rust-lang/rust

internal compiler error: "byte index 15 is not a char boundary"

dwrensha opened this issue · 0 comments

I'm seeing an internal compiler error on the following input (found by fuzz-rustc):

$ echo IBwfdHMAIVt7aQoAACAgZm4gct27b2E+ct27bQ== | base64 --decode > main.rs
$ rustc main.rs
error: unknown start of token: \u{1c}
 --> main.rs:1:2
  |
1 |  ts![{i
  |  ^

error: unknown start of token: \u{1f}
 --> main.rs:1:3
  |
1 |  ts![{i
  |  ^

error: unknown start of token: \u{0}
 --> main.rs:1:6
  |
1 |  ts![{i
  |    ^

error: unknown start of token: \u{0}
 --> main.rs:2:1
  |
2 |   fn rݻoa>rݻm
  | ^

error: unknown start of token: \u{0}
 --> main.rs:2:2
  |
2 |   fn rݻoa>rݻm
  | ^

error: this file contains an unclosed delimiter
 --> main.rs:2:16
  |
1 |  ts![{i
  |     -- unclosed delimiter
  |     |
  |     unclosed delimiter
2 |   fn rݻoa>rݻm
  |              ^

error: macros that expand to items must be delimited with braces or followed by a semicolon
 --> main.rs:1:8
  |
1 |    ts![{i
  |  _____^
2 | |   fn rݻoa>rݻm
  | |_____________^
  |
thread 'rustc' panicked at 'byte index 15 is not a char boundary; it is inside 'ݻ' (bytes 14..16) of `  fn rݻoa>rݻm`', src/libcore/str/mod.rs:2154:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.42.0-nightly (3761dcd34 2020-01-28) running on x86_64-unknown-linux-gnu

error: aborting due to 6 previous errors

My compiler version is:

$ rustc -vV
rustc 1.42.0-nightly (3761dcd34 2020-01-28)
binary: rustc
commit-hash: 3761dcd3467441f78939ccb3b341b03b6a7558d7
commit-date: 2020-01-28
host: x86_64-unknown-linux-gnu
release: 1.42.0-nightly
LLVM version: 9.0

I also observe the error on beta, but not on stable.