Skip to content

Commit a7c7fe6

Browse files
committed
Add test for #[rustc_per_edition].
1 parent 2655bc9 commit a7c7fe6

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// edition:2015
2+
3+
#![feature(rustc_attrs)]
4+
5+
#[rustc_per_edition]
6+
pub type I32OrStr = (
7+
i32, // 2015
8+
&'static str, // 2018+
9+
);
10+
11+
pub type I32 = I32OrStr;
12+
13+
pub use I32OrStr as Magic;
14+
15+
#[macro_export]
16+
macro_rules! int {
17+
() => {
18+
$crate::I32OrStr
19+
}
20+
}
21+
22+
#[macro_export]
23+
macro_rules! x {
24+
() => {
25+
X
26+
}
27+
}
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// check-pass
2+
// edition:2021
3+
// aux-build:per-edition.rs
4+
5+
#![feature(rustc_attrs)]
6+
7+
#[macro_use]
8+
extern crate per_edition;
9+
10+
#[rustc_per_edition]
11+
type X = (
12+
u32, // 2015
13+
&'static str, // 2018,
14+
f64, // 2021+
15+
);
16+
17+
fn main() {
18+
let _: X = 6.28;
19+
let _: per_edition::I32 = 1i32;
20+
let _: per_edition::I32OrStr = "hello";
21+
let _: per_edition::Magic = "world";
22+
let _: per_edition::int!() = 2i32;
23+
let _: per_edition::x!() = 3u32;
24+
}

0 commit comments

Comments
 (0)