Skip to content

[ICE]: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32 #156316

@matthiaskrgr

Description

@matthiaskrgr

similar to #155799
snippet:

impl S { fn f(···>) }

Version information

rustc 1.97.0-nightly (3e353d735 2026-05-08)
binary: rustc
commit-hash: 3e353d7353b0cd6fa4eefd5c882457cc2708184c
commit-date: 2026-05-08
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.4

Possibly related line of code:

if mbc.pos < bpos {
// Every character is at least one byte, so we only
// count the actual extra bytes.
total_extra_bytes += mbc.bytes as u32 - 1;
// We should never see a byte position in the middle of a
// character.
assert!(bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32);
} else {
break;
}
}
assert!(total_extra_bytes <= bpos.to_u32());

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

Program output

error: unknown start of token: \u{b7}
 --> /tmp/icemaker_global_tempdir.GkbtIIr0R5CH/rustc_testrunner_tmpdir_reporting.wqFqS9tl0ozR/mvce.rs:1:15
  |
1 | impl S { fn f(···>) }
  |               ^^^
  |
  = note: character appears 2 more times
help: Unicode character '·' (Middle Dot) looks like '.' (Period), but it is not
  |
1 - impl S { fn f(···>) }
1 + impl S { fn f(...>) }
  |

error: unknown start of token: \u{b7}
 --> /tmp/icemaker_global_tempdir.GkbtIIr0R5CH/rustc_testrunner_tmpdir_reporting.wqFqS9tl0ozR/mvce.rs:1:16
  |
1 | impl S { fn f(···>) }
  |                ^^
  |
  = note: character appears once more
help: Unicode character '·' (Middle Dot) looks like '.' (Period), but it is not
  |
1 - impl S { fn f(···>) }
1 + impl S { fn f(·..>) }
  |

error: unknown start of token: \u{b7}
 --> /tmp/icemaker_global_tempdir.GkbtIIr0R5CH/rustc_testrunner_tmpdir_reporting.wqFqS9tl0ozR/mvce.rs:1:17
  |
1 | impl S { fn f(···>) }
  |                 ^
  |
help: Unicode character '·' (Middle Dot) looks like '.' (Period), but it is not
  |
1 - impl S { fn f(···>) }
1 + impl S { fn f(··.>) }
  |


