4 #![allow(unreachable_code)]
16 let mut c = Point{ x:1, y:0 };
18 // Captured by value, but variable is dead on entry.
20 // This will not trigger a warning for unused variable as
21 // c.x will be treated as a Non-tracked place
24 a = 1; //~ WARN value captured by `a` is never read
28 // Read and written to, but never actually used.
30 // This will not trigger a warning for unused variable as
31 // c.x will be treated as a Non-tracked place
33 a += 1; //~ WARN unused variable: `a`
38 // Value is read by closure itself on later invocations.
39 // This will not trigger a warning for unused variable as
40 // c.x will be treated as a Non-tracked place
48 // Never read because this is FnOnce closure.
49 // This will not trigger a warning for unused variable as
50 // c.x will be treated as a Non-tracked place
53 a += 1; //~ WARN value assigned to `a` is never read
65 let mut a : Option<& str>;
67 let mut b : Option<& str>;
69 let mut d = MyStruct{ x: None, y: 1};
70 let mut e = MyStruct{ x: None, y: 1};
73 // This will not trigger a warning for unused variable as
74 // d.x will be treated as a Non-tracked place
77 a = Some("d1"); //~ WARN value assigned to `a` is never read
81 // This will not trigger a warning for unused variable as
82 //e.x will be treated as a Non-tracked place
85 b = Some("e1"); //~ WARN value assigned to `b` is never read
86 //~| WARN unused variable: `b`
87 b = Some("e2"); //~ WARN value assigned to `b` is never read