Skip to content

ICE: invalid format num when println! with multiple unused formatting arguments(format_args_implicits) #125002

Closed
@pymongo

Description

@pymongo

Code

fn main() {
    println!("%65536", 1);
}

Meta

rustc --version --verbose:

rustc 1.78.0 (9b00956e5 2024-04-29)
binary: rustc
commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
commit-date: 2024-04-29
host: x86_64-unknown-linux-gnu
release: 1.78.0
LLVM version: 18.1.2

Error output

thread 'rustc' panicked at compiler/rustc_builtin_macros/src/format_foreign.rs:272:55:
invalid format num `"65536"`
Backtrace

thread 'rustc' panicked at compiler/rustc_builtin_macros/src/format_foreign.rs:272:55:
invalid format num `"1172797387437666312"`
stack backtrace:
   0:     0x7f824978ee25 - std::backtrace_rs::backtrace::libunwind::trace::h076b7d335d3f5d8e
                               at /rustc/6e1d94708a0a4a35ca7e46c6cac98adf62fe800e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7f824978ee25 - std::backtrace_rs::backtrace::trace_unsynchronized::he80fbffb90acdf81
                               at /rustc/6e1d94708a0a4a35ca7e46c6cac98adf62fe800e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f824978ee25 - std::backtrace::Backtrace::create::hed86b473a99fdb7c
                               at /rustc/6e1d94708a0a4a35ca7e46c6cac98adf62fe800e/library/std/src/backtrace.rs:331:13
   3:     0x7f824978ed75 - std::backtrace::Backtrace::force_capture::h17f58d3d8d696aca
                               at /rustc/6e1d94708a0a4a35ca7e46c6cac98adf62fe800e/library/std/src/backtrace.rs:312:9
   4:     0x7f824c8ea249 - std[420967f48346b39c]::panicking::update_hook::<alloc[478b9a7ca3809208]::boxed::Box<rustc_driver_impl[9e6d636adc327e66]::install_ice_hook::{closure#0}>>::{closure#0}
   5:     0x7f82497a9a86 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hd12a80ecb6b6cfe8
                               at /rustc/6e1d94708a0a4a35ca7e46c6cac98adf62fe800e/library/alloc/src/boxed.rs:2036:9
   6:     0x7f82497a9a86 - std::panicking::rust_panic_with_hook::h33d302c7fc861cff
                               at /rustc/6e1d94708a0a4a35ca7e46c6cac98adf62fe800e/library/std/src/panicking.rs:799:13
   7:     0x7f82497a9834 - std::panicking::begin_panic_handler::{{closure}}::hc538f5c218e27dc0
                               at /rustc/6e1d94708a0a4a35ca7e46c6cac98adf62fe800e/library/std/src/panicking.rs:664:13
   8:     0x7f82497a7109 - std::sys_common::backtrace::__rust_end_short_backtrace::habfe9112f9a835c0
                               at /rustc/6e1d94708a0a4a35ca7e46c6cac98adf62fe800e/library/std/src/sys_common/backtrace.rs:171:18
   9:     0x7f82497a9567 - rust_begin_unwind
                               at /rustc/6e1d94708a0a4a35ca7e46c6cac98adf62fe800e/library/std/src/panicking.rs:652:5
  10:     0x7f82497f23d3 - core::panicking::panic_fmt::h36e9ce03408e5254
                               at /rustc/6e1d94708a0a4a35ca7e46c6cac98adf62fe800e/library/core/src/panicking.rs:72:14
  11:     0x7f824c7350f1 - <rustc_builtin_macros[5110e67ae3fbf1dc]::format_foreign::printf::Num>::from_str
  12:     0x7f824c73604f - <rustc_builtin_macros[5110e67ae3fbf1dc]::format_foreign::printf::Substitutions as core[554a336f897370d5]::iter::traits::iterator::Iterator>::next
  13:     0x7f824e62e0fe - rustc_builtin_macros[5110e67ae3fbf1dc]::format::make_format_args
  14:     0x7f824e7a59cb - rustc_builtin_macros[5110e67ae3fbf1dc]::format::expand_format_args_impl
  15:     0x7f824a7c210c - <rustc_expand[a63df943e9d70b7e]::expand::MacroExpander>::fully_expand_fragment
  16:     0x7f824e90c998 - <rustc_expand[a63df943e9d70b7e]::expand::MacroExpander>::expand_crate
  17:     0x7f824e215741 - rustc_interface[d156b119c0ee28cb]::passes::resolver_for_lowering_raw
  18:     0x7f824e214ccd - rustc_query_impl[afd3850f0842b024]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[afd3850f0842b024]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b29a689460622aa4]::query::erase::Erased<[u8; 16usize]>>
  19:     0x7f824e214caf - <rustc_query_impl[afd3850f0842b024]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[554a336f897370d5]::ops::function::FnOnce<(rustc_middle[b29a689460622aa4]::ty::context::TyCtxt, ())>>::call_once
  20:     0x7f824ec03740 - rustc_query_system[6b56706b6a133fc0]::query::plumbing::try_execute_query::<rustc_query_impl[afd3850f0842b024]::DynamicConfig<rustc_query_system[6b56706b6a133fc0]::query::caches::SingleCache<rustc_middle[b29a689460622aa4]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[afd3850f0842b024]::plumbing::QueryCtxt, true>
  21:     0x7f824ec031b7 - rustc_query_impl[afd3850f0842b024]::query_impl::resolver_for_lowering_raw::get_query_incr::__rust_end_short_backtrace
  22:     0x7f824e81e07e - rustc_interface[d156b119c0ee28cb]::interface::run_compiler::<core[554a336f897370d5]::result::Result<(), rustc_span[7f36b8f4ab5c669f]::ErrorGuaranteed>, rustc_driver_impl[9e6d636adc327e66]::run_compiler::{closure#0}>::{closure#1}
  23:     0x7f824e7fae09 - std[420967f48346b39c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d156b119c0ee28cb]::util::run_in_thread_with_globals<rustc_interface[d156b119c0ee28cb]::util::run_in_thread_pool_with_globals<rustc_interface[d156b119c0ee28cb]::interface::run_compiler<core[554a336f897370d5]::result::Result<(), rustc_span[7f36b8f4ab5c669f]::ErrorGuaranteed>, rustc_driver_impl[9e6d636adc327e66]::run_compiler::{closure#0}>::{closure#1}, core[554a336f897370d5]::result::Result<(), rustc_span[7f36b8f4ab5c669f]::ErrorGuaranteed>>::{closure#0}, core[554a336f897370d5]::result::Result<(), rustc_span[7f36b8f4ab5c669f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[554a336f897370d5]::result::Result<(), rustc_span[7f36b8f4ab5c669f]::ErrorGuaranteed>>
  24:     0x7f824e7fabb6 - <<std[420967f48346b39c]::thread::Builder>::spawn_unchecked_<rustc_interface[d156b119c0ee28cb]::util::run_in_thread_with_globals<rustc_interface[d156b119c0ee28cb]::util::run_in_thread_pool_with_globals<rustc_interface[d156b119c0ee28cb]::interface::run_compiler<core[554a336f897370d5]::result::Result<(), rustc_span[7f36b8f4ab5c669f]::ErrorGuaranteed>, rustc_driver_impl[9e6d636adc327e66]::run_compiler::{closure#0}>::{closure#1}, core[554a336f897370d5]::result::Result<(), rustc_span[7f36b8f4ab5c669f]::ErrorGuaranteed>>::{closure#0}, core[554a336f897370d5]::result::Result<(), rustc_span[7f36b8f4ab5c669f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[554a336f897370d5]::result::Result<(), rustc_span[7f36b8f4ab5c669f]::ErrorGuaranteed>>::{closure#2} as core[554a336f897370d5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7f82497b38cb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h56757e55bbcfa856
                               at /rustc/6e1d94708a0a4a35ca7e46c6cac98adf62fe800e/library/alloc/src/boxed.rs:2022:9
  26:     0x7f82497b38cb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf230e264012c630a
                               at /rustc/6e1d94708a0a4a35ca7e46c6cac98adf62fe800e/library/alloc/src/boxed.rs:2022:9
  27:     0x7f82497b38cb - std::sys::pal::unix::thread::Thread::new::thread_start::hfcc46c6a7fe0b042
                               at /rustc/6e1d94708a0a4a35ca7e46c6cac98adf62fe800e/library/std/src/sys/pal/unix/thread.rs:108:17
  28:     0x7f82496bd609 - start_thread
  29:     0x7f82495e0353 - clone
  30:                0x0 - <unknown>


rustc version: 1.80.0-nightly (6e1d94708 2024-05-10)
platform: 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

No one assigned

    Labels

    C-bugCategory: This is a bug.I-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