Skip to content

Another(?) 'failed to get layout for...' ICE #116065

Closed
@cehteh

Description

@cehteh

Code

Minimal Example:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d93a36587d78f6351cf687e2a8f00ace

use core::iter::Peekable;

type FooFn = &'static fn(&Peekable<&dyn Iterator<Item = i32>>);

pub const fn foofail(foofn: FooFn) {
    let _go_boom_ = foofn;
}

Meta

rustc --version --verbose:

rustc 1.72.1 (d5c2e9c34 2023-09-13)
binary: rustc
commit-hash: d5c2e9c342b358556da91d61ed4133f6f50fc0c3
commit-date: 2023-09-13
host: x86_64-unknown-linux-gnu
release: 1.72.1
LLVM version: 16.0.5

Same ICE on nightly and beta.

Error output

error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:987:13: failed to get layout for `Peekable<&dyn Iterator<Item = OsStr>>`: NormalizationFailure(std::option::Option<std::option::Option<<&dyn std::iter::Iterator<Item = std::ffi::OsStr> as std::iter::Iterator>::Item>>, Type(std::option::Option<std::option::Option<<&dyn std::iter::Iterator<Item = std::ffi::OsStr> as std::iter::Iterator>::Item>>))
Backtrace


thread 'rustc' panicked at 'Box<dyn Any>', /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/compiler/rustc_errors/src/lib.rs:995:33
stack backtrace:
   0:     0x7fdc86f62b51 - std::backtrace_rs::backtrace::libunwind::trace::h66dc1c6acf794faa
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fdc86f62b51 - std::backtrace_rs::backtrace::trace_unsynchronized::ha80d20099a67f790
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fdc86f62b51 - std::sys_common::backtrace::_print_fmt::h7b959d43f35f16d4
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fdc86f62b51 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdaa196410d9ee0b9
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fdc86fc96ff - core::fmt::rt::Argument::fmt::h0ddfbbe8be3f80d0
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/fmt/rt.rs:138:9
   5:     0x7fdc86fc96ff - core::fmt::write::h66b3c629f3d623e4
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/fmt/mod.rs:1094:21
   6:     0x7fdc86f55497 - std::io::Write::write_fmt::hb6d80fba4115e0c2
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/io/mod.rs:1714:15
   7:     0x7fdc86f62965 - std::sys_common::backtrace::_print::h1a49cfb0cf3cce17
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fdc86f62965 - std::sys_common::backtrace::print::hca95c2d0055e42a2
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fdc86f65743 - std::panicking::default_hook::{{closure}}::hc03c01c56bca600c
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:269:22
  10:     0x7fdc86f654d4 - std::panicking::default_hook::hb2cb5315b6634f1c
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:288:9
  11:     0x7fdc8a26b60b - rustc_driver_impl[e91af841be79713a]::install_ice_hook::{closure#0}
  12:     0x7fdc86f65f6e - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb3a915ffd78277c6
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/boxed.rs:2007:9
  13:     0x7fdc86f65f6e - std::panicking::rust_panic_with_hook::h75cd912a39a34e8a
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:709:13
  14:     0x7fdc8a0fc041 - std[74d10c9f32099e86]::panicking::begin_panic::<rustc_errors[db744a5925f28741]::ExplicitBug>::{closure#0}
  15:     0x7fdc8a0fbd66 - std[74d10c9f32099e86]::sys_common::backtrace::__rust_end_short_backtrace::<std[74d10c9f32099e86]::panicking::begin_panic<rustc_errors[db744a5925f28741]::ExplicitBug>::{closure#0}, !>
  16:     0x7fdc8a0e0216 - std[74d10c9f32099e86]::panicking::begin_panic::<rustc_errors[db744a5925f28741]::ExplicitBug>
  17:     0x7fdc8a0de732 - <rustc_errors[db744a5925f28741]::HandlerInner>::span_bug::<rustc_span[ca0c6fb73220b455]::span_encoding::Span, alloc[1f40c6002c873f6d]::string::String>
  18:     0x7fdc8a0ddb76 - <rustc_errors[db744a5925f28741]::Handler>::span_bug::<rustc_span[ca0c6fb73220b455]::span_encoding::Span, alloc[1f40c6002c873f6d]::string::String>
  19:     0x7fdc8a0d8a7d - rustc_middle[fbd75b4db2cdb7e6]::util::bug::opt_span_bug_fmt::<rustc_span[ca0c6fb73220b455]::span_encoding::Span>::{closure#0}
  20:     0x7fdc8a0d8aaa - rustc_middle[fbd75b4db2cdb7e6]::ty::context::tls::with_opt::<rustc_middle[fbd75b4db2cdb7e6]::util::bug::opt_span_bug_fmt<rustc_span[ca0c6fb73220b455]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fdc8a0d738a - rustc_middle[fbd75b4db2cdb7e6]::ty::context::tls::with_context_opt::<rustc_middle[fbd75b4db2cdb7e6]::ty::context::tls::with_opt<rustc_middle[fbd75b4db2cdb7e6]::util::bug::opt_span_bug_fmt<rustc_span[ca0c6fb73220b455]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fdc88b0ebc4 - rustc_middle[fbd75b4db2cdb7e6]::util::bug::span_bug_fmt::<rustc_span[ca0c6fb73220b455]::span_encoding::Span>
  23:     0x7fdc8a12ed1a - <rustc_codegen_llvm[367182e9bda81d84]::context::CodegenCx as rustc_middle[fbd75b4db2cdb7e6]::ty::layout::LayoutOfHelpers>::handle_layout_err
  24:     0x7fdc8a128bda - <rustc_codegen_llvm[367182e9bda81d84]::context::CodegenCx as rustc_middle[fbd75b4db2cdb7e6]::ty::layout::LayoutOf>::spanned_layout_of::{closure#0}
  25:     0x7fdc883d5d89 - <rustc_target[586facafeb2a002f]::abi::TyAndLayout<rustc_middle[fbd75b4db2cdb7e6]::ty::Ty> as rustc_codegen_llvm[367182e9bda81d84]::type_of::LayoutLlvmExt>::llvm_type
  26:     0x7fdc8863644e - <rustc_target[586facafeb2a002f]::abi::call::FnAbi<rustc_middle[fbd75b4db2cdb7e6]::ty::Ty> as rustc_codegen_llvm[367182e9bda81d84]::abi::FnAbiLlvmExt>::llvm_type
  27:     0x7fdc883d51b5 - <rustc_target[586facafeb2a002f]::abi::TyAndLayout<rustc_middle[fbd75b4db2cdb7e6]::ty::Ty> as rustc_codegen_llvm[367182e9bda81d84]::type_of::LayoutLlvmExt>::llvm_type
  28:     0x7fdc883d43a4 - <rustc_target[586facafeb2a002f]::abi::TyAndLayout<rustc_middle[fbd75b4db2cdb7e6]::ty::Ty> as rustc_codegen_llvm[367182e9bda81d84]::type_of::LayoutLlvmExt>::llvm_type
  29:     0x7fdc883d43a4 - <rustc_target[586facafeb2a002f]::abi::TyAndLayout<rustc_middle[fbd75b4db2cdb7e6]::ty::Ty> as rustc_codegen_llvm[367182e9bda81d84]::type_of::LayoutLlvmExt>::llvm_type
  30:     0x7fdc8863644e - <rustc_target[586facafeb2a002f]::abi::call::FnAbi<rustc_middle[fbd75b4db2cdb7e6]::ty::Ty> as rustc_codegen_llvm[367182e9bda81d84]::abi::FnAbiLlvmExt>::llvm_type
  31:     0x7fdc88634cfe - <rustc_codegen_llvm[367182e9bda81d84]::context::CodegenCx as rustc_codegen_ssa[d0f56ad1a06d95ee]::traits::declare::PreDefineMethods>::predefine_fn
  32:     0x7fdc8984a945 - rustc_codegen_llvm[367182e9bda81d84]::base::compile_codegen_unit::module_codegen
  33:     0x7fdc89848b35 - <rustc_middle[fbd75b4db2cdb7e6]::dep_graph::dep_node::DepKind as rustc_query_system[8b63fd0ca5778b73]::dep_graph::DepKind>::with_deps::<<rustc_query_system[8b63fd0ca5778b73]::dep_graph::graph::DepGraphData<rustc_middle[fbd75b4db2cdb7e6]::dep_graph::dep_node::DepKind>>::with_task<rustc_middle[fbd75b4db2cdb7e6]::ty::context::TyCtxt, rustc_span[ca0c6fb73220b455]::symbol::Symbol, rustc_codegen_ssa[d0f56ad1a06d95ee]::ModuleCodegen<rustc_codegen_llvm[367182e9bda81d84]::ModuleLlvm>>::{closure#0}::{closure#0}, rustc_codegen_ssa[d0f56ad1a06d95ee]::ModuleCodegen<rustc_codegen_llvm[367182e9bda81d84]::ModuleLlvm>>
  34:     0x7fdc8984831f - rustc_codegen_llvm[367182e9bda81d84]::base::compile_codegen_unit
  35:     0x7fdc89845965 - rustc_codegen_ssa[d0f56ad1a06d95ee]::base::codegen_crate::<rustc_codegen_llvm[367182e9bda81d84]::LlvmCodegenBackend>
  36:     0x7fdc89845266 - <rustc_codegen_llvm[367182e9bda81d84]::LlvmCodegenBackend as rustc_codegen_ssa[d0f56ad1a06d95ee]::traits::backend::CodegenBackend>::codegen_crate
  37:     0x7fdc89729a72 - <rustc_session[7bc6f0e7ff11a78e]::session::Session>::time::<alloc[1f40c6002c873f6d]::boxed::Box<dyn core[63ccc595abf60ca6]::any::Any>, rustc_interface[9522ab489a5f66e6]::passes::start_codegen::{closure#0}>
  38:     0x7fdc897295bb - rustc_interface[9522ab489a5f66e6]::passes::start_codegen
  39:     0x7fdc8972319a - <rustc_middle[fbd75b4db2cdb7e6]::ty::context::GlobalCtxt>::enter::<<rustc_interface[9522ab489a5f66e6]::queries::Queries>::ongoing_codegen::{closure#0}, core[63ccc595abf60ca6]::result::Result<alloc[1f40c6002c873f6d]::boxed::Box<dyn core[63ccc595abf60ca6]::any::Any>, rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>
  40:     0x7fdc897225e8 - <rustc_interface[9522ab489a5f66e6]::interface::Compiler>::enter::<rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}::{closure#2}, core[63ccc595abf60ca6]::result::Result<core[63ccc595abf60ca6]::option::Option<rustc_interface[9522ab489a5f66e6]::queries::Linker>, rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>
  41:     0x7fdc8971f7b5 - rustc_span[ca0c6fb73220b455]::set_source_map::<core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>, rustc_interface[9522ab489a5f66e6]::interface::run_compiler<core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>, rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  42:     0x7fdc8971f226 - <scoped_tls[35a2f59988e0a19c]::ScopedKey<rustc_span[ca0c6fb73220b455]::SessionGlobals>>::set::<rustc_interface[9522ab489a5f66e6]::interface::run_compiler<core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>, rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}>::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>
  43:     0x7fdc8971e7ec - std[74d10c9f32099e86]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9522ab489a5f66e6]::util::run_in_thread_pool_with_globals<rustc_interface[9522ab489a5f66e6]::interface::run_compiler<core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>, rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}>::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>
  44:     0x7fdc89aa53b5 - <<std[74d10c9f32099e86]::thread::Builder>::spawn_unchecked_<rustc_interface[9522ab489a5f66e6]::util::run_in_thread_pool_with_globals<rustc_interface[9522ab489a5f66e6]::interface::run_compiler<core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>, rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}>::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>::{closure#1} as core[63ccc595abf60ca6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7fdc86f70425 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hde6e666388faa495
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/boxed.rs:1993:9
  46:     0x7fdc86f70425 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9b6389e489a4842f
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/boxed.rs:1993:9
  47:     0x7fdc86f70425 - std::sys::unix::thread::Thread::new::thread_start::hcab660740b858b1f
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys/unix/thread.rs:108:17
  48:     0x7fdc86d0d044 - start_thread
                               at ./nptl/pthread_create.c:442:8
  49:     0x7fdc86d8d5fc - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  50:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions