mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
546ba3d310
Fixes issue 133118. This also modifies `tests/ui/moves/moved-value-on-as-ref-arg.rs` to have more useful bounds on the tests for suggestions to borrow `Borrow` and `BorrowMut` arguments. With its old tautological `T: BorrowMut<T>` bound, this fix would make it suggest a shared borrow for that argument.
22 lines
809 B
Plaintext
22 lines
809 B
Plaintext
error[E0382]: use of moved value: `g1`
|
|
--> $DIR/region-var-in-moved-ty-issue-133118.rs:22:15
|
|
|
|
|
LL | let g1 = beta.gamma();
|
|
| -- move occurs because `g1` has type `<&B as Beta>::Gamma`, which does not implement the `Copy` trait
|
|
LL | a(g1) + a(g1)
|
|
| -- ^^ value used here after move
|
|
| |
|
|
| value moved here
|
|
|
|
|
note: consider changing this parameter type in function `a` to borrow instead if owning the value isn't necessary
|
|
--> $DIR/region-var-in-moved-ty-issue-133118.rs:12:24
|
|
|
|
|
LL | pub fn a<T: Alpha>(_x: T) -> usize {
|
|
| - ^ this parameter takes ownership of the value
|
|
| |
|
|
| in this function
|
|
|
|
error: aborting due to 1 previous error
|
|
|
|
For more information about this error, try `rustc --explain E0382`.
|