Auto merge of #127865 - matthiaskrgr:rollup-8m49dlg, r=matthiaskrgr · model-checking/verify-rust-std@5578593 (original) (raw)

`@@ -947,7 +947,6 @@ extern "rust-intrinsic" {

`

947

947

`#[rustc_const_stable(feature = "const_unreachable_unchecked", since = "1.57.0")]

`

948

948

`#[rustc_nounwind]

`

949

949

`pub fn unreachable() -> !;

`

950

``

-

951

950

`}

`

952

951

``

953

952

`/// Informs the optimizer that a condition is always true.

`

`@@ -1018,78 +1017,40 @@ extern "rust-intrinsic" {

`

1018

1017

`#[rustc_nounwind]

`

1019

1018

`pub fn breakpoint();

`

1020

1019

``

1021

``

`-

/// The size of a type in bytes.

`

1022

``

`-

///

`

1023

``

`-

/// Note that, unlike most intrinsics, this is safe to call;

`

1024

``

`` -

/// it does not require an unsafe block.

``

1025

``

`-

/// Therefore, implementations must not require the user to uphold

`

1026

``

`-

/// any safety invariants.

`

1027

``

`-

///

`

1028

``

`-

/// More specifically, this is the offset in bytes between successive

`

1029

``

`-

/// items of the same type, including alignment padding.

`

1030

``

`-

///

`

1031

``

`` -

/// The stabilized version of this intrinsic is [core::mem::size_of].

``

``

1020

`+

#[cfg(bootstrap)]

`

1032

1021

`#[rustc_const_stable(feature = "const_size_of", since = "1.40.0")]

`

1033

1022

`#[rustc_safe_intrinsic]

`

1034

1023

`#[rustc_nounwind]

`

1035

1024

`pub fn size_of() -> usize;

`

1036

1025

``

1037

``

`-

/// The minimum alignment of a type.

`

1038

``

`-

///

`

1039

``

`-

/// Note that, unlike most intrinsics, this is safe to call;

`

1040

``

`` -

/// it does not require an unsafe block.

``

1041

``

`-

/// Therefore, implementations must not require the user to uphold

`

1042

``

`-

/// any safety invariants.

`

1043

``

`-

///

`

1044

``

`` -

/// The stabilized version of this intrinsic is [core::mem::align_of].

``

``

1026

`+

#[cfg(bootstrap)]

`

1045

1027

`#[rustc_const_stable(feature = "const_min_align_of", since = "1.40.0")]

`

1046

1028

`#[rustc_safe_intrinsic]

`

1047

1029

`#[rustc_nounwind]

`

1048

1030

`pub fn min_align_of() -> usize;

`

1049

``

`-

/// The preferred alignment of a type.

`

1050

``

`-

///

`

1051

``

`-

/// This intrinsic does not have a stable counterpart.

`

1052

``

`-

/// It's "tracking issue" is #91971.

`

``

1031

+

``

1032

`+

#[cfg(bootstrap)]

`

1053

1033

`#[rustc_const_unstable(feature = "const_pref_align_of", issue = "91971")]

`

1054

1034

`#[rustc_nounwind]

`

1055

1035

`pub fn pref_align_of() -> usize;

`

1056

1036

``

1057

``

`-

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

`

1058

``

`-

///

`

1059

``

`` -

/// The stabilized version of this intrinsic is [crate::mem::size_of_val].

``

``

1037

`+

#[cfg(bootstrap)]

`

1060

1038

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

`

1061

1039

`#[rustc_nounwind]

`

1062

1040

`pub fn size_of_val<T: ?Sized>(_: *const T) -> usize;

`

1063

``

`-

/// The required alignment of the referenced value.

`

1064

``

`-

///

`

1065

``

`` -

/// The stabilized version of this intrinsic is [core::mem::align_of_val].

``

``

1041

+

``

1042

`+

#[cfg(bootstrap)]

`

1066

1043

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

`

1067

1044

`#[rustc_nounwind]

`

1068

1045

`pub fn min_align_of_val<T: ?Sized>(_: *const T) -> usize;

`

1069

1046

``

1070

``

`-

/// Gets a static string slice containing the name of a type.

`

1071

``

`-

///

`

1072

``

`-

/// Note that, unlike most intrinsics, this is safe to call;

`

1073

``

`` -

/// it does not require an unsafe block.

``

1074

``

`-

/// Therefore, implementations must not require the user to uphold

`

1075

``

`-

/// any safety invariants.

`

1076

``

`-

///

`

1077

``

`` -

/// The stabilized version of this intrinsic is [core::any::type_name].

``

``

1047

`+

#[cfg(bootstrap)]

`

1078

1048

`#[rustc_const_unstable(feature = "const_type_name", issue = "63084")]

`

1079

1049

`#[rustc_safe_intrinsic]

`

1080

1050

`#[rustc_nounwind]

`

1081

1051

`pub fn type_name<T: ?Sized>() -> &'static str;

`

1082

1052

``

1083

``

`-

/// Gets an identifier which is globally unique to the specified type. This

`

1084

``

`-

/// function will return the same value for a type regardless of whichever

`

1085

``

`-

/// crate it is invoked in.

`

1086

``

`-

///

`

1087

``

`-

/// Note that, unlike most intrinsics, this is safe to call;

`

1088

``

`` -

/// it does not require an unsafe block.

``

1089

``

`-

/// Therefore, implementations must not require the user to uphold

`

1090

``

`-

/// any safety invariants.

`

1091

``

`-

///

`

1092

``

`` -

/// The stabilized version of this intrinsic is [core::any::TypeId::of].

``

``

1053

`+

#[cfg(bootstrap)]

`

1093

1054

`#[rustc_const_unstable(feature = "const_type_id", issue = "77125")]

`

1094

1055

`#[rustc_safe_intrinsic]

`

1095

1056

`#[rustc_nounwind]

`

`@@ -2424,15 +2385,7 @@ extern "rust-intrinsic" {

`

2424

2385

`#[rustc_nounwind]

`

2425

2386

`pub fn discriminant_value(v: &T) -> ::Discriminant;

`

2426

2387

``

2427

``

`` -

/// Returns the number of variants of the type T cast to a usize;

``

2428

``

`` -

/// if T has no variants, returns 0. Uninhabited variants will be counted.

``

2429

``

`-

///

`

2430

``

`-

/// Note that, unlike most intrinsics, this is safe to call;

`

2431

``

`` -

/// it does not require an unsafe block.

``

2432

``

`-

/// Therefore, implementations must not require the user to uphold

`

2433

``

`-

/// any safety invariants.

`

2434

``

`-

///

`

2435

``

`` -

/// The to-be-stabilized version of this intrinsic is [crate::mem::variant_count].

``

``

2388

`+

#[cfg(bootstrap)]

`

2436

2389

`#[rustc_const_unstable(feature = "variant_count", issue = "73662")]

`

2437

2390

`#[rustc_safe_intrinsic]

`

2438

2391

`#[rustc_nounwind]

`

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

`

2773

2726

`// Runtime NOP

`

2774

2727

`}

`

2775

2728

``

2776

``

`` -

/// ptr must point to a vtable.

``

2777

2729

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

`

``

2730

`+

///

`

``

2731

`+

/// # Safety

`

``

2732

`+

///

`

``

2733

`` +

/// ptr must point to a vtable.

``

2778

2734

`#[rustc_nounwind]

`

2779

2735

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

`

2780

2736

`#[rustc_intrinsic]

`

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

`

2783

2739

`unreachable!()

`

2784

2740

`}

`

2785

2741

``

2786

``

`` -

/// ptr must point to a vtable.

``

2787

2742

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

`

``

2743

`+

///

`

``

2744

`+

/// # Safety

`

``

2745

`+

///

`

``

2746

`` +

/// ptr must point to a vtable.

``

2788

2747

`#[rustc_nounwind]

`

2789

2748

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

`

2790

2749

`#[rustc_intrinsic]

`

`@@ -2793,6 +2752,150 @@ pub unsafe fn vtable_align(_ptr: *const ()) -> usize {

`

2793

2752

`unreachable!()

`

2794

2753

`}

`

2795

2754

``

``

2755

`+

/// The size of a type in bytes.

`

``

2756

`+

///

`

``

2757

`+

/// Note that, unlike most intrinsics, this is safe to call;

`

``

2758

`` +

/// it does not require an unsafe block.

``

``

2759

`+

/// Therefore, implementations must not require the user to uphold

`

``

2760

`+

/// any safety invariants.

`

``

2761

`+

///

`

``

2762

`+

/// More specifically, this is the offset in bytes between successive

`

``

2763

`+

/// items of the same type, including alignment padding.

`

``

2764

`+

///

`

``

2765

`` +

/// The stabilized version of this intrinsic is [core::mem::size_of].

``

``

2766

`+

#[rustc_nounwind]

`

``

2767

`+

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

`

``

2768

`+

#[rustc_const_stable(feature = "const_size_of", since = "1.40.0")]

`

``

2769

`+

#[rustc_intrinsic]

`

``

2770

`+

#[rustc_intrinsic_must_be_overridden]

`

``

2771

`+

#[cfg(not(bootstrap))]

`

``

2772

`+

pub const fn size_of() -> usize {

`

``

2773

`+

unreachable!()

`

``

2774

`+

}

`

``

2775

+

``

2776

`+

/// The minimum alignment of a type.

`

``

2777

`+

///

`

``

2778

`+

/// Note that, unlike most intrinsics, this is safe to call;

`

``

2779

`` +

/// it does not require an unsafe block.

``

``

2780

`+

/// Therefore, implementations must not require the user to uphold

`

``

2781

`+

/// any safety invariants.

`

``

2782

`+

///

`

``

2783

`` +

/// The stabilized version of this intrinsic is [core::mem::align_of].

``

``

2784

`+

#[rustc_nounwind]

`

``

2785

`+

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

`

``

2786

`+

#[rustc_const_stable(feature = "const_min_align_of", since = "1.40.0")]

`

``

2787

`+

#[rustc_intrinsic]

`

``

2788

`+

#[rustc_intrinsic_must_be_overridden]

`

``

2789

`+

#[cfg(not(bootstrap))]

`

``

2790

`+

pub const fn min_align_of() -> usize {

`

``

2791

`+

unreachable!()

`

``

2792

`+

}

`

``

2793

+

``

2794

`+

/// The preferred alignment of a type.

`

``

2795

`+

///

`

``

2796

`+

/// This intrinsic does not have a stable counterpart.

`

``

2797

`+

/// It's "tracking issue" is #91971.

`

``

2798

`+

#[rustc_nounwind]

`

``

2799

`+

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

`

``

2800

`+

#[rustc_const_unstable(feature = "const_pref_align_of", issue = "91971")]

`

``

2801

`+

#[rustc_intrinsic]

`

``

2802

`+

#[rustc_intrinsic_must_be_overridden]

`

``

2803

`+

#[cfg(not(bootstrap))]

`

``

2804

`+

pub const unsafe fn pref_align_of() -> usize {

`

``

2805

`+

unreachable!()

`

``

2806

`+

}

`

``

2807

+

``

2808

`` +

/// Returns the number of variants of the type T cast to a usize;

``

``

2809

`` +

/// if T has no variants, returns 0. Uninhabited variants will be counted.

``

``

2810

`+

///

`

``

2811

`+

/// Note that, unlike most intrinsics, this is safe to call;

`

``

2812

`` +

/// it does not require an unsafe block.

``

``

2813

`+

/// Therefore, implementations must not require the user to uphold

`

``

2814

`+

/// any safety invariants.

`

``

2815

`+

///

`

``

2816

`` +

/// The to-be-stabilized version of this intrinsic is [crate::mem::variant_count].

``

``

2817

`+

#[rustc_nounwind]

`

``

2818

`+

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

`

``

2819

`+

#[rustc_const_unstable(feature = "variant_count", issue = "73662")]

`

``

2820

`+

#[rustc_intrinsic]

`

``

2821

`+

#[rustc_intrinsic_must_be_overridden]

`

``

2822

`+

#[cfg(not(bootstrap))]

`

``

2823

`+

pub const fn variant_count() -> usize {

`

``

2824

`+

unreachable!()

`

``

2825

`+

}

`

``

2826

+

``

2827

`+

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

`

``

2828

`+

///

`

``

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.

``

``

2834

`+

#[rustc_nounwind]

`

``

2835

`+

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

`

``

2836

`+

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

`

``

2837

`+

#[rustc_intrinsic]

`

``

2838

`+

#[rustc_intrinsic_must_be_overridden]

`

``

2839

`+

#[cfg(not(bootstrap))]

`

``

2840

`+

pub const unsafe fn size_of_val<T: ?Sized>(_ptr: *const T) -> usize {

`

``

2841

`+

unreachable!()

`

``

2842

`+

}

`

``

2843

+

``

2844

`+

/// The required alignment of the referenced value.

`

``

2845

`+

///

`

``

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.

``

``

2851

`+

#[rustc_nounwind]

`

``

2852

`+

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

`

``

2853

`+

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

`

``

2854

`+

#[rustc_intrinsic]

`

``

2855

`+

#[rustc_intrinsic_must_be_overridden]

`

``

2856

`+

#[cfg(not(bootstrap))]

`

``

2857

`+

pub const unsafe fn min_align_of_val<T: ?Sized>(_ptr: *const T) -> usize {

`

``

2858

`+

unreachable!()

`

``

2859

`+

}

`

``

2860

+

``

2861

`+

/// Gets a static string slice containing the name of a type.

`

``

2862

`+

///

`

``

2863

`+

/// Note that, unlike most intrinsics, this is safe to call;

`

``

2864

`` +

/// it does not require an unsafe block.

``

``

2865

`+

/// Therefore, implementations must not require the user to uphold

`

``

2866

`+

/// any safety invariants.

`

``

2867

`+

///

`

``

2868

`` +

/// The stabilized version of this intrinsic is [core::any::type_name].

``

``

2869

`+

#[rustc_nounwind]

`

``

2870

`+

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

`

``

2871

`+

#[rustc_const_unstable(feature = "const_type_name", issue = "63084")]

`

``

2872

`+

#[rustc_intrinsic]

`

``

2873

`+

#[rustc_intrinsic_must_be_overridden]

`

``

2874

`+

#[cfg(not(bootstrap))]

`

``

2875

`+

pub const fn type_name<T: ?Sized>() -> &'static str {

`

``

2876

`+

unreachable!()

`

``

2877

`+

}

`

``

2878

+

``

2879

`+

/// Gets an identifier which is globally unique to the specified type. This

`

``

2880

`+

/// function will return the same value for a type regardless of whichever

`

``

2881

`+

/// crate it is invoked in.

`

``

2882

`+

///

`

``

2883

`+

/// Note that, unlike most intrinsics, this is safe to call;

`

``

2884

`` +

/// it does not require an unsafe block.

``

``

2885

`+

/// Therefore, implementations must not require the user to uphold

`

``

2886

`+

/// any safety invariants.

`

``

2887

`+

///

`

``

2888

`` +

/// The stabilized version of this intrinsic is [core::any::TypeId::of].

``

``

2889

`+

#[rustc_nounwind]

`

``

2890

`+

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

`

``

2891

`+

#[rustc_const_unstable(feature = "const_type_id", issue = "77125")]

`

``

2892

`+

#[rustc_intrinsic]

`

``

2893

`+

#[rustc_intrinsic_must_be_overridden]

`

``

2894

`+

#[cfg(not(bootstrap))]

`

``

2895

`+

pub const fn type_id<T: ?Sized + 'static>() -> u128 {

`

``

2896

`+

unreachable!()

`

``

2897

`+

}

`

``

2898

+

2796

2899

`` /// Lowers in MIR to Rvalue::Aggregate with AggregateKind::RawPtr.

``

2797

2900

`///

`

2798

2901

`` /// This is used to implement functions like slice::from_raw_parts_mut and

``