Skip to content

ICE with unsizing an extern type #79409

@DutchGhost

Description

@DutchGhost

Code

#![feature(extern_types)]
#![feature(unsized_locals)]

extern { 
    type Device;
}

unsafe fn make_device() -> Box<Device> {
    Box::from_raw(0 as *mut _)
}

fn main() {
    let d: Device = unsafe { *make_device() };
}

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (1c389ffef 2020-11-24)

Error output

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `false`,
 right: `true`', compiler/rustc_codegen_llvm/src/builder.rs:445:9
Backtrace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/core/src/panicking.rs:92:14
   2: <rustc_codegen_llvm::builder::Builder as rustc_codegen_ssa::traits::builder::BuilderMethods>::load_operand
   3: rustc_codegen_ssa::mir::operand::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_consume
   4: rustc_codegen_ssa::mir::operand::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_operand
   5: rustc_codegen_ssa::mir::block::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_block
   6: rustc_codegen_ssa::mir::codegen_mir
   7: rustc_codegen_ssa::base::codegen_instance
   8: <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define
   9: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
  10: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  11: rustc_codegen_llvm::base::compile_codegen_unit
  12: rustc_codegen_ssa::base::codegen_crate
  13: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  14: rustc_interface::queries::Queries::ongoing_codegen
  15: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  16: rustc_span::with_source_map
  17: 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-extern_types`#![feature(extern_types)]`F-unsized_locals`#![feature(unsized_locals)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions