Skip to content

Commit 0d7a792

Browse files
authored
Rollup merge of rust-lang#68084 - estebank:ice-68000, r=varkor
Do not ICE on unicode next point Use `shrink_to_hi` instead of `next_point`. Fix rust-lang#68000.
2 parents 5f7d23d + fcd850f commit 0d7a792

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/librustc_parse/parser/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,7 @@ impl<'a> Parser<'a> {
15101510
}
15111511
}
15121512
_ => {
1513-
let sp = self.sess.source_map().next_point(self.prev_span);
1513+
let sp = self.prev_span.shrink_to_hi();
15141514
let mut err = self.struct_span_err(
15151515
sp,
15161516
&format!("expected `,`, or `}}`, found {}", super::token_descr(&self.token)),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pub struct Foo {
2+
pub bar: Vec<i32>ö
3+
//~^ ERROR expected `,`, or `}`, found `ö`
4+
} //~ ERROR expected `:`, found `}`
5+
6+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error: expected `,`, or `}`, found `ö`
2+
--> $DIR/issue-68000-unicode-ident-after-missing-comma.rs:2:22
3+
|
4+
LL | pub bar: Vec<i32>ö
5+
| ^ help: try adding a comma: `,`
6+
7+
error: expected `:`, found `}`
8+
--> $DIR/issue-68000-unicode-ident-after-missing-comma.rs:4:1
9+
|
10+
LL | pub bar: Vec<i32>ö
11+
| - expected `:`
12+
LL |
13+
LL | }
14+
| ^ unexpected token
15+
16+
error: aborting due to 2 previous errors
17+

0 commit comments

Comments
 (0)