[ICE]: `assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
auto-reduced (treereduce-rust):
fn main() {
format!(concat!("lJ�.�", "{f:?#}"))
}
original:
fn main() { format !(concat !("lJ�.�", "{f:?#}")) }
Version information
rustc 1.97.0-nightly (a3e96d8cb 2026-05-02)
binary: rustc
commit-hash: a3e96d8cb8a420022828d0a595277ad3671928a7
commit-date: 2026-05-02
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.4
Possibly related line of code:
https://github.com/rust-lang/rust/blob/a3e96d8cb8a420022828d0a595277ad3671928a7/compiler/rustc_span/src/lib.rs#L2424-L2436
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
thread 'rustc' (1246010) panicked at /rustc-dev/a3e96d8cb8a420022828d0a595277ad3671928a7/compiler/rustc_span/src/lib.rs:2430:17:
assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32
stack backtrace:
0: 0x7f57ab213d59 - <<std[a6e59834c9dcb832]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[bcda8720f064f613]::fmt::Display>::fmt
1: 0x7f57ab817408 - core[bcda8720f064f613]::fmt::write
2: 0x7f57ab22a786 - <std[a6e59834c9dcb832]::sys::stdio::unix::Stderr as std[a6e59834c9dcb832]::io::Write>::write_fmt
3: 0x7f57ab1e9f2e - std[a6e59834c9dcb832]::panicking::default_hook::{closure#0}
4: 0x7f57ab207413 - std[a6e59834c9dcb832]::panicking::default_hook
5: 0x7f57aa1130f1 - std[a6e59834c9dcb832]::panicking::update_hook::<alloc[3d5dd0a2646140e7]::boxed::Box<rustc_driver_impl[148980a9c85a140]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f57ab2076f2 - std[a6e59834c9dcb832]::panicking::panic_with_hook
7: 0x7f57ab1ea024 - std[a6e59834c9dcb832]::panicking::panic_handler::{closure#0}
8: 0x7f57ab1e0d09 - std[a6e59834c9dcb832]::sys::backtrace::__rust_end_short_backtrace::<std[a6e59834c9dcb832]::panicking::panic_handler::{closure#0}, !>
9: 0x7f57ab1eba5d - __rustc[c519c707fcea3ff3]::rust_begin_unwind
10: 0x7f57a82e659c - core[bcda8720f064f613]::panicking::panic_fmt
11: 0x7f57a8fc4e22 - core[bcda8720f064f613]::panicking::panic
12: 0x7f57ac5d0e28 - <rustc_span[4ae4b24a1f5a09ed]::source_map::SourceMap>::lookup_char_pos
13: 0x7f57ac5ce392 - <rustc_span[4ae4b24a1f5a09ed]::source_map::SourceMap>::is_valid_span
14: 0x7f57aca40cd2 - <rustc_errors[78c66cf784f2adf4]::annotate_snippet_emitter_writer::AnnotateSnippetEmitter>::emit_messages_default
15: 0x7f57acb37392 - <rustc_errors[78c66cf784f2adf4]::annotate_snippet_emitter_writer::AnnotateSnippetEmitter as rustc_errors[78c66cf784f2adf4]::emitter::Emitter>::emit_diagnostic
16: 0x7f57acb31855 - <rustc_errors[78c66cf784f2adf4]::DiagCtxtInner>::emit_diagnostic::{closure#3}
17: 0x7f57acb2ff0e - rustc_interface[88b672da49076e3f]::callbacks::track_diagnostic::<core[bcda8720f064f613]::option::Option<rustc_span[4ae4b24a1f5a09ed]::ErrorGuaranteed>>
18: 0x7f57acb2e926 - <rustc_errors[78c66cf784f2adf4]::DiagCtxtInner>::emit_diagnostic
19: 0x7f57acb2e7df - <rustc_errors[78c66cf784f2adf4]::DiagCtxtHandle>::emit_diagnostic
20: 0x7f57a842a089 - <rustc_span[4ae4b24a1f5a09ed]::ErrorGuaranteed as rustc_errors[78c66cf784f2adf4]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
21: 0x7f57ac5e7c66 - rustc_builtin_macros[310916f9afe3922e]::format::make_format_args
22: 0x7f57ac307d05 - rustc_builtin_macros[310916f9afe3922e]::format::expand_format_args_impl
23: 0x7f57acd6e7b2 - <rustc_expand[cf24bbcfbecad4b6]::expand::MacroExpander>::fully_expand_fragment
24: 0x7f57acd68714 - <rustc_expand[cf24bbcfbecad4b6]::expand::MacroExpander>::expand_crate
25: 0x7f57ac0ab566 - rustc_interface[88b672da49076e3f]::passes::resolver_for_lowering_raw
26: 0x7f57ac0aa9d9 - rustc_query_impl[cfd2d2ca1121962c]::query_impl::resolver_for_lowering_raw::invoke_provider_fn::__rust_begin_short_backtrace
27: 0x7f57ac9c446c - rustc_query_impl[cfd2d2ca1121962c]::execution::try_execute_query::<rustc_middle[d5a5c8ef1e1f6962]::query::caches::SingleCache<rustc_middle[d5a5c8ef1e1f6962]::query::erase::ErasedData<[u8; 16usize]>>, false>
28: 0x7f57ac97cff8 - rustc_query_impl[cfd2d2ca1121962c]::query_impl::resolver_for_lowering_raw::execute_query_non_incr::__rust_end_short_backtrace
29: 0x7f57ac97adf7 - rustc_interface[88b672da49076e3f]::interface::run_compiler::<(), rustc_driver_impl[148980a9c85a140]::run_compiler::{closure#0}>::{closure#1}
30: 0x7f57ac9b4cfa - std[a6e59834c9dcb832]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[88b672da49076e3f]::util::run_in_thread_with_globals<rustc_interface[88b672da49076e3f]::util::run_in_thread_pool_with_globals<rustc_interface[88b672da49076e3f]::interface::run_compiler<(), rustc_driver_impl[148980a9c85a140]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
31: 0x7f57ac9b53ed - <std[a6e59834c9dcb832]::thread::lifecycle::spawn_unchecked<rustc_interface[88b672da49076e3f]::util::run_in_thread_with_globals<rustc_interface[88b672da49076e3f]::util::run_in_thread_pool_with_globals<rustc_interface[88b672da49076e3f]::interface::run_compiler<(), rustc_driver_impl[148980a9c85a140]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[bcda8720f064f613]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
32: 0x7f57ac9b61ec - <std[a6e59834c9dcb832]::sys::thread::unix::Thread>::new::thread_start
33: 0x7f57a64a597a - <unknown>
34: 0x7f57a65292bc - <unknown>
35: 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 (a3e96d8cb 2026-05-02) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
error: aborting due to 1 previous error
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the reduced reproducer in a.rs with the reported nightly rustc command. Read compiler/rustc_span/src/lib.rs around lines 2424-2436 and trace the source-span lookup reached through format! expansion. Done means the reproducer no longer triggers the assertion or compiler panic, with coverage for this case added where the compiler's existing tests belong.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100