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

@@ -9,7 +9,7 @@ categories = ["wasm"]
keywords = ["webassembly", "wasm"]
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"
edition = "2021"
default-run = "wasmtime"
[lib]

View File

@@ -7,7 +7,7 @@ license = "Apache-2.0 WITH LLVM-exception"
documentation = "https://github.com/bytecodealliance/wasmtime/blob/main/cranelift/docs/index.md"
repository = "https://github.com/bytecodealliance/wasmtime"
publish = false
edition = "2018"
edition = "2021"
[[bin]]
name = "clif-util"

View File

@@ -9,7 +9,7 @@ repository = "https://github.com/bytecodealliance/wasmtime"
categories = ["no-std"]
readme = "README.md"
keywords = ["btree", "forest", "set", "map"]
edition = "2018"
edition = "2021"
[dependencies]
cranelift-entity = { path = "../entity", version = "0.83.0", default-features = false }

View File

@@ -10,7 +10,7 @@ categories = ["no-std"]
readme = "README.md"
keywords = ["compile", "compiler", "jit"]
build = "build.rs"
edition = "2018"
edition = "2021"
[dependencies]
cranelift-codegen-shared = { path = "./shared", version = "0.83.0" }

View File

@@ -6,7 +6,7 @@ description = "Metaprogram for cranelift-codegen code generator library"
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"
edition = "2021"
# FIXME(rust-lang/cargo#9300): uncomment once that lands
# [package.metadata.docs.rs]

View File

@@ -6,7 +6,7 @@ description = "For code shared between cranelift-codegen-meta and cranelift-code
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"
edition = "2021"
[dependencies]
# Since this is a shared dependency of several packages, please strive to keep this dependency-free

View File

@@ -9,7 +9,7 @@ repository = "https://github.com/bytecodealliance/wasmtime"
categories = ["no-std"]
readme = "README.md"
keywords = ["entity", "set", "map"]
edition = "2018"
edition = "2021"
[dependencies]
serde = { version = "1.0.94", features = ["derive"], optional = true }

View File

@@ -7,7 +7,7 @@ license = "Apache-2.0 WITH LLVM-exception"
documentation = "https://docs.rs/cranelift-filetests"
repository = "https://github.com/bytecodealliance/wasmtime"
publish = false
edition = "2018"
edition = "2021"
[dependencies]
cranelift-codegen = { path = "../codegen", version = "0.83.0", features = ["testing_hooks"] }

View File

@@ -8,7 +8,7 @@ documentation = "https://docs.rs/cranelift-frontend"
categories = ["no-std"]
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"
edition = "2021"
[dependencies]
cranelift-codegen = { path = "../codegen", version = "0.83.0", default-features = false }

View File

@@ -6,7 +6,7 @@ description = "Cranelift module generator"
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"
edition = "2021"
publish = false

View File

@@ -8,7 +8,7 @@ documentation = "https://docs.rs/cranelift-interpreter"
categories = ["no-std"]
license = "Apache-2.0 WITH LLVM-exception"
readme = "README.md"
edition = "2018"
edition = "2021"
[dependencies]
cranelift-codegen = { path = "../codegen", version = "0.83.0" }

View File

@@ -3,7 +3,7 @@ name = "isle-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
edition = "2021"
[package.metadata]
cargo-fuzz = true

View File

@@ -1,7 +1,7 @@
[package]
authors = ["The Cranelift Project Developers"]
description = "ISLE: Instruction Selection and Lowering Expressions. A domain-specific language for instruction selection in Cranelift."
edition = "2018"
edition = "2021"
license = "Apache-2.0 WITH LLVM-exception"
name = "cranelift-isle"
readme = "../README.md"

View File

@@ -2,7 +2,7 @@
name = "islec"
version = "0.1.0"
authors = ["The Cranelift Project Developers"]
edition = "2018"
edition = "2021"
license = "Apache-2.0 WITH LLVM-exception"
publish = false

View File

@@ -7,7 +7,7 @@ repository = "https://github.com/bytecodealliance/wasmtime"
documentation = "https://docs.rs/cranelift-jit"
license = "Apache-2.0 WITH LLVM-exception"
readme = "README.md"
edition = "2018"
edition = "2021"
[dependencies]
cranelift-module = { path = "../module", version = "0.83.0" }

