Skip to content

Commit 761bed9

Browse files
uefi: Add ptr_meta dependency
The `ptr_meta` crate (https://docs.rs/ptr_meta) is a polyfill for the unstable [`ptr_metadata`](rust-lang/rust#81513) feature on stable Rust. This allows us to drop use of an unstable feature with fairly minimal code changes; mostly just adding a derive for the `Pointee` type on some DST structs.
1 parent 1c9f2ef commit 761bed9

File tree

11 files changed

+88
-57
lines changed

11 files changed

+88
-57
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
`impl Iterator` which simplifies usage.
3030
- `GraphicsOutput::modes()` now returns `ModesIter` instead of `impl Iterator`
3131
which simplifies usage.
32+
- Use of the unstable `ptr_metadata` feature has been replaced with a dependency
33+
on the [`ptr_meta`](https://docs.rs/ptr_meta) crate.
3234

3335
### Removed
3436

uefi/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ unstable = []
2525
[dependencies]
2626
bitflags = "1.3.1"
2727
log = { version = "0.4.5", default-features = false }
28+
ptr_meta = { version = "0.2.0", default-features = false }
2829
ucs2 = "0.3.2"
2930
uefi-macros = "0.9.0"
3031

uefi/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
6161
#![feature(abi_efiapi)]
6262
#![feature(maybe_uninit_slice)]
63-
#![feature(ptr_metadata)]
6463
#![cfg_attr(feature = "alloc", feature(vec_into_raw_parts))]
6564
#![cfg_attr(feature = "unstable", feature(error_in_core))]
6665
#![cfg_attr(all(feature = "unstable", feature = "alloc"), feature(allocator_api))]

uefi/src/proto/device_path/build.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ pub use uefi::proto::device_path::device_path_gen::build::*;
99

1010
use crate::proto::device_path::{DevicePath, DevicePathNode};
1111
use core::mem::MaybeUninit;
12-
use core::ptr;
1312

1413
#[cfg(feature = "alloc")]
1514
use alloc::vec::Vec;
@@ -139,7 +138,7 @@ impl<'a> DevicePathBuilder<'a> {
139138
};
140139

141140
let ptr: *const () = data.as_ptr().cast();
142-
Ok(unsafe { &*ptr::from_raw_parts(ptr, data.len()) })
141+
Ok(unsafe { &*ptr_meta::from_raw_parts(ptr, data.len()) })
143142
}
144143
}
145144

0 commit comments

Comments
 (0)