Browse Source

More edition 2024 preparation

Gary Guo 5 months ago
parent
commit
a1b75b6f4c

+ 4 - 9
src/abi.rs

@@ -99,20 +99,15 @@ pub type PersonalityRoutine = unsafe extern "C" fn(
 macro_rules! binding {
     () => {};
     (unsafe extern $abi: literal fn $name: ident ($($arg: ident : $arg_ty: ty),*$(,)?) $(-> $ret: ty)?; $($rest: tt)*) => {
-        extern $abi {
-            pub fn $name($($arg: $arg_ty),*) $(-> $ret)?;
+        unsafe extern $abi {
+            pub unsafe fn $name($($arg: $arg_ty),*) $(-> $ret)?;
         }
         binding!($($rest)*);
     };
 
     (extern $abi: literal fn $name: ident ($($arg: ident : $arg_ty: ty),*$(,)?) $(-> $ret: ty)?; $($rest: tt)*) => {
-        #[allow(non_snake_case)]
-        #[inline]
-        pub fn $name($($arg: $arg_ty),*) $(-> $ret)? {
-            extern $abi {
-                fn $name($($arg: $arg_ty),*) $(-> $ret)?;
-            }
-            unsafe { $name($($arg),*) }
+        unsafe extern $abi {
+            pub safe fn $name($($arg: $arg_ty),*) $(-> $ret)?;
         }
         binding!($($rest)*);
     };

+ 1 - 1
src/panic_handler.rs

@@ -11,7 +11,7 @@ use core::sync::atomic::{AtomicI32, Ordering};
 static PANIC_COUNT: Cell<usize> = Cell::new(0);
 
 #[link(name = "c")]
-extern "C" {}
+unsafe extern "C" {}
 
 pub(crate) fn drop_panic() {
     eprintln!("Rust panics must be rethrown");

+ 1 - 1
src/unwinder/find_fde/fixed.rs

@@ -9,7 +9,7 @@ pub fn get_finder() -> &'static StaticFinder {
     &StaticFinder(())
 }
 
-extern "C" {
+unsafe extern "C" {
     static __executable_start: u8;
     static __etext: u8;
     static __eh_frame: u8;

+ 1 - 1
src/unwinder/find_fde/gnu_eh_frame_hdr.rs

@@ -9,7 +9,7 @@ pub fn get_finder() -> &'static StaticFinder {
     &StaticFinder(())
 }
 
-extern "C" {
+unsafe extern "C" {
     static __executable_start: u8;
     static __etext: u8;
     static __GNU_EH_FRAME_HDR: u8;

+ 1 - 1
test_crates/throw_and_catch/src/main.rs

@@ -8,7 +8,7 @@ use alloc::{borrow::ToOwned, string::String};
 use unwinding::print::*;
 
 #[link(name = "c")]
-extern "C" {}
+unsafe extern "C" {}
 
 struct PrintOnDrop(String);