Skip to content

Commit

Permalink
Add test for #[rustc_per_edition].
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Feb 24, 2021
1 parent 2655bc9 commit a7c7fe6
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/test/ui/editions/auxiliary/per-edition.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// edition:2015

#![feature(rustc_attrs)]

#[rustc_per_edition]
pub type I32OrStr = (
i32, // 2015
&'static str, // 2018+
);

pub type I32 = I32OrStr;

pub use I32OrStr as Magic;

#[macro_export]
macro_rules! int {
() => {
$crate::I32OrStr
}
}

#[macro_export]
macro_rules! x {
() => {
X
}
}
24 changes: 24 additions & 0 deletions src/test/ui/editions/rustc-per-edition.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// check-pass
// edition:2021
// aux-build:per-edition.rs

#![feature(rustc_attrs)]

#[macro_use]
extern crate per_edition;

#[rustc_per_edition]
type X = (
u32, // 2015
&'static str, // 2018,
f64, // 2021+
);

fn main() {
let _: X = 6.28;
let _: per_edition::I32 = 1i32;
let _: per_edition::I32OrStr = "hello";
let _: per_edition::Magic = "world";
let _: per_edition::int!() = 2i32;
let _: per_edition::x!() = 3u32;
}

0 comments on commit a7c7fe6

Please sign in to comment.