Skip to content

Commit 48429f1

Browse files
committed
Make vtable_align a rustc_intrinsic
1 parent ca0f915 commit 48429f1

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

library/core/src/intrinsics.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,6 +2506,7 @@ extern "rust-intrinsic" {
25062506
/// `ptr` must point to a vtable.
25072507
/// The intrinsic will return the alignment stored in that vtable.
25082508
#[rustc_nounwind]
2509+
#[cfg(bootstrap)]
25092510
pub fn vtable_align(ptr: *const ()) -> usize;
25102511

25112512
#[cfg(bootstrap)]
@@ -2720,13 +2721,24 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize)
27202721
/// The intrinsic will return the size stored in that vtable.
27212722
#[rustc_nounwind]
27222723
#[unstable(feature = "core_intrinsics", issue = "none")]
2723-
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
2724-
#[cfg_attr(not(bootstrap), rustc_intrinsic_must_be_overridden)]
2724+
#[rustc_intrinsic]
2725+
#[rustc_intrinsic_must_be_overridden]
27252726
#[cfg(not(bootstrap))]
27262727
pub unsafe fn vtable_size(_ptr: *const ()) -> usize {
27272728
unreachable!()
27282729
}
27292730

2731+
/// `ptr` must point to a vtable.
2732+
/// The intrinsic will return the alignment stored in that vtable.
2733+
#[rustc_nounwind]
2734+
#[unstable(feature = "core_intrinsics", issue = "none")]
2735+
#[rustc_intrinsic]
2736+
#[rustc_intrinsic_must_be_overridden]
2737+
#[cfg(not(bootstrap))]
2738+
pub unsafe fn vtable_align(_ptr: *const ()) -> usize {
2739+
unreachable!()
2740+
}
2741+
27302742
/// Retag a box pointer as part of casting it to a raw pointer. This is the `Box` equivalent of
27312743
/// `(x: &mut T) as *mut T`. The input pointer must be the pointer of a `Box` (passed as raw pointer
27322744
/// to avoid all questions around move semantics and custom allocators), and `A` must be the `Box`'s

0 commit comments

Comments
 (0)