-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
fmt::Display compiler panic: len is 0 but the index is 0 #66065
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.I-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.I-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Hi there! This is the second time I've compiled code with Rust ever, and my first time filing a bug report, so I may need some guidance if the info here isn't quite enough to work with :).
Learning about println! in Rust by Example, I incorrectly entered the below code. I looked at the documentation and realized I had made a mistake, but the compiler still panicked and recommended I open a bug report. I really believe in Rust and want to see this project succeed, hopefully this information is helpful!
println!("Pi is roughly: {:.*}, 3, 3.141592")
"Pi is roughly 3.142"
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/slice/mod.rs:2715:10
note: run with
RUST_BACKTRACE=1environment variable to display a backtrace.error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.38.0 (625451e 2019-09-23) running on x86_64-unknown-linux-gnu
Meta
rustc --version --verbose:rustc 1.38.0 (625451e 2019-09-23)binary: rustc
commit-hash: 625451e
commit-date: 2019-09-23
host: x86_64-unknown-linux-gnu
release: 1.38.0
LLVM version: 9.0
Backtrace:
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/slice/mod.rs:2715:10
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:47
3: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:36
4: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:200
5: std::panicking::default_hook
at src/libstd/panicking.rs:214
6: rustc::util::common::panic_hook
7: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:481
8: std::panicking::continue_panic_fmt
at src/libstd/panicking.rs:384
9: rust_begin_unwind
at src/libstd/panicking.rs:311
10: core::panicking::panic_fmt
at src/libcore/panicking.rs:85
11: core::panicking::panic_bounds_check
at src/libcore/panicking.rs:61
12: syntax_ext::format::expand_preparsed_format_args
13: syntax_ext::format::expand_format_args_impl
14: ::expand
15: syntax::ext::expand::MacroExpander::expand_fragment
16: syntax::ext::expand::MacroExpander::expand_crate
17: rustc_interface::passes::configure_and_expand_inner::{{closure}}
18: rustc::util::common::time
19: rustc_interface::passes::configure_and_expand_inner
20: rustc_interface::passes::configure_and_expand::{{closure}}
21: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
22: rustc_interface::passes::configure_and_expand
23: rustc_interface::queries::Query::compute
24: rustc_interface::queries::::expansion
25: rustc_interface::interface::run_compiler_in_existing_thread_pool
26: std::thread::local::LocalKey::with
27: syntax::with_globals
note: Some details are omitted, run with
RUST_BACKTRACE=fullfor a verbose backtrace.query stack during panic:
end of query stack