thread 'rustc' (308109) panicked at /rustc-dev/3e353d7353b0cd6fa4eefd5c882457cc2708184c/compiler/rustc_span/src/lib.rs:2430:17:
assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32
stack backtrace:
   0:     0x7fcca4a74239 - <<std[db65628f2330fd11]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[b3c617e8375f9bd0]::fmt::Display>::fmt
   1:     0x7fcca501b788 - core[b3c617e8375f9bd0]::fmt::write
   2:     0x7fcca4a8ac66 - <std[db65628f2330fd11]::sys::stdio::unix::Stderr as std[db65628f2330fd11]::io::Write>::write_fmt
   3:     0x7fcca4a4a2de - std[db65628f2330fd11]::panicking::default_hook::{closure#0}
   4:     0x7fcca4a678f3 - std[db65628f2330fd11]::panicking::default_hook
   5:     0x7fcca39544d1 - std[db65628f2330fd11]::panicking::update_hook::<alloc[b10a1c065189447]::boxed::Box<rustc_driver_impl[1f444ccaa450aabc]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fcca4a67bd2 - std[db65628f2330fd11]::panicking::panic_with_hook
   7:     0x7fcca4a4a3d4 - std[db65628f2330fd11]::panicking::panic_handler::{closure#0}
   8:     0x7fcca4a410b9 - std[db65628f2330fd11]::sys::backtrace::__rust_end_short_backtrace::<std[db65628f2330fd11]::panicking::panic_handler::{closure#0}, !>
   9:     0x7fcca4a4be0d - __rustc[87b1f669d989e0ab]::rust_begin_unwind
  10:     0x7fcca1b2c50c - core[b3c617e8375f9bd0]::panicking::panic_fmt
  11:     0x7fcca2020202 - core[b3c617e8375f9bd0]::panicking::panic
  12:     0x7fcca5831528 - <rustc_span[749aae40fdac821d]::source_map::SourceMap>::lookup_char_pos
  13:     0x7fcca638e9d2 - <rustc_span[749aae40fdac821d]::source_map::SourceMap>::is_valid_span
  14:     0x7fcca6391dd2 - <rustc_errors[4e25407aa9dfcb98]::annotate_snippet_emitter_writer::AnnotateSnippetEmitter>::emit_messages_default
  15:     0x7fcca638b14c - <rustc_errors[4e25407aa9dfcb98]::annotate_snippet_emitter_writer::AnnotateSnippetEmitter as rustc_errors[4e25407aa9dfcb98]::emitter::Emitter>::emit_diagnostic
  16:     0x7fcca6388515 - <rustc_errors[4e25407aa9dfcb98]::DiagCtxtInner>::emit_diagnostic::{closure#3}
  17:     0x7fcca6386c2a - rustc_interface[232b63f46aa35c0e]::callbacks::track_diagnostic::<core[b3c617e8375f9bd0]::option::Option<rustc_span[749aae40fdac821d]::ErrorGuaranteed>>
  18:     0x7fcca63855e6 - <rustc_errors[4e25407aa9dfcb98]::DiagCtxtInner>::emit_diagnostic
  19:     0x7fcca638549f - <rustc_errors[4e25407aa9dfcb98]::DiagCtxtHandle>::emit_diagnostic
  20:     0x7fcca1bbc379 - <rustc_span[749aae40fdac821d]::ErrorGuaranteed as rustc_errors[4e25407aa9dfcb98]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  21:     0x7fcca51b80e5 - <rustc_parse[6f24b5b0f58f21fc]::parser::Parser>::parse_pat_with_range_pat
  22:     0x7fcca422bda4 - <rustc_parse[6f24b5b0f58f21fc]::parser::Parser>::recover_arg_parse
  23:     0x7fcca51e733c - <rustc_parse[6f24b5b0f58f21fc]::parser::Parser>::parse_param_general::{closure#0}
  24:     0x7fcca51a4ea3 - <rustc_parse[6f24b5b0f58f21fc]::parser::Parser>::parse_fn_params
  25:     0x7fcca51bc848 - <rustc_parse[6f24b5b0f58f21fc]::parser::Parser>::parse_fn
  26:     0x7fcca518d538 - <rustc_parse[6f24b5b0f58f21fc]::parser::Parser>::parse_item_kind
  27:     0x7fcca5189667 - <rustc_parse[6f24b5b0f58f21fc]::parser::Parser>::parse_item_common
  28:     0x7fcca519ba19 - <rustc_parse[6f24b5b0f58f21fc]::parser::Parser>::parse_item_impl
  29:     0x7fcca518d75d - <rustc_parse[6f24b5b0f58f21fc]::parser::Parser>::parse_item_kind
  30:     0x7fcca5189667 - <rustc_parse[6f24b5b0f58f21fc]::parser::Parser>::parse_item_common
  31:     0x7fcca51d1394 - <rustc_parse[6f24b5b0f58f21fc]::parser::Parser>::parse_mod
  32:     0x7fcca61c24fd - rustc_interface[232b63f46aa35c0e]::passes::parse
  33:     0x7fcca61c5eec - rustc_interface[232b63f46aa35c0e]::interface::run_compiler::<(), rustc_driver_impl[1f444ccaa450aabc]::run_compiler::{closure#0}>::{closure#1}
  34:     0x7fcca6175c3e - std[db65628f2330fd11]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[232b63f46aa35c0e]::util::run_in_thread_with_globals<rustc_interface[232b63f46aa35c0e]::util::run_in_thread_pool_with_globals<rustc_interface[232b63f46aa35c0e]::interface::run_compiler<(), rustc_driver_impl[1f444ccaa450aabc]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  35:     0x7fcca617632d - <std[db65628f2330fd11]::thread::lifecycle::spawn_unchecked<rustc_interface[232b63f46aa35c0e]::util::run_in_thread_with_globals<rustc_interface[232b63f46aa35c0e]::util::run_in_thread_pool_with_globals<rustc_interface[232b63f46aa35c0e]::interface::run_compiler<(), rustc_driver_impl[1f444ccaa450aabc]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[b3c617e8375f9bd0]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x7fcca617712c - <std[db65628f2330fd11]::sys::thread::unix::Thread>::new::thread_start
  37:     0x7fcc9fca597a - <unknown>
  38:     0x7fcc9fd292bc - <unknown>
  39:                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.97.0-nightly (3e353d735 2026-05-08) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 4 previous errors


Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTC-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
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions