Skip to content

Commit b98f75a

Browse files
authored
Bump MSRV to 1.84.0 (#10520)
* Bump MSRV to 1.84.0 Coupled with today's release of 1.86.0 * Fix tests on windows
1 parent 5ae33b4 commit b98f75a

10 files changed

Lines changed: 23 additions & 79 deletions

File tree

.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-03-19" >> "$GITHUB_OUTPUT"
31+
echo "version=nightly-2025-04-03" >> "$GITHUB_OUTPUT"
3232
else
3333
echo "version=${{ inputs.toolchain }}" >> "$GITHUB_OUTPUT"
3434
fi

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,7 @@ authors = ["The Wasmtime Project Developers"]
174174
edition = "2021"
175175
# Wasmtime's current policy is that this number can be no larger than the
176176
# current stable release of Rust minus 2.
177-
#
178-
# NB: once this is 1.84+ delete `pulley/build.rs` and the similar code in
179-
# `crate/wasmtime/build.rs`
180-
rust-version = "1.83.0"
177+
rust-version = "1.84.0"
181178

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

crates/test-programs/artifacts/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub fn wasi_tests_environment() -> &'static [(&'static str, &'static str)] {
1919
// Windows does not support renaming a directory to an empty directory -
2020
// empty directory must be deleted.
2121
("NO_RENAME_DIR_TO_EMPTY_DIR", "1"),
22+
("RENAME_DIR_ONTO_FILE", "1"),
2223
]
2324
}
2425
#[cfg(all(unix, not(target_os = "macos")))]

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

Lines changed: 13 additions & 8 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, create_file, open_scratch_directory};
2+
use test_programs::preview1::{assert_errno, create_file, open_scratch_directory, TestConfig};
33

44
unsafe fn test_path_rename(dir_fd: wasip1::Fd) {
55
// First, try renaming a dir to nonexistent path
@@ -62,13 +62,18 @@ unsafe fn test_path_rename(dir_fd: wasip1::Fd) {
6262
);
6363

6464
// Try renaming dir to a file
65-
assert_errno!(
66-
wasip1::path_rename(dir_fd, "source", dir_fd, "target/file")
67-
.expect_err("renaming a directory to a file"),
68-
wasip1::ERRNO_NOTDIR
69-
);
70-
wasip1::path_unlink_file(dir_fd, "target/file").expect("removing a file");
71-
wasip1::path_remove_directory(dir_fd, "source").expect("removing a directory");
65+
if TestConfig::from_env().support_rename_dir_onto_file() {
66+
wasip1::path_rename(dir_fd, "source", dir_fd, "target/file").unwrap();
67+
wasip1::path_remove_directory(dir_fd, "target/file").expect("removing a directory");
68+
} else {
69+
assert_errno!(
70+
wasip1::path_rename(dir_fd, "source", dir_fd, "target/file")
71+
.expect_err("renaming a directory to a file"),
72+
wasip1::ERRNO_NOTDIR
73+
);
74+
wasip1::path_unlink_file(dir_fd, "target/file").expect("removing a file");
75+
wasip1::path_remove_directory(dir_fd, "source").expect("removing a directory");
76+
}
7277
wasip1::path_remove_directory(dir_fd, "target").expect("removing a directory");
7378

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

crates/test-programs/src/preview1.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ pub struct TestConfig {
129129
fs_time_precision: u64,
130130
no_dangling_filesystem: bool,
131131
no_rename_dir_to_empty_dir: bool,
132+
rename_dir_onto_file: bool,
132133
}
133134

134135
enum ErrnoMode {
@@ -160,6 +161,7 @@ impl TestConfig {
160161
fs_time_precision,
161162
no_dangling_filesystem,
162163
no_rename_dir_to_empty_dir,
164+
rename_dir_onto_file: std::env::var("RENAME_DIR_ONTO_FILE").is_ok(),
163165
}
164166
}
165167
pub fn errno_expect_unix(&self) -> bool {
@@ -189,4 +191,7 @@ impl TestConfig {
189191
pub fn support_rename_dir_to_empty_dir(&self) -> bool {
190192
!self.no_rename_dir_to_empty_dir
191193
}
194+
pub fn support_rename_dir_onto_file(&self) -> bool {
195+
self.rename_dir_onto_file
196+
}
192197
}

crates/wasmtime/build.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
use std::process::Command;
21
use std::str;
32

43
fn main() {
54
println!("cargo:rerun-if-changed=build.rs");
65

7-
enable_features_based_on_rustc_version();
8-
96
// NB: duplicating a workaround in the wasmtime-fiber build script.
107
custom_cfg("asan", cfg_is("sanitize", "address"));
118

@@ -95,23 +92,3 @@ fn build_c_helpers() {
9592
build.file("src/runtime/vm/helpers.c");
9693
build.compile("wasmtime-helpers");
9794
}
98-
99-
fn enable_features_based_on_rustc_version() {
100-
// Temporary check to see if the rustc version >= 1.84 in which case
101-
// provenance-related pointer APIs are available. This is temporary because
102-
// in the future the MSRV of this crate will be beyond 1.84 in which case
103-
// this build script can be deleted.
104-
let minor = rustc_minor_version().unwrap_or(0);
105-
custom_cfg("has_provenance_apis", minor >= 84);
106-
}
107-
108-
fn rustc_minor_version() -> Option<u32> {
109-
let rustc = std::env::var("RUSTC").unwrap();
110-
let output = Command::new(rustc).arg("--version").output().ok()?;
111-
let version = str::from_utf8(&output.stdout).ok()?;
112-
let mut pieces = version.split('.');
113-
if pieces.next() != Some("rustc 1") {
114-
return None;
115-
}
116-
pieces.next()?.parse().ok()
117-
}

crates/wasmtime/src/runtime/vm/provenance.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,7 @@ impl<T> VmPtr<T> {
107107

108108
/// Similar to `as_send_sync`, but returns a `NonNull<T>`.
109109
pub fn as_non_null(&self) -> NonNull<T> {
110-
#[cfg(has_provenance_apis)]
111110
let ptr = core::ptr::with_exposed_provenance_mut(self.ptr.get());
112-
#[cfg(not(has_provenance_apis))]
113-
let ptr = self.ptr.get() as *mut T;
114-
115111
unsafe { NonNull::new_unchecked(ptr) }
116112
}
117113

@@ -141,10 +137,7 @@ impl<T> fmt::Debug for VmPtr<T> {
141137
impl<T> From<NonNull<T>> for VmPtr<T> {
142138
fn from(ptr: NonNull<T>) -> VmPtr<T> {
143139
VmPtr {
144-
#[cfg(has_provenance_apis)]
145140
ptr: unsafe { NonZeroUsize::new_unchecked(ptr.as_ptr().expose_provenance()) },
146-
#[cfg(not(has_provenance_apis))]
147-
ptr: unsafe { NonZeroUsize::new_unchecked(ptr.as_ptr() as usize) },
148141
_marker: marker::PhantomData,
149142
}
150143
}

crates/wasmtime/src/runtime/vm/vmcontext.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,6 @@ macro_rules! define_builtin_array {
960960
/// pointer is considered valid.
961961
pub fn expose_provenance(&self) -> NonNull<Self>{
962962
$(
963-
#[cfg(has_provenance_apis)]
964963
(self.$name as *mut u8).expose_provenance();
965964
)*
966965
NonNull::from(self)

pulley/build.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

pulley/src/interp.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,7 @@ impl XRegVal {
472472

473473
pub fn get_ptr<T>(&self) -> *mut T {
474474
let ptr = unsafe { self.0.ptr };
475-
let ptr = usize::from_le(ptr);
476-
#[cfg(has_provenance_apis)]
477-
return core::ptr::with_exposed_provenance_mut(ptr);
478-
#[cfg(not(has_provenance_apis))]
479-
return ptr as *mut T;
475+
core::ptr::with_exposed_provenance_mut(usize::from_le(ptr))
480476
}
481477

482478
pub fn set_i32(&mut self, x: i32) {
@@ -496,11 +492,7 @@ impl XRegVal {
496492
}
497493

498494
pub fn set_ptr<T>(&mut self, ptr: *mut T) {
499-
#[cfg(has_provenance_apis)]
500-
let ptr = ptr.expose_provenance();
501-
#[cfg(not(has_provenance_apis))]
502-
let ptr = ptr as usize;
503-
self.0.ptr = ptr.to_le();
495+
self.0.ptr = ptr.expose_provenance().to_le();
504496
}
505497
}
506498

0 commit comments

Comments
 (0)