File tree 4 files changed +10
-34
lines changed
4 files changed +10
-34
lines changed Original file line number Diff line number Diff line change @@ -3463,35 +3463,14 @@ pub(crate) macro const_eval_select {
3463
3463
$( #[ $compiletime_attr: meta] ) * $compiletime: block
3464
3464
else
3465
3465
$( #[ $runtime_attr: meta] ) * $runtime: block
3466
- ) => {
3467
- // Use the `noinline` arm, after adding explicit `inline` attributes
3468
- $crate:: intrinsics:: const_eval_select!(
3469
- @capture { $( $arg : $ty = $val) , * } $( -> $ret) ? :
3470
- #[ noinline]
3471
- if const
3472
- #[ inline] // prevent codegen on this function
3473
- $( #[ $compiletime_attr] ) *
3474
- $compiletime
3475
- else
3476
- #[ inline] // avoid the overhead of an extra fn call
3477
- $( #[ $runtime_attr] ) *
3478
- $runtime
3479
- )
3480
- } ,
3481
- // With a leading #[noinline], we don't add inline attributes
3482
- (
3483
- @capture { $( $arg: ident : $ty: ty = $val: expr) , * $( , ) ? } $( -> $ret: ty ) ? :
3484
- #[ noinline]
3485
- if const
3486
- $( #[ $compiletime_attr: meta] ) * $compiletime: block
3487
- else
3488
- $( #[ $runtime_attr: meta] ) * $runtime: block
3489
3466
) => { {
3467
+ #[ inline] // avoid the overhead of an extra fn call
3490
3468
$( #[ $runtime_attr] ) *
3491
3469
fn runtime( $( $arg: $ty) , * ) $( -> $ret ) ? {
3492
3470
$runtime
3493
3471
}
3494
3472
3473
+ #[ inline] // prevent codegen on this function
3495
3474
$( #[ $compiletime_attr] ) *
3496
3475
const fn compiletime( $( $arg: $ty) , * ) $( -> $ret ) ? {
3497
3476
// Don't warn if one of the arguments is unused.
Original file line number Diff line number Diff line change @@ -1258,9 +1258,8 @@ impl f128 {
1258
1258
min <= max,
1259
1259
"min > max, or either was NaN" ,
1260
1260
"min > max, or either was NaN. min = {min:?}, max = {max:?}" ,
1261
- // FIXME(f16_f128): Passed by-ref to avoid codegen crashes
1262
- min: & f128 = & min,
1263
- max: & f128 = & max,
1261
+ min: f128,
1262
+ max: f128,
1264
1263
) ;
1265
1264
1266
1265
if self < min {
Original file line number Diff line number Diff line change @@ -1235,9 +1235,8 @@ impl f16 {
1235
1235
min <= max,
1236
1236
"min > max, or either was NaN" ,
1237
1237
"min > max, or either was NaN. min = {min:?}, max = {max:?}" ,
1238
- // FIXME(f16_f128): Passed by-ref to avoid codegen crashes
1239
- min: & f16 = & min,
1240
- max: & f16 = & max,
1238
+ min: f16,
1239
+ max: f16,
1241
1240
) ;
1242
1241
1243
1242
if self < min {
Original file line number Diff line number Diff line change @@ -206,16 +206,15 @@ pub macro const_panic {
206
206
// add the `rustc_allow_const_fn_unstable`. This is okay to do
207
207
// because both variants will panic, just with different messages.
208
208
#[ rustc_allow_const_fn_unstable( const_eval_select) ]
209
- #[ inline( always) ] // inline the wrapper
209
+ #[ inline( always) ]
210
210
#[ track_caller]
211
211
#[ cfg_attr( bootstrap, rustc_const_stable( feature = "const_panic" , since = "CURRENT_RUSTC_VERSION" ) ) ]
212
212
const fn do_panic ( $( $arg: $ty) , * ) -> ! {
213
213
$crate:: intrinsics:: const_eval_select!(
214
- @capture { $( $arg: $ty = $arg) , * } -> !:
215
- #[ noinline]
216
- if const #[ track_caller] #[ inline] { // Inline this, to prevent codegen
214
+ @capture { $( $arg: $ty) , * } -> !:
215
+ if const #[ track_caller] {
217
216
$crate :: panic!( $const_msg)
218
- } else #[ track_caller] { // Do not inline this, it makes perf worse
217
+ } else #[ track_caller] {
219
218
$crate :: panic!( $runtime_msg)
220
219
}
221
220
)
You can’t perform that action at this time.
0 commit comments