-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On nightly with NLL, suggest `#![feature(bind_by_move_pattern_guards)…
…]` when it might fix the code.
- Loading branch information
Showing
5 changed files
with
75 additions
and
8 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
11 changes: 11 additions & 0 deletions
11
src/test/ui/bind-by-move/bind-by-move-no-guards.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0008]: cannot bind by-move into a pattern guard | ||
--> $DIR/bind-by-move-no-guards.rs:8:14 | ||
| | ||
LL | Some(z) if z.recv().unwrap() => { panic!() }, | ||
| ^ moves value into pattern guard | ||
| | ||
= help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0008`. |
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,24 @@ | ||
error[E0302]: cannot assign in a pattern guard | ||
--> $DIR/borrowck-mutate-in-guard.rs:20:25 | ||
| | ||
LL | Enum::A(_) if { x = Enum::B(false); false } => 1, | ||
| ^^^^^^^^^^^^^^^^^^ assignment in pattern guard | ||
|
||
error[E0301]: cannot mutably borrow in a pattern guard | ||
--> $DIR/borrowck-mutate-in-guard.rs:22:38 | ||
| | ||
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1, | ||
| ^ borrowed mutably in pattern guard | ||
| | ||
= help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable | ||
|
||
error[E0302]: cannot assign in a pattern guard | ||
--> $DIR/borrowck-mutate-in-guard.rs:22:41 | ||
| | ||
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1, | ||
| ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors occurred: E0301, E0302. | ||
For more information about an error, try `rustc --explain E0301`. |
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,11 @@ | ||
error[E0008]: cannot bind by-move into a pattern guard | ||
--> $DIR/E0008.rs:13:14 | ||
| | ||
LL | Some(s) if s.len() == 0 => {}, | ||
| ^ moves value into pattern guard | ||
| | ||
= help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0008`. |
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,11 @@ | ||
error[E0301]: cannot mutably borrow in a pattern guard | ||
--> $DIR/E0301.rs:14:19 | ||
| | ||
LL | option if option.take().is_none() => {}, //~ ERROR E0301 | ||
| ^^^^^^ borrowed mutably in pattern guard | ||
| | ||
= help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0301`. |