Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0df3d3d

Browse files
committedMar 7, 2024
Make vtable_align a rustc_intrinsic
1 parent 90e0e2e commit 0df3d3d

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)]
@@ -2706,13 +2707,24 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize)
27062707
/// The intrinsic will return the size stored in that vtable.
27072708
#[rustc_nounwind]
27082709
#[unstable(feature = "core_intrinsics", issue = "none")]
2709-
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
2710-
#[cfg_attr(not(bootstrap), rustc_intrinsic_must_be_overridden)]
2710+
#[rustc_intrinsic]
2711+
#[rustc_intrinsic_must_be_overridden]
27112712
#[cfg(not(bootstrap))]
27122713
pub unsafe fn vtable_size(_ptr: *const ()) -> usize {
27132714
unreachable!()
27142715
}
27152716

2717+
/// `ptr` must point to a vtable.
2718+
/// The intrinsic will return the alignment stored in that vtable.
2719+
#[rustc_nounwind]
2720+
#[unstable(feature = "core_intrinsics", issue = "none")]
2721+
#[rustc_intrinsic]
2722+
#[rustc_intrinsic_must_be_overridden]
2723+
#[cfg(not(bootstrap))]
2724+
pub unsafe fn vtable_align(_ptr: *const ()) -> usize {
2725+
unreachable!()
2726+
}
2727+
27162728
// Some functions are defined here because they accidentally got made
27172729
// available in this module on stable. See <https://github.com/rust-lang/rust/issues/15702>.
27182730
// (`transmute` also falls into this category, but it cannot be wrapped due to the

0 commit comments

Comments
 (0)
Please sign in to comment.