Skip to content

Switch to the stable channel 🎉 #688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/msrv_toolchain.toml
Original file line number Diff line number Diff line change
@@ -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"]
9 changes: 9 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -143,13 +147,18 @@ 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
steps:
- 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

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## uefi - [Unreleased]

As of this release, the UEFI crates work on the stable channel. This requires
Rust 1.68 or higher.

### Added

- Added the `ComponentName1` and `ComponentName2` protocols. The `ComponentName`
Expand Down
4 changes: 1 addition & 3 deletions book/src/tutorial/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ This is some boilerplate that all Rust UEFI applications will
need. `no_main` is needed because the UEFI application entry point is
different from the standard Rust `main` function. `no_std` is needed to
turn off the `std` library; the `core` and `alloc` crates can still be
used. And `feature(abi_efiapi)` is needed because UEFI applications have
a special calling convention that is not yet stabilized in the Rust
compiler.
used.

Next up are some `use` lines. Nothing too exciting here; the
`uefi::prelude` module is intended to be glob-imported, and exports a
Expand Down
20 changes: 7 additions & 13 deletions book/src/tutorial/building.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
# Building

## Nightly toolchain
## Toolchain

Rust's nightly toolchain is currently required because uefi-rs uses some
unstable features.

The easiest way to set this up is using a [rustup toolchain file]. In
the root of your repository, add `rust-toolchain.toml`:
In order to compile for UEFI, an appropriate target must be installed. The
easiest way to set this up is using a [rustup toolchain file]. In the root of
your repository, add `rust-toolchain.toml`:

```toml
[toolchain]
channel = "nightly"
targets = ["x86_64-unknown-uefi"]
targets = ["aarch64-unknown-uefi", "i686-unknown-uefi", "x86_64-unknown-uefi"]
```

Here we have specified the `x86_64-unknown-uefi` target; there are also
`i686-unknown-uefi` and `aarch64-unknown-uefi` targets available.

Note that nightly releases can sometimes break, so you might opt to pin
to a specific release. For example, `channel = "nightly-2022-11-10"`.
Here we have specified all three of the currently-supported UEFI targets; you
can remove some if you don't need them.

## Build the application

Expand Down
1 change: 0 additions & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[toolchain]
channel = "nightly"
targets = ["aarch64-unknown-uefi", "i686-unknown-uefi", "x86_64-unknown-uefi"]
2 changes: 1 addition & 1 deletion template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ UEFI application developed using `uefi-rs`.

## File structure

- [`rust-toolchain.toml`](rust-toolchain.toml) sets the nightly channel.
- [`rust-toolchain.toml`](rust-toolchain.toml) adds the UEFI targets.
- [`Cargo.toml`](./Cargo.toml) shows the necessary dependencies.
- [`src/main.rs`](./src/main.rs) has a minimal entry point that
initializes the `uefi-services` crate and exits successfully.
Expand Down
1 change: 0 additions & 1 deletion template/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[toolchain]
channel = "nightly"
targets = ["aarch64-unknown-uefi", "i686-unknown-uefi", "x86_64-unknown-uefi"]
2 changes: 0 additions & 2 deletions template/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![no_main]
#![no_std]
#![feature(abi_efiapi)]
#![allow(stable_features)]

use uefi::prelude::*;

