Skip to content

Commit

Permalink
Upgrade all crates to the Rust 2021 edition (#3991)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
alexcrichton authored Apr 4, 2022
1 parent f18dbe4 commit 7b5176b
Show file tree
Hide file tree
Showing 59 changed files with 60 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cranelift/bforest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/codegen/meta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion cranelift/codegen/shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cranelift/entity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/filetests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/fuzzgen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion cranelift/interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/isle/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cranelift/isle/isle/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cranelift/isle/islec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cranelift/jit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/module/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/object/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/preopt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/reader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/serde/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cranelift/umbrella/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion crates/bench-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion crates/c-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion crates/c-api/macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 4 additions & 0 deletions crates/c-api/src/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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(()),
Expand Down
2 changes: 1 addition & 1 deletion crates/cache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion crates/cache/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion crates/environ/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion crates/fiber/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/fuzzing/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion crates/fuzzing/wasm-spec-interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/jit-debug/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion crates/jit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion crates/misc/run-examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "run-examples"
version = "0.19.0"
authors = ["The Wasmtime Project Developers"]
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion crates/test-programs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion crates/test-programs/wasi-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion crates/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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'] }
Expand Down
2 changes: 1 addition & 1 deletion crates/wasi-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion crates/wasi-common/cap-std-sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading

0 comments on commit 7b5176b

Please sign in to comment.