Skip to content

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

@matthiaskrgr

Description

@matthiaskrgr

snippet:

fn main() { ··· }

Version information

rustc 1.97.0-nightly (9838411cb 2026-04-25)
binary: rustc
commit-hash: 9838411cb723b60dc62b1625751075c4d933b992
commit-date: 2026-04-25
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.2

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.Vu99ciwcWKfr/rustc_testrunner_tmpdir_reporting.6hmS81DKGYJ4/mvce.rs:1:13
  |
1 | fn main() { ··· }
  |             ^^^
  |
  = note: character appears 2 more times
help: Unicode character '·' (Middle Dot) looks like '.' (Period), but it is not
  |
1 - fn main() { ··· }
1 + fn main() { ... }
  |

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

error: unknown start of token: \u{b7}
 --> /tmp/icemaker_global_tempdir.Vu99ciwcWKfr/rustc_testrunner_tmpdir_reporting.6hmS81DKGYJ4/mvce.rs:1:15
  |
1 | fn main() { ··· }
  |               ^
  |
help: Unicode character '·' (Middle Dot) looks like '.' (Period), but it is not
  |
1 - fn main() { ··· }
1 + fn main() { ··. }
  |

error: unexpected token: `...`
 --> /tmp/icemaker_global_tempdir.Vu99ciwcWKfr/rustc_testrunner_tmpdir_reporting.6hmS81DKGYJ4/mvce.rs:1:13
  |
1 | fn main() { ··· }
  |             ^^^
  |
help: use `..` for an exclusive range
  |
1 - fn main() { ··· }
1 + fn main() { .. }
  |
help: or `..=` for an inclusive range
  |
1 - fn main() { ··· }
1 + fn main() { ..= }
  |


