未验证 提交 1caa5b00 编写于 作者: Y Yuki Okushi 提交者: GitHub

Rollup merge of #80185 - JohnTitor:issue-80134, r=davidtwco

Fix ICE when pointing at multi bytes character

Fixes #80134

Seems this ICE was introduced by #73953, checking width of span to avoid ICE.
......@@ -721,13 +721,9 @@ fn parse_seq_to_before_tokens<T>(
Ok(t) => {
// Parsed successfully, therefore most probably the code only
// misses a separator.
let mut exp_span = self.sess.source_map().next_point(sp);
if self.sess.source_map().is_multiline(exp_span) {
exp_span = sp;
}
expect_err
.span_suggestion_short(
exp_span,
sp,
&format!("missing `{}`", token_str),
token_str,
Applicability::MaybeIncorrect,
......
// Regression test for #80134.
fn main() {
(()é);
//~^ ERROR: expected one of `)`, `,`, `.`, `?`, or an operator
//~| ERROR: cannot find value `é` in this scope
//~| ERROR: non-ascii idents are not fully supported
(());
//~^ ERROR: expected one of `)`, `,`, `.`, `?`, or an operator
//~| ERROR: cannot find value `氷` in this scope
//~| ERROR: non-ascii idents are not fully supported
}
error: expected one of `)`, `,`, `.`, `?`, or an operator, found `é`
--> $DIR/multibyte-char-use-seperator-issue-80134.rs:4:8
|
LL | (()é);
| ^
| |
| expected one of `)`, `,`, `.`, `?`, or an operator
| help: missing `,`
error: expected one of `)`, `,`, `.`, `?`, or an operator, found `氷`
--> $DIR/multibyte-char-use-seperator-issue-80134.rs:8:8
|
LL | (()氷);
| -^
| |
| expected one of `)`, `,`, `.`, `?`, or an operator
| help: missing `,`
error[E0425]: cannot find value `é` in this scope
--> $DIR/multibyte-char-use-seperator-issue-80134.rs:4:8
|
LL | (()é);
| ^ not found in this scope
error[E0425]: cannot find value `氷` in this scope
--> $DIR/multibyte-char-use-seperator-issue-80134.rs:8:8
|
LL | (()氷);
| ^^ not found in this scope
error[E0658]: non-ascii idents are not fully supported
--> $DIR/multibyte-char-use-seperator-issue-80134.rs:4:8
|
LL | (()é);
| ^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/multibyte-char-use-seperator-issue-80134.rs:8:8
|
LL | (()氷);
| ^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0425, E0658.
For more information about an error, try `rustc --explain E0425`.
// run-rustfix
#![allow(unused_imports)]
pub mod x {
pub struct A;
pub struct B;
}
// `.` is similar to `,` so list parsing should continue to closing `}`
use x::{A, B}; //~ ERROR expected one of `,`, `::`, `as`, or `}`, found `.`
fn main() {}
// run-rustfix
#![allow(unused_imports)]
pub mod x {
......
error: expected one of `,`, `::`, `as`, or `}`, found `.`
--> $DIR/similar-tokens.rs:11:10
--> $DIR/similar-tokens.rs:9:10
|
LL | use x::{A. B};
| ^
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册