Closed
Description
fn main() {
[(); std::usize::MAX].to_vec();
}
yields
rustc 1.17.0-nightly (536a900c4 2017-02-17)
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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'capacity overflow', /checkout/src/libcore/option.rs:785
stack backtrace:
1: 0x7fae53745009 - std::sys::imp::backtrace::tracing::imp::write::hbb14611794d3841b
at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
2: 0x7fae5375369e - std::panicking::default_hook::{{closure}}::h6ed906c7818ac88c
at /checkout/src/libstd/panicking.rs:351
3: 0x7fae53753244 - std::panicking::default_hook::h23eeafbf7c1c05c3
at /checkout/src/libstd/panicking.rs:361
4: 0x7fae53753afb - std::panicking::rust_panic_with_hook::hd0067971b6d1240e
at /checkout/src/libstd/panicking.rs:545
5: 0x7fae53753984 - std::panicking::begin_panic::h1fd1f10a3de8f902
at /checkout/src/libstd/panicking.rs:507
6: 0x7fae537538f9 - std::panicking::begin_panic_fmt::haa043917b5d6f21b
at /checkout/src/libstd/panicking.rs:491
7: 0x7fae53753887 - rust_begin_unwind
at /checkout/src/libstd/panicking.rs:467
8: 0x7fae5378ffad - core::panicking::panic_fmt::he9c7f335d160b59d
at /checkout/src/libcore/panicking.rs:69
9: 0x7fae5379003d - core::option::expect_failed::h4aee2e09812a5db0
at /checkout/src/libcore/option.rs:785
10: 0x7fae521353a6 - rustc_trans::mir::constant::MirConstContext::const_rvalue::heb484f8472627f5c
11: 0x7fae5212ff12 - rustc_trans::mir::constant::MirConstContext::trans::h35feb1f9cf557c80
12: 0x7fae52136a0c - rustc_trans::mir::constant::<impl rustc_trans::mir::MirContext<'a, 'tcx>>::trans_constant::h08c4da4fb1fb7de9
13: 0x7fae5213a48a - rustc_trans::mir::operand::<impl rustc_trans::mir::MirContext<'a, 'tcx>>::trans_operand::h030b0d35ad91ccc1
14: 0x7fae5213ed86 - rustc_trans::mir::rvalue::<impl rustc_trans::mir::MirContext<'a, 'tcx>>::trans_rvalue_operand::h8daa5f1b02e3409a
15: 0x7fae52128c5c - rustc_trans::mir::block::<impl rustc_trans::mir::MirContext<'a, 'tcx>>::trans_block::hc875b973724a7a5b
16: 0x7fae52126408 - rustc_trans::mir::trans_mir::hbf96b5a8626b9c5e
17: 0x7fae52145497 - rustc_trans::trans_item::TransItem::define::h6fe5680662abac88
18: 0x7fae520c8041 - rustc_trans::base::trans_crate::h5e0e08437ed5cea1
19: 0x7fae53b07725 - rustc_driver::driver::phase_4_translate_to_llvm::h17c152535d661e43
20: 0x7fae53ad70ee - rustc_driver::driver::compile_input::{{closure}}::hc10e3fe5b6db0076
21: 0x7fae53af4f7f - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::h7d2a6da150c7eba7
22: 0x7fae53a5fa14 - rustc::ty::context::TyCtxt::create_and_enter::h825fbad7d24d1480
23: 0x7fae53ad4e63 - rustc_driver::driver::compile_input::hf3e3aa4173908b86
24: 0x7fae53b1c42d - rustc_driver::run_compiler::h8f8d47f1d258a8a6
25: 0x7fae53a267cb - std::panicking::try::do_call::h206b9daee04f4ea2
26: 0x7fae5375c9aa - __rust_maybe_catch_panic
at /checkout/src/libpanic_unwind/lib.rs:98
27: 0x7fae53a4eb92 - <F as alloc::boxed::FnBox<A>>::call_box::h5d196fbb3229f499
28: 0x7fae537524e4 - std::sys::imp::thread::Thread::new::thread_start::h2c901daa88f3cb32
at /checkout/src/liballoc/boxed.rs:648
at /checkout/src/libstd/sys_common/thread.rs:21
at /checkout/src/libstd/sys/unix/thread.rs:84
29: 0x7fae4b5016b9 - start_thread
30: 0x7fae5340582c - clone
31: 0x0 - <unknown>
On the playground, the minimum value that will cause this error is [(); (std::usize::MAX >> 3) + 1]
, where [(); std::usize::MAX >> 3].to_vec()
yields
rustc 1.17.0-nightly (536a900c4 2017-02-17)
fatal runtime error: out of memory
Illegal instruction (core dumped)
even though there should be no memory being allocated (size 0 type).
Metadata
Metadata
Assignees
Labels
No labels