rust: update to edition 2024

This commit is contained in:
Philipp Schuster
2025-03-23 13:29:23 +01:00
parent 7ff771e641
commit bfe3c6d420
9 changed files with 32 additions and 24 deletions
+2 -2
View File
@@ -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"
+2
View File
@@ -0,0 +1,2 @@
# Temporarily for this commit.
style_edition = "2021"
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "uefi_app"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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" }
+1 -1
View File
@@ -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 {
+16 -14
View File
@@ -8,18 +8,20 @@ pub unsafe fn test() {
info!("Running graphics output protocol test");
let handle =
boot::get_handle_for_protocol::<GraphicsOutput>().expect("missing GraphicsOutput protocol");
let gop = &mut boot::open_protocol::<GraphicsOutput>(
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::<GraphicsOutput>(
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,
+7 -3
View File
@@ -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::<CustomLoadFile2Protocol>().as_ref().unwrap();
let this = unsafe { this.cast::<CustomLoadFile2Protocol>().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