From 2a3439fba03a4f3606a53e44339a484fde9cd35e Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Sat, 25 Feb 2023 17:36:11 -0500 Subject: [PATCH] Change toolchain from nightly to stable As of Rust 1.68, the uefi crates work on stable. Remove the `channel = "nightly"` setting from `rust-toolchain.toml` and `template/rust-toolchain.toml`. Related changes: * The CI job to compile with the MSRV has been changed from `nightly-2022-11-22` to `1.68`. So for now the MSRV job isn't checking anything that isn't already checked by other jobs, but once 1.69 comes out it will. * The CI job to test the latest crates.io release still needs the nightly toolchain until we do a new release. * Some of the uefi-macros compiler ui tests have been modified so that the error output matches the errors produced by stable compiler, which are currently slightly different in a few cases from the nightly compiler. In particular, the precise spans we output for errors in the guid macros don't work on stable, because proc-macro's Literal::subspan method is currently unstable. --- .github/workflows/msrv_toolchain.toml | 3 +-- .github/workflows/rust.yml | 9 +++++++++ rust-toolchain.toml | 1 - template/rust-toolchain.toml | 1 - uefi-macros/tests/ui/entry_bad_abi.stderr | 2 +- uefi-macros/tests/ui/entry_bad_return_type.stderr | 2 +- uefi-macros/tests/ui/guid_bad_hex_group2.stderr | 4 ++-- uefi-macros/tests/ui/guid_bad_hex_group5.stderr | 4 ++-- xtask/src/main.rs | 5 ++--- 9 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/msrv_toolchain.toml b/.github/workflows/msrv_toolchain.toml index f373655e..dc91b462 100644 --- a/.github/workflows/msrv_toolchain.toml +++ b/.github/workflows/msrv_toolchain.toml @@ -1,4 +1,3 @@ [toolchain] -# Oldest nightly that currently works with `cargo xtask build`. -channel = "nightly-2022-11-22" +channel = "1.68" targets = ["aarch64-unknown-uefi", "i686-unknown-uefi", "x86_64-unknown-uefi"] diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5387dcd2..f5b8df1e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -108,6 +108,10 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 + # TODO: for now our latest release (0.19.1) requires nightly. + - name: Set nightly toolchain + run: cp .github/workflows/nightly_toolchain.toml rust-toolchain.toml + - name: Build run: cargo xtask test-latest-release @@ -143,6 +147,8 @@ jobs: - name: Build run: cargo xtask build + # This job requires the nightly channel, but keep it as a separate job from + # `nightly_channel` because it takes a while to run. build_feature_permutations: name: Check that the build works for all feature combinations runs-on: ubuntu-latest @@ -150,6 +156,9 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 + - name: Set nightly toolchain so that `unstable` can be included + run: cp .github/workflows/nightly_toolchain.toml rust-toolchain.toml + - name: Build run: cargo xtask build --feature-permutations diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a96790bb..e756ee7e 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,2 @@ [toolchain] -channel = "nightly" targets = ["aarch64-unknown-uefi", "i686-unknown-uefi", "x86_64-unknown-uefi"] diff --git a/template/rust-toolchain.toml b/template/rust-toolchain.toml index a96790bb..e756ee7e 100644 --- a/template/rust-toolchain.toml +++ b/template/rust-toolchain.toml @@ -1,3 +1,2 @@ [toolchain] -channel = "nightly" targets = ["aarch64-unknown-uefi", "i686-unknown-uefi", "x86_64-unknown-uefi"] diff --git a/uefi-macros/tests/ui/entry_bad_abi.stderr b/uefi-macros/tests/ui/entry_bad_abi.stderr index da602d66..a40d65a8 100644 --- a/uefi-macros/tests/ui/entry_bad_abi.stderr +++ b/uefi-macros/tests/ui/entry_bad_abi.stderr @@ -2,4 +2,4 @@ error: Entry method must have no ABI modifier --> tests/ui/entry_bad_abi.rs:8:1 | 8 | extern "C" fn main(_handle: Handle, _st: SystemTable) -> Status { - | ^^^^^^^^^^ + | ^^^^^^ diff --git a/uefi-macros/tests/ui/entry_bad_return_type.stderr b/uefi-macros/tests/ui/entry_bad_return_type.stderr index 3cb1206b..9a1bf88c 100644 --- a/uefi-macros/tests/ui/entry_bad_return_type.stderr +++ b/uefi-macros/tests/ui/entry_bad_return_type.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> tests/ui/entry_bad_return_type.rs:8:1 | 8 | fn main(_handle: Handle, _st: SystemTable) -> bool { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Status`, found `bool` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Status`, found `bool` | = note: expected fn pointer `extern "efiapi" fn(uefi::Handle, uefi::table::SystemTable<_>) -> Status` found fn pointer `extern "efiapi" fn(uefi::Handle, uefi::table::SystemTable<_>) -> bool` diff --git a/uefi-macros/tests/ui/guid_bad_hex_group2.stderr b/uefi-macros/tests/ui/guid_bad_hex_group2.stderr index 4daacf76..ca59b447 100644 --- a/uefi-macros/tests/ui/guid_bad_hex_group2.stderr +++ b/uefi-macros/tests/ui/guid_bad_hex_group2.stderr @@ -1,5 +1,5 @@ error: GUID component "Gaaa" is not a hexadecimal number - --> tests/ui/guid_bad_hex_group2.rs:5:44 + --> tests/ui/guid_bad_hex_group2.rs:5:34 | 5 | const BadHexGroup2: Guid = guid!("aaaaaaaa-Gaaa-aaaa-aaaa-aaaaaaaaaaaa"); - | ^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/uefi-macros/tests/ui/guid_bad_hex_group5.stderr b/uefi-macros/tests/ui/guid_bad_hex_group5.stderr index bac7fc80..36ba8343 100644 --- a/uefi-macros/tests/ui/guid_bad_hex_group5.stderr +++ b/uefi-macros/tests/ui/guid_bad_hex_group5.stderr @@ -1,5 +1,5 @@ error: GUID component "aaaaaaaaaaaG" is not a hexadecimal number - --> tests/ui/guid_bad_hex_group5.rs:5:59 + --> tests/ui/guid_bad_hex_group5.rs:5:34 | 5 | const BadHexGroup5: Guid = guid!("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaG"); - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 217526f5..cd647c8b 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -50,7 +50,7 @@ fn build(opt: &BuildOpt) -> Result<()> { let cargo = Cargo { action: CargoAction::Build, - features: Feature::more_code(true, true), + features: Feature::more_code(false, true), packages: Package::all_except_xtask(), release: opt.build_mode.release, target: Some(*opt.target), @@ -64,8 +64,7 @@ fn clippy(opt: &ClippyOpt) -> Result<()> { // Run clippy on all the UEFI packages. let cargo = Cargo { action: CargoAction::Clippy, - // for all possible features - features: Feature::more_code(true, true), + features: Feature::more_code(false, true), packages: Package::all_except_xtask(), release: false, target: Some(*opt.target),