Skip to content

Commit fcd850f

Browse files
committed
Do not ICE on unicode next point
Use `shrink_to_hi` instead of `next_point` Fix #68000.
1 parent 72b2bd5 commit fcd850f

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
@@ -1489,7 +1489,7 @@ impl<'a> Parser<'a> {
14891489
}
14901490
}
14911491
_ => {
1492-
let sp = self.sess.source_map().next_point(self.prev_span);
1492+
let sp = self.prev_span.shrink_to_hi();
14931493
let mut err = self.struct_span_err(
14941494
sp,
14951495
&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)