Skip to content

ICE: frontmatter: byte index 8 is not a char boundary; it is inside '🚧' #141483

Open
@matthiaskrgr

Description

@matthiaskrgr

snippet:

---
x ---🚧️
---

Version information

rustc 1.89.0-nightly (e88e85463 2025-05-23)
binary: rustc
commit-hash: e88e85463468ce5d5ce468414eb69e3b15fa8d42
commit-date: 2025-05-23
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5

Possibly related line of code:

Some(c)
}
/// Moves to a substring by a number of bytes.
pub(crate) fn bump_bytes(&mut self, n: usize) {
self.chars = self.as_str()[n..].chars();
}
/// Eats symbols while predicate returns true or until the end of file is reached.
pub(crate) fn eat_while(&mut self, mut predicate: impl FnMut(char) -> bool) {
// It was tried making optimized version of this for eg. line comments, but
// LLVM can inline all of this and compile it down to fast iteration over bytes.

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output


thread 'rustc' panicked at compiler/rustc_lexer/src/cursor.rs:107:35:
byte index 8 is not a char boundary; it is inside '🚧' (bytes 6..10) of `
x ---🚧️
---
`
stack backtrace:
   0:     0x75535e76e073 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h03779a6f0d0528fb
   1:     0x75535ee05ab7 - core::fmt::write::h37188b143c8299db
   2:     0x755360266fd1 - std::io::Write::write_fmt::hf33b730412790e29
   3:     0x75535e76ded2 - std::sys::backtrace::BacktraceLock::print::hbc62909c49e926d5
   4:     0x75535e771aca - std::panicking::default_hook::{{closure}}::h30d9b30f64bce3ec
   5:     0x75535e77164f - std::panicking::default_hook::hc1d74f335a317740
   6:     0x75535d79a363 - std[72f0f555f0ececc7]::panicking::update_hook::<alloc[3d9b53f579cadf77]::boxed::Box<rustc_driver_impl[52f955853b1bdd09]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x75535e772343 - std::panicking::rust_panic_with_hook::hd85f4b59c2a8b76a
   8:     0x75535e77203a - std::panicking::begin_panic_handler::{{closure}}::hbf5c3c720aa8494f
   9:     0x75535e76e539 - std::sys::backtrace::__rust_end_short_backtrace::h55fd737a7acda9ea
  10:     0x75535e771cfd - __rustc[83c4e437f04fdc4d]::rust_begin_unwind
  11:     0x75535b08a660 - core::panicking::panic_fmt::h32a0625b979e8829
  12:     0x75535d112d28 - core::str::slice_error_fail_rt::hb2cec37802a687f9
  13:     0x75535cb7f05a - core::str::slice_error_fail::h7b428d3ce99a48be
  14:     0x75535dc6bb21 - <rustc_lexer[c752e56cd8974d08]::cursor::Cursor>::bump_bytes
  15:     0x75535dc6c38f - <rustc_lexer[c752e56cd8974d08]::cursor::Cursor>::frontmatter
  16:     0x755360470559 - <rustc_lexer[c752e56cd8974d08]::cursor::Cursor>::advance_token.cold
  17:     0x75535f74855c - <rustc_parse[cba823092eecc222]::lexer::Lexer>::bump_minimal
  18:     0x75535ee17b65 - <rustc_parse[cba823092eecc222]::lexer::Lexer>::lex_token_trees
  19:     0x75535fbf7c53 - rustc_parse[cba823092eecc222]::source_file_to_stream
  20:     0x75535fbf7977 - rustc_parse[cba823092eecc222]::new_parser_from_source_file
  21:     0x75535fbfa6db - rustc_interface[683f45d0a04ac5b6]::passes::parse
  22:     0x75535fea8ce5 - rustc_interface[683f45d0a04ac5b6]::interface::run_compiler::<(), rustc_driver_impl[52f955853b1bdd09]::run_compiler::{closure#0}>::{closure#1}
  23:     0x75535fe64986 - std[72f0f555f0ececc7]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[683f45d0a04ac5b6]::util::run_in_thread_with_globals<rustc_interface[683f45d0a04ac5b6]::util::run_in_thread_pool_with_globals<rustc_interface[683f45d0a04ac5b6]::interface::run_compiler<(), rustc_driver_impl[52f955853b1bdd09]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  24:     0x75535fe6462b - <<std[72f0f555f0ececc7]::thread::Builder>::spawn_unchecked_<rustc_interface[683f45d0a04ac5b6]::util::run_in_thread_with_globals<rustc_interface[683f45d0a04ac5b6]::util::run_in_thread_pool_with_globals<rustc_interface[683f45d0a04ac5b6]::interface::run_compiler<(), rustc_driver_impl[52f955853b1bdd09]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[5de45699eb5b5ad3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x75535fe6597d - std::sys::pal::unix::thread::Thread::new::thread_start::hb186a50e9c63d629
  26:     0x755359ca57eb - <unknown>
  27:     0x755359d2918c - <unknown>
  28:                0x0 - <unknown>

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.89.0-nightly (e88e85463 2025-05-23) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UnicodeArea: UnicodeA-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.F-frontmatter`#![feature(frontmatter)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions