Skip to content

Commit 9b23f7c

Browse files
estebankcuviper
authored andcommitted
Do not ICE on unicode next point
Use `shrink_to_hi` instead of `next_point` Fix rust-lang#68000. (cherry picked from commit fcd850f)
1 parent 2aff5b8 commit 9b23f7c

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
@@ -1572,7 +1572,7 @@ impl<'a> Parser<'a> {
15721572
}
15731573
}
15741574
_ => {
1575-
let sp = self.sess.source_map().next_point(self.prev_span);
1575+
let sp = self.prev_span.shrink_to_hi();
15761576
let mut err = self.struct_span_err(sp, &format!("expected `,`, or `}}`, found {}",
15771577
self.this_token_descr()));
15781578
if self.token.is_ident() {
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)