diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md index 70c7acccd3638..0dc81378e05b2 100644 --- a/src/doc/rustc/src/codegen-options/index.md +++ b/src/doc/rustc/src/codegen-options/index.md @@ -197,7 +197,11 @@ in software. ## prefer-dynamic By default, `rustc` prefers to statically link dependencies. This option will -make it use dynamic linking instead. +indicate that dynamic linking should be used if possible if both a static and +dynamic versions of a library are available. There is an internal algorithm +for determining whether or not it is possible to statically or dynamically +link with a dependency. For example, `cdylib` crate types may only use static +linkage. ## no-integrated-as diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index 79b4f7542f9b0..ee04a769e123e 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -20,9 +20,9 @@ to `#[cfg(verbose)]` and `#[cfg(feature = "serde")]` respectively. ## `-L`: add a directory to the library search path + -When looking for external crates or libraries, a directory passed to this flag -will be searched. +The `-L` flag adds a path to search for external crates and libraries. The kind of search path can optionally be specified with the form `-L KIND=PATH` where `KIND` may be one of: @@ -262,9 +262,30 @@ This flag, when combined with other flags, makes them produce extra output. ## `--extern`: specify where an external library is located -This flag allows you to pass the name and location of an external crate that -will be linked into the crate you are building. This flag may be specified -multiple times. The format of the value should be `CRATENAME=PATH`. +This flag allows you to pass the name and location for an external crate of a +direct dependency. Indirect dependencies (dependencies of dependencies) are +located using the [`-L` flag](#option-l-search-path). The given crate name is +added to the [extern prelude], which is the same as specifying `extern crate` +within the root module. The given crate name does not need to match the name +the library was built with. + +This flag may be specified multiple times. This flag takes an argument with +either of the following formats: + +* `CRATENAME=PATH` — Indicates the given crate is found at the given path. +* `CRATENAME` — Indicates the given crate may be found in the search path, + such as within the sysroot or via the `-L` flag. + +The same crate name may be specified multiple times for different crate types. +If both an `rlib` and `dylib` are found, an internal algorithm is used to +decide which to use for linking. The [`-C prefer-dynamic` +flag][prefer-dynamic] may be used to influence which is used. + +If the same crate name is specified with and without a path, the one with the +path is used and the pathless flag has no effect. + +[extern prelude]: ../reference/items/extern-crates.html#extern-prelude +[prefer-dynamic]: codegen-options/index.md#prefer-dynamic ## `--sysroot`: Override the system root diff --git a/src/etc/generate-deriving-span-tests.py b/src/etc/generate-deriving-span-tests.py index 66a3c8e555405..39c24fb10e590 100755 --- a/src/etc/generate-deriving-span-tests.py +++ b/src/etc/generate-deriving-span-tests.py @@ -14,8 +14,7 @@ os.path.join(os.path.dirname(__file__), '../test/ui/derives/')) TEMPLATE = """\ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' {error_deriving} diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs index 5d0333d5226d2..1b06baeb711c2 100644 --- a/src/libcore/alloc.rs +++ b/src/libcore/alloc.rs @@ -1,5 +1,7 @@ //! Memory allocation APIs +// ignore-tidy-undocumented-unsafe + #![stable(feature = "alloc_module", since = "1.28.0")] use crate::cmp; diff --git a/src/libcore/any.rs b/src/libcore/any.rs index e2704e807d104..39a5dd7263ccf 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -182,6 +182,7 @@ impl dyn Any { #[inline] pub fn downcast_ref(&self) -> Option<&T> { if self.is::() { + // SAFETY: just checked whether we are pointing to the correct type unsafe { Some(&*(self as *const dyn Any as *const T)) } @@ -217,6 +218,7 @@ impl dyn Any { #[inline] pub fn downcast_mut(&mut self) -> Option<&mut T> { if self.is::() { + // SAFETY: just checked whether we are pointing to the correct type unsafe { Some(&mut *(self as *mut dyn Any as *mut T)) } @@ -424,7 +426,11 @@ impl TypeId { #[rustc_const_unstable(feature="const_type_id")] pub const fn of() -> TypeId { TypeId { + #[cfg(bootstrap)] + // SAFETY: going away soon t: unsafe { intrinsics::type_id::() }, + #[cfg(not(bootstrap))] + t: intrinsics::type_id::(), } } } diff --git a/src/libcore/array/iter.rs b/src/libcore/array/iter.rs index 11803238407c8..307e9b90ee2c0 100644 --- a/src/libcore/array/iter.rs +++ b/src/libcore/array/iter.rs @@ -51,7 +51,7 @@ where /// iterator (either via `IntoIterator` for arrays or via another way). #[unstable(feature = "array_value_iter", issue = "65798")] pub fn new(array: [T; N]) -> Self { - // The transmute here is actually safe. The docs of `MaybeUninit` + // SAFETY: The transmute here is actually safe. The docs of `MaybeUninit` // promise: // // > `MaybeUninit` is guaranteed to have the same size and alignment @@ -84,10 +84,10 @@ where /// Returns an immutable slice of all elements that have not been yielded /// yet. fn as_slice(&self) -> &[T] { - // This transmute is safe. As mentioned in `new`, `MaybeUninit` retains + let slice = &self.data[self.alive.clone()]; + // SAFETY: This transmute is safe. As mentioned in `new`, `MaybeUninit` retains // the size and alignment of `T`. Furthermore, we know that all // elements within `alive` are properly initialized. - let slice = &self.data[self.alive.clone()]; unsafe { mem::transmute::<&[MaybeUninit], &[T]>(slice) } @@ -117,7 +117,8 @@ where let idx = self.alive.start; self.alive.start += 1; - // Read the element from the array. This is safe: `idx` is an index + // Read the element from the array. + // SAFETY: This is safe: `idx` is an index // into the "alive" region of the array. Reading this element means // that `data[idx]` is regarded as dead now (i.e. do not touch). As // `idx` was the start of the alive-zone, the alive zone is now @@ -163,7 +164,8 @@ where // + 1]`. self.alive.end -= 1; - // Read the element from the array. This is safe: `alive.end` is an + // Read the element from the array. + // SAFETY: This is safe: `alive.end` is an // index into the "alive" region of the array. Compare the previous // comment that states that the alive region is // `data[alive.start..alive.end + 1]`. Reading this element means that @@ -226,6 +228,7 @@ where [T; N]: LengthAtMost32, { fn clone(&self) -> Self { + // SAFETY: each point of unsafety is documented inside the unsafe block unsafe { // This creates a new uninitialized array. Note that the `assume_init` // refers to the array, not the individual elements. And it is Ok if diff --git a/src/libcore/array/mod.rs b/src/libcore/array/mod.rs index e1ec8b795d04c..74a7d062d3f4a 100644 --- a/src/libcore/array/mod.rs +++ b/src/libcore/array/mod.rs @@ -156,6 +156,7 @@ where fn try_from(slice: &[T]) -> Result<&[T; N], TryFromSliceError> { if slice.len() == N { let ptr = slice.as_ptr() as *const [T; N]; + // SAFETY: ok because we just checked that the length fits unsafe { Ok(&*ptr) } } else { Err(TryFromSliceError(())) @@ -173,6 +174,7 @@ where fn try_from(slice: &mut [T]) -> Result<&mut [T; N], TryFromSliceError> { if slice.len() == N { let ptr = slice.as_mut_ptr() as *mut [T; N]; + // SAFETY: ok because we just checked that the length fits unsafe { Ok(&mut *ptr) } } else { Err(TryFromSliceError(())) diff --git a/src/libcore/ascii.rs b/src/libcore/ascii.rs index 4087333e2cf6d..9b588525bd698 100644 --- a/src/libcore/ascii.rs +++ b/src/libcore/ascii.rs @@ -135,6 +135,7 @@ impl FusedIterator for EscapeDefault {} #[stable(feature = "ascii_escape_display", since = "1.39.0")] impl fmt::Display for EscapeDefault { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + // SAFETY: ok because `escape_default` created only valid utf-8 data f.write_str(unsafe { from_utf8_unchecked(&self.data[self.range.clone()]) }) } } diff --git a/src/libcore/benches/ascii.rs b/src/libcore/benches/ascii.rs index a337c46713133..e921dd1ba0636 100644 --- a/src/libcore/benches/ascii.rs +++ b/src/libcore/benches/ascii.rs @@ -118,6 +118,7 @@ benches! { } fn case07_fake_simd_u32(bytes: &mut [u8]) { + // SAFETY: transmuting a sequence of `u8` to `u32` is always fine let (before, aligned, after) = unsafe { bytes.align_to_mut::() }; @@ -142,6 +143,7 @@ benches! { } fn case08_fake_simd_u64(bytes: &mut [u8]) { + // SAFETY: transmuting a sequence of `u8` to `u64` is always fine let (before, aligned, after) = unsafe { bytes.align_to_mut::() }; diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 817c04d0af924..87d8e7aff058d 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -187,6 +187,8 @@ //! ``` //! +// ignore-tidy-undocumented-unsafe + #![stable(feature = "rust1", since = "1.0.0")] use crate::cmp::Ordering; diff --git a/src/libcore/char/convert.rs b/src/libcore/char/convert.rs index c456e14db12d4..28f5207449561 100644 --- a/src/libcore/char/convert.rs +++ b/src/libcore/char/convert.rs @@ -224,6 +224,7 @@ impl TryFrom for char { if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) { Err(CharTryFromError(())) } else { + // SAFETY: checked that it's a legal unicode value Ok(unsafe { from_u32_unchecked(i) }) } } diff --git a/src/libcore/char/decode.rs b/src/libcore/char/decode.rs index b71c9c2c40b37..ae09251c776de 100644 --- a/src/libcore/char/decode.rs +++ b/src/libcore/char/decode.rs @@ -87,7 +87,7 @@ impl> Iterator for DecodeUtf16 { }; if u < 0xD800 || 0xDFFF < u { - // not a surrogate + // SAFETY: not a surrogate Some(Ok(unsafe { from_u32_unchecked(u as u32) })) } else if u >= 0xDC00 { // a trailing surrogate @@ -107,6 +107,7 @@ impl> Iterator for DecodeUtf16 { // all ok, so lets decode it. let c = (((u - 0xD800) as u32) << 10 | (u2 - 0xDC00) as u32) + 0x1_0000; + // SAFETY: we checked that it's a legal unicode value Some(Ok(unsafe { from_u32_unchecked(c) })) } } diff --git a/src/libcore/char/methods.rs b/src/libcore/char/methods.rs index 971d89e004446..c048bab287dd2 100644 --- a/src/libcore/char/methods.rs +++ b/src/libcore/char/methods.rs @@ -438,6 +438,7 @@ impl char { #[inline] pub fn encode_utf8(self, dst: &mut [u8]) -> &mut str { let code = self as u32; + // SAFETY: each arm checks the size of the slice and only uses `get_unchecked` unsafe ops unsafe { let len = if code < MAX_ONE_B && !dst.is_empty() { *dst.get_unchecked_mut(0) = code as u8; @@ -507,6 +508,7 @@ impl char { #[inline] pub fn encode_utf16(self, dst: &mut [u16]) -> &mut [u16] { let mut code = self as u32; + // SAFETY: each arm checks whether there are enough bits to write into unsafe { if (code & 0xFFFF) == code && !dst.is_empty() { // The BMP falls through (assuming non-surrogate, as it should) diff --git a/src/libcore/ffi.rs b/src/libcore/ffi.rs index 569c667ac0a54..499dd0facd38c 100644 --- a/src/libcore/ffi.rs +++ b/src/libcore/ffi.rs @@ -315,6 +315,7 @@ impl<'f> Clone for VaListImpl<'f> { #[inline] fn clone(&self) -> Self { let mut dest = crate::mem::MaybeUninit::uninit(); + // SAFETY: we write to the `MaybeUninit`, thus it is initialized and `assume_init` is legal unsafe { va_copy(dest.as_mut_ptr(), self); dest.assume_init() diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index a2fff913ac720..b52b56b1bdbc2 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -2,6 +2,8 @@ use crate::fmt::{Formatter, Result, LowerExp, UpperExp, Display, Debug}; use crate::mem::MaybeUninit; use crate::num::flt2dec; +// ignore-tidy-undocumented-unsafe + // Don't inline this so callers don't use the stack space this function // requires unless they have to. #[inline(never)] diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 0e83a282b18f7..5a039144f667f 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -1,5 +1,7 @@ //! Utilities for formatting and printing strings. +// ignore-tidy-undocumented-unsafe + #![stable(feature = "rust1", since = "1.0.0")] use crate::cell::{UnsafeCell, Cell, RefCell, Ref, RefMut}; diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index 3b5c9fbff250a..3c7aefc090f8e 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -1,5 +1,7 @@ //! Integer and floating-point number formatting +// ignore-tidy-undocumented-unsafe + use crate::fmt; use crate::ops::{Div, Rem, Sub}; diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index 020e085abf8a8..0082363692df6 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -79,6 +79,8 @@ //! } //! ``` +// ignore-tidy-undocumented-unsafe + #![stable(feature = "rust1", since = "1.0.0")] use crate::fmt; diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs index 19aeafd882ef1..194d9e6e2f8ad 100644 --- a/src/libcore/hash/sip.rs +++ b/src/libcore/hash/sip.rs @@ -1,5 +1,7 @@ //! An implementation of SipHash. +// ignore-tidy-undocumented-unsafe + #![allow(deprecated)] // the types in this module are deprecated use crate::marker::PhantomData; diff --git a/src/libcore/hint.rs b/src/libcore/hint.rs index 368a2f16b281e..f68a3e5a76fd7 100644 --- a/src/libcore/hint.rs +++ b/src/libcore/hint.rs @@ -2,6 +2,8 @@ //! Hints to compiler that affects how code should be emitted or optimized. +// ignore-tidy-undocumented-unsafe + use crate::intrinsics; /// Informs the compiler that this point in the code is not reachable, enabling diff --git a/src/libcore/iter/adapters/mod.rs b/src/libcore/iter/adapters/mod.rs index 3b8edc2ad6177..39d571006e66a 100644 --- a/src/libcore/iter/adapters/mod.rs +++ b/src/libcore/iter/adapters/mod.rs @@ -517,8 +517,18 @@ impl Iterator for StepBy where I: Iterator { // overflow handling loop { let mul = n.checked_mul(step); - if unsafe { intrinsics::likely(mul.is_some()) } { - return self.iter.nth(mul.unwrap() - 1); + #[cfg(bootstrap)] + { + // SAFETY: going away soon + if unsafe { intrinsics::likely(mul.is_some()) } { + return self.iter.nth(mul.unwrap() - 1); + } + } + #[cfg(not(bootstrap))] + { + if intrinsics::likely(mul.is_some()) { + return self.iter.nth(mul.unwrap() - 1); + } } let div_n = usize::MAX / n; let div_step = usize::MAX / step; diff --git a/src/libcore/iter/adapters/zip.rs b/src/libcore/iter/adapters/zip.rs index 430ceacdd9fab..14d9d5499b880 100644 --- a/src/libcore/iter/adapters/zip.rs +++ b/src/libcore/iter/adapters/zip.rs @@ -1,3 +1,5 @@ +// ignore-tidy-undocumented-unsafe + use crate::cmp; use super::super::{Iterator, DoubleEndedIterator, ExactSizeIterator, FusedIterator, TrustedLen}; diff --git a/src/libcore/mem/maybe_uninit.rs b/src/libcore/mem/maybe_uninit.rs index 03093139bc2f9..4b3dc1c83c41d 100644 --- a/src/libcore/mem/maybe_uninit.rs +++ b/src/libcore/mem/maybe_uninit.rs @@ -1,6 +1,8 @@ use crate::intrinsics; use crate::mem::ManuallyDrop; +// ignore-tidy-undocumented-unsafe + /// A wrapper type to construct uninitialized instances of `T`. /// /// # Initialization invariant diff --git a/src/libcore/mem/mod.rs b/src/libcore/mem/mod.rs index c7da56aad309a..26909be949664 100644 --- a/src/libcore/mem/mod.rs +++ b/src/libcore/mem/mod.rs @@ -93,6 +93,8 @@ pub fn forget(t: T) { #[inline] #[unstable(feature = "forget_unsized", issue = "0")] pub fn forget_unsized(t: T) { + // SAFETY: the forget intrinsic could be safe, but there's no point in making it safe since + // we'll be implementing this function soon via `ManuallyDrop` unsafe { intrinsics::forget(t) } } @@ -266,7 +268,11 @@ pub const fn size_of() -> usize { #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn size_of_val(val: &T) -> usize { + #[cfg(bootstrap)] + // SAFETY: going away soon unsafe { intrinsics::size_of_val(val) } + #[cfg(not(bootstrap))] + intrinsics::size_of_val(val) } /// Returns the [ABI]-required minimum alignment of a type. @@ -310,7 +316,11 @@ pub fn min_align_of() -> usize { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_deprecated(reason = "use `align_of_val` instead", since = "1.2.0")] pub fn min_align_of_val(val: &T) -> usize { + #[cfg(bootstrap)] + // SAFETY: going away soon unsafe { intrinsics::min_align_of_val(val) } + #[cfg(not(bootstrap))] + intrinsics::min_align_of_val(val) } /// Returns the [ABI]-required minimum alignment of a type. @@ -350,8 +360,9 @@ pub const fn align_of() -> usize { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] +#[allow(deprecated)] pub fn align_of_val(val: &T) -> usize { - unsafe { intrinsics::min_align_of_val(val) } + min_align_of_val(val) } /// Returns `true` if dropping values of type `T` matters. @@ -508,6 +519,8 @@ pub unsafe fn uninitialized() -> T { #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn swap(x: &mut T, y: &mut T) { + // SAFETY: the raw pointers have been created from safe mutable references satisfying all the + // constraints on `ptr::swap_nonoverlapping_one` unsafe { ptr::swap_nonoverlapping_one(x, y); } @@ -822,7 +835,11 @@ impl fmt::Debug for Discriminant { /// ``` #[stable(feature = "discriminant_value", since = "1.21.0")] pub fn discriminant(v: &T) -> Discriminant { + #[cfg(bootstrap)] + // SAFETY: going away soon unsafe { Discriminant(intrinsics::discriminant_value(v), PhantomData) } + #[cfg(not(bootstrap))] + Discriminant(intrinsics::discriminant_value(v), PhantomData) } diff --git a/src/libcore/num/dec2flt/algorithm.rs b/src/libcore/num/dec2flt/algorithm.rs index ed89852dc48da..641463026261d 100644 --- a/src/libcore/num/dec2flt/algorithm.rs +++ b/src/libcore/num/dec2flt/algorithm.rs @@ -58,6 +58,8 @@ mod fpu_precision { pub struct FPUControlWord(u16); fn set_cw(cw: u16) { + // SAFETY: the `fldcw` instruction has been audited to be able to work correctly with + // any `u16` unsafe { asm!("fldcw $0" :: "m" (cw) :: "volatile") } } @@ -74,6 +76,8 @@ mod fpu_precision { // Get the original value of the control word to restore it later, when the // `FPUControlWord` structure is dropped + // SAFETY: the `fnstcw` instruction has been audited to be able to work correctly with + // any `u16` unsafe { asm!("fnstcw $0" : "=*m" (&cw) ::: "volatile") } // Set the control word to the desired precision. This is achieved by masking away the old diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index 5730088c4d9a9..7662bba6b5e13 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -414,6 +414,7 @@ impl f32 { #[stable(feature = "float_bits_conv", since = "1.20.0")] #[inline] pub fn to_bits(self) -> u32 { + // SAFETY: `u32` is a plain old datatype so we can always transmute to it unsafe { mem::transmute(self) } } @@ -456,6 +457,7 @@ impl f32 { #[stable(feature = "float_bits_conv", since = "1.20.0")] #[inline] pub fn from_bits(v: u32) -> Self { + // SAFETY: `u32` is a plain old datatype so we can always transmute from it // It turns out the safety issues with sNaN were overblown! Hooray! unsafe { mem::transmute(v) } } diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index 2bdeda340dce0..4a2a35dfb0999 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -427,6 +427,7 @@ impl f64 { #[stable(feature = "float_bits_conv", since = "1.20.0")] #[inline] pub fn to_bits(self) -> u64 { + // SAFETY: `u64` is a plain old datatype so we can always transmute to it unsafe { mem::transmute(self) } } @@ -469,6 +470,7 @@ impl f64 { #[stable(feature = "float_bits_conv", since = "1.20.0")] #[inline] pub fn from_bits(v: u64) -> Self { + // SAFETY: `u64` is a plain old datatype so we can always transmute from it // It turns out the safety issues with sNaN were overblown! Hooray! unsafe { mem::transmute(v) } } diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index b4ade70414462..4b9e82c7cfee9 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -71,6 +71,7 @@ assert_eq!(size_of::>(), size_of::<", s #[inline] pub fn new(n: $Int) -> Option { if n != 0 { + // SAFETY: we just checked that there's no `0` Some(unsafe { $Ty(n) }) } else { None @@ -703,6 +704,7 @@ $EndFeature, " if rhs == 0 || (self == Self::min_value() && rhs == -1) { None } else { + // SAFETY: div by zero and by INT_MIN have been checked above Some(unsafe { intrinsics::unchecked_div(self, rhs) }) } } @@ -759,6 +761,7 @@ $EndFeature, " if rhs == 0 || (self == Self::min_value() && rhs == -1) { None } else { + // SAFETY: div by zero and by INT_MIN have been checked above Some(unsafe { intrinsics::unchecked_rem(self, rhs) }) } } @@ -1329,6 +1332,8 @@ $EndFeature, " without modifying the original"] #[inline] pub const fn wrapping_shl(self, rhs: u32) -> Self { + // SAFETY: the masking by the bitsize of the type ensures that we do not shift + // out of bounds unsafe { intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT) } @@ -1358,6 +1363,8 @@ $EndFeature, " without modifying the original"] #[inline] pub const fn wrapping_shr(self, rhs: u32) -> Self { + // SAFETY: the masking by the bitsize of the type ensures that we do not shift + // out of bounds unsafe { intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT) } @@ -2113,6 +2120,8 @@ assert_eq!( #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn to_ne_bytes(self) -> [u8; mem::size_of::()] { + // SAFETY: integers are plain old datatypes so we can always transmute them to + // arrays of bytes unsafe { mem::transmute(self) } } } @@ -2221,6 +2230,7 @@ fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn from_ne_bytes(bytes: [u8; mem::size_of::()]) -> Self { + // SAFETY: integers are plain old datatypes so we can always transmute to them unsafe { mem::transmute(bytes) } } } @@ -2748,6 +2758,8 @@ assert_eq!(1", stringify!($SelfT), ".checked_div(0), None);", $EndFeature, " pub fn checked_div(self, rhs: Self) -> Option { match rhs { 0 => None, + // SAFETY: div by zero has been checked above and unsigned types have no other + // failure modes for division rhs => Some(unsafe { intrinsics::unchecked_div(self, rhs) }), } } @@ -2799,6 +2811,8 @@ assert_eq!(5", stringify!($SelfT), ".checked_rem(0), None);", $EndFeature, " if rhs == 0 { None } else { + // SAFETY: div by zero has been checked above and unsigned types have no other + // failure modes for division Some(unsafe { intrinsics::unchecked_rem(self, rhs) }) } } @@ -3248,6 +3262,8 @@ assert_eq!(1", stringify!($SelfT), ".wrapping_shl(128), 1);", $EndFeature, " without modifying the original"] #[inline] pub const fn wrapping_shl(self, rhs: u32) -> Self { + // SAFETY: the masking by the bitsize of the type ensures that we do not shift + // out of bounds unsafe { intrinsics::unchecked_shl(self, (rhs & ($BITS - 1)) as $SelfT) } @@ -3279,6 +3295,8 @@ assert_eq!(128", stringify!($SelfT), ".wrapping_shr(128), 128);", $EndFeature, " without modifying the original"] #[inline] pub const fn wrapping_shr(self, rhs: u32) -> Self { + // SAFETY: the masking by the bitsize of the type ensures that we do not shift + // out of bounds unsafe { intrinsics::unchecked_shr(self, (rhs & ($BITS - 1)) as $SelfT) } @@ -3775,11 +3793,11 @@ assert!(!10", stringify!($SelfT), ".is_power_of_two());", $EndFeature, " fn one_less_than_next_power_of_two(self) -> Self { if self <= 1 { return 0; } - // Because `p > 0`, it cannot consist entirely of leading zeros. + let p = self - 1; + // SAFETY: Because `p > 0`, it cannot consist entirely of leading zeros. // That means the shift is always in-bounds, and some processors // (such as intel pre-haswell) have more efficient ctlz // intrinsics when the argument is non-zero. - let p = self - 1; let z = unsafe { intrinsics::ctlz_nonzero(p) }; <$SelfT>::max_value() >> z } @@ -3925,6 +3943,8 @@ assert_eq!( #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn to_ne_bytes(self) -> [u8; mem::size_of::()] { + // SAFETY: integers are plain old datatypes so we can always transmute them to + // arrays of bytes unsafe { mem::transmute(self) } } } @@ -4033,6 +4053,7 @@ fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn from_ne_bytes(bytes: [u8; mem::size_of::()]) -> Self { + // SAFETY: integers are plain old datatypes so we can always transmute to them unsafe { mem::transmute(bytes) } } } diff --git a/src/libcore/option.rs b/src/libcore/option.rs index f0ac5e749f6b3..958f31c0fd22a 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -133,6 +133,8 @@ //! [`Box`]: ../../std/boxed/struct.Box.html //! [`i32`]: ../../std/primitive.i32.html +// ignore-tidy-undocumented-unsafe + #![stable(feature = "rust1", since = "1.0.0")] use crate::iter::{FromIterator, FusedIterator, TrustedLen}; diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs index 685b749776b1d..b88dc336097f3 100644 --- a/src/libcore/panicking.rs +++ b/src/libcore/panicking.rs @@ -20,6 +20,8 @@ //! one function. Currently, the actual symbol is declared in the standard //! library, but the location of this may change over time. +// ignore-tidy-undocumented-unsafe + #![allow(dead_code, missing_docs)] #![unstable(feature = "core_panic", reason = "internal details of the implementation of the `panic!` \ diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index be057ed6d59a7..1219fd09a9dfa 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -552,6 +552,7 @@ impl Pin

