ICE: string indexed not at a char boundary when constructing error message #91268
Labels
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
I'm seeing an internal compiler error on the following input, found by fuzz-rustc:
Code
Error output
Affected versions: I tried nightly 2021-11-25 and stable 1.56.1 and they both show the same ICE.
Backtrace
Thanks to the detailed error message I was able to quickly locate the issue, on this line:
rust/compiler/rustc_ast_lowering/src/path.rs
Line 236 in 6d246f0
It is assumed that the last character of
snippet
will be a)
, so usingsnippet.len() - 1
as an index should be safe. However as we see in the input code, it is possible to enter that branch without a closing)
, and it will trigger the panic if the last character happens to be multibyte.The text was updated successfully, but these errors were encountered: