-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #123736 - compiler-errors:multiply-on-rhs, r=estebank
Don't delay a bug if we suggest adding a semicolon to the RHS of an assign operator It only makes sense to delay a bug based on the assumption that "[we] defer to the later error produced by `check_lhs_assignable`" *if* the expression we're erroring actually is an LHS; otherwise, we should still report the error since it's both useful and required. Fixes #123722
- Loading branch information
Showing
3 changed files
with
34 additions
and
4 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,8 @@ | ||
pub fn test(y: &i32) { | ||
let x; | ||
x = () | ||
*y | ||
//~^ ERROR cannot multiply `()` by `&i32` | ||
} | ||
|
||
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,16 @@ | ||
error[E0369]: cannot multiply `()` by `&i32` | ||
--> $DIR/multiply-is-deref-on-rhs.rs:4:5 | ||
| | ||
LL | x = () | ||
| -- () | ||
LL | *y | ||
| ^- &i32 | ||
| | ||
help: you might have meant to write a semicolon here | ||
| | ||
LL | x = (); | ||
| + | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0369`. |