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 when using allocator API via reference #83304

Closed
mkroening opened this issue Mar 19, 2021 · 2 comments
Closed

ICE when using allocator API via reference #83304

mkroening opened this issue Mar 19, 2021 · 2 comments
Labels
A-allocators Area: Custom and system allocators A-layout Area: Memory layout of types 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

@mkroening
Copy link
Contributor

Code

#![feature(allocator_api)]

pub fn foo() -> u8 {
    *Box::new_in(0, &std::alloc::Global)
}

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (1705a7d64 2021-03-18)
binary: rustc
commit-hash: 1705a7d64b833d1c4b69958b0627bd054e6d764b
commit-date: 2021-03-18
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0

Error output

thread 'rustc' panicked at 'assertion failed: i < this.fields.count()', /rustc/1705a7d64b833d1c4b69958b0627bd054e6d764b/compiler/rustc_middle/src/ty/layout.rs:2188:21
note: run with `RUST_BACKTRACE=1` environment variable to display a 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.52.0-nightly (1705a7d64 2021-03-18) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
end of query stack
Backtrace

   0: rust_begin_unwind
             at /rustc/1705a7d64b833d1c4b69958b0627bd054e6d764b/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/1705a7d64b833d1c4b69958b0627bd054e6d764b/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/1705a7d64b833d1c4b69958b0627bd054e6d764b/library/core/src/panicking.rs:50:5
   3: rustc_middle::ty::layout::<impl rustc_target::abi::TyAndLayoutMethods<C> for &rustc_middle::ty::TyS>::field::ty_and_layout_kind
   4: <rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS> as rustc_codegen_llvm::type_of::LayoutLlvmExt>::scalar_pair_element_llvm_type
   5: <rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS> as rustc_codegen_llvm::type_of::LayoutLlvmExt>::scalar_pair_element_llvm_type
   6: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_codegen_llvm::abi::FnAbiLlvmExt>::llvm_type
   7: rustc_codegen_llvm::mono_item::<impl rustc_codegen_ssa::traits::declare::PreDefineMethods for rustc_codegen_llvm::context::CodegenCx>::predefine_fn
   8: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
   9: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  10: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  11: rustc_codegen_llvm::base::compile_codegen_unit
  12: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  13: rustc_interface::passes::QueryContext::enter
  14: rustc_interface::queries::Queries::ongoing_codegen
  15: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  16: rustc_span::with_source_map
  17: rustc_interface::interface::create_compiler_and_run
  18: scoped_tls::ScopedKey<T>::set

@mkroening mkroening 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 19, 2021
@jonas-schievink jonas-schievink added A-allocators Area: Custom and system allocators A-layout Area: Memory layout of types labels Mar 19, 2021
@jyn514
Copy link
Member

jyn514 commented Mar 19, 2021

I think this is a duplicate of #78459.

@mkroening
Copy link
Contributor Author

Indeed. Thanks!

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-allocators Area: Custom and system allocators A-layout Area: Memory layout of types 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

3 participants