From d76cdb052e8ee95b8baa96fc19771c169d7b424a Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Tue, 10 Nov 2020 09:29:27 +0100 Subject: [PATCH] const param macro test --- .../ui/const-generics/const-param-hygiene.rs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/test/ui/const-generics/const-param-hygiene.rs diff --git a/src/test/ui/const-generics/const-param-hygiene.rs b/src/test/ui/const-generics/const-param-hygiene.rs new file mode 100644 index 00000000000..c8cefc36732 --- /dev/null +++ b/src/test/ui/const-generics/const-param-hygiene.rs @@ -0,0 +1,22 @@ +// run-pass +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] + +macro_rules! bar { + ($($t:tt)*) => { impl $($t)* }; +} + +macro_rules! baz { + ($t:tt) => { fn test(&self) -> usize { $t } }; +} + +struct Foo; + +bar!(Foo { baz!{ M } }); + +fn main() { + assert_eq!(Foo::<7>.test::<3>(), 3); +}