Expand Down
1 change: 0 additions & 1 deletion uefi-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ fn get_function_arg_name(f: &ItemFn, arg_index: usize, errors: &mut TokenStream2
///
/// ```no_run
/// #![no_main]
/// #![feature(abi_efiapi)]
///
/// use uefi::prelude::*;
///
Expand Down
2 changes: 1 addition & 1 deletion uefi-macros/tests/ui/entry_bad_abi.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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<Boot>) -> Status {
| ^^^^^^^^^^
| ^^^^^^
2 changes: 1 addition & 1 deletion uefi-macros/tests/ui/entry_bad_return_type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> tests/ui/entry_bad_return_type.rs:8:1
|
8 | fn main(_handle: Handle, _st: SystemTable<Boot>) -> 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`
4 changes: 2 additions & 2 deletions uefi-macros/tests/ui/guid_bad_hex_group2.stderr
Original file line number Diff line number Diff line change
@@ -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");
| ^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 changes: 2 additions & 2 deletions uefi-macros/tests/ui/guid_bad_hex_group5.stderr
Original file line number Diff line number Diff line change
@@ -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");
| ^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 changes: 0 additions & 11 deletions uefi-services/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
//! [`exit_boot_services`]: uefi::table::SystemTable::exit_boot_services

#![no_std]
#![feature(alloc_error_handler)]
#![feature(abi_efiapi)]
#![deny(clippy::must_use_candidate)]
#![allow(stable_features)]

extern crate log;
// Core types.
Expand Down Expand Up @@ -257,11 +254,3 @@ fn panic_handler(info: &core::panic::PanicInfo) -> ! {
}
}
}

#[alloc_error_handler]
fn out_of_memory(layout: ::core::alloc::Layout) -> ! {
panic!(
"Ran out of free memory while trying to allocate {:#?}",
layout
);
}
2 changes: 0 additions & 2 deletions uefi-test-runner/examples/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// ANCHOR: features
#![no_main]
#![no_std]
#![feature(abi_efiapi)]
#![allow(stable_features)]
// ANCHOR_END: features

// ANCHOR: use
Expand Down
2 changes: 0 additions & 2 deletions uefi-test-runner/examples/loaded_image.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// ANCHOR: all
#![no_main]
#![no_std]
#![feature(abi_efiapi)]
#![allow(stable_features)]

use log::info;
use uefi::prelude::*;
Expand Down
2 changes: 0 additions & 2 deletions uefi-test-runner/examples/sierpinski.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// ANCHOR: all
#![no_main]
#![no_std]
#![feature(abi_efiapi)]
#![allow(stable_features)]

extern crate alloc;

Expand Down
2 changes: 0 additions & 2 deletions uefi-test-runner/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![no_std]
#![no_main]
#![feature(abi_efiapi)]
#![allow(stable_features)]

#[macro_use]
extern crate log;
Expand Down
6 changes: 3 additions & 3 deletions uefi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ For additional information, refer to the [UEFI specification][spec].

## MSRV

The uefi-rs crates currently require some [unstable features].
The nightly MSRV is currently 2022-11-22.
The minimum supported Rust version is currently 1.68, which is the first Rust
release that fully supports all necessary features on the stable channel.

[unstable features]: https://github.com/rust-osdev/uefi-rs/issues/452
In the future, our policy will be to support at least the past two stable releases.

## License

Expand Down
8 changes: 1 addition & 7 deletions uefi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@
//! - `panic-on-logger-errors` (enabled by default): Panic if a text
//! output error occurs in the logger.
//! - `unstable`: Enable functionality that depends on [unstable
//! features] in the nightly compiler. Note that currently the `uefi`
//! crate _always_ requires unstable features even if the `unstable`
//! feature is not enabled, but once a couple more required features
//! are stabilized we intend to make the `uefi` crate work on the
//! stable channel by default.
//! features] in the nightly compiler.
//! As example, in conjunction with the `alloc`-feature, this gate allows
//! the `allocator_api` on certain functions.
//!
Expand All @@ -79,7 +75,6 @@
//! [spec]: https://uefi.org/specifications
//! [unstable features]: https://doc.rust-lang.org/unstable-book/

#![feature(abi_efiapi)]
#![cfg_attr(feature = "unstable", feature(error_in_core))]
#![cfg_attr(all(feature = "unstable", feature = "alloc"), feature(allocator_api))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
Expand All @@ -88,7 +83,6 @@
#![warn(clippy::ptr_as_ptr, missing_docs, unused)]
#![deny(clippy::all)]
#![deny(clippy::must_use_candidate)]
#![allow(stable_features)]

#[cfg(feature = "alloc")]
extern crate alloc;
Expand Down
5 changes: 2 additions & 3 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
Expand Down