Skip to content

Commit 4a2e08f

Browse files
committed
fix warnings for non-Unix builds
1 parent 880e684 commit 4a2e08f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/shims/fs.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -549,12 +549,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
549549
target_op: OpTy<'tcx, Tag>,
550550
linkpath_op: OpTy<'tcx, Tag>
551551
) -> InterpResult<'tcx, i32> {
552-
#[cfg(target_family = "unix")]
552+
#[cfg(unix)]
553553
fn create_link(src: &Path, dst: &Path) -> std::io::Result<()> {
554554
std::os::unix::fs::symlink(src, dst)
555555
}
556556

557-
#[cfg(target_family = "windows")]
557+
#[cfg(windows)]
558558
fn create_link(src: &Path, dst: &Path) -> std::io::Result<()> {
559559
use std::os::windows::fs;
560560
if src.is_dir() {
@@ -816,22 +816,24 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
816816

817817
this.check_no_isolation("mkdir")?;
818818

819-
let _mode = if this.tcx.sess.target.target.target_os == "macos" {
819+
#[cfg_attr(not(unix), allow(unused_variables))]
820+
let mode = if this.tcx.sess.target.target.target_os == "macos" {
820821
u32::from(this.read_scalar(mode_op)?.not_undef()?.to_u16()?)
821822
} else {
822823
this.read_scalar(mode_op)?.to_u32()?
823824
};
824825

825826
let path = this.read_path_from_c_str(this.read_scalar(path_op)?.not_undef()?)?;
826827

828+
#[cfg_attr(not(unix), allow(unused_mut))]
827829
let mut builder = DirBuilder::new();
828830

829831
// If the host supports it, forward on the mode of the directory
830832
// (i.e. permission bits and the sticky bit)
831-
#[cfg(target_family = "unix")]
833+
#[cfg(unix)]
832834
{
833835
use std::os::unix::fs::DirBuilderExt;
834-
builder.mode(_mode.into());
836+
builder.mode(mode.into());
835837
}
836838

837839
let result = builder.create(path).map(|_| 0i32);

0 commit comments

Comments
 (0)