forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#57294 - estebank:point-copy-less, r=nikomat…
…sakis When using value after move, point at span of local When trying to use a value after move, instead of using a note, point at the local declaration that has a type that doesn't implement `Copy` trait. ``` error[E0382]: use of moved value: `x` --> $DIR/issue-34721.rs:27:9 | LL | pub fn baz<T: Foo>(x: T) -> T { | - - move occurs because `x` has type `T`, which does not implement the `Copy` trait | | | consider adding a `Copy` constraint to this type argument LL | if 0 == 1 { LL | bar::bar(x.zero()) | - value moved here LL | } else { LL | x.zero() | - value moved here LL | }; LL | x.zero() | ^ value used here after move ``` Fix rust-lang#34721.
- Loading branch information
Showing
23 changed files
with
175 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/test/ui/issues/issue-27282-move-match-input-into-guard.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#![feature(nll)] | ||
|
||
pub trait Foo { | ||
fn zero(self) -> Self; | ||
} | ||
|
||
impl Foo for u32 { | ||
fn zero(self) -> u32 { 0u32 } | ||
} | ||
|
||
pub mod bar { | ||
pub use Foo; | ||
pub fn bar<T: Foo>(x: T) -> T { | ||
x.zero() | ||
} | ||
} | ||
|
||
mod baz { | ||
use bar; | ||
use Foo; | ||
pub fn baz<T: Foo>(x: T) -> T { | ||
if 0 == 1 { | ||
bar::bar(x.zero()) | ||
} else { | ||
x.zero() | ||
}; | ||
x.zero() | ||
//~^ ERROR use of moved value | ||
} | ||
} | ||
|
||
fn main() { | ||
let _ = baz::baz(0u32); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error[E0382]: use of moved value: `x` | ||
--> $DIR/issue-34721.rs:27:9 | ||
| | ||
LL | pub fn baz<T: Foo>(x: T) -> T { | ||
| - - move occurs because `x` has type `T`, which does not implement the `Copy` trait | ||
| | | ||
| consider adding a `Copy` constraint to this type argument | ||
LL | if 0 == 1 { | ||
LL | bar::bar(x.zero()) | ||
| - value moved here | ||
LL | } else { | ||
LL | x.zero() | ||
| - value moved here | ||
LL | }; | ||
LL | x.zero() | ||
| ^ value used here after move | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0382`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.