forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
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#87559 - estebank:consider-borrowing, r=oli-obk
Tweak borrowing suggestion in `for` loop
- Loading branch information
Showing
5 changed files
with
76 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
error[E0507]: cannot move out of `self.v` which is behind a shared reference | ||
--> $DIR/for-i-in-vec.rs:10:18 | ||
--> $DIR/for-i-in-vec.rs:11:18 | ||
| | ||
LL | for _ in self.v { | ||
| ^^^^^^ | ||
| | | ||
| move occurs because `self.v` has type `Vec<u32>`, which does not implement the `Copy` trait | ||
| help: consider iterating over a slice of the `Vec<_>`'s content: `&self.v` | ||
| ^^^^^^ move occurs because `self.v` has type `Vec<u32>`, which does not implement the `Copy` trait | ||
| | ||
help: consider iterating over a slice of the `Vec<u32>`'s content | ||
| | ||
LL | for _ in &self.v { | ||
| ^ | ||
|
||
error[E0507]: cannot move out of `self.h` which is behind a shared reference | ||
--> $DIR/for-i-in-vec.rs:13:18 | ||
| | ||
LL | for _ in self.h { | ||
| ^^^^^^ move occurs because `self.h` has type `HashMap<i32, i32>`, which does not implement the `Copy` trait | ||
| | ||
help: consider iterating over a slice of the `HashMap<i32, i32>`'s content | ||
| | ||
LL | for _ in &self.h { | ||
| ^ | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0507`. |
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