Skip to content

Commit

Permalink
improve panic message
Browse files Browse the repository at this point in the history
  • Loading branch information
japaric authored and RalfJung committed Sep 30, 2018
1 parent bd3c781 commit 7294fcd
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/librustc_codegen_llvm/mir/block.rs
Expand Up @@ -475,14 +475,12 @@ impl FunctionCx<'a, 'll, 'tcx> {
.max(tcx.data_layout.i32_align)
.max(tcx.data_layout.pointer_align);

let str = if intrinsic == Some("init") {
"Attempted to instantiate an uninhabited type (e.g. `!`) \
using mem::zeroed()"
} else {
"Attempted to instantiate an uninhabited type (e.g. `!`) \
using mem::uninitialized()"
};
let msg_str = Symbol::intern(str).as_str();
let str = format!(
"Attempted to instantiate uninhabited type {} using mem::{}",
sig.output(),
if intrinsic == Some("init") { "zeroed" } else { "uninitialized" }
);
let msg_str = Symbol::intern(&str).as_str();
let msg_str = C_str_slice(bx.cx, msg_str);
let msg_file_line_col = C_struct(bx.cx,
&[msg_str, filename, line, col],
Expand Down

0 comments on commit 7294fcd

Please sign in to comment.