View File

@@ -8,7 +8,7 @@ documentation = "https://docs.rs/cranelift-module"
categories = ["no-std"]
license = "Apache-2.0 WITH LLVM-exception"
readme = "README.md"
edition = "2018"
edition = "2021"
[dependencies]
cranelift-codegen = { path = "../codegen", version = "0.83.0", default-features = false }

View File

@@ -8,7 +8,7 @@ repository = "https://github.com/bytecodealliance/wasmtime"
categories = ["no-std"]
license = "Apache-2.0 WITH LLVM-exception"
readme = "README.md"
edition = "2018"
edition = "2021"
[dependencies]
cranelift-codegen = { path = "../codegen", version = "0.83.0", default-features = false }

View File

@@ -7,7 +7,7 @@ repository = "https://github.com/bytecodealliance/wasmtime"
documentation = "https://docs.rs/cranelift-object"
license = "Apache-2.0 WITH LLVM-exception"
readme = "README.md"
edition = "2018"
edition = "2021"
[dependencies]
cranelift-module = { path = "../module", version = "0.83.0" }

View File

@@ -9,7 +9,7 @@ repository = "https://github.com/bytecodealliance/wasmtime"
categories = ["no-std"]
readme = "README.md"
keywords = ["optimize", "compile", "compiler", "jit"]
edition = "2018"
edition = "2021"
[dependencies]
cranelift-codegen = { path = "../codegen", version = "0.83.0", default-features = false }

View File

@@ -7,7 +7,7 @@ license = "Apache-2.0 WITH LLVM-exception"
documentation = "https://docs.rs/cranelift-reader"
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2018"
edition = "2021"
[dependencies]
cranelift-codegen = { path = "../codegen", version = "0.83.0" }

View File

@@ -7,7 +7,7 @@ repository = "https://github.com/bytecodealliance/wasmtime"
license = "Apache-2.0 WITH LLVM-exception"
readme = "README.md"
keywords = ["webassembly", "serde"]
edition = "2018"
edition = "2021"
[[bin]]
name = "clif-json"

View File

@@ -9,7 +9,7 @@ repository = "https://github.com/bytecodealliance/wasmtime"
categories = ["no-std"]
readme = "README.md"
keywords = ["compile", "compiler", "jit"]
edition = "2018"
edition = "2021"
[dependencies]
cranelift-codegen = { path = "../codegen", version = "0.83.0", default-features = false }

View File

@@ -9,7 +9,7 @@ license = "Apache-2.0 WITH LLVM-exception"
categories = ["no-std", "wasm"]
readme = "README.md"
keywords = ["webassembly", "wasm"]
edition = "2018"
edition = "2021"
[dependencies]
wasmparser = { version = "0.83.0", default-features = false }

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

View File

@@ -1,7 +1,7 @@
[package]
name = "rust_wasi_markdown_parser"
version = "0.1.0"
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,7 +2,7 @@
name = "example-fib-debug-wasm"
version = "0.0.0"
authors = ["The Wasmtime Project Developers"]
edition = "2018"
edition = "2021"
publish = false
[lib]

View File

@@ -2,7 +2,7 @@
name = "example-tokio-wasm"
version = "0.0.0"
authors = ["The Wasmtime Project Developers"]
edition = "2018"
edition = "2021"
publish = false
[[bin]]

View File

@@ -2,7 +2,7 @@
name = "example-wasi-wasm"
version = "0.0.0"
authors = ["The Wasmtime Project Developers"]
edition = "2018"
edition = "2021"
publish = false
[[bin]]

View File

@@ -2,7 +2,7 @@
name = "wasmtime-fuzz"
version = "0.0.0"
authors = ["The Wasmtime Project Developers"]
edition = "2018"
edition = "2021"
publish = false
[package.metadata]

View File

@@ -111,7 +111,6 @@ mod tests {
move |mut caller: Caller<'_, _>| {
let mem = caller.get_export("memory").unwrap().into_memory().unwrap();
let memory = mem.data(&caller);
use std::convert::TryInto;
i32::from_le_bytes(memory[0..4].try_into().unwrap())
}
});