-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
rust: edition 2024 #1586
Conversation
195e139
to
f499281
Compare
4719df1
to
c0a9cd1
Compare
@nicholasbishop I have a never ending back-and-forth between code gen and formatting with these lines and I don't really understand where the root cause is. Using full-text search, I can't find anything. Any idea?
diff --git a/uefi-raw/src/protocol/device_path/device_path_gen.rs b/uefi-raw/src/protocol/device_path/device_path_gen.rs index 9914779c..825a2792 100644 --- a/uefi-raw/src/protocol/device_path/device_path_gen.rs +++ b/uefi-raw/src/protocol/device_path/device_path_gen.rs @@ -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)] diff --git a/uefi/src/proto/device_path/device_path_gen.rs b/uefi/src/proto/device_path/device_path_gen.rs index 915e1ff6..3892524b 100644 --- a/uefi/src/proto/device_path/device_path_gen.rs +++ b/uefi/src/proto/device_path/device_path_gen.rs @@ -15,7 +15,7 @@ use crate::proto::device_path::{ self, DevicePathHeader, DevicePathNode, DeviceSubType, DeviceType, NodeConversionError, }; use crate::proto::network::IpAddress; -use crate::{guid, Guid}; +use crate::{Guid, guid}; use bitflags::bitflags; use core::mem::{size_of, size_of_val}; use core::ptr::addr_of; @@ -3647,10 +3647,10 @@ impl TryFrom<&DevicePathNode> for DevicePathNodeEnum<'_> { /// Build device paths from their component nodes. pub mod build { use super::*; + use crate::CStr16; use crate::proto::device_path::build::{BuildError, BuildNode}; use crate::proto::device_path::{DeviceSubType, DeviceType}; - use crate::CStr16; - use core::mem::{size_of_val, MaybeUninit}; + use core::mem::{MaybeUninit, size_of_val}; /// Device path build nodes for [`DeviceType::END`]. pub mod end { use super::*;
Interesting. I'm not sure why this is happening, but explicitly passing --style-edition=2024
to the rustfmt command in the code generator fixes it:
diff --git a/xtask/src/device_path/util.rs b/xtask/src/device_path/util.rs index 59cdc662..e1b9fe4e 100644 --- a/xtask/src/device_path/util.rs +++ b/xtask/src/device_path/util.rs @@ -16,6 +16,7 @@ pub fn is_doc_attr(attr: &Attribute) -> bool { pub fn rustfmt_string(input: String) -> Result<String> { let mut child = Command::new("rustfmt") .args([ + "--style-edition=2024", "--config", // Convert `#[doc = "..."]` to `///` for readability. "normalize_doc_attributes=true",
It seems as though it's ignoring the config file, but I'm not sure why that would be.
d27f05a
to
99ec999
Compare
Ahh, got it. I deleted rustfmt.toml
again once I set edition = "2024"
in Cargo.toml
. cargo fmt
forwards --edition 2024
to rustfmt
but direct invocations of rustfmt
are not aware of Cargo.toml#edition
of course.
rust: fix unsafe entry attribute
We can delete rustfmt.toml as the style version defaults to the crate's rust edition.
99ec999
to
8161c51
Compare
8161c51
to
086f093
Compare
Are we good to go here, @nicholasbishop?
I'm not sure how to handle the Miri error 🤔
b8f137d
to
d9e1f0a
Compare
d9e1f0a
to
6eac8c1
Compare
Oh interesting, miri error might be unrelated to this PR, also happens here: https://github.com/rust-osdev/uefi-rs/actions/runs/15084802709/job/42405995121
Update: context rust-lang/miri#4323
Closes #1584
Checklist