about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorAyush Singh <ayushsingh1325@gmail.com>2023-03-28 20:14:33 +0530
committerAyush Singh <ayushdevel1325@gmail.com>2023-09-22 17:23:33 +0530
commit7a956441a15e6056448233d79f2d03581ce0ccfc (patch)
tree9bb579dbb5dd1e294616fc2625940841808b42cd /library/std/src
parent5df24d18b6cdb8abcede6b658cf066360a219c12 (diff)
downloadrust-7a956441a15e6056448233d79f2d03581ce0ccfc.tar.gz
rust-7a956441a15e6056448233d79f2d03581ce0ccfc.zip
Fixes from PR
- Some comment fixes.
- Make some functions unsafe.
- Make helpers module private.
- Rebase on master
- Update r-efi to v4.2.0

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/os/uefi/env.rs2
-rw-r--r--library/std/src/sys/uefi/helpers.rs4
-rw-r--r--library/std/src/sys/uefi/mod.rs6
3 files changed, 7 insertions, 5 deletions
diff --git a/library/std/src/os/uefi/env.rs b/library/std/src/os/uefi/env.rs
index 41dc7ccdb6a..4dd090e22c6 100644
--- a/library/std/src/os/uefi/env.rs
+++ b/library/std/src/os/uefi/env.rs
@@ -66,7 +66,7 @@ pub(crate) fn try_system_table() -> Option<NonNull<c_void>> {
 }
 
 /// Get the SystemHandle Pointer.
-/// This function is mostly intended for places where panic is not an option
+/// This function is mostly intended for places where panicking is not an option
 pub(crate) fn try_image_handle() -> Option<NonNull<c_void>> {
     GLOBALS.get().map(|x| x.1)
 }
diff --git a/library/std/src/sys/uefi/helpers.rs b/library/std/src/sys/uefi/helpers.rs
index 2108484a40c..ea1c68a90ef 100644
--- a/library/std/src/sys/uefi/helpers.rs
+++ b/library/std/src/sys/uefi/helpers.rs
@@ -295,7 +295,9 @@ pub(crate) fn create_event(
     }
 }
 
-pub(crate) fn close_event(evt: NonNull<crate::ffi::c_void>) -> io::Result<()> {
+/// # SAFETY
+/// - The supplied event must be valid
+pub(crate) unsafe fn close_event(evt: NonNull<crate::ffi::c_void>) -> io::Result<()> {
     let boot_services: NonNull<efi::BootServices> =
         boot_services().ok_or(BOOT_SERVICES_UNAVAILABLE)?.cast();
     let r = unsafe {
diff --git a/library/std/src/sys/uefi/mod.rs b/library/std/src/sys/uefi/mod.rs
index 6fd2c5f21cb..27f76f04c05 100644
--- a/library/std/src/sys/uefi/mod.rs
+++ b/library/std/src/sys/uefi/mod.rs
@@ -47,7 +47,7 @@ pub mod thread_local_key;
 #[path = "../unsupported/time.rs"]
 pub mod time;
 
-pub(crate) mod helpers;
+mod helpers;
 
 #[cfg(test)]
 mod tests;
@@ -96,7 +96,7 @@ pub(crate) unsafe fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) {
 /// - must be called only once during runtime cleanup.
 pub unsafe fn cleanup() {
     if let Some(exit_boot_service_event) = EXIT_BOOT_SERVICE_EVENT.take() {
-        let _ = helpers::close_event(exit_boot_service_event);
+        let _ = unsafe { helpers::close_event(exit_boot_service_event) };
     }
 }
 
@@ -123,7 +123,7 @@ pub fn decode_error_kind(code: i32) -> crate::io::ErrorKind {
 
 pub fn abort_internal() -> ! {
     if let Some(exit_boot_service_event) = EXIT_BOOT_SERVICE_EVENT.take() {
-        let _ = helpers::close_event(exit_boot_service_event);
+        let _ = unsafe { helpers::close_event(exit_boot_service_event) };
     }
 
     if let (Some(boot_services), Some(handle)) =