Skip to content

Commit 1368257

Browse files
author
The Miri Cronjob Bot
committed
fmt
1 parent a973a8c commit 1368257

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

src/tools/miri/src/shims/foreign_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_middle::{mir, ty};
1515
use rustc_session::config::OomStrategy;
1616
use rustc_span::Symbol;
1717
use rustc_target::callconv::FnAbi;
18-
use rustc_target::spec::{Os, Arch};
18+
use rustc_target::spec::{Arch, Os};
1919

2020
use super::alloc::EvalContextExt as _;
2121
use super::backtrace::EvalContextExt as _;

src/tools/miri/src/shims/unix/foreign_items.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ pub fn is_dyn_sym(name: &str, target_os: &Os) -> bool {
2727
// needed at least on macOS to avoid file-based fallback in getrandom
2828
"getentropy" | "getrandom" => true,
2929
// Give specific OSes a chance to allow their symbols.
30-
_ => match *target_os {
31-
Os::Android => android::is_dyn_sym(name),
32-
Os::FreeBsd => freebsd::is_dyn_sym(name),
33-
Os::Linux => linux::is_dyn_sym(name),
34-
Os::MacOs => macos::is_dyn_sym(name),
35-
Os::Solaris | Os::Illumos => solarish::is_dyn_sym(name),
36-
_ => false,
37-
},
30+
_ =>
31+
match *target_os {
32+
Os::Android => android::is_dyn_sym(name),
33+
Os::FreeBsd => freebsd::is_dyn_sym(name),
34+
Os::Linux => linux::is_dyn_sym(name),
35+
Os::MacOs => macos::is_dyn_sym(name),
36+
Os::Solaris | Os::Illumos => solarish::is_dyn_sym(name),
37+
_ => false,
38+
},
3839
}
3940
}
4041

@@ -530,7 +531,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
530531
}
531532
"pipe2" => {
532533
// Currently this function does not exist on all Unixes, e.g. on macOS.
533-
this.check_target_os(&[Os::Linux, Os::FreeBsd, Os::Solaris, Os::Illumos], link_name)?;
534+
this.check_target_os(
535+
&[Os::Linux, Os::FreeBsd, Os::Solaris, Os::Illumos],
536+
link_name,
537+
)?;
534538
let [pipefd, flags] = this.check_shim_sig(
535539
shim_sig!(extern "C" fn(*mut _, i32) -> i32),
536540
link_name,

src/tools/miri/src/shims/unix/fs.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
530530
) -> InterpResult<'tcx, Scalar> {
531531
let this = self.eval_context_mut();
532532

533-
if !matches!(&this.tcx.sess.target.os, Os::MacOs | Os::FreeBsd | Os::Solaris | Os::Illumos) {
533+
if !matches!(&this.tcx.sess.target.os, Os::MacOs | Os::FreeBsd | Os::Solaris | Os::Illumos)
534+
{
534535
panic!("`macos_fbsd_solaris_stat` should not be called on {}", this.tcx.sess.target.os);
535536
}
536537

@@ -560,7 +561,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
560561
) -> InterpResult<'tcx, Scalar> {
561562
let this = self.eval_context_mut();
562563

563-
if !matches!(&this.tcx.sess.target.os, Os::MacOs | Os::FreeBsd | Os::Solaris | Os::Illumos) {
564+
if !matches!(&this.tcx.sess.target.os, Os::MacOs | Os::FreeBsd | Os::Solaris | Os::Illumos)
565+
{
564566
panic!(
565567
"`macos_fbsd_solaris_lstat` should not be called on {}",
566568
this.tcx.sess.target.os
@@ -591,7 +593,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
591593
) -> InterpResult<'tcx, Scalar> {
592594
let this = self.eval_context_mut();
593595

594-
if !matches!(&this.tcx.sess.target.os, Os::MacOs | Os::FreeBsd | Os::Solaris | Os::Illumos) {
596+
if !matches!(&this.tcx.sess.target.os, Os::MacOs | Os::FreeBsd | Os::Solaris | Os::Illumos)
597+
{
595598
panic!(
596599
"`macos_fbsd_solaris_fstat` should not be called on {}",
597600
this.tcx.sess.target.os
@@ -904,7 +907,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
904907
fn readdir64(&mut self, dirent_type: &str, dirp_op: &OpTy<'tcx>) -> InterpResult<'tcx, Scalar> {
905908
let this = self.eval_context_mut();
906909

907-
if !matches!(&this.tcx.sess.target.os, Os::Linux | Os::Solaris | Os::Illumos | Os::FreeBsd) {
910+
if !matches!(&this.tcx.sess.target.os, Os::Linux | Os::Solaris | Os::Illumos | Os::FreeBsd)
911+
{
908912
panic!("`linux_solaris_readdir64` should not be called on {}", this.tcx.sess.target.os);
909913
}
910914

0 commit comments

Comments
 (0)