diff options
| author | Jorge Aparicio <jorge@japaric.io> | 2018-08-23 16:36:51 +0200 |
|---|---|---|
| committer | Jorge Aparicio <jorge@japaric.io> | 2018-09-22 21:01:21 +0200 |
| commit | 33c10eae904a69422b47501444fc319185cc5158 (patch) | |
| tree | 9e55348deaae4615add4755981bc6a9185f4ae46 | |
| parent | ce6e6f93330b9333e188b7d3e99cbffdac725a59 (diff) | |
| download | rust-33c10eae904a69422b47501444fc319185cc5158.tar.gz rust-33c10eae904a69422b47501444fc319185cc5158.zip | |
improve panic message
| -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 e876585db65..b3ca78d59de 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], |
