Skip to content

Commit cd14df5

Browse files
committed
rust: update to edition 2024
1 parent 36af958 commit cd14df5

File tree

9 files changed

+32
-24
lines changed

9 files changed

+32
-24
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ members = [
1313
[workspace.package]
1414
authors = ["The Rust OSDev team"]
1515
categories = ["embedded", "no-std", "api-bindings"]
16-
edition = "2021"
16+
edition = "2024"
1717
keywords = ["uefi", "efi"]
1818
license = "MIT OR Apache-2.0"
1919
repository = "https://github.com/rust-osdev/uefi-rs"
20-
rust-version = "1.81"
20+
rust-version = "1.85.1"
2121

2222
[workspace.dependencies]
2323
bitflags = "2.0.0"

rustfmt.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Temporarily for this commit.
2+
style_edition = "2021"

template/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "uefi_app"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55
publish = false
66

77
[dependencies]

uefi-raw/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ license.workspace = true
1616
repository.workspace = true
1717
# uefi-raw is much less likely to need the latest bleeding-edge features.
1818
# Hence, it is okay to not use the workspace MSRV.
19-
rust-version = "1.77"
19+
rust-version = "1.85.1"
2020

2121
[dependencies]
2222
bitflags.workspace = true

uefi-std-example/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "uefi-std-example"
33
version = "0.1.0"
44
authors = ["The Rust OSDev team"]
55
publish = false
6-
edition = "2021"
6+
edition = "2024"
77

88
[dependencies]
99
# Attention: Don't activate the panic_handler feature, as it will clash with

uefi-test-runner/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "uefi-test-runner"
33
version = "0.2.0"
44
authors = ["The Rust OSDev team"]
55
publish = false
6-
edition = "2021"
6+
edition = "2024"
77

88
[dependencies]
99
uefi-raw = { path = "../uefi-raw" }

uefi-test-runner/examples/sierpinski.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use alloc::vec::Vec;
1111
use uefi::prelude::*;
1212
use uefi::proto::console::gop::{BltOp, BltPixel, BltRegion, GraphicsOutput};
1313
use uefi::proto::rng::Rng;
14-
use uefi::{boot, Result};
14+
use uefi::{Result, boot};
1515

1616
#[derive(Clone, Copy)]
1717
struct Point {

uefi-test-runner/src/proto/console/gop.rs

+16-14
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,20 @@ pub unsafe fn test() {
88
info!("Running graphics output protocol test");
99
let handle =
1010
boot::get_handle_for_protocol::<GraphicsOutput>().expect("missing GraphicsOutput protocol");
11-
let gop = &mut boot::open_protocol::<GraphicsOutput>(
12-
OpenProtocolParams {
13-
handle,
14-
agent: boot::image_handle(),
15-
controller: None,
16-
},
17-
// For this test, don't open in exclusive mode. That
18-
// would break the connection between stdout and the
19-
// video console.
20-
OpenProtocolAttributes::GetProtocol,
21-
)
22-
.expect("failed to open Graphics Output Protocol");
11+
let gop = unsafe {
12+
&mut boot::open_protocol::<GraphicsOutput>(
13+
OpenProtocolParams {
14+
handle,
15+
agent: boot::image_handle(),
16+
controller: None,
17+
},
18+
// For this test, don't open in exclusive mode. That
19+
// would break the connection between stdout and the
20+
// video console.
21+
OpenProtocolAttributes::GetProtocol,
22+
)
23+
.expect("failed to open Graphics Output Protocol")
24+
};
2325

2426
set_graphics_mode(gop);
2527
fill_color(gop);
@@ -73,10 +75,10 @@ fn draw_fb(gop: &mut GraphicsOutput) {
7375

7476
type PixelWriter = unsafe fn(&mut FrameBuffer, usize, [u8; 3]);
7577
unsafe fn write_pixel_rgb(fb: &mut FrameBuffer, pixel_base: usize, rgb: [u8; 3]) {
76-
fb.write_value(pixel_base, rgb);
78+
unsafe { fb.write_value(pixel_base, rgb) }
7779
}
7880
unsafe fn write_pixel_bgr(fb: &mut FrameBuffer, pixel_base: usize, rgb: [u8; 3]) {
79-
fb.write_value(pixel_base, [rgb[2], rgb[1], rgb[0]]);
81+
unsafe { fb.write_value(pixel_base, [rgb[2], rgb[1], rgb[0]]) }
8082
}
8183
let write_pixel: PixelWriter = match mi.pixel_format() {
8284
PixelFormat::Rgb => write_pixel_rgb,

uefi-test-runner/src/proto/load.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ unsafe extern "efiapi" fn raw_load_file(
2323
buffer: *mut c_void,
2424
) -> Status {
2525
log::debug!("Called static extern \"efiapi\" `raw_load_file` glue function");
26-
let this = this.cast::<CustomLoadFile2Protocol>().as_ref().unwrap();
26+
let this = unsafe { this.cast::<CustomLoadFile2Protocol>().as_ref().unwrap() };
2727
this.load_file(buffer_size, buffer.cast())
2828
}
2929

@@ -60,11 +60,15 @@ impl CustomLoadFile2Protocol {
6060
}
6161

6262
unsafe fn install_protocol(handle: Handle, guid: Guid, protocol: &mut CustomLoadFile2Protocol) {
63-
boot::install_protocol_interface(Some(handle), &guid, addr_of!(*protocol).cast()).unwrap();
63+
unsafe {
64+
boot::install_protocol_interface(Some(handle), &guid, addr_of!(*protocol).cast()).unwrap();
65+
}
6466
}
6567

6668
unsafe fn uninstall_protocol(handle: Handle, guid: Guid, protocol: &mut CustomLoadFile2Protocol) {
67-
boot::uninstall_protocol_interface(handle, &guid, addr_of!(*protocol).cast()).unwrap();
69+
unsafe {
70+
boot::uninstall_protocol_interface(handle, &guid, addr_of!(*protocol).cast()).unwrap();
71+
}
6872
}
6973

7074
/// This tests the LoadFile and LoadFile2 protocols. As this protocol is not

0 commit comments

Comments
 (0)