Skip to content

rust: edition 2024 #1586

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ members = [
[workspace.package]
authors = ["The Rust OSDev team"]
categories = ["embedded", "no-std", "api-bindings"]
edition = "2021"
edition = "2024"
keywords = ["uefi", "efi"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-osdev/uefi-rs"
rust-version = "1.81"
rust-version = "1.85.1"

[workspace.dependencies]
bitflags = "2.0.0"
Expand Down
8 changes: 8 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# We keep this file explicitley to ensure that direct invocations of `rustfmt`
# also use the proper style edition. Unlike `cargo fmt`, which forwards the
# Rust edition specified in Cargo.toml to `rustfmt`, `rustfmt` still defaults to
# the 2021 edition and is unaware of `Cargo.toml`.
#
# We use a direct invocation of `rustfmt` in our device path generation code.

style_edition = "2024"
2 changes: 1 addition & 1 deletion template/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "uefi_app"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false

[dependencies]
Expand Down
3 changes: 3 additions & 0 deletions uefi-macros/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# uefi-macros - [Unreleased]

## Changed

- **Breaking:** The MSRV is now 1.85.1 and the crate uses the Rust 2024 edition.

# uefi-macros - 0.18.1 (2025-05-04)

Expand Down
19 changes: 8 additions & 11 deletions uefi-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ extern crate proc_macro;
use proc_macro::TokenStream;

use proc_macro2::TokenStream as TokenStream2;
use quote::{quote, quote_spanned, TokenStreamExt};
use quote::{TokenStreamExt, quote, quote_spanned};
use syn::spanned::Spanned;
use syn::{
parse_macro_input, parse_quote, parse_quote_spanned, Error, Expr, ExprLit, ExprPath, ItemFn,
ItemStruct, Lit, Visibility,
Error, Expr, ExprLit, ExprPath, ItemFn, ItemStruct, Lit, Visibility, parse_macro_input,
parse_quote, parse_quote_spanned,
};

macro_rules! err {
Expand Down Expand Up @@ -69,13 +69,10 @@ pub fn unsafe_protocol(args: TokenStream, input: TokenStream) -> TokenStream {
quote!(::uefi::guid!(#lit))
}
Expr::Path(ExprPath { path, .. }) => quote!(#path),
_ => {
return err!(
expr,
"macro input must be either a string literal or path to a constant"
)
.into()
}
_ => err!(
expr,
"macro input must be either a string literal or path to a constant"
),
};

let item_struct = parse_macro_input!(input as ItemStruct);
Expand Down Expand Up @@ -215,7 +212,7 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream {
let result = quote! {
#fn_type_check

#[export_name = "efi_main"]
#[unsafe(export_name = "efi_main")]
#f

};
Expand Down
4 changes: 4 additions & 0 deletions uefi-raw/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
- `DevicePathProtocol` now derives
`Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash`

## Changed

- **Breaking:** The MSRV is now 1.85.1 and the crate uses the Rust 2024 edition.


# uefi-raw - 0.10.0 (2025-02-07)

Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ license.workspace = true
repository.workspace = true
# uefi-raw is much less likely to need the latest bleeding-edge features.
# Hence, it is okay to not use the workspace MSRV.
rust-version = "1.77"
rust-version = "1.85.1"

[dependencies]
bitflags.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub mod time;
mod status;

pub use status::Status;
pub use uguid::{guid, Guid};
pub use uguid::{Guid, guid};

use core::ffi::c_void;
use core::fmt::{self, Debug, Formatter};
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/ata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use super::device_path::DevicePathProtocol;
use crate::{Event, Status};
use core::ffi::c_void;
use uguid::{guid, Guid};
use uguid::{Guid, guid};

bitflags::bitflags! {
/// ATA Controller attributes.
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/block.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::{guid, Boolean, Guid, Status};
use crate::{Boolean, Guid, Status, guid};
use core::ffi::c_void;

/// Logical block address.
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pub mod serial;

use crate::{guid, Boolean, Char16, Event, Guid, PhysicalAddress, Status};
use crate::{Boolean, Char16, Event, Guid, PhysicalAddress, Status, guid};
use bitflags::bitflags;
use core::ptr;

Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/console/serial.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::{guid, Guid, Status};
use crate::{Guid, Status, guid};
use bitflags::bitflags;

bitflags! {
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/device_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

mod device_path_gen;

use crate::{guid, Boolean, Char16, Guid};
use crate::{Boolean, Char16, Guid, guid};

pub use device_path_gen::{acpi, bios_boot_spec, end, hardware, media, messaging};

Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/device_path/device_path_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#![allow(missing_debug_implementations)]
use crate::protocol::device_path;
use crate::table::boot::MemoryType;
use crate::{guid, Guid, IpAddress};
use crate::{Guid, IpAddress, guid};
use bitflags::bitflags;
use device_path::DevicePathProtocol as DevicePathHeader;
#[cfg(doc)]
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/disk.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::{guid, Event, Guid, Status};
use crate::{Event, Guid, Status, guid};
use core::ffi::c_void;

#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/driver.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::protocol::device_path::DevicePathProtocol;
use crate::{guid, Guid, Handle, Status};
use crate::{Guid, Handle, Status, guid};

#[derive(Debug)]
#[repr(C)]
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/file_system.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::time::Time;
use crate::{guid, Boolean, Char16, Event, Guid, Status};
use crate::{Boolean, Char16, Event, Guid, Status, guid};
use bitflags::bitflags;
use core::ffi::c_void;

Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/firmware_volume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::firmware_storage::FirmwareVolumeAttributes;
use crate::protocol::block::Lba;
use crate::{guid, Guid, Handle, PhysicalAddress, Status};
use crate::{Guid, Handle, PhysicalAddress, Status, guid};
use core::ffi::c_void;
use core::ops::RangeInclusive;

Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/hii/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Bindings for HII Database Protocol
use super::{HiiHandle, HiiPackageHeader, HiiPackageListHeader, KeyDescriptor};
use crate::{guid, Guid, Handle, Status};
use crate::{Guid, Handle, Status, guid};

/// EFI_HII_KEYBOARD_LAYOUT
#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/loaded_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::protocol::device_path::DevicePathProtocol;
use crate::table::boot::MemoryType;
use crate::table::system::SystemTable;
use crate::{guid, Guid, Handle, Status};
use crate::{Guid, Handle, Status, guid};
use core::ffi::c_void;

#[derive(Clone, Copy, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/media.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::protocol::device_path::DevicePathProtocol;
use crate::{guid, Boolean, Guid, Status};
use crate::{Boolean, Guid, Status, guid};
use core::ffi::c_void;

#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/memory_protection.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::table::boot::MemoryAttribute;
use crate::{guid, Guid, PhysicalAddress, Status};
use crate::{Guid, PhysicalAddress, Status, guid};

#[derive(Debug)]
#[repr(C)]
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/misc.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::table::runtime;
use crate::{guid, Guid, Status};
use crate::{Guid, Status, guid};

#[derive(Debug)]
#[repr(C)]
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/network/dhcp4.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::{guid, Boolean, Char8, Event, Guid, Ipv4Address, MacAddress, Status};
use crate::{Boolean, Char8, Event, Guid, Ipv4Address, MacAddress, Status, guid};
use core::ffi::c_void;

newtype_enum! {
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/network/http.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::{guid, Boolean, Char16, Char8, Event, Guid, Ipv4Address, Ipv6Address, Status};
use crate::{Boolean, Char8, Char16, Event, Guid, Ipv4Address, Ipv6Address, Status, guid};
use core::ffi::c_void;
use core::fmt::{self, Debug, Formatter};
use core::ptr;
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/network/ip4_config2.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::protocol::network::ip4::Ip4RouteTable;
use crate::{guid, Char16, Event, Guid, Ipv4Address, MacAddress, Status};
use crate::{Char16, Event, Guid, Ipv4Address, MacAddress, Status, guid};
use core::ffi::c_void;

newtype_enum! {
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/network/pxe.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::{guid, Boolean, Char8, Guid, IpAddress, MacAddress, Status};
use crate::{Boolean, Char8, Guid, IpAddress, MacAddress, Status, guid};
use bitflags::bitflags;
use core::ffi::c_void;
use core::fmt::{self, Debug, Formatter};
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/network/snp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use core::ffi;

use bitflags::bitflags;

use crate::{guid, Boolean, Event, Guid, IpAddress, MacAddress, Status};
use crate::{Boolean, Event, Guid, IpAddress, MacAddress, Status, guid};

#[derive(Debug)]
#[repr(C)]
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/network/tls.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::{guid, Guid, Status};
use crate::{Guid, Status, guid};
use core::ffi::c_void;

newtype_enum! {
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/nvme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use super::device_path::DevicePathProtocol;
use crate::Status;
use core::ffi::c_void;
use uguid::{guid, Guid};
use uguid::{Guid, guid};

bitflags::bitflags! {
/// In an NVMe command, the `flags` field specifies which cdw (command specific word)
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/rng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

//! `Rng` protocol.
use crate::{guid, Guid, Status};
use crate::{Guid, Status, guid};

newtype_enum! {
/// The algorithms listed are optional, not meant to be exhaustive
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/scsi.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use super::device_path::DevicePathProtocol;
use crate::{guid, Event, Guid, Status};
use crate::{Event, Guid, Status, guid};
use core::ffi::c_void;

pub const SCSI_TARGET_MAX_BYTES: usize = 0x10;
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/shell_params.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::{guid, Char16, Guid};
use crate::{Char16, Guid, guid};
use core::ffi::c_void;

pub type ShellFileHandle = *const c_void;
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/string.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::{guid, Char16, Char8, Guid};
use crate::{Char8, Char16, Guid, guid};

#[derive(Debug)]
#[repr(C)]
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/tcg/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! [TCG]: https://trustedcomputinggroup.org/
//! [TPM]: https://en.wikipedia.org/wiki/Trusted_Platform_Module
use crate::{guid, Guid, PhysicalAddress, Status};
use crate::{Guid, PhysicalAddress, Status, guid};
use core::ffi::c_void;

/// Information about the protocol and the TPM device.
Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/tcg/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//! [TPM]: https://en.wikipedia.org/wiki/Trusted_Platform_Module
use super::EventType;
use crate::{guid, Guid, PhysicalAddress, Status};
use crate::{Guid, PhysicalAddress, Status, guid};
use bitflags::bitflags;
use core::ffi::c_void;

Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/usb/host_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use core::ffi;

use bitflags::bitflags;

use crate::{guid, Boolean, Guid, Status};
use crate::{Boolean, Guid, Status, guid};

use super::{AsyncUsbTransferCallback, DataDirection, DeviceRequest, UsbTransferStatus};

Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/protocol/usb/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use core::ffi;

use crate::{guid, Boolean, Char16, Guid, Status};
use crate::{Boolean, Char16, Guid, Status, guid};

use super::{
AsyncUsbTransferCallback, ConfigDescriptor, DataDirection, DeviceDescriptor, DeviceRequest,
Expand Down
4 changes: 2 additions & 2 deletions uefi-raw/src/table/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
//! UEFI services available at runtime, even after the OS boots.
use crate::capsule::CapsuleHeader;
use crate::table::boot::MemoryDescriptor;
use crate::table::Header;
use crate::table::boot::MemoryDescriptor;
use crate::time::Time;
use crate::{guid, Boolean, Char16, Guid, PhysicalAddress, Status};
use crate::{Boolean, Char16, Guid, PhysicalAddress, Status, guid};
use bitflags::bitflags;
use core::ffi::c_void;

Expand Down
2 changes: 1 addition & 1 deletion uefi-raw/src/table/system.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::protocol::console::{SimpleTextInputProtocol, SimpleTextOutputProtocol};
use crate::table::Header;
use crate::table::boot::BootServices;
use crate::table::configuration::ConfigurationTable;
use crate::table::runtime::RuntimeServices;
use crate::table::Header;
use crate::{Char16, Handle};
use core::mem::size_of;
use core::ptr;
Expand Down
Loading
Loading