Skip to content

Commit 253579a

Browse files
authored
Bump MSRV to 1.83.0 (#10264)
* Bump MSRV to 1.83.0 This commit updates the minimum supported Rust version for Wasmtime and Cranelift to 1.83.0. This is coupled with Rust's release today of 1.85.0. Additionally the nightly version used in testing was updated to today's nightly too. prtest:full * Update path_rename test to work on Windows Looks like the Rust standard library and Windows now has enough support to act the same across all platforms. * Fix compile warning * Looks like windows has new error codes now too * This error is still different
1 parent 692490b commit 253579a

File tree

3 files changed

+33
-58
lines changed

3 files changed

+33
-58
lines changed

.github/actions/install-rust/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ runs:
2828
elif [ "${{ inputs.toolchain }}" = "msrv" ]; then
2929
echo "version=1.$msrv.0" >> "$GITHUB_OUTPUT"
3030
elif [ "${{ inputs.toolchain }}" = "wasmtime-ci-pinned-nightly" ]; then
31-
echo "version=nightly-2025-01-09" >> "$GITHUB_OUTPUT"
31+
echo "version=nightly-2025-02-20" >> "$GITHUB_OUTPUT"
3232
else
3333
echo "version=${{ inputs.toolchain }}" >> "$GITHUB_OUTPUT"
3434
fi

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ edition = "2021"
173173
#
174174
# NB: once this is 1.84+ delete `pulley/build.rs` and the similar code in
175175
# `crate/wasmtime/build.rs`
176-
rust-version = "1.82.0"
176+
rust-version = "1.83.0"
177177

178178
[workspace.lints.rust]
179179
# Turn on some lints which are otherwise allow-by-default in rustc.

crates/test-programs/src/bin/preview1_path_rename.rs

Lines changed: 31 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::{env, process};
2-
use test_programs::preview1::{assert_errno, config, create_file, open_scratch_directory};
2+
use test_programs::preview1::{assert_errno, create_file, open_scratch_directory};
33

44
unsafe fn test_path_rename(dir_fd: wasi::Fd) {
55
// First, try renaming a dir to nonexistent path
@@ -27,41 +27,28 @@ unsafe fn test_path_rename(dir_fd: wasi::Fd) {
2727
wasi::fd_close(fd).expect("closing a file");
2828
wasi::path_remove_directory(dir_fd, "target").expect("removing a directory");
2929

30-
// Yes, renaming a dir to an empty dir is a property guaranteed by rename(2)
31-
// and its fairly important that it is atomic.
32-
// But, we haven't found a way to emulate it on windows. So, sometimes this
33-
// behavior is just hosed. Sorry.
34-
if config().support_rename_dir_to_empty_dir() {
35-
// Now, try renaming renaming a dir to existing empty dir
36-
wasi::path_create_directory(dir_fd, "source").expect("creating a directory");
37-
wasi::path_create_directory(dir_fd, "target").expect("creating a directory");
38-
wasi::path_rename(dir_fd, "source", dir_fd, "target").expect("renaming a directory");
39-
40-
// Check that source directory doesn't exist anymore
41-
assert_errno!(
42-
wasi::path_open(dir_fd, 0, "source", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
43-
.expect_err("opening a nonexistent path as a directory"),
44-
wasi::ERRNO_NOENT
45-
);
46-
47-
// Check that target directory exists
48-
fd = wasi::path_open(dir_fd, 0, "target", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
49-
.expect("opening renamed path as a directory");
50-
assert!(
51-
fd > libc::STDERR_FILENO as wasi::Fd,
52-
"file descriptor range check",
53-
);
54-
55-
wasi::fd_close(fd).expect("closing a file");
56-
wasi::path_remove_directory(dir_fd, "target").expect("removing a directory");
57-
} else {
58-
wasi::path_create_directory(dir_fd, "source").expect("creating a directory");
59-
wasi::path_create_directory(dir_fd, "target").expect("creating a directory");
60-
wasi::path_rename(dir_fd, "source", dir_fd, "target")
61-
.expect_err("windows does not support renaming a directory to an empty directory");
62-
wasi::path_remove_directory(dir_fd, "target").expect("removing a directory");
63-
wasi::path_remove_directory(dir_fd, "source").expect("removing a directory");
64-
}
30+
// Now, try renaming renaming a dir to existing empty dir
31+
wasi::path_create_directory(dir_fd, "source").expect("creating a directory");
32+
wasi::path_create_directory(dir_fd, "target").expect("creating a directory");
33+
wasi::path_rename(dir_fd, "source", dir_fd, "target").expect("renaming a directory");
34+
35+
// Check that source directory doesn't exist anymore
36+
assert_errno!(
37+
wasi::path_open(dir_fd, 0, "source", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
38+
.expect_err("opening a nonexistent path as a directory"),
39+
wasi::ERRNO_NOENT
40+
);
41+
42+
// Check that target directory exists
43+
fd = wasi::path_open(dir_fd, 0, "target", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
44+
.expect("opening renamed path as a directory");
45+
assert!(
46+
fd > libc::STDERR_FILENO as wasi::Fd,
47+
"file descriptor range check",
48+
);
49+
50+
wasi::fd_close(fd).expect("closing a file");
51+
wasi::path_remove_directory(dir_fd, "target").expect("removing a directory");
6552

6653
// Now, try renaming a dir to existing non-empty dir
6754
wasi::path_create_directory(dir_fd, "source").expect("creating a directory");
@@ -71,29 +58,17 @@ unsafe fn test_path_rename(dir_fd: wasi::Fd) {
7158
assert_errno!(
7259
wasi::path_rename(dir_fd, "source", dir_fd, "target")
7360
.expect_err("renaming directory to a nonempty directory"),
74-
windows => wasi::ERRNO_ACCES,
75-
unix => wasi::ERRNO_NOTEMPTY
61+
wasi::ERRNO_NOTEMPTY
7662
);
7763

78-
// This is technically a different property, but the root of these divergent behaviors is in
79-
// the semantics that windows gives us around renaming directories. So, it lives under the same
80-
// flag.
81-
if config().support_rename_dir_to_empty_dir() {
82-
// Try renaming dir to a file
83-
assert_errno!(
84-
wasi::path_rename(dir_fd, "source", dir_fd, "target/file")
85-
.expect_err("renaming a directory to a file"),
86-
wasi::ERRNO_NOTDIR
87-
);
88-
wasi::path_unlink_file(dir_fd, "target/file").expect("removing a file");
89-
wasi::path_remove_directory(dir_fd, "source").expect("removing a directory");
90-
} else {
91-
// Windows will let you erase a file by renaming a directory to it.
92-
// WASI users can't depend on this error getting caught to prevent data loss.
64+
// Try renaming dir to a file
65+
assert_errno!(
9366
wasi::path_rename(dir_fd, "source", dir_fd, "target/file")
94-
.expect("windows happens to support renaming a directory to a file");
95-
wasi::path_remove_directory(dir_fd, "target/file").expect("removing a file");
96-
}
67+
.expect_err("renaming a directory to a file"),
68+
wasi::ERRNO_NOTDIR
69+
);
70+
wasi::path_unlink_file(dir_fd, "target/file").expect("removing a file");
71+
wasi::path_remove_directory(dir_fd, "source").expect("removing a directory");
9772
wasi::path_remove_directory(dir_fd, "target").expect("removing a directory");
9873

9974
// Now, try renaming a file to a nonexistent path

0 commit comments

Comments
 (0)