Skip to content

Commit ae74cad

Browse files
committed
Review fixes - comments and style
1 parent 3c55cd5 commit ae74cad

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ libloading = "0.8"
4343
[target.'cfg(target_family = "windows")'.dependencies]
4444
windows-sys = { version = "0.59", features = [
4545
"Win32_Foundation",
46-
"Win32_Security",
4746
"Win32_System_IO",
4847
"Win32_Storage_FileSystem",
4948
] }

src/shims/windows/fs.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,18 +251,18 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
251251
}
252252

253253
let handle = if is_dir {
254-
let fh = &mut this.machine.fds;
255-
let fd_num = fh.insert_new(DirHandle { path: file_name });
254+
// Open this as a directory.
255+
let fd_num = this.machine.fds.insert_new(DirHandle { path: file_name });
256256
Ok(Handle::File(fd_num))
257257
} else if creation_disposition == OpenExisting && !(desired_read || desired_write) {
258258
// Windows supports handles with no permissions. These allow things such as reading
259259
// metadata, but not file content.
260-
let fh = &mut this.machine.fds;
261260
file_name.metadata().map(|meta| {
262-
let fd_num = fh.insert_new(MetadataHandle { meta });
261+
let fd_num = this.machine.fds.insert_new(MetadataHandle { meta });
263262
Handle::File(fd_num)
264263
})
265264
} else {
265+
// Open this as a standard file.
266266
match creation_disposition {
267267
CreateAlways | OpenAlways => {
268268
options.create(true);
@@ -286,8 +286,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
286286
}
287287

288288
options.open(file_name).map(|file| {
289-
let fh = &mut this.machine.fds;
290-
let fd_num = fh.insert_new(FileHandle { file, writable: desired_write });
289+
let fd_num =
290+
this.machine.fds.insert_new(FileHandle { file, writable: desired_write });
291291
Handle::File(fd_num)
292292
})
293293
};

tests/pass/shims/fs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ mod utils;
1717

1818
fn main() {
1919
test_path_conversion();
20+
// Windows file handling is very incomplete.
2021
if cfg!(not(windows)) {
2122
test_file();
2223
test_file_create_new();

0 commit comments

Comments
 (0)