1 struct Example<const N: usize>; 2 3 macro_rules! external_macro { 4 () => {{ 5 //~^ ERROR expected type 6 const X: usize = 1337; 7 X 8 }} 9 } 10 11 trait Marker<const N: usize> {} 12 impl<const N: usize> Marker<N> for Example<N> {} 13 make_marker() -> impl Marker<gimme_a_const!(marker)>14fn make_marker() -> impl Marker<gimme_a_const!(marker)> { 15 //~^ ERROR: type provided when a constant was expected 16 Example::<gimme_a_const!(marker)> 17 //~^ ERROR: type provided when a constant was expected 18 } 19 20 fn from_marker(_: impl Marker<{ 21 #[macro_export] 22 macro_rules! inline { () => {{ 3 }} }; inline!() 23 }>) {} 24 main()25fn main() { 26 let _ok = Example::<{ 27 #[macro_export] 28 macro_rules! gimme_a_const { 29 ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} 30 //~^ ERROR expected type 31 //~| ERROR expected type 32 }; 33 gimme_a_const!(run) 34 }>; 35 36 let _fail = Example::<external_macro!()>; 37 //~^ ERROR: type provided when a constant was expected 38 39 let _fail = Example::<gimme_a_const!()>; 40 //~^ ERROR: type provided when a constant was expected 41 //~| ERROR unexpected end of macro invocation 42 } 43