Skip to content

Commit 0407348

Browse files
committed
Add run-pass test for 2015 edition code using 2018 edition macros with edition-gated keywords
1 parent 0eabb1b commit 0407348

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags: -Zedition=2018 -Zunstable-options
12+
#![feature(raw_identifiers)]
13+
14+
#[macro_export]
15+
macro_rules! produces_async {
16+
() => (pub fn async() {})
17+
}
18+
19+
#[macro_export]
20+
macro_rules! produces_async_raw {
21+
() => (pub fn r#async() {})
22+
}
23+
24+
#[macro_export]
25+
macro_rules! consumes_async_raw {
26+
(r#async) => (1)
27+
}
28+
29+
#[macro_export]
30+
macro_rules! consumes_ident {
31+
($i:ident) => ($i)
32+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags: -Zedition=2015 -Zunstable-options
12+
// aux-build:edition-kw-macro-2018.rs
13+
14+
#![feature(raw_identifiers)]
15+
16+
#[macro_use]
17+
extern crate edition_kw_macro_2018;
18+
19+
20+
pub fn main() {
21+
let mut async = 1;
22+
async = consumes_async_raw!(r#async);
23+
async = consumes_async_raw!(async);
24+
if r#async == 1 {
25+
26+
}
27+
if consumes_ident!(r#async) == 1 {
28+
// ...
29+
}
30+
if consumes_ident!(async) == 1 {
31+
// ...
32+
}
33+
one::r#async();
34+
two::r#async();
35+
one::async();
36+
two::async();
37+
}
38+
39+
40+
mod one {
41+
produces_async! {}
42+
}
43+
mod two {
44+
produces_async_raw! {}
45+
}

0 commit comments

Comments
 (0)