Browse Source

Bump MSRV to 1.78.0 (#9010)

* Bump MSRV to 1.78.0

This commit updates to use Rust 1.80 in CI as well as updating the
minimum-supported-rust-version to 1.78. Additionally the nightly used in
testing in CI is updated as well.

prtest:full

* Fix compat with latest nightly in tests

* Fix some more nightly warnings

* Ignore new tests on MIRI
pull/9012/head
Alex Crichton 3 months ago
committed by GitHub
parent
commit
787cdec566
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      .github/actions/install-rust/action.yml
  2. 2
      Cargo.toml
  3. 31
      crates/wasmtime/src/runtime/vm/sys/miri/traphandlers.rs
  4. 2
      tests/all/call_hook.rs
  5. 1
      tests/all/func.rs
  6. 1
      tests/all/host_funcs.rs
  7. 10
      tests/all/traps.rs
  8. 10
      tests/host_segfault.rs

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

@ -23,7 +23,7 @@ runs:
elif [ "${{ inputs.toolchain }}" = "msrv" ]; then
echo "version=1.$msrv.0" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.toolchain }}" = "wasmtime-ci-pinned-nightly" ]; then
echo "version=nightly-2024-06-13" >> "$GITHUB_OUTPUT"
echo "version=nightly-2024-07-25" >> "$GITHUB_OUTPUT"
else
echo "version=${{ inputs.toolchain }}" >> "$GITHUB_OUTPUT"
fi

2
Cargo.toml

@ -160,7 +160,7 @@ authors = ["The Wasmtime Project Developers"]
edition = "2021"
# Wasmtime's current policy is that this number can be no larger than the
# current stable release of Rust minus 2.
rust-version = "1.77.0"
rust-version = "1.78.0"
[workspace.lints.rust]
# Turn on some lints which are otherwise allow-by-default in rustc.

31
crates/wasmtime/src/runtime/vm/sys/miri/traphandlers.rs

@ -1,37 +1,30 @@
// For MIRI, set up just enough of a setjmp/longjmp with catching panics
// to get a few tests working that use this.
// For MIRI, there's no way to implement longjmp/setjmp. The only possible way
// to implement this is with panic/catch_panic, but the entrypoint into Rust
// from wasm is defined as `extern "C"` which isn't allowed to panic. That
// means that panicking here triggers UB which gets routed to `libc::abort()`.
//
// This maens that on MIRI all tests which trap are configured to be skipped at
// this time.
//
// Note that no actual JIT code runs in MIRI so this is purely here for
// host-to-host calls.
use crate::runtime::vm::VMContext;
struct WasmtimeLongjmp;
pub fn wasmtime_setjmp(
_jmp_buf: *mut *const u8,
callback: extern "C" fn(*mut u8, *mut VMContext),
payload: *mut u8,
callee: *mut VMContext,
) -> i32 {
use std::panic::{self, AssertUnwindSafe};
let result = panic::catch_unwind(AssertUnwindSafe(|| {
callback(payload, callee);
}));
match result {
Ok(()) => 1,
Err(e) => {
if e.is::<WasmtimeLongjmp>() {
0
} else {
panic::resume_unwind(e)
}
}
}
callback(payload, callee);
1
}
pub fn wasmtime_longjmp(_jmp_buf: *const u8) -> ! {
std::panic::panic_any(WasmtimeLongjmp)
unsafe {
libc::abort();
}
}
#[allow(missing_docs)]

2
tests/all/call_hook.rs

@ -748,7 +748,7 @@ async fn drop_suspended_async_hook() -> Result<(), Error> {
assert_eq!(*state, 0);
*state += 1;
let _dec = Decrement(state);
loop {
for _ in 0.. {
tokio::task::yield_now().await;
}
})

1
tests/all/func.rs

@ -690,6 +690,7 @@ fn import_works() -> Result<()> {
}
#[test]
#[cfg_attr(miri, ignore)]
fn trap_smoke() -> Result<()> {
let mut store = Store::<()>::default();
let f = Func::wrap(&mut store, || -> Result<()> { bail!("test") });

1
tests/all/host_funcs.rs

@ -454,6 +454,7 @@ fn call_wasm_many_args() -> Result<()> {
}
#[test]
#[cfg_attr(miri, ignore)]
fn trap_smoke() -> Result<()> {
let engine = Engine::default();
let mut linker = Linker::<()>::new(&engine);

10
tests/all/traps.rs

@ -406,7 +406,7 @@ fn rust_panic_import() -> Result<()> {
let module = Module::new(store.engine(), &binary)?;
let sig = FuncType::new(store.engine(), None, None);
let func = Func::new(&mut store, sig, |_, _, _| panic!("this is a panic"));
let func2 = Func::wrap(&mut store, || panic!("this is another panic"));
let func2 = Func::wrap(&mut store, || -> () { panic!("this is another panic") });
let instance = Instance::new(&mut store, &module, &[func.into(), func2.into()])?;
let func = instance.get_typed_func::<(), ()>(&mut store, "foo")?;
let err =
@ -501,7 +501,7 @@ fn rust_panic_start_function() -> Result<()> {
.unwrap_err();
assert_eq!(err.downcast_ref::<&'static str>(), Some(&"this is a panic"));
let func = Func::wrap(&mut store, || panic!("this is another panic"));
let func = Func::wrap(&mut store, || -> () { panic!("this is another panic") });
let err = panic::catch_unwind(AssertUnwindSafe(|| {
drop(Instance::new(&mut store, &module, &[func.into()]));
}))
@ -1007,7 +1007,7 @@ async fn async_then_sync_trap() -> Result<()> {
let sync_module = Module::new(sync_store.engine(), wat)?;
let mut sync_linker = Linker::new(sync_store.engine());
sync_linker.func_wrap("", "b", |_caller: Caller<_>| unreachable!())?;
sync_linker.func_wrap("", "b", |_caller: Caller<_>| -> () { unreachable!() })?;
let sync_instance = sync_linker.instantiate(&mut sync_store, &sync_module)?;
@ -1085,7 +1085,7 @@ async fn sync_then_async_trap() -> Result<()> {
let async_module = Module::new(async_store.engine(), wat)?;
let mut async_linker = Linker::new(async_store.engine());
async_linker.func_wrap("", "b", |_caller: Caller<_>| unreachable!())?;
async_linker.func_wrap("", "b", |_caller: Caller<_>| -> () { unreachable!() })?;
let async_instance = async_linker
.instantiate_async(&mut async_store, &async_module)
@ -1643,7 +1643,7 @@ fn same_module_multiple_stores() -> Result<()> {
let instance1 = Instance::new(&mut store1, &module, &[f1.into(), call_ref1.into()])?;
instance1
.get_typed_func(&mut store1, "a")?
.get_typed_func::<(), ()>(&mut store1, "a")?
.call(&mut store1, ())?;
let expected_stacks = vec![

10
tests/host_segfault.rs

@ -125,7 +125,7 @@ fn main() {
let engine = Engine::default();
let mut store = Store::new(&engine, ());
let module = Module::new(&engine, r#"(import "" "" (func)) (start 0)"#).unwrap();
let segfault = Func::wrap(&mut store, || segfault());
let segfault = Func::wrap(&mut store, || -> () { segfault() });
Instance::new(&mut store, &module, &[segfault.into()]).unwrap();
unreachable!();
},
@ -140,7 +140,9 @@ fn main() {
let mut store = Store::new(&engine, ());
let f = Func::wrap_async(&mut store, |_, _: ()| {
Box::new(async {
overrun_the_stack();
if true {
overrun_the_stack();
}
})
});
run_future(f.call_async(&mut store, &[], &mut [])).unwrap();
@ -172,7 +174,9 @@ fn main() {
let mut store = Store::new(&engine, ());
let f = Func::wrap_async(&mut store, |_, _: ()| {
Box::new(async {
overrun_the_stack();
if true {
overrun_the_stack();
}
})
});
run_future(f.call_async(&mut store, &[], &mut [])).unwrap();

Loading…
Cancel
Save