diff options
| author | Jorge Aparicio <jorge@japaric.io> | 2018-08-23 16:36:51 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2018-09-30 17:27:06 +0200 |
| commit | 7294fcdc410051777f124a80d63e7a7a629fcec5 (patch) | |
| tree | da2ad9496947d845e8f7d6fd6715a7f47f8f1535 /src | |
| parent | bd3c7812cbadf875ebcc79d65a1f65c29dea0c8c (diff) | |
| download | rust-7294fcdc410051777f124a80d63e7a7a629fcec5.tar.gz rust-7294fcdc410051777f124a80d63e7a7a629fcec5.zip | |
improve panic message
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_codegen_llvm/mir/block.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/librustc_codegen_llvm/mir/block.rs b/src/librustc_codegen_llvm/mir/block.rs index 72fb9df6f81..c8515a4b6ff 100644 --- a/src/librustc_codegen_llvm/mir/block.rs +++ b/src/librustc_codegen_llvm/mir/block.rs @@ -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], |
