build: migrate to Rust 2021 edition

Rust 2021 edition has a few improvements over the 2018 edition. Migrate
the project to 2021 edition by following recommended migration steps.
Luckily, the code itself doesn't require fixing.

Bump MSRV to 1.56 as it is required by the 2021 edition. Also fix the
clap build dependency to make Cloud Hypervisor build again.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2022-04-08 15:11:04 +00:00 committed by Rob Bradford
parent 298a5580a9
commit 7d7bfb2034
29 changed files with 31 additions and 31 deletions

View File

@ -13,7 +13,7 @@ jobs:
- stable
- beta
- nightly
- 1.54
- 1.56
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl

View File

@ -1 +1 @@
edition = "2018"
edition = "2021"

View File

@ -2,7 +2,7 @@
name = "cloud-hypervisor"
version = "22.0.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
default-run = "cloud-hypervisor"
build = "build.rs"
license = "LICENSE-APACHE & LICENSE-BSD-3-Clause"
@ -10,7 +10,7 @@ description = "Open source Virtual Machine Monitor (VMM) that runs on top of KVM
homepage = "https://github.com/cloud-hypervisor/cloud-hypervisor"
# Minimum buildable version:
# Keep in sync with version in .github/workflows/build.yaml
rust-version = "1.54"
rust-version = "1.56"
[profile.release]
lto = true
@ -34,7 +34,7 @@ vmm-sys-util = "0.9.0"
vm-memory = "0.7.0"
[build-dependencies]
clap = { version = "3.1.8", features = ["wrap_help"] }
clap = { version = "3.1.8", features = ["cargo"] }
# List of patched crates
[patch.crates-io]

View File

@ -2,7 +2,7 @@
name = "acpi_tables"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
[dependencies]
vm-memory = "0.7.0"

View File

@ -2,7 +2,7 @@
name = "api_client"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
[dependencies]
vmm-sys-util = "0.9.0"

View File

@ -2,7 +2,7 @@
name = "arch"
version = "0.1.0"
authors = ["The Chromium OS Authors"]
edition = "2018"
edition = "2021"
[features]
default = []

View File

@ -2,7 +2,7 @@
name = "block_util"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
[features]
default = []

View File

@ -2,7 +2,7 @@
name = "devices"
version = "0.1.0"
authors = ["The Chromium OS Authors"]
edition = "2018"
edition = "2021"
[dependencies]
acpi_tables = { path = "../acpi_tables" }

View File

@ -2,7 +2,7 @@
name = "event_monitor"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
[dependencies]
libc = "0.2.122"

View File

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

View File

@ -2,7 +2,7 @@
name = "hypervisor"
version = "0.1.0"
authors = ["Microsoft Authors"]
edition = "2018"
edition = "2021"
license = "Apache-2.0 OR BSD-3-Clause"
[features]

View File

@ -2,7 +2,7 @@
name = "net_gen"
version = "0.1.0"
authors = ["The Chromium OS Authors"]
edition = "2018"
edition = "2021"
[dependencies]
vmm-sys-util = "0.9.0"

View File

@ -2,7 +2,7 @@
name = "net_util"
version = "0.1.0"
authors = ["The Chromium OS Authors"]
edition = "2018"
edition = "2021"
[dependencies]
epoll = "4.3.1"

View File

@ -2,4 +2,4 @@
name = "option_parser"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"

View File

@ -2,7 +2,7 @@
name = "pci"
version = "0.1.0"
authors = ["Samuel Ortiz <sameo@linux.intel.com>"]
edition = "2018"
edition = "2021"
[features]
default = []

View File

@ -2,7 +2,7 @@
name = "performance-metrics"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
build = "build.rs"
[dependencies]

View File

@ -2,7 +2,7 @@
name = "qcow"
version = "0.1.0"
authors = ["The Chromium OS Authors"]
edition = "2018"
edition = "2021"
license = "BSD-3-Clause"
[lib]

View File

@ -1,7 +1,7 @@
[package]
name = "rate_limiter"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]
libc = "0.2.122"

View File

@ -2,7 +2,7 @@
name = "test_infra"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
[dependencies]
dirs = "4.0.0"

View File

@ -2,7 +2,7 @@
name = "vfio_user"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
[dependencies]
anyhow = "1.0.56"

View File

@ -2,7 +2,7 @@
name = "vhdx"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
license = "Apache-2.0"
[dependencies]

View File

@ -2,7 +2,7 @@
name = "vhost_user_block"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
[dependencies]
block_util = { path = "../block_util" }

View File

@ -2,7 +2,7 @@
name = "vhost_user_net"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
[dependencies]
clap = { version = "3.1.8", features = ["wrap_help"] }

View File

@ -2,7 +2,7 @@
name = "virtio-devices"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
[features]
default = []

View File

@ -2,7 +2,7 @@
name = "vm-allocator"
version = "0.1.0"
authors = ["The Chromium OS Authors"]
edition = "2018"
edition = "2021"
[dependencies]
libc = "0.2.122"

View File

@ -2,7 +2,7 @@
name = "vm-device"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
[features]
default = []

View File

@ -2,7 +2,7 @@
name = "vm-migration"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
[dependencies]
anyhow = "1.0.56"

View File

@ -2,7 +2,7 @@
name = "vm-virtio"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
[features]
default = []

View File

@ -2,7 +2,7 @@
name = "vmm"
version = "0.1.0"
authors = ["The Cloud Hypervisor Authors"]
edition = "2018"
edition = "2021"
[features]
default = []