Skip to content

Commit 9b23f69

Browse files
committed
Auto merge of #139826 - matthiaskrgr:rollup-0q0qvkd, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #139745 (Avoid unused clones in `Cloned<I>` and `Copied<I>`) - #139757 (opt-dist: use executable-extension for host llvm-profdata) - #139778 (Add test for issue 34834) - #139783 (Use `compiletest-ignore-dir` for bootstrap self-tests) - #139797 (Allow (but don't require) `#[unsafe(naked)]` so that `compiler-builtins` can upgrade to it) - #139799 (Specify `--print info=file` syntax in `--help`) - #139811 (Use `newtype_index!`-generated types more idiomatically) - #139813 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2 parents cbeff6b + c7d7b0e commit 9b23f69

File tree

7 files changed

+42
-14
lines changed

7 files changed

+42
-14
lines changed

Cargo.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ features = ['unprefixed_malloc_on_supported_platforms']
3737

3838
[target.'cfg(unix)'.dependencies]
3939
libc = "0.2"
40-
libffi = "3.2.0"
40+
libffi = "4.0.0"
4141
libloading = "0.8"
4242

4343
[target.'cfg(target_family = "windows")'.dependencies]

ci/ci.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ case $HOST_TARGET in
164164
# Partially supported targets (tier 2)
165165
BASIC="empty_main integer heap_alloc libc-mem vec string btreemap" # ensures we have the basics: pre-main code, system allocator
166166
UNIX="hello panic/panic panic/unwind concurrency/simple atomic libc-mem libc-misc libc-random env num_cpus" # the things that are very similar across all Unixes, and hence easily supported there
167-
TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC $UNIX time hashmap random threadname pthread fs libc-pipe concurrency sync
168-
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX time hashmap random threadname pthread fs libc-pipe
169-
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX time hashmap random sync concurrency thread epoll eventfd
167+
TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC $UNIX time hashmap random thread sync concurrency fs libc-pipe
168+
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX time hashmap random thread sync concurrency fs libc-pipe
169+
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX time hashmap random thread sync concurrency epoll eventfd
170170
TEST_TARGET=wasm32-wasip2 run_tests_minimal $BASIC wasm
171171
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std empty_main wasm # this target doesn't really have std
172172
TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7d7de5bf3c3cbf9c2c5bbc5cbfb9197a8a427d35
1+
1bc56185ee257ed829a0aea7abdc3b03c5fed887

src/shims/windows/foreign_items.rs

+20-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn win_get_full_path_name<'tcx>(path: &Path) -> InterpResult<'tcx, io::Result<Pa
6565
}
6666
// Otherwise we try to do something kind of close to what Windows does, but this is probably not
6767
// right in all cases.
68-
let mut result: Vec<&[u8]> = vec![]; // will be a vecot of components, joined by `/`.
68+
let mut result: Vec<&[u8]> = vec![]; // will be a vector of components, joined by `/`.
6969
let mut bytes = bytes; // the remaining bytes to process
7070
let mut stop = false;
7171
while !stop {
@@ -396,6 +396,25 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
396396
let last_error = this.get_last_error()?;
397397
this.write_scalar(last_error, dest)?;
398398
}
399+
"RtlNtStatusToDosError" => {
400+
let [status] = this.check_shim(abi, sys_conv, link_name, args)?;
401+
let status = this.read_scalar(status)?.to_u32()?;
402+
let err = match status {
403+
// STATUS_MEDIA_WRITE_PROTECTED => ERROR_WRITE_PROTECT
404+
0xC00000A2 => 19,
405+
// STATUS_FILE_INVALID => ERROR_FILE_INVALID
406+
0xC0000098 => 1006,
407+
// STATUS_DISK_FULL => ERROR_DISK_FULL
408+
0xC000007F => 112,
409+
// STATUS_IO_DEVICE_ERROR => ERROR_IO_DEVICE
410+
0xC0000185 => 1117,
411+
// STATUS_ACCESS_DENIED => ERROR_ACCESS_DENIED
412+
0xC0000022 => 5,
413+
// Anything without an error code => ERROR_MR_MID_NOT_FOUND
414+
_ => 317,
415+
};
416+
this.write_scalar(Scalar::from_i32(err), dest)?;
417+
}
399418

400419
// Querying system information
401420
"GetSystemInfo" => {

tests/pass-dep/shims/windows-fs.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ use std::ptr;
1010
mod utils;
1111

1212
use windows_sys::Win32::Foundation::{
13-
CloseHandle, ERROR_ALREADY_EXISTS, GENERIC_READ, GENERIC_WRITE, GetLastError,
13+
CloseHandle, ERROR_ACCESS_DENIED, ERROR_ALREADY_EXISTS, ERROR_IO_DEVICE, GENERIC_READ,
14+
GENERIC_WRITE, GetLastError, RtlNtStatusToDosError, STATUS_ACCESS_DENIED,
15+
STATUS_IO_DEVICE_ERROR,
1416
};
1517
use windows_sys::Win32::Storage::FileSystem::{
1618
BY_HANDLE_FILE_INFORMATION, CREATE_ALWAYS, CREATE_NEW, CreateFileW, FILE_ATTRIBUTE_DIRECTORY,
@@ -26,6 +28,7 @@ fn main() {
2628
test_create_always_twice();
2729
test_open_always_twice();
2830
test_open_dir_reparse();
31+
test_ntstatus_to_dos();
2932
}
3033
}
3134

@@ -191,6 +194,12 @@ unsafe fn test_open_dir_reparse() {
191194
};
192195
}
193196

197+
unsafe fn test_ntstatus_to_dos() {
198+
// We won't test all combinations, just a couple common ones
199+
assert_eq!(RtlNtStatusToDosError(STATUS_IO_DEVICE_ERROR), ERROR_IO_DEVICE);
200+
assert_eq!(RtlNtStatusToDosError(STATUS_ACCESS_DENIED), ERROR_ACCESS_DENIED);
201+
}
202+
194203
fn to_wide_cstr(path: &Path) -> Vec<u16> {
195204
let mut raw_path = path.as_os_str().encode_wide().collect::<Vec<_>>();
196205
raw_path.extend([0, 0]);

tests/pass/issues/issue-134713-swap_nonoverlapping_untyped.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::mem::{size_of, align_of};
1+
use std::mem::{align_of, size_of};
22

33
// See <https://github.com/rust-lang/rust/issues/134713>
44

0 commit comments

Comments
 (0)