thread 'rustc' (128488) panicked at /rustc-dev/9838411cb723b60dc62b1625751075c4d933b992/compiler/rustc_span/src/lib.rs:2439:17:
assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32
stack backtrace:
   0:     0x7f859378bf8b - <<std[1786388830a04a8d]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[e8d809a99398819b]::fmt::Display>::fmt
   1:     0x7f8593e2d988 - core[e8d809a99398819b]::fmt::write
   2:     0x7f85937a2bc6 - <std[1786388830a04a8d]::sys::stdio::unix::Stderr as std[1786388830a04a8d]::io::Write>::write_fmt
   3:     0x7f8593762208 - std[1786388830a04a8d]::panicking::default_hook::{closure#0}
   4:     0x7f859377f5f3 - std[1786388830a04a8d]::panicking::default_hook
   5:     0x7f859273f87c - std[1786388830a04a8d]::panicking::update_hook::<alloc[f5a461388265045a]::boxed::Box<rustc_driver_impl[da6b3b23f136fde3]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f859377f8d2 - std[1786388830a04a8d]::panicking::panic_with_hook
   7:     0x7f85937622fa - std[1786388830a04a8d]::panicking::panic_handler::{closure#0}
   8:     0x7f8593756829 - std[1786388830a04a8d]::sys::backtrace::__rust_end_short_backtrace::<std[1786388830a04a8d]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f8593763d2d - __rustc[eef9394372a8438c]::rust_begin_unwind
  10:     0x7f859035b11c - core[e8d809a99398819b]::panicking::panic_fmt
  11:     0x7f85901cc532 - core[e8d809a99398819b]::panicking::panic
  12:     0x7f8594bf7fa1 - <rustc_span[13a33207dce17326]::source_map::SourceMap>::lookup_char_pos
  13:     0x7f8594bf5416 - <rustc_span[13a33207dce17326]::source_map::SourceMap>::is_valid_span
  14:     0x7f85952bc825 - <rustc_errors[f0680982b6380391]::annotate_snippet_emitter_writer::AnnotateSnippetEmitter>::emit_messages_default
  15:     0x7f85952ba031 - <rustc_errors[f0680982b6380391]::annotate_snippet_emitter_writer::AnnotateSnippetEmitter as rustc_errors[f0680982b6380391]::emitter::Emitter>::emit_diagnostic
  16:     0x7f85952b43ef - <rustc_errors[f0680982b6380391]::DiagCtxtInner>::emit_diagnostic::{closure#3}
  17:     0x7f85952b2a85 - rustc_interface[55fbf8829e20395b]::callbacks::track_diagnostic::<core[e8d809a99398819b]::option::Option<rustc_span[13a33207dce17326]::ErrorGuaranteed>>
  18:     0x7f85952b1431 - <rustc_errors[f0680982b6380391]::DiagCtxtInner>::emit_diagnostic
  19:     0x7f85952b12df - <rustc_errors[f0680982b6380391]::DiagCtxtHandle>::emit_diagnostic
  20:     0x7f85909c28fa - <rustc_span[13a33207dce17326]::ErrorGuaranteed as rustc_errors[f0680982b6380391]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  21:     0x7f8593015dc0 - <rustc_parse[682cf439e2ad6624]::parser::Parser>::inclusive_range_with_incorrect_end
  22:     0x7f8594e0de21 - <rustc_parse[682cf439e2ad6624]::parser::Parser>::parse_expr_prefix_range::{closure#0}
  23:     0x7f8594e0d065 - <rustc_parse[682cf439e2ad6624]::parser::Parser>::parse_expr_prefix_range
  24:     0x7f85940476a5 - <rustc_parse[682cf439e2ad6624]::parser::Parser>::parse_expr_assoc_with
  25:     0x7f8593ff66ec - <rustc_parse[682cf439e2ad6624]::parser::Parser>::parse_stmt_without_recovery
  26:     0x7f859400319b - <rustc_parse[682cf439e2ad6624]::parser::Parser>::parse_block_common
  27:     0x7f8593fd8026 - <rustc_parse[682cf439e2ad6624]::parser::Parser>::parse_fn
  28:     0x7f8593fb8b2f - <rustc_parse[682cf439e2ad6624]::parser::Parser>::parse_item_kind
  29:     0x7f8593fb4aea - <rustc_parse[682cf439e2ad6624]::parser::Parser>::parse_item_common
  30:     0x7f8593ffbf98 - <rustc_parse[682cf439e2ad6624]::parser::Parser>::parse_mod
  31:     0x7f8594f17487 - rustc_interface[55fbf8829e20395b]::passes::parse
  32:     0x7f8594f23501 - rustc_interface[55fbf8829e20395b]::interface::run_compiler::<(), rustc_driver_impl[da6b3b23f136fde3]::run_compiler::{closure#0}>::{closure#1}
  33:     0x7f8594f76484 - std[1786388830a04a8d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[55fbf8829e20395b]::util::run_in_thread_with_globals<rustc_interface[55fbf8829e20395b]::util::run_in_thread_pool_with_globals<rustc_interface[55fbf8829e20395b]::interface::run_compiler<(), rustc_driver_impl[da6b3b23f136fde3]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  34:     0x7f8594f76b6d - <std[1786388830a04a8d]::thread::lifecycle::spawn_unchecked<rustc_interface[55fbf8829e20395b]::util::run_in_thread_with_globals<rustc_interface[55fbf8829e20395b]::util::run_in_thread_pool_with_globals<rustc_interface[55fbf8829e20395b]::interface::run_compiler<(), rustc_driver_impl[da6b3b23f136fde3]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[e8d809a99398819b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35:     0x7f8594f779ec - <std[1786388830a04a8d]::sys::thread::unix::Thread>::new::thread_start
  36:     0x7f858eaa597a - <unknown>
  37:     0x7f858eb292bc - <unknown>
  38:                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 (9838411cb 2026-04-25) running on x86_64-unknown-linux-gnu

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

For more information about this error, try `rustc --explain E0586`.

Metadata

Metadata

Assignees

No one assigned

    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) ❄️P-lowLow priorityT-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