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.
This commit is contained in:
parent
0ad927c0c0
commit
00f4daa276
12 changed files with 255 additions and 63 deletions
|
@ -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])
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue