Skip to content

Commit 0079cad

Browse files
committed
Cleanups, minor fixes to item locations
1 parent b1d5a90 commit 0079cad

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

src/shims/files.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
use std::any::Any;
22
use std::collections::BTreeMap;
33
use std::io::{IsTerminal, Read, SeekFrom, Write};
4-
use std::{fs, io};
54
use std::ops::Deref;
65
use std::rc::{Rc, Weak};
6+
use std::{fs, io};
77

88
use rustc_abi::Size;
99

10-
use crate::*;
1110
use crate::shims::unix::UnixFileDescription;
12-
13-
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
14-
pub(crate) enum FlockOp {
15-
SharedLock { nonblocking: bool },
16-
ExclusiveLock { nonblocking: bool },
17-
Unlock,
18-
}
11+
use crate::*;
1912

2013
/// Represents an open file description.
2114
pub trait FileDescription: std::fmt::Debug + Any {
@@ -70,9 +63,7 @@ pub trait FileDescription: std::fmt::Debug + Any {
7063
}
7164

7265
fn metadata<'tcx>(&self) -> InterpResult<'tcx, io::Result<fs::Metadata>> {
73-
throw_unsup_format!(
74-
"obtaining metadata is only supported on file-backed file descriptors"
75-
);
66+
throw_unsup_format!("obtaining metadata is only supported on file-backed file descriptors");
7667
}
7768

7869
fn is_tty(&self, _communicate_allowed: bool) -> bool {

src/shims/unix/fd.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@ use std::io::{self, ErrorKind};
66
use rustc_abi::Size;
77

88
use crate::helpers::check_min_arg_count;
9+
use crate::shims::files::FileDescription;
910
use crate::shims::unix::linux::epoll::EpollReadyEvents;
1011
use crate::shims::unix::*;
1112
use crate::*;
12-
use crate::shims::files::{FileDescription, FlockOp};
13+
14+
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
15+
pub(crate) enum FlockOp {
16+
SharedLock { nonblocking: bool },
17+
ExclusiveLock { nonblocking: bool },
18+
Unlock,
19+
}
1320

1421
/// Represents unix-specific file descriptions.
1522
pub trait UnixFileDescription: FileDescription {

src/shims/unix/fs.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
//! File and file system access
22
33
use std::borrow::Cow;
4-
use std::fs::{DirBuilder, File, FileType, OpenOptions, ReadDir, read_dir, remove_dir, remove_file, rename, Metadata};
4+
use std::fs::{
5+
DirBuilder, File, FileType, Metadata, OpenOptions, ReadDir, read_dir, remove_dir, remove_file,
6+
rename,
7+
};
58
use std::io::{self, ErrorKind, IsTerminal, Read, Seek, SeekFrom, Write};
69
use std::path::{Path, PathBuf};
710
use std::time::SystemTime;
@@ -11,10 +14,10 @@ use rustc_data_structures::fx::FxHashMap;
1114

1215
use self::shims::time::system_time_to_duration;
1316
use crate::helpers::check_min_arg_count;
17+
use crate::shims::files::{EvalContextExt as _, FileDescription, FileDescriptionRef};
1418
use crate::shims::os_str::bytes_to_os_str;
15-
use crate::shims::files::{FileDescription, FileDescriptionRef, FlockOp, EvalContextExt as _};
19+
use crate::shims::unix::fd::{FlockOp, UnixFileDescription};
1620
use crate::*;
17-
use crate::shims::unix::fd::UnixFileDescription;
1821

1922
#[derive(Debug)]
2023
struct FileHandle {

src/shims/windows/foreign_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::*;
1212

1313
// The NTSTATUS STATUS_INVALID_HANDLE (0xC0000008) encoded as a HRESULT by setting the N bit.
1414
// (https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)
15-
const STATUS_INVALID_HANDLE: u32 = 0xD0000008;
15+
// const STATUS_INVALID_HANDLE: u32 = 0xD0000008;
1616

1717
pub fn is_dyn_sym(name: &str) -> bool {
1818
// std does dynamic detection for these symbols

0 commit comments

Comments
 (0)