Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to get layout for [type error]: the type [type error] has an unknown layout #93997

Closed
mejrs opened this issue Feb 14, 2022 · 2 comments · Fixed by #94248
Closed

failed to get layout for [type error]: the type [type error] has an unknown layout #93997

mejrs opened this issue Feb 14, 2022 · 2 comments · Fixed by #94248
Assignees
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@mejrs
Copy link
Contributor

mejrs commented Feb 14, 2022

Code

fn main() {
    while {} {}
}

Playground

Original example that triggered this:

fn main() {
    let mut x: u8 = 0;
    while {
        print!("yay ");
        x += (x + 1) - x;
        x < 10;
    } {}
}

Meta

It exists on stable, beta and nightly.

rustc --version --verbose:

rustc 1.60.0-nightly (1e12aef3f 2022-02-13) running on x86_64-unknown-linux-gnu

Error output

Compiling playground v0.0.1 (/playground)
error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:912:13: failed to get layout for `[type error]`: the type `[type error]` has an unknown layout
 [--> src/main.rs:1:1
](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#)  |
1 | fn main() {
  | ^^^^^^^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/compiler/rustc_errors/src/lib.rs:1106:9
Backtrace


stack backtrace:
   0:     0x7fb656804b5c - std::backtrace_rs::backtrace::libunwind::trace::h38d656af46687c91
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fb656804b5c - std::backtrace_rs::backtrace::trace_unsynchronized::h6463e81b43d545da
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fb656804b5c - std::sys_common::backtrace::_print_fmt::h7d0aeff1635ad318
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fb656804b5c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he9ed9f7bc97615c6
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fb65686667c - core::fmt::write::h26fb070fd492e04f
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/core/src/fmt/mod.rs:1190:17
   5:     0x7fb6567f4ed8 - std::io::Write::write_fmt::ha7a1cfea3d855428
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/std/src/io/mod.rs:1657:15
   6:     0x7fb656808ad7 - std::sys_common::backtrace::_print::h6a43ee74b02286e0
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fb656808ad7 - std::sys_common::backtrace::print::hfe9d3eef26a9b46f
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fb656808ad7 - std::panicking::default_hook::{{closure}}::he3bbb991ed25ca71
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/std/src/panicking.rs:295:22
   9:     0x7fb65680879f - std::panicking::default_hook::h4e425f0c50c308bd
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/std/src/panicking.rs:314:9
  10:     0x7fb656f94cb1 - rustc_driver[a91e56fa9d42f309]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fb6568093b5 - std::panicking::rust_panic_with_hook::h22c18dec3fc9e708
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/std/src/panicking.rs:702:17
  12:     0x7fb6570d2c21 - std[b153a624bb710ba]::panicking::begin_panic::<rustc_errors[73a3c157b3209785]::ExplicitBug>::{closure#0}
  13:     0x7fb6570d2a76 - std[b153a624bb710ba]::sys_common::backtrace::__rust_end_short_backtrace::<std[b153a624bb710ba]::panicking::begin_panic<rustc_errors[73a3c157b3209785]::ExplicitBug>::{closure#0}, !>
  14:     0x7fb657109a96 - std[b153a624bb710ba]::panicking::begin_panic::<rustc_errors[73a3c157b3209785]::ExplicitBug>
  15:     0x7fb657109356 - std[b153a624bb710ba]::panic::panic_any::<rustc_errors[73a3c157b3209785]::ExplicitBug>
  16:     0x7fb657106548 - <rustc_errors[73a3c157b3209785]::HandlerInner>::span_bug::<rustc_span[cd0e477a0d9055ec]::span_encoding::Span>
  17:     0x7fb657106220 - <rustc_errors[73a3c157b3209785]::Handler>::span_bug::<rustc_span[cd0e477a0d9055ec]::span_encoding::Span>
  18:     0x7fb6570f33b8 - rustc_middle[cc566e06f15dafa0]::ty::context::tls::with_opt::<rustc_middle[cc566e06f15dafa0]::util::bug::opt_span_bug_fmt<rustc_span[cd0e477a0d9055ec]::span_encoding::Span>::{closure#0}, ()>
  19:     0x7fb6570f3470 - rustc_middle[cc566e06f15dafa0]::util::bug::opt_span_bug_fmt::<rustc_span[cd0e477a0d9055ec]::span_encoding::Span>
  20:     0x7fb6570f343c - rustc_middle[cc566e06f15dafa0]::util::bug::span_bug_fmt::<rustc_span[cd0e477a0d9055ec]::span_encoding::Span>
  21:     0x7fb6570c2b94 - <rustc_codegen_llvm[ce7fced1d54ea27c]::context::CodegenCx as rustc_middle[cc566e06f15dafa0]::ty::layout::LayoutOfHelpers>::handle_layout_err
  22:     0x7fb6570c62b1 - <rustc_codegen_llvm[ce7fced1d54ea27c]::context::CodegenCx as rustc_middle[cc566e06f15dafa0]::ty::layout::LayoutOf>::spanned_layout_of::{closure#0}
  23:     0x7fb6581e855c - <core[62aaa051b59bb8a7]::iter::adapters::map::Map<core[62aaa051b59bb8a7]::slice::iter::Iter<rustc_middle[cc566e06f15dafa0]::mir::LocalDecl>, rustc_codegen_ssa[c5eabbff9f30fa84]::mir::analyze::non_ssa_locals<rustc_codegen_llvm[ce7fced1d54ea27c]::builder::Builder>::{closure#0}> as core[62aaa051b59bb8a7]::iter::traits::iterator::Iterator>::fold::<(), core[62aaa051b59bb8a7]::iter::traits::iterator::Iterator::for_each::call<rustc_codegen_ssa[c5eabbff9f30fa84]::mir::analyze::LocalKind, <alloc[5fc1b733952c8f94]::vec::Vec<rustc_codegen_ssa[c5eabbff9f30fa84]::mir::analyze::LocalKind> as alloc[5fc1b733952c8f94]::vec::spec_extend::SpecExtend<rustc_codegen_ssa[c5eabbff9f30fa84]::mir::analyze::LocalKind, core[62aaa051b59bb8a7]::iter::adapters::map::Map<core[62aaa051b59bb8a7]::slice::iter::Iter<rustc_middle[cc566e06f15dafa0]::mir::LocalDecl>, rustc_codegen_ssa[c5eabbff9f30fa84]::mir::analyze::non_ssa_locals<rustc_codegen_llvm[ce7fced1d54ea27c]::builder::Builder>::{closure#0}>>>::spec_extend::{closure#0}>::{closure#0}>
  24:     0x7fb65823bcbe - rustc_codegen_ssa[c5eabbff9f30fa84]::mir::analyze::non_ssa_locals::<rustc_codegen_llvm[ce7fced1d54ea27c]::builder::Builder>
  25:     0x7fb65821a529 - rustc_codegen_ssa[c5eabbff9f30fa84]::mir::codegen_mir::<rustc_codegen_llvm[ce7fced1d54ea27c]::builder::Builder>
  26:     0x7fb6581dab52 - rustc_codegen_llvm[ce7fced1d54ea27c]::base::compile_codegen_unit::module_codegen
  27:     0x7fb658e7a436 - <rustc_query_system[4f5991938760a368]::dep_graph::graph::DepGraph<rustc_middle[cc566e06f15dafa0]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[cc566e06f15dafa0]::ty::context::TyCtxt, rustc_span[cd0e477a0d9055ec]::symbol::Symbol, rustc_codegen_ssa[c5eabbff9f30fa84]::ModuleCodegen<rustc_codegen_llvm[ce7fced1d54ea27c]::ModuleLlvm>>
  28:     0x7fb658e765de - rustc_codegen_llvm[ce7fced1d54ea27c]::base::compile_codegen_unit
  29:     0x7fb658ea305e - <rustc_codegen_llvm[ce7fced1d54ea27c]::LlvmCodegenBackend as rustc_codegen_ssa[c5eabbff9f30fa84]::traits::backend::CodegenBackend>::codegen_crate
  30:     0x7fb658e31337 - <rustc_session[5d2f28b07d0c8873]::session::Session>::time::<alloc[5fc1b733952c8f94]::boxed::Box<dyn core[62aaa051b59bb8a7]::any::Any>, rustc_interface[cc122fef18c9905d]::passes::start_codegen::{closure#0}>
  31:     0x7fb658e4f4cc - <rustc_interface[cc122fef18c9905d]::passes::QueryContext>::enter::<<rustc_interface[cc122fef18c9905d]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[62aaa051b59bb8a7]::result::Result<alloc[5fc1b733952c8f94]::boxed::Box<dyn core[62aaa051b59bb8a7]::any::Any>, rustc_errors[73a3c157b3209785]::ErrorReported>>
  32:     0x7fb658e45e7f - <rustc_interface[cc122fef18c9905d]::queries::Queries>::ongoing_codegen
  33:     0x7fb658e1097b - rustc_interface[cc122fef18c9905d]::interface::create_compiler_and_run::<core[62aaa051b59bb8a7]::result::Result<(), rustc_errors[73a3c157b3209785]::ErrorReported>, rustc_driver[a91e56fa9d42f309]::run_compiler::{closure#1}>
  34:     0x7fb658df6052 - std[b153a624bb710ba]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[cc122fef18c9905d]::util::run_in_thread_pool_with_globals<rustc_interface[cc122fef18c9905d]::interface::run_compiler<core[62aaa051b59bb8a7]::result::Result<(), rustc_errors[73a3c157b3209785]::ErrorReported>, rustc_driver[a91e56fa9d42f309]::run_compiler::{closure#1}>::{closure#0}, core[62aaa051b59bb8a7]::result::Result<(), rustc_errors[73a3c157b3209785]::ErrorReported>>::{closure#0}, core[62aaa051b59bb8a7]::result::Result<(), rustc_errors[73a3c157b3209785]::ErrorReported>>
  35:     0x7fb658e29169 - <<std[b153a624bb710ba]::thread::Builder>::spawn_unchecked_<rustc_interface[cc122fef18c9905d]::util::run_in_thread_pool_with_globals<rustc_interface[cc122fef18c9905d]::interface::run_compiler<core[62aaa051b59bb8a7]::result::Result<(), rustc_errors[73a3c157b3209785]::ErrorReported>, rustc_driver[a91e56fa9d42f309]::run_compiler::{closure#1}>::{closure#0}, core[62aaa051b59bb8a7]::result::Result<(), rustc_errors[73a3c157b3209785]::ErrorReported>>::{closure#0}, core[62aaa051b59bb8a7]::result::Result<(), rustc_errors[73a3c157b3209785]::ErrorReported>>::{closure#1} as core[62aaa051b59bb8a7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x7fb656815243 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h353fa42c42b20ec5
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/alloc/src/boxed.rs:1854:9
  37:     0x7fb656815243 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0930c1c2fa5dac80
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/alloc/src/boxed.rs:1854:9
  38:     0x7fb656815243 - std::sys::unix::thread::Thread::new::thread_start::hb3ede8336acd4f71
                               at /rustc/1e12aef3fab243407f9d71ba9956cb2a1bf105d5/library/std/src/sys/unix/thread.rs:108:17
  39:     0x7fb656749609 - start_thread
  40:     0x7fb656663293 - clone
  41:                0x0 - <unknown>

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.60.0-nightly (1e12aef3f 2022-02-13) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `playground`

@mejrs mejrs added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 14, 2022
@5225225
Copy link
Contributor

5225225 commented Feb 14, 2022

Bisected this

searched toolchains dd549dc through 6d246f0


Regression in 9adfd9d


searched nightlies: from nightly-2019-11-20 to nightly-2022-02-06
regressed nightly: nightly-2021-11-27
searched commit range: dd549dc...6d246f0
regressed commit: 9adfd9d

bisected with cargo-bisect-rustc v0.6.1

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --regress ice --start 2019-11-20 -- build 

The code was just

fn main() {
    while {} {}
}

fanninpm added a commit to fanninpm/glacier that referenced this issue Feb 15, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Feb 15, 2022
@compiler-errors
Copy link
Member

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants