-
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.
Rollup merge of #81325 - osa1:issue81293, r=estebank
typeck: Don't suggest converting LHS exprs Converting LHS of an assignment does not work, so avoid suggesting that. Fixes #81293
- Loading branch information
Showing
4 changed files
with
51 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
fn main() { | ||
let a: u16; | ||
let b: u16 = 42; | ||
let c: usize = 5; | ||
|
||
a = c + b * 5; //~ ERROR: mismatched types [E0308] | ||
//~| ERROR: mismatched types [E0308] | ||
//~| ERROR: cannot add `u16` to `usize` [E0277] | ||
} |
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[E0308]: mismatched types | ||
--> $DIR/issue-81293.rs:6:13 | ||
| | ||
LL | a = c + b * 5; | ||
| ^^^^^ expected `usize`, found `u16` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-81293.rs:6:9 | ||
| | ||
LL | a = c + b * 5; | ||
| ^^^^^^^^^ expected `u16`, found `usize` | ||
|
||
error[E0277]: cannot add `u16` to `usize` | ||
--> $DIR/issue-81293.rs:6:11 | ||
| | ||
LL | a = c + b * 5; | ||
| ^ no implementation for `usize + u16` | ||
| | ||
= help: the trait `Add<u16>` is not implemented for `usize` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0277, E0308. | ||
For more information about an error, try `rustc --explain E0277`. |