]> git.lizzy.rs Git - rust.git/blob - tests/ui/use/use-after-move-implicity-coerced-object.stderr
Don't resolve type var roots in point_at_expr_source_of_inferred_type
[rust.git] / tests / ui / use / use-after-move-implicity-coerced-object.stderr
1 error[E0382]: borrow of moved value: `n`
2   --> $DIR/use-after-move-implicity-coerced-object.rs:28:13
3    |
4 LL |     let n: Box<_> = Number { n: 42 }.into();
5    |         - move occurs because `n` has type `Box<Number>`, which does not implement the `Copy` trait
6 LL |     let mut l: Box<_> = List { list: Vec::new() }.into();
7 LL |     l.push(n);
8    |            - value moved here
9 LL |
10 LL |     let x = n.to_string();
11    |             ^^^^^^^^^^^^^ value borrowed here after move
12    |
13 note: consider changing this parameter type in method `push` to borrow instead if owning the value isn't necessary
14   --> $DIR/use-after-move-implicity-coerced-object.rs:17:27
15    |
16 LL |     fn push(&mut self, n: Box<dyn ToString + 'static>) {
17    |        ----               ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this parameter takes ownership of the value
18    |        |
19    |        in this method
20
21 error: aborting due to previous error
22
23 For more information about this error, try `rustc --explain E0382`.