Closed
Description
I tried this code:
fn main() {
println!("{:p$.w$}", 1.0, w = 2, p = 3);
}
cargo build
crashed with thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', compiler/rustc_builtin_macros/src/format.rs:1001:28
. I tried it on stable 1.62.1 and nightly 1.64.0-nightly (848090dcd 2022-07-22)
Meta
rustc --version --verbose
:
rustc 1.64.0-nightly (c2f428d2f 2022-07-14)
binary: rustc
commit-hash: c2f428d2f3340a0e7d995f4726223db91b93704c
commit-date: 2022-07-14
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6
Backtrace
thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', compiler/rustc_builtin_macros/src/format.rs:1001:28
stack backtrace:
0: rust_begin_unwind
at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/core/src/panicking.rs:142:14
2: core::panicking::panic_bounds_check
at /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c/library/core/src/panicking.rs:84:5
3: rustc_builtin_macros::format::expand_preparsed_format_args
4: rustc_builtin_macros::format::expand_format_args_impl
5: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
6: <rustc_expand::expand::MacroExpander>::expand_crate
7: <rustc_session::session::Session>::time::<core::result::Result<rustc_ast::ast::Crate, rustc_errors::ErrorGuaranteed>, rustc_interface::passes::configure_and_expand::{closure#1}>
8: rustc_interface::passes::configure_and_expand
9: <rustc_interface::queries::Queries>::expansion
10: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
11: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
12: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>
13: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: internal compiler error: unexpected panic