fork/rust

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

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

master
1.2 KiB24 linesraw
1error[E0382]: borrow of moved value: `message`
2  --> $DIR/liveness-use-after-send.rs:16:20
3   |
4LL | fn test00_start(ch: Chan<Box<isize>>, message: Box<isize>, _count: Box<isize>) {
5   |                                       ------- move occurs because `message` has type `Box<isize>`, which does not implement the `Copy` trait
6LL |     send(ch, message);
7   |              ------- value moved here
8LL |     println!("{}", message);
9   |                    ^^^^^^^ value borrowed here after move
10   |
11note: consider changing this parameter type in function `send` to borrow instead if owning the value isn't necessary
12  --> $DIR/liveness-use-after-send.rs:3:54
13   |
14LL | fn send<T:Send + std::fmt::Debug>(ch: Chan<T>, data: T) {
15   |    ---- in this function                             ^ this parameter takes ownership of the value
16   = 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)
17help: consider cloning the value if the performance cost is acceptable
18   |
19LL |     send(ch, message.clone());
20   |                     ++++++++
21
22error: aborting due to previous error
23
24For more information about this error, try `rustc --explain E0382`.