@@ -28,8 +28,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
28
28
// (as opposed to through a place), we have to remember to erase any tag
29
29
// that might still hang around!
30
30
31
- let intrinsic_name = this. tcx . item_name ( instance. def_id ( ) ) . as_str ( ) ;
32
- match intrinsic_name. get ( ) {
31
+ let intrinsic_name = & * this. tcx . item_name ( instance. def_id ( ) ) . as_str ( ) ;
32
+ match intrinsic_name {
33
33
"arith_offset" => {
34
34
let offset = this. read_scalar ( args[ 1 ] ) ?. to_isize ( this) ?;
35
35
let ptr = this. read_scalar ( args[ 0 ] ) ?. not_undef ( ) ?;
@@ -228,7 +228,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
228
228
"log10f32" | "log2f32" | "floorf32" | "ceilf32" | "truncf32" | "roundf32" => {
229
229
// FIXME: Using host floats.
230
230
let f = f32:: from_bits ( this. read_scalar ( args[ 0 ] ) ?. to_u32 ( ) ?) ;
231
- let f = match intrinsic_name. get ( ) {
231
+ let f = match intrinsic_name {
232
232
"sinf32" => f. sin ( ) ,
233
233
"fabsf32" => f. abs ( ) ,
234
234
"cosf32" => f. cos ( ) ,
@@ -251,7 +251,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
251
251
"log10f64" | "log2f64" | "floorf64" | "ceilf64" | "truncf64" | "roundf64" => {
252
252
// FIXME: Using host floats.
253
253
let f = f64:: from_bits ( this. read_scalar ( args[ 0 ] ) ?. to_u64 ( ) ?) ;
254
- let f = match intrinsic_name. get ( ) {
254
+ let f = match intrinsic_name {
255
255
"sinf64" => f. sin ( ) ,
256
256
"fabsf64" => f. abs ( ) ,
257
257
"cosf64" => f. cos ( ) ,
@@ -273,7 +273,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
273
273
"fadd_fast" | "fsub_fast" | "fmul_fast" | "fdiv_fast" | "frem_fast" => {
274
274
let a = this. read_immediate ( args[ 0 ] ) ?;
275
275
let b = this. read_immediate ( args[ 1 ] ) ?;
276
- let op = match intrinsic_name. get ( ) {
276
+ let op = match intrinsic_name {
277
277
"fadd_fast" => mir:: BinOp :: Add ,
278
278
"fsub_fast" => mir:: BinOp :: Sub ,
279
279
"fmul_fast" => mir:: BinOp :: Mul ,
@@ -287,7 +287,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
287
287
"minnumf32" | "maxnumf32" => {
288
288
let a = this. read_scalar ( args[ 0 ] ) ?. to_f32 ( ) ?;
289
289
let b = this. read_scalar ( args[ 1 ] ) ?. to_f32 ( ) ?;
290
- let res = if intrinsic_name. get ( ) . starts_with ( "min" ) {
290
+ let res = if intrinsic_name. starts_with ( "min" ) {
291
291
a. min ( b)
292
292
} else {
293
293
a. max ( b)
@@ -298,7 +298,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
298
298
"minnumf64" | "maxnumf64" => {
299
299
let a = this. read_scalar ( args[ 0 ] ) ?. to_f64 ( ) ?;
300
300
let b = this. read_scalar ( args[ 1 ] ) ?. to_f64 ( ) ?;
301
- let res = if intrinsic_name. get ( ) . starts_with ( "min" ) {
301
+ let res = if intrinsic_name. starts_with ( "min" ) {
302
302
a. min ( b)
303
303
} else {
304
304
a. max ( b)
@@ -509,15 +509,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
509
509
"unchecked_add" | "unchecked_sub" | "unchecked_mul" => {
510
510
let l = this. read_immediate ( args[ 0 ] ) ?;
511
511
let r = this. read_immediate ( args[ 1 ] ) ?;
512
- let op = match intrinsic_name. get ( ) {
512
+ let op = match intrinsic_name {
513
513
"unchecked_add" => mir:: BinOp :: Add ,
514
514
"unchecked_sub" => mir:: BinOp :: Sub ,
515
515
"unchecked_mul" => mir:: BinOp :: Mul ,
516
516
_ => bug ! ( ) ,
517
517
} ;
518
518
let ( res, overflowed, _ty) = this. overflowing_binary_op ( op, l, r) ?;
519
519
if overflowed {
520
- throw_ub_format ! ( "Overflowing arithmetic in {}" , intrinsic_name. get ( ) ) ;
520
+ throw_ub_format ! ( "Overflowing arithmetic in {}" , intrinsic_name) ;
521
521
}
522
522
this. write_scalar ( res, dest) ?;
523
523
}
0 commit comments