1 // 2 // run-pass 3 // 4 // Description - ensure Interpolated blocks can act as valid function bodies 5 // Covered cases: free functions, struct methods, and default trait functions 6 7 macro_rules! def_fn { 8 ($body:block) => { 9 fn bar() $body 10 } 11 } 12 13 trait Foo { 14 def_fn!({ println!("foo"); }); 15 } 16 17 struct Baz {} 18 19 impl Foo for Baz {} 20 21 struct Qux {} 22 23 impl Qux { 24 def_fn!({ println!("qux"); }); 25 } 26 27 def_fn!({ println!("quux"); }); 28 main()29pub fn main() { 30 Baz::bar(); 31 Qux::bar(); 32 bar(); 33 } 34