Skip to content

Commit eca4393

Browse files
lcnroli-obk
authored andcommitted
Add a builtin FnPtr trait
1 parent 113f72d commit eca4393

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

core/src/marker.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,3 +922,18 @@ mod copy_impls {
922922
#[stable(feature = "rust1", since = "1.0.0")]
923923
impl<T: ?Sized> Copy for &T {}
924924
}
925+
926+
/// A common trait implemented by all function pointers.
927+
#[unstable(
928+
feature = "fn_ptr_trait",
929+
issue = "none",
930+
reason = "internal trait for implementing various traits for all function pointers"
931+
)]
932+
#[lang = "fn_ptr_trait"]
933+
#[cfg(not(bootstrap))]
934+
#[rustc_deny_explicit_impl]
935+
pub trait FnPtr {
936+
/// Returns the address of the function pointer.
937+
#[lang = "fn_ptr_addr"]
938+
fn addr(self) -> *const ();
939+
}

0 commit comments

Comments
 (0)