-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-Unicode-unawareDiagnostics: Diagnostics that are unaware of Unicode and trigger codepoint boundary assertionsDiagnostics: Diagnostics that are unaware of Unicode and trigger codepoint boundary assertionsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
auto-reduced (treereduce-rust):
fn main() {
format_args!(r#"lJ�.�"#, "r} {}");
}
original:
//@ only-64bit
fn main() {
format_args!("{}", 0x8f_i8); // issue #115423
//~^ ERROR literal out of range for `i8`
format_args!("{}", 0xffff_ffff_u8); // issue #116633
//~^ ERROR literal out of range for `u8`
format_args!("{}", 0xffff_ffff_ffff_ffff_ffff_usize);
//~^ ERROR literal out of range for `usize`
format_args!("{}", 0x8000_0000_0000_0000_isize);
//~^ ERROR literal out of range for `isize`
format_args!( r#"lJ�.�"# , "r} {}" ); // treat unsuffixed literals as i32
//~^ ERROR literal out of range for `i32`
}
Version information
rustc 1.91.0-nightly (f4665ab83 2025-09-10)
binary: rustc
commit-hash: f4665ab8368ad2e8a86d4390ae35c28bdd9561bb
commit-date: 2025-09-10
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0
Possibly related line of code:
rust/compiler/rustc_builtin_macros/src/format.rs
Lines 771 to 783 in f4665ab
if !show_example { | |
if unused.len() > 1 { | |
diag.note(format!("consider adding {} format specifiers", unused.len())); | |
} | |
} else { | |
let original_fmt_str = | |
if fmt_str.len() >= 1 { &fmt_str[..fmt_str.len() - 1] } else { "" }; | |
let msg = if unused.len() == 1 { | |
"a format specifier".to_string() | |
} else { | |
format!("{} format specifiers", unused.len()) | |
}; |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
thread 'rustc' (756102) panicked at compiler/rustc_builtin_macros/src/format.rs:777:49:
byte index 18 is not a char boundary; it is inside '�' (bytes 16..19) of `lJ�.�`
stack backtrace:
0: 0x7fb97ddb3a33 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h58efb85b4afb9282
1: 0x7fb97e401b58 - core::fmt::write::h6b0cae4b537bfe08
2: 0x7fb97dd68741 - std::io::Write::write_fmt::h089f4af151fcd2e6
3: 0x7fb97dd79982 - std::sys::backtrace::BacktraceLock::print::h8beb0bd9fe3c3024
4: 0x7fb97dd7f8c9 - std::panicking::default_hook::{{closure}}::ha6ffe211db3c2b3e
5: 0x7fb97dd7f3f3 - std::panicking::default_hook::ha280a8dfe530c87d
6: 0x7fb97cdc7b67 - std[d67ac5ad0a42d03]::panicking::update_hook::<alloc[e778cbe432e58468]::boxed::Box<rustc_driver_impl[230383b2e391cff2]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7fb97dd7fcef - std::panicking::panic_with_hook::h01b30406868d876d
8: 0x7fb97dd7faaa - std::panicking::panic_handler::{{closure}}::hfa57565d5a11ece8
9: 0x7fb97dd79ab9 - std::sys::backtrace::__rust_end_short_backtrace::h918d65dc187717f3
10: 0x7fb97dd5a2ad - __rustc[339cf7b7cea2fd37]::rust_begin_unwind
11: 0x7fb97a4c3d70 - core::panicking::panic_fmt::h7242abd08fb07965
12: 0x7fb97c7b9f1a - core::str::slice_error_fail_rt::hdfc01175be90721d
13: 0x7fb97c6dfada - core::str::slice_error_fail::h4633508616fa075b
14: 0x7fb97cbc1a85 - rustc_builtin_macros[c4891b4743d42d07]::format::report_missing_placeholders
15: 0x7fb97f143fcc - rustc_builtin_macros[c4891b4743d42d07]::format::make_format_args
16: 0x7fb97f13b16b - rustc_builtin_macros[c4891b4743d42d07]::format::expand_format_args_impl
17: 0x7fb97fa3869f - <rustc_expand[e9277a4b799467fd]::expand::MacroExpander>::fully_expand_fragment
18: 0x7fb97fa282c5 - <rustc_expand[e9277a4b799467fd]::expand::MacroExpander>::expand_crate
19: 0x7fb97ed356ab - rustc_interface[58f4313b459aaca8]::passes::configure_and_expand
20: 0x7fb97f63f46d - rustc_interface[58f4313b459aaca8]::passes::resolver_for_lowering_raw
21: 0x7fb97f63f1cd - rustc_query_impl[c8817d97ddc1e295]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c8817d97ddc1e295]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5a14ac77c2417a85]::query::erase::Erased<[u8; 16usize]>>
22: 0x7fb97f63f1a7 - <rustc_query_impl[c8817d97ddc1e295]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[b261ba1525849e66]::ops::function::FnOnce<(rustc_middle[5a14ac77c2417a85]::ty::context::TyCtxt, ())>>::call_once
23: 0x7fb97f41c81f - rustc_query_system[93dcb6cc0b67b8ce]::query::plumbing::try_execute_query::<rustc_query_impl[c8817d97ddc1e295]::DynamicConfig<rustc_query_system[93dcb6cc0b67b8ce]::query::caches::SingleCache<rustc_middle[5a14ac77c2417a85]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[c8817d97ddc1e295]::plumbing::QueryCtxt, false>
24: 0x7fb97f41c37c - rustc_query_impl[c8817d97ddc1e295]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
25: 0x7fb97f72e20e - rustc_interface[58f4313b459aaca8]::passes::create_and_enter_global_ctxt::<core[b261ba1525849e66]::option::Option<rustc_interface[58f4313b459aaca8]::queries::Linker>, rustc_driver_impl[230383b2e391cff2]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
26: 0x7fb97f6db23e - rustc_interface[58f4313b459aaca8]::interface::run_compiler::<(), rustc_driver_impl[230383b2e391cff2]::run_compiler::{closure#0}>::{closure#1}
27: 0x7fb97f621378 - std[d67ac5ad0a42d03]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[58f4313b459aaca8]::util::run_in_thread_with_globals<rustc_interface[58f4313b459aaca8]::util::run_in_thread_pool_with_globals<rustc_interface[58f4313b459aaca8]::interface::run_compiler<(), rustc_driver_impl[230383b2e391cff2]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
28: 0x7fb97f62105c - <<std[d67ac5ad0a42d03]::thread::Builder>::spawn_unchecked_<rustc_interface[58f4313b459aaca8]::util::run_in_thread_with_globals<rustc_interface[58f4313b459aaca8]::util::run_in_thread_pool_with_globals<rustc_interface[58f4313b459aaca8]::interface::run_compiler<(), rustc_driver_impl[230383b2e391cff2]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[b261ba1525849e66]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
29: 0x7fb97f62758d - std::sys::pal::unix::thread::Thread::new::thread_start::h2d569b959ba677ee
30: 0x7fb978e969cb - <unknown>
31: 0x7fb978f1aa0c - <unknown>
32: 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.91.0-nightly (f4665ab83 2025-09-10) 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
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-Unicode-unawareDiagnostics: Diagnostics that are unaware of Unicode and trigger codepoint boundary assertionsDiagnostics: Diagnostics that are unaware of Unicode and trigger codepoint boundary assertionsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.