mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +00:00
18 lines
290 B
Rust
18 lines
290 B
Rust
//@ run-pass
|
|
|
|
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);
|
|
}
|