@@ -36,7 +36,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
36
36
let intrinsic_name = this. tcx . item_name ( instance. def_id ( ) ) ;
37
37
let intrinsic_name = intrinsic_name. as_str ( ) ;
38
38
let ret = match ret {
39
- None => throw_unsup_format ! ( "unimplemented (diverging) intrinsic: {}" , intrinsic_name ) ,
39
+ None => throw_unsup_format ! ( "unimplemented (diverging) intrinsic: `{intrinsic_name}`" ) ,
40
40
Some ( p) => p,
41
41
} ;
42
42
@@ -86,7 +86,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
86
86
// `checked_mul` enforces a too small bound (the correct one would probably be machine_isize_max),
87
87
// but no actual allocation can be big enough for the difference to be noticeable.
88
88
let byte_count = ty_layout. size . checked_mul ( count, this) . ok_or_else ( || {
89
- err_ub_format ! ( "overflow computing total size of `{}`" , intrinsic_name )
89
+ err_ub_format ! ( "overflow computing total size of `{intrinsic_name }`" )
90
90
} ) ?;
91
91
this. write_bytes_ptr (
92
92
ptr,
@@ -200,24 +200,20 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
200
200
ty:: Float ( FloatTy :: F32 ) => x. to_scalar ( ) ?. to_f32 ( ) ?. is_finite ( ) ,
201
201
ty:: Float ( FloatTy :: F64 ) => x. to_scalar ( ) ?. to_f64 ( ) ?. is_finite ( ) ,
202
202
_ => bug ! (
203
- "`{}` called with non-float input type {:?}" ,
204
- intrinsic_name,
205
- x. layout. ty
203
+ "`{intrinsic_name}` called with non-float input type {ty:?}" ,
204
+ ty = x. layout. ty,
206
205
) ,
207
206
} )
208
207
} ;
209
208
match ( float_finite ( a) ?, float_finite ( b) ?) {
210
209
( false , false ) => throw_ub_format ! (
211
- "`{}` intrinsic called with non-finite value as both parameters" ,
212
- intrinsic_name,
210
+ "`{intrinsic_name}` intrinsic called with non-finite value as both parameters" ,
213
211
) ,
214
212
( false , _) => throw_ub_format ! (
215
- "`{}` intrinsic called with non-finite value as first parameter" ,
216
- intrinsic_name,
213
+ "`{intrinsic_name}` intrinsic called with non-finite value as first parameter" ,
217
214
) ,
218
215
( _, false ) => throw_ub_format ! (
219
- "`{}` intrinsic called with non-finite value as second parameter" ,
220
- intrinsic_name,
216
+ "`{intrinsic_name}` intrinsic called with non-finite value as second parameter" ,
221
217
) ,
222
218
_ => { }
223
219
}
@@ -494,7 +490,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
494
490
// See <https://github.com/rust-lang/rust/issues/91237>.
495
491
if overflowed {
496
492
let r_val = right. to_scalar ( ) ?. to_bits ( right. layout . size ) ?;
497
- throw_ub_format ! ( "overflowing shift by {} in `{}` in SIMD lane {}" , r_val , intrinsic_name , i ) ;
493
+ throw_ub_format ! ( "overflowing shift by {r_val } in `{intrinsic_name }` in SIMD lane {i}" ) ;
498
494
}
499
495
}
500
496
if matches ! ( mir_op, BinOp :: Eq | BinOp :: Ne | BinOp :: Lt | BinOp :: Le | BinOp :: Gt | BinOp :: Ge ) {
@@ -751,9 +747,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
751
747
this. float_to_int_unchecked ( op. to_scalar ( ) ?. to_f64 ( ) ?, dest. layout . ty ) ?. into ( ) ,
752
748
_ =>
753
749
throw_unsup_format ! (
754
- "Unsupported SIMD cast from element type {} to {}" ,
755
- op. layout. ty,
756
- dest. layout. ty
750
+ "Unsupported SIMD cast from element type {from_ty } to {to_ty }" ,
751
+ from_ty = op. layout. ty,
752
+ to_ty = dest. layout. ty,
757
753
) ,
758
754
} ;
759
755
this. write_immediate ( val, & dest. into ( ) ) ?;
@@ -1093,7 +1089,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
1093
1089
throw_machine_stop ! ( TerminationInfo :: Abort ( "Trace/breakpoint trap" . to_string( ) ) )
1094
1090
}
1095
1091
1096
- name => throw_unsup_format ! ( "unimplemented intrinsic: {}" , name ) ,
1092
+ name => throw_unsup_format ! ( "unimplemented intrinsic: `{name}`" ) ,
1097
1093
}
1098
1094
1099
1095
trace ! ( "{:?}" , this. dump_place( * * dest) ) ;
@@ -1340,9 +1336,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
1340
1336
} else {
1341
1337
// `f` was not representable in this integer type.
1342
1338
throw_ub_format ! (
1343
- "`float_to_int_unchecked` intrinsic called on {} which cannot be represented in target type `{:?}`" ,
1344
- f,
1345
- dest_ty,
1339
+ "`float_to_int_unchecked` intrinsic called on {f} which cannot be represented in target type `{dest_ty:?}`" ,
1346
1340
) ;
1347
1341
}
1348
1342
}
@@ -1356,14 +1350,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
1356
1350
} else {
1357
1351
// `f` was not representable in this integer type.
1358
1352
throw_ub_format ! (
1359
- "`float_to_int_unchecked` intrinsic called on {} which cannot be represented in target type `{:?}`" ,
1360
- f,
1361
- dest_ty,
1353
+ "`float_to_int_unchecked` intrinsic called on {f} which cannot be represented in target type `{dest_ty:?}`" ,
1362
1354
) ;
1363
1355
}
1364
1356
}
1365
1357
// Nothing else
1366
- _ => bug ! ( "`float_to_int_unchecked` called with non-int output type {:?}" , dest_ty ) ,
1358
+ _ => bug ! ( "`float_to_int_unchecked` called with non-int output type {dest_ty :?}" ) ,
1367
1359
} )
1368
1360
}
1369
1361
}
0 commit comments