diff --git a/Cargo.toml b/Cargo.toml index e5b05cf4..9d1aeb41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 00000000..a22f268f --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,2 @@ +# Temporarily for this commit. +style_edition = "2021" diff --git a/template/Cargo.toml b/template/Cargo.toml index 9ed10f05..87a237b0 100644 --- a/template/Cargo.toml +++ b/template/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "uefi_app" version = "0.1.0" -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/uefi-raw/Cargo.toml b/uefi-raw/Cargo.toml index d8d80692..b77b5530 100644 --- a/uefi-raw/Cargo.toml +++ b/uefi-raw/Cargo.toml @@ -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 diff --git a/uefi-std-example/Cargo.toml b/uefi-std-example/Cargo.toml index 5a2e3e29..9ec083c3 100644 --- a/uefi-std-example/Cargo.toml +++ b/uefi-std-example/Cargo.toml @@ -3,7 +3,7 @@ name = "uefi-std-example" version = "0.1.0" authors = ["The Rust OSDev team"] publish = false -edition = "2021" +edition = "2024" [dependencies] # Attention: Don't activate the panic_handler feature, as it will clash with diff --git a/uefi-test-runner/Cargo.toml b/uefi-test-runner/Cargo.toml index f5240677..d608362a 100644 --- a/uefi-test-runner/Cargo.toml +++ b/uefi-test-runner/Cargo.toml @@ -3,7 +3,7 @@ name = "uefi-test-runner" version = "0.2.0" authors = ["The Rust OSDev team"] publish = false -edition = "2021" +edition = "2024" [dependencies] uefi-raw = { path = "../uefi-raw" } diff --git a/uefi-test-runner/examples/sierpinski.rs b/uefi-test-runner/examples/sierpinski.rs index 92a7b745..b4514c47 100644 --- a/uefi-test-runner/examples/sierpinski.rs +++ b/uefi-test-runner/examples/sierpinski.rs @@ -11,7 +11,7 @@ use alloc::vec::Vec; use uefi::prelude::*; use uefi::proto::console::gop::{BltOp, BltPixel, BltRegion, GraphicsOutput}; use uefi::proto::rng::Rng; -use uefi::{boot, Result}; +use uefi::{Result, boot}; #[derive(Clone, Copy)] struct Point { diff --git a/uefi-test-runner/src/proto/console/gop.rs b/uefi-test-runner/src/proto/console/gop.rs index 6e490cec..db42ddfa 100644 --- a/uefi-test-runner/src/proto/console/gop.rs +++ b/uefi-test-runner/src/proto/console/gop.rs @@ -8,18 +8,20 @@ pub unsafe fn test() { info!("Running graphics output protocol test"); let handle = boot::get_handle_for_protocol::().expect("missing GraphicsOutput protocol"); - let gop = &mut boot::open_protocol::( - OpenProtocolParams { - handle, - agent: boot::image_handle(), - controller: None, - }, - // For this test, don't open in exclusive mode. That - // would break the connection between stdout and the - // video console. - OpenProtocolAttributes::GetProtocol, - ) - .expect("failed to open Graphics Output Protocol"); + let gop = unsafe { + &mut boot::open_protocol::( + OpenProtocolParams { + handle, + agent: boot::image_handle(), + controller: None, + }, + // For this test, don't open in exclusive mode. That + // would break the connection between stdout and the + // video console. + OpenProtocolAttributes::GetProtocol, + ) + .expect("failed to open Graphics Output Protocol") + }; set_graphics_mode(gop); fill_color(gop); @@ -73,10 +75,10 @@ fn draw_fb(gop: &mut GraphicsOutput) { type PixelWriter = unsafe fn(&mut FrameBuffer, usize, [u8; 3]); unsafe fn write_pixel_rgb(fb: &mut FrameBuffer, pixel_base: usize, rgb: [u8; 3]) { - fb.write_value(pixel_base, rgb); + unsafe { fb.write_value(pixel_base, rgb) } } unsafe fn write_pixel_bgr(fb: &mut FrameBuffer, pixel_base: usize, rgb: [u8; 3]) { - fb.write_value(pixel_base, [rgb[2], rgb[1], rgb[0]]); + unsafe { fb.write_value(pixel_base, [rgb[2], rgb[1], rgb[0]]) } } let write_pixel: PixelWriter = match mi.pixel_format() { PixelFormat::Rgb => write_pixel_rgb, diff --git a/uefi-test-runner/src/proto/load.rs b/uefi-test-runner/src/proto/load.rs index 176025ad..c025239f 100644 --- a/uefi-test-runner/src/proto/load.rs +++ b/uefi-test-runner/src/proto/load.rs @@ -23,7 +23,7 @@ unsafe extern "efiapi" fn raw_load_file( buffer: *mut c_void, ) -> Status { log::debug!("Called static extern \"efiapi\" `raw_load_file` glue function"); - let this = this.cast::().as_ref().unwrap(); + let this = unsafe { this.cast::().as_ref().unwrap() }; this.load_file(buffer_size, buffer.cast()) } @@ -60,11 +60,15 @@ impl CustomLoadFile2Protocol { } unsafe fn install_protocol(handle: Handle, guid: Guid, protocol: &mut CustomLoadFile2Protocol) { - boot::install_protocol_interface(Some(handle), &guid, addr_of!(*protocol).cast()).unwrap(); + unsafe { + boot::install_protocol_interface(Some(handle), &guid, addr_of!(*protocol).cast()).unwrap(); + } } unsafe fn uninstall_protocol(handle: Handle, guid: Guid, protocol: &mut CustomLoadFile2Protocol) { - boot::uninstall_protocol_interface(handle, &guid, addr_of!(*protocol).cast()).unwrap(); + unsafe { + boot::uninstall_protocol_interface(handle, &guid, addr_of!(*protocol).cast()).unwrap(); + } } /// This tests the LoadFile and LoadFile2 protocols. As this protocol is not