]> git.lizzy.rs Git - rust.git/blob - src/test/ui/liveness/liveness-dead.rs
Rollup merge of #87440 - twetzel59:fix-barrier-no-op, r=yaahc
[rust.git] / src / test / ui / liveness / liveness-dead.rs
1 #![allow(dead_code)]
2 #![deny(unused_assignments)]
3
4 fn f1(x: &mut isize) {
5     *x = 1; // no error
6 }
7
8 fn f2() {
9     let mut x: isize = 3; //~ ERROR: value assigned to `x` is never read
10     x = 4;
11     x.clone();
12 }
13
14 fn f3() {
15     let mut x: isize = 3;
16     x.clone();
17     x = 4; //~ ERROR: value assigned to `x` is never read
18 }
19
20 fn f4(mut x: i32) { //~ ERROR: value passed to `x` is never read
21     x = 4;
22     x.clone();
23 }
24
25 fn f5(mut x: i32) {
26     x.clone();
27     x = 4; //~ ERROR: value assigned to `x` is never read
28 }
29
30 // #22630
31 fn f6() {
32     let mut done = false;
33     while !done {
34         done = true; // no error
35         continue;
36     }
37 }
38
39 fn main() {}