{ #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] pub fn as_ref(&self) -> Pin<&P::Target> { + // SAFETY: see documentation on this function unsafe { Pin::new_unchecked(&*self.pointer) } } @@ -610,6 +611,7 @@ impl Pin

{ #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] pub fn as_mut(&mut self) -> Pin<&mut P::Target> { + // SAFETY: see documentation on this function unsafe { Pin::new_unchecked(&mut *self.pointer) } } diff --git a/src/libcore/ptr/mod.rs b/src/libcore/ptr/mod.rs index 1a13ac465f436..5a75730cf2bd4 100644 --- a/src/libcore/ptr/mod.rs +++ b/src/libcore/ptr/mod.rs @@ -65,6 +65,8 @@ //! [`write_volatile`]: ./fn.write_volatile.html //! [`NonNull::dangling`]: ./struct.NonNull.html#method.dangling +// ignore-tidy-undocumented-unsafe + #![stable(feature = "rust1", since = "1.0.0")] use crate::intrinsics; diff --git a/src/libcore/ptr/non_null.rs b/src/libcore/ptr/non_null.rs index 7dcd57f1f9858..7599991f0f15a 100644 --- a/src/libcore/ptr/non_null.rs +++ b/src/libcore/ptr/non_null.rs @@ -7,6 +7,8 @@ use crate::mem; use crate::ptr::Unique; use crate::cmp::Ordering; +// ignore-tidy-undocumented-unsafe + /// `*mut T` but non-zero and covariant. /// /// This is often the correct thing to use when building data structures using diff --git a/src/libcore/ptr/unique.rs b/src/libcore/ptr/unique.rs index 3521dd7997956..11a3aed1ab41b 100644 --- a/src/libcore/ptr/unique.rs +++ b/src/libcore/ptr/unique.rs @@ -5,6 +5,8 @@ use crate::marker::{PhantomData, Unsize}; use crate::mem; use crate::ptr::NonNull; +// ignore-tidy-undocumented-unsafe + /// A wrapper around a raw non-null `*mut T` that indicates that the possessor /// of this wrapper owns the referent. Useful for building abstractions like /// `Box`, `Vec`, `String`, and `HashMap`. diff --git a/src/libcore/slice/memchr.rs b/src/libcore/slice/memchr.rs index 45ab016c49628..2a2169dd348c2 100644 --- a/src/libcore/slice/memchr.rs +++ b/src/libcore/slice/memchr.rs @@ -1,6 +1,8 @@ // Original implementation taken from rust-memchr. // Copyright 2015 Andrew Gallant, bluss and Nicolas Koch +// ignore-tidy-undocumented-unsafe + use crate::cmp; use crate::mem; diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 7655b2f806532..c8fe9f9861315 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -1,4 +1,5 @@ // ignore-tidy-filelength +// ignore-tidy-undocumented-unsafe //! Slice management and manipulation. //! diff --git a/src/libcore/slice/sort.rs b/src/libcore/slice/sort.rs index 2f2170f7ff14c..a719a51b61605 100644 --- a/src/libcore/slice/sort.rs +++ b/src/libcore/slice/sort.rs @@ -6,6 +6,8 @@ //! Unstable sorting is compatible with libcore because it doesn't allocate memory, unlike our //! stable sorting implementation. +// ignore-tidy-undocumented-unsafe + use crate::cmp; use crate::mem::{self, MaybeUninit}; use crate::ptr; diff --git a/src/libcore/str/lossy.rs b/src/libcore/str/lossy.rs index e8f747f1a67d5..762de0489a975 100644 --- a/src/libcore/str/lossy.rs +++ b/src/libcore/str/lossy.rs @@ -3,6 +3,8 @@ use crate::str as core_str; use crate::fmt::{self, Write}; use crate::mem; +// ignore-tidy-undocumented-unsafe + /// Lossy UTF-8 string. #[unstable(feature = "str_internals", issue = "0")] pub struct Utf8Lossy { diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 1968919f5541c..25b7eec5b3343 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1,4 +1,5 @@ // ignore-tidy-filelength +// ignore-tidy-undocumented-unsafe //! String manipulation. //! diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index ad9d956fda1c8..a494274118a74 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -3,6 +3,8 @@ //! For more details, see the traits [`Pattern`], [`Searcher`], //! [`ReverseSearcher`], and [`DoubleEndedSearcher`]. +// ignore-tidy-undocumented-unsafe + #![unstable(feature = "pattern", reason = "API not fully fleshed out and ready to be stabilized", issue = "27721")] diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 73d5abf1aed23..d311cb16b64d3 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -112,6 +112,8 @@ //! println!("live threads: {}", old_thread_count + 1); //! ``` +// ignore-tidy-undocumented-unsafe + #![stable(feature = "rust1", since = "1.0.0")] #![cfg_attr(not(target_has_atomic_load_store = "8"), allow(dead_code))] #![cfg_attr(not(target_has_atomic_load_store = "8"), allow(unused_imports))] diff --git a/src/libcore/tests/num/flt2dec/mod.rs b/src/libcore/tests/num/flt2dec/mod.rs index c41d35efced6c..a35897e9bc1ac 100644 --- a/src/libcore/tests/num/flt2dec/mod.rs +++ b/src/libcore/tests/num/flt2dec/mod.rs @@ -85,6 +85,8 @@ fn ldexp_f64(a: f64, b: i32) -> f64 { extern { fn ldexp(x: f64, n: i32) -> f64; } + // SAFETY: assuming a correct `ldexp` has been supplied, the given arguments cannot possibly + // cause undefined behavior unsafe { ldexp(a, b) } } diff --git a/src/libcore/time.rs b/src/libcore/time.rs index 5a0e4388e0325..57fc1a7b76075 100644 --- a/src/libcore/time.rs +++ b/src/libcore/time.rs @@ -920,7 +920,7 @@ impl fmt::Debug for Duration { if end == 0 { write!(f, "{}", integer_part) } else { - // We are only writing ASCII digits into the buffer and it was + // SAFETY: We are only writing ASCII digits into the buffer and it was // initialized with '0's, so it contains valid UTF8. let s = unsafe { crate::str::from_utf8_unchecked(&buf[..end]) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 2bcddeaf1962d..eb5654e80a82c 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1800,7 +1800,7 @@ pub fn rustc_optgroups() -> Vec { "", "extern", "Specify where an external rust library is located", - "NAME=PATH", + "NAME[=PATH]", ), opt::multi_s( "", @@ -2164,7 +2164,6 @@ fn collect_print_requests( cg: &mut CodegenOptions, dopts: &mut DebuggingOptions, matches: &getopts::Matches, - is_unstable_enabled: bool, error_format: ErrorOutputType, ) -> Vec { let mut prints = Vec::::new(); @@ -2206,7 +2205,7 @@ fn collect_print_requests( "tls-models" => PrintRequest::TlsModels, "native-static-libs" => PrintRequest::NativeStaticLibs, "target-spec-json" => { - if is_unstable_enabled { + if dopts.unstable_options { PrintRequest::TargetSpec } else { early_error( @@ -2370,7 +2369,6 @@ fn parse_externs( matches: &getopts::Matches, debugging_opts: &DebuggingOptions, error_format: ErrorOutputType, - is_unstable_enabled: bool, ) -> Externs { if matches.opt_present("extern-private") && !debugging_opts.unstable_options { early_error( @@ -2392,13 +2390,6 @@ fn parse_externs( let name = parts.next().unwrap_or_else(|| early_error(error_format, "--extern value must not be empty")); let location = parts.next().map(|s| s.to_string()); - if location.is_none() && !is_unstable_enabled { - early_error( - error_format, - "the `-Z unstable-options` flag must also be passed to \ - enable `--extern crate_name` without `=path`", - ); - }; let entry = externs .entry(name.to_owned()) @@ -2483,12 +2474,10 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { ); } - let is_unstable_enabled = nightly_options::is_unstable_enabled(matches); let prints = collect_print_requests( &mut cg, &mut debugging_opts, matches, - is_unstable_enabled, error_format, ); @@ -2521,7 +2510,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { ); } - let externs = parse_externs(matches, &debugging_opts, error_format, is_unstable_enabled); + let externs = parse_externs(matches, &debugging_opts, error_format); let crate_name = matches.opt_str("crate-name"); diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index d5e7ac19263a0..b3ef3217ec6a0 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -76,7 +76,10 @@ pub fn encode_with_shorthand(encoder: &mut E, // The shorthand encoding uses the same usize as the // discriminant, with an offset so they can't conflict. + #[cfg(bootstrap)] let discriminant = unsafe { intrinsics::discriminant_value(variant) }; + #[cfg(not(bootstrap))] + let discriminant = intrinsics::discriminant_value(variant); assert!(discriminant < SHORTHAND_OFFSET as u64); let shorthand = start + SHORTHAND_OFFSET; diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 867f5f76b59bc..c6fd1256a8e64 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -2052,7 +2052,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue { ); err.span_label(expr.span, "this code causes undefined behavior when executed"); - err.span_label(expr.span, "help: use `MaybeUninit` instead"); + err.span_label(expr.span, "help: use `MaybeUninit` instead, \ + and only call `assume_init` after initialization is done"); if let Some(span) = span { err.span_note(span, &msg); } else { diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 33dc85fc68a2e..693f6f05fab28 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -67,11 +67,13 @@ fn equate_intrinsic_type<'tcx>( pub fn intrinsic_operation_unsafety(intrinsic: &str) -> hir::Unsafety { match intrinsic { "size_of" | "min_align_of" | "needs_drop" | "caller_location" | + "size_of_val" | "min_align_of_val" | "add_with_overflow" | "sub_with_overflow" | "mul_with_overflow" | "wrapping_add" | "wrapping_sub" | "wrapping_mul" | "saturating_add" | "saturating_sub" | "rotate_left" | "rotate_right" | "ctpop" | "ctlz" | "cttz" | "bswap" | "bitreverse" | + "discriminant_value" | "type_id" | "likely" | "unlikely" | "minnumf32" | "minnumf64" | "maxnumf32" | "maxnumf64" | "type_name" => hir::Unsafety::Normal, _ => hir::Unsafety::Unsafe, diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 0b8d4d6c302f1..255d5f9f35dbf 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -615,10 +615,6 @@ fn parse_externs(matches: &getopts::Matches) -> Result { let mut parts = arg.splitn(2, '='); let name = parts.next().ok_or("--extern value must not be empty".to_string())?; let location = parts.next().map(|s| s.to_string()); - if location.is_none() && !nightly_options::is_unstable_enabled(matches) { - return Err("the `-Z unstable-options` flag must also be passed to \ - enable `--extern crate_name` without `=path`".to_string()); - } let name = name.to_string(); // For Rustdoc purposes, we can treat all externs as public externs.entry(name) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 29f0b99d8ee69..9a87bcc10db8e 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1230,18 +1230,87 @@ impl AllTypes { } } +#[derive(Debug)] +enum Setting { + Section { + description: &'static str, + sub_settings: Vec, + }, + Entry { + js_data_name: &'static str, + description: &'static str, + default_value: bool, + } +} + +impl Setting { + fn display(&self) -> String { + match *self { + Setting::Section { ref description, ref sub_settings } => { + format!( + "

\ +
{}
\ +
{}
+
", + description, + sub_settings.iter().map(|s| s.display()).collect::() + ) + } + Setting::Entry { ref js_data_name, ref description, ref default_value } => { + format!( + "
\ + \ +
{}
\ +
", + js_data_name, + if *default_value { " checked" } else { "" }, + description, + ) + } + } + } +} + +impl From<(&'static str, &'static str, bool)> for Setting { + fn from(values: (&'static str, &'static str, bool)) -> Setting { + Setting::Entry { + js_data_name: values.0, + description: values.1, + default_value: values.2, + } + } +} + +impl> From<(&'static str, Vec)> for Setting { + fn from(values: (&'static str, Vec)) -> Setting { + Setting::Section { + description: values.0, + sub_settings: values.1.into_iter().map(|v| v.into()).collect::>(), + } + } +} + fn settings(root_path: &str, suffix: &str) -> String { // (id, explanation, default value) - let settings = [ - ("item-declarations", "Auto-hide item declarations.", true), - ("item-attributes", "Auto-hide item attributes.", true), - ("trait-implementations", "Auto-hide trait implementations documentation", - true), - ("method-docs", "Auto-hide item methods' documentation", false), + let settings: &[Setting] = &[ + ("Auto-hide item declarations", vec![ + ("auto-hide-struct", "Auto-hide structs declaration", true), + ("auto-hide-enum", "Auto-hide enums declaration", false), + ("auto-hide-union", "Auto-hide unions declaration", true), + ("auto-hide-trait", "Auto-hide traits declaration", true), + ("auto-hide-macro", "Auto-hide macros declaration", false), + ]).into(), + ("auto-hide-attributes", "Auto-hide item attributes.", true).into(), + ("auto-hide-method-docs", "Auto-hide item methods' documentation", false).into(), + ("auto-hide-trait-implementations", "Auto-hide trait implementations documentation", + true).into(), ("go-to-only-result", "Directly go to item in search if there is only one result", - false), - ("line-numbers", "Show line numbers on code examples", false), - ("disable-shortcuts", "Disable keyboard shortcuts", false), + false).into(), + ("line-numbers", "Show line numbers on code examples", false).into(), + ("disable-shortcuts", "Disable keyboard shortcuts", false).into(), ]; format!( "

\ @@ -1249,17 +1318,7 @@ fn settings(root_path: &str, suffix: &str) -> String {

\
{}
\ ", - settings.iter() - .map(|(id, text, enabled)| { - format!("
\ - \ -
{}
\ -
", id, if *enabled { " checked" } else { "" }, text) - }) - .collect::(), + settings.iter().map(|s| s.display()).collect::(), root_path, suffix) } diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 53e16978ff12b..87eb36aba1370 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -2118,7 +2118,7 @@ function getSearchElement() { function autoCollapse(pageId, collapse) { if (collapse) { toggleAllDocs(pageId, true); - } else if (getCurrentValue("rustdoc-trait-implementations") !== "false") { + } else if (getCurrentValue("rustdoc-auto-hide-trait-implementations") !== "false") { var impl_list = document.getElementById("implementations-list"); if (impl_list !== null) { @@ -2156,7 +2156,7 @@ function getSearchElement() { } var toggle = createSimpleToggle(false); - var hideMethodDocs = getCurrentValue("rustdoc-method-docs") === "true"; + var hideMethodDocs = getCurrentValue("rustdoc-auto-hide-method-docs") === "true"; var pageId = getPageId(); var func = function(e) { @@ -2286,7 +2286,31 @@ function getSearchElement() { return wrapper; } - var showItemDeclarations = getCurrentValue("rustdoc-item-declarations") === "false"; + var currentType = document.getElementsByClassName("type-decl")[0]; + var className = null; + if (currentType) { + currentType = currentType.getElementsByClassName("rust")[0]; + if (currentType) { + currentType.classList.forEach(function(item) { + if (item !== "main") { + className = item; + return true; + } + }); + } + } + var showItemDeclarations = getCurrentValue("rustdoc-auto-hide-" + className); + if (showItemDeclarations === null) { + if (className === "enum" || className === "macro") { + showItemDeclarations = "false"; + } else if (className === "struct" || className === "union" || className === "trait") { + showItemDeclarations = "true"; + } else { + // In case we found an unknown type, we just use the "parent" value. + showItemDeclarations = getCurrentValue("rustdoc-auto-hide-declarations"); + } + } + showItemDeclarations = showItemDeclarations === "false"; function buildToggleWrapper(e) { if (hasClass(e, "autohide")) { var wrap = e.previousElementSibling; @@ -2369,7 +2393,7 @@ function getSearchElement() { // To avoid checking on "rustdoc-item-attributes" value on every loop... var itemAttributesFunc = function() {}; - if (getCurrentValue("rustdoc-item-attributes") !== "false") { + if (getCurrentValue("rustdoc-auto-hide-attributes") !== "false") { itemAttributesFunc = function(x) { collapseDocs(x.previousSibling.childNodes[0], "toggle"); }; diff --git a/src/librustdoc/html/static/settings.css b/src/librustdoc/html/static/settings.css index b31ad96fa545f..d03cf7fcc459e 100644 --- a/src/librustdoc/html/static/settings.css +++ b/src/librustdoc/html/static/settings.css @@ -1,5 +1,6 @@ .setting-line { padding: 5px; + position: relative; } .setting-line > div { @@ -10,6 +11,13 @@ padding-top: 2px; } +.setting-line > .title { + font-size: 19px; + width: 100%; + max-width: none; + border-bottom: 1px solid; +} + .toggle { position: relative; display: inline-block; @@ -59,3 +67,9 @@ input:checked + .slider:before { -ms-transform: translateX(19px); transform: translateX(19px); } + +.setting-line > .sub-settings { + padding-left: 42px; + width: 100%; + display: block; +} diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css index c3116dbe7a242..a60d543a53936 100644 --- a/src/librustdoc/html/static/themes/dark.css +++ b/src/librustdoc/html/static/themes/dark.css @@ -425,3 +425,6 @@ div.files > a:hover, div.name:hover { div.files > .selected { background-color: #333; } +.setting-line > .title { + border-bottom-color: #ddd; +} diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css index e2bf9f9d2f23a..351f027b942ff 100644 --- a/src/librustdoc/html/static/themes/light.css +++ b/src/librustdoc/html/static/themes/light.css @@ -419,3 +419,6 @@ div.files > a:hover, div.name:hover { div.files > .selected { background-color: #fff; } +.setting-line > .title { + border-bottom-color: #D5D5D5; +} diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 8cd32a3d1b508..13b8809e23e40 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -140,7 +140,7 @@ fn opts() -> Vec { }), stable("cfg", |o| o.optmulti("", "cfg", "pass a --cfg to rustc", "")), stable("extern", |o| { - o.optmulti("", "extern", "pass an --extern to rustc", "NAME=PATH") + o.optmulti("", "extern", "pass an --extern to rustc", "NAME[=PATH]") }), unstable("extern-html-root-url", |o| { o.optmulti("", "extern-html-root-url", diff --git a/src/test/run-make-fulldeps/extern-flag-fun/Makefile b/src/test/run-make-fulldeps/extern-flag-fun/Makefile index a9f2585335003..38d1d5bb8488a 100644 --- a/src/test/run-make-fulldeps/extern-flag-fun/Makefile +++ b/src/test/run-make-fulldeps/extern-flag-fun/Makefile @@ -4,7 +4,6 @@ all: $(RUSTC) bar.rs --crate-type=rlib $(RUSTC) bar.rs --crate-type=rlib -C extra-filename=-a $(RUSTC) bar-alt.rs --crate-type=rlib - $(RUSTC) foo.rs --extern hello && exit 1 || exit 0 $(RUSTC) foo.rs --extern bar=no-exist && exit 1 || exit 0 $(RUSTC) foo.rs --extern bar=foo.rs && exit 1 || exit 0 $(RUSTC) foo.rs \ @@ -15,3 +14,6 @@ all: --extern bar=$(TMPDIR)/libbar.rlib \ --extern bar=$(TMPDIR)/libbar-a.rlib $(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib + # Try to be sneaky and load a private crate from with a non-private name. + $(RUSTC) rustc.rs -Zforce-unstable-if-unmarked --crate-type=rlib + $(RUSTC) gated_unstable.rs --extern alloc=$(TMPDIR)/librustc.rlib 2>&1 | $(CGREP) 'rustc_private' diff --git a/src/test/run-make-fulldeps/extern-flag-fun/gated_unstable.rs b/src/test/run-make-fulldeps/extern-flag-fun/gated_unstable.rs new file mode 100644 index 0000000000000..03600c830fff6 --- /dev/null +++ b/src/test/run-make-fulldeps/extern-flag-fun/gated_unstable.rs @@ -0,0 +1,3 @@ +extern crate alloc; + +fn main() {} diff --git a/src/test/run-make-fulldeps/extern-flag-fun/rustc.rs b/src/test/run-make-fulldeps/extern-flag-fun/rustc.rs new file mode 100644 index 0000000000000..b76b4321d62aa --- /dev/null +++ b/src/test/run-make-fulldeps/extern-flag-fun/rustc.rs @@ -0,0 +1 @@ +pub fn foo() {} diff --git a/src/test/run-make-fulldeps/extern-flag-pathless/Makefile b/src/test/run-make-fulldeps/extern-flag-pathless/Makefile new file mode 100644 index 0000000000000..4849fc62f4a95 --- /dev/null +++ b/src/test/run-make-fulldeps/extern-flag-pathless/Makefile @@ -0,0 +1,18 @@ +-include ../tools.mk + +# Test mixing pathless --extern with paths. + +all: + $(RUSTC) bar-static.rs --crate-name=bar --crate-type=rlib + $(RUSTC) bar-dynamic.rs --crate-name=bar --crate-type=dylib -C prefer-dynamic + # rlib preferred over dylib + $(RUSTC) foo.rs --extern bar + $(call RUN,foo) | $(CGREP) 'static' + $(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib --extern bar + $(call RUN,foo) | $(CGREP) 'static' + # explicit --extern overrides pathless + $(RUSTC) foo.rs --extern bar=$(call DYLIB,bar) --extern bar + $(call RUN,foo) | $(CGREP) 'dynamic' + # prefer-dynamic does what it says + $(RUSTC) foo.rs --extern bar -C prefer-dynamic + $(call RUN,foo) | $(CGREP) 'dynamic' diff --git a/src/test/run-make-fulldeps/extern-flag-pathless/bar-dynamic.rs b/src/test/run-make-fulldeps/extern-flag-pathless/bar-dynamic.rs new file mode 100644 index 0000000000000..e2d68d517ff97 --- /dev/null +++ b/src/test/run-make-fulldeps/extern-flag-pathless/bar-dynamic.rs @@ -0,0 +1,3 @@ +pub fn f() { + println!("dynamic"); +} diff --git a/src/test/run-make-fulldeps/extern-flag-pathless/bar-static.rs b/src/test/run-make-fulldeps/extern-flag-pathless/bar-static.rs new file mode 100644 index 0000000000000..240d8bde4d186 --- /dev/null +++ b/src/test/run-make-fulldeps/extern-flag-pathless/bar-static.rs @@ -0,0 +1,3 @@ +pub fn f() { + println!("static"); +} diff --git a/src/test/run-make-fulldeps/extern-flag-pathless/foo.rs b/src/test/run-make-fulldeps/extern-flag-pathless/foo.rs new file mode 100644 index 0000000000000..1ea64da7dad26 --- /dev/null +++ b/src/test/run-make-fulldeps/extern-flag-pathless/foo.rs @@ -0,0 +1,3 @@ +fn main() { + bar::f(); +} diff --git a/src/test/run-make-fulldeps/save-analysis-rfc2126/Makefile b/src/test/run-make-fulldeps/save-analysis-rfc2126/Makefile index bf98fcd10cfde..36288c4b870e7 100644 --- a/src/test/run-make-fulldeps/save-analysis-rfc2126/Makefile +++ b/src/test/run-make-fulldeps/save-analysis-rfc2126/Makefile @@ -1,8 +1,7 @@ -include ../tools.mk all: extern_absolute_paths.rs krate2 - $(RUSTC) extern_absolute_paths.rs -Zsave-analysis --edition=2018 \ - -Z unstable-options --extern krate2 + $(RUSTC) extern_absolute_paths.rs -Zsave-analysis --edition=2018 --extern krate2 cat $(TMPDIR)/save-analysis/extern_absolute_paths.json | "$(PYTHON)" validate_json.py krate2: krate2.rs diff --git a/src/test/rustdoc/inline_cross/use_crate.rs b/src/test/rustdoc/inline_cross/use_crate.rs index f678ba0a46c0d..00e0f041c56fe 100644 --- a/src/test/rustdoc/inline_cross/use_crate.rs +++ b/src/test/rustdoc/inline_cross/use_crate.rs @@ -2,7 +2,7 @@ // aux-build:use_crate_2.rs // build-aux-docs // edition:2018 -// compile-flags:--extern use_crate --extern use_crate_2 -Z unstable-options +// compile-flags:--extern use_crate --extern use_crate_2 // During the buildup to Rust 2018, rustdoc would eagerly inline `pub use some_crate;` as if it // were a module, so we changed it to make `pub use`ing crate roots remain as a `pub use` statement diff --git a/src/test/ui-fulldeps/pathless-extern-unstable.rs b/src/test/ui-fulldeps/pathless-extern-unstable.rs new file mode 100644 index 0000000000000..00b3ec5409ff0 --- /dev/null +++ b/src/test/ui-fulldeps/pathless-extern-unstable.rs @@ -0,0 +1,10 @@ +// ignore-stage1 +// edition:2018 +// compile-flags:--extern rustc + +// Test that `--extern rustc` fails with `rustc_private`. + +pub use rustc; +//~^ ERROR use of unstable library feature 'rustc_private' + +fn main() {} diff --git a/src/test/ui-fulldeps/pathless-extern-unstable.stderr b/src/test/ui-fulldeps/pathless-extern-unstable.stderr new file mode 100644 index 0000000000000..edc3b1c58be22 --- /dev/null +++ b/src/test/ui-fulldeps/pathless-extern-unstable.stderr @@ -0,0 +1,12 @@ +error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? + --> $DIR/pathless-extern-unstable.rs:7:9 + | +LL | pub use rustc; + | ^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/27812 + = help: add `#![feature(rustc_private)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/async-await/issues/issue-62009-1.rs b/src/test/ui/async-await/issues/issue-62009-1.rs index 788474365c9e5..e95f7df388c45 100644 --- a/src/test/ui/async-await/issues/issue-62009-1.rs +++ b/src/test/ui/async-await/issues/issue-62009-1.rs @@ -1,6 +1,5 @@ // edition:2018 -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) async fn print_dur() {} diff --git a/src/test/ui/async-await/issues/issue-62009-1.stderr b/src/test/ui/async-await/issues/issue-62009-1.stderr index 538430290d299..6c8e0d0a5c403 100644 --- a/src/test/ui/async-await/issues/issue-62009-1.stderr +++ b/src/test/ui/async-await/issues/issue-62009-1.stderr @@ -1,5 +1,5 @@ error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-62009-1.rs:8:5 + --> $DIR/issue-62009-1.rs:7:5 | LL | fn main() { | ---- this is not `async` @@ -7,7 +7,7 @@ LL | async { let (); }.await; | ^^^^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-62009-1.rs:10:5 + --> $DIR/issue-62009-1.rs:9:5 | LL | fn main() { | ---- this is not `async` @@ -19,7 +19,7 @@ LL | | }.await; | |___________^ only allowed inside `async` functions and blocks error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-62009-1.rs:14:5 + --> $DIR/issue-62009-1.rs:13:5 | LL | fn main() { | ---- this is not `async` @@ -27,11 +27,11 @@ LL | fn main() { LL | (|_| 2333).await; | ^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks -error[E0277]: the trait bound `[closure@$DIR/issue-62009-1.rs:14:5: 14:15]: std::future::Future` is not satisfied - --> $DIR/issue-62009-1.rs:14:5 +error[E0277]: the trait bound `[closure@$DIR/issue-62009-1.rs:13:5: 13:15]: std::future::Future` is not satisfied + --> $DIR/issue-62009-1.rs:13:5 | LL | (|_| 2333).await; - | ^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:14:5: 14:15]` + | ^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:13:5: 13:15]` | ::: $SRC_DIR/libstd/future.rs:LL:COL | diff --git a/src/test/ui/closures/closure-move-sync.rs b/src/test/ui/closures/closure-move-sync.rs index 951a3bcb5f423..2f1e6c81ae5a8 100644 --- a/src/test/ui/closures/closure-move-sync.rs +++ b/src/test/ui/closures/closure-move-sync.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::thread; use std::sync::mpsc::channel; diff --git a/src/test/ui/closures/closure-move-sync.stderr b/src/test/ui/closures/closure-move-sync.stderr index f676df9c559eb..ac5e3ccb42187 100644 --- a/src/test/ui/closures/closure-move-sync.stderr +++ b/src/test/ui/closures/closure-move-sync.stderr @@ -1,5 +1,5 @@ error[E0277]: `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely - --> $DIR/closure-move-sync.rs:8:13 + --> $DIR/closure-move-sync.rs:7:13 | LL | let t = thread::spawn(|| { | ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely @@ -11,10 +11,10 @@ LL | F: FnOnce() -> T, F: Send + 'static, T: Send + 'static | = help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Receiver<()>` = note: required because of the requirements on the impl of `std::marker::Send` for `&std::sync::mpsc::Receiver<()>` - = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:8:27: 11:6 recv:&std::sync::mpsc::Receiver<()>]` + = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:7:27: 10:6 recv:&std::sync::mpsc::Receiver<()>]` error[E0277]: `std::sync::mpsc::Sender<()>` cannot be shared between threads safely - --> $DIR/closure-move-sync.rs:20:5 + --> $DIR/closure-move-sync.rs:19:5 | LL | thread::spawn(|| tx.send(()).unwrap()); | ^^^^^^^^^^^^^ `std::sync::mpsc::Sender<()>` cannot be shared between threads safely @@ -26,7 +26,7 @@ LL | F: FnOnce() -> T, F: Send + 'static, T: Send + 'static | = help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Sender<()>` = note: required because of the requirements on the impl of `std::marker::Send` for `&std::sync::mpsc::Sender<()>` - = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:20:19: 20:42 tx:&std::sync::mpsc::Sender<()>]` + = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:19:19: 19:42 tx:&std::sync::mpsc::Sender<()>]` error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-size_of-cycle.rs b/src/test/ui/consts/const-size_of-cycle.rs index 1bbe881872cb3..6c35b9212c6cb 100644 --- a/src/test/ui/consts/const-size_of-cycle.rs +++ b/src/test/ui/consts/const-size_of-cycle.rs @@ -1,5 +1,4 @@ -// ignore-musl -// ignore-x86 +// ignore-x86 FIXME: missing sysroot spans (#53081) // error-pattern: cycle detected struct Foo { diff --git a/src/test/ui/consts/const-size_of-cycle.stderr b/src/test/ui/consts/const-size_of-cycle.stderr index 1ae39e7563a82..5b06ade44c5cb 100644 --- a/src/test/ui/consts/const-size_of-cycle.stderr +++ b/src/test/ui/consts/const-size_of-cycle.stderr @@ -1,11 +1,11 @@ error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}#0` - --> $DIR/const-size_of-cycle.rs:6:17 + --> $DIR/const-size_of-cycle.rs:5:17 | LL | bytes: [u8; std::mem::size_of::()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}#0`... - --> $DIR/const-size_of-cycle.rs:6:17 + --> $DIR/const-size_of-cycle.rs:5:17 | LL | bytes: [u8; std::mem::size_of::()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | pub fn size_of() -> usize; = note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All, def_id: None }, value: [u8; _] }`... = note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}#0`, completing the cycle note: cycle used when processing `Foo` - --> $DIR/const-size_of-cycle.rs:5:1 + --> $DIR/const-size_of-cycle.rs:4:1 | LL | struct Foo { | ^^^^^^^^^^ diff --git a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs index b556d442420e0..da00f81b96ead 100644 --- a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr index 7db5fbe3de402..796e6a2b744f7 100644 --- a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied - --> $DIR/derives-span-Clone-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-Clone-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Clone-enum.rs b/src/test/ui/derives/derives-span-Clone-enum.rs index 9bb4f486c3ef0..98ae1b2c5b8a2 100644 --- a/src/test/ui/derives/derives-span-Clone-enum.rs +++ b/src/test/ui/derives/derives-span-Clone-enum.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Clone-enum.stderr b/src/test/ui/derives/derives-span-Clone-enum.stderr index 4371dc900ac10..3e94bb551ea97 100644 --- a/src/test/ui/derives/derives-span-Clone-enum.stderr +++ b/src/test/ui/derives/derives-span-Clone-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied - --> $DIR/derives-span-Clone-enum.rs:9:6 + --> $DIR/derives-span-Clone-enum.rs:10:6 | LL | Error | ^^^^^ the trait `std::clone::Clone` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Clone-struct.rs b/src/test/ui/derives/derives-span-Clone-struct.rs index f151636f848a0..db677e26f5049 100644 --- a/src/test/ui/derives/derives-span-Clone-struct.rs +++ b/src/test/ui/derives/derives-span-Clone-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Clone-struct.stderr b/src/test/ui/derives/derives-span-Clone-struct.stderr index cc3b602c9c0b9..0674d64fe9dfe 100644 --- a/src/test/ui/derives/derives-span-Clone-struct.stderr +++ b/src/test/ui/derives/derives-span-Clone-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied - --> $DIR/derives-span-Clone-struct.rs:8:5 + --> $DIR/derives-span-Clone-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Clone-tuple-struct.rs b/src/test/ui/derives/derives-span-Clone-tuple-struct.rs index 7a62885324ebd..d716b6fe900ca 100644 --- a/src/test/ui/derives/derives-span-Clone-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Clone-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr index b2bf3527b0cc4..f6b4006014a3a 100644 --- a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied - --> $DIR/derives-span-Clone-tuple-struct.rs:8:5 + --> $DIR/derives-span-Clone-tuple-struct.rs:9:5 | LL | Error | ^^^^^ the trait `std::clone::Clone` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs index 949597bc8f6ee..10deccb8ad7c1 100644 --- a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr index ca5bcfe930d61..6a0e382b9e545 100644 --- a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` - --> $DIR/derives-span-Debug-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-Debug-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ `Error` cannot be formatted using `{:?}` diff --git a/src/test/ui/derives/derives-span-Debug-enum.rs b/src/test/ui/derives/derives-span-Debug-enum.rs index b2a39708ceb9a..b8bed0eab552e 100644 --- a/src/test/ui/derives/derives-span-Debug-enum.rs +++ b/src/test/ui/derives/derives-span-Debug-enum.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Debug-enum.stderr b/src/test/ui/derives/derives-span-Debug-enum.stderr index cd367a334fc60..f27499ba441a0 100644 --- a/src/test/ui/derives/derives-span-Debug-enum.stderr +++ b/src/test/ui/derives/derives-span-Debug-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` - --> $DIR/derives-span-Debug-enum.rs:9:6 + --> $DIR/derives-span-Debug-enum.rs:10:6 | LL | Error | ^^^^^ `Error` cannot be formatted using `{:?}` diff --git a/src/test/ui/derives/derives-span-Debug-struct.rs b/src/test/ui/derives/derives-span-Debug-struct.rs index cf91c9436a623..22f037ee36f24 100644 --- a/src/test/ui/derives/derives-span-Debug-struct.rs +++ b/src/test/ui/derives/derives-span-Debug-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Debug-struct.stderr b/src/test/ui/derives/derives-span-Debug-struct.stderr index e00695ec0ba62..09d62f12b0449 100644 --- a/src/test/ui/derives/derives-span-Debug-struct.stderr +++ b/src/test/ui/derives/derives-span-Debug-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` - --> $DIR/derives-span-Debug-struct.rs:8:5 + --> $DIR/derives-span-Debug-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ `Error` cannot be formatted using `{:?}` diff --git a/src/test/ui/derives/derives-span-Debug-tuple-struct.rs b/src/test/ui/derives/derives-span-Debug-tuple-struct.rs index cea973c91a783..c693facfeaa92 100644 --- a/src/test/ui/derives/derives-span-Debug-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Debug-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr index 37440b59ae704..f100cf32fdf85 100644 --- a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` - --> $DIR/derives-span-Debug-tuple-struct.rs:8:5 + --> $DIR/derives-span-Debug-tuple-struct.rs:9:5 | LL | Error | ^^^^^ `Error` cannot be formatted using `{:?}` diff --git a/src/test/ui/derives/derives-span-Default-struct.rs b/src/test/ui/derives/derives-span-Default-struct.rs index 71fd5829e7585..1654883998def 100644 --- a/src/test/ui/derives/derives-span-Default-struct.rs +++ b/src/test/ui/derives/derives-span-Default-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Default-struct.stderr b/src/test/ui/derives/derives-span-Default-struct.stderr index 413d4ec8c291a..11664d400ee71 100644 --- a/src/test/ui/derives/derives-span-Default-struct.stderr +++ b/src/test/ui/derives/derives-span-Default-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::default::Default` is not satisfied - --> $DIR/derives-span-Default-struct.rs:8:5 + --> $DIR/derives-span-Default-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ the trait `std::default::Default` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Default-tuple-struct.rs b/src/test/ui/derives/derives-span-Default-tuple-struct.rs index 463f7d230ca41..f1390c8b6f6b5 100644 --- a/src/test/ui/derives/derives-span-Default-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Default-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr index 8f4d43daa5191..c79f093942fdd 100644 --- a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::default::Default` is not satisfied - --> $DIR/derives-span-Default-tuple-struct.rs:8:5 + --> $DIR/derives-span-Default-tuple-struct.rs:9:5 | LL | Error | ^^^^^ the trait `std::default::Default` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs index d2dab8687f774..77c386d7f9094 100644 --- a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr index 52ecce4632d12..87c0313ca1fc6 100644 --- a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied - --> $DIR/derives-span-Eq-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-Eq-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Eq-enum.rs b/src/test/ui/derives/derives-span-Eq-enum.rs index c6c0d4321083b..c7fe37813325d 100644 --- a/src/test/ui/derives/derives-span-Eq-enum.rs +++ b/src/test/ui/derives/derives-span-Eq-enum.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-Eq-enum.stderr b/src/test/ui/derives/derives-span-Eq-enum.stderr index bf91a0edc375b..c8db6d3ff2f7b 100644 --- a/src/test/ui/derives/derives-span-Eq-enum.stderr +++ b/src/test/ui/derives/derives-span-Eq-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied - --> $DIR/derives-span-Eq-enum.rs:9:6 + --> $DIR/derives-span-Eq-enum.rs:10:6 | LL | Error | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Eq-struct.rs b/src/test/ui/derives/derives-span-Eq-struct.rs index df310039847d4..8674cadb3092d 100644 --- a/src/test/ui/derives/derives-span-Eq-struct.rs +++ b/src/test/ui/derives/derives-span-Eq-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-Eq-struct.stderr b/src/test/ui/derives/derives-span-Eq-struct.stderr index 531e8887cd2bc..df4ea5b1d4144 100644 --- a/src/test/ui/derives/derives-span-Eq-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied - --> $DIR/derives-span-Eq-struct.rs:8:5 + --> $DIR/derives-span-Eq-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Eq-tuple-struct.rs b/src/test/ui/derives/derives-span-Eq-tuple-struct.rs index abf6526b90078..99cc9582b5b60 100644 --- a/src/test/ui/derives/derives-span-Eq-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Eq-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr index 9e21c6c67bfc7..def06d710867f 100644 --- a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied - --> $DIR/derives-span-Eq-tuple-struct.rs:8:5 + --> $DIR/derives-span-Eq-tuple-struct.rs:9:5 | LL | Error | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs index ed87360a0be9f..604b0842fa93c 100644 --- a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr index 708ebca9fb153..cc1caf7804186 100644 --- a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied - --> $DIR/derives-span-Hash-enum-struct-variant.rs:11:6 + --> $DIR/derives-span-Hash-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ the trait `std::hash::Hash` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Hash-enum.rs b/src/test/ui/derives/derives-span-Hash-enum.rs index 5b3649c9826e6..bf3033a232c0c 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.rs +++ b/src/test/ui/derives/derives-span-Hash-enum.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Hash-enum.stderr b/src/test/ui/derives/derives-span-Hash-enum.stderr index dc171cbe5dd13..246d821ed2bf6 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied - --> $DIR/derives-span-Hash-enum.rs:11:6 + --> $DIR/derives-span-Hash-enum.rs:10:6 | LL | Error | ^^^^^ the trait `std::hash::Hash` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Hash-struct.rs b/src/test/ui/derives/derives-span-Hash-struct.rs index ead70861a0ad6..b6abb9d229e13 100644 --- a/src/test/ui/derives/derives-span-Hash-struct.rs +++ b/src/test/ui/derives/derives-span-Hash-struct.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Hash-struct.stderr b/src/test/ui/derives/derives-span-Hash-struct.stderr index 429449b82bf64..720c127635e62 100644 --- a/src/test/ui/derives/derives-span-Hash-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied - --> $DIR/derives-span-Hash-struct.rs:10:5 + --> $DIR/derives-span-Hash-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ the trait `std::hash::Hash` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Hash-tuple-struct.rs b/src/test/ui/derives/derives-span-Hash-tuple-struct.rs index 820f13ed18ef2..e01351fe8a6ba 100644 --- a/src/test/ui/derives/derives-span-Hash-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr index a6c4c479b24d7..1fd1e601eca01 100644 --- a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied - --> $DIR/derives-span-Hash-tuple-struct.rs:10:5 + --> $DIR/derives-span-Hash-tuple-struct.rs:9:5 | LL | Error | ^^^^^ the trait `std::hash::Hash` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs index 62355cc2d9619..6d516d4b0adc3 100644 --- a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(Eq,PartialOrd,PartialEq)] diff --git a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr index 5c0d4e4ebe917..f0d7e4465a79b 100644 --- a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied - --> $DIR/derives-span-Ord-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-Ord-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Ord-enum.rs b/src/test/ui/derives/derives-span-Ord-enum.rs index 72738931d10f2..51b5d7f0ed1d2 100644 --- a/src/test/ui/derives/derives-span-Ord-enum.rs +++ b/src/test/ui/derives/derives-span-Ord-enum.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(Eq,PartialOrd,PartialEq)] diff --git a/src/test/ui/derives/derives-span-Ord-enum.stderr b/src/test/ui/derives/derives-span-Ord-enum.stderr index 56268a237450a..37eca92e77e63 100644 --- a/src/test/ui/derives/derives-span-Ord-enum.stderr +++ b/src/test/ui/derives/derives-span-Ord-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied - --> $DIR/derives-span-Ord-enum.rs:9:6 + --> $DIR/derives-span-Ord-enum.rs:10:6 | LL | Error | ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Ord-struct.rs b/src/test/ui/derives/derives-span-Ord-struct.rs index 53d4c2c22b55f..c924ecaa315fc 100644 --- a/src/test/ui/derives/derives-span-Ord-struct.rs +++ b/src/test/ui/derives/derives-span-Ord-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(Eq,PartialOrd,PartialEq)] diff --git a/src/test/ui/derives/derives-span-Ord-struct.stderr b/src/test/ui/derives/derives-span-Ord-struct.stderr index 40dc3d09dad7e..72c1fe4803c4d 100644 --- a/src/test/ui/derives/derives-span-Ord-struct.stderr +++ b/src/test/ui/derives/derives-span-Ord-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied - --> $DIR/derives-span-Ord-struct.rs:8:5 + --> $DIR/derives-span-Ord-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Ord-tuple-struct.rs b/src/test/ui/derives/derives-span-Ord-tuple-struct.rs index 4e09c27098641..80546634690c3 100644 --- a/src/test/ui/derives/derives-span-Ord-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Ord-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(Eq,PartialOrd,PartialEq)] diff --git a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr index 4a9dea8c12e9a..642c8579b514c 100644 --- a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied - --> $DIR/derives-span-Ord-tuple-struct.rs:8:5 + --> $DIR/derives-span-Ord-tuple-struct.rs:9:5 | LL | Error | ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs index d66faa086dec7..b13798686c001 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr index ed5468cc4dac2..d6a5652560187 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ @@ -7,7 +7,7 @@ LL | x: Error = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ diff --git a/src/test/ui/derives/derives-span-PartialEq-enum.rs b/src/test/ui/derives/derives-span-PartialEq-enum.rs index 66edf460b312a..5f8f05ad94b47 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum.rs +++ b/src/test/ui/derives/derives-span-PartialEq-enum.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-PartialEq-enum.stderr b/src/test/ui/derives/derives-span-PartialEq-enum.stderr index 06a88c03f58af..1f5ad42a3aa33 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-enum.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum.rs:9:6 + --> $DIR/derives-span-PartialEq-enum.rs:10:6 | LL | Error | ^^^^^ @@ -7,7 +7,7 @@ LL | Error = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum.rs:9:6 + --> $DIR/derives-span-PartialEq-enum.rs:10:6 | LL | Error | ^^^^^ diff --git a/src/test/ui/derives/derives-span-PartialEq-struct.rs b/src/test/ui/derives/derives-span-PartialEq-struct.rs index ce5c67af77f05..560bf582e8da2 100644 --- a/src/test/ui/derives/derives-span-PartialEq-struct.rs +++ b/src/test/ui/derives/derives-span-PartialEq-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-PartialEq-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-struct.stderr index b8481048361e5..4e0b2fa4e6f26 100644 --- a/src/test/ui/derives/derives-span-PartialEq-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-struct.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-struct.rs:8:5 + --> $DIR/derives-span-PartialEq-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ @@ -7,7 +7,7 @@ LL | x: Error = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-struct.rs:8:5 + --> $DIR/derives-span-PartialEq-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ diff --git a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs index eaa628311361c..09a3249f0593f 100644 --- a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr index 4398d25212550..78e215534e0da 100644 --- a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-tuple-struct.rs:8:5 + --> $DIR/derives-span-PartialEq-tuple-struct.rs:9:5 | LL | Error | ^^^^^ @@ -7,7 +7,7 @@ LL | Error = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-tuple-struct.rs:8:5 + --> $DIR/derives-span-PartialEq-tuple-struct.rs:9:5 | LL | Error | ^^^^^ diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs index 0bc6f98d9825b..0d18bdc113aee 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr index ac9f45046353a..a6f0c873e2fd0 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum.rs b/src/test/ui/derives/derives-span-PartialOrd-enum.rs index ee4423f3bee7a..78e4babb976cd 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-enum.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr index 3e684aef39f24..838126111c35e 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum.rs:9:6 + --> $DIR/derives-span-PartialOrd-enum.rs:10:6 | LL | Error | ^^^^^ no implementation for `Error < Error` and `Error > Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-struct.rs b/src/test/ui/derives/derives-span-PartialOrd-struct.rs index 48435e0cd45a5..728ec75b6c40a 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-struct.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr index 10659aac64217..2df64d915a94d 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-struct.rs:8:5 + --> $DIR/derives-span-PartialOrd-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs index 2aa412e6d1d8f..c92b47e9297be 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr index cbe05e3784057..63aebe32ed298 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-tuple-struct.rs:8:5 + --> $DIR/derives-span-PartialOrd-tuple-struct.rs:9:5 | LL | Error | ^^^^^ no implementation for `Error < Error` and `Error > Error` diff --git a/src/test/ui/enum-discriminant/discriminant_value.rs b/src/test/ui/enum-discriminant/discriminant_value.rs index b7000015c71db..32d2d40241c82 100644 --- a/src/test/ui/enum-discriminant/discriminant_value.rs +++ b/src/test/ui/enum-discriminant/discriminant_value.rs @@ -51,34 +51,31 @@ enum Mixed { } pub fn main() { - unsafe { + assert_eq!(discriminant_value(&CLike1::A), 0); + assert_eq!(discriminant_value(&CLike1::B), 1); + assert_eq!(discriminant_value(&CLike1::C), 2); + assert_eq!(discriminant_value(&CLike1::D), 3); - assert_eq!(discriminant_value(&CLike1::A), 0); - assert_eq!(discriminant_value(&CLike1::B), 1); - assert_eq!(discriminant_value(&CLike1::C), 2); - assert_eq!(discriminant_value(&CLike1::D), 3); + assert_eq!(discriminant_value(&CLike2::A), 5); + assert_eq!(discriminant_value(&CLike2::B), 2); + assert_eq!(discriminant_value(&CLike2::C), 19); + assert_eq!(discriminant_value(&CLike2::D), 20); - assert_eq!(discriminant_value(&CLike2::A), 5); - assert_eq!(discriminant_value(&CLike2::B), 2); - assert_eq!(discriminant_value(&CLike2::C), 19); - assert_eq!(discriminant_value(&CLike2::D), 20); + assert_eq!(discriminant_value(&CLike3::A), 5); + assert_eq!(discriminant_value(&CLike3::B), 6); + assert_eq!(discriminant_value(&CLike3::C), -1_i8 as u64); + assert_eq!(discriminant_value(&CLike3::D), 0); - assert_eq!(discriminant_value(&CLike3::A), 5); - assert_eq!(discriminant_value(&CLike3::B), 6); - assert_eq!(discriminant_value(&CLike3::C), -1_i8 as u64); - assert_eq!(discriminant_value(&CLike3::D), 0); + assert_eq!(discriminant_value(&ADT::First(0,0)), 0); + assert_eq!(discriminant_value(&ADT::Second(5)), 1); - assert_eq!(discriminant_value(&ADT::First(0,0)), 0); - assert_eq!(discriminant_value(&ADT::Second(5)), 1); + assert_eq!(discriminant_value(&NullablePointer::Nothing), 1); + assert_eq!(discriminant_value(&NullablePointer::Something(&CONST)), 0); - assert_eq!(discriminant_value(&NullablePointer::Nothing), 1); - assert_eq!(discriminant_value(&NullablePointer::Something(&CONST)), 0); + assert_eq!(discriminant_value(&10), 0); + assert_eq!(discriminant_value(&"test"), 0); - assert_eq!(discriminant_value(&10), 0); - assert_eq!(discriminant_value(&"test"), 0); - - assert_eq!(3, discriminant_value(&Mixed::Unit)); - assert_eq!(2, discriminant_value(&Mixed::Tuple(5))); - assert_eq!(1, discriminant_value(&Mixed::Struct{a: 7, b: 11})); - } + assert_eq!(3, discriminant_value(&Mixed::Unit)); + assert_eq!(2, discriminant_value(&Mixed::Tuple(5))); + assert_eq!(1, discriminant_value(&Mixed::Struct{a: 7, b: 11})); } diff --git a/src/test/ui/impl-trait/impl-generic-mismatch.rs b/src/test/ui/impl-trait/impl-generic-mismatch.rs index f4fba4c34c142..5597df4ba499b 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch.rs +++ b/src/test/ui/impl-trait/impl-generic-mismatch.rs @@ -1,5 +1,4 @@ -// ignore-musl -// ignore-x86 +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::fmt::Debug; diff --git a/src/test/ui/impl-trait/impl-generic-mismatch.stderr b/src/test/ui/impl-trait/impl-generic-mismatch.stderr index bfe94119a02f6..2278519e95ad1 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch.stderr +++ b/src/test/ui/impl-trait/impl-generic-mismatch.stderr @@ -1,5 +1,5 @@ error[E0643]: method `foo` has incompatible signature for trait - --> $DIR/impl-generic-mismatch.rs:11:12 + --> $DIR/impl-generic-mismatch.rs:10:12 | LL | fn foo(&self, _: &impl Debug); | ---------- declaration in trait here @@ -13,7 +13,7 @@ LL | fn foo(&self, _: &impl Debug) { } | -- ^^^^^^^^^^ error[E0643]: method `bar` has incompatible signature for trait - --> $DIR/impl-generic-mismatch.rs:20:23 + --> $DIR/impl-generic-mismatch.rs:19:23 | LL | fn bar(&self, _: &U); | - declaration in trait here @@ -27,7 +27,7 @@ LL | fn bar(&self, _: &U) { } | ^^^^^^^^^^ ^ error[E0643]: method `hash` has incompatible signature for trait - --> $DIR/impl-generic-mismatch.rs:31:33 + --> $DIR/impl-generic-mismatch.rs:30:33 | LL | fn hash(&self, hasher: &mut impl Hasher) {} | ^^^^^^^^^^^ expected generic parameter, found `impl Trait` diff --git a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs index ce8c2d5168fbb..abcc92ce34d17 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs +++ b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) // aux-build:two_macros.rs macro_rules! define_vec { diff --git a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr index 8e01fc8df3def..7a55abe42556c 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr +++ b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr @@ -1,5 +1,5 @@ error: macro-expanded `extern crate` items cannot shadow names passed with `--extern` - --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:21:9 + --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:20:9 | LL | extern crate std as core; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,13 +8,13 @@ LL | define_other_core!(); | --------------------- in this macro invocation error[E0659]: `Vec` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:15:9 + --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:14:9 | LL | Vec::panic!(); | ^^^ ambiguous name | note: `Vec` could refer to the crate imported here - --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:7:9 + --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:6:9 | LL | extern crate std as Vec; | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs index eca9a67fcb387..369de04007022 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::ops::Deref; trait Trait {} diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr index d3862e3d4df60..8086d3f1fbc64 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr @@ -1,5 +1,5 @@ error: `impl` item signature doesn't match `trait` item signature - --> $DIR/mismatched_trait_impl-2.rs:10:5 + --> $DIR/mismatched_trait_impl-2.rs:9:5 | LL | fn deref(&self) -> &dyn Trait { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found fn(&Struct) -> &dyn Trait diff --git a/src/test/ui/interior-mutability/interior-mutability.rs b/src/test/ui/interior-mutability/interior-mutability.rs index 6968e3669caec..60633fdd393ee 100644 --- a/src/test/ui/interior-mutability/interior-mutability.rs +++ b/src/test/ui/interior-mutability/interior-mutability.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::cell::Cell; use std::panic::catch_unwind; fn main() { diff --git a/src/test/ui/interior-mutability/interior-mutability.stderr b/src/test/ui/interior-mutability/interior-mutability.stderr index b76fce2880552..5c129524f51b4 100644 --- a/src/test/ui/interior-mutability/interior-mutability.stderr +++ b/src/test/ui/interior-mutability/interior-mutability.stderr @@ -1,5 +1,5 @@ error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/interior-mutability.rs:7:5 + --> $DIR/interior-mutability.rs:6:5 | LL | catch_unwind(|| { x.set(23); }); | ^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary @@ -12,7 +12,7 @@ LL | pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { = help: within `std::cell::Cell`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell` = note: required because it appears within the type `std::cell::Cell` = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `&std::cell::Cell` - = note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:7:18: 7:35 x:&std::cell::Cell]` + = note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:6:18: 6:35 x:&std::cell::Cell]` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-21160.rs b/src/test/ui/issues/issue-21160.rs index dfb39743352fc..0199abbd8f04a 100644 --- a/src/test/ui/issues/issue-21160.rs +++ b/src/test/ui/issues/issue-21160.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) struct Bar; impl Bar { diff --git a/src/test/ui/issues/issue-21160.stderr b/src/test/ui/issues/issue-21160.stderr index 9f88fa2fadd4c..65ba64b49d06d 100644 --- a/src/test/ui/issues/issue-21160.stderr +++ b/src/test/ui/issues/issue-21160.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Bar: std::hash::Hash` is not satisfied - --> $DIR/issue-21160.rs:10:12 + --> $DIR/issue-21160.rs:9:12 | LL | struct Foo(Bar); | ^^^ the trait `std::hash::Hash` is not implemented for `Bar` diff --git a/src/test/ui/issues/issue-27033.rs b/src/test/ui/issues/issue-27033.rs index bcb06d743a05d..7120dee6339f1 100644 --- a/src/test/ui/issues/issue-27033.rs +++ b/src/test/ui/issues/issue-27033.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) fn main() { match Some(1) { None @ _ => {} //~ ERROR match bindings cannot shadow unit variants diff --git a/src/test/ui/issues/issue-27033.stderr b/src/test/ui/issues/issue-27033.stderr index a4baa7bdf7f85..2d6d2ef41bd74 100644 --- a/src/test/ui/issues/issue-27033.stderr +++ b/src/test/ui/issues/issue-27033.stderr @@ -1,5 +1,5 @@ error[E0530]: match bindings cannot shadow unit variants - --> $DIR/issue-27033.rs:5:9 + --> $DIR/issue-27033.rs:4:9 | LL | None @ _ => {} | ^^^^ cannot be named the same as a unit variant @@ -10,7 +10,7 @@ LL | pub use crate::option::Option::{self, Some, None}; | ---- the unit variant `None` is defined here error[E0530]: match bindings cannot shadow constants - --> $DIR/issue-27033.rs:9:9 + --> $DIR/issue-27033.rs:8:9 | LL | const C: u8 = 1; | ---------------- the constant `C` is defined here diff --git a/src/test/ui/issues/issue-43398.rs b/src/test/ui/issues/issue-43398.rs index ae52e8f3f6b43..f0b762c6254a3 100644 --- a/src/test/ui/issues/issue-43398.rs +++ b/src/test/ui/issues/issue-43398.rs @@ -7,9 +7,7 @@ enum Big { A, B } fn main() { - unsafe { - println!("{} {:?}", - std::intrinsics::discriminant_value(&Big::A), - std::mem::discriminant(&Big::B)); - } + println!("{} {:?}", + std::intrinsics::discriminant_value(&Big::A), + std::mem::discriminant(&Big::B)); } diff --git a/src/test/ui/issues/issue-51582.rs b/src/test/ui/issues/issue-51582.rs index 63ef05729bc56..40a70c623a741 100644 --- a/src/test/ui/issues/issue-51582.rs +++ b/src/test/ui/issues/issue-51582.rs @@ -14,5 +14,5 @@ fn main() { assert_eq!(1, make_b() as u8); assert_eq!(1, make_b() as i32); assert_eq!(1, make_b() as u32); - assert_eq!(1, unsafe { std::intrinsics::discriminant_value(&make_b()) }); + assert_eq!(1, std::intrinsics::discriminant_value(&make_b())); } diff --git a/src/test/ui/lint/uninitialized-zeroed.stderr b/src/test/ui/lint/uninitialized-zeroed.stderr index e12b1897ade1b..bdb5959953f50 100644 --- a/src/test/ui/lint/uninitialized-zeroed.stderr +++ b/src/test/ui/lint/uninitialized-zeroed.stderr @@ -5,7 +5,7 @@ LL | let _val: &'static T = mem::zeroed(); | ^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: lint level defined here --> $DIR/uninitialized-zeroed.rs:7:9 @@ -21,7 +21,7 @@ LL | let _val: &'static T = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: References must be non-null @@ -32,7 +32,7 @@ LL | let _val: Wrap<&'static T> = mem::zeroed(); | ^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: References must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:18:18 @@ -47,7 +47,7 @@ LL | let _val: Wrap<&'static T> = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: References must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:18:18 @@ -62,7 +62,7 @@ LL | let _val: ! = mem::zeroed(); | ^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: The never type (`!`) has no valid value @@ -73,7 +73,7 @@ LL | let _val: ! = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: The never type (`!`) has no valid value @@ -84,7 +84,7 @@ LL | let _val: (i32, !) = mem::zeroed(); | ^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: The never type (`!`) has no valid value @@ -95,7 +95,7 @@ LL | let _val: (i32, !) = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: The never type (`!`) has no valid value @@ -106,7 +106,7 @@ LL | let _val: Void = mem::zeroed(); | ^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: 0-variant enums have no valid value @@ -117,7 +117,7 @@ LL | let _val: Void = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: 0-variant enums have no valid value @@ -128,7 +128,7 @@ LL | let _val: &'static i32 = mem::zeroed(); | ^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: References must be non-null @@ -139,7 +139,7 @@ LL | let _val: &'static i32 = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: References must be non-null @@ -150,7 +150,7 @@ LL | let _val: Ref = mem::zeroed(); | ^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: References must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:15:12 @@ -165,7 +165,7 @@ LL | let _val: Ref = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: References must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:15:12 @@ -180,7 +180,7 @@ LL | let _val: fn() = mem::zeroed(); | ^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: Function pointers must be non-null @@ -191,7 +191,7 @@ LL | let _val: fn() = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: Function pointers must be non-null @@ -202,7 +202,7 @@ LL | let _val: Wrap = mem::zeroed(); | ^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: Function pointers must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:18:18 @@ -217,7 +217,7 @@ LL | let _val: Wrap = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: Function pointers must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:18:18 @@ -232,7 +232,7 @@ LL | let _val: WrapEnum = mem::zeroed(); | ^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: Function pointers must be non-null (in this enum field) --> $DIR/uninitialized-zeroed.rs:19:28 @@ -247,7 +247,7 @@ LL | let _val: WrapEnum = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: Function pointers must be non-null (in this enum field) --> $DIR/uninitialized-zeroed.rs:19:28 @@ -262,7 +262,7 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed(); | ^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: References must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:16:16 @@ -277,7 +277,7 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: References must be non-null (in this struct field) --> $DIR/uninitialized-zeroed.rs:16:16 @@ -292,7 +292,7 @@ LL | let _val: NonNull = mem::zeroed(); | ^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: std::ptr::NonNull must be non-null @@ -303,7 +303,7 @@ LL | let _val: NonNull = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: std::ptr::NonNull must be non-null @@ -314,7 +314,7 @@ LL | let _val: *const dyn Send = mem::zeroed(); | ^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: The vtable of a wide raw pointer must be non-null @@ -325,7 +325,7 @@ LL | let _val: *const dyn Send = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: The vtable of a wide raw pointer must be non-null @@ -336,7 +336,7 @@ LL | let _val: bool = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: Booleans must be `true` or `false` @@ -347,7 +347,7 @@ LL | let _val: Wrap = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | note: Characters must be a valid unicode codepoint (in this struct field) --> $DIR/uninitialized-zeroed.rs:18:18 @@ -362,7 +362,7 @@ LL | let _val: NonBig = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: NonBig must be initialized inside its custom valid range @@ -373,7 +373,7 @@ LL | let _val: &'static i32 = mem::transmute(0usize); | ^^^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: References must be non-null @@ -384,7 +384,7 @@ LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: References must be non-null @@ -395,7 +395,7 @@ LL | let _val: NonZeroU32 = mem::transmute(0); | ^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: std::num::NonZeroU32 must be non-null @@ -406,7 +406,7 @@ LL | let _val: NonNull = MaybeUninit::zeroed().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: std::ptr::NonNull must be non-null @@ -417,7 +417,7 @@ LL | let _val: NonNull = MaybeUninit::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: std::ptr::NonNull must be non-null @@ -428,7 +428,7 @@ LL | let _val: bool = MaybeUninit::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed - | help: use `MaybeUninit` instead + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done | = note: Booleans must be `true` or `false` diff --git a/src/test/ui/no-send-res-ports.rs b/src/test/ui/no-send-res-ports.rs index 01fc29713a45d..85d812dd61904 100644 --- a/src/test/ui/no-send-res-ports.rs +++ b/src/test/ui/no-send-res-ports.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::thread; use std::rc::Rc; diff --git a/src/test/ui/no-send-res-ports.stderr b/src/test/ui/no-send-res-ports.stderr index dc186f7c85e94..f23a3bf832ab6 100644 --- a/src/test/ui/no-send-res-ports.stderr +++ b/src/test/ui/no-send-res-ports.stderr @@ -1,5 +1,5 @@ error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely - --> $DIR/no-send-res-ports.rs:27:5 + --> $DIR/no-send-res-ports.rs:26:5 | LL | thread::spawn(move|| { | ^^^^^^^^^^^^^ `std::rc::Rc<()>` cannot be sent between threads safely @@ -9,10 +9,10 @@ LL | thread::spawn(move|| { LL | F: FnOnce() -> T, F: Send + 'static, T: Send + 'static | ---- required by this bound in `std::thread::spawn` | - = help: within `[closure@$DIR/no-send-res-ports.rs:27:19: 31:6 x:main::Foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>` + = help: within `[closure@$DIR/no-send-res-ports.rs:26:19: 30:6 x:main::Foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>` = note: required because it appears within the type `Port<()>` = note: required because it appears within the type `main::Foo` - = note: required because it appears within the type `[closure@$DIR/no-send-res-ports.rs:27:19: 31:6 x:main::Foo]` + = note: required because it appears within the type `[closure@$DIR/no-send-res-ports.rs:26:19: 30:6 x:main::Foo]` error: aborting due to previous error diff --git a/src/test/ui/pathless-extern-ok.rs b/src/test/ui/pathless-extern-ok.rs new file mode 100644 index 0000000000000..0ffa5eb894040 --- /dev/null +++ b/src/test/ui/pathless-extern-ok.rs @@ -0,0 +1,9 @@ +// edition:2018 +// compile-flags:--extern alloc +// build-pass + +// Test that `--extern alloc` will load from the sysroot without error. + +fn main() { + let _: Vec = alloc::vec::Vec::new(); +} diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.rs b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.rs index c27cea302fc40..a028247ec5c11 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.rs +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.rs @@ -1,6 +1,5 @@ // compile-flags: --test -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::num::ParseFloatError; diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr index 6aa95c308f248..9cefef58bf53a 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr @@ -1,5 +1,5 @@ error[E0277]: `main` has invalid return type `std::result::Result` - --> $DIR/termination-trait-test-wrong-type.rs:8:1 + --> $DIR/termination-trait-test-wrong-type.rs:7:1 | LL | / fn can_parse_zero_as_f32() -> Result { LL | | "0".parse() diff --git a/src/test/ui/traits/trait-suggest-where-clause.rs b/src/test/ui/traits/trait-suggest-where-clause.rs index 5ed14a6a86685..5d3464d20f30d 100644 --- a/src/test/ui/traits/trait-suggest-where-clause.rs +++ b/src/test/ui/traits/trait-suggest-where-clause.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::mem; struct Misc(T); diff --git a/src/test/ui/traits/trait-suggest-where-clause.stderr b/src/test/ui/traits/trait-suggest-where-clause.stderr index f1004ea9dc6ee..2bb7defdac710 100644 --- a/src/test/ui/traits/trait-suggest-where-clause.stderr +++ b/src/test/ui/traits/trait-suggest-where-clause.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `U` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:9:20 + --> $DIR/trait-suggest-where-clause.rs:8:20 | LL | fn check() { | -- help: consider further restricting this bound: `U: std::marker::Sized +` @@ -16,7 +16,7 @@ LL | pub const fn size_of() -> usize { = note: to learn more, visit error[E0277]: the size for values of type `U` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:12:5 + --> $DIR/trait-suggest-where-clause.rs:11:5 | LL | fn check() { | -- help: consider further restricting this bound: `U: std::marker::Sized +` @@ -34,7 +34,7 @@ LL | pub const fn size_of() -> usize { = note: required because it appears within the type `Misc` error[E0277]: the trait bound `u64: std::convert::From` is not satisfied - --> $DIR/trait-suggest-where-clause.rs:17:5 + --> $DIR/trait-suggest-where-clause.rs:16:5 | LL | >::from; | ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From` is not implemented for `u64` @@ -42,7 +42,7 @@ LL | >::from; = note: required by `std::convert::From::from` error[E0277]: the trait bound `u64: std::convert::From<::Item>` is not satisfied - --> $DIR/trait-suggest-where-clause.rs:20:5 + --> $DIR/trait-suggest-where-clause.rs:19:5 | LL | ::Item>>::from; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<::Item>` is not implemented for `u64` @@ -50,7 +50,7 @@ LL | ::Item>>::from; = note: required by `std::convert::From::from` error[E0277]: the trait bound `Misc<_>: std::convert::From` is not satisfied - --> $DIR/trait-suggest-where-clause.rs:25:5 + --> $DIR/trait-suggest-where-clause.rs:24:5 | LL | as From>::from; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From` is not implemented for `Misc<_>` @@ -58,7 +58,7 @@ LL | as From>::from; = note: required by `std::convert::From::from` error[E0277]: the size for values of type `[T]` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:30:20 + --> $DIR/trait-suggest-where-clause.rs:29:20 | LL | mem::size_of::<[T]>(); | ^^^ doesn't have a size known at compile-time @@ -72,7 +72,7 @@ LL | pub const fn size_of() -> usize { = note: to learn more, visit error[E0277]: the size for values of type `[&U]` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:33:5 + --> $DIR/trait-suggest-where-clause.rs:32:5 | LL | mem::size_of::<[&U]>(); | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time diff --git a/src/test/ui/type_length_limit.rs b/src/test/ui/type_length_limit.rs index cd15f81a61535..926f12911c52a 100644 --- a/src/test/ui/type_length_limit.rs +++ b/src/test/ui/type_length_limit.rs @@ -1,5 +1,4 @@ -// ignore-musl -// ignore-x86 +// ignore-x86 FIXME: missing sysroot spans (#53081) // error-pattern: reached the type-length limit while instantiating // Test that the type length limit can be changed. diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index 9302909968615..5abe481368df5 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -160,6 +160,8 @@ pub fn check(path: &Path, bad: &mut bool) { let can_contain = contents.contains("// ignore-tidy-") || contents.contains("# ignore-tidy-"); let mut skip_cr = contains_ignore_directive(can_contain, &contents, "cr"); + let mut skip_undocumented_unsafe = + contains_ignore_directive(can_contain, &contents, "undocumented-unsafe"); let mut skip_tab = contains_ignore_directive(can_contain, &contents, "tab"); let mut skip_line_length = contains_ignore_directive(can_contain, &contents, "linelength"); let mut skip_file_length = contains_ignore_directive(can_contain, &contents, "filelength"); @@ -171,6 +173,7 @@ pub fn check(path: &Path, bad: &mut bool) { let mut leading_new_lines = false; let mut trailing_new_lines = 0; let mut lines = 0; + let mut last_safety_comment = false; for (i, line) in contents.split('\n').enumerate() { let mut err = |msg: &str| { tidy_error!(bad, "{}:{}: {}", file.display(), i + 1, msg); @@ -200,6 +203,20 @@ pub fn check(path: &Path, bad: &mut bool) { err("XXX is deprecated; use FIXME") } } + let is_test = || file.components().any(|c| c.as_os_str() == "tests"); + // for now we just check libcore + if line.contains("unsafe {") && !line.trim().starts_with("//") && !last_safety_comment { + if file.components().any(|c| c.as_os_str() == "libcore") && !is_test() { + suppressible_tidy_err!(err, skip_undocumented_unsafe, "undocumented unsafe"); + } + } + if line.contains("// SAFETY: ") || line.contains("// Safety: ") { + last_safety_comment = true; + } else if line.trim().starts_with("//") || line.trim().is_empty() { + // keep previous value + } else { + last_safety_comment = false; + } if (line.starts_with("// Copyright") || line.starts_with("# Copyright") || line.starts_with("Copyright"))