Skip to content

Commit 847d584

Browse files
committed
Make vtable_align a rustc_intrinsic
1 parent 0c3685d commit 847d584

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

library/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)]
@@ -2702,13 +2703,24 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize)
27022703
/// The intrinsic will return the size stored in that vtable.
27032704
#[rustc_nounwind]
27042705
#[unstable(feature = "core_intrinsics", issue = "none")]
2705-
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
2706-
#[cfg_attr(not(bootstrap), rustc_intrinsic_must_be_overridden)]
2706+
#[rustc_intrinsic]
2707+
#[rustc_intrinsic_must_be_overridden]
27072708
#[cfg(not(bootstrap))]
27082709
pub unsafe fn vtable_size(_ptr: *const ()) -> usize {
27092710
unreachable!()
27102711
}
27112712

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

0 commit comments

Comments
 (0)