Make vtable_align a rustc_intrinsic

This commit is contained in:
Oli Scherer 2024-03-05 17:47:57 +00:00
parent 7f9830b16c
commit e0d67aeb0b

View File

@ -2506,6 +2506,7 @@ extern "rust-intrinsic" {
/// `ptr` must point to a vtable.
/// The intrinsic will return the alignment stored in that vtable.
#[rustc_nounwind]
#[cfg(bootstrap)]
pub fn vtable_align(ptr: *const ()) -> usize;
#[cfg(bootstrap)]
@ -2720,13 +2721,24 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize)
/// The intrinsic will return the size stored in that vtable.
#[rustc_nounwind]
#[unstable(feature = "core_intrinsics", issue = "none")]
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
#[cfg_attr(not(bootstrap), rustc_intrinsic_must_be_overridden)]
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[cfg(not(bootstrap))]
pub unsafe fn vtable_size(_ptr: *const ()) -> usize {
unreachable!()
}
/// `ptr` must point to a vtable.
/// The intrinsic will return the alignment stored in that vtable.
#[rustc_nounwind]
#[unstable(feature = "core_intrinsics", issue = "none")]
#[rustc_intrinsic]
#[rustc_intrinsic_must_be_overridden]
#[cfg(not(bootstrap))]
pub unsafe fn vtable_align(_ptr: *const ()) -> usize {
unreachable!()
}
// Some functions are defined here because they accidentally got made
// available in this module on stable. See <https://github.com/rust-lang/rust/issues/15702>.
// (`transmute` also falls into this category, but it cannot be wrapped due to the