File tree Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -1234,6 +1234,9 @@ fn build_base_args(
1234
1234
if * panic != PanicStrategy :: Unwind {
1235
1235
cmd. arg ( "-C" ) . arg ( format ! ( "panic={}" , panic) ) ;
1236
1236
}
1237
+ if * panic == PanicStrategy :: ImmediateAbort {
1238
+ cmd. arg ( "-Z" ) . arg ( "unstable-options" ) ;
1239
+ }
1237
1240
1238
1241
cmd. args ( & lto_args ( build_runner, unit) ) ;
1239
1242
Original file line number Diff line number Diff line change @@ -890,6 +890,7 @@ unstable_cli_options!(
890
890
skip_rustdoc_fingerprint: bool ,
891
891
target_applies_to_host: bool = ( "Enable the `target-applies-to-host` key in the .cargo/config.toml file" ) ,
892
892
trim_paths: bool = ( "Enable the `trim-paths` option in profiles" ) ,
893
+ panic_immediate_abort: bool = ( "Enable setting `panic = \" immediate-abort\" ` in profiles" ) ,
893
894
unstable_options: bool = ( "Allow the usage of unstable options" ) ,
894
895
warnings: bool = ( "Allow use of the build.warnings config key" ) ,
895
896
) ;
@@ -1420,6 +1421,7 @@ impl CliUnstable {
1420
1421
"skip-rustdoc-fingerprint" => self . skip_rustdoc_fingerprint = parse_empty ( k, v) ?,
1421
1422
"script" => self . script = parse_empty ( k, v) ?,
1422
1423
"target-applies-to-host" => self . target_applies_to_host = parse_empty ( k, v) ?,
1424
+ "panic-immediate-abort" => self . panic_immediate_abort = parse_empty ( k, v) ?,
1423
1425
"unstable-options" => self . unstable_options = parse_empty ( k, v) ?,
1424
1426
"warnings" => self . warnings = parse_empty ( k, v) ?,
1425
1427
_ => bail ! (
Original file line number Diff line number Diff line change @@ -2550,10 +2550,10 @@ pub fn validate_profile(
2550
2550
}
2551
2551
2552
2552
if let Some ( panic) = & root. panic {
2553
- if panic != "unwind" && panic != "abort" {
2553
+ if panic != "unwind" && panic != "abort" && panic != "immediate-abort" {
2554
2554
bail ! (
2555
2555
"`panic` setting of `{}` is not a valid setting, \
2556
- must be `unwind` or `abort`",
2556
+ must be `unwind`, `abort`, or `immediate- abort`. ",
2557
2557
panic
2558
2558
) ;
2559
2559
}
@@ -2607,6 +2607,15 @@ fn validate_profile_layer(
2607
2607
_ => { }
2608
2608
}
2609
2609
}
2610
+ if profile. panic . as_deref ( ) == Some ( "immediate-abort" ) {
2611
+ match (
2612
+ features. require ( Feature :: panic_immediate_abort ( ) ) ,
2613
+ cli_unstable. panic_immediate_abort ,
2614
+ ) {
2615
+ ( Err ( e) , false ) => return Err ( e) ,
2616
+ _ => { }
2617
+ }
2618
+ }
2610
2619
Ok ( ( ) )
2611
2620
}
2612
2621
Original file line number Diff line number Diff line change @@ -150,6 +150,7 @@ mod proc_macro;
150
150
mod profile_config;
151
151
mod profile_custom;
152
152
mod profile_overrides;
153
+ mod profile_panic_immediate_abort;
153
154
mod profile_targets;
154
155
mod profile_trim_paths;
155
156
mod profiles;
You can’t perform that action at this time.
0 commit comments