Skip to content

Commit 5316796

Browse files
committed
Update stability annotations on fnptr impls for C-unwind ABI
1 parent d0a33f2 commit 5316796

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

library/core/src/ptr/mod.rs

+19-13
Original file line numberDiff line numberDiff line change
@@ -1862,9 +1862,15 @@ macro_rules! maybe_fnptr_doc {
18621862
// Impls for function pointers
18631863
macro_rules! fnptr_impls_safety_abi {
18641864
($FnTy: ty, $($Arg: ident),*) => {
1865+
fnptr_impls_safety_abi! { #[stable(feature = "fnptr_impls", since = "1.4.0")] $FnTy, $($Arg),* }
1866+
};
1867+
(@c_unwind $FnTy: ty, $($Arg: ident),*) => {
1868+
fnptr_impls_safety_abi! { #[unstable(feature = "c_unwind", issue = "74990")] $FnTy, $($Arg),* }
1869+
};
1870+
(#[$meta:meta] $FnTy: ty, $($Arg: ident),*) => {
18651871
maybe_fnptr_doc! {
18661872
$($Arg)* @
1867-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
1873+
#[$meta]
18681874
impl<Ret, $($Arg),*> PartialEq for $FnTy {
18691875
#[inline]
18701876
fn eq(&self, other: &Self) -> bool {
@@ -1875,13 +1881,13 @@ macro_rules! fnptr_impls_safety_abi {
18751881

18761882
maybe_fnptr_doc! {
18771883
$($Arg)* @
1878-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
1884+
#[$meta]
18791885
impl<Ret, $($Arg),*> Eq for $FnTy {}
18801886
}
18811887

18821888
maybe_fnptr_doc! {
18831889
$($Arg)* @
1884-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
1890+
#[$meta]
18851891
impl<Ret, $($Arg),*> PartialOrd for $FnTy {
18861892
#[inline]
18871893
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
@@ -1892,7 +1898,7 @@ macro_rules! fnptr_impls_safety_abi {
18921898

18931899
maybe_fnptr_doc! {
18941900
$($Arg)* @
1895-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
1901+
#[$meta]
18961902
impl<Ret, $($Arg),*> Ord for $FnTy {
18971903
#[inline]
18981904
fn cmp(&self, other: &Self) -> Ordering {
@@ -1903,7 +1909,7 @@ macro_rules! fnptr_impls_safety_abi {
19031909

19041910
maybe_fnptr_doc! {
19051911
$($Arg)* @
1906-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
1912+
#[$meta]
19071913
impl<Ret, $($Arg),*> hash::Hash for $FnTy {
19081914
fn hash<HH: hash::Hasher>(&self, state: &mut HH) {
19091915
state.write_usize(*self as usize)
@@ -1913,7 +1919,7 @@ macro_rules! fnptr_impls_safety_abi {
19131919

19141920
maybe_fnptr_doc! {
19151921
$($Arg)* @
1916-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
1922+
#[$meta]
19171923
impl<Ret, $($Arg),*> fmt::Pointer for $FnTy {
19181924
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19191925
fmt::pointer_fmt_inner(*self as usize, f)
@@ -1923,7 +1929,7 @@ macro_rules! fnptr_impls_safety_abi {
19231929

19241930
maybe_fnptr_doc! {
19251931
$($Arg)* @
1926-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
1932+
#[$meta]
19271933
impl<Ret, $($Arg),*> fmt::Debug for $FnTy {
19281934
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19291935
fmt::pointer_fmt_inner(*self as usize, f)
@@ -1938,22 +1944,22 @@ macro_rules! fnptr_impls_args {
19381944
fnptr_impls_safety_abi! { extern "Rust" fn($($Arg),+) -> Ret, $($Arg),+ }
19391945
fnptr_impls_safety_abi! { extern "C" fn($($Arg),+) -> Ret, $($Arg),+ }
19401946
fnptr_impls_safety_abi! { extern "C" fn($($Arg),+ , ...) -> Ret, $($Arg),+ }
1941-
fnptr_impls_safety_abi! { extern "C-unwind" fn($($Arg),+) -> Ret, $($Arg),+ }
1942-
fnptr_impls_safety_abi! { extern "C-unwind" fn($($Arg),+ , ...) -> Ret, $($Arg),+ }
1947+
fnptr_impls_safety_abi! { @c_unwind extern "C-unwind" fn($($Arg),+) -> Ret, $($Arg),+ }
1948+
fnptr_impls_safety_abi! { @c_unwind extern "C-unwind" fn($($Arg),+ , ...) -> Ret, $($Arg),+ }
19431949
fnptr_impls_safety_abi! { unsafe extern "Rust" fn($($Arg),+) -> Ret, $($Arg),+ }
19441950
fnptr_impls_safety_abi! { unsafe extern "C" fn($($Arg),+) -> Ret, $($Arg),+ }
19451951
fnptr_impls_safety_abi! { unsafe extern "C" fn($($Arg),+ , ...) -> Ret, $($Arg),+ }
1946-
fnptr_impls_safety_abi! { unsafe extern "C-unwind" fn($($Arg),+) -> Ret, $($Arg),+ }
1947-
fnptr_impls_safety_abi! { unsafe extern "C-unwind" fn($($Arg),+ , ...) -> Ret, $($Arg),+ }
1952+
fnptr_impls_safety_abi! { @c_unwind unsafe extern "C-unwind" fn($($Arg),+) -> Ret, $($Arg),+ }
1953+
fnptr_impls_safety_abi! { @c_unwind unsafe extern "C-unwind" fn($($Arg),+ , ...) -> Ret, $($Arg),+ }
19481954
};
19491955
() => {
19501956
// No variadic functions with 0 parameters
19511957
fnptr_impls_safety_abi! { extern "Rust" fn() -> Ret, }
19521958
fnptr_impls_safety_abi! { extern "C" fn() -> Ret, }
1953-
fnptr_impls_safety_abi! { extern "C-unwind" fn() -> Ret, }
1959+
fnptr_impls_safety_abi! { @c_unwind extern "C-unwind" fn() -> Ret, }
19541960
fnptr_impls_safety_abi! { unsafe extern "Rust" fn() -> Ret, }
19551961
fnptr_impls_safety_abi! { unsafe extern "C" fn() -> Ret, }
1956-
fnptr_impls_safety_abi! { unsafe extern "C-unwind" fn() -> Ret, }
1962+
fnptr_impls_safety_abi! { @c_unwind unsafe extern "C-unwind" fn() -> Ret, }
19571963
};
19581964
}
19591965

0 commit comments

Comments
 (0)