Upgrade all crates to the Rust 2021 edition (#3991)
* Upgrade all crates to the Rust 2021 edition
I've personally started using the new format strings for things like
`panic!("some message {foo}")` or similar and have been upgrading crates
on a case-by-case basis, but I think it probably makes more sense to go
ahead and blanket upgrade everything so 2021 features are always
available.
* Fix compile of the C API
* Fix a warning
* Fix another warning
This commit is contained in:
@@ -6,7 +6,7 @@ description = "C API to expose the Wasmtime runtime"
|
||||
license = "Apache-2.0 WITH LLVM-exception"
|
||||
repository = "https://github.com/bytecodealliance/wasmtime"
|
||||
readme = "README.md"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
name = "wasmtime-c-api-macros"
|
||||
version = "0.19.0"
|
||||
authors = ["The Wasmtime Project Developers"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
|
||||
@@ -104,6 +104,7 @@ pub unsafe extern "C" fn wasm_func_new_with_env(
|
||||
) -> Box<wasm_func_t> {
|
||||
let finalizer = crate::ForeignData { data, finalizer };
|
||||
create_function(store, ty, move |params, results| {
|
||||
drop(&finalizer); // move entire finalizer into this closure
|
||||
callback(finalizer.data, params, results)
|
||||
})
|
||||
}
|
||||
@@ -233,6 +234,8 @@ pub(crate) unsafe fn c_callback_to_rust_fn(
|
||||
) -> impl Fn(Caller<'_, crate::StoreData>, &[Val], &mut [Val]) -> Result<(), Trap> {
|
||||
let foreign = crate::ForeignData { data, finalizer };
|
||||
move |mut caller, params, results| {
|
||||
drop(&foreign); // move entire foreign into this closure
|
||||
|
||||
// Convert `params/results` to `wasmtime_val_t`. Use the previous
|
||||
// storage in `hostcall_val_storage` to help avoid allocations all the
|
||||
// time.
|
||||
@@ -295,6 +298,7 @@ pub(crate) unsafe fn c_unchecked_callback_to_rust_fn(
|
||||
) -> impl Fn(Caller<'_, crate::StoreData>, *mut ValRaw) -> Result<(), Trap> {
|
||||
let foreign = crate::ForeignData { data, finalizer };
|
||||
move |caller, values| {
|
||||
drop(&foreign); // move entire foreign into this closure
|
||||
let mut caller = wasmtime_caller_t { caller };
|
||||
match callback(foreign.data, &mut caller, values) {
|
||||
None => Ok(()),
|
||||
|
||||
Reference in New Issue
Block a user