]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/closures/2229_closure_analysis/diagnostics/liveness.rs
4 #![allow(unreachable_code)]
15 let mut c
= Point{ x:1, y:0 }
;
17 // Captured by value, but variable is dead on entry.
19 // This will not trigger a warning for unused variable as
20 // c.x will be treated as a Non-tracked place
23 a
= 1; //~ WARN value captured by `a` is never read
27 // Read and written to, but never actually used.
29 // This will not trigger a warning for unused variable as
30 // c.x will be treated as a Non-tracked place
32 a
+= 1; //~ WARN unused variable: `a`
37 // Value is read by closure itself on later invocations.
38 // This will not trigger a warning for unused variable as
39 // c.x will be treated as a Non-tracked place
47 // Never read because this is FnOnce closure.
48 // This will not trigger a warning for unused variable as
49 // c.x will be treated as a Non-tracked place
52 a
+= 1; //~ WARN value assigned to `a` is never read
64 let mut a
: Option
<& str>;
66 let mut b
: Option
<& str>;
68 let mut d
= MyStruct{ x: None, y: 1}
;
69 let mut e
= MyStruct{ x: None, y: 1}
;
72 // This will not trigger a warning for unused variable as
73 // d.x will be treated as a Non-tracked place
76 a
= Some("d1"); //~ WARN value assigned to `a` is never read
80 // This will not trigger a warning for unused variable as
81 //e.x will be treated as a Non-tracked place
84 b
= Some("e1"); //~ WARN value assigned to `b` is never read
85 //~| WARN unused variable: `b`
86 b
= Some("e2"); //~ WARN value assigned to `b` is never read