Skip to content

Error when passing reference to Allocator impl to Box::new_in #92054

Closed
@pjht

Description

@pjht

Code

Could not isolate, but I think it was caused by passing a reference to a custom impl of Allocator to Box::new_zeroed_slice_in.

Meta

rustc --version --verbose:

rustc 1.59.0-nightly (6bda5b331 2021-12-12)
binary: rustc
commit-hash: 6bda5b331cfe7e04e1fe348c58a928fc2b650f4f
commit-date: 2021-12-12
host: x86_64-unknown-linux-gnu
release: 1.59.0-nightly
LLVM version: 13.0.0

Error output

error: internal compiler error: /rustc/6bda5b331cfe7e04e1fe348c58a928fc2b650f4f/compiler/rustc_codegen_ssa/src/mir/operand.rs:132:38: Deref of by-Ref operand OperandRef(Ref((%"alloc::boxed::Box<[u64], &virtual_memory::LazyWrp<spin::mutex::Mutex<virtual_m)

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1170:9
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.59.0-nightly (6bda5b331 2021-12-12) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options -C panic=abort -C embed-bitcode=no -C debuginfo=2 -C incremental -C link-args=-image-base 0xffff800000000000 --crate-type bin

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

query stack during panic:
end of query stack
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1170:9
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: std::panic::panic_any::<rustc_errors::ExplicitBug>
   2: <rustc_errors::HandlerInner>::bug
   3: <rustc_errors::Handler>::bug
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, ()>
   5: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>
   6: rustc_middle::util::bug::bug_fmt
   7: <rustc_codegen_ssa::mir::FunctionCx<rustc_codegen_llvm::builder::Builder>>::codegen_place
   8: <rustc_codegen_ssa::mir::FunctionCx<rustc_codegen_llvm::builder::Builder>>::codegen_rvalue_operand
   9: rustc_codegen_ssa::mir::codegen_mir::<rustc_codegen_llvm::builder::Builder>
  10: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
  11: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::symbol::Symbol, rustc_codegen_ssa::ModuleCodegen<rustc_codegen_llvm::ModuleLlvm>>
  12: rustc_codegen_llvm::base::compile_codegen_unit
  13: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  14: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
  15: <rustc_interface::queries::Queries>::ongoing_codegen
  16: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>>
  17: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  18: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions