fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.0 KiB46 linesraw
1warning: denote infinite loops with `loop { ... }`
2  --> $DIR/liveness-move-in-while.rs:8:9
3   |
4LL |         while true { while true { while true { x = y; x.clone(); } } }
5   |         ^^^^^^^^^^ help: use `loop`
6   |
7   = note: `#[warn(while_true)]` on by default
8
9warning: denote infinite loops with `loop { ... }`
10  --> $DIR/liveness-move-in-while.rs:8:22
11   |
12LL |         while true { while true { while true { x = y; x.clone(); } } }
13   |                      ^^^^^^^^^^ help: use `loop`
14
15warning: denote infinite loops with `loop { ... }`
16  --> $DIR/liveness-move-in-while.rs:8:35
17   |
18LL |         while true { while true { while true { x = y; x.clone(); } } }
19   |                                   ^^^^^^^^^^ help: use `loop`
20
21error[E0382]: borrow of moved value: `y`
22  --> $DIR/liveness-move-in-while.rs:7:24
23   |
24LL |     let y: Box<isize> = 42.into();
25   |         - move occurs because `y` has type `Box<isize>`, which does not implement the `Copy` trait
26...
27LL |     loop {
28   |     ---- inside of this loop
29LL |         println!("{}", y);
30   |                        ^ value borrowed here after move
31LL |         while true { while true { while true { x = y; x.clone(); } } }
32   |         ----------   ----------   ----------       - value moved here, in previous iteration of loop
33   |         |            |            |
34   |         |            |            inside of this loop
35   |         |            inside of this loop
36   |         inside of this loop
37   |
38   = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
39help: consider cloning the value if the performance cost is acceptable
40   |
41LL |         while true { while true { while true { x = y.clone(); x.clone(); } } }
42   |                                                     ++++++++
43
44error: aborting due to previous error; 3 warnings emitted
45
46For more information about this error, try `rustc --explain E0382`.