|
1 |
| -error[E0382]: use of moved value: `bar` |
2 |
| - --> $DIR/suggest-borrow-for-generic-arg.rs:12:16 |
| 1 | +error[E0382]: borrow of moved value: `stdout` |
| 2 | + --> $DIR/suggest-borrow-for-generic-arg.rs:14:14 |
3 | 3 | |
|
4 |
| -LL | let bar = aux::Bar; |
5 |
| - | --- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait |
6 |
| -LL | aux::foo(bar); |
7 |
| - | --- value moved here |
8 |
| -LL | let _baa = bar; |
9 |
| - | ^^^ value used here after move |
| 4 | +LL | let mut stdout = io::stdout(); |
| 5 | + | ---------- move occurs because `stdout` has type `Stdout`, which does not implement the `Copy` trait |
| 6 | +LL | aux::write_stuff(stdout)?; |
| 7 | + | ------ value moved here |
| 8 | +LL | writeln!(stdout, "second line")?; |
| 9 | + | ^^^^^^ value borrowed here after move |
10 | 10 | |
|
11 |
| -help: consider borrowing `bar` |
| 11 | +help: consider borrowing `stdout` |
12 | 12 | |
|
13 |
| -LL | aux::foo(&bar); |
14 |
| - | + |
| 13 | +LL | aux::write_stuff(&stdout)?; |
| 14 | + | + |
15 | 15 |
|
16 |
| -error[E0382]: use of moved value: `bar` |
17 |
| - --> $DIR/suggest-borrow-for-generic-arg.rs:15:16 |
| 16 | +error[E0382]: borrow of moved value: `buf` |
| 17 | + --> $DIR/suggest-borrow-for-generic-arg.rs:19:14 |
18 | 18 | |
|
19 |
| -LL | let mut bar = aux::Bar; |
20 |
| - | ------- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait |
21 |
| -LL | aux::qux(bar); |
22 |
| - | --- value moved here |
23 |
| -LL | let _baa = bar; |
24 |
| - | ^^^ value used here after move |
| 19 | +LL | let mut buf = Vec::new(); |
| 20 | + | ------- move occurs because `buf` has type `Vec<u8>`, which does not implement the `Copy` trait |
| 21 | +LL | aux::write_stuff(buf)?; |
| 22 | + | --- value moved here |
| 23 | +LL | |
| 24 | +LL | writeln!(buf, "second_line") |
| 25 | + | ^^^ value borrowed here after move |
25 | 26 | |
|
26 |
| -help: consider mutably borrowing `bar` |
| 27 | +help: consider mutably borrowing `buf` |
27 | 28 | |
|
28 |
| -LL | aux::qux(&mut bar); |
29 |
| - | ++++ |
| 29 | +LL | aux::write_stuff(&mut buf)?; |
| 30 | + | ++++ |
| 31 | +help: consider cloning the value if the performance cost is acceptable |
| 32 | + | |
| 33 | +LL | aux::write_stuff(buf.clone())?; |
| 34 | + | ++++++++ |
30 | 35 |
|
31 |
| -error[E0382]: use of moved value: `bar` |
32 |
| - --> $DIR/suggest-borrow-for-generic-arg.rs:18:16 |
| 36 | +error[E0382]: use of moved value: `stdin` |
| 37 | + --> $DIR/suggest-borrow-for-generic-arg.rs:26:27 |
33 | 38 | |
|
34 |
| -LL | let bar = aux::Bar; |
35 |
| - | --- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait |
36 |
| -LL | aux::bat(bar); |
37 |
| - | --- value moved here |
38 |
| -LL | let _baa = bar; |
39 |
| - | ^^^ value used here after move |
| 39 | +LL | let stdin = io::stdin(); |
| 40 | + | ----- move occurs because `stdin` has type `Stdin`, which does not implement the `Copy` trait |
| 41 | +LL | aux::read_and_discard(stdin)?; |
| 42 | + | ----- value moved here |
| 43 | +LL | aux::read_and_discard(stdin)?; |
| 44 | + | ^^^^^ value used here after move |
40 | 45 | |
|
41 |
| -help: consider borrowing `bar` |
| 46 | +help: consider borrowing `stdin` |
42 | 47 | |
|
43 |
| -LL | aux::bat(&bar); |
44 |
| - | + |
| 48 | +LL | aux::read_and_discard(&stdin)?; |
| 49 | + | + |
45 | 50 |
|
46 |
| -error[E0382]: use of moved value: `bar` |
47 |
| - --> $DIR/suggest-borrow-for-generic-arg.rs:21:16 |
| 51 | +error[E0382]: use of moved value: `bytes` |
| 52 | + --> $DIR/suggest-borrow-for-generic-arg.rs:31:27 |
| 53 | + | |
| 54 | +LL | let mut bytes = std::collections::VecDeque::from([1, 2, 3, 4, 5, 6]); |
| 55 | + | --------- move occurs because `bytes` has type `VecDeque<u8>`, which does not implement the `Copy` trait |
| 56 | +LL | aux::read_and_discard(bytes)?; |
| 57 | + | ----- value moved here |
| 58 | +LL | |
| 59 | +LL | aux::read_and_discard(bytes) |
| 60 | + | ^^^^^ value used here after move |
| 61 | + | |
| 62 | +help: consider mutably borrowing `bytes` |
| 63 | + | |
| 64 | +LL | aux::read_and_discard(&mut bytes)?; |
| 65 | + | ++++ |
| 66 | +help: consider cloning the value if the performance cost is acceptable |
| 67 | + | |
| 68 | +LL | aux::read_and_discard(bytes.clone())?; |
| 69 | + | ++++++++ |
| 70 | + |
| 71 | +error[E0382]: use of moved value: `iter` |
| 72 | + --> $DIR/suggest-borrow-for-generic-arg.rs:39:42 |
| 73 | + | |
| 74 | +LL | let mut iter = [1, 2, 3, 4, 5, 6].into_iter(); |
| 75 | + | -------- move occurs because `iter` has type `std::array::IntoIter<usize, 6>`, which does not implement the `Copy` trait |
| 76 | +LL | let _six: usize = aux::sum_three(iter); |
| 77 | + | ---- value moved here |
| 78 | +LL | |
| 79 | +LL | let _fifteen: usize = aux::sum_three(iter); |
| 80 | + | ^^^^ value used here after move |
48 | 81 | |
|
49 |
| -LL | let mut bar = aux::Bar; |
50 |
| - | ------- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait |
51 |
| -LL | aux::baz(bar); |
52 |
| - | --- value moved here |
53 |
| -LL | let _baa = bar; |
54 |
| - | ^^^ value used here after move |
| 82 | +help: consider mutably borrowing `iter` |
55 | 83 | |
|
56 |
| -help: consider mutably borrowing `bar` |
| 84 | +LL | let _six: usize = aux::sum_three(&mut iter); |
| 85 | + | ++++ |
| 86 | +help: consider cloning the value if the performance cost is acceptable |
57 | 87 | |
|
58 |
| -LL | aux::baz(&mut bar); |
59 |
| - | ++++ |
| 88 | +LL | let _six: usize = aux::sum_three(iter.clone()); |
| 89 | + | ++++++++ |
60 | 90 |
|
61 |
| -error: aborting due to 4 previous errors |
| 91 | +error: aborting due to 5 previous errors |
62 | 92 |
|
63 | 93 | For more information about this error, try `rustc --explain E0382`.
|
0 commit comments