Description
Hello,
I'm encountering persistent compilation errors when trying to use uefi = "0.30.0"
(with uefi-services = "0.25.0"
initially, then relying on uefi crate's own handlers via features logger, alloc, global_allocator, panic_handler
) for a no_std
UEFI application targeting x86_64-unknown-uefi
with a nightly Rust toolchain.
The primary issue is with SystemTable<Boot>::exit_boot_services
. The documentation for uefi v0.30.0
indicates the method signature is: pub unsafe fn exit_boot_services(self, memory_type: MemoryType) -> Result<(SystemTable<Runtime>, MemoryMap<'_>), ExitBootServicesError>
However, when I call it as unsafe { system_table.exit_boot_services(MemoryType::LOADER_DATA) }
and try to match on the Result
, the compiler gives an error: error[E0308]: mismatched types note: expected tuple (SystemTable<Runtime>, MemoryMap<'_>) found enum Result<_, _>
This suggests the compiler believes the method directly returns a tuple, which matches a much older API style (e.g., pre-v0.15.0 where it wasn't unsafe and didn't return a Result, and MemoryMap was 'static).
Additionally, I'm facing issues resolving freestanding functions from the uefi::boot
module:
use uefi::boot::memory_map_size; results in error[E0432]: unresolved import uefi::boot Calls like uefi::boot::memory_map_size(bt) result in error[E0433]: failed to resolve: could not find boot in uefi
This occurs even though the uefi v0.30.0
documentation indicates these functions (like memory_map_size, memory_map, open_protocol_exclusive, exit_boot_services as a freestanding alternative) exist in the uefi::boot
module.
Other related issues include:
SystemTableExt::find_gop()
(from prelude) not being found on SystemTable<Boot>
instances.
Difficulty resolving uefi::proto::loaded_image::Protocol
(the struct for loaded image data, not the GUID).
Cargo.toml dependencies:
[dependencies]
spin = "0.9.8"
uefi = { version = "0.30.0", features = ["logger", "alloc", "global_allocator", "panic_handler"] }
log = "0.4.20"
Environment:
Target: x86_64-unknown-uefi
Toolchain: Nightly (latest available in the environment, e.g., 1.89.0-nightly)
.cargo/config.toml specifies build-std = ["core", "compiler_builtins", "alloc"] under [unstable].
Could there be a known issue with feature flag interactions, version resolution subtleties with Cargo for this target, or specific rust-toolchain.toml configurations that might lead to the compiler effectively seeing an older/different API for parts of the uefi crate than specified by the version string?
Any guidance on what might be causing this discrepancy between documented v0.30.0
API and compiler behavior would be greatly appreciated.
Thank you!