forked from tianocore/edk2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RustPkg/Test: Make Alloc related updates for latest nightly
1. Updates Alloc trait to AllocRef allocater_api discussion: rust-lang/rust#32838 Impacting code change: rust-lang/rust@7ca25db AllocRef documentation: https://doc.rust-lang.org/nightly/core/alloc/trait.AllocRef.html 2. Adds AllocInit arg to alloc() calls Per https://doc.rust-lang.org/nightly/core/alloc/trait.AllocRef.html, a new core::alloc::AllocInit enum was added to the core::alloc::AllocRef trait. The enum allows the caller to specify whether the memory should be zeroed or left uninitialized. Code change in rust-lang that implemented the new parameter: rust-lang/rust@56cbf2f This change updates callers of alloc() to pass the second parameter, conforming to the latest interface and preventing a build failure. 3. Updates usage of AllocRef methods to account for recent changes The return value for core::alloc::AllocRef.alloc() is now a Result<MemoryBlock, AllocErr> whereas it was previously Result<(NonNull<u8>, usize), AllocErr>. Calling the as_ptr() method on the Ok variant is no longer valid. This change uses the underlying ptr field in the MemoryBlock to similarly get the core::ptr::NonNull<u8>. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
- Loading branch information
Showing
2 changed files
with
16 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters