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 /tests/codegen-units | |
| 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 'tests/codegen-units')
| -rw-r--r-- | tests/codegen-units/item-collection/implicit-panic-call.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/codegen-units/item-collection/implicit-panic-call.rs b/tests/codegen-units/item-collection/implicit-panic-call.rs index 2e0d742307a..b348b4acc24 100644 --- a/tests/codegen-units/item-collection/implicit-panic-call.rs +++ b/tests/codegen-units/item-collection/implicit-panic-call.rs @@ -16,10 +16,17 @@ struct Location<'a> { _col: u32, } -#[lang = "panic"] +#[lang = "panic_const_div_by_zero"] #[inline] #[track_caller] -fn panic(_: &'static str) -> ! { +fn panic_div_zero() -> ! { + loop {} +} + +#[lang = "panic_const_div_overflow"] +#[inline] +#[track_caller] +fn panic_div_overflow() -> ! { loop {} } @@ -55,4 +62,5 @@ pub fn foo() { //~ MONO_ITEM fn foo //~ MONO_ITEM fn <i32 as Div>::div -//~ MONO_ITEM fn panic +//~ MONO_ITEM fn panic_div_zero +//~ MONO_ITEM fn panic_div_overflow |
