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

ICE: compiler/rustc_codegen_llvm/src/context.rs, failed to get layout for [type error]: the type [type error] has an unknown layout #83691

Closed
chengniansun opened this issue Mar 30, 2021 · 3 comments
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) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@chengniansun
Copy link

rustc 1.32 does not ICE.

Code

mod dep1 {
    extern "C" {
        pub static collision: Box<_>;
    }
}
fn main() {
    dep1::collision
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (48691ea6e 2021-03-29)
binary: rustc
commit-hash: 48691ea6e639640f110b43e33d4aba1f07e7415c
commit-date: 2021-03-29
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

warning: `extern` block uses type `Box<[type error]>`, which is not FFI-safe
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:31
  |
3 |         pub static collision: Box<_>;
  |                               ^^^^^^ not FFI-safe
  |
  = note: `#[warn(improper_ctypes)]` on by default
  = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
  = note: this struct has unspecified layout

error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:784:17: failed to get layout for `[type error]`: the type `[type error]` has an unknown layout

thread 'rustc' panicked at 'Box<Any>', /rustc/48691ea6e639640f110b43e33d4aba1f07e7415c/library/std/src/panic.rs:59:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.53.0-nightly (48691ea6e 2021-03-29) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to previous error; 1 warning emitted
Backtrace

warning: `extern` block uses type `Box<[type error]>`, which is not FFI-safe
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:31
  |
3 |         pub static collision: Box<_>;
  |                               ^^^^^^ not FFI-safe
  |
  = note: `#[warn(improper_ctypes)]` on by default
  = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
  = note: this struct has unspecified layout

error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:784:17: failed to get layout for `[type error]`: the type `[type error]` has an unknown layout

thread 'rustc' panicked at 'Box<Any>', /rustc/48691ea6e639640f110b43e33d4aba1f07e7415c/library/std/src/panic.rs:59:5
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::bug
   3: rustc_errors::Handler::bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::bug_fmt
   7: <rustc_codegen_llvm::context::CodegenCx as rustc_target::abi::LayoutOf>::spanned_layout_of
   8: rustc_codegen_ssa::mir::analyze::non_ssa_locals
   9: rustc_codegen_ssa::mir::codegen_mir
  10: rustc_codegen_ssa::base::codegen_instance
  11: <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define
  12: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
  13: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  14: rustc_codegen_llvm::base::compile_codegen_unit
  15: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  16: rustc_interface::passes::QueryContext::enter
  17: rustc_interface::queries::Queries::ongoing_codegen
  18: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  19: rustc_span::with_source_map
  20: rustc_interface::interface::create_compiler_and_run
  21: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.53.0-nightly (48691ea6e 2021-03-29) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to previous error; 1 warning emitted

@chengniansun chengniansun 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 Mar 30, 2021
@jyn514 jyn514 added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Mar 30, 2021
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 30, 2021
@apiraino
Copy link
Contributor

Regression seems to be in nightly-2020-01-01

found 6 bors merge commits in the specified range
  commit[0] 2019-12-30UTC: Auto merge of #67707 - petrochenkov:crateren, r=Centril
  commit[1] 2019-12-31UTC: Auto merge of #67032 - cjgillot:hirene, r=Zoxc
  commit[2] 2019-12-31UTC: Auto merge of #67597 - estebank:placeholder-type, r=oli-obk
  commit[3] 2019-12-31UTC: Auto merge of #67752 - Dylan-DPC:rollup-7f9v4nx, r=Dylan-DPC
  commit[4] 2019-12-31UTC: Auto merge of #67699 - cjgillot:passes-resolve, r=Zoxc
  commit[5] 2019-12-31UTC: Auto merge of #67764 - Centril:rollup-ycbq3os, r=Centril
ERROR: no commits between a9dd56ff9a08d74c53d5cc22d18f126a12749608 
  and 119307a83e12291a3fc126735d6bd0292c443464 within last 167 days

@apiraino
Copy link
Contributor

Assigning priority as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 31, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Apr 2, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Apr 2, 2021
@Alexendoo
Copy link
Member

Fixed by #83734

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) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants