Document safety of a few intrinsics · model-checking/verify-rust-std@5487574 (original) (raw)

`@@ -2726,8 +2726,11 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize)

`

2726

2726

`// Runtime NOP

`

2727

2727

`}

`

2728

2728

``

2729

``

`` -

/// ptr must point to a vtable.

``

2730

2729

`/// The intrinsic will return the size stored in that vtable.

`

``

2730

`+

///

`

``

2731

`+

/// # Safety

`

``

2732

`+

///

`

``

2733

`` +

/// ptr must point to a vtable.

``

2731

2734

`#[rustc_nounwind]

`

2732

2735

`#[unstable(feature = "core_intrinsics", issue = "none")]

`

2733

2736

`#[rustc_intrinsic]

`

`@@ -2736,8 +2739,11 @@ pub unsafe fn vtable_size(_ptr: *const ()) -> usize {

`

2736

2739

`unreachable!()

`

2737

2740

`}

`

2738

2741

``

2739

``

`` -

/// ptr must point to a vtable.

``

2740

2742

`/// The intrinsic will return the alignment stored in that vtable.

`

``

2743

`+

///

`

``

2744

`+

/// # Safety

`

``

2745

`+

///

`

``

2746

`` +

/// ptr must point to a vtable.

``

2741

2747

`#[rustc_nounwind]

`

2742

2748

`#[unstable(feature = "core_intrinsics", issue = "none")]

`

2743

2749

`#[rustc_intrinsic]

`

`@@ -2821,6 +2827,10 @@ pub const fn variant_count() -> usize {

`

2821

2827

`/// The size of the referenced value in bytes.

`

2822

2828

`///

`

2823

2829

`` /// 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.

``

2824

2834

`#[rustc_nounwind]

`

2825

2835

`#[unstable(feature = "core_intrinsics", issue = "none")]

`

2826

2836

`#[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 {

`

2834

2844

`/// The required alignment of the referenced value.

`

2835

2845

`///

`

2836

2846

`` /// 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.

``

2837

2851

`#[rustc_nounwind]

`

2838

2852

`#[unstable(feature = "core_intrinsics", issue = "none")]

`

2839

2853

`#[rustc_const_unstable(feature = "const_align_of_val", issue = "46571")]

`