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.
Only suppress binop error in favor of semicolon suggestion if we're i…
…n an assignment statement
- Loading branch information
1 parent
5baee04
commit a02aba7
Showing
3 changed files
with
47 additions
and
1 deletion.
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,14 @@ | ||
pub fn bad(x: &mut bool) { | ||
if true | ||
*x = true {} | ||
//~^ ERROR cannot multiply `bool` by `&mut bool` | ||
} | ||
|
||
pub fn bad2(x: &mut bool) { | ||
let y: bool; | ||
y = true | ||
*x = true; | ||
//~^ ERROR cannot multiply `bool` by `&mut bool` | ||
} | ||
|
||
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,29 @@ | ||
error[E0369]: cannot multiply `bool` by `&mut bool` | ||
--> $DIR/nested-assignment-may-be-deref.rs:3:5 | ||
| | ||
LL | if true | ||
| ---- bool | ||
LL | *x = true {} | ||
| ^- &mut bool | ||
| | ||
help: you might have meant to write a semicolon here | ||
| | ||
LL | if true; | ||
| + | ||
|
||
error[E0369]: cannot multiply `bool` by `&mut bool` | ||
--> $DIR/nested-assignment-may-be-deref.rs:10:5 | ||
| | ||
LL | y = true | ||
| ---- bool | ||
LL | *x = true; | ||
| ^- &mut bool | ||
| | ||
help: you might have meant to write a semicolon here | ||
| | ||
LL | y = true; | ||
| + | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0369`. |