-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #117892 - estebank:fat-arrow-typo, r=compiler-errors
Detect more `=>` typos Handle and recover `match expr { pat >= { arm } }`.
- Loading branch information
Showing
5 changed files
with
51 additions
and
10 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,7 @@ | ||
// run-rustfix | ||
fn main() { | ||
match 1 { | ||
1 => {} //~ ERROR | ||
_ => { let _: u16 = 2u16; } //~ ERROR | ||
} | ||
} |
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,7 @@ | ||
// run-rustfix | ||
fn main() { | ||
match 1 { | ||
1 >= {} //~ ERROR | ||
_ => { let _: u16 = 2u8; } //~ ERROR | ||
} | ||
} |
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,25 @@ | ||
error: expected one of `...`, `..=`, `..`, `=>`, `if`, or `|`, found `>=` | ||
--> $DIR/recover-ge-as-fat-arrow.rs:4:11 | ||
| | ||
LL | 1 >= {} | ||
| ^^ | ||
| | | ||
| expected one of `...`, `..=`, `..`, `=>`, `if`, or `|` | ||
| help: use a fat arrow to start a match arm: `=>` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/recover-ge-as-fat-arrow.rs:5:29 | ||
| | ||
LL | _ => { let _: u16 = 2u8; } | ||
| --- ^^^ expected `u16`, found `u8` | ||
| | | ||
| expected due to this | ||
| | ||
help: change the type of the numeric literal from `u8` to `u16` | ||
| | ||
LL | _ => { let _: u16 = 2u16; } | ||
| ~~~ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |