const param macro test
This commit is contained in:
parent
25f6938da4
commit
d76cdb052e
22
src/test/ui/const-generics/const-param-hygiene.rs
Normal file
22
src/test/ui/const-generics/const-param-hygiene.rs
Normal file
@ -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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user