Skip to content

Commit e2f11bc

Browse files
committed
Make vtable_align a rustc_intrinsic
1 parent 1eb203d commit e2f11bc

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

core/src/intrinsics.rs

+14-2
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
// Some functions are defined here because they accidentally got made
27312743
// available in this module on stable. See <https://github.com/rust-lang/rust/issues/15702>.
27322744
// (`transmute` also falls into this category, but it cannot be wrapped due to the

0 commit comments

Comments
 (0)