forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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 rust-lang#103521 - chenyukang:yukang/fix-103451-avoid…
…-hang, r=jackh726,wesleywiser Avoid possible infinite loop when next_point reaching the end of file Fixes rust-lang#103451 If we return a span with `lo` = `hi`, `span_to_snippet` will always get `Ok("")`, which may introduce infinite loop if we don't care. This PR make `find_width_of_character_at_span` return `width` with 1, so that `span_to_snippet` will get an `Err`.
- Loading branch information
Showing
4 changed files
with
46 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,5 @@ | ||
// error-pattern: this file contains an unclosed delimiter | ||
// error-pattern: expected value, found struct `R` | ||
struct R { } | ||
struct S { | ||
x: [u8; R |
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,32 @@ | ||
error: this file contains an unclosed delimiter | ||
--> $DIR/issue-103451.rs:5:15 | ||
| | ||
LL | struct S { | ||
| - unclosed delimiter | ||
LL | x: [u8; R | ||
| - ^ | ||
| | | ||
| unclosed delimiter | ||
|
||
error: this file contains an unclosed delimiter | ||
--> $DIR/issue-103451.rs:5:15 | ||
| | ||
LL | struct S { | ||
| - unclosed delimiter | ||
LL | x: [u8; R | ||
| - ^ | ||
| | | ||
| unclosed delimiter | ||
|
||
error[E0423]: expected value, found struct `R` | ||
--> $DIR/issue-103451.rs:5:13 | ||
| | ||
LL | struct R { } | ||
| ------------ `R` defined here | ||
LL | struct S { | ||
LL | x: [u8; R | ||
| ^ help: use struct literal syntax instead: `R {}` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0423`. |