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 trying to construct ! #36479

Closed
durka opened this Issue Sep 14, 2016 · 4 comments

Comments

Projects
None yet
6 participants
@durka
Copy link
Contributor

durka commented Sep 14, 2016

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

@canndrew

This comment has been minimized.

Copy link
Contributor

canndrew commented Sep 15, 2016

I dunno exactly why that's happening but I think the fix would be to make transmute-ing to an uninhabited type from a non-uninhabited type a compile error.

Edit: Oh right, which you already said. I'll try and do a PR for this today.

@Aatch Aatch added the I-ICE label Sep 15, 2016

@canndrew

This comment has been minimized.

Copy link
Contributor

canndrew commented Sep 15, 2016

PRs #36449 and #36489 in combination are a fix for this.

@cyplo

This comment has been minimized.

Copy link
Contributor

cyplo commented Nov 21, 2017

Still panics on: rustc 1.23.0-nightly (8b22e70 2017-10-31) running on x86_64-apple-darwin

@rkruppe

This comment has been minimized.

Copy link
Member

rkruppe commented May 28, 2018

This doesn't ICE any more on nightly playground (2018-05-25). I think #50803 fixed this.

@durka durka closed this May 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.