Skip to content

[ICE]: diagnostic::on_unimplemented start byte index 10 is not a char boundary #159252

Description

@matthiaskrgr

since #156161

auto-reduced (treereduce-rust):

#[diagnostic::on_unimplemented(message = " \x00 \u{b123} \\\u{b123} {:?}")]

fn main() {}

original:

#[diagnostic::on_unimplemented(message = " \x00 \u{b123} \\\u{b123} {:?}")]
trait Foo {}
fn main() {}

Version information

rustc 1.99.0-nightly (225e91c03 2026-07-13)
binary: rustc
commit-hash: 225e91c03da22cd4b9792b83c1cfc97967101614
commit-date: 2026-07-13
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8

Possibly related line of code:

/// Parses all of a string which is to be considered a "raw literal" in a
/// format string. This is everything outside of the braces.
fn string(&mut self, start: usize) -> &'input str {
while let Some((r, i, c)) = self.peek() {
match c {
'{' | '}' => {
return &self.input[start..i];
}
'\n' if self.is_source_literal => {
self.input_vec_index += 1;
self.line_spans.push(self.cur_line_start..r.start);
self.cur_line_start = r.end;
}

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

Program output


thread 'rustc' (363693) panicked at /rustc-dev/225e91c03da22cd4b9792b83c1cfc97967101614/compiler/rustc_parse_format/src/lib.rs:513:39:
start byte index 10 is not a char boundary; it is inside '넣' (bytes 8..11 of string)
stack backtrace:
   0:     0x7f7eeb00aa06 - <<std[f815c803b8bda7b3]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[a425eebf46758491]::fmt::Display>::fmt
   1:     0x7f7eeb610dc8 - core[a425eebf46758491]::fmt::write
   2:     0x7f7eeb01fe7c - <std[f815c803b8bda7b3]::sys::stdio::unix::Stderr as core[a425eebf46758491]::io::write::Write>::write_fmt
   3:     0x7f7eeafded8a - std[f815c803b8bda7b3]::panicking::default_hook::{closure#0}
   4:     0x7f7eeaffd123 - std[f815c803b8bda7b3]::panicking::default_hook
   5:     0x7f7ee9fd4a2b - std[f815c803b8bda7b3]::panicking::update_hook::<alloc[2f076b677b3e1a3b]::boxed::Box<rustc_driver_impl[f6b68445f387381]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f7eeaffd5c2 - std[f815c803b8bda7b3]::panicking::panic_with_hook
   7:     0x7f7eeafdee42 - std[f815c803b8bda7b3]::panicking::panic_handler::{closure#0}
   8:     0x7f7eeafd5b09 - std[f815c803b8bda7b3]::sys::backtrace::__rust_end_short_backtrace::<std[f815c803b8bda7b3]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f7eeafe079d - __rustc[17bcef32ef66a019]::rust_begin_unwind
  10:     0x7f7ee7d5157c - core[a425eebf46758491]::panicking::panic_fmt
  11:     0x7f7ee997497d - core[a425eebf46758491]::str::slice_error_fail_rt
  12:     0x7f7ee974b83a - core[a425eebf46758491]::str::slice_error_fail
  13:     0x7f7eed42b825 - <rustc_parse_format[f1c09d163e9b9eea]::Parser>::string.cold
  14:     0x7f7eec1da1c8 - <rustc_parse_format[f1c09d163e9b9eea]::Parser>::argument
  15:     0x7f7eec1dc2e8 - <rustc_parse_format[f1c09d163e9b9eea]::Parser as core[a425eebf46758491]::iter::traits::iterator::Iterator>::next
  16:     0x7f7eecae17f4 - rustc_attr_parsing[986f0cc2418a25a7]::attributes::diagnostic::parse_format_string
  17:     0x7f7eecae139f - rustc_attr_parsing[986f0cc2418a25a7]::attributes::diagnostic::parse_directive_items::<core[a425eebf46758491]::slice::iter::Iter<rustc_attr_parsing[986f0cc2418a25a7]::parser::MetaItemOrLitParser>>::{closure#0}
  18:     0x7f7eecae0ac2 - rustc_attr_parsing[986f0cc2418a25a7]::attributes::diagnostic::parse_directive_items::<core[a425eebf46758491]::slice::iter::Iter<rustc_attr_parsing[986f0cc2418a25a7]::parser::MetaItemOrLitParser>>
  19:     0x7f7eecae05bb - <<rustc_attr_parsing[986f0cc2418a25a7]::attributes::diagnostic::on_unimplemented::OnUnimplementedParser as rustc_attr_parsing[986f0cc2418a25a7]::attributes::AttributeParser>::ATTRIBUTES::{closure#0} as core[a425eebf46758491]::ops::function::FnOnce<(&mut rustc_attr_parsing[986f0cc2418a25a7]::attributes::diagnostic::on_unimplemented::OnUnimplementedParser, &mut rustc_attr_parsing[986f0cc2418a25a7]::context::AcceptContext, &rustc_attr_parsing[986f0cc2418a25a7]::parser::ArgParser)>>::call_once
  20:     0x7f7eecae04c1 - rustc_attr_parsing[986f0cc2418a25a7]::context::ATTRIBUTE_PARSERS::{closure#0}::{closure#18}
  21:     0x7f7eebf76b3e - <rustc_ast_lowering[778953a3457ff41f]::LoweringContext>::lower_attrs_vec
  22:     0x7f7eeb949241 - rustc_ast_lowering[778953a3457ff41f]::lower_to_hir
  23:     0x7f7eeb94619d - rustc_query_impl[68a2f365f9927c9b]::query_impl::lower_to_hir::invoke_provider_fn::__rust_begin_short_backtrace
  24:     0x7f7eeb944e0a - rustc_query_impl[68a2f365f9927c9b]::execution::try_execute_query::<rustc_data_structures[d208358c53517434]::vec_cache::VecCache<rustc_span[5e6c73db80a2ecda]::def_id::LocalDefId, rustc_middle[83d6f6fa2ecd6292]::query::erase::ErasedData<[u8; 16usize]>, rustc_middle[83d6f6fa2ecd6292]::dep_graph::graph::DepNodeIndex>, false>
  25:     0x7f7eeb944b45 - rustc_query_impl[68a2f365f9927c9b]::query_impl::lower_to_hir::execute_query_non_incr::__rust_end_short_backtrace
  26:     0x7f7eeb944671 - rustc_query_impl[68a2f365f9927c9b]::query_impl::hir_owner::invoke_provider_fn::__rust_begin_short_backtrace
  27:     0x7f7eeb943a12 - rustc_query_impl[68a2f365f9927c9b]::execution::try_execute_query::<rustc_data_structures[d208358c53517434]::vec_cache::VecCache<rustc_span[5e6c73db80a2ecda]::def_id::LocalDefId, rustc_middle[83d6f6fa2ecd6292]::query::erase::ErasedData<[u8; 32usize]>, rustc_middle[83d6f6fa2ecd6292]::dep_graph::graph::DepNodeIndex>, false>
  28:     0x7f7eeb943748 - rustc_query_impl[68a2f365f9927c9b]::query_impl::hir_owner::execute_query_non_incr::__rust_end_short_backtrace
  29:     0x7f7eec418bce - <rustc_middle[83d6f6fa2ecd6292]::hir::map::ItemCollector as rustc_hir[a0947a8222fbe6e0]::intravisit::Visitor>::visit_nested_item
  30:     0x7f7eec4168e5 - rustc_middle[83d6f6fa2ecd6292]::hir::map::hir_crate_items
  31:     0x7f7eec7eed77 - rustc_query_impl[68a2f365f9927c9b]::query_impl::hir_crate_items::invoke_provider_fn::__rust_begin_short_backtrace
  32:     0x7f7eec7f2fda - rustc_query_impl[68a2f365f9927c9b]::execution::try_execute_query::<rustc_middle[83d6f6fa2ecd6292]::query::caches::SingleCache<rustc_middle[83d6f6fa2ecd6292]::query::erase::ErasedData<[u8; 8usize]>>, false>
  33:     0x7f7eec7f20f9 - rustc_query_impl[68a2f365f9927c9b]::query_impl::hir_crate_items::execute_query_non_incr::__rust_end_short_backtrace
  34:     0x7f7eebc6baee - rustc_interface[daa1f9eccb307e6d]::passes::analysis
  35:     0x7f7eec7f2687 - rustc_query_impl[68a2f365f9927c9b]::execution::try_execute_query::<rustc_middle[83d6f6fa2ecd6292]::query::caches::SingleCache<rustc_middle[83d6f6fa2ecd6292]::query::erase::ErasedData<[u8; 0usize]>>, false>
  36:     0x7f7eec7f2369 - rustc_query_impl[68a2f365f9927c9b]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  37:     0x7f7eec785d1b - rustc_interface[daa1f9eccb307e6d]::interface::run_compiler::<(), rustc_driver_impl[f6b68445f387381]::run_compiler::{closure#0}>::{closure#1}
  38:     0x7f7eec7dd0ba - std[f815c803b8bda7b3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[daa1f9eccb307e6d]::util::run_in_thread_with_globals<rustc_interface[daa1f9eccb307e6d]::util::run_in_thread_pool_with_globals<rustc_interface[daa1f9eccb307e6d]::interface::run_compiler<(), rustc_driver_impl[f6b68445f387381]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  39:     0x7f7eec7dce6d - <std[f815c803b8bda7b3]::thread::lifecycle::spawn_unchecked<rustc_interface[daa1f9eccb307e6d]::util::run_in_thread_with_globals<rustc_interface[daa1f9eccb307e6d]::util::run_in_thread_pool_with_globals<rustc_interface[daa1f9eccb307e6d]::interface::run_compiler<(), rustc_driver_impl[f6b68445f387381]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[a425eebf46758491]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x7f7eec7e1290 - <std[f815c803b8bda7b3]::sys::thread::unix::Thread>::new::thread_start
  41:     0x7f7ee6097739 - <unknown>
  42:     0x7f7ee611bedc - <unknown>
  43:                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.99.0-nightly (225e91c03 2026-07-13) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [lower_to_hir] lowering HIR for `main`
#1 [hir_owner] getting owner for `main`
#2 [hir_crate_items] getting HIR crate items
#3 [analysis] running analysis passes on crate `mvce`
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.D-Unicode-unawareDiagnostics: Diagnostics that are unaware of Unicode and trigger codepoint boundary assertionsI-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