Skip to content

ICE trying to construct ! #36479

Closed
Closed
@durka

Description

@durka

This should lead to compile error or UB, but not an ICE.

#![feature(never_type)]

fn main() {
    println!("{:?}", unsafe { std::mem::transmute::<(),!>(()) });
}
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:317
stack backtrace:
   1:     0x7fdde4ace173 - std::sys::backtrace::tracing::imp::write::h4b09e6e8c01db097
   2:     0x7fdde4aded1d - std::panicking::default_hook::{{closure}}::h1d3243f546573ff4
   3:     0x7fdde4add2be - std::panicking::default_hook::h96c288d728df3ebf
   4:     0x7fdde4add9a8 - std::panicking::rust_panic_with_hook::hb1322e5f2588b4db
   5:     0x7fdde4add842 - std::panicking::begin_panic::hfbeda5aad583dc32
   6:     0x7fdde4add780 - std::panicking::begin_panic_fmt::h4fe9fb9d5109c4bf
   7:     0x7fdde4add701 - rust_begin_unwind
   8:     0x7fdde4b47e6f - core::panicking::panic_fmt::h4395919ece15c671
   9:     0x7fdde4b47d9b - core::panicking::panic::hc74ff52ed78364e1
  10:     0x7fdde362cd06 - rustc_trans::mir::block::<impl rustc_trans::mir::MirContext<'bcx, 'tcx>>::trans_block::he2f6252e2877e76b
  11:     0x7fdde36257b8 - rustc_trans::mir::trans_mir::hc6963a43e5e7752b
  12:     0x7fdde35c5d9e - rustc_trans::base::trans_closure::h7d9d1480ec1824e6
  13:     0x7fdde3645fe7 - rustc_trans::trans_item::TransItem::define::hfbf0030d6e6abc40
  14:     0x7fdde35c9244 - rustc_trans::base::trans_crate::h45437752c34c2c6e
  15:     0x7fdde4e9b17d - rustc_driver::driver::phase_4_translate_to_llvm::h1b8076dc9a7a3e1b
  16:     0x7fdde4ed6bdc - rustc_driver::driver::compile_input::{{closure}}::hdf708031c67974d4
  17:     0x7fdde4ec7d55 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::hcac3a2328cd9259a
  18:     0x7fdde4e93695 - rustc_driver::driver::phase_3_run_analysis_passes::h9865057b323cad0e
  19:     0x7fdde4e84793 - rustc_driver::driver::compile_input::hc0edbed7edb3eb18
  20:     0x7fdde4eb0626 - rustc_driver::run_compiler::h22d678d32fb7c300
  21:     0x7fdde4dee4c3 - std::panicking::try::do_call::h4d040997e2efdaf3
  22:     0x7fdde4aec046 - __rust_maybe_catch_panic
  23:     0x7fdde4e0be99 - <F as alloc::boxed::FnBox<A>>::call_box::hba0b436c79e56b23
  24:     0x7fdde4adb7f0 - std::sys::thread::Thread::new::thread_start::h022e3887023c6290
  25:     0x7fdddcb786f9 - start_thread
  26:     0x7fdde471eb5c - clone
  27:                0x0 - <unknown>

cc @canndrew

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions