Closed
Description
This test is compile-fail/never_transmute_humans.rs from miri
// This should fail even without validation
// compile-flags: -Zmir-emit-validate=0
#![feature(never_type)]
#![allow(unreachable_code)]
#![allow(unused_variables)]
struct Human;
fn main() {
let x: ! = unsafe {
std::mem::transmute::<Human, !>(Human) //~ ERROR entered unreachable code
};
f(x)
}
fn f(x: !) -> ! { x }
backtrace
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
1: std::sys_common::backtrace::print
2: std::panicking::default_hook::{{closure}}
3: std::panicking::default_hook
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
6: std::panicking::begin_panic_fmt
7: rust_begin_unwind
8: core::panicking::panic_fmt
9: core::panicking::panic
10: rustc_trans::mir::block::<impl rustc_trans::mir::FunctionCx<'a, 'tcx>>::trans_terminator
11: rustc_trans::mir::trans_mir
12: rustc_trans::base::trans_instance
13: rustc_trans::trans_item::MonoItemExt::define
14: rustc_trans::base::compile_codegen_unit
15: rustc::ty::maps::<impl rustc::ty::maps::config::QueryConfig<'tcx> for rustc::ty::maps::queries::compile_codegen_unit<'tcx>>::compute
16: rustc::dep_graph::graph::DepGraph::with_task_impl
17: rustc::ty::context::tls::with_related_context
18: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
19: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
20: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::compile_codegen_unit
21: rustc_trans::base::trans_crate
22: <rustc_trans::LlvmTransCrate as rustc_trans_utils::trans_crate::TransCrate>::trans_crate
23: rustc::util::common::time
24: rustc_driver::driver::phase_4_translate_to_llvm
25: rustc_driver::driver::compile_input::{{closure}}
26: rustc::ty::context::tls::enter_context
27: <std::thread::local::LocalKey<T>>::with
28: rustc::ty::context::TyCtxt::create_and_enter
29: rustc_driver::driver::compile_input
30: rustc_driver::run_compiler_impl
31: <scoped_tls::ScopedKey<T>>::set
32: syntax::with_globals
33: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
34: __rust_maybe_catch_panic
35: rustc_driver::run
36: rustc_driver::main
37: std::rt::lang_start::{{closure}}
38: std::panicking::try::do_call
39: __rust_maybe_catch_panic
40: std::rt::lang_start_internal
41: main
query stack during panic:
#0 [compile_codegen_unit] compile_codegen_unit
end of query stack
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.27.0-nightly (8ff4b4206 2018-05-08) running on x86_64-apple-darwin