Closed apexys closed 4 years ago
Apparently that happens in stable as well https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=d738669296f02c31dc5fe0a7b560d504
This started to happen in Rust 1.28 (this properly errors out in Rust 1.27).
If I write the following:
struct TestStruct{
test: Vec<i32>zöz
}
It can be noticed the spans are different.
In Rust 1.27.1, I get this:
error: expected `,`, or `}`, found `zöz`
--> <source>:2:19
|
2 | test: Vec<i32>zöz
| ^^^
|
= help: struct fields should be separated by commas
Meanwhile in Rust 1.28, I get this:
error: expected `,`, or `}`, found `zöz`
--> <source>:2:19
|
2 | test: Vec<i32>zöz
| ^ help: try adding a comma: `,`
Note that it tries to point out the first character. This may suggest addition of 1 byte instead of 1 character somewhere.
is_case_difference
was introduced much later than Rust 1.28, I don't think it's a cause, rather, it encountered an invalid span and exploded, while the actual cause is somewhere else (my guess is https://github.com/rust-lang/rust/blob/9e6fb538f9254884ca9f958fdce413d6c3f2016c/src/librustc_parse/parser/item.rs#L1493, but I don't know enough about Rust internals).
The bug is in next_point
, where we must use find_width_of_character_at_span
correctly and somehow we aren't.
triage: P-high, removing I-nominated label.
Hi everyone,
I accidentally mistyped on a german keyboard and entered an additional ö-character after a Vec-declaration. This apparently causes an internal compiler error.
I tried this code:
and ran cargo build.
I expected to see this happen:
Compiler complains about an extra character at the end of the definition
Instead, this happened:
Meta
rustc --version --verbose
:Backtrace: