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 with -Zprint-type-sizes #89034

Closed
benbromhead opened this issue Sep 17, 2021 · 1 comment
Closed

ICE with -Zprint-type-sizes #89034

benbromhead opened this issue Sep 17, 2021 · 1 comment
Labels
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.

Comments

@benbromhead
Copy link

Steps to reproduce

Create a new cargo project with cargo init
Update Cargo.toml with the following:

[package]
name = "print_sizes_ice"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
proc-macro-nested = "0.1.7"

Compile with the following:
RUST_BACKTRACE=1 RUSTFLAGS=-Zprint-type-sizes cargo build --release

$ RUST_BACKTRACE=1 RUSTFLAGS=-Zprint-type-sizes cargo build --release
    Updating crates.io index
   Compiling proc-macro-nested v0.1.7
thread 'rustc' panicked at 'internal error: entered unreachable code: FieldsShape::offset: `Primitive`s have no fields', /rustc/e4828d5b7f745a9e867a9b0cc7f080f287bcf55d/compiler/rustc_target/src/abi/mod.rs:895:17
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
   3: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
   4: rustc_middle::ty::layout::layout_of
   5: rustc_query_system::query::plumbing::get_query
   6: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::layout_of
   7: rustc_middle::ty::layout::LayoutOf::layout_of
   8: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
   9: <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::fold
  10: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  11: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal
  12: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::of_instance
  13: rustc_codegen_llvm::mono_item::<impl rustc_codegen_ssa::traits::declare::PreDefineMethods for rustc_codegen_llvm::context::CodegenCx>::predefine_fn
  14: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
  15: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  16: rustc_codegen_llvm::base::compile_codegen_unit
  17: rustc_codegen_ssa::base::codegen_crate
  18: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  19: rustc_interface::queries::Queries::ongoing_codegen
  20: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  21: rustc_span::with_source_map
  22: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.57.0-nightly (e4828d5b7 2021-09-16) running on x86_64-apple-darwin

note: compiler flags: -Z print-type-sizes -C embed-bitcode=no -C debug-assertions=off --crate-type bin

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

query stack during panic:
#0 [layout_of] computing layout of `std::result::Result<std::convert::Infallible, !>`
end of query stack
error: could not compile `proc-macro-nested`

Also happens with 2018 edition. Practically I know the library generating this is deprecated, however it's brought in from another dependency in my project.

@benbromhead benbromhead 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 Sep 17, 2021
@jyn514
Copy link
Member

jyn514 commented Sep 17, 2021

Duplicate of #86528.

@jyn514 jyn514 closed this as completed Sep 17, 2021
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. 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

No branches or pull requests

2 participants