@@ -274,14 +274,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
274
274
} else {
275
275
Abi :: System { unwind : false }
276
276
} ;
277
- let & [ ref code] = this. check_shim ( abi, exp_abi, link_name, args) ?;
277
+ let [ code] = this. check_shim ( abi, exp_abi, link_name, args) ?;
278
278
// it's really u32 for ExitProcess, but we have to put it into the `Exit` variant anyway
279
279
let code = this. read_scalar ( code) ?. to_i32 ( ) ?;
280
280
throw_machine_stop ! ( TerminationInfo :: Exit ( code. into( ) ) ) ;
281
281
}
282
282
"abort" => {
283
- let & [ ] =
284
- this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
283
+ let [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
285
284
throw_machine_stop ! ( TerminationInfo :: Abort (
286
285
"the program aborted execution" . to_owned( )
287
286
) )
@@ -367,7 +366,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
367
366
match & * link_name. as_str ( ) {
368
367
// Miri-specific extern functions
369
368
"miri_static_root" => {
370
- let & [ ref ptr] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
369
+ let [ ptr] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
371
370
let ptr = this. read_pointer ( ptr) ?;
372
371
let ( alloc_id, offset, _) = this. ptr_get_alloc_id ( ptr) ?;
373
372
if offset != Size :: ZERO {
@@ -400,13 +399,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
400
399
401
400
// Standard C allocation
402
401
"malloc" => {
403
- let & [ ref size] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
402
+ let [ size] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
404
403
let size = this. read_scalar ( size) ?. to_machine_usize ( this) ?;
405
404
let res = this. malloc ( size, /*zero_init:*/ false , MiriMemoryKind :: C ) ?;
406
405
this. write_pointer ( res, dest) ?;
407
406
}
408
407
"calloc" => {
409
- let & [ ref items, ref len] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
408
+ let [ items, len] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
410
409
let items = this. read_scalar ( items) ?. to_machine_usize ( this) ?;
411
410
let len = this. read_scalar ( len) ?. to_machine_usize ( this) ?;
412
411
let size =
@@ -415,12 +414,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
415
414
this. write_pointer ( res, dest) ?;
416
415
}
417
416
"free" => {
418
- let & [ ref ptr] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
417
+ let [ ptr] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
419
418
let ptr = this. read_pointer ( ptr) ?;
420
419
this. free ( ptr, MiriMemoryKind :: C ) ?;
421
420
}
422
421
"realloc" => {
423
- let & [ ref old_ptr, ref new_size] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
422
+ let [ old_ptr, new_size] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
424
423
let old_ptr = this. read_pointer ( old_ptr) ?;
425
424
let new_size = this. read_scalar ( new_size) ?. to_machine_usize ( this) ?;
426
425
let res = this. realloc ( old_ptr, new_size, MiriMemoryKind :: C ) ?;
@@ -429,7 +428,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
429
428
430
429
// Rust allocation
431
430
"__rust_alloc" => {
432
- let & [ ref size, ref align] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
431
+ let [ size, align] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
433
432
let size = this. read_scalar ( size) ?. to_machine_usize ( this) ?;
434
433
let align = this. read_scalar ( align) ?. to_machine_usize ( this) ?;
435
434
@@ -446,7 +445,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
446
445
} ) ;
447
446
}
448
447
"__rust_alloc_zeroed" => {
449
- let & [ ref size, ref align] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
448
+ let [ size, align] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
450
449
let size = this. read_scalar ( size) ?. to_machine_usize ( this) ?;
451
450
let align = this. read_scalar ( align) ?. to_machine_usize ( this) ?;
452
451
@@ -465,7 +464,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
465
464
} ) ;
466
465
}
467
466
"__rust_dealloc" => {
468
- let & [ ref ptr, ref old_size, ref align] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
467
+ let [ ptr, old_size, align] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
469
468
let ptr = this. read_pointer ( ptr) ?;
470
469
let old_size = this. read_scalar ( old_size) ?. to_machine_usize ( this) ?;
471
470
let align = this. read_scalar ( align) ?. to_machine_usize ( this) ?;
@@ -480,7 +479,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
480
479
} ) ;
481
480
}
482
481
"__rust_realloc" => {
483
- let & [ ref ptr, ref old_size, ref align, ref new_size] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
482
+ let [ ptr, old_size, align, new_size] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
484
483
let ptr = this. read_pointer ( ptr) ?;
485
484
let old_size = this. read_scalar ( old_size) ?. to_machine_usize ( this) ?;
486
485
let align = this. read_scalar ( align) ?. to_machine_usize ( this) ?;
@@ -504,7 +503,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
504
503
505
504
// C memory handling functions
506
505
"memcmp" => {
507
- let & [ ref left, ref right, ref n] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
506
+ let [ left, right, n] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
508
507
let left = this. read_pointer ( left) ?;
509
508
let right = this. read_pointer ( right) ?;
510
509
let n = Size :: from_bytes ( this. read_scalar ( n) ?. to_machine_usize ( this) ?) ;
@@ -524,7 +523,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
524
523
this. write_scalar ( Scalar :: from_i32 ( result) , dest) ?;
525
524
}
526
525
"memrchr" => {
527
- let & [ ref ptr, ref val, ref num] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
526
+ let [ ptr, val, num] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
528
527
let ptr = this. read_pointer ( ptr) ?;
529
528
let val = this. read_scalar ( val) ?. to_i32 ( ) ? as u8 ;
530
529
let num = this. read_scalar ( num) ?. to_machine_usize ( this) ?;
@@ -541,7 +540,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
541
540
}
542
541
}
543
542
"memchr" => {
544
- let & [ ref ptr, ref val, ref num] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
543
+ let [ ptr, val, num] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
545
544
let ptr = this. read_pointer ( ptr) ?;
546
545
let val = this. read_scalar ( val) ?. to_i32 ( ) ? as u8 ;
547
546
let num = this. read_scalar ( num) ?. to_machine_usize ( this) ?;
@@ -557,7 +556,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
557
556
}
558
557
}
559
558
"strlen" => {
560
- let & [ ref ptr] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
559
+ let [ ptr] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
561
560
let ptr = this. read_pointer ( ptr) ?;
562
561
let n = this. read_c_str ( ptr) ?. len ( ) ;
563
562
this. write_scalar ( Scalar :: from_machine_usize ( u64:: try_from ( n) . unwrap ( ) , this) , dest) ?;
@@ -573,7 +572,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
573
572
| "asinf"
574
573
| "atanf"
575
574
=> {
576
- let & [ ref f] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
575
+ let [ f] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
577
576
// FIXME: Using host floats.
578
577
let f = f32:: from_bits ( this. read_scalar ( f) ?. to_u32 ( ) ?) ;
579
578
let f = match & * link_name. as_str ( ) {
@@ -593,7 +592,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
593
592
| "hypotf"
594
593
| "atan2f"
595
594
=> {
596
- let & [ ref f1, ref f2] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
595
+ let [ f1, f2] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
597
596
// underscore case for windows, here and below
598
597
// (see https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/floating-point-primitives?view=vs-2019)
599
598
// FIXME: Using host floats.
@@ -615,7 +614,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
615
614
| "asin"
616
615
| "atan"
617
616
=> {
618
- let & [ ref f] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
617
+ let [ f] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
619
618
// FIXME: Using host floats.
620
619
let f = f64:: from_bits ( this. read_scalar ( f) ?. to_u64 ( ) ?) ;
621
620
let f = match & * link_name. as_str ( ) {
@@ -635,7 +634,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
635
634
| "hypot"
636
635
| "atan2"
637
636
=> {
638
- let & [ ref f1, ref f2] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
637
+ let [ f1, f2] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
639
638
// FIXME: Using host floats.
640
639
let f1 = f64:: from_bits ( this. read_scalar ( f1) ?. to_u64 ( ) ?) ;
641
640
let f2 = f64:: from_bits ( this. read_scalar ( f2) ?. to_u64 ( ) ?) ;
@@ -651,7 +650,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
651
650
| "ldexp"
652
651
| "scalbn"
653
652
=> {
654
- let & [ ref x , ref exp] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
653
+ let [ x , exp] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
655
654
// For radix-2 (binary) systems, `ldexp` and `scalbn` are the same.
656
655
let x = this. read_scalar ( x) ?. to_f64 ( ) ?;
657
656
let exp = this. read_scalar ( exp) ?. to_i32 ( ) ?;
@@ -673,7 +672,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
673
672
// Architecture-specific shims
674
673
"llvm.x86.addcarry.64" if this. tcx . sess . target . arch == "x86_64" => {
675
674
// Computes u8+u64+u64, returning tuple (u8,u64) comprising the output carry and truncated sum.
676
- let & [ ref c_in, ref a , ref b] = this. check_shim ( abi, Abi :: Unadjusted , link_name, args) ?;
675
+ let [ c_in, a , b] = this. check_shim ( abi, Abi :: Unadjusted , link_name, args) ?;
677
676
let c_in = this. read_scalar ( c_in) ?. to_u8 ( ) ?;
678
677
let a = this. read_scalar ( a) ?. to_u64 ( ) ?;
679
678
let b = this. read_scalar ( b) ?. to_u64 ( ) ?;
@@ -687,11 +686,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
687
686
this. write_scalar ( Scalar :: from_u64 ( sum) , & sum_field) ?;
688
687
}
689
688
"llvm.x86.sse2.pause" if this. tcx . sess . target . arch == "x86" || this. tcx . sess . target . arch == "x86_64" => {
690
- let & [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
689
+ let [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
691
690
this. yield_active_thread ( ) ;
692
691
}
693
692
"llvm.aarch64.isb" if this. tcx . sess . target . arch == "aarch64" => {
694
- let & [ ref arg] = this. check_shim ( abi, Abi :: Unadjusted , link_name, args) ?;
693
+ let [ arg] = this. check_shim ( abi, Abi :: Unadjusted , link_name, args) ?;
695
694
let arg = this. read_scalar ( arg) ?. to_i32 ( ) ?;
696
695
match arg {
697
696
15 => { // SY ("full system scope")
0 commit comments