]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-31011.rs
Enable full revision in const generics ui tests
[rust.git] / src / test / ui / issues / issue-31011.rs
1 macro_rules! log {
2     ( $ctx:expr, $( $args:expr),* ) => {
3         if $ctx.trace {
4         //~^ no field `trace` on type `&T`
5             println!( $( $args, )* );
6         }
7     }
8 }
9
10 // Create a structure.
11 struct Foo {
12   trace: bool,
13 }
14
15 // Generic wrapper calls log! with a structure.
16 fn wrap<T>(context: &T) -> ()
17 {
18     log!(context, "entered wrapper");
19     //~^ in this expansion of log!
20 }
21
22 fn main() {
23     // Create a structure.
24     let x = Foo { trace: true };
25     log!(x, "run started");
26     // Apply a closure which accesses internal fields.
27     wrap(&x);
28     log!(x, "run finished");
29 }