-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed as not planned
Closed as not planned
Copy link
Labels
A-lang-itemArea: Language itemsArea: Language itemsC-bugCategory: This is a bug.Category: This is a bug.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.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Description
Code
// build-pass
// compile-flags: -Z mir-opt-level=3
#![crate_type="lib"]
#![feature(lang_items)]
#![no_std]
#[lang = "owned_box"]
pub struct Box<T: ?Sized>(*mut T);
impl<T: ?Sized> Drop for Box<T> {
fn drop(&mut self) {
}
}
#[lang = "box_free"]
#[inline(always)]
unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
dealloc(ptr)
}
#[inline(never)]
fn dealloc<T: ?Sized>(_: *mut T) {
}
pub struct Foo<T>(T);
pub fn foo(a: Option<Box<Foo<usize>>>) -> usize {
let f = match a {
None => Foo(0),
Some(vec) => *vec,
};
f.0
}
Meta
rustc --version --verbose
:
rustc 1.62.0-nightly (ec77f2524 2022-04-17)
binary: rustc
commit-hash: ec77f252434a532fdb5699ae4f21a3072d211edd
commit-date: 2022-04-17
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.0
Error output
<output>
Backtrace
thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/compiler/rustc_middle/src/ty/layout.rs:2408:51
stack backtrace:
0: 0x7fa4c7c9d83d - std::backtrace_rs::backtrace::libunwind::trace::hdc1f21fb71c845ee
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7fa4c7c9d83d - std::backtrace_rs::backtrace::trace_unsynchronized::h825695a1eac7e4dc
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7fa4c7c9d83d - std::sys_common::backtrace::_print_fmt::h201cc1fed0ce4598
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/sys_common/backtrace.rs:66:5
3: 0x7fa4c7c9d83d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4c86a2fdb08a33f9
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/sys_common/backtrace.rs:45:22
4: 0x7fa4c7cf8f1c - core::fmt::write::hee99b3f0c63f5ca9
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/core/src/fmt/mod.rs:1194:17
5: 0x7fa4c7c8f031 - std::io::Write::write_fmt::hfa56cdeea03f4b89
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/io/mod.rs:1655:15
6: 0x7fa4c7ca0555 - std::sys_common::backtrace::_print::hbd75018aef718598
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/sys_common/backtrace.rs:48:5
7: 0x7fa4c7ca0555 - std::sys_common::backtrace::print::hc594da4af1e8ead7
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/sys_common/backtrace.rs:35:9
8: 0x7fa4c7ca0555 - std::panicking::default_hook::{{closure}}::h0602100d469ef01e
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/panicking.rs:295:22
9: 0x7fa4c7ca01c9 - std::panicking::default_hook::hc7ef6a8909090411
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/panicking.rs:314:9
10: 0x7fa4c84d0521 - rustc_driver[8e3c698622bece67]::DEFAULT_HOOK::{closure#0}::{closure#0}
11: 0x7fa4c7ca0d26 - std::panicking::rust_panic_with_hook::hb9245fe7222caa6e
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/panicking.rs:702:17
12: 0x7fa4c7ca0b27 - std::panicking::begin_panic_handler::{{closure}}::he83bcf9a0c850a85
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/panicking.rs:588:13
13: 0x7fa4c7c9dcf4 - std::sys_common::backtrace::__rust_end_short_backtrace::h465a02e71d825eac
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/sys_common/backtrace.rs:138:18
14: 0x7fa4c7ca0859 - rust_begin_unwind
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/panicking.rs:584:5
15: 0x7fa4c7c65c33 - core::panicking::panic_fmt::h23e69d1ae62ab6cd
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/core/src/panicking.rs:142:14
16: 0x7fa4c7c65b72 - core::panicking::panic_bounds_check::h8691db1ad4a2a4b5
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/core/src/panicking.rs:84:5
17: 0x7fa4c97ce917 - <rustc_middle[c02e249562e6ab88]::ty::Ty as rustc_target[707938acfa23df7d]::abi::TyAbiInterface<_>>::ty_and_layout_field::field_ty_or_layout::<rustc_codegen_llvm[b528a78dcf849805]::context::CodegenCx>
18: 0x7fa4c97e941f - <rustc_target[707938acfa23df7d]::abi::TyAndLayout<rustc_middle[c02e249562e6ab88]::ty::Ty>>::field::<rustc_codegen_llvm[b528a78dcf849805]::context::CodegenCx>
19: 0x7fa4c981e8bb - <rustc_codegen_ssa[a235b737831fdbb2]::mir::FunctionCx<rustc_codegen_llvm[b528a78dcf849805]::builder::Builder>>::codegen_place
20: 0x7fa4c9815481 - <rustc_codegen_ssa[a235b737831fdbb2]::mir::FunctionCx<rustc_codegen_llvm[b528a78dcf849805]::builder::Builder>>::codegen_rvalue
21: 0x7fa4c97fbbf9 - rustc_codegen_ssa[a235b737831fdbb2]::mir::codegen_mir::<rustc_codegen_llvm[b528a78dcf849805]::builder::Builder>
22: 0x7fa4c97c7503 - rustc_codegen_llvm[b528a78dcf849805]::base::compile_codegen_unit::module_codegen
23: 0x7fa4ca594716 - <rustc_query_system[b98794630d07627]::dep_graph::graph::DepGraph<rustc_middle[c02e249562e6ab88]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[c02e249562e6ab88]::ty::context::TyCtxt, rustc_span[e15e523c5f5ffbde]::symbol::Symbol, rustc_codegen_ssa[a235b737831fdbb2]::ModuleCodegen<rustc_codegen_llvm[b528a78dcf849805]::ModuleLlvm>>
24: 0x7fa4ca5941f9 - rustc_codegen_llvm[b528a78dcf849805]::base::compile_codegen_unit
25: 0x7fa4ca565f35 - rustc_codegen_ssa[a235b737831fdbb2]::base::codegen_crate::<rustc_codegen_llvm[b528a78dcf849805]::LlvmCodegenBackend>
26: 0x7fa4ca5b90fe - <rustc_codegen_llvm[b528a78dcf849805]::LlvmCodegenBackend as rustc_codegen_ssa[a235b737831fdbb2]::traits::backend::CodegenBackend>::codegen_crate
27: 0x7fa4ca540327 - <rustc_session[8619e56cac793b58]::session::Session>::time::<alloc[8d468ea801fd4f9]::boxed::Box<dyn core[f08f6a517a2b1407]::any::Any>, rustc_interface[b4fe925d1e8786a0]::passes::start_codegen::{closure#0}>
28: 0x7fa4ca53c0ec - <rustc_interface[b4fe925d1e8786a0]::passes::QueryContext>::enter::<<rustc_interface[b4fe925d1e8786a0]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[f08f6a517a2b1407]::result::Result<alloc[8d468ea801fd4f9]::boxed::Box<dyn core[f08f6a517a2b1407]::any::Any>, rustc_errors[dbef8fecc23abfce]::ErrorGuaranteed>>
29: 0x7fa4ca55e58f - <rustc_interface[b4fe925d1e8786a0]::queries::Queries>::ongoing_codegen
30: 0x7fa4ca505dcb - <rustc_interface[b4fe925d1e8786a0]::interface::Compiler>::enter::<rustc_driver[8e3c698622bece67]::run_compiler::{closure#1}::{closure#2}, core[f08f6a517a2b1407]::result::Result<core[f08f6a517a2b1407]::option::Option<rustc_interface[b4fe925d1e8786a0]::queries::Linker>, rustc_errors[dbef8fecc23abfce]::ErrorGuaranteed>>
31: 0x7fa4ca52eeef - rustc_span[e15e523c5f5ffbde]::with_source_map::<core[f08f6a517a2b1407]::result::Result<(), rustc_errors[dbef8fecc23abfce]::ErrorGuaranteed>, rustc_interface[b4fe925d1e8786a0]::interface::create_compiler_and_run<core[f08f6a517a2b1407]::result::Result<(), rustc_errors[dbef8fecc23abfce]::ErrorGuaranteed>, rustc_driver[8e3c698622bece67]::run_compiler::{closure#1}>::{closure#1}>
32: 0x7fa4ca5069b7 - <scoped_tls[ed206aee8c9203a6]::ScopedKey<rustc_span[e15e523c5f5ffbde]::SessionGlobals>>::set::<rustc_interface[b4fe925d1e8786a0]::interface::run_compiler<core[f08f6a517a2b1407]::result::Result<(), rustc_errors[dbef8fecc23abfce]::ErrorGuaranteed>, rustc_driver[8e3c698622bece67]::run_compiler::{closure#1}>::{closure#0}, core[f08f6a517a2b1407]::result::Result<(), rustc_errors[dbef8fecc23abfce]::ErrorGuaranteed>>
33: 0x7fa4ca51bf0f - std[7eb92d5d5059ff02]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b4fe925d1e8786a0]::util::run_in_thread_pool_with_globals<rustc_interface[b4fe925d1e8786a0]::interface::run_compiler<core[f08f6a517a2b1407]::result::Result<(), rustc_errors[dbef8fecc23abfce]::ErrorGuaranteed>, rustc_driver[8e3c698622bece67]::run_compiler::{closure#1}>::{closure#0}, core[f08f6a517a2b1407]::result::Result<(), rustc_errors[dbef8fecc23abfce]::ErrorGuaranteed>>::{closure#0}, core[f08f6a517a2b1407]::result::Result<(), rustc_errors[dbef8fecc23abfce]::ErrorGuaranteed>>
34: 0x7fa4ca51c049 - <<std[7eb92d5d5059ff02]::thread::Builder>::spawn_unchecked_<rustc_interface[b4fe925d1e8786a0]::util::run_in_thread_pool_with_globals<rustc_interface[b4fe925d1e8786a0]::interface::run_compiler<core[f08f6a517a2b1407]::result::Result<(), rustc_errors[dbef8fecc23abfce]::ErrorGuaranteed>, rustc_driver[8e3c698622bece67]::run_compiler::{closure#1}>::{closure#0}, core[f08f6a517a2b1407]::result::Result<(), rustc_errors[dbef8fecc23abfce]::ErrorGuaranteed>>::{closure#0}, core[f08f6a517a2b1407]::result::Result<(), rustc_errors[dbef8fecc23abfce]::ErrorGuaranteed>>::{closure#1} as core[f08f6a517a2b1407]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
35: 0x7fa4c7caabd3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd2056160a42acd52
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/alloc/src/boxed.rs:1866:9
36: 0x7fa4c7caabd3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h99c5b980edefbf69
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/alloc/src/boxed.rs:1866:9
37: 0x7fa4c7caabd3 - std::sys::unix::thread::Thread::new::thread_start::h42961cfa146716e3
at /rustc/ec77f252434a532fdb5699ae4f21a3072d211edd/library/std/src/sys/unix/thread.rs:108:17
38: 0x7fa4c7a835c2 - start_thread
39: 0x7fa4c7b08584 - __clone
40: 0x0 - <unknown>
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.62.0-nightly (ec77f2524 2022-04-17) running on x86_64-unknown-linux-gnu
query stack during panic:
end of query stack
Metadata
Metadata
Assignees
Labels
A-lang-itemArea: Language itemsArea: Language itemsC-bugCategory: This is a bug.Category: This is a bug.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.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.