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:
Alex Crichton
2022-04-04 12:27:12 -05:00
committed by GitHub
parent f18dbe49c9
commit 7b5176baea
59 changed files with 60 additions and 58 deletions

View File

@@ -6,7 +6,7 @@ description = "Exposes a benchmarking API for 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]

View File

@@ -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]

View File

@@ -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]

View File

@@ -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(()),

View File

@@ -6,7 +6,7 @@ description = "Support for automatic module caching with Wasmtime"
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/bytecodealliance/wasmtime"
documentation = "https://docs.rs/wasmtime-cache/"
edition = "2018"
edition = "2021"
[dependencies]
anyhow = "1.0"

View File

@@ -230,7 +230,6 @@ impl WorkerThread {
#[cfg(target_os = "windows")]
fn lower_thread_priority() {
use std::convert::TryInto;
use winapi::um::processthreadsapi::{GetCurrentThread, SetThreadPriority};
use winapi::um::winbase::THREAD_MODE_BACKGROUND_BEGIN;

View File

@@ -8,7 +8,7 @@ repository = "https://github.com/bytecodealliance/wasmtime"
documentation = "https://docs.rs/wasmtime-environ/"
categories = ["wasm"]
keywords = ["webassembly", "wasm"]
edition = "2018"
edition = "2021"
[dependencies]
anyhow = "1.0"

View File

@@ -5,7 +5,7 @@ authors = ["The Wasmtime Project Developers"]
description = "Fiber support for Wasmtime"
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/bytecodealliance/wasmtime"
edition = "2018"
edition = "2021"
# We link to some native code with symbols that don't change often, so let Cargo
# know that we can't show up multiple times in a crate graph. If this is an

View File

@@ -1,7 +1,7 @@
[package]
authors = ["The Wasmtime Project Developers"]
description = "Fuzzing infrastructure for Wasmtime"
edition = "2018"
edition = "2021"
name = "wasmtime-fuzzing"
publish = false
version = "0.19.0"

View File

@@ -4,7 +4,7 @@ description = "A Rust-to-OCaml wrapper for the WebAssembly specification interpr
name = "wasm-spec-interpreter"
version = "0.1.0"
publish = false
edition = "2018"
edition = "2021"
license = "Apache-2.0 WITH LLVM-exception"
# Until https://gitlab.com/ocaml-rust/ocaml-boxroot/-/issues/1 is resolved and

View File

@@ -8,7 +8,7 @@ categories = ["development-tools::debugging"]
keywords = ["gdb", "jit"]
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"
edition = "2021"
[dependencies]
lazy_static = {version = "1.3.0", optional = true }

View File

@@ -8,7 +8,7 @@ license = "Apache-2.0 WITH LLVM-exception"
categories = ["wasm"]
keywords = ["webassembly", "wasm"]
repository = "https://github.com/bytecodealliance/wasmtime"
edition = "2018"
edition = "2021"
[dependencies]
wasmtime-environ = { path = "../environ", version = "=0.36.0" }

View File

@@ -2,7 +2,7 @@
name = "run-examples"
version = "0.19.0"
authors = ["The Wasmtime Project Developers"]
edition = "2018"
edition = "2021"
publish = false
[dependencies]

View File

@@ -8,7 +8,7 @@ license = "Apache-2.0 WITH LLVM-exception"
categories = ["wasm"]
keywords = ["webassembly", "wasm"]
repository = "https://github.com/bytecodealliance/wasmtime"
edition = "2018"
edition = "2021"
[dependencies]
wasmtime-environ = { path = "../environ", version = "=0.36.0" }

View File

@@ -3,7 +3,7 @@ name = "test-programs"
version = "0.19.0"
authors = ["The Wasmtime Project Developers"]
readme = "README.md"
edition = "2018"
edition = "2021"
publish = false
license = "Apache-2.0 WITH LLVM-exception"

View File

@@ -3,7 +3,7 @@ name = "wasi-tests"
version = "0.19.0"
authors = ["The Wasmtime Project Developers"]
readme = "README.md"
edition = "2018"
edition = "2021"
publish = false
[dependencies]

View File

@@ -6,7 +6,7 @@ description = "WebAssembly type definitions for Cranelift"
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/bytecodealliance/wasmtime"
documentation = "https://docs.rs/wasmtime-types"
edition = "2018"
edition = "2021"
[dependencies]
cranelift-entity = { path = "../../cranelift/entity", version = "0.83.0", features = ['enable-serde'] }

View File

@@ -8,7 +8,7 @@ categories = ["wasm"]
keywords = ["webassembly", "wasm"]
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"
edition = "2021"
include = ["src/**/*", "WASI/phases/**/*", "README.md", "LICENSE", "build.rs"]
build = "build.rs"

View File

@@ -8,7 +8,7 @@ categories = ["wasm"]
keywords = ["webassembly", "wasm"]
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"
edition = "2021"
include = ["src/**/*", "README.md", "LICENSE" ]
[dependencies]

View File

@@ -7,7 +7,7 @@ license = "Apache-2.0 WITH LLVM-exception"
categories = ["wasm"]
keywords = ["webassembly", "wasm"]
repository = "https://github.com/bytecodealliance/wasmtime"
edition = "2018"
edition = "2021"
include = ["src/**/*", "LICENSE" ]
[dependencies]

View File

@@ -9,7 +9,7 @@ categories = ["wasm", "cryptography"]
keywords = ["webassembly", "wasm", "crypto"]
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"
edition = "2021"
[dependencies]
anyhow = "1.0"

View File

@@ -9,7 +9,7 @@ categories = ["wasm", "computer-vision"]
keywords = ["webassembly", "wasm", "neural-network"]
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"
edition = "2021"
[dependencies]
# These dependencies are necessary for the witx-generation macros to work:

View File

@@ -3,7 +3,7 @@ name = "wasi-nn-example"
version = "0.19.0"
authors = ["The Wasmtime Project Developers"]
readme = "README.md"
edition = "2018"
edition = "2021"
publish = false
[dependencies]

View File

@@ -8,7 +8,7 @@ categories = ["wasm"]
keywords = ["webassembly", "wasm"]
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"
edition = "2021"
include = ["src/**/*", "README.md", "LICENSE", "build.rs"]
build = "build.rs"

View File

@@ -7,7 +7,7 @@ documentation = "https://docs.rs/wasmtime"
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"
edition = "2021"
[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "nightlydoc"]

View File

@@ -7,7 +7,7 @@ license = "Apache-2.0 WITH LLVM-exception"
categories = ["wasm"]
keywords = ["webassembly", "wasm"]
repository = "https://github.com/bytecodealliance/wasmtime"
edition = "2018"
edition = "2021"
[dependencies]
anyhow = "1.0.19"

View File

@@ -2,7 +2,7 @@
name = "wiggle"
version = "0.36.0"
authors = ["Pat Hickey <phickey@fastly.com>", "Jakub Konka <kubkonk@jakubkonka.com>", "Alex Crichton <alex@alexcrichton.com>"]
edition = "2018"
edition = "2021"
license = "Apache-2.0 WITH LLVM-exception"
description = "Runtime components of wiggle code generator"
categories = ["wasm"]

View File

@@ -3,7 +3,7 @@ name = "wiggle-generate"
version = "0.36.0"
authors = ["Pat Hickey <phickey@fastly.com>", "Jakub Konka <kubkon@jakubkonka.com>", "Alex Crichton <alex@alexcrichton.com>"]
license = "Apache-2.0 WITH LLVM-exception"
edition = "2018"
edition = "2021"
description = "Library crate for wiggle code generator."
categories = ["wasm"]
keywords = ["webassembly", "wasm"]

View File

@@ -2,7 +2,7 @@
name = "wiggle-macro"
version = "0.36.0"
authors = ["Pat Hickey <phickey@fastly.com>", "Jakub Konka <kubkon@jakubkonka.com>", "Alex Crichton <alex@alexcrichton.com>"]
edition = "2018"
edition = "2021"
license = "Apache-2.0 WITH LLVM-exception"
description = "Wiggle code generator"
categories = ["wasm"]

View File

@@ -3,7 +3,7 @@ name = "wiggle-test"
version = "0.21.0"
authors = ["Pat Hickey <phickey@fastly.com>", "Jakub Konka <kubkon@jakubkonka.com>", "Alex Crichton <alex@alexcrichton.com>"]
license = "Apache-2.0 WITH LLVM-exception"
edition = "2018"
edition = "2021"
description = "Reusable testing components for wiggle code generator. Only intended to be used by tests in `wiggle` crate."
categories = ["wasm"]
keywords = ["webassembly", "wasm"]