@@ -25,7 +25,7 @@ use rustc_target::{
2525
2626use super :: backtrace:: EvalContextExt as _;
2727use crate :: * ;
28- use helpers:: { check_abi , check_arg_count} ;
28+ use helpers:: check_arg_count;
2929
3030/// Returned by `emulate_foreign_item_by_name`.
3131pub enum EmulateByNameResult {
@@ -226,14 +226,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
226226 let ( dest, ret) = match ret {
227227 None => match link_name {
228228 "miri_start_panic" => {
229- check_abi ( this , abi, Abi :: Rust ) ?;
229+ this . check_abi ( abi, Abi :: Rust ) ?;
230230 this. handle_miri_start_panic ( args, unwind) ?;
231231 return Ok ( None ) ;
232232 }
233233 // This matches calls to the foreign item `panic_impl`.
234234 // The implementation is provided by the function with the `#[panic_handler]` attribute.
235235 "panic_impl" => {
236- check_abi ( this , abi, Abi :: Rust ) ?;
236+ this . check_abi ( abi, Abi :: Rust ) ?;
237237 let panic_impl_id = tcx. lang_items ( ) . panic_impl ( ) . unwrap ( ) ;
238238 let panic_impl_instance = ty:: Instance :: mono ( tcx, panic_impl_id) ;
239239 return Ok ( Some ( & * this. load_mir ( panic_impl_instance. def , None ) ?) ) ;
@@ -242,14 +242,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
242242 | "exit"
243243 | "ExitProcess"
244244 => {
245- check_abi ( this , abi, if link_name == "exit" { Abi :: C { unwind : false } } else { Abi :: System { unwind : false } } ) ?;
245+ this . check_abi ( abi, if link_name == "exit" { Abi :: C { unwind : false } } else { Abi :: System { unwind : false } } ) ?;
246246 let & [ ref code] = check_arg_count ( args) ?;
247247 // it's really u32 for ExitProcess, but we have to put it into the `Exit` variant anyway
248248 let code = this. read_scalar ( code) ?. to_i32 ( ) ?;
249249 throw_machine_stop ! ( TerminationInfo :: Exit ( code. into( ) ) ) ;
250250 }
251251 "abort" => {
252- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
252+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
253253 throw_machine_stop ! ( TerminationInfo :: Abort (
254254 "the program aborted execution" . to_owned( )
255255 ) )
@@ -298,7 +298,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
298298 match link_name {
299299 // Miri-specific extern functions
300300 "miri_static_root" => {
301- check_abi ( this , abi, Abi :: Rust ) ?;
301+ this . check_abi ( abi, Abi :: Rust ) ?;
302302 let & [ ref ptr] = check_arg_count ( args) ?;
303303 let ptr = this. read_scalar ( ptr) ?. check_init ( ) ?;
304304 let ptr = this. force_ptr ( ptr) ?;
@@ -310,27 +310,27 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
310310
311311 // Obtains a Miri backtrace. See the README for details.
312312 "miri_get_backtrace" => {
313- check_abi ( this , abi, Abi :: Rust ) ?;
313+ this . check_abi ( abi, Abi :: Rust ) ?;
314314 this. handle_miri_get_backtrace ( args, dest) ?;
315315 }
316316
317317 // Resolves a Miri backtrace frame. See the README for details.
318318 "miri_resolve_frame" => {
319- check_abi ( this , abi, Abi :: Rust ) ?;
319+ this . check_abi ( abi, Abi :: Rust ) ?;
320320 this. handle_miri_resolve_frame ( args, dest) ?;
321321 }
322322
323323
324324 // Standard C allocation
325325 "malloc" => {
326- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
326+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
327327 let & [ ref size] = check_arg_count ( args) ?;
328328 let size = this. read_scalar ( size) ?. to_machine_usize ( this) ?;
329329 let res = this. malloc ( size, /*zero_init:*/ false , MiriMemoryKind :: C ) ;
330330 this. write_scalar ( res, dest) ?;
331331 }
332332 "calloc" => {
333- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
333+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
334334 let & [ ref items, ref len] = check_arg_count ( args) ?;
335335 let items = this. read_scalar ( items) ?. to_machine_usize ( this) ?;
336336 let len = this. read_scalar ( len) ?. to_machine_usize ( this) ?;
@@ -340,13 +340,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
340340 this. write_scalar ( res, dest) ?;
341341 }
342342 "free" => {
343- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
343+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
344344 let & [ ref ptr] = check_arg_count ( args) ?;
345345 let ptr = this. read_scalar ( ptr) ?. check_init ( ) ?;
346346 this. free ( ptr, MiriMemoryKind :: C ) ?;
347347 }
348348 "realloc" => {
349- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
349+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
350350 let & [ ref old_ptr, ref new_size] = check_arg_count ( args) ?;
351351 let old_ptr = this. read_scalar ( old_ptr) ?. check_init ( ) ?;
352352 let new_size = this. read_scalar ( new_size) ?. to_machine_usize ( this) ?;
@@ -358,7 +358,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
358358 // (Usually these would be forwarded to to `#[global_allocator]`; we instead implement a generic
359359 // allocation that also checks that all conditions are met, such as not permitting zero-sized allocations.)
360360 "__rust_alloc" => {
361- check_abi ( this , abi, Abi :: Rust ) ?;
361+ this . check_abi ( abi, Abi :: Rust ) ?;
362362 let & [ ref size, ref align] = check_arg_count ( args) ?;
363363 let size = this. read_scalar ( size) ?. to_machine_usize ( this) ?;
364364 let align = this. read_scalar ( align) ?. to_machine_usize ( this) ?;
@@ -371,7 +371,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
371371 this. write_scalar ( ptr, dest) ?;
372372 }
373373 "__rust_alloc_zeroed" => {
374- check_abi ( this , abi, Abi :: Rust ) ?;
374+ this . check_abi ( abi, Abi :: Rust ) ?;
375375 let & [ ref size, ref align] = check_arg_count ( args) ?;
376376 let size = this. read_scalar ( size) ?. to_machine_usize ( this) ?;
377377 let align = this. read_scalar ( align) ?. to_machine_usize ( this) ?;
@@ -386,7 +386,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
386386 this. write_scalar ( ptr, dest) ?;
387387 }
388388 "__rust_dealloc" => {
389- check_abi ( this , abi, Abi :: Rust ) ?;
389+ this . check_abi ( abi, Abi :: Rust ) ?;
390390 let & [ ref ptr, ref old_size, ref align] = check_arg_count ( args) ?;
391391 let ptr = this. read_scalar ( ptr) ?. check_init ( ) ?;
392392 let old_size = this. read_scalar ( old_size) ?. to_machine_usize ( this) ?;
@@ -400,7 +400,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
400400 ) ?;
401401 }
402402 "__rust_realloc" => {
403- check_abi ( this , abi, Abi :: Rust ) ?;
403+ this . check_abi ( abi, Abi :: Rust ) ?;
404404 let & [ ref ptr, ref old_size, ref align, ref new_size] = check_arg_count ( args) ?;
405405 let ptr = this. force_ptr ( this. read_scalar ( ptr) ?. check_init ( ) ?) ?;
406406 let old_size = this. read_scalar ( old_size) ?. to_machine_usize ( this) ?;
@@ -421,7 +421,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
421421
422422 // C memory handling functions
423423 "memcmp" => {
424- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
424+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
425425 let & [ ref left, ref right, ref n] = check_arg_count ( args) ?;
426426 let left = this. read_scalar ( left) ?. check_init ( ) ?;
427427 let right = this. read_scalar ( right) ?. check_init ( ) ?;
@@ -442,7 +442,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
442442 this. write_scalar ( Scalar :: from_i32 ( result) , dest) ?;
443443 }
444444 "memrchr" => {
445- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
445+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
446446 let & [ ref ptr, ref val, ref num] = check_arg_count ( args) ?;
447447 let ptr = this. read_scalar ( ptr) ?. check_init ( ) ?;
448448 let val = this. read_scalar ( val) ?. to_i32 ( ) ? as u8 ;
@@ -461,7 +461,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
461461 }
462462 }
463463 "memchr" => {
464- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
464+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
465465 let & [ ref ptr, ref val, ref num] = check_arg_count ( args) ?;
466466 let ptr = this. read_scalar ( ptr) ?. check_init ( ) ?;
467467 let val = this. read_scalar ( val) ?. to_i32 ( ) ? as u8 ;
@@ -479,7 +479,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
479479 }
480480 }
481481 "strlen" => {
482- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
482+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
483483 let & [ ref ptr] = check_arg_count ( args) ?;
484484 let ptr = this. read_scalar ( ptr) ?. check_init ( ) ?;
485485 let n = this. read_c_str ( ptr) ?. len ( ) ;
@@ -496,7 +496,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
496496 | "asinf"
497497 | "atanf"
498498 => {
499- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
499+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
500500 let & [ ref f] = check_arg_count ( args) ?;
501501 // FIXME: Using host floats.
502502 let f = f32:: from_bits ( this. read_scalar ( f) ?. to_u32 ( ) ?) ;
@@ -517,7 +517,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
517517 | "hypotf"
518518 | "atan2f"
519519 => {
520- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
520+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
521521 let & [ ref f1, ref f2] = check_arg_count ( args) ?;
522522 // underscore case for windows, here and below
523523 // (see https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/floating-point-primitives?view=vs-2019)
@@ -540,7 +540,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
540540 | "asin"
541541 | "atan"
542542 => {
543- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
543+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
544544 let & [ ref f] = check_arg_count ( args) ?;
545545 // FIXME: Using host floats.
546546 let f = f64:: from_bits ( this. read_scalar ( f) ?. to_u64 ( ) ?) ;
@@ -561,7 +561,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
561561 | "hypot"
562562 | "atan2"
563563 => {
564- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
564+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
565565 let & [ ref f1, ref f2] = check_arg_count ( args) ?;
566566 // FIXME: Using host floats.
567567 let f1 = f64:: from_bits ( this. read_scalar ( f1) ?. to_u64 ( ) ?) ;
@@ -578,7 +578,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
578578 | "ldexp"
579579 | "scalbn"
580580 => {
581- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
581+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
582582 let & [ ref x, ref exp] = check_arg_count ( args) ?;
583583 // For radix-2 (binary) systems, `ldexp` and `scalbn` are the same.
584584 let x = this. read_scalar ( x) ?. to_f64 ( ) ?;
@@ -600,12 +600,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
600600
601601 // Architecture-specific shims
602602 "llvm.x86.sse2.pause" if this. tcx . sess . target . arch == "x86" || this. tcx . sess . target . arch == "x86_64" => {
603- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
603+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
604604 let & [ ] = check_arg_count ( args) ?;
605605 this. yield_active_thread ( ) ;
606606 }
607607 "llvm.aarch64.isb" if this. tcx . sess . target . arch == "aarch64" => {
608- check_abi ( this , abi, Abi :: C { unwind : false } ) ?;
608+ this . check_abi ( abi, Abi :: C { unwind : false } ) ?;
609609 let & [ ref arg] = check_arg_count ( args) ?;
610610 let arg = this. read_scalar ( arg) ?. to_i32 ( ) ?;
611611 match arg {
0 commit comments