diff --git a/src/doc/unstable-book/src/language-features/lang-items.md b/src/doc/unstable-book/src/language-features/lang-items.md
index d4ad65e84b7b4..6f096e582f575 100644
--- a/src/doc/unstable-book/src/language-features/lang-items.md
+++ b/src/doc/unstable-book/src/language-features/lang-items.md
@@ -188,11 +188,7 @@ pub extern fn rust_begin_panic(info: &PanicInfo) -> ! {
In many cases, you may need to manually link to the `compiler_builtins` crate
when building a `no_std` binary. You may observe this via linker error messages
-such as "```undefined reference to `__rust_probestack'```". Using this crate
-also requires enabling the library feature `compiler_builtins_lib`. You can read
-more about this [here][compiler-builtins-lib].
-
-[compiler-builtins-lib]: ../library-features/compiler-builtins-lib.md
+such as "```undefined reference to `__rust_probestack'```".
## More about the language items
diff --git a/src/doc/unstable-book/src/library-features/compiler-builtins-lib.md b/src/doc/unstable-book/src/library-features/compiler-builtins-lib.md
deleted file mode 100644
index 6c71c3f2ce191..0000000000000
--- a/src/doc/unstable-book/src/library-features/compiler-builtins-lib.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# `compiler_builtins_lib`
-
-The tracking issue for this feature is: None.
-
-------------------------
-
-This feature is required to link to the `compiler_builtins` crate which contains
-"compiler intrinsics". Compiler intrinsics are software implementations of basic
-operations like multiplication of `u64`s. These intrinsics are only required on
-platforms where these operations don't directly map to a hardware instruction.
-
-You should never need to explicitly link to the `compiler_builtins` crate when
-building "std" programs as `compiler_builtins` is already in the dependency
-graph of `std`. But you may need it when building `no_std` **binary** crates. If
-you get a *linker* error like:
-
-``` text
-$PWD/src/main.rs:11: undefined reference to `__aeabi_lmul'
-$PWD/src/main.rs:11: undefined reference to `__aeabi_uldivmod'
-```
-
-That means that you need to link to this crate.
-
-When you link to this crate, make sure it only appears once in your crate
-dependency graph. Also, it doesn't matter where in the dependency graph you
-place the `compiler_builtins` crate.
-
-
-
-``` rust,ignore
-#![feature(compiler_builtins_lib)]
-#![no_std]
-
-extern crate compiler_builtins;
-```
diff --git a/src/etc/installer/msi/rust.wxs b/src/etc/installer/msi/rust.wxs
index a2e378f7b1db4..a182bc4067a9f 100644
--- a/src/etc/installer/msi/rust.wxs
+++ b/src/etc/installer/msi/rust.wxs
@@ -85,7 +85,7 @@
-
+
diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs
index 2f6d10c027be3..7b83658fca60d 100644
--- a/src/liballoc/slice.rs
+++ b/src/liballoc/slice.rs
@@ -450,7 +450,8 @@ impl [T] {
// and `rem` is the remaining part of `n`.
// Using `Vec` to access `set_len()`.
- let mut buf = Vec::with_capacity(self.len().checked_mul(n).expect("capacity overflow"));
+ let capacity = self.len().checked_mul(n).expect("capacity overflow");
+ let mut buf = Vec::with_capacity(capacity);
// `2^expn` repetition is done by doubling `buf` `expn`-times.
buf.extend(self);
@@ -476,7 +477,7 @@ impl [T] {
// `rem` (`= n - 2^expn`) repetition is done by copying
// first `rem` repetitions from `buf` itself.
- let rem_len = self.len() * n - buf.len(); // `self.len() * rem`
+ let rem_len = capacity - buf.len(); // `self.len() * rem`
if rem_len > 0 {
// `buf.extend(buf[0 .. rem_len])`:
unsafe {
@@ -487,8 +488,7 @@ impl [T] {
rem_len,
);
// `buf.len() + rem_len` equals to `buf.capacity()` (`= self.len() * n`).
- let buf_cap = buf.capacity();
- buf.set_len(buf_cap);
+ buf.set_len(capacity);
}
}
buf
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index 502090731f4a1..416c73f50bd89 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -697,7 +697,7 @@ extern "rust-intrinsic" {
#[rustc_const_stable(feature = "const_min_align_of", since = "1.40.0")]
pub fn min_align_of() -> usize;
- #[rustc_const_unstable(feature = "const_pref_align_of", issue = "0")]
+ #[rustc_const_unstable(feature = "const_pref_align_of", issue = "none")]
pub fn pref_align_of() -> usize;
/// The size of the referenced value in bytes.
@@ -708,13 +708,13 @@ extern "rust-intrinsic" {
pub fn min_align_of_val(_: &T) -> usize;
/// Gets a static string slice containing the name of a type.
- #[rustc_const_unstable(feature = "const_type_name", issue = "0")]
+ #[rustc_const_unstable(feature = "const_type_name", issue = "none")]
pub fn type_name() -> &'static str;
/// Gets an identifier which is globally unique to the specified type. This
/// function will return the same value for a type regardless of whichever
/// crate it is invoked in.
- #[rustc_const_unstable(feature = "const_type_id", issue = "0")]
+ #[rustc_const_unstable(feature = "const_type_id", issue = "none")]
pub fn type_id() -> u64;
/// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited:
@@ -1222,7 +1222,7 @@ extern "rust-intrinsic" {
/// let num_leading = unsafe { ctlz_nonzero(x) };
/// assert_eq!(num_leading, 3);
/// ```
- #[rustc_const_unstable(feature = "constctlz", issue = "0")]
+ #[rustc_const_unstable(feature = "constctlz", issue = "none")]
pub fn ctlz_nonzero(x: T) -> T;
/// Returns the number of trailing unset bits (zeroes) in an integer type `T`.
@@ -1267,7 +1267,7 @@ extern "rust-intrinsic" {
/// let num_trailing = unsafe { cttz_nonzero(x) };
/// assert_eq!(num_trailing, 3);
/// ```
- #[rustc_const_unstable(feature = "const_cttz", issue = "0")]
+ #[rustc_const_unstable(feature = "const_cttz", issue = "none")]
pub fn cttz_nonzero(x: T) -> T;
/// Reverses the bytes in an integer type `T`.
@@ -1396,7 +1396,7 @@ extern "rust-intrinsic" {
pub fn nontemporal_store(ptr: *mut T, val: T);
/// See documentation of `<*const T>::offset_from` for details.
- #[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "0")]
+ #[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "none")]
pub fn ptr_offset_from(ptr: *const T, base: *const T) -> isize;
/// Internal hook used by Miri to implement unwinding.
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs
index 5ddf5d48965d5..ba82a7c16d324 100644
--- a/src/libcore/slice/mod.rs
+++ b/src/libcore/slice/mod.rs
@@ -34,7 +34,7 @@ use crate::mem;
use crate::ops::{self, FnMut, Range};
use crate::option::Option;
use crate::option::Option::{None, Some};
-use crate::ptr;
+use crate::ptr::{NonNull, self};
use crate::result::Result;
use crate::result::Result::{Err, Ok};
@@ -628,7 +628,7 @@ impl [T] {
ptr.add(self.len())
};
- Iter { ptr, end, _marker: marker::PhantomData }
+ Iter { ptr: NonNull::new_unchecked(ptr as *mut T), end, _marker: marker::PhantomData }
}
}
@@ -656,7 +656,7 @@ impl [T] {
ptr.add(self.len())
};
- IterMut { ptr, end, _marker: marker::PhantomData }
+ IterMut { ptr: NonNull::new_unchecked(ptr), end, _marker: marker::PhantomData }
}
}
@@ -3095,7 +3095,7 @@ macro_rules! is_empty {
// The way we encode the length of a ZST iterator, this works both for ZST
// and non-ZST.
($self: ident) => {
- $self.ptr == $self.end
+ $self.ptr.as_ptr() as *const T == $self.end
};
}
// To get rid of some bounds checks (see `position`), we compute the length in a somewhat
@@ -3105,17 +3105,17 @@ macro_rules! len {
#![allow(unused_unsafe)] // we're sometimes used within an unsafe block
let start = $self.ptr;
- let size = size_from_ptr(start);
+ let size = size_from_ptr(start.as_ptr());
if size == 0 {
// This _cannot_ use `unchecked_sub` because we depend on wrapping
// to represent the length of long ZST slice iterators.
- ($self.end as usize).wrapping_sub(start as usize)
+ ($self.end as usize).wrapping_sub(start.as_ptr() as usize)
} else {
// We know that `start <= end`, so can do better than `offset_from`,
// which needs to deal in signed. By setting appropriate flags here
// we can tell LLVM this, which helps it remove bounds checks.
// SAFETY: By the type invariant, `start <= end`
- let diff = unsafe { unchecked_sub($self.end as usize, start as usize) };
+ let diff = unsafe { unchecked_sub($self.end as usize, start.as_ptr() as usize) };
// By also telling LLVM that the pointers are apart by an exact
// multiple of the type size, it can optimize `len() == 0` down to
// `start == end` instead of `(end - start) < size`.
@@ -3161,7 +3161,7 @@ macro_rules! iterator {
// Helper function for creating a slice from the iterator.
#[inline(always)]
fn make_slice(&self) -> &'a [T] {
- unsafe { from_raw_parts(self.ptr, len!(self)) }
+ unsafe { from_raw_parts(self.ptr.as_ptr(), len!(self)) }
}
// Helper function for moving the start of the iterator forwards by `offset` elements,
@@ -3171,10 +3171,10 @@ macro_rules! iterator {
unsafe fn post_inc_start(&mut self, offset: isize) -> * $raw_mut T {
if mem::size_of::() == 0 {
zst_shrink!(self, offset);
- self.ptr
+ self.ptr.as_ptr()
} else {
- let old = self.ptr;
- self.ptr = self.ptr.offset(offset);
+ let old = self.ptr.as_ptr();
+ self.ptr = NonNull::new_unchecked(self.ptr.as_ptr().offset(offset));
old
}
}
@@ -3186,7 +3186,7 @@ macro_rules! iterator {
unsafe fn pre_dec_end(&mut self, offset: isize) -> * $raw_mut T {
if mem::size_of::() == 0 {
zst_shrink!(self, offset);
- self.ptr
+ self.ptr.as_ptr()
} else {
self.end = self.end.offset(-offset);
self.end
@@ -3215,7 +3215,7 @@ macro_rules! iterator {
fn next(&mut self) -> Option<$elem> {
// could be implemented with slices, but this avoids bounds checks
unsafe {
- assume(!self.ptr.is_null());
+ assume(!self.ptr.as_ptr().is_null());
if mem::size_of::() != 0 {
assume(!self.end.is_null());
}
@@ -3245,9 +3245,12 @@ macro_rules! iterator {
if mem::size_of::() == 0 {
// We have to do it this way as `ptr` may never be 0, but `end`
// could be (due to wrapping).
- self.end = self.ptr;
+ self.end = self.ptr.as_ptr();
} else {
- self.ptr = self.end;
+ unsafe {
+ // End can't be 0 if T isn't ZST because ptr isn't 0 and end >= ptr
+ self.ptr = NonNull::new_unchecked(self.end as *mut T);
+ }
}
return None;
}
@@ -3308,7 +3311,7 @@ macro_rules! iterator {
fn next_back(&mut self) -> Option<$elem> {
// could be implemented with slices, but this avoids bounds checks
unsafe {
- assume(!self.ptr.is_null());
+ assume(!self.ptr.as_ptr().is_null());
if mem::size_of::() != 0 {
assume(!self.end.is_null());
}
@@ -3324,7 +3327,7 @@ macro_rules! iterator {
fn nth_back(&mut self, n: usize) -> Option<$elem> {
if n >= len!(self) {
// This iterator is now empty.
- self.end = self.ptr;
+ self.end = self.ptr.as_ptr();
return None;
}
// We are in bounds. `pre_dec_end` does the right thing even for ZSTs.
@@ -3365,7 +3368,7 @@ macro_rules! iterator {
/// [slices]: ../../std/primitive.slice.html
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, T: 'a> {
- ptr: *const T,
+ ptr: NonNull,
end: *const T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that
// ptr == end is a quick test for the Iterator being empty, that works
// for both ZST and non-ZST.
@@ -3467,7 +3470,7 @@ impl AsRef<[T]> for Iter<'_, T> {
/// [slices]: ../../std/primitive.slice.html
#[stable(feature = "rust1", since = "1.0.0")]
pub struct IterMut<'a, T: 'a> {
- ptr: *mut T,
+ ptr: NonNull,
end: *mut T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that
// ptr == end is a quick test for the Iterator being empty, that works
// for both ZST and non-ZST.
@@ -3522,7 +3525,7 @@ impl<'a, T> IterMut<'a, T> {
/// ```
#[stable(feature = "iter_to_slice", since = "1.4.0")]
pub fn into_slice(self) -> &'a mut [T] {
- unsafe { from_raw_parts_mut(self.ptr, len!(self)) }
+ unsafe { from_raw_parts_mut(self.ptr.as_ptr(), len!(self)) }
}
/// Views the underlying data as a subslice of the original data.
@@ -5682,7 +5685,7 @@ impl_marker_for!(BytewiseEquality,
#[doc(hidden)]
unsafe impl<'a, T> TrustedRandomAccess for Iter<'a, T> {
unsafe fn get_unchecked(&mut self, i: usize) -> &'a T {
- &*self.ptr.add(i)
+ &*self.ptr.as_ptr().add(i)
}
fn may_have_side_effect() -> bool {
false
@@ -5692,7 +5695,7 @@ unsafe impl<'a, T> TrustedRandomAccess for Iter<'a, T> {
#[doc(hidden)]
unsafe impl<'a, T> TrustedRandomAccess for IterMut<'a, T> {
unsafe fn get_unchecked(&mut self, i: usize) -> &'a mut T {
- &mut *self.ptr.add(i)
+ &mut *self.ptr.as_ptr().add(i)
}
fn may_have_side_effect() -> bool {
false
diff --git a/src/libpanic_unwind/seh.rs b/src/libpanic_unwind/seh.rs
index 9a28c47ba9458..e1907ec4e5f32 100644
--- a/src/libpanic_unwind/seh.rs
+++ b/src/libpanic_unwind/seh.rs
@@ -41,7 +41,7 @@
//! are then recovered in the filter function to be written to the stack frame
//! of the `try` intrinsic.
//!
-//! [win64]: http://msdn.microsoft.com/en-us/library/1eyas8tf.aspx
+//! [win64]: https://docs.microsoft.com/en-us/cpp/build/exception-handling-x64
//! [llvm]: http://llvm.org/docs/ExceptionHandling.html#background-on-windows-exceptions
#![allow(nonstandard_style)]
diff --git a/src/librustc/mir/interpret/value.rs b/src/librustc/mir/interpret/value.rs
index 49b542af0a034..e8e1678561096 100644
--- a/src/librustc/mir/interpret/value.rs
+++ b/src/librustc/mir/interpret/value.rs
@@ -415,22 +415,30 @@ impl<'tcx, Tag> Scalar {
}
}
+ #[inline]
+ fn to_unsigned_with_bit_width(self, bits: u64) -> InterpResult<'static, u128> {
+ let sz = Size::from_bits(bits);
+ self.to_bits(sz)
+ }
+
+ /// Converts the scalar to produce an `u8`. Fails if the scalar is a pointer.
pub fn to_u8(self) -> InterpResult<'static, u8> {
- let sz = Size::from_bits(8);
- let b = self.to_bits(sz)?;
- Ok(b as u8)
+ self.to_unsigned_with_bit_width(8).map(|v| v as u8)
+ }
+
+ /// Converts the scalar to produce an `u16`. Fails if the scalar is a pointer.
+ pub fn to_u16(self) -> InterpResult<'static, u16> {
+ self.to_unsigned_with_bit_width(16).map(|v| v as u16)
}
+ /// Converts the scalar to produce an `u32`. Fails if the scalar is a pointer.
pub fn to_u32(self) -> InterpResult<'static, u32> {
- let sz = Size::from_bits(32);
- let b = self.to_bits(sz)?;
- Ok(b as u32)
+ self.to_unsigned_with_bit_width(32).map(|v| v as u32)
}
+ /// Converts the scalar to produce an `u64`. Fails if the scalar is a pointer.
pub fn to_u64(self) -> InterpResult<'static, u64> {
- let sz = Size::from_bits(64);
- let b = self.to_bits(sz)?;
- Ok(b as u64)
+ self.to_unsigned_with_bit_width(64).map(|v| v as u64)
}
pub fn to_machine_usize(self, cx: &impl HasDataLayout) -> InterpResult<'static, u64> {
@@ -438,25 +446,31 @@ impl<'tcx, Tag> Scalar {
Ok(b as u64)
}
- pub fn to_i8(self) -> InterpResult<'static, i8> {
- let sz = Size::from_bits(8);
+ #[inline]
+ fn to_signed_with_bit_width(self, bits: u64) -> InterpResult<'static, i128> {
+ let sz = Size::from_bits(bits);
let b = self.to_bits(sz)?;
- let b = sign_extend(b, sz) as i128;
- Ok(b as i8)
+ Ok(sign_extend(b, sz) as i128)
+ }
+
+ /// Converts the scalar to produce an `i8`. Fails if the scalar is a pointer.
+ pub fn to_i8(self) -> InterpResult<'static, i8> {
+ self.to_signed_with_bit_width(8).map(|v| v as i8)
+ }
+
+ /// Converts the scalar to produce an `i16`. Fails if the scalar is a pointer.
+ pub fn to_i16(self) -> InterpResult<'static, i16> {
+ self.to_signed_with_bit_width(16).map(|v| v as i16)
}
+ /// Converts the scalar to produce an `i32`. Fails if the scalar is a pointer.
pub fn to_i32(self) -> InterpResult<'static, i32> {
- let sz = Size::from_bits(32);
- let b = self.to_bits(sz)?;
- let b = sign_extend(b, sz) as i128;
- Ok(b as i32)
+ self.to_signed_with_bit_width(32).map(|v| v as i32)
}
+ /// Converts the scalar to produce an `i64`. Fails if the scalar is a pointer.
pub fn to_i64(self) -> InterpResult<'static, i64> {
- let sz = Size::from_bits(64);
- let b = self.to_bits(sz)?;
- let b = sign_extend(b, sz) as i128;
- Ok(b as i64)
+ self.to_signed_with_bit_width(64).map(|v| v as i64)
}
pub fn to_machine_isize(self, cx: &impl HasDataLayout) -> InterpResult<'static, i64> {
diff --git a/src/librustc_codegen_llvm/metadata.rs b/src/librustc_codegen_llvm/metadata.rs
index d328144a15e12..abe34bb148ce5 100644
--- a/src/librustc_codegen_llvm/metadata.rs
+++ b/src/librustc_codegen_llvm/metadata.rs
@@ -97,7 +97,7 @@ pub fn metadata_section_name(target: &Target) -> &'static str {
// > Executable images do not use a string table and do not support
// > section names longer than 8 characters
//
- // https://msdn.microsoft.com/en-us/library/windows/hardware/gg463119.aspx
+ // https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
//
// As a result, we choose a slightly shorter name! As to why
// `.note.rustc` works on MinGW, that's another good question...
diff --git a/src/librustc_codegen_ssa/back/command.rs b/src/librustc_codegen_ssa/back/command.rs
index 5595386be2431..dcc16416e5e87 100644
--- a/src/librustc_codegen_ssa/back/command.rs
+++ b/src/librustc_codegen_ssa/back/command.rs
@@ -168,8 +168,8 @@ impl Command {
// error code if we fail to spawn and automatically re-spawning the
// linker with smaller arguments.
//
- // [1]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
- // [2]: https://blogs.msdn.microsoft.com/oldnewthing/20031210-00/?p=41553
+ // [1]: https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa
+ // [2]: https://devblogs.microsoft.com/oldnewthing/?p=41553
let estimated_command_line_len = self.args.iter().map(|a| a.len()).sum::();
estimated_command_line_len > 1024 * 6
diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs
index f3420f9a9f9fd..c7a599a5749b7 100644
--- a/src/librustc_codegen_ssa/back/link.rs
+++ b/src/librustc_codegen_ssa/back/link.rs
@@ -1044,7 +1044,7 @@ pub fn exec_linker(
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.is_like_msvc {
// This is "documented" at
- // https://msdn.microsoft.com/en-us/library/4xdcbak7.aspx
+ // https://docs.microsoft.com/en-us/cpp/build/reference/at-specify-a-linker-response-file
//
// Unfortunately there's not a great specification of the
// syntax I could find online (at least) but some local
diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs
index e856be0eeb3fc..a89b170c649f6 100644
--- a/src/librustc_codegen_ssa/mir/block.rs
+++ b/src/librustc_codegen_ssa/mir/block.rs
@@ -618,14 +618,17 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
if let mir::PlaceRef {
base:
&PlaceBase::Static(box Static {
- kind: StaticKind::Promoted(promoted, _),
+ kind: StaticKind::Promoted(promoted, substs),
ty,
- def_id: _,
+ def_id,
}),
projection: &[],
} = place.as_ref()
{
- let c = bx.tcx().const_eval_promoted(self.instance, promoted);
+ let c = bx.tcx().const_eval_promoted(
+ Instance::new(def_id, self.monomorphize(&substs)),
+ promoted,
+ );
let (llval, ty) = self.simd_shuffle_indices(
&bx,
terminator.source_info.span,
diff --git a/src/librustc_target/abi/call/x86_win64.rs b/src/librustc_target/abi/call/x86_win64.rs
index f08a7c5063e03..2aad641b1ecf0 100644
--- a/src/librustc_target/abi/call/x86_win64.rs
+++ b/src/librustc_target/abi/call/x86_win64.rs
@@ -1,7 +1,7 @@
use crate::abi::call::{ArgAbi, FnAbi, Reg};
use crate::abi::Abi;
-// Win64 ABI: http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx
+// Win64 ABI: https://docs.microsoft.com/en-us/cpp/build/parameter-passing
pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
let fixup = |a: &mut ArgAbi<'_, Ty>| {
diff --git a/src/librustc_target/spec/i686_pc_windows_msvc.rs b/src/librustc_target/spec/i686_pc_windows_msvc.rs
index 195c00d684f7d..b160007e0621a 100644
--- a/src/librustc_target/spec/i686_pc_windows_msvc.rs
+++ b/src/librustc_target/spec/i686_pc_windows_msvc.rs
@@ -11,7 +11,7 @@ pub fn target() -> TargetResult {
// Ensure the linker will only produce an image if it can also produce a table of
// the image's safe exception handlers.
- // https://msdn.microsoft.com/en-us/library/9a89h429.aspx
+ // https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap().push("/SAFESEH".to_string());
Ok(Target {
diff --git a/src/libstd/env.rs b/src/libstd/env.rs
index 52eebcfcb94c0..60facd9f8d468 100644
--- a/src/libstd/env.rs
+++ b/src/libstd/env.rs
@@ -552,7 +552,7 @@ impl Error for JoinPathsError {
/// (including to an empty string).
/// - If both do not exist, [`GetUserProfileDirectory`][msdn] is used to return the path.
///
-/// [msdn]: https://msdn.microsoft.com/en-us/library/windows/desktop/bb762280(v=vs.85).aspx
+/// [msdn]: https://docs.microsoft.com/en-us/windows/win32/api/userenv/nf-userenv-getuserprofiledirectorya
///
/// # Examples
///
@@ -591,7 +591,7 @@ pub fn home_dir() -> Option {
/// This behavior is identical to that of [`GetTempPath`][msdn], which this
/// function uses internally.
///
-/// [msdn]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa364992(v=vs.85).aspx
+/// [msdn]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppatha
///
/// ```no_run
/// use std::env;
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs
index 01e57ec0ab941..cff7bbe5ef183 100644
--- a/src/libstd/fs.rs
+++ b/src/libstd/fs.rs
@@ -1841,7 +1841,7 @@ pub fn read_link>(path: P) -> io::Result {
/// or written to a file another application may read).
///
/// [changes]: ../io/index.html#platform-specific-behavior
-/// [path]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath
+/// [path]: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
///
/// # Errors
///
diff --git a/src/libstd/sys/windows/ext/fs.rs b/src/libstd/sys/windows/ext/fs.rs
index 0462f889a8e54..d508a333484ae 100644
--- a/src/libstd/sys/windows/ext/fs.rs
+++ b/src/libstd/sys/windows/ext/fs.rs
@@ -117,7 +117,7 @@ pub trait OpenOptionsExt {
/// let file = OpenOptions::new().access_mode(0).open("foo.txt");
/// ```
///
- /// [`CreateFile`]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx
+ /// [`CreateFile`]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea
#[stable(feature = "open_options_ext", since = "1.10.0")]
fn access_mode(&mut self, access: u32) -> &mut Self;
@@ -145,7 +145,7 @@ pub trait OpenOptionsExt {
/// .open("foo.txt");
/// ```
///
- /// [`CreateFile`]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx
+ /// [`CreateFile`]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea
#[stable(feature = "open_options_ext", since = "1.10.0")]
fn share_mode(&mut self, val: u32) -> &mut Self;
@@ -174,8 +174,8 @@ pub trait OpenOptionsExt {
/// .open("foo.txt");
/// ```
///
- /// [`CreateFile`]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx
- /// [`CreateFile2`]: https://msdn.microsoft.com/en-us/library/windows/desktop/hh449422.aspx
+ /// [`CreateFile`]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea
+ /// [`CreateFile2`]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfile2
#[stable(feature = "open_options_ext", since = "1.10.0")]
fn custom_flags(&mut self, flags: u32) -> &mut Self;
@@ -211,8 +211,8 @@ pub trait OpenOptionsExt {
/// .open("foo.txt");
/// ```
///
- /// [`CreateFile`]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx
- /// [`CreateFile2`]: https://msdn.microsoft.com/en-us/library/windows/desktop/hh449422.aspx
+ /// [`CreateFile`]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea
+ /// [`CreateFile2`]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfile2
#[stable(feature = "open_options_ext", since = "1.10.0")]
fn attributes(&mut self, val: u32) -> &mut Self;
@@ -254,10 +254,10 @@ pub trait OpenOptionsExt {
/// .open(r"\\.\pipe\MyPipe");
/// ```
///
- /// [`CreateFile`]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx
- /// [`CreateFile2`]: https://msdn.microsoft.com/en-us/library/windows/desktop/hh449422.aspx
+ /// [`CreateFile`]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea
+ /// [`CreateFile2`]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfile2
/// [Impersonation Levels]:
- /// https://msdn.microsoft.com/en-us/library/windows/desktop/aa379572.aspx
+ /// https://docs.microsoft.com/en-us/windows/win32/api/winnt/ne-winnt-security_impersonation_level
#[stable(feature = "open_options_ext", since = "1.10.0")]
fn security_qos_flags(&mut self, flags: u32) -> &mut OpenOptions;
}
@@ -297,7 +297,7 @@ impl OpenOptionsExt for OpenOptions {
///
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
/// [`BY_HANDLE_FILE_INFORMATION`]:
-/// https://msdn.microsoft.com/en-us/library/windows/desktop/aa363788.aspx
+/// https://docs.microsoft.com/en-us/windows/win32/api/fileapi/ns-fileapi-by_handle_file_information
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Returns the value of the `dwFileAttributes` field of this metadata.
@@ -321,7 +321,7 @@ pub trait MetadataExt {
/// ```
///
/// [File Attribute Constants]:
- /// https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117.aspx
+ /// https://docs.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
#[stable(feature = "metadata_ext", since = "1.1.0")]
fn file_attributes(&self) -> u32;
@@ -350,7 +350,7 @@ pub trait MetadataExt {
/// }
/// ```
///
- /// [`FILETIME`]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724284.aspx
+ /// [`FILETIME`]: https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime
#[stable(feature = "metadata_ext", since = "1.1.0")]
fn creation_time(&self) -> u64;
@@ -385,7 +385,7 @@ pub trait MetadataExt {
/// }
/// ```
///
- /// [`FILETIME`]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724284.aspx
+ /// [`FILETIME`]: https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime
#[stable(feature = "metadata_ext", since = "1.1.0")]
fn last_access_time(&self) -> u64;
@@ -418,7 +418,7 @@ pub trait MetadataExt {
/// }
/// ```
///
- /// [`FILETIME`]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724284.aspx
+ /// [`FILETIME`]: https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime
#[stable(feature = "metadata_ext", since = "1.1.0")]
fn last_write_time(&self) -> u64;
diff --git a/src/libstd/sys/windows/ext/process.rs b/src/libstd/sys/windows/ext/process.rs
index ed35c5ff19446..8c34a9faf1d4a 100644
--- a/src/libstd/sys/windows/ext/process.rs
+++ b/src/libstd/sys/windows/ext/process.rs
@@ -99,7 +99,7 @@ pub trait CommandExt {
///
/// These will always be ORed with `CREATE_UNICODE_ENVIRONMENT`.
///
- /// [1]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
+ /// [1]: https://docs.microsoft.com/en-us/windows/win32/procthread/process-creation-flags
#[stable(feature = "windows_process_extensions", since = "1.16.0")]
fn creation_flags(&mut self, flags: u32) -> &mut process::Command;
}
diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs
index a515b382ab02a..b004cd19020f8 100644
--- a/src/libstd/sys/windows/mod.rs
+++ b/src/libstd/sys/windows/mod.rs
@@ -262,7 +262,7 @@ pub fn dur2timeout(dur: Duration) -> c::DWORD {
// terminating the process but without necessarily bypassing all exception
// handlers.
//
-// https://msdn.microsoft.com/en-us/library/dn774154.aspx
+// https://docs.microsoft.com/en-us/cpp/intrinsics/fastfail
#[allow(unreachable_code)]
pub unsafe fn abort_internal() -> ! {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs
index e0a1d2f4c0e20..e7fa61dd0f6b9 100644
--- a/src/libstd/sys/windows/os.rs
+++ b/src/libstd/sys/windows/os.rs
@@ -34,7 +34,7 @@ pub fn error_string(mut errnum: i32) -> String {
// NTSTATUS errors may be encoded as HRESULT, which may returned from
// GetLastError. For more information about Windows error codes, see
- // `[MS-ERREF]`: https://msdn.microsoft.com/en-us/library/cc231198.aspx
+ // `[MS-ERREF]`: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a
if (errnum & c::FACILITY_NT_BIT as i32) != 0 {
// format according to https://support.microsoft.com/en-us/help/259693
const NTDLL_DLL: &[u16] = &[
diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs
index 7318ced676a4c..d2e3b07ab855d 100644
--- a/src/libterm/lib.rs
+++ b/src/libterm/lib.rs
@@ -27,7 +27,7 @@
//! ```
//!
//! [ansi]: https://en.wikipedia.org/wiki/ANSI_escape_code
-//! [win]: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682010%28v=vs.85%29.aspx
+//! [win]: https://docs.microsoft.com/en-us/windows/console/character-mode-applications
//! [ti]: https://en.wikipedia.org/wiki/Terminfo
#![doc(
diff --git a/src/libterm/win.rs b/src/libterm/win.rs
index a789d739ab174..b6c607a30816c 100644
--- a/src/libterm/win.rs
+++ b/src/libterm/win.rs
@@ -101,7 +101,7 @@ impl WinConsole {
unsafe {
// Magic -11 means stdout, from
- // http://msdn.microsoft.com/en-us/library/windows/desktop/ms683231%28v=vs.85%29.aspx
+ // https://docs.microsoft.com/en-us/windows/console/getstdhandle
//
// You may be wondering, "but what about stderr?", and the answer
// to that is that setting terminal attributes on the stdout
diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557-ice.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557-ice.rs
new file mode 100644
index 0000000000000..4c09ae25c5f3e
--- /dev/null
+++ b/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557-ice.rs
@@ -0,0 +1,25 @@
+// This used to cause an ICE for an internal index out of range due to simd_shuffle_indices being
+// passed the wrong Instance, causing issues with inlining. See #67557.
+//
+// run-pass
+// compile-flags: -Zmir-opt-level=3
+#![feature(platform_intrinsics, repr_simd)]
+
+extern "platform-intrinsic" {
+ fn simd_shuffle2(x: T, y: T, idx: [u32; 2]) -> U;
+}
+
+#[repr(simd)]
+#[derive(Debug, PartialEq)]
+struct Simd2(u8, u8);
+
+fn main() {
+ unsafe {
+ let _: Simd2 = inline_me();
+ }
+}
+
+#[inline(always)]
+unsafe fn inline_me() -> Simd2 {
+ simd_shuffle2(Simd2(10, 11), Simd2(12, 13), [0, 3])
+}
diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557.rs
new file mode 100644
index 0000000000000..7a0d955686bb6
--- /dev/null
+++ b/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557.rs
@@ -0,0 +1,40 @@
+// This used to cause assert_10_13 to unexpectingly fail, due to simd_shuffle_indices being passed
+// the wrong Instance, causing issues with inlining. See #67557.
+//
+// run-pass
+// compile-flags: -Zmir-opt-level=3
+#![feature(platform_intrinsics, repr_simd)]
+
+extern "platform-intrinsic" {
+ fn simd_shuffle2(x: T, y: T, idx: [u32; 2]) -> U;
+}
+
+#[repr(simd)]
+#[derive(Debug, PartialEq)]
+struct Simd2(u8, u8);
+
+fn main() {
+ unsafe {
+ let p_res: Simd2 = simd_shuffle2(Simd2(10, 11), Simd2(12, 13), [0, 1]);
+ let a_res: Simd2 = inline_me();
+
+ assert_10_11(p_res);
+ assert_10_13(a_res);
+ }
+}
+
+#[inline(never)]
+fn assert_10_11(x: Simd2) {
+ assert_eq!(x, Simd2(10, 11));
+}
+
+#[inline(never)]
+fn assert_10_13(x: Simd2) {
+ assert_eq!(x, Simd2(10, 13));
+}
+
+
+#[inline(always)]
+unsafe fn inline_me() -> Simd2 {
+ simd_shuffle2(Simd2(10, 11), Simd2(12, 13), [0, 3])
+}