-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't use bytepos offsets when computing semicolon span for removal
- Loading branch information
1 parent
e78913b
commit fc06582
Showing
3 changed files
with
44 additions
and
2 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,10 @@ | ||
// Ensures our "remove semicolon" suggestion isn't hardcoded with a character width, | ||
// in case it was accidentally mixed up with a greek question mark. | ||
|
||
pub fn square(num: i32) -> i32 { | ||
//~^ ERROR mismatched types | ||
num * num; | ||
//~^ ERROR unknown start of token | ||
} | ||
|
||
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,25 @@ | ||
error: unknown start of token: \u{37e} | ||
--> $DIR/remove-semi-but-confused-char.rs:6:14 | ||
| | ||
LL | num * num; | ||
| ^ | ||
| | ||
help: Unicode character ';' (Greek Question Mark) looks like ';' (Semicolon), but it is not | ||
| | ||
LL | num * num; | ||
| ~ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/remove-semi-but-confused-char.rs:4:28 | ||
| | ||
LL | pub fn square(num: i32) -> i32 { | ||
| ------ ^^^ expected `i32`, found `()` | ||
| | | ||
| implicitly returns `()` as its body has no tail or `return` expression | ||
LL | | ||
LL | num * num; | ||
| - help: remove this semicolon to return this value | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |