Closed
Description
Originally stumbled upon through the eval IRC bot: https://play.rust-lang.org/?gist=56ee292ac11008f001f7d1093bacd982&version=stable&mode=debug
Here's the smallest reproduction I could get, playground
fn main() {
&{[1, 2, 3][4]};
}
Removing either the block or the borrow displays only a normal compiler error (not an ICE)
trace
Compiling playground v0.0.1 (/playground)
error: index out of bounds: the len is 3 but the index is 4
--> src/main.rs:2:7
|
2 | &{[1, 2, 3][4]};
| ^^^^^^^^^^^^
|
= note: #[deny(const_err)] on by default
thread 'rustc' panicked at 'Tried to access element 4 of array/slice with length 3', src/librustc_mir/interpret/place.rs:378:17
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
1: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:59
at src/libstd/panicking.rs:197
3: std::panicking::default_hook
at src/libstd/panicking.rs:211
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:478
6: std::panicking::continue_panic_fmt
at src/libstd/panicking.rs:381
7: std::panicking::begin_panic_fmt
at src/libstd/panicking.rs:336
8: rustc_mir::interpret::place::<impl rustc_mir::interpret::eval_context::InterpretCx<M>>::mplace_projection
9: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpretCx<M>>::eval_place_to_op
10: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpretCx<M>>::run
11: rustc_mir::const_eval::eval_body_using_ecx
12: rustc_mir::const_eval::const_eval_raw_provider
13: rustc::ty::query::__query_compute::const_eval_raw
14: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval_raw>::compute
15: rustc::dep_graph::graph::DepGraph::with_task_impl
16: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
17: rustc_mir::const_eval::const_eval_provider
18: rustc::ty::query::__query_compute::const_eval
19: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval>::compute
20: rustc::dep_graph::graph::DepGraph::with_task_impl
21: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
22: rustc_mir::const_eval::const_eval_provider
23: rustc::ty::query::__query_compute::const_eval
24: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval>::compute
25: rustc::dep_graph::graph::DepGraph::with_task_impl
26: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
27: rustc_mir::monomorphize::collector::collect_items_rec
28: rustc_mir::monomorphize::collector::collect_crate_mono_items::{{closure}}
29: rustc::util::common::time
30: rustc_mir::monomorphize::collector::collect_crate_mono_items
31: rustc::util::common::time
32: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
33: rustc::ty::query::__query_compute::collect_and_partition_mono_items
34: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::collect_and_partition_mono_items>::compute
35: rustc::dep_graph::graph::DepGraph::with_task_impl
36: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
37: rustc_codegen_ssa::base::codegen_crate
38: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
39: rustc::util::common::time
40: rustc_interface::passes::start_codegen
41: rustc::ty::context::tls::enter_global
42: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
43: rustc_interface::passes::create_global_ctxt::{{closure}}
44: rustc_interface::passes::BoxedGlobalCtxt::enter
45: rustc_interface::queries::Query<T>::compute
46: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::ongoing_codegen
47: rustc_interface::interface::run_compiler_in_existing_thread_pool
48: std::thread::local::LocalKey<T>::with
49: scoped_tls::ScopedKey<T>::set
50: syntax::with_globals
query stack during panic:
#0 [const_eval_raw] const-evaluating `main`
#1 [const_eval] const-evaluating + checking `main`
#2 [const_eval] const-evaluating + checking `main`
#3 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to previous error
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.35.0 (3c235d560 2019-05-20) running on x86_64-unknown-linux-gnu
note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin
note: some of the compiler flags provided by cargo are hidden
error: Could not compile `playground`.
To learn more, run the command again with --verbose.