-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Erase regions when checking for missing Copy predicates
- Loading branch information
1 parent
38a0b81
commit 5ddaa2d
Showing
3 changed files
with
41 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
pub struct DataStruct(); | ||
|
||
pub struct HelperStruct<'n> { | ||
pub helpers: [Vec<&'n i64>; 2], | ||
pub is_empty: bool, | ||
} | ||
|
||
impl DataStruct { | ||
pub fn f(&self) -> HelperStruct { | ||
let helpers = [vec![], vec![]]; | ||
|
||
HelperStruct { helpers, is_empty: helpers[0].is_empty() } | ||
//~^ ERROR borrow of moved value | ||
} | ||
} | ||
|
||
fn main() {} |
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,14 @@ | ||
error[E0382]: borrow of moved value: `helpers` | ||
--> $DIR/copy-suggestion-region-vid.rs:12:43 | ||
| | ||
LL | let helpers = [vec![], vec![]]; | ||
| ------- move occurs because `helpers` has type `[Vec<&i64>; 2]`, which does not implement the `Copy` trait | ||
LL | | ||
LL | HelperStruct { helpers, is_empty: helpers[0].is_empty() } | ||
| ------- ^^^^^^^^^^^^^^^^^^^^^ value borrowed here after move | ||
| | | ||
| value moved here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0382`. |