Importing rustc-1.49.0
Bug: 176888219
Change-Id: Ib0805d37e7b485cd420bbff8a8b000cf87e7ede0
diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs
index 426cdb1..433f012 100644
--- a/library/core/src/intrinsics.rs
+++ b/library/core/src/intrinsics.rs
@@ -9,7 +9,7 @@
//! This includes changes in the stability of the constness.
//!
//! In order to make an intrinsic usable at compile-time, one needs to copy the implementation
-//! from https://github.com/rust-lang/miri/blob/master/src/shims/intrinsics.rs to
+//! from <https://github.com/rust-lang/miri/blob/master/src/shims/intrinsics.rs> to
//! `compiler/rustc_mir/src/interpret/intrinsics.rs` and add a
//! `#[rustc_const_unstable(feature = "foo", issue = "01234")]` to the intrinsic.
//!
@@ -719,7 +719,7 @@
/// macro, which panics when it is executed, it is *undefined behavior* to
/// reach code marked with this function.
///
- /// The stabilized version of this intrinsic is [`crate::hint::unreachable_unchecked`].
+ /// The stabilized version of this intrinsic is [`core::hint::unreachable_unchecked`](crate::hint::unreachable_unchecked).
#[rustc_const_unstable(feature = "const_unreachable_unchecked", issue = "53188")]
pub fn unreachable() -> !;
@@ -764,7 +764,7 @@
/// More specifically, this is the offset in bytes between successive
/// items of the same type, including alignment padding.
///
- /// The stabilized version of this intrinsic is [`size_of`].
+ /// The stabilized version of this intrinsic is [`core::mem::size_of`](crate::mem::size_of).
#[rustc_const_stable(feature = "const_size_of", since = "1.40.0")]
pub fn size_of<T>() -> usize;
@@ -772,12 +772,12 @@
///
/// Drop glue is not run on the destination.
///
- /// The stabilized version of this intrinsic is [`crate::ptr::write`].
+ /// The stabilized version of this intrinsic is [`core::ptr::write`](crate::ptr::write).
pub fn move_val_init<T>(dst: *mut T, src: T);
/// The minimum alignment of a type.
///
- /// The stabilized version of this intrinsic is [`crate::mem::align_of`].
+ /// The stabilized version of this intrinsic is [`core::mem::align_of`](crate::mem::align_of).
#[rustc_const_stable(feature = "const_min_align_of", since = "1.40.0")]
pub fn min_align_of<T>() -> usize;
/// The preferred alignment of a type.
@@ -788,18 +788,18 @@
/// The size of the referenced value in bytes.
///
- /// The stabilized version of this intrinsic is [`size_of_val`].
+ /// The stabilized version of this intrinsic is [`mem::size_of_val`].
#[rustc_const_unstable(feature = "const_size_of_val", issue = "46571")]
pub fn size_of_val<T: ?Sized>(_: *const T) -> usize;
/// The required alignment of the referenced value.
///
- /// The stabilized version of this intrinsic is [`crate::mem::align_of_val`].
+ /// The stabilized version of this intrinsic is [`core::mem::align_of_val`](crate::mem::align_of_val).
#[rustc_const_unstable(feature = "const_align_of_val", issue = "46571")]
pub fn min_align_of_val<T: ?Sized>(_: *const T) -> usize;
/// Gets a static string slice containing the name of a type.
///
- /// The stabilized version of this intrinsic is [`crate::any::type_name`].
+ /// The stabilized version of this intrinsic is [`core::any::type_name`](crate::any::type_name).
#[rustc_const_unstable(feature = "const_type_name", issue = "63084")]
pub fn type_name<T: ?Sized>() -> &'static str;
@@ -807,7 +807,7 @@
/// function will return the same value for a type regardless of whichever
/// crate it is invoked in.
///
- /// The stabilized version of this intrinsic is [`crate::any::TypeId::of`].
+ /// The stabilized version of this intrinsic is [`core::any::TypeId::of`](crate::any::TypeId::of).
#[rustc_const_unstable(feature = "const_type_id", issue = "77125")]
pub fn type_id<T: ?Sized + 'static>() -> u64;
@@ -831,7 +831,7 @@
/// Gets a reference to a static `Location` indicating where it was called.
///
- /// Consider using [`crate::panic::Location::caller`] instead.
+ /// Consider using [`core::panic::Location::caller`](crate::panic::Location::caller) instead.
#[rustc_const_unstable(feature = "const_caller_location", issue = "76156")]
pub fn caller_location() -> &'static crate::panic::Location<'static>;
@@ -1072,7 +1072,7 @@
// NOTE: While this makes the intrinsic const stable, we have some custom code in const fn
// checks that prevent its use within `const fn`.
#[rustc_const_stable(feature = "const_transmute", since = "1.46.0")]
- #[cfg_attr(not(bootstrap), rustc_diagnostic_item = "transmute")]
+ #[rustc_diagnostic_item = "transmute"]
pub fn transmute<T, U>(e: T) -> U;
/// Returns `true` if the actual type given as `T` requires drop
@@ -1082,7 +1082,7 @@
/// If the actual type neither requires drop glue nor implements
/// `Copy`, then the return value of this function is unspecified.
///
- /// The stabilized version of this intrinsic is [`needs_drop`].
+ /// The stabilized version of this intrinsic is [`mem::needs_drop`](crate::mem::needs_drop).
#[rustc_const_stable(feature = "const_needs_drop", since = "1.40.0")]
pub fn needs_drop<T>() -> bool;
@@ -1152,11 +1152,11 @@
/// Performs a volatile load from the `src` pointer.
///
- /// The stabilized version of this intrinsic is [`crate::ptr::read_volatile`].
+ /// The stabilized version of this intrinsic is [`core::ptr::read_volatile`](crate::ptr::read_volatile).
pub fn volatile_load<T>(src: *const T) -> T;
/// Performs a volatile store to the `dst` pointer.
///
- /// The stabilized version of this intrinsic is [`crate::ptr::write_volatile`].
+ /// The stabilized version of this intrinsic is [`core::ptr::write_volatile`](crate::ptr::write_volatile).
pub fn volatile_store<T>(dst: *mut T, val: T);
/// Performs a volatile load from the `src` pointer
@@ -1660,22 +1660,22 @@
/// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
///
/// The stabilized versions of this intrinsic are available on the integer
- /// primitives via the `checked_add` method. For example,
- /// [`u32::checked_add`]
+ /// primitives via the `wrapping_add` method. For example,
+ /// [`u32::wrapping_add`]
#[rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0")]
pub fn wrapping_add<T: Copy>(a: T, b: T) -> T;
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
///
/// The stabilized versions of this intrinsic are available on the integer
- /// primitives via the `checked_sub` method. For example,
- /// [`u32::checked_sub`]
+ /// primitives via the `wrapping_sub` method. For example,
+ /// [`u32::wrapping_sub`]
#[rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0")]
pub fn wrapping_sub<T: Copy>(a: T, b: T) -> T;
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
///
/// The stabilized versions of this intrinsic are available on the integer
- /// primitives via the `checked_mul` method. For example,
- /// [`u32::checked_mul`]
+ /// primitives via the `wrapping_mul` method. For example,
+ /// [`u32::wrapping_mul`]
#[rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0")]
pub fn wrapping_mul<T: Copy>(a: T, b: T) -> T;
@@ -1697,14 +1697,14 @@
/// Returns the value of the discriminant for the variant in 'v',
/// cast to a `u64`; if `T` has no discriminant, returns 0.
///
- /// The stabilized version of this intrinsic is [`crate::mem::discriminant`].
+ /// The stabilized version of this intrinsic is [`core::mem::discriminant`](crate::mem::discriminant).
#[rustc_const_unstable(feature = "const_discriminant", issue = "69821")]
pub fn discriminant_value<T>(v: &T) -> <T as DiscriminantKind>::Discriminant;
/// Returns the number of variants of the type `T` cast to a `usize`;
/// if `T` has no variants, returns 0. Uninhabited variants will be counted.
///
- /// The to-be-stabilized version of this intrinsic is [`variant_count`].
+ /// The to-be-stabilized version of this intrinsic is [`mem::variant_count`].
#[rustc_const_unstable(feature = "variant_count", issue = "73662")]
pub fn variant_count<T>() -> usize;