Document safety of a few intrinsics · model-checking/verify-rust-std@5487574
@@ -2726,8 +2726,11 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize)
27262726// Runtime NOP
27272727}
272827282729-/// `ptr` must point to a vtable.
27302729/// The intrinsic will return the size stored in that vtable.
2730+///
2731+/// # Safety
2732+///
2733+/// `ptr` must point to a vtable.
27312734#[rustc_nounwind]
27322735#[unstable(feature = "core_intrinsics", issue = "none")]
27332736#[rustc_intrinsic]
@@ -2736,8 +2739,11 @@ pub unsafe fn vtable_size(_ptr: *const ()) -> usize {
27362739unreachable!()
27372740}
273827412739-/// `ptr` must point to a vtable.
27402742/// The intrinsic will return the alignment stored in that vtable.
2743+///
2744+/// # Safety
2745+///
2746+/// `ptr` must point to a vtable.
27412747#[rustc_nounwind]
27422748#[unstable(feature = "core_intrinsics", issue = "none")]
27432749#[rustc_intrinsic]
@@ -2821,6 +2827,10 @@ pub const fn variant_count<T>() -> usize {
28212827/// The size of the referenced value in bytes.
28222828///
28232829/// The stabilized version of this intrinsic is [`crate::mem::size_of_val`].
2830+///
2831+/// # Safety
2832+///
2833+/// See [`crate::mem::size_of_val_raw`] for safety conditions.
28242834#[rustc_nounwind]
28252835#[unstable(feature = "core_intrinsics", issue = "none")]
28262836#[rustc_const_unstable(feature = "const_size_of_val", issue = "46571")]
@@ -2834,6 +2844,10 @@ pub const unsafe fn size_of_val<T: ?Sized>(_ptr: *const T) -> usize {
28342844/// The required alignment of the referenced value.
28352845///
28362846/// The stabilized version of this intrinsic is [`core::mem::align_of_val`].
2847+///
2848+/// # Safety
2849+///
2850+/// See [`crate::mem::align_of_val_raw`] for safety conditions.
28372851#[rustc_nounwind]
28382852#[unstable(feature = "core_intrinsics", issue = "none")]
28392853#[rustc_const_unstable(feature = "const_align_of_val", issue = "46571")]