diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2024-03-17 22:26:39 -0400 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2024-03-22 09:55:50 -0400 |
| commit | 00f4daa27673a07bf9ad20f4707d97bc1079450f (patch) | |
| tree | eef31d06035d56a9abaabb0d0cd3b972d84a4b0b /compiler/rustc_codegen_ssa/src/mir | |
| parent | 0ad927c0c07b65fc0dae37105e09c877c87c296a (diff) | |
| download | rust-00f4daa27673a07bf9ad20f4707d97bc1079450f.tar.gz rust-00f4daa27673a07bf9ad20f4707d97bc1079450f.zip | |
Codegen const panic messages as function calls
This skips emitting extra arguments at every callsite (of which there can be many). For a librustc_driver build with overflow checks enabled, this cuts 0.7MB from the resulting binary.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/mir')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/block.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index 02e7bb05b77..3749133b743 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -651,10 +651,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { (LangItem::PanicMisalignedPointerDereference, vec![required, found, location]) } _ => { - let msg = bx.const_str(msg.description()); - // It's `pub fn panic(expr: &str)`, with the wide reference being passed - // as two arguments, and `#[track_caller]` adds an implicit third argument. - (LangItem::Panic, vec![msg.0, msg.1, location]) + // It's `pub fn panic_...()` and `#[track_caller]` adds an implicit argument. + (msg.panic_function(), vec![location]) } }; |
