diff options
| author | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-11-10 09:29:27 +0100 |
|---|---|---|
| committer | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-11-10 09:51:01 +0100 |
| commit | d76cdb052e8ee95b8baa96fc19771c169d7b424a (patch) | |
| tree | fee03b864115bada2d491cef87f669574bf840ac | |
| parent | 25f6938da459a57b43bdf16ed6bdad3225b2a3ce (diff) | |
| download | rust-d76cdb052e8ee95b8baa96fc19771c169d7b424a.tar.gz rust-d76cdb052e8ee95b8baa96fc19771c169d7b424a.zip | |
const param macro test
| -rw-r--r-- | src/test/ui/const-generics/const-param-hygiene.rs | 22 |
1 files changed, 22 insertions, 0 deletions
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<const N: usize> $($t)* }; +} + +macro_rules! baz { + ($t:tt) => { fn test<const M: usize>(&self) -> usize { $t } }; +} + +struct Foo<const N: usize>; + +bar!(Foo<N> { baz!{ M } }); + +fn main() { + assert_eq!(Foo::<7>.test::<3>(), 3); +} |
