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

panic: assertion failed: i < this.fields.count() (allocator_api) #87856

Closed
ammkrn opened this issue Aug 8, 2021 · 2 comments
Closed

panic: assertion failed: i < this.fields.count() (allocator_api) #87856

ammkrn opened this issue Aug 8, 2021 · 2 comments
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

@ammkrn
Copy link

ammkrn commented Aug 8, 2021

I recognize this is an unstable feature, but I'm filing this per the compiler's request. I was trying out the allocator_api feature in conjunction with bumpalo ^3.6.1.

Code

#![feature(allocator_api)]
fn main() {
    use bumpalo::Bump;
    let b = Bump::new();
    let x = Box::new_in(1usize, &b);
}

Meta

Not sure if this happens with stable since it's a nightly-only feature.

rustc --version --verbose:

rustc 1.56.0-nightly (574d37568 2021-08-07) running on x86_64-apple-darwin

compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type bin

Error output

thread 'rustc' panicked at 'assertion failed: i < this.fields.count()', /rustc/574d37568029f5c637557a87426ade54770d9a14/compiler/rustc_middle/src/ty/layout.rs:2209:21

error: internal compiler error: unexpected panic

Backtrace:

stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   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_query_system::dep_graph::graph::DepGraph<K>::with_task
  10: rustc_codegen_llvm::base::compile_codegen_unit
  11: rustc_codegen_ssa::base::codegen_crate
  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
@ammkrn ammkrn 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 Aug 8, 2021
@beepster4096
Copy link
Contributor

I believe this is a duplicate of #78459

@beepster4096
Copy link
Contributor

This needs to be closed. #78459 is closed.

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

4 participants
@beepster4096 @ammkrn @Dylan-DPC and others