From adddee4946fb2138f8aa4bc56daafed939301535 Mon Sep 17 00:00:00 2001 From: MikaelUrankar Date: Sat, 2 Feb 2019 16:41:38 +0100 Subject: [PATCH 001/381] Add FreeBSD armv6 and armv7 targets --- src/bootstrap/bootstrap.py | 4 ++++ .../spec/armv6_unknown_freebsd.rs | 24 +++++++++++++++++++ .../spec/armv7_unknown_freebsd.rs | 24 +++++++++++++++++++ src/librustc_target/spec/mod.rs | 2 ++ 4 files changed, 54 insertions(+) create mode 100644 src/librustc_target/spec/armv6_unknown_freebsd.rs create mode 100644 src/librustc_target/spec/armv7_unknown_freebsd.rs diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 119b38bcc99d..7813d9bd63c0 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -262,6 +262,10 @@ def default_build_triple(): cputype = 'arm' if ostype == 'linux-android': ostype = 'linux-androideabi' + elif ostype == 'unknown-freebsd': + cputype = subprocess.check_output( + ['uname', '-p']).strip().decode(default_encoding) + ostype = 'unknown-freebsd' elif cputype == 'armv6l': cputype = 'arm' if ostype == 'linux-android': diff --git a/src/librustc_target/spec/armv6_unknown_freebsd.rs b/src/librustc_target/spec/armv6_unknown_freebsd.rs new file mode 100644 index 000000000000..39886a16a740 --- /dev/null +++ b/src/librustc_target/spec/armv6_unknown_freebsd.rs @@ -0,0 +1,24 @@ +use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; + +pub fn target() -> TargetResult { + let base = super::freebsd_base::opts(); + Ok(Target { + llvm_target: "armv6-unknown-freebsd-gnueabihf".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + arch: "arm".to_string(), + target_os: "freebsd".to_string(), + target_env: "gnueabihf".to_string(), + target_vendor: "unknown".to_string(), + linker_flavor: LinkerFlavor::Gcc, + + options: TargetOptions { + features: "+v6,+vfp2".to_string(), + max_atomic_width: Some(64), + abi_blacklist: super::arm_base::abi_blacklist(), + .. base + } + }) +} diff --git a/src/librustc_target/spec/armv7_unknown_freebsd.rs b/src/librustc_target/spec/armv7_unknown_freebsd.rs new file mode 100644 index 000000000000..ba63fd2bf053 --- /dev/null +++ b/src/librustc_target/spec/armv7_unknown_freebsd.rs @@ -0,0 +1,24 @@ +use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; + +pub fn target() -> TargetResult { + let base = super::freebsd_base::opts(); + Ok(Target { + llvm_target: "armv7-unknown-freebsd-gnueabihf".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + arch: "arm".to_string(), + target_os: "freebsd".to_string(), + target_env: "gnueabihf".to_string(), + target_vendor: "unknown".to_string(), + linker_flavor: LinkerFlavor::Gcc, + + options: TargetOptions { + features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(), + max_atomic_width: Some(64), + abi_blacklist: super::arm_base::abi_blacklist(), + .. base + } + }) +} diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index e47da3cff95b..5c40aaaa6b07 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -366,6 +366,8 @@ supported_targets! { ("aarch64-linux-android", aarch64_linux_android), ("aarch64-unknown-freebsd", aarch64_unknown_freebsd), + ("armv6-unknown-freebsd", armv6_unknown_freebsd), + ("armv7-unknown-freebsd", armv7_unknown_freebsd), ("i686-unknown-freebsd", i686_unknown_freebsd), ("powerpc64-unknown-freebsd", powerpc64_unknown_freebsd), ("x86_64-unknown-freebsd", x86_64_unknown_freebsd), From 95840b35fc047af16ac4d1c7c0948761295494f8 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Wed, 13 Feb 2019 12:30:53 +0100 Subject: [PATCH 002/381] Relax Read bounds on a bunch of BufReader methods --- src/libstd/io/buffered.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 0615cd59db4e..d760d88cdc22 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -101,7 +101,9 @@ impl BufReader { } } } +} +impl BufReader { /// Gets a reference to the underlying reader. /// /// It is inadvisable to directly read from the underlying reader. From 85f13f0d42fe7ee0a5850a271e8a1c975ad5b85f Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 8 Feb 2019 14:54:22 +0100 Subject: [PATCH 003/381] Add a convert::Infallible empty enum, make string::ParseError an alias --- src/liballoc/string.rs | 37 ++--------------- src/libcore/convert.rs | 93 ++++++++++++++++++++++++++++++++++++++++++ src/libstd/path.rs | 3 +- 3 files changed, 97 insertions(+), 36 deletions(-) diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index 84c35c6f1bd2..b714df5d36b6 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -486,7 +486,7 @@ impl String { /// [`str::from_utf8`]: ../../std/str/fn.from_utf8.html /// [`as_bytes`]: struct.String.html#method.as_bytes /// [`FromUtf8Error`]: struct.FromUtf8Error.html - /// [`Err`]: ../../stdresult/enum.Result.html#variant.Err + /// [`Err`]: ../../std/result/enum.Result.html#variant.Err #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn from_utf8(vec: Vec) -> Result { @@ -2073,48 +2073,17 @@ impl ops::DerefMut for String { /// [`String`]: struct.String.html /// [`from_str`]: ../../std/str/trait.FromStr.html#tymethod.from_str #[stable(feature = "str_parse_error", since = "1.5.0")] -#[derive(Copy)] -pub enum ParseError {} +pub type ParseError = core::convert::Infallible; #[stable(feature = "rust1", since = "1.0.0")] impl FromStr for String { - type Err = ParseError; + type Err = core::convert::Infallible; #[inline] fn from_str(s: &str) -> Result { Ok(String::from(s)) } } -#[stable(feature = "str_parse_error", since = "1.5.0")] -impl Clone for ParseError { - fn clone(&self) -> ParseError { - match *self {} - } -} - -#[stable(feature = "str_parse_error", since = "1.5.0")] -impl fmt::Debug for ParseError { - fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { - match *self {} - } -} - -#[stable(feature = "str_parse_error2", since = "1.8.0")] -impl fmt::Display for ParseError { - fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { - match *self {} - } -} - -#[stable(feature = "str_parse_error", since = "1.5.0")] -impl PartialEq for ParseError { - fn eq(&self, _: &ParseError) -> bool { - match *self {} - } -} - -#[stable(feature = "str_parse_error", since = "1.5.0")] -impl Eq for ParseError {} /// A trait for converting a value to a `String`. /// diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 4a7c6e15a4df..b31b71aef658 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -499,3 +499,96 @@ impl AsRef for str { self } } + +//////////////////////////////////////////////////////////////////////////////// +// THE NO-ERROR ERROR TYPE +//////////////////////////////////////////////////////////////////////////////// + +/// The error type for errors that can never happen. +/// +/// Since this enum has no variant, a value of this type can never actually exist. +/// This can be useful for generic APIs that use [`Result`] and parameterize the error type, +/// to indicate that the result is always [`Ok`]. +/// +/// For example, the [`TryFrom`] trait (conversion that returns a [`Result`]) +/// has a blanket implementation for all types where a reverse [`Into`] implementation exists. +/// +/// ```ignore (illustrates std code, duplicating the impl in a doctest would be an error) +/// impl TryFrom for T where U: Into { +/// type Error = Infallible; +/// +/// fn try_from(value: U) -> Result { +/// Ok(U::into(value)) // Never returns `Err` +/// } +/// } +/// ``` +/// +/// # Future compatibility +/// +/// This enum has the same role as [the `!` “never” type][never], +/// which is unstable in this version of Rust. +/// When `!` is stabilized, we plan to make `Infallible` a type alias to it: +/// +/// ```ignore (illustrates future std change) +/// pub type Infallible = !; +/// ``` +/// +/// … and eventually deprecate `Infallible`. +/// +/// +/// However there is one case where `!` syntax can be used +/// before `!` is stabilized as a full-fleged type: in the position of a function’s return type. +/// Specifically, it is possible implementations for two different function pointer types: +/// +/// ``` +/// trait MyTrait {} +/// impl MyTrait for fn() -> ! {} +/// impl MyTrait for fn() -> std::convert::Infallible {} +/// ``` +/// +/// With `Infallible` being an enum, this code is valid. +/// However when `Infallible` becomes an alias for the never type, +/// the two `impl`s will start to overlap +/// and therefore will be disallowed by the language’s trait coherence rules. +/// +/// [`Ok`]: ../result/enum.Result.html#variant.Ok +/// [`Result`]: ../result/enum.Result.html +/// [`TryFrom`]: trait.TryFrom.html +/// [`Into`]: trait.Into.html +/// [never]: ../../std/primitive.never.html +#[stable(feature = "convert_infallible", since = "1.34.0")] +#[derive(Copy)] +pub enum Infallible {} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl Clone for Infallible { + fn clone(&self) -> Infallible { + match *self {} + } +} + +use fmt; + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl fmt::Debug for Infallible { + fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { + match *self {} + } +} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl fmt::Display for Infallible { + fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { + match *self {} + } +} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl PartialEq for Infallible { + fn eq(&self, _: &Infallible) -> bool { + match *self {} + } +} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl Eq for Infallible {} diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 0f1d627fa1e8..d9199666e583 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -78,7 +78,6 @@ use iter::{self, FusedIterator}; use ops::{self, Deref}; use rc::Rc; use str::FromStr; -use string::ParseError; use sync::Arc; use ffi::{OsStr, OsString}; @@ -1453,7 +1452,7 @@ impl From for PathBuf { #[stable(feature = "path_from_str", since = "1.32.0")] impl FromStr for PathBuf { - type Err = ParseError; + type Err = core::convert::Infallible; fn from_str(s: &str) -> Result { Ok(PathBuf::from(s)) From 2f7120397f5178fd3b389c2551a03991f3f4ee31 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 8 Feb 2019 14:55:44 +0100 Subject: [PATCH 004/381] Use convert::Infallible instead of never in the blanket TryFrom impl --- src/libcore/convert.rs | 2 +- src/libcore/num/mod.rs | 14 ++++++++++++-- src/test/run-pass/try_from.rs | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index b31b71aef658..06344ed5ff76 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -467,7 +467,7 @@ impl TryInto for T where U: TryFrom // with an uninhabited error type. #[unstable(feature = "try_from", issue = "33417")] impl TryFrom for T where U: Into { - type Error = !; + type Error = Infallible; fn try_from(value: U) -> Result { Ok(U::into(value)) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 6fb67ea9c9ac..ae7f1fe98c99 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -2,7 +2,7 @@ #![stable(feature = "rust1", since = "1.0.0")] -use convert::TryFrom; +use convert::{TryFrom, Infallible}; use fmt; use intrinsics; use mem; @@ -4531,9 +4531,19 @@ impl fmt::Display for TryFromIntError { } #[unstable(feature = "try_from", issue = "33417")] +impl From for TryFromIntError { + fn from(x: Infallible) -> TryFromIntError { + match x {} + } +} + +#[unstable(feature = "never_type", issue = "35121")] impl From for TryFromIntError { fn from(never: !) -> TryFromIntError { - never + // Match rather than coerce to make sure that code like + // `From for TryFromIntError` above will keep working + // when `Infallible` becomes an alias to `!`. + match never {} } } diff --git a/src/test/run-pass/try_from.rs b/src/test/run-pass/try_from.rs index 4522ce3a8d61..797e7937045c 100644 --- a/src/test/run-pass/try_from.rs +++ b/src/test/run-pass/try_from.rs @@ -6,7 +6,7 @@ #![feature(try_from, never_type)] -use std::convert::TryInto; +use std::convert::{TryInto, Infallible}; struct Foo { t: T, @@ -32,6 +32,6 @@ impl Into> for Foo { } pub fn main() { - let _: Result, !> = Foo { t: 10 }.try_into(); + let _: Result, Infallible> = Foo { t: 10 }.try_into(); } From c80a8f51dcdc90dd8a5234f3bef6160814eee5df Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 8 Feb 2019 15:00:47 +0100 Subject: [PATCH 005/381] Stabilize TryFrom and TryInto --- src/libcore/array.rs | 8 ++++---- src/libcore/char/convert.rs | 6 +++--- src/libcore/char/mod.rs | 2 +- src/libcore/convert.rs | 12 +++++++---- src/libcore/num/mod.rs | 20 +++++++------------ src/libcore/tests/lib.rs | 1 - src/librustc_apfloat/lib.rs | 1 - src/librustc_mir/lib.rs | 1 - src/libstd/error.rs | 6 +++--- src/libstd/lib.rs | 1 - .../run-pass/try-from-int-error-partial-eq.rs | 1 - src/test/run-pass/try_from.rs | 2 +- src/test/ui/e0119/conflict-with-std.rs | 1 - src/test/ui/e0119/conflict-with-std.stderr | 6 +++--- 14 files changed, 30 insertions(+), 38 deletions(-) diff --git a/src/libcore/array.rs b/src/libcore/array.rs index 3a27a39af4ac..9c6ecc435024 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -49,7 +49,7 @@ unsafe impl> FixedSizeArray for A { } /// The error type returned when a conversion from a slice to an array fails. -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] #[derive(Debug, Copy, Clone)] pub struct TryFromSliceError(()); @@ -138,7 +138,7 @@ macro_rules! array_impls { } } - #[unstable(feature = "try_from", issue = "33417")] + #[stable(feature = "try_from", since = "1.34.0")] impl<'a, T> TryFrom<&'a [T]> for [T; $N] where T: Copy { type Error = TryFromSliceError; @@ -147,7 +147,7 @@ macro_rules! array_impls { } } - #[unstable(feature = "try_from", issue = "33417")] + #[stable(feature = "try_from", since = "1.34.0")] impl<'a, T> TryFrom<&'a [T]> for &'a [T; $N] { type Error = TryFromSliceError; @@ -161,7 +161,7 @@ macro_rules! array_impls { } } - #[unstable(feature = "try_from", issue = "33417")] + #[stable(feature = "try_from", since = "1.34.0")] impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; $N] { type Error = TryFromSliceError; diff --git a/src/libcore/char/convert.rs b/src/libcore/char/convert.rs index 4a1a236b669f..6a5abfb408f5 100644 --- a/src/libcore/char/convert.rs +++ b/src/libcore/char/convert.rs @@ -218,7 +218,7 @@ impl FromStr for char { } -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl TryFrom for char { type Error = CharTryFromError; @@ -233,11 +233,11 @@ impl TryFrom for char { } /// The error type returned when a conversion from u32 to char fails. -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct CharTryFromError(()); -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl fmt::Display for CharTryFromError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { "converted integer out of range for `char`".fmt(f) diff --git a/src/libcore/char/mod.rs b/src/libcore/char/mod.rs index 15e153bdfada..f3369c4d9401 100644 --- a/src/libcore/char/mod.rs +++ b/src/libcore/char/mod.rs @@ -30,7 +30,7 @@ pub use self::convert::{from_u32, from_digit}; pub use self::convert::from_u32_unchecked; #[stable(feature = "char_from_str", since = "1.20.0")] pub use self::convert::ParseCharError; -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] pub use self::convert::CharTryFromError; #[stable(feature = "decode_utf16", since = "1.9.0")] pub use self::decode::{decode_utf16, DecodeUtf16, DecodeUtf16Error}; diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 06344ed5ff76..65aa91e2dab0 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -370,22 +370,26 @@ pub trait From: Sized { /// /// [`TryFrom`]: trait.TryFrom.html /// [`Into`]: trait.Into.html -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] pub trait TryInto: Sized { /// The type returned in the event of a conversion error. + #[stable(feature = "try_from", since = "1.34.0")] type Error; /// Performs the conversion. + #[stable(feature = "try_from", since = "1.34.0")] fn try_into(self) -> Result; } /// Attempt to construct `Self` via a conversion. -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] pub trait TryFrom: Sized { /// The type returned in the event of a conversion error. + #[stable(feature = "try_from", since = "1.34.0")] type Error; /// Performs the conversion. + #[stable(feature = "try_from", since = "1.34.0")] fn try_from(value: T) -> Result; } @@ -453,7 +457,7 @@ impl From for T { // TryFrom implies TryInto -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl TryInto for T where U: TryFrom { type Error = U::Error; @@ -465,7 +469,7 @@ impl TryInto for T where U: TryFrom // Infallible conversions are semantically equivalent to fallible conversions // with an uninhabited error type. -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl TryFrom for T where U: Into { type Error = Infallible; diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index ae7f1fe98c99..ffd9e4a5cab0 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -2004,7 +2004,6 @@ assert_eq!(value, ", $swap_op, "); When starting from a slice rather than an array, fallible conversion APIs can be used: ``` -#![feature(try_from)] use std::convert::TryInto; fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { @@ -2036,7 +2035,6 @@ assert_eq!(value, ", $swap_op, "); When starting from a slice rather than an array, fallible conversion APIs can be used: ``` -#![feature(try_from)] use std::convert::TryInto; fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { @@ -2078,7 +2076,6 @@ assert_eq!(value, ", $swap_op, "); When starting from a slice rather than an array, fallible conversion APIs can be used: ``` -#![feature(try_from)] use std::convert::TryInto; fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { @@ -3771,7 +3768,6 @@ assert_eq!(value, ", $swap_op, "); When starting from a slice rather than an array, fallible conversion APIs can be used: ``` -#![feature(try_from)] use std::convert::TryInto; fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { @@ -3803,7 +3799,6 @@ assert_eq!(value, ", $swap_op, "); When starting from a slice rather than an array, fallible conversion APIs can be used: ``` -#![feature(try_from)] use std::convert::TryInto; fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { @@ -3845,7 +3840,6 @@ assert_eq!(value, ", $swap_op, "); When starting from a slice rather than an array, fallible conversion APIs can be used: ``` -#![feature(try_from)] use std::convert::TryInto; fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { @@ -4508,7 +4502,7 @@ macro_rules! from_str_radix_int_impl { from_str_radix_int_impl! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 } /// The error type returned when a checked integral type conversion fails. -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct TryFromIntError(()); @@ -4523,14 +4517,14 @@ impl TryFromIntError { } } -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl fmt::Display for TryFromIntError { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { self.__description().fmt(fmt) } } -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl From for TryFromIntError { fn from(x: Infallible) -> TryFromIntError { match x {} @@ -4550,7 +4544,7 @@ impl From for TryFromIntError { // no possible bounds violation macro_rules! try_from_unbounded { ($source:ty, $($target:ty),*) => {$( - #[unstable(feature = "try_from", issue = "33417")] + #[stable(feature = "try_from", since = "1.34.0")] impl TryFrom<$source> for $target { type Error = TryFromIntError; @@ -4565,7 +4559,7 @@ macro_rules! try_from_unbounded { // only negative bounds macro_rules! try_from_lower_bounded { ($source:ty, $($target:ty),*) => {$( - #[unstable(feature = "try_from", issue = "33417")] + #[stable(feature = "try_from", since = "1.34.0")] impl TryFrom<$source> for $target { type Error = TryFromIntError; @@ -4584,7 +4578,7 @@ macro_rules! try_from_lower_bounded { // unsigned to signed (only positive bound) macro_rules! try_from_upper_bounded { ($source:ty, $($target:ty),*) => {$( - #[unstable(feature = "try_from", issue = "33417")] + #[stable(feature = "try_from", since = "1.34.0")] impl TryFrom<$source> for $target { type Error = TryFromIntError; @@ -4603,7 +4597,7 @@ macro_rules! try_from_upper_bounded { // all other cases macro_rules! try_from_both_bounded { ($source:ty, $($target:ty),*) => {$( - #[unstable(feature = "try_from", issue = "33417")] + #[stable(feature = "try_from", since = "1.34.0")] impl TryFrom<$source> for $target { type Error = TryFromIntError; diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 3e8549f8ae36..06df75b1ee8f 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -27,7 +27,6 @@ #![feature(str_internals)] #![feature(test)] #![feature(trusted_len)] -#![feature(try_from)] #![feature(try_trait)] #![feature(align_offset)] #![feature(reverse_bits)] diff --git a/src/librustc_apfloat/lib.rs b/src/librustc_apfloat/lib.rs index 46d046d7b41b..1b0bcdd0b5b4 100644 --- a/src/librustc_apfloat/lib.rs +++ b/src/librustc_apfloat/lib.rs @@ -35,7 +35,6 @@ #![deny(rust_2018_idioms)] #![feature(nll)] -#![feature(try_from)] // See librustc_cratesio_shim/Cargo.toml for a comment explaining this. #[allow(unused_extern_crates)] extern crate rustc_cratesio_shim; diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index 909f96956695..bc8e94122273 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -24,7 +24,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![feature(unicode_internals)] #![feature(step_trait)] #![feature(slice_concat_ext)] -#![feature(try_from)] #![feature(reverse_bits)] #![feature(try_blocks)] diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 6348b411a4c6..cd930240465c 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -466,14 +466,14 @@ impl Error for num::ParseIntError { } } -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl Error for num::TryFromIntError { fn description(&self) -> &str { self.__description() } } -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl Error for array::TryFromSliceError { fn description(&self) -> &str { self.__description() @@ -548,7 +548,7 @@ impl Error for cell::BorrowMutError { } } -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl Error for char::CharTryFromError { fn description(&self) -> &str { "converted integer out of range for `char`" diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index e57cb2ce5fd1..47d2f1132459 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -281,7 +281,6 @@ #![feature(rustc_private)] #![feature(thread_local)] #![feature(toowned_clone_into)] -#![feature(try_from)] #![feature(try_reserve)] #![feature(unboxed_closures)] #![feature(untagged_unions)] diff --git a/src/test/run-pass/try-from-int-error-partial-eq.rs b/src/test/run-pass/try-from-int-error-partial-eq.rs index 83ede6759257..e9b53f2d1c8d 100644 --- a/src/test/run-pass/try-from-int-error-partial-eq.rs +++ b/src/test/run-pass/try-from-int-error-partial-eq.rs @@ -1,4 +1,3 @@ -#![feature(try_from)] #![allow(unused_must_use)] use std::convert::TryFrom; diff --git a/src/test/run-pass/try_from.rs b/src/test/run-pass/try_from.rs index 797e7937045c..e42f2c3e3930 100644 --- a/src/test/run-pass/try_from.rs +++ b/src/test/run-pass/try_from.rs @@ -4,7 +4,7 @@ // This test was added to show the motivation for doing this // over `TryFrom` being blanket impl for all `T: From` -#![feature(try_from, never_type)] +#![feature(never_type)] use std::convert::{TryInto, Infallible}; diff --git a/src/test/ui/e0119/conflict-with-std.rs b/src/test/ui/e0119/conflict-with-std.rs index e639bc5db5e0..6dc81f33dfcc 100644 --- a/src/test/ui/e0119/conflict-with-std.rs +++ b/src/test/ui/e0119/conflict-with-std.rs @@ -1,4 +1,3 @@ -#![feature(try_from)] use std::marker::PhantomData; use std::convert::{TryFrom, AsRef}; diff --git a/src/test/ui/e0119/conflict-with-std.stderr b/src/test/ui/e0119/conflict-with-std.stderr index c2ae321aa5e5..1cfb3c1dabae 100644 --- a/src/test/ui/e0119/conflict-with-std.stderr +++ b/src/test/ui/e0119/conflict-with-std.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `std::convert::AsRef` for type `std::boxed::Box`: - --> $DIR/conflict-with-std.rs:7:1 + --> $DIR/conflict-with-std.rs:6:1 | LL | impl AsRef for Box { //~ ERROR conflicting implementations | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | impl AsRef for Box { //~ ERROR conflicting implementations where T: ?Sized; error[E0119]: conflicting implementations of trait `std::convert::From` for type `S`: - --> $DIR/conflict-with-std.rs:14:1 + --> $DIR/conflict-with-std.rs:13:1 | LL | impl From for S { //~ ERROR conflicting implementations | ^^^^^^^^^^^^^^^^^^ @@ -18,7 +18,7 @@ LL | impl From for S { //~ ERROR conflicting implementations - impl std::convert::From for T; error[E0119]: conflicting implementations of trait `std::convert::TryFrom` for type `X`: - --> $DIR/conflict-with-std.rs:21:1 + --> $DIR/conflict-with-std.rs:20:1 | LL | impl TryFrom for X { //~ ERROR conflicting implementations | ^^^^^^^^^^^^^^^^^^^^^ From b2cf9a02b2bce6ed984b0c967e2daf0af7b13629 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Wed, 13 Feb 2019 18:01:37 +0100 Subject: [PATCH 006/381] Add `impl From for Infallible` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The reverse conversion unfortunately causes unexpected errors like: ``` error[E0277]: the trait bound `!: std::convert::From<()>` is not satisfied --> src/librustc_metadata/encoder.rs:105:9 | 105 | self.emit_usize(seq.len)?; | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<()>` is not implemented for `!` | = help: the following implementations were found: > = note: the trait is implemented for `()`. Possibly this error has been caused by changes to Rust's type-inference algorithm (see: https://github.com/rust-lang/rust/issues/48950 for more info). Consider whether you meant to use the type `()` here instead. = note: required by `std::convert::From::from` ``` I don’t understand why this error happens. If I’m reading the code correctly the return types of `emit_usize` and of the method that contains line 105 are both `Result<(), !>`, so the expansion of the `?` operator should involve `!: From`, not `From<()>`. Is this a type inference bug? --- src/libcore/convert.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 65aa91e2dab0..c6c41fb99a46 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -596,3 +596,10 @@ impl PartialEq for Infallible { #[stable(feature = "convert_infallible", since = "1.34.0")] impl Eq for Infallible {} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl From for Infallible { + fn from(x: !) -> Self { + x + } +} From 31bcec648aa57391115f877a2ca022d7ff6415aa Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Fri, 8 Feb 2019 20:42:34 +0100 Subject: [PATCH 007/381] Add vectored read and write support This functionality has lived for a while in the tokio ecosystem, where it can improve performance by minimizing copies. --- src/libstd/io/buffered.rs | 33 ++++- src/libstd/io/cursor.rs | 217 +++++++++++++++++++++++++++++++- src/libstd/io/impls.rs | 59 ++++++++- src/libstd/io/mod.rs | 124 +++++++++++++++++- src/libstd/io/util.rs | 18 ++- src/libstd/lib.rs | 1 + src/libstd/net/tcp.rs | 69 +++++++++- src/libstd/sys/cloudabi/io.rs | 32 +++++ src/libstd/sys/cloudabi/mod.rs | 36 +++--- src/libstd/sys/redox/io.rs | 32 +++++ src/libstd/sys/redox/mod.rs | 11 +- src/libstd/sys/redox/net/tcp.rs | 16 ++- src/libstd/sys/sgx/io.rs | 32 +++++ src/libstd/sys/sgx/mod.rs | 52 ++++---- src/libstd/sys/sgx/net.rs | 16 +++ src/libstd/sys/unix/ext/net.rs | 37 +++++- src/libstd/sys/unix/fd.rs | 20 ++- src/libstd/sys/unix/io.rs | 61 +++++++++ src/libstd/sys/unix/l4re.rs | 18 ++- src/libstd/sys/unix/mod.rs | 9 +- src/libstd/sys/unix/net.rs | 10 +- src/libstd/sys/wasm/io.rs | 32 +++++ src/libstd/sys/wasm/mod.rs | 12 +- src/libstd/sys/wasm/net.rs | 10 +- src/libstd/sys/windows/c.rs | 25 ++++ src/libstd/sys/windows/io.rs | 63 ++++++++++ src/libstd/sys/windows/mod.rs | 27 ++-- src/libstd/sys/windows/net.rs | 43 ++++++- src/libstd/sys_common/net.rs | 10 +- 29 files changed, 1033 insertions(+), 92 deletions(-) create mode 100644 src/libstd/sys/cloudabi/io.rs create mode 100644 src/libstd/sys/redox/io.rs create mode 100644 src/libstd/sys/sgx/io.rs create mode 100644 src/libstd/sys/unix/io.rs create mode 100644 src/libstd/sys/wasm/io.rs create mode 100644 src/libstd/sys/windows/io.rs diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 0615cd59db4e..a5edc4360ca4 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -5,7 +5,7 @@ use io::prelude::*; use cmp; use error; use fmt; -use io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom}; +use io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut}; use memchr; /// The `BufReader` struct adds buffering to any reader. @@ -235,6 +235,19 @@ impl Read for BufReader { Ok(nread) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + let total_len = bufs.iter().map(|b| b.as_slice().len()).sum::(); + if self.pos == self.cap && total_len >= self.buf.len() { + return self.inner.read_vectored(bufs); + } + let nread = { + let mut rem = self.fill_buf()?; + rem.read_vectored(bufs)? + }; + self.consume(nread); + Ok(nread) + } + // we can't skip unconditionally because of the large buffer case in read. unsafe fn initializer(&self) -> Initializer { self.inner.initializer() @@ -577,9 +590,25 @@ impl Write for BufWriter { self.panicked = false; r } else { - Write::write(&mut self.buf, buf) + self.buf.write(buf) } } + + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + let total_len = bufs.iter().map(|b| b.as_slice().len()).sum::(); + if self.buf.len() + total_len > self.buf.capacity() { + self.flush_buf()?; + } + if total_len >= self.buf.capacity() { + self.panicked = true; + let r = self.inner.as_mut().unwrap().write_vectored(bufs); + self.panicked = false; + r + } else { + self.buf.write_vectored(bufs) + } + } + fn flush(&mut self) -> io::Result<()> { self.flush_buf().and_then(|()| self.get_mut().flush()) } diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs index b205f7888389..ef636cc6f8c6 100644 --- a/src/libstd/io/cursor.rs +++ b/src/libstd/io/cursor.rs @@ -2,7 +2,7 @@ use io::prelude::*; use core::convert::TryInto; use cmp; -use io::{self, Initializer, SeekFrom, Error, ErrorKind}; +use io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut}; /// A `Cursor` wraps an in-memory buffer and provides it with a /// [`Seek`] implementation. @@ -221,6 +221,19 @@ impl Read for Cursor where T: AsRef<[u8]> { Ok(n) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + let mut nread = 0; + for buf in bufs { + let buf = buf.as_mut_slice(); + let n = self.read(buf)?; + nread += n; + if n < buf.len() { + break; + } + } + Ok(nread) + } + fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { let n = buf.len(); Read::read_exact(&mut self.fill_buf()?, buf)?; @@ -251,6 +264,24 @@ fn slice_write(pos_mut: &mut u64, slice: &mut [u8], buf: &[u8]) -> io::Result], +) -> io::Result +{ + let mut nwritten = 0; + for buf in bufs { + let buf = buf.as_slice(); + let n = slice_write(pos_mut, slice, buf)?; + nwritten += n; + if n < buf.len() { + break; + } + } + Ok(nwritten) +} + // Resizing write implementation fn vec_write(pos_mut: &mut u64, vec: &mut Vec, buf: &[u8]) -> io::Result { let pos: usize = (*pos_mut).try_into().map_err(|_| { @@ -278,12 +309,31 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec, buf: &[u8]) -> io::Result, + bufs: &[IoVec<'_>], +) -> io::Result +{ + let mut nwritten = 0; + for buf in bufs { + nwritten += vec_write(pos_mut, vec, buf.as_slice())?; + } + Ok(nwritten) +} + #[stable(feature = "rust1", since = "1.0.0")] impl<'a> Write for Cursor<&'a mut [u8]> { #[inline] fn write(&mut self, buf: &[u8]) -> io::Result { slice_write(&mut self.pos, self.inner, buf) } + + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + slice_write_vectored(&mut self.pos, self.inner, bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } } @@ -292,6 +342,11 @@ impl<'a> Write for Cursor<&'a mut Vec> { fn write(&mut self, buf: &[u8]) -> io::Result { vec_write(&mut self.pos, self.inner, buf) } + + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + vec_write_vectored(&mut self.pos, self.inner, bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } } @@ -300,6 +355,11 @@ impl Write for Cursor> { fn write(&mut self, buf: &[u8]) -> io::Result { vec_write(&mut self.pos, &mut self.inner, buf) } + + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + vec_write_vectored(&mut self.pos, &mut self.inner, bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } } @@ -309,13 +369,19 @@ impl Write for Cursor> { fn write(&mut self, buf: &[u8]) -> io::Result { slice_write(&mut self.pos, &mut self.inner, buf) } + + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + slice_write_vectored(&mut self.pos, &mut self.inner, bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } } #[cfg(test)] mod tests { use io::prelude::*; - use io::{Cursor, SeekFrom}; + use io::{Cursor, SeekFrom, IoVec, IoVecMut}; #[test] fn test_vec_writer() { @@ -323,7 +389,10 @@ mod tests { assert_eq!(writer.write(&[0]).unwrap(), 1); assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3); assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4); - let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; + assert_eq!(writer.write_vectored( + &[IoVec::new(&[]), IoVec::new(&[8, 9]), IoVec::new(&[10])], + ).unwrap(), 3); + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(writer, b); } @@ -333,7 +402,10 @@ mod tests { assert_eq!(writer.write(&[0]).unwrap(), 1); assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3); assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4); - let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; + assert_eq!(writer.write_vectored( + &[IoVec::new(&[]), IoVec::new(&[8, 9]), IoVec::new(&[10])], + ).unwrap(), 3); + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(&writer.get_ref()[..], b); } @@ -344,7 +416,10 @@ mod tests { assert_eq!(writer.write(&[0]).unwrap(), 1); assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3); assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4); - let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; + assert_eq!(writer.write_vectored( + &[IoVec::new(&[]), IoVec::new(&[8, 9]), IoVec::new(&[10])], + ).unwrap(), 3); + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(&writer.get_ref()[..], b); } @@ -366,6 +441,26 @@ mod tests { assert_eq!(&**writer.get_ref(), b); } + #[test] + fn test_box_slice_writer_vectored() { + let mut writer = Cursor::new(vec![0u8; 9].into_boxed_slice()); + assert_eq!(writer.position(), 0); + assert_eq!(writer.write_vectored(&[IoVec::new(&[0])]).unwrap(), 1); + assert_eq!(writer.position(), 1); + assert_eq!( + writer.write_vectored(&[IoVec::new(&[1, 2, 3]), IoVec::new(&[4, 5, 6, 7])]).unwrap(), + 7, + ); + assert_eq!(writer.position(), 8); + assert_eq!(writer.write_vectored(&[]).unwrap(), 0); + assert_eq!(writer.position(), 8); + + assert_eq!(writer.write_vectored(&[IoVec::new(&[8, 9])]).unwrap(), 1); + assert_eq!(writer.write_vectored(&[IoVec::new(&[10])]).unwrap(), 0); + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8]; + assert_eq!(&**writer.get_ref(), b); + } + #[test] fn test_buf_writer() { let mut buf = [0 as u8; 9]; @@ -387,6 +482,31 @@ mod tests { assert_eq!(buf, b); } + #[test] + fn test_buf_writer_vectored() { + let mut buf = [0 as u8; 9]; + { + let mut writer = Cursor::new(&mut buf[..]); + assert_eq!(writer.position(), 0); + assert_eq!(writer.write_vectored(&[IoVec::new(&[0])]).unwrap(), 1); + assert_eq!(writer.position(), 1); + assert_eq!( + writer.write_vectored( + &[IoVec::new(&[1, 2, 3]), IoVec::new(&[4, 5, 6, 7])], + ).unwrap(), + 7, + ); + assert_eq!(writer.position(), 8); + assert_eq!(writer.write_vectored(&[]).unwrap(), 0); + assert_eq!(writer.position(), 8); + + assert_eq!(writer.write_vectored(&[IoVec::new(&[8, 9])]).unwrap(), 1); + assert_eq!(writer.write_vectored(&[IoVec::new(&[10])]).unwrap(), 0); + } + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8]; + assert_eq!(buf, b); + } + #[test] fn test_buf_writer_seek() { let mut buf = [0 as u8; 8]; @@ -447,6 +567,35 @@ mod tests { assert_eq!(reader.read(&mut buf).unwrap(), 0); } + #[test] + fn test_mem_reader_vectored() { + let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7]); + let mut buf = []; + assert_eq!(reader.read_vectored(&mut [IoVecMut::new(&mut buf)]).unwrap(), 0); + assert_eq!(reader.position(), 0); + let mut buf = [0]; + assert_eq!( + reader.read_vectored(&mut [IoVecMut::new(&mut []), IoVecMut::new(&mut buf)]).unwrap(), + 1, + ); + assert_eq!(reader.position(), 1); + let b: &[_] = &[0]; + assert_eq!(buf, b); + let mut buf1 = [0; 4]; + let mut buf2 = [0; 4]; + assert_eq!( + reader.read_vectored( + &mut [IoVecMut::new(&mut buf1), IoVecMut::new(&mut buf2)], + ).unwrap(), + 7, + ); + let b1: &[_] = &[1, 2, 3, 4]; + let b2: &[_] = &[5, 6, 7]; + assert_eq!(buf1, b1); + assert_eq!(&buf2[..3], b2); + assert_eq!(reader.read(&mut buf).unwrap(), 0); + } + #[test] fn test_boxed_slice_reader() { let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7].into_boxed_slice()); @@ -469,6 +618,35 @@ mod tests { assert_eq!(reader.read(&mut buf).unwrap(), 0); } + #[test] + fn test_boxed_slice_reader_vectored() { + let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7].into_boxed_slice()); + let mut buf = []; + assert_eq!(reader.read_vectored(&mut [IoVecMut::new(&mut buf)]).unwrap(), 0); + assert_eq!(reader.position(), 0); + let mut buf = [0]; + assert_eq!( + reader.read_vectored(&mut [IoVecMut::new(&mut []), IoVecMut::new(&mut buf)]).unwrap(), + 1, + ); + assert_eq!(reader.position(), 1); + let b: &[_] = &[0]; + assert_eq!(buf, b); + let mut buf1 = [0; 4]; + let mut buf2 = [0; 4]; + assert_eq!( + reader.read_vectored( + &mut [IoVecMut::new(&mut buf1), IoVecMut::new(&mut buf2)], + ).unwrap(), + 7, + ); + let b1: &[_] = &[1, 2, 3, 4]; + let b2: &[_] = &[5, 6, 7]; + assert_eq!(buf1, b1); + assert_eq!(&buf2[..3], b2); + assert_eq!(reader.read(&mut buf).unwrap(), 0); + } + #[test] fn read_to_end() { let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7]); @@ -499,6 +677,35 @@ mod tests { assert_eq!(reader.read(&mut buf).unwrap(), 0); } + #[test] + fn test_slice_reader_vectored() { + let in_buf = vec![0, 1, 2, 3, 4, 5, 6, 7]; + let reader = &mut &in_buf[..]; + let mut buf = []; + assert_eq!(reader.read_vectored(&mut [IoVecMut::new(&mut buf)]).unwrap(), 0); + let mut buf = [0]; + assert_eq!( + reader.read_vectored(&mut [IoVecMut::new(&mut []), IoVecMut::new(&mut buf)]).unwrap(), + 1, + ); + assert_eq!(reader.len(), 7); + let b: &[_] = &[0]; + assert_eq!(buf, b); + let mut buf1 = [0; 4]; + let mut buf2 = [0; 4]; + assert_eq!( + reader.read_vectored( + &mut [IoVecMut::new(&mut buf1), IoVecMut::new(&mut buf2)], + ).unwrap(), + 7, + ); + let b1: &[_] = &[1, 2, 3, 4]; + let b2: &[_] = &[5, 6, 7]; + assert_eq!(buf1, b1); + assert_eq!(&buf2[..3], b2); + assert_eq!(reader.read(&mut buf).unwrap(), 0); + } + #[test] fn test_read_exact() { let in_buf = vec![0, 1, 2, 3, 4, 5, 6, 7]; diff --git a/src/libstd/io/impls.rs b/src/libstd/io/impls.rs index ec75a87aec34..4bba4af77c48 100644 --- a/src/libstd/io/impls.rs +++ b/src/libstd/io/impls.rs @@ -1,5 +1,6 @@ use cmp; -use io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind}; +use io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut, + IoVec}; use fmt; use mem; @@ -13,6 +14,11 @@ impl<'a, R: Read + ?Sized> Read for &'a mut R { (**self).read(buf) } + #[inline] + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + (**self).read_vectored(bufs) + } + #[inline] unsafe fn initializer(&self) -> Initializer { (**self).initializer() @@ -38,6 +44,11 @@ impl<'a, W: Write + ?Sized> Write for &'a mut W { #[inline] fn write(&mut self, buf: &[u8]) -> io::Result { (**self).write(buf) } + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + (**self).write_vectored(bufs) + } + #[inline] fn flush(&mut self) -> io::Result<()> { (**self).flush() } @@ -82,6 +93,11 @@ impl Read for Box { (**self).read(buf) } + #[inline] + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + (**self).read_vectored(bufs) + } + #[inline] unsafe fn initializer(&self) -> Initializer { (**self).initializer() @@ -107,6 +123,11 @@ impl Write for Box { #[inline] fn write(&mut self, buf: &[u8]) -> io::Result { (**self).write(buf) } + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + (**self).write_vectored(bufs) + } + #[inline] fn flush(&mut self) -> io::Result<()> { (**self).flush() } @@ -171,6 +192,19 @@ impl<'a> Read for &'a [u8] { Ok(amt) } + #[inline] + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + let mut nread = 0; + for buf in bufs { + nread += self.read(buf.as_mut_slice())?; + if self.is_empty() { + break; + } + } + + Ok(nread) + } + #[inline] unsafe fn initializer(&self) -> Initializer { Initializer::nop() @@ -231,6 +265,19 @@ impl<'a> Write for &'a mut [u8] { Ok(amt) } + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + let mut nwritten = 0; + for buf in bufs { + nwritten += self.write(buf.as_slice())?; + if self.is_empty() { + break; + } + } + + Ok(nwritten) + } + #[inline] fn write_all(&mut self, data: &[u8]) -> io::Result<()> { if self.write(data)? == data.len() { @@ -254,6 +301,16 @@ impl Write for Vec { Ok(buf.len()) } + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + let len = bufs.iter().map(|b| b.as_slice().len()).sum(); + self.reserve(len); + for buf in bufs { + self.extend_from_slice(buf.as_slice()); + } + Ok(len) + } + #[inline] fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { self.extend_from_slice(buf); diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index c0570ae60a19..b9765605f8e3 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -265,6 +265,7 @@ use slice; use str; use memchr; use ptr; +use sys; #[stable(feature = "rust1", since = "1.0.0")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; @@ -520,6 +521,22 @@ pub trait Read { #[stable(feature = "rust1", since = "1.0.0")] fn read(&mut self, buf: &mut [u8]) -> Result; + /// Like `read`, except that it reads into a slice of buffers. + /// + /// Data is copied to fill each buffer in order, with the final buffer + /// written to possibly being only partially filled. This method must behave + /// as a single call to `read` with the buffers concatenated would. + /// + /// The default implementation simply passes the first nonempty buffer to + /// `read`. + #[unstable(feature = "iovec", issue = "0")] + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result { + match bufs.iter_mut().map(|b| b.as_mut_slice()).find(|b| !b.is_empty()) { + Some(buf) => self.read(buf), + None => Ok(0), + } + } + /// Determines if this `Read`er can work with buffers of uninitialized /// memory. /// @@ -867,6 +884,85 @@ pub trait Read { } } +/// A buffer type used with `Read::read_vectored`. +/// +/// It is semantically a wrapper around an `&mut [u8]`, but is guaranteed to be +/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on +/// Windows. +#[unstable(feature = "iovec", issue = "0")] +#[repr(transparent)] +pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>); + +#[unstable(feature = "iovec", issue = "0")] +impl<'a> fmt::Debug for IoVecMut<'a> { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(self.as_slice(), fmt) + } +} + +impl<'a> IoVecMut<'a> { + /// Creates a new `IoVecMut` wrapping a byte slice. + /// + /// # Panics + /// + /// Panics on Windows if the slice is larger than 4GB. + #[unstable(feature = "iovec", issue = "0")] + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + IoVecMut(sys::io::IoVecMut::new(buf)) + } + + /// Returns a shared reference to the inner slice. + #[unstable(feature = "iovec", issue = "0")] + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + self.0.as_slice() + } + + /// Returns a mutable reference to the inner slice. + #[unstable(feature = "iovec", issue = "0")] + #[inline] + pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + self.0.as_mut_slice() + } +} + +/// A buffer type used with `Write::write_vectored`. +/// +/// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be +/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on +/// Windows. +#[unstable(feature = "iovec", issue = "0")] +#[repr(transparent)] +pub struct IoVec<'a>(sys::io::IoVec<'a>); + +#[unstable(feature = "iovec", issue = "0")] +impl<'a> fmt::Debug for IoVec<'a> { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(self.as_slice(), fmt) + } +} + +impl<'a> IoVec<'a> { + /// Creates a new `IoVec` wrapping a byte slice. + /// + /// # Panics + /// + /// Panics on Windows if the slice is larger than 4GB. + #[unstable(feature = "iovec", issue = "0")] + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + IoVec(sys::io::IoVec::new(buf)) + } + + /// Returns a shared reference to the inner slice. + #[unstable(feature = "iovec", issue = "0")] + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + self.0.as_slice() + } +} + /// A type used to conditionally initialize buffers passed to `Read` methods. #[unstable(feature = "read_initializer", issue = "42788")] #[derive(Debug)] @@ -997,6 +1093,22 @@ pub trait Write { #[stable(feature = "rust1", since = "1.0.0")] fn write(&mut self, buf: &[u8]) -> Result; + /// Like `write`, except that it writes from a slice of buffers. + /// + /// Data is copied to from each buffer in order, with the final buffer + /// read from possibly being only partially consumed. This method must + /// behave as a call to `write` with the buffers concatenated would. + /// + /// The default implementation simply passes the first nonempty buffer to + /// `write`. + #[unstable(feature = "iovec", issue = "0")] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result { + match bufs.iter().map(|b| b.as_slice()).find(|b| !b.is_empty()) { + Some(buf) => self.write(buf), + None => Ok(0), + } + } + /// Flush this output stream, ensuring that all intermediately buffered /// contents reach their destination. /// @@ -1691,13 +1803,23 @@ impl Read for Chain { fn read(&mut self, buf: &mut [u8]) -> Result { if !self.done_first { match self.first.read(buf)? { - 0 if buf.len() != 0 => { self.done_first = true; } + 0 if buf.len() != 0 => self.done_first = true, n => return Ok(n), } } self.second.read(buf) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result { + if !self.done_first { + match self.first.read_vectored(bufs)? { + 0 if bufs.iter().any(|b| !b.as_slice().is_empty()) => self.done_first = true, + n => return Ok(n), + } + } + self.second.read_vectored(bufs) + } + unsafe fn initializer(&self) -> Initializer { let initializer = self.first.initializer(); if initializer.should_initialize() { diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 8df961a9add6..6743018793fb 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -1,7 +1,7 @@ #![allow(missing_copy_implementations)] use fmt; -use io::{self, Read, Initializer, Write, ErrorKind, BufRead}; +use io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut}; use mem; /// Copies the entire contents of a reader into a writer. @@ -152,6 +152,15 @@ impl Read for Repeat { Ok(buf.len()) } + #[inline] + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + let mut nwritten = 0; + for buf in bufs { + nwritten += self.read(buf.as_mut_slice())?; + } + Ok(nwritten) + } + #[inline] unsafe fn initializer(&self) -> Initializer { Initializer::nop() @@ -195,6 +204,13 @@ pub fn sink() -> Sink { Sink { _priv: () } } impl Write for Sink { #[inline] fn write(&mut self, buf: &[u8]) -> io::Result { Ok(buf.len()) } + + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + let total_len = bufs.iter().map(|b| b.as_slice().len()).sum(); + Ok(total_len) + } + #[inline] fn flush(&mut self) -> io::Result<()> { Ok(()) } } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index e57cb2ce5fd1..ebfe0b0de9ec 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -228,6 +228,7 @@ #![feature(arbitrary_self_types)] #![feature(array_error_internals)] #![feature(asm)] +#![feature(bind_by_move_pattern_guards)] #![feature(box_syntax)] #![feature(c_variadic)] #![feature(cfg_target_has_atomic)] diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index c4b0cd0f17c3..d8a9d80cdbf7 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -1,7 +1,7 @@ use io::prelude::*; use fmt; -use io::{self, Initializer}; +use io::{self, Initializer, IoVec, IoVecMut}; use net::{ToSocketAddrs, SocketAddr, Shutdown}; use sys_common::net as net_imp; use sys_common::{AsInner, FromInner, IntoInner}; @@ -569,6 +569,10 @@ impl TcpStream { impl Read for TcpStream { fn read(&mut self, buf: &mut [u8]) -> io::Result { self.0.read(buf) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + self.0.read_vectored(bufs) + } + #[inline] unsafe fn initializer(&self) -> Initializer { Initializer::nop() @@ -577,12 +581,21 @@ impl Read for TcpStream { #[stable(feature = "rust1", since = "1.0.0")] impl Write for TcpStream { fn write(&mut self, buf: &[u8]) -> io::Result { self.0.write(buf) } + + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + self.0.write_vectored(bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } } #[stable(feature = "rust1", since = "1.0.0")] impl<'a> Read for &'a TcpStream { fn read(&mut self, buf: &mut [u8]) -> io::Result { self.0.read(buf) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + self.0.read_vectored(bufs) + } + #[inline] unsafe fn initializer(&self) -> Initializer { Initializer::nop() @@ -591,6 +604,11 @@ impl<'a> Read for &'a TcpStream { #[stable(feature = "rust1", since = "1.0.0")] impl<'a> Write for &'a TcpStream { fn write(&mut self, buf: &[u8]) -> io::Result { self.0.write(buf) } + + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + self.0.write_vectored(bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } } @@ -911,7 +929,7 @@ impl fmt::Debug for TcpListener { #[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))] mod tests { - use io::ErrorKind; + use io::{ErrorKind, IoVec, IoVecMut}; use io::prelude::*; use net::*; use net::test::{next_test_ip4, next_test_ip6}; @@ -1184,6 +1202,53 @@ mod tests { }) } + #[test] + fn read_vectored() { + each_ip(&mut |addr| { + let srv = t!(TcpListener::bind(&addr)); + let mut s1 = t!(TcpStream::connect(&addr)); + let mut s2 = t!(srv.accept()).0; + + let len = s1.write(&[10, 11, 12]).unwrap(); + assert_eq!(len, 3); + + let mut a = []; + let mut b = [0]; + let mut c = [0; 3]; + let len = t!(s2.read_vectored( + &mut [IoVecMut::new(&mut a), IoVecMut::new(&mut b), IoVecMut::new(&mut c)], + )); + assert!(len > 0); + assert_eq!(b, [10]); + // some implementations don't support readv, so we may only fill the first buffer + assert!(len == 1 || c == [11, 12, 0]); + }) + } + + #[test] + fn write_vectored() { + each_ip(&mut |addr| { + let srv = t!(TcpListener::bind(&addr)); + let mut s1 = t!(TcpStream::connect(&addr)); + let mut s2 = t!(srv.accept()).0; + + let a = []; + let b = [10]; + let c = [11, 12]; + t!(s1.write_vectored(&[IoVec::new(&a), IoVec::new(&b), IoVec::new(&c)])); + + let mut buf = [0; 4]; + let len = t!(s2.read(&mut buf)); + // some implementations don't support writev, so we may only write the first buffer + if len == 1 { + assert_eq!(buf, [10, 0, 0, 0]); + } else { + assert_eq!(len, 3); + assert_eq!(buf, [10, 11, 12, 0]); + } + }) + } + #[test] fn double_bind() { each_ip(&mut |addr| { diff --git a/src/libstd/sys/cloudabi/io.rs b/src/libstd/sys/cloudabi/io.rs new file mode 100644 index 000000000000..9ee5788c5800 --- /dev/null +++ b/src/libstd/sys/cloudabi/io.rs @@ -0,0 +1,32 @@ +pub struct IoVec<'a>(&'a [u8]); + +impl<'a> IoVec<'a> { + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + IoVec(buf) + } + + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + self.0 + } +} + +pub struct IoVecMut<'a>(&'a mut [u8]); + +impl<'a> IoVecMut<'a> { + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + IoVecMut(buf) + } + + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + self.0 + } + + #[inline] + pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + self.0 + } +} diff --git a/src/libstd/sys/cloudabi/mod.rs b/src/libstd/sys/cloudabi/mod.rs index cd621b769456..d9bc21861c90 100644 --- a/src/libstd/sys/cloudabi/mod.rs +++ b/src/libstd/sys/cloudabi/mod.rs @@ -1,4 +1,3 @@ -use io; use libc; use mem; @@ -10,6 +9,7 @@ pub mod backtrace; #[path = "../unix/cmath.rs"] pub mod cmath; pub mod condvar; +pub mod io; #[path = "../unix/memchr.rs"] pub mod memchr; pub mod mutex; @@ -32,24 +32,24 @@ pub use self::shims::*; #[allow(dead_code)] pub fn init() {} -pub fn decode_error_kind(errno: i32) -> io::ErrorKind { +pub fn decode_error_kind(errno: i32) -> ::io::ErrorKind { match errno { - x if x == abi::errno::ACCES as i32 => io::ErrorKind::PermissionDenied, - x if x == abi::errno::ADDRINUSE as i32 => io::ErrorKind::AddrInUse, - x if x == abi::errno::ADDRNOTAVAIL as i32 => io::ErrorKind::AddrNotAvailable, - x if x == abi::errno::AGAIN as i32 => io::ErrorKind::WouldBlock, - x if x == abi::errno::CONNABORTED as i32 => io::ErrorKind::ConnectionAborted, - x if x == abi::errno::CONNREFUSED as i32 => io::ErrorKind::ConnectionRefused, - x if x == abi::errno::CONNRESET as i32 => io::ErrorKind::ConnectionReset, - x if x == abi::errno::EXIST as i32 => io::ErrorKind::AlreadyExists, - x if x == abi::errno::INTR as i32 => io::ErrorKind::Interrupted, - x if x == abi::errno::INVAL as i32 => io::ErrorKind::InvalidInput, - x if x == abi::errno::NOENT as i32 => io::ErrorKind::NotFound, - x if x == abi::errno::NOTCONN as i32 => io::ErrorKind::NotConnected, - x if x == abi::errno::PERM as i32 => io::ErrorKind::PermissionDenied, - x if x == abi::errno::PIPE as i32 => io::ErrorKind::BrokenPipe, - x if x == abi::errno::TIMEDOUT as i32 => io::ErrorKind::TimedOut, - _ => io::ErrorKind::Other, + x if x == abi::errno::ACCES as i32 => ::io::ErrorKind::PermissionDenied, + x if x == abi::errno::ADDRINUSE as i32 => ::io::ErrorKind::AddrInUse, + x if x == abi::errno::ADDRNOTAVAIL as i32 => ::io::ErrorKind::AddrNotAvailable, + x if x == abi::errno::AGAIN as i32 => ::io::ErrorKind::WouldBlock, + x if x == abi::errno::CONNABORTED as i32 => ::io::ErrorKind::ConnectionAborted, + x if x == abi::errno::CONNREFUSED as i32 => ::io::ErrorKind::ConnectionRefused, + x if x == abi::errno::CONNRESET as i32 => ::io::ErrorKind::ConnectionReset, + x if x == abi::errno::EXIST as i32 => ::io::ErrorKind::AlreadyExists, + x if x == abi::errno::INTR as i32 => ::io::ErrorKind::Interrupted, + x if x == abi::errno::INVAL as i32 => ::io::ErrorKind::InvalidInput, + x if x == abi::errno::NOENT as i32 => ::io::ErrorKind::NotFound, + x if x == abi::errno::NOTCONN as i32 => ::io::ErrorKind::NotConnected, + x if x == abi::errno::PERM as i32 => ::io::ErrorKind::PermissionDenied, + x if x == abi::errno::PIPE as i32 => ::io::ErrorKind::BrokenPipe, + x if x == abi::errno::TIMEDOUT as i32 => ::io::ErrorKind::TimedOut, + _ => ::io::ErrorKind::Other, } } diff --git a/src/libstd/sys/redox/io.rs b/src/libstd/sys/redox/io.rs new file mode 100644 index 000000000000..9ee5788c5800 --- /dev/null +++ b/src/libstd/sys/redox/io.rs @@ -0,0 +1,32 @@ +pub struct IoVec<'a>(&'a [u8]); + +impl<'a> IoVec<'a> { + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + IoVec(buf) + } + + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + self.0 + } +} + +pub struct IoVecMut<'a>(&'a mut [u8]); + +impl<'a> IoVecMut<'a> { + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + IoVecMut(buf) + } + + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + self.0 + } + + #[inline] + pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + self.0 + } +} diff --git a/src/libstd/sys/redox/mod.rs b/src/libstd/sys/redox/mod.rs index c106db8ddfaf..c3878349bb32 100644 --- a/src/libstd/sys/redox/mod.rs +++ b/src/libstd/sys/redox/mod.rs @@ -1,6 +1,6 @@ #![allow(dead_code, missing_docs, nonstandard_style)] -use io::{self, ErrorKind}; +use ::io::{ErrorKind}; pub use libc::strlen; pub use self::rand::hashmap_random_keys; @@ -17,6 +17,7 @@ pub mod ext; pub mod fast_thread_local; pub mod fd; pub mod fs; +pub mod io; pub mod memchr; pub mod mutex; pub mod net; @@ -63,8 +64,8 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { } } -pub fn cvt(result: Result) -> io::Result { - result.map_err(|err| io::Error::from_raw_os_error(err.errno)) +pub fn cvt(result: Result) -> ::io::Result { + result.map_err(|err| ::io::Error::from_raw_os_error(err.errno)) } #[doc(hidden)] @@ -82,9 +83,9 @@ macro_rules! impl_is_minus_one { impl_is_minus_one! { i8 i16 i32 i64 isize } -pub fn cvt_libc(t: T) -> io::Result { +pub fn cvt_libc(t: T) -> ::io::Result { if t.is_minus_one() { - Err(io::Error::last_os_error()) + Err(::io::Error::last_os_error()) } else { Ok(t) } diff --git a/src/libstd/sys/redox/net/tcp.rs b/src/libstd/sys/redox/net/tcp.rs index e0353b130bb4..08e12dc1ab10 100644 --- a/src/libstd/sys/redox/net/tcp.rs +++ b/src/libstd/sys/redox/net/tcp.rs @@ -1,5 +1,5 @@ use cmp; -use io::{self, Error, ErrorKind, Result}; +use io::{self, Error, ErrorKind, Result, IoVec, IoVecMut}; use mem; use net::{SocketAddr, Shutdown}; use path::Path; @@ -34,10 +34,24 @@ impl TcpStream { self.0.read(buf) } + pub fn read_vectored(&self, buf: &mut [IoVecMut<'_>]) -> io::Result { + match buf.iter_mut().map(|b| b.as_mut_slice()).find(|b| !b.is_empty()) { + Some(buf) => self.read(buf), + None => Ok(0), + } + } + pub fn write(&self, buf: &[u8]) -> Result { self.0.write(buf) } + pub fn write_vectored(&self, bufs: &[IoVec<'_>]) -> io::Result { + match buf.iter().map(|b| b.as_slice()).find(|b| !b.is_empty()) { + Some(buf) => self.write(buf), + None => Ok(0), + } + } + pub fn take_error(&self) -> Result> { Ok(None) } diff --git a/src/libstd/sys/sgx/io.rs b/src/libstd/sys/sgx/io.rs new file mode 100644 index 000000000000..9ee5788c5800 --- /dev/null +++ b/src/libstd/sys/sgx/io.rs @@ -0,0 +1,32 @@ +pub struct IoVec<'a>(&'a [u8]); + +impl<'a> IoVec<'a> { + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + IoVec(buf) + } + + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + self.0 + } +} + +pub struct IoVecMut<'a>(&'a mut [u8]); + +impl<'a> IoVecMut<'a> { + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + IoVecMut(buf) + } + + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + self.0 + } + + #[inline] + pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + self.0 + } +} diff --git a/src/libstd/sys/sgx/mod.rs b/src/libstd/sys/sgx/mod.rs index 4225ecbb2065..403dd61187fc 100644 --- a/src/libstd/sys/sgx/mod.rs +++ b/src/libstd/sys/sgx/mod.rs @@ -3,7 +3,6 @@ //! This module contains the facade (aka platform-specific) implementations of //! OS level functionality for Fortanix SGX. -use io; use os::raw::c_char; use sync::atomic::{AtomicBool, Ordering}; @@ -20,6 +19,7 @@ pub mod env; pub mod ext; pub mod fd; pub mod fs; +pub mod io; pub mod memchr; pub mod mutex; pub mod net; @@ -41,12 +41,12 @@ pub fn init() { /// This function is used to implement functionality that simply doesn't exist. /// Programs relying on this functionality will need to deal with the error. -pub fn unsupported() -> io::Result { +pub fn unsupported() -> ::io::Result { Err(unsupported_err()) } -pub fn unsupported_err() -> io::Error { - io::Error::new(io::ErrorKind::Other, +pub fn unsupported_err() -> ::io::Error { + ::io::Error::new(::io::ErrorKind::Other, "operation not supported on SGX yet") } @@ -55,58 +55,58 @@ pub fn unsupported_err() -> io::Error { /// returned, the program might very well be able to function normally. This is /// what happens when `SGX_INEFFECTIVE_ERROR` is set to `true`. If it is /// `false`, the behavior is the same as `unsupported`. -pub fn sgx_ineffective(v: T) -> io::Result { +pub fn sgx_ineffective(v: T) -> ::io::Result { static SGX_INEFFECTIVE_ERROR: AtomicBool = AtomicBool::new(false); if SGX_INEFFECTIVE_ERROR.load(Ordering::Relaxed) { - Err(io::Error::new(io::ErrorKind::Other, + Err(::io::Error::new(::io::ErrorKind::Other, "operation can't be trusted to have any effect on SGX")) } else { Ok(v) } } -pub fn decode_error_kind(code: i32) -> io::ErrorKind { +pub fn decode_error_kind(code: i32) -> ::io::ErrorKind { use fortanix_sgx_abi::Error; // FIXME: not sure how to make sure all variants of Error are covered if code == Error::NotFound as _ { - io::ErrorKind::NotFound + ::io::ErrorKind::NotFound } else if code == Error::PermissionDenied as _ { - io::ErrorKind::PermissionDenied + ::io::ErrorKind::PermissionDenied } else if code == Error::ConnectionRefused as _ { - io::ErrorKind::ConnectionRefused + ::io::ErrorKind::ConnectionRefused } else if code == Error::ConnectionReset as _ { - io::ErrorKind::ConnectionReset + ::io::ErrorKind::ConnectionReset } else if code == Error::ConnectionAborted as _ { - io::ErrorKind::ConnectionAborted + ::io::ErrorKind::ConnectionAborted } else if code == Error::NotConnected as _ { - io::ErrorKind::NotConnected + ::io::ErrorKind::NotConnected } else if code == Error::AddrInUse as _ { - io::ErrorKind::AddrInUse + ::io::ErrorKind::AddrInUse } else if code == Error::AddrNotAvailable as _ { - io::ErrorKind::AddrNotAvailable + ::io::ErrorKind::AddrNotAvailable } else if code == Error::BrokenPipe as _ { - io::ErrorKind::BrokenPipe + ::io::ErrorKind::BrokenPipe } else if code == Error::AlreadyExists as _ { - io::ErrorKind::AlreadyExists + ::io::ErrorKind::AlreadyExists } else if code == Error::WouldBlock as _ { - io::ErrorKind::WouldBlock + ::io::ErrorKind::WouldBlock } else if code == Error::InvalidInput as _ { - io::ErrorKind::InvalidInput + ::io::ErrorKind::InvalidInput } else if code == Error::InvalidData as _ { - io::ErrorKind::InvalidData + ::io::ErrorKind::InvalidData } else if code == Error::TimedOut as _ { - io::ErrorKind::TimedOut + ::io::ErrorKind::TimedOut } else if code == Error::WriteZero as _ { - io::ErrorKind::WriteZero + ::io::ErrorKind::WriteZero } else if code == Error::Interrupted as _ { - io::ErrorKind::Interrupted + ::io::ErrorKind::Interrupted } else if code == Error::Other as _ { - io::ErrorKind::Other + ::io::ErrorKind::Other } else if code == Error::UnexpectedEof as _ { - io::ErrorKind::UnexpectedEof + ::io::ErrorKind::UnexpectedEof } else { - io::ErrorKind::Other + ::io::ErrorKind::Other } } diff --git a/src/libstd/sys/sgx/net.rs b/src/libstd/sys/sgx/net.rs index 6e86b06b2862..2ecae1d746f7 100644 --- a/src/libstd/sys/sgx/net.rs +++ b/src/libstd/sys/sgx/net.rs @@ -103,10 +103,26 @@ impl TcpStream { self.inner.inner.read(buf) } + pub fn read_vectored(&self, buf: &mut [IoVecMut<'_>]) -> io::Result { + let buf = match buf.get(0) { + Some(buf) => buf.as_mut_slice(), + None => return Ok(0), + }; + self.read(buf) + } + pub fn write(&self, buf: &[u8]) -> io::Result { self.inner.inner.write(buf) } + pub fn write_vectored(&self, buf: &[IoVec<'_>]) -> io::Result { + let buf = match buf.get(0) { + Some(buf) => buf.as_slice(), + None => return Ok(0), + }; + self.read(buf) + } + pub fn peer_addr(&self) -> io::Result { addr_to_sockaddr(&self.peer_addr) } diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs index acc064acfcd2..4b60ea654c1f 100644 --- a/src/libstd/sys/unix/ext/net.rs +++ b/src/libstd/sys/unix/ext/net.rs @@ -18,7 +18,7 @@ mod libc { use ascii; use ffi::OsStr; use fmt; -use io::{self, Initializer}; +use io::{self, Initializer, IoVec, IoVecMut}; use mem; use net::{self, Shutdown}; use os::unix::ffi::OsStrExt; @@ -551,6 +551,10 @@ impl io::Read for UnixStream { io::Read::read(&mut &*self, buf) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + io::Read::read_vectored(&mut &*self, bufs) + } + #[inline] unsafe fn initializer(&self) -> Initializer { Initializer::nop() @@ -563,6 +567,10 @@ impl<'a> io::Read for &'a UnixStream { self.0.read(buf) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + self.0.read_vectored(bufs) + } + #[inline] unsafe fn initializer(&self) -> Initializer { Initializer::nop() @@ -575,6 +583,10 @@ impl io::Write for UnixStream { io::Write::write(&mut &*self, buf) } + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + io::Write::write_vectored(&mut &*self, bufs) + } + fn flush(&mut self) -> io::Result<()> { io::Write::flush(&mut &*self) } @@ -586,6 +598,10 @@ impl<'a> io::Write for &'a UnixStream { self.0.write(buf) } + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + self.0.write_vectored(bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } @@ -1510,6 +1526,25 @@ mod test { thread.join().unwrap(); } + #[test] + fn vectored() { + let (mut s1, mut s2) = or_panic!(UnixStream::pair()); + + let len = or_panic!(s1.write_vectored( + &[IoVec::new(b"hello"), IoVec::new(b" "), IoVec::new(b"world!")], + )); + assert_eq!(len, 12); + + let mut buf1 = [0; 6]; + let mut buf2 = [0; 7]; + let len = or_panic!(s2.read_vectored( + &mut [IoVecMut::new(&mut buf1), IoVecMut::new(&mut buf2)], + )); + assert_eq!(len, 12); + assert_eq!(&buf1, b"hello "); + assert_eq!(&buf2, b"world!\0"); + } + #[test] fn pair() { let msg1 = b"hello"; diff --git a/src/libstd/sys/unix/fd.rs b/src/libstd/sys/unix/fd.rs index 2cbd9536f4da..6946b7b5dfa4 100644 --- a/src/libstd/sys/unix/fd.rs +++ b/src/libstd/sys/unix/fd.rs @@ -1,7 +1,7 @@ #![unstable(reason = "not public", issue = "0", feature = "fd")] use cmp; -use io::{self, Read, Initializer}; +use io::{self, Read, Initializer, IoVec, IoVecMut}; use libc::{self, c_int, c_void, ssize_t}; use mem; use sync::atomic::{AtomicBool, Ordering}; @@ -52,6 +52,15 @@ impl FileDesc { Ok(ret as usize) } + pub fn read_vectored(&self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + let ret = cvt(unsafe { + libc::readv(self.fd, + bufs.as_ptr() as *const libc::iovec, + cmp::min(bufs.len(), c_int::max_value() as usize) as c_int) + })?; + Ok(ret as usize) + } + pub fn read_to_end(&self, buf: &mut Vec) -> io::Result { let mut me = self; (&mut me).read_to_end(buf) @@ -105,6 +114,15 @@ impl FileDesc { Ok(ret as usize) } + pub fn write_vectored(&self, bufs: &[IoVec<'_>]) -> io::Result { + let ret = cvt(unsafe { + libc::writev(self.fd, + bufs.as_ptr() as *const libc::iovec, + cmp::min(bufs.len(), c_int::max_value() as usize) as c_int) + })?; + Ok(ret as usize) + } + pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result { #[cfg(target_os = "android")] use super::android::cvt_pwrite64; diff --git a/src/libstd/sys/unix/io.rs b/src/libstd/sys/unix/io.rs new file mode 100644 index 000000000000..69b2db82ea3a --- /dev/null +++ b/src/libstd/sys/unix/io.rs @@ -0,0 +1,61 @@ +use marker::PhantomData; +use libc::{iovec, c_void}; +use slice; + +#[repr(transparent)] +pub struct IoVec<'a> { + vec: iovec, + _p: PhantomData<&'a [u8]>, +} + +impl<'a> IoVec<'a> { + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + IoVec { + vec: iovec { + iov_base: buf.as_ptr() as *mut u8 as *mut c_void, + iov_len: buf.len() + }, + _p: PhantomData, + } + } + + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + unsafe { + slice::from_raw_parts(self.vec.iov_base as *mut u8, self.vec.iov_len) + } + } +} + +pub struct IoVecMut<'a> { + vec: iovec, + _p: PhantomData<&'a mut [u8]>, +} + +impl<'a> IoVecMut<'a> { + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + IoVecMut { + vec: iovec { + iov_base: buf.as_mut_ptr() as *mut c_void, + iov_len: buf.len() + }, + _p: PhantomData, + } + } + + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + unsafe { + slice::from_raw_parts(self.vec.iov_base as *mut u8, self.vec.iov_len) + } + } + + #[inline] + pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + unsafe { + slice::from_raw_parts_mut(self.vec.iov_base as *mut u8, self.vec.iov_len) + } + } +} diff --git a/src/libstd/sys/unix/l4re.rs b/src/libstd/sys/unix/l4re.rs index 48037310c8d3..4775e29fb570 100644 --- a/src/libstd/sys/unix/l4re.rs +++ b/src/libstd/sys/unix/l4re.rs @@ -5,7 +5,7 @@ macro_rules! unimpl { pub mod net { #![allow(warnings)] use fmt; - use io; + use io::{self, IoVec, IoVecMut}; use libc; use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; use sys_common::{AsInner, FromInner, IntoInner}; @@ -46,6 +46,10 @@ pub mod net { unimpl!(); } + pub fn read_vectored(&self, _: &mut [IoVecMut<'_>]) -> io::Result { + unimpl!(); + } + pub fn peek(&self, _: &mut [u8]) -> io::Result { unimpl!(); } @@ -62,6 +66,10 @@ pub mod net { unimpl!(); } + pub fn write_vectored(&self, _: &[IoVec<'_>]) -> io::Result { + unimpl!(); + } + pub fn set_timeout(&self, _: Option, _: libc::c_int) -> io::Result<()> { unimpl!(); } @@ -144,10 +152,18 @@ pub mod net { unimpl!(); } + pub fn read_vectored(&self, _: &mut [IoVecMut<'_>]) -> io::Result { + unimpl!(); + } + pub fn write(&self, _: &[u8]) -> io::Result { unimpl!(); } + pub fn write_vectored(&self, _: &[IoVec<'_>]) -> io::Result { + unimpl!(); + } + pub fn peer_addr(&self) -> io::Result { unimpl!(); } diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index b36c117fd09d..0de1a223fbd1 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -1,6 +1,6 @@ #![allow(missing_docs, nonstandard_style)] -use io::{self, ErrorKind}; +use io::ErrorKind; use libc; #[cfg(any(rustdoc, target_os = "linux"))] pub use os::linux as platform; @@ -39,6 +39,7 @@ pub mod fast_thread_local; pub mod fd; pub mod fs; pub mod memchr; +pub mod io; pub mod mutex; #[cfg(not(target_os = "l4re"))] pub mod net; @@ -126,15 +127,15 @@ macro_rules! impl_is_minus_one { impl_is_minus_one! { i8 i16 i32 i64 isize } -pub fn cvt(t: T) -> io::Result { +pub fn cvt(t: T) -> ::io::Result { if t.is_minus_one() { - Err(io::Error::last_os_error()) + Err(::io::Error::last_os_error()) } else { Ok(t) } } -pub fn cvt_r(mut f: F) -> io::Result +pub fn cvt_r(mut f: F) -> ::io::Result where T: IsMinusOne, F: FnMut() -> T { diff --git a/src/libstd/sys/unix/net.rs b/src/libstd/sys/unix/net.rs index d780d71c3769..521d9b425179 100644 --- a/src/libstd/sys/unix/net.rs +++ b/src/libstd/sys/unix/net.rs @@ -1,5 +1,5 @@ use ffi::CStr; -use io; +use io::{self, IoVec, IoVecMut}; use libc::{self, c_int, c_void, size_t, sockaddr, socklen_t, EAI_SYSTEM, MSG_PEEK}; use mem; use net::{SocketAddr, Shutdown}; @@ -241,6 +241,10 @@ impl Socket { self.recv_with_flags(buf, MSG_PEEK) } + pub fn read_vectored(&self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + self.0.read_vectored(bufs) + } + fn recv_from_with_flags(&self, buf: &mut [u8], flags: c_int) -> io::Result<(usize, SocketAddr)> { let mut storage: libc::sockaddr_storage = unsafe { mem::zeroed() }; @@ -269,6 +273,10 @@ impl Socket { self.0.write(buf) } + pub fn write_vectored(&self, bufs: &[IoVec<'_>]) -> io::Result { + self.0.write_vectored(bufs) + } + pub fn set_timeout(&self, dur: Option, kind: libc::c_int) -> io::Result<()> { let timeout = match dur { Some(dur) => { diff --git a/src/libstd/sys/wasm/io.rs b/src/libstd/sys/wasm/io.rs new file mode 100644 index 000000000000..9ee5788c5800 --- /dev/null +++ b/src/libstd/sys/wasm/io.rs @@ -0,0 +1,32 @@ +pub struct IoVec<'a>(&'a [u8]); + +impl<'a> IoVec<'a> { + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + IoVec(buf) + } + + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + self.0 + } +} + +pub struct IoVecMut<'a>(&'a mut [u8]); + +impl<'a> IoVecMut<'a> { + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + IoVecMut(buf) + } + + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + self.0 + } + + #[inline] + pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + self.0 + } +} diff --git a/src/libstd/sys/wasm/mod.rs b/src/libstd/sys/wasm/mod.rs index e21455ec6da7..e71c6bcd7fe7 100644 --- a/src/libstd/sys/wasm/mod.rs +++ b/src/libstd/sys/wasm/mod.rs @@ -14,7 +14,6 @@ //! compiling for wasm. That way it's a compile time error for something that's //! guaranteed to be a runtime error! -use io; use os::raw::c_char; use ptr; use sys::os_str::Buf; @@ -29,6 +28,7 @@ pub mod backtrace; pub mod cmath; pub mod env; pub mod fs; +pub mod io; pub mod memchr; pub mod net; pub mod os; @@ -63,17 +63,17 @@ cfg_if! { pub fn init() { } -pub fn unsupported() -> io::Result { +pub fn unsupported() -> ::io::Result { Err(unsupported_err()) } -pub fn unsupported_err() -> io::Error { - io::Error::new(io::ErrorKind::Other, +pub fn unsupported_err() -> ::io::Error { + ::io::Error::new(::io::ErrorKind::Other, "operation not supported on wasm yet") } -pub fn decode_error_kind(_code: i32) -> io::ErrorKind { - io::ErrorKind::Other +pub fn decode_error_kind(_code: i32) -> ::io::ErrorKind { + ::io::ErrorKind::Other } // This enum is used as the storage for a bunch of types which can't actually diff --git a/src/libstd/sys/wasm/net.rs b/src/libstd/sys/wasm/net.rs index 81e4e8255bf5..d9f5d5384320 100644 --- a/src/libstd/sys/wasm/net.rs +++ b/src/libstd/sys/wasm/net.rs @@ -1,5 +1,5 @@ use fmt; -use io; +use io::{self, IoVec, IoVecMut}; use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; use time::Duration; use sys::{unsupported, Void}; @@ -40,10 +40,18 @@ impl TcpStream { match self.0 {} } + pub fn read_vectored(&self, _: &mut [IoVecMut<'_>]) -> io::Result { + match self.0 {} + } + pub fn write(&self, _: &[u8]) -> io::Result { match self.0 {} } + pub fn write_vectored(&self, _: &[IoVec<'_>]) -> io::Result { + match self.0 {} + } + pub fn peer_addr(&self) -> io::Result { match self.0 {} } diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 28fd4df386e9..a78b599204b2 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -57,6 +57,9 @@ pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO; pub type LPSTR = *mut CHAR; pub type LPWSTR = *mut WCHAR; pub type LPFILETIME = *mut FILETIME; +pub type LPWSABUF = *mut WSABUF; +pub type LPWSAOVERLAPPED = *mut c_void; +pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = *mut c_void; pub type PCONDITION_VARIABLE = *mut CONDITION_VARIABLE; pub type PLARGE_INTEGER = *mut c_longlong; @@ -324,6 +327,12 @@ pub struct WSADATA { pub szSystemStatus: [u8; WSASYS_STATUS_LEN + 1], } +#[repr(C)] +pub struct WSABUF { + pub len: ULONG, + pub buf: *mut CHAR, +} + #[repr(C)] pub struct WSAPROTOCOL_INFO { pub dwServiceFlags1: DWORD, @@ -988,6 +997,22 @@ extern "system" { dwProcessId: DWORD, lpProtocolInfo: LPWSAPROTOCOL_INFO) -> c_int; + pub fn WSASend(s: SOCKET, + lpBuffers: LPWSABUF, + dwBufferCount: DWORD, + lpNumberOfBytesSent: LPDWORD, + dwFlags: DWORD, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE) + -> c_int; + pub fn WSARecv(s: SOCKET, + lpBuffers: LPWSABUF, + dwBufferCount: DWORD, + lpNumberOfBytesRecvd: LPDWORD, + lpFlags: LPDWORD, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE) + -> c_int; pub fn GetCurrentProcessId() -> DWORD; pub fn WSASocketW(af: c_int, kind: c_int, diff --git a/src/libstd/sys/windows/io.rs b/src/libstd/sys/windows/io.rs new file mode 100644 index 000000000000..a14bfea9a217 --- /dev/null +++ b/src/libstd/sys/windows/io.rs @@ -0,0 +1,63 @@ +use marker::PhantomData; +use slice; +use sys::c; + +#[repr(transparent)] +pub struct IoVec<'a> { + vec: c::WSABUF, + _p: PhantomData<&'a [u8]>, +} + +impl<'a> IoVec<'a> { + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + assert!(buf.len() <= c::ULONG::max_value() as usize); + IoVec { + vec: c::WSABUF { + len: buf.len() as c::ULONG, + buf: buf.as_ptr() as *mut u8 as *mut c::CHAR, + }, + _p: PhantomData, + } + } + + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + unsafe { + slice::from_raw_parts(self.vec.buf as *mut u8, self.vec.len as usize) + } + } +} + +pub struct IoVecMut<'a> { + vec: c::WSABUF, + _p: PhantomData<&'a mut [u8]>, +} + +impl<'a> IoVecMut<'a> { + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + assert!(buf.len() <= c::ULONG::max_value() as usize); + IoVecMut { + vec: c::WSABUF { + len: buf.len() as c::ULONG, + buf: buf.as_mut_ptr() as *mut c::CHAR, + }, + _p: PhantomData, + } + } + + #[inline] + pub fn as_slice(&self) -> &'a [u8] { + unsafe { + slice::from_raw_parts(self.vec.buf as *mut u8, self.vec.len as usize) + } + } + + #[inline] + pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + unsafe { + slice::from_raw_parts_mut(self.vec.buf as *mut u8, self.vec.len as usize) + } + } +} diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index e97e436efbf7..56c76a169feb 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -2,7 +2,7 @@ use ptr; use ffi::{OsStr, OsString}; -use io::{self, ErrorKind}; +use io::ErrorKind; use os::windows::ffi::{OsStrExt, OsStringExt}; use path::PathBuf; use time::Duration; @@ -26,6 +26,7 @@ pub mod ext; pub mod fast_thread_local; pub mod fs; pub mod handle; +pub mod io; pub mod memchr; pub mod mutex; pub mod net; @@ -75,12 +76,12 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { } } -pub fn to_u16s>(s: S) -> io::Result> { - fn inner(s: &OsStr) -> io::Result> { +pub fn to_u16s>(s: S) -> ::io::Result> { + fn inner(s: &OsStr) -> ::io::Result> { let mut maybe_result: Vec = s.encode_wide().collect(); if maybe_result.iter().any(|&u| u == 0) { - return Err(io::Error::new(io::ErrorKind::InvalidInput, - "strings passed to WinAPI cannot contain NULs")); + return Err(::io::Error::new(::io::ErrorKind::InvalidInput, + "strings passed to WinAPI cannot contain NULs")); } maybe_result.push(0); Ok(maybe_result) @@ -102,7 +103,7 @@ pub fn to_u16s>(s: S) -> io::Result> { // Once the syscall has completed (errors bail out early) the second closure is // yielded the data which has been read from the syscall. The return value // from this closure is then the return value of the function. -fn fill_utf16_buf(mut f1: F1, f2: F2) -> io::Result +fn fill_utf16_buf(mut f1: F1, f2: F2) -> ::io::Result where F1: FnMut(*mut u16, c::DWORD) -> c::DWORD, F2: FnOnce(&[u16]) -> T { @@ -134,7 +135,7 @@ fn fill_utf16_buf(mut f1: F1, f2: F2) -> io::Result c::SetLastError(0); let k = match f1(buf.as_mut_ptr(), n as c::DWORD) { 0 if c::GetLastError() == 0 => 0, - 0 => return Err(io::Error::last_os_error()), + 0 => return Err(::io::Error::last_os_error()), n => n, } as usize; if k == n && c::GetLastError() == c::ERROR_INSUFFICIENT_BUFFER { @@ -157,7 +158,7 @@ fn wide_char_to_multi_byte(code_page: u32, flags: u32, s: &[u16], no_default_char: bool) - -> io::Result> { + -> ::io::Result> { unsafe { let mut size = c::WideCharToMultiByte(code_page, flags, @@ -168,7 +169,7 @@ fn wide_char_to_multi_byte(code_page: u32, ptr::null(), ptr::null_mut()); if size == 0 { - return Err(io::Error::last_os_error()); + return Err(::io::Error::last_os_error()); } let mut buf = Vec::with_capacity(size as usize); @@ -185,10 +186,10 @@ fn wide_char_to_multi_byte(code_page: u32, if no_default_char { &mut used_default_char } else { ptr::null_mut() }); if size == 0 { - return Err(io::Error::last_os_error()); + return Err(::io::Error::last_os_error()); } if no_default_char && used_default_char == c::TRUE { - return Err(io::Error::new(io::ErrorKind::InvalidData, + return Err(::io::Error::new(::io::ErrorKind::InvalidData, "string cannot be converted to requested code page")); } @@ -220,9 +221,9 @@ macro_rules! impl_is_zero { impl_is_zero! { i8 i16 i32 i64 isize u8 u16 u32 u64 usize } -pub fn cvt(i: I) -> io::Result { +pub fn cvt(i: I) -> ::io::Result { if i.is_zero() { - Err(io::Error::last_os_error()) + Err(::io::Error::last_os_error()) } else { Ok(i) } diff --git a/src/libstd/sys/windows/net.rs b/src/libstd/sys/windows/net.rs index acda81dcde57..76be26a9d1a5 100644 --- a/src/libstd/sys/windows/net.rs +++ b/src/libstd/sys/windows/net.rs @@ -1,7 +1,7 @@ #![unstable(issue = "0", feature = "windows_net")] use cmp; -use io::{self, Read}; +use io::{self, Read, IoVec, IoVecMut}; use libc::{c_int, c_void, c_ulong, c_long}; use mem; use net::{SocketAddr, Shutdown}; @@ -207,6 +207,30 @@ impl Socket { self.recv_with_flags(buf, 0) } + pub fn read_vectored(&self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + // On unix when a socket is shut down all further reads return 0, so we + // do the same on windows to map a shut down socket to returning EOF. + let len = cmp::min(bufs.len(), c::DWORD::max_value() as usize) as c::DWORD; + let mut nread = 0; + let mut flags = 0; + unsafe { + let ret = c::WSARecv( + self.0, + bufs.as_mut_ptr() as *mut c::WSABUF, + len, + &mut nread, + &mut flags, + ptr::null_mut(), + ptr::null_mut(), + ); + match ret { + 0 => Ok(nread as usize), + _ if c::WSAGetLastError() == c::WSAESHUTDOWN => Ok(0), + _ => Err(last_error()), + } + } + } + pub fn peek(&self, buf: &mut [u8]) -> io::Result { self.recv_with_flags(buf, c::MSG_PEEK) } @@ -243,6 +267,23 @@ impl Socket { self.recv_from_with_flags(buf, c::MSG_PEEK) } + pub fn write_vectored(&self, bufs: &[IoVec<'_>]) -> io::Result { + let len = cmp::min(bufs.len(), c::DWORD::max_value() as usize) as c::DWORD; + let mut nwritten = 0; + unsafe { + cvt(c::WSASend( + self.0, + bufs.as_ptr() as *const c::WSABUF as *mut c::WSABUF, + len, + &mut nwritten, + 0, + ptr::null_mut(), + ptr::null_mut(), + ))?; + } + Ok(nwritten as usize) + } + pub fn set_timeout(&self, dur: Option, kind: c_int) -> io::Result<()> { let timeout = match dur { diff --git a/src/libstd/sys_common/net.rs b/src/libstd/sys_common/net.rs index f75df3ea695c..0d60593ce1f2 100644 --- a/src/libstd/sys_common/net.rs +++ b/src/libstd/sys_common/net.rs @@ -1,7 +1,7 @@ use cmp; use ffi::CString; use fmt; -use io::{self, Error, ErrorKind}; +use io::{self, Error, ErrorKind, IoVec, IoVecMut}; use libc::{c_int, c_void}; use mem; use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; @@ -255,6 +255,10 @@ impl TcpStream { self.inner.read(buf) } + pub fn read_vectored(&self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + self.inner.read_vectored(bufs) + } + pub fn write(&self, buf: &[u8]) -> io::Result { let len = cmp::min(buf.len(), ::max_value() as usize) as wrlen_t; let ret = cvt(unsafe { @@ -266,6 +270,10 @@ impl TcpStream { Ok(ret as usize) } + pub fn write_vectored(&self, bufs: &[IoVec<'_>]) -> io::Result { + self.inner.write_vectored(bufs) + } + pub fn peer_addr(&self) -> io::Result { sockname(|buf, len| unsafe { c::getpeername(*self.inner.as_inner(), buf, len) From 596f18201c7863d8b02fe6fa1872cf3ba2b6b381 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 11 Feb 2019 19:31:37 -0800 Subject: [PATCH 008/381] impl Deref/DerefMut for IoVec types Returning &'a mut [u8] was unsound, and we may as well just have them directly deref to their slices to make it easier to work with them. --- src/libstd/io/buffered.rs | 4 ++-- src/libstd/io/cursor.rs | 4 +--- src/libstd/io/impls.rs | 8 ++++---- src/libstd/io/mod.rs | 36 ++++++++++++++++++++------------- src/libstd/io/util.rs | 4 ++-- src/libstd/sys/cloudabi/io.rs | 6 +++--- src/libstd/sys/redox/io.rs | 6 +++--- src/libstd/sys/redox/net/tcp.rs | 4 ++-- src/libstd/sys/sgx/io.rs | 6 +++--- src/libstd/sys/sgx/net.rs | 4 ++-- src/libstd/sys/unix/io.rs | 6 +++--- src/libstd/sys/wasm/io.rs | 6 +++--- src/libstd/sys/windows/io.rs | 6 +++--- 13 files changed, 53 insertions(+), 47 deletions(-) diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index a5edc4360ca4..d8a5f5a4d8cb 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -236,7 +236,7 @@ impl Read for BufReader { } fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { - let total_len = bufs.iter().map(|b| b.as_slice().len()).sum::(); + let total_len = bufs.iter().map(|b| b.len()).sum::(); if self.pos == self.cap && total_len >= self.buf.len() { return self.inner.read_vectored(bufs); } @@ -595,7 +595,7 @@ impl Write for BufWriter { } fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { - let total_len = bufs.iter().map(|b| b.as_slice().len()).sum::(); + let total_len = bufs.iter().map(|b| b.len()).sum::(); if self.buf.len() + total_len > self.buf.capacity() { self.flush_buf()?; } diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs index ef636cc6f8c6..d1739894a277 100644 --- a/src/libstd/io/cursor.rs +++ b/src/libstd/io/cursor.rs @@ -224,7 +224,6 @@ impl Read for Cursor where T: AsRef<[u8]> { fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { let mut nread = 0; for buf in bufs { - let buf = buf.as_mut_slice(); let n = self.read(buf)?; nread += n; if n < buf.len() { @@ -272,7 +271,6 @@ fn slice_write_vectored( { let mut nwritten = 0; for buf in bufs { - let buf = buf.as_slice(); let n = slice_write(pos_mut, slice, buf)?; nwritten += n; if n < buf.len() { @@ -317,7 +315,7 @@ fn vec_write_vectored( { let mut nwritten = 0; for buf in bufs { - nwritten += vec_write(pos_mut, vec, buf.as_slice())?; + nwritten += vec_write(pos_mut, vec, buf)?; } Ok(nwritten) } diff --git a/src/libstd/io/impls.rs b/src/libstd/io/impls.rs index 4bba4af77c48..57d8cf40a798 100644 --- a/src/libstd/io/impls.rs +++ b/src/libstd/io/impls.rs @@ -196,7 +196,7 @@ impl<'a> Read for &'a [u8] { fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { let mut nread = 0; for buf in bufs { - nread += self.read(buf.as_mut_slice())?; + nread += self.read(buf)?; if self.is_empty() { break; } @@ -269,7 +269,7 @@ impl<'a> Write for &'a mut [u8] { fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { let mut nwritten = 0; for buf in bufs { - nwritten += self.write(buf.as_slice())?; + nwritten += self.write(buf)?; if self.is_empty() { break; } @@ -303,10 +303,10 @@ impl Write for Vec { #[inline] fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { - let len = bufs.iter().map(|b| b.as_slice().len()).sum(); + let len = bufs.iter().map(|b| b.len()).sum(); self.reserve(len); for buf in bufs { - self.extend_from_slice(buf.as_slice()); + self.extend_from_slice(buf); } Ok(len) } diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index b9765605f8e3..7f9c5a0316c8 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -264,6 +264,7 @@ use fmt; use slice; use str; use memchr; +use ops::{Deref, DerefMut}; use ptr; use sys; @@ -531,7 +532,7 @@ pub trait Read { /// `read`. #[unstable(feature = "iovec", issue = "0")] fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result { - match bufs.iter_mut().map(|b| b.as_mut_slice()).find(|b| !b.is_empty()) { + match bufs.iter_mut().find(|b| !b.is_empty()) { Some(buf) => self.read(buf), None => Ok(0), } @@ -896,7 +897,7 @@ pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>); #[unstable(feature = "iovec", issue = "0")] impl<'a> fmt::Debug for IoVecMut<'a> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - fmt::Debug::fmt(self.as_slice(), fmt) + fmt::Debug::fmt(self.0.as_slice(), fmt) } } @@ -911,18 +912,22 @@ impl<'a> IoVecMut<'a> { pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { IoVecMut(sys::io::IoVecMut::new(buf)) } +} + +#[unstable(feature = "iovec", issue = "0")] +impl<'a> Deref for IoVecMut<'a> { + type Target = [u8]; - /// Returns a shared reference to the inner slice. - #[unstable(feature = "iovec", issue = "0")] #[inline] - pub fn as_slice(&self) -> &'a [u8] { + fn deref(&self) -> &[u8] { self.0.as_slice() } +} - /// Returns a mutable reference to the inner slice. - #[unstable(feature = "iovec", issue = "0")] +#[unstable(feature = "iovec", issue = "0")] +impl<'a> DerefMut for IoVecMut<'a> { #[inline] - pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + fn deref_mut(&mut self) -> &mut [u8] { self.0.as_mut_slice() } } @@ -939,7 +944,7 @@ pub struct IoVec<'a>(sys::io::IoVec<'a>); #[unstable(feature = "iovec", issue = "0")] impl<'a> fmt::Debug for IoVec<'a> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - fmt::Debug::fmt(self.as_slice(), fmt) + fmt::Debug::fmt(self.0.as_slice(), fmt) } } @@ -954,11 +959,14 @@ impl<'a> IoVec<'a> { pub fn new(buf: &'a [u8]) -> IoVec<'a> { IoVec(sys::io::IoVec::new(buf)) } +} + +#[unstable(feature = "iovec", issue = "0")] +impl<'a> Deref for IoVec<'a> { + type Target = [u8]; - /// Returns a shared reference to the inner slice. - #[unstable(feature = "iovec", issue = "0")] #[inline] - pub fn as_slice(&self) -> &'a [u8] { + fn deref(&self) -> &[u8] { self.0.as_slice() } } @@ -1103,7 +1111,7 @@ pub trait Write { /// `write`. #[unstable(feature = "iovec", issue = "0")] fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result { - match bufs.iter().map(|b| b.as_slice()).find(|b| !b.is_empty()) { + match bufs.iter().find(|b| !b.is_empty()) { Some(buf) => self.write(buf), None => Ok(0), } @@ -1813,7 +1821,7 @@ impl Read for Chain { fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result { if !self.done_first { match self.first.read_vectored(bufs)? { - 0 if bufs.iter().any(|b| !b.as_slice().is_empty()) => self.done_first = true, + 0 if bufs.iter().any(|b| !b.is_empty()) => self.done_first = true, n => return Ok(n), } } diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 6743018793fb..5ce955eb1e4a 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -156,7 +156,7 @@ impl Read for Repeat { fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { let mut nwritten = 0; for buf in bufs { - nwritten += self.read(buf.as_mut_slice())?; + nwritten += self.read(buf)?; } Ok(nwritten) } @@ -207,7 +207,7 @@ impl Write for Sink { #[inline] fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { - let total_len = bufs.iter().map(|b| b.as_slice().len()).sum(); + let total_len = bufs.iter().map(|b| b.len()).sum(); Ok(total_len) } diff --git a/src/libstd/sys/cloudabi/io.rs b/src/libstd/sys/cloudabi/io.rs index 9ee5788c5800..8b02d3fd19d3 100644 --- a/src/libstd/sys/cloudabi/io.rs +++ b/src/libstd/sys/cloudabi/io.rs @@ -7,7 +7,7 @@ impl<'a> IoVec<'a> { } #[inline] - pub fn as_slice(&self) -> &'a [u8] { + pub fn as_slice(&self) -> &[u8] { self.0 } } @@ -21,12 +21,12 @@ impl<'a> IoVecMut<'a> { } #[inline] - pub fn as_slice(&self) -> &'a [u8] { + pub fn as_slice(&self) -> &[u8] { self.0 } #[inline] - pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + pub fn as_mut_slice(&mut self) -> &mut [u8] { self.0 } } diff --git a/src/libstd/sys/redox/io.rs b/src/libstd/sys/redox/io.rs index 9ee5788c5800..8b02d3fd19d3 100644 --- a/src/libstd/sys/redox/io.rs +++ b/src/libstd/sys/redox/io.rs @@ -7,7 +7,7 @@ impl<'a> IoVec<'a> { } #[inline] - pub fn as_slice(&self) -> &'a [u8] { + pub fn as_slice(&self) -> &[u8] { self.0 } } @@ -21,12 +21,12 @@ impl<'a> IoVecMut<'a> { } #[inline] - pub fn as_slice(&self) -> &'a [u8] { + pub fn as_slice(&self) -> &[u8] { self.0 } #[inline] - pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + pub fn as_mut_slice(&mut self) -> &mut [u8] { self.0 } } diff --git a/src/libstd/sys/redox/net/tcp.rs b/src/libstd/sys/redox/net/tcp.rs index 08e12dc1ab10..4396a6f963c7 100644 --- a/src/libstd/sys/redox/net/tcp.rs +++ b/src/libstd/sys/redox/net/tcp.rs @@ -35,7 +35,7 @@ impl TcpStream { } pub fn read_vectored(&self, buf: &mut [IoVecMut<'_>]) -> io::Result { - match buf.iter_mut().map(|b| b.as_mut_slice()).find(|b| !b.is_empty()) { + match buf.iter_mut().find(|b| !b.is_empty()) { Some(buf) => self.read(buf), None => Ok(0), } @@ -46,7 +46,7 @@ impl TcpStream { } pub fn write_vectored(&self, bufs: &[IoVec<'_>]) -> io::Result { - match buf.iter().map(|b| b.as_slice()).find(|b| !b.is_empty()) { + match buf.iter().find(|b| !b.is_empty()) { Some(buf) => self.write(buf), None => Ok(0), } diff --git a/src/libstd/sys/sgx/io.rs b/src/libstd/sys/sgx/io.rs index 9ee5788c5800..8b02d3fd19d3 100644 --- a/src/libstd/sys/sgx/io.rs +++ b/src/libstd/sys/sgx/io.rs @@ -7,7 +7,7 @@ impl<'a> IoVec<'a> { } #[inline] - pub fn as_slice(&self) -> &'a [u8] { + pub fn as_slice(&self) -> &[u8] { self.0 } } @@ -21,12 +21,12 @@ impl<'a> IoVecMut<'a> { } #[inline] - pub fn as_slice(&self) -> &'a [u8] { + pub fn as_slice(&self) -> &[u8] { self.0 } #[inline] - pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + pub fn as_mut_slice(&mut self) -> &mut [u8] { self.0 } } diff --git a/src/libstd/sys/sgx/net.rs b/src/libstd/sys/sgx/net.rs index 2ecae1d746f7..f46ed022b214 100644 --- a/src/libstd/sys/sgx/net.rs +++ b/src/libstd/sys/sgx/net.rs @@ -105,7 +105,7 @@ impl TcpStream { pub fn read_vectored(&self, buf: &mut [IoVecMut<'_>]) -> io::Result { let buf = match buf.get(0) { - Some(buf) => buf.as_mut_slice(), + Some(buf) => buf, None => return Ok(0), }; self.read(buf) @@ -117,7 +117,7 @@ impl TcpStream { pub fn write_vectored(&self, buf: &[IoVec<'_>]) -> io::Result { let buf = match buf.get(0) { - Some(buf) => buf.as_slice(), + Some(buf) => buf, None => return Ok(0), }; self.read(buf) diff --git a/src/libstd/sys/unix/io.rs b/src/libstd/sys/unix/io.rs index 69b2db82ea3a..65e4c6e05775 100644 --- a/src/libstd/sys/unix/io.rs +++ b/src/libstd/sys/unix/io.rs @@ -21,7 +21,7 @@ impl<'a> IoVec<'a> { } #[inline] - pub fn as_slice(&self) -> &'a [u8] { + pub fn as_slice(&self) -> &[u8] { unsafe { slice::from_raw_parts(self.vec.iov_base as *mut u8, self.vec.iov_len) } @@ -46,14 +46,14 @@ impl<'a> IoVecMut<'a> { } #[inline] - pub fn as_slice(&self) -> &'a [u8] { + pub fn as_slice(&self) -> &[u8] { unsafe { slice::from_raw_parts(self.vec.iov_base as *mut u8, self.vec.iov_len) } } #[inline] - pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + pub fn as_mut_slice(&mut self) -> &mut [u8] { unsafe { slice::from_raw_parts_mut(self.vec.iov_base as *mut u8, self.vec.iov_len) } diff --git a/src/libstd/sys/wasm/io.rs b/src/libstd/sys/wasm/io.rs index 9ee5788c5800..8b02d3fd19d3 100644 --- a/src/libstd/sys/wasm/io.rs +++ b/src/libstd/sys/wasm/io.rs @@ -7,7 +7,7 @@ impl<'a> IoVec<'a> { } #[inline] - pub fn as_slice(&self) -> &'a [u8] { + pub fn as_slice(&self) -> &[u8] { self.0 } } @@ -21,12 +21,12 @@ impl<'a> IoVecMut<'a> { } #[inline] - pub fn as_slice(&self) -> &'a [u8] { + pub fn as_slice(&self) -> &[u8] { self.0 } #[inline] - pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + pub fn as_mut_slice(&mut self) -> &mut [u8] { self.0 } } diff --git a/src/libstd/sys/windows/io.rs b/src/libstd/sys/windows/io.rs index a14bfea9a217..662e30479238 100644 --- a/src/libstd/sys/windows/io.rs +++ b/src/libstd/sys/windows/io.rs @@ -22,7 +22,7 @@ impl<'a> IoVec<'a> { } #[inline] - pub fn as_slice(&self) -> &'a [u8] { + pub fn as_slice(&self) -> &[u8] { unsafe { slice::from_raw_parts(self.vec.buf as *mut u8, self.vec.len as usize) } @@ -48,14 +48,14 @@ impl<'a> IoVecMut<'a> { } #[inline] - pub fn as_slice(&self) -> &'a [u8] { + pub fn as_slice(&self) -> &[u8] { unsafe { slice::from_raw_parts(self.vec.buf as *mut u8, self.vec.len as usize) } } #[inline] - pub fn as_mut_slice(&mut self) -> &'a mut [u8] { + pub fn as_mut_slice(&mut self) -> &mut [u8] { unsafe { slice::from_raw_parts_mut(self.vec.buf as *mut u8, self.vec.len as usize) } From 034de8da7d1c290ac1f4485373f3ee91f624566d Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Wed, 13 Feb 2019 20:07:22 -0800 Subject: [PATCH 009/381] Whitelist iovec types in linkchecker --- src/tools/linkchecker/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index af704ce260dc..9a6c97dbca01 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -134,7 +134,9 @@ fn check(cache: &mut Cache, file.ends_with("log/index.html") || file.ends_with("ty/struct.Slice.html") || file.ends_with("ty/enum.Attributes.html") || - file.ends_with("ty/struct.SymbolName.html") { + file.ends_with("ty/struct.SymbolName.html") || + file.ends_with("io/struct.IoVec.html") || + file.ends_with("io/struct.IoVecMut.html") { return None; } // FIXME(#32553) From 5ca3b00ce05057c753f41f5b691df13efef95233 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Wed, 13 Feb 2019 20:10:44 -0800 Subject: [PATCH 010/381] Add a tracking issue --- src/libstd/io/mod.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 7f9c5a0316c8..3d3759c2d6ff 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -530,7 +530,7 @@ pub trait Read { /// /// The default implementation simply passes the first nonempty buffer to /// `read`. - #[unstable(feature = "iovec", issue = "0")] + #[unstable(feature = "iovec", issue = "58452")] fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result { match bufs.iter_mut().find(|b| !b.is_empty()) { Some(buf) => self.read(buf), @@ -890,11 +890,11 @@ pub trait Read { /// It is semantically a wrapper around an `&mut [u8]`, but is guaranteed to be /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// Windows. -#[unstable(feature = "iovec", issue = "0")] +#[unstable(feature = "iovec", issue = "58452")] #[repr(transparent)] pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>); -#[unstable(feature = "iovec", issue = "0")] +#[unstable(feature = "iovec", issue = "58452")] impl<'a> fmt::Debug for IoVecMut<'a> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(self.0.as_slice(), fmt) @@ -907,14 +907,14 @@ impl<'a> IoVecMut<'a> { /// # Panics /// /// Panics on Windows if the slice is larger than 4GB. - #[unstable(feature = "iovec", issue = "0")] + #[unstable(feature = "iovec", issue = "58452")] #[inline] pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { IoVecMut(sys::io::IoVecMut::new(buf)) } } -#[unstable(feature = "iovec", issue = "0")] +#[unstable(feature = "iovec", issue = "58452")] impl<'a> Deref for IoVecMut<'a> { type Target = [u8]; @@ -924,7 +924,7 @@ impl<'a> Deref for IoVecMut<'a> { } } -#[unstable(feature = "iovec", issue = "0")] +#[unstable(feature = "iovec", issue = "58452")] impl<'a> DerefMut for IoVecMut<'a> { #[inline] fn deref_mut(&mut self) -> &mut [u8] { @@ -937,11 +937,11 @@ impl<'a> DerefMut for IoVecMut<'a> { /// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be /// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on /// Windows. -#[unstable(feature = "iovec", issue = "0")] +#[unstable(feature = "iovec", issue = "58452")] #[repr(transparent)] pub struct IoVec<'a>(sys::io::IoVec<'a>); -#[unstable(feature = "iovec", issue = "0")] +#[unstable(feature = "iovec", issue = "58452")] impl<'a> fmt::Debug for IoVec<'a> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(self.0.as_slice(), fmt) @@ -954,14 +954,14 @@ impl<'a> IoVec<'a> { /// # Panics /// /// Panics on Windows if the slice is larger than 4GB. - #[unstable(feature = "iovec", issue = "0")] + #[unstable(feature = "iovec", issue = "58452")] #[inline] pub fn new(buf: &'a [u8]) -> IoVec<'a> { IoVec(sys::io::IoVec::new(buf)) } } -#[unstable(feature = "iovec", issue = "0")] +#[unstable(feature = "iovec", issue = "58452")] impl<'a> Deref for IoVec<'a> { type Target = [u8]; @@ -1109,7 +1109,7 @@ pub trait Write { /// /// The default implementation simply passes the first nonempty buffer to /// `write`. - #[unstable(feature = "iovec", issue = "0")] + #[unstable(feature = "iovec", issue = "58452")] fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result { match bufs.iter().find(|b| !b.is_empty()) { Some(buf) => self.write(buf), From 503e74e96958045025448f90c8da4c7bd1484be9 Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Wed, 6 Feb 2019 14:17:22 +0100 Subject: [PATCH 011/381] Fix SECURITY_SQOS_PRESENT missing if security_qos_flags(SECURITY_ANONYMOUS) is set --- src/libstd/sys/windows/fs.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs index 533b8ae9ba2c..e1f815a525c9 100644 --- a/src/libstd/sys/windows/fs.rs +++ b/src/libstd/sys/windows/fs.rs @@ -191,7 +191,11 @@ impl OpenOptions { pub fn access_mode(&mut self, access_mode: u32) { self.access_mode = Some(access_mode); } pub fn share_mode(&mut self, share_mode: u32) { self.share_mode = share_mode; } pub fn attributes(&mut self, attrs: u32) { self.attributes = attrs; } - pub fn security_qos_flags(&mut self, flags: u32) { self.security_qos_flags = flags; } + pub fn security_qos_flags(&mut self, flags: u32) { + // We have to set `SECURITY_SQOS_PRESENT` here, because one of the valid flags we can + // receive is `SECURITY_ANONYMOUS = 0x0`, which we can't check for later on. + self.security_qos_flags = flags | c::SECURITY_SQOS_PRESENT; + } pub fn security_attributes(&mut self, attrs: c::LPSECURITY_ATTRIBUTES) { self.security_attributes = attrs as usize; } @@ -239,7 +243,6 @@ impl OpenOptions { self.custom_flags | self.attributes | self.security_qos_flags | - if self.security_qos_flags != 0 { c::SECURITY_SQOS_PRESENT } else { 0 } | if self.create_new { c::FILE_FLAG_OPEN_REPARSE_POINT } else { 0 } } } From 200bc02a5e41e763175b5fa9eb97f27a472c777f Mon Sep 17 00:00:00 2001 From: Lucas Molas Date: Thu, 14 Feb 2019 21:33:31 -0300 Subject: [PATCH 012/381] nll: remove `NllLivenessMap` from `LivenessContext` It was used in `compute_for_all_locals` to iterate only the `Local`s that need liveness analysis (filtered through `compute`). Instead, explicitly extract that reduced set (as `live_locals`) in `trace` and pass it to `compute_for_all_locals`. Change the variable type used in `compute_for_all_locals` from `LiveVar` to `Local` and do the same for its helper functions (and the functions in `LocalUseMap` they rely on): * `add_defs_for` -> `LocalUseMap::defs` * `compute_use_live_points_for` -> `LocalUseMap::uses` * `compute_drop_live_points_for` -> `LocalUseMap::drops` Push back the use of `LiveVar` to the `LocalUseMap` (where the other `NllLivenessMap` remains embedded) functions which internally do the `from_local` conversion. --- .../nll/type_check/liveness/local_use_map.rs | 15 ++++--- .../nll/type_check/liveness/trace.rs | 44 ++++++++----------- 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs index e9765d2798cd..fccd633aaa1e 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs @@ -73,18 +73,21 @@ impl LocalUseMap<'me> { local_use_map } - crate fn defs(&self, local: LiveVar) -> impl Iterator + '_ { - vll::iter(self.first_def_at[local], &self.appearances) + crate fn defs(&self, local: Local) -> impl Iterator + '_ { + let live_var = self.liveness_map.from_local(local).unwrap(); + vll::iter(self.first_def_at[live_var], &self.appearances) .map(move |aa| self.appearances[aa].point_index) } - crate fn uses(&self, local: LiveVar) -> impl Iterator + '_ { - vll::iter(self.first_use_at[local], &self.appearances) + crate fn uses(&self, local: Local) -> impl Iterator + '_ { + let live_var = self.liveness_map.from_local(local).unwrap(); + vll::iter(self.first_use_at[live_var], &self.appearances) .map(move |aa| self.appearances[aa].point_index) } - crate fn drops(&self, local: LiveVar) -> impl Iterator + '_ { - vll::iter(self.first_drop_at[local], &self.appearances) + crate fn drops(&self, local: Local) -> impl Iterator + '_ { + let live_var = self.liveness_map.from_local(local).unwrap(); + vll::iter(self.first_drop_at[live_var], &self.appearances) .map(move |aa| self.appearances[aa].point_index) } } diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs index 4a0b4b7c205c..67dcf255f567 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs @@ -1,13 +1,12 @@ use crate::borrow_check::location::LocationTable; use crate::borrow_check::nll::region_infer::values::{self, PointIndex, RegionValueElements}; -use crate::borrow_check::nll::type_check::liveness::liveness_map::{LiveVar, NllLivenessMap}; +use crate::borrow_check::nll::type_check::liveness::liveness_map::NllLivenessMap; use crate::borrow_check::nll::type_check::liveness::local_use_map::LocalUseMap; use crate::borrow_check::nll::type_check::NormalizeLocation; use crate::borrow_check::nll::type_check::TypeChecker; use crate::dataflow::move_paths::indexes::MovePathIndex; use crate::dataflow::move_paths::MoveData; use crate::dataflow::{FlowAtLocation, FlowsAtLocation, MaybeInitializedPlaces}; -use crate::util::liveness::LiveVariableMap; use rustc::infer::canonical::QueryRegionConstraint; use rustc::mir::{BasicBlock, ConstraintCategory, Local, Location, Mir}; use rustc::traits::query::dropck_outlives::DropckOutlivesResult; @@ -56,12 +55,12 @@ pub(super) fn trace( elements, local_use_map, move_data, - liveness_map, drop_data: FxHashMap::default(), location_table, }; - LivenessResults::new(cx).compute_for_all_locals(); + let live_locals: Vec = liveness_map.to_local.clone().into_iter().collect(); + LivenessResults::new(cx).compute_for_all_locals(live_locals); } /// Contextual state for the type-liveness generator. @@ -95,9 +94,6 @@ where /// dropped. local_use_map: &'me LocalUseMap<'me>, - /// Map tracking which variables need liveness computation. - liveness_map: &'me NllLivenessMap, - /// Maps between a MIR Location and a LocationIndex location_table: &'me LocationTable, } @@ -148,15 +144,12 @@ impl LivenessResults<'me, 'typeck, 'flow, 'gcx, 'tcx> { } } - fn compute_for_all_locals(&mut self) { - for live_local in self.cx.liveness_map.to_local.indices() { - let local = self.cx.liveness_map.from_live_var(live_local); - debug!("local={:?} live_local={:?}", local, live_local); - + fn compute_for_all_locals(&mut self, live_locals: Vec) { + for local in live_locals { self.reset_local_state(); - self.add_defs_for(live_local); - self.compute_use_live_points_for(live_local); - self.compute_drop_live_points_for(live_local); + self.add_defs_for(local); + self.compute_use_live_points_for(local); + self.compute_drop_live_points_for(local); let local_ty = self.cx.mir.local_decls[local].ty; @@ -185,8 +178,8 @@ impl LivenessResults<'me, 'typeck, 'flow, 'gcx, 'tcx> { } /// Adds the definitions of `local` into `self.defs`. - fn add_defs_for(&mut self, live_local: LiveVar) { - for def in self.cx.local_use_map.defs(live_local) { + fn add_defs_for(&mut self, local: Local) { + for def in self.cx.local_use_map.defs(local) { debug!("- defined at {:?}", def); self.defs.insert(def); } @@ -194,14 +187,14 @@ impl LivenessResults<'me, 'typeck, 'flow, 'gcx, 'tcx> { /// Computes all points where local is "use live" -- meaning its /// current value may be used later (except by a drop). This is - /// done by walking backwards from each use of `live_local` until we + /// done by walking backwards from each use of `local` until we /// find a `def` of local. /// - /// Requires `add_defs_for(live_local)` to have been executed. - fn compute_use_live_points_for(&mut self, live_local: LiveVar) { - debug!("compute_use_live_points_for(live_local={:?})", live_local); + /// Requires `add_defs_for(local)` to have been executed. + fn compute_use_live_points_for(&mut self, local: Local) { + debug!("compute_use_live_points_for(local={:?})", local); - self.stack.extend(self.cx.local_use_map.uses(live_local)); + self.stack.extend(self.cx.local_use_map.uses(local)); while let Some(p) = self.stack.pop() { if self.defs.contains(p) { continue; @@ -224,15 +217,14 @@ impl LivenessResults<'me, 'typeck, 'flow, 'gcx, 'tcx> { /// /// Requires `compute_use_live_points_for` and `add_defs_for` to /// have been executed. - fn compute_drop_live_points_for(&mut self, live_local: LiveVar) { - debug!("compute_drop_live_points_for(live_local={:?})", live_local); + fn compute_drop_live_points_for(&mut self, local: Local) { + debug!("compute_drop_live_points_for(local={:?})", local); - let local = self.cx.liveness_map.from_live_var(live_local); let mpi = self.cx.move_data.rev_lookup.find_local(local); debug!("compute_drop_live_points_for: mpi = {:?}", mpi); // Find the drops where `local` is initialized. - for drop_point in self.cx.local_use_map.drops(live_local) { + for drop_point in self.cx.local_use_map.drops(local) { let location = self.cx.elements.to_location(drop_point); debug_assert_eq!(self.cx.mir.terminator_loc(location.block), location,); From 4ae4e0501bdf9e6d6be06757b08f92e3553848c6 Mon Sep 17 00:00:00 2001 From: Lucas Molas Date: Thu, 14 Feb 2019 23:49:45 -0300 Subject: [PATCH 013/381] nll: remove `NllLivenessMap` from `LocalUseMap` Extend `LocalUseMap`'s `IndexVec`s that track def/use/drop data to store the original `Local` indexes and not the compacted `LiveVar` ones (favoring speed and code simplicity over space). Remove the `NllLivenessMap` embedded inside it since it's no longer needed to perform the `LiveVar`/`Local` conversion. --- .../nll/type_check/liveness/local_use_map.rs | 79 ++++++++++++------- .../nll/type_check/liveness/trace.rs | 6 +- 2 files changed, 52 insertions(+), 33 deletions(-) diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs index fccd633aaa1e..9b8940098852 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs @@ -1,6 +1,5 @@ use crate::borrow_check::nll::region_infer::values::{PointIndex, RegionValueElements}; -use crate::borrow_check::nll::type_check::liveness::liveness_map::{LiveVar, NllLivenessMap}; -use crate::util::liveness::{categorize, DefUse, LiveVariableMap}; +use crate::util::liveness::{categorize, DefUse}; use rustc::mir::visit::{PlaceContext, Visitor}; use rustc::mir::{Local, Location, Mir}; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; @@ -9,26 +8,33 @@ use rustc_data_structures::vec_linked_list as vll; /// A map that cross references each local with the locations where it /// is defined (assigned), used, or dropped. Used during liveness /// computation. -crate struct LocalUseMap<'me> { - liveness_map: &'me NllLivenessMap, - +/// +/// We keep track only of `Local`s we'll do the liveness analysis later, +/// this means that our internal `IndexVec`s will only be sparsely populated. +/// In the time-memory trade-off between keeping compact vectors with new +/// indexes (and needing to continuously map the `Local` index to its compact +/// counterpart) and having `IndexVec`s that we only use a fraction of, time +/// (and code simplicity) was favored. The rationale is that we only keep +/// a small number of `IndexVec`s throughout the entire analysis while, in +/// contrast, we're accessing each `Local` *many* times. +crate struct LocalUseMap { /// Head of a linked list of **definitions** of each variable -- /// definition in this context means assignment, e.g., `x` is /// defined in `x = y` but not `y`; that first def is the head of /// a linked list that lets you enumerate all places the variable /// is assigned. - first_def_at: IndexVec>, + first_def_at: IndexVec>, /// Head of a linked list of **uses** of each variable -- use in /// this context means that the existing value of the variable is /// read or modified. e.g., `y` is used in `x = y` but not `x`. /// Note that `DROP(x)` terminators are excluded from this list. - first_use_at: IndexVec>, + first_use_at: IndexVec>, /// Head of a linked list of **drops** of each variable -- these /// are a special category of uses corresponding to the drop that /// we add for each local variable. - first_drop_at: IndexVec>, + first_drop_at: IndexVec>, appearances: IndexVec, } @@ -50,55 +56,68 @@ impl vll::LinkElem for Appearance { } } -impl LocalUseMap<'me> { +impl LocalUseMap { crate fn build( - liveness_map: &'me NllLivenessMap, + live_locals: &Vec, elements: &RegionValueElements, mir: &Mir<'_>, ) -> Self { - let nones = IndexVec::from_elem_n(None, liveness_map.num_variables()); + let nones = IndexVec::from_elem_n(None, mir.local_decls.len()); let mut local_use_map = LocalUseMap { - liveness_map, first_def_at: nones.clone(), first_use_at: nones.clone(), first_drop_at: nones, appearances: IndexVec::new(), }; + let mut locals_with_use_data: IndexVec = + IndexVec::from_elem_n(false, mir.local_decls.len()); + live_locals + .iter() + .for_each(|&local| locals_with_use_data[local] = true); + LocalUseMapBuild { local_use_map: &mut local_use_map, elements, - }.visit_mir(mir); + locals_with_use_data, + } + .visit_mir(mir); local_use_map } crate fn defs(&self, local: Local) -> impl Iterator + '_ { - let live_var = self.liveness_map.from_local(local).unwrap(); - vll::iter(self.first_def_at[live_var], &self.appearances) + vll::iter(self.first_def_at[local], &self.appearances) .map(move |aa| self.appearances[aa].point_index) } crate fn uses(&self, local: Local) -> impl Iterator + '_ { - let live_var = self.liveness_map.from_local(local).unwrap(); - vll::iter(self.first_use_at[live_var], &self.appearances) + vll::iter(self.first_use_at[local], &self.appearances) .map(move |aa| self.appearances[aa].point_index) } crate fn drops(&self, local: Local) -> impl Iterator + '_ { - let live_var = self.liveness_map.from_local(local).unwrap(); - vll::iter(self.first_drop_at[live_var], &self.appearances) + vll::iter(self.first_drop_at[local], &self.appearances) .map(move |aa| self.appearances[aa].point_index) } } -struct LocalUseMapBuild<'me, 'map: 'me> { - local_use_map: &'me mut LocalUseMap<'map>, +struct LocalUseMapBuild<'me> { + local_use_map: &'me mut LocalUseMap, elements: &'me RegionValueElements, + + // Vector used in `visit_local` to signal which `Local`s do we need + // def/use/drop information on, constructed from `live_locals` (that + // contains the variables we'll do the liveness analysis for). + // This vector serves optimization purposes only: we could have + // obtained the same information from `live_locals` but we want to + // avoid repeatedly calling `Vec::contains()` (see `LocalUseMap` for + // the rationale on the time-memory trade-off we're favoring here). + locals_with_use_data: IndexVec, } -impl LocalUseMapBuild<'_, '_> { - fn insert_def(&mut self, local: LiveVar, location: Location) { +impl LocalUseMapBuild<'_> { + fn insert_def(&mut self, local: Local, location: Location) { Self::insert( self.elements, &mut self.local_use_map.first_def_at[local], @@ -107,7 +126,7 @@ impl LocalUseMapBuild<'_, '_> { ); } - fn insert_use(&mut self, local: LiveVar, location: Location) { + fn insert_use(&mut self, local: Local, location: Location) { Self::insert( self.elements, &mut self.local_use_map.first_use_at[local], @@ -116,7 +135,7 @@ impl LocalUseMapBuild<'_, '_> { ); } - fn insert_drop(&mut self, local: LiveVar, location: Location) { + fn insert_drop(&mut self, local: Local, location: Location) { Self::insert( self.elements, &mut self.local_use_map.first_drop_at[local], @@ -140,13 +159,13 @@ impl LocalUseMapBuild<'_, '_> { } } -impl Visitor<'tcx> for LocalUseMapBuild<'_, '_> { +impl Visitor<'tcx> for LocalUseMapBuild<'_> { fn visit_local(&mut self, &local: &Local, context: PlaceContext<'tcx>, location: Location) { - if let Some(local_with_region) = self.local_use_map.liveness_map.from_local(local) { + if self.locals_with_use_data[local] { match categorize(context) { - Some(DefUse::Def) => self.insert_def(local_with_region, location), - Some(DefUse::Use) => self.insert_use(local_with_region, location), - Some(DefUse::Drop) => self.insert_drop(local_with_region, location), + Some(DefUse::Def) => self.insert_def(local, location), + Some(DefUse::Use) => self.insert_use(local, location), + Some(DefUse::Drop) => self.insert_drop(local, location), _ => (), } } diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs index 67dcf255f567..4950d0045d3f 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs @@ -46,7 +46,8 @@ pub(super) fn trace( return; } - let local_use_map = &LocalUseMap::build(liveness_map, elements, mir); + let live_locals: Vec = liveness_map.to_local.clone().into_iter().collect(); + let local_use_map = &LocalUseMap::build(&live_locals, elements, mir); let cx = LivenessContext { typeck, @@ -59,7 +60,6 @@ pub(super) fn trace( location_table, }; - let live_locals: Vec = liveness_map.to_local.clone().into_iter().collect(); LivenessResults::new(cx).compute_for_all_locals(live_locals); } @@ -92,7 +92,7 @@ where /// Index indicating where each variable is assigned, used, or /// dropped. - local_use_map: &'me LocalUseMap<'me>, + local_use_map: &'me LocalUseMap, /// Maps between a MIR Location and a LocationIndex location_table: &'me LocationTable, From d6ede9192d520ffda332e337418b00d357082dd6 Mon Sep 17 00:00:00 2001 From: Lucas Molas Date: Fri, 15 Feb 2019 01:04:16 -0300 Subject: [PATCH 014/381] nll: remove `NllLivenessMap` and `LiveVar` Extract the `compute` logic (now renamed `compute_live_locals`) from `NllLivenessMap` to the `liveness` module. Remove the unused structures. --- src/librustc_mir/borrow_check/nll/mod.rs | 1 - .../nll/type_check/liveness/liveness_map.rs | 94 ------------------- .../nll/type_check/liveness/mod.rs | 85 ++++++++++++++--- .../nll/type_check/liveness/trace.rs | 8 +- 4 files changed, 71 insertions(+), 117 deletions(-) delete mode 100644 src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs diff --git a/src/librustc_mir/borrow_check/nll/mod.rs b/src/librustc_mir/borrow_check/nll/mod.rs index 84fdbb9423e0..2d3800dd1dda 100644 --- a/src/librustc_mir/borrow_check/nll/mod.rs +++ b/src/librustc_mir/borrow_check/nll/mod.rs @@ -2,7 +2,6 @@ use crate::borrow_check::borrow_set::BorrowSet; use crate::borrow_check::location::{LocationIndex, LocationTable}; use crate::borrow_check::nll::facts::AllFactsExt; use crate::borrow_check::nll::type_check::{MirTypeckResults, MirTypeckRegionConstraints}; -use crate::borrow_check::nll::type_check::liveness::liveness_map::NllLivenessMap; use crate::borrow_check::nll::region_infer::values::RegionValueElements; use crate::dataflow::indexes::BorrowIndex; use crate::dataflow::move_paths::MoveData; diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs deleted file mode 100644 index b9f9d83161b7..000000000000 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs +++ /dev/null @@ -1,94 +0,0 @@ -//! For the NLL computation, we need to compute liveness, but only for those -//! local variables whose types contain regions. The others are not of interest -//! to us. This file defines a new index type (LiveVar) that indexes into -//! a list of "variables whose type contain regions". It also defines a map from -//! Local to LiveVar and vice versa -- this map can be given to the -//! liveness code so that it only operates over variables with regions in their -//! types, instead of all variables. - -use crate::borrow_check::nll::ToRegionVid; -use crate::borrow_check::nll::facts::{AllFacts, AllFactsExt}; -use crate::util::liveness::LiveVariableMap; -use rustc::mir::{Local, Mir}; -use rustc::ty::{RegionVid, TyCtxt}; -use rustc_data_structures::fx::FxHashSet; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; - -/// Map between Local and LiveVar indices: the purpose of this -/// map is to define the subset of local variables for which we need -/// to do a liveness computation. We only need to compute whether a -/// variable `X` is live if that variable contains some region `R` in -/// its type where `R` is not known to outlive a free region (i.e., -/// where `R` may be valid for just a subset of the fn body). -crate struct NllLivenessMap { - /// For each local variable, contains `Some(i)` if liveness is - /// needed for this variable. - pub from_local: IndexVec>, - - /// For each `LiveVar`, maps back to the original `Local` index. - pub to_local: IndexVec, -} - -impl LiveVariableMap for NllLivenessMap { - fn from_local(&self, local: Local) -> Option { - self.from_local[local] - } - - type LiveVar = LiveVar; - - fn from_live_var(&self, local: Self::LiveVar) -> Local { - self.to_local[local] - } - - fn num_variables(&self) -> usize { - self.to_local.len() - } -} - -impl NllLivenessMap { - crate fn compute( - tcx: TyCtxt<'_, '_, 'tcx>, - free_regions: &FxHashSet, - mir: &Mir<'tcx>, - ) -> Self { - let mut to_local = IndexVec::default(); - let facts_enabled = AllFacts::enabled(tcx); - let from_local: IndexVec> = mir.local_decls - .iter_enumerated() - .map(|(local, local_decl)| { - if tcx.all_free_regions_meet(&local_decl.ty, |r| { - free_regions.contains(&r.to_region_vid()) - }) && !facts_enabled { - // If all the regions in the type are free regions - // (or there are no regions), then we don't need - // to track liveness for this variable. - None - } else { - Some(to_local.push(local)) - } - }) - .collect(); - - debug!("{} total variables", mir.local_decls.len()); - debug!("{} variables need liveness", to_local.len()); - debug!("{} regions outlive free regions", free_regions.len()); - - Self { - from_local, - to_local, - } - } - - /// Returns `true` if there are no local variables that need liveness computation. - crate fn is_empty(&self) -> bool { - self.to_local.is_empty() - } -} - -/// Index given to each local variable for which we need to -/// compute liveness information. For many locals, we are able to -/// skip liveness information: for example, those variables whose -/// types contain no regions. -newtype_index! { - pub struct LiveVar { .. } -} diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs index 28a8cad8ca20..960e75048fa1 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs @@ -1,19 +1,19 @@ use crate::borrow_check::location::LocationTable; -use crate::borrow_check::nll::region_infer::values::RegionValueElements; use crate::borrow_check::nll::constraints::ConstraintSet; -use crate::borrow_check::nll::NllLivenessMap; +use crate::borrow_check::nll::facts::{AllFacts, AllFactsExt}; +use crate::borrow_check::nll::region_infer::values::RegionValueElements; use crate::borrow_check::nll::universal_regions::UniversalRegions; +use crate::borrow_check::nll::ToRegionVid; use crate::dataflow::move_paths::MoveData; -use crate::dataflow::MaybeInitializedPlaces; use crate::dataflow::FlowAtLocation; -use rustc::mir::Mir; -use rustc::ty::RegionVid; +use crate::dataflow::MaybeInitializedPlaces; +use rustc::mir::{Local, Mir}; +use rustc::ty::{RegionVid, TyCtxt}; use rustc_data_structures::fx::FxHashSet; use std::rc::Rc; use super::TypeChecker; -crate mod liveness_map; mod local_use_map; mod trace; @@ -34,16 +34,71 @@ pub(super) fn generate<'gcx, 'tcx>( location_table: &LocationTable, ) { debug!("liveness::generate"); - let free_regions = { - let borrowck_context = typeck.borrowck_context.as_ref().unwrap(); - regions_that_outlive_free_regions( - typeck.infcx.num_region_vars(), - &borrowck_context.universal_regions, - &borrowck_context.constraints.outlives_constraints, - ) + + let live_locals: Vec = if AllFacts::enabled(typeck.tcx()) { + // If "dump facts from NLL analysis" was requested perform + // the liveness analysis for all `Local`s. This case opens + // the possibility of the variables being analyzed in `trace` + // to be *any* `Local`, not just the "live" ones, so we can't + // make any assumptions past this point as to the characteristics + // of the `live_locals`. + // FIXME: Review "live" terminology past this point, we should + // not be naming the `Local`s as live. + mir.local_decls.indices().collect() + } else { + let free_regions = { + let borrowck_context = typeck.borrowck_context.as_ref().unwrap(); + regions_that_outlive_free_regions( + typeck.infcx.num_region_vars(), + &borrowck_context.universal_regions, + &borrowck_context.constraints.outlives_constraints, + ) + }; + compute_live_locals(typeck.tcx(), &free_regions, mir) }; - let liveness_map = NllLivenessMap::compute(typeck.tcx(), &free_regions, mir); - trace::trace(typeck, mir, elements, flow_inits, move_data, &liveness_map, location_table); + + if !live_locals.is_empty() { + trace::trace( + typeck, + mir, + elements, + flow_inits, + move_data, + live_locals, + location_table, + ); + } +} + +// The purpose of `compute_live_locals` is to define the subset of `Local` +// variables for which we need to do a liveness computation. We only need +// to compute whether a variable `X` is live if that variable contains +// some region `R` in its type where `R` is not known to outlive a free +// region (i.e., where `R` may be valid for just a subset of the fn body). +fn compute_live_locals( + tcx: TyCtxt<'_, '_, 'tcx>, + free_regions: &FxHashSet, + mir: &Mir<'tcx>, +) -> Vec { + let live_locals: Vec = mir + .local_decls + .iter_enumerated() + .filter_map(|(local, local_decl)| { + if tcx.all_free_regions_meet(&local_decl.ty, |r| { + free_regions.contains(&r.to_region_vid()) + }) { + None + } else { + Some(local) + } + }) + .collect(); + + debug!("{} total variables", mir.local_decls.len()); + debug!("{} variables need liveness", live_locals.len()); + debug!("{} regions outlive free regions", free_regions.len()); + + live_locals } /// Computes all regions that are (currently) known to outlive free diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs index 4950d0045d3f..f0df7070e6b5 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs @@ -1,6 +1,5 @@ use crate::borrow_check::location::LocationTable; use crate::borrow_check::nll::region_infer::values::{self, PointIndex, RegionValueElements}; -use crate::borrow_check::nll::type_check::liveness::liveness_map::NllLivenessMap; use crate::borrow_check::nll::type_check::liveness::local_use_map::LocalUseMap; use crate::borrow_check::nll::type_check::NormalizeLocation; use crate::borrow_check::nll::type_check::TypeChecker; @@ -37,16 +36,11 @@ pub(super) fn trace( elements: &Rc, flow_inits: &mut FlowAtLocation<'tcx, MaybeInitializedPlaces<'_, 'gcx, 'tcx>>, move_data: &MoveData<'tcx>, - liveness_map: &NllLivenessMap, + live_locals: Vec, location_table: &LocationTable, ) { debug!("trace()"); - if liveness_map.is_empty() { - return; - } - - let live_locals: Vec = liveness_map.to_local.clone().into_iter().collect(); let local_use_map = &LocalUseMap::build(&live_locals, elements, mir); let cx = LivenessContext { From ae5f7224b5ee08f9762befb26eccb8ad26cdbcbc Mon Sep 17 00:00:00 2001 From: Lucas Molas Date: Fri, 15 Feb 2019 02:01:29 -0300 Subject: [PATCH 015/381] nll: remove `IdentityMap` and `LiveVariableMap` With `NllLivenessMap` and `LiveVar` removed, the `IdentityMap` (remaining structure implementing the `LiveVariableMap` trait) loses its meaning. Specialize the `LiveVarSet` to a `BitSet` removing the `V` and related parameters. The `LiveVarSet` was only being used as `LiveVarSet` so this commit doesn't bring any change to the logic, it just removes an unused parameter (that without `LiveVar` now, it couldn't have been specialized to anything but `Local`). --- src/librustc_mir/transform/generator.rs | 16 ++-- src/librustc_mir/util/liveness.rs | 122 +++++++----------------- 2 files changed, 41 insertions(+), 97 deletions(-) diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 0866b87cf17e..2c305197328a 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -68,7 +68,7 @@ use crate::transform::no_landing_pads::no_landing_pads; use crate::dataflow::{do_dataflow, DebugFormatted, state_for_location}; use crate::dataflow::{MaybeStorageLive, HaveBeenBorrowedLocals}; use crate::util::dump_mir; -use crate::util::liveness::{self, IdentityMap}; +use crate::util::liveness; pub struct StateTransform; @@ -148,7 +148,7 @@ struct SuspensionPoint { state: u32, resume: BasicBlock, drop: Option, - storage_liveness: liveness::LiveVarSet, + storage_liveness: liveness::LiveVarSet, } struct TransformVisitor<'a, 'tcx: 'a> { @@ -165,7 +165,7 @@ struct TransformVisitor<'a, 'tcx: 'a> { // A map from a suspension point in a block to the locals which have live storage at that point // FIXME(eddyb) This should use `IndexVec>`. - storage_liveness: FxHashMap>, + storage_liveness: FxHashMap, // A list of suspension points, generated during the transform suspension_points: Vec, @@ -358,7 +358,7 @@ fn replace_result_variable<'tcx>( new_ret_local } -struct StorageIgnored(liveness::LiveVarSet); +struct StorageIgnored(liveness::LiveVarSet); impl<'tcx> Visitor<'tcx> for StorageIgnored { fn visit_statement(&mut self, @@ -379,8 +379,8 @@ fn locals_live_across_suspend_points( source: MirSource<'tcx>, movable: bool, ) -> ( - liveness::LiveVarSet, - FxHashMap>, + liveness::LiveVarSet, + FxHashMap, ) { let dead_unwinds = BitSet::new_empty(mir.basic_blocks().len()); let node_id = tcx.hir().as_local_node_id(source.def_id()).unwrap(); @@ -414,14 +414,12 @@ fn locals_live_across_suspend_points( let mut set = liveness::LiveVarSet::new_empty(mir.local_decls.len()); let mut liveness = liveness::liveness_of_locals( mir, - &IdentityMap::new(mir), ); liveness::dump_mir( tcx, "generator_liveness", source, mir, - &IdentityMap::new(mir), &liveness, ); @@ -491,7 +489,7 @@ fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &mut Mir<'tcx>) -> (FxHashMap, usize)>, GeneratorLayout<'tcx>, - FxHashMap>) + FxHashMap) { // Use a liveness analysis to compute locals which are live across a suspension point let (live_locals, storage_liveness) = locals_live_across_suspend_points(tcx, diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index dcbd9aa9af22..9cda6cfdacbe 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -39,7 +39,7 @@ use std::path::{Path, PathBuf}; use crate::transform::MirSource; use crate::util::pretty::{dump_enabled, write_basic_block, write_mir_intro}; -pub type LiveVarSet = BitSet; +pub type LiveVarSet = BitSet; /// This gives the result of the liveness analysis at the boundary of /// basic blocks. @@ -48,66 +48,27 @@ pub type LiveVarSet = BitSet; /// liveness for. This is often `Local`, in which case we computed /// liveness for all variables -- but it can also be some other type, /// which indicates a subset of the variables within the graph. -pub struct LivenessResult { +pub struct LivenessResult { /// Live variables on exit to each basic block. This is equal to /// the union of the `ins` for each successor. - pub outs: IndexVec>, -} - -/// Defines the mapping to/from the MIR local variables (`Local`) to -/// the "live variable indices" we are using in a particular -/// computation. -pub trait LiveVariableMap { - type LiveVar; - - fn from_local(&self, local: Local) -> Option; - fn from_live_var(&self, local: Self::LiveVar) -> Local; - fn num_variables(&self) -> usize; -} - -#[derive(Debug)] -pub struct IdentityMap<'a, 'tcx: 'a> { - mir: &'a Mir<'tcx>, -} - -impl<'a, 'tcx> IdentityMap<'a, 'tcx> { - pub fn new(mir: &'a Mir<'tcx>) -> Self { - Self { mir } - } -} - -impl<'a, 'tcx> LiveVariableMap for IdentityMap<'a, 'tcx> { - type LiveVar = Local; - - fn from_local(&self, local: Local) -> Option { - Some(local) - } - - fn from_live_var(&self, local: Self::LiveVar) -> Local { - local - } - - fn num_variables(&self) -> usize { - self.mir.local_decls.len() - } + pub outs: IndexVec, } /// Computes which local variables are live within the given function /// `mir`. The liveness mode `mode` determines what sorts of uses are /// considered to make a variable live (e.g., do drops count?). -pub fn liveness_of_locals<'tcx, V: Idx>( +pub fn liveness_of_locals<'tcx>( mir: &Mir<'tcx>, - map: &impl LiveVariableMap, -) -> LivenessResult { - let num_live_vars = map.num_variables(); +) -> LivenessResult { + let num_live_vars = mir.local_decls.len(); - let def_use: IndexVec<_, DefsUses> = mir + let def_use: IndexVec<_, DefsUses> = mir .basic_blocks() .iter() - .map(|b| block(map, b, num_live_vars)) + .map(|b| block(b, num_live_vars)) .collect(); - let mut outs: IndexVec<_, LiveVarSet> = mir + let mut outs: IndexVec<_, LiveVarSet> = mir .basic_blocks() .indices() .map(|_| LiveVarSet::new_empty(num_live_vars)) @@ -211,27 +172,23 @@ pub fn categorize<'tcx>(context: PlaceContext<'tcx>) -> Option { } } -struct DefsUsesVisitor<'lv, V, M> -where - V: Idx, - M: LiveVariableMap + 'lv, +struct DefsUsesVisitor { - map: &'lv M, - defs_uses: DefsUses, + defs_uses: DefsUses, } #[derive(Eq, PartialEq, Clone)] -struct DefsUses { - defs: LiveVarSet, - uses: LiveVarSet, +struct DefsUses { + defs: LiveVarSet, + uses: LiveVarSet, } -impl DefsUses { - fn apply(&self, bits: &mut LiveVarSet) -> bool { +impl DefsUses { + fn apply(&self, bits: &mut LiveVarSet) -> bool { bits.subtract(&self.defs) | bits.union(&self.uses) } - fn add_def(&mut self, index: V) { + fn add_def(&mut self, index: Local) { // If it was used already in the block, remove that use // now that we found a definition. // @@ -245,7 +202,7 @@ impl DefsUses { self.defs.insert(index); } - fn add_use(&mut self, index: V) { + fn add_use(&mut self, index: Local) { // Inverse of above. // // Example: @@ -261,29 +218,22 @@ impl DefsUses { } } -impl<'tcx, 'lv, V, M> Visitor<'tcx> for DefsUsesVisitor<'lv, V, M> -where - V: Idx, - M: LiveVariableMap, +impl<'tcx> Visitor<'tcx> for DefsUsesVisitor { fn visit_local(&mut self, &local: &Local, context: PlaceContext<'tcx>, _: Location) { - if let Some(v_index) = self.map.from_local(local) { - match categorize(context) { - Some(DefUse::Def) => self.defs_uses.add_def(v_index), - Some(DefUse::Use) | Some(DefUse::Drop) => self.defs_uses.add_use(v_index), - _ => (), - } + match categorize(context) { + Some(DefUse::Def) => self.defs_uses.add_def(local), + Some(DefUse::Use) | Some(DefUse::Drop) => self.defs_uses.add_use(local), + _ => (), } } } -fn block<'tcx, V: Idx>( - map: &impl LiveVariableMap, +fn block<'tcx>( b: &BasicBlockData<'tcx>, locals: usize, -) -> DefsUses { +) -> DefsUses { let mut visitor = DefsUsesVisitor { - map, defs_uses: DefsUses { defs: LiveVarSet::new_empty(locals), uses: LiveVarSet::new_empty(locals), @@ -305,13 +255,12 @@ fn block<'tcx, V: Idx>( visitor.defs_uses } -pub fn dump_mir<'a, 'tcx, V: Idx>( +pub fn dump_mir<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, pass_name: &str, source: MirSource<'tcx>, mir: &Mir<'tcx>, - map: &impl LiveVariableMap, - result: &LivenessResult, + result: &LivenessResult, ) { if !dump_enabled(tcx, pass_name, source) { return; @@ -320,17 +269,16 @@ pub fn dump_mir<'a, 'tcx, V: Idx>( // see notes on #41697 below tcx.item_path_str(source.def_id()) }); - dump_matched_mir_node(tcx, pass_name, &node_path, source, mir, map, result); + dump_matched_mir_node(tcx, pass_name, &node_path, source, mir, result); } -fn dump_matched_mir_node<'a, 'tcx, V: Idx>( +fn dump_matched_mir_node<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, pass_name: &str, node_path: &str, source: MirSource<'tcx>, mir: &Mir<'tcx>, - map: &dyn LiveVariableMap, - result: &LivenessResult, + result: &LivenessResult, ) { let mut file_path = PathBuf::new(); file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir)); @@ -342,25 +290,23 @@ fn dump_matched_mir_node<'a, 'tcx, V: Idx>( writeln!(file, "// source = {:?}", source)?; writeln!(file, "// pass_name = {}", pass_name)?; writeln!(file, "")?; - write_mir_fn(tcx, source, mir, map, &mut file, result)?; + write_mir_fn(tcx, source, mir, &mut file, result)?; Ok(()) }); } -pub fn write_mir_fn<'a, 'tcx, V: Idx>( +pub fn write_mir_fn<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource<'tcx>, mir: &Mir<'tcx>, - map: &dyn LiveVariableMap, w: &mut dyn Write, - result: &LivenessResult, + result: &LivenessResult, ) -> io::Result<()> { write_mir_intro(tcx, src, mir, w)?; for block in mir.basic_blocks().indices() { - let print = |w: &mut dyn Write, prefix, result: &IndexVec>| { + let print = |w: &mut dyn Write, prefix, result: &IndexVec| { let live: Vec = result[block] .iter() - .map(|v| map.from_live_var(v)) .map(|local| format!("{:?}", local)) .collect(); writeln!(w, "{} {{{}}}", prefix, live.join(", ")) From cf267540ebabdeac1f2045819cd6bac561017e29 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sun, 17 Feb 2019 21:30:00 +0100 Subject: [PATCH 016/381] Review comments --- src/libcore/convert.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index c6c41fb99a46..6b059f31d90e 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -41,6 +41,8 @@ #![stable(feature = "rust1", since = "1.0.0")] +use fmt; + /// An identity function. /// /// Two things are important to note about this function: @@ -571,8 +573,6 @@ impl Clone for Infallible { } } -use fmt; - #[stable(feature = "convert_infallible", since = "1.34.0")] impl fmt::Debug for Infallible { fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -597,6 +597,20 @@ impl PartialEq for Infallible { #[stable(feature = "convert_infallible", since = "1.34.0")] impl Eq for Infallible {} +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl PartialOrd for Infallible { + fn partial_cmp(&self, _other: &Self) -> Option { + match *self {} + } +} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl Ord for Infallible { + fn cmp(&self, _other: &Self) -> crate::cmp::Ordering { + match *self {} + } +} + #[stable(feature = "convert_infallible", since = "1.34.0")] impl From for Infallible { fn from(x: !) -> Self { From 13ffbee1735c7329d6e7b3521712996c914c4ef9 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 22 Feb 2019 22:07:58 +0100 Subject: [PATCH 017/381] Add MaybeUninit::read_uninitialized Also remove a no-longer accurate comments --- src/libcore/mem.rs | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 43afc9a522a3..3955839ac362 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1185,6 +1185,61 @@ impl MaybeUninit { ManuallyDrop::into_inner(self.value) } + /// Reads the value from the `MaybeUninit` container. The resulting `T` is subject + /// to the usual drop handling. + /// + /// # Unsafety + /// + /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized + /// state. Calling this when the content is not yet fully initialized causes undefined + /// behavior. + /// + /// Moreover, this leaves a copy of the same data behind in the `MaybeUninit`. When using + /// multiple copies of the data (by calling `read_initialized` multiple times, or first + /// calling `read_initialized` and then [`into_initialized`]), it is your responsibility + /// to ensure that that data may indeed be duplicated. + /// + /// # Examples + /// + /// Correct usage of this method: + /// + /// ```rust + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let mut x = MaybeUninit::::uninitialized(); + /// x.set(13); + /// let x1 = unsafe { x.read_initialized() }; + /// // `u32` is `Copy`, so we may read multiple times. + /// let x2 = unsafe { x.read_initialized() }; + /// + /// let mut x = MaybeUninit::>>::uninitialized(); + /// x.set(None); + /// let x1 = unsafe { x.read_initialized() }; + /// // Duplicating a `None` value is okay, so we may read multiple times. + /// let x2 = unsafe { x.read_initialized() }; + /// ``` + /// + /// *Incorrect* usafe of this method: + /// + /// ```rust,no_run + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let mut x = MaybeUninit::>>::uninitialized(); + /// x.set(Some(vec![0,1,2])); + /// let x1 = unsafe { x.read_initialized() }; + /// let x2 = unsafe { x.read_initialized() }; + /// // We now created two copies of the same vector, leading to a double-free when + /// // they both get dropped! + /// ``` + #[unstable(feature = "maybe_uninit", issue = "53491")] + #[inline(always)] + pub unsafe fn read_initialized(&self) -> T { + intrinsics::panic_if_uninhabited::(); + self.as_ptr().read() + } + /// Gets a reference to the contained value. /// /// # Unsafety From dc570fb3f26b45d101440bb4fe57121ca06884d3 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 22 Feb 2019 22:11:37 +0100 Subject: [PATCH 018/381] also add examples to MaybeUninit::into_initialized --- src/libcore/mem.rs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 3955839ac362..42f30c1dd6d7 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1178,6 +1178,31 @@ impl MaybeUninit { /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized /// state. Calling this when the content is not yet fully initialized causes undefined /// behavior. + /// + /// # Examples + /// + /// Correct usage of this method: + /// + /// ```rust + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let mut x = MaybeUninit::::uninitialized(); + /// x.set(true); + /// let x_init = unsafe { x.into_initialized() }; + /// assert_eq!(x_init, true); + /// ``` + /// + /// *Incorrect* usage of this method: + /// + /// ```rust,no_run + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let x = MaybeUninit::>::uninitialized(); + /// let x_init = unsafe { x.into_initialized() }; + /// // `x` had not been initialized yet, so this last line causes undefined behavior. + /// ``` #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub unsafe fn into_initialized(self) -> T { @@ -1212,15 +1237,17 @@ impl MaybeUninit { /// let x1 = unsafe { x.read_initialized() }; /// // `u32` is `Copy`, so we may read multiple times. /// let x2 = unsafe { x.read_initialized() }; + /// assert_eq!(x1, x2); /// /// let mut x = MaybeUninit::>>::uninitialized(); /// x.set(None); /// let x1 = unsafe { x.read_initialized() }; /// // Duplicating a `None` value is okay, so we may read multiple times. /// let x2 = unsafe { x.read_initialized() }; + /// assert_eq!(x1, x2); /// ``` /// - /// *Incorrect* usafe of this method: + /// *Incorrect* usage of this method: /// /// ```rust,no_run /// #![feature(maybe_uninit)] From 10f511daa01d98e4c8f524cbdf38e9dd6c3ea9e3 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 22 Feb 2019 22:17:04 +0100 Subject: [PATCH 019/381] misc tweaks --- src/libcore/mem.rs | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 42f30c1dd6d7..556f8a9e8a2a 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1056,12 +1056,22 @@ impl DerefMut for ManuallyDrop { /// This is exploited by the compiler for various optimizations, such as eliding /// run-time checks and optimizing `enum` layout. /// -/// Not initializing memory at all (instead of zero-initializing it) causes the same -/// issue: after all, the initial value of the variable might just happen to be -/// one that violates the invariant. Moreover, uninitialized memory is special -/// in that the compiler knows that it does not have a fixed value. This makes -/// it undefined behavior to have uninitialized data in a variable even if that -/// variable has otherwise no restrictions about which values are valid: +/// Similarly, entirely uninitialized memory may have any content, while a `bool` must +/// always be `true` or `false`. Hence, creating an uninitialized `bool` is undefined behavior: +/// +/// ```rust,no_run +/// #![feature(maybe_uninit)] +/// use std::mem::{self, MaybeUninit}; +/// +/// let b: bool = unsafe { mem::uninitialized() }; // undefined behavior! +/// // equivalent code with `MaybeUninit` +/// let b: bool = unsafe { MaybeUninit::uninitialized().into_initialized() }; // undefined behavior! +/// ``` +/// +/// Moreover, uninitialized memory is special in that the compiler knows that +/// it does not have a fixed value. This makes it undefined behavior to have +/// uninitialized data in a variable even if that variable has integer type, +/// which otherwise can hold any bit pattern: /// /// ```rust,no_run /// #![feature(maybe_uninit)] @@ -1074,8 +1084,8 @@ impl DerefMut for ManuallyDrop { /// (Notice that the rules around uninitialized integers are not finalized yet, but /// until they are, it is advisable to avoid them.) /// -/// `MaybeUninit` serves to enable unsafe code to deal with uninitialized data: -/// it is a signal to the compiler indicating that the data here might *not* +/// `MaybeUninit` serves to enable unsafe code to deal with uninitialized data. +/// It is a signal to the compiler indicating that the data here might *not* /// be initialized: /// /// ```rust @@ -1092,11 +1102,11 @@ impl DerefMut for ManuallyDrop { /// let x = unsafe { x.into_initialized() }; /// ``` /// -/// The compiler then knows to not optimize this code. +/// The compiler then knows to not make any incorrect assumptions or optimizations on this code. // FIXME before stabilizing, explain how to initialize a struct field-by-field. #[allow(missing_debug_implementations)] #[unstable(feature = "maybe_uninit", issue = "53491")] -// NOTE after stabilizing `MaybeUninit` proceed to deprecate `mem::{uninitialized,zeroed}` +// NOTE after stabilizing `MaybeUninit` proceed to deprecate `mem::uninitialized` pub union MaybeUninit { uninit: (), value: ManuallyDrop, @@ -1154,7 +1164,7 @@ impl MaybeUninit { } /// Gets a pointer to the contained value. Reading from this pointer or turning it - /// into a reference will be undefined behavior unless the `MaybeUninit` is initialized. + /// into a reference is undefined behavior unless the `MaybeUninit` is initialized. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub fn as_ptr(&self) -> *const T { @@ -1162,7 +1172,7 @@ impl MaybeUninit { } /// Gets a mutable pointer to the contained value. Reading from this pointer or turning it - /// into a reference will be undefined behavior unless the `MaybeUninit` is initialized. + /// into a reference is undefined behavior unless the `MaybeUninit` is initialized. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub fn as_mut_ptr(&mut self) -> *mut T { From 48aa59e74d6a2b3fea5162eaed902798dc0f95f8 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 22 Feb 2019 22:23:31 +0100 Subject: [PATCH 020/381] examples for as[_mut]_ptr --- src/libcore/mem.rs | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 556f8a9e8a2a..d586f45534ea 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1165,6 +1165,32 @@ impl MaybeUninit { /// Gets a pointer to the contained value. Reading from this pointer or turning it /// into a reference is undefined behavior unless the `MaybeUninit` is initialized. + /// + /// # Examples + /// + /// Correct usage of this method: + /// + /// ```rust + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let mut x = MaybeUninit::>::uninitialized(); + /// x.set(vec![0,1,2]); + /// // Create a reference into the `MaybeUninit`. This is okay because we initialized it. + /// let x_vec = unsafe { &*x.as_ptr() }; + /// assert_eq!(x_vec.len(), 3); + /// ``` + /// + /// *Incorrect* usage of this method: + /// + /// ```rust,no_run + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let x = MaybeUninit::>::uninitialized(); + /// let x_vec = unsafe { &*x.as_ptr() }; + /// // We have created a reference to an uninitialized vector! This is undefined behavior. + /// ``` #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub fn as_ptr(&self) -> *const T { @@ -1173,6 +1199,33 @@ impl MaybeUninit { /// Gets a mutable pointer to the contained value. Reading from this pointer or turning it /// into a reference is undefined behavior unless the `MaybeUninit` is initialized. + /// + /// # Examples + /// + /// Correct usage of this method: + /// + /// ```rust + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let mut x = MaybeUninit::>::uninitialized(); + /// x.set(vec![0,1,2]); + /// // Create a reference into the `MaybeUninit`. This is okay because we initialized it. + /// let x_vec = unsafe { &mut *x.as_mut_ptr() }; + /// x_vec.push(3); + /// assert_eq!(x_vec.len(), 4); + /// ``` + /// + /// *Incorrect* usage of this method: + /// + /// ```rust,no_run + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let mut x = MaybeUninit::>::uninitialized(); + /// let x_vec = unsafe { &mut *x.as_mut_ptr() }; + /// // We have created a reference to an uninitialized vector! This is undefined behavior. + /// ``` #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub fn as_mut_ptr(&mut self) -> *mut T { From 084ee7a875cb02c0f0c0c6d1ffaff81d69cec74e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 22 Feb 2019 22:35:18 +0100 Subject: [PATCH 021/381] examples for MaybeUninit::zeroed --- src/libcore/mem.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index d586f45534ea..8f6798e0f6e6 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1141,6 +1141,35 @@ impl MaybeUninit { /// /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. /// It is your responsibility to make sure `T` gets dropped if it got initialized. + /// + /// # Example + /// + /// Correct usage of this method: initializing a struct with zero, where all + /// fields of the struct can hold 0 as a valid value. + /// + /// ```rust + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let x = MaybeUninit::<(u8, bool)>::zeroed(); + /// let x = unsafe { x.into_initialized() }; + /// assert_eq!(x, (0, false)); + /// ``` + /// + /// *Incorrect* usage of this method: initializing a struct with zero, where some fields + /// cannot hold 0 as a valid value. + /// + /// ```rust,no_run + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// enum NotZero { One = 1, Two = 2 }; + /// + /// let x = MaybeUninit::<(u8, NotZero)>::zeroed(); + /// let x = unsafe { x.into_initialized() }; + /// // We create a `NotZero` (inside a pair) that does not have a valid discriminant. + /// // This is undefined behavior. + /// ``` #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline] pub fn zeroed() -> MaybeUninit { From d10366fe27bf1a1e6ab67076bdc268f486abeb88 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 22 Feb 2019 22:47:30 +0100 Subject: [PATCH 022/381] avoid unnecessary use of MaybeUninit::get_ref, and expand comment on the others --- src/libcore/fmt/float.rs | 4 ++++ src/libcore/ptr.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 20c626cef1b1..edeb65afd67b 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -15,6 +15,7 @@ fn float_to_decimal_common_exact(fmt: &mut Formatter, num: &T, // FIXME(#53491): Technically, this is calling `get_mut` on an uninitialized // `MaybeUninit` (here and elsewhere in this file). Revisit this once // we decided whether that is valid or not. + // Using `freeze` is *not enough*; `flt2dec::Part` is an enum! let formatted = flt2dec::to_exact_fixed_str(flt2dec::strategy::grisu::format_exact, *num, sign, precision, false, buf.get_mut(), parts.get_mut()); @@ -33,6 +34,7 @@ fn float_to_decimal_common_shortest(fmt: &mut Formatter, num: &T, // enough for f32 and f64 let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninitialized(); let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninitialized(); + // FIXME(#53491) let formatted = flt2dec::to_shortest_str(flt2dec::strategy::grisu::format_shortest, *num, sign, precision, false, buf.get_mut(), parts.get_mut()); @@ -71,6 +73,7 @@ fn float_to_exponential_common_exact(fmt: &mut Formatter, num: &T, unsafe { let mut buf = MaybeUninit::<[u8; 1024]>::uninitialized(); // enough for f32 and f64 let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninitialized(); + // FIXME(#53491) let formatted = flt2dec::to_exact_exp_str(flt2dec::strategy::grisu::format_exact, *num, sign, precision, upper, buf.get_mut(), parts.get_mut()); @@ -90,6 +93,7 @@ fn float_to_exponential_common_shortest(fmt: &mut Formatter, // enough for f32 and f64 let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninitialized(); let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninitialized(); + // FIXME(#53491) let formatted = flt2dec::to_shortest_exp_str(flt2dec::strategy::grisu::format_shortest, *num, sign, (0, 0), upper, buf.get_mut(), parts.get_mut()); diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 866c8d0896b3..a2599ae834c6 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -301,7 +301,7 @@ pub unsafe fn swap(x: *mut T, y: *mut T) { // Perform the swap copy_nonoverlapping(x, tmp.as_mut_ptr(), 1); copy(y, x, 1); // `x` and `y` may overlap - copy_nonoverlapping(tmp.get_ref(), y, 1); + copy_nonoverlapping(tmp.as_ptr(), y, 1); } /// Swaps `count * size_of::()` bytes between the two regions of memory From aa4a9b0827f09efa8a06d99df6cae07b21e6729c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 22 Feb 2019 22:58:53 +0100 Subject: [PATCH 023/381] make MaybeUninit Copy --- src/libcore/mem.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 8f6798e0f6e6..296f15d83030 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1106,12 +1106,22 @@ impl DerefMut for ManuallyDrop { // FIXME before stabilizing, explain how to initialize a struct field-by-field. #[allow(missing_debug_implementations)] #[unstable(feature = "maybe_uninit", issue = "53491")] +#[derive(Copy)] // NOTE after stabilizing `MaybeUninit` proceed to deprecate `mem::uninitialized` pub union MaybeUninit { uninit: (), value: ManuallyDrop, } +#[unstable(feature = "maybe_uninit", issue = "53491")] +impl Clone for MaybeUninit { + #[inline(always)] + fn clone(&self) -> Self { + // Not calling T::clone(), we cannot know if we are initialized enough for that. + *self + } +} + impl MaybeUninit { /// Create a new `MaybeUninit` initialized with the given value. /// From 61097bce0dd4d394129ba15d2bbd41ec2dc526ef Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Wed, 7 Nov 2018 22:45:21 +0100 Subject: [PATCH 024/381] Add debug-info to access variables from generator state --- src/librustc_codegen_ssa/mir/mod.rs | 35 +++++++++++++++++++++++++---- src/test/debuginfo/generators.rs | 10 +++++++-- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index c7e2131eed5d..ce342320af92 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -607,15 +607,42 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( }; let upvar_tys = upvar_substs.upvar_tys(def_id, tcx); - for (i, (decl, ty)) in mir.upvar_decls.iter().zip(upvar_tys).enumerate() { - let byte_offset_of_var_in_env = closure_layout.fields.offset(i).bytes(); + let extra_locals = { + let upvars = mir.upvar_decls + .iter() + .zip(upvar_tys) + .enumerate() + .map(|(i, (decl, ty))| (i, decl.debug_name, decl.by_ref, ty)); + + let generator_fields = mir.generator_layout.as_ref().map(|generator_layout| { + let (def_id, gen_substs) = match closure_layout.ty.sty { + ty::Generator(def_id, substs, _) => (def_id, substs), + _ => bug!("generator layout without generator substs"), + }; + let state_tys = gen_substs.state_tys(def_id, tcx); + + let upvar_count = mir.upvar_decls.len(); + generator_layout.fields + .iter() + .zip(state_tys) + .enumerate() + .filter_map(move |(i, (decl, ty))| { + decl.name.map(|name| (i + upvar_count + 1, name, false, ty)) + }) + }).into_iter().flatten(); + + upvars.chain(generator_fields) + }; + + for (field, name, by_ref, ty) in extra_locals { + let byte_offset_of_var_in_env = closure_layout.fields.offset(field).bytes(); let ops = bx.debuginfo_upvar_decls_ops_sequence(byte_offset_of_var_in_env); // The environment and the capture can each be indirect. let mut ops = if env_ref { &ops[..] } else { &ops[1..] }; - let ty = if let (true, &ty::Ref(_, ty, _)) = (decl.by_ref, &ty.sty) { + let ty = if let (true, &ty::Ref(_, ty, _)) = (by_ref, &ty.sty) { ty } else { ops = &ops[..ops.len() - 1]; @@ -628,7 +655,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( }; bx.declare_local( &fx.debug_context, - decl.debug_name, + name, ty, scope, variable_access, diff --git a/src/test/debuginfo/generators.rs b/src/test/debuginfo/generators.rs index b56d222e0e01..35a67217f167 100644 --- a/src/test/debuginfo/generators.rs +++ b/src/test/debuginfo/generators.rs @@ -7,6 +7,8 @@ // gdb-command:run // gdb-command:print a // gdb-check:$1 = 5 +// gdb-command:print d +// gdb-check:$2 = 6 // === LLDB TESTS ================================================================================== @@ -14,8 +16,11 @@ // lldb-command:print a // lldbg-check:(int) $0 = 5 // lldbr-check:(int) a = 5 +// lldb-command:print d +// lldbg-check:(int) $1 = 6 +// lldbr-check:(int) d = 6 -#![feature(omit_gdb_pretty_printer_section, generators, generator_trait, pin)] +#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)] #![omit_gdb_pretty_printer_section] use std::ops::Generator; @@ -24,9 +29,10 @@ use std::pin::Pin; fn main() { let mut a = 5; let mut b = || { + let d = 6; yield; _zzz(); // #break - a = 6; + a = d; }; Pin::new(&mut b).resume(); Pin::new(&mut b).resume(); From 089524c31ac8098965f9ed69d89a5de127b4bbbb Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Wed, 6 Feb 2019 14:20:27 +0100 Subject: [PATCH 025/381] Correct OpenOptions::security_qos_flags documentation --- src/libstd/sys/windows/ext/fs.rs | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/libstd/sys/windows/ext/fs.rs b/src/libstd/sys/windows/ext/fs.rs index 89038da6295f..85967516933a 100644 --- a/src/libstd/sys/windows/ext/fs.rs +++ b/src/libstd/sys/windows/ext/fs.rs @@ -220,13 +220,27 @@ pub trait OpenOptionsExt { /// the specified value (or combines it with `custom_flags` and `attributes` /// to set the `dwFlagsAndAttributes` for [`CreateFile`]). /// - /// By default, `security_qos_flags` is set to `SECURITY_ANONYMOUS`. For - /// information about possible values, see [Impersonation Levels] on the - /// Windows Dev Center site. + /// By default `security_qos_flags` is not set. It should be specified when + /// opening a named pipe, to control to which degree a server process can + /// act on behalf of a client process (security impersonation level). /// + /// When `security_qos_flags` is not set a malicious program can gain the + /// elevated privileges of a privileged Rust process when it allows opening + /// user-specified paths, by tricking it into opening a named pipe. So + /// arguably `security_qos_flags` should also be set when opening arbitrary + /// paths. However the bits can then conflict with other flags, specifically + /// `FILE_FLAG_OPEN_NO_RECALL`. + /// + /// For information about possible values, see [Impersonation Levels] on the + /// Windows Dev Center site. The `SECURITY_SQOS_PRESENT` flag is set + /// automatically when using this method. + /// # Examples /// /// ```no_run + /// # #[cfg(for_demonstration_only)] + /// extern crate winapi; + /// # mod winapi { pub const SECURITY_IDENTIFICATION: u32 = 0; } /// use std::fs::OpenOptions; /// use std::os::windows::prelude::*; /// @@ -235,9 +249,9 @@ pub trait OpenOptionsExt { /// .create(true) /// /// // Sets the flag value to `SecurityIdentification`. - /// .security_qos_flags(1) + /// .security_qos_flags(winapi::SECURITY_IDENTIFICATION) /// - /// .open("foo.txt"); + /// .open(r"\\.\pipe\MyPipe"); /// ``` /// /// [`CreateFile`]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx From 7d01aa8a4815207d83664353895ac168b7564e4b Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Sat, 23 Feb 2019 14:25:03 +0000 Subject: [PATCH 026/381] Type check coercions to pointer types --- src/librustc/ich/impls_mir.rs | 1 + src/librustc/mir/mod.rs | 3 + src/librustc/ty/context.rs | 20 ++-- src/librustc_codegen_ssa/mir/rvalue.rs | 6 +- .../borrow_check/nll/type_check/mod.rs | 113 +++++++++++++++++- src/librustc_mir/build/expr/as_place.rs | 1 + src/librustc_mir/build/expr/as_rvalue.rs | 6 +- src/librustc_mir/build/expr/category.rs | 1 + src/librustc_mir/build/expr/into.rs | 1 + src/librustc_mir/hair/cx/expr.rs | 2 +- src/librustc_mir/hair/mod.rs | 3 + src/librustc_mir/interpret/cast.rs | 2 +- src/librustc_mir/transform/qualify_consts.rs | 1 + .../transform/qualify_min_const_fn.rs | 3 + .../ui/nll/type-check-pointer-coercions.rs | 39 ++++++ .../nll/type-check-pointer-coercions.stderr | 87 ++++++++++++++ 16 files changed, 274 insertions(+), 15 deletions(-) create mode 100644 src/test/ui/nll/type-check-pointer-coercions.rs create mode 100644 src/test/ui/nll/type-check-pointer-coercions.stderr diff --git a/src/librustc/ich/impls_mir.rs b/src/librustc/ich/impls_mir.rs index 51fc78ffc866..69a1e2d8a1ef 100644 --- a/src/librustc/ich/impls_mir.rs +++ b/src/librustc/ich/impls_mir.rs @@ -373,6 +373,7 @@ impl_stable_hash_for!(enum mir::CastKind { ReifyFnPointer, ClosureFnPointer, UnsafeFnPointer, + MutToConstPointer, Unsize }); diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 3513d652b534..5d596f81099f 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -2220,6 +2220,9 @@ pub enum CastKind { /// Converts safe fn() to unsafe fn() UnsafeFnPointer, + /// Coerces *mut T to *const T, preserving T. + MutToConstPointer, + /// "Unsize" -- convert a thin-or-fat pointer to a fat pointer. /// codegen must figure out the details once full monomorphization /// is known. For example, this could be used to cast from a diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 6bb322251256..02a7be121cca 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -59,7 +59,6 @@ use std::hash::{Hash, Hasher}; use std::fmt; use std::mem; use std::ops::{Deref, Bound}; -use std::ptr; use std::iter; use std::sync::mpsc; use std::sync::Arc; @@ -171,7 +170,7 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> { // Make sure we don't end up with inference // types/regions in the global interner - if ptr::eq(local, global) { + if ptr_eq(local, global) { bug!("Attempted to intern `{:?}` which contains \ inference types/regions in the global type context", &ty_struct); @@ -1163,7 +1162,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// Returns `true` if self is the same as self.global_tcx(). fn is_global(self) -> bool { - ptr::eq(self.interners, &self.global_interners) + ptr_eq(self.interners, &self.global_interners) } /// Creates a type context and call the closure with a `TyCtxt` reference @@ -1819,12 +1818,11 @@ impl<'a, 'tcx> Lift<'tcx> for &'a mir::interpret::Allocation { } pub mod tls { - use super::{GlobalCtxt, TyCtxt}; + use super::{GlobalCtxt, TyCtxt, ptr_eq}; use std::fmt; use std::mem; use std::marker::PhantomData; - use std::ptr; use syntax_pos; use crate::ty::query; use errors::{Diagnostic, TRACK_DIAGNOSTICS}; @@ -2067,7 +2065,7 @@ pub mod tls { { with_context(|context| { unsafe { - assert!(ptr::eq(context.tcx.gcx, tcx.gcx)); + assert!(ptr_eq(context.tcx.gcx, tcx.gcx)); let context: &ImplicitCtxt<'_, '_, '_> = mem::transmute(context); f(context) } @@ -2085,8 +2083,8 @@ pub mod tls { { with_context(|context| { unsafe { - assert!(ptr::eq(context.tcx.gcx, tcx.gcx)); - assert!(ptr::eq(context.tcx.interners, tcx.interners)); + assert!(ptr_eq(context.tcx.gcx, tcx.gcx)); + assert!(ptr_eq(context.tcx.interners, tcx.interners)); let context: &ImplicitCtxt<'_, '_, '_> = mem::transmute(context); f(context) } @@ -2993,6 +2991,12 @@ impl InternIteratorElement for Result { } } +// We are comparing types with different invariant lifetimes, so `ptr::eq` +// won't work for us. +fn ptr_eq(t: *const T, u: *const U) -> bool { + t as *const () == u as *const () +} + pub fn provide(providers: &mut ty::query::Providers<'_>) { providers.in_scope_traits_map = |tcx, id| tcx.gcx.trait_map.get(&id).cloned(); providers.module_exports = |tcx, id| tcx.gcx.export_map.get(&id).cloned(); diff --git a/src/librustc_codegen_ssa/mir/rvalue.rs b/src/librustc_codegen_ssa/mir/rvalue.rs index 25a7754d118d..c8b7216e2977 100644 --- a/src/librustc_codegen_ssa/mir/rvalue.rs +++ b/src/librustc_codegen_ssa/mir/rvalue.rs @@ -257,7 +257,8 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } } } - mir::CastKind::Misc if bx.cx().is_backend_scalar_pair(operand.layout) => { + mir::CastKind::MutToConstPointer + | mir::CastKind::Misc if bx.cx().is_backend_scalar_pair(operand.layout) => { if let OperandValue::Pair(data_ptr, meta) = operand.val { if bx.cx().is_backend_scalar_pair(cast) { let data_cast = bx.pointercast(data_ptr, @@ -274,7 +275,8 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bug!("Unexpected non-Pair operand") } } - mir::CastKind::Misc => { + mir::CastKind::MutToConstPointer + | mir::CastKind::Misc => { assert!(bx.cx().is_backend_immediate(cast)); let ll_t_out = bx.cx().immediate_backend_type(cast); if operand.layout.abi.is_uninhabited() { diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 49f90eb90aaf..6b948e40bfbb 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -1984,7 +1984,118 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { ); } - CastKind::Misc => {} + CastKind::MutToConstPointer => { + let ty_from = match op.ty(mir, tcx).sty { + ty::RawPtr(ty::TypeAndMut { + ty: ty_from, + mutbl: hir::MutMutable, + }) => ty_from, + _ => { + span_mirbug!( + self, + rvalue, + "unexpected base type for cast {:?}", + ty, + ); + return; + } + }; + let ty_to = match ty.sty { + ty::RawPtr(ty::TypeAndMut { + ty: ty_to, + mutbl: hir::MutImmutable, + }) => ty_to, + _ => { + span_mirbug!( + self, + rvalue, + "unexpected target type for cast {:?}", + ty, + ); + return; + } + }; + if let Err(terr) = self.sub_types( + ty_from, + ty_to, + location.to_locations(), + ConstraintCategory::Cast, + ) { + span_mirbug!( + self, + rvalue, + "relating {:?} with {:?} yields {:?}", + ty_from, + ty_to, + terr + ) + } + } + + CastKind::Misc => { + if let ty::Ref(_, mut ty_from, _) = op.ty(mir, tcx).sty { + let (mut ty_to, mutability) = if let ty::RawPtr(ty::TypeAndMut { + ty: ty_to, + mutbl, + }) = ty.sty { + (ty_to, mutbl) + } else { + span_mirbug!( + self, + rvalue, + "invalid cast types {:?} -> {:?}", + op.ty(mir, tcx), + ty, + ); + return; + }; + + // Handle the direct cast from `&[T; N]` to `*const T` by unwrapping + // any array we find. + while let ty::Array(ty_elem_from, _) = ty_from.sty { + ty_from = ty_elem_from; + if let ty::Array(ty_elem_to, _) = ty_to.sty { + ty_to = ty_elem_to; + } else { + break; + } + } + + if let hir::MutMutable = mutability { + if let Err(terr) = self.eq_types( + ty_from, + ty_to, + location.to_locations(), + ConstraintCategory::Cast, + ) { + span_mirbug!( + self, + rvalue, + "equating {:?} with {:?} yields {:?}", + ty_from, + ty_to, + terr + ) + } + } else { + if let Err(terr) = self.sub_types( + ty_from, + ty_to, + location.to_locations(), + ConstraintCategory::Cast, + ) { + span_mirbug!( + self, + rvalue, + "relating {:?} with {:?} yields {:?}", + ty_from, + ty_to, + terr + ) + } + } + } + } } } diff --git a/src/librustc_mir/build/expr/as_place.rs b/src/librustc_mir/build/expr/as_place.rs index ed444191226a..7f30d9f92514 100644 --- a/src/librustc_mir/build/expr/as_place.rs +++ b/src/librustc_mir/build/expr/as_place.rs @@ -196,6 +196,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { | ExprKind::ReifyFnPointer { .. } | ExprKind::ClosureFnPointer { .. } | ExprKind::UnsafeFnPointer { .. } + | ExprKind::MutToConstPointer { .. } | ExprKind::Unsize { .. } | ExprKind::Repeat { .. } | ExprKind::Borrow { .. } diff --git a/src/librustc_mir/build/expr/as_rvalue.rs b/src/librustc_mir/build/expr/as_rvalue.rs index 88dbd93939e5..6fa7393ee53e 100644 --- a/src/librustc_mir/build/expr/as_rvalue.rs +++ b/src/librustc_mir/build/expr/as_rvalue.rs @@ -142,8 +142,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { block.and(Rvalue::Use(Operand::Move(Place::Local(result)))) } ExprKind::Cast { source } => { - let source = this.hir.mirror(source); - let source = unpack!(block = this.as_operand(block, scope, source)); block.and(Rvalue::Cast(CastKind::Misc, source, expr.ty)) } @@ -163,6 +161,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let source = unpack!(block = this.as_operand(block, scope, source)); block.and(Rvalue::Cast(CastKind::ClosureFnPointer, source, expr.ty)) } + ExprKind::MutToConstPointer { source } => { + let source = unpack!(block = this.as_operand(block, scope, source)); + block.and(Rvalue::Cast(CastKind::MutToConstPointer, source, expr.ty)) + } ExprKind::Unsize { source } => { let source = unpack!(block = this.as_operand(block, scope, source)); block.and(Rvalue::Cast(CastKind::Unsize, source, expr.ty)) diff --git a/src/librustc_mir/build/expr/category.rs b/src/librustc_mir/build/expr/category.rs index ca7d435e6222..c8c30ac3ce4d 100644 --- a/src/librustc_mir/build/expr/category.rs +++ b/src/librustc_mir/build/expr/category.rs @@ -62,6 +62,7 @@ impl Category { | ExprKind::ReifyFnPointer { .. } | ExprKind::ClosureFnPointer { .. } | ExprKind::UnsafeFnPointer { .. } + | ExprKind::MutToConstPointer { .. } | ExprKind::Unsize { .. } | ExprKind::Repeat { .. } | ExprKind::Borrow { .. } diff --git a/src/librustc_mir/build/expr/into.rs b/src/librustc_mir/build/expr/into.rs index 05231bc7b3f1..ed27fc38c2a0 100644 --- a/src/librustc_mir/build/expr/into.rs +++ b/src/librustc_mir/build/expr/into.rs @@ -383,6 +383,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { | ExprKind::ReifyFnPointer { .. } | ExprKind::ClosureFnPointer { .. } | ExprKind::UnsafeFnPointer { .. } + | ExprKind::MutToConstPointer { .. } | ExprKind::Unsize { .. } | ExprKind::Repeat { .. } | ExprKind::Borrow { .. } diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 10d04a80d734..a08be74afbe8 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -88,7 +88,7 @@ fn apply_adjustment<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ExprKind::NeverToAny { source: expr.to_ref() } } Adjust::MutToConstPointer => { - ExprKind::Cast { source: expr.to_ref() } + ExprKind::MutToConstPointer { source: expr.to_ref() } } Adjust::Deref(None) => { // Adjust the span from the block, to the last expression of the diff --git a/src/librustc_mir/hair/mod.rs b/src/librustc_mir/hair/mod.rs index e615b009cf37..966549b42fa9 100644 --- a/src/librustc_mir/hair/mod.rs +++ b/src/librustc_mir/hair/mod.rs @@ -190,6 +190,9 @@ pub enum ExprKind<'tcx> { UnsafeFnPointer { source: ExprRef<'tcx>, }, + MutToConstPointer { + source: ExprRef<'tcx>, + }, Unsize { source: ExprRef<'tcx>, }, diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs index ce62d79e585a..73c73cc23dcf 100644 --- a/src/librustc_mir/interpret/cast.rs +++ b/src/librustc_mir/interpret/cast.rs @@ -33,7 +33,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> self.unsize_into(src, dest)?; } - Misc => { + Misc | MutToConstPointer => { let src = self.read_immediate(src)?; if self.type_is_fat_ptr(src.layout.ty) { diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 285c674643f2..fb4c64bd5f55 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -1091,6 +1091,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { Rvalue::Cast(CastKind::UnsafeFnPointer, ..) | Rvalue::Cast(CastKind::ClosureFnPointer, ..) | Rvalue::Cast(CastKind::Unsize, ..) | + Rvalue::Cast(CastKind::MutToConstPointer, ..) | Rvalue::Discriminant(..) | Rvalue::Len(_) | Rvalue::Ref(..) | diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 34f850fc4aad..d0d627549930 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -152,6 +152,9 @@ fn check_rvalue( _ => check_operand(tcx, mir, operand, span), } } + Rvalue::Cast(CastKind::MutToConstPointer, operand, _) => { + check_operand(tcx, mir, operand, span) + } Rvalue::Cast(CastKind::UnsafeFnPointer, _, _) | Rvalue::Cast(CastKind::ClosureFnPointer, _, _) | Rvalue::Cast(CastKind::ReifyFnPointer, _, _) => Err(( diff --git a/src/test/ui/nll/type-check-pointer-coercions.rs b/src/test/ui/nll/type-check-pointer-coercions.rs new file mode 100644 index 000000000000..b6a25eddb866 --- /dev/null +++ b/src/test/ui/nll/type-check-pointer-coercions.rs @@ -0,0 +1,39 @@ +#![feature(nll)] + +fn shared_to_const<'a, 'b>(x: &&'a i32) -> *const &'b i32 { + x //~ ERROR +} + +fn unique_to_const<'a, 'b>(x: &mut &'a i32) -> *const &'b i32 { + x //~ ERROR +} + +fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 { + // Two errors because *mut is invariant + x //~ ERROR + //~| ERROR +} + +fn mut_to_const<'a, 'b>(x: *mut &'a i32) -> *const &'b i32 { + x //~ ERROR +} + +fn array_elem<'a, 'b>(x: &'a i32) -> *const &'b i32 { + let z = &[x; 3]; + let y = z as *const &i32; + y //~ ERROR +} + +fn array_coerce<'a, 'b>(x: &'a i32) -> *const [&'b i32; 3] { + let z = &[x; 3]; + let y = z as *const [&i32; 3]; + y //~ ERROR +} + +fn nested_array<'a, 'b>(x: &'a i32) -> *const [&'b i32; 2] { + let z = &[[x; 2]; 3]; + let y = z as *const [&i32; 2]; + y //~ ERROR +} + +fn main() {} diff --git a/src/test/ui/nll/type-check-pointer-coercions.stderr b/src/test/ui/nll/type-check-pointer-coercions.stderr new file mode 100644 index 000000000000..3b8d99421242 --- /dev/null +++ b/src/test/ui/nll/type-check-pointer-coercions.stderr @@ -0,0 +1,87 @@ +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:4:5 + | +LL | fn shared_to_const<'a, 'b>(x: &&'a i32) -> *const &'b i32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x //~ ERROR + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:8:5 + | +LL | fn unique_to_const<'a, 'b>(x: &mut &'a i32) -> *const &'b i32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x //~ ERROR + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:13:5 + | +LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | // Two errors because *mut is invariant +LL | x //~ ERROR + | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:13:5 + | +LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | // Two errors because *mut is invariant +LL | x //~ ERROR + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:18:5 + | +LL | fn mut_to_const<'a, 'b>(x: *mut &'a i32) -> *const &'b i32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x //~ ERROR + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:24:5 + | +LL | fn array_elem<'a, 'b>(x: &'a i32) -> *const &'b i32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | y //~ ERROR + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:30:5 + | +LL | fn array_coerce<'a, 'b>(x: &'a i32) -> *const [&'b i32; 3] { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | y //~ ERROR + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:36:5 + | +LL | fn nested_array<'a, 'b>(x: &'a i32) -> *const [&'b i32; 2] { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | y //~ ERROR + | ^ returning this value requires that `'a` must outlive `'b` + +error: aborting due to 8 previous errors + From 53c027588263abf69bf0124f15eb6d261cd43316 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sat, 23 Feb 2019 16:17:07 +0100 Subject: [PATCH 027/381] Apply suggestions from code review Co-Authored-By: RalfJung --- src/libcore/mem.rs | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 296f15d83030..46ba523c7722 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1064,13 +1064,13 @@ impl DerefMut for ManuallyDrop { /// use std::mem::{self, MaybeUninit}; /// /// let b: bool = unsafe { mem::uninitialized() }; // undefined behavior! -/// // equivalent code with `MaybeUninit` +/// // The equivalent code with `MaybeUninit`: /// let b: bool = unsafe { MaybeUninit::uninitialized().into_initialized() }; // undefined behavior! /// ``` /// /// Moreover, uninitialized memory is special in that the compiler knows that /// it does not have a fixed value. This makes it undefined behavior to have -/// uninitialized data in a variable even if that variable has integer type, +/// uninitialized data in a variable even if that variable has an integer type, /// which otherwise can hold any bit pattern: /// /// ```rust,no_run @@ -1084,7 +1084,7 @@ impl DerefMut for ManuallyDrop { /// (Notice that the rules around uninitialized integers are not finalized yet, but /// until they are, it is advisable to avoid them.) /// -/// `MaybeUninit` serves to enable unsafe code to deal with uninitialized data. +/// `MaybeUninit` serves to enable unsafe code to deal with uninitialized data. /// It is a signal to the compiler indicating that the data here might *not* /// be initialized: /// @@ -1107,7 +1107,7 @@ impl DerefMut for ManuallyDrop { #[allow(missing_debug_implementations)] #[unstable(feature = "maybe_uninit", issue = "53491")] #[derive(Copy)] -// NOTE after stabilizing `MaybeUninit` proceed to deprecate `mem::uninitialized` +// NOTE after stabilizing `MaybeUninit` proceed to deprecate `mem::uninitialized`. pub union MaybeUninit { uninit: (), value: ManuallyDrop, @@ -1123,7 +1123,7 @@ impl Clone for MaybeUninit { } impl MaybeUninit { - /// Create a new `MaybeUninit` initialized with the given value. + /// Create a new `MaybeUninit` initialized with the given value. /// /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. /// It is your responsibility to make sure `T` gets dropped if it got initialized. @@ -1149,13 +1149,13 @@ impl MaybeUninit { /// but `MaybeUninit<&'static i32>::zeroed()` is not because references must not /// be null. /// - /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. + /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. /// It is your responsibility to make sure `T` gets dropped if it got initialized. /// /// # Example /// - /// Correct usage of this method: initializing a struct with zero, where all - /// fields of the struct can hold 0 as a valid value. + /// Correct usage of this function: initializing a struct with zero, where all + /// fields of the struct can hold the bit-pattern 0 as a valid value. /// /// ```rust /// #![feature(maybe_uninit)] @@ -1166,7 +1166,7 @@ impl MaybeUninit { /// assert_eq!(x, (0, false)); /// ``` /// - /// *Incorrect* usage of this method: initializing a struct with zero, where some fields + /// *Incorrect* usage of this function: initializing a struct with zero, where some fields /// cannot hold 0 as a valid value. /// /// ```rust,no_run @@ -1177,7 +1177,7 @@ impl MaybeUninit { /// /// let x = MaybeUninit::<(u8, NotZero)>::zeroed(); /// let x = unsafe { x.into_initialized() }; - /// // We create a `NotZero` (inside a pair) that does not have a valid discriminant. + /// // Inside a pair, we create a `NotZero` that does not have a valid discriminant. /// // This is undefined behavior. /// ``` #[unstable(feature = "maybe_uninit", issue = "53491")] @@ -1203,7 +1203,7 @@ impl MaybeUninit { } /// Gets a pointer to the contained value. Reading from this pointer or turning it - /// into a reference is undefined behavior unless the `MaybeUninit` is initialized. + /// into a reference is undefined behavior unless the `MaybeUninit` is initialized. /// /// # Examples /// @@ -1237,7 +1237,7 @@ impl MaybeUninit { } /// Gets a mutable pointer to the contained value. Reading from this pointer or turning it - /// into a reference is undefined behavior unless the `MaybeUninit` is initialized. + /// into a reference is undefined behavior unless the `MaybeUninit` is initialized. /// /// # Examples /// @@ -1249,7 +1249,8 @@ impl MaybeUninit { /// /// let mut x = MaybeUninit::>::uninitialized(); /// x.set(vec![0,1,2]); - /// // Create a reference into the `MaybeUninit`. This is okay because we initialized it. + /// // Create a reference into the `MaybeUninit>`. + /// // This is okay because we initialized it. /// let x_vec = unsafe { &mut *x.as_mut_ptr() }; /// x_vec.push(3); /// assert_eq!(x_vec.len(), 4); @@ -1303,7 +1304,7 @@ impl MaybeUninit { /// /// let x = MaybeUninit::>::uninitialized(); /// let x_init = unsafe { x.into_initialized() }; - /// // `x` had not been initialized yet, so this last line causes undefined behavior. + /// // `x` had not been initialized yet, so this last line caused undefined behavior. /// ``` #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] @@ -1312,16 +1313,16 @@ impl MaybeUninit { ManuallyDrop::into_inner(self.value) } - /// Reads the value from the `MaybeUninit` container. The resulting `T` is subject + /// Reads the value from the `MaybeUninit` container. The resulting `T` is subject /// to the usual drop handling. /// - /// # Unsafety + /// # Safety /// - /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized + /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized /// state. Calling this when the content is not yet fully initialized causes undefined /// behavior. /// - /// Moreover, this leaves a copy of the same data behind in the `MaybeUninit`. When using + /// Moreover, this leaves a copy of the same data behind in the `MaybeUninit`. When using /// multiple copies of the data (by calling `read_initialized` multiple times, or first /// calling `read_initialized` and then [`into_initialized`]), it is your responsibility /// to ensure that that data may indeed be duplicated. From ac2284b80b5bf50702af2289c2ac4f04efa573ec Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 23 Feb 2019 16:18:50 +0100 Subject: [PATCH 028/381] expand type name --- src/libcore/mem.rs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 46ba523c7722..b354815a3a14 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1035,7 +1035,7 @@ impl DerefMut for ManuallyDrop { } } -/// A newtype to construct uninitialized instances of `T`. +/// A wrapper to construct uninitialized instances of `T`. /// /// The compiler, in general, assumes that variables are properly initialized /// at their respective type. For example, a variable of reference type must @@ -1049,7 +1049,7 @@ impl DerefMut for ManuallyDrop { /// use std::mem::{self, MaybeUninit}; /// /// let x: &i32 = unsafe { mem::zeroed() }; // undefined behavior! -/// // equivalent code with `MaybeUninit` +/// // equivalent code with `MaybeUninit<&i32>` /// let x: &i32 = unsafe { MaybeUninit::zeroed().into_initialized() }; // undefined behavior! /// ``` /// @@ -1064,7 +1064,7 @@ impl DerefMut for ManuallyDrop { /// use std::mem::{self, MaybeUninit}; /// /// let b: bool = unsafe { mem::uninitialized() }; // undefined behavior! -/// // The equivalent code with `MaybeUninit`: +/// // The equivalent code with `MaybeUninit`: /// let b: bool = unsafe { MaybeUninit::uninitialized().into_initialized() }; // undefined behavior! /// ``` /// @@ -1078,7 +1078,7 @@ impl DerefMut for ManuallyDrop { /// use std::mem::{self, MaybeUninit}; /// /// let x: i32 = unsafe { mem::uninitialized() }; // undefined behavior! -/// // equivalent code with `MaybeUninit` +/// // equivalent code with `MaybeUninit` /// let x: i32 = unsafe { MaybeUninit::uninitialized().into_initialized() }; // undefined behavior! /// ``` /// (Notice that the rules around uninitialized integers are not finalized yet, but @@ -1093,7 +1093,7 @@ impl DerefMut for ManuallyDrop { /// use std::mem::MaybeUninit; /// /// // Create an explicitly uninitialized reference. The compiler knows that data inside -/// // a `MaybeUninit` may be invalid, and hence this is not UB: +/// // a `MaybeUninit` may be invalid, and hence this is not UB: /// let mut x = MaybeUninit::<&i32>::uninitialized(); /// // Set it to a valid value. /// x.set(&0); @@ -1125,7 +1125,7 @@ impl Clone for MaybeUninit { impl MaybeUninit { /// Create a new `MaybeUninit` initialized with the given value. /// - /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. + /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. /// It is your responsibility to make sure `T` gets dropped if it got initialized. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] @@ -1133,9 +1133,9 @@ impl MaybeUninit { MaybeUninit { value: ManuallyDrop::new(val) } } - /// Creates a new `MaybeUninit` in an uninitialized state. + /// Creates a new `MaybeUninit` in an uninitialized state. /// - /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. + /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. /// It is your responsibility to make sure `T` gets dropped if it got initialized. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] @@ -1143,7 +1143,7 @@ impl MaybeUninit { MaybeUninit { uninit: () } } - /// Creates a new `MaybeUninit` in an uninitialized state, with the memory being + /// Creates a new `MaybeUninit` in an uninitialized state, with the memory being /// filled with `0` bytes. It depends on `T` whether that already makes for /// proper initialization. For example, `MaybeUninit::zeroed()` is initialized, /// but `MaybeUninit<&'static i32>::zeroed()` is not because references must not @@ -1190,9 +1190,9 @@ impl MaybeUninit { u } - /// Sets the value of the `MaybeUninit`. This overwrites any previous value without dropping it. - /// For your convenience, this also returns a mutable reference to the (now safely initialized) - /// contents of `self`. + /// Sets the value of the `MaybeUninit`. This overwrites any previous value + /// without dropping it. For your convenience, this also returns a mutable + /// reference to the (now safely initialized) contents of `self`. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub fn set(&mut self, val: T) -> &mut T { @@ -1215,7 +1215,7 @@ impl MaybeUninit { /// /// let mut x = MaybeUninit::>::uninitialized(); /// x.set(vec![0,1,2]); - /// // Create a reference into the `MaybeUninit`. This is okay because we initialized it. + /// // Create a reference into the `MaybeUninit`. This is okay because we initialized it. /// let x_vec = unsafe { &*x.as_ptr() }; /// assert_eq!(x_vec.len(), 3); /// ``` @@ -1272,13 +1272,13 @@ impl MaybeUninit { unsafe { &mut *self.value as *mut T } } - /// Extracts the value from the `MaybeUninit` container. This is a great way + /// Extracts the value from the `MaybeUninit` container. This is a great way /// to ensure that the data will get dropped, because the resulting `T` is /// subject to the usual drop handling. /// /// # Unsafety /// - /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized + /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized /// state. Calling this when the content is not yet fully initialized causes undefined /// behavior. /// @@ -1374,7 +1374,7 @@ impl MaybeUninit { /// /// # Unsafety /// - /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized + /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized /// state. Calling this when the content is not yet fully initialized causes undefined /// behavior. #[unstable(feature = "maybe_uninit_ref", issue = "53491")] @@ -1387,7 +1387,7 @@ impl MaybeUninit { /// /// # Unsafety /// - /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized + /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized /// state. Calling this when the content is not yet fully initialized causes undefined /// behavior. // FIXME(#53491): We currently rely on the above being incorrect, i.e., we have references From 8ce9b8667ac831821729f11b1e7c685af1e9e21c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 23 Feb 2019 16:20:00 +0100 Subject: [PATCH 029/381] fix link --- src/libcore/mem.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index b354815a3a14..30fa904101d2 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1327,6 +1327,8 @@ impl MaybeUninit { /// calling `read_initialized` and then [`into_initialized`]), it is your responsibility /// to ensure that that data may indeed be duplicated. /// + /// [`into_initialized`]: #method.into_initialized + /// /// # Examples /// /// Correct usage of this method: From 890ef48eb93c42e8a6c5535a6aefa02291b93b2d Mon Sep 17 00:00:00 2001 From: varkor Date: Sat, 23 Feb 2019 18:57:25 +0000 Subject: [PATCH 030/381] Fix an indexing error when using `x.py help` --- src/bootstrap/bootstrap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 119b38bcc99d..c98d8b8ecf43 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -830,7 +830,7 @@ def main(): # x.py help ... if len(sys.argv) > 1 and sys.argv[1] == 'help': - sys.argv = sys.argv[:1] + [sys.argv[2], '-h'] + sys.argv[3:] + sys.argv = [sys.argv[0], '-h'] + sys.argv[2:] help_triggered = ( '-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1) From 906ec8acce8126172df758e7e7f400429c3489dc Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Wed, 20 Feb 2019 16:20:01 -0500 Subject: [PATCH 031/381] move collapse and unindent docs passes earlier --- src/librustdoc/passes/collapse_docs.rs | 5 +++-- src/librustdoc/passes/mod.rs | 20 +++++++++---------- src/librustdoc/passes/unindent_comments.rs | 5 +++-- .../rustdoc-ui/intra-links-warning.stderr | 4 ++-- src/test/rustdoc-ui/issue-58473-2.rs | 12 +++++++++++ src/test/rustdoc-ui/issue-58473.rs | 10 ++++++++++ 6 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 src/test/rustdoc-ui/issue-58473-2.rs create mode 100644 src/test/rustdoc-ui/issue-58473.rs diff --git a/src/librustdoc/passes/collapse_docs.rs b/src/librustdoc/passes/collapse_docs.rs index e5e60cbe7170..399f8261d21e 100644 --- a/src/librustdoc/passes/collapse_docs.rs +++ b/src/librustdoc/passes/collapse_docs.rs @@ -1,4 +1,5 @@ use crate::clean::{self, DocFragment, Item}; +use crate::core::DocContext; use crate::fold; use crate::fold::{DocFolder}; use crate::passes::Pass; @@ -6,7 +7,7 @@ use crate::passes::Pass; use std::mem::replace; pub const COLLAPSE_DOCS: Pass = - Pass::late("collapse-docs", collapse_docs, + Pass::early("collapse-docs", collapse_docs, "concatenates all document attributes into one document attribute"); #[derive(Copy, Clone, Debug, PartialEq, Eq)] @@ -26,7 +27,7 @@ impl DocFragment { } } -pub fn collapse_docs(krate: clean::Crate) -> clean::Crate { +pub fn collapse_docs(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { Collapser.fold_crate(krate) } diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index 4d7fef7a76a9..db2bb8984384 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -141,27 +141,27 @@ pub const PASSES: &'static [Pass] = &[ ]; /// The list of passes run by default. -pub const DEFAULT_PASSES: &'static [&'static str] = &[ +pub const DEFAULT_PASSES: &[&str] = &[ "collect-trait-impls", + "collapse-docs", + "unindent-comments", "check-private-items-doc-tests", "strip-hidden", "strip-private", "collect-intra-doc-links", "check-code-block-syntax", - "collapse-docs", - "unindent-comments", "propagate-doc-cfg", ]; /// The list of default passes run with `--document-private-items` is passed to rustdoc. -pub const DEFAULT_PRIVATE_PASSES: &'static [&'static str] = &[ +pub const DEFAULT_PRIVATE_PASSES: &[&str] = &[ "collect-trait-impls", + "collapse-docs", + "unindent-comments", "check-private-items-doc-tests", "strip-priv-imports", "collect-intra-doc-links", "check-code-block-syntax", - "collapse-docs", - "unindent-comments", "propagate-doc-cfg", ]; @@ -438,11 +438,11 @@ crate fn source_span_for_markdown_range( .span_to_snippet(span_of_attrs(attrs)) .ok()?; - let starting_line = markdown[..md_range.start].lines().count() - 1; - let ending_line = markdown[..md_range.end].lines().count() - 1; + let starting_line = markdown[..md_range.start].matches('\n').count(); + let ending_line = starting_line + markdown[md_range.start..md_range.end].matches('\n').count(); - // We use `split_terminator('\n')` instead of `lines()` when counting bytes so that we only - // we can treat CRLF and LF line endings the same way. + // We use `split_terminator('\n')` instead of `lines()` when counting bytes so that we treat + // CRLF and LF line endings the same way. let mut src_lines = snippet.split_terminator('\n'); let md_lines = markdown.split_terminator('\n'); diff --git a/src/librustdoc/passes/unindent_comments.rs b/src/librustdoc/passes/unindent_comments.rs index 269e4cbe65f8..c32c3556a572 100644 --- a/src/librustdoc/passes/unindent_comments.rs +++ b/src/librustdoc/passes/unindent_comments.rs @@ -3,14 +3,15 @@ use std::string::String; use std::usize; use crate::clean::{self, DocFragment, Item}; +use crate::core::DocContext; use crate::fold::{self, DocFolder}; use crate::passes::Pass; pub const UNINDENT_COMMENTS: Pass = - Pass::late("unindent-comments", unindent_comments, + Pass::early("unindent-comments", unindent_comments, "removes excess indentation on comments in order for markdown to like it"); -pub fn unindent_comments(krate: clean::Crate) -> clean::Crate { +pub fn unindent_comments(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { CommentCleaner.fold_crate(krate) } diff --git a/src/test/rustdoc-ui/intra-links-warning.stderr b/src/test/rustdoc-ui/intra-links-warning.stderr index e5409c042056..60fc131dbda1 100644 --- a/src/test/rustdoc-ui/intra-links-warning.stderr +++ b/src/test/rustdoc-ui/intra-links-warning.stderr @@ -105,8 +105,8 @@ LL | | /// [error] | = note: the link appears in this line: - [error] - ^^^^^ + [error] + ^^^^^ = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[error1]` cannot be resolved, ignoring it... diff --git a/src/test/rustdoc-ui/issue-58473-2.rs b/src/test/rustdoc-ui/issue-58473-2.rs new file mode 100644 index 000000000000..5e5ddebe1088 --- /dev/null +++ b/src/test/rustdoc-ui/issue-58473-2.rs @@ -0,0 +1,12 @@ +// compile-pass + +#![deny(private_doc_tests)] + +mod foo { + /** + Does nothing, returns `()` + + yadda-yadda-yadda + */ + fn foo() {} +} diff --git a/src/test/rustdoc-ui/issue-58473.rs b/src/test/rustdoc-ui/issue-58473.rs new file mode 100644 index 000000000000..0e5be3292c05 --- /dev/null +++ b/src/test/rustdoc-ui/issue-58473.rs @@ -0,0 +1,10 @@ +// compile-pass + +pub trait Foo { + /** + Does nothing, returns `()` + + yadda-yadda-yadda + */ + fn foo() {} +} From 1536852b428b56a13a3026354db72e0b83c83652 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Sat, 23 Feb 2019 15:10:56 -0500 Subject: [PATCH 032/381] merge early and late passes into single struct --- src/librustdoc/config.rs | 2 +- src/librustdoc/core.rs | 8 +- src/librustdoc/lib.rs | 22 ----- .../passes/check_code_block_syntax.rs | 8 +- src/librustdoc/passes/collapse_docs.rs | 8 +- .../passes/collect_intra_doc_links.rs | 8 +- src/librustdoc/passes/collect_trait_impls.rs | 8 +- src/librustdoc/passes/mod.rs | 89 ++----------------- .../passes/private_items_doc_tests.rs | 9 +- src/librustdoc/passes/propagate_doc_cfg.rs | 11 ++- src/librustdoc/passes/strip_hidden.rs | 8 +- src/librustdoc/passes/strip_priv_imports.rs | 7 +- src/librustdoc/passes/strip_private.rs | 10 ++- src/librustdoc/passes/unindent_comments.rs | 8 +- 14 files changed, 68 insertions(+), 138 deletions(-) diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index e5caf7fdfa23..b1c53ea92b30 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -214,7 +214,7 @@ impl Options { if matches.opt_strs("passes") == ["list"] { println!("Available passes for running rustdoc:"); for pass in passes::PASSES { - println!("{:>20} - {}", pass.name(), pass.description()); + println!("{:>20} - {}", pass.name, pass.description); } println!("\nDefault passes for rustdoc:"); for &name in passes::DEFAULT_PASSES { diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 4f70751c9053..bf95cde163fc 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -606,10 +606,12 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt passes::defaults(default_passes).iter().map(|p| p.to_string()).collect(); passes.extend(manual_passes); + info!("Executing passes"); + for pass in &passes { - // the "unknown pass" error will be reported when late passes are run - if let Some(pass) = passes::find_pass(pass).and_then(|p| p.early_fn()) { - krate = pass(krate, &ctxt); + match passes::find_pass(pass).map(|p| p.pass) { + Some(pass) => krate = pass(krate, &ctxt), + None => error!("unknown pass {}, skipping", *pass), } } diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 5e9f9ee9f80a..39e504951d1c 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -441,28 +441,6 @@ where R: 'static + Send, krate.version = crate_version; - info!("Executing passes"); - - for pass in &passes { - // determine if we know about this pass - let pass = match passes::find_pass(pass) { - Some(pass) => if let Some(pass) = pass.late_fn() { - pass - } else { - // not a late pass, but still valid so don't report the error - continue - } - None => { - error!("unknown pass {}, skipping", *pass); - - continue - }, - }; - - // run it - krate = pass(krate); - } - tx.send(f(Output { krate: krate, renderinfo: renderinfo, diff --git a/src/librustdoc/passes/check_code_block_syntax.rs b/src/librustdoc/passes/check_code_block_syntax.rs index f960374370e0..88d9c87c5289 100644 --- a/src/librustdoc/passes/check_code_block_syntax.rs +++ b/src/librustdoc/passes/check_code_block_syntax.rs @@ -10,9 +10,11 @@ use crate::fold::DocFolder; use crate::html::markdown::{self, RustCodeBlock}; use crate::passes::Pass; -pub const CHECK_CODE_BLOCK_SYNTAX: Pass = - Pass::early("check-code-block-syntax", check_code_block_syntax, - "validates syntax inside Rust code blocks"); +pub const CHECK_CODE_BLOCK_SYNTAX: Pass = Pass { + name: "check-code-block-syntax", + pass: check_code_block_syntax, + description: "validates syntax inside Rust code blocks", +}; pub fn check_code_block_syntax(krate: clean::Crate, cx: &DocContext<'_, '_, '_>) -> clean::Crate { SyntaxChecker { cx }.fold_crate(krate) diff --git a/src/librustdoc/passes/collapse_docs.rs b/src/librustdoc/passes/collapse_docs.rs index 399f8261d21e..088a6ea77c73 100644 --- a/src/librustdoc/passes/collapse_docs.rs +++ b/src/librustdoc/passes/collapse_docs.rs @@ -6,9 +6,11 @@ use crate::passes::Pass; use std::mem::replace; -pub const COLLAPSE_DOCS: Pass = - Pass::early("collapse-docs", collapse_docs, - "concatenates all document attributes into one document attribute"); +pub const COLLAPSE_DOCS: Pass = Pass { + name: "collapse-docs", + pass: collapse_docs, + description: "concatenates all document attributes into one document attribute", +}; #[derive(Copy, Clone, Debug, PartialEq, Eq)] enum DocFragmentKind { diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index cf2c3aa48460..532bb9644510 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -18,9 +18,11 @@ use crate::passes::{look_for_tests, Pass}; use super::span_of_attrs; -pub const COLLECT_INTRA_DOC_LINKS: Pass = - Pass::early("collect-intra-doc-links", collect_intra_doc_links, - "reads a crate's documentation to resolve intra-doc-links"); +pub const COLLECT_INTRA_DOC_LINKS: Pass = Pass { + name: "collect-intra-doc-links", + pass: collect_intra_doc_links, + description: "reads a crate's documentation to resolve intra-doc-links", +}; pub fn collect_intra_doc_links(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate { if !UnstableFeatures::from_environment().is_nightly_build() { diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs index 903cce3bc032..4c90540871d2 100644 --- a/src/librustdoc/passes/collect_trait_impls.rs +++ b/src/librustdoc/passes/collect_trait_impls.rs @@ -6,9 +6,11 @@ use super::Pass; use rustc::util::nodemap::FxHashSet; use rustc::hir::def_id::DefId; -pub const COLLECT_TRAIT_IMPLS: Pass = - Pass::early("collect-trait-impls", collect_trait_impls, - "retrieves trait impls for items in the crate"); +pub const COLLECT_TRAIT_IMPLS: Pass = Pass { + name: "collect-trait-impls", + pass: collect_trait_impls, + description: "retrieves trait impls for items in the crate", +}; pub fn collect_trait_impls(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate { let mut synth = SyntheticImplCollector::new(cx); diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index db2bb8984384..3a9d8ef20ce8 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -6,7 +6,6 @@ use rustc::lint as lint; use rustc::middle::privacy::AccessLevels; use rustc::util::nodemap::DefIdSet; use std::mem; -use std::fmt; use syntax::ast::NodeId; use syntax_pos::{DUMMY_SP, Span}; use std::ops::Range; @@ -46,84 +45,14 @@ pub use self::collect_trait_impls::COLLECT_TRAIT_IMPLS; mod check_code_block_syntax; pub use self::check_code_block_syntax::CHECK_CODE_BLOCK_SYNTAX; -/// Represents a single pass. +/// A single pass over the cleaned documentation. +/// +/// Runs in the compiler context, so it has access to types and traits and the like. #[derive(Copy, Clone)] -pub enum Pass { - /// An "early pass" is run in the compiler context, and can gather information about types and - /// traits and the like. - EarlyPass { - name: &'static str, - pass: fn(clean::Crate, &DocContext<'_, '_, '_>) -> clean::Crate, - description: &'static str, - }, - /// A "late pass" is run between crate cleaning and page generation. - LatePass { - name: &'static str, - pass: fn(clean::Crate) -> clean::Crate, - description: &'static str, - }, -} - -impl fmt::Debug for Pass { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let mut dbg = match *self { - Pass::EarlyPass { .. } => f.debug_struct("EarlyPass"), - Pass::LatePass { .. } => f.debug_struct("LatePass"), - }; - - dbg.field("name", &self.name()) - .field("pass", &"...") - .field("description", &self.description()) - .finish() - } -} - -impl Pass { - /// Constructs a new early pass. - pub const fn early(name: &'static str, - pass: fn(clean::Crate, &DocContext<'_, '_, '_>) -> clean::Crate, - description: &'static str) -> Pass { - Pass::EarlyPass { name, pass, description } - } - - /// Constructs a new late pass. - pub const fn late(name: &'static str, - pass: fn(clean::Crate) -> clean::Crate, - description: &'static str) -> Pass { - Pass::LatePass { name, pass, description } - } - - /// Returns the name of this pass. - pub fn name(self) -> &'static str { - match self { - Pass::EarlyPass { name, .. } | - Pass::LatePass { name, .. } => name, - } - } - - /// Returns the description of this pass. - pub fn description(self) -> &'static str { - match self { - Pass::EarlyPass { description, .. } | - Pass::LatePass { description, .. } => description, - } - } - - /// If this pass is an early pass, returns the pointer to its function. - pub fn early_fn(self) -> Option) -> clean::Crate> { - match self { - Pass::EarlyPass { pass, .. } => Some(pass), - _ => None, - } - } - - /// If this pass is a late pass, returns the pointer to its function. - pub fn late_fn(self) -> Option clean::Crate> { - match self { - Pass::LatePass { pass, .. } => Some(pass), - _ => None, - } - } +pub struct Pass { + pub name: &'static str, + pub pass: fn(clean::Crate, &DocContext<'_, '_, '_>) -> clean::Crate, + pub description: &'static str, } /// The full list of passes. @@ -184,8 +113,8 @@ pub fn defaults(default_set: DefaultPassOption) -> &'static [&'static str] { } /// If the given name matches a known pass, returns its information. -pub fn find_pass(pass_name: &str) -> Option { - PASSES.iter().find(|p| p.name() == pass_name).cloned() +pub fn find_pass(pass_name: &str) -> Option<&'static Pass> { + PASSES.iter().find(|p| p.name == pass_name) } struct Stripper<'a> { diff --git a/src/librustdoc/passes/private_items_doc_tests.rs b/src/librustdoc/passes/private_items_doc_tests.rs index 819d15f65e8e..1c3977c4f85c 100644 --- a/src/librustdoc/passes/private_items_doc_tests.rs +++ b/src/librustdoc/passes/private_items_doc_tests.rs @@ -3,10 +3,11 @@ use crate::core::DocContext; use crate::fold::DocFolder; use crate::passes::{look_for_tests, Pass}; - -pub const CHECK_PRIVATE_ITEMS_DOC_TESTS: Pass = - Pass::early("check-private-items-doc-tests", check_private_items_doc_tests, - "check private items doc tests"); +pub const CHECK_PRIVATE_ITEMS_DOC_TESTS: Pass = Pass { + name: "check-private-items-doc-tests", + pass: check_private_items_doc_tests, + description: "check private items doc tests", +}; struct PrivateItemDocTestLinter<'a, 'tcx: 'a, 'rcx: 'a> { cx: &'a DocContext<'a, 'tcx, 'rcx>, diff --git a/src/librustdoc/passes/propagate_doc_cfg.rs b/src/librustdoc/passes/propagate_doc_cfg.rs index 9ba0b2272869..aed80b5ba86f 100644 --- a/src/librustdoc/passes/propagate_doc_cfg.rs +++ b/src/librustdoc/passes/propagate_doc_cfg.rs @@ -2,14 +2,17 @@ use std::sync::Arc; use crate::clean::{Crate, Item}; use crate::clean::cfg::Cfg; +use crate::core::DocContext; use crate::fold::DocFolder; use crate::passes::Pass; -pub const PROPAGATE_DOC_CFG: Pass = - Pass::late("propagate-doc-cfg", propagate_doc_cfg, - "propagates `#[doc(cfg(...))]` to child items"); +pub const PROPAGATE_DOC_CFG: Pass = Pass { + name: "propagate-doc-cfg", + pass: propagate_doc_cfg, + description: "propagates `#[doc(cfg(...))]` to child items", +}; -pub fn propagate_doc_cfg(cr: Crate) -> Crate { +pub fn propagate_doc_cfg(cr: Crate, _: &DocContext<'_, '_, '_>) -> Crate { CfgPropagator { parent_cfg: None }.fold_crate(cr) } diff --git a/src/librustdoc/passes/strip_hidden.rs b/src/librustdoc/passes/strip_hidden.rs index b3d50e06816c..330057e53843 100644 --- a/src/librustdoc/passes/strip_hidden.rs +++ b/src/librustdoc/passes/strip_hidden.rs @@ -7,9 +7,11 @@ use crate::core::DocContext; use crate::fold::{DocFolder, StripItem}; use crate::passes::{ImplStripper, Pass}; -pub const STRIP_HIDDEN: Pass = - Pass::early("strip-hidden", strip_hidden, - "strips all doc(hidden) items from the output"); +pub const STRIP_HIDDEN: Pass = Pass { + name: "strip-hidden", + pass: strip_hidden, + description: "strips all doc(hidden) items from the output", +}; /// Strip items marked `#[doc(hidden)]` pub fn strip_hidden(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { diff --git a/src/librustdoc/passes/strip_priv_imports.rs b/src/librustdoc/passes/strip_priv_imports.rs index 3af1403e8749..479f0877bd7d 100644 --- a/src/librustdoc/passes/strip_priv_imports.rs +++ b/src/librustdoc/passes/strip_priv_imports.rs @@ -3,8 +3,11 @@ use crate::fold::{DocFolder}; use crate::core::DocContext; use crate::passes::{ImportStripper, Pass}; -pub const STRIP_PRIV_IMPORTS: Pass = Pass::early("strip-priv-imports", strip_priv_imports, - "strips all private import statements (`use`, `extern crate`) from a crate"); +pub const STRIP_PRIV_IMPORTS: Pass = Pass { + name: "strip-priv-imports", + pass: strip_priv_imports, + description: "strips all private import statements (`use`, `extern crate`) from a crate", +}; pub fn strip_priv_imports(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { ImportStripper.fold_crate(krate) diff --git a/src/librustdoc/passes/strip_private.rs b/src/librustdoc/passes/strip_private.rs index e553d792eb69..1ac3a90f38d3 100644 --- a/src/librustdoc/passes/strip_private.rs +++ b/src/librustdoc/passes/strip_private.rs @@ -5,10 +5,12 @@ use crate::fold::{DocFolder}; use crate::core::DocContext; use crate::passes::{ImplStripper, ImportStripper, Stripper, Pass}; -pub const STRIP_PRIVATE: Pass = - Pass::early("strip-private", strip_private, - "strips all private items from a crate which cannot be seen externally, \ - implies strip-priv-imports"); +pub const STRIP_PRIVATE: Pass = Pass { + name: "strip-private", + pass: strip_private, + description: "strips all private items from a crate which cannot be seen externally, \ + implies strip-priv-imports", +}; /// Strip private items from the point of view of a crate or externally from a /// crate, specified by the `xcrate` flag. diff --git a/src/librustdoc/passes/unindent_comments.rs b/src/librustdoc/passes/unindent_comments.rs index c32c3556a572..b77cf68d7c63 100644 --- a/src/librustdoc/passes/unindent_comments.rs +++ b/src/librustdoc/passes/unindent_comments.rs @@ -7,9 +7,11 @@ use crate::core::DocContext; use crate::fold::{self, DocFolder}; use crate::passes::Pass; -pub const UNINDENT_COMMENTS: Pass = - Pass::early("unindent-comments", unindent_comments, - "removes excess indentation on comments in order for markdown to like it"); +pub const UNINDENT_COMMENTS: Pass = Pass { + name: "unindent-comments", + pass: unindent_comments, + description: "removes excess indentation on comments in order for markdown to like it", +}; pub fn unindent_comments(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { CommentCleaner.fold_crate(krate) From 5d1f100988c12dabf5a34854e9db6875b999e357 Mon Sep 17 00:00:00 2001 From: memoryruins Date: Sat, 23 Feb 2019 21:07:04 -0500 Subject: [PATCH 033/381] Add unstable option to ignore should_panic tests. --- src/libtest/lib.rs | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 5c7fb1b80446..a712d4092308 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -366,6 +366,7 @@ pub struct TestOpts { pub list: bool, pub filter: Option, pub filter_exact: bool, + pub exclude_should_panic: bool, pub run_ignored: RunIgnored, pub run_tests: bool, pub bench_benchmarks: bool, @@ -385,6 +386,7 @@ impl TestOpts { list: false, filter: None, filter_exact: false, + exclude_should_panic: false, run_ignored: RunIgnored::No, run_tests: false, bench_benchmarks: false, @@ -406,6 +408,7 @@ fn optgroups() -> getopts::Options { let mut opts = getopts::Options::new(); opts.optflag("", "include-ignored", "Run ignored and not ignored tests") .optflag("", "ignored", "Run only ignored tests") + .optflag("", "exclude-should-panic", "Sets #[should_panic] tests to imply #[ignore]") .optflag("", "test", "Run tests and not benchmarks") .optflag("", "bench", "Run benchmarks instead of tests") .optflag("", "list", "List all tests and benchmarks") @@ -558,6 +561,13 @@ pub fn parse_opts(args: &[String]) -> Option { None }; + let exclude_should_panic = matches.opt_present("exclude-should-panic"); + if !allow_unstable && exclude_should_panic { + return Some(Err( + "The \"exclude-should-panic\" flag is only accepted on the nightly compiler".into(), + )); + } + let include_ignored = matches.opt_present("include-ignored"); if !allow_unstable && include_ignored { return Some(Err( @@ -648,6 +658,7 @@ pub fn parse_opts(args: &[String]) -> Option { list, filter, filter_exact: exact, + exclude_should_panic, run_ignored, run_tests, bench_benchmarks, @@ -1365,6 +1376,14 @@ pub fn filter_tests(opts: &TestOpts, tests: Vec) -> Vec { @@ -1983,6 +2002,32 @@ mod tests { assert!(!filtered[1].desc.ignore); } + #[test] + pub fn exclude_should_panic_option() { + let mut opts = TestOpts::new(); + opts.run_tests = true; + opts.exclude_should_panic = true; + + let mut tests = one_ignored_one_unignored_test(); + + tests.push(TestDescAndFn { + desc: TestDesc { + name: StaticTestName("3"), + ignore: false, + should_panic: ShouldPanic::YesWithMessage("should panic with message"), + allow_fail: false, + }, + testfn: DynTestFn(Box::new(move || {})), + }); + + let filtered = filter_tests(&opts, tests); + + assert_eq!(filtered.len(), 3); + assert!(filtered[0].desc.ignore); + assert!(!filtered[1].desc.ignore); + assert!(filtered[2].desc.ignore); + } + #[test] pub fn exact_filter_match() { fn tests() -> Vec { From 904a91c496b582edbf172ebae5165a58e150b1c3 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 18 Feb 2019 10:41:10 +0100 Subject: [PATCH 034/381] hir: impl Display for HirId --- src/librustc/hir/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index d0b92587b59f..f8b85d13c7fa 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -112,6 +112,12 @@ impl serialize::UseSpecializedDecodable for HirId { } } +impl fmt::Display for HirId { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{:?}", self) + } +} + // hack to ensure that we don't try to access the private parts of `ItemLocalId` in this module mod item_local_id_inner { use rustc_data_structures::indexed_vec::Idx; From 00b74e5eaf4439e859fd057bbf7048f93d8659d5 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 18 Feb 2019 10:59:17 +0100 Subject: [PATCH 035/381] hir: remove NodeId from Lifetime and Ty --- src/librustc/hir/lowering.rs | 30 ++++----- src/librustc/hir/mod.rs | 10 ++- src/librustc/ich/impls_hir.rs | 2 - .../nice_region_error/different_lifetimes.rs | 2 +- src/librustc/middle/resolve_lifetime.rs | 63 ++++++++++--------- src/librustc_save_analysis/lib.rs | 2 +- src/librustc_typeck/astconv.rs | 16 ++--- src/librustc_typeck/check/mod.rs | 3 +- src/librustc_typeck/collect.rs | 2 +- src/librustc_typeck/lib.rs | 4 +- src/librustdoc/clean/mod.rs | 14 ++--- src/librustdoc/core.rs | 3 - src/librustdoc/test.rs | 2 +- 13 files changed, 71 insertions(+), 82 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index d55f62d3e1a5..f4452555ba6e 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -1350,9 +1350,8 @@ impl<'a> LoweringContext<'a> { TyKind::Mac(_) => panic!("TyMac should have been expanded by now."), }; - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(t.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(t.id); hir::Ty { - id: node_id, node: kind, span: t.span, hir_id, @@ -1533,9 +1532,8 @@ impl<'a> LoweringContext<'a> { && !self.already_defined_lifetimes.contains(&name) { self.already_defined_lifetimes.insert(name); - let LoweredNodeId { node_id, hir_id } = self.context.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.context.next_id(); self.output_lifetimes.push(hir::GenericArg::Lifetime(hir::Lifetime { - id: node_id, hir_id, span: lifetime.span, name, @@ -1980,8 +1978,8 @@ impl<'a> LoweringContext<'a> { .map(|ty| this.lower_ty_direct(ty, ImplTraitContext::disallowed())) .collect(); let mk_tup = |this: &mut Self, tys, span| { - let LoweredNodeId { node_id, hir_id } = this.next_id(); - hir::Ty { node: hir::TyKind::Tup(tys), id: node_id, hir_id, span } + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); + hir::Ty { node: hir::TyKind::Tup(tys), hir_id, span } }; let LoweredNodeId { node_id, hir_id } = this.next_id(); @@ -2318,9 +2316,8 @@ impl<'a> LoweringContext<'a> { this.lower_ty(ty, ImplTraitContext::Existential(Some(fn_def_id))) } FunctionRetTy::Default(span) => { - let LoweredNodeId { node_id, hir_id } = this.next_id(); + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); P(hir::Ty { - id: node_id, hir_id, node: hir::TyKind::Tup(hir_vec![]), span: *span, @@ -2362,17 +2359,16 @@ impl<'a> LoweringContext<'a> { ]; if let Some((name, span)) = bound_lifetime { - let LoweredNodeId { node_id, hir_id } = this.next_id(); + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); bounds.push(hir::GenericBound::Outlives( - hir::Lifetime { id: node_id, hir_id, name, span })); + hir::Lifetime { hir_id, name, span })); } hir::HirVec::from(bounds) }); - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); let impl_trait_ty = P(hir::Ty { - id: node_id, node: impl_trait_ty, span, hir_id, @@ -2431,10 +2427,9 @@ impl<'a> LoweringContext<'a> { span: Span, name: hir::LifetimeName, ) -> hir::Lifetime { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(id); hir::Lifetime { - id: node_id, hir_id, span, name: name, @@ -5108,7 +5103,6 @@ impl<'a> LoweringContext<'a> { _ => hir::TyKind::Path(qpath), }; hir::Ty { - id: id.node_id, hir_id: id.hir_id, node, span, @@ -5124,9 +5118,8 @@ impl<'a> LoweringContext<'a> { // `'f`. AnonymousLifetimeMode::CreateParameter => { let fresh_name = self.collect_fresh_in_band_lifetime(span); - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Lifetime { - id: node_id, hir_id, span, name: hir::LifetimeName::Param(fresh_name), @@ -5227,10 +5220,9 @@ impl<'a> LoweringContext<'a> { } fn new_implicit_lifetime(&mut self, span: Span) -> hir::Lifetime { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Lifetime { - id: node_id, hir_id, span, name: hir::LifetimeName::Implicit, diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index f8b85d13c7fa..f655b9fe4c89 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -151,7 +151,6 @@ pub const DUMMY_ITEM_LOCAL_ID: ItemLocalId = ItemLocalId::MAX; #[derive(Clone, RustcEncodable, RustcDecodable, Copy)] pub struct Lifetime { - pub id: NodeId, pub hir_id: HirId, pub span: Span, @@ -272,7 +271,7 @@ impl fmt::Debug for Lifetime { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "lifetime({}: {})", - self.id, + self.hir_id, print::to_string(print::NO_ANN, |s| s.print_lifetime(self))) } } @@ -417,10 +416,10 @@ impl GenericArg { } } - pub fn id(&self) -> NodeId { + pub fn id(&self) -> HirId { match self { - GenericArg::Lifetime(l) => l.id, - GenericArg::Type(t) => t.id, + GenericArg::Lifetime(l) => l.hir_id, + GenericArg::Type(t) => t.hir_id, GenericArg::Const(c) => c.value.id, } } @@ -1760,7 +1759,6 @@ pub struct TypeBinding { #[derive(Clone, RustcEncodable, RustcDecodable)] pub struct Ty { - pub id: NodeId, pub node: TyKind, pub span: Span, pub hir_id: HirId, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 727c441b0e8d..7c9d64950a6f 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -158,7 +158,6 @@ impl_stable_hash_for!(struct ast::Label { }); impl_stable_hash_for!(struct hir::Lifetime { - id, hir_id, span, name @@ -318,7 +317,6 @@ impl<'a> HashStable> for hir::Ty { hasher: &mut StableHasher) { hcx.while_hashing_hir_bodies(true, |hcx| { let hir::Ty { - id: _, hir_id: _, ref node, ref span, diff --git a/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs b/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs index 5d5a9b36087a..86d7a19bc830 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs @@ -101,7 +101,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { let (span_1, span_2, main_label, span_label) = match (sup_is_ret_type, sub_is_ret_type) { (None, None) => { - let (main_label_1, span_label_1) = if ty_sup.id == ty_sub.id { + let (main_label_1, span_label_1) = if ty_sup.hir_id == ty_sub.hir_id { ( "this type is declared with multiple lifetimes...".to_owned(), "...but data with one lifetime flows into the other here".to_owned() diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 08da74f47d45..a8104a47e67b 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -13,7 +13,7 @@ use crate::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt}; use crate::rustc::lint; use crate::session::Session; -use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, NodeMap, NodeSet}; +use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, NodeMap, NodeSet}; use errors::{Applicability, DiagnosticBuilder}; use rustc_data_structures::sync::Lrc; use std::borrow::Cow; @@ -151,7 +151,7 @@ impl Region { if let Region::EarlyBound(index, _, _) = self { params .nth(index as usize) - .and_then(|lifetime| map.defs.get(&lifetime.id).cloned()) + .and_then(|lifetime| map.defs.get(&lifetime.hir_id).cloned()) } else { Some(self) } @@ -195,7 +195,7 @@ pub type ObjectLifetimeDefault = Set1; struct NamedRegionMap { // maps from every use of a named (not anonymous) lifetime to a // `Region` describing how that region is bound - pub defs: NodeMap, + pub defs: HirIdMap, // the set of lifetime def ids that are late-bound; a region can // be late-bound if (a) it does NOT appear in a where-clause and @@ -385,8 +385,7 @@ fn resolve_lifetimes<'tcx>( let mut rl = ResolveLifetimes::default(); - for (k, v) in named_region_map.defs { - let hir_id = tcx.hir().node_to_hir_id(k); + for (hir_id, v) in named_region_map.defs { let map = rl.defs.entry(hir_id.owner_local_def_id()).or_default(); Lrc::get_mut(map).unwrap().insert(hir_id.local_id, v); } @@ -570,7 +569,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { } fn visit_ty(&mut self, ty: &'tcx hir::Ty) { - debug!("visit_ty: id={:?} ty={:?}", ty.id, ty); + debug!("visit_ty: id={:?} ty={:?}", ty.hir_id, ty); match ty.node { hir::TyKind::BareFn(ref c) => { let next_early_index = self.next_early_index(); @@ -629,7 +628,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { hir::TyKind::Rptr(ref lifetime_ref, ref mt) => { self.visit_lifetime(lifetime_ref); let scope = Scope::ObjectLifetimeDefault { - lifetime: self.map.defs.get(&lifetime_ref.id).cloned(), + lifetime: self.map.defs.get(&lifetime_ref.hir_id).cloned(), s: self.scope, }; self.with(scope, |_, this| this.visit_ty(&mt.ty)); @@ -672,7 +671,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { // and ban them. Type variables instantiated inside binders aren't // well-supported at the moment, so this doesn't work. // In the future, this should be fixed and this error should be removed. - let def = self.map.defs.get(&lifetime.id).cloned(); + let def = self.map.defs.get(&lifetime.hir_id).cloned(); if let Some(Region::LateBound(_, def_id, _)) = def { if let Some(node_id) = self.tcx.hir().as_local_node_id(def_id) { // Ensure that the parent of the def is an item, not HRTB @@ -1501,8 +1500,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } } }; - if let Node::Lifetime(hir_lifetime) = self.tcx.hir().get(lifetime.id) { - if let Some(parent) = self.tcx.hir().find(self.tcx.hir().get_parent(hir_lifetime.id)) { + if let Node::Lifetime(hir_lifetime) = self.tcx.hir().get_by_hir_id(lifetime.hir_id) { + if let Some(parent) = self.tcx.hir().find_by_hir_id( + self.tcx.hir().get_parent_item(hir_lifetime.hir_id)) + { match parent { Node::Item(item) => { if let hir::ItemKind::Fn(decl, _, _, _) = &item.node { @@ -1582,22 +1583,22 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { debug!("node id first={:?}", node_id); if let Some((id, span, name)) = match self.tcx.hir().get(node_id) { Node::Lifetime(hir_lifetime) => Some(( - hir_lifetime.id, + hir_lifetime.hir_id, hir_lifetime.span, hir_lifetime.name.ident(), )), Node::GenericParam(param) => { - Some((param.id, param.span, param.name.ident())) + Some((param.hir_id, param.span, param.name.ident())) } _ => None, } { - debug!("id = {:?} span = {:?} name = {:?}", node_id, span, name); + debug!("id = {:?} span = {:?} name = {:?}", id, span, name); if name == keywords::UnderscoreLifetime.ident() { continue; } - let mut err = self.tcx.struct_span_lint_node( + let mut err = self.tcx.struct_span_lint_hir( lint::builtin::SINGLE_USE_LIFETIMES, id, span, @@ -1622,17 +1623,17 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { let node_id = self.tcx.hir().as_local_node_id(def_id).unwrap(); if let Some((id, span, name)) = match self.tcx.hir().get(node_id) { Node::Lifetime(hir_lifetime) => Some(( - hir_lifetime.id, + hir_lifetime.hir_id, hir_lifetime.span, hir_lifetime.name.ident(), )), Node::GenericParam(param) => { - Some((param.id, param.span, param.name.ident())) + Some((param.hir_id, param.span, param.name.ident())) } _ => None, } { - debug!("id ={:?} span = {:?} name = {:?}", node_id, span, name); - let mut err = self.tcx.struct_span_lint_node( + debug!("id ={:?} span = {:?} name = {:?}", id, span, name); + let mut err = self.tcx.struct_span_lint_hir( lint::builtin::UNUSED_LIFETIMES, id, span, @@ -2049,8 +2050,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { // and whether there's a `self` argument (treated specially). let mut assoc_item_kind = None; let mut impl_self = None; - let parent = self.tcx.hir().get_parent_node(output.id); - let body = match self.tcx.hir().get(parent) { + let parent = self.tcx.hir().get_parent_node_by_hir_id(output.hir_id); + let body = match self.tcx.hir().get_by_hir_id(parent) { // `fn` definitions and methods. Node::Item(&hir::Item { node: hir::ItemKind::Fn(.., body), @@ -2063,12 +2064,13 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { }) => { if let hir::ItemKind::Trait(.., ref trait_items) = self.tcx .hir() - .expect_item(self.tcx.hir().get_parent(parent)) + .expect_item_by_hir_id(self.tcx.hir().get_parent_item(parent)) .node { + let parent_node_id = self.tcx.hir().hir_to_node_id(parent); assoc_item_kind = trait_items .iter() - .find(|ti| ti.id.node_id == parent) + .find(|ti| ti.id.node_id == parent_node_id) .map(|ti| ti.kind); } match *m { @@ -2083,13 +2085,14 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { }) => { if let hir::ItemKind::Impl(.., ref self_ty, ref impl_items) = self.tcx .hir() - .expect_item(self.tcx.hir().get_parent(parent)) + .expect_item_by_hir_id(self.tcx.hir().get_parent_item(parent)) .node { impl_self = Some(self_ty); + let parent_node_id = self.tcx.hir().hir_to_node_id(parent); assoc_item_kind = impl_items .iter() - .find(|ii| ii.id.node_id == parent) + .find(|ii| ii.id.node_id == parent_node_id) .map(|ii| ii.kind); } Some(body) @@ -2143,7 +2146,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { if let hir::TyKind::Rptr(lifetime_ref, ref mt) = inputs[0].node { if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = mt.ty.node { if is_self_ty(path.def) { - if let Some(&lifetime) = self.map.defs.get(&lifetime_ref.id) { + if let Some(&lifetime) = self.map.defs.get(&lifetime_ref.hir_id) { let scope = Scope::Elision { elide: Elide::Exact(lifetime), s: self.scope, @@ -2262,7 +2265,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } fn visit_lifetime(&mut self, lifetime_ref: &hir::Lifetime) { - if let Some(&lifetime) = self.map.defs.get(&lifetime_ref.id) { + if let Some(&lifetime) = self.map.defs.get(&lifetime_ref.hir_id) { match lifetime { Region::LateBound(debruijn, _, _) | Region::LateBoundAnon(debruijn, _) if debruijn < self.outer_index => @@ -2653,7 +2656,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } fn insert_lifetime(&mut self, lifetime_ref: &'tcx hir::Lifetime, def: Region) { - if lifetime_ref.id == ast::DUMMY_NODE_ID { + if lifetime_ref.hir_id == hir::DUMMY_HIR_ID { span_bug!( lifetime_ref.span, "lifetime reference not renumbered, \ @@ -2663,11 +2666,11 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { debug!( "insert_lifetime: {} resolved to {:?} span={:?}", - self.tcx.hir().node_to_string(lifetime_ref.id), + self.tcx.hir().hir_to_string(lifetime_ref.hir_id), def, self.tcx.sess.source_map().span_to_string(lifetime_ref.span) ); - self.map.defs.insert(lifetime_ref.id, def); + self.map.defs.insert(lifetime_ref.hir_id, def); match def { Region::LateBoundAnon(..) | Region::Static => { @@ -2699,7 +2702,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { /// error (esp. around impl trait). In that case, we remove the /// entry into `map.defs` so as not to confuse later code. fn uninsert_lifetime_on_error(&mut self, lifetime_ref: &'tcx hir::Lifetime, bad_def: Region) { - let old_value = self.map.defs.remove(&lifetime_ref.id); + let old_value = self.map.defs.remove(&lifetime_ref.hir_id); assert_eq!(old_value, Some(bad_def)); } } diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 8ab9a8e8dda8..af3f54187b0c 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -397,7 +397,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { Some(Node::Item(item)) => match item.node { hir::ItemKind::Impl(.., ref ty, _) => { let mut qualname = String::from("<"); - qualname.push_str(&self.tcx.hir().node_to_pretty_string(ty.id)); + qualname.push_str(&self.tcx.hir().hir_to_pretty_string(ty.hir_id)); let trait_id = self.tcx.trait_id_of_impl(impl_id); let mut decl_id = None; diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index cde6eb22bb8a..9dfd19199bac 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -304,8 +304,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { } else { let mut multispan = MultiSpan::from_span(span); multispan.push_span_label(span_late, note.to_string()); - tcx.lint_node(lint::builtin::LATE_BOUND_LIFETIME_ARGUMENTS, - args.args[0].id(), multispan, msg); + tcx.lint_hir(lint::builtin::LATE_BOUND_LIFETIME_ARGUMENTS, + args.args[0].id(), multispan, msg); return (false, None); } } @@ -1267,7 +1267,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { // parameter or `Self`. pub fn associated_path_to_ty( &self, - ref_id: ast::NodeId, + hir_ref_id: hir::HirId, span: Span, qself_ty: Ty<'tcx>, qself_def: Def, @@ -1276,6 +1276,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { ) -> (Ty<'tcx>, Def) { let tcx = self.tcx(); let assoc_ident = assoc_segment.ident; + let ref_id = tcx.hir().hir_to_node_id(hir_ref_id); debug!("associated_path_to_ty: {:?}::{}", qself_ty, assoc_ident); @@ -1370,7 +1371,6 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { }; let trait_did = bound.def_id(); - let hir_ref_id = self.tcx().hir().node_to_hir_id(ref_id); let (assoc_ident, def_scope) = tcx.adjust_ident(assoc_ident, trait_did, hir_ref_id); let item = tcx.associated_items(trait_did).find(|i| { Namespace::from(i.kind) == Namespace::Type && @@ -1388,9 +1388,9 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { tcx.check_stability(item.def_id, Some(ref_id), span); if let Some(variant_def) = variant_resolution { - let mut err = tcx.struct_span_lint_node( + let mut err = tcx.struct_span_lint_hir( AMBIGUOUS_ASSOCIATED_ITEMS, - ref_id, + hir_ref_id, span, "ambiguous associated item", ); @@ -1742,7 +1742,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// internal notion of a type. pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> { debug!("ast_ty_to_ty(id={:?}, ast_ty={:?} ty_ty={:?})", - ast_ty.id, ast_ty, ast_ty.node); + ast_ty.hir_id, ast_ty, ast_ty.node); let tcx = self.tcx(); @@ -1795,7 +1795,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { } else { Def::Err }; - self.associated_path_to_ty(ast_ty.id, ast_ty.span, ty, def, segment, false).0 + self.associated_path_to_ty(ast_ty.hir_id, ast_ty.span, ty, def, segment, false).0 } hir::TyKind::Array(ref ty, ref length) => { let length_def_id = tcx.hir().local_def_id(length.id); diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 6ac0c79b1f2e..def0886dcb20 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -4734,7 +4734,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } else { Def::Err }; - let (ty, def) = AstConv::associated_path_to_ty(self, node_id, path_span, + let hir_id = self.tcx.hir().node_to_hir_id(node_id); + let (ty, def) = AstConv::associated_path_to_ty(self, hir_id, path_span, ty, def, segment, true); // Write back the new resolution. diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index ec1d9d24730e..b0427a5be3ea 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -2224,7 +2224,7 @@ fn compute_sig_of_foreign_fn_decl<'a, 'tcx>( &format!( "use of SIMD type `{}` in FFI is highly experimental and \ may result in invalid code", - tcx.hir().node_to_pretty_string(ast_ty.id) + tcx.hir().hir_to_pretty_string(ast_ty.hir_id) ), ) .help("add #![feature(simd_ffi)] to the crate attributes to enable") diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 2dcb48692f6b..75ab49fa7508 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -373,8 +373,8 @@ pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> // In case there are any projections etc, find the "environment" // def-id that will be used to determine the traits/predicates in // scope. This is derived from the enclosing item-like thing. - let env_node_id = tcx.hir().get_parent(hir_ty.id); - let env_def_id = tcx.hir().local_def_id(env_node_id); + let env_node_id = tcx.hir().get_parent_item(hir_ty.hir_id); + let env_def_id = tcx.hir().local_def_id_from_hir_id(env_node_id); let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id); astconv::AstConv::ast_ty_to_ty(&item_cx, hir_ty) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 2b2a116f8ca4..1171b5ac3b65 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1219,7 +1219,7 @@ impl Lifetime { impl Clean for hir::Lifetime { fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Lifetime { - if self.id != ast::DUMMY_NODE_ID { + if self.hir_id != hir::DUMMY_HIR_ID { let def = cx.tcx.named_region(self.hir_id); match def { Some(rl::Region::EarlyBound(_, node_id, _)) | @@ -1986,7 +1986,7 @@ impl Clean for hir::IsAuto { impl Clean for hir::TraitRef { fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type { - resolve_type(cx, self.path.clean(cx), self.ref_id) + resolve_type(cx, self.path.clean(cx), self.hir_ref_id) } } @@ -2654,7 +2654,7 @@ impl Clean for hir::Ty { }); return cx.enter_alias(ty_substs, lt_substs, const_substs, || ty.clean(cx)); } - resolve_type(cx, path.clean(cx), self.id) + resolve_type(cx, path.clean(cx), self.hir_id) } TyKind::Path(hir::QPath::Resolved(Some(ref qself), ref p)) => { let mut segments: Vec<_> = p.segments.clone().into(); @@ -2667,7 +2667,7 @@ impl Clean for hir::Ty { Type::QPath { name: p.segments.last().expect("segments were empty").ident.name.clean(cx), self_type: box qself.clean(cx), - trait_: box resolve_type(cx, trait_path.clean(cx), self.id) + trait_: box resolve_type(cx, trait_path.clean(cx), self.hir_id) } } TyKind::Path(hir::QPath::TypeRelative(ref qself, ref segment)) => { @@ -2684,7 +2684,7 @@ impl Clean for hir::Ty { Type::QPath { name: segment.ident.name.clean(cx), self_type: box qself.clean(cx), - trait_: box resolve_type(cx, trait_path.clean(cx), self.id) + trait_: box resolve_type(cx, trait_path.clean(cx), self.hir_id) } } TyKind::TraitObject(ref bounds, ref lifetime) => { @@ -3907,8 +3907,8 @@ fn print_const_expr(cx: &DocContext<'_, '_, '_>, body: hir::BodyId) -> String { /// Given a type Path, resolve it to a Type using the TyCtxt fn resolve_type(cx: &DocContext<'_, '_, '_>, path: Path, - id: ast::NodeId) -> Type { - if id == ast::DUMMY_NODE_ID { + id: hir::HirId) -> Type { + if id == hir::DUMMY_HIR_ID { debug!("resolve_type({:?})", path); } else { debug!("resolve_type({:?},{:?})", path, id); diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 4f70751c9053..226924c41c54 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -193,7 +193,6 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { }; hir::Ty { - id: ast::DUMMY_NODE_ID, node: hir::TyKind::Path(hir::QPath::Resolved(None, P(new_path))), span: DUMMY_SP, hir_id: hir::DUMMY_HIR_ID, @@ -213,7 +212,6 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { }; args.push(hir::GenericArg::Lifetime(hir::Lifetime { - id: ast::DUMMY_NODE_ID, hir_id: hir::DUMMY_HIR_ID, span: DUMMY_SP, name: hir::LifetimeName::Param(name), @@ -235,7 +233,6 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { pub fn ty_param_to_ty(&self, param: ty::GenericParamDef) -> hir::Ty { debug!("ty_param_to_ty({:?}) {:?}", param, param.def_id); hir::Ty { - id: ast::DUMMY_NODE_ID, node: hir::TyKind::Path(hir::QPath::Resolved( None, P(hir::Path { diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 3db65205a2dc..8dad26f9292c 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -868,7 +868,7 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirCollector<'a, 'hir> { fn visit_item(&mut self, item: &'hir hir::Item) { let name = if let hir::ItemKind::Impl(.., ref ty, _) = item.node { - self.map.node_to_pretty_string(ty.id) + self.map.hir_to_pretty_string(ty.hir_id) } else { item.ident.to_string() }; From 58ed6833790d2a0a3aeda57336b4106516278c52 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 18 Feb 2019 12:11:42 +0100 Subject: [PATCH 036/381] passes: HirIdify Id --- src/librustc_passes/hir_stats.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/librustc_passes/hir_stats.rs b/src/librustc_passes/hir_stats.rs index 4071b5902b03..c74314ce0c4b 100644 --- a/src/librustc_passes/hir_stats.rs +++ b/src/librustc_passes/hir_stats.rs @@ -2,7 +2,7 @@ // pieces of AST and HIR. The resulting numbers are good approximations but not // completely accurate (some things might be counted twice, others missed). -use rustc::hir; +use rustc::hir::{self, HirId}; use rustc::hir::intravisit as hir_visit; use rustc::util::common::to_readable_str; use rustc::util::nodemap::{FxHashMap, FxHashSet}; @@ -12,7 +12,7 @@ use syntax_pos::Span; #[derive(Copy, Clone, PartialEq, Eq, Hash)] enum Id { - Node(NodeId), + Node(HirId), Attr(AttrId), None, } @@ -119,7 +119,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_item(&mut self, i: &'v hir::Item) { - self.record("Item", Id::Node(i.id), i); + self.record("Item", Id::Node(i.hir_id), i); hir_visit::walk_item(self, i) } @@ -129,22 +129,22 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_foreign_item(&mut self, i: &'v hir::ForeignItem) { - self.record("ForeignItem", Id::Node(i.id), i); + self.record("ForeignItem", Id::Node(i.hir_id), i); hir_visit::walk_foreign_item(self, i) } fn visit_local(&mut self, l: &'v hir::Local) { - self.record("Local", Id::Node(l.id), l); + self.record("Local", Id::Node(l.hir_id), l); hir_visit::walk_local(self, l) } fn visit_block(&mut self, b: &'v hir::Block) { - self.record("Block", Id::Node(b.id), b); + self.record("Block", Id::Node(b.hir_id), b); hir_visit::walk_block(self, b) } fn visit_stmt(&mut self, s: &'v hir::Stmt) { - self.record("Stmt", Id::Node(s.id), s); + self.record("Stmt", Id::Node(s.hir_id), s); hir_visit::walk_stmt(self, s) } @@ -154,17 +154,17 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_pat(&mut self, p: &'v hir::Pat) { - self.record("Pat", Id::Node(p.id), p); + self.record("Pat", Id::Node(p.hir_id), p); hir_visit::walk_pat(self, p) } fn visit_expr(&mut self, ex: &'v hir::Expr) { - self.record("Expr", Id::Node(ex.id), ex); + self.record("Expr", Id::Node(ex.hir_id), ex); hir_visit::walk_expr(self, ex) } fn visit_ty(&mut self, t: &'v hir::Ty) { - self.record("Ty", Id::Node(t.id), t); + self.record("Ty", Id::Node(t.hir_id), t); hir_visit::walk_ty(self, t) } @@ -184,12 +184,12 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_trait_item(&mut self, ti: &'v hir::TraitItem) { - self.record("TraitItem", Id::Node(ti.id), ti); + self.record("TraitItem", Id::Node(ti.hir_id), ti); hir_visit::walk_trait_item(self, ti) } fn visit_impl_item(&mut self, ii: &'v hir::ImplItem) { - self.record("ImplItem", Id::Node(ii.id), ii); + self.record("ImplItem", Id::Node(ii.hir_id), ii); hir_visit::walk_impl_item(self, ii) } @@ -199,7 +199,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_struct_field(&mut self, s: &'v hir::StructField) { - self.record("StructField", Id::Node(s.id), s); + self.record("StructField", Id::Node(s.hir_id), s); hir_visit::walk_struct_field(self, s) } @@ -212,7 +212,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_lifetime(&mut self, lifetime: &'v hir::Lifetime) { - self.record("Lifetime", Id::Node(lifetime.id), lifetime); + self.record("Lifetime", Id::Node(lifetime.hir_id), lifetime); hir_visit::walk_lifetime(self, lifetime) } @@ -234,7 +234,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_assoc_type_binding(&mut self, type_binding: &'v hir::TypeBinding) { - self.record("TypeBinding", Id::Node(type_binding.id), type_binding); + self.record("TypeBinding", Id::Node(type_binding.hir_id), type_binding); hir_visit::walk_assoc_type_binding(self, type_binding) } @@ -243,7 +243,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_macro_def(&mut self, macro_def: &'v hir::MacroDef) { - self.record("MacroDef", Id::Node(macro_def.id), macro_def); + self.record("MacroDef", Id::Node(macro_def.hir_id), macro_def); hir_visit::walk_macro_def(self, macro_def) } } From 1c18ac1f65ad87709e962176fb84a17d570cafb9 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 18 Feb 2019 12:22:41 +0100 Subject: [PATCH 037/381] privacy: HirIdify ObsoleteVisiblePrivateTypesVisitor --- src/librustc_privacy/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 894cb4cf11b2..825721a1a96a 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -21,7 +21,7 @@ use rustc::ty::{self, TyCtxt, Ty, TraitRef, TypeFoldable, GenericParamDefKind}; use rustc::ty::fold::TypeVisitor; use rustc::ty::query::Providers; use rustc::ty::subst::Substs; -use rustc::util::nodemap::NodeSet; +use rustc::util::nodemap::HirIdSet; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::Lrc; use syntax::ast::{self, DUMMY_NODE_ID, Ident}; @@ -1152,7 +1152,7 @@ struct ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx: 'a> { access_levels: &'a AccessLevels, in_variant: bool, // Set of errors produced by this obsolete visitor. - old_error_set: NodeSet, + old_error_set: HirIdSet, } struct ObsoleteCheckTypeForPrivatenessVisitor<'a, 'b: 'a, 'tcx: 'b> { @@ -1196,7 +1196,7 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { fn check_generic_bound(&mut self, bound: &hir::GenericBound) { if let hir::GenericBound::Trait(ref trait_ref, _) = *bound { if self.path_is_private_type(&trait_ref.trait_ref.path) { - self.old_error_set.insert(trait_ref.trait_ref.ref_id); + self.old_error_set.insert(trait_ref.trait_ref.hir_ref_id); } } } @@ -1452,7 +1452,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { fn visit_ty(&mut self, t: &'tcx hir::Ty) { if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = t.node { if self.path_is_private_type(path) { - self.old_error_set.insert(t.id); + self.old_error_set.insert(t.hir_id); } } intravisit::walk_ty(self, t) @@ -1596,7 +1596,7 @@ impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for SearchInterfaceForPrivateItemsVisitor< struct PrivateItemsInPublicInterfacesVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, has_pub_restricted: bool, - old_error_set: &'a NodeSet, + old_error_set: &'a HirIdSet, private_crates: FxHashSet } @@ -1608,7 +1608,7 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { // Slow path taken only if there any errors in the crate. for &id in self.old_error_set { // Walk up the nodes until we find `item_id` (or we hit a root). - let mut id = id; + let mut id = self.tcx.hir().hir_to_node_id(id); loop { if id == item_id { has_old_errors = true; From e4f8a6bcc1ecc3715a025c3a56ebf06c117ba767 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 18 Feb 2019 14:53:25 +0100 Subject: [PATCH 038/381] hir: remove NodeId from GenericParam --- src/librustc/hir/lowering.rs | 6 +---- src/librustc/hir/map/mod.rs | 11 ++++++--- src/librustc/hir/mod.rs | 3 +-- src/librustc/ich/impls_hir.rs | 1 - src/librustc/middle/resolve_lifetime.rs | 25 ++++++++++----------- src/librustc_metadata/encoder.rs | 4 ++-- src/librustc_typeck/collect.rs | 30 ++++++++++++------------- src/librustdoc/clean/mod.rs | 12 +++++----- 8 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index f4452555ba6e..f551eb48c6cc 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -780,7 +780,6 @@ impl<'a> LoweringContext<'a> { ); hir::GenericParam { - id: node_id, hir_id, name: hir_name, attrs: hir_vec![], @@ -1300,7 +1299,6 @@ impl<'a> LoweringContext<'a> { // Set the name to `impl Bound1 + Bound2`. let ident = Ident::from_str(&pprust::ty_to_string(t)).with_span_pos(span); in_band_ty_params.push(hir::GenericParam { - id: def_node_id, hir_id, name: ParamName::Plain(ident), pure_wrt_drop: false, @@ -1567,7 +1565,6 @@ impl<'a> LoweringContext<'a> { }; self.output_lifetime_params.push(hir::GenericParam { - id: def_node_id, hir_id, name, span: lifetime.span, @@ -2519,10 +2516,9 @@ impl<'a> LoweringContext<'a> { } }; - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(param.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(param.id); hir::GenericParam { - id: node_id, hir_id, name, span: param.ident.span, diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 39203208855e..052802810f09 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -395,9 +395,14 @@ impl<'hir> Map<'hir> { } Node::GenericParam(param) => { Some(match param.kind { - GenericParamKind::Lifetime { .. } => Def::Local(param.id), - GenericParamKind::Type { .. } => Def::TyParam(self.local_def_id(param.id)), - GenericParamKind::Const { .. } => Def::ConstParam(self.local_def_id(param.id)), + GenericParamKind::Lifetime { .. } => { + let node_id = self.hir_to_node_id(param.hir_id); + Def::Local(node_id) + }, + GenericParamKind::Type { .. } => Def::TyParam( + self.local_def_id_from_hir_id(param.hir_id)), + GenericParamKind::Const { .. } => Def::ConstParam( + self.local_def_id_from_hir_id(param.hir_id)), }) } } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index f655b9fe4c89..a5b61f002f77 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -420,7 +420,7 @@ impl GenericArg { match self { GenericArg::Lifetime(l) => l.hir_id, GenericArg::Type(t) => t.hir_id, - GenericArg::Const(c) => c.value.id, + GenericArg::Const(c) => c.value.hir_id, } } } @@ -552,7 +552,6 @@ pub enum GenericParamKind { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct GenericParam { - pub id: NodeId, pub hir_id: HirId, pub name: ParamName, pub attrs: HirVec, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 7c9d64950a6f..0bee2a6f260a 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -206,7 +206,6 @@ impl_stable_hash_for!(enum hir::TraitBoundModifier { }); impl_stable_hash_for!(struct hir::GenericParam { - id, hir_id, name, pure_wrt_drop, diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index a8104a47e67b..31e9eb9b7463 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -13,7 +13,7 @@ use crate::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt}; use crate::rustc::lint; use crate::session::Session; -use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, NodeMap, NodeSet}; +use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, HirIdSet, NodeMap}; use errors::{Applicability, DiagnosticBuilder}; use rustc_data_structures::sync::Lrc; use std::borrow::Cow; @@ -83,7 +83,7 @@ impl Region { fn early(hir_map: &Map<'_>, index: &mut u32, param: &GenericParam) -> (ParamName, Region) { let i = *index; *index += 1; - let def_id = hir_map.local_def_id(param.id); + let def_id = hir_map.local_def_id_from_hir_id(param.hir_id); let origin = LifetimeDefOrigin::from_param(param); debug!("Region::early: index={} def_id={:?}", i, def_id); (param.name.modern(), Region::EarlyBound(i, def_id, origin)) @@ -91,7 +91,7 @@ impl Region { fn late(hir_map: &Map<'_>, param: &GenericParam) -> (ParamName, Region) { let depth = ty::INNERMOST; - let def_id = hir_map.local_def_id(param.id); + let def_id = hir_map.local_def_id_from_hir_id(param.hir_id); let origin = LifetimeDefOrigin::from_param(param); debug!( "Region::late: param={:?} depth={:?} def_id={:?} origin={:?}", @@ -200,7 +200,7 @@ struct NamedRegionMap { // the set of lifetime def ids that are late-bound; a region can // be late-bound if (a) it does NOT appear in a where-clause and // (b) it DOES appear in the arguments. - pub late_bound: NodeSet, + pub late_bound: HirIdSet, // For each type and trait definition, maps type parameters // to the trait object lifetime defaults computed from them. @@ -389,8 +389,7 @@ fn resolve_lifetimes<'tcx>( let map = rl.defs.entry(hir_id.owner_local_def_id()).or_default(); Lrc::get_mut(map).unwrap().insert(hir_id.local_id, v); } - for k in named_region_map.late_bound { - let hir_id = tcx.hir().node_to_hir_id(k); + for hir_id in named_region_map.late_bound { let map = rl.late_bound .entry(hir_id.owner_local_def_id()) .or_default(); @@ -1338,7 +1337,7 @@ fn object_lifetime_defaults_for_item( add_bounds(&mut set, ¶m.bounds); - let param_def_id = tcx.hir().local_def_id(param.id); + let param_def_id = tcx.hir().local_def_id_from_hir_id(param.hir_id); for predicate in &generics.where_clause.predicates { // Look for `type: ...` where clauses. let data = match *predicate { @@ -1373,7 +1372,7 @@ fn object_lifetime_defaults_for_item( .iter() .filter_map(|param| match param.kind { GenericParamKind::Lifetime { .. } => Some(( - param.id, + param.hir_id, hir::LifetimeName::Param(param.name), LifetimeDefOrigin::from_param(param), )), @@ -1382,7 +1381,7 @@ fn object_lifetime_defaults_for_item( .enumerate() .find(|&(_, (_, lt_name, _))| lt_name == name) .map_or(Set1::Many, |(i, (id, _, origin))| { - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); Set1::One(Region::EarlyBound(i as u32, def_id, origin)) }) } @@ -1707,7 +1706,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { let mut non_lifetime_count = 0; let lifetimes = generics.params.iter().filter_map(|param| match param.kind { GenericParamKind::Lifetime { .. } => { - if self.map.late_bound.contains(¶m.id) { + if self.map.late_bound.contains(¶m.hir_id) { Some(Region::late(&self.tcx.hir(), param)) } else { Some(Region::early(&self.tcx.hir(), &mut index, param)) @@ -2792,11 +2791,11 @@ fn insert_late_bound_lifetimes( debug!( "insert_late_bound_lifetimes: lifetime {:?} with id {:?} is late-bound", param.name.ident(), - param.id + param.hir_id ); - let inserted = map.late_bound.insert(param.id); - assert!(inserted, "visited lifetime {:?} twice", param.id); + let inserted = map.late_bound.insert(param.hir_id); + assert!(inserted, "visited lifetime {:?} twice", param.hir_id); } return; diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 7e325ecc76c0..ef2cca708d17 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1702,13 +1702,13 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { match param.kind { hir::GenericParamKind::Lifetime { .. } => {} hir::GenericParamKind::Type { ref default, .. } => { - let def_id = self.tcx.hir().local_def_id(param.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(param.hir_id); let has_default = Untracked(default.is_some()); let encode_info = IsolatedEncoder::encode_info_for_ty_param; self.record(def_id, encode_info, (def_id, has_default)); } hir::GenericParamKind::Const { .. } => { - let def_id = self.tcx.hir().local_def_id(param.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(param.hir_id); let encode_info = IsolatedEncoder::encode_info_for_const_param; self.record(def_id, encode_info, def_id); } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index b0427a5be3ea..2ef6aaf4f049 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -129,12 +129,12 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { hir::GenericParamKind::Type { default: Some(_), .. } => { - let def_id = self.tcx.hir().local_def_id(param.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(param.hir_id); self.tcx.type_of(def_id); } hir::GenericParamKind::Type { .. } => {} hir::GenericParamKind::Const { .. } => { - let def_id = self.tcx.hir().local_def_id(param.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(param.hir_id); self.tcx.type_of(def_id); } } @@ -322,9 +322,10 @@ fn type_param_predicates<'a, 'tcx>( }; let icx = ItemCtxt::new(tcx, item_def_id); + let param_hir_id = tcx.hir().node_to_hir_id(param_id); Lrc::make_mut(&mut result) .predicates - .extend(icx.type_parameter_bounds_in_generics(ast_generics, param_id, ty, + .extend(icx.type_parameter_bounds_in_generics(ast_generics, param_hir_id, ty, OnlySelfBounds(true))); result } @@ -337,7 +338,7 @@ impl<'a, 'tcx> ItemCtxt<'a, 'tcx> { fn type_parameter_bounds_in_generics( &self, ast_generics: &hir::Generics, - param_id: ast::NodeId, + param_id: hir::HirId, ty: Ty<'tcx>, only_self_bounds: OnlySelfBounds, ) -> Vec<(ty::Predicate<'tcx>, Span)> { @@ -345,7 +346,7 @@ impl<'a, 'tcx> ItemCtxt<'a, 'tcx> { .params .iter() .filter_map(|param| match param.kind { - GenericParamKind::Type { .. } if param.id == param_id => Some(¶m.bounds), + GenericParamKind::Type { .. } if param.hir_id == param_id => Some(¶m.bounds), _ => None, }) .flat_map(|bounds| bounds.iter()) @@ -382,12 +383,12 @@ impl<'a, 'tcx> ItemCtxt<'a, 'tcx> { fn is_param<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, ast_ty: &hir::Ty, - param_id: ast::NodeId, + param_id: hir::HirId, ) -> bool { if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node { match path.def { Def::SelfTy(Some(def_id), None) | Def::TyParam(def_id) => { - def_id == tcx.hir().local_def_id(param_id) + def_id == tcx.hir().local_def_id_from_hir_id(param_id) } _ => false, } @@ -721,7 +722,7 @@ fn super_predicates_of<'a, 'tcx>( // as one of its "superpredicates". let is_trait_alias = tcx.is_trait_alias(trait_def_id); let superbounds2 = icx.type_parameter_bounds_in_generics( - generics, item.id, self_param_ty, OnlySelfBounds(!is_trait_alias)); + generics, item.hir_id, self_param_ty, OnlySelfBounds(!is_trait_alias)); // Combine the two lists to form the complete set of superbounds: let superbounds: Vec<_> = superbounds1.into_iter().chain(superbounds2).collect(); @@ -987,7 +988,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty .map(|(i, param)| ty::GenericParamDef { name: param.name.ident().as_interned_str(), index: own_start + i as u32, - def_id: tcx.hir().local_def_id(param.id), + def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id), pure_wrt_drop: param.pure_wrt_drop, kind: ty::GenericParamDefKind::Lifetime, }), @@ -1018,9 +1019,9 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty if !allow_defaults && default.is_some() { if !tcx.features().default_type_parameter_fallback { - tcx.lint_node( + tcx.lint_hir( lint::builtin::INVALID_TYPE_PARAM_DEFAULT, - param.id, + param.hir_id, param.span, &format!( "defaults for type parameters are only allowed in \ @@ -1033,7 +1034,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty let ty_param = ty::GenericParamDef { index: type_start + i as u32, name: param.name.ident().as_interned_str(), - def_id: tcx.hir().local_def_id(param.id), + def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id), pure_wrt_drop: param.pure_wrt_drop, kind: ty::GenericParamDefKind::Type { has_default: default.is_some(), @@ -1704,8 +1705,7 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx>( .iter() .filter(move |param| match param.kind { GenericParamKind::Lifetime { .. } => { - let hir_id = tcx.hir().node_to_hir_id(param.id); - !tcx.is_late_bound(hir_id) + !tcx.is_late_bound(param.hir_id) } _ => false, }) @@ -1942,7 +1942,7 @@ fn explicit_predicates_of<'a, 'tcx>( let mut index = parent_count + has_own_self as u32; for param in early_bound_lifetimes_from_generics(tcx, ast_generics) { let region = tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { - def_id: tcx.hir().local_def_id(param.id), + def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id), index, name: param.name.ident().as_interned_str(), })); diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 1171b5ac3b65..03f248f41adf 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1511,7 +1511,7 @@ impl Clean for hir::GenericParam { } hir::GenericParamKind::Type { ref default, synthetic } => { (self.name.ident().name.clean(cx), GenericParamDefKind::Type { - did: cx.tcx.hir().local_def_id(self.id), + did: cx.tcx.hir().local_def_id_from_hir_id(self.hir_id), bounds: self.bounds.clean(cx), default: default.clean(cx), synthetic: synthetic, @@ -1519,7 +1519,7 @@ impl Clean for hir::GenericParam { } hir::GenericParamKind::Const { ref ty } => { (self.name.ident().name.clean(cx), GenericParamDefKind::Const { - did: cx.tcx.hir().local_def_id(self.id), + did: cx.tcx.hir().local_def_id_from_hir_id(self.hir_id), ty: ty.clean(cx), }) } @@ -2597,7 +2597,7 @@ impl Clean for hir::Ty { if let Some(lt) = lifetime.cloned() { if !lt.is_elided() { let lt_def_id = - cx.tcx.hir().local_def_id(param.id); + cx.tcx.hir().local_def_id_from_hir_id(param.hir_id); lt_substs.insert(lt_def_id, lt.clean(cx)); } } @@ -2605,7 +2605,8 @@ impl Clean for hir::Ty { } hir::GenericParamKind::Type { ref default, .. } => { let ty_param_def = - Def::TyParam(cx.tcx.hir().local_def_id(param.id)); + Def::TyParam( + cx.tcx.hir().local_def_id_from_hir_id(param.hir_id)); let mut j = 0; let type_ = generic_args.args.iter().find_map(|arg| { match arg { @@ -2629,7 +2630,8 @@ impl Clean for hir::Ty { } hir::GenericParamKind::Const { .. } => { let const_param_def = - Def::ConstParam(cx.tcx.hir().local_def_id(param.id)); + Def::ConstParam( + cx.tcx.hir().local_def_id_from_hir_id(param.hir_id)); let mut j = 0; let const_ = generic_args.args.iter().find_map(|arg| { match arg { From cd5b5e7a8022f419af649455bf047384e71922fd Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 18 Feb 2019 15:00:59 +0100 Subject: [PATCH 039/381] hir: remove NodeId from WhereClause --- src/librustc/hir/lowering.rs | 6 ++---- src/librustc/hir/mod.rs | 4 +--- src/librustc/hir/print.rs | 1 - src/librustc/ich/impls_hir.rs | 1 - 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index f551eb48c6cc..182dfdb60e36 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -1391,12 +1391,11 @@ impl<'a> LoweringContext<'a> { ); self.with_hir_id_owner(exist_ty_node_id, |lctx| { - let LoweredNodeId { node_id, hir_id } = lctx.next_id(); + let LoweredNodeId { node_id: _, hir_id } = lctx.next_id(); let exist_ty_item_kind = hir::ItemKind::Existential(hir::ExistTy { generics: hir::Generics { params: lifetime_defs, where_clause: hir::WhereClause { - id: node_id, hir_id, predicates: Vec::new().into(), }, @@ -2599,10 +2598,9 @@ impl<'a> LoweringContext<'a> { self.with_anonymous_lifetime_mode( AnonymousLifetimeMode::ReportError, |this| { - let LoweredNodeId { node_id, hir_id } = this.lower_node_id(wc.id); + let LoweredNodeId { node_id: _, hir_id } = this.lower_node_id(wc.id); hir::WhereClause { - id: node_id, hir_id, predicates: wc.predicates .iter() diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index a5b61f002f77..37e45ebe7f4f 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -19,7 +19,7 @@ use errors::FatalError; use syntax_pos::{Span, DUMMY_SP, symbol::InternedString}; use syntax::source_map::Spanned; use rustc_target::spec::abi::Abi; -use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, DUMMY_NODE_ID, AsmDialect}; +use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, AsmDialect}; use syntax::ast::{Attribute, Label, Lit, StrStyle, FloatTy, IntTy, UintTy}; use syntax::attr::{InlineAttr, OptimizeAttr}; use syntax::ext::hygiene::SyntaxContext; @@ -583,7 +583,6 @@ impl Generics { Generics { params: HirVec::new(), where_clause: WhereClause { - id: DUMMY_NODE_ID, hir_id: DUMMY_HIR_ID, predicates: HirVec::new(), }, @@ -628,7 +627,6 @@ pub enum SyntheticTyParamKind { /// A where-clause in a definition. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct WhereClause { - pub id: NodeId, pub hir_id: HirId, pub predicates: HirVec, } diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index ece649cf1b88..17d374884134 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -2248,7 +2248,6 @@ impl<'a> State<'a> { let generics = hir::Generics { params: hir::HirVec::new(), where_clause: hir::WhereClause { - id: ast::DUMMY_NODE_ID, hir_id: hir::DUMMY_HIR_ID, predicates: hir::HirVec::new(), }, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 0bee2a6f260a..97d5abd28fa1 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -253,7 +253,6 @@ impl_stable_hash_for!(enum hir::SyntheticTyParamKind { }); impl_stable_hash_for!(struct hir::WhereClause { - id, hir_id, predicates }); From b6b2edbfd7a8b09995874db270869220d26b4533 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 18 Feb 2019 15:06:13 +0100 Subject: [PATCH 040/381] hir: remove NodeId from WhereEqPredicate --- src/librustc/hir/lowering.rs | 3 +-- src/librustc/hir/mod.rs | 1 - src/librustc/ich/impls_hir.rs | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 182dfdb60e36..d13cc27d2df5 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -2661,10 +2661,9 @@ impl<'a> LoweringContext<'a> { ref rhs_ty, span, }) => { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(id); hir::WherePredicate::EqPredicate(hir::WhereEqPredicate { - id: node_id, hir_id, lhs_ty: self.lower_ty(lhs_ty, ImplTraitContext::disallowed()), rhs_ty: self.lower_ty(rhs_ty, ImplTraitContext::disallowed()), diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 37e45ebe7f4f..e1c744fd28fb 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -687,7 +687,6 @@ pub struct WhereRegionPredicate { /// An equality predicate (e.g., `T = int`); currently unsupported. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct WhereEqPredicate { - pub id: NodeId, pub hir_id: HirId, pub span: Span, pub lhs_ty: P, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 97d5abd28fa1..c761b722e0ba 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -277,7 +277,6 @@ impl_stable_hash_for!(struct hir::WhereRegionPredicate { }); impl_stable_hash_for!(struct hir::WhereEqPredicate { - id, hir_id, span, lhs_ty, From 46e4f4ae617dbaa32a08dee3a474cdbbcb583f40 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 18 Feb 2019 15:35:20 +0100 Subject: [PATCH 041/381] middle: partially HirIdify stability --- src/librustc/middle/stability.rs | 52 ++++++++++++++------------------ 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 707d3484982e..3a81660ad691 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -117,13 +117,13 @@ struct Annotator<'a, 'tcx: 'a> { impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { // Determine the stability for a node based on its attributes and inherited // stability. The stability is recorded in the index and used as the parent. - fn annotate(&mut self, id: NodeId, attrs: &[Attribute], + fn annotate(&mut self, hir_id: HirId, attrs: &[Attribute], item_sp: Span, kind: AnnotationKind, visit_children: F) where F: FnOnce(&mut Self) { if self.tcx.features().staged_api { // This crate explicitly wants staged API. - debug!("annotate(id = {:?}, attrs = {:?})", id, attrs); + debug!("annotate(id = {:?}, attrs = {:?})", hir_id, attrs); if let Some(..) = attr::find_deprecation(&self.tcx.sess.parse_sess, attrs, item_sp) { self.tcx.sess.span_err(item_sp, "`#[deprecated]` cannot be used in staged api, \ use `#[rustc_deprecated]` instead"); @@ -178,7 +178,6 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { } } - let hir_id = self.tcx.hir().node_to_hir_id(id); self.index.stab_map.insert(hir_id, stab); let orig_parent_stab = replace(&mut self.parent_stab, Some(stab)); @@ -188,7 +187,6 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { debug!("annotate: not found, parent = {:?}", self.parent_stab); if let Some(stab) = self.parent_stab { if stab.level.is_unstable() { - let hir_id = self.tcx.hir().node_to_hir_id(id); self.index.stab_map.insert(hir_id, stab); } } @@ -209,7 +207,6 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { // -Zforce-unstable-if-unmarked is set. if let Some(stab) = self.parent_stab { if stab.level.is_unstable() { - let hir_id = self.tcx.hir().node_to_hir_id(id); self.index.stab_map.insert(hir_id, stab); } } @@ -220,7 +217,6 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { } // `Deprecation` is just two pointers, no need to intern it - let hir_id = self.tcx.hir().node_to_hir_id(id); let depr_entry = DeprecationEntry::local(depr, hir_id); self.index.depr_map.insert(hir_id, depr_entry.clone()); @@ -229,7 +225,6 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { visit_children(self); self.parent_depr = orig_parent_depr; } else if let Some(parent_depr) = self.parent_depr.clone() { - let hir_id = self.tcx.hir().node_to_hir_id(id); self.index.depr_map.insert(hir_id, parent_depr); visit_children(self); } else { @@ -264,20 +259,20 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { } hir::ItemKind::Struct(ref sd, _) => { if !sd.is_struct() { - self.annotate(sd.id(), &i.attrs, i.span, AnnotationKind::Required, |_| {}) + self.annotate(sd.hir_id(), &i.attrs, i.span, AnnotationKind::Required, |_| {}) } } _ => {} } - self.annotate(i.id, &i.attrs, i.span, kind, |v| { + self.annotate(i.hir_id, &i.attrs, i.span, kind, |v| { intravisit::walk_item(v, i) }); self.in_trait_impl = orig_in_trait_impl; } fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) { - self.annotate(ti.id, &ti.attrs, ti.span, AnnotationKind::Required, |v| { + self.annotate(ti.hir_id, &ti.attrs, ti.span, AnnotationKind::Required, |v| { intravisit::walk_trait_item(v, ti); }); } @@ -288,31 +283,30 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { } else { AnnotationKind::Required }; - self.annotate(ii.id, &ii.attrs, ii.span, kind, |v| { + self.annotate(ii.hir_id, &ii.attrs, ii.span, kind, |v| { intravisit::walk_impl_item(v, ii); }); } fn visit_variant(&mut self, var: &'tcx Variant, g: &'tcx Generics, item_id: HirId) { - self.annotate(var.node.data.id(), &var.node.attrs, var.span, AnnotationKind::Required, |v| { - intravisit::walk_variant(v, var, g, item_id); - }) + self.annotate(var.node.data.hir_id(), &var.node.attrs, var.span, AnnotationKind::Required, + |v| { intravisit::walk_variant(v, var, g, item_id) }) } fn visit_struct_field(&mut self, s: &'tcx StructField) { - self.annotate(s.id, &s.attrs, s.span, AnnotationKind::Required, |v| { + self.annotate(s.hir_id, &s.attrs, s.span, AnnotationKind::Required, |v| { intravisit::walk_struct_field(v, s); }); } fn visit_foreign_item(&mut self, i: &'tcx hir::ForeignItem) { - self.annotate(i.id, &i.attrs, i.span, AnnotationKind::Required, |v| { + self.annotate(i.hir_id, &i.attrs, i.span, AnnotationKind::Required, |v| { intravisit::walk_foreign_item(v, i); }); } fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef) { - self.annotate(md.id, &md.attrs, md.span, AnnotationKind::Required, |_| {}); + self.annotate(md.hir_id, &md.attrs, md.span, AnnotationKind::Required, |_| {}); } } @@ -322,12 +316,12 @@ struct MissingStabilityAnnotations<'a, 'tcx: 'a> { } impl<'a, 'tcx: 'a> MissingStabilityAnnotations<'a, 'tcx> { - fn check_missing_stability(&self, id: NodeId, span: Span, name: &str) { - let hir_id = self.tcx.hir().node_to_hir_id(id); + fn check_missing_stability(&self, hir_id: HirId, span: Span, name: &str) { let stab = self.tcx.stability().local_stability(hir_id); + let node_id = self.tcx.hir().hir_to_node_id(hir_id); let is_error = !self.tcx.sess.opts.test && stab.is_none() && - self.access_levels.is_reachable(id); + self.access_levels.is_reachable(node_id); if is_error { self.tcx.sess.span_err( span, @@ -350,42 +344,42 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> { // optional. They inherit stability from their parents when unannotated. hir::ItemKind::Impl(.., None, _, _) | hir::ItemKind::ForeignMod(..) => {} - _ => self.check_missing_stability(i.id, i.span, i.node.descriptive_variant()) + _ => self.check_missing_stability(i.hir_id, i.span, i.node.descriptive_variant()) } intravisit::walk_item(self, i) } fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) { - self.check_missing_stability(ti.id, ti.span, "item"); + self.check_missing_stability(ti.hir_id, ti.span, "item"); intravisit::walk_trait_item(self, ti); } fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) { let impl_def_id = self.tcx.hir().local_def_id(self.tcx.hir().get_parent(ii.id)); if self.tcx.impl_trait_ref(impl_def_id).is_none() { - self.check_missing_stability(ii.id, ii.span, "item"); + self.check_missing_stability(ii.hir_id, ii.span, "item"); } intravisit::walk_impl_item(self, ii); } fn visit_variant(&mut self, var: &'tcx Variant, g: &'tcx Generics, item_id: HirId) { - self.check_missing_stability(var.node.data.id(), var.span, "variant"); + self.check_missing_stability(var.node.data.hir_id(), var.span, "variant"); intravisit::walk_variant(self, var, g, item_id); } fn visit_struct_field(&mut self, s: &'tcx StructField) { - self.check_missing_stability(s.id, s.span, "field"); + self.check_missing_stability(s.hir_id, s.span, "field"); intravisit::walk_struct_field(self, s); } fn visit_foreign_item(&mut self, i: &'tcx hir::ForeignItem) { - self.check_missing_stability(i.id, i.span, i.node.descriptive_variant()); + self.check_missing_stability(i.hir_id, i.span, i.node.descriptive_variant()); intravisit::walk_foreign_item(self, i); } fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef) { - self.check_missing_stability(md.id, md.span, "macro"); + self.check_missing_stability(md.hir_id, md.span, "macro"); } } @@ -441,7 +435,7 @@ impl<'a, 'tcx> Index<'tcx> { annotator.parent_stab = Some(stability); } - annotator.annotate(ast::CRATE_NODE_ID, + annotator.annotate(hir::CRATE_HIR_ID, &krate.attrs, krate.span, AnnotationKind::Required, @@ -843,7 +837,7 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { tcx, access_levels, }; - missing.check_missing_stability(ast::CRATE_NODE_ID, krate.span, "crate"); + missing.check_missing_stability(hir::CRATE_HIR_ID, krate.span, "crate"); intravisit::walk_crate(&mut missing, krate); krate.visit_all_item_likes(&mut missing.as_deep_visitor()); } From c886d47b822d0269360d9945b556764bd94ac7ec Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 18 Feb 2019 15:54:14 +0100 Subject: [PATCH 042/381] doc: partially HirIdify visit_ast --- src/librustdoc/visit_ast.rs | 75 +++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 2428a823d0b3..b791bfc11e01 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -66,13 +66,13 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { } } - fn stability(&self, id: ast::NodeId) -> Option { - self.cx.tcx.hir().opt_local_def_id(id) + fn stability(&self, id: hir::HirId) -> Option { + self.cx.tcx.hir().opt_local_def_id_from_hir_id(id) .and_then(|def_id| self.cx.tcx.lookup_stability(def_id)).cloned() } - fn deprecation(&self, id: ast::NodeId) -> Option { - self.cx.tcx.hir().opt_local_def_id(id) + fn deprecation(&self, id: hir::HirId) -> Option { + self.cx.tcx.hir().opt_local_def_id_from_hir_id(id) .and_then(|def_id| self.cx.tcx.lookup_deprecation(def_id)) } @@ -83,7 +83,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { krate.attrs.clone(), Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Public }, - ast::CRATE_NODE_ID, + hir::CRATE_HIR_ID, &krate.module, None); // Attach the crate's exported macros to the top-level module: @@ -105,8 +105,8 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { struct_type, name, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), attrs: item.attrs.clone(), generics: generics.clone(), fields: sd.fields().iter().cloned().collect(), @@ -124,8 +124,8 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { struct_type, name, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), attrs: item.attrs.clone(), generics: generics.clone(), fields: sd.fields().iter().cloned().collect(), @@ -142,14 +142,14 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { variants: def.variants.iter().map(|v| Variant { name: v.node.ident.name, attrs: v.node.attrs.clone(), - stab: self.stability(v.node.data.id()), - depr: self.deprecation(v.node.data.id()), + stab: self.stability(v.node.data.hir_id()), + depr: self.deprecation(v.node.data.hir_id()), def: v.node.data.clone(), whence: v.span, }).collect(), vis: it.vis.clone(), - stab: self.stability(it.id), - depr: self.deprecation(it.id), + stab: self.stability(it.hir_id), + depr: self.deprecation(it.hir_id), generics: params.clone(), attrs: it.attrs.clone(), id: it.id, @@ -207,16 +207,16 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { helpers, attrs: item.attrs.clone(), whence: item.span, - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }); } None => { om.fns.push(Function { id: item.id, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), attrs: item.attrs.clone(), decl: fd.clone(), name, @@ -230,7 +230,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { } pub fn visit_mod_contents(&mut self, span: Span, attrs: hir::HirVec, - vis: hir::Visibility, id: ast::NodeId, + vis: hir::Visibility, id: hir::HirId, m: &hir::Mod, name: Option) -> Module { let mut om = Module::new(name); @@ -240,7 +240,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { om.vis = vis.clone(); om.stab = self.stability(id); om.depr = self.deprecation(id); - om.id = id; + om.id = self.cx.tcx.hir().hir_to_node_id(id); // Keep track of if there were any private modules in the path. let orig_inside_public_path = self.inside_public_path; self.inside_public_path &= vis.node.is_pub(); @@ -460,7 +460,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { om.mods.push(self.visit_mod_contents(item.span, item.attrs.clone(), item.vis.clone(), - item.id, + item.hir_id, m, Some(ident.name))); }, @@ -481,8 +481,8 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.typedefs.push(t); }, @@ -494,8 +494,8 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.existentials.push(t); }, @@ -509,8 +509,8 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.statics.push(s); }, @@ -523,8 +523,8 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.constants.push(s); }, @@ -543,8 +543,8 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.traits.push(t); }, @@ -557,8 +557,8 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.trait_aliases.push(t); }, @@ -588,8 +588,8 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { id: item.id, whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.impls.push(i); } @@ -609,13 +609,14 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { let matchers = tts.chunks(4).map(|arm| arm[0].span()).collect(); Macro { - def_id: self.cx.tcx.hir().local_def_id(def.id), + + def_id: self.cx.tcx.hir().local_def_id_from_hir_id(def.hir_id), attrs: def.attrs.clone(), name: renamed.unwrap_or(def.name), whence: def.span, matchers, - stab: self.stability(def.id), - depr: self.deprecation(def.id), + stab: self.stability(def.hir_id), + depr: self.deprecation(def.hir_id), imported_from: None, } } From 63b4dd91be31b6565d2b868e5ac9ee0e4e33610b Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 18 Feb 2019 15:55:00 +0100 Subject: [PATCH 043/381] hir: remove NodeId from MacroDef --- src/librustc/hir/lowering.rs | 1 - src/librustc/hir/map/collector.rs | 3 ++- src/librustc/hir/map/mod.rs | 2 +- src/librustc/hir/mod.rs | 1 - src/librustc/ich/impls_hir.rs | 1 - src/librustc_metadata/encoder.rs | 4 ++-- src/librustc_metadata/index_builder.rs | 2 +- src/librustc_privacy/lib.rs | 8 +++++--- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index d13cc27d2df5..b790ee1eaea1 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -3532,7 +3532,6 @@ impl<'a> LoweringContext<'a> { name: ident.name, vis, attrs, - id: i.id, hir_id, span: i.span, body, diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 04eec88004aa..588b986aad29 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -507,7 +507,8 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { } fn visit_macro_def(&mut self, macro_def: &'hir MacroDef) { - let def_index = self.definitions.opt_def_index(macro_def.id).unwrap(); + let node_id = self.hir_to_node_id[¯o_def.hir_id]; + let def_index = self.definitions.opt_def_index(node_id).unwrap(); self.with_dep_node_owner(def_index, macro_def, |this| { this.insert(macro_def.span, macro_def.hir_id, Node::MacroDef(macro_def)); diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 052802810f09..5339d0fa0ecd 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -390,7 +390,7 @@ impl<'hir> Map<'hir> { Some(Def::Local(local.id)) } Node::MacroDef(macro_def) => { - Some(Def::Macro(self.local_def_id(macro_def.id), + Some(Def::Macro(self.local_def_id_from_hir_id(macro_def.hir_id), MacroKind::Bang)) } Node::GenericParam(param) => { diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index e1c744fd28fb..1d7b28baed7f 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -809,7 +809,6 @@ pub struct MacroDef { pub name: Name, pub vis: Visibility, pub attrs: HirVec, - pub id: NodeId, pub hir_id: HirId, pub span: Span, pub body: TokenStream, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index c761b722e0ba..ef13638ceb70 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -406,7 +406,6 @@ impl_stable_hash_for!(struct hir::MacroDef { name, vis, attrs, - id, hir_id, span, legacy, diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index ef2cca708d17..79457cc028a7 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1279,7 +1279,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { /// Serialize the text of exported macros fn encode_info_for_macro_def(&mut self, macro_def: &hir::MacroDef) -> Entry<'tcx> { use syntax::print::pprust; - let def_id = self.tcx.hir().local_def_id(macro_def.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(macro_def.hir_id); Entry { kind: EntryKind::MacroDef(self.lazy(&MacroDef { body: pprust::tts_to_string(¯o_def.body.trees().collect::>()), @@ -1680,7 +1680,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> { self.index.encode_info_for_ty(ty); } fn visit_macro_def(&mut self, macro_def: &'tcx hir::MacroDef) { - let def_id = self.index.tcx.hir().local_def_id(macro_def.id); + let def_id = self.index.tcx.hir().local_def_id_from_hir_id(macro_def.hir_id); self.index.record(def_id, IsolatedEncoder::encode_info_for_macro_def, macro_def); } } diff --git a/src/librustc_metadata/index_builder.rs b/src/librustc_metadata/index_builder.rs index 9aff1133ea92..3e2571fc0b39 100644 --- a/src/librustc_metadata/index_builder.rs +++ b/src/librustc_metadata/index_builder.rs @@ -185,7 +185,7 @@ macro_rules! read_hir { ($t:ty) => { impl<'tcx> DepGraphRead for &'tcx $t { fn read(&self, tcx: TyCtxt<'_, '_, '_>) { - tcx.hir().read(self.id); + tcx.hir().read_by_hir_id(self.hir_id); } } } diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 825721a1a96a..830ede751fbc 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -695,18 +695,20 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef) { + let node_id = self.tcx.hir().hir_to_node_id(md.hir_id); + if md.legacy { - self.update(md.id, Some(AccessLevel::Public)); + self.update(node_id, Some(AccessLevel::Public)); return } let module_did = ty::DefIdTree::parent( self.tcx, - self.tcx.hir().local_def_id(md.id) + self.tcx.hir().local_def_id_from_hir_id(md.hir_id) ).unwrap(); let mut module_id = self.tcx.hir().as_local_node_id(module_did).unwrap(); let level = if md.vis.node.is_pub() { self.get(module_id) } else { None }; - let level = self.update(md.id, level); + let level = self.update(node_id, level); if level.is_none() { return } From 2cf6e914aa4630fc06cb0a55d41d4364cee95682 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Sat, 23 Feb 2019 18:14:47 +0100 Subject: [PATCH 044/381] Update stdsimd --- src/stdsimd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdsimd b/src/stdsimd index 9a6069704408..359845eb7cae 160000 --- a/src/stdsimd +++ b/src/stdsimd @@ -1 +1 @@ -Subproject commit 9a60697044088f6704a40da78dee25eb6d55fd6f +Subproject commit 359845eb7cae85799dc2ec81f2fb05da0aa6276d From a5e2d0c4e5f4afe1bd52ed0ebe0be03890d3af62 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 24 Feb 2019 12:25:46 +0100 Subject: [PATCH 045/381] remark that the rules are unfinished --- src/libcore/mem.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 30fa904101d2..d4d51f8eeb76 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1230,6 +1230,8 @@ impl MaybeUninit { /// let x_vec = unsafe { &*x.as_ptr() }; /// // We have created a reference to an uninitialized vector! This is undefined behavior. /// ``` + /// (Notice that the rules around referenced to uninitialized data are not finalized yet, but + /// until they are, it is advisable to avoid them.) #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub fn as_ptr(&self) -> *const T { @@ -1266,6 +1268,8 @@ impl MaybeUninit { /// let x_vec = unsafe { &mut *x.as_mut_ptr() }; /// // We have created a reference to an uninitialized vector! This is undefined behavior. /// ``` + /// (Notice that the rules around referenced to uninitialized data are not finalized yet, but + /// until they are, it is advisable to avoid them.) #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub fn as_mut_ptr(&mut self) -> *mut T { From 19a54e80934c802109ae7175cc824c22c672caa6 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Sun, 24 Feb 2019 12:54:45 +0000 Subject: [PATCH 046/381] Type check pointer comparisons --- .../borrow_check/nll/type_check/mod.rs | 40 +++++++++++- .../ui/nll/type-check-pointer-comparisons.rs | 33 ++++++++++ .../nll/type-check-pointer-comparisons.stderr | 62 +++++++++++++++++++ 3 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/nll/type-check-pointer-comparisons.rs create mode 100644 src/test/ui/nll/type-check-pointer-comparisons.stderr diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 6b948e40bfbb..ef0f11ecfb9b 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -27,6 +27,7 @@ use rustc::hir::def_id::DefId; use rustc::infer::canonical::QueryRegionConstraint; use rustc::infer::outlives::env::RegionBoundPairs; use rustc::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime, NLLRegionVariableOrigin}; +use rustc::infer::type_variable::TypeVariableOrigin; use rustc::mir::interpret::EvalErrorKind::BoundsCheck; use rustc::mir::tcx::PlaceTy; use rustc::mir::visit::{PlaceContext, Visitor, MutatingUseContext, NonMutatingUseContext}; @@ -2103,7 +2104,44 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { self.add_reborrow_constraint(location, region, borrowed_place); } - // FIXME: These other cases have to be implemented in future PRs + Rvalue::BinaryOp(BinOp::Eq, left, right) + | Rvalue::BinaryOp(BinOp::Ne, left, right) + | Rvalue::BinaryOp(BinOp::Lt, left, right) + | Rvalue::BinaryOp(BinOp::Le, left, right) + | Rvalue::BinaryOp(BinOp::Gt, left, right) + | Rvalue::BinaryOp(BinOp::Ge, left, right) => { + let ty_left = left.ty(mir, tcx); + if let ty::RawPtr(_) | ty::FnPtr(_) = ty_left.sty { + let ty_right = right.ty(mir, tcx); + let common_ty = self.infcx.next_ty_var( + TypeVariableOrigin::MiscVariable(mir.source_info(location).span), + ); + self.sub_types( + common_ty, + ty_left, + location.to_locations(), + ConstraintCategory::Boring + ).unwrap_or_else(|err| { + bug!("Could not equate type variable with {:?}: {:?}", ty_left, err) + }); + if let Err(terr) = self.sub_types( + common_ty, + ty_right, + location.to_locations(), + ConstraintCategory::Boring + ) { + span_mirbug!( + self, + rvalue, + "unexpected comparison types {:?} and {:?} yields {:?}", + ty_left, + ty_right, + terr + ) + } + } + } + Rvalue::Use(..) | Rvalue::Len(..) | Rvalue::BinaryOp(..) diff --git a/src/test/ui/nll/type-check-pointer-comparisons.rs b/src/test/ui/nll/type-check-pointer-comparisons.rs new file mode 100644 index 000000000000..3c900356fab3 --- /dev/null +++ b/src/test/ui/nll/type-check-pointer-comparisons.rs @@ -0,0 +1,33 @@ +#![feature(nll)] + +// Check that we assert that pointers have a common subtype for comparisons + +fn compare_const<'a, 'b>(x: *const &mut &'a i32, y: *const &mut &'b i32) { + x == y; + //~^ ERROR lifetime may not live long enough + //~| ERROR lifetime may not live long enough +} + +fn compare_mut<'a, 'b>(x: *mut &'a i32, y: *mut &'b i32) { + x == y; + //~^ ERROR lifetime may not live long enough + //~| ERROR lifetime may not live long enough +} + +fn compare_fn_ptr<'a, 'b, 'c>(f: fn(&'c mut &'a i32), g: fn(&'c mut &'b i32)) { + f == g; + //~^ ERROR lifetime may not live long enough + //~| ERROR lifetime may not live long enough +} + +fn compare_hr_fn_ptr<'a>(f: fn(&'a i32), g: fn(&i32)) { + // Ideally this should compile with the operands swapped as well, but HIR + // type checking prevents it (and stops compilation) for now. + f == g; // OK +} + +fn compare_const_fn_ptr<'a>(f: *const fn(&'a i32), g: *const fn(&i32)) { + f == g; // OK +} + +fn main() {} diff --git a/src/test/ui/nll/type-check-pointer-comparisons.stderr b/src/test/ui/nll/type-check-pointer-comparisons.stderr new file mode 100644 index 000000000000..c0a994cfb638 --- /dev/null +++ b/src/test/ui/nll/type-check-pointer-comparisons.stderr @@ -0,0 +1,62 @@ +error: lifetime may not live long enough + --> $DIR/type-check-pointer-comparisons.rs:6:5 + | +LL | fn compare_const<'a, 'b>(x: *const &mut &'a i32, y: *const &mut &'b i32) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x == y; + | ^ requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-comparisons.rs:6:10 + | +LL | fn compare_const<'a, 'b>(x: *const &mut &'a i32, y: *const &mut &'b i32) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x == y; + | ^ requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-comparisons.rs:12:5 + | +LL | fn compare_mut<'a, 'b>(x: *mut &'a i32, y: *mut &'b i32) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x == y; + | ^ requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-comparisons.rs:12:10 + | +LL | fn compare_mut<'a, 'b>(x: *mut &'a i32, y: *mut &'b i32) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x == y; + | ^ requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-comparisons.rs:18:5 + | +LL | fn compare_fn_ptr<'a, 'b, 'c>(f: fn(&'c mut &'a i32), g: fn(&'c mut &'b i32)) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | f == g; + | ^ requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-comparisons.rs:18:10 + | +LL | fn compare_fn_ptr<'a, 'b, 'c>(f: fn(&'c mut &'a i32), g: fn(&'c mut &'b i32)) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | f == g; + | ^ requires that `'b` must outlive `'a` + +error: aborting due to 6 previous errors + From 4c13791537d3a13ba667b60ec1314d1361679987 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 24 Feb 2019 07:42:59 -0800 Subject: [PATCH 047/381] Fix cloudabi --- src/libstd/sys/cloudabi/shims/net.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libstd/sys/cloudabi/shims/net.rs b/src/libstd/sys/cloudabi/shims/net.rs index b4caa899a75d..869a0ef87a70 100644 --- a/src/libstd/sys/cloudabi/shims/net.rs +++ b/src/libstd/sys/cloudabi/shims/net.rs @@ -1,5 +1,5 @@ use fmt; -use io; +use io::{self, IoVec, IoVecMut}; use net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr}; use time::Duration; use sys::{unsupported, Void}; @@ -42,10 +42,18 @@ impl TcpStream { match self.0 {} } + pub fn read_vectored(&self, _: &mut [IoVecMut<'_>]) -> io::Result { + match self.0 {} + } + pub fn write(&self, _: &[u8]) -> io::Result { match self.0 {} } + pub fn write_vectored(&self, _: &[IoVec<'_>]) -> io::Result { + match self.0 {} + } + pub fn peer_addr(&self) -> io::Result { match self.0 {} } From be8d728f3cb1cb79a630c6e6aba6df923dd3e999 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 24 Feb 2019 16:58:04 +0100 Subject: [PATCH 048/381] show how to set with ptr::write --- src/libcore/mem.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index d4d51f8eeb76..967a36f6f1c3 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1191,7 +1191,8 @@ impl MaybeUninit { } /// Sets the value of the `MaybeUninit`. This overwrites any previous value - /// without dropping it. For your convenience, this also returns a mutable + /// without dropping it, so be careful not to use this twice unless you want to + /// skip running the destructor. For your convenience, this also returns a mutable /// reference to the (now safely initialized) contents of `self`. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] @@ -1214,7 +1215,7 @@ impl MaybeUninit { /// use std::mem::MaybeUninit; /// /// let mut x = MaybeUninit::>::uninitialized(); - /// x.set(vec![0,1,2]); + /// unsafe { x.as_mut_ptr().write(vec![0,1,2]); } /// // Create a reference into the `MaybeUninit`. This is okay because we initialized it. /// let x_vec = unsafe { &*x.as_ptr() }; /// assert_eq!(x_vec.len(), 3); @@ -1250,7 +1251,7 @@ impl MaybeUninit { /// use std::mem::MaybeUninit; /// /// let mut x = MaybeUninit::>::uninitialized(); - /// x.set(vec![0,1,2]); + /// unsafe { x.as_mut_ptr().write(vec![0,1,2]); } /// // Create a reference into the `MaybeUninit>`. /// // This is okay because we initialized it. /// let x_vec = unsafe { &mut *x.as_mut_ptr() }; @@ -1295,7 +1296,7 @@ impl MaybeUninit { /// use std::mem::MaybeUninit; /// /// let mut x = MaybeUninit::::uninitialized(); - /// x.set(true); + /// unsafe { x.as_mut_ptr().write(true); } /// let x_init = unsafe { x.into_initialized() }; /// assert_eq!(x_init, true); /// ``` From 021a140dcdbbae9050818b3f28402385efab3adc Mon Sep 17 00:00:00 2001 From: ljedrz Date: Fri, 22 Feb 2019 15:48:14 +0100 Subject: [PATCH 049/381] hir: remove NodeId from Block --- src/librustc/hir/lowering.rs | 9 +-- src/librustc/hir/mod.rs | 1 - src/librustc/ich/impls_hir.rs | 1 - src/librustc/middle/expr_use_visitor.rs | 2 +- src/librustc/middle/liveness.rs | 5 +- src/librustc/middle/region.rs | 2 +- src/librustc/mir/interpret/error.rs | 14 ++-- src/librustc/mir/mod.rs | 12 ++-- src/librustc/traits/object_safety.rs | 3 +- src/librustc/ty/context.rs | 4 +- src/librustc_driver/pretty.rs | 4 +- src/librustc_mir/borrow_check/mod.rs | 2 +- src/librustc_mir/build/block.rs | 6 +- src/librustc_mir/build/mod.rs | 4 +- src/librustc_mir/build/scope.rs | 12 +--- src/librustc_mir/const_eval.rs | 6 +- src/librustc_mir/hair/cx/block.rs | 2 +- src/librustc_mir/hair/cx/mod.rs | 19 +++--- src/librustc_mir/hair/mod.rs | 4 +- src/librustc_mir/transform/check_unsafety.rs | 59 ++++++++-------- src/librustc_mir/transform/const_prop.rs | 6 +- src/librustc_typeck/check/closure.rs | 2 +- src/librustc_typeck/check/mod.rs | 71 ++++++++++---------- src/librustc_typeck/check/regionck.rs | 6 +- 24 files changed, 121 insertions(+), 135 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index b790ee1eaea1..769cfbe5b4c6 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -2804,10 +2804,9 @@ impl<'a> LoweringContext<'a> { } } - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(b.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(b.id); P(hir::Block { - id: node_id, hir_id, stmts: stmts.into(), expr, @@ -3887,11 +3886,10 @@ impl<'a> LoweringContext<'a> { // Wrap the `if let` expr in a block. let span = els.span; let els = P(self.lower_expr(els)); - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); let blk = P(hir::Block { stmts: hir_vec![], expr: Some(els), - id: node_id, hir_id, rules: hir::DefaultBlock, span, @@ -4965,12 +4963,11 @@ impl<'a> LoweringContext<'a> { stmts: hir::HirVec, expr: Option>, ) -> hir::Block { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Block { stmts, expr, - id: node_id, hir_id, rules: hir::DefaultBlock, span, diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 1d7b28baed7f..53a63735cefb 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -822,7 +822,6 @@ pub struct Block { /// An expression at the end of the block /// without a semicolon, if any. pub expr: Option>, - pub id: NodeId, pub hir_id: HirId, /// Distinguishes between `unsafe { ... }` and `{ ... }`. pub rules: BlockCheckMode, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index ef13638ceb70..e12a1bc7f191 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -415,7 +415,6 @@ impl_stable_hash_for!(struct hir::MacroDef { impl_stable_hash_for!(struct hir::Block { stmts, expr, - id -> _, hir_id -> _, rules, span, diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 8da20ba42666..29cb40a9a673 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -629,7 +629,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { /// Indicates that the value of `blk` will be consumed, meaning either copied or moved /// depending on its type. fn walk_block(&mut self, blk: &hir::Block) { - debug!("walk_block(blk.id={})", blk.id); + debug!("walk_block(blk.hir_id={})", blk.hir_id); for stmt in &blk.stmts { self.walk_stmt(stmt); diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 03e16494b038..8cbc4bff3e15 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -950,7 +950,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { fn propagate_through_block(&mut self, blk: &hir::Block, succ: LiveNode) -> LiveNode { if blk.targeted_by_break { - self.break_ln.insert(blk.id, succ); + let node_id = self.ir.tcx.hir().hir_to_node_id(blk.hir_id); + self.break_ln.insert(node_id, succ); } let succ = self.propagate_through_opt_expr(blk.expr.as_ref().map(|e| &**e), succ); blk.stmts.iter().rev().fold(succ, |succ, stmt| { @@ -1386,7 +1387,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } } debug!("propagate_through_loop: using id for loop body {} {}", - expr.id, self.ir.tcx.hir().node_to_pretty_string(body.id)); + expr.id, self.ir.tcx.hir().hir_to_pretty_string(body.hir_id)); self.break_ln.insert(expr.id, succ); diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index fd188b33d7e1..3499138fb791 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -745,7 +745,7 @@ fn record_var_lifetime(visitor: &mut RegionResolutionVisitor<'_, '_>, } fn resolve_block<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, blk: &'tcx hir::Block) { - debug!("resolve_block(blk.id={:?})", blk.id); + debug!("resolve_block(blk.hir_id={:?})", blk.hir_id); let prev_cx = visitor.cx; diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 29beabdb2abd..c4e1860bd833 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -1,5 +1,6 @@ use std::{fmt, env}; +use crate::hir; use crate::hir::map::definitions::DefPathData; use crate::mir; use crate::ty::{self, Ty, layout}; @@ -14,7 +15,6 @@ use crate::ty::query::TyCtxtAt; use errors::DiagnosticBuilder; use syntax_pos::{Pos, Span}; -use syntax::ast; use syntax::symbol::Symbol; #[derive(Debug, Copy, Clone, PartialEq, Eq)] @@ -50,7 +50,7 @@ pub struct ConstEvalErr<'tcx> { pub struct FrameInfo<'tcx> { pub call_site: Span, // this span is in the caller! pub instance: ty::Instance<'tcx>, - pub lint_root: Option, + pub lint_root: Option, } impl<'tcx> fmt::Display for FrameInfo<'tcx> { @@ -98,7 +98,7 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> { pub fn report_as_lint(&self, tcx: TyCtxtAt<'a, 'gcx, 'tcx>, message: &str, - lint_root: ast::NodeId, + lint_root: hir::HirId, ) -> ErrorHandled { let lint = self.struct_generic( tcx, @@ -118,7 +118,7 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> { &self, tcx: TyCtxtAt<'a, 'gcx, 'tcx>, message: &str, - lint_root: Option, + lint_root: Option, ) -> Result, ErrorHandled> { match self.error { EvalErrorKind::Layout(LayoutError::Unknown(_)) | @@ -129,15 +129,15 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> { } trace!("reporting const eval failure at {:?}", self.span); let mut err = if let Some(lint_root) = lint_root { - let node_id = self.stacktrace + let hir_id = self.stacktrace .iter() .rev() .filter_map(|frame| frame.lint_root) .next() .unwrap_or(lint_root); - tcx.struct_span_lint_node( + tcx.struct_span_lint_hir( crate::rustc::lint::builtin::CONST_ERR, - node_id, + hir_id, tcx.span, message, ) diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 3513d652b534..f0bf31f47f59 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -413,7 +413,7 @@ pub enum Safety { /// Unsafe because of an unsafe fn FnUnsafe, /// Unsafe because of an `unsafe` block - ExplicitUnsafe(ast::NodeId), + ExplicitUnsafe(hir::HirId), } impl_stable_hash_for!(struct Mir<'tcx> { @@ -2098,8 +2098,8 @@ pub struct SourceScopeData { #[derive(Clone, Debug, RustcEncodable, RustcDecodable)] pub struct SourceScopeLocalData { - /// A NodeId with lint levels equivalent to this scope's lint levels. - pub lint_root: ast::NodeId, + /// A HirId with lint levels equivalent to this scope's lint levels. + pub lint_root: hir::HirId, /// The unsafe block that contains this node. pub safety: Safety, } @@ -2849,8 +2849,8 @@ pub enum UnsafetyViolationKind { General, /// Permitted in const fn and regular fns. GeneralAndConstFn, - ExternStatic(ast::NodeId), - BorrowPacked(ast::NodeId), + ExternStatic(hir::HirId), + BorrowPacked(hir::HirId), } #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] @@ -2867,7 +2867,7 @@ pub struct UnsafetyCheckResult { pub violations: Lrc<[UnsafetyViolation]>, /// unsafe blocks in this function, along with whether they are used. This is /// used for the "unused_unsafe" lint. - pub unsafe_blocks: Lrc<[(ast::NodeId, bool)]>, + pub unsafe_blocks: Lrc<[(hir::HirId, bool)]>, } /// The layout of generator state diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index b31aa5998f36..5c24b0ebfe05 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -10,6 +10,7 @@ use super::elaborate_predicates; +use crate::hir; use crate::hir::def_id::DefId; use crate::lint; use crate::traits::{self, Obligation, ObligationCause}; @@ -129,7 +130,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { // It's also hard to get a use site span, so we use the method definition span. self.lint_node_note( lint::builtin::WHERE_CLAUSES_OBJECT_SAFETY, - ast::CRATE_NODE_ID, + hir::CRATE_HIR_ID, *span, &format!("the trait `{}` cannot be made into an object", self.item_path_str(trait_def_id)), diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 6bb322251256..a71c0d4ab963 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -2859,11 +2859,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn lint_node_note>(self, lint: &'static Lint, - id: NodeId, + id: hir::HirId, span: S, msg: &str, note: &str) { - let mut err = self.struct_span_lint_node(lint, id, span.into(), msg); + let mut err = self.struct_span_lint_hir(lint, id, span.into(), msg); err.note(note); err.emit() } diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 4caf2ec676f0..b0b5594b93ea 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -420,8 +420,8 @@ impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> { } pprust_hir::AnnNode::Block(blk) => { s.s.space()?; - s.synth_comment(format!("block node_id: {} hir local_id: {}", - blk.id, blk.hir_id.local_id.as_u32())) + s.synth_comment(format!("block hir_id: {} hir local_id: {}", + blk.hir_id, blk.hir_id.local_id.as_u32())) } pprust_hir::AnnNode::Expr(expr) => { s.s.space()?; diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index f7d079c5494e..7fce5f92e0ca 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -301,7 +301,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( } let mut_span = tcx.sess.source_map().span_until_non_whitespace(span); - tcx.struct_span_lint_node( + tcx.struct_span_lint_hir( UNUSED_MUT, vsi[local_decl.source_info.scope].lint_root, span, diff --git a/src/librustc_mir/build/block.rs b/src/librustc_mir/build/block.rs index 7d93e131a6ca..499ec1900473 100644 --- a/src/librustc_mir/build/block.rs +++ b/src/librustc_mir/build/block.rs @@ -206,14 +206,14 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { debug!("update_source_scope_for({:?}, {:?})", span, safety_mode); let new_unsafety = match safety_mode { BlockSafety::Safe => None, - BlockSafety::ExplicitUnsafe(node_id) => { + BlockSafety::ExplicitUnsafe(hir_id) => { assert_eq!(self.push_unsafe_count, 0); match self.unpushed_unsafe { Safety::Safe => {} _ => return } - self.unpushed_unsafe = Safety::ExplicitUnsafe(node_id); - Some(Safety::ExplicitUnsafe(node_id)) + self.unpushed_unsafe = Safety::ExplicitUnsafe(hir_id); + Some(Safety::ExplicitUnsafe(hir_id)) } BlockSafety::PushUnsafe => { self.push_unsafe_count += 1; diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 64ab491cbd5b..5d8dc6ef8e45 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -72,13 +72,13 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t }; tcx.infer_ctxt().enter(|infcx| { - let cx = Cx::new(&infcx, id); + let fn_hir_id = tcx.hir().node_to_hir_id(id); + let cx = Cx::new(&infcx, fn_hir_id); let mut mir = if cx.tables().tainted_by_errors { build::construct_error(cx, body_id) } else if cx.body_owner_kind.is_fn_or_closure() { // fetch the fully liberated fn signature (that is, all bound // types/lifetimes replaced) - let fn_hir_id = tcx.hir().node_to_hir_id(id); let fn_sig = cx.tables().liberated_fn_sigs()[fn_hir_id].clone(); let fn_def_id = tcx.hir().local_def_id(id); diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs index 3392495f7a11..71acf747d085 100644 --- a/src/librustc_mir/build/scope.rs +++ b/src/librustc_mir/build/scope.rs @@ -308,17 +308,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { debug!("in_scope(region_scope={:?}, block={:?})", region_scope, block); let source_scope = self.source_scope; let tcx = self.hir.tcx(); - if let LintLevel::Explicit(node_id) = lint_level { + if let LintLevel::Explicit(current_hir_id) = lint_level { let same_lint_scopes = tcx.dep_graph.with_ignore(|| { let sets = tcx.lint_levels(LOCAL_CRATE); - let parent_hir_id = - tcx.hir().definitions().node_to_hir_id( - self.source_scope_local_data[source_scope].lint_root - ); - let current_hir_id = - tcx.hir().definitions().node_to_hir_id(node_id); - sets.lint_level_set(parent_hir_id) == - sets.lint_level_set(current_hir_id) + let parent_hir_id = self.source_scope_local_data[source_scope].lint_root; + sets.lint_level_set(parent_hir_id) == sets.lint_level_set(current_hir_id) }); if !same_lint_scopes { diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index 7be7f4b43928..1eb129c6fc3a 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -663,11 +663,11 @@ pub fn const_eval_raw_provider<'a, 'tcx>( // because any code that existed before validation could not have failed validation // thus preventing such a hard error from being a backwards compatibility hazard Some(Def::Const(_)) | Some(Def::AssociatedConst(_)) => { - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); err.report_as_lint( tcx.at(tcx.def_span(def_id)), "any use of this value will cause an error", - node_id, + hir_id, ) }, // promoting runtime code is only allowed to error if it references broken constants @@ -683,7 +683,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>( err.report_as_lint( tcx.at(span), "reaching this expression at runtime will panic or abort", - tcx.hir().as_local_node_id(def_id).unwrap(), + tcx.hir().as_local_hir_id(def_id).unwrap(), ) } // anything else (array lengths, enum initializers, constant patterns) are reported diff --git a/src/librustc_mir/hair/cx/block.rs b/src/librustc_mir/hair/cx/block.rs index 4a64ddb73fc2..b63bf4bc2468 100644 --- a/src/librustc_mir/hair/cx/block.rs +++ b/src/librustc_mir/hair/cx/block.rs @@ -30,7 +30,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Block { hir::BlockCheckMode::DefaultBlock => BlockSafety::Safe, hir::BlockCheckMode::UnsafeBlock(..) => - BlockSafety::ExplicitUnsafe(self.id), + BlockSafety::ExplicitUnsafe(self.hir_id), hir::BlockCheckMode::PushUnsafeBlock(..) => BlockSafety::PushUnsafe, hir::BlockCheckMode::PopUnsafeBlock(..) => diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index cd937d702fd7..d24a70528ec4 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -26,7 +26,7 @@ pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { tcx: TyCtxt<'a, 'gcx, 'tcx>, infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, - pub root_lint_level: ast::NodeId, + pub root_lint_level: hir::HirId, pub param_env: ty::ParamEnv<'gcx>, /// Identity `Substs` for use with const-evaluation. @@ -51,10 +51,10 @@ pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, - src_id: ast::NodeId) -> Cx<'a, 'gcx, 'tcx> { + src_id: hir::HirId) -> Cx<'a, 'gcx, 'tcx> { let tcx = infcx.tcx; - let src_def_id = tcx.hir().local_def_id(src_id); - let body_owner_kind = tcx.hir().body_owner_kind(src_id); + let src_def_id = tcx.hir().local_def_id_from_hir_id(src_id); + let body_owner_kind = tcx.hir().body_owner_kind_by_hir_id(src_id); let constness = match body_owner_kind { hir::BodyOwnerKind::Const | @@ -63,7 +63,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { hir::BodyOwnerKind::Fn => hir::Constness::NotConst, }; - let attrs = tcx.hir().attrs(src_id); + let attrs = tcx.hir().attrs_by_hir_id(src_id); // Some functions always have overflow checks enabled, // however, they may not get codegen'd, depending on @@ -204,7 +204,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { }); if has_lint_level { - LintLevel::Explicit(node_id) + LintLevel::Explicit(hir_id) } else { LintLevel::Inherited } @@ -237,7 +237,7 @@ impl UserAnnotatedTyHelpers<'gcx, 'tcx> for Cx<'_, 'gcx, 'tcx> { } } -fn lint_level_for_hir_id(tcx: TyCtxt<'_, '_, '_>, mut id: ast::NodeId) -> ast::NodeId { +fn lint_level_for_hir_id(tcx: TyCtxt<'_, '_, '_>, mut id: hir::HirId) -> hir::HirId { // Right now we insert a `with_ignore` node in the dep graph here to // ignore the fact that `lint_levels` below depends on the entire crate. // For now this'll prevent false positives of recompiling too much when @@ -249,11 +249,10 @@ fn lint_level_for_hir_id(tcx: TyCtxt<'_, '_, '_>, mut id: ast::NodeId) -> ast::N tcx.dep_graph.with_ignore(|| { let sets = tcx.lint_levels(LOCAL_CRATE); loop { - let hir_id = tcx.hir().definitions().node_to_hir_id(id); - if sets.lint_level_set(hir_id).is_some() { + if sets.lint_level_set(id).is_some() { return id } - let next = tcx.hir().get_parent_node(id); + let next = tcx.hir().get_parent_node_by_hir_id(id); if next == id { bug!("lint traversal reached the root of the crate"); } diff --git a/src/librustc_mir/hair/mod.rs b/src/librustc_mir/hair/mod.rs index e615b009cf37..22e44ae85a46 100644 --- a/src/librustc_mir/hair/mod.rs +++ b/src/librustc_mir/hair/mod.rs @@ -28,7 +28,7 @@ mod util; #[derive(Copy, Clone, Debug)] pub enum LintLevel { Inherited, - Explicit(ast::NodeId) + Explicit(hir::HirId) } impl LintLevel { @@ -54,7 +54,7 @@ pub struct Block<'tcx> { #[derive(Copy, Clone, Debug)] pub enum BlockSafety { Safe, - ExplicitUnsafe(ast::NodeId), + ExplicitUnsafe(hir::HirId), PushUnsafe, PopUnsafe } diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 66529e579835..3ed63d749cd3 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -12,7 +12,6 @@ use rustc::lint::builtin::{SAFE_EXTERN_STATICS, SAFE_PACKED_BORROWS, UNUSED_UNSA use rustc::mir::*; use rustc::mir::visit::{PlaceContext, Visitor, MutatingUseContext}; -use syntax::ast; use syntax::symbol::Symbol; use std::ops::Bound; @@ -29,8 +28,8 @@ pub struct UnsafetyChecker<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, /// Mark an `unsafe` block as used, so we don't lint it. - used_unsafe: FxHashSet, - inherited_blocks: Vec<(ast::NodeId, bool)>, + used_unsafe: FxHashSet, + inherited_blocks: Vec<(hir::HirId, bool)>, } impl<'a, 'gcx, 'tcx> UnsafetyChecker<'a, 'tcx> { @@ -349,7 +348,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { fn register_violations(&mut self, violations: &[UnsafetyViolation], - unsafe_blocks: &[(ast::NodeId, bool)]) { + unsafe_blocks: &[(hir::HirId, bool)]) { let safety = self.source_scope_local_data[self.source_info.scope].safety; let within_unsafe = match safety { // `unsafe` blocks are required in safe code @@ -375,10 +374,10 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { } // `unsafe` function bodies allow unsafe without additional unsafe blocks Safety::BuiltinUnsafe | Safety::FnUnsafe => true, - Safety::ExplicitUnsafe(node_id) => { + Safety::ExplicitUnsafe(hir_id) => { // mark unsafe block as used if there are any unsafe operations inside if !violations.is_empty() { - self.used_unsafe.insert(node_id); + self.used_unsafe.insert(hir_id); } // only some unsafety is allowed in const fn if self.min_const_fn { @@ -405,8 +404,8 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { true } }; - self.inherited_blocks.extend(unsafe_blocks.iter().map(|&(node_id, is_used)| { - (node_id, is_used && !within_unsafe) + self.inherited_blocks.extend(unsafe_blocks.iter().map(|&(hir_id, is_used)| { + (hir_id, is_used && !within_unsafe) })); } fn check_mut_borrowing_layout_constrained_field( @@ -467,8 +466,8 @@ pub(crate) fn provide(providers: &mut Providers<'_>) { } struct UnusedUnsafeVisitor<'a> { - used_unsafe: &'a FxHashSet, - unsafe_blocks: &'a mut Vec<(ast::NodeId, bool)>, + used_unsafe: &'a FxHashSet, + unsafe_blocks: &'a mut Vec<(hir::HirId, bool)>, } impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> { @@ -482,19 +481,19 @@ impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> { hir::intravisit::walk_block(self, block); if let hir::UnsafeBlock(hir::UserProvided) = block.rules { - self.unsafe_blocks.push((block.id, self.used_unsafe.contains(&block.id))); + self.unsafe_blocks.push((block.hir_id, self.used_unsafe.contains(&block.hir_id))); } } } fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, - used_unsafe: &FxHashSet, - unsafe_blocks: &'a mut Vec<(ast::NodeId, bool)>) + used_unsafe: &FxHashSet, + unsafe_blocks: &'a mut Vec<(hir::HirId, bool)>) { let body_id = - tcx.hir().as_local_node_id(def_id).and_then(|node_id| { - tcx.hir().maybe_body_owned_by(node_id) + tcx.hir().as_local_hir_id(def_id).and_then(|hir_id| { + tcx.hir().maybe_body_owned_by_by_hir_id(hir_id) }); let body_id = match body_id { @@ -574,18 +573,18 @@ fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: D &message); } -/// Returns the `NodeId` for an enclosing scope that is also `unsafe`. +/// Returns the `HirId` for an enclosing scope that is also `unsafe`. fn is_enclosed(tcx: TyCtxt<'_, '_, '_>, - used_unsafe: &FxHashSet, - id: ast::NodeId) -> Option<(String, ast::NodeId)> { - let parent_id = tcx.hir().get_parent_node(id); + used_unsafe: &FxHashSet, + id: hir::HirId) -> Option<(String, hir::HirId)> { + let parent_id = tcx.hir().get_parent_node_by_hir_id(id); if parent_id != id { if used_unsafe.contains(&parent_id) { Some(("block".to_string(), parent_id)) } else if let Some(Node::Item(&hir::Item { node: hir::ItemKind::Fn(_, header, _, _), .. - })) = tcx.hir().find(parent_id) { + })) = tcx.hir().find_by_hir_id(parent_id) { match header.unsafety { hir::Unsafety::Unsafe => Some(("fn".to_string(), parent_id)), hir::Unsafety::Normal => None, @@ -599,14 +598,14 @@ fn is_enclosed(tcx: TyCtxt<'_, '_, '_>, } fn report_unused_unsafe(tcx: TyCtxt<'_, '_, '_>, - used_unsafe: &FxHashSet, - id: ast::NodeId) { - let span = tcx.sess.source_map().def_span(tcx.hir().span(id)); + used_unsafe: &FxHashSet, + id: hir::HirId) { + let span = tcx.sess.source_map().def_span(tcx.hir().span_by_hir_id(id)); let msg = "unnecessary `unsafe` block"; - let mut db = tcx.struct_span_lint_node(UNUSED_UNSAFE, id, span, msg); + let mut db = tcx.struct_span_lint_hir(UNUSED_UNSAFE, id, span, msg); db.span_label(span, msg); if let Some((kind, id)) = is_enclosed(tcx, used_unsafe, id) { - db.span_label(tcx.sess.source_map().def_span(tcx.hir().span(id)), + db.span_label(tcx.sess.source_map().def_span(tcx.hir().span_by_hir_id(id)), format!("because it's nested under this `unsafe` {}", kind)); } db.emit(); @@ -655,20 +654,20 @@ pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { .note(&details.as_str()[..]) .emit(); } - UnsafetyViolationKind::ExternStatic(lint_node_id) => { + UnsafetyViolationKind::ExternStatic(lint_hir_id) => { tcx.lint_node_note(SAFE_EXTERN_STATICS, - lint_node_id, + lint_hir_id, source_info.span, &format!("{} is unsafe and requires unsafe function or block \ (error E0133)", &description.as_str()[..]), &details.as_str()[..]); } - UnsafetyViolationKind::BorrowPacked(lint_node_id) => { + UnsafetyViolationKind::BorrowPacked(lint_hir_id) => { if let Some(impl_def_id) = builtin_derive_def_id(tcx, def_id) { tcx.unsafe_derive_on_repr_packed(impl_def_id); } else { tcx.lint_node_note(SAFE_PACKED_BORROWS, - lint_node_id, + lint_hir_id, source_info.span, &format!("{} is unsafe and requires unsafe function or block \ (error E0133)", &description.as_str()[..]), @@ -679,7 +678,7 @@ pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { } let mut unsafe_blocks: Vec<_> = unsafe_blocks.into_iter().collect(); - unsafe_blocks.sort(); + unsafe_blocks.sort_by_cached_key(|(hir_id, _)| tcx.hir().hir_to_node_id(*hir_id)); let used_unsafe: FxHashSet<_> = unsafe_blocks.iter() .flat_map(|&&(id, used)| if used { Some(id) } else { None }) .collect(); diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 7da00c4ea0c3..24fe7d43883f 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -430,10 +430,10 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { } else { "left" }; - let node_id = source_scope_local_data[source_info.scope].lint_root; - self.tcx.lint_node( + let hir_id = source_scope_local_data[source_info.scope].lint_root; + self.tcx.lint_hir( ::rustc::lint::builtin::EXCEEDING_BITSHIFTS, - node_id, + hir_id, span, &format!("attempt to shift {} with overflow", dir)); return None; diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index 722af8f0e778..f602ed24acd4 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -86,7 +86,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.param_env, liberated_sig, decl, - expr.id, + expr.hir_id, body, gen, ).1; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index def0886dcb20..61fc58ec8618 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -388,14 +388,14 @@ impl Needs { #[derive(Copy, Clone)] pub struct UnsafetyState { - pub def: ast::NodeId, + pub def: hir::HirId, pub unsafety: hir::Unsafety, pub unsafe_push_count: u32, from_fn: bool } impl UnsafetyState { - pub fn function(unsafety: hir::Unsafety, def: ast::NodeId) -> UnsafetyState { + pub fn function(unsafety: hir::Unsafety, def: hir::HirId) -> UnsafetyState { UnsafetyState { def: def, unsafety: unsafety, unsafe_push_count: 0, from_fn: true } } @@ -410,11 +410,11 @@ impl UnsafetyState { unsafety => { let (unsafety, def, count) = match blk.rules { hir::PushUnsafeBlock(..) => - (unsafety, blk.id, self.unsafe_push_count.checked_add(1).unwrap()), + (unsafety, blk.hir_id, self.unsafe_push_count.checked_add(1).unwrap()), hir::PopUnsafeBlock(..) => - (unsafety, blk.id, self.unsafe_push_count.checked_sub(1).unwrap()), + (unsafety, blk.hir_id, self.unsafe_push_count.checked_sub(1).unwrap()), hir::UnsafeBlock(..) => - (hir::Unsafety::Unsafe, blk.id, self.unsafe_push_count), + (hir::Unsafety::Unsafe, blk.hir_id, self.unsafe_push_count), hir::DefaultBlock => (unsafety, self.def, self.unsafe_push_count), }; @@ -770,10 +770,10 @@ fn adt_destructor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, /// (notably closures), `typeck_tables(def_id)` would wind up /// redirecting to the owning function. fn primary_body_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - id: ast::NodeId) + id: hir::HirId) -> Option<(hir::BodyId, Option<&'tcx hir::FnDecl>)> { - match tcx.hir().get(id) { + match tcx.hir().get_by_hir_id(id) { Node::Item(item) => { match item.node { hir::ItemKind::Const(_, body) | @@ -820,7 +820,7 @@ fn has_typeck_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, return tcx.has_typeck_tables(outer_def_id); } - let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); primary_body_of(tcx, id).is_some() } @@ -840,8 +840,8 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, return tcx.typeck_tables_of(outer_def_id); } - let id = tcx.hir().as_local_node_id(def_id).unwrap(); - let span = tcx.hir().span(id); + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let span = tcx.hir().span_by_hir_id(id); // Figure out what primary body this item has. let (body_id, fn_decl) = primary_body_of(tcx, id).unwrap_or_else(|| { @@ -925,8 +925,8 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Consistency check our TypeckTables instance can hold all ItemLocalIds // it will need to hold. - assert_eq!(tables.local_id_root, - Some(DefId::local(tcx.hir().definitions().node_to_hir_id(id).owner))); + assert_eq!(tables.local_id_root, Some(DefId::local(id.owner))); + tables } @@ -939,7 +939,7 @@ fn check_abi<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: Span, abi: Abi) { struct GatherLocalsVisitor<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { fcx: &'a FnCtxt<'a, 'gcx, 'tcx>, - parent_id: ast::NodeId, + parent_id: hir::HirId, } impl<'a, 'gcx, 'tcx> GatherLocalsVisitor<'a, 'gcx, 'tcx> { @@ -1051,7 +1051,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, fn_sig: ty::FnSig<'tcx>, decl: &'gcx hir::FnDecl, - fn_id: ast::NodeId, + fn_id: hir::HirId, body: &'gcx hir::Body, can_be_generator: Option) -> (FnCtxt<'a, 'gcx, 'tcx>, Option>) @@ -1085,9 +1085,9 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, fcx.yield_ty = Some(yield_ty); } - let outer_def_id = fcx.tcx.closure_base_def_id(fcx.tcx.hir().local_def_id(fn_id)); - let outer_node_id = fcx.tcx.hir().as_local_node_id(outer_def_id).unwrap(); - GatherLocalsVisitor { fcx: &fcx, parent_id: outer_node_id, }.visit_body(body); + let outer_def_id = fcx.tcx.closure_base_def_id(fcx.tcx.hir().local_def_id_from_hir_id(fn_id)); + let outer_hir_id = fcx.tcx.hir().as_local_hir_id(outer_def_id).unwrap(); + GatherLocalsVisitor { fcx: &fcx, parent_id: outer_hir_id, }.visit_body(body); // Add formal parameters. for (arg_ty, arg) in fn_sig.inputs().iter().zip(&body.arguments) { @@ -1110,8 +1110,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, fcx.write_ty(arg.hir_id, arg_ty); } - let fn_hir_id = fcx.tcx.hir().node_to_hir_id(fn_id); - inherited.tables.borrow_mut().liberated_fn_sigs_mut().insert(fn_hir_id, fn_sig); + inherited.tables.borrow_mut().liberated_fn_sigs_mut().insert(fn_id, fn_sig); fcx.check_return_expr(&body.value); @@ -1164,14 +1163,13 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, // Check that the main return type implements the termination trait. if let Some(term_id) = fcx.tcx.lang_items().termination() { if let Some((def_id, EntryFnType::Main)) = fcx.tcx.entry_fn(LOCAL_CRATE) { - let main_id = fcx.tcx.hir().as_local_node_id(def_id).unwrap(); + let main_id = fcx.tcx.hir().as_local_hir_id(def_id).unwrap(); if main_id == fn_id { let substs = fcx.tcx.mk_substs_trait(declared_ret_ty, &[]); let trait_ref = ty::TraitRef::new(term_id, substs); let return_ty_span = decl.output.span(); - let fn_hir_id = fcx.tcx.hir().node_to_hir_id(fn_id); let cause = traits::ObligationCause::new( - return_ty_span, fn_hir_id, ObligationCauseCode::MainFunctionType); + return_ty_span, fn_id, ObligationCauseCode::MainFunctionType); inherited.register_predicate( traits::Obligation::new( @@ -1182,7 +1180,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, // Check that a function marked as `#[panic_handler]` has signature `fn(&PanicInfo) -> !` if let Some(panic_impl_did) = fcx.tcx.lang_items().panic_impl() { - if panic_impl_did == fcx.tcx.hir().local_def_id(fn_id) { + if panic_impl_did == fcx.tcx.hir().local_def_id_from_hir_id(fn_id) { if let Some(panic_info_did) = fcx.tcx.lang_items().panic_info() { // at this point we don't care if there are duplicate handlers or if the handler has // the wrong signature as this value we'll be used when writing metadata and that @@ -1197,7 +1195,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, } let inputs = fn_sig.inputs(); - let span = fcx.tcx.hir().span(fn_id); + let span = fcx.tcx.hir().span_by_hir_id(fn_id); if inputs.len() == 1 { let arg_is_panic_info = match inputs[0].sty { ty::Ref(region, ty, mutbl) => match ty.sty { @@ -1218,7 +1216,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, ); } - if let Node::Item(item) = fcx.tcx.hir().get(fn_id) { + if let Node::Item(item) = fcx.tcx.hir().get_by_hir_id(fn_id) { if let ItemKind::Fn(_, _, ref generics, _) = item.node { if !generics.params.is_empty() { fcx.tcx.sess.span_err( @@ -1240,7 +1238,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, // Check that a function marked as `#[alloc_error_handler]` has signature `fn(Layout) -> !` if let Some(alloc_error_handler_did) = fcx.tcx.lang_items().oom() { - if alloc_error_handler_did == fcx.tcx.hir().local_def_id(fn_id) { + if alloc_error_handler_did == fcx.tcx.hir().local_def_id_from_hir_id(fn_id) { if let Some(alloc_layout_did) = fcx.tcx.lang_items().alloc_layout() { if declared_ret_ty.sty != ty::Never { fcx.tcx.sess.span_err( @@ -1250,7 +1248,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, } let inputs = fn_sig.inputs(); - let span = fcx.tcx.hir().span(fn_id); + let span = fcx.tcx.hir().span_by_hir_id(fn_id); if inputs.len() == 1 { let arg_is_alloc_layout = match inputs[0].sty { ty::Adt(ref adt, _) => { @@ -1266,7 +1264,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, ); } - if let Node::Item(item) = fcx.tcx.hir().get(fn_id) { + if let Node::Item(item) = fcx.tcx.hir().get_by_hir_id(fn_id) { if let ItemKind::Fn(_, _, ref generics, _) = item.node { if !generics.params.is_empty() { fcx.tcx.sess.span_err( @@ -2030,7 +2028,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ret_coercion_span: RefCell::new(None), yield_ty: None, ps: RefCell::new(UnsafetyState::function(hir::Unsafety::Normal, - ast::CRATE_NODE_ID)), + hir::CRATE_HIR_ID)), diverges: Cell::new(Diverges::Maybe), has_errors: Cell::new(false), enclosing_breakables: RefCell::new(EnclosingBreakables { @@ -2339,10 +2337,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// `InferCtxt::instantiate_opaque_types` for more details. fn instantiate_opaque_types_from_value>( &self, - parent_id: ast::NodeId, + parent_id: hir::HirId, value: &T, ) -> T { - let parent_def_id = self.tcx.hir().local_def_id(parent_id); + let parent_def_id = self.tcx.hir().local_def_id_from_hir_id(parent_id); debug!("instantiate_opaque_types_from_value(parent_def_id={:?}, value={:?})", parent_def_id, value); @@ -4937,7 +4935,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { may_break: false, }; - let (ctxt, ()) = self.with_breakable_ctxt(blk.id, ctxt, || { + let blk_node_id = self.tcx.hir().hir_to_node_id(blk.hir_id); + let (ctxt, ()) = self.with_breakable_ctxt(blk_node_id, ctxt, || { for s in &blk.stmts { self.check_stmt(s); } @@ -4947,12 +4946,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let tail_expr_ty = tail_expr.map(|t| self.check_expr_with_expectation(t, expected)); let mut enclosing_breakables = self.enclosing_breakables.borrow_mut(); - let ctxt = enclosing_breakables.find_breakable(blk.id); + let ctxt = enclosing_breakables.find_breakable(blk_node_id); let coerce = ctxt.coerce.as_mut().unwrap(); if let Some(tail_expr_ty) = tail_expr_ty { let tail_expr = tail_expr.unwrap(); let cause = self.cause(tail_expr.span, - ObligationCauseCode::BlockTailExpression(blk.id)); + ObligationCauseCode::BlockTailExpression(blk_node_id)); coerce.coerce(self, &cause, tail_expr, @@ -4976,9 +4975,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // that highlight errors inline. let mut sp = blk.span; let mut fn_span = None; - if let Some((decl, ident)) = self.get_parent_fn_decl(blk.id) { + if let Some((decl, ident)) = self.get_parent_fn_decl(blk_node_id) { let ret_sp = decl.output.span(); - if let Some(block_sp) = self.parent_item_span(blk.id) { + if let Some(block_sp) = self.parent_item_span(blk_node_id) { // HACK: on some cases (`ui/liveness/liveness-issue-2163.rs`) the // output would otherwise be incorrect and even misleading. Make sure // the span we're aiming at correspond to a `fn` body. diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index 08bc861766b8..5279fbd9cf6e 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -90,7 +90,6 @@ use rustc_data_structures::sync::Lrc; use std::mem; use std::ops::Deref; use std::rc::Rc; -use syntax::ast; use syntax_pos::Span; // a variation on try that just returns unit @@ -163,7 +162,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// rest of type check and because sometimes we need type /// inference to have completed before we can determine which /// constraints to add. - pub fn regionck_fn(&self, fn_id: ast::NodeId, body: &'gcx hir::Body) { + pub fn regionck_fn(&self, fn_id: hir::HirId, body: &'gcx hir::Body) { debug!("regionck_fn(id={})", fn_id); let subject = self.tcx.hir().body_owner_def_id(body.id()); let hir_id = body.value.hir_id; @@ -176,9 +175,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); if self.err_count_since_creation() == 0 { - let fn_hir_id = self.tcx.hir().node_to_hir_id(fn_id); // regionck assumes typeck succeeded - rcx.visit_fn_body(fn_hir_id, body, self.tcx.hir().span_by_hir_id(fn_hir_id)); + rcx.visit_fn_body(fn_id, body, self.tcx.hir().span_by_hir_id(fn_id)); } rcx.resolve_regions_and_report_errors(SuppressRegionErrors::when_nll_is_enabled(self.tcx)); From d7ced1dd5a6a58ed59b12b693fa1b45aadec0a9c Mon Sep 17 00:00:00 2001 From: ljedrz Date: Sun, 24 Feb 2019 09:33:17 +0100 Subject: [PATCH 050/381] hir: remove NodeId from Expr --- src/librustc/cfg/construct.rs | 2 +- src/librustc/hir/lowering.rs | 16 +-- src/librustc/hir/map/blocks.rs | 22 +-- src/librustc/hir/map/mod.rs | 7 +- src/librustc/hir/mod.rs | 3 +- src/librustc/ich/impls_hir.rs | 1 - src/librustc/lint/mod.rs | 22 +-- src/librustc/middle/dead.rs | 10 +- src/librustc/middle/expr_use_visitor.rs | 47 ++++--- src/librustc/middle/liveness.rs | 36 ++--- src/librustc/middle/mem_categorization.rs | 8 +- src/librustc/middle/stability.rs | 22 +-- src/librustc/traits/mod.rs | 4 +- src/librustc/ty/mod.rs | 3 +- src/librustc_borrowck/borrowck/check_loans.rs | 19 ++- .../borrowck/gather_loans/mod.rs | 15 +- src/librustc_driver/pretty.rs | 14 +- src/librustc_lint/builtin.rs | 2 +- src/librustc_lint/types.rs | 14 +- src/librustc_lint/unused.rs | 4 +- src/librustc_metadata/encoder.rs | 2 +- src/librustc_mir/hair/cx/block.rs | 2 +- src/librustc_mir/hair/cx/expr.rs | 13 +- src/librustc_mir/hair/cx/mod.rs | 3 +- src/librustc_mir/hair/pattern/check_match.rs | 10 +- src/librustc_mir/hair/pattern/mod.rs | 2 +- src/librustc_passes/rvalue_promotion.rs | 23 +-- src/librustc_privacy/lib.rs | 9 +- src/librustc_save_analysis/dump_visitor.rs | 3 +- src/librustc_typeck/astconv.rs | 7 +- src/librustc_typeck/check/_match.rs | 27 ++-- src/librustc_typeck/check/callee.rs | 2 +- src/librustc_typeck/check/cast.rs | 6 +- src/librustc_typeck/check/closure.rs | 6 +- src/librustc_typeck/check/coercion.rs | 13 +- src/librustc_typeck/check/demand.rs | 17 ++- src/librustc_typeck/check/method/mod.rs | 10 +- src/librustc_typeck/check/method/probe.rs | 17 ++- src/librustc_typeck/check/mod.rs | 131 +++++++++--------- src/librustc_typeck/check/op.rs | 8 +- src/librustc_typeck/check/regionck.rs | 4 +- src/librustc_typeck/check/upvar.rs | 15 +- src/librustc_typeck/check/writeback.rs | 9 +- src/librustc_typeck/collect.rs | 2 +- 44 files changed, 307 insertions(+), 305 deletions(-) diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs index 9eeae6eeb5f3..30a0477467d8 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -398,7 +398,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { args: I) -> CFGIndex { let func_or_rcvr_exit = self.expr(func_or_rcvr, pred); let ret = self.straightline(call_expr, func_or_rcvr_exit, args); - let m = self.tcx.hir().get_module_parent(call_expr.id); + let m = self.tcx.hir().get_module_parent_by_hir_id(call_expr.hir_id); if self.tcx.is_ty_uninhabited_from(m, self.tables.expr_ty(call_expr)) { self.add_unreachable_node() } else { diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 769cfbe5b4c6..0211dd728756 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -963,7 +963,6 @@ impl<'a> LoweringContext<'a> { let closure_hir_id = self.lower_node_id(closure_node_id).hir_id; let decl = self.lower_fn_decl(&decl, None, /* impl trait allowed */ false, None); let generator = hir::Expr { - id: closure_node_id, hir_id: closure_hir_id, node: hir::ExprKind::Closure(capture_clause, decl, body_id, span, Some(hir::GeneratorMovability::Static)), @@ -3932,10 +3931,9 @@ impl<'a> LoweringContext<'a> { let mut block = this.lower_block(body, true).into_inner(); let tail = block.expr.take().map_or_else( || { - let LoweredNodeId { node_id, hir_id } = this.next_id(); + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); let span = this.sess.source_map().end_point(unstable_span); hir::Expr { - id: node_id, span, node: hir::ExprKind::Tup(hir_vec![]), attrs: ThinVec::new(), @@ -4120,10 +4118,9 @@ impl<'a> LoweringContext<'a> { let struct_path = self.std_path(e.span, &struct_path, None, is_unit); let struct_path = hir::QPath::Resolved(None, P(struct_path)); - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(e.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(e.id); return hir::Expr { - id: node_id, hir_id, node: if is_unit { hir::ExprKind::Path(struct_path) @@ -4473,9 +4470,8 @@ impl<'a> LoweringContext<'a> { self.lower_label(opt_label), hir::LoopSource::ForLoop, ); - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(e.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(e.id); let loop_expr = P(hir::Expr { - id: node_id, hir_id, node: loop_expr, span: e.span, @@ -4620,10 +4616,9 @@ impl<'a> LoweringContext<'a> { ExprKind::Mac(_) => panic!("Shouldn't exist here"), }; - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(e.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(e.id); hir::Expr { - id: node_id, hir_id, node: kind, span: e.span, @@ -4895,9 +4890,8 @@ impl<'a> LoweringContext<'a> { } fn expr(&mut self, span: Span, node: hir::ExprKind, attrs: ThinVec) -> hir::Expr { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Expr { - id: node_id, hir_id, node, span, diff --git a/src/librustc/hir/map/blocks.rs b/src/librustc/hir/map/blocks.rs index 6919628c7675..1114ef52bbc0 100644 --- a/src/librustc/hir/map/blocks.rs +++ b/src/librustc/hir/map/blocks.rs @@ -75,10 +75,10 @@ pub enum Code<'a> { } impl<'a> Code<'a> { - pub fn id(&self) -> NodeId { + pub fn id(&self) -> ast::HirId { match *self { Code::FnLike(node) => node.id(), - Code::Expr(block) => block.id, + Code::Expr(block) => block.hir_id, } } @@ -104,7 +104,7 @@ struct ItemFnParts<'a> { vis: &'a ast::Visibility, generics: &'a ast::Generics, body: ast::BodyId, - id: NodeId, + id: ast::HirId, span: Span, attrs: &'a [Attribute], } @@ -114,13 +114,13 @@ struct ItemFnParts<'a> { struct ClosureParts<'a> { decl: &'a FnDecl, body: ast::BodyId, - id: NodeId, + id: ast::HirId, span: Span, attrs: &'a [Attribute], } impl<'a> ClosureParts<'a> { - fn new(d: &'a FnDecl, b: ast::BodyId, id: NodeId, s: Span, attrs: &'a [Attribute]) -> Self { + fn new(d: &'a FnDecl, b: ast::BodyId, id: ast::HirId, s: Span, attrs: &'a [Attribute]) -> Self { ClosureParts { decl: d, body: b, @@ -168,7 +168,7 @@ impl<'a> FnLikeNode<'a> { |c: ClosureParts<'_>| c.span) } - pub fn id(self) -> NodeId { + pub fn id(self) -> ast::HirId { self.handle(|i: ItemFnParts<'_>| i.id, |id, _, _: &'a ast::MethodSig, _, _, _, _| id, |c: ClosureParts<'_>| c.id) @@ -213,7 +213,7 @@ impl<'a> FnLikeNode<'a> { fn handle(self, item_fn: I, method: M, closure: C) -> A where I: FnOnce(ItemFnParts<'a>) -> A, - M: FnOnce(NodeId, + M: FnOnce(ast::HirId, Ident, &'a ast::MethodSig, Option<&'a ast::Visibility>, @@ -227,7 +227,7 @@ impl<'a> FnLikeNode<'a> { map::Node::Item(i) => match i.node { ast::ItemKind::Fn(ref decl, header, ref generics, block) => item_fn(ItemFnParts { - id: i.id, + id: i.hir_id, ident: i.ident, decl: &decl, body: block, @@ -241,21 +241,21 @@ impl<'a> FnLikeNode<'a> { }, map::Node::TraitItem(ti) => match ti.node { ast::TraitItemKind::Method(ref sig, ast::TraitMethod::Provided(body)) => { - method(ti.id, ti.ident, sig, None, body, ti.span, &ti.attrs) + method(ti.hir_id, ti.ident, sig, None, body, ti.span, &ti.attrs) } _ => bug!("trait method FnLikeNode that is not fn-like"), }, map::Node::ImplItem(ii) => { match ii.node { ast::ImplItemKind::Method(ref sig, body) => { - method(ii.id, ii.ident, sig, Some(&ii.vis), body, ii.span, &ii.attrs) + method(ii.hir_id, ii.ident, sig, Some(&ii.vis), body, ii.span, &ii.attrs) } _ => bug!("impl method FnLikeNode that is not fn-like") } }, map::Node::Expr(e) => match e.node { ast::ExprKind::Closure(_, ref decl, block, _fn_decl_span, _gen) => - closure(ClosureParts::new(&decl, block, e.id, e.span, &e.attrs)), + closure(ClosureParts::new(&decl, block, e.hir_id, e.span, &e.attrs)), _ => bug!("expr FnLikeNode that is not fn-like"), }, _ => bug!("other FnLikeNode that is not fn-like"), diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 5339d0fa0ecd..41e48e46ea5b 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -799,7 +799,7 @@ impl<'hir> Map<'hir> { /// false /// } /// ``` - pub fn get_return_block(&self, id: NodeId) -> Option { + pub fn get_return_block(&self, id: HirId) -> Option { let match_fn = |node: &Node<'_>| { match *node { Node::Item(_) | @@ -822,7 +822,10 @@ impl<'hir> Map<'hir> { } }; - self.walk_parent_nodes(id, match_fn, match_non_returning_block).ok() + let node_id = self.hir_to_node_id(id); + self.walk_parent_nodes(node_id, match_fn, match_non_returning_block) + .ok() + .map(|return_node_id| self.node_to_hir_id(return_node_id)) } /// Retrieves the `NodeId` for `id`'s parent item, or `id` itself if no diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 53a63735cefb..497825e203e2 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1333,7 +1333,6 @@ pub struct AnonConst { /// An expression #[derive(Clone, RustcEncodable, RustcDecodable)] pub struct Expr { - pub id: NodeId, pub span: Span, pub node: ExprKind, pub attrs: ThinVec, @@ -1436,7 +1435,7 @@ impl Expr { impl fmt::Debug for Expr { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "expr({}: {})", self.id, + write!(f, "expr({}: {})", self.hir_id, print::to_string(print::NO_ANN, |s| s.print_expr(self))) } } diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index e12a1bc7f191..d1161dda1e2f 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -559,7 +559,6 @@ impl<'a> HashStable> for hir::Expr { hasher: &mut StableHasher) { hcx.while_hashing_hir_bodies(true, |hcx| { let hir::Expr { - id: _, hir_id: _, ref span, ref node, diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index 6c60f3f5a80a..dd003e44bea0 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -723,7 +723,7 @@ fn lint_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, cnum: CrateNum) }; let krate = tcx.hir().krate(); - builder.with_lint_attrs(ast::CRATE_NODE_ID, &krate.attrs, |builder| { + builder.with_lint_attrs(hir::CRATE_HIR_ID, &krate.attrs, |builder| { intravisit::walk_crate(builder, krate); }); @@ -737,13 +737,13 @@ struct LintLevelMapBuilder<'a, 'tcx: 'a> { impl<'a, 'tcx> LintLevelMapBuilder<'a, 'tcx> { fn with_lint_attrs(&mut self, - id: ast::NodeId, + id: hir::HirId, attrs: &[ast::Attribute], f: F) where F: FnOnce(&mut Self) { let push = self.levels.push(attrs); - self.levels.register_id(self.tcx.hir().definitions().node_to_hir_id(id)); + self.levels.register_id(id); f(self); self.levels.pop(push); } @@ -755,25 +755,25 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'a, 'tcx> { } fn visit_item(&mut self, it: &'tcx hir::Item) { - self.with_lint_attrs(it.id, &it.attrs, |builder| { + self.with_lint_attrs(it.hir_id, &it.attrs, |builder| { intravisit::walk_item(builder, it); }); } fn visit_foreign_item(&mut self, it: &'tcx hir::ForeignItem) { - self.with_lint_attrs(it.id, &it.attrs, |builder| { + self.with_lint_attrs(it.hir_id, &it.attrs, |builder| { intravisit::walk_foreign_item(builder, it); }) } fn visit_expr(&mut self, e: &'tcx hir::Expr) { - self.with_lint_attrs(e.id, &e.attrs, |builder| { + self.with_lint_attrs(e.hir_id, &e.attrs, |builder| { intravisit::walk_expr(builder, e); }) } fn visit_struct_field(&mut self, s: &'tcx hir::StructField) { - self.with_lint_attrs(s.id, &s.attrs, |builder| { + self.with_lint_attrs(s.hir_id, &s.attrs, |builder| { intravisit::walk_struct_field(builder, s); }) } @@ -782,25 +782,25 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'a, 'tcx> { v: &'tcx hir::Variant, g: &'tcx hir::Generics, item_id: hir::HirId) { - self.with_lint_attrs(v.node.data.id(), &v.node.attrs, |builder| { + self.with_lint_attrs(v.node.data.hir_id(), &v.node.attrs, |builder| { intravisit::walk_variant(builder, v, g, item_id); }) } fn visit_local(&mut self, l: &'tcx hir::Local) { - self.with_lint_attrs(l.id, &l.attrs, |builder| { + self.with_lint_attrs(l.hir_id, &l.attrs, |builder| { intravisit::walk_local(builder, l); }) } fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) { - self.with_lint_attrs(trait_item.id, &trait_item.attrs, |builder| { + self.with_lint_attrs(trait_item.hir_id, &trait_item.attrs, |builder| { intravisit::walk_trait_item(builder, trait_item); }); } fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) { - self.with_lint_attrs(impl_item.id, &impl_item.attrs, |builder| { + self.with_lint_attrs(impl_item.hir_id, &impl_item.attrs, |builder| { intravisit::walk_impl_item(builder, impl_item); }); } diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 878d93c66cc2..201a779ee182 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -99,10 +99,10 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { } } - fn handle_field_access(&mut self, lhs: &hir::Expr, node_id: ast::NodeId) { + fn handle_field_access(&mut self, lhs: &hir::Expr, hir_id: hir::HirId) { match self.tables.expr_ty_adjusted(lhs).sty { ty::Adt(def, _) => { - let index = self.tcx.field_index(node_id, self.tables); + let index = self.tcx.field_index(hir_id, self.tables); self.insert_def_id(def.non_enum_variant().fields[index].did); } ty::Tuple(..) => {} @@ -120,7 +120,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { if let PatKind::Wild = pat.node.pat.node { continue; } - let index = self.tcx.field_index(pat.node.id, self.tables); + let index = self.tcx.field_index(pat.node.hir_id, self.tables); self.insert_def_id(variant.fields[index].did); } } @@ -190,7 +190,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { fn mark_as_used_if_union(&mut self, adt: &ty::AdtDef, fields: &hir::HirVec) { if adt.is_union() && adt.non_enum_variant().fields.len() > 1 && adt.did.is_local() { for field in fields { - let index = self.tcx.field_index(field.id, self.tables); + let index = self.tcx.field_index(field.hir_id, self.tables); self.insert_def_id(adt.non_enum_variant().fields[index].did); } } @@ -232,7 +232,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> { self.lookup_and_handle_method(expr.hir_id); } hir::ExprKind::Field(ref lhs, ..) => { - self.handle_field_access(&lhs, expr.id); + self.handle_field_access(&lhs, expr.hir_id); } hir::ExprKind::Struct(_, ref fields, _) => { if let ty::Adt(ref adt, _) = self.tables.expr_ty(expr).sty { diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 29cb40a9a673..7fc01e302a7d 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -33,7 +33,7 @@ pub trait Delegate<'tcx> { // The value found at `cmt` is either copied or moved, depending // on mode. fn consume(&mut self, - consume_id: ast::NodeId, + consume_id: hir::HirId, consume_span: Span, cmt: &mc::cmt_<'tcx>, mode: ConsumeMode); @@ -65,7 +65,7 @@ pub trait Delegate<'tcx> { // The value found at `borrow` is being borrowed at the point // `borrow_id` for the region `loan_region` with kind `bk`. fn borrow(&mut self, - borrow_id: ast::NodeId, + borrow_id: hir::HirId, borrow_span: Span, cmt: &mc::cmt_<'tcx>, loan_region: ty::Region<'tcx>, @@ -79,7 +79,7 @@ pub trait Delegate<'tcx> { // The path at `cmt` is being assigned to. fn mutate(&mut self, - assignment_id: ast::NodeId, + assignment_id: hir::HirId, assignment_span: Span, assignee_cmt: &mc::cmt_<'tcx>, mode: MutateMode); @@ -329,7 +329,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { } fn delegate_consume(&mut self, - consume_id: ast::NodeId, + consume_id: hir::HirId, consume_span: Span, cmt: &mc::cmt_<'tcx>) { debug!("delegate_consume(consume_id={}, cmt={:?})", @@ -349,7 +349,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { debug!("consume_expr(expr={:?})", expr); let cmt = return_if_err!(self.mc.cat_expr(expr)); - self.delegate_consume(expr.id, expr.span, &cmt); + self.delegate_consume(expr.hir_id, expr.span, &cmt); self.walk_expr(expr); } @@ -359,7 +359,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { expr: &hir::Expr, mode: MutateMode) { let cmt = return_if_err!(self.mc.cat_expr(expr)); - self.delegate.mutate(assignment_expr.id, span, &cmt, mode); + self.delegate.mutate(assignment_expr.hir_id, span, &cmt, mode); self.walk_expr(expr); } @@ -372,7 +372,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { expr, r, bk); let cmt = return_if_err!(self.mc.cat_expr(expr)); - self.delegate.borrow(expr.id, expr.span, &cmt, r, bk, cause); + self.delegate.borrow(expr.hir_id, expr.span, &cmt, r, bk, cause); self.walk_expr(expr) } @@ -662,7 +662,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { // Consume those fields of the with expression that are needed. for (f_index, with_field) in adt.non_enum_variant().fields.iter().enumerate() { let is_mentioned = fields.iter().any(|f| { - self.tcx().field_index(f.id, self.mc.tables) == f_index + self.tcx().field_index(f.hir_id, self.mc.tables) == f_index }); if !is_mentioned { let cmt_field = self.mc.cat_field( @@ -672,7 +672,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { with_field.ident, with_field.ty(self.tcx(), substs) ); - self.delegate_consume(with_expr.id, with_expr.span, &cmt_field); + self.delegate_consume(with_expr.hir_id, with_expr.span, &cmt_field); } } } @@ -711,7 +711,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { adjustment::Adjust::Unsize => { // Creating a closure/fn-pointer or unsizing consumes // the input and stores it into the resulting rvalue. - self.delegate_consume(expr.id, expr.span, &cmt); + self.delegate_consume(expr.hir_id, expr.span, &cmt); } adjustment::Adjust::Deref(None) => {} @@ -723,7 +723,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { // this is an autoref of `x`. adjustment::Adjust::Deref(Some(ref deref)) => { let bk = ty::BorrowKind::from_mutbl(deref.mutbl); - self.delegate.borrow(expr.id, expr.span, &cmt, deref.region, bk, AutoRef); + self.delegate.borrow(expr.hir_id, expr.span, &cmt, deref.region, bk, AutoRef); } adjustment::Adjust::Borrow(ref autoref) => { @@ -741,14 +741,14 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { expr: &hir::Expr, cmt_base: &mc::cmt_<'tcx>, autoref: &adjustment::AutoBorrow<'tcx>) { - debug!("walk_autoref(expr.id={} cmt_base={:?} autoref={:?})", - expr.id, + debug!("walk_autoref(expr.hir_id={} cmt_base={:?} autoref={:?})", + expr.hir_id, cmt_base, autoref); match *autoref { adjustment::AutoBorrow::Ref(r, m) => { - self.delegate.borrow(expr.id, + self.delegate.borrow(expr.hir_id, expr.span, cmt_base, r, @@ -757,8 +757,8 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { } adjustment::AutoBorrow::RawPtr(m) => { - debug!("walk_autoref: expr.id={} cmt_base={:?}", - expr.id, + debug!("walk_autoref: expr.hir_id={} cmt_base={:?}", + expr.hir_id, cmt_base); // Converting from a &T to *T (or &mut T to *mut T) is @@ -770,7 +770,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { data: region::ScopeData::Node })); - self.delegate.borrow(expr.id, + self.delegate.borrow(expr.hir_id, expr.span, cmt_base, r, @@ -864,7 +864,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { // binding being produced. let def = Def::Local(canonical_id); if let Ok(ref binding_cmt) = mc.cat_def(pat.hir_id, pat.span, pat_ty, def) { - delegate.mutate(pat.id, pat.span, binding_cmt, MutateMode::Init); + delegate.mutate(pat.hir_id, pat.span, binding_cmt, MutateMode::Init); } // It is also a borrow or copy/move of the value being matched. @@ -872,7 +872,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { ty::BindByReference(m) => { if let ty::Ref(r, _, _) = pat_ty.sty { let bk = ty::BorrowKind::from_mutbl(m); - delegate.borrow(pat.id, pat.span, &cmt_pat, r, bk, RefBinding); + delegate.borrow(pat.hir_id, pat.span, &cmt_pat, r, bk, RefBinding); } } ty::BindByValue(..) => { @@ -920,10 +920,11 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { fn walk_captures(&mut self, closure_expr: &hir::Expr, fn_decl_span: Span) { debug!("walk_captures({:?})", closure_expr); - self.tcx().with_freevars(closure_expr.id, |freevars| { + let closure_node_id = self.tcx().hir().hir_to_node_id(closure_expr.hir_id); + let closure_def_id = self.tcx().hir().local_def_id(closure_node_id); + self.tcx().with_freevars(closure_node_id, |freevars| { for freevar in freevars { let var_hir_id = self.tcx().hir().node_to_hir_id(freevar.var_id()); - let closure_def_id = self.tcx().hir().local_def_id(closure_expr.id); let upvar_id = ty::UpvarId { var_path: ty::UpvarPath { hir_id: var_hir_id }, closure_expr_id: closure_def_id.to_local(), @@ -938,10 +939,10 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { self.param_env, &cmt_var, CaptureMove); - self.delegate.consume(closure_expr.id, freevar.span, &cmt_var, mode); + self.delegate.consume(closure_expr.hir_id, freevar.span, &cmt_var, mode); } ty::UpvarCapture::ByRef(upvar_borrow) => { - self.delegate.borrow(closure_expr.id, + self.delegate.borrow(closure_expr.hir_id, fn_decl_span, &cmt_var, upvar_borrow.region, diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 8cbc4bff3e15..76933a6e3484 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -265,7 +265,7 @@ struct IrMaps<'a, 'tcx: 'a> { num_vars: usize, live_node_map: HirIdMap, variable_map: HirIdMap, - capture_info_map: NodeMap>>, + capture_info_map: HirIdMap>>, var_kinds: Vec, lnks: Vec, } @@ -344,8 +344,8 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> { } } - fn set_captures(&mut self, node_id: NodeId, cs: Vec) { - self.capture_info_map.insert(node_id, Rc::new(cs)); + fn set_captures(&mut self, hir_id: HirId, cs: Vec) { + self.capture_info_map.insert(hir_id, Rc::new(cs)); } fn lnk(&self, ln: LiveNode) -> LiveNodeKind { @@ -460,7 +460,7 @@ fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) { match expr.node { // live nodes required for uses or definitions of variables: hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) => { - debug!("expr {}: path that leads to {:?}", expr.id, path.def); + debug!("expr {}: path that leads to {:?}", expr.hir_id, path.def); if let Def::Local(..) = path.def { ir.add_live_node_for_node(expr.hir_id, ExprNode(expr.span)); } @@ -476,7 +476,8 @@ fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) { // in better error messages than just pointing at the closure // construction site. let mut call_caps = Vec::new(); - ir.tcx.with_freevars(expr.id, |freevars| { + let node_id = ir.tcx.hir().hir_to_node_id(expr.hir_id); + ir.tcx.with_freevars(node_id, |freevars| { call_caps.extend(freevars.iter().filter_map(|fv| { if let Def::Local(rv) = fv.def { let fv_ln = ir.add_live_node(FreeVarNode(fv.span)); @@ -487,7 +488,7 @@ fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) { } })); }); - ir.set_captures(expr.id, call_caps); + ir.set_captures(expr.hir_id, call_caps); intravisit::walk_expr(ir, expr); } @@ -925,7 +926,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } fn compute(&mut self, body: &hir::Expr) -> LiveNode { - debug!("compute: using id for body, {}", self.ir.tcx.hir().node_to_pretty_string(body.id)); + debug!("compute: using id for body, {}", + self.ir.tcx.hir().hir_to_pretty_string(body.hir_id)); // the fallthrough exit is only for those cases where we do not // explicitly return: @@ -940,7 +942,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { for ln_idx in 0..self.ir.num_live_nodes { debug!("{:?}", self.ln_str(LiveNode(ln_idx as u32))); } - body.id + body.hir_id }, entry_ln); @@ -1003,7 +1005,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode) -> LiveNode { - debug!("propagate_through_expr: {}", self.ir.tcx.hir().node_to_pretty_string(expr.id)); + debug!("propagate_through_expr: {}", self.ir.tcx.hir().hir_to_pretty_string(expr.hir_id)); match expr.node { // Interesting cases with control flow or which gen/kill @@ -1017,11 +1019,11 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { hir::ExprKind::Closure(..) => { debug!("{} is an ExprKind::Closure", - self.ir.tcx.hir().node_to_pretty_string(expr.id)); + self.ir.tcx.hir().hir_to_pretty_string(expr.hir_id)); // the construction of a closure itself is not important, // but we have to consider the closed over variables. - let caps = self.ir.capture_info_map.get(&expr.id).cloned().unwrap_or_else(|| + let caps = self.ir.capture_info_map.get(&expr.hir_id).cloned().unwrap_or_else(|| span_bug!(expr.span, "no registered caps")); caps.iter().rev().fold(succ, |succ, cap| { @@ -1170,7 +1172,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } hir::ExprKind::Call(ref f, ref args) => { - let m = self.ir.tcx.hir().get_module_parent(expr.id); + let m = self.ir.tcx.hir().get_module_parent_by_hir_id(expr.hir_id); let succ = if self.ir.tcx.is_ty_uninhabited_from(m, self.tables.expr_ty(expr)) { self.s.exit_ln } else { @@ -1181,7 +1183,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } hir::ExprKind::MethodCall(.., ref args) => { - let m = self.ir.tcx.hir().get_module_parent(expr.id); + let m = self.ir.tcx.hir().get_module_parent_by_hir_id(expr.hir_id); let succ = if self.ir.tcx.is_ty_uninhabited_from(m, self.tables.expr_ty(expr)) { self.s.exit_ln } else { @@ -1387,17 +1389,17 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } } debug!("propagate_through_loop: using id for loop body {} {}", - expr.id, self.ir.tcx.hir().hir_to_pretty_string(body.hir_id)); + expr.hir_id, self.ir.tcx.hir().hir_to_pretty_string(body.hir_id)); - - self.break_ln.insert(expr.id, succ); + let node_id = self.ir.tcx.hir().hir_to_node_id(expr.hir_id); + self.break_ln.insert(node_id, succ); let cond_ln = match kind { LoopLoop => ln, WhileLoop(ref cond) => self.propagate_through_expr(&cond, ln), }; - self.cont_ln.insert(expr.id, cond_ln); + self.cont_ln.insert(node_id, cond_ln); let body_ln = self.propagate_through_block(body, cond_ln); diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index f65c09e31343..822a42b374f3 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -632,7 +632,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { } pub fn cat_expr_unadjusted(&self, expr: &hir::Expr) -> McResult> { - debug!("cat_expr: id={} expr={:?}", expr.id, expr); + debug!("cat_expr: id={} expr={:?}", expr.hir_id, expr); let expr_ty = self.expr_ty(expr)?; match expr.node { @@ -648,10 +648,10 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { hir::ExprKind::Field(ref base, f_ident) => { let base_cmt = Rc::new(self.cat_expr(&base)?); debug!("cat_expr(cat_field): id={} expr={:?} base={:?}", - expr.id, + expr.hir_id, expr, base_cmt); - let f_index = self.tcx.field_index(expr.id, self.tables); + let f_index = self.tcx.field_index(expr.hir_id, self.tables); Ok(self.cat_field(expr, base_cmt, f_index, f_ident, expr_ty)) } @@ -1321,7 +1321,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { for fp in field_pats { let field_ty = self.pat_ty_adjusted(&fp.node.pat)?; // see (*2) - let f_index = self.tcx.field_index(fp.node.id, self.tables); + let f_index = self.tcx.field_index(fp.node.hir_id, self.tables); let cmt_field = Rc::new(self.cat_field(pat, cmt.clone(), f_index, fp.node.ident, field_ty)); self.cat_pattern_(cmt_field, &fp.node.pat, op)?; diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 3a81660ad691..55572c637f80 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -14,7 +14,7 @@ use crate::session::{DiagnosticMessageId, Session}; use syntax::symbol::Symbol; use syntax_pos::{Span, MultiSpan}; use syntax::ast; -use syntax::ast::{NodeId, Attribute}; +use syntax::ast::Attribute; use syntax::errors::Applicability; use syntax::feature_gate::{GateIssue, emit_feature_err}; use syntax::attr::{self, Stability, Deprecation}; @@ -557,9 +557,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// If `id` is `Some(_)`, this function will also check if the item at `def_id` has been /// deprecated. If the item is indeed deprecated, we will emit a deprecation lint attached to /// `id`. - pub fn eval_stability(self, def_id: DefId, id: Option, span: Span) -> EvalResult { + pub fn eval_stability(self, def_id: DefId, id: Option, span: Span) -> EvalResult { let lint_deprecated = |def_id: DefId, - id: NodeId, + id: HirId, note: Option, suggestion: Option, message: &str, @@ -570,9 +570,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { format!("{}", message) }; - let mut diag = self.struct_span_lint_node(lint, id, span, &msg); + let mut diag = self.struct_span_lint_hir(lint, id, span, &msg); if let Some(suggestion) = suggestion { - if let hir::Node::Expr(_) = self.hir().get(id) { + if let hir::Node::Expr(_) = self.hir().get_by_hir_id(id) { diag.span_suggestion( span, &msg, @@ -582,15 +582,16 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } diag.emit(); - if id == ast::DUMMY_NODE_ID { - span_bug!(span, "emitted a {} lint with dummy node id: {:?}", lint.name, def_id); + if id == hir::DUMMY_HIR_ID { + span_bug!(span, "emitted a {} lint with dummy HIR id: {:?}", lint.name, def_id); } }; // Deprecated attributes apply in-crate and cross-crate. if let Some(id) = id { if let Some(depr_entry) = self.lookup_deprecation_entry(def_id) { - let parent_def_id = self.hir().local_def_id(self.hir().get_parent(id)); + let parent_def_id = self.hir().local_def_id_from_hir_id( + self.hir().get_parent_item(id)); let skip = self.lookup_deprecation_entry(parent_def_id) .map_or(false, |parent_depr| parent_depr.same_origin(&depr_entry)); @@ -703,7 +704,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// /// Additionally, this function will also check if the item is deprecated. If so, and `id` is /// not `None`, a deprecated lint attached to `id` will be emitted. - pub fn check_stability(self, def_id: DefId, id: Option, span: Span) { + pub fn check_stability(self, def_id: DefId, id: Option, span: Span) { match self.eval_stability(def_id, id, span) { EvalResult::Allow => {} EvalResult::Deny { feature, reason, issue } => { @@ -763,7 +764,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { None => return, }; let def_id = DefId { krate: cnum, index: CRATE_DEF_INDEX }; - self.tcx.check_stability(def_id, Some(item.id), item.span); + self.tcx.check_stability(def_id, Some(item.hir_id), item.span); } // For implementations of traits, check the stability of each item @@ -811,7 +812,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { } fn visit_path(&mut self, path: &'tcx hir::Path, id: hir::HirId) { - let id = self.tcx.hir().hir_to_node_id(id); if let Some(def_id) = path.def.opt_def_id() { self.tcx.check_stability(def_id, Some(id), path.span) } diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index 99d1e32d5239..be6a95948edb 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -257,10 +257,10 @@ pub enum ObligationCauseCode<'tcx> { ReturnNoExpression, /// `return` with an expression - ReturnType(ast::NodeId), + ReturnType(hir::HirId), /// Block implicit return - BlockTailExpression(ast::NodeId), + BlockTailExpression(hir::HirId), /// #[feature(trivial_bounds)] is not enabled TrivialBound, diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 02e4fb12af5c..a3cf7bf488ee 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -2775,8 +2775,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - pub fn field_index(self, node_id: NodeId, tables: &TypeckTables<'_>) -> usize { - let hir_id = self.hir().node_to_hir_id(node_id); + pub fn field_index(self, hir_id: hir::HirId, tables: &TypeckTables<'_>) -> usize { tables.field_indices().get(hir_id).cloned().expect("no index for a field") } diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index b528967dd65f..c74d7f00cf51 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -89,15 +89,14 @@ struct CheckLoanCtxt<'a, 'tcx: 'a> { impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> { fn consume(&mut self, - consume_id: ast::NodeId, + consume_id: hir::HirId, consume_span: Span, cmt: &mc::cmt_<'tcx>, mode: euv::ConsumeMode) { debug!("consume(consume_id={}, cmt={:?}, mode={:?})", consume_id, cmt, mode); - let hir_id = self.tcx().hir().node_to_hir_id(consume_id); - self.consume_common(hir_id.local_id, consume_span, cmt, mode); + self.consume_common(consume_id.local_id, consume_span, cmt, mode); } fn matched_pat(&mut self, @@ -118,7 +117,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> { } fn borrow(&mut self, - borrow_id: ast::NodeId, + borrow_id: hir::HirId, borrow_span: Span, cmt: &mc::cmt_<'tcx>, loan_region: ty::Region<'tcx>, @@ -130,22 +129,21 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> { borrow_id, cmt, loan_region, bk, loan_cause); - let hir_id = self.tcx().hir().node_to_hir_id(borrow_id); if let Some(lp) = opt_loan_path(cmt) { let moved_value_use_kind = match loan_cause { euv::ClosureCapture(_) => MovedInCapture, _ => MovedInUse, }; - self.check_if_path_is_moved(hir_id.local_id, borrow_span, moved_value_use_kind, &lp); + self.check_if_path_is_moved(borrow_id.local_id, borrow_span, moved_value_use_kind, &lp); } - self.check_for_conflicting_loans(hir_id.local_id); + self.check_for_conflicting_loans(borrow_id.local_id); self.check_for_loans_across_yields(cmt, loan_region, borrow_span); } fn mutate(&mut self, - assignment_id: ast::NodeId, + assignment_id: hir::HirId, assignment_span: Span, assignee_cmt: &mc::cmt_<'tcx>, mode: euv::MutateMode) @@ -176,8 +174,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> { } } } - self.check_assignment(self.tcx().hir().node_to_hir_id(assignment_id).local_id, - assignment_span, assignee_cmt); + self.check_assignment(assignment_id.local_id, assignment_span, assignee_cmt); } fn decl_without_init(&mut self, _id: ast::NodeId, _span: Span) { } @@ -188,7 +185,7 @@ pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, move_data: &move_data::FlowedMoveData<'c, 'tcx>, all_loans: &[Loan<'tcx>], body: &hir::Body) { - debug!("check_loans(body id={})", body.value.id); + debug!("check_loans(body id={})", body.value.hir_id); let def_id = bccx.tcx.hir().body_owner_def_id(body.id()); diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index cf6053b71b6a..03af27997d3c 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -68,7 +68,7 @@ struct GatherLoanCtxt<'a, 'tcx: 'a> { impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> { fn consume(&mut self, - consume_id: ast::NodeId, + consume_id: hir::HirId, _consume_span: Span, cmt: &mc::cmt_<'tcx>, mode: euv::ConsumeMode) { @@ -79,7 +79,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> { euv::Move(move_reason) => { gather_moves::gather_move_from_expr( self.bccx, &self.move_data, &mut self.move_error_collector, - self.bccx.tcx.hir().node_to_hir_id(consume_id).local_id, cmt, move_reason); + consume_id.local_id, cmt, move_reason); } euv::Copy => { } } @@ -115,7 +115,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> { } fn borrow(&mut self, - borrow_id: ast::NodeId, + borrow_id: hir::HirId, borrow_span: Span, cmt: &mc::cmt_<'tcx>, loan_region: ty::Region<'tcx>, @@ -126,8 +126,8 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> { bk={:?}, loan_cause={:?})", borrow_id, cmt, loan_region, bk, loan_cause); - let hir_id = self.bccx.tcx.hir().node_to_hir_id(borrow_id); - self.guarantee_valid(hir_id.local_id, + + self.guarantee_valid(borrow_id.local_id, borrow_span, cmt, bk, @@ -136,12 +136,13 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> { } fn mutate(&mut self, - assignment_id: ast::NodeId, + assignment_id: hir::HirId, assignment_span: Span, assignee_cmt: &mc::cmt_<'tcx>, _: euv::MutateMode) { - self.guarantee_assignment_valid(assignment_id, + let node_id = self.bccx.tcx.hir().hir_to_node_id(assignment_id); + self.guarantee_assignment_valid(node_id, assignment_span, assignee_cmt); } diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index b0b5594b93ea..0698c15346eb 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -425,8 +425,8 @@ impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> { } pprust_hir::AnnNode::Expr(expr) => { s.s.space()?; - s.synth_comment(format!("node_id: {} hir local_id: {}", - expr.id, expr.hir_id.local_id.as_u32()))?; + s.synth_comment(format!("expr hir_id: {} hir local_id: {}", + expr.hir_id, expr.hir_id.local_id.as_u32()))?; s.pclose() } pprust_hir::AnnNode::Pat(pat) => { @@ -834,15 +834,15 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec, let body_id = match code { blocks::Code::Expr(expr) => { // Find the function this expression is from. - let mut node_id = expr.id; + let mut hir_id = expr.hir_id; loop { - let node = tcx.hir().get(node_id); + let node = tcx.hir().get_by_hir_id(hir_id); if let Some(n) = hir::map::blocks::FnLikeNode::from_node(node) { break n.body(); } - let parent = tcx.hir().get_parent_node(node_id); - assert_ne!(node_id, parent); - node_id = parent; + let parent = tcx.hir().get_parent_node_by_hir_id(hir_id); + assert_ne!(hir_id, parent); + hir_id = parent; } } blocks::Code::FnLike(fn_like) => fn_like.body(), diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 40c9ef3f63cf..ac10b6403bd1 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -200,7 +200,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns { } if let PatKind::Binding(_, _, _, ident, None) = fieldpat.node.pat.node { if cx.tcx.find_field_index(ident, &variant) == - Some(cx.tcx.field_index(fieldpat.node.id, cx.tables)) { + Some(cx.tcx.field_index(fieldpat.node.hir_id, cx.tables)) { let mut err = cx.struct_span_lint(NON_SHORTHAND_FIELD_PATTERNS, fieldpat.span, &format!("the `{}:` in this pattern is redundant", ident)); diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 34f8fc40597f..ba598ccf7ab5 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -48,12 +48,12 @@ declare_lint! { #[derive(Copy, Clone)] pub struct TypeLimits { /// Id of the last visited negated expression - negated_expr_id: ast::NodeId, + negated_expr_id: hir::HirId, } impl TypeLimits { pub fn new() -> TypeLimits { - TypeLimits { negated_expr_id: ast::DUMMY_NODE_ID } + TypeLimits { negated_expr_id: hir::DUMMY_HIR_ID } } } @@ -73,8 +73,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { match e.node { hir::ExprKind::Unary(hir::UnNeg, ref expr) => { // propagate negation, if the negation itself isn't negated - if self.negated_expr_id != e.id { - self.negated_expr_id = expr.id; + if self.negated_expr_id != e.hir_id { + self.negated_expr_id = expr.hir_id; } } hir::ExprKind::Binary(binop, ref l, ref r) => { @@ -97,7 +97,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { }; let (_, max) = int_ty_range(int_type); let max = max as u128; - let negative = self.negated_expr_id == e.id; + let negative = self.negated_expr_id == e.hir_id; // Detect literal value out of range [min, max] inclusive // avoiding use of -min to prevent overflow/panic @@ -138,8 +138,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { _ => bug!(), }; if lit_val < min || lit_val > max { - let parent_id = cx.tcx.hir().get_parent_node(e.id); - if let Node::Expr(parent_expr) = cx.tcx.hir().get(parent_id) { + let parent_id = cx.tcx.hir().get_parent_node_by_hir_id(e.hir_id); + if let Node::Expr(parent_expr) = cx.tcx.hir().get_by_hir_id(parent_id) { if let hir::ExprKind::Cast(..) = parent_expr.node { if let ty::Char = cx.tables.expr_ty(parent_expr).sty { let mut err = cx.struct_span_lint( diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index 407e68429351..86b8b276eafe 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -58,7 +58,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { let t = cx.tables.expr_ty(&expr); let type_permits_lack_of_use = if t.is_unit() - || cx.tcx.is_ty_uninhabited_from(cx.tcx.hir().get_module_parent(expr.id), t) { + || cx.tcx.is_ty_uninhabited_from( + cx.tcx.hir().get_module_parent_by_hir_id(expr.hir_id), t) + { true } else { match t.sty { diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 79457cc028a7..5fdc5899a721 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1729,7 +1729,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { fn encode_info_for_expr(&mut self, expr: &hir::Expr) { match expr.node { hir::ExprKind::Closure(..) => { - let def_id = self.tcx.hir().local_def_id(expr.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(expr.hir_id); self.record(def_id, IsolatedEncoder::encode_info_for_closure, def_id); } _ => {} diff --git a/src/librustc_mir/hair/cx/block.rs b/src/librustc_mir/hair/cx/block.rs index b63bf4bc2468..f58e61915e8c 100644 --- a/src/librustc_mir/hair/cx/block.rs +++ b/src/librustc_mir/hair/cx/block.rs @@ -103,7 +103,7 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }, pattern, initializer: local.init.to_ref(), - lint_level: cx.lint_level_of(local.id), + lint_level: cx.lint_level_of(local.hir_id), }, opt_destruction_scope: opt_dxn_ext, span: stmt_span, diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 10d04a80d734..a11afc3a27f2 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -24,7 +24,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr { data: region::ScopeData::Node }; - debug!("Expr::make_mirror(): id={}, span={:?}", self.id, self.span); + debug!("Expr::make_mirror(): id={}, span={:?}", self.hir_id, self.span); let mut expr = make_mirror_unadjusted(cx, self); @@ -44,7 +44,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr { kind: ExprKind::Scope { region_scope: expr_scope, value: expr.to_ref(), - lint_level: cx.lint_level_of(self.id), + lint_level: cx.lint_level_of(self.hir_id), }, }; @@ -529,7 +529,8 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, span_bug!(expr.span, "closure expr w/o closure type: {:?}", closure_ty); } }; - let upvars = cx.tcx.with_freevars(expr.id, |freevars| { + let expr_node_id = cx.tcx.hir().hir_to_node_id(expr.hir_id); + let upvars = cx.tcx.with_freevars(expr_node_id, |freevars| { freevars.iter() .zip(substs.upvar_tys(def_id, cx.tcx)) .map(|(fv, ty)| capture_freevar(cx, expr, fv, ty)) @@ -637,7 +638,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, hir::ExprKind::Field(ref source, ..) => { ExprKind::Field { lhs: source.to_ref(), - name: Field::new(cx.tcx.field_index(expr.id, cx.tables)), + name: Field::new(cx.tcx.field_index(expr.hir_id, cx.tables)), } } hir::ExprKind::Cast(ref source, ref cast_ty) => { @@ -1184,7 +1185,7 @@ fn capture_freevar<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, let var_hir_id = cx.tcx.hir().node_to_hir_id(freevar.var_id()); let upvar_id = ty::UpvarId { var_path: ty::UpvarPath { hir_id: var_hir_id }, - closure_expr_id: cx.tcx.hir().local_def_id(closure_expr.id).to_local(), + closure_expr_id: cx.tcx.hir().local_def_id_from_hir_id(closure_expr.hir_id).to_local(), }; let upvar_capture = cx.tables().upvar_capture(upvar_id); let temp_lifetime = cx.region_scope_tree.temporary_scope(closure_expr.hir_id.local_id); @@ -1223,7 +1224,7 @@ fn field_refs<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, fields.iter() .map(|field| { FieldExprRef { - name: Field::new(cx.tcx.field_index(field.id, cx.tables)), + name: Field::new(cx.tcx.field_index(field.hir_id, cx.tables)), expr: field.expr.to_ref(), } }) diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index d24a70528ec4..9e19badf49db 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -197,8 +197,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { ty.needs_drop(self.tcx.global_tcx(), param_env) } - fn lint_level_of(&self, node_id: ast::NodeId) -> LintLevel { - let hir_id = self.tcx.hir().definitions().node_to_hir_id(node_id); + fn lint_level_of(&self, hir_id: hir::HirId) -> LintLevel { let has_lint_level = self.tcx.dep_graph.with_ignore(|| { self.tcx.lint_levels(LOCAL_CRATE).lint_level_set(hir_id).is_some() }); diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 7c44d1bf2c93..fff810b0e6f2 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -171,7 +171,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { } } - let module = self.tcx.hir().get_module_parent(scrut.id); + let module = self.tcx.hir().get_module_parent_by_hir_id(scrut.hir_id); MatchCheckCtxt::create_and_enter(self.tcx, self.param_env, module, |ref mut cx| { let mut have_errors = false; @@ -203,7 +203,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { // Then, if the match has no arms, check whether the scrutinee // is uninhabited. let pat_ty = self.tables.node_type(scrut.hir_id); - let module = self.tcx.hir().get_module_parent(scrut.id); + let module = self.tcx.hir().get_module_parent_by_hir_id(scrut.hir_id); if inlined_arms.is_empty() { let scrutinee_is_uninhabited = if self.tcx.features().exhaustive_patterns { self.tcx.is_ty_uninhabited_from(module, pat_ty) @@ -561,10 +561,10 @@ struct MutationChecker<'a, 'tcx: 'a> { impl<'a, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'tcx> { fn matched_pat(&mut self, _: &Pat, _: &cmt_<'_>, _: euv::MatchMode) {} - fn consume(&mut self, _: ast::NodeId, _: Span, _: &cmt_<'_>, _: ConsumeMode) {} + fn consume(&mut self, _: hir::HirId, _: Span, _: &cmt_<'_>, _: ConsumeMode) {} fn consume_pat(&mut self, _: &Pat, _: &cmt_<'_>, _: ConsumeMode) {} fn borrow(&mut self, - _: ast::NodeId, + _: hir::HirId, span: Span, _: &cmt_<'_>, _: ty::Region<'tcx>, @@ -587,7 +587,7 @@ impl<'a, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'tcx> { } } fn decl_without_init(&mut self, _: ast::NodeId, _: Span) {} - fn mutate(&mut self, _: ast::NodeId, span: Span, _: &cmt_<'_>, mode: MutateMode) { + fn mutate(&mut self, _: hir::HirId, span: Span, _: &cmt_<'_>, mode: MutateMode) { match mode { MutateMode::JustWrite | MutateMode::WriteAndRead => { struct_span_err!(self.cx.tcx.sess, span, E0302, "cannot assign in a pattern guard") diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 4d571f4f7829..9e5fdaa8afdf 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -631,7 +631,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { fields.iter() .map(|field| { FieldPattern { - field: Field::new(self.tcx.field_index(field.node.id, + field: Field::new(self.tcx.field_index(field.node.hir_id, self.tables)), pattern: self.lower_pattern(&field.node.pat), } diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 20f31b3ebc17..c25884df87ba 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -23,7 +23,7 @@ use rustc::middle::mem_categorization::Categorization; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::query::Providers; use rustc::ty::subst::Substs; -use rustc::util::nodemap::{ItemLocalSet, NodeSet}; +use rustc::util::nodemap::{ItemLocalSet, HirIdSet}; use rustc::hir; use rustc_data_structures::sync::Lrc; use syntax::ast; @@ -92,7 +92,7 @@ struct CheckCrateVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, in_fn: bool, in_static: bool, - mut_rvalue_borrows: NodeSet, + mut_rvalue_borrows: HirIdSet, param_env: ty::ParamEnv<'tcx>, identity_substs: &'tcx Substs<'tcx>, tables: &'a ty::TypeckTables<'tcx>, @@ -169,7 +169,7 @@ impl<'a, 'gcx> CheckCrateVisitor<'a, 'gcx> { fn remove_mut_rvalue_borrow(&mut self, pat: &hir::Pat) -> bool { let mut any_removed = false; pat.walk(|p| { - any_removed |= self.mut_rvalue_borrows.remove(&p.id); + any_removed |= self.mut_rvalue_borrows.remove(&p.hir_id); true }); any_removed @@ -223,7 +223,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { hir::StmtKind::Local(ref local) => { if self.remove_mut_rvalue_borrow(&local.pat) { if let Some(init) = &local.init { - self.mut_rvalue_borrows.insert(init.id); + self.mut_rvalue_borrows.insert(init.hir_id); } } @@ -248,7 +248,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { outer &= check_adjustments(self, ex); // Handle borrows on (or inside the autorefs of) this expression. - if self.mut_rvalue_borrows.remove(&ex.id) { + if self.mut_rvalue_borrows.remove(&ex.hir_id) { outer = NotPromotable } @@ -318,7 +318,7 @@ fn check_expr_kind<'a, 'tcx>( } hir::ExprKind::Cast(ref from, _) => { let expr_promotability = v.check_expr(from); - debug!("Checking const cast(id={})", from.id); + debug!("Checking const cast(id={})", from.hir_id); match v.tables.cast_kinds().get(from.hir_id) { None => { v.tcx.sess.delay_span_bug(e.span, "no kind for cast"); @@ -456,9 +456,10 @@ fn check_expr_kind<'a, 'tcx>( hir::ExprKind::Closure(_capture_clause, ref _box_fn_decl, body_id, _span, _option_generator_movability) => { let nested_body_promotable = v.check_nested_body(body_id); + let node_id = v.tcx.hir().hir_to_node_id(e.hir_id); // Paths in constant contexts cannot refer to local variables, // as there are none, and thus closures can't have upvars there. - if v.tcx.with_freevars(e.id, |fv| !fv.is_empty()) { + if v.tcx.with_freevars(node_id, |fv| !fv.is_empty()) { NotPromotable } else { nested_body_promotable @@ -518,7 +519,7 @@ fn check_expr_kind<'a, 'tcx>( mut_borrow = v.remove_mut_rvalue_borrow(pat); } if mut_borrow { - v.mut_rvalue_borrows.insert(expr.id); + v.mut_rvalue_borrows.insert(expr.hir_id); } let _ = v.check_expr(expr); @@ -619,13 +620,13 @@ fn check_adjustments<'a, 'tcx>( impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for CheckCrateVisitor<'a, 'gcx> { fn consume(&mut self, - _consume_id: ast::NodeId, + _consume_id: hir::HirId, _consume_span: Span, _cmt: &mc::cmt_<'_>, _mode: euv::ConsumeMode) {} fn borrow(&mut self, - borrow_id: ast::NodeId, + borrow_id: hir::HirId, _borrow_span: Span, cmt: &mc::cmt_<'tcx>, _loan_region: ty::Region<'tcx>, @@ -678,7 +679,7 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for CheckCrateVisitor<'a, 'gcx> { fn decl_without_init(&mut self, _id: ast::NodeId, _span: Span) {} fn mutate(&mut self, - _assignment_id: ast::NodeId, + _assignment_id: hir::HirId, _assignment_span: Span, _assignee_cmt: &mc::cmt_<'_>, _mode: euv::MutateMode) { diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 830ede751fbc..568e622bd34c 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -271,7 +271,8 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) return (ctor_vis, span, descr); } Node::Expr(expr) => { - return (ty::Visibility::Restricted(tcx.hir().get_module_parent(expr.id)), + return (ty::Visibility::Restricted( + tcx.hir().get_module_parent_by_hir_id(expr.hir_id)), expr.span, "private") } node => bug!("unexpected node kind: {:?}", node) @@ -872,7 +873,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { // unmentioned fields, just check them all. for (vf_index, variant_field) in variant.fields.iter().enumerate() { let field = fields.iter().find(|f| { - self.tcx.field_index(f.id, self.tables) == vf_index + self.tcx.field_index(f.hir_id, self.tables) == vf_index }); let (use_ctxt, span) = match field { Some(field) => (field.ident.span, field.span), @@ -883,7 +884,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { } else { for field in fields { let use_ctxt = field.ident.span; - let index = self.tcx.field_index(field.id, self.tables); + let index = self.tcx.field_index(field.hir_id, self.tables); self.check_field(use_ctxt, field.span, adt, &variant.fields[index]); } } @@ -902,7 +903,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { let variant = adt.variant_of_def(def); for field in fields { let use_ctxt = field.node.ident.span; - let index = self.tcx.field_index(field.node.id, self.tables); + let index = self.tcx.field_index(field.node.hir_id, self.tables); self.check_field(use_ctxt, field.span, adt, &variant.fields[index]); } } diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 187ebf0bc430..b82aee7c96ad 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -1517,7 +1517,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc return; } }; - let def = self.save_ctxt.get_path_def(hir_expr.id); + let node_id = self.save_ctxt.tcx.hir().hir_to_node_id(hir_expr.hir_id); + let def = self.save_ctxt.get_path_def(node_id); self.process_struct_lit(ex, path, fields, adt.variant_of_def(def), base) } ast::ExprKind::MethodCall(ref seg, ref args) => self.process_method_call(ex, seg, args), diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 9dfd19199bac..e5ab7ba1de94 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -885,7 +885,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let msg = format!("associated type `{}` is private", binding.item_name); tcx.sess.span_err(binding.span, &msg); } - tcx.check_stability(assoc_ty.def_id, Some(ref_id), binding.span); + tcx.check_stability(assoc_ty.def_id, Some(hir_ref_id), binding.span); if !speculative { dup_bindings.entry(assoc_ty.def_id) @@ -1276,7 +1276,6 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { ) -> (Ty<'tcx>, Def) { let tcx = self.tcx(); let assoc_ident = assoc_segment.ident; - let ref_id = tcx.hir().hir_to_node_id(hir_ref_id); debug!("associated_path_to_ty: {:?}::{}", qself_ty, assoc_ident); @@ -1293,7 +1292,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let def = Def::Variant(variant_def.did); if permit_variants { check_type_alias_enum_variants_enabled(tcx, span); - tcx.check_stability(variant_def.did, Some(ref_id), span); + tcx.check_stability(variant_def.did, Some(hir_ref_id), span); return (qself_ty, def); } else { variant_resolution = Some(def); @@ -1385,7 +1384,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let msg = format!("{} `{}` is private", def.kind_name(), assoc_ident); tcx.sess.span_err(span, &msg); } - tcx.check_stability(item.def_id, Some(ref_id), span); + tcx.check_stability(item.def_id, Some(hir_ref_id), span); if let Some(variant_def) = variant_resolution { let mut err = tcx.struct_span_lint_hir( diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 0e6ab5b1eb3b..7c53cb05391c 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -64,7 +64,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } PatKind::Path(ref qpath) => { - let (def, _, _) = self.resolve_ty_and_def_ufcs(qpath, pat.id, pat.span); + let (def, _, _) = self.resolve_ty_and_def_ufcs(qpath, pat.hir_id, pat.span); match def { Def::Const(..) | Def::AssociatedConst(..) => false, _ => true, @@ -630,7 +630,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); if self.diverges.get().always() { for arm in arms { - self.warn_if_unreachable(arm.body.id, arm.body.span, "arm"); + self.warn_if_unreachable(arm.body.hir_id, arm.body.span, "arm"); } } @@ -725,7 +725,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); let cause = if i == 0 { // The reason for the first arm to fail is not that the match arms diverge, // but rather that there's a prior obligation that doesn't hold. - self.cause(arm_span, ObligationCauseCode::BlockTailExpression(arm.body.id)) + self.cause(arm_span, ObligationCauseCode::BlockTailExpression(arm.body.hir_id)) } else { self.cause(expr.span, ObligationCauseCode::MatchExpressionArm { arm_span, @@ -761,7 +761,8 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); ) -> Ty<'tcx> { // Resolve the path and check the definition for errors. - let (variant, pat_ty) = if let Some(variant_ty) = self.check_struct_path(qpath, pat.id) { + let (variant, pat_ty) = if let Some(variant_ty) = self.check_struct_path(qpath, pat.hir_id) + { variant_ty } else { for field in fields { @@ -779,7 +780,8 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); self.demand_eqtype_pat(pat.span, expected, pat_ty, match_discrim_span); // Type-check subpatterns. - if self.check_struct_pat_fields(pat_ty, pat.id, pat.span, variant, fields, etc, def_bm) { + if self.check_struct_pat_fields(pat_ty, pat.hir_id, pat.span, variant, fields, etc, def_bm) + { pat_ty } else { self.tcx.types.err @@ -795,7 +797,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); let tcx = self.tcx; // Resolve the path and check the definition for errors. - let (def, opt_ty, segments) = self.resolve_ty_and_def_ufcs(qpath, pat.id, pat.span); + let (def, opt_ty, segments) = self.resolve_ty_and_def_ufcs(qpath, pat.hir_id, pat.span); match def { Def::Err => { self.set_tainted_by_errors(); @@ -818,7 +820,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); } // Type-check the path. - let pat_ty = self.instantiate_value_path(segments, opt_ty, def, pat.span, pat.id).0; + let pat_ty = self.instantiate_value_path(segments, opt_ty, def, pat.span, pat.hir_id).0; self.demand_suptype(pat.span, expected, pat_ty); pat_ty } @@ -849,7 +851,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); }; // Resolve the path and check the definition for errors. - let (def, opt_ty, segments) = self.resolve_ty_and_def_ufcs(qpath, pat.id, pat.span); + let (def, opt_ty, segments) = self.resolve_ty_and_def_ufcs(qpath, pat.hir_id, pat.span); if def == Def::Err { self.set_tainted_by_errors(); on_error(); @@ -857,7 +859,8 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); } // Type-check the path. - let (pat_ty, def) = self.instantiate_value_path(segments, opt_ty, def, pat.span, pat.id); + let (pat_ty, def) = self.instantiate_value_path(segments, opt_ty, def, pat.span, + pat.hir_id); if !pat_ty.is_fn() { report_unexpected_def(def); return self.tcx.types.err; @@ -897,7 +900,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); let field_ty = self.field_ty(subpat.span, &variant.fields[i], substs); self.check_pat_walk(&subpat, field_ty, def_bm, match_arm_pat_span); - self.tcx.check_stability(variant.fields[i].did, Some(pat.id), subpat.span); + self.tcx.check_stability(variant.fields[i].did, Some(pat.hir_id), subpat.span); } } else { let subpats_ending = if subpats.len() == 1 { "" } else { "s" }; @@ -917,7 +920,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); fn check_struct_pat_fields(&self, adt_ty: Ty<'tcx>, - pat_id: ast::NodeId, + pat_id: hir::HirId, span: Span, variant: &'tcx ty::VariantDef, fields: &'gcx [Spanned], @@ -963,7 +966,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); vacant.insert(span); field_map.get(&ident) .map(|(i, f)| { - self.write_field_index(field.id, *i); + self.write_field_index(field.hir_id, *i); self.tcx.check_stability(f.did, Some(pat_id), span); self.field_ty(span, f, substs) }) diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index 1bbb93b4e461..79dcb9a9305c 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -250,7 +250,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let &ty::Adt(adt_def, ..) = t { if adt_def.is_enum() { if let hir::ExprKind::Call(ref expr, _) = call_expr.node { - unit_variant = Some(self.tcx.hir().node_to_pretty_string(expr.id)) + unit_variant = Some(self.tcx.hir().hir_to_pretty_string(expr.hir_id)) } } } diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index 317d6bbd7859..97ee973938cc 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -399,9 +399,9 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { } else { ("", lint::builtin::TRIVIAL_CASTS) }; - let mut err = fcx.tcx.struct_span_lint_node( + let mut err = fcx.tcx.struct_span_lint_hir( lint, - self.expr.id, + self.expr.hir_id, self.span, &format!("trivial {}cast: `{}` as `{}`", adjective, @@ -417,7 +417,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { self.cast_ty = fcx.structurally_resolved_type(self.span, self.cast_ty); debug!("check_cast({}, {:?} as {:?})", - self.expr.id, + self.expr.hir_id, self.expr_ty, self.cast_ty); diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index f602ed24acd4..5cf767abfc51 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -72,7 +72,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { opt_kind, expected_sig ); - let expr_def_id = self.tcx.hir().local_def_id(expr.id); + let expr_def_id = self.tcx.hir().local_def_id_from_hir_id(expr.hir_id); let ClosureSignatures { bound_sig, @@ -131,8 +131,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let closure_type = self.tcx.mk_closure(expr_def_id, substs); debug!( - "check_closure: expr.id={:?} closure_type={:?}", - expr.id, closure_type + "check_closure: expr.hir_id={:?} closure_type={:?}", + expr.hir_id, closure_type ); // Tuple up the arguments and insert the resulting function type into diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 90071e3f3634..62c6ab8da24a 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -1177,7 +1177,8 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> Expressions::UpFront(coercion_sites) => { // if the user gave us an array to validate, check that we got // the next expression in the list, as expected - assert_eq!(coercion_sites[self.pushed].as_coercion_site().id, e.id); + assert_eq!(coercion_sites[self.pushed].as_coercion_site().hir_id, + e.hir_id); } } self.pushed += 1; @@ -1208,7 +1209,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> db.span_label(cause.span, "return type is not `()`"); } ObligationCauseCode::BlockTailExpression(blk_id) => { - let parent_id = fcx.tcx.hir().get_parent_node(blk_id); + let parent_id = fcx.tcx.hir().get_parent_node_by_hir_id(blk_id); db = self.report_return_mismatched_types( cause, expected, @@ -1246,8 +1247,8 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> found: Ty<'tcx>, err: TypeError<'tcx>, fcx: &FnCtxt<'a, 'gcx, 'tcx>, - id: syntax::ast::NodeId, - expression: Option<(&'gcx hir::Expr, syntax::ast::NodeId)>, + id: hir::HirId, + expression: Option<(&'gcx hir::Expr, hir::HirId)>, ) -> DiagnosticBuilder<'a> { let mut db = fcx.report_mismatched_types(cause, expected, found, err); @@ -1257,7 +1258,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> // Verify that this is a tail expression of a function, otherwise the // label pointing out the cause for the type coercion will be wrong // as prior return coercions would not be relevant (#57664). - let parent_id = fcx.tcx.hir().get_parent_node(id); + let parent_id = fcx.tcx.hir().get_parent_node_by_hir_id(id); let fn_decl = if let Some((expr, blk_id)) = expression { pointing_at_return_type = fcx.suggest_mismatched_types_on_tail( &mut db, @@ -1267,7 +1268,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> cause.span, blk_id, ); - let parent = fcx.tcx.hir().get(parent_id); + let parent = fcx.tcx.hir().get_by_hir_id(parent_id); fcx.get_node_fn_decl(parent).map(|(fn_decl, _, is_main)| (fn_decl, is_main)) } else { fcx.get_fn_decl(parent_id) diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 8b80fba4d19d..ac794c3d6f34 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -2,7 +2,6 @@ use crate::check::FnCtxt; use rustc::infer::InferOk; use rustc::traits::{ObligationCause, ObligationCauseCode}; -use syntax::ast; use syntax::util::parser::PREC_POSTFIX; use syntax_pos::Span; use rustc::hir; @@ -164,7 +163,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { probe::Mode::MethodCall, expected, checked_ty, - ast::DUMMY_NODE_ID); + hir::DUMMY_HIR_ID); methods.retain(|m| { self.has_no_input_arg(m) && self.tcx.get_attrs(m.def_id).iter() @@ -218,15 +217,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let hir::def::Def::Local(id) = path.def { let parent = self.tcx.hir().get_parent_node(id); if let Some(Node::Expr(hir::Expr { - id, + hir_id, node: hir::ExprKind::Closure(_, decl, ..), .. })) = self.tcx.hir().find(parent) { - let parent = self.tcx.hir().get_parent_node(*id); + let parent = self.tcx.hir().get_parent_node_by_hir_id(*hir_id); if let (Some(Node::Expr(hir::Expr { node: hir::ExprKind::MethodCall(path, span, expr), .. - })), 1) = (self.tcx.hir().find(parent), decl.inputs.len()) { + })), 1) = (self.tcx.hir().find_by_hir_id(parent), decl.inputs.len()) { let self_ty = self.tables.borrow().node_type(expr[0].hir_id); let self_ty = format!("{:?}", self_ty); let name = path.ident.as_str(); @@ -470,8 +469,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { checked_ty: Ty<'tcx>, expected_ty: Ty<'tcx>, ) -> bool { - let parent_id = self.tcx.hir().get_parent_node(expr.id); - if let Some(parent) = self.tcx.hir().find(parent_id) { + let parent_id = self.tcx.hir().get_parent_node_by_hir_id(expr.hir_id); + if let Some(parent) = self.tcx.hir().find_by_hir_id(parent_id) { // Shouldn't suggest `.into()` on `const`s. if let Node::Item(Item { node: ItemKind::Const(_, _), .. }) = parent { // FIXME(estebank): modify once we decide to suggest `as` casts @@ -501,10 +500,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some(hir::Node::Expr(hir::Expr { node: hir::ExprKind::Struct(_, fields, _), .. - })) = self.tcx.hir().find(self.tcx.hir().get_parent_node(expr.id)) { + })) = self.tcx.hir().find_by_hir_id(self.tcx.hir().get_parent_node_by_hir_id(expr.hir_id)) { // `expr` is a literal field for a struct, only suggest if appropriate for field in fields { - if field.expr.id == expr.id && field.is_shorthand { + if field.expr.hir_id == expr.hir_id && field.is_shorthand { // This is a field literal prefix = format!("{}: ", field.ident); break; diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index 259a28645815..b14c56ddad00 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -105,7 +105,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn method_exists(&self, method_name: ast::Ident, self_ty: Ty<'tcx>, - call_expr_id: ast::NodeId, + call_expr_id: hir::HirId, allow_private: bool) -> bool { let mode = probe::Mode::MethodCall; @@ -131,7 +131,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { msg: &str, method_name: ast::Ident, self_ty: Ty<'tcx>, - call_expr_id: ast::NodeId, + call_expr_id: hir::HirId, ) { let has_params = self .probe_for_name( @@ -202,7 +202,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .unwrap().insert(import_def_id); } - self.tcx.check_stability(pick.item.def_id, Some(call_expr.id), span); + self.tcx.check_stability(pick.item.def_id, Some(call_expr.hir_id), span); let result = self.confirm_method( span, @@ -255,7 +255,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let mode = probe::Mode::MethodCall; let self_ty = self.resolve_type_vars_if_possible(&self_ty); self.probe_for_name(span, mode, method_name, IsSuggestion(false), - self_ty, call_expr.id, scope) + self_ty, call_expr.hir_id, scope) } /// `lookup_method_in_trait` is used for overloaded operators. @@ -399,7 +399,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { span: Span, method_name: ast::Ident, self_ty: Ty<'tcx>, - expr_id: ast::NodeId + expr_id: hir::HirId ) -> Result> { debug!( "resolve_ufcs: method_name={:?} self_ty={:?} expr_id={:?}", diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 709177212ada..c6116d58c1e7 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -209,7 +209,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { mode: Mode, return_type: Ty<'tcx>, self_ty: Ty<'tcx>, - scope_expr_id: ast::NodeId) + scope_expr_id: hir::HirId) -> Vec { debug!("probe(self_ty={:?}, return_type={}, scope_expr_id={})", self_ty, @@ -238,7 +238,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { item_name: ast::Ident, is_suggestion: IsSuggestion, self_ty: Ty<'tcx>, - scope_expr_id: ast::NodeId, + scope_expr_id: hir::HirId, scope: ProbeScope) -> PickResult<'tcx> { debug!("probe(self_ty={:?}, item_name={}, scope_expr_id={})", @@ -263,7 +263,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { return_type: Option>, is_suggestion: IsSuggestion, self_ty: Ty<'tcx>, - scope_expr_id: ast::NodeId, + scope_expr_id: hir::HirId, scope: ProbeScope, op: OP) -> Result> @@ -340,7 +340,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { "the type of this value must be known \ to call a method on a raw pointer on it"); } else { - self.tcx.lint_node( + self.tcx.lint_hir( lint::builtin::TYVAR_BEHIND_RAW_POINTER, scope_expr_id, span, @@ -825,13 +825,12 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { } fn assemble_extension_candidates_for_traits_in_scope(&mut self, - expr_id: ast::NodeId) + expr_hir_id: hir::HirId) -> Result<(), MethodError<'tcx>> { - if expr_id == ast::DUMMY_NODE_ID { + if expr_hir_id == hir::DUMMY_HIR_ID { return Ok(()) } let mut duplicates = FxHashSet::default(); - let expr_hir_id = self.tcx.hir().node_to_hir_id(expr_id); let opt_applicable_traits = self.tcx.in_scope_traits(expr_hir_id); if let Some(applicable_traits) = opt_applicable_traits { for trait_candidate in applicable_traits.iter() { @@ -1415,7 +1414,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { steps, IsSuggestion(true)); pcx.allow_similar_names = true; pcx.assemble_inherent_candidates(); - pcx.assemble_extension_candidates_for_traits_in_scope(ast::DUMMY_NODE_ID)?; + pcx.assemble_extension_candidates_for_traits_in_scope(hir::DUMMY_HIR_ID)?; let method_names = pcx.candidate_method_names(); pcx.allow_similar_names = false; @@ -1425,7 +1424,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { pcx.reset(); pcx.method_name = Some(method_name); pcx.assemble_inherent_candidates(); - pcx.assemble_extension_candidates_for_traits_in_scope(ast::DUMMY_NODE_ID) + pcx.assemble_extension_candidates_for_traits_in_scope(hir::DUMMY_HIR_ID) .ok().map_or(None, |_| { pcx.pick_core() .and_then(|pick| pick.ok()) diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 61fc58ec8618..0ff3b613fe7a 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -137,7 +137,7 @@ use crate::TypeAndSubsts; use crate::lint; use crate::util::captures::Captures; use crate::util::common::{ErrorReported, indenter}; -use crate::util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, NodeMap}; +use crate::util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, HirIdMap, NodeMap}; pub use self::Expectation::*; use self::autoderef::Autoderef; @@ -497,11 +497,11 @@ pub struct BreakableCtxt<'gcx: 'tcx, 'tcx> { pub struct EnclosingBreakables<'gcx: 'tcx, 'tcx> { stack: Vec>, - by_id: NodeMap, + by_id: HirIdMap, } impl<'gcx, 'tcx> EnclosingBreakables<'gcx, 'tcx> { - fn find_breakable(&mut self, target_id: ast::NodeId) -> &mut BreakableCtxt<'gcx, 'tcx> { + fn find_breakable(&mut self, target_id: hir::HirId) -> &mut BreakableCtxt<'gcx, 'tcx> { let ix = *self.by_id.get(&target_id).unwrap_or_else(|| { bug!("could not find enclosing breakable with id {}", target_id); }); @@ -2049,13 +2049,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// Produces warning on the given node, if the current point in the /// function is unreachable, and there hasn't been another warning. - fn warn_if_unreachable(&self, id: ast::NodeId, span: Span, kind: &str) { + fn warn_if_unreachable(&self, id: hir::HirId, span: Span, kind: &str) { if self.diverges.get() == Diverges::Always { self.diverges.set(Diverges::WarnedAlways); debug!("warn_if_unreachable: id={:?} span={:?} kind={}", id, span, kind); - self.tcx().lint_node( + self.tcx().lint_hir( lint::builtin::UNREACHABLE_CODE, id, span, &format!("unreachable {}", kind)); @@ -2143,8 +2143,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - pub fn write_field_index(&self, node_id: ast::NodeId, index: usize) { - let hir_id = self.tcx.hir().node_to_hir_id(node_id); + pub fn write_field_index(&self, hir_id: hir::HirId, index: usize) { self.tables.borrow_mut().field_indices_mut().insert(hir_id, index); } @@ -3007,7 +3006,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Closure arguments themselves can't be diverging, but // a previous argument can, e.g., `foo(panic!(), || {})`. if !check_closures { - self.warn_if_unreachable(arg.id, arg.span, "expression"); + self.warn_if_unreachable(arg.hir_id, arg.span, "expression"); } let is_closure = match arg.node { @@ -3338,7 +3337,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ret_coercion.borrow_mut() .coerce(self, &self.cause(return_expr.span, - ObligationCauseCode::ReturnType(return_expr.id)), + ObligationCauseCode::ReturnType(return_expr.hir_id)), return_expr, return_expr_ty); } @@ -3509,13 +3508,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let field_ty = self.field_ty(expr.span, field, substs); // Save the index of all fields regardless of their visibility in case // of error recovery. - self.write_field_index(expr.id, index); + self.write_field_index(expr.hir_id, index); if field.vis.is_accessible_from(def_scope, self.tcx) { let adjustments = autoderef.adjust_steps(self, needs); self.apply_adjustments(base, adjustments); autoderef.finalize(self); - self.tcx.check_stability(field.did, Some(expr.id), expr.span); + self.tcx.check_stability(field.did, Some(expr.hir_id), expr.span); return field_ty; } private_candidate = Some((base_def.did, field_ty)); @@ -3530,7 +3529,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.apply_adjustments(base, adjustments); autoderef.finalize(self); - self.write_field_index(expr.id, index); + self.write_field_index(expr.hir_id, index); return field_ty; } } @@ -3547,31 +3546,33 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { "field `{}` of struct `{}` is private", field, struct_path); // Also check if an accessible method exists, which is often what is meant. - if self.method_exists(field, expr_t, expr.id, false) && !self.expr_in_place(expr.id) { + if self.method_exists(field, expr_t, expr.hir_id, false) + && !self.expr_in_place(expr.hir_id) + { self.suggest_method_call( &mut err, &format!("a method `{}` also exists, call it with parentheses", field), field, expr_t, - expr.id, + expr.hir_id, ); } err.emit(); field_ty } else if field.name == keywords::Invalid.name() { self.tcx().types.err - } else if self.method_exists(field, expr_t, expr.id, true) { + } else if self.method_exists(field, expr_t, expr.hir_id, true) { let mut err = type_error_struct!(self.tcx().sess, field.span, expr_t, E0615, "attempted to take value of method `{}` on type `{}`", field, expr_t); - if !self.expr_in_place(expr.id) { + if !self.expr_in_place(expr.hir_id) { self.suggest_method_call( &mut err, "use parentheses to call the method", field, expr_t, - expr.id + expr.hir_id ); } else { err.help("methods are immutable and cannot be assigned to"); @@ -3611,7 +3612,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ) { let base = self.tcx.sess.source_map() .span_to_snippet(base.span) - .unwrap_or_else(|_| self.tcx.hir().node_to_pretty_string(base.id)); + .unwrap_or_else(|_| + self.tcx.hir().hir_to_pretty_string(base.hir_id)); let help = "instead of using tuple indexing, use array indexing"; let suggestion = format!("{}[{}]", base, field); let applicability = if len < user_index { @@ -3627,7 +3629,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty::RawPtr(..) => { let base = self.tcx.sess.source_map() .span_to_snippet(base.span) - .unwrap_or_else(|_| self.tcx.hir().node_to_pretty_string(base.id)); + .unwrap_or_else(|_| self.tcx.hir().hir_to_pretty_string(base.hir_id)); let msg = format!("`{}` is a raw pointer; try dereferencing it", base); let suggestion = format!("(*{}).{}", base, field); err.span_suggestion( @@ -3752,7 +3754,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn check_expr_struct_fields(&self, adt_ty: Ty<'tcx>, expected: Expectation<'tcx>, - expr_id: ast::NodeId, + expr_id: hir::HirId, span: Span, variant: &'tcx ty::VariantDef, ast_fields: &'gcx [hir::Field], @@ -3785,7 +3787,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let ident = tcx.adjust_ident(field.ident, variant.did, self.body_id).0; let field_type = if let Some((i, v_field)) = remaining_fields.remove(&ident) { seen_fields.insert(ident, field.span); - self.write_field_index(field.id, i); + self.write_field_index(field.hir_id, i); // We don't look at stability attributes on // struct-like enums (yet...), but it's definitely not @@ -3873,13 +3875,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn check_struct_path(&self, qpath: &QPath, - node_id: ast::NodeId) + hir_id: hir::HirId) -> Option<(&'tcx ty::VariantDef, Ty<'tcx>)> { let path_span = match *qpath { QPath::Resolved(_, ref path) => path.span, QPath::TypeRelative(ref qself, _) => qself.span }; - let (def, ty) = self.finish_resolving_struct_path(qpath, path_span, node_id); + let (def, ty) = self.finish_resolving_struct_path(qpath, path_span, hir_id); let variant = match def { Def::Err => { self.set_tainted_by_errors(); @@ -3907,7 +3909,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some((variant, did, substs)) = variant { debug!("check_struct_path: did={:?} substs={:?}", did, substs); - let hir_id = self.tcx.hir().node_to_hir_id(node_id); self.write_user_type_annotation_from_substs(hir_id, did, substs, None); // Check bounds on type arguments used in the path. @@ -3936,7 +3937,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { { // Find the relevant variant let (variant, adt_ty) = - if let Some(variant_ty) = self.check_struct_path(qpath, expr.id) { + if let Some(variant_ty) = self.check_struct_path(qpath, expr.hir_id) { variant_ty } else { self.check_struct_fields_on_error(fields, base_expr); @@ -3956,7 +3957,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { adt.variant_descr()); } - let error_happened = self.check_expr_struct_fields(adt_ty, expected, expr.id, path_span, + let error_happened = self.check_expr_struct_fields(adt_ty, expected, expr.hir_id, path_span, variant, fields, base_expr.is_none()); if let &Some(ref base_expr) = base_expr { // If check_expr_struct_fields hit an error, do not attempt to populate @@ -4005,7 +4006,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { expr, expected); // Warn for expressions after diverging siblings. - self.warn_if_unreachable(expr.id, expr.span, "expression"); + self.warn_if_unreachable(expr.hir_id, expr.span, "expression"); // Hide the outer diverging and has_errors flags. let old_diverges = self.diverges.get(); @@ -4021,7 +4022,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ExprKind::Loop(..) | ExprKind::While(..) | ExprKind::If(..) | ExprKind::Match(..) => {} - _ => self.warn_if_unreachable(expr.id, expr.span, "expression") + _ => self.warn_if_unreachable(expr.hir_id, expr.span, "expression") } // Any expression that produces a value of type `!` must have diverged @@ -4038,7 +4039,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.diverges.set(self.diverges.get() | old_diverges); self.has_errors.set(self.has_errors.get() | old_has_errors); - debug!("type of {} is...", self.tcx.hir().node_to_string(expr.id)); + debug!("type of {} is...", self.tcx.hir().hir_to_string(expr.hir_id)); debug!("... {:?}, expected is {:?}", ty, expected); ty @@ -4058,7 +4059,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); let tcx = self.tcx; - let id = expr.id; + let id = expr.hir_id; match expr.node { ExprKind::Box(ref subexpr) => { let expected_inner = expected.to_option(self).map_or(NoExpectation, |ty| { @@ -4190,7 +4191,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } ExprKind::Path(ref qpath) => { - let (def, opt_ty, segs) = self.resolve_ty_and_def_ufcs(qpath, expr.id, expr.span); + let (def, opt_ty, segs) = self.resolve_ty_and_def_ufcs(qpath, expr.hir_id, + expr.span); let ty = match def { Def::Err => { self.set_tainted_by_errors(); @@ -4255,6 +4257,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } ExprKind::Break(destination, ref expr_opt) => { if let Ok(target_id) = destination.target_id { + let target_id = tcx.hir().node_to_hir_id(target_id); let (e_ty, cause); if let Some(ref e) = *expr_opt { // If this is a break with a value, we need to type-check @@ -4360,7 +4363,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { *self.ret_coercion_span.borrow_mut() = Some(expr.span); } let cause = self.cause(expr.span, ObligationCauseCode::ReturnNoExpression); - if let Some((fn_decl, _)) = self.get_fn_decl(expr.id) { + if let Some((fn_decl, _)) = self.get_fn_decl(expr.hir_id) { coercion.coerce_forced_unit( self, &cause, @@ -4422,7 +4425,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { may_break: false, // Will get updated if/when we find a `break`. }; - let (ctxt, ()) = self.with_breakable_ctxt(expr.id, ctxt, || { + let (ctxt, ()) = self.with_breakable_ctxt(expr.hir_id, ctxt, || { self.check_expr_has_type_or_error(&cond, tcx.types.bool); let cond_diverging = self.diverges.get(); self.check_block_no_value(&body); @@ -4458,7 +4461,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { may_break: false, // Will get updated if/when we find a `break`. }; - let (ctxt, ()) = self.with_breakable_ctxt(expr.id, ctxt, || { + let (ctxt, ()) = self.with_breakable_ctxt(expr.hir_id, ctxt, || { self.check_block_no_value(&body); }); @@ -4715,7 +4718,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn finish_resolving_struct_path(&self, qpath: &QPath, path_span: Span, - node_id: ast::NodeId) + hir_id: hir::HirId) -> (Def, Ty<'tcx>) { match *qpath { @@ -4732,12 +4735,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } else { Def::Err }; - let hir_id = self.tcx.hir().node_to_hir_id(node_id); let (ty, def) = AstConv::associated_path_to_ty(self, hir_id, path_span, ty, def, segment, true); // Write back the new resolution. - let hir_id = self.tcx.hir().node_to_hir_id(node_id); self.tables.borrow_mut().type_dependent_defs_mut().insert(hir_id, def); (def, ty) @@ -4749,11 +4750,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// definition. The newly resolved definition is written into `type_dependent_defs`. pub fn resolve_ty_and_def_ufcs<'b>(&self, qpath: &'b QPath, - node_id: ast::NodeId, + hir_id: hir::HirId, span: Span) -> (Def, Option>, &'b [hir::PathSegment]) { - debug!("resolve_ty_and_def_ufcs: qpath={:?} node_id={:?} span={:?}", qpath, node_id, span); + debug!("resolve_ty_and_def_ufcs: qpath={:?} hir_id={:?} span={:?}", qpath, hir_id, span); let (ty, qself, item_segment) = match *qpath { QPath::Resolved(ref opt_qself, ref path) => { return (path.def, @@ -4764,14 +4765,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { (self.to_ty(qself), qself, segment) } }; - let hir_id = self.tcx.hir().node_to_hir_id(node_id); if let Some(cached_def) = self.tables.borrow().type_dependent_defs().get(hir_id) { // Return directly on cache hit. This is useful to avoid doubly reporting // errors with default match binding modes. See #44614. return (*cached_def, Some(ty), slice::from_ref(&**item_segment)) } let item_name = item_segment.ident; - let def = match self.resolve_ufcs(span, item_name, ty, node_id) { + let def = match self.resolve_ufcs(span, item_name, ty, hir_id) { Ok(def) => def, Err(error) => { let def = match error { @@ -4853,7 +4853,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { hir::StmtKind::Local(..) | hir::StmtKind::Expr(..) | hir::StmtKind::Semi(..) => {} } - self.warn_if_unreachable(stmt.id, stmt.span, "statement"); + self.warn_if_unreachable(stmt.hir_id, stmt.span, "statement"); // Hide the outer diverging and `has_errors` flags. let old_diverges = self.diverges.get(); @@ -4935,8 +4935,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { may_break: false, }; - let blk_node_id = self.tcx.hir().hir_to_node_id(blk.hir_id); - let (ctxt, ()) = self.with_breakable_ctxt(blk_node_id, ctxt, || { + let (ctxt, ()) = self.with_breakable_ctxt(blk.hir_id, ctxt, || { for s in &blk.stmts { self.check_stmt(s); } @@ -4946,12 +4945,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let tail_expr_ty = tail_expr.map(|t| self.check_expr_with_expectation(t, expected)); let mut enclosing_breakables = self.enclosing_breakables.borrow_mut(); - let ctxt = enclosing_breakables.find_breakable(blk_node_id); + let ctxt = enclosing_breakables.find_breakable(blk.hir_id); let coerce = ctxt.coerce.as_mut().unwrap(); if let Some(tail_expr_ty) = tail_expr_ty { let tail_expr = tail_expr.unwrap(); let cause = self.cause(tail_expr.span, - ObligationCauseCode::BlockTailExpression(blk_node_id)); + ObligationCauseCode::BlockTailExpression(blk.hir_id)); coerce.coerce(self, &cause, tail_expr, @@ -4975,6 +4974,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // that highlight errors inline. let mut sp = blk.span; let mut fn_span = None; + let blk_node_id = self.tcx.hir().hir_to_node_id(blk.hir_id); if let Some((decl, ident)) = self.get_parent_fn_decl(blk_node_id) { let ret_sp = decl.output.span(); if let Some(block_sp) = self.parent_item_span(blk_node_id) { @@ -5067,13 +5067,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - /// Given a `NodeId`, return the `FnDecl` of the method it is enclosed by and whether a + /// Given a `HirId`, return the `FnDecl` of the method it is enclosed by and whether a /// suggestion can be made, `None` otherwise. - pub fn get_fn_decl(&self, blk_id: ast::NodeId) -> Option<(hir::FnDecl, bool)> { + pub fn get_fn_decl(&self, blk_id: hir::HirId) -> Option<(hir::FnDecl, bool)> { // Get enclosing Fn, if it is a function or a trait method, unless there's a `loop` or // `while` before reaching it, as block tail returns are not available in them. self.tcx.hir().get_return_block(blk_id).and_then(|blk_id| { - let parent = self.tcx.hir().get(blk_id); + let parent = self.tcx.hir().get_by_hir_id(blk_id); self.get_node_fn_decl(parent).map(|(fn_decl, _, is_main)| (fn_decl, is_main)) }) } @@ -5090,7 +5090,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { expected: Ty<'tcx>, found: Ty<'tcx>, cause_span: Span, - blk_id: ast::NodeId, + blk_id: hir::HirId, ) -> bool { self.suggest_missing_semicolon(err, expression, expected, cause_span); let mut pointing_at_return_type = false; @@ -5303,14 +5303,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self_ty: Option>, def: Def, span: Span, - node_id: ast::NodeId) + hir_id: hir::HirId) -> (Ty<'tcx>, Def) { debug!( - "instantiate_value_path(segments={:?}, self_ty={:?}, def={:?}, node_id={})", + "instantiate_value_path(segments={:?}, self_ty={:?}, def={:?}, hir_id={})", segments, self_ty, def, - node_id, + hir_id, ); let tcx = self.tcx; @@ -5380,7 +5380,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Def::Local(nid) | Def::Upvar(nid, ..) => { let ty = self.local_ty(span, nid).decl_ty; let ty = self.normalize_associated_types_in(span, &ty); - self.write_ty(tcx.hir().node_to_hir_id(node_id), ty); + self.write_ty(hir_id, ty); return (ty, def); } _ => {} @@ -5532,7 +5532,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { assert!(!ty.has_escaping_bound_vars()); // First, store the "user substs" for later. - let hir_id = tcx.hir().node_to_hir_id(node_id); self.write_user_type_annotation_from_substs(hir_id, def_id, substs, user_self_ty); // Add all the obligations that are required, substituting and @@ -5566,10 +5565,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - self.check_rustc_args_require_const(def_id, node_id, span); + self.check_rustc_args_require_const(def_id, hir_id, span); debug!("instantiate_value_path: type of {:?} is {:?}", - node_id, + hir_id, ty_substituted); self.write_substs(hir_id, substs); @@ -5578,7 +5577,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn check_rustc_args_require_const(&self, def_id: DefId, - node_id: ast::NodeId, + hir_id: hir::HirId, span: Span) { // We're only interested in functions tagged with // #[rustc_args_required_const], so ignore anything that's not. @@ -5588,9 +5587,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // If our calling expression is indeed the function itself, we're good! // If not, generate an error that this can only be called directly. - if let Node::Expr(expr) = self.tcx.hir().get(self.tcx.hir().get_parent_node(node_id)) { + if let Node::Expr(expr) = self.tcx.hir().get_by_hir_id( + self.tcx.hir().get_parent_node_by_hir_id(hir_id)) + { if let ExprKind::Call(ref callee, ..) = expr.node { - if callee.id == node_id { + if callee.hir_id == hir_id { return } } @@ -5618,7 +5619,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - fn with_breakable_ctxt R, R>(&self, id: ast::NodeId, + fn with_breakable_ctxt R, R>(&self, id: hir::HirId, ctxt: BreakableCtxt<'gcx, 'tcx>, f: F) -> (BreakableCtxt<'gcx, 'tcx>, R) { let index; @@ -5655,22 +5656,22 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } /// Returns `true` if an expression is contained inside the LHS of an assignment expression. - fn expr_in_place(&self, mut expr_id: ast::NodeId) -> bool { + fn expr_in_place(&self, mut expr_id: hir::HirId) -> bool { let mut contained_in_place = false; while let hir::Node::Expr(parent_expr) = - self.tcx.hir().get(self.tcx.hir().get_parent_node(expr_id)) + self.tcx.hir().get_by_hir_id(self.tcx.hir().get_parent_node_by_hir_id(expr_id)) { match &parent_expr.node { hir::ExprKind::Assign(lhs, ..) | hir::ExprKind::AssignOp(_, lhs, ..) => { - if lhs.id == expr_id { + if lhs.hir_id == expr_id { contained_in_place = true; break; } } _ => (), } - expr_id = parent_expr.id; + expr_id = parent_expr.hir_id; } contained_in_place diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index 9b1a656b1bc9..284c8d1b7c42 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -51,8 +51,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { { let tcx = self.tcx; - debug!("check_binop(expr.id={}, expr={:?}, op={:?}, lhs_expr={:?}, rhs_expr={:?})", - expr.id, + debug!("check_binop(expr.hir_id={}, expr={:?}, op={:?}, lhs_expr={:?}, rhs_expr={:?})", + expr.hir_id, expr, op, lhs_expr, @@ -150,8 +150,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { is_assign: IsAssign) -> (Ty<'tcx>, Ty<'tcx>, Ty<'tcx>) { - debug!("check_overloaded_binop(expr.id={}, op={:?}, is_assign={:?})", - expr.id, + debug!("check_overloaded_binop(expr.hir_id={}, op={:?}, is_assign={:?})", + expr.hir_id, op, is_assign); diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index 5279fbd9cf6e..bf4df19556d0 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -694,8 +694,8 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for RegionCtxt<'a, 'gcx, 'tcx> { hir::ExprKind::Ret(Some(ref ret_expr)) => { let call_site_scope = self.call_site_scope; debug!( - "visit_expr ExprKind::Ret ret_expr.id {} call_site_scope: {:?}", - ret_expr.id, call_site_scope + "visit_expr ExprKind::Ret ret_expr.hir_id {} call_site_scope: {:?}", + ret_expr.hir_id, call_site_scope ); let call_site_region = self.tcx.mk_region(ty::ReScope(call_site_scope.unwrap())); self.type_of_node_must_outlive( diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index 1816b7454dd2..ffeef84c4176 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -67,7 +67,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for InferBorrowKindVisitor<'a, 'gcx, 'tcx> { let body = self.fcx.tcx.hir().body(body_id); self.visit_body(body); self.fcx - .analyze_closure(expr.id, expr.hir_id, expr.span, body, cc); + .analyze_closure(expr.hir_id, expr.span, body, cc); } intravisit::walk_expr(self, expr); @@ -77,7 +77,6 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for InferBorrowKindVisitor<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn analyze_closure( &self, - closure_node_id: ast::NodeId, closure_hir_id: hir::HirId, span: Span, body: &hir::Body, @@ -89,7 +88,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { debug!( "analyze_closure(id={:?}, body.id={:?})", - closure_node_id, + closure_hir_id, body.id() ); @@ -105,7 +104,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { span_bug!( span, "type of closure expr {:?} is not a closure {:?}", - closure_node_id, + closure_hir_id, t ); } @@ -121,6 +120,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { None }; + let closure_node_id = self.tcx.hir().hir_to_node_id(closure_hir_id); + self.tcx.with_freevars(closure_node_id, |freevars| { let mut freevar_list: Vec = Vec::with_capacity(freevars.len()); for freevar in freevars { @@ -582,7 +583,7 @@ impl<'a, 'gcx, 'tcx> InferBorrowKind<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'gcx, 'tcx> { fn consume( &mut self, - _consume_id: ast::NodeId, + _consume_id: hir::HirId, _consume_span: Span, cmt: &mc::cmt_<'tcx>, mode: euv::ConsumeMode, @@ -611,7 +612,7 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'gcx, 'tcx> { fn borrow( &mut self, - borrow_id: ast::NodeId, + borrow_id: hir::HirId, _borrow_span: Span, cmt: &mc::cmt_<'tcx>, _loan_region: ty::Region<'tcx>, @@ -638,7 +639,7 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'gcx, 'tcx> { fn mutate( &mut self, - _assignment_id: ast::NodeId, + _assignment_id: hir::HirId, _assignment_span: Span, assignee_cmt: &mc::cmt_<'tcx>, _mode: euv::MutateMode, diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index e4c0e3bd54d5..82a12b95d991 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -243,11 +243,11 @@ impl<'cx, 'gcx, 'tcx> Visitor<'gcx> for WritebackCx<'cx, 'gcx, 'tcx> { } hir::ExprKind::Struct(_, ref fields, _) => { for field in fields { - self.visit_field_id(field.id); + self.visit_field_id(field.hir_id); } } hir::ExprKind::Field(..) => { - self.visit_field_id(e.id); + self.visit_field_id(e.hir_id); } _ => {} } @@ -273,7 +273,7 @@ impl<'cx, 'gcx, 'tcx> Visitor<'gcx> for WritebackCx<'cx, 'gcx, 'tcx> { } hir::PatKind::Struct(_, ref fields, _) => { for field in fields { - self.visit_field_id(field.node.id); + self.visit_field_id(field.node.hir_id); } } _ => {} @@ -590,8 +590,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { } } - fn visit_field_id(&mut self, node_id: ast::NodeId) { - let hir_id = self.tcx().hir().node_to_hir_id(node_id); + fn visit_field_id(&mut self, hir_id: hir::HirId) { if let Some(index) = self.fcx .tables .borrow_mut() diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 2ef6aaf4f049..7587380acf8c 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -144,7 +144,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { fn visit_expr(&mut self, expr: &'tcx hir::Expr) { if let hir::ExprKind::Closure(..) = expr.node { - let def_id = self.tcx.hir().local_def_id(expr.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(expr.hir_id); self.tcx.generics_of(def_id); self.tcx.type_of(def_id); } From 8300f51936149ec43eb063205e4d03c54a308f3c Mon Sep 17 00:00:00 2001 From: Nathan Corbyn Date: Sat, 23 Feb 2019 18:39:27 +0000 Subject: [PATCH 051/381] Deny `async fn` in 2015 edition Fix style issues and update diagnostic messages Update src/librustc_passes/diagnostics.rs Co-Authored-By: doctorn Deny nested `async fn` in Rust 2015 edition Deny nested `async fn` in Rust 2015 edition Deny nested `async fn` in Rust 2015 edition --- src/librustc/hir/lowering.rs | 10 ++-- src/librustc/hir/map/def_collector.rs | 10 ++-- src/librustc_passes/ast_validation.rs | 14 ++++- src/librustc_passes/diagnostics.rs | 12 ++++ src/librustc_resolve/lib.rs | 4 +- src/librustc_save_analysis/sig.rs | 4 +- src/libsyntax/ast.rs | 4 +- src/libsyntax/ext/build.rs | 2 +- src/libsyntax/feature_gate.rs | 2 +- src/libsyntax/mut_visit.rs | 2 +- src/libsyntax/parse/parser.rs | 39 +++++++++---- src/libsyntax/print/pprust.rs | 4 +- src/libsyntax/visit.rs | 15 +++-- src/libsyntax_ext/test.rs | 2 +- .../editions/edition-deny-async-fns-2015.rs | 34 +++++++++++ .../edition-deny-async-fns-2015.stderr | 58 +++++++++++++++++++ .../feature-gate-async-await-2015-edition.rs | 3 +- ...ature-gate-async-await-2015-edition.stderr | 16 +++-- .../recursive-async-impl-trait-type.rs | 11 ++++ .../recursive-async-impl-trait-type.stderr | 11 ++++ .../impl-trait/recursive-impl-trait-type.rs | 6 +- .../recursive-impl-trait-type.stderr | 14 +---- 22 files changed, 215 insertions(+), 62 deletions(-) create mode 100644 src/test/ui/editions/edition-deny-async-fns-2015.rs create mode 100644 src/test/ui/editions/edition-deny-async-fns-2015.stderr create mode 100644 src/test/ui/impl-trait/recursive-async-impl-trait-type.rs create mode 100644 src/test/ui/impl-trait/recursive-async-impl-trait-type.stderr diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index f6b68682886e..f65bd255ba66 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -2906,7 +2906,7 @@ impl<'a> LoweringContext<'a> { // `impl Future` here because lower_body // only cares about the input argument patterns in the function // declaration (decl), not the return types. - let body_id = this.lower_async_body(decl, header.asyncness, body); + let body_id = this.lower_async_body(decl, header.asyncness.node, body); let (generics, fn_decl) = this.add_in_band_defs( generics, @@ -2916,7 +2916,7 @@ impl<'a> LoweringContext<'a> { decl, Some((fn_def_id, idty)), true, - header.asyncness.opt_return_id() + header.asyncness.node.opt_return_id() ), ); @@ -3410,14 +3410,14 @@ impl<'a> LoweringContext<'a> { ) } ImplItemKind::Method(ref sig, ref body) => { - let body_id = self.lower_async_body(&sig.decl, sig.header.asyncness, body); + let body_id = self.lower_async_body(&sig.decl, sig.header.asyncness.node, body); let impl_trait_return_allow = !self.is_in_trait_impl; let (generics, sig) = self.lower_method_sig( &i.generics, sig, impl_item_def_id, impl_trait_return_allow, - sig.header.asyncness.opt_return_id(), + sig.header.asyncness.node.opt_return_id(), ); (generics, hir::ImplItemKind::Method(sig, body_id)) } @@ -3637,7 +3637,7 @@ impl<'a> LoweringContext<'a> { fn lower_fn_header(&mut self, h: FnHeader) -> hir::FnHeader { hir::FnHeader { unsafety: self.lower_unsafety(h.unsafety), - asyncness: self.lower_asyncness(h.asyncness), + asyncness: self.lower_asyncness(h.asyncness.node), constness: self.lower_constness(h.constness), abi: h.abi, } diff --git a/src/librustc/hir/map/def_collector.rs b/src/librustc/hir/map/def_collector.rs index 72aa9570cc2f..12760f8b9828 100644 --- a/src/librustc/hir/map/def_collector.rs +++ b/src/librustc/hir/map/def_collector.rs @@ -73,7 +73,7 @@ impl<'a> DefCollector<'a> { decl: &'a FnDecl, body: &'a Block, ) { - let (closure_id, return_impl_trait_id) = match header.asyncness { + let (closure_id, return_impl_trait_id) = match header.asyncness.node { IsAsync::Async { closure_id, return_impl_trait_id, @@ -129,10 +129,10 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { } ItemKind::Fn( ref decl, - ref header @ FnHeader { asyncness: IsAsync::Async { .. }, .. }, + ref header, ref generics, ref body, - ) => { + ) if header.asyncness.node.is_async() => { return self.visit_async_fn( i.id, i.ident.name, @@ -242,9 +242,9 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { fn visit_impl_item(&mut self, ii: &'a ImplItem) { let def_data = match ii.node { ImplItemKind::Method(MethodSig { - header: ref header @ FnHeader { asyncness: IsAsync::Async { .. }, .. }, + ref header, ref decl, - }, ref body) => { + }, ref body) if header.asyncness.node.is_async() => { return self.visit_async_fn( ii.id, ii.ident.name, diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index 606ae2741283..f96fc3b897f8 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -463,7 +463,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { self.invalid_visibility(&impl_item.vis, None); if let ImplItemKind::Method(ref sig, _) = impl_item.node { self.check_trait_fn_not_const(sig.header.constness); - self.check_trait_fn_not_async(impl_item.span, sig.header.asyncness); + self.check_trait_fn_not_async(impl_item.span, sig.header.asyncness.node); } } } @@ -482,9 +482,10 @@ impl<'a> Visitor<'a> for AstValidator<'a> { .note("only trait implementations may be annotated with default").emit(); } } - ItemKind::Fn(_, header, ref generics, _) => { + ItemKind::Fn(_, ref header, ref generics, _) => { // We currently do not permit const generics in `const fn`, as // this is tantamount to allowing compile-time dependent typing. + self.visit_fn_header(header); if header.constness.node == Constness::Const { // Look for const generics and error if we find any. for param in &generics.params { @@ -535,7 +536,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { self.no_questions_in_bounds(bounds, "supertraits", true); for trait_item in trait_items { if let TraitItemKind::Method(ref sig, ref block) = trait_item.node { - self.check_trait_fn_not_async(trait_item.span, sig.header.asyncness); + self.check_trait_fn_not_async(trait_item.span, sig.header.asyncness.node); self.check_trait_fn_not_const(sig.header.constness); if block.is_none() { self.check_decl_no_pat(&sig.decl, |span, mut_ident| { @@ -702,6 +703,13 @@ impl<'a> Visitor<'a> for AstValidator<'a> { .span_bug(mac.span, "macro invocation missed in expansion; did you forget to override \ the relevant `fold_*()` method in `PlaceholderExpander`?"); } + + fn visit_fn_header(&mut self, header: &'a FnHeader) { + if header.asyncness.node.is_async() && self.session.rust_2015() { + struct_span_err!(self.session, header.asyncness.span, E0670, + "`async fn` is not permitted in the 2015 edition").emit(); + } + } } pub fn check_crate(session: &Session, krate: &Crate) -> (bool, bool) { diff --git a/src/librustc_passes/diagnostics.rs b/src/librustc_passes/diagnostics.rs index 19d4d3aeb0f6..e3c6b16703a4 100644 --- a/src/librustc_passes/diagnostics.rs +++ b/src/librustc_passes/diagnostics.rs @@ -310,6 +310,18 @@ loop { break; } ``` +"##, + +E0670: r##" +Rust 2015 does not permit the use of `async fn`. + +Example of erroneous code: + +```compile_fail,E0670 +async fn foo() {} +``` + +Switch to the Rust 2018 edition to use `async fn`. "## } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 1a7744786d80..3993964bd9db 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -806,9 +806,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> { debug!("(resolving function) entering function"); let (rib_kind, asyncness) = match function_kind { FnKind::ItemFn(_, ref header, ..) => - (ItemRibKind, header.asyncness), + (ItemRibKind, header.asyncness.node), FnKind::Method(_, ref sig, _, _) => - (TraitOrImplItemRibKind, sig.header.asyncness), + (TraitOrImplItemRibKind, sig.header.asyncness.node), FnKind::Closure(_) => // Async closures aren't resolved through `visit_fn`-- they're // processed separately diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs index 50a335bf9087..52f3a2077702 100644 --- a/src/librustc_save_analysis/sig.rs +++ b/src/librustc_save_analysis/sig.rs @@ -378,7 +378,7 @@ impl Sig for ast::Item { if header.constness.node == ast::Constness::Const { text.push_str("const "); } - if header.asyncness.is_async() { + if header.asyncness.node.is_async() { text.push_str("async "); } if header.unsafety == ast::Unsafety::Unsafe { @@ -936,7 +936,7 @@ fn make_method_signature( if m.header.constness.node == ast::Constness::Const { text.push_str("const "); } - if m.header.asyncness.is_async() { + if m.header.asyncness.node.is_async() { text.push_str("async "); } if m.header.unsafety == ast::Unsafety::Unsafe { diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 9c4945d74dbf..b6f9ae36da70 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -2216,7 +2216,7 @@ impl Item { #[derive(Clone, Copy, RustcEncodable, RustcDecodable, Debug)] pub struct FnHeader { pub unsafety: Unsafety, - pub asyncness: IsAsync, + pub asyncness: Spanned, pub constness: Spanned, pub abi: Abi, } @@ -2225,7 +2225,7 @@ impl Default for FnHeader { fn default() -> FnHeader { FnHeader { unsafety: Unsafety::Normal, - asyncness: IsAsync::NotAsync, + asyncness: dummy_spanned(IsAsync::NotAsync), constness: dummy_spanned(Constness::NotConst), abi: Abi::Rust, } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 27b0cfb16307..2f88749ace85 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -1017,7 +1017,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ast::ItemKind::Fn(self.fn_decl(inputs, ast::FunctionRetTy::Ty(output)), ast::FnHeader { unsafety: ast::Unsafety::Normal, - asyncness: ast::IsAsync::NotAsync, + asyncness: dummy_spanned(ast::IsAsync::NotAsync), constness: dummy_spanned(ast::Constness::NotConst), abi: Abi::Rust, }, diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index d574b410ccc0..0f7ba041f9c0 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1894,7 +1894,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { match fn_kind { FnKind::ItemFn(_, header, _, _) => { // Check for const fn and async fn declarations. - if header.asyncness.is_async() { + if header.asyncness.node.is_async() { gate_feature_post!(&self, async_await, span, "async fn is unstable"); } // Stability of const fn methods are covered in diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 86849f580d08..935142e8a2de 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -926,7 +926,7 @@ pub fn noop_flat_map_impl_item(mut item: ImplItem, visitor: &mut pub fn noop_visit_fn_header(header: &mut FnHeader, vis: &mut T) { let FnHeader { unsafety: _, asyncness, constness: _, abi: _ } = header; - vis.visit_asyncness(asyncness); + vis.visit_asyncness(&mut asyncness.node); } pub fn noop_visit_mod(Mod { inner, items, inline: _ }: &mut Mod, vis: &mut T) { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 5a753e1f8c8a..c257f05ae468 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -5001,6 +5001,11 @@ impl<'a> Parser<'a> { ) } + fn is_async_fn(&mut self) -> bool { + self.token.is_keyword(keywords::Async) && + self.look_ahead(1, |t| t.is_keyword(keywords::Fn)) + } + fn is_do_catch_block(&mut self) -> bool { self.token.is_keyword(keywords::Do) && self.look_ahead(1, |t| t.is_keyword(keywords::Catch)) && @@ -5133,7 +5138,8 @@ impl<'a> Parser<'a> { !self.is_union_item() && !self.is_crate_vis() && !self.is_existential_type_decl() && - !self.is_auto_trait_item() { + !self.is_auto_trait_item() && + !self.is_async_fn() { let pth = self.parse_path(PathStyle::Expr)?; if !self.eat(&token::Not) { @@ -6346,7 +6352,7 @@ impl<'a> Parser<'a> { /// Parses an item-position function declaration. fn parse_item_fn(&mut self, unsafety: Unsafety, - asyncness: IsAsync, + asyncness: Spanned, constness: Spanned, abi: Abi) -> PResult<'a, ItemInfo> { @@ -6378,7 +6384,7 @@ impl<'a> Parser<'a> { -> PResult<'a, ( Spanned, Unsafety, - IsAsync, + Spanned, Abi )> { @@ -6386,6 +6392,7 @@ impl<'a> Parser<'a> { let const_span = self.prev_span; let unsafety = self.parse_unsafety(); let asyncness = self.parse_asyncness(); + let asyncness = respan(self.prev_span, asyncness); let (constness, unsafety, abi) = if is_const_fn { (respan(const_span, Constness::Const), unsafety, Abi::Rust) } else { @@ -7796,7 +7803,7 @@ impl<'a> Parser<'a> { let abi = opt_abi.unwrap_or(Abi::C); let (ident, item_, extra_attrs) = self.parse_item_fn(Unsafety::Normal, - IsAsync::NotAsync, + respan(fn_span, IsAsync::NotAsync), respan(fn_span, Constness::NotConst), abi)?; let prev_span = self.prev_span; @@ -7840,7 +7847,7 @@ impl<'a> Parser<'a> { self.bump(); let (ident, item_, extra_attrs) = self.parse_item_fn(unsafety, - IsAsync::NotAsync, + respan(const_span, IsAsync::NotAsync), respan(const_span, Constness::Const), Abi::Rust)?; let prev_span = self.prev_span; @@ -7888,14 +7895,15 @@ impl<'a> Parser<'a> { // ASYNC FUNCTION ITEM let unsafety = self.parse_unsafety(); self.expect_keyword(keywords::Async)?; + let async_span = self.prev_span; self.expect_keyword(keywords::Fn)?; let fn_span = self.prev_span; let (ident, item_, extra_attrs) = self.parse_item_fn(unsafety, - IsAsync::Async { + respan(async_span, IsAsync::Async { closure_id: ast::DUMMY_NODE_ID, return_impl_trait_id: ast::DUMMY_NODE_ID, - }, + }), respan(fn_span, Constness::NotConst), Abi::Rust)?; let prev_span = self.prev_span; @@ -7904,6 +7912,13 @@ impl<'a> Parser<'a> { item_, visibility, maybe_append(attrs, extra_attrs)); + if self.span.rust_2015() { + self.diagnostic().struct_span_err_with_code( + async_span, + "`async fn` is not permitted in the 2015 edition", + DiagnosticId::Error("E0670".into()) + ).emit(); + } return Ok(Some(item)); } if self.check_keyword(keywords::Unsafe) && @@ -7951,7 +7966,7 @@ impl<'a> Parser<'a> { let fn_span = self.prev_span; let (ident, item_, extra_attrs) = self.parse_item_fn(Unsafety::Normal, - IsAsync::NotAsync, + respan(fn_span, IsAsync::NotAsync), respan(fn_span, Constness::NotConst), Abi::Rust)?; let prev_span = self.prev_span; @@ -7977,7 +7992,7 @@ impl<'a> Parser<'a> { let fn_span = self.prev_span; let (ident, item_, extra_attrs) = self.parse_item_fn(Unsafety::Unsafe, - IsAsync::NotAsync, + respan(fn_span, IsAsync::NotAsync), respan(fn_span, Constness::NotConst), abi)?; let prev_span = self.prev_span; @@ -8244,7 +8259,8 @@ impl<'a> Parser<'a> { lo: Span, visibility: Visibility ) -> PResult<'a, Option>> { - if macros_allowed && self.token.is_path_start() { + if macros_allowed && self.token.is_path_start() && + !(self.is_async_fn() && self.span.rust_2015()) { // MACRO INVOCATION ITEM let prev_span = self.prev_span; @@ -8299,7 +8315,8 @@ impl<'a> Parser<'a> { fn parse_assoc_macro_invoc(&mut self, item_kind: &str, vis: Option<&Visibility>, at_end: &mut bool) -> PResult<'a, Option> { - if self.token.is_path_start() { + if self.token.is_path_start() && + !(self.is_async_fn() && self.span.rust_2015()) { let prev_span = self.prev_span; let lo = self.span; let pth = self.parse_path(PathStyle::Mod)?; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index dcf9815f6d1b..d6265ebde1bb 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -3195,7 +3195,7 @@ impl<'a> State<'a> { ast::Constness::Const => self.word_nbsp("const")? } - self.print_asyncness(header.asyncness)?; + self.print_asyncness(header.asyncness.node)?; self.print_unsafety(header.unsafety)?; if header.abi != Abi::Rust { @@ -3247,7 +3247,7 @@ mod tests { ast::FnHeader { unsafety: ast::Unsafety::Normal, constness: source_map::dummy_spanned(ast::Constness::NotConst), - asyncness: ast::IsAsync::NotAsync, + asyncness: source_map::dummy_spanned(ast::IsAsync::NotAsync), abi: Abi::Rust, }, abba_ident, diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index a002394c710f..46d8d772e932 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -22,7 +22,7 @@ use syntax_pos::Span; #[derive(Copy, Clone)] pub enum FnKind<'a> { /// fn foo() or extern "Abi" fn foo() - ItemFn(Ident, FnHeader, &'a Visibility, &'a Block), + ItemFn(Ident, &'a FnHeader, &'a Visibility, &'a Block), /// fn foo(&self) Method(Ident, &'a MethodSig, Option<&'a Visibility>, &'a Block), @@ -149,6 +149,9 @@ pub trait Visitor<'ast>: Sized { fn visit_fn_ret_ty(&mut self, ret_ty: &'ast FunctionRetTy) { walk_fn_ret_ty(self, ret_ty) } + fn visit_fn_header(&mut self, _header: &'ast FnHeader) { + // Nothing to do + } } #[macro_export] @@ -225,8 +228,9 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) { visitor.visit_ty(typ); visitor.visit_expr(expr); } - ItemKind::Fn(ref declaration, header, ref generics, ref body) => { + ItemKind::Fn(ref declaration, ref header, ref generics, ref body) => { visitor.visit_generics(generics); + visitor.visit_fn_header(header); visitor.visit_fn(FnKind::ItemFn(item.ident, header, &item.vis, body), declaration, @@ -539,11 +543,13 @@ pub fn walk_fn<'a, V>(visitor: &mut V, kind: FnKind<'a>, declaration: &'a FnDecl where V: Visitor<'a>, { match kind { - FnKind::ItemFn(_, _, _, body) => { + FnKind::ItemFn(_, header, _, body) => { + visitor.visit_fn_header(header); walk_fn_decl(visitor, declaration); visitor.visit_block(body); } - FnKind::Method(_, _, _, body) => { + FnKind::Method(_, sig, _, body) => { + visitor.visit_fn_header(&sig.header); walk_fn_decl(visitor, declaration); visitor.visit_block(body); } @@ -564,6 +570,7 @@ pub fn walk_trait_item<'a, V: Visitor<'a>>(visitor: &mut V, trait_item: &'a Trai walk_list!(visitor, visit_expr, default); } TraitItemKind::Method(ref sig, None) => { + visitor.visit_fn_header(&sig.header); walk_fn_decl(visitor, &sig.decl); } TraitItemKind::Method(ref sig, Some(ref body)) => { diff --git a/src/libsyntax_ext/test.rs b/src/libsyntax_ext/test.rs index 371862465487..f4b625f8ea2c 100644 --- a/src/libsyntax_ext/test.rs +++ b/src/libsyntax_ext/test.rs @@ -257,7 +257,7 @@ fn has_test_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool { ); return false } - if header.asyncness.is_async() { + if header.asyncness.node.is_async() { sd.span_err( i.span, "async functions cannot be used for tests" diff --git a/src/test/ui/editions/edition-deny-async-fns-2015.rs b/src/test/ui/editions/edition-deny-async-fns-2015.rs new file mode 100644 index 000000000000..2105aa5835d0 --- /dev/null +++ b/src/test/ui/editions/edition-deny-async-fns-2015.rs @@ -0,0 +1,34 @@ +// edition:2015 + +#![feature(futures_api, async_await)] + +async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + +fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in the 2015 edition + +async fn async_baz() { //~ ERROR `async fn` is not permitted in the 2015 edition + async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition +} + +struct Foo {} + +impl Foo { + async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition +} + +trait Bar { + async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + //~^ ERROR trait fns cannot be declared `async` +} + +fn main() { + macro_rules! accept_item { ($x:item) => {} } + + accept_item! { + async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + } + + let inside_closure = || { + async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition + }; +} diff --git a/src/test/ui/editions/edition-deny-async-fns-2015.stderr b/src/test/ui/editions/edition-deny-async-fns-2015.stderr new file mode 100644 index 000000000000..1ad907aa7eb4 --- /dev/null +++ b/src/test/ui/editions/edition-deny-async-fns-2015.stderr @@ -0,0 +1,58 @@ +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:5:1 + | +LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + | ^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:7:12 + | +LL | fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in the 2015 edition + | ^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:10:5 + | +LL | async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition + | ^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:9:1 + | +LL | async fn async_baz() { //~ ERROR `async fn` is not permitted in the 2015 edition + | ^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:32:9 + | +LL | async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition + | ^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:28:9 + | +LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + | ^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:16:5 + | +LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + | ^^^^^ + +error[E0706]: trait fns cannot be declared `async` + --> $DIR/edition-deny-async-fns-2015.rs:20:5 + | +LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + | ^^^^^^^^^^^^^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:20:5 + | +LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + | ^^^^^ + +error: aborting due to 9 previous errors + +Some errors occurred: E0670, E0706. +For more information about an error, try `rustc --explain E0670`. diff --git a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs index 84dd1b9f814c..b6ab8ae0a9bc 100644 --- a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs +++ b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs @@ -2,7 +2,8 @@ #![feature(futures_api)] -async fn foo() {} //~ ERROR async fn is unstable +async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + //~^ ERROR async fn is unstable fn main() { let _ = async {}; //~ ERROR cannot find struct, variant or union type `async` diff --git a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr index 450b2c42f119..58051153e1f0 100644 --- a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr +++ b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr @@ -1,11 +1,17 @@ +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/feature-gate-async-await-2015-edition.rs:5:1 + | +LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + | ^^^^^ + error[E0422]: cannot find struct, variant or union type `async` in this scope - --> $DIR/feature-gate-async-await-2015-edition.rs:8:13 + --> $DIR/feature-gate-async-await-2015-edition.rs:9:13 | LL | let _ = async {}; //~ ERROR cannot find struct, variant or union type `async` | ^^^^^ not found in this scope error[E0425]: cannot find value `async` in this scope - --> $DIR/feature-gate-async-await-2015-edition.rs:9:13 + --> $DIR/feature-gate-async-await-2015-edition.rs:10:13 | LL | let _ = async || { true }; //~ ERROR cannot find value `async` in this scope | ^^^^^ not found in this scope @@ -13,12 +19,12 @@ LL | let _ = async || { true }; //~ ERROR cannot find value `async` in this error[E0658]: async fn is unstable (see issue #50547) --> $DIR/feature-gate-async-await-2015-edition.rs:5:1 | -LL | async fn foo() {} //~ ERROR async fn is unstable +LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(async_await)] to the crate attributes to enable -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors -Some errors occurred: E0422, E0425, E0658. +Some errors occurred: E0422, E0425, E0658, E0670. For more information about an error, try `rustc --explain E0422`. diff --git a/src/test/ui/impl-trait/recursive-async-impl-trait-type.rs b/src/test/ui/impl-trait/recursive-async-impl-trait-type.rs new file mode 100644 index 000000000000..40642523be25 --- /dev/null +++ b/src/test/ui/impl-trait/recursive-async-impl-trait-type.rs @@ -0,0 +1,11 @@ +// edition:2018 +// Test that impl trait does not allow creating recursive types that are +// otherwise forbidden when using `async` and `await`. + +#![feature(await_macro, async_await, futures_api, generators)] + +async fn recursive_async_function() -> () { //~ ERROR + await!(recursive_async_function()); +} + +fn main() {} diff --git a/src/test/ui/impl-trait/recursive-async-impl-trait-type.stderr b/src/test/ui/impl-trait/recursive-async-impl-trait-type.stderr new file mode 100644 index 000000000000..acdeabb2f989 --- /dev/null +++ b/src/test/ui/impl-trait/recursive-async-impl-trait-type.stderr @@ -0,0 +1,11 @@ +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-async-impl-trait-type.rs:7:40 + | +LL | async fn recursive_async_function() -> () { //~ ERROR + | ^^ expands to self-referential type + | + = note: expanded type is `std::future::GenFuture<[static generator@$DIR/recursive-async-impl-trait-type.rs:7:43: 9:2 {impl std::future::Future, ()}]>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0720`. diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type.rs b/src/test/ui/impl-trait/recursive-impl-trait-type.rs index facb191a3708..869876dc6a88 100644 --- a/src/test/ui/impl-trait/recursive-impl-trait-type.rs +++ b/src/test/ui/impl-trait/recursive-impl-trait-type.rs @@ -1,7 +1,7 @@ // Test that impl trait does not allow creating recursive types that are // otherwise forbidden. -#![feature(await_macro, async_await, futures_api, generators)] +#![feature(futures_api, generators)] fn option(i: i32) -> impl Sized { //~ ERROR if i < 0 { @@ -62,10 +62,6 @@ fn generator_hold() -> impl Sized { //~ ERROR } } -async fn recursive_async_function() -> () { //~ ERROR - await!(recursive_async_function()); -} - fn use_fn_ptr() -> impl Sized { // OK, error already reported fn_ptr() } diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type.stderr b/src/test/ui/impl-trait/recursive-impl-trait-type.stderr index 8a8789120577..96494229fd33 100644 --- a/src/test/ui/impl-trait/recursive-impl-trait-type.stderr +++ b/src/test/ui/impl-trait/recursive-impl-trait-type.stderr @@ -95,15 +95,7 @@ LL | fn generator_hold() -> impl Sized { //~ ERROR = note: expanded type is `[generator@$DIR/recursive-impl-trait-type.rs:58:5: 62:6 {impl Sized, ()}]` error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type.rs:65:40 - | -LL | async fn recursive_async_function() -> () { //~ ERROR - | ^^ expands to self-referential type - | - = note: expanded type is `std::future::GenFuture<[static generator@$DIR/recursive-impl-trait-type.rs:65:43: 67:2 {impl std::future::Future, ()}]>` - -error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type.rs:73:26 + --> $DIR/recursive-impl-trait-type.rs:69:26 | LL | fn mutual_recursion() -> impl Sync { //~ ERROR | ^^^^^^^^^ expands to self-referential type @@ -111,13 +103,13 @@ LL | fn mutual_recursion() -> impl Sync { //~ ERROR = note: type resolves to itself error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type.rs:77:28 + --> $DIR/recursive-impl-trait-type.rs:73:28 | LL | fn mutual_recursion_b() -> impl Sized { //~ ERROR | ^^^^^^^^^^ expands to self-referential type | = note: type resolves to itself -error: aborting due to 15 previous errors +error: aborting due to 14 previous errors For more information about this error, try `rustc --explain E0720`. From 43e7434120a10f86713091667258f58b6c245e2d Mon Sep 17 00:00:00 2001 From: memoryruins Date: Sun, 24 Feb 2019 11:58:08 -0500 Subject: [PATCH 052/381] Simplify exclude_should_panic flag. --- src/libtest/lib.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index a712d4092308..ea821a1d9392 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -408,7 +408,7 @@ fn optgroups() -> getopts::Options { let mut opts = getopts::Options::new(); opts.optflag("", "include-ignored", "Run ignored and not ignored tests") .optflag("", "ignored", "Run only ignored tests") - .optflag("", "exclude-should-panic", "Sets #[should_panic] tests to imply #[ignore]") + .optflag("", "exclude-should-panic", "Excludes tests marked as should_panic") .optflag("", "test", "Run tests and not benchmarks") .optflag("", "bench", "Run benchmarks instead of tests") .optflag("", "list", "List all tests and benchmarks") @@ -1376,12 +1376,9 @@ pub fn filter_tests(opts: &TestOpts, tests: Vec) -> Vec Date: Sun, 24 Feb 2019 20:34:24 +0100 Subject: [PATCH 053/381] prefer into_initialized over read_initialited --- src/libcore/mem.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 967a36f6f1c3..4b5056c5adff 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1321,6 +1321,9 @@ impl MaybeUninit { /// Reads the value from the `MaybeUninit` container. The resulting `T` is subject /// to the usual drop handling. /// + /// Whenever possible, it is preferrable to use [`into_initialized`] instead, which + /// prevents duplicating the content of the `MaybeUninit`. + /// /// # Safety /// /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized From c5b87a29ddea3674a2b2bfe797698fd2fc1bb211 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 24 Feb 2019 10:49:55 -0800 Subject: [PATCH 054/381] Fix sgx --- src/libstd/sys/sgx/net.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libstd/sys/sgx/net.rs b/src/libstd/sys/sgx/net.rs index f46ed022b214..c4c2de43ff7d 100644 --- a/src/libstd/sys/sgx/net.rs +++ b/src/libstd/sys/sgx/net.rs @@ -1,5 +1,5 @@ use fmt; -use io; +use io::{self, IoVec, IoVecMut}; use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr, ToSocketAddrs}; use time::Duration; use sys::{unsupported, Void, sgx_ineffective, AsInner, FromInner, IntoInner, TryIntoInner}; @@ -104,7 +104,7 @@ impl TcpStream { } pub fn read_vectored(&self, buf: &mut [IoVecMut<'_>]) -> io::Result { - let buf = match buf.get(0) { + let buf = match buf.get_mut(0) { Some(buf) => buf, None => return Ok(0), }; @@ -120,7 +120,7 @@ impl TcpStream { Some(buf) => buf, None => return Ok(0), }; - self.read(buf) + self.write(buf) } pub fn peer_addr(&self) -> io::Result { From 4785c748f2190440fb3f90b5319f121f2d31e0e4 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 24 Feb 2019 18:48:44 -0800 Subject: [PATCH 055/381] Fix redox --- src/libstd/sys/redox/net/tcp.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libstd/sys/redox/net/tcp.rs b/src/libstd/sys/redox/net/tcp.rs index 4396a6f963c7..abb9f72c324b 100644 --- a/src/libstd/sys/redox/net/tcp.rs +++ b/src/libstd/sys/redox/net/tcp.rs @@ -34,8 +34,8 @@ impl TcpStream { self.0.read(buf) } - pub fn read_vectored(&self, buf: &mut [IoVecMut<'_>]) -> io::Result { - match buf.iter_mut().find(|b| !b.is_empty()) { + pub fn read_vectored(&self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + match bufs.iter_mut().find(|b| !b.is_empty()) { Some(buf) => self.read(buf), None => Ok(0), } @@ -46,7 +46,7 @@ impl TcpStream { } pub fn write_vectored(&self, bufs: &[IoVec<'_>]) -> io::Result { - match buf.iter().find(|b| !b.is_empty()) { + match bufs.iter().find(|b| !b.is_empty()) { Some(buf) => self.write(buf), None => Ok(0), } From 77a30ec593002b8e1c7887a14432e9a60f8f74db Mon Sep 17 00:00:00 2001 From: ljedrz Date: Sun, 24 Feb 2019 19:47:40 +0100 Subject: [PATCH 056/381] update clippy --- src/tools/clippy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/clippy b/src/tools/clippy index 1fac38088609..7bc2e1d60d23 160000 --- a/src/tools/clippy +++ b/src/tools/clippy @@ -1 +1 @@ -Subproject commit 1fac38088609747627b07807945224cf1ea642ca +Subproject commit 7bc2e1d60d23a2f6a31d7a04d40171372d80b5b3 From 19c302c89af342de9f9a7c48c5f6cd6860fed546 Mon Sep 17 00:00:00 2001 From: Kornel Date: Sun, 24 Feb 2019 17:44:59 +0000 Subject: [PATCH 057/381] Update book submodule --- src/doc/book | 2 +- src/libstd/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/book b/src/doc/book index 0e9061cbaf95..fab9419503f0 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit 0e9061cbaf95adfb9f3ed36c6cef4c046f282e86 +Subproject commit fab9419503f0e34c1a06f9350a6705d0ce741dc6 diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 6dd3a6cc0fdb..f1219ec07727 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -187,7 +187,7 @@ //! [`sync`]: sync/index.html //! [`thread`]: thread/index.html //! [`use std::env`]: env/index.html -//! [`use`]: ../book/ch07-02-modules-and-use-to-control-scope-and-privacy.html#the-use-keyword-to-bring-paths-into-a-scope +//! [`use`]: ../book/ch07-02-defining-modules-to-control-scope-and-privacy.html //! [crates.io]: https://crates.io //! [deref-coercions]: ../book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods //! [files]: fs/struct.File.html From 1fd2f1687c6483fd3386f838c30332215c3f32b2 Mon Sep 17 00:00:00 2001 From: Tim Vermeulen Date: Mon, 25 Feb 2019 16:44:04 +0100 Subject: [PATCH 058/381] Have all methods of Filter and FilterMap use internal iteration --- src/libcore/iter/adapters/mod.rs | 37 ++++++-------------------------- 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/src/libcore/iter/adapters/mod.rs b/src/libcore/iter/adapters/mod.rs index bca1b76dbb97..d4ad22c16bbf 100644 --- a/src/libcore/iter/adapters/mod.rs +++ b/src/libcore/iter/adapters/mod.rs @@ -681,12 +681,7 @@ impl Iterator for Filter where P: FnMut(&I::Item) -> bool #[inline] fn next(&mut self) -> Option { - for x in &mut self.iter { - if (self.predicate)(&x) { - return Some(x); - } - } - None + self.try_for_each(Err).err() } #[inline] @@ -707,12 +702,9 @@ impl Iterator for Filter where P: FnMut(&I::Item) -> bool // Using the branchless version will also simplify the LLVM byte code, thus // leaving more budget for LLVM optimizations. #[inline] - fn count(mut self) -> usize { - let mut count = 0; - for x in &mut self.iter { - count += (self.predicate)(&x) as usize; - } - count + fn count(self) -> usize { + let mut predicate = self.predicate; + self.iter.map(|x| predicate(&x) as usize).sum() } #[inline] @@ -746,12 +738,7 @@ impl DoubleEndedIterator for Filter { #[inline] fn next_back(&mut self) -> Option { - for x in self.iter.by_ref().rev() { - if (self.predicate)(&x) { - return Some(x); - } - } - None + self.try_rfold((), |_, x| Err(x)).err() } #[inline] @@ -820,12 +807,7 @@ impl Iterator for FilterMap #[inline] fn next(&mut self) -> Option { - for x in self.iter.by_ref() { - if let Some(y) = (self.f)(x) { - return Some(y); - } - } - None + self.try_for_each(Err).err() } #[inline] @@ -863,12 +845,7 @@ impl DoubleEndedIterator for FilterMap { #[inline] fn next_back(&mut self) -> Option { - for x in self.iter.by_ref().rev() { - if let Some(y) = (self.f)(x) { - return Some(y); - } - } - None + self.try_rfold((), |_, x| Err(x)).err() } #[inline] From 834347ddafee7c33f3fd556c4976275b1111dc8f Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 9 Feb 2019 20:28:22 +0100 Subject: [PATCH 059/381] Add rustdoc JS non-std tests --- src/bootstrap/builder.rs | 1 + src/bootstrap/test.rs | 44 +++ src/test/rustdoc-js-not-std/basic.js | 7 + src/test/rustdoc-js-not-std/basic.rs | 1 + src/tools/rustdoc-js-not-std/tester.js | 365 +++++++++++++++++++++++++ src/tools/rustdoc-js/tester.js | 3 +- 6 files changed, 420 insertions(+), 1 deletion(-) create mode 100644 src/test/rustdoc-js-not-std/basic.js create mode 100644 src/test/rustdoc-js-not-std/basic.rs create mode 100644 src/tools/rustdoc-js-not-std/tester.js diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 7e6c0a9f52aa..71b9cd6f9fba 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -406,6 +406,7 @@ impl<'a> Builder<'a> { test::Clippy, test::CompiletestTest, test::RustdocJS, + test::RustdocJSNotStd, test::RustdocTheme, // Run bootstrap close to the end as it's unlikely to fail test::Bootstrap, diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 51412f79c3d0..7dcc10e8a091 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -612,6 +612,50 @@ impl Step for RustdocJS { } } +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct RustdocJSNotStd { + pub host: Interned, + pub target: Interned, + pub compiler: Compiler, +} + +impl Step for RustdocJSNotStd { + type Output = (); + const DEFAULT: bool = true; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun) -> ShouldRun { + run.path("src/test/rustdoc-js-not-std") + } + + fn make_run(run: RunConfig) { + let compiler = run.builder.compiler(run.builder.top_stage, run.host); + run.builder.ensure(RustdocJSNotStd { + host: run.host, + target: run.target, + compiler, + }); + } + + fn run(self, builder: &Builder) { + if let Some(ref nodejs) = builder.config.nodejs { + let mut command = Command::new(nodejs); + command.args(&["src/tools/rustdoc-js-not-std/tester.js", + &*self.host, + builder.top_stage.to_string().as_str()]); + builder.ensure(crate::doc::Std { + target: self.target, + stage: builder.top_stage, + }); + builder.run(&mut command); + } else { + builder.info( + "No nodejs found, skipping \"src/test/rustdoc-js-not-std\" tests" + ); + } + } +} + #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct RustdocUi { pub host: Interned, diff --git a/src/test/rustdoc-js-not-std/basic.js b/src/test/rustdoc-js-not-std/basic.js new file mode 100644 index 000000000000..d99b23468b60 --- /dev/null +++ b/src/test/rustdoc-js-not-std/basic.js @@ -0,0 +1,7 @@ +const QUERY = 'Fo'; + +const EXPECTED = { + 'others': [ + { 'path': 'basic', 'name': 'Foo' }, + ], +}; diff --git a/src/test/rustdoc-js-not-std/basic.rs b/src/test/rustdoc-js-not-std/basic.rs new file mode 100644 index 000000000000..4a835673a596 --- /dev/null +++ b/src/test/rustdoc-js-not-std/basic.rs @@ -0,0 +1 @@ +pub struct Foo; diff --git a/src/tools/rustdoc-js-not-std/tester.js b/src/tools/rustdoc-js-not-std/tester.js new file mode 100644 index 000000000000..61490b2f48d0 --- /dev/null +++ b/src/tools/rustdoc-js-not-std/tester.js @@ -0,0 +1,365 @@ +const fs = require('fs'); +const { spawnSync } = require('child_process'); + +const TEST_FOLDER = 'src/test/rustdoc-js-not-std/'; + +function getNextStep(content, pos, stop) { + while (pos < content.length && content[pos] !== stop && + (content[pos] === ' ' || content[pos] === '\t' || content[pos] === '\n')) { + pos += 1; + } + if (pos >= content.length) { + return null; + } + if (content[pos] !== stop) { + return pos * -1; + } + return pos; +} + +// Stupid function extractor based on indent. Doesn't support block +// comments. If someone puts a ' or an " in a block comment this +// will blow up. Template strings are not tested and might also be +// broken. +function extractFunction(content, functionName) { + var indent = 0; + var splitter = "function " + functionName + "("; + + while (true) { + var start = content.indexOf(splitter); + if (start === -1) { + break; + } + var pos = start; + while (pos < content.length && content[pos] !== ')') { + pos += 1; + } + if (pos >= content.length) { + break; + } + pos = getNextStep(content, pos + 1, '{'); + if (pos === null) { + break; + } else if (pos < 0) { + content = content.slice(-pos); + continue; + } + while (pos < content.length) { + // Eat single-line comments + if (content[pos] === '/' && pos > 0 && content[pos-1] === '/') { + do { + pos += 1; + } while (pos < content.length && content[pos] !== '\n'); + + // Eat quoted strings + } else if (content[pos] === '"' || content[pos] === "'" || content[pos] === "`") { + var stop = content[pos]; + var is_escaped = false; + do { + if (content[pos] === '\\') { + pos += 2; + } else { + pos += 1; + } + } while (pos < content.length && + (content[pos] !== stop || content[pos - 1] === '\\')); + + // Otherwise, check for indent + } else if (content[pos] === '{') { + indent += 1; + } else if (content[pos] === '}') { + indent -= 1; + if (indent === 0) { + return content.slice(start, pos + 1); + } + } + pos += 1; + } + content = content.slice(start + 1); + } + return null; +} + +// Stupid function extractor for array. +function extractArrayVariable(content, arrayName) { + var splitter = "var " + arrayName; + while (true) { + var start = content.indexOf(splitter); + if (start === -1) { + break; + } + var pos = getNextStep(content, start, '='); + if (pos === null) { + break; + } else if (pos < 0) { + content = content.slice(-pos); + continue; + } + pos = getNextStep(content, pos, '['); + if (pos === null) { + break; + } else if (pos < 0) { + content = content.slice(-pos); + continue; + } + while (pos < content.length) { + if (content[pos] === '"' || content[pos] === "'") { + var stop = content[pos]; + do { + if (content[pos] === '\\') { + pos += 2; + } else { + pos += 1; + } + } while (pos < content.length && + (content[pos] !== stop || content[pos - 1] === '\\')); + } else if (content[pos] === ']' && + pos + 1 < content.length && + content[pos + 1] === ';') { + return content.slice(start, pos + 2); + } + pos += 1; + } + content = content.slice(start + 1); + } + return null; +} + +// Stupid function extractor for variable. +function extractVariable(content, varName) { + var splitter = "var " + varName; + while (true) { + var start = content.indexOf(splitter); + if (start === -1) { + break; + } + var pos = getNextStep(content, start, '='); + if (pos === null) { + break; + } else if (pos < 0) { + content = content.slice(-pos); + continue; + } + while (pos < content.length) { + if (content[pos] === '"' || content[pos] === "'") { + var stop = content[pos]; + do { + if (content[pos] === '\\') { + pos += 2; + } else { + pos += 1; + } + } while (pos < content.length && + (content[pos] !== stop || content[pos - 1] === '\\')); + } else if (content[pos] === ';') { + return content.slice(start, pos + 1); + } + pos += 1; + } + content = content.slice(start + 1); + } + return null; +} + +function loadContent(content) { + var Module = module.constructor; + var m = new Module(); + m._compile(content, "tmp.js"); + m.exports.ignore_order = content.indexOf("\n// ignore-order\n") !== -1 || + content.startsWith("// ignore-order\n"); + m.exports.exact_check = content.indexOf("\n// exact-check\n") !== -1 || + content.startsWith("// exact-check\n"); + m.exports.should_fail = content.indexOf("\n// should-fail\n") !== -1 || + content.startsWith("// should-fail\n"); + return m.exports; +} + +function readFile(filePath) { + return fs.readFileSync(filePath, 'utf8'); +} + +function loadThings(thingsToLoad, kindOfLoad, funcToCall, fileContent) { + var content = ''; + for (var i = 0; i < thingsToLoad.length; ++i) { + var tmp = funcToCall(fileContent, thingsToLoad[i]); + if (tmp === null) { + console.error('unable to find ' + kindOfLoad + ' "' + thingsToLoad[i] + '"'); + process.exit(1); + } + content += tmp; + content += 'exports.' + thingsToLoad[i] + ' = ' + thingsToLoad[i] + ';'; + } + return content; +} + +function lookForEntry(entry, data) { + for (var i = 0; i < data.length; ++i) { + var allGood = true; + for (var key in entry) { + if (!entry.hasOwnProperty(key)) { + continue; + } + var value = data[i][key]; + // To make our life easier, if there is a "parent" type, we add it to the path. + if (key === 'path' && data[i]['parent'] !== undefined) { + if (value.length > 0) { + value += '::' + data[i]['parent']['name']; + } else { + value = data[i]['parent']['name']; + } + } + if (value !== entry[key]) { + allGood = false; + break; + } + } + if (allGood === true) { + return i; + } + } + return null; +} + +function remove_docs(out_dir) { + spawnSync('rm', ['-rf', out_dir]); +} + +function build_docs(out_dir, rustdoc_path, file_to_document) { + remove_docs(out_dir); + var c = spawnSync(rustdoc_path, [file_to_document, '-o', out_dir]); + var s = ''; + if (c.error || c.stderr.length > 0) { + if (c.stderr.length > 0) { + s += '==> STDERR: ' + c.stderr + '\n'; + } + s += '==> ERROR: ' + c.error; + } + return s; +} + +function load_files(out_folder, crate) { + var mainJs = readFile(out_folder + "/main.js"); + var ALIASES = readFile(out_folder + "/aliases.js"); + var searchIndex = readFile(out_folder + "/search-index.js").split("\n"); + if (searchIndex[searchIndex.length - 1].length === 0) { + searchIndex.pop(); + } + searchIndex.pop(); + searchIndex = loadContent(searchIndex.join("\n") + '\nexports.searchIndex = searchIndex;'); + finalJS = ""; + + var arraysToLoad = ["itemTypes"]; + var variablesToLoad = ["MAX_LEV_DISTANCE", "MAX_RESULTS", + "GENERICS_DATA", "NAME", "INPUTS_DATA", "OUTPUT_DATA", + "TY_PRIMITIVE", "TY_KEYWORD", + "levenshtein_row2"]; + // execQuery first parameter is built in getQuery (which takes in the search input). + // execQuery last parameter is built in buildIndex. + // buildIndex requires the hashmap from search-index. + var functionsToLoad = ["buildHrefAndPath", "pathSplitter", "levenshtein", "validateResult", + "getQuery", "buildIndex", "execQuery", "execSearch"]; + + finalJS += 'window = { "currentCrate": "' + crate + '" };\n'; + finalJS += 'var rootPath = "../";\n'; + finalJS += ALIASES; + finalJS += loadThings(arraysToLoad, 'array', extractArrayVariable, mainJs); + finalJS += loadThings(variablesToLoad, 'variable', extractVariable, mainJs); + finalJS += loadThings(functionsToLoad, 'function', extractFunction, mainJs); + + var loaded = loadContent(finalJS); + return [loaded, loaded.buildIndex(searchIndex.searchIndex)]; +} + +function main(argv) { + if (argv.length !== 4) { + console.error("USAGE: node tester.js [TOOLCHAIN] [STAGE]"); + return 1; + } + const toolchain = argv[2]; + const stage = argv[3]; + const rustdoc_path = './build/' + toolchain + '/stage' + stage + '/bin/rustdoc'; + + var errors = 0; + + fs.readdirSync(TEST_FOLDER).forEach(function(file) { + if (!file.endsWith('.js')) { + return; + } + var test_name = file.substring(0, file.length - 3); + process.stdout.write('Checking "' + test_name + '" ... '); + var rust_file = TEST_FOLDER + test_name + '.rs'; + + if (!fs.existsSync(rust_file)) { + console.error("FAILED"); + console.error("==> Missing '" + test_name + ".rs' file..."); + errors += 1; + return; + } + + var out_folder = "build/" + toolchain + "/stage" + stage + "/tests/rustdoc-js-not-std/" + + test_name; + + var ret = build_docs(out_folder, rustdoc_path, rust_file); + if (ret.length > 0) { + console.error("FAILED"); + console.error(ret); + errors += 1; + return; + } + + var [loaded, index] = load_files(out_folder, test_name); + var loadedFile = loadContent(readFile(TEST_FOLDER + file) + + 'exports.QUERY = QUERY;exports.EXPECTED = EXPECTED;'); + const expected = loadedFile.EXPECTED; + const query = loadedFile.QUERY; + const filter_crate = loadedFile.FILTER_CRATE; + const ignore_order = loadedFile.ignore_order; + const exact_check = loadedFile.exact_check; + const should_fail = loadedFile.should_fail; + var results = loaded.execSearch(loaded.getQuery(query), index); + var error_text = []; + for (var key in expected) { + if (!expected.hasOwnProperty(key)) { + continue; + } + if (!results.hasOwnProperty(key)) { + error_text.push('==> Unknown key "' + key + '"'); + break; + } + var entry = expected[key]; + var prev_pos = -1; + for (var i = 0; i < entry.length; ++i) { + var entry_pos = lookForEntry(entry[i], results[key]); + if (entry_pos === null) { + error_text.push("==> Result not found in '" + key + "': '" + + JSON.stringify(entry[i]) + "'"); + } else if (exact_check === true && prev_pos + 1 !== entry_pos) { + error_text.push("==> Exact check failed at position " + (prev_pos + 1) + ": " + + "expected '" + JSON.stringify(entry[i]) + "' but found '" + + JSON.stringify(results[key][i]) + "'"); + } else if (ignore_order === false && entry_pos < prev_pos) { + error_text.push("==> '" + JSON.stringify(entry[i]) + "' was supposed to be " + + " before '" + JSON.stringify(results[key][entry_pos]) + "'"); + } else { + prev_pos = entry_pos; + } + } + } + if (error_text.length === 0 && should_fail === true) { + errors += 1; + console.error("FAILED"); + console.error("==> Test was supposed to fail but all items were found..."); + } else if (error_text.length !== 0 && should_fail === false) { + errors += 1; + console.error("FAILED"); + console.error(error_text.join("\n")); + } else { + // In this case, we remove the docs, no need to keep them around. + remove_docs(out_folder); + console.log("OK"); + } + }); + return errors; +} + +process.exit(main(process.argv)); diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js index c41da93a9831..38fdcb4f468c 100644 --- a/src/tools/rustdoc-js/tester.js +++ b/src/tools/rustdoc-js/tester.js @@ -221,7 +221,8 @@ function lookForEntry(entry, data) { function main(argv) { if (argv.length !== 3) { - console.error("Expected toolchain to check as argument (for example 'x86_64-apple-darwin'"); + console.error("Expected toolchain to check as argument (for example \ + 'x86_64-apple-darwin')"); return 1; } var toolchain = argv[2]; From aa3ca321e92c541dce363634c9cea7cf23689a5e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 24 Feb 2019 00:08:43 +0100 Subject: [PATCH 060/381] Rename rustdoc js test suites --- src/bootstrap/builder.rs | 2 +- src/bootstrap/test.rs | 18 ++--- src/test/rustdoc-js-not-std/basic.js | 7 -- .../{rustdoc-js => rustdoc-js-std}/alias-1.js | 0 .../{rustdoc-js => rustdoc-js-std}/alias-2.js | 0 .../{rustdoc-js => rustdoc-js-std}/alias-3.js | 0 .../{rustdoc-js => rustdoc-js-std}/alias.js | 0 src/test/rustdoc-js-std/basic.js | 15 ++++ .../deduplication.js | 0 .../enum-option.js | 0 .../filter-crate.js | 0 .../fn-forget.js | 0 .../{rustdoc-js => rustdoc-js-std}/from_u.js | 0 .../{rustdoc-js => rustdoc-js-std}/keyword.js | 0 .../macro-check.js | 0 .../macro-print.js | 0 .../multi-query.js | 0 .../{rustdoc-js => rustdoc-js-std}/never.js | 0 .../{rustdoc-js => rustdoc-js-std}/quoted.js | 0 .../should-fail.js | 0 .../string-from_ut.js | 0 .../struct-vec.js | 0 .../{rustdoc-js => rustdoc-js-std}/vec-new.js | 0 src/test/rustdoc-js/basic.js | 12 +-- .../basic.rs | 0 .../tester.js | 74 ++++--------------- src/tools/rustdoc-js/tester.js | 65 +++++++++++++--- 27 files changed, 93 insertions(+), 100 deletions(-) delete mode 100644 src/test/rustdoc-js-not-std/basic.js rename src/test/{rustdoc-js => rustdoc-js-std}/alias-1.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/alias-2.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/alias-3.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/alias.js (100%) create mode 100644 src/test/rustdoc-js-std/basic.js rename src/test/{rustdoc-js => rustdoc-js-std}/deduplication.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/enum-option.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/filter-crate.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/fn-forget.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/from_u.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/keyword.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/macro-check.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/macro-print.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/multi-query.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/never.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/quoted.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/should-fail.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/string-from_ut.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/struct-vec.js (100%) rename src/test/{rustdoc-js => rustdoc-js-std}/vec-new.js (100%) rename src/test/{rustdoc-js-not-std => rustdoc-js}/basic.rs (100%) rename src/tools/{rustdoc-js-not-std => rustdoc-js-std}/tester.js (83%) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 71b9cd6f9fba..a471af257665 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -405,7 +405,7 @@ impl<'a> Builder<'a> { test::Miri, test::Clippy, test::CompiletestTest, - test::RustdocJS, + test::RustdocJSStd, test::RustdocJSNotStd, test::RustdocTheme, // Run bootstrap close to the end as it's unlikely to fail diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 7dcc10e8a091..c724d75c2dc0 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -574,22 +574,22 @@ impl Step for RustdocTheme { } #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct RustdocJS { +pub struct RustdocJSStd { pub host: Interned, pub target: Interned, } -impl Step for RustdocJS { +impl Step for RustdocJSStd { type Output = (); const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - run.path("src/test/rustdoc-js") + run.path("src/test/rustdoc-js-std") } fn make_run(run: RunConfig<'_>) { - run.builder.ensure(RustdocJS { + run.builder.ensure(RustdocJSStd { host: run.host, target: run.target, }); @@ -598,7 +598,7 @@ impl Step for RustdocJS { fn run(self, builder: &Builder<'_>) { if let Some(ref nodejs) = builder.config.nodejs { let mut command = Command::new(nodejs); - command.args(&["src/tools/rustdoc-js/tester.js", &*self.host]); + command.args(&["src/tools/rustdoc-js-std/tester.js", &*self.host]); builder.ensure(crate::doc::Std { target: self.target, stage: builder.top_stage, @@ -606,7 +606,7 @@ impl Step for RustdocJS { builder.run(&mut command); } else { builder.info( - "No nodejs found, skipping \"src/test/rustdoc-js\" tests" + "No nodejs found, skipping \"src/test/rustdoc-js-std\" tests" ); } } @@ -625,7 +625,7 @@ impl Step for RustdocJSNotStd { const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { - run.path("src/test/rustdoc-js-not-std") + run.path("src/test/rustdoc-js") } fn make_run(run: RunConfig) { @@ -640,7 +640,7 @@ impl Step for RustdocJSNotStd { fn run(self, builder: &Builder) { if let Some(ref nodejs) = builder.config.nodejs { let mut command = Command::new(nodejs); - command.args(&["src/tools/rustdoc-js-not-std/tester.js", + command.args(&["src/tools/rustdoc-js/tester.js", &*self.host, builder.top_stage.to_string().as_str()]); builder.ensure(crate::doc::Std { @@ -650,7 +650,7 @@ impl Step for RustdocJSNotStd { builder.run(&mut command); } else { builder.info( - "No nodejs found, skipping \"src/test/rustdoc-js-not-std\" tests" + "No nodejs found, skipping \"src/test/rustdoc-js\" tests" ); } } diff --git a/src/test/rustdoc-js-not-std/basic.js b/src/test/rustdoc-js-not-std/basic.js deleted file mode 100644 index d99b23468b60..000000000000 --- a/src/test/rustdoc-js-not-std/basic.js +++ /dev/null @@ -1,7 +0,0 @@ -const QUERY = 'Fo'; - -const EXPECTED = { - 'others': [ - { 'path': 'basic', 'name': 'Foo' }, - ], -}; diff --git a/src/test/rustdoc-js/alias-1.js b/src/test/rustdoc-js-std/alias-1.js similarity index 100% rename from src/test/rustdoc-js/alias-1.js rename to src/test/rustdoc-js-std/alias-1.js diff --git a/src/test/rustdoc-js/alias-2.js b/src/test/rustdoc-js-std/alias-2.js similarity index 100% rename from src/test/rustdoc-js/alias-2.js rename to src/test/rustdoc-js-std/alias-2.js diff --git a/src/test/rustdoc-js/alias-3.js b/src/test/rustdoc-js-std/alias-3.js similarity index 100% rename from src/test/rustdoc-js/alias-3.js rename to src/test/rustdoc-js-std/alias-3.js diff --git a/src/test/rustdoc-js/alias.js b/src/test/rustdoc-js-std/alias.js similarity index 100% rename from src/test/rustdoc-js/alias.js rename to src/test/rustdoc-js-std/alias.js diff --git a/src/test/rustdoc-js-std/basic.js b/src/test/rustdoc-js-std/basic.js new file mode 100644 index 000000000000..824cac710833 --- /dev/null +++ b/src/test/rustdoc-js-std/basic.js @@ -0,0 +1,15 @@ +const QUERY = 'String'; + +const EXPECTED = { + 'others': [ + { 'path': 'std::string', 'name': 'String' }, + { 'path': 'std::ffi', 'name': 'CString' }, + { 'path': 'std::ffi', 'name': 'OsString' }, + ], + 'in_args': [ + { 'path': 'std::str', 'name': 'eq' }, + ], + 'returned': [ + { 'path': 'std::string::String', 'name': 'add' }, + ], +}; diff --git a/src/test/rustdoc-js/deduplication.js b/src/test/rustdoc-js-std/deduplication.js similarity index 100% rename from src/test/rustdoc-js/deduplication.js rename to src/test/rustdoc-js-std/deduplication.js diff --git a/src/test/rustdoc-js/enum-option.js b/src/test/rustdoc-js-std/enum-option.js similarity index 100% rename from src/test/rustdoc-js/enum-option.js rename to src/test/rustdoc-js-std/enum-option.js diff --git a/src/test/rustdoc-js/filter-crate.js b/src/test/rustdoc-js-std/filter-crate.js similarity index 100% rename from src/test/rustdoc-js/filter-crate.js rename to src/test/rustdoc-js-std/filter-crate.js diff --git a/src/test/rustdoc-js/fn-forget.js b/src/test/rustdoc-js-std/fn-forget.js similarity index 100% rename from src/test/rustdoc-js/fn-forget.js rename to src/test/rustdoc-js-std/fn-forget.js diff --git a/src/test/rustdoc-js/from_u.js b/src/test/rustdoc-js-std/from_u.js similarity index 100% rename from src/test/rustdoc-js/from_u.js rename to src/test/rustdoc-js-std/from_u.js diff --git a/src/test/rustdoc-js/keyword.js b/src/test/rustdoc-js-std/keyword.js similarity index 100% rename from src/test/rustdoc-js/keyword.js rename to src/test/rustdoc-js-std/keyword.js diff --git a/src/test/rustdoc-js/macro-check.js b/src/test/rustdoc-js-std/macro-check.js similarity index 100% rename from src/test/rustdoc-js/macro-check.js rename to src/test/rustdoc-js-std/macro-check.js diff --git a/src/test/rustdoc-js/macro-print.js b/src/test/rustdoc-js-std/macro-print.js similarity index 100% rename from src/test/rustdoc-js/macro-print.js rename to src/test/rustdoc-js-std/macro-print.js diff --git a/src/test/rustdoc-js/multi-query.js b/src/test/rustdoc-js-std/multi-query.js similarity index 100% rename from src/test/rustdoc-js/multi-query.js rename to src/test/rustdoc-js-std/multi-query.js diff --git a/src/test/rustdoc-js/never.js b/src/test/rustdoc-js-std/never.js similarity index 100% rename from src/test/rustdoc-js/never.js rename to src/test/rustdoc-js-std/never.js diff --git a/src/test/rustdoc-js/quoted.js b/src/test/rustdoc-js-std/quoted.js similarity index 100% rename from src/test/rustdoc-js/quoted.js rename to src/test/rustdoc-js-std/quoted.js diff --git a/src/test/rustdoc-js/should-fail.js b/src/test/rustdoc-js-std/should-fail.js similarity index 100% rename from src/test/rustdoc-js/should-fail.js rename to src/test/rustdoc-js-std/should-fail.js diff --git a/src/test/rustdoc-js/string-from_ut.js b/src/test/rustdoc-js-std/string-from_ut.js similarity index 100% rename from src/test/rustdoc-js/string-from_ut.js rename to src/test/rustdoc-js-std/string-from_ut.js diff --git a/src/test/rustdoc-js/struct-vec.js b/src/test/rustdoc-js-std/struct-vec.js similarity index 100% rename from src/test/rustdoc-js/struct-vec.js rename to src/test/rustdoc-js-std/struct-vec.js diff --git a/src/test/rustdoc-js/vec-new.js b/src/test/rustdoc-js-std/vec-new.js similarity index 100% rename from src/test/rustdoc-js/vec-new.js rename to src/test/rustdoc-js-std/vec-new.js diff --git a/src/test/rustdoc-js/basic.js b/src/test/rustdoc-js/basic.js index 824cac710833..d99b23468b60 100644 --- a/src/test/rustdoc-js/basic.js +++ b/src/test/rustdoc-js/basic.js @@ -1,15 +1,7 @@ -const QUERY = 'String'; +const QUERY = 'Fo'; const EXPECTED = { 'others': [ - { 'path': 'std::string', 'name': 'String' }, - { 'path': 'std::ffi', 'name': 'CString' }, - { 'path': 'std::ffi', 'name': 'OsString' }, - ], - 'in_args': [ - { 'path': 'std::str', 'name': 'eq' }, - ], - 'returned': [ - { 'path': 'std::string::String', 'name': 'add' }, + { 'path': 'basic', 'name': 'Foo' }, ], }; diff --git a/src/test/rustdoc-js-not-std/basic.rs b/src/test/rustdoc-js/basic.rs similarity index 100% rename from src/test/rustdoc-js-not-std/basic.rs rename to src/test/rustdoc-js/basic.rs diff --git a/src/tools/rustdoc-js-not-std/tester.js b/src/tools/rustdoc-js-std/tester.js similarity index 83% rename from src/tools/rustdoc-js-not-std/tester.js rename to src/tools/rustdoc-js-std/tester.js index 61490b2f48d0..f49dd86c8c32 100644 --- a/src/tools/rustdoc-js-not-std/tester.js +++ b/src/tools/rustdoc-js-std/tester.js @@ -1,7 +1,6 @@ const fs = require('fs'); -const { spawnSync } = require('child_process'); -const TEST_FOLDER = 'src/test/rustdoc-js-not-std/'; +const TEST_FOLDER = 'src/test/rustdoc-js-std/'; function getNextStep(content, pos, stop) { while (pos < content.length && content[pos] !== stop && @@ -220,27 +219,17 @@ function lookForEntry(entry, data) { return null; } -function remove_docs(out_dir) { - spawnSync('rm', ['-rf', out_dir]); -} - -function build_docs(out_dir, rustdoc_path, file_to_document) { - remove_docs(out_dir); - var c = spawnSync(rustdoc_path, [file_to_document, '-o', out_dir]); - var s = ''; - if (c.error || c.stderr.length > 0) { - if (c.stderr.length > 0) { - s += '==> STDERR: ' + c.stderr + '\n'; - } - s += '==> ERROR: ' + c.error; +function main(argv) { + if (argv.length !== 3) { + console.error("Expected toolchain to check as argument (for example \ + 'x86_64-apple-darwin')"); + return 1; } - return s; -} + var toolchain = argv[2]; -function load_files(out_folder, crate) { - var mainJs = readFile(out_folder + "/main.js"); - var ALIASES = readFile(out_folder + "/aliases.js"); - var searchIndex = readFile(out_folder + "/search-index.js").split("\n"); + var mainJs = readFile("build/" + toolchain + "/doc/main.js"); + var ALIASES = readFile("build/" + toolchain + "/doc/aliases.js"); + var searchIndex = readFile("build/" + toolchain + "/doc/search-index.js").split("\n"); if (searchIndex[searchIndex.length - 1].length === 0) { searchIndex.pop(); } @@ -259,7 +248,7 @@ function load_files(out_folder, crate) { var functionsToLoad = ["buildHrefAndPath", "pathSplitter", "levenshtein", "validateResult", "getQuery", "buildIndex", "execQuery", "execSearch"]; - finalJS += 'window = { "currentCrate": "' + crate + '" };\n'; + finalJS += 'window = { "currentCrate": "std" };\n'; finalJS += 'var rootPath = "../";\n'; finalJS += ALIASES; finalJS += loadThings(arraysToLoad, 'array', extractArrayVariable, mainJs); @@ -267,47 +256,11 @@ function load_files(out_folder, crate) { finalJS += loadThings(functionsToLoad, 'function', extractFunction, mainJs); var loaded = loadContent(finalJS); - return [loaded, loaded.buildIndex(searchIndex.searchIndex)]; -} - -function main(argv) { - if (argv.length !== 4) { - console.error("USAGE: node tester.js [TOOLCHAIN] [STAGE]"); - return 1; - } - const toolchain = argv[2]; - const stage = argv[3]; - const rustdoc_path = './build/' + toolchain + '/stage' + stage + '/bin/rustdoc'; + var index = loaded.buildIndex(searchIndex.searchIndex); var errors = 0; fs.readdirSync(TEST_FOLDER).forEach(function(file) { - if (!file.endsWith('.js')) { - return; - } - var test_name = file.substring(0, file.length - 3); - process.stdout.write('Checking "' + test_name + '" ... '); - var rust_file = TEST_FOLDER + test_name + '.rs'; - - if (!fs.existsSync(rust_file)) { - console.error("FAILED"); - console.error("==> Missing '" + test_name + ".rs' file..."); - errors += 1; - return; - } - - var out_folder = "build/" + toolchain + "/stage" + stage + "/tests/rustdoc-js-not-std/" + - test_name; - - var ret = build_docs(out_folder, rustdoc_path, rust_file); - if (ret.length > 0) { - console.error("FAILED"); - console.error(ret); - errors += 1; - return; - } - - var [loaded, index] = load_files(out_folder, test_name); var loadedFile = loadContent(readFile(TEST_FOLDER + file) + 'exports.QUERY = QUERY;exports.EXPECTED = EXPECTED;'); const expected = loadedFile.EXPECTED; @@ -317,6 +270,7 @@ function main(argv) { const exact_check = loadedFile.exact_check; const should_fail = loadedFile.should_fail; var results = loaded.execSearch(loaded.getQuery(query), index); + process.stdout.write('Checking "' + file + '" ... '); var error_text = []; for (var key in expected) { if (!expected.hasOwnProperty(key)) { @@ -354,8 +308,6 @@ function main(argv) { console.error("FAILED"); console.error(error_text.join("\n")); } else { - // In this case, we remove the docs, no need to keep them around. - remove_docs(out_folder); console.log("OK"); } }); diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js index 38fdcb4f468c..f7c15eaf1b07 100644 --- a/src/tools/rustdoc-js/tester.js +++ b/src/tools/rustdoc-js/tester.js @@ -1,4 +1,5 @@ const fs = require('fs'); +const { spawnSync } = require('child_process'); const TEST_FOLDER = 'src/test/rustdoc-js/'; @@ -219,17 +220,22 @@ function lookForEntry(entry, data) { return null; } -function main(argv) { - if (argv.length !== 3) { - console.error("Expected toolchain to check as argument (for example \ - 'x86_64-apple-darwin')"); - return 1; +function build_docs(out_dir, rustdoc_path, file_to_document) { + var c = spawnSync(rustdoc_path, [file_to_document, '-o', out_dir]); + var s = ''; + if (c.error || c.stderr.length > 0) { + if (c.stderr.length > 0) { + s += '==> STDERR: ' + c.stderr + '\n'; + } + s += '==> ERROR: ' + c.error; } - var toolchain = argv[2]; + return s; +} - var mainJs = readFile("build/" + toolchain + "/doc/main.js"); - var ALIASES = readFile("build/" + toolchain + "/doc/aliases.js"); - var searchIndex = readFile("build/" + toolchain + "/doc/search-index.js").split("\n"); +function load_files(out_folder, crate) { + var mainJs = readFile(out_folder + "/main.js"); + var ALIASES = readFile(out_folder + "/aliases.js"); + var searchIndex = readFile(out_folder + "/search-index.js").split("\n"); if (searchIndex[searchIndex.length - 1].length === 0) { searchIndex.pop(); } @@ -248,7 +254,7 @@ function main(argv) { var functionsToLoad = ["buildHrefAndPath", "pathSplitter", "levenshtein", "validateResult", "getQuery", "buildIndex", "execQuery", "execSearch"]; - finalJS += 'window = { "currentCrate": "std" };\n'; + finalJS += 'window = { "currentCrate": "' + crate + '" };\n'; finalJS += 'var rootPath = "../";\n'; finalJS += ALIASES; finalJS += loadThings(arraysToLoad, 'array', extractArrayVariable, mainJs); @@ -256,11 +262,47 @@ function main(argv) { finalJS += loadThings(functionsToLoad, 'function', extractFunction, mainJs); var loaded = loadContent(finalJS); - var index = loaded.buildIndex(searchIndex.searchIndex); + return [loaded, loaded.buildIndex(searchIndex.searchIndex)]; +} + +function main(argv) { + if (argv.length !== 4) { + console.error("USAGE: node tester.js [TOOLCHAIN] [STAGE]"); + return 1; + } + const toolchain = argv[2]; + const stage = argv[3]; + const rustdoc_path = './build/' + toolchain + '/stage' + stage + '/bin/rustdoc'; var errors = 0; fs.readdirSync(TEST_FOLDER).forEach(function(file) { + if (!file.endsWith('.js')) { + return; + } + var test_name = file.substring(0, file.length - 3); + process.stdout.write('Checking "' + test_name + '" ... '); + var rust_file = TEST_FOLDER + test_name + '.rs'; + + if (!fs.existsSync(rust_file)) { + console.error("FAILED"); + console.error("==> Missing '" + test_name + ".rs' file..."); + errors += 1; + return; + } + + var out_folder = "build/" + toolchain + "/stage" + stage + "/tests/rustdoc-js/" + + test_name; + + var ret = build_docs(out_folder, rustdoc_path, rust_file); + if (ret.length > 0) { + console.error("FAILED"); + console.error(ret); + errors += 1; + return; + } + + var [loaded, index] = load_files(out_folder, test_name); var loadedFile = loadContent(readFile(TEST_FOLDER + file) + 'exports.QUERY = QUERY;exports.EXPECTED = EXPECTED;'); const expected = loadedFile.EXPECTED; @@ -270,7 +312,6 @@ function main(argv) { const exact_check = loadedFile.exact_check; const should_fail = loadedFile.should_fail; var results = loaded.execSearch(loaded.getQuery(query), index); - process.stdout.write('Checking "' + file + '" ... '); var error_text = []; for (var key in expected) { if (!expected.hasOwnProperty(key)) { From be23cd9a2d32295240e265aa2ed38bace71aca65 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 24 Feb 2019 01:04:07 +0100 Subject: [PATCH 061/381] Move documentation build into bootstrap --- src/bootstrap/test.rs | 46 ++++++++++++++++++++++++--- src/tools/rustdoc-js/tester.js | 58 ++++++++++------------------------ 2 files changed, 58 insertions(+), 46 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index c724d75c2dc0..83066468cd43 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -4,7 +4,7 @@ //! our CI. use std::env; -use std::ffi::OsString; +use std::ffi::{OsStr, OsString}; use std::fmt; use std::fs; use std::iter; @@ -639,14 +639,50 @@ impl Step for RustdocJSNotStd { fn run(self, builder: &Builder) { if let Some(ref nodejs) = builder.config.nodejs { - let mut command = Command::new(nodejs); - command.args(&["src/tools/rustdoc-js/tester.js", - &*self.host, - builder.top_stage.to_string().as_str()]); builder.ensure(crate::doc::Std { target: self.target, stage: builder.top_stage, }); + + let mut tests_to_run = Vec::new(); + let out = Path::new("build").join(&*self.host) + .join(&format!("stage{}", + builder.top_stage.to_string().as_str())) + .join("tests") + .join("rustdoc-js"); + + if let Ok(it) = fs::read_dir("src/test/rustdoc-js/") { + for entry in it { + if let Ok(entry) = entry { + let path = entry.path(); + if path.extension() != Some(&OsStr::new("rs")) || !path.is_file() { + continue + } + let path_clone = path.clone(); + let file_stem = path_clone.file_stem().expect("cannot get file stem"); + let out = out.join(file_stem); + let mut cmd = builder.rustdoc_cmd(self.host); + cmd.arg("-o"); + cmd.arg(out); + cmd.arg(path); + if if builder.config.verbose_tests { + try_run(builder, &mut cmd) + } else { + try_run_quiet(builder, &mut cmd) + } { + tests_to_run.push(file_stem.to_os_string()); + } + } + } + } + assert!(!tests_to_run.is_empty(), "no rustdoc-js test generated..."); + + tests_to_run.insert(0, "src/tools/rustdoc-js/tester.js".into()); + tests_to_run.insert(1, out.into()); + + let mut command = Command::new(nodejs); + command.args(&tests_to_run); + builder.run(&mut command); } else { builder.info( diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js index f7c15eaf1b07..833ce5d13704 100644 --- a/src/tools/rustdoc-js/tester.js +++ b/src/tools/rustdoc-js/tester.js @@ -220,18 +220,6 @@ function lookForEntry(entry, data) { return null; } -function build_docs(out_dir, rustdoc_path, file_to_document) { - var c = spawnSync(rustdoc_path, [file_to_document, '-o', out_dir]); - var s = ''; - if (c.error || c.stderr.length > 0) { - if (c.stderr.length > 0) { - s += '==> STDERR: ' + c.stderr + '\n'; - } - s += '==> ERROR: ' + c.error; - } - return s; -} - function load_files(out_folder, crate) { var mainJs = readFile(out_folder + "/main.js"); var ALIASES = readFile(out_folder + "/aliases.js"); @@ -266,44 +254,32 @@ function load_files(out_folder, crate) { } function main(argv) { - if (argv.length !== 4) { - console.error("USAGE: node tester.js [TOOLCHAIN] [STAGE]"); + if (argv.length < 4) { + console.error("USAGE: node tester.js OUT_FOLDER [TESTS]"); return 1; } - const toolchain = argv[2]; - const stage = argv[3]; - const rustdoc_path = './build/' + toolchain + '/stage' + stage + '/bin/rustdoc'; + if (argv[2].substr(-1) !== "/") { + argv[2] += "/"; + } + const out_folder = argv[2]; var errors = 0; - fs.readdirSync(TEST_FOLDER).forEach(function(file) { - if (!file.endsWith('.js')) { - return; - } - var test_name = file.substring(0, file.length - 3); + for (var j = 3; j < argv.length; ++j) { + const test_name = argv[j]; + process.stdout.write('Checking "' + test_name + '" ... '); - var rust_file = TEST_FOLDER + test_name + '.rs'; - - if (!fs.existsSync(rust_file)) { - console.error("FAILED"); - console.error("==> Missing '" + test_name + ".rs' file..."); + if (!fs.existsSync(TEST_FOLDER + test_name + ".js")) { errors += 1; - return; + console.error("FAILED"); + console.error("==> Missing '" + test_name + ".js' file..."); + continue; } - var out_folder = "build/" + toolchain + "/stage" + stage + "/tests/rustdoc-js/" + - test_name; + const test_out_folder = out_folder + test_name; - var ret = build_docs(out_folder, rustdoc_path, rust_file); - if (ret.length > 0) { - console.error("FAILED"); - console.error(ret); - errors += 1; - return; - } - - var [loaded, index] = load_files(out_folder, test_name); - var loadedFile = loadContent(readFile(TEST_FOLDER + file) + + var [loaded, index] = load_files(test_out_folder, test_name); + var loadedFile = loadContent(readFile(TEST_FOLDER + test_name + ".js") + 'exports.QUERY = QUERY;exports.EXPECTED = EXPECTED;'); const expected = loadedFile.EXPECTED; const query = loadedFile.QUERY; @@ -351,7 +327,7 @@ function main(argv) { } else { console.log("OK"); } - }); + } return errors; } From 240fad04f1c5517d5d38ab62c321f09c35a468d1 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 25 Feb 2019 17:47:12 +0100 Subject: [PATCH 062/381] Update to last updates --- src/bootstrap/test.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 83066468cd43..97a5c500b1a4 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -624,11 +624,11 @@ impl Step for RustdocJSNotStd { const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; - fn should_run(run: ShouldRun) -> ShouldRun { + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { run.path("src/test/rustdoc-js") } - fn make_run(run: RunConfig) { + fn make_run(run: RunConfig<'_>) { let compiler = run.builder.compiler(run.builder.top_stage, run.host); run.builder.ensure(RustdocJSNotStd { host: run.host, @@ -637,7 +637,7 @@ impl Step for RustdocJSNotStd { }); } - fn run(self, builder: &Builder) { + fn run(self, builder: &Builder<'_>) { if let Some(ref nodejs) = builder.config.nodejs { builder.ensure(crate::doc::Std { target: self.target, From f1b88abffbbfd4625d4002d1eef1275829aba29c Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Sun, 24 Feb 2019 10:01:27 -0500 Subject: [PATCH 063/381] Fix copy-pasted typo for read_string return value --- src/libstd/io/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index b634ea43e34e..b49eea391772 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1458,7 +1458,7 @@ pub trait BufRead: Read { /// /// If successful, this function will return the total number of bytes read. /// - /// An empty buffer returned indicates that the stream has reached EOF. + /// If this function returns `Ok(0)`, the stream has reached EOF. /// /// # Errors /// From 8e1b5d897a277e9e25685e9acac7333b9a0f8bf4 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Fri, 4 Jan 2019 02:57:11 +0300 Subject: [PATCH 064/381] Restrict value in key-value attributes to literals --- src/libsyntax/parse/attr.rs | 18 +++++++--- src/libsyntax/tokenstream.rs | 2 +- src/test/ui/attr-eq-token-tree.rs | 4 +-- src/test/ui/attr-eq-token-tree.stderr | 8 +++++ src/test/ui/macros/macro-attribute.rs | 2 +- src/test/ui/macros/macro-attribute.stderr | 8 ++--- .../ui/malformed/malformed-interpolated.rs | 18 ++++++++++ .../malformed/malformed-interpolated.stderr | 35 +++++++++++++++++++ src/test/ui/parser/attr-bad-meta-2.stderr | 4 +-- src/test/ui/proc-macro/proc-macro-gates.rs | 2 +- .../ui/proc-macro/proc-macro-gates.stderr | 4 +-- 11 files changed, 87 insertions(+), 18 deletions(-) create mode 100644 src/test/ui/attr-eq-token-tree.stderr create mode 100644 src/test/ui/malformed/malformed-interpolated.rs create mode 100644 src/test/ui/malformed/malformed-interpolated.stderr diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 9020c8c6a2dc..e7937f57002f 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -158,11 +158,21 @@ impl<'a> Parser<'a> { self.parse_token_tree().into() } else if self.eat(&token::Eq) { let eq = TokenTree::Token(self.prev_span, token::Eq); - let tree = match self.token { - token::CloseDelim(_) | token::Eof => self.unexpected()?, - _ => self.parse_token_tree(), + let mut is_interpolated_expr = false; + if let token::Interpolated(nt) = &self.token { + if let token::NtExpr(..) = **nt { + is_interpolated_expr = true; + } + } + let tokens = if is_interpolated_expr { + // We need to accept arbitrary interpolated expressions to continue + // supporting things like `doc = $expr` that work on stable. + // Non-literal interpolated expressions are rejected after expansion. + self.parse_token_tree().into() + } else { + self.parse_unsuffixed_lit()?.tokens() }; - TokenStream::new(vec![eq.into(), tree.into()]) + TokenStream::from_streams(vec![eq.into(), tokens]) } else { TokenStream::empty() }; diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs index 283679e758b5..4ce308d015c0 100644 --- a/src/libsyntax/tokenstream.rs +++ b/src/libsyntax/tokenstream.rs @@ -254,7 +254,7 @@ impl TokenStream { } } - fn from_streams(mut streams: Vec) -> TokenStream { + pub(crate) fn from_streams(mut streams: Vec) -> TokenStream { match streams.len() { 0 => TokenStream::empty(), 1 => streams.pop().unwrap(), diff --git a/src/test/ui/attr-eq-token-tree.rs b/src/test/ui/attr-eq-token-tree.rs index f28f76db9389..b8dfafc446e9 100644 --- a/src/test/ui/attr-eq-token-tree.rs +++ b/src/test/ui/attr-eq-token-tree.rs @@ -1,6 +1,4 @@ -// compile-pass - #![feature(custom_attribute, unrestricted_attribute_tokens)] -#[my_attr = !] // OK under feature gate +#[my_attr = !] //~ ERROR unexpected token: `!` fn main() {} diff --git a/src/test/ui/attr-eq-token-tree.stderr b/src/test/ui/attr-eq-token-tree.stderr new file mode 100644 index 000000000000..57d6a4e0f16a --- /dev/null +++ b/src/test/ui/attr-eq-token-tree.stderr @@ -0,0 +1,8 @@ +error: unexpected token: `!` + --> $DIR/attr-eq-token-tree.rs:3:11 + | +LL | #[my_attr = !] //~ ERROR unexpected token: `!` + | ^ + +error: aborting due to previous error + diff --git a/src/test/ui/macros/macro-attribute.rs b/src/test/ui/macros/macro-attribute.rs index 7ddac2745c5a..332246fd1cf9 100644 --- a/src/test/ui/macros/macro-attribute.rs +++ b/src/test/ui/macros/macro-attribute.rs @@ -1,4 +1,4 @@ #![feature(unrestricted_attribute_tokens)] -#[doc = $not_there] //~ ERROR expected `]`, found `not_there` +#[doc = $not_there] //~ ERROR unexpected token: `$` fn main() { } diff --git a/src/test/ui/macros/macro-attribute.stderr b/src/test/ui/macros/macro-attribute.stderr index fd4e7252d530..55f8e09b7e3e 100644 --- a/src/test/ui/macros/macro-attribute.stderr +++ b/src/test/ui/macros/macro-attribute.stderr @@ -1,8 +1,8 @@ -error: expected `]`, found `not_there` - --> $DIR/macro-attribute.rs:3:10 +error: unexpected token: `$` + --> $DIR/macro-attribute.rs:3:7 | -LL | #[doc = $not_there] //~ ERROR expected `]`, found `not_there` - | ^^^^^^^^^ expected `]` +LL | #[doc = $not_there] //~ ERROR unexpected token: `$` + | ^ error: aborting due to previous error diff --git a/src/test/ui/malformed/malformed-interpolated.rs b/src/test/ui/malformed/malformed-interpolated.rs new file mode 100644 index 000000000000..e452435968ba --- /dev/null +++ b/src/test/ui/malformed/malformed-interpolated.rs @@ -0,0 +1,18 @@ +#![feature(custom_attribute)] + +macro_rules! check { + ($expr: expr) => ( + #[my_attr = $expr] //~ ERROR suffixed literals are not allowed in attributes + //~| ERROR unexpected token: `-0` + //~| ERROR unexpected token: `0 + 0` + use main as _; + ); +} + +check!("0"); // OK +check!(0); // OK +check!(0u8); // ERROR, see above +check!(-0); // ERROR, see above +check!(0 + 0); // ERROR, see above + +fn main() {} diff --git a/src/test/ui/malformed/malformed-interpolated.stderr b/src/test/ui/malformed/malformed-interpolated.stderr new file mode 100644 index 000000000000..f9c89316fcd1 --- /dev/null +++ b/src/test/ui/malformed/malformed-interpolated.stderr @@ -0,0 +1,35 @@ +error: suffixed literals are not allowed in attributes + --> $DIR/malformed-interpolated.rs:5:21 + | +LL | #[my_attr = $expr] //~ ERROR suffixed literals are not allowed in attributes + | ^^^^^ +... +LL | check!(0u8); // ERROR, see above + | ------------ in this macro invocation + | + = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + +error: unexpected token: `-0` + --> $DIR/malformed-interpolated.rs:5:19 + | +LL | #[my_attr = $expr] //~ ERROR suffixed literals are not allowed in attributes + | ^ +... +LL | check!(-0); // ERROR, see above + | ----------- in this macro invocation + | + = help: try enabling `#![feature(unrestricted_attribute_tokens)]` + +error: unexpected token: `0 + 0` + --> $DIR/malformed-interpolated.rs:5:19 + | +LL | #[my_attr = $expr] //~ ERROR suffixed literals are not allowed in attributes + | ^ +... +LL | check!(0 + 0); // ERROR, see above + | -------------- in this macro invocation + | + = help: try enabling `#![feature(unrestricted_attribute_tokens)]` + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/parser/attr-bad-meta-2.stderr b/src/test/ui/parser/attr-bad-meta-2.stderr index ddc7a4b034b7..36e566b5aa41 100644 --- a/src/test/ui/parser/attr-bad-meta-2.stderr +++ b/src/test/ui/parser/attr-bad-meta-2.stderr @@ -1,8 +1,8 @@ error: unexpected token: `]` - --> $DIR/attr-bad-meta-2.rs:1:9 + --> $DIR/attr-bad-meta-2.rs:1:8 | LL | #[path =] //~ ERROR unexpected token: `]` - | ^ unexpected token after this + | ^ error: aborting due to previous error diff --git a/src/test/ui/proc-macro/proc-macro-gates.rs b/src/test/ui/proc-macro/proc-macro-gates.rs index b708f6303148..af6bfa08aaa9 100644 --- a/src/test/ui/proc-macro/proc-macro-gates.rs +++ b/src/test/ui/proc-macro/proc-macro-gates.rs @@ -19,7 +19,7 @@ mod _test2_inner { //~| ERROR: non-builtin inner attributes are unstable } -#[a = y] //~ ERROR: must only be followed by a delimiter token +#[a = "y"] //~ ERROR: must only be followed by a delimiter token fn _test3() {} fn attrs() { diff --git a/src/test/ui/proc-macro/proc-macro-gates.stderr b/src/test/ui/proc-macro/proc-macro-gates.stderr index c0bc06d358de..abfcf09bfaf6 100644 --- a/src/test/ui/proc-macro/proc-macro-gates.stderr +++ b/src/test/ui/proc-macro/proc-macro-gates.stderr @@ -33,8 +33,8 @@ LL | #![a] //~ ERROR: custom attributes cannot be applied to modules error: custom attribute invocations must be of the form #[foo] or #[foo(..)], the macro name must only be followed by a delimiter token --> $DIR/proc-macro-gates.rs:22:1 | -LL | #[a = y] //~ ERROR: must only be followed by a delimiter token - | ^^^^^^^^ +LL | #[a = "y"] //~ ERROR: must only be followed by a delimiter token + | ^^^^^^^^^^ error[E0658]: custom attributes cannot be applied to statements (see issue #54727) --> $DIR/proc-macro-gates.rs:31:5 From eccc19996b1e6a38568544e0be3cfe971caa12eb Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Mon, 25 Feb 2019 22:40:44 +0300 Subject: [PATCH 065/381] Stabilize `unrestricted_attribute_tokens` --- src/libcore/lib.rs | 1 - src/libsyntax/feature_gate.rs | 18 +++++++---------- src/test/run-pass/proc-macro/derive-b.rs | 2 -- src/test/ui/attr-eq-token-tree.rs | 2 +- ...ture-gate-unrestricted-attribute-tokens.rs | 7 ------- ...-gate-unrestricted-attribute-tokens.stderr | 20 ------------------- src/test/ui/macros/macro-attribute.rs | 2 -- src/test/ui/macros/macro-attribute.stderr | 2 +- .../malformed/malformed-interpolated.stderr | 4 ---- .../marker-attribute-with-values.rs | 5 ++--- .../marker-attribute-with-values.stderr | 12 +++++------ src/test/ui/parser/attr-bad-meta.rs | 2 -- src/test/ui/parser/attr-bad-meta.stderr | 2 +- .../ui/proc-macro/proc-macro-attributes.rs | 1 - .../proc-macro/proc-macro-attributes.stderr | 16 +++++---------- src/test/ui/unrestricted-attribute-tokens.rs | 4 +++- 16 files changed, 26 insertions(+), 74 deletions(-) delete mode 100644 src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.stderr diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index f2165c676fd4..63688e70c45c 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -123,7 +123,6 @@ #![feature(abi_unadjusted)] #![feature(adx_target_feature)] #![feature(maybe_uninit, maybe_uninit_slice, maybe_uninit_array)] -#![feature(unrestricted_attribute_tokens)] #![feature(external_doc)] #[prelude_import] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index c9b441193b76..cc1953e69d4c 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -21,8 +21,9 @@ use crate::early_buffered_lints::BufferedEarlyLintId; use crate::source_map::Spanned; use crate::edition::{ALL_EDITIONS, Edition}; use crate::visit::{self, FnKind, Visitor}; -use crate::parse::ParseSess; +use crate::parse::{token, ParseSess}; use crate::symbol::Symbol; +use crate::tokenstream::TokenTree; use errors::{DiagnosticBuilder, Handler}; use rustc_data_structures::fx::FxHashMap; @@ -431,9 +432,6 @@ declare_features! ( // Added for testing E0705; perma-unstable. (active, test_2018_feature, "1.31.0", Some(0), Some(Edition::Edition2018)), - // support for arbitrary delimited token streams in non-macro attributes - (active, unrestricted_attribute_tokens, "1.30.0", Some(55208), None), - // Allows unsized rvalues at arguments and parameters. (active, unsized_locals, "1.30.0", Some(48055), None), @@ -700,6 +698,8 @@ declare_features! ( (accepted, cfg_target_vendor, "1.33.0", Some(29718), None), // `extern crate self as foo;` puts local crate root into extern prelude under name `foo`. (accepted, extern_crate_self, "1.34.0", Some(56409), None), + // support for arbitrary delimited token streams in non-macro attributes + (accepted, unrestricted_attribute_tokens, "1.34.0", Some(55208), None), ); // If you change this, please modify `src/doc/unstable-book` as well. You must @@ -1660,13 +1660,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { match BUILTIN_ATTRIBUTES.iter().find(|(name, ..)| attr.path == name) { Some(&(name, _, template, _)) => self.check_builtin_attribute(attr, name, template), - None => if !self.context.features.unrestricted_attribute_tokens { - // Unfortunately, `parse_meta` cannot be called speculatively - // because it can report errors by itself, so we have to call it - // only if the feature is disabled. - if let Err(mut err) = attr.parse_meta(self.context.parse_sess) { - err.help("try enabling `#![feature(unrestricted_attribute_tokens)]`").emit() - } + None => if let Some(TokenTree::Token(_, token::Eq)) = attr.tokens.trees().next() { + // All key-value attributes are restricted to meta-item syntax. + attr.parse_meta(self.context.parse_sess).map_err(|mut err| err.emit()).ok(); } } } diff --git a/src/test/run-pass/proc-macro/derive-b.rs b/src/test/run-pass/proc-macro/derive-b.rs index af48cabca99e..da67534364b6 100644 --- a/src/test/run-pass/proc-macro/derive-b.rs +++ b/src/test/run-pass/proc-macro/derive-b.rs @@ -1,7 +1,5 @@ // aux-build:derive-b.rs -#![feature(unrestricted_attribute_tokens)] - extern crate derive_b; #[derive(Debug, PartialEq, derive_b::B, Eq, Copy, Clone)] diff --git a/src/test/ui/attr-eq-token-tree.rs b/src/test/ui/attr-eq-token-tree.rs index b8dfafc446e9..6aacb9d572ae 100644 --- a/src/test/ui/attr-eq-token-tree.rs +++ b/src/test/ui/attr-eq-token-tree.rs @@ -1,4 +1,4 @@ -#![feature(custom_attribute, unrestricted_attribute_tokens)] +#![feature(custom_attribute)] #[my_attr = !] //~ ERROR unexpected token: `!` fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.rs b/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.rs deleted file mode 100644 index 181c8592c547..000000000000 --- a/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![feature(custom_attribute)] - -#[my_attr(a b c d)] -//~^ ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `b` -//~| ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `c` -//~| ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `d` -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.stderr b/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.stderr deleted file mode 100644 index 1ddf2ff6d640..000000000000 --- a/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: expected one of `(`, `)`, `,`, `::`, or `=`, found `b` - --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:3:13 - | -LL | #[my_attr(a b c d)] - | ^ expected one of `(`, `)`, `,`, `::`, or `=` here - -error: expected one of `(`, `)`, `,`, `::`, or `=`, found `c` - --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:3:15 - | -LL | #[my_attr(a b c d)] - | ^ expected one of `(`, `)`, `,`, `::`, or `=` here - -error: expected one of `(`, `)`, `,`, `::`, or `=`, found `d` - --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:3:17 - | -LL | #[my_attr(a b c d)] - | ^ expected one of `(`, `)`, `,`, `::`, or `=` here - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/macros/macro-attribute.rs b/src/test/ui/macros/macro-attribute.rs index 332246fd1cf9..f580dfa8e34e 100644 --- a/src/test/ui/macros/macro-attribute.rs +++ b/src/test/ui/macros/macro-attribute.rs @@ -1,4 +1,2 @@ -#![feature(unrestricted_attribute_tokens)] - #[doc = $not_there] //~ ERROR unexpected token: `$` fn main() { } diff --git a/src/test/ui/macros/macro-attribute.stderr b/src/test/ui/macros/macro-attribute.stderr index 55f8e09b7e3e..7314e4833489 100644 --- a/src/test/ui/macros/macro-attribute.stderr +++ b/src/test/ui/macros/macro-attribute.stderr @@ -1,5 +1,5 @@ error: unexpected token: `$` - --> $DIR/macro-attribute.rs:3:7 + --> $DIR/macro-attribute.rs:1:7 | LL | #[doc = $not_there] //~ ERROR unexpected token: `$` | ^ diff --git a/src/test/ui/malformed/malformed-interpolated.stderr b/src/test/ui/malformed/malformed-interpolated.stderr index f9c89316fcd1..24aa590c4d90 100644 --- a/src/test/ui/malformed/malformed-interpolated.stderr +++ b/src/test/ui/malformed/malformed-interpolated.stderr @@ -17,8 +17,6 @@ LL | #[my_attr = $expr] //~ ERROR suffixed literals are not allowed in a ... LL | check!(-0); // ERROR, see above | ----------- in this macro invocation - | - = help: try enabling `#![feature(unrestricted_attribute_tokens)]` error: unexpected token: `0 + 0` --> $DIR/malformed-interpolated.rs:5:19 @@ -28,8 +26,6 @@ LL | #[my_attr = $expr] //~ ERROR suffixed literals are not allowed in a ... LL | check!(0 + 0); // ERROR, see above | -------------- in this macro invocation - | - = help: try enabling `#![feature(unrestricted_attribute_tokens)]` error: aborting due to 3 previous errors diff --git a/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs b/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs index ea356d574f62..f8bcec78650e 100644 --- a/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs +++ b/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs @@ -1,5 +1,4 @@ #![feature(marker_trait_attr)] -#![feature(unrestricted_attribute_tokens)] #[marker(always)] trait Marker1 {} @@ -9,8 +8,8 @@ trait Marker1 {} trait Marker2 {} //~^^ ERROR attribute must be of the form -#[marker(key = value)] +#[marker(key = "value")] trait Marker3 {} -//~^^ ERROR expected unsuffixed literal or identifier, found value +//~^^ ERROR attribute must be of the form `#[marker]` fn main() {} diff --git a/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr b/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr index c683b393d84e..2b31dcb4760a 100644 --- a/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr +++ b/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr @@ -1,20 +1,20 @@ error: attribute must be of the form `#[marker]` - --> $DIR/marker-attribute-with-values.rs:4:1 + --> $DIR/marker-attribute-with-values.rs:3:1 | LL | #[marker(always)] | ^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[marker]` - --> $DIR/marker-attribute-with-values.rs:8:1 + --> $DIR/marker-attribute-with-values.rs:7:1 | LL | #[marker("never")] | ^^^^^^^^^^^^^^^^^^ -error: expected unsuffixed literal or identifier, found value - --> $DIR/marker-attribute-with-values.rs:12:10 +error: attribute must be of the form `#[marker]` + --> $DIR/marker-attribute-with-values.rs:11:1 | -LL | #[marker(key = value)] - | ^^^ +LL | #[marker(key = "value")] + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/attr-bad-meta.rs b/src/test/ui/parser/attr-bad-meta.rs index 7fe542724914..8001977f5a39 100644 --- a/src/test/ui/parser/attr-bad-meta.rs +++ b/src/test/ui/parser/attr-bad-meta.rs @@ -1,4 +1,2 @@ -#![feature(unrestricted_attribute_tokens)] - #[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*` mod m {} diff --git a/src/test/ui/parser/attr-bad-meta.stderr b/src/test/ui/parser/attr-bad-meta.stderr index 7351702ec9dc..693da95017d2 100644 --- a/src/test/ui/parser/attr-bad-meta.stderr +++ b/src/test/ui/parser/attr-bad-meta.stderr @@ -1,5 +1,5 @@ error: expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*` - --> $DIR/attr-bad-meta.rs:3:7 + --> $DIR/attr-bad-meta.rs:1:7 | LL | #[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*` | ^ expected one of `(`, `::`, `=`, `[`, `]`, or `{` here diff --git a/src/test/ui/proc-macro/proc-macro-attributes.rs b/src/test/ui/proc-macro/proc-macro-attributes.rs index 1cc824e943c7..062053453ee4 100644 --- a/src/test/ui/proc-macro/proc-macro-attributes.rs +++ b/src/test/ui/proc-macro/proc-macro-attributes.rs @@ -8,7 +8,6 @@ extern crate derive_b; #[B(D)] //~ ERROR `B` is ambiguous #[B(E = "foo")] //~ ERROR `B` is ambiguous #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous - //~^ ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `tokens` #[derive(B)] struct B; diff --git a/src/test/ui/proc-macro/proc-macro-attributes.stderr b/src/test/ui/proc-macro/proc-macro-attributes.stderr index 7ac44c9354dd..a5ec787ac67e 100644 --- a/src/test/ui/proc-macro/proc-macro-attributes.stderr +++ b/src/test/ui/proc-macro/proc-macro-attributes.stderr @@ -13,7 +13,7 @@ LL | #[B] //~ ERROR `B` is ambiguous | ^ ambiguous name | note: `B` could refer to the derive helper attribute defined here - --> $DIR/proc-macro-attributes.rs:12:10 + --> $DIR/proc-macro-attributes.rs:11:10 | LL | #[derive(B)] | ^ @@ -30,7 +30,7 @@ LL | #[B(D)] //~ ERROR `B` is ambiguous | ^ ambiguous name | note: `B` could refer to the derive helper attribute defined here - --> $DIR/proc-macro-attributes.rs:12:10 + --> $DIR/proc-macro-attributes.rs:11:10 | LL | #[derive(B)] | ^ @@ -47,7 +47,7 @@ LL | #[B(E = "foo")] //~ ERROR `B` is ambiguous | ^ ambiguous name | note: `B` could refer to the derive helper attribute defined here - --> $DIR/proc-macro-attributes.rs:12:10 + --> $DIR/proc-macro-attributes.rs:11:10 | LL | #[derive(B)] | ^ @@ -64,7 +64,7 @@ LL | #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous | ^ ambiguous name | note: `B` could refer to the derive helper attribute defined here - --> $DIR/proc-macro-attributes.rs:12:10 + --> $DIR/proc-macro-attributes.rs:11:10 | LL | #[derive(B)] | ^ @@ -74,13 +74,7 @@ note: `B` could also refer to the derive macro imported here LL | #[macro_use] | ^^^^^^^^^^^^ -error: expected one of `(`, `)`, `,`, `::`, or `=`, found `tokens` - --> $DIR/proc-macro-attributes.rs:10:15 - | -LL | #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous - | ^^^^^^ expected one of `(`, `)`, `,`, `::`, or `=` here - -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors Some errors occurred: E0658, E0659. For more information about an error, try `rustc --explain E0658`. diff --git a/src/test/ui/unrestricted-attribute-tokens.rs b/src/test/ui/unrestricted-attribute-tokens.rs index 9d8ba03eca56..4798f7b396cd 100644 --- a/src/test/ui/unrestricted-attribute-tokens.rs +++ b/src/test/ui/unrestricted-attribute-tokens.rs @@ -1,6 +1,8 @@ // compile-pass -#![feature(custom_attribute, unrestricted_attribute_tokens)] +#![feature(custom_attribute)] #[my_attr(a b c d)] +#[my_attr[a b c d]] +#[my_attr{a b c d}] fn main() {} From 0f6b148db278dd14b11e009c60712f0303c05f79 Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 22:14:18 +0000 Subject: [PATCH 066/381] Allow lang and lib features to share names --- src/librustc/middle/stability.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 30a43c7a9259..b93164c1f676 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -403,10 +403,14 @@ impl<'a, 'tcx> Index<'tcx> { active_features: Default::default(), }; - let ref active_lib_features = tcx.features().declared_lib_features; + let active_lib_features = &tcx.features().declared_lib_features; + let active_lang_features = &tcx.features().declared_lang_features; - // Put the active features into a map for quick lookup - index.active_features = active_lib_features.iter().map(|&(ref s, _)| s.clone()).collect(); + // Put the active features into a map for quick lookup. + index.active_features = + active_lib_features.iter().map(|&(ref s, ..)| s.clone()) + .chain(active_lang_features.iter().map(|&(ref s, ..)| s.clone())) + .collect(); { let krate = tcx.hir().krate(); From 6c44bbbbaaab182196f7584810046bfef4385019 Mon Sep 17 00:00:00 2001 From: Jethro Beekman Date: Tue, 26 Feb 2019 09:18:22 +0900 Subject: [PATCH 067/381] Update dlmalloc to 0.1.3 --- Cargo.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2b17a6acbaa6..1918b44a6eeb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -744,7 +744,7 @@ dependencies = [ [[package]] name = "dlmalloc" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2092,7 +2092,7 @@ name = "rand_chacha" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2114,7 +2114,7 @@ name = "rand_hc" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2139,7 +2139,7 @@ name = "rand_xorshift" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3230,7 +3230,7 @@ dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", - "dlmalloc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "panic_abort 0.0.0", @@ -4000,7 +4000,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" "checksum directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72d337a64190607d4fcca2cb78982c5dd57f4916e19696b48a575fa746b6cb0f" "checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" -"checksum dlmalloc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d56ad71b31043818d0ee10a7fb9664882f8e45849c81647585e6a3124f185517" +"checksum dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f283302e035e61c23f2b86b3093e8c6273a4c3125742d6087e96ade001ca5e63" "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" "checksum elasticlunr-rs 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a99a310cd1f9770e7bf8e48810c7bcbb0e078c8fb23a8c7bcf0da4c2bf61a455" "checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" From eddd07cc8a92dd603e9884789fb58b2d3edd2e16 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 22 Feb 2019 13:36:04 +1100 Subject: [PATCH 068/381] Make `visit_clobber` panic-safe. --- src/libsyntax/mut_visit.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 1e5eb0992bd1..b7d22b3d554f 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -21,6 +21,7 @@ use syntax_pos::Span; use rustc_data_structures::sync::Lrc; use std::ops::DerefMut; +use std::{panic, process, ptr}; pub trait ExpectOne { fn expect_one(self, err: &'static str) -> A::Item; @@ -305,11 +306,18 @@ pub trait MutVisitor: Sized { /// Use a map-style function (`FnOnce(T) -> T`) to overwrite a `&mut T`. Useful /// when using a `flat_map_*` or `filter_map_*` method within a `visit_` -/// method. +/// method. Abort the program if the closure panics. // // No `noop_` prefix because there isn't a corresponding method in `MutVisitor`. pub fn visit_clobber(t: &mut T, f: F) where F: FnOnce(T) -> T { - unsafe { std::ptr::write(t, f(std::ptr::read(t))); } + unsafe { + // Safe because `t` is used in a read-only fashion by `read()` before + // being overwritten by `write()`. + let old_t = ptr::read(t); + let new_t = panic::catch_unwind(panic::AssertUnwindSafe(|| f(old_t))) + .unwrap_or_else(|_| process::abort()); + ptr::write(t, new_t); + } } // No `noop_` prefix because there isn't a corresponding method in `MutVisitor`. From abd88a9e3a6014134dac0a705eae6de7448ea514 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Mon, 25 Feb 2019 19:49:49 -0800 Subject: [PATCH 069/381] Disable running several Stdio doctests * A number of `Stdio` related doc examples include running the "rev" command to illustrate piping commands. The majority of these tests are marked as `no_run` except for two tests which were not * Not running these tests is unlikely to cause any negative impact, and doing so also allows the test suite to pass in environments where the "rev" command is unavailable --- src/libstd/process.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index a2ef85016d8a..735ce61c9bc2 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1015,7 +1015,7 @@ impl From for Stdio { /// /// `ChildStdin` will be converted to `Stdio` using `Stdio::from` under the hood. /// - /// ```rust + /// ```rust,no_run /// use std::process::{Command, Stdio}; /// /// let reverse = Command::new("rev") @@ -1044,7 +1044,7 @@ impl From for Stdio { /// /// `ChildStdout` will be converted to `Stdio` using `Stdio::from` under the hood. /// - /// ```rust + /// ```rust,no_run /// use std::process::{Command, Stdio}; /// /// let hello = Command::new("echo") From 5b975162e24d3be643a05824b6132dcb968e3fa7 Mon Sep 17 00:00:00 2001 From: Marcel Hellwig Date: Tue, 26 Feb 2019 09:54:45 +0100 Subject: [PATCH 070/381] update scoped_tls to 1.0 --- src/librustc/Cargo.toml | 2 +- src/librustc_driver/Cargo.toml | 2 +- src/libsyntax/Cargo.toml | 2 +- src/libsyntax_pos/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index e83adad4e2a0..e3557132a125 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -17,7 +17,7 @@ graphviz = { path = "../libgraphviz" } jobserver = "0.1" lazy_static = "1.0.0" num_cpus = "1.0" -scoped-tls = { version = "0.1.1", features = ["nightly"] } +scoped-tls = "1.0" log = { version = "0.4", features = ["release_max_level_info", "std"] } polonius-engine = "0.6.2" rustc-rayon = "0.1.1" diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index 8bcda409e666..2e6e775c5261 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -14,7 +14,7 @@ graphviz = { path = "../libgraphviz" } log = "0.4" env_logger = { version = "0.5", default-features = false } rustc-rayon = "0.1.1" -scoped-tls = { version = "0.1.1", features = ["nightly"] } +scoped-tls = "1.0" rustc = { path = "../librustc" } rustc_allocator = { path = "../librustc_allocator" } rustc_target = { path = "../librustc_target" } diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml index 4a0bb0302ffb..71c2ab82f65c 100644 --- a/src/libsyntax/Cargo.toml +++ b/src/libsyntax/Cargo.toml @@ -13,7 +13,7 @@ crate-type = ["dylib"] bitflags = "1.0" serialize = { path = "../libserialize" } log = "0.4" -scoped-tls = "0.1" +scoped-tls = "1.0" syntax_pos = { path = "../libsyntax_pos" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/libsyntax_pos/Cargo.toml b/src/libsyntax_pos/Cargo.toml index 5658451c54f7..691abffbbc1a 100644 --- a/src/libsyntax_pos/Cargo.toml +++ b/src/libsyntax_pos/Cargo.toml @@ -13,6 +13,6 @@ crate-type = ["dylib"] serialize = { path = "../libserialize" } rustc_data_structures = { path = "../librustc_data_structures" } arena = { path = "../libarena" } -scoped-tls = { version = "0.1.1", features = ["nightly"] } +scoped-tls = "1.0" unicode-width = "0.1.4" cfg-if = "0.1.2" From 992694ac4dcbc93ca249fbb9f148cc586f1d384d Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Tue, 26 Feb 2019 17:54:57 +0900 Subject: [PATCH 071/381] reduce repetitions of (n << amt) >> amt --- src/librustc/ty/util.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 1ba7c3bba797..796ac372d020 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -4,6 +4,7 @@ use crate::hir::def::Def; use crate::hir::def_id::DefId; use crate::hir::map::DefPathData; use crate::hir::{self, Node}; +use crate::mir::interpret::{sign_extend, truncate}; use crate::ich::NodeIdHashingMode; use crate::traits::{self, ObligationCause}; use crate::ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable}; @@ -32,12 +33,12 @@ impl<'tcx> fmt::Display for Discr<'tcx> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { match self.ty.sty { ty::Int(ity) => { - let bits = ty::tls::with(|tcx| { - Integer::from_attr(&tcx, SignedInt(ity)).size().bits() + let size = ty::tls::with(|tcx| { + Integer::from_attr(&tcx, SignedInt(ity)).size() }); - let x = self.val as i128; + let x = self.val; // sign extend the raw representation to be an i128 - let x = (x << (128 - bits)) >> (128 - bits); + let x = sign_extend(x, size) as i128; write!(fmt, "{}", x) }, _ => write!(fmt, "{}", self.val), @@ -57,12 +58,12 @@ impl<'tcx> Discr<'tcx> { _ => bug!("non integer discriminant"), }; + let size = int.size(); let bit_size = int.size().bits(); let shift = 128 - bit_size; if signed { let sext = |u| { - let i = u as i128; - (i << shift) >> shift + sign_extend(u, size) as i128 }; let min = sext(1_u128 << (bit_size - 1)); let max = i128::max_value() >> shift; @@ -77,7 +78,7 @@ impl<'tcx> Discr<'tcx> { }; // zero the upper bits let val = val as u128; - let val = (val << shift) >> shift; + let val = truncate(val, size); (Self { val: val as u128, ty: self.ty, From 56fb2873fe284ef470c468f2370418aa8bebc41a Mon Sep 17 00:00:00 2001 From: Marcel Hellwig Date: Tue, 26 Feb 2019 11:15:52 +0100 Subject: [PATCH 072/381] update Cargo.lock --- Cargo.lock | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2b17a6acbaa6..735858d11eed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2381,7 +2381,7 @@ dependencies = [ "rustc_errors 0.0.0", "rustc_fs_util 0.0.0", "rustc_target 0.0.0", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", @@ -2726,7 +2726,7 @@ dependencies = [ "rustc_target 0.0.0", "rustc_traits 0.0.0", "rustc_typeck 0.0.0", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", @@ -3090,6 +3090,11 @@ name = "scoped-tls" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "scoped_threadpool" version = "0.1.9" @@ -3345,7 +3350,7 @@ dependencies = [ "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "rustc_target 0.0.0", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "syntax_pos 0.0.0", @@ -3372,7 +3377,7 @@ dependencies = [ "arena 0.0.0", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_data_structures 0.0.0", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4183,6 +4188,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" "checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" "checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" +"checksum scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" "checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" From 6375efc822eab92a42ce0382ca9597d8430c4efd Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 26 Feb 2019 20:06:31 +0900 Subject: [PATCH 073/381] Update string_cache_codegen to 0.4.2 --- Cargo.lock | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2b17a6acbaa6..64db279862d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1399,7 +1399,7 @@ dependencies = [ "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1936,14 +1936,6 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "proc-macro2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "proc-macro2" version = "0.4.24" @@ -2015,14 +2007,6 @@ name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "quote" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "quote" version = "0.6.10" @@ -3255,19 +3239,19 @@ dependencies = [ "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "string_cache_codegen" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4124,7 +4108,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" "checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6" "checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61" -"checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" "checksum proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "926d0604475349f463fe44130aae73f2294b5309ab2ca0310b998bd334ef191f" "checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32" @@ -4132,7 +4115,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" "checksum racer 2.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "d634483bed41bb116122b84ffe0ef8740345c2ceb2784ce86c33499700eb13a7" "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" @@ -4201,7 +4183,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbc596e092fe5f598b12ef46cc03754085ac2f4d8c739ad61c4ae266cc3b3fa" "checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" -"checksum string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "35293b05cf1494e8ddd042a7df6756bf18d07f42d234f32e71dce8a7aabb0191" +"checksum string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eea1eee654ef80933142157fdad9dd8bc43cf7c74e999e369263496f04ff4da" "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum strum 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f6c3a2071519ab6a48f465808c4c1ffdd00dfc8e93111d02b4fc5abab177676e" From ccfa5d6df8ee061264c44bb8fbb3b3f35592ba92 Mon Sep 17 00:00:00 2001 From: csmoe Date: Sat, 9 Feb 2019 22:11:53 +0800 Subject: [PATCH 074/381] replace &'tcx Substs with SubstsRef --- src/librustc/dep_graph/dep_node.rs | 4 ++-- src/librustc/infer/combine.rs | 8 +++---- src/librustc/infer/equate.rs | 8 +++---- .../nice_region_error/placeholder_error.rs | 6 ++--- src/librustc/infer/mod.rs | 4 ++-- src/librustc/infer/opaque_types/mod.rs | 6 ++--- src/librustc/middle/exported_symbols.rs | 4 ++-- src/librustc/mir/mod.rs | 6 ++--- src/librustc/mir/tcx.rs | 4 ++-- src/librustc/mir/visit.rs | 6 ++--- src/librustc/traits/mod.rs | 10 ++++---- src/librustc/traits/select.rs | 8 +++---- src/librustc/traits/specialize/mod.rs | 12 +++++----- src/librustc/ty/adjustment.rs | 4 ++-- src/librustc/ty/codec.rs | 10 ++++---- src/librustc/ty/context.rs | 24 +++++++++---------- src/librustc/ty/inhabitedness/mod.rs | 14 +++++------ src/librustc/ty/instance.rs | 12 +++++----- src/librustc/ty/mod.rs | 4 ++-- src/librustc/ty/query/config.rs | 4 ++-- src/librustc/ty/query/keys.rs | 4 ++-- src/librustc/ty/query/mod.rs | 12 +++++----- src/librustc/ty/relate.rs | 22 ++++++++--------- src/librustc/ty/sty.rs | 24 +++++++++---------- src/librustc/ty/subst.rs | 20 +++++++++------- src/librustc/ty/util.rs | 8 +++---- .../back/symbol_export.rs | 6 ++--- src/librustc_codegen_ssa/callee.rs | 6 ++--- src/librustc_codegen_ssa/mir/mod.rs | 4 ++-- src/librustc_codegen_utils/symbol_names.rs | 4 ++-- src/librustc_lint/types.rs | 4 ++-- .../borrow_check/nll/constraint_generation.rs | 4 ++-- .../error_reporting/region_name.rs | 6 ++--- src/librustc_mir/borrow_check/nll/renumber.rs | 4 ++-- .../borrow_check/nll/type_check/mod.rs | 4 ++-- .../borrow_check/nll/universal_regions.rs | 8 +++---- src/librustc_mir/build/mod.rs | 4 ++-- src/librustc_mir/hair/cx/expr.rs | 5 ++-- src/librustc_mir/hair/mod.rs | 4 ++-- src/librustc_mir/hair/pattern/check_match.rs | 4 ++-- src/librustc_mir/hair/pattern/mod.rs | 12 +++++----- src/librustc_mir/interpret/eval_context.rs | 6 ++--- src/librustc_mir/monomorphize/collector.rs | 8 +++---- src/librustc_mir/transform/erase_regions.rs | 4 ++-- src/librustc_mir/transform/generator.rs | 4 ++-- src/librustc_mir/transform/inline.rs | 4 ++-- src/librustc_mir/util/elaborate_drops.rs | 16 ++++++------- src/librustc_passes/rvalue_promotion.rs | 4 ++-- src/librustc_typeck/astconv.rs | 10 ++++---- src/librustc_typeck/check/cast.rs | 4 ++-- src/librustc_typeck/check/method/confirm.rs | 13 +++++----- src/librustc_typeck/check/method/mod.rs | 4 ++-- src/librustc_typeck/check/method/probe.rs | 8 +++---- src/librustc_typeck/check/mod.rs | 8 +++---- src/librustc_typeck/lib.rs | 4 ++-- 55 files changed, 213 insertions(+), 211 deletions(-) diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 2f91da4f62e3..0d8f71a50ce5 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -67,7 +67,7 @@ use crate::traits::query::{ }; use crate::ty::{TyCtxt, FnSig, Instance, InstanceDef, ParamEnv, ParamEnvAnd, Predicate, PolyFnSig, PolyTraitRef, Ty}; -use crate::ty::subst::Substs; +use crate::ty::subst::SubstsRef; // erase!() just makes tokens go away. It's used to specify which macro argument // is repeated (i.e., which sub-expression of the macro we are in) but don't need @@ -661,7 +661,7 @@ define_dep_nodes!( <'tcx> [] TypeOpNormalizePolyFnSig(CanonicalTypeOpNormalizeGoal<'tcx, PolyFnSig<'tcx>>), [] TypeOpNormalizeFnSig(CanonicalTypeOpNormalizeGoal<'tcx, FnSig<'tcx>>), - [] SubstituteNormalizeAndTestPredicates { key: (DefId, &'tcx Substs<'tcx>) }, + [] SubstituteNormalizeAndTestPredicates { key: (DefId, SubstsRef<'tcx>) }, [] MethodAutoderefSteps(CanonicalTyGoal<'tcx>), [input] TargetFeaturesWhitelist, diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index 9cd5a844f159..6ef902a47dc8 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -34,7 +34,7 @@ use crate::ty::{IntType, UintType}; use crate::ty::{self, Ty, TyCtxt}; use crate::ty::error::TypeError; use crate::ty::relate::{self, Relate, RelateResult, TypeRelation}; -use crate::ty::subst::Substs; +use crate::ty::subst::SubstsRef; use crate::traits::{Obligation, PredicateObligations}; use syntax::ast; @@ -373,9 +373,9 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, ' fn relate_item_substs(&mut self, item_def_id: DefId, - a_subst: &'tcx Substs<'tcx>, - b_subst: &'tcx Substs<'tcx>) - -> RelateResult<'tcx, &'tcx Substs<'tcx>> + a_subst: SubstsRef<'tcx>, + b_subst: SubstsRef<'tcx>) + -> RelateResult<'tcx, SubstsRef<'tcx>> { if self.ambient_variance == ty::Variance::Invariant { // Avoid fetching the variance if we are in an invariant diff --git a/src/librustc/infer/equate.rs b/src/librustc/infer/equate.rs index a4b62307a60b..31b01eecf5cb 100644 --- a/src/librustc/infer/equate.rs +++ b/src/librustc/infer/equate.rs @@ -5,7 +5,7 @@ use crate::hir::def_id::DefId; use crate::ty::{self, Ty, TyCtxt}; use crate::ty::TyVar; -use crate::ty::subst::Substs; +use crate::ty::subst::SubstsRef; use crate::ty::relate::{self, Relate, RelateResult, TypeRelation}; /// Ensures `a` is made equal to `b`. Returns `a` on success. @@ -33,9 +33,9 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> fn relate_item_substs(&mut self, _item_def_id: DefId, - a_subst: &'tcx Substs<'tcx>, - b_subst: &'tcx Substs<'tcx>) - -> RelateResult<'tcx, &'tcx Substs<'tcx>> + a_subst: SubstsRef<'tcx>, + b_subst: SubstsRef<'tcx>) + -> RelateResult<'tcx, SubstsRef<'tcx>> { // N.B., once we are equating types, we don't care about // variance, so don't try to lookup the variance here. This diff --git a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs index 3b2fb7d41008..506388c268bb 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs @@ -7,7 +7,7 @@ use crate::infer::{SubregionOrigin, TypeTrace}; use crate::traits::{ObligationCause, ObligationCauseCode}; use crate::ty; use crate::ty::error::ExpectedFound; -use crate::ty::subst::Substs; +use crate::ty::subst::SubstsRef; use crate::util::ppaux::RegionHighlightMode; impl NiceRegionError<'me, 'gcx, 'tcx> { @@ -175,8 +175,8 @@ impl NiceRegionError<'me, 'gcx, 'tcx> { sub_placeholder: Option>, sup_placeholder: Option>, trait_def_id: DefId, - expected_substs: &'tcx Substs<'tcx>, - actual_substs: &'tcx Substs<'tcx>, + expected_substs: SubstsRef<'tcx>, + actual_substs: SubstsRef<'tcx>, ) -> DiagnosticBuilder<'me> { debug!( "try_report_placeholders_trait(\ diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index ac2ebece442c..a02918a49394 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -18,7 +18,7 @@ use crate::traits::{self, ObligationCause, PredicateObligations, TraitEngine}; use crate::ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric}; use crate::ty::fold::TypeFoldable; use crate::ty::relate::RelateResult; -use crate::ty::subst::{Kind, Substs}; +use crate::ty::subst::{Kind, Substs, SubstsRef}; use crate::ty::{self, GenericParamDefKind, Ty, TyCtxt, CtxtInterners}; use crate::ty::{FloatVid, IntVid, TyVid}; use crate::util::nodemap::FxHashMap; @@ -1088,7 +1088,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// Given a set of generics defined on a type or impl, returns a substitution mapping each /// type/region parameter to a fresh inference variable. - pub fn fresh_substs_for_item(&self, span: Span, def_id: DefId) -> &'tcx Substs<'tcx> { + pub fn fresh_substs_for_item(&self, span: Span, def_id: DefId) -> SubstsRef<'tcx> { Substs::for_item(self.tcx, def_id, |param, _| self.var_for_def(span, param)) } diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index e75446b01c11..079c2a12a847 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -9,7 +9,7 @@ use crate::traits::{self, PredicateObligation}; use crate::ty::{self, Ty, TyCtxt, GenericParamDefKind}; use crate::ty::fold::{BottomUpFolder, TypeFoldable, TypeFolder}; use crate::ty::outlives::Component; -use crate::ty::subst::{Kind, Substs, UnpackedKind}; +use crate::ty::subst::{Kind, Substs, SubstsRef, UnpackedKind}; use crate::util::nodemap::DefIdMap; pub type OpaqueTypeMap<'tcx> = DefIdMap>; @@ -30,7 +30,7 @@ pub struct OpaqueTypeDecl<'tcx> { /// fn foo<'a, 'b, T>() -> Foo<'a, T> /// /// then `substs` would be `['a, T]`. - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, /// The type variable that represents the value of the abstract type /// that we require. In other words, after we compile this function, @@ -740,7 +740,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> { &mut self, ty: Ty<'tcx>, def_id: DefId, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, ) -> Ty<'tcx> { let infcx = self.infcx; let tcx = infcx.tcx; diff --git a/src/librustc/middle/exported_symbols.rs b/src/librustc/middle/exported_symbols.rs index 6c43068a2277..32c721676553 100644 --- a/src/librustc/middle/exported_symbols.rs +++ b/src/librustc/middle/exported_symbols.rs @@ -5,7 +5,7 @@ use rustc_data_structures::stable_hasher::{StableHasher, HashStable, use std::cmp; use std::mem; use crate::ty; -use crate::ty::subst::Substs; +use crate::ty::subst::SubstsRef; /// The SymbolExportLevel of a symbols specifies from which kinds of crates /// the symbol will be exported. `C` symbols will be exported from any @@ -33,7 +33,7 @@ impl SymbolExportLevel { #[derive(Eq, PartialEq, Debug, Copy, Clone, RustcEncodable, RustcDecodable)] pub enum ExportedSymbol<'tcx> { NonGeneric(DefId), - Generic(DefId, &'tcx Substs<'tcx>), + Generic(DefId, SubstsRef<'tcx>), NoDefId(ty::SymbolName), } diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 001a347c3313..bfc74979af42 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -27,7 +27,7 @@ use syntax::ast::{self, Name}; use syntax::symbol::InternedString; use syntax_pos::{Span, DUMMY_SP}; use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; -use crate::ty::subst::{Subst, Substs}; +use crate::ty::subst::{Subst, SubstsRef}; use crate::ty::layout::VariantIdx; use crate::ty::{ self, AdtDef, CanonicalUserTypeAnnotations, ClosureSubsts, GeneratorSubsts, Region, Ty, TyCtxt, @@ -2151,7 +2151,7 @@ impl<'tcx> Operand<'tcx> { pub fn function_handle<'a>( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, span: Span, ) -> Self { let ty = tcx.type_of(def_id).subst(tcx, substs); @@ -2247,7 +2247,7 @@ pub enum AggregateKind<'tcx> { Adt( &'tcx AdtDef, VariantIdx, - &'tcx Substs<'tcx>, + SubstsRef<'tcx>, Option, Option, ), diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index bf4ac7496d2e..dbf911851bf2 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -4,7 +4,7 @@ */ use crate::mir::*; -use crate::ty::subst::{Subst, Substs}; +use crate::ty::subst::{Subst, SubstsRef}; use crate::ty::{self, AdtDef, Ty, TyCtxt}; use crate::ty::layout::VariantIdx; use crate::hir; @@ -17,7 +17,7 @@ pub enum PlaceTy<'tcx> { /// Downcast to a particular variant of an enum. Downcast { adt_def: &'tcx AdtDef, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, variant_index: VariantIdx }, } diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs index e5828039ac29..4f31cebca088 100644 --- a/src/librustc/mir/visit.rs +++ b/src/librustc/mir/visit.rs @@ -1,5 +1,5 @@ use crate::hir::def_id::DefId; -use crate::ty::subst::Substs; +use crate::ty::subst::SubstsRef; use crate::ty::{CanonicalUserTypeAnnotation, ClosureSubsts, GeneratorSubsts, Region, Ty}; use crate::mir::*; use syntax_pos::Span; @@ -238,7 +238,7 @@ macro_rules! make_mir_visitor { } fn visit_substs(&mut self, - substs: & $($mutability)? &'tcx Substs<'tcx>, + substs: & $($mutability)? SubstsRef<'tcx>, _: Location) { self.super_substs(substs); } @@ -889,7 +889,7 @@ macro_rules! make_mir_visitor { fn super_const(&mut self, _const: & $($mutability)? &'tcx ty::LazyConst<'tcx>) { } - fn super_substs(&mut self, _substs: & $($mutability)? &'tcx Substs<'tcx>) { + fn super_substs(&mut self, _substs: & $($mutability)? SubstsRef<'tcx>) { } fn super_generator_substs(&mut self, diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index be6a95948edb..64ac874e8f1d 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -29,7 +29,7 @@ use crate::mir::interpret::ErrorHandled; use rustc_data_structures::sync::Lrc; use syntax::ast; use syntax_pos::{Span, DUMMY_SP}; -use crate::ty::subst::Substs; +use crate::ty::subst::{Substs, SubstsRef}; use crate::ty::{self, AdtKind, List, Ty, TyCtxt, GenericParamDefKind, ToPredicate}; use crate::ty::error::{ExpectedFound, TypeError}; use crate::ty::fold::{TypeFolder, TypeFoldable, TypeVisitor}; @@ -565,7 +565,7 @@ pub enum Vtable<'tcx, N> { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)] pub struct VtableImplData<'tcx, N> { pub impl_def_id: DefId, - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, pub nested: Vec } @@ -622,7 +622,7 @@ pub struct VtableFnPointerData<'tcx, N> { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)] pub struct VtableTraitAliasData<'tcx, N> { pub alias_def_id: DefId, - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, pub nested: Vec, } @@ -963,7 +963,7 @@ fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - key: (DefId, &'tcx Substs<'tcx>)) + key: (DefId, SubstsRef<'tcx>)) -> bool { debug!("substitute_normalize_and_test_predicates(key={:?})", @@ -983,7 +983,7 @@ fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx fn vtable_methods<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) - -> Lrc)>>> + -> Lrc)>>> { debug!("vtable_methods({:?})", trait_ref); diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 05fb40ac10a0..320b591ddcf7 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -34,7 +34,7 @@ use crate::middle::lang_items; use crate::mir::interpret::GlobalId; use crate::ty::fast_reject; use crate::ty::relate::TypeRelation; -use crate::ty::subst::{Subst, Substs}; +use crate::ty::subst::{Subst, Substs, SubstsRef}; use crate::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable}; use crate::hir; @@ -2944,7 +2944,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { fn vtable_impl( &mut self, impl_def_id: DefId, - mut substs: Normalized<'tcx, &'tcx Substs<'tcx>>, + mut substs: Normalized<'tcx, SubstsRef<'tcx>>, cause: ObligationCause<'tcx>, recursion_depth: usize, param_env: ty::ParamEnv<'tcx>, @@ -3538,7 +3538,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { impl_def_id: DefId, obligation: &TraitObligation<'tcx>, snapshot: &CombinedSnapshot<'_, 'tcx>, - ) -> Normalized<'tcx, &'tcx Substs<'tcx>> { + ) -> Normalized<'tcx, SubstsRef<'tcx>> { match self.match_impl(impl_def_id, obligation, snapshot) { Ok(substs) => substs, Err(()) => { @@ -3556,7 +3556,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { impl_def_id: DefId, obligation: &TraitObligation<'tcx>, snapshot: &CombinedSnapshot<'_, 'tcx>, - ) -> Result>, ()> { + ) -> Result>, ()> { let impl_trait_ref = self.tcx().impl_trait_ref(impl_def_id).unwrap(); // Before we create the substitutions and everything, first diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index 804f1b9d820a..9a760065cb1f 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -20,7 +20,7 @@ use rustc_data_structures::sync::Lrc; use syntax_pos::DUMMY_SP; use crate::traits::select::IntercrateAmbiguityCause; use crate::ty::{self, TyCtxt, TypeFoldable}; -use crate::ty::subst::{Subst, Substs}; +use crate::ty::subst::{Subst, Substs, SubstsRef}; use super::{SelectionContext, FulfillmentContext}; use super::util::impl_trait_ref_and_oblig; @@ -73,9 +73,9 @@ pub struct OverlapError { pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, source_impl: DefId, - source_substs: &'tcx Substs<'tcx>, + source_substs: SubstsRef<'tcx>, target_node: specialization_graph::Node) - -> &'tcx Substs<'tcx> { + -> SubstsRef<'tcx> { debug!("translate_substs({:?}, {:?}, {:?}, {:?})", param_env, source_impl, source_substs, target_node); let source_trait_ref = infcx.tcx @@ -114,9 +114,9 @@ pub fn find_associated_item<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, item: &ty::AssociatedItem, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, impl_data: &super::VtableImplData<'tcx, ()>, -) -> (DefId, &'tcx Substs<'tcx>) { +) -> (DefId, SubstsRef<'tcx>) { debug!("find_associated_item({:?}, {:?}, {:?}, {:?})", param_env, item, substs, impl_data); assert!(!substs.needs_infer()); @@ -214,7 +214,7 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, source_trait_ref: ty::TraitRef<'tcx>, target_impl: DefId) - -> Result<&'tcx Substs<'tcx>, ()> { + -> Result, ()> { debug!("fulfill_implication({:?}, trait_ref={:?} |- {:?} applies)", param_env, source_trait_ref, target_impl); diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs index ff4fc87542dc..8d449f5c44cf 100644 --- a/src/librustc/ty/adjustment.rs +++ b/src/librustc/ty/adjustment.rs @@ -1,7 +1,7 @@ use crate::hir; use crate::hir::def_id::DefId; use crate::ty::{self, Ty, TyCtxt}; -use crate::ty::subst::Substs; +use crate::ty::subst::SubstsRef; /// Represents coercing a value to a different type of value. @@ -98,7 +98,7 @@ pub struct OverloadedDeref<'tcx> { impl<'a, 'gcx, 'tcx> OverloadedDeref<'tcx> { pub fn method_call(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, source: Ty<'tcx>) - -> (DefId, &'tcx Substs<'tcx>) { + -> (DefId, SubstsRef<'tcx>) { let trait_def_id = match self.mutbl { hir::MutImmutable => tcx.lang_items().deref_trait(), hir::MutMutable => tcx.lang_items().deref_mut_trait() diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index e93de32f7257..3ab744ebaeb1 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -13,7 +13,7 @@ use crate::rustc_serialize::{Decodable, Decoder, Encoder, Encodable, opaque}; use std::hash::Hash; use std::intrinsics; use crate::ty::{self, Ty, TyCtxt}; -use crate::ty::subst::Substs; +use crate::ty::subst::SubstsRef; use crate::mir::interpret::Allocation; /// The shorthand encoding uses an enum's variant index `usize` @@ -185,7 +185,7 @@ pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D) } #[inline] -pub fn decode_substs<'a, 'tcx, D>(decoder: &mut D) -> Result<&'tcx Substs<'tcx>, D::Error> +pub fn decode_substs<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> where D: TyDecoder<'a, 'tcx>, 'tcx: 'a, { @@ -281,7 +281,7 @@ macro_rules! implement_ty_decoder { use $crate::infer::canonical::CanonicalVarInfos; use $crate::ty; use $crate::ty::codec::*; - use $crate::ty::subst::Substs; + use $crate::ty::subst::SubstsRef; use $crate::hir::def_id::{CrateNum}; use crate::rustc_serialize::{Decoder, SpecializedDecoder}; use std::borrow::Cow; @@ -344,9 +344,9 @@ macro_rules! implement_ty_decoder { } } - impl<$($typaram),*> SpecializedDecoder<&'tcx Substs<'tcx>> + impl<$($typaram),*> SpecializedDecoder> for $DecoderName<$($typaram),*> { - fn specialized_decode(&mut self) -> Result<&'tcx Substs<'tcx>, Self::Error> { + fn specialized_decode(&mut self) -> Result, Self::Error> { decode_substs(self) } } diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index a71c0d4ab963..68f21ce10788 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -22,7 +22,7 @@ use crate::middle::resolve_lifetime::{self, ObjectLifetimeDefault}; use crate::middle::stability; use crate::mir::{self, Mir, interpret, ProjectionKind}; use crate::mir::interpret::Allocation; -use crate::ty::subst::{Kind, Substs, Subst}; +use crate::ty::subst::{Kind, Substs, Subst, SubstsRef}; use crate::ty::ReprOptions; use crate::traits; use crate::traits::{Clause, Clauses, GoalKind, Goal, Goals}; @@ -325,7 +325,7 @@ pub struct ResolvedOpaqueTy<'tcx> { /// Generic parameters on the opaque type as passed by this function. /// For `existential type Foo; fn foo() -> Foo { .. }` this is `[T, U]`, not /// `[A, B]` - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, } #[derive(RustcEncodable, RustcDecodable, Debug)] @@ -352,7 +352,7 @@ pub struct TypeckTables<'tcx> { /// of this node. This only applies to nodes that refer to entities /// parameterized by type parameters, such as generic fns, types, or /// other items. - node_substs: ItemLocalMap<&'tcx Substs<'tcx>>, + node_substs: ItemLocalMap>, /// This will either store the canonicalized types provided by the user /// or the substitutions that the user explicitly gave (if any) attached @@ -548,19 +548,19 @@ impl<'tcx> TypeckTables<'tcx> { self.node_types.get(&id.local_id).cloned() } - pub fn node_substs_mut(&mut self) -> LocalTableInContextMut<'_, &'tcx Substs<'tcx>> { + pub fn node_substs_mut(&mut self) -> LocalTableInContextMut<'_, SubstsRef<'tcx>> { LocalTableInContextMut { local_id_root: self.local_id_root, data: &mut self.node_substs } } - pub fn node_substs(&self, id: hir::HirId) -> &'tcx Substs<'tcx> { + pub fn node_substs(&self, id: hir::HirId) -> SubstsRef<'tcx> { validate_hir_id_for_typeck_tables(self.local_id_root, id, false); self.node_substs.get(&id.local_id).cloned().unwrap_or_else(|| Substs::empty()) } - pub fn node_substs_opt(&self, id: hir::HirId) -> Option<&'tcx Substs<'tcx>> { + pub fn node_substs_opt(&self, id: hir::HirId) -> Option> { validate_hir_id_for_typeck_tables(self.local_id_root, id, false); self.node_substs.get(&id.local_id).cloned() } @@ -1733,7 +1733,7 @@ impl<'gcx> GlobalCtxt<'gcx> { /// A trait implemented for all X<'a> types which can be safely and /// efficiently converted to X<'tcx> as long as they are part of the /// provided TyCtxt<'tcx>. -/// This can be done, for example, for Ty<'tcx> or &'tcx Substs<'tcx> +/// This can be done, for example, for Ty<'tcx> or SubstsRef<'tcx> /// by looking them up in their respective interners. /// /// However, this is still not the best implementation as it does @@ -2507,7 +2507,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } #[inline] - pub fn mk_adt(self, def: &'tcx AdtDef, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> { + pub fn mk_adt(self, def: &'tcx AdtDef, substs: SubstsRef<'tcx>) -> Ty<'tcx> { // take a copy of substs so that we own the vectors inside self.mk_ty(Adt(def, substs)) } @@ -2613,7 +2613,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { #[inline] pub fn mk_fn_def(self, def_id: DefId, - substs: &'tcx Substs<'tcx>) -> Ty<'tcx> { + substs: SubstsRef<'tcx>) -> Ty<'tcx> { self.mk_ty(FnDef(def_id, substs)) } @@ -2634,7 +2634,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { #[inline] pub fn mk_projection(self, item_def_id: DefId, - substs: &'tcx Substs<'tcx>) + substs: SubstsRef<'tcx>) -> Ty<'tcx> { self.mk_ty(Projection(ProjectionTy { item_def_id, @@ -2704,7 +2704,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } #[inline] - pub fn mk_opaque(self, def_id: DefId, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> { + pub fn mk_opaque(self, def_id: DefId, substs: SubstsRef<'tcx>) -> Ty<'tcx> { self.mk_ty(Opaque(def_id, substs)) } @@ -2817,7 +2817,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn mk_substs_trait(self, self_ty: Ty<'tcx>, rest: &[Kind<'tcx>]) - -> &'tcx Substs<'tcx> + -> SubstsRef<'tcx> { self.mk_substs(iter::once(self_ty.into()).chain(rest.iter().cloned())) } diff --git a/src/librustc/ty/inhabitedness/mod.rs b/src/librustc/ty/inhabitedness/mod.rs index 601ffe70eec1..33ec9c874f9e 100644 --- a/src/librustc/ty/inhabitedness/mod.rs +++ b/src/librustc/ty/inhabitedness/mod.rs @@ -1,6 +1,6 @@ use crate::ty::context::TyCtxt; use crate::ty::{AdtDef, VariantDef, FieldDef, Ty, TyS}; -use crate::ty::{self, DefId, Substs}; +use crate::ty::{self, DefId, SubstsRef}; use crate::ty::{AdtKind, Visibility}; use crate::ty::TyKind::*; @@ -108,7 +108,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn is_enum_variant_uninhabited_from(self, module: DefId, variant: &'tcx VariantDef, - substs: &'tcx Substs<'tcx>) + substs: SubstsRef<'tcx>) -> bool { self.variant_inhabitedness_forest(variant, substs).contains(self, module) @@ -116,13 +116,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn is_variant_uninhabited_from_all_modules(self, variant: &'tcx VariantDef, - substs: &'tcx Substs<'tcx>) + substs: SubstsRef<'tcx>) -> bool { !self.variant_inhabitedness_forest(variant, substs).is_empty() } - fn variant_inhabitedness_forest(self, variant: &'tcx VariantDef, substs: &'tcx Substs<'tcx>) + fn variant_inhabitedness_forest(self, variant: &'tcx VariantDef, substs: SubstsRef<'tcx>) -> DefIdForest { // Determine the ADT kind: let adt_def_id = self.adt_def_id_of_variant(variant); @@ -138,7 +138,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { fn uninhabited_from( &self, tcx: TyCtxt<'a, 'gcx, 'tcx>, - substs: &'tcx Substs<'tcx>) -> DefIdForest + substs: SubstsRef<'tcx>) -> DefIdForest { DefIdForest::intersection(tcx, self.variants.iter().map(|v| { v.uninhabited_from(tcx, substs, self.adt_kind()) @@ -151,7 +151,7 @@ impl<'a, 'gcx, 'tcx> VariantDef { fn uninhabited_from( &self, tcx: TyCtxt<'a, 'gcx, 'tcx>, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, adt_kind: AdtKind) -> DefIdForest { let is_enum = match adt_kind { @@ -172,7 +172,7 @@ impl<'a, 'gcx, 'tcx> FieldDef { fn uninhabited_from( &self, tcx: TyCtxt<'a, 'gcx, 'tcx>, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, is_enum: bool, ) -> DefIdForest { let data_uninhabitedness = move || { diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index 5fc22e3c02b6..709dce4589f6 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -1,6 +1,6 @@ use crate::hir::Unsafety; use crate::hir::def_id::DefId; -use crate::ty::{self, Ty, PolyFnSig, TypeFoldable, Substs, TyCtxt}; +use crate::ty::{self, Ty, PolyFnSig, TypeFoldable, SubstsRef, TyCtxt}; use crate::traits; use rustc_target::spec::abi::Abi; use crate::util::ppaux; @@ -11,7 +11,7 @@ use std::iter; #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct Instance<'tcx> { pub def: InstanceDef<'tcx>, - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, } #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)] @@ -203,7 +203,7 @@ impl<'tcx> fmt::Display for Instance<'tcx> { } impl<'a, 'b, 'tcx> Instance<'tcx> { - pub fn new(def_id: DefId, substs: &'tcx Substs<'tcx>) + pub fn new(def_id: DefId, substs: SubstsRef<'tcx>) -> Instance<'tcx> { assert!(!substs.has_escaping_bound_vars(), "substs of instance {:?} not normalized for codegen: {:?}", @@ -241,7 +241,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { pub fn resolve(tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, def_id: DefId, - substs: &'tcx Substs<'tcx>) -> Option> { + substs: SubstsRef<'tcx>) -> Option> { debug!("resolve(def_id={:?}, substs={:?})", def_id, substs); let result = if let Some(trait_def_id) = tcx.trait_of_item(def_id) { debug!(" => associated item, attempting to find impl in param_env {:#?}", param_env); @@ -293,7 +293,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { pub fn resolve_for_vtable(tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, def_id: DefId, - substs: &'tcx Substs<'tcx>) -> Option> { + substs: SubstsRef<'tcx>) -> Option> { debug!("resolve(def_id={:?}, substs={:?})", def_id, substs); let fn_sig = tcx.fn_sig(def_id); let is_vtable_shim = @@ -338,7 +338,7 @@ fn resolve_associated_item<'a, 'tcx>( trait_item: &ty::AssociatedItem, param_env: ty::ParamEnv<'tcx>, trait_id: DefId, - rcvr_substs: &'tcx Substs<'tcx>, + rcvr_substs: SubstsRef<'tcx>, ) -> Option> { let def_id = trait_item.def_id; debug!("resolve_associated_item(trait_item={:?}, \ diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index a3cf7bf488ee..e098488824f3 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -22,7 +22,7 @@ use crate::session::CrateDisambiguator; use crate::traits::{self, Reveal}; use crate::ty; use crate::ty::layout::VariantIdx; -use crate::ty::subst::{Subst, Substs}; +use crate::ty::subst::{Subst, Substs, SubstsRef}; use crate::ty::util::{IntTypeExt, Discr}; use crate::ty::walk::TypeWalker; use crate::util::captures::Captures; @@ -1067,7 +1067,7 @@ pub enum Predicate<'tcx> { Subtype(PolySubtypePredicate<'tcx>), /// Constant initializer must evaluate successfully. - ConstEvaluatable(DefId, &'tcx Substs<'tcx>), + ConstEvaluatable(DefId, SubstsRef<'tcx>), } /// The crate outlives map is computed during typeck and contains the diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index 1870812893c1..0d3e9f7914ba 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -9,7 +9,7 @@ use crate::traits::query::{ CanonicalTypeOpProvePredicateGoal, CanonicalTypeOpSubtypeGoal, }; use crate::ty::{self, ParamEnvAnd, Ty, TyCtxt}; -use crate::ty::subst::Substs; +use crate::ty::subst::SubstsRef; use crate::ty::query::queries; use crate::ty::query::Query; use crate::ty::query::QueryCache; @@ -914,7 +914,7 @@ impl<'tcx> QueryDescription<'tcx> for queries::optimized_mir<'tcx> { } impl<'tcx> QueryDescription<'tcx> for queries::substitute_normalize_and_test_predicates<'tcx> { - fn describe(tcx: TyCtxt<'_, '_, '_>, key: (DefId, &'tcx Substs<'tcx>)) -> Cow<'static, str> { + fn describe(tcx: TyCtxt<'_, '_, '_>, key: (DefId, SubstsRef<'tcx>)) -> Cow<'static, str> { format!("testing substituted normalized predicates:`{}`", tcx.item_path_str(key.0)).into() } } diff --git a/src/librustc/ty/query/keys.rs b/src/librustc/ty/query/keys.rs index f5eb7374cc19..d353da801778 100644 --- a/src/librustc/ty/query/keys.rs +++ b/src/librustc/ty/query/keys.rs @@ -4,7 +4,7 @@ use crate::infer::canonical::Canonical; use crate::hir::def_id::{CrateNum, DefId, LOCAL_CRATE, DefIndex}; use crate::traits; use crate::ty::{self, Ty, TyCtxt}; -use crate::ty::subst::Substs; +use crate::ty::subst::SubstsRef; use crate::ty::fast_reject::SimplifiedType; use crate::mir; @@ -109,7 +109,7 @@ impl Key for (DefId, SimplifiedType) { } } -impl<'tcx> Key for (DefId, &'tcx Substs<'tcx>) { +impl<'tcx> Key for (DefId, SubstsRef<'tcx>) { fn query_crate(&self) -> CrateNum { self.0.krate } diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs index 740875109d02..ee36a1af8f40 100644 --- a/src/librustc/ty/query/mod.rs +++ b/src/librustc/ty/query/mod.rs @@ -36,8 +36,8 @@ use crate::traits::specialization_graph; use crate::traits::Clauses; use crate::ty::{self, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt, AdtSizedConstraint}; use crate::ty::steal::Steal; -use crate::ty::subst::Substs; use crate::ty::util::NeedsDrop; +use crate::ty::subst::SubstsRef; use crate::util::nodemap::{DefIdSet, DefIdMap, ItemLocalSet}; use crate::util::common::{ErrorReported}; use crate::util::profiling::ProfileCategory::*; @@ -393,7 +393,7 @@ define_queries! { <'tcx> Other { [] fn vtable_methods: vtable_methods_node(ty::PolyTraitRef<'tcx>) - -> Lrc)>>>, + -> Lrc)>>>, }, Codegen { @@ -493,9 +493,9 @@ define_queries! { <'tcx> Codegen { [] fn upstream_monomorphizations: UpstreamMonomorphizations(CrateNum) - -> Lrc, CrateNum>>>>, + -> Lrc, CrateNum>>>>, [] fn upstream_monomorphizations_for: UpstreamMonomorphizationsFor(DefId) - -> Option, CrateNum>>>, + -> Option, CrateNum>>>, }, Other { @@ -714,7 +714,7 @@ define_queries! { <'tcx> >, [] fn substitute_normalize_and_test_predicates: - substitute_normalize_and_test_predicates_node((DefId, &'tcx Substs<'tcx>)) -> bool, + substitute_normalize_and_test_predicates_node((DefId, SubstsRef<'tcx>)) -> bool, [] fn method_autoderef_steps: MethodAutoderefSteps( CanonicalTyGoal<'tcx> @@ -906,7 +906,7 @@ fn vtable_methods_node<'tcx>(trait_ref: ty::PolyTraitRef<'tcx>) -> DepConstructo DepConstructor::VtableMethods{ trait_ref } } -fn substitute_normalize_and_test_predicates_node<'tcx>(key: (DefId, &'tcx Substs<'tcx>)) +fn substitute_normalize_and_test_predicates_node<'tcx>(key: (DefId, SubstsRef<'tcx>)) -> DepConstructor<'tcx> { DepConstructor::SubstituteNormalizeAndTestPredicates { key } } diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index db248072d9b5..b15aa8629016 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -5,7 +5,7 @@ //! subtyping, type equality, etc. use crate::hir::def_id::DefId; -use crate::ty::subst::{Kind, UnpackedKind, Substs}; +use crate::ty::subst::{Kind, UnpackedKind, SubstsRef}; use crate::ty::{self, Ty, TyCtxt, TypeFoldable}; use crate::ty::error::{ExpectedFound, TypeError}; use crate::mir::interpret::GlobalId; @@ -50,9 +50,9 @@ pub trait TypeRelation<'a, 'gcx: 'a+'tcx, 'tcx: 'a> : Sized { /// accordingly. fn relate_item_substs(&mut self, item_def_id: DefId, - a_subst: &'tcx Substs<'tcx>, - b_subst: &'tcx Substs<'tcx>) - -> RelateResult<'tcx, &'tcx Substs<'tcx>> + a_subst: SubstsRef<'tcx>, + b_subst: SubstsRef<'tcx>) + -> RelateResult<'tcx, SubstsRef<'tcx>> { debug!("relate_item_substs(item_def_id={:?}, a_subst={:?}, b_subst={:?})", item_def_id, @@ -123,9 +123,9 @@ impl<'tcx> Relate<'tcx> for ty::TypeAndMut<'tcx> { pub fn relate_substs<'a, 'gcx, 'tcx, R>(relation: &mut R, variances: Option<&Vec>, - a_subst: &'tcx Substs<'tcx>, - b_subst: &'tcx Substs<'tcx>) - -> RelateResult<'tcx, &'tcx Substs<'tcx>> + a_subst: SubstsRef<'tcx>, + b_subst: SubstsRef<'tcx>) + -> RelateResult<'tcx, SubstsRef<'tcx>> where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { let tcx = relation.tcx(); @@ -624,11 +624,11 @@ impl<'tcx> Relate<'tcx> for ty::GeneratorSubsts<'tcx> { } } -impl<'tcx> Relate<'tcx> for &'tcx Substs<'tcx> { +impl<'tcx> Relate<'tcx> for SubstsRef<'tcx> { fn relate<'a, 'gcx, R>(relation: &mut R, - a: &&'tcx Substs<'tcx>, - b: &&'tcx Substs<'tcx>) - -> RelateResult<'tcx, &'tcx Substs<'tcx>> + a: &SubstsRef<'tcx>, + b: &SubstsRef<'tcx>) + -> RelateResult<'tcx, SubstsRef<'tcx>> where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { relate_substs(relation, None, a, b) diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index dd382ec006bd..31399fbab0a3 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -7,7 +7,7 @@ use crate::mir::interpret::{ConstValue, truncate}; use crate::middle::region; use polonius_engine::Atom; use rustc_data_structures::indexed_vec::Idx; -use crate::ty::subst::{Substs, Subst, Kind, UnpackedKind}; +use crate::ty::subst::{Substs, Subst, SubstsRef, Kind, UnpackedKind}; use crate::ty::{self, AdtDef, TypeFlags, Ty, TyCtxt, TypeFoldable}; use crate::ty::{List, TyS, ParamEnvAnd, ParamEnv}; use crate::util::captures::Captures; @@ -105,7 +105,7 @@ pub enum TyKind<'tcx> { /// That is, even after substitution it is possible that there are type /// variables. This happens when the `Adt` corresponds to an ADT /// definition and not a concrete use of it. - Adt(&'tcx AdtDef, &'tcx Substs<'tcx>), + Adt(&'tcx AdtDef, SubstsRef<'tcx>), /// An unsized FFI type that is opaque to Rust. Written as `extern type T`. Foreign(DefId), @@ -136,7 +136,7 @@ pub enum TyKind<'tcx> { /// fn foo() -> i32 { 1 } /// let bar = foo; // bar: fn() -> i32 {foo} /// ``` - FnDef(DefId, &'tcx Substs<'tcx>), + FnDef(DefId, SubstsRef<'tcx>), /// A pointer to a function. Written as `fn() -> i32`. /// @@ -184,7 +184,7 @@ pub enum TyKind<'tcx> { /// * or the `existential type` declaration /// The substitutions are for the generics of the function in question. /// After typeck, the concrete type can be found in the `types` map. - Opaque(DefId, &'tcx Substs<'tcx>), + Opaque(DefId, SubstsRef<'tcx>), /// A type parameter; for example, `T` in `fn f(x: T) {} Param(ParamTy), @@ -309,7 +309,7 @@ pub struct ClosureSubsts<'tcx> { /// /// These are separated out because codegen wants to pass them around /// when monomorphizing. - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, } /// Struct returned by `split()`. Note that these are subslices of the @@ -387,7 +387,7 @@ impl<'tcx> ClosureSubsts<'tcx> { #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct GeneratorSubsts<'tcx> { - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, } struct SplitGeneratorSubsts<'tcx> { @@ -672,11 +672,11 @@ impl<'tcx> Binder<&'tcx List>> { #[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] pub struct TraitRef<'tcx> { pub def_id: DefId, - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, } impl<'tcx> TraitRef<'tcx> { - pub fn new(def_id: DefId, substs: &'tcx Substs<'tcx>) -> TraitRef<'tcx> { + pub fn new(def_id: DefId, substs: SubstsRef<'tcx>) -> TraitRef<'tcx> { TraitRef { def_id: def_id, substs: substs } } @@ -742,7 +742,7 @@ impl<'tcx> PolyTraitRef<'tcx> { #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] pub struct ExistentialTraitRef<'tcx> { pub def_id: DefId, - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, } impl<'a, 'gcx, 'tcx> ExistentialTraitRef<'tcx> { @@ -915,7 +915,7 @@ impl Binder { #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct ProjectionTy<'tcx> { /// The parameters of the associated item. - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, /// The `DefId` of the `TraitItem` for the associated type `N`. /// @@ -1297,7 +1297,7 @@ impl From for BoundTy { #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct ExistentialProjection<'tcx> { pub item_def_id: DefId, - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, pub ty: Ty<'tcx>, } @@ -2060,7 +2060,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { /// Used in the HIR by using `Unevaluated` everywhere and later normalizing to `Evaluated` if the /// code is monomorphic enough for that. pub enum LazyConst<'tcx> { - Unevaluated(DefId, &'tcx Substs<'tcx>), + Unevaluated(DefId, SubstsRef<'tcx>), Evaluated(Const<'tcx>), } diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 7559ea90b178..0e033b116a2a 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -159,10 +159,12 @@ impl<'tcx> Decodable for Kind<'tcx> { /// A substitution mapping generic parameters to new values. pub type Substs<'tcx> = List>; +pub type SubstsRef<'tcx> = &'tcx Substs<'tcx>; + impl<'a, 'gcx, 'tcx> Substs<'tcx> { /// Creates a `Substs` that maps each generic parameter to itself. pub fn identity_for_item(tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId) - -> &'tcx Substs<'tcx> { + -> SubstsRef<'tcx> { Substs::for_item(tcx, def_id, |param, _| { tcx.mk_param_from_def(param) }) @@ -175,7 +177,7 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> { pub fn bound_vars_for_item( tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId - ) -> &'tcx Substs<'tcx> { + ) -> SubstsRef<'tcx> { Substs::for_item(tcx, def_id, |param, _| { match param.kind { ty::GenericParamDefKind::Type { .. } => { @@ -205,7 +207,7 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> { pub fn for_item(tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId, mut mk_kind: F) - -> &'tcx Substs<'tcx> + -> SubstsRef<'tcx> where F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx> { let defs = tcx.generics_of(def_id); @@ -219,7 +221,7 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> { tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId, mut mk_kind: F) - -> &'tcx Substs<'tcx> + -> SubstsRef<'tcx> where F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx> { Substs::for_item(tcx, def_id, |param, substs| { @@ -312,18 +314,18 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> { pub fn rebase_onto(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, source_ancestor: DefId, target_substs: &Substs<'tcx>) - -> &'tcx Substs<'tcx> { + -> SubstsRef<'tcx> { let defs = tcx.generics_of(source_ancestor); tcx.mk_substs(target_substs.iter().chain(&self[defs.params.len()..]).cloned()) } pub fn truncate_to(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, generics: &ty::Generics) - -> &'tcx Substs<'tcx> { + -> SubstsRef<'tcx> { tcx.mk_substs(self.iter().take(generics.count()).cloned()) } } -impl<'tcx> TypeFoldable<'tcx> for &'tcx Substs<'tcx> { +impl<'tcx> TypeFoldable<'tcx> for SubstsRef<'tcx> { fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self { let params: SmallVec<[_; 8]> = self.iter().map(|k| k.fold_with(folder)).collect(); @@ -341,7 +343,7 @@ impl<'tcx> TypeFoldable<'tcx> for &'tcx Substs<'tcx> { } } -impl<'tcx> serialize::UseSpecializedDecodable for &'tcx Substs<'tcx> {} +impl<'tcx> serialize::UseSpecializedDecodable for SubstsRef<'tcx> {} /////////////////////////////////////////////////////////////////////////// // Public trait `Subst` @@ -563,7 +565,7 @@ pub type CanonicalUserSubsts<'tcx> = Canonical<'tcx, UserSubsts<'tcx>>; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] pub struct UserSubsts<'tcx> { /// The substitutions for the item as given by the user. - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, /// The self type, in the case of a `::Item` path (when applied /// to an inherent impl). See `UserSelfTy` below. diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 1ba7c3bba797..a7b080724925 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -7,7 +7,7 @@ use crate::hir::{self, Node}; use crate::ich::NodeIdHashingMode; use crate::traits::{self, ObligationCause}; use crate::ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable}; -use crate::ty::subst::{Subst, Substs, UnpackedKind}; +use crate::ty::subst::{Subst, Substs, SubstsRef, UnpackedKind}; use crate::ty::query::TyCtxtAt; use crate::ty::TyKind::*; use crate::ty::layout::{Integer, IntegerExt}; @@ -588,7 +588,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// Given the `DefId` of some item that has no type parameters, make /// a suitable "empty substs" for it. - pub fn empty_substs_for_def_id(self, item_def_id: DefId) -> &'tcx Substs<'tcx> { + pub fn empty_substs_for_def_id(self, item_def_id: DefId) -> SubstsRef<'tcx> { Substs::for_item(self, item_def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => self.types.re_erased.into(), @@ -633,7 +633,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn try_expand_impl_trait_type( self, def_id: DefId, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, ) -> Result, Ty<'tcx>> { use crate::ty::fold::TypeFolder; @@ -652,7 +652,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { fn expand_opaque_ty( &mut self, def_id: DefId, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, ) -> Option> { if self.found_recursion { None diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index 16f5880b13f5..4b01e264f19e 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -11,7 +11,7 @@ use rustc::middle::exported_symbols::{SymbolExportLevel, ExportedSymbol, metadat use rustc::session::config; use rustc::ty::{TyCtxt, SymbolName}; use rustc::ty::query::Providers; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::util::nodemap::{FxHashMap, DefIdMap}; use rustc_allocator::ALLOCATOR_METHODS; use rustc_data_structures::indexed_vec::IndexVec; @@ -282,7 +282,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn upstream_monomorphizations_provider<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, cnum: CrateNum) - -> Lrc, CrateNum>>>> + -> Lrc, CrateNum>>>> { debug_assert!(cnum == LOCAL_CRATE); @@ -334,7 +334,7 @@ fn upstream_monomorphizations_provider<'a, 'tcx>( fn upstream_monomorphizations_for_provider<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) - -> Option, CrateNum>>> + -> Option, CrateNum>>> { debug_assert!(!def_id.is_local()); tcx.upstream_monomorphizations(LOCAL_CRATE) diff --git a/src/librustc_codegen_ssa/callee.rs b/src/librustc_codegen_ssa/callee.rs index 3665d45d1e9c..4744dd6302fb 100644 --- a/src/librustc_codegen_ssa/callee.rs +++ b/src/librustc_codegen_ssa/callee.rs @@ -1,12 +1,12 @@ use crate::traits::*; use rustc::ty; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::hir::def_id::DefId; pub fn resolve_and_get_fn<'tcx, Cx: CodegenMethods<'tcx>>( cx: &Cx, def_id: DefId, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, ) -> Cx::Value { cx.get_fn( ty::Instance::resolve( @@ -23,7 +23,7 @@ pub fn resolve_and_get_fn_for_vtable<'tcx, >( cx: &Cx, def_id: DefId, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, ) -> Cx::Value { cx.get_fn( ty::Instance::resolve_for_vtable( diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 203d84bff5bb..e1528921a596 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -2,7 +2,7 @@ use libc::c_uint; use rustc::ty::{self, Ty, TypeFoldable, UpvarSubsts}; use rustc::ty::layout::{TyLayout, HasTyCtxt}; use rustc::mir::{self, Mir}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::session::config::DebugInfo; use rustc_mir::monomorphize::Instance; use rustc_target::abi::call::{FnType, PassMode}; @@ -85,7 +85,7 @@ pub struct FunctionCx<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> { scopes: IndexVec>, /// If this function is being monomorphized, this contains the type substitutions used. - param_substs: &'tcx Substs<'tcx>, + param_substs: SubstsRef<'tcx>, } impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index 8d105853d92f..f529cf30a62e 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -94,7 +94,7 @@ use rustc::hir::map::definitions::DefPathData; use rustc::ich::NodeIdHashingMode; use rustc::ty::item_path::{self, ItemPathBuffer, RootMode}; use rustc::ty::query::Providers; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc::util::common::record_time; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; @@ -134,7 +134,7 @@ fn get_symbol_hash<'a, 'tcx>( // values for generic type parameters, // if any. - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, ) -> u64 { debug!( "get_symbol_hash(def_id={:?}, parameters={:?})", diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index b6fd64123493..a56c3215f9d6 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -1,7 +1,7 @@ #![allow(non_snake_case)] use rustc::hir::Node; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt}; use rustc::ty::layout::{self, IntegerExt, LayoutOf, VariantIdx}; use rustc::{lint, util}; @@ -445,7 +445,7 @@ enum FfiResult<'tcx> { /// FIXME: This duplicates code in codegen. fn is_repr_nullable_ptr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def: &'tcx ty::AdtDef, - substs: &Substs<'tcx>) + substs: SubstsRef<'tcx>) -> bool { if def.variants.len() == 2 { let data_idx; diff --git a/src/librustc_mir/borrow_check/nll/constraint_generation.rs b/src/librustc_mir/borrow_check/nll/constraint_generation.rs index c02c2b4934cf..9eb09b514741 100644 --- a/src/librustc_mir/borrow_check/nll/constraint_generation.rs +++ b/src/librustc_mir/borrow_check/nll/constraint_generation.rs @@ -10,8 +10,8 @@ use rustc::mir::{BasicBlock, BasicBlockData, Location, Mir, Place, Rvalue}; use rustc::mir::{SourceInfo, Statement, Terminator}; use rustc::mir::UserTypeProjection; use rustc::ty::fold::TypeFoldable; -use rustc::ty::subst::Substs; use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, RegionVid}; +use rustc::ty::subst::SubstsRef; pub(super) fn generate_constraints<'cx, 'gcx, 'tcx>( infcx: &InferCtxt<'cx, 'gcx, 'tcx>, @@ -50,7 +50,7 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx /// We sometimes have `substs` within an rvalue, or within a /// call. Make them live at the location where they appear. - fn visit_substs(&mut self, substs: &&'tcx Substs<'tcx>, location: Location) { + fn visit_substs(&mut self, substs: &SubstsRef<'tcx>, location: Location) { self.add_regular_live_constraint(*substs, location); self.super_substs(substs); } diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs index 089640ab7024..cc01f632e075 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs @@ -6,7 +6,7 @@ use rustc::hir; use rustc::hir::def_id::DefId; use rustc::infer::InferCtxt; use rustc::mir::Mir; -use rustc::ty::subst::{Substs, UnpackedKind}; +use rustc::ty::subst::{SubstsRef, UnpackedKind}; use rustc::ty::{self, RegionKind, RegionVid, Ty, TyCtxt}; use rustc::util::ppaux::RegionHighlightMode; use rustc_errors::DiagnosticBuilder; @@ -541,7 +541,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// types+hir to search through). fn match_adt_and_segment<'hir>( &self, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, needle_fr: RegionVid, last_segment: &'hir hir::PathSegment, counter: &mut usize, @@ -587,7 +587,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// `search_stack` the types+hir to search through. fn try_match_adt_and_generic_args<'hir>( &self, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, needle_fr: RegionVid, args: &'hir hir::GenericArgs, search_stack: &mut Vec<(Ty<'tcx>, &'hir hir::Ty)>, diff --git a/src/librustc_mir/borrow_check/nll/renumber.rs b/src/librustc_mir/borrow_check/nll/renumber.rs index e6a974fd8cc9..eab9e0ae171e 100644 --- a/src/librustc_mir/borrow_check/nll/renumber.rs +++ b/src/librustc_mir/borrow_check/nll/renumber.rs @@ -1,4 +1,4 @@ -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, Ty, TypeFoldable}; use rustc::mir::{Location, Mir}; use rustc::mir::visit::{MutVisitor, TyContext}; @@ -55,7 +55,7 @@ impl<'a, 'gcx, 'tcx> MutVisitor<'tcx> for NLLVisitor<'a, 'gcx, 'tcx> { debug!("visit_ty: ty={:?}", ty); } - fn visit_substs(&mut self, substs: &mut &'tcx Substs<'tcx>, location: Location) { + fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, location: Location) { debug!("visit_substs(substs={:?}, location={:?})", substs, location); *substs = self.renumber_regions(&{ *substs }); diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 49f90eb90aaf..4202d10aa63d 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -36,7 +36,7 @@ use rustc::traits::query::type_op::custom::CustomTypeOp; use rustc::traits::query::{Fallible, NoSolution}; use rustc::traits::{ObligationCause, PredicateObligations}; use rustc::ty::fold::TypeFoldable; -use rustc::ty::subst::{Subst, Substs, UnpackedKind, UserSubsts}; +use rustc::ty::subst::{Subst, SubstsRef, UnpackedKind, UserSubsts}; use rustc::ty::{ self, RegionVid, ToPolyTraitRef, Ty, TyCtxt, TyKind, UserType, CanonicalUserTypeAnnotation, UserTypeAnnotationIndex, @@ -2261,7 +2261,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { &mut self, tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, location: Location, ) -> ty::InstantiatedPredicates<'tcx> { if let Some(closure_region_requirements) = tcx.mir_borrowck(def_id).closure_requirements { diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs index a5bf15825770..b418d608f080 100644 --- a/src/librustc_mir/borrow_check/nll/universal_regions.rs +++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs @@ -17,7 +17,7 @@ use rustc::hir::def_id::DefId; use rustc::hir::{self, BodyOwnerKind, HirId}; use rustc::infer::{InferCtxt, NLLRegionVariableOrigin}; use rustc::ty::fold::TypeFoldable; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{Substs, SubstsRef}; use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, RegionVid, Ty, TyCtxt}; use rustc::util::nodemap::FxHashMap; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; @@ -94,12 +94,12 @@ pub enum DefiningTy<'tcx> { /// The MIR is a fn item with the given `DefId` and substs. The signature /// of the function can be bound then with the `fn_sig` query. - FnDef(DefId, &'tcx Substs<'tcx>), + FnDef(DefId, SubstsRef<'tcx>), /// The MIR represents some form of constant. The signature then /// is that it has no inputs and a single return value, which is /// the value of the constant. - Const(DefId, &'tcx Substs<'tcx>), + Const(DefId, SubstsRef<'tcx>), } impl<'tcx> DefiningTy<'tcx> { @@ -222,7 +222,7 @@ impl<'tcx> UniversalRegions<'tcx> { /// `V[1]: V[2]`. pub fn closure_mapping( tcx: TyCtxt<'_, '_, 'tcx>, - closure_substs: &'tcx Substs<'tcx>, + closure_substs: SubstsRef<'tcx>, expected_num_vars: usize, closure_base_def_id: DefId, ) -> IndexVec> { diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index a9a16024302e..19507c900da6 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -12,7 +12,7 @@ use rustc::middle::region; use rustc::mir::*; use rustc::mir::visit::{MutVisitor, TyContext}; use rustc::ty::{self, Ty, TyCtxt}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::util::nodemap::NodeMap; use rustc_target::spec::PanicStrategy; use rustc_data_structures::indexed_vec::{IndexVec, Idx}; @@ -212,7 +212,7 @@ impl<'a, 'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'a, 'gcx> { } } - fn visit_substs(&mut self, substs: &mut &'tcx Substs<'tcx>, _: Location) { + fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, _: Location) { if let Some(lifted) = self.tcx.lift(substs) { *substs = lifted; } else { diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 699ef7138cd9..c32a4fc3820f 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -9,6 +9,7 @@ use rustc::mir::interpret::{GlobalId, ErrorHandled}; use rustc::ty::{self, AdtKind, Ty}; use rustc::ty::adjustment::{Adjustment, Adjust, AutoBorrow, AutoBorrowMutability}; use rustc::ty::cast::CastKind as TyCastKind; +use rustc::ty::subst::{Substs, SubstsRef}; use rustc::hir; use rustc::hir::def_id::LocalDefId; use rustc::mir::BorrowKind; @@ -834,7 +835,7 @@ fn method_callee<'a, 'gcx, 'tcx>( cx: &mut Cx<'a, 'gcx, 'tcx>, expr: &hir::Expr, span: Span, - overloaded_callee: Option<(DefId, &'tcx Substs<'tcx>)>, + overloaded_callee: Option<(DefId, SubstsRef<'tcx>)>, ) -> Expr<'tcx> { let temp_lifetime = cx.region_scope_tree.temporary_scope(expr.hir_id.local_id); let (def_id, substs, user_ty) = match overloaded_callee { @@ -1133,7 +1134,7 @@ fn overloaded_place<'a, 'gcx, 'tcx>( cx: &mut Cx<'a, 'gcx, 'tcx>, expr: &'tcx hir::Expr, place_ty: Ty<'tcx>, - overloaded_callee: Option<(DefId, &'tcx Substs<'tcx>)>, + overloaded_callee: Option<(DefId, SubstsRef<'tcx>)>, args: Vec>, ) -> ExprKind<'tcx> { // For an overloaded *x or x[y] expression of type T, the method diff --git a/src/librustc_mir/hair/mod.rs b/src/librustc_mir/hair/mod.rs index fffa2ed3ec55..2efdacd7622c 100644 --- a/src/librustc_mir/hair/mod.rs +++ b/src/librustc_mir/hair/mod.rs @@ -8,7 +8,7 @@ use rustc::mir::{BinOp, BorrowKind, Field, UnOp}; use rustc::hir::def_id::DefId; use rustc::infer::canonical::Canonical; use rustc::middle::region; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::ty::{AdtDef, UpvarSubsts, Ty, Const, LazyConst, UserType}; use rustc::ty::layout::VariantIdx; use rustc::hir; @@ -261,7 +261,7 @@ pub enum ExprKind<'tcx> { Adt { adt_def: &'tcx AdtDef, variant_index: VariantIdx, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, /// Optional user-given substs: for something like `let x = /// Bar:: { ... }`. diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index fff810b0e6f2..085ac67cfb74 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -11,7 +11,7 @@ use rustc::middle::mem_categorization::cmt_; use rustc::middle::region; use rustc::session::Session; use rustc::ty::{self, Ty, TyCtxt}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{Substs, SubstsRef}; use rustc::lint; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc::util::common::ErrorReported; @@ -64,7 +64,7 @@ struct MatchVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, param_env: ty::ParamEnv<'tcx>, - identity_substs: &'tcx Substs<'tcx>, + identity_substs: SubstsRef<'tcx>, region_scope_tree: &'a region::ScopeTree, } diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 9e5fdaa8afdf..c234c2474ff1 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -16,7 +16,7 @@ use rustc::mir::{UserTypeProjection}; use rustc::mir::interpret::{Scalar, GlobalId, ConstValue, sign_extend}; use rustc::ty::{self, Region, TyCtxt, AdtDef, Ty, Lift, UserType}; use rustc::ty::{CanonicalUserType, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations}; -use rustc::ty::subst::{Substs, Kind}; +use rustc::ty::subst::{SubstsRef, Kind}; use rustc::ty::layout::VariantIdx; use rustc::hir::{self, PatKind, RangeEnd}; use rustc::hir::def::{Def, CtorKind}; @@ -135,7 +135,7 @@ pub enum PatternKind<'tcx> { /// multiple variants. Variant { adt_def: &'tcx AdtDef, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, variant_index: VariantIdx, subpatterns: Vec>, }, @@ -330,13 +330,13 @@ pub struct PatternContext<'a, 'tcx: 'a> { pub tcx: TyCtxt<'a, 'tcx, 'tcx>, pub param_env: ty::ParamEnv<'tcx>, pub tables: &'a ty::TypeckTables<'tcx>, - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, pub errors: Vec, } impl<'a, 'tcx> Pattern<'tcx> { pub fn from_hir(tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env_and_substs: ty::ParamEnvAnd<'tcx, &'tcx Substs<'tcx>>, + param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, tables: &'a ty::TypeckTables<'tcx>, pat: &'tcx hir::Pat) -> Self { let mut pcx = PatternContext::new(tcx, param_env_and_substs, tables); @@ -352,7 +352,7 @@ impl<'a, 'tcx> Pattern<'tcx> { impl<'a, 'tcx> PatternContext<'a, 'tcx> { pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env_and_substs: ty::ParamEnvAnd<'tcx, &'tcx Substs<'tcx>>, + param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, tables: &'a ty::TypeckTables<'tcx>) -> Self { PatternContext { tcx, @@ -1093,7 +1093,7 @@ macro_rules! CloneImpls { CloneImpls!{ <'tcx> Span, Field, Mutability, ast::Name, ast::NodeId, usize, ty::Const<'tcx>, Region<'tcx>, Ty<'tcx>, BindingMode, &'tcx AdtDef, - &'tcx Substs<'tcx>, &'tcx Kind<'tcx>, UserType<'tcx>, + SubstsRef<'tcx>, &'tcx Kind<'tcx>, UserType<'tcx>, UserTypeProjection<'tcx>, PatternTypeProjection<'tcx> } diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 0c1b5d65b8b6..8a32c3b636c7 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -9,7 +9,7 @@ use rustc::mir; use rustc::ty::layout::{ self, Size, Align, HasDataLayout, LayoutOf, TyLayout }; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, SubstsRef}; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc::ty::query::TyCtxtAt; use rustc_data_structures::indexed_vec::IndexVec; @@ -244,7 +244,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc pub(super) fn resolve( &self, def_id: DefId, - substs: &'tcx Substs<'tcx> + substs: SubstsRef<'tcx> ) -> EvalResult<'tcx, ty::Instance<'tcx>> { trace!("resolve: {:?}, {:#?}", def_id, substs); trace!("param_env: {:#?}", self.param_env); @@ -306,7 +306,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc fn monomorphize_with_substs + Subst<'tcx>>( &self, t: T, - substs: &'tcx Substs<'tcx> + substs: SubstsRef<'tcx> ) -> T { // miri doesn't care about lifetimes, and will choke on some crazy ones // let's simply get rid of them diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index dd7158897b88..2e4b8682437f 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -180,7 +180,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::mir::interpret::{AllocId, ConstValue}; use rustc::middle::lang_items::{ExchangeMallocFnLangItem, StartFnLangItem}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{Substs, SubstsRef}; use rustc::ty::{self, TypeFoldable, Ty, TyCtxt, GenericParamDefKind}; use rustc::ty::adjustment::CustomCoerceUnsized; use rustc::session::config::EntryFnType; @@ -500,7 +500,7 @@ struct MirNeighborCollector<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &'a mir::Mir<'tcx>, output: &'a mut Vec>, - param_substs: &'tcx Substs<'tcx>, + param_substs: SubstsRef<'tcx>, } impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { @@ -748,7 +748,7 @@ fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: fn is_available_upstream_generic<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, - substs: &'tcx Substs<'tcx>) + substs: SubstsRef<'tcx>) -> bool { debug_assert!(!def_id.is_local()); @@ -1218,7 +1218,7 @@ fn def_id_to_string<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn collect_lazy_const<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, constant: &ty::LazyConst<'tcx>, - param_substs: &'tcx Substs<'tcx>, + param_substs: SubstsRef<'tcx>, output: &mut Vec>, ) { let (def_id, substs) = match *constant { diff --git a/src/librustc_mir/transform/erase_regions.rs b/src/librustc_mir/transform/erase_regions.rs index 84f209f8776d..9494d4b1f6c3 100644 --- a/src/librustc_mir/transform/erase_regions.rs +++ b/src/librustc_mir/transform/erase_regions.rs @@ -4,7 +4,7 @@ //! N.B., we do _not_ erase regions of statements that are relevant for //! "types-as-contracts"-validation, namely, `AcquireValid` and `ReleaseValid`. -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TyCtxt}; use rustc::mir::*; use rustc::mir::visit::{MutVisitor, TyContext}; @@ -36,7 +36,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for EraseRegionsVisitor<'a, 'tcx> { *constant = self.tcx.erase_regions(constant); } - fn visit_substs(&mut self, substs: &mut &'tcx Substs<'tcx>, _: Location) { + fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, _: Location) { *substs = self.tcx.erase_regions(substs); } diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 0866b87cf17e..09142828f18a 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -55,7 +55,7 @@ use rustc::mir::*; use rustc::mir::visit::{PlaceContext, Visitor, MutVisitor}; use rustc::ty::{self, TyCtxt, AdtDef, Ty}; use rustc::ty::layout::VariantIdx; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::bit_set::BitSet; @@ -154,7 +154,7 @@ struct SuspensionPoint { struct TransformVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, state_adt_ref: &'tcx AdtDef, - state_substs: &'tcx Substs<'tcx>, + state_substs: SubstsRef<'tcx>, // The index of the generator state in the generator struct state_field: usize, diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 07ebbf6d0ebe..56e4926090ea 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -9,7 +9,7 @@ use rustc_data_structures::indexed_vec::{Idx, IndexVec}; use rustc::mir::*; use rustc::mir::visit::*; use rustc::ty::{self, Instance, InstanceDef, ParamEnv, Ty, TyCtxt}; -use rustc::ty::subst::{Subst,Substs}; +use rustc::ty::subst::{Subst, SubstsRef}; use std::collections::VecDeque; use std::iter; @@ -32,7 +32,7 @@ pub struct Inline; #[derive(Copy, Clone, Debug)] struct CallSite<'tcx> { callee: DefId, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, bb: BasicBlock, location: SourceInfo, } diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index e86ece138301..cf3ba1765406 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -5,7 +5,7 @@ use rustc::middle::lang_items; use rustc::traits::Reveal; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::layout::VariantIdx; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::ty::util::IntTypeExt; use rustc_data_structures::indexed_vec::Idx; use crate::util::patch::MirPatch; @@ -189,7 +189,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> base_place: &Place<'tcx>, variant_path: D::Path, variant: &'tcx ty::VariantDef, - substs: &'tcx Substs<'tcx>) + substs: SubstsRef<'tcx>) -> Vec<(Place<'tcx>, Option)> { variant.fields.iter().enumerate().map(|(i, f)| { @@ -328,7 +328,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> self.drop_ladder(fields, succ, unwind).0 } - fn open_drop_for_box<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: &'tcx Substs<'tcx>) + fn open_drop_for_box<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>) -> BasicBlock { debug!("open_drop_for_box({:?}, {:?}, {:?})", self, adt, substs); @@ -346,7 +346,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> self.drop_subpath(&interior, interior_path, succ, unwind_succ) } - fn open_drop_for_adt<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: &'tcx Substs<'tcx>) + fn open_drop_for_adt<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>) -> BasicBlock { debug!("open_drop_for_adt({:?}, {:?}, {:?})", self, adt, substs); if adt.variants.len() == 0 { @@ -376,7 +376,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> } fn open_drop_for_adt_contents(&mut self, adt: &'tcx ty::AdtDef, - substs: &'tcx Substs<'tcx>) + substs: SubstsRef<'tcx>) -> (BasicBlock, Unwind) { let (succ, unwind) = self.drop_ladder_bottom(); if !adt.is_enum() { @@ -393,7 +393,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> } fn open_drop_for_multivariant(&mut self, adt: &'tcx ty::AdtDef, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, succ: BasicBlock, unwind: Unwind) -> (BasicBlock, Unwind) { @@ -867,7 +867,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> fn box_free_block<'a>( &mut self, adt: &'tcx ty::AdtDef, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, target: BasicBlock, unwind: Unwind, ) -> BasicBlock { @@ -878,7 +878,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> fn unelaborated_free_block<'a>( &mut self, adt: &'tcx ty::AdtDef, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, target: BasicBlock, unwind: Unwind ) -> BasicBlock { diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index c25884df87ba..105eb5187467 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -22,7 +22,7 @@ use rustc::middle::mem_categorization as mc; use rustc::middle::mem_categorization::Categorization; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::query::Providers; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{Substs, SubstsRef}; use rustc::util::nodemap::{ItemLocalSet, HirIdSet}; use rustc::hir; use rustc_data_structures::sync::Lrc; @@ -94,7 +94,7 @@ struct CheckCrateVisitor<'a, 'tcx: 'a> { in_static: bool, mut_rvalue_borrows: HirIdSet, param_env: ty::ParamEnv<'tcx>, - identity_substs: &'tcx Substs<'tcx>, + identity_substs: SubstsRef<'tcx>, tables: &'a ty::TypeckTables<'tcx>, result: ItemLocalSet, } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index db63f2aafbc2..7e56c62c5f33 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -14,7 +14,7 @@ use rustc::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS; use rustc::traits; use rustc::ty::{self, Ty, TyCtxt, ToPredicate, TypeFoldable}; use rustc::ty::{GenericParamDef, GenericParamDefKind}; -use rustc::ty::subst::{Kind, Subst, Substs}; +use rustc::ty::subst::{Kind, Subst, Substs, SubstsRef}; use rustc::ty::wf::object_region_bounds; use rustc_data_structures::sync::Lrc; use rustc_target::spec::abi; @@ -177,7 +177,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { span: Span, def_id: DefId, item_segment: &hir::PathSegment) - -> &'tcx Substs<'tcx> + -> SubstsRef<'tcx> { let (substs, assoc_bindings, _) = item_segment.with_generic_args(|generic_args| { self.create_substs_for_ast_path( @@ -436,7 +436,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { args_for_def_id: impl Fn(DefId) -> (Option<&'b GenericArgs>, bool), provided_kind: impl Fn(&GenericParamDef, &GenericArg) -> Kind<'tcx>, inferred_kind: impl Fn(Option<&[Kind<'tcx>]>, &GenericParamDef, bool) -> Kind<'tcx>, - ) -> &'tcx Substs<'tcx> { + ) -> SubstsRef<'tcx> { // Collect the segments of the path; we need to substitute arguments // for parameters throughout the entire path (wherever there are // generic parameters). @@ -548,7 +548,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { generic_args: &hir::GenericArgs, infer_types: bool, self_ty: Option>) - -> (&'tcx Substs<'tcx>, Vec>, Option>) + -> (SubstsRef<'tcx>, Vec>, Option>) { // If the type is parameterized by this region, then replace this // region with the current anon region binding (in other words, @@ -760,7 +760,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { trait_def_id: DefId, self_ty: Ty<'tcx>, trait_segment: &hir::PathSegment, - ) -> (&'tcx Substs<'tcx>, Vec>, Option>) { + ) -> (SubstsRef<'tcx>, Vec>, Option>) { debug!("create_substs_for_ast_trait_ref(trait_segment={:?})", trait_segment); diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index 97ee973938cc..87276b8c66ca 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -37,9 +37,9 @@ use rustc::hir; use rustc::session::Session; use rustc::traits; use rustc::ty::{self, Ty, TypeFoldable, TypeAndMut}; +use rustc::ty::subst::SubstsRef; use rustc::ty::adjustment::AllowTwoPhase; use rustc::ty::cast::{CastKind, CastTy}; -use rustc::ty::subst::Substs; use rustc::middle::lang_items; use syntax::ast; use syntax_pos::Span; @@ -69,7 +69,7 @@ enum PointerKind<'tcx> { /// The unsize info of this projection OfProjection(&'tcx ty::ProjectionTy<'tcx>), /// The unsize info of this opaque ty - OfOpaque(DefId, &'tcx Substs<'tcx>), + OfOpaque(DefId, SubstsRef<'tcx>), /// The unsize info of this parameter OfParam(&'tcx ty::ParamTy), } diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 1eaa8b17d09f..996d6cfd5683 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -4,10 +4,9 @@ use crate::astconv::AstConv; use crate::check::{FnCtxt, PlaceOp, callee, Needs}; use crate::hir::GenericArg; use crate::hir::def_id::DefId; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{Subst, SubstsRef}; use rustc::traits; use rustc::ty::{self, Ty, GenericParamDefKind}; -use rustc::ty::subst::Subst; use rustc::ty::adjustment::{Adjustment, Adjust, OverloadedDeref}; use rustc::ty::adjustment::{AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::fold::TypeFoldable; @@ -209,7 +208,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { fn fresh_receiver_substs(&mut self, self_ty: Ty<'tcx>, pick: &probe::Pick<'tcx>) - -> &'tcx Substs<'tcx> { + -> SubstsRef<'tcx> { match pick.kind { probe::InherentImplPick => { let impl_def_id = pick.item.container.id(); @@ -300,8 +299,8 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { &mut self, pick: &probe::Pick<'tcx>, seg: &hir::PathSegment, - parent_substs: &Substs<'tcx>, - ) -> &'tcx Substs<'tcx> { + parent_substs: SubstsRef<'tcx>, + ) -> SubstsRef<'tcx> { // Determine the values for the generic parameters of the method. // If they were not explicitly supplied, just construct fresh // variables. @@ -369,7 +368,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { // until we unify the `Self` type. fn instantiate_method_sig(&mut self, pick: &probe::Pick<'tcx>, - all_substs: &'tcx Substs<'tcx>) + all_substs: SubstsRef<'tcx>) -> (ty::FnSig<'tcx>, ty::InstantiatedPredicates<'tcx>) { debug!("instantiate_method_sig(pick={:?}, all_substs={:?})", pick, @@ -404,7 +403,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { fn add_obligations(&mut self, fty: Ty<'tcx>, - all_substs: &Substs<'tcx>, + all_substs: SubstsRef<'tcx>, method_predicates: &ty::InstantiatedPredicates<'tcx>) { debug!("add_obligations: fty={:?} all_substs={:?} method_predicates={:?}", fty, diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index b14c56ddad00..cb6a862f06ee 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -18,7 +18,7 @@ use rustc::hir; use rustc::hir::def::Def; use rustc::hir::def_id::DefId; use rustc::traits; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{Substs, SubstsRef}; use rustc::ty::{self, Ty, ToPredicate, ToPolyTraitRef, TraitRef, TypeFoldable}; use rustc::ty::GenericParamDefKind; use rustc::ty::subst::Subst; @@ -38,7 +38,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { pub struct MethodCallee<'tcx> { /// Impl method ID, for inherent methods, or trait method ID, otherwise. pub def_id: DefId, - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, /// Instantiated method signature, i.e., it has been /// substituted, normalized, and has had late-bound diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 312d83cebbab..0db9e3ed85fd 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -13,7 +13,7 @@ use rustc_data_structures::sync::Lrc; use rustc::hir; use rustc::lint; use rustc::session::config::nightly_options; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, Substs, SubstsRef}; use rustc::traits::{self, ObligationCause}; use rustc::traits::query::{CanonicalTyGoal}; use rustc::traits::query::method_autoderef::{CandidateStep, MethodAutoderefStepsResult}; @@ -125,7 +125,7 @@ struct Candidate<'tcx> { #[derive(Debug)] enum CandidateKind<'tcx> { - InherentImplCandidate(&'tcx Substs<'tcx>, + InherentImplCandidate(SubstsRef<'tcx>, // Normalize obligations Vec>), ObjectCandidate, @@ -1537,11 +1537,11 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { } /// Gets the type of an impl and generate substitutions with placeholders. - fn impl_ty_and_substs(&self, impl_def_id: DefId) -> (Ty<'tcx>, &'tcx Substs<'tcx>) { + fn impl_ty_and_substs(&self, impl_def_id: DefId) -> (Ty<'tcx>, SubstsRef<'tcx>) { (self.tcx.type_of(impl_def_id), self.fresh_item_substs(impl_def_id)) } - fn fresh_item_substs(&self, def_id: DefId) -> &'tcx Substs<'tcx> { + fn fresh_item_substs(&self, def_id: DefId) -> SubstsRef<'tcx> { Substs::for_item(self.tcx, def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => self.tcx.types.re_erased.into(), diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index d77aabcda2d8..fbbc65feb737 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -109,7 +109,7 @@ use rustc::ty::{ use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::fold::TypeFoldable; use rustc::ty::query::Providers; -use rustc::ty::subst::{UnpackedKind, Subst, Substs, UserSelfTy, UserSubsts}; +use rustc::ty::subst::{UnpackedKind, Subst, Substs, SubstsRef, UserSelfTy, UserSubsts}; use rustc::ty::util::{Representability, IntTypeExt, Discr}; use rustc::ty::layout::VariantIdx; use syntax_pos::{self, BytePos, Span, MultiSpan}; @@ -1318,7 +1318,7 @@ fn check_union<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn check_opaque<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, span: Span, ) { if let Err(partially_expanded_type) = tcx.try_expand_impl_trait_type(def_id, substs) { @@ -2200,7 +2200,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - pub fn write_substs(&self, node_id: hir::HirId, substs: &'tcx Substs<'tcx>) { + pub fn write_substs(&self, node_id: hir::HirId, substs: SubstsRef<'tcx>) { if !substs.is_noop() { debug!("write_substs({:?}, {:?}) in fcx {}", node_id, @@ -2222,7 +2222,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { &self, hir_id: hir::HirId, def_id: DefId, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, user_self_ty: Option>, ) { debug!( diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index bd9b4fecbecc..419796a2014e 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -105,7 +105,7 @@ use rustc::session; use rustc::session::CompileIncomplete; use rustc::session::config::{EntryFnType, nightly_options}; use rustc::traits::{ObligationCause, ObligationCauseCode, TraitEngine, TraitEngineExt}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::query::Providers; use rustc::util; @@ -116,7 +116,7 @@ use util::common::time; use std::iter; pub struct TypeAndSubsts<'tcx> { - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, ty: Ty<'tcx>, } From 998896c036cca6ed984f39fe28bb867055432167 Mon Sep 17 00:00:00 2001 From: Tobias Bucher Date: Tue, 26 Feb 2019 16:10:28 +0100 Subject: [PATCH 075/381] Clarify `rotate_{left,right}` docs I wondered what the `<>`! +Please note this isn't the same operation as the `>>` shifting operator! # Examples @@ -2300,7 +2300,7 @@ assert_eq!(n.trailing_zeros(), 3);", $EndFeature, " concat!("Shifts the bits to the left by a specified amount, `n`, wrapping the truncated bits to the end of the resulting integer. -Please note this isn't the same operation as `<<`! +Please note this isn't the same operation as the `<<` shifting operator! # Examples @@ -2324,7 +2324,7 @@ assert_eq!(n.rotate_left(", $rot, "), m); wrapping the truncated bits to the beginning of the resulting integer. -Please note this isn't the same operation as `>>`! +Please note this isn't the same operation as the `>>` shifting operator! # Examples diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 50e189c9e364..9cd5108ade41 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -429,7 +429,8 @@ assert_eq!(n.trailing_zeros(), 3); /// wrapping the truncated bits to the end of the resulting /// integer. /// - /// Please note this isn't the same operation as `>>`! + /// Please note this isn't the same operation as the `>>` shifting + /// operator! /// /// # Examples /// @@ -454,7 +455,8 @@ assert_eq!(n.trailing_zeros(), 3); /// wrapping the truncated bits to the beginning of the resulting /// integer. /// - /// Please note this isn't the same operation as `<<`! + /// Please note this isn't the same operation as the `<<` shifting + /// operator! /// /// # Examples /// From c196097e588b05e86b5ce6de992b2a6e6a7027bd Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 12 Feb 2019 10:20:34 -0800 Subject: [PATCH 076/381] rustc: Update LLVM, remove dead wasm code This commit updates the LLVM branch to the rebased version of the upstream release/8.x branch. This includes a wasm patch which means that the `rewrite_imports` pass in rustc is no longer needed (yay!) and we can instead rely on `wasm-import-module`, an attribute we're already emitting, to take care of all the work. --- src/librustc_codegen_llvm/back/link.rs | 1 - src/librustc_codegen_llvm/back/wasm.rs | 126 ------------------------- src/librustc_codegen_ssa/base.rs | 24 +---- src/librustc_codegen_ssa/lib.rs | 1 - src/llvm-project | 2 +- 5 files changed, 2 insertions(+), 152 deletions(-) diff --git a/src/librustc_codegen_llvm/back/link.rs b/src/librustc_codegen_llvm/back/link.rs index 819f7f941025..6c175ff4247c 100644 --- a/src/librustc_codegen_llvm/back/link.rs +++ b/src/librustc_codegen_llvm/back/link.rs @@ -698,7 +698,6 @@ fn link_natively(sess: &Session, } if sess.opts.target_triple.triple() == "wasm32-unknown-unknown" { - wasm::rewrite_imports(&out_filename, &codegen_results.crate_info.wasm_imports); wasm::add_producer_section( &out_filename, &sess.edition().to_string(), diff --git a/src/librustc_codegen_llvm/back/wasm.rs b/src/librustc_codegen_llvm/back/wasm.rs index e1d3351d3dec..f90bb89fbe87 100644 --- a/src/librustc_codegen_llvm/back/wasm.rs +++ b/src/librustc_codegen_llvm/back/wasm.rs @@ -2,116 +2,11 @@ use std::fs; use std::path::Path; use std::str; -use rustc_data_structures::fx::FxHashMap; use serialize::leb128; // https://webassembly.github.io/spec/core/binary/modules.html#binary-importsec -const WASM_IMPORT_SECTION_ID: u8 = 2; const WASM_CUSTOM_SECTION_ID: u8 = 0; -const WASM_EXTERNAL_KIND_FUNCTION: u8 = 0; -const WASM_EXTERNAL_KIND_TABLE: u8 = 1; -const WASM_EXTERNAL_KIND_MEMORY: u8 = 2; -const WASM_EXTERNAL_KIND_GLOBAL: u8 = 3; - -/// Rewrite the module imports are listed from in a wasm module given the field -/// name to module name mapping in `import_map`. -/// -/// LLVM 6 which we're using right now doesn't have the ability to configure the -/// module a wasm symbol is import from. Rather all imported symbols come from -/// the bland `"env"` module unconditionally. Furthermore we'd *also* need -/// support in LLD for preserving these import modules, which it unfortunately -/// currently does not. -/// -/// This function is intended as a hack for now where we manually rewrite the -/// wasm output by LLVM to have the correct import modules listed. The -/// `#[link(wasm_import_module = "...")]` attribute in Rust translates to the -/// module that each symbol is imported from, so here we manually go through the -/// wasm file, decode it, rewrite imports, and then rewrite the wasm module. -/// -/// Support for this was added to LLVM in -/// https://github.com/llvm-mirror/llvm/commit/0f32e1365, although support still -/// needs to be added, tracked at https://bugs.llvm.org/show_bug.cgi?id=37168 -pub fn rewrite_imports(path: &Path, import_map: &FxHashMap) { - if import_map.is_empty() { - return - } - - let wasm = fs::read(path).expect("failed to read wasm output"); - let mut ret = WasmEncoder::new(); - ret.data.extend(&wasm[..8]); - - // skip the 8 byte wasm/version header - for (id, raw) in WasmSections(WasmDecoder::new(&wasm[8..])) { - ret.byte(id); - if id == WASM_IMPORT_SECTION_ID { - info!("rewriting import section"); - let data = rewrite_import_section( - &mut WasmDecoder::new(raw), - import_map, - ); - ret.bytes(&data); - } else { - info!("carry forward section {}, {} bytes long", id, raw.len()); - ret.bytes(raw); - } - } - - fs::write(path, &ret.data).expect("failed to write wasm output"); - - fn rewrite_import_section( - wasm: &mut WasmDecoder<'_>, - import_map: &FxHashMap, - ) - -> Vec - { - let mut dst = WasmEncoder::new(); - let n = wasm.u32(); - dst.u32(n); - info!("rewriting {} imports", n); - for _ in 0..n { - rewrite_import_entry(wasm, &mut dst, import_map); - } - return dst.data - } - - fn rewrite_import_entry(wasm: &mut WasmDecoder<'_>, - dst: &mut WasmEncoder, - import_map: &FxHashMap) { - // More info about the binary format here is available at: - // https://webassembly.github.io/spec/core/binary/modules.html#import-section - // - // Note that you can also find the whole point of existence of this - // function here, where we map the `module` name to a different one if - // we've got one listed. - let module = wasm.str(); - let field = wasm.str(); - let new_module = if module == "env" { - import_map.get(field).map(|s| &**s).unwrap_or(module) - } else { - module - }; - info!("import rewrite ({} => {}) / {}", module, new_module, field); - dst.str(new_module); - dst.str(field); - let kind = wasm.byte(); - dst.byte(kind); - match kind { - WASM_EXTERNAL_KIND_FUNCTION => dst.u32(wasm.u32()), - WASM_EXTERNAL_KIND_TABLE => { - dst.byte(wasm.byte()); // element_type - dst.limits(wasm.limits()); - } - WASM_EXTERNAL_KIND_MEMORY => dst.limits(wasm.limits()), - WASM_EXTERNAL_KIND_GLOBAL => { - dst.byte(wasm.byte()); // content_type - dst.bool(wasm.bool()); // mutable - } - b => panic!("unknown kind: {}", b), - } - } -} - /// Adds or augment the existing `producers` section to encode information about /// the Rust compiler used to produce the wasm file. pub fn add_producer_section( @@ -266,15 +161,6 @@ impl<'a> WasmDecoder<'a> { let len = self.u32(); str::from_utf8(self.skip(len as usize)).unwrap() } - - fn bool(&mut self) -> bool { - self.byte() == 1 - } - - fn limits(&mut self) -> (u32, Option) { - let has_max = self.bool(); - (self.u32(), if has_max { Some(self.u32()) } else { None }) - } } struct WasmEncoder { @@ -302,16 +188,4 @@ impl WasmEncoder { fn str(&mut self, val: &str) { self.bytes(val.as_bytes()) } - - fn bool(&mut self, b: bool) { - self.byte(b as u8); - } - - fn limits(&mut self, limits: (u32, Option)) { - self.bool(limits.1.is_some()); - self.u32(limits.0); - if let Some(c) = limits.1 { - self.u32(c); - } - } } diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index fad41a11a82b..39ce15e47729 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -16,7 +16,7 @@ use crate::{ModuleCodegen, ModuleKind, CachedModuleCodegen}; use rustc::dep_graph::cgu_reuse_tracker::CguReuse; -use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; +use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::middle::lang_items::StartFnLangItem; use rustc::middle::weak_lang_items; use rustc::mir::mono::{Stats, CodegenUnitNameBuilder}; @@ -816,21 +816,11 @@ impl CrateInfo { used_crates_dynamic: cstore::used_crates(tcx, LinkagePreference::RequireDynamic), used_crates_static: cstore::used_crates(tcx, LinkagePreference::RequireStatic), used_crate_source: Default::default(), - wasm_imports: Default::default(), lang_item_to_crate: Default::default(), missing_lang_items: Default::default(), }; let lang_items = tcx.lang_items(); - let load_wasm_items = tcx.sess.crate_types.borrow() - .iter() - .any(|c| *c != config::CrateType::Rlib) && - tcx.sess.opts.target_triple.triple() == "wasm32-unknown-unknown"; - - if load_wasm_items { - info.load_wasm_imports(tcx, LOCAL_CRATE); - } - let crates = tcx.crates(); let n_crates = crates.len(); @@ -858,9 +848,6 @@ impl CrateInfo { if tcx.is_no_builtins(cnum) { info.is_no_builtins.insert(cnum); } - if load_wasm_items { - info.load_wasm_imports(tcx, cnum); - } let missing = tcx.missing_lang_items(cnum); for &item in missing.iter() { if let Ok(id) = lang_items.require(item) { @@ -879,15 +866,6 @@ impl CrateInfo { return info } - - fn load_wasm_imports(&mut self, tcx: TyCtxt<'_, '_, '_>, cnum: CrateNum) { - self.wasm_imports.extend(tcx.wasm_import_module_map(cnum).iter().map(|(&id, module)| { - let instance = Instance::mono(tcx, id); - let import_name = tcx.symbol_name(instance); - - (import_name.to_string(), module.clone()) - })); - } } fn is_codegened_item(tcx: TyCtxt<'_, '_, '_>, id: DefId) -> bool { diff --git a/src/librustc_codegen_ssa/lib.rs b/src/librustc_codegen_ssa/lib.rs index 92fa2766f872..f38b22aa0417 100644 --- a/src/librustc_codegen_ssa/lib.rs +++ b/src/librustc_codegen_ssa/lib.rs @@ -138,7 +138,6 @@ pub struct CrateInfo { pub used_crate_source: FxHashMap>, pub used_crates_static: Vec<(CrateNum, LibSource)>, pub used_crates_dynamic: Vec<(CrateNum, LibSource)>, - pub wasm_imports: FxHashMap, pub lang_item_to_crate: FxHashMap, pub missing_lang_items: FxHashMap>, } diff --git a/src/llvm-project b/src/llvm-project index 73a75d35b977..38ad31bde8ff 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 73a75d35b9776d56160fa3200aca4a970ae49b60 +Subproject commit 38ad31bde8ff681d862dc0f96930a5dd9b7a472e From 9b4055b30200caf366d387624fd5bbb03de8da13 Mon Sep 17 00:00:00 2001 From: Angelos Oikonomopoulos Date: Tue, 26 Feb 2019 16:48:12 +0100 Subject: [PATCH 077/381] Normalize the type Self resolves to in an impl This is required at the very least in order to evaluate associated constants for arrays (see #58212). --- src/librustc_typeck/astconv.rs | 3 ++- src/test/run-pass/issues/issue-58212.rs | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/test/run-pass/issues/issue-58212.rs diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index db63f2aafbc2..c52ff8bf650c 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1700,7 +1700,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { // `Self` in impl (we know the concrete type). assert_eq!(opt_self_ty, None); self.prohibit_generics(&path.segments); - tcx.at(span).type_of(def_id) + // Try to evaluate any array length constants + self.normalize_ty(span, tcx.at(span).type_of(def_id)) } Def::SelfTy(Some(_), None) => { // `Self` in trait. diff --git a/src/test/run-pass/issues/issue-58212.rs b/src/test/run-pass/issues/issue-58212.rs new file mode 100644 index 000000000000..76437630309a --- /dev/null +++ b/src/test/run-pass/issues/issue-58212.rs @@ -0,0 +1,13 @@ +trait FromUnchecked { + unsafe fn from_unchecked(); +} + +impl FromUnchecked for [u8; 1] { + unsafe fn from_unchecked() { + let mut array: Self = std::mem::uninitialized(); + let _ptr = &mut array as *mut [u8] as *mut u8; + } +} + +fn main() { +} From cf1172978729ecaf62492622498f4ca75137c390 Mon Sep 17 00:00:00 2001 From: csmoe Date: Tue, 26 Feb 2019 09:30:34 +0800 Subject: [PATCH 078/381] rename Substs to InternalSubsts Change-Id: I3fa00e999a2ee4eb72db1fdf53a8633b49176a18 --- src/librustc/infer/error_reporting/mod.rs | 10 +++---- src/librustc/infer/mod.rs | 4 +-- src/librustc/infer/opaque_types/mod.rs | 4 +-- src/librustc/infer/outlives/verify.rs | 4 +-- src/librustc/traits/auto_trait.rs | 2 +- src/librustc/traits/codegen/mod.rs | 4 +-- src/librustc/traits/mod.rs | 6 ++-- src/librustc/traits/object_safety.rs | 22 +++++++++------ src/librustc/traits/project.rs | 6 ++-- src/librustc/traits/query/normalize.rs | 4 +-- src/librustc/traits/select.rs | 4 +-- src/librustc/traits/specialize/mod.rs | 4 +-- src/librustc/traits/util.rs | 4 +-- src/librustc/ty/context.rs | 14 +++++----- src/librustc/ty/flags.rs | 4 +-- src/librustc/ty/mod.rs | 12 ++++---- src/librustc/ty/sty.rs | 10 +++---- src/librustc/ty/subst.rs | 28 +++++++++---------- src/librustc/ty/util.rs | 4 +-- src/librustc/ty/walk.rs | 2 +- src/librustc/ty/wf.rs | 4 +-- src/librustc/util/ppaux.rs | 8 +++--- src/librustc_codegen_llvm/debuginfo/mod.rs | 4 +-- .../debuginfo/type_names.rs | 6 ++-- .../borrow_check/nll/region_infer/mod.rs | 6 ++-- .../borrow_check/nll/universal_regions.rs | 8 +++--- src/librustc_mir/hair/cx/expr.rs | 6 ++-- src/librustc_mir/hair/cx/mod.rs | 8 +++--- src/librustc_mir/hair/pattern/_match.rs | 4 +-- src/librustc_mir/hair/pattern/check_match.rs | 4 +-- src/librustc_mir/lints.rs | 4 +-- src/librustc_mir/monomorphize/collector.rs | 6 ++-- src/librustc_mir/monomorphize/item.rs | 6 ++-- src/librustc_mir/shim.rs | 6 ++-- src/librustc_mir/transform/const_prop.rs | 4 +-- src/librustc_passes/rvalue_promotion.rs | 6 ++-- src/librustc_privacy/lib.rs | 6 ++-- src/librustc_resolve/lib.rs | 2 +- .../chalk_context/program_clauses.rs | 4 +-- src/librustc_traits/dropck_outlives.rs | 4 +-- src/librustc_traits/generic_types.rs | 8 +++--- src/librustc_traits/lowering/mod.rs | 12 ++++---- src/librustc_typeck/astconv.rs | 6 ++-- src/librustc_typeck/check/closure.rs | 4 +-- src/librustc_typeck/check/coercion.rs | 2 +- src/librustc_typeck/check/compare_method.rs | 6 ++-- src/librustc_typeck/check/dropck.rs | 4 +-- src/librustc_typeck/check/method/mod.rs | 4 +-- src/librustc_typeck/check/method/probe.rs | 10 +++---- src/librustc_typeck/check/mod.rs | 18 ++++++------ src/librustc_typeck/check/regionck.rs | 4 +-- src/librustc_typeck/check/wfcheck.rs | 4 +-- src/librustc_typeck/collect.rs | 20 ++++++------- src/librustc_typeck/variance/constraints.rs | 6 ++-- src/librustdoc/clean/mod.rs | 12 ++++---- 55 files changed, 191 insertions(+), 187 deletions(-) diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 705d9c4cf93e..3dace2f2e89b 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -56,7 +56,7 @@ use crate::hir::Node; use crate::middle::region; use crate::traits::{ObligationCause, ObligationCauseCode}; use crate::ty::error::TypeError; -use crate::ty::{self, subst::Subst, Region, Ty, TyCtxt, TyKind, TypeFoldable}; +use crate::ty::{self, subst::{Subst, SubstsRef}, Region, Ty, TyCtxt, TyKind, TypeFoldable}; use errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString}; use std::{cmp, fmt}; use syntax_pos::{Pos, Span}; @@ -570,7 +570,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { value: &mut DiagnosticStyledString, other_value: &mut DiagnosticStyledString, name: String, - sub: &ty::subst::Substs<'tcx>, + sub: ty::subst::SubstsRef<'tcx>, pos: usize, other_ty: &Ty<'tcx>, ) { @@ -648,7 +648,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { mut t1_out: &mut DiagnosticStyledString, mut t2_out: &mut DiagnosticStyledString, path: String, - sub: &ty::subst::Substs<'tcx>, + sub: ty::subst::SubstsRef<'tcx>, other_path: String, other_ty: &Ty<'tcx>, ) -> Option<()> { @@ -687,8 +687,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { fn strip_generic_default_params( &self, def_id: DefId, - substs: &ty::subst::Substs<'tcx>, - ) -> &'tcx ty::subst::Substs<'tcx> { + substs: ty::subst::SubstsRef<'tcx>, + ) -> SubstsRef<'tcx> { let generics = self.tcx.generics_of(def_id); let mut num_supplied_defaults = 0; let mut type_params = generics diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index a02918a49394..84ad742d3c97 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -18,7 +18,7 @@ use crate::traits::{self, ObligationCause, PredicateObligations, TraitEngine}; use crate::ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric}; use crate::ty::fold::TypeFoldable; use crate::ty::relate::RelateResult; -use crate::ty::subst::{Kind, Substs, SubstsRef}; +use crate::ty::subst::{Kind, InternalSubsts, SubstsRef}; use crate::ty::{self, GenericParamDefKind, Ty, TyCtxt, CtxtInterners}; use crate::ty::{FloatVid, IntVid, TyVid}; use crate::util::nodemap::FxHashMap; @@ -1089,7 +1089,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// Given a set of generics defined on a type or impl, returns a substitution mapping each /// type/region parameter to a fresh inference variable. pub fn fresh_substs_for_item(&self, span: Span, def_id: DefId) -> SubstsRef<'tcx> { - Substs::for_item(self.tcx, def_id, |param, _| self.var_for_def(span, param)) + InternalSubsts::for_item(self.tcx, def_id, |param, _| self.var_for_def(span, param)) } /// Returns `true` if errors have been reported since this infcx was diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index 079c2a12a847..159bc1ceae26 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -9,7 +9,7 @@ use crate::traits::{self, PredicateObligation}; use crate::ty::{self, Ty, TyCtxt, GenericParamDefKind}; use crate::ty::fold::{BottomUpFolder, TypeFoldable, TypeFolder}; use crate::ty::outlives::Component; -use crate::ty::subst::{Kind, Substs, SubstsRef, UnpackedKind}; +use crate::ty::subst::{Kind, InternalSubsts, SubstsRef, UnpackedKind}; use crate::util::nodemap::DefIdMap; pub type OpaqueTypeMap<'tcx> = DefIdMap>; @@ -437,7 +437,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // lifetimes with 'static and remapping only those used in the // `impl Trait` return type, resulting in the parameters // shifting. - let id_substs = Substs::identity_for_item(gcx, def_id); + let id_substs = InternalSubsts::identity_for_item(gcx, def_id); let map: FxHashMap, Kind<'gcx>> = opaque_defn .substs .iter() diff --git a/src/librustc/infer/outlives/verify.rs b/src/librustc/infer/outlives/verify.rs index 494f708c6a7b..e1ad5aeea19f 100644 --- a/src/librustc/infer/outlives/verify.rs +++ b/src/librustc/infer/outlives/verify.rs @@ -2,7 +2,7 @@ use crate::hir::def_id::DefId; use crate::infer::outlives::env::RegionBoundPairs; use crate::infer::{GenericKind, VerifyBound}; use crate::traits; -use crate::ty::subst::{Subst, Substs}; +use crate::ty::subst::{Subst, InternalSubsts}; use crate::ty::{self, Ty, TyCtxt}; use crate::util::captures::Captures; @@ -292,7 +292,7 @@ impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> { .iter() .map(|(p, _)| *p) .collect(); - let identity_substs = Substs::identity_for_item(tcx, assoc_item_def_id); + let identity_substs = InternalSubsts::identity_for_item(tcx, assoc_item_def_id); let identity_proj = tcx.mk_projection(assoc_item_def_id, identity_substs); self.collect_outlives_from_predicate_list( move |ty| ty == identity_proj, diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index 60a3777abf84..e93351197fe4 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -631,7 +631,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { finished_map } - fn is_param_no_infer(&self, substs: &Substs<'_>) -> bool { + fn is_param_no_infer(&self, substs: SubstsRef<'_>) -> bool { return self.is_of_param(substs.type_at(0)) && !substs.types().any(|t| t.has_infer_types()); } diff --git a/src/librustc/traits/codegen/mod.rs b/src/librustc/traits/codegen/mod.rs index d6b7b3b99cac..9b0a3820c859 100644 --- a/src/librustc/traits/codegen/mod.rs +++ b/src/librustc/traits/codegen/mod.rs @@ -11,7 +11,7 @@ use syntax_pos::Span; use crate::traits::{FulfillmentContext, Obligation, ObligationCause, SelectionContext, TraitEngine, Vtable}; use crate::ty::{self, Ty, TyCtxt}; -use crate::ty::subst::{Subst, Substs}; +use crate::ty::subst::{Subst, SubstsRef}; use crate::ty::fold::TypeFoldable; /// Attempts to resolve an obligation to a vtable. The result is @@ -82,7 +82,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { /// types. pub fn subst_and_normalize_erasing_regions( self, - param_substs: &Substs<'tcx>, + param_substs: SubstsRef<'tcx>, param_env: ty::ParamEnv<'tcx>, value: &T ) -> T diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index 64ac874e8f1d..ee7893a27de7 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -29,7 +29,7 @@ use crate::mir::interpret::ErrorHandled; use rustc_data_structures::sync::Lrc; use syntax::ast; use syntax_pos::{Span, DUMMY_SP}; -use crate::ty::subst::{Substs, SubstsRef}; +use crate::ty::subst::{InternalSubsts, SubstsRef}; use crate::ty::{self, AdtKind, List, Ty, TyCtxt, GenericParamDefKind, ToPredicate}; use crate::ty::error::{ExpectedFound, TypeError}; use crate::ty::fold::{TypeFolder, TypeFoldable, TypeVisitor}; @@ -992,7 +992,7 @@ fn vtable_methods<'a, 'tcx>( let trait_methods = tcx.associated_items(trait_ref.def_id()) .filter(|item| item.kind == ty::AssociatedKind::Method); - // Now list each method's DefId and Substs (for within its trait). + // Now list each method's DefId and InternalSubsts (for within its trait). // If the method can never be called from this object, produce None. trait_methods.map(move |trait_method| { debug!("vtable_methods: trait_method={:?}", trait_method); @@ -1007,7 +1007,7 @@ fn vtable_methods<'a, 'tcx>( // the method may have some early-bound lifetimes, add // regions for those let substs = trait_ref.map_bound(|trait_ref| - Substs::for_item(tcx, def_id, |param, _| + InternalSubsts::for_item(tcx, def_id, |param, _| match param.kind { GenericParamDefKind::Lifetime => tcx.types.re_erased.into(), GenericParamDefKind::Type {..} => { diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 5c24b0ebfe05..b2079c251693 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -15,7 +15,7 @@ use crate::hir::def_id::DefId; use crate::lint; use crate::traits::{self, Obligation, ObligationCause}; use crate::ty::{self, Ty, TyCtxt, TypeFoldable, Predicate, ToPredicate}; -use crate::ty::subst::{Subst, Substs}; +use crate::ty::subst::{Subst, InternalSubsts}; use std::borrow::Cow; use std::iter::{self}; use syntax::ast::{self, Name}; @@ -406,7 +406,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { self, receiver_ty: Ty<'tcx>, self_ty: Ty<'tcx>, method_def_id: DefId ) -> Ty<'tcx> { debug!("receiver_for_self_ty({:?}, {:?}, {:?})", receiver_ty, self_ty, method_def_id); - let substs = Substs::for_item(self, method_def_id, |param, _| { + let substs = InternalSubsts::for_item(self, method_def_id, |param, _| { if param.index == 0 { self_ty.into() } else { @@ -559,13 +559,17 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { // U: Trait let trait_predicate = { - let substs = Substs::for_item(self, method.container.assert_trait(), |param, _| { - if param.index == 0 { - unsized_self_ty.into() - } else { - self.mk_param_from_def(param) - } - }); + let substs = InternalSubsts::for_item( + self, + method.container.assert_trait(), + |param, _| { + if param.index == 0 { + unsized_self_ty.into() + } else { + self.mk_param_from_def(param) + } + }, + ); ty::TraitRef { def_id: unsize_did, diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index 05141c9daf1d..72df12bc535a 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -18,7 +18,7 @@ use crate::infer::type_variable::TypeVariableOrigin; use crate::mir::interpret::{GlobalId}; use rustc_data_structures::snapshot_map::{Snapshot, SnapshotMap}; use syntax::ast::Ident; -use crate::ty::subst::{Subst, Substs}; +use crate::ty::subst::{Subst, InternalSubsts}; use crate::ty::{self, ToPredicate, ToPolyTraitRef, Ty, TyCtxt}; use crate::ty::fold::{TypeFoldable, TypeFolder}; use crate::util::common::FN_OUTPUT_NAME; @@ -401,7 +401,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssociatedTypeNormalizer<'a, let tcx = self.selcx.tcx().global_tcx(); if let Some(param_env) = self.tcx().lift_to_global(&self.param_env) { if substs.needs_infer() || substs.has_placeholders() { - let identity_substs = Substs::identity_for_item(tcx, def_id); + let identity_substs = InternalSubsts::identity_for_item(tcx, def_id); let instance = ty::Instance::resolve(tcx, param_env, def_id, identity_substs); if let Some(instance) = instance { let cid = GlobalId { @@ -1490,7 +1490,7 @@ fn confirm_impl_candidate<'cx, 'gcx, 'tcx>( } let substs = translate_substs(selcx.infcx(), param_env, impl_def_id, substs, assoc_ty.node); let ty = if let ty::AssociatedKind::Existential = assoc_ty.item.kind { - let item_substs = Substs::identity_for_item(tcx, assoc_ty.item.def_id); + let item_substs = InternalSubsts::identity_for_item(tcx, assoc_ty.item.def_id); tcx.mk_opaque(assoc_ty.item.def_id, item_substs) } else { tcx.type_of(assoc_ty.item.def_id) diff --git a/src/librustc/traits/query/normalize.rs b/src/librustc/traits/query/normalize.rs index 224076ce17e7..8a30c18d6e5f 100644 --- a/src/librustc/traits/query/normalize.rs +++ b/src/librustc/traits/query/normalize.rs @@ -9,7 +9,7 @@ use crate::mir::interpret::GlobalId; use crate::traits::project::Normalized; use crate::traits::{Obligation, ObligationCause, PredicateObligation, Reveal}; use crate::ty::fold::{TypeFoldable, TypeFolder}; -use crate::ty::subst::{Subst, Substs}; +use crate::ty::subst::{Subst, InternalSubsts}; use crate::ty::{self, Ty, TyCtxt}; use super::NoSolution; @@ -193,7 +193,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx let tcx = self.infcx.tcx.global_tcx(); if let Some(param_env) = self.tcx().lift_to_global(&self.param_env) { if substs.needs_infer() || substs.has_placeholders() { - let identity_substs = Substs::identity_for_item(tcx, def_id); + let identity_substs = InternalSubsts::identity_for_item(tcx, def_id); let instance = ty::Instance::resolve(tcx, param_env, def_id, identity_substs); if let Some(instance) = instance { let cid = GlobalId { diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 320b591ddcf7..e85b84bce432 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -34,7 +34,7 @@ use crate::middle::lang_items; use crate::mir::interpret::GlobalId; use crate::ty::fast_reject; use crate::ty::relate::TypeRelation; -use crate::ty::subst::{Subst, Substs, SubstsRef}; +use crate::ty::subst::{Subst, SubstsRef}; use crate::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable}; use crate::hir; @@ -3761,7 +3761,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { recursion_depth: usize, param_env: ty::ParamEnv<'tcx>, def_id: DefId, // of impl or trait - substs: &Substs<'tcx>, // for impl or trait + substs: SubstsRef<'tcx>, // for impl or trait ) -> Vec> { debug!("impl_or_trait_obligations(def_id={:?})", def_id); let tcx = self.tcx(); diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index 9a760065cb1f..1d84f22acd9f 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -20,7 +20,7 @@ use rustc_data_structures::sync::Lrc; use syntax_pos::DUMMY_SP; use crate::traits::select::IntercrateAmbiguityCause; use crate::ty::{self, TyCtxt, TypeFoldable}; -use crate::ty::subst::{Subst, Substs, SubstsRef}; +use crate::ty::subst::{Subst, InternalSubsts, SubstsRef}; use super::{SelectionContext, FulfillmentContext}; use super::util::impl_trait_ref_and_oblig; @@ -399,7 +399,7 @@ fn to_pretty_impl_header(tcx: TyCtxt<'_, '_, '_>, impl_def_id: DefId) -> Option< let mut w = "impl".to_owned(); - let substs = Substs::identity_for_item(tcx, impl_def_id); + let substs = InternalSubsts::identity_for_item(tcx, impl_def_id); // FIXME: Currently only handles ?Sized. // Needs to support ?Move and ?DynSized when they are implemented. diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index 754cc94073b1..c3223f0cd633 100644 --- a/src/librustc/traits/util.rs +++ b/src/librustc/traits/util.rs @@ -3,7 +3,7 @@ use crate::hir::def_id::DefId; use crate::traits::specialize::specialization_graph::NodeItem; use crate::ty::{self, Ty, TyCtxt, ToPredicate, ToPolyTraitRef}; use crate::ty::outlives::Component; -use crate::ty::subst::{Kind, Subst, Substs}; +use crate::ty::subst::{Kind, Subst, SubstsRef}; use crate::util::nodemap::FxHashSet; use super::{Obligation, ObligationCause, PredicateObligation, SelectionContext, Normalized}; @@ -358,7 +358,7 @@ impl<'tcx, I: Iterator>> Iterator for FilterToTraits< pub fn impl_trait_ref_and_oblig<'a, 'gcx, 'tcx>(selcx: &mut SelectionContext<'a, 'gcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, impl_def_id: DefId, - impl_substs: &Substs<'tcx>) + impl_substs: SubstsRef<'tcx>,) -> (ty::TraitRef<'tcx>, Vec>) { diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 68f21ce10788..b37b632f4bee 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -22,7 +22,7 @@ use crate::middle::resolve_lifetime::{self, ObjectLifetimeDefault}; use crate::middle::stability; use crate::mir::{self, Mir, interpret, ProjectionKind}; use crate::mir::interpret::Allocation; -use crate::ty::subst::{Kind, Substs, Subst, SubstsRef}; +use crate::ty::subst::{Kind, InternalSubsts, Subst, SubstsRef}; use crate::ty::ReprOptions; use crate::traits; use crate::traits::{Clause, Clauses, GoalKind, Goal, Goals}; @@ -118,7 +118,7 @@ pub struct CtxtInterners<'tcx> { /// they're accessed quite often. type_: InternedSet<'tcx, TyS<'tcx>>, type_list: InternedSet<'tcx, List>>, - substs: InternedSet<'tcx, Substs<'tcx>>, + substs: InternedSet<'tcx, InternalSubsts<'tcx>>, canonical_var_infos: InternedSet<'tcx, List>, region: InternedSet<'tcx, RegionKind>, existential_predicates: InternedSet<'tcx, List>>, @@ -557,7 +557,7 @@ impl<'tcx> TypeckTables<'tcx> { pub fn node_substs(&self, id: hir::HirId) -> SubstsRef<'tcx> { validate_hir_id_for_typeck_tables(self.local_id_root, id, false); - self.node_substs.get(&id.local_id).cloned().unwrap_or_else(|| Substs::empty()) + self.node_substs.get(&id.local_id).cloned().unwrap_or_else(|| InternalSubsts::empty()) } pub fn node_substs_opt(&self, id: hir::HirId) -> Option> { @@ -1807,7 +1807,7 @@ nop_list_lift!{Predicate<'a> => Predicate<'tcx>} nop_list_lift!{CanonicalVarInfo => CanonicalVarInfo} nop_list_lift!{ProjectionKind<'a> => ProjectionKind<'tcx>} -// this is the impl for `&'a Substs<'a>` +// this is the impl for `&'a InternalSubsts<'a>` nop_list_lift!{Kind<'a> => Kind<'tcx>} impl<'a, 'tcx> Lift<'tcx> for &'a mir::interpret::Allocation { @@ -2183,7 +2183,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { Generator, GeneratorWitness, Dynamic, Closure, Tuple, Bound, Param, Infer, UnnormalizedProjection, Projection, Opaque, Foreign); - println!("Substs interner: #{}", self.interners.substs.borrow().len()); + println!("InternalSubsts interner: #{}", self.interners.substs.borrow().len()); println!("Region interner: #{}", self.interners.region.borrow().len()); println!("Stability interner: #{}", self.stability_interner.borrow().len()); println!("Allocation interner: #{}", self.allocation_interner.borrow().len()); @@ -2250,7 +2250,7 @@ impl<'tcx: 'lcx, 'lcx> Borrow<[CanonicalVarInfo]> for Interned<'tcx, List Borrow<[Kind<'lcx>]> for Interned<'tcx, Substs<'tcx>> { +impl<'tcx: 'lcx, 'lcx> Borrow<[Kind<'lcx>]> for Interned<'tcx, InternalSubsts<'tcx>> { fn borrow<'a>(&'a self) -> &'a [Kind<'lcx>] { &self.0[..] } @@ -2520,7 +2520,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn mk_box(self, ty: Ty<'tcx>) -> Ty<'tcx> { let def_id = self.require_lang_item(lang_items::OwnedBoxLangItem); let adt_def = self.adt_def(def_id); - let substs = Substs::for_item(self, def_id, |param, substs| { + let substs = InternalSubsts::for_item(self, def_id, |param, substs| { match param.kind { GenericParamDefKind::Lifetime => bug!(), GenericParamDefKind::Type { has_default, .. } => { diff --git a/src/librustc/ty/flags.rs b/src/librustc/ty/flags.rs index 25ec3e49cdf6..2b12dcca93ad 100644 --- a/src/librustc/ty/flags.rs +++ b/src/librustc/ty/flags.rs @@ -1,4 +1,4 @@ -use crate::ty::subst::Substs; +use crate::ty::subst::SubstsRef; use crate::ty::{self, Ty, TypeFlags, TypeFoldable}; #[derive(Debug)] @@ -241,7 +241,7 @@ impl FlagComputation { self.add_substs(projection_ty.substs); } - fn add_substs(&mut self, substs: &Substs<'_>) { + fn add_substs(&mut self, substs: SubstsRef<'_>) { for ty in substs.types() { self.add_ty(ty); } diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index e098488824f3..5243c4dbfd20 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -22,7 +22,7 @@ use crate::session::CrateDisambiguator; use crate::traits::{self, Reveal}; use crate::ty; use crate::ty::layout::VariantIdx; -use crate::ty::subst::{Subst, Substs, SubstsRef}; +use crate::ty::subst::{Subst, InternalSubsts, SubstsRef}; use crate::ty::util::{IntTypeExt, Discr}; use crate::ty::walk::TypeWalker; use crate::util::captures::Captures; @@ -982,14 +982,14 @@ impl<'tcx> serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {} impl<'tcx> serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {} impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> { - pub fn instantiate(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, substs: &Substs<'tcx>) + pub fn instantiate(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, substs: SubstsRef<'tcx>) -> InstantiatedPredicates<'tcx> { let mut instantiated = InstantiatedPredicates::empty(); self.instantiate_into(tcx, &mut instantiated, substs); instantiated } - pub fn instantiate_own(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, substs: &Substs<'tcx>) + pub fn instantiate_own(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, substs: SubstsRef<'tcx>) -> InstantiatedPredicates<'tcx> { InstantiatedPredicates { predicates: self.predicates.iter().map(|(p, _)| p.subst(tcx, substs)).collect(), @@ -998,7 +998,7 @@ impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> { fn instantiate_into(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, instantiated: &mut InstantiatedPredicates<'tcx>, - substs: &Substs<'tcx>) { + substs: SubstsRef<'tcx>) { if let Some(def_id) = self.parent { tcx.predicates_of(def_id).instantiate_into(tcx, instantiated, substs); } @@ -2261,7 +2261,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { ) -> Option> { let param_env = ParamEnv::empty(); let repr_type = self.repr.discr_type(); - let substs = Substs::identity_for_item(tcx.global_tcx(), expr_did); + let substs = InternalSubsts::identity_for_item(tcx.global_tcx(), expr_did); let instance = ty::Instance::new(expr_did, substs); let cid = GlobalId { instance, @@ -2463,7 +2463,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { } impl<'a, 'gcx, 'tcx> FieldDef { - pub fn ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, subst: &Substs<'tcx>) -> Ty<'tcx> { + pub fn ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> { tcx.type_of(self.did).subst(tcx, subst) } } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 31399fbab0a3..df8b14b1f10c 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -7,7 +7,7 @@ use crate::mir::interpret::{ConstValue, truncate}; use crate::middle::region; use polonius_engine::Atom; use rustc_data_structures::indexed_vec::Idx; -use crate::ty::subst::{Substs, Subst, SubstsRef, Kind, UnpackedKind}; +use crate::ty::subst::{InternalSubsts, Subst, SubstsRef, Kind, UnpackedKind}; use crate::ty::{self, AdtDef, TypeFlags, Ty, TyCtxt, TypeFoldable}; use crate::ty::{List, TyS, ParamEnvAnd, ParamEnv}; use crate::util::captures::Captures; @@ -101,7 +101,7 @@ pub enum TyKind<'tcx> { /// Structures, enumerations and unions. /// - /// Substs here, possibly against intuition, *may* contain `Param`s. + /// InternalSubsts here, possibly against intuition, *may* contain `Param`s. /// That is, even after substitution it is possible that there are type /// variables. This happens when the `Adt` corresponds to an ADT /// definition and not a concrete use of it. @@ -685,7 +685,7 @@ impl<'tcx> TraitRef<'tcx> { pub fn identity<'a, 'gcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId) -> TraitRef<'tcx> { TraitRef { def_id, - substs: Substs::identity_for_item(tcx, def_id), + substs: InternalSubsts::identity_for_item(tcx, def_id), } } @@ -704,7 +704,7 @@ impl<'tcx> TraitRef<'tcx> { pub fn from_method(tcx: TyCtxt<'_, '_, 'tcx>, trait_id: DefId, - substs: &Substs<'tcx>) + substs: SubstsRef<'tcx>) -> ty::TraitRef<'tcx> { let defs = tcx.generics_of(trait_id); @@ -1120,7 +1120,7 @@ pub type Region<'tcx> = &'tcx RegionKind; /// These are regions that are stored behind a binder and must be substituted /// with some concrete region before being used. There are two kind of /// bound regions: early-bound, which are bound in an item's `Generics`, -/// and are substituted by a `Substs`, and late-bound, which are part of +/// and are substituted by a `InternalSubsts`, and late-bound, which are part of /// higher-ranked types (e.g., `for<'a> fn(&'a ())`), and are substituted by /// the likes of `liberate_late_bound_regions`. The distinction exists /// because higher-ranked lifetimes aren't supported in all places. See [1][2]. diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 0e033b116a2a..450fab81661f 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -157,20 +157,20 @@ impl<'tcx> Decodable for Kind<'tcx> { } /// A substitution mapping generic parameters to new values. -pub type Substs<'tcx> = List>; +pub type InternalSubsts<'tcx> = List>; -pub type SubstsRef<'tcx> = &'tcx Substs<'tcx>; +pub type SubstsRef<'tcx> = &'tcx InternalSubsts<'tcx>; -impl<'a, 'gcx, 'tcx> Substs<'tcx> { - /// Creates a `Substs` that maps each generic parameter to itself. +impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { + /// Creates a `InternalSubsts` that maps each generic parameter to itself. pub fn identity_for_item(tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId) -> SubstsRef<'tcx> { - Substs::for_item(tcx, def_id, |param, _| { + Self::for_item(tcx, def_id, |param, _| { tcx.mk_param_from_def(param) }) } - /// Creates a `Substs` that maps each generic parameter to a higher-ranked + /// Creates a `InternalSubsts` that maps each generic parameter to a higher-ranked /// var bound at index `0`. For types, we use a `BoundVar` index equal to /// the type parameter index. For regions, we use the `BoundRegion::BrNamed` /// variant (which has a `DefId`). @@ -178,7 +178,7 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> { tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId ) -> SubstsRef<'tcx> { - Substs::for_item(tcx, def_id, |param, _| { + Self::for_item(tcx, def_id, |param, _| { match param.kind { ty::GenericParamDefKind::Type { .. } => { tcx.mk_ty( @@ -199,9 +199,9 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> { }) } - /// Creates a `Substs` for generic parameter definitions, + /// Creates a `InternalSubsts` for generic parameter definitions, /// by calling closures to obtain each kind. - /// The closures get to observe the `Substs` as they're + /// The closures get to observe the `InternalSubsts` as they're /// being built, which can be used to correctly /// substitute defaults of generic parameters. pub fn for_item(tcx: TyCtxt<'a, 'gcx, 'tcx>, @@ -213,7 +213,7 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> { let defs = tcx.generics_of(def_id); let count = defs.count(); let mut substs = SmallVec::with_capacity(count); - Substs::fill_item(&mut substs, tcx, defs, &mut mk_kind); + Self::fill_item(&mut substs, tcx, defs, &mut mk_kind); tcx.intern_substs(&substs) } @@ -224,7 +224,7 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> { -> SubstsRef<'tcx> where F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx> { - Substs::for_item(tcx, def_id, |param, substs| { + Self::for_item(tcx, def_id, |param, substs| { self.get(param.index as usize) .cloned() .unwrap_or_else(|| mk_kind(param, substs)) @@ -239,9 +239,9 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> { { if let Some(def_id) = defs.parent { let parent_defs = tcx.generics_of(def_id); - Substs::fill_item(substs, tcx, parent_defs, mk_kind); + Self::fill_item(substs, tcx, parent_defs, mk_kind); } - Substs::fill_single(substs, defs, mk_kind) + Self::fill_single(substs, defs, mk_kind) } fn fill_single(substs: &mut SmallVec<[Kind<'tcx>; 8]>, @@ -313,7 +313,7 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> { /// parameters (e.g., method parameters) on top of that base. pub fn rebase_onto(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, source_ancestor: DefId, - target_substs: &Substs<'tcx>) + target_substs: SubstsRef<'tcx>) -> SubstsRef<'tcx> { let defs = tcx.generics_of(source_ancestor); tcx.mk_substs(target_substs.iter().chain(&self[defs.params.len()..]).cloned()) diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index a7b080724925..7374eba2e317 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -7,7 +7,7 @@ use crate::hir::{self, Node}; use crate::ich::NodeIdHashingMode; use crate::traits::{self, ObligationCause}; use crate::ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable}; -use crate::ty::subst::{Subst, Substs, SubstsRef, UnpackedKind}; +use crate::ty::subst::{Subst, InternalSubsts, SubstsRef, UnpackedKind}; use crate::ty::query::TyCtxtAt; use crate::ty::TyKind::*; use crate::ty::layout::{Integer, IntegerExt}; @@ -589,7 +589,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// Given the `DefId` of some item that has no type parameters, make /// a suitable "empty substs" for it. pub fn empty_substs_for_def_id(self, item_def_id: DefId) -> SubstsRef<'tcx> { - Substs::for_item(self, item_def_id, |param, _| { + InternalSubsts::for_item(self, item_def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => self.types.re_erased.into(), GenericParamDefKind::Type {..} => { diff --git a/src/librustc/ty/walk.rs b/src/librustc/ty/walk.rs index 126f5290af51..d9f309ae58e0 100644 --- a/src/librustc/ty/walk.rs +++ b/src/librustc/ty/walk.rs @@ -99,7 +99,7 @@ fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) { (p.substs, Some(p.ty)), ty::ExistentialPredicate::AutoTrait(_) => // Empty iterator - (ty::Substs::empty(), None), + (ty::InternalSubsts::empty(), None), }; substs.types().rev().chain(opt_ty) diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index 282bf1219fa5..599d38bc4ab6 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -1,7 +1,7 @@ use crate::hir; use crate::hir::def_id::DefId; use crate::infer::InferCtxt; -use crate::ty::subst::Substs; +use crate::ty::subst::SubstsRef; use crate::traits; use crate::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable}; use std::iter::once; @@ -432,7 +432,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { fn nominal_obligations(&mut self, def_id: DefId, - substs: &Substs<'tcx>) + substs: SubstsRef<'tcx>) -> Vec> { let predicates = diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 768fd02e8238..fbe9e3359bfe 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -1,7 +1,7 @@ use crate::hir::def_id::DefId; use crate::hir::map::definitions::DefPathData; use crate::middle::region; -use crate::ty::subst::{self, Subst}; +use crate::ty::subst::{self, Subst, SubstsRef}; use crate::ty::{BrAnon, BrEnv, BrFresh, BrNamed}; use crate::ty::{Bool, Char, Adt}; use crate::ty::{Error, Str, Array, Slice, Float, FnDef, FnPtr}; @@ -384,7 +384,7 @@ impl PrintContext { fn parameterized(&mut self, f: &mut F, - substs: &subst::Substs<'_>, + substs: SubstsRef<'_>, did: DefId, projections: &[ty::ProjectionPredicate<'_>]) -> fmt::Result { @@ -692,7 +692,7 @@ pub fn identify_regions() -> bool { } pub fn parameterized(f: &mut F, - substs: &subst::Substs<'_>, + substs: SubstsRef<'_>, did: DefId, projections: &[ty::ProjectionPredicate<'_>]) -> fmt::Result { @@ -1290,7 +1290,7 @@ define_print! { Ok(()) } } - Foreign(def_id) => parameterized(f, subst::Substs::empty(), def_id, &[]), + Foreign(def_id) => parameterized(f, subst::InternalSubsts::empty(), def_id, &[]), Projection(ref data) => data.print(f, cx), UnnormalizedProjection(ref data) => { write!(f, "Unnormalized(")?; diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index ae6e16b31e7a..c0869bb889af 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -15,7 +15,7 @@ use crate::llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilder, DISubprogram, D DISPFlags, DILexicalBlock}; use rustc::hir::CodegenFnAttrFlags; use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE}; -use rustc::ty::subst::{Substs, UnpackedKind}; +use rustc::ty::subst::{SubstsRef, UnpackedKind}; use crate::abi::Abi; use crate::common::CodegenCx; @@ -399,7 +399,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { fn get_template_parameters<'ll, 'tcx>( cx: &CodegenCx<'ll, 'tcx>, generics: &ty::Generics, - substs: &Substs<'tcx>, + substs: SubstsRef<'tcx>, file_metadata: &'ll DIFile, name_to_append_suffix_to: &mut String, ) -> &'ll DIArray { diff --git a/src/librustc_codegen_llvm/debuginfo/type_names.rs b/src/librustc_codegen_llvm/debuginfo/type_names.rs index 32e930ac44c8..176c9b8c542b 100644 --- a/src/librustc_codegen_llvm/debuginfo/type_names.rs +++ b/src/librustc_codegen_llvm/debuginfo/type_names.rs @@ -2,7 +2,7 @@ use crate::common::CodegenCx; use rustc::hir::def_id::DefId; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty}; use rustc_codegen_ssa::traits::*; @@ -193,13 +193,13 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, } } - // Pushes the type parameters in the given `Substs` to the output string. + // Pushes the type parameters in the given `InternalSubsts` to the output string. // This ignores region parameters, since they can't reliably be // reconstructed for items from non-local crates. For local crates, this // would be possible but with inlining and LTO we have to use the least // common denominator - otherwise we would run into conflicts. fn push_type_params<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, - substs: &Substs<'tcx>, + substs: SubstsRef<'tcx>, output: &mut String) { if substs.types().next().is_none() { return; diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs index cbeb5dc206ee..785f810d9415 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs @@ -14,7 +14,7 @@ use rustc::mir::{ ClosureOutlivesRequirement, ClosureOutlivesSubject, ClosureRegionRequirements, ConstraintCategory, Local, Location, Mir, }; -use rustc::ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable}; +use rustc::ty::{self, subst::SubstsRef, RegionVid, Ty, TyCtxt, TypeFoldable}; use rustc::util::common::{self, ErrorReported}; use rustc_data_structures::bit_set::BitSet; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; @@ -1359,7 +1359,7 @@ pub trait ClosureRegionRequirementsExt<'gcx, 'tcx> { tcx: TyCtxt<'_, 'gcx, 'tcx>, location: Location, closure_def_id: DefId, - closure_substs: &'tcx ty::subst::Substs<'tcx>, + closure_substs: SubstsRef<'tcx>, ) -> Vec>; fn subst_closure_mapping( @@ -1390,7 +1390,7 @@ impl<'gcx, 'tcx> ClosureRegionRequirementsExt<'gcx, 'tcx> for ClosureRegionRequi tcx: TyCtxt<'_, 'gcx, 'tcx>, location: Location, closure_def_id: DefId, - closure_substs: &'tcx ty::subst::Substs<'tcx>, + closure_substs: SubstsRef<'tcx>, ) -> Vec> { debug!( "apply_requirements(location={:?}, closure_def_id={:?}, closure_substs={:?})", diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs index b418d608f080..4d9a3775b312 100644 --- a/src/librustc_mir/borrow_check/nll/universal_regions.rs +++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs @@ -17,7 +17,7 @@ use rustc::hir::def_id::DefId; use rustc::hir::{self, BodyOwnerKind, HirId}; use rustc::infer::{InferCtxt, NLLRegionVariableOrigin}; use rustc::ty::fold::TypeFoldable; -use rustc::ty::subst::{Substs, SubstsRef}; +use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, RegionVid, Ty, TyCtxt}; use rustc::util::nodemap::FxHashMap; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; @@ -138,7 +138,7 @@ struct UniversalRegionIndices<'tcx> { /// used because trait matching and type-checking will feed us /// region constraints that reference those regions and we need to /// be able to map them our internal `RegionVid`. This is - /// basically equivalent to a `Substs`, except that it also + /// basically equivalent to a `InternalSubsts`, except that it also /// contains an entry for `ReStatic` -- it might be nice to just /// use a substs, and then handle `ReStatic` another way. indices: FxHashMap, RegionVid>, @@ -507,7 +507,7 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> { BodyOwnerKind::Const | BodyOwnerKind::Static(..) => { assert_eq!(closure_base_def_id, self.mir_def_id); - let identity_substs = Substs::identity_for_item(tcx, closure_base_def_id); + let identity_substs = InternalSubsts::identity_for_item(tcx, closure_base_def_id); let substs = self.infcx .replace_free_regions_with_nll_infer_vars(FR, &identity_substs); DefiningTy::Const(self.mir_def_id, substs) @@ -527,7 +527,7 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> { let tcx = self.infcx.tcx; let gcx = tcx.global_tcx(); let closure_base_def_id = tcx.closure_base_def_id(self.mir_def_id); - let identity_substs = Substs::identity_for_item(gcx, closure_base_def_id); + let identity_substs = InternalSubsts::identity_for_item(gcx, closure_base_def_id); let fr_substs = match defining_ty { DefiningTy::Closure(_, ClosureSubsts { ref substs }) | DefiningTy::Generator(_, GeneratorSubsts { ref substs }, _) => { diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index c32a4fc3820f..5548366db66e 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -9,7 +9,7 @@ use rustc::mir::interpret::{GlobalId, ErrorHandled}; use rustc::ty::{self, AdtKind, Ty}; use rustc::ty::adjustment::{Adjustment, Adjust, AutoBorrow, AutoBorrowMutability}; use rustc::ty::cast::CastKind as TyCastKind; -use rustc::ty::subst::{Substs, SubstsRef}; +use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::hir; use rustc::hir::def_id::LocalDefId; use rustc::mir::BorrowKind; @@ -561,7 +561,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, // Now comes the rote stuff: hir::ExprKind::Repeat(ref v, ref count) => { let def_id = cx.tcx.hir().local_def_id(count.id); - let substs = Substs::identity_for_item(cx.tcx.global_tcx(), def_id); + let substs = InternalSubsts::identity_for_item(cx.tcx.global_tcx(), def_id); let instance = ty::Instance::resolve( cx.tcx.global_tcx(), cx.param_env, @@ -717,7 +717,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, Some(did) => { // in case we are offsetting from a computed discriminant // and not the beginning of discriminants (which is always `0`) - let substs = Substs::identity_for_item(cx.tcx(), did); + let substs = InternalSubsts::identity_for_item(cx.tcx(), did); let lhs = mk_const(ty::LazyConst::Unevaluated(did, substs)); let bin = ExprKind::Binary { op: BinOp::Add, diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index 9e19badf49db..70f04fb89286 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -12,7 +12,7 @@ use rustc::middle::region; use rustc::infer::InferCtxt; use rustc::ty::subst::Subst; use rustc::ty::{self, Ty, TyCtxt}; -use rustc::ty::subst::{Kind, Substs}; +use rustc::ty::subst::{Kind, InternalSubsts}; use rustc::ty::layout::VariantIdx; use syntax::ast; use syntax::attr; @@ -29,8 +29,8 @@ pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { pub root_lint_level: hir::HirId, pub param_env: ty::ParamEnv<'gcx>, - /// Identity `Substs` for use with const-evaluation. - pub identity_substs: &'gcx Substs<'gcx>, + /// Identity `InternalSubsts` for use with const-evaluation. + pub identity_substs: &'gcx InternalSubsts<'gcx>, pub region_scope_tree: Lrc, pub tables: &'a ty::TypeckTables<'gcx>, @@ -82,7 +82,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { infcx, root_lint_level: lint_level, param_env: tcx.param_env(src_def_id), - identity_substs: Substs::identity_for_item(tcx.global_tcx(), src_def_id), + identity_substs: InternalSubsts::identity_for_item(tcx.global_tcx(), src_def_id), region_scope_tree: tcx.region_scope_tree(src_def_id), tables: tcx.typeck_tables_of(src_def_id), constness, diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 10bef53e249c..9e9a5d0f82ad 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -168,7 +168,7 @@ use super::{PatternFoldable, PatternFolder, compare_const_vals}; use rustc::hir::def_id::DefId; use rustc::hir::RangeEnd; -use rustc::ty::{self, Ty, TyCtxt, TypeFoldable, Const}; +use rustc::ty::{self, subst::SubstsRef, Ty, TyCtxt, TypeFoldable, Const}; use rustc::ty::layout::{Integer, IntegerExt, VariantIdx, Size}; use rustc::mir::Field; @@ -402,7 +402,7 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { fn is_variant_uninhabited(&self, variant: &'tcx ty::VariantDef, - substs: &'tcx ty::subst::Substs<'tcx>) + substs: SubstsRef<'tcx>) -> bool { if self.tcx.features().exhaustive_patterns { diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 085ac67cfb74..9cecf4af7d44 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -11,7 +11,7 @@ use rustc::middle::mem_categorization::cmt_; use rustc::middle::region; use rustc::session::Session; use rustc::ty::{self, Ty, TyCtxt}; -use rustc::ty::subst::{Substs, SubstsRef}; +use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::lint; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc::util::common::ErrorReported; @@ -51,7 +51,7 @@ pub(crate) fn check_match<'a, 'tcx>( tables: tcx.body_tables(body_id), region_scope_tree: &tcx.region_scope_tree(def_id), param_env: tcx.param_env(def_id), - identity_substs: Substs::identity_for_item(tcx, def_id), + identity_substs: InternalSubsts::identity_for_item(tcx, def_id), }.visit_body(tcx.hir().body(body_id)); }) } diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index 6b6e8fcdc82c..c795b412bfa9 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -5,7 +5,7 @@ use rustc::hir::map::blocks::FnLikeNode; use rustc::lint::builtin::UNCONDITIONAL_RECURSION; use rustc::mir::{self, Mir, TerminatorKind}; use rustc::ty::{AssociatedItem, AssociatedItemContainer, Instance, TyCtxt, TyKind}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::InternalSubsts; pub fn check(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &Mir<'tcx>, @@ -69,7 +69,7 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>, }) => tcx.generics_of(trait_def_id).count(), _ => 0 }; - let caller_substs = &Substs::identity_for_item(tcx, def_id)[..trait_substs_count]; + let caller_substs = &InternalSubsts::identity_for_item(tcx, def_id)[..trait_substs_count]; while let Some(bb) = reachable_without_self_call_queue.pop() { if visited.contains(bb) { diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 2e4b8682437f..4cec306412e8 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -180,7 +180,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::mir::interpret::{AllocId, ConstValue}; use rustc::middle::lang_items::{ExchangeMallocFnLangItem, StartFnLangItem}; -use rustc::ty::subst::{Substs, SubstsRef}; +use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::{self, TypeFoldable, Ty, TyCtxt, GenericParamDefKind}; use rustc::ty::adjustment::CustomCoerceUnsized; use rustc::session::config::EntryFnType; @@ -956,7 +956,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { debug!("RootCollector: ADT drop-glue for {}", def_id_to_string(self.tcx, def_id)); - let ty = Instance::new(def_id, Substs::empty()).ty(self.tcx); + let ty = Instance::new(def_id, InternalSubsts::empty()).ty(self.tcx); visit_drop_use(self.tcx, ty, true, self.output); } } @@ -1116,7 +1116,7 @@ fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, continue; } - let substs = Substs::for_item(tcx, method.def_id, |param, _| { + let substs = InternalSubsts::for_item(tcx, method.def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => tcx.types.re_erased.into(), GenericParamDefKind::Type {..} => { diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index 6e639c3a1179..a26a1a7861eb 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -3,7 +3,7 @@ use rustc::hir; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::session::config::OptLevel; use rustc::ty::{self, Ty, TyCtxt, ClosureSubsts, GeneratorSubsts}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{SubstsRef, InternalSubsts}; use syntax::ast; use syntax::attr::InlineAttr; use std::fmt::{self, Write}; @@ -151,7 +151,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { debug!("is_instantiable({:?})", self); let (def_id, substs) = match *self.as_mono_item() { MonoItem::Fn(ref instance) => (instance.def_id(), instance.substs), - MonoItem::Static(def_id) => (def_id, Substs::empty()), + MonoItem::Static(def_id) => (def_id, InternalSubsts::empty()), // global asm never has predicates MonoItem::GlobalAsm(..) => return true }; @@ -422,7 +422,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { } fn push_type_params(&self, - substs: &Substs<'tcx>, + substs: SubstsRef<'tcx>, projections: I, output: &mut String, debug: bool) diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index d4145b8e47ea..ce7c9af81cb0 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -4,7 +4,7 @@ use rustc::infer; use rustc::mir::*; use rustc::ty::{self, Ty, TyCtxt, GenericParamDefKind}; use rustc::ty::layout::VariantIdx; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, InternalSubsts}; use rustc::ty::query::Providers; use rustc_data_structures::indexed_vec::{IndexVec, Idx}; @@ -183,7 +183,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let substs = if let Some(ty) = ty { tcx.intern_substs(&[ty.into()]) } else { - Substs::identity_for_item(tcx, def_id) + InternalSubsts::identity_for_item(tcx, def_id) }; let sig = tcx.fn_sig(def_id).subst(tcx, substs); let sig = tcx.erase_late_bound_regions(&sig); @@ -451,7 +451,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { ) { let tcx = self.tcx; - let substs = Substs::for_item(tcx, self.def_id, |param, _| { + let substs = InternalSubsts::for_item(tcx, self.def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => tcx.types.re_erased.into(), GenericParamDefKind::Type {..} => ty.into(), diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 8b17904c7b5b..5ed0055e7c4f 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -10,7 +10,7 @@ use rustc::mir::visit::{Visitor, PlaceContext, MutatingUseContext, NonMutatingUs use rustc::mir::interpret::{EvalErrorKind, Scalar, GlobalId, EvalResult}; use rustc::ty::{TyCtxt, self, Instance}; use syntax::source_map::{Span, DUMMY_SP}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::InternalSubsts; use rustc_data_structures::indexed_vec::IndexVec; use rustc::ty::ParamEnv; use rustc::ty::layout::{ @@ -288,7 +288,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { // FIXME: can't handle code with generics return None; } - let substs = Substs::identity_for_item(self.tcx, self.source.def_id()); + let substs = InternalSubsts::identity_for_item(self.tcx, self.source.def_id()); let instance = Instance::new(self.source.def_id(), substs); let cid = GlobalId { instance, diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 105eb5187467..6b8e37b3b313 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -22,7 +22,7 @@ use rustc::middle::mem_categorization as mc; use rustc::middle::mem_categorization::Categorization; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::query::Providers; -use rustc::ty::subst::{Substs, SubstsRef}; +use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::util::nodemap::{ItemLocalSet, HirIdSet}; use rustc::hir; use rustc_data_structures::sync::Lrc; @@ -75,7 +75,7 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, in_static: false, mut_rvalue_borrows: Default::default(), param_env: ty::ParamEnv::empty(), - identity_substs: Substs::empty(), + identity_substs: InternalSubsts::empty(), result: ItemLocalSet::default(), }; @@ -199,7 +199,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { self.tables = self.tcx.typeck_tables_of(item_def_id); self.param_env = self.tcx.param_env(item_def_id); - self.identity_substs = Substs::identity_for_item(self.tcx, item_def_id); + self.identity_substs = InternalSubsts::identity_for_item(self.tcx, item_def_id); let body = self.tcx.hir().body(body_id); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 568e622bd34c..27103ab99651 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -20,7 +20,7 @@ use rustc::middle::privacy::{AccessLevel, AccessLevels}; use rustc::ty::{self, TyCtxt, Ty, TraitRef, TypeFoldable, GenericParamDefKind}; use rustc::ty::fold::TypeVisitor; use rustc::ty::query::Providers; -use rustc::ty::subst::Substs; +use rustc::ty::subst::InternalSubsts; use rustc::util::nodemap::HirIdSet; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::Lrc; @@ -127,7 +127,7 @@ impl<'a, 'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'a, 'tcx, V> { fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { let tcx = self.def_id_visitor.tcx(); - // Substs are not visited here because they are visited below in `super_visit_with`. + // InternalSubsts are not visited here because they are visited below in `super_visit_with`. match ty.sty { ty::Adt(&ty::AdtDef { did: def_id, .. }, ..) | ty::Foreign(def_id) | @@ -180,7 +180,7 @@ impl<'a, 'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'a, 'tcx, V> ty::ExistentialPredicate::Trait(trait_ref) => trait_ref, ty::ExistentialPredicate::Projection(proj) => proj.trait_ref(tcx), ty::ExistentialPredicate::AutoTrait(def_id) => - ty::ExistentialTraitRef { def_id, substs: Substs::empty() }, + ty::ExistentialTraitRef { def_id, substs: InternalSubsts::empty() }, }; let ty::ExistentialTraitRef { def_id, substs: _ } = trait_ref; if self.def_id_visitor.visit_def_id(def_id, "trait", &trait_ref) { diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 1a7744786d80..ac572b652130 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -863,7 +863,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> { fn visit_generics(&mut self, generics: &'tcx Generics) { // For type parameter defaults, we have to ban access - // to following type parameters, as the Substs can only + // to following type parameters, as the InternalSubsts can only // provide previous type parameters as they're built. We // put all the parameters on the ban list and then remove // them one by one as they are processed and become available. diff --git a/src/librustc_traits/chalk_context/program_clauses.rs b/src/librustc_traits/chalk_context/program_clauses.rs index adfd26814db1..4d8a67ca6386 100644 --- a/src/librustc_traits/chalk_context/program_clauses.rs +++ b/src/librustc_traits/chalk_context/program_clauses.rs @@ -10,7 +10,7 @@ use rustc::traits::{ Environment, }; use rustc::ty; -use rustc::ty::subst::{Substs, Subst}; +use rustc::ty::subst::{InternalSubsts, Subst}; use rustc::hir; use rustc::hir::def_id::DefId; use rustc_target::spec::abi; @@ -129,7 +129,7 @@ fn assemble_builtin_sized_impls<'tcx>( // Struct def ty::Adt(adt_def, _) => { - let substs = Substs::bound_vars_for_item(tcx, adt_def.did); + let substs = InternalSubsts::bound_vars_for_item(tcx, adt_def.did); let adt = tcx.mk_ty(ty::Adt(adt_def, substs)); let sized_constraint = adt_def.sized_constraint(tcx) .iter() diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs index 7185c4ce4464..49fcb7cd8335 100644 --- a/src/librustc_traits/dropck_outlives.rs +++ b/src/librustc_traits/dropck_outlives.rs @@ -4,7 +4,7 @@ use rustc::traits::query::dropck_outlives::{DropckOutlivesResult, DtorckConstrai use rustc::traits::query::{CanonicalTyGoal, NoSolution}; use rustc::traits::{TraitEngine, Normalized, ObligationCause, TraitEngineExt}; use rustc::ty::query::Providers; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, InternalSubsts}; use rustc::ty::{self, ParamEnvAnd, Ty, TyCtxt}; use rustc::util::nodemap::FxHashSet; use rustc_data_structures::sync::Lrc; @@ -291,7 +291,7 @@ crate fn adt_dtorck_constraint<'a, 'tcx>( if def.is_phantom_data() { // The first generic parameter here is guaranteed to be a type because it's // `PhantomData`. - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); assert_eq!(substs.len(), 1); let result = DtorckConstraint { outlives: vec![], diff --git a/src/librustc_traits/generic_types.rs b/src/librustc_traits/generic_types.rs index 03511e1d76d0..634c024b0646 100644 --- a/src/librustc_traits/generic_types.rs +++ b/src/librustc_traits/generic_types.rs @@ -1,7 +1,7 @@ //! Utilities for creating generic types with bound vars in place of parameter values. use rustc::ty::{self, Ty, TyCtxt}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::InternalSubsts; use rustc::hir; use rustc::hir::def_id::DefId; use rustc_target::spec::abi; @@ -64,17 +64,17 @@ crate fn ref_ty(tcx: ty::TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tc } crate fn fn_def(tcx: ty::TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { - tcx.mk_ty(ty::FnDef(def_id, Substs::bound_vars_for_item(tcx, def_id))) + tcx.mk_ty(ty::FnDef(def_id, InternalSubsts::bound_vars_for_item(tcx, def_id))) } crate fn closure(tcx: ty::TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_closure(def_id, ty::ClosureSubsts { - substs: Substs::bound_vars_for_item(tcx, def_id), + substs: InternalSubsts::bound_vars_for_item(tcx, def_id), }) } crate fn generator(tcx: ty::TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_generator(def_id, ty::GeneratorSubsts { - substs: Substs::bound_vars_for_item(tcx, def_id), + substs: InternalSubsts::bound_vars_for_item(tcx, def_id), }, hir::GeneratorMovability::Movable) } diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index 908fdcfe7430..d261b2382e7a 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -18,7 +18,7 @@ use rustc::traits::{ }; use rustc::ty::query::Providers; use rustc::ty::{self, List, TyCtxt}; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, InternalSubsts}; use syntax::ast; use std::iter; @@ -182,7 +182,7 @@ fn program_clauses_for_trait<'a, 'tcx>( // } // ``` - let bound_vars = Substs::bound_vars_for_item(tcx, def_id); + let bound_vars = InternalSubsts::bound_vars_for_item(tcx, def_id); // `Self: Trait` let trait_pred = ty::TraitPredicate { @@ -294,7 +294,7 @@ fn program_clauses_for_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId // } // ``` - let bound_vars = Substs::bound_vars_for_item(tcx, def_id); + let bound_vars = InternalSubsts::bound_vars_for_item(tcx, def_id); let trait_ref = tcx.impl_trait_ref(def_id) .expect("not an impl") @@ -336,7 +336,7 @@ pub fn program_clauses_for_type_def<'a, 'tcx>( // } // ``` - let bound_vars = Substs::bound_vars_for_item(tcx, def_id); + let bound_vars = InternalSubsts::bound_vars_for_item(tcx, def_id); // `Ty<...>` let ty = tcx.type_of(def_id).subst(tcx, bound_vars); @@ -426,7 +426,7 @@ pub fn program_clauses_for_associated_type_def<'a, 'tcx>( _ => bug!("not an trait container"), }; - let trait_bound_vars = Substs::bound_vars_for_item(tcx, trait_id); + let trait_bound_vars = InternalSubsts::bound_vars_for_item(tcx, trait_id); let trait_ref = ty::TraitRef { def_id: trait_id, substs: trait_bound_vars, @@ -564,7 +564,7 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>( _ => bug!("not an impl container"), }; - let impl_bound_vars = Substs::bound_vars_for_item(tcx, impl_id); + let impl_bound_vars = InternalSubsts::bound_vars_for_item(tcx, impl_id); // `A0 as Trait` let trait_ref = tcx.impl_trait_ref(impl_id) diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 7e56c62c5f33..6f3dc8b969cf 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -14,7 +14,7 @@ use rustc::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS; use rustc::traits; use rustc::ty::{self, Ty, TyCtxt, ToPredicate, TypeFoldable}; use rustc::ty::{GenericParamDef, GenericParamDefKind}; -use rustc::ty::subst::{Kind, Subst, Substs, SubstsRef}; +use rustc::ty::subst::{Kind, Subst, InternalSubsts, SubstsRef}; use rustc::ty::wf::object_region_bounds; use rustc_data_structures::sync::Lrc; use rustc_target::spec::abi; @@ -1798,7 +1798,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { } hir::TyKind::Array(ref ty, ref length) => { let length_def_id = tcx.hir().local_def_id(length.id); - let substs = Substs::identity_for_item(tcx, length_def_id); + let substs = InternalSubsts::identity_for_item(tcx, length_def_id); let length = ty::LazyConst::Unevaluated(length_def_id, substs); let length = tcx.mk_lazy_const(length); let array_ty = tcx.mk_ty(ty::Array(self.ast_ty_to_ty(&ty), length)); @@ -1839,7 +1839,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let generics = tcx.generics_of(def_id); debug!("impl_trait_ty_to_ty: generics={:?}", generics); - let substs = Substs::for_item(tcx, def_id, |param, _| { + let substs = InternalSubsts::for_item(tcx, def_id, |param, _| { if let Some(i) = (param.index as usize).checked_sub(generics.parent_count) { // Our own parameters are the resolved lifetimes. match param.kind { diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index 220adc2de7b6..2a4b17a63995 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -12,7 +12,7 @@ use rustc::traits::Obligation; use rustc::traits::error_reporting::ArgKind; use rustc::ty::{self, Ty, GenericParamDefKind}; use rustc::ty::fold::TypeFoldable; -use rustc::ty::subst::Substs; +use rustc::ty::subst::InternalSubsts; use std::cmp; use std::iter; use rustc_target::spec::abi::Abi; @@ -95,7 +95,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // types of upvars. These will be unified during the upvar // inference phase (`upvar.rs`). let base_substs = - Substs::identity_for_item(self.tcx, self.tcx.closure_base_def_id(expr_def_id)); + InternalSubsts::identity_for_item(self.tcx, self.tcx.closure_base_def_id(expr_def_id)); let substs = base_substs.extend_to(self.tcx,expr_def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => { diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index ebd7dad58fd0..64f61d5e5232 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -823,7 +823,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { debug!("coercion::try_find_coercion_lub({:?}, {:?})", prev_ty, new_ty); // Special-case that coercion alone cannot handle: - // Two function item types of differing IDs or Substs. + // Two function item types of differing IDs or InternalSubsts. if let (&ty::FnDef(..), &ty::FnDef(..)) = (&prev_ty.sty, &new_ty.sty) { // Don't reify if the function types have a LUB, i.e., they // are the same function and their parameters have a LUB. diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index c6b34672e6b4..e061a5304eb2 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -4,7 +4,7 @@ use rustc::ty::{self, TyCtxt, GenericParamDefKind}; use rustc::ty::util::ExplicitSelf; use rustc::traits::{self, ObligationCause, ObligationCauseCode, Reveal}; use rustc::ty::error::{ExpectedFound, TypeError}; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, InternalSubsts, SubstsRef}; use rustc::util::common::ErrorReported; use errors::Applicability; @@ -160,7 +160,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // a fresh FulfillmentCtxt, and invoke select_all_or_error. // Create mapping from impl to placeholder. - let impl_to_skol_substs = Substs::identity_for_item(tcx, impl_m.def_id); + let impl_to_skol_substs = InternalSubsts::identity_for_item(tcx, impl_m.def_id); // Create mapping from trait to placeholder. let trait_to_skol_substs = impl_to_skol_substs.rebase_onto(tcx, @@ -361,7 +361,7 @@ fn check_region_bounds_on_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_m: &ty::AssociatedItem, trait_generics: &ty::Generics, impl_generics: &ty::Generics, - trait_to_skol_substs: &Substs<'tcx>) + trait_to_skol_substs: SubstsRef<'tcx>) -> Result<(), ErrorReported> { let trait_params = trait_generics.own_counts().lifetimes; let impl_params = impl_generics.own_counts().lifetimes; diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index ad74e78fecdc..12c7484f0f92 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -6,7 +6,7 @@ use rustc::infer::outlives::env::OutlivesEnvironment; use rustc::infer::{self, InferOk, SuppressRegionErrors}; use rustc::middle::region; use rustc::traits::{ObligationCause, TraitEngine, TraitEngineExt}; -use rustc::ty::subst::{Subst, Substs, UnpackedKind}; +use rustc::ty::subst::{Subst, SubstsRef, UnpackedKind}; use rustc::ty::{self, Ty, TyCtxt}; use crate::util::common::ErrorReported; @@ -145,7 +145,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>( drop_impl_did: DefId, dtor_predicates: &ty::GenericPredicates<'tcx>, self_type_did: DefId, - self_to_impl_substs: &Substs<'tcx>, + self_to_impl_substs: SubstsRef<'tcx>, ) -> Result<(), ErrorReported> { let mut result = Ok(()); diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index cb6a862f06ee..d81d24e6d2b0 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -18,7 +18,7 @@ use rustc::hir; use rustc::hir::def::Def; use rustc::hir::def_id::DefId; use rustc::traits; -use rustc::ty::subst::{Substs, SubstsRef}; +use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::{self, Ty, ToPredicate, ToPolyTraitRef, TraitRef, TypeFoldable}; use rustc::ty::GenericParamDefKind; use rustc::ty::subst::Subst; @@ -281,7 +281,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { trait_def_id); // Construct a trait-reference `self_ty : Trait` - let substs = Substs::for_item(self.tcx, trait_def_id, |param, _| { + let substs = InternalSubsts::for_item(self.tcx, trait_def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => {} GenericParamDefKind::Type {..} => { diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 0db9e3ed85fd..a4624eebcba8 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -13,7 +13,7 @@ use rustc_data_structures::sync::Lrc; use rustc::hir; use rustc::lint; use rustc::session::config::nightly_options; -use rustc::ty::subst::{Subst, Substs, SubstsRef}; +use rustc::ty::subst::{Subst, InternalSubsts, SubstsRef}; use rustc::traits::{self, ObligationCause}; use rustc::traits::query::{CanonicalTyGoal}; use rustc::traits::query::method_autoderef::{CandidateStep, MethodAutoderefStepsResult}; @@ -1480,7 +1480,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { fn xform_self_ty(&self, item: &ty::AssociatedItem, impl_ty: Ty<'tcx>, - substs: &Substs<'tcx>) + substs: SubstsRef<'tcx>) -> (Ty<'tcx>, Option>) { if item.kind == ty::AssociatedKind::Method && self.mode == Mode::MethodCall { let sig = self.xform_method_sig(item.def_id, substs); @@ -1492,7 +1492,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { fn xform_method_sig(&self, method: DefId, - substs: &Substs<'tcx>) + substs: SubstsRef<'tcx>) -> ty::FnSig<'tcx> { let fn_sig = self.tcx.fn_sig(method); @@ -1517,7 +1517,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { if generics.params.is_empty() { xform_fn_sig.subst(self.tcx, substs) } else { - let substs = Substs::for_item(self.tcx, method, |param, _| { + let substs = InternalSubsts::for_item(self.tcx, method, |param, _| { let i = param.index as usize; if i < substs.len() { substs[i] @@ -1542,7 +1542,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { } fn fresh_item_substs(&self, def_id: DefId) -> SubstsRef<'tcx> { - Substs::for_item(self.tcx, def_id, |param, _| { + InternalSubsts::for_item(self.tcx, def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => self.tcx.types.re_erased.into(), GenericParamDefKind::Type {..} => { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index fbbc65feb737..202d8bec4e95 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -109,7 +109,7 @@ use rustc::ty::{ use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::fold::TypeFoldable; use rustc::ty::query::Providers; -use rustc::ty::subst::{UnpackedKind, Subst, Substs, SubstsRef, UserSelfTy, UserSubsts}; +use rustc::ty::subst::{UnpackedKind, Subst, InternalSubsts, SubstsRef, UserSelfTy, UserSubsts}; use rustc::ty::util::{Representability, IntTypeExt, Discr}; use rustc::ty::layout::VariantIdx; use syntax_pos::{self, BytePos, Span, MultiSpan}; @@ -1385,7 +1385,7 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite hir::ItemKind::Existential(..) => { let def_id = tcx.hir().local_def_id(it.id); - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); check_opaque(tcx, def_id, substs, it.span); } hir::ItemKind::Ty(..) => { @@ -1809,7 +1809,7 @@ fn check_transparent<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: De // For each field, figure out if it's known to be a ZST and align(1) let field_infos = adt.non_enum_variant().fields.iter().map(|field| { - let ty = field.ty(tcx, Substs::identity_for_item(tcx, field.did)); + let ty = field.ty(tcx, InternalSubsts::identity_for_item(tcx, field.did)); let param_env = tcx.param_env(field.did); let layout = tcx.layout_of(param_env.and(ty)); // We are currently checking the type this field came from, so it must be local @@ -2177,7 +2177,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if !method_generics.params.is_empty() { let user_type_annotation = self.infcx.probe(|_| { let user_substs = UserSubsts { - substs: Substs::for_item(self.tcx, method.def_id, |param, _| { + substs: InternalSubsts::for_item(self.tcx, method.def_id, |param, _| { let i = param.index as usize; if i < method_generics.parent_count { self.infcx.var_for_def(DUMMY_SP, param) @@ -2303,7 +2303,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// types as well. This function combines the two. fn instantiate_type_scheme(&self, span: Span, - substs: &Substs<'tcx>, + substs: SubstsRef<'tcx>, value: &T) -> T where T : TypeFoldable<'tcx> @@ -2319,7 +2319,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// As `instantiate_type_scheme`, but for the bounds found in a /// generic type scheme. - fn instantiate_bounds(&self, span: Span, def_id: DefId, substs: &Substs<'tcx>) + fn instantiate_bounds(&self, span: Span, def_id: DefId, substs: SubstsRef<'tcx>) -> ty::InstantiatedPredicates<'tcx> { let bounds = self.tcx.predicates_of(def_id); let result = bounds.instantiate(self.tcx, substs); @@ -2477,7 +2477,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } /// Registers obligations that all types appearing in `substs` are well-formed. - pub fn add_wf_bounds(&self, substs: &Substs<'tcx>, expr: &hir::Expr) { + pub fn add_wf_bounds(&self, substs: SubstsRef<'tcx>, expr: &hir::Expr) { for ty in substs.types() { self.register_wf_obligation(ty, expr.span, traits::MiscObligation); } @@ -2521,7 +2521,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn field_ty(&self, span: Span, field: &'tcx ty::FieldDef, - substs: &Substs<'tcx>) + substs: SubstsRef<'tcx>) -> Ty<'tcx> { self.normalize_associated_types_in(span, &field.ty(self.tcx, substs)) @@ -4554,7 +4554,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ExprKind::Repeat(ref element, ref count) => { let count_def_id = tcx.hir().local_def_id(count.id); let param_env = ty::ParamEnv::empty(); - let substs = Substs::identity_for_item(tcx.global_tcx(), count_def_id); + let substs = InternalSubsts::identity_for_item(tcx.global_tcx(), count_def_id); let instance = ty::Instance::resolve( tcx.global_tcx(), param_env, diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index bf4df19556d0..b549986777c8 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -81,7 +81,7 @@ use rustc::hir::def_id::DefId; use rustc::infer::outlives::env::OutlivesEnvironment; use rustc::infer::{self, RegionObligation, SuppressRegionErrors}; use rustc::ty::adjustment; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty}; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; @@ -1393,7 +1393,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { fn substs_wf_in_scope( &mut self, origin: infer::ParameterOrigin, - substs: &Substs<'tcx>, + substs: SubstsRef<'tcx>, expr_span: Span, expr_region: ty::Region<'tcx>, ) { diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 9217484f3a7a..69f2a17fdf11 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -4,7 +4,7 @@ use crate::constrained_type_params::{identify_constrained_type_params, Parameter use crate::hir::def_id::DefId; use rustc::traits::{self, ObligationCauseCode}; use rustc::ty::{self, Lift, Ty, TyCtxt, TyKind, GenericParamDefKind, TypeFoldable, ToPredicate}; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, InternalSubsts}; use rustc::util::nodemap::{FxHashSet, FxHashMap}; use rustc::middle::lang_items; use rustc::infer::opaque_types::may_define_existential_type; @@ -459,7 +459,7 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>( // For more examples see tests `defaults-well-formedness.rs` and `type-check-defaults.rs`. // // First we build the defaulted substitution. - let substs = Substs::for_item(fcx.tcx, def_id, |param, _| { + let substs = InternalSubsts::for_item(fcx.tcx, def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => { // All regions are identity. diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 2153582819c6..167fb109567d 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -23,7 +23,7 @@ use crate::middle::resolve_lifetime as rl; use crate::middle::weak_lang_items; use rustc::mir::mono::Linkage; use rustc::ty::query::Providers; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, InternalSubsts}; use rustc::ty::util::Discr; use rustc::ty::util::IntTypeExt; use rustc::ty::subst::UnpackedKind; @@ -1149,7 +1149,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { match tcx.hir().get(node_id) { Node::TraitItem(item) => match item.node { TraitItemKind::Method(..) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); tcx.mk_fn_def(def_id, substs) } TraitItemKind::Const(ref ty, _) | TraitItemKind::Type(_, Some(ref ty)) => icx.to_ty(ty), @@ -1160,7 +1160,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { Node::ImplItem(item) => match item.node { ImplItemKind::Method(..) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); tcx.mk_fn_def(def_id, substs) } ImplItemKind::Const(ref ty, _) => icx.to_ty(ty), @@ -1193,12 +1193,12 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { | ItemKind::Ty(ref t, _) | ItemKind::Impl(.., ref t, _) => icx.to_ty(t), ItemKind::Fn(..) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); tcx.mk_fn_def(def_id, substs) } ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..) => { let def = tcx.adt_def(def_id); - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); tcx.mk_adt(def, substs) } ItemKind::Existential(hir::ExistTy { @@ -1246,7 +1246,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { Node::ForeignItem(foreign_item) => match foreign_item.node { ForeignItemKind::Fn(..) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); tcx.mk_fn_def(def_id, substs) } ForeignItemKind::Static(ref t, _) => icx.to_ty(t), @@ -1262,7 +1262,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.type_of(tcx.hir().get_parent_did(node_id)) } VariantData::Tuple(..) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); tcx.mk_fn_def(def_id, substs) } }, @@ -1279,7 +1279,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { } let substs = ty::ClosureSubsts { - substs: Substs::identity_for_item(tcx, def_id), + substs: InternalSubsts::identity_for_item(tcx, def_id), }; tcx.mk_closure(def_id, substs) @@ -1829,7 +1829,7 @@ fn explicit_predicates_of<'a, 'tcx>( Node::ImplItem(item) => match item.node { ImplItemKind::Existential(ref bounds) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); let opaque_ty = tcx.mk_opaque(def_id, substs); // Collect the bounds, i.e., the `A+B+'c` in `impl A+B+'c`. @@ -1874,7 +1874,7 @@ fn explicit_predicates_of<'a, 'tcx>( impl_trait_fn, ref generics, }) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); let opaque_ty = tcx.mk_opaque(def_id, substs); // Collect the bounds, i.e., the `A+B+'c` in `impl A+B+'c`. diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 1d407870ee73..7b94b047c92e 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -4,7 +4,7 @@ //! We walk the set of items and, for each member, generate new constraints. use hir::def_id::DefId; -use rustc::ty::subst::{Substs, UnpackedKind}; +use rustc::ty::subst::{UnpackedKind, SubstsRef}; use rustc::ty::{self, Ty, TyCtxt}; use syntax::ast; use rustc::hir; @@ -222,7 +222,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { fn add_constraints_from_invariant_substs(&mut self, current: &CurrentItem, - substs: &Substs<'tcx>, + substs: SubstsRef<'tcx>, variance: VarianceTermPtr<'a>) { debug!("add_constraints_from_invariant_substs: substs={:?} variance={:?}", substs, @@ -344,7 +344,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { fn add_constraints_from_substs(&mut self, current: &CurrentItem, def_id: DefId, - substs: &Substs<'tcx>, + substs: SubstsRef<'tcx>, variance: VarianceTermPtr<'a>) { debug!("add_constraints_from_substs(def_id={:?}, substs={:?}, variance={:?})", def_id, diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 2c2959aec9fc..72abbae231aa 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -20,7 +20,7 @@ use rustc::mir::interpret::GlobalId; use rustc::hir::{self, GenericArg, HirVec}; use rustc::hir::def::{self, Def, CtorKind}; use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::{self, TyCtxt, Region, RegionVid, Ty, AdtKind}; use rustc::ty::fold::TypeFolder; use rustc::ty::layout::VariantIdx; @@ -1089,7 +1089,7 @@ impl Clean for hir::GenericBound { } fn external_generic_args(cx: &DocContext<'_, '_, '_>, trait_did: Option, has_self: bool, - bindings: Vec, substs: &Substs<'_>) -> GenericArgs { + bindings: Vec, substs: SubstsRef<'_>) -> GenericArgs { let lifetimes = substs.regions().filter_map(|v| v.clean(cx)).collect(); let types = substs.types().skip(has_self as usize).collect::>(); @@ -1131,7 +1131,7 @@ fn external_generic_args(cx: &DocContext<'_, '_, '_>, trait_did: Option, // trait_did should be set to a trait's DefId if called on a TraitRef, in order to sugar // from Fn<(A, B,), C> to Fn(A, B) -> C fn external_path(cx: &DocContext<'_, '_, '_>, name: &str, trait_did: Option, has_self: bool, - bindings: Vec, substs: &Substs<'_>) -> Path { + bindings: Vec, substs: SubstsRef<'_>) -> Path { Path { global: false, def: Def::Err, @@ -1192,7 +1192,7 @@ impl<'tcx> Clean for ty::TraitRef<'tcx> { } } -impl<'tcx> Clean>> for Substs<'tcx> { +impl<'tcx> Clean>> for InternalSubsts<'tcx> { fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option> { let mut v = Vec::new(); v.extend(self.regions().filter_map(|r| r.clean(cx)).map(GenericBound::Outlives)); @@ -2532,7 +2532,7 @@ impl Clean for hir::Ty { TyKind::Array(ref ty, ref length) => { let def_id = cx.tcx.hir().local_def_id(length.id); let param_env = cx.tcx.param_env(def_id); - let substs = Substs::identity_for_item(cx.tcx, def_id); + let substs = InternalSubsts::identity_for_item(cx.tcx, def_id); let cid = GlobalId { instance: ty::Instance::new(def_id, substs), promoted: None @@ -2776,7 +2776,7 @@ impl<'tcx> Clean for Ty<'tcx> { ty::Foreign(did) => { inline::record_extern_fqn(cx, did, TypeKind::Foreign); let path = external_path(cx, &cx.tcx.item_name(did).as_str(), - None, false, vec![], Substs::empty()); + None, false, vec![], InternalSubsts::empty()); ResolvedPath { path: path, typarams: None, From c1f3d1520efc91ec79dfafd6ab0e679872092487 Mon Sep 17 00:00:00 2001 From: Adonis Date: Sat, 2 Feb 2019 12:03:38 +0100 Subject: [PATCH 079/381] Changing error message to reflect changes with the 2018 edition Signed-off-by: Adonis Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf Update src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr Co-Authored-By: asettouf Update src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr Co-Authored-By: asettouf Stabilize split_ascii_whitespace Tracking issue FCP to merge: https://github.com/rust-lang/rust/issues/48656#issuecomment-442372750 fix stabilization order of uniform_paths. hir: add HirId to main Hir nodes Fix `std::os::fortanix_sgx::usercalls::raw::UsercallNrs` Fixes https://github.com/fortanix/rust-sgx/issues/88 Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf Revert "Merge remote-tracking branch 'upstream/master'" This reverts commit 751f05bd155e2c55d4177fe8211df634faf3a644, reversing changes made to 545a3e62b0cb473108869a61b271bc589afb49da. --- src/libsyntax/ext/tt/quoted.rs | 18 ++++++++++++------ ...macro-at-most-once-rep-2015-ques-rep.stderr | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/libsyntax/ext/tt/quoted.rs b/src/libsyntax/ext/tt/quoted.rs index b56871a18857..43d279980f6e 100644 --- a/src/libsyntax/ext/tt/quoted.rs +++ b/src/libsyntax/ext/tt/quoted.rs @@ -474,11 +474,13 @@ where // #1 is a separator and #2 should be a KleepeOp. // (N.B. We need to advance the input iterator.) match parse_kleene_op(input, span) { - // #2 is `?`, which is not allowed as a Kleene op in 2015 edition. + // #2 is `?`, which is not allowed as a Kleene op in 2015 edition, + // but is allowed in the 2018 edition. Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => { sess.span_diagnostic .struct_span_err(op2_span, "expected `*` or `+`") - .note("`?` is not a macro repetition operator") + .note("`?` is not a macro repetition operator in the 2015 edition, \ + but is accepted in the 2018 edition") .emit(); // Return a dummy @@ -506,10 +508,12 @@ where Err(_) => op1_span, } } else { - // `?` is not allowed as a Kleene op in 2015 + // `?` is not allowed as a Kleene op in 2015, + // but is allowed in the 2018 edition sess.span_diagnostic .struct_span_err(op1_span, "expected `*` or `+`") - .note("`?` is not a macro repetition operator") + .note("`?` is not a macro repetition operator in the 2015 edition, \ + but is accepted in the 2018 edition") .emit(); // Return a dummy @@ -519,11 +523,13 @@ where // #1 is a separator followed by #2, a KleeneOp Ok(Err((tok, span))) => match parse_kleene_op(input, span) { - // #2 is a `?`, which is not allowed as a Kleene op in 2015 edition. + // #2 is a `?`, which is not allowed as a Kleene op in 2015 edition, + // but is allowed in the 2018 edition Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => { sess.span_diagnostic .struct_span_err(op2_span, "expected `*` or `+`") - .note("`?` is not a macro repetition operator") + .note("`?` is not a macro repetition operator in the 2015 edition, \ + but is accepted in the 2018 edition") .emit(); // Return a dummy diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr index b27b60459d63..cb0a9163b747 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr +++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr @@ -4,7 +4,7 @@ error: expected `*` or `+` LL | ($(a)?) => {} //~ERROR expected `*` or `+` | ^ | - = note: `?` is not a macro repetition operator + = note: `?` is not a macro repetition operator in the 2015 edition, but is accepted in the 2018 edition error: expected `*` or `+` --> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:10:11 @@ -12,7 +12,7 @@ error: expected `*` or `+` LL | ($(a),?) => {} //~ERROR expected `*` or `+` | ^ | - = note: `?` is not a macro repetition operator + = note: `?` is not a macro repetition operator in the 2015 edition, but is accepted in the 2018 edition error: aborting due to 2 previous errors From f313baedba2d73e1a24df77483ac24622de201ae Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Tue, 26 Feb 2019 12:20:38 -0700 Subject: [PATCH 080/381] Add tracking issue for the unwind attribute. --- src/libsyntax/feature_gate.rs | 4 ++-- .../ui/feature-gates/feature-gate-unwind-attributes.stderr | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index cc1953e69d4c..cafdaea70a1a 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -233,8 +233,8 @@ declare_features! ( // Allows `#[unwind(..)]`. // - // rustc internal for rust runtime - (active, unwind_attributes, "1.4.0", None, None), + // Permits specifying whether a function should permit unwinding or abort on unwind. + (active, unwind_attributes, "1.4.0", Some(58760), None), // Allows the use of `#[naked]` on functions. (active, naked_functions, "1.9.0", Some(32408), None), diff --git a/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr b/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr index 918d40d681bb..77f2f13c99ee 100644 --- a/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr +++ b/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr @@ -1,4 +1,4 @@ -error[E0658]: #[unwind] is experimental +error[E0658]: #[unwind] is experimental (see issue #58760) --> $DIR/feature-gate-unwind-attributes.rs:11:5 | LL | #[unwind(allowed)] //~ ERROR #[unwind] is experimental From b11502fbc0cfc251c1b96743562761c9a451d84a Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Tue, 26 Feb 2019 22:42:50 +0300 Subject: [PATCH 081/381] Mention `unwind(aborts)` in diagnostics for `#[unwind]` Simplify input validation for `#[unwind]`, add tests --- src/libsyntax/attr/builtin.rs | 48 +++++++------------ src/libsyntax/feature_gate.rs | 2 +- src/test/ui/malformed/malformed-unwind-1.rs | 11 +++++ .../ui/malformed/malformed-unwind-1.stderr | 14 ++++++ src/test/ui/malformed/malformed-unwind-2.rs | 11 +++++ .../ui/malformed/malformed-unwind-2.stderr | 15 ++++++ 6 files changed, 69 insertions(+), 32 deletions(-) create mode 100644 src/test/ui/malformed/malformed-unwind-1.rs create mode 100644 src/test/ui/malformed/malformed-unwind-1.stderr create mode 100644 src/test/ui/malformed/malformed-unwind-2.rs create mode 100644 src/test/ui/malformed/malformed-unwind-2.stderr diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs index e84adc01cf04..f7a000935caf 100644 --- a/src/libsyntax/attr/builtin.rs +++ b/src/libsyntax/attr/builtin.rs @@ -7,7 +7,7 @@ use crate::parse::ParseSess; use errors::{Applicability, Handler}; use syntax_pos::{symbol::Symbol, Span}; -use super::{list_contains_name, mark_used, MetaItemKind}; +use super::{mark_used, MetaItemKind}; enum AttrError { MultipleItem(Name), @@ -79,40 +79,26 @@ pub enum UnwindAttr { /// Determine what `#[unwind]` attribute is present in `attrs`, if any. pub fn find_unwind_attr(diagnostic: Option<&Handler>, attrs: &[Attribute]) -> Option { - let syntax_error = |attr: &Attribute| { - mark_used(attr); - diagnostic.map(|d| { - span_err!(d, attr.span, E0633, "malformed `#[unwind]` attribute"); - }); - None - }; - attrs.iter().fold(None, |ia, attr| { - if attr.path != "unwind" { - return ia; - } - let meta = match attr.meta() { - Some(meta) => meta.node, - None => return ia, - }; - match meta { - MetaItemKind::Word => { - syntax_error(attr) - } - MetaItemKind::List(ref items) => { - mark_used(attr); - if items.len() != 1 { - syntax_error(attr) - } else if list_contains_name(&items[..], "allowed") { - Some(UnwindAttr::Allowed) - } else if list_contains_name(&items[..], "aborts") { - Some(UnwindAttr::Aborts) - } else { - syntax_error(attr) + if attr.check_name("unwind") { + if let Some(meta) = attr.meta() { + if let MetaItemKind::List(items) = meta.node { + if items.len() == 1 { + if items[0].check_name("allowed") { + return Some(UnwindAttr::Allowed); + } else if items[0].check_name("aborts") { + return Some(UnwindAttr::Aborts); + } + } + + diagnostic.map(|d| { + span_err!(d, attr.span, E0633, "malformed `#[unwind]` attribute"); + }); } } - _ => ia, } + + ia }) } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index cc1953e69d4c..93c6de274eee 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1173,7 +1173,7 @@ pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeTemplate, Attribu "dropck_eyepatch", "may_dangle has unstable semantics and may be removed in the future", cfg_fn!(dropck_eyepatch))), - ("unwind", Whitelisted, template!(List: "allowed"), Gated(Stability::Unstable, + ("unwind", Whitelisted, template!(List: "allowed|aborts"), Gated(Stability::Unstable, "unwind_attributes", "#[unwind] is experimental", cfg_fn!(unwind_attributes))), diff --git a/src/test/ui/malformed/malformed-unwind-1.rs b/src/test/ui/malformed/malformed-unwind-1.rs new file mode 100644 index 000000000000..e34c288c027c --- /dev/null +++ b/src/test/ui/malformed/malformed-unwind-1.rs @@ -0,0 +1,11 @@ +#![feature(unwind_attributes)] + +#[unwind] +//~^ ERROR attribute must be of the form +extern "C" fn f1() {} + +#[unwind = ""] +//~^ ERROR attribute must be of the form +extern "C" fn f2() {} + +fn main() {} diff --git a/src/test/ui/malformed/malformed-unwind-1.stderr b/src/test/ui/malformed/malformed-unwind-1.stderr new file mode 100644 index 000000000000..852136eed91b --- /dev/null +++ b/src/test/ui/malformed/malformed-unwind-1.stderr @@ -0,0 +1,14 @@ +error: attribute must be of the form `#[unwind(allowed|aborts)]` + --> $DIR/malformed-unwind-1.rs:3:1 + | +LL | #[unwind] + | ^^^^^^^^^ + +error: attribute must be of the form `#[unwind(allowed|aborts)]` + --> $DIR/malformed-unwind-1.rs:7:1 + | +LL | #[unwind = ""] + | ^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/malformed/malformed-unwind-2.rs b/src/test/ui/malformed/malformed-unwind-2.rs new file mode 100644 index 000000000000..d4955b433093 --- /dev/null +++ b/src/test/ui/malformed/malformed-unwind-2.rs @@ -0,0 +1,11 @@ +#![feature(unwind_attributes)] + +#[unwind(allowed, aborts)] +//~^ ERROR malformed `#[unwind]` attribute +extern "C" fn f1() {} + +#[unwind(unsupported)] +//~^ ERROR malformed `#[unwind]` attribute +extern "C" fn f2() {} + +fn main() {} diff --git a/src/test/ui/malformed/malformed-unwind-2.stderr b/src/test/ui/malformed/malformed-unwind-2.stderr new file mode 100644 index 000000000000..88fc4e00a2fd --- /dev/null +++ b/src/test/ui/malformed/malformed-unwind-2.stderr @@ -0,0 +1,15 @@ +error[E0633]: malformed `#[unwind]` attribute + --> $DIR/malformed-unwind-2.rs:3:1 + | +LL | #[unwind(allowed, aborts)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0633]: malformed `#[unwind]` attribute + --> $DIR/malformed-unwind-2.rs:7:1 + | +LL | #[unwind(unsupported)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0633`. From dc00a8adee77f04a450e2f02be97b4e308af863e Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Wed, 27 Feb 2019 09:36:49 +0300 Subject: [PATCH 082/381] Validate `#[unwind]` syntax regardless of platform-specific panic strategy --- src/librustc_mir/build/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 19507c900da6..39c84b95f8f5 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -581,6 +581,10 @@ fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, // Not callable from C, so we can safely unwind through these if abi == Abi::Rust || abi == Abi::RustCall { return false; } + // Validate `#[unwind]` syntax regardless of platform-specific panic strategy + let attrs = &tcx.get_attrs(fn_def_id); + let unwind_attr = attr::find_unwind_attr(Some(tcx.sess.diagnostic()), attrs); + // We never unwind, so it's not relevant to stop an unwind if tcx.sess.panic_strategy() != PanicStrategy::Unwind { return false; } @@ -589,8 +593,7 @@ fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, // This is a special case: some functions have a C abi but are meant to // unwind anyway. Don't stop them. - let attrs = &tcx.get_attrs(fn_def_id); - match attr::find_unwind_attr(Some(tcx.sess.diagnostic()), attrs) { + match unwind_attr { None => true, Some(UnwindAttr::Allowed) => false, Some(UnwindAttr::Aborts) => true, From 88847718f0cca57124cbd1bce12fc938c5bde088 Mon Sep 17 00:00:00 2001 From: Tim Vermeulen Date: Wed, 27 Feb 2019 11:44:30 +0100 Subject: [PATCH 083/381] Add relevant benchmarks --- src/libcore/benches/iter.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/libcore/benches/iter.rs b/src/libcore/benches/iter.rs index fe852e42b5cd..5cc2bce846d8 100644 --- a/src/libcore/benches/iter.rs +++ b/src/libcore/benches/iter.rs @@ -306,3 +306,31 @@ fn bench_skip_then_zip(b: &mut Bencher) { assert_eq!(s, 2009900); }); } + +#[bench] +fn bench_filter_count(b: &mut Bencher) { + b.iter(|| { + (0i64..1000000).map(black_box).filter(|x| x % 3 == 0).count() + }) +} + +#[bench] +fn bench_filter_ref_count(b: &mut Bencher) { + b.iter(|| { + (0i64..1000000).map(black_box).by_ref().filter(|x| x % 3 == 0).count() + }) +} + +#[bench] +fn bench_filter_chain_count(b: &mut Bencher) { + b.iter(|| { + (0i64..1000000).chain(0..1000000).map(black_box).filter(|x| x % 3 == 0).count() + }) +} + +#[bench] +fn bench_filter_chain_ref_count(b: &mut Bencher) { + b.iter(|| { + (0i64..1000000).chain(0..1000000).map(black_box).by_ref().filter(|x| x % 3 == 0).count() + }) +} \ No newline at end of file From ec2e4ba919a65a972019925b5b33d0f309f467fc Mon Sep 17 00:00:00 2001 From: Tim Vermeulen Date: Wed, 27 Feb 2019 11:46:37 +0100 Subject: [PATCH 084/381] Improve existing benchmarks to prevent extreme optimizations --- src/libcore/benches/iter.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/benches/iter.rs b/src/libcore/benches/iter.rs index 5cc2bce846d8..4f3d6f379022 100644 --- a/src/libcore/benches/iter.rs +++ b/src/libcore/benches/iter.rs @@ -185,13 +185,13 @@ bench_sums! { bench_sums! { bench_filter_sum, bench_filter_ref_sum, - (0i64..1000000).filter(|x| x % 2 == 0) + (0i64..1000000).filter(|x| x % 3 == 0) } bench_sums! { bench_filter_chain_sum, bench_filter_chain_ref_sum, - (0i64..1000000).chain(0..1000000).filter(|x| x % 2 == 0) + (0i64..1000000).chain(0..1000000).filter(|x| x % 3 == 0) } bench_sums! { From 88bd624a88692dd4bbda5f3f324f0035dc041534 Mon Sep 17 00:00:00 2001 From: Tim Vermeulen Date: Wed, 27 Feb 2019 13:22:18 +0100 Subject: [PATCH 085/381] Add trailing newline --- src/libcore/benches/iter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/benches/iter.rs b/src/libcore/benches/iter.rs index 4f3d6f379022..1dd2bd3ee78a 100644 --- a/src/libcore/benches/iter.rs +++ b/src/libcore/benches/iter.rs @@ -333,4 +333,4 @@ fn bench_filter_chain_ref_count(b: &mut Bencher) { b.iter(|| { (0i64..1000000).chain(0..1000000).map(black_box).by_ref().filter(|x| x % 3 == 0).count() }) -} \ No newline at end of file +} From 4e7d4c7778a00371ba707fb8f9022bcbb443bb29 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 27 Feb 2019 15:32:32 +0100 Subject: [PATCH 086/381] ManuallyDrop != MaybeUninit --- src/libcore/mem.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index f41d293e80ad..6b1b91d00faa 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -900,10 +900,16 @@ pub fn discriminant(v: &T) -> Discriminant { } } +// FIXME: Reference `MaybeUninit` from these docs, once that is stable. /// A wrapper to inhibit compiler from automatically calling `T`’s destructor. /// /// This wrapper is 0-cost. /// +/// `ManuallyDrop` is subject to the same layout optimizations as `T`. +/// As a consequence, it has *no effect* on the assumptions that the compiler makes +/// about all values being initialized at their type. In particular, initializing +/// a `ManuallyDrop<&T>` with [`mem::zeroed`] is undefined behavior. +/// /// # Examples /// /// This wrapper helps with explicitly documenting the drop order dependencies between fields of @@ -935,6 +941,8 @@ pub fn discriminant(v: &T) -> Discriminant { /// } /// } /// ``` +/// +/// [`mem::zeroed']: fn.zeroed.html #[stable(feature = "manually_drop", since = "1.20.0")] #[lang = "manually_drop"] #[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] From d2b1212558b25e69eb867402792d5b5b5a07ad19 Mon Sep 17 00:00:00 2001 From: Simon Heath Date: Wed, 30 Jan 2019 19:42:37 -0500 Subject: [PATCH 087/381] Started expanding docs for `TryFrom` and `TryInto`. The examples are still lacking for now, both for module docs and for methods/impl's. --- src/libcore/convert.rs | 44 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 5ecfa9cde032..a3f1a3201f31 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -366,6 +366,11 @@ pub trait From: Sized { /// provides an equivalent `TryInto` implementation for free, thanks to a /// blanket implementation in the standard library. For more information on this, /// see the documentation for [`Into`]. +/// +/// # Implementing `TryInto` +/// +/// This suffers the same restrictions and reasoning as implementing +/// [`Into`], see there for details. /// /// [`TryFrom`]: trait.TryFrom.html /// [`Into`]: trait.Into.html @@ -380,7 +385,44 @@ pub trait TryInto: Sized { fn try_into(self) -> Result; } -/// Attempt to construct `Self` via a conversion. +/// Simple and safe type conversions that may fail in a controlled +/// way under some circumstances. It is the reciprocal of [`TryInto`]. +/// +/// This is useful when you are doing a type conversion that may +/// trivially succeed but may also need special handling. +/// For example, there is no way to convert an `i64` into an `i32` +/// using the [`From`] trait, because an `i64` may contain a value +/// that an `i32` cannot represent and so the conversion would lose data. +/// This might be handled by truncating the `i64` to an `i32` (essentially +/// giving the `i64`'s value modulo `i32::MAX`) or by simply returning +/// `i32::MAX`, or by some other method. The `From` trait is intended +/// for lossless conversions, so the `TryFrom` trait informs the +/// programmer when a type conversion could go bad and lets them +/// decide how to handle it. +/// +/// # Generic Implementations +/// +/// - `TryFrom for U` implies [`TryInto`]` for T` +/// - [`try_from`] is reflexive, which means that `TryFrom for T` +/// is implemented +/// +/// # Examples +/// +/// As described, [`i32`] implements `TryFrom`: +/// +/// ``` +/// let big_number = 1_000_000_000_000i64; +/// // Silently truncates `big_number`, requires detecting +/// // and handling the truncation after the fact. +/// let smaller_number = big_number as i32; +/// assert_eq!(smaller_number, -727379968); +/// +/// let try_smaller_number = i32::try_from(big_number); +/// assert!(try_smaller_number.is_err()); +/// +/// let try_successful_smaller_number = i32::try_from(3); +/// assert!(try_successful_smaller_number.is_ok()); +/// ``` #[stable(feature = "try_from", since = "1.34.0")] pub trait TryFrom: Sized { /// The type returned in the event of a conversion error. From 12532277d5bde13c19d3b40d34c07ec78c79ff71 Mon Sep 17 00:00:00 2001 From: Simon Heath Date: Wed, 30 Jan 2019 20:19:01 -0500 Subject: [PATCH 088/381] Add basic docs to integer TryFrom impl macros. They're not as good as `From` 'cause they don't stringify the types and generate examples and so on, but it's a start. --- src/libcore/num/mod.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 3ceba83afeef..39a1b48e0766 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -4544,6 +4544,9 @@ macro_rules! try_from_unbounded { impl TryFrom<$source> for $target { type Error = TryFromIntError; + /// Try to create the target type from the source type. + /// This particular variant will never fail, but is included + /// for completeness's sake. #[inline] fn try_from(value: $source) -> Result { Ok(value as $target) @@ -4559,6 +4562,10 @@ macro_rules! try_from_lower_bounded { impl TryFrom<$source> for $target { type Error = TryFromIntError; + /// Try to create a target number type from a + /// source type that has `source::MIN > dest::MIN`. + /// Will return an error if `source` is less than + /// `dest::MIN`. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { if u >= 0 { @@ -4578,6 +4585,10 @@ macro_rules! try_from_upper_bounded { impl TryFrom<$source> for $target { type Error = TryFromIntError; + /// Try to create a target number type from a + /// source type that has `source::MAX > dest::MAX`. + /// Will return an error if `source` is greater than + /// `dest::MAX`. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { if u > (<$target>::max_value() as $source) { @@ -4597,6 +4608,11 @@ macro_rules! try_from_both_bounded { impl TryFrom<$source> for $target { type Error = TryFromIntError; + /// Try to "narrow" a number from the source type + /// to the target type. Will return an error if + /// the source value is either larger than the + /// `MAX` value for the target type or smaller + /// than the `MIN` value for it. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { let min = <$target>::min_value() as $source; From c1d1c6731c22a2840eecd72b9bfb4ffc6f05647b Mon Sep 17 00:00:00 2001 From: Simon Heath Date: Thu, 31 Jan 2019 21:47:18 -0500 Subject: [PATCH 089/381] Fix a bunch of heckin' trailing whitespace --- src/libcore/convert.rs | 24 ++++++++++++------------ src/libcore/num/mod.rs | 10 +++++----- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index a3f1a3201f31..f64f2fb3e9fa 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -366,9 +366,9 @@ pub trait From: Sized { /// provides an equivalent `TryInto` implementation for free, thanks to a /// blanket implementation in the standard library. For more information on this, /// see the documentation for [`Into`]. -/// +/// /// # Implementing `TryInto` -/// +/// /// This suffers the same restrictions and reasoning as implementing /// [`Into`], see there for details. /// @@ -387,25 +387,25 @@ pub trait TryInto: Sized { /// Simple and safe type conversions that may fail in a controlled /// way under some circumstances. It is the reciprocal of [`TryInto`]. -/// -/// This is useful when you are doing a type conversion that may +/// +/// This is useful when you are doing a type conversion that may /// trivially succeed but may also need special handling. /// For example, there is no way to convert an `i64` into an `i32` /// using the [`From`] trait, because an `i64` may contain a value /// that an `i32` cannot represent and so the conversion would lose data. /// This might be handled by truncating the `i64` to an `i32` (essentially -/// giving the `i64`'s value modulo `i32::MAX`) or by simply returning -/// `i32::MAX`, or by some other method. The `From` trait is intended -/// for lossless conversions, so the `TryFrom` trait informs the +/// giving the `i64`'s value modulo `i32::MAX`) or by simply returning +/// `i32::MAX`, or by some other method. The `From` trait is intended +/// for lossless conversions, so the `TryFrom` trait informs the /// programmer when a type conversion could go bad and lets them /// decide how to handle it. -/// +/// /// # Generic Implementations /// /// - `TryFrom for U` implies [`TryInto`]` for T` -/// - [`try_from`] is reflexive, which means that `TryFrom for T` +/// - [`try_from`] is reflexive, which means that `TryFrom for T` /// is implemented -/// +/// /// # Examples /// /// As described, [`i32`] implements `TryFrom`: @@ -416,10 +416,10 @@ pub trait TryInto: Sized { /// // and handling the truncation after the fact. /// let smaller_number = big_number as i32; /// assert_eq!(smaller_number, -727379968); -/// +/// /// let try_smaller_number = i32::try_from(big_number); /// assert!(try_smaller_number.is_err()); -/// +/// /// let try_successful_smaller_number = i32::try_from(3); /// assert!(try_successful_smaller_number.is_ok()); /// ``` diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 39a1b48e0766..d8e230abaf9b 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -4564,7 +4564,7 @@ macro_rules! try_from_lower_bounded { /// Try to create a target number type from a /// source type that has `source::MIN > dest::MIN`. - /// Will return an error if `source` is less than + /// Will return an error if `source` is less than /// `dest::MIN`. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { @@ -4587,7 +4587,7 @@ macro_rules! try_from_upper_bounded { /// Try to create a target number type from a /// source type that has `source::MAX > dest::MAX`. - /// Will return an error if `source` is greater than + /// Will return an error if `source` is greater than /// `dest::MAX`. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { @@ -4609,9 +4609,9 @@ macro_rules! try_from_both_bounded { type Error = TryFromIntError; /// Try to "narrow" a number from the source type - /// to the target type. Will return an error if - /// the source value is either larger than the - /// `MAX` value for the target type or smaller + /// to the target type. Will return an error if + /// the source value is either larger than the + /// `MAX` value for the target type or smaller /// than the `MIN` value for it. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { From cc6f394d6f1ea4f452a944685d422125a5f71ac3 Mon Sep 17 00:00:00 2001 From: Simon Heath Date: Wed, 13 Feb 2019 12:52:35 -0500 Subject: [PATCH 090/381] Fix some links in TryFrom docs. --- src/libcore/convert.rs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index f64f2fb3e9fa..4716aea1cdd5 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -361,11 +361,12 @@ pub trait From: Sized { /// An attempted conversion that consumes `self`, which may or may not be /// expensive. /// -/// Library authors should not directly implement this trait, but should prefer -/// implementing the [`TryFrom`] trait, which offers greater flexibility and -/// provides an equivalent `TryInto` implementation for free, thanks to a -/// blanket implementation in the standard library. For more information on this, -/// see the documentation for [`Into`]. +/// Library authors should usually not directly implement this trait, +/// but should prefer implementing the [`TryFrom`] trait, which offers +/// greater flexibility and provides an equivalent `TryInto` +/// implementation for free, thanks to a blanket implementation in the +/// standard library. For more information on this, see the +/// documentation for [`Into`]. /// /// # Implementing `TryInto` /// @@ -396,7 +397,7 @@ pub trait TryInto: Sized { /// This might be handled by truncating the `i64` to an `i32` (essentially /// giving the `i64`'s value modulo `i32::MAX`) or by simply returning /// `i32::MAX`, or by some other method. The `From` trait is intended -/// for lossless conversions, so the `TryFrom` trait informs the +/// for perfect conversions, so the `TryFrom` trait informs the /// programmer when a type conversion could go bad and lets them /// decide how to handle it. /// @@ -404,7 +405,8 @@ pub trait TryInto: Sized { /// /// - `TryFrom for U` implies [`TryInto`]` for T` /// - [`try_from`] is reflexive, which means that `TryFrom for T` -/// is implemented +/// is implemented and cannot fail -- the associated `Error` type for +/// calling `T::try_from()` on a value of type `T` is `!`. /// /// # Examples /// @@ -417,12 +419,18 @@ pub trait TryInto: Sized { /// let smaller_number = big_number as i32; /// assert_eq!(smaller_number, -727379968); /// +/// // Returns an error because `big_number` is too big to +/// // fit in an `i32`. /// let try_smaller_number = i32::try_from(big_number); /// assert!(try_smaller_number.is_err()); /// +/// // Returns `Ok(3)`. /// let try_successful_smaller_number = i32::try_from(3); /// assert!(try_successful_smaller_number.is_ok()); /// ``` +/// +/// [`try_from`]: trait.TryFrom.html#tymethod.try_from +/// [`TryInto`]: trait.TryInto.html #[stable(feature = "try_from", since = "1.34.0")] pub trait TryFrom: Sized { /// The type returned in the event of a conversion error. From 72afe51d81dd0824a009e378e9142ca7236806aa Mon Sep 17 00:00:00 2001 From: Simon Heath Date: Thu, 14 Feb 2019 09:19:03 -0500 Subject: [PATCH 091/381] Slowly figuring out how rustdoc actually works. Unfortunately trying to run doctests on my local machine is not really faster than letting Travis do it... --- src/libcore/convert.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 4716aea1cdd5..a9d1d01ccbb4 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -413,6 +413,9 @@ pub trait TryInto: Sized { /// As described, [`i32`] implements `TryFrom`: /// /// ``` +/// #![feature(try_from)] +/// use std::convert::TryFrom; +/// /// let big_number = 1_000_000_000_000i64; /// // Silently truncates `big_number`, requires detecting /// // and handling the truncation after the fact. From 60cf413a20392ae38ffbf945e3d77f892655a74f Mon Sep 17 00:00:00 2001 From: Simon Heath Date: Tue, 26 Feb 2019 23:47:55 -0500 Subject: [PATCH 092/381] Incorporated review changes. --- src/libcore/convert.rs | 4 +++- src/libcore/num/mod.rs | 48 ++++++++++++++++++++++++++++-------------- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index a9d1d01ccbb4..0fc182348c6c 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -406,7 +406,9 @@ pub trait TryInto: Sized { /// - `TryFrom for U` implies [`TryInto`]` for T` /// - [`try_from`] is reflexive, which means that `TryFrom for T` /// is implemented and cannot fail -- the associated `Error` type for -/// calling `T::try_from()` on a value of type `T` is `!`. +/// calling `T::try_from()` on a value of type `T` is `Infallible`. +/// When the `!` type is stablized `Infallible` and `!` will be +/// equivalent. /// /// # Examples /// diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index d8e230abaf9b..4a2f958b93fe 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -4544,9 +4544,14 @@ macro_rules! try_from_unbounded { impl TryFrom<$source> for $target { type Error = TryFromIntError; - /// Try to create the target type from the source type. - /// This particular variant will never fail, but is included - /// for completeness's sake. + /// Try to create the target number type from a source + /// number type. If the source type has a larger range + /// than the target, or their ranges are disjoint (such + /// as converting a signed to unsigned number or vice + /// versa), this will return `None` if the source value + /// doesn't fit into the range of the destination value. + /// If the conversion can never fail, this is still + /// implemented for completeness's sake. #[inline] fn try_from(value: $source) -> Result { Ok(value as $target) @@ -4562,10 +4567,14 @@ macro_rules! try_from_lower_bounded { impl TryFrom<$source> for $target { type Error = TryFromIntError; - /// Try to create a target number type from a - /// source type that has `source::MIN > dest::MIN`. - /// Will return an error if `source` is less than - /// `dest::MIN`. + /// Try to create the target number type from a source + /// number type. If the source type has a larger range + /// than the target, or their ranges are disjoint (such + /// as converting a signed to unsigned number or vice + /// versa), this will return `None` if the source value + /// doesn't fit into the range of the destination value. + /// If the conversion can never fail, this is still + /// implemented for completeness's sake. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { if u >= 0 { @@ -4585,10 +4594,14 @@ macro_rules! try_from_upper_bounded { impl TryFrom<$source> for $target { type Error = TryFromIntError; - /// Try to create a target number type from a - /// source type that has `source::MAX > dest::MAX`. - /// Will return an error if `source` is greater than - /// `dest::MAX`. + /// Try to create the target number type from a source + /// number type. If the source type has a larger range + /// than the target, or their ranges are disjoint (such + /// as converting a signed to unsigned number or vice + /// versa), this will return `None` if the source value + /// doesn't fit into the range of the destination value. + /// If the conversion can never fail, this is still + /// implemented for completeness's sake. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { if u > (<$target>::max_value() as $source) { @@ -4608,11 +4621,14 @@ macro_rules! try_from_both_bounded { impl TryFrom<$source> for $target { type Error = TryFromIntError; - /// Try to "narrow" a number from the source type - /// to the target type. Will return an error if - /// the source value is either larger than the - /// `MAX` value for the target type or smaller - /// than the `MIN` value for it. + /// Try to create the target number type from a source + /// number type. If the source type has a larger range + /// than the target, or their ranges are disjoint (such + /// as converting a signed to unsigned number or vice + /// versa), this will return `None` if the source value + /// doesn't fit into the range of the destination value. + /// If the conversion can never fail, this is still + /// implemented for completeness's sake. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { let min = <$target>::min_value() as $source; From 5dce719520a49b305b668a00ad25cb4731048670 Mon Sep 17 00:00:00 2001 From: Simon Heath Date: Wed, 27 Feb 2019 09:54:37 -0500 Subject: [PATCH 093/381] Vastly simplify TryFrom docs. --- src/libcore/num/mod.rs | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 4a2f958b93fe..d08aa079dbd1 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -4545,13 +4545,8 @@ macro_rules! try_from_unbounded { type Error = TryFromIntError; /// Try to create the target number type from a source - /// number type. If the source type has a larger range - /// than the target, or their ranges are disjoint (such - /// as converting a signed to unsigned number or vice - /// versa), this will return `None` if the source value - /// doesn't fit into the range of the destination value. - /// If the conversion can never fail, this is still - /// implemented for completeness's sake. + /// number type. This returns an error if the source value + /// is outside of the range of the target type. #[inline] fn try_from(value: $source) -> Result { Ok(value as $target) @@ -4568,13 +4563,8 @@ macro_rules! try_from_lower_bounded { type Error = TryFromIntError; /// Try to create the target number type from a source - /// number type. If the source type has a larger range - /// than the target, or their ranges are disjoint (such - /// as converting a signed to unsigned number or vice - /// versa), this will return `None` if the source value - /// doesn't fit into the range of the destination value. - /// If the conversion can never fail, this is still - /// implemented for completeness's sake. + /// number type. This returns an error if the source value + /// is outside of the range of the target type. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { if u >= 0 { @@ -4595,13 +4585,8 @@ macro_rules! try_from_upper_bounded { type Error = TryFromIntError; /// Try to create the target number type from a source - /// number type. If the source type has a larger range - /// than the target, or their ranges are disjoint (such - /// as converting a signed to unsigned number or vice - /// versa), this will return `None` if the source value - /// doesn't fit into the range of the destination value. - /// If the conversion can never fail, this is still - /// implemented for completeness's sake. + /// number type. This returns an error if the source value + /// is outside of the range of the target type. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { if u > (<$target>::max_value() as $source) { @@ -4622,13 +4607,8 @@ macro_rules! try_from_both_bounded { type Error = TryFromIntError; /// Try to create the target number type from a source - /// number type. If the source type has a larger range - /// than the target, or their ranges are disjoint (such - /// as converting a signed to unsigned number or vice - /// versa), this will return `None` if the source value - /// doesn't fit into the range of the destination value. - /// If the conversion can never fail, this is still - /// implemented for completeness's sake. + /// number type. This returns an error if the source value + /// is outside of the range of the target type. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { let min = <$target>::min_value() as $source; From cd56472cc47981e62c684ceada7922ac3731b785 Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Tue, 26 Feb 2019 17:02:28 +0000 Subject: [PATCH 094/381] Fix tidy check for language and library features --- src/tools/tidy/src/unstable_book.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/tools/tidy/src/unstable_book.rs b/src/tools/tidy/src/unstable_book.rs index 63196eda7cc5..cd60f36b1d27 100644 --- a/src/tools/tidy/src/unstable_book.rs +++ b/src/tools/tidy/src/unstable_book.rs @@ -82,25 +82,27 @@ pub fn check(path: &path::Path, bad: &mut bool) { !lang_features.contains_key(name) }).collect(); + // Library features let unstable_lib_feature_names = collect_unstable_feature_names(&lib_features); let unstable_book_lib_features_section_file_names = collect_unstable_book_lib_features_section_file_names(path); - // Check for Unstable Book sections that don't have a corresponding unstable feature - for feature_name in &unstable_book_lib_features_section_file_names - - &unstable_lib_feature_names { - tidy_error!(bad, - "The Unstable Book has a 'library feature' section '{}' which doesn't \ - correspond to an unstable library feature", - feature_name) - } - // Language features - let unstable_lang_feature_names = collect_unstable_feature_names(&lang_features); let unstable_book_lang_features_section_file_names = collect_unstable_book_lang_features_section_file_names(path); + // Check for Unstable Book sections that don't have a corresponding unstable feature + for feature_name in &unstable_book_lib_features_section_file_names - + &unstable_lib_feature_names { + if !unstable_lang_feature_names.contains(&feature_name) { + tidy_error!(bad, + "The Unstable Book has a 'library feature' section '{}' which doesn't \ + correspond to an unstable library feature", + feature_name); + } + } + // Check for Unstable Book sections that don't have a corresponding unstable feature. for feature_name in &unstable_book_lang_features_section_file_names - &unstable_lang_feature_names { From 58147d486bc26eb59d18d8e0d83aa6fe0b467fb9 Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Fri, 30 Nov 2018 15:53:44 +0000 Subject: [PATCH 095/381] Support defining C compatible variadic functions Add support for defining C compatible variadic functions in unsafe rust with extern "C". --- src/librustc/hir/intravisit.rs | 3 + src/librustc/hir/lowering.rs | 6 + src/librustc/hir/mod.rs | 3 + src/librustc/hir/print.rs | 3 + src/librustc/ich/impls_hir.rs | 3 +- src/librustc/middle/resolve_lifetime.rs | 31 ++- src/librustc/ty/sty.rs | 6 +- src/librustc_codegen_llvm/abi.rs | 45 +++- src/librustc_codegen_llvm/intrinsic.rs | 51 ++++- src/librustc_codegen_llvm/mono_item.rs | 8 +- src/librustc_codegen_llvm/va_arg.rs | 4 +- src/librustc_codegen_ssa/mir/block.rs | 50 ++++- src/librustc_codegen_ssa/mir/mod.rs | 64 +++++- src/librustc_codegen_ssa/traits/intrinsic.rs | 6 + src/librustc_lint/types.rs | 9 +- .../borrow_check/nll/type_check/mod.rs | 11 +- src/librustc_save_analysis/sig.rs | 1 + src/librustc_target/abi/call/mod.rs | 17 +- src/librustc_target/abi/call/x86.rs | 2 +- src/librustc_typeck/astconv.rs | 9 + src/librustc_typeck/check/callee.rs | 14 +- src/librustc_typeck/check/intrinsic.rs | 6 +- src/librustdoc/clean/mod.rs | 8 +- src/librustdoc/html/format.rs | 22 +- src/libsyntax/ast.rs | 2 + src/libsyntax/mut_visit.rs | 3 +- src/libsyntax/parse/parser.rs | 106 +++++----- src/libsyntax/print/pprust.rs | 3 + src/libsyntax/visit.rs | 2 +- src/test/codegen/c-variadic.rs | 69 ++++++ .../c-link-to-rust-va-list-fn/checkrust.rs | 27 ++- .../c-link-to-rust-va-list-fn/test.c | 10 + src/test/rustdoc/variadic.rs | 2 +- .../variadic-ffi-1.rs} | 0 .../variadic-ffi-1.stderr} | 2 +- .../variadic-ffi-2.rs | 0 .../variadic-ffi-2.stderr | 0 .../variadic-ffi-3.rs | 4 +- .../variadic-ffi-3.stderr | 18 +- src/test/ui/c-variadic/variadic-ffi-4.rs | 29 +++ src/test/ui/c-variadic/variadic-ffi-4.stderr | 198 ++++++++++++++++++ src/test/ui/c-variadic/variadic-ffi-5.rs | 31 +++ src/test/ui/c-variadic/variadic-ffi-5.stderr | 73 +++++++ src/test/ui/c-variadic/variadic-ffi-6.rs | 12 ++ src/test/ui/c-variadic/variadic-ffi-6.stderr | 11 + src/test/ui/error-codes/E0617.rs | 4 +- src/test/ui/error-codes/E0617.stderr | 8 +- src/test/ui/parser/recover-enum2.stderr | 4 +- 48 files changed, 848 insertions(+), 152 deletions(-) create mode 100644 src/test/codegen/c-variadic.rs rename src/test/ui/{variadic/variadic-ffi.rs => c-variadic/variadic-ffi-1.rs} (100%) rename src/test/ui/{variadic/variadic-ffi.stderr => c-variadic/variadic-ffi-1.stderr} (91%) rename src/test/ui/{variadic => c-variadic}/variadic-ffi-2.rs (100%) rename src/test/ui/{variadic => c-variadic}/variadic-ffi-2.stderr (100%) rename src/test/ui/{variadic => c-variadic}/variadic-ffi-3.rs (85%) rename src/test/ui/{variadic => c-variadic}/variadic-ffi-3.stderr (90%) create mode 100644 src/test/ui/c-variadic/variadic-ffi-4.rs create mode 100644 src/test/ui/c-variadic/variadic-ffi-4.stderr create mode 100644 src/test/ui/c-variadic/variadic-ffi-5.rs create mode 100644 src/test/ui/c-variadic/variadic-ffi-5.stderr create mode 100644 src/test/ui/c-variadic/variadic-ffi-6.rs create mode 100644 src/test/ui/c-variadic/variadic-ffi-6.stderr diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 0bc40da7e4f2..8e4b9a5e8e64 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -617,6 +617,9 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) { TyKind::Typeof(ref expression) => { visitor.visit_anon_const(expression) } + TyKind::CVarArgs(ref lt) => { + visitor.visit_lifetime(lt) + } TyKind::Infer | TyKind::Err => {} } } diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 0211dd728756..0e2b34d4facf 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -1345,6 +1345,12 @@ impl<'a> LoweringContext<'a> { } } TyKind::Mac(_) => panic!("TyMac should have been expanded by now."), + TyKind::CVarArgs => { + // Create the implicit lifetime of the "spoofed" `VaList`. + let span = self.sess.source_map().next_point(t.span.shrink_to_lo()); + let lt = self.new_implicit_lifetime(span); + hir::TyKind::CVarArgs(lt) + }, }; let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(t.id); diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 38e6e61592b1..205109d18fe2 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1829,6 +1829,9 @@ pub enum TyKind { Infer, /// Placeholder for a type that has failed to be defined. Err, + /// Placeholder for C-variadic arguments. We "spoof" the `VaList` created + /// from the variadic arguments. This type is only valid up to typeck. + CVarArgs(Lifetime), } #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 17d374884134..8c252b0d0274 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -434,6 +434,9 @@ impl<'a> State<'a> { self.s.word("/*ERROR*/")?; self.pclose()?; } + hir::TyKind::CVarArgs(_) => { + self.s.word("...")?; + } } self.end() } diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index d1161dda1e2f..b7ec5889d6ae 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -361,7 +361,8 @@ impl_stable_hash_for!(enum hir::TyKind { TraitObject(trait_refs, lifetime), Typeof(body_id), Err, - Infer + Infer, + CVarArgs(lt), }); impl_stable_hash_for!(struct hir::FnDecl { diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 31e9eb9b7463..832391d44162 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -764,6 +764,13 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { }); } } + hir::TyKind::CVarArgs(ref lt) => { + // Resolve the generated lifetime for the C-variadic arguments. + // The lifetime is generated in AST -> HIR lowering. + if lt.name.is_elided() { + self.resolve_elided_lifetimes(vec![lt]) + } + } _ => intravisit::walk_ty(self, ty), } } @@ -2225,18 +2232,22 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { if let hir::TyKind::BareFn(_) = ty.node { self.outer_index.shift_in(1); } - if let hir::TyKind::TraitObject(ref bounds, ref lifetime) = ty.node { - for bound in bounds { - self.visit_poly_trait_ref(bound, hir::TraitBoundModifier::None); - } + match ty.node { + hir::TyKind::TraitObject(ref bounds, ref lifetime) => { + for bound in bounds { + self.visit_poly_trait_ref(bound, hir::TraitBoundModifier::None); + } - // Stay on the safe side and don't include the object - // lifetime default (which may not end up being used). - if !lifetime.is_elided() { - self.visit_lifetime(lifetime); + // Stay on the safe side and don't include the object + // lifetime default (which may not end up being used). + if !lifetime.is_elided() { + self.visit_lifetime(lifetime); + } + } + hir::TyKind::CVarArgs(_) => {} + _ => { + intravisit::walk_ty(self, ty); } - } else { - intravisit::walk_ty(self, ty); } if let hir::TyKind::BareFn(_) = ty.node { self.outer_index.shift_out(1); diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index df8b14b1f10c..7ade035ce890 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -977,9 +977,9 @@ impl<'tcx> PolyGenSig<'tcx> { /// Signature of a function type, which I have arbitrarily /// decided to use to refer to the input/output types. /// -/// - `inputs` is the list of arguments and their modes. -/// - `output` is the return type. -/// - `variadic` indicates whether this is a variadic function. (only true for foreign fns) +/// - `inputs`: is the list of arguments and their modes. +/// - `output`: is the return type. +/// - `variadic`: indicates whether this is a C-variadic function. #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] pub struct FnSig<'tcx> { pub inputs_and_output: &'tcx List>, diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs index 992149f7a47b..aea62360651c 100644 --- a/src/librustc_codegen_llvm/abi.rs +++ b/src/librustc_codegen_llvm/abi.rs @@ -258,7 +258,7 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> { val }; match self.mode { - PassMode::Ignore => {}, + PassMode::Ignore(_) => {} PassMode::Pair(..) => { OperandValue::Pair(next(), next()).store(bx, dst); } @@ -507,6 +507,14 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { } }; + // Store the index of the last argument. This is useful for working with + // C-compatible variadic arguments. + let last_arg_idx = if sig.inputs().is_empty() { + None + } else { + Some(sig.inputs().len() - 1) + }; + let arg_of = |ty: Ty<'tcx>, arg_idx: Option| { let is_return = arg_idx.is_none(); let mut arg = mk_arg_type(ty, arg_idx); @@ -516,7 +524,30 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { // The same is true for s390x-unknown-linux-gnu // and sparc64-unknown-linux-gnu. if is_return || rust_abi || (!win_x64_gnu && !linux_s390x && !linux_sparc64) { - arg.mode = PassMode::Ignore; + arg.mode = PassMode::Ignore(IgnoreMode::Zst); + } + } + + // If this is a C-variadic function, this is not the return value, + // and there is one or more fixed arguments; ensure that the `VaList` + // is ignored as an argument. + if sig.variadic { + match (last_arg_idx, arg_idx) { + (Some(last_idx), Some(cur_idx)) if last_idx == cur_idx => { + let va_list_did = match cx.tcx.lang_items().va_list() { + Some(did) => did, + None => bug!("`va_list` lang item required for C-variadic functions"), + }; + match ty.sty { + ty::Adt(def, _) if def.did == va_list_did => { + // This is the "spoofed" `VaList`. Set the arguments mode + // so that it will be ignored. + arg.mode = PassMode::Ignore(IgnoreMode::CVarArgs); + }, + _ => (), + } + } + _ => {} } } @@ -646,7 +677,9 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { ); let llreturn_ty = match self.ret.mode { - PassMode::Ignore => cx.type_void(), + PassMode::Ignore(IgnoreMode::Zst) => cx.type_void(), + PassMode::Ignore(IgnoreMode::CVarArgs) => + bug!("`va_list` should never be a return type"), PassMode::Direct(_) | PassMode::Pair(..) => { self.ret.layout.immediate_llvm_type(cx) } @@ -664,7 +697,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { } let llarg_ty = match arg.mode { - PassMode::Ignore => continue, + PassMode::Ignore(_) => continue, PassMode::Direct(_) => arg.layout.immediate_llvm_type(cx), PassMode::Pair(..) => { llargument_tys.push(arg.layout.scalar_pair_element_llvm_type(cx, 0, true)); @@ -733,7 +766,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { apply(&ArgAttributes::new()); } match arg.mode { - PassMode::Ignore => {} + PassMode::Ignore(_) => {} PassMode::Direct(ref attrs) | PassMode::Indirect(ref attrs, None) => apply(attrs), PassMode::Indirect(ref attrs, Some(ref extra_attrs)) => { @@ -780,7 +813,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { apply(&ArgAttributes::new()); } match arg.mode { - PassMode::Ignore => {} + PassMode::Ignore(_) => {} PassMode::Direct(ref attrs) | PassMode::Indirect(ref attrs, None) => apply(attrs), PassMode::Indirect(ref attrs, Some(ref extra_attrs)) => { diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index d1cbe1d4dd68..3268af396a2f 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -136,22 +136,18 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { let tp_ty = substs.type_at(0); self.const_usize(self.size_of(tp_ty).bytes()) } - func @ "va_start" | func @ "va_end" => { - let va_list = match (tcx.lang_items().va_list(), &result.layout.ty.sty) { - (Some(did), ty::Adt(def, _)) if def.did == did => args[0].immediate(), - (Some(_), _) => self.load(args[0].immediate(), - tcx.data_layout.pointer_align.abi), - (None, _) => bug!("va_list language item must be defined") - }; - let intrinsic = self.cx().get_intrinsic(&format!("llvm.{}", func)); - self.call(intrinsic, &[va_list], None) + "va_start" => { + self.va_start(args[0].immediate()) + } + "va_end" => { + self.va_end(args[0].immediate()) } "va_copy" => { let va_list = match (tcx.lang_items().va_list(), &result.layout.ty.sty) { (Some(did), ty::Adt(def, _)) if def.did == did => args[0].immediate(), (Some(_), _) => self.load(args[0].immediate(), tcx.data_layout.pointer_align.abi), - (None, _) => bug!("va_list language item must be defined") + (None, _) => bug!("`va_list` language item must be defined") }; let intrinsic = self.cx().get_intrinsic(&("llvm.va_copy")); self.call(intrinsic, &[llresult, va_list], None); @@ -722,6 +718,41 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { let expect = self.get_intrinsic(&"llvm.expect.i1"); self.call(expect, &[cond, self.const_bool(expected)], None) } + + fn va_start(&mut self, list: &'ll Value) -> &'ll Value { + let target = &self.cx.tcx.sess.target.target; + let arch = &target.arch; + // A pointer to the architecture specific structure is passed to this + // function. For pointer variants (i686, RISC-V, Windows, etc), we + // should do do nothing, as the address to the pointer is needed. For + // architectures with a architecture specific structure (`Aarch64`, + // `X86_64`, etc), this function should load the structure from the + // address provided. + let va_list = match &**arch { + _ if target.options.is_like_windows => list, + "aarch64" if target.target_os == "ios" => list, + "aarch64" | "x86_64" | "powerpc" => + self.load(list, self.tcx().data_layout.pointer_align.abi), + _ => list, + }; + let intrinsic = self.cx().get_intrinsic("llvm.va_start"); + self.call(intrinsic, &[va_list], None) + } + + fn va_end(&mut self, list: &'ll Value) -> &'ll Value { + let target = &self.cx.tcx.sess.target.target; + let arch = &target.arch; + // See the comment in `va_start` for the purpose of the following. + let va_list = match &**arch { + _ if target.options.is_like_windows => list, + "aarch64" if target.target_os == "ios" => list, + "aarch64" | "x86_64" | "powerpc" => + self.load(list, self.tcx().data_layout.pointer_align.abi), + _ => list, + }; + let intrinsic = self.cx().get_intrinsic("llvm.va_end"); + self.call(intrinsic, &[va_list], None) + } } fn copy_intrinsic( diff --git a/src/librustc_codegen_llvm/mono_item.rs b/src/librustc_codegen_llvm/mono_item.rs index 4fe6a1f4f4b1..7f0cdb9f5800 100644 --- a/src/librustc_codegen_llvm/mono_item.rs +++ b/src/librustc_codegen_llvm/mono_item.rs @@ -36,10 +36,10 @@ impl PreDefineMethods<'tcx> for CodegenCx<'ll, 'tcx> { } fn predefine_fn(&self, - instance: Instance<'tcx>, - linkage: Linkage, - visibility: Visibility, - symbol_name: &str) { + instance: Instance<'tcx>, + linkage: Linkage, + visibility: Visibility, + symbol_name: &str) { assert!(!instance.substs.needs_infer() && !instance.substs.has_param_types()); diff --git a/src/librustc_codegen_llvm/va_arg.rs b/src/librustc_codegen_llvm/va_arg.rs index 8719390b51ac..7aceaea4510c 100644 --- a/src/librustc_codegen_llvm/va_arg.rs +++ b/src/librustc_codegen_llvm/va_arg.rs @@ -109,12 +109,12 @@ pub(super) fn emit_va_arg( Align::from_bytes(4).unwrap(), true) } // Windows Aarch64 - ("aarch4", true) => { + ("aarch64", true) => { emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(8).unwrap(), false) } // iOS Aarch64 - ("aarch4", _) if target.target_os == "ios" => { + ("aarch64", _) if target.target_os == "ios" => { emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(8).unwrap(), true) } diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index caca1789fc98..f40aa0cb6d12 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -3,7 +3,7 @@ use rustc::ty::{self, Ty, TypeFoldable}; use rustc::ty::layout::{self, LayoutOf, HasTyCtxt}; use rustc::mir; use rustc::mir::interpret::EvalErrorKind; -use rustc_target::abi::call::{ArgType, FnType, PassMode}; +use rustc_target::abi::call::{ArgType, FnType, PassMode, IgnoreMode}; use rustc_target::spec::abi::Abi; use rustc_mir::monomorphize; use crate::base; @@ -18,7 +18,7 @@ use syntax_pos::Pos; use super::{FunctionCx, LocalRef}; use super::place::PlaceRef; -use super::operand::OperandRef; +use super::operand::{OperandValue, OperandRef}; use super::operand::OperandValue::{Pair, Ref, Immediate}; impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { @@ -232,12 +232,21 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } mir::TerminatorKind::Return => { + if self.fn_ty.variadic { + if let Some(va_list) = self.va_list_ref { + bx.va_end(va_list.llval); + } + } let llval = match self.fn_ty.ret.mode { - PassMode::Ignore | PassMode::Indirect(..) => { + PassMode::Ignore(IgnoreMode::Zst) | PassMode::Indirect(..) => { bx.ret_void(); return; } + PassMode::Ignore(IgnoreMode::CVarArgs) => { + bug!("C variadic arguments should never be the return type"); + } + PassMode::Direct(_) | PassMode::Pair(..) => { let op = self.codegen_consume(&mut bx, &mir::Place::Local(mir::RETURN_PLACE)); @@ -481,7 +490,10 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { return; } - let extra_args = &args[sig.inputs().len()..]; + // The "spoofed" `VaList` added to a C-variadic functions signature + // should not be included in the `extra_args` calculation. + let extra_args_start_idx = sig.inputs().len() - if sig.variadic { 1 } else { 0 }; + let extra_args = &args[extra_args_start_idx..]; let extra_args = extra_args.iter().map(|op_arg| { let op_ty = op_arg.ty(self.mir, bx.tcx()); self.monomorphize(&op_ty) @@ -658,7 +670,37 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { (&args[..], None) }; + // Useful determining if the current argument is the "spoofed" `VaList` + let last_arg_idx = if sig.inputs().is_empty() { + None + } else { + Some(sig.inputs().len() - 1) + }; 'make_args: for (i, arg) in first_args.iter().enumerate() { + // If this is a C-variadic function the function signature contains + // an "spoofed" `VaList`. This argument is ignored, but we need to + // populate it with a dummy operand so that the users real arguments + // are not overwritten. + let i = if sig.variadic && last_arg_idx.map(|x| x == i).unwrap_or(false) { + let layout = match tcx.lang_items().va_list() { + Some(did) => bx.cx().layout_of(bx.tcx().type_of(did)), + None => bug!("va_list language item required for C variadics"), + }; + let op = OperandRef { + val: OperandValue::Immediate( + bx.cx().const_undef(bx.cx().immediate_backend_type(layout)) + ), + layout: layout, + }; + self.codegen_argument(&mut bx, op, &mut llargs, &fn_ty.args[i]); + if i + 1 < fn_ty.args.len() { + i + 1 + } else { + break 'make_args + } + } else { + i + }; let mut op = self.codegen_operand(&mut bx, arg); if let (0, Some(ty::InstanceDef::Virtual(_, idx))) = (i, def) { diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index e1528921a596..95cf8cfe2d03 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -5,7 +5,7 @@ use rustc::mir::{self, Mir}; use rustc::ty::subst::SubstsRef; use rustc::session::config::DebugInfo; use rustc_mir::monomorphize::Instance; -use rustc_target::abi::call::{FnType, PassMode}; +use rustc_target::abi::call::{FnType, PassMode, IgnoreMode}; use crate::base; use crate::debuginfo::{self, VariableAccess, VariableKind, FunctionDebugContext}; use crate::traits::*; @@ -86,6 +86,10 @@ pub struct FunctionCx<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> { /// If this function is being monomorphized, this contains the type substitutions used. param_substs: SubstsRef<'tcx>, + + /// If this function is a C-variadic function, this contains the `PlaceRef` of the + /// "spoofed" `VaList`. + va_list_ref: Option>, } impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { @@ -246,13 +250,18 @@ pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( assert!(!instance.substs.needs_infer()); instance.substs }, + va_list_ref: None, }; let memory_locals = analyze::non_ssa_locals(&fx); // Allocate variable and temp allocas fx.locals = { - let args = arg_local_refs(&mut bx, &fx, &fx.scopes, &memory_locals); + // FIXME(dlrobertson): This is ugly. Find a better way of getting the `PlaceRef` or + // `LocalRef` from `arg_local_refs` + let mut va_list_ref = None; + let args = arg_local_refs(&mut bx, &fx, &fx.scopes, &memory_locals, &mut va_list_ref); + fx.va_list_ref = va_list_ref; let mut allocate_local = |local| { let decl = &mir.local_decls[local]; @@ -433,6 +442,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( debuginfo::MirDebugScope >, memory_locals: &BitSet, + va_list_ref: &mut Option>, ) -> Vec> { let mir = fx.mir; let tcx = fx.cx.tcx(); @@ -447,6 +457,15 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( None }; + // Store the index of the last argument. This is used to + // call va_start on the va_list instead of attempting + // to store_fn_arg. + let last_arg_idx = if fx.fn_ty.args.is_empty() { + None + } else { + Some(fx.fn_ty.args.len() - 1) + }; + mir.args_iter().enumerate().map(|(arg_index, local)| { let arg_decl = &mir.local_decls[local]; @@ -510,9 +529,16 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( // of putting everything in allocas just so we can use llvm.dbg.declare. let local = |op| LocalRef::Operand(Some(op)); match arg.mode { - PassMode::Ignore => { + PassMode::Ignore(IgnoreMode::Zst) => { return local(OperandRef::new_zst(bx.cx(), arg.layout)); } + PassMode::Ignore(IgnoreMode::CVarArgs) => { + let backend_type = bx.cx().immediate_backend_type(arg.layout); + return local(OperandRef { + val: OperandValue::Immediate(bx.cx().const_undef(backend_type)), + layout: arg.layout, + }); + } PassMode::Direct(_) => { let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint); bx.set_value_name(llarg, &name); @@ -559,9 +585,35 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( indirect_operand.store(bx, tmp); tmp } else { - let tmp = PlaceRef::alloca(bx, arg.layout, &name); - bx.store_fn_arg(arg, &mut llarg_idx, tmp); - tmp + if fx.fn_ty.variadic && last_arg_idx.map(|idx| arg_index == idx).unwrap_or(false) { + let va_list_impl = match arg_decl.ty.ty_adt_def() { + Some(adt) => adt.non_enum_variant(), + None => bug!("`va_list` language item improperly constructed") + }; + match tcx.type_of(va_list_impl.fields[0].did).sty { + ty::Ref(_, ty, _) => { + // If the underlying structure the `VaList` contains is a structure, + // we need to allocate it (e.g., X86_64 on Linux). + let tmp = PlaceRef::alloca(bx, arg.layout, &name); + if let ty::Adt(..) = ty.sty { + let layout = bx.layout_of(ty); + // Create an unnamed allocation for the backing structure + // and store it in the the spoofed `VaList`. + let backing = PlaceRef::alloca(bx, layout, ""); + bx.store(backing.llval, tmp.llval, layout.align.abi); + } + // Call `va_start` on the spoofed `VaList`. + bx.va_start(tmp.llval); + *va_list_ref = Some(tmp); + tmp + } + _ => bug!("improperly constructed `va_list` lang item"), + } + } else { + let tmp = PlaceRef::alloca(bx, arg.layout, &name); + bx.store_fn_arg(arg, &mut llarg_idx, tmp); + tmp + } }; arg_scope.map(|scope| { // Is this a regular argument? diff --git a/src/librustc_codegen_ssa/traits/intrinsic.rs b/src/librustc_codegen_ssa/traits/intrinsic.rs index 3cd0c39d4139..cd5278989778 100644 --- a/src/librustc_codegen_ssa/traits/intrinsic.rs +++ b/src/librustc_codegen_ssa/traits/intrinsic.rs @@ -20,4 +20,10 @@ pub trait IntrinsicCallMethods<'tcx>: BackendTypes { fn abort(&mut self); fn assume(&mut self, val: Self::Value); fn expect(&mut self, cond: Self::Value, expected: bool) -> Self::Value; + /// Trait method used to inject `va_start` on the "spoofed" `VaList` in + /// Rust defined C-variadic functions. + fn va_start(&mut self, val: Self::Value) -> Self::Value; + /// Trait method used to inject `va_end` on the "spoofed" `VaList` before + /// Rust defined C-variadic functions return. + fn va_end(&mut self, val: Self::Value) -> Self::Value; } diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index a56c3215f9d6..fb279a5d9b87 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -766,8 +766,15 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { let def_id = self.cx.tcx.hir().local_def_id(id); let sig = self.cx.tcx.fn_sig(def_id); let sig = self.cx.tcx.erase_late_bound_regions(&sig); + let inputs = if sig.variadic { + // Don't include the spoofed `VaList` in the functions list + // of inputs. + &sig.inputs()[..sig.inputs().len() - 1] + } else { + &sig.inputs()[..] + }; - for (input_ty, input_hir) in sig.inputs().iter().zip(&decl.inputs) { + for (input_ty, input_hir) in inputs.iter().zip(&decl.inputs) { self.check_type_for_ffi_and_report_errors(input_hir.span, input_ty); } diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 4202d10aa63d..f897795d86f4 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -1602,10 +1602,17 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { from_hir_call: bool, ) { debug!("check_call_inputs({:?}, {:?})", sig, args); - if args.len() < sig.inputs().len() || (args.len() > sig.inputs().len() && !sig.variadic) { + // Do not count the `VaList` argument as a "true" argument to + // a C-variadic function. + let inputs = if sig.variadic { + &sig.inputs()[..sig.inputs().len() - 1] + } else { + &sig.inputs()[..] + }; + if args.len() < inputs.len() || (args.len() > inputs.len() && !sig.variadic) { span_mirbug!(self, term, "call to {:?} with wrong # of args", sig); } - for (n, (fn_arg, op_arg)) in sig.inputs().iter().zip(args).enumerate() { + for (n, (fn_arg, op_arg)) in inputs.iter().zip(args).enumerate() { let op_arg_ty = op_arg.ty(mir, self.tcx()); let category = if from_hir_call { ConstraintCategory::CallArgument diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs index 50a335bf9087..222c43de3b7b 100644 --- a/src/librustc_save_analysis/sig.rs +++ b/src/librustc_save_analysis/sig.rs @@ -190,6 +190,7 @@ impl Sig for ast::Ty { Ok(replace_text(nested, text)) } ast::TyKind::Never => Ok(text_sig("!".to_owned())), + ast::TyKind::CVarArgs => Ok(text_sig("...".to_owned())), ast::TyKind::Tup(ref ts) => { let mut text = "(".to_owned(); let mut defs = vec![]; diff --git a/src/librustc_target/abi/call/mod.rs b/src/librustc_target/abi/call/mod.rs index 411eb192d902..8ada328a1584 100644 --- a/src/librustc_target/abi/call/mod.rs +++ b/src/librustc_target/abi/call/mod.rs @@ -23,10 +23,18 @@ mod x86_64; mod x86_win64; mod wasm32; +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum IgnoreMode { + /// C-variadic arguments. + CVarArgs, + /// A zero-sized type. + Zst, +} + #[derive(Clone, Copy, PartialEq, Eq, Debug)] pub enum PassMode { - /// Ignore the argument (useful for empty struct). - Ignore, + /// Ignore the argument (useful for empty structs and C-variadic args). + Ignore(IgnoreMode), /// Pass the argument directly. Direct(ArgAttributes), /// Pass a pair's elements directly in two arguments. @@ -481,7 +489,10 @@ impl<'a, Ty> ArgType<'a, Ty> { } pub fn is_ignore(&self) -> bool { - self.mode == PassMode::Ignore + match self.mode { + PassMode::Ignore(_) => true, + _ => false + } } } diff --git a/src/librustc_target/abi/call/x86.rs b/src/librustc_target/abi/call/x86.rs index 2e809571ab18..6ca3ce88bd6e 100644 --- a/src/librustc_target/abi/call/x86.rs +++ b/src/librustc_target/abi/call/x86.rs @@ -88,7 +88,7 @@ pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType<'a, Ty>, flavor: Fla for arg in &mut fty.args { let attrs = match arg.mode { - PassMode::Ignore | + PassMode::Ignore(_) | PassMode::Indirect(_, None) => continue, PassMode::Direct(ref mut attrs) => attrs, PassMode::Pair(..) | diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 6f3dc8b969cf..1d99584eec49 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1822,6 +1822,15 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { hir::TyKind::Err => { tcx.types.err } + hir::TyKind::CVarArgs(lt) => { + let va_list_did = match tcx.lang_items().va_list() { + Some(did) => did, + None => span_bug!(ast_ty.span, + "`va_list` lang item required for variadics"), + }; + let region = self.ast_region_to_region(<, None); + tcx.type_of(va_list_did).subst(tcx, &[region.into()]) + } }; self.record_ty(ast_ty.hir_id, result_ty, ast_ty.span); diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index 7bf7d8254065..aeb43635eb78 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -368,17 +368,27 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .0; let fn_sig = self.normalize_associated_types_in(call_expr.span, &fn_sig); + let inputs = if fn_sig.variadic { + if fn_sig.inputs().len() > 1 { + &fn_sig.inputs()[..fn_sig.inputs().len() - 1] + } else { + span_bug!(call_expr.span, + "C-variadic functions are only valid with one or more fixed arguments"); + } + } else { + &fn_sig.inputs()[..] + }; // Call the generic checker. let expected_arg_tys = self.expected_inputs_for_expected_output( call_expr.span, expected, fn_sig.output(), - fn_sig.inputs(), + inputs, ); self.check_argument_types( call_expr.span, call_expr.span, - fn_sig.inputs(), + inputs, &expected_arg_tys[..], arg_exprs, fn_sig.variadic, diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 3b174b55f2ba..924ced2e2a3c 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -337,7 +337,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, "va_start" | "va_end" => { match mk_va_list_ty() { Some(va_list_ty) => (0, vec![va_list_ty], tcx.mk_unit()), - None => bug!("va_list lang_item must be defined to use va_list intrinsics") + None => bug!("`va_list` language item needed for C-variadic intrinsics") } } @@ -364,14 +364,14 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }; (0, vec![tcx.mk_imm_ref(tcx.mk_region(env_region), va_list_ty)], ret_ty) } - None => bug!("va_list lang_item must be defined to use va_list intrinsics") + None => bug!("`va_list` language item needed for C-variadic intrinsics") } } "va_arg" => { match mk_va_list_ty() { Some(va_list_ty) => (1, vec![va_list_ty], param(0)), - None => bug!("va_list lang_item must be defined to use va_list intrinsics") + None => bug!("`va_list` language item needed for C-variadic intrinsics") } } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 72abbae231aa..53dcc258c690 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1752,7 +1752,6 @@ impl Clean for doctree::Function { pub struct FnDecl { pub inputs: Arguments, pub output: FunctionRetTy, - pub variadic: bool, pub attrs: Attributes, } @@ -1831,7 +1830,6 @@ impl<'a, A: Copy> Clean for (&'a hir::FnDecl, A) FnDecl { inputs: (&self.0.inputs[..], self.1).clean(cx), output: self.0.output.clean(cx), - variadic: self.0.variadic, attrs: Attributes::default() } } @@ -1849,7 +1847,6 @@ impl<'a, 'tcx> Clean for (DefId, ty::PolyFnSig<'tcx>) { FnDecl { output: Return(sig.skip_binder().output().clean(cx)), attrs: Attributes::default(), - variadic: sig.skip_binder().variadic, inputs: Arguments { values: sig.skip_binder().inputs().iter().map(|t| { Argument { @@ -2252,6 +2249,7 @@ pub enum Type { Slice(Box), Array(Box, String), Never, + CVarArgs, Unique(Box), RawPointer(Mutability, Box), BorrowedRef { @@ -2290,6 +2288,7 @@ pub enum PrimitiveType { Reference, Fn, Never, + CVarArgs, } #[derive(Clone, RustcEncodable, RustcDecodable, Copy, Debug)] @@ -2469,6 +2468,7 @@ impl PrimitiveType { Reference => "reference", Fn => "fn", Never => "never", + CVarArgs => "...", } } @@ -2518,6 +2518,7 @@ impl Clean for hir::Ty { match self.node { TyKind::Never => Never, + TyKind::CVarArgs(_) => CVarArgs, TyKind::Ptr(ref m) => RawPointer(m.mutbl.clean(cx), box m.ty.clean(cx)), TyKind::Rptr(ref l, ref m) => { let lifetime = if l.is_elided() { @@ -3654,6 +3655,7 @@ fn build_deref_target_impls(cx: &DocContext<'_, '_, '_>, Reference => None, Fn => None, Never => None, + CVarArgs => tcx.lang_items().va_list(), }; if let Some(did) = did { if !did.is_local() { diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 4463dad1c8a1..d204a179ca62 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -609,6 +609,7 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter<'_>, use_absolute: bool) -> primitive_link(f, PrimitiveType::Array, &format!("; {}]", n)) } clean::Never => primitive_link(f, PrimitiveType::Never, "!"), + clean::CVarArgs => primitive_link(f, PrimitiveType::CVarArgs, "..."), clean::RawPointer(m, ref t) => { match **t { clean::Generic(_) | clean::ResolvedPath {is_generic: true, ..} => { @@ -834,18 +835,10 @@ impl fmt::Display for clean::FunctionRetTy { impl fmt::Display for clean::FnDecl { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if self.variadic { - if f.alternate() { - write!(f, "({args:#}, ...){arrow:#}", args = self.inputs, arrow = self.output) - } else { - write!(f, "({args}, ...){arrow}", args = self.inputs, arrow = self.output) - } + if f.alternate() { + write!(f, "({args:#}){arrow:#}", args = self.inputs, arrow = self.output) } else { - if f.alternate() { - write!(f, "({args:#}){arrow:#}", args = self.inputs, arrow = self.output) - } else { - write!(f, "({args}){arrow}", args = self.inputs, arrow = self.output) - } + write!(f, "({args}){arrow}", args = self.inputs, arrow = self.output) } } } @@ -907,12 +900,7 @@ impl<'a> fmt::Display for Function<'a> { } } - let mut args_plain = format!("({})", args_plain); - - if decl.variadic { - args.push_str(",
..."); - args_plain.push_str(", ..."); - } + let args_plain = format!("({})", args_plain); let output = if let hir::IsAsync::Async = asyncness { Cow::Owned(decl.sugared_async_return_type()) diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 9c4945d74dbf..5bae00b9cb84 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1643,6 +1643,8 @@ pub enum TyKind { Mac(Mac), /// Placeholder for a kind that has failed to be defined. Err, + /// Placeholder for a `va_list`. + CVarArgs, } impl TyKind { diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 86849f580d08..8efc4689cac8 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -401,7 +401,8 @@ pub fn noop_visit_ty(ty: &mut P, vis: &mut T) { let Ty { id, node, span } = ty.deref_mut(); vis.visit_id(id); match node { - TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err | TyKind::Never => {} + TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err | + TyKind::Never | TyKind::CVarArgs => {} TyKind::Slice(ty) => vis.visit_ty(ty), TyKind::Ptr(mt) => vis.visit_mt(mt), TyKind::Rptr(lt, mt) => { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 7e900dfeb1ee..b58091b57da4 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1543,7 +1543,7 @@ impl<'a> Parser<'a> { // definition... // We don't allow argument names to be left off in edition 2018. - p.parse_arg_general(p.span.rust_2018(), true) + p.parse_arg_general(p.span.rust_2018(), true, false) })?; generics.where_clause = self.parse_where_clause()?; @@ -1613,7 +1613,7 @@ impl<'a> Parser<'a> { /// Parses an optional return type `[ -> TY ]` in a function declaration. fn parse_ret_ty(&mut self, allow_plus: bool) -> PResult<'a, FunctionRetTy> { if self.eat(&token::RArrow) { - Ok(FunctionRetTy::Ty(self.parse_ty_common(allow_plus, true)?)) + Ok(FunctionRetTy::Ty(self.parse_ty_common(allow_plus, true, false)?)) } else { Ok(FunctionRetTy::Default(self.span.shrink_to_lo())) } @@ -1621,7 +1621,7 @@ impl<'a> Parser<'a> { /// Parses a type. pub fn parse_ty(&mut self) -> PResult<'a, P> { - self.parse_ty_common(true, true) + self.parse_ty_common(true, true, false) } /// Parses a type in restricted contexts where `+` is not permitted. @@ -1631,11 +1631,11 @@ impl<'a> Parser<'a> { /// Example 2: `value1 as TYPE + value2` /// `+` is prohibited to avoid interactions with expression grammar. fn parse_ty_no_plus(&mut self) -> PResult<'a, P> { - self.parse_ty_common(false, true) + self.parse_ty_common(false, true, false) } - fn parse_ty_common(&mut self, allow_plus: bool, allow_qpath_recovery: bool) - -> PResult<'a, P> { + fn parse_ty_common(&mut self, allow_plus: bool, allow_qpath_recovery: bool, + allow_variadic: bool) -> PResult<'a, P> { maybe_whole!(self, NtTy, |x| x); let lo = self.span; @@ -1772,6 +1772,15 @@ impl<'a> Parser<'a> { TyKind::Path(None, path) } } + } else if self.check(&token::DotDotDot) { + if allow_variadic { + self.eat(&token::DotDotDot); + TyKind::CVarArgs + } else { + return Err(self.fatal( + "only foreign functions are allowed to be variadic" + )); + } } else { let msg = format!("expected type, found {}", self.this_token_descr()); return Err(self.fatal(&msg)); @@ -1959,7 +1968,8 @@ impl<'a> Parser<'a> { } /// This version of parse arg doesn't necessarily require identifier names. - fn parse_arg_general(&mut self, require_name: bool, is_trait_item: bool) -> PResult<'a, Arg> { + fn parse_arg_general(&mut self, require_name: bool, is_trait_item: bool, + allow_variadic: bool) -> PResult<'a, Arg> { maybe_whole!(self, NtArg, |x| x); if let Ok(Some(_)) = self.parse_self_arg() { @@ -2008,12 +2018,12 @@ impl<'a> Parser<'a> { } self.eat_incorrect_doc_comment("a method argument's type"); - (pat, self.parse_ty()?) + (pat, self.parse_ty_common(true, true, allow_variadic)?) } else { debug!("parse_arg_general ident_to_pat"); let parser_snapshot_before_ty = self.clone(); self.eat_incorrect_doc_comment("a method argument's type"); - let mut ty = self.parse_ty(); + let mut ty = self.parse_ty_common(true, true, allow_variadic); if ty.is_ok() && self.token != token::Comma && self.token != token::CloseDelim(token::Paren) { // This wasn't actually a type, but a pattern looking like a type, @@ -2032,6 +2042,11 @@ impl<'a> Parser<'a> { (pat, ty) } Err(mut err) => { + // If this is a variadic argument and we hit an error, return the + // error. + if self.token == token::DotDotDot { + return Err(err); + } // Recover from attempting to parse the argument as a type without pattern. err.cancel(); mem::replace(self, parser_snapshot_before_ty); @@ -2068,7 +2083,7 @@ impl<'a> Parser<'a> { /// Parses a single function argument. crate fn parse_arg(&mut self) -> PResult<'a, Arg> { - self.parse_arg_general(true, false) + self.parse_arg_general(true, false, false) } /// Parses an argument in a lambda header (e.g., `|arg, arg|`). @@ -2406,7 +2421,7 @@ impl<'a> Parser<'a> { } let span = lo.to(self.prev_span); let output = if self.eat(&token::RArrow) { - Some(self.parse_ty_common(false, false)?) + Some(self.parse_ty_common(false, false, false)?) } else { None }; @@ -6118,44 +6133,38 @@ impl<'a> Parser<'a> { &token::CloseDelim(token::Paren), SeqSep::trailing_allowed(token::Comma), |p| { - if p.token == token::DotDotDot { - p.bump(); - variadic = true; - if allow_variadic { - if p.token != token::CloseDelim(token::Paren) { - let span = p.span; - p.span_err(span, - "`...` must be last in argument list for variadic function"); - } - Ok(None) - } else { - let span = p.prev_span; - if p.token == token::CloseDelim(token::Paren) { - // continue parsing to present any further errors - p.struct_span_err( - span, - "only foreign functions are allowed to be variadic" - ).emit(); - Ok(Some(dummy_arg(span))) - } else { - // this function definition looks beyond recovery, stop parsing - p.span_err(span, - "only foreign functions are allowed to be variadic"); - Ok(None) - } - } + // If the argument is a C-variadic argument we should not + // enforce named arguments. + let enforce_named_args = if p.token == token::DotDotDot { + false } else { - match p.parse_arg_general(named_args, false) { - Ok(arg) => Ok(Some(arg)), - Err(mut e) => { - e.emit(); - let lo = p.prev_span; - // Skip every token until next possible arg or end. - p.eat_to_tokens(&[&token::Comma, &token::CloseDelim(token::Paren)]); - // Create a placeholder argument for proper arg count (#34264). - let span = lo.to(p.prev_span); - Ok(Some(dummy_arg(span))) + named_args + }; + match p.parse_arg_general(enforce_named_args, false, + allow_variadic) { + Ok(arg) => { + if let TyKind::CVarArgs = arg.ty.node { + variadic = true; + if p.token != token::CloseDelim(token::Paren) { + let span = p.span; + p.span_err(span, + "`...` must be last in argument list in variadic function"); + Ok(None) + } else { + Ok(Some(arg)) + } + } else { + Ok(Some(arg)) } + }, + Err(mut e) => { + e.emit(); + let lo = p.prev_span; + // Skip every token until next possible arg or end. + p.eat_to_tokens(&[&token::Comma, &token::CloseDelim(token::Paren)]); + // Create a placeholder argument for proper arg count (issue #34264). + let span = lo.to(p.prev_span); + Ok(Some(dummy_arg(span))) } } } @@ -6389,7 +6398,8 @@ impl<'a> Parser<'a> { abi: Abi) -> PResult<'a, ItemInfo> { let (ident, mut generics) = self.parse_fn_header()?; - let decl = self.parse_fn_decl(false)?; + let allow_variadic = abi == Abi::C && unsafety == Unsafety::Unsafe; + let decl = self.parse_fn_decl(allow_variadic)?; generics.where_clause = self.parse_where_clause()?; let (inner_attrs, body) = self.parse_inner_attrs_and_block()?; let header = FnHeader { unsafety, asyncness, constness, abi }; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index dcf9815f6d1b..b3964d0ce9c8 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1118,6 +1118,9 @@ impl<'a> State<'a> { ast::TyKind::Mac(ref m) => { self.print_mac(m)?; } + ast::TyKind::CVarArgs => { + self.s.word("...")?; + } } self.end() } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index a002394c710f..dd9f4f74d9e4 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -315,7 +315,7 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) { walk_list!(visitor, visit_lifetime, opt_lifetime); visitor.visit_ty(&mutable_type.ty) } - TyKind::Never => {}, + TyKind::Never | TyKind::CVarArgs => {} TyKind::Tup(ref tuple_element_types) => { walk_list!(visitor, visit_ty, tuple_element_types); } diff --git a/src/test/codegen/c-variadic.rs b/src/test/codegen/c-variadic.rs new file mode 100644 index 000000000000..09c18ed90b21 --- /dev/null +++ b/src/test/codegen/c-variadic.rs @@ -0,0 +1,69 @@ +// compile-flags: -C no-prepopulate-passes + +#![crate_type = "lib"] +#![feature(c_variadic)] +#![no_std] +use core::ffi::VaList; + +extern "C" { + fn foreign_c_variadic_0(_: i32, ...); + fn foreign_c_variadic_1(_: VaList, ...); +} + +pub unsafe extern "C" fn use_foreign_c_variadic_0() { + // Ensure that we correctly call foreign C-variadic functions. + // CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0) + foreign_c_variadic_0(0); + // CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0, i32 42) + foreign_c_variadic_0(0, 42i32); + // CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0, i32 42, i32 1024) + foreign_c_variadic_0(0, 42i32, 1024i32); + // CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0, i32 42, i32 1024, i32 0) + foreign_c_variadic_0(0, 42i32, 1024i32, 0i32); +} + +// Ensure that we do not remove the `va_list` passed to the foreign function when +// removing the "spoofed" `VaList` that is used by Rust defined C-variadics. +pub unsafe extern "C" fn use_foreign_c_variadic_1_0(ap: VaList) { + // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap) + foreign_c_variadic_1(ap); +} + +pub unsafe extern "C" fn use_foreign_c_variadic_1_1(ap: VaList) { + // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 42) + foreign_c_variadic_1(ap, 42i32); +} +pub unsafe extern "C" fn use_foreign_c_variadic_1_2(ap: VaList) { + // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 2, i32 42) + foreign_c_variadic_1(ap, 2i32, 42i32); +} + +pub unsafe extern "C" fn use_foreign_c_variadic_1_3(ap: VaList) { + // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 2, i32 42, i32 0) + foreign_c_variadic_1(ap, 2i32, 42i32, 0i32); +} + +// Ensure that `va_start` and `va_end` are properly injected. +#[no_mangle] +pub unsafe extern "C" fn c_variadic(n: i32, mut ap: ...) -> i32 { + // CHECK: call void @llvm.va_start + let mut sum = 0; + for _ in 0..n { + sum += ap.arg::(); + } + sum + // CHECK: call void @llvm.va_end +} + +// Ensure that we generate the correct `call` signature when calling a Rust +// defined C-variadic. +pub unsafe fn test_c_variadic_call() { + // CHECK: call i32 (i32, ...) @c_variadic(i32 0) + c_variadic(0); + // CHECK: call i32 (i32, ...) @c_variadic(i32 0, i32 42) + c_variadic(0, 42i32); + // CHECK: call i32 (i32, ...) @c_variadic(i32 0, i32 42, i32 1024) + c_variadic(0, 42i32, 1024i32); + // CHECK: call i32 (i32, ...) @c_variadic(i32 0, i32 42, i32 1024, i32 0) + c_variadic(0, 42i32, 1024i32, 0i32); +} diff --git a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs index d55aac1e40f4..96a238afaec0 100644 --- a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs +++ b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs @@ -18,8 +18,10 @@ macro_rules! continue_if { unsafe fn compare_c_str(ptr: *const c_char, val: &str) -> bool { let cstr0 = CStr::from_ptr(ptr); - let cstr1 = CString::new(val).unwrap(); - &*cstr1 == cstr0 + match CString::new(val) { + Ok(cstr1) => &*cstr1 == cstr0, + Err(_) => false, + } } #[no_mangle] @@ -68,3 +70,24 @@ pub unsafe extern "C" fn check_list_copy_0(mut ap: VaList) -> usize { } }) } + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_0(_: c_int, mut ap: ...) -> usize { + continue_if!(ap.arg::() == 42); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Hello, World!")); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_1(_: c_int, mut ap: ...) -> usize { + continue_if!(ap.arg::().floor() == 3.14f64.floor()); + continue_if!(ap.arg::() == 12); + continue_if!(ap.arg::() == 'A' as c_char); + continue_if!(ap.arg::() == 1); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_2(_: c_int, mut ap: ...) -> usize { + 0 +} diff --git a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c index 95cf0ef46ca1..91b060dce26f 100644 --- a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c +++ b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c @@ -8,6 +8,9 @@ extern size_t check_list_0(va_list ap); extern size_t check_list_1(va_list ap); extern size_t check_list_2(va_list ap); extern size_t check_list_copy_0(va_list ap); +extern size_t check_varargs_0(int fixed, ...); +extern size_t check_varargs_1(int fixed, ...); +extern size_t check_varargs_2(int fixed, ...); int test_rust(size_t (*fn)(va_list), ...) { size_t ret = 0; @@ -26,5 +29,12 @@ int main(int argc, char* argv[]) { assert(test_rust(check_list_2, 3.14, 12l, 'a', 6.28, "Hello", 42, "World") == 0); assert(test_rust(check_list_copy_0, 6.28, 16, 'A', "Skip Me!", "Correct") == 0); + + assert(check_varargs_0(0, 42, "Hello, World!") == 0); + + assert(check_varargs_1(0, 3.14, 12l, 'A', 0x1LL) == 0); + + assert(check_varargs_2(0, "All", "of", "these", "are", "ignored", ".") == 0); + return 0; } diff --git a/src/test/rustdoc/variadic.rs b/src/test/rustdoc/variadic.rs index bd8f1775b3d0..5af2aea21fca 100644 --- a/src/test/rustdoc/variadic.rs +++ b/src/test/rustdoc/variadic.rs @@ -1,4 +1,4 @@ extern "C" { - // @has variadic/fn.foo.html //pre 'pub unsafe extern "C" fn foo(x: i32, ...)' + // @has variadic/fn.foo.html //pre 'pub unsafe extern "C" fn foo(x: i32, _: ...)' pub fn foo(x: i32, ...); } diff --git a/src/test/ui/variadic/variadic-ffi.rs b/src/test/ui/c-variadic/variadic-ffi-1.rs similarity index 100% rename from src/test/ui/variadic/variadic-ffi.rs rename to src/test/ui/c-variadic/variadic-ffi-1.rs diff --git a/src/test/ui/variadic/variadic-ffi.stderr b/src/test/ui/c-variadic/variadic-ffi-1.stderr similarity index 91% rename from src/test/ui/variadic/variadic-ffi.stderr rename to src/test/ui/c-variadic/variadic-ffi-1.stderr index 617b1f46ea3f..52d7394d6af0 100644 --- a/src/test/ui/variadic/variadic-ffi.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-1.stderr @@ -1,5 +1,5 @@ error[E0045]: variadic function must have C or cdecl calling convention - --> $DIR/variadic-ffi.rs:5:5 + --> $DIR/variadic-ffi-1.rs:5:5 | LL | fn printf(_: *const u8, ...); //~ ERROR: variadic function must have C or cdecl calling | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variadics require C or cdecl calling convention diff --git a/src/test/ui/variadic/variadic-ffi-2.rs b/src/test/ui/c-variadic/variadic-ffi-2.rs similarity index 100% rename from src/test/ui/variadic/variadic-ffi-2.rs rename to src/test/ui/c-variadic/variadic-ffi-2.rs diff --git a/src/test/ui/variadic/variadic-ffi-2.stderr b/src/test/ui/c-variadic/variadic-ffi-2.stderr similarity index 100% rename from src/test/ui/variadic/variadic-ffi-2.stderr rename to src/test/ui/c-variadic/variadic-ffi-2.stderr diff --git a/src/test/ui/variadic/variadic-ffi-3.rs b/src/test/ui/c-variadic/variadic-ffi-3.rs similarity index 85% rename from src/test/ui/variadic/variadic-ffi-3.rs rename to src/test/ui/c-variadic/variadic-ffi-3.rs index 12b3426d9da1..c02d1f54e564 100644 --- a/src/test/ui/variadic/variadic-ffi-3.rs +++ b/src/test/ui/c-variadic/variadic-ffi-3.rs @@ -14,12 +14,10 @@ fn main() { let x: unsafe extern "C" fn(f: isize, x: u8) = foo; //~^ ERROR: mismatched types //~| expected type `unsafe extern "C" fn(isize, u8)` - //~| found type `unsafe extern "C" fn(isize, u8, ...) {foo}` let y: extern "C" fn(f: isize, x: u8, ...) = bar; //~^ ERROR: mismatched types - //~| expected type `extern "C" fn(isize, u8, ...)` - //~| found type `extern "C" fn(isize, u8) {bar}` + //~| expected type `for<'r> extern "C" fn(isize, u8, std::ffi::VaList<'r>, ...)` foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function diff --git a/src/test/ui/variadic/variadic-ffi-3.stderr b/src/test/ui/c-variadic/variadic-ffi-3.stderr similarity index 90% rename from src/test/ui/variadic/variadic-ffi-3.stderr rename to src/test/ui/c-variadic/variadic-ffi-3.stderr index 0fecbbf36b80..82e3c6cd06fc 100644 --- a/src/test/ui/variadic/variadic-ffi-3.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-3.stderr @@ -23,49 +23,49 @@ LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; | ^^^ expected non-variadic fn, found variadic function | = note: expected type `unsafe extern "C" fn(isize, u8)` - found type `unsafe extern "C" fn(isize, u8, ...) {foo}` + found type `for<'r> unsafe extern "C" fn(isize, u8, std::ffi::VaList<'r>, ...) {foo}` error[E0308]: mismatched types - --> $DIR/variadic-ffi-3.rs:19:54 + --> $DIR/variadic-ffi-3.rs:18:54 | LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; | ^^^ expected variadic fn, found non-variadic function | - = note: expected type `extern "C" fn(isize, u8, ...)` + = note: expected type `for<'r> extern "C" fn(isize, u8, std::ffi::VaList<'r>, ...)` found type `extern "C" fn(isize, u8) {bar}` error[E0617]: can't pass `f32` to variadic function - --> $DIR/variadic-ffi-3.rs:24:19 + --> $DIR/variadic-ffi-3.rs:22:19 | LL | foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function | ^^^^ help: cast the value to `c_double`: `3f32 as c_double` error[E0617]: can't pass `bool` to variadic function - --> $DIR/variadic-ffi-3.rs:25:19 + --> $DIR/variadic-ffi-3.rs:23:19 | LL | foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function | ^^^^ help: cast the value to `c_int`: `true as c_int` error[E0617]: can't pass `i8` to variadic function - --> $DIR/variadic-ffi-3.rs:26:19 + --> $DIR/variadic-ffi-3.rs:24:19 | LL | foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function | ^^^ help: cast the value to `c_int`: `1i8 as c_int` error[E0617]: can't pass `u8` to variadic function - --> $DIR/variadic-ffi-3.rs:27:19 + --> $DIR/variadic-ffi-3.rs:25:19 | LL | foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function | ^^^ help: cast the value to `c_uint`: `1u8 as c_uint` error[E0617]: can't pass `i16` to variadic function - --> $DIR/variadic-ffi-3.rs:28:19 + --> $DIR/variadic-ffi-3.rs:26:19 | LL | foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function | ^^^^ help: cast the value to `c_int`: `1i16 as c_int` error[E0617]: can't pass `u16` to variadic function - --> $DIR/variadic-ffi-3.rs:29:19 + --> $DIR/variadic-ffi-3.rs:27:19 | LL | foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function | ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint` diff --git a/src/test/ui/c-variadic/variadic-ffi-4.rs b/src/test/ui/c-variadic/variadic-ffi-4.rs new file mode 100644 index 000000000000..9101be564564 --- /dev/null +++ b/src/test/ui/c-variadic/variadic-ffi-4.rs @@ -0,0 +1,29 @@ +#![crate_type="lib"] +#![no_std] +#![feature(c_variadic)] + +use core::ffi::VaList; + +pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> { + ap //~ ERROR: explicit lifetime required +} + +pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> { + ap //~ ERROR: explicit lifetime required +} + +pub unsafe extern "C" fn no_escape2(_: usize, ap: ...) { + let _ = ap.copy(|ap| { ap }); //~ ERROR: cannot infer an appropriate lifetime +} + +pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) { + *ap0 = ap1; //~ ERROR: mismatched types +} + +pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { + ap0 = &mut ap1; + //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long + //~^^ ERROR: mismatched types + //~^^^ ERROR: mismatched types + //~^^^^ ERROR: cannot infer an appropriate lifetime +} diff --git a/src/test/ui/c-variadic/variadic-ffi-4.stderr b/src/test/ui/c-variadic/variadic-ffi-4.stderr new file mode 100644 index 000000000000..1d752be065c4 --- /dev/null +++ b/src/test/ui/c-variadic/variadic-ffi-4.stderr @@ -0,0 +1,198 @@ +error[E0621]: explicit lifetime required in the type of `ap` + --> $DIR/variadic-ffi-4.rs:8:5 + | +LL | pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> { + | --- help: add explicit lifetime `'a` to the type of `ap`: `core::ffi::VaList<'a>` +LL | ap //~ ERROR: explicit lifetime required + | ^^ lifetime `'a` required + +error[E0621]: explicit lifetime required in the type of `ap` + --> $DIR/variadic-ffi-4.rs:12:5 + | +LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> { + | --- help: add explicit lifetime `'static` to the type of `ap`: `core::ffi::VaList<'static>` +LL | ap //~ ERROR: explicit lifetime required + | ^^ lifetime `'static` required + +error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements + --> $DIR/variadic-ffi-4.rs:16:28 + | +LL | let _ = ap.copy(|ap| { ap }); //~ ERROR: cannot infer an appropriate lifetime + | ^^ + | +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 16:21... + --> $DIR/variadic-ffi-4.rs:16:21 + | +LL | let _ = ap.copy(|ap| { ap }); //~ ERROR: cannot infer an appropriate lifetime + | ^^^^^^^^^^^ + = note: ...so that the expression is assignable: + expected core::ffi::VaList<'_> + found core::ffi::VaList<'_> +note: but, the lifetime must be valid for the method call at 16:13... + --> $DIR/variadic-ffi-4.rs:16:13 + | +LL | let _ = ap.copy(|ap| { ap }); //~ ERROR: cannot infer an appropriate lifetime + | ^^^^^^^^^^^^^^^^^^^^ +note: ...so type `core::ffi::VaList<'_>` of expression is valid during the expression + --> $DIR/variadic-ffi-4.rs:16:13 + | +LL | let _ = ap.copy(|ap| { ap }); //~ ERROR: cannot infer an appropriate lifetime + | ^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: mismatched types + --> $DIR/variadic-ffi-4.rs:20:12 + | +LL | *ap0 = ap1; //~ ERROR: mismatched types + | ^^^ lifetime mismatch + | + = note: expected type `core::ffi::VaList<'_>` + found type `core::ffi::VaList<'_>` +note: the anonymous lifetime #3 defined on the function body at 19:1... + --> $DIR/variadic-ffi-4.rs:19:1 + | +LL | / pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) { +LL | | *ap0 = ap1; //~ ERROR: mismatched types +LL | | } + | |_^ +note: ...does not necessarily outlive the anonymous lifetime #2 defined on the function body at 19:1 + --> $DIR/variadic-ffi-4.rs:19:1 + | +LL | / pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) { +LL | | *ap0 = ap1; //~ ERROR: mismatched types +LL | | } + | |_^ + +error[E0490]: a value of type `core::ffi::VaList<'_>` is borrowed for too long + --> $DIR/variadic-ffi-4.rs:24:11 + | +LL | ap0 = &mut ap1; + | ^^^^^^^^ + | +note: the type is valid for the anonymous lifetime #1 defined on the function body at 23:1 + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long +LL | | //~^^ ERROR: mismatched types +LL | | //~^^^ ERROR: mismatched types +LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | } + | |_^ +note: but the borrow lasts for the anonymous lifetime #3 defined on the function body at 23:1 + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long +LL | | //~^^ ERROR: mismatched types +LL | | //~^^^ ERROR: mismatched types +LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | } + | |_^ + +error[E0308]: mismatched types + --> $DIR/variadic-ffi-4.rs:24:11 + | +LL | ap0 = &mut ap1; + | ^^^^^^^^ lifetime mismatch + | + = note: expected type `&mut core::ffi::VaList<'_>` + found type `&mut core::ffi::VaList<'_>` +note: the anonymous lifetime #3 defined on the function body at 23:1... + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long +LL | | //~^^ ERROR: mismatched types +LL | | //~^^^ ERROR: mismatched types +LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | } + | |_^ +note: ...does not necessarily outlive the anonymous lifetime #2 defined on the function body at 23:1 + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long +LL | | //~^^ ERROR: mismatched types +LL | | //~^^^ ERROR: mismatched types +LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | } + | |_^ + +error[E0308]: mismatched types + --> $DIR/variadic-ffi-4.rs:24:11 + | +LL | ap0 = &mut ap1; + | ^^^^^^^^ lifetime mismatch + | + = note: expected type `&mut core::ffi::VaList<'_>` + found type `&mut core::ffi::VaList<'_>` +note: the anonymous lifetime #2 defined on the function body at 23:1... + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long +LL | | //~^^ ERROR: mismatched types +LL | | //~^^^ ERROR: mismatched types +LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | } + | |_^ +note: ...does not necessarily outlive the anonymous lifetime #3 defined on the function body at 23:1 + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long +LL | | //~^^ ERROR: mismatched types +LL | | //~^^^ ERROR: mismatched types +LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | } + | |_^ + +error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements + --> $DIR/variadic-ffi-4.rs:24:11 + | +LL | ap0 = &mut ap1; + | ^^^^^^^^ + | +note: first, the lifetime cannot outlive the anonymous lifetime #3 defined on the function body at 23:1... + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long +LL | | //~^^ ERROR: mismatched types +LL | | //~^^^ ERROR: mismatched types +LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | } + | |_^ +note: ...so that the type `core::ffi::VaList<'_>` is not borrowed for too long + --> $DIR/variadic-ffi-4.rs:24:11 + | +LL | ap0 = &mut ap1; + | ^^^^^^^^ +note: but, the lifetime must be valid for the anonymous lifetime #1 defined on the function body at 23:1... + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long +LL | | //~^^ ERROR: mismatched types +LL | | //~^^^ ERROR: mismatched types +LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | } + | |_^ +note: ...so that reference does not outlive borrowed content + --> $DIR/variadic-ffi-4.rs:24:11 + | +LL | ap0 = &mut ap1; + | ^^^^^^^^ + +error: aborting due to 8 previous errors + +Some errors occurred: E0308, E0490, E0495, E0621. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/c-variadic/variadic-ffi-5.rs b/src/test/ui/c-variadic/variadic-ffi-5.rs new file mode 100644 index 000000000000..d96482ff4d17 --- /dev/null +++ b/src/test/ui/c-variadic/variadic-ffi-5.rs @@ -0,0 +1,31 @@ +#![crate_type="lib"] +#![no_std] +#![feature(c_variadic)] +// The tests in this file are similar to that of variadic-ffi-4, but this +// one enables nll. +#![feature(nll)] + +use core::ffi::VaList; + +pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> { + ap //~ ERROR: explicit lifetime required +} + +pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> { + ap //~ ERROR: explicit lifetime required +} + +pub unsafe extern "C" fn no_escape2(_: usize, ap: ...) { + let _ = ap.copy(|ap| { ap }); //~ ERROR: lifetime may not live long enough +} + +pub unsafe extern "C" fn no_escape3(_: usize, ap0: &mut VaList, mut ap1: ...) { + *ap0 = ap1; //~ ERROR: lifetime may not live long enough +} + +pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) { + ap0 = &mut ap1; + //~^ ERROR: lifetime may not live long enough + //~^^ ERROR: lifetime may not live long enough + //~^^^ ERROR: `ap1` does not live long enough +} diff --git a/src/test/ui/c-variadic/variadic-ffi-5.stderr b/src/test/ui/c-variadic/variadic-ffi-5.stderr new file mode 100644 index 000000000000..2d452872baf4 --- /dev/null +++ b/src/test/ui/c-variadic/variadic-ffi-5.stderr @@ -0,0 +1,73 @@ +error[E0621]: explicit lifetime required in the type of `ap` + --> $DIR/variadic-ffi-5.rs:11:5 + | +LL | pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> { + | --- help: add explicit lifetime `'a` to the type of `ap`: `core::ffi::VaList<'a>` +LL | ap //~ ERROR: explicit lifetime required + | ^^ lifetime `'a` required + +error[E0621]: explicit lifetime required in the type of `ap` + --> $DIR/variadic-ffi-5.rs:15:5 + | +LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> { + | --- help: add explicit lifetime `'static` to the type of `ap`: `core::ffi::VaList<'static>` +LL | ap //~ ERROR: explicit lifetime required + | ^^ lifetime `'static` required + +error: lifetime may not live long enough + --> $DIR/variadic-ffi-5.rs:19:28 + | +LL | let _ = ap.copy(|ap| { ap }); //~ ERROR: lifetime may not live long enough + | --- ^^ returning this value requires that `'1` must outlive `'2` + | | | + | | return type of closure is core::ffi::VaList<'2> + | has type `core::ffi::VaList<'1>` + +error: lifetime may not live long enough + --> $DIR/variadic-ffi-5.rs:23:5 + | +LL | pub unsafe extern "C" fn no_escape3(_: usize, ap0: &mut VaList, mut ap1: ...) { + | --- ------- has type `core::ffi::VaList<'1>` + | | + | has type `&mut core::ffi::VaList<'2>` +LL | *ap0 = ap1; //~ ERROR: lifetime may not live long enough + | ^^^^^^^^^^ assignment requires that `'1` must outlive `'2` + +error: lifetime may not live long enough + --> $DIR/variadic-ffi-5.rs:27:5 + | +LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) { + | ------- ------- has type `core::ffi::VaList<'2>` + | | + | has type `&mut core::ffi::VaList<'1>` +LL | ap0 = &mut ap1; + | ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2` + +error: lifetime may not live long enough + --> $DIR/variadic-ffi-5.rs:27:5 + | +LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) { + | ------- ------- has type `core::ffi::VaList<'1>` + | | + | has type `&mut core::ffi::VaList<'2>` +LL | ap0 = &mut ap1; + | ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2` + +error[E0597]: `ap1` does not live long enough + --> $DIR/variadic-ffi-5.rs:27:11 + | +LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) { + | - let's call the lifetime of this reference `'1` +LL | ap0 = &mut ap1; + | ------^^^^^^^^ + | | | + | | borrowed value does not live long enough + | assignment requires that `ap1` is borrowed for `'1` +... +LL | } + | - `ap1` dropped here while still borrowed + +error: aborting due to 7 previous errors + +Some errors occurred: E0597, E0621. +For more information about an error, try `rustc --explain E0597`. diff --git a/src/test/ui/c-variadic/variadic-ffi-6.rs b/src/test/ui/c-variadic/variadic-ffi-6.rs new file mode 100644 index 000000000000..9b5293fad3bf --- /dev/null +++ b/src/test/ui/c-variadic/variadic-ffi-6.rs @@ -0,0 +1,12 @@ +#![crate_type="lib"] + +pub unsafe extern "C" fn use_vararg_lifetime( + x: usize, + y: ... +) -> &usize { //~ ERROR missing lifetime specifier + &0 +} + +pub unsafe extern "C" fn use_normal_arg_lifetime(x: &usize, y: ...) -> &usize { // OK + x +} diff --git a/src/test/ui/c-variadic/variadic-ffi-6.stderr b/src/test/ui/c-variadic/variadic-ffi-6.stderr new file mode 100644 index 000000000000..76bd18959a51 --- /dev/null +++ b/src/test/ui/c-variadic/variadic-ffi-6.stderr @@ -0,0 +1,11 @@ +error[E0106]: missing lifetime specifier + --> $DIR/variadic-ffi-6.rs:7:6 + | +LL | ) -> &usize { //~ ERROR missing lifetime specifier + | ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static` + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/error-codes/E0617.rs b/src/test/ui/error-codes/E0617.rs index 9eed1225ab82..51f13c7dbd54 100644 --- a/src/test/ui/error-codes/E0617.rs +++ b/src/test/ui/error-codes/E0617.rs @@ -22,7 +22,7 @@ fn main() { //~^ ERROR can't pass `u16` to variadic function //~| HELP cast the value to `c_uint` printf(::std::ptr::null(), printf); - //~^ ERROR can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function - //~| HELP cast the value to `unsafe extern "C" fn(*const i8, ...)` + //~^ ERROR can't pass `for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaList<'r>, ...) {printf}` to variadic function + //~| HELP cast the value to `for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaList<'r>, ...)` } } diff --git a/src/test/ui/error-codes/E0617.stderr b/src/test/ui/error-codes/E0617.stderr index 486ca1fa92f1..8387d5c7e93a 100644 --- a/src/test/ui/error-codes/E0617.stderr +++ b/src/test/ui/error-codes/E0617.stderr @@ -28,15 +28,15 @@ error[E0617]: can't pass `u16` to variadic function LL | printf(::std::ptr::null(), 0u16); | ^^^^ help: cast the value to `c_uint`: `0u16 as c_uint` -error[E0617]: can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function +error[E0617]: can't pass `for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaList<'r>, ...) {printf}` to variadic function --> $DIR/E0617.rs:24:36 | LL | printf(::std::ptr::null(), printf); | ^^^^^^ -help: cast the value to `unsafe extern "C" fn(*const i8, ...)` +help: cast the value to `for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaList<'r>, ...)` | -LL | printf(::std::ptr::null(), printf as unsafe extern "C" fn(*const i8, ...)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | printf(::std::ptr::null(), printf as for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaList<'r>, ...)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/parser/recover-enum2.stderr b/src/test/ui/parser/recover-enum2.stderr index 2473420a7793..b308e644ad9f 100644 --- a/src/test/ui/parser/recover-enum2.stderr +++ b/src/test/ui/parser/recover-enum2.stderr @@ -10,11 +10,11 @@ error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `{` LL | Nope(i32 {}) //~ ERROR: found `{` | ^ expected one of 7 possible tokens here -error: expected one of `!`, `&&`, `&`, `(`, `)`, `*`, `+`, `,`, `::`, `<`, `?`, `[`, `_`, `crate`, `dyn`, `extern`, `fn`, `for`, `impl`, `pub`, `unsafe`, `}`, or lifetime, found `{` +error: expected one of `!`, `&&`, `&`, `(`, `)`, `*`, `+`, `,`, `...`, `::`, `<`, `?`, `[`, `_`, `crate`, `dyn`, `extern`, `fn`, `for`, `impl`, `pub`, `unsafe`, `}`, or lifetime, found `{` --> $DIR/recover-enum2.rs:27:22 | LL | Nope(i32 {}) //~ ERROR: found `{` - | ^ expected one of 23 possible tokens here + | ^ expected one of 24 possible tokens here error: expected expression, found reserved identifier `_` --> $DIR/recover-enum2.rs:32:22 From 210c6071b02db76900d55e00bd46ee91285c3a07 Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Sun, 24 Feb 2019 22:40:11 +0000 Subject: [PATCH 096/381] Add c_variadic language feature item --- src/libsyntax/feature_gate.rs | 12 ++++++++++++ src/test/ui/c-variadic/variadic-ffi-6.rs | 1 + src/test/ui/feature-gate/feature-gate-c_variadic.rs | 4 ++++ .../ui/feature-gate/feature-gate-c_variadic.stderr | 11 +++++++++++ 4 files changed, 28 insertions(+) create mode 100644 src/test/ui/feature-gate/feature-gate-c_variadic.rs create mode 100644 src/test/ui/feature-gate/feature-gate-c_variadic.stderr diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index cc1953e69d4c..fad370d768e8 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -471,6 +471,9 @@ declare_features! ( // #[repr(align(X))] on enums (active, repr_align_enum, "1.34.0", Some(57996), None), + + // Allows the use of C-variadics + (active, c_variadic, "1.34.0", Some(44930), None), ); declare_features! ( @@ -1901,6 +1904,11 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { if header.asyncness.is_async() { gate_feature_post!(&self, async_await, span, "async fn is unstable"); } + + if fn_decl.c_variadic { + gate_feature_post!(&self, c_variadic, span, + "C-varaidic functions are unstable"); + } // Stability of const fn methods are covered in // `visit_trait_item` and `visit_impl_item` below; this is // because default methods don't pass through this point. @@ -1929,6 +1937,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { if block.is_none() { self.check_abi(sig.header.abi, ti.span); } + if sig.decl.c_variadic { + gate_feature_post!(&self, c_variadic, ti.span, + "C-varaidic functions are unstable"); + } if sig.header.constness.node == ast::Constness::Const { gate_feature_post!(&self, const_fn, ti.span, "const fn is unstable"); } diff --git a/src/test/ui/c-variadic/variadic-ffi-6.rs b/src/test/ui/c-variadic/variadic-ffi-6.rs index 9b5293fad3bf..4dd8a2d45218 100644 --- a/src/test/ui/c-variadic/variadic-ffi-6.rs +++ b/src/test/ui/c-variadic/variadic-ffi-6.rs @@ -1,4 +1,5 @@ #![crate_type="lib"] +#![feature(c_variadic)] pub unsafe extern "C" fn use_vararg_lifetime( x: usize, diff --git a/src/test/ui/feature-gate/feature-gate-c_variadic.rs b/src/test/ui/feature-gate/feature-gate-c_variadic.rs new file mode 100644 index 000000000000..5801a2a89e2c --- /dev/null +++ b/src/test/ui/feature-gate/feature-gate-c_variadic.rs @@ -0,0 +1,4 @@ +#![crate_type="lib"] + +pub unsafe extern "C" fn test(_: i32, ap: ...) { } +//~^ C-varaidic functions are unstable diff --git a/src/test/ui/feature-gate/feature-gate-c_variadic.stderr b/src/test/ui/feature-gate/feature-gate-c_variadic.stderr new file mode 100644 index 000000000000..a876e16fdea4 --- /dev/null +++ b/src/test/ui/feature-gate/feature-gate-c_variadic.stderr @@ -0,0 +1,11 @@ +error[E0658]: C-varaidic functions are unstable (see issue #44930) + --> $DIR/feature-gate-c_variadic.rs:3:1 + | +LL | pub unsafe extern "C" fn test(_: i32, ap: ...) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(c_variadic)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. From 1a6e9e24083c3250f76ca1ad6a0142d9ab3223d0 Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Sun, 24 Feb 2019 22:40:49 +0000 Subject: [PATCH 097/381] Add c_variadic to the unstable-book - Add the c_variadic language feature - Add the c_variadic library feature --- .../src/language-features/c-variadic.md | 24 +++++++++++++++++ .../src/library-features/c-variadic.md | 26 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/doc/unstable-book/src/language-features/c-variadic.md create mode 100644 src/doc/unstable-book/src/library-features/c-variadic.md diff --git a/src/doc/unstable-book/src/language-features/c-variadic.md b/src/doc/unstable-book/src/language-features/c-variadic.md new file mode 100644 index 000000000000..9e7968d906fb --- /dev/null +++ b/src/doc/unstable-book/src/language-features/c-variadic.md @@ -0,0 +1,24 @@ +# `c_variadic` + +The tracking issue for this feature is: [#44930] + +[#44930]: https://github.com/rust-lang/rust/issues/44930 + +------------------------ + +The `c_variadic` language feature enables C-variadic functions to be +defined in Rust. The may be called both from within Rust and via FFI. + +## Examples + +```rust +#![feature(c_variadic)] + +pub unsafe extern "C" fn add(n: usize, mut args: ...) -> usize { + let mut sum = 0; + for _ in 0..n { + sum += args.arg::(); + } + sum +} +``` diff --git a/src/doc/unstable-book/src/library-features/c-variadic.md b/src/doc/unstable-book/src/library-features/c-variadic.md new file mode 100644 index 000000000000..77762116e6b1 --- /dev/null +++ b/src/doc/unstable-book/src/library-features/c-variadic.md @@ -0,0 +1,26 @@ +# `c_variadic` + +The tracking issue for this feature is: [#44930] + +[#44930]: https://github.com/rust-lang/rust/issues/44930 + +------------------------ + +The `c_variadic` library feature exposes the `VaList` structure, +Rust's analogue of C's `va_list` type. + +## Examples + +```rust +#![feature(c_variadic)] + +use std::ffi::VaList; + +pub unsafe extern "C" fn vadd(n: usize, mut args: VaList) -> usize { + let mut sum = 0; + for _ in 0..n { + sum += args.arg::(); + } + sum +} +``` From a618ad6335f7cb70005884542f0548ef29f23b7e Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Sat, 2 Feb 2019 16:34:09 +0000 Subject: [PATCH 098/381] Refactor FunctionCx::codgen_terminator - Move closures defined in codegen_terminator into a separate helper structure and implementation. - Create helper functions for each of the complex match arms on the terminators kind in codegen_terminator. --- src/librustc_codegen_ssa/mir/block.rs | 1480 +++++++++++++------------ 1 file changed, 790 insertions(+), 690 deletions(-) diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index f40aa0cb6d12..684dfac991b4 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -13,6 +13,8 @@ use crate::meth; use crate::traits::*; +use std::borrow::Cow; + use syntax::symbol::Symbol; use syntax_pos::Pos; @@ -21,6 +23,779 @@ use super::place::PlaceRef; use super::operand::{OperandValue, OperandRef}; use super::operand::OperandValue::{Pair, Ref, Immediate}; +/// Used by `FunctionCx::codegen_terminator` for emitting common patterns +/// e.g., creating a basic block, calling a function, etc. +struct TerminatorCodegenHelper<'a, 'tcx> { + bb: &'a mir::BasicBlock, + terminator: &'a mir::Terminator<'tcx>, + funclet_bb: Option, +} + +impl<'a, 'tcx> TerminatorCodegenHelper<'a, 'tcx> { + /// Returns the associated funclet from `FunctionCx::funclets` for the + /// `funclet_bb` member if it is not `None`. + fn funclet<'c, 'b, Bx: BuilderMethods<'b, 'tcx>>( + &self, + fx: &'c mut FunctionCx<'b, 'tcx, Bx>, + ) -> Option<&'c Bx::Funclet> { + match self.funclet_bb { + Some(funcl) => fx.funclets[funcl].as_ref(), + None => None, + } + } + + fn lltarget<'b, 'c, Bx: BuilderMethods<'b, 'tcx>>( + &self, + fx: &'c mut FunctionCx<'b, 'tcx, Bx>, + target: mir::BasicBlock, + ) -> (Bx::BasicBlock, bool) { + let span = self.terminator.source_info.span; + let lltarget = fx.blocks[target]; + let target_funclet = fx.cleanup_kinds[target].funclet_bb(target); + match (self.funclet_bb, target_funclet) { + (None, None) => (lltarget, false), + (Some(f), Some(t_f)) if f == t_f || !base::wants_msvc_seh(fx.cx.tcx().sess) => + (lltarget, false), + // jump *into* cleanup - need a landing pad if GNU + (None, Some(_)) => (fx.landing_pad_to(target), false), + (Some(_), None) => span_bug!(span, "{:?} - jump out of cleanup?", self.terminator), + (Some(_), Some(_)) => (fx.landing_pad_to(target), true), + } + } + + /// Create a basic block. + fn llblock<'c, 'b, Bx: BuilderMethods<'b, 'tcx>>( + &self, + fx: &'c mut FunctionCx<'b, 'tcx, Bx>, + target: mir::BasicBlock, + ) -> Bx::BasicBlock { + let (lltarget, is_cleanupret) = self.lltarget(fx, target); + if is_cleanupret { + // MSVC cross-funclet jump - need a trampoline + + debug!("llblock: creating cleanup trampoline for {:?}", target); + let name = &format!("{:?}_cleanup_trampoline_{:?}", self.bb, target); + let mut trampoline = fx.new_block(name); + trampoline.cleanup_ret(self.funclet(fx).unwrap(), + Some(lltarget)); + trampoline.llbb() + } else { + lltarget + } + } + + fn funclet_br<'c, 'b, Bx: BuilderMethods<'b, 'tcx>>( + &self, + fx: &'c mut FunctionCx<'b, 'tcx, Bx>, + bx: &mut Bx, + target: mir::BasicBlock, + ) { + let (lltarget, is_cleanupret) = self.lltarget(fx, target); + if is_cleanupret { + // micro-optimization: generate a `ret` rather than a jump + // to a trampoline. + bx.cleanup_ret(self.funclet(fx).unwrap(), Some(lltarget)); + } else { + bx.br(lltarget); + } + } + + /// Call `fn_ptr` of `fn_ty` with the arguments `llargs`, the optional + /// return destination `destination` and the cleanup function `cleanup`. + fn do_call<'c, 'b, Bx: BuilderMethods<'b, 'tcx>>( + &self, + fx: &'c mut FunctionCx<'b, 'tcx, Bx>, + bx: &mut Bx, + fn_ty: FnType<'tcx, Ty<'tcx>>, + fn_ptr: Bx::Value, + llargs: &[Bx::Value], + destination: Option<(ReturnDest<'tcx, Bx::Value>, mir::BasicBlock)>, + cleanup: Option, + ) { + if let Some(cleanup) = cleanup { + let ret_bx = if let Some((_, target)) = destination { + fx.blocks[target] + } else { + fx.unreachable_block() + }; + let invokeret = bx.invoke(fn_ptr, + &llargs, + ret_bx, + self.llblock(fx, cleanup), + self.funclet(fx)); + bx.apply_attrs_callsite(&fn_ty, invokeret); + + if let Some((ret_dest, target)) = destination { + let mut ret_bx = fx.build_block(target); + fx.set_debug_loc(&mut ret_bx, self.terminator.source_info); + fx.store_return(&mut ret_bx, ret_dest, &fn_ty.ret, invokeret); + } + } else { + let llret = bx.call(fn_ptr, &llargs, self.funclet(fx)); + bx.apply_attrs_callsite(&fn_ty, llret); + if fx.mir[*self.bb].is_cleanup { + // Cleanup is always the cold path. Don't inline + // drop glue. Also, when there is a deeply-nested + // struct, there are "symmetry" issues that cause + // exponential inlining - see issue #41696. + bx.do_not_inline(llret); + } + + if let Some((ret_dest, target)) = destination { + fx.store_return(bx, ret_dest, &fn_ty.ret, llret); + self.funclet_br(fx, bx, target); + } else { + bx.unreachable(); + } + } + } +} + +/// Codegen implementations for some terminator variants. +impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { + /// Generates code for a `Resume` terminator. + fn codegen_resume_terminator<'b>( + &mut self, + helper: TerminatorCodegenHelper<'b, 'tcx>, + mut bx: Bx, + ) { + if let Some(funclet) = helper.funclet(self) { + bx.cleanup_ret(funclet, None); + } else { + let slot = self.get_personality_slot(&mut bx); + let lp0 = slot.project_field(&mut bx, 0); + let lp0 = bx.load_operand(lp0).immediate(); + let lp1 = slot.project_field(&mut bx, 1); + let lp1 = bx.load_operand(lp1).immediate(); + slot.storage_dead(&mut bx); + + if !bx.sess().target.target.options.custom_unwind_resume { + let mut lp = bx.const_undef(self.landing_pad_type()); + lp = bx.insert_value(lp, lp0, 0); + lp = bx.insert_value(lp, lp1, 1); + bx.resume(lp); + } else { + bx.call(bx.eh_unwind_resume(), &[lp0], + helper.funclet(self)); + bx.unreachable(); + } + } + } + + fn codegen_switchint_terminator<'b>( + &mut self, + helper: TerminatorCodegenHelper<'b, 'tcx>, + mut bx: Bx, + discr: &mir::Operand<'tcx>, + switch_ty: Ty<'tcx>, + values: &Cow<'tcx, [u128]>, + targets: &Vec, + ) { + let discr = self.codegen_operand(&mut bx, &discr); + if targets.len() == 2 { + // If there are two targets, emit br instead of switch + let lltrue = helper.llblock(self, targets[0]); + let llfalse = helper.llblock(self, targets[1]); + if switch_ty == bx.tcx().types.bool { + // Don't generate trivial icmps when switching on bool + if let [0] = values[..] { + bx.cond_br(discr.immediate(), llfalse, lltrue); + } else { + assert_eq!(&values[..], &[1]); + bx.cond_br(discr.immediate(), lltrue, llfalse); + } + } else { + let switch_llty = bx.immediate_backend_type( + bx.layout_of(switch_ty) + ); + let llval = bx.const_uint_big(switch_llty, values[0]); + let cmp = bx.icmp(IntPredicate::IntEQ, discr.immediate(), llval); + bx.cond_br(cmp, lltrue, llfalse); + } + } else { + let (otherwise, targets) = targets.split_last().unwrap(); + let switch = bx.switch(discr.immediate(), + helper.llblock(self, *otherwise), + values.len()); + let switch_llty = bx.immediate_backend_type( + bx.layout_of(switch_ty) + ); + for (&value, target) in values.iter().zip(targets) { + let llval = bx.const_uint_big(switch_llty, value); + let llbb = helper.llblock(self, *target); + bx.add_case(switch, llval, llbb) + } + } + } + + fn codegen_return_terminator<'b>( + &mut self, + mut bx: Bx, + ) { + if self.fn_ty.variadic { + if let Some(va_list) = self.va_list_ref { + bx.va_end(va_list.llval); + } + } + let llval = match self.fn_ty.ret.mode { + PassMode::Ignore(IgnoreMode::Zst) | PassMode::Indirect(..) => { + bx.ret_void(); + return; + } + + PassMode::Ignore(IgnoreMode::CVarArgs) => { + bug!("C-variadic arguments should never be the return type"); + } + + PassMode::Direct(_) | PassMode::Pair(..) => { + let op = + self.codegen_consume(&mut bx, &mir::Place::Local(mir::RETURN_PLACE)); + if let Ref(llval, _, align) = op.val { + bx.load(llval, align) + } else { + op.immediate_or_packed_pair(&mut bx) + } + } + + PassMode::Cast(cast_ty) => { + let op = match self.locals[mir::RETURN_PLACE] { + LocalRef::Operand(Some(op)) => op, + LocalRef::Operand(None) => bug!("use of return before def"), + LocalRef::Place(cg_place) => { + OperandRef { + val: Ref(cg_place.llval, None, cg_place.align), + layout: cg_place.layout + } + } + LocalRef::UnsizedPlace(_) => bug!("return type must be sized"), + }; + let llslot = match op.val { + Immediate(_) | Pair(..) => { + let scratch = + PlaceRef::alloca(&mut bx, self.fn_ty.ret.layout, "ret"); + op.val.store(&mut bx, scratch); + scratch.llval + } + Ref(llval, _, align) => { + assert_eq!(align, op.layout.align.abi, + "return place is unaligned!"); + llval + } + }; + let addr = bx.pointercast(llslot, bx.type_ptr_to( + bx.cast_backend_type(&cast_ty) + )); + bx.load(addr, self.fn_ty.ret.layout.align.abi) + } + }; + bx.ret(llval); + } + + + fn codegen_drop_terminator<'b>( + &mut self, + helper: TerminatorCodegenHelper<'b, 'tcx>, + mut bx: Bx, + location: &mir::Place<'tcx>, + target: mir::BasicBlock, + unwind: Option, + ) { + let ty = location.ty(self.mir, bx.tcx()).to_ty(bx.tcx()); + let ty = self.monomorphize(&ty); + let drop_fn = monomorphize::resolve_drop_in_place(bx.tcx(), ty); + + if let ty::InstanceDef::DropGlue(_, None) = drop_fn.def { + // we don't actually need to drop anything. + helper.funclet_br(self, &mut bx, target); + return + } + + let place = self.codegen_place(&mut bx, location); + let (args1, args2); + let mut args = if let Some(llextra) = place.llextra { + args2 = [place.llval, llextra]; + &args2[..] + } else { + args1 = [place.llval]; + &args1[..] + }; + let (drop_fn, fn_ty) = match ty.sty { + ty::Dynamic(..) => { + let sig = drop_fn.fn_sig(self.cx.tcx()); + let sig = self.cx.tcx().normalize_erasing_late_bound_regions( + ty::ParamEnv::reveal_all(), + &sig, + ); + let fn_ty = bx.new_vtable(sig, &[]); + let vtable = args[1]; + args = &args[..1]; + (meth::DESTRUCTOR.get_fn(&mut bx, vtable, &fn_ty), fn_ty) + } + _ => { + (bx.get_fn(drop_fn), + bx.fn_type_of_instance(&drop_fn)) + } + }; + helper.do_call(self, &mut bx, fn_ty, drop_fn, args, + Some((ReturnDest::Nothing, target)), + unwind); + } + + fn codegen_assert_terminator<'b>( + &mut self, + helper: TerminatorCodegenHelper<'b, 'tcx>, + mut bx: Bx, + terminator: &mir::Terminator<'tcx>, + cond: &mir::Operand<'tcx>, + expected: bool, + msg: &mir::AssertMessage<'tcx>, + target: mir::BasicBlock, + cleanup: Option, + ) { + let span = terminator.source_info.span; + let cond = self.codegen_operand(&mut bx, cond).immediate(); + let mut const_cond = bx.const_to_opt_u128(cond, false).map(|c| c == 1); + + // This case can currently arise only from functions marked + // with #[rustc_inherit_overflow_checks] and inlined from + // another crate (mostly core::num generic/#[inline] fns), + // while the current crate doesn't use overflow checks. + // NOTE: Unlike binops, negation doesn't have its own + // checked operation, just a comparison with the minimum + // value, so we have to check for the assert message. + if !bx.check_overflow() { + if let mir::interpret::EvalErrorKind::OverflowNeg = *msg { + const_cond = Some(expected); + } + } + + // Don't codegen the panic block if success if known. + if const_cond == Some(expected) { + helper.funclet_br(self, &mut bx, target); + return; + } + + // Pass the condition through llvm.expect for branch hinting. + let cond = bx.expect(cond, expected); + + // Create the failure block and the conditional branch to it. + let lltarget = helper.llblock(self, target); + let panic_block = self.new_block("panic"); + if expected { + bx.cond_br(cond, lltarget, panic_block.llbb()); + } else { + bx.cond_br(cond, panic_block.llbb(), lltarget); + } + + // After this point, bx is the block for the call to panic. + bx = panic_block; + self.set_debug_loc(&mut bx, terminator.source_info); + + // Get the location information. + let loc = bx.sess().source_map().lookup_char_pos(span.lo()); + let filename = Symbol::intern(&loc.file.name.to_string()).as_str(); + let filename = bx.const_str_slice(filename); + let line = bx.const_u32(loc.line as u32); + let col = bx.const_u32(loc.col.to_usize() as u32 + 1); + let align = self.cx.tcx().data_layout.aggregate_align.abi + .max(self.cx.tcx().data_layout.i32_align.abi) + .max(self.cx.tcx().data_layout.pointer_align.abi); + + // Put together the arguments to the panic entry point. + let (lang_item, args) = match *msg { + EvalErrorKind::BoundsCheck { ref len, ref index } => { + let len = self.codegen_operand(&mut bx, len).immediate(); + let index = self.codegen_operand(&mut bx, index).immediate(); + + let file_line_col = bx.const_struct(&[filename, line, col], false); + let file_line_col = bx.static_addr_of( + file_line_col, + align, + Some("panic_bounds_check_loc") + ); + (lang_items::PanicBoundsCheckFnLangItem, + vec![file_line_col, index, len]) + } + _ => { + let str = msg.description(); + let msg_str = Symbol::intern(str).as_str(); + let msg_str = bx.const_str_slice(msg_str); + let msg_file_line_col = bx.const_struct( + &[msg_str, filename, line, col], + false + ); + let msg_file_line_col = bx.static_addr_of( + msg_file_line_col, + align, + Some("panic_loc") + ); + (lang_items::PanicFnLangItem, + vec![msg_file_line_col]) + } + }; + + // Obtain the panic entry point. + let def_id = common::langcall(bx.tcx(), Some(span), "", lang_item); + let instance = ty::Instance::mono(bx.tcx(), def_id); + let fn_ty = bx.fn_type_of_instance(&instance); + let llfn = bx.get_fn(instance); + + // Codegen the actual panic invoke/call. + helper.do_call(self, &mut bx, fn_ty, llfn, &args, None, cleanup); + } + + fn codegen_call_terminator<'b>( + &mut self, + helper: TerminatorCodegenHelper<'b, 'tcx>, + mut bx: Bx, + terminator: &mir::Terminator<'tcx>, + func: &mir::Operand<'tcx>, + args: &Vec>, + destination: &Option<(mir::Place<'tcx>, mir::BasicBlock)>, + cleanup: Option, + ) { + let span = terminator.source_info.span; + // Create the callee. This is a fn ptr or zero-sized and hence a kind of scalar. + let callee = self.codegen_operand(&mut bx, func); + + let (instance, mut llfn) = match callee.layout.ty.sty { + ty::FnDef(def_id, substs) => { + (Some(ty::Instance::resolve(bx.tcx(), + ty::ParamEnv::reveal_all(), + def_id, + substs).unwrap()), + None) + } + ty::FnPtr(_) => { + (None, Some(callee.immediate())) + } + _ => bug!("{} is not callable", callee.layout.ty), + }; + let def = instance.map(|i| i.def); + let sig = callee.layout.ty.fn_sig(bx.tcx()); + let sig = bx.tcx().normalize_erasing_late_bound_regions( + ty::ParamEnv::reveal_all(), + &sig, + ); + let abi = sig.abi; + + // Handle intrinsics old codegen wants Expr's for, ourselves. + let intrinsic = match def { + Some(ty::InstanceDef::Intrinsic(def_id)) => + Some(bx.tcx().item_name(def_id).as_str()), + _ => None + }; + let intrinsic = intrinsic.as_ref().map(|s| &s[..]); + + if intrinsic == Some("transmute") { + if let Some(destination_ref) = destination.as_ref() { + let &(ref dest, target) = destination_ref; + self.codegen_transmute(&mut bx, &args[0], dest); + helper.funclet_br(self, &mut bx, target); + } else { + // If we are trying to transmute to an uninhabited type, + // it is likely there is no allotted destination. In fact, + // transmuting to an uninhabited type is UB, which means + // we can do what we like. Here, we declare that transmuting + // into an uninhabited type is impossible, so anything following + // it must be unreachable. + assert_eq!(bx.layout_of(sig.output()).abi, layout::Abi::Uninhabited); + bx.unreachable(); + } + return; + } + + // The "spoofed" `VaList` added to a C-variadic functions signature + // should not be included in the `extra_args` calculation. + let extra_args_start_idx = sig.inputs().len() - if sig.variadic { 1 } else { 0 }; + let extra_args = &args[extra_args_start_idx..]; + let extra_args = extra_args.iter().map(|op_arg| { + let op_ty = op_arg.ty(self.mir, bx.tcx()); + self.monomorphize(&op_ty) + }).collect::>(); + + let fn_ty = match def { + Some(ty::InstanceDef::Virtual(..)) => { + bx.new_vtable(sig, &extra_args) + } + Some(ty::InstanceDef::DropGlue(_, None)) => { + // Empty drop glue; a no-op. + let &(_, target) = destination.as_ref().unwrap(); + helper.funclet_br(self, &mut bx, target); + return; + } + _ => bx.new_fn_type(sig, &extra_args) + }; + + // Emit a panic or a no-op for `panic_if_uninhabited`. + if intrinsic == Some("panic_if_uninhabited") { + let ty = instance.unwrap().substs.type_at(0); + let layout = bx.layout_of(ty); + if layout.abi.is_uninhabited() { + let loc = bx.sess().source_map().lookup_char_pos(span.lo()); + let filename = Symbol::intern(&loc.file.name.to_string()).as_str(); + let filename = bx.const_str_slice(filename); + let line = bx.const_u32(loc.line as u32); + let col = bx.const_u32(loc.col.to_usize() as u32 + 1); + let align = self.cx.tcx().data_layout.aggregate_align.abi + .max(self.cx.tcx().data_layout.i32_align.abi) + .max(self.cx.tcx().data_layout.pointer_align.abi); + + let str = format!( + "Attempted to instantiate uninhabited type {}", + ty + ); + let msg_str = Symbol::intern(&str).as_str(); + let msg_str = bx.const_str_slice(msg_str); + let msg_file_line_col = bx.const_struct( + &[msg_str, filename, line, col], + false, + ); + let msg_file_line_col = bx.static_addr_of( + msg_file_line_col, + align, + Some("panic_loc"), + ); + + // Obtain the panic entry point. + let def_id = + common::langcall(bx.tcx(), Some(span), "", lang_items::PanicFnLangItem); + let instance = ty::Instance::mono(bx.tcx(), def_id); + let fn_ty = bx.fn_type_of_instance(&instance); + let llfn = bx.get_fn(instance); + + // Codegen the actual panic invoke/call. + helper.do_call( + self, + &mut bx, + fn_ty, + llfn, + &[msg_file_line_col], + destination.as_ref().map(|(_, bb)| (ReturnDest::Nothing, *bb)), + cleanup, + ); + } else { + // a NOP + helper.funclet_br(self, &mut bx, destination.as_ref().unwrap().1) + } + return; + } + + // The arguments we'll be passing. Plus one to account for outptr, if used. + let arg_count = fn_ty.args.len() + fn_ty.ret.is_indirect() as usize; + let mut llargs = Vec::with_capacity(arg_count); + + // Prepare the return value destination + let ret_dest = if let Some((ref dest, _)) = *destination { + let is_intrinsic = intrinsic.is_some(); + self.make_return_dest(&mut bx, dest, &fn_ty.ret, &mut llargs, + is_intrinsic) + } else { + ReturnDest::Nothing + }; + + if intrinsic.is_some() && intrinsic != Some("drop_in_place") { + let dest = match ret_dest { + _ if fn_ty.ret.is_indirect() => llargs[0], + ReturnDest::Nothing => + bx.const_undef(bx.type_ptr_to(bx.memory_ty(&fn_ty.ret))), + ReturnDest::IndirectOperand(dst, _) | ReturnDest::Store(dst) => + dst.llval, + ReturnDest::DirectOperand(_) => + bug!("Cannot use direct operand with an intrinsic call"), + }; + + let args: Vec<_> = args.iter().enumerate().map(|(i, arg)| { + // The indices passed to simd_shuffle* in the + // third argument must be constant. This is + // checked by const-qualification, which also + // promotes any complex rvalues to constants. + if i == 2 && intrinsic.unwrap().starts_with("simd_shuffle") { + match *arg { + // The shuffle array argument is usually not an explicit constant, + // but specified directly in the code. This means it gets promoted + // and we can then extract the value by evaluating the promoted. + mir::Operand::Copy(mir::Place::Promoted(box(index, ty))) | + mir::Operand::Move(mir::Place::Promoted(box(index, ty))) => { + let param_env = ty::ParamEnv::reveal_all(); + let cid = mir::interpret::GlobalId { + instance: self.instance, + promoted: Some(index), + }; + let c = bx.tcx().const_eval(param_env.and(cid)); + let (llval, ty) = self.simd_shuffle_indices( + &bx, + terminator.source_info.span, + ty, + c, + ); + return OperandRef { + val: Immediate(llval), + layout: bx.layout_of(ty), + }; + + } + mir::Operand::Copy(_) | + mir::Operand::Move(_) => { + span_bug!(span, "shuffle indices must be constant"); + } + mir::Operand::Constant(ref constant) => { + let c = self.eval_mir_constant(&bx, constant); + let (llval, ty) = self.simd_shuffle_indices( + &bx, + constant.span, + constant.ty, + c, + ); + return OperandRef { + val: Immediate(llval), + layout: bx.layout_of(ty) + }; + } + } + } + + self.codegen_operand(&mut bx, arg) + }).collect(); + + + let callee_ty = instance.as_ref().unwrap().ty(bx.tcx()); + bx.codegen_intrinsic_call(callee_ty, &fn_ty, &args, dest, + terminator.source_info.span); + + if let ReturnDest::IndirectOperand(dst, _) = ret_dest { + self.store_return(&mut bx, ret_dest, &fn_ty.ret, dst.llval); + } + + if let Some((_, target)) = *destination { + helper.funclet_br(self, &mut bx, target); + } else { + bx.unreachable(); + } + + return; + } + + // Split the rust-call tupled arguments off. + let (first_args, untuple) = if abi == Abi::RustCall && !args.is_empty() { + let (tup, args) = args.split_last().unwrap(); + (args, Some(tup)) + } else { + (&args[..], None) + }; + + // Useful determining if the current argument is the "spoofed" `VaList` + let last_arg_idx = if sig.inputs().is_empty() { + None + } else { + Some(sig.inputs().len() - 1) + }; + 'make_args: for (i, arg) in first_args.iter().enumerate() { + // If this is a C-variadic function the function signature contains + // an "spoofed" `VaList`. This argument is ignored, but we need to + // populate it with a dummy operand so that the users real arguments + // are not overwritten. + let i = if sig.variadic && last_arg_idx.map(|x| x == i).unwrap_or(false) { + let layout = match self.cx.tcx().lang_items().va_list() { + Some(did) => bx.cx().layout_of(bx.tcx().type_of(did)), + None => bug!("`va_list` language item required for C-variadics"), + }; + let op = OperandRef { + val: OperandValue::Immediate( + bx.cx().const_undef(bx.cx().immediate_backend_type(layout) + )), + layout: layout, + }; + self.codegen_argument(&mut bx, op, &mut llargs, &fn_ty.args[i]); + if i + 1 < fn_ty.args.len() { + i + 1 + } else { + break 'make_args + } + } else { + i + }; + let mut op = self.codegen_operand(&mut bx, arg); + + if let (0, Some(ty::InstanceDef::Virtual(_, idx))) = (i, def) { + if let Pair(..) = op.val { + // In the case of Rc, we need to explicitly pass a + // *mut RcBox with a Scalar (not ScalarPair) ABI. This is a hack + // that is understood elsewhere in the compiler as a method on + // `dyn Trait`. + // To get a `*mut RcBox`, we just keep unwrapping newtypes until + // we get a value of a built-in pointer type + 'descend_newtypes: while !op.layout.ty.is_unsafe_ptr() + && !op.layout.ty.is_region_ptr() + { + 'iter_fields: for i in 0..op.layout.fields.count() { + let field = op.extract_field(&mut bx, i); + if !field.layout.is_zst() { + // we found the one non-zero-sized field that is allowed + // now find *its* non-zero-sized field, or stop if it's a + // pointer + op = field; + continue 'descend_newtypes + } + } + + span_bug!(span, "receiver has no non-zero-sized fields {:?}", op); + } + + // now that we have `*dyn Trait` or `&dyn Trait`, split it up into its + // data pointer and vtable. Look up the method in the vtable, and pass + // the data pointer as the first argument + match op.val { + Pair(data_ptr, meta) => { + llfn = Some(meth::VirtualIndex::from_index(idx) + .get_fn(&mut bx, meta, &fn_ty)); + llargs.push(data_ptr); + continue 'make_args + } + other => bug!("expected a Pair, got {:?}", other), + } + } else if let Ref(data_ptr, Some(meta), _) = op.val { + // by-value dynamic dispatch + llfn = Some(meth::VirtualIndex::from_index(idx) + .get_fn(&mut bx, meta, &fn_ty)); + llargs.push(data_ptr); + continue; + } else { + span_bug!(span, "can't codegen a virtual call on {:?}", op); + } + } + + // The callee needs to own the argument memory if we pass it + // by-ref, so make a local copy of non-immediate constants. + match (arg, op.val) { + (&mir::Operand::Copy(_), Ref(_, None, _)) | + (&mir::Operand::Constant(_), Ref(_, None, _)) => { + let tmp = PlaceRef::alloca(&mut bx, op.layout, "const"); + op.val.store(&mut bx, tmp); + op.val = Ref(tmp.llval, None, tmp.align); + } + _ => {} + } + + self.codegen_argument(&mut bx, op, &mut llargs, &fn_ty.args[i]); + } + if let Some(tup) = untuple { + self.codegen_arguments_untupled(&mut bx, tup, &mut llargs, + &fn_ty.args[first_args.len()..]) + } + + let fn_ptr = match (llfn, instance) { + (Some(llfn), _) => llfn, + (None, Some(instance)) => bx.get_fn(instance), + _ => span_bug!(span, "no llfn for call"), + }; + + helper.do_call(self, &mut bx, fn_ty, fn_ptr, &llargs, + destination.as_ref().map(|&(_, target)| (ret_dest, target)), + cleanup); + } +} + impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { pub fn codegen_block( &mut self, @@ -47,141 +822,15 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { debug!("codegen_terminator: {:?}", terminator); // Create the cleanup bundle, if needed. - let tcx = self.cx.tcx(); - let span = terminator.source_info.span; let funclet_bb = self.cleanup_kinds[bb].funclet_bb(bb); - - // HACK(eddyb) force the right lifetimes, NLL can't figure them out. - fn funclet_closure_factory<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( - funclet_bb: Option - ) -> impl for<'b> Fn( - &'b FunctionCx<'a, 'tcx, Bx>, - ) -> Option<&'b Bx::Funclet> { - move |this| { - match funclet_bb { - Some(funclet_bb) => this.funclets[funclet_bb].as_ref(), - None => None, - } - } - } - let funclet = funclet_closure_factory(funclet_bb); - - let lltarget = |this: &mut Self, target: mir::BasicBlock| { - let lltarget = this.blocks[target]; - let target_funclet = this.cleanup_kinds[target].funclet_bb(target); - match (funclet_bb, target_funclet) { - (None, None) => (lltarget, false), - (Some(f), Some(t_f)) - if f == t_f || !base::wants_msvc_seh(tcx.sess) - => (lltarget, false), - (None, Some(_)) => { - // jump *into* cleanup - need a landing pad if GNU - (this.landing_pad_to(target), false) - } - (Some(_), None) => span_bug!(span, "{:?} - jump out of cleanup?", terminator), - (Some(_), Some(_)) => { - (this.landing_pad_to(target), true) - } - } - }; - - let llblock = |this: &mut Self, target: mir::BasicBlock| { - let (lltarget, is_cleanupret) = lltarget(this, target); - if is_cleanupret { - // MSVC cross-funclet jump - need a trampoline - - debug!("llblock: creating cleanup trampoline for {:?}", target); - let name = &format!("{:?}_cleanup_trampoline_{:?}", bb, target); - let mut trampoline = this.new_block(name); - trampoline.cleanup_ret(funclet(this).unwrap(), Some(lltarget)); - trampoline.llbb() - } else { - lltarget - } - }; - - let funclet_br = - |this: &mut Self, bx: &mut Bx, target: mir::BasicBlock| { - let (lltarget, is_cleanupret) = lltarget(this, target); - if is_cleanupret { - // micro-optimization: generate a `ret` rather than a jump - // to a trampoline. - bx.cleanup_ret(funclet(this).unwrap(), Some(lltarget)); - } else { - bx.br(lltarget); - } - }; - - let do_call = | - this: &mut Self, - bx: &mut Bx, - fn_ty: FnType<'tcx, Ty<'tcx>>, - fn_ptr: Bx::Value, - llargs: &[Bx::Value], - destination: Option<(ReturnDest<'tcx, Bx::Value>, mir::BasicBlock)>, - cleanup: Option - | { - if let Some(cleanup) = cleanup { - let ret_bx = if let Some((_, target)) = destination { - this.blocks[target] - } else { - this.unreachable_block() - }; - let invokeret = bx.invoke(fn_ptr, - &llargs, - ret_bx, - llblock(this, cleanup), - funclet(this)); - bx.apply_attrs_callsite(&fn_ty, invokeret); - - if let Some((ret_dest, target)) = destination { - let mut ret_bx = this.build_block(target); - this.set_debug_loc(&mut ret_bx, terminator.source_info); - this.store_return(&mut ret_bx, ret_dest, &fn_ty.ret, invokeret); - } - } else { - let llret = bx.call(fn_ptr, &llargs, funclet(this)); - bx.apply_attrs_callsite(&fn_ty, llret); - if this.mir[bb].is_cleanup { - // Cleanup is always the cold path. Don't inline - // drop glue. Also, when there is a deeply-nested - // struct, there are "symmetry" issues that cause - // exponential inlining - see issue #41696. - bx.do_not_inline(llret); - } - - if let Some((ret_dest, target)) = destination { - this.store_return(bx, ret_dest, &fn_ty.ret, llret); - funclet_br(this, bx, target); - } else { - bx.unreachable(); - } - } + let helper = TerminatorCodegenHelper { + bb: &bb, terminator, funclet_bb }; self.set_debug_loc(&mut bx, terminator.source_info); match terminator.kind { mir::TerminatorKind::Resume => { - if let Some(funclet) = funclet(self) { - bx.cleanup_ret(funclet, None); - } else { - let slot = self.get_personality_slot(&mut bx); - let lp0 = slot.project_field(&mut bx, 0); - let lp0 = bx.load_operand(lp0).immediate(); - let lp1 = slot.project_field(&mut bx, 1); - let lp1 = bx.load_operand(lp1).immediate(); - slot.storage_dead(&mut bx); - - if !bx.sess().target.target.options.custom_unwind_resume { - let mut lp = bx.const_undef(self.landing_pad_type()); - lp = bx.insert_value(lp, lp0, 0); - lp = bx.insert_value(lp, lp1, 1); - bx.resume(lp); - } else { - bx.call(bx.eh_unwind_resume(), &[lp0], funclet(self)); - bx.unreachable(); - } - } + self.codegen_resume_terminator(helper, bx) } mir::TerminatorKind::Abort => { @@ -190,105 +839,18 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } mir::TerminatorKind::Goto { target } => { - funclet_br(self, &mut bx, target); + helper.funclet_br(self, &mut bx, target); } - mir::TerminatorKind::SwitchInt { ref discr, switch_ty, ref values, ref targets } => { - let discr = self.codegen_operand(&mut bx, discr); - if targets.len() == 2 { - // If there are two targets, emit br instead of switch - let lltrue = llblock(self, targets[0]); - let llfalse = llblock(self, targets[1]); - if switch_ty == bx.tcx().types.bool { - // Don't generate trivial icmps when switching on bool - if let [0] = values[..] { - bx.cond_br(discr.immediate(), llfalse, lltrue); - } else { - assert_eq!(&values[..], &[1]); - bx.cond_br(discr.immediate(), lltrue, llfalse); - } - } else { - let switch_llty = bx.immediate_backend_type( - bx.layout_of(switch_ty) - ); - let llval = bx.const_uint_big(switch_llty, values[0]); - let cmp = bx.icmp(IntPredicate::IntEQ, discr.immediate(), llval); - bx.cond_br(cmp, lltrue, llfalse); - } - } else { - let (otherwise, targets) = targets.split_last().unwrap(); - let switch = bx.switch(discr.immediate(), - llblock(self, *otherwise), - values.len()); - let switch_llty = bx.immediate_backend_type( - bx.layout_of(switch_ty) - ); - for (&value, target) in values.iter().zip(targets) { - let llval = bx.const_uint_big(switch_llty, value); - let llbb = llblock(self, *target); - bx.add_case(switch, llval, llbb) - } - } + mir::TerminatorKind::SwitchInt { + ref discr, switch_ty, ref values, ref targets + } => { + self.codegen_switchint_terminator(helper, bx, discr, switch_ty, + values, targets); } mir::TerminatorKind::Return => { - if self.fn_ty.variadic { - if let Some(va_list) = self.va_list_ref { - bx.va_end(va_list.llval); - } - } - let llval = match self.fn_ty.ret.mode { - PassMode::Ignore(IgnoreMode::Zst) | PassMode::Indirect(..) => { - bx.ret_void(); - return; - } - - PassMode::Ignore(IgnoreMode::CVarArgs) => { - bug!("C variadic arguments should never be the return type"); - } - - PassMode::Direct(_) | PassMode::Pair(..) => { - let op = - self.codegen_consume(&mut bx, &mir::Place::Local(mir::RETURN_PLACE)); - if let Ref(llval, _, align) = op.val { - bx.load(llval, align) - } else { - op.immediate_or_packed_pair(&mut bx) - } - } - - PassMode::Cast(cast_ty) => { - let op = match self.locals[mir::RETURN_PLACE] { - LocalRef::Operand(Some(op)) => op, - LocalRef::Operand(None) => bug!("use of return before def"), - LocalRef::Place(cg_place) => { - OperandRef { - val: Ref(cg_place.llval, None, cg_place.align), - layout: cg_place.layout - } - } - LocalRef::UnsizedPlace(_) => bug!("return type must be sized"), - }; - let llslot = match op.val { - Immediate(_) | Pair(..) => { - let scratch = - PlaceRef::alloca(&mut bx, self.fn_ty.ret.layout, "ret"); - op.val.store(&mut bx, scratch); - scratch.llval - } - Ref(llval, _, align) => { - assert_eq!(align, op.layout.align.abi, - "return place is unaligned!"); - llval - } - }; - let addr = bx.pointercast(llslot, bx.type_ptr_to( - bx.cast_backend_type(&cast_ty) - )); - bx.load(addr, self.fn_ty.ret.layout.align.abi) - } - }; - bx.ret(llval); + self.codegen_return_terminator(bx); } mir::TerminatorKind::Unreachable => { @@ -296,137 +858,12 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } mir::TerminatorKind::Drop { ref location, target, unwind } => { - let ty = location.ty(self.mir, bx.tcx()).to_ty(bx.tcx()); - let ty = self.monomorphize(&ty); - let drop_fn = monomorphize::resolve_drop_in_place(bx.tcx(), ty); - - if let ty::InstanceDef::DropGlue(_, None) = drop_fn.def { - // we don't actually need to drop anything. - funclet_br(self, &mut bx, target); - return - } - - let place = self.codegen_place(&mut bx, location); - let (args1, args2); - let mut args = if let Some(llextra) = place.llextra { - args2 = [place.llval, llextra]; - &args2[..] - } else { - args1 = [place.llval]; - &args1[..] - }; - let (drop_fn, fn_ty) = match ty.sty { - ty::Dynamic(..) => { - let sig = drop_fn.fn_sig(tcx); - let sig = tcx.normalize_erasing_late_bound_regions( - ty::ParamEnv::reveal_all(), - &sig, - ); - let fn_ty = bx.new_vtable(sig, &[]); - let vtable = args[1]; - args = &args[..1]; - (meth::DESTRUCTOR.get_fn(&mut bx, vtable, &fn_ty), fn_ty) - } - _ => { - (bx.get_fn(drop_fn), - bx.fn_type_of_instance(&drop_fn)) - } - }; - do_call(self, &mut bx, fn_ty, drop_fn, args, - Some((ReturnDest::Nothing, target)), - unwind); + self.codegen_drop_terminator(helper, bx, location, target, unwind); } mir::TerminatorKind::Assert { ref cond, expected, ref msg, target, cleanup } => { - let cond = self.codegen_operand(&mut bx, cond).immediate(); - let mut const_cond = bx.const_to_opt_u128(cond, false).map(|c| c == 1); - - // This case can currently arise only from functions marked - // with #[rustc_inherit_overflow_checks] and inlined from - // another crate (mostly core::num generic/#[inline] fns), - // while the current crate doesn't use overflow checks. - // NOTE: Unlike binops, negation doesn't have its own - // checked operation, just a comparison with the minimum - // value, so we have to check for the assert message. - if !bx.check_overflow() { - if let mir::interpret::EvalErrorKind::OverflowNeg = *msg { - const_cond = Some(expected); - } - } - - // Don't codegen the panic block if success if known. - if const_cond == Some(expected) { - funclet_br(self, &mut bx, target); - return; - } - - // Pass the condition through llvm.expect for branch hinting. - let cond = bx.expect(cond, expected); - - // Create the failure block and the conditional branch to it. - let lltarget = llblock(self, target); - let panic_block = self.new_block("panic"); - if expected { - bx.cond_br(cond, lltarget, panic_block.llbb()); - } else { - bx.cond_br(cond, panic_block.llbb(), lltarget); - } - - // After this point, bx is the block for the call to panic. - bx = panic_block; - self.set_debug_loc(&mut bx, terminator.source_info); - - // Get the location information. - let loc = bx.sess().source_map().lookup_char_pos(span.lo()); - let filename = Symbol::intern(&loc.file.name.to_string()).as_str(); - let filename = bx.const_str_slice(filename); - let line = bx.const_u32(loc.line as u32); - let col = bx.const_u32(loc.col.to_usize() as u32 + 1); - let align = tcx.data_layout.aggregate_align.abi - .max(tcx.data_layout.i32_align.abi) - .max(tcx.data_layout.pointer_align.abi); - - // Put together the arguments to the panic entry point. - let (lang_item, args) = match *msg { - EvalErrorKind::BoundsCheck { ref len, ref index } => { - let len = self.codegen_operand(&mut bx, len).immediate(); - let index = self.codegen_operand(&mut bx, index).immediate(); - - let file_line_col = bx.const_struct(&[filename, line, col], false); - let file_line_col = bx.static_addr_of( - file_line_col, - align, - Some("panic_bounds_check_loc") - ); - (lang_items::PanicBoundsCheckFnLangItem, - vec![file_line_col, index, len]) - } - _ => { - let str = msg.description(); - let msg_str = Symbol::intern(str).as_str(); - let msg_str = bx.const_str_slice(msg_str); - let msg_file_line_col = bx.const_struct( - &[msg_str, filename, line, col], - false - ); - let msg_file_line_col = bx.static_addr_of( - msg_file_line_col, - align, - Some("panic_loc") - ); - (lang_items::PanicFnLangItem, - vec![msg_file_line_col]) - } - }; - - // Obtain the panic entry point. - let def_id = common::langcall(bx.tcx(), Some(span), "", lang_item); - let instance = ty::Instance::mono(bx.tcx(), def_id); - let fn_ty = bx.fn_type_of_instance(&instance); - let llfn = bx.get_fn(instance); - - // Codegen the actual panic invoke/call. - do_call(self, &mut bx, fn_ty, llfn, &args, None, cleanup); + self.codegen_assert_terminator(helper, bx, terminator, cond, + expected, msg, target, cleanup); } mir::TerminatorKind::DropAndReplace { .. } => { @@ -440,345 +877,8 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { cleanup, from_hir_call: _ } => { - // Create the callee. This is a fn ptr or zero-sized and hence a kind of scalar. - let callee = self.codegen_operand(&mut bx, func); - - let (instance, mut llfn) = match callee.layout.ty.sty { - ty::FnDef(def_id, substs) => { - (Some(ty::Instance::resolve(bx.tcx(), - ty::ParamEnv::reveal_all(), - def_id, - substs).unwrap()), - None) - } - ty::FnPtr(_) => { - (None, Some(callee.immediate())) - } - _ => bug!("{} is not callable", callee.layout.ty) - }; - let def = instance.map(|i| i.def); - let sig = callee.layout.ty.fn_sig(bx.tcx()); - let sig = bx.tcx().normalize_erasing_late_bound_regions( - ty::ParamEnv::reveal_all(), - &sig, - ); - let abi = sig.abi; - - // Handle intrinsics old codegen wants Expr's for, ourselves. - let intrinsic = match def { - Some(ty::InstanceDef::Intrinsic(def_id)) - => Some(bx.tcx().item_name(def_id).as_str()), - _ => None - }; - let intrinsic = intrinsic.as_ref().map(|s| &s[..]); - - if intrinsic == Some("transmute") { - if let Some(destination_ref) = destination.as_ref() { - let &(ref dest, target) = destination_ref; - self.codegen_transmute(&mut bx, &args[0], dest); - funclet_br(self, &mut bx, target); - } else { - // If we are trying to transmute to an uninhabited type, - // it is likely there is no allotted destination. In fact, - // transmuting to an uninhabited type is UB, which means - // we can do what we like. Here, we declare that transmuting - // into an uninhabited type is impossible, so anything following - // it must be unreachable. - assert_eq!(bx.layout_of(sig.output()).abi, layout::Abi::Uninhabited); - bx.unreachable(); - } - return; - } - - // The "spoofed" `VaList` added to a C-variadic functions signature - // should not be included in the `extra_args` calculation. - let extra_args_start_idx = sig.inputs().len() - if sig.variadic { 1 } else { 0 }; - let extra_args = &args[extra_args_start_idx..]; - let extra_args = extra_args.iter().map(|op_arg| { - let op_ty = op_arg.ty(self.mir, bx.tcx()); - self.monomorphize(&op_ty) - }).collect::>(); - - let fn_ty = match def { - Some(ty::InstanceDef::Virtual(..)) => { - bx.new_vtable(sig, &extra_args) - } - Some(ty::InstanceDef::DropGlue(_, None)) => { - // empty drop glue - a nop. - let &(_, target) = destination.as_ref().unwrap(); - funclet_br(self, &mut bx, target); - return; - } - _ => bx.new_fn_type(sig, &extra_args) - }; - - // emit a panic or a NOP for `panic_if_uninhabited` - if intrinsic == Some("panic_if_uninhabited") { - let ty = instance.unwrap().substs.type_at(0); - let layout = bx.layout_of(ty); - if layout.abi.is_uninhabited() { - let loc = bx.sess().source_map().lookup_char_pos(span.lo()); - let filename = Symbol::intern(&loc.file.name.to_string()).as_str(); - let filename = bx.const_str_slice(filename); - let line = bx.const_u32(loc.line as u32); - let col = bx.const_u32(loc.col.to_usize() as u32 + 1); - let align = tcx.data_layout.aggregate_align.abi - .max(tcx.data_layout.i32_align.abi) - .max(tcx.data_layout.pointer_align.abi); - - let str = format!( - "Attempted to instantiate uninhabited type {}", - ty - ); - let msg_str = Symbol::intern(&str).as_str(); - let msg_str = bx.const_str_slice(msg_str); - let msg_file_line_col = bx.const_struct( - &[msg_str, filename, line, col], - false, - ); - let msg_file_line_col = bx.static_addr_of( - msg_file_line_col, - align, - Some("panic_loc"), - ); - - // Obtain the panic entry point. - let def_id = - common::langcall(bx.tcx(), Some(span), "", lang_items::PanicFnLangItem); - let instance = ty::Instance::mono(bx.tcx(), def_id); - let fn_ty = bx.fn_type_of_instance(&instance); - let llfn = bx.get_fn(instance); - - // Codegen the actual panic invoke/call. - do_call( - self, - &mut bx, - fn_ty, - llfn, - &[msg_file_line_col], - destination.as_ref().map(|(_, bb)| (ReturnDest::Nothing, *bb)), - cleanup, - ); - } else { - // a NOP - funclet_br(self, &mut bx, destination.as_ref().unwrap().1); - } - return; - } - - // The arguments we'll be passing. Plus one to account for outptr, if used. - let arg_count = fn_ty.args.len() + fn_ty.ret.is_indirect() as usize; - let mut llargs = Vec::with_capacity(arg_count); - - // Prepare the return value destination - let ret_dest = if let Some((ref dest, _)) = *destination { - let is_intrinsic = intrinsic.is_some(); - self.make_return_dest(&mut bx, dest, &fn_ty.ret, &mut llargs, - is_intrinsic) - } else { - ReturnDest::Nothing - }; - - if intrinsic.is_some() && intrinsic != Some("drop_in_place") { - let dest = match ret_dest { - _ if fn_ty.ret.is_indirect() => llargs[0], - ReturnDest::Nothing => { - bx.const_undef(bx.type_ptr_to(bx.memory_ty(&fn_ty.ret))) - } - ReturnDest::IndirectOperand(dst, _) | - ReturnDest::Store(dst) => dst.llval, - ReturnDest::DirectOperand(_) => - bug!("Cannot use direct operand with an intrinsic call") - }; - - let args: Vec<_> = args.iter().enumerate().map(|(i, arg)| { - // The indices passed to simd_shuffle* in the - // third argument must be constant. This is - // checked by const-qualification, which also - // promotes any complex rvalues to constants. - if i == 2 && intrinsic.unwrap().starts_with("simd_shuffle") { - match *arg { - // The shuffle array argument is usually not an explicit constant, - // but specified directly in the code. This means it gets promoted - // and we can then extract the value by evaluating the promoted. - mir::Operand::Copy(mir::Place::Promoted(box(index, ty))) | - mir::Operand::Move(mir::Place::Promoted(box(index, ty))) => { - let param_env = ty::ParamEnv::reveal_all(); - let cid = mir::interpret::GlobalId { - instance: self.instance, - promoted: Some(index), - }; - let c = bx.tcx().const_eval(param_env.and(cid)); - let (llval, ty) = self.simd_shuffle_indices( - &bx, - terminator.source_info.span, - ty, - c, - ); - return OperandRef { - val: Immediate(llval), - layout: bx.layout_of(ty), - }; - - }, - mir::Operand::Copy(_) | - mir::Operand::Move(_) => { - span_bug!(span, "shuffle indices must be constant"); - } - mir::Operand::Constant(ref constant) => { - let c = self.eval_mir_constant(&bx, constant); - let (llval, ty) = self.simd_shuffle_indices( - &bx, - constant.span, - constant.ty, - c, - ); - return OperandRef { - val: Immediate(llval), - layout: bx.layout_of(ty) - }; - } - } - } - - self.codegen_operand(&mut bx, arg) - }).collect(); - - - let callee_ty = instance.as_ref().unwrap().ty(bx.tcx()); - bx.codegen_intrinsic_call(callee_ty, &fn_ty, &args, dest, - terminator.source_info.span); - - if let ReturnDest::IndirectOperand(dst, _) = ret_dest { - self.store_return(&mut bx, ret_dest, &fn_ty.ret, dst.llval); - } - - if let Some((_, target)) = *destination { - funclet_br(self, &mut bx, target); - } else { - bx.unreachable(); - } - - return; - } - - // Split the rust-call tupled arguments off. - let (first_args, untuple) = if abi == Abi::RustCall && !args.is_empty() { - let (tup, args) = args.split_last().unwrap(); - (args, Some(tup)) - } else { - (&args[..], None) - }; - - // Useful determining if the current argument is the "spoofed" `VaList` - let last_arg_idx = if sig.inputs().is_empty() { - None - } else { - Some(sig.inputs().len() - 1) - }; - 'make_args: for (i, arg) in first_args.iter().enumerate() { - // If this is a C-variadic function the function signature contains - // an "spoofed" `VaList`. This argument is ignored, but we need to - // populate it with a dummy operand so that the users real arguments - // are not overwritten. - let i = if sig.variadic && last_arg_idx.map(|x| x == i).unwrap_or(false) { - let layout = match tcx.lang_items().va_list() { - Some(did) => bx.cx().layout_of(bx.tcx().type_of(did)), - None => bug!("va_list language item required for C variadics"), - }; - let op = OperandRef { - val: OperandValue::Immediate( - bx.cx().const_undef(bx.cx().immediate_backend_type(layout)) - ), - layout: layout, - }; - self.codegen_argument(&mut bx, op, &mut llargs, &fn_ty.args[i]); - if i + 1 < fn_ty.args.len() { - i + 1 - } else { - break 'make_args - } - } else { - i - }; - let mut op = self.codegen_operand(&mut bx, arg); - - if let (0, Some(ty::InstanceDef::Virtual(_, idx))) = (i, def) { - if let Pair(..) = op.val { - // In the case of Rc, we need to explicitly pass a - // *mut RcBox with a Scalar (not ScalarPair) ABI. This is a hack - // that is understood elsewhere in the compiler as a method on - // `dyn Trait`. - // To get a `*mut RcBox`, we just keep unwrapping newtypes until - // we get a value of a built-in pointer type - 'descend_newtypes: while !op.layout.ty.is_unsafe_ptr() - && !op.layout.ty.is_region_ptr() - { - 'iter_fields: for i in 0..op.layout.fields.count() { - let field = op.extract_field(&mut bx, i); - if !field.layout.is_zst() { - // we found the one non-zero-sized field that is allowed - // now find *its* non-zero-sized field, or stop if it's a - // pointer - op = field; - continue 'descend_newtypes - } - } - - span_bug!(span, "receiver has no non-zero-sized fields {:?}", op); - } - - // now that we have `*dyn Trait` or `&dyn Trait`, split it up into its - // data pointer and vtable. Look up the method in the vtable, and pass - // the data pointer as the first argument - match op.val { - Pair(data_ptr, meta) => { - llfn = Some(meth::VirtualIndex::from_index(idx) - .get_fn(&mut bx, meta, &fn_ty)); - llargs.push(data_ptr); - continue 'make_args - } - other => bug!("expected a Pair, got {:?}", other) - } - } else if let Ref(data_ptr, Some(meta), _) = op.val { - // by-value dynamic dispatch - llfn = Some(meth::VirtualIndex::from_index(idx) - .get_fn(&mut bx, meta, &fn_ty)); - llargs.push(data_ptr); - continue; - } else { - span_bug!(span, "can't codegen a virtual call on {:?}", op); - } - } - - // The callee needs to own the argument memory if we pass it - // by-ref, so make a local copy of non-immediate constants. - match (arg, op.val) { - (&mir::Operand::Copy(_), Ref(_, None, _)) | - (&mir::Operand::Constant(_), Ref(_, None, _)) => { - let tmp = PlaceRef::alloca(&mut bx, op.layout, "const"); - op.val.store(&mut bx, tmp); - op.val = Ref(tmp.llval, None, tmp.align); - } - _ => {} - } - - self.codegen_argument(&mut bx, op, &mut llargs, &fn_ty.args[i]); - } - if let Some(tup) = untuple { - self.codegen_arguments_untupled(&mut bx, tup, &mut llargs, - &fn_ty.args[first_args.len()..]) - } - - let fn_ptr = match (llfn, instance) { - (Some(llfn), _) => llfn, - (None, Some(instance)) => bx.get_fn(instance), - _ => span_bug!(span, "no llfn for call"), - }; - - do_call(self, &mut bx, fn_ty, fn_ptr, &llargs, - destination.as_ref().map(|&(_, target)| (ret_dest, target)), - cleanup); + self.codegen_call_terminator(helper, bx, terminator, func, + args, destination, cleanup); } mir::TerminatorKind::GeneratorDrop | mir::TerminatorKind::Yield { .. } => bug!("generator ops in codegen"), From 08bd4ff9987fc57215a2fe54c63da0e86d9e6fbf Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Fri, 8 Feb 2019 17:30:42 +0000 Subject: [PATCH 099/381] Rename variadic to c_variadic Function signatures with the `variadic` member set are actually C-variadic functions. Make this a little more explicit by renaming the `variadic` boolean value, `c_variadic`. --- src/librustc/hir/lowering.rs | 6 +-- src/librustc/hir/mod.rs | 2 +- src/librustc/hir/print.rs | 2 +- src/librustc/ich/impls_hir.rs | 2 +- src/librustc/ich/impls_ty.rs | 2 +- src/librustc/traits/select.rs | 2 +- src/librustc/ty/context.rs | 6 +-- src/librustc/ty/instance.rs | 2 +- src/librustc/ty/relate.rs | 6 +-- src/librustc/ty/structural_impls.rs | 4 +- src/librustc/ty/sty.rs | 8 ++-- src/librustc/util/ppaux.rs | 8 ++-- src/librustc_codegen_llvm/abi.rs | 10 ++-- .../debuginfo/type_names.rs | 2 +- src/librustc_codegen_ssa/mir/block.rs | 6 +-- src/librustc_codegen_ssa/mir/mod.rs | 2 +- src/librustc_lint/types.rs | 2 +- .../borrow_check/nll/type_check/mod.rs | 4 +- src/librustc_mir/monomorphize/item.rs | 2 +- src/librustc_target/abi/call/arm.rs | 2 +- src/librustc_target/abi/call/mod.rs | 2 +- .../chalk_context/program_clauses.rs | 8 ++-- src/librustc_traits/generic_types.rs | 4 +- src/librustc_typeck/astconv.rs | 6 +-- src/librustc_typeck/check/callee.rs | 6 +-- src/librustc_typeck/check/closure.rs | 10 ++-- src/librustc_typeck/check/mod.rs | 24 +++++----- src/librustc_typeck/lib.rs | 14 +++--- src/libsyntax/ast.rs | 2 +- src/libsyntax/ext/build.rs | 2 +- src/libsyntax/mut_visit.rs | 2 +- src/libsyntax/parse/parser.rs | 48 +++++++++---------- src/libsyntax/print/pprust.rs | 4 +- .../pprust-expr-roundtrip.rs | 2 +- src/test/ui/c-variadic/variadic-ffi-1.stderr | 4 +- src/test/ui/c-variadic/variadic-ffi-2.stderr | 4 +- src/test/ui/error-codes/E0045.stderr | 4 +- .../ui/invalid/invalid-variadic-function.rs | 2 +- .../invalid/invalid-variadic-function.stderr | 2 +- src/test/ui/parser/variadic-ffi-3.rs | 2 +- src/test/ui/parser/variadic-ffi-3.stderr | 2 +- src/test/ui/parser/variadic-ffi-4.rs | 2 +- src/test/ui/parser/variadic-ffi-4.stderr | 2 +- 43 files changed, 119 insertions(+), 119 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 0e2b34d4facf..6e96054bea9b 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -954,7 +954,7 @@ impl<'a> LoweringContext<'a> { let decl = FnDecl { inputs: vec![], output, - variadic: false + c_variadic: false }; let body_id = self.record_body(body_expr, Some(&decl)); self.is_generator = prev_is_generator; @@ -2118,7 +2118,7 @@ impl<'a> LoweringContext<'a> { P(hir::FnDecl { inputs, output, - variadic: decl.variadic, + c_variadic: decl.c_variadic, implicit_self: decl.inputs.get(0).map_or( hir::ImplicitSelfKind::None, |arg| { @@ -3973,7 +3973,7 @@ impl<'a> LoweringContext<'a> { let outer_decl = FnDecl { inputs: decl.inputs.clone(), output: FunctionRetTy::Default(fn_decl_span), - variadic: false, + c_variadic: false, }; // We need to lower the declaration outside the new scope, because we // have to conserve the state of being inside a loop condition for the diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 205109d18fe2..d8169d05dd4d 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1868,7 +1868,7 @@ pub struct Arg { pub struct FnDecl { pub inputs: HirVec, pub output: FunctionRetTy, - pub variadic: bool, + pub c_variadic: bool, /// Does the function have an implicit self? pub implicit_self: ImplicitSelfKind, } diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 8c252b0d0274..dab4b9c824d9 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -2007,7 +2007,7 @@ impl<'a> State<'a> { s.print_type(ty)?; s.end() })?; - if decl.variadic { + if decl.c_variadic { self.s.word(", ...")?; } self.pclose()?; diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index b7ec5889d6ae..775822786900 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -368,7 +368,7 @@ impl_stable_hash_for!(enum hir::TyKind { impl_stable_hash_for!(struct hir::FnDecl { inputs, output, - variadic, + c_variadic, implicit_self }); diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index cce1273b7f02..f77a88128f25 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -232,7 +232,7 @@ impl_stable_hash_for!(struct ty::GenSig<'tcx> { impl_stable_hash_for!(struct ty::FnSig<'tcx> { inputs_and_output, - variadic, + c_variadic, unsafety, abi }); diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index e85b84bce432..e7cc9618080c 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -1944,7 +1944,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { if let ty::FnSig { unsafety: hir::Unsafety::Normal, abi: Abi::Rust, - variadic: false, + c_variadic: false, .. } = self_ty.fn_sig(self.tcx()).skip_binder() { diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index b37b632f4bee..9767396147cf 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -2453,7 +2453,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.mk_fn_sig( params_iter, s.output(), - s.variadic, + s.c_variadic, hir::Unsafety::Normal, abi::Abi::Rust, ) @@ -2779,7 +2779,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn mk_fn_sig(self, inputs: I, output: I::Item, - variadic: bool, + c_variadic: bool, unsafety: hir::Unsafety, abi: abi::Abi) -> , ty::FnSig<'tcx>>>::Output @@ -2788,7 +2788,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { { inputs.chain(iter::once(output)).intern_with(|xs| ty::FnSig { inputs_and_output: self.intern_type_list(xs), - variadic, unsafety, abi + c_variadic, unsafety, abi }) } diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index 709dce4589f6..49ebd202813f 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -65,7 +65,7 @@ impl<'a, 'tcx> Instance<'tcx> { sig.map_bound(|sig| tcx.mk_fn_sig( iter::once(*env_ty.skip_binder()).chain(sig.inputs().iter().cloned()), sig.output(), - sig.variadic, + sig.c_variadic, sig.unsafety, sig.abi )) diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index b15aa8629016..2940757fa905 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -147,9 +147,9 @@ impl<'tcx> Relate<'tcx> for ty::FnSig<'tcx> { { let tcx = relation.tcx(); - if a.variadic != b.variadic { + if a.c_variadic != b.c_variadic { return Err(TypeError::VariadicMismatch( - expected_found(relation, &a.variadic, &b.variadic))); + expected_found(relation, &a.c_variadic, &b.c_variadic))); } let unsafety = relation.relate(&a.unsafety, &b.unsafety)?; let abi = relation.relate(&a.abi, &b.abi)?; @@ -171,7 +171,7 @@ impl<'tcx> Relate<'tcx> for ty::FnSig<'tcx> { }); Ok(ty::FnSig { inputs_and_output: tcx.mk_type_list(inputs_and_output)?, - variadic: a.variadic, + c_variadic: a.c_variadic, unsafety, abi, }) diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index a81d5c9d86ed..f1a465e1f172 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -396,7 +396,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::FnSig<'a> { tcx.lift(&self.inputs_and_output).map(|x| { ty::FnSig { inputs_and_output: x, - variadic: self.variadic, + c_variadic: self.c_variadic, unsafety: self.unsafety, abi: self.abi, } @@ -832,7 +832,7 @@ BraceStructTypeFoldableImpl! { BraceStructTypeFoldableImpl! { impl<'tcx> TypeFoldable<'tcx> for ty::FnSig<'tcx> { - inputs_and_output, variadic, unsafety, abi + inputs_and_output, c_variadic, unsafety, abi } } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 7ade035ce890..3fd2e38a3d3e 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -979,11 +979,11 @@ impl<'tcx> PolyGenSig<'tcx> { /// /// - `inputs`: is the list of arguments and their modes. /// - `output`: is the return type. -/// - `variadic`: indicates whether this is a C-variadic function. +/// - `c_variadic`: indicates whether this is a C-variadic function. #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] pub struct FnSig<'tcx> { pub inputs_and_output: &'tcx List>, - pub variadic: bool, + pub c_variadic: bool, pub unsafety: hir::Unsafety, pub abi: abi::Abi, } @@ -1016,8 +1016,8 @@ impl<'tcx> PolyFnSig<'tcx> { pub fn output(&self) -> ty::Binder> { self.map_bound_ref(|fn_sig| fn_sig.output()) } - pub fn variadic(&self) -> bool { - self.skip_binder().variadic + pub fn c_variadic(&self) -> bool { + self.skip_binder().c_variadic } pub fn unsafety(&self) -> hir::Unsafety { self.skip_binder().unsafety diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index fbe9e3359bfe..aecef3c5ec71 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -360,7 +360,7 @@ impl PrintContext { fn fn_sig(&mut self, f: &mut F, inputs: &[Ty<'_>], - variadic: bool, + c_variadic: bool, output: Ty<'_>) -> fmt::Result { write!(f, "(")?; @@ -370,7 +370,7 @@ impl PrintContext { for &ty in inputs { print!(f, self, write(", "), print_display(ty))?; } - if variadic { + if c_variadic { write!(f, ", ...")?; } } @@ -1074,10 +1074,10 @@ define_print! { } write!(f, "fn")?; - cx.fn_sig(f, self.inputs(), self.variadic, self.output()) + cx.fn_sig(f, self.inputs(), self.c_variadic, self.output()) } debug { - write!(f, "({:?}; variadic: {})->{:?}", self.inputs(), self.variadic, self.output()) + write!(f, "({:?}; c_variadic: {})->{:?}", self.inputs(), self.c_variadic, self.output()) } } } diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs index aea62360651c..49c9555a2c68 100644 --- a/src/librustc_codegen_llvm/abi.rs +++ b/src/librustc_codegen_llvm/abi.rs @@ -422,7 +422,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { let mut inputs = sig.inputs(); let extra_args = if sig.abi == RustCall { - assert!(!sig.variadic && extra_args.is_empty()); + assert!(!sig.c_variadic && extra_args.is_empty()); match sig.inputs().last().unwrap().sty { ty::Tuple(ref tupled_arguments) => { @@ -435,7 +435,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { } } } else { - assert!(sig.variadic || extra_args.is_empty()); + assert!(sig.c_variadic || extra_args.is_empty()); extra_args }; @@ -531,7 +531,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { // If this is a C-variadic function, this is not the return value, // and there is one or more fixed arguments; ensure that the `VaList` // is ignored as an argument. - if sig.variadic { + if sig.c_variadic { match (last_arg_idx, arg_idx) { (Some(last_idx), Some(cur_idx)) if last_idx == cur_idx => { let va_list_did = match cx.tcx.lang_items().va_list() { @@ -589,7 +589,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { args: inputs.iter().chain(extra_args).enumerate().map(|(i, ty)| { arg_of(ty, Some(i)) }).collect(), - variadic: sig.variadic, + c_variadic: sig.c_variadic, conv, }; fn_ty.adjust_for_abi(cx, sig.abi); @@ -717,7 +717,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { llargument_tys.push(llarg_ty); } - if self.variadic { + if self.c_variadic { cx.type_variadic_func(&llargument_tys, llreturn_ty) } else { cx.type_func(&llargument_tys, llreturn_ty) diff --git a/src/librustc_codegen_llvm/debuginfo/type_names.rs b/src/librustc_codegen_llvm/debuginfo/type_names.rs index 176c9b8c542b..8b218ab39d99 100644 --- a/src/librustc_codegen_llvm/debuginfo/type_names.rs +++ b/src/librustc_codegen_llvm/debuginfo/type_names.rs @@ -143,7 +143,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, output.pop(); } - if sig.variadic { + if sig.c_variadic { if !sig.inputs().is_empty() { output.push_str(", ..."); } else { diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index 684dfac991b4..627380ee38ff 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -232,7 +232,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { &mut self, mut bx: Bx, ) { - if self.fn_ty.variadic { + if self.fn_ty.c_variadic { if let Some(va_list) = self.va_list_ref { bx.va_end(va_list.llval); } @@ -507,7 +507,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // The "spoofed" `VaList` added to a C-variadic functions signature // should not be included in the `extra_args` calculation. - let extra_args_start_idx = sig.inputs().len() - if sig.variadic { 1 } else { 0 }; + let extra_args_start_idx = sig.inputs().len() - if sig.c_variadic { 1 } else { 0 }; let extra_args = &args[extra_args_start_idx..]; let extra_args = extra_args.iter().map(|op_arg| { let op_ty = op_arg.ty(self.mir, bx.tcx()); @@ -695,7 +695,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // an "spoofed" `VaList`. This argument is ignored, but we need to // populate it with a dummy operand so that the users real arguments // are not overwritten. - let i = if sig.variadic && last_arg_idx.map(|x| x == i).unwrap_or(false) { + let i = if sig.c_variadic && last_arg_idx.map(|x| x == i).unwrap_or(false) { let layout = match self.cx.tcx().lang_items().va_list() { Some(did) => bx.cx().layout_of(bx.tcx().type_of(did)), None => bug!("`va_list` language item required for C-variadics"), diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 95cf8cfe2d03..dc77d4673cd2 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -585,7 +585,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( indirect_operand.store(bx, tmp); tmp } else { - if fx.fn_ty.variadic && last_arg_idx.map(|idx| arg_index == idx).unwrap_or(false) { + if fx.fn_ty.c_variadic && last_arg_idx.map(|idx| arg_index == idx).unwrap_or(false) { let va_list_impl = match arg_decl.ty.ty_adt_def() { Some(adt) => adt.non_enum_variant(), None => bug!("`va_list` language item improperly constructed") diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index fb279a5d9b87..35489ab42e73 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -766,7 +766,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { let def_id = self.cx.tcx.hir().local_def_id(id); let sig = self.cx.tcx.fn_sig(def_id); let sig = self.cx.tcx.erase_late_bound_regions(&sig); - let inputs = if sig.variadic { + let inputs = if sig.c_variadic { // Don't include the spoofed `VaList` in the functions list // of inputs. &sig.inputs()[..sig.inputs().len() - 1] diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index f897795d86f4..df035aab54c9 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -1604,12 +1604,12 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { debug!("check_call_inputs({:?}, {:?})", sig, args); // Do not count the `VaList` argument as a "true" argument to // a C-variadic function. - let inputs = if sig.variadic { + let inputs = if sig.c_variadic { &sig.inputs()[..sig.inputs().len() - 1] } else { &sig.inputs()[..] }; - if args.len() < inputs.len() || (args.len() > inputs.len() && !sig.variadic) { + if args.len() < inputs.len() || (args.len() > inputs.len() && !sig.c_variadic) { span_mirbug!(self, term, "call to {:?} with wrong # of args", sig); } for (n, (fn_arg, op_arg)) in inputs.iter().zip(args).enumerate() { diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index a26a1a7861eb..059af2dbba94 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -353,7 +353,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { output.pop(); } - if sig.variadic { + if sig.c_variadic { if !sig.inputs().is_empty() { output.push_str(", ..."); } else { diff --git a/src/librustc_target/abi/call/arm.rs b/src/librustc_target/abi/call/arm.rs index 52d7f3ac3dcb..e3fee8e5700c 100644 --- a/src/librustc_target/abi/call/arm.rs +++ b/src/librustc_target/abi/call/arm.rs @@ -99,7 +99,7 @@ pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType<'a, Ty>) // `extern "aapcs"`, then we must use the VFP registers for homogeneous aggregates. let vfp = cx.target_spec().llvm_target.ends_with("hf") && fty.conv != Conv::ArmAapcs - && !fty.variadic; + && !fty.c_variadic; if !fty.ret.is_ignore() { classify_ret_ty(cx, &mut fty.ret, vfp); diff --git a/src/librustc_target/abi/call/mod.rs b/src/librustc_target/abi/call/mod.rs index 8ada328a1584..fbbd120f934b 100644 --- a/src/librustc_target/abi/call/mod.rs +++ b/src/librustc_target/abi/call/mod.rs @@ -531,7 +531,7 @@ pub struct FnType<'a, Ty> { /// LLVM return type. pub ret: ArgType<'a, Ty>, - pub variadic: bool, + pub c_variadic: bool, pub conv: Conv, } diff --git a/src/librustc_traits/chalk_context/program_clauses.rs b/src/librustc_traits/chalk_context/program_clauses.rs index 4d8a67ca6386..3f88d0e08b46 100644 --- a/src/librustc_traits/chalk_context/program_clauses.rs +++ b/src/librustc_traits/chalk_context/program_clauses.rs @@ -105,7 +105,7 @@ fn assemble_builtin_sized_impls<'tcx>( let fn_ptr = generic_types::fn_ptr( tcx, fn_ptr.inputs_and_output.len(), - fn_ptr.variadic, + fn_ptr.c_variadic, fn_ptr.unsafety, fn_ptr.abi ); @@ -190,11 +190,11 @@ fn wf_clause_for_raw_ptr<'tcx>( fn wf_clause_for_fn_ptr<'tcx>( tcx: ty::TyCtxt<'_, '_, 'tcx>, arity_and_output: usize, - variadic: bool, + c_variadic: bool, unsafety: hir::Unsafety, abi: abi::Abi ) -> Clauses<'tcx> { - let fn_ptr = generic_types::fn_ptr(tcx, arity_and_output, variadic, unsafety, abi); + let fn_ptr = generic_types::fn_ptr(tcx, arity_and_output, c_variadic, unsafety, abi); let wf_clause = ProgramClause { goal: DomainGoal::WellFormed(WellFormed::Ty(fn_ptr)), @@ -503,7 +503,7 @@ impl ChalkInferenceContext<'cx, 'gcx, 'tcx> { wf_clause_for_fn_ptr( self.infcx.tcx, fn_ptr.inputs_and_output.len(), - fn_ptr.variadic, + fn_ptr.c_variadic, fn_ptr.unsafety, fn_ptr.abi ) diff --git a/src/librustc_traits/generic_types.rs b/src/librustc_traits/generic_types.rs index 634c024b0646..f2ce9631f35a 100644 --- a/src/librustc_traits/generic_types.rs +++ b/src/librustc_traits/generic_types.rs @@ -24,7 +24,7 @@ crate fn raw_ptr(tcx: TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> crate fn fn_ptr( tcx: ty::TyCtxt<'_, '_, 'tcx>, arity_and_output: usize, - variadic: bool, + c_variadic: bool, unsafety: hir::Unsafety, abi: abi::Abi ) -> Ty<'tcx> { @@ -37,7 +37,7 @@ crate fn fn_ptr( let fn_sig = ty::Binder::bind(ty::FnSig { inputs_and_output, - variadic, + c_variadic, unsafety, abi, }); diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 1d99584eec49..b3694752204c 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -18,7 +18,7 @@ use rustc::ty::subst::{Kind, Subst, InternalSubsts, SubstsRef}; use rustc::ty::wf::object_region_bounds; use rustc_data_structures::sync::Lrc; use rustc_target::spec::abi; -use crate::require_c_abi_if_variadic; +use crate::require_c_abi_if_c_variadic; use smallvec::SmallVec; use syntax::ast; use syntax::feature_gate::{GateIssue, emit_feature_err}; @@ -1768,7 +1768,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { tcx.mk_tup(fields.iter().map(|t| self.ast_ty_to_ty(&t))) } hir::TyKind::BareFn(ref bf) => { - require_c_abi_if_variadic(tcx, &bf.decl, bf.abi, ast_ty.span); + require_c_abi_if_c_variadic(tcx, &bf.decl, bf.abi, ast_ty.span); tcx.mk_fn_ptr(self.ty_of_fn(bf.unsafety, bf.abi, &bf.decl)) } hir::TyKind::TraitObject(ref bounds, ref lifetime) => { @@ -1913,7 +1913,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let bare_fn_ty = ty::Binder::bind(tcx.mk_fn_sig( input_tys, output_ty, - decl.variadic, + decl.c_variadic, unsafety, abi )); diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index aeb43635eb78..0a4c0eb3aff7 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -368,7 +368,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .0; let fn_sig = self.normalize_associated_types_in(call_expr.span, &fn_sig); - let inputs = if fn_sig.variadic { + let inputs = if fn_sig.c_variadic { if fn_sig.inputs().len() > 1 { &fn_sig.inputs()[..fn_sig.inputs().len() - 1] } else { @@ -391,7 +391,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { inputs, &expected_arg_tys[..], arg_exprs, - fn_sig.variadic, + fn_sig.c_variadic, TupleArgumentsFlag::DontTupleArguments, def_span, ); @@ -424,7 +424,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn_sig.inputs(), &expected_arg_tys, arg_exprs, - fn_sig.variadic, + fn_sig.c_variadic, TupleArgumentsFlag::TupleArguments, None, ); diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index 2a4b17a63995..db89b32be7b6 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -141,7 +141,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.tcx.mk_fn_sig( iter::once(self.tcx.intern_tup(sig.inputs())), sig.output(), - sig.variadic, + sig.c_variadic, sig.unsafety, sig.abi, ) @@ -386,7 +386,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Watch out for some surprises and just ignore the // expectation if things don't see to match up with what we // expect. - if expected_sig.sig.variadic != decl.variadic { + if expected_sig.sig.c_variadic != decl.c_variadic { return self.sig_of_closure_no_expectation(expr_def_id, decl, body); } else if expected_sig.sig.inputs_and_output.len() != decl.inputs.len() + 1 { return self.sig_of_closure_with_mismatched_number_of_arguments( @@ -404,7 +404,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let bound_sig = ty::Binder::bind(self.tcx.mk_fn_sig( expected_sig.sig.inputs().iter().cloned(), expected_sig.sig.output(), - decl.variadic, + decl.c_variadic, hir::Unsafety::Normal, Abi::RustCall, )); @@ -586,7 +586,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let result = ty::Binder::bind(self.tcx.mk_fn_sig( supplied_arguments, supplied_return, - decl.variadic, + decl.c_variadic, hir::Unsafety::Normal, Abi::RustCall, )); @@ -621,7 +621,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let result = ty::Binder::bind(self.tcx.mk_fn_sig( supplied_arguments, self.tcx.types.err, - decl.variadic, + decl.c_variadic, hir::Unsafety::Normal, Abi::RustCall, )); diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 202d8bec4e95..3a430f77b6c6 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -130,7 +130,7 @@ use std::mem::replace; use std::ops::{self, Deref}; use std::slice; -use crate::require_c_abi_if_variadic; +use crate::require_c_abi_if_c_variadic; use crate::session::{CompileIncomplete, Session}; use crate::session::config::EntryFnType; use crate::TypeAndSubsts; @@ -1072,7 +1072,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, fn_sig = fcx.tcx.mk_fn_sig( fn_sig.inputs().iter().cloned(), revealed_ret_ty, - fn_sig.variadic, + fn_sig.c_variadic, fn_sig.unsafety, fn_sig.abi ); @@ -1426,7 +1426,7 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite } if let hir::ForeignItemKind::Fn(ref fn_decl, _, _) = item.node { - require_c_abi_if_variadic(tcx, fn_decl, m.abi, item.span); + require_c_abi_if_c_variadic(tcx, fn_decl, m.abi, item.span); } } } @@ -2783,7 +2783,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { &method.sig.inputs()[1..] ); self.check_argument_types(sp, expr_sp, &method.sig.inputs()[1..], &expected_arg_tys[..], - args_no_rcvr, method.sig.variadic, tuple_arguments, + args_no_rcvr, method.sig.c_variadic, tuple_arguments, self.tcx.hir().span_if_local(method.def_id)); method.sig.output() } @@ -2862,7 +2862,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn_inputs: &[Ty<'tcx>], mut expected_arg_tys: &[Ty<'tcx>], args: &'gcx [hir::Expr], - variadic: bool, + c_variadic: bool, tuple_arguments: TupleArgumentsFlag, def_span: Option) { let tcx = self.tcx; @@ -2886,11 +2886,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let param_count_error = |expected_count: usize, arg_count: usize, error_code: &str, - variadic: bool, + c_variadic: bool, sugg_unit: bool| { let mut err = tcx.sess.struct_span_err_with_code(sp, &format!("this function takes {}{} but {} {} supplied", - if variadic {"at least "} else {""}, + if c_variadic { "at least " } else { "" }, potentially_plural_count(expected_count, "parameter"), potentially_plural_count(arg_count, "parameter"), if arg_count == 1 {"was"} else {"were"}), @@ -2910,7 +2910,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Applicability::MachineApplicable); } else { err.span_label(sp, format!("expected {}{}", - if variadic {"at least "} else {""}, + if c_variadic { "at least " } else { "" }, potentially_plural_count(expected_count, "parameter"))); } err.emit(); @@ -2944,7 +2944,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } else if expected_arg_count == supplied_arg_count { fn_inputs.to_vec() - } else if variadic { + } else if c_variadic { if supplied_arg_count >= expected_arg_count { fn_inputs.to_vec() } else { @@ -2991,10 +2991,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.select_obligations_where_possible(false); } - // For variadic functions, we don't have a declared type for all of + // For C-variadic functions, we don't have a declared type for all of // the arguments hence we only do our usual type checking with // the arguments who's types we do know. - let t = if variadic { + let t = if c_variadic { expected_arg_count } else if tuple_arguments == TupleArguments { args.len() @@ -3043,7 +3043,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // We also need to make sure we at least write the ty of the other // arguments which we skipped above. - if variadic { + if c_variadic { fn variadic_error<'tcx>(s: &Session, span: Span, t: Ty<'tcx>, cast_ty: &str) { use crate::structured_errors::{VariadicError, StructuredDiagnostic}; VariadicError::new(s, span, t, cast_ty).diagnostic().emit(); diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 419796a2014e..2095c81d0fb0 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -136,14 +136,14 @@ fn check_type_alias_enum_variants_enabled<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, } } -fn require_c_abi_if_variadic(tcx: TyCtxt<'_, '_, '_>, - decl: &hir::FnDecl, - abi: Abi, - span: Span) { - if decl.variadic && !(abi == Abi::C || abi == Abi::Cdecl) { +fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_, '_, '_>, + decl: &hir::FnDecl, + abi: Abi, + span: Span) { + if decl.c_variadic && !(abi == Abi::C || abi == Abi::Cdecl) { let mut err = struct_span_err!(tcx.sess, span, E0045, - "variadic function must have C or cdecl calling convention"); - err.span_label(span, "variadics require C or cdecl calling convention").emit(); + "C-variadic function must have C or cdecl calling convention"); + err.span_label(span, "C-variadics require C or cdecl calling convention").emit(); } } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 5bae00b9cb84..b4bf6665d4e9 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1804,7 +1804,7 @@ impl Arg { pub struct FnDecl { pub inputs: Vec, pub output: FunctionRetTy, - pub variadic: bool, + pub c_variadic: bool, } impl FnDecl { diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 27b0cfb16307..0bdc7fd60cb1 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -985,7 +985,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { P(ast::FnDecl { inputs, output, - variadic: false + c_variadic: false }) } diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 8efc4689cac8..032a0e993ae4 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -673,7 +673,7 @@ pub fn noop_visit_asyncness(asyncness: &mut IsAsync, vis: &mut T) } pub fn noop_visit_fn_decl(decl: &mut P, vis: &mut T) { - let FnDecl { inputs, output, variadic: _ } = decl.deref_mut(); + let FnDecl { inputs, output, c_variadic: _ } = decl.deref_mut(); visit_vec(inputs, |input| vis.visit_arg(input)); match output { FunctionRetTy::Default(span) => vis.visit_span(span), diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index b58091b57da4..5f3b08bf942c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1457,12 +1457,12 @@ impl<'a> Parser<'a> { }; self.expect_keyword(keywords::Fn)?; - let (inputs, variadic) = self.parse_fn_args(false, true)?; + let (inputs, c_variadic) = self.parse_fn_args(false, true)?; let ret_ty = self.parse_ret_ty(false)?; let decl = P(FnDecl { inputs, output: ret_ty, - variadic, + c_variadic, }); Ok(TyKind::BareFn(P(BareFnTy { abi, @@ -1635,7 +1635,7 @@ impl<'a> Parser<'a> { } fn parse_ty_common(&mut self, allow_plus: bool, allow_qpath_recovery: bool, - allow_variadic: bool) -> PResult<'a, P> { + allow_c_variadic: bool) -> PResult<'a, P> { maybe_whole!(self, NtTy, |x| x); let lo = self.span; @@ -1773,12 +1773,12 @@ impl<'a> Parser<'a> { } } } else if self.check(&token::DotDotDot) { - if allow_variadic { + if allow_c_variadic { self.eat(&token::DotDotDot); TyKind::CVarArgs } else { return Err(self.fatal( - "only foreign functions are allowed to be variadic" + "only foreign functions are allowed to be C-variadic" )); } } else { @@ -1969,7 +1969,7 @@ impl<'a> Parser<'a> { /// This version of parse arg doesn't necessarily require identifier names. fn parse_arg_general(&mut self, require_name: bool, is_trait_item: bool, - allow_variadic: bool) -> PResult<'a, Arg> { + allow_c_variadic: bool) -> PResult<'a, Arg> { maybe_whole!(self, NtArg, |x| x); if let Ok(Some(_)) = self.parse_self_arg() { @@ -2018,12 +2018,12 @@ impl<'a> Parser<'a> { } self.eat_incorrect_doc_comment("a method argument's type"); - (pat, self.parse_ty_common(true, true, allow_variadic)?) + (pat, self.parse_ty_common(true, true, allow_c_variadic)?) } else { debug!("parse_arg_general ident_to_pat"); let parser_snapshot_before_ty = self.clone(); self.eat_incorrect_doc_comment("a method argument's type"); - let mut ty = self.parse_ty_common(true, true, allow_variadic); + let mut ty = self.parse_ty_common(true, true, allow_c_variadic); if ty.is_ok() && self.token != token::Comma && self.token != token::CloseDelim(token::Paren) { // This wasn't actually a type, but a pattern looking like a type, @@ -2042,7 +2042,7 @@ impl<'a> Parser<'a> { (pat, ty) } Err(mut err) => { - // If this is a variadic argument and we hit an error, return the + // If this is a C-variadic argument and we hit an error, return the // error. if self.token == token::DotDotDot { return Err(err); @@ -6122,12 +6122,12 @@ impl<'a> Parser<'a> { Ok(where_clause) } - fn parse_fn_args(&mut self, named_args: bool, allow_variadic: bool) + fn parse_fn_args(&mut self, named_args: bool, allow_c_variadic: bool) -> PResult<'a, (Vec , bool)> { self.expect(&token::OpenDelim(token::Paren))?; let sp = self.span; - let mut variadic = false; + let mut c_variadic = false; let (args, recovered): (Vec>, bool) = self.parse_seq_to_before_end( &token::CloseDelim(token::Paren), @@ -6141,14 +6141,14 @@ impl<'a> Parser<'a> { named_args }; match p.parse_arg_general(enforce_named_args, false, - allow_variadic) { + allow_c_variadic) { Ok(arg) => { if let TyKind::CVarArgs = arg.ty.node { - variadic = true; + c_variadic = true; if p.token != token::CloseDelim(token::Paren) { let span = p.span; p.span_err(span, - "`...` must be last in argument list in variadic function"); + "`...` must be the last argument of a C-variadic function"); Ok(None) } else { Ok(Some(arg)) @@ -6176,24 +6176,24 @@ impl<'a> Parser<'a> { let args: Vec<_> = args.into_iter().filter_map(|x| x).collect(); - if variadic && args.is_empty() { + if c_variadic && args.is_empty() { self.span_err(sp, - "variadic function must be declared with at least one named argument"); + "C-variadic function must be declared with at least one named argument"); } - Ok((args, variadic)) + Ok((args, c_variadic)) } /// Parses the argument list and result type of a function declaration. - fn parse_fn_decl(&mut self, allow_variadic: bool) -> PResult<'a, P> { + fn parse_fn_decl(&mut self, allow_c_variadic: bool) -> PResult<'a, P> { - let (args, variadic) = self.parse_fn_args(true, allow_variadic)?; + let (args, c_variadic) = self.parse_fn_args(true, allow_c_variadic)?; let ret_ty = self.parse_ret_ty(true)?; Ok(P(FnDecl { inputs: args, output: ret_ty, - variadic, + c_variadic, })) } @@ -6340,7 +6340,7 @@ impl<'a> Parser<'a> { Ok(P(FnDecl { inputs: fn_inputs, output: self.parse_ret_ty(true)?, - variadic: false + c_variadic: false })) } @@ -6366,7 +6366,7 @@ impl<'a> Parser<'a> { Ok(P(FnDecl { inputs: inputs_captures, output, - variadic: false + c_variadic: false })) } @@ -6398,8 +6398,8 @@ impl<'a> Parser<'a> { abi: Abi) -> PResult<'a, ItemInfo> { let (ident, mut generics) = self.parse_fn_header()?; - let allow_variadic = abi == Abi::C && unsafety == Unsafety::Unsafe; - let decl = self.parse_fn_decl(allow_variadic)?; + let allow_c_variadic = abi == Abi::C && unsafety == Unsafety::Unsafe; + let decl = self.parse_fn_decl(allow_c_variadic)?; generics.where_clause = self.parse_where_clause()?; let (inner_attrs, body) = self.parse_inner_attrs_and_block()?; let header = FnHeader { unsafety, asyncness, constness, abi }; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index b3964d0ce9c8..4f4336c5b271 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2814,7 +2814,7 @@ impl<'a> State<'a> { -> io::Result<()> { self.popen()?; self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, false))?; - if decl.variadic { + if decl.c_variadic { self.s.word(", ...")?; } self.pclose()?; @@ -3241,7 +3241,7 @@ mod tests { let decl = ast::FnDecl { inputs: Vec::new(), output: ast::FunctionRetTy::Default(syntax_pos::DUMMY_SP), - variadic: false + c_variadic: false }; let generics = ast::Generics::default(); assert_eq!( diff --git a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs index 956bc5ad862c..80e0b0102af7 100644 --- a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs @@ -112,7 +112,7 @@ fn iter_exprs(depth: usize, f: &mut FnMut(P)) { let decl = P(FnDecl { inputs: vec![], output: FunctionRetTy::Default(DUMMY_SP), - variadic: false, + c_variadic: false, }); iter_exprs(depth - 1, &mut |e| g( ExprKind::Closure(CaptureBy::Value, diff --git a/src/test/ui/c-variadic/variadic-ffi-1.stderr b/src/test/ui/c-variadic/variadic-ffi-1.stderr index 52d7394d6af0..61d55ce0d3ef 100644 --- a/src/test/ui/c-variadic/variadic-ffi-1.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-1.stderr @@ -1,8 +1,8 @@ -error[E0045]: variadic function must have C or cdecl calling convention +error[E0045]: C-variadic function must have C or cdecl calling convention --> $DIR/variadic-ffi-1.rs:5:5 | LL | fn printf(_: *const u8, ...); //~ ERROR: variadic function must have C or cdecl calling - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variadics require C or cdecl calling convention + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention error: aborting due to previous error diff --git a/src/test/ui/c-variadic/variadic-ffi-2.stderr b/src/test/ui/c-variadic/variadic-ffi-2.stderr index cb2a9f874b7b..4c8b8d2b2e1a 100644 --- a/src/test/ui/c-variadic/variadic-ffi-2.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-2.stderr @@ -1,8 +1,8 @@ -error[E0045]: variadic function must have C or cdecl calling convention +error[E0045]: C-variadic function must have C or cdecl calling convention --> $DIR/variadic-ffi-2.rs:3:11 | LL | fn baz(f: extern "stdcall" fn(usize, ...)) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variadics require C or cdecl calling convention + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0045.stderr b/src/test/ui/error-codes/E0045.stderr index b38bbc169bd6..0ce91f0a4010 100644 --- a/src/test/ui/error-codes/E0045.stderr +++ b/src/test/ui/error-codes/E0045.stderr @@ -1,8 +1,8 @@ -error[E0045]: variadic function must have C or cdecl calling convention +error[E0045]: C-variadic function must have C or cdecl calling convention --> $DIR/E0045.rs:1:17 | LL | extern "Rust" { fn foo(x: u8, ...); } //~ ERROR E0045 - | ^^^^^^^^^^^^^^^^^^^ variadics require C or cdecl calling convention + | ^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention error: aborting due to previous error diff --git a/src/test/ui/invalid/invalid-variadic-function.rs b/src/test/ui/invalid/invalid-variadic-function.rs index aea630e7c26a..8d23f0e47707 100644 --- a/src/test/ui/invalid/invalid-variadic-function.rs +++ b/src/test/ui/invalid/invalid-variadic-function.rs @@ -1,3 +1,3 @@ extern "C" fn foo(x: u8, ...); -//~^ ERROR only foreign functions are allowed to be variadic +//~^ ERROR only foreign functions are allowed to be C-variadic //~| ERROR expected one of `->`, `where`, or `{`, found `;` diff --git a/src/test/ui/invalid/invalid-variadic-function.stderr b/src/test/ui/invalid/invalid-variadic-function.stderr index 7a0b8066fd52..b2dbf8b91908 100644 --- a/src/test/ui/invalid/invalid-variadic-function.stderr +++ b/src/test/ui/invalid/invalid-variadic-function.stderr @@ -1,4 +1,4 @@ -error: only foreign functions are allowed to be variadic +error: only foreign functions are allowed to be C-variadic --> $DIR/invalid-variadic-function.rs:1:26 | LL | extern "C" fn foo(x: u8, ...); diff --git a/src/test/ui/parser/variadic-ffi-3.rs b/src/test/ui/parser/variadic-ffi-3.rs index 13bce27bb834..ce83cc87abe0 100644 --- a/src/test/ui/parser/variadic-ffi-3.rs +++ b/src/test/ui/parser/variadic-ffi-3.rs @@ -1,5 +1,5 @@ fn foo(x: isize, ...) { - //~^ ERROR: only foreign functions are allowed to be variadic + //~^ ERROR: only foreign functions are allowed to be C-variadic } fn main() {} diff --git a/src/test/ui/parser/variadic-ffi-3.stderr b/src/test/ui/parser/variadic-ffi-3.stderr index 150de9e63d39..8ea4d194396f 100644 --- a/src/test/ui/parser/variadic-ffi-3.stderr +++ b/src/test/ui/parser/variadic-ffi-3.stderr @@ -1,4 +1,4 @@ -error: only foreign functions are allowed to be variadic +error: only foreign functions are allowed to be C-variadic --> $DIR/variadic-ffi-3.rs:1:18 | LL | fn foo(x: isize, ...) { diff --git a/src/test/ui/parser/variadic-ffi-4.rs b/src/test/ui/parser/variadic-ffi-4.rs index 812ed256a5d3..5f8b3f8f539b 100644 --- a/src/test/ui/parser/variadic-ffi-4.rs +++ b/src/test/ui/parser/variadic-ffi-4.rs @@ -1,5 +1,5 @@ extern "C" fn foo(x: isize, ...) { - //~^ ERROR: only foreign functions are allowed to be variadic + //~^ ERROR: only foreign functions are allowed to be C-variadic } fn main() {} diff --git a/src/test/ui/parser/variadic-ffi-4.stderr b/src/test/ui/parser/variadic-ffi-4.stderr index 2d036b0cf379..69fbf84869c1 100644 --- a/src/test/ui/parser/variadic-ffi-4.stderr +++ b/src/test/ui/parser/variadic-ffi-4.stderr @@ -1,4 +1,4 @@ -error: only foreign functions are allowed to be variadic +error: only foreign functions are allowed to be C-variadic --> $DIR/variadic-ffi-4.rs:1:29 | LL | extern "C" fn foo(x: isize, ...) { From f7dd4389f8145fe0f29c5b29784b244fa38d2bfb Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Sun, 24 Feb 2019 00:17:25 +0000 Subject: [PATCH 100/381] Fix doc comments in librustc/hir/lowering.rs --- src/librustc/hir/lowering.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 6e96054bea9b..7a6c7f1e8997 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -74,7 +74,7 @@ const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF; pub struct LoweringContext<'a> { crate_root: Option<&'static str>, - // Used to assign ids to HIR nodes that do not directly correspond to an AST node. + /// Used to assign ids to HIR nodes that do not directly correspond to an AST node. sess: &'a Session, cstore: &'a dyn CrateStore, @@ -107,25 +107,25 @@ pub struct LoweringContext<'a> { /// written at all (e.g., `&T` or `std::cell::Ref`). anonymous_lifetime_mode: AnonymousLifetimeMode, - // Used to create lifetime definitions from in-band lifetime usages. - // e.g., `fn foo(x: &'x u8) -> &'x u8` to `fn foo<'x>(x: &'x u8) -> &'x u8` - // When a named lifetime is encountered in a function or impl header and - // has not been defined - // (i.e., it doesn't appear in the in_scope_lifetimes list), it is added - // to this list. The results of this list are then added to the list of - // lifetime definitions in the corresponding impl or function generics. + /// Used to create lifetime definitions from in-band lifetime usages. + /// e.g., `fn foo(x: &'x u8) -> &'x u8` to `fn foo<'x>(x: &'x u8) -> &'x u8` + /// When a named lifetime is encountered in a function or impl header and + /// has not been defined + /// (i.e., it doesn't appear in the in_scope_lifetimes list), it is added + /// to this list. The results of this list are then added to the list of + /// lifetime definitions in the corresponding impl or function generics. lifetimes_to_define: Vec<(Span, ParamName)>, - // Whether or not in-band lifetimes are being collected. This is used to - // indicate whether or not we're in a place where new lifetimes will result - // in in-band lifetime definitions, such a function or an impl header, - // including implicit lifetimes from `impl_header_lifetime_elision`. + /// Whether or not in-band lifetimes are being collected. This is used to + /// indicate whether or not we're in a place where new lifetimes will result + /// in in-band lifetime definitions, such a function or an impl header, + /// including implicit lifetimes from `impl_header_lifetime_elision`. is_collecting_in_band_lifetimes: bool, - // Currently in-scope lifetimes defined in impl headers, fn headers, or HRTB. - // When `is_collectin_in_band_lifetimes` is true, each lifetime is checked - // against this list to see if it is already in-scope, or if a definition - // needs to be created for it. + /// Currently in-scope lifetimes defined in impl headers, fn headers, or HRTB. + /// When `is_collectin_in_band_lifetimes` is true, each lifetime is checked + /// against this list to see if it is already in-scope, or if a definition + /// needs to be created for it. in_scope_lifetimes: Vec, current_module: NodeId, From b70a9532a9d3e2ae4b9bf7bc4a4a0bfc7dbe134b Mon Sep 17 00:00:00 2001 From: Trevor Spiteri Date: Wed, 20 Feb 2019 15:11:22 +0100 Subject: [PATCH 101/381] Replace `s` with `self` in docs for str methods taking self. --- src/libcore/str/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 8b51d8465141..53334adadb85 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -3965,7 +3965,7 @@ impl str { me.make_ascii_lowercase() } - /// Return an iterator that escapes each char in `s` with [`char::escape_debug`]. + /// Return an iterator that escapes each char in `self` with [`char::escape_debug`]. /// /// Note: only extended grapheme codepoints that begin the string will be /// escaped. @@ -4013,7 +4013,7 @@ impl str { } } - /// Return an iterator that escapes each char in `s` with [`char::escape_default`]. + /// Return an iterator that escapes each char in `self` with [`char::escape_default`]. /// /// [`char::escape_default`]: ../std/primitive.char.html#method.escape_default /// @@ -4051,7 +4051,7 @@ impl str { EscapeDefault { inner: self.chars().flat_map(CharEscapeDefault) } } - /// Return an iterator that escapes each char in `s` with [`char::escape_unicode`]. + /// Return an iterator that escapes each char in `self` with [`char::escape_unicode`]. /// /// [`char::escape_unicode`]: ../std/primitive.char.html#method.escape_unicode /// From 320640060f38957028141ea30bc4d5577d1e53b0 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 27 Feb 2019 08:03:54 -0800 Subject: [PATCH 102/381] Whitelist containers that allow older toolchains We'll use this as a temporary measure to get an LLVM update landed, but we'll have to go through and update images later to make sure they've got the right toolchains. --- config.toml.example | 2 ++ src/bootstrap/config.rs | 3 +++ src/bootstrap/native.rs | 4 ++++ src/ci/docker/dist-x86_64-netbsd/Dockerfile | 3 ++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config.toml.example b/config.toml.example index f45db37c33b8..8f6bf03489f0 100644 --- a/config.toml.example +++ b/config.toml.example @@ -104,6 +104,8 @@ # The value specified here will be passed as `-DLLVM_USE_LINKER` to CMake. #use-linker = "lld" +# Whether or not to specify `-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=YES` +#allow-old-toolchain = false # ============================================================================= # General build configuration options diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 7d3e584f1a6f..d20958854ed6 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -78,6 +78,7 @@ pub struct Config { pub llvm_link_jobs: Option, pub llvm_version_suffix: Option, pub llvm_use_linker: Option, + pub llvm_allow_old_toolchain: Option, pub lld_enabled: bool, pub lldb_enabled: bool, @@ -263,6 +264,7 @@ struct Llvm { ldflags: Option, use_libcxx: Option, use_linker: Option, + allow_old_toolchain: Option, } #[derive(Deserialize, Default, Clone)] @@ -530,6 +532,7 @@ impl Config { config.llvm_ldflags = llvm.ldflags.clone(); set(&mut config.llvm_use_libcxx, llvm.use_libcxx); config.llvm_use_linker = llvm.use_linker.clone(); + config.llvm_allow_old_toolchain = llvm.allow_old_toolchain.clone(); } if let Some(ref rust) = toml.rust { diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 192b1cd1fbb7..d78670cfe515 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -238,6 +238,10 @@ impl Step for Llvm { cfg.define("LLVM_USE_LINKER", linker); } + if let Some(true) = builder.config.llvm_allow_old_toolchain { + cfg.define("LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN", "YES"); + } + if let Some(ref python) = builder.config.python { cfg.define("PYTHON_EXECUTABLE", python); } diff --git a/src/ci/docker/dist-x86_64-netbsd/Dockerfile b/src/ci/docker/dist-x86_64-netbsd/Dockerfile index a17a7ebc03dd..4fe7e2cca2b6 100644 --- a/src/ci/docker/dist-x86_64-netbsd/Dockerfile +++ b/src/ci/docker/dist-x86_64-netbsd/Dockerfile @@ -33,5 +33,6 @@ ENV \ ENV HOSTS=x86_64-unknown-netbsd -ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs +ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs \ + --set llvm.allow-old-toolchain ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS From e67050e8b6cbf48d041eb5f3993d620402073a7a Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Wed, 27 Feb 2019 17:41:25 +0100 Subject: [PATCH 103/381] Don't promote function calls to nonpromotable things --- src/librustc_mir/transform/qualify_consts.rs | 7 ++----- src/test/ui/consts/invalid_promotion.rs | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 src/test/ui/consts/invalid_promotion.rs diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 285c674643f2..73ac68c4ac3b 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -507,7 +507,7 @@ impl Qualif for IsNotPromotable { fn in_call( cx: &ConstCx<'_, 'tcx>, callee: &Operand<'tcx>, - _args: &[Operand<'tcx>], + args: &[Operand<'tcx>], _return_ty: Ty<'tcx>, ) -> bool { if cx.mode == Mode::Fn { @@ -520,10 +520,7 @@ impl Qualif for IsNotPromotable { } } - // FIXME(eddyb) do we need "not promotable" in anything - // other than `Mode::Fn` by any chance? - - false + Self::in_operand(cx, callee) || args.iter().any(|arg| Self::in_operand(cx, arg)) } } diff --git a/src/test/ui/consts/invalid_promotion.rs b/src/test/ui/consts/invalid_promotion.rs new file mode 100644 index 000000000000..f98406e50e9a --- /dev/null +++ b/src/test/ui/consts/invalid_promotion.rs @@ -0,0 +1,18 @@ +// compile-pass +// note this was only reproducible with lib crates +// compile-flags: --crate-type=lib + +pub struct Hz; + +impl Hz { + pub const fn num(&self) -> u32 { + 42 + } + pub const fn normalized(&self) -> Hz { + Hz + } + + pub const fn as_u32(&self) -> u32 { + self.normalized().num() // this used to promote the `self.normalized()` + } +} From f92c20426ea5f5ddcc6dcf73dbe0739d3d76b614 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 27 Feb 2019 18:58:19 +0100 Subject: [PATCH 104/381] improve readability --- src/libcore/mem.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 6b1b91d00faa..f78213ba9f67 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -908,7 +908,7 @@ pub fn discriminant(v: &T) -> Discriminant { /// `ManuallyDrop` is subject to the same layout optimizations as `T`. /// As a consequence, it has *no effect* on the assumptions that the compiler makes /// about all values being initialized at their type. In particular, initializing -/// a `ManuallyDrop<&T>` with [`mem::zeroed`] is undefined behavior. +/// a `ManuallyDrop<&mut T>` with [`mem::zeroed`] is undefined behavior. /// /// # Examples /// From 93b6d9e086c6910118a57e4332c9448ab550931f Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Mon, 11 Feb 2019 04:23:21 +0900 Subject: [PATCH 105/381] libstd => 2018 --- src/libstd/Cargo.toml | 1 + src/libstd/alloc.rs | 5 +- src/libstd/build.rs | 2 - src/libstd/collections/hash/bench.rs | 4 +- src/libstd/collections/hash/map.rs | 24 +-- src/libstd/collections/hash/set.rs | 12 +- src/libstd/collections/hash/table.rs | 17 +- src/libstd/collections/mod.rs | 2 +- src/libstd/env.rs | 26 +-- src/libstd/error.rs | 23 +-- src/libstd/f32.rs | 16 +- src/libstd/f64.rs | 14 +- src/libstd/ffi/c_str.rs | 44 ++--- src/libstd/ffi/os_str.rs | 24 +-- src/libstd/fs.rs | 47 +++--- src/libstd/io/buffered.rs | 21 ++- src/libstd/io/cursor.rs | 11 +- src/libstd/io/error.rs | 18 +-- src/libstd/io/impls.rs | 11 +- src/libstd/io/lazy.rs | 10 +- src/libstd/io/mod.rs | 23 ++- src/libstd/io/stdio.rs | 30 ++-- src/libstd/io/util.rs | 10 +- src/libstd/lib.rs | 13 +- src/libstd/macros.rs | 2 +- src/libstd/memchr.rs | 4 +- src/libstd/net/addr.rs | 30 ++-- src/libstd/net/ip.rs | 16 +- src/libstd/net/mod.rs | 2 +- src/libstd/net/parser.rs | 8 +- src/libstd/net/tcp.rs | 30 ++-- src/libstd/net/test.rs | 6 +- src/libstd/net/udp.rs | 26 +-- src/libstd/num.rs | 31 ++-- src/libstd/os/android/fs.rs | 8 +- src/libstd/os/android/raw.rs | 14 +- src/libstd/os/bitrig/fs.rs | 8 +- src/libstd/os/bitrig/raw.rs | 4 +- src/libstd/os/dragonfly/fs.rs | 8 +- src/libstd/os/dragonfly/raw.rs | 2 +- src/libstd/os/emscripten/fs.rs | 8 +- src/libstd/os/emscripten/raw.rs | 2 +- src/libstd/os/fortanix_sgx/mod.rs | 27 ++-- src/libstd/os/freebsd/fs.rs | 8 +- src/libstd/os/freebsd/raw.rs | 2 +- src/libstd/os/fuchsia/fs.rs | 4 +- src/libstd/os/fuchsia/raw.rs | 10 +- src/libstd/os/haiku/fs.rs | 8 +- src/libstd/os/haiku/raw.rs | 4 +- src/libstd/os/hermit/fs.rs | 8 +- src/libstd/os/ios/fs.rs | 8 +- src/libstd/os/ios/raw.rs | 2 +- src/libstd/os/linux/fs.rs | 8 +- src/libstd/os/linux/raw.rs | 10 +- src/libstd/os/macos/fs.rs | 8 +- src/libstd/os/macos/raw.rs | 2 +- src/libstd/os/mod.rs | 8 +- src/libstd/os/netbsd/fs.rs | 8 +- src/libstd/os/netbsd/raw.rs | 4 +- src/libstd/os/openbsd/fs.rs | 8 +- src/libstd/os/openbsd/raw.rs | 2 +- src/libstd/os/raw/mod.rs | 7 +- src/libstd/os/solaris/fs.rs | 8 +- src/libstd/os/solaris/raw.rs | 4 +- src/libstd/panic.rs | 28 ++-- src/libstd/panicking.rs | 42 ++--- src/libstd/path.rs | 42 ++--- src/libstd/prelude/v1.rs | 32 ++-- src/libstd/process.rs | 51 +++--- src/libstd/rt.rs | 18 +-- src/libstd/sync/barrier.rs | 10 +- src/libstd/sync/condvar.rs | 26 +-- src/libstd/sync/mod.rs | 2 +- src/libstd/sync/mpsc/blocking.rs | 10 +- src/libstd/sync/mpsc/cache_aligned.rs | 2 +- src/libstd/sync/mpsc/mod.rs | 24 +-- src/libstd/sync/mpsc/mpsc_queue.rs | 11 +- src/libstd/sync/mpsc/oneshot.rs | 12 +- src/libstd/sync/mpsc/select.rs | 8 +- src/libstd/sync/mpsc/select_tests.rs | 4 +- src/libstd/sync/mpsc/shared.rs | 20 +-- src/libstd/sync/mpsc/spsc_queue.rs | 10 +- src/libstd/sync/mpsc/stream.rs | 17 +- src/libstd/sync/mpsc/sync.rs | 10 +- src/libstd/sync/mutex.rs | 22 +-- src/libstd/sync/once.rs | 16 +- src/libstd/sync/rwlock.rs | 22 +-- src/libstd/sys/cloudabi/abi/cloudabi.rs | 150 +++++++++--------- src/libstd/sys/cloudabi/args.rs | 2 +- src/libstd/sys/cloudabi/backtrace.rs | 17 +- src/libstd/sys/cloudabi/condvar.rs | 14 +- src/libstd/sys/cloudabi/mod.rs | 40 ++--- src/libstd/sys/cloudabi/mutex.rs | 10 +- src/libstd/sys/cloudabi/os.rs | 9 +- src/libstd/sys/cloudabi/rwlock.rs | 8 +- src/libstd/sys/cloudabi/shims/args.rs | 2 +- src/libstd/sys/cloudabi/shims/fs.rs | 14 +- src/libstd/sys/cloudabi/shims/mod.rs | 2 +- src/libstd/sys/cloudabi/shims/net.rs | 13 +- src/libstd/sys/cloudabi/shims/os.rs | 14 +- src/libstd/sys/cloudabi/shims/pipe.rs | 4 +- src/libstd/sys/cloudabi/shims/process.rs | 14 +- src/libstd/sys/cloudabi/stdio.rs | 6 +- src/libstd/sys/cloudabi/thread.rs | 21 ++- src/libstd/sys/cloudabi/time.rs | 6 +- src/libstd/sys/mod.rs | 2 +- src/libstd/sys/redox/args.rs | 17 +- src/libstd/sys/redox/backtrace/mod.rs | 12 +- src/libstd/sys/redox/backtrace/printing.rs | 2 +- src/libstd/sys/redox/backtrace/tracing.rs | 14 +- src/libstd/sys/redox/condvar.rs | 14 +- src/libstd/sys/redox/ext/ffi.rs | 8 +- src/libstd/sys/redox/ext/fs.rs | 10 +- src/libstd/sys/redox/ext/io.rs | 10 +- src/libstd/sys/redox/ext/net.rs | 14 +- src/libstd/sys/redox/ext/process.rs | 10 +- src/libstd/sys/redox/ext/thread.rs | 4 +- src/libstd/sys/redox/fast_thread_local.rs | 10 +- src/libstd/sys/redox/fd.rs | 8 +- src/libstd/sys/redox/fs.rs | 22 +-- src/libstd/sys/redox/mod.rs | 12 +- src/libstd/sys/redox/mutex.rs | 8 +- src/libstd/sys/redox/net/dns/answer.rs | 4 +- src/libstd/sys/redox/net/dns/mod.rs | 8 +- src/libstd/sys/redox/net/dns/query.rs | 2 +- src/libstd/sys/redox/net/mod.rs | 20 +-- src/libstd/sys/redox/net/tcp.rs | 18 +-- src/libstd/sys/redox/net/udp.rs | 20 +-- src/libstd/sys/redox/os.rs | 40 ++--- src/libstd/sys/redox/os_str.rs | 17 +- src/libstd/sys/redox/path.rs | 4 +- src/libstd/sys/redox/pipe.rs | 6 +- src/libstd/sys/redox/process.rs | 35 ++-- src/libstd/sys/redox/stdio.rs | 10 +- src/libstd/sys/redox/thread.rs | 14 +- src/libstd/sys/redox/thread_local.rs | 6 +- src/libstd/sys/redox/time.rs | 11 +- src/libstd/sys/sgx/abi/mod.rs | 4 +- src/libstd/sys/sgx/abi/panic.rs | 6 +- src/libstd/sys/sgx/abi/reloc.rs | 2 +- src/libstd/sys/sgx/abi/tls.rs | 16 +- src/libstd/sys/sgx/abi/usercalls/alloc.rs | 12 +- src/libstd/sys/sgx/abi/usercalls/mod.rs | 4 +- src/libstd/sys/sgx/abi/usercalls/raw.rs | 6 +- src/libstd/sys/sgx/alloc.rs | 4 +- src/libstd/sys/sgx/args.rs | 10 +- src/libstd/sys/sgx/backtrace.rs | 15 +- src/libstd/sys/sgx/condvar.rs | 4 +- src/libstd/sys/sgx/ext/arch.rs | 2 +- src/libstd/sys/sgx/ext/ffi.rs | 8 +- src/libstd/sys/sgx/ext/io.rs | 6 +- src/libstd/sys/sgx/fd.rs | 6 +- src/libstd/sys/sgx/fs.rs | 14 +- src/libstd/sys/sgx/mod.rs | 61 +++---- src/libstd/sys/sgx/net.rs | 18 +-- src/libstd/sys/sgx/os.rs | 24 +-- src/libstd/sys/sgx/os_str.rs | 17 +- src/libstd/sys/sgx/path.rs | 4 +- src/libstd/sys/sgx/pipe.rs | 4 +- src/libstd/sys/sgx/process.rs | 14 +- src/libstd/sys/sgx/rwlock.rs | 16 +- src/libstd/sys/sgx/stdio.rs | 6 +- src/libstd/sys/sgx/thread.rs | 14 +- src/libstd/sys/sgx/time.rs | 2 +- src/libstd/sys/sgx/waitqueue.rs | 24 +-- src/libstd/sys/unix/alloc.rs | 7 +- src/libstd/sys/unix/android.rs | 10 +- src/libstd/sys/unix/args.rs | 30 ++-- src/libstd/sys/unix/backtrace/mod.rs | 9 +- .../sys/unix/backtrace/printing/dladdr.rs | 11 +- src/libstd/sys/unix/backtrace/printing/mod.rs | 10 +- .../unix/backtrace/tracing/backtrace_fn.rs | 10 +- .../sys/unix/backtrace/tracing/gcc_s.rs | 14 +- src/libstd/sys/unix/condvar.rs | 15 +- src/libstd/sys/unix/ext/ffi.rs | 8 +- src/libstd/sys/unix/ext/fs.rs | 13 +- src/libstd/sys/unix/ext/io.rs | 11 +- src/libstd/sys/unix/ext/net.rs | 36 ++--- src/libstd/sys/unix/ext/process.rs | 12 +- src/libstd/sys/unix/ext/raw.rs | 6 +- src/libstd/sys/unix/ext/thread.rs | 6 +- src/libstd/sys/unix/fast_thread_local.rs | 9 +- src/libstd/sys/unix/fd.rs | 19 +-- src/libstd/sys/unix/fs.rs | 50 +++--- src/libstd/sys/unix/l4re.rs | 16 +- src/libstd/sys/unix/memchr.rs | 6 +- src/libstd/sys/unix/mod.rs | 43 +++-- src/libstd/sys/unix/mutex.rs | 6 +- src/libstd/sys/unix/net.rs | 27 ++-- src/libstd/sys/unix/os.rs | 59 +++---- src/libstd/sys/unix/os_str.rs | 17 +- src/libstd/sys/unix/path.rs | 4 +- src/libstd/sys/unix/pipe.rs | 13 +- src/libstd/sys/unix/process/process_common.rs | 34 ++-- .../sys/unix/process/process_fuchsia.rs | 25 +-- src/libstd/sys/unix/process/process_unix.rs | 23 +-- src/libstd/sys/unix/process/zircon.rs | 8 +- src/libstd/sys/unix/rand.rs | 24 ++- src/libstd/sys/unix/rwlock.rs | 5 +- src/libstd/sys/unix/stack_overflow.rs | 12 +- src/libstd/sys/unix/stdio.rs | 7 +- src/libstd/sys/unix/thread.rs | 41 +++-- src/libstd/sys/unix/thread_local.rs | 3 +- src/libstd/sys/unix/time.rs | 28 ++-- src/libstd/sys/unix/weak.rs | 15 +- src/libstd/sys/wasm/alloc.rs | 8 +- src/libstd/sys/wasm/args.rs | 8 +- src/libstd/sys/wasm/backtrace.rs | 6 +- src/libstd/sys/wasm/condvar.rs | 4 +- src/libstd/sys/wasm/condvar_atomics.rs | 12 +- src/libstd/sys/wasm/fs.rs | 14 +- src/libstd/sys/wasm/mod.rs | 24 +-- src/libstd/sys/wasm/mutex.rs | 2 +- src/libstd/sys/wasm/mutex_atomics.rs | 10 +- src/libstd/sys/wasm/net.rs | 12 +- src/libstd/sys/wasm/os.rs | 14 +- src/libstd/sys/wasm/os_str.rs | 17 +- src/libstd/sys/wasm/path.rs | 4 +- src/libstd/sys/wasm/pipe.rs | 4 +- src/libstd/sys/wasm/process.rs | 14 +- src/libstd/sys/wasm/rwlock.rs | 2 +- src/libstd/sys/wasm/rwlock_atomics.rs | 6 +- src/libstd/sys/wasm/stdio.rs | 4 +- src/libstd/sys/wasm/thread.rs | 16 +- src/libstd/sys/wasm/thread_local.rs | 4 +- src/libstd/sys/wasm/thread_local_atomics.rs | 4 +- src/libstd/sys/wasm/time.rs | 4 +- src/libstd/sys/windows/alloc.rs | 6 +- src/libstd/sys/windows/args.rs | 23 +-- .../sys/windows/backtrace/backtrace_gnu.rs | 13 +- src/libstd/sys/windows/backtrace/mod.rs | 13 +- .../sys/windows/backtrace/printing/mod.rs | 6 +- .../sys/windows/backtrace/printing/msvc.rs | 19 +-- src/libstd/sys/windows/c.rs | 11 +- src/libstd/sys/windows/compat.rs | 12 +- src/libstd/sys/windows/condvar.rs | 10 +- src/libstd/sys/windows/dynamic_lib.rs | 8 +- src/libstd/sys/windows/ext/ffi.rs | 10 +- src/libstd/sys/windows/ext/fs.rs | 10 +- src/libstd/sys/windows/ext/io.rs | 14 +- src/libstd/sys/windows/ext/process.rs | 8 +- src/libstd/sys/windows/ext/raw.rs | 2 +- src/libstd/sys/windows/ext/thread.rs | 6 +- src/libstd/sys/windows/fast_thread_local.rs | 2 +- src/libstd/sys/windows/fs.rs | 26 +-- src/libstd/sys/windows/handle.rs | 15 +- src/libstd/sys/windows/mod.rs | 38 ++--- src/libstd/sys/windows/mutex.rs | 10 +- src/libstd/sys/windows/net.rs | 33 ++-- src/libstd/sys/windows/os.rs | 30 ++-- src/libstd/sys/windows/os_str.rs | 14 +- src/libstd/sys/windows/path.rs | 8 +- src/libstd/sys/windows/pipe.rs | 26 +-- src/libstd/sys/windows/process.rs | 45 +++--- src/libstd/sys/windows/rand.rs | 6 +- src/libstd/sys/windows/rwlock.rs | 4 +- src/libstd/sys/windows/stack_overflow.rs | 4 +- src/libstd/sys/windows/stdio.rs | 16 +- src/libstd/sys/windows/thread.rs | 19 +-- src/libstd/sys/windows/thread_local.rs | 12 +- src/libstd/sys/windows/time.rs | 23 +-- src/libstd/sys_common/alloc.rs | 6 +- src/libstd/sys_common/at_exit_imp.rs | 8 +- src/libstd/sys_common/backtrace.rs | 21 +-- src/libstd/sys_common/bytestring.rs | 4 +- src/libstd/sys_common/condvar.rs | 6 +- src/libstd/sys_common/gnu/libbacktrace.rs | 17 +- src/libstd/sys_common/io.rs | 8 +- src/libstd/sys_common/mod.rs | 8 +- src/libstd/sys_common/mutex.rs | 2 +- src/libstd/sys_common/net.rs | 39 ++--- src/libstd/sys_common/poison.rs | 8 +- src/libstd/sys_common/process.rs | 8 +- src/libstd/sys_common/remutex.rs | 20 +-- src/libstd/sys_common/rwlock.rs | 2 +- src/libstd/sys_common/thread.rs | 10 +- src/libstd/sys_common/thread_info.rs | 6 +- src/libstd/sys_common/thread_local.rs | 8 +- src/libstd/sys_common/util.rs | 10 +- src/libstd/sys_common/wtf8.rs | 28 ++-- src/libstd/tests/env.rs | 2 - src/libstd/thread/local.rs | 46 +++--- src/libstd/thread/mod.rs | 58 +++---- src/libstd/time.rs | 16 +- 284 files changed, 1989 insertions(+), 2024 deletions(-) diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml index 7d60a170422b..1a6b58f35b39 100644 --- a/src/libstd/Cargo.toml +++ b/src/libstd/Cargo.toml @@ -6,6 +6,7 @@ build = "build.rs" license = "MIT/Apache-2.0" repository = "https://github.com/rust-lang/rust.git" description = "The Rust Standard Library" +edition = "2018" [lib] name = "std" diff --git a/src/libstd/alloc.rs b/src/libstd/alloc.rs index 8b6e5680c2d6..a13da2901df9 100644 --- a/src/libstd/alloc.rs +++ b/src/libstd/alloc.rs @@ -64,7 +64,8 @@ use core::sync::atomic::{AtomicPtr, Ordering}; use core::{mem, ptr}; use core::ptr::NonNull; -use sys_common::util::dumb_print; + +use crate::sys_common::util::dumb_print; #[stable(feature = "alloc_module", since = "1.28.0")] #[doc(inline)] @@ -208,7 +209,7 @@ pub fn rust_oom(layout: Layout) -> ! { unsafe { mem::transmute(hook) } }; hook(layout); - unsafe { ::sys::abort_internal(); } + unsafe { crate::sys::abort_internal(); } } #[cfg(not(test))] diff --git a/src/libstd/build.rs b/src/libstd/build.rs index 9b4ea0829aa9..726c27321538 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -1,7 +1,5 @@ #![deny(warnings)] -extern crate cc; - use std::env; fn main() { diff --git a/src/libstd/collections/hash/bench.rs b/src/libstd/collections/hash/bench.rs index 8ca43f8ada21..7f5add054368 100644 --- a/src/libstd/collections/hash/bench.rs +++ b/src/libstd/collections/hash/bench.rs @@ -1,8 +1,6 @@ #![cfg(test)] -extern crate test; - -use self::test::Bencher; +use test::Bencher; #[bench] fn new_drop(b: &mut Bencher) { diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 4fb0235539c4..a51847c92b51 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1,18 +1,18 @@ use self::Entry::*; use self::VacantEntryState::*; -use intrinsics::unlikely; -use collections::CollectionAllocErr; -use cell::Cell; -use borrow::Borrow; -use cmp::max; -use fmt::{self, Debug}; +use crate::intrinsics::unlikely; +use crate::collections::CollectionAllocErr; +use crate::cell::Cell; +use crate::borrow::Borrow; +use crate::cmp::max; +use crate::fmt::{self, Debug}; #[allow(deprecated)] -use hash::{Hash, Hasher, BuildHasher, SipHasher13}; -use iter::{FromIterator, FusedIterator}; -use mem::{self, replace}; -use ops::{Deref, DerefMut, Index}; -use sys; +use crate::hash::{Hash, Hasher, BuildHasher, SipHasher13}; +use crate::iter::{FromIterator, FusedIterator}; +use crate::mem::{self, replace}; +use crate::ops::{Deref, DerefMut, Index}; +use crate::sys; use super::table::{self, Bucket, EmptyBucket, Fallibility, FullBucket, FullBucketMut, RawTable, SafeHash}; @@ -3328,7 +3328,7 @@ mod test_map { use super::HashMap; use super::Entry::{Occupied, Vacant}; use super::RandomState; - use cell::RefCell; + use crate::cell::RefCell; use rand::{thread_rng, Rng}; use realstd::collections::CollectionAllocErr::*; use realstd::mem::size_of; diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 46a5f26df635..8a599c11b209 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -1,8 +1,8 @@ -use borrow::Borrow; -use fmt; -use hash::{Hash, BuildHasher}; -use iter::{Chain, FromIterator, FusedIterator}; -use ops::{BitOr, BitAnd, BitXor, Sub}; +use crate::borrow::Borrow; +use crate::fmt; +use crate::hash::{Hash, BuildHasher}; +use crate::iter::{Chain, FromIterator, FusedIterator}; +use crate::ops::{BitOr, BitAnd, BitXor, Sub}; use super::Recover; use super::map::{self, HashMap, Keys, RandomState}; @@ -1751,7 +1751,7 @@ mod test_set { #[test] fn test_replace() { - use hash; + use crate::hash; #[derive(Debug)] struct Foo(&'static str, i32); diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 865431252acf..31e7a6931356 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -1,12 +1,11 @@ -use alloc::{Global, Alloc, Layout, LayoutErr, handle_alloc_error}; -use collections::CollectionAllocErr; -use hash::{BuildHasher, Hash, Hasher}; -use marker; -use mem::{size_of, needs_drop}; -use mem; -use ops::{Deref, DerefMut}; -use ptr::{self, Unique, NonNull}; -use hint; +use crate::alloc::{Global, Alloc, Layout, LayoutErr, handle_alloc_error}; +use crate::collections::CollectionAllocErr; +use crate::hash::{BuildHasher, Hash, Hasher}; +use crate::marker; +use crate::mem::{self, size_of, needs_drop}; +use crate::ops::{Deref, DerefMut}; +use crate::ptr::{self, Unique, NonNull}; +use crate::hint; use self::BucketState::*; diff --git a/src/libstd/collections/mod.rs b/src/libstd/collections/mod.rs index 9ebeff48426f..286ce2d389b8 100644 --- a/src/libstd/collections/mod.rs +++ b/src/libstd/collections/mod.rs @@ -412,7 +412,7 @@ #[stable(feature = "rust1", since = "1.0.0")] #[rustc_deprecated(reason = "moved to `std::ops::Bound`", since = "1.26.0")] #[doc(hidden)] -pub use ops::Bound; +pub use crate::ops::Bound; #[stable(feature = "rust1", since = "1.0.0")] pub use alloc_crate::collections::{BinaryHeap, BTreeMap, BTreeSet}; #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 543973ab991d..97c67f562a7d 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -13,13 +13,13 @@ #![stable(feature = "env", since = "1.0.0")] -use error::Error; -use ffi::{OsStr, OsString}; -use fmt; -use io; -use path::{Path, PathBuf}; -use sys; -use sys::os as os_imp; +use crate::error::Error; +use crate::ffi::{OsStr, OsString}; +use crate::fmt; +use crate::io; +use crate::path::{Path, PathBuf}; +use crate::sys; +use crate::sys::os as os_imp; /// Returns the current working directory as a [`PathBuf`]. /// @@ -800,7 +800,7 @@ impl fmt::Debug for ArgsOs { /// Constants associated with the current target #[stable(feature = "env", since = "1.0.0")] pub mod consts { - use sys::env::os; + use crate::sys::env::os; /// A string describing the architecture of the CPU that is currently /// in use. @@ -972,7 +972,7 @@ mod arch { mod tests { use super::*; - use path::Path; + use crate::path::Path; #[test] #[cfg_attr(target_os = "emscripten", ignore)] @@ -995,7 +995,7 @@ mod tests { #[test] #[cfg(windows)] fn split_paths_windows() { - use path::PathBuf; + use crate::path::PathBuf; fn check_parse(unparsed: &str, parsed: &[&str]) -> bool { split_paths(unparsed).collect::>() == @@ -1017,7 +1017,7 @@ mod tests { #[test] #[cfg(unix)] fn split_paths_unix() { - use path::PathBuf; + use crate::path::PathBuf; fn check_parse(unparsed: &str, parsed: &[&str]) -> bool { split_paths(unparsed).collect::>() == @@ -1034,7 +1034,7 @@ mod tests { #[test] #[cfg(unix)] fn join_paths_unix() { - use ffi::OsStr; + use crate::ffi::OsStr; fn test_eq(input: &[&str], output: &str) -> bool { &*join_paths(input.iter().cloned()).unwrap() == @@ -1052,7 +1052,7 @@ mod tests { #[test] #[cfg(windows)] fn join_paths_windows() { - use ffi::OsStr; + use crate::ffi::OsStr; fn test_eq(input: &[&str], output: &str) -> bool { &*join_paths(input.iter().cloned()).unwrap() == diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 17e50a649fa5..2858308e8f8d 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -13,17 +13,18 @@ // coherence challenge (e.g., specialization, neg impls, etc) we can // reconsider what crate these items belong in. -use alloc::{AllocErr, LayoutErr, CannotReallocInPlace}; -use any::TypeId; -use borrow::Cow; -use cell; -use char; use core::array; -use fmt::{self, Debug, Display}; -use mem::transmute; -use num; -use str; -use string; + +use crate::alloc::{AllocErr, LayoutErr, CannotReallocInPlace}; +use crate::any::TypeId; +use crate::borrow::Cow; +use crate::cell; +use crate::char; +use crate::fmt::{self, Debug, Display}; +use crate::mem::transmute; +use crate::num; +use crate::str; +use crate::string; /// `Error` is a trait representing the basic expectations for error values, /// i.e., values of type `E` in [`Result`]. Errors must describe @@ -852,7 +853,7 @@ impl dyn Error + Send + Sync { #[cfg(test)] mod tests { use super::Error; - use fmt; + use crate::fmt; #[derive(Debug, PartialEq)] struct A; diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index cb1f93581775..f6cd9e82abd4 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -9,9 +9,9 @@ #![allow(missing_docs)] #[cfg(not(test))] -use intrinsics; +use crate::intrinsics; #[cfg(not(test))] -use sys::cmath; +use crate::sys::cmath; #[stable(feature = "rust1", since = "1.0.0")] pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON}; @@ -488,7 +488,7 @@ impl f32 { #[inline] pub fn log2(self) -> f32 { #[cfg(target_os = "android")] - return ::sys::android::log2f32(self); + return crate::sys::android::log2f32(self); #[cfg(not(target_os = "android"))] return unsafe { intrinsics::log2f32(self) }; } @@ -932,7 +932,7 @@ impl f32 { #[inline] pub fn acosh(self) -> f32 { match self { - x if x < 1.0 => ::f32::NAN, + x if x < 1.0 => crate::f32::NAN, x => (x + ((x * x) - 1.0).sqrt()).ln(), } } @@ -960,10 +960,10 @@ impl f32 { #[cfg(test)] mod tests { - use f32; - use f32::*; - use num::*; - use num::FpCategory as Fp; + use crate::f32; + use crate::f32::*; + use crate::num::*; + use crate::num::FpCategory as Fp; #[test] fn test_num_f32() { diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index 7fa7b8075193..8ff97ab828a7 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -9,9 +9,9 @@ #![allow(missing_docs)] #[cfg(not(test))] -use intrinsics; +use crate::intrinsics; #[cfg(not(test))] -use sys::cmath; +use crate::sys::cmath; #[stable(feature = "rust1", since = "1.0.0")] pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON}; @@ -436,7 +436,7 @@ impl f64 { pub fn log2(self) -> f64 { self.log_wrapper(|n| { #[cfg(target_os = "android")] - return ::sys::android::log2f64(n); + return crate::sys::android::log2f64(n); #[cfg(not(target_os = "android"))] return unsafe { intrinsics::log2f64(n) }; }) @@ -906,10 +906,10 @@ impl f64 { #[cfg(test)] mod tests { - use f64; - use f64::*; - use num::*; - use num::FpCategory as Fp; + use crate::f64; + use crate::f64::*; + use crate::num::*; + use crate::num::FpCategory as Fp; #[test] fn test_num_f64() { diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 0ef722428278..139680e526fd 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -1,19 +1,19 @@ -use ascii; -use borrow::{Cow, Borrow}; -use cmp::Ordering; -use error::Error; -use fmt::{self, Write}; -use io; -use mem; -use memchr; -use ops; -use os::raw::c_char; -use ptr; -use rc::Rc; -use slice; -use str::{self, Utf8Error}; -use sync::Arc; -use sys; +use crate::ascii; +use crate::borrow::{Cow, Borrow}; +use crate::cmp::Ordering; +use crate::error::Error; +use crate::fmt::{self, Write}; +use crate::io; +use crate::mem; +use crate::memchr; +use crate::ops; +use crate::os::raw::c_char; +use crate::ptr; +use crate::rc::Rc; +use crate::slice; +use crate::str::{self, Utf8Error}; +use crate::sync::Arc; +use crate::sys; /// A type representing an owned, C-compatible, nul-terminated string with no nul bytes in the /// middle. @@ -1303,12 +1303,12 @@ impl AsRef for CString { #[cfg(test)] mod tests { use super::*; - use os::raw::c_char; - use borrow::Cow::{Borrowed, Owned}; - use hash::{Hash, Hasher}; - use collections::hash_map::DefaultHasher; - use rc::Rc; - use sync::Arc; + use crate::os::raw::c_char; + use crate::borrow::Cow::{Borrowed, Owned}; + use crate::hash::{Hash, Hasher}; + use crate::collections::hash_map::DefaultHasher; + use crate::rc::Rc; + use crate::sync::Arc; #[test] fn c_to_rust() { diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 81433832ffc7..f68eaeb9c7e1 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -1,13 +1,13 @@ -use borrow::{Borrow, Cow}; -use fmt; -use ops; -use cmp; -use hash::{Hash, Hasher}; -use rc::Rc; -use sync::Arc; +use crate::borrow::{Borrow, Cow}; +use crate::fmt; +use crate::ops; +use crate::cmp; +use crate::hash::{Hash, Hasher}; +use crate::rc::Rc; +use crate::sync::Arc; -use sys::os_str::{Buf, Slice}; -use sys_common::{AsInner, IntoInner, FromInner}; +use crate::sys::os_str::{Buf, Slice}; +use crate::sys_common::{AsInner, IntoInner, FromInner}; /// A type that can represent owned, mutable platform-native strings, but is /// cheaply inter-convertible with Rust strings. @@ -968,10 +968,10 @@ impl AsInner for OsStr { #[cfg(test)] mod tests { use super::*; - use sys_common::{AsInner, IntoInner}; + use crate::sys_common::{AsInner, IntoInner}; - use rc::Rc; - use sync::Arc; + use crate::rc::Rc; + use crate::sync::Arc; #[test] fn test_os_string_with_capacity() { diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 79b5686faac6..25f2dd73504a 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -7,13 +7,13 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fmt; -use ffi::OsString; -use io::{self, SeekFrom, Seek, Read, Initializer, Write}; -use path::{Path, PathBuf}; -use sys::fs as fs_imp; -use sys_common::{AsInnerMut, FromInner, AsInner, IntoInner}; -use time::SystemTime; +use crate::fmt; +use crate::ffi::OsString; +use crate::io::{self, SeekFrom, Seek, Read, Initializer, Write}; +use crate::path::{Path, PathBuf}; +use crate::sys::fs as fs_imp; +use crate::sys_common::{AsInnerMut, FromInner, AsInner, IntoInner}; +use crate::time::SystemTime; /// A reference to an open file on the filesystem. /// @@ -2096,26 +2096,27 @@ impl AsInnerMut for DirBuilder { #[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))] mod tests { - use io::prelude::*; + use crate::io::prelude::*; + + use crate::fs::{self, File, OpenOptions}; + use crate::io::{ErrorKind, SeekFrom}; + use crate::path::Path; + use crate::str; + use crate::sys_common::io::test::{TempDir, tmpdir}; + use crate::thread; - use fs::{self, File, OpenOptions}; - use io::{ErrorKind, SeekFrom}; - use path::Path; use rand::{rngs::StdRng, FromEntropy, RngCore}; - use str; - use sys_common::io::test::{TempDir, tmpdir}; - use thread; #[cfg(windows)] - use os::windows::fs::{symlink_dir, symlink_file}; + use crate::os::windows::fs::{symlink_dir, symlink_file}; #[cfg(windows)] - use sys::fs::symlink_junction; + use crate::sys::fs::symlink_junction; #[cfg(unix)] - use os::unix::fs::symlink as symlink_dir; + use crate::os::unix::fs::symlink as symlink_dir; #[cfg(unix)] - use os::unix::fs::symlink as symlink_file; + use crate::os::unix::fs::symlink as symlink_file; #[cfg(unix)] - use os::unix::fs::symlink as symlink_junction; + use crate::os::unix::fs::symlink as symlink_junction; macro_rules! check { ($e:expr) => ( match $e { @@ -2334,7 +2335,7 @@ mod tests { #[test] #[cfg(unix)] fn file_test_io_read_write_at() { - use os::unix::fs::FileExt; + use crate::os::unix::fs::FileExt; let tmpdir = tmpdir(); let filename = tmpdir.join("file_rt_io_file_test_read_write_at.txt"); @@ -2390,7 +2391,7 @@ mod tests { #[test] #[cfg(unix)] fn set_get_unix_permissions() { - use os::unix::fs::PermissionsExt; + use crate::os::unix::fs::PermissionsExt; let tmpdir = tmpdir(); let filename = &tmpdir.join("set_get_unix_permissions"); @@ -2411,7 +2412,7 @@ mod tests { #[test] #[cfg(windows)] fn file_test_io_seek_read_write() { - use os::windows::fs::FileExt; + use crate::os::windows::fs::FileExt; let tmpdir = tmpdir(); let filename = tmpdir.join("file_rt_io_file_test_seek_read_write.txt"); @@ -3013,7 +3014,7 @@ mod tests { #[test] fn open_flavors() { - use fs::OpenOptions as OO; + use crate::fs::OpenOptions as OO; fn c(t: &T) -> T { t.clone() } let tmpdir = tmpdir(); diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 6383a14cf184..559a54d3c8ac 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -1,12 +1,12 @@ //! Buffering wrappers for I/O traits -use io::prelude::*; +use crate::io::prelude::*; -use cmp; -use error; -use fmt; -use io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut}; -use memchr; +use crate::cmp; +use crate::error; +use crate::fmt; +use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut}; +use crate::memchr; /// The `BufReader` struct adds buffering to any reader. /// @@ -977,11 +977,10 @@ impl fmt::Debug for LineWriter where W: fmt::Debug { #[cfg(test)] mod tests { - use io::prelude::*; - use io::{self, BufReader, BufWriter, LineWriter, SeekFrom}; - use sync::atomic::{AtomicUsize, Ordering}; - use thread; - use test; + use crate::io::prelude::*; + use crate::io::{self, BufReader, BufWriter, LineWriter, SeekFrom}; + use crate::sync::atomic::{AtomicUsize, Ordering}; + use crate::thread; /// A dummy reader intended at testing short-reads propagation. pub struct ShortReader { diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs index 577a115025ba..873da0898c7f 100644 --- a/src/libstd/io/cursor.rs +++ b/src/libstd/io/cursor.rs @@ -1,8 +1,9 @@ -use io::prelude::*; +use crate::io::prelude::*; + +use crate::cmp; +use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut}; use core::convert::TryInto; -use cmp; -use io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut}; /// A `Cursor` wraps an in-memory buffer and provides it with a /// [`Seek`] implementation. @@ -378,8 +379,8 @@ impl Write for Cursor> { #[cfg(test)] mod tests { - use io::prelude::*; - use io::{Cursor, SeekFrom, IoVec, IoVecMut}; + use crate::io::prelude::*; + use crate::io::{Cursor, SeekFrom, IoVec, IoVecMut}; #[test] fn test_vec_writer() { diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index e9b4f60182c4..fdc5625ff184 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -1,8 +1,8 @@ -use error; -use fmt; -use result; -use sys; -use convert::From; +use crate::error; +use crate::fmt; +use crate::result; +use crate::sys; +use crate::convert::From; /// A specialized [`Result`](../result/enum.Result.html) type for I/O /// operations. @@ -566,10 +566,10 @@ fn _assert_error_is_sync_send() { #[cfg(test)] mod test { use super::{Error, ErrorKind, Repr, Custom}; - use error; - use fmt; - use sys::os::error_string; - use sys::decode_error_kind; + use crate::error; + use crate::fmt; + use crate::sys::os::error_string; + use crate::sys::decode_error_kind; #[test] fn test_debug_error() { diff --git a/src/libstd/io/impls.rs b/src/libstd/io/impls.rs index aa8db177ffcd..bd3d0a416386 100644 --- a/src/libstd/io/impls.rs +++ b/src/libstd/io/impls.rs @@ -1,8 +1,8 @@ -use cmp; -use io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut, +use crate::cmp; +use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut, IoVec}; -use fmt; -use mem; +use crate::fmt; +use crate::mem; // ============================================================================= // Forwarding implementations @@ -323,8 +323,7 @@ impl Write for Vec { #[cfg(test)] mod tests { - use io::prelude::*; - use test; + use crate::io::prelude::*; #[bench] fn bench_read_slice(b: &mut test::Bencher) { diff --git a/src/libstd/io/lazy.rs b/src/libstd/io/lazy.rs index e3ebe82e3dac..e864aa2c864b 100644 --- a/src/libstd/io/lazy.rs +++ b/src/libstd/io/lazy.rs @@ -1,8 +1,8 @@ -use cell::Cell; -use ptr; -use sync::Arc; -use sys_common; -use sys_common::mutex::Mutex; +use crate::cell::Cell; +use crate::ptr; +use crate::sync::Arc; +use crate::sys_common; +use crate::sys_common::mutex::Mutex; pub struct Lazy { // We never call `lock.init()`, so it is UB to attempt to acquire this mutex reentrantly! diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 613ae7a67284..e3e2754a7aa0 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -259,14 +259,14 @@ #![stable(feature = "rust1", since = "1.0.0")] -use cmp; -use fmt; -use slice; -use str; -use memchr; -use ops::{Deref, DerefMut}; -use ptr; -use sys; +use crate::cmp; +use crate::fmt; +use crate::slice; +use crate::str; +use crate::memchr; +use crate::ops::{Deref, DerefMut}; +use crate::ptr; +use crate::sys; #[stable(feature = "rust1", since = "1.0.0")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; @@ -297,7 +297,7 @@ mod lazy; mod util; mod stdio; -const DEFAULT_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; +const DEFAULT_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE; struct Guard<'a> { buf: &'a mut Vec, len: usize } @@ -2155,10 +2155,9 @@ impl Iterator for Lines { #[cfg(test)] mod tests { - use io::prelude::*; - use io; + use crate::io::prelude::*; + use crate::io; use super::Cursor; - use test; use super::repeat; #[test] diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 0324568e6fb5..13bf357e2eb8 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -1,13 +1,13 @@ -use io::prelude::*; +use crate::io::prelude::*; -use cell::RefCell; -use fmt; -use io::lazy::Lazy; -use io::{self, Initializer, BufReader, LineWriter}; -use sync::{Arc, Mutex, MutexGuard}; -use sys::stdio; -use sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; -use thread::LocalKey; +use crate::cell::RefCell; +use crate::fmt; +use crate::io::lazy::Lazy; +use crate::io::{self, Initializer, BufReader, LineWriter}; +use crate::sync::{Arc, Mutex, MutexGuard}; +use crate::sys::stdio; +use crate::sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; +use crate::thread::LocalKey; /// Stdout used by print! and println! macros thread_local! { @@ -668,8 +668,8 @@ impl fmt::Debug for StderrLock<'_> { issue = "0")] #[doc(hidden)] pub fn set_panic(sink: Option>) -> Option> { - use panicking::LOCAL_STDERR; - use mem; + use crate::panicking::LOCAL_STDERR; + use crate::mem; LOCAL_STDERR.with(move |slot| { mem::replace(&mut *slot.borrow_mut(), sink) }).and_then(|mut s| { @@ -692,7 +692,7 @@ pub fn set_panic(sink: Option>) -> Option>) -> Option> { - use mem; + use crate::mem; LOCAL_STDOUT.with(move |slot| { mem::replace(&mut *slot.borrow_mut(), sink) }).and_then(|mut s| { @@ -749,14 +749,14 @@ pub fn _print(args: fmt::Arguments) { issue = "0")] #[doc(hidden)] pub fn _eprint(args: fmt::Arguments) { - use panicking::LOCAL_STDERR; + use crate::panicking::LOCAL_STDERR; print_to(args, &LOCAL_STDERR, stderr, "stderr"); } #[cfg(test)] mod tests { - use panic::{UnwindSafe, RefUnwindSafe}; - use thread; + use crate::panic::{UnwindSafe, RefUnwindSafe}; + use crate::thread; use super::*; #[test] diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 5ce955eb1e4a..6aaf8f1889ac 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -1,8 +1,8 @@ #![allow(missing_copy_implementations)] -use fmt; -use io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut}; -use mem; +use crate::fmt; +use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut}; +use crate::mem; /// Copies the entire contents of a reader into a writer. /// @@ -224,8 +224,8 @@ impl fmt::Debug for Sink { #[cfg(test)] mod tests { - use io::prelude::*; - use io::{copy, sink, empty, repeat}; + use crate::io::prelude::*; + use crate::io::{copy, sink, empty, repeat}; #[test] fn copy_copies() { diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index ff72704bfbf6..92197e8014a0 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -209,6 +209,10 @@ #![deny(intra_doc_link_resolution_failure)] #![deny(missing_debug_implementations)] +#![deny(rust_2018_idioms)] +#![allow(explicit_outlives_requirements)] +#![allow(elided_lifetimes_in_paths)] + // Tell the compiler to link to either panic_abort or panic_unwind #![needs_panic_runtime] @@ -272,7 +276,6 @@ #![feature(maybe_uninit)] #![feature(needs_panic_runtime)] #![feature(never_type)] -#![feature(nll)] #![feature(non_exhaustive)] #![feature(on_unimplemented)] #![feature(optin_builtin_traits)] @@ -313,29 +316,25 @@ use prelude::v1::*; // Access to Bencher, etc. #[cfg(test)] extern crate test; -#[cfg(test)] extern crate rand; // Re-export a few macros from core #[stable(feature = "rust1", since = "1.0.0")] pub use core::{assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne}; #[stable(feature = "rust1", since = "1.0.0")] -pub use core::{unreachable, unimplemented, write, writeln, try}; +pub use core::{unreachable, unimplemented, write, writeln, r#try}; #[allow(unused_imports)] // macros from `alloc` are not used on all platforms #[macro_use] extern crate alloc as alloc_crate; #[doc(masked)] +#[allow(unused_extern_crates)] extern crate libc; -extern crate rustc_demangle; // We always need an unwinder currently for backtraces #[doc(masked)] #[allow(unused_extern_crates)] extern crate unwind; -#[cfg(feature = "backtrace")] -extern crate backtrace_sys; - // During testing, this crate is not actually the "real" std library, but rather // it links to the real std library, which was compiled from this same source // code. So any lang items std defines are conditionally excluded (or else they diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index b9204d27f539..281641c3c123 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -333,7 +333,7 @@ macro_rules! dbg { #[cfg_attr(stage0, allow_internal_unstable)] #[cfg_attr(not(stage0), allow_internal_unstable(gen_future, generators))] #[allow_internal_unsafe] -macro_rules! await { +macro_rules! r#await { ($e:expr) => { { let mut pinned = $e; loop { diff --git a/src/libstd/memchr.rs b/src/libstd/memchr.rs index 9f44c67c1cc5..d69294b2d200 100644 --- a/src/libstd/memchr.rs +++ b/src/libstd/memchr.rs @@ -22,7 +22,7 @@ /// ``` #[inline] pub fn memchr(needle: u8, haystack: &[u8]) -> Option { - ::sys::memchr::memchr(needle, haystack) + crate::sys::memchr::memchr(needle, haystack) } /// A safe interface to `memrchr`. @@ -42,7 +42,7 @@ pub fn memchr(needle: u8, haystack: &[u8]) -> Option { /// ``` #[inline] pub fn memrchr(needle: u8, haystack: &[u8]) -> Option { - ::sys::memchr::memrchr(needle, haystack) + crate::sys::memchr::memrchr(needle, haystack) } #[cfg(test)] diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index 4b60ee8e6dad..f5a87cc3ea67 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -1,16 +1,16 @@ -use fmt; -use hash; -use io; -use mem; -use net::{ntoh, hton, IpAddr, Ipv4Addr, Ipv6Addr}; -use option; -use sys::net::netc as c; -use sys_common::{FromInner, AsInner, IntoInner}; -use sys_common::net::LookupHost; -use vec; -use iter; -use slice; -use convert::TryInto; +use crate::fmt; +use crate::hash; +use crate::io; +use crate::mem; +use crate::net::{ntoh, hton, IpAddr, Ipv4Addr, Ipv6Addr}; +use crate::option; +use crate::sys::net::netc as c; +use crate::sys_common::{FromInner, AsInner, IntoInner}; +use crate::sys_common::net::LookupHost; +use crate::vec; +use crate::iter; +use crate::slice; +use crate::convert::TryInto; /// An internet socket address, either IPv4 or IPv6. /// @@ -921,8 +921,8 @@ impl ToSocketAddrs for String { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use net::*; - use net::test::{tsa, sa6, sa4}; + use crate::net::*; + use crate::net::test::{tsa, sa6, sa4}; #[test] fn to_socket_addr_ipaddr_u16() { diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index c85612901681..fa256ce50865 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -3,11 +3,11 @@ be to be stable", issue = "27709")] -use cmp::Ordering; -use fmt; -use hash; -use sys::net::netc as c; -use sys_common::{AsInner, FromInner}; +use crate::cmp::Ordering; +use crate::fmt; +use crate::hash; +use crate::sys::net::netc as c; +use crate::sys_common::{AsInner, FromInner}; /// An IP address, either IPv4 or IPv6. /// @@ -1509,9 +1509,9 @@ impl From<[u16; 8]> for IpAddr { // Tests for this module #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use net::*; - use net::Ipv6MulticastScope::*; - use net::test::{tsa, sa6, sa4}; + use crate::net::*; + use crate::net::Ipv6MulticastScope::*; + use crate::net::test::{tsa, sa6, sa4}; #[test] fn test_from_str_ipv4() { diff --git a/src/libstd/net/mod.rs b/src/libstd/net/mod.rs index 93e724db3d4d..b68146939fdc 100644 --- a/src/libstd/net/mod.rs +++ b/src/libstd/net/mod.rs @@ -28,7 +28,7 @@ #![stable(feature = "rust1", since = "1.0.0")] -use io::{self, Error, ErrorKind}; +use crate::io::{self, Error, ErrorKind}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope}; diff --git a/src/libstd/net/parser.rs b/src/libstd/net/parser.rs index 70e0c2ad4b49..7951cd6bcf28 100644 --- a/src/libstd/net/parser.rs +++ b/src/libstd/net/parser.rs @@ -3,10 +3,10 @@ //! This module is "publicly exported" through the `FromStr` implementations //! below. -use error::Error; -use fmt; -use net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; -use str::FromStr; +use crate::error::Error; +use crate::fmt; +use crate::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; +use crate::str::FromStr; struct Parser<'a> { // parsing as ASCII, so can use byte array diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index 3aa29f83b293..275557da96f6 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -1,11 +1,11 @@ -use io::prelude::*; +use crate::io::prelude::*; -use fmt; -use io::{self, Initializer, IoVec, IoVecMut}; -use net::{ToSocketAddrs, SocketAddr, Shutdown}; -use sys_common::net as net_imp; -use sys_common::{AsInner, FromInner, IntoInner}; -use time::Duration; +use crate::fmt; +use crate::io::{self, Initializer, IoVec, IoVecMut}; +use crate::net::{ToSocketAddrs, SocketAddr, Shutdown}; +use crate::sys_common::net as net_imp; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::time::Duration; /// A TCP stream between a local and a remote socket. /// @@ -929,14 +929,14 @@ impl fmt::Debug for TcpListener { #[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))] mod tests { - use io::{ErrorKind, IoVec, IoVecMut}; - use io::prelude::*; - use net::*; - use net::test::{next_test_ip4, next_test_ip6}; - use sync::mpsc::channel; - use sys_common::AsInner; - use time::{Instant, Duration}; - use thread; + use crate::io::{ErrorKind, IoVec, IoVecMut}; + use crate::io::prelude::*; + use crate::net::*; + use crate::net::test::{next_test_ip4, next_test_ip6}; + use crate::sync::mpsc::channel; + use crate::sys_common::AsInner; + use crate::time::{Instant, Duration}; + use crate::thread; fn each_ip(f: &mut dyn FnMut(SocketAddr)) { f(next_test_ip4()); diff --git a/src/libstd/net/test.rs b/src/libstd/net/test.rs index eb5862cbdd94..89fefd9d1d5e 100644 --- a/src/libstd/net/test.rs +++ b/src/libstd/net/test.rs @@ -1,8 +1,8 @@ #![allow(warnings)] // not used on emscripten -use env; -use net::{SocketAddr, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr, ToSocketAddrs}; -use sync::atomic::{AtomicUsize, Ordering}; +use crate::env; +use crate::net::{SocketAddr, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr, ToSocketAddrs}; +use crate::sync::atomic::{AtomicUsize, Ordering}; static PORT: AtomicUsize = AtomicUsize::new(0); diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs index d49871ce7bd8..edc9d665444a 100644 --- a/src/libstd/net/udp.rs +++ b/src/libstd/net/udp.rs @@ -1,9 +1,9 @@ -use fmt; -use io::{self, Error, ErrorKind}; -use net::{ToSocketAddrs, SocketAddr, Ipv4Addr, Ipv6Addr}; -use sys_common::net as net_imp; -use sys_common::{AsInner, FromInner, IntoInner}; -use time::Duration; +use crate::fmt; +use crate::io::{self, Error, ErrorKind}; +use crate::net::{ToSocketAddrs, SocketAddr, Ipv4Addr, Ipv6Addr}; +use crate::sys_common::net as net_imp; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::time::Duration; /// A UDP socket. /// @@ -808,13 +808,13 @@ impl fmt::Debug for UdpSocket { #[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))] mod tests { - use io::ErrorKind; - use net::*; - use net::test::{next_test_ip4, next_test_ip6}; - use sync::mpsc::channel; - use sys_common::AsInner; - use time::{Instant, Duration}; - use thread; + use crate::io::ErrorKind; + use crate::net::*; + use crate::net::test::{next_test_ip4, next_test_ip6}; + use crate::sync::mpsc::channel; + use crate::sys_common::AsInner; + use crate::time::{Instant, Duration}; + use crate::thread; fn each_ip(f: &mut dyn FnMut(SocketAddr, SocketAddr)) { f(next_test_ip4(), next_test_ip4()); diff --git a/src/libstd/num.rs b/src/libstd/num.rs index c80b9a56704a..828d5720eec1 100644 --- a/src/libstd/num.rs +++ b/src/libstd/num.rs @@ -14,8 +14,8 @@ pub use core::num::Wrapping; #[stable(feature = "nonzero", since = "1.28.0")] pub use core::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, NonZeroUsize}; -#[cfg(test)] use fmt; -#[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem}; +#[cfg(test)] use crate::fmt; +#[cfg(test)] use crate::ops::{Add, Sub, Mul, Div, Rem}; /// Helper function for testing numeric operations #[cfg(test)] @@ -35,16 +35,16 @@ pub fn test_num(ten: T, two: T) where #[cfg(test)] mod tests { - use u8; - use u16; - use u32; - use u64; - use usize; - use ops::Mul; + use crate::u8; + use crate::u16; + use crate::u32; + use crate::u64; + use crate::usize; + use crate::ops::Mul; #[test] fn test_saturating_add_uint() { - use usize::MAX; + use crate::usize::MAX; assert_eq!(3_usize.saturating_add(5_usize), 8_usize); assert_eq!(3_usize.saturating_add(MAX-1), MAX); assert_eq!(MAX.saturating_add(MAX), MAX); @@ -53,7 +53,7 @@ mod tests { #[test] fn test_saturating_sub_uint() { - use usize::MAX; + use crate::usize::MAX; assert_eq!(5_usize.saturating_sub(3_usize), 2_usize); assert_eq!(3_usize.saturating_sub(5_usize), 0_usize); assert_eq!(0_usize.saturating_sub(1_usize), 0_usize); @@ -62,7 +62,7 @@ mod tests { #[test] fn test_saturating_add_int() { - use isize::{MIN,MAX}; + use crate::isize::{MIN,MAX}; assert_eq!(3i32.saturating_add(5), 8); assert_eq!(3isize.saturating_add(MAX-1), MAX); assert_eq!(MAX.saturating_add(MAX), MAX); @@ -74,7 +74,7 @@ mod tests { #[test] fn test_saturating_sub_int() { - use isize::{MIN,MAX}; + use crate::isize::{MIN,MAX}; assert_eq!(3i32.saturating_sub(5), -2); assert_eq!(MIN.saturating_sub(1), MIN); assert_eq!((-2isize).saturating_sub(MAX), MIN); @@ -232,8 +232,8 @@ mod tests { assert_eq!(u64_val.to_string(), "0"); } - fn from_str(t: &str) -> Option { - ::str::FromStr::from_str(t).ok() + fn from_str(t: &str) -> Option { + crate::str::FromStr::from_str(t).ok() } #[test] @@ -275,8 +275,7 @@ mod tests { #[cfg(test)] mod bench { - extern crate test; - use self::test::Bencher; + use test::Bencher; #[bench] fn bench_pow_function(b: &mut Bencher) { diff --git a/src/libstd/os/android/fs.rs b/src/libstd/os/android/fs.rs index 7aab6bf27ca8..9b24f86204bb 100644 --- a/src/libstd/os/android/fs.rs +++ b/src/libstd/os/android/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::android::raw; +use crate::os::android::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/android/raw.rs b/src/libstd/os/android/raw.rs index e03de8a7cc40..acf5ca1e4297 100644 --- a/src/libstd/os/android/raw.rs +++ b/src/libstd/os/android/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; +use crate::os::raw::c_long; #[stable(feature = "pthread_t", since = "1.8.0")] pub type pthread_t = c_long; @@ -19,8 +19,8 @@ pub use self::arch::{dev_t, mode_t, blkcnt_t, blksize_t, ino_t, nlink_t, off_t, #[cfg(any(target_arch = "arm", target_arch = "x86"))] mod arch { - use os::raw::{c_uint, c_uchar, c_ulonglong, c_longlong, c_ulong}; - use os::unix::raw::{uid_t, gid_t}; + use crate::os::raw::{c_uint, c_uchar, c_ulonglong, c_longlong, c_ulong}; + use crate::os::unix::raw::{uid_t, gid_t}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; @@ -89,8 +89,8 @@ mod arch { #[cfg(target_arch = "aarch64")] mod arch { - use os::raw::{c_uchar, c_ulong}; - use os::unix::raw::{uid_t, gid_t}; + use crate::os::raw::{c_uchar, c_ulong}; + use crate::os::unix::raw::{uid_t, gid_t}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; @@ -157,8 +157,8 @@ mod arch { #[cfg(target_arch = "x86_64")] mod arch { - use os::raw::{c_uint, c_long, c_ulong}; - use os::unix::raw::{uid_t, gid_t}; + use crate::os::raw::{c_uint, c_long, c_ulong}; + use crate::os::unix::raw::{uid_t, gid_t}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; diff --git a/src/libstd/os/bitrig/fs.rs b/src/libstd/os/bitrig/fs.rs index 8d6da3b7a073..849d4aa67f20 100644 --- a/src/libstd/os/bitrig/fs.rs +++ b/src/libstd/os/bitrig/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::bitrig::raw; +use crate::os::bitrig::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/bitrig/raw.rs b/src/libstd/os/bitrig/raw.rs index 034dc986b691..c966d5a8e5b4 100644 --- a/src/libstd/os/bitrig/raw.rs +++ b/src/libstd/os/bitrig/raw.rs @@ -8,8 +8,8 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; -use os::unix::raw::{uid_t, gid_t}; +use crate::os::raw::c_long; +use crate::os::unix::raw::{uid_t, gid_t}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/dragonfly/fs.rs b/src/libstd/os/dragonfly/fs.rs index 14f5e8035687..ba38660224f2 100644 --- a/src/libstd/os/dragonfly/fs.rs +++ b/src/libstd/os/dragonfly/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::dragonfly::raw; +use crate::os::dragonfly::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/dragonfly/raw.rs b/src/libstd/os/dragonfly/raw.rs index 4f36652ddcf5..46ef5a1e7cf7 100644 --- a/src/libstd/os/dragonfly/raw.rs +++ b/src/libstd/os/dragonfly/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; +use crate::os::raw::c_long; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/emscripten/fs.rs b/src/libstd/os/emscripten/fs.rs index 33c41c9223e6..aa6aa38283de 100644 --- a/src/libstd/os/emscripten/fs.rs +++ b/src/libstd/os/emscripten/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::emscripten::raw; +use crate::os::emscripten::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/emscripten/raw.rs b/src/libstd/os/emscripten/raw.rs index d59ce482ef78..e55134879794 100644 --- a/src/libstd/os/emscripten/raw.rs +++ b/src/libstd/os/emscripten/raw.rs @@ -10,7 +10,7 @@ definitions")] #![allow(deprecated)] -use os::raw::{c_long, c_short, c_uint, c_ulong}; +use crate::os::raw::{c_long, c_short, c_uint, c_ulong}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; diff --git a/src/libstd/os/fortanix_sgx/mod.rs b/src/libstd/os/fortanix_sgx/mod.rs index bd6f4b4465b2..bca22e717d72 100644 --- a/src/libstd/os/fortanix_sgx/mod.rs +++ b/src/libstd/os/fortanix_sgx/mod.rs @@ -11,34 +11,35 @@ /// /// [ABI documentation]: https://docs.rs/fortanix-sgx-abi/ pub mod usercalls { - pub use sys::abi::usercalls::*; + pub use crate::sys::abi::usercalls::*; /// Primitives for allocating memory in userspace as well as copying data /// to and from user memory. pub mod alloc { - pub use sys::abi::usercalls::alloc::*; + pub use crate::sys::abi::usercalls::alloc::*; } /// Lowest-level interfaces to usercalls and usercall ABI type definitions. pub mod raw { - pub use sys::abi::usercalls::raw::{do_usercall, Usercalls as UsercallNrs}; - pub use sys::abi::usercalls::raw::{accept_stream, alloc, async_queues, bind_stream, close, - connect_stream, exit, flush, free, insecure_time, + pub use crate::sys::abi::usercalls::raw::{do_usercall, Usercalls as UsercallNrs}; + pub use crate::sys::abi::usercalls::raw::{accept_stream, alloc, async_queues, bind_stream, + close, connect_stream, exit, flush, free, insecure_time, launch_thread, read, read_alloc, send, wait, write}; // fortanix-sgx-abi re-exports - pub use sys::abi::usercalls::raw::{ByteBuffer, FifoDescriptor, Return, Usercall}; - pub use sys::abi::usercalls::raw::Error; - pub use sys::abi::usercalls::raw::{EV_RETURNQ_NOT_EMPTY, EV_UNPARK, EV_USERCALLQ_NOT_FULL, - FD_STDERR, FD_STDIN, FD_STDOUT, RESULT_SUCCESS, - USERCALL_USER_DEFINED, WAIT_INDEFINITE, WAIT_NO}; - pub use sys::abi::usercalls::raw::{Fd, Result, Tcs}; + pub use crate::sys::abi::usercalls::raw::{ByteBuffer, FifoDescriptor, Return, Usercall}; + pub use crate::sys::abi::usercalls::raw::Error; + pub use crate::sys::abi::usercalls::raw::{EV_RETURNQ_NOT_EMPTY, EV_UNPARK, + EV_USERCALLQ_NOT_FULL, FD_STDERR, FD_STDIN, FD_STDOUT, + RESULT_SUCCESS, USERCALL_USER_DEFINED, WAIT_INDEFINITE, + WAIT_NO}; + pub use crate::sys::abi::usercalls::raw::{Fd, Result, Tcs}; } } /// Functions for querying mapping information for pointers. pub mod mem { - pub use sys::abi::mem::*; + pub use crate::sys::abi::mem::*; } -pub use sys::ext::{io, arch, ffi}; +pub use crate::sys::ext::{io, arch, ffi}; diff --git a/src/libstd/os/freebsd/fs.rs b/src/libstd/os/freebsd/fs.rs index 1b4a0fcfa7c1..4cc3a4b91fbd 100644 --- a/src/libstd/os/freebsd/fs.rs +++ b/src/libstd/os/freebsd/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::freebsd::raw; +use crate::os::freebsd::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/freebsd/raw.rs b/src/libstd/os/freebsd/raw.rs index 7d90e583b5b9..0c58154ae607 100644 --- a/src/libstd/os/freebsd/raw.rs +++ b/src/libstd/os/freebsd/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; +use crate::os::raw::c_long; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/fuchsia/fs.rs b/src/libstd/os/fuchsia/fs.rs index 8c2d23cb1c2e..1544bdfbe0cd 100644 --- a/src/libstd/os/fuchsia/fs.rs +++ b/src/libstd/os/fuchsia/fs.rs @@ -1,7 +1,7 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/fuchsia/raw.rs b/src/libstd/os/fuchsia/raw.rs index b4a6bd3295c6..7e44a79b371c 100644 --- a/src/libstd/os/fuchsia/raw.rs +++ b/src/libstd/os/fuchsia/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_ulong; +use crate::os::raw::c_ulong; #[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; @@ -25,7 +25,7 @@ pub use self::arch::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t}; target_arch = "powerpc", target_arch = "arm"))] mod arch { - use os::raw::{c_long, c_short, c_uint}; + use crate::os::raw::{c_long, c_short, c_uint}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; @@ -81,7 +81,7 @@ mod arch { #[cfg(target_arch = "mips")] mod arch { - use os::raw::{c_long, c_ulong}; + use crate::os::raw::{c_long, c_ulong}; #[cfg(target_env = "musl")] #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64; @@ -151,7 +151,7 @@ mod arch { #[cfg(target_arch = "aarch64")] mod arch { - use os::raw::{c_long, c_int}; + use crate::os::raw::{c_long, c_int}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; @@ -207,7 +207,7 @@ mod arch { #[cfg(target_arch = "x86_64")] mod arch { - use os::raw::{c_long, c_int}; + use crate::os::raw::{c_long, c_int}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/haiku/fs.rs b/src/libstd/os/haiku/fs.rs index 2ed1ca975d8b..4097f8c26a62 100644 --- a/src/libstd/os/haiku/fs.rs +++ b/src/libstd/os/haiku/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::haiku::raw; +use crate::os::haiku::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/haiku/raw.rs b/src/libstd/os/haiku/raw.rs index e6af8f29807c..d86f4f3ba57c 100644 --- a/src/libstd/os/haiku/raw.rs +++ b/src/libstd/os/haiku/raw.rs @@ -4,8 +4,8 @@ #![allow(deprecated)] -use os::raw::{c_long}; -use os::unix::raw::{uid_t, gid_t}; +use crate::os::raw::{c_long}; +use crate::os::unix::raw::{uid_t, gid_t}; // Use the direct definition of usize, instead of uintptr_t like in libc #[stable(feature = "pthread_t", since = "1.8.0")] pub type pthread_t = usize; diff --git a/src/libstd/os/hermit/fs.rs b/src/libstd/os/hermit/fs.rs index b94324475e5a..eb28a839ba86 100644 --- a/src/libstd/os/hermit/fs.rs +++ b/src/libstd/os/hermit/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::hermit::raw; +use crate::os::hermit::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/ios/fs.rs b/src/libstd/os/ios/fs.rs index 7f0bdb80b20d..7b625f5e3fe3 100644 --- a/src/libstd/os/ios/fs.rs +++ b/src/libstd/os/ios/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::ios::raw; +use crate::os::ios::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/ios/raw.rs b/src/libstd/os/ios/raw.rs index 1b528ce8c91b..fa38bca09e26 100644 --- a/src/libstd/os/ios/raw.rs +++ b/src/libstd/os/ios/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; +use crate::os::raw::c_long; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/linux/fs.rs b/src/libstd/os/linux/fs.rs index 572d814fc069..ec5e98370768 100644 --- a/src/libstd/os/linux/fs.rs +++ b/src/libstd/os/linux/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::linux::raw; +use crate::os::linux::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/linux/raw.rs b/src/libstd/os/linux/raw.rs index e5ab8a839cb7..77eeacb4b477 100644 --- a/src/libstd/os/linux/raw.rs +++ b/src/libstd/os/linux/raw.rs @@ -9,7 +9,7 @@ #![allow(deprecated)] #![allow(missing_debug_implementations)] -use os::raw::c_ulong; +use crate::os::raw::c_ulong; #[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; @@ -28,7 +28,7 @@ pub use self::arch::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t}; target_arch = "asmjs", target_arch = "wasm32"))] mod arch { - use os::raw::{c_long, c_short, c_uint}; + use crate::os::raw::{c_long, c_short, c_uint}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; @@ -84,7 +84,7 @@ mod arch { #[cfg(target_arch = "mips")] mod arch { - use os::raw::{c_long, c_ulong}; + use crate::os::raw::{c_long, c_ulong}; #[cfg(target_env = "musl")] #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64; @@ -156,7 +156,7 @@ mod arch { #[cfg(target_arch = "aarch64")] mod arch { - use os::raw::{c_long, c_int}; + use crate::os::raw::{c_long, c_int}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; @@ -212,7 +212,7 @@ mod arch { #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))] mod arch { - use os::raw::{c_long, c_int}; + use crate::os::raw::{c_long, c_int}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/macos/fs.rs b/src/libstd/os/macos/fs.rs index 1227fc46fcdc..1bd66ad4c764 100644 --- a/src/libstd/os/macos/fs.rs +++ b/src/libstd/os/macos/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::macos::raw; +use crate::os::macos::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/macos/raw.rs b/src/libstd/os/macos/raw.rs index 684cb891e001..5685642c07ff 100644 --- a/src/libstd/os/macos/raw.rs +++ b/src/libstd/os/macos/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; +use crate::os::raw::c_long; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/mod.rs b/src/libstd/os/mod.rs index 6215ba47e30a..5cce3df71d6a 100644 --- a/src/libstd/os/mod.rs +++ b/src/libstd/os/mod.rs @@ -12,10 +12,10 @@ cfg_if! { // cross-platform way in the documentation #[stable(feature = "rust1", since = "1.0.0")] - pub use sys::unix_ext as unix; + pub use crate::sys::unix_ext as unix; #[stable(feature = "rust1", since = "1.0.0")] - pub use sys::windows_ext as windows; + pub use crate::sys::windows_ext as windows; #[doc(cfg(target_os = "linux"))] pub mod linux; @@ -26,11 +26,11 @@ cfg_if! { #[cfg(any(target_os = "redox", unix))] #[stable(feature = "rust1", since = "1.0.0")] - pub use sys::ext as unix; + pub use crate::sys::ext as unix; #[cfg(windows)] #[stable(feature = "rust1", since = "1.0.0")] - pub use sys::ext as windows; + pub use crate::sys::ext as windows; #[cfg(any(target_os = "linux", target_os = "l4re"))] pub mod linux; diff --git a/src/libstd/os/netbsd/fs.rs b/src/libstd/os/netbsd/fs.rs index 7022013e9dd2..6dffb70b5dc7 100644 --- a/src/libstd/os/netbsd/fs.rs +++ b/src/libstd/os/netbsd/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::netbsd::raw; +use crate::os::netbsd::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/netbsd/raw.rs b/src/libstd/os/netbsd/raw.rs index f02bae801a24..1d5d5c6891e3 100644 --- a/src/libstd/os/netbsd/raw.rs +++ b/src/libstd/os/netbsd/raw.rs @@ -8,8 +8,8 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; -use os::unix::raw::{uid_t, gid_t}; +use crate::os::raw::c_long; +use crate::os::unix::raw::{uid_t, gid_t}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/openbsd/fs.rs b/src/libstd/os/openbsd/fs.rs index 4d9749199f94..73f9757f3b79 100644 --- a/src/libstd/os/openbsd/fs.rs +++ b/src/libstd/os/openbsd/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::openbsd::raw; +use crate::os::openbsd::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/openbsd/raw.rs b/src/libstd/os/openbsd/raw.rs index 27710ca6ce7b..094168453d79 100644 --- a/src/libstd/os/openbsd/raw.rs +++ b/src/libstd/os/openbsd/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; +use crate::os::raw::c_long; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/raw/mod.rs b/src/libstd/os/raw/mod.rs index 78288a6a1f0c..e9043b4b40d7 100644 --- a/src/libstd/os/raw/mod.rs +++ b/src/libstd/os/raw/mod.rs @@ -86,9 +86,8 @@ pub use core::ffi::c_void; #[cfg(test)] #[allow(unused_imports)] mod tests { - use any::TypeId; - use libc; - use mem; + use crate::any::TypeId; + use crate::mem; macro_rules! ok { ($($t:ident)*) => {$( @@ -99,7 +98,7 @@ mod tests { #[test] fn same() { - use os::raw; + use crate::os::raw; ok!(c_char c_schar c_uchar c_short c_ushort c_int c_uint c_long c_ulong c_longlong c_ulonglong c_float c_double); } diff --git a/src/libstd/os/solaris/fs.rs b/src/libstd/os/solaris/fs.rs index f2f89b5dd8bc..55a8d5d1ef00 100644 --- a/src/libstd/os/solaris/fs.rs +++ b/src/libstd/os/solaris/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::solaris::raw; +use crate::os::solaris::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/solaris/raw.rs b/src/libstd/os/solaris/raw.rs index 3c2c063ca41e..93270efea2b6 100644 --- a/src/libstd/os/solaris/raw.rs +++ b/src/libstd/os/solaris/raw.rs @@ -8,8 +8,8 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; -use os::unix::raw::{uid_t, gid_t}; +use crate::os::raw::c_long; +use crate::os::unix::raw::{uid_t, gid_t}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs index daeac7107a56..6a16414c1417 100644 --- a/src/libstd/panic.rs +++ b/src/libstd/panic.rs @@ -2,21 +2,21 @@ #![stable(feature = "std_panic", since = "1.9.0")] -use any::Any; -use cell::UnsafeCell; -use fmt; -use future::Future; -use pin::Pin; -use ops::{Deref, DerefMut}; -use panicking; -use ptr::{Unique, NonNull}; -use rc::Rc; -use sync::{Arc, Mutex, RwLock, atomic}; -use task::{Waker, Poll}; -use thread::Result; +use crate::any::Any; +use crate::cell::UnsafeCell; +use crate::fmt; +use crate::future::Future; +use crate::pin::Pin; +use crate::ops::{Deref, DerefMut}; +use crate::panicking; +use crate::ptr::{Unique, NonNull}; +use crate::rc::Rc; +use crate::sync::{Arc, Mutex, RwLock, atomic}; +use crate::task::{Waker, Poll}; +use crate::thread::Result; #[stable(feature = "panic_hooks", since = "1.10.0")] -pub use panicking::{take_hook, set_hook}; +pub use crate::panicking::{take_hook, set_hook}; #[stable(feature = "panic_hooks", since = "1.10.0")] pub use core::panic::{PanicInfo, Location}; @@ -385,7 +385,7 @@ impl Future for AssertUnwindSafe { #[stable(feature = "catch_unwind", since = "1.9.0")] pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { unsafe { - panicking::try(f) + panicking::r#try(f) } } diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index aaffc9bad454..868b309686cf 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -8,22 +8,22 @@ //! * Shims around "try" use core::panic::BoxMeUp; - -use io::prelude::*; - -use any::Any; -use cell::RefCell; use core::panic::{PanicInfo, Location}; -use fmt; -use intrinsics; -use mem; -use ptr; -use raw; -use sys::stdio::panic_output; -use sys_common::rwlock::RWLock; -use sys_common::thread_info; -use sys_common::util; -use thread; + +use crate::io::prelude::*; + +use crate::any::Any; +use crate::cell::RefCell; +use crate::fmt; +use crate::intrinsics; +use crate::mem; +use crate::ptr; +use crate::raw; +use crate::sys::stdio::panic_output; +use crate::sys_common::rwlock::RWLock; +use crate::sys_common::thread_info; +use crate::sys_common::util; +use crate::thread; thread_local! { pub static LOCAL_STDERR: RefCell>> = { @@ -159,7 +159,7 @@ pub fn take_hook() -> Box { fn default_hook(info: &PanicInfo) { #[cfg(feature = "backtrace")] - use sys_common::backtrace; + use crate::sys_common::backtrace; // If this is a double panic, make sure that we print a backtrace // for this panic. Otherwise only print it if logging is enabled. @@ -186,13 +186,13 @@ fn default_hook(info: &PanicInfo) { let thread = thread_info::current_thread(); let name = thread.as_ref().and_then(|t| t.name()).unwrap_or(""); - let write = |err: &mut dyn (::io::Write)| { + let write = |err: &mut dyn crate::io::Write| { let _ = writeln!(err, "thread '{}' panicked at '{}', {}", name, msg, location); #[cfg(feature = "backtrace")] { - use sync::atomic::{AtomicBool, Ordering}; + use crate::sync::atomic::{AtomicBool, Ordering}; static FIRST_PANIC: AtomicBool = AtomicBool::new(true); @@ -221,7 +221,7 @@ fn default_hook(info: &PanicInfo) { #[doc(hidden)] #[unstable(feature = "update_panic_count", issue = "0")] pub fn update_panic_count(amt: isize) -> usize { - use cell::Cell; + use crate::cell::Cell; thread_local! { static PANIC_COUNT: Cell = Cell::new(0) } PANIC_COUNT.with(|c| { @@ -235,7 +235,7 @@ pub fn update_panic_count(amt: isize) -> usize { pub use realstd::rt::update_panic_count; /// Invoke a closure, capturing the cause of an unwinding panic if one occurs. -pub unsafe fn try R>(f: F) -> Result> { +pub unsafe fn r#try R>(f: F) -> Result> { #[allow(unions_with_drop_fields)] union Data { f: F, @@ -352,7 +352,7 @@ fn continue_panic_fmt(info: &PanicInfo) -> ! { } fn fill(&mut self) -> &mut String { - use fmt::Write; + use crate::fmt::Write; let inner = self.inner; self.string.get_or_insert_with(|| { diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 9f91a9f89eb7..858a5778b816 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -67,22 +67,22 @@ #![stable(feature = "rust1", since = "1.0.0")] -use borrow::{Borrow, Cow}; -use cmp; -use error::Error; -use fmt; -use fs; -use hash::{Hash, Hasher}; -use io; -use iter::{self, FusedIterator}; -use ops::{self, Deref}; -use rc::Rc; -use str::FromStr; -use sync::Arc; +use crate::borrow::{Borrow, Cow}; +use crate::cmp; +use crate::error::Error; +use crate::fmt; +use crate::fs; +use crate::hash::{Hash, Hasher}; +use crate::io; +use crate::iter::{self, FusedIterator}; +use crate::ops::{self, Deref}; +use crate::rc::Rc; +use crate::str::FromStr; +use crate::sync::Arc; -use ffi::{OsStr, OsString}; +use crate::ffi::{OsStr, OsString}; -use sys::path::{is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix}; +use crate::sys::path::{is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix}; //////////////////////////////////////////////////////////////////////////////// // GENERAL NOTES @@ -279,7 +279,7 @@ pub fn is_separator(c: char) -> bool { /// /// For example, `/` on Unix and `\` on Windows. #[stable(feature = "rust1", since = "1.0.0")] -pub const MAIN_SEPARATOR: char = ::sys::path::MAIN_SEP; +pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP; //////////////////////////////////////////////////////////////////////////////// // Misc helpers @@ -2819,8 +2819,8 @@ impl Error for StripPrefixError { mod tests { use super::*; - use rc::Rc; - use sync::Arc; + use crate::rc::Rc; + use crate::sync::Arc; macro_rules! t( ($path:expr, iter: $iter:expr) => ( @@ -2907,7 +2907,7 @@ mod tests { #[test] fn into() { - use borrow::Cow; + use crate::borrow::Cow; let static_path = Path::new("/home/foo"); let static_cow_path: Cow<'static, Path> = static_path.into(); @@ -4007,7 +4007,7 @@ mod tests { #[test] fn test_eq_receivers() { - use borrow::Cow; + use crate::borrow::Cow; let borrowed: &Path = Path::new("foo/bar"); let mut owned: PathBuf = PathBuf::new(); @@ -4032,8 +4032,8 @@ mod tests { #[test] pub fn test_compare() { - use hash::{Hash, Hasher}; - use collections::hash_map::DefaultHasher; + use crate::hash::{Hash, Hasher}; + use crate::collections::hash_map::DefaultHasher; fn hash(t: T) -> u64 { let mut s = DefaultHasher::new(); diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs index 3001c899f620..ce1e8e3319cf 100644 --- a/src/libstd/prelude/v1.rs +++ b/src/libstd/prelude/v1.rs @@ -9,41 +9,41 @@ // Re-exported core operators #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use marker::{Copy, Send, Sized, Sync, Unpin}; +pub use crate::marker::{Copy, Send, Sized, Sync, Unpin}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use ops::{Drop, Fn, FnMut, FnOnce}; +pub use crate::ops::{Drop, Fn, FnMut, FnOnce}; // Re-exported functions #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use mem::drop; +pub use crate::mem::drop; // Re-exported types and traits #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use clone::Clone; +pub use crate::clone::Clone; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; +pub use crate::cmp::{PartialEq, PartialOrd, Eq, Ord}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use convert::{AsRef, AsMut, Into, From}; +pub use crate::convert::{AsRef, AsMut, Into, From}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use default::Default; +pub use crate::default::Default; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use iter::{Iterator, Extend, IntoIterator}; +pub use crate::iter::{Iterator, Extend, IntoIterator}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use iter::{DoubleEndedIterator, ExactSizeIterator}; +pub use crate::iter::{DoubleEndedIterator, ExactSizeIterator}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use option::Option::{self, Some, None}; +pub use crate::option::Option::{self, Some, None}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use result::Result::{self, Ok, Err}; +pub use crate::result::Result::{self, Ok, Err}; // The file so far is equivalent to src/libcore/prelude/v1.rs, @@ -54,16 +54,16 @@ pub use result::Result::{self, Ok, Err}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use boxed::Box; +pub use crate::boxed::Box; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use borrow::ToOwned; +pub use crate::borrow::ToOwned; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use slice::SliceConcatExt; +pub use crate::slice::SliceConcatExt; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use string::{String, ToString}; +pub use crate::string::{String, ToString}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use vec::Vec; +pub use crate::vec::Vec; diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 735ce61c9bc2..568400093440 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -106,17 +106,17 @@ #![stable(feature = "process", since = "1.0.0")] -use io::prelude::*; +use crate::io::prelude::*; -use ffi::OsStr; -use fmt; -use fs; -use io::{self, Initializer}; -use path::Path; -use str; -use sys::pipe::{read2, AnonPipe}; -use sys::process as imp; -use sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; +use crate::ffi::OsStr; +use crate::fmt; +use crate::fs; +use crate::io::{self, Initializer}; +use crate::path::Path; +use crate::str; +use crate::sys::pipe::{read2, AnonPipe}; +use crate::sys::process as imp; +use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; /// Representation of a running or exited child process. /// @@ -1481,8 +1481,8 @@ impl Child { /// [platform-specific behavior]: #platform-specific-behavior #[stable(feature = "rust1", since = "1.0.0")] pub fn exit(code: i32) -> ! { - ::sys_common::cleanup(); - ::sys::os::exit(code) + crate::sys_common::cleanup(); + crate::sys::os::exit(code) } /// Terminates the process in an abnormal fashion. @@ -1543,7 +1543,7 @@ pub fn exit(code: i32) -> ! { /// [panic hook]: ../../std/panic/fn.set_hook.html #[stable(feature = "process_abort", since = "1.17.0")] pub fn abort() -> ! { - unsafe { ::sys::abort_internal() }; + unsafe { crate::sys::abort_internal() }; } /// Returns the OS-assigned process identifier associated with this process. @@ -1561,7 +1561,7 @@ pub fn abort() -> ! { /// #[stable(feature = "getpid", since = "1.26.0")] pub fn id() -> u32 { - ::sys::os::getpid() + crate::sys::os::getpid() } /// A trait for implementing arbitrary return types in the `main` function. @@ -1623,10 +1623,10 @@ impl Termination for ExitCode { #[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))] mod tests { - use io::prelude::*; + use crate::io::prelude::*; - use io::ErrorKind; - use str; + use crate::io::ErrorKind; + use crate::str; use super::{Command, Output, Stdio}; // FIXME(#10380) these tests should not all be ignored on android. @@ -1671,7 +1671,7 @@ mod tests { #[cfg(unix)] #[cfg_attr(target_os = "android", ignore)] fn signal_reported_right() { - use os::unix::process::ExitStatusExt; + use crate::os::unix::process::ExitStatusExt; let mut p = Command::new("/bin/sh") .arg("-c").arg("read a") @@ -1741,8 +1741,8 @@ mod tests { #[cfg_attr(target_os = "android", ignore)] #[cfg(unix)] fn uid_works() { - use os::unix::prelude::*; - use libc; + use crate::os::unix::prelude::*; + let mut p = Command::new("/bin/sh") .arg("-c").arg("true") .uid(unsafe { libc::getuid() }) @@ -1755,8 +1755,7 @@ mod tests { #[cfg_attr(target_os = "android", ignore)] #[cfg(unix)] fn uid_to_root_fails() { - use os::unix::prelude::*; - use libc; + use crate::os::unix::prelude::*; // if we're already root, this isn't a valid test. Most of the bots run // as non-root though (android is an exception). @@ -1881,7 +1880,7 @@ mod tests { #[test] fn test_override_env() { - use env; + use crate::env; // In some build environments (such as chrooted Nix builds), `env` can // only be found in the explicitly-provided PATH env variable, not in @@ -1910,7 +1909,7 @@ mod tests { #[test] fn test_capture_env_at_spawn() { - use env; + use crate::env; let mut cmd = env_cmd(); cmd.env("RUN_TEST_NEW_ENV1", "123"); @@ -1985,8 +1984,8 @@ mod tests { #[test] #[cfg(windows)] fn test_creation_flags() { - use os::windows::process::CommandExt; - use sys::c::{BOOL, DWORD, INFINITE}; + use crate::os::windows::process::CommandExt; + use crate::sys::c::{BOOL, DWORD, INFINITE}; #[repr(C, packed)] struct DEBUG_EVENT { pub event_code: DWORD, diff --git a/src/libstd/rt.rs b/src/libstd/rt.rs index 5ddb66b1897e..cf45eb0daba3 100644 --- a/src/libstd/rt.rs +++ b/src/libstd/rt.rs @@ -14,18 +14,18 @@ // Re-export some of our utilities which are expected by other crates. -pub use panicking::{begin_panic, begin_panic_fmt, update_panic_count}; +pub use crate::panicking::{begin_panic, begin_panic_fmt, update_panic_count}; // To reduce the generated code of the new `lang_start`, this function is doing // the real work. #[cfg(not(test))] -fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + ::panic::RefUnwindSafe), +fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + crate::panic::RefUnwindSafe), argc: isize, argv: *const *const u8) -> isize { - use panic; - use sys; - use sys_common; - use sys_common::thread_info; - use thread::Thread; + use crate::panic; + use crate::sys; + use crate::sys_common; + use crate::sys_common::thread_info; + use crate::thread::Thread; sys::init(); @@ -46,7 +46,7 @@ fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + ::panic::RefUnwindSafe), // Let's run some code! #[cfg(feature = "backtrace")] let exit_code = panic::catch_unwind(|| { - ::sys_common::backtrace::__rust_begin_short_backtrace(move || main()) + sys_common::backtrace::__rust_begin_short_backtrace(move || main()) }); #[cfg(not(feature = "backtrace"))] let exit_code = panic::catch_unwind(move || main()); @@ -58,7 +58,7 @@ fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + ::panic::RefUnwindSafe), #[cfg(not(test))] #[lang = "start"] -fn lang_start +fn lang_start (main: fn() -> T, argc: isize, argv: *const *const u8) -> isize { lang_start_internal(&move || main().report(), argc, argv) diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs index bc2e14d436a9..a4205daba8b6 100644 --- a/src/libstd/sync/barrier.rs +++ b/src/libstd/sync/barrier.rs @@ -1,5 +1,5 @@ -use fmt; -use sync::{Mutex, Condvar}; +use crate::fmt; +use crate::sync::{Mutex, Condvar}; /// A barrier enables multiple threads to synchronize the beginning /// of some computation. @@ -181,9 +181,9 @@ impl BarrierWaitResult { #[cfg(test)] mod tests { - use sync::{Arc, Barrier}; - use sync::mpsc::{channel, TryRecvError}; - use thread; + use crate::sync::{Arc, Barrier}; + use crate::sync::mpsc::{channel, TryRecvError}; + use crate::thread; #[test] #[cfg_attr(target_os = "emscripten", ignore)] diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 036aff090ead..5ebb61754e1f 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -1,10 +1,10 @@ -use fmt; -use sync::atomic::{AtomicUsize, Ordering}; -use sync::{mutex, MutexGuard, PoisonError}; -use sys_common::condvar as sys; -use sys_common::mutex as sys_mutex; -use sys_common::poison::{self, LockResult}; -use time::{Duration, Instant}; +use crate::fmt; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::sync::{mutex, MutexGuard, PoisonError}; +use crate::sys_common::condvar as sys; +use crate::sys_common::mutex as sys_mutex; +use crate::sys_common::poison::{self, LockResult}; +use crate::time::{Duration, Instant}; /// A type indicating whether a timed wait on a condition variable returned /// due to a time out or not. @@ -612,12 +612,12 @@ impl Drop for Condvar { #[cfg(test)] mod tests { /// #![feature(wait_until)] - use sync::mpsc::channel; - use sync::{Condvar, Mutex, Arc}; - use sync::atomic::{AtomicBool, Ordering}; - use thread; - use time::Duration; - use u64; + use crate::sync::mpsc::channel; + use crate::sync::{Condvar, Mutex, Arc}; + use crate::sync::atomic::{AtomicBool, Ordering}; + use crate::thread; + use crate::time::Duration; + use crate::u64; #[test] fn smoke() { diff --git a/src/libstd/sync/mod.rs b/src/libstd/sync/mod.rs index 3d11af7dc10e..809ee8826981 100644 --- a/src/libstd/sync/mod.rs +++ b/src/libstd/sync/mod.rs @@ -165,7 +165,7 @@ pub use self::mutex::{Mutex, MutexGuard}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::once::{Once, OnceState, ONCE_INIT}; #[stable(feature = "rust1", since = "1.0.0")] -pub use sys_common::poison::{PoisonError, TryLockError, TryLockResult, LockResult}; +pub use crate::sys_common::poison::{PoisonError, TryLockError, TryLockResult, LockResult}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard}; diff --git a/src/libstd/sync/mpsc/blocking.rs b/src/libstd/sync/mpsc/blocking.rs index eaf09a16756b..6eacfaec2535 100644 --- a/src/libstd/sync/mpsc/blocking.rs +++ b/src/libstd/sync/mpsc/blocking.rs @@ -1,10 +1,10 @@ //! Generic support for building blocking abstractions. -use thread::{self, Thread}; -use sync::atomic::{AtomicBool, Ordering}; -use sync::Arc; -use mem; -use time::Instant; +use crate::thread::{self, Thread}; +use crate::sync::atomic::{AtomicBool, Ordering}; +use crate::sync::Arc; +use crate::mem; +use crate::time::Instant; struct Inner { thread: Thread, diff --git a/src/libstd/sync/mpsc/cache_aligned.rs b/src/libstd/sync/mpsc/cache_aligned.rs index fb1177e03506..b14a9e5d61bd 100644 --- a/src/libstd/sync/mpsc/cache_aligned.rs +++ b/src/libstd/sync/mpsc/cache_aligned.rs @@ -1,4 +1,4 @@ -use ops::{Deref, DerefMut}; +use crate::ops::{Deref, DerefMut}; #[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(align(64))] diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 5273345c6b4f..90c5c50c23b9 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -266,12 +266,12 @@ // And now that you've seen all the races that I found and attempted to fix, // here's the code for you to find some more! -use sync::Arc; -use error; -use fmt; -use mem; -use cell::UnsafeCell; -use time::{Duration, Instant}; +use crate::sync::Arc; +use crate::error; +use crate::fmt; +use crate::mem; +use crate::cell::UnsafeCell; +use crate::time::{Duration, Instant}; #[unstable(feature = "mpsc_select", issue = "27800")] pub use self::select::{Select, Handle}; @@ -1822,10 +1822,10 @@ impl From for RecvTimeoutError { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use env; use super::*; - use thread; - use time::{Duration, Instant}; + use crate::env; + use crate::thread; + use crate::time::{Duration, Instant}; pub fn stress_factor() -> usize { match env::var("RUST_TEST_STRESS") { @@ -2514,10 +2514,10 @@ mod tests { #[cfg(all(test, not(target_os = "emscripten")))] mod sync_tests { - use env; - use thread; use super::*; - use time::Duration; + use crate::env; + use crate::thread; + use crate::time::Duration; pub fn stress_factor() -> usize { match env::var("RUST_TEST_STRESS") { diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index 794d11f1eac9..8f5681b97f44 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -15,8 +15,9 @@ pub use self::PopResult::*; use core::ptr; use core::cell::UnsafeCell; -use boxed::Box; -use sync::atomic::{AtomicPtr, Ordering}; + +use crate::boxed::Box; +use crate::sync::atomic::{AtomicPtr, Ordering}; /// A result of the `pop` function. pub enum PopResult { @@ -120,10 +121,10 @@ impl Drop for Queue { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use sync::mpsc::channel; use super::{Queue, Data, Empty, Inconsistent}; - use sync::Arc; - use thread; + use crate::sync::mpsc::channel; + use crate::sync::Arc; + use crate::thread; #[test] fn test_full() { diff --git a/src/libstd/sync/mpsc/oneshot.rs b/src/libstd/sync/mpsc/oneshot.rs index 36928c428e33..5c516d5de0f1 100644 --- a/src/libstd/sync/mpsc/oneshot.rs +++ b/src/libstd/sync/mpsc/oneshot.rs @@ -27,12 +27,12 @@ pub use self::UpgradeResult::*; pub use self::SelectionResult::*; use self::MyUpgrade::*; -use sync::mpsc::Receiver; -use sync::mpsc::blocking::{self, SignalToken}; -use cell::UnsafeCell; -use ptr; -use sync::atomic::{AtomicUsize, Ordering}; -use time::Instant; +use crate::sync::mpsc::Receiver; +use crate::sync::mpsc::blocking::{self, SignalToken}; +use crate::cell::UnsafeCell; +use crate::ptr; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::time::Instant; // Various states you can find a port in. const EMPTY: usize = 0; // initial state: no data, no blocked receiver diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index 8591b55dc58e..19c949086454 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -46,16 +46,14 @@ #![rustc_deprecated(since = "1.32.0", reason = "channel selection will be removed in a future release")] - -use fmt; - use core::cell::{Cell, UnsafeCell}; use core::marker; use core::ptr; use core::usize; -use sync::mpsc::{Receiver, RecvError}; -use sync::mpsc::blocking::{self, SignalToken}; +use crate::fmt; +use crate::sync::mpsc::{Receiver, RecvError}; +use crate::sync::mpsc::blocking::{self, SignalToken}; /// The "receiver set" of the select interface. This structure is used to manage /// a set of receivers which are being selected over. diff --git a/src/libstd/sync/mpsc/select_tests.rs b/src/libstd/sync/mpsc/select_tests.rs index be048511caae..18d93462c78d 100644 --- a/src/libstd/sync/mpsc/select_tests.rs +++ b/src/libstd/sync/mpsc/select_tests.rs @@ -2,8 +2,8 @@ /// This file exists to hack around https://github.com/rust-lang/rust/issues/47238 -use thread; -use sync::mpsc::*; +use crate::thread; +use crate::sync::mpsc::*; // Don't use the libstd version so we can pull in the right Select structure // (std::comm points at the wrong one) diff --git a/src/libstd/sync/mpsc/shared.rs b/src/libstd/sync/mpsc/shared.rs index 3da73ac0b822..6a5d861f0e9c 100644 --- a/src/libstd/sync/mpsc/shared.rs +++ b/src/libstd/sync/mpsc/shared.rs @@ -14,16 +14,16 @@ use core::cmp; use core::intrinsics::abort; use core::isize; -use cell::UnsafeCell; -use ptr; -use sync::atomic::{AtomicUsize, AtomicIsize, AtomicBool, Ordering}; -use sync::mpsc::blocking::{self, SignalToken}; -use sync::mpsc::mpsc_queue as mpsc; -use sync::mpsc::select::StartResult::*; -use sync::mpsc::select::StartResult; -use sync::{Mutex, MutexGuard}; -use thread; -use time::Instant; +use crate::cell::UnsafeCell; +use crate::ptr; +use crate::sync::atomic::{AtomicUsize, AtomicIsize, AtomicBool, Ordering}; +use crate::sync::mpsc::blocking::{self, SignalToken}; +use crate::sync::mpsc::mpsc_queue as mpsc; +use crate::sync::mpsc::select::StartResult::*; +use crate::sync::mpsc::select::StartResult; +use crate::sync::{Mutex, MutexGuard}; +use crate::thread; +use crate::time::Instant; const DISCONNECTED: isize = isize::MIN; const FUDGE: isize = 1024; diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs index b43ccf074a42..0edb1c24e801 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -6,11 +6,11 @@ // http://www.1024cores.net/home/lock-free-algorithms/queues/unbounded-spsc-queue -use boxed::Box; use core::ptr; use core::cell::UnsafeCell; -use sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; +use crate::boxed::Box; +use crate::sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; use super::cache_aligned::CacheAligned; @@ -233,10 +233,10 @@ impl Drop for Queue(guard: &MutexGuard<'a, T>) -> &'a poison::Fla #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use sync::mpsc::channel; - use sync::{Arc, Mutex, Condvar}; - use sync::atomic::{AtomicUsize, Ordering}; - use thread; + use crate::sync::mpsc::channel; + use crate::sync::{Arc, Mutex, Condvar}; + use crate::sync::atomic::{AtomicUsize, Ordering}; + use crate::thread; struct Packet(Arc<(Mutex, Condvar)>); diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index e207d0170d7b..a036c2666625 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -52,11 +52,11 @@ // You'll find a few more details in the implementation, but that's the gist of // it! -use fmt; -use marker; -use ptr; -use sync::atomic::{AtomicUsize, AtomicBool, Ordering}; -use thread::{self, Thread}; +use crate::fmt; +use crate::marker; +use crate::ptr; +use crate::sync::atomic::{AtomicUsize, AtomicBool, Ordering}; +use crate::thread::{self, Thread}; /// A synchronization primitive which can be used to run a one-time global /// initialization. Useful for one-time initialization for FFI or related @@ -514,9 +514,9 @@ impl OnceState { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use panic; - use sync::mpsc::channel; - use thread; + use crate::panic; + use crate::sync::mpsc::channel; + use crate::thread; use super::Once; #[test] diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 7f3cb4f72c7b..0be83c76d625 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -1,10 +1,10 @@ -use cell::UnsafeCell; -use fmt; -use mem; -use ops::{Deref, DerefMut}; -use ptr; -use sys_common::poison::{self, LockResult, TryLockError, TryLockResult}; -use sys_common::rwlock as sys; +use crate::cell::UnsafeCell; +use crate::fmt; +use crate::mem; +use crate::ops::{Deref, DerefMut}; +use crate::ptr; +use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult}; +use crate::sys_common::rwlock as sys; /// A reader-writer lock /// @@ -554,10 +554,10 @@ impl Drop for RwLockWriteGuard<'_, T> { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { use rand::{self, Rng}; - use sync::mpsc::channel; - use thread; - use sync::{Arc, RwLock, TryLockError}; - use sync::atomic::{AtomicUsize, Ordering}; + use crate::sync::mpsc::channel; + use crate::thread; + use crate::sync::{Arc, RwLock, TryLockError}; + use crate::sync::atomic::{AtomicUsize, Ordering}; #[derive(Eq, PartialEq, Debug)] struct NonCopy(i32); diff --git a/src/libstd/sys/cloudabi/abi/cloudabi.rs b/src/libstd/sys/cloudabi/abi/cloudabi.rs index 83d45b3547bc..2307e2167c5c 100644 --- a/src/libstd/sys/cloudabi/abi/cloudabi.rs +++ b/src/libstd/sys/cloudabi/abi/cloudabi.rs @@ -1090,10 +1090,10 @@ pub union auxv_union { #[test] #[cfg(target_pointer_width = "32")] fn auxv_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 8); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 8); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: auxv = ::core::mem::uninitialized(); + let obj: auxv = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.a_type as *const _ as usize - base, 0); assert_eq!(&obj.union.a_val as *const _ as usize - base, 4); @@ -1103,10 +1103,10 @@ fn auxv_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn auxv_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 16); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 16); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: auxv = ::core::mem::uninitialized(); + let obj: auxv = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.a_type as *const _ as usize - base, 0); assert_eq!(&obj.union.a_val as *const _ as usize - base, 8); @@ -1124,10 +1124,10 @@ pub struct ciovec { #[test] #[cfg(target_pointer_width = "32")] fn ciovec_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 8); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 8); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: ciovec = ::core::mem::uninitialized(); + let obj: ciovec = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.buf.0 as *const _ as usize - base, 0); assert_eq!(&obj.buf.1 as *const _ as usize - base, 4); @@ -1136,10 +1136,10 @@ fn ciovec_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn ciovec_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 16); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 16); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: ciovec = ::core::mem::uninitialized(); + let obj: ciovec = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.buf.0 as *const _ as usize - base, 0); assert_eq!(&obj.buf.1 as *const _ as usize - base, 8); @@ -1164,10 +1164,10 @@ pub struct dirent { } #[test] fn dirent_layout_test() { - assert_eq!(::core::mem::size_of::(), 24); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 24); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: dirent = ::core::mem::uninitialized(); + let obj: dirent = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.d_next as *const _ as usize - base, 0); assert_eq!(&obj.d_ino as *const _ as usize - base, 8); @@ -1228,10 +1228,10 @@ pub struct event_proc_terminate { } #[test] fn event_layout_test() { - assert_eq!(::core::mem::size_of::(), 32); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 32); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: event = ::core::mem::uninitialized(); + let obj: event = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.userdata as *const _ as usize - base, 0); assert_eq!(&obj.error as *const _ as usize - base, 8); @@ -1262,10 +1262,10 @@ pub struct fdstat { } #[test] fn fdstat_layout_test() { - assert_eq!(::core::mem::size_of::(), 24); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 24); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: fdstat = ::core::mem::uninitialized(); + let obj: fdstat = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.fs_filetype as *const _ as usize - base, 0); assert_eq!(&obj.fs_flags as *const _ as usize - base, 2); @@ -1299,10 +1299,10 @@ pub struct filestat { } #[test] fn filestat_layout_test() { - assert_eq!(::core::mem::size_of::(), 56); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 56); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: filestat = ::core::mem::uninitialized(); + let obj: filestat = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.st_dev as *const _ as usize - base, 0); assert_eq!(&obj.st_ino as *const _ as usize - base, 8); @@ -1325,10 +1325,10 @@ pub struct iovec { #[test] #[cfg(target_pointer_width = "32")] fn iovec_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 8); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 8); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: iovec = ::core::mem::uninitialized(); + let obj: iovec = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.buf.0 as *const _ as usize - base, 0); assert_eq!(&obj.buf.1 as *const _ as usize - base, 4); @@ -1337,10 +1337,10 @@ fn iovec_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn iovec_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 16); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 16); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: iovec = ::core::mem::uninitialized(); + let obj: iovec = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.buf.0 as *const _ as usize - base, 0); assert_eq!(&obj.buf.1 as *const _ as usize - base, 8); @@ -1360,10 +1360,10 @@ pub struct lookup { } #[test] fn lookup_layout_test() { - assert_eq!(::core::mem::size_of::(), 8); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 8); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: lookup = ::core::mem::uninitialized(); + let obj: lookup = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.fd as *const _ as usize - base, 0); assert_eq!(&obj.flags as *const _ as usize - base, 4); @@ -1394,10 +1394,10 @@ pub struct recv_in { #[test] #[cfg(target_pointer_width = "32")] fn recv_in_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 20); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 20); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: recv_in = ::core::mem::uninitialized(); + let obj: recv_in = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.ri_data.0 as *const _ as usize - base, 0); assert_eq!(&obj.ri_data.1 as *const _ as usize - base, 4); @@ -1409,10 +1409,10 @@ fn recv_in_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn recv_in_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 40); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 40); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: recv_in = ::core::mem::uninitialized(); + let obj: recv_in = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.ri_data.0 as *const _ as usize - base, 0); assert_eq!(&obj.ri_data.1 as *const _ as usize - base, 8); @@ -1438,10 +1438,10 @@ pub struct recv_out { #[test] #[cfg(target_pointer_width = "32")] fn recv_out_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 52); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 52); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: recv_out = ::core::mem::uninitialized(); + let obj: recv_out = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.ro_datalen as *const _ as usize - base, 0); assert_eq!(&obj.ro_fdslen as *const _ as usize - base, 4); @@ -1452,10 +1452,10 @@ fn recv_out_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn recv_out_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 64); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 64); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: recv_out = ::core::mem::uninitialized(); + let obj: recv_out = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.ro_datalen as *const _ as usize - base, 0); assert_eq!(&obj.ro_fdslen as *const _ as usize - base, 8); @@ -1480,10 +1480,10 @@ pub struct send_in { #[test] #[cfg(target_pointer_width = "32")] fn send_in_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 20); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 20); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: send_in = ::core::mem::uninitialized(); + let obj: send_in = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.si_data.0 as *const _ as usize - base, 0); assert_eq!(&obj.si_data.1 as *const _ as usize - base, 4); @@ -1495,10 +1495,10 @@ fn send_in_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn send_in_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 40); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 40); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: send_in = ::core::mem::uninitialized(); + let obj: send_in = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.si_data.0 as *const _ as usize - base, 0); assert_eq!(&obj.si_data.1 as *const _ as usize - base, 8); @@ -1518,10 +1518,10 @@ pub struct send_out { #[test] #[cfg(target_pointer_width = "32")] fn send_out_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 4); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 4); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: send_out = ::core::mem::uninitialized(); + let obj: send_out = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.so_datalen as *const _ as usize - base, 0); } @@ -1529,10 +1529,10 @@ fn send_out_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn send_out_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 8); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 8); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: send_out = ::core::mem::uninitialized(); + let obj: send_out = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.so_datalen as *const _ as usize - base, 0); } @@ -1647,10 +1647,10 @@ pub struct subscription_proc_terminate { #[test] #[cfg(target_pointer_width = "32")] fn subscription_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 56); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 56); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: subscription = ::core::mem::uninitialized(); + let obj: subscription = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.userdata as *const _ as usize - base, 0); assert_eq!(&obj.unused as *const _ as usize - base, 8); @@ -1674,10 +1674,10 @@ fn subscription_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn subscription_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 56); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 56); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: subscription = ::core::mem::uninitialized(); + let obj: subscription = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.userdata as *const _ as usize - base, 0); assert_eq!(&obj.unused as *const _ as usize - base, 8); @@ -1728,10 +1728,10 @@ pub struct tcb { #[test] #[cfg(target_pointer_width = "32")] fn tcb_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 4); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 4); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: tcb = ::core::mem::uninitialized(); + let obj: tcb = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.parent as *const _ as usize - base, 0); } @@ -1739,10 +1739,10 @@ fn tcb_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn tcb_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 8); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 8); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: tcb = ::core::mem::uninitialized(); + let obj: tcb = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.parent as *const _ as usize - base, 0); } @@ -1773,10 +1773,10 @@ pub struct threadattr { #[test] #[cfg(target_pointer_width = "32")] fn threadattr_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 16); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 16); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: threadattr = ::core::mem::uninitialized(); + let obj: threadattr = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.entry_point as *const _ as usize - base, 0); assert_eq!(&obj.stack.0 as *const _ as usize - base, 4); @@ -1787,10 +1787,10 @@ fn threadattr_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn threadattr_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 32); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 32); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: threadattr = ::core::mem::uninitialized(); + let obj: threadattr = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.entry_point as *const _ as usize - base, 0); assert_eq!(&obj.stack.0 as *const _ as usize - base, 8); diff --git a/src/libstd/sys/cloudabi/args.rs b/src/libstd/sys/cloudabi/args.rs index 4147ffff8711..dea562abad3f 100644 --- a/src/libstd/sys/cloudabi/args.rs +++ b/src/libstd/sys/cloudabi/args.rs @@ -1,4 +1,4 @@ -pub use sys::cloudabi::shims::args::*; +pub use crate::sys::cloudabi::shims::args::*; #[allow(dead_code)] pub fn init(_: isize, _: *const *const u8) {} diff --git a/src/libstd/sys/cloudabi/backtrace.rs b/src/libstd/sys/cloudabi/backtrace.rs index 72f28550435a..a15d2238e556 100644 --- a/src/libstd/sys/cloudabi/backtrace.rs +++ b/src/libstd/sys/cloudabi/backtrace.rs @@ -1,9 +1,10 @@ -use error::Error; -use ffi::CStr; -use intrinsics; -use io; -use libc; -use sys_common::backtrace::Frame; +use crate::error::Error; +use crate::ffi::CStr; +use crate::fmt; +use crate::intrinsics; +use crate::io; +use crate::sys_common::backtrace::Frame; + use unwind as uw; pub struct BacktraceContext; @@ -22,8 +23,8 @@ impl Error for UnwindError { } } -impl ::fmt::Display for UnwindError { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { +impl fmt::Display for UnwindError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}: {:?}", self.description(), self.0) } } diff --git a/src/libstd/sys/cloudabi/condvar.rs b/src/libstd/sys/cloudabi/condvar.rs index 758f29653aeb..7aa0b0b6f491 100644 --- a/src/libstd/sys/cloudabi/condvar.rs +++ b/src/libstd/sys/cloudabi/condvar.rs @@ -1,10 +1,10 @@ -use cell::UnsafeCell; -use mem; -use sync::atomic::{AtomicU32, Ordering}; -use sys::cloudabi::abi; -use sys::mutex::{self, Mutex}; -use sys::time::checked_dur2intervals; -use time::Duration; +use crate::cell::UnsafeCell; +use crate::mem; +use crate::sync::atomic::{AtomicU32, Ordering}; +use crate::sys::cloudabi::abi; +use crate::sys::mutex::{self, Mutex}; +use crate::sys::time::checked_dur2intervals; +use crate::time::Duration; extern "C" { #[thread_local] diff --git a/src/libstd/sys/cloudabi/mod.rs b/src/libstd/sys/cloudabi/mod.rs index d9bc21861c90..47c90fddd867 100644 --- a/src/libstd/sys/cloudabi/mod.rs +++ b/src/libstd/sys/cloudabi/mod.rs @@ -1,5 +1,5 @@ -use libc; -use mem; +use crate::io::ErrorKind; +use crate::mem; #[path = "../unix/alloc.rs"] pub mod alloc; @@ -32,29 +32,29 @@ pub use self::shims::*; #[allow(dead_code)] pub fn init() {} -pub fn decode_error_kind(errno: i32) -> ::io::ErrorKind { +pub fn decode_error_kind(errno: i32) -> ErrorKind { match errno { - x if x == abi::errno::ACCES as i32 => ::io::ErrorKind::PermissionDenied, - x if x == abi::errno::ADDRINUSE as i32 => ::io::ErrorKind::AddrInUse, - x if x == abi::errno::ADDRNOTAVAIL as i32 => ::io::ErrorKind::AddrNotAvailable, - x if x == abi::errno::AGAIN as i32 => ::io::ErrorKind::WouldBlock, - x if x == abi::errno::CONNABORTED as i32 => ::io::ErrorKind::ConnectionAborted, - x if x == abi::errno::CONNREFUSED as i32 => ::io::ErrorKind::ConnectionRefused, - x if x == abi::errno::CONNRESET as i32 => ::io::ErrorKind::ConnectionReset, - x if x == abi::errno::EXIST as i32 => ::io::ErrorKind::AlreadyExists, - x if x == abi::errno::INTR as i32 => ::io::ErrorKind::Interrupted, - x if x == abi::errno::INVAL as i32 => ::io::ErrorKind::InvalidInput, - x if x == abi::errno::NOENT as i32 => ::io::ErrorKind::NotFound, - x if x == abi::errno::NOTCONN as i32 => ::io::ErrorKind::NotConnected, - x if x == abi::errno::PERM as i32 => ::io::ErrorKind::PermissionDenied, - x if x == abi::errno::PIPE as i32 => ::io::ErrorKind::BrokenPipe, - x if x == abi::errno::TIMEDOUT as i32 => ::io::ErrorKind::TimedOut, - _ => ::io::ErrorKind::Other, + x if x == abi::errno::ACCES as i32 => ErrorKind::PermissionDenied, + x if x == abi::errno::ADDRINUSE as i32 => ErrorKind::AddrInUse, + x if x == abi::errno::ADDRNOTAVAIL as i32 => ErrorKind::AddrNotAvailable, + x if x == abi::errno::AGAIN as i32 => ErrorKind::WouldBlock, + x if x == abi::errno::CONNABORTED as i32 => ErrorKind::ConnectionAborted, + x if x == abi::errno::CONNREFUSED as i32 => ErrorKind::ConnectionRefused, + x if x == abi::errno::CONNRESET as i32 => ErrorKind::ConnectionReset, + x if x == abi::errno::EXIST as i32 => ErrorKind::AlreadyExists, + x if x == abi::errno::INTR as i32 => ErrorKind::Interrupted, + x if x == abi::errno::INVAL as i32 => ErrorKind::InvalidInput, + x if x == abi::errno::NOENT as i32 => ErrorKind::NotFound, + x if x == abi::errno::NOTCONN as i32 => ErrorKind::NotConnected, + x if x == abi::errno::PERM as i32 => ErrorKind::PermissionDenied, + x if x == abi::errno::PIPE as i32 => ErrorKind::BrokenPipe, + x if x == abi::errno::TIMEDOUT as i32 => ErrorKind::TimedOut, + _ => ErrorKind::Other, } } pub unsafe fn abort_internal() -> ! { - ::core::intrinsics::abort(); + core::intrinsics::abort(); } pub use libc::strlen; diff --git a/src/libstd/sys/cloudabi/mutex.rs b/src/libstd/sys/cloudabi/mutex.rs index ae62d8bfdb0c..5e191e31d5fc 100644 --- a/src/libstd/sys/cloudabi/mutex.rs +++ b/src/libstd/sys/cloudabi/mutex.rs @@ -1,8 +1,8 @@ -use cell::UnsafeCell; -use mem; -use sync::atomic::{AtomicU32, Ordering}; -use sys::cloudabi::abi; -use sys::rwlock::{self, RWLock}; +use crate::cell::UnsafeCell; +use crate::mem; +use crate::sync::atomic::{AtomicU32, Ordering}; +use crate::sys::cloudabi::abi; +use crate::sys::rwlock::{self, RWLock}; extern "C" { #[thread_local] diff --git a/src/libstd/sys/cloudabi/os.rs b/src/libstd/sys/cloudabi/os.rs index 8a6464125de6..7db7808a0878 100644 --- a/src/libstd/sys/cloudabi/os.rs +++ b/src/libstd/sys/cloudabi/os.rs @@ -1,8 +1,9 @@ -use ffi::CStr; -use libc::{self, c_int}; -use str; +use crate::ffi::CStr; +use crate::str; -pub use sys::cloudabi::shims::os::*; +use libc::c_int; + +pub use crate::sys::cloudabi::shims::os::*; pub fn errno() -> i32 { extern "C" { diff --git a/src/libstd/sys/cloudabi/rwlock.rs b/src/libstd/sys/cloudabi/rwlock.rs index 7f08c2c78691..6da3f3841b6c 100644 --- a/src/libstd/sys/cloudabi/rwlock.rs +++ b/src/libstd/sys/cloudabi/rwlock.rs @@ -1,7 +1,7 @@ -use cell::UnsafeCell; -use mem; -use sync::atomic::{AtomicU32, Ordering}; -use sys::cloudabi::abi; +use crate::cell::UnsafeCell; +use crate::mem; +use crate::sync::atomic::{AtomicU32, Ordering}; +use crate::sys::cloudabi::abi; extern "C" { #[thread_local] diff --git a/src/libstd/sys/cloudabi/shims/args.rs b/src/libstd/sys/cloudabi/shims/args.rs index f924a434263f..f5cf71caf6c0 100644 --- a/src/libstd/sys/cloudabi/shims/args.rs +++ b/src/libstd/sys/cloudabi/shims/args.rs @@ -1,4 +1,4 @@ -use ffi::OsString; +use crate::ffi::OsString; pub struct Args(()); diff --git a/src/libstd/sys/cloudabi/shims/fs.rs b/src/libstd/sys/cloudabi/shims/fs.rs index 3af10a74c7d4..56667bef0070 100644 --- a/src/libstd/sys/cloudabi/shims/fs.rs +++ b/src/libstd/sys/cloudabi/shims/fs.rs @@ -1,10 +1,10 @@ -use ffi::OsString; -use fmt; -use hash::{Hash, Hasher}; -use io::{self, SeekFrom}; -use path::{Path, PathBuf}; -use sys::time::SystemTime; -use sys::{unsupported, Void}; +use crate::ffi::OsString; +use crate::fmt; +use crate::hash::{Hash, Hasher}; +use crate::io::{self, SeekFrom}; +use crate::path::{Path, PathBuf}; +use crate::sys::time::SystemTime; +use crate::sys::{unsupported, Void}; pub struct File(Void); diff --git a/src/libstd/sys/cloudabi/shims/mod.rs b/src/libstd/sys/cloudabi/shims/mod.rs index 080eac19ceb0..fbb5ff55f222 100644 --- a/src/libstd/sys/cloudabi/shims/mod.rs +++ b/src/libstd/sys/cloudabi/shims/mod.rs @@ -1,4 +1,4 @@ -use io; +use crate::io; pub mod args; pub mod env; diff --git a/src/libstd/sys/cloudabi/shims/net.rs b/src/libstd/sys/cloudabi/shims/net.rs index 869a0ef87a70..50d72dc7b240 100644 --- a/src/libstd/sys/cloudabi/shims/net.rs +++ b/src/libstd/sys/cloudabi/shims/net.rs @@ -1,10 +1,11 @@ -use fmt; -use io::{self, IoVec, IoVecMut}; -use net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr}; -use time::Duration; -use sys::{unsupported, Void}; -use convert::TryFrom; +use crate::fmt; +use crate::io::{self, IoVec, IoVecMut}; +use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr}; +use crate::time::Duration; +use crate::sys::{unsupported, Void}; +use crate::convert::TryFrom; +#[allow(unused_extern_crates)] pub extern crate libc as netc; pub struct TcpStream(Void); diff --git a/src/libstd/sys/cloudabi/shims/os.rs b/src/libstd/sys/cloudabi/shims/os.rs index 31cb18ea5268..0c4690e12b05 100644 --- a/src/libstd/sys/cloudabi/shims/os.rs +++ b/src/libstd/sys/cloudabi/shims/os.rs @@ -1,10 +1,10 @@ -use error::Error as StdError; -use ffi::{OsStr, OsString}; -use fmt; -use io; -use iter; -use path::{self, PathBuf}; -use sys::{unsupported, Void}; +use crate::error::Error as StdError; +use crate::ffi::{OsStr, OsString}; +use crate::fmt; +use crate::io; +use crate::iter; +use crate::path::{self, PathBuf}; +use crate::sys::{unsupported, Void}; pub fn getcwd() -> io::Result { unsupported() diff --git a/src/libstd/sys/cloudabi/shims/pipe.rs b/src/libstd/sys/cloudabi/shims/pipe.rs index 30ef79dd769b..f3debb950474 100644 --- a/src/libstd/sys/cloudabi/shims/pipe.rs +++ b/src/libstd/sys/cloudabi/shims/pipe.rs @@ -1,5 +1,5 @@ -use io; -use sys::Void; +use crate::io; +use crate::sys::Void; pub struct AnonPipe(Void); diff --git a/src/libstd/sys/cloudabi/shims/process.rs b/src/libstd/sys/cloudabi/shims/process.rs index 49b9d5e266ec..710c42c11490 100644 --- a/src/libstd/sys/cloudabi/shims/process.rs +++ b/src/libstd/sys/cloudabi/shims/process.rs @@ -1,10 +1,10 @@ -use ffi::OsStr; -use fmt; -use io; -use sys::fs::File; -use sys::pipe::AnonPipe; -use sys::{unsupported, Void}; -use sys_common::process::{CommandEnv, DefaultEnvKey}; +use crate::ffi::OsStr; +use crate::fmt; +use crate::io; +use crate::sys::fs::File; +use crate::sys::pipe::AnonPipe; +use crate::sys::{unsupported, Void}; +use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; //////////////////////////////////////////////////////////////////////////////// // Command diff --git a/src/libstd/sys/cloudabi/stdio.rs b/src/libstd/sys/cloudabi/stdio.rs index 81d79213f615..601563c5b1fc 100644 --- a/src/libstd/sys/cloudabi/stdio.rs +++ b/src/libstd/sys/cloudabi/stdio.rs @@ -1,5 +1,5 @@ -use io; -use sys::cloudabi::abi; +use crate::io; +use crate::sys::cloudabi::abi; pub struct Stdin(()); pub struct Stdout(()); @@ -59,7 +59,7 @@ pub fn is_ebadf(err: &io::Error) -> bool { err.raw_os_error() == Some(abi::errno::BADF as i32) } -pub const STDIN_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; +pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE; pub fn panic_output() -> Option { Stderr::new().ok() diff --git a/src/libstd/sys/cloudabi/thread.rs b/src/libstd/sys/cloudabi/thread.rs index 950420420f09..f853346e0e63 100644 --- a/src/libstd/sys/cloudabi/thread.rs +++ b/src/libstd/sys/cloudabi/thread.rs @@ -1,14 +1,13 @@ -use boxed::FnBox; -use cmp; -use ffi::CStr; -use io; -use libc; -use mem; -use ptr; -use sys::cloudabi::abi; -use sys::time::checked_dur2intervals; -use sys_common::thread::*; -use time::Duration; +use crate::boxed::FnBox; +use crate::cmp; +use crate::ffi::CStr; +use crate::io; +use crate::mem; +use crate::ptr; +use crate::sys::cloudabi::abi; +use crate::sys::time::checked_dur2intervals; +use crate::sys_common::thread::*; +use crate::time::Duration; pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024; diff --git a/src/libstd/sys/cloudabi/time.rs b/src/libstd/sys/cloudabi/time.rs index 545e3c0ce845..d7502c61eff2 100644 --- a/src/libstd/sys/cloudabi/time.rs +++ b/src/libstd/sys/cloudabi/time.rs @@ -1,6 +1,6 @@ -use mem; -use sys::cloudabi::abi; -use time::Duration; +use crate::mem; +use crate::sys::cloudabi::abi; +use crate::time::Duration; const NSEC_PER_SEC: abi::timestamp = 1_000_000_000; diff --git a/src/libstd/sys/mod.rs b/src/libstd/sys/mod.rs index 0a56f4fad6d1..5ba9304c09b9 100644 --- a/src/libstd/sys/mod.rs +++ b/src/libstd/sys/mod.rs @@ -67,7 +67,7 @@ cfg_if! { pub mod unix_ext {} } else { // On other platforms like Windows document the bare bones of unix - use os::linux as platform; + use crate::os::linux as platform; #[path = "unix/ext/mod.rs"] pub mod unix_ext; } diff --git a/src/libstd/sys/redox/args.rs b/src/libstd/sys/redox/args.rs index 4e51be03f6f0..f9e2f5ba311a 100644 --- a/src/libstd/sys/redox/args.rs +++ b/src/libstd/sys/redox/args.rs @@ -5,9 +5,9 @@ #![allow(dead_code)] // runtime init functions not used during testing -use ffi::OsString; -use marker::PhantomData; -use vec; +use crate::ffi::OsString; +use crate::marker::PhantomData; +use crate::vec; /// One-time global initialization. pub unsafe fn init(argc: isize, argv: *const *const u8) { imp::init(argc, argv) } @@ -46,14 +46,13 @@ impl DoubleEndedIterator for Args { } mod imp { - use os::unix::prelude::*; - use mem; - use ffi::{CStr, OsString}; - use marker::PhantomData; - use libc; + use crate::os::unix::prelude::*; + use crate::mem; + use crate::ffi::{CStr, OsString}; + use crate::marker::PhantomData; use super::Args; - use sys_common::mutex::Mutex; + use crate::sys_common::mutex::Mutex; static mut GLOBAL_ARGS_PTR: usize = 0; static LOCK: Mutex = Mutex::new(); diff --git a/src/libstd/sys/redox/backtrace/mod.rs b/src/libstd/sys/redox/backtrace/mod.rs index 9a007241073c..8ea2783580a4 100644 --- a/src/libstd/sys/redox/backtrace/mod.rs +++ b/src/libstd/sys/redox/backtrace/mod.rs @@ -9,13 +9,13 @@ mod tracing; mod printing; pub mod gnu { - use io; - use fs; + use crate::io; + use crate::fs; + use crate::vec::Vec; + use crate::ffi::OsStr; + use crate::os::unix::ffi::OsStrExt; + use crate::io::Read; use libc::c_char; - use vec::Vec; - use ffi::OsStr; - use os::unix::ffi::OsStrExt; - use io::Read; pub fn get_executable_filename() -> io::Result<(Vec, fs::File)> { let mut exefile = fs::File::open("sys:exe")?; diff --git a/src/libstd/sys/redox/backtrace/printing.rs b/src/libstd/sys/redox/backtrace/printing.rs index c50c7154f0cd..489eed4562de 100644 --- a/src/libstd/sys/redox/backtrace/printing.rs +++ b/src/libstd/sys/redox/backtrace/printing.rs @@ -1 +1 @@ -pub use sys_common::gnu::libbacktrace::{foreach_symbol_fileline, resolve_symname}; +pub use crate::sys_common::gnu::libbacktrace::{foreach_symbol_fileline, resolve_symname}; diff --git a/src/libstd/sys/redox/backtrace/tracing.rs b/src/libstd/sys/redox/backtrace/tracing.rs index 59a8c5fab3d4..e7a68eadbde3 100644 --- a/src/libstd/sys/redox/backtrace/tracing.rs +++ b/src/libstd/sys/redox/backtrace/tracing.rs @@ -1,8 +1,8 @@ -use error::Error; -use io; -use libc; -use sys::backtrace::BacktraceContext; -use sys_common::backtrace::Frame; +use crate::error::Error; +use crate::fmt; +use crate::io; +use crate::sys::backtrace::BacktraceContext; +use crate::sys_common::backtrace::Frame; use unwind as uw; @@ -20,8 +20,8 @@ impl Error for UnwindError { } } -impl ::fmt::Display for UnwindError { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { +impl fmt::Display for UnwindError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}: {:?}", self.description(), self.0) } } diff --git a/src/libstd/sys/redox/condvar.rs b/src/libstd/sys/redox/condvar.rs index 5f9eee588c33..a6365cac23ea 100644 --- a/src/libstd/sys/redox/condvar.rs +++ b/src/libstd/sys/redox/condvar.rs @@ -1,10 +1,10 @@ -use cell::UnsafeCell; -use intrinsics::{atomic_cxchg, atomic_load, atomic_xadd, atomic_xchg}; -use ptr; -use time::Duration; +use crate::cell::UnsafeCell; +use crate::intrinsics::{atomic_cxchg, atomic_load, atomic_xadd, atomic_xchg}; +use crate::ptr; +use crate::time::Duration; -use sys::mutex::{mutex_unlock, Mutex}; -use sys::syscall::{futex, TimeSpec, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE}; +use crate::sys::mutex::{mutex_unlock, Mutex}; +use crate::sys::syscall::{futex, TimeSpec, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE}; pub struct Condvar { lock: UnsafeCell<*mut i32>, @@ -48,7 +48,7 @@ impl Condvar { atomic_xadd(seq, 1); - let _ = futex(seq, FUTEX_REQUEUE, 1, ::usize::MAX, *lock); + let _ = futex(seq, FUTEX_REQUEUE, 1, crate::usize::MAX, *lock); } } diff --git a/src/libstd/sys/redox/ext/ffi.rs b/src/libstd/sys/redox/ext/ffi.rs index 848880d26e89..671498bc3903 100644 --- a/src/libstd/sys/redox/ext/ffi.rs +++ b/src/libstd/sys/redox/ext/ffi.rs @@ -2,10 +2,10 @@ #![stable(feature = "rust1", since = "1.0.0")] -use ffi::{OsStr, OsString}; -use mem; -use sys::os_str::Buf; -use sys_common::{FromInner, IntoInner, AsInner}; +use crate::ffi::{OsStr, OsString}; +use crate::mem; +use crate::sys::os_str::Buf; +use crate::sys_common::{FromInner, IntoInner, AsInner}; /// Redox-specific extensions to [`OsString`]. /// diff --git a/src/libstd/sys/redox/ext/fs.rs b/src/libstd/sys/redox/ext/fs.rs index 8b81273f201c..53b9dd68f734 100644 --- a/src/libstd/sys/redox/ext/fs.rs +++ b/src/libstd/sys/redox/ext/fs.rs @@ -2,11 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs::{self, Permissions, OpenOptions}; -use io; -use path::Path; -use sys; -use sys_common::{FromInner, AsInner, AsInnerMut}; +use crate::fs::{self, Permissions, OpenOptions}; +use crate::io; +use crate::path::Path; +use crate::sys; +use crate::sys_common::{FromInner, AsInner, AsInnerMut}; /// Redox-specific extensions to [`fs::Permissions`]. /// diff --git a/src/libstd/sys/redox/ext/io.rs b/src/libstd/sys/redox/ext/io.rs index 3ee0c6010a7a..f431f96c541f 100644 --- a/src/libstd/sys/redox/ext/io.rs +++ b/src/libstd/sys/redox/ext/io.rs @@ -2,11 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs; -use net; -use sys; -use io; -use sys_common::{self, AsInner, FromInner, IntoInner}; +use crate::fs; +use crate::net; +use crate::sys; +use crate::io; +use crate::sys_common::{self, AsInner, FromInner, IntoInner}; /// Raw file descriptors. #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/sys/redox/ext/net.rs b/src/libstd/sys/redox/ext/net.rs index 7411b8e068f6..2c121787804d 100644 --- a/src/libstd/sys/redox/ext/net.rs +++ b/src/libstd/sys/redox/ext/net.rs @@ -2,13 +2,13 @@ //! Unix-specific networking functionality -use fmt; -use io::{self, Error, ErrorKind, Initializer}; -use net::Shutdown; -use os::unix::io::{RawFd, AsRawFd, FromRawFd, IntoRawFd}; -use path::Path; -use time::Duration; -use sys::{cvt, fd::FileDesc, syscall}; +use crate::fmt; +use crate::io::{self, Error, ErrorKind, Initializer}; +use crate::net::Shutdown; +use crate::os::unix::io::{RawFd, AsRawFd, FromRawFd, IntoRawFd}; +use crate::path::Path; +use crate::time::Duration; +use crate::sys::{cvt, fd::FileDesc, syscall}; /// An address associated with a Unix socket. /// diff --git a/src/libstd/sys/redox/ext/process.rs b/src/libstd/sys/redox/ext/process.rs index 020075531dd0..e981cb93d441 100644 --- a/src/libstd/sys/redox/ext/process.rs +++ b/src/libstd/sys/redox/ext/process.rs @@ -2,11 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use io; -use os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd}; -use process; -use sys; -use sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; +use crate::io; +use crate::os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd}; +use crate::process; +use crate::sys; +use crate::sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; /// Redox-specific extensions to the [`process::Command`] builder, /// diff --git a/src/libstd/sys/redox/ext/thread.rs b/src/libstd/sys/redox/ext/thread.rs index 21b140ad718a..629eaef04ce3 100644 --- a/src/libstd/sys/redox/ext/thread.rs +++ b/src/libstd/sys/redox/ext/thread.rs @@ -2,8 +2,8 @@ #![stable(feature = "thread_extensions", since = "1.9.0")] -use sys_common::{AsInner, IntoInner}; -use thread::JoinHandle; +use crate::sys_common::{AsInner, IntoInner}; +use crate::thread::JoinHandle; #[stable(feature = "thread_extensions", since = "1.9.0")] #[allow(deprecated)] diff --git a/src/libstd/sys/redox/fast_thread_local.rs b/src/libstd/sys/redox/fast_thread_local.rs index 95263e6f5e31..1202708a4769 100644 --- a/src/libstd/sys/redox/fast_thread_local.rs +++ b/src/libstd/sys/redox/fast_thread_local.rs @@ -1,9 +1,9 @@ #![cfg(target_thread_local)] #![unstable(feature = "thread_local_internals", issue = "0")] -use cell::{Cell, UnsafeCell}; -use mem; -use ptr; +use crate::cell::{Cell, UnsafeCell}; +use crate::mem; +use crate::ptr; pub struct Key { @@ -15,7 +15,7 @@ pub struct Key { dtor_running: Cell, } -unsafe impl ::marker::Sync for Key { } +unsafe impl Sync for Key { } impl Key { pub const fn new() -> Key { @@ -57,7 +57,7 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { // *should* be the case that this loop always terminates because we // provide the guarantee that a TLS key cannot be set after it is // flagged for destruction. - use sys_common::thread_local as os; + use crate::sys_common::thread_local as os; static DTORS: os::StaticKey = os::StaticKey::new(Some(run_dtors)); type List = Vec<(*mut u8, unsafe extern fn(*mut u8))>; diff --git a/src/libstd/sys/redox/fd.rs b/src/libstd/sys/redox/fd.rs index fbf31aae2d0e..a42e486db223 100644 --- a/src/libstd/sys/redox/fd.rs +++ b/src/libstd/sys/redox/fd.rs @@ -1,9 +1,9 @@ #![unstable(reason = "not public", issue = "0", feature = "fd")] -use io::{self, Read}; -use mem; -use sys::{cvt, syscall}; -use sys_common::AsInner; +use crate::io::{self, Read}; +use crate::mem; +use crate::sys::{cvt, syscall}; +use crate::sys_common::AsInner; pub struct FileDesc { fd: usize, diff --git a/src/libstd/sys/redox/fs.rs b/src/libstd/sys/redox/fs.rs index 97e5dcebfeab..159ee9911bd3 100644 --- a/src/libstd/sys/redox/fs.rs +++ b/src/libstd/sys/redox/fs.rs @@ -1,14 +1,14 @@ -use os::unix::prelude::*; +use crate::os::unix::prelude::*; -use ffi::{OsString, OsStr}; -use fmt; -use io::{self, Error, ErrorKind, SeekFrom}; -use path::{Path, PathBuf}; -use sync::Arc; -use sys::fd::FileDesc; -use sys::time::SystemTime; -use sys::{cvt, syscall}; -use sys_common::{AsInner, FromInner}; +use crate::ffi::{OsString, OsStr}; +use crate::fmt; +use crate::io::{self, Error, ErrorKind, SeekFrom}; +use crate::path::{Path, PathBuf}; +use crate::sync::Arc; +use crate::sys::fd::FileDesc; +use crate::sys::time::SystemTime; +use crate::sys::{cvt, syscall}; +use crate::sys_common::{AsInner, FromInner}; pub struct File(FileDesc); @@ -457,7 +457,7 @@ pub fn canonicalize(p: &Path) -> io::Result { } pub fn copy(from: &Path, to: &Path) -> io::Result { - use fs::{File, set_permissions}; + use crate::fs::{File, set_permissions}; if !from.is_file() { return Err(Error::new(ErrorKind::InvalidInput, "the source path is not an existing regular file")) diff --git a/src/libstd/sys/redox/mod.rs b/src/libstd/sys/redox/mod.rs index c3878349bb32..7f3ac1f1bb5b 100644 --- a/src/libstd/sys/redox/mod.rs +++ b/src/libstd/sys/redox/mod.rs @@ -1,6 +1,6 @@ #![allow(dead_code, missing_docs, nonstandard_style)] -use ::io::{ErrorKind}; +use crate::io::ErrorKind; pub use libc::strlen; pub use self::rand::hashmap_random_keys; @@ -64,8 +64,8 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { } } -pub fn cvt(result: Result) -> ::io::Result { - result.map_err(|err| ::io::Error::from_raw_os_error(err.errno)) +pub fn cvt(result: Result) -> crate::io::Result { + result.map_err(|err| crate::io::Error::from_raw_os_error(err.errno)) } #[doc(hidden)] @@ -83,9 +83,9 @@ macro_rules! impl_is_minus_one { impl_is_minus_one! { i8 i16 i32 i64 isize } -pub fn cvt_libc(t: T) -> ::io::Result { +pub fn cvt_libc(t: T) -> crate::io::Result { if t.is_minus_one() { - Err(::io::Error::last_os_error()) + Err(crate::io::Error::last_os_error()) } else { Ok(t) } @@ -93,5 +93,5 @@ pub fn cvt_libc(t: T) -> ::io::Result { /// On Redox, use an illegal instruction to abort pub unsafe fn abort_internal() -> ! { - ::core::intrinsics::abort(); + core::intrinsics::abort(); } diff --git a/src/libstd/sys/redox/mutex.rs b/src/libstd/sys/redox/mutex.rs index bf39cc485911..59399df0294c 100644 --- a/src/libstd/sys/redox/mutex.rs +++ b/src/libstd/sys/redox/mutex.rs @@ -1,8 +1,8 @@ -use cell::UnsafeCell; -use intrinsics::{atomic_cxchg, atomic_xchg}; -use ptr; +use crate::cell::UnsafeCell; +use crate::intrinsics::{atomic_cxchg, atomic_xchg}; +use crate::ptr; -use sys::syscall::{futex, getpid, FUTEX_WAIT, FUTEX_WAKE}; +use crate::sys::syscall::{futex, getpid, FUTEX_WAIT, FUTEX_WAKE}; pub unsafe fn mutex_try_lock(m: *mut i32) -> bool { atomic_cxchg(m, 0, 1).0 == 0 diff --git a/src/libstd/sys/redox/net/dns/answer.rs b/src/libstd/sys/redox/net/dns/answer.rs index c0450c11ed6b..e9b406bc685a 100644 --- a/src/libstd/sys/redox/net/dns/answer.rs +++ b/src/libstd/sys/redox/net/dns/answer.rs @@ -1,5 +1,5 @@ -use string::String; -use vec::Vec; +use crate::string::String; +use crate::vec::Vec; #[derive(Clone, Debug)] pub struct DnsAnswer { diff --git a/src/libstd/sys/redox/net/dns/mod.rs b/src/libstd/sys/redox/net/dns/mod.rs index 8f0a0610af5e..6533e0d5efb7 100644 --- a/src/libstd/sys/redox/net/dns/mod.rs +++ b/src/libstd/sys/redox/net/dns/mod.rs @@ -1,10 +1,10 @@ pub use self::answer::DnsAnswer; pub use self::query::DnsQuery; -use slice; -use u16; -use string::String; -use vec::Vec; +use crate::slice; +use crate::u16; +use crate::string::String; +use crate::vec::Vec; mod answer; mod query; diff --git a/src/libstd/sys/redox/net/dns/query.rs b/src/libstd/sys/redox/net/dns/query.rs index dcb554d82deb..65fb241b0373 100644 --- a/src/libstd/sys/redox/net/dns/query.rs +++ b/src/libstd/sys/redox/net/dns/query.rs @@ -1,4 +1,4 @@ -use string::String; +use crate::string::String; #[derive(Clone, Debug)] pub struct DnsQuery { diff --git a/src/libstd/sys/redox/net/mod.rs b/src/libstd/sys/redox/net/mod.rs index 9e7599aebbbd..a172763f6131 100644 --- a/src/libstd/sys/redox/net/mod.rs +++ b/src/libstd/sys/redox/net/mod.rs @@ -1,13 +1,13 @@ -use fs::File; -use io::{Error, Read, self}; -use iter::Iterator; -use net::{Ipv4Addr, SocketAddr, SocketAddrV4}; -use str::FromStr; -use string::{String, ToString}; -use sys::syscall::EINVAL; -use time::{self, Duration}; -use vec::{IntoIter, Vec}; -use convert::{TryFrom, TryInto}; +use crate::fs::File; +use crate::io::{Error, Read, self}; +use crate::iter::Iterator; +use crate::net::{Ipv4Addr, SocketAddr, SocketAddrV4}; +use crate::str::FromStr; +use crate::string::{String, ToString}; +use crate::sys::syscall::EINVAL; +use crate::time::{self, Duration}; +use crate::vec::{IntoIter, Vec}; +use crate::convert::{TryFrom, TryInto}; use self::dns::{Dns, DnsQuery}; diff --git a/src/libstd/sys/redox/net/tcp.rs b/src/libstd/sys/redox/net/tcp.rs index abb9f72c324b..5081c3de73c5 100644 --- a/src/libstd/sys/redox/net/tcp.rs +++ b/src/libstd/sys/redox/net/tcp.rs @@ -1,12 +1,12 @@ -use cmp; -use io::{self, Error, ErrorKind, Result, IoVec, IoVecMut}; -use mem; -use net::{SocketAddr, Shutdown}; -use path::Path; -use sys::fs::{File, OpenOptions}; -use sys::syscall::TimeSpec; -use sys_common::{AsInner, FromInner, IntoInner}; -use time::Duration; +use crate::cmp; +use crate::io::{self, Error, ErrorKind, Result, IoVec, IoVecMut}; +use crate::mem; +use crate::net::{SocketAddr, Shutdown}; +use crate::path::Path; +use crate::sys::fs::{File, OpenOptions}; +use crate::sys::syscall::TimeSpec; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::time::Duration; use super::{path_to_peer_addr, path_to_local_addr}; diff --git a/src/libstd/sys/redox/net/udp.rs b/src/libstd/sys/redox/net/udp.rs index 2a59b44f0936..b1a60b145708 100644 --- a/src/libstd/sys/redox/net/udp.rs +++ b/src/libstd/sys/redox/net/udp.rs @@ -1,13 +1,13 @@ -use cell::UnsafeCell; -use cmp; -use io::{self, Error, ErrorKind, Result}; -use mem; -use net::{SocketAddr, Ipv4Addr, Ipv6Addr}; -use path::Path; -use sys::fs::{File, OpenOptions}; -use sys::syscall::TimeSpec; -use sys_common::{AsInner, FromInner, IntoInner}; -use time::Duration; +use crate::cell::UnsafeCell; +use crate::cmp; +use crate::io::{self, Error, ErrorKind, Result}; +use crate::mem; +use crate::net::{SocketAddr, Ipv4Addr, Ipv6Addr}; +use crate::path::Path; +use crate::sys::fs::{File, OpenOptions}; +use crate::sys::syscall::TimeSpec; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::time::Duration; use super::{path_to_peer_addr, path_to_local_addr}; diff --git a/src/libstd/sys/redox/os.rs b/src/libstd/sys/redox/os.rs index f7a26c949702..76e43a83b737 100644 --- a/src/libstd/sys/redox/os.rs +++ b/src/libstd/sys/redox/os.rs @@ -2,25 +2,25 @@ #![allow(unused_imports)] // lots of cfg code here -use libc::{self, c_char}; +use libc::c_char; -use os::unix::prelude::*; +use crate::os::unix::prelude::*; -use error::Error as StdError; -use ffi::{CStr, CString, OsStr, OsString}; -use fmt; -use io::{self, Read, Write}; -use iter; -use marker::PhantomData; -use mem; -use memchr; -use path::{self, PathBuf}; -use ptr; -use slice; -use str; -use sys_common::mutex::Mutex; -use sys::{cvt, cvt_libc, fd, syscall}; -use vec; +use crate::error::Error as StdError; +use crate::ffi::{CStr, CString, OsStr, OsString}; +use crate::fmt; +use crate::io::{self, Read, Write}; +use crate::iter; +use crate::marker::PhantomData; +use crate::mem; +use crate::memchr; +use crate::path::{self, PathBuf}; +use crate::ptr; +use crate::slice; +use crate::str; +use crate::sys_common::mutex::Mutex; +use crate::sys::{cvt, cvt_libc, fd, syscall}; +use crate::vec; extern { #[link_name = "__errno_location"] @@ -107,7 +107,7 @@ impl StdError for JoinPathsError { } pub fn current_exe() -> io::Result { - use fs::File; + use crate::fs::File; let mut file = File::open("sys:exe")?; @@ -218,13 +218,13 @@ pub fn page_size() -> usize { } pub fn temp_dir() -> PathBuf { - ::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| { + crate::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| { PathBuf::from("/tmp") }) } pub fn home_dir() -> Option { - return ::env::var_os("HOME").map(PathBuf::from); + return crate::env::var_os("HOME").map(PathBuf::from); } pub fn exit(code: i32) -> ! { diff --git a/src/libstd/sys/redox/os_str.rs b/src/libstd/sys/redox/os_str.rs index 9d5e084feb2d..79b43458d00f 100644 --- a/src/libstd/sys/redox/os_str.rs +++ b/src/libstd/sys/redox/os_str.rs @@ -1,14 +1,15 @@ /// The underlying OsString/OsStr implementation on Unix systems: just /// a `Vec`/`[u8]`. -use borrow::Cow; -use fmt; -use str; -use mem; -use rc::Rc; -use sync::Arc; -use sys_common::{AsInner, IntoInner}; -use sys_common::bytestring::debug_fmt_bytestring; +use crate::borrow::Cow; +use crate::fmt; +use crate::str; +use crate::mem; +use crate::rc::Rc; +use crate::sync::Arc; +use crate::sys_common::{AsInner, IntoInner}; +use crate::sys_common::bytestring::debug_fmt_bytestring; + use core::str::lossy::Utf8Lossy; #[derive(Clone, Hash)] diff --git a/src/libstd/sys/redox/path.rs b/src/libstd/sys/redox/path.rs index a7a8b03c8b1f..618d61e6fcb4 100644 --- a/src/libstd/sys/redox/path.rs +++ b/src/libstd/sys/redox/path.rs @@ -1,5 +1,5 @@ -use ffi::OsStr; -use path::Prefix; +use crate::ffi::OsStr; +use crate::path::Prefix; #[inline] pub fn is_sep_byte(b: u8) -> bool { diff --git a/src/libstd/sys/redox/pipe.rs b/src/libstd/sys/redox/pipe.rs index 9e40eadb2370..911ba9c3f652 100644 --- a/src/libstd/sys/redox/pipe.rs +++ b/src/libstd/sys/redox/pipe.rs @@ -1,6 +1,6 @@ -use io; -use sys::{cvt, syscall}; -use sys::fd::FileDesc; +use crate::io; +use crate::sys::{cvt, syscall}; +use crate::sys::fd::FileDesc; //////////////////////////////////////////////////////////////////////////////// // Anonymous pipes diff --git a/src/libstd/sys/redox/process.rs b/src/libstd/sys/redox/process.rs index 81af8eb553d0..8830cdf333ef 100644 --- a/src/libstd/sys/redox/process.rs +++ b/src/libstd/sys/redox/process.rs @@ -1,20 +1,21 @@ -use env::{split_paths}; -use ffi::{CStr, OsStr}; -use fmt; -use fs::File; -use io::{self, prelude::*, BufReader, Error, ErrorKind, SeekFrom}; +use crate::env::{self, split_paths}; +use crate::ffi::{CStr, OsStr}; +use crate::fmt; +use crate::fs::File; +use crate::io::{self, prelude::*, BufReader, Error, ErrorKind, SeekFrom}; +use crate::os::unix::ffi::OsStrExt; +use crate::path::{Path, PathBuf}; +use crate::ptr; +use crate::sys::ext::fs::MetadataExt; +use crate::sys::ext::io::AsRawFd; +use crate::sys::fd::FileDesc; +use crate::sys::fs::{File as SysFile, OpenOptions}; +use crate::sys::os::{ENV_LOCK, environ}; +use crate::sys::pipe::{self, AnonPipe}; +use crate::sys::{cvt, syscall}; +use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; + use libc::{EXIT_SUCCESS, EXIT_FAILURE}; -use os::unix::ffi::OsStrExt; -use path::{Path, PathBuf}; -use ptr; -use sys::ext::fs::MetadataExt; -use sys::ext::io::AsRawFd; -use sys::fd::FileDesc; -use sys::fs::{File as SysFile, OpenOptions}; -use sys::os::{ENV_LOCK, environ}; -use sys::pipe::{self, AnonPipe}; -use sys::{cvt, syscall}; -use sys_common::process::{CommandEnv, DefaultEnvKey}; //////////////////////////////////////////////////////////////////////////////// // Command @@ -297,7 +298,7 @@ impl Command { let program = if self.program.contains(':') || self.program.contains('/') { Some(PathBuf::from(&self.program)) - } else if let Ok(path_env) = ::env::var("PATH") { + } else if let Ok(path_env) = env::var("PATH") { let mut program = None; for mut path in split_paths(&path_env) { path.push(&self.program); diff --git a/src/libstd/sys/redox/stdio.rs b/src/libstd/sys/redox/stdio.rs index 8571b38cefa1..33f5bdbb5d35 100644 --- a/src/libstd/sys/redox/stdio.rs +++ b/src/libstd/sys/redox/stdio.rs @@ -1,6 +1,6 @@ -use io; -use sys::{cvt, syscall}; -use sys::fd::FileDesc; +use crate::io; +use crate::sys::{cvt, syscall}; +use crate::sys::fd::FileDesc; pub struct Stdin(()); pub struct Stdout(()); @@ -54,10 +54,10 @@ impl io::Write for Stderr { } pub fn is_ebadf(err: &io::Error) -> bool { - err.raw_os_error() == Some(::sys::syscall::EBADF as i32) + err.raw_os_error() == Some(crate::sys::syscall::EBADF as i32) } -pub const STDIN_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; +pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE; pub fn panic_output() -> Option { Stderr::new().ok() diff --git a/src/libstd/sys/redox/thread.rs b/src/libstd/sys/redox/thread.rs index 18679a7871e2..ae0b91b4d6c7 100644 --- a/src/libstd/sys/redox/thread.rs +++ b/src/libstd/sys/redox/thread.rs @@ -1,10 +1,10 @@ -use boxed::FnBox; -use ffi::CStr; -use io; -use mem; -use sys_common::thread::start_thread; -use sys::{cvt, syscall}; -use time::Duration; +use crate::boxed::FnBox; +use crate::ffi::CStr; +use crate::io; +use crate::mem; +use crate::sys_common::thread::start_thread; +use crate::sys::{cvt, syscall}; +use crate::time::Duration; pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024; diff --git a/src/libstd/sys/redox/thread_local.rs b/src/libstd/sys/redox/thread_local.rs index a1929b941659..4bc8c4d5883d 100644 --- a/src/libstd/sys/redox/thread_local.rs +++ b/src/libstd/sys/redox/thread_local.rs @@ -1,8 +1,8 @@ #![allow(dead_code)] // not used on all platforms -use collections::BTreeMap; -use ptr; -use sync::atomic::{AtomicUsize, Ordering}; +use crate::collections::BTreeMap; +use crate::ptr; +use crate::sync::atomic::{AtomicUsize, Ordering}; pub type Key = usize; diff --git a/src/libstd/sys/redox/time.rs b/src/libstd/sys/redox/time.rs index 401b7012aa7e..9db3e85ca9c8 100644 --- a/src/libstd/sys/redox/time.rs +++ b/src/libstd/sys/redox/time.rs @@ -1,8 +1,9 @@ -use cmp::Ordering; -use fmt; -use sys::{cvt, syscall}; -use time::Duration; -use convert::TryInto; +use crate::cmp::Ordering; +use crate::fmt; +use crate::sys::{cvt, syscall}; +use crate::time::Duration; +use crate::convert::TryInto; + use core::hash::{Hash, Hasher}; const NSEC_PER_SEC: u64 = 1_000_000_000; diff --git a/src/libstd/sys/sgx/abi/mod.rs b/src/libstd/sys/sgx/abi/mod.rs index 509a1990d978..7426f7be9e96 100644 --- a/src/libstd/sys/sgx/abi/mod.rs +++ b/src/libstd/sys/sgx/abi/mod.rs @@ -1,5 +1,5 @@ use core::sync::atomic::{AtomicUsize, Ordering}; -use io::Write; +use crate::io::Write; // runtime features mod reloc; @@ -37,7 +37,7 @@ unsafe extern "C" fn tcs_init(secondary: bool) { }, // We need to wait until the initialization is done. BUSY => while RELOC_STATE.load(Ordering::Acquire) == BUSY { - ::core::arch::x86_64::_mm_pause() + core::arch::x86_64::_mm_pause() }, // Initialization is done. DONE => {}, diff --git a/src/libstd/sys/sgx/abi/panic.rs b/src/libstd/sys/sgx/abi/panic.rs index b2afacc70b82..83411cb5b4c2 100644 --- a/src/libstd/sys/sgx/abi/panic.rs +++ b/src/libstd/sys/sgx/abi/panic.rs @@ -1,7 +1,7 @@ use super::usercalls::{alloc::UserRef, self}; -use cmp; -use io::{self, Write}; -use mem; +use crate::cmp; +use crate::io::{self, Write}; +use crate::mem; extern "C" { fn take_debug_panic_buf_ptr() -> *mut u8; diff --git a/src/libstd/sys/sgx/abi/reloc.rs b/src/libstd/sys/sgx/abi/reloc.rs index 4dd41d70bd70..a39841bc36f5 100644 --- a/src/libstd/sys/sgx/abi/reloc.rs +++ b/src/libstd/sys/sgx/abi/reloc.rs @@ -1,4 +1,4 @@ -use slice::from_raw_parts; +use crate::slice::from_raw_parts; use super::mem; const R_X86_64_RELATIVE: u32 = 8; diff --git a/src/libstd/sys/sgx/abi/tls.rs b/src/libstd/sys/sgx/abi/tls.rs index e1fc36968452..b2a812c7231d 100644 --- a/src/libstd/sys/sgx/abi/tls.rs +++ b/src/libstd/sys/sgx/abi/tls.rs @@ -1,8 +1,8 @@ -use sync::atomic::{AtomicUsize, Ordering}; -use ptr; -use mem; -use cell::Cell; -use num::NonZeroUsize; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::ptr; +use crate::mem; +use crate::cell::Cell; +use crate::num::NonZeroUsize; use self::sync_bitset::*; #[cfg(target_pointer_width="64")] @@ -152,9 +152,9 @@ impl Tls { } mod sync_bitset { - use sync::atomic::{AtomicUsize, Ordering}; - use iter::{Enumerate, Peekable}; - use slice::Iter; + use crate::sync::atomic::{AtomicUsize, Ordering}; + use crate::iter::{Enumerate, Peekable}; + use crate::slice::Iter; use super::{TLS_KEYS_BITSET_SIZE, USIZE_BITS}; /// A bitset that can be used synchronously. diff --git a/src/libstd/sys/sgx/abi/usercalls/alloc.rs b/src/libstd/sys/sgx/abi/usercalls/alloc.rs index 0ccbbbc65015..b787bd1a5aba 100644 --- a/src/libstd/sys/sgx/abi/usercalls/alloc.rs +++ b/src/libstd/sys/sgx/abi/usercalls/alloc.rs @@ -1,11 +1,11 @@ #![allow(unused)] -use ptr::{self, NonNull}; -use mem; -use cell::UnsafeCell; -use slice; -use ops::{Deref, DerefMut, Index, IndexMut, CoerceUnsized}; -use slice::SliceIndex; +use crate::ptr::{self, NonNull}; +use crate::mem; +use crate::cell::UnsafeCell; +use crate::slice; +use crate::ops::{Deref, DerefMut, Index, IndexMut, CoerceUnsized}; +use crate::slice::SliceIndex; use fortanix_sgx_abi::*; use super::super::mem::is_user_range; diff --git a/src/libstd/sys/sgx/abi/usercalls/mod.rs b/src/libstd/sys/sgx/abi/usercalls/mod.rs index 511d6e9e9273..7361011e92d3 100644 --- a/src/libstd/sys/sgx/abi/usercalls/mod.rs +++ b/src/libstd/sys/sgx/abi/usercalls/mod.rs @@ -1,5 +1,5 @@ -use io::{Error as IoError, Result as IoResult}; -use time::Duration; +use crate::io::{Error as IoError, Result as IoResult}; +use crate::time::Duration; pub(crate) mod alloc; #[macro_use] diff --git a/src/libstd/sys/sgx/abi/usercalls/raw.rs b/src/libstd/sys/sgx/abi/usercalls/raw.rs index 447f20584f85..ad0b6d7b3d8e 100644 --- a/src/libstd/sys/sgx/abi/usercalls/raw.rs +++ b/src/libstd/sys/sgx/abi/usercalls/raw.rs @@ -3,8 +3,8 @@ #[unstable(feature = "sgx_platform", issue = "56975")] pub use fortanix_sgx_abi::*; -use ptr::NonNull; -use num::NonZeroU64; +use crate::ptr::NonNull; +use crate::num::NonZeroU64; #[repr(C)] struct UsercallReturn(u64, u64); @@ -35,7 +35,7 @@ pub unsafe fn do_usercall(nr: NonZeroU64, p1: u64, p2: u64, p3: u64, p4: u64, ab type Register = u64; trait RegisterArgument { - fn from_register(Register) -> Self; + fn from_register(_: Register) -> Self; fn into_register(self) -> Register; } diff --git a/src/libstd/sys/sgx/alloc.rs b/src/libstd/sys/sgx/alloc.rs index 95284190bddc..94dc8ec25b58 100644 --- a/src/libstd/sys/sgx/alloc.rs +++ b/src/libstd/sys/sgx/alloc.rs @@ -1,6 +1,4 @@ -extern crate dlmalloc; - -use alloc::{GlobalAlloc, Layout, System}; +use crate::alloc::{GlobalAlloc, Layout, System}; use super::waitqueue::SpinMutex; diff --git a/src/libstd/sys/sgx/args.rs b/src/libstd/sys/sgx/args.rs index bc138a64019a..b73bf9213b77 100644 --- a/src/libstd/sys/sgx/args.rs +++ b/src/libstd/sys/sgx/args.rs @@ -1,9 +1,9 @@ -use ffi::OsString; use super::abi::usercalls::{alloc, raw::ByteBuffer}; -use sync::atomic::{AtomicUsize, Ordering}; -use sys::os_str::Buf; -use sys_common::FromInner; -use slice; +use crate::ffi::OsString; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::sys::os_str::Buf; +use crate::sys_common::FromInner; +use crate::slice; static ARGS: AtomicUsize = AtomicUsize::new(0); type ArgsStore = Vec; diff --git a/src/libstd/sys/sgx/backtrace.rs b/src/libstd/sys/sgx/backtrace.rs index 2b8e1da05791..d0361574e39d 100644 --- a/src/libstd/sys/sgx/backtrace.rs +++ b/src/libstd/sys/sgx/backtrace.rs @@ -1,9 +1,10 @@ -use io; -use error::Error; -use libc; -use sys_common::backtrace::Frame; +use crate::io; +use crate::error::Error; +use crate::fmt; +use crate::sys_common::backtrace::Frame; +use crate::sys::sgx::abi::mem::image_base; + use unwind as uw; -use sys::sgx::abi::mem::image_base; pub struct BacktraceContext; @@ -21,8 +22,8 @@ impl Error for UnwindError { } } -impl ::fmt::Display for UnwindError { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { +impl fmt::Display for UnwindError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}: {:?}", self.description(), self.0) } } diff --git a/src/libstd/sys/sgx/condvar.rs b/src/libstd/sys/sgx/condvar.rs index b42e5490c72d..e9a7684f74d0 100644 --- a/src/libstd/sys/sgx/condvar.rs +++ b/src/libstd/sys/sgx/condvar.rs @@ -1,5 +1,5 @@ -use sys::mutex::Mutex; -use time::Duration; +use crate::sys::mutex::Mutex; +use crate::time::Duration; use super::waitqueue::{WaitVariable, WaitQueue, SpinMutex}; diff --git a/src/libstd/sys/sgx/ext/arch.rs b/src/libstd/sys/sgx/ext/arch.rs index 97f7d9181a53..53fb371947a9 100644 --- a/src/libstd/sys/sgx/ext/arch.rs +++ b/src/libstd/sys/sgx/ext/arch.rs @@ -4,7 +4,7 @@ //! Software Developer's Manual, Volume 3, Chapter 40. #![unstable(feature = "sgx_platform", issue = "56975")] -use mem::MaybeUninit; +use crate::mem::MaybeUninit; /// Wrapper struct to force 16-byte alignment. #[repr(align(16))] diff --git a/src/libstd/sys/sgx/ext/ffi.rs b/src/libstd/sys/sgx/ext/ffi.rs index 7b0ffea49ae7..ad7ade9b17d8 100644 --- a/src/libstd/sys/sgx/ext/ffi.rs +++ b/src/libstd/sys/sgx/ext/ffi.rs @@ -2,10 +2,10 @@ #![unstable(feature = "sgx_platform", issue = "56975")] -use ffi::{OsStr, OsString}; -use mem; -use sys::os_str::Buf; -use sys_common::{FromInner, IntoInner, AsInner}; +use crate::ffi::{OsStr, OsString}; +use crate::mem; +use crate::sys::os_str::Buf; +use crate::sys_common::{FromInner, IntoInner, AsInner}; /// SGX-specific extensions to [`OsString`]. /// diff --git a/src/libstd/sys/sgx/ext/io.rs b/src/libstd/sys/sgx/ext/io.rs index 1eb269783c5a..fc88d10d3edd 100644 --- a/src/libstd/sys/sgx/ext/io.rs +++ b/src/libstd/sys/sgx/ext/io.rs @@ -4,9 +4,9 @@ //! description of [`TryIntoRawFd`](trait.TryIntoRawFd.html) for more details. #![unstable(feature = "sgx_platform", issue = "56975")] -pub use sys::abi::usercalls::raw::Fd as RawFd; -use net; -use sys::{self, AsInner, FromInner, IntoInner, TryIntoInner}; +pub use crate::sys::abi::usercalls::raw::Fd as RawFd; +use crate::net; +use crate::sys::{self, AsInner, FromInner, IntoInner, TryIntoInner}; /// A trait to extract the raw SGX file descriptor from an underlying /// object. diff --git a/src/libstd/sys/sgx/fd.rs b/src/libstd/sys/sgx/fd.rs index 69077728b1a9..a9924f55f12b 100644 --- a/src/libstd/sys/sgx/fd.rs +++ b/src/libstd/sys/sgx/fd.rs @@ -1,8 +1,8 @@ use fortanix_sgx_abi::Fd; -use io; -use mem; -use sys::{AsInner, FromInner, IntoInner}; +use crate::io; +use crate::mem; +use crate::sys::{AsInner, FromInner, IntoInner}; use super::abi::usercalls; #[derive(Debug)] diff --git a/src/libstd/sys/sgx/fs.rs b/src/libstd/sys/sgx/fs.rs index 8b1c4476bc41..485d2c87fbd2 100644 --- a/src/libstd/sys/sgx/fs.rs +++ b/src/libstd/sys/sgx/fs.rs @@ -1,10 +1,10 @@ -use ffi::OsString; -use fmt; -use hash::{Hash, Hasher}; -use io::{self, SeekFrom}; -use path::{Path, PathBuf}; -use sys::time::SystemTime; -use sys::{unsupported, Void}; +use crate::ffi::OsString; +use crate::fmt; +use crate::hash::{Hash, Hasher}; +use crate::io::{self, SeekFrom}; +use crate::path::{Path, PathBuf}; +use crate::sys::time::SystemTime; +use crate::sys::{unsupported, Void}; pub struct File(Void); diff --git a/src/libstd/sys/sgx/mod.rs b/src/libstd/sys/sgx/mod.rs index 403dd61187fc..325df7688f37 100644 --- a/src/libstd/sys/sgx/mod.rs +++ b/src/libstd/sys/sgx/mod.rs @@ -3,8 +3,9 @@ //! This module contains the facade (aka platform-specific) implementations of //! OS level functionality for Fortanix SGX. -use os::raw::c_char; -use sync::atomic::{AtomicBool, Ordering}; +use crate::io::ErrorKind; +use crate::os::raw::c_char; +use crate::sync::atomic::{AtomicBool, Ordering}; pub mod abi; mod waitqueue; @@ -41,12 +42,12 @@ pub fn init() { /// This function is used to implement functionality that simply doesn't exist. /// Programs relying on this functionality will need to deal with the error. -pub fn unsupported() -> ::io::Result { +pub fn unsupported() -> crate::io::Result { Err(unsupported_err()) } -pub fn unsupported_err() -> ::io::Error { - ::io::Error::new(::io::ErrorKind::Other, +pub fn unsupported_err() -> crate::io::Error { + crate::io::Error::new(ErrorKind::Other, "operation not supported on SGX yet") } @@ -55,58 +56,58 @@ pub fn unsupported_err() -> ::io::Error { /// returned, the program might very well be able to function normally. This is /// what happens when `SGX_INEFFECTIVE_ERROR` is set to `true`. If it is /// `false`, the behavior is the same as `unsupported`. -pub fn sgx_ineffective(v: T) -> ::io::Result { +pub fn sgx_ineffective(v: T) -> crate::io::Result { static SGX_INEFFECTIVE_ERROR: AtomicBool = AtomicBool::new(false); if SGX_INEFFECTIVE_ERROR.load(Ordering::Relaxed) { - Err(::io::Error::new(::io::ErrorKind::Other, + Err(crate::io::Error::new(ErrorKind::Other, "operation can't be trusted to have any effect on SGX")) } else { Ok(v) } } -pub fn decode_error_kind(code: i32) -> ::io::ErrorKind { +pub fn decode_error_kind(code: i32) -> ErrorKind { use fortanix_sgx_abi::Error; // FIXME: not sure how to make sure all variants of Error are covered if code == Error::NotFound as _ { - ::io::ErrorKind::NotFound + ErrorKind::NotFound } else if code == Error::PermissionDenied as _ { - ::io::ErrorKind::PermissionDenied + ErrorKind::PermissionDenied } else if code == Error::ConnectionRefused as _ { - ::io::ErrorKind::ConnectionRefused + ErrorKind::ConnectionRefused } else if code == Error::ConnectionReset as _ { - ::io::ErrorKind::ConnectionReset + ErrorKind::ConnectionReset } else if code == Error::ConnectionAborted as _ { - ::io::ErrorKind::ConnectionAborted + ErrorKind::ConnectionAborted } else if code == Error::NotConnected as _ { - ::io::ErrorKind::NotConnected + ErrorKind::NotConnected } else if code == Error::AddrInUse as _ { - ::io::ErrorKind::AddrInUse + ErrorKind::AddrInUse } else if code == Error::AddrNotAvailable as _ { - ::io::ErrorKind::AddrNotAvailable + ErrorKind::AddrNotAvailable } else if code == Error::BrokenPipe as _ { - ::io::ErrorKind::BrokenPipe + ErrorKind::BrokenPipe } else if code == Error::AlreadyExists as _ { - ::io::ErrorKind::AlreadyExists + ErrorKind::AlreadyExists } else if code == Error::WouldBlock as _ { - ::io::ErrorKind::WouldBlock + ErrorKind::WouldBlock } else if code == Error::InvalidInput as _ { - ::io::ErrorKind::InvalidInput + ErrorKind::InvalidInput } else if code == Error::InvalidData as _ { - ::io::ErrorKind::InvalidData + ErrorKind::InvalidData } else if code == Error::TimedOut as _ { - ::io::ErrorKind::TimedOut + ErrorKind::TimedOut } else if code == Error::WriteZero as _ { - ::io::ErrorKind::WriteZero + ErrorKind::WriteZero } else if code == Error::Interrupted as _ { - ::io::ErrorKind::Interrupted + ErrorKind::Interrupted } else if code == Error::Other as _ { - ::io::ErrorKind::Other + ErrorKind::Other } else if code == Error::UnexpectedEof as _ { - ::io::ErrorKind::UnexpectedEof + ErrorKind::UnexpectedEof } else { - ::io::ErrorKind::Other + ErrorKind::Other } } @@ -131,9 +132,9 @@ pub unsafe fn abort_internal() -> ! { pub fn hashmap_random_keys() -> (u64, u64) { fn rdrand64() -> u64 { unsafe { - let mut ret: u64 = ::mem::uninitialized(); + let mut ret: u64 = crate::mem::uninitialized(); for _ in 0..10 { - if ::arch::x86_64::_rdrand64_step(&mut ret) == 1 { + if crate::arch::x86_64::_rdrand64_step(&mut ret) == 1 { return ret; } } @@ -143,7 +144,7 @@ pub fn hashmap_random_keys() -> (u64, u64) { (rdrand64(), rdrand64()) } -pub use sys_common::{AsInner, FromInner, IntoInner}; +pub use crate::sys_common::{AsInner, FromInner, IntoInner}; pub trait TryIntoInner: Sized { fn try_into_inner(self) -> Result; diff --git a/src/libstd/sys/sgx/net.rs b/src/libstd/sys/sgx/net.rs index c4c2de43ff7d..ab8b2681393f 100644 --- a/src/libstd/sys/sgx/net.rs +++ b/src/libstd/sys/sgx/net.rs @@ -1,12 +1,12 @@ -use fmt; -use io::{self, IoVec, IoVecMut}; -use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr, ToSocketAddrs}; -use time::Duration; -use sys::{unsupported, Void, sgx_ineffective, AsInner, FromInner, IntoInner, TryIntoInner}; -use sys::fd::FileDesc; -use convert::TryFrom; -use error; -use sync::Arc; +use crate::fmt; +use crate::io::{self, IoVec, IoVecMut}; +use crate::net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr, ToSocketAddrs}; +use crate::time::Duration; +use crate::sys::{unsupported, Void, sgx_ineffective, AsInner, FromInner, IntoInner, TryIntoInner}; +use crate::sys::fd::FileDesc; +use crate::convert::TryFrom; +use crate::error; +use crate::sync::Arc; use super::abi::usercalls; diff --git a/src/libstd/sys/sgx/os.rs b/src/libstd/sys/sgx/os.rs index b1e4d371a677..2725e66ce5de 100644 --- a/src/libstd/sys/sgx/os.rs +++ b/src/libstd/sys/sgx/os.rs @@ -1,17 +1,17 @@ use fortanix_sgx_abi::{Error, RESULT_SUCCESS}; -use error::Error as StdError; -use ffi::{OsString, OsStr}; -use fmt; -use io; -use path::{self, PathBuf}; -use str; -use sys::{unsupported, Void, sgx_ineffective, decode_error_kind}; -use collections::HashMap; -use vec; -use sync::Mutex; -use sync::atomic::{AtomicUsize, Ordering}; -use sync::Once; +use crate::error::Error as StdError; +use crate::ffi::{OsString, OsStr}; +use crate::fmt; +use crate::io; +use crate::path::{self, PathBuf}; +use crate::str; +use crate::sys::{unsupported, Void, sgx_ineffective, decode_error_kind}; +use crate::collections::HashMap; +use crate::vec; +use crate::sync::Mutex; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::sync::Once; pub fn errno() -> i32 { RESULT_SUCCESS diff --git a/src/libstd/sys/sgx/os_str.rs b/src/libstd/sys/sgx/os_str.rs index 9d5e084feb2d..79b43458d00f 100644 --- a/src/libstd/sys/sgx/os_str.rs +++ b/src/libstd/sys/sgx/os_str.rs @@ -1,14 +1,15 @@ /// The underlying OsString/OsStr implementation on Unix systems: just /// a `Vec`/`[u8]`. -use borrow::Cow; -use fmt; -use str; -use mem; -use rc::Rc; -use sync::Arc; -use sys_common::{AsInner, IntoInner}; -use sys_common::bytestring::debug_fmt_bytestring; +use crate::borrow::Cow; +use crate::fmt; +use crate::str; +use crate::mem; +use crate::rc::Rc; +use crate::sync::Arc; +use crate::sys_common::{AsInner, IntoInner}; +use crate::sys_common::bytestring::debug_fmt_bytestring; + use core::str::lossy::Utf8Lossy; #[derive(Clone, Hash)] diff --git a/src/libstd/sys/sgx/path.rs b/src/libstd/sys/sgx/path.rs index 90b1fa7c97b9..1115de1fbe5b 100644 --- a/src/libstd/sys/sgx/path.rs +++ b/src/libstd/sys/sgx/path.rs @@ -1,5 +1,5 @@ -use path::Prefix; -use ffi::OsStr; +use crate::path::Prefix; +use crate::ffi::OsStr; #[inline] pub fn is_sep_byte(b: u8) -> bool { diff --git a/src/libstd/sys/sgx/pipe.rs b/src/libstd/sys/sgx/pipe.rs index ac48a6dc0332..2582b993b608 100644 --- a/src/libstd/sys/sgx/pipe.rs +++ b/src/libstd/sys/sgx/pipe.rs @@ -1,5 +1,5 @@ -use io; -use sys::Void; +use crate::io; +use crate::sys::Void; pub struct AnonPipe(Void); diff --git a/src/libstd/sys/sgx/process.rs b/src/libstd/sys/sgx/process.rs index 5357d931c736..c49daaa16320 100644 --- a/src/libstd/sys/sgx/process.rs +++ b/src/libstd/sys/sgx/process.rs @@ -1,10 +1,10 @@ -use ffi::OsStr; -use fmt; -use io; -use sys::fs::File; -use sys::pipe::AnonPipe; -use sys::{unsupported, Void}; -use sys_common::process::{CommandEnv, DefaultEnvKey}; +use crate::ffi::OsStr; +use crate::fmt; +use crate::io; +use crate::sys::fs::File; +use crate::sys::pipe::AnonPipe; +use crate::sys::{unsupported, Void}; +use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; //////////////////////////////////////////////////////////////////////////////// // Command diff --git a/src/libstd/sys/sgx/rwlock.rs b/src/libstd/sys/sgx/rwlock.rs index 4dfbe86d14f4..372760bbf26b 100644 --- a/src/libstd/sys/sgx/rwlock.rs +++ b/src/libstd/sys/sgx/rwlock.rs @@ -1,12 +1,12 @@ -use alloc::{self, Layout}; -use num::NonZeroUsize; -use slice; -use str; +use crate::alloc::{self, Layout}; +use crate::num::NonZeroUsize; +use crate::slice; +use crate::str; use super::waitqueue::{ try_lock_or_false, NotifiedTcs, SpinMutex, SpinMutexGuard, WaitQueue, WaitVariable, }; -use mem; +use crate::mem; pub struct RWLock { readers: SpinMutex>>, @@ -206,7 +206,7 @@ pub unsafe extern "C" fn __rust_print_err(m: *mut u8, s: i32) { #[no_mangle] // NB. used by both libunwind and libpanic_abort pub unsafe extern "C" fn __rust_abort() { - ::sys::abort_internal(); + crate::sys::abort_internal(); } #[no_mangle] @@ -224,8 +224,8 @@ mod tests { use super::*; use core::array::FixedSizeArray; - use mem::MaybeUninit; - use {mem, ptr}; + use crate::mem::MaybeUninit; + use crate::{mem, ptr}; // The below test verifies that the bytes of initialized RWLock are the ones // we use in libunwind. diff --git a/src/libstd/sys/sgx/stdio.rs b/src/libstd/sys/sgx/stdio.rs index 57d66ed9a853..f2c6892bfb7f 100644 --- a/src/libstd/sys/sgx/stdio.rs +++ b/src/libstd/sys/sgx/stdio.rs @@ -1,7 +1,7 @@ use fortanix_sgx_abi as abi; -use io; -use sys::fd::FileDesc; +use crate::io; +use crate::sys::fd::FileDesc; pub struct Stdin(()); pub struct Stdout(()); @@ -52,7 +52,7 @@ impl io::Write for Stderr { } } -pub const STDIN_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; +pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE; pub fn is_ebadf(err: &io::Error) -> bool { // FIXME: Rust normally maps Unix EBADF to `Other` diff --git a/src/libstd/sys/sgx/thread.rs b/src/libstd/sys/sgx/thread.rs index b4bdb03e61af..13569062ac18 100644 --- a/src/libstd/sys/sgx/thread.rs +++ b/src/libstd/sys/sgx/thread.rs @@ -1,7 +1,7 @@ -use boxed::FnBox; -use ffi::CStr; -use io; -use time::Duration; +use crate::boxed::FnBox; +use crate::ffi::CStr; +use crate::io; +use crate::time::Duration; use super::abi::usercalls; @@ -10,9 +10,9 @@ pub struct Thread(task_queue::JoinHandle); pub const DEFAULT_MIN_STACK_SIZE: usize = 4096; mod task_queue { - use sync::{Mutex, MutexGuard, Once}; - use sync::mpsc; - use boxed::FnBox; + use crate::sync::{Mutex, MutexGuard, Once}; + use crate::sync::mpsc; + use crate::boxed::FnBox; pub type JoinHandle = mpsc::Receiver<()>; diff --git a/src/libstd/sys/sgx/time.rs b/src/libstd/sys/sgx/time.rs index 407fe72b0e62..e4f789c3e365 100644 --- a/src/libstd/sys/sgx/time.rs +++ b/src/libstd/sys/sgx/time.rs @@ -1,4 +1,4 @@ -use time::Duration; +use crate::time::Duration; use super::abi::usercalls; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] diff --git a/src/libstd/sys/sgx/waitqueue.rs b/src/libstd/sys/sgx/waitqueue.rs index aec643b3175b..1dbf2afbf498 100644 --- a/src/libstd/sys/sgx/waitqueue.rs +++ b/src/libstd/sys/sgx/waitqueue.rs @@ -10,8 +10,8 @@ /// recorded in the enclave. The wakeup event state is protected by a spinlock. /// The queue and associated wait state are stored in a `WaitVariable`. -use ops::{Deref, DerefMut}; -use num::NonZeroUsize; +use crate::ops::{Deref, DerefMut}; +use crate::num::NonZeroUsize; use fortanix_sgx_abi::{Tcs, EV_UNPARK, WAIT_INDEFINITE}; use super::abi::usercalls; @@ -211,8 +211,8 @@ impl WaitQueue { /// A doubly-linked list where callers are in charge of memory allocation /// of the nodes in the list. mod unsafe_list { - use ptr::NonNull; - use mem; + use crate::ptr::NonNull; + use crate::mem; pub struct UnsafeListEntry { next: NonNull>, @@ -341,7 +341,7 @@ mod unsafe_list { #[cfg(test)] mod tests { use super::*; - use cell::Cell; + use crate::cell::Cell; unsafe fn assert_empty(list: &mut UnsafeList) { assert!(list.pop().is_none(), "assertion failed: list is not empty"); @@ -404,9 +404,9 @@ mod unsafe_list { /// Trivial spinlock-based implementation of `sync::Mutex`. // FIXME: Perhaps use Intel TSX to avoid locking? mod spin_mutex { - use cell::UnsafeCell; - use sync::atomic::{AtomicBool, Ordering, spin_loop_hint}; - use ops::{Deref, DerefMut}; + use crate::cell::UnsafeCell; + use crate::sync::atomic::{AtomicBool, Ordering, spin_loop_hint}; + use crate::ops::{Deref, DerefMut}; #[derive(Default)] pub struct SpinMutex { @@ -496,8 +496,8 @@ mod spin_mutex { #![allow(deprecated)] use super::*; - use sync::Arc; - use thread; + use crate::sync::Arc; + use crate::thread; #[test] fn sleep() { @@ -519,8 +519,8 @@ mod spin_mutex { #[cfg(test)] mod tests { use super::*; - use sync::Arc; - use thread; + use crate::sync::Arc; + use crate::thread; #[test] fn queue() { diff --git a/src/libstd/sys/unix/alloc.rs b/src/libstd/sys/unix/alloc.rs index 93e8e0e66967..8e8f5017da75 100644 --- a/src/libstd/sys/unix/alloc.rs +++ b/src/libstd/sys/unix/alloc.rs @@ -1,7 +1,6 @@ -use ptr; -use libc; -use sys_common::alloc::{MIN_ALIGN, realloc_fallback}; -use alloc::{GlobalAlloc, Layout, System}; +use crate::ptr; +use crate::sys_common::alloc::{MIN_ALIGN, realloc_fallback}; +use crate::alloc::{GlobalAlloc, Layout, System}; #[stable(feature = "alloc_system_type", since = "1.28.0")] unsafe impl GlobalAlloc for System { diff --git a/src/libstd/sys/unix/android.rs b/src/libstd/sys/unix/android.rs index 986fa27ede66..6774160bb256 100644 --- a/src/libstd/sys/unix/android.rs +++ b/src/libstd/sys/unix/android.rs @@ -21,7 +21,7 @@ use libc::{c_int, c_void, sighandler_t, size_t, ssize_t}; use libc::{ftruncate, pread, pwrite}; -use io; +use crate::io; use super::{cvt, cvt_r}; // The `log2` and `log2f` functions apparently appeared in android-18, or at @@ -49,12 +49,12 @@ use super::{cvt, cvt_r}; #[cfg(not(test))] pub fn log2f32(f: f32) -> f32 { - f.ln() * ::f32::consts::LOG2_E + f.ln() * crate::f32::consts::LOG2_E } #[cfg(not(test))] pub fn log2f64(f: f64) -> f64 { - f.ln() * ::f64::consts::LOG2_E + f.ln() * crate::f64::consts::LOG2_E } // Back in the day [1] the `signal` function was just an inline wrapper @@ -117,7 +117,7 @@ pub fn ftruncate64(fd: c_int, size: u64) -> io::Result<()> { pub unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: size_t, offset: i64) -> io::Result { - use convert::TryInto; + use crate::convert::TryInto; weak!(fn pread64(c_int, *mut c_void, size_t, i64) -> ssize_t); pread64.get().map(|f| cvt(f(fd, buf, count, offset))).unwrap_or_else(|| { if let Ok(o) = offset.try_into() { @@ -133,7 +133,7 @@ pub unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: size_t, offset: i6 pub unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: size_t, offset: i64) -> io::Result { - use convert::TryInto; + use crate::convert::TryInto; weak!(fn pwrite64(c_int, *const c_void, size_t, i64) -> ssize_t); pwrite64.get().map(|f| cvt(f(fd, buf, count, offset))).unwrap_or_else(|| { if let Ok(o) = offset.try_into() { diff --git a/src/libstd/sys/unix/args.rs b/src/libstd/sys/unix/args.rs index db1c5f4fea54..18de1096df2a 100644 --- a/src/libstd/sys/unix/args.rs +++ b/src/libstd/sys/unix/args.rs @@ -5,9 +5,9 @@ #![allow(dead_code)] // runtime init functions not used during testing -use ffi::OsString; -use marker::PhantomData; -use vec; +use crate::ffi::OsString; +use crate::marker::PhantomData; +use crate::vec; /// One-time global initialization. pub unsafe fn init(argc: isize, argv: *const *const u8) { imp::init(argc, argv) } @@ -59,14 +59,13 @@ impl DoubleEndedIterator for Args { target_os = "fuchsia", target_os = "hermit"))] mod imp { - use os::unix::prelude::*; - use ptr; - use ffi::{CStr, OsString}; - use marker::PhantomData; - use libc; + use crate::os::unix::prelude::*; + use crate::ptr; + use crate::ffi::{CStr, OsString}; + use crate::marker::PhantomData; use super::Args; - use sys_common::mutex::Mutex; + use crate::sys_common::mutex::Mutex; static mut ARGC: isize = 0; static mut ARGV: *const *const u8 = ptr::null(); @@ -107,9 +106,8 @@ mod imp { #[cfg(any(target_os = "macos", target_os = "ios"))] mod imp { - use ffi::CStr; - use marker::PhantomData; - use libc; + use crate::ffi::CStr; + use crate::marker::PhantomData; use super::Args; pub unsafe fn init(_argc: isize, _argv: *const *const u8) { @@ -120,7 +118,7 @@ mod imp { #[cfg(target_os = "macos")] pub fn args() -> Args { - use os::unix::prelude::*; + use crate::os::unix::prelude::*; extern { // These functions are in crt_externs.h. fn _NSGetArgc() -> *mut libc::c_int; @@ -155,9 +153,9 @@ mod imp { // res #[cfg(target_os = "ios")] pub fn args() -> Args { - use ffi::OsString; - use mem; - use str; + use crate::ffi::OsString; + use crate::mem; + use crate::str; extern { fn sel_registerName(name: *const libc::c_uchar) -> Sel; diff --git a/src/libstd/sys/unix/backtrace/mod.rs b/src/libstd/sys/unix/backtrace/mod.rs index 79c3e39d8f8d..0887e5a4df93 100644 --- a/src/libstd/sys/unix/backtrace/mod.rs +++ b/src/libstd/sys/unix/backtrace/mod.rs @@ -83,8 +83,9 @@ mod printing; #[cfg(not(target_os = "emscripten"))] pub mod gnu { - use io; - use fs; + use crate::io; + use crate::fs; + use libc::c_char; #[cfg(not(any(target_os = "macos", target_os = "ios")))] @@ -94,8 +95,8 @@ pub mod gnu { #[cfg(any(target_os = "macos", target_os = "ios"))] pub fn get_executable_filename() -> io::Result<(Vec, fs::File)> { - use env; - use os::unix::ffi::OsStrExt; + use crate::env; + use crate::os::unix::ffi::OsStrExt; let filename = env::current_exe()?; let file = fs::File::open(&filename)?; diff --git a/src/libstd/sys/unix/backtrace/printing/dladdr.rs b/src/libstd/sys/unix/backtrace/printing/dladdr.rs index 09715db8c1a3..cf3bda640e92 100644 --- a/src/libstd/sys/unix/backtrace/printing/dladdr.rs +++ b/src/libstd/sys/unix/backtrace/printing/dladdr.rs @@ -1,9 +1,8 @@ -use io; -use intrinsics; -use ffi::CStr; -use libc; -use sys::backtrace::BacktraceContext; -use sys_common::backtrace::Frame; +use crate::io; +use crate::intrinsics; +use crate::ffi::CStr; +use crate::sys::backtrace::BacktraceContext; +use crate::sys_common::backtrace::Frame; pub fn resolve_symname(frame: Frame, callback: F, diff --git a/src/libstd/sys/unix/backtrace/printing/mod.rs b/src/libstd/sys/unix/backtrace/printing/mod.rs index d0303e6995f8..d090caede437 100644 --- a/src/libstd/sys/unix/backtrace/printing/mod.rs +++ b/src/libstd/sys/unix/backtrace/printing/mod.rs @@ -1,8 +1,8 @@ mod dladdr; -use sys::backtrace::BacktraceContext; -use sys_common::backtrace::Frame; -use io; +use crate::sys::backtrace::BacktraceContext; +use crate::sys_common::backtrace::Frame; +use crate::io; #[cfg(target_os = "emscripten")] pub use self::dladdr::resolve_symname; @@ -16,14 +16,14 @@ where } #[cfg(not(target_os = "emscripten"))] -pub use sys_common::gnu::libbacktrace::foreach_symbol_fileline; +pub use crate::sys_common::gnu::libbacktrace::foreach_symbol_fileline; #[cfg(not(target_os = "emscripten"))] pub fn resolve_symname(frame: Frame, callback: F, bc: &BacktraceContext) -> io::Result<()> where F: FnOnce(Option<&str>) -> io::Result<()> { - ::sys_common::gnu::libbacktrace::resolve_symname(frame, |symname| { + crate::sys_common::gnu::libbacktrace::resolve_symname(frame, |symname| { if symname.is_some() { callback(symname) } else { diff --git a/src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs b/src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs index 236762c5eb5d..a628d107ad6f 100644 --- a/src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs +++ b/src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs @@ -8,10 +8,10 @@ /// simple to use it should be used only on iOS devices as the only viable /// option. -use io; -use libc; -use sys::backtrace::BacktraceContext; -use sys_common::backtrace::Frame; +use crate::io; +use crate::ptr; +use crate::sys::backtrace::BacktraceContext; +use crate::sys_common::backtrace::Frame; #[inline(never)] // if we know this is a function call, we can skip it when // tracing @@ -20,7 +20,7 @@ pub fn unwind_backtrace(frames: &mut [Frame]) { const FRAME_LEN: usize = 100; assert!(FRAME_LEN >= frames.len()); - let mut raw_frames = [::ptr::null_mut(); FRAME_LEN]; + let mut raw_frames = [ptr::null_mut(); FRAME_LEN]; let nb_frames = unsafe { backtrace(raw_frames.as_mut_ptr(), raw_frames.len() as libc::c_int) } as usize; diff --git a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs index 72a7968c514c..abbeca0fde6e 100644 --- a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs +++ b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs @@ -1,8 +1,8 @@ -use error::Error; -use io; -use libc; -use sys::backtrace::BacktraceContext; -use sys_common::backtrace::Frame; +use crate::error::Error; +use crate::fmt; +use crate::io; +use crate::sys::backtrace::BacktraceContext; +use crate::sys_common::backtrace::Frame; use unwind as uw; @@ -20,8 +20,8 @@ impl Error for UnwindError { } } -impl ::fmt::Display for UnwindError { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { +impl fmt::Display for UnwindError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}: {:?}", self.description(), self.0) } } diff --git a/src/libstd/sys/unix/condvar.rs b/src/libstd/sys/unix/condvar.rs index 3e048d5c6e4f..47fb6792f08a 100644 --- a/src/libstd/sys/unix/condvar.rs +++ b/src/libstd/sys/unix/condvar.rs @@ -1,7 +1,6 @@ -use cell::UnsafeCell; -use libc; -use sys::mutex::{self, Mutex}; -use time::Duration; +use crate::cell::UnsafeCell; +use crate::sys::mutex::{self, Mutex}; +use crate::time::Duration; pub struct Condvar { inner: UnsafeCell } @@ -41,7 +40,7 @@ impl Condvar { target_os = "android", target_os = "hermit")))] pub unsafe fn init(&mut self) { - use mem; + use crate::mem; let mut attr: libc::pthread_condattr_t = mem::uninitialized(); let r = libc::pthread_condattr_init(&mut attr); assert_eq!(r, 0); @@ -80,7 +79,7 @@ impl Condvar { target_os = "android", target_os = "hermit")))] pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool { - use mem; + use crate::mem; let mut now: libc::timespec = mem::zeroed(); let r = libc::clock_gettime(libc::CLOCK_MONOTONIC, &mut now); @@ -110,8 +109,8 @@ impl Condvar { // https://github.com/llvm-mirror/libcxx/blob/release_35/include/__mutex_base#L367 #[cfg(any(target_os = "macos", target_os = "ios", target_os = "android", target_os = "hermit"))] pub unsafe fn wait_timeout(&self, mutex: &Mutex, mut dur: Duration) -> bool { - use ptr; - use time::Instant; + use crate::ptr; + use crate::time::Instant; // 1000 years let max_dur = Duration::from_secs(1000 * 365 * 86400); diff --git a/src/libstd/sys/unix/ext/ffi.rs b/src/libstd/sys/unix/ext/ffi.rs index d1c3cd82ac51..0c0232398152 100644 --- a/src/libstd/sys/unix/ext/ffi.rs +++ b/src/libstd/sys/unix/ext/ffi.rs @@ -2,10 +2,10 @@ #![stable(feature = "rust1", since = "1.0.0")] -use ffi::{OsStr, OsString}; -use mem; -use sys::os_str::Buf; -use sys_common::{FromInner, IntoInner, AsInner}; +use crate::ffi::{OsStr, OsString}; +use crate::mem; +use crate::sys::os_str::Buf; +use crate::sys_common::{FromInner, IntoInner, AsInner}; /// Unix-specific extensions to [`OsString`]. /// diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index abcce3ab8296..d9baac993c42 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -2,13 +2,12 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs::{self, Permissions, OpenOptions}; -use io; -use libc; -use path::Path; -use sys; -use sys_common::{FromInner, AsInner, AsInnerMut}; -use sys::platform::fs::MetadataExt as UnixMetadataExt; +use crate::fs::{self, Permissions, OpenOptions}; +use crate::io; +use crate::path::Path; +use crate::sys; +use crate::sys_common::{FromInner, AsInner, AsInnerMut}; +use crate::sys::platform::fs::MetadataExt as UnixMetadataExt; /// Unix-specific extensions to [`File`]. /// diff --git a/src/libstd/sys/unix/ext/io.rs b/src/libstd/sys/unix/ext/io.rs index 73f4879e4e43..1a0b3b8962bd 100644 --- a/src/libstd/sys/unix/ext/io.rs +++ b/src/libstd/sys/unix/ext/io.rs @@ -2,12 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs; -use os::raw; -use sys; -use io; -use sys_common::{AsInner, FromInner, IntoInner}; -use libc; +use crate::fs; +use crate::os::raw; +use crate::sys; +use crate::io; +use crate::sys_common::{AsInner, FromInner, IntoInner}; /// Raw file descriptors. #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs index 4b60ea654c1f..4fc79efe7ceb 100644 --- a/src/libstd/sys/unix/ext/net.rs +++ b/src/libstd/sys/unix/ext/net.rs @@ -15,19 +15,19 @@ mod libc { pub struct sockaddr_un; } -use ascii; -use ffi::OsStr; -use fmt; -use io::{self, Initializer, IoVec, IoVecMut}; -use mem; -use net::{self, Shutdown}; -use os::unix::ffi::OsStrExt; -use os::unix::io::{RawFd, AsRawFd, FromRawFd, IntoRawFd}; -use path::Path; -use time::Duration; -use sys::{self, cvt}; -use sys::net::Socket; -use sys_common::{self, AsInner, FromInner, IntoInner}; +use crate::ascii; +use crate::ffi::OsStr; +use crate::fmt; +use crate::io::{self, Initializer, IoVec, IoVecMut}; +use crate::mem; +use crate::net::{self, Shutdown}; +use crate::os::unix::ffi::OsStrExt; +use crate::os::unix::io::{RawFd, AsRawFd, FromRawFd, IntoRawFd}; +use crate::path::Path; +use crate::time::Duration; +use crate::sys::{self, cvt}; +use crate::sys::net::Socket; +use crate::sys_common::{self, AsInner, FromInner, IntoInner}; #[cfg(any(target_os = "linux", target_os = "android", target_os = "dragonfly", target_os = "freebsd", @@ -1481,11 +1481,11 @@ impl IntoRawFd for UnixDatagram { #[cfg(all(test, not(target_os = "emscripten")))] mod test { - use thread; - use io::{self, ErrorKind}; - use io::prelude::*; - use time::Duration; - use sys_common::io::test::tmpdir; + use crate::thread; + use crate::io::{self, ErrorKind}; + use crate::io::prelude::*; + use crate::time::Duration; + use crate::sys_common::io::test::tmpdir; use super::*; diff --git a/src/libstd/sys/unix/ext/process.rs b/src/libstd/sys/unix/ext/process.rs index b487bb889baf..7ace95edef9f 100644 --- a/src/libstd/sys/unix/ext/process.rs +++ b/src/libstd/sys/unix/ext/process.rs @@ -2,11 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use io; -use os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd}; -use process; -use sys; -use sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; +use crate::io; +use crate::os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd}; +use crate::process; +use crate::sys; +use crate::sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; /// Unix-specific extensions to the [`process::Command`] builder. /// @@ -209,5 +209,5 @@ impl IntoRawFd for process::ChildStderr { /// Returns the OS-assigned process identifier associated with this process's parent. #[stable(feature = "unix_ppid", since = "1.27.0")] pub fn parent_id() -> u32 { - ::sys::os::getppid() + crate::sys::os::getppid() } diff --git a/src/libstd/sys/unix/ext/raw.rs b/src/libstd/sys/unix/ext/raw.rs index eabb4b025030..75ae54a919ab 100644 --- a/src/libstd/sys/unix/ext/raw.rs +++ b/src/libstd/sys/unix/ext/raw.rs @@ -14,10 +14,10 @@ #[doc(inline)] #[stable(feature = "pthread_t", since = "1.8.0")] -pub use sys::platform::raw::pthread_t; +pub use crate::sys::platform::raw::pthread_t; #[doc(inline)] #[stable(feature = "raw_ext", since = "1.1.0")] -pub use sys::platform::raw::{dev_t, ino_t, mode_t, nlink_t, off_t, blksize_t}; +pub use crate::sys::platform::raw::{dev_t, ino_t, mode_t, nlink_t, off_t, blksize_t}; #[doc(inline)] #[stable(feature = "raw_ext", since = "1.1.0")] -pub use sys::platform::raw::{blkcnt_t, time_t}; +pub use crate::sys::platform::raw::{blkcnt_t, time_t}; diff --git a/src/libstd/sys/unix/ext/thread.rs b/src/libstd/sys/unix/ext/thread.rs index 4b3d5e31848f..759ef6236e80 100644 --- a/src/libstd/sys/unix/ext/thread.rs +++ b/src/libstd/sys/unix/ext/thread.rs @@ -3,9 +3,9 @@ #![stable(feature = "thread_extensions", since = "1.9.0")] #[allow(deprecated)] -use os::unix::raw::pthread_t; -use sys_common::{AsInner, IntoInner}; -use thread::JoinHandle; +use crate::os::unix::raw::pthread_t; +use crate::sys_common::{AsInner, IntoInner}; +use crate::thread::JoinHandle; #[stable(feature = "thread_extensions", since = "1.9.0")] #[allow(deprecated)] diff --git a/src/libstd/sys/unix/fast_thread_local.rs b/src/libstd/sys/unix/fast_thread_local.rs index 742ffd12b883..17478dce4fe5 100644 --- a/src/libstd/sys/unix/fast_thread_local.rs +++ b/src/libstd/sys/unix/fast_thread_local.rs @@ -12,9 +12,8 @@ // Due to rust-lang/rust#18804, make sure this is not generic! #[cfg(any(target_os = "linux", target_os = "fuchsia", target_os = "hermit"))] pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { - use libc; - use mem; - use sys_common::thread_local::register_dtor_fallback; + use crate::mem; + use crate::sys_common::thread_local::register_dtor_fallback; extern { #[linkage = "extern_weak"] @@ -45,8 +44,8 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { // _tlv_atexit. #[cfg(target_os = "macos")] pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { - use cell::Cell; - use ptr; + use crate::cell::Cell; + use crate::ptr; #[thread_local] static REGISTERED: Cell = Cell::new(false); diff --git a/src/libstd/sys/unix/fd.rs b/src/libstd/sys/unix/fd.rs index 6946b7b5dfa4..c274ad26cb1f 100644 --- a/src/libstd/sys/unix/fd.rs +++ b/src/libstd/sys/unix/fd.rs @@ -1,12 +1,13 @@ #![unstable(reason = "not public", issue = "0", feature = "fd")] -use cmp; -use io::{self, Read, Initializer, IoVec, IoVecMut}; -use libc::{self, c_int, c_void, ssize_t}; -use mem; -use sync::atomic::{AtomicBool, Ordering}; -use sys::cvt; -use sys_common::AsInner; +use crate::cmp; +use crate::io::{self, Read, Initializer, IoVec, IoVecMut}; +use crate::mem; +use crate::sync::atomic::{AtomicBool, Ordering}; +use crate::sys::cvt; +use crate::sys_common::AsInner; + +use libc::{c_int, c_void, ssize_t}; #[derive(Debug)] pub struct FileDesc { @@ -74,7 +75,7 @@ impl FileDesc { unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: usize, offset: i64) -> io::Result { - use convert::TryInto; + use crate::convert::TryInto; use libc::pread64; // pread64 on emscripten actually takes a 32 bit offset if let Ok(o) = offset.try_into() { @@ -131,7 +132,7 @@ impl FileDesc { unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: usize, offset: i64) -> io::Result { - use convert::TryInto; + use crate::convert::TryInto; use libc::pwrite64; // pwrite64 on emscripten actually takes a 32 bit offset if let Ok(o) = offset.try_into() { diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 5183d6fadd21..3b80b475a93d 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -1,17 +1,18 @@ -use os::unix::prelude::*; +use crate::os::unix::prelude::*; -use ffi::{CString, CStr, OsString, OsStr}; -use fmt; -use io::{self, Error, ErrorKind, SeekFrom}; -use libc::{self, c_int, mode_t}; -use mem; -use path::{Path, PathBuf}; -use ptr; -use sync::Arc; -use sys::fd::FileDesc; -use sys::time::SystemTime; -use sys::{cvt, cvt_r}; -use sys_common::{AsInner, FromInner}; +use crate::ffi::{CString, CStr, OsString, OsStr}; +use crate::fmt; +use crate::io::{self, Error, ErrorKind, SeekFrom}; +use crate::mem; +use crate::path::{Path, PathBuf}; +use crate::ptr; +use crate::sync::Arc; +use crate::sys::fd::FileDesc; +use crate::sys::time::SystemTime; +use crate::sys::{cvt, cvt_r}; +use crate::sys_common::{AsInner, FromInner}; + +use libc::{c_int, mode_t}; #[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "l4re"))] use libc::{stat64, fstat64, lstat64, off64_t, ftruncate64, lseek64, dirent64, readdir64_r, open64}; @@ -217,6 +218,8 @@ impl Iterator for ReadDir { #[cfg(any(target_os = "solaris", target_os = "fuchsia"))] fn next(&mut self) -> Option> { + use crate::slice; + unsafe { loop { // Although readdir_r(3) would be a correct function to use here because @@ -239,8 +242,8 @@ impl Iterator for ReadDir { let ret = DirEntry { entry: *entry_ptr, - name: ::slice::from_raw_parts(name as *const u8, - namelen as usize).to_owned().into_boxed_slice(), + name: slice::from_raw_parts(name as *const u8, + namelen as usize).to_owned().into_boxed_slice(), dir: self.clone() }; if ret.name_bytes() != b"." && ret.name_bytes() != b".." { @@ -365,9 +368,10 @@ impl DirEntry { target_os = "dragonfly", target_os = "bitrig"))] fn name_bytes(&self) -> &[u8] { + use crate::slice; unsafe { - ::slice::from_raw_parts(self.entry.d_name.as_ptr() as *const u8, - self.entry.d_namlen as usize) + slice::from_raw_parts(self.entry.d_name.as_ptr() as *const u8, + self.entry.d_namlen as usize) } } #[cfg(any(target_os = "android", @@ -475,7 +479,7 @@ impl File { // that we support, so we only do this on Linux currently. #[cfg(target_os = "linux")] fn ensure_cloexec(fd: &FileDesc) -> io::Result<()> { - use sync::atomic::{AtomicUsize, Ordering}; + use crate::sync::atomic::{AtomicUsize, Ordering}; const OPEN_CLOEXEC_UNKNOWN: usize = 0; const OPEN_CLOEXEC_SUPPORTED: usize = 1; @@ -542,7 +546,7 @@ impl File { pub fn truncate(&self, size: u64) -> io::Result<()> { #[cfg(target_os = "android")] - return ::sys::android::ftruncate64(self.0.raw(), size); + return crate::sys::android::ftruncate64(self.0.raw(), size); #[cfg(not(target_os = "android"))] return cvt_r(|| unsafe { @@ -825,7 +829,7 @@ pub fn canonicalize(p: &Path) -> io::Result { #[cfg(not(any(target_os = "linux", target_os = "android")))] pub fn copy(from: &Path, to: &Path) -> io::Result { - use fs::File; + use crate::fs::File; if !from.is_file() { return Err(Error::new(ErrorKind::InvalidInput, "the source path is not an existing regular file")) @@ -842,9 +846,9 @@ pub fn copy(from: &Path, to: &Path) -> io::Result { #[cfg(any(target_os = "linux", target_os = "android"))] pub fn copy(from: &Path, to: &Path) -> io::Result { - use cmp; - use fs::File; - use sync::atomic::{AtomicBool, Ordering}; + use crate::cmp; + use crate::fs::File; + use crate::sync::atomic::{AtomicBool, Ordering}; // Kernel prior to 4.5 don't have copy_file_range // We store the availability in a global to avoid unnecessary syscalls diff --git a/src/libstd/sys/unix/l4re.rs b/src/libstd/sys/unix/l4re.rs index 4775e29fb570..b6e8cc738946 100644 --- a/src/libstd/sys/unix/l4re.rs +++ b/src/libstd/sys/unix/l4re.rs @@ -4,15 +4,15 @@ macro_rules! unimpl { pub mod net { #![allow(warnings)] - use fmt; - use io::{self, IoVec, IoVecMut}; - use libc; - use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; - use sys_common::{AsInner, FromInner, IntoInner}; - use sys::fd::FileDesc; - use time::Duration; - use convert::TryFrom; + use crate::fmt; + use crate::io::{self, IoVec, IoVecMut}; + use crate::net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; + use crate::sys_common::{AsInner, FromInner, IntoInner}; + use crate::sys::fd::FileDesc; + use crate::time::Duration; + use crate::convert::TryFrom; + #[allow(unused_extern_crates)] pub extern crate libc as netc; pub struct Socket(FileDesc); diff --git a/src/libstd/sys/unix/memchr.rs b/src/libstd/sys/unix/memchr.rs index ec04a22a0d2e..1984678bdde4 100644 --- a/src/libstd/sys/unix/memchr.rs +++ b/src/libstd/sys/unix/memchr.rs @@ -2,8 +2,6 @@ // Copyright 2015 Andrew Gallant, bluss and Nicolas Koch pub fn memchr(needle: u8, haystack: &[u8]) -> Option { - use libc; - let p = unsafe { libc::memchr( haystack.as_ptr() as *const libc::c_void, @@ -21,8 +19,6 @@ pub fn memrchr(needle: u8, haystack: &[u8]) -> Option { #[cfg(target_os = "linux")] fn memrchr_specific(needle: u8, haystack: &[u8]) -> Option { - use libc; - // GNU's memrchr() will - unlike memchr() - error if haystack is empty. if haystack.is_empty() {return None} let p = unsafe { @@ -40,7 +36,7 @@ pub fn memrchr(needle: u8, haystack: &[u8]) -> Option { #[cfg(not(target_os = "linux"))] fn memrchr_specific(needle: u8, haystack: &[u8]) -> Option { - ::core::slice::memchr::memrchr(needle, haystack) + core::slice::memchr::memrchr(needle, haystack) } memrchr_specific(needle, haystack) diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index 0de1a223fbd1..fbe3444311e5 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -1,24 +1,23 @@ #![allow(missing_docs, nonstandard_style)] -use io::ErrorKind; -use libc; +use crate::io::ErrorKind; -#[cfg(any(rustdoc, target_os = "linux"))] pub use os::linux as platform; +#[cfg(any(rustdoc, target_os = "linux"))] pub use crate::os::linux as platform; -#[cfg(all(not(rustdoc), target_os = "android"))] pub use os::android as platform; -#[cfg(all(not(rustdoc), target_os = "bitrig"))] pub use os::bitrig as platform; -#[cfg(all(not(rustdoc), target_os = "dragonfly"))] pub use os::dragonfly as platform; -#[cfg(all(not(rustdoc), target_os = "freebsd"))] pub use os::freebsd as platform; -#[cfg(all(not(rustdoc), target_os = "haiku"))] pub use os::haiku as platform; -#[cfg(all(not(rustdoc), target_os = "ios"))] pub use os::ios as platform; -#[cfg(all(not(rustdoc), target_os = "macos"))] pub use os::macos as platform; -#[cfg(all(not(rustdoc), target_os = "netbsd"))] pub use os::netbsd as platform; -#[cfg(all(not(rustdoc), target_os = "openbsd"))] pub use os::openbsd as platform; -#[cfg(all(not(rustdoc), target_os = "solaris"))] pub use os::solaris as platform; -#[cfg(all(not(rustdoc), target_os = "emscripten"))] pub use os::emscripten as platform; -#[cfg(all(not(rustdoc), target_os = "fuchsia"))] pub use os::fuchsia as platform; -#[cfg(all(not(rustdoc), target_os = "l4re"))] pub use os::linux as platform; -#[cfg(all(not(rustdoc), target_os = "hermit"))] pub use os::hermit as platform; +#[cfg(all(not(rustdoc), target_os = "android"))] pub use crate::os::android as platform; +#[cfg(all(not(rustdoc), target_os = "bitrig"))] pub use crate::os::bitrig as platform; +#[cfg(all(not(rustdoc), target_os = "dragonfly"))] pub use crate::os::dragonfly as platform; +#[cfg(all(not(rustdoc), target_os = "freebsd"))] pub use crate::os::freebsd as platform; +#[cfg(all(not(rustdoc), target_os = "haiku"))] pub use crate::os::haiku as platform; +#[cfg(all(not(rustdoc), target_os = "ios"))] pub use crate::os::ios as platform; +#[cfg(all(not(rustdoc), target_os = "macos"))] pub use crate::os::macos as platform; +#[cfg(all(not(rustdoc), target_os = "netbsd"))] pub use crate::os::netbsd as platform; +#[cfg(all(not(rustdoc), target_os = "openbsd"))] pub use crate::os::openbsd as platform; +#[cfg(all(not(rustdoc), target_os = "solaris"))] pub use crate::os::solaris as platform; +#[cfg(all(not(rustdoc), target_os = "emscripten"))] pub use crate::os::emscripten as platform; +#[cfg(all(not(rustdoc), target_os = "fuchsia"))] pub use crate::os::fuchsia as platform; +#[cfg(all(not(rustdoc), target_os = "l4re"))] pub use crate::os::linux as platform; +#[cfg(all(not(rustdoc), target_os = "hermit"))] pub use crate::os::hermit as platform; pub use self::rand::hashmap_random_keys; pub use libc::strlen; @@ -82,7 +81,7 @@ pub fn init() { } #[cfg(target_os = "android")] -pub use sys::android::signal; +pub use crate::sys::android::signal; #[cfg(not(target_os = "android"))] pub use libc::signal; @@ -127,15 +126,15 @@ macro_rules! impl_is_minus_one { impl_is_minus_one! { i8 i16 i32 i64 isize } -pub fn cvt(t: T) -> ::io::Result { +pub fn cvt(t: T) -> crate::io::Result { if t.is_minus_one() { - Err(::io::Error::last_os_error()) + Err(crate::io::Error::last_os_error()) } else { Ok(t) } } -pub fn cvt_r(mut f: F) -> ::io::Result +pub fn cvt_r(mut f: F) -> crate::io::Result where T: IsMinusOne, F: FnMut() -> T { @@ -155,5 +154,5 @@ pub fn cvt_r(mut f: F) -> ::io::Result // instruction" that intrinsics::abort would cause, as intrinsics::abort is // implemented as an illegal instruction. pub unsafe fn abort_internal() -> ! { - ::libc::abort() + libc::abort() } diff --git a/src/libstd/sys/unix/mutex.rs b/src/libstd/sys/unix/mutex.rs index 54429dc84b6b..b6a22e1962ab 100644 --- a/src/libstd/sys/unix/mutex.rs +++ b/src/libstd/sys/unix/mutex.rs @@ -1,6 +1,5 @@ -use cell::UnsafeCell; -use libc; -use mem; +use crate::cell::UnsafeCell; +use crate::mem; pub struct Mutex { inner: UnsafeCell } @@ -74,7 +73,6 @@ impl Mutex { #[inline] #[cfg(target_os = "dragonfly")] pub unsafe fn destroy(&self) { - use libc; let r = libc::pthread_mutex_destroy(self.inner.get()); // On DragonFly pthread_mutex_destroy() returns EINVAL if called on a // mutex that was just initialized with libc::PTHREAD_MUTEX_INITIALIZER. diff --git a/src/libstd/sys/unix/net.rs b/src/libstd/sys/unix/net.rs index 521d9b425179..8e8cdf837a9e 100644 --- a/src/libstd/sys/unix/net.rs +++ b/src/libstd/sys/unix/net.rs @@ -1,16 +1,19 @@ -use ffi::CStr; -use io::{self, IoVec, IoVecMut}; -use libc::{self, c_int, c_void, size_t, sockaddr, socklen_t, EAI_SYSTEM, MSG_PEEK}; -use mem; -use net::{SocketAddr, Shutdown}; -use str; -use sys::fd::FileDesc; -use sys_common::{AsInner, FromInner, IntoInner}; -use sys_common::net::{getsockopt, setsockopt, sockaddr_to_addr}; -use time::{Duration, Instant}; -use cmp; +use crate::ffi::CStr; +use crate::io::{self, IoVec, IoVecMut}; +use crate::mem; +use crate::net::{SocketAddr, Shutdown}; +use crate::str; +use crate::sys::fd::FileDesc; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::sys_common::net::{getsockopt, setsockopt, sockaddr_to_addr}; +use crate::time::{Duration, Instant}; +use crate::cmp; + +use libc::{c_int, c_void, size_t, sockaddr, socklen_t, EAI_SYSTEM, MSG_PEEK}; pub use sys::{cvt, cvt_r}; + +#[allow(unused_extern_crates)] pub extern crate libc as netc; pub type wrlen_t = size_t; @@ -384,7 +387,7 @@ impl IntoInner for Socket { // believe it's thread-safe). #[cfg(target_env = "gnu")] fn on_resolver_failure() { - use sys; + use crate::sys; // If the version fails to parse, we treat it the same as "not glibc". if let Some(version) = sys::os::glibc_version() { diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 58ea190fcc00..e16d50d437b2 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -2,25 +2,26 @@ #![allow(unused_imports)] // lots of cfg code here -use os::unix::prelude::*; +use crate::os::unix::prelude::*; -use error::Error as StdError; -use ffi::{CString, CStr, OsString, OsStr}; -use fmt; -use io; -use iter; -use libc::{self, c_int, c_char, c_void}; -use marker::PhantomData; -use mem; -use memchr; -use path::{self, PathBuf}; -use ptr; -use slice; -use str; -use sys_common::mutex::{Mutex, MutexGuard}; -use sys::cvt; -use sys::fd; -use vec; +use crate::error::Error as StdError; +use crate::ffi::{CString, CStr, OsString, OsStr}; +use crate::fmt; +use crate::io; +use crate::iter; +use crate::marker::PhantomData; +use crate::mem; +use crate::memchr; +use crate::path::{self, PathBuf}; +use crate::ptr; +use crate::slice; +use crate::str; +use crate::sys_common::mutex::{Mutex, MutexGuard}; +use crate::sys::cvt; +use crate::sys::fd; +use crate::vec; + +use libc::{c_int, c_char, c_void}; const TMPBUF_SZ: usize = 128; @@ -207,13 +208,13 @@ pub fn current_exe() -> io::Result { libc::KERN_PROC_PATHNAME as c_int, -1 as c_int]; let mut sz = 0; - cvt(libc::sysctl(mib.as_mut_ptr(), mib.len() as ::libc::c_uint, + cvt(libc::sysctl(mib.as_mut_ptr(), mib.len() as libc::c_uint, ptr::null_mut(), &mut sz, ptr::null_mut(), 0))?; if sz == 0 { return Err(io::Error::last_os_error()) } let mut v: Vec = Vec::with_capacity(sz); - cvt(libc::sysctl(mib.as_mut_ptr(), mib.len() as ::libc::c_uint, + cvt(libc::sysctl(mib.as_mut_ptr(), mib.len() as libc::c_uint, v.as_mut_ptr() as *mut libc::c_void, &mut sz, ptr::null_mut(), 0))?; if sz == 0 { @@ -230,7 +231,7 @@ pub fn current_exe() -> io::Result { unsafe { let mib = [libc::CTL_KERN, libc::KERN_PROC_ARGS, -1, libc::KERN_PROC_PATHNAME]; let mut path_len: usize = 0; - cvt(libc::sysctl(mib.as_ptr(), mib.len() as ::libc::c_uint, + cvt(libc::sysctl(mib.as_ptr(), mib.len() as libc::c_uint, ptr::null_mut(), &mut path_len, ptr::null(), 0))?; if path_len <= 1 { @@ -238,7 +239,7 @@ pub fn current_exe() -> io::Result { "KERN_PROC_PATHNAME sysctl returned zero-length string")) } let mut path: Vec = Vec::with_capacity(path_len); - cvt(libc::sysctl(mib.as_ptr(), mib.len() as ::libc::c_uint, + cvt(libc::sysctl(mib.as_ptr(), mib.len() as libc::c_uint, path.as_ptr() as *mut libc::c_void, &mut path_len, ptr::null(), 0))?; path.set_len(path_len - 1); // chop off NUL @@ -248,7 +249,7 @@ pub fn current_exe() -> io::Result { fn procfs() -> io::Result { let curproc_exe = path::Path::new("/proc/curproc/exe"); if curproc_exe.is_file() { - return ::fs::read_link(curproc_exe); + return crate::fs::read_link(curproc_exe); } Err(io::Error::new(io::ErrorKind::Other, "/proc/curproc/exe doesn't point to regular file.")) @@ -277,7 +278,7 @@ pub fn current_exe() -> io::Result { } let argv0 = CStr::from_ptr(argv[0]).to_bytes(); if argv0[0] == b'.' || argv0.iter().any(|b| *b == b'/') { - ::fs::canonicalize(OsStr::from_bytes(argv0)) + crate::fs::canonicalize(OsStr::from_bytes(argv0)) } else { Ok(PathBuf::from(OsStr::from_bytes(argv0))) } @@ -286,7 +287,7 @@ pub fn current_exe() -> io::Result { #[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))] pub fn current_exe() -> io::Result { - match ::fs::read_link("/proc/self/exe") { + match crate::fs::read_link("/proc/self/exe") { Err(ref e) if e.kind() == io::ErrorKind::NotFound => { Err(io::Error::new( io::ErrorKind::Other, @@ -373,7 +374,7 @@ pub fn current_exe() -> io::Result { let result = _get_next_image_info(0, &mut cookie, &mut info, mem::size_of::() as i32); if result != 0 { - use io::ErrorKind; + use crate::io::ErrorKind; Err(io::Error::new(ErrorKind::Other, "Error getting executable path")) } else { let name = CStr::from_ptr(info.name.as_ptr()).to_bytes(); @@ -384,7 +385,7 @@ pub fn current_exe() -> io::Result { #[cfg(any(target_os = "fuchsia", target_os = "l4re", target_os = "hermit"))] pub fn current_exe() -> io::Result { - use io::ErrorKind; + use crate::io::ErrorKind; Err(io::Error::new(ErrorKind::Other, "Not yet implemented!")) } @@ -495,7 +496,7 @@ pub fn page_size() -> usize { } pub fn temp_dir() -> PathBuf { - ::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| { + crate::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| { if cfg!(target_os = "android") { PathBuf::from("/data/local/tmp") } else { @@ -505,7 +506,7 @@ pub fn temp_dir() -> PathBuf { } pub fn home_dir() -> Option { - return ::env::var_os("HOME").or_else(|| unsafe { + return crate::env::var_os("HOME").or_else(|| unsafe { fallback() }).map(PathBuf::from); diff --git a/src/libstd/sys/unix/os_str.rs b/src/libstd/sys/unix/os_str.rs index 9d5e084feb2d..79b43458d00f 100644 --- a/src/libstd/sys/unix/os_str.rs +++ b/src/libstd/sys/unix/os_str.rs @@ -1,14 +1,15 @@ /// The underlying OsString/OsStr implementation on Unix systems: just /// a `Vec`/`[u8]`. -use borrow::Cow; -use fmt; -use str; -use mem; -use rc::Rc; -use sync::Arc; -use sys_common::{AsInner, IntoInner}; -use sys_common::bytestring::debug_fmt_bytestring; +use crate::borrow::Cow; +use crate::fmt; +use crate::str; +use crate::mem; +use crate::rc::Rc; +use crate::sync::Arc; +use crate::sys_common::{AsInner, IntoInner}; +use crate::sys_common::bytestring::debug_fmt_bytestring; + use core::str::lossy::Utf8Lossy; #[derive(Clone, Hash)] diff --git a/src/libstd/sys/unix/path.rs b/src/libstd/sys/unix/path.rs index 2ef78fb2f86d..5c062e7c97cd 100644 --- a/src/libstd/sys/unix/path.rs +++ b/src/libstd/sys/unix/path.rs @@ -1,5 +1,5 @@ -use path::Prefix; -use ffi::OsStr; +use crate::path::Prefix; +use crate::ffi::OsStr; #[inline] pub fn is_sep_byte(b: u8) -> bool { diff --git a/src/libstd/sys/unix/pipe.rs b/src/libstd/sys/unix/pipe.rs index a746d982c6ca..bc3c026adab8 100644 --- a/src/libstd/sys/unix/pipe.rs +++ b/src/libstd/sys/unix/pipe.rs @@ -1,9 +1,10 @@ -use io; -use libc::{self, c_int}; -use mem; -use sync::atomic::{AtomicBool, Ordering}; -use sys::fd::FileDesc; -use sys::{cvt, cvt_r}; +use crate::io; +use crate::mem; +use crate::sync::atomic::{AtomicBool, Ordering}; +use crate::sys::fd::FileDesc; +use crate::sys::{cvt, cvt_r}; + +use libc::c_int; //////////////////////////////////////////////////////////////////////////////// // Anonymous pipes diff --git a/src/libstd/sys/unix/process/process_common.rs b/src/libstd/sys/unix/process/process_common.rs index 7fa256e59b2d..856d202be03f 100644 --- a/src/libstd/sys/unix/process/process_common.rs +++ b/src/libstd/sys/unix/process/process_common.rs @@ -1,15 +1,16 @@ -use os::unix::prelude::*; +use crate::os::unix::prelude::*; -use ffi::{OsString, OsStr, CString, CStr}; -use fmt; -use io; -use libc::{self, c_int, gid_t, uid_t, c_char, EXIT_SUCCESS, EXIT_FAILURE}; -use ptr; -use sys::fd::FileDesc; -use sys::fs::{File, OpenOptions}; -use sys::pipe::{self, AnonPipe}; -use sys_common::process::{CommandEnv, DefaultEnvKey}; -use collections::BTreeMap; +use crate::ffi::{OsString, OsStr, CString, CStr}; +use crate::fmt; +use crate::io; +use crate::ptr; +use crate::sys::fd::FileDesc; +use crate::sys::fs::{File, OpenOptions}; +use crate::sys::pipe::{self, AnonPipe}; +use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; +use crate::collections::BTreeMap; + +use libc::{c_int, gid_t, uid_t, c_char, EXIT_SUCCESS, EXIT_FAILURE}; //////////////////////////////////////////////////////////////////////////////// // Command @@ -406,11 +407,10 @@ impl ExitCode { mod tests { use super::*; - use ffi::OsStr; - use mem; - use ptr; - use libc; - use sys::cvt; + use crate::ffi::OsStr; + use crate::mem; + use crate::ptr; + use crate::sys::cvt; macro_rules! t { ($e:expr) => { @@ -443,7 +443,7 @@ mod tests { #[cfg(target_os = "android")] unsafe fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::c_int { - use slice; + use crate::slice; let raw = slice::from_raw_parts_mut(set as *mut u8, mem::size_of::()); let bit = (signum - 1) as usize; diff --git a/src/libstd/sys/unix/process/process_fuchsia.rs b/src/libstd/sys/unix/process/process_fuchsia.rs index 5582310adbf7..7c6be9b0a604 100644 --- a/src/libstd/sys/unix/process/process_fuchsia.rs +++ b/src/libstd/sys/unix/process/process_fuchsia.rs @@ -1,10 +1,11 @@ -use io; -use libc::{self, size_t}; -use mem; -use ptr; +use crate::io; +use crate::mem; +use crate::ptr; -use sys::process::zircon::{Handle, zx_handle_t}; -use sys::process::process_common::*; +use crate::sys::process::zircon::{Handle, zx_handle_t}; +use crate::sys::process::process_common::*; + +use libc::size_t; //////////////////////////////////////////////////////////////////////////////// // Command @@ -44,7 +45,7 @@ impl Command { unsafe fn do_exec(&mut self, stdio: ChildPipes, maybe_envp: Option<&CStringArray>) -> io::Result { - use sys::process::zircon::*; + use crate::sys::process::zircon::*; let envp = match maybe_envp { Some(envp) => envp.as_ptr(), @@ -109,7 +110,7 @@ impl Process { } pub fn kill(&mut self) -> io::Result<()> { - use sys::process::zircon::*; + use crate::sys::process::zircon::*; unsafe { zx_cvt(zx_task_kill(self.handle.raw()))?; } @@ -117,8 +118,8 @@ impl Process { } pub fn wait(&mut self) -> io::Result { - use default::Default; - use sys::process::zircon::*; + use crate::default::Default; + use crate::sys::process::zircon::*; let mut proc_info: zx_info_process_t = Default::default(); let mut actual: size_t = 0; @@ -140,8 +141,8 @@ impl Process { } pub fn try_wait(&mut self) -> io::Result> { - use default::Default; - use sys::process::zircon::*; + use crate::default::Default; + use crate::sys::process::zircon::*; let mut proc_info: zx_info_process_t = Default::default(); let mut actual: size_t = 0; diff --git a/src/libstd/sys/unix/process/process_unix.rs b/src/libstd/sys/unix/process/process_unix.rs index 6fbbbb349b17..220b1fd45313 100644 --- a/src/libstd/sys/unix/process/process_unix.rs +++ b/src/libstd/sys/unix/process/process_unix.rs @@ -1,9 +1,10 @@ -use io::{self, Error, ErrorKind}; -use libc::{self, c_int, gid_t, pid_t, uid_t}; -use ptr; -use sys::cvt; -use sys::process::process_common::*; -use sys; +use crate::io::{self, Error, ErrorKind}; +use crate::ptr; +use crate::sys::cvt; +use crate::sys::process::process_common::*; +use crate::sys; + +use libc::{c_int, gid_t, pid_t, uid_t}; //////////////////////////////////////////////////////////////////////////////// // Command @@ -164,7 +165,7 @@ impl Command { stdio: ChildPipes, maybe_envp: Option<&CStringArray> ) -> io::Error { - use sys::{self, cvt_r}; + use crate::sys::{self, cvt_r}; macro_rules! t { ($e:expr) => (match $e { @@ -207,7 +208,7 @@ impl Command { // emscripten has no signal support. #[cfg(not(any(target_os = "emscripten")))] { - use mem; + use crate::mem; // Reset signal handling so the child process starts in a // standardized state. libstd ignores SIGPIPE, and signal-handling // libraries often set a mask. Child processes inherit ignored @@ -278,8 +279,8 @@ impl Command { fn posix_spawn(&mut self, stdio: &ChildPipes, envp: Option<&CStringArray>) -> io::Result> { - use mem; - use sys; + use crate::mem; + use crate::sys; if self.get_gid().is_some() || self.get_uid().is_some() || @@ -427,7 +428,7 @@ impl Process { } pub fn wait(&mut self) -> io::Result { - use sys::cvt_r; + use crate::sys::cvt_r; if let Some(status) = self.status { return Ok(status) } diff --git a/src/libstd/sys/unix/process/zircon.rs b/src/libstd/sys/unix/process/zircon.rs index 690c745218b6..ec715d5490f6 100644 --- a/src/libstd/sys/unix/process/zircon.rs +++ b/src/libstd/sys/unix/process/zircon.rs @@ -1,9 +1,9 @@ #![allow(non_camel_case_types, unused)] -use convert::TryInto; -use io; -use os::raw::c_char; -use u64; +use crate::convert::TryInto; +use crate::io; +use crate::os::raw::c_char; +use crate::u64; use libc::{c_int, c_void, size_t}; diff --git a/src/libstd/sys/unix/rand.rs b/src/libstd/sys/unix/rand.rs index f2e17c36738f..122f22b37a26 100644 --- a/src/libstd/sys/unix/rand.rs +++ b/src/libstd/sys/unix/rand.rs @@ -1,5 +1,5 @@ -use mem; -use slice; +use crate::mem; +use crate::slice; pub fn hashmap_random_keys() -> (u64, u64) { let mut v = (0, 0); @@ -17,10 +17,8 @@ pub fn hashmap_random_keys() -> (u64, u64) { not(target_os = "freebsd"), not(target_os = "fuchsia")))] mod imp { - use fs::File; - use io::Read; - #[cfg(any(target_os = "linux", target_os = "android"))] - use libc; + use crate::fs::File; + use crate::io::Read; #[cfg(any(target_os = "linux", target_os = "android"))] fn getrandom(buf: &mut [u8]) -> libc::c_long { @@ -34,8 +32,8 @@ mod imp { #[cfg(any(target_os = "linux", target_os = "android"))] fn getrandom_fill_bytes(v: &mut [u8]) -> bool { - use sync::atomic::{AtomicBool, Ordering}; - use sys::os::errno; + use crate::sync::atomic::{AtomicBool, Ordering}; + use crate::sys::os::errno; static GETRANDOM_UNAVAILABLE: AtomicBool = AtomicBool::new(false); if GETRANDOM_UNAVAILABLE.load(Ordering::Relaxed) { @@ -86,8 +84,7 @@ mod imp { #[cfg(target_os = "openbsd")] mod imp { - use libc; - use sys::os::errno; + use crate::sys::os::errno; pub fn fill_bytes(v: &mut [u8]) { // getentropy(2) permits a maximum buffer size of 256 bytes @@ -104,9 +101,9 @@ mod imp { #[cfg(target_os = "ios")] mod imp { - use io; + use crate::io; + use crate::ptr; use libc::{c_int, size_t}; - use ptr; enum SecRandom {} @@ -134,8 +131,7 @@ mod imp { #[cfg(target_os = "freebsd")] mod imp { - use libc; - use ptr; + use crate::ptr; pub fn fill_bytes(v: &mut [u8]) { let mib = [libc::CTL_KERN, libc::KERN_ARND]; diff --git a/src/libstd/sys/unix/rwlock.rs b/src/libstd/sys/unix/rwlock.rs index a068a11993e3..e48bfdae6104 100644 --- a/src/libstd/sys/unix/rwlock.rs +++ b/src/libstd/sys/unix/rwlock.rs @@ -1,6 +1,5 @@ -use libc; -use cell::UnsafeCell; -use sync::atomic::{AtomicUsize, Ordering}; +use crate::cell::UnsafeCell; +use crate::sync::atomic::{AtomicUsize, Ordering}; pub struct RWLock { inner: UnsafeCell, diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs index d6a219a6d575..cfa019634bd0 100644 --- a/src/libstd/sys/unix/stack_overflow.rs +++ b/src/libstd/sys/unix/stack_overflow.rs @@ -1,6 +1,5 @@ #![cfg_attr(test, allow(dead_code))] -use libc; use self::imp::{make_handler, drop_handler}; pub use self::imp::cleanup; @@ -34,8 +33,9 @@ impl Drop for Handler { target_os = "openbsd"))] mod imp { use super::Handler; - use mem; - use ptr; + use crate::mem; + use crate::ptr; + use libc::{sigaltstack, SIGSTKSZ, SS_DISABLE}; use libc::{sigaction, SIGBUS, SIG_DFL, SA_SIGINFO, SA_ONSTACK, sighandler_t}; @@ -44,7 +44,7 @@ mod imp { use libc::{SIGSEGV, PROT_READ, PROT_WRITE, MAP_PRIVATE, MAP_ANON}; use libc::MAP_FAILED; - use sys_common::thread_info; + use crate::sys_common::thread_info; #[cfg(any(target_os = "linux", target_os = "android"))] @@ -87,7 +87,7 @@ mod imp { unsafe extern fn signal_handler(signum: libc::c_int, info: *mut libc::siginfo_t, _data: *mut libc::c_void) { - use sys_common::util::report_overflow; + use crate::sys_common::util::report_overflow; let guard = thread_info::stack_guard().unwrap_or(0..0); let addr = siginfo_si_addr(info); @@ -193,7 +193,7 @@ mod imp { all(target_os = "netbsd", not(target_vendor = "rumprun")), target_os = "openbsd")))] mod imp { - use ptr; + use crate::ptr; pub unsafe fn init() { } diff --git a/src/libstd/sys/unix/stdio.rs b/src/libstd/sys/unix/stdio.rs index 56b75bf9f793..35f163bbdb10 100644 --- a/src/libstd/sys/unix/stdio.rs +++ b/src/libstd/sys/unix/stdio.rs @@ -1,6 +1,5 @@ -use io; -use libc; -use sys::fd::FileDesc; +use crate::io; +use crate::sys::fd::FileDesc; pub struct Stdin(()); pub struct Stdout(()); @@ -57,7 +56,7 @@ pub fn is_ebadf(err: &io::Error) -> bool { err.raw_os_error() == Some(libc::EBADF as i32) } -pub const STDIN_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; +pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE; pub fn panic_output() -> Option { Stderr::new().ok() diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index e29557f1ba29..feb15e8f585a 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -1,14 +1,13 @@ -use boxed::FnBox; -use cmp; -use ffi::CStr; -use io; -use libc; -use mem; -use ptr; -use sys::os; -use time::Duration; +use crate::boxed::FnBox; +use crate::cmp; +use crate::ffi::CStr; +use crate::io; +use crate::mem; +use crate::ptr; +use crate::sys::os; +use crate::time::Duration; -use sys_common::thread::*; +use crate::sys_common::thread::*; #[cfg(not(target_os = "l4re"))] pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024; @@ -118,7 +117,7 @@ impl Thread { #[cfg(target_os = "netbsd")] pub fn set_name(name: &CStr) { - use ffi::CString; + use crate::ffi::CString; let cname = CString::new(&b"%s"[..]).unwrap(); unsafe { libc::pthread_setname_np(libc::pthread_self(), cname.as_ptr(), @@ -197,7 +196,7 @@ impl Drop for Thread { not(target_os = "solaris")))] #[cfg_attr(test, allow(dead_code))] pub mod guard { - use ops::Range; + use crate::ops::Range; pub type Guard = Range; pub unsafe fn current() -> Option { None } pub unsafe fn init() -> Option { None } @@ -213,11 +212,11 @@ pub mod guard { target_os = "solaris"))] #[cfg_attr(test, allow(dead_code))] pub mod guard { - use libc; use libc::{mmap, mprotect}; use libc::{PROT_NONE, PROT_READ, PROT_WRITE, MAP_PRIVATE, MAP_ANON, MAP_FAILED, MAP_FIXED}; - use ops::Range; - use sys::os; + + use crate::ops::Range; + use crate::sys::os; // This is initialized in init() and only read from after static mut PAGE_SIZE: usize = 0; @@ -226,7 +225,7 @@ pub mod guard { #[cfg(target_os = "solaris")] unsafe fn get_stack_start() -> Option<*mut libc::c_void> { - let mut current_stack: libc::stack_t = ::mem::zeroed(); + let mut current_stack: libc::stack_t = crate::mem::zeroed(); assert_eq!(libc::stack_getbounds(&mut current_stack), 0); Some(current_stack.ss_sp) } @@ -240,7 +239,7 @@ pub mod guard { #[cfg(any(target_os = "openbsd", target_os = "bitrig"))] unsafe fn get_stack_start() -> Option<*mut libc::c_void> { - let mut current_stack: libc::stack_t = ::mem::zeroed(); + let mut current_stack: libc::stack_t = crate::mem::zeroed(); assert_eq!(libc::pthread_stackseg_np(libc::pthread_self(), &mut current_stack), 0); @@ -259,14 +258,14 @@ pub mod guard { target_os = "linux", target_os = "netbsd", target_os = "l4re"))] unsafe fn get_stack_start() -> Option<*mut libc::c_void> { let mut ret = None; - let mut attr: libc::pthread_attr_t = ::mem::zeroed(); + let mut attr: libc::pthread_attr_t = crate::mem::zeroed(); assert_eq!(libc::pthread_attr_init(&mut attr), 0); #[cfg(target_os = "freebsd")] let e = libc::pthread_attr_get_np(libc::pthread_self(), &mut attr); #[cfg(not(target_os = "freebsd"))] let e = libc::pthread_getattr_np(libc::pthread_self(), &mut attr); if e == 0 { - let mut stackaddr = ::ptr::null_mut(); + let mut stackaddr = crate::ptr::null_mut(); let mut stacksize = 0; assert_eq!(libc::pthread_attr_getstack(&attr, &mut stackaddr, &mut stacksize), 0); @@ -357,7 +356,7 @@ pub mod guard { target_os = "linux", target_os = "netbsd", target_os = "l4re"))] pub unsafe fn current() -> Option { let mut ret = None; - let mut attr: libc::pthread_attr_t = ::mem::zeroed(); + let mut attr: libc::pthread_attr_t = crate::mem::zeroed(); assert_eq!(libc::pthread_attr_init(&mut attr), 0); #[cfg(target_os = "freebsd")] let e = libc::pthread_attr_get_np(libc::pthread_self(), &mut attr); @@ -369,7 +368,7 @@ pub mod guard { if guardsize == 0 { panic!("there is no guard page"); } - let mut stackaddr = ::ptr::null_mut(); + let mut stackaddr = crate::ptr::null_mut(); let mut size = 0; assert_eq!(libc::pthread_attr_getstack(&attr, &mut stackaddr, &mut size), 0); diff --git a/src/libstd/sys/unix/thread_local.rs b/src/libstd/sys/unix/thread_local.rs index c171fbce237f..ac615b76b362 100644 --- a/src/libstd/sys/unix/thread_local.rs +++ b/src/libstd/sys/unix/thread_local.rs @@ -1,7 +1,6 @@ #![allow(dead_code)] // not used on all platforms -use mem; -use libc; +use crate::mem; pub type Key = libc::pthread_key_t; diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index 4a655714f991..cbb0615911ad 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -1,10 +1,10 @@ -use cmp::Ordering; -use libc; -use time::Duration; +use crate::cmp::Ordering; +use crate::time::Duration; + use core::hash::{Hash, Hasher}; pub use self::inner::{Instant, SystemTime, UNIX_EPOCH}; -use convert::TryInto; +use crate::convert::TryInto; const NSEC_PER_SEC: u64 = 1_000_000_000; @@ -113,12 +113,11 @@ impl Hash for Timespec { #[cfg(any(target_os = "macos", target_os = "ios"))] mod inner { - use fmt; - use libc; - use sync::Once; - use sys::cvt; - use sys_common::mul_div_u64; - use time::Duration; + use crate::fmt; + use crate::sync::Once; + use crate::sys::cvt; + use crate::sys_common::mul_div_u64; + use crate::time::Duration; use super::NSEC_PER_SEC; use super::Timespec; @@ -173,7 +172,7 @@ mod inner { impl SystemTime { pub fn now() -> SystemTime { - use ptr; + use crate::ptr; let mut s = libc::timeval { tv_sec: 0, @@ -249,10 +248,9 @@ mod inner { #[cfg(not(any(target_os = "macos", target_os = "ios")))] mod inner { - use fmt; - use libc; - use sys::cvt; - use time::Duration; + use crate::fmt; + use crate::sys::cvt; + use crate::time::Duration; use super::Timespec; diff --git a/src/libstd/sys/unix/weak.rs b/src/libstd/sys/unix/weak.rs index b60e241f10ce..9a7691e54bc1 100644 --- a/src/libstd/sys/unix/weak.rs +++ b/src/libstd/sys/unix/weak.rs @@ -16,17 +16,15 @@ //! symbol, but that caused Debian to detect an unnecessarily strict versioned //! dependency on libc6 (#23628). -use libc; - -use ffi::CStr; -use marker; -use mem; -use sync::atomic::{AtomicUsize, Ordering}; +use crate::ffi::CStr; +use crate::marker; +use crate::mem; +use crate::sync::atomic::{AtomicUsize, Ordering}; macro_rules! weak { (fn $name:ident($($t:ty),*) -> $ret:ty) => ( - static $name: ::sys::weak::Weak $ret> = - ::sys::weak::Weak::new(concat!(stringify!($name), '\0')); + static $name: crate::sys::weak::Weak $ret> = + crate::sys::weak::Weak::new(concat!(stringify!($name), '\0')); ) } @@ -71,7 +69,6 @@ unsafe fn fetch(name: &str) -> usize { macro_rules! syscall { (fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => ( unsafe fn $name($($arg_name: $t),*) -> $ret { - use libc; use super::os; weak! { fn $name($($t),*) -> $ret } diff --git a/src/libstd/sys/wasm/alloc.rs b/src/libstd/sys/wasm/alloc.rs index f082887ce205..b9098548b9c1 100644 --- a/src/libstd/sys/wasm/alloc.rs +++ b/src/libstd/sys/wasm/alloc.rs @@ -16,9 +16,7 @@ //! The crate itself provides a global allocator which on wasm has no //! synchronization as there are no threads! -extern crate dlmalloc; - -use alloc::{GlobalAlloc, Layout, System}; +use crate::alloc::{GlobalAlloc, Layout, System}; static mut DLMALLOC: dlmalloc::Dlmalloc = dlmalloc::DLMALLOC_INIT; @@ -51,8 +49,8 @@ unsafe impl GlobalAlloc for System { #[cfg(target_feature = "atomics")] mod lock { - use arch::wasm32; - use sync::atomic::{AtomicI32, Ordering::SeqCst}; + use crate::arch::wasm32; + use crate::sync::atomic::{AtomicI32, Ordering::SeqCst}; static LOCKED: AtomicI32 = AtomicI32::new(0); diff --git a/src/libstd/sys/wasm/args.rs b/src/libstd/sys/wasm/args.rs index cea56091adcb..b3c77b869956 100644 --- a/src/libstd/sys/wasm/args.rs +++ b/src/libstd/sys/wasm/args.rs @@ -1,7 +1,7 @@ -use ffi::OsString; -use marker::PhantomData; -use vec; -use sys::ArgsSysCall; +use crate::ffi::OsString; +use crate::marker::PhantomData; +use crate::vec; +use crate::sys::ArgsSysCall; pub unsafe fn init(_argc: isize, _argv: *const *const u8) { // On wasm these should always be null, so there's nothing for us to do here diff --git a/src/libstd/sys/wasm/backtrace.rs b/src/libstd/sys/wasm/backtrace.rs index 52d4a63bb638..7d56b298997a 100644 --- a/src/libstd/sys/wasm/backtrace.rs +++ b/src/libstd/sys/wasm/backtrace.rs @@ -1,6 +1,6 @@ -use io; -use sys::unsupported; -use sys_common::backtrace::Frame; +use crate::io; +use crate::sys::unsupported; +use crate::sys_common::backtrace::Frame; pub struct BacktraceContext; diff --git a/src/libstd/sys/wasm/condvar.rs b/src/libstd/sys/wasm/condvar.rs index 22df0f60db5a..9c7cc3c63b15 100644 --- a/src/libstd/sys/wasm/condvar.rs +++ b/src/libstd/sys/wasm/condvar.rs @@ -1,5 +1,5 @@ -use sys::mutex::Mutex; -use time::Duration; +use crate::sys::mutex::Mutex; +use crate::time::Duration; pub struct Condvar { } diff --git a/src/libstd/sys/wasm/condvar_atomics.rs b/src/libstd/sys/wasm/condvar_atomics.rs index 099404c75d42..580d21218445 100644 --- a/src/libstd/sys/wasm/condvar_atomics.rs +++ b/src/libstd/sys/wasm/condvar_atomics.rs @@ -1,9 +1,9 @@ -use arch::wasm32; -use cmp; -use mem; -use sync::atomic::{AtomicUsize, Ordering::SeqCst}; -use sys::mutex::Mutex; -use time::Duration; +use crate::arch::wasm32; +use crate::cmp; +use crate::mem; +use crate::sync::atomic::{AtomicUsize, Ordering::SeqCst}; +use crate::sys::mutex::Mutex; +use crate::time::Duration; pub struct Condvar { cnt: AtomicUsize, diff --git a/src/libstd/sys/wasm/fs.rs b/src/libstd/sys/wasm/fs.rs index 8b1c4476bc41..485d2c87fbd2 100644 --- a/src/libstd/sys/wasm/fs.rs +++ b/src/libstd/sys/wasm/fs.rs @@ -1,10 +1,10 @@ -use ffi::OsString; -use fmt; -use hash::{Hash, Hasher}; -use io::{self, SeekFrom}; -use path::{Path, PathBuf}; -use sys::time::SystemTime; -use sys::{unsupported, Void}; +use crate::ffi::OsString; +use crate::fmt; +use crate::hash::{Hash, Hasher}; +use crate::io::{self, SeekFrom}; +use crate::path::{Path, PathBuf}; +use crate::sys::time::SystemTime; +use crate::sys::{unsupported, Void}; pub struct File(Void); diff --git a/src/libstd/sys/wasm/mod.rs b/src/libstd/sys/wasm/mod.rs index e71c6bcd7fe7..1828cce4e520 100644 --- a/src/libstd/sys/wasm/mod.rs +++ b/src/libstd/sys/wasm/mod.rs @@ -14,12 +14,12 @@ //! compiling for wasm. That way it's a compile time error for something that's //! guaranteed to be a runtime error! -use os::raw::c_char; -use ptr; -use sys::os_str::Buf; -use sys_common::{AsInner, FromInner}; -use ffi::{OsString, OsStr}; -use time::Duration; +use crate::os::raw::c_char; +use crate::ptr; +use crate::sys::os_str::Buf; +use crate::sys_common::{AsInner, FromInner}; +use crate::ffi::{OsString, OsStr}; +use crate::time::Duration; pub mod alloc; pub mod args; @@ -63,17 +63,17 @@ cfg_if! { pub fn init() { } -pub fn unsupported() -> ::io::Result { +pub fn unsupported() -> crate::io::Result { Err(unsupported_err()) } -pub fn unsupported_err() -> ::io::Error { - ::io::Error::new(::io::ErrorKind::Other, +pub fn unsupported_err() -> crate::io::Error { + crate::io::Error::new(crate::io::ErrorKind::Other, "operation not supported on wasm yet") } -pub fn decode_error_kind(_code: i32) -> ::io::ErrorKind { - ::io::ErrorKind::Other +pub fn decode_error_kind(_code: i32) -> crate::io::ErrorKind { + crate::io::ErrorKind::Other } // This enum is used as the storage for a bunch of types which can't actually @@ -168,7 +168,7 @@ impl ExitSysCall { }; unsafe { syscall(SysCallIndex::Exit, &mut call_record); - ::intrinsics::abort(); + crate::intrinsics::abort(); } } } diff --git a/src/libstd/sys/wasm/mutex.rs b/src/libstd/sys/wasm/mutex.rs index cf0a0a8638b1..9d713e9b4390 100644 --- a/src/libstd/sys/wasm/mutex.rs +++ b/src/libstd/sys/wasm/mutex.rs @@ -1,4 +1,4 @@ -use cell::UnsafeCell; +use crate::cell::UnsafeCell; pub struct Mutex { locked: UnsafeCell, diff --git a/src/libstd/sys/wasm/mutex_atomics.rs b/src/libstd/sys/wasm/mutex_atomics.rs index da03e8fa23f1..0e4f3d80aa93 100644 --- a/src/libstd/sys/wasm/mutex_atomics.rs +++ b/src/libstd/sys/wasm/mutex_atomics.rs @@ -1,8 +1,8 @@ -use arch::wasm32; -use cell::UnsafeCell; -use mem; -use sync::atomic::{AtomicUsize, AtomicU32, Ordering::SeqCst}; -use sys::thread; +use crate::arch::wasm32; +use crate::cell::UnsafeCell; +use crate::mem; +use crate::sync::atomic::{AtomicUsize, AtomicU32, Ordering::SeqCst}; +use crate::sys::thread; pub struct Mutex { locked: AtomicUsize, diff --git a/src/libstd/sys/wasm/net.rs b/src/libstd/sys/wasm/net.rs index d9f5d5384320..1249832fb09d 100644 --- a/src/libstd/sys/wasm/net.rs +++ b/src/libstd/sys/wasm/net.rs @@ -1,9 +1,9 @@ -use fmt; -use io::{self, IoVec, IoVecMut}; -use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; -use time::Duration; -use sys::{unsupported, Void}; -use convert::TryFrom; +use crate::fmt; +use crate::io::{self, IoVec, IoVecMut}; +use crate::net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; +use crate::time::Duration; +use crate::sys::{unsupported, Void}; +use crate::convert::TryFrom; pub struct TcpStream(Void); diff --git a/src/libstd/sys/wasm/os.rs b/src/libstd/sys/wasm/os.rs index 9b278dfb9f8b..145f9ccd73a8 100644 --- a/src/libstd/sys/wasm/os.rs +++ b/src/libstd/sys/wasm/os.rs @@ -1,10 +1,10 @@ -use error::Error as StdError; -use ffi::{OsString, OsStr}; -use fmt; -use io; -use path::{self, PathBuf}; -use str; -use sys::{unsupported, Void, ExitSysCall, GetEnvSysCall, SetEnvSysCall}; +use crate::error::Error as StdError; +use crate::ffi::{OsString, OsStr}; +use crate::fmt; +use crate::io; +use crate::path::{self, PathBuf}; +use crate::str; +use crate::sys::{unsupported, Void, ExitSysCall, GetEnvSysCall, SetEnvSysCall}; pub fn errno() -> i32 { 0 diff --git a/src/libstd/sys/wasm/os_str.rs b/src/libstd/sys/wasm/os_str.rs index 9d5e084feb2d..79b43458d00f 100644 --- a/src/libstd/sys/wasm/os_str.rs +++ b/src/libstd/sys/wasm/os_str.rs @@ -1,14 +1,15 @@ /// The underlying OsString/OsStr implementation on Unix systems: just /// a `Vec`/`[u8]`. -use borrow::Cow; -use fmt; -use str; -use mem; -use rc::Rc; -use sync::Arc; -use sys_common::{AsInner, IntoInner}; -use sys_common::bytestring::debug_fmt_bytestring; +use crate::borrow::Cow; +use crate::fmt; +use crate::str; +use crate::mem; +use crate::rc::Rc; +use crate::sync::Arc; +use crate::sys_common::{AsInner, IntoInner}; +use crate::sys_common::bytestring::debug_fmt_bytestring; + use core::str::lossy::Utf8Lossy; #[derive(Clone, Hash)] diff --git a/src/libstd/sys/wasm/path.rs b/src/libstd/sys/wasm/path.rs index 2ef78fb2f86d..5c062e7c97cd 100644 --- a/src/libstd/sys/wasm/path.rs +++ b/src/libstd/sys/wasm/path.rs @@ -1,5 +1,5 @@ -use path::Prefix; -use ffi::OsStr; +use crate::path::Prefix; +use crate::ffi::OsStr; #[inline] pub fn is_sep_byte(b: u8) -> bool { diff --git a/src/libstd/sys/wasm/pipe.rs b/src/libstd/sys/wasm/pipe.rs index ac48a6dc0332..2582b993b608 100644 --- a/src/libstd/sys/wasm/pipe.rs +++ b/src/libstd/sys/wasm/pipe.rs @@ -1,5 +1,5 @@ -use io; -use sys::Void; +use crate::io; +use crate::sys::Void; pub struct AnonPipe(Void); diff --git a/src/libstd/sys/wasm/process.rs b/src/libstd/sys/wasm/process.rs index 5357d931c736..c49daaa16320 100644 --- a/src/libstd/sys/wasm/process.rs +++ b/src/libstd/sys/wasm/process.rs @@ -1,10 +1,10 @@ -use ffi::OsStr; -use fmt; -use io; -use sys::fs::File; -use sys::pipe::AnonPipe; -use sys::{unsupported, Void}; -use sys_common::process::{CommandEnv, DefaultEnvKey}; +use crate::ffi::OsStr; +use crate::fmt; +use crate::io; +use crate::sys::fs::File; +use crate::sys::pipe::AnonPipe; +use crate::sys::{unsupported, Void}; +use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; //////////////////////////////////////////////////////////////////////////////// // Command diff --git a/src/libstd/sys/wasm/rwlock.rs b/src/libstd/sys/wasm/rwlock.rs index 9f172859b7e6..a2b07c7fa1fc 100644 --- a/src/libstd/sys/wasm/rwlock.rs +++ b/src/libstd/sys/wasm/rwlock.rs @@ -1,4 +1,4 @@ -use cell::UnsafeCell; +use crate::cell::UnsafeCell; pub struct RWLock { mode: UnsafeCell, diff --git a/src/libstd/sys/wasm/rwlock_atomics.rs b/src/libstd/sys/wasm/rwlock_atomics.rs index 404b33bca41b..c705568cec99 100644 --- a/src/libstd/sys/wasm/rwlock_atomics.rs +++ b/src/libstd/sys/wasm/rwlock_atomics.rs @@ -1,6 +1,6 @@ -use cell::UnsafeCell; -use sys::mutex::Mutex; -use sys::condvar::Condvar; +use crate::cell::UnsafeCell; +use crate::sys::mutex::Mutex; +use crate::sys::condvar::Condvar; pub struct RWLock { lock: Mutex, diff --git a/src/libstd/sys/wasm/stdio.rs b/src/libstd/sys/wasm/stdio.rs index d7540fd815c9..b8899a9c8474 100644 --- a/src/libstd/sys/wasm/stdio.rs +++ b/src/libstd/sys/wasm/stdio.rs @@ -1,5 +1,5 @@ -use io; -use sys::{ReadSysCall, WriteSysCall}; +use crate::io; +use crate::sys::{ReadSysCall, WriteSysCall}; pub struct Stdin; pub struct Stdout; diff --git a/src/libstd/sys/wasm/thread.rs b/src/libstd/sys/wasm/thread.rs index c2322088e8e5..a65c413119f8 100644 --- a/src/libstd/sys/wasm/thread.rs +++ b/src/libstd/sys/wasm/thread.rs @@ -1,8 +1,8 @@ -use boxed::FnBox; -use ffi::CStr; -use io; -use sys::{unsupported, Void}; -use time::Duration; +use crate::boxed::FnBox; +use crate::ffi::CStr; +use crate::io; +use crate::sys::{unsupported, Void}; +use crate::time::Duration; pub struct Thread(Void); @@ -31,8 +31,8 @@ impl Thread { #[cfg(target_feature = "atomics")] pub fn sleep(dur: Duration) { - use arch::wasm32; - use cmp; + use crate::arch::wasm32; + use crate::cmp; // Use an atomic wait to block the current thread artificially with a // timeout listed. Note that we should never be notified (return value @@ -76,7 +76,7 @@ cfg_if! { // you'd like to use them be sure to update that and make sure everyone // agrees what's what. pub fn tcb_get() -> *mut u8 { - use mem; + use crate::mem; assert_eq!(mem::size_of::<*mut u8>(), mem::size_of::()); unsafe { __wbindgen_tcb_get() as *mut u8 } } diff --git a/src/libstd/sys/wasm/thread_local.rs b/src/libstd/sys/wasm/thread_local.rs index c7c385da8c37..29e9854bcfcc 100644 --- a/src/libstd/sys/wasm/thread_local.rs +++ b/src/libstd/sys/wasm/thread_local.rs @@ -1,5 +1,5 @@ -use boxed::Box; -use ptr; +use crate::boxed::Box; +use crate::ptr; pub type Key = usize; diff --git a/src/libstd/sys/wasm/thread_local_atomics.rs b/src/libstd/sys/wasm/thread_local_atomics.rs index d1d0af252c8c..b408ad0d5c1f 100644 --- a/src/libstd/sys/wasm/thread_local_atomics.rs +++ b/src/libstd/sys/wasm/thread_local_atomics.rs @@ -1,5 +1,5 @@ -use sys::thread; -use sync::atomic::{AtomicUsize, Ordering::SeqCst}; +use crate::sys::thread; +use crate::sync::atomic::{AtomicUsize, Ordering::SeqCst}; const MAX_KEYS: usize = 128; static NEXT_KEY: AtomicUsize = AtomicUsize::new(0); diff --git a/src/libstd/sys/wasm/time.rs b/src/libstd/sys/wasm/time.rs index 31798466fed2..c1228a1b75e3 100644 --- a/src/libstd/sys/wasm/time.rs +++ b/src/libstd/sys/wasm/time.rs @@ -1,5 +1,5 @@ -use time::Duration; -use sys::{TimeSysCall, TimeClock}; +use crate::time::Duration; +use crate::sys::{TimeSysCall, TimeClock}; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] pub struct Instant(Duration); diff --git a/src/libstd/sys/windows/alloc.rs b/src/libstd/sys/windows/alloc.rs index 0d7f803c7eef..a33c4019a2e6 100644 --- a/src/libstd/sys/windows/alloc.rs +++ b/src/libstd/sys/windows/alloc.rs @@ -1,6 +1,6 @@ -use alloc::{GlobalAlloc, Layout, System}; -use sys::c; -use sys_common::alloc::{MIN_ALIGN, realloc_fallback}; +use crate::alloc::{GlobalAlloc, Layout, System}; +use crate::sys::c; +use crate::sys_common::alloc::{MIN_ALIGN, realloc_fallback}; #[repr(C)] struct Header(*mut u8); diff --git a/src/libstd/sys/windows/args.rs b/src/libstd/sys/windows/args.rs index f67280691097..3f10e6e5983e 100644 --- a/src/libstd/sys/windows/args.rs +++ b/src/libstd/sys/windows/args.rs @@ -1,14 +1,15 @@ #![allow(dead_code)] // runtime init functions not used during testing -use os::windows::prelude::*; -use sys::windows::os::current_exe; -use sys::c; -use ffi::OsString; -use fmt; -use vec; +use crate::os::windows::prelude::*; +use crate::sys::windows::os::current_exe; +use crate::sys::c; +use crate::ffi::OsString; +use crate::fmt; +use crate::vec; +use crate::slice; +use crate::path::PathBuf; + use core::iter; -use slice; -use path::PathBuf; pub unsafe fn init(_argc: isize, _argv: *const *const u8) { } @@ -80,7 +81,7 @@ unsafe fn parse_lp_cmd_line OsString>(lp_cmd_line: *const u16, exe_na // "However, if lpCmdLine starts with any amount of whitespace, CommandLineToArgvW // will consider the first argument to be an empty string. Excess whitespace at the // end of lpCmdLine is ignored." - 0...SPACE => { + 0..=SPACE => { ret_val.push(OsString::new()); &cmd_line[1..] }, @@ -192,8 +193,8 @@ impl ExactSizeIterator for Args { #[cfg(test)] mod tests { - use sys::windows::args::*; - use ffi::OsString; + use crate::sys::windows::args::*; + use crate::ffi::OsString; fn chk(string: &str, parts: &[&str]) { let mut wide: Vec = OsString::from(string).encode_wide().collect(); diff --git a/src/libstd/sys/windows/backtrace/backtrace_gnu.rs b/src/libstd/sys/windows/backtrace/backtrace_gnu.rs index e8aa93997423..7ac1f8122f78 100644 --- a/src/libstd/sys/windows/backtrace/backtrace_gnu.rs +++ b/src/libstd/sys/windows/backtrace/backtrace_gnu.rs @@ -1,10 +1,11 @@ -use io; -use sys::c; +use crate::io; +use crate::sys::c; +use crate::path::PathBuf; +use crate::fs::{OpenOptions, File}; +use crate::sys::ext::fs::OpenOptionsExt; +use crate::sys::handle::Handle; + use libc::c_char; -use path::PathBuf; -use fs::{OpenOptions, File}; -use sys::ext::fs::OpenOptionsExt; -use sys::handle::Handle; use super::super::{fill_utf16_buf, os2path, to_u16s, wide_char_to_multi_byte}; fn query_full_process_image_name() -> io::Result { diff --git a/src/libstd/sys/windows/backtrace/mod.rs b/src/libstd/sys/windows/backtrace/mod.rs index 4bda8ac91da6..c5b0cc872108 100644 --- a/src/libstd/sys/windows/backtrace/mod.rs +++ b/src/libstd/sys/windows/backtrace/mod.rs @@ -14,13 +14,14 @@ #![allow(deprecated)] // dynamic_lib -use io; +use crate::io; +use crate::mem; +use crate::ptr; +use crate::sys::c; +use crate::sys::dynamic_lib::DynamicLibrary; +use crate::sys_common::backtrace::Frame; + use libc::c_void; -use mem; -use ptr; -use sys::c; -use sys::dynamic_lib::DynamicLibrary; -use sys_common::backtrace::Frame; macro_rules! sym { ($lib:expr, $e:expr, $t:ident) => ( diff --git a/src/libstd/sys/windows/backtrace/printing/mod.rs b/src/libstd/sys/windows/backtrace/printing/mod.rs index d44df7e5f248..9497d51ac179 100644 --- a/src/libstd/sys/windows/backtrace/printing/mod.rs +++ b/src/libstd/sys/windows/backtrace/printing/mod.rs @@ -4,11 +4,11 @@ mod printing; #[cfg(target_env = "gnu")] mod printing { - pub use sys_common::gnu::libbacktrace::{foreach_symbol_fileline, resolve_symname}; + pub use crate::sys_common::gnu::libbacktrace::{foreach_symbol_fileline, resolve_symname}; // dummy functions to mirror those present in msvc version. - use sys::dynamic_lib::DynamicLibrary; - use io; + use crate::sys::dynamic_lib::DynamicLibrary; + use crate::io; pub struct PrintingFnsEx {} pub struct PrintingFns64 {} pub fn load_printing_fns_ex(_: &DynamicLibrary) -> io::Result { diff --git a/src/libstd/sys/windows/backtrace/printing/msvc.rs b/src/libstd/sys/windows/backtrace/printing/msvc.rs index b186bb423345..13a1512d0eb3 100644 --- a/src/libstd/sys/windows/backtrace/printing/msvc.rs +++ b/src/libstd/sys/windows/backtrace/printing/msvc.rs @@ -1,12 +1,13 @@ -use ffi::CStr; -use io; +use crate::ffi::CStr; +use crate::io; +use crate::mem; +use crate::sys::backtrace::BacktraceContext; +use crate::sys::backtrace::StackWalkVariant; +use crate::sys::c; +use crate::sys::dynamic_lib::DynamicLibrary; +use crate::sys_common::backtrace::Frame; + use libc::{c_char, c_ulong}; -use mem; -use sys::backtrace::BacktraceContext; -use sys::backtrace::StackWalkVariant; -use sys::c; -use sys::dynamic_lib::DynamicLibrary; -use sys_common::backtrace::Frame; // Structs holding printing functions and loaders for them // Two versions depending on whether dbghelp.dll has StackWalkEx or not @@ -190,7 +191,7 @@ where { unsafe { let mut line: c::IMAGEHLP_LINE64 = mem::zeroed(); - line.SizeOfStruct = ::mem::size_of::() as u32; + line.SizeOfStruct = mem::size_of::() as u32; let ret = line_getter( context.handle, diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index a78b599204b2..518eccf754cf 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -4,11 +4,12 @@ #![cfg_attr(test, allow(dead_code))] #![unstable(issue = "0", feature = "windows_c")] -use os::raw::{c_int, c_uint, c_ulong, c_long, c_longlong, c_ushort, c_char}; +use crate::os::raw::{c_int, c_uint, c_ulong, c_long, c_longlong, c_ushort, c_char}; #[cfg(target_arch = "x86_64")] -use os::raw::c_ulonglong; +use crate::os::raw::c_ulonglong; +use crate::ptr; + use libc::{wchar_t, size_t, c_void}; -use ptr; pub use self::FILE_INFO_BY_HANDLE_CLASS::*; pub use self::EXCEPTION_DISPOSITION::*; @@ -65,7 +66,7 @@ pub type PCONDITION_VARIABLE = *mut CONDITION_VARIABLE; pub type PLARGE_INTEGER = *mut c_longlong; pub type PSRWLOCK = *mut SRWLOCK; -pub type SOCKET = ::os::windows::raw::SOCKET; +pub type SOCKET = crate::os::windows::raw::SOCKET; pub type socklen_t = c_int; pub type ADDRESS_FAMILY = USHORT; @@ -450,7 +451,7 @@ pub struct MOUNT_POINT_REPARSE_BUFFER { pub PathBuffer: WCHAR, } -pub type LPPROGRESS_ROUTINE = ::option::Option Option { let mut module: Vec = module.encode_utf16().collect(); @@ -44,14 +44,14 @@ macro_rules! compat_fn { )*) => ($( #[allow(unused_variables)] pub unsafe fn $symbol($($argname: $argtype),*) -> $rettype { - use sync::atomic::{AtomicUsize, Ordering}; - use mem; + use crate::sync::atomic::{AtomicUsize, Ordering}; + use crate::mem; type F = unsafe extern "system" fn($($argtype),*) -> $rettype; static PTR: AtomicUsize = AtomicUsize::new(0); fn load() -> usize { - ::sys::compat::store_func(&PTR, + crate::sys::compat::store_func(&PTR, stringify!($module), stringify!($symbol), fallback as usize) diff --git a/src/libstd/sys/windows/condvar.rs b/src/libstd/sys/windows/condvar.rs index 48d8af739130..62835ea7c94f 100644 --- a/src/libstd/sys/windows/condvar.rs +++ b/src/libstd/sys/windows/condvar.rs @@ -1,8 +1,8 @@ -use cell::UnsafeCell; -use sys::c; -use sys::mutex::{self, Mutex}; -use sys::os; -use time::Duration; +use crate::cell::UnsafeCell; +use crate::sys::c; +use crate::sys::mutex::{self, Mutex}; +use crate::sys::os; +use crate::time::Duration; pub struct Condvar { inner: UnsafeCell } diff --git a/src/libstd/sys/windows/dynamic_lib.rs b/src/libstd/sys/windows/dynamic_lib.rs index fa3c5ecb9776..b9d5105cb730 100644 --- a/src/libstd/sys/windows/dynamic_lib.rs +++ b/src/libstd/sys/windows/dynamic_lib.rs @@ -1,8 +1,8 @@ -use os::windows::prelude::*; +use crate::os::windows::prelude::*; -use ffi::{CString, OsStr}; -use io; -use sys::c; +use crate::ffi::{CString, OsStr}; +use crate::io; +use crate::sys::c; pub struct DynamicLibrary { handle: c::HMODULE, diff --git a/src/libstd/sys/windows/ext/ffi.rs b/src/libstd/sys/windows/ext/ffi.rs index 6508c0cf447d..547b1ef796b4 100644 --- a/src/libstd/sys/windows/ext/ffi.rs +++ b/src/libstd/sys/windows/ext/ffi.rs @@ -59,13 +59,13 @@ #![stable(feature = "rust1", since = "1.0.0")] -use ffi::{OsString, OsStr}; -use sys::os_str::Buf; -use sys_common::wtf8::Wtf8Buf; -use sys_common::{FromInner, AsInner}; +use crate::ffi::{OsString, OsStr}; +use crate::sys::os_str::Buf; +use crate::sys_common::wtf8::Wtf8Buf; +use crate::sys_common::{FromInner, AsInner}; #[stable(feature = "rust1", since = "1.0.0")] -pub use sys_common::wtf8::EncodeWide; +pub use crate::sys_common::wtf8::EncodeWide; /// Windows-specific extensions to [`OsString`]. /// diff --git a/src/libstd/sys/windows/ext/fs.rs b/src/libstd/sys/windows/ext/fs.rs index 89038da6295f..b6da59502806 100644 --- a/src/libstd/sys/windows/ext/fs.rs +++ b/src/libstd/sys/windows/ext/fs.rs @@ -2,11 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs::{self, OpenOptions, Metadata}; -use io; -use path::Path; -use sys; -use sys_common::{AsInnerMut, AsInner}; +use crate::fs::{self, OpenOptions, Metadata}; +use crate::io; +use crate::path::Path; +use crate::sys; +use crate::sys_common::{AsInnerMut, AsInner}; /// Windows-specific extensions to [`File`]. /// diff --git a/src/libstd/sys/windows/ext/io.rs b/src/libstd/sys/windows/ext/io.rs index fbe0426ce5a8..1a7d734b89e4 100644 --- a/src/libstd/sys/windows/ext/io.rs +++ b/src/libstd/sys/windows/ext/io.rs @@ -1,12 +1,12 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs; -use os::windows::raw; -use net; -use sys_common::{self, AsInner, FromInner, IntoInner}; -use sys; -use io; -use sys::c; +use crate::fs; +use crate::os::windows::raw; +use crate::net; +use crate::sys_common::{self, AsInner, FromInner, IntoInner}; +use crate::sys; +use crate::sys::c; +use crate::io; /// Raw HANDLEs. #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/sys/windows/ext/process.rs b/src/libstd/sys/windows/ext/process.rs index 15f0fd4e11f4..b2e6cdead4f3 100644 --- a/src/libstd/sys/windows/ext/process.rs +++ b/src/libstd/sys/windows/ext/process.rs @@ -2,10 +2,10 @@ #![stable(feature = "process_extensions", since = "1.2.0")] -use os::windows::io::{FromRawHandle, RawHandle, AsRawHandle, IntoRawHandle}; -use process; -use sys; -use sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; +use crate::os::windows::io::{FromRawHandle, RawHandle, AsRawHandle, IntoRawHandle}; +use crate::process; +use crate::sys; +use crate::sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; #[stable(feature = "process_extensions", since = "1.2.0")] impl FromRawHandle for process::Stdio { diff --git a/src/libstd/sys/windows/ext/raw.rs b/src/libstd/sys/windows/ext/raw.rs index 77428d9e7747..d2bab2720369 100644 --- a/src/libstd/sys/windows/ext/raw.rs +++ b/src/libstd/sys/windows/ext/raw.rs @@ -2,7 +2,7 @@ #![stable(feature = "raw_ext", since = "1.1.0")] -use os::raw::c_void; +use crate::os::raw::c_void; #[stable(feature = "raw_ext", since = "1.1.0")] pub type HANDLE = *mut c_void; #[cfg(target_pointer_width = "32")] diff --git a/src/libstd/sys/windows/ext/thread.rs b/src/libstd/sys/windows/ext/thread.rs index 29d612fedc0f..fdc7e7fa32f0 100644 --- a/src/libstd/sys/windows/ext/thread.rs +++ b/src/libstd/sys/windows/ext/thread.rs @@ -2,9 +2,9 @@ #![stable(feature = "thread_extensions", since = "1.9.0")] -use os::windows::io::{RawHandle, AsRawHandle, IntoRawHandle}; -use thread; -use sys_common::{AsInner, IntoInner}; +use crate::os::windows::io::{RawHandle, AsRawHandle, IntoRawHandle}; +use crate::thread; +use crate::sys_common::{AsInner, IntoInner}; #[stable(feature = "thread_extensions", since = "1.9.0")] impl AsRawHandle for thread::JoinHandle { diff --git a/src/libstd/sys/windows/fast_thread_local.rs b/src/libstd/sys/windows/fast_thread_local.rs index f8b936b48103..0ccc67e3fd54 100644 --- a/src/libstd/sys/windows/fast_thread_local.rs +++ b/src/libstd/sys/windows/fast_thread_local.rs @@ -1,7 +1,7 @@ #![unstable(feature = "thread_local_internals", issue = "0")] #![cfg(target_thread_local)] -pub use sys_common::thread_local::register_dtor_fallback as register_dtor; +pub use crate::sys_common::thread_local::register_dtor_fallback as register_dtor; pub fn requires_move_before_drop() -> bool { false diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs index 533b8ae9ba2c..f19c111f09aa 100644 --- a/src/libstd/sys/windows/fs.rs +++ b/src/libstd/sys/windows/fs.rs @@ -1,17 +1,17 @@ -use os::windows::prelude::*; +use crate::os::windows::prelude::*; -use ffi::OsString; -use fmt; -use io::{self, Error, SeekFrom}; -use mem; -use path::{Path, PathBuf}; -use ptr; -use slice; -use sync::Arc; -use sys::handle::Handle; -use sys::time::SystemTime; -use sys::{c, cvt}; -use sys_common::FromInner; +use crate::ffi::OsString; +use crate::fmt; +use crate::io::{self, Error, SeekFrom}; +use crate::mem; +use crate::path::{Path, PathBuf}; +use crate::ptr; +use crate::slice; +use crate::sync::Arc; +use crate::sys::handle::Handle; +use crate::sys::time::SystemTime; +use crate::sys::{c, cvt}; +use crate::sys_common::FromInner; use super::to_u16s; diff --git a/src/libstd/sys/windows/handle.rs b/src/libstd/sys/windows/handle.rs index 855efbd3eb5d..02549088c870 100644 --- a/src/libstd/sys/windows/handle.rs +++ b/src/libstd/sys/windows/handle.rs @@ -1,13 +1,12 @@ #![unstable(issue = "0", feature = "windows_handle")] -use cmp; -use io::{ErrorKind, Read}; -use io; -use mem; -use ops::Deref; -use ptr; -use sys::c; -use sys::cvt; +use crate::cmp; +use crate::io::{self, ErrorKind, Read}; +use crate::mem; +use crate::ops::Deref; +use crate::ptr; +use crate::sys::c; +use crate::sys::cvt; /// An owned container for `HANDLE` object, closing them on Drop. /// diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index 56c76a169feb..1425254a2e12 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -1,11 +1,11 @@ #![allow(missing_docs, nonstandard_style)] -use ptr; -use ffi::{OsStr, OsString}; -use io::ErrorKind; -use os::windows::ffi::{OsStrExt, OsStringExt}; -use path::PathBuf; -use time::Duration; +use crate::ptr; +use crate::ffi::{OsStr, OsString}; +use crate::io::ErrorKind; +use crate::os::windows::ffi::{OsStrExt, OsStringExt}; +use crate::path::PathBuf; +use crate::time::Duration; pub use libc::strlen; pub use self::rand::hashmap_random_keys; @@ -76,11 +76,11 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { } } -pub fn to_u16s>(s: S) -> ::io::Result> { - fn inner(s: &OsStr) -> ::io::Result> { +pub fn to_u16s>(s: S) -> crate::io::Result> { + fn inner(s: &OsStr) -> crate::io::Result> { let mut maybe_result: Vec = s.encode_wide().collect(); if maybe_result.iter().any(|&u| u == 0) { - return Err(::io::Error::new(::io::ErrorKind::InvalidInput, + return Err(crate::io::Error::new(ErrorKind::InvalidInput, "strings passed to WinAPI cannot contain NULs")); } maybe_result.push(0); @@ -103,7 +103,7 @@ pub fn to_u16s>(s: S) -> ::io::Result> { // Once the syscall has completed (errors bail out early) the second closure is // yielded the data which has been read from the syscall. The return value // from this closure is then the return value of the function. -fn fill_utf16_buf(mut f1: F1, f2: F2) -> ::io::Result +fn fill_utf16_buf(mut f1: F1, f2: F2) -> crate::io::Result where F1: FnMut(*mut u16, c::DWORD) -> c::DWORD, F2: FnOnce(&[u16]) -> T { @@ -135,7 +135,7 @@ fn fill_utf16_buf(mut f1: F1, f2: F2) -> ::io::Result c::SetLastError(0); let k = match f1(buf.as_mut_ptr(), n as c::DWORD) { 0 if c::GetLastError() == 0 => 0, - 0 => return Err(::io::Error::last_os_error()), + 0 => return Err(crate::io::Error::last_os_error()), n => n, } as usize; if k == n && c::GetLastError() == c::ERROR_INSUFFICIENT_BUFFER { @@ -158,7 +158,7 @@ fn wide_char_to_multi_byte(code_page: u32, flags: u32, s: &[u16], no_default_char: bool) - -> ::io::Result> { + -> crate::io::Result> { unsafe { let mut size = c::WideCharToMultiByte(code_page, flags, @@ -169,7 +169,7 @@ fn wide_char_to_multi_byte(code_page: u32, ptr::null(), ptr::null_mut()); if size == 0 { - return Err(::io::Error::last_os_error()); + return Err(crate::io::Error::last_os_error()); } let mut buf = Vec::with_capacity(size as usize); @@ -186,10 +186,10 @@ fn wide_char_to_multi_byte(code_page: u32, if no_default_char { &mut used_default_char } else { ptr::null_mut() }); if size == 0 { - return Err(::io::Error::last_os_error()); + return Err(crate::io::Error::last_os_error()); } if no_default_char && used_default_char == c::TRUE { - return Err(::io::Error::new(::io::ErrorKind::InvalidData, + return Err(crate::io::Error::new(crate::io::ErrorKind::InvalidData, "string cannot be converted to requested code page")); } @@ -221,9 +221,9 @@ macro_rules! impl_is_zero { impl_is_zero! { i8 i16 i32 i64 isize u8 u16 u32 u64 usize } -pub fn cvt(i: I) -> ::io::Result { +pub fn cvt(i: I) -> crate::io::Result { if i.is_zero() { - Err(::io::Error::last_os_error()) + Err(crate::io::Error::last_os_error()) } else { Ok(i) } @@ -263,7 +263,7 @@ pub unsafe fn abort_internal() -> ! { #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { asm!("int $$0x29" :: "{ecx}"(7) ::: volatile); // 7 is FAST_FAIL_FATAL_APP_EXIT - ::intrinsics::unreachable(); + crate::intrinsics::unreachable(); } - ::intrinsics::abort(); + crate::intrinsics::abort(); } diff --git a/src/libstd/sys/windows/mutex.rs b/src/libstd/sys/windows/mutex.rs index f690580ae38b..1aa910f05c9c 100644 --- a/src/libstd/sys/windows/mutex.rs +++ b/src/libstd/sys/windows/mutex.rs @@ -19,11 +19,11 @@ //! CriticalSection is used and we keep track of who's holding the mutex to //! detect recursive locks. -use cell::UnsafeCell; -use mem::{self, MaybeUninit}; -use sync::atomic::{AtomicUsize, Ordering}; -use sys::c; -use sys::compat; +use crate::cell::UnsafeCell; +use crate::mem::{self, MaybeUninit}; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::sys::c; +use crate::sys::compat; pub struct Mutex { lock: AtomicUsize, diff --git a/src/libstd/sys/windows/net.rs b/src/libstd/sys/windows/net.rs index 76be26a9d1a5..1231fd55e252 100644 --- a/src/libstd/sys/windows/net.rs +++ b/src/libstd/sys/windows/net.rs @@ -1,26 +1,27 @@ #![unstable(issue = "0", feature = "windows_net")] -use cmp; -use io::{self, Read, IoVec, IoVecMut}; +use crate::cmp; +use crate::io::{self, Read, IoVec, IoVecMut}; +use crate::mem; +use crate::net::{SocketAddr, Shutdown}; +use crate::ptr; +use crate::sync::Once; +use crate::sys::c; +use crate::sys; +use crate::sys_common::{self, AsInner, FromInner, IntoInner}; +use crate::sys_common::net; +use crate::time::Duration; + use libc::{c_int, c_void, c_ulong, c_long}; -use mem; -use net::{SocketAddr, Shutdown}; -use ptr; -use sync::Once; -use sys::c; -use sys; -use sys_common::{self, AsInner, FromInner, IntoInner}; -use sys_common::net; -use time::Duration; pub type wrlen_t = i32; pub mod netc { - pub use sys::c::*; - pub use sys::c::SOCKADDR as sockaddr; - pub use sys::c::SOCKADDR_STORAGE_LH as sockaddr_storage; - pub use sys::c::ADDRINFOA as addrinfo; - pub use sys::c::ADDRESS_FAMILY as sa_family_t; + pub use crate::sys::c::*; + pub use crate::sys::c::SOCKADDR as sockaddr; + pub use crate::sys::c::SOCKADDR_STORAGE_LH as sockaddr_storage; + pub use crate::sys::c::ADDRINFOA as addrinfo; + pub use crate::sys::c::ADDRESS_FAMILY as sa_family_t; } pub struct Socket(c::SOCKET); diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index 7399dd41a41c..5b433ddfb4a3 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -2,18 +2,18 @@ #![allow(nonstandard_style)] -use os::windows::prelude::*; +use crate::os::windows::prelude::*; -use error::Error as StdError; -use ffi::{OsString, OsStr}; -use fmt; -use io; -use os::windows::ffi::EncodeWide; -use path::{self, PathBuf}; -use ptr; -use slice; -use sys::{c, cvt}; -use sys::handle::Handle; +use crate::error::Error as StdError; +use crate::ffi::{OsString, OsStr}; +use crate::fmt; +use crate::io; +use crate::os::windows::ffi::EncodeWide; +use crate::path::{self, PathBuf}; +use crate::ptr; +use crate::slice; +use crate::sys::{c, cvt}; +use crate::sys::handle::Handle; use super::to_u16s; @@ -285,8 +285,8 @@ pub fn temp_dir() -> PathBuf { } pub fn home_dir() -> Option { - ::env::var_os("HOME").or_else(|| { - ::env::var_os("USERPROFILE") + crate::env::var_os("HOME").or_else(|| { + crate::env::var_os("USERPROFILE") }).map(PathBuf::from).or_else(|| unsafe { let me = c::GetCurrentProcess(); let mut token = ptr::null_mut(); @@ -314,8 +314,8 @@ pub fn getpid() -> u32 { #[cfg(test)] mod tests { - use io::Error; - use sys::c; + use crate::io::Error; + use crate::sys::c; // tests `error_string` above #[test] diff --git a/src/libstd/sys/windows/os_str.rs b/src/libstd/sys/windows/os_str.rs index 7e4bcd990b1e..8befa66ecdc9 100644 --- a/src/libstd/sys/windows/os_str.rs +++ b/src/libstd/sys/windows/os_str.rs @@ -1,13 +1,13 @@ /// The underlying OsString/OsStr implementation on Windows is a /// wrapper around the "WTF-8" encoding; see the `wtf8` module for more. -use borrow::Cow; -use fmt; -use sys_common::wtf8::{Wtf8, Wtf8Buf}; -use mem; -use rc::Rc; -use sync::Arc; -use sys_common::{AsInner, IntoInner, FromInner}; +use crate::borrow::Cow; +use crate::fmt; +use crate::sys_common::wtf8::{Wtf8, Wtf8Buf}; +use crate::mem; +use crate::rc::Rc; +use crate::sync::Arc; +use crate::sys_common::{AsInner, IntoInner, FromInner}; #[derive(Clone, Hash)] pub struct Buf { diff --git a/src/libstd/sys/windows/path.rs b/src/libstd/sys/windows/path.rs index ad1759e84c32..b8532ca9b0d4 100644 --- a/src/libstd/sys/windows/path.rs +++ b/src/libstd/sys/windows/path.rs @@ -1,6 +1,6 @@ -use path::Prefix; -use ffi::OsStr; -use mem; +use crate::path::Prefix; +use crate::ffi::OsStr; +use crate::mem; fn os_str_as_u8_slice(s: &OsStr) -> &[u8] { unsafe { mem::transmute(s) } @@ -20,7 +20,7 @@ pub fn is_verbatim_sep(b: u8) -> bool { } pub fn parse_prefix<'a>(path: &'a OsStr) -> Option { - use path::Prefix::*; + use crate::path::Prefix::*; unsafe { // The unsafety here stems from converting between &OsStr and &[u8] // and back. This is safe to do because (1) we only look at ASCII diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs index d3b102268f63..07f4f5f0e58c 100644 --- a/src/libstd/sys/windows/pipe.rs +++ b/src/libstd/sys/windows/pipe.rs @@ -1,17 +1,17 @@ -use os::windows::prelude::*; +use crate::os::windows::prelude::*; -use ffi::OsStr; -use io; -use mem; -use path::Path; -use ptr; -use slice; -use sync::atomic::Ordering::SeqCst; -use sync::atomic::AtomicUsize; -use sys::c; -use sys::fs::{File, OpenOptions}; -use sys::handle::Handle; -use sys::hashmap_random_keys; +use crate::ffi::OsStr; +use crate::io; +use crate::mem; +use crate::path::Path; +use crate::ptr; +use crate::slice; +use crate::sync::atomic::Ordering::SeqCst; +use crate::sync::atomic::AtomicUsize; +use crate::sys::c; +use crate::sys::fs::{File, OpenOptions}; +use crate::sys::handle::Handle; +use crate::sys::hashmap_random_keys; //////////////////////////////////////////////////////////////////////////////// // Anonymous pipes diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index 2527168a968c..95f061d22bd4 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -1,27 +1,28 @@ #![unstable(feature = "process_internals", issue = "0")] -use collections::BTreeMap; -use env::split_paths; -use env; -use ffi::{OsString, OsStr}; -use fmt; -use fs; -use io::{self, Error, ErrorKind}; +use crate::collections::BTreeMap; +use crate::env::split_paths; +use crate::env; +use crate::ffi::{OsString, OsStr}; +use crate::fmt; +use crate::fs; +use crate::io::{self, Error, ErrorKind}; +use crate::mem; +use crate::os::windows::ffi::OsStrExt; +use crate::path::Path; +use crate::ptr; +use crate::sys::mutex::Mutex; +use crate::sys::c; +use crate::sys::fs::{OpenOptions, File}; +use crate::sys::handle::Handle; +use crate::sys::pipe::{self, AnonPipe}; +use crate::sys::stdio; +use crate::sys::cvt; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::sys_common::process::{CommandEnv, EnvKey}; +use crate::borrow::Borrow; + use libc::{c_void, EXIT_SUCCESS, EXIT_FAILURE}; -use mem; -use os::windows::ffi::OsStrExt; -use path::Path; -use ptr; -use sys::mutex::Mutex; -use sys::c; -use sys::fs::{OpenOptions, File}; -use sys::handle::Handle; -use sys::pipe::{self, AnonPipe}; -use sys::stdio; -use sys::cvt; -use sys_common::{AsInner, FromInner, IntoInner}; -use sys_common::process::{CommandEnv, EnvKey}; -use borrow::Borrow; //////////////////////////////////////////////////////////////////////////////// // Command @@ -537,7 +538,7 @@ fn make_dirp(d: Option<&OsString>) -> io::Result<(*const u16, Vec)> { #[cfg(test)] mod tests { - use ffi::{OsStr, OsString}; + use crate::ffi::{OsStr, OsString}; use super::make_command_line; #[test] diff --git a/src/libstd/sys/windows/rand.rs b/src/libstd/sys/windows/rand.rs index 4f000dceb2f1..0193f4defa1f 100644 --- a/src/libstd/sys/windows/rand.rs +++ b/src/libstd/sys/windows/rand.rs @@ -1,6 +1,6 @@ -use io; -use mem; -use sys::c; +use crate::io; +use crate::mem; +use crate::sys::c; pub fn hashmap_random_keys() -> (u64, u64) { let mut v = (0, 0); diff --git a/src/libstd/sys/windows/rwlock.rs b/src/libstd/sys/windows/rwlock.rs index 3cd19470101a..ef57562fc3a0 100644 --- a/src/libstd/sys/windows/rwlock.rs +++ b/src/libstd/sys/windows/rwlock.rs @@ -1,5 +1,5 @@ -use cell::UnsafeCell; -use sys::c; +use crate::cell::UnsafeCell; +use crate::sys::c; pub struct RWLock { inner: UnsafeCell } diff --git a/src/libstd/sys/windows/stack_overflow.rs b/src/libstd/sys/windows/stack_overflow.rs index 0c7de0bc9e8f..d5b7765f9ff5 100644 --- a/src/libstd/sys/windows/stack_overflow.rs +++ b/src/libstd/sys/windows/stack_overflow.rs @@ -1,7 +1,7 @@ #![cfg_attr(test, allow(dead_code))] -use sys_common::util::report_overflow; -use sys::c; +use crate::sys_common::util::report_overflow; +use crate::sys::c; pub struct Handler; diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs index 99445f4e0d45..b2beaca41b1d 100644 --- a/src/libstd/sys/windows/stdio.rs +++ b/src/libstd/sys/windows/stdio.rs @@ -1,13 +1,13 @@ #![unstable(issue = "0", feature = "windows_stdio")] -use char::decode_utf16; -use cmp; -use io; -use ptr; -use str; -use sys::c; -use sys::cvt; -use sys::handle::Handle; +use crate::char::decode_utf16; +use crate::cmp; +use crate::io; +use crate::ptr; +use crate::str; +use crate::sys::c; +use crate::sys::cvt; +use crate::sys::handle::Handle; // Don't cache handles but get them fresh for every read/write. This allows us to track changes to // the value over time (such as if a process calls `SetStdHandle` while it's running). See #40490. diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs index bd7cb673a0db..1b0a811f13b7 100644 --- a/src/libstd/sys/windows/thread.rs +++ b/src/libstd/sys/windows/thread.rs @@ -1,13 +1,14 @@ -use boxed::FnBox; -use io; -use ffi::CStr; -use mem; +use crate::boxed::FnBox; +use crate::io; +use crate::ffi::CStr; +use crate::mem; +use crate::ptr; +use crate::sys::c; +use crate::sys::handle::Handle; +use crate::sys_common::thread::*; +use crate::time::Duration; + use libc::c_void; -use ptr; -use sys::c; -use sys::handle::Handle; -use sys_common::thread::*; -use time::Duration; use super::to_u16s; diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs index 50bbd5476b36..4c9734fa0aa6 100644 --- a/src/libstd/sys/windows/thread_local.rs +++ b/src/libstd/sys/windows/thread_local.rs @@ -1,8 +1,8 @@ -use mem; -use ptr; -use sync::atomic::AtomicPtr; -use sync::atomic::Ordering::SeqCst; -use sys::c; +use crate::mem; +use crate::ptr; +use crate::sync::atomic::AtomicPtr; +use crate::sync::atomic::Ordering::SeqCst; +use crate::sys::c; pub type Key = c::DWORD; pub type Dtor = unsafe extern fn(*mut u8); @@ -211,7 +211,7 @@ unsafe extern "system" fn on_tls_callback(h: c::LPVOID, #[cfg(target_env = "msvc")] unsafe fn reference_tls_used() { extern { static _tls_used: u8; } - ::intrinsics::volatile_load(&_tls_used); + crate::intrinsics::volatile_load(&_tls_used); } #[cfg(not(target_env = "msvc"))] unsafe fn reference_tls_used() {} diff --git a/src/libstd/sys/windows/time.rs b/src/libstd/sys/windows/time.rs index 8a8159af2f1a..2c99bca70095 100644 --- a/src/libstd/sys/windows/time.rs +++ b/src/libstd/sys/windows/time.rs @@ -1,9 +1,10 @@ -use cmp::Ordering; -use fmt; -use mem; -use sys::c; -use time::Duration; -use convert::TryInto; +use crate::cmp::Ordering; +use crate::fmt; +use crate::mem; +use crate::sys::c; +use crate::time::Duration; +use crate::convert::TryInto; + use core::hash::{Hash, Hasher}; const NANOS_PER_SEC: u64 = 1_000_000_000; @@ -172,11 +173,11 @@ fn intervals2dur(intervals: u64) -> Duration { mod perf_counter { use super::{NANOS_PER_SEC}; - use sync::Once; - use sys_common::mul_div_u64; - use sys::c; - use sys::cvt; - use time::Duration; + use crate::sync::Once; + use crate::sys_common::mul_div_u64; + use crate::sys::c; + use crate::sys::cvt; + use crate::time::Duration; pub struct PerformanceCounterInstant { ts: c::LARGE_INTEGER diff --git a/src/libstd/sys_common/alloc.rs b/src/libstd/sys_common/alloc.rs index eac6bb454c0c..978a70bee098 100644 --- a/src/libstd/sys_common/alloc.rs +++ b/src/libstd/sys_common/alloc.rs @@ -1,8 +1,8 @@ #![allow(dead_code)] -use alloc::{GlobalAlloc, Layout, System}; -use cmp; -use ptr; +use crate::alloc::{GlobalAlloc, Layout, System}; +use crate::cmp; +use crate::ptr; // The minimum alignment guaranteed by the architecture. This value is used to // add fast paths for low alignment values. diff --git a/src/libstd/sys_common/at_exit_imp.rs b/src/libstd/sys_common/at_exit_imp.rs index cd2d176c2a5c..1181b8616119 100644 --- a/src/libstd/sys_common/at_exit_imp.rs +++ b/src/libstd/sys_common/at_exit_imp.rs @@ -2,10 +2,10 @@ //! //! Documentation can be found on the `rt::at_exit` function. -use boxed::FnBox; -use ptr; -use mem; -use sys_common::mutex::Mutex; +use crate::boxed::FnBox; +use crate::ptr; +use crate::mem; +use crate::sys_common::mutex::Mutex; type Queue = Vec>; diff --git a/src/libstd/sys_common/backtrace.rs b/src/libstd/sys_common/backtrace.rs index 347244b0e0d4..1a80908779e1 100644 --- a/src/libstd/sys_common/backtrace.rs +++ b/src/libstd/sys_common/backtrace.rs @@ -1,17 +1,18 @@ /// Common code for printing the backtrace in the same way across the different /// supported platforms. -use env; -use io::prelude::*; -use io; -use path::{self, Path}; -use ptr; -use rustc_demangle::demangle; -use str; -use sync::atomic::{self, Ordering}; -use sys::mutex::Mutex; +use crate::env; +use crate::io::prelude::*; +use crate::io; +use crate::path::{self, Path}; +use crate::ptr; +use crate::str; +use crate::sync::atomic::{self, Ordering}; +use crate::sys::mutex::Mutex; -pub use sys::backtrace::{ +use rustc_demangle::demangle; + +pub use crate::sys::backtrace::{ unwind_backtrace, resolve_symname, foreach_symbol_fileline, diff --git a/src/libstd/sys_common/bytestring.rs b/src/libstd/sys_common/bytestring.rs index 915c17374ca0..273d586a5a0b 100644 --- a/src/libstd/sys_common/bytestring.rs +++ b/src/libstd/sys_common/bytestring.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] -use fmt::{Formatter, Result, Write}; +use crate::fmt::{Formatter, Result, Write}; use core::str::lossy::{Utf8Lossy, Utf8LossyChunk}; pub fn debug_fmt_bytestring(slice: &[u8], f: &mut Formatter) -> Result { @@ -25,7 +25,7 @@ pub fn debug_fmt_bytestring(slice: &[u8], f: &mut Formatter) -> Result { #[cfg(test)] mod tests { use super::*; - use fmt::{Formatter, Result, Debug}; + use crate::fmt::{Formatter, Result, Debug}; #[test] fn smoke() { diff --git a/src/libstd/sys_common/condvar.rs b/src/libstd/sys_common/condvar.rs index ad95879f0735..fc59c8356f46 100644 --- a/src/libstd/sys_common/condvar.rs +++ b/src/libstd/sys_common/condvar.rs @@ -1,6 +1,6 @@ -use time::Duration; -use sys_common::mutex::{self, Mutex}; -use sys::condvar as imp; +use crate::time::Duration; +use crate::sys_common::mutex::{self, Mutex}; +use crate::sys::condvar as imp; /// An OS-based condition variable. /// diff --git a/src/libstd/sys_common/gnu/libbacktrace.rs b/src/libstd/sys_common/gnu/libbacktrace.rs index 188eb4e4b86b..6cd050242dd9 100644 --- a/src/libstd/sys_common/gnu/libbacktrace.rs +++ b/src/libstd/sys_common/gnu/libbacktrace.rs @@ -1,12 +1,11 @@ -use libc; -use backtrace_sys::{self, backtrace_state}; +use backtrace_sys::backtrace_state; -use ffi::CStr; -use io; -use mem; -use ptr; -use sys::backtrace::BacktraceContext; -use sys_common::backtrace::Frame; +use crate::ffi::CStr; +use crate::io; +use crate::mem; +use crate::ptr; +use crate::sys::backtrace::BacktraceContext; +use crate::sys_common::backtrace::Frame; pub fn foreach_symbol_fileline(frame: Frame, mut f: F, @@ -153,7 +152,7 @@ unsafe fn init_state() -> *mut backtrace_state { static mut STATE: *mut backtrace_state = ptr::null_mut(); if !STATE.is_null() { return STATE } - let filename = match ::sys::backtrace::gnu::get_executable_filename() { + let filename = match crate::sys::backtrace::gnu::get_executable_filename() { Ok((filename, file)) => { // filename is purposely leaked here since libbacktrace requires // it to stay allocated permanently, file is also leaked so that diff --git a/src/libstd/sys_common/io.rs b/src/libstd/sys_common/io.rs index b9071c69b7ce..44b0963302dd 100644 --- a/src/libstd/sys_common/io.rs +++ b/src/libstd/sys_common/io.rs @@ -3,10 +3,10 @@ pub const DEFAULT_BUF_SIZE: usize = 8 * 1024; #[cfg(test)] #[allow(dead_code)] // not used on emscripten pub mod test { - use path::{Path, PathBuf}; - use env; - use rand::{self, RngCore}; - use fs; + use crate::path::{Path, PathBuf}; + use crate::env; + use crate::fs; + use rand::RngCore; pub struct TempDir(PathBuf); diff --git a/src/libstd/sys_common/mod.rs b/src/libstd/sys_common/mod.rs index c18b603a6356..1fc32365408b 100644 --- a/src/libstd/sys_common/mod.rs +++ b/src/libstd/sys_common/mod.rs @@ -15,11 +15,11 @@ #![allow(missing_docs)] #![allow(missing_debug_implementations)] -use sync::Once; -use sys; +use crate::sync::Once; +use crate::sys; macro_rules! rtabort { - ($($t:tt)*) => (::sys_common::util::abort(format_args!($($t)*))) + ($($t:tt)*) => (crate::sys_common::util::abort(format_args!($($t)*))) } macro_rules! rtassert { @@ -52,7 +52,7 @@ cfg_if! { target_os = "redox", all(target_arch = "wasm32", not(target_os = "emscripten")), all(target_vendor = "fortanix", target_env = "sgx")))] { - pub use sys::net; + pub use crate::sys::net; } else { pub mod net; } diff --git a/src/libstd/sys_common/mutex.rs b/src/libstd/sys_common/mutex.rs index b47d8698c605..4b58cac7941b 100644 --- a/src/libstd/sys_common/mutex.rs +++ b/src/libstd/sys_common/mutex.rs @@ -1,4 +1,4 @@ -use sys::mutex as imp; +use crate::sys::mutex as imp; /// An OS-based mutual exclusion lock. /// diff --git a/src/libstd/sys_common/net.rs b/src/libstd/sys_common/net.rs index 0d60593ce1f2..36721171b173 100644 --- a/src/libstd/sys_common/net.rs +++ b/src/libstd/sys_common/net.rs @@ -1,37 +1,38 @@ -use cmp; -use ffi::CString; -use fmt; -use io::{self, Error, ErrorKind, IoVec, IoVecMut}; +use crate::cmp; +use crate::ffi::CString; +use crate::fmt; +use crate::io::{self, Error, ErrorKind, IoVec, IoVecMut}; +use crate::mem; +use crate::net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; +use crate::ptr; +use crate::sys::net::{cvt, cvt_r, cvt_gai, Socket, init, wrlen_t}; +use crate::sys::net::netc as c; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::time::Duration; +use crate::convert::{TryFrom, TryInto}; + use libc::{c_int, c_void}; -use mem; -use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; -use ptr; -use sys::net::{cvt, cvt_r, cvt_gai, Socket, init, wrlen_t}; -use sys::net::netc as c; -use sys_common::{AsInner, FromInner, IntoInner}; -use time::Duration; -use convert::{TryFrom, TryInto}; #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "haiku", target_os = "l4re"))] -use sys::net::netc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP; +use crate::sys::net::netc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP; #[cfg(not(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "haiku", target_os = "l4re")))] -use sys::net::netc::IPV6_ADD_MEMBERSHIP; +use crate::sys::net::netc::IPV6_ADD_MEMBERSHIP; #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "haiku", target_os = "l4re"))] -use sys::net::netc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP; +use crate::sys::net::netc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP; #[cfg(not(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "haiku", target_os = "l4re")))] -use sys::net::netc::IPV6_DROP_MEMBERSHIP; +use crate::sys::net::netc::IPV6_DROP_MEMBERSHIP; #[cfg(any(target_os = "linux", target_os = "android", target_os = "dragonfly", target_os = "freebsd", @@ -109,8 +110,8 @@ fn to_ipv6mr_interface(value: u32) -> c_int { } #[cfg(not(target_os = "android"))] -fn to_ipv6mr_interface(value: u32) -> ::libc::c_uint { - value as ::libc::c_uint +fn to_ipv6mr_interface(value: u32) -> libc::c_uint { + value as libc::c_uint } //////////////////////////////////////////////////////////////////////////////// @@ -653,7 +654,7 @@ impl fmt::Debug for UdpSocket { #[cfg(test)] mod tests { use super::*; - use collections::HashMap; + use crate::collections::HashMap; #[test] fn no_lookup_host_duplicates() { diff --git a/src/libstd/sys_common/poison.rs b/src/libstd/sys_common/poison.rs index 1358916ef993..d22942356664 100644 --- a/src/libstd/sys_common/poison.rs +++ b/src/libstd/sys_common/poison.rs @@ -1,7 +1,7 @@ -use error::{Error}; -use fmt; -use sync::atomic::{AtomicBool, Ordering}; -use thread; +use crate::error::{Error}; +use crate::fmt; +use crate::sync::atomic::{AtomicBool, Ordering}; +use crate::thread; pub struct Flag { failed: AtomicBool } diff --git a/src/libstd/sys_common/process.rs b/src/libstd/sys_common/process.rs index 3384ffeb64e9..4d40dec97245 100644 --- a/src/libstd/sys_common/process.rs +++ b/src/libstd/sys_common/process.rs @@ -1,10 +1,10 @@ #![allow(dead_code)] #![unstable(feature = "process_internals", issue = "0")] -use ffi::{OsStr, OsString}; -use env; -use collections::BTreeMap; -use borrow::Borrow; +use crate::ffi::{OsStr, OsString}; +use crate::env; +use crate::collections::BTreeMap; +use crate::borrow::Borrow; pub trait EnvKey: From + Into + diff --git a/src/libstd/sys_common/remutex.rs b/src/libstd/sys_common/remutex.rs index 596e5d534c29..2aec361d7a49 100644 --- a/src/libstd/sys_common/remutex.rs +++ b/src/libstd/sys_common/remutex.rs @@ -1,9 +1,9 @@ -use fmt; -use marker; -use ops::Deref; -use sys_common::poison::{self, TryLockError, TryLockResult, LockResult}; -use sys::mutex as sys; -use panic::{UnwindSafe, RefUnwindSafe}; +use crate::fmt; +use crate::marker; +use crate::ops::Deref; +use crate::sys_common::poison::{self, TryLockError, TryLockResult, LockResult}; +use crate::sys::mutex as sys; +use crate::panic::{UnwindSafe, RefUnwindSafe}; /// A re-entrant mutual exclusion /// @@ -159,10 +159,10 @@ impl Drop for ReentrantMutexGuard<'_, T> { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; - use cell::RefCell; - use sync::Arc; - use thread; + use crate::sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; + use crate::cell::RefCell; + use crate::sync::Arc; + use crate::thread; #[test] fn smoke() { diff --git a/src/libstd/sys_common/rwlock.rs b/src/libstd/sys_common/rwlock.rs index 0aa0284539a8..0b1a092de542 100644 --- a/src/libstd/sys_common/rwlock.rs +++ b/src/libstd/sys_common/rwlock.rs @@ -1,4 +1,4 @@ -use sys::rwlock as imp; +use crate::sys::rwlock as imp; /// An OS-based reader-writer lock. /// diff --git a/src/libstd/sys_common/thread.rs b/src/libstd/sys_common/thread.rs index fe9ad7623b7d..b2142e753085 100644 --- a/src/libstd/sys_common/thread.rs +++ b/src/libstd/sys_common/thread.rs @@ -1,8 +1,8 @@ -use boxed::FnBox; -use env; -use sync::atomic::{self, Ordering}; -use sys::stack_overflow; -use sys::thread as imp; +use crate::boxed::FnBox; +use crate::env; +use crate::sync::atomic::{self, Ordering}; +use crate::sys::stack_overflow; +use crate::sys::thread as imp; #[allow(dead_code)] pub unsafe fn start_thread(main: *mut u8) { diff --git a/src/libstd/sys_common/thread_info.rs b/src/libstd/sys_common/thread_info.rs index b4bca72b09d1..b3c21ec508a9 100644 --- a/src/libstd/sys_common/thread_info.rs +++ b/src/libstd/sys_common/thread_info.rs @@ -1,8 +1,8 @@ #![allow(dead_code)] // stack_guard isn't used right now on all platforms -use cell::RefCell; -use sys::thread::guard::Guard; -use thread::Thread; +use crate::cell::RefCell; +use crate::sys::thread::guard::Guard; +use crate::thread::Thread; struct ThreadInfo { stack_guard: Option, diff --git a/src/libstd/sys_common/thread_local.rs b/src/libstd/sys_common/thread_local.rs index 874e58dcfeee..bdf79002e906 100644 --- a/src/libstd/sys_common/thread_local.rs +++ b/src/libstd/sys_common/thread_local.rs @@ -48,10 +48,10 @@ #![unstable(feature = "thread_local_internals", issue = "0")] #![allow(dead_code)] // sys isn't exported yet -use ptr; -use sync::atomic::{self, AtomicUsize, Ordering}; -use sys::thread_local as imp; -use sys_common::mutex::Mutex; +use crate::ptr; +use crate::sync::atomic::{self, AtomicUsize, Ordering}; +use crate::sys::thread_local as imp; +use crate::sys_common::mutex::Mutex; /// A type for TLS keys that are statically allocated. /// diff --git a/src/libstd/sys_common/util.rs b/src/libstd/sys_common/util.rs index 7dec22be9780..b547d941f3ba 100644 --- a/src/libstd/sys_common/util.rs +++ b/src/libstd/sys_common/util.rs @@ -1,7 +1,7 @@ -use fmt; -use io::prelude::*; -use sys::stdio::panic_output; -use thread; +use crate::fmt; +use crate::io::prelude::*; +use crate::sys::stdio::panic_output; +use crate::thread; pub fn dumb_print(args: fmt::Arguments) { if let Some(mut out) = panic_output() { @@ -16,7 +16,7 @@ pub fn dumb_print(args: fmt::Arguments) { pub fn abort(args: fmt::Arguments) -> ! { dumb_print(format_args!("fatal runtime error: {}\n", args)); - unsafe { ::sys::abort_internal(); } + unsafe { crate::sys::abort_internal(); } } #[allow(dead_code)] // stack overflow detection not enabled on all platforms diff --git a/src/libstd/sys_common/wtf8.rs b/src/libstd/sys_common/wtf8.rs index 6d4594fe295c..b15239e8d877 100644 --- a/src/libstd/sys_common/wtf8.rs +++ b/src/libstd/sys_common/wtf8.rs @@ -17,18 +17,18 @@ use core::str::next_code_point; -use borrow::Cow; -use char; -use fmt; -use hash::{Hash, Hasher}; -use iter::FromIterator; -use mem; -use ops; -use rc::Rc; -use slice; -use str; -use sync::Arc; -use sys_common::AsInner; +use crate::borrow::Cow; +use crate::char; +use crate::fmt; +use crate::hash::{Hash, Hasher}; +use crate::iter::FromIterator; +use crate::mem; +use crate::ops; +use crate::rc::Rc; +use crate::slice; +use crate::str; +use crate::sync::Arc; +use crate::sys_common::AsInner; const UTF8_REPLACEMENT_CHARACTER: &str = "\u{FFFD}"; @@ -413,7 +413,7 @@ impl AsInner<[u8]> for Wtf8 { impl fmt::Debug for Wtf8 { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn write_str_escaped(f: &mut fmt::Formatter, s: &str) -> fmt::Result { - use fmt::Write; + use crate::fmt::Write; for c in s.chars().flat_map(|c| c.escape_debug()) { f.write_char(c)? } @@ -871,7 +871,7 @@ impl Wtf8 { #[cfg(test)] mod tests { - use borrow::Cow; + use crate::borrow::Cow; use super::*; #[test] diff --git a/src/libstd/tests/env.rs b/src/libstd/tests/env.rs index e985c3899af4..06fb5533afdd 100644 --- a/src/libstd/tests/env.rs +++ b/src/libstd/tests/env.rs @@ -1,5 +1,3 @@ -extern crate rand; - use std::env::*; use std::ffi::{OsString, OsStr}; diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 8207709e1f9f..d1f53734d30e 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -2,10 +2,10 @@ #![unstable(feature = "thread_local_internals", issue = "0")] -use cell::UnsafeCell; -use fmt; -use hint; -use mem; +use crate::cell::UnsafeCell; +use crate::fmt; +use crate::hint; +use crate::mem; /// A thread local storage key which owns its contents. /// @@ -310,14 +310,14 @@ impl LocalKey { #[doc(hidden)] #[cfg(all(target_arch = "wasm32", not(target_feature = "atomics")))] pub mod statik { - use cell::UnsafeCell; - use fmt; + use crate::cell::UnsafeCell; + use crate::fmt; pub struct Key { inner: UnsafeCell>, } - unsafe impl ::marker::Sync for Key { } + unsafe impl Sync for Key { } impl fmt::Debug for Key { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -341,11 +341,11 @@ pub mod statik { #[doc(hidden)] #[cfg(target_thread_local)] pub mod fast { - use cell::{Cell, UnsafeCell}; - use fmt; - use mem; - use ptr; - use sys::fast_thread_local::{register_dtor, requires_move_before_drop}; + use crate::cell::{Cell, UnsafeCell}; + use crate::fmt; + use crate::mem; + use crate::ptr; + use crate::sys::fast_thread_local::{register_dtor, requires_move_before_drop}; pub struct Key { inner: UnsafeCell>, @@ -412,11 +412,11 @@ pub mod fast { #[doc(hidden)] pub mod os { - use cell::{Cell, UnsafeCell}; - use fmt; - use marker; - use ptr; - use sys_common::thread_local::StaticKey as OsStaticKey; + use crate::cell::{Cell, UnsafeCell}; + use crate::fmt; + use crate::marker; + use crate::ptr; + use crate::sys_common::thread_local::StaticKey as OsStaticKey; pub struct Key { // OS-TLS key that we'll use to key off. @@ -430,7 +430,7 @@ pub mod os { } } - unsafe impl ::marker::Sync for Key { } + unsafe impl Sync for Key { } struct Value { key: &'static Key, @@ -484,9 +484,9 @@ pub mod os { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use sync::mpsc::{channel, Sender}; - use cell::{Cell, UnsafeCell}; - use thread; + use crate::sync::mpsc::{channel, Sender}; + use crate::cell::{Cell, UnsafeCell}; + use crate::thread; struct Foo(Sender<()>); @@ -632,8 +632,8 @@ mod tests { #[cfg(test)] mod dynamic_tests { - use cell::RefCell; - use collections::HashMap; + use crate::cell::RefCell; + use crate::collections::HashMap; #[test] fn smoke() { diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 438ea3aa3f6a..08f0aa2f0d20 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -156,25 +156,25 @@ #![stable(feature = "rust1", since = "1.0.0")] -use any::Any; -use boxed::FnBox; -use cell::UnsafeCell; -use ffi::{CStr, CString}; -use fmt; -use io; -use mem; -use panic; -use panicking; -use str; -use sync::{Mutex, Condvar, Arc}; -use sync::atomic::AtomicUsize; -use sync::atomic::Ordering::SeqCst; -use sys::thread as imp; -use sys_common::mutex; -use sys_common::thread_info; -use sys_common::thread; -use sys_common::{AsInner, IntoInner}; -use time::Duration; +use crate::any::Any; +use crate::boxed::FnBox; +use crate::cell::UnsafeCell; +use crate::ffi::{CStr, CString}; +use crate::fmt; +use crate::io; +use crate::mem; +use crate::panic; +use crate::panicking; +use crate::str; +use crate::sync::{Mutex, Condvar, Arc}; +use crate::sync::atomic::AtomicUsize; +use crate::sync::atomic::Ordering::SeqCst; +use crate::sys::thread as imp; +use crate::sys_common::mutex; +use crate::sys_common::thread_info; +use crate::sys_common::thread; +use crate::sys_common::{AsInner, IntoInner}; +use crate::time::Duration; //////////////////////////////////////////////////////////////////////////////// // Thread-local storage @@ -466,7 +466,7 @@ impl Builder { thread_info::set(imp::guard::current(), their_thread); #[cfg(feature = "backtrace")] let try_result = panic::catch_unwind(panic::AssertUnwindSafe(|| { - ::sys_common::backtrace::__rust_begin_short_backtrace(f) + crate::sys_common::backtrace::__rust_begin_short_backtrace(f) })); #[cfg(not(feature = "backtrace"))] let try_result = panic::catch_unwind(panic::AssertUnwindSafe(f)); @@ -1051,7 +1051,7 @@ impl ThreadId { // If we somehow use up all our bits, panic so that we're not // covering up subtle bugs of IDs being reused. - if COUNTER == ::u64::MAX { + if COUNTER == crate::u64::MAX { panic!("failed to generate unique thread ID: bitspace exhausted"); } @@ -1290,7 +1290,7 @@ impl fmt::Debug for Thread { /// /// [`Result`]: ../../std/result/enum.Result.html #[stable(feature = "rust1", since = "1.0.0")] -pub type Result = ::result::Result>; +pub type Result = crate::result::Result>; // This packet is used to communicate the return value between the child thread // and the parent thread. Memory is shared through the `Arc` within and there's @@ -1482,13 +1482,13 @@ fn _assert_sync_and_send() { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use any::Any; - use sync::mpsc::{channel, Sender}; - use result; - use super::{Builder}; - use thread; - use time::Duration; - use u32; + use super::Builder; + use crate::any::Any; + use crate::sync::mpsc::{channel, Sender}; + use crate::result; + use crate::thread; + use crate::time::Duration; + use crate::u32; // !!! These tests are dangerous. If something is buggy, they will hang, !!! // !!! instead of exiting cleanly. This might wedge the buildbots. !!! diff --git a/src/libstd/time.rs b/src/libstd/time.rs index e1f5e1fcb938..6d7093ac33ea 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -12,13 +12,13 @@ #![stable(feature = "time", since = "1.3.0")] -use cmp; -use error::Error; -use fmt; -use ops::{Add, Sub, AddAssign, SubAssign}; -use sys::time; -use sys_common::FromInner; -use sys_common::mutex::Mutex; +use crate::cmp; +use crate::error::Error; +use crate::fmt; +use crate::ops::{Add, Sub, AddAssign, SubAssign}; +use crate::sys::time; +use crate::sys_common::FromInner; +use crate::sys_common::mutex::Mutex; #[stable(feature = "time", since = "1.3.0")] pub use core::time::Duration; @@ -713,7 +713,7 @@ mod tests { assert_almost_eq!(a.checked_sub(second).unwrap().checked_add(second).unwrap(), a); // A difference of 80 and 800 years cannot fit inside a 32-bit time_t - if !(cfg!(unix) && ::mem::size_of::<::libc::time_t>() <= 4) { + if !(cfg!(unix) && crate::mem::size_of::() <= 4) { let eighty_years = second * 60 * 60 * 24 * 365 * 80; assert_almost_eq!(a - eighty_years + eighty_years, a); assert_almost_eq!(a - (eighty_years * 10) + (eighty_years * 10), a); From 0749a04fb64f1423e811c280de8206cdc5715004 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Mon, 11 Feb 2019 04:24:34 +0900 Subject: [PATCH 106/381] Fix #[macro_use] extern crate in sys/cloudabi --- src/libstd/sys/cloudabi/abi/bitflags.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libstd/sys/cloudabi/abi/bitflags.rs b/src/libstd/sys/cloudabi/abi/bitflags.rs index f764cc1df5a5..306936213ed1 100644 --- a/src/libstd/sys/cloudabi/abi/bitflags.rs +++ b/src/libstd/sys/cloudabi/abi/bitflags.rs @@ -25,8 +25,7 @@ // ignore-license #[cfg(feature = "bitflags")] -#[macro_use] -extern crate bitflags; +use bitflags::bitflags; // Minimal implementation of bitflags! in case we can't depend on the bitflags // crate. Only implements `bits()` and a `from_bits_truncate()` that doesn't From 2c783c3543f9582bb113253ab4d2277a4b27728f Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Mon, 11 Feb 2019 04:25:30 +0900 Subject: [PATCH 107/381] Revert removed #![feature(nll)] --- src/libstd/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 92197e8014a0..4883c607ad19 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -276,6 +276,7 @@ #![feature(maybe_uninit)] #![feature(needs_panic_runtime)] #![feature(never_type)] +#![feature(nll)] #![feature(non_exhaustive)] #![feature(on_unimplemented)] #![feature(optin_builtin_traits)] From 2af18a2b38d53dad24813e12ef0e468e5cc5d229 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Fri, 15 Feb 2019 20:31:00 +0900 Subject: [PATCH 108/381] Fix errors in test/ui --- src/test/ui/hygiene/no_implicit_prelude.rs | 2 +- src/test/ui/hygiene/no_implicit_prelude.stderr | 11 ++++++++++- src/test/ui/tag-that-dare-not-speak-its-name.rs | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/test/ui/hygiene/no_implicit_prelude.rs b/src/test/ui/hygiene/no_implicit_prelude.rs index 20da78f08dd2..1cd05f4d44c5 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.rs +++ b/src/test/ui/hygiene/no_implicit_prelude.rs @@ -13,7 +13,7 @@ mod bar { } fn f() { ::foo::m!(); - println!(); // OK on 2015 edition (at least for now) + println!(); //~ ERROR cannot find macro `print!` in this scope } } diff --git a/src/test/ui/hygiene/no_implicit_prelude.stderr b/src/test/ui/hygiene/no_implicit_prelude.stderr index 7c9404cee2b8..b1de7700edb3 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.stderr +++ b/src/test/ui/hygiene/no_implicit_prelude.stderr @@ -7,6 +7,15 @@ LL | fn f() { ::bar::m!(); } LL | Vec::new(); //~ ERROR failed to resolve | ^^^ use of undeclared type or module `Vec` +error: cannot find macro `print!` in this scope + --> $DIR/no_implicit_prelude.rs:16:9 + | +LL | println!(); //~ ERROR cannot find macro `print!` in this scope + | ^^^^^^^^^^^ + | + = help: have you added the `#[macro_use]` on the module/import? + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + error[E0599]: no method named `clone` found for type `()` in the current scope --> $DIR/no_implicit_prelude.rs:12:12 | @@ -20,7 +29,7 @@ LL | ().clone() //~ ERROR no method named `clone` found = note: the following trait is implemented but not in scope, perhaps add a `use` for it: `use std::clone::Clone;` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors Some errors occurred: E0433, E0599. For more information about an error, try `rustc --explain E0433`. diff --git a/src/test/ui/tag-that-dare-not-speak-its-name.rs b/src/test/ui/tag-that-dare-not-speak-its-name.rs index 0a7f405746c8..fc9df7a974e8 100644 --- a/src/test/ui/tag-that-dare-not-speak-its-name.rs +++ b/src/test/ui/tag-that-dare-not-speak-its-name.rs @@ -4,7 +4,7 @@ use std::vec::Vec; fn last(v: Vec<&T> ) -> std::option::Option { - panic!(); + ::std::panic!(); } fn main() { From 9d691bd9cee83a4bd49b02849cc3095eb6fc23d7 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Fri, 15 Feb 2019 23:54:05 +0900 Subject: [PATCH 109/381] Fix error in tag-that-dare-not-speak-its-name --- src/test/ui/tag-that-dare-not-speak-its-name.rs | 1 - src/test/ui/tag-that-dare-not-speak-its-name.stderr | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/ui/tag-that-dare-not-speak-its-name.rs b/src/test/ui/tag-that-dare-not-speak-its-name.rs index fc9df7a974e8..9f47b2e9b9f4 100644 --- a/src/test/ui/tag-that-dare-not-speak-its-name.rs +++ b/src/test/ui/tag-that-dare-not-speak-its-name.rs @@ -1,6 +1,5 @@ // Issue #876 -#![no_implicit_prelude] use std::vec::Vec; fn last(v: Vec<&T> ) -> std::option::Option { diff --git a/src/test/ui/tag-that-dare-not-speak-its-name.stderr b/src/test/ui/tag-that-dare-not-speak-its-name.stderr index a0d6b0007d7d..23e3d6652621 100644 --- a/src/test/ui/tag-that-dare-not-speak-its-name.stderr +++ b/src/test/ui/tag-that-dare-not-speak-its-name.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/tag-that-dare-not-speak-its-name.rs:12:20 + --> $DIR/tag-that-dare-not-speak-its-name.rs:11:20 | LL | let x : char = last(y); | ^^^^^^^ expected char, found enum `std::option::Option` From 90dbf59b920054e5808718f4a54323e3653348aa Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sun, 17 Feb 2019 22:35:20 +0900 Subject: [PATCH 110/381] Fix some imports and paths --- src/libstd/lib.rs | 3 --- src/libstd/sys/sgx/abi/usercalls/mod.rs | 2 +- src/libstd/sys/unix/stack_overflow.rs | 1 - src/libstd/sys_common/util.rs | 2 +- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 4883c607ad19..32a168619dfb 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -344,9 +344,6 @@ extern crate unwind; // testing gives test-std access to real-std lang items and globals. See #2912 #[cfg(test)] extern crate std as realstd; -#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] -extern crate fortanix_sgx_abi; - // The standard macros that are not built-in to the compiler. #[macro_use] mod macros; diff --git a/src/libstd/sys/sgx/abi/usercalls/mod.rs b/src/libstd/sys/sgx/abi/usercalls/mod.rs index 7361011e92d3..d84b6154cbeb 100644 --- a/src/libstd/sys/sgx/abi/usercalls/mod.rs +++ b/src/libstd/sys/sgx/abi/usercalls/mod.rs @@ -22,7 +22,7 @@ pub fn read(fd: Fd, buf: &mut [u8]) -> IoResult { #[unstable(feature = "sgx_platform", issue = "56975")] pub fn read_alloc(fd: Fd) -> IoResult> { unsafe { - let userbuf = ByteBuffer { data: ::ptr::null_mut(), len: 0 }; + let userbuf = ByteBuffer { data: crate::ptr::null_mut(), len: 0 }; let mut userbuf = alloc::User::new_from_enclave(&userbuf); raw::read_alloc(fd, userbuf.as_raw_mut_ptr()).from_sgx_result()?; Ok(userbuf.copy_user_buffer()) diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs index cfa019634bd0..8c60bddc2383 100644 --- a/src/libstd/sys/unix/stack_overflow.rs +++ b/src/libstd/sys/unix/stack_overflow.rs @@ -39,7 +39,6 @@ mod imp { use libc::{sigaltstack, SIGSTKSZ, SS_DISABLE}; use libc::{sigaction, SIGBUS, SIG_DFL, SA_SIGINFO, SA_ONSTACK, sighandler_t}; - use libc; use libc::{mmap, munmap}; use libc::{SIGSEGV, PROT_READ, PROT_WRITE, MAP_PRIVATE, MAP_ANON}; use libc::MAP_FAILED; diff --git a/src/libstd/sys_common/util.rs b/src/libstd/sys_common/util.rs index b547d941f3ba..206443a67369 100644 --- a/src/libstd/sys_common/util.rs +++ b/src/libstd/sys_common/util.rs @@ -11,7 +11,7 @@ pub fn dumb_print(args: fmt::Arguments) { // Other platforms should use the appropriate platform-specific mechanism for // aborting the process. If no platform-specific mechanism is available, -// ::intrinsics::abort() may be used instead. The above implementations cover +// crate::intrinsics::abort() may be used instead. The above implementations cover // all targets currently supported by libstd. pub fn abort(args: fmt::Arguments) -> ! { From aad9e29f52988c55cd8cee2bd181a2e3c9d436a4 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 27 Feb 2019 16:15:56 +0900 Subject: [PATCH 111/381] Fix rebase fail --- src/libstd/sys/unix/io.rs | 5 +++-- src/libstd/sys/unix/net.rs | 2 +- src/libstd/sys/windows/io.rs | 6 +++--- src/libstd/sys/windows/stdio.rs | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libstd/sys/unix/io.rs b/src/libstd/sys/unix/io.rs index 65e4c6e05775..eb3fa470a652 100644 --- a/src/libstd/sys/unix/io.rs +++ b/src/libstd/sys/unix/io.rs @@ -1,6 +1,7 @@ -use marker::PhantomData; +use crate::marker::PhantomData; +use crate::slice; + use libc::{iovec, c_void}; -use slice; #[repr(transparent)] pub struct IoVec<'a> { diff --git a/src/libstd/sys/unix/net.rs b/src/libstd/sys/unix/net.rs index 8e8cdf837a9e..7712a41ded46 100644 --- a/src/libstd/sys/unix/net.rs +++ b/src/libstd/sys/unix/net.rs @@ -11,7 +11,7 @@ use crate::cmp; use libc::{c_int, c_void, size_t, sockaddr, socklen_t, EAI_SYSTEM, MSG_PEEK}; -pub use sys::{cvt, cvt_r}; +pub use crate::sys::{cvt, cvt_r}; #[allow(unused_extern_crates)] pub extern crate libc as netc; diff --git a/src/libstd/sys/windows/io.rs b/src/libstd/sys/windows/io.rs index 662e30479238..54dd271c9d66 100644 --- a/src/libstd/sys/windows/io.rs +++ b/src/libstd/sys/windows/io.rs @@ -1,6 +1,6 @@ -use marker::PhantomData; -use slice; -use sys::c; +use crate::marker::PhantomData; +use crate::slice; +use crate::sys::c; #[repr(transparent)] pub struct IoVec<'a> { diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs index b2beaca41b1d..b1e76b3b755d 100644 --- a/src/libstd/sys/windows/stdio.rs +++ b/src/libstd/sys/windows/stdio.rs @@ -201,7 +201,7 @@ fn read_u16s(handle: c::HANDLE, buf: &mut [u16]) -> io::Result { const CTRL_Z: u16 = 0x1A; const CTRL_Z_MASK: c::ULONG = 1 << CTRL_Z; let mut input_control = c::CONSOLE_READCONSOLE_CONTROL { - nLength: ::mem::size_of::() as c::ULONG, + nLength: crate::mem::size_of::() as c::ULONG, nInitialChars: 0, dwCtrlWakeupMask: CTRL_Z_MASK, dwControlKeyState: 0, From a998b1f425bc13d891ed5b28f1b708970f9db4b4 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Wed, 27 Feb 2019 10:56:58 -0500 Subject: [PATCH 112/381] allow specifying attributes for tool lints --- src/librustc/lint/mod.rs | 20 +++++++++++++------ .../ui-fulldeps/auxiliary/lint_tool_test.rs | 6 +++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index dd003e44bea0..496ff568b31b 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -132,14 +132,22 @@ macro_rules! declare_lint { #[macro_export] macro_rules! declare_tool_lint { - ($vis: vis $tool: ident ::$NAME: ident, $Level: ident, $desc: expr) => ( - declare_tool_lint!{$vis $tool::$NAME, $Level, $desc, false} + ( + $(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level: ident, $desc: expr + ) => ( + declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, false} ); - ($vis: vis $tool: ident ::$NAME: ident, $Level: ident, $desc: expr, - report_in_external_macro: $rep: expr) => ( - declare_tool_lint!{$vis $tool::$NAME, $Level, $desc, $rep} + ( + $(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr, + report_in_external_macro: $rep:expr + ) => ( + declare_tool_lint!{$(#[$attr])* $vis $tool::$NAME, $Level, $desc, $rep} ); - ($vis: vis $tool: ident ::$NAME: ident, $Level: ident, $desc: expr, $external: expr) => ( + ( + $(#[$attr:meta])* $vis:vis $tool:ident ::$NAME:ident, $Level:ident, $desc:expr, + $external:expr + ) => ( + $(#[$attr])* $vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint { name: &concat!(stringify!($tool), "::", stringify!($NAME)), default_level: $crate::lint::$Level, diff --git a/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs b/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs index 1a9bd9e66dba..d25a5ea37462 100644 --- a/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs @@ -13,7 +13,11 @@ use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass, use rustc_plugin::Registry; use syntax::ast; declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff"); -declare_tool_lint!(pub clippy::TEST_GROUP, Warn, "Warn about other stuff"); +declare_tool_lint!( + /// Some docs + pub clippy::TEST_GROUP, + Warn, "Warn about other stuff" +); struct Pass; From 3aca176fb24418803f37e999ebcdb1d277b99fe4 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 27 Feb 2019 21:08:15 -0800 Subject: [PATCH 113/381] Update edition-guide --- src/bootstrap/doc.rs | 2 +- src/doc/edition-guide | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 40f0e5ede8bd..e0ad0422a6ce 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -60,7 +60,7 @@ macro_rules! book { // NOTE: When adding a book here, make sure to ALSO build the book by // adding a build step in `src/bootstrap/builder.rs`! book!( - EditionGuide, "src/doc/edition-guide", "edition-guide", RustbookVersion::MdBook1; + EditionGuide, "src/doc/edition-guide", "edition-guide", RustbookVersion::MdBook2; EmbeddedBook, "src/doc/embedded-book", "embedded-book", RustbookVersion::MdBook2; Nomicon, "src/doc/nomicon", "nomicon", RustbookVersion::MdBook1; Reference, "src/doc/reference", "reference", RustbookVersion::MdBook1; diff --git a/src/doc/edition-guide b/src/doc/edition-guide index 419edb885ec1..5f3cc2a56187 160000 --- a/src/doc/edition-guide +++ b/src/doc/edition-guide @@ -1 +1 @@ -Subproject commit 419edb885ec1a98c0747b3907003d79e3e6b93a9 +Subproject commit 5f3cc2a5618700efcde3bc00799744f21fa9ad2e From 797d8ea4789c64bb20869fa7fb0c15e2c09432cf Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 28 Feb 2019 07:32:13 +0100 Subject: [PATCH 114/381] Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const Make `Unique::as_ptr` const without feature attribute as it's unstable Make `NonNull::dangling` and `NonNull::cast` const with `feature = "const_ptr_nonnull"` --- src/libcore/ptr.rs | 8 +++--- src/test/run-pass/consts/const-ptr-nonnull.rs | 17 +++++++++++++ src/test/run-pass/consts/const-ptr-unique.rs | 15 +++++++++++ src/test/ui/consts/const-ptr-nonnull.rs | 11 ++++++++ src/test/ui/consts/const-ptr-nonnull.stderr | 25 +++++++++++++++++++ src/test/ui/consts/const-ptr-unique.rs | 10 ++++++++ src/test/ui/consts/const-ptr-unique.stderr | 14 +++++++++++ 7 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 src/test/run-pass/consts/const-ptr-nonnull.rs create mode 100644 src/test/run-pass/consts/const-ptr-unique.rs create mode 100644 src/test/ui/consts/const-ptr-nonnull.rs create mode 100644 src/test/ui/consts/const-ptr-nonnull.stderr create mode 100644 src/test/ui/consts/const-ptr-unique.rs create mode 100644 src/test/ui/consts/const-ptr-unique.stderr diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 866c8d0896b3..3e1773ff9d25 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -2790,7 +2790,7 @@ impl Unique { } /// Acquires the underlying `*mut` pointer. - pub fn as_ptr(self) -> *mut T { + pub const fn as_ptr(self) -> *mut T { self.pointer as *mut T } @@ -2903,7 +2903,8 @@ impl NonNull { /// some other means. #[stable(feature = "nonnull", since = "1.25.0")] #[inline] - pub fn dangling() -> Self { + #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_ptr_nonnull"))] + pub const fn dangling() -> Self { unsafe { let ptr = mem::align_of::() as *mut T; NonNull::new_unchecked(ptr) @@ -2966,7 +2967,8 @@ impl NonNull { /// Cast to a pointer of another type #[stable(feature = "nonnull_cast", since = "1.27.0")] #[inline] - pub fn cast(self) -> NonNull { + #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_ptr_nonnull"))] + pub const fn cast(self) -> NonNull { unsafe { NonNull::new_unchecked(self.as_ptr() as *mut U) } diff --git a/src/test/run-pass/consts/const-ptr-nonnull.rs b/src/test/run-pass/consts/const-ptr-nonnull.rs new file mode 100644 index 000000000000..91624e92fbe7 --- /dev/null +++ b/src/test/run-pass/consts/const-ptr-nonnull.rs @@ -0,0 +1,17 @@ +// run-pass + +#![feature(const_ptr_nonnull)] + +use std::ptr::NonNull; + +const DANGLING: NonNull = NonNull::dangling(); +const CASTED: NonNull = NonNull::cast(NonNull::::dangling()); + +fn ident(ident: T) -> T { + ident +} + +pub fn main() { + assert_eq!(DANGLING, ident(NonNull::dangling())); + assert_eq!(CASTED, ident(NonNull::dangling())); +} diff --git a/src/test/run-pass/consts/const-ptr-unique.rs b/src/test/run-pass/consts/const-ptr-unique.rs new file mode 100644 index 000000000000..eb371ab18416 --- /dev/null +++ b/src/test/run-pass/consts/const-ptr-unique.rs @@ -0,0 +1,15 @@ +// run-pass + +#![feature(ptr_internals)] + +use std::ptr::Unique; + +const PTR: *mut u32 = Unique::empty().as_ptr(); + +fn ident(ident: T) -> T { + ident +} + +pub fn main() { + assert_eq!(PTR, ident(Unique::::empty().as_ptr())); +} diff --git a/src/test/ui/consts/const-ptr-nonnull.rs b/src/test/ui/consts/const-ptr-nonnull.rs new file mode 100644 index 000000000000..54e743aa32e2 --- /dev/null +++ b/src/test/ui/consts/const-ptr-nonnull.rs @@ -0,0 +1,11 @@ +use std::ptr::NonNull; + +fn main() { + let x: &'static NonNull = &(NonNull::dangling()); + //~^ ERROR borrowed value does not live long enough + + let mut i: i32 = 10; + let non_null = NonNull::new(&mut i).unwrap(); + let x: &'static NonNull = &(non_null.cast()); + //~^ ERROR borrowed value does not live long enough +} diff --git a/src/test/ui/consts/const-ptr-nonnull.stderr b/src/test/ui/consts/const-ptr-nonnull.stderr new file mode 100644 index 000000000000..a9476dda6d32 --- /dev/null +++ b/src/test/ui/consts/const-ptr-nonnull.stderr @@ -0,0 +1,25 @@ +error[E0597]: borrowed value does not live long enough + --> $DIR/const-ptr-nonnull.rs:4:37 + | +LL | let x: &'static NonNull = &(NonNull::dangling()); + | ^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough +... +LL | } + | - temporary value only lives until here + | + = note: borrowed value must be valid for the static lifetime... + +error[E0597]: borrowed value does not live long enough + --> $DIR/const-ptr-nonnull.rs:9:37 + | +LL | let x: &'static NonNull = &(non_null.cast()); + | ^^^^^^^^^^^^^^^^^ temporary value does not live long enough +LL | //~^ ERROR borrowed value does not live long enough +LL | } + | - temporary value only lives until here + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/consts/const-ptr-unique.rs b/src/test/ui/consts/const-ptr-unique.rs new file mode 100644 index 000000000000..be44a2418160 --- /dev/null +++ b/src/test/ui/consts/const-ptr-unique.rs @@ -0,0 +1,10 @@ +#![feature(ptr_internals)] + +use std::ptr::Unique; + +fn main() { + let mut i: u32 = 10; + let unique = Unique::new(&mut i).unwrap(); + let x: &'static *mut u32 = &(unique.as_ptr()); + //~^ ERROR borrowed value does not live long enough +} diff --git a/src/test/ui/consts/const-ptr-unique.stderr b/src/test/ui/consts/const-ptr-unique.stderr new file mode 100644 index 000000000000..141465bf184d --- /dev/null +++ b/src/test/ui/consts/const-ptr-unique.stderr @@ -0,0 +1,14 @@ +error[E0597]: borrowed value does not live long enough + --> $DIR/const-ptr-unique.rs:8:33 + | +LL | let x: &'static *mut u32 = &(unique.as_ptr()); + | ^^^^^^^^^^^^^^^^^ temporary value does not live long enough +LL | //~^ ERROR borrowed value does not live long enough +LL | } + | - temporary value only lives until here + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. From fbdece47c84aa1161b01c86457ee193dd434387d Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 28 Feb 2019 19:10:43 +1100 Subject: [PATCH 115/381] Ensure `record_layout_for_printing()` is inlined. This reduces instruction counts for the `ctfe-stress-2` benchmark by about 1%. --- src/librustc/ty/layout.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 6c507c0015d7..7d2b21b9aecd 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -1176,14 +1176,20 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { /// This is invoked by the `layout_raw` query to record the final /// layout of each type. - #[inline] + #[inline(always)] fn record_layout_for_printing(&self, layout: TyLayout<'tcx>) { - // If we are running with `-Zprint-type-sizes`, record layouts for - // dumping later. Ignore layouts that are done with non-empty - // environments or non-monomorphic layouts, as the user only wants - // to see the stuff resulting from the final codegen session. + // If we are running with `-Zprint-type-sizes`, maybe record layouts + // for dumping later. + if self.tcx.sess.opts.debugging_opts.print_type_sizes { + self.record_layout_for_printing_outlined(layout) + } + } + + fn record_layout_for_printing_outlined(&self, layout: TyLayout<'tcx>) { + // Ignore layouts that are done with non-empty environments or + // non-monomorphic layouts, as the user only wants to see the stuff + // resulting from the final codegen session. if - !self.tcx.sess.opts.debugging_opts.print_type_sizes || layout.ty.has_param_types() || layout.ty.has_self_ty() || !self.param_env.caller_bounds.is_empty() @@ -1191,10 +1197,6 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { return; } - self.record_layout_for_printing_outlined(layout) - } - - fn record_layout_for_printing_outlined(&self, layout: TyLayout<'tcx>) { // (delay format until we actually need it) let record = |kind, packed, opt_discr_size, variants| { let type_desc = format!("{:?}", layout.ty); From 0c1a38ce3b281ce23b9ba84312f58ba6ac82af57 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 28 Feb 2019 09:24:35 +0100 Subject: [PATCH 116/381] Update src/libcore/mem.rs Co-Authored-By: RalfJung --- src/libcore/mem.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index f78213ba9f67..94f342e7e8ef 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -942,7 +942,7 @@ pub fn discriminant(v: &T) -> Discriminant { /// } /// ``` /// -/// [`mem::zeroed']: fn.zeroed.html +/// [`mem::zeroed`]: fn.zeroed.html #[stable(feature = "manually_drop", since = "1.20.0")] #[lang = "manually_drop"] #[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] From 405d95080288dc760e117a506278d968d57dfe09 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 28 Feb 2019 18:08:48 +0100 Subject: [PATCH 117/381] Move rustdoc-js testing into compiletest --- src/bootstrap/test.rs | 62 ++++++---------------------- src/test/rustdoc-js/basic.rs | 1 + src/tools/compiletest/src/common.rs | 3 ++ src/tools/compiletest/src/runtest.rs | 29 +++++++++++-- 4 files changed, 42 insertions(+), 53 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 97a5c500b1a4..b7323b2eadc3 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -4,7 +4,7 @@ //! our CI. use std::env; -use std::ffi::{OsStr, OsString}; +use std::ffi::OsString; use std::fmt; use std::fs; use std::iter; @@ -638,52 +638,15 @@ impl Step for RustdocJSNotStd { } fn run(self, builder: &Builder<'_>) { - if let Some(ref nodejs) = builder.config.nodejs { - builder.ensure(crate::doc::Std { + if builder.config.nodejs.is_some() { + builder.ensure(Compiletest { + compiler: self.compiler, target: self.target, - stage: builder.top_stage, + mode: "js-doc-test", + suite: "rustdoc-js", + path: None, + compare_mode: None, }); - - let mut tests_to_run = Vec::new(); - let out = Path::new("build").join(&*self.host) - .join(&format!("stage{}", - builder.top_stage.to_string().as_str())) - .join("tests") - .join("rustdoc-js"); - - if let Ok(it) = fs::read_dir("src/test/rustdoc-js/") { - for entry in it { - if let Ok(entry) = entry { - let path = entry.path(); - if path.extension() != Some(&OsStr::new("rs")) || !path.is_file() { - continue - } - let path_clone = path.clone(); - let file_stem = path_clone.file_stem().expect("cannot get file stem"); - let out = out.join(file_stem); - let mut cmd = builder.rustdoc_cmd(self.host); - cmd.arg("-o"); - cmd.arg(out); - cmd.arg(path); - if if builder.config.verbose_tests { - try_run(builder, &mut cmd) - } else { - try_run_quiet(builder, &mut cmd) - } { - tests_to_run.push(file_stem.to_os_string()); - } - } - } - } - assert!(!tests_to_run.is_empty(), "no rustdoc-js test generated..."); - - tests_to_run.insert(0, "src/tools/rustdoc-js/tester.js".into()); - tests_to_run.insert(1, out.into()); - - let mut command = Command::new(nodejs); - command.args(&tests_to_run); - - builder.run(&mut command); } else { builder.info( "No nodejs found, skipping \"src/test/rustdoc-js\" tests" @@ -1070,12 +1033,13 @@ impl Step for Compiletest { .arg(builder.sysroot_libdir(compiler, target)); cmd.arg("--rustc-path").arg(builder.rustc(compiler)); - let is_rustdoc_ui = suite.ends_with("rustdoc-ui"); + let is_rustdoc = suite.ends_with("rustdoc-ui") || suite.ends_with("rustdoc-js"); // Avoid depending on rustdoc when we don't need it. if mode == "rustdoc" || (mode == "run-make" && suite.ends_with("fulldeps")) - || (mode == "ui" && is_rustdoc_ui) + || (mode == "ui" && is_rustdoc) + || mode == "js-doc-test" { cmd.arg("--rustdoc-path") .arg(builder.rustdoc(compiler.host)); @@ -1109,12 +1073,12 @@ impl Step for Compiletest { cmd.arg("--nodejs").arg(nodejs); } - let mut flags = if is_rustdoc_ui { + let mut flags = if is_rustdoc { Vec::new() } else { vec!["-Crpath".to_string()] }; - if !is_rustdoc_ui { + if !is_rustdoc { if builder.config.rust_optimize_tests { flags.push("-O".to_string()); } diff --git a/src/test/rustdoc-js/basic.rs b/src/test/rustdoc-js/basic.rs index 4a835673a596..1b4963fcebea 100644 --- a/src/test/rustdoc-js/basic.rs +++ b/src/test/rustdoc-js/basic.rs @@ -1 +1,2 @@ +/// Foo pub struct Foo; diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 6b3117a1f74f..f0991c8cdb54 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -24,6 +24,7 @@ pub enum Mode { Incremental, RunMake, Ui, + JsDocTest, MirOpt, } @@ -59,6 +60,7 @@ impl FromStr for Mode { "incremental" => Ok(Incremental), "run-make" => Ok(RunMake), "ui" => Ok(Ui), + "js-doc-test" => Ok(JsDocTest), "mir-opt" => Ok(MirOpt), _ => Err(()), } @@ -82,6 +84,7 @@ impl fmt::Display for Mode { Incremental => "incremental", RunMake => "run-make", Ui => "ui", + JsDocTest => "js-doc-test", MirOpt => "mir-opt", }; fmt::Display::fmt(s, f) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index bac41a7c5790..f7c02e831a9a 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -4,7 +4,7 @@ use crate::common::{output_base_dir, output_base_name, output_testname_unique}; use crate::common::{Codegen, CodegenUnits, DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Rustdoc}; use crate::common::{CompileFail, Pretty, RunFail, RunPass, RunPassValgrind}; use crate::common::{Config, TestPaths}; -use crate::common::{Incremental, MirOpt, RunMake, Ui}; +use crate::common::{Incremental, MirOpt, RunMake, Ui, JsDocTest}; use diff; use crate::errors::{self, Error, ErrorKind}; use filetime::FileTime; @@ -275,6 +275,7 @@ impl<'test> TestCx<'test> { RunMake => self.run_rmake_test(), RunPass | Ui => self.run_ui_test(), MirOpt => self.run_mir_opt_test(), + JsDocTest => self.run_js_doc_test(), } } @@ -290,7 +291,7 @@ impl<'test> TestCx<'test> { fn should_compile_successfully(&self) -> bool { match self.config.mode { CompileFail => self.props.compile_pass, - RunPass => true, + RunPass | JsDocTest => true, Ui => self.props.compile_pass, Incremental => { let revision = self.revision @@ -1712,7 +1713,8 @@ impl<'test> TestCx<'test> { } fn make_compile_args(&self, input_file: &Path, output_file: TargetLocation) -> Command { - let is_rustdoc = self.config.src_base.ends_with("rustdoc-ui"); + let is_rustdoc = self.config.src_base.ends_with("rustdoc-ui") || + self.config.src_base.ends_with("rustdoc-js"); let mut rustc = if !is_rustdoc { Command::new(&self.config.rustc_path) } else { @@ -1802,7 +1804,7 @@ impl<'test> TestCx<'test> { rustc.arg(dir_opt); } RunFail | RunPassValgrind | Pretty | DebugInfoBoth | DebugInfoGdb | DebugInfoLldb - | Codegen | Rustdoc | RunMake | CodegenUnits => { + | Codegen | Rustdoc | RunMake | CodegenUnits | JsDocTest => { // do not use JSON output } } @@ -2710,6 +2712,25 @@ impl<'test> TestCx<'test> { fs::remove_dir(path) } + fn run_js_doc_test(&self) { + if let Some(nodejs) = &self.config.nodejs { + let out_dir = self.output_base_dir(); + + self.document(&out_dir); + + let root = self.config.find_rust_src_root().unwrap(); + let res = self.cmd2procres( + Command::new(&nodejs) + .arg(root.join("src/tools/rustdoc-js/tester.js")) + .arg(out_dir.parent().expect("no parent")) + .arg(&self.testpaths.file.file_stem().expect("couldn't get file stem")), + ); + if !res.status.success() { + self.fatal_proc_rec("rustdoc-js test failed!", &res); + } + } + } + fn run_ui_test(&self) { // if the user specified a format in the ui test // print the output to the stderr file, otherwise extract From 23a51f91c928a4ff2cbf39218e6e991365e5f562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 8 Dec 2018 20:30:23 +0100 Subject: [PATCH 118/381] Introduce rustc_interface and move some methods there --- Cargo.lock | 31 + src/bootstrap/bin/rustc.rs | 2 + src/librustc/dep_graph/dep_node.rs | 1 + src/librustc/session/config.rs | 7 + src/librustc/session/mod.rs | 109 +-- src/librustc/ty/context.rs | 4 +- src/librustc/ty/query/config.rs | 6 + src/librustc/ty/query/mod.rs | 8 +- src/librustc/ty/query/plumbing.rs | 1 + src/librustc_driver/Cargo.toml | 1 + src/librustc_driver/driver.rs | 488 +----------- src/librustc_driver/lib.rs | 299 +------- src/librustc_driver/pretty.rs | 270 +------ src/librustc_driver/test.rs | 11 +- src/librustc_interface/Cargo.toml | 35 + src/librustc_interface/lib.rs | 43 ++ src/librustc_interface/passes.rs | 296 ++++++++ .../proc_macro_decls.rs | 0 .../profile/mod.rs | 0 .../profile/trace.rs | 0 src/librustc_interface/util.rs | 702 ++++++++++++++++++ src/librustc_typeck/check/mod.rs | 6 +- src/librustc_typeck/lib.rs | 11 +- src/librustdoc/core.rs | 33 +- src/librustdoc/lib.rs | 1 + src/librustdoc/test.rs | 15 +- src/test/run-make-fulldeps/issue-19371/foo.rs | 4 +- .../rustdoc-ui/failed-doctest-output.stdout | 4 +- src/test/ui/issues/issue-23302-3.stderr | 1 + 29 files changed, 1334 insertions(+), 1055 deletions(-) create mode 100644 src/librustc_interface/Cargo.toml create mode 100644 src/librustc_interface/lib.rs create mode 100644 src/librustc_interface/passes.rs rename src/{librustc_driver => librustc_interface}/proc_macro_decls.rs (100%) rename src/{librustc_driver => librustc_interface}/profile/mod.rs (100%) rename src/{librustc_driver => librustc_interface}/profile/trace.rs (100%) create mode 100644 src/librustc_interface/util.rs diff --git a/Cargo.lock b/Cargo.lock index 6773734c5746..381322bc421d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2699,6 +2699,7 @@ dependencies = [ "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "rustc_incremental 0.0.0", + "rustc_interface 0.0.0", "rustc_lint 0.0.0", "rustc_metadata 0.0.0", "rustc_mir 0.0.0", @@ -2751,6 +2752,36 @@ dependencies = [ "syntax_pos 0.0.0", ] +[[package]] +name = "rustc_interface" +version = "0.0.0" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_allocator 0.0.0", + "rustc_borrowck 0.0.0", + "rustc_codegen_utils 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_incremental 0.0.0", + "rustc_lint 0.0.0", + "rustc_metadata 0.0.0", + "rustc_mir 0.0.0", + "rustc_passes 0.0.0", + "rustc_plugin 0.0.0", + "rustc_privacy 0.0.0", + "rustc_resolve 0.0.0", + "rustc_traits 0.0.0", + "rustc_typeck 0.0.0", + "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serialize 0.0.0", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syntax 0.0.0", + "syntax_ext 0.0.0", + "syntax_pos 0.0.0", +] + [[package]] name = "rustc_lint" version = "0.0.0" diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index b6afe317a07b..70e4a69a07d4 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -107,6 +107,8 @@ fn main() { // actually downloaded, so we just always pass the `--sysroot` option. cmd.arg("--sysroot").arg(&sysroot); + cmd.arg("-Zexternal-macro-backtrace"); + // When we build Rust dylibs they're all intended for intermediate // usage, so make sure we pass the -Cprefer-dynamic flag instead of // linking all deps statically into the dylib. diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 0d8f71a50ce5..c607eb5906e6 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -456,6 +456,7 @@ define_dep_nodes!( <'tcx> [eval_always] CoherenceInherentImplOverlapCheck, [] CoherenceCheckTrait(DefId), [eval_always] PrivacyAccessLevels(CrateNum), + [eval_always] Analysis(CrateNum), // Represents the MIR for a fn; also used as the task node for // things read/modify that MIR. diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 65da458efbff..99eee4b559a5 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -499,6 +499,13 @@ impl Input { Input::Str { ref mut input, .. } => Some(input), } } + + pub fn source_name(&self) -> FileName { + match *self { + Input::File(ref ifile) => ifile.clone().into(), + Input::Str { ref name, .. } => name.clone(), + } + } } #[derive(Clone, Hash)] diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 833785f04076..5b9b70edc680 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -899,14 +899,14 @@ impl Session { /// Returns the number of query threads that should be used for this /// compilation - pub fn threads_from_opts(opts: &config::Options) -> usize { - opts.debugging_opts.threads.unwrap_or(::num_cpus::get()) + pub fn threads_from_count(query_threads: Option) -> usize { + query_threads.unwrap_or(::num_cpus::get()) } /// Returns the number of query threads that should be used for this /// compilation pub fn threads(&self) -> usize { - Self::threads_from_opts(&self.opts) + Self::threads_from_count(self.opts.debugging_opts.threads) } /// Returns the number of codegen units that should be used for this @@ -1023,16 +1023,67 @@ pub fn build_session( local_crate_source_file, registry, Lrc::new(source_map::SourceMap::new(file_path_mapping)), - None, + DiagnosticOutput::Default, + Default::default(), ) } +fn default_emitter( + sopts: &config::Options, + registry: errors::registry::Registry, + source_map: &Lrc, + emitter_dest: Option>, +) -> Box { + match (sopts.error_format, emitter_dest) { + (config::ErrorOutputType::HumanReadable(color_config), None) => Box::new( + EmitterWriter::stderr( + color_config, + Some(source_map.clone()), + false, + sopts.debugging_opts.teach, + ).ui_testing(sopts.debugging_opts.ui_testing), + ), + (config::ErrorOutputType::HumanReadable(_), Some(dst)) => Box::new( + EmitterWriter::new(dst, Some(source_map.clone()), false, false) + .ui_testing(sopts.debugging_opts.ui_testing), + ), + (config::ErrorOutputType::Json(pretty), None) => Box::new( + JsonEmitter::stderr( + Some(registry), + source_map.clone(), + pretty, + ).ui_testing(sopts.debugging_opts.ui_testing), + ), + (config::ErrorOutputType::Json(pretty), Some(dst)) => Box::new( + JsonEmitter::new( + dst, + Some(registry), + source_map.clone(), + pretty, + ).ui_testing(sopts.debugging_opts.ui_testing), + ), + (config::ErrorOutputType::Short(color_config), None) => Box::new( + EmitterWriter::stderr(color_config, Some(source_map.clone()), true, false), + ), + (config::ErrorOutputType::Short(_), Some(dst)) => { + Box::new(EmitterWriter::new(dst, Some(source_map.clone()), true, false)) + } + } +} + +pub enum DiagnosticOutput { + Default, + Raw(Box), + Emitter(Box) +} + pub fn build_session_with_source_map( sopts: config::Options, local_crate_source_file: Option, registry: errors::registry::Registry, source_map: Lrc, - emitter_dest: Option>, + diagnostics_output: DiagnosticOutput, + lint_caps: FxHashMap, ) -> Session { // FIXME: This is not general enough to make the warning lint completely override // normal diagnostic warnings, since the warning lint can also be denied and changed @@ -1054,42 +1105,13 @@ pub fn build_session_with_source_map( let external_macro_backtrace = sopts.debugging_opts.external_macro_backtrace; - let emitter: Box = - match (sopts.error_format, emitter_dest) { - (config::ErrorOutputType::HumanReadable(color_config), None) => Box::new( - EmitterWriter::stderr( - color_config, - Some(source_map.clone()), - false, - sopts.debugging_opts.teach, - ).ui_testing(sopts.debugging_opts.ui_testing), - ), - (config::ErrorOutputType::HumanReadable(_), Some(dst)) => Box::new( - EmitterWriter::new(dst, Some(source_map.clone()), false, false) - .ui_testing(sopts.debugging_opts.ui_testing), - ), - (config::ErrorOutputType::Json(pretty), None) => Box::new( - JsonEmitter::stderr( - Some(registry), - source_map.clone(), - pretty, - ).ui_testing(sopts.debugging_opts.ui_testing), - ), - (config::ErrorOutputType::Json(pretty), Some(dst)) => Box::new( - JsonEmitter::new( - dst, - Some(registry), - source_map.clone(), - pretty, - ).ui_testing(sopts.debugging_opts.ui_testing), - ), - (config::ErrorOutputType::Short(color_config), None) => Box::new( - EmitterWriter::stderr(color_config, Some(source_map.clone()), true, false), - ), - (config::ErrorOutputType::Short(_), Some(dst)) => { - Box::new(EmitterWriter::new(dst, Some(source_map.clone()), true, false)) - } - }; + let emitter = match diagnostics_output { + DiagnosticOutput::Default => default_emitter(&sopts, registry, &source_map, None), + DiagnosticOutput::Raw(write) => { + default_emitter(&sopts, registry, &source_map, Some(write)) + } + DiagnosticOutput::Emitter(emitter) => emitter, + }; let diagnostic_handler = errors::Handler::with_emitter_and_flags( emitter, @@ -1103,7 +1125,7 @@ pub fn build_session_with_source_map( }, ); - build_session_(sopts, local_crate_source_file, diagnostic_handler, source_map) + build_session_(sopts, local_crate_source_file, diagnostic_handler, source_map, lint_caps) } pub fn build_session_( @@ -1111,6 +1133,7 @@ pub fn build_session_( local_crate_source_file: Option, span_diagnostic: errors::Handler, source_map: Lrc, + driver_lint_caps: FxHashMap, ) -> Session { let host_triple = TargetTriple::from_triple(config::host_triple()); let host = Target::search(&host_triple).unwrap_or_else(|e| @@ -1235,7 +1258,7 @@ pub fn build_session_( }, has_global_allocator: Once::new(), has_panic_handler: Once::new(), - driver_lint_caps: Default::default(), + driver_lint_caps, }; validate_commandline_args_with_session_available(&sess); diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 9767396147cf..d02c9fc174c6 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -50,7 +50,7 @@ use rustc_data_structures::stable_hasher::{HashStable, hash_stable_hashmap, StableVec}; use arena::{TypedArena, SyncDroplessArena}; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; -use rustc_data_structures::sync::{self, Lrc, Lock, WorkerLocal}; +use rustc_data_structures::sync::{Lrc, Lock, WorkerLocal}; use std::any::Any; use std::borrow::Borrow; use std::cmp::Ordering; @@ -1285,8 +1285,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let gcx = arenas.global_ctxt.as_ref().unwrap(); - sync::assert_send_val(&gcx); - let r = tls::enter_global(gcx, f); gcx.queries.record_computed_queries(s); diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index 0d3e9f7914ba..feca0f7170ef 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -611,6 +611,12 @@ impl<'tcx> QueryDescription<'tcx> for queries::extern_crate<'tcx> { } } +impl<'tcx> QueryDescription<'tcx> for queries::analysis<'tcx> { + fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> { + "running analysis passes on this crate".into() + } +} + impl<'tcx> QueryDescription<'tcx> for queries::lint_levels<'tcx> { fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> { "computing the lint levels for items in this crate".into() diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs index ee36a1af8f40..197b9a71b0ac 100644 --- a/src/librustc/ty/query/mod.rs +++ b/src/librustc/ty/query/mod.rs @@ -19,7 +19,7 @@ use crate::mir::interpret::{ConstEvalRawResult, ConstEvalResult}; use crate::mir::mono::CodegenUnit; use crate::mir; use crate::mir::interpret::GlobalId; -use crate::session::{CompileResult, CrateDisambiguator}; +use crate::session::CrateDisambiguator; use crate::session::config::{EntryFnType, OutputFilenames, OptLevel}; use crate::traits::{self, Vtable}; use crate::traits::query::{ @@ -99,6 +99,9 @@ pub use self::on_disk_cache::OnDiskCache; // as they will raise an fatal error on query cycles instead. define_queries! { <'tcx> Other { + /// Run analysis passes on the crate + [] fn analysis: Analysis(CrateNum) -> Result<(), ErrorReported>, + /// Records the type of every item. [] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>, @@ -290,7 +293,8 @@ define_queries! { <'tcx> }, TypeChecking { - [] fn typeck_item_bodies: typeck_item_bodies_dep_node(CrateNum) -> CompileResult, + [] fn typeck_item_bodies: + typeck_item_bodies_dep_node(CrateNum) -> Result<(), ErrorReported>, [] fn typeck_tables_of: TypeckTables(DefId) -> &'tcx ty::TypeckTables<'tcx>, }, diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index 37cb6753ed5b..ebaa31d703f8 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -1357,6 +1357,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, DepKind::CrateHash => { force!(crate_hash, krate!()); } DepKind::OriginalCrateName => { force!(original_crate_name, krate!()); } DepKind::ExtraFileName => { force!(extra_filename, krate!()); } + DepKind::Analysis => { force!(analysis, krate!()); } DepKind::AllTraitImplementations => { force!(all_trait_implementations, krate!()); diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index 2e6e775c5261..0b379ef662dd 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -33,6 +33,7 @@ rustc_save_analysis = { path = "../librustc_save_analysis" } rustc_traits = { path = "../librustc_traits" } rustc_codegen_utils = { path = "../librustc_codegen_utils" } rustc_typeck = { path = "../librustc_typeck" } +rustc_interface = { path = "../librustc_interface" } serialize = { path = "../libserialize" } syntax = { path = "../libsyntax" } smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index b998b77a76b9..f87a809e6c6e 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -2,42 +2,39 @@ use rustc::dep_graph::DepGraph; use rustc::hir; use rustc::hir::lowering::lower_crate; use rustc::hir::map as hir_map; +use rustc::hir::def_id::LOCAL_CRATE; use rustc::lint; use rustc::middle::{self, reachable, resolve_lifetime, stability}; use rustc::ty::{self, AllArenas, Resolutions, TyCtxt}; use rustc::traits; use rustc::util::common::{install_panic_hook, time, ErrorReported}; use rustc::util::profiling::ProfileCategory; -use rustc::session::{CompileResult, CrateDisambiguator, Session}; +use rustc::session::{CompileResult, Session}; use rustc::session::CompileIncomplete; use rustc::session::config::{self, Input, OutputFilenames, OutputType}; use rustc::session::search_paths::PathKind; use rustc_allocator as allocator; use rustc_borrowck as borrowck; use rustc_codegen_utils::codegen_backend::CodegenBackend; -use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::stable_hasher::StableHasher; use rustc_data_structures::sync::{self, Lock}; use rustc_incremental; use rustc_metadata::creader::CrateLoader; use rustc_metadata::cstore::{self, CStore}; use rustc_mir as mir; -use rustc_passes::{self, ast_validation, hir_stats, loops, rvalue_promotion, layout_test}; +use rustc_passes::{self, ast_validation, hir_stats}; use rustc_plugin as plugin; use rustc_plugin::registry::Registry; use rustc_privacy; use rustc_resolve::{Resolver, ResolverArenas}; use rustc_traits; use rustc_typeck as typeck; -use syntax::{self, ast, attr, diagnostics, visit}; +use syntax::{self, ast, diagnostics, visit}; use syntax::early_buffered_lints::BufferedEarlyLint; use syntax::ext::base::ExtCtxt; use syntax::mut_visit::MutVisitor; use syntax::parse::{self, PResult}; use syntax::util::node_count::NodeCounter; -use syntax::util::lev_distance::find_best_match_for_name; -use syntax::symbol::Symbol; -use syntax_pos::{FileName, hygiene}; +use syntax_pos::hygiene; use syntax_ext; use serialize::json; @@ -46,14 +43,11 @@ use std::any::Any; use std::env; use std::ffi::OsString; use std::fs; -use std::io::{self, Write}; use std::iter; use std::path::{Path, PathBuf}; use std::sync::mpsc; -use pretty::ReplaceBodyWithLoop; -use proc_macro_decls; -use profile; +use rustc_interface::{util, profile, passes}; use super::Compilation; #[cfg(not(parallel_compiler))] @@ -78,7 +72,7 @@ pub fn spawn_thread_pool R + sync::Send, R: sync:: let gcx_ptr = &Lock::new(0); let config = ThreadPoolBuilder::new() - .num_threads(Session::threads_from_opts(&opts)) + .num_threads(Session::threads_from_count(opts.debugging_opts.threads)) .deadlock_handler(|| unsafe { ty::query::handle_deadlock() }) .stack_size(::STACK_SIZE); @@ -160,7 +154,7 @@ pub fn compile_input( (compile_state.krate.unwrap(), compile_state.registry) }; - let outputs = build_output_filenames(input, outdir, output, &krate.attrs, sess); + let outputs = util::build_output_filenames(input, outdir, output, &krate.attrs, sess); let crate_name = ::rustc_codegen_utils::link::find_crate_name(Some(sess), &krate.attrs, input); install_panic_hook(); @@ -194,12 +188,17 @@ pub fn compile_input( )? }; - let output_paths = generated_output_paths(sess, &outputs, output.is_some(), &crate_name); + let output_paths = passes::generated_output_paths( + sess, + &outputs, + output.is_some(), + &crate_name + ); // Ensure the source file isn't accidentally overwritten during compilation. if let Some(ref input_path) = *input_path { if sess.opts.will_create_output_file() { - if output_contains_path(&output_paths, input_path) { + if passes::output_contains_path(&output_paths, input_path) { sess.err(&format!( "the input file \"{}\" would be overwritten by the generated \ executable", @@ -207,7 +206,7 @@ pub fn compile_input( )); return Err(CompileIncomplete::Stopped); } - if let Some(dir_path) = output_conflicts_with_dir(&output_paths) { + if let Some(dir_path) = passes::output_conflicts_with_dir(&output_paths) { sess.err(&format!( "the generated executable for the input file \"{}\" conflicts with the \ existing directory \"{}\"", @@ -219,7 +218,7 @@ pub fn compile_input( } } - write_out_deps(sess, &outputs, &output_paths); + passes::write_out_deps(sess, &outputs, &output_paths); if sess.opts.output_types.contains_key(&OutputType::DepInfo) && sess.opts.output_types.len() == 1 { @@ -333,7 +332,7 @@ pub fn compile_input( Ok((outputs.clone(), ongoing_codegen, tcx.dep_graph.clone())) }, - )?? + )? }; if sess.opts.debugging_opts.print_type_sizes { @@ -364,13 +363,6 @@ pub fn compile_input( Ok(()) } -pub fn source_name(input: &Input) -> FileName { - match *input { - Input::File(ref ifile) => ifile.clone().into(), - Input::Str { ref name, .. } => name.clone(), - } -} - /// CompileController is used to customize compilation, it allows compilation to /// be stopped and/or to call arbitrary code at various points in compilation. /// It also allows for various flags to be set to influence what information gets @@ -806,10 +798,10 @@ where // these need to be set "early" so that expansion sees `quote` if enabled. sess.init_features(features); - let crate_types = collect_crate_types(sess, &krate.attrs); + let crate_types = util::collect_crate_types(sess, &krate.attrs); sess.crate_types.set(crate_types); - let disambiguator = compute_crate_disambiguator(sess); + let disambiguator = util::compute_crate_disambiguator(sess); sess.crate_disambiguator.set(disambiguator); rustc_incremental::prepare_session_directory(sess, &crate_name, disambiguator); @@ -1019,7 +1011,7 @@ where // If we're actually rustdoc then there's no need to actually compile // anything, so switch everything to just looping if sess.opts.actually_rustdoc { - ReplaceBodyWithLoop::new(sess).visit_crate(&mut krate); + util::ReplaceBodyWithLoop::new(sess).visit_crate(&mut krate); } let (has_proc_macro_decls, has_global_allocator) = time(sess, "AST validation", || { @@ -1145,7 +1137,7 @@ where } pub fn default_provide(providers: &mut ty::query::Providers) { - proc_macro_decls::provide(providers); + rustc_interface::passes::provide(providers); plugin::build::provide(providers); hir::provide(providers); borrowck::provide(providers); @@ -1186,7 +1178,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>( name: &str, output_filenames: &OutputFilenames, f: F, -) -> Result +) -> R where F: for<'a> FnOnce( TyCtxt<'a, 'tcx, 'tcx>, @@ -1227,114 +1219,9 @@ where // tcx available. time(sess, "dep graph tcx init", || rustc_incremental::dep_graph_tcx_init(tcx)); - parallel!({ - time(sess, "looking for entry point", || { - middle::entry::find_entry_point(tcx) - }); + tcx.analysis(LOCAL_CRATE).ok(); - time(sess, "looking for plugin registrar", || { - plugin::build::find_plugin_registrar(tcx) - }); - - time(sess, "looking for derive registrar", || { - proc_macro_decls::find(tcx) - }); - }, { - time(sess, "loop checking", || loops::check_crate(tcx)); - }, { - time(sess, "attribute checking", || { - hir::check_attr::check_crate(tcx) - }); - }, { - time(sess, "stability checking", || { - stability::check_unstable_api_usage(tcx) - }); - }); - - // passes are timed inside typeck - match typeck::check_crate(tcx) { - Ok(x) => x, - Err(x) => { - f(tcx, rx, Err(x)); - return Err(x); - } - } - - time(sess, "misc checking", || { - parallel!({ - time(sess, "rvalue promotion", || { - rvalue_promotion::check_crate(tcx) - }); - }, { - time(sess, "intrinsic checking", || { - middle::intrinsicck::check_crate(tcx) - }); - }, { - time(sess, "match checking", || mir::matchck_crate(tcx)); - }, { - // this must run before MIR dump, because - // "not all control paths return a value" is reported here. - // - // maybe move the check to a MIR pass? - time(sess, "liveness checking", || { - middle::liveness::check_crate(tcx) - }); - }); - }); - - // Abort so we don't try to construct MIR with liveness errors. - // We also won't want to continue with errors from rvalue promotion - tcx.sess.abort_if_errors(); - - time(sess, "borrow checking", || { - if tcx.use_ast_borrowck() { - borrowck::check_crate(tcx); - } - }); - - time(sess, - "MIR borrow checking", - || tcx.par_body_owners(|def_id| { tcx.ensure().mir_borrowck(def_id); })); - - time(sess, "dumping chalk-like clauses", || { - rustc_traits::lowering::dump_program_clauses(tcx); - }); - - time(sess, "MIR effect checking", || { - for def_id in tcx.body_owners() { - mir::transform::check_unsafety::check_unsafety(tcx, def_id) - } - }); - - time(sess, "layout testing", || layout_test::test_layout(tcx)); - - // Avoid overwhelming user with errors if borrow checking failed. - // I'm not sure how helpful this is, to be honest, but it avoids - // a - // lot of annoying errors in the compile-fail tests (basically, - // lint warnings and so on -- kindck used to do this abort, but - // kindck is gone now). -nmatsakis - if sess.err_count() > 0 { - return Ok(f(tcx, rx, sess.compile_status())); - } - - time(sess, "misc checking", || { - parallel!({ - time(sess, "privacy checking", || { - rustc_privacy::check_crate(tcx) - }); - }, { - time(sess, "death checking", || middle::dead::check_crate(tcx)); - }, { - time(sess, "unused lib feature checking", || { - stability::check_unused_or_stable_features(tcx) - }); - }, { - time(sess, "lint checking", || lint::check_crate(tcx)); - }); - }); - - return Ok(f(tcx, rx, tcx.sess.compile_status())); + f(tcx, rx, tcx.sess.compile_status()) }, ) } @@ -1359,328 +1246,3 @@ pub fn phase_4_codegen<'a, 'tcx>( codegen } - -fn escape_dep_filename(filename: &FileName) -> String { - // Apparently clang and gcc *only* escape spaces: - // http://llvm.org/klaus/clang/commit/9d50634cfc268ecc9a7250226dd5ca0e945240d4 - filename.to_string().replace(" ", "\\ ") -} - -// Returns all the paths that correspond to generated files. -fn generated_output_paths( - sess: &Session, - outputs: &OutputFilenames, - exact_name: bool, - crate_name: &str, -) -> Vec { - let mut out_filenames = Vec::new(); - for output_type in sess.opts.output_types.keys() { - let file = outputs.path(*output_type); - match *output_type { - // If the filename has been overridden using `-o`, it will not be modified - // by appending `.rlib`, `.exe`, etc., so we can skip this transformation. - OutputType::Exe if !exact_name => for crate_type in sess.crate_types.borrow().iter() { - let p = ::rustc_codegen_utils::link::filename_for_input( - sess, - *crate_type, - crate_name, - outputs, - ); - out_filenames.push(p); - }, - OutputType::DepInfo if sess.opts.debugging_opts.dep_info_omit_d_target => { - // Don't add the dep-info output when omitting it from dep-info targets - } - _ => { - out_filenames.push(file); - } - } - } - out_filenames -} - -// Runs `f` on every output file path and returns the first non-None result, or None if `f` -// returns None for every file path. -fn check_output(output_paths: &[PathBuf], f: F) -> Option -where - F: Fn(&PathBuf) -> Option, -{ - for output_path in output_paths { - if let Some(result) = f(output_path) { - return Some(result); - } - } - None -} - -pub fn output_contains_path(output_paths: &[PathBuf], input_path: &PathBuf) -> bool { - let input_path = input_path.canonicalize().ok(); - if input_path.is_none() { - return false; - } - let check = |output_path: &PathBuf| { - if output_path.canonicalize().ok() == input_path { - Some(()) - } else { - None - } - }; - check_output(output_paths, check).is_some() -} - -pub fn output_conflicts_with_dir(output_paths: &[PathBuf]) -> Option { - let check = |output_path: &PathBuf| { - if output_path.is_dir() { - Some(output_path.clone()) - } else { - None - } - }; - check_output(output_paths, check) -} - -fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &[PathBuf]) { - // Write out dependency rules to the dep-info file if requested - if !sess.opts.output_types.contains_key(&OutputType::DepInfo) { - return; - } - let deps_filename = outputs.path(OutputType::DepInfo); - - let result = (|| -> io::Result<()> { - // Build a list of files used to compile the output and - // write Makefile-compatible dependency rules - let files: Vec = sess.source_map() - .files() - .iter() - .filter(|fmap| fmap.is_real_file()) - .filter(|fmap| !fmap.is_imported()) - .map(|fmap| escape_dep_filename(&fmap.name)) - .collect(); - let mut file = fs::File::create(&deps_filename)?; - for path in out_filenames { - writeln!(file, "{}: {}\n", path.display(), files.join(" "))?; - } - - // Emit a fake target for each input file to the compilation. This - // prevents `make` from spitting out an error if a file is later - // deleted. For more info see #28735 - for path in files { - writeln!(file, "{}:", path)?; - } - Ok(()) - })(); - - if let Err(e) = result { - sess.fatal(&format!( - "error writing dependencies to `{}`: {}", - deps_filename.display(), - e - )); - } -} - -pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute]) -> Vec { - // Unconditionally collect crate types from attributes to make them used - let attr_types: Vec = attrs - .iter() - .filter_map(|a| { - if a.check_name("crate_type") { - match a.value_str() { - Some(ref n) if *n == "rlib" => Some(config::CrateType::Rlib), - Some(ref n) if *n == "dylib" => Some(config::CrateType::Dylib), - Some(ref n) if *n == "cdylib" => Some(config::CrateType::Cdylib), - Some(ref n) if *n == "lib" => Some(config::default_lib_output()), - Some(ref n) if *n == "staticlib" => Some(config::CrateType::Staticlib), - Some(ref n) if *n == "proc-macro" => Some(config::CrateType::ProcMacro), - Some(ref n) if *n == "bin" => Some(config::CrateType::Executable), - Some(ref n) => { - let crate_types = vec![ - Symbol::intern("rlib"), - Symbol::intern("dylib"), - Symbol::intern("cdylib"), - Symbol::intern("lib"), - Symbol::intern("staticlib"), - Symbol::intern("proc-macro"), - Symbol::intern("bin") - ]; - - if let ast::MetaItemKind::NameValue(spanned) = a.meta().unwrap().node { - let span = spanned.span; - let lev_candidate = find_best_match_for_name( - crate_types.iter(), - &n.as_str(), - None - ); - if let Some(candidate) = lev_candidate { - session.buffer_lint_with_diagnostic( - lint::builtin::UNKNOWN_CRATE_TYPES, - ast::CRATE_NODE_ID, - span, - "invalid `crate_type` value", - lint::builtin::BuiltinLintDiagnostics:: - UnknownCrateTypes( - span, - "did you mean".to_string(), - format!("\"{}\"", candidate) - ) - ); - } else { - session.buffer_lint( - lint::builtin::UNKNOWN_CRATE_TYPES, - ast::CRATE_NODE_ID, - span, - "invalid `crate_type` value" - ); - } - } - None - } - None => None - } - } else { - None - } - }) - .collect(); - - // If we're generating a test executable, then ignore all other output - // styles at all other locations - if session.opts.test { - return vec![config::CrateType::Executable]; - } - - // Only check command line flags if present. If no types are specified by - // command line, then reuse the empty `base` Vec to hold the types that - // will be found in crate attributes. - let mut base = session.opts.crate_types.clone(); - if base.is_empty() { - base.extend(attr_types); - if base.is_empty() { - base.push(::rustc_codegen_utils::link::default_output_for_target( - session, - )); - } else { - base.sort(); - base.dedup(); - } - } - - base.retain(|crate_type| { - let res = !::rustc_codegen_utils::link::invalid_output_for_target(session, *crate_type); - - if !res { - session.warn(&format!( - "dropping unsupported crate type `{}` for target `{}`", - *crate_type, session.opts.target_triple - )); - } - - res - }); - - base -} - -pub fn compute_crate_disambiguator(session: &Session) -> CrateDisambiguator { - use std::hash::Hasher; - - // The crate_disambiguator is a 128 bit hash. The disambiguator is fed - // into various other hashes quite a bit (symbol hashes, incr. comp. hashes, - // debuginfo type IDs, etc), so we don't want it to be too wide. 128 bits - // should still be safe enough to avoid collisions in practice. - let mut hasher = StableHasher::::new(); - - let mut metadata = session.opts.cg.metadata.clone(); - // We don't want the crate_disambiguator to dependent on the order - // -C metadata arguments, so sort them: - metadata.sort(); - // Every distinct -C metadata value is only incorporated once: - metadata.dedup(); - - hasher.write(b"metadata"); - for s in &metadata { - // Also incorporate the length of a metadata string, so that we generate - // different values for `-Cmetadata=ab -Cmetadata=c` and - // `-Cmetadata=a -Cmetadata=bc` - hasher.write_usize(s.len()); - hasher.write(s.as_bytes()); - } - - // Also incorporate crate type, so that we don't get symbol conflicts when - // linking against a library of the same name, if this is an executable. - let is_exe = session - .crate_types - .borrow() - .contains(&config::CrateType::Executable); - hasher.write(if is_exe { b"exe" } else { b"lib" }); - - CrateDisambiguator::from(hasher.finish()) -} - -pub fn build_output_filenames( - input: &Input, - odir: &Option, - ofile: &Option, - attrs: &[ast::Attribute], - sess: &Session, -) -> OutputFilenames { - match *ofile { - None => { - // "-" as input file will cause the parser to read from stdin so we - // have to make up a name - // We want to toss everything after the final '.' - let dirpath = (*odir).as_ref().cloned().unwrap_or_default(); - - // If a crate name is present, we use it as the link name - let stem = sess.opts - .crate_name - .clone() - .or_else(|| attr::find_crate_name(attrs).map(|n| n.to_string())) - .unwrap_or_else(|| input.filestem().to_owned()); - - OutputFilenames { - out_directory: dirpath, - out_filestem: stem, - single_output_file: None, - extra: sess.opts.cg.extra_filename.clone(), - outputs: sess.opts.output_types.clone(), - } - } - - Some(ref out_file) => { - let unnamed_output_types = sess.opts - .output_types - .values() - .filter(|a| a.is_none()) - .count(); - let ofile = if unnamed_output_types > 1 { - sess.warn( - "due to multiple output types requested, the explicitly specified \ - output file name will be adapted for each output type", - ); - None - } else { - Some(out_file.clone()) - }; - if *odir != None { - sess.warn("ignoring --out-dir flag due to -o flag"); - } - if !sess.opts.cg.extra_filename.is_empty() { - sess.warn("ignoring -C extra-filename flag due to -o flag"); - } - - OutputFilenames { - out_directory: out_file.parent().unwrap_or_else(|| Path::new("")).to_path_buf(), - out_filestem: out_file - .file_stem() - .unwrap_or_default() - .to_str() - .unwrap() - .to_string(), - single_output_file: ofile, - extra: sess.opts.cg.extra_filename.clone(), - outputs: sess.opts.output_types.clone(), - } - } - } -} diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index e022d3a3818a..52dbb618d0d1 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -27,7 +27,6 @@ extern crate rustc; extern crate rustc_allocator; extern crate rustc_target; extern crate rustc_borrowck; -#[macro_use] extern crate rustc_data_structures; extern crate rustc_errors as errors; extern crate rustc_passes; @@ -42,6 +41,7 @@ extern crate rustc_save_analysis; extern crate rustc_traits; extern crate rustc_codegen_utils; extern crate rustc_typeck; +extern crate rustc_interface; extern crate scoped_tls; extern crate serialize; extern crate smallvec; @@ -58,19 +58,18 @@ use rustc_save_analysis as save; use rustc_save_analysis::DumpHandler; use rustc_data_structures::sync::{self, Lrc, Ordering::SeqCst}; use rustc_data_structures::OnDrop; -use rustc::session::{self, config, Session, build_session, CompileResult}; +use rustc::session::{self, config, Session, build_session, CompileResult, DiagnosticOutput}; use rustc::session::CompileIncomplete; use rustc::session::config::{Input, PrintRequest, ErrorOutputType}; use rustc::session::config::nightly_options; -use rustc::session::filesearch; use rustc::session::{early_error, early_warn}; use rustc::lint::Lint; use rustc::lint; use rustc_metadata::locator; use rustc_metadata::cstore::CStore; -use rustc_metadata::dynamic_lib::DynamicLibrary; use rustc::util::common::{time, ErrorReported}; use rustc_codegen_utils::codegen_backend::CodegenBackend; +use rustc_interface::util::{self, get_codegen_sysroot}; use serialize::json::ToJson; @@ -78,19 +77,15 @@ use std::any::Any; use std::borrow::Cow; use std::cmp::max; use std::default::Default; -use std::env::consts::{DLL_PREFIX, DLL_SUFFIX}; use std::env; use std::error::Error; use std::ffi::OsString; use std::fmt::{self, Display}; use std::io::{self, Read, Write}; -use std::mem; use std::panic; -use std::path::{PathBuf, Path}; +use std::path::PathBuf; use std::process::{self, Command, Stdio}; use std::str; -use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::{Once, ONCE_INIT}; use std::thread; use syntax::ast; @@ -102,34 +97,8 @@ use syntax_pos::{DUMMY_SP, MultiSpan, FileName}; #[cfg(test)] mod test; -pub mod profile; pub mod driver; pub mod pretty; -mod proc_macro_decls; - -pub mod target_features { - use syntax::ast; - use syntax::symbol::Symbol; - use rustc::session::Session; - use rustc_codegen_utils::codegen_backend::CodegenBackend; - - /// Adds `target_feature = "..."` cfgs for a variety of platform - /// specific features (SSE, NEON etc.). - /// - /// This is performed by checking whether a whitelisted set of - /// features is available on the target machine, by querying LLVM. - pub fn add_configuration(cfg: &mut ast::CrateConfig, - sess: &Session, - codegen_backend: &dyn CodegenBackend) { - let tf = Symbol::intern("target_feature"); - - cfg.extend(codegen_backend.target_features(sess).into_iter().map(|feat| (tf, Some(feat)))); - - if sess.crt_static_feature() { - cfg.insert((tf, Some(Symbol::intern("crt-static")))); - } - } -} /// Exit status code used for successful compilation and help output. pub const EXIT_SUCCESS: isize = 0; @@ -196,235 +165,6 @@ pub fn run(run_compiler: F) -> isize } } -fn load_backend_from_dylib(path: &Path) -> fn() -> Box { - let lib = DynamicLibrary::open(Some(path)).unwrap_or_else(|err| { - let err = format!("couldn't load codegen backend {:?}: {:?}", path, err); - early_error(ErrorOutputType::default(), &err); - }); - unsafe { - match lib.symbol("__rustc_codegen_backend") { - Ok(f) => { - mem::forget(lib); - mem::transmute::<*mut u8, _>(f) - } - Err(e) => { - let err = format!("couldn't load codegen backend as it \ - doesn't export the `__rustc_codegen_backend` \ - symbol: {:?}", e); - early_error(ErrorOutputType::default(), &err); - } - } - } -} - -pub fn get_codegen_backend(sess: &Session) -> Box { - static INIT: Once = ONCE_INIT; - - #[allow(deprecated)] - #[no_debug] - static mut LOAD: fn() -> Box = || unreachable!(); - - INIT.call_once(|| { - let codegen_name = sess.opts.debugging_opts.codegen_backend.as_ref() - .unwrap_or(&sess.target.target.options.codegen_backend); - let backend = match &codegen_name[..] { - "metadata_only" => { - rustc_codegen_utils::codegen_backend::MetadataOnlyCodegenBackend::boxed - } - filename if filename.contains(".") => { - load_backend_from_dylib(filename.as_ref()) - } - codegen_name => get_codegen_sysroot(codegen_name), - }; - - unsafe { - LOAD = backend; - } - }); - let backend = unsafe { LOAD() }; - backend.init(sess); - backend -} - -fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box { - // For now we only allow this function to be called once as it'll dlopen a - // few things, which seems to work best if we only do that once. In - // general this assertion never trips due to the once guard in `get_codegen_backend`, - // but there's a few manual calls to this function in this file we protect - // against. - static LOADED: AtomicBool = AtomicBool::new(false); - assert!(!LOADED.fetch_or(true, Ordering::SeqCst), - "cannot load the default codegen backend twice"); - - // When we're compiling this library with `--test` it'll run as a binary but - // not actually exercise much functionality. As a result most of the logic - // here is defunkt (it assumes we're a dynamic library in a sysroot) so - // let's just return a dummy creation function which won't be used in - // general anyway. - if cfg!(test) { - return rustc_codegen_utils::codegen_backend::MetadataOnlyCodegenBackend::boxed - } - - let target = session::config::host_triple(); - let mut sysroot_candidates = vec![filesearch::get_or_default_sysroot()]; - let path = current_dll_path() - .and_then(|s| s.canonicalize().ok()); - if let Some(dll) = path { - // use `parent` twice to chop off the file name and then also the - // directory containing the dll which should be either `lib` or `bin`. - if let Some(path) = dll.parent().and_then(|p| p.parent()) { - // The original `path` pointed at the `rustc_driver` crate's dll. - // Now that dll should only be in one of two locations. The first is - // in the compiler's libdir, for example `$sysroot/lib/*.dll`. The - // other is the target's libdir, for example - // `$sysroot/lib/rustlib/$target/lib/*.dll`. - // - // We don't know which, so let's assume that if our `path` above - // ends in `$target` we *could* be in the target libdir, and always - // assume that we may be in the main libdir. - sysroot_candidates.push(path.to_owned()); - - if path.ends_with(target) { - sysroot_candidates.extend(path.parent() // chop off `$target` - .and_then(|p| p.parent()) // chop off `rustlib` - .and_then(|p| p.parent()) // chop off `lib` - .map(|s| s.to_owned())); - } - } - } - - let sysroot = sysroot_candidates.iter() - .map(|sysroot| { - let libdir = filesearch::relative_target_lib_path(&sysroot, &target); - sysroot.join(libdir).with_file_name( - option_env!("CFG_CODEGEN_BACKENDS_DIR").unwrap_or("codegen-backends")) - }) - .filter(|f| { - info!("codegen backend candidate: {}", f.display()); - f.exists() - }) - .next(); - let sysroot = sysroot.unwrap_or_else(|| { - let candidates = sysroot_candidates.iter() - .map(|p| p.display().to_string()) - .collect::>() - .join("\n* "); - let err = format!("failed to find a `codegen-backends` folder \ - in the sysroot candidates:\n* {}", candidates); - early_error(ErrorOutputType::default(), &err); - }); - info!("probing {} for a codegen backend", sysroot.display()); - - let d = sysroot.read_dir().unwrap_or_else(|e| { - let err = format!("failed to load default codegen backend, couldn't \ - read `{}`: {}", sysroot.display(), e); - early_error(ErrorOutputType::default(), &err); - }); - - let mut file: Option = None; - - let expected_name = format!("rustc_codegen_llvm-{}", backend_name); - for entry in d.filter_map(|e| e.ok()) { - let path = entry.path(); - let filename = match path.file_name().and_then(|s| s.to_str()) { - Some(s) => s, - None => continue, - }; - if !(filename.starts_with(DLL_PREFIX) && filename.ends_with(DLL_SUFFIX)) { - continue - } - let name = &filename[DLL_PREFIX.len() .. filename.len() - DLL_SUFFIX.len()]; - if name != expected_name { - continue - } - if let Some(ref prev) = file { - let err = format!("duplicate codegen backends found\n\ - first: {}\n\ - second: {}\n\ - ", prev.display(), path.display()); - early_error(ErrorOutputType::default(), &err); - } - file = Some(path.clone()); - } - - match file { - Some(ref s) => return load_backend_from_dylib(s), - None => { - let err = format!("failed to load default codegen backend for `{}`, \ - no appropriate codegen dylib found in `{}`", - backend_name, sysroot.display()); - early_error(ErrorOutputType::default(), &err); - } - } - - #[cfg(unix)] - fn current_dll_path() -> Option { - use std::ffi::{OsStr, CStr}; - use std::os::unix::prelude::*; - - unsafe { - let addr = current_dll_path as usize as *mut _; - let mut info = mem::zeroed(); - if libc::dladdr(addr, &mut info) == 0 { - info!("dladdr failed"); - return None - } - if info.dli_fname.is_null() { - info!("dladdr returned null pointer"); - return None - } - let bytes = CStr::from_ptr(info.dli_fname).to_bytes(); - let os = OsStr::from_bytes(bytes); - Some(PathBuf::from(os)) - } - } - - #[cfg(windows)] - fn current_dll_path() -> Option { - use std::ffi::OsString; - use std::os::windows::prelude::*; - - extern "system" { - fn GetModuleHandleExW(dwFlags: u32, - lpModuleName: usize, - phModule: *mut usize) -> i32; - fn GetModuleFileNameW(hModule: usize, - lpFilename: *mut u16, - nSize: u32) -> u32; - } - - const GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS: u32 = 0x00000004; - - unsafe { - let mut module = 0; - let r = GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, - current_dll_path as usize, - &mut module); - if r == 0 { - info!("GetModuleHandleExW failed: {}", io::Error::last_os_error()); - return None - } - let mut space = Vec::with_capacity(1024); - let r = GetModuleFileNameW(module, - space.as_mut_ptr(), - space.capacity() as u32); - if r == 0 { - info!("GetModuleFileNameW failed: {}", io::Error::last_os_error()); - return None - } - let r = r as usize; - if r >= space.capacity() { - info!("our buffer was too small? {}", - io::Error::last_os_error()); - return None - } - space.set_len(r); - let os = OsString::from_wide(&space); - Some(PathBuf::from(os)) - } - } -} - // Parse args and run the compiler. This is the primary entry point for rustc. // See comments on CompilerCalls below for details about the callbacks argument. // The FileLoader provides a way to load files from sources other than the file system. @@ -485,7 +225,12 @@ fn run_compiler_with_pool<'a>( let loader = file_loader.unwrap_or(box RealFileLoader); let source_map = Lrc::new(SourceMap::with_file_loader(loader, sopts.file_path_mapping())); let mut sess = session::build_session_with_source_map( - sopts, input_file_path.clone(), descriptions, source_map, emitter_dest, + sopts, + input_file_path.clone(), + descriptions, + source_map, + emitter_dest.map(|e| DiagnosticOutput::Raw(e)).unwrap_or(DiagnosticOutput::Default), + Default::default(), ); if let Some(err) = input_err { @@ -495,12 +240,12 @@ fn run_compiler_with_pool<'a>( return (Err(CompileIncomplete::Stopped), Some(sess)); } - let codegen_backend = get_codegen_backend(&sess); + let codegen_backend = util::get_codegen_backend(&sess); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let mut cfg = config::build_configuration(&sess, cfg); - target_features::add_configuration(&mut cfg, &sess, &*codegen_backend); + util::add_configuration(&mut cfg, &sess, &*codegen_backend); sess.parse_sess.config = cfg; let result = { @@ -710,8 +455,8 @@ fn stdout_isatty() -> bool { } fn handle_explain(code: &str, - descriptions: &errors::registry::Registry, output: ErrorOutputType) { + let descriptions = rustc_interface::util::diagnostics_registry(); let normalised = if code.starts_with("E") { code.to_string() } else { @@ -788,11 +533,11 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls { matches: &getopts::Matches, _: &config::Options, _: &ast::CrateConfig, - descriptions: &errors::registry::Registry, + _: &errors::registry::Registry, output: ErrorOutputType) -> Compilation { if let Some(ref code) = matches.opt_str("explain") { - handle_explain(code, descriptions, output); + handle_explain(code, output); return Compilation::Stop; } @@ -820,8 +565,8 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls { } rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let mut cfg = config::build_configuration(&sess, cfg.clone()); - let codegen_backend = get_codegen_backend(&sess); - target_features::add_configuration(&mut cfg, &sess, &*codegen_backend); + let codegen_backend = util::get_codegen_backend(&sess); + util::add_configuration(&mut cfg, &sess, &*codegen_backend); sess.parse_sess.config = cfg; let should_stop = RustcDefaultCalls::print_crate_info( &*codegen_backend, @@ -1024,13 +769,19 @@ impl RustcDefaultCalls { let input = input.unwrap_or_else(|| early_error(ErrorOutputType::default(), "no input file provided")); let attrs = attrs.as_ref().unwrap(); - let t_outputs = driver::build_output_filenames(input, odir, ofile, attrs, sess); + let t_outputs = rustc_interface::util::build_output_filenames( + input, + odir, + ofile, + attrs, + sess + ); let id = rustc_codegen_utils::link::find_crate_name(Some(sess), attrs, input); if *req == PrintRequest::CrateName { println!("{}", id); continue; } - let crate_types = driver::collect_crate_types(sess, attrs); + let crate_types = rustc_interface::util::collect_crate_types(sess, attrs); for &style in &crate_types { let fname = rustc_codegen_utils::link::filename_for_input( sess, diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 0698c15346eb..ac2f6da0c608 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -9,36 +9,33 @@ use rustc::hir::print as pprust_hir; use rustc::session::Session; use rustc::session::config::{Input, OutputFilenames}; use rustc::ty::{self, TyCtxt, Resolutions, AllArenas}; +use rustc_interface::util; use rustc_borrowck as borrowck; use rustc_borrowck::graphviz as borrowck_dot; -use rustc_data_structures::thin_vec::ThinVec; use rustc_metadata::cstore::CStore; use rustc_mir::util::{write_mir_pretty, write_mir_graphviz}; -use syntax::ast::{self, BlockCheckMode}; -use syntax::mut_visit::{*, MutVisitor, visit_clobber}; +use syntax::ast; +use syntax::mut_visit::MutVisitor; use syntax::print::{pprust}; use syntax::print::pprust::PrintState; -use syntax::ptr::P; -use syntax_pos::{self, FileName}; +use syntax_pos::FileName; use graphviz as dot; -use smallvec::SmallVec; use std::cell::Cell; use std::fs::File; use std::io::{self, Write}; -use std::ops::DerefMut; use std::option; use std::path::Path; use std::str::FromStr; -use std::mem; pub use self::UserIdentifiedItem::*; pub use self::PpSourceMode::*; pub use self::PpMode::*; use self::NodesMatchingUII::*; -use {abort_on_err, driver}; +use abort_on_err; +use driver; #[derive(Copy, Clone, PartialEq, Debug)] pub enum PpSourceMode { @@ -217,18 +214,19 @@ impl PpSourceMode { } PpmTyped => { let control = &driver::CompileController::basic(); - let codegen_backend = ::get_codegen_backend(sess); + let codegen_backend = util::get_codegen_backend(sess); let mut arenas = AllArenas::new(); - abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend, - control, - sess, - cstore, - hir_map.clone(), - resolutions.clone(), - &mut arenas, - id, - output_filenames, - |tcx, _, _| { + driver::phase_3_run_analysis_passes(&*codegen_backend, + control, + sess, + cstore, + hir_map.clone(), + resolutions.clone(), + &mut arenas, + id, + output_filenames, + |tcx, _, result| { + abort_on_err(result, tcx.sess); let empty_tables = ty::TypeckTables::empty(None); let annotation = TypedAnnotation { tcx, @@ -237,8 +235,7 @@ impl PpSourceMode { tcx.dep_graph.with_ignore(|| { f(&annotation, hir_map.forest.krate()) }) - }), - sess) + }) } _ => panic!("Should use call_with_pp_support"), } @@ -627,204 +624,6 @@ impl UserIdentifiedItem { } } -// Note: Also used by librustdoc, see PR #43348. Consider moving this struct elsewhere. -// -// FIXME: Currently the `everybody_loops` transformation is not applied to: -// * `const fn`, due to issue #43636 that `loop` is not supported for const evaluation. We are -// waiting for miri to fix that. -// * `impl Trait`, due to issue #43869 that functions returning impl Trait cannot be diverging. -// Solving this may require `!` to implement every trait, which relies on the an even more -// ambitious form of the closed RFC #1637. See also [#34511]. -// -// [#34511]: https://github.com/rust-lang/rust/issues/34511#issuecomment-322340401 -pub struct ReplaceBodyWithLoop<'a> { - within_static_or_const: bool, - nested_blocks: Option>, - sess: &'a Session, -} - -impl<'a> ReplaceBodyWithLoop<'a> { - pub fn new(sess: &'a Session) -> ReplaceBodyWithLoop<'a> { - ReplaceBodyWithLoop { - within_static_or_const: false, - nested_blocks: None, - sess - } - } - - fn run R>(&mut self, is_const: bool, action: F) -> R { - let old_const = mem::replace(&mut self.within_static_or_const, is_const); - let old_blocks = self.nested_blocks.take(); - let ret = action(self); - self.within_static_or_const = old_const; - self.nested_blocks = old_blocks; - ret - } - - fn should_ignore_fn(ret_ty: &ast::FnDecl) -> bool { - if let ast::FunctionRetTy::Ty(ref ty) = ret_ty.output { - fn involves_impl_trait(ty: &ast::Ty) -> bool { - match ty.node { - ast::TyKind::ImplTrait(..) => true, - ast::TyKind::Slice(ref subty) | - ast::TyKind::Array(ref subty, _) | - ast::TyKind::Ptr(ast::MutTy { ty: ref subty, .. }) | - ast::TyKind::Rptr(_, ast::MutTy { ty: ref subty, .. }) | - ast::TyKind::Paren(ref subty) => involves_impl_trait(subty), - ast::TyKind::Tup(ref tys) => any_involves_impl_trait(tys.iter()), - ast::TyKind::Path(_, ref path) => path.segments.iter().any(|seg| { - match seg.args.as_ref().map(|generic_arg| &**generic_arg) { - None => false, - Some(&ast::GenericArgs::AngleBracketed(ref data)) => { - let types = data.args.iter().filter_map(|arg| match arg { - ast::GenericArg::Type(ty) => Some(ty), - _ => None, - }); - any_involves_impl_trait(types.into_iter()) || - any_involves_impl_trait(data.bindings.iter().map(|b| &b.ty)) - }, - Some(&ast::GenericArgs::Parenthesized(ref data)) => { - any_involves_impl_trait(data.inputs.iter()) || - any_involves_impl_trait(data.output.iter()) - } - } - }), - _ => false, - } - } - - fn any_involves_impl_trait<'a, I: Iterator>>(mut it: I) -> bool { - it.any(|subty| involves_impl_trait(subty)) - } - - involves_impl_trait(ty) - } else { - false - } - } -} - -impl<'a> MutVisitor for ReplaceBodyWithLoop<'a> { - fn visit_item_kind(&mut self, i: &mut ast::ItemKind) { - let is_const = match i { - ast::ItemKind::Static(..) | ast::ItemKind::Const(..) => true, - ast::ItemKind::Fn(ref decl, ref header, _, _) => - header.constness.node == ast::Constness::Const || Self::should_ignore_fn(decl), - _ => false, - }; - self.run(is_const, |s| noop_visit_item_kind(i, s)) - } - - fn flat_map_trait_item(&mut self, i: ast::TraitItem) -> SmallVec<[ast::TraitItem; 1]> { - let is_const = match i.node { - ast::TraitItemKind::Const(..) => true, - ast::TraitItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) => - header.constness.node == ast::Constness::Const || Self::should_ignore_fn(decl), - _ => false, - }; - self.run(is_const, |s| noop_flat_map_trait_item(i, s)) - } - - fn flat_map_impl_item(&mut self, i: ast::ImplItem) -> SmallVec<[ast::ImplItem; 1]> { - let is_const = match i.node { - ast::ImplItemKind::Const(..) => true, - ast::ImplItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) => - header.constness.node == ast::Constness::Const || Self::should_ignore_fn(decl), - _ => false, - }; - self.run(is_const, |s| noop_flat_map_impl_item(i, s)) - } - - fn visit_anon_const(&mut self, c: &mut ast::AnonConst) { - self.run(true, |s| noop_visit_anon_const(c, s)) - } - - fn visit_block(&mut self, b: &mut P) { - fn stmt_to_block(rules: ast::BlockCheckMode, - s: Option, - sess: &Session) -> ast::Block { - ast::Block { - stmts: s.into_iter().collect(), - rules, - id: sess.next_node_id(), - span: syntax_pos::DUMMY_SP, - } - } - - fn block_to_stmt(b: ast::Block, sess: &Session) -> ast::Stmt { - let expr = P(ast::Expr { - id: sess.next_node_id(), - node: ast::ExprKind::Block(P(b), None), - span: syntax_pos::DUMMY_SP, - attrs: ThinVec::new(), - }); - - ast::Stmt { - id: sess.next_node_id(), - node: ast::StmtKind::Expr(expr), - span: syntax_pos::DUMMY_SP, - } - } - - let empty_block = stmt_to_block(BlockCheckMode::Default, None, self.sess); - let loop_expr = P(ast::Expr { - node: ast::ExprKind::Loop(P(empty_block), None), - id: self.sess.next_node_id(), - span: syntax_pos::DUMMY_SP, - attrs: ThinVec::new(), - }); - - let loop_stmt = ast::Stmt { - id: self.sess.next_node_id(), - span: syntax_pos::DUMMY_SP, - node: ast::StmtKind::Expr(loop_expr), - }; - - if self.within_static_or_const { - noop_visit_block(b, self) - } else { - visit_clobber(b.deref_mut(), |b| { - let mut stmts = vec![]; - for s in b.stmts { - let old_blocks = self.nested_blocks.replace(vec![]); - - stmts.extend(self.flat_map_stmt(s).into_iter().filter(|s| s.is_item())); - - // we put a Some in there earlier with that replace(), so this is valid - let new_blocks = self.nested_blocks.take().unwrap(); - self.nested_blocks = old_blocks; - stmts.extend(new_blocks.into_iter().map(|b| block_to_stmt(b, &self.sess))); - } - - let mut new_block = ast::Block { - stmts, - ..b - }; - - if let Some(old_blocks) = self.nested_blocks.as_mut() { - //push our fresh block onto the cache and yield an empty block with `loop {}` - if !new_block.stmts.is_empty() { - old_blocks.push(new_block); - } - - stmt_to_block(b.rules, Some(loop_stmt), self.sess) - } else { - //push `loop {}` onto the end of our fresh block and yield that - new_block.stmts.push(loop_stmt); - - new_block - } - }) - } - } - - // in general the pretty printer processes unexpanded code, so - // we override the default `visit_mac` method which panics. - fn visit_mac(&mut self, mac: &mut ast::Mac) { - noop_visit_mac(mac, self) - } -} - fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec, tcx: TyCtxt<'a, 'tcx, 'tcx>, code: blocks::Code<'tcx>, @@ -892,12 +691,12 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec, pub fn visit_crate(sess: &Session, krate: &mut ast::Crate, ppm: PpMode) { if let PpmSource(PpmEveryBodyLoops) = ppm { - ReplaceBodyWithLoop::new(sess).visit_crate(krate); + util::ReplaceBodyWithLoop::new(sess).visit_crate(krate); } } fn get_source(input: &Input, sess: &Session) -> (Vec, FileName) { - let src_name = driver::source_name(input); + let src_name = input.source_name(); let src = sess.source_map() .get_source_file(&src_name) .unwrap() @@ -1117,18 +916,19 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session, let mut out = Vec::new(); let control = &driver::CompileController::basic(); - let codegen_backend = ::get_codegen_backend(sess); + let codegen_backend = util::get_codegen_backend(sess); let mut arenas = AllArenas::new(); - abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend, - control, - sess, - cstore, - hir_map.clone(), - resolutions.clone(), - &mut arenas, - crate_name, - output_filenames, - |tcx, _, _| { + driver::phase_3_run_analysis_passes(&*codegen_backend, + control, + sess, + cstore, + hir_map.clone(), + resolutions.clone(), + &mut arenas, + crate_name, + output_filenames, + |tcx, _, result| { + abort_on_err(result, tcx.sess); match ppm { PpmMir | PpmMirCFG => { if let Some(nodeid) = nodeid { @@ -1174,9 +974,7 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session, } _ => unreachable!(), } - }), - sess) - .unwrap(); + }).unwrap(); write_output(out, ofile); } diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index 2ec755bd6269..309a9f7b5252 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -16,6 +16,7 @@ use rustc::ty::query::OnDiskCache; use rustc::ty::subst::Subst; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc_data_structures::sync::{self, Lrc}; +use rustc_interface::util; use rustc_lint; use rustc_metadata::cstore::CStore; use rustc_target::spec::abi::Abi; @@ -91,6 +92,13 @@ where options.debugging_opts.verbose = true; options.unstable_features = UnstableFeatures::Allow; + // When we're compiling this library with `--test` it'll run as a binary but + // not actually exercise much functionality. + // As a result most of the logic loading the codegen backend is defunkt + // (it assumes we're a dynamic library in a sysroot) + // so let's just use the metadata only backend which doesn't need to load any libraries. + options.debugging_opts.codegen_backend = Some("metadata_only".to_owned()); + driver::spawn_thread_pool(options, |options| { test_env_with_pool(options, source_string, args, body) }) @@ -111,8 +119,9 @@ fn test_env_with_pool( None, diagnostic_handler, Lrc::new(SourceMap::new(FilePathMapping::empty())), + Default::default(), ); - let cstore = CStore::new(::get_codegen_backend(&sess).metadata_loader()); + let cstore = CStore::new(util::get_codegen_backend(&sess).metadata_loader()); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let input = config::Input::Str { name: FileName::anon_source_code(&source_string), diff --git a/src/librustc_interface/Cargo.toml b/src/librustc_interface/Cargo.toml new file mode 100644 index 000000000000..1acd3dfc7656 --- /dev/null +++ b/src/librustc_interface/Cargo.toml @@ -0,0 +1,35 @@ +[package] +authors = ["The Rust Project Developers"] +name = "rustc_interface" +version = "0.0.0" + +[lib] +name = "rustc_interface" +path = "lib.rs" +crate-type = ["dylib"] + +[dependencies] +log = "0.4" +rustc-rayon = "0.1.1" +smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } +scoped-tls = { version = "0.1.1", features = ["nightly"] } +syntax = { path = "../libsyntax" } +syntax_ext = { path = "../libsyntax_ext" } +syntax_pos = { path = "../libsyntax_pos" } +serialize = { path = "../libserialize" } +rustc = { path = "../librustc" } +rustc_allocator = { path = "../librustc_allocator" } +rustc_borrowck = { path = "../librustc_borrowck" } +rustc_incremental = { path = "../librustc_incremental" } +rustc_traits = { path = "../librustc_traits" } +rustc_data_structures = { path = "../librustc_data_structures" } +rustc_codegen_utils = { path = "../librustc_codegen_utils" } +rustc_metadata = { path = "../librustc_metadata" } +rustc_mir = { path = "../librustc_mir" } +rustc_passes = { path = "../librustc_passes" } +rustc_typeck = { path = "../librustc_typeck" } +rustc_lint = { path = "../librustc_lint" } +rustc_errors = { path = "../librustc_errors" } +rustc_plugin = { path = "../librustc_plugin" } +rustc_privacy = { path = "../librustc_privacy" } +rustc_resolve = { path = "../librustc_resolve" } diff --git a/src/librustc_interface/lib.rs b/src/librustc_interface/lib.rs new file mode 100644 index 000000000000..e5c7c35a36d7 --- /dev/null +++ b/src/librustc_interface/lib.rs @@ -0,0 +1,43 @@ +#![feature(box_syntax)] +#![feature(set_stdio)] +#![feature(nll)] +#![feature(arbitrary_self_types)] +#![feature(generator_trait)] +#![cfg_attr(unix, feature(libc))] + +#![allow(unused_imports)] + +#![recursion_limit="256"] + +#[cfg(unix)] +extern crate libc; +#[macro_use] +extern crate log; +extern crate rustc; +extern crate rustc_codegen_utils; +extern crate rustc_allocator; +extern crate rustc_borrowck; +extern crate rustc_incremental; +extern crate rustc_traits; +#[macro_use] +extern crate rustc_data_structures; +extern crate rustc_errors; +extern crate rustc_lint; +extern crate rustc_metadata; +extern crate rustc_mir; +extern crate rustc_passes; +extern crate rustc_plugin; +extern crate rustc_privacy; +extern crate rustc_rayon as rayon; +extern crate rustc_resolve; +extern crate rustc_typeck; +extern crate smallvec; +extern crate serialize; +extern crate syntax; +extern crate syntax_pos; +extern crate syntax_ext; + +pub mod passes; +pub mod profile; +pub mod util; +pub mod proc_macro_decls; diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs new file mode 100644 index 000000000000..16ced6956380 --- /dev/null +++ b/src/librustc_interface/passes.rs @@ -0,0 +1,296 @@ +use util; +use proc_macro_decls; + +use rustc::dep_graph::DepGraph; +use rustc::hir; +use rustc::hir::lowering::lower_crate; +use rustc::hir::def_id::{CrateNum, LOCAL_CRATE}; +use rustc::lint; +use rustc::middle::{self, reachable, resolve_lifetime, stability}; +use rustc::middle::privacy::AccessLevels; +use rustc::ty::{self, AllArenas, Resolutions, TyCtxt}; +use rustc::ty::steal::Steal; +use rustc::traits; +use rustc::util::common::{time, ErrorReported}; +use rustc::util::profiling::ProfileCategory; +use rustc::session::{CompileResult, CrateDisambiguator, Session}; +use rustc::session::config::{self, Input, OutputFilenames, OutputType}; +use rustc::session::search_paths::PathKind; +use rustc_allocator as allocator; +use rustc_borrowck as borrowck; +use rustc_codegen_utils::codegen_backend::CodegenBackend; +use rustc_data_structures::fingerprint::Fingerprint; +use rustc_data_structures::stable_hasher::StableHasher; +use rustc_data_structures::sync::Lrc; +use rustc_incremental; +use rustc_metadata::creader::CrateLoader; +use rustc_metadata::cstore::{self, CStore}; +use rustc_mir as mir; +use rustc_passes::{self, ast_validation, hir_stats, loops, rvalue_promotion, layout_test}; +use rustc_plugin as plugin; +use rustc_plugin::registry::Registry; +use rustc_privacy; +use rustc_resolve::{Resolver, ResolverArenas}; +use rustc_traits; +use rustc_typeck as typeck; +use syntax::{self, ast, attr, diagnostics, visit}; +use syntax::early_buffered_lints::BufferedEarlyLint; +use syntax::ext::base::ExtCtxt; +use syntax::mut_visit::MutVisitor; +use syntax::parse::{self, PResult}; +use syntax::util::node_count::NodeCounter; +use syntax::util::lev_distance::find_best_match_for_name; +use syntax::symbol::Symbol; +use syntax_pos::{FileName, hygiene}; +use syntax_ext; + +use serialize::json; + +use std::any::Any; +use std::env; +use std::ffi::OsString; +use std::fs; +use std::io::{self, Write}; +use std::iter; +use std::path::{Path, PathBuf}; +use std::sync::mpsc; +use std::cell::RefCell; +use std::rc::Rc; +use std::mem; +use std::ops::Generator; + +/// Returns all the paths that correspond to generated files. +pub fn generated_output_paths( + sess: &Session, + outputs: &OutputFilenames, + exact_name: bool, + crate_name: &str, +) -> Vec { + let mut out_filenames = Vec::new(); + for output_type in sess.opts.output_types.keys() { + let file = outputs.path(*output_type); + match *output_type { + // If the filename has been overridden using `-o`, it will not be modified + // by appending `.rlib`, `.exe`, etc., so we can skip this transformation. + OutputType::Exe if !exact_name => for crate_type in sess.crate_types.borrow().iter() { + let p = ::rustc_codegen_utils::link::filename_for_input( + sess, + *crate_type, + crate_name, + outputs, + ); + out_filenames.push(p); + }, + OutputType::DepInfo if sess.opts.debugging_opts.dep_info_omit_d_target => { + // Don't add the dep-info output when omitting it from dep-info targets + } + _ => { + out_filenames.push(file); + } + } + } + out_filenames +} + +// Runs `f` on every output file path and returns the first non-None result, or None if `f` +// returns None for every file path. +fn check_output(output_paths: &[PathBuf], f: F) -> Option +where + F: Fn(&PathBuf) -> Option, +{ + for output_path in output_paths { + if let Some(result) = f(output_path) { + return Some(result); + } + } + None +} + +pub fn output_contains_path(output_paths: &[PathBuf], input_path: &PathBuf) -> bool { + let input_path = input_path.canonicalize().ok(); + if input_path.is_none() { + return false; + } + let check = |output_path: &PathBuf| { + if output_path.canonicalize().ok() == input_path { + Some(()) + } else { + None + } + }; + check_output(output_paths, check).is_some() +} + +pub fn output_conflicts_with_dir(output_paths: &[PathBuf]) -> Option { + let check = |output_path: &PathBuf| { + if output_path.is_dir() { + Some(output_path.clone()) + } else { + None + } + }; + check_output(output_paths, check) +} + +fn escape_dep_filename(filename: &FileName) -> String { + // Apparently clang and gcc *only* escape spaces: + // http://llvm.org/klaus/clang/commit/9d50634cfc268ecc9a7250226dd5ca0e945240d4 + filename.to_string().replace(" ", "\\ ") +} + +pub fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &[PathBuf]) { + // Write out dependency rules to the dep-info file if requested + if !sess.opts.output_types.contains_key(&OutputType::DepInfo) { + return; + } + let deps_filename = outputs.path(OutputType::DepInfo); + + let result = (|| -> io::Result<()> { + // Build a list of files used to compile the output and + // write Makefile-compatible dependency rules + let files: Vec = sess.source_map() + .files() + .iter() + .filter(|fmap| fmap.is_real_file()) + .filter(|fmap| !fmap.is_imported()) + .map(|fmap| escape_dep_filename(&fmap.name)) + .collect(); + let mut file = fs::File::create(&deps_filename)?; + for path in out_filenames { + writeln!(file, "{}: {}\n", path.display(), files.join(" "))?; + } + + // Emit a fake target for each input file to the compilation. This + // prevents `make` from spitting out an error if a file is later + // deleted. For more info see #28735 + for path in files { + writeln!(file, "{}:", path)?; + } + Ok(()) + })(); + + if let Err(e) = result { + sess.fatal(&format!( + "error writing dependencies to `{}`: {}", + deps_filename.display(), + e + )); + } +} + +pub fn provide(providers: &mut ty::query::Providers) { + providers.analysis = analysis; + proc_macro_decls::provide(providers); +} + +fn analysis<'tcx>( + tcx: TyCtxt<'_, 'tcx, 'tcx>, + cnum: CrateNum, +) -> Result<(), ErrorReported> { + assert_eq!(cnum, LOCAL_CRATE); + + let sess = tcx.sess; + + parallel!({ + time(sess, "looking for entry point", || { + middle::entry::find_entry_point(tcx) + }); + + time(sess, "looking for plugin registrar", || { + plugin::build::find_plugin_registrar(tcx) + }); + + time(sess, "looking for derive registrar", || { + proc_macro_decls::find(tcx) + }); + }, { + time(sess, "loop checking", || loops::check_crate(tcx)); + }, { + time(sess, "attribute checking", || { + hir::check_attr::check_crate(tcx) + }); + }, { + time(sess, "stability checking", || { + stability::check_unstable_api_usage(tcx) + }); + }); + + // passes are timed inside typeck + typeck::check_crate(tcx)?; + + time(sess, "misc checking", || { + parallel!({ + time(sess, "rvalue promotion", || { + rvalue_promotion::check_crate(tcx) + }); + }, { + time(sess, "intrinsic checking", || { + middle::intrinsicck::check_crate(tcx) + }); + }, { + time(sess, "match checking", || mir::matchck_crate(tcx)); + }, { + // this must run before MIR dump, because + // "not all control paths return a value" is reported here. + // + // maybe move the check to a MIR pass? + time(sess, "liveness checking", || { + middle::liveness::check_crate(tcx) + }); + }); + }); + + // Abort so we don't try to construct MIR with liveness errors. + // We also won't want to continue with errors from rvalue promotion + tcx.sess.abort_if_errors(); + + time(sess, "borrow checking", || { + if tcx.use_ast_borrowck() { + borrowck::check_crate(tcx); + } + }); + + time(sess, + "MIR borrow checking", + || tcx.par_body_owners(|def_id| { tcx.ensure().mir_borrowck(def_id); })); + + time(sess, "dumping chalk-like clauses", || { + rustc_traits::lowering::dump_program_clauses(tcx); + }); + + time(sess, "MIR effect checking", || { + for def_id in tcx.body_owners() { + mir::transform::check_unsafety::check_unsafety(tcx, def_id) + } + }); + + time(sess, "layout testing", || layout_test::test_layout(tcx)); + + // Avoid overwhelming user with errors if borrow checking failed. + // I'm not sure how helpful this is, to be honest, but it avoids + // a + // lot of annoying errors in the compile-fail tests (basically, + // lint warnings and so on -- kindck used to do this abort, but + // kindck is gone now). -nmatsakis + if sess.err_count() > 0 { + return Err(ErrorReported); + } + + time(sess, "misc checking", || { + parallel!({ + time(sess, "privacy checking", || { + rustc_privacy::check_crate(tcx) + }); + }, { + time(sess, "death checking", || middle::dead::check_crate(tcx)); + }, { + time(sess, "unused lib feature checking", || { + stability::check_unused_or_stable_features(tcx) + }); + }, { + time(sess, "lint checking", || lint::check_crate(tcx)); + }); + }); + + Ok(()) +} diff --git a/src/librustc_driver/proc_macro_decls.rs b/src/librustc_interface/proc_macro_decls.rs similarity index 100% rename from src/librustc_driver/proc_macro_decls.rs rename to src/librustc_interface/proc_macro_decls.rs diff --git a/src/librustc_driver/profile/mod.rs b/src/librustc_interface/profile/mod.rs similarity index 100% rename from src/librustc_driver/profile/mod.rs rename to src/librustc_interface/profile/mod.rs diff --git a/src/librustc_driver/profile/trace.rs b/src/librustc_interface/profile/trace.rs similarity index 100% rename from src/librustc_driver/profile/trace.rs rename to src/librustc_interface/profile/trace.rs diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs new file mode 100644 index 000000000000..6f92c3044621 --- /dev/null +++ b/src/librustc_interface/util.rs @@ -0,0 +1,702 @@ +use rustc::session::config::{Input, OutputFilenames, ErrorOutputType}; +use rustc::session::{self, config, early_error, filesearch, Session, DiagnosticOutput}; +use rustc::session::CrateDisambiguator; +use rustc::ty; +use rustc::lint; +use rustc_codegen_utils::codegen_backend::CodegenBackend; +use rustc_data_structures::sync::{Lock, Lrc}; +use rustc_data_structures::stable_hasher::StableHasher; +use rustc_data_structures::fingerprint::Fingerprint; +use rustc_data_structures::thin_vec::ThinVec; +use rustc_data_structures::fx::{FxHashSet, FxHashMap}; +use rustc_errors::registry::Registry; +use rustc_lint; +use rustc_metadata::dynamic_lib::DynamicLibrary; +use rustc_mir; +use rustc_passes; +use rustc_plugin; +use rustc_privacy; +use rustc_resolve; +use rustc_typeck; +use std::collections::HashSet; +use std::env; +use std::env::consts::{DLL_PREFIX, DLL_SUFFIX}; +use std::io::{self, Write}; +use std::mem; +use std::path::{Path, PathBuf}; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::{Arc, Mutex, Once}; +use std::ops::DerefMut; +use smallvec::SmallVec; +use syntax::ptr::P; +use syntax::mut_visit::{*, MutVisitor, visit_clobber}; +use syntax::ast::BlockCheckMode; +use syntax::util::lev_distance::find_best_match_for_name; +use syntax::source_map::{FileLoader, RealFileLoader, SourceMap}; +use syntax::symbol::Symbol; +use syntax::{self, ast, attr}; +#[cfg(not(parallel_compiler))] +use std::{thread, panic}; + +pub fn diagnostics_registry() -> Registry { + let mut all_errors = Vec::new(); + all_errors.extend_from_slice(&rustc::DIAGNOSTICS); + all_errors.extend_from_slice(&rustc_typeck::DIAGNOSTICS); + all_errors.extend_from_slice(&rustc_resolve::DIAGNOSTICS); + all_errors.extend_from_slice(&rustc_privacy::DIAGNOSTICS); + // FIXME: need to figure out a way to get these back in here + // all_errors.extend_from_slice(get_codegen_backend(sess).diagnostics()); + all_errors.extend_from_slice(&rustc_metadata::DIAGNOSTICS); + all_errors.extend_from_slice(&rustc_passes::DIAGNOSTICS); + all_errors.extend_from_slice(&rustc_plugin::DIAGNOSTICS); + all_errors.extend_from_slice(&rustc_mir::DIAGNOSTICS); + all_errors.extend_from_slice(&syntax::DIAGNOSTICS); + + Registry::new(&all_errors) +} + +/// Adds `target_feature = "..."` cfgs for a variety of platform +/// specific features (SSE, NEON etc.). +/// +/// This is performed by checking whether a whitelisted set of +/// features is available on the target machine, by querying LLVM. +pub fn add_configuration( + cfg: &mut ast::CrateConfig, + sess: &Session, + codegen_backend: &dyn CodegenBackend, +) { + let tf = Symbol::intern("target_feature"); + + cfg.extend( + codegen_backend + .target_features(sess) + .into_iter() + .map(|feat| (tf, Some(feat))), + ); + + if sess.crt_static_feature() { + cfg.insert((tf, Some(Symbol::intern("crt-static")))); + } +} + +fn load_backend_from_dylib(path: &Path) -> fn() -> Box { + let lib = DynamicLibrary::open(Some(path)).unwrap_or_else(|err| { + let err = format!("couldn't load codegen backend {:?}: {:?}", path, err); + early_error(ErrorOutputType::default(), &err); + }); + unsafe { + match lib.symbol("__rustc_codegen_backend") { + Ok(f) => { + mem::forget(lib); + mem::transmute::<*mut u8, _>(f) + } + Err(e) => { + let err = format!("couldn't load codegen backend as it \ + doesn't export the `__rustc_codegen_backend` \ + symbol: {:?}", e); + early_error(ErrorOutputType::default(), &err); + } + } + } +} + +pub fn get_codegen_backend(sess: &Session) -> Box { + static INIT: Once = Once::new(); + + static mut LOAD: fn() -> Box = || unreachable!(); + + INIT.call_once(|| { + let codegen_name = sess.opts.debugging_opts.codegen_backend.as_ref() + .unwrap_or(&sess.target.target.options.codegen_backend); + let backend = match &codegen_name[..] { + "metadata_only" => { + rustc_codegen_utils::codegen_backend::MetadataOnlyCodegenBackend::boxed + } + filename if filename.contains(".") => { + load_backend_from_dylib(filename.as_ref()) + } + codegen_name => get_codegen_sysroot(codegen_name), + }; + + unsafe { + LOAD = backend; + } + }); + let backend = unsafe { LOAD() }; + backend.init(sess); + backend +} + +pub fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box { + // For now we only allow this function to be called once as it'll dlopen a + // few things, which seems to work best if we only do that once. In + // general this assertion never trips due to the once guard in `get_codegen_backend`, + // but there's a few manual calls to this function in this file we protect + // against. + static LOADED: AtomicBool = AtomicBool::new(false); + assert!(!LOADED.fetch_or(true, Ordering::SeqCst), + "cannot load the default codegen backend twice"); + + let target = session::config::host_triple(); + let mut sysroot_candidates = vec![filesearch::get_or_default_sysroot()]; + let path = current_dll_path() + .and_then(|s| s.canonicalize().ok()); + if let Some(dll) = path { + // use `parent` twice to chop off the file name and then also the + // directory containing the dll which should be either `lib` or `bin`. + if let Some(path) = dll.parent().and_then(|p| p.parent()) { + // The original `path` pointed at the `rustc_driver` crate's dll. + // Now that dll should only be in one of two locations. The first is + // in the compiler's libdir, for example `$sysroot/lib/*.dll`. The + // other is the target's libdir, for example + // `$sysroot/lib/rustlib/$target/lib/*.dll`. + // + // We don't know which, so let's assume that if our `path` above + // ends in `$target` we *could* be in the target libdir, and always + // assume that we may be in the main libdir. + sysroot_candidates.push(path.to_owned()); + + if path.ends_with(target) { + sysroot_candidates.extend(path.parent() // chop off `$target` + .and_then(|p| p.parent()) // chop off `rustlib` + .and_then(|p| p.parent()) // chop off `lib` + .map(|s| s.to_owned())); + } + } + } + + let sysroot = sysroot_candidates.iter() + .map(|sysroot| { + let libdir = filesearch::relative_target_lib_path(&sysroot, &target); + sysroot.join(libdir).with_file_name( + option_env!("CFG_CODEGEN_BACKENDS_DIR").unwrap_or("codegen-backends")) + }) + .filter(|f| { + info!("codegen backend candidate: {}", f.display()); + f.exists() + }) + .next(); + let sysroot = sysroot.unwrap_or_else(|| { + let candidates = sysroot_candidates.iter() + .map(|p| p.display().to_string()) + .collect::>() + .join("\n* "); + let err = format!("failed to find a `codegen-backends` folder \ + in the sysroot candidates:\n* {}", candidates); + early_error(ErrorOutputType::default(), &err); + }); + info!("probing {} for a codegen backend", sysroot.display()); + + let d = sysroot.read_dir().unwrap_or_else(|e| { + let err = format!("failed to load default codegen backend, couldn't \ + read `{}`: {}", sysroot.display(), e); + early_error(ErrorOutputType::default(), &err); + }); + + let mut file: Option = None; + + let expected_name = format!("rustc_codegen_llvm-{}", backend_name); + for entry in d.filter_map(|e| e.ok()) { + let path = entry.path(); + let filename = match path.file_name().and_then(|s| s.to_str()) { + Some(s) => s, + None => continue, + }; + if !(filename.starts_with(DLL_PREFIX) && filename.ends_with(DLL_SUFFIX)) { + continue + } + let name = &filename[DLL_PREFIX.len() .. filename.len() - DLL_SUFFIX.len()]; + if name != expected_name { + continue + } + if let Some(ref prev) = file { + let err = format!("duplicate codegen backends found\n\ + first: {}\n\ + second: {}\n\ + ", prev.display(), path.display()); + early_error(ErrorOutputType::default(), &err); + } + file = Some(path.clone()); + } + + match file { + Some(ref s) => return load_backend_from_dylib(s), + None => { + let err = format!("failed to load default codegen backend for `{}`, \ + no appropriate codegen dylib found in `{}`", + backend_name, sysroot.display()); + early_error(ErrorOutputType::default(), &err); + } + } + + #[cfg(unix)] + fn current_dll_path() -> Option { + use std::ffi::{OsStr, CStr}; + use std::os::unix::prelude::*; + + unsafe { + let addr = current_dll_path as usize as *mut _; + let mut info = mem::zeroed(); + if libc::dladdr(addr, &mut info) == 0 { + info!("dladdr failed"); + return None + } + if info.dli_fname.is_null() { + info!("dladdr returned null pointer"); + return None + } + let bytes = CStr::from_ptr(info.dli_fname).to_bytes(); + let os = OsStr::from_bytes(bytes); + Some(PathBuf::from(os)) + } + } + + #[cfg(windows)] + fn current_dll_path() -> Option { + use std::ffi::OsString; + use std::os::windows::prelude::*; + + extern "system" { + fn GetModuleHandleExW(dwFlags: u32, + lpModuleName: usize, + phModule: *mut usize) -> i32; + fn GetModuleFileNameW(hModule: usize, + lpFilename: *mut u16, + nSize: u32) -> u32; + } + + const GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS: u32 = 0x00000004; + + unsafe { + let mut module = 0; + let r = GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, + current_dll_path as usize, + &mut module); + if r == 0 { + info!("GetModuleHandleExW failed: {}", io::Error::last_os_error()); + return None + } + let mut space = Vec::with_capacity(1024); + let r = GetModuleFileNameW(module, + space.as_mut_ptr(), + space.capacity() as u32); + if r == 0 { + info!("GetModuleFileNameW failed: {}", io::Error::last_os_error()); + return None + } + let r = r as usize; + if r >= space.capacity() { + info!("our buffer was too small? {}", + io::Error::last_os_error()); + return None + } + space.set_len(r); + let os = OsString::from_wide(&space); + Some(PathBuf::from(os)) + } + } +} + +pub fn compute_crate_disambiguator(session: &Session) -> CrateDisambiguator { + use std::hash::Hasher; + + // The crate_disambiguator is a 128 bit hash. The disambiguator is fed + // into various other hashes quite a bit (symbol hashes, incr. comp. hashes, + // debuginfo type IDs, etc), so we don't want it to be too wide. 128 bits + // should still be safe enough to avoid collisions in practice. + let mut hasher = StableHasher::::new(); + + let mut metadata = session.opts.cg.metadata.clone(); + // We don't want the crate_disambiguator to dependent on the order + // -C metadata arguments, so sort them: + metadata.sort(); + // Every distinct -C metadata value is only incorporated once: + metadata.dedup(); + + hasher.write(b"metadata"); + for s in &metadata { + // Also incorporate the length of a metadata string, so that we generate + // different values for `-Cmetadata=ab -Cmetadata=c` and + // `-Cmetadata=a -Cmetadata=bc` + hasher.write_usize(s.len()); + hasher.write(s.as_bytes()); + } + + // Also incorporate crate type, so that we don't get symbol conflicts when + // linking against a library of the same name, if this is an executable. + let is_exe = session + .crate_types + .borrow() + .contains(&config::CrateType::Executable); + hasher.write(if is_exe { b"exe" } else { b"lib" }); + + CrateDisambiguator::from(hasher.finish()) +} + +pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute]) -> Vec { + // Unconditionally collect crate types from attributes to make them used + let attr_types: Vec = attrs + .iter() + .filter_map(|a| { + if a.check_name("crate_type") { + match a.value_str() { + Some(ref n) if *n == "rlib" => Some(config::CrateType::Rlib), + Some(ref n) if *n == "dylib" => Some(config::CrateType::Dylib), + Some(ref n) if *n == "cdylib" => Some(config::CrateType::Cdylib), + Some(ref n) if *n == "lib" => Some(config::default_lib_output()), + Some(ref n) if *n == "staticlib" => Some(config::CrateType::Staticlib), + Some(ref n) if *n == "proc-macro" => Some(config::CrateType::ProcMacro), + Some(ref n) if *n == "bin" => Some(config::CrateType::Executable), + Some(ref n) => { + let crate_types = vec![ + Symbol::intern("rlib"), + Symbol::intern("dylib"), + Symbol::intern("cdylib"), + Symbol::intern("lib"), + Symbol::intern("staticlib"), + Symbol::intern("proc-macro"), + Symbol::intern("bin") + ]; + + if let ast::MetaItemKind::NameValue(spanned) = a.meta().unwrap().node { + let span = spanned.span; + let lev_candidate = find_best_match_for_name( + crate_types.iter(), + &n.as_str(), + None + ); + if let Some(candidate) = lev_candidate { + session.buffer_lint_with_diagnostic( + lint::builtin::UNKNOWN_CRATE_TYPES, + ast::CRATE_NODE_ID, + span, + "invalid `crate_type` value", + lint::builtin::BuiltinLintDiagnostics:: + UnknownCrateTypes( + span, + "did you mean".to_string(), + format!("\"{}\"", candidate) + ) + ); + } else { + session.buffer_lint( + lint::builtin::UNKNOWN_CRATE_TYPES, + ast::CRATE_NODE_ID, + span, + "invalid `crate_type` value" + ); + } + } + None + } + None => None + } + } else { + None + } + }) + .collect(); + + // If we're generating a test executable, then ignore all other output + // styles at all other locations + if session.opts.test { + return vec![config::CrateType::Executable]; + } + + // Only check command line flags if present. If no types are specified by + // command line, then reuse the empty `base` Vec to hold the types that + // will be found in crate attributes. + let mut base = session.opts.crate_types.clone(); + if base.is_empty() { + base.extend(attr_types); + if base.is_empty() { + base.push(::rustc_codegen_utils::link::default_output_for_target( + session, + )); + } else { + base.sort(); + base.dedup(); + } + } + + base.retain(|crate_type| { + let res = !::rustc_codegen_utils::link::invalid_output_for_target(session, *crate_type); + + if !res { + session.warn(&format!( + "dropping unsupported crate type `{}` for target `{}`", + *crate_type, session.opts.target_triple + )); + } + + res + }); + + base +} + +pub fn build_output_filenames( + input: &Input, + odir: &Option, + ofile: &Option, + attrs: &[ast::Attribute], + sess: &Session, +) -> OutputFilenames { + match *ofile { + None => { + // "-" as input file will cause the parser to read from stdin so we + // have to make up a name + // We want to toss everything after the final '.' + let dirpath = (*odir).as_ref().cloned().unwrap_or_default(); + + // If a crate name is present, we use it as the link name + let stem = sess.opts + .crate_name + .clone() + .or_else(|| attr::find_crate_name(attrs).map(|n| n.to_string())) + .unwrap_or_else(|| input.filestem().to_owned()); + + OutputFilenames { + out_directory: dirpath, + out_filestem: stem, + single_output_file: None, + extra: sess.opts.cg.extra_filename.clone(), + outputs: sess.opts.output_types.clone(), + } + } + + Some(ref out_file) => { + let unnamed_output_types = sess.opts + .output_types + .values() + .filter(|a| a.is_none()) + .count(); + let ofile = if unnamed_output_types > 1 { + sess.warn( + "due to multiple output types requested, the explicitly specified \ + output file name will be adapted for each output type", + ); + None + } else { + Some(out_file.clone()) + }; + if *odir != None { + sess.warn("ignoring --out-dir flag due to -o flag"); + } + if !sess.opts.cg.extra_filename.is_empty() { + sess.warn("ignoring -C extra-filename flag due to -o flag"); + } + + OutputFilenames { + out_directory: out_file.parent().unwrap_or_else(|| Path::new("")).to_path_buf(), + out_filestem: out_file + .file_stem() + .unwrap_or_default() + .to_str() + .unwrap() + .to_string(), + single_output_file: ofile, + extra: sess.opts.cg.extra_filename.clone(), + outputs: sess.opts.output_types.clone(), + } + } + } +} + +// Note: Also used by librustdoc, see PR #43348. Consider moving this struct elsewhere. +// +// FIXME: Currently the `everybody_loops` transformation is not applied to: +// * `const fn`, due to issue #43636 that `loop` is not supported for const evaluation. We are +// waiting for miri to fix that. +// * `impl Trait`, due to issue #43869 that functions returning impl Trait cannot be diverging. +// Solving this may require `!` to implement every trait, which relies on the an even more +// ambitious form of the closed RFC #1637. See also [#34511]. +// +// [#34511]: https://github.com/rust-lang/rust/issues/34511#issuecomment-322340401 +pub struct ReplaceBodyWithLoop<'a> { + within_static_or_const: bool, + nested_blocks: Option>, + sess: &'a Session, +} + +impl<'a> ReplaceBodyWithLoop<'a> { + pub fn new(sess: &'a Session) -> ReplaceBodyWithLoop<'a> { + ReplaceBodyWithLoop { + within_static_or_const: false, + nested_blocks: None, + sess + } + } + + fn run R>(&mut self, is_const: bool, action: F) -> R { + let old_const = mem::replace(&mut self.within_static_or_const, is_const); + let old_blocks = self.nested_blocks.take(); + let ret = action(self); + self.within_static_or_const = old_const; + self.nested_blocks = old_blocks; + ret + } + + fn should_ignore_fn(ret_ty: &ast::FnDecl) -> bool { + if let ast::FunctionRetTy::Ty(ref ty) = ret_ty.output { + fn involves_impl_trait(ty: &ast::Ty) -> bool { + match ty.node { + ast::TyKind::ImplTrait(..) => true, + ast::TyKind::Slice(ref subty) | + ast::TyKind::Array(ref subty, _) | + ast::TyKind::Ptr(ast::MutTy { ty: ref subty, .. }) | + ast::TyKind::Rptr(_, ast::MutTy { ty: ref subty, .. }) | + ast::TyKind::Paren(ref subty) => involves_impl_trait(subty), + ast::TyKind::Tup(ref tys) => any_involves_impl_trait(tys.iter()), + ast::TyKind::Path(_, ref path) => path.segments.iter().any(|seg| { + match seg.args.as_ref().map(|generic_arg| &**generic_arg) { + None => false, + Some(&ast::GenericArgs::AngleBracketed(ref data)) => { + let types = data.args.iter().filter_map(|arg| match arg { + ast::GenericArg::Type(ty) => Some(ty), + _ => None, + }); + any_involves_impl_trait(types.into_iter()) || + any_involves_impl_trait(data.bindings.iter().map(|b| &b.ty)) + }, + Some(&ast::GenericArgs::Parenthesized(ref data)) => { + any_involves_impl_trait(data.inputs.iter()) || + any_involves_impl_trait(data.output.iter()) + } + } + }), + _ => false, + } + } + + fn any_involves_impl_trait<'a, I: Iterator>>(mut it: I) -> bool { + it.any(|subty| involves_impl_trait(subty)) + } + + involves_impl_trait(ty) + } else { + false + } + } +} + +impl<'a> MutVisitor for ReplaceBodyWithLoop<'a> { + fn visit_item_kind(&mut self, i: &mut ast::ItemKind) { + let is_const = match i { + ast::ItemKind::Static(..) | ast::ItemKind::Const(..) => true, + ast::ItemKind::Fn(ref decl, ref header, _, _) => + header.constness.node == ast::Constness::Const || Self::should_ignore_fn(decl), + _ => false, + }; + self.run(is_const, |s| noop_visit_item_kind(i, s)) + } + + fn flat_map_trait_item(&mut self, i: ast::TraitItem) -> SmallVec<[ast::TraitItem; 1]> { + let is_const = match i.node { + ast::TraitItemKind::Const(..) => true, + ast::TraitItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) => + header.constness.node == ast::Constness::Const || Self::should_ignore_fn(decl), + _ => false, + }; + self.run(is_const, |s| noop_flat_map_trait_item(i, s)) + } + + fn flat_map_impl_item(&mut self, i: ast::ImplItem) -> SmallVec<[ast::ImplItem; 1]> { + let is_const = match i.node { + ast::ImplItemKind::Const(..) => true, + ast::ImplItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) => + header.constness.node == ast::Constness::Const || Self::should_ignore_fn(decl), + _ => false, + }; + self.run(is_const, |s| noop_flat_map_impl_item(i, s)) + } + + fn visit_anon_const(&mut self, c: &mut ast::AnonConst) { + self.run(true, |s| noop_visit_anon_const(c, s)) + } + + fn visit_block(&mut self, b: &mut P) { + fn stmt_to_block(rules: ast::BlockCheckMode, + s: Option, + sess: &Session) -> ast::Block { + ast::Block { + stmts: s.into_iter().collect(), + rules, + id: sess.next_node_id(), + span: syntax_pos::DUMMY_SP, + } + } + + fn block_to_stmt(b: ast::Block, sess: &Session) -> ast::Stmt { + let expr = P(ast::Expr { + id: sess.next_node_id(), + node: ast::ExprKind::Block(P(b), None), + span: syntax_pos::DUMMY_SP, + attrs: ThinVec::new(), + }); + + ast::Stmt { + id: sess.next_node_id(), + node: ast::StmtKind::Expr(expr), + span: syntax_pos::DUMMY_SP, + } + } + + let empty_block = stmt_to_block(BlockCheckMode::Default, None, self.sess); + let loop_expr = P(ast::Expr { + node: ast::ExprKind::Loop(P(empty_block), None), + id: self.sess.next_node_id(), + span: syntax_pos::DUMMY_SP, + attrs: ThinVec::new(), + }); + + let loop_stmt = ast::Stmt { + id: self.sess.next_node_id(), + span: syntax_pos::DUMMY_SP, + node: ast::StmtKind::Expr(loop_expr), + }; + + if self.within_static_or_const { + noop_visit_block(b, self) + } else { + visit_clobber(b.deref_mut(), |b| { + let mut stmts = vec![]; + for s in b.stmts { + let old_blocks = self.nested_blocks.replace(vec![]); + + stmts.extend(self.flat_map_stmt(s).into_iter().filter(|s| s.is_item())); + + // we put a Some in there earlier with that replace(), so this is valid + let new_blocks = self.nested_blocks.take().unwrap(); + self.nested_blocks = old_blocks; + stmts.extend(new_blocks.into_iter().map(|b| block_to_stmt(b, &self.sess))); + } + + let mut new_block = ast::Block { + stmts, + ..b + }; + + if let Some(old_blocks) = self.nested_blocks.as_mut() { + //push our fresh block onto the cache and yield an empty block with `loop {}` + if !new_block.stmts.is_empty() { + old_blocks.push(new_block); + } + + stmt_to_block(b.rules, Some(loop_stmt), self.sess) + } else { + //push `loop {}` onto the end of our fresh block and yield that + new_block.stmts.push(loop_stmt); + + new_block + } + }) + } + } + + // in general the pretty printer processes unexpanded code, so + // we override the default `visit_mac` method which panics. + fn visit_mac(&mut self, mac: &mut ast::Mac) { + noop_visit_mac(mac, self) + } +} diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 3a430f77b6c6..5769ab253123 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -131,7 +131,7 @@ use std::ops::{self, Deref}; use std::slice; use crate::require_c_abi_if_c_variadic; -use crate::session::{CompileIncomplete, Session}; +use crate::session::Session; use crate::session::config::EntryFnType; use crate::TypeAndSubsts; use crate::lint; @@ -711,12 +711,12 @@ fn check_mod_item_types<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx }); } -pub fn check_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), CompileIncomplete> { +pub fn check_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.typeck_item_bodies(LOCAL_CRATE) } fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) - -> Result<(), CompileIncomplete> + -> Result<(), ErrorReported> { debug_assert!(crate_num == LOCAL_CRATE); Ok(tcx.sess.track_errors(|| { diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 2095c81d0fb0..00c2ab792869 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -102,7 +102,7 @@ use rustc::infer::InferOk; use rustc::lint; use rustc::middle; use rustc::session; -use rustc::session::CompileIncomplete; +use rustc::util::common::ErrorReported; use rustc::session::config::{EntryFnType, nightly_options}; use rustc::traits::{ObligationCause, ObligationCauseCode, TraitEngine, TraitEngineExt}; use rustc::ty::subst::SubstsRef; @@ -315,7 +315,7 @@ pub fn provide(providers: &mut Providers<'_>) { } pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) - -> Result<(), CompileIncomplete> + -> Result<(), ErrorReported> { tcx.sess.profiler(|p| p.start_activity(ProfileCategory::TypeChecking)); @@ -324,7 +324,6 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) tcx.sess.track_errors(|| { time(tcx.sess, "type collecting", || collect::collect_item_types(tcx)); - })?; if tcx.features().rustc_attrs { @@ -362,7 +361,11 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) tcx.sess.profiler(|p| p.end_activity(ProfileCategory::TypeChecking)); - tcx.sess.compile_status() + if tcx.sess.err_count() == 0 { + Ok(()) + } else { + Err(ErrorReported) + } } /// A quasi-deprecated helper used in rustdoc and save-analysis to get diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 4dce4e86cc44..fdb071638b79 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -1,5 +1,5 @@ use rustc_lint; -use rustc_driver::{self, driver, target_features, abort_on_err}; +use rustc_driver::{driver, abort_on_err}; use rustc::session::{self, config}; use rustc::hir::def_id::{DefId, DefIndex, DefIndexAddressSpace, CrateNum, LOCAL_CRATE}; use rustc::hir::def::Def; @@ -11,6 +11,7 @@ use rustc::hir::map as hir_map; use rustc::lint::{self, LintPass}; use rustc::session::config::ErrorOutputType; use rustc::util::nodemap::{FxHashMap, FxHashSet}; +use rustc_interface::util; use rustc_resolve as resolve; use rustc_metadata::creader::CrateLoader; use rustc_metadata::cstore::CStore; @@ -402,7 +403,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt debugging_options.ui_testing); let mut sess = session::build_session_( - sessopts, cpath, diagnostic_handler, source_map, + sessopts, cpath, diagnostic_handler, source_map, Default::default(), ); lint::builtin::HardwiredLints.get_lints() @@ -422,12 +423,12 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt lint::Allow); }); - let codegen_backend = rustc_driver::get_codegen_backend(&sess); + let codegen_backend = util::get_codegen_backend(&sess); let cstore = Rc::new(CStore::new(codegen_backend.metadata_loader())); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let mut cfg = config::build_configuration(&sess, config::parse_cfgspecs(cfgs)); - target_features::add_configuration(&mut cfg, &sess, &*codegen_backend); + util::add_configuration(&mut cfg, &sess, &*codegen_backend); sess.parse_sess.config = cfg; let control = &driver::CompileController::basic(); @@ -481,23 +482,23 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt let mut arenas = AllArenas::new(); let hir_map = hir_map::map_crate(&sess, &*cstore, &mut hir_forest, &defs); - let output_filenames = driver::build_output_filenames(&input, + let output_filenames = util::build_output_filenames(&input, &None, &None, &[], &sess); let resolver = RefCell::new(resolver); - abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend, - control, - &sess, - &*cstore, - hir_map, - resolutions, - &mut arenas, - &name, - &output_filenames, - |tcx, _, result| { + driver::phase_3_run_analysis_passes(&*codegen_backend, + control, + &sess, + &*cstore, + hir_map, + resolutions, + &mut arenas, + &name, + &output_filenames, + |tcx, _, result| { if result.is_err() { sess.fatal("Compilation failed, aborting rustdoc"); } @@ -615,6 +616,6 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt ctxt.sess().abort_if_errors(); (krate, ctxt.renderinfo.into_inner(), render_options, passes) - }), &sess) + }) }) } diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 39e504951d1c..b3807d750b6e 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -30,6 +30,7 @@ extern crate rustc_lint; extern crate rustc_metadata; extern crate rustc_target; extern crate rustc_typeck; +extern crate rustc_interface; extern crate serialize; extern crate syntax; extern crate syntax_pos; diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 8dad26f9292c..c3c0875bc7d2 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -2,9 +2,10 @@ use errors::{self, FatalError}; use errors::emitter::ColorConfig; use rustc_data_structures::sync::Lrc; use rustc_lint; -use rustc_driver::{self, driver, target_features, Compilation}; +use rustc_driver::{self, driver, Compilation}; use rustc_driver::driver::phase_2_configure_and_expand; use rustc_metadata::cstore::CStore; +use rustc_interface::util; use rustc::hir; use rustc::hir::intravisit; use rustc::session::{self, CompileIncomplete, config}; @@ -70,15 +71,15 @@ pub fn run(mut options: Options) -> isize { Some(source_map.clone())); let mut sess = session::build_session_( - sessopts, Some(options.input), handler, source_map.clone(), + sessopts, Some(options.input), handler, source_map.clone(), Default::default(), ); - let codegen_backend = rustc_driver::get_codegen_backend(&sess); + let codegen_backend = util::get_codegen_backend(&sess); let cstore = CStore::new(codegen_backend.metadata_loader()); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let mut cfg = config::build_configuration(&sess, config::parse_cfgspecs(options.cfgs.clone())); - target_features::add_configuration(&mut cfg, &sess, &*codegen_backend); + util::add_configuration(&mut cfg, &sess, &*codegen_backend); sess.parse_sess.config = cfg; let krate = @@ -274,9 +275,9 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize, let diagnostic_handler = errors::Handler::with_emitter(true, false, box emitter); let mut sess = session::build_session_( - sessopts, None, diagnostic_handler, source_map, + sessopts, None, diagnostic_handler, source_map, Default::default(), ); - let codegen_backend = rustc_driver::get_codegen_backend(&sess); + let codegen_backend = util::get_codegen_backend(&sess); let cstore = CStore::new(codegen_backend.metadata_loader()); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); @@ -305,7 +306,7 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize, let mut control = driver::CompileController::basic(); let mut cfg = config::build_configuration(&sess, config::parse_cfgspecs(cfgs.clone())); - target_features::add_configuration(&mut cfg, &sess, &*codegen_backend); + util::add_configuration(&mut cfg, &sess, &*codegen_backend); sess.parse_sess.config = cfg; let out = Some(outdir.lock().unwrap().path().join("rust_out")); diff --git a/src/test/run-make-fulldeps/issue-19371/foo.rs b/src/test/run-make-fulldeps/issue-19371/foo.rs index b8461c568c86..e9d825df2a46 100644 --- a/src/test/run-make-fulldeps/issue-19371/foo.rs +++ b/src/test/run-make-fulldeps/issue-19371/foo.rs @@ -6,6 +6,7 @@ extern crate rustc_lint; extern crate rustc_metadata; extern crate rustc_errors; extern crate rustc_codegen_utils; +extern crate rustc_interface; extern crate syntax; use rustc::session::{build_session, Session}; @@ -14,6 +15,7 @@ use rustc::session::config::{Input, Options, use rustc_driver::driver::{self, compile_input, CompileController}; use rustc_metadata::cstore::CStore; use rustc_errors::registry::Registry; +use rustc_interface::util; use syntax::source_map::FileName; use rustc_codegen_utils::codegen_backend::CodegenBackend; @@ -45,7 +47,7 @@ fn main() { fn basic_sess(opts: Options) -> (Session, Rc, Box) { let descriptions = Registry::new(&rustc::DIAGNOSTICS); let sess = build_session(opts, None, descriptions); - let codegen_backend = rustc_driver::get_codegen_backend(&sess); + let codegen_backend = util::get_codegen_backend(&sess); let cstore = Rc::new(CStore::new(codegen_backend.metadata_loader())); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); (sess, cstore, codegen_backend) diff --git a/src/test/rustdoc-ui/failed-doctest-output.stdout b/src/test/rustdoc-ui/failed-doctest-output.stdout index b7617ec556d2..895c40e4cab2 100644 --- a/src/test/rustdoc-ui/failed-doctest-output.stdout +++ b/src/test/rustdoc-ui/failed-doctest-output.stdout @@ -12,7 +12,7 @@ error[E0425]: cannot find value `no` in this scope 3 | no | ^^ not found in this scope -thread '$DIR/failed-doctest-output.rs - OtherStruct (line 17)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:351:13 +thread '$DIR/failed-doctest-output.rs - OtherStruct (line 17)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:352:13 note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace. ---- $DIR/failed-doctest-output.rs - SomeStruct (line 11) stdout ---- @@ -21,7 +21,7 @@ thread '$DIR/failed-doctest-output.rs - SomeStruct (line 11)' panicked at 'test thread 'main' panicked at 'oh no', $DIR/failed-doctest-output.rs:3:1 note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace. -', src/librustdoc/test.rs:372:17 +', src/librustdoc/test.rs:373:17 failures: diff --git a/src/test/ui/issues/issue-23302-3.stderr b/src/test/ui/issues/issue-23302-3.stderr index 392769b4c565..b3ca736622a2 100644 --- a/src/test/ui/issues/issue-23302-3.stderr +++ b/src/test/ui/issues/issue-23302-3.stderr @@ -20,6 +20,7 @@ note: ...which requires checking which parts of `B` are promotable to static... LL | const B: i32 = A; | ^ = note: ...which again requires const checking if rvalue is promotable to static `A`, completing the cycle + = note: cycle used when running analysis passes on this crate error: aborting due to previous error From 96be181c7ed004b2892addc22c285b321e029fd9 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 28 Feb 2019 16:34:03 -0500 Subject: [PATCH 119/381] Fixed a syntax error in the pin docs --- src/libcore/pin.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index f9f20dcea9e2..835357b4e017 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -215,7 +215,7 @@ //! had a method `fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T>`. //! Then we could do the following: //! ```compile_fail -//! fn exploit_ref_cell(rc: Pin<&mut RefCell) { +//! fn exploit_ref_cell(rc: Pin<&mut RefCell>) { //! { let p = rc.as_mut().get_pin_mut(); } // Here we get pinned access to the `T`. //! let rc_shr: &RefCell = rc.into_ref().get_ref(); //! let b = rc_shr.borrow_mut(); From 009c91a294e56878e3359d58903d5dc8d3d0f35b Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Wed, 30 Jan 2019 14:04:56 -0600 Subject: [PATCH 120/381] add option to calculate documentation coverage --- src/doc/rustdoc/src/unstable-features.md | 21 ++++ src/librustdoc/config.rs | 12 +++ src/librustdoc/core.rs | 11 +- src/librustdoc/lib.rs | 12 +++ .../passes/calculate_doc_coverage.rs | 101 ++++++++++++++++++ src/librustdoc/passes/mod.rs | 14 +++ 6 files changed, 167 insertions(+), 4 deletions(-) create mode 100644 src/librustdoc/passes/calculate_doc_coverage.rs diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index 3463cdb126cc..cb741d1bf99f 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -428,3 +428,24 @@ $ rustdoc src/lib.rs --test -Z unstable-options --persist-doctests target/rustdo This flag allows you to keep doctest executables around after they're compiled or run. Usually, rustdoc will immediately discard a compiled doctest after it's been tested, but with this option, you can keep those binaries around for farther testing. + +### `--show-coverage`: calculate the percentage of items with documentation + +Using this flag looks like this: + +```bash +$ rustdoc src/lib.rs -Z unstable-options --show-coverage +``` + +If you want to determine how many items in your crate are documented, pass this flag to rustdoc. +When it receives this flag, it will count the public items in your crate that have documentation, +and print out the counts and a percentage instead of generating docs. + +Some methodology notes about what rustdoc counts in this metric: + +* Rustdoc will only count items from your crate (i.e. items re-exported from other crates don't + count). +* Since trait implementations can inherit documentation from their trait, it will count trait impl + blocks separately, and show totals both with and without trait impls included. +* Inherent impl blocks are not counted, even though their doc comments are displayed, because the + common pattern in Rust code is to write all inherent methods into the same impl block. diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index b1c53ea92b30..d7c6b197164d 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -85,6 +85,9 @@ pub struct Options { /// Whether to display warnings during doc generation or while gathering doctests. By default, /// all non-rustdoc-specific lints are allowed when generating docs. pub display_warnings: bool, + /// Whether to run the `calculate-doc-coverage` pass, which counts the number of public items + /// with and without documentation. + pub show_coverage: bool, // Options that alter generated documentation pages @@ -128,6 +131,7 @@ impl fmt::Debug for Options { .field("default_passes", &self.default_passes) .field("manual_passes", &self.manual_passes) .field("display_warnings", &self.display_warnings) + .field("show_coverage", &self.show_coverage) .field("crate_version", &self.crate_version) .field("render_options", &self.render_options) .finish() @@ -224,6 +228,10 @@ impl Options { for &name in passes::DEFAULT_PRIVATE_PASSES { println!("{:>20}", name); } + println!("\nPasses run with `--show-coverage`:"); + for &name in passes::DEFAULT_COVERAGE_PASSES { + println!("{:>20}", name); + } return Err(0); } @@ -415,12 +423,15 @@ impl Options { let default_passes = if matches.opt_present("no-defaults") { passes::DefaultPassOption::None + } else if matches.opt_present("show-coverage") { + passes::DefaultPassOption::Coverage } else if matches.opt_present("document-private-items") { passes::DefaultPassOption::Private } else { passes::DefaultPassOption::Default }; let manual_passes = matches.opt_strs("passes"); + let show_coverage = matches.opt_present("show-coverage"); let crate_name = matches.opt_str("crate-name"); let playground_url = matches.opt_str("playground-url"); @@ -463,6 +474,7 @@ impl Options { default_passes, manual_passes, display_warnings, + show_coverage, crate_version, persist_doctests, render_options: RenderOptions { diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 4dce4e86cc44..76c3bca7c14c 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -605,10 +605,13 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt info!("Executing passes"); - for pass in &passes { - match passes::find_pass(pass).map(|p| p.pass) { - Some(pass) => krate = pass(krate, &ctxt), - None => error!("unknown pass {}, skipping", *pass), + for pass_name in &passes { + match passes::find_pass(pass_name).map(|p| p.pass) { + Some(pass) => { + debug!("running pass {}", pass_name); + krate = pass(krate, &ctxt); + } + None => error!("unknown pass {}, skipping", *pass_name), } } diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 39e504951d1c..625e3d05c299 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -347,6 +347,11 @@ fn opts() -> Vec { "generate-redirect-pages", "Generate extra pages to support legacy URLs and tool links") }), + unstable("show-coverage", |o| { + o.optflag("", + "show-coverage", + "calculate percentage of public items with documentation") + }), ] } @@ -391,7 +396,14 @@ fn main_args(args: &[String]) -> isize { let diag_opts = (options.error_format, options.debugging_options.treat_err_as_bug, options.debugging_options.ui_testing); + let show_coverage = options.show_coverage; rust_input(options, move |out| { + if show_coverage { + // if we ran coverage, bail early, we don't need to also generate docs at this point + // (also we didn't load in any of the useful passes) + return rustc_driver::EXIT_SUCCESS; + } + let Output { krate, passes, renderinfo, renderopts } = out; info!("going to format"); let (error_format, treat_err_as_bug, ui_testing) = diag_opts; diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs new file mode 100644 index 000000000000..b812415d6775 --- /dev/null +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -0,0 +1,101 @@ +use crate::clean; +use crate::core::DocContext; +use crate::fold::{self, DocFolder}; +use crate::passes::Pass; + +use syntax::attr; + +pub const CALCULATE_DOC_COVERAGE: Pass = Pass { + name: "calculate-doc-coverage", + pass: calculate_doc_coverage, + description: "counts the number of items with and without documentation", +}; + +fn calculate_doc_coverage(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { + let mut calc = CoverageCalculator::default(); + let krate = calc.fold_crate(krate); + + let total_minus_traits = calc.total - calc.total_trait_impls; + let docs_minus_traits = calc.with_docs - calc.trait_impls_with_docs; + + print!("Rustdoc found {}/{} items with documentation", calc.with_docs, calc.total); + println!(" ({}/{} not counting trait impls)", docs_minus_traits, total_minus_traits); + + if calc.total > 0 { + let percentage = (calc.with_docs as f64 * 100.0) / calc.total as f64; + let percentage_minus_traits = + (docs_minus_traits as f64 * 100.0) / total_minus_traits as f64; + println!(" Score: {:.1}% ({:.1}% not counting trait impls)", + percentage, percentage_minus_traits); + } + + krate +} + +#[derive(Default)] +struct CoverageCalculator { + total: usize, + with_docs: usize, + total_trait_impls: usize, + trait_impls_with_docs: usize, +} + +impl fold::DocFolder for CoverageCalculator { + fn fold_item(&mut self, i: clean::Item) -> Option { + match i.inner { + clean::StrippedItem(..) => {} + clean::ImplItem(ref impl_) + if attr::contains_name(&i.attrs.other_attrs, "automatically_derived") + || impl_.synthetic || impl_.blanket_impl.is_some() => + { + // skip counting anything inside these impl blocks + // FIXME(misdreavus): need to also find items that came out of a derive macro + return Some(i); + } + // non-local items are skipped because they can be out of the users control, especially + // in the case of trait impls, which rustdoc eagerly inlines + _ => if i.def_id.is_local() { + let has_docs = !i.attrs.doc_strings.is_empty(); + + if let clean::ImplItem(ref i) = i.inner { + if let Some(ref tr) = i.trait_ { + debug!("counting impl {:#} for {:#}", tr, i.for_); + + self.total += 1; + if has_docs { + self.with_docs += 1; + } + + // trait impls inherit their docs from the trait definition, so documenting + // them can be considered optional + + self.total_trait_impls += 1; + if has_docs { + self.trait_impls_with_docs += 1; + } + + for it in &i.items { + self.total_trait_impls += 1; + if !it.attrs.doc_strings.is_empty() { + self.trait_impls_with_docs += 1; + } + } + } else { + // inherent impls *can* be documented, and those docs show up, but in most + // cases it doesn't make sense, as all methods on a type are in one single + // impl block + debug!("not counting impl {:#}", i.for_); + } + } else { + debug!("counting {} {:?}", i.type_(), i.name); + self.total += 1; + if has_docs { + self.with_docs += 1; + } + } + } + } + + self.fold_item_recur(i) + } +} diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index 3a9d8ef20ce8..bda63ae18fd7 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -45,6 +45,9 @@ pub use self::collect_trait_impls::COLLECT_TRAIT_IMPLS; mod check_code_block_syntax; pub use self::check_code_block_syntax::CHECK_CODE_BLOCK_SYNTAX; +mod calculate_doc_coverage; +pub use self::calculate_doc_coverage::CALCULATE_DOC_COVERAGE; + /// A single pass over the cleaned documentation. /// /// Runs in the compiler context, so it has access to types and traits and the like. @@ -67,6 +70,7 @@ pub const PASSES: &'static [Pass] = &[ COLLECT_INTRA_DOC_LINKS, CHECK_CODE_BLOCK_SYNTAX, COLLECT_TRAIT_IMPLS, + CALCULATE_DOC_COVERAGE, ]; /// The list of passes run by default. @@ -94,12 +98,21 @@ pub const DEFAULT_PRIVATE_PASSES: &[&str] = &[ "propagate-doc-cfg", ]; +/// The list of default passes run when `--doc-coverage` is passed to rustdoc. +pub const DEFAULT_COVERAGE_PASSES: &'static [&'static str] = &[ + "collect-trait-impls", + "strip-hidden", + "strip-private", + "calculate-doc-coverage", +]; + /// A shorthand way to refer to which set of passes to use, based on the presence of /// `--no-defaults` or `--document-private-items`. #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum DefaultPassOption { Default, Private, + Coverage, None, } @@ -108,6 +121,7 @@ pub fn defaults(default_set: DefaultPassOption) -> &'static [&'static str] { match default_set { DefaultPassOption::Default => DEFAULT_PASSES, DefaultPassOption::Private => DEFAULT_PRIVATE_PASSES, + DefaultPassOption::Coverage => DEFAULT_COVERAGE_PASSES, DefaultPassOption::None => &[], } } From 9e98a25b9520861a6b443a1d28c04a9b1854e24e Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Wed, 30 Jan 2019 14:15:09 -0600 Subject: [PATCH 121/381] tabs -> spaces --- src/doc/rustdoc/src/unstable-features.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index cb741d1bf99f..d838f9d95132 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -53,7 +53,7 @@ For example, in the following code: ```rust /// Does the thing. pub fn do_the_thing(_: SomeType) { - println!("Let's do the thing!"); + println!("Let's do the thing!"); } /// Token you use to [`do_the_thing`]. @@ -66,15 +66,15 @@ target out also works: ```rust pub mod some_module { - /// Token you use to do the thing. - pub struct SomeStruct; + /// Token you use to do the thing. + pub struct SomeStruct; } /// Does the thing. Requires one [`SomeStruct`] for the thing to work. /// /// [`SomeStruct`]: some_module::SomeStruct pub fn do_the_thing(_: some_module::SomeStruct) { - println!("Let's do the thing!"); + println!("Let's do the thing!"); } ``` From fc9459351c0136715089f9e9d96f57fed2c80a52 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Wed, 20 Feb 2019 15:15:13 -0600 Subject: [PATCH 122/381] count fewer items in calculate-doc-coverage --- src/librustdoc/passes/calculate_doc_coverage.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs index b812415d6775..57ac75bf4d41 100644 --- a/src/librustdoc/passes/calculate_doc_coverage.rs +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -43,7 +43,11 @@ struct CoverageCalculator { impl fold::DocFolder for CoverageCalculator { fn fold_item(&mut self, i: clean::Item) -> Option { match i.inner { - clean::StrippedItem(..) => {} + clean::StrippedItem(..) => { + // don't count items in stripped modules + return Some(i); + } + clean::ImportItem(..) | clean::ExternCrateItem(..) => {} clean::ImplItem(ref impl_) if attr::contains_name(&i.attrs.other_attrs, "automatically_derived") || impl_.synthetic || impl_.blanket_impl.is_some() => From 95500c078bec0082fe0e4f3e20d962d436a0e099 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Wed, 20 Feb 2019 15:26:35 -0600 Subject: [PATCH 123/381] refactor: combine item count numbers into a new struct --- .../passes/calculate_doc_coverage.rs | 86 ++++++++++++------- 1 file changed, 57 insertions(+), 29 deletions(-) diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs index 57ac75bf4d41..cb6d180fbd3b 100644 --- a/src/librustdoc/passes/calculate_doc_coverage.rs +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -5,6 +5,9 @@ use crate::passes::Pass; use syntax::attr; +use std::ops::Sub; +use std::fmt; + pub const CALCULATE_DOC_COVERAGE: Pass = Pass { name: "calculate-doc-coverage", pass: calculate_doc_coverage, @@ -15,29 +18,66 @@ fn calculate_doc_coverage(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> cl let mut calc = CoverageCalculator::default(); let krate = calc.fold_crate(krate); - let total_minus_traits = calc.total - calc.total_trait_impls; - let docs_minus_traits = calc.with_docs - calc.trait_impls_with_docs; + let non_traits = calc.items - calc.trait_impl_items; - print!("Rustdoc found {}/{} items with documentation", calc.with_docs, calc.total); - println!(" ({}/{} not counting trait impls)", docs_minus_traits, total_minus_traits); + print!("Rustdoc found {} items with documentation", calc.items); + println!(" ({} not counting trait impls)", non_traits); - if calc.total > 0 { - let percentage = (calc.with_docs as f64 * 100.0) / calc.total as f64; - let percentage_minus_traits = - (docs_minus_traits as f64 * 100.0) / total_minus_traits as f64; + if let (Some(percentage), Some(percentage_non_traits)) = + (calc.items.percentage(), non_traits.percentage()) + { println!(" Score: {:.1}% ({:.1}% not counting trait impls)", - percentage, percentage_minus_traits); + percentage, percentage_non_traits); } krate } +#[derive(Default, Copy, Clone)] +struct ItemCount { + total: u64, + with_docs: u64, +} + +impl ItemCount { + fn count_item(&mut self, has_docs: bool) { + self.total += 1; + + if has_docs { + self.with_docs += 1; + } + } + + fn percentage(&self) -> Option { + if self.total > 0 { + Some((self.with_docs as f64 * 100.0) / self.total as f64) + } else { + None + } + } +} + +impl Sub for ItemCount { + type Output = Self; + + fn sub(self, rhs: Self) -> Self { + ItemCount { + total: self.total - rhs.total, + with_docs: self.with_docs - rhs.with_docs, + } + } +} + +impl fmt::Display for ItemCount { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}/{}", self.with_docs, self.total) + } +} + #[derive(Default)] struct CoverageCalculator { - total: usize, - with_docs: usize, - total_trait_impls: usize, - trait_impls_with_docs: usize, + items: ItemCount, + trait_impl_items: ItemCount, } impl fold::DocFolder for CoverageCalculator { @@ -65,24 +105,15 @@ impl fold::DocFolder for CoverageCalculator { if let Some(ref tr) = i.trait_ { debug!("counting impl {:#} for {:#}", tr, i.for_); - self.total += 1; - if has_docs { - self.with_docs += 1; - } + self.items.count_item(has_docs); // trait impls inherit their docs from the trait definition, so documenting // them can be considered optional - self.total_trait_impls += 1; - if has_docs { - self.trait_impls_with_docs += 1; - } + self.trait_impl_items.count_item(has_docs); for it in &i.items { - self.total_trait_impls += 1; - if !it.attrs.doc_strings.is_empty() { - self.trait_impls_with_docs += 1; - } + self.trait_impl_items.count_item(!it.attrs.doc_strings.is_empty()); } } else { // inherent impls *can* be documented, and those docs show up, but in most @@ -92,10 +123,7 @@ impl fold::DocFolder for CoverageCalculator { } } else { debug!("counting {} {:?}", i.type_(), i.name); - self.total += 1; - if has_docs { - self.with_docs += 1; - } + self.items.count_item(has_docs); } } } From 5eb1ab5265402cf0a40b71a5236cfe6289e7647d Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Thu, 21 Feb 2019 10:58:40 -0600 Subject: [PATCH 124/381] print doc coverage as a table of individual item types --- src/librustdoc/html/item_type.rs | 2 +- .../passes/calculate_doc_coverage.rs | 208 ++++++++++++++---- 2 files changed, 167 insertions(+), 43 deletions(-) diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs index 353fa4ae8c99..366e60b3ad92 100644 --- a/src/librustdoc/html/item_type.rs +++ b/src/librustdoc/html/item_type.rs @@ -15,7 +15,7 @@ use crate::clean; /// module headings. If you are adding to this enum and want to ensure that the sidebar also prints /// a heading, edit the listing in `html/render.rs`, function `sidebar_module`. This uses an /// ordering based on a helper function inside `item_module`, in the same file. -#[derive(Copy, PartialEq, Clone, Debug)] +#[derive(Copy, PartialEq, Eq, Clone, Debug, PartialOrd, Ord)] pub enum ItemType { Module = 0, ExternCrate = 1, diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs index cb6d180fbd3b..06f9a604ec83 100644 --- a/src/librustdoc/passes/calculate_doc_coverage.rs +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -1,12 +1,14 @@ use crate::clean; use crate::core::DocContext; +use crate::html::item_type::ItemType; use crate::fold::{self, DocFolder}; use crate::passes::Pass; use syntax::attr; -use std::ops::Sub; +use std::collections::BTreeMap; use std::fmt; +use std::ops; pub const CALCULATE_DOC_COVERAGE: Pass = Pass { name: "calculate-doc-coverage", @@ -18,17 +20,7 @@ fn calculate_doc_coverage(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> cl let mut calc = CoverageCalculator::default(); let krate = calc.fold_crate(krate); - let non_traits = calc.items - calc.trait_impl_items; - - print!("Rustdoc found {} items with documentation", calc.items); - println!(" ({} not counting trait impls)", non_traits); - - if let (Some(percentage), Some(percentage_non_traits)) = - (calc.items.percentage(), non_traits.percentage()) - { - println!(" Score: {:.1}% ({:.1}% not counting trait impls)", - percentage, percentage_non_traits); - } + calc.print_results(); krate } @@ -57,7 +49,7 @@ impl ItemCount { } } -impl Sub for ItemCount { +impl ops::Sub for ItemCount { type Output = Self; fn sub(self, rhs: Self) -> Self { @@ -68,6 +60,13 @@ impl Sub for ItemCount { } } +impl ops::AddAssign for ItemCount { + fn add_assign(&mut self, rhs: Self) { + self.total += rhs.total; + self.with_docs += rhs.with_docs; + } +} + impl fmt::Display for ItemCount { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}/{}", self.with_docs, self.total) @@ -76,58 +75,183 @@ impl fmt::Display for ItemCount { #[derive(Default)] struct CoverageCalculator { - items: ItemCount, - trait_impl_items: ItemCount, + items: BTreeMap, +} + +impl CoverageCalculator { + fn print_results(&self) { + use crate::html::item_type::ItemType::*; + + let mut total = ItemCount::default(); + + let main_types = [ + Module, Function, + Struct, StructField, + Enum, Variant, + Union, + Method, + Trait, TyMethod, + AssociatedType, AssociatedConst, + Macro, + Static, Constant, + ForeignType, Existential, + Typedef, TraitAlias, + Primitive, Keyword, + ]; + + println!("+-{0:->25}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); + println!("| {:<25} | {:>10} | {:>10} | {:>10} |", + "Item Type", "Documented", "Total", "Percentage"); + println!("+-{0:->25}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); + + for item_type in &main_types { + let count = self.items.get(item_type).cloned().unwrap_or_default(); + + if let Some(percentage) = count.percentage() { + println!("| {:<25} | {:>10} | {:>10} | {:>9.1}% |", + table_name(item_type), count.with_docs, count.total, percentage); + + total += count; + } + } + + println!("+-{0:->25}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); + + if let Some(count) = self.items.get(&Impl) { + if let Some(percentage) = count.percentage() { + if let Some(percentage) = total.percentage() { + println!("| {:<25} | {:>10} | {:>10} | {:>9.1}% |", + "Total (non trait impls)", total.with_docs, total.total, percentage); + } + + println!("+-{0:->25}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); + + println!("| {:<25} | {:>10} | {:>10} | {:>9.1}% |", + table_name(&Impl), count.with_docs, count.total, percentage); + + println!("+-{0:->25}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); + + total += *count; + } + } + + println!("| {:<25} | {:>10} | {:>10} | {:>9.1}% |", + "Total", total.with_docs, total.total, total.percentage().unwrap_or(0.0)); + println!("+-{0:->25}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); + } } impl fold::DocFolder for CoverageCalculator { - fn fold_item(&mut self, i: clean::Item) -> Option { + fn fold_item(&mut self, mut i: clean::Item) -> Option { + let has_docs = !i.attrs.doc_strings.is_empty(); + match i.inner { + _ if !i.def_id.is_local() => { + // non-local items are skipped because they can be out of the users control, + // especially in the case of trait impls, which rustdoc eagerly inlines + return Some(i); + } clean::StrippedItem(..) => { // don't count items in stripped modules return Some(i); } - clean::ImportItem(..) | clean::ExternCrateItem(..) => {} + clean::ImportItem(..) | clean::ExternCrateItem(..) => { + // docs on `use` and `extern crate` statements are not displayed, so they're not + // worth counting + return Some(i); + } clean::ImplItem(ref impl_) if attr::contains_name(&i.attrs.other_attrs, "automatically_derived") || impl_.synthetic || impl_.blanket_impl.is_some() => { - // skip counting anything inside these impl blocks + // built-in derives get the `#[automatically_derived]` attribute, and + // synthetic/blanket impls are made up by rustdoc and can't be documented // FIXME(misdreavus): need to also find items that came out of a derive macro return Some(i); } - // non-local items are skipped because they can be out of the users control, especially - // in the case of trait impls, which rustdoc eagerly inlines - _ => if i.def_id.is_local() { - let has_docs = !i.attrs.doc_strings.is_empty(); + clean::ImplItem(ref impl_) => { + if let Some(ref tr) = impl_.trait_ { + debug!("counting impl {:#} for {:#}", tr, impl_.for_); - if let clean::ImplItem(ref i) = i.inner { - if let Some(ref tr) = i.trait_ { - debug!("counting impl {:#} for {:#}", tr, i.for_); + // trait impls inherit their docs from the trait definition, so documenting + // them can be considered optional + self.items.entry(ItemType::Impl).or_default().count_item(has_docs); - self.items.count_item(has_docs); - - // trait impls inherit their docs from the trait definition, so documenting - // them can be considered optional - - self.trait_impl_items.count_item(has_docs); - - for it in &i.items { - self.trait_impl_items.count_item(!it.attrs.doc_strings.is_empty()); - } - } else { - // inherent impls *can* be documented, and those docs show up, but in most - // cases it doesn't make sense, as all methods on a type are in one single - // impl block - debug!("not counting impl {:#}", i.for_); + for it in &impl_.items { + let has_docs = !it.attrs.doc_strings.is_empty(); + self.items.entry(ItemType::Impl).or_default().count_item(has_docs); } + + // now skip recursing, so that we don't double-count this impl's items + return Some(i); } else { - debug!("counting {} {:?}", i.type_(), i.name); - self.items.count_item(has_docs); + // inherent impls *can* be documented, and those docs show up, but in most + // cases it doesn't make sense, as all methods on a type are in one single + // impl block + debug!("not counting impl {:#}", impl_.for_); } } + clean::MacroItem(..) | clean::ProcMacroItem(..) => { + // combine `macro_rules!` macros and proc-macros in the same count + debug!("counting macro {:?}", i.name); + self.items.entry(ItemType::Macro).or_default().count_item(has_docs); + } + clean::TraitItem(ref mut trait_) => { + // because both trait methods with a default impl and struct methods are + // ItemType::Method, we need to properly tag trait methods as TyMethod instead + debug!("counting trait {:?}", i.name); + self.items.entry(ItemType::Trait).or_default().count_item(has_docs); + + // since we're not going on to document the crate, it doesn't matter if we discard + // the item after counting it + trait_.items.retain(|it| { + if it.type_() == ItemType::Method { + let has_docs = !it.attrs.doc_strings.is_empty(); + self.items.entry(ItemType::TyMethod).or_default().count_item(has_docs); + false + } else { + true + } + }); + } + _ => { + debug!("counting {} {:?}", i.type_(), i.name); + self.items.entry(i.type_()).or_default().count_item(has_docs); + } } self.fold_item_recur(i) } } + +fn table_name(type_: &ItemType) -> &'static str { + match *type_ { + ItemType::Module => "Modules", + ItemType::Struct => "Structs", + ItemType::Union => "Unions", + ItemType::Enum => "Enums", + ItemType::Function => "Functions", + ItemType::Typedef => "Type Aliases", + ItemType::Static => "Statics", + ItemType::Trait => "Traits", + // inherent impls aren't counted, and trait impls get all their items thrown into this + // counter + ItemType::Impl => "Trait Impl Items", + // even though trait methods with a default impl get cleaned as Method, we convert them + // to TyMethod when counting + ItemType::TyMethod => "Trait Methods", + ItemType::Method => "Methods", + ItemType::StructField => "Struct Fields", + ItemType::Variant => "Enum Variants", + ItemType::Macro => "Macros", + ItemType::Primitive => "Primitives", + ItemType::AssociatedType => "Associated Types", + ItemType::Constant => "Constants", + ItemType::AssociatedConst => "Associated Constants", + ItemType::ForeignType => "Foreign Types", + ItemType::Keyword => "Keywords", + ItemType::Existential => "Existential Types", + ItemType::TraitAlias => "Trait Aliases", + _ => panic!("unanticipated ItemType: {}", type_), + } +} From a3a255990e714827601623634bbc5fd59f689f71 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Thu, 21 Feb 2019 11:10:12 -0600 Subject: [PATCH 125/381] add a coverage mode for private items --- src/librustdoc/config.rs | 14 +++++++++++--- src/librustdoc/passes/mod.rs | 9 +++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index d7c6b197164d..5cbcc2433ba5 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -232,6 +232,10 @@ impl Options { for &name in passes::DEFAULT_COVERAGE_PASSES { println!("{:>20}", name); } + println!("\nPasses run with `--show-coverage --document-private-items`:"); + for &name in passes::PRIVATE_COVERAGE_PASSES { + println!("{:>20}", name); + } return Err(0); } @@ -421,17 +425,21 @@ impl Options { } }); + let show_coverage = matches.opt_present("show-coverage"); + let document_private = matches.opt_present("document-private-items"); + let default_passes = if matches.opt_present("no-defaults") { passes::DefaultPassOption::None - } else if matches.opt_present("show-coverage") { + } else if show_coverage && document_private { + passes::DefaultPassOption::PrivateCoverage + } else if show_coverage { passes::DefaultPassOption::Coverage - } else if matches.opt_present("document-private-items") { + } else if document_private { passes::DefaultPassOption::Private } else { passes::DefaultPassOption::Default }; let manual_passes = matches.opt_strs("passes"); - let show_coverage = matches.opt_present("show-coverage"); let crate_name = matches.opt_str("crate-name"); let playground_url = matches.opt_str("playground-url"); diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index bda63ae18fd7..e36a029f9752 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -106,6 +106,13 @@ pub const DEFAULT_COVERAGE_PASSES: &'static [&'static str] = &[ "calculate-doc-coverage", ]; +/// The list of default passes run when `--doc-coverage --document-private-items` is passed to +/// rustdoc. +pub const PRIVATE_COVERAGE_PASSES: &'static [&'static str] = &[ + "collect-trait-impls", + "calculate-doc-coverage", +]; + /// A shorthand way to refer to which set of passes to use, based on the presence of /// `--no-defaults` or `--document-private-items`. #[derive(Copy, Clone, PartialEq, Eq, Debug)] @@ -113,6 +120,7 @@ pub enum DefaultPassOption { Default, Private, Coverage, + PrivateCoverage, None, } @@ -122,6 +130,7 @@ pub fn defaults(default_set: DefaultPassOption) -> &'static [&'static str] { DefaultPassOption::Default => DEFAULT_PASSES, DefaultPassOption::Private => DEFAULT_PRIVATE_PASSES, DefaultPassOption::Coverage => DEFAULT_COVERAGE_PASSES, + DefaultPassOption::PrivateCoverage => PRIVATE_COVERAGE_PASSES, DefaultPassOption::None => &[], } } From 3ce19b4a2c062a7a269bd2783a4a441d515b64c8 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Thu, 21 Feb 2019 16:02:21 -0600 Subject: [PATCH 126/381] tweak wording of extern types --- src/librustdoc/passes/calculate_doc_coverage.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs index 06f9a604ec83..f70de1ce9510 100644 --- a/src/librustdoc/passes/calculate_doc_coverage.rs +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -248,7 +248,7 @@ fn table_name(type_: &ItemType) -> &'static str { ItemType::AssociatedType => "Associated Types", ItemType::Constant => "Constants", ItemType::AssociatedConst => "Associated Constants", - ItemType::ForeignType => "Foreign Types", + ItemType::ForeignType => "Extern Types", ItemType::Keyword => "Keywords", ItemType::Existential => "Existential Types", ItemType::TraitAlias => "Trait Aliases", From 63bdd29ef4e744d6cacc2373b3b317eeebdf2a07 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Thu, 21 Feb 2019 16:02:56 -0600 Subject: [PATCH 127/381] add tests for doc coverage --- src/test/rustdoc-ui/coverage/basic.rs | 50 +++++++++++++++++++ src/test/rustdoc-ui/coverage/basic.stdout | 15 ++++++ src/test/rustdoc-ui/coverage/empty.rs | 4 ++ src/test/rustdoc-ui/coverage/empty.stdout | 7 +++ src/test/rustdoc-ui/coverage/enums.rs | 22 ++++++++ src/test/rustdoc-ui/coverage/enums.stdout | 10 ++++ src/test/rustdoc-ui/coverage/exotic.rs | 15 ++++++ src/test/rustdoc-ui/coverage/exotic.stdout | 9 ++++ src/test/rustdoc-ui/coverage/private.rs | 21 ++++++++ src/test/rustdoc-ui/coverage/private.stdout | 10 ++++ .../rustdoc-ui/coverage/statics-consts.rs | 23 +++++++++ .../rustdoc-ui/coverage/statics-consts.stdout | 12 +++++ src/test/rustdoc-ui/coverage/traits.rs | 37 ++++++++++++++ src/test/rustdoc-ui/coverage/traits.stdout | 16 ++++++ 14 files changed, 251 insertions(+) create mode 100644 src/test/rustdoc-ui/coverage/basic.rs create mode 100644 src/test/rustdoc-ui/coverage/basic.stdout create mode 100644 src/test/rustdoc-ui/coverage/empty.rs create mode 100644 src/test/rustdoc-ui/coverage/empty.stdout create mode 100644 src/test/rustdoc-ui/coverage/enums.rs create mode 100644 src/test/rustdoc-ui/coverage/enums.stdout create mode 100644 src/test/rustdoc-ui/coverage/exotic.rs create mode 100644 src/test/rustdoc-ui/coverage/exotic.stdout create mode 100644 src/test/rustdoc-ui/coverage/private.rs create mode 100644 src/test/rustdoc-ui/coverage/private.stdout create mode 100644 src/test/rustdoc-ui/coverage/statics-consts.rs create mode 100644 src/test/rustdoc-ui/coverage/statics-consts.stdout create mode 100644 src/test/rustdoc-ui/coverage/traits.rs create mode 100644 src/test/rustdoc-ui/coverage/traits.stdout diff --git a/src/test/rustdoc-ui/coverage/basic.rs b/src/test/rustdoc-ui/coverage/basic.rs new file mode 100644 index 000000000000..4247fdf98955 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/basic.rs @@ -0,0 +1,50 @@ +// compile-flags:-Z unstable-options --show-coverage +// compile-pass + +#![feature(extern_types)] + +//! Make sure to have some docs on your crate root + +/// This struct is documented, but its fields are not. +/// +/// However, one field is private, so it shouldn't show in the total. +pub struct SomeStruct { + pub some_field: usize, + other_field: usize, +} + +impl SomeStruct { + /// Method with docs + pub fn this_fn(&self) {} + + // Method without docs + pub fn other_method(&self) {} +} + +// struct without docs +pub struct OtherStruct; + +// function with no docs +pub fn some_fn() {} + +/// Function with docs +pub fn other_fn() {} + +pub enum SomeEnum { + /// Some of these variants are documented... + VarOne, + /// ...but some of them are not. + VarTwo, + // (like this one) + VarThree, +} + +/// There's a macro here, too +#[macro_export] +macro_rules! some_macro { + () => {}; +} + +extern { + pub type ExternType; +} diff --git a/src/test/rustdoc-ui/coverage/basic.stdout b/src/test/rustdoc-ui/coverage/basic.stdout new file mode 100644 index 000000000000..089ab6017d19 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/basic.stdout @@ -0,0 +1,15 @@ ++---------------------------+------------+------------+------------+ +| Item Type | Documented | Total | Percentage | ++---------------------------+------------+------------+------------+ +| Modules | 1 | 1 | 100.0% | +| Functions | 1 | 2 | 50.0% | +| Structs | 1 | 2 | 50.0% | +| Struct Fields | 0 | 1 | 0.0% | +| Enums | 0 | 1 | 0.0% | +| Enum Variants | 2 | 3 | 66.7% | +| Methods | 1 | 2 | 50.0% | +| Macros | 1 | 1 | 100.0% | +| Extern Types | 0 | 1 | 0.0% | ++---------------------------+------------+------------+------------+ +| Total | 7 | 14 | 50.0% | ++---------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/empty.rs b/src/test/rustdoc-ui/coverage/empty.rs new file mode 100644 index 000000000000..463617a1143d --- /dev/null +++ b/src/test/rustdoc-ui/coverage/empty.rs @@ -0,0 +1,4 @@ +// compile-flags:-Z unstable-options --show-coverage +// compile-pass + +// an empty crate still has one item to document: the crate root diff --git a/src/test/rustdoc-ui/coverage/empty.stdout b/src/test/rustdoc-ui/coverage/empty.stdout new file mode 100644 index 000000000000..df68205bbaa3 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/empty.stdout @@ -0,0 +1,7 @@ ++---------------------------+------------+------------+------------+ +| Item Type | Documented | Total | Percentage | ++---------------------------+------------+------------+------------+ +| Modules | 0 | 1 | 0.0% | ++---------------------------+------------+------------+------------+ +| Total | 0 | 1 | 0.0% | ++---------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/enums.rs b/src/test/rustdoc-ui/coverage/enums.rs new file mode 100644 index 000000000000..5cd7f490d1a9 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/enums.rs @@ -0,0 +1,22 @@ +// compile-flags:-Z unstable-options --show-coverage +// compile-pass + +//! (remember the crate root is still a module) + +/// so check out this enum here +pub enum ThisEnum { + /// this variant has some weird stuff going on + VarOne { + /// like, it has some named fields inside + field_one: usize, + // (these show up as struct fields) + field_two: usize, + }, + /// here's another variant for you + VarTwo(String), + // but not all of them need to be documented as thoroughly + VarThree, +} + +/// uninhabited enums? sure, let's throw one of those around +pub enum OtherEnum {} diff --git a/src/test/rustdoc-ui/coverage/enums.stdout b/src/test/rustdoc-ui/coverage/enums.stdout new file mode 100644 index 000000000000..651ea0953102 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/enums.stdout @@ -0,0 +1,10 @@ ++---------------------------+------------+------------+------------+ +| Item Type | Documented | Total | Percentage | ++---------------------------+------------+------------+------------+ +| Modules | 1 | 1 | 100.0% | +| Struct Fields | 1 | 2 | 50.0% | +| Enums | 2 | 2 | 100.0% | +| Enum Variants | 2 | 3 | 66.7% | ++---------------------------+------------+------------+------------+ +| Total | 6 | 8 | 75.0% | ++---------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/exotic.rs b/src/test/rustdoc-ui/coverage/exotic.rs new file mode 100644 index 000000000000..b4adf45b90b8 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/exotic.rs @@ -0,0 +1,15 @@ +// compile-flags:-Z unstable-options --show-coverage +// compile-pass + +#![feature(doc_keyword)] + +//! the features only used in std also have entries in the table, so make sure those get pulled out +//! properly as well + +/// woo, check it out, we can write our own primitive docs lol +#[doc(primitive="unit")] +mod prim_unit {} + +/// keywords? sure, pile them on +#[doc(keyword="where")] +mod where_keyword {} diff --git a/src/test/rustdoc-ui/coverage/exotic.stdout b/src/test/rustdoc-ui/coverage/exotic.stdout new file mode 100644 index 000000000000..97eab50a55a4 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/exotic.stdout @@ -0,0 +1,9 @@ ++---------------------------+------------+------------+------------+ +| Item Type | Documented | Total | Percentage | ++---------------------------+------------+------------+------------+ +| Modules | 1 | 1 | 100.0% | +| Primitives | 1 | 1 | 100.0% | +| Keywords | 1 | 1 | 100.0% | ++---------------------------+------------+------------+------------+ +| Total | 3 | 3 | 100.0% | ++---------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/private.rs b/src/test/rustdoc-ui/coverage/private.rs new file mode 100644 index 000000000000..9024185856da --- /dev/null +++ b/src/test/rustdoc-ui/coverage/private.rs @@ -0,0 +1,21 @@ +// compile-flags:-Z unstable-options --show-coverage --document-private-items +// compile-pass + +#![allow(unused)] + +//! when `--document-private-items` is passed, nothing is safe. everything must have docs or your +//! score will suffer the consequences + +mod this_mod { + fn private_fn() {} +} + +/// See, our public items have docs! +pub struct SomeStruct { + /// Look, all perfectly documented! + pub field: usize, + other: usize, +} + +/// Nothing shady going on here. Just a bunch of well-documented code. (cough) +pub fn public_fn() {} diff --git a/src/test/rustdoc-ui/coverage/private.stdout b/src/test/rustdoc-ui/coverage/private.stdout new file mode 100644 index 000000000000..f1a5461b836c --- /dev/null +++ b/src/test/rustdoc-ui/coverage/private.stdout @@ -0,0 +1,10 @@ ++---------------------------+------------+------------+------------+ +| Item Type | Documented | Total | Percentage | ++---------------------------+------------+------------+------------+ +| Modules | 1 | 2 | 50.0% | +| Functions | 1 | 2 | 50.0% | +| Structs | 1 | 1 | 100.0% | +| Struct Fields | 1 | 2 | 50.0% | ++---------------------------+------------+------------+------------+ +| Total | 4 | 7 | 57.1% | ++---------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/statics-consts.rs b/src/test/rustdoc-ui/coverage/statics-consts.rs new file mode 100644 index 000000000000..3c1dd35dfe1a --- /dev/null +++ b/src/test/rustdoc-ui/coverage/statics-consts.rs @@ -0,0 +1,23 @@ +// compile-flags:-Z unstable-options --show-coverage +// compile-pass + +//! gotta make sure we can count statics and consts correctly, too + +/// static like electricity, right? +pub static THIS_STATIC: usize = 0; + +/// (it's not electricity, is it) +pub const THIS_CONST: usize = 1; + +/// associated consts show up separately, but let's throw them in as well +pub trait SomeTrait { + /// just like that, yeah + const ASSOC_CONST: usize; +} + +pub struct SomeStruct; + +impl SomeStruct { + /// wait, structs can have them too, can't forget those + pub const ASSOC_CONST: usize = 100; +} diff --git a/src/test/rustdoc-ui/coverage/statics-consts.stdout b/src/test/rustdoc-ui/coverage/statics-consts.stdout new file mode 100644 index 000000000000..54516fe613fb --- /dev/null +++ b/src/test/rustdoc-ui/coverage/statics-consts.stdout @@ -0,0 +1,12 @@ ++---------------------------+------------+------------+------------+ +| Item Type | Documented | Total | Percentage | ++---------------------------+------------+------------+------------+ +| Modules | 1 | 1 | 100.0% | +| Structs | 0 | 1 | 0.0% | +| Traits | 1 | 1 | 100.0% | +| Associated Constants | 2 | 2 | 100.0% | +| Statics | 1 | 1 | 100.0% | +| Constants | 1 | 1 | 100.0% | ++---------------------------+------------+------------+------------+ +| Total | 6 | 7 | 85.7% | ++---------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/traits.rs b/src/test/rustdoc-ui/coverage/traits.rs new file mode 100644 index 000000000000..0a6defa17f85 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/traits.rs @@ -0,0 +1,37 @@ +// compile-flags:-Z unstable-options --show-coverage +// compile-pass + +#![feature(trait_alias)] + +/// look at this trait right here +pub trait ThisTrait { + /// that's a trait all right + fn right_here(&self); + + /// even the provided functions show up as trait methods + fn aww_yeah(&self) {} + + /// gotta check those associated types, they're slippery + type SomeType; +} + +/// so what happens if we take some struct... +pub struct SomeStruct; + +/// ...and slap this trait on it? +impl ThisTrait for SomeStruct { + /// what we get is a perfect combo! + fn right_here(&self) {} + + type SomeType = String; +} + +/// but what about those aliases? i hear they're pretty exotic +pub trait MyAlias = ThisTrait + Send + Sync; + +// FIXME(58624): once rustdoc can process existential types, we need to make sure they're counted +// /// woah, getting all existential in here +// pub existential type ThisExists: ThisTrait; +// +// /// why don't we get a little more concrete +// pub fn defines() -> ThisExists { SomeStruct {} } diff --git a/src/test/rustdoc-ui/coverage/traits.stdout b/src/test/rustdoc-ui/coverage/traits.stdout new file mode 100644 index 000000000000..6f5db8729efb --- /dev/null +++ b/src/test/rustdoc-ui/coverage/traits.stdout @@ -0,0 +1,16 @@ ++---------------------------+------------+------------+------------+ +| Item Type | Documented | Total | Percentage | ++---------------------------+------------+------------+------------+ +| Modules | 0 | 1 | 0.0% | +| Structs | 1 | 1 | 100.0% | +| Traits | 1 | 1 | 100.0% | +| Trait Methods | 2 | 2 | 100.0% | +| Associated Types | 1 | 1 | 100.0% | +| Trait Aliases | 1 | 1 | 100.0% | ++---------------------------+------------+------------+------------+ +| Total (non trait impls) | 6 | 7 | 85.7% | ++---------------------------+------------+------------+------------+ +| Trait Impl Items | 2 | 3 | 66.7% | ++---------------------------+------------+------------+------------+ +| Total | 8 | 10 | 80.0% | ++---------------------------+------------+------------+------------+ From 80b49191bbf8cf7b418fc828f944bf4580121db3 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Thu, 21 Feb 2019 16:04:56 -0600 Subject: [PATCH 128/381] update docs for doc coverage --- src/doc/rustdoc/src/unstable-features.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index d838f9d95132..22bfa0bd553b 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -445,7 +445,9 @@ Some methodology notes about what rustdoc counts in this metric: * Rustdoc will only count items from your crate (i.e. items re-exported from other crates don't count). -* Since trait implementations can inherit documentation from their trait, it will count trait impl - blocks separately, and show totals both with and without trait impls included. +* Since trait implementations can inherit documentation from their trait, separate totals are given + both with and without trait implementations. * Inherent impl blocks are not counted, even though their doc comments are displayed, because the common pattern in Rust code is to write all inherent methods into the same impl block. +* By default, only public items are counted. To count private items as well, pass + `--document-private-items` at the same time. From 1b63543dc62d2df0143b8d003017e29eca097063 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Thu, 28 Feb 2019 15:27:42 -0600 Subject: [PATCH 129/381] track items per-file instead of per-type --- .../passes/calculate_doc_coverage.rs | 154 ++++-------------- 1 file changed, 35 insertions(+), 119 deletions(-) diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs index f70de1ce9510..6e0238b7a4d5 100644 --- a/src/librustdoc/passes/calculate_doc_coverage.rs +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -1,10 +1,10 @@ use crate::clean; use crate::core::DocContext; -use crate::html::item_type::ItemType; use crate::fold::{self, DocFolder}; use crate::passes::Pass; use syntax::attr; +use syntax_pos::FileName; use std::collections::BTreeMap; use std::fmt; @@ -75,74 +75,51 @@ impl fmt::Display for ItemCount { #[derive(Default)] struct CoverageCalculator { - items: BTreeMap, + items: BTreeMap, } impl CoverageCalculator { fn print_results(&self) { - use crate::html::item_type::ItemType::*; - let mut total = ItemCount::default(); - let main_types = [ - Module, Function, - Struct, StructField, - Enum, Variant, - Union, - Method, - Trait, TyMethod, - AssociatedType, AssociatedConst, - Macro, - Static, Constant, - ForeignType, Existential, - Typedef, TraitAlias, - Primitive, Keyword, - ]; + fn print_table_line() { + println!("+-{0:->35}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); + } - println!("+-{0:->25}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); - println!("| {:<25} | {:>10} | {:>10} | {:>10} |", - "Item Type", "Documented", "Total", "Percentage"); - println!("+-{0:->25}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); + fn print_table_record(name: &str, count: ItemCount, percentage: f64) { + println!("| {:<35} | {:>10} | {:>10} | {:>9.1}% |", + name, count.with_docs, count.total, percentage); + } - for item_type in &main_types { - let count = self.items.get(item_type).cloned().unwrap_or_default(); + print_table_line(); + println!("| {:<35} | {:>10} | {:>10} | {:>10} |", + "File", "Documented", "Total", "Percentage"); + print_table_line(); + for (file, &count) in &self.items { if let Some(percentage) = count.percentage() { - println!("| {:<25} | {:>10} | {:>10} | {:>9.1}% |", - table_name(item_type), count.with_docs, count.total, percentage); + let mut name = file.to_string(); + // if a filename is too long, shorten it so we don't blow out the table + // FIXME(misdreavus): this needs to count graphemes, and probably also track + // double-wide characters... + if name.len() > 35 { + name = "...".to_string() + &name[name.len()-32..]; + } + + print_table_record(&name, count, percentage); total += count; } } - println!("+-{0:->25}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); - - if let Some(count) = self.items.get(&Impl) { - if let Some(percentage) = count.percentage() { - if let Some(percentage) = total.percentage() { - println!("| {:<25} | {:>10} | {:>10} | {:>9.1}% |", - "Total (non trait impls)", total.with_docs, total.total, percentage); - } - - println!("+-{0:->25}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); - - println!("| {:<25} | {:>10} | {:>10} | {:>9.1}% |", - table_name(&Impl), count.with_docs, count.total, percentage); - - println!("+-{0:->25}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); - - total += *count; - } - } - - println!("| {:<25} | {:>10} | {:>10} | {:>9.1}% |", - "Total", total.with_docs, total.total, total.percentage().unwrap_or(0.0)); - println!("+-{0:->25}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); + print_table_line(); + print_table_record("Total", total, total.percentage().unwrap_or(0.0)); + print_table_line(); } } impl fold::DocFolder for CoverageCalculator { - fn fold_item(&mut self, mut i: clean::Item) -> Option { + fn fold_item(&mut self, i: clean::Item) -> Option { let has_docs = !i.attrs.doc_strings.is_empty(); match i.inner { @@ -171,87 +148,26 @@ impl fold::DocFolder for CoverageCalculator { } clean::ImplItem(ref impl_) => { if let Some(ref tr) = impl_.trait_ { - debug!("counting impl {:#} for {:#}", tr, impl_.for_); + debug!("impl {:#} for {:#} in {}", tr, impl_.for_, i.source.filename); - // trait impls inherit their docs from the trait definition, so documenting - // them can be considered optional - self.items.entry(ItemType::Impl).or_default().count_item(has_docs); - - for it in &impl_.items { - let has_docs = !it.attrs.doc_strings.is_empty(); - self.items.entry(ItemType::Impl).or_default().count_item(has_docs); - } - - // now skip recursing, so that we don't double-count this impl's items + // don't count trait impls, the missing-docs lint doesn't so we shouldn't + // either return Some(i); } else { // inherent impls *can* be documented, and those docs show up, but in most // cases it doesn't make sense, as all methods on a type are in one single // impl block - debug!("not counting impl {:#}", impl_.for_); + debug!("impl {:#} in {}", impl_.for_, i.source.filename); } } - clean::MacroItem(..) | clean::ProcMacroItem(..) => { - // combine `macro_rules!` macros and proc-macros in the same count - debug!("counting macro {:?}", i.name); - self.items.entry(ItemType::Macro).or_default().count_item(has_docs); - } - clean::TraitItem(ref mut trait_) => { - // because both trait methods with a default impl and struct methods are - // ItemType::Method, we need to properly tag trait methods as TyMethod instead - debug!("counting trait {:?}", i.name); - self.items.entry(ItemType::Trait).or_default().count_item(has_docs); - - // since we're not going on to document the crate, it doesn't matter if we discard - // the item after counting it - trait_.items.retain(|it| { - if it.type_() == ItemType::Method { - let has_docs = !it.attrs.doc_strings.is_empty(); - self.items.entry(ItemType::TyMethod).or_default().count_item(has_docs); - false - } else { - true - } - }); - } _ => { - debug!("counting {} {:?}", i.type_(), i.name); - self.items.entry(i.type_()).or_default().count_item(has_docs); + debug!("counting {} {:?} in {}", i.type_(), i.name, i.source.filename); + self.items.entry(i.source.filename.clone()) + .or_default() + .count_item(has_docs); } } self.fold_item_recur(i) } } - -fn table_name(type_: &ItemType) -> &'static str { - match *type_ { - ItemType::Module => "Modules", - ItemType::Struct => "Structs", - ItemType::Union => "Unions", - ItemType::Enum => "Enums", - ItemType::Function => "Functions", - ItemType::Typedef => "Type Aliases", - ItemType::Static => "Statics", - ItemType::Trait => "Traits", - // inherent impls aren't counted, and trait impls get all their items thrown into this - // counter - ItemType::Impl => "Trait Impl Items", - // even though trait methods with a default impl get cleaned as Method, we convert them - // to TyMethod when counting - ItemType::TyMethod => "Trait Methods", - ItemType::Method => "Methods", - ItemType::StructField => "Struct Fields", - ItemType::Variant => "Enum Variants", - ItemType::Macro => "Macros", - ItemType::Primitive => "Primitives", - ItemType::AssociatedType => "Associated Types", - ItemType::Constant => "Constants", - ItemType::AssociatedConst => "Associated Constants", - ItemType::ForeignType => "Extern Types", - ItemType::Keyword => "Keywords", - ItemType::Existential => "Existential Types", - ItemType::TraitAlias => "Trait Aliases", - _ => panic!("unanticipated ItemType: {}", type_), - } -} From 74cf1adfd640ac81f01238d6d5b2a5befb707e6f Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Thu, 28 Feb 2019 15:31:39 -0600 Subject: [PATCH 130/381] tweak docs for rustdoc's `--show-coverage` --- src/doc/rustdoc/src/unstable-features.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index 22bfa0bd553b..3938df1a6826 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -445,9 +445,13 @@ Some methodology notes about what rustdoc counts in this metric: * Rustdoc will only count items from your crate (i.e. items re-exported from other crates don't count). -* Since trait implementations can inherit documentation from their trait, separate totals are given - both with and without trait implementations. -* Inherent impl blocks are not counted, even though their doc comments are displayed, because the - common pattern in Rust code is to write all inherent methods into the same impl block. +* Docs written directly onto inherent impl blocks are not counted, even though their doc comments + are displayed, because the common pattern in Rust code is to write all inherent methods into the + same impl block. +* Items in a trait implementation are not counted, as those impls will inherit any docs from the + trait itself. * By default, only public items are counted. To count private items as well, pass `--document-private-items` at the same time. + +Public items that are not documented can be seen with the built-in `missing_docs` lint. Private +items that are not documented can be seen with Clippy's `missing_docs_in_private_items` lint. From 515dbe73abb3ee20582011f9bcc2cb20ced098d3 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Thu, 28 Feb 2019 16:24:38 -0600 Subject: [PATCH 131/381] update rustdoc coverage tests with new table layout --- src/test/rustdoc-ui/coverage/basic.stdout | 22 ++++++------------ src/test/rustdoc-ui/coverage/empty.stdout | 14 +++++------ src/test/rustdoc-ui/coverage/enums.stdout | 17 ++++++-------- src/test/rustdoc-ui/coverage/exotic.stdout | 17 +++++++------- src/test/rustdoc-ui/coverage/private.stdout | 17 ++++++-------- .../rustdoc-ui/coverage/statics-consts.stdout | 19 ++++++--------- src/test/rustdoc-ui/coverage/traits.rs | 2 +- src/test/rustdoc-ui/coverage/traits.stdout | 23 ++++++------------- 8 files changed, 51 insertions(+), 80 deletions(-) diff --git a/src/test/rustdoc-ui/coverage/basic.stdout b/src/test/rustdoc-ui/coverage/basic.stdout index 089ab6017d19..3e9166063162 100644 --- a/src/test/rustdoc-ui/coverage/basic.stdout +++ b/src/test/rustdoc-ui/coverage/basic.stdout @@ -1,15 +1,7 @@ -+---------------------------+------------+------------+------------+ -| Item Type | Documented | Total | Percentage | -+---------------------------+------------+------------+------------+ -| Modules | 1 | 1 | 100.0% | -| Functions | 1 | 2 | 50.0% | -| Structs | 1 | 2 | 50.0% | -| Struct Fields | 0 | 1 | 0.0% | -| Enums | 0 | 1 | 0.0% | -| Enum Variants | 2 | 3 | 66.7% | -| Methods | 1 | 2 | 50.0% | -| Macros | 1 | 1 | 100.0% | -| Extern Types | 0 | 1 | 0.0% | -+---------------------------+------------+------------+------------+ -| Total | 7 | 14 | 50.0% | -+---------------------------+------------+------------+------------+ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...est/rustdoc-ui/coverage/basic.rs | 7 | 14 | 50.0% | ++-------------------------------------+------------+------------+------------+ +| Total | 7 | 14 | 50.0% | ++-------------------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/empty.stdout b/src/test/rustdoc-ui/coverage/empty.stdout index df68205bbaa3..11b514fbfeae 100644 --- a/src/test/rustdoc-ui/coverage/empty.stdout +++ b/src/test/rustdoc-ui/coverage/empty.stdout @@ -1,7 +1,7 @@ -+---------------------------+------------+------------+------------+ -| Item Type | Documented | Total | Percentage | -+---------------------------+------------+------------+------------+ -| Modules | 0 | 1 | 0.0% | -+---------------------------+------------+------------+------------+ -| Total | 0 | 1 | 0.0% | -+---------------------------+------------+------------+------------+ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...est/rustdoc-ui/coverage/empty.rs | 0 | 1 | 0.0% | ++-------------------------------------+------------+------------+------------+ +| Total | 0 | 1 | 0.0% | ++-------------------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/enums.stdout b/src/test/rustdoc-ui/coverage/enums.stdout index 651ea0953102..87e2ad9f20df 100644 --- a/src/test/rustdoc-ui/coverage/enums.stdout +++ b/src/test/rustdoc-ui/coverage/enums.stdout @@ -1,10 +1,7 @@ -+---------------------------+------------+------------+------------+ -| Item Type | Documented | Total | Percentage | -+---------------------------+------------+------------+------------+ -| Modules | 1 | 1 | 100.0% | -| Struct Fields | 1 | 2 | 50.0% | -| Enums | 2 | 2 | 100.0% | -| Enum Variants | 2 | 3 | 66.7% | -+---------------------------+------------+------------+------------+ -| Total | 6 | 8 | 75.0% | -+---------------------------+------------+------------+------------+ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...est/rustdoc-ui/coverage/enums.rs | 6 | 8 | 75.0% | ++-------------------------------------+------------+------------+------------+ +| Total | 6 | 8 | 75.0% | ++-------------------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/exotic.stdout b/src/test/rustdoc-ui/coverage/exotic.stdout index 97eab50a55a4..2bacfcfcecab 100644 --- a/src/test/rustdoc-ui/coverage/exotic.stdout +++ b/src/test/rustdoc-ui/coverage/exotic.stdout @@ -1,9 +1,8 @@ -+---------------------------+------------+------------+------------+ -| Item Type | Documented | Total | Percentage | -+---------------------------+------------+------------+------------+ -| Modules | 1 | 1 | 100.0% | -| Primitives | 1 | 1 | 100.0% | -| Keywords | 1 | 1 | 100.0% | -+---------------------------+------------+------------+------------+ -| Total | 3 | 3 | 100.0% | -+---------------------------+------------+------------+------------+ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...st/rustdoc-ui/coverage/exotic.rs | 1 | 1 | 100.0% | +| | 2 | 2 | 100.0% | ++-------------------------------------+------------+------------+------------+ +| Total | 3 | 3 | 100.0% | ++-------------------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/private.stdout b/src/test/rustdoc-ui/coverage/private.stdout index f1a5461b836c..0d4c7c68fd05 100644 --- a/src/test/rustdoc-ui/coverage/private.stdout +++ b/src/test/rustdoc-ui/coverage/private.stdout @@ -1,10 +1,7 @@ -+---------------------------+------------+------------+------------+ -| Item Type | Documented | Total | Percentage | -+---------------------------+------------+------------+------------+ -| Modules | 1 | 2 | 50.0% | -| Functions | 1 | 2 | 50.0% | -| Structs | 1 | 1 | 100.0% | -| Struct Fields | 1 | 2 | 50.0% | -+---------------------------+------------+------------+------------+ -| Total | 4 | 7 | 57.1% | -+---------------------------+------------+------------+------------+ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...t/rustdoc-ui/coverage/private.rs | 4 | 7 | 57.1% | ++-------------------------------------+------------+------------+------------+ +| Total | 4 | 7 | 57.1% | ++-------------------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/statics-consts.stdout b/src/test/rustdoc-ui/coverage/statics-consts.stdout index 54516fe613fb..8459f90ae7b3 100644 --- a/src/test/rustdoc-ui/coverage/statics-consts.stdout +++ b/src/test/rustdoc-ui/coverage/statics-consts.stdout @@ -1,12 +1,7 @@ -+---------------------------+------------+------------+------------+ -| Item Type | Documented | Total | Percentage | -+---------------------------+------------+------------+------------+ -| Modules | 1 | 1 | 100.0% | -| Structs | 0 | 1 | 0.0% | -| Traits | 1 | 1 | 100.0% | -| Associated Constants | 2 | 2 | 100.0% | -| Statics | 1 | 1 | 100.0% | -| Constants | 1 | 1 | 100.0% | -+---------------------------+------------+------------+------------+ -| Total | 6 | 7 | 85.7% | -+---------------------------+------------+------------+------------+ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...oc-ui/coverage/statics-consts.rs | 6 | 7 | 85.7% | ++-------------------------------------+------------+------------+------------+ +| Total | 6 | 7 | 85.7% | ++-------------------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/traits.rs b/src/test/rustdoc-ui/coverage/traits.rs index 0a6defa17f85..5f32d5b0cccc 100644 --- a/src/test/rustdoc-ui/coverage/traits.rs +++ b/src/test/rustdoc-ui/coverage/traits.rs @@ -20,7 +20,7 @@ pub struct SomeStruct; /// ...and slap this trait on it? impl ThisTrait for SomeStruct { - /// what we get is a perfect combo! + /// nothing! trait impls are totally ignored in this calculation, sorry. fn right_here(&self) {} type SomeType = String; diff --git a/src/test/rustdoc-ui/coverage/traits.stdout b/src/test/rustdoc-ui/coverage/traits.stdout index 6f5db8729efb..e347a4da0b97 100644 --- a/src/test/rustdoc-ui/coverage/traits.stdout +++ b/src/test/rustdoc-ui/coverage/traits.stdout @@ -1,16 +1,7 @@ -+---------------------------+------------+------------+------------+ -| Item Type | Documented | Total | Percentage | -+---------------------------+------------+------------+------------+ -| Modules | 0 | 1 | 0.0% | -| Structs | 1 | 1 | 100.0% | -| Traits | 1 | 1 | 100.0% | -| Trait Methods | 2 | 2 | 100.0% | -| Associated Types | 1 | 1 | 100.0% | -| Trait Aliases | 1 | 1 | 100.0% | -+---------------------------+------------+------------+------------+ -| Total (non trait impls) | 6 | 7 | 85.7% | -+---------------------------+------------+------------+------------+ -| Trait Impl Items | 2 | 3 | 66.7% | -+---------------------------+------------+------------+------------+ -| Total | 8 | 10 | 80.0% | -+---------------------------+------------+------------+------------+ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...st/rustdoc-ui/coverage/traits.rs | 6 | 7 | 85.7% | ++-------------------------------------+------------+------------+------------+ +| Total | 6 | 7 | 85.7% | ++-------------------------------------+------------+------------+------------+ From 892fed9d08e7392ad04fb4351e88bff416f6a2d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Tue, 18 Dec 2018 09:03:38 +0100 Subject: [PATCH 132/381] Add support for using a jobserver with Rayon --- src/librustc/Cargo.toml | 4 +- src/librustc/session/mod.rs | 30 +---- src/librustc/ty/query/job.rs | 5 + src/librustc_data_structures/Cargo.toml | 6 +- src/librustc_data_structures/jobserver.rs | 153 ++++++++++++++++++++++ src/librustc_data_structures/lib.rs | 1 + src/librustc_driver/Cargo.toml | 2 +- src/librustc_driver/driver.rs | 3 + 8 files changed, 172 insertions(+), 32 deletions(-) create mode 100644 src/librustc_data_structures/jobserver.rs diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index e3557132a125..26a27ea88e27 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -20,8 +20,8 @@ num_cpus = "1.0" scoped-tls = "1.0" log = { version = "0.4", features = ["release_max_level_info", "std"] } polonius-engine = "0.6.2" -rustc-rayon = "0.1.1" -rustc-rayon-core = "0.1.1" +rustc-rayon = "0.1.2" +rustc-rayon-core = "0.1.2" rustc_apfloat = { path = "../librustc_apfloat" } rustc_target = { path = "../librustc_target" } rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 5b9b70edc680..3cff5ec23095 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -34,7 +34,8 @@ use crate::util::profiling::SelfProfiler; use rustc_target::spec::{PanicStrategy, RelroLevel, Target, TargetTriple}; use rustc_data_structures::flock; -use jobserver::Client; +use rustc_data_structures::jobserver; +use ::jobserver::Client; use std; use std::cell::{self, Cell, RefCell}; @@ -1230,32 +1231,7 @@ pub fn build_session_( optimization_fuel, print_fuel_crate, print_fuel, - // Note that this is unsafe because it may misinterpret file descriptors - // on Unix as jobserver file descriptors. We hopefully execute this near - // the beginning of the process though to ensure we don't get false - // positives, or in other words we try to execute this before we open - // any file descriptors ourselves. - // - // Pick a "reasonable maximum" if we don't otherwise have - // a jobserver in our environment, capping out at 32 so we - // don't take everything down by hogging the process run queue. - // The fixed number is used to have deterministic compilation - // across machines. - // - // Also note that we stick this in a global because there could be - // multiple `Session` instances in this process, and the jobserver is - // per-process. - jobserver: unsafe { - static mut GLOBAL_JOBSERVER: *mut Client = 0 as *mut _; - static INIT: std::sync::Once = std::sync::ONCE_INIT; - INIT.call_once(|| { - let client = Client::from_env().unwrap_or_else(|| { - Client::new(32).expect("failed to create jobserver") - }); - GLOBAL_JOBSERVER = Box::into_raw(Box::new(client)); - }); - (*GLOBAL_JOBSERVER).clone() - }, + jobserver: jobserver::client(), has_global_allocator: Once::new(), has_panic_handler: Once::new(), driver_lint_caps, diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index 22211468412c..8e68c9fa3043 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -7,6 +7,7 @@ use std::{fmt, ptr}; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::{Lock, LockGuard, Lrc, Weak}; use rustc_data_structures::OnDrop; +use rustc_data_structures::jobserver; use syntax_pos::Span; use crate::ty::tls; @@ -198,7 +199,11 @@ impl<'tcx> QueryLatch<'tcx> { // we have to be in the `wait` call. This is ensured by the deadlock handler // getting the self.info lock. rayon_core::mark_blocked(); + jobserver::release_thread(); waiter.condvar.wait(&mut info); + // Release the lock before we potentially block in `acquire_thread` + mem::drop(info); + jobserver::acquire_thread(); } } diff --git a/src/librustc_data_structures/Cargo.toml b/src/librustc_data_structures/Cargo.toml index 6aa262715ecf..6002bf69b706 100644 --- a/src/librustc_data_structures/Cargo.toml +++ b/src/librustc_data_structures/Cargo.toml @@ -12,13 +12,15 @@ crate-type = ["dylib"] [dependencies] ena = "0.11" log = "0.4" +jobserver_crate = { version = "0.1", package = "jobserver" } +lazy_static = "1" rustc_cratesio_shim = { path = "../librustc_cratesio_shim" } serialize = { path = "../libserialize" } graphviz = { path = "../libgraphviz" } cfg-if = "0.1.2" stable_deref_trait = "1.0.0" -rayon = { version = "0.1.1", package = "rustc-rayon" } -rayon-core = { version = "0.1.1", package = "rustc-rayon-core" } +rayon = { version = "0.1.2", package = "rustc-rayon" } +rayon-core = { version = "0.1.2", package = "rustc-rayon-core" } rustc-hash = "1.0.1" smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } diff --git a/src/librustc_data_structures/jobserver.rs b/src/librustc_data_structures/jobserver.rs new file mode 100644 index 000000000000..c85cdfbdcd8d --- /dev/null +++ b/src/librustc_data_structures/jobserver.rs @@ -0,0 +1,153 @@ +use jobserver_crate::{Client, HelperThread, Acquired}; +use lazy_static::lazy_static; +use std::sync::{Condvar, Arc, Mutex}; +use std::mem; + +#[derive(Default)] +pub struct LockedProxyData { + /// The number of free thread tokens, this may include the implicit token given to the process + free: usize, + + /// The number of threads waiting for a token + waiters: usize, + + /// The number of tokens we requested from the server + requested: usize, + + /// Stored tokens which will be dropped when we no longer need them + tokens: Vec, +} + +impl LockedProxyData { + fn request_token(&mut self, thread: &Mutex) { + self.requested += 1; + thread.lock().unwrap().request_token(); + } + + fn release_token(&mut self, cond_var: &Condvar) { + if self.waiters > 0 { + self.free += 1; + cond_var.notify_one(); + } else { + if self.tokens.is_empty() { + // We are returning the implicit token + self.free += 1; + } else { + // Return a real token to the server + self.tokens.pop().unwrap(); + } + } + } + + fn take_token(&mut self, thread: &Mutex) -> bool { + if self.free > 0 { + self.free -= 1; + self.waiters -= 1; + + // We stole some token reqested by someone else + // Request another one + if self.requested + self.free < self.waiters { + self.request_token(thread); + } + + true + } else { + false + } + } + + fn new_requested_token(&mut self, token: Acquired, cond_var: &Condvar) { + self.requested -= 1; + + // Does anything need this token? + if self.waiters > 0 { + self.free += 1; + self.tokens.push(token); + cond_var.notify_one(); + } else { + // Otherwise we'll just drop it + mem::drop(token); + } + } +} + +#[derive(Default)] +pub struct ProxyData { + lock: Mutex, + cond_var: Condvar, +} + +pub struct Proxy { + thread: Mutex, + data: Arc, +} + +lazy_static! { + // We can only call `from_env` once per process + + // Note that this is unsafe because it may misinterpret file descriptors + // on Unix as jobserver file descriptors. We hopefully execute this near + // the beginning of the process though to ensure we don't get false + // positives, or in other words we try to execute this before we open + // any file descriptors ourselves. + // + // Pick a "reasonable maximum" if we don't otherwise have + // a jobserver in our environment, capping out at 32 so we + // don't take everything down by hogging the process run queue. + // The fixed number is used to have deterministic compilation + // across machines. + // + // Also note that we stick this in a global because there could be + // multiple rustc instances in this process, and the jobserver is + // per-process. + static ref GLOBAL_CLIENT: Client = unsafe { + Client::from_env().unwrap_or_else(|| { + Client::new(32).expect("failed to create jobserver") + }) + }; + + static ref GLOBAL_PROXY: Proxy = { + let data = Arc::new(ProxyData::default()); + + Proxy { + data: data.clone(), + thread: Mutex::new(client().into_helper_thread(move |token| { + data.lock.lock().unwrap().new_requested_token(token.unwrap(), &data.cond_var); + }).unwrap()), + } + }; +} + +pub fn client() -> Client { + GLOBAL_CLIENT.clone() +} + +pub fn acquire_thread() { + GLOBAL_PROXY.acquire_token(); +} + +pub fn release_thread() { + GLOBAL_PROXY.release_token(); +} + +impl Proxy { + pub fn release_token(&self) { + self.data.lock.lock().unwrap().release_token(&self.data.cond_var); + } + + pub fn acquire_token(&self) { + let mut data = self.data.lock.lock().unwrap(); + data.waiters += 1; + if data.take_token(&self.thread) { + return; + } + // Request a token for us + data.request_token(&self.thread); + loop { + data = self.data.cond_var.wait(data).unwrap(); + if data.take_token(&self.thread) { + return; + } + } + } +} diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 2bfb1b24a81b..09482340b1a1 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -77,6 +77,7 @@ pub mod fx; pub mod graph; pub mod indexed_vec; pub mod interner; +pub mod jobserver; pub mod obligation_forest; pub mod owning_ref; pub mod ptr_key; diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index 0b379ef662dd..a77e497af7b8 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -13,7 +13,7 @@ arena = { path = "../libarena" } graphviz = { path = "../libgraphviz" } log = "0.4" env_logger = { version = "0.5", default-features = false } -rustc-rayon = "0.1.1" +rustc-rayon = "0.1.2" scoped-tls = "1.0" rustc = { path = "../librustc" } rustc_allocator = { path = "../librustc_allocator" } diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index f87a809e6c6e..c4d8a66aa6db 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -17,6 +17,7 @@ use rustc_allocator as allocator; use rustc_borrowck as borrowck; use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_data_structures::sync::{self, Lock}; +use rustc_data_structures::jobserver; use rustc_incremental; use rustc_metadata::creader::CrateLoader; use rustc_metadata::cstore::{self, CStore}; @@ -72,6 +73,8 @@ pub fn spawn_thread_pool R + sync::Send, R: sync:: let gcx_ptr = &Lock::new(0); let config = ThreadPoolBuilder::new() + .acquire_thread_handler(jobserver::acquire_thread) + .release_thread_handler(jobserver::release_thread) .num_threads(Session::threads_from_count(opts.debugging_opts.threads)) .deadlock_handler(|| unsafe { ty::query::handle_deadlock() }) .stack_size(::STACK_SIZE); From 35a1b91c4b4153027a722a267ba0bcdfec6d2bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Thu, 31 Jan 2019 17:00:06 +0100 Subject: [PATCH 133/381] Address comments --- src/librustc_data_structures/jobserver.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/librustc_data_structures/jobserver.rs b/src/librustc_data_structures/jobserver.rs index c85cdfbdcd8d..48ac8125a0d6 100644 --- a/src/librustc_data_structures/jobserver.rs +++ b/src/librustc_data_structures/jobserver.rs @@ -4,7 +4,7 @@ use std::sync::{Condvar, Arc, Mutex}; use std::mem; #[derive(Default)] -pub struct LockedProxyData { +struct LockedProxyData { /// The number of free thread tokens, this may include the implicit token given to the process free: usize, @@ -72,12 +72,15 @@ impl LockedProxyData { } #[derive(Default)] -pub struct ProxyData { +struct ProxyData { lock: Mutex, cond_var: Condvar, } -pub struct Proxy { +/// A helper type which makes managing jobserver tokens easier. +/// It also allows you to treat the implicit token given to the process +/// in the same manner as requested tokens. +struct Proxy { thread: Mutex, data: Arc, } @@ -131,11 +134,11 @@ pub fn release_thread() { } impl Proxy { - pub fn release_token(&self) { + fn release_token(&self) { self.data.lock.lock().unwrap().release_token(&self.data.cond_var); } - pub fn acquire_token(&self) { + fn acquire_token(&self) { let mut data = self.data.lock.lock().unwrap(); data.waiters += 1; if data.take_token(&self.thread) { From 42d817f3e72cbc1e06b404bc4326cb70f4264811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Thu, 31 Jan 2019 20:09:43 +0100 Subject: [PATCH 134/381] Fix import --- src/librustc_driver/driver.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index c4d8a66aa6db..858a5602e7b7 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -17,6 +17,7 @@ use rustc_allocator as allocator; use rustc_borrowck as borrowck; use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_data_structures::sync::{self, Lock}; +#[cfg(parallel_compiler)] use rustc_data_structures::jobserver; use rustc_incremental; use rustc_metadata::creader::CrateLoader; From 5c78fa836d271e1ae664b9e0be4c5de3cb9e4698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Wed, 27 Feb 2019 15:17:12 +0100 Subject: [PATCH 135/381] Update Cargo.lock --- Cargo.lock | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 381322bc421d..4fe819511704 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2358,8 +2358,8 @@ dependencies = [ "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "polonius-engine 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_apfloat 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", @@ -2409,8 +2409,8 @@ dependencies = [ "rustc-ap-rustc_cratesio_shim 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-ap-serialize 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2508,23 +2508,23 @@ dependencies = [ [[package]] name = "rustc-rayon" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-rayon-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2672,11 +2672,13 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "graphviz 0.0.0", + "jobserver 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_cratesio_shim 0.0.0", "serialize 0.0.0", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2692,7 +2694,7 @@ dependencies = [ "graphviz 0.0.0", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", - "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_allocator 0.0.0", "rustc_borrowck 0.0.0", "rustc_codegen_utils 0.0.0", @@ -2758,7 +2760,7 @@ version = "0.0.0" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", - "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_allocator 0.0.0", "rustc_borrowck 0.0.0", "rustc_codegen_utils 0.0.0", @@ -4190,8 +4192,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rustc-ap-syntax_pos 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e4f88a1213562373cee9de5a1d77bbf16dd706030304af041c9733492fcc952" "checksum rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "82ae957aa1b3055d8e086486723c0ccd3d7b8fa190ae8fa2e35543b6171c810e" "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" -"checksum rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c6d5a683c6ba4ed37959097e88d71c9e8e26659a3cb5be8b389078e7ad45306" -"checksum rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40f06724db71e18d68b3b946fdf890ca8c921d9edccc1404fdfdb537b0d12649" +"checksum rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8d98c51d9cbbe810c8b6693236d3412d8cd60513ff27a3e1b6af483dca0af544" +"checksum rustc-rayon-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "526e7b6d2707a5b9bec3927d424ad70fa3cfc68e0ac1b75e46cdbbc95adc5108" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_tools_util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c5a95edfa0c893236ae4778bb7c4752760e4c0d245e19b5eff33c5aa5eb9dc" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" From c0e8cf94103289c424c62ca48e1e3f56e352a84a Mon Sep 17 00:00:00 2001 From: Jethro Beekman Date: Thu, 14 Feb 2019 18:06:01 +0530 Subject: [PATCH 136/381] Use the correct stderr when testing libstd --- src/libstd/io/impls.rs | 14 ++++++++++++++ src/libstd/io/stdio.rs | 16 ++++++++++++++-- src/libstd/lib.rs | 2 +- src/libstd/panicking.rs | 28 ++++++++++++---------------- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/src/libstd/io/impls.rs b/src/libstd/io/impls.rs index bd3d0a416386..b286e4016da7 100644 --- a/src/libstd/io/impls.rs +++ b/src/libstd/io/impls.rs @@ -165,6 +165,20 @@ impl BufRead for Box { } } +// Used by panicking::default_hook +#[cfg(test)] +/// This impl is only used by printing logic, so any error returned is always +/// of kind `Other`, and should be ignored. +impl Write for Box { + fn write(&mut self, buf: &[u8]) -> io::Result { + (**self).write(buf).map_err(|_| ErrorKind::Other.into()) + } + + fn flush(&mut self) -> io::Result<()> { + (**self).flush().map_err(|_| ErrorKind::Other.into()) + } +} + // ============================================================================= // In-memory buffer implementations diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 13bf357e2eb8..589fb455a191 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -1,3 +1,5 @@ +#![cfg_attr(test, allow(unused))] + use crate::io::prelude::*; use crate::cell::RefCell; @@ -16,6 +18,13 @@ thread_local! { } } +/// Stderr used by eprint! and eprintln! macros, and panics +thread_local! { + static LOCAL_STDERR: RefCell>> = { + RefCell::new(None) + } +} + /// A handle to a raw instance of the standard input stream of this process. /// /// This handle is not synchronized or buffered in any fashion. Constructed via @@ -668,7 +677,6 @@ impl fmt::Debug for StderrLock<'_> { issue = "0")] #[doc(hidden)] pub fn set_panic(sink: Option>) -> Option> { - use crate::panicking::LOCAL_STDERR; use crate::mem; LOCAL_STDERR.with(move |slot| { mem::replace(&mut *slot.borrow_mut(), sink) @@ -740,6 +748,7 @@ where reason = "implementation detail which may disappear or be replaced at any time", issue = "0")] #[doc(hidden)] +#[cfg(not(test))] pub fn _print(args: fmt::Arguments) { print_to(args, &LOCAL_STDOUT, stdout, "stdout"); } @@ -748,11 +757,14 @@ pub fn _print(args: fmt::Arguments) { reason = "implementation detail which may disappear or be replaced at any time", issue = "0")] #[doc(hidden)] +#[cfg(not(test))] pub fn _eprint(args: fmt::Arguments) { - use crate::panicking::LOCAL_STDERR; print_to(args, &LOCAL_STDERR, stderr, "stderr"); } +#[cfg(test)] +pub use realstd::io::{_eprint, _print}; + #[cfg(test)] mod tests { use crate::panic::{UnwindSafe, RefUnwindSafe}; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 32a168619dfb..e31680f23f1d 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -219,7 +219,7 @@ // std may use features in a platform-specific way #![allow(unused_features)] -#![cfg_attr(test, feature(test, update_panic_count))] +#![cfg_attr(test, feature(print_internals, set_stdio, test, update_panic_count))] #![cfg_attr(all(target_vendor = "fortanix", target_env = "sgx"), feature(global_asm, range_contains, slice_index_methods, decl_macro, coerce_unsized, sgx_platform, ptr_wrapping_offset_from))] diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index 868b309686cf..eae885602d3e 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -7,13 +7,9 @@ //! * Executing a panic up to doing the actual implementation //! * Shims around "try" -use core::panic::BoxMeUp; -use core::panic::{PanicInfo, Location}; - -use crate::io::prelude::*; +use core::panic::{BoxMeUp, PanicInfo, Location}; use crate::any::Any; -use crate::cell::RefCell; use crate::fmt; use crate::intrinsics; use crate::mem; @@ -25,11 +21,12 @@ use crate::sys_common::thread_info; use crate::sys_common::util; use crate::thread; -thread_local! { - pub static LOCAL_STDERR: RefCell>> = { - RefCell::new(None) - } -} +#[cfg(not(test))] +use crate::io::set_panic; +// make sure to use the stderr output configured +// by libtest in the real copy of std +#[cfg(test)] +use realstd::io::set_panic; // Binary interface to the panic runtime that the standard library depends on. // @@ -205,12 +202,11 @@ fn default_hook(info: &PanicInfo) { } }; - if let Some(mut local) = LOCAL_STDERR.with(|s| s.borrow_mut().take()) { - write(&mut *local); - let mut s = Some(local); - LOCAL_STDERR.with(|slot| { - *slot.borrow_mut() = s.take(); - }); + if let Some(mut local) = set_panic(None) { + // NB. In `cfg(test)` this uses the forwarding impl + // for `Box`. + write(&mut local); + set_panic(Some(local)); } else if let Some(mut out) = panic_output() { write(&mut out); } From 0f993d5a7abfe156a261d7a53f4297e8b05cc91f Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 22 Feb 2019 05:24:03 +0100 Subject: [PATCH 137/381] Put Local, Static and Promoted as one Base variant of Place --- src/librustc/ich/impls_mir.rs | 6 +-- src/librustc/mir/mod.rs | 32 +++++++---- src/librustc/mir/tcx.rs | 6 +-- src/librustc/mir/visit.rs | 6 +-- src/librustc_codegen_ssa/mir/analyze.rs | 5 +- src/librustc_codegen_ssa/mir/block.rs | 14 +++-- src/librustc_codegen_ssa/mir/operand.rs | 2 +- src/librustc_codegen_ssa/mir/place.rs | 12 +++-- src/librustc_codegen_ssa/mir/rvalue.rs | 2 +- src/librustc_codegen_ssa/mir/statement.rs | 2 +- src/librustc_mir/borrow_check/borrow_set.rs | 2 +- .../borrow_check/error_reporting.rs | 49 +++++++++-------- src/librustc_mir/borrow_check/mod.rs | 46 ++++++++-------- src/librustc_mir/borrow_check/move_errors.rs | 2 +- .../borrow_check/mutability_errors.rs | 35 ++++++------ .../borrow_check/nll/constraint_generation.rs | 4 +- .../borrow_check/nll/explain_borrow/mod.rs | 29 +++++----- .../borrow_check/nll/invalidation.rs | 4 +- .../borrow_check/nll/type_check/mod.rs | 18 ++++--- src/librustc_mir/borrow_check/path_utils.rs | 8 +-- src/librustc_mir/borrow_check/place_ext.rs | 14 ++--- .../borrow_check/places_conflict.rs | 26 ++++----- src/librustc_mir/borrow_check/prefixes.rs | 13 ++--- src/librustc_mir/borrow_check/used_muts.rs | 6 ++- src/librustc_mir/build/expr/as_operand.rs | 2 +- src/librustc_mir/build/expr/as_place.rs | 20 +++---- src/librustc_mir/build/expr/as_rvalue.rs | 27 ++++++---- src/librustc_mir/build/expr/as_temp.rs | 4 +- src/librustc_mir/build/expr/into.rs | 2 +- src/librustc_mir/build/expr/stmt.rs | 17 ++++-- src/librustc_mir/build/matches/mod.rs | 10 ++-- src/librustc_mir/build/misc.rs | 2 +- src/librustc_mir/build/mod.rs | 6 +-- src/librustc_mir/build/scope.rs | 4 +- .../dataflow/drop_flag_effects.rs | 2 +- .../dataflow/impls/borrowed_locals.rs | 6 +-- src/librustc_mir/dataflow/impls/borrows.rs | 6 +-- src/librustc_mir/dataflow/impls/mod.rs | 3 +- .../dataflow/move_paths/builder.rs | 14 ++--- src/librustc_mir/dataflow/move_paths/mod.rs | 8 +-- src/librustc_mir/interpret/operand.rs | 5 +- src/librustc_mir/interpret/place.rs | 10 ++-- src/librustc_mir/interpret/terminator.rs | 8 ++- src/librustc_mir/shim.rs | 54 ++++++++++--------- .../transform/add_moves_for_packed_drops.rs | 4 +- src/librustc_mir/transform/add_retag.rs | 8 +-- src/librustc_mir/transform/check_unsafety.rs | 8 +-- src/librustc_mir/transform/const_prop.rs | 10 ++-- src/librustc_mir/transform/copy_prop.rs | 24 +++++---- src/librustc_mir/transform/elaborate_drops.rs | 6 +-- src/librustc_mir/transform/generator.rs | 20 +++---- src/librustc_mir/transform/inline.rs | 16 +++--- src/librustc_mir/transform/instcombine.rs | 4 +- src/librustc_mir/transform/lower_128bit.rs | 4 +- src/librustc_mir/transform/promote_consts.rs | 14 ++--- src/librustc_mir/transform/qualify_consts.rs | 36 ++++++++----- .../transform/qualify_min_const_fn.rs | 7 +-- .../transform/remove_noop_landing_pads.rs | 2 +- src/librustc_mir/transform/rustc_peek.rs | 4 +- .../transform/uniform_array_move_out.rs | 22 ++++---- src/librustc_mir/util/elaborate_drops.rs | 39 +++++++------- src/librustc_mir/util/graphviz.rs | 10 ++-- src/librustc_mir/util/pretty.rs | 2 +- 63 files changed, 441 insertions(+), 352 deletions(-) diff --git a/src/librustc/ich/impls_mir.rs b/src/librustc/ich/impls_mir.rs index ddc091b71870..41b78ee50965 100644 --- a/src/librustc/ich/impls_mir.rs +++ b/src/librustc/ich/impls_mir.rs @@ -209,13 +209,13 @@ impl<'a, 'gcx> HashStable> for mir::Place<'gcx> { hasher: &mut StableHasher) { mem::discriminant(self).hash_stable(hcx, hasher); match *self { - mir::Place::Local(ref local) => { + mir::Place::Base(mir::PlaceBase::Local(ref local)) => { local.hash_stable(hcx, hasher); } - mir::Place::Static(ref statik) => { + mir::Place::Base(mir::PlaceBase::Static(ref statik)) => { statik.hash_stable(hcx, hasher); } - mir::Place::Promoted(ref promoted) => { + mir::Place::Base(mir::PlaceBase::Promoted(ref promoted)) => { promoted.hash_stable(hcx, hasher); } mir::Place::Projection(ref place_projection) => { diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index bfc74979af42..b6f5ff25c8fb 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1896,6 +1896,14 @@ impl<'tcx> Debug for Statement<'tcx> { /// changing or disturbing program state. #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] pub enum Place<'tcx> { + Base(PlaceBase<'tcx>), + + /// projection out of a place (access a field, deref a pointer, etc) + Projection(Box>), +} + +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] +pub enum PlaceBase<'tcx> { /// local variable Local(Local), @@ -1904,9 +1912,6 @@ pub enum Place<'tcx> { /// Constant code promoted to an injected static Promoted(Box<(Promoted, Ty<'tcx>)>), - - /// projection out of a place (access a field, deref a pointer, etc) - Projection(Box>), } /// The `DefId` of a static, along with its normalized type (which is @@ -1994,6 +1999,8 @@ newtype_index! { } impl<'tcx> Place<'tcx> { + pub const RETURN_PLACE: Place<'tcx> = Place::Base(PlaceBase::Local(RETURN_PLACE)); + pub fn field(self, f: Field, ty: Ty<'tcx>) -> Place<'tcx> { self.elem(ProjectionElem::Field(f, ty)) } @@ -2020,9 +2027,9 @@ impl<'tcx> Place<'tcx> { // FIXME: can we safely swap the semantics of `fn base_local` below in here instead? pub fn local(&self) -> Option { match self { - Place::Local(local) | + Place::Base(PlaceBase::Local(local)) | Place::Projection(box Projection { - base: Place::Local(local), + base: Place::Base(PlaceBase::Local(local)), elem: ProjectionElem::Deref, }) => Some(*local), _ => None, @@ -2032,9 +2039,9 @@ impl<'tcx> Place<'tcx> { /// Finds the innermost `Local` from this `Place`. pub fn base_local(&self) -> Option { match self { - Place::Local(local) => Some(*local), + Place::Base(PlaceBase::Local(local)) => Some(*local), Place::Projection(box Projection { base, elem: _ }) => base.base_local(), - Place::Promoted(..) | Place::Static(..) => None, + Place::Base(PlaceBase::Promoted(..)) | Place::Base(PlaceBase::Static(..)) => None, } } } @@ -2044,14 +2051,19 @@ impl<'tcx> Debug for Place<'tcx> { use self::Place::*; match *self { - Local(id) => write!(fmt, "{:?}", id), - Static(box self::Static { def_id, ty }) => write!( + Base(PlaceBase::Local(id)) => write!(fmt, "{:?}", id), + Base(PlaceBase::Static(box self::Static { def_id, ty })) => write!( fmt, "({}: {:?})", ty::tls::with(|tcx| tcx.item_path_str(def_id)), ty ), - Promoted(ref promoted) => write!(fmt, "({:?}: {:?})", promoted.0, promoted.1), + Base(PlaceBase::Promoted(ref promoted)) => write!( + fmt, + "({:?}: {:?})", + promoted.0, + promoted.1 + ), Projection(ref data) => match data.elem { ProjectionElem::Downcast(ref adt_def, index) => { write!(fmt, "({:?} as {})", data.base, adt_def.variants[index].ident) diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index dbf911851bf2..a6f153eaf646 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -158,10 +158,10 @@ impl<'tcx> Place<'tcx> { where D: HasLocalDecls<'tcx> { match *self { - Place::Local(index) => + Place::Base(PlaceBase::Local(index)) => PlaceTy::Ty { ty: local_decls.local_decls()[index].ty }, - Place::Promoted(ref data) => PlaceTy::Ty { ty: data.1 }, - Place::Static(ref data) => + Place::Base(PlaceBase::Promoted(ref data)) => PlaceTy::Ty { ty: data.1 }, + Place::Base(PlaceBase::Static(ref data)) => PlaceTy::Ty { ty: data.ty }, Place::Projection(ref proj) => proj.base.ty(local_decls, tcx).projection_ty(tcx, &proj.elem), diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs index 4f31cebca088..28e816f13436 100644 --- a/src/librustc/mir/visit.rs +++ b/src/librustc/mir/visit.rs @@ -733,13 +733,13 @@ macro_rules! make_mir_visitor { context: PlaceContext<'tcx>, location: Location) { match place { - Place::Local(local) => { + Place::Base(PlaceBase::Local(local)) => { self.visit_local(local, context, location); } - Place::Static(static_) => { + Place::Base(PlaceBase::Static(static_)) => { self.visit_static(static_, context, location); } - Place::Promoted(promoted) => { + Place::Base(PlaceBase::Promoted(promoted)) => { self.visit_ty(& $($mutability)? promoted.1, TyContext::Location(location)); }, Place::Projection(proj) => { diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs index 9fe2e58bc203..facae9a97970 100644 --- a/src/librustc_codegen_ssa/mir/analyze.rs +++ b/src/librustc_codegen_ssa/mir/analyze.rs @@ -103,7 +103,7 @@ impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx> location: Location) { debug!("visit_assign(block={:?}, place={:?}, rvalue={:?})", block, place, rvalue); - if let mir::Place::Local(index) = *place { + if let mir::Place::Base(mir::PlaceBase::Local(index)) = *place { self.assign(index, location); if !self.fx.rvalue_creates_operand(rvalue) { self.not_ssa(index); @@ -245,7 +245,8 @@ impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx> } PlaceContext::MutatingUse(MutatingUseContext::Drop) => { - let ty = mir::Place::Local(local).ty(self.fx.mir, self.fx.cx.tcx()); + let ty = mir::Place::Base(mir::PlaceBase::Local(local)).ty(self.fx.mir, + self.fx.cx.tcx()); let ty = self.fx.monomorphize(&ty.to_ty(self.fx.cx.tcx())); // Only need the place if we're actually dropping it. diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index 627380ee38ff..02086c7730ce 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -249,7 +249,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { PassMode::Direct(_) | PassMode::Pair(..) => { let op = - self.codegen_consume(&mut bx, &mir::Place::Local(mir::RETURN_PLACE)); + self.codegen_consume(&mut bx, &mir::Place::RETURN_PLACE); if let Ref(llval, _, align) = op.val { bx.load(llval, align) } else { @@ -615,8 +615,12 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // The shuffle array argument is usually not an explicit constant, // but specified directly in the code. This means it gets promoted // and we can then extract the value by evaluating the promoted. - mir::Operand::Copy(mir::Place::Promoted(box(index, ty))) | - mir::Operand::Move(mir::Place::Promoted(box(index, ty))) => { + mir::Operand::Copy( + mir::Place::Base(mir::PlaceBase::Promoted(box(index, ty))) + ) | + mir::Operand::Move( + mir::Place::Base(mir::PlaceBase::Promoted(box(index, ty))) + ) => { let param_env = ty::ParamEnv::reveal_all(); let cid = mir::interpret::GlobalId { instance: self.instance, @@ -1106,7 +1110,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { if fn_ret.is_ignore() { return ReturnDest::Nothing; } - let dest = if let mir::Place::Local(index) = *dest { + let dest = if let mir::Place::Base(mir::PlaceBase::Local(index)) = *dest { match self.locals[index] { LocalRef::Place(dest) => dest, LocalRef::UnsizedPlace(_) => bug!("return type must be sized"), @@ -1161,7 +1165,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { src: &mir::Operand<'tcx>, dst: &mir::Place<'tcx> ) { - if let mir::Place::Local(index) = *dst { + if let mir::Place::Base(mir::PlaceBase::Local(index)) = *dst { match self.locals[index] { LocalRef::Place(place) => self.codegen_transmute_into(bx, src, place), LocalRef::UnsizedPlace(_) => bug!("transmute must not involve unsized locals"), diff --git a/src/librustc_codegen_ssa/mir/operand.rs b/src/librustc_codegen_ssa/mir/operand.rs index 0e8cdc83b486..0a6549851f44 100644 --- a/src/librustc_codegen_ssa/mir/operand.rs +++ b/src/librustc_codegen_ssa/mir/operand.rs @@ -378,7 +378,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // watch out for locals that do not have an // alloca; they are handled somewhat differently - if let mir::Place::Local(index) = *place { + if let mir::Place::Base(mir::PlaceBase::Local(index)) = *place { match self.locals[index] { LocalRef::Operand(Some(o)) => { return Some(o); diff --git a/src/librustc_codegen_ssa/mir/place.rs b/src/librustc_codegen_ssa/mir/place.rs index 1edcbfead2c9..0408ccf039f3 100644 --- a/src/librustc_codegen_ssa/mir/place.rs +++ b/src/librustc_codegen_ssa/mir/place.rs @@ -392,7 +392,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let cx = self.cx; let tcx = self.cx.tcx(); - if let mir::Place::Local(index) = *place { + if let mir::Place::Base(mir::PlaceBase::Local(index)) = *place { match self.locals[index] { LocalRef::Place(place) => { return place; @@ -407,8 +407,8 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } let result = match *place { - mir::Place::Local(_) => bug!(), // handled above - mir::Place::Promoted(box (index, ty)) => { + mir::Place::Base(mir::PlaceBase::Local(_)) => bug!(), // handled above + mir::Place::Base(mir::PlaceBase::Promoted(box (index, ty))) => { let param_env = ty::ParamEnv::reveal_all(); let cid = mir::interpret::GlobalId { instance: self.instance, @@ -435,7 +435,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } } } - mir::Place::Static(box mir::Static { def_id, ty }) => { + mir::Place::Base(mir::PlaceBase::Static(box mir::Static { def_id, ty })) => { // NB: The layout of a static may be unsized as is the case when working // with a static that is an extern_type. let layout = cx.layout_of(self.monomorphize(&ty)); @@ -457,7 +457,9 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { cg_base.project_field(bx, field.index()) } mir::ProjectionElem::Index(index) => { - let index = &mir::Operand::Copy(mir::Place::Local(index)); + let index = &mir::Operand::Copy( + mir::Place::Base(mir::PlaceBase::Local(index)) + ); let index = self.codegen_operand(bx, index); let llindex = index.immediate(); cg_base.project_index(bx, llindex) diff --git a/src/librustc_codegen_ssa/mir/rvalue.rs b/src/librustc_codegen_ssa/mir/rvalue.rs index 25a7754d118d..b0c667a965da 100644 --- a/src/librustc_codegen_ssa/mir/rvalue.rs +++ b/src/librustc_codegen_ssa/mir/rvalue.rs @@ -534,7 +534,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { ) -> Bx::Value { // ZST are passed as operands and require special handling // because codegen_place() panics if Local is operand. - if let mir::Place::Local(index) = *place { + if let mir::Place::Base(mir::PlaceBase::Local(index)) = *place { if let LocalRef::Operand(Some(op)) = self.locals[index] { if let ty::Array(_, n) = op.layout.ty.sty { let n = n.unwrap_usize(bx.cx().tcx()); diff --git a/src/librustc_codegen_ssa/mir/statement.rs b/src/librustc_codegen_ssa/mir/statement.rs index a1bd919c4335..97729e8aeb35 100644 --- a/src/librustc_codegen_ssa/mir/statement.rs +++ b/src/librustc_codegen_ssa/mir/statement.rs @@ -17,7 +17,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { self.set_debug_loc(&mut bx, statement.source_info); match statement.kind { mir::StatementKind::Assign(ref place, ref rvalue) => { - if let mir::Place::Local(index) = *place { + if let mir::Place::Base(mir::PlaceBase::Local(index)) = *place { match self.locals[index] { LocalRef::Place(cg_dest) => { self.codegen_rvalue(bx, cg_dest, rvalue) diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index 2a3a616317c1..cbef7a7f6c48 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -333,7 +333,7 @@ impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> { // TEMP = &foo // // so extract `temp`. - let temp = if let &mir::Place::Local(temp) = assigned_place { + let temp = if let &mir::Place::Base(mir::PlaceBase::Local(temp)) = assigned_place { temp } else { span_bug!( diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index 67fbe5762e73..dc1979b6380b 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -8,7 +8,7 @@ use rustc::middle::region::ScopeTree; use rustc::mir::{ self, AggregateKind, BindingForm, BorrowKind, ClearCrossCrate, Constant, ConstraintCategory, Field, Local, LocalDecl, LocalKind, Location, Operand, - Place, PlaceProjection, ProjectionElem, Rvalue, Statement, StatementKind, + Place, PlaceBase, PlaceProjection, ProjectionElem, Rvalue, Statement, StatementKind, TerminatorKind, VarBindingForm, }; use rustc::ty::{self, DefIdTree}; @@ -220,7 +220,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { ); } } - if let Place::Local(local) = place { + if let Place::Base(PlaceBase::Local(local)) = place { let decl = &self.mir.local_decls[*local]; err.span_label( decl.source_info.span, @@ -679,7 +679,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let borrow_span = borrow_spans.var_or_use(); let proper_span = match *root_place { - Place::Local(local) => self.mir.local_decls[local].source_info.span, + Place::Base(PlaceBase::Local(local)) => self.mir.local_decls[local].source_info.span, _ => drop_span, }; @@ -1061,7 +1061,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let (place_desc, note) = if let Some(place_desc) = opt_place_desc { let local_kind = match borrow.borrowed_place { - Place::Local(local) => { + Place::Base(PlaceBase::Local(local)) => { match self.mir.local_kind(local) { LocalKind::ReturnPointer | LocalKind::Temp => bug!("temporary or return pointer with a name"), @@ -1086,7 +1086,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let root_place = self.prefixes(&borrow.borrowed_place, PrefixSet::All) .last() .unwrap(); - let local = if let Place::Local(local) = *root_place { + let local = if let Place::Base(PlaceBase::Local(local)) = *root_place { local } else { bug!("report_cannot_return_reference_to_local: not a local") @@ -1385,7 +1385,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { assigned_span: Span, err_place: &Place<'tcx>, ) { - let (from_arg, local_decl) = if let Place::Local(local) = *err_place { + let (from_arg, local_decl) = if let Place::Base(PlaceBase::Local(local)) = *err_place { if let LocalKind::Arg = self.mir.local_kind(local) { (true, Some(&self.mir.local_decls[local])) } else { @@ -1600,13 +1600,13 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { including_downcast: &IncludingDowncast, ) -> Result<(), ()> { match *place { - Place::Promoted(_) => { + Place::Base(PlaceBase::Promoted(_)) => { buf.push_str("promoted"); } - Place::Local(local) => { + Place::Base(PlaceBase::Local(local)) => { self.append_local_to_string(local, buf)?; } - Place::Static(ref static_) => { + Place::Base(PlaceBase::Static(ref static_)) => { buf.push_str(&self.infcx.tcx.item_name(static_.def_id).to_string()); } Place::Projection(ref proj) => { @@ -1630,7 +1630,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { autoderef, &including_downcast, )?; - } else if let Place::Local(local) = proj.base { + } else if let Place::Base(PlaceBase::Local(local)) = proj.base { if let Some(ClearCrossCrate::Set(BindingForm::RefForGuard)) = self.mir.local_decls[local].is_user_variable { @@ -1742,12 +1742,14 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { /// End-user visible description of the `field`nth field of `base` fn describe_field(&self, base: &Place<'_>, field: Field) -> String { match *base { - Place::Local(local) => { + Place::Base(PlaceBase::Local(local)) => { let local = &self.mir.local_decls[local]; self.describe_field_from_ty(&local.ty, field) } - Place::Promoted(ref prom) => self.describe_field_from_ty(&prom.1, field), - Place::Static(ref static_) => self.describe_field_from_ty(&static_.ty, field), + Place::Base(PlaceBase::Promoted(ref prom)) => + self.describe_field_from_ty(&prom.1, field), + Place::Base(PlaceBase::Static(ref static_)) => + self.describe_field_from_ty(&static_.ty, field), Place::Projection(ref proj) => match proj.elem { ProjectionElem::Deref => self.describe_field(&proj.base, field), ProjectionElem::Downcast(def, variant_index) => @@ -1809,7 +1811,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { /// Checks if a place is a thread-local static. pub fn is_place_thread_local(&self, place: &Place<'tcx>) -> bool { - if let Place::Static(statik) = place { + if let Place::Base(PlaceBase::Static(statik)) = place { let attrs = self.infcx.tcx.get_attrs(statik.def_id); let is_thread_local = attrs.iter().any(|attr| attr.check_name("thread_local")); @@ -1827,7 +1829,9 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { fn classify_drop_access_kind(&self, place: &Place<'tcx>) -> StorageDeadOrDrop<'tcx> { let tcx = self.infcx.tcx; match place { - Place::Local(_) | Place::Static(_) | Place::Promoted(_) => { + Place::Base(PlaceBase::Local(_)) | + Place::Base(PlaceBase::Static(_)) | + Place::Base(PlaceBase::Promoted(_)) => { StorageDeadOrDrop::LocalStorageDead } Place::Projection(box PlaceProjection { base, elem }) => { @@ -1912,7 +1916,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { ); // Check that the initial assignment of the reserve location is into a temporary. let mut target = *match reservation { - Place::Local(local) if self.mir.local_kind(*local) == LocalKind::Temp => local, + Place::Base(PlaceBase::Local(local)) + if self.mir.local_kind(*local) == LocalKind::Temp => local, _ => return None, }; @@ -1924,8 +1929,10 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { "annotate_argument_and_return_for_borrow: target={:?} stmt={:?}", target, stmt ); - if let StatementKind::Assign(Place::Local(assigned_to), box rvalue) = &stmt.kind - { + if let StatementKind::Assign( + Place::Base(PlaceBase::Local(assigned_to)), + box rvalue + ) = &stmt.kind { debug!( "annotate_argument_and_return_for_borrow: assigned_to={:?} \ rvalue={:?}", @@ -2048,7 +2055,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { target, terminator ); if let TerminatorKind::Call { - destination: Some((Place::Local(assigned_to), _)), + destination: Some((Place::Base(PlaceBase::Local(assigned_to)), _)), args, .. } = &terminator.kind @@ -2496,7 +2503,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { .get(location.statement_index) { Some(&Statement { - kind: StatementKind::Assign(Place::Local(local), _), + kind: StatementKind::Assign(Place::Base(PlaceBase::Local(local)), _), .. }) => local, _ => return OtherUse(use_span), @@ -2522,7 +2529,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { def_id, is_generator, places ); if let Some((args_span, var_span)) = self.closure_span( - *def_id, &Place::Local(target), places + *def_id, &Place::Base(PlaceBase::Local(target)), places ) { return ClosureUse { is_generator, diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 1091646bdd5c..715ee856a7a6 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -8,7 +8,7 @@ use rustc::infer::InferCtxt; use rustc::lint::builtin::UNUSED_MUT; use rustc::middle::borrowck::SignalledError; use rustc::mir::{AggregateKind, BasicBlock, BorrowCheckResult, BorrowKind}; -use rustc::mir::{ClearCrossCrate, Local, Location, Mir, Mutability, Operand, Place}; +use rustc::mir::{ClearCrossCrate, Local, Location, Mir, Mutability, Operand, Place, PlaceBase}; use rustc::mir::{Field, Projection, ProjectionElem, Rvalue, Statement, StatementKind}; use rustc::mir::{Terminator, TerminatorKind}; use rustc::ty::query::Providers; @@ -588,7 +588,7 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx StatementKind::StorageDead(local) => { self.access_place( ContextKind::StorageDead.new(location), - (&Place::Local(local), span), + (&Place::Base(PlaceBase::Local(local)), span), (Shallow(None), Write(WriteKind::StorageDeadOrDrop)), LocalMutationIsAllowed::Yes, flow_state, @@ -1104,7 +1104,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // Special case: you can assign a immutable local variable // (e.g., `x = ...`) so long as it has never been initialized // before (at this point in the flow). - if let &Place::Local(local) = place_span.0 { + if let &Place::Base(PlaceBase::Local(local)) = place_span.0 { if let Mutability::Not = self.mir.local_decls[local].mutability { // check for reassignments to immutable local variables self.check_if_reassignment_to_immutable_state( @@ -1231,8 +1231,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // captures of a closure are copied/moved directly // when generating MIR. match operands[field.index()] { - Operand::Move(Place::Local(local)) - | Operand::Copy(Place::Local(local)) => { + Operand::Move(Place::Base(PlaceBase::Local(local))) + | Operand::Copy(Place::Base(PlaceBase::Local(local))) => { self.used_mut.insert(local); } Operand::Move(ref place @ Place::Projection(_)) @@ -1242,10 +1242,10 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { self.used_mut_upvars.push(field); } } - Operand::Move(Place::Static(..)) - | Operand::Copy(Place::Static(..)) - | Operand::Move(Place::Promoted(..)) - | Operand::Copy(Place::Promoted(..)) + Operand::Move(Place::Base(PlaceBase::Static(..))) + | Operand::Copy(Place::Base(PlaceBase::Static(..))) + | Operand::Move(Place::Base(PlaceBase::Promoted(..))) + | Operand::Copy(Place::Base(PlaceBase::Promoted(..))) | Operand::Constant(..) => {} } } @@ -1328,14 +1328,14 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // // FIXME: allow thread-locals to borrow other thread locals? let (might_be_alive, will_be_dropped) = match root_place { - Place::Promoted(_) => (true, false), - Place::Static(_) => { + Place::Base(PlaceBase::Promoted(_)) => (true, false), + Place::Base(PlaceBase::Static(_)) => { // Thread-locals might be dropped after the function exits, but // "true" statics will never be. let is_thread_local = self.is_place_thread_local(&root_place); (true, is_thread_local) } - Place::Local(_) => { + Place::Base(PlaceBase::Local(_)) => { // Locals are always dropped at function exit, and if they // have a destructor it would've been called already. (false, self.locals_are_invalidated_at_exit) @@ -1594,10 +1594,10 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { last_prefix = prefix; } match *last_prefix { - Place::Local(_) => panic!("should have move path for every Local"), + Place::Base(PlaceBase::Local(_)) => panic!("should have move path for every Local"), Place::Projection(_) => panic!("PrefixSet::All meant don't stop for Projection"), - Place::Promoted(_) | - Place::Static(_) => Err(NoMovePathFound::ReachedStatic), + Place::Base(PlaceBase::Promoted(_)) | + Place::Base(PlaceBase::Static(_)) => Err(NoMovePathFound::ReachedStatic), } } @@ -1623,8 +1623,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let mut place = place; loop { match *place { - Place::Promoted(_) | - Place::Local(_) | Place::Static(_) => { + Place::Base(PlaceBase::Promoted(_)) | + Place::Base(PlaceBase::Local(_)) | Place::Base(PlaceBase::Static(_)) => { // assigning to `x` does not require `x` be initialized. break; } @@ -1947,7 +1947,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { ) { match root_place { RootPlace { - place: Place::Local(local), + place: Place::Base(PlaceBase::Local(local)), is_local_mutation_allowed, } => { // If the local may have been initialized, and it is now currently being @@ -1972,11 +1972,11 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { } } RootPlace { - place: Place::Promoted(..), + place: Place::Base(PlaceBase::Promoted(..)), is_local_mutation_allowed: _, } => {} RootPlace { - place: Place::Static(..), + place: Place::Base(PlaceBase::Static(..)), is_local_mutation_allowed: _, } => {} } @@ -1990,7 +1990,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { is_local_mutation_allowed: LocalMutationIsAllowed, ) -> Result, &'d Place<'tcx>> { match *place { - Place::Local(local) => { + Place::Base(PlaceBase::Local(local)) => { let local = &self.mir.local_decls[local]; match local.mutability { Mutability::Not => match is_local_mutation_allowed { @@ -2012,11 +2012,11 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { } // The rules for promotion are made by `qualify_consts`, there wouldn't even be a // `Place::Promoted` if the promotion weren't 100% legal. So we just forward this - Place::Promoted(_) => Ok(RootPlace { + Place::Base(PlaceBase::Promoted(_)) => Ok(RootPlace { place, is_local_mutation_allowed, }), - Place::Static(ref static_) => { + Place::Base(PlaceBase::Static(ref static_)) => { if self.infcx.tcx.is_static(static_.def_id) != Some(hir::Mutability::MutMutable) { Err(place) } else { diff --git a/src/librustc_mir/borrow_check/move_errors.rs b/src/librustc_mir/borrow_check/move_errors.rs index 2a5433d43178..bd4bf67d0b15 100644 --- a/src/librustc_mir/borrow_check/move_errors.rs +++ b/src/librustc_mir/borrow_check/move_errors.rs @@ -111,7 +111,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { // If that ever stops being the case, then the ever initialized // flow could be used. if let Some(StatementKind::Assign( - Place::Local(local), + Place::Base(PlaceBase::Local(local)), box Rvalue::Use(Operand::Move(move_from)), )) = self.mir.basic_blocks()[location.block] .statements diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index 008c081aeb60..f68ed4422bca 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -1,8 +1,8 @@ use rustc::hir; use rustc::hir::Node; use rustc::mir::{self, BindingForm, Constant, ClearCrossCrate, Local, Location, Mir}; -use rustc::mir::{Mutability, Operand, Place, Projection, ProjectionElem, Static, Terminator}; -use rustc::mir::TerminatorKind; +use rustc::mir::{Mutability, Operand, Place, PlaceBase, Projection, ProjectionElem, Static}; +use rustc::mir::{Terminator, TerminatorKind}; use rustc::ty::{self, Const, DefIdTree, TyS, TyKind, TyCtxt}; use rustc_data_structures::indexed_vec::Idx; use syntax_pos::Span; @@ -45,9 +45,9 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { debug!("report_mutability_error: access_place_desc={:?}", access_place_desc); match the_place_err { - Place::Local(local) => { + Place::Base(PlaceBase::Local(local)) => { item_msg = format!("`{}`", access_place_desc.unwrap()); - if let Place::Local(_) = access_place { + if let Place::Base(PlaceBase::Local(_)) = access_place { reason = ", as it is not declared as mutable".to_string(); } else { let name = self.mir.local_decls[*local] @@ -78,7 +78,8 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { base, elem: ProjectionElem::Deref, }) => { - if *base == Place::Local(Local::new(1)) && !self.mir.upvar_decls.is_empty() { + if *base == Place::Base(PlaceBase::Local(Local::new(1))) && + !self.mir.upvar_decls.is_empty() { item_msg = format!("`{}`", access_place_desc.unwrap()); debug_assert!(self.mir.local_decls[Local::new(1)].ty.is_region_ptr()); debug_assert!(is_closure_or_generator( @@ -92,7 +93,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { ", as `Fn` closures cannot mutate their captured variables".to_string() } } else if { - if let Place::Local(local) = *base { + if let Place::Base(PlaceBase::Local(local)) = *base { if let Some(ClearCrossCrate::Set(BindingForm::RefForGuard)) = self.mir.local_decls[local].is_user_variable { true @@ -128,10 +129,10 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { } } - Place::Promoted(_) => unreachable!(), + Place::Base(PlaceBase::Promoted(_)) => unreachable!(), - Place::Static(box Static { def_id, ty: _ }) => { - if let Place::Static(_) = access_place { + Place::Base(PlaceBase::Static(box Static { def_id, ty: _ })) => { + if let Place::Base(PlaceBase::Static(_)) = access_place { item_msg = format!("immutable static item `{}`", access_place_desc.unwrap()); reason = String::new(); } else { @@ -241,7 +242,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { }, // Suggest removing a `&mut` from the use of a mutable reference. - Place::Local(local) + Place::Base(PlaceBase::Local(local)) if { self.mir.local_decls.get(*local).map(|local_decl| { if let ClearCrossCrate::Set( @@ -276,7 +277,8 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { // We want to suggest users use `let mut` for local (user // variable) mutations... - Place::Local(local) if self.mir.local_decls[*local].can_be_made_mutable() => { + Place::Base(PlaceBase::Local(local)) + if self.mir.local_decls[*local].can_be_made_mutable() => { // ... but it doesn't make sense to suggest it on // variables that are `ref x`, `ref mut x`, `&self`, // or `&mut self` (such variables are simply not @@ -330,7 +332,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { // complete hack to approximate old AST-borrowck // diagnostic: if the span starts with a mutable borrow of // a local variable, then just suggest the user remove it. - Place::Local(_) + Place::Base(PlaceBase::Local(_)) if { if let Ok(snippet) = self.infcx.tcx.sess.source_map().span_to_snippet(span) { snippet.starts_with("&mut ") @@ -344,7 +346,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { } Place::Projection(box Projection { - base: Place::Local(local), + base: Place::Base(PlaceBase::Local(local)), elem: ProjectionElem::Deref, }) if { if let Some(ClearCrossCrate::Set(BindingForm::RefForGuard)) = @@ -368,7 +370,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { // FIXME: can this case be generalized to work for an // arbitrary base for the projection? Place::Projection(box Projection { - base: Place::Local(local), + base: Place::Base(PlaceBase::Local(local)), elem: ProjectionElem::Deref, }) if self.mir.local_decls[*local].is_user_variable.is_some() => { @@ -447,7 +449,8 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { Place::Projection(box Projection { base, elem: ProjectionElem::Deref, - }) if *base == Place::Local(Local::new(1)) && !self.mir.upvar_decls.is_empty() => + }) if *base == Place::Base(PlaceBase::Local(Local::new(1))) && + !self.mir.upvar_decls.is_empty() => { err.span_label(span, format!("cannot {ACT}", ACT = act)); err.span_help( @@ -457,7 +460,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { } Place::Projection(box Projection { - base: Place::Local(local), + base: Place::Base(PlaceBase::Local(local)), elem: ProjectionElem::Deref, }) if error_access == AccessKind::MutableBorrow => { err.span_label(span, format!("cannot {ACT}", ACT = act)); diff --git a/src/librustc_mir/borrow_check/nll/constraint_generation.rs b/src/librustc_mir/borrow_check/nll/constraint_generation.rs index 9eb09b514741..375dd6e97f1a 100644 --- a/src/librustc_mir/borrow_check/nll/constraint_generation.rs +++ b/src/librustc_mir/borrow_check/nll/constraint_generation.rs @@ -6,7 +6,7 @@ use crate::borrow_check::nll::region_infer::values::LivenessValues; use rustc::infer::InferCtxt; use rustc::mir::visit::TyContext; use rustc::mir::visit::Visitor; -use rustc::mir::{BasicBlock, BasicBlockData, Location, Mir, Place, Rvalue}; +use rustc::mir::{BasicBlock, BasicBlockData, Location, Mir, Place, PlaceBase, Rvalue}; use rustc::mir::{SourceInfo, Statement, Terminator}; use rustc::mir::UserTypeProjection; use rustc::ty::fold::TypeFoldable; @@ -130,7 +130,7 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx // When we see `X = ...`, then kill borrows of // `(*X).foo` and so forth. if let Some(all_facts) = self.all_facts { - if let Place::Local(temp) = place { + if let Place::Base(PlaceBase::Local(temp)) = place { if let Some(borrow_indices) = self.borrow_set.local_map.get(temp) { all_facts.killed.reserve(borrow_indices.len()); for &borrow_index in borrow_indices { diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs index 8ea249959dd2..17f8c23f4fdd 100644 --- a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs +++ b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs @@ -6,8 +6,8 @@ use crate::borrow_check::nll::region_infer::{Cause, RegionName}; use crate::borrow_check::nll::ConstraintDescription; use crate::borrow_check::{Context, MirBorrowckCtxt, WriteKind}; use rustc::mir::{ - CastKind, ConstraintCategory, FakeReadCause, Local, Location, Mir, Operand, Place, Projection, - ProjectionElem, Rvalue, Statement, StatementKind, TerminatorKind, + CastKind, ConstraintCategory, FakeReadCause, Local, Location, Mir, Operand, Place, PlaceBase, + Projection, ProjectionElem, Rvalue, Statement, StatementKind, TerminatorKind, }; use rustc::ty::{self, TyCtxt}; use rustc_data_structures::fx::FxHashSet; @@ -245,7 +245,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { Some(Cause::LiveVar(local, location)) => { let span = mir.source_info(location).span; let spans = self - .move_spans(&Place::Local(local), location) + .move_spans(&Place::Base(PlaceBase::Local(local)), location) .or_else(|| self.borrow_spans(span, location)); let borrow_location = context.loc; @@ -265,7 +265,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let mut should_note_order = false; if mir.local_decls[local].name.is_some() { if let Some((WriteKind::StorageDeadOrDrop, place)) = kind_place { - if let Place::Local(borrowed_local) = place { + if let Place::Base(PlaceBase::Local(borrowed_local)) = place { let dropped_local_scope = mir.local_decls[local].visibility_scope; let borrowed_local_scope = mir.local_decls[*borrowed_local].visibility_scope; @@ -481,7 +481,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // Just point to the function, to reduce the chance of overlapping spans. let function_span = match func { Operand::Constant(c) => c.span, - Operand::Copy(Place::Local(l)) | Operand::Move(Place::Local(l)) => { + Operand::Copy(Place::Base(PlaceBase::Local(l))) | + Operand::Move(Place::Base(PlaceBase::Local(l))) => { let local_decl = &self.mir.local_decls[*l]; if local_decl.name.is_none() { local_decl.source_info.span @@ -522,7 +523,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // it which simplifies the termination logic. let mut queue = vec![location]; let mut target = if let Some(&Statement { - kind: StatementKind::Assign(Place::Local(local), _), + kind: StatementKind::Assign(Place::Base(PlaceBase::Local(local)), _), .. }) = stmt { @@ -547,9 +548,9 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // The only kind of statement that we care about is assignments... if let StatementKind::Assign(place, box rvalue) = &stmt.kind { let into = match place { - Place::Local(into) => into, + Place::Base(PlaceBase::Local(into)) => into, Place::Projection(box Projection { - base: Place::Local(into), + base: Place::Base(PlaceBase::Local(into)), elem: ProjectionElem::Deref, }) => into, _ => { @@ -563,8 +564,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // If we see a use, we should check whether it is our data, and if so // update the place that we're looking for to that new place. Rvalue::Use(operand) => match operand { - Operand::Copy(Place::Local(from)) - | Operand::Move(Place::Local(from)) + Operand::Copy(Place::Base(PlaceBase::Local(from))) + | Operand::Move(Place::Base(PlaceBase::Local(from))) if *from == target => { target = *into; @@ -574,8 +575,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // If we see a unsized cast, then if it is our data we should check // whether it is being cast to a trait object. Rvalue::Cast(CastKind::Unsize, operand, ty) => match operand { - Operand::Copy(Place::Local(from)) - | Operand::Move(Place::Local(from)) + Operand::Copy(Place::Base(PlaceBase::Local(from))) + | Operand::Move(Place::Base(PlaceBase::Local(from))) if *from == target => { debug!("was_captured_by_trait_object: ty={:?}", ty); @@ -605,7 +606,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { debug!("was_captured_by_trait_object: terminator={:?}", terminator); if let TerminatorKind::Call { - destination: Some((Place::Local(dest), block)), + destination: Some((Place::Base(PlaceBase::Local(dest)), block)), args, .. } = &terminator.kind @@ -616,7 +617,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { ); // Check if one of the arguments to this function is the target place. let found_target = args.iter().any(|arg| { - if let Operand::Move(Place::Local(potential)) = arg { + if let Operand::Move(Place::Base(PlaceBase::Local(potential))) = arg { *potential == target } else { false diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs index 9c0676776210..aafbff357764 100644 --- a/src/librustc_mir/borrow_check/nll/invalidation.rs +++ b/src/librustc_mir/borrow_check/nll/invalidation.rs @@ -12,7 +12,7 @@ use crate::borrow_check::path_utils::*; use crate::dataflow::move_paths::indexes::BorrowIndex; use rustc::ty::TyCtxt; use rustc::mir::visit::Visitor; -use rustc::mir::{BasicBlock, Location, Mir, Place, Rvalue}; +use rustc::mir::{BasicBlock, Location, Mir, Place, PlaceBase, Rvalue}; use rustc::mir::{Statement, StatementKind}; use rustc::mir::{Terminator, TerminatorKind}; use rustc::mir::{Operand, BorrowKind}; @@ -131,7 +131,7 @@ impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> { StatementKind::StorageDead(local) => { self.access_place( ContextKind::StorageDead.new(location), - &Place::Local(local), + &Place::Base(PlaceBase::Local(local)), (Shallow(None), Write(WriteKind::StorageDeadOrDrop)), LocalMutationIsAllowed::Yes, ); diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index df035aab54c9..cf054c2d0550 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -451,10 +451,10 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { ) -> PlaceTy<'tcx> { debug!("sanitize_place: {:?}", place); let place_ty = match *place { - Place::Local(index) => PlaceTy::Ty { + Place::Base(PlaceBase::Local(index)) => PlaceTy::Ty { ty: self.mir.local_decls[index].ty, }, - Place::Promoted(box (_index, sty)) => { + Place::Base(PlaceBase::Promoted(box (_index, sty))) => { let sty = self.sanitize_type(place, sty); // FIXME -- promoted MIR return types reference // various "free regions" (e.g., scopes and things) @@ -469,7 +469,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { // promoted_mir.return_ty() PlaceTy::Ty { ty: sty } } - Place::Static(box Static { def_id, ty: sty }) => { + Place::Base(PlaceBase::Static(box Static { def_id, ty: sty })) => { let sty = self.sanitize_type(place, sty); let ty = self.tcx().type_of(def_id); let ty = self.cx.normalize(ty, location); @@ -553,7 +553,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { } } ProjectionElem::Index(i) => { - let index_ty = Place::Local(i).ty(self.mir, tcx).to_ty(tcx); + let index_ty = Place::Base(PlaceBase::Local(i)).ty(self.mir, tcx).to_ty(tcx); if index_ty != tcx.types.usize { PlaceTy::Ty { ty: span_mirbug_and_err!(self, i, "index by non-usize {:?}", i), @@ -1234,7 +1234,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { // of lowering. Assignments to other sorts of places *are* interesting // though. let category = match *place { - Place::Local(RETURN_PLACE) => if let Some(BorrowCheckContext { + Place::Base(PlaceBase::Local(RETURN_PLACE)) => if let Some(BorrowCheckContext { universal_regions: UniversalRegions { defining_ty: DefiningTy::Const(def_id, _), @@ -1251,7 +1251,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { } else { ConstraintCategory::Return }, - Place::Local(l) if !mir.local_decls[l].is_user_variable.is_some() => { + Place::Base(PlaceBase::Local(l)) + if !mir.local_decls[l].is_user_variable.is_some() => { ConstraintCategory::Boring } _ => ConstraintCategory::Assignment, @@ -1537,7 +1538,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { Some((ref dest, _target_block)) => { let dest_ty = dest.ty(mir, tcx).to_ty(tcx); let category = match *dest { - Place::Local(RETURN_PLACE) => { + Place::Base(PlaceBase::Local(RETURN_PLACE)) => { if let Some(BorrowCheckContext { universal_regions: UniversalRegions { @@ -1556,7 +1557,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { ConstraintCategory::Return } } - Place::Local(l) if !mir.local_decls[l].is_user_variable.is_some() => { + Place::Base(PlaceBase::Local(l)) + if !mir.local_decls[l].is_user_variable.is_some() => { ConstraintCategory::Boring } _ => ConstraintCategory::Assignment, diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index 9073ae6bed5b..9e0bb93c33a5 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -3,7 +3,7 @@ use crate::borrow_check::places_conflict; use crate::borrow_check::Context; use crate::borrow_check::AccessDepth; use crate::dataflow::indexes::BorrowIndex; -use rustc::mir::{BasicBlock, Location, Mir, Place}; +use rustc::mir::{BasicBlock, Location, Mir, Place, PlaceBase}; use rustc::mir::{ProjectionElem, BorrowKind}; use rustc::ty::TyCtxt; use rustc_data_structures::graph::dominators::Dominators; @@ -138,9 +138,9 @@ pub(super) fn is_active<'tcx>( /// This is called for all Yield statements on movable generators pub(super) fn borrow_of_local_data<'tcx>(place: &Place<'tcx>) -> bool { match place { - Place::Promoted(_) | - Place::Static(..) => false, - Place::Local(..) => true, + Place::Base(PlaceBase::Promoted(_)) | + Place::Base(PlaceBase::Static(..)) => false, + Place::Base(PlaceBase::Local(..)) => true, Place::Projection(box proj) => { match proj.elem { // Reborrow of already borrowed data is ignored diff --git a/src/librustc_mir/borrow_check/place_ext.rs b/src/librustc_mir/borrow_check/place_ext.rs index d6d2861b557a..c05ee3cf65b3 100644 --- a/src/librustc_mir/borrow_check/place_ext.rs +++ b/src/librustc_mir/borrow_check/place_ext.rs @@ -1,6 +1,6 @@ use rustc::hir; use rustc::mir::ProjectionElem; -use rustc::mir::{Local, Mir, Place, Mutability}; +use rustc::mir::{Local, Mir, Place, PlaceBase, Mutability}; use rustc::ty::{self, TyCtxt}; use crate::borrow_check::borrow_set::LocalsStateAtExit; @@ -30,7 +30,7 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> { locals_state_at_exit: &LocalsStateAtExit, ) -> bool { match self { - Place::Promoted(_) => false, + Place::Base(PlaceBase::Promoted(_)) => false, // If a local variable is immutable, then we only need to track borrows to guard // against two kinds of errors: @@ -40,7 +40,7 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> { // // In particular, the variable cannot be mutated -- the "access checks" will fail -- // so we don't have to worry about mutation while borrowed. - Place::Local(index) => { + Place::Base(PlaceBase::Local(index)) => { match locals_state_at_exit { LocalsStateAtExit::AllAreInvalidated => false, LocalsStateAtExit::SomeAreInvalidated { has_storage_dead_or_moved } => { @@ -51,7 +51,7 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> { } } } - Place::Static(static_) => { + Place::Base(PlaceBase::Static(static_)) => { tcx.is_static(static_.def_id) == Some(hir::Mutability::MutMutable) } Place::Projection(proj) => match proj.elem { @@ -88,9 +88,9 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> { loop { match p { Place::Projection(pi) => p = &pi.base, - Place::Promoted(_) | - Place::Static(_) => return None, - Place::Local(l) => return Some(*l), + Place::Base(PlaceBase::Promoted(_)) | + Place::Base(PlaceBase::Static(_)) => return None, + Place::Base(PlaceBase::Local(l)) => return Some(*l), } } } diff --git a/src/librustc_mir/borrow_check/places_conflict.rs b/src/librustc_mir/borrow_check/places_conflict.rs index b5175cf41dd5..1d18ada1fb69 100644 --- a/src/librustc_mir/borrow_check/places_conflict.rs +++ b/src/librustc_mir/borrow_check/places_conflict.rs @@ -2,8 +2,7 @@ use crate::borrow_check::ArtificialField; use crate::borrow_check::Overlap; use crate::borrow_check::{Deep, Shallow, AccessDepth}; use rustc::hir; -use rustc::mir::{BorrowKind, Mir, Place}; -use rustc::mir::{Projection, ProjectionElem}; +use rustc::mir::{BorrowKind, Mir, Place, PlaceBase, Projection, ProjectionElem}; use rustc::ty::{self, TyCtxt}; use std::cmp::max; @@ -60,8 +59,8 @@ pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>( // This Local/Local case is handled by the more general code below, but // it's so common that it's a speed win to check for it first. - if let Place::Local(l1) = borrow_place { - if let Place::Local(l2) = access_place { + if let Place::Base(PlaceBase::Local(l1)) = borrow_place { + if let Place::Base(PlaceBase::Local(l2)) = access_place { return l1 == l2; } } @@ -339,8 +338,8 @@ fn unroll_place<'tcx, R>( op, ), - Place::Promoted(_) | - Place::Local(_) | Place::Static(_) => { + Place::Base(PlaceBase::Promoted(_)) | + Place::Base(PlaceBase::Local(_)) | Place::Base(PlaceBase::Static(_)) => { let list = PlaceComponents { component: place, next, @@ -361,7 +360,7 @@ fn place_element_conflict<'a, 'gcx: 'tcx, 'tcx>( bias: PlaceConflictBias, ) -> Overlap { match (elem1, elem2) { - (Place::Local(l1), Place::Local(l2)) => { + (Place::Base(PlaceBase::Local(l1)), Place::Base(PlaceBase::Local(l2))) => { if l1 == l2 { // the same local - base case, equal debug!("place_element_conflict: DISJOINT-OR-EQ-LOCAL"); @@ -372,7 +371,7 @@ fn place_element_conflict<'a, 'gcx: 'tcx, 'tcx>( Overlap::Disjoint } } - (Place::Static(static1), Place::Static(static2)) => { + (Place::Base(PlaceBase::Static(static1)), Place::Base(PlaceBase::Static(static2))) => { if static1.def_id != static2.def_id { debug!("place_element_conflict: DISJOINT-STATIC"); Overlap::Disjoint @@ -385,7 +384,7 @@ fn place_element_conflict<'a, 'gcx: 'tcx, 'tcx>( Overlap::EqualOrDisjoint } } - (Place::Promoted(p1), Place::Promoted(p2)) => { + (Place::Base(PlaceBase::Promoted(p1)), Place::Base(PlaceBase::Promoted(p2))) => { if p1.0 == p2.0 { if let ty::Array(_, size) = p1.1.sty { if size.unwrap_usize(tcx) == 0 { @@ -403,9 +402,12 @@ fn place_element_conflict<'a, 'gcx: 'tcx, 'tcx>( Overlap::Disjoint } } - (Place::Local(_), Place::Promoted(_)) | (Place::Promoted(_), Place::Local(_)) | - (Place::Promoted(_), Place::Static(_)) | (Place::Static(_), Place::Promoted(_)) | - (Place::Local(_), Place::Static(_)) | (Place::Static(_), Place::Local(_)) => { + (Place::Base(PlaceBase::Local(_)), Place::Base(PlaceBase::Promoted(_))) | + (Place::Base(PlaceBase::Promoted(_)), Place::Base(PlaceBase::Local(_))) | + (Place::Base(PlaceBase::Promoted(_)), Place::Base(PlaceBase::Static(_))) | + (Place::Base(PlaceBase::Static(_)), Place::Base(PlaceBase::Promoted(_))) | + (Place::Base(PlaceBase::Local(_)), Place::Base(PlaceBase::Static(_))) | + (Place::Base(PlaceBase::Static(_)), Place::Base(PlaceBase::Local(_))) => { debug!("place_element_conflict: DISJOINT-STATIC-LOCAL-PROMOTED"); Overlap::Disjoint } diff --git a/src/librustc_mir/borrow_check/prefixes.rs b/src/librustc_mir/borrow_check/prefixes.rs index c3a8381cd581..384fd5c9987b 100644 --- a/src/librustc_mir/borrow_check/prefixes.rs +++ b/src/librustc_mir/borrow_check/prefixes.rs @@ -11,7 +11,7 @@ use super::MirBorrowckCtxt; use rustc::hir; use rustc::ty::{self, TyCtxt}; -use rustc::mir::{Mir, Place, ProjectionElem}; +use rustc::mir::{Mir, Place, PlaceBase, ProjectionElem}; pub trait IsPrefixOf<'tcx> { fn is_prefix_of(&self, other: &Place<'tcx>) -> bool; @@ -26,8 +26,9 @@ impl<'tcx> IsPrefixOf<'tcx> for Place<'tcx> { } match *cursor { - Place::Promoted(_) | - Place::Local(_) | Place::Static(_) => return false, + Place::Base(PlaceBase::Promoted(_)) | + Place::Base(PlaceBase::Local(_)) | + Place::Base(PlaceBase::Static(_)) => return false, Place::Projection(ref proj) => { cursor = &proj.base; } @@ -86,9 +87,9 @@ impl<'cx, 'gcx, 'tcx> Iterator for Prefixes<'cx, 'gcx, 'tcx> { 'cursor: loop { let proj = match *cursor { - Place::Promoted(_) | - Place::Local(_) | // search yielded this leaf - Place::Static(_) => { + Place::Base(PlaceBase::Promoted(_)) | + Place::Base(PlaceBase::Local(_)) | // search yielded this leaf + Place::Base(PlaceBase::Static(_)) => { self.next = None; return Some(cursor); } diff --git a/src/librustc_mir/borrow_check/used_muts.rs b/src/librustc_mir/borrow_check/used_muts.rs index 8c7359bdee76..b102bced0e33 100644 --- a/src/librustc_mir/borrow_check/used_muts.rs +++ b/src/librustc_mir/borrow_check/used_muts.rs @@ -1,5 +1,7 @@ use rustc::mir::visit::{PlaceContext, Visitor}; -use rustc::mir::{BasicBlock, Local, Location, Place, Statement, StatementKind, TerminatorKind}; +use rustc::mir::{ + BasicBlock, Local, Location, Place, PlaceBase, Statement, StatementKind, TerminatorKind +}; use rustc_data_structures::fx::FxHashSet; @@ -114,7 +116,7 @@ impl<'visit, 'cx, 'gcx, 'tcx> Visitor<'tcx> for GatherUsedMutsVisitor<'visit, 'c "assignment of {:?} to {:?}, adding {:?} to used mutable set", path.place, local, path.place ); - if let Place::Local(user_local) = path.place { + if let Place::Base(PlaceBase::Local(user_local)) = path.place { self.mbcx.used_mut.insert(user_local); } } diff --git a/src/librustc_mir/build/expr/as_operand.rs b/src/librustc_mir/build/expr/as_operand.rs index 38fae8539c8d..e354a2ee8160 100644 --- a/src/librustc_mir/build/expr/as_operand.rs +++ b/src/librustc_mir/build/expr/as_operand.rs @@ -74,7 +74,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } Category::Place | Category::Rvalue(..) => { let operand = unpack!(block = this.as_temp(block, scope, expr, Mutability::Mut)); - block.and(Operand::Move(Place::Local(operand))) + block.and(Operand::Move(Place::Base(PlaceBase::Local(operand)))) } } } diff --git a/src/librustc_mir/build/expr/as_place.rs b/src/librustc_mir/build/expr/as_place.rs index ed444191226a..3bea88024b3f 100644 --- a/src/librustc_mir/build/expr/as_place.rs +++ b/src/librustc_mir/build/expr/as_place.rs @@ -98,19 +98,19 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { <, Rvalue::BinaryOp( BinOp::Lt, - Operand::Copy(Place::Local(idx)), + Operand::Copy(Place::Base(PlaceBase::Local(idx))), Operand::Copy(len.clone()), ), ); let msg = BoundsCheck { len: Operand::Move(len), - index: Operand::Copy(Place::Local(idx)), + index: Operand::Copy(Place::Base(PlaceBase::Local(idx))), }; let success = this.assert(block, Operand::Move(lt), true, msg, expr_span); success.and(slice.index(idx)) } - ExprKind::SelfRef => block.and(Place::Local(Local::new(1))), + ExprKind::SelfRef => block.and(Place::Base(PlaceBase::Local(Local::new(1)))), ExprKind::VarRef { id } => { let place = if this.is_bound_var_in_guard(id) && this .hir @@ -118,17 +118,17 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { .all_pat_vars_are_implicit_refs_within_guards() { let index = this.var_local_id(id, RefWithinGuard); - Place::Local(index).deref() + Place::Base(PlaceBase::Local(index)).deref() } else { let index = this.var_local_id(id, OutsideGuard); - Place::Local(index) + Place::Base(PlaceBase::Local(index)) }; block.and(place) } - ExprKind::StaticRef { id } => block.and(Place::Static(Box::new(Static { + ExprKind::StaticRef { id } => block.and(Place::Base(PlaceBase::Static(Box::new(Static { def_id: id, ty: expr.ty, - }))), + })))), ExprKind::PlaceTypeAscription { source, user_ty } => { let place = unpack!(block = this.as_place(block, source)); @@ -172,14 +172,14 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { Statement { source_info, kind: StatementKind::AscribeUserType( - Place::Local(temp.clone()), + Place::Base(PlaceBase::Local(temp.clone())), Variance::Invariant, box UserTypeProjection { base: annotation_index, projs: vec![], }, ), }, ); } - block.and(Place::Local(temp)) + block.and(Place::Base(PlaceBase::Local(temp))) } ExprKind::Array { .. } @@ -219,7 +219,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { }); let temp = unpack!(block = this.as_temp(block, expr.temp_lifetime, expr, mutability)); - block.and(Place::Local(temp)) + block.and(Place::Base(PlaceBase::Local(temp))) } } } diff --git a/src/librustc_mir/build/expr/as_rvalue.rs b/src/librustc_mir/build/expr/as_rvalue.rs index 88dbd93939e5..b00d1c612edf 100644 --- a/src/librustc_mir/build/expr/as_rvalue.rs +++ b/src/librustc_mir/build/expr/as_rvalue.rs @@ -127,7 +127,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { this.schedule_drop_storage_and_value( expr_span, scope, - &Place::Local(result), + &Place::Base(PlaceBase::Local(result)), value.ty, ); } @@ -135,11 +135,16 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // malloc some memory of suitable type (thus far, uninitialized): let box_ = Rvalue::NullaryOp(NullOp::Box, value.ty); this.cfg - .push_assign(block, source_info, &Place::Local(result), box_); + .push_assign(block, source_info, &Place::Base(PlaceBase::Local(result)), box_); // initialize the box contents: - unpack!(block = this.into(&Place::Local(result).deref(), block, value)); - block.and(Rvalue::Use(Operand::Move(Place::Local(result)))) + unpack!( + block = this.into( + &Place::Base(PlaceBase::Local(result)).deref(), + block, value + ) + ); + block.and(Rvalue::Use(Operand::Move(Place::Base(PlaceBase::Local(result))))) } ExprKind::Cast { source } => { let source = this.hir.mirror(source); @@ -522,9 +527,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let arg_place = unpack!(block = this.as_place(block, arg)); let mutability = match arg_place { - Place::Local(local) => this.local_decls[local].mutability, + Place::Base(PlaceBase::Local(local)) => this.local_decls[local].mutability, Place::Projection(box Projection { - base: Place::Local(local), + base: Place::Base(PlaceBase::Local(local)), elem: ProjectionElem::Deref, }) => { debug_assert!( @@ -554,11 +559,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // Not projected from the implicit `self` in a closure. debug_assert!( match *base { - Place::Local(local) => local == Local::new(1), + Place::Base(PlaceBase::Local(local)) => local == Local::new(1), Place::Projection(box Projection { ref base, elem: ProjectionElem::Deref, - }) => *base == Place::Local(Local::new(1)), + }) => *base == Place::Base(PlaceBase::Local(Local::new(1))), _ => false, }, "Unexpected capture place" @@ -583,7 +588,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { this.cfg.push_assign( block, source_info, - &Place::Local(temp), + &Place::Base(PlaceBase::Local(temp)), Rvalue::Ref(this.hir.tcx().types.re_erased, borrow_kind, arg_place), ); @@ -594,12 +599,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { this.schedule_drop_storage_and_value( upvar_span, temp_lifetime, - &Place::Local(temp), + &Place::Base(PlaceBase::Local(temp)), upvar_ty, ); } - block.and(Operand::Move(Place::Local(temp))) + block.and(Operand::Move(Place::Base(PlaceBase::Local(temp)))) } // Helper to get a `-1` value of the appropriate type diff --git a/src/librustc_mir/build/expr/as_temp.rs b/src/librustc_mir/build/expr/as_temp.rs index efa1a4895e0c..cba771f27065 100644 --- a/src/librustc_mir/build/expr/as_temp.rs +++ b/src/librustc_mir/build/expr/as_temp.rs @@ -73,7 +73,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ); } - unpack!(block = this.into(&Place::Local(temp), block, expr)); + unpack!(block = this.into(&Place::Base(PlaceBase::Local(temp)), block, expr)); // In constants, temp_lifetime is None for temporaries that live for the // 'static lifetime. Thus we do not drop these temporaries and simply leak them. @@ -88,7 +88,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { this.schedule_drop_storage_and_value( expr_span, temp_lifetime, - &Place::Local(temp), + &Place::Base(PlaceBase::Local(temp)), expr_ty, ); } diff --git a/src/librustc_mir/build/expr/into.rs b/src/librustc_mir/build/expr/into.rs index 07db67a6ae00..d9839e0c6ec5 100644 --- a/src/librustc_mir/build/expr/into.rs +++ b/src/librustc_mir/build/expr/into.rs @@ -295,7 +295,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { is_user_variable: None, is_block_tail: None, }); - let ptr_temp = Place::Local(ptr_temp); + let ptr_temp = Place::Base(PlaceBase::Local(ptr_temp)); let block = unpack!(this.into(&ptr_temp, block, ptr)); this.into(&ptr_temp.deref(), block, val) } else { diff --git a/src/librustc_mir/build/expr/stmt.rs b/src/librustc_mir/build/expr/stmt.rs index aadc2368f5ae..9527a2327957 100644 --- a/src/librustc_mir/build/expr/stmt.rs +++ b/src/librustc_mir/build/expr/stmt.rs @@ -139,13 +139,22 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { Some(value) => { debug!("stmt_expr Return val block_context.push(SubExpr) : {:?}", expr2); this.block_context.push(BlockFrame::SubExpr); - let result = unpack!(this.into(&Place::Local(RETURN_PLACE), block, value)); + let result = unpack!( + this.into( + &Place::RETURN_PLACE, + block, + value + ) + ); this.block_context.pop(); result } None => { - this.cfg - .push_assign_unit(block, source_info, &Place::Local(RETURN_PLACE)); + this.cfg.push_assign_unit( + block, + source_info, + &Place::RETURN_PLACE, + ); block } }; @@ -226,7 +235,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } } let temp = this.local_decls.push(local_decl); - let place = Place::Local(temp); + let place = Place::Base(PlaceBase::Local(temp)); debug!("created temp {:?} for expr {:?} in block_context: {:?}", temp, expr, this.block_context); place diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index 2c4eb0bc091c..8f1301b743e9 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -543,7 +543,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { kind: StatementKind::StorageLive(local_id), }, ); - let place = Place::Local(local_id); + let place = Place::Base(PlaceBase::Local(local_id)); let var_ty = self.local_decls[local_id].ty; let hir_id = self.hir.tcx().hir().node_to_hir_id(var); let region_scope = self.hir.region_scope_tree.var_scope(hir_id.local_id); @@ -559,7 +559,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { self.schedule_drop( span, region_scope, - &Place::Local(local_id), + &Place::Base(PlaceBase::Local(local_id)), var_ty, DropKind::Value { cached_block: CachedBlock::default(), @@ -1452,7 +1452,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { self.cfg.push_assign( block, scrutinee_source_info, - &Place::Local(temp), + &Place::Base(PlaceBase::Local(temp)), borrow, ); } @@ -1478,7 +1478,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { source_info: guard_end, kind: StatementKind::FakeRead( FakeReadCause::ForMatchGuard, - Place::Local(temp), + Place::Base(PlaceBase::Local(temp)), ), }); } @@ -1529,7 +1529,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // place they refer to can't be modified by the guard. for binding in by_value_bindings.clone() { let local_id = self.var_local_id(binding.var_id, RefWithinGuard); - let place = Place::Local(local_id); + let place = Place::Base(PlaceBase::Local(local_id)); self.cfg.push( block, Statement { diff --git a/src/librustc_mir/build/misc.rs b/src/librustc_mir/build/misc.rs index 900f7f1744a1..2692c24806ff 100644 --- a/src/librustc_mir/build/misc.rs +++ b/src/librustc_mir/build/misc.rs @@ -16,7 +16,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { /// call `schedule_drop` once the temporary is initialized. pub fn temp(&mut self, ty: Ty<'tcx>, span: Span) -> Place<'tcx> { let temp = self.local_decls.push(LocalDecl::new_temp(ty, span)); - let place = Place::Local(temp); + let place = Place::Base(PlaceBase::Local(temp)); debug!("temp: created temp {:?} with type {:?}", place, self.local_decls[temp].ty); place diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 19507c900da6..e4f85887841e 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -741,7 +741,7 @@ fn construct_const<'a, 'gcx, 'tcx>( let mut block = START_BLOCK; let expr = builder.hir.mirror(ast_expr); - unpack!(block = builder.into_expr(&Place::Local(RETURN_PLACE), block, expr)); + unpack!(block = builder.into_expr(&Place::RETURN_PLACE, block, expr)); let source_info = builder.source_info(span); builder.cfg.terminate(block, source_info, TerminatorKind::Return); @@ -887,7 +887,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { for (index, arg_info) in arguments.iter().enumerate() { // Function arguments always get the first Local indices after the return place let local = Local::new(index + 1); - let place = Place::Local(local); + let place = Place::Base(PlaceBase::Local(local)); let &ArgInfo(ty, opt_ty_info, pattern, ref self_binding) = arg_info; // Make sure we drop (parts of) the argument even when not matched on. @@ -936,7 +936,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } let body = self.hir.mirror(ast_body); - self.into(&Place::Local(RETURN_PLACE), block, body) + self.into(&Place::RETURN_PLACE, block, body) } fn get_unit_temp(&mut self) -> Place<'tcx> { diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs index 71acf747d085..4189e3e7ddbb 100644 --- a/src/librustc_mir/build/scope.rs +++ b/src/librustc_mir/build/scope.rs @@ -662,7 +662,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { DropKind::Value { .. } => if !needs_drop { return }, DropKind::Storage => { match *place { - Place::Local(index) => if index.index() <= self.arg_count { + Place::Base(PlaceBase::Local(index)) => if index.index() <= self.arg_count { span_bug!( span, "`schedule_drop` called with index {} and arg_count {}", index.index(), @@ -936,7 +936,7 @@ fn build_scope_drops<'tcx>( // Drop the storage for both value and storage drops. // Only temps and vars need their storage dead. match drop_data.location { - Place::Local(index) if index.index() > arg_count => { + Place::Base(PlaceBase::Local(index)) if index.index() > arg_count => { cfg.push(block, Statement { source_info, kind: StatementKind::StorageDead(index) diff --git a/src/librustc_mir/dataflow/drop_flag_effects.rs b/src/librustc_mir/dataflow/drop_flag_effects.rs index 151a004dce94..f78c82a93020 100644 --- a/src/librustc_mir/dataflow/drop_flag_effects.rs +++ b/src/librustc_mir/dataflow/drop_flag_effects.rs @@ -163,7 +163,7 @@ pub(crate) fn drop_flag_effects_for_function_entry<'a, 'gcx, 'tcx, F>( { let move_data = &ctxt.move_data; for arg in mir.args_iter() { - let place = mir::Place::Local(arg); + let place = mir::Place::Base(mir::PlaceBase::Local(arg)); let lookup_result = move_data.rev_lookup.find(&place); on_lookup_result_bits(tcx, mir, move_data, lookup_result, diff --git a/src/librustc_mir/dataflow/impls/borrowed_locals.rs b/src/librustc_mir/dataflow/impls/borrowed_locals.rs index 51d628ce6c5c..b9c8879b3c36 100644 --- a/src/librustc_mir/dataflow/impls/borrowed_locals.rs +++ b/src/librustc_mir/dataflow/impls/borrowed_locals.rs @@ -92,9 +92,9 @@ struct BorrowedLocalsVisitor<'b, 'c: 'b> { fn find_local<'tcx>(place: &Place<'tcx>) -> Option { match *place { - Place::Local(l) => Some(l), - Place::Promoted(_) | - Place::Static(..) => None, + Place::Base(PlaceBase::Local(l)) => Some(l), + Place::Base(PlaceBase::Promoted(_)) | + Place::Base(PlaceBase::Static(..)) => None, Place::Projection(ref proj) => { match proj.elem { ProjectionElem::Deref => None, diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index beb0b3187082..b47aff3a4f85 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -1,7 +1,7 @@ use crate::borrow_check::borrow_set::{BorrowSet, BorrowData}; use crate::borrow_check::place_ext::PlaceExt; -use rustc::mir::{self, Location, Place, Mir}; +use rustc::mir::{self, Location, Place, PlaceBase, Mir}; use rustc::ty::TyCtxt; use rustc::ty::RegionVid; @@ -189,7 +189,7 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> { ) { debug!("kill_borrows_on_place: place={:?}", place); // Handle the `Place::Local(..)` case first and exit early. - if let Place::Local(local) = place { + if let Place::Base(PlaceBase::Local(local)) = place { if let Some(borrow_indices) = self.borrow_set.local_map.get(&local) { debug!("kill_borrows_on_place: borrow_indices={:?}", borrow_indices); sets.kill_all(borrow_indices); @@ -285,7 +285,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for Borrows<'a, 'gcx, 'tcx> { mir::StatementKind::StorageDead(local) => { // Make sure there are no remaining borrows for locals that // are gone out of scope. - self.kill_borrows_on_place(sets, &Place::Local(local)); + self.kill_borrows_on_place(sets, &Place::Base(PlaceBase::Local(local))); } mir::StatementKind::InlineAsm { ref outputs, ref asm, .. } => { diff --git a/src/librustc_mir/dataflow/impls/mod.rs b/src/librustc_mir/dataflow/impls/mod.rs index cc92ebfab89b..4dcfb3f1a7fc 100644 --- a/src/librustc_mir/dataflow/impls/mod.rs +++ b/src/librustc_mir/dataflow/impls/mod.rs @@ -493,7 +493,8 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for EverInitializedPlaces<'a, 'gcx, 'tc // storagedeads after everything ends, so if we don't regard the // storagelive as killing storage, we would have a multiple assignment // to immutable data error. - if let LookupResult::Exact(mpi) = rev_lookup.find(&mir::Place::Local(local)) { + if let LookupResult::Exact(mpi) = + rev_lookup.find(&mir::Place::Base(mir::PlaceBase::Local(local))) { debug!("stmt {:?} at loc {:?} clears the ever initialized status of {:?}", stmt, location, &init_path_map[mpi]); sets.kill_all(&init_path_map[mpi]); diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index 1ae050654b4b..7a9140bce628 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -33,13 +33,13 @@ impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> { moves: IndexVec::new(), loc_map: LocationMap::new(mir), rev_lookup: MovePathLookup { - locals: mir.local_decls.indices().map(Place::Local).map(|v| { + locals: mir.local_decls.indices().map(PlaceBase::Local).map(|v| { Self::new_move_path( &mut move_paths, &mut path_map, &mut init_path_map, None, - v, + Place::Base(v), ) }).collect(), projections: Default::default(), @@ -96,9 +96,9 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> { { debug!("lookup({:?})", place); match *place { - Place::Local(local) => Ok(self.builder.data.rev_lookup.locals[local]), - Place::Promoted(..) | - Place::Static(..) => { + Place::Base(PlaceBase::Local(local)) => Ok(self.builder.data.rev_lookup.locals[local]), + Place::Base(PlaceBase::Promoted(..)) | + Place::Base(PlaceBase::Static(..)) => { Err(MoveError::cannot_move_out_of(self.loc, Static)) } Place::Projection(ref proj) => { @@ -285,7 +285,7 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> { } StatementKind::StorageLive(_) => {} StatementKind::StorageDead(local) => { - self.gather_move(&Place::Local(local)); + self.gather_move(&Place::Base(PlaceBase::Local(local))); } StatementKind::SetDiscriminant{ .. } => { span_bug!(stmt.source_info.span, @@ -345,7 +345,7 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> { TerminatorKind::Unreachable => { } TerminatorKind::Return => { - self.gather_move(&Place::Local(RETURN_PLACE)); + self.gather_move(&Place::RETURN_PLACE); } TerminatorKind::Assert { ref cond, .. } => { diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index efd979a7da4f..0c29ea8ab4af 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -273,9 +273,9 @@ impl<'tcx> MovePathLookup<'tcx> { // parent. pub fn find(&self, place: &Place<'tcx>) -> LookupResult { match *place { - Place::Local(local) => LookupResult::Exact(self.locals[local]), - Place::Promoted(_) | - Place::Static(..) => LookupResult::Parent(None), + Place::Base(PlaceBase::Local(local)) => LookupResult::Exact(self.locals[local]), + Place::Base(PlaceBase::Promoted(_)) | + Place::Base(PlaceBase::Static(..)) => LookupResult::Parent(None), Place::Projection(ref proj) => { match self.find(&proj.base) { LookupResult::Exact(base_path) => { @@ -347,7 +347,7 @@ impl<'a, 'gcx, 'tcx> MoveData<'tcx> { pub fn base_local(&self, mut mpi: MovePathIndex) -> Option { loop { let path = &self.move_paths[mpi]; - if let Place::Local(l) = path.place { return Some(l); } + if let Place::Base(PlaceBase::Local(l)) = path.place { return Some(l); } if let Some(parent) = path.parent { mpi = parent; continue } else { return None } } } diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 474df457f61a..979595d6c000 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -515,9 +515,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> layout: Option>, ) -> EvalResult<'tcx, OpTy<'tcx, M::PointerTag>> { use rustc::mir::Place::*; + use rustc::mir::PlaceBase; let op = match *mir_place { - Local(mir::RETURN_PLACE) => return err!(ReadFromReturnPointer), - Local(local) => self.access_local(self.frame(), local, layout)?, + Base(PlaceBase::Local(mir::RETURN_PLACE)) => return err!(ReadFromReturnPointer), + Base(PlaceBase::Local(local)) => self.access_local(self.frame(), local, layout)?, Projection(ref proj) => { let op = self.eval_place_to_op(&proj.base, None)?; diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 7b66d11131c1..4df274bc9df9 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -581,8 +581,9 @@ where mir_place: &mir::Place<'tcx> ) -> EvalResult<'tcx, MPlaceTy<'tcx, M::PointerTag>> { use rustc::mir::Place::*; + use rustc::mir::PlaceBase; Ok(match *mir_place { - Promoted(ref promoted) => { + Base(PlaceBase::Promoted(ref promoted)) => { let instance = self.frame().instance; self.const_eval_raw(GlobalId { instance, @@ -590,7 +591,7 @@ where })? } - Static(ref static_) => { + Base(PlaceBase::Static(ref static_)) => { assert!(!static_.ty.needs_subst()); let layout = self.layout_of(static_.ty)?; let instance = ty::Instance::mono(*self.tcx, static_.def_id); @@ -624,8 +625,9 @@ where mir_place: &mir::Place<'tcx> ) -> EvalResult<'tcx, PlaceTy<'tcx, M::PointerTag>> { use rustc::mir::Place::*; + use rustc::mir::PlaceBase; let place = match *mir_place { - Local(mir::RETURN_PLACE) => match self.frame().return_place { + Base(PlaceBase::Local(mir::RETURN_PLACE)) => match self.frame().return_place { Some(return_place) => // We use our layout to verify our assumption; caller will validate // their layout on return. @@ -635,7 +637,7 @@ where }, None => return err!(InvalidNullPointerUsage), }, - Local(local) => PlaceTy { + Base(PlaceBase::Local(local)) => PlaceTy { place: Place::Local { frame: self.cur_frame(), local, diff --git a/src/librustc_mir/interpret/terminator.rs b/src/librustc_mir/interpret/terminator.rs index c2ee3f5715bd..83469d749870 100644 --- a/src/librustc_mir/interpret/terminator.rs +++ b/src/librustc_mir/interpret/terminator.rs @@ -352,7 +352,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> // not advance `caller_iter` for ZSTs. let mut locals_iter = mir.args_iter(); while let Some(local) = locals_iter.next() { - let dest = self.eval_place(&mir::Place::Local(local))?; + let dest = self.eval_place( + &mir::Place::Base(mir::PlaceBase::Local(local)) + )?; if Some(local) == mir.spread_arg { // Must be a tuple for i in 0..dest.layout.fields.count() { @@ -371,7 +373,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } // Don't forget to check the return type! if let Some(caller_ret) = dest { - let callee_ret = self.eval_place(&mir::Place::Local(mir::RETURN_PLACE))?; + let callee_ret = self.eval_place( + &mir::Place::RETURN_PLACE + )?; if !Self::check_argument_compat( rust_abi, caller_ret.layout, diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index ce7c9af81cb0..adc328f1033e 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -221,7 +221,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let Some(..) = ty { // The first argument (index 0), but add 1 for the return value. - let dropee_ptr = Place::Local(Local::new(1+0)); + let dropee_ptr = Place::Base(PlaceBase::Local(Local::new(1+0))); if tcx.sess.opts.debugging_opts.mir_emit_retag { // Function arguments should be retagged, and we make this one raw. mir.basic_blocks_mut()[START_BLOCK].statements.insert(0, Statement { @@ -317,8 +317,8 @@ fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let mut builder = CloneShimBuilder::new(tcx, def_id, self_ty); let is_copy = self_ty.is_copy_modulo_regions(tcx, tcx.param_env(def_id), builder.span); - let dest = Place::Local(RETURN_PLACE); - let src = Place::Local(Local::new(1+0)).deref(); + let dest = Place::RETURN_PLACE; + let src = Place::Base(PlaceBase::Local(Local::new(1+0))).deref(); match self_ty.sty { _ if is_copy => builder.copy_shim(), @@ -424,10 +424,10 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { } fn copy_shim(&mut self) { - let rcvr = Place::Local(Local::new(1+0)).deref(); + let rcvr = Place::Base(PlaceBase::Local(Local::new(1+0))).deref(); let ret_statement = self.make_statement( StatementKind::Assign( - Place::Local(RETURN_PLACE), + Place::RETURN_PLACE, box Rvalue::Use(Operand::Copy(rcvr)) ) ); @@ -436,9 +436,9 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { fn make_place(&mut self, mutability: Mutability, ty: Ty<'tcx>) -> Place<'tcx> { let span = self.span; - Place::Local( + Place::Base(PlaceBase::Local( self.local_decls.push(temp_decl(mutability, ty, span)) - ) + )) } fn make_clone_call( @@ -546,7 +546,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { let inits = vec![ self.make_statement( StatementKind::Assign( - Place::Local(beg), + Place::Base(PlaceBase::Local(beg)), box Rvalue::Use(Operand::Constant(self.make_usize(0))) ) ), @@ -564,7 +564,11 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { // BB #3; // } // BB #4; - self.loop_header(Place::Local(beg), end, BasicBlock::new(2), BasicBlock::new(4), false); + self.loop_header(Place::Base(PlaceBase::Local(beg)), + end, + BasicBlock::new(2), + BasicBlock::new(4), + false); // BB #2 // `dest[i] = Clone::clone(src[beg])`; @@ -580,10 +584,10 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { let statements = vec![ self.make_statement( StatementKind::Assign( - Place::Local(beg), + Place::Base(PlaceBase::Local(beg)), box Rvalue::BinaryOp( BinOp::Add, - Operand::Copy(Place::Local(beg)), + Operand::Copy(Place::Base(PlaceBase::Local(beg))), Operand::Constant(self.make_usize(1)) ) ) @@ -603,7 +607,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { let beg = self.local_decls.push(temp_decl(Mutability::Mut, tcx.types.usize, span)); let init = self.make_statement( StatementKind::Assign( - Place::Local(beg), + Place::Base(PlaceBase::Local(beg)), box Rvalue::Use(Operand::Constant(self.make_usize(0))) ) ); @@ -614,7 +618,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { // BB #8; // } // BB #9; - self.loop_header(Place::Local(beg), Place::Local(end), + self.loop_header(Place::Base(PlaceBase::Local(beg)), Place::Base(PlaceBase::Local(end)), BasicBlock::new(7), BasicBlock::new(9), true); // BB #7 (cleanup) @@ -630,10 +634,10 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { // `goto #6;` let statement = self.make_statement( StatementKind::Assign( - Place::Local(beg), + Place::Base(PlaceBase::Local(beg)), box Rvalue::BinaryOp( BinOp::Add, - Operand::Copy(Place::Local(beg)), + Operand::Copy(Place::Base(PlaceBase::Local(beg))), Operand::Constant(self.make_usize(1)) ) ) @@ -718,7 +722,7 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let source_info = SourceInfo { span, scope: OUTERMOST_SOURCE_SCOPE }; let rcvr_arg = Local::new(1+0); - let rcvr_l = Place::Local(rcvr_arg); + let rcvr_l = Place::Base(PlaceBase::Local(rcvr_arg)); let mut statements = vec![]; let rcvr = match rcvr_adjustment { @@ -748,11 +752,11 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, statements.push(Statement { source_info, kind: StatementKind::Assign( - Place::Local(ref_rcvr), + Place::Base(PlaceBase::Local(ref_rcvr)), box Rvalue::Ref(tcx.types.re_erased, borrow_kind, rcvr_l) ) }); - Operand::Move(Place::Local(ref_rcvr)) + Operand::Move(Place::Base(PlaceBase::Local(ref_rcvr))) } }; @@ -774,12 +778,12 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let Some(untuple_args) = untuple_args { args.extend(untuple_args.iter().enumerate().map(|(i, ity)| { - let arg_place = Place::Local(Local::new(1+1)); + let arg_place = Place::Base(PlaceBase::Local(Local::new(1+1))); Operand::Move(arg_place.field(Field::new(i), *ity)) })); } else { args.extend((1..sig.inputs().len()).map(|i| { - Operand::Move(Place::Local(Local::new(1+i))) + Operand::Move(Place::Base(PlaceBase::Local(Local::new(1+i)))) })); } @@ -797,7 +801,7 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, block(&mut blocks, statements, TerminatorKind::Call { func: callee, args, - destination: Some((Place::Local(RETURN_PLACE), + destination: Some((Place::RETURN_PLACE, BasicBlock::new(1))), cleanup: if let Adjustment::RefMut = rcvr_adjustment { Some(BasicBlock::new(3)) @@ -810,7 +814,7 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let Adjustment::RefMut = rcvr_adjustment { // BB #1 - drop for Self block(&mut blocks, vec![], TerminatorKind::Drop { - location: Place::Local(rcvr_arg), + location: Place::Base(PlaceBase::Local(rcvr_arg)), target: BasicBlock::new(2), unwind: None }, false); @@ -820,7 +824,7 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let Adjustment::RefMut = rcvr_adjustment { // BB #3 - drop if closure panics block(&mut blocks, vec![], TerminatorKind::Drop { - location: Place::Local(rcvr_arg), + location: Place::Base(PlaceBase::Local(rcvr_arg)), target: BasicBlock::new(4), unwind: None }, true); @@ -892,11 +896,11 @@ pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>, statements: vec![Statement { source_info, kind: StatementKind::Assign( - Place::Local(RETURN_PLACE), + Place::RETURN_PLACE, box Rvalue::Aggregate( box AggregateKind::Adt(adt_def, variant_no, substs, None, None), (1..sig.inputs().len()+1).map(|i| { - Operand::Move(Place::Local(Local::new(i))) + Operand::Move(Place::Base(PlaceBase::Local(Local::new(i)))) }).collect() ) ) diff --git a/src/librustc_mir/transform/add_moves_for_packed_drops.rs b/src/librustc_mir/transform/add_moves_for_packed_drops.rs index 4d4c89b8b6a4..e8528eee0bca 100644 --- a/src/librustc_mir/transform/add_moves_for_packed_drops.rs +++ b/src/librustc_mir/transform/add_moves_for_packed_drops.rs @@ -121,10 +121,10 @@ fn add_move_for_packed_drop<'a, 'tcx>( patch.add_statement( loc, StatementKind::StorageLive(temp)); - patch.add_assign(loc, Place::Local(temp), + patch.add_assign(loc, Place::Base(PlaceBase::Local(temp)), Rvalue::Use(Operand::Move(location.clone()))); patch.patch_terminator(loc.block, TerminatorKind::Drop { - location: Place::Local(temp), + location: Place::Base(PlaceBase::Local(temp)), target: storage_dead_block, unwind }); diff --git a/src/librustc_mir/transform/add_retag.rs b/src/librustc_mir/transform/add_retag.rs index e66c11aa36e0..20b75c558679 100644 --- a/src/librustc_mir/transform/add_retag.rs +++ b/src/librustc_mir/transform/add_retag.rs @@ -21,9 +21,9 @@ fn is_stable<'tcx>( match *place { // Locals and statics have stable addresses, for sure - Local { .. } | - Promoted { .. } | - Static { .. } => + Base(PlaceBase::Local { .. }) | + Base(PlaceBase::Promoted { .. }) | + Base(PlaceBase::Static { .. }) => true, // Recurse for projections Projection(ref proj) => { @@ -101,7 +101,7 @@ impl MirPass for AddRetag { }; // Gather all arguments, skip return value. let places = local_decls.iter_enumerated().skip(1).take(arg_count) - .map(|(local, _)| Place::Local(local)) + .map(|(local, _)| Place::Base(PlaceBase::Local(local))) .filter(needs_retag) .collect::>(); // Emit their retags. diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 3ed63d749cd3..ceef15091b5f 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -241,7 +241,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { ); } let old_source_info = self.source_info; - if let &Place::Local(local) = base { + if let &Place::Base(PlaceBase::Local(local)) = base { if self.mir.local_decls[local].internal { // Internal locals are used in the `move_val_init` desugaring. // We want to check unsafety against the source info of the @@ -297,13 +297,13 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { } self.source_info = old_source_info; } - &Place::Local(..) => { + &Place::Base(PlaceBase::Local(..)) => { // locals are safe } - &Place::Promoted(_) => { + &Place::Base(PlaceBase::Promoted(_)) => { bug!("unsafety checking should happen before promotion") } - &Place::Static(box Static { def_id, ty: _ }) => { + &Place::Base(PlaceBase::Static(box Static { def_id, ty: _ })) => { if self.tcx.is_static(def_id) == Some(hir::Mutability::MutMutable) { self.require_unsafe("use of mutable static", "mutable statics can be mutated by multiple threads: aliasing violations \ diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 5ed0055e7c4f..25dee3ec9556 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -3,7 +3,7 @@ use rustc::hir::def::Def; -use rustc::mir::{Constant, Location, Place, Mir, Operand, Rvalue, Local}; +use rustc::mir::{Constant, Location, Place, PlaceBase, Mir, Operand, Rvalue, Local}; use rustc::mir::{NullOp, UnOp, StatementKind, Statement, BasicBlock, LocalKind}; use rustc::mir::{TerminatorKind, ClearCrossCrate, SourceInfo, BinOp, ProjectionElem}; use rustc::mir::visit::{Visitor, PlaceContext, MutatingUseContext, NonMutatingUseContext}; @@ -267,7 +267,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { fn eval_place(&mut self, place: &Place<'tcx>, source_info: SourceInfo) -> Option> { match *place { - Place::Local(loc) => self.places[loc].clone(), + Place::Base(PlaceBase::Local(loc)) => self.places[loc].clone(), Place::Projection(ref proj) => match proj.elem { ProjectionElem::Field(field, _) => { trace!("field proj on {:?}", proj.base); @@ -282,7 +282,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { // an `Index` projection would throw us off-track. _ => None, }, - Place::Promoted(ref promoted) => { + Place::Base(PlaceBase::Promoted(ref promoted)) => { let generics = self.tcx.generics_of(self.source.def_id()); if generics.requires_monomorphization(self.tcx) { // FIXME: can't handle code with generics @@ -556,7 +556,7 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { .to_ty(self.tcx); if let Ok(place_layout) = self.tcx.layout_of(self.param_env.and(place_ty)) { if let Some(value) = self.const_prop(rval, place_layout, statement.source_info) { - if let Place::Local(local) = *place { + if let Place::Base(PlaceBase::Local(local)) = *place { trace!("checking whether {:?} can be stored to {:?}", value, local); if self.can_const_prop[local] { trace!("storing {:?} to {:?}", value, local); @@ -591,7 +591,7 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { while let Place::Projection(ref proj) = *place { place = &proj.base; } - if let Place::Local(local) = *place { + if let Place::Base(PlaceBase::Local(local)) = *place { self.places[local] = None; } }, diff --git a/src/librustc_mir/transform/copy_prop.rs b/src/librustc_mir/transform/copy_prop.rs index 7d907ca3a215..817a2f31c073 100644 --- a/src/librustc_mir/transform/copy_prop.rs +++ b/src/librustc_mir/transform/copy_prop.rs @@ -19,7 +19,9 @@ //! (non-mutating) use of `SRC`. These restrictions are conservative and may be relaxed in the //! future. -use rustc::mir::{Constant, Local, LocalKind, Location, Place, Mir, Operand, Rvalue, StatementKind}; +use rustc::mir::{ + Constant, Local, LocalKind, Location, Place, PlaceBase, Mir, Operand, Rvalue, StatementKind +}; use rustc::mir::visit::MutVisitor; use rustc::ty::TyCtxt; use crate::transform::{MirPass, MirSource}; @@ -94,8 +96,10 @@ impl MirPass for CopyPropagation { // That use of the source must be an assignment. match statement.kind { - StatementKind::Assign(Place::Local(local), box Rvalue::Use(ref operand)) if - local == dest_local => { + StatementKind::Assign( + Place::Base(PlaceBase::Local(local)), + box Rvalue::Use(ref operand) + ) if local == dest_local => { let maybe_action = match *operand { Operand::Copy(ref src_place) | Operand::Move(ref src_place) => { @@ -144,12 +148,12 @@ fn eliminate_self_assignments<'tcx>( if let Some(stmt) = mir[location.block].statements.get(location.statement_index) { match stmt.kind { StatementKind::Assign( - Place::Local(local), - box Rvalue::Use(Operand::Copy(Place::Local(src_local))), + Place::Base(PlaceBase::Local(local)), + box Rvalue::Use(Operand::Copy(Place::Base(PlaceBase::Local(src_local)))), ) | StatementKind::Assign( - Place::Local(local), - box Rvalue::Use(Operand::Move(Place::Local(src_local))), + Place::Base(PlaceBase::Local(local)), + box Rvalue::Use(Operand::Move(Place::Base(PlaceBase::Local(src_local)))), ) if local == dest_local && dest_local == src_local => {} _ => { continue; @@ -176,7 +180,7 @@ impl<'tcx> Action<'tcx> { fn local_copy(mir: &Mir<'tcx>, def_use_analysis: &DefUseAnalysis<'_>, src_place: &Place<'tcx>) -> Option> { // The source must be a local. - let src_local = if let Place::Local(local) = *src_place { + let src_local = if let Place::Base(PlaceBase::Local(local)) = *src_place { local } else { debug!(" Can't copy-propagate local: source is not a local"); @@ -330,8 +334,8 @@ impl<'tcx> MutVisitor<'tcx> for ConstantPropagationVisitor<'tcx> { self.super_operand(operand, location); match *operand { - Operand::Copy(Place::Local(local)) | - Operand::Move(Place::Local(local)) if local == self.dest_local => {} + Operand::Copy(Place::Base(PlaceBase::Local(local))) | + Operand::Move(Place::Base(PlaceBase::Local(local))) if local == self.dest_local => {} _ => return, } diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 0f8db5f7334b..74175d0149ff 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -330,7 +330,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { } fn drop_flag(&mut self, index: MovePathIndex) -> Option> { - self.drop_flags.get(&index).map(|t| Place::Local(*t)) + self.drop_flags.get(&index).map(|t| Place::Base(PlaceBase::Local(*t))) } /// create a patch that elaborates all drops in the input @@ -543,7 +543,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { if let Some(&flag) = self.drop_flags.get(&path) { let span = self.patch.source_info_for_location(self.mir, loc).span; let val = self.constant_bool(span, val.value()); - self.patch.add_assign(loc, Place::Local(flag), val); + self.patch.add_assign(loc, Place::Base(PlaceBase::Local(flag)), val); } } @@ -552,7 +552,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { let span = self.patch.source_info_for_location(self.mir, loc).span; let false_ = self.constant_bool(span, false); for flag in self.drop_flags.values() { - self.patch.add_assign(loc, Place::Local(*flag), false_.clone()); + self.patch.add_assign(loc, Place::Base(PlaceBase::Local(*flag)), false_.clone()); } } diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 09142828f18a..c455d38cebce 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -102,7 +102,7 @@ impl<'tcx> MutVisitor<'tcx> for DerefArgVisitor { place: &mut Place<'tcx>, context: PlaceContext<'tcx>, location: Location) { - if *place == Place::Local(self_arg()) { + if *place == Place::Base(PlaceBase::Local(self_arg())) { *place = Place::Projection(Box::new(Projection { base: place.clone(), elem: ProjectionElem::Deref, @@ -129,7 +129,7 @@ impl<'tcx> MutVisitor<'tcx> for PinArgVisitor<'tcx> { place: &mut Place<'tcx>, context: PlaceContext<'tcx>, location: Location) { - if *place == Place::Local(self_arg()) { + if *place == Place::Base(PlaceBase::Local(self_arg())) { *place = Place::Projection(Box::new(Projection { base: place.clone(), elem: ProjectionElem::Field(Field::new(0), self.ref_gen_ty), @@ -183,7 +183,7 @@ impl<'a, 'tcx> TransformVisitor<'a, 'tcx> { // Create a Place referencing a generator struct field fn make_field(&self, idx: usize, ty: Ty<'tcx>) -> Place<'tcx> { - let base = Place::Local(self_arg()); + let base = Place::Base(PlaceBase::Local(self_arg())); let field = Projection { base: base, elem: ProjectionElem::Field(Field::new(idx), ty), @@ -223,7 +223,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for TransformVisitor<'a, 'tcx> { place: &mut Place<'tcx>, context: PlaceContext<'tcx>, location: Location) { - if let Place::Local(l) = *place { + if let Place::Base(PlaceBase::Local(l)) = *place { // Replace an Local in the remap with a generator struct access if let Some(&(ty, idx)) = self.remap.get(&l) { *place = self.make_field(idx, ty); @@ -249,7 +249,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for TransformVisitor<'a, 'tcx> { let ret_val = match data.terminator().kind { TerminatorKind::Return => Some((VariantIdx::new(1), None, - Operand::Move(Place::Local(self.new_ret_local)), + Operand::Move(Place::Base(PlaceBase::Local(self.new_ret_local))), None)), TerminatorKind::Yield { ref value, resume, drop } => Some((VariantIdx::new(0), Some(resume), @@ -263,7 +263,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for TransformVisitor<'a, 'tcx> { // We must assign the value first in case it gets declared dead below data.statements.push(Statement { source_info, - kind: StatementKind::Assign(Place::Local(RETURN_PLACE), + kind: StatementKind::Assign(Place::RETURN_PLACE, box self.make_state(state_idx, v)), }); let state = if let Some(resume) = resume { // Yield @@ -597,7 +597,7 @@ fn elaborate_generator_drops<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, &Terminator { source_info, kind: TerminatorKind::Drop { - location: Place::Local(local), + location: Place::Base(PlaceBase::Local(local)), target, unwind } @@ -619,7 +619,7 @@ fn elaborate_generator_drops<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, elaborate_drop( &mut elaborator, source_info, - &Place::Local(gen), + &Place::Base(PlaceBase::Local(gen)), (), target, unwind, @@ -693,7 +693,7 @@ fn create_generator_drop_shim<'a, 'tcx>( // Alias tracking must know we changed the type mir.basic_blocks_mut()[START_BLOCK].statements.insert(0, Statement { source_info, - kind: StatementKind::Retag(RetagKind::Raw, Place::Local(self_arg())), + kind: StatementKind::Retag(RetagKind::Raw, Place::Base(PlaceBase::Local(self_arg()))), }) } @@ -809,7 +809,7 @@ fn insert_clean_drop<'a, 'tcx>(mir: &mut Mir<'tcx>) -> BasicBlock { // Create a block to destroy an unresumed generators. This can only destroy upvars. let drop_clean = BasicBlock::new(mir.basic_blocks().len()); let term = TerminatorKind::Drop { - location: Place::Local(self_arg()), + location: Place::Base(PlaceBase::Local(self_arg())), target: return_block, unwind: None, }; diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 56e4926090ea..4cdef015b53f 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -449,7 +449,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { } // Static variables need a borrow because the callee // might modify the same static. - Place::Static(_) => true, + Place::Base(PlaceBase::Static(_)) => true, _ => false } } @@ -466,7 +466,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { let temp = LocalDecl::new_temp(ty, callsite.location.span); let tmp = caller_mir.local_decls.push(temp); - let tmp = Place::Local(tmp); + let tmp = Place::Base(PlaceBase::Local(tmp)); let stmt = Statement { source_info: callsite.location, @@ -560,7 +560,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { let tuple = self.create_temp_if_necessary(args.next().unwrap(), callsite, caller_mir); assert!(args.next().is_none()); - let tuple = Place::Local(tuple); + let tuple = Place::Base(PlaceBase::Local(tuple)); let tuple_tys = if let ty::Tuple(s) = tuple.ty(caller_mir, tcx).to_ty(tcx).sty { s } else { @@ -599,7 +599,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { // FIXME: Analysis of the usage of the arguments to avoid // unnecessary temporaries. - if let Operand::Move(Place::Local(local)) = arg { + if let Operand::Move(Place::Base(PlaceBase::Local(local))) = arg { if caller_mir.local_kind(local) == LocalKind::Temp { // Reuse the operand if it's a temporary already return local; @@ -617,7 +617,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { let stmt = Statement { source_info: callsite.location, - kind: StatementKind::Assign(Place::Local(arg_tmp), box arg), + kind: StatementKind::Assign(Place::Base(PlaceBase::Local(arg_tmp)), box arg), }; caller_mir[callsite.bb].statements.push(stmt); arg_tmp @@ -665,7 +665,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> { _location: Location) { if *local == RETURN_PLACE { match self.destination { - Place::Local(l) => { + Place::Base(PlaceBase::Local(l)) => { *local = l; return; }, @@ -686,11 +686,11 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> { _location: Location) { match place { - Place::Local(RETURN_PLACE) => { + Place::Base(PlaceBase::Local(RETURN_PLACE)) => { // Return pointer; update the place itself *place = self.destination.clone(); }, - Place::Promoted(ref mut promoted) => { + Place::Base(PlaceBase::Promoted(ref mut promoted)) => { if let Some(p) = self.promoted_map.get(promoted.0).cloned() { promoted.0 = p; } diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index 290915763e27..e0e64fd1f9b5 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -1,6 +1,6 @@ //! Performs various peephole optimizations. -use rustc::mir::{Constant, Location, Place, Mir, Operand, ProjectionElem, Rvalue, Local}; +use rustc::mir::{Constant, Location, Place, PlaceBase, Mir, Operand, ProjectionElem, Rvalue, Local}; use rustc::mir::visit::{MutVisitor, Visitor}; use rustc::ty::{TyCtxt, TyKind}; use rustc::util::nodemap::{FxHashMap, FxHashSet}; @@ -45,7 +45,7 @@ impl<'tcx> MutVisitor<'tcx> for InstCombineVisitor<'tcx> { let new_place = match *rvalue { Rvalue::Ref(_, _, Place::Projection(ref mut projection)) => { // Replace with dummy - mem::replace(&mut projection.base, Place::Local(Local::new(0))) + mem::replace(&mut projection.base, Place::Base(PlaceBase::Local(Local::new(0)))) } _ => bug!("Detected `&*` but didn't find `&*`!"), }; diff --git a/src/librustc_mir/transform/lower_128bit.rs b/src/librustc_mir/transform/lower_128bit.rs index 3d1f55e530e6..ad108587247f 100644 --- a/src/librustc_mir/transform/lower_128bit.rs +++ b/src/librustc_mir/transform/lower_128bit.rs @@ -86,13 +86,13 @@ impl Lower128Bit { block.statements.push(Statement { source_info: source_info, kind: StatementKind::Assign( - Place::Local(local), + Place::Base(PlaceBase::Local(local)), box Rvalue::Cast( CastKind::Misc, rhs, rhs_override_ty.unwrap())), }); - rhs = Operand::Move(Place::Local(local)); + rhs = Operand::Move(Place::Base(PlaceBase::Local(local))); } let call_did = check_lang_item_type( diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index a6726718e2d2..831d8b46a65c 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -178,7 +178,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { span, scope: OUTERMOST_SOURCE_SCOPE }, - kind: StatementKind::Assign(Place::Local(dest), box rvalue) + kind: StatementKind::Assign(Place::Base(PlaceBase::Local(dest)), box rvalue) }); } @@ -268,7 +268,9 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { func, args, cleanup: None, - destination: Some((Place::Local(new_temp), new_target)), + destination: Some( + (Place::Base(PlaceBase::Local(new_temp)), new_target) + ), from_hir_call, }, ..terminator @@ -292,7 +294,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { promoted.span = span; promoted.local_decls[RETURN_PLACE] = LocalDecl::new_return_place(ty, span); - Place::Promoted(box (promoted_id, ty)) + Place::Base(PlaceBase::Promoted(box (promoted_id, ty))) }; let (blocks, local_decls) = self.source.basic_blocks_and_local_decls_mut(); match candidate { @@ -373,7 +375,7 @@ pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>, match candidate { Candidate::Ref(Location { block, statement_index }) => { match mir[block].statements[statement_index].kind { - StatementKind::Assign(Place::Local(local), _) => { + StatementKind::Assign(Place::Base(PlaceBase::Local(local)), _) => { if temps[local] == TempState::PromotedOut { // Already promoted. continue; @@ -420,7 +422,7 @@ pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>, for block in mir.basic_blocks_mut() { block.statements.retain(|statement| { match statement.kind { - StatementKind::Assign(Place::Local(index), _) | + StatementKind::Assign(Place::Base(PlaceBase::Local(index)), _) | StatementKind::StorageLive(index) | StatementKind::StorageDead(index) => { !promoted(index) @@ -430,7 +432,7 @@ pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>, }); let terminator = block.terminator_mut(); match terminator.kind { - TerminatorKind::Drop { location: Place::Local(index), target, .. } => { + TerminatorKind::Drop { location: Place::Base(PlaceBase::Local(index)), target, .. } => { if promoted(index) { terminator.kind = TerminatorKind::Goto { target, diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 285c674643f2..d41098e2881a 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -186,9 +186,9 @@ trait Qualif { fn in_place(cx: &ConstCx<'_, 'tcx>, place: &Place<'tcx>) -> bool { match *place { - Place::Local(local) => Self::in_local(cx, local), - Place::Promoted(_) => bug!("qualifying already promoted MIR"), - Place::Static(ref static_) => Self::in_static(cx, static_), + Place::Base(PlaceBase::Local(local)) => Self::in_local(cx, local), + Place::Base(PlaceBase::Promoted(_)) => bug!("qualifying already promoted MIR"), + Place::Base(PlaceBase::Static(ref static_)) => Self::in_static(cx, static_), Place::Projection(ref proj) => Self::in_projection(cx, proj), } } @@ -730,7 +730,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { place = &proj.base; } debug!("qualify_consts: promotion candidate: place={:?}", place); - if let Place::Local(local) = *place { + if let Place::Base(PlaceBase::Local(local)) = *place { if self.mir.local_kind(local) == LocalKind::Temp { debug!("qualify_consts: promotion candidate: local={:?}", local); // The borrowed place doesn't have `HasMutInterior` @@ -754,7 +754,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { let index = loop { match dest { // We treat all locals equal in constants - Place::Local(index) => break *index, + Place::Base(PlaceBase::Local(index)) => break *index, // projections are transparent for assignments // we qualify the entire destination at once, even if just a field would have // stricter qualification @@ -768,8 +768,9 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { ); dest = &proj.base; }, - Place::Promoted(..) => bug!("promoteds don't exist yet during promotion"), - Place::Static(..) => { + Place::Base(PlaceBase::Promoted(..)) => + bug!("promoteds don't exist yet during promotion"), + Place::Base(PlaceBase::Static(..)) => { // Catch more errors in the destination. `visit_place` also checks that we // do not try to access statics from constants or try to mutate statics self.visit_place( @@ -878,7 +879,10 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { match *candidate { Candidate::Ref(Location { block: bb, statement_index: stmt_idx }) => { match self.mir[bb].statements[stmt_idx].kind { - StatementKind::Assign(_, box Rvalue::Ref(_, _, Place::Local(index))) => { + StatementKind::Assign( + _, + box Rvalue::Ref(_, _, Place::Base(PlaceBase::Local(index))) + ) => { promoted_temps.insert(index); } _ => {} @@ -915,9 +919,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { debug!("visit_place: place={:?} context={:?} location={:?}", place, context, location); self.super_place(place, context, location); match *place { - Place::Local(_) | - Place::Promoted(_) => {} - Place::Static(ref global) => { + Place::Base(PlaceBase::Local(_)) | + Place::Base(PlaceBase::Promoted(_)) => {} + Place::Base(PlaceBase::Static(ref global)) => { if self.tcx .get_attrs(global.def_id) .iter() @@ -1032,7 +1036,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { match *operand { Operand::Move(ref place) => { // Mark the consumed locals to indicate later drops are noops. - if let Place::Local(local) = *place { + if let Place::Base(PlaceBase::Local(local)) = *place { self.cx.per_local[NeedsDrop].remove(local); } } @@ -1335,7 +1339,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { unleash_miri!(self); // HACK(eddyb): emulate a bit of dataflow analysis, // conservatively, that drop elaboration will do. - let needs_drop = if let Place::Local(local) = *place { + let needs_drop = if let Place::Base(PlaceBase::Local(local)) = *place { if NeedsDrop::in_local(self, local) { Some(self.mir.local_decls[local].source_info.span) } else { @@ -1565,7 +1569,11 @@ impl MirPass for QualifyAndPromoteConstants { }); let terminator = block.terminator_mut(); match terminator.kind { - TerminatorKind::Drop { location: Place::Local(index), target, .. } => { + TerminatorKind::Drop { + location: Place::Base(PlaceBase::Local(index)), + target, + .. + } => { if promoted_temps.contains(index) { terminator.kind = TerminatorKind::Goto { target, diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 34f850fc4aad..6c44fac10f59 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -252,10 +252,11 @@ fn check_place( span: Span, ) -> McfResult { match place { - Place::Local(_) => Ok(()), + Place::Base(PlaceBase::Local(_)) => Ok(()), // promoteds are always fine, they are essentially constants - Place::Promoted(_) => Ok(()), - Place::Static(_) => Err((span, "cannot access `static` items in const fn".into())), + Place::Base(PlaceBase::Promoted(_)) => Ok(()), + Place::Base(PlaceBase::Static(_)) => + Err((span, "cannot access `static` items in const fn".into())), Place::Projection(proj) => { match proj.elem { | ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. } diff --git a/src/librustc_mir/transform/remove_noop_landing_pads.rs b/src/librustc_mir/transform/remove_noop_landing_pads.rs index 0ad33bff9d6c..b7493b25d465 100644 --- a/src/librustc_mir/transform/remove_noop_landing_pads.rs +++ b/src/librustc_mir/transform/remove_noop_landing_pads.rs @@ -47,7 +47,7 @@ impl RemoveNoopLandingPads { // These are all nops in a landing pad } - StatementKind::Assign(Place::Local(_), box Rvalue::Use(_)) => { + StatementKind::Assign(Place::Base(PlaceBase::Local(_)), box Rvalue::Use(_)) => { // Writing to a local (e.g., a drop flag) does not // turn a landing pad to a non-nop } diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index 40e02e712c15..a44ec526f9dd 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -115,8 +115,8 @@ fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }; assert!(args.len() == 1); let peek_arg_place = match args[0] { - mir::Operand::Copy(ref place @ mir::Place::Local(_)) | - mir::Operand::Move(ref place @ mir::Place::Local(_)) => Some(place), + mir::Operand::Copy(ref place @ mir::Place::Base(mir::PlaceBase::Local(_))) | + mir::Operand::Move(ref place @ mir::Place::Base(mir::PlaceBase::Local(_))) => Some(place), _ => None, }; diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index fd8d68a48226..b1d898bb5b02 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -101,7 +101,7 @@ impl<'a, 'tcx> UniformArrayMoveOutVisitor<'a, 'tcx> { let temp = self.patch.new_temp(item_ty, self.mir.source_info(location).span); self.patch.add_statement(location, StatementKind::StorageLive(temp)); self.patch.add_assign(location, - Place::Local(temp), + Place::Base(PlaceBase::Local(temp)), Rvalue::Use( Operand::Move( Place::Projection(box PlaceProjection{ @@ -113,12 +113,16 @@ impl<'a, 'tcx> UniformArrayMoveOutVisitor<'a, 'tcx> { })))); temp }).collect(); - self.patch.add_assign(location, - dst_place.clone(), - Rvalue::Aggregate(box AggregateKind::Array(item_ty), - temps.iter().map( - |x| Operand::Move(Place::Local(*x))).collect() - )); + self.patch.add_assign( + location, + dst_place.clone(), + Rvalue::Aggregate( + box AggregateKind::Array(item_ty), + temps.iter().map( + |x| Operand::Move(Place::Base(PlaceBase::Local(*x))) + ).collect() + ) + ); for temp in temps { self.patch.add_statement(location, StatementKind::StorageDead(temp)); } @@ -176,7 +180,7 @@ impl MirPass for RestoreSubsliceArrayMoveOut { if let StatementKind::Assign(ref dst_place, ref rval) = statement.kind { if let Rvalue::Aggregate(box AggregateKind::Array(_), ref items) = **rval { let items : Vec<_> = items.iter().map(|item| { - if let Operand::Move(Place::Local(local)) = item { + if let Operand::Move(Place::Base(PlaceBase::Local(local))) = item { let local_use = &visitor.locals_use[*local]; let opt_index_and_place = Self::try_get_item_source(local_use, mir); // each local should be used twice: @@ -257,7 +261,7 @@ impl RestoreSubsliceArrayMoveOut { if block.statements.len() > location.statement_index { let statement = &block.statements[location.statement_index]; if let StatementKind::Assign( - Place::Local(_), + Place::Base(PlaceBase::Local(_)), box Rvalue::Use(Operand::Move(Place::Projection(box PlaceProjection{ ref base, elem: ProjectionElem::ConstantIndex{ offset, min_length: _, from_end: false}})))) = statement.kind { diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index cf3ba1765406..26fa8d6d1f0b 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -486,7 +486,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> // discriminant after it is free-ed, because that // way lies only trouble. let discr_ty = adt.repr.discr_type().to_ty(self.tcx()); - let discr = Place::Local(self.new_temp(discr_ty)); + let discr = Place::Base(PlaceBase::Local(self.new_temp(discr_ty))); let discr_rv = Rvalue::Discriminant(self.place.clone()); let switch_block = BasicBlockData { statements: vec![self.assign(&discr, discr_rv)], @@ -520,11 +520,11 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> mutbl: hir::Mutability::MutMutable }); let ref_place = self.new_temp(ref_ty); - let unit_temp = Place::Local(self.new_temp(tcx.mk_unit())); + let unit_temp = Place::Base(PlaceBase::Local(self.new_temp(tcx.mk_unit()))); let result = BasicBlockData { statements: vec![self.assign( - &Place::Local(ref_place), + &Place::Base(PlaceBase::Local(ref_place)), Rvalue::Ref(tcx.types.re_erased, BorrowKind::Mut { allow_two_phase_borrow: false }, self.place.clone()) @@ -533,7 +533,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> kind: TerminatorKind::Call { func: Operand::function_handle(tcx, drop_fn.def_id, substs, self.source_info.span), - args: vec![Operand::Move(Place::Local(ref_place))], + args: vec![Operand::Move(Place::Base(PlaceBase::Local(ref_place)))], destination: Some((unit_temp, succ)), cleanup: unwind.into_option(), from_hir_call: true, @@ -578,8 +578,8 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> ty: ety, mutbl: hir::Mutability::MutMutable }); - let ptr = &Place::Local(self.new_temp(ref_ty)); - let can_go = &Place::Local(self.new_temp(tcx.types.bool)); + let ptr = &Place::Base(PlaceBase::Local(self.new_temp(ref_ty))); + let can_go = &Place::Base(PlaceBase::Local(self.new_temp(tcx.types.bool))); let one = self.constant_usize(1); let (ptr_next, cur_next) = if ptr_based { @@ -587,23 +587,23 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> tcx.types.re_erased, BorrowKind::Mut { allow_two_phase_borrow: false }, Place::Projection(Box::new(Projection { - base: Place::Local(cur), + base: Place::Base(PlaceBase::Local(cur)), elem: ProjectionElem::Deref, })) ), - Rvalue::BinaryOp(BinOp::Offset, copy(&Place::Local(cur)), one)) + Rvalue::BinaryOp(BinOp::Offset, copy(&Place::Base(PlaceBase::Local(cur))), one)) } else { (Rvalue::Ref( tcx.types.re_erased, BorrowKind::Mut { allow_two_phase_borrow: false }, self.place.clone().index(cur)), - Rvalue::BinaryOp(BinOp::Add, copy(&Place::Local(cur)), one)) + Rvalue::BinaryOp(BinOp::Add, copy(&Place::Base(PlaceBase::Local(cur))), one)) }; let drop_block = BasicBlockData { statements: vec![ self.assign(ptr, ptr_next), - self.assign(&Place::Local(cur), cur_next) + self.assign(&Place::Base(PlaceBase::Local(cur)), cur_next) ], is_cleanup: unwind.is_cleanup(), terminator: Some(Terminator { @@ -617,7 +617,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> let loop_block = BasicBlockData { statements: vec![ self.assign(can_go, Rvalue::BinaryOp(BinOp::Eq, - copy(&Place::Local(cur)), + copy(&Place::Base(PlaceBase::Local(cur))), copy(length_or_end))) ], is_cleanup: unwind.is_cleanup(), @@ -667,8 +667,8 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> let move_ = |place: &Place<'tcx>| Operand::Move(place.clone()); let tcx = self.tcx(); - let size = &Place::Local(self.new_temp(tcx.types.usize)); - let size_is_zero = &Place::Local(self.new_temp(tcx.types.bool)); + let size = &Place::Base(PlaceBase::Local(self.new_temp(tcx.types.usize))); + let size_is_zero = &Place::Base(PlaceBase::Local(self.new_temp(tcx.types.bool))); let base_block = BasicBlockData { statements: vec![ self.assign(size, Rvalue::NullaryOp(NullOp::SizeOf, ety)), @@ -703,9 +703,12 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> }; let cur = self.new_temp(iter_ty); - let length = Place::Local(self.new_temp(tcx.types.usize)); + let length = Place::Base(PlaceBase::Local(self.new_temp(tcx.types.usize))); let length_or_end = if ptr_based { - Place::Local(self.new_temp(iter_ty)) + // FIXME check if we want to make it return a `Place` directly + // if all use sites want a `Place::Base` anyway. + let temp = self.new_temp(iter_ty); + Place::Base(PlaceBase::Local(temp)) } else { length.clone() }; @@ -728,13 +731,13 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> unwind, ptr_based); - let cur = Place::Local(cur); + let cur = Place::Base(PlaceBase::Local(cur)); let zero = self.constant_usize(0); let mut drop_block_stmts = vec![]; drop_block_stmts.push(self.assign(&length, Rvalue::Len(self.place.clone()))); if ptr_based { let tmp_ty = tcx.mk_mut_ptr(self.place_ty(self.place)); - let tmp = Place::Local(self.new_temp(tmp_ty)); + let tmp = Place::Base(PlaceBase::Local(self.new_temp(tmp_ty))); // tmp = &mut P; // cur = tmp as *mut T; // end = Offset(cur, len); @@ -883,7 +886,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> unwind: Unwind ) -> BasicBlock { let tcx = self.tcx(); - let unit_temp = Place::Local(self.new_temp(tcx.mk_unit())); + let unit_temp = Place::Base(PlaceBase::Local(self.new_temp(tcx.mk_unit()))); let free_func = tcx.require_lang_item(lang_items::BoxFreeFnLangItem); let args = adt.variants[VariantIdx::new(0)].fields.iter().enumerate().map(|(i, f)| { let field = Field::new(i); diff --git a/src/librustc_mir/util/graphviz.rs b/src/librustc_mir/util/graphviz.rs index e93b96c12161..5d495fc04588 100644 --- a/src/librustc_mir/util/graphviz.rs +++ b/src/librustc_mir/util/graphviz.rs @@ -134,7 +134,11 @@ fn write_graph_label<'a, 'gcx, 'tcx, W: Write>(tcx: TyCtxt<'a, 'gcx, 'tcx>, if i > 0 { write!(w, ", ")?; } - write!(w, "{:?}: {}", Place::Local(arg), escape(&mir.local_decls[arg].ty))?; + write!(w, + "{:?}: {}", + Place::Base(PlaceBase::Local(arg)), + escape(&mir.local_decls[arg].ty) + )?; } write!(w, ") -> {}", escape(mir.return_ty()))?; @@ -150,10 +154,10 @@ fn write_graph_label<'a, 'gcx, 'tcx, W: Write>(tcx: TyCtxt<'a, 'gcx, 'tcx>, if let Some(name) = decl.name { write!(w, r#"{:?}: {}; // {}
"#, - Place::Local(local), escape(&decl.ty), name)?; + Place::Base(PlaceBase::Local(local)), escape(&decl.ty), name)?; } else { write!(w, r#"let mut {:?}: {};
"#, - Place::Local(local), escape(&decl.ty))?; + Place::Base(PlaceBase::Local(local)), escape(&decl.ty))?; } } diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs index 8177de50776d..c3fbee3a2a6e 100644 --- a/src/librustc_mir/util/pretty.rs +++ b/src/librustc_mir/util/pretty.rs @@ -625,7 +625,7 @@ fn write_mir_sig( if i != 0 { write!(w, ", ")?; } - write!(w, "{:?}: {}", Place::Local(arg), mir.local_decls[arg].ty)?; + write!(w, "{:?}: {}", Place::Base(PlaceBase::Local(arg)), mir.local_decls[arg].ty)?; } write!(w, ") -> {}", mir.return_ty())?; From 3391f6ce8083ea860009caa99b415b402feeddd1 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 1 Mar 2019 10:14:09 +0100 Subject: [PATCH 138/381] tidy: deny(rust_2018_idioms) --- src/tools/tidy/src/deps.rs | 12 ++++++------ src/tools/tidy/src/features.rs | 2 +- src/tools/tidy/src/lib.rs | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 94dd5478e529..0169725fa296 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -49,13 +49,13 @@ const EXCEPTIONS: &[&str] = &[ ]; /// Which crates to check against the whitelist? -const WHITELIST_CRATES: &[CrateVersion] = &[ +const WHITELIST_CRATES: &[CrateVersion<'_>] = &[ CrateVersion("rustc", "0.0.0"), CrateVersion("rustc_codegen_llvm", "0.0.0"), ]; /// Whitelist of crates rustc is allowed to depend on. Avoid adding to the list if possible. -const WHITELIST: &[Crate] = &[ +const WHITELIST: &[Crate<'_>] = &[ Crate("adler32"), Crate("aho-corasick"), Crate("arrayvec"), @@ -183,7 +183,7 @@ struct Crate<'a>(&'a str); // (name) #[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Debug, Hash)] struct CrateVersion<'a>(&'a str, &'a str); // (name, version) -impl<'a> Crate<'a> { +impl Crate<'_> { pub fn id_str(&self) -> String { format!("{} ", self.0) } @@ -330,10 +330,10 @@ fn get_deps(path: &Path, cargo: &Path) -> Resolve { /// Checks the dependencies of the given crate from the given cargo metadata to see if they are on /// the whitelist. Returns a list of illegal dependencies. -fn check_crate_whitelist<'a, 'b>( - whitelist: &'a HashSet, +fn check_crate_whitelist<'a>( + whitelist: &'a HashSet>, resolve: &'a Resolve, - visited: &'b mut BTreeSet>, + visited: &mut BTreeSet>, krate: CrateVersion<'a>, must_be_on_whitelist: bool, ) -> BTreeSet> { diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 7126c0c2f6ec..1eab217027c8 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -22,7 +22,7 @@ pub enum Status { } impl fmt::Display for Status { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let as_str = match *self { Status::Stable => "stable", Status::Unstable => "unstable", diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index 022c53f909c7..c4a1246ffdf5 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -3,7 +3,8 @@ //! This library contains the tidy lints and exposes it //! to be used by tools. -extern crate serde; +#![deny(rust_2018_idioms)] + extern crate serde_json; #[macro_use] extern crate serde_derive; From 204f087daf6570824832eec56b24d9cd8cbf4a70 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Fri, 1 Mar 2019 10:18:50 +0100 Subject: [PATCH 139/381] librustc_interface: Update scoped-tls to 1.0 Done previously as a part of https://github.com/rust-lang/rust/pull/58748 --- Cargo.lock | 2 +- src/librustc_interface/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 381322bc421d..2e4fbf02a0e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2774,7 +2774,7 @@ dependencies = [ "rustc_resolve 0.0.0", "rustc_traits 0.0.0", "rustc_typeck 0.0.0", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", diff --git a/src/librustc_interface/Cargo.toml b/src/librustc_interface/Cargo.toml index 1acd3dfc7656..294e23dc6177 100644 --- a/src/librustc_interface/Cargo.toml +++ b/src/librustc_interface/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["dylib"] log = "0.4" rustc-rayon = "0.1.1" smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } -scoped-tls = { version = "0.1.1", features = ["nightly"] } +scoped-tls = "1.0" syntax = { path = "../libsyntax" } syntax_ext = { path = "../libsyntax_ext" } syntax_pos = { path = "../libsyntax_pos" } From 805145f2f96545600f7fec0a9a7b9edfb7bd9c38 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 1 Mar 2019 10:41:25 +0100 Subject: [PATCH 140/381] Revert "Auto merge of #58597 - pietroalbini:appveyor-gce, r=alexcrichton" This reverts commit fd42f24b0129b32d66f174510518c083cdcec3eb, reversing changes made to 0e25a6829c66302dc06c351bb494774e3d075f77. --- appveyor.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 3a0cb8b4fcee..d70ad54b1c81 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,11 +5,6 @@ environment: # server goes down presumably. See #43333 for more info CARGO_HTTP_CHECK_REVOKE: false - # Execute the builds on GCE instead of Hyper-V. Those builders have a 3-4 - # minute startup overhead, but AppVeyor support recommended this as a - # possible solution for #58160 (spurious 259 exit codes) - appveyor_build_worker_cloud: gce - matrix: # 32/64 bit MSVC tests - MSYS_BITS: 64 From 260b0917b074b00960672a5308edee5c023e44f4 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 1 Mar 2019 11:15:22 +0100 Subject: [PATCH 141/381] tools/rustbook: deny(rust_2018_idioms) --- src/tools/rustbook/src/main.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs index 5a6246347cc0..cfc1bc6d414e 100644 --- a/src/tools/rustbook/src/main.rs +++ b/src/tools/rustbook/src/main.rs @@ -1,4 +1,5 @@ -// +#![deny(rust_2018_idioms)] + use clap::{crate_version}; use std::env; @@ -68,7 +69,7 @@ fn main() { } // Build command implementation -pub fn build_1(args: &ArgMatches) -> Result1<()> { +pub fn build_1(args: &ArgMatches<'_>) -> Result1<()> { let book_dir = get_book_dir(args); let mut book = MDBook1::load(&book_dir)?; @@ -85,7 +86,7 @@ pub fn build_1(args: &ArgMatches) -> Result1<()> { } // Build command implementation -pub fn build_2(args: &ArgMatches) -> Result2<()> { +pub fn build_2(args: &ArgMatches<'_>) -> Result2<()> { let book_dir = get_book_dir(args); let mut book = MDBook2::load(&book_dir)?; @@ -101,7 +102,7 @@ pub fn build_2(args: &ArgMatches) -> Result2<()> { Ok(()) } -fn get_book_dir(args: &ArgMatches) -> PathBuf { +fn get_book_dir(args: &ArgMatches<'_>) -> PathBuf { if let Some(dir) = args.value_of("dir") { // Check if path is relative from current dir, or absolute... let p = Path::new(dir); From 341b02398630c6c503f63fdecc1f3ed7b0cc721e Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 26 Feb 2019 08:56:00 +0100 Subject: [PATCH 142/381] hir: remove NodeId from Stmt --- src/librustc/hir/lowering.rs | 24 ++++++++---------------- src/librustc/hir/mod.rs | 3 +-- src/librustc/ich/impls_hir.rs | 1 - 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 19bb7f41e1b0..5be5623cd85c 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -4427,9 +4427,8 @@ impl<'a> LoweringContext<'a> { ThinVec::new(), )) }; - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); let match_stmt = hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Expr(match_expr), span: head_sp, @@ -4456,9 +4455,8 @@ impl<'a> LoweringContext<'a> { let body_block = self.with_loop_scope(e.id, |this| this.lower_block(body, false)); let body_expr = P(self.expr_block(body_block, ThinVec::new())); - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); let body_stmt = hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Expr(body_expr), span: body.span, @@ -4639,10 +4637,9 @@ impl<'a> LoweringContext<'a> { let mut ids: SmallVec<[hir::Stmt; 1]> = item_ids .into_iter() .map(|item_id| { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Item(item_id), span: s.span, @@ -4650,10 +4647,9 @@ impl<'a> LoweringContext<'a> { }) .collect(); ids.push({ - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(s.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(s.id); hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Local(P(l)), span: s.span, @@ -4667,12 +4663,11 @@ impl<'a> LoweringContext<'a> { return self.lower_item_id(it) .into_iter() .map(|item_id| { - let LoweredNodeId { node_id, hir_id } = id.take() + let LoweredNodeId { node_id: _, hir_id } = id.take() .map(|id| self.lower_node_id(id)) .unwrap_or_else(|| self.next_id()); hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Item(item_id), span: s.span, @@ -4681,20 +4676,18 @@ impl<'a> LoweringContext<'a> { .collect(); } StmtKind::Expr(ref e) => { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(s.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(s.id); hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Expr(P(self.lower_expr(e))), span: s.span, } }, StmtKind::Semi(ref e) => { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(s.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(s.id); hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Semi(P(self.lower_expr(e))), span: s.span, @@ -4925,9 +4918,8 @@ impl<'a> LoweringContext<'a> { source, }; - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Local(P(local)), span: sp diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index d8169d05dd4d..af283b845914 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1162,7 +1162,6 @@ impl UnOp { /// A statement. #[derive(Clone, RustcEncodable, RustcDecodable)] pub struct Stmt { - pub id: NodeId, pub hir_id: HirId, pub node: StmtKind, pub span: Span, @@ -1170,7 +1169,7 @@ pub struct Stmt { impl fmt::Debug for Stmt { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "stmt({}: {})", self.id, + write!(f, "stmt({}: {})", self.hir_id, print::to_string(print::NO_ANN, |s| s.print_stmt(self))) } } diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 775822786900..0b4866ab920a 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -495,7 +495,6 @@ impl_stable_hash_for!(enum hir::UnOp { }); impl_stable_hash_for!(struct hir::Stmt { - id, hir_id, node, span, From 70d3b290e2a6d0b9d6e033b61b8c4c55fbeb456a Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 26 Feb 2019 10:04:27 +0100 Subject: [PATCH 143/381] hir: remove NodeId from Local --- src/librustc/hir/lowering.rs | 6 ++---- src/librustc/hir/map/mod.rs | 2 +- src/librustc/hir/mod.rs | 1 - src/librustc/ich/impls_hir.rs | 1 - src/librustc_typeck/check/_match.rs | 6 +++--- src/librustc_typeck/check/mod.rs | 25 +++++++++++++------------ src/librustc_typeck/check/writeback.rs | 2 +- 7 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 5be5623cd85c..86a0dfae4c49 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -2008,7 +2008,7 @@ impl<'a> LoweringContext<'a> { } fn lower_local(&mut self, l: &Local) -> (hir::Local, SmallVec<[hir::ItemId; 1]>) { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(l.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(l.id); let mut ids = SmallVec::<[hir::ItemId; 1]>::new(); if self.sess.features_untracked().impl_trait_in_bindings { if let Some(ref ty) = l.ty { @@ -2018,7 +2018,6 @@ impl<'a> LoweringContext<'a> { } let parent_def_id = DefId::local(self.current_hir_id_owner.last().unwrap().0); (hir::Local { - id: node_id, hir_id, ty: l.ty .as_ref() @@ -4905,13 +4904,12 @@ impl<'a> LoweringContext<'a> { pat: P, source: hir::LocalSource, ) -> hir::Stmt { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); let local = hir::Local { pat, ty: None, init: ex, - id: node_id, hir_id, span: sp, attrs: ThinVec::new(), diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 41e48e46ea5b..1d8ea8f65571 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -387,7 +387,7 @@ impl<'hir> Map<'hir> { Node::Block(_) | Node::Crate => None, Node::Local(local) => { - Some(Def::Local(local.id)) + Some(Def::Local(self.hir_to_node_id(local.hir_id))) } Node::MacroDef(macro_def) => { Some(Def::Macro(self.local_def_id_from_hir_id(macro_def.hir_id), diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index af283b845914..fc2f3643f939 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1207,7 +1207,6 @@ pub struct Local { pub ty: Option>, /// Initializer expression to set the value, if any. pub init: Option>, - pub id: NodeId, pub hir_id: HirId, pub span: Span, pub attrs: ThinVec, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 0b4866ab920a..8109a374c049 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -505,7 +505,6 @@ impl_stable_hash_for!(struct hir::Local { pat, ty, init, - id, hir_id, span, attrs, diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 100e55fc3672..e27672842dbc 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -227,7 +227,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.demand_eqtype_pat(pat.span, expected, rhs_ty, match_discrim_span); common_type } - PatKind::Binding(ba, var_id, _, _, ref sub) => { + PatKind::Binding(ba, _, var_id, _, ref sub) => { let bm = if ba == hir::BindingAnnotation::Unannotated { def_bm } else { @@ -239,7 +239,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .pat_binding_modes_mut() .insert(pat.hir_id, bm); debug!("check_pat_walk: pat.hir_id={:?} bm={:?}", pat.hir_id, bm); - let local_ty = self.local_ty(pat.span, pat.id).decl_ty; + let local_ty = self.local_ty(pat.span, pat.hir_id).decl_ty; match bm { ty::BindByReference(mutbl) => { // if the binding is like @@ -265,7 +265,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // if there are multiple arms, make sure they all agree on // what the type of the binding `x` ought to be - if var_id != pat.id { + if var_id != pat.hir_id { let vt = self.local_ty(pat.span, var_id).decl_ty; self.demand_eqtype_pat(pat.span, vt, local_ty, match_discrim_span); } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 5769ab253123..9a8b682cb48d 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -137,7 +137,7 @@ use crate::TypeAndSubsts; use crate::lint; use crate::util::captures::Captures; use crate::util::common::{ErrorReported, indenter}; -use crate::util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, HirIdMap, NodeMap}; +use crate::util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, HirIdMap}; pub use self::Expectation::*; use self::autoderef::Autoderef; @@ -194,7 +194,7 @@ pub struct Inherited<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { tables: MaybeInProgressTables<'a, 'tcx>, - locals: RefCell>>, + locals: RefCell>>, fulfillment_cx: RefCell>>, @@ -943,7 +943,7 @@ struct GatherLocalsVisitor<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> GatherLocalsVisitor<'a, 'gcx, 'tcx> { - fn assign(&mut self, span: Span, nid: ast::NodeId, ty_opt: Option>) -> Ty<'tcx> { + fn assign(&mut self, span: Span, nid: hir::HirId, ty_opt: Option>) -> Ty<'tcx> { match ty_opt { None => { // infer the variable's type @@ -994,19 +994,19 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for GatherLocalsVisitor<'a, 'gcx, 'tcx> { }, None => None, }; - self.assign(local.span, local.id, local_ty); + self.assign(local.span, local.hir_id, local_ty); debug!("Local variable {:?} is assigned type {}", local.pat, self.fcx.ty_to_string( - self.fcx.locals.borrow().get(&local.id).unwrap().clone().decl_ty)); + self.fcx.locals.borrow().get(&local.hir_id).unwrap().clone().decl_ty)); intravisit::walk_local(self, local); } // Add pattern bindings. fn visit_pat(&mut self, p: &'gcx hir::Pat) { if let PatKind::Binding(_, _, _, ident, _) = p.node { - let var_ty = self.assign(p.span, p.id, None); + let var_ty = self.assign(p.span, p.hir_id, None); if !self.fcx.tcx.features().unsized_locals { self.fcx.require_type_is_sized(var_ty, p.span, @@ -1016,7 +1016,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for GatherLocalsVisitor<'a, 'gcx, 'tcx> { debug!("Pattern binding {} is assigned to {} with type {:?}", ident, self.fcx.ty_to_string( - self.fcx.locals.borrow().get(&p.id).unwrap().clone().decl_ty), + self.fcx.locals.borrow().get(&p.hir_id).unwrap().clone().decl_ty), var_ty); } intravisit::walk_pat(self, p); @@ -2124,10 +2124,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { format!("{:?}", self_ptr) } - pub fn local_ty(&self, span: Span, nid: ast::NodeId) -> LocalTy<'tcx> { + pub fn local_ty(&self, span: Span, nid: hir::HirId) -> LocalTy<'tcx> { self.locals.borrow().get(&nid).cloned().unwrap_or_else(|| span_bug!(span, "no type for local variable {}", - self.tcx.hir().node_to_string(nid)) + self.tcx.hir().hir_to_string(nid)) ) } @@ -4805,7 +4805,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // See #44848. let ref_bindings = local.pat.contains_explicit_ref_binding(); - let local_ty = self.local_ty(init.span, local.id).revealed_ty; + let local_ty = self.local_ty(init.span, local.hir_id).revealed_ty; if let Some(m) = ref_bindings { // Somewhat subtle: if we have a `ref` binding in the pattern, // we want to avoid introducing coercions for the RHS. This is @@ -4824,7 +4824,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } pub fn check_decl_local(&self, local: &'gcx hir::Local) { - let t = self.local_ty(local.span, local.id).decl_ty; + let t = self.local_ty(local.span, local.hir_id).decl_ty; self.write_ty(local.hir_id, t); if let Some(ref init) = local.init { @@ -5378,7 +5378,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { match def { Def::Local(nid) | Def::Upvar(nid, ..) => { - let ty = self.local_ty(span, nid).decl_ty; + let hid = self.tcx.hir().node_to_hir_id(nid); + let ty = self.local_ty(span, hid).decl_ty; let ty = self.normalize_associated_types_in(span, &ty); self.write_ty(hir_id, ty); return (ty, def); diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 7c1283a6d210..5981d9bb66bf 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -287,7 +287,7 @@ impl<'cx, 'gcx, 'tcx> Visitor<'gcx> for WritebackCx<'cx, 'gcx, 'tcx> { fn visit_local(&mut self, l: &'gcx hir::Local) { intravisit::walk_local(self, l); - let var_ty = self.fcx.local_ty(l.span, l.id).decl_ty; + let var_ty = self.fcx.local_ty(l.span, l.hir_id).decl_ty; let var_ty = self.resolve(&var_ty, &l.span); self.write_ty_to_tables(l.hir_id, var_ty); } From d959f443fb5d191bb06343350a65fd0953eb311c Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 26 Feb 2019 10:10:54 +0100 Subject: [PATCH 144/381] hir: remove NodeId from Field --- src/librustc/hir/lowering.rs | 6 ++---- src/librustc/hir/mod.rs | 1 - src/librustc/ich/impls_hir.rs | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 86a0dfae4c49..740f3cf51bcd 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -2767,10 +2767,9 @@ impl<'a> LoweringContext<'a> { } fn lower_field(&mut self, f: &Field) -> hir::Field { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Field { - id: node_id, hir_id, ident: f.ident, expr: P(self.lower_expr(&f.expr)), @@ -4801,10 +4800,9 @@ impl<'a> LoweringContext<'a> { } fn field(&mut self, ident: Ident, expr: P, span: Span) -> hir::Field { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Field { - id: node_id, hir_id, ident, span, diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index fc2f3643f939..1e675247178a 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1229,7 +1229,6 @@ pub enum Guard { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Field { - pub id: NodeId, pub hir_id: HirId, pub ident: Ident, pub expr: P, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 8109a374c049..f36b74de77a7 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -523,7 +523,6 @@ impl_stable_hash_for!(enum hir::Guard { }); impl_stable_hash_for!(struct hir::Field { - id -> _, hir_id -> _, ident, expr, From 4543fc243e23780f29b15b4a805253660569f980 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 26 Feb 2019 10:24:50 +0100 Subject: [PATCH 145/381] hir: remove NodeId from AnonConst --- src/librustc/hir/lowering.rs | 3 +-- src/librustc/hir/mod.rs | 1 - src/librustc/ich/impls_hir.rs | 1 - src/librustc_metadata/encoder.rs | 4 ++-- src/librustc_mir/hair/cx/expr.rs | 2 +- src/librustc_typeck/astconv.rs | 2 +- src/librustc_typeck/check/mod.rs | 4 ++-- src/librustc_typeck/collect.rs | 25 +++++++++++++------------ src/librustdoc/clean/mod.rs | 2 +- 9 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 740f3cf51bcd..bca8d4e7fb00 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -3811,9 +3811,8 @@ impl<'a> LoweringContext<'a> { fn lower_anon_const(&mut self, c: &AnonConst) -> hir::AnonConst { self.with_new_scopes(|this| { - let LoweredNodeId { node_id, hir_id } = this.lower_node_id(c.id); + let LoweredNodeId { node_id: _, hir_id } = this.lower_node_id(c.id); hir::AnonConst { - id: node_id, hir_id, body: this.lower_body(None, |this| this.lower_expr(&c.value)), } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 1e675247178a..33abc918d732 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1322,7 +1322,6 @@ impl BodyOwnerKind { /// explicit discriminant values for enum variants. #[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug)] pub struct AnonConst { - pub id: NodeId, pub hir_id: HirId, pub body: BodyId, } diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index f36b74de77a7..f7066a0eb17b 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -546,7 +546,6 @@ impl_stable_hash_for!(enum hir::UnsafeSource { }); impl_stable_hash_for!(struct hir::AnonConst { - id, hir_id, body }); diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 5fdc5899a721..b4a71b887dc3 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1667,7 +1667,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> { intravisit::walk_variant(self, v, g, id); if let Some(ref discr) = v.node.disr_expr { - let def_id = self.index.tcx.hir().local_def_id(discr.id); + let def_id = self.index.tcx.hir().local_def_id_from_hir_id(discr.hir_id); self.index.record(def_id, IsolatedEncoder::encode_info_for_anon_const, def_id); } } @@ -1719,7 +1719,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { fn encode_info_for_ty(&mut self, ty: &hir::Ty) { match ty.node { hir::TyKind::Array(_, ref length) => { - let def_id = self.tcx.hir().local_def_id(length.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(length.hir_id); self.record(def_id, IsolatedEncoder::encode_info_for_anon_const, def_id); } _ => {} diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 5548366db66e..0751af9b12af 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -560,7 +560,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, // Now comes the rote stuff: hir::ExprKind::Repeat(ref v, ref count) => { - let def_id = cx.tcx.hir().local_def_id(count.id); + let def_id = cx.tcx.hir().local_def_id_from_hir_id(count.hir_id); let substs = InternalSubsts::identity_for_item(cx.tcx.global_tcx(), def_id); let instance = ty::Instance::resolve( cx.tcx.global_tcx(), diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 4a88922b50ee..37dcaa014596 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1798,7 +1798,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { self.associated_path_to_ty(ast_ty.hir_id, ast_ty.span, ty, def, segment, false).0 } hir::TyKind::Array(ref ty, ref length) => { - let length_def_id = tcx.hir().local_def_id(length.id); + let length_def_id = tcx.hir().local_def_id_from_hir_id(length.hir_id); let substs = InternalSubsts::identity_for_item(tcx, length_def_id); let length = ty::LazyConst::Unevaluated(length_def_id, substs); let length = tcx.mk_lazy_const(length); diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 9a8b682cb48d..89ad6d402b68 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1870,7 +1870,7 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, for v in vs { if let Some(ref e) = v.node.disr_expr { - tcx.typeck_tables_of(tcx.hir().local_def_id(e.id)); + tcx.typeck_tables_of(tcx.hir().local_def_id_from_hir_id(e.hir_id)); } } @@ -4552,7 +4552,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { tcx.mk_array(element_ty, args.len() as u64) } ExprKind::Repeat(ref element, ref count) => { - let count_def_id = tcx.hir().local_def_id(count.id); + let count_def_id = tcx.hir().local_def_id_from_hir_id(count.hir_id); let param_env = ty::ParamEnv::empty(); let substs = InternalSubsts::identity_for_item(tcx.global_tcx(), count_def_id); let instance = ty::Instance::resolve( diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 167fb109567d..a777ac3e0a68 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -532,7 +532,7 @@ fn convert_enum_variant_types<'a, 'tcx>( let wrapped_discr = prev_discr.map_or(initial, |d| d.wrap_incr(tcx)); prev_discr = Some( if let Some(ref e) = variant.node.disr_expr { - let expr_did = tcx.hir().local_def_id(e.id); + let expr_did = tcx.hir().local_def_id_from_hir_id(e.hir_id); def.eval_explicit_discr(tcx, expr_did) } else if let Some(discr) = repr_type.disr_incr(tcx, prev_discr) { Some(discr) @@ -637,7 +637,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad let did = tcx.hir().local_def_id(v.node.data.id()); let discr = if let Some(ref e) = v.node.disr_expr { distance_from_explicit = 0; - ty::VariantDiscr::Explicit(tcx.hir().local_def_id(e.id)) + ty::VariantDiscr::Explicit(tcx.hir().local_def_id_from_hir_id(e.hir_id)) } else { ty::VariantDiscr::Relative(distance_from_explicit) }; @@ -1142,11 +1142,11 @@ fn report_assoc_ty_on_inherent_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { use rustc::hir::*; - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let icx = ItemCtxt::new(tcx, def_id); - match tcx.hir().get(node_id) { + match tcx.hir().get_by_hir_id(hir_id) { Node::TraitItem(item) => match item.node { TraitItemKind::Method(..) => { let substs = InternalSubsts::identity_for_item(tcx, def_id); @@ -1166,7 +1166,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { ImplItemKind::Const(ref ty, _) => icx.to_ty(ty), ImplItemKind::Existential(_) => { if tcx - .impl_trait_ref(tcx.hir().get_parent_did(node_id)) + .impl_trait_ref(tcx.hir().get_parent_did_by_hir_id(hir_id)) .is_none() { report_assoc_ty_on_inherent_impl(tcx, item.span); @@ -1176,7 +1176,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { } ImplItemKind::Type(ref ty) => { if tcx - .impl_trait_ref(tcx.hir().get_parent_did(node_id)) + .impl_trait_ref(tcx.hir().get_parent_did_by_hir_id(hir_id)) .is_none() { report_assoc_ty_on_inherent_impl(tcx, item.span); @@ -1259,7 +1259,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { .. }) => match *def { VariantData::Unit(..) | VariantData::Struct(..) => { - tcx.type_of(tcx.hir().get_parent_did(node_id)) + tcx.type_of(tcx.hir().get_parent_did_by_hir_id(hir_id)) } VariantData::Tuple(..) => { let substs = InternalSubsts::identity_for_item(tcx, def_id); @@ -1274,7 +1274,6 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { .. }) => { if gen.is_some() { - let hir_id = tcx.hir().node_to_hir_id(node_id); return tcx.typeck_tables_of(def_id).node_type(hir_id); } @@ -1285,7 +1284,9 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_closure(def_id, substs) } - Node::AnonConst(_) => match tcx.hir().get(tcx.hir().get_parent_node(node_id)) { + Node::AnonConst(_) => match tcx.hir().get_by_hir_id( + tcx.hir().get_parent_node_by_hir_id(hir_id)) + { Node::Ty(&hir::Ty { node: hir::TyKind::Array(_, ref constant), .. @@ -1297,7 +1298,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { | Node::Expr(&hir::Expr { node: ExprKind::Repeat(_, ref constant), .. - }) if constant.id == node_id => + }) if constant.hir_id == hir_id => { tcx.types.usize } @@ -1309,9 +1310,9 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { .. }, .. - }) if e.id == node_id => + }) if e.hir_id == hir_id => { - tcx.adt_def(tcx.hir().get_parent_did(node_id)) + tcx.adt_def(tcx.hir().get_parent_did_by_hir_id(hir_id)) .repr .discr_type() .to_ty(tcx) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 53dcc258c690..032452115d6f 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2531,7 +2531,7 @@ impl Clean for hir::Ty { } TyKind::Slice(ref ty) => Slice(box ty.clean(cx)), TyKind::Array(ref ty, ref length) => { - let def_id = cx.tcx.hir().local_def_id(length.id); + let def_id = cx.tcx.hir().local_def_id_from_hir_id(length.hir_id); let param_env = cx.tcx.param_env(def_id); let substs = InternalSubsts::identity_for_item(cx.tcx, def_id); let cid = GlobalId { From 43294c6c8c03780d44a5f27bbbb4e6e0c72add66 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 26 Feb 2019 11:01:11 +0100 Subject: [PATCH 146/381] middle: HirIdify dead --- src/librustc/middle/dead.rs | 117 ++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 58 deletions(-) diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 201a779ee182..3b607127d862 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -26,8 +26,8 @@ use syntax_pos; // function, then we should explore its block to check for codes that // may need to be marked as live. fn should_explore<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - node_id: ast::NodeId) -> bool { - match tcx.hir().find(node_id) { + hir_id: hir::HirId) -> bool { + match tcx.hir().find_by_hir_id(hir_id) { Some(Node::Item(..)) | Some(Node::ImplItem(..)) | Some(Node::ForeignItem(..)) | @@ -39,33 +39,33 @@ fn should_explore<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } struct MarkSymbolVisitor<'a, 'tcx: 'a> { - worklist: Vec, + worklist: Vec, tcx: TyCtxt<'a, 'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, - live_symbols: FxHashSet, + live_symbols: FxHashSet, repr_has_repr_c: bool, in_pat: bool, inherited_pub_visibility: bool, ignore_variant_stack: Vec, // maps from tuple struct constructors to tuple struct items - struct_constructors: FxHashMap, + struct_constructors: FxHashMap, } impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { fn check_def_id(&mut self, def_id: DefId) { - if let Some(node_id) = self.tcx.hir().as_local_node_id(def_id) { - if should_explore(self.tcx, node_id) || - self.struct_constructors.contains_key(&node_id) { - self.worklist.push(node_id); + if let Some(hir_id) = self.tcx.hir().as_local_hir_id(def_id) { + if should_explore(self.tcx, hir_id) || + self.struct_constructors.contains_key(&hir_id) { + self.worklist.push(hir_id); } - self.live_symbols.insert(node_id); + self.live_symbols.insert(hir_id); } } fn insert_def_id(&mut self, def_id: DefId) { - if let Some(node_id) = self.tcx.hir().as_local_node_id(def_id) { - debug_assert!(!should_explore(self.tcx, node_id)); - self.live_symbols.insert(node_id); + if let Some(hir_id) = self.tcx.hir().as_local_hir_id(def_id) { + debug_assert!(!should_explore(self.tcx, hir_id)); + self.live_symbols.insert(hir_id); } } @@ -136,7 +136,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { // tuple struct constructor function let id = self.struct_constructors.get(&id).cloned().unwrap_or(id); - if let Some(node) = self.tcx.hir().find(id) { + if let Some(node) = self.tcx.hir().find_by_hir_id(id) { self.live_symbols.insert(id); self.visit_node(node); } @@ -217,7 +217,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> { let live_fields = def.fields().iter().filter(|f| { has_repr_c || inherited_pub_visibility || f.vis.node.is_pub() }); - self.live_symbols.extend(live_fields.map(|f| f.id)); + self.live_symbols.extend(live_fields.map(|f| f.hir_id)); intravisit::walk_struct_def(self, def); } @@ -285,7 +285,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> { } fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>, - id: ast::NodeId, + id: hir::HirId, attrs: &[ast::Attribute]) -> bool { if attr::contains_name(attrs, "lang") { return true; @@ -306,7 +306,7 @@ fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>, return true; } - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); let cg_attrs = tcx.codegen_fn_attrs(def_id); // #[used], #[no_mangle], #[export_name], etc also keeps the item alive @@ -333,25 +333,25 @@ fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>, // 2) We are not sure to be live or not // * Implementation of a trait method struct LifeSeeder<'k, 'tcx: 'k> { - worklist: Vec, + worklist: Vec, krate: &'k hir::Crate, tcx: TyCtxt<'k, 'tcx, 'tcx>, // see `MarkSymbolVisitor::struct_constructors` - struct_constructors: FxHashMap, + struct_constructors: FxHashMap, } impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { let allow_dead_code = has_allow_dead_code_or_lang_attr(self.tcx, - item.id, + item.hir_id, &item.attrs); if allow_dead_code { - self.worklist.push(item.id); + self.worklist.push(item.hir_id); } match item.node { hir::ItemKind::Enum(ref enum_def, _) if allow_dead_code => { self.worklist.extend(enum_def.variants.iter() - .map(|variant| variant.node.data.id())); + .map(|variant| variant.node.data.hir_id())); } hir::ItemKind::Trait(.., ref trait_item_refs) => { for trait_item_ref in trait_item_refs { @@ -360,9 +360,9 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> { hir::TraitItemKind::Const(_, Some(_)) | hir::TraitItemKind::Method(_, hir::TraitMethod::Provided(_)) => { if has_allow_dead_code_or_lang_attr(self.tcx, - trait_item.id, + trait_item.hir_id, &trait_item.attrs) { - self.worklist.push(trait_item.id); + self.worklist.push(trait_item.hir_id); } } _ => {} @@ -374,14 +374,14 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> { let impl_item = self.krate.impl_item(impl_item_ref.id); if opt_trait.is_some() || has_allow_dead_code_or_lang_attr(self.tcx, - impl_item.id, + impl_item.hir_id, &impl_item.attrs) { - self.worklist.push(impl_item_ref.id.node_id); + self.worklist.push(self.tcx.hir().node_to_hir_id(impl_item_ref.id.node_id)); } } } hir::ItemKind::Struct(ref variant_data, _) => { - self.struct_constructors.insert(variant_data.id(), item.id); + self.struct_constructors.insert(variant_data.hir_id(), item.hir_id); } _ => () } @@ -400,16 +400,16 @@ fn create_and_seed_worklist<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, access_levels: &privacy::AccessLevels, krate: &hir::Crate, -) -> (Vec, FxHashMap) { +) -> (Vec, FxHashMap) { let worklist = access_levels.map.iter().filter_map(|(&id, level)| { if level >= &privacy::AccessLevel::Reachable { - Some(id) + Some(tcx.hir().node_to_hir_id(id)) } else { None } }).chain( // Seed entry point - tcx.entry_fn(LOCAL_CRATE).map(|(def_id, _)| tcx.hir().as_local_node_id(def_id).unwrap()) + tcx.entry_fn(LOCAL_CRATE).map(|(def_id, _)| tcx.hir().as_local_hir_id(def_id).unwrap()) ).collect::>(); // Seed implemented trait items @@ -427,7 +427,7 @@ fn create_and_seed_worklist<'a, 'tcx>( fn find_live<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, access_levels: &privacy::AccessLevels, krate: &hir::Crate) - -> FxHashSet { + -> FxHashSet { let (worklist, struct_constructors) = create_and_seed_worklist(tcx, access_levels, krate); let mut symbol_visitor = MarkSymbolVisitor { worklist, @@ -446,7 +446,7 @@ fn find_live<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, struct DeadVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, - live_symbols: FxHashSet, + live_symbols: FxHashSet, } impl<'a, 'tcx> DeadVisitor<'a, 'tcx> { @@ -461,33 +461,33 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> { | hir::ItemKind::Union(..) => true, _ => false }; - should_warn && !self.symbol_is_live(item.id) + should_warn && !self.symbol_is_live(item.hir_id) } fn should_warn_about_field(&mut self, field: &hir::StructField) -> bool { let field_type = self.tcx.type_of(self.tcx.hir().local_def_id(field.id)); !field.is_positional() - && !self.symbol_is_live(field.id) + && !self.symbol_is_live(field.hir_id) && !field_type.is_phantom_data() - && !has_allow_dead_code_or_lang_attr(self.tcx, field.id, &field.attrs) + && !has_allow_dead_code_or_lang_attr(self.tcx, field.hir_id, &field.attrs) } fn should_warn_about_variant(&mut self, variant: &hir::VariantKind) -> bool { - !self.symbol_is_live(variant.data.id()) + !self.symbol_is_live(variant.data.hir_id()) && !has_allow_dead_code_or_lang_attr(self.tcx, - variant.data.id(), + variant.data.hir_id(), &variant.attrs) } fn should_warn_about_foreign_item(&mut self, fi: &hir::ForeignItem) -> bool { - !self.symbol_is_live(fi.id) - && !has_allow_dead_code_or_lang_attr(self.tcx, fi.id, &fi.attrs) + !self.symbol_is_live(fi.hir_id) + && !has_allow_dead_code_or_lang_attr(self.tcx, fi.hir_id, &fi.attrs) } - // id := node id of an item's definition. + // id := HIR id of an item's definition. fn symbol_is_live( &mut self, - id: ast::NodeId, + id: hir::HirId, ) -> bool { if self.live_symbols.contains(&id) { return true; @@ -496,12 +496,12 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> { // This is done to handle the case where, for example, the static // method of a private type is used, but the type itself is never // called directly. - let def_id = self.tcx.hir().local_def_id(id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(id); let inherent_impls = self.tcx.inherent_impls(def_id); for &impl_did in inherent_impls.iter() { for &item_did in &self.tcx.associated_item_def_ids(impl_did)[..] { - if let Some(item_node_id) = self.tcx.hir().as_local_node_id(item_did) { - if self.live_symbols.contains(&item_node_id) { + if let Some(item_hir_id) = self.tcx.hir().as_local_hir_id(item_did) { + if self.live_symbols.contains(&item_hir_id) { return true; } } @@ -511,18 +511,18 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> { } fn warn_dead_code(&mut self, - id: ast::NodeId, + id: hir::HirId, span: syntax_pos::Span, name: ast::Name, node_type: &str, participle: &str) { if !name.as_str().starts_with("_") { self.tcx - .lint_node(lint::builtin::DEAD_CODE, - id, - span, - &format!("{} is never {}: `{}`", - node_type, participle, name)); + .lint_hir(lint::builtin::DEAD_CODE, + id, + span, + &format!("{} is never {}: `{}`", + node_type, participle, name)); } } } @@ -555,7 +555,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { _ => "used" }; self.warn_dead_code( - item.id, + item.hir_id, span, item.ident.name, item.node.descriptive_variant(), @@ -572,7 +572,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { g: &'tcx hir::Generics, id: hir::HirId) { if self.should_warn_about_variant(&variant.node) { - self.warn_dead_code(variant.node.data.id(), variant.span, variant.node.ident.name, + self.warn_dead_code(variant.node.data.hir_id(), variant.span, variant.node.ident.name, "variant", "constructed"); } else { intravisit::walk_variant(self, variant, g, id); @@ -581,7 +581,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { fn visit_foreign_item(&mut self, fi: &'tcx hir::ForeignItem) { if self.should_warn_about_foreign_item(fi) { - self.warn_dead_code(fi.id, fi.span, fi.ident.name, + self.warn_dead_code(fi.hir_id, fi.span, fi.ident.name, fi.node.descriptive_variant(), "used"); } intravisit::walk_foreign_item(self, fi); @@ -589,7 +589,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { fn visit_struct_field(&mut self, field: &'tcx hir::StructField) { if self.should_warn_about_field(&field) { - self.warn_dead_code(field.id, field.span, field.ident.name, "field", "used"); + self.warn_dead_code(field.hir_id, field.span, field.ident.name, "field", "used"); } intravisit::walk_struct_field(self, field); } @@ -597,8 +597,8 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) { match impl_item.node { hir::ImplItemKind::Const(_, body_id) => { - if !self.symbol_is_live(impl_item.id) { - self.warn_dead_code(impl_item.id, + if !self.symbol_is_live(impl_item.hir_id) { + self.warn_dead_code(impl_item.hir_id, impl_item.span, impl_item.ident.name, "associated const", @@ -607,9 +607,10 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { self.visit_nested_body(body_id) } hir::ImplItemKind::Method(_, body_id) => { - if !self.symbol_is_live(impl_item.id) { + if !self.symbol_is_live(impl_item.hir_id) { let span = self.tcx.sess.source_map().def_span(impl_item.span); - self.warn_dead_code(impl_item.id, span, impl_item.ident.name, "method", "used"); + self.warn_dead_code(impl_item.hir_id, span, impl_item.ident.name, "method", + "used"); } self.visit_nested_body(body_id) } From e72584c3a1b74dcc8f2ef51fb1d934c397b524aa Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 26 Feb 2019 11:04:58 +0100 Subject: [PATCH 147/381] hir: remove NodeId from TraitItem --- src/librustc/hir/lowering.rs | 1 - src/librustc/hir/map/collector.rs | 2 +- src/librustc/hir/map/mod.rs | 2 +- src/librustc/hir/mod.rs | 1 - src/librustc/hir/print.rs | 10 +-- src/librustc/ich/impls_hir.rs | 1 - src/librustc/lint/context.rs | 12 ++-- src/librustc/middle/resolve_lifetime.rs | 8 +-- .../symbol_names_test.rs | 11 ++-- src/librustc_incremental/assert_dep_graph.rs | 18 +++--- .../persist/dirty_clean.rs | 18 +++--- src/librustc_lint/builtin.rs | 28 +++++---- src/librustc_mir/lints.rs | 2 +- src/librustc_privacy/lib.rs | 62 ++++++++++--------- src/librustc_traits/lowering/mod.rs | 12 ++-- src/librustc_typeck/check/wfcheck.rs | 29 +++++---- src/librustc_typeck/check_unused.rs | 2 +- src/librustc_typeck/collect.rs | 13 ++-- src/librustc_typeck/variance/constraints.rs | 25 ++++---- src/librustc_typeck/variance/solve.rs | 2 +- src/librustc_typeck/variance/terms.rs | 31 +++++----- src/librustdoc/clean/mod.rs | 7 ++- 22 files changed, 149 insertions(+), 148 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index bca8d4e7fb00..3add88c05e75 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -3351,7 +3351,6 @@ impl<'a> LoweringContext<'a> { }; hir::TraitItem { - id: node_id, hir_id, ident: i.ident, attrs: self.lower_attrs(&i.attrs), diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 588b986aad29..cf48e9cab63c 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -386,7 +386,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { fn visit_trait_item(&mut self, ti: &'hir TraitItem) { debug_assert_eq!(ti.hir_id.owner, - self.definitions.opt_def_index(ti.id).unwrap()); + self.definitions.opt_def_index(self.hir_to_node_id[&ti.hir_id]).unwrap()); self.with_dep_node_owner(ti.hir_id.owner, ti, |this| { this.insert(ti.span, ti.hir_id, Node::TraitItem(ti)); diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 1d8ea8f65571..05180f308567 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -349,7 +349,7 @@ impl<'hir> Map<'hir> { } } Node::TraitItem(item) => { - let def_id = self.local_def_id(item.id); + let def_id = self.local_def_id_from_hir_id(item.hir_id); match item.node { TraitItemKind::Const(..) => Some(Def::AssociatedConst(def_id)), TraitItemKind::Method(..) => Some(Def::Method(def_id)), diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 33abc918d732..486372248c51 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1668,7 +1668,6 @@ pub struct TraitItemId { /// signature) or provided (meaning it has a default implementation). #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct TraitItem { - pub id: NodeId, pub ident: Ident, pub hir_id: HirId, pub attrs: HirVec, diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index dab4b9c824d9..28e9403e9dba 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -25,7 +25,7 @@ pub enum AnnNode<'a> { Name(&'a ast::Name), Block(&'a hir::Block), Item(&'a hir::Item), - SubItem(ast::NodeId), + SubItem(hir::HirId), Expr(&'a hir::Expr), Pat(&'a hir::Pat), } @@ -927,7 +927,7 @@ impl<'a> State<'a> { } pub fn print_trait_item(&mut self, ti: &hir::TraitItem) -> io::Result<()> { - self.ann.pre(self, AnnNode::SubItem(ti.id))?; + self.ann.pre(self, AnnNode::SubItem(ti.hir_id))?; self.hardbreak_if_not_bol()?; self.maybe_print_comment(ti.span.lo())?; self.print_outer_attributes(&ti.attrs)?; @@ -959,11 +959,11 @@ impl<'a> State<'a> { default.as_ref().map(|ty| &**ty))?; } } - self.ann.post(self, AnnNode::SubItem(ti.id)) + self.ann.post(self, AnnNode::SubItem(ti.hir_id)) } pub fn print_impl_item(&mut self, ii: &hir::ImplItem) -> io::Result<()> { - self.ann.pre(self, AnnNode::SubItem(ii.id))?; + self.ann.pre(self, AnnNode::SubItem(ii.hir_id))?; self.hardbreak_if_not_bol()?; self.maybe_print_comment(ii.span.lo())?; self.print_outer_attributes(&ii.attrs)?; @@ -989,7 +989,7 @@ impl<'a> State<'a> { self.print_associated_type(ii.ident, Some(bounds), None)?; } } - self.ann.post(self, AnnNode::SubItem(ii.id)) + self.ann.post(self, AnnNode::SubItem(ii.hir_id)) } pub fn print_stmt(&mut self, st: &hir::Stmt) -> io::Result<()> { diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index f7066a0eb17b..0a53bdeae842 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -669,7 +669,6 @@ impl<'a> HashStable> for hir::TraitItem { hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { let hir::TraitItem { - id: _, hir_id: _, ident, ref attrs, diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index dda314429fc8..a856bfbfd7ee 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -793,11 +793,11 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> { run_lints!(self, exit_lint_attrs, attrs); } - fn with_param_env(&mut self, id: ast::NodeId, f: F) + fn with_param_env(&mut self, id: hir::HirId, f: F) where F: FnOnce(&mut Self), { let old_param_env = self.param_env; - self.param_env = self.tcx.param_env(self.tcx.hir().local_def_id(id)); + self.param_env = self.tcx.param_env(self.tcx.hir().local_def_id_from_hir_id(id)); f(self); self.param_env = old_param_env; } @@ -841,7 +841,7 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, 'tcx> { let generics = self.generics.take(); self.generics = it.node.generics(); self.with_lint_attrs(it.hir_id, &it.attrs, |cx| { - cx.with_param_env(it.id, |cx| { + cx.with_param_env(it.hir_id, |cx| { run_lints!(cx, check_item, it); hir_visit::walk_item(cx, it); run_lints!(cx, check_item_post, it); @@ -852,7 +852,7 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, 'tcx> { fn visit_foreign_item(&mut self, it: &'tcx hir::ForeignItem) { self.with_lint_attrs(it.hir_id, &it.attrs, |cx| { - cx.with_param_env(it.id, |cx| { + cx.with_param_env(it.hir_id, |cx| { run_lints!(cx, check_foreign_item, it); hir_visit::walk_foreign_item(cx, it); run_lints!(cx, check_foreign_item_post, it); @@ -983,7 +983,7 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, 'tcx> { let generics = self.generics.take(); self.generics = Some(&trait_item.generics); self.with_lint_attrs(trait_item.hir_id, &trait_item.attrs, |cx| { - cx.with_param_env(trait_item.id, |cx| { + cx.with_param_env(trait_item.hir_id, |cx| { run_lints!(cx, check_trait_item, trait_item); hir_visit::walk_trait_item(cx, trait_item); run_lints!(cx, check_trait_item_post, trait_item); @@ -996,7 +996,7 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, 'tcx> { let generics = self.generics.take(); self.generics = Some(&impl_item.generics); self.with_lint_attrs(impl_item.hir_id, &impl_item.attrs, |cx| { - cx.with_param_env(impl_item.id, |cx| { + cx.with_param_env(impl_item.hir_id, |cx| { run_lints!(cx, check_impl_item, impl_item); hir_visit::walk_impl_item(cx, impl_item); run_lints!(cx, check_impl_item_post, impl_item); diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 832391d44162..dd44e19bc7df 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -781,7 +781,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { Method(ref sig, _) => { let tcx = self.tcx; self.visit_early_late( - Some(tcx.hir().get_parent(trait_item.id)), + Some(tcx.hir().get_parent_item(trait_item.hir_id)), &sig.decl, &trait_item.generics, |this| intravisit::walk_trait_item(this, trait_item), @@ -833,7 +833,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { Method(ref sig, _) => { let tcx = self.tcx; self.visit_early_late( - Some(tcx.hir().get_parent(impl_item.id)), + Some(tcx.hir().get_parent_item(impl_item.hir_id)), &sig.decl, &impl_item.generics, |this| intravisit::walk_impl_item(this, impl_item), @@ -1685,7 +1685,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { /// ordering is not important there. fn visit_early_late( &mut self, - parent_id: Option, + parent_id: Option, decl: &'tcx hir::FnDecl, generics: &'tcx hir::Generics, walk: F, @@ -1697,7 +1697,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { // Find the start of nested early scopes, e.g., in methods. let mut index = 0; if let Some(parent_id) = parent_id { - let parent = self.tcx.hir().expect_item(parent_id); + let parent = self.tcx.hir().expect_item_by_hir_id(parent_id); if sub_items_have_self_param(&parent.node) { index += 1; // Self comes before lifetimes } diff --git a/src/librustc_codegen_utils/symbol_names_test.rs b/src/librustc_codegen_utils/symbol_names_test.rs index a11eb4da66ad..c49526815466 100644 --- a/src/librustc_codegen_utils/symbol_names_test.rs +++ b/src/librustc_codegen_utils/symbol_names_test.rs @@ -6,7 +6,6 @@ use rustc::hir; use rustc::ty::TyCtxt; -use syntax::ast; use rustc_mir::monomorphize::Instance; @@ -33,9 +32,9 @@ struct SymbolNamesTest<'a, 'tcx:'a> { impl<'a, 'tcx> SymbolNamesTest<'a, 'tcx> { fn process_attrs(&mut self, - node_id: ast::NodeId) { + hir_id: hir::HirId) { let tcx = self.tcx; - let def_id = tcx.hir().local_def_id(node_id); + let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); for attr in tcx.get_attrs(def_id).iter() { if attr.check_name(SYMBOL_NAME) { // for now, can only use on monomorphic names @@ -56,14 +55,14 @@ impl<'a, 'tcx> SymbolNamesTest<'a, 'tcx> { impl<'a, 'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for SymbolNamesTest<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { - self.process_attrs(item.id); + self.process_attrs(item.hir_id); } fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) { - self.process_attrs(trait_item.id); + self.process_attrs(trait_item.hir_id); } fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) { - self.process_attrs(impl_item.id); + self.process_attrs(impl_item.hir_id); } } diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index fe44e0cbe614..1f69d617c83b 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -69,7 +69,7 @@ pub fn assert_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { let mut visitor = IfThisChanged { tcx, if_this_changed: vec![], then_this_would_need: vec![] }; - visitor.process_attrs(ast::CRATE_NODE_ID, &tcx.hir().krate().attrs); + visitor.process_attrs(hir::CRATE_HIR_ID, &tcx.hir().krate().attrs); tcx.hir().krate().visit_all_item_likes(&mut visitor.as_deep_visitor()); (visitor.if_this_changed, visitor.then_this_would_need) }; @@ -87,7 +87,7 @@ pub fn assert_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { } type Sources = Vec<(Span, DefId, DepNode)>; -type Targets = Vec<(Span, ast::Name, ast::NodeId, DepNode)>; +type Targets = Vec<(Span, ast::Name, hir::HirId, DepNode)>; struct IfThisChanged<'a, 'tcx:'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -110,8 +110,8 @@ impl<'a, 'tcx> IfThisChanged<'a, 'tcx> { value } - fn process_attrs(&mut self, node_id: ast::NodeId, attrs: &[ast::Attribute]) { - let def_id = self.tcx.hir().local_def_id(node_id); + fn process_attrs(&mut self, hir_id: hir::HirId, attrs: &[ast::Attribute]) { + let def_id = self.tcx.hir().local_def_id_from_hir_id(hir_id); let def_path_hash = self.tcx.def_path_hash(def_id); for attr in attrs { if attr.check_name(ATTR_IF_THIS_CHANGED) { @@ -151,7 +151,7 @@ impl<'a, 'tcx> IfThisChanged<'a, 'tcx> { }; self.then_this_would_need.push((attr.span, dep_node_interned.unwrap(), - node_id, + hir_id, dep_node)); } } @@ -164,22 +164,22 @@ impl<'a, 'tcx> Visitor<'tcx> for IfThisChanged<'a, 'tcx> { } fn visit_item(&mut self, item: &'tcx hir::Item) { - self.process_attrs(item.id, &item.attrs); + self.process_attrs(item.hir_id, &item.attrs); intravisit::walk_item(self, item); } fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) { - self.process_attrs(trait_item.id, &trait_item.attrs); + self.process_attrs(trait_item.hir_id, &trait_item.attrs); intravisit::walk_trait_item(self, trait_item); } fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) { - self.process_attrs(impl_item.id, &impl_item.attrs); + self.process_attrs(impl_item.hir_id, &impl_item.attrs); intravisit::walk_impl_item(self, impl_item); } fn visit_struct_field(&mut self, s: &'tcx hir::StructField) { - self.process_attrs(s.id, &s.attrs); + self.process_attrs(s.hir_id, &s.attrs); intravisit::walk_struct_field(self, s); } } diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index c13a3533032a..2794b6c556ff 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -241,7 +241,7 @@ pub struct DirtyCleanVisitor<'a, 'tcx:'a> { impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { /// Possibly "deserialize" the attribute into a clean/dirty assertion - fn assertion_maybe(&mut self, item_id: ast::NodeId, attr: &Attribute) + fn assertion_maybe(&mut self, item_id: hir::HirId, attr: &Attribute) -> Option { let is_clean = if attr.check_name(ATTR_DIRTY) { @@ -269,7 +269,7 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { } /// Gets the "auto" assertion on pre-validated attr, along with the `except` labels. - fn assertion_auto(&mut self, item_id: ast::NodeId, attr: &Attribute, is_clean: bool) + fn assertion_auto(&mut self, item_id: hir::HirId, attr: &Attribute, is_clean: bool) -> Assertion { let (name, mut auto) = self.auto_labels(item_id, attr); @@ -321,8 +321,8 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { /// Return all DepNode labels that should be asserted for this item. /// index=0 is the "name" used for error messages - fn auto_labels(&mut self, item_id: ast::NodeId, attr: &Attribute) -> (&'static str, Labels) { - let node = self.tcx.hir().get(item_id); + fn auto_labels(&mut self, item_id: hir::HirId, attr: &Attribute) -> (&'static str, Labels) { + let node = self.tcx.hir().get_by_hir_id(item_id); let (name, labels) = match node { HirNode::Item(item) => { match item.node { @@ -499,8 +499,8 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { } } - fn check_item(&mut self, item_id: ast::NodeId, item_span: Span) { - let def_id = self.tcx.hir().local_def_id(item_id); + fn check_item(&mut self, item_id: hir::HirId, item_span: Span) { + let def_id = self.tcx.hir().local_def_id_from_hir_id(item_id); for attr in self.tcx.get_attrs(def_id).iter() { let assertion = match self.assertion_maybe(item_id, attr) { Some(a) => a, @@ -519,15 +519,15 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { impl<'a, 'tcx> ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { - self.check_item(item.id, item.span); + self.check_item(item.hir_id, item.span); } fn visit_trait_item(&mut self, item: &hir::TraitItem) { - self.check_item(item.id, item.span); + self.check_item(item.hir_id, item.span); } fn visit_impl_item(&mut self, item: &hir::ImplItem) { - self.check_item(item.id, item.span); + self.check_item(item.hir_id, item.span); } } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index ac10b6403bd1..c9cbffbaefe9 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -324,7 +324,7 @@ pub struct MissingDoc { doc_hidden_stack: Vec, /// Private traits or trait items that leaked through. Don't check their methods. - private_traits: FxHashSet, + private_traits: FxHashSet, } fn has_doc(attr: &ast::Attribute) -> bool { @@ -361,7 +361,7 @@ impl MissingDoc { fn check_missing_docs_attrs(&self, cx: &LateContext<'_, '_>, - id: Option, + id: Option, attrs: &[ast::Attribute], sp: Span, desc: &'static str) { @@ -380,7 +380,8 @@ impl MissingDoc { // It's an option so the crate root can also use this function (it doesn't // have a NodeId). if let Some(id) = id { - if !cx.access_levels.is_exported(id) { + let node_id = cx.tcx.hir().hir_to_node_id(id); + if !cx.access_levels.is_exported(node_id) { return; } } @@ -444,9 +445,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { hir::ItemKind::Trait(.., ref trait_item_refs) => { // Issue #11592, traits are always considered exported, even when private. if let hir::VisibilityKind::Inherited = it.vis.node { - self.private_traits.insert(it.id); + self.private_traits.insert(it.hir_id); for trait_item_ref in trait_item_refs { - self.private_traits.insert(trait_item_ref.id.node_id); + let hir_id = cx.tcx.hir().node_to_hir_id(trait_item_ref.id.node_id); + self.private_traits.insert(hir_id); } return; } @@ -462,7 +464,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { Some(Node::Item(item)) => { if let hir::VisibilityKind::Inherited = item.vis.node { for impl_item_ref in impl_item_refs { - self.private_traits.insert(impl_item_ref.id.node_id); + let hir_id = cx.tcx.hir().node_to_hir_id( + impl_item_ref.id.node_id); + self.private_traits.insert(hir_id); } } } @@ -476,11 +480,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { _ => return, }; - self.check_missing_docs_attrs(cx, Some(it.id), &it.attrs, it.span, desc); + self.check_missing_docs_attrs(cx, Some(it.hir_id), &it.attrs, it.span, desc); } fn check_trait_item(&mut self, cx: &LateContext<'_, '_>, trait_item: &hir::TraitItem) { - if self.private_traits.contains(&trait_item.id) { + if self.private_traits.contains(&trait_item.hir_id) { return; } @@ -491,7 +495,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { }; self.check_missing_docs_attrs(cx, - Some(trait_item.id), + Some(trait_item.hir_id), &trait_item.attrs, trait_item.span, desc); @@ -510,7 +514,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { hir::ImplItemKind::Existential(_) => "an associated existential type", }; self.check_missing_docs_attrs(cx, - Some(impl_item.id), + Some(impl_item.hir_id), &impl_item.attrs, impl_item.span, desc); @@ -519,7 +523,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { fn check_struct_field(&mut self, cx: &LateContext<'_, '_>, sf: &hir::StructField) { if !sf.is_positional() { self.check_missing_docs_attrs(cx, - Some(sf.id), + Some(sf.hir_id), &sf.attrs, sf.span, "a struct field") @@ -528,7 +532,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { fn check_variant(&mut self, cx: &LateContext<'_, '_>, v: &hir::Variant, _: &hir::Generics) { self.check_missing_docs_attrs(cx, - Some(v.node.data.id()), + Some(v.node.data.hir_id()), &v.node.attrs, v.span, "a variant"); diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index c795b412bfa9..bf6d6e1ba739 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -130,7 +130,7 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>, // recurs. if !reached_exit_without_self_call && !self_call_locations.is_empty() { let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let sp = tcx.sess.source_map().def_span(tcx.hir().span(node_id)); + let sp = tcx.sess.source_map().def_span(tcx.hir().span_by_hir_id(hir_id)); let mut db = tcx.struct_span_lint_node(UNCONDITIONAL_RECURSION, node_id, sp, diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 27103ab99651..93305797eef0 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -290,10 +290,10 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) // Set the correct `TypeckTables` for the given `item_id` (or an empty table if // there is no `TypeckTables` for the item). fn item_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - node_id: ast::NodeId, + hir_id: hir::HirId, empty_tables: &'a ty::TypeckTables<'tcx>) -> &'a ty::TypeckTables<'tcx> { - let def_id = tcx.hir().local_def_id(node_id); + let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); if tcx.has_typeck_tables(def_id) { tcx.typeck_tables_of(def_id) } else { empty_tables } } @@ -841,7 +841,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { let orig_current_item = mem::replace(&mut self.current_item, item.id); let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, item.id, self.empty_tables)); + mem::replace(&mut self.tables, item_tables(self.tcx, item.hir_id, self.empty_tables)); intravisit::walk_item(self, item); self.current_item = orig_current_item; self.tables = orig_tables; @@ -849,14 +849,14 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) { let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, ti.id, self.empty_tables)); + mem::replace(&mut self.tables, item_tables(self.tcx, ti.hir_id, self.empty_tables)); intravisit::walk_trait_item(self, ti); self.tables = orig_tables; } fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) { let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, ii.id, self.empty_tables)); + mem::replace(&mut self.tables, item_tables(self.tcx, ii.hir_id, self.empty_tables)); intravisit::walk_impl_item(self, ii); self.tables = orig_tables; } @@ -1114,7 +1114,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { mem::replace(&mut self.current_item, self.tcx.hir().local_def_id(item.id)); let orig_in_body = mem::replace(&mut self.in_body, false); let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, item.id, self.empty_tables)); + mem::replace(&mut self.tables, item_tables(self.tcx, item.hir_id, self.empty_tables)); intravisit::walk_item(self, item); self.tables = orig_tables; self.in_body = orig_in_body; @@ -1123,14 +1123,14 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) { let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, ti.id, self.empty_tables)); + mem::replace(&mut self.tables, item_tables(self.tcx, ti.hir_id, self.empty_tables)); intravisit::walk_trait_item(self, ti); self.tables = orig_tables; } fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) { let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, ii.id, self.empty_tables)); + mem::replace(&mut self.tables, item_tables(self.tcx, ii.hir_id, self.empty_tables)); intravisit::walk_impl_item(self, ii); self.tables = orig_tables; } @@ -1495,7 +1495,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { struct SearchInterfaceForPrivateItemsVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, - item_id: ast::NodeId, + item_id: hir::HirId, item_def_id: DefId, span: Span, /// The visitor checks that each component type is at least this visible. @@ -1548,8 +1548,8 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { } - let node_id = match self.tcx.hir().as_local_node_id(def_id) { - Some(node_id) => node_id, + let hir_id = match self.tcx.hir().as_local_hir_id(def_id) { + Some(hir_id) => hir_id, None => return false, }; @@ -1604,20 +1604,20 @@ struct PrivateItemsInPublicInterfacesVisitor<'a, 'tcx: 'a> { } impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { - fn check(&self, item_id: ast::NodeId, required_visibility: ty::Visibility) + fn check(&self, item_id: hir::HirId, required_visibility: ty::Visibility) -> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { let mut has_old_errors = false; // Slow path taken only if there any errors in the crate. for &id in self.old_error_set { // Walk up the nodes until we find `item_id` (or we hit a root). - let mut id = self.tcx.hir().hir_to_node_id(id); + let mut id = id; loop { if id == item_id { has_old_errors = true; break; } - let parent = self.tcx.hir().get_parent_node(id); + let parent = self.tcx.hir().get_parent_node_by_hir_id(id); if parent == id { break; } @@ -1632,8 +1632,8 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { SearchInterfaceForPrivateItemsVisitor { tcx: self.tcx, item_id, - item_def_id: self.tcx.hir().local_def_id(item_id), - span: self.tcx.hir().span(item_id), + item_def_id: self.tcx.hir().local_def_id_from_hir_id(item_id), + span: self.tcx.hir().span_by_hir_id(item_id), required_visibility, has_pub_restricted: self.has_pub_restricted, has_old_errors, @@ -1642,9 +1642,9 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { } } - fn check_trait_or_impl_item(&self, node_id: ast::NodeId, assoc_item_kind: AssociatedItemKind, + fn check_trait_or_impl_item(&self, hir_id: hir::HirId, assoc_item_kind: AssociatedItemKind, defaultness: hir::Defaultness, vis: ty::Visibility) { - let mut check = self.check(node_id, vis); + let mut check = self.check(hir_id, vis); let (check_ty, is_assoc_ty) = match assoc_item_kind { AssociatedItemKind::Const | AssociatedItemKind::Method { .. } => (true, false), @@ -1682,30 +1682,31 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> // Subitems of these items have inherited publicity. hir::ItemKind::Const(..) | hir::ItemKind::Static(..) | hir::ItemKind::Fn(..) | hir::ItemKind::Ty(..) => { - self.check(item.id, item_visibility).generics().predicates().ty(); + self.check(item.hir_id, item_visibility).generics().predicates().ty(); } hir::ItemKind::Existential(..) => { // `ty()` for existential types is the underlying type, // it's not a part of interface, so we skip it. - self.check(item.id, item_visibility).generics().predicates(); + self.check(item.hir_id, item_visibility).generics().predicates(); } hir::ItemKind::Trait(.., ref trait_item_refs) => { - self.check(item.id, item_visibility).generics().predicates(); + self.check(item.hir_id, item_visibility).generics().predicates(); for trait_item_ref in trait_item_refs { - self.check_trait_or_impl_item(trait_item_ref.id.node_id, trait_item_ref.kind, + let hir_id = tcx.hir().node_to_hir_id(trait_item_ref.id.node_id); + self.check_trait_or_impl_item(hir_id, trait_item_ref.kind, trait_item_ref.defaultness, item_visibility); } } hir::ItemKind::TraitAlias(..) => { - self.check(item.id, item_visibility).generics().predicates(); + self.check(item.hir_id, item_visibility).generics().predicates(); } hir::ItemKind::Enum(ref def, _) => { - self.check(item.id, item_visibility).generics().predicates(); + self.check(item.hir_id, item_visibility).generics().predicates(); for variant in &def.variants { for field in variant.node.data.fields() { - self.check(field.id, item_visibility).ty(); + self.check(field.hir_id, item_visibility).ty(); } } } @@ -1713,17 +1714,17 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { let vis = ty::Visibility::from_hir(&foreign_item.vis, item.id, tcx); - self.check(foreign_item.id, vis).generics().predicates().ty(); + self.check(foreign_item.hir_id, vis).generics().predicates().ty(); } } // Subitems of structs and unions have their own publicity. hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { - self.check(item.id, item_visibility).generics().predicates(); + self.check(item.hir_id, item_visibility).generics().predicates(); for field in struct_def.fields() { let field_visibility = ty::Visibility::from_hir(&field.vis, item.id, tcx); - self.check(field.id, min(item_visibility, field_visibility, tcx)).ty(); + self.check(field.hir_id, min(item_visibility, field_visibility, tcx)).ty(); } } // An inherent impl is public when its type is public @@ -1732,7 +1733,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> // Subitems of trait impls have inherited publicity. hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => { let impl_vis = ty::Visibility::of_impl(item.id, tcx, &Default::default()); - self.check(item.id, impl_vis).generics().predicates(); + self.check(item.hir_id, impl_vis).generics().predicates(); for impl_item_ref in impl_item_refs { let impl_item = tcx.hir().impl_item(impl_item_ref.id); let impl_item_vis = if trait_ref.is_none() { @@ -1740,7 +1741,8 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> } else { impl_vis }; - self.check_trait_or_impl_item(impl_item_ref.id.node_id, impl_item_ref.kind, + let hir_id = tcx.hir().node_to_hir_id(impl_item_ref.id.node_id); + self.check_trait_or_impl_item(hir_id, impl_item_ref.kind, impl_item_ref.defaultness, impl_item_vis); } } diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index d261b2382e7a..44883d438a1e 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -612,8 +612,8 @@ struct ClauseDumper<'a, 'tcx: 'a> { } impl<'a, 'tcx> ClauseDumper<'a, 'tcx> { - fn process_attrs(&mut self, node_id: ast::NodeId, attrs: &[ast::Attribute]) { - let def_id = self.tcx.hir().local_def_id(node_id); + fn process_attrs(&mut self, hir_id: hir::HirId, attrs: &[ast::Attribute]) { + let def_id = self.tcx.hir().local_def_id_from_hir_id(hir_id); for attr in attrs { let mut clauses = None; @@ -655,22 +655,22 @@ impl<'a, 'tcx> Visitor<'tcx> for ClauseDumper<'a, 'tcx> { } fn visit_item(&mut self, item: &'tcx hir::Item) { - self.process_attrs(item.id, &item.attrs); + self.process_attrs(item.hir_id, &item.attrs); intravisit::walk_item(self, item); } fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) { - self.process_attrs(trait_item.id, &trait_item.attrs); + self.process_attrs(trait_item.hir_id, &trait_item.attrs); intravisit::walk_trait_item(self, trait_item); } fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) { - self.process_attrs(impl_item.id, &impl_item.attrs); + self.process_attrs(impl_item.hir_id, &impl_item.attrs); intravisit::walk_impl_item(self, impl_item); } fn visit_struct_field(&mut self, s: &'tcx hir::StructField) { - self.process_attrs(s.id, &s.attrs); + self.process_attrs(s.hir_id, &s.attrs); intravisit::walk_struct_field(self, s); } } diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 69f2a17fdf11..154449a38f4e 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -108,14 +108,14 @@ pub fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: Def check_item_fn(tcx, item); } hir::ItemKind::Static(ref ty, ..) => { - check_item_type(tcx, item.id, ty.span, false); + check_item_type(tcx, item.hir_id, ty.span, false); } hir::ItemKind::Const(ref ty, ..) => { - check_item_type(tcx, item.id, ty.span, false); + check_item_type(tcx, item.hir_id, ty.span, false); } hir::ItemKind::ForeignMod(ref module) => for it in module.items.iter() { if let hir::ForeignItemKind::Static(ref ty, ..) = it.node { - check_item_type(tcx, it.id, ty.span, true); + check_item_type(tcx, it.hir_id, ty.span, true); } }, hir::ItemKind::Struct(ref struct_def, ref ast_generics) => { @@ -157,7 +157,7 @@ pub fn check_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { hir::TraitItemKind::Method(ref sig, _) => Some(sig), _ => None }; - check_associated_item(tcx, trait_item.id, trait_item.span, method_sig); + check_associated_item(tcx, trait_item.hir_id, trait_item.span, method_sig); } pub fn check_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { @@ -168,18 +168,18 @@ pub fn check_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { hir::ImplItemKind::Method(ref sig, _) => Some(sig), _ => None }; - check_associated_item(tcx, impl_item.id, impl_item.span, method_sig); + check_associated_item(tcx, impl_item.hir_id, impl_item.span, method_sig); } fn check_associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - item_id: ast::NodeId, + item_id: hir::HirId, span: Span, sig_if_method: Option<&hir::MethodSig>) { debug!("check_associated_item: {:?}", item_id); let code = ObligationCauseCode::MiscObligation; for_id(tcx, item_id, span).with_fcx(|fcx, tcx| { - let item = fcx.tcx.associated_item(fcx.tcx.hir().local_def_id(item_id)); + let item = fcx.tcx.associated_item(fcx.tcx.hir().local_def_id_from_hir_id(item_id)); let (mut implied_bounds, self_ty) = match item.container { ty::TraitContainer(_) => (vec![], fcx.tcx.mk_self_type()), @@ -220,16 +220,15 @@ fn check_associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn for_item<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, item: &hir::Item) -> CheckWfFcxBuilder<'a, 'gcx, 'tcx> { - for_id(tcx, item.id, item.span) + for_id(tcx, item.hir_id, item.span) } -fn for_id<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, id: ast::NodeId, span: Span) +fn for_id<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, id: hir::HirId, span: Span) -> CheckWfFcxBuilder<'a, 'gcx, 'tcx> { - let def_id = tcx.hir().local_def_id(id); - let hir_id = tcx.hir().node_to_hir_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); CheckWfFcxBuilder { inherited: Inherited::build(tcx, def_id), - id: hir_id, + id, span, param_env: tcx.param_env(def_id), } @@ -339,14 +338,14 @@ fn check_item_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { fn check_item_type<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, - item_id: ast::NodeId, + item_id: hir::HirId, ty_span: Span, allow_foreign_ty: bool, ) { debug!("check_item_type: {:?}", item_id); for_id(tcx, item_id, ty_span).with_fcx(|fcx, gcx| { - let ty = gcx.type_of(gcx.hir().local_def_id(item_id)); + let ty = gcx.type_of(gcx.hir().local_def_id_from_hir_id(item_id)); let item_ty = fcx.normalize_associated_types_in(ty_span, &ty); let mut forbid_unsized = true; @@ -1025,7 +1024,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'a, 'tcx> { fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) { debug!("visit_trait_item: {:?}", trait_item); - let def_id = self.tcx.hir().local_def_id(trait_item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(trait_item.hir_id); self.tcx.ensure().check_trait_item_well_formed(def_id); } diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index 70f7c30f7ecb..3da090aed9c9 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -34,7 +34,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CheckVisitor<'a, 'tcx> { return; } if let hir::ItemKind::Use(ref path, _) = item.node { - self.check_import(item.id, path.span); + self.check_import(item.hir_id, path.span); } } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index a777ac3e0a68..c11fed089139 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -152,7 +152,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { } fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) { - convert_trait_item(self.tcx, trait_item.id); + convert_trait_item(self.tcx, trait_item.hir_id); intravisit::walk_trait_item(self, trait_item); } @@ -479,9 +479,9 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) { } } -fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_item_id: ast::NodeId) { - let trait_item = tcx.hir().expect_trait_item(trait_item_id); - let def_id = tcx.hir().local_def_id(trait_item.id); +fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_item_id: hir::HirId) { + let trait_item = tcx.hir().expect_trait_item_by_hir_id(trait_item_id); + let def_id = tcx.hir().local_def_id_from_hir_id(trait_item.hir_id); tcx.generics_of(def_id); match trait_item.node { @@ -1493,7 +1493,7 @@ fn find_existential_constraints<'a, 'tcx>( } } fn visit_trait_item(&mut self, it: &'tcx TraitItem) { - let def_id = self.tcx.hir().local_def_id(it.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(it.hir_id); self.check(def_id); intravisit::walk_trait_item(self, it); } @@ -2063,7 +2063,8 @@ fn explicit_predicates_of<'a, 'tcx>( }; let assoc_ty = - tcx.mk_projection(tcx.hir().local_def_id(trait_item.id), self_trait_ref.substs); + tcx.mk_projection(tcx.hir().local_def_id_from_hir_id(trait_item.hir_id), + self_trait_ref.substs); let bounds = compute_bounds( &ItemCtxt::new(tcx, def_id), diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 7b94b047c92e..d8d93b462a90 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -6,7 +6,6 @@ use hir::def_id::DefId; use rustc::ty::subst::{UnpackedKind, SubstsRef}; use rustc::ty::{self, Ty, TyCtxt}; -use syntax::ast; use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; @@ -72,31 +71,31 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ConstraintContext<'a, 'tcx> { match item.node { hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { - self.visit_node_helper(item.id); + self.visit_node_helper(item.hir_id); if let hir::VariantData::Tuple(..) = *struct_def { - self.visit_node_helper(struct_def.id()); + self.visit_node_helper(struct_def.hir_id()); } } hir::ItemKind::Enum(ref enum_def, _) => { - self.visit_node_helper(item.id); + self.visit_node_helper(item.hir_id); for variant in &enum_def.variants { if let hir::VariantData::Tuple(..) = variant.node.data { - self.visit_node_helper(variant.node.data.id()); + self.visit_node_helper(variant.node.data.hir_id()); } } } hir::ItemKind::Fn(..) => { - self.visit_node_helper(item.id); + self.visit_node_helper(item.hir_id); } hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { if let hir::ForeignItemKind::Fn(..) = foreign_item.node { - self.visit_node_helper(foreign_item.id); + self.visit_node_helper(foreign_item.hir_id); } } } @@ -107,21 +106,21 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ConstraintContext<'a, 'tcx> { fn visit_trait_item(&mut self, trait_item: &hir::TraitItem) { if let hir::TraitItemKind::Method(..) = trait_item.node { - self.visit_node_helper(trait_item.id); + self.visit_node_helper(trait_item.hir_id); } } fn visit_impl_item(&mut self, impl_item: &hir::ImplItem) { if let hir::ImplItemKind::Method(..) = impl_item.node { - self.visit_node_helper(impl_item.id); + self.visit_node_helper(impl_item.hir_id); } } } impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { - fn visit_node_helper(&mut self, id: ast::NodeId) { + fn visit_node_helper(&mut self, id: hir::HirId) { let tcx = self.terms_cx.tcx; - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); self.build_constraints_for_item(def_id); } @@ -138,7 +137,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { return; } - let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); let inferred_start = self.terms_cx.inferred_starts[&id]; let current_item = &CurrentItem { inferred_start }; match tcx.type_of(def_id).sty { @@ -356,7 +355,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { return; } - let (local, remote) = if let Some(id) = self.tcx().hir().as_local_node_id(def_id) { + let (local, remote) = if let Some(id) = self.tcx().hir().as_local_hir_id(def_id) { (Some(self.terms_cx.inferred_starts[&id]), None) } else { (None, Some(self.tcx().variances_of(def_id))) diff --git a/src/librustc_typeck/variance/solve.rs b/src/librustc_typeck/variance/solve.rs index f962c1313a92..cec33ba87dea 100644 --- a/src/librustc_typeck/variance/solve.rs +++ b/src/librustc_typeck/variance/solve.rs @@ -83,7 +83,7 @@ impl<'a, 'tcx> SolveContext<'a, 'tcx> { let solutions = &self.solutions; self.terms_cx.inferred_starts.iter().map(|(&id, &InferredIndex(start))| { - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); let generics = tcx.generics_of(def_id); let mut variances = solutions[start..start+generics.count()].to_vec(); diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index 4e562992e8cf..e564a8658fca 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -12,10 +12,9 @@ use arena::TypedArena; use rustc::ty::{self, TyCtxt}; use std::fmt; -use syntax::ast; use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; -use crate::util::nodemap::NodeMap; +use crate::util::nodemap::HirIdMap; use self::VarianceTerm::*; @@ -55,11 +54,11 @@ pub struct TermsContext<'a, 'tcx: 'a> { // For marker types, UnsafeCell, and other lang items where // variance is hardcoded, records the item-id and the hardcoded // variance. - pub lang_items: Vec<(ast::NodeId, Vec)>, + pub lang_items: Vec<(hir::HirId, Vec)>, // Maps from the node id of an item to the first inferred index // used for its type & region parameters. - pub inferred_starts: NodeMap, + pub inferred_starts: HirIdMap, // Maps from an InferredIndex to the term for that variable. pub inferred_terms: Vec>, @@ -86,7 +85,7 @@ pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx> terms_cx } -fn lang_items(tcx: TyCtxt<'_, '_, '_>) -> Vec<(ast::NodeId, Vec)> { +fn lang_items(tcx: TyCtxt<'_, '_, '_>) -> Vec<(hir::HirId, Vec)> { let lang_items = tcx.lang_items(); let all = vec![ (lang_items.phantom_data(), vec![ty::Covariant]), @@ -96,14 +95,14 @@ fn lang_items(tcx: TyCtxt<'_, '_, '_>) -> Vec<(ast::NodeId, Vec)> all.into_iter() // iterating over (Option, Variance) .filter(|&(ref d,_)| d.is_some()) .map(|(d, v)| (d.unwrap(), v)) // (DefId, Variance) - .filter_map(|(d, v)| tcx.hir().as_local_node_id(d).map(|n| (n, v))) // (NodeId, Variance) + .filter_map(|(d, v)| tcx.hir().as_local_hir_id(d).map(|n| (n, v))) // (HirId, Variance) .collect() } impl<'a, 'tcx> TermsContext<'a, 'tcx> { - fn add_inferreds_for_item(&mut self, id: ast::NodeId) { + fn add_inferreds_for_item(&mut self, id: hir::HirId) { let tcx = self.tcx; - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); let count = tcx.generics_of(def_id).count(); if count == 0 { @@ -134,31 +133,31 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for TermsContext<'a, 'tcx> { match item.node { hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { - self.add_inferreds_for_item(item.id); + self.add_inferreds_for_item(item.hir_id); if let hir::VariantData::Tuple(..) = *struct_def { - self.add_inferreds_for_item(struct_def.id()); + self.add_inferreds_for_item(struct_def.hir_id()); } } hir::ItemKind::Enum(ref enum_def, _) => { - self.add_inferreds_for_item(item.id); + self.add_inferreds_for_item(item.hir_id); for variant in &enum_def.variants { if let hir::VariantData::Tuple(..) = variant.node.data { - self.add_inferreds_for_item(variant.node.data.id()); + self.add_inferreds_for_item(variant.node.data.hir_id()); } } } hir::ItemKind::Fn(..) => { - self.add_inferreds_for_item(item.id); + self.add_inferreds_for_item(item.hir_id); } hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { if let hir::ForeignItemKind::Fn(..) = foreign_item.node { - self.add_inferreds_for_item(foreign_item.id); + self.add_inferreds_for_item(foreign_item.hir_id); } } } @@ -169,13 +168,13 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for TermsContext<'a, 'tcx> { fn visit_trait_item(&mut self, trait_item: &hir::TraitItem) { if let hir::TraitItemKind::Method(..) = trait_item.node { - self.add_inferreds_for_item(trait_item.id); + self.add_inferreds_for_item(trait_item.hir_id); } } fn visit_impl_item(&mut self, impl_item: &hir::ImplItem) { if let hir::ImplItemKind::Method(..) = impl_item.node { - self.add_inferreds_for_item(impl_item.id); + self.add_inferreds_for_item(impl_item.hir_id); } } } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 032452115d6f..2be4fbe4d7c8 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2022,14 +2022,15 @@ impl Clean for hir::TraitItem { AssociatedTypeItem(bounds.clean(cx), default.clean(cx)) } }; + let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id); Item { name: Some(self.ident.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.span.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: local_did, visibility: None, - stability: get_stability(cx, cx.tcx.hir().local_def_id(self.id)), - deprecation: get_deprecation(cx, cx.tcx.hir().local_def_id(self.id)), + stability: get_stability(cx, local_did), + deprecation: get_deprecation(cx, local_did), inner, } } From c2e517e0c4eabda5f71bec1124ed5bb746c39eb0 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 26 Feb 2019 11:48:34 +0100 Subject: [PATCH 148/381] ty: HirIdify some lints --- src/librustc/lint/context.rs | 3 +- src/librustc/middle/stability.rs | 5 ++- src/librustc/traits/specialize/mod.rs | 4 +-- src/librustc/ty/context.rs | 33 ++++--------------- src/librustc_mir/hair/pattern/check_match.rs | 16 ++++----- src/librustc_mir/hair/pattern/mod.rs | 3 +- src/librustc_mir/lints.rs | 10 +++--- src/librustc_mir/transform/check_unsafety.rs | 14 ++++---- src/librustc_mir/transform/const_prop.rs | 8 ++--- src/librustc_privacy/lib.rs | 16 ++++----- src/librustc_typeck/check_unused.rs | 17 +++++----- .../coherence/inherent_impls_overlap.rs | 8 ++--- .../passes/collect_intra_doc_links.rs | 4 +-- src/librustdoc/passes/mod.rs | 10 +++--- 14 files changed, 62 insertions(+), 89 deletions(-) diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index a856bfbfd7ee..9761ee313533 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -729,8 +729,7 @@ impl<'a, 'tcx> LintContext<'tcx> for LateContext<'a, 'tcx> { match span { Some(s) => self.tcx.struct_span_lint_hir(lint, hir_id, s, msg), None => { - let node_id = self.tcx.hir().hir_to_node_id(hir_id); // FIXME(@ljedrz): remove later - self.tcx.struct_lint_node(lint, node_id, msg) + self.tcx.struct_lint_node(lint, hir_id, msg) }, } } diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index f85b80605449..5b7bfab5acc7 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -13,7 +13,6 @@ use crate::middle::privacy::AccessLevels; use crate::session::{DiagnosticMessageId, Session}; use syntax::symbol::Symbol; use syntax_pos::{Span, MultiSpan}; -use syntax::ast; use syntax::ast::Attribute; use syntax::errors::Applicability; use syntax::feature_gate::{GateIssue, emit_feature_err}; @@ -922,8 +921,8 @@ fn unnecessary_stable_feature_lint<'a, 'tcx>( feature: Symbol, since: Symbol ) { - tcx.lint_node(lint::builtin::STABLE_FEATURES, - ast::CRATE_NODE_ID, + tcx.lint_hir(lint::builtin::STABLE_FEATURES, + hir::CRATE_HIR_ID, span, &format!("the feature `{}` has been stable since {} and no longer requires \ an attribute to enable", feature, since)); diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index 1d84f22acd9f..a2924cb993fb 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -334,9 +334,9 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>( FutureCompatOverlapErrorKind::Issue33140 => lint::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS, }; - tcx.struct_span_lint_node( + tcx.struct_span_lint_hir( lint, - tcx.hir().as_local_node_id(impl_def_id).unwrap(), + tcx.hir().as_local_hir_id(impl_def_id).unwrap(), impl_span, &msg) } else { diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index d02c9fc174c6..1983dfbd4b7d 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -65,7 +65,7 @@ use std::sync::mpsc; use std::sync::Arc; use std::marker::PhantomData; use rustc_target::spec::abi; -use syntax::ast::{self, NodeId}; +use syntax::ast; use syntax::attr; use syntax::source_map::MultiSpan; use syntax::edition::Edition; @@ -2836,14 +2836,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.struct_span_lint_hir(lint, hir_id, span.into(), msg).emit() } - pub fn lint_node>(self, - lint: &'static Lint, - id: NodeId, - span: S, - msg: &str) { - self.struct_span_lint_node(lint, id, span.into(), msg).emit() - } - pub fn lint_hir_note>(self, lint: &'static Lint, hir_id: HirId, @@ -2866,7 +2858,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { err.emit() } - pub fn lint_level_at_node(self, lint: &'static Lint, mut id: NodeId) + pub fn lint_level_at_node(self, lint: &'static Lint, mut id: hir::HirId) -> (lint::Level, lint::LintSource) { // Right now we insert a `with_ignore` node in the dep graph here to @@ -2880,11 +2872,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.dep_graph.with_ignore(|| { let sets = self.lint_levels(LOCAL_CRATE); loop { - let hir_id = self.hir().definitions().node_to_hir_id(id); - if let Some(pair) = sets.level_and_source(lint, hir_id, self.sess) { + if let Some(pair) = sets.level_and_source(lint, id, self.sess) { return pair } - let next = self.hir().get_parent_node(id); + let next = self.hir().get_parent_node_by_hir_id(id); if next == id { bug!("lint traversal reached the root of the crate"); } @@ -2900,23 +2891,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { msg: &str) -> DiagnosticBuilder<'tcx> { - let node_id = self.hir().hir_to_node_id(hir_id); - let (level, src) = self.lint_level_at_node(lint, node_id); + let (level, src) = self.lint_level_at_node(lint, hir_id); lint::struct_lint_level(self.sess, lint, level, src, Some(span.into()), msg) } - pub fn struct_span_lint_node>(self, - lint: &'static Lint, - id: NodeId, - span: S, - msg: &str) - -> DiagnosticBuilder<'tcx> - { - let (level, src) = self.lint_level_at_node(lint, id); - lint::struct_lint_level(self.sess, lint, level, src, Some(span.into()), msg) - } - - pub fn struct_lint_node(self, lint: &'static Lint, id: NodeId, msg: &str) + pub fn struct_lint_node(self, lint: &'static Lint, id: HirId, msg: &str) -> DiagnosticBuilder<'tcx> { let (level, src) = self.lint_level_at_node(lint, id); diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 9cecf4af7d44..0f151cd688df 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -346,9 +346,9 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, NotUseful => { match source { hir::MatchSource::IfLetDesugar { .. } => { - cx.tcx.lint_node( + cx.tcx.lint_hir( lint::builtin::IRREFUTABLE_LET_PATTERNS, - hir_pat.id, + hir_pat.hir_id, pat.span, "irrefutable if-let pattern", ); @@ -359,16 +359,16 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, match arm_index { // The arm with the user-specified pattern. 0 => { - cx.tcx.lint_node( + cx.tcx.lint_hir( lint::builtin::UNREACHABLE_PATTERNS, - hir_pat.id, pat.span, + hir_pat.hir_id, pat.span, "unreachable pattern"); }, // The arm with the wildcard pattern. 1 => { - cx.tcx.lint_node( + cx.tcx.lint_hir( lint::builtin::IRREFUTABLE_LET_PATTERNS, - hir_pat.id, + hir_pat.hir_id, pat.span, "irrefutable while-let pattern", ); @@ -379,9 +379,9 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, hir::MatchSource::ForLoopDesugar | hir::MatchSource::Normal => { - let mut err = cx.tcx.struct_span_lint_node( + let mut err = cx.tcx.struct_span_lint_hir( lint::builtin::UNREACHABLE_PATTERNS, - hir_pat.id, + hir_pat.hir_id, pat.span, "unreachable pattern", ); diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index c234c2474ff1..d5f2e7a7275e 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -955,8 +955,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { debug!("const_to_pat: cv.ty={:?} span={:?}", cv.ty, span); let kind = match cv.ty.sty { ty::Float(_) => { - let id = self.tcx.hir().hir_to_node_id(id); - self.tcx.lint_node( + self.tcx.lint_hir( ::rustc::lint::builtin::ILLEGAL_FLOATING_POINT_LITERAL_PATTERN, id, span, diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index bf6d6e1ba739..bfc977c28cd3 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -129,12 +129,12 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>, // no break */ }`) shouldn't be linted unless it actually // recurs. if !reached_exit_without_self_call && !self_call_locations.is_empty() { - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let sp = tcx.sess.source_map().def_span(tcx.hir().span_by_hir_id(hir_id)); - let mut db = tcx.struct_span_lint_node(UNCONDITIONAL_RECURSION, - node_id, - sp, - "function cannot return without recursing"); + let mut db = tcx.struct_span_lint_hir(UNCONDITIONAL_RECURSION, + hir_id, + sp, + "function cannot return without recursing"); db.span_label(sp, "cannot return without recursing"); // offer some help to the programmer. for location in &self_call_locations { diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 3ed63d749cd3..caddc23077dc 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -553,10 +553,8 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) } fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { - let lint_node_id = match tcx.hir().as_local_node_id(def_id) { - Some(node_id) => node_id, - None => bug!("checking unsafety for non-local def id {:?}", def_id) - }; + let lint_hir_id = tcx.hir().as_local_hir_id(def_id).unwrap_or_else(|| + bug!("checking unsafety for non-local def id {:?}", def_id)); // FIXME: when we make this a hard error, this should have its // own error code. @@ -567,10 +565,10 @@ fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: D "#[derive] can't be used on a #[repr(packed)] struct that \ does not derive Copy (error E0133)".to_string() }; - tcx.lint_node(SAFE_PACKED_BORROWS, - lint_node_id, - tcx.def_span(def_id), - &message); + tcx.lint_hir(SAFE_PACKED_BORROWS, + lint_hir_id, + tcx.def_span(def_id), + &message); } /// Returns the `HirId` for an enclosing scope that is also `unsafe`. diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 5ed0055e7c4f..ed0e27a1f785 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -603,10 +603,10 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { .unwrap() .source_info .span; - let node_id = self + let hir_id = self .tcx .hir() - .as_local_node_id(self.source.def_id()) + .as_local_hir_id(self.source.def_id()) .expect("some part of a failing const eval must be local"); use rustc::mir::interpret::EvalErrorKind::*; let msg = match msg { @@ -643,9 +643,9 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { // Need proper const propagator for these _ => return, }; - self.tcx.lint_node( + self.tcx.lint_hir( ::rustc::lint::builtin::CONST_ERR, - node_id, + hir_id, span, &msg, ); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 93305797eef0..6c03dbd8f0b4 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1539,12 +1539,12 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { if self.leaks_private_dep(def_id) { - self.tcx.lint_node(lint::builtin::EXPORTED_PRIVATE_DEPENDENCIES, - self.item_id, - self.span, - &format!("{} `{}` from private dependency '{}' in public \ - interface", kind, descr, - self.tcx.crate_name(def_id.krate))); + self.tcx.lint_hir(lint::builtin::EXPORTED_PRIVATE_DEPENDENCIES, + self.item_id, + self.span, + &format!("{} `{}` from private dependency '{}' in public \ + interface", kind, descr, + self.tcx.crate_name(def_id.krate))); } @@ -1567,8 +1567,8 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { err.emit(); } else { let err_code = if kind == "trait" { "E0445" } else { "E0446" }; - self.tcx.lint_node(lint::builtin::PRIVATE_IN_PUBLIC, node_id, self.span, - &format!("{} (error {})", msg, err_code)); + self.tcx.lint_hir(lint::builtin::PRIVATE_IN_PUBLIC, hir_id, self.span, + &format!("{} (error {})", msg, err_code)); } } diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index 3da090aed9c9..4c6d7710009b 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -51,14 +51,13 @@ struct CheckVisitor<'a, 'tcx: 'a> { } impl<'a, 'tcx> CheckVisitor<'a, 'tcx> { - fn check_import(&self, id: ast::NodeId, span: Span) { - let def_id = self.tcx.hir().local_def_id(id); + fn check_import(&self, id: hir::HirId, span: Span) { + let def_id = self.tcx.hir().local_def_id_from_hir_id(id); if !self.tcx.maybe_unused_trait_import(def_id) { return; } - let import_def_id = self.tcx.hir().local_def_id(id); - if self.used_trait_imports.contains(&import_def_id) { + if self.used_trait_imports.contains(&def_id) { return; } @@ -67,7 +66,7 @@ impl<'a, 'tcx> CheckVisitor<'a, 'tcx> { } else { "unused import".to_owned() }; - self.tcx.lint_node(lint::builtin::UNUSED_IMPORTS, id, span, &msg); + self.tcx.lint_hir(lint::builtin::UNUSED_IMPORTS, id, span, &msg); } } @@ -121,8 +120,8 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { }); for extern_crate in &crates_to_lint { - let id = tcx.hir().as_local_node_id(extern_crate.def_id).unwrap(); - let item = tcx.hir().expect_item(id); + let id = tcx.hir().as_local_hir_id(extern_crate.def_id).unwrap(); + let item = tcx.hir().expect_item_by_hir_id(id); // If the crate is fully unused, we suggest removing it altogether. // We do this in any edition. @@ -135,7 +134,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { .map(|attr| attr.span) .fold(span, |acc, attr_span| acc.to(attr_span)); - tcx.struct_span_lint_node(lint, id, span, msg) + tcx.struct_span_lint_hir(lint, id, span, msg) .span_suggestion_short( span_with_attrs, "remove it", @@ -177,7 +176,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { None => format!("use {};", item.ident.name), }; let replacement = visibility_qualified(&item.vis, base_replacement); - tcx.struct_span_lint_node(lint, id, extern_crate.span, msg) + tcx.struct_span_lint_hir(lint, id, extern_crate.span, msg) .span_suggestion_short( extern_crate.span, &help, diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs index 282f1bad172d..a51f45a6ff8f 100644 --- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs +++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs @@ -36,11 +36,11 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> { for &item2 in &impl_items2[..] { if (name, namespace) == name_and_namespace(item2) { - let node_id = self.tcx.hir().as_local_node_id(impl1); - let mut err = if used_to_be_allowed && node_id.is_some() { - self.tcx.struct_span_lint_node( + let hir_id = self.tcx.hir().as_local_hir_id(impl1); + let mut err = if used_to_be_allowed && hir_id.is_some() { + self.tcx.struct_span_lint_hir( lint::builtin::INCOHERENT_FUNDAMENTAL_IMPLS, - node_id.unwrap(), + hir_id.unwrap(), self.tcx.span_of_impl(item1).unwrap(), &format!("duplicate definitions with name `{}` (E0592)", name) ) diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 67f291285c44..25c86b24c187 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -473,9 +473,9 @@ fn resolution_failure( ) { let sp = span_of_attrs(attrs); - let mut diag = cx.tcx.struct_span_lint_node( + let mut diag = cx.tcx.struct_span_lint_hir( lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE, - NodeId::from_u32(0), + hir::CRATE_HIR_ID, sp, &format!("`[{}]` cannot be resolved, ignoring it...", path_str), ); diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index 3a9d8ef20ce8..d6f3585a04f3 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -1,12 +1,12 @@ //! Contains information about "passes", used to modify crate information during the documentation //! process. +use rustc::hir; use rustc::hir::def_id::DefId; use rustc::lint as lint; use rustc::middle::privacy::AccessLevels; use rustc::util::nodemap::DefIdSet; use std::mem; -use syntax::ast::NodeId; use syntax_pos::{DUMMY_SP, Span}; use std::ops::Range; @@ -312,18 +312,18 @@ pub fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a>( if find_testable_code(&dox, &mut tests, ErrorCodes::No).is_ok() { if check_missing_code == true && tests.found_tests == 0 { - let mut diag = cx.tcx.struct_span_lint_node( + let mut diag = cx.tcx.struct_span_lint_hir( lint::builtin::MISSING_DOC_CODE_EXAMPLES, - NodeId::from_u32(0), + hir::CRATE_HIR_ID, span_of_attrs(&item.attrs), "Missing code example in this documentation"); diag.emit(); } else if check_missing_code == false && tests.found_tests > 0 && !cx.renderinfo.borrow().access_levels.is_doc_reachable(item.def_id) { - let mut diag = cx.tcx.struct_span_lint_node( + let mut diag = cx.tcx.struct_span_lint_hir( lint::builtin::PRIVATE_DOC_TESTS, - NodeId::from_u32(0), + hir::CRATE_HIR_ID, span_of_attrs(&item.attrs), "Documentation test in private item"); diag.emit(); From a29ceb9f51390293e0833f763b7490e70da255c5 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 26 Feb 2019 15:11:59 +0100 Subject: [PATCH 149/381] hir: remove NodeId from ImplItem --- src/librustc/hir/intravisit.rs | 1 - src/librustc/hir/lowering.rs | 1 - src/librustc/hir/map/collector.rs | 2 +- src/librustc/hir/map/mod.rs | 2 +- src/librustc/hir/mod.rs | 1 - src/librustc/ich/impls_hir.rs | 1 - src/librustc/middle/reachable.rs | 2 +- src/librustc/middle/stability.rs | 3 ++- src/librustc_lint/builtin.rs | 13 +++++++------ src/librustc_mir/monomorphize/collector.rs | 2 +- src/librustc_privacy/lib.rs | 7 +++++-- src/librustc_typeck/check/mod.rs | 3 ++- src/librustc_typeck/check/wfcheck.rs | 2 +- src/librustc_typeck/collect.rs | 10 +++++----- src/librustdoc/clean/mod.rs | 7 ++++--- 15 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 8e4b9a5e8e64..85549bc667f9 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -878,7 +878,6 @@ pub fn walk_trait_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_item_ref: pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplItem) { // N.B., deliberately force a compilation error if/when new fields are added. let ImplItem { - id: _, hir_id: _, ident, ref vis, diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 3add88c05e75..856550aa018b 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -3426,7 +3426,6 @@ impl<'a> LoweringContext<'a> { }; hir::ImplItem { - id: node_id, hir_id, ident: i.ident, attrs: self.lower_attrs(&i.attrs), diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index cf48e9cab63c..0425d5a50238 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -398,7 +398,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { fn visit_impl_item(&mut self, ii: &'hir ImplItem) { debug_assert_eq!(ii.hir_id.owner, - self.definitions.opt_def_index(ii.id).unwrap()); + self.definitions.opt_def_index(self.hir_to_node_id[&ii.hir_id]).unwrap()); self.with_dep_node_owner(ii.hir_id.owner, ii, |this| { this.insert(ii.span, ii.hir_id, Node::ImplItem(ii)); diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 05180f308567..66e814f06609 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -357,7 +357,7 @@ impl<'hir> Map<'hir> { } } Node::ImplItem(item) => { - let def_id = self.local_def_id(item.id); + let def_id = self.local_def_id_from_hir_id(item.hir_id); match item.node { ImplItemKind::Const(..) => Some(Def::AssociatedConst(def_id)), ImplItemKind::Method(..) => Some(Def::Method(def_id)), diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 486372248c51..1a95d567c721 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1710,7 +1710,6 @@ pub struct ImplItemId { /// Represents anything within an `impl` block #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct ImplItem { - pub id: NodeId, pub ident: Ident, pub hir_id: HirId, pub vis: Visibility, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 0a53bdeae842..5774b1049141 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -703,7 +703,6 @@ impl<'a> HashStable> for hir::ImplItem { hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { let hir::ImplItem { - id: _, hir_id: _, ident, ref vis, diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 0562fddb2b52..cffbc2eaa40c 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -48,7 +48,7 @@ fn method_might_be_inlined<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_item: &hir::ImplItem, impl_src: DefId) -> bool { let codegen_fn_attrs = tcx.codegen_fn_attrs(impl_item.hir_id.owner_def_id()); - let generics = tcx.generics_of(tcx.hir().local_def_id(impl_item.id)); + let generics = tcx.generics_of(tcx.hir().local_def_id_from_hir_id(impl_item.hir_id)); if codegen_fn_attrs.requests_inline() || generics.requires_monomorphization(tcx) { return true } diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 5b7bfab5acc7..3c1b49e2dde6 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -355,7 +355,8 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> { } fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) { - let impl_def_id = self.tcx.hir().local_def_id(self.tcx.hir().get_parent(ii.id)); + let impl_def_id = self.tcx.hir().local_def_id_from_hir_id( + self.tcx.hir().get_parent_item(ii.hir_id)); if self.tcx.impl_trait_ref(impl_def_id).is_none() { self.check_missing_stability(ii.hir_id, ii.span, "item"); } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index c9cbffbaefe9..4d484a64f47d 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1112,11 +1112,12 @@ impl LintPass for UnreachablePub { } impl UnreachablePub { - fn perform_lint(&self, cx: &LateContext<'_, '_>, what: &str, id: ast::NodeId, + fn perform_lint(&self, cx: &LateContext<'_, '_>, what: &str, id: hir::HirId, vis: &hir::Visibility, span: Span, exportable: bool) { let mut applicability = Applicability::MachineApplicable; + let node_id = cx.tcx.hir().hir_to_node_id(id); match vis.node { - hir::VisibilityKind::Public if !cx.access_levels.is_reachable(id) => { + hir::VisibilityKind::Public if !cx.access_levels.is_reachable(node_id) => { if span.ctxt().outer().expn_info().is_some() { applicability = Applicability::MaybeIncorrect; } @@ -1148,20 +1149,20 @@ impl UnreachablePub { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnreachablePub { fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) { - self.perform_lint(cx, "item", item.id, &item.vis, item.span, true); + self.perform_lint(cx, "item", item.hir_id, &item.vis, item.span, true); } fn check_foreign_item(&mut self, cx: &LateContext<'_, '_>, foreign_item: &hir::ForeignItem) { - self.perform_lint(cx, "item", foreign_item.id, &foreign_item.vis, + self.perform_lint(cx, "item", foreign_item.hir_id, &foreign_item.vis, foreign_item.span, true); } fn check_struct_field(&mut self, cx: &LateContext<'_, '_>, field: &hir::StructField) { - self.perform_lint(cx, "field", field.id, &field.vis, field.span, false); + self.perform_lint(cx, "field", field.hir_id, &field.vis, field.span, false); } fn check_impl_item(&mut self, cx: &LateContext<'_, '_>, impl_item: &hir::ImplItem) { - self.perform_lint(cx, "item", impl_item.id, &impl_item.vis, impl_item.span, false); + self.perform_lint(cx, "item", impl_item.hir_id, &impl_item.vis, impl_item.span, false); } } diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 4cec306412e8..a58c69f636d4 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -1006,7 +1006,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { fn visit_impl_item(&mut self, ii: &'v hir::ImplItem) { match ii.node { hir::ImplItemKind::Method(hir::MethodSig { .. }, _) => { - let def_id = self.tcx.hir().local_def_id(ii.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(ii.hir_id); self.push_if_root(def_id); } _ => { /* Nothing to do here */ } diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 6c03dbd8f0b4..4a73f86ef6fe 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1318,7 +1318,9 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { match impl_item.node { hir::ImplItemKind::Const(..) | hir::ImplItemKind::Method(..) => { - self.access_levels.is_reachable(impl_item.id) + let node_id = self.tcx.hir().hir_to_node_id( + impl_item.hir_id); + self.access_levels.is_reachable(node_id) } hir::ImplItemKind::Existential(..) | hir::ImplItemKind::Type(_) => false, @@ -1340,10 +1342,11 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { // don't erroneously report errors for private // types in private items. let impl_item = self.tcx.hir().impl_item(impl_item_ref.id); + let node_id = self.tcx.hir().hir_to_node_id(impl_item.hir_id); match impl_item.node { hir::ImplItemKind::Const(..) | hir::ImplItemKind::Method(..) - if self.item_is_public(&impl_item.id, &impl_item.vis) => + if self.item_is_public(&node_id, &impl_item.vis) => { intravisit::walk_impl_item(self, impl_item) } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 89ad6d402b68..80ffe4415610 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1554,7 +1554,8 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Check existing impl methods to see if they are both present in trait // and compatible with trait signature for impl_item in impl_items() { - let ty_impl_item = tcx.associated_item(tcx.hir().local_def_id(impl_item.id)); + let ty_impl_item = tcx.associated_item( + tcx.hir().local_def_id_from_hir_id(impl_item.hir_id)); let ty_trait_item = tcx.associated_items(impl_trait_ref.def_id) .find(|ac| Namespace::from(&impl_item.node) == Namespace::from(ac.kind) && tcx.hygienic_eq(ty_impl_item.ident, ac.ident, impl_trait_ref.def_id)) diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 154449a38f4e..b7c862a89a1b 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -1030,7 +1030,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'a, 'tcx> { fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) { debug!("visit_impl_item: {:?}", impl_item); - let def_id = self.tcx.hir().local_def_id(impl_item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(impl_item.hir_id); self.tcx.ensure().check_impl_item_well_formed(def_id); } } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index c11fed089139..16102ad4cde3 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -157,7 +157,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { } fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) { - convert_impl_item(self.tcx, impl_item.id); + convert_impl_item(self.tcx, impl_item.hir_id); intravisit::walk_impl_item(self, impl_item); } } @@ -500,12 +500,12 @@ fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_item_id: hir: tcx.predicates_of(def_id); } -fn convert_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_item_id: ast::NodeId) { - let def_id = tcx.hir().local_def_id(impl_item_id); +fn convert_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_item_id: hir::HirId) { + let def_id = tcx.hir().local_def_id_from_hir_id(impl_item_id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); - if let hir::ImplItemKind::Method(..) = tcx.hir().expect_impl_item(impl_item_id).node { + if let hir::ImplItemKind::Method(..) = tcx.hir().expect_impl_item_by_hir_id(impl_item_id).node { tcx.fn_sig(def_id); } } @@ -1485,7 +1485,7 @@ fn find_existential_constraints<'a, 'tcx>( } } fn visit_impl_item(&mut self, it: &'tcx ImplItem) { - let def_id = self.tcx.hir().local_def_id(it.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(it.hir_id); // the existential type itself or its children are not within its reveal scope if def_id != self.def_id { self.check(def_id); diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 2be4fbe4d7c8..d88d0dab4f0e 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2055,14 +2055,15 @@ impl Clean for hir::ImplItem { generics: Generics::default(), }, true), }; + let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id); Item { name: Some(self.ident.name.clean(cx)), source: self.span.clean(cx), attrs: self.attrs.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: local_did, visibility: self.vis.clean(cx), - stability: get_stability(cx, cx.tcx.hir().local_def_id(self.id)), - deprecation: get_deprecation(cx, cx.tcx.hir().local_def_id(self.id)), + stability: get_stability(cx, local_did), + deprecation: get_deprecation(cx, local_did), inner, } } From 2827f8d4fef702b778aef044d044cd51e655e9cd Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 26 Feb 2019 15:27:56 +0100 Subject: [PATCH 150/381] hir: remove NodeId from TypeBinding --- src/librustc/hir/lowering.rs | 9 +++------ src/librustc/hir/mod.rs | 1 - src/librustc/ich/impls_hir.rs | 1 - 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 856550aa018b..33d95149e9c0 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -1151,10 +1151,9 @@ impl<'a> LoweringContext<'a> { fn lower_ty_binding(&mut self, b: &TypeBinding, itctx: ImplTraitContext<'_>) -> hir::TypeBinding { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(b.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(b.id); hir::TypeBinding { - id: node_id, hir_id, ident: b.ident, ty: self.lower_ty(&b.ty, itctx), @@ -1982,14 +1981,13 @@ impl<'a> LoweringContext<'a> { let LoweredNodeId { node_id: _, hir_id } = this.next_id(); hir::Ty { node: hir::TyKind::Tup(tys), hir_id, span } }; - let LoweredNodeId { node_id, hir_id } = this.next_id(); + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); ( hir::GenericArgs { args: hir_vec![GenericArg::Type(mk_tup(this, inputs, span))], bindings: hir_vec![ hir::TypeBinding { - id: node_id, hir_id, ident: Ident::from_str(FN_OUTPUT_NAME), ty: output @@ -2326,13 +2324,12 @@ impl<'a> LoweringContext<'a> { }; // "" - let LoweredNodeId { node_id, hir_id } = this.next_id(); + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); let future_params = P(hir::GenericArgs { args: hir_vec![], bindings: hir_vec![hir::TypeBinding { ident: Ident::from_str(FN_OUTPUT_NAME), ty: output_ty, - id: node_id, hir_id, span, }], diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 1a95d567c721..3d272c0e251c 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1737,7 +1737,6 @@ pub enum ImplItemKind { // Bind a type to an associated type: `A=Foo`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct TypeBinding { - pub id: NodeId, pub hir_id: HirId, pub ident: Ident, pub ty: P, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 5774b1049141..d601d1e15578 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -294,7 +294,6 @@ impl_stable_hash_for!(struct hir::MethodSig { }); impl_stable_hash_for!(struct hir::TypeBinding { - id, hir_id, ident -> (ident.name), ty, From aa6a9c3f416cc73be8591f05c2b98862b7a500f0 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 26 Feb 2019 15:33:07 +0100 Subject: [PATCH 151/381] hir: remove NodeId from Arg --- src/librustc/hir/lowering.rs | 3 +-- src/librustc/hir/mod.rs | 1 - src/librustc/ich/impls_hir.rs | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 33d95149e9c0..b636e6f811d5 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -2042,9 +2042,8 @@ impl<'a> LoweringContext<'a> { } fn lower_arg(&mut self, arg: &Arg) -> hir::Arg { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(arg.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(arg.id); hir::Arg { - id: node_id, hir_id, pat: self.lower_pat(&arg.pat), } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 3d272c0e251c..4eadfdd18e67 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1852,7 +1852,6 @@ pub struct InlineAsm { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Arg { pub pat: P, - pub id: NodeId, pub hir_id: HirId, } diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index d601d1e15578..112127c8db17 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -955,7 +955,6 @@ impl_stable_hash_for!(enum hir::StmtKind { impl_stable_hash_for!(struct hir::Arg { pat, - id, hir_id }); From 01cf66bb3074f8de056905e09fb9839e15f4b816 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 26 Feb 2019 15:47:14 +0100 Subject: [PATCH 152/381] hir: remove NodeId from TraitRef --- src/librustc/hir/lowering.rs | 7 ++----- src/librustc/hir/mod.rs | 1 - src/librustc/ich/impls_hir.rs | 3 +-- src/librustc_typeck/astconv.rs | 5 ++--- src/librustc_typeck/lib.rs | 4 ++-- src/librustdoc/clean/auto_trait.rs | 1 - src/librustdoc/clean/blanket_impl.rs | 1 - 7 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index b636e6f811d5..738c7d770353 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -2338,13 +2338,12 @@ impl<'a> LoweringContext<'a> { let future_path = this.std_path(span, &["future", "Future"], Some(future_params), false); - let LoweredNodeId { node_id, hir_id } = this.next_id(); + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); let mut bounds = vec![ hir::GenericBound::Trait( hir::PolyTraitRef { trait_ref: hir::TraitRef { path: future_path, - ref_id: node_id, hir_ref_id: hir_id, }, bound_generic_params: hir_vec![], @@ -2714,10 +2713,9 @@ impl<'a> LoweringContext<'a> { hir::QPath::Resolved(None, path) => path.and_then(|path| path), qpath => bug!("lower_trait_ref: unexpected QPath `{:?}`", qpath), }; - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(p.ref_id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(p.ref_id); hir::TraitRef { path, - ref_id: node_id, hir_ref_id: hir_id, } } @@ -5056,7 +5054,6 @@ impl<'a> LoweringContext<'a> { bound_generic_params: hir::HirVec::new(), trait_ref: hir::TraitRef { path: path.and_then(|path| path), - ref_id: id.node_id, hir_ref_id: id.hir_id, }, span, diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 4eadfdd18e67..3a2a1f3f3dd0 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -2062,7 +2062,6 @@ pub enum UseKind { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct TraitRef { pub path: Path, - pub ref_id: NodeId, pub hir_ref_id: HirId, } diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 112127c8db17..1bfb036495b5 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -385,8 +385,7 @@ impl_stable_hash_for!(enum hir::ImplicitSelfKind { }); impl_stable_hash_for!(struct hir::TraitRef { - // Don't hash the ref_id. It is tracked via the thing it is used to access - ref_id -> _, + // Don't hash the hir_ref_id. It is tracked via the thing it is used to access hir_ref_id -> _, path, }); diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 37dcaa014596..5dbcf908020b 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -718,7 +718,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { // specify type to assert that error was already reported in Err case: let predicate: Result<_, ErrorReported> = self.ast_type_binding_to_poly_projection_predicate( - trait_ref.ref_id, poly_trait_ref, binding, speculative, &mut dup_bindings); + trait_ref.hir_ref_id, poly_trait_ref, binding, speculative, &mut dup_bindings); // okay to ignore Err because of ErrorReported (see above) Some((predicate.ok()?, binding.span)) })); @@ -802,7 +802,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { fn ast_type_binding_to_poly_projection_predicate( &self, - ref_id: ast::NodeId, + hir_ref_id: hir::HirId, trait_ref: ty::PolyTraitRef<'tcx>, binding: &ConvertedBinding<'tcx>, speculative: bool, @@ -874,7 +874,6 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { binding.item_name, binding.span) }?; - let hir_ref_id = self.tcx().hir().node_to_hir_id(ref_id); let (assoc_ident, def_scope) = tcx.adjust_ident(binding.item_name, candidate.def_id(), hir_ref_id); let assoc_ty = tcx.associated_items(candidate.def_id()).find(|i| { diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 00c2ab792869..a918113b1fc0 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -386,8 +386,8 @@ pub fn hir_trait_to_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_trait: // In case there are any projections etc, find the "environment" // def-id that will be used to determine the traits/predicates in // scope. This is derived from the enclosing item-like thing. - let env_node_id = tcx.hir().get_parent(hir_trait.ref_id); - let env_def_id = tcx.hir().local_def_id(env_node_id); + let env_hir_id = tcx.hir().get_parent_item(hir_trait.hir_ref_id); + let env_def_id = tcx.hir().local_def_id_from_hir_id(env_hir_id); let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id); let mut projections = Vec::new(); let (principal, _) = astconv::AstConv::instantiate_poly_trait_ref_inner( diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index 952541bb85f9..d07a4579ad5c 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -115,7 +115,6 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> { if result.is_auto() { let trait_ = hir::TraitRef { path: get_path_for_type(self.cx.tcx, trait_def_id, hir::def::Def::Trait), - ref_id: ast::DUMMY_NODE_ID, hir_ref_id: hir::DUMMY_HIR_ID, }; diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index 55abcb4a93bd..5a13490eeccf 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -123,7 +123,6 @@ impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> { path: get_path_for_type(infcx.tcx, trait_def_id, hir::def::Def::Trait), - ref_id: ast::DUMMY_NODE_ID, hir_ref_id: hir::DUMMY_HIR_ID, }; let provided_trait_methods = From 9cd184590847ae20f3e49c3f23d8118632011872 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 26 Feb 2019 15:55:01 +0100 Subject: [PATCH 153/381] hir: remove NodeId from VisibilityKind --- src/librustc/hir/intravisit.rs | 2 +- src/librustc/hir/lowering.rs | 7 ++----- src/librustc/hir/mod.rs | 2 +- src/librustc/ich/impls_hir.rs | 3 +-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 85549bc667f9..0aeac8cc440e 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -1105,7 +1105,7 @@ pub fn walk_arm<'v, V: Visitor<'v>>(visitor: &mut V, arm: &'v Arm) { } pub fn walk_vis<'v, V: Visitor<'v>>(visitor: &mut V, vis: &'v Visibility) { - if let VisibilityKind::Restricted { ref path, id: _, hir_id } = vis.node { + if let VisibilityKind::Restricted { ref path, hir_id } = vis.node { visitor.visit_id(hir_id); visitor.visit_path(path, hir_id) } diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 738c7d770353..a97ea7da7f19 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -3115,12 +3115,11 @@ impl<'a> LoweringContext<'a> { hir::VisibilityKind::Public => hir::VisibilityKind::Public, hir::VisibilityKind::Crate(sugar) => hir::VisibilityKind::Crate(sugar), hir::VisibilityKind::Inherited => hir::VisibilityKind::Inherited, - hir::VisibilityKind::Restricted { ref path, id: _, hir_id: _ } => { + hir::VisibilityKind::Restricted { ref path, hir_id: _ } => { let id = this.next_id(); let path = this.renumber_segment_ids(path); hir::VisibilityKind::Restricted { path, - id: id.node_id, hir_id: id.hir_id, } } @@ -3222,12 +3221,11 @@ impl<'a> LoweringContext<'a> { hir::VisibilityKind::Public => hir::VisibilityKind::Public, hir::VisibilityKind::Crate(sugar) => hir::VisibilityKind::Crate(sugar), hir::VisibilityKind::Inherited => hir::VisibilityKind::Inherited, - hir::VisibilityKind::Restricted { ref path, id: _, hir_id: _ } => { + hir::VisibilityKind::Restricted { ref path, hir_id: _ } => { let id = this.next_id(); let path = this.renumber_segment_ids(path); hir::VisibilityKind::Restricted { path: path, - id: id.node_id, hir_id: id.hir_id, } } @@ -4721,7 +4719,6 @@ impl<'a> LoweringContext<'a> { ParamMode::Explicit, explicit_owner, )), - id: lowered_id.node_id, hir_id: lowered_id.hir_id, } }, diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 3a2a1f3f3dd0..3ba4efba9186 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -2096,7 +2096,7 @@ pub type Visibility = Spanned; pub enum VisibilityKind { Public, Crate(CrateSugar), - Restricted { path: P, id: NodeId, hir_id: HirId }, + Restricted { path: P, hir_id: HirId }, Inherited, } diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 1bfb036495b5..af1cce5e3545 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -748,9 +748,8 @@ impl<'a> HashStable> for hir::VisibilityKind { hir::VisibilityKind::Crate(sugar) => { sugar.hash_stable(hcx, hasher); } - hir::VisibilityKind::Restricted { ref path, id, hir_id } => { + hir::VisibilityKind::Restricted { ref path, hir_id } => { hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { - id.hash_stable(hcx, hasher); hir_id.hash_stable(hcx, hasher); }); path.hash_stable(hcx, hasher); From c259489209449a49d136dab4f09f7fcadd8f078c Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 1 Mar 2019 11:23:25 +0100 Subject: [PATCH 154/381] tools/remote-test-{client,server}: deny(rust_2018_idioms) --- src/tools/remote-test-client/src/main.rs | 4 +++- src/tools/remote-test-server/src/main.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tools/remote-test-client/src/main.rs b/src/tools/remote-test-client/src/main.rs index cb9dac27ce49..f42de4417678 100644 --- a/src/tools/remote-test-client/src/main.rs +++ b/src/tools/remote-test-client/src/main.rs @@ -1,3 +1,5 @@ +#![deny(rust_2018_idioms)] + /// This is a small client program intended to pair with `remote-test-server` in /// this repository. This client connects to the server over TCP and is used to /// push artifacts and run tests on the server instead of locally. @@ -15,7 +17,7 @@ use std::process::{Command, Stdio}; use std::thread; use std::time::Duration; -const REMOTE_ADDR_ENV: &'static str = "TEST_DEVICE_ADDR"; +const REMOTE_ADDR_ENV: &str = "TEST_DEVICE_ADDR"; macro_rules! t { ($e:expr) => (match $e { diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs index 750eea3a28ae..e1270489d315 100644 --- a/src/tools/remote-test-server/src/main.rs +++ b/src/tools/remote-test-server/src/main.rs @@ -1,3 +1,5 @@ +#![deny(rust_2018_idioms)] + /// This is a small server which is intended to run inside of an emulator or /// on a remote test device. This server pairs with the `remote-test-client` /// program in this repository. The `remote-test-client` connects to this @@ -120,7 +122,7 @@ struct RemoveOnDrop<'a> { inner: &'a Path, } -impl<'a> Drop for RemoveOnDrop<'a> { +impl Drop for RemoveOnDrop<'_> { fn drop(&mut self) { t!(fs::remove_dir_all(self.inner)); } From 670a4d65d577cfc59eefe8eb0b73d5b027ea0038 Mon Sep 17 00:00:00 2001 From: Jens Hausdorf Date: Fri, 1 Mar 2019 13:19:00 +0100 Subject: [PATCH 155/381] Fix typo in Vec#resize_with documentation --- src/liballoc/vec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 229dafc5fdc3..947ce354ae71 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1260,7 +1260,7 @@ impl Vec { /// This method uses a closure to create new values on every push. If /// you'd rather [`Clone`] a given value, use [`resize`]. If you want /// to use the [`Default`] trait to generate values, you can pass - /// [`Default::default()`] as the second argument.. + /// [`Default::default()`] as the second argument. /// /// # Examples /// From c3aab1448070e7c039c204889fe59a1d00456db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Fri, 1 Mar 2019 15:06:14 +0100 Subject: [PATCH 156/381] Forbid duplicating Cargo as a dependency --- src/tools/tidy/src/deps.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 94dd5478e529..fbc4730bc1d6 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -378,7 +378,7 @@ fn check_crate_duplicate(resolve: &Resolve, bad: &mut bool) { // to accidentally sneak into our dependency graph, in order to ensure we keep our CI times // under control. - // "cargo", // FIXME(#53005) + "cargo", "rustc-ap-syntax", ]; let mut name_to_id: HashMap<_, Vec<_>> = HashMap::new(); From 8c16507045a76ef616533ec29626f6ce6be40a6c Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Fri, 1 Mar 2019 17:10:29 +0100 Subject: [PATCH 157/381] Schedule the demolition of `IsNotPromotable` --- src/librustc_mir/transform/qualify_consts.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 73ac68c4ac3b..f7b7754cea7b 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -499,6 +499,8 @@ impl Qualif for IsNotConst { // Refers to temporaries which cannot be promoted as // promote_consts decided they weren't simple enough. +// FIXME(oli-obk,eddyb): Remove this flag entirely and +// solely process this information via `IsNotConst`. struct IsNotPromotable; impl Qualif for IsNotPromotable { From a7d17bfcd537c89908b59d86f4af1d6137974845 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 1 Mar 2019 10:34:08 -0800 Subject: [PATCH 158/381] Update toolchain to build NetBSD release This allows us to remove the "allow old toolchains" flag we pass to LLVM, ensuring that we'll be up to date when LLVM needs us to be! --- src/ci/docker/dist-x86_64-netbsd/Dockerfile | 20 ++----------------- .../build-netbsd-toolchain.sh | 12 +++++------ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/ci/docker/dist-x86_64-netbsd/Dockerfile b/src/ci/docker/dist-x86_64-netbsd/Dockerfile index 4fe7e2cca2b6..44b1aaa24b19 100644 --- a/src/ci/docker/dist-x86_64-netbsd/Dockerfile +++ b/src/ci/docker/dist-x86_64-netbsd/Dockerfile @@ -3,23 +3,8 @@ FROM ubuntu:16.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -# Ubuntu 16.04 (this container) ships with make 4, but something in the -# toolchains we build below chokes on that, so go back to make 3 -COPY scripts/make3.sh /scripts/ -RUN sh /scripts/make3.sh - -COPY scripts/crosstool-ng.sh /scripts/ -RUN sh /scripts/crosstool-ng.sh - -COPY scripts/rustbuild-setup.sh /scripts/ -RUN sh /scripts/rustbuild-setup.sh -USER rustbuild -WORKDIR /tmp - COPY dist-x86_64-netbsd/build-netbsd-toolchain.sh /tmp/ -RUN ./build-netbsd-toolchain.sh - -USER root +RUN /tmp/build-netbsd-toolchain.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh @@ -33,6 +18,5 @@ ENV \ ENV HOSTS=x86_64-unknown-netbsd -ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs \ - --set llvm.allow-old-toolchain +ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS diff --git a/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh b/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh index ac92d68a1f50..b5377c64b1f5 100755 --- a/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh +++ b/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh @@ -28,15 +28,15 @@ mkdir -p /x-tools/x86_64-unknown-netbsd/sysroot URL=https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror # Originally from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-$BSD/source/sets/*.tgz -curl $URL/2017-03-17-netbsd-src.tgz | tar xzf - -curl $URL/2017-03-17-netbsd-gnusrc.tgz | tar xzf - -curl $URL/2017-03-17-netbsd-sharesrc.tgz | tar xzf - -curl $URL/2017-03-17-netbsd-syssrc.tgz | tar xzf - +curl $URL/2018-03-01-netbsd-src.tgz | tar xzf - +curl $URL/2018-03-01-netbsd-gnusrc.tgz | tar xzf - +curl $URL/2018-03-01-netbsd-sharesrc.tgz | tar xzf - +curl $URL/2018-03-01-netbsd-syssrc.tgz | tar xzf - # Originally from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-$BSD/amd64/binary/sets/*.tgz -curl $URL/2017-03-17-netbsd-base.tgz | \ +curl $URL/2018-03-01-netbsd-base.tgz | \ tar xzf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib ./lib -curl $URL/2017-03-17-netbsd-comp.tgz | \ +curl $URL/2018-03-01-netbsd-comp.tgz | \ tar xzf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib cd usr/src From 60eeed34af9b8a934ed02c7da36764710e466554 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Thu, 17 Jan 2019 20:03:58 +0000 Subject: [PATCH 159/381] Include bounds from promoted constants in NLL Previously, a promoted that contains a function item wouldn't have the function items bounds propagated to the main function body. --- .../borrow_check/nll/region_infer/values.rs | 4 +- src/librustc_mir/borrow_check/nll/renumber.rs | 8 ++ .../borrow_check/nll/type_check/mod.rs | 114 +++++++++++++++--- src/test/ui/nll/issue-48697.rs | 4 +- src/test/ui/nll/issue-48697.stderr | 11 ++ src/test/ui/nll/promoted-bounds.rs | 27 +++++ src/test/ui/nll/promoted-bounds.stderr | 15 +++ src/test/ui/nll/promoted-closure-pair.rs | 12 ++ src/test/ui/nll/promoted-closure-pair.stderr | 12 ++ 9 files changed, 185 insertions(+), 22 deletions(-) create mode 100644 src/test/ui/nll/issue-48697.stderr create mode 100644 src/test/ui/nll/promoted-bounds.rs create mode 100644 src/test/ui/nll/promoted-bounds.stderr create mode 100644 src/test/ui/nll/promoted-closure-pair.rs create mode 100644 src/test/ui/nll/promoted-closure-pair.stderr diff --git a/src/librustc_mir/borrow_check/nll/region_infer/values.rs b/src/librustc_mir/borrow_check/nll/region_infer/values.rs index ef27fdbde387..c4491778162f 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/values.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/values.rs @@ -154,10 +154,10 @@ impl LivenessValues { /// Creates a new set of "region values" that tracks causal information. /// Each of the regions in num_region_variables will be initialized with an /// empty set of points and no causal information. - crate fn new(elements: &Rc) -> Self { + crate fn new(elements: Rc) -> Self { Self { - elements: elements.clone(), points: SparseBitMatrix::new(elements.num_points), + elements: elements, } } diff --git a/src/librustc_mir/borrow_check/nll/renumber.rs b/src/librustc_mir/borrow_check/nll/renumber.rs index eab9e0ae171e..0a0a88e69426 100644 --- a/src/librustc_mir/borrow_check/nll/renumber.rs +++ b/src/librustc_mir/borrow_check/nll/renumber.rs @@ -47,6 +47,14 @@ impl<'a, 'gcx, 'tcx> NLLVisitor<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> MutVisitor<'tcx> for NLLVisitor<'a, 'gcx, 'tcx> { + fn visit_mir(&mut self, mir: &mut Mir<'tcx>) { + for promoted in mir.promoted.iter_mut() { + self.visit_mir(promoted); + } + + self.super_mir(mir); + } + fn visit_ty(&mut self, ty: &mut Ty<'tcx>, ty_context: TyContext) { debug!("visit_ty(ty={:?}, ty_context={:?})", ty, ty_context); diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index cf054c2d0550..4929c69d873b 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -45,7 +45,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::indexed_vec::{IndexVec, Idx}; use rustc::ty::layout::VariantIdx; use std::rc::Rc; -use std::{fmt, iter}; +use std::{fmt, iter, mem}; use syntax_pos::{Span, DUMMY_SP}; macro_rules! span_mirbug { @@ -124,7 +124,7 @@ pub(crate) fn type_check<'gcx, 'tcx>( let mut constraints = MirTypeckRegionConstraints { placeholder_indices: PlaceholderIndices::default(), placeholder_index_to_region: IndexVec::default(), - liveness_constraints: LivenessValues::new(elements), + liveness_constraints: LivenessValues::new(elements.clone()), outlives_constraints: ConstraintSet::default(), closure_bounds_mapping: Default::default(), type_tests: Vec::default(), @@ -253,7 +253,7 @@ enum FieldAccessError { /// is a problem. struct TypeVerifier<'a, 'b: 'a, 'gcx: 'tcx, 'tcx: 'b> { cx: &'a mut TypeChecker<'b, 'gcx, 'tcx>, - mir: &'a Mir<'tcx>, + mir: &'b Mir<'tcx>, last_span: Span, mir_def_id: DefId, errors_reported: bool, @@ -385,7 +385,7 @@ impl<'a, 'b, 'gcx, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'gcx, 'tcx> { } impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { - fn new(cx: &'a mut TypeChecker<'b, 'gcx, 'tcx>, mir: &'a Mir<'tcx>) -> Self { + fn new(cx: &'a mut TypeChecker<'b, 'gcx, 'tcx>, mir: &'b Mir<'tcx>) -> Self { TypeVerifier { mir, mir_def_id: cx.mir_def_id, @@ -454,19 +454,31 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { Place::Base(PlaceBase::Local(index)) => PlaceTy::Ty { ty: self.mir.local_decls[index].ty, }, - Place::Base(PlaceBase::Promoted(box (_index, sty))) => { + Place::Base(PlaceBase::Promoted(box (index, sty))) => { let sty = self.sanitize_type(place, sty); - // FIXME -- promoted MIR return types reference - // various "free regions" (e.g., scopes and things) - // that they ought not to do. We have to figure out - // how best to handle that -- probably we want treat - // promoted MIR much like closures, renumbering all - // their free regions and propagating constraints - // upwards. We have the same acyclic guarantees, so - // that should be possible. But for now, ignore them. - // - // let promoted_mir = &self.mir.promoted[index]; - // promoted_mir.return_ty() + + if !self.errors_reported { + let promoted_mir = &self.mir.promoted[index]; + self.sanitize_promoted(promoted_mir, location); + + let promoted_ty = promoted_mir.return_ty(); + + if let Err(terr) = self.cx.eq_types( + sty, + promoted_ty, + location.to_locations(), + ConstraintCategory::Boring, + ) { + span_mirbug!( + self, + place, + "bad promoted type ({:?}: {:?}): {:?}", + promoted_ty, + sty, + terr + ); + }; + } PlaceTy::Ty { ty: sty } } Place::Base(PlaceBase::Static(box Static { def_id, ty: sty })) => { @@ -533,6 +545,74 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { place_ty } + fn sanitize_promoted(&mut self, promoted_mir: &'b Mir<'tcx>, location: Location) { + // Determine the constraints from the promoted MIR by running the type + // checker on the promoted MIR, then transfer the constraints back to + // the main MIR, changing the locations to the provided location. + + let main_mir = mem::replace(&mut self.mir, promoted_mir); + self.cx.mir = promoted_mir; + + let all_facts = &mut None; + let mut constraints = Default::default(); + let mut closure_bounds = Default::default(); + if let Some(ref mut bcx) = self.cx.borrowck_context { + // Don't try to add borrow_region facts for the promoted MIR + mem::swap(bcx.all_facts, all_facts); + + // Use a new sets of constraints and closure bounds so that we can + // modify their locations. + mem::swap(&mut bcx.constraints.outlives_constraints, &mut constraints); + mem::swap(&mut bcx.constraints.closure_bounds_mapping, &mut closure_bounds); + }; + + self.visit_mir(promoted_mir); + + if !self.errors_reported { + // if verifier failed, don't do further checks to avoid ICEs + self.cx.typeck_mir(promoted_mir); + } + + self.mir = main_mir; + self.cx.mir = main_mir; + // Merge the outlives constraints back in, at the given location. + if let Some(ref mut base_bcx) = self.cx.borrowck_context { + mem::swap(base_bcx.all_facts, all_facts); + mem::swap(&mut base_bcx.constraints.outlives_constraints, &mut constraints); + mem::swap(&mut base_bcx.constraints.closure_bounds_mapping, &mut closure_bounds); + + let locations = location.to_locations(); + for constraint in constraints.iter() { + let mut constraint = *constraint; + constraint.locations = locations; + if let ConstraintCategory::Return + | ConstraintCategory::UseAsConst + | ConstraintCategory::UseAsStatic = constraint.category + { + // "Returning" from a promoted is an assigment to a + // temporary from the user's point of view. + constraint.category = ConstraintCategory::Boring; + } + base_bcx.constraints.outlives_constraints.push(constraint) + } + + if !closure_bounds.is_empty() { + let combined_bounds_mapping = closure_bounds + .into_iter() + .flat_map(|(_, value)| value) + .collect(); + let existing = base_bcx + .constraints + .closure_bounds_mapping + .insert(location, combined_bounds_mapping); + assert!( + existing.is_none(), + "Multiple promoteds/closures at the same location." + ); + } + } + } + fn sanitize_projection( &mut self, base: PlaceTy<'tcx>, @@ -2275,7 +2355,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { ) -> ty::InstantiatedPredicates<'tcx> { if let Some(closure_region_requirements) = tcx.mir_borrowck(def_id).closure_requirements { let closure_constraints = - closure_region_requirements.apply_requirements(tcx, location, def_id, substs); + closure_region_requirements.apply_requirements(tcx, def_id, substs); if let Some(ref mut borrowck_context) = self.borrowck_context { let bounds_mapping = closure_constraints diff --git a/src/test/ui/nll/issue-48697.rs b/src/test/ui/nll/issue-48697.rs index c60c265b813b..ececd6fccd84 100644 --- a/src/test/ui/nll/issue-48697.rs +++ b/src/test/ui/nll/issue-48697.rs @@ -1,14 +1,12 @@ // Regression test for #48697 -// compile-pass - #![feature(nll)] fn foo(x: &i32) -> &i32 { let z = 4; let f = &|y| y; let k = f(&z); - f(x) + f(x) //~ cannot return value referencing local variable } fn main() {} diff --git a/src/test/ui/nll/issue-48697.stderr b/src/test/ui/nll/issue-48697.stderr new file mode 100644 index 000000000000..16b46c15b90b --- /dev/null +++ b/src/test/ui/nll/issue-48697.stderr @@ -0,0 +1,11 @@ +error[E0515]: cannot return value referencing local variable `z` + --> $DIR/issue-48697.rs:9:5 + | +LL | let k = f(&z); + | -- `z` is borrowed here +LL | f(x) //~ cannot return value referencing local variable + | ^^^^ returns a value referencing data owned by the current function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. diff --git a/src/test/ui/nll/promoted-bounds.rs b/src/test/ui/nll/promoted-bounds.rs new file mode 100644 index 000000000000..59b21cf9ac2a --- /dev/null +++ b/src/test/ui/nll/promoted-bounds.rs @@ -0,0 +1,27 @@ +#![feature(nll)] + +fn shorten_lifetime<'a, 'b, 'min>(a: &'a i32, b: &'b i32) -> &'min i32 +where + 'a: 'min, + 'b: 'min, +{ + if *a < *b { + &a + } else { + &b + } +} + +fn main() { + let promoted_fn_item_ref = &shorten_lifetime; + + let a = &5; + let ptr = { + let l = 3; + let b = &l; //~ ERROR does not live long enough + let c = promoted_fn_item_ref(a, b); + c + }; + + println!("ptr = {:?}", ptr); +} diff --git a/src/test/ui/nll/promoted-bounds.stderr b/src/test/ui/nll/promoted-bounds.stderr new file mode 100644 index 000000000000..9798f238fc4d --- /dev/null +++ b/src/test/ui/nll/promoted-bounds.stderr @@ -0,0 +1,15 @@ +error[E0597]: `l` does not live long enough + --> $DIR/promoted-bounds.rs:21:17 + | +LL | let ptr = { + | --- borrow later stored here +LL | let l = 3; +LL | let b = &l; //~ ERROR does not live long enough + | ^^ borrowed value does not live long enough +... +LL | }; + | - `l` dropped here while still borrowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/promoted-closure-pair.rs b/src/test/ui/nll/promoted-closure-pair.rs new file mode 100644 index 000000000000..7b3bbad4c1e0 --- /dev/null +++ b/src/test/ui/nll/promoted-closure-pair.rs @@ -0,0 +1,12 @@ +// Check that we handle multiple closures in the same promoted constant. + +#![feature(nll)] + +fn foo() -> &'static i32 { + let z = 0; + let p = &(|y| y, |y| y); + p.0(&z); + p.1(&z) //~ ERROR cannot return +} + +fn main() {} diff --git a/src/test/ui/nll/promoted-closure-pair.stderr b/src/test/ui/nll/promoted-closure-pair.stderr new file mode 100644 index 000000000000..5f4a6037668b --- /dev/null +++ b/src/test/ui/nll/promoted-closure-pair.stderr @@ -0,0 +1,12 @@ +error[E0515]: cannot return value referencing local variable `z` + --> $DIR/promoted-closure-pair.rs:9:5 + | +LL | p.1(&z) //~ ERROR cannot return + | ^^^^--^ + | | | + | | `z` is borrowed here + | returns a value referencing data owned by the current function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. From 848c25207208d3ad71e6d4fd3719cc7dc725bdf4 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Thu, 17 Jan 2019 20:04:09 +0000 Subject: [PATCH 160/381] Remove unnecessary parameter --- src/librustc_mir/borrow_check/nll/region_infer/mod.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs index 785f810d9415..f0d3a0d2986e 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs @@ -1357,7 +1357,6 @@ pub trait ClosureRegionRequirementsExt<'gcx, 'tcx> { fn apply_requirements( &self, tcx: TyCtxt<'_, 'gcx, 'tcx>, - location: Location, closure_def_id: DefId, closure_substs: SubstsRef<'tcx>, ) -> Vec>; @@ -1388,13 +1387,12 @@ impl<'gcx, 'tcx> ClosureRegionRequirementsExt<'gcx, 'tcx> for ClosureRegionRequi fn apply_requirements( &self, tcx: TyCtxt<'_, 'gcx, 'tcx>, - location: Location, closure_def_id: DefId, closure_substs: SubstsRef<'tcx>, ) -> Vec> { debug!( - "apply_requirements(location={:?}, closure_def_id={:?}, closure_substs={:?})", - location, closure_def_id, closure_substs + "apply_requirements(closure_def_id={:?}, closure_substs={:?})", + closure_def_id, closure_substs ); // Extract the values of the free regions in `closure_substs` From 3b93d71fd200d5f2f39f1c4a7a4b09cb19ff64be Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Wed, 27 Feb 2019 22:21:49 +0000 Subject: [PATCH 161/381] Handle type annotations in promoted MIR correctly Type annotations are shared between the MIR of a function and the promoted constants for that function, so keep them in the type checker when we check the promoted MIR. --- .../borrow_check/nll/type_check/mod.rs | 32 ++++++++++--------- .../user-annotations/promoted-annotation.rs | 12 +++++++ .../promoted-annotation.stderr | 17 ++++++++++ 3 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 src/test/ui/nll/user-annotations/promoted-annotation.rs create mode 100644 src/test/ui/nll/user-annotations/promoted-annotation.stderr diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 4929c69d873b..9fa3bf552473 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -39,7 +39,8 @@ use rustc::ty::fold::TypeFoldable; use rustc::ty::subst::{Subst, SubstsRef, UnpackedKind, UserSubsts}; use rustc::ty::{ self, RegionVid, ToPolyTraitRef, Ty, TyCtxt, TyKind, UserType, - CanonicalUserTypeAnnotation, UserTypeAnnotationIndex, + CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, + UserTypeAnnotationIndex, }; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::indexed_vec::{IndexVec, Idx}; @@ -283,7 +284,7 @@ impl<'a, 'b, 'gcx, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'gcx, 'tcx> { location.to_locations(), ConstraintCategory::Boring, ) { - let annotation = &self.mir.user_type_annotations[annotation_index]; + let annotation = &self.cx.user_type_annotations[annotation_index]; span_mirbug!( self, constant, @@ -550,8 +551,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { // checker on the promoted MIR, then transfer the constraints back to // the main MIR, changing the locations to the provided location. - let main_mir = mem::replace(&mut self.mir, promoted_mir); - self.cx.mir = promoted_mir; + let parent_mir = mem::replace(&mut self.mir, promoted_mir); let all_facts = &mut None; let mut constraints = Default::default(); @@ -573,8 +573,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { self.cx.typeck_mir(promoted_mir); } - self.mir = main_mir; - self.cx.mir = main_mir; + self.mir = parent_mir; // Merge the outlives constraints back in, at the given location. if let Some(ref mut base_bcx) = self.cx.borrowck_context { mem::swap(base_bcx.all_facts, all_facts); @@ -818,7 +817,9 @@ struct TypeChecker<'a, 'gcx: 'tcx, 'tcx: 'a> { infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, param_env: ty::ParamEnv<'gcx>, last_span: Span, - mir: &'a Mir<'tcx>, + /// User type annotations are shared between the main MIR and the MIR of + /// all of the promoted items. + user_type_annotations: &'a CanonicalUserTypeAnnotations<'tcx>, mir_def_id: DefId, region_bound_pairs: &'a RegionBoundPairs<'tcx>, implicit_region_bound: Option>, @@ -973,8 +974,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { let mut checker = Self { infcx, last_span: DUMMY_SP, - mir, mir_def_id, + user_type_annotations: &mir.user_type_annotations, param_env, region_bound_pairs, implicit_region_bound, @@ -990,9 +991,9 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { fn check_user_type_annotations(&mut self) { debug!( "check_user_type_annotations: user_type_annotations={:?}", - self.mir.user_type_annotations + self.user_type_annotations ); - for user_annotation in &self.mir.user_type_annotations { + for user_annotation in self.user_type_annotations { let CanonicalUserTypeAnnotation { span, ref user_ty, inferred_ty } = *user_annotation; let (annotation, _) = self.infcx.instantiate_canonical_with_fresh_inference_vars( span, user_ty @@ -1175,7 +1176,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { a, v, user_ty, locations, ); - let annotated_type = self.mir.user_type_annotations[user_ty.base].inferred_ty; + let annotated_type = self.user_type_annotations[user_ty.base].inferred_ty; let mut curr_projected_ty = PlaceTy::from_ty(annotated_type); let tcx = self.infcx.tcx; @@ -1361,7 +1362,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { location.to_locations(), ConstraintCategory::Boring, ) { - let annotation = &mir.user_type_annotations[annotation_index]; + let annotation = &self.user_type_annotations[annotation_index]; span_mirbug!( self, stmt, @@ -1420,7 +1421,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { Locations::All(stmt.source_info.span), ConstraintCategory::TypeAnnotation, ) { - let annotation = &mir.user_type_annotations[projection.base]; + let annotation = &self.user_type_annotations[projection.base]; span_mirbug!( self, stmt, @@ -2078,7 +2079,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { } Rvalue::Ref(region, _borrow_kind, borrowed_place) => { - self.add_reborrow_constraint(location, region, borrowed_place); + self.add_reborrow_constraint(mir, location, region, borrowed_place); } // FIXME: These other cases have to be implemented in future PRs @@ -2177,6 +2178,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { /// - `borrowed_place`: the place `P` being borrowed fn add_reborrow_constraint( &mut self, + mir: &Mir<'tcx>, location: Location, borrow_region: ty::Region<'tcx>, borrowed_place: &Place<'tcx>, @@ -2226,7 +2228,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { match *elem { ProjectionElem::Deref => { let tcx = self.infcx.tcx; - let base_ty = base.ty(self.mir, tcx).to_ty(tcx); + let base_ty = base.ty(mir, tcx).to_ty(tcx); debug!("add_reborrow_constraint - base_ty = {:?}", base_ty); match base_ty.sty { diff --git a/src/test/ui/nll/user-annotations/promoted-annotation.rs b/src/test/ui/nll/user-annotations/promoted-annotation.rs new file mode 100644 index 000000000000..fa2d2fb81183 --- /dev/null +++ b/src/test/ui/nll/user-annotations/promoted-annotation.rs @@ -0,0 +1,12 @@ +// Test that type annotations are checked in promoted constants correctly. + +#![feature(nll)] + +fn foo<'a>() { + let x = 0; + let f = &drop::<&'a i32>; + f(&x); + //~^ ERROR `x` does not live long enough +} + +fn main() {} diff --git a/src/test/ui/nll/user-annotations/promoted-annotation.stderr b/src/test/ui/nll/user-annotations/promoted-annotation.stderr new file mode 100644 index 000000000000..144af1e0ec12 --- /dev/null +++ b/src/test/ui/nll/user-annotations/promoted-annotation.stderr @@ -0,0 +1,17 @@ +error[E0597]: `x` does not live long enough + --> $DIR/promoted-annotation.rs:8:7 + | +LL | fn foo<'a>() { + | -- lifetime `'a` defined here +LL | let x = 0; +LL | let f = &drop::<&'a i32>; + | ---------------- assignment requires that `x` is borrowed for `'a` +LL | f(&x); + | ^^ borrowed value does not live long enough +LL | //~^ ERROR `x` does not live long enough +LL | } + | - `x` dropped here while still borrowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. From dc4973dfd918f5d71cd8e5c8e5aac5b8a86bf4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 1 Mar 2019 14:42:39 -0800 Subject: [PATCH 162/381] Expand where negative supertrait specific error is shown Fix #58857. --- src/libsyntax/parse/parser.rs | 48 +++++++++++++++------------ src/test/ui/issues/issue-58857.rs | 7 ++++ src/test/ui/issues/issue-58857.stderr | 8 +++++ 3 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 src/test/ui/issues/issue-58857.rs create mode 100644 src/test/ui/issues/issue-58857.stderr diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index fd5038a8614f..1606bd591bd2 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1803,7 +1803,7 @@ impl<'a> Parser<'a> { let mut bounds = vec![GenericBound::Trait(poly_trait_ref, TraitBoundModifier::None)]; if parse_plus { self.eat_plus(); // `+`, or `+=` gets split and `+` is discarded - bounds.append(&mut self.parse_generic_bounds(None)?); + bounds.append(&mut self.parse_generic_bounds(Some(self.prev_span))?); } Ok(TyKind::TraitObject(bounds, TraitObjectSyntax::None)) } @@ -5523,6 +5523,7 @@ impl<'a> Parser<'a> { let mut bounds = Vec::new(); let mut negative_bounds = Vec::new(); let mut last_plus_span = None; + let mut was_negative = false; loop { // This needs to be synchronized with `Token::can_begin_bound`. let is_bound_start = self.check_path() || self.check_lifetime() || @@ -5567,9 +5568,10 @@ impl<'a> Parser<'a> { } let poly_span = lo.to(self.prev_span); if is_negative { - negative_bounds.push( - last_plus_span.or(colon_span).unwrap() - .to(poly_span)); + was_negative = true; + if let Some(sp) = last_plus_span.or(colon_span) { + negative_bounds.push(sp.to(poly_span)); + } } else { let poly_trait = PolyTraitRef::new(lifetime_defs, path, poly_span); let modifier = if question.is_some() { @@ -5591,26 +5593,28 @@ impl<'a> Parser<'a> { } } - if !negative_bounds.is_empty() { + if !negative_bounds.is_empty() || was_negative { let plural = negative_bounds.len() > 1; let mut err = self.struct_span_err(negative_bounds, "negative trait bounds are not supported"); - let bound_list = colon_span.unwrap().to(self.prev_span); - let mut new_bound_list = String::new(); - if !bounds.is_empty() { - let mut snippets = bounds.iter().map(|bound| bound.span()) - .map(|span| self.sess.source_map().span_to_snippet(span)); - while let Some(Ok(snippet)) = snippets.next() { - new_bound_list.push_str(" + "); - new_bound_list.push_str(&snippet); + if let Some(bound_list) = colon_span { + let bound_list = bound_list.to(self.prev_span); + let mut new_bound_list = String::new(); + if !bounds.is_empty() { + let mut snippets = bounds.iter().map(|bound| bound.span()) + .map(|span| self.sess.source_map().span_to_snippet(span)); + while let Some(Ok(snippet)) = snippets.next() { + new_bound_list.push_str(" + "); + new_bound_list.push_str(&snippet); + } + new_bound_list = new_bound_list.replacen(" +", ":", 1); } - new_bound_list = new_bound_list.replacen(" +", ":", 1); + err.span_suggestion_short(bound_list, + &format!("remove the trait bound{}", + if plural { "s" } else { "" }), + new_bound_list, + Applicability::MachineApplicable); } - err.span_suggestion_short(bound_list, - &format!("remove the trait bound{}", - if plural { "s" } else { "" }), - new_bound_list, - Applicability::MachineApplicable); err.emit(); } @@ -5646,7 +5650,7 @@ impl<'a> Parser<'a> { // Parse optional colon and param bounds. let bounds = if self.eat(&token::Colon) { - self.parse_generic_bounds(None)? + self.parse_generic_bounds(Some(self.prev_span))? } else { Vec::new() }; @@ -6091,7 +6095,7 @@ impl<'a> Parser<'a> { // or with mandatory equality sign and the second type. let ty = self.parse_ty()?; if self.eat(&token::Colon) { - let bounds = self.parse_generic_bounds(None)?; + let bounds = self.parse_generic_bounds(Some(self.prev_span))?; where_clause.predicates.push(ast::WherePredicate::BoundPredicate( ast::WhereBoundPredicate { span: lo.to(self.prev_span), @@ -7643,7 +7647,7 @@ impl<'a> Parser<'a> { tps.where_clause = self.parse_where_clause()?; let alias = if existential { self.expect(&token::Colon)?; - let bounds = self.parse_generic_bounds(None)?; + let bounds = self.parse_generic_bounds(Some(self.prev_span))?; AliasKind::Existential(bounds) } else { self.expect(&token::Eq)?; diff --git a/src/test/ui/issues/issue-58857.rs b/src/test/ui/issues/issue-58857.rs new file mode 100644 index 000000000000..392e4ea0c2ec --- /dev/null +++ b/src/test/ui/issues/issue-58857.rs @@ -0,0 +1,7 @@ +struct Conj {a : A} +trait Valid {} + +impl Conj{} +//~^ ERROR negative trait bounds are not supported + +fn main() {} diff --git a/src/test/ui/issues/issue-58857.stderr b/src/test/ui/issues/issue-58857.stderr new file mode 100644 index 000000000000..040e9eb8a656 --- /dev/null +++ b/src/test/ui/issues/issue-58857.stderr @@ -0,0 +1,8 @@ +error: negative trait bounds are not supported + --> $DIR/issue-58857.rs:4:7 + | +LL | impl Conj{} + | ^^^^^^^^ help: remove the trait bound + +error: aborting due to previous error + From 5360ded0e50b332b8f7dfc725e3a59d34d4265a8 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Fri, 1 Mar 2019 21:26:10 -0500 Subject: [PATCH 163/381] fix an issue with path probing on Windows The old logic would incorrectly look for "python2.exe" when searching for "python2.7.exe". --- src/bootstrap/sanity.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index ff4fb85bbfad..1a26309b4714 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -34,15 +34,17 @@ impl Finder { fn maybe_have>(&mut self, cmd: S) -> Option { let cmd: OsString = cmd.as_ref().into(); - let path = self.path.clone(); + let path = &self.path; self.cache.entry(cmd.clone()).or_insert_with(|| { - for path in env::split_paths(&path) { + for path in env::split_paths(path) { let target = path.join(&cmd); - let mut cmd_alt = cmd.clone(); - cmd_alt.push(".exe"); - if target.is_file() || // some/path/git - target.with_extension("exe").exists() || // some/path/git.exe - target.join(&cmd_alt).exists() { // some/path/git/git.exe + let mut cmd_exe = cmd.clone(); + cmd_exe.push(".exe"); + + if target.is_file() // some/path/git + || path.join(&cmd_exe).exists() // some/path/git.exe + || target.join(&cmd_exe).exists() // some/path/git/git.exe + { return Some(target); } } From 12d8a7d64e0c70a33dea591f7158aad38b1563c5 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Fri, 22 Feb 2019 10:24:29 -0500 Subject: [PATCH 164/381] look for python2 symlinks before bootstrap python Before this commit, if you're running x.py directly on a system where `python` is symlinked to Python 3, then the `python` config option will default to a Python 3 interpreter. This causes debuginfo tests to fail with an opaque error message, since they have a hard requirement on Python 2. This commit modifies the Python probe behavior to look for python2.7 and python2 *before* using the interpreter used to execute `x.py`. --- config.toml.example | 3 +++ src/bootstrap/sanity.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config.toml.example b/config.toml.example index f45db37c33b8..b4ad15a82357 100644 --- a/config.toml.example +++ b/config.toml.example @@ -162,6 +162,9 @@ # Python interpreter to use for various tasks throughout the build, notably # rustdoc tests, the lldb python interpreter, and some dist bits and pieces. # Note that Python 2 is currently required. +# +# Defaults to python2.7, then python2. If neither executable can be found, then +# it defaults to the Python interpreter used to execute x.py. #python = "python2.7" # Force Cargo to check that Cargo.lock describes the precise dependency diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index 1a26309b4714..b9f456e91003 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -109,9 +109,9 @@ pub fn check(build: &mut Build) { } build.config.python = build.config.python.take().map(|p| cmd_finder.must_have(p)) - .or_else(|| env::var_os("BOOTSTRAP_PYTHON").map(PathBuf::from)) // set by bootstrap.py .or_else(|| cmd_finder.maybe_have("python2.7")) .or_else(|| cmd_finder.maybe_have("python2")) + .or_else(|| env::var_os("BOOTSTRAP_PYTHON").map(PathBuf::from)) // set by bootstrap.py .or_else(|| Some(cmd_finder.must_have("python"))); build.config.nodejs = build.config.nodejs.take().map(|p| cmd_finder.must_have(p)) From 7e277d96feffdab52faef3fe5198a550d126db6d Mon Sep 17 00:00:00 2001 From: ljedrz Date: Wed, 27 Feb 2019 15:56:24 +0100 Subject: [PATCH 165/381] middle & privacy: partially HirIdify --- src/librustc/middle/reachable.rs | 64 ++++++------ src/librustc_privacy/lib.rs | 162 ++++++++++++++++--------------- 2 files changed, 120 insertions(+), 106 deletions(-) diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index cffbc2eaa40c..55a9b2477cfa 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -14,10 +14,9 @@ use crate::ty::{self, TyCtxt}; use crate::ty::query::Providers; use crate::middle::privacy; use crate::session::config; -use crate::util::nodemap::{NodeSet, FxHashSet}; +use crate::util::nodemap::{HirIdSet, FxHashSet}; use rustc_target::spec::abi::Abi; -use syntax::ast; use crate::hir; use crate::hir::def_id::LOCAL_CRATE; use crate::hir::intravisit::{Visitor, NestedVisitorMap}; @@ -70,10 +69,10 @@ struct ReachableContext<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, // The set of items which must be exported in the linkage sense. - reachable_symbols: NodeSet, + reachable_symbols: HirIdSet, // A worklist of item IDs. Each item ID in this worklist will be inlined // and will be scanned for further references. - worklist: Vec, + worklist: Vec, // Whether any output of this compilation is a library any_library: bool, } @@ -104,27 +103,28 @@ impl<'a, 'tcx> Visitor<'tcx> for ReachableContext<'a, 'tcx> { match def { Some(Def::Local(node_id)) | Some(Def::Upvar(node_id, ..)) => { - self.reachable_symbols.insert(node_id); + let hir_id = self.tcx.hir().node_to_hir_id(node_id); + self.reachable_symbols.insert(hir_id); } Some(def) => { - if let Some((node_id, def_id)) = def.opt_def_id().and_then(|def_id| { - self.tcx.hir().as_local_node_id(def_id).map(|node_id| (node_id, def_id)) + if let Some((hir_id, def_id)) = def.opt_def_id().and_then(|def_id| { + self.tcx.hir().as_local_hir_id(def_id).map(|hir_id| (hir_id, def_id)) }) { if self.def_id_represents_local_inlined_item(def_id) { - self.worklist.push(node_id); + self.worklist.push(hir_id); } else { match def { // If this path leads to a constant, then we need to // recurse into the constant to continue finding // items that are reachable. Def::Const(..) | Def::AssociatedConst(..) => { - self.worklist.push(node_id); + self.worklist.push(hir_id); } // If this wasn't a static, then the destination is // surely reachable. _ => { - self.reachable_symbols.insert(node_id); + self.reachable_symbols.insert(hir_id); } } } @@ -204,14 +204,14 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { continue } - if let Some(ref item) = self.tcx.hir().find(search_item) { + if let Some(ref item) = self.tcx.hir().find_by_hir_id(search_item) { self.propagate_node(item, search_item); } } } fn propagate_node(&mut self, node: &Node<'tcx>, - search_item: ast::NodeId) { + search_item: hir::HirId) { if !self.any_library { // If we are building an executable, only explicitly extern // types need to be exported. @@ -221,7 +221,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { } else { false }; - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); let codegen_attrs = self.tcx.codegen_fn_attrs(def_id); let is_extern = codegen_attrs.contains_extern_indicator(); let std_internal = codegen_attrs.flags.contains( @@ -242,7 +242,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { Node::Item(item) => { match item.node { hir::ItemKind::Fn(.., body) => { - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); if item_might_be_inlined(self.tcx, &item, self.tcx.codegen_fn_attrs(def_id)) { @@ -295,7 +295,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { self.visit_nested_body(body); } hir::ImplItemKind::Method(_, body) => { - let did = self.tcx.hir().get_parent_did(search_item); + let did = self.tcx.hir().get_parent_did_by_hir_id(search_item); if method_might_be_inlined(self.tcx, impl_item, did) { self.visit_nested_body(body) } @@ -317,7 +317,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { _ => { bug!( "found unexpected node kind in worklist: {} ({:?})", - self.tcx.hir().node_to_string(search_item), + self.tcx.hir().hir_to_string(search_item), node, ); } @@ -336,7 +336,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { struct CollectPrivateImplItemsVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, access_levels: &'a privacy::AccessLevels, - worklist: &'a mut Vec, + worklist: &'a mut Vec, } impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, 'tcx> { @@ -348,13 +348,18 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, let codegen_attrs = self.tcx.codegen_fn_attrs(def_id); if codegen_attrs.contains_extern_indicator() || codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL) { - self.worklist.push(item.id); + self.worklist.push(item.hir_id); } // We need only trait impls here, not inherent impls, and only non-exported ones if let hir::ItemKind::Impl(.., Some(ref trait_ref), _, ref impl_item_refs) = item.node { - if !self.access_levels.is_reachable(item.id) { - self.worklist.extend(impl_item_refs.iter().map(|r| r.id.node_id)); + let node_id = self.tcx.hir().hir_to_node_id(item.hir_id); + if !self.access_levels.is_reachable(node_id) { + // FIXME(@ljedrz): rework back to a nice extend when item Ids contain HirId + for impl_item_ref in impl_item_refs { + let hir_id = self.tcx.hir().node_to_hir_id(impl_item_ref.id.node_id); + self.worklist.push(hir_id); + } let trait_def_id = match trait_ref.path.def { Def::Trait(def_id) => def_id, @@ -368,11 +373,11 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, let provided_trait_methods = self.tcx.provided_trait_methods(trait_def_id); self.worklist.reserve(provided_trait_methods.len()); for default_method in provided_trait_methods { - let node_id = self.tcx - .hir() - .as_local_node_id(default_method.def_id) - .unwrap(); - self.worklist.push(node_id); + let hir_id = self.tcx + .hir() + .as_local_hir_id(default_method.def_id) + .unwrap(); + self.worklist.push(hir_id); } } } @@ -388,7 +393,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, // We introduce a new-type here, so we can have a specialized HashStable // implementation for it. #[derive(Clone)] -pub struct ReachableSet(pub Lrc); +pub struct ReachableSet(pub Lrc); fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) -> ReachableSet { debug_assert!(crate_num == LOCAL_CRATE); @@ -412,11 +417,12 @@ fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) -> // If other crates link to us, they're going to expect to be able to // use the lang items, so we need to be sure to mark them as // exported. - reachable_context.worklist.extend(access_levels.map.iter().map(|(id, _)| *id)); + reachable_context.worklist.extend( + access_levels.map.iter().map(|(id, _)| tcx.hir().node_to_hir_id(*id))); for item in tcx.lang_items().items().iter() { if let Some(did) = *item { - if let Some(node_id) = tcx.hir().as_local_node_id(did) { - reachable_context.worklist.push(node_id); + if let Some(hir_id) = tcx.hir().as_local_hir_id(did) { + reachable_context.worklist.push(hir_id); } } } diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 4a73f86ef6fe..7bd0d746bcb6 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -24,7 +24,7 @@ use rustc::ty::subst::InternalSubsts; use rustc::util::nodemap::HirIdSet; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::Lrc; -use syntax::ast::{self, DUMMY_NODE_ID, Ident}; +use syntax::ast::Ident; use syntax::attr; use syntax::symbol::keywords; use syntax_pos::Span; @@ -349,10 +349,10 @@ trait VisibilityLike: Sized { // Returns an over-approximation (`skip_assoc_tys` = true) of visibility due to // associated types for which we can't determine visibility precisely. - fn of_impl<'a, 'tcx>(node_id: ast::NodeId, tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn of_impl<'a, 'tcx>(hir_id: hir::HirId, tcx: TyCtxt<'a, 'tcx, 'tcx>, access_levels: &'a AccessLevels) -> Self { let mut find = FindMin { tcx, access_levels, min: Self::MAX }; - let def_id = tcx.hir().local_def_id(node_id); + let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); find.visit(tcx.type_of(def_id)); if let Some(trait_ref) = tcx.impl_trait_ref(def_id) { find.visit_trait(trait_ref); @@ -409,16 +409,18 @@ struct ReachEverythingInTheInterfaceVisitor<'b, 'a: 'b, 'tcx: 'a> { } impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { - fn get(&self, id: ast::NodeId) -> Option { - self.access_levels.map.get(&id).cloned() + fn get(&self, id: hir::HirId) -> Option { + let node_id = self.tcx.hir().hir_to_node_id(id); + self.access_levels.map.get(&node_id).cloned() } // Updates node level and returns the updated level. - fn update(&mut self, id: ast::NodeId, level: Option) -> Option { + fn update(&mut self, id: hir::HirId, level: Option) -> Option { let old_level = self.get(id); // Accessibility levels can only grow. if level > old_level { - self.access_levels.map.insert(id, level.unwrap()); + let node_id = self.tcx.hir().hir_to_node_id(id); + self.access_levels.map.insert(node_id, level.unwrap()); self.changed = true; level } else { @@ -426,11 +428,11 @@ impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { } } - fn reach(&mut self, item_id: ast::NodeId, access_level: Option) + fn reach(&mut self, item_id: hir::HirId, access_level: Option) -> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { ReachEverythingInTheInterfaceVisitor { access_level: cmp::min(access_level, Some(AccessLevel::Reachable)), - item_def_id: self.tcx.hir().local_def_id(item_id), + item_def_id: self.tcx.hir().local_def_id_from_hir_id(item_id), ev: self, } } @@ -464,7 +466,7 @@ impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { let def_id = self.tcx.hir().local_def_id(item_id.id); if !self.tcx.hygienic_eq(segment.ident, item.ident, def_id) { continue; } if let hir::ItemKind::Use(..) = item.node { - self.update(item.id, Some(AccessLevel::Exported)); + self.update(item.hir_id, Some(AccessLevel::Exported)); } } } @@ -483,7 +485,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { let inherited_item_level = match item.node { hir::ItemKind::Impl(..) => - Option::::of_impl(item.id, self.tcx, &self.access_levels), + Option::::of_impl(item.hir_id, self.tcx, &self.access_levels), // Foreign modules inherit level from parents. hir::ItemKind::ForeignMod(..) => self.prev_level, // Other `pub` items inherit levels from parents. @@ -498,44 +500,46 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { }; // Update level of the item itself. - let item_level = self.update(item.id, inherited_item_level); + let item_level = self.update(item.hir_id, inherited_item_level); // Update levels of nested things. match item.node { hir::ItemKind::Enum(ref def, _) => { for variant in &def.variants { - let variant_level = self.update(variant.node.data.id(), item_level); + let variant_level = self.update(variant.node.data.hir_id(), item_level); for field in variant.node.data.fields() { - self.update(field.id, variant_level); + self.update(field.hir_id, variant_level); } } } hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => { for impl_item_ref in impl_item_refs { if trait_ref.is_some() || impl_item_ref.vis.node.is_pub() { - self.update(impl_item_ref.id.node_id, item_level); + let hir_id = self.tcx.hir().node_to_hir_id(impl_item_ref.id.node_id); + self.update(hir_id, item_level); } } } hir::ItemKind::Trait(.., ref trait_item_refs) => { for trait_item_ref in trait_item_refs { - self.update(trait_item_ref.id.node_id, item_level); + let hir_id = self.tcx.hir().node_to_hir_id(trait_item_ref.id.node_id); + self.update(hir_id, item_level); } } hir::ItemKind::Struct(ref def, _) | hir::ItemKind::Union(ref def, _) => { if !def.is_struct() { - self.update(def.id(), item_level); + self.update(def.hir_id(), item_level); } for field in def.fields() { if field.vis.node.is_pub() { - self.update(field.id, item_level); + self.update(field.hir_id, item_level); } } } hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { if foreign_item.vis.node.is_pub() { - self.update(foreign_item.id, item_level); + self.update(foreign_item.hir_id, item_level); } } } @@ -572,21 +576,22 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { // in the reachability pass (`middle/reachable.rs`). Types are marked as link-time // reachable if they are returned via `impl Trait`, even from private functions. let exist_level = cmp::max(item_level, Some(AccessLevel::ReachableFromImplTrait)); - self.reach(item.id, exist_level).generics().predicates().ty(); + self.reach(item.hir_id, exist_level).generics().predicates().ty(); } // Visit everything. hir::ItemKind::Const(..) | hir::ItemKind::Static(..) | hir::ItemKind::Fn(..) | hir::ItemKind::Ty(..) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates().ty(); + self.reach(item.hir_id, item_level).generics().predicates().ty(); } } hir::ItemKind::Trait(.., ref trait_item_refs) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates(); + self.reach(item.hir_id, item_level).generics().predicates(); for trait_item_ref in trait_item_refs { - let mut reach = self.reach(trait_item_ref.id.node_id, item_level); + let hir_id = self.tcx.hir().node_to_hir_id(trait_item_ref.id.node_id); + let mut reach = self.reach(hir_id, item_level); reach.generics().predicates(); if trait_item_ref.kind == AssociatedItemKind::Type && @@ -600,18 +605,19 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } hir::ItemKind::TraitAlias(..) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates(); + self.reach(item.hir_id, item_level).generics().predicates(); } } // Visit everything except for private impl items. hir::ItemKind::Impl(.., ref impl_item_refs) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates().ty().trait_ref(); + self.reach(item.hir_id, item_level).generics().predicates().ty().trait_ref(); for impl_item_ref in impl_item_refs { - let impl_item_level = self.get(impl_item_ref.id.node_id); + let hir_id = self.tcx.hir().node_to_hir_id(impl_item_ref.id.node_id); + let impl_item_level = self.get(hir_id); if impl_item_level.is_some() { - self.reach(impl_item_ref.id.node_id, impl_item_level) + self.reach(hir_id, impl_item_level) .generics().predicates().ty(); } } @@ -621,26 +627,26 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { // Visit everything, but enum variants have their own levels. hir::ItemKind::Enum(ref def, _) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates(); + self.reach(item.hir_id, item_level).generics().predicates(); } for variant in &def.variants { - let variant_level = self.get(variant.node.data.id()); + let variant_level = self.get(variant.node.data.hir_id()); if variant_level.is_some() { for field in variant.node.data.fields() { - self.reach(field.id, variant_level).ty(); + self.reach(field.hir_id, variant_level).ty(); } // Corner case: if the variant is reachable, but its // enum is not, make the enum reachable as well. - self.update(item.id, variant_level); + self.update(item.hir_id, variant_level); } } } // Visit everything, but foreign items have their own levels. hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { - let foreign_item_level = self.get(foreign_item.id); + let foreign_item_level = self.get(foreign_item.hir_id); if foreign_item_level.is_some() { - self.reach(foreign_item.id, foreign_item_level) + self.reach(foreign_item.hir_id, foreign_item_level) .generics().predicates().ty(); } } @@ -649,11 +655,11 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates(); + self.reach(item.hir_id, item_level).generics().predicates(); for field in struct_def.fields() { - let field_level = self.get(field.id); + let field_level = self.get(field.hir_id); if field_level.is_some() { - self.reach(field.id, field_level).ty(); + self.reach(field.hir_id, field_level).ty(); } } } @@ -683,8 +689,8 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { for export in exports.iter() { if export.vis == ty::Visibility::Public { if let Some(def_id) = export.def.opt_def_id() { - if let Some(node_id) = self.tcx.hir().as_local_node_id(def_id) { - self.update(node_id, Some(AccessLevel::Exported)); + if let Some(hir_id) = self.tcx.hir().as_local_hir_id(def_id) { + self.update(hir_id, Some(AccessLevel::Exported)); } } } @@ -696,10 +702,8 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef) { - let node_id = self.tcx.hir().hir_to_node_id(md.hir_id); - if md.legacy { - self.update(node_id, Some(AccessLevel::Public)); + self.update(md.hir_id, Some(AccessLevel::Public)); return } @@ -707,38 +711,39 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { self.tcx, self.tcx.hir().local_def_id_from_hir_id(md.hir_id) ).unwrap(); - let mut module_id = self.tcx.hir().as_local_node_id(module_did).unwrap(); + let mut module_id = self.tcx.hir().as_local_hir_id(module_did).unwrap(); let level = if md.vis.node.is_pub() { self.get(module_id) } else { None }; - let level = self.update(node_id, level); + let level = self.update(md.hir_id, level); if level.is_none() { return } loop { - let module = if module_id == ast::CRATE_NODE_ID { + let module = if module_id == hir::CRATE_HIR_ID { &self.tcx.hir().krate().module } else if let hir::ItemKind::Mod(ref module) = - self.tcx.hir().expect_item(module_id).node { + self.tcx.hir().expect_item_by_hir_id(module_id).node { module } else { unreachable!() }; for id in &module.item_ids { - self.update(id.id, level); + let hir_id = self.tcx.hir().node_to_hir_id(id.id); + self.update(hir_id, level); } - let def_id = self.tcx.hir().local_def_id(module_id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(module_id); if let Some(exports) = self.tcx.module_exports(def_id) { for export in exports.iter() { - if let Some(node_id) = self.tcx.hir().as_local_node_id(export.def.def_id()) { - self.update(node_id, level); + if let Some(hir_id) = self.tcx.hir().as_local_hir_id(export.def.def_id()) { + self.update(hir_id, level); } } } - if module_id == ast::CRATE_NODE_ID { + if module_id == hir::CRATE_HIR_ID { break } - module_id = self.tcx.hir().get_parent_node(module_id); + module_id = self.tcx.hir().get_parent_node_by_hir_id(module_id); } } } @@ -779,8 +784,8 @@ impl<'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.ev.tcx } fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool { - if let Some(node_id) = self.ev.tcx.hir().as_local_node_id(def_id) { - self.ev.update(node_id, self.access_level); + if let Some(hir_id) = self.ev.tcx.hir().as_local_hir_id(def_id) { + self.ev.update(hir_id, self.access_level); } false } @@ -796,7 +801,7 @@ impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for ReachEverythingInTheInterfaceVisitor<' struct NamePrivacyVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, - current_item: ast::NodeId, + current_item: hir::HirId, empty_tables: &'a ty::TypeckTables<'tcx>, } @@ -808,7 +813,7 @@ impl<'a, 'tcx> NamePrivacyVisitor<'a, 'tcx> { def: &'tcx ty::AdtDef, // definition of the struct or enum field: &'tcx ty::FieldDef) { // definition of the field let ident = Ident::new(keywords::Invalid.name(), use_ctxt); - let current_hir = self.tcx.hir().node_to_hir_id(self.current_item); + let current_hir = self.current_item; let def_id = self.tcx.adjust_ident(ident, def.did, current_hir).1; if !def.is_enum() && !field.vis.is_accessible_from(def_id, self.tcx) { struct_span_err!(self.tcx.sess, span, E0451, "field `{}` of {} `{}` is private", @@ -839,7 +844,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { } fn visit_item(&mut self, item: &'tcx hir::Item) { - let orig_current_item = mem::replace(&mut self.current_item, item.id); + let orig_current_item = mem::replace(&mut self.current_item, item.hir_id); let orig_tables = mem::replace(&mut self.tables, item_tables(self.tcx, item.hir_id, self.empty_tables)); intravisit::walk_item(self, item); @@ -1110,8 +1115,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { // Check types in item interfaces. fn visit_item(&mut self, item: &'tcx hir::Item) { - let orig_current_item = - mem::replace(&mut self.current_item, self.tcx.hir().local_def_id(item.id)); + let orig_current_item = mem::replace(&mut self.current_item, + self.tcx.hir().local_def_id_from_hir_id(item.hir_id)); let orig_in_body = mem::replace(&mut self.in_body, false); let orig_tables = mem::replace(&mut self.tables, item_tables(self.tcx, item.hir_id, self.empty_tables)); @@ -1190,10 +1195,11 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { } } - fn trait_is_public(&self, trait_id: ast::NodeId) -> bool { + fn trait_is_public(&self, trait_id: hir::HirId) -> bool { // FIXME: this would preferably be using `exported_items`, but all // traits are exported currently (see `EmbargoVisitor.exported_trait`). - self.access_levels.is_public(trait_id) + let node_id = self.tcx.hir().hir_to_node_id(trait_id); + self.access_levels.is_public(node_id) } fn check_generic_bound(&mut self, bound: &hir::GenericBound) { @@ -1204,8 +1210,9 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { } } - fn item_is_public(&self, id: &ast::NodeId, vis: &hir::Visibility) -> bool { - self.access_levels.is_reachable(*id) || vis.node.is_pub() + fn item_is_public(&self, id: &hir::HirId, vis: &hir::Visibility) -> bool { + let node_id = self.tcx.hir().hir_to_node_id(*id); + self.access_levels.is_reachable(node_id) || vis.node.is_pub() } } @@ -1253,7 +1260,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { hir::ItemKind::ForeignMod(_) => {} hir::ItemKind::Trait(.., ref bounds, _) => { - if !self.trait_is_public(item.id) { + if !self.trait_is_public(item.hir_id) { return } @@ -1295,8 +1302,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { |tr| { let did = tr.path.def.def_id(); - if let Some(node_id) = self.tcx.hir().as_local_node_id(did) { - self.trait_is_public(node_id) + if let Some(hir_id) = self.tcx.hir().as_local_hir_id(did) { + self.trait_is_public(hir_id) } else { true // external traits must be public } @@ -1318,9 +1325,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { match impl_item.node { hir::ImplItemKind::Const(..) | hir::ImplItemKind::Method(..) => { - let node_id = self.tcx.hir().hir_to_node_id( - impl_item.hir_id); - self.access_levels.is_reachable(node_id) + self.access_levels.is_reachable( + impl_item_ref.id.node_id) } hir::ImplItemKind::Existential(..) | hir::ImplItemKind::Type(_) => false, @@ -1342,11 +1348,10 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { // don't erroneously report errors for private // types in private items. let impl_item = self.tcx.hir().impl_item(impl_item_ref.id); - let node_id = self.tcx.hir().hir_to_node_id(impl_item.hir_id); match impl_item.node { hir::ImplItemKind::Const(..) | hir::ImplItemKind::Method(..) - if self.item_is_public(&node_id, &impl_item.vis) => + if self.item_is_public(&impl_item.hir_id, &impl_item.vis) => { intravisit::walk_impl_item(self, impl_item) } @@ -1387,7 +1392,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { // methods will be visible as `Public::foo`. let mut found_pub_static = false; for impl_item_ref in impl_item_refs { - if self.item_is_public(&impl_item_ref.id.node_id, &impl_item_ref.vis) { + let hir_id = self.tcx.hir().node_to_hir_id(impl_item_ref.id.node_id); + if self.item_is_public(&hir_id, &impl_item_ref.vis) { let impl_item = self.tcx.hir().impl_item(impl_item_ref.id); match impl_item_ref.kind { AssociatedItemKind::Const => { @@ -1414,7 +1420,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { hir::ItemKind::Ty(..) => return, // Not at all public, so we don't care. - _ if !self.item_is_public(&item.id, &item.vis) => { + _ if !self.item_is_public(&item.hir_id, &item.vis) => { return; } @@ -1450,7 +1456,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { } fn visit_foreign_item(&mut self, item: &'tcx hir::ForeignItem) { - if self.access_levels.is_reachable(item.id) { + let node_id = self.tcx.hir().hir_to_node_id(item.hir_id); + if self.access_levels.is_reachable(node_id) { intravisit::walk_foreign_item(self, item) } } @@ -1468,7 +1475,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { v: &'tcx hir::Variant, g: &'tcx hir::Generics, item_id: hir::HirId) { - if self.access_levels.is_reachable(v.node.data.id()) { + let node_id = self.tcx.hir().hir_to_node_id(v.node.data.hir_id()); + if self.access_levels.is_reachable(node_id) { self.in_variant = true; intravisit::walk_variant(self, v, g, item_id); self.in_variant = false; @@ -1735,7 +1743,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> // A trait impl is public when both its type and its trait are public // Subitems of trait impls have inherited publicity. hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => { - let impl_vis = ty::Visibility::of_impl(item.id, tcx, &Default::default()); + let impl_vis = ty::Visibility::of_impl(item.hir_id, tcx, &Default::default()); self.check(item.hir_id, impl_vis).generics().predicates(); for impl_item_ref in impl_item_refs { let impl_item = tcx.hir().impl_item(impl_item_ref.id); @@ -1773,7 +1781,7 @@ fn check_mod_privacy<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { let mut visitor = NamePrivacyVisitor { tcx, tables: &empty_tables, - current_item: DUMMY_NODE_ID, + current_item: hir::DUMMY_HIR_ID, empty_tables: &empty_tables, }; let (module, span, node_id) = tcx.hir().get_module(module_def_id); @@ -1827,7 +1835,7 @@ fn privacy_access_levels<'tcx>( break } } - visitor.update(ast::CRATE_NODE_ID, Some(AccessLevel::Public)); + visitor.update(hir::CRATE_HIR_ID, Some(AccessLevel::Public)); { let mut visitor = ObsoleteVisiblePrivateTypesVisitor { From ae45f170ee0ce7d068b51b14cb2d0685c16327bc Mon Sep 17 00:00:00 2001 From: ljedrz Date: Wed, 27 Feb 2019 15:56:59 +0100 Subject: [PATCH 166/381] hir: remove NodeId from StructField --- src/librustc/hir/lowering.rs | 3 +-- src/librustc/hir/mod.rs | 1 - src/librustc/ich/impls_hir.rs | 1 - src/librustc/middle/dead.rs | 2 +- src/librustc/middle/stability.rs | 3 +-- src/librustc_codegen_ssa/back/symbol_export.rs | 12 ++++++------ src/librustc_lint/builtin.rs | 11 +++++++---- src/librustc_typeck/check/wfcheck.rs | 2 +- src/librustc_typeck/collect.rs | 8 ++++---- src/librustdoc/clean/mod.rs | 8 +++++--- 10 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index a97ea7da7f19..b854cd4af1b5 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -2743,11 +2743,10 @@ impl<'a> LoweringContext<'a> { } fn lower_struct_field(&mut self, (index, f): (usize, &StructField)) -> hir::StructField { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(f.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(f.id); hir::StructField { span: f.span, - id: node_id, hir_id, ident: match f.ident { Some(ident) => ident, diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 3ba4efba9186..fa0487bbc9d4 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -2132,7 +2132,6 @@ pub struct StructField { pub span: Span, pub ident: Ident, pub vis: Visibility, - pub id: NodeId, pub hir_id: HirId, pub ty: P, pub attrs: HirVec, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index af1cce5e3545..718e828e601d 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -838,7 +838,6 @@ impl_stable_hash_for!(struct hir::StructField { span, ident -> (ident.name), vis, - id, hir_id, ty, attrs diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 3b607127d862..d94a6eb8804b 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -465,7 +465,7 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> { } fn should_warn_about_field(&mut self, field: &hir::StructField) -> bool { - let field_type = self.tcx.type_of(self.tcx.hir().local_def_id(field.id)); + let field_type = self.tcx.type_of(self.tcx.hir().local_def_id_from_hir_id(field.hir_id)); !field.is_positional() && !self.symbol_is_live(field.hir_id) && !field_type.is_phantom_data() diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 3c1b49e2dde6..8b5d70d834d9 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -317,10 +317,9 @@ struct MissingStabilityAnnotations<'a, 'tcx: 'a> { impl<'a, 'tcx: 'a> MissingStabilityAnnotations<'a, 'tcx> { fn check_missing_stability(&self, hir_id: HirId, span: Span, name: &str) { let stab = self.tcx.stability().local_stability(hir_id); - let node_id = self.tcx.hir().hir_to_node_id(hir_id); let is_error = !self.tcx.sess.opts.test && stab.is_none() && - self.access_levels.is_reachable(node_id); + self.access_levels.is_reachable(self.tcx.hir().hir_to_node_id(hir_id)); if is_error { self.tcx.sess.span_err( span, diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index 4b01e264f19e..7da28c19d241 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -69,7 +69,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let mut reachable_non_generics: DefIdMap<_> = tcx.reachable_set(LOCAL_CRATE).0 .iter() - .filter_map(|&node_id| { + .filter_map(|&hir_id| { // We want to ignore some FFI functions that are not exposed from // this crate. Reachable FFI functions can be lumped into two // categories: @@ -83,9 +83,9 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // // As a result, if this id is an FFI item (foreign item) then we only // let it through if it's included statically. - match tcx.hir().get(node_id) { + match tcx.hir().get_by_hir_id(hir_id) { Node::ForeignItem(..) => { - let def_id = tcx.hir().local_def_id(node_id); + let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); if tcx.is_statically_included_foreign_item(def_id) { Some(def_id) } else { @@ -105,7 +105,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, node: hir::ImplItemKind::Method(..), .. }) => { - let def_id = tcx.hir().local_def_id(node_id); + let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); let generics = tcx.generics_of(def_id); if !generics.requires_monomorphization(tcx) && // Functions marked with #[inline] are only ever codegened @@ -343,8 +343,8 @@ fn upstream_monomorphizations_for_provider<'a, 'tcx>( } fn is_unreachable_local_definition_provider(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> bool { - if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { - !tcx.reachable_set(LOCAL_CRATE).0.contains(&node_id) + if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) { + !tcx.reachable_set(LOCAL_CRATE).0.contains(&hir_id) } else { bug!("is_unreachable_local_definition called with non-local DefId: {:?}", def_id) diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 4d484a64f47d..e540a21c2fda 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -148,7 +148,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxPointers { hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { for struct_field in struct_def.fields() { - let def_id = cx.tcx.hir().local_def_id(struct_field.id); + let def_id = cx.tcx.hir().local_def_id_from_hir_id(struct_field.hir_id); self.check_heap_type(cx, struct_field.span, cx.tcx.type_of(def_id)); } @@ -560,7 +560,8 @@ impl LintPass for MissingCopyImplementations { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingCopyImplementations { fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) { - if !cx.access_levels.is_reachable(item.id) { + let node_id = cx.tcx.hir().hir_to_node_id(item.hir_id); + if !cx.access_levels.is_reachable(node_id) { return; } let (def, ty) = match item.node { @@ -631,7 +632,8 @@ impl LintPass for MissingDebugImplementations { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations { fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) { - if !cx.access_levels.is_reachable(item.id) { + let node_id = cx.tcx.hir().hir_to_node_id(item.hir_id); + if !cx.access_levels.is_reachable(node_id) { return; } @@ -1078,7 +1080,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnionsWithDropFields { fn check_item(&mut self, ctx: &LateContext<'_, '_>, item: &hir::Item) { if let hir::ItemKind::Union(ref vdata, _) = item.node { for field in vdata.fields() { - let field_ty = ctx.tcx.type_of(ctx.tcx.hir().local_def_id(field.id)); + let field_ty = ctx.tcx.type_of( + ctx.tcx.hir().local_def_id_from_hir_id(field.hir_id)); if field_ty.needs_drop(ctx.tcx, ctx.param_env) { ctx.span_lint(UNIONS_WITH_DROP_FIELDS, field.span, diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index b7c862a89a1b..51a971823afb 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -1050,7 +1050,7 @@ struct AdtField<'tcx> { impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn non_enum_variant(&self, struct_def: &hir::VariantData) -> AdtVariant<'tcx> { let fields = struct_def.fields().iter().map(|field| { - let field_ty = self.tcx.type_of(self.tcx.hir().local_def_id(field.id)); + let field_ty = self.tcx.type_of(self.tcx.hir().local_def_id_from_hir_id(field.hir_id)); let field_ty = self.normalize_associated_types_in(field.span, &field_ty); AdtField { ty: field_ty, span: field.span } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 16102ad4cde3..38150192886b 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -447,7 +447,7 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) { tcx.predicates_of(def_id); for f in struct_def.fields() { - let def_id = tcx.hir().local_def_id(f.id); + let def_id = tcx.hir().local_def_id_from_hir_id(f.hir_id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); @@ -555,7 +555,7 @@ fn convert_enum_variant_types<'a, 'tcx>( ); for f in variant.node.data.fields() { - let def_id = tcx.hir().local_def_id(f.id); + let def_id = tcx.hir().local_def_id_from_hir_id(f.hir_id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); @@ -582,7 +582,7 @@ fn convert_variant<'a, 'tcx>( .fields() .iter() .map(|f| { - let fid = tcx.hir().local_def_id(f.id); + let fid = tcx.hir().local_def_id_from_hir_id(f.hir_id); let dup_span = seen_fields.get(&f.ident.modern()).cloned(); if let Some(prev_span) = dup_span { struct_span_err!( @@ -1577,7 +1577,7 @@ fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig let ty = tcx.type_of(tcx.hir().get_parent_did(node_id)); let inputs = fields .iter() - .map(|f| tcx.type_of(tcx.hir().local_def_id(f.id))); + .map(|f| tcx.type_of(tcx.hir().local_def_id_from_hir_id(f.hir_id))); ty::Binder::bind(tcx.mk_fn_sig( inputs, ty, diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index d88d0dab4f0e..c39bd13bc3a5 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2913,14 +2913,16 @@ impl<'tcx> Clean for Ty<'tcx> { impl Clean for hir::StructField { fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id); + Item { name: Some(self.ident.name).clean(cx), attrs: self.attrs.clean(cx), source: self.span.clean(cx), visibility: self.vis.clean(cx), - stability: get_stability(cx, cx.tcx.hir().local_def_id(self.id)), - deprecation: get_deprecation(cx, cx.tcx.hir().local_def_id(self.id)), - def_id: cx.tcx.hir().local_def_id(self.id), + stability: get_stability(cx, local_did), + deprecation: get_deprecation(cx, local_did), + def_id: local_did, inner: StructFieldItem(self.ty.clean(cx)), } } From 3c25193f3ff60faff504a24749761970a72ccdc6 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Wed, 27 Feb 2019 16:12:35 +0100 Subject: [PATCH 167/381] hir: remove NodeId from ForeignItem --- src/librustc/hir/lowering.rs | 1 - src/librustc/hir/map/mod.rs | 2 +- src/librustc/hir/mod.rs | 1 - src/librustc/ich/impls_hir.rs | 1 - src/librustc_lint/types.rs | 14 +++++++------- src/librustc_metadata/encoder.rs | 9 ++++++--- src/librustc_metadata/foreign_modules.rs | 2 +- src/librustc_typeck/check/intrinsic.rs | 2 +- src/librustc_typeck/check/mod.rs | 2 +- src/librustc_typeck/collect.rs | 2 +- src/librustdoc/clean/mod.rs | 8 +++++--- src/librustdoc/visit_ast.rs | 2 +- 12 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index b854cd4af1b5..c99d1b7bd09d 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -3551,7 +3551,6 @@ impl<'a> LoweringContext<'a> { let LoweredNodeId { node_id, hir_id } = self.lower_node_id(i.id); let def_id = self.resolver.definitions().local_def_id(node_id); hir::ForeignItem { - id: node_id, hir_id, ident: i.ident, attrs: self.lower_attrs(&i.attrs), diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 66e814f06609..2a664282d51c 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -341,7 +341,7 @@ impl<'hir> Map<'hir> { } } Node::ForeignItem(item) => { - let def_id = self.local_def_id(item.id); + let def_id = self.local_def_id_from_hir_id(item.hir_id); match item.node { ForeignItemKind::Fn(..) => Some(Def::Fn(def_id)), ForeignItemKind::Static(_, m) => Some(Def::Static(def_id, m)), diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index fa0487bbc9d4..dc15c2a04a81 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -2378,7 +2378,6 @@ pub struct ForeignItem { pub ident: Ident, pub attrs: HirVec, pub node: ForeignItemKind, - pub id: NodeId, pub hir_id: HirId, pub span: Span, pub vis: Visibility, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 718e828e601d..ecd3d16d20a5 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -931,7 +931,6 @@ impl_stable_hash_for!(struct hir::ForeignItem { ident -> (ident.name), attrs, node, - id, hir_id, span, vis diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 35489ab42e73..da6c3b6dc159 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -762,8 +762,8 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { } } - fn check_foreign_fn(&mut self, id: ast::NodeId, decl: &hir::FnDecl) { - let def_id = self.cx.tcx.hir().local_def_id(id); + fn check_foreign_fn(&mut self, id: hir::HirId, decl: &hir::FnDecl) { + let def_id = self.cx.tcx.hir().local_def_id_from_hir_id(id); let sig = self.cx.tcx.fn_sig(def_id); let sig = self.cx.tcx.erase_late_bound_regions(&sig); let inputs = if sig.c_variadic { @@ -786,8 +786,8 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { } } - fn check_foreign_static(&mut self, id: ast::NodeId, span: Span) { - let def_id = self.cx.tcx.hir().local_def_id(id); + fn check_foreign_static(&mut self, id: hir::HirId, span: Span) { + let def_id = self.cx.tcx.hir().local_def_id_from_hir_id(id); let ty = self.cx.tcx.type_of(def_id); self.check_type_for_ffi_and_report_errors(span, ty); } @@ -809,14 +809,14 @@ impl LintPass for ImproperCTypes { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImproperCTypes { fn check_foreign_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::ForeignItem) { let mut vis = ImproperCTypesVisitor { cx }; - let abi = cx.tcx.hir().get_foreign_abi(it.id); + let abi = cx.tcx.hir().get_foreign_abi_by_hir_id(it.hir_id); if abi != Abi::RustIntrinsic && abi != Abi::PlatformIntrinsic { match it.node { hir::ForeignItemKind::Fn(ref decl, _, _) => { - vis.check_foreign_fn(it.id, decl); + vis.check_foreign_fn(it.hir_id, decl); } hir::ForeignItemKind::Static(ref ty, _) => { - vis.check_foreign_static(it.id, ty.span); + vis.check_foreign_static(it.hir_id, ty.span); } hir::ForeignItemKind::Type => () } diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index b4a71b887dc3..9ea277984e7b 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1161,7 +1161,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { hir::ItemKind::ForeignMod(ref fm) => { self.lazy_seq(fm.items .iter() - .map(|foreign_item| tcx.hir().local_def_id(foreign_item.id).index)) + .map(|foreign_item| tcx.hir().local_def_id_from_hir_id( + foreign_item.hir_id).index)) } hir::ItemKind::Enum(..) => { let def = self.tcx.adt_def(def_id); @@ -1607,9 +1608,11 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { hir::ForeignItemKind::Type => EntryKind::ForeignType, }; + let node_id = self.tcx.hir().hir_to_node_id(nitem.hir_id); + Entry { kind, - visibility: self.lazy(&ty::Visibility::from_hir(&nitem.vis, nitem.id, tcx)), + visibility: self.lazy(&ty::Visibility::from_hir(&nitem.vis, node_id, tcx)), span: self.lazy(&nitem.span), attributes: self.encode_attributes(&nitem.attrs), children: LazySeq::empty(), @@ -1655,7 +1658,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> { } fn visit_foreign_item(&mut self, ni: &'tcx hir::ForeignItem) { intravisit::walk_foreign_item(self, ni); - let def_id = self.index.tcx.hir().local_def_id(ni.id); + let def_id = self.index.tcx.hir().local_def_id_from_hir_id(ni.hir_id); self.index.record(def_id, IsolatedEncoder::encode_info_for_foreign_item, (def_id, ni)); diff --git a/src/librustc_metadata/foreign_modules.rs b/src/librustc_metadata/foreign_modules.rs index 2c03bd6659f2..e1487b6be0fe 100644 --- a/src/librustc_metadata/foreign_modules.rs +++ b/src/librustc_metadata/foreign_modules.rs @@ -25,7 +25,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for Collector<'a, 'tcx> { }; let foreign_items = fm.items.iter() - .map(|it| self.tcx.hir().local_def_id(it.id)) + .map(|it| self.tcx.hir().local_def_id_from_hir_id(it.hir_id)) .collect(); self.modules.push(ForeignModule { foreign_items, diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 924ced2e2a3c..40c60caffa42 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -22,7 +22,7 @@ fn equate_intrinsic_type<'a, 'tcx>( inputs: Vec>, output: Ty<'tcx>, ) { - let def_id = tcx.hir().local_def_id(it.id); + let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id); match it.node { hir::ForeignItemKind::Fn(..) => {} diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 80ffe4415610..ace6469f46f1 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1407,7 +1407,7 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite } } else { for item in &m.items { - let generics = tcx.generics_of(tcx.hir().local_def_id(item.id)); + let generics = tcx.generics_of(tcx.hir().local_def_id_from_hir_id(item.hir_id)); if generics.params.len() - generics.own_counts().lifetimes != 0 { let mut err = struct_span_err!( tcx.sess, diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 38150192886b..a66fc328547e 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -409,7 +409,7 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) { | hir::ItemKind::GlobalAsm(_) => {} hir::ItemKind::ForeignMod(ref foreign_mod) => { for item in &foreign_mod.items { - let def_id = tcx.hir().local_def_id(item.id); + let def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index c39bd13bc3a5..15840da2f40f 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -3821,14 +3821,16 @@ impl Clean for hir::ForeignItem { } }; + let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id); + Item { name: Some(self.ident.clean(cx)), attrs: self.attrs.clean(cx), source: self.span.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: local_did, visibility: self.vis.clean(cx), - stability: get_stability(cx, cx.tcx.hir().local_def_id(self.id)), - deprecation: get_deprecation(cx, cx.tcx.hir().local_def_id(self.id)), + stability: get_stability(cx, local_did), + deprecation: get_deprecation(cx, local_did), inner, } } diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index b791bfc11e01..12c7488d47e0 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -357,7 +357,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { Node::ForeignItem(it) if !glob => { // Generate a fresh `extern {}` block if we want to inline a foreign item. om.foreigns.push(hir::ForeignMod { - abi: tcx.hir().get_foreign_abi(it.id), + abi: tcx.hir().get_foreign_abi_by_hir_id(it.hir_id), items: vec![hir::ForeignItem { ident: renamed.unwrap_or(it.ident), .. it.clone() From 77fa041fc1ca58b2ccbdb600f39aa92da1276970 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Wed, 27 Feb 2019 17:35:24 +0100 Subject: [PATCH 168/381] hir: remove NodeId from Item --- src/librustc/hir/check_attr.rs | 2 +- src/librustc/hir/lowering.rs | 6 +-- src/librustc/hir/map/collector.rs | 2 +- src/librustc/hir/map/mod.rs | 2 +- src/librustc/hir/mod.rs | 1 - src/librustc/ich/impls_hir.rs | 1 - src/librustc/middle/dead.rs | 2 +- src/librustc/middle/entry.rs | 33 ++++++++------- src/librustc/middle/lang_items.rs | 2 +- src/librustc/middle/reachable.rs | 4 +- src/librustc/middle/resolve_lifetime.rs | 15 ++++--- src/librustc/middle/stability.rs | 4 +- src/librustc/ty/mod.rs | 12 ++++-- src/librustc_driver/pretty.rs | 4 +- src/librustc_interface/proc_macro_decls.rs | 7 ++-- src/librustc_lint/builtin.rs | 34 ++++++++-------- src/librustc_lint/types.rs | 2 +- src/librustc_metadata/encoder.rs | 28 ++++++------- src/librustc_metadata/foreign_modules.rs | 2 +- src/librustc_metadata/index_builder.rs | 4 +- src/librustc_metadata/native_libs.rs | 2 +- src/librustc_mir/monomorphize/collector.rs | 15 +++---- src/librustc_passes/layout_test.rs | 2 +- src/librustc_plugin/build.rs | 9 ++--- src/librustc_privacy/lib.rs | 32 ++++++++------- src/librustc_typeck/check/method/suggest.rs | 2 +- src/librustc_typeck/check/mod.rs | 40 +++++++++---------- src/librustc_typeck/check/wfcheck.rs | 14 +++---- src/librustc_typeck/check_unused.rs | 2 +- .../coherence/inherent_impls.rs | 4 +- .../coherence/inherent_impls_overlap.rs | 2 +- src/librustc_typeck/coherence/orphan.rs | 4 +- src/librustc_typeck/coherence/unsafety.rs | 3 +- src/librustc_typeck/collect.rs | 20 +++++----- src/librustc_typeck/impl_wf_check.rs | 2 +- .../outlives/implicit_infer.rs | 8 ++-- src/librustc_typeck/outlives/test.rs | 2 +- src/librustc_typeck/variance/terms.rs | 2 +- src/librustc_typeck/variance/test.rs | 2 +- src/librustdoc/clean/mod.rs | 24 +++++------ src/librustdoc/doctree.rs | 26 ++++++------ src/librustdoc/visit_ast.rs | 36 ++++++++--------- 42 files changed, 208 insertions(+), 212 deletions(-) diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index ddc1eebe645a..8b304007a357 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -94,7 +94,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { /// Checks any attribute. fn check_attributes(&self, item: &hir::Item, target: Target) { if target == Target::Fn || target == Target::Const { - self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(item.id)); + self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id_from_hir_id(item.hir_id)); } else if let Some(a) = item.attrs.iter().find(|a| a.check_name("target_feature")) { self.tcx.sess.struct_span_err(a.span, "attribute should be applied to a function") .span_label(item.span, "not a function") diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index c99d1b7bd09d..53c1e5979663 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -1414,7 +1414,6 @@ impl<'a> LoweringContext<'a> { trace!("exist ty def index: {:#?}", exist_ty_def_index); let exist_ty_item = hir::Item { - id: exist_ty_id.node_id, hir_id: exist_ty_id.hir_id, ident: keywords::Invalid.ident(), attrs: Default::default(), @@ -3128,7 +3127,6 @@ impl<'a> LoweringContext<'a> { this.insert_item( new_id.node_id, hir::Item { - id: new_id.node_id, hir_id: new_id.hir_id, ident, attrs: attrs.clone(), @@ -3234,7 +3232,6 @@ impl<'a> LoweringContext<'a> { this.insert_item( new_id, hir::Item { - id: new_id, hir_id: new_hir_id, ident, attrs: attrs.clone(), @@ -3534,10 +3531,9 @@ impl<'a> LoweringContext<'a> { let node = self.lower_item_kind(i.id, &mut ident, &attrs, &mut vis, &i.node); - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(i.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(i.id); Some(hir::Item { - id: node_id, hir_id, ident, attrs, diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 0425d5a50238..9f39d648df1b 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -356,7 +356,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { fn visit_item(&mut self, i: &'hir Item) { debug!("visit_item: {:?}", i); debug_assert_eq!(i.hir_id.owner, - self.definitions.opt_def_index(i.id).unwrap()); + self.definitions.opt_def_index(self.hir_to_node_id[&i.hir_id]).unwrap()); self.with_dep_node_owner(i.hir_id.owner, i, |this| { this.insert(i.span, i.hir_id, Node::Item(i)); this.with_parent(i.hir_id, |this| { diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 2a664282d51c..f8d1c949bdc7 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -319,7 +319,7 @@ impl<'hir> Map<'hir> { match node { Node::Item(item) => { - let def_id = || self.local_def_id(item.id); + let def_id = || self.local_def_id_from_hir_id(item.hir_id); match item.node { ItemKind::Static(_, m, _) => Some(Def::Static(def_id(), m == MutMutable)), diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index dc15c2a04a81..8dfac646e8ea 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -2221,7 +2221,6 @@ pub struct ItemId { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Item { pub ident: Ident, - pub id: NodeId, pub hir_id: HirId, pub attrs: HirVec, pub node: ItemKind, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index ecd3d16d20a5..773fbda7961f 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -856,7 +856,6 @@ impl<'a> HashStable> for hir::Item { let hir::Item { ident, ref attrs, - id: _, hir_id: _, ref node, ref vis, diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index d94a6eb8804b..5fe22f4c5977 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -152,7 +152,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { Node::Item(item) => { match item.node { hir::ItemKind::Struct(..) | hir::ItemKind::Union(..) => { - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); let def = self.tcx.adt_def(def_id); self.repr_has_repr_c = def.repr.c(); diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs index 2d0e6c3917bb..c20454a8822c 100644 --- a/src/librustc/middle/entry.rs +++ b/src/librustc/middle/entry.rs @@ -2,11 +2,10 @@ use crate::hir::map as hir_map; use crate::hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, LOCAL_CRATE}; use crate::session::{config, Session}; use crate::session::config::EntryFnType; -use syntax::ast::NodeId; use syntax::attr; use syntax::entry::EntryPointType; use syntax_pos::Span; -use crate::hir::{Item, ItemKind, ImplItem, TraitItem}; +use crate::hir::{HirId, Item, ItemKind, ImplItem, TraitItem}; use crate::hir::itemlikevisit::ItemLikeVisitor; use crate::ty::TyCtxt; use crate::ty::query::Providers; @@ -17,22 +16,22 @@ struct EntryContext<'a, 'tcx: 'a> { map: &'a hir_map::Map<'tcx>, // The top-level function called 'main' - main_fn: Option<(NodeId, Span)>, + main_fn: Option<(HirId, Span)>, // The function that has attribute named 'main' - attr_main_fn: Option<(NodeId, Span)>, + attr_main_fn: Option<(HirId, Span)>, // The function that has the attribute 'start' on it - start_fn: Option<(NodeId, Span)>, + start_fn: Option<(HirId, Span)>, // The functions that one might think are 'main' but aren't, e.g. // main functions not defined at the top level. For diagnostics. - non_main_fns: Vec<(NodeId, Span)> , + non_main_fns: Vec<(HirId, Span)> , } impl<'a, 'tcx> ItemLikeVisitor<'tcx> for EntryContext<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx Item) { - let def_id = self.map.local_def_id(item.id); + let def_id = self.map.local_def_id_from_hir_id(item.hir_id); let def_key = self.map.def_key(def_id); let at_root = def_key.parent == Some(CRATE_DEF_INDEX); find_item(item, self, at_root); @@ -106,18 +105,18 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) { match entry_point_type(item, at_root) { EntryPointType::MainNamed => { if ctxt.main_fn.is_none() { - ctxt.main_fn = Some((item.id, item.span)); + ctxt.main_fn = Some((item.hir_id, item.span)); } else { span_err!(ctxt.session, item.span, E0136, "multiple 'main' functions"); } }, EntryPointType::OtherMain => { - ctxt.non_main_fns.push((item.id, item.span)); + ctxt.non_main_fns.push((item.hir_id, item.span)); }, EntryPointType::MainAttr => { if ctxt.attr_main_fn.is_none() { - ctxt.attr_main_fn = Some((item.id, item.span)); + ctxt.attr_main_fn = Some((item.hir_id, item.span)); } else { struct_span_err!(ctxt.session, item.span, E0137, "multiple functions with a #[main] attribute") @@ -128,7 +127,7 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) { }, EntryPointType::Start => { if ctxt.start_fn.is_none() { - ctxt.start_fn = Some((item.id, item.span)); + ctxt.start_fn = Some((item.hir_id, item.span)); } else { struct_span_err!(ctxt.session, item.span, E0138, "multiple 'start' functions") .span_label(ctxt.start_fn.unwrap().1, "previous `start` function here") @@ -144,12 +143,12 @@ fn configure_main( tcx: TyCtxt<'_, '_, '_>, visitor: &EntryContext<'_, '_>, ) -> Option<(DefId, EntryFnType)> { - if let Some((node_id, _)) = visitor.start_fn { - Some((tcx.hir().local_def_id(node_id), EntryFnType::Start)) - } else if let Some((node_id, _)) = visitor.attr_main_fn { - Some((tcx.hir().local_def_id(node_id), EntryFnType::Main)) - } else if let Some((node_id, _)) = visitor.main_fn { - Some((tcx.hir().local_def_id(node_id), EntryFnType::Main)) + if let Some((hir_id, _)) = visitor.start_fn { + Some((tcx.hir().local_def_id_from_hir_id(hir_id), EntryFnType::Start)) + } else if let Some((hir_id, _)) = visitor.attr_main_fn { + Some((tcx.hir().local_def_id_from_hir_id(hir_id), EntryFnType::Main)) + } else if let Some((hir_id, _)) = visitor.main_fn { + Some((tcx.hir().local_def_id_from_hir_id(hir_id), EntryFnType::Main)) } else { // No main function let mut err = struct_err!(tcx.sess, E0601, diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 3f9230ab551d..7626310ea4eb 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -98,7 +98,7 @@ impl<'a, 'v, 'tcx> ItemLikeVisitor<'v> for LanguageItemCollector<'a, 'tcx> { match self.item_refs.get(&*value.as_str()).cloned() { // Known lang item with attribute on correct target. Some((item_index, expected_target)) if actual_target == expected_target => { - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); self.collect_item(item_index, def_id); }, // Known lang item with attribute on incorrect target. diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 55a9b2477cfa..962a08c7bef8 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -36,7 +36,7 @@ fn item_might_be_inlined(tcx: TyCtxt<'a, 'tcx, 'tcx>, match item.node { hir::ItemKind::Impl(..) | hir::ItemKind::Fn(..) => { - let generics = tcx.generics_of(tcx.hir().local_def_id(item.id)); + let generics = tcx.generics_of(tcx.hir().local_def_id_from_hir_id(item.hir_id)); generics.requires_monomorphization(tcx) } _ => false, @@ -344,7 +344,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, // Anything which has custom linkage gets thrown on the worklist no // matter where it is in the crate, along with "special std symbols" // which are currently akin to allocator symbols. - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); let codegen_attrs = self.tcx.codegen_fn_attrs(def_id); if codegen_attrs.contains_extern_indicator() || codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL) { diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index dd44e19bc7df..7c2cf29eba1f 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -13,7 +13,7 @@ use crate::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt}; use crate::rustc::lint; use crate::session::Session; -use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, HirIdSet, NodeMap}; +use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, HirIdSet}; use errors::{Applicability, DiagnosticBuilder}; use rustc_data_structures::sync::Lrc; use std::borrow::Cow; @@ -204,7 +204,7 @@ struct NamedRegionMap { // For each type and trait definition, maps type parameters // to the trait object lifetime defaults computed from them. - pub object_lifetime_defaults: NodeMap>, + pub object_lifetime_defaults: HirIdMap>, } /// See [`NamedRegionMap`]. @@ -395,8 +395,7 @@ fn resolve_lifetimes<'tcx>( .or_default(); Lrc::get_mut(map).unwrap().insert(hir_id.local_id); } - for (k, v) in named_region_map.object_lifetime_defaults { - let hir_id = tcx.hir().node_to_hir_id(k); + for (hir_id, v) in named_region_map.object_lifetime_defaults { let map = rl.object_lifetime_defaults .entry(hir_id.owner_local_def_id()) .or_default(); @@ -1266,8 +1265,8 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) { fn compute_object_lifetime_defaults( tcx: TyCtxt<'_, '_, '_>, -) -> NodeMap> { - let mut map = NodeMap::default(); +) -> HirIdMap> { + let mut map = HirIdMap::default(); for item in tcx.hir().krate().items.values() { match item.node { hir::ItemKind::Struct(_, ref generics) @@ -1311,7 +1310,7 @@ fn compute_object_lifetime_defaults( tcx.sess.span_err(item.span, &object_lifetime_default_reprs); } - map.insert(item.id, result); + map.insert(item.hir_id, result); } _ => {} } @@ -1959,7 +1958,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { }; let map = &self.map; - let unsubst = if let Some(id) = self.tcx.hir().as_local_node_id(def_id) { + let unsubst = if let Some(id) = self.tcx.hir().as_local_hir_id(def_id) { &map.object_lifetime_defaults[&id] } else { let tcx = self.tcx; diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 8b5d70d834d9..aa2392448616 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -761,7 +761,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { // compiler-generated `extern crate` items have a dummy span. if item.span.is_dummy() { return } - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); let cnum = match self.tcx.extern_mod_stmt_cnum(def_id) { Some(cnum) => cnum, None => return, @@ -791,7 +791,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { // There's no good place to insert stability check for non-Copy unions, // so semi-randomly perform it here in stability.rs hir::ItemKind::Union(..) if !self.tcx.features().untagged_unions => { - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); let adt_def = self.tcx.adt_def(def_id); let ty = self.tcx.type_of(def_id); diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 5243c4dbfd20..3b89f853c3e8 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -260,7 +260,7 @@ impl<'a, 'gcx, 'tcx> DefIdTree for TyCtxt<'a, 'gcx, 'tcx> { } impl Visibility { - pub fn from_hir(visibility: &hir::Visibility, id: NodeId, tcx: TyCtxt<'_, '_, '_>) -> Self { + pub fn from_hir(visibility: &hir::Visibility, id: hir::HirId, tcx: TyCtxt<'_, '_, '_>) -> Self { match visibility.node { hir::VisibilityKind::Public => Visibility::Public, hir::VisibilityKind::Crate(_) => Visibility::Restricted(DefId::local(CRATE_DEF_INDEX)), @@ -271,7 +271,7 @@ impl Visibility { def => Visibility::Restricted(def.def_id()), }, hir::VisibilityKind::Inherited => { - Visibility::Restricted(tcx.hir().get_module_parent(id)) + Visibility::Restricted(tcx.hir().get_module_parent_by_hir_id(id)) } } } @@ -2737,11 +2737,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { hir::AssociatedItemKind::Existential => bug!("only impls can have existentials"), }; + let hir_id = self.hir().node_to_hir_id(trait_item_ref.id.node_id); + AssociatedItem { ident: trait_item_ref.ident, kind, // Visibility of trait items is inherited from their traits. - vis: Visibility::from_hir(parent_vis, trait_item_ref.id.node_id, self), + vis: Visibility::from_hir(parent_vis, hir_id, self), defaultness: trait_item_ref.defaultness, def_id, container: TraitContainer(parent_def_id), @@ -2763,11 +2765,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { hir::AssociatedItemKind::Existential => (ty::AssociatedKind::Existential, false), }; + let hir_id = self.hir().node_to_hir_id(impl_item_ref.id.node_id); + AssociatedItem { ident: impl_item_ref.ident, kind, // Visibility of trait impl items doesn't matter. - vis: ty::Visibility::from_hir(&impl_item_ref.vis, impl_item_ref.id.node_id, self), + vis: ty::Visibility::from_hir(&impl_item_ref.vis, hir_id, self), defaultness: impl_item_ref.defaultness, def_id, container: ImplContainer(parent_def_id), diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index ac2f6da0c608..3399562bc8d8 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -408,8 +408,8 @@ impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> { pprust_hir::AnnNode::Name(_) => Ok(()), pprust_hir::AnnNode::Item(item) => { s.s.space()?; - s.synth_comment(format!("node_id: {} hir local_id: {}", - item.id, item.hir_id.local_id.as_u32())) + s.synth_comment(format!("hir_id: {} hir local_id: {}", + item.hir_id, item.hir_id.local_id.as_u32())) } pprust_hir::AnnNode::SubItem(id) => { s.s.space()?; diff --git a/src/librustc_interface/proc_macro_decls.rs b/src/librustc_interface/proc_macro_decls.rs index 093d15b7e3c5..8ed03efd1a78 100644 --- a/src/librustc_interface/proc_macro_decls.rs +++ b/src/librustc_interface/proc_macro_decls.rs @@ -3,7 +3,6 @@ use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::hir; use rustc::ty::TyCtxt; use rustc::ty::query::Providers; -use syntax::ast; use syntax::attr; pub fn find<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> Option { @@ -19,17 +18,17 @@ fn proc_macro_decls_static<'tcx>( let mut finder = Finder { decls: None }; tcx.hir().krate().visit_all_item_likes(&mut finder); - finder.decls.map(|id| tcx.hir().local_def_id(id)) + finder.decls.map(|id| tcx.hir().local_def_id_from_hir_id(id)) } struct Finder { - decls: Option, + decls: Option, } impl<'v> ItemLikeVisitor<'v> for Finder { fn visit_item(&mut self, item: &hir::Item) { if attr::contains_name(&item.attrs, "rustc_proc_macro_decls") { - self.decls = Some(item.id); + self.decls = Some(item.hir_id); } } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index e540a21c2fda..f5737c8fe51c 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -26,7 +26,7 @@ use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::ty::{self, Ty}; use rustc::{lint, util}; use hir::Node; -use util::nodemap::NodeSet; +use util::nodemap::HirIdSet; use lint::{LateContext, LintContext, LintArray}; use lint::{LintPass, LateLintPass, EarlyLintPass, EarlyContext}; @@ -137,7 +137,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxPointers { hir::ItemKind::Enum(..) | hir::ItemKind::Struct(..) | hir::ItemKind::Union(..) => { - let def_id = cx.tcx.hir().local_def_id(it.id); + let def_id = cx.tcx.hir().local_def_id_from_hir_id(it.hir_id); self.check_heap_type(cx, it.span, cx.tcx.type_of(def_id)) } _ => () @@ -569,21 +569,21 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingCopyImplementations { if !ast_generics.params.is_empty() { return; } - let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id(item.id)); + let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id_from_hir_id(item.hir_id)); (def, cx.tcx.mk_adt(def, cx.tcx.intern_substs(&[]))) } hir::ItemKind::Union(_, ref ast_generics) => { if !ast_generics.params.is_empty() { return; } - let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id(item.id)); + let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id_from_hir_id(item.hir_id)); (def, cx.tcx.mk_adt(def, cx.tcx.intern_substs(&[]))) } hir::ItemKind::Enum(_, ref ast_generics) => { if !ast_generics.params.is_empty() { return; } - let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id(item.id)); + let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id_from_hir_id(item.hir_id)); (def, cx.tcx.mk_adt(def, cx.tcx.intern_substs(&[]))) } _ => return, @@ -611,7 +611,7 @@ declare_lint! { } pub struct MissingDebugImplementations { - impling_types: Option, + impling_types: Option, } impl MissingDebugImplementations { @@ -650,11 +650,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations { }; if self.impling_types.is_none() { - let mut impls = NodeSet::default(); + let mut impls = HirIdSet::default(); cx.tcx.for_each_impl(debug, |d| { if let Some(ty_def) = cx.tcx.type_of(d).ty_adt_def() { - if let Some(node_id) = cx.tcx.hir().as_local_node_id(ty_def.did) { - impls.insert(node_id); + if let Some(hir_id) = cx.tcx.hir().as_local_hir_id(ty_def.did) { + impls.insert(hir_id); } } }); @@ -663,7 +663,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations { debug!("{:?}", self.impling_types); } - if !self.impling_types.as_ref().unwrap().contains(&item.id) { + if !self.impling_types.as_ref().unwrap().contains(&item.hir_id) { cx.span_lint(MISSING_DEBUG_IMPLEMENTATIONS, item.span, "type does not implement `fmt::Debug`; consider adding #[derive(Debug)] \ @@ -860,7 +860,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PluginAsLibrary { _ => return, }; - let def_id = cx.tcx.hir().local_def_id(it.id); + let def_id = cx.tcx.hir().local_def_id_from_hir_id(it.hir_id); let prfn = match cx.tcx.extern_mod_stmt_cnum(def_id) { Some(cnum) => cx.tcx.plugin_registrar_fn(cnum), None => { @@ -1360,7 +1360,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TrivialConstraints { if cx.tcx.features().trivial_bounds { - let def_id = cx.tcx.hir().local_def_id(item.id); + let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id); let predicates = cx.tcx.predicates_of(def_id); for &(predicate, span) in &predicates.predicates { let predicate_kind_name = match predicate { @@ -1500,14 +1500,14 @@ declare_lint! { } pub struct UnnameableTestItems { - boundary: ast::NodeId, // NodeId of the item under which things are not nameable + boundary: hir::HirId, // HirId of the item under which things are not nameable items_nameable: bool, } impl UnnameableTestItems { pub fn new() -> Self { Self { - boundary: ast::DUMMY_NODE_ID, + boundary: hir::DUMMY_HIR_ID, items_nameable: true } } @@ -1529,7 +1529,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnnameableTestItems { if let hir::ItemKind::Mod(..) = it.node {} else { self.items_nameable = false; - self.boundary = it.id; + self.boundary = it.hir_id; } return; } @@ -1544,7 +1544,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnnameableTestItems { } fn check_item_post(&mut self, _cx: &LateContext<'_, '_>, it: &hir::Item) { - if !self.items_nameable && self.boundary == it.id { + if !self.items_nameable && self.boundary == it.hir_id { self.items_nameable = true; } } @@ -1794,7 +1794,7 @@ impl ExplicitOutlivesRequirements { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) { let infer_static = cx.tcx.features().infer_static_outlives_requirements; - let def_id = cx.tcx.hir().local_def_id(item.id); + let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id); if let hir::ItemKind::Struct(_, ref generics) = item.node { let mut bound_count = 0; let mut lint_spans = Vec::new(); diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index da6c3b6dc159..4ad1a00afe97 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -839,7 +839,7 @@ impl LintPass for VariantSizeDifferences { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for VariantSizeDifferences { fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) { if let hir::ItemKind::Enum(ref enum_definition, _) = it.node { - let item_def_id = cx.tcx.hir().local_def_id(it.id); + let item_def_id = cx.tcx.hir().local_def_id_from_hir_id(it.hir_id); let t = cx.tcx.type_of(item_def_id); let ty = cx.tcx.erase_regions(&t); match cx.layout_of(ty) { diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 9ea277984e7b..541c7a781992 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -29,7 +29,7 @@ use std::hash::Hash; use std::path::Path; use rustc_data_structures::sync::Lrc; use std::u32; -use syntax::ast::{self, CRATE_NODE_ID}; +use syntax::ast; use syntax::attr; use syntax::source_map::Spanned; use syntax::symbol::keywords; @@ -314,7 +314,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { let vis = Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Public }; index.record(DefId::local(CRATE_DEF_INDEX), IsolatedEncoder::encode_info_for_mod, - FromId(CRATE_NODE_ID, (&krate.module, &krate.attrs, &vis))); + FromId(hir::CRATE_HIR_ID, (&krate.module, &krate.attrs, &vis))); let mut visitor = EncodeVisitor { index }; krate.visit_all_item_likes(&mut visitor.as_deep_visitor()); for macro_def in &krate.exported_macros { @@ -588,8 +588,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { } }; - let enum_id = tcx.hir().as_local_node_id(enum_did).unwrap(); - let enum_vis = &tcx.hir().expect_item(enum_id).vis; + let enum_id = tcx.hir().as_local_hir_id(enum_did).unwrap(); + let enum_vis = &tcx.hir().expect_item_by_hir_id(enum_id).vis; Entry { kind: EntryKind::Variant(self.lazy(&data)), @@ -624,7 +624,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { &hir::Visibility)>) -> Entry<'tcx> { let tcx = self.tcx; - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); debug!("IsolatedEncoder::encode_info_for_mod({:?})", def_id); let data = ModData { @@ -714,8 +714,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { } }; - let struct_id = tcx.hir().as_local_node_id(adt_def_id).unwrap(); - let struct_vis = &tcx.hir().expect_item(struct_id).vis; + let struct_id = tcx.hir().as_local_hir_id(adt_def_id).unwrap(); + let struct_vis = &tcx.hir().expect_item_by_hir_id(struct_id).vis; let mut ctor_vis = ty::Visibility::from_hir(struct_vis, struct_id, tcx); for field in &variant.fields { if ctor_vis.is_at_least(field.vis, tcx) { @@ -1055,7 +1055,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { EntryKind::Fn(self.lazy(&data)) } hir::ItemKind::Mod(ref m) => { - return self.encode_info_for_mod(FromId(item.id, (m, &item.attrs, &item.vis))); + return self.encode_info_for_mod(FromId(item.hir_id, (m, &item.attrs, &item.vis))); } hir::ItemKind::ForeignMod(_) => EntryKind::ForeignMod, hir::ItemKind::GlobalAsm(..) => EntryKind::GlobalAsm, @@ -1154,7 +1154,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { Entry { kind, - visibility: self.lazy(&ty::Visibility::from_hir(&item.vis, item.id, tcx)), + visibility: self.lazy(&ty::Visibility::from_hir(&item.vis, item.hir_id, tcx)), span: self.lazy(&item.span), attributes: self.encode_attributes(&item.attrs), children: match item.node { @@ -1608,11 +1608,9 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { hir::ForeignItemKind::Type => EntryKind::ForeignType, }; - let node_id = self.tcx.hir().hir_to_node_id(nitem.hir_id); - Entry { kind, - visibility: self.lazy(&ty::Visibility::from_hir(&nitem.vis, node_id, tcx)), + visibility: self.lazy(&ty::Visibility::from_hir(&nitem.vis, nitem.hir_id, tcx)), span: self.lazy(&nitem.span), attributes: self.encode_attributes(&nitem.attrs), children: LazySeq::empty(), @@ -1648,7 +1646,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> { } fn visit_item(&mut self, item: &'tcx hir::Item) { intravisit::walk_item(self, item); - let def_id = self.index.tcx.hir().local_def_id(item.id); + let def_id = self.index.tcx.hir().local_def_id_from_hir_id(item.hir_id); match item.node { hir::ItemKind::ExternCrate(_) | hir::ItemKind::Use(..) => (), // ignore these @@ -1744,7 +1742,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { /// so it's easier to do that here then to wait until we would encounter /// normally in the visitor walk. fn encode_addl_info_for_item(&mut self, item: &hir::Item) { - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); match item.node { hir::ItemKind::Static(..) | hir::ItemKind::Const(..) | @@ -1809,7 +1807,7 @@ struct ImplVisitor<'a, 'tcx: 'a> { impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'a, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { if let hir::ItemKind::Impl(..) = item.node { - let impl_id = self.tcx.hir().local_def_id(item.id); + let impl_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); if let Some(trait_ref) = self.tcx.impl_trait_ref(impl_id) { self.impls .entry(trait_ref.def_id) diff --git a/src/librustc_metadata/foreign_modules.rs b/src/librustc_metadata/foreign_modules.rs index e1487b6be0fe..284f6796145a 100644 --- a/src/librustc_metadata/foreign_modules.rs +++ b/src/librustc_metadata/foreign_modules.rs @@ -29,7 +29,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for Collector<'a, 'tcx> { .collect(); self.modules.push(ForeignModule { foreign_items, - def_id: self.tcx.hir().local_def_id(it.id), + def_id: self.tcx.hir().local_def_id_from_hir_id(it.hir_id), }); } diff --git a/src/librustc_metadata/index_builder.rs b/src/librustc_metadata/index_builder.rs index 3e2571fc0b39..8343171b99f4 100644 --- a/src/librustc_metadata/index_builder.rs +++ b/src/librustc_metadata/index_builder.rs @@ -215,10 +215,10 @@ impl DepGraphRead for Untracked { /// HIR node that doesn't carry its own ID. This will allow an /// arbitrary `T` to be passed in, but register a read on the given /// `NodeId`. -pub struct FromId(pub ast::NodeId, pub T); +pub struct FromId(pub hir::HirId, pub T); impl DepGraphRead for FromId { fn read(&self, tcx: TyCtxt<'_, '_, '_>) { - tcx.hir().read(self.0); + tcx.hir().read_by_hir_id(self.0); } } diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index 118fb203c69a..23898387cba4 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -56,7 +56,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for Collector<'a, 'tcx> { name: None, kind: cstore::NativeUnknown, cfg: None, - foreign_module: Some(self.tcx.hir().local_def_id(it.id)), + foreign_module: Some(self.tcx.hir().local_def_id_from_hir_id(it.hir_id)), wasm_import_module: None, }; let mut kind_specified = false; diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index a58c69f636d4..1f20c70dec50 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -952,7 +952,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { hir::ItemKind::Union(_, ref generics) => { if generics.params.is_empty() { if self.mode == MonoItemCollectionMode::Eager { - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); debug!("RootCollector: ADT drop-glue for {}", def_id_to_string(self.tcx, def_id)); @@ -964,11 +964,12 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { hir::ItemKind::GlobalAsm(..) => { debug!("RootCollector: ItemKind::GlobalAsm({})", def_id_to_string(self.tcx, - self.tcx.hir().local_def_id(item.id))); - self.output.push(MonoItem::GlobalAsm(item.id)); + self.tcx.hir().local_def_id_from_hir_id(item.hir_id))); + let node_id = self.tcx.hir().hir_to_node_id(item.hir_id); + self.output.push(MonoItem::GlobalAsm(node_id)); } hir::ItemKind::Static(..) => { - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); debug!("RootCollector: ItemKind::Static({})", def_id_to_string(self.tcx, def_id)); self.output.push(MonoItem::Static(def_id)); @@ -978,7 +979,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { // actually used somewhere. Just declaring them is insufficient. // but even just declaring them must collect the items they refer to - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); let instance = Instance::mono(self.tcx, def_id); let cid = GlobalId { @@ -992,7 +993,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { } } hir::ItemKind::Fn(..) => { - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); self.push_if_root(def_id); } } @@ -1097,7 +1098,7 @@ fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } - let impl_def_id = tcx.hir().local_def_id(item.id); + let impl_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); debug!("create_mono_items_for_default_impls(item={})", def_id_to_string(tcx, impl_def_id)); diff --git a/src/librustc_passes/layout_test.rs b/src/librustc_passes/layout_test.rs index d21707c578b2..7fe3f5a36d85 100644 --- a/src/librustc_passes/layout_test.rs +++ b/src/librustc_passes/layout_test.rs @@ -27,7 +27,7 @@ struct VarianceTest<'a, 'tcx: 'a> { impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { - let item_def_id = self.tcx.hir().local_def_id(item.id); + let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); if let ItemKind::Ty(..) = item.node { for attr in self.tcx.get_attrs(item_def_id).iter() { diff --git a/src/librustc_plugin/build.rs b/src/librustc_plugin/build.rs index c1ba4d7b3d86..31018a7cd7a3 100644 --- a/src/librustc_plugin/build.rs +++ b/src/librustc_plugin/build.rs @@ -1,6 +1,5 @@ //! Used by `rustc` when compiling a plugin crate. -use syntax::ast; use syntax::attr; use syntax_pos::Span; use rustc::hir::itemlikevisit::ItemLikeVisitor; @@ -10,7 +9,7 @@ use rustc::ty::TyCtxt; use rustc::ty::query::Providers; struct RegistrarFinder { - registrars: Vec<(ast::NodeId, Span)> , + registrars: Vec<(hir::HirId, Span)> , } impl<'v> ItemLikeVisitor<'v> for RegistrarFinder { @@ -18,7 +17,7 @@ impl<'v> ItemLikeVisitor<'v> for RegistrarFinder { if let hir::ItemKind::Fn(..) = item.node { if attr::contains_name(&item.attrs, "plugin_registrar") { - self.registrars.push((item.id, item.span)); + self.registrars.push((item.hir_id, item.span)); } } } @@ -47,8 +46,8 @@ fn plugin_registrar_fn<'tcx>( match finder.registrars.len() { 0 => None, 1 => { - let (node_id, _) = finder.registrars.pop().unwrap(); - Some(tcx.hir().local_def_id(node_id)) + let (hir_id, _) = finder.registrars.pop().unwrap(); + Some(tcx.hir().local_def_id_from_hir_id(hir_id)) }, _ => { let diagnostic = tcx.sess.diagnostic(); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 7bd0d746bcb6..240e55abde82 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -220,16 +220,16 @@ impl<'a, 'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'a, 'tcx, V> fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> (ty::Visibility, Span, &'static str) { - match tcx.hir().as_local_node_id(def_id) { - Some(node_id) => { - let vis = match tcx.hir().get(node_id) { + match tcx.hir().as_local_hir_id(def_id) { + Some(hir_id) => { + let vis = match tcx.hir().get_by_hir_id(hir_id) { Node::Item(item) => &item.vis, Node::ForeignItem(foreign_item) => &foreign_item.vis, Node::TraitItem(..) | Node::Variant(..) => { - return def_id_visibility(tcx, tcx.hir().get_parent_did(node_id)); + return def_id_visibility(tcx, tcx.hir().get_parent_did_by_hir_id(hir_id)); } Node::ImplItem(impl_item) => { - match tcx.hir().get(tcx.hir().get_parent(node_id)) { + match tcx.hir().get_by_hir_id(tcx.hir().get_parent_item(hir_id)) { Node::Item(item) => match &item.node { hir::ItemKind::Impl(.., None, _, _) => &impl_item.vis, hir::ItemKind::Impl(.., Some(trait_ref), _, _) @@ -240,16 +240,16 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) } } Node::StructCtor(vdata) => { - let struct_node_id = tcx.hir().get_parent(node_id); - let item = match tcx.hir().get(struct_node_id) { + let struct_hir_id = tcx.hir().get_parent_item(hir_id); + let item = match tcx.hir().get_by_hir_id(struct_hir_id) { Node::Item(item) => item, node => bug!("unexpected node kind: {:?}", node), }; let (mut ctor_vis, mut span, mut descr) = - (ty::Visibility::from_hir(&item.vis, struct_node_id, tcx), + (ty::Visibility::from_hir(&item.vis, struct_hir_id, tcx), item.vis.span, item.vis.node.descr()); for field in vdata.fields() { - let field_vis = ty::Visibility::from_hir(&field.vis, node_id, tcx); + let field_vis = ty::Visibility::from_hir(&field.vis, hir_id, tcx); if ctor_vis.is_at_least(field_vis, tcx) { ctor_vis = field_vis; span = field.vis.span; @@ -260,7 +260,7 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) // If the structure is marked as non_exhaustive then lower the // visibility to within the crate. if ctor_vis == ty::Visibility::Public { - let adt_def = tcx.adt_def(tcx.hir().get_parent_did(node_id)); + let adt_def = tcx.adt_def(tcx.hir().get_parent_did_by_hir_id(hir_id)); if adt_def.non_enum_variant().is_field_list_non_exhaustive() { ctor_vis = ty::Visibility::Restricted(DefId::local(CRATE_DEF_INDEX)); span = attr::find_by_name(&item.attrs, "non_exhaustive").unwrap().span; @@ -277,7 +277,7 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) } node => bug!("unexpected node kind: {:?}", node) }; - (ty::Visibility::from_hir(vis, node_id, tcx), vis.span, vis.node.descr()) + (ty::Visibility::from_hir(vis, hir_id, tcx), vis.span, vis.node.descr()) } None => { let vis = tcx.visibility(def_id); @@ -1679,7 +1679,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> fn visit_item(&mut self, item: &'tcx hir::Item) { let tcx = self.tcx; - let item_visibility = ty::Visibility::from_hir(&item.vis, item.id, tcx); + let item_visibility = ty::Visibility::from_hir(&item.vis, item.hir_id, tcx); match item.node { // Crates are always public. @@ -1724,7 +1724,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> // Subitems of foreign modules have their own publicity. hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { - let vis = ty::Visibility::from_hir(&foreign_item.vis, item.id, tcx); + let vis = ty::Visibility::from_hir(&foreign_item.vis, item.hir_id, tcx); self.check(foreign_item.hir_id, vis).generics().predicates().ty(); } } @@ -1734,7 +1734,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> self.check(item.hir_id, item_visibility).generics().predicates(); for field in struct_def.fields() { - let field_visibility = ty::Visibility::from_hir(&field.vis, item.id, tcx); + let field_visibility = ty::Visibility::from_hir(&field.vis, item.hir_id, tcx); self.check(field.hir_id, min(item_visibility, field_visibility, tcx)).ty(); } } @@ -1748,7 +1748,9 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> for impl_item_ref in impl_item_refs { let impl_item = tcx.hir().impl_item(impl_item_ref.id); let impl_item_vis = if trait_ref.is_none() { - min(ty::Visibility::from_hir(&impl_item.vis, item.id, tcx), impl_vis, tcx) + min(ty::Visibility::from_hir(&impl_item.vis, item.hir_id, tcx), + impl_vis, + tcx) } else { impl_vis }; diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index c15cb1e5bb15..4bf6471a6293 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -732,7 +732,7 @@ fn compute_all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec impl<'v, 'a, 'tcx> itemlikevisit::ItemLikeVisitor<'v> for Visitor<'a, 'tcx> { fn visit_item(&mut self, i: &'v hir::Item) { if let hir::ItemKind::Trait(..) = i.node { - let def_id = self.map.local_def_id(i.id); + let def_id = self.map.local_def_id_from_hir_id(i.hir_id); self.traits.push(def_id); } } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index ace6469f46f1..8c428e516bce 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1289,9 +1289,9 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, } fn check_struct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - id: ast::NodeId, + id: hir::HirId, span: Span) { - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); let def = tcx.adt_def(def_id); def.destructor(tcx); // force the destructor to be evaluated check_representable(tcx, span, def_id); @@ -1305,9 +1305,9 @@ fn check_struct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn check_union<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - id: ast::NodeId, + id: hir::HirId, span: Span) { - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); let def = tcx.adt_def(def_id); def.destructor(tcx); // force the destructor to be evaluated check_representable(tcx, span, def_id); @@ -1338,28 +1338,28 @@ fn check_opaque<'a, 'tcx>( pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Item) { debug!( - "check_item_type(it.id={}, it.name={})", - it.id, - tcx.item_path_str(tcx.hir().local_def_id(it.id)) + "check_item_type(it.hir_id={}, it.name={})", + it.hir_id, + tcx.item_path_str(tcx.hir().local_def_id_from_hir_id(it.hir_id)) ); let _indenter = indenter(); match it.node { // Consts can play a role in type-checking, so they are included here. hir::ItemKind::Static(..) => { - let def_id = tcx.hir().local_def_id(it.id); + let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id); tcx.typeck_tables_of(def_id); maybe_check_static_with_link_section(tcx, def_id, it.span); } hir::ItemKind::Const(..) => { - tcx.typeck_tables_of(tcx.hir().local_def_id(it.id)); + tcx.typeck_tables_of(tcx.hir().local_def_id_from_hir_id(it.hir_id)); } hir::ItemKind::Enum(ref enum_definition, _) => { - check_enum(tcx, it.span, &enum_definition.variants, it.id); + check_enum(tcx, it.span, &enum_definition.variants, it.hir_id); } hir::ItemKind::Fn(..) => {} // entirely within check_item_body hir::ItemKind::Impl(.., ref impl_item_refs) => { - debug!("ItemKind::Impl {} with id {}", it.ident, it.id); - let impl_def_id = tcx.hir().local_def_id(it.id); + debug!("ItemKind::Impl {} with id {}", it.ident, it.hir_id); + let impl_def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id); if let Some(impl_trait_ref) = tcx.impl_trait_ref(impl_def_id) { check_impl_items_against_trait( tcx, @@ -1373,23 +1373,23 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite } } hir::ItemKind::Trait(..) => { - let def_id = tcx.hir().local_def_id(it.id); + let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id); check_on_unimplemented(tcx, def_id, it); } hir::ItemKind::Struct(..) => { - check_struct(tcx, it.id, it.span); + check_struct(tcx, it.hir_id, it.span); } hir::ItemKind::Union(..) => { - check_union(tcx, it.id, it.span); + check_union(tcx, it.hir_id, it.span); } hir::ItemKind::Existential(..) => { - let def_id = tcx.hir().local_def_id(it.id); + let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id); let substs = InternalSubsts::identity_for_item(tcx, def_id); check_opaque(tcx, def_id, substs, it.span); } hir::ItemKind::Ty(..) => { - let def_id = tcx.hir().local_def_id(it.id); + let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id); let pty_ty = tcx.type_of(def_id); let generics = tcx.generics_of(def_id); check_bounds_are_used(tcx, &generics, pty_ty); @@ -1476,7 +1476,7 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_, '_, '_>, id: DefId, span fn check_on_unimplemented<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_def_id: DefId, item: &hir::Item) { - let item_def_id = tcx.hir().local_def_id(item.id); + let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); // an error would be reported if this fails. let _ = traits::OnUnimplementedDirective::of_item(tcx, trait_def_id, item_def_id); } @@ -1842,8 +1842,8 @@ fn check_transparent<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: De pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, vs: &'tcx [hir::Variant], - id: ast::NodeId) { - let def_id = tcx.hir().local_def_id(id); + id: hir::HirId) { + let def_id = tcx.hir().local_def_id_from_hir_id(id); let def = tcx.adt_def(def_id); def.destructor(tcx); // force the destructor to be evaluated diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 51a971823afb..860fa526a1b9 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -241,7 +241,7 @@ fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>, { for_item(tcx, item).with_fcx(|fcx, fcx_tcx| { let variants = lookup_fields(fcx); - let def_id = fcx.tcx.hir().local_def_id(item.id); + let def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id); let packed = fcx.tcx.adt_def(def_id).repr.packed(); for variant in &variants { @@ -302,9 +302,9 @@ fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn check_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { - debug!("check_trait: {:?}", item.id); + debug!("check_trait: {:?}", item.hir_id); - let trait_def_id = tcx.hir().local_def_id(item.id); + let trait_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); let trait_def = tcx.trait_def(trait_def_id); if trait_def.is_marker { @@ -326,7 +326,7 @@ fn check_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { fn check_item_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { for_item(tcx, item).with_fcx(|fcx, tcx| { - let def_id = fcx.tcx.hir().local_def_id(item.id); + let def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id); let sig = fcx.tcx.fn_sig(def_id); let sig = fcx.normalize_associated_types_in(item.span, &sig); let mut implied_bounds = vec![]; @@ -376,7 +376,7 @@ fn check_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, debug!("check_impl: {:?}", item); for_item(tcx, item).with_fcx(|fcx, tcx| { - let item_def_id = fcx.tcx.hir().local_def_id(item.id); + let item_def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id); match *ast_trait_ref { Some(ref ast_trait_ref) => { @@ -887,7 +887,7 @@ fn check_variances_for_type_defn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item, hir_generics: &hir::Generics) { - let item_def_id = tcx.hir().local_def_id(item.id); + let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); let ty = tcx.type_of(item_def_id); if tcx.has_error_field(ty) { return; @@ -1018,7 +1018,7 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> { impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'a, 'tcx> { fn visit_item(&mut self, i: &'tcx hir::Item) { debug!("visit_item: {:?}", i); - let def_id = self.tcx.hir().local_def_id(i.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(i.hir_id); self.tcx.ensure().check_item_well_formed(def_id); } diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index 4c6d7710009b..6079f12936b5 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -212,7 +212,7 @@ struct ExternCrateToLint { impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CollectExternCrateVisitor<'a, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { if let hir::ItemKind::ExternCrate(orig_name) = item.node { - let extern_crate_def_id = self.tcx.hir().local_def_id(item.id); + let extern_crate_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); self.crates_to_lint.push( ExternCrateToLint { def_id: extern_crate_def_id, diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index 93cc86423ace..d167c7fcafbe 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -85,7 +85,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> { _ => return }; - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); let self_ty = self.tcx.type_of(def_id); let lang_items = self.tcx.lang_items(); match self_ty.sty { @@ -288,7 +288,7 @@ impl<'a, 'tcx> InherentCollect<'a, 'tcx> { // Add the implementation to the mapping from implementation to base // type def ID, if there is a base type for this implementation and // the implementation does not have any associated traits. - let impl_def_id = self.tcx.hir().local_def_id(item.id); + let impl_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); let mut rc_vec = self.impls_map.inherent_impls .entry(def_id) .or_default(); diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs index a51f45a6ff8f..832c172e97c1 100644 --- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs +++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs @@ -120,7 +120,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentOverlapChecker<'a, 'tcx> { hir::ItemKind::Struct(..) | hir::ItemKind::Trait(..) | hir::ItemKind::Union(..) => { - let type_def_id = self.tcx.hir().local_def_id(item.id); + let type_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); self.check_for_overlapping_inherent_impls(type_def_id); } _ => {} diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index b776a980b7c9..c875b856f3a4 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -22,11 +22,11 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> { /// to prevent inundating the user with a bunch of similar error /// reports. fn visit_item(&mut self, item: &hir::Item) { - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); // "Trait" impl if let hir::ItemKind::Impl(.., Some(_), _, _) = item.node { debug!("coherence2::orphan check: trait impl {}", - self.tcx.hir().node_to_string(item.id)); + self.tcx.hir().hir_to_string(item.hir_id)); let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap(); let trait_def_id = trait_ref.def_id; let cm = self.tcx.sess.source_map(); diff --git a/src/librustc_typeck/coherence/unsafety.rs b/src/librustc_typeck/coherence/unsafety.rs index 81ef4de3d80e..0b1de510aa4b 100644 --- a/src/librustc_typeck/coherence/unsafety.rs +++ b/src/librustc_typeck/coherence/unsafety.rs @@ -21,7 +21,8 @@ impl<'cx, 'tcx, 'v> UnsafetyChecker<'cx, 'tcx> { unsafety: hir::Unsafety, polarity: hir::ImplPolarity) { - if let Some(trait_ref) = self.tcx.impl_trait_ref(self.tcx.hir().local_def_id(item.id)) { + let local_did = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); + if let Some(trait_ref) = self.tcx.impl_trait_ref(local_did) { let trait_def = self.tcx.trait_def(trait_ref.def_id); let unsafe_attr = impl_generics.and_then(|generics| { generics.params.iter().find(|p| p.pure_wrt_drop).map(|_| "may_dangle") diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index a66fc328547e..95c0ad95bc1a 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -118,7 +118,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { } fn visit_item(&mut self, item: &'tcx hir::Item) { - convert_item(self.tcx, item.id); + convert_item(self.tcx, item.hir_id); intravisit::walk_item(self, item); } @@ -397,10 +397,10 @@ fn is_param<'a, 'tcx>( } } -fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) { - let it = tcx.hir().expect_item(item_id); - debug!("convert: item {} with id {}", it.ident, it.id); - let def_id = tcx.hir().local_def_id(item_id); +fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: hir::HirId) { + let it = tcx.hir().expect_item_by_hir_id(item_id); + debug!("convert: item {} with id {}", it.ident, it.hir_id); + let def_id = tcx.hir().local_def_id_from_hir_id(item_id); match it.node { // These don't define types. hir::ItemKind::ExternCrate(_) @@ -577,7 +577,7 @@ fn convert_variant<'a, 'tcx>( attribute_def_id: DefId ) -> ty::VariantDef { let mut seen_fields: FxHashMap = Default::default(); - let node_id = tcx.hir().as_local_node_id(did).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(did).unwrap(); let fields = def .fields() .iter() @@ -601,7 +601,7 @@ fn convert_variant<'a, 'tcx>( ty::FieldDef { did: fid, ident: f.ident, - vis: ty::Visibility::from_hir(&f.vis, node_id, tcx), + vis: ty::Visibility::from_hir(&f.vis, hir_id, tcx), } }) .collect(); @@ -937,12 +937,12 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty // // Something of a hack: use the node id for the trait, also as // the node id for the Self type parameter. - let param_id = item.id; + let param_id = item.hir_id; opt_self = Some(ty::GenericParamDef { index: 0, name: keywords::SelfUpper.name().as_interned_str(), - def_id: tcx.hir().local_def_id(param_id), + def_id: tcx.hir().local_def_id_from_hir_id(param_id), pure_wrt_drop: false, kind: ty::GenericParamDefKind::Type { has_default: false, @@ -1477,7 +1477,7 @@ fn find_existential_constraints<'a, 'tcx>( intravisit::NestedVisitorMap::All(&self.tcx.hir()) } fn visit_item(&mut self, it: &'tcx Item) { - let def_id = self.tcx.hir().local_def_id(it.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(it.hir_id); // the existential type itself or its children are not within its reveal scope if def_id != self.def_id { self.check(def_id); diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index ed39874eeaad..fb61dfad472a 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -79,7 +79,7 @@ struct ImplWfCheck<'a, 'tcx: 'a> { impl<'a, 'tcx> ItemLikeVisitor<'tcx> for ImplWfCheck<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { if let hir::ItemKind::Impl(.., ref impl_item_refs) = item.node { - let impl_def_id = self.tcx.hir().local_def_id(item.id); + let impl_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); enforce_impl_params_are_constrained(self.tcx, impl_def_id, impl_item_refs); diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index 6c56e9991c8a..b560f3b49792 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -52,16 +52,16 @@ pub struct InferVisitor<'cx, 'tcx: 'cx> { impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { - let item_did = self.tcx.hir().local_def_id(item.id); + let item_did = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); debug!("InferVisitor::visit_item(item={:?})", item_did); - let node_id = self + let hir_id = self .tcx .hir() - .as_local_node_id(item_did) + .as_local_hir_id(item_did) .expect("expected local def-id"); - let item = match self.tcx.hir().get(node_id) { + let item = match self.tcx.hir().get_by_hir_id(hir_id) { Node::Item(item) => item, _ => bug!(), }; diff --git a/src/librustc_typeck/outlives/test.rs b/src/librustc_typeck/outlives/test.rs index cbeb7f7b6919..e10c83612071 100644 --- a/src/librustc_typeck/outlives/test.rs +++ b/src/librustc_typeck/outlives/test.rs @@ -14,7 +14,7 @@ struct OutlivesTest<'a, 'tcx: 'a> { impl<'a, 'tcx> ItemLikeVisitor<'tcx> for OutlivesTest<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { - let item_def_id = self.tcx.hir().local_def_id(item.id); + let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); // For unit testing: check for a special "rustc_outlives" // attribute and report an error with various results if found. diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index e564a8658fca..50c8d5adfa37 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -128,7 +128,7 @@ impl<'a, 'tcx> TermsContext<'a, 'tcx> { impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for TermsContext<'a, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { debug!("add_inferreds for item {}", - self.tcx.hir().node_to_string(item.id)); + self.tcx.hir().hir_to_string(item.hir_id)); match item.node { hir::ItemKind::Struct(ref struct_def, _) | diff --git a/src/librustc_typeck/variance/test.rs b/src/librustc_typeck/variance/test.rs index 0f566e6ded97..d04b1b276a2c 100644 --- a/src/librustc_typeck/variance/test.rs +++ b/src/librustc_typeck/variance/test.rs @@ -12,7 +12,7 @@ struct VarianceTest<'a, 'tcx: 'a> { impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { - let item_def_id = self.tcx.hir().local_def_id(item.id); + let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); // For unit testing: check for a special "rustc_variance" // attribute and report an error with various results if found. diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 15840da2f40f..7511ad5dd29d 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1725,7 +1725,7 @@ impl Clean for doctree::Function { (self.generics.clean(cx), (&self.decl, self.body).clean(cx)) }); - let did = cx.tcx.hir().local_def_id(self.id); + let did = cx.tcx.hir().local_def_id_from_hir_id(self.id); let constness = if cx.tcx.is_min_const_fn(did) { hir::Constness::Const } else { @@ -1932,7 +1932,7 @@ impl Clean for doctree::Trait { name: Some(self.name.clean(cx)), attrs: attrs, source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -1962,7 +1962,7 @@ impl Clean for doctree::TraitAlias { name: Some(self.name.clean(cx)), attrs, source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -2994,7 +2994,7 @@ impl Clean for doctree::Struct { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3014,7 +3014,7 @@ impl Clean for doctree::Union { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3061,7 +3061,7 @@ impl Clean for doctree::Enum { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3377,7 +3377,7 @@ impl Clean for doctree::Typedef { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id.clone()), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3401,7 +3401,7 @@ impl Clean for doctree::Existential { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id.clone()), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3452,7 +3452,7 @@ impl Clean for doctree::Static { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3477,7 +3477,7 @@ impl Clean for doctree::Constant { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3591,7 +3591,7 @@ impl Clean> for doctree::Impl { name: None, attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -4038,7 +4038,7 @@ impl Clean for doctree::ProcMacro { visibility: Some(Public), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), inner: ProcMacroItem(ProcMacro { kind: self.kind, helpers: self.helpers.clean(cx), diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index e8458385739d..9c54b40b422a 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -89,7 +89,7 @@ pub struct Struct { pub vis: hir::Visibility, pub stab: Option, pub depr: Option, - pub id: NodeId, + pub id: hir::HirId, pub struct_type: StructType, pub name: Name, pub generics: hir::Generics, @@ -102,7 +102,7 @@ pub struct Union { pub vis: hir::Visibility, pub stab: Option, pub depr: Option, - pub id: NodeId, + pub id: hir::HirId, pub struct_type: StructType, pub name: Name, pub generics: hir::Generics, @@ -118,7 +118,7 @@ pub struct Enum { pub variants: hir::HirVec, pub generics: hir::Generics, pub attrs: hir::HirVec, - pub id: NodeId, + pub id: hir::HirId, pub whence: Span, pub name: Name, } @@ -135,7 +135,7 @@ pub struct Variant { pub struct Function { pub decl: hir::FnDecl, pub attrs: hir::HirVec, - pub id: NodeId, + pub id: hir::HirId, pub name: Name, pub vis: hir::Visibility, pub stab: Option, @@ -150,7 +150,7 @@ pub struct Typedef { pub ty: P, pub gen: hir::Generics, pub name: Name, - pub id: ast::NodeId, + pub id: hir::HirId, pub attrs: hir::HirVec, pub whence: Span, pub vis: hir::Visibility, @@ -161,7 +161,7 @@ pub struct Typedef { pub struct Existential { pub exist_ty: hir::ExistTy, pub name: Name, - pub id: ast::NodeId, + pub id: hir::HirId, pub attrs: hir::HirVec, pub whence: Span, pub vis: hir::Visibility, @@ -179,7 +179,7 @@ pub struct Static { pub vis: hir::Visibility, pub stab: Option, pub depr: Option, - pub id: ast::NodeId, + pub id: hir::HirId, pub whence: Span, } @@ -191,7 +191,7 @@ pub struct Constant { pub vis: hir::Visibility, pub stab: Option, pub depr: Option, - pub id: ast::NodeId, + pub id: hir::HirId, pub whence: Span, } @@ -203,7 +203,7 @@ pub struct Trait { pub generics: hir::Generics, pub bounds: hir::HirVec, pub attrs: hir::HirVec, - pub id: ast::NodeId, + pub id: hir::HirId, pub whence: Span, pub vis: hir::Visibility, pub stab: Option, @@ -215,7 +215,7 @@ pub struct TraitAlias { pub generics: hir::Generics, pub bounds: hir::HirVec, pub attrs: hir::HirVec, - pub id: ast::NodeId, + pub id: hir::HirId, pub whence: Span, pub vis: hir::Visibility, pub stab: Option, @@ -236,7 +236,7 @@ pub struct Impl { pub vis: hir::Visibility, pub stab: Option, pub depr: Option, - pub id: ast::NodeId, + pub id: hir::HirId, } // For Macro we store the DefId instead of the NodeId, since we also create @@ -263,7 +263,7 @@ pub struct ExternCrate { pub struct Import { pub name: Name, - pub id: NodeId, + pub id: hir::HirId, pub vis: hir::Visibility, pub attrs: hir::HirVec, pub path: hir::Path, @@ -273,7 +273,7 @@ pub struct Import { pub struct ProcMacro { pub name: Name, - pub id: NodeId, + pub id: hir::HirId, pub kind: MacroKind, pub helpers: Vec, pub attrs: hir::HirVec, diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 12c7488d47e0..c1bd1d83a5b0 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -101,7 +101,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { debug!("Visiting struct"); let struct_type = struct_type_from_def(&*sd); Struct { - id: item.id, + id: item.hir_id, struct_type, name, vis: item.vis.clone(), @@ -120,7 +120,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { debug!("Visiting union"); let struct_type = struct_type_from_def(&*sd); Union { - id: item.id, + id: item.hir_id, struct_type, name, vis: item.vis.clone(), @@ -152,7 +152,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { depr: self.deprecation(it.hir_id), generics: params.clone(), attrs: it.attrs.clone(), - id: it.id, + id: it.hir_id, whence: it.span, } } @@ -202,7 +202,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { om.proc_macros.push(ProcMacro { name, - id: item.id, + id: item.hir_id, kind, helpers, attrs: item.attrs.clone(), @@ -213,7 +213,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { } None => { om.fns.push(Function { - id: item.id, + id: item.hir_id, vis: item.vis.clone(), stab: self.stability(item.hir_id), depr: self.deprecation(item.hir_id), @@ -262,7 +262,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { /// /// Returns `true` if the target has been inlined. fn maybe_inline_local(&mut self, - id: ast::NodeId, + id: hir::HirId, def: Def, renamed: Option, glob: bool, @@ -291,7 +291,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { return false; }; - let use_attrs = tcx.hir().attrs(id); + let use_attrs = tcx.hir().attrs_by_hir_id(id); // Don't inline `doc(hidden)` imports so they can be stripped at a later stage. let is_no_inline = use_attrs.lists("doc").has_word("no_inline") || use_attrs.lists("doc").has_word("hidden"); @@ -381,7 +381,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { let ident = renamed.unwrap_or(item.ident); if item.vis.node.is_pub() { - let def_id = self.cx.tcx.hir().local_def_id(item.id); + let def_id = self.cx.tcx.hir().local_def_id_from_hir_id(item.hir_id); self.store_path(def_id); } @@ -401,7 +401,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { _ if self.inlining && !item.vis.node.is_pub() => {} hir::ItemKind::GlobalAsm(..) => {} hir::ItemKind::ExternCrate(orig_name) => { - let def_id = self.cx.tcx.hir().local_def_id(item.id); + let def_id = self.cx.tcx.hir().local_def_id_from_hir_id(item.hir_id); om.extern_crates.push(ExternCrate { cnum: self.cx.tcx.extern_mod_stmt_cnum(def_id) .unwrap_or(LOCAL_CRATE), @@ -436,7 +436,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { } }); let ident = if is_glob { None } else { Some(ident) }; - if self.maybe_inline_local(item.id, + if self.maybe_inline_local(item.hir_id, path.def, ident, is_glob, @@ -448,7 +448,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { om.imports.push(Import { name: ident.name, - id: item.id, + id: item.hir_id, vis: item.vis.clone(), attrs: item.attrs.clone(), path: (**path).clone(), @@ -477,7 +477,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { ty: ty.clone(), gen: gen.clone(), name: ident.name, - id: item.id, + id: item.hir_id, attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), @@ -490,7 +490,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { let t = Existential { exist_ty: exist_ty.clone(), name: ident.name, - id: item.id, + id: item.hir_id, attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), @@ -504,7 +504,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { type_: ty.clone(), mutability: mut_.clone(), expr: exp.clone(), - id: item.id, + id: item.hir_id, name: ident.name, attrs: item.attrs.clone(), whence: item.span, @@ -518,7 +518,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { let s = Constant { type_: ty.clone(), expr: exp.clone(), - id: item.id, + id: item.hir_id, name: ident.name, attrs: item.attrs.clone(), whence: item.span, @@ -539,7 +539,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { items, generics: gen.clone(), bounds: b.iter().cloned().collect(), - id: item.id, + id: item.hir_id, attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), @@ -553,7 +553,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { name: ident.name, generics: gen.clone(), bounds: b.iter().cloned().collect(), - id: item.id, + id: item.hir_id, attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), @@ -585,7 +585,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { for_: ty.clone(), items, attrs: item.attrs.clone(), - id: item.id, + id: item.hir_id, whence: item.span, vis: item.vis.clone(), stab: self.stability(item.hir_id), From 50b8bc8c8cc84b653fa14fe2fe4c7284e70c413d Mon Sep 17 00:00:00 2001 From: ljedrz Date: Fri, 1 Mar 2019 09:31:58 +0100 Subject: [PATCH 169/381] hir: remove NodeId from Pat and FieldPat --- src/librustc/hir/lowering.rs | 55 +++++++++--------- src/librustc/hir/mod.rs | 4 +- src/librustc/ich/impls_hir.rs | 2 - src/librustc/middle/expr_use_visitor.rs | 6 +- src/librustc/middle/mem_categorization.rs | 18 +++--- src/librustc/middle/resolve_lifetime.rs | 2 +- src/librustc_borrowck/borrowck/check_loans.rs | 6 +- .../borrowck/gather_loans/gather_moves.rs | 10 ++-- .../borrowck/gather_loans/lifetime.rs | 3 +- .../borrowck/gather_loans/mod.rs | 7 +-- src/librustc_borrowck/borrowck/mod.rs | 57 +++++++++---------- src/librustc_driver/pretty.rs | 4 +- src/librustc_mir/hair/cx/mod.rs | 2 +- src/librustc_mir/hair/pattern/check_match.rs | 5 +- src/librustc_passes/rvalue_promotion.rs | 3 +- src/librustc_typeck/check/mod.rs | 3 +- src/librustc_typeck/check/upvar.rs | 2 +- 17 files changed, 87 insertions(+), 102 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 53c1e5979663..5a95681d667f 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -3740,12 +3740,11 @@ impl<'a> LoweringContext<'a> { let fs = fields .iter() .map(|f| { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); Spanned { span: f.span, node: hir::FieldPat { - id: node_id, hir_id, ident: f.node.ident, pat: self.lower_pat(&f.node.pat), @@ -3777,9 +3776,8 @@ impl<'a> LoweringContext<'a> { PatKind::Mac(_) => panic!("Shouldn't exist here"), }; - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(p.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(p.id); P(hir::Pat { - id: node_id, hir_id, node, span: p.span, @@ -4353,7 +4351,7 @@ impl<'a> LoweringContext<'a> { let iter = self.str_to_ident("iter"); let next_ident = self.str_to_ident("__next"); - let next_pat = self.pat_ident_binding_mode( + let (next_pat, next_pat_nid) = self.pat_ident_binding_mode( desugared_span, next_ident, hir::BindingAnnotation::Mutable, @@ -4362,9 +4360,9 @@ impl<'a> LoweringContext<'a> { // `::std::option::Option::Some(val) => next = val` let pat_arm = { let val_ident = self.str_to_ident("val"); - let val_pat = self.pat_ident(pat.span, val_ident); - let val_expr = P(self.expr_ident(pat.span, val_ident, val_pat.id)); - let next_expr = P(self.expr_ident(pat.span, next_ident, next_pat.id)); + let (val_pat, val_pat_nid) = self.pat_ident(pat.span, val_ident); + let val_expr = P(self.expr_ident(pat.span, val_ident, val_pat_nid)); + let next_expr = P(self.expr_ident(pat.span, next_ident, next_pat_nid)); let assign = P(self.expr( pat.span, hir::ExprKind::Assign(next_expr, val_expr), @@ -4383,7 +4381,7 @@ impl<'a> LoweringContext<'a> { }; // `mut iter` - let iter_pat = self.pat_ident_binding_mode( + let (iter_pat, iter_pat_nid) = self.pat_ident_binding_mode( desugared_span, iter, hir::BindingAnnotation::Mutable @@ -4391,7 +4389,7 @@ impl<'a> LoweringContext<'a> { // `match ::std::iter::Iterator::next(&mut iter) { ... }` let match_expr = { - let iter = P(self.expr_ident(head_sp, iter, iter_pat.id)); + let iter = P(self.expr_ident(head_sp, iter, iter_pat_nid)); let ref_mut_iter = self.expr_mut_addr_of(head_sp, iter); let next_path = &["iter", "Iterator", "next"]; let next_path = P(self.expr_std_path(head_sp, next_path, None, ThinVec::new())); @@ -4415,7 +4413,7 @@ impl<'a> LoweringContext<'a> { span: head_sp, }; - let next_expr = P(self.expr_ident(head_sp, next_ident, next_pat.id)); + let next_expr = P(self.expr_ident(head_sp, next_ident, next_pat_nid)); // `let mut __next` let next_let = self.stmt_let_pat( @@ -4542,11 +4540,11 @@ impl<'a> LoweringContext<'a> { // `Ok(val) => #[allow(unreachable_code)] val,` let ok_arm = { let val_ident = self.str_to_ident("val"); - let val_pat = self.pat_ident(e.span, val_ident); + let (val_pat, val_pat_nid) = self.pat_ident(e.span, val_ident); let val_expr = P(self.expr_ident_with_attrs( e.span, val_ident, - val_pat.id, + val_pat_nid, ThinVec::from(attrs.clone()), )); let ok_pat = self.pat_ok(e.span, val_pat); @@ -4558,12 +4556,12 @@ impl<'a> LoweringContext<'a> { // return Try::from_error(From::from(err)),` let err_arm = { let err_ident = self.str_to_ident("err"); - let err_local = self.pat_ident(e.span, err_ident); + let (err_local, err_local_nid) = self.pat_ident(e.span, err_ident); let from_expr = { let path = &["convert", "From", "from"]; let from = P(self.expr_std_path( e.span, path, None, ThinVec::new())); - let err_expr = self.expr_ident(e.span, err_ident, err_local.id); + let err_expr = self.expr_ident(e.span, err_ident, err_local_nid); self.expr_call(e.span, from, hir_vec![err_expr]) }; @@ -4911,15 +4909,15 @@ impl<'a> LoweringContext<'a> { ident: Ident, ex: P, ) -> (hir::Stmt, NodeId) { - let pat = if mutbl { + let (pat, pat_nid) = if mutbl { self.pat_ident_binding_mode(sp, ident, hir::BindingAnnotation::Mutable) } else { self.pat_ident(sp, ident) }; - let pat_id = pat.id; + ( self.stmt_let_pat(sp, Some(ex), pat, hir::LocalSource::Normal), - pat_id, + pat_nid, ) } @@ -4977,7 +4975,7 @@ impl<'a> LoweringContext<'a> { self.pat(span, pt) } - fn pat_ident(&mut self, span: Span, ident: Ident) -> P { + fn pat_ident(&mut self, span: Span, ident: Ident) -> (P, NodeId) { self.pat_ident_binding_mode(span, ident, hir::BindingAnnotation::Unannotated) } @@ -4986,15 +4984,17 @@ impl<'a> LoweringContext<'a> { span: Span, ident: Ident, bm: hir::BindingAnnotation, - ) -> P { + ) -> (P, NodeId) { let LoweredNodeId { node_id, hir_id } = self.next_id(); - P(hir::Pat { - id: node_id, - hir_id, - node: hir::PatKind::Binding(bm, node_id, hir_id, ident.with_span_pos(span), None), - span, - }) + ( + P(hir::Pat { + hir_id, + node: hir::PatKind::Binding(bm, node_id, hir_id, ident.with_span_pos(span), None), + span, + }), + node_id + ) } fn pat_wild(&mut self, span: Span) -> P { @@ -5002,9 +5002,8 @@ impl<'a> LoweringContext<'a> { } fn pat(&mut self, span: Span, pat: hir::PatKind) -> P { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); P(hir::Pat { - id: node_id, hir_id, node: pat, span, diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 8dfac646e8ea..d632810d006e 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -834,7 +834,6 @@ pub struct Block { #[derive(Clone, RustcEncodable, RustcDecodable)] pub struct Pat { - pub id: NodeId, pub hir_id: HirId, pub node: PatKind, pub span: Span, @@ -842,7 +841,7 @@ pub struct Pat { impl fmt::Debug for Pat { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "pat({}: {})", self.id, + write!(f, "pat({}: {})", self.hir_id, print::to_string(print::NO_ANN, |s| s.print_pat(self))) } } @@ -897,7 +896,6 @@ impl Pat { /// except `is_shorthand` is true. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct FieldPat { - pub id: NodeId, pub hir_id: HirId, /// The identifier for the field. pub ident: Ident, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 773fbda7961f..f46ef20aaf19 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -421,7 +421,6 @@ impl_stable_hash_for!(struct hir::Block { }); impl_stable_hash_for!(struct hir::Pat { - id -> _, hir_id -> _, node, span, @@ -430,7 +429,6 @@ impl_stable_hash_for!(struct hir::Pat { impl_stable_hash_for_spanned!(hir::FieldPat); impl_stable_hash_for!(struct hir::FieldPat { - id -> _, hir_id -> _, ident -> (ident.name), pat, diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 7fc01e302a7d..6e8b661b7b89 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -19,7 +19,6 @@ use crate::ty::{self, TyCtxt, adjustment}; use crate::hir::{self, PatKind}; use rustc_data_structures::sync::Lrc; use std::rc::Rc; -use syntax::ast; use syntax::ptr::P; use syntax_pos::Span; use crate::util::nodemap::ItemLocalSet; @@ -74,7 +73,7 @@ pub trait Delegate<'tcx> { // The local variable `id` is declared but not initialized. fn decl_without_init(&mut self, - id: ast::NodeId, + id: hir::HirId, span: Span); // The path at `cmt` is being assigned to. @@ -609,8 +608,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { match local.init { None => { local.pat.each_binding(|_, hir_id, span, _| { - let node_id = self.mc.tcx.hir().hir_to_node_id(hir_id); - self.delegate.decl_without_init(node_id, span); + self.delegate.decl_without_init(hir_id, span); }) } diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 822a42b374f3..a3e8598194e7 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -88,7 +88,7 @@ pub enum Categorization<'tcx> { ThreadLocal(ty::Region<'tcx>), // value that cannot move, but still restricted in scope StaticItem, Upvar(Upvar), // upvar referenced by closure env - Local(ast::NodeId), // local variable + Local(hir::HirId), // local variable Deref(cmt<'tcx>, PointerKind<'tcx>), // deref of a ptr Interior(cmt<'tcx>, InteriorKind), // something interior: field, tuple, etc Downcast(cmt<'tcx>, DefId), // selects a particular enum variant (*1) @@ -198,9 +198,9 @@ pub struct cmt_<'tcx> { pub type cmt<'tcx> = Rc>; pub enum ImmutabilityBlame<'tcx> { - ImmLocal(ast::NodeId), + ImmLocal(hir::HirId), ClosureEnv(LocalDefId), - LocalDeref(ast::NodeId), + LocalDeref(hir::HirId), AdtFieldDeref(&'tcx ty::AdtDef, &'tcx ty::FieldDef) } @@ -230,8 +230,8 @@ impl<'tcx> cmt_<'tcx> { Categorization::Deref(ref base_cmt, BorrowedPtr(ty::ImmBorrow, _)) => { // try to figure out where the immutable reference came from match base_cmt.cat { - Categorization::Local(node_id) => - Some(ImmutabilityBlame::LocalDeref(node_id)), + Categorization::Local(hir_id) => + Some(ImmutabilityBlame::LocalDeref(hir_id)), Categorization::Interior(ref base_cmt, InteriorField(field_index)) => { base_cmt.resolve_field(field_index.0).map(|(adt_def, field_def)| { ImmutabilityBlame::AdtFieldDeref(adt_def, field_def) @@ -247,8 +247,8 @@ impl<'tcx> cmt_<'tcx> { _ => None } } - Categorization::Local(node_id) => { - Some(ImmutabilityBlame::ImmLocal(node_id)) + Categorization::Local(hir_id) => { + Some(ImmutabilityBlame::ImmLocal(hir_id)) } Categorization::Rvalue(..) | Categorization::Upvar(..) | @@ -741,7 +741,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { Ok(cmt_ { hir_id, span, - cat: Categorization::Local(vid), + cat: Categorization::Local(self.tcx.hir().node_to_hir_id(vid)), mutbl: MutabilityCategory::from_local(self.tcx, self.tables, vid), ty: expr_ty, note: NoteNone @@ -1495,7 +1495,7 @@ impl<'tcx> cmt_<'tcx> { "non-place".into() } Categorization::Local(vid) => { - if tcx.hir().is_argument(vid) { + if tcx.hir().is_argument(tcx.hir().hir_to_node_id(vid)) { "argument" } else { "local variable" diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 7c2cf29eba1f..3375a6219fdf 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -2397,7 +2397,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { let help_name = if let Some(body) = parent { let arg = &self.tcx.hir().body(body).arguments[index]; - format!("`{}`", self.tcx.hir().node_to_pretty_string(arg.pat.id)) + format!("`{}`", self.tcx.hir().hir_to_pretty_string(arg.pat.hir_id)) } else { format!("argument {}", index + 1) }; diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index c74d7f00cf51..bd854e3aa3c8 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -17,7 +17,6 @@ use rustc::middle::mem_categorization as mc; use rustc::middle::mem_categorization::Categorization; use rustc::middle::region; use rustc::ty::{self, TyCtxt, RegionKind}; -use syntax::ast; use syntax_pos::Span; use rustc::hir; use rustc::hir::Node; @@ -177,7 +176,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> { self.check_assignment(assignment_id.local_id, assignment_span, assignee_cmt); } - fn decl_without_init(&mut self, _id: ast::NodeId, _span: Span) { } + fn decl_without_init(&mut self, _id: hir::HirId, _span: Span) { } } pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, @@ -887,11 +886,10 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> { // Check for reassignments to (immutable) local variables. This // needs to be done here instead of in check_loans because we // depend on move data. - if let Categorization::Local(local_id) = assignee_cmt.cat { + if let Categorization::Local(hir_id) = assignee_cmt.cat { let lp = opt_loan_path(assignee_cmt).unwrap(); self.move_data.each_assignment_of(assignment_id, &lp, |assign| { if assignee_cmt.mutbl.is_mutable() { - let hir_id = self.bccx.tcx.hir().node_to_hir_id(local_id); self.bccx.used_mut_nodes.borrow_mut().insert(hir_id); } else { self.bccx.report_reassigned_immutable_variable( diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index 6b050fd9ba23..310a9a2ef8da 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -11,7 +11,6 @@ use rustc::middle::mem_categorization::InteriorOffsetKind as Kind; use rustc::ty::{self, Ty}; use std::rc::Rc; -use syntax::ast; use syntax_pos::Span; use rustc::hir::*; use rustc::hir::Node; @@ -48,9 +47,9 @@ pub enum PatternSource<'tcx> { /// with a reference to the let fn get_pattern_source<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, pat: &Pat) -> PatternSource<'tcx> { - let parent = tcx.hir().get_parent_node(pat.id); + let parent = tcx.hir().get_parent_node_by_hir_id(pat.hir_id); - match tcx.hir().get(parent) { + match tcx.hir().get_by_hir_id(parent) { Node::Expr(ref e) => { // the enclosing expression must be a `match` or something else assert!(match e.node { @@ -67,11 +66,10 @@ fn get_pattern_source<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, pat: &Pat) -> Patte pub fn gather_decl<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, move_data: &MoveData<'tcx>, - var_id: ast::NodeId, + var_id: hir::HirId, var_ty: Ty<'tcx>) { let loan_path = Rc::new(LoanPath::new(LpVar(var_id), var_ty)); - let hir_id = bccx.tcx.hir().node_to_hir_id(var_id); - move_data.add_move(bccx.tcx, loan_path, hir_id.local_id, Declared); + move_data.add_move(bccx.tcx, loan_path, var_id.local_id, Declared); } pub fn gather_move_from_expr<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, diff --git a/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs b/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs index ae1d49afd493..0e08b62668ac 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs @@ -104,8 +104,7 @@ impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> { Categorization::Upvar(..) => { self.bccx.tcx.mk_region(ty::ReScope(self.item_scope)) } - Categorization::Local(local_id) => { - let hir_id = self.bccx.tcx.hir().node_to_hir_id(local_id); + Categorization::Local(hir_id) => { self.bccx.tcx.mk_region(ty::ReScope( self.bccx.region_scope_tree.var_scope(hir_id.local_id))) } diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index 03af27997d3c..bf730ba41f42 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -147,10 +147,10 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> { assignee_cmt); } - fn decl_without_init(&mut self, id: ast::NodeId, _span: Span) { + fn decl_without_init(&mut self, id: hir::HirId, _span: Span) { let ty = self.bccx .tables - .node_type(self.bccx.tcx.hir().node_to_hir_id(id)); + .node_type(id); gather_moves::gather_decl(self.bccx, &self.move_data, id, ty); } } @@ -438,9 +438,8 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> { while let Some(current_path) = wrapped_path { wrapped_path = match current_path.kind { - LpVar(local_id) => { + LpVar(hir_id) => { if !through_borrow { - let hir_id = self.bccx.tcx.hir().node_to_hir_id(local_id); self.bccx.used_mut_nodes.borrow_mut().insert(hir_id); } None diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 31189a71bba8..6d0efb163b8f 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -335,7 +335,7 @@ impl<'tcx> Hash for LoanPath<'tcx> { #[derive(PartialEq, Eq, Hash, Debug)] pub enum LoanPathKind<'tcx> { - LpVar(ast::NodeId), // `x` in README.md + LpVar(hir::HirId), // `x` in README.md LpUpvar(ty::UpvarId), // `x` captured by-value into closure LpDowncast(Rc>, DefId), // `x` downcast to particular enum variant LpExtend(Rc>, mc::MutabilityCategory, LoanPathElem<'tcx>) @@ -417,8 +417,7 @@ fn closure_to_block(closure_id: LocalDefId, impl<'a, 'tcx> LoanPath<'tcx> { pub fn kill_scope(&self, bccx: &BorrowckCtxt<'a, 'tcx>) -> region::Scope { match self.kind { - LpVar(local_id) => { - let hir_id = bccx.tcx.hir().node_to_hir_id(local_id); + LpVar(hir_id) => { bccx.region_scope_tree.var_scope(hir_id.local_id) } LpUpvar(upvar_id) => { @@ -919,7 +918,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { self.note_immutability_blame( &mut db, err.cmt.immutability_blame(), - self.tcx.hir().hir_to_node_id(err.cmt.hir_id) + err.cmt.hir_id ); db.emit(); self.signal_error(); @@ -1135,7 +1134,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { self.note_immutability_blame( &mut err, blame, - self.tcx.hir().hir_to_node_id(cmt.hir_id) + cmt.hir_id ); if is_closure { @@ -1175,8 +1174,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { } } - fn local_binding_mode(&self, node_id: ast::NodeId) -> ty::BindingMode { - let pat = match self.tcx.hir().get(node_id) { + fn local_binding_mode(&self, hir_id: hir::HirId) -> ty::BindingMode { + let pat = match self.tcx.hir().get_by_hir_id(hir_id) { Node::Binding(pat) => pat, node => bug!("bad node for local: {:?}", node) }; @@ -1192,16 +1191,16 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { } } - fn local_ty(&self, node_id: ast::NodeId) -> (Option<&hir::Ty>, bool) { - let parent = self.tcx.hir().get_parent_node(node_id); - let parent_node = self.tcx.hir().get(parent); + fn local_ty(&self, hir_id: hir::HirId) -> (Option<&hir::Ty>, bool) { + let parent = self.tcx.hir().get_parent_node_by_hir_id(hir_id); + let parent_node = self.tcx.hir().get_by_hir_id(parent); // The parent node is like a fn if let Some(fn_like) = FnLikeNode::from_node(parent_node) { // `nid`'s parent's `Body` let fn_body = self.tcx.hir().body(fn_like.body()); // Get the position of `node_id` in the arguments list - let arg_pos = fn_body.arguments.iter().position(|arg| arg.pat.id == node_id); + let arg_pos = fn_body.arguments.iter().position(|arg| arg.pat.hir_id == hir_id); if let Some(i) = arg_pos { // The argument's `Ty` (Some(&fn_like.decl().inputs[i]), @@ -1217,17 +1216,17 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { fn note_immutability_blame(&self, db: &mut DiagnosticBuilder<'_>, blame: Option>, - error_node_id: ast::NodeId) { + error_hir_id: hir::HirId) { match blame { None => {} Some(ImmutabilityBlame::ClosureEnv(_)) => {} - Some(ImmutabilityBlame::ImmLocal(node_id)) => { - self.note_immutable_local(db, error_node_id, node_id) + Some(ImmutabilityBlame::ImmLocal(hir_id)) => { + self.note_immutable_local(db, error_hir_id, hir_id) } - Some(ImmutabilityBlame::LocalDeref(node_id)) => { - match self.local_binding_mode(node_id) { + Some(ImmutabilityBlame::LocalDeref(hir_id)) => { + match self.local_binding_mode(hir_id) { ty::BindByReference(..) => { - let let_span = self.tcx.hir().span(node_id); + let let_span = self.tcx.hir().span_by_hir_id(hir_id); let suggestion = suggest_ref_mut(self.tcx, let_span); if let Some(replace_str) = suggestion { db.span_suggestion( @@ -1244,7 +1243,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { } } ty::BindByValue(..) => { - if let (Some(local_ty), is_implicit_self) = self.local_ty(node_id) { + if let (Some(local_ty), is_implicit_self) = self.local_ty(hir_id) { if let Some(msg) = self.suggest_mut_for_immutable(local_ty, is_implicit_self) { db.span_label(local_ty.span, msg); @@ -1273,12 +1272,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { // not a mutable reference) or to avoid borrowing altogether fn note_immutable_local(&self, db: &mut DiagnosticBuilder<'_>, - borrowed_node_id: ast::NodeId, - binding_node_id: ast::NodeId) { - let let_span = self.tcx.hir().span(binding_node_id); - if let ty::BindByValue(..) = self.local_binding_mode(binding_node_id) { + borrowed_hir_id: hir::HirId, + binding_hir_id: hir::HirId) { + let let_span = self.tcx.hir().span_by_hir_id(binding_hir_id); + if let ty::BindByValue(..) = self.local_binding_mode(binding_hir_id) { if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(let_span) { - let (ty, is_implicit_self) = self.local_ty(binding_node_id); + let (ty, is_implicit_self) = self.local_ty(binding_hir_id); if is_implicit_self && snippet != "self" { // avoid suggesting `mut &self`. return @@ -1291,9 +1290,9 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { }, )) = ty.map(|t| &t.node) { - let borrow_expr_id = self.tcx.hir().get_parent_node(borrowed_node_id); + let borrow_expr_id = self.tcx.hir().get_parent_node_by_hir_id(borrowed_hir_id); db.span_suggestion( - self.tcx.hir().span(borrow_expr_id), + self.tcx.hir().span_by_hir_id(borrow_expr_id), "consider removing the `&mut`, as it is an \ immutable binding to a mutable reference", snippet, @@ -1373,7 +1372,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { if let Categorization::Deref(..) = err.cmt.cat { db.span_label(*error_span, "cannot borrow as mutable"); } else if let Categorization::Local(local_id) = err.cmt.cat { - let span = self.tcx.hir().span(local_id); + let span = self.tcx.hir().span_by_hir_id(local_id); if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) { if snippet.starts_with("ref mut ") || snippet.starts_with("&mut ") { db.span_label(*error_span, "cannot reborrow mutably"); @@ -1401,7 +1400,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { out.push_str(&self.tcx.hir().name_by_hir_id(id).as_str()); } LpVar(id) => { - out.push_str(&self.tcx.hir().name(id).as_str()); + out.push_str(&self.tcx.hir().name_by_hir_id(id).as_str()); } LpDowncast(ref lp_base, variant_def_id) => { @@ -1512,7 +1511,7 @@ impl<'tcx> fmt::Debug for LoanPath<'tcx> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.kind { LpVar(id) => { - write!(f, "$({})", ty::tls::with(|tcx| tcx.hir().node_to_string(id))) + write!(f, "$({})", ty::tls::with(|tcx| tcx.hir().hir_to_string(id))) } LpUpvar(ty::UpvarId{ var_path: ty::UpvarPath {hir_id: var_id}, closure_expr_id }) => { @@ -1547,7 +1546,7 @@ impl<'tcx> fmt::Display for LoanPath<'tcx> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.kind { LpVar(id) => { - write!(f, "$({})", ty::tls::with(|tcx| tcx.hir().node_to_user_string(id))) + write!(f, "$({})", ty::tls::with(|tcx| tcx.hir().hir_to_user_string(id))) } LpUpvar(ty::UpvarId{ var_path: ty::UpvarPath { hir_id }, closure_expr_id: _ }) => { diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 3399562bc8d8..1750aa62dd5e 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -428,8 +428,8 @@ impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> { } pprust_hir::AnnNode::Pat(pat) => { s.s.space()?; - s.synth_comment(format!("pat node_id: {} hir local_id: {}", - pat.id, pat.hir_id.local_id.as_u32())) + s.synth_comment(format!("pat hir_id: {} hir local_id: {}", + pat.hir_id, pat.hir_id.local_id.as_u32())) } } } diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index 70f04fb89286..8b16eeeea23c 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -153,7 +153,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { pub fn pattern_from_hir(&mut self, p: &hir::Pat) -> Pattern<'tcx> { let tcx = self.tcx.global_tcx(); - let p = match tcx.hir().get(p.id) { + let p = match tcx.hir().get_by_hir_id(p.hir_id) { Node::Pat(p) | Node::Binding(p) => p, node => bug!("pattern became {:?}", node) }; diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 0f151cd688df..3d8c085567f1 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -24,7 +24,6 @@ use rustc::hir::{self, Pat, PatKind}; use smallvec::smallvec; use std::slice; -use syntax::ast; use syntax::ptr::P; use syntax_pos::{Span, DUMMY_SP, MultiSpan}; @@ -241,7 +240,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { } fn check_irrefutable(&self, pat: &'tcx Pat, origin: &str) { - let module = self.tcx.hir().get_module_parent(pat.id); + let module = self.tcx.hir().get_module_parent_by_hir_id(pat.hir_id); MatchCheckCtxt::create_and_enter(self.tcx, self.param_env, module, |ref mut cx| { let mut patcx = PatternContext::new(self.tcx, self.param_env.and(self.identity_substs), @@ -586,7 +585,7 @@ impl<'a, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'tcx> { ty::ImmBorrow | ty::UniqueImmBorrow => {} } } - fn decl_without_init(&mut self, _: ast::NodeId, _: Span) {} + fn decl_without_init(&mut self, _: hir::HirId, _: Span) {} fn mutate(&mut self, _: hir::HirId, span: Span, _: &cmt_<'_>, mode: MutateMode) { match mode { MutateMode::JustWrite | MutateMode::WriteAndRead => { diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 6b8e37b3b313..edd658254467 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -26,7 +26,6 @@ use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::util::nodemap::{ItemLocalSet, HirIdSet}; use rustc::hir; use rustc_data_structures::sync::Lrc; -use syntax::ast; use syntax_pos::{Span, DUMMY_SP}; use log::debug; use Promotability::*; @@ -677,7 +676,7 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for CheckCrateVisitor<'a, 'gcx> { } } - fn decl_without_init(&mut self, _id: ast::NodeId, _span: Span) {} + fn decl_without_init(&mut self, _id: hir::HirId, _span: Span) {} fn mutate(&mut self, _assignment_id: hir::HirId, _assignment_span: Span, diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 8c428e516bce..183667e22446 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1008,9 +1008,10 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for GatherLocalsVisitor<'a, 'gcx, 'tcx> { if let PatKind::Binding(_, _, _, ident, _) = p.node { let var_ty = self.assign(p.span, p.hir_id, None); + let node_id = self.fcx.tcx.hir().hir_to_node_id(p.hir_id); if !self.fcx.tcx.features().unsized_locals { self.fcx.require_type_is_sized(var_ty, p.span, - traits::VariableType(p.id)); + traits::VariableType(node_id)); } debug!("Pattern binding {} is assigned to {} with type {:?}", diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index bf6f4482e746..89e8b2b840d1 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -635,7 +635,7 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'gcx, 'tcx> { } } - fn decl_without_init(&mut self, _id: ast::NodeId, _span: Span) {} + fn decl_without_init(&mut self, _id: hir::HirId, _span: Span) {} fn mutate( &mut self, From fb22315f0878b432e1e79f9825a4b94651a5d475 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Fri, 1 Mar 2019 09:52:20 +0100 Subject: [PATCH 170/381] hir: remove NodeId from VariantData --- src/librustc/hir/lowering.rs | 10 ++++------ src/librustc/hir/map/mod.rs | 4 ++-- src/librustc/hir/mod.rs | 19 ++++++------------- src/librustc/ich/impls_hir.rs | 6 +++--- src/librustc_metadata/encoder.rs | 4 ++-- src/librustc_mir/build/mod.rs | 4 ++-- src/librustc_mir/shim.rs | 5 ++--- src/librustc_mir/transform/mod.rs | 4 ++-- src/librustc_typeck/collect.rs | 12 ++++++------ src/librustdoc/clean/mod.rs | 2 +- 10 files changed, 30 insertions(+), 40 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 5a95681d667f..27a7561e7658 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -2674,7 +2674,7 @@ impl<'a> LoweringContext<'a> { fn lower_variant_data(&mut self, vdata: &VariantData) -> hir::VariantData { match *vdata { VariantData::Struct(ref fields, id) => { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(id); hir::VariantData::Struct( fields @@ -2682,12 +2682,11 @@ impl<'a> LoweringContext<'a> { .enumerate() .map(|f| self.lower_struct_field(f)) .collect(), - node_id, hir_id, ) }, VariantData::Tuple(ref fields, id) => { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(id); hir::VariantData::Tuple( fields @@ -2695,14 +2694,13 @@ impl<'a> LoweringContext<'a> { .enumerate() .map(|f| self.lower_struct_field(f)) .collect(), - node_id, hir_id, ) }, VariantData::Unit(id) => { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(id); - hir::VariantData::Unit(node_id, hir_id) + hir::VariantData::Unit(hir_id) }, } } diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index f8d1c949bdc7..bec04b2e4050 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -366,11 +366,11 @@ impl<'hir> Map<'hir> { } } Node::Variant(variant) => { - let def_id = self.local_def_id(variant.node.data.id()); + let def_id = self.local_def_id_from_hir_id(variant.node.data.hir_id()); Some(Def::Variant(def_id)) } Node::StructCtor(variant) => { - let def_id = self.local_def_id(variant.id()); + let def_id = self.local_def_id_from_hir_id(variant.hir_id()); Some(Def::StructCtor(def_id, def::CtorKind::from_hir(variant))) } Node::AnonConst(_) | diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index d632810d006e..b0f362ca30ae 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -2156,9 +2156,9 @@ impl StructField { /// Id of the whole struct lives in `Item`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum VariantData { - Struct(HirVec, NodeId, HirId), - Tuple(HirVec, NodeId, HirId), - Unit(NodeId, HirId), + Struct(HirVec, HirId), + Tuple(HirVec, HirId), + Unit(HirId), } impl VariantData { @@ -2168,18 +2168,11 @@ impl VariantData { _ => &[], } } - pub fn id(&self) -> NodeId { - match *self { - VariantData::Struct(_, id, ..) - | VariantData::Tuple(_, id, ..) - | VariantData::Unit(id, ..) => id, - } - } pub fn hir_id(&self) -> HirId { match *self { - VariantData::Struct(_, _, hir_id) - | VariantData::Tuple(_, _, hir_id) - | VariantData::Unit(_, hir_id) => hir_id, + VariantData::Struct(_, hir_id) + | VariantData::Tuple(_, hir_id) + | VariantData::Unit(hir_id) => hir_id, } } pub fn is_struct(&self) -> bool { diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index f46ef20aaf19..6a52b633c4f1 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -842,9 +842,9 @@ impl_stable_hash_for!(struct hir::StructField { }); impl_stable_hash_for!(enum hir::VariantData { - Struct(fields, id, hir_id), - Tuple(fields, id, hir_id), - Unit(id, hir_id) + Struct(fields, hir_id), + Tuple(fields, hir_id), + Unit(hir_id) }); impl<'a> HashStable> for hir::Item { diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 541c7a781992..f79cfa3b773e 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1069,7 +1069,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { // for methods, write all the stuff get_trait_method // needs to know let struct_ctor = if !struct_def.is_struct() { - Some(tcx.hir().local_def_id(struct_def.id()).index) + Some(tcx.hir().local_def_id_from_hir_id(struct_def.hir_id()).index) } else { None }; @@ -1772,7 +1772,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { // If the struct has a constructor, encode it. if !struct_def.is_struct() { - let ctor_def_id = self.tcx.hir().local_def_id(struct_def.id()); + let ctor_def_id = self.tcx.hir().local_def_id_from_hir_id(struct_def.hir_id()); self.record(ctor_def_id, IsolatedEncoder::encode_struct_ctor, (def_id, ctor_def_id)); diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index e4f85887841e..61ead366a87c 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -229,7 +229,7 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, -> Mir<'tcx> { let span = tcx.hir().span(ctor_id); - if let hir::VariantData::Tuple(ref fields, ctor_id, _) = *v { + if let hir::VariantData::Tuple(ref fields, ctor_id) = *v { tcx.infer_ctxt().enter(|infcx| { let mut mir = shim::build_adt_ctor(&infcx, ctor_id, fields, span); @@ -245,7 +245,7 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }; mir_util::dump_mir(tcx, None, "mir_map", &0, - MirSource::item(tcx.hir().local_def_id(ctor_id)), + MirSource::item(tcx.hir().local_def_id_from_hir_id(ctor_id)), &mir, |_, _| Ok(()) ); mir diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index adc328f1033e..db8476f3be5f 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -10,7 +10,6 @@ use rustc::ty::query::Providers; use rustc_data_structures::indexed_vec::{IndexVec, Idx}; use rustc_target::spec::abi::Abi; -use syntax::ast; use syntax_pos::Span; use std::fmt; @@ -855,14 +854,14 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>, - ctor_id: ast::NodeId, + ctor_id: hir::HirId, fields: &[hir::StructField], span: Span) -> Mir<'tcx> { let tcx = infcx.tcx; let gcx = tcx.global_tcx(); - let def_id = tcx.hir().local_def_id(ctor_id); + let def_id = tcx.hir().local_def_id_from_hir_id(ctor_id); let param_env = gcx.param_env(def_id); // Normalize the sig. diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index c1bb31a49a4b..8f5fc6963771 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -80,8 +80,8 @@ fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: CrateNum) _: &'tcx hir::Generics, _: hir::HirId, _: Span) { - if let hir::VariantData::Tuple(_, node_id, _) = *v { - self.set.insert(self.tcx.hir().local_def_id(node_id)); + if let hir::VariantData::Tuple(_, hir_id) = *v { + self.set.insert(self.tcx.hir().local_def_id_from_hir_id(hir_id)); } intravisit::walk_struct_def(self, v) } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 95c0ad95bc1a..594e29ab9dde 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -454,7 +454,7 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: hir::HirId) { } if !struct_def.is_struct() { - convert_variant_ctor(tcx, struct_def.id()); + convert_variant_ctor(tcx, struct_def.hir_id()); } } @@ -510,8 +510,8 @@ fn convert_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_item_id: hir::H } } -fn convert_variant_ctor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ctor_id: ast::NodeId) { - let def_id = tcx.hir().local_def_id(ctor_id); +fn convert_variant_ctor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ctor_id: hir::HirId) { + let def_id = tcx.hir().local_def_id_from_hir_id(ctor_id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); @@ -563,7 +563,7 @@ fn convert_enum_variant_types<'a, 'tcx>( // Convert the ctor, if any. This also registers the variant as // an item. - convert_variant_ctor(tcx, variant.node.data.id()); + convert_variant_ctor(tcx, variant.node.data.hir_id()); } } @@ -634,7 +634,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad def.variants .iter() .map(|v| { - let did = tcx.hir().local_def_id(v.node.data.id()); + let did = tcx.hir().local_def_id_from_hir_id(v.node.data.hir_id()); let discr = if let Some(ref e) = v.node.disr_expr { distance_from_explicit = 0; ty::VariantDiscr::Explicit(tcx.hir().local_def_id_from_hir_id(e.hir_id)) @@ -652,7 +652,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad ItemKind::Struct(ref def, _) => { // Use separate constructor id for unit/tuple structs and reuse did for braced structs. let ctor_id = if !def.is_struct() { - Some(tcx.hir().local_def_id(def.id())) + Some(tcx.hir().local_def_id_from_hir_id(def.hir_id())) } else { None }; diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 7511ad5dd29d..c64a73fa308e 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -3088,7 +3088,7 @@ impl Clean for doctree::Variant { visibility: None, stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.def.id()), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.def.hir_id()), inner: VariantItem(Variant { kind: self.def.clean(cx), }), From fa61c67fe63df1d69979f116a29bb72ade0c6308 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Fri, 1 Mar 2019 10:28:13 +0100 Subject: [PATCH 171/381] hir: HirIdify Impl&TraitItemId --- src/librustc/hir/lowering.rs | 8 +++--- src/librustc/hir/map/mod.rs | 8 +++--- src/librustc/hir/mod.rs | 4 +-- src/librustc/ich/impls_hir.rs | 8 +++--- src/librustc/middle/dead.rs | 2 +- src/librustc/middle/reachable.rs | 6 +---- src/librustc/middle/resolve_lifetime.rs | 17 ++++++------- src/librustc/ty/mod.rs | 28 +++++++++------------ src/librustc_lint/builtin.rs | 7 ++---- src/librustc_privacy/lib.rs | 26 ++++++++----------- src/librustc_typeck/check/compare_method.rs | 12 ++++----- src/librustc_typeck/impl_wf_check.rs | 2 +- 12 files changed, 55 insertions(+), 73 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 27a7561e7658..52ad800e81c6 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -469,8 +469,8 @@ impl<'a> LoweringContext<'a> { fn visit_trait_item(&mut self, item: &'lcx TraitItem) { self.lctx.with_hir_id_owner(item.id, |lctx| { - let id = hir::TraitItemId { node_id: item.id }; let hir_item = lctx.lower_trait_item(item); + let id = hir::TraitItemId { hir_id: hir_item.hir_id }; lctx.trait_items.insert(id, hir_item); lctx.modules.get_mut(&lctx.current_module).unwrap().trait_items.insert(id); }); @@ -480,8 +480,8 @@ impl<'a> LoweringContext<'a> { fn visit_impl_item(&mut self, item: &'lcx ImplItem) { self.lctx.with_hir_id_owner(item.id, |lctx| { - let id = hir::ImplItemId { node_id: item.id }; let hir_item = lctx.lower_impl_item(item); + let id = hir::ImplItemId { hir_id: hir_item.hir_id }; lctx.impl_items.insert(id, hir_item); lctx.modules.get_mut(&lctx.current_module).unwrap().impl_items.insert(id); }); @@ -3363,7 +3363,7 @@ impl<'a> LoweringContext<'a> { TraitItemKind::Macro(..) => unimplemented!(), }; hir::TraitItemRef { - id: hir::TraitItemId { node_id: i.id }, + id: hir::TraitItemId { hir_id: self.lower_node_id(i.id).hir_id }, ident: i.ident, span: i.span, defaultness: self.lower_defaultness(Defaultness::Default, has_default), @@ -3427,7 +3427,7 @@ impl<'a> LoweringContext<'a> { fn lower_impl_item_ref(&mut self, i: &ImplItem) -> hir::ImplItemRef { hir::ImplItemRef { - id: hir::ImplItemId { node_id: i.id }, + id: hir::ImplItemId { hir_id: self.lower_node_id(i.id).hir_id }, ident: i.ident, span: i.span, vis: self.lower_visibility(&i.vis, Some(i.id)), diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index bec04b2e4050..21a9ed5ebe03 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -427,7 +427,7 @@ impl<'hir> Map<'hir> { } pub fn trait_item(&self, id: TraitItemId) -> &'hir TraitItem { - self.read(id.node_id); + self.read_by_hir_id(id.hir_id); // N.B., intentionally bypass `self.forest.krate()` so that we // do not trigger a read of the whole krate here @@ -435,7 +435,7 @@ impl<'hir> Map<'hir> { } pub fn impl_item(&self, id: ImplItemId) -> &'hir ImplItem { - self.read(id.node_id); + self.read_by_hir_id(id.hir_id); // N.B., intentionally bypass `self.forest.krate()` so that we // do not trigger a read of the whole krate here @@ -618,11 +618,11 @@ impl<'hir> Map<'hir> { } for id in &module.trait_items { - visitor.visit_trait_item(self.expect_trait_item(id.node_id)); + visitor.visit_trait_item(self.expect_trait_item_by_hir_id(id.hir_id)); } for id in &module.impl_items { - visitor.visit_impl_item(self.expect_impl_item(id.node_id)); + visitor.visit_impl_item(self.expect_impl_item_by_hir_id(id.hir_id)); } } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index b0f362ca30ae..2d0296aa38c7 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1657,7 +1657,7 @@ pub struct MethodSig { // so it can fetched later. #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Debug)] pub struct TraitItemId { - pub node_id: NodeId, + pub hir_id: HirId, } /// Represents an item declaration within a trait declaration, @@ -1702,7 +1702,7 @@ pub enum TraitItemKind { // so it can fetched later. #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Debug)] pub struct ImplItemId { - pub node_id: NodeId, + pub hir_id: HirId, } /// Represents anything within an `impl` block diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 6a52b633c4f1..0803816fb03f 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -116,11 +116,11 @@ impl<'a> HashStable> for hir::TraitItemId { hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { let hir::TraitItemId { - node_id + hir_id } = * self; hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { - node_id.hash_stable(hcx, hasher); + hir_id.hash_stable(hcx, hasher); }) } } @@ -130,11 +130,11 @@ impl<'a> HashStable> for hir::ImplItemId { hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { let hir::ImplItemId { - node_id + hir_id } = * self; hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { - node_id.hash_stable(hcx, hasher); + hir_id.hash_stable(hcx, hasher); }) } } diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 5fe22f4c5977..8ffd119f95c0 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -376,7 +376,7 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> { has_allow_dead_code_or_lang_attr(self.tcx, impl_item.hir_id, &impl_item.attrs) { - self.worklist.push(self.tcx.hir().node_to_hir_id(impl_item_ref.id.node_id)); + self.worklist.push(impl_item_ref.id.hir_id); } } } diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 962a08c7bef8..086b3a318e6b 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -355,11 +355,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, if let hir::ItemKind::Impl(.., Some(ref trait_ref), _, ref impl_item_refs) = item.node { let node_id = self.tcx.hir().hir_to_node_id(item.hir_id); if !self.access_levels.is_reachable(node_id) { - // FIXME(@ljedrz): rework back to a nice extend when item Ids contain HirId - for impl_item_ref in impl_item_refs { - let hir_id = self.tcx.hir().node_to_hir_id(impl_item_ref.id.node_id); - self.worklist.push(hir_id); - } + self.worklist.extend(impl_item_refs.iter().map(|ii_ref| ii_ref.id.hir_id)); let trait_def_id = match trait_ref.path.def { Def::Trait(def_id) => def_id, diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 3375a6219fdf..2618d0874cbc 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -671,13 +671,14 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { // In the future, this should be fixed and this error should be removed. let def = self.map.defs.get(&lifetime.hir_id).cloned(); if let Some(Region::LateBound(_, def_id, _)) = def { - if let Some(node_id) = self.tcx.hir().as_local_node_id(def_id) { + if let Some(hir_id) = self.tcx.hir().as_local_hir_id(def_id) { // Ensure that the parent of the def is an item, not HRTB - let parent_id = self.tcx.hir().get_parent_node(node_id); - let parent_impl_id = hir::ImplItemId { node_id: parent_id }; - let parent_trait_id = hir::TraitItemId { node_id: parent_id }; + let parent_id = self.tcx.hir().get_parent_node_by_hir_id(hir_id); + let parent_impl_id = hir::ImplItemId { hir_id: parent_id }; + let parent_trait_id = hir::TraitItemId { hir_id: parent_id }; let krate = self.tcx.hir().forest.krate(); - if !(krate.items.contains_key(&parent_id) + let parent_node_id = self.tcx.hir().hir_to_node_id(parent_id); + if !(krate.items.contains_key(&parent_node_id) || krate.impl_items.contains_key(&parent_impl_id) || krate.trait_items.contains_key(&parent_trait_id)) { @@ -2072,10 +2073,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { .expect_item_by_hir_id(self.tcx.hir().get_parent_item(parent)) .node { - let parent_node_id = self.tcx.hir().hir_to_node_id(parent); assoc_item_kind = trait_items .iter() - .find(|ti| ti.id.node_id == parent_node_id) + .find(|ti| ti.id.hir_id == parent) .map(|ti| ti.kind); } match *m { @@ -2094,10 +2094,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { .node { impl_self = Some(self_ty); - let parent_node_id = self.tcx.hir().hir_to_node_id(parent); assoc_item_kind = impl_items .iter() - .find(|ii| ii.id.node_id == parent_node_id) + .find(|ii| ii.id.hir_id == parent) .map(|ii| ii.kind); } Some(body) diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 3b89f853c3e8..1f897d29a1eb 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -2727,7 +2727,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { parent_vis: &hir::Visibility, trait_item_ref: &hir::TraitItemRef) -> AssociatedItem { - let def_id = self.hir().local_def_id(trait_item_ref.id.node_id); + let def_id = self.hir().local_def_id_from_hir_id(trait_item_ref.id.hir_id); let (kind, has_self) = match trait_item_ref.kind { hir::AssociatedItemKind::Const => (ty::AssociatedKind::Const, false), hir::AssociatedItemKind::Method { has_self } => { @@ -2737,13 +2737,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { hir::AssociatedItemKind::Existential => bug!("only impls can have existentials"), }; - let hir_id = self.hir().node_to_hir_id(trait_item_ref.id.node_id); - AssociatedItem { ident: trait_item_ref.ident, kind, // Visibility of trait items is inherited from their traits. - vis: Visibility::from_hir(parent_vis, hir_id, self), + vis: Visibility::from_hir(parent_vis, trait_item_ref.id.hir_id, self), defaultness: trait_item_ref.defaultness, def_id, container: TraitContainer(parent_def_id), @@ -2755,7 +2753,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { parent_def_id: DefId, impl_item_ref: &hir::ImplItemRef) -> AssociatedItem { - let def_id = self.hir().local_def_id(impl_item_ref.id.node_id); + let def_id = self.hir().local_def_id_from_hir_id(impl_item_ref.id.hir_id); let (kind, has_self) = match impl_item_ref.kind { hir::AssociatedItemKind::Const => (ty::AssociatedKind::Const, false), hir::AssociatedItemKind::Method { has_self } => { @@ -2765,13 +2763,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { hir::AssociatedItemKind::Existential => (ty::AssociatedKind::Existential, false), }; - let hir_id = self.hir().node_to_hir_id(impl_item_ref.id.node_id); - AssociatedItem { ident: impl_item_ref.ident, kind, // Visibility of trait impl items doesn't matter. - vis: ty::Visibility::from_hir(&impl_item_ref.vis, hir_id, self), + vis: ty::Visibility::from_hir(&impl_item_ref.vis, impl_item_ref.id.hir_id, self), defaultness: impl_item_ref.defaultness, def_id, container: ImplContainer(parent_def_id), @@ -3041,13 +3037,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> AssociatedItem { - let id = tcx.hir().as_local_node_id(def_id).unwrap(); - let parent_id = tcx.hir().get_parent(id); - let parent_def_id = tcx.hir().local_def_id(parent_id); - let parent_item = tcx.hir().expect_item(parent_id); + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let parent_id = tcx.hir().get_parent_item(id); + let parent_def_id = tcx.hir().local_def_id_from_hir_id(parent_id); + let parent_item = tcx.hir().expect_item_by_hir_id(parent_id); match parent_item.node { hir::ItemKind::Impl(.., ref impl_item_refs) => { - if let Some(impl_item_ref) = impl_item_refs.iter().find(|i| i.id.node_id == id) { + if let Some(impl_item_ref) = impl_item_refs.iter().find(|i| i.id.hir_id == id) { let assoc_item = tcx.associated_item_from_impl_item_ref(parent_def_id, impl_item_ref); debug_assert_eq!(assoc_item.def_id, def_id); @@ -3056,7 +3052,7 @@ fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Asso } hir::ItemKind::Trait(.., ref trait_item_refs) => { - if let Some(trait_item_ref) = trait_item_refs.iter().find(|i| i.id.node_id == id) { + if let Some(trait_item_ref) = trait_item_refs.iter().find(|i| i.id.hir_id == id) { let assoc_item = tcx.associated_item_from_trait_item_ref(parent_def_id, &parent_item.vis, trait_item_ref); @@ -3110,13 +3106,13 @@ fn associated_item_def_ids<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir::ItemKind::Trait(.., ref trait_item_refs) => { trait_item_refs.iter() .map(|trait_item_ref| trait_item_ref.id) - .map(|id| tcx.hir().local_def_id(id.node_id)) + .map(|id| tcx.hir().local_def_id_from_hir_id(id.hir_id)) .collect() } hir::ItemKind::Impl(.., ref impl_item_refs) => { impl_item_refs.iter() .map(|impl_item_ref| impl_item_ref.id) - .map(|id| tcx.hir().local_def_id(id.node_id)) + .map(|id| tcx.hir().local_def_id_from_hir_id(id.hir_id)) .collect() } hir::ItemKind::TraitAlias(..) => vec![], diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index f5737c8fe51c..641adec82cdd 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -447,8 +447,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { if let hir::VisibilityKind::Inherited = it.vis.node { self.private_traits.insert(it.hir_id); for trait_item_ref in trait_item_refs { - let hir_id = cx.tcx.hir().node_to_hir_id(trait_item_ref.id.node_id); - self.private_traits.insert(hir_id); + self.private_traits.insert(trait_item_ref.id.hir_id); } return; } @@ -464,9 +463,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { Some(Node::Item(item)) => { if let hir::VisibilityKind::Inherited = item.vis.node { for impl_item_ref in impl_item_refs { - let hir_id = cx.tcx.hir().node_to_hir_id( - impl_item_ref.id.node_id); - self.private_traits.insert(hir_id); + self.private_traits.insert(impl_item_ref.id.hir_id); } } } diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 240e55abde82..550b333700b0 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -515,15 +515,13 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => { for impl_item_ref in impl_item_refs { if trait_ref.is_some() || impl_item_ref.vis.node.is_pub() { - let hir_id = self.tcx.hir().node_to_hir_id(impl_item_ref.id.node_id); - self.update(hir_id, item_level); + self.update(impl_item_ref.id.hir_id, item_level); } } } hir::ItemKind::Trait(.., ref trait_item_refs) => { for trait_item_ref in trait_item_refs { - let hir_id = self.tcx.hir().node_to_hir_id(trait_item_ref.id.node_id); - self.update(hir_id, item_level); + self.update(trait_item_ref.id.hir_id, item_level); } } hir::ItemKind::Struct(ref def, _) | hir::ItemKind::Union(ref def, _) => { @@ -590,8 +588,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { self.reach(item.hir_id, item_level).generics().predicates(); for trait_item_ref in trait_item_refs { - let hir_id = self.tcx.hir().node_to_hir_id(trait_item_ref.id.node_id); - let mut reach = self.reach(hir_id, item_level); + let mut reach = self.reach(trait_item_ref.id.hir_id, item_level); reach.generics().predicates(); if trait_item_ref.kind == AssociatedItemKind::Type && @@ -614,10 +611,9 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { self.reach(item.hir_id, item_level).generics().predicates().ty().trait_ref(); for impl_item_ref in impl_item_refs { - let hir_id = self.tcx.hir().node_to_hir_id(impl_item_ref.id.node_id); - let impl_item_level = self.get(hir_id); + let impl_item_level = self.get(impl_item_ref.id.hir_id); if impl_item_level.is_some() { - self.reach(hir_id, impl_item_level) + self.reach(impl_item_ref.id.hir_id, impl_item_level) .generics().predicates().ty(); } } @@ -1326,7 +1322,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { hir::ImplItemKind::Const(..) | hir::ImplItemKind::Method(..) => { self.access_levels.is_reachable( - impl_item_ref.id.node_id) + self.tcx.hir().hir_to_node_id( + impl_item_ref.id.hir_id)) } hir::ImplItemKind::Existential(..) | hir::ImplItemKind::Type(_) => false, @@ -1392,8 +1389,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { // methods will be visible as `Public::foo`. let mut found_pub_static = false; for impl_item_ref in impl_item_refs { - let hir_id = self.tcx.hir().node_to_hir_id(impl_item_ref.id.node_id); - if self.item_is_public(&hir_id, &impl_item_ref.vis) { + if self.item_is_public(&impl_item_ref.id.hir_id, &impl_item_ref.vis) { let impl_item = self.tcx.hir().impl_item(impl_item_ref.id); match impl_item_ref.kind { AssociatedItemKind::Const => { @@ -1704,8 +1700,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> self.check(item.hir_id, item_visibility).generics().predicates(); for trait_item_ref in trait_item_refs { - let hir_id = tcx.hir().node_to_hir_id(trait_item_ref.id.node_id); - self.check_trait_or_impl_item(hir_id, trait_item_ref.kind, + self.check_trait_or_impl_item(trait_item_ref.id.hir_id, trait_item_ref.kind, trait_item_ref.defaultness, item_visibility); } } @@ -1754,8 +1749,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> } else { impl_vis }; - let hir_id = tcx.hir().node_to_hir_id(impl_item_ref.id.node_id); - self.check_trait_or_impl_item(hir_id, impl_item_ref.kind, + self.check_trait_or_impl_item(impl_item_ref.id.hir_id, impl_item_ref.kind, impl_item_ref.defaultness, impl_item_vis); } } diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index e061a5304eb2..59766e7e47d6 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -760,11 +760,11 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, .source_map() .span_to_snippet(trait_span) .ok()?; - let trait_m = tcx.hir().as_local_node_id(trait_m.def_id)?; - let trait_m = tcx.hir().trait_item(hir::TraitItemId { node_id: trait_m }); + let trait_m = tcx.hir().as_local_hir_id(trait_m.def_id)?; + let trait_m = tcx.hir().trait_item(hir::TraitItemId { hir_id: trait_m }); - let impl_m = tcx.hir().as_local_node_id(impl_m.def_id)?; - let impl_m = tcx.hir().impl_item(hir::ImplItemId { node_id: impl_m }); + let impl_m = tcx.hir().as_local_hir_id(impl_m.def_id)?; + let impl_m = tcx.hir().impl_item(hir::ImplItemId { hir_id: impl_m }); // in case there are no generics, take the spot between the function name // and the opening paren of the argument list @@ -805,8 +805,8 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, (None, Some(hir::SyntheticTyParamKind::ImplTrait)) => { err.span_label(impl_span, "expected `impl Trait`, found generic parameter"); (|| { - let impl_m = tcx.hir().as_local_node_id(impl_m.def_id)?; - let impl_m = tcx.hir().impl_item(hir::ImplItemId { node_id: impl_m }); + let impl_m = tcx.hir().as_local_hir_id(impl_m.def_id)?; + let impl_m = tcx.hir().impl_item(hir::ImplItemId { hir_id: impl_m }); let input_tys = match impl_m.node { hir::ImplItemKind::Method(ref sig, _) => &sig.decl.inputs, _ => unreachable!(), diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index fb61dfad472a..b79277ffbbce 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -108,7 +108,7 @@ fn enforce_impl_params_are_constrained<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Disallow unconstrained lifetimes, but only if they appear in assoc types. let lifetimes_in_associated_types: FxHashSet<_> = impl_item_refs.iter() - .map(|item_ref| tcx.hir().local_def_id(item_ref.id.node_id)) + .map(|item_ref| tcx.hir().local_def_id_from_hir_id(item_ref.id.hir_id)) .filter(|&def_id| { let item = tcx.associated_item(def_id); item.kind == ty::AssociatedKind::Type && item.defaultness.has_value() From 299ed9af947db19a35e540bbb4ac5dac5a72e0ae Mon Sep 17 00:00:00 2001 From: ljedrz Date: Fri, 1 Mar 2019 15:13:30 +0100 Subject: [PATCH 172/381] driver: fix test --- src/librustc_driver/test.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index 309a9f7b5252..65f8ce75bd11 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -249,7 +249,7 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> { } #[allow(dead_code)] // this seems like it could be useful, even if we don't use it now - pub fn lookup_item(&self, names: &[String]) -> ast::NodeId { + pub fn lookup_item(&self, names: &[String]) -> hir::HirId { return match search_mod(self, &self.infcx.tcx.hir().krate().module, 0, names) { Some(id) => id, None => { @@ -262,7 +262,7 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> { m: &hir::Mod, idx: usize, names: &[String], - ) -> Option { + ) -> Option { assert!(idx < names.len()); for item in &m.item_ids { let item = this.infcx.tcx.hir().expect_item(item.id); @@ -273,9 +273,9 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> { return None; } - fn search(this: &Env, it: &hir::Item, idx: usize, names: &[String]) -> Option { + fn search(this: &Env, it: &hir::Item, idx: usize, names: &[String]) -> Option { if idx == names.len() { - return Some(it.id); + return Some(it.hir_id); } return match it.node { From 04d0a8cb83e713f71848c4afeba72d7e776acc6a Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Sat, 2 Mar 2019 03:14:29 +0000 Subject: [PATCH 173/381] Fix C-variadic function printing There is no longer a need to append the string `", ..."` to a functions args as `...` is parsed as an argument and will appear in the functions arguments. --- src/libsyntax/print/pprust.rs | 3 --- src/test/pretty/fn-variadic.rs | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/test/pretty/fn-variadic.rs diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 942bd9693917..49e3fad4af0f 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2814,9 +2814,6 @@ impl<'a> State<'a> { -> io::Result<()> { self.popen()?; self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, false))?; - if decl.c_variadic { - self.s.word(", ...")?; - } self.pclose()?; self.print_fn_output(decl) diff --git a/src/test/pretty/fn-variadic.rs b/src/test/pretty/fn-variadic.rs new file mode 100644 index 000000000000..d3b193a3e181 --- /dev/null +++ b/src/test/pretty/fn-variadic.rs @@ -0,0 +1,15 @@ +// Check that `fn foo(x: i32, ...)` does not print as `fn foo(x: i32, ..., ...)`. +// See issue #58853. +// +// pp-exact +#![feature(c_variadic)] + +extern "C" { + pub fn foo(x: i32, ...); +} + +pub unsafe extern "C" fn bar(_: i32, mut ap: ...) -> usize { + ap.arg::() +} + +fn main() { } From 2870015b7b7a52a23db0b68fde8b830706061fd0 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Wed, 27 Feb 2019 16:58:12 -0700 Subject: [PATCH 174/381] Bootstrap compiler update for 1.35 release --- src/bootstrap/channel.rs | 2 +- src/liballoc/macros.rs | 3 +- src/libcore/intrinsics.rs | 2 - src/libcore/macros.rs | 6 +- src/libcore/marker.rs | 2 +- src/libcore/num/mod.rs | 102 ------------------------- src/libcore/pin.rs | 2 +- src/libcore/sync/atomic.rs | 16 +--- src/librustc_data_structures/macros.rs | 3 +- src/libstd/macros.rs | 18 ++--- src/libstd/thread/local.rs | 8 +- src/stage0.txt | 2 +- 12 files changed, 20 insertions(+), 146 deletions(-) diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs index 0b2f62485c9e..aa683161b654 100644 --- a/src/bootstrap/channel.rs +++ b/src/bootstrap/channel.rs @@ -14,7 +14,7 @@ use crate::Build; use crate::config::Config; // The version number -pub const CFG_RELEASE_NUM: &str = "1.34.0"; +pub const CFG_RELEASE_NUM: &str = "1.35.0"; pub struct GitInfo { inner: Option, diff --git a/src/liballoc/macros.rs b/src/liballoc/macros.rs index eb3410078513..dd128e096f95 100644 --- a/src/liballoc/macros.rs +++ b/src/liballoc/macros.rs @@ -34,8 +34,7 @@ #[cfg(not(test))] #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(not(stage0), allow_internal_unstable(box_syntax))] -#[cfg_attr(stage0, allow_internal_unstable)] +#[allow_internal_unstable(box_syntax)] macro_rules! vec { ($elem:expr; $n:expr) => ( $crate::vec::from_elem($elem, $n) diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index e6098b1b24cc..75a33394e3d2 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -1282,13 +1282,11 @@ extern "rust-intrinsic" { /// The stabilized versions of this intrinsic are available on the integer /// primitives via the `saturating_add` method. For example, /// [`std::u32::saturating_add`](../../std/primitive.u32.html#method.saturating_add) - #[cfg(not(stage0))] pub fn saturating_add(a: T, b: T) -> T; /// Computes `a - b`, while saturating at numeric bounds. /// The stabilized versions of this intrinsic are available on the integer /// primitives via the `saturating_sub` method. For example, /// [`std::u32::saturating_sub`](../../std/primitive.u32.html#method.saturating_sub) - #[cfg(not(stage0))] pub fn saturating_sub(a: T, b: T) -> T; /// Returns the value of the discriminant for the variant in 'v', diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index fdbfa56000b8..b052f59b0f5c 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -1,7 +1,6 @@ /// Entry point of thread panic. For details, see `std::macros`. #[macro_export] -#[cfg_attr(not(stage0), allow_internal_unstable(core_panic, __rust_unstable_column))] -#[cfg_attr(stage0, allow_internal_unstable)] +#[allow_internal_unstable(core_panic, __rust_unstable_column)] #[stable(feature = "core", since = "1.6.0")] macro_rules! panic { () => ( @@ -422,8 +421,7 @@ macro_rules! write { /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(format_args_nl))] +#[allow_internal_unstable(format_args_nl)] macro_rules! writeln { ($dst:expr) => ( write!($dst, "\n") diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 29606cb19038..9b1ead7edd68 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -636,7 +636,7 @@ unsafe impl Freeze for &mut T {} /// [`Pin

`]: ../pin/struct.Pin.html /// [`pin module`]: ../../std/pin/index.html #[stable(feature = "pin", since = "1.33.0")] -#[cfg_attr(not(stage0), lang = "unpin")] +#[lang = "unpin"] pub auto trait Unpin {} /// A marker type which does not implement `Unpin`. diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 6708a195f88c..502e3de8c637 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -874,33 +874,6 @@ bounds instead of overflowing. Basic usage: -``` -", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_add(1), 101); -assert_eq!(", stringify!($SelfT), "::max_value().saturating_add(100), ", stringify!($SelfT), -"::max_value());", -$EndFeature, " -```"), - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn saturating_add(self, rhs: Self) -> Self { - match self.checked_add(rhs) { - Some(x) => x, - None if rhs >= 0 => Self::max_value(), - None => Self::min_value(), - } - } - - } - - doc_comment! { - concat!("Saturating integer addition. Computes `self + rhs`, saturating at the numeric -bounds instead of overflowing. - -# Examples - -Basic usage: - ``` ", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_add(1), 101); assert_eq!(", stringify!($SelfT), "::max_value().saturating_add(100), ", stringify!($SelfT), @@ -911,37 +884,11 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_saturating_int_methods")] #[inline] - #[cfg(not(stage0))] pub const fn saturating_add(self, rhs: Self) -> Self { intrinsics::saturating_add(self, rhs) } } - doc_comment! { - concat!("Saturating integer subtraction. Computes `self - rhs`, saturating at the -numeric bounds instead of overflowing. - -# Examples - -Basic usage: - -``` -", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_sub(127), -27); -assert_eq!(", stringify!($SelfT), "::min_value().saturating_sub(100), ", stringify!($SelfT), -"::min_value());", -$EndFeature, " -```"), - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn saturating_sub(self, rhs: Self) -> Self { - match self.checked_sub(rhs) { - Some(x) => x, - None if rhs >= 0 => Self::min_value(), - None => Self::max_value(), - } - } - } doc_comment! { concat!("Saturating integer subtraction. Computes `self - rhs`, saturating at the @@ -960,7 +907,6 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_saturating_int_methods")] #[inline] - #[cfg(not(stage0))] pub const fn saturating_sub(self, rhs: Self) -> Self { intrinsics::saturating_sub(self, rhs) } @@ -2780,29 +2726,6 @@ the numeric bounds instead of overflowing. Basic usage: -``` -", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_add(1), 101); -assert_eq!(200u8.saturating_add(127), 255);", $EndFeature, " -```"), - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn saturating_add(self, rhs: Self) -> Self { - match self.checked_add(rhs) { - Some(x) => x, - None => Self::max_value(), - } - } - } - - doc_comment! { - concat!("Saturating integer addition. Computes `self + rhs`, saturating at -the numeric bounds instead of overflowing. - -# Examples - -Basic usage: - ``` ", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_add(1), 101); assert_eq!(200u8.saturating_add(127), 255);", $EndFeature, " @@ -2811,7 +2734,6 @@ assert_eq!(200u8.saturating_add(127), 255);", $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_saturating_int_methods")] #[inline] - #[cfg(not(stage0))] pub const fn saturating_add(self, rhs: Self) -> Self { intrinsics::saturating_add(self, rhs) } @@ -2825,29 +2747,6 @@ at the numeric bounds instead of overflowing. Basic usage: -``` -", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_sub(27), 73); -assert_eq!(13", stringify!($SelfT), ".saturating_sub(127), 0);", $EndFeature, " -```"), - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn saturating_sub(self, rhs: Self) -> Self { - match self.checked_sub(rhs) { - Some(x) => x, - None => Self::min_value(), - } - } - } - - doc_comment! { - concat!("Saturating integer subtraction. Computes `self - rhs`, saturating -at the numeric bounds instead of overflowing. - -# Examples - -Basic usage: - ``` ", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_sub(27), 73); assert_eq!(13", stringify!($SelfT), ".saturating_sub(127), 0);", $EndFeature, " @@ -2855,7 +2754,6 @@ assert_eq!(13", stringify!($SelfT), ".saturating_sub(127), 0);", $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_saturating_int_methods")] #[inline] - #[cfg(not(stage0))] pub const fn saturating_sub(self, rhs: Self) -> Self { intrinsics::saturating_sub(self, rhs) } diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index f9f20dcea9e2..11e5b0adcc4b 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -279,7 +279,7 @@ use ops::{Deref, DerefMut, Receiver, CoerceUnsized, DispatchFromDyn}; // implementations, are allowed because they all only use `&P`, so they cannot move // the value behind `pointer`. #[stable(feature = "pin", since = "1.33.0")] -#[cfg_attr(not(stage0), lang = "pin")] +#[lang = "pin"] #[fundamental] #[repr(transparent)] #[derive(Copy, Clone, Hash, Eq, Ord)] diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index d0ee5fa9e6b3..04a49d253015 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -290,15 +290,11 @@ pub enum Ordering { /// [`AtomicBool`]: struct.AtomicBool.html #[cfg(target_has_atomic = "8")] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(not(stage0), rustc_deprecated( +#[rustc_deprecated( since = "1.34.0", reason = "the `new` function is now preferred", suggestion = "AtomicBool::new(false)", -))] -#[cfg_attr(stage0, rustc_deprecated( - since = "1.34.0", - reason = "the `new` function is now preferred", -))] +)] pub const ATOMIC_BOOL_INIT: AtomicBool = AtomicBool::new(false); #[cfg(target_has_atomic = "8")] @@ -1158,15 +1154,11 @@ macro_rules! atomic_int { /// An atomic integer initialized to `0`. #[$stable_init_const] - #[cfg_attr(stage0, rustc_deprecated( - since = "1.34.0", - reason = "the `new` function is now preferred", - ))] - #[cfg_attr(not(stage0), rustc_deprecated( + #[rustc_deprecated( since = "1.34.0", reason = "the `new` function is now preferred", suggestion = $atomic_new, - ))] + )] pub const $atomic_init: $atomic_type = $atomic_type::new(0); #[$stable] diff --git a/src/librustc_data_structures/macros.rs b/src/librustc_data_structures/macros.rs index af1f2910461e..029e7267c824 100644 --- a/src/librustc_data_structures/macros.rs +++ b/src/librustc_data_structures/macros.rs @@ -1,8 +1,7 @@ /// A simple static assertion macro. The first argument should be a unique /// ALL_CAPS identifier that describes the condition. #[macro_export] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(type_ascription))] +#[allow_internal_unstable(type_ascription)] macro_rules! static_assert { ($name:ident: $test:expr) => { // Use the bool to access an array such that if the bool is false, the access diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 281641c3c123..9d0eb2e6b1ce 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -53,8 +53,7 @@ /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(__rust_unstable_column, libstd_sys_internals))] +#[allow_internal_unstable(__rust_unstable_column, libstd_sys_internals)] macro_rules! panic { () => ({ panic!("explicit panic") @@ -112,8 +111,7 @@ macro_rules! panic { /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(print_internals))] +#[allow_internal_unstable(print_internals)] macro_rules! print { ($($arg:tt)*) => ($crate::io::_print(format_args!($($arg)*))); } @@ -145,8 +143,7 @@ macro_rules! print { /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(print_internals, format_args_nl))] +#[allow_internal_unstable(print_internals, format_args_nl)] macro_rules! println { () => (print!("\n")); ($($arg:tt)*) => ({ @@ -177,8 +174,7 @@ macro_rules! println { /// ``` #[macro_export] #[stable(feature = "eprint", since = "1.19.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(print_internals))] +#[allow_internal_unstable(print_internals)] macro_rules! eprint { ($($arg:tt)*) => ($crate::io::_eprint(format_args!($($arg)*))); } @@ -206,8 +202,7 @@ macro_rules! eprint { /// ``` #[macro_export] #[stable(feature = "eprint", since = "1.19.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(print_internals, format_args_nl))] +#[allow_internal_unstable(print_internals, format_args_nl)] macro_rules! eprintln { () => (eprint!("\n")); ($($arg:tt)*) => ({ @@ -330,8 +325,7 @@ macro_rules! dbg { /// A macro to await on an async call. #[macro_export] #[unstable(feature = "await_macro", issue = "50547")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(gen_future, generators))] +#[allow_internal_unstable(gen_future, generators)] #[allow_internal_unsafe] macro_rules! r#await { ($e:expr) => { { diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index d1f53734d30e..3a876e05eccb 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -126,8 +126,7 @@ impl fmt::Debug for LocalKey { /// [`std::thread::LocalKey`]: ../std/thread/struct.LocalKey.html #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(thread_local_internals))] +#[allow_internal_unstable(thread_local_internals)] macro_rules! thread_local { // empty (base case for the recursion) () => {}; @@ -149,10 +148,7 @@ macro_rules! thread_local { reason = "should not be necessary", issue = "0")] #[macro_export] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable( - thread_local_internals, cfg_target_thread_local, thread_local, -))] +#[allow_internal_unstable(thread_local_internals, cfg_target_thread_local, thread_local)] #[allow_internal_unsafe] macro_rules! __thread_local_inner { (@key $(#[$attr:meta])* $vis:vis $name:ident, $t:ty, $init:expr) => { diff --git a/src/stage0.txt b/src/stage0.txt index a93ee6bc604a..274c0f90442f 100644 --- a/src/stage0.txt +++ b/src/stage0.txt @@ -12,7 +12,7 @@ # source tarball for a stable release you'll likely see `1.x.0` for rustc and # `0.x.0` for Cargo where they were released on `date`. -date: 2019-02-17 +date: 2019-02-27 rustc: beta cargo: beta From edbbfad88f67b789bca682e4f2c4a58ac4dc81cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 2 Mar 2019 11:25:00 -0800 Subject: [PATCH 175/381] Suggest removal of `&` when borrowing macro and appropriate Fix #58815. --- src/librustc_typeck/check/demand.rs | 9 +++++++ src/test/ui/block-result/issue-5500.stderr | 5 +++- .../ui/diverging-tuple-parts-39485.stderr | 10 +++++-- src/test/ui/suggestions/format-borrow.rs | 6 +++++ src/test/ui/suggestions/format-borrow.stderr | 27 +++++++++++++++++++ 5 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 src/test/ui/suggestions/format-borrow.rs create mode 100644 src/test/ui/suggestions/format-borrow.stderr diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index f736e7ac29d0..32ca854b2774 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -367,6 +367,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Maybe remove `&`? hir::ExprKind::AddrOf(_, ref expr) => { if !cm.span_to_filename(expr.span).is_real() { + if let Ok(code) = cm.span_to_snippet(sp) { + if code.chars().next() == Some('&') { + return Some(( + sp, + "consider removing the borrow", + code[1..].to_string()), + ); + } + } return None; } if let Ok(code) = cm.span_to_snippet(expr.span) { diff --git a/src/test/ui/block-result/issue-5500.stderr b/src/test/ui/block-result/issue-5500.stderr index 0d9c9d8143d3..6a13b31fe932 100644 --- a/src/test/ui/block-result/issue-5500.stderr +++ b/src/test/ui/block-result/issue-5500.stderr @@ -4,7 +4,10 @@ error[E0308]: mismatched types LL | fn main() { | - expected `()` because of default return type LL | &panic!() - | ^^^^^^^^^ expected (), found reference + | ^^^^^^^^^ + | | + | expected (), found reference + | help: consider removing the borrow: `panic!()` | = note: expected type `()` found type `&_` diff --git a/src/test/ui/diverging-tuple-parts-39485.stderr b/src/test/ui/diverging-tuple-parts-39485.stderr index c399650d3258..3457549a7523 100644 --- a/src/test/ui/diverging-tuple-parts-39485.stderr +++ b/src/test/ui/diverging-tuple-parts-39485.stderr @@ -1,13 +1,19 @@ error[E0308]: mismatched types --> $DIR/diverging-tuple-parts-39485.rs:8:5 | -LL | fn g() { - | - help: try adding a return type: `-> &_` LL | &panic!() //~ ERROR mismatched types | ^^^^^^^^^ expected (), found reference | = note: expected type `()` found type `&_` +help: try adding a return type + | +LL | fn g() -> &_ { + | ^^^^^ +help: consider removing the borrow + | +LL | panic!() //~ ERROR mismatched types + | ^^^^^^^^ error[E0308]: mismatched types --> $DIR/diverging-tuple-parts-39485.rs:12:5 diff --git a/src/test/ui/suggestions/format-borrow.rs b/src/test/ui/suggestions/format-borrow.rs new file mode 100644 index 000000000000..63930e7f787f --- /dev/null +++ b/src/test/ui/suggestions/format-borrow.rs @@ -0,0 +1,6 @@ +fn main() { + let a: String = &String::from("a"); + //~^ ERROR mismatched types + let b: String = &format!("b"); + //~^ ERROR mismatched types +} diff --git a/src/test/ui/suggestions/format-borrow.stderr b/src/test/ui/suggestions/format-borrow.stderr new file mode 100644 index 000000000000..44bb11faa7f3 --- /dev/null +++ b/src/test/ui/suggestions/format-borrow.stderr @@ -0,0 +1,27 @@ +error[E0308]: mismatched types + --> $DIR/format-borrow.rs:2:21 + | +LL | let a: String = &String::from("a"); + | ^^^^^^^^^^^^^^^^^^ + | | + | expected struct `std::string::String`, found reference + | help: consider removing the borrow: `String::from("a")` + | + = note: expected type `std::string::String` + found type `&std::string::String` + +error[E0308]: mismatched types + --> $DIR/format-borrow.rs:4:21 + | +LL | let b: String = &format!("b"); + | ^^^^^^^^^^^^^ + | | + | expected struct `std::string::String`, found reference + | help: consider removing the borrow: `format!("b")` + | + = note: expected type `std::string::String` + found type `&std::string::String` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. From df852c0d793eaf0c31124de6c0020d21c07591e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 2 Mar 2019 15:16:53 -0800 Subject: [PATCH 176/381] Suggest appropriate code for unused field when desrtucturing patttern Fix #56472. --- src/librustc/middle/liveness.rs | 15 +++++++++++++- .../ui/suggestions/unused-closure-argument.rs | 20 +++++++++++++++++++ .../unused-closure-argument.stderr | 20 +++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/suggestions/unused-closure-argument.rs create mode 100644 src/test/ui/suggestions/unused-closure-argument.stderr diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 76933a6e3484..97f747c94a41 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -379,9 +379,22 @@ fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'a, 'tcx>, let body = ir.tcx.hir().body(body_id); for arg in &body.arguments { + let is_shorthand = match arg.pat.node { + crate::hir::PatKind::Struct(..) => true, + _ => false, + }; arg.pat.each_binding(|_bm, hir_id, _x, ident| { debug!("adding argument {:?}", hir_id); - fn_maps.add_variable(Arg(hir_id, ident.name)); + let var = if is_shorthand { + Local(LocalInfo { + id: hir_id, + name: ident.name, + is_shorthand: true, + }) + } else { + Arg(hir_id, ident.name) + }; + fn_maps.add_variable(var); }) }; diff --git a/src/test/ui/suggestions/unused-closure-argument.rs b/src/test/ui/suggestions/unused-closure-argument.rs new file mode 100644 index 000000000000..677003ebf225 --- /dev/null +++ b/src/test/ui/suggestions/unused-closure-argument.rs @@ -0,0 +1,20 @@ +#![deny(unused_variables)] + +struct Point { + x: i32, + y: i32, +} + +fn main() { + let points = vec!(Point { x: 1, y: 2 }, Point { x: 3, y: 4 }); + + let _: i32 = points.iter() + .map(|Point { x, y }| y) + //~^ ERROR unused variable + .sum(); + + let _: i32 = points.iter() + .map(|x| 4) + //~^ ERROR unused variable + .sum(); +} diff --git a/src/test/ui/suggestions/unused-closure-argument.stderr b/src/test/ui/suggestions/unused-closure-argument.stderr new file mode 100644 index 000000000000..5cfdd79659b2 --- /dev/null +++ b/src/test/ui/suggestions/unused-closure-argument.stderr @@ -0,0 +1,20 @@ +error: unused variable: `x` + --> $DIR/unused-closure-argument.rs:12:23 + | +LL | .map(|Point { x, y }| y) + | ^ help: try ignoring the field: `x: _` + | +note: lint level defined here + --> $DIR/unused-closure-argument.rs:1:9 + | +LL | #![deny(unused_variables)] + | ^^^^^^^^^^^^^^^^ + +error: unused variable: `x` + --> $DIR/unused-closure-argument.rs:17:15 + | +LL | .map(|x| 4) + | ^ help: consider prefixing with an underscore: `_x` + +error: aborting due to 2 previous errors + From ddd4731f5ffaa30d8f27823497f1ecb1dcf03134 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sat, 2 Mar 2019 16:58:38 -0300 Subject: [PATCH 177/381] Update miri --- Cargo.lock | 22 ++++++++++++++++++++++ src/tools/miri | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 4fe819511704..2e5dce66a33c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -508,6 +508,7 @@ dependencies = [ "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tester 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3437,6 +3438,15 @@ dependencies = [ name = "term" version = "0.0.0" +[[package]] +name = "term" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "term" version = "0.5.1" @@ -3473,6 +3483,16 @@ dependencies = [ "term 0.0.0", ] +[[package]] +name = "tester" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "textwrap" version = "0.10.0" @@ -4234,9 +4254,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "a303ba60a099fcd2aaa646b14d2724591a96a75283e4b7ed3d1a1658909d9ae2" "checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2" "checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508" +"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +"checksum tester 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e812cb26c597f86a49b26dbb58b878bd2a2b4b93fc069dc39499228fe556ff6" "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" diff --git a/src/tools/miri b/src/tools/miri index 724be298a1e1..e3527fdba717 160000 --- a/src/tools/miri +++ b/src/tools/miri @@ -1 +1 @@ -Subproject commit 724be298a1e12593dbc3786cafc307627e46e802 +Subproject commit e3527fdba7178120a6398e76aa4b3908b10ef85e From 0081ef2548f95171b33bbaedcd90253cf41916b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 10 Feb 2019 05:12:00 -0800 Subject: [PATCH 178/381] Point at enum definition when match patterns are not exhaustive ``` error[E0004]: non-exhaustive patterns: type `X` is non-empty --> file.rs:9:11 | 1 | / enum X { 2 | | A, | | - variant not covered 3 | | B, | | - variant not covered 4 | | C, | | - variant not covered 5 | | } | |_- `X` defined here ... 9 | match x { | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `B` and `C` not covered --> file.rs:11:11 | 1 | / enum X { 2 | | A, 3 | | B, 4 | | C, | | - not covered 5 | | } | |_- `X` defined here ... 11 | match x { | ^ patterns `C` not covered ``` When a match expression doesn't have patterns covering every variant, point at the enum's definition span. On a best effort basis, point at the variant(s) that are missing. This does not handle the case when the missing pattern is due to a field's enum variants: ``` enum E1 { A, B, C, } enum E2 { A(E1), B, } fn foo() { match E2::A(E1::A) { E2::A(E1::B) => {} E2::B => {} } //~^ ERROR `E2::A(E1::A)` and `E2::A(E1::C)` not handled } ``` Unify look between match with no arms and match with some missing patterns. Fix #37518. --- src/librustc_mir/hair/pattern/_match.rs | 1 - src/librustc_mir/hair/pattern/check_match.rs | 134 ++++++++++++++---- src/test/ui/always-inhabited-union-ref.stderr | 12 +- src/test/ui/check_match/issue-35609.stderr | 22 +++ src/test/ui/consts/match_ice.stderr | 2 + src/test/ui/empty/empty-never-array.stderr | 11 +- src/test/ui/error-codes/E0004-2.stderr | 6 +- src/test/ui/error-codes/E0004.stderr | 13 +- .../ui/exhaustive_integer_patterns.stderr | 22 +++ ...-gate-precise_pointer_size_matching.stderr | 4 + src/test/ui/issues/issue-15129.stderr | 2 + src/test/ui/issues/issue-2111.stderr | 2 + src/test/ui/issues/issue-30240.stderr | 4 + src/test/ui/issues/issue-3096-1.stderr | 6 +- src/test/ui/issues/issue-3096-2.stderr | 6 +- src/test/ui/issues/issue-31561.stderr | 11 +- src/test/ui/issues/issue-3601.stderr | 2 + src/test/ui/issues/issue-39362.stderr | 11 +- src/test/ui/issues/issue-4321.stderr | 2 + src/test/ui/match/match-argm-statics-2.stderr | 16 ++- .../match/match-byte-array-patterns-2.stderr | 4 + src/test/ui/match/match-non-exhaustive.stderr | 4 + .../ui/match/match-privately-empty.stderr | 2 + src/test/ui/match/match-slice-patterns.stderr | 2 + .../missing/missing-items/issue-40221.stderr | 12 +- .../non-exhaustive-float-range-match.stderr | 2 + .../non-exhaustive-match-nested.stderr | 10 ++ .../non-exhaustive-match.stderr | 28 ++++ .../non-exhaustive-pattern-witness.stderr | 70 +++++++-- .../ui/precise_pointer_size_matching.stderr | 4 + .../slice.stderr | 2 + .../ui/rfc-2008-non-exhaustive/enum.stderr | 2 + .../struct-like-enum-nonexhaustive.stderr | 13 +- .../tuple/tuple-struct-nonexhaustive.stderr | 5 + .../uninhabited-irrefutable.stderr | 12 +- .../uninhabited-matches-feature-gated.stderr | 24 ++-- 36 files changed, 390 insertions(+), 95 deletions(-) diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 9e9a5d0f82ad..60eb30e07533 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -539,7 +539,6 @@ impl<'tcx> Witness<'tcx> { self.apply_constructor(cx, ctor, ty) } - /// Constructs a partial witness for a pattern given a list of /// patterns expanded by the specialization step. /// diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 0f151cd688df..96709e2ac045 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -10,7 +10,7 @@ use rustc::middle::expr_use_visitor as euv; use rustc::middle::mem_categorization::cmt_; use rustc::middle::region; use rustc::session::Session; -use rustc::ty::{self, Ty, TyCtxt}; +use rustc::ty::{self, Ty, TyCtxt, TyKind}; use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::lint; use rustc_errors::{Applicability, DiagnosticBuilder}; @@ -204,25 +204,42 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { // is uninhabited. let pat_ty = self.tables.node_type(scrut.hir_id); let module = self.tcx.hir().get_module_parent_by_hir_id(scrut.hir_id); + let mut def_span = None; + let mut missing_variants = vec![]; if inlined_arms.is_empty() { let scrutinee_is_uninhabited = if self.tcx.features().exhaustive_patterns { self.tcx.is_ty_uninhabited_from(module, pat_ty) } else { match pat_ty.sty { ty::Never => true, - ty::Adt(def, _) => def.variants.is_empty(), + ty::Adt(def, _) => { + def_span = self.tcx.hir().span_if_local(def.did); + if def.variants.len() < 4 && !def.variants.is_empty() { + // keep around to point at the definition of non-covered variants + missing_variants = def.variants.iter() + .map(|variant| variant.ident.span) + .collect(); + } + def.variants.is_empty() + }, _ => false } }; if !scrutinee_is_uninhabited { // We know the type is inhabited, so this must be wrong - let mut err = create_e0004(self.tcx.sess, scrut.span, - format!("non-exhaustive patterns: type `{}` \ - is non-empty", - pat_ty)); - span_help!(&mut err, scrut.span, - "ensure that all possible cases are being handled, \ - possibly by adding wildcards or more match arms"); + let mut err = create_e0004(self.tcx.sess, scrut.span, format!( + "non-exhaustive patterns: type `{}` is non-empty", + pat_ty, + )); + err.help("ensure that all possible cases are being handled, \ + possibly by adding wildcards or more match arms"); + if let Some(sp) = def_span { + err.span_label(sp, format!("`{}` defined here", pat_ty)); + } + // point at the definition of non-covered enum variants + for variant in &missing_variants { + err.span_label(*variant, "variant not covered"); + } err.emit(); } // If the type *is* uninhabited, it's vacuously exhaustive @@ -264,7 +281,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { }; let pattern_string = witness[0].single_pattern().to_string(); - let mut diag = struct_span_err!( + let mut err = struct_span_err!( self.tcx.sess, pat.span, E0005, "refutable pattern in {}: `{}` not covered", origin, pattern_string @@ -277,8 +294,13 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { } _ => format!("pattern `{}` not covered", pattern_string), }; - diag.span_label(pat.span, label_msg); - diag.emit(); + err.span_label(pat.span, label_msg); + if let ty::Adt(def, _) = pattern_ty.sty { + if let Some(sp) = self.tcx.hir().span_if_local(def.did){ + err.span_label(sp, format!("`{}` defined here", pattern_ty)); + } + } + err.emit(); }); } } @@ -332,10 +354,11 @@ fn pat_is_catchall(pat: &Pat) -> bool { } // Check for unreachable patterns -fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, - arms: &[(Vec<(&'a Pattern<'tcx>, &hir::Pat)>, Option<&hir::Expr>)], - source: hir::MatchSource) -{ +fn check_arms<'a, 'tcx>( + cx: &mut MatchCheckCtxt<'a, 'tcx>, + arms: &[(Vec<(&'a Pattern<'tcx>, &hir::Pat)>, Option<&hir::Expr>)], + source: hir::MatchSource, +) { let mut seen = Matrix::empty(); let mut catchall = None; for (arm_index, &(ref pats, guard)) in arms.iter().enumerate() { @@ -411,10 +434,12 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, } } -fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, - scrut_ty: Ty<'tcx>, - sp: Span, - matrix: &Matrix<'p, 'tcx>) { +fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>( + cx: &mut MatchCheckCtxt<'a, 'tcx>, + scrut_ty: Ty<'tcx>, + sp: Span, + matrix: &Matrix<'p, 'tcx>, +) { let wild_pattern = Pattern { ty: scrut_ty, span: DUMMY_SP, @@ -448,11 +473,26 @@ fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, 1 => format!("pattern {} not covered", joined_patterns), _ => format!("patterns {} not covered", joined_patterns), }; - create_e0004(cx.tcx.sess, sp, - format!("non-exhaustive patterns: {} not covered", - joined_patterns)) - .span_label(sp, label_text) - .emit(); + let mut err = create_e0004(cx.tcx.sess, sp, format!( + "non-exhaustive patterns: {} not covered", + joined_patterns, + )); + err.span_label(sp, label_text); + // point at the definition of non-covered enum variants + if let ty::Adt(def, _) = scrut_ty.sty { + if let Some(sp) = cx.tcx.hir().span_if_local(def.did){ + err.span_label(sp, format!("`{}` defined here", scrut_ty)); + } + } + let patterns = witnesses.iter().map(|p| (**p).clone()).collect::>(); + if patterns.len() < 4 { + for sp in maybe_point_at_variant(cx, &scrut_ty.sty, patterns.as_slice()) { + err.span_label(sp, "not covered"); + } + } + err.help("ensure that all possible cases are being handled, \ + possibly by adding wildcards or more match arms"); + err.emit(); } NotUseful => { // This is good, wildcard pattern isn't reachable @@ -461,10 +501,48 @@ fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, } } +fn maybe_point_at_variant( + cx: &mut MatchCheckCtxt<'a, 'tcx>, + sty: &TyKind<'tcx>, + patterns: &[Pattern], +) -> Vec { + let mut covered = vec![]; + if let ty::Adt(def, _) = sty { + // Don't point at the variants if they are too many to avoid visual clutter + for pattern in patterns { + let pk: &PatternKind = &pattern.kind; + if let PatternKind::Variant { adt_def, variant_index, subpatterns, .. } = pk { + if adt_def.did == def.did { + let sp = def.variants[*variant_index].ident.span; + if covered.contains(&sp) { + continue; + } + covered.push(sp); + let subpatterns = subpatterns.iter() + .map(|field_pattern| field_pattern.pattern.clone()) + .collect::>(); + covered.extend( + maybe_point_at_variant(cx, sty, subpatterns.as_slice()), + ); + } + } + if let PatternKind::Leaf{ subpatterns } = pk { + let subpatterns = subpatterns.iter() + .map(|field_pattern| field_pattern.pattern.clone()) + .collect::>(); + covered.extend(maybe_point_at_variant(cx, sty, subpatterns.as_slice())); + } + } + } + covered +} + // Legality of move bindings checking -fn check_legality_of_move_bindings(cx: &MatchVisitor<'_, '_>, - has_guard: bool, - pats: &[P]) { +fn check_legality_of_move_bindings( + cx: &MatchVisitor<'_, '_>, + has_guard: bool, + pats: &[P], +) { let mut by_ref_span = None; for pat in pats { pat.each_binding(|_, hir_id, span, _path| { diff --git a/src/test/ui/always-inhabited-union-ref.stderr b/src/test/ui/always-inhabited-union-ref.stderr index 212f5d7c525f..792ab6f59a43 100644 --- a/src/test/ui/always-inhabited-union-ref.stderr +++ b/src/test/ui/always-inhabited-union-ref.stderr @@ -4,11 +4,7 @@ error[E0004]: non-exhaustive patterns: type `&'static !` is non-empty LL | match uninhab_ref() { | ^^^^^^^^^^^^^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/always-inhabited-union-ref.rs:23:11 - | -LL | match uninhab_ref() { - | ^^^^^^^^^^^^^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: type `Foo` is non-empty --> $DIR/always-inhabited-union-ref.rs:27:11 @@ -16,11 +12,7 @@ error[E0004]: non-exhaustive patterns: type `Foo` is non-empty LL | match uninhab_union() { | ^^^^^^^^^^^^^^^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/always-inhabited-union-ref.rs:27:11 - | -LL | match uninhab_union() { - | ^^^^^^^^^^^^^^^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/check_match/issue-35609.stderr b/src/test/ui/check_match/issue-35609.stderr index 7a517e856cbe..54e5c988f8cc 100644 --- a/src/test/ui/check_match/issue-35609.stderr +++ b/src/test/ui/check_match/issue-35609.stderr @@ -3,48 +3,70 @@ error[E0004]: non-exhaustive patterns: `(B, _)`, `(C, _)`, `(D, _)` and 2 more n | LL | match (A, ()) { //~ ERROR non-exhaustive | ^^^^^^^ patterns `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered --> $DIR/issue-35609.rs:14:11 | LL | match (A, A) { //~ ERROR non-exhaustive | ^^^^^^ patterns `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:18:11 | LL | match ((A, ()), ()) { //~ ERROR non-exhaustive | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:22:11 | LL | match ((A, ()), A) { //~ ERROR non-exhaustive | ^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:26:11 | LL | match ((A, ()), ()) { //~ ERROR non-exhaustive | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered --> $DIR/issue-35609.rs:31:11 | +LL | struct S(Enum, ()); + | ------------------- `S` defined here +... LL | match S(A, ()) { //~ ERROR non-exhaustive | ^^^^^^^^ patterns `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered --> $DIR/issue-35609.rs:35:11 | +LL | struct Sd { x: Enum, y: () } + | ---------------------------- `Sd` defined here +... LL | match (Sd { x: A, y: () }) { //~ ERROR non-exhaustive | ^^^^^^^^^^^^^^^^^^^^ patterns `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered --> $DIR/issue-35609.rs:39:11 | LL | match Some(A) { //~ ERROR non-exhaustive | ^^^^^^^ patterns `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 8 previous errors diff --git a/src/test/ui/consts/match_ice.stderr b/src/test/ui/consts/match_ice.stderr index e6e04e2c4627..d98402316959 100644 --- a/src/test/ui/consts/match_ice.stderr +++ b/src/test/ui/consts/match_ice.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `&S` not covered | LL | match C { //~ ERROR non-exhaustive | ^ pattern `&S` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/empty/empty-never-array.stderr b/src/test/ui/empty/empty-never-array.stderr index e409f14d6ce9..f1be4a6edec5 100644 --- a/src/test/ui/empty/empty-never-array.stderr +++ b/src/test/ui/empty/empty-never-array.stderr @@ -1,8 +1,15 @@ error[E0005]: refutable pattern in local binding: `T(_, _)` not covered --> $DIR/empty-never-array.rs:10:9 | -LL | let Helper::U(u) = Helper::T(t, []); - | ^^^^^^^^^^^^ pattern `T(_, _)` not covered +LL | / enum Helper { +LL | | T(T, [!; 0]), +LL | | #[allow(dead_code)] +LL | | U(U), +LL | | } + | |_- `Helper` defined here +... +LL | let Helper::U(u) = Helper::T(t, []); + | ^^^^^^^^^^^^ pattern `T(_, _)` not covered error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr index 8b262cc6eb78..94e38cf26aa4 100644 --- a/src/test/ui/error-codes/E0004-2.stderr +++ b/src/test/ui/error-codes/E0004-2.stderr @@ -4,11 +4,7 @@ error[E0004]: non-exhaustive patterns: type `std::option::Option` is non-em LL | match x { } //~ ERROR E0004 | ^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/E0004-2.rs:4:11 - | -LL | match x { } //~ ERROR E0004 - | ^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0004.stderr b/src/test/ui/error-codes/E0004.stderr index a66dd9290320..123f4b2f1b71 100644 --- a/src/test/ui/error-codes/E0004.stderr +++ b/src/test/ui/error-codes/E0004.stderr @@ -1,8 +1,17 @@ error[E0004]: non-exhaustive patterns: `HastaLaVistaBaby` not covered --> $DIR/E0004.rs:9:11 | -LL | match x { //~ ERROR E0004 - | ^ pattern `HastaLaVistaBaby` not covered +LL | / enum Terminator { +LL | | HastaLaVistaBaby, + | | ---------------- not covered +LL | | TalkToMyHand, +LL | | } + | |_- `Terminator` defined here +... +LL | match x { //~ ERROR E0004 + | ^ pattern `HastaLaVistaBaby` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/exhaustive_integer_patterns.stderr b/src/test/ui/exhaustive_integer_patterns.stderr index 7b873f7ba425..d9513710d446 100644 --- a/src/test/ui/exhaustive_integer_patterns.stderr +++ b/src/test/ui/exhaustive_integer_patterns.stderr @@ -15,12 +15,16 @@ error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered | LL | match x { //~ ERROR non-exhaustive patterns | ^ pattern `128u8..=255u8` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more not covered --> $DIR/exhaustive_integer_patterns.rs:33:11 | LL | match x { //~ ERROR non-exhaustive patterns | ^ patterns `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: unreachable pattern --> $DIR/exhaustive_integer_patterns.rs:44:9 @@ -33,54 +37,72 @@ error[E0004]: non-exhaustive patterns: `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` | LL | match x { //~ ERROR non-exhaustive patterns | ^ patterns `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `-128i8` not covered --> $DIR/exhaustive_integer_patterns.rs:82:11 | LL | match 0i8 { //~ ERROR non-exhaustive patterns | ^^^ pattern `-128i8` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `0i16` not covered --> $DIR/exhaustive_integer_patterns.rs:90:11 | LL | match 0i16 { //~ ERROR non-exhaustive patterns | ^^^^ pattern `0i16` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered --> $DIR/exhaustive_integer_patterns.rs:108:11 | LL | match 0u8 { //~ ERROR non-exhaustive patterns | ^^^ pattern `128u8..=255u8` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered --> $DIR/exhaustive_integer_patterns.rs:120:11 | LL | match (0u8, Some(())) { //~ ERROR non-exhaustive patterns | ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `(126u8..=127u8, false)` not covered --> $DIR/exhaustive_integer_patterns.rs:125:11 | LL | match (0u8, true) { //~ ERROR non-exhaustive patterns | ^^^^^^^^^^^ pattern `(126u8..=127u8, false)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211455u128` not covered --> $DIR/exhaustive_integer_patterns.rs:145:11 | LL | match 0u128 { //~ ERROR non-exhaustive patterns | ^^^^^ pattern `340282366920938463463374607431768211455u128` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `5u128..=340282366920938463463374607431768211455u128` not covered --> $DIR/exhaustive_integer_patterns.rs:149:11 | LL | match 0u128 { //~ ERROR non-exhaustive patterns | ^^^^^ pattern `5u128..=340282366920938463463374607431768211455u128` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `0u128..=3u128` not covered --> $DIR/exhaustive_integer_patterns.rs:153:11 | LL | match 0u128 { //~ ERROR non-exhaustive patterns | ^^^^^ pattern `0u128..=3u128` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 13 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr index 5806f6f03915..fd1e5392e69e 100644 --- a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr +++ b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr @@ -3,12 +3,16 @@ error[E0004]: non-exhaustive patterns: `_` not covered | LL | match 0usize { //~ERROR non-exhaustive patterns: `_` not covered | ^^^^^^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11 | LL | match 0isize { //~ERROR non-exhaustive patterns: `_` not covered | ^^^^^^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-15129.stderr b/src/test/ui/issues/issue-15129.stderr index 7ee369085202..b93fa14db038 100644 --- a/src/test/ui/issues/issue-15129.stderr +++ b/src/test/ui/issues/issue-15129.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `(T1(()), V2(_))` not covered | LL | match (T::T1(()), V::V2(true)) { | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `(T1(()), V2(_))` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2111.stderr b/src/test/ui/issues/issue-2111.stderr index 348ad153c809..90fdb48ea625 100644 --- a/src/test/ui/issues/issue-2111.stderr +++ b/src/test/ui/issues/issue-2111.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `(None, None)` not covered | LL | match (a,b) { | ^^^^^ pattern `(None, None)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/issues/issue-30240.stderr b/src/test/ui/issues/issue-30240.stderr index 973c59c58526..bc538abf3bdf 100644 --- a/src/test/ui/issues/issue-30240.stderr +++ b/src/test/ui/issues/issue-30240.stderr @@ -3,12 +3,16 @@ error[E0004]: non-exhaustive patterns: `&_` not covered | LL | match "world" { //~ ERROR non-exhaustive patterns: `&_` | ^^^^^^^ pattern `&_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&_` not covered --> $DIR/issue-30240.rs:6:11 | LL | match "world" { //~ ERROR non-exhaustive patterns: `&_` | ^^^^^^^ pattern `&_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-3096-1.stderr b/src/test/ui/issues/issue-3096-1.stderr index 7ced0d36805d..fee58474031e 100644 --- a/src/test/ui/issues/issue-3096-1.stderr +++ b/src/test/ui/issues/issue-3096-1.stderr @@ -4,11 +4,7 @@ error[E0004]: non-exhaustive patterns: type `()` is non-empty LL | match () { } //~ ERROR non-exhaustive | ^^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/issue-3096-1.rs:2:11 - | -LL | match () { } //~ ERROR non-exhaustive - | ^^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3096-2.stderr b/src/test/ui/issues/issue-3096-2.stderr index df8767944895..93119d377441 100644 --- a/src/test/ui/issues/issue-3096-2.stderr +++ b/src/test/ui/issues/issue-3096-2.stderr @@ -4,11 +4,7 @@ error[E0004]: non-exhaustive patterns: type `*const Bottom` is non-empty LL | match x { } //~ ERROR non-exhaustive patterns | ^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/issue-3096-2.rs:5:11 - | -LL | match x { } //~ ERROR non-exhaustive patterns - | ^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/issues/issue-31561.stderr b/src/test/ui/issues/issue-31561.stderr index c95fc36cea6e..246137aeee05 100644 --- a/src/test/ui/issues/issue-31561.stderr +++ b/src/test/ui/issues/issue-31561.stderr @@ -1,8 +1,15 @@ error[E0005]: refutable pattern in local binding: `Bar` not covered --> $DIR/issue-31561.rs:8:9 | -LL | let Thing::Foo(y) = Thing::Foo(1); - | ^^^^^^^^^^^^^ pattern `Bar` not covered +LL | / enum Thing { +LL | | Foo(u8), +LL | | Bar, +LL | | Baz +LL | | } + | |_- `Thing` defined here +... +LL | let Thing::Foo(y) = Thing::Foo(1); + | ^^^^^^^^^^^^^ pattern `Bar` not covered error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3601.stderr b/src/test/ui/issues/issue-3601.stderr index 0b5242ee528d..85b534434342 100644 --- a/src/test/ui/issues/issue-3601.stderr +++ b/src/test/ui/issues/issue-3601.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `_` not covered | LL | box NodeKind::Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns | ^^^^^^^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/issues/issue-39362.stderr b/src/test/ui/issues/issue-39362.stderr index 06385127e94f..55cd14a5c1e0 100644 --- a/src/test/ui/issues/issue-39362.stderr +++ b/src/test/ui/issues/issue-39362.stderr @@ -1,8 +1,15 @@ error[E0004]: non-exhaustive patterns: `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered --> $DIR/issue-39362.rs:10:11 | -LL | match f { - | ^ patterns `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered +LL | / enum Foo { +LL | | Bar { bar: Bar, id: usize } +LL | | } + | |_- `Foo` defined here +... +LL | match f { + | ^ patterns `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/issues/issue-4321.stderr b/src/test/ui/issues/issue-4321.stderr index 7817fdcbce99..731e63fbb2b0 100644 --- a/src/test/ui/issues/issue-4321.stderr +++ b/src/test/ui/issues/issue-4321.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `(true, false)` not covered | LL | println!("foo {:}", match tup { //~ ERROR non-exhaustive patterns: `(true, false)` not covered | ^^^ pattern `(true, false)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/match/match-argm-statics-2.stderr b/src/test/ui/match/match-argm-statics-2.stderr index 3e6f22ab8751..8c54e030823a 100644 --- a/src/test/ui/match/match-argm-statics-2.stderr +++ b/src/test/ui/match/match-argm-statics-2.stderr @@ -3,18 +3,30 @@ error[E0004]: non-exhaustive patterns: `(true, false)` not covered | LL | match (true, false) { | ^^^^^^^^^^^^^ pattern `(true, false)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Some(Some(West))` not covered --> $DIR/match-argm-statics-2.rs:29:11 | LL | match Some(Some(North)) { | ^^^^^^^^^^^^^^^^^ pattern `Some(Some(West))` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Foo { bar: Some(North), baz: NewBool(true) }` not covered --> $DIR/match-argm-statics-2.rs:48:11 | -LL | match (Foo { bar: Some(North), baz: NewBool(true) }) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { bar: Some(North), baz: NewBool(true) }` not covered +LL | / struct Foo { +LL | | bar: Option, +LL | | baz: NewBool +LL | | } + | |_- `Foo` defined here +... +LL | match (Foo { bar: Some(North), baz: NewBool(true) }) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { bar: Some(North), baz: NewBool(true) }` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 3 previous errors diff --git a/src/test/ui/match/match-byte-array-patterns-2.stderr b/src/test/ui/match/match-byte-array-patterns-2.stderr index 4030cd39448a..83dbecfcac65 100644 --- a/src/test/ui/match/match-byte-array-patterns-2.stderr +++ b/src/test/ui/match/match-byte-array-patterns-2.stderr @@ -3,12 +3,16 @@ error[E0004]: non-exhaustive patterns: `&[_, _, _, _]` not covered | LL | match buf { //~ ERROR non-exhaustive | ^^^ pattern `&[_, _, _, _]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[]`, `&[_]`, `&[_, _]` and 3 more not covered --> $DIR/match-byte-array-patterns-2.rs:10:11 | LL | match buf { //~ ERROR non-exhaustive | ^^^ patterns `&[]`, `&[_]`, `&[_, _]` and 3 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/match/match-non-exhaustive.stderr b/src/test/ui/match/match-non-exhaustive.stderr index ab5ab18c3283..9921e4f63b64 100644 --- a/src/test/ui/match/match-non-exhaustive.stderr +++ b/src/test/ui/match/match-non-exhaustive.stderr @@ -3,12 +3,16 @@ error[E0004]: non-exhaustive patterns: `-2147483648i32..=0i32` and `2i32..=21474 | LL | match 0 { 1 => () } //~ ERROR non-exhaustive patterns | ^ patterns `-2147483648i32..=0i32` and `2i32..=2147483647i32` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/match-non-exhaustive.rs:3:11 | LL | match 0 { 0 if false => () } //~ ERROR non-exhaustive patterns | ^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/match/match-privately-empty.stderr b/src/test/ui/match/match-privately-empty.stderr index 23ca64e50af7..f79d180a1b8b 100644 --- a/src/test/ui/match/match-privately-empty.stderr +++ b/src/test/ui/match/match-privately-empty.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not co | LL | match private::DATA { | ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/match/match-slice-patterns.stderr b/src/test/ui/match/match-slice-patterns.stderr index 2b817498aba9..24769db34c93 100644 --- a/src/test/ui/match/match-slice-patterns.stderr +++ b/src/test/ui/match/match-slice-patterns.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `&[_, Some(_), None, _]` not covered | LL | match list { | ^^^^ pattern `&[_, Some(_), None, _]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/missing/missing-items/issue-40221.stderr b/src/test/ui/missing/missing-items/issue-40221.stderr index 437fb7bbc313..9e4ce7c81b70 100644 --- a/src/test/ui/missing/missing-items/issue-40221.stderr +++ b/src/test/ui/missing/missing-items/issue-40221.stderr @@ -1,8 +1,16 @@ error[E0004]: non-exhaustive patterns: `C(QA)` not covered --> $DIR/issue-40221.rs:11:11 | -LL | match proto { //~ ERROR non-exhaustive patterns - | ^^^^^ pattern `C(QA)` not covered +LL | / enum P { +LL | | C(PC), + | | - not covered +LL | | } + | |_- `P` defined here +... +LL | match proto { //~ ERROR non-exhaustive patterns + | ^^^^^ pattern `C(QA)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr b/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr index 2e285afb3804..03215f72ebcd 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `_` not covered | LL | match 0.0 { //~ ERROR non-exhaustive patterns | ^^^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr b/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr index b2551c8dcf2a..d5beac4b7163 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr @@ -3,12 +3,22 @@ error[E0004]: non-exhaustive patterns: `(Some(&[]), Err(_))` not covered | LL | match (l1, l2) { //~ ERROR non-exhaustive patterns: `(Some(&[]), Err(_))` not covered | ^^^^^^^^ pattern `(Some(&[]), Err(_))` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `A(C)` not covered --> $DIR/non-exhaustive-match-nested.rs:17:11 | +LL | enum T { A(U), B } + | ------------------ + | | | + | | not covered + | `T` defined here +... LL | match x { //~ ERROR non-exhaustive patterns: `A(C)` not covered | ^ pattern `A(C)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match.stderr b/src/test/ui/non-exhaustive/non-exhaustive-match.stderr index 8d2a73b2c6dc..112e18432b44 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-match.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-match.stderr @@ -1,50 +1,78 @@ error[E0004]: non-exhaustive patterns: `A` not covered --> $DIR/non-exhaustive-match.rs:8:11 | +LL | enum T { A, B } + | --------------- + | | | + | | not covered + | `T` defined here +... LL | match x { T::B => { } } //~ ERROR non-exhaustive patterns: `A` not covered | ^ pattern `A` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `false` not covered --> $DIR/non-exhaustive-match.rs:9:11 | LL | match true { //~ ERROR non-exhaustive patterns: `false` not covered | ^^^^ pattern `false` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Some(_)` not covered --> $DIR/non-exhaustive-match.rs:12:11 | LL | match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered | ^^^^^^^^ pattern `Some(_)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)` and `(_, _, 5i32..=2147483647i32)` not covered --> $DIR/non-exhaustive-match.rs:15:11 | LL | match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)` | ^^^^^^^^^ patterns `(_, _, -2147483648i32..=3i32)` and `(_, _, 5i32..=2147483647i32)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `(A, A)` not covered --> $DIR/non-exhaustive-match.rs:19:11 | LL | match (T::A, T::A) { //~ ERROR non-exhaustive patterns: `(A, A)` not covered | ^^^^^^^^^^^^ pattern `(A, A)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `B` not covered --> $DIR/non-exhaustive-match.rs:23:11 | +LL | enum T { A, B } + | --------------- + | | | + | | not covered + | `T` defined here +... LL | match T::A { //~ ERROR non-exhaustive patterns: `B` not covered | ^^^^ pattern `B` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `[]` not covered --> $DIR/non-exhaustive-match.rs:34:11 | LL | match *vec { //~ ERROR non-exhaustive patterns: `[]` not covered | ^^^^ pattern `[]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `[_, _, _, _]` not covered --> $DIR/non-exhaustive-match.rs:47:11 | LL | match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _]` not covered | ^^^^ pattern `[_, _, _, _]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 8 previous errors diff --git a/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr b/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr index d3a06e7b4b6f..a0b497dd4c0b 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr @@ -1,44 +1,94 @@ error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered --> $DIR/non-exhaustive-pattern-witness.rs:9:11 | -LL | match (Foo { first: true, second: None }) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered +LL | / struct Foo { +LL | | first: bool, +LL | | second: Option<[usize; 4]> +LL | | } + | |_- `Foo` defined here +... +LL | match (Foo { first: true, second: None }) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Red` not covered --> $DIR/non-exhaustive-pattern-witness.rs:25:11 | -LL | match Color::Red { - | ^^^^^^^^^^ pattern `Red` not covered +LL | / enum Color { +LL | | Red, + | | --- not covered +LL | | Green, +LL | | CustomRGBA { a: bool, r: u8, g: u8, b: u8 } +LL | | } + | |_- `Color` defined here +... +LL | match Color::Red { + | ^^^^^^^^^^ pattern `Red` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `East`, `South` and `West` not covered --> $DIR/non-exhaustive-pattern-witness.rs:37:11 | -LL | match Direction::North { - | ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` not covered +LL | / enum Direction { +LL | | North, East, South, West + | | ---- ----- ---- not covered + | | | | + | | | not covered + | | not covered +LL | | } + | |_- `Direction` defined here +... +LL | match Direction::North { + | ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Second`, `Third`, `Fourth` and 8 more not covered --> $DIR/non-exhaustive-pattern-witness.rs:48:11 | -LL | match ExcessiveEnum::First { - | ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered +LL | / enum ExcessiveEnum { +LL | | First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth +LL | | } + | |_- `ExcessiveEnum` defined here +... +LL | match ExcessiveEnum::First { + | ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered --> $DIR/non-exhaustive-pattern-witness.rs:56:11 | -LL | match Color::Red { - | ^^^^^^^^^^ pattern `CustomRGBA { a: true, .. }` not covered +LL | / enum Color { +LL | | Red, +LL | | Green, +LL | | CustomRGBA { a: bool, r: u8, g: u8, b: u8 } + | | ---------- not covered +LL | | } + | |_- `Color` defined here +... +LL | match Color::Red { + | ^^^^^^^^^^ pattern `CustomRGBA { a: true, .. }` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `[Second(true), Second(false)]` not covered --> $DIR/non-exhaustive-pattern-witness.rs:72:11 | LL | match *x { | ^^ pattern `[Second(true), Second(false)]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `((), false)` not covered --> $DIR/non-exhaustive-pattern-witness.rs:85:11 | LL | match ((), false) { | ^^^^^^^^^^^ pattern `((), false)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 7 previous errors diff --git a/src/test/ui/precise_pointer_size_matching.stderr b/src/test/ui/precise_pointer_size_matching.stderr index 4acbec6c7ff1..a8906a43003a 100644 --- a/src/test/ui/precise_pointer_size_matching.stderr +++ b/src/test/ui/precise_pointer_size_matching.stderr @@ -3,12 +3,16 @@ error[E0004]: non-exhaustive patterns: `$ISIZE_MIN..=-6isize` and `21isize..=$IS | LL | match 0isize { //~ ERROR non-exhaustive patterns | ^^^^^^ patterns `$ISIZE_MIN..=-6isize` and `21isize..=$ISIZE_MAX` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `0usize` and `21usize..=$USIZE_MAX` not covered --> $DIR/precise_pointer_size_matching.rs:29:11 | LL | match 0usize { //~ ERROR non-exhaustive patterns | ^^^^^^ patterns `0usize` and `21usize..=$USIZE_MAX` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr index 1dfad0d31896..e24c8f155590 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `&[]` not covered | LL | match sl { //~ ERROR non-exhaustive patterns | ^^ pattern `&[]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr index acce9779067a..b5c1a4ebba4a 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `_` not covered | LL | match enum_unit { | ^^^^^^^^^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr b/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr index d651ea0b4e2d..0aa85eb7253e 100644 --- a/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr +++ b/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr @@ -1,8 +1,17 @@ error[E0004]: non-exhaustive patterns: `B { x: Some(_) }` not covered --> $DIR/struct-like-enum-nonexhaustive.rs:8:11 | -LL | match x { //~ ERROR non-exhaustive patterns - | ^ pattern `B { x: Some(_) }` not covered +LL | / enum A { +LL | | B { x: Option }, + | | - not covered +LL | | C +LL | | } + | |_- `A` defined here +... +LL | match x { //~ ERROR non-exhaustive patterns + | ^ pattern `B { x: Some(_) }` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr b/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr index 8d627fc2a8d7..58d0862be6d2 100644 --- a/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr +++ b/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr @@ -1,8 +1,13 @@ error[E0004]: non-exhaustive patterns: `Foo(_, _)` not covered --> $DIR/tuple-struct-nonexhaustive.rs:5:11 | +LL | struct Foo(isize, isize); + | ------------------------- `Foo` defined here +... LL | match x { //~ ERROR non-exhaustive | ^ pattern `Foo(_, _)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr index 63819bf949bd..2424252af2ad 100644 --- a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr +++ b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr @@ -1,8 +1,16 @@ error[E0005]: refutable pattern in local binding: `A(_)` not covered --> $DIR/uninhabited-irrefutable.rs:27:9 | -LL | let Foo::D(_y) = x; //~ ERROR refutable pattern in local binding: `A(_)` not covered - | ^^^^^^^^^^ pattern `A(_)` not covered +LL | / enum Foo { +LL | | A(foo::SecretlyEmpty), +LL | | B(foo::NotSoSecretlyEmpty), +LL | | C(NotSoSecretlyEmpty), +LL | | D(u32), +LL | | } + | |_- `Foo` defined here +... +LL | let Foo::D(_y) = x; //~ ERROR refutable pattern in local binding: `A(_)` not covered + | ^^^^^^^^^^ pattern `A(_)` not covered error: aborting due to previous error diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr index b88dcc9aea43..fec95ca14943 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `Err(_)` not covered | LL | let _ = match x { //~ ERROR non-exhaustive | ^ pattern `Err(_)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: type `&Void` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:10:19 @@ -10,11 +12,7 @@ error[E0004]: non-exhaustive patterns: type `&Void` is non-empty LL | let _ = match x {}; //~ ERROR non-exhaustive | ^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/uninhabited-matches-feature-gated.rs:10:19 - | -LL | let _ = match x {}; //~ ERROR non-exhaustive - | ^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: type `(Void,)` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:13:19 @@ -22,11 +20,7 @@ error[E0004]: non-exhaustive patterns: type `(Void,)` is non-empty LL | let _ = match x {}; //~ ERROR non-exhaustive | ^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/uninhabited-matches-feature-gated.rs:13:19 - | -LL | let _ = match x {}; //~ ERROR non-exhaustive - | ^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: type `[Void; 1]` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:16:19 @@ -34,23 +28,23 @@ error[E0004]: non-exhaustive patterns: type `[Void; 1]` is non-empty LL | let _ = match x {}; //~ ERROR non-exhaustive | ^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/uninhabited-matches-feature-gated.rs:16:19 - | -LL | let _ = match x {}; //~ ERROR non-exhaustive - | ^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[_]` not covered --> $DIR/uninhabited-matches-feature-gated.rs:19:19 | LL | let _ = match x { //~ ERROR non-exhaustive | ^ pattern `&[_]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Err(_)` not covered --> $DIR/uninhabited-matches-feature-gated.rs:27:19 | LL | let _ = match x { //~ ERROR non-exhaustive | ^ pattern `Err(_)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0005]: refutable pattern in local binding: `Err(_)` not covered --> $DIR/uninhabited-matches-feature-gated.rs:32:9 From 509bb0acba1de4ca9b766efd432a824b798ce6af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 11 Feb 2019 11:22:46 -0800 Subject: [PATCH 179/381] Use anonymous explicit lifetimes --- src/librustc_mir/hair/pattern/check_match.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 96709e2ac045..c92f3d4e51bf 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -484,7 +484,7 @@ fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>( err.span_label(sp, format!("`{}` defined here", scrut_ty)); } } - let patterns = witnesses.iter().map(|p| (**p).clone()).collect::>(); + let patterns = witnesses.iter().map(|p| (**p).clone()).collect::>>(); if patterns.len() < 4 { for sp in maybe_point_at_variant(cx, &scrut_ty.sty, patterns.as_slice()) { err.span_label(sp, "not covered"); @@ -504,13 +504,13 @@ fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>( fn maybe_point_at_variant( cx: &mut MatchCheckCtxt<'a, 'tcx>, sty: &TyKind<'tcx>, - patterns: &[Pattern], + patterns: &[Pattern<'_>], ) -> Vec { let mut covered = vec![]; if let ty::Adt(def, _) = sty { // Don't point at the variants if they are too many to avoid visual clutter for pattern in patterns { - let pk: &PatternKind = &pattern.kind; + let pk: &PatternKind<'_> = &pattern.kind; if let PatternKind::Variant { adt_def, variant_index, subpatterns, .. } = pk { if adt_def.did == def.did { let sp = def.variants[*variant_index].ident.span; From d651281a71b7d31947e33383dcb2a5647827e0fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 2 Mar 2019 16:44:00 -0800 Subject: [PATCH 180/381] Reword error message --- src/librustc_mir/hair/pattern/check_match.rs | 26 ++++++++++++++------ src/test/ui/error-codes/E0004-2.stderr | 2 +- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index c92f3d4e51bf..f56d28d6f864 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -217,7 +217,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { if def.variants.len() < 4 && !def.variants.is_empty() { // keep around to point at the definition of non-covered variants missing_variants = def.variants.iter() - .map(|variant| variant.ident.span) + .map(|variant| variant.ident) .collect(); } def.variants.is_empty() @@ -227,10 +227,19 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { }; if !scrutinee_is_uninhabited { // We know the type is inhabited, so this must be wrong - let mut err = create_e0004(self.tcx.sess, scrut.span, format!( - "non-exhaustive patterns: type `{}` is non-empty", - pat_ty, - )); + let mut err = create_e0004( + self.tcx.sess, + scrut.span, + format!("non-exhaustive patterns: {}", match missing_variants.len() { + 0 => format!("type `{}` is non-empty", pat_ty), + 1 => format!( + "pattern `{}` of type `{}` is not handled", + missing_variants[0].name, + pat_ty, + ), + _ => format!("multiple patterns of type `{}` are not handled", pat_ty), + }), + ); err.help("ensure that all possible cases are being handled, \ possibly by adding wildcards or more match arms"); if let Some(sp) = def_span { @@ -238,7 +247,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { } // point at the definition of non-covered enum variants for variant in &missing_variants { - err.span_label(*variant, "variant not covered"); + err.span_label(variant.span, "variant not covered"); } err.emit(); } @@ -508,7 +517,8 @@ fn maybe_point_at_variant( ) -> Vec { let mut covered = vec![]; if let ty::Adt(def, _) = sty { - // Don't point at the variants if they are too many to avoid visual clutter + // Don't point at variants that have already been covered due to other patterns to avoid + // visual clutter for pattern in patterns { let pk: &PatternKind<'_> = &pattern.kind; if let PatternKind::Variant { adt_def, variant_index, subpatterns, .. } = pk { @@ -526,7 +536,7 @@ fn maybe_point_at_variant( ); } } - if let PatternKind::Leaf{ subpatterns } = pk { + if let PatternKind::Leaf { subpatterns } = pk { let subpatterns = subpatterns.iter() .map(|field_pattern| field_pattern.pattern.clone()) .collect::>(); diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr index 94e38cf26aa4..c8732852a71e 100644 --- a/src/test/ui/error-codes/E0004-2.stderr +++ b/src/test/ui/error-codes/E0004-2.stderr @@ -1,4 +1,4 @@ -error[E0004]: non-exhaustive patterns: type `std::option::Option` is non-empty +error[E0004]: non-exhaustive patterns: multiple patterns of type `std::option::Option` are not handled --> $DIR/E0004-2.rs:4:11 | LL | match x { } //~ ERROR E0004 From 379cd29d1c9ce06aa48fdd49208cfd7ffd3e5c07 Mon Sep 17 00:00:00 2001 From: Alexander Regueiro Date: Sat, 2 Mar 2019 15:16:36 +0000 Subject: [PATCH 181/381] Nit --- src/test/pretty/fn-variadic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/pretty/fn-variadic.rs b/src/test/pretty/fn-variadic.rs index d3b193a3e181..d499be424603 100644 --- a/src/test/pretty/fn-variadic.rs +++ b/src/test/pretty/fn-variadic.rs @@ -1,6 +1,6 @@ // Check that `fn foo(x: i32, ...)` does not print as `fn foo(x: i32, ..., ...)`. // See issue #58853. -// + // pp-exact #![feature(c_variadic)] From 04679431a249570bb2ca6d5813ebb37db76cc9db Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sat, 2 Mar 2019 22:27:26 -0700 Subject: [PATCH 182/381] Call clang and llvm-objdump with correct library path --- .../run-make-fulldeps/cross-lang-lto-clang/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/run-make-fulldeps/cross-lang-lto-clang/Makefile b/src/test/run-make-fulldeps/cross-lang-lto-clang/Makefile index b3c5fb2d7964..3f74a17e0bb9 100644 --- a/src/test/run-make-fulldeps/cross-lang-lto-clang/Makefile +++ b/src/test/run-make-fulldeps/cross-lang-lto-clang/Makefile @@ -9,17 +9,17 @@ all: cpp-executable rust-executable cpp-executable: $(RUSTC) -Clinker-plugin-lto=on -o $(TMPDIR)/librustlib-xlto.a -Copt-level=2 -Ccodegen-units=1 ./rustlib.rs - $(CLANG) -flto=thin -fuse-ld=lld -L $(TMPDIR) -lrustlib-xlto -o $(TMPDIR)/cmain ./cmain.c -O3 + $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) $(CLANG) -flto=thin -fuse-ld=lld -L $(TMPDIR) -lrustlib-xlto -o $(TMPDIR)/cmain ./cmain.c -O3 # Make sure we don't find a call instruction to the function we expect to # always be inlined. - llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -v -e "call.*rust_always_inlined" + $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -v -e "call.*rust_always_inlined" # As a sanity check, make sure we do find a call instruction to a # non-inlined function - llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -e "call.*rust_never_inlined" + $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -e "call.*rust_never_inlined" rust-executable: - $(CLANG) ./clib.c -flto=thin -c -o $(TMPDIR)/clib.o -O2 + $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) $(CLANG) ./clib.c -flto=thin -c -o $(TMPDIR)/clib.o -O2 (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) $(RUSTC) -Clinker-plugin-lto=on -L$(TMPDIR) -Copt-level=2 -Clinker=$(CLANG) -Clink-arg=-fuse-ld=lld ./main.rs -o $(TMPDIR)/rsmain - llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -e "call.*c_never_inlined" - llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -v -e "call.*c_always_inlined" + $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -e "call.*c_never_inlined" + $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -v -e "call.*c_always_inlined" From 020539e230ade3860cf413f4501b83d34bfa35ce Mon Sep 17 00:00:00 2001 From: Alexandra V Date: Sun, 3 Mar 2019 13:25:55 +0100 Subject: [PATCH 183/381] Remove stray ` in the documentation for the FromIterator implementation for Option --- src/libcore/option.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 60aed7ce09d7..46dfe28da622 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -1286,7 +1286,7 @@ impl> FromIterator> for Option { /// # Examples /// /// Here is an example which increments every integer in a vector. - /// `We use the checked variant of `add` that returns `None` when the + /// We use the checked variant of `add` that returns `None` when the /// calculation would result in an overflow. /// /// ``` From 25b8c614f020c7298eb70198b781d591d81bed7d Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Sun, 10 Feb 2019 17:23:00 -0500 Subject: [PATCH 184/381] Wrap the self-profiler in an `Arc>` This will allow us to send it across threads and measure things like LLVM time. --- Cargo.lock | 1 + src/librustc/session/mod.rs | 46 ++++++++++++-------------- src/librustc_codegen_ssa/Cargo.toml | 1 + src/librustc_codegen_ssa/back/write.rs | 24 ++++++++++++++ src/librustc_codegen_ssa/lib.rs | 3 ++ src/librustc_driver/driver.rs | 8 ----- src/librustc_driver/lib.rs | 9 +++++ 7 files changed, 60 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2e5dce66a33c..9154cb4d5b8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2625,6 +2625,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", "rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_allocator 0.0.0", diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 3cff5ec23095..d873a72ed4d7 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -44,7 +44,9 @@ use std::fmt; use std::io::Write; use std::path::PathBuf; use std::time::Duration; -use std::sync::mpsc; +use std::sync::{Arc, mpsc}; + +use parking_lot::Mutex as PlMutex; mod code_stats; pub mod config; @@ -127,11 +129,8 @@ pub struct Session { /// Used by `-Z profile-queries` in `util::common`. pub profile_channel: Lock>>, - /// Used by `-Z self-profile`. - pub self_profiling_active: bool, - - /// Used by `-Z self-profile`. - pub self_profiling: Lock, + /// Used by -Z self-profile + pub self_profiling: Option>>, /// Some measurements that are being gathered during compilation. pub perf_stats: PerfStats, @@ -834,27 +833,23 @@ impl Session { #[inline(never)] #[cold] fn profiler_active ()>(&self, f: F) { - let mut profiler = self.self_profiling.borrow_mut(); - f(&mut profiler); + match &self.self_profiling { + None => bug!("profiler_active() called but there was no profiler active"), + Some(profiler) => { + let mut p = profiler.lock(); + + f(&mut p); + } + } } #[inline(always)] pub fn profiler ()>(&self, f: F) { - if unlikely!(self.self_profiling_active) { + if unlikely!(self.self_profiling.is_some()) { self.profiler_active(f) } } - pub fn print_profiler_results(&self) { - let mut profiler = self.self_profiling.borrow_mut(); - profiler.print_results(&self.opts); - } - - pub fn save_json_results(&self) { - let profiler = self.self_profiling.borrow(); - profiler.save_results(&self.opts); - } - pub fn print_perf_stats(&self) { println!( "Total time spent computing symbol hashes: {}", @@ -1136,6 +1131,13 @@ pub fn build_session_( source_map: Lrc, driver_lint_caps: FxHashMap, ) -> Session { + let self_profiling_active = sopts.debugging_opts.self_profile || + sopts.debugging_opts.profile_json; + + let self_profiler = + if self_profiling_active { Some(Arc::new(PlMutex::new(SelfProfiler::new()))) } + else { None }; + let host_triple = TargetTriple::from_triple(config::host_triple()); let host = Target::search(&host_triple).unwrap_or_else(|e| span_diagnostic @@ -1185,9 +1187,6 @@ pub fn build_session_( CguReuseTracker::new_disabled() }; - let self_profiling_active = sopts.debugging_opts.self_profile || - sopts.debugging_opts.profile_json; - let sess = Session { target: target_cfg, host, @@ -1216,8 +1215,7 @@ pub fn build_session_( imported_macro_spans: OneThread::new(RefCell::new(FxHashMap::default())), incr_comp_session: OneThread::new(RefCell::new(IncrCompSession::NotInitialized)), cgu_reuse_tracker, - self_profiling_active, - self_profiling: Lock::new(SelfProfiler::new()), + self_profiling: self_profiler, profile_channel: Lock::new(None), perf_stats: PerfStats { symbol_hash_time: Lock::new(Duration::from_secs(0)), diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml index 0aba43580f1f..4702e34aa19e 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -19,6 +19,7 @@ memmap = "0.6" log = "0.4.5" libc = "0.2.44" jobserver = "0.1.11" +parking_lot = "0.7" serialize = { path = "../libserialize" } syntax = { path = "../libsyntax" } diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 908ee95efcba..4bccc2a6d1f7 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -19,6 +19,7 @@ use rustc::util::time_graph::{self, TimeGraph, Timeline}; use rustc::hir::def_id::{CrateNum, LOCAL_CRATE}; use rustc::ty::TyCtxt; use rustc::util::common::{time_depth, set_time_depth, print_time_passes_entry}; +use rustc::util::profiling::SelfProfiler; use rustc_fs_util::link_or_copy; use rustc_data_structures::svh::Svh; use rustc_errors::{Handler, Level, DiagnosticBuilder, FatalError, DiagnosticId}; @@ -29,6 +30,7 @@ use syntax::ext::hygiene::Mark; use syntax_pos::MultiSpan; use syntax_pos::symbol::Symbol; use jobserver::{Client, Acquired}; +use parking_lot::Mutex as PlMutex; use std::any::Any; use std::fs; @@ -201,6 +203,7 @@ pub struct CodegenContext { // Resources needed when running LTO pub backend: B, pub time_passes: bool, + pub profiler: Option>>, pub lto: Lto, pub no_landing_pads: bool, pub save_temps: bool, @@ -254,6 +257,26 @@ impl CodegenContext { ModuleKind::Allocator => &self.allocator_module_config, } } + + #[inline(never)] + #[cold] + fn profiler_active ()>(&self, f: F) { + match &self.profiler { + None => bug!("profiler_active() called but there was no profiler active"), + Some(profiler) => { + let mut p = profiler.lock(); + + f(&mut p); + } + } + } + + #[inline(always)] + pub fn profile ()>(&self, f: F) { + if unlikely!(self.profiler.is_some()) { + self.profiler_active(f) + } + } } fn generate_lto_work( @@ -1033,6 +1056,7 @@ fn start_executing_work( save_temps: sess.opts.cg.save_temps, opts: Arc::new(sess.opts.clone()), time_passes: sess.time_passes(), + profiler: sess.self_profiling.clone(), exported_symbols, plugin_passes: sess.plugin_llvm_passes.borrow().clone(), remark: sess.opts.cg.remark.clone(), diff --git a/src/librustc_codegen_ssa/lib.rs b/src/librustc_codegen_ssa/lib.rs index f38b22aa0417..fec41936a238 100644 --- a/src/librustc_codegen_ssa/lib.rs +++ b/src/librustc_codegen_ssa/lib.rs @@ -2,9 +2,11 @@ #![feature(box_patterns)] #![feature(box_syntax)] +#![feature(core_intrinsics)] #![feature(custom_attribute)] #![feature(libc)] #![feature(rustc_diagnostic_macros)] +#![feature(stmt_expr_attributes)] #![feature(in_band_lifetimes)] #![feature(nll)] #![allow(unused_attributes)] @@ -20,6 +22,7 @@ #[macro_use] extern crate log; #[macro_use] extern crate rustc; +#[macro_use] extern crate rustc_data_structures; #[macro_use] extern crate syntax; use std::path::PathBuf; diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 858a5602e7b7..d3e295607c2b 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -349,14 +349,6 @@ pub fn compile_input( sess.print_perf_stats(); } - if sess.opts.debugging_opts.self_profile { - sess.print_profiler_results(); - } - - if sess.opts.debugging_opts.profile_json { - sess.save_json_results(); - } - controller_entry_point!( compilation_done, sess, diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 52dbb618d0d1..9546498cf939 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -276,6 +276,15 @@ fn run_compiler_with_pool<'a>( &control) }; + + if sess.opts.debugging_opts.self_profile { + sess.profiler(|p| p.print_results(&sess.opts)); + } + + if sess.opts.debugging_opts.profile_json { + sess.profiler(|p| p.save_results(&sess.opts)); + } + (result, Some(sess)) } From fccc84199cdf12de8ae89b7bea5276beb6a67c29 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Mon, 11 Feb 2019 18:11:43 -0500 Subject: [PATCH 185/381] Remove profiler output and replace with a raw event dump Related to #58372 --- src/librustc/session/config.rs | 4 +- src/librustc/session/mod.rs | 5 +- src/librustc/util/profiling.rs | 578 +++++++++++++++------------------ src/librustc_driver/lib.rs | 7 +- 4 files changed, 268 insertions(+), 326 deletions(-) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 99eee4b559a5..774ab0333db5 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1405,9 +1405,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, crate_attr: Vec = (Vec::new(), parse_string_push, [TRACKED], "inject the given attribute in the crate"), self_profile: bool = (false, parse_bool, [UNTRACKED], - "run the self profiler"), - profile_json: bool = (false, parse_bool, [UNTRACKED], - "output a json file with profiler results"), + "run the self profiler and output the raw event data"), emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED], "emits a section containing stack size metadata"), plt: Option = (None, parse_opt_bool, [TRACKED], diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index d873a72ed4d7..774bc8b450b5 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -1131,11 +1131,8 @@ pub fn build_session_( source_map: Lrc, driver_lint_caps: FxHashMap, ) -> Session { - let self_profiling_active = sopts.debugging_opts.self_profile || - sopts.debugging_opts.profile_json; - let self_profiler = - if self_profiling_active { Some(Arc::new(PlMutex::new(SelfProfiler::new()))) } + if sopts.debugging_opts.self_profile { Some(Arc::new(PlMutex::new(SelfProfiler::new()))) } else { None }; let host_triple = TargetTriple::from_triple(config::host_triple()); diff --git a/src/librustc/util/profiling.rs b/src/librustc/util/profiling.rs index c90bd12a3100..bd40566065b6 100644 --- a/src/librustc/util/profiling.rs +++ b/src/librustc/util/profiling.rs @@ -1,10 +1,12 @@ -use std::collections::{BTreeMap, HashMap}; +use std::collections::HashMap; use std::fs; -use std::io::{self, Write}; +use std::io::{BufWriter, Write}; +use std::mem; +use std::process; use std::thread::ThreadId; use std::time::Instant; -use crate::session::config::{Options, OptLevel}; +use crate::session::config::Options; #[derive(Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd)] pub enum ProfileCategory { @@ -23,142 +25,41 @@ pub enum ProfilerEvent { QueryEnd { query_name: &'static str, category: ProfileCategory, time: Instant }, GenericActivityStart { category: ProfileCategory, time: Instant }, GenericActivityEnd { category: ProfileCategory, time: Instant }, - QueryCacheHit { query_name: &'static str, category: ProfileCategory }, - QueryCount { query_name: &'static str, category: ProfileCategory, count: usize }, IncrementalLoadResultStart { query_name: &'static str, time: Instant }, IncrementalLoadResultEnd { query_name: &'static str, time: Instant }, + QueryCacheHit { query_name: &'static str, category: ProfileCategory, time: Instant }, + QueryCount { query_name: &'static str, category: ProfileCategory, count: usize, time: Instant }, QueryBlockedStart { query_name: &'static str, category: ProfileCategory, time: Instant }, QueryBlockedEnd { query_name: &'static str, category: ProfileCategory, time: Instant }, } impl ProfilerEvent { - fn is_start_event(&self) -> bool { + fn timestamp(&self) -> Instant { use self::ProfilerEvent::*; match self { - QueryStart { .. } | - GenericActivityStart { .. } | - IncrementalLoadResultStart { .. } | - QueryBlockedStart { .. } => true, - - QueryEnd { .. } | - GenericActivityEnd { .. } | - QueryCacheHit { .. } | - QueryCount { .. } | - IncrementalLoadResultEnd { .. } | - QueryBlockedEnd { .. } => false, + QueryStart { time, .. } | + QueryEnd { time, .. } | + GenericActivityStart { time, .. } | + GenericActivityEnd { time, .. } | + QueryCacheHit { time, .. } | + QueryCount { time, .. } | + IncrementalLoadResultStart { time, .. } | + IncrementalLoadResultEnd { time, .. } | + QueryBlockedStart { time, .. } | + QueryBlockedEnd { time, .. } => *time } } } +fn thread_id_to_u64(tid: ThreadId) -> u64 { + unsafe { mem::transmute::(tid) } +} + pub struct SelfProfiler { events: HashMap>, } -struct CategoryResultData { - query_times: BTreeMap<&'static str, u64>, - query_cache_stats: BTreeMap<&'static str, (u64, u64)>, //(hits, total) -} - -impl CategoryResultData { - fn new() -> CategoryResultData { - CategoryResultData { - query_times: BTreeMap::new(), - query_cache_stats: BTreeMap::new(), - } - } - - fn total_time(&self) -> u64 { - self.query_times.iter().map(|(_, time)| time).sum() - } - - fn total_cache_data(&self) -> (u64, u64) { - let (mut hits, mut total) = (0, 0); - - for (_, (h, t)) in &self.query_cache_stats { - hits += h; - total += t; - } - - (hits, total) - } -} - -impl Default for CategoryResultData { - fn default() -> CategoryResultData { - CategoryResultData::new() - } -} - -struct CalculatedResults { - categories: BTreeMap, - crate_name: Option, - optimization_level: OptLevel, - incremental: bool, - verbose: bool, -} - -impl CalculatedResults { - fn new() -> CalculatedResults { - CalculatedResults { - categories: BTreeMap::new(), - crate_name: None, - optimization_level: OptLevel::No, - incremental: false, - verbose: false, - } - } - - fn consolidate(mut cr1: CalculatedResults, cr2: CalculatedResults) -> CalculatedResults { - for (category, data) in cr2.categories { - let cr1_data = cr1.categories.entry(category).or_default(); - - for (query, time) in data.query_times { - *cr1_data.query_times.entry(query).or_default() += time; - } - - for (query, (hits, total)) in data.query_cache_stats { - let (h, t) = cr1_data.query_cache_stats.entry(query).or_insert((0, 0)); - *h += hits; - *t += total; - } - } - - cr1 - } - - fn total_time(&self) -> u64 { - self.categories.iter().map(|(_, data)| data.total_time()).sum() - } - - fn with_options(mut self, opts: &Options) -> CalculatedResults { - self.crate_name = opts.crate_name.clone(); - self.optimization_level = opts.optimize; - self.incremental = opts.incremental.is_some(); - self.verbose = opts.debugging_opts.verbose; - - self - } -} - -fn time_between_ns(start: Instant, end: Instant) -> u64 { - if start < end { - let time = end - start; - (time.as_secs() * 1_000_000_000) + (time.subsec_nanos() as u64) - } else { - debug!("time_between_ns: ignorning instance of end < start"); - 0 - } -} - -fn calculate_percent(numerator: u64, denominator: u64) -> f32 { - if denominator > 0 { - ((numerator as f32) / (denominator as f32)) * 100.0 - } else { - 0.0 - } -} - impl SelfProfiler { pub fn new() -> SelfProfiler { let mut profiler = SelfProfiler { @@ -197,6 +98,7 @@ impl SelfProfiler { query_name, category, count, + time: Instant::now(), }) } @@ -205,6 +107,7 @@ impl SelfProfiler { self.record(ProfilerEvent::QueryCacheHit { query_name, category, + time: Instant::now(), }) } @@ -268,208 +171,257 @@ impl SelfProfiler { events.push(event); } - fn calculate_thread_results(events: &Vec) -> CalculatedResults { + pub fn dump_raw_events(&self, opts: &Options) { use self::ProfilerEvent::*; - assert!( - events.last().map(|e| !e.is_start_event()).unwrap_or(true), - "there was an event running when calculate_reslts() was called" - ); + //find the earliest Instant to use as t=0 + //when serializing the events, we'll calculate a Duration + //using (instant - min_instant) + let min_instant = + self.events + .iter() + .map(|(_, values)| values[0].timestamp()) + .min() + .unwrap(); - let mut results = CalculatedResults::new(); + let pid = process::id(); - //(event, child time to subtract) - let mut query_stack = Vec::new(); + let filename = + format!("{}.profile_events.json", opts.crate_name.clone().unwrap_or_default()); - for event in events { - match event { - QueryStart { .. } | GenericActivityStart { .. } => { - query_stack.push((event, 0)); - }, - QueryEnd { query_name, category, time: end_time } => { - let previous_query = query_stack.pop(); - if let Some((QueryStart { - query_name: p_query_name, - time: start_time, - category: _ }, child_time_to_subtract)) = previous_query { - assert_eq!( - p_query_name, + let mut file = BufWriter::new(fs::File::create(filename).unwrap()); + + let threads: Vec<_> = + self.events + .keys() + .into_iter() + .map(|tid| format!("{}", thread_id_to_u64(*tid))) + .collect(); + + write!(file, + "{{\ + \"processes\": {{\ + \"{}\": {{\ + \"threads\": [{}],\ + \"crate_name\": \"{}\",\ + \"opt_level\": \"{:?}\",\ + \"incremental\": {}\ + }}\ + }},\ + \"events\": [\ + ", + pid, + threads.join(","), + opts.crate_name.clone().unwrap_or_default(), + opts.optimize, + if opts.incremental.is_some() { "true" } else { "false" }, + ).unwrap(); + + let mut is_first = true; + for (thread_id, events) in &self.events { + let thread_id = thread_id_to_u64(*thread_id); + + for event in events { + if is_first { + is_first = false; + } else { + writeln!(file, ",").unwrap(); + } + + let (secs, nanos) = { + let duration = event.timestamp() - min_instant; + (duration.as_secs(), duration.subsec_nanos()) + }; + + match event { + QueryStart { query_name, category, time: _ } => + write!(file, + "{{ \ + \"QueryStart\": {{ \ + \"query_name\": \"{}\",\ + \"category\": \"{:?}\",\ + \"time\": {{\ + \"secs\": {},\ + \"nanos\": {}\ + }},\ + \"thread_id\": {}\ + }}\ + }}", query_name, - "Saw a query end but the previous query wasn't the corresponding start" - ); - - let time_ns = time_between_ns(*start_time, *end_time); - let self_time_ns = time_ns - child_time_to_subtract; - let result_data = results.categories.entry(*category).or_default(); - - *result_data.query_times.entry(query_name).or_default() += self_time_ns; - - if let Some((_, child_time_to_subtract)) = query_stack.last_mut() { - *child_time_to_subtract += time_ns; - } - } else { - bug!("Saw a query end but the previous event wasn't a query start"); - } - } - GenericActivityEnd { category, time: end_time } => { - let previous_event = query_stack.pop(); - if let Some((GenericActivityStart { - category: previous_category, - time: start_time }, child_time_to_subtract)) = previous_event { - assert_eq!( - previous_category, category, - "Saw an end but the previous event wasn't the corresponding start" - ); - - let time_ns = time_between_ns(*start_time, *end_time); - let self_time_ns = time_ns - child_time_to_subtract; - let result_data = results.categories.entry(*category).or_default(); - - *result_data.query_times - .entry("{time spent not running queries}") - .or_default() += self_time_ns; - - if let Some((_, child_time_to_subtract)) = query_stack.last_mut() { - *child_time_to_subtract += time_ns; - } - } else { - bug!("Saw an activity end but the previous event wasn't an activity start"); - } - }, - QueryCacheHit { category, query_name } => { - let result_data = results.categories.entry(*category).or_default(); - - let (hits, total) = - result_data.query_cache_stats.entry(query_name).or_insert((0, 0)); - *hits += 1; - *total += 1; - }, - QueryCount { category, query_name, count } => { - let result_data = results.categories.entry(*category).or_default(); - - let (_, totals) = - result_data.query_cache_stats.entry(query_name).or_insert((0, 0)); - *totals += *count as u64; - }, - //we don't summarize incremental load result events in the simple output mode - IncrementalLoadResultStart { .. } | IncrementalLoadResultEnd { .. } => { }, - //we don't summarize parallel query blocking in the simple output mode - QueryBlockedStart { .. } | QueryBlockedEnd { .. } => { }, - } - } - - //normalize the times to ms - for (_, data) in &mut results.categories { - for (_, time) in &mut data.query_times { - *time = *time / 1_000_000; - } - } - - results - } - - fn get_results(&self, opts: &Options) -> CalculatedResults { - self.events - .iter() - .map(|(_, r)| SelfProfiler::calculate_thread_results(r)) - .fold(CalculatedResults::new(), CalculatedResults::consolidate) - .with_options(opts) - } - - pub fn print_results(&mut self, opts: &Options) { - self.end_activity(ProfileCategory::Other); - - let results = self.get_results(opts); - - let total_time = results.total_time() as f32; - - let out = io::stderr(); - let mut lock = out.lock(); - - let crate_name = results.crate_name.map(|n| format!(" for {}", n)).unwrap_or_default(); - - writeln!(lock, "Self profiling results{}:", crate_name).unwrap(); - writeln!(lock).unwrap(); - - writeln!(lock, "| Phase | Time (ms) \ - | Time (%) | Queries | Hits (%)") - .unwrap(); - writeln!(lock, "| ----------------------------------------- | -------------- \ - | -------- | -------------- | --------") - .unwrap(); - - let mut categories: Vec<_> = results.categories.iter().collect(); - categories.sort_by_cached_key(|(_, d)| d.total_time()); - - for (category, data) in categories.iter().rev() { - let (category_hits, category_total) = data.total_cache_data(); - let category_hit_percent = calculate_percent(category_hits, category_total); - - writeln!( - lock, - "| {0: <41} | {1: >14} | {2: >8.2} | {3: >14} | {4: >8}", - format!("{:?}", category), - data.total_time(), - ((data.total_time() as f32) / total_time) * 100.0, - category_total, - format!("{:.2}", category_hit_percent), - ).unwrap(); - - //in verbose mode, show individual query data - if results.verbose { - //don't show queries that took less than 1ms - let mut times: Vec<_> = data.query_times.iter().filter(|(_, t)| **t > 0).collect(); - times.sort_by(|(_, time1), (_, time2)| time2.cmp(time1)); - - for (query, time) in times { - let (hits, total) = data.query_cache_stats.get(query).unwrap_or(&(0, 0)); - let hit_percent = calculate_percent(*hits, *total); - - writeln!( - lock, - "| - {0: <39} | {1: >14} | {2: >8.2} | {3: >14} | {4: >8}", - query, - time, - ((*time as f32) / total_time) * 100.0, - total, - format!("{:.2}", hit_percent), - ).unwrap(); + secs, + nanos, + thread_id, + ).unwrap(), + QueryEnd { query_name, category, time: _ } => + write!(file, + "{{\ + \"QueryEnd\": {{\ + \"query_name\": \"{}\",\ + \"category\": \"{:?}\",\ + \"time\": {{\ + \"secs\": {},\ + \"nanos\": {}\ + }},\ + \"thread_id\": {}\ + }}\ + }}", + query_name, + category, + secs, + nanos, + thread_id, + ).unwrap(), + GenericActivityStart { category, time: _ } => + write!(file, + "{{ + \"GenericActivityStart\": {{\ + \"category\": \"{:?}\",\ + \"time\": {{\ + \"secs\": {},\ + \"nanos\": {}\ + }},\ + \"thread_id\": {}\ + }}\ + }}", + category, + secs, + nanos, + thread_id, + ).unwrap(), + GenericActivityEnd { category, time: _ } => + write!(file, + "{{\ + \"GenericActivityEnd\": {{\ + \"category\": \"{:?}\",\ + \"time\": {{\ + \"secs\": {},\ + \"nanos\": {}\ + }},\ + \"thread_id\": {}\ + }}\ + }}", + category, + secs, + nanos, + thread_id, + ).unwrap(), + QueryCacheHit { query_name, category, time: _ } => + write!(file, + "{{\ + \"QueryCacheHit\": {{\ + \"query_name\": \"{}\",\ + \"category\": \"{:?}\",\ + \"time\": {{\ + \"secs\": {},\ + \"nanos\": {}\ + }},\ + \"thread_id\": {}\ + }}\ + }}", + query_name, + category, + secs, + nanos, + thread_id, + ).unwrap(), + QueryCount { query_name, category, count, time: _ } => + write!(file, + "{{\ + \"QueryCount\": {{\ + \"query_name\": \"{}\",\ + \"category\": \"{:?}\",\ + \"count\": {},\ + \"time\": {{\ + \"secs\": {},\ + \"nanos\": {}\ + }},\ + \"thread_id\": {}\ + }}\ + }}", + query_name, + category, + count, + secs, + nanos, + thread_id, + ).unwrap(), + IncrementalLoadResultStart { query_name, time: _ } => + write!(file, + "{{\ + \"IncrementalLoadResultStart\": {{\ + \"query_name\": \"{}\",\ + \"time\": {{\ + \"secs\": {},\ + \"nanos\": {}\ + }},\ + \"thread_id\": {}\ + }}\ + }}", + query_name, + secs, + nanos, + thread_id, + ).unwrap(), + IncrementalLoadResultEnd { query_name, time: _ } => + write!(file, + "{{\ + \"IncrementalLoadResultEnd\": {{\ + \"query_name\": \"{}\",\ + \"time\": {{\ + \"secs\": {},\ + \"nanos\": {}\ + }},\ + \"thread_id\": {}\ + }}\ + }}", + query_name, + secs, + nanos, + thread_id, + ).unwrap(), + QueryBlockedStart { query_name, category, time: _ } => + write!(file, + "{{\ + \"QueryBlockedStart\": {{\ + \"query_name\": \"{}\",\ + \"category\": \"{:?}\",\ + \"time\": {{\ + \"secs\": {},\ + \"nanos\": {}\ + }},\ + \"thread_id\": {}\ + }}\ + }}", + query_name, + category, + secs, + nanos, + thread_id, + ).unwrap(), + QueryBlockedEnd { query_name, category, time: _ } => + write!(file, + "{{\ + \"QueryBlockedEnd\": {{\ + \"query_name\": \"{}\",\ + \"category\": \"{:?}\",\ + \"time\": {{\ + \"secs\": {},\ + \"nanos\": {}\ + }},\ + \"thread_id\": {}\ + }}\ + }}", + query_name, + category, + secs, + nanos, + thread_id, + ).unwrap() } } } - writeln!(lock).unwrap(); - writeln!(lock, "Optimization level: {:?}", opts.optimize).unwrap(); - writeln!(lock, "Incremental: {}", if results.incremental { "on" } else { "off" }).unwrap(); - } - - pub fn save_results(&self, opts: &Options) { - let results = self.get_results(opts); - - let compilation_options = - format!("{{ \"optimization_level\": \"{:?}\", \"incremental\": {} }}", - results.optimization_level, - if results.incremental { "true" } else { "false" }); - - let mut category_data = String::new(); - - for (category, data) in &results.categories { - let (hits, total) = data.total_cache_data(); - let hit_percent = calculate_percent(hits, total); - - category_data.push_str(&format!("{{ \"category\": \"{:?}\", \"time_ms\": {}, \ - \"query_count\": {}, \"query_hits\": {} }}", - category, - data.total_time(), - total, - format!("{:.2}", hit_percent))); - } - - let json = format!("{{ \"category_data\": {}, \"compilation_options\": {} }}", - category_data, - compilation_options); - - fs::write("self_profiler_results.json", json).unwrap(); + write!(file, "] }}").unwrap(); } } diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 9546498cf939..cc1b8916c107 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -276,13 +276,8 @@ fn run_compiler_with_pool<'a>( &control) }; - if sess.opts.debugging_opts.self_profile { - sess.profiler(|p| p.print_results(&sess.opts)); - } - - if sess.opts.debugging_opts.profile_json { - sess.profiler(|p| p.save_results(&sess.opts)); + sess.profiler(|p| p.dump_raw_events(&sess.opts)); } (result, Some(sess)) From 9d26789495901fa6b43ec3300fd664a150be0b3a Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Wed, 13 Feb 2019 05:33:51 -0500 Subject: [PATCH 186/381] Reduce the size of events by using a u64 instead of Instant Part of #58372 --- src/librustc/util/profiling.rs | 74 +++++++++++++++++----------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/src/librustc/util/profiling.rs b/src/librustc/util/profiling.rs index bd40566065b6..c052f00cd18e 100644 --- a/src/librustc/util/profiling.rs +++ b/src/librustc/util/profiling.rs @@ -4,7 +4,7 @@ use std::io::{BufWriter, Write}; use std::mem; use std::process; use std::thread::ThreadId; -use std::time::Instant; +use std::time::{Duration, Instant, SystemTime}; use crate::session::config::Options; @@ -21,20 +21,20 @@ pub enum ProfileCategory { #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum ProfilerEvent { - QueryStart { query_name: &'static str, category: ProfileCategory, time: Instant }, - QueryEnd { query_name: &'static str, category: ProfileCategory, time: Instant }, - GenericActivityStart { category: ProfileCategory, time: Instant }, - GenericActivityEnd { category: ProfileCategory, time: Instant }, - IncrementalLoadResultStart { query_name: &'static str, time: Instant }, - IncrementalLoadResultEnd { query_name: &'static str, time: Instant }, - QueryCacheHit { query_name: &'static str, category: ProfileCategory, time: Instant }, - QueryCount { query_name: &'static str, category: ProfileCategory, count: usize, time: Instant }, - QueryBlockedStart { query_name: &'static str, category: ProfileCategory, time: Instant }, - QueryBlockedEnd { query_name: &'static str, category: ProfileCategory, time: Instant }, + QueryStart { query_name: &'static str, category: ProfileCategory, time: u64 }, + QueryEnd { query_name: &'static str, category: ProfileCategory, time: u64 }, + GenericActivityStart { category: ProfileCategory, time: u64 }, + GenericActivityEnd { category: ProfileCategory, time: u64 }, + IncrementalLoadResultStart { query_name: &'static str, time: u64 }, + IncrementalLoadResultEnd { query_name: &'static str, time: u64 }, + QueryCacheHit { query_name: &'static str, category: ProfileCategory, time: u64 }, + QueryCount { query_name: &'static str, category: ProfileCategory, count: usize, time: u64 }, + QueryBlockedStart { query_name: &'static str, category: ProfileCategory, time: u64 }, + QueryBlockedEnd { query_name: &'static str, category: ProfileCategory, time: u64 }, } impl ProfilerEvent { - fn timestamp(&self) -> Instant { + fn timestamp(&self) -> u64 { use self::ProfilerEvent::*; match self { @@ -58,16 +58,18 @@ fn thread_id_to_u64(tid: ThreadId) -> u64 { pub struct SelfProfiler { events: HashMap>, + start_time: SystemTime, + start_instant: Instant, } impl SelfProfiler { pub fn new() -> SelfProfiler { - let mut profiler = SelfProfiler { + let profiler = SelfProfiler { events: HashMap::new(), + start_time: SystemTime::now(), + start_instant: Instant::now(), }; - profiler.start_activity(ProfileCategory::Other); - profiler } @@ -75,7 +77,7 @@ impl SelfProfiler { pub fn start_activity(&mut self, category: ProfileCategory) { self.record(ProfilerEvent::GenericActivityStart { category, - time: Instant::now(), + time: self.get_time_from_start(), }) } @@ -83,7 +85,7 @@ impl SelfProfiler { pub fn end_activity(&mut self, category: ProfileCategory) { self.record(ProfilerEvent::GenericActivityEnd { category, - time: Instant::now(), + time: self.get_time_from_start(), }) } @@ -98,7 +100,7 @@ impl SelfProfiler { query_name, category, count, - time: Instant::now(), + time: self.get_time_from_start(), }) } @@ -107,7 +109,7 @@ impl SelfProfiler { self.record(ProfilerEvent::QueryCacheHit { query_name, category, - time: Instant::now(), + time: self.get_time_from_start(), }) } @@ -116,7 +118,7 @@ impl SelfProfiler { self.record(ProfilerEvent::QueryStart { query_name, category, - time: Instant::now(), + time: self.get_time_from_start(), }); } @@ -125,7 +127,7 @@ impl SelfProfiler { self.record(ProfilerEvent::QueryEnd { query_name, category, - time: Instant::now(), + time: self.get_time_from_start(), }) } @@ -133,7 +135,7 @@ impl SelfProfiler { pub fn incremental_load_result_start(&mut self, query_name: &'static str) { self.record(ProfilerEvent::IncrementalLoadResultStart { query_name, - time: Instant::now(), + time: self.get_time_from_start(), }) } @@ -141,7 +143,7 @@ impl SelfProfiler { pub fn incremental_load_result_end(&mut self, query_name: &'static str) { self.record(ProfilerEvent::IncrementalLoadResultEnd { query_name, - time: Instant::now(), + time: self.get_time_from_start(), }) } @@ -150,7 +152,7 @@ impl SelfProfiler { self.record(ProfilerEvent::QueryBlockedStart { query_name, category, - time: Instant::now(), + time: self.get_time_from_start(), }) } @@ -159,7 +161,7 @@ impl SelfProfiler { self.record(ProfilerEvent::QueryBlockedEnd { query_name, category, - time: Instant::now(), + time: self.get_time_from_start(), }) } @@ -171,19 +173,15 @@ impl SelfProfiler { events.push(event); } + #[inline] + fn get_time_from_start(&self) -> u64 { + let duration = Instant::now() - self.start_instant; + duration.as_nanos() as u64 + } + pub fn dump_raw_events(&self, opts: &Options) { use self::ProfilerEvent::*; - //find the earliest Instant to use as t=0 - //when serializing the events, we'll calculate a Duration - //using (instant - min_instant) - let min_instant = - self.events - .iter() - .map(|(_, values)| values[0].timestamp()) - .min() - .unwrap(); - let pid = process::id(); let filename = @@ -229,8 +227,10 @@ impl SelfProfiler { } let (secs, nanos) = { - let duration = event.timestamp() - min_instant; - (duration.as_secs(), duration.subsec_nanos()) + let time = self.start_time + Duration::from_nanos(event.timestamp()); + let time_since_unix = + time.duration_since(SystemTime::UNIX_EPOCH).unwrap_or_default(); + (time_since_unix.as_secs(), time_since_unix.subsec_nanos()) }; match event { From f20ad7043904023e810cfaeb5d775f281a4a1619 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Mon, 25 Feb 2019 18:46:53 -0500 Subject: [PATCH 187/381] Use FxHashMap --- src/librustc/util/profiling.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/librustc/util/profiling.rs b/src/librustc/util/profiling.rs index c052f00cd18e..c134d48f987b 100644 --- a/src/librustc/util/profiling.rs +++ b/src/librustc/util/profiling.rs @@ -1,4 +1,3 @@ -use std::collections::HashMap; use std::fs; use std::io::{BufWriter, Write}; use std::mem; @@ -8,6 +7,8 @@ use std::time::{Duration, Instant, SystemTime}; use crate::session::config::Options; +use rustc_data_structures::fx::FxHashMap; + #[derive(Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd)] pub enum ProfileCategory { Parsing, @@ -57,7 +58,7 @@ fn thread_id_to_u64(tid: ThreadId) -> u64 { } pub struct SelfProfiler { - events: HashMap>, + events: FxHashMap>, start_time: SystemTime, start_instant: Instant, } @@ -65,7 +66,7 @@ pub struct SelfProfiler { impl SelfProfiler { pub fn new() -> SelfProfiler { let profiler = SelfProfiler { - events: HashMap::new(), + events: Default::default(), start_time: SystemTime::now(), start_instant: Instant::now(), }; From 2293d2260a382146fe5ea62ce91580ad7a31178d Mon Sep 17 00:00:00 2001 From: benaryorg Date: Sun, 3 Mar 2019 15:21:52 +0100 Subject: [PATCH 188/381] race condition in thread local storage example The example had a potential race condition that would still pass the test. If the thread which was supposed to modify it's own thread local was slower than the instruction to modify in the main thread, then the test would pass even in case of a failure. This is would be minor if the child thread was waited for since it check using an `assert_eq` for the same thing, but vice versa. However, if the `assert_eq` failed this would trigger a panic, which is not at all caught by the example since the thread is not waited on. Signed-off-by: benaryorg --- src/libstd/thread/local.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 3a876e05eccb..7ad6b124e3a3 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -40,13 +40,16 @@ use crate::mem; /// }); /// /// // each thread starts out with the initial value of 1 -/// thread::spawn(move|| { +/// let t = thread::spawn(move|| { /// FOO.with(|f| { /// assert_eq!(*f.borrow(), 1); /// *f.borrow_mut() = 3; /// }); /// }); /// +/// // wait for the thread to complete and bail out on panic +/// t.join().unwrap(); +/// /// // we retain our original value of 2 despite the child thread /// FOO.with(|f| { /// assert_eq!(*f.borrow(), 2); From 41e60d1562738c0295c4344339c6368e9446e936 Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Mon, 4 Mar 2019 11:23:38 +1300 Subject: [PATCH 189/381] Monomorphize generator field types for debuginfo --- src/librustc_codegen_ssa/mir/mod.rs | 1 + src/test/run-pass/generator/issue-58888.rs | 27 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/test/run-pass/generator/issue-58888.rs diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index ce342320af92..fa8a74b2715e 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -627,6 +627,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( .zip(state_tys) .enumerate() .filter_map(move |(i, (decl, ty))| { + let ty = fx.monomorphize(&ty); decl.name.map(|name| (i + upvar_count + 1, name, false, ty)) }) }).into_iter().flatten(); diff --git a/src/test/run-pass/generator/issue-58888.rs b/src/test/run-pass/generator/issue-58888.rs new file mode 100644 index 000000000000..43b37a9afc2c --- /dev/null +++ b/src/test/run-pass/generator/issue-58888.rs @@ -0,0 +1,27 @@ +// run-pass +// compile-flags: -g + +#![feature(generators, generator_trait)] + +use std::ops::Generator; + +struct Database; + +impl Database { + fn get_connection(&self) -> impl Iterator { + Some(()).into_iter() + } + + fn check_connection(&self) -> impl Generator + '_ { + move || { + let iter = self.get_connection(); + for i in iter { + yield i + } + } + } +} + +fn main() { + Database.check_connection(); +} From 60a649ef6ecf905253507997211ebd081f298f24 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 3 Mar 2019 23:43:46 +0100 Subject: [PATCH 190/381] Add .nll.stderr output --- .../ui/consts/const-ptr-nonnull.nll.stderr | 25 +++++++++++++++++++ .../ui/consts/const-ptr-unique.nll.stderr | 14 +++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/test/ui/consts/const-ptr-nonnull.nll.stderr create mode 100644 src/test/ui/consts/const-ptr-unique.nll.stderr diff --git a/src/test/ui/consts/const-ptr-nonnull.nll.stderr b/src/test/ui/consts/const-ptr-nonnull.nll.stderr new file mode 100644 index 000000000000..6977e7fdc118 --- /dev/null +++ b/src/test/ui/consts/const-ptr-nonnull.nll.stderr @@ -0,0 +1,25 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/const-ptr-nonnull.rs:4:37 + | +LL | let x: &'static NonNull = &(NonNull::dangling()); + | --------------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use + | | + | type annotation requires that borrow lasts for `'static` +... +LL | } + | - temporary value is freed at the end of this statement + +error[E0716]: temporary value dropped while borrowed + --> $DIR/const-ptr-nonnull.rs:9:37 + | +LL | let x: &'static NonNull = &(non_null.cast()); + | --------------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use + | | + | type annotation requires that borrow lasts for `'static` +LL | //~^ ERROR borrowed value does not live long enough +LL | } + | - temporary value is freed at the end of this statement + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-ptr-unique.nll.stderr b/src/test/ui/consts/const-ptr-unique.nll.stderr new file mode 100644 index 000000000000..b201994c894e --- /dev/null +++ b/src/test/ui/consts/const-ptr-unique.nll.stderr @@ -0,0 +1,14 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/const-ptr-unique.rs:8:33 + | +LL | let x: &'static *mut u32 = &(unique.as_ptr()); + | ----------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use + | | + | type annotation requires that borrow lasts for `'static` +LL | //~^ ERROR borrowed value does not live long enough +LL | } + | - temporary value is freed at the end of this statement + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0716`. From 594e2616db5fff245469d9813469556f86d2be74 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Sun, 3 Mar 2019 14:48:03 +0100 Subject: [PATCH 191/381] Update Clippy --- Cargo.lock | 14 +++++++------- src/tools/clippy | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9154cb4d5b8b..19dadaa14005 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -374,7 +374,7 @@ dependencies = [ "clippy-mini-macro-test 0.2.0", "clippy_dev 0.0.1", "clippy_lints 0.0.212", - "compiletest_rs 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "compiletest_rs 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -493,7 +493,7 @@ dependencies = [ [[package]] name = "compiletest_rs" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1591,7 +1591,7 @@ dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "compiletest_rs 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "compiletest_rs 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2077,7 +2077,7 @@ name = "rand_chacha" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2099,7 +2099,7 @@ name = "rand_hc" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2124,7 +2124,7 @@ name = "rand_xorshift" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4019,7 +4019,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007" "checksum commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2" "checksum compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6711d51cb46744dd8305293cc3fbc392aaff7a8f5095a7c4fae1e5113ef07c96" -"checksum compiletest_rs 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0d76d4322a40f6b0db7259d4f2c8a65ed8b0d84fce0bbc61b98cf47f8ec6eec3" +"checksum compiletest_rs 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "56c799b1f7142badf3b047b4c1f2074cc96b6b784fb2432f2ed9c87da0a03749" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2640d6d0bf22e82bed1b73c6aef8d5dd31e5abe6666c57e6d45e2649f4f887" "checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" diff --git a/src/tools/clippy b/src/tools/clippy index 7bc2e1d60d23..caccf8bd4c3d 160000 --- a/src/tools/clippy +++ b/src/tools/clippy @@ -1 +1 @@ -Subproject commit 7bc2e1d60d23a2f6a31d7a04d40171372d80b5b3 +Subproject commit caccf8bd4c3d490d6a4cf329a3411bbf68753642 From 939a2639742f161811b500bc45bd06a1d63e9d18 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Mon, 4 Mar 2019 16:20:46 +0900 Subject: [PATCH 192/381] Update rand version --- Cargo.lock | 2 +- src/librustc_incremental/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 19dadaa14005..0406d37b6dc2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2747,7 +2747,7 @@ version = "0.0.0" dependencies = [ "graphviz 0.0.0", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", "rustc_data_structures 0.0.0", "rustc_fs_util 0.0.0", diff --git a/src/librustc_incremental/Cargo.toml b/src/librustc_incremental/Cargo.toml index 10b448b7fec3..df971ec5bdb8 100644 --- a/src/librustc_incremental/Cargo.toml +++ b/src/librustc_incremental/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["dylib"] [dependencies] graphviz = { path = "../libgraphviz" } log = "0.4" -rand = "0.5" +rand = "0.6" rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } serialize = { path = "../libserialize" } From 1fec8c28353321048447465506dc68ab3a6c335e Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Sun, 10 Feb 2019 17:54:56 +0100 Subject: [PATCH 193/381] Make the Entry API of HashMap Sync and Send (fixes #45219) --- src/libstd/collections/hash/map.rs | 10 ++++++++++ .../sync-send-iterators-in-libcollections.rs | 1 + 2 files changed, 11 insertions(+) diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 91c4e990e007..8bd87ff9b6c3 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -2339,6 +2339,11 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> { elem: FullBucket>, } +#[stable(feature = "rust1", since = "1.0.0")] +unsafe impl<'a, K: 'a + Send, V: 'a + Send> Send for OccupiedEntry<'a, K, V> {} +#[stable(feature = "rust1", since = "1.0.0")] +unsafe impl<'a, K: 'a + Sync, V: 'a + Sync> Sync for OccupiedEntry<'a, K, V> {} + #[stable(feature= "debug_hash_map", since = "1.12.0")] impl<'a, K: 'a + Debug, V: 'a + Debug> Debug for OccupiedEntry<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -2360,6 +2365,11 @@ pub struct VacantEntry<'a, K: 'a, V: 'a> { elem: VacantEntryState>, } +#[stable(feature = "rust1", since = "1.0.0")] +unsafe impl<'a, K: 'a + Send, V: 'a + Send> Send for VacantEntry<'a, K, V> {} +#[stable(feature = "rust1", since = "1.0.0")] +unsafe impl<'a, K: 'a + Sync, V: 'a + Sync> Sync for VacantEntry<'a, K, V> {} + #[stable(feature= "debug_hash_map", since = "1.12.0")] impl<'a, K: 'a + Debug, V: 'a> Debug for VacantEntry<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs index 812cf89751ef..fd53bb607f79 100644 --- a/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs +++ b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs @@ -53,6 +53,7 @@ fn main() { is_sync_send!(BTreeSet::::new(), union(&BTreeSet::::new())); all_sync_send!(HashMap::::new(), iter, iter_mut, drain, into_iter, keys, values); + is_sync_send!(HashMap::::new(), entry(0)); all_sync_send!(HashSet::::new(), iter, drain, into_iter); is_sync_send!(HashSet::::new(), difference(&HashSet::::new())); is_sync_send!(HashSet::::new(), symmetric_difference(&HashSet::::new())); From b129de47a0a1fbb387510da72b90d9035fd2e4fe Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 4 Mar 2019 13:16:49 +0100 Subject: [PATCH 194/381] Regression test for #58435. --- .../issues/issue-58435-ice-with-assoc-const.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/run-pass/issues/issue-58435-ice-with-assoc-const.rs diff --git a/src/test/run-pass/issues/issue-58435-ice-with-assoc-const.rs b/src/test/run-pass/issues/issue-58435-ice-with-assoc-const.rs new file mode 100644 index 000000000000..94e2b2563df5 --- /dev/null +++ b/src/test/run-pass/issues/issue-58435-ice-with-assoc-const.rs @@ -0,0 +1,17 @@ +// The const-evaluator was at one point ICE'ing while trying to +// evaluate the body of `fn id` during the `s.id()` call in main. + +struct S(T); + +impl S { + const ID: fn(&S) -> &S = |s| s; + pub fn id(&self) -> &Self { + Self::ID(self) // This, plus call below ... + } +} + +fn main() { + let s = S(10u32); + assert!(S::::ID(&s).0 == 10); // Works fine + assert!(s.id().0 == 10); // ... causes compiler to panic +} From 5c0615b89c399ce6a431ba660f9457c24bc69964 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Sat, 16 Feb 2019 20:51:43 +0100 Subject: [PATCH 195/381] Use early unwraps instead of bubbling up errors just to unwrap in the end --- src/librustc_codegen_ssa/mir/constant.rs | 14 ++++---- src/librustc_mir/const_eval.rs | 43 +++++++++++------------- src/librustc_mir/hair/pattern/_match.rs | 8 +---- src/librustc_mir/hair/pattern/mod.rs | 9 ++--- 4 files changed, 30 insertions(+), 44 deletions(-) diff --git a/src/librustc_codegen_ssa/mir/constant.rs b/src/librustc_codegen_ssa/mir/constant.rs index 6bc69efa4a7d..349c9132842b 100644 --- a/src/librustc_codegen_ssa/mir/constant.rs +++ b/src/librustc_codegen_ssa/mir/constant.rs @@ -49,36 +49,36 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { constant: Result, ErrorHandled>, ) -> (Bx::Value, Ty<'tcx>) { constant - .and_then(|c| { + .map(|c| { let field_ty = c.ty.builtin_index().unwrap(); let fields = match c.ty.sty { ty::Array(_, n) => n.unwrap_usize(bx.tcx()), ref other => bug!("invalid simd shuffle type: {}", other), }; - let values: Result, ErrorHandled> = (0..fields).map(|field| { + let values: Vec<_> = (0..fields).map(|field| { let field = const_field( bx.tcx(), ty::ParamEnv::reveal_all(), None, mir::Field::new(field as usize), c, - )?; + ); if let Some(prim) = field.val.try_to_scalar() { let layout = bx.layout_of(field_ty); let scalar = match layout.abi { layout::Abi::Scalar(ref x) => x, _ => bug!("from_const: invalid ByVal layout: {:#?}", layout) }; - Ok(bx.scalar_to_backend( + bx.scalar_to_backend( prim, scalar, bx.immediate_backend_type(layout), - )) + ) } else { bug!("simd shuffle field {:?}", field) } }).collect(); - let llval = bx.const_struct(&values?, false); - Ok((llval, c.ty)) + let llval = bx.const_struct(&values, false); + (llval, c.ty) }) .unwrap_or_else(|_| { bx.tcx().sess.span_err( diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index 35ca13891876..ee522570b363 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -466,45 +466,42 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> } /// Projects to a field of a (variant of a) const. +// this function uses `unwrap` copiously, because an already validated constant must have valid +// fields and can thus never fail outside of compiler bugs pub fn const_field<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, variant: Option, field: mir::Field, value: ty::Const<'tcx>, -) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> { +) -> ty::Const<'tcx> { trace!("const_field: {:?}, {:?}", field, value); let ecx = mk_eval_cx(tcx, DUMMY_SP, param_env); - let result = (|| { - // get the operand again - let op = ecx.const_to_op(value, None)?; - // downcast - let down = match variant { - None => op, - Some(variant) => ecx.operand_downcast(op, variant)? - }; - // then project - let field = ecx.operand_field(down, field.index() as u64)?; - // and finally move back to the const world, always normalizing because - // this is not called for statics. - op_to_const(&ecx, field) - })(); - result.map_err(|error| { - let err = error_to_const_error(&ecx, error); - err.report_as_error(ecx.tcx, "could not access field of constant"); - ErrorHandled::Reported - }) + // get the operand again + let op = ecx.const_to_op(value, None).unwrap(); + // downcast + let down = match variant { + None => op, + Some(variant) => ecx.operand_downcast(op, variant).unwrap(), + }; + // then project + let field = ecx.operand_field(down, field.index() as u64).unwrap(); + // and finally move back to the const world, always normalizing because + // this is not called for statics. + op_to_const(&ecx, field).unwrap() } +// this function uses `unwrap` copiously, because an already validated constant must have valid +// fields and can thus never fail outside of compiler bugs pub fn const_variant_index<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, val: ty::Const<'tcx>, -) -> EvalResult<'tcx, VariantIdx> { +) -> VariantIdx { trace!("const_variant_index: {:?}", val); let ecx = mk_eval_cx(tcx, DUMMY_SP, param_env); - let op = ecx.const_to_op(val, None)?; - Ok(ecx.read_discriminant(op)?.1) + let op = ecx.const_to_op(val, None).unwrap(); + ecx.read_discriminant(op).unwrap().1 } pub fn error_to_const_error<'a, 'mir, 'tcx>( diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 60eb30e07533..586a3fdb907e 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -440,13 +440,7 @@ impl<'tcx> Constructor<'tcx> { assert!(!adt.is_enum()); VariantIdx::new(0) } - &ConstantValue(c) => { - crate::const_eval::const_variant_index( - cx.tcx, - cx.param_env, - c, - ).unwrap() - }, + &ConstantValue(c) => crate::const_eval::const_variant_index(cx.tcx, cx.param_env, c), _ => bug!("bad constructor {:?} for adt {:?}", self, adt) } } diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index d5f2e7a7275e..ab54d4c50b5e 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -937,10 +937,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { debug!("const_to_pat: cv={:#?} id={:?}", cv, id); let adt_subpattern = |i, variant_opt| { let field = Field::new(i); - let val = const_field( - self.tcx, self.param_env, - variant_opt, field, cv, - ).expect("field access failed"); + let val = const_field(self.tcx, self.param_env, variant_opt, field, cv); self.const_to_pat(instance, val, id, span) }; let adt_subpatterns = |n, variant_opt| { @@ -979,9 +976,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { PatternKind::Wild } ty::Adt(adt_def, substs) if adt_def.is_enum() => { - let variant_index = const_variant_index( - self.tcx, self.param_env, cv - ).expect("const_variant_index failed"); + let variant_index = const_variant_index(self.tcx, self.param_env, cv); let subpatterns = adt_subpatterns( adt_def.variants[variant_index].fields.len(), Some(variant_index), From 9ed94e5e54f619f05c184107215327ef3ed221b1 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Wed, 27 Feb 2019 17:09:32 -0700 Subject: [PATCH 196/381] Fix release note problems noticed after merging. --- RELEASES.md | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 841467b69c98..4cda02c5c2eb 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4,10 +4,10 @@ Version 1.33.0 (2019-02-28) Language -------- - [You can now use the `cfg(target_vendor)` attribute.][57465] E.g. - `#[cfg(target_vendor="linux")] fn main() { println!("Hello Linux!"); }` + `#[cfg(target_vendor="apple")] fn main() { println!("Hello Apple!"); }` - [Integer patterns such as in a match expression can now be exhaustive.][56362] E.g. You can have match statement on a `u8` that covers `0..=255` and - you would no longer be required to have a `_ => unreachable!()` case. + you would no longer be required to have a `_ => unreachable!()` case. - [You can now have multiple patterns in `if let` and `while let` expressions.][57532] You can do this with the same syntax as a `match` expression. E.g. @@ -51,8 +51,7 @@ Language // Allowed as there is only one `Read` in the module. pub trait Read {} ``` -- [`extern` functions will now abort by default when panicking.][55982] - This was previously undefined behaviour. +- [You may now use `Rc`, `Arc`, and `Pin` as method receivers][56805]. Compiler -------- @@ -109,27 +108,30 @@ Compatibility Notes are now deprecated in the standard library, and their usage will now produce a warning. Please use the `str::{trim_start, trim_end, trim_start_matches, trim_end_matches}` methods instead. +- The `Error::cause` method has been deprecated in favor of `Error::source` which supports + downcasting. -[57615]: https://github.com/rust-lang/rust/pull/57615/ -[57465]: https://github.com/rust-lang/rust/pull/57465/ -[57532]: https://github.com/rust-lang/rust/pull/57532/ -[57535]: https://github.com/rust-lang/rust/pull/57535/ -[57566]: https://github.com/rust-lang/rust/pull/57566/ +[55982]: https://github.com/rust-lang/rust/pull/55982/ +[56303]: https://github.com/rust-lang/rust/pull/56303/ +[56351]: https://github.com/rust-lang/rust/pull/56351/ +[56362]: https://github.com/rust-lang/rust/pull/56362 +[56642]: https://github.com/rust-lang/rust/pull/56642/ +[56769]: https://github.com/rust-lang/rust/pull/56769/ +[56805]: https://github.com/rust-lang/rust/pull/56805 +[56947]: https://github.com/rust-lang/rust/pull/56947/ +[57049]: https://github.com/rust-lang/rust/pull/57049/ +[57067]: https://github.com/rust-lang/rust/pull/57067/ +[57105]: https://github.com/rust-lang/rust/pull/57105 [57130]: https://github.com/rust-lang/rust/pull/57130/ [57167]: https://github.com/rust-lang/rust/pull/57167/ [57175]: https://github.com/rust-lang/rust/pull/57175/ [57234]: https://github.com/rust-lang/rust/pull/57234/ [57332]: https://github.com/rust-lang/rust/pull/57332/ -[56947]: https://github.com/rust-lang/rust/pull/56947/ -[57049]: https://github.com/rust-lang/rust/pull/57049/ -[57067]: https://github.com/rust-lang/rust/pull/57067/ -[56769]: https://github.com/rust-lang/rust/pull/56769/ -[56642]: https://github.com/rust-lang/rust/pull/56642/ -[56303]: https://github.com/rust-lang/rust/pull/56303/ -[56351]: https://github.com/rust-lang/rust/pull/56351/ -[55982]: https://github.com/rust-lang/rust/pull/55982/ -[56362]: https://github.com/rust-lang/rust/pull/56362 -[57105]: https://github.com/rust-lang/rust/pull/57105 +[57465]: https://github.com/rust-lang/rust/pull/57465/ +[57532]: https://github.com/rust-lang/rust/pull/57532/ +[57535]: https://github.com/rust-lang/rust/pull/57535/ +[57566]: https://github.com/rust-lang/rust/pull/57566/ +[57615]: https://github.com/rust-lang/rust/pull/57615/ [cargo/6484]: https://github.com/rust-lang/cargo/pull/6484/ [`unix::FileExt::read_exact_at`]: https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method.read_exact_at [`unix::FileExt::write_all_at`]: https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method.write_all_at @@ -170,7 +172,7 @@ Language - [You can now match against literals in macros with the `literal` specifier.][56072] This will match against a literal of any type. E.g. `1`, `'A'`, `"Hello World"` -- [Self can now be used as a constructor and pattern for unit and tuple structs.][56365] E.g. +- [Self can now be used as a constructor and pattern for unit and tuple structs.][56365] E.g. ```rust struct Point(i32, i32); @@ -460,7 +462,7 @@ Version 1.31.0 (2018-12-06) Language -------- -- 🎉 [This version marks the release of the 2018 edition of Rust.][54057] 🎉 +- 🎉 [This version marks the release of the 2018 edition of Rust.][54057] 🎉 - [New lifetime elision rules now allow for eliding lifetimes in functions and impl headers.][54778] E.g. `impl<'a> Reader for BufReader<'a> {}` can now be `impl Reader for BufReader<'_> {}`. Lifetimes are still required to be defined From 6dd2a857aa60925e42e3d319534bee46f0664caf Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Mon, 4 Mar 2019 18:53:12 +0000 Subject: [PATCH 197/381] Regression test added for an async ICE. --- .../issues/issue-57084-async-await.rs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/test/run-pass/issues/issue-57084-async-await.rs diff --git a/src/test/run-pass/issues/issue-57084-async-await.rs b/src/test/run-pass/issues/issue-57084-async-await.rs new file mode 100644 index 000000000000..feed68b5db10 --- /dev/null +++ b/src/test/run-pass/issues/issue-57084-async-await.rs @@ -0,0 +1,27 @@ +// This issue reproduces an ICE on compile (E.g. fails on 2018-12-19 nightly). +// run-pass +// edition:2018 +#![feature(async_await,futures_api,await_macro,generators)] + +pub struct Foo; + +impl Foo { + async fn with<'a, F, R>(&'a self, f: F) -> R + where F: Fn() -> R + 'a, + { + loop { + match f() { + _ => yield, + } + } + } + + pub async fn run<'a>(&'a self, data: &'a [u8]) + { + await!(self.with(move || { + println!("{:p}", data); + })) + } +} + +fn main() {} From 9e8a62b73449c82c5600eea7e8ce1683aa862be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 5 Feb 2019 15:17:08 -0800 Subject: [PATCH 198/381] On return type `impl Trait` for block with no expr point at last semi --- src/librustc/traits/error_reporting.rs | 32 ++++++++++++++++--- .../impl-trait-return-trailing-semicolon.rs | 7 ++++ ...mpl-trait-return-trailing-semicolon.stderr | 13 ++++++++ 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 src/test/ui/suggestions/impl-trait-return-trailing-semicolon.rs create mode 100644 src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 3eb49092fed1..9262cbec9f41 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -598,11 +598,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } } - pub fn report_selection_error(&self, - obligation: &PredicateObligation<'tcx>, - error: &SelectionError<'tcx>, - fallback_has_occurred: bool) - { + pub fn report_selection_error( + &self, + obligation: &PredicateObligation<'tcx>, + error: &SelectionError<'tcx>, + fallback_has_occurred: bool, + ) { let span = obligation.cause.span; let mut err = match *error { @@ -647,6 +648,27 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { trait_ref.to_predicate(), post_message) )); + let parent_node = self.tcx.hir().get_parent_node(obligation.cause.body_id); + let node = self.tcx.hir().find(parent_node); + if let Some(hir::Node::Item(hir::Item { + node: hir::ItemKind::Fn(decl, _, _, body_id), + .. + })) = node { + let body = self.tcx.hir().body(*body_id); + if let hir::ExprKind::Block(blk, _) = &body.value.node { + if decl.output.span().overlaps(span) && blk.expr.is_none() && + "()" == &trait_ref.self_ty().to_string() + { + // When encountering a method with a trait bound not satisfied + // in the return type with a body that has no return, suggest + // removal of semicolon on last statement. + if let Some(ref stmt) = blk.stmts.last() { + let sp = self.tcx.sess.source_map().end_point(stmt.span); + err.span_label(sp, "consider removing this semicolon"); + } + } + } + } let explanation = if obligation.cause.code == ObligationCauseCode::MainFunctionType { "consider using `()`, or a `Result`".to_owned() diff --git a/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.rs b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.rs new file mode 100644 index 000000000000..e72a2d8ccc62 --- /dev/null +++ b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.rs @@ -0,0 +1,7 @@ +trait Bar {} +impl Bar for u8 {} +fn foo() -> impl Bar { + 5; //~^ ERROR the trait bound `(): Bar` is not satisfied +} + +fn main() {} diff --git a/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr new file mode 100644 index 000000000000..f26fb141ccf8 --- /dev/null +++ b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr @@ -0,0 +1,13 @@ +error[E0277]: the trait bound `(): Bar` is not satisfied + --> $DIR/impl-trait-return-trailing-semicolon.rs:3:13 + | +LL | fn foo() -> impl Bar { + | ^^^^^^^^ the trait `Bar` is not implemented for `()` +LL | 5; //~^ ERROR the trait bound `(): Bar` is not satisfied + | - consider removing this semicolon + | + = note: the return type of a function must have a statically known size + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. From f2718dc7263ae7355dd8ffdd7a788e0683b5aabf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 7 Feb 2019 06:02:17 -0800 Subject: [PATCH 199/381] Add fixme --- src/librustc/traits/error_reporting.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 9262cbec9f41..32fce1043d01 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -659,9 +659,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { if decl.output.span().overlaps(span) && blk.expr.is_none() && "()" == &trait_ref.self_ty().to_string() { - // When encountering a method with a trait bound not satisfied - // in the return type with a body that has no return, suggest - // removal of semicolon on last statement. + // FIXME(estebank): When encountering a method with a trait + // bound not satisfied in the return type with a body that has + // no return, suggest removal of semicolon on last statement. + // Once that is added, close #54771. if let Some(ref stmt) = blk.stmts.last() { let sp = self.tcx.sess.source_map().end_point(stmt.span); err.span_label(sp, "consider removing this semicolon"); From 842014d8fc128b6ffc8de2f4387e1fb926a8ea9b Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 4 Mar 2019 13:28:31 -0800 Subject: [PATCH 200/381] Add an explicit test for issue #50582 This code no longer ICEs, and @yodaldevoid found that it was fixed by commit fe5710a. While that added a similar test, we can explicitly test this reproducer too. Closes #50582. --- src/test/ui/issues/issue-50582.rs | 4 ++++ src/test/ui/issues/issue-50582.stderr | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/test/ui/issues/issue-50582.rs create mode 100644 src/test/ui/issues/issue-50582.stderr diff --git a/src/test/ui/issues/issue-50582.rs b/src/test/ui/issues/issue-50582.rs new file mode 100644 index 000000000000..1358e0bde4c8 --- /dev/null +++ b/src/test/ui/issues/issue-50582.rs @@ -0,0 +1,4 @@ +fn main() { + Vec::<[(); 1 + for x in 0..1 {}]>::new(); + //~^ ERROR cannot add +} diff --git a/src/test/ui/issues/issue-50582.stderr b/src/test/ui/issues/issue-50582.stderr new file mode 100644 index 000000000000..226f5a3f0fed --- /dev/null +++ b/src/test/ui/issues/issue-50582.stderr @@ -0,0 +1,11 @@ +error[E0277]: cannot add `()` to `{integer}` + --> $DIR/issue-50582.rs:2:18 + | +LL | Vec::<[(); 1 + for x in 0..1 {}]>::new(); + | ^ no implementation for `{integer} + ()` + | + = help: the trait `std::ops::Add<()>` is not implemented for `{integer}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. From e6387b6a75ce37cb5ef8582b8b011737337caf9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 4 Mar 2019 13:39:52 -0800 Subject: [PATCH 201/381] Fix rebase and move suggestion to its own method --- src/librustc/traits/error_reporting.rs | 75 ++++++++++++++++---------- 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 32fce1043d01..502edb4ac6b2 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -648,28 +648,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { trait_ref.to_predicate(), post_message) )); - let parent_node = self.tcx.hir().get_parent_node(obligation.cause.body_id); - let node = self.tcx.hir().find(parent_node); - if let Some(hir::Node::Item(hir::Item { - node: hir::ItemKind::Fn(decl, _, _, body_id), - .. - })) = node { - let body = self.tcx.hir().body(*body_id); - if let hir::ExprKind::Block(blk, _) = &body.value.node { - if decl.output.span().overlaps(span) && blk.expr.is_none() && - "()" == &trait_ref.self_ty().to_string() - { - // FIXME(estebank): When encountering a method with a trait - // bound not satisfied in the return type with a body that has - // no return, suggest removal of semicolon on last statement. - // Once that is added, close #54771. - if let Some(ref stmt) = blk.stmts.last() { - let sp = self.tcx.sess.source_map().end_point(stmt.span); - err.span_label(sp, "consider removing this semicolon"); - } - } - } - } let explanation = if obligation.cause.code == ObligationCauseCode::MainFunctionType { "consider using `()`, or a `Result`".to_owned() @@ -695,6 +673,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { self.suggest_borrow_on_unsized_slice(&obligation.cause.code, &mut err); self.suggest_remove_reference(&obligation, &mut err, &trait_ref); + self.suggest_semicolon_removal(&obligation, &mut err, span, &trait_ref); // Try to report a help message if !trait_ref.has_infer_types() && @@ -923,9 +902,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// When encountering an assignment of an unsized trait, like `let x = ""[..];`, provide a /// suggestion to borrow the initializer in order to use have a slice instead. - fn suggest_borrow_on_unsized_slice(&self, - code: &ObligationCauseCode<'tcx>, - err: &mut DiagnosticBuilder<'tcx>) { + fn suggest_borrow_on_unsized_slice( + &self, + code: &ObligationCauseCode<'tcx>, + err: &mut DiagnosticBuilder<'tcx>, + ) { if let &ObligationCauseCode::VariableType(node_id) = code { let parent_node = self.tcx.hir().get_parent_node(node_id); if let Some(Node::Local(ref local)) = self.tcx.hir().find(parent_node) { @@ -947,10 +928,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// Whenever references are used by mistake, like `for (i, e) in &vec.iter().enumerate()`, /// suggest removing these references until we reach a type that implements the trait. - fn suggest_remove_reference(&self, - obligation: &PredicateObligation<'tcx>, - err: &mut DiagnosticBuilder<'tcx>, - trait_ref: &ty::Binder>) { + fn suggest_remove_reference( + &self, + obligation: &PredicateObligation<'tcx>, + err: &mut DiagnosticBuilder<'tcx>, + trait_ref: &ty::Binder>, + ) { let trait_ref = trait_ref.skip_binder(); let span = obligation.cause.span; @@ -992,6 +975,40 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } } + fn suggest_semicolon_removal( + &self, + obligation: &PredicateObligation<'tcx>, + err: &mut DiagnosticBuilder<'tcx>, + span: Span, + trait_ref: &ty::Binder>, + ) { + let hir = self.tcx.hir(); + let parent_node = hir.get_parent_node( + hir.hir_to_node_id(obligation.cause.body_id), + ); + let node = hir.find(parent_node); + if let Some(hir::Node::Item(hir::Item { + node: hir::ItemKind::Fn(decl, _, _, body_id), + .. + })) = node { + let body = hir.body(*body_id); + if let hir::ExprKind::Block(blk, _) = &body.value.node { + if decl.output.span().overlaps(span) && blk.expr.is_none() && + "()" == &trait_ref.self_ty().to_string() + { + // FIXME(estebank): When encountering a method with a trait + // bound not satisfied in the return type with a body that has + // no return, suggest removal of semicolon on last statement. + // Once that is added, close #54771. + if let Some(ref stmt) = blk.stmts.last() { + let sp = self.tcx.sess.source_map().end_point(stmt.span); + err.span_label(sp, "consider removing this semicolon"); + } + } + } + } + } + /// Given some node representing a fn-like thing in the HIR map, /// returns a span and `ArgKind` information that describes the /// arguments it expects. This can be supplied to From 538a0963ff4a55da47fcf2a1e14c62edab5af48d Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 4 Mar 2019 15:12:45 -0800 Subject: [PATCH 202/381] Add as_slice() to slice::IterMut and vec::Drain In bluss/indexmap#88, we found that there was no easy way to implement `Debug` for our `IterMut` and `Drain` iterators. Those are built on `slice::IterMut` and `vec::Drain`, which implement `Debug` themselves, but have no other way to access their data. With a new `as_slice()` method, we can read the data and customize its presentation. --- src/liballoc/vec.rs | 19 +++++++++++++++++++ src/libcore/slice/mod.rs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 947ce354ae71..7c3cab77bfbb 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -2468,6 +2468,25 @@ impl fmt::Debug for Drain<'_, T> { } } +impl<'a, T> Drain<'a, T> { + /// Returns the remaining items of this iterator as a slice. + /// + /// # Examples + /// + /// ``` + /// # #![feature(vec_drain_as_slice)] + /// let mut vec = vec!['a', 'b', 'c']; + /// let mut drain = vec.drain(..); + /// assert_eq!(drain.as_slice(), &['a', 'b', 'c']); + /// let _ = drain.next().unwrap(); + /// assert_eq!(drain.as_slice(), &['b', 'c']); + /// ``` + #[unstable(feature = "vec_drain_as_slice", reason = "recently added", issue = "0")] + pub fn as_slice(&self) -> &[T] { + self.iter.as_slice() + } +} + #[stable(feature = "drain", since = "1.6.0")] unsafe impl Sync for Drain<'_, T> {} #[stable(feature = "drain", since = "1.6.0")] diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 2063f8ffaf65..b48101c23dad 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -3288,6 +3288,38 @@ impl<'a, T> IterMut<'a, T> { pub fn into_slice(self) -> &'a mut [T] { unsafe { from_raw_parts_mut(self.ptr, len!(self)) } } + + /// Views the underlying data as a subslice of the original data. + /// + /// To avoid creating `&mut` references that alias, this has a + /// borrowed lifetime from the iterator. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// # #![feature(slice_iter_mut_as_slice)] + /// // First, we declare a type which has `iter_mut` method to get the `IterMut` + /// // struct (&[usize here]): + /// let mut slice = &mut [1, 2, 3]; + /// + /// // Then, we get the iterator: + /// let mut iter = slice.iter_mut(); + /// // So if we print what `as_slice` method returns here, we have "[1, 2, 3]": + /// println!("{:?}", iter.as_slice()); + /// assert_eq!(iter.as_slice(), &[1, 2, 3]); + /// + /// // Next, we move to the second element of the slice: + /// iter.next(); + /// // Now `as_slice` returns "[2, 3]": + /// println!("{:?}", iter.as_slice()); + /// assert_eq!(iter.as_slice(), &[2, 3]); + /// ``` + #[unstable(feature = "slice_iter_mut_as_slice", reason = "recently added", issue = "0")] + pub fn as_slice(&self) -> &[T] { + self.make_slice() + } } iterator!{struct IterMut -> *mut T, &'a mut T, mut, {mut}, {}} From 97431a40908a32db31fbc1f10af365e653309a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Mon, 3 Dec 2018 01:14:35 +0100 Subject: [PATCH 203/381] Create a derive macro for HashStable --- src/librustc/Cargo.toml | 1 + src/librustc/hir/mod.rs | 3 ++- src/librustc/ich/impls_hir.rs | 6 ----- src/librustc/lib.rs | 1 + src/librustc_macros/Cargo.toml | 13 +++++++++++ src/librustc_macros/src/hash_stable.rs | 31 ++++++++++++++++++++++++++ src/librustc_macros/src/lib.rs | 14 ++++++++++++ src/tools/tidy/src/deps.rs | 1 + 8 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 src/librustc_macros/Cargo.toml create mode 100644 src/librustc_macros/src/hash_stable.rs create mode 100644 src/librustc_macros/src/lib.rs diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index 26a27ea88e27..31e10c19c7a6 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -24,6 +24,7 @@ rustc-rayon = "0.1.2" rustc-rayon-core = "0.1.2" rustc_apfloat = { path = "../librustc_apfloat" } rustc_target = { path = "../librustc_target" } +rustc_macros = { path = "../librustc_macros" } rustc_data_structures = { path = "../librustc_data_structures" } errors = { path = "../librustc_errors", package = "rustc_errors" } serialize = { path = "../libserialize" } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 2d0296aa38c7..4b5670af1385 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -32,6 +32,7 @@ use crate::ty::query::Providers; use rustc_data_structures::sync::{ParallelIterator, par_iter, Send, Sync}; use rustc_data_structures::thin_vec::ThinVec; +use rustc_macros::HashStable; use serialize::{self, Encoder, Encodable, Decoder, Decodable}; use std::collections::{BTreeSet, BTreeMap}; @@ -149,7 +150,7 @@ pub const DUMMY_HIR_ID: HirId = HirId { pub const DUMMY_ITEM_LOCAL_ID: ItemLocalId = ItemLocalId::MAX; -#[derive(Clone, RustcEncodable, RustcDecodable, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, Copy, HashStable)] pub struct Lifetime { pub hir_id: HirId, pub span: Span, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 0803816fb03f..d8d4157e20ec 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -157,12 +157,6 @@ impl_stable_hash_for!(struct ast::Label { ident }); -impl_stable_hash_for!(struct hir::Lifetime { - hir_id, - span, - name -}); - impl_stable_hash_for!(struct hir::Path { span, def, diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 205ea6126fc5..e1f6e1caeae9 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -148,6 +148,7 @@ pub mod util { #[doc(hidden)] mod rustc { pub use crate::lint; + pub use crate::ich; } // FIXME(#27438): right now the unit tests of librustc don't refer to any actual diff --git a/src/librustc_macros/Cargo.toml b/src/librustc_macros/Cargo.toml new file mode 100644 index 000000000000..c5e01e9e0a76 --- /dev/null +++ b/src/librustc_macros/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "rustc_macros" +version = "0.1.0" +authors = ["The Rust Project Developers"] + +[lib] +proc-macro = true + +[dependencies] +synstructure = "0.10.1" +syn = { version = "0.15.22", features = ["full"] } +proc-macro2 = "0.4.24" +quote = "0.6.10" \ No newline at end of file diff --git a/src/librustc_macros/src/hash_stable.rs b/src/librustc_macros/src/hash_stable.rs new file mode 100644 index 000000000000..86ac0b353e5f --- /dev/null +++ b/src/librustc_macros/src/hash_stable.rs @@ -0,0 +1,31 @@ +use synstructure; +use syn; +use proc_macro2; + +pub fn hash_stable_derive(mut s: synstructure::Structure) -> proc_macro2::TokenStream { + let generic: syn::GenericParam = parse_quote!('__ctx); + s.add_bounds(synstructure::AddBounds::Generics); + s.add_impl_generic(generic); + let body = s.each(|bi| quote!{ + ::rustc_data_structures::stable_hasher::HashStable::hash_stable(#bi, __hcx, __hasher); + }); + + let discriminant = match s.ast().data { + syn::Data::Enum(_) => quote! { + ::std::mem::discriminant(self).hash_stable(__hcx, __hasher); + }, + syn::Data::Struct(_) => quote! {}, + syn::Data::Union(_) => panic!("cannot derive on union"), + }; + + s.bound_impl(quote!(::rustc_data_structures::stable_hasher::HashStable + <::rustc::ich::StableHashingContext<'__ctx>>), quote!{ + fn hash_stable<__W: ::rustc_data_structures::stable_hasher::StableHasherResult>( + &self, + __hcx: &mut ::rustc::ich::StableHashingContext<'__ctx>, + __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<__W>) { + #discriminant + match *self { #body } + } + }) +} diff --git a/src/librustc_macros/src/lib.rs b/src/librustc_macros/src/lib.rs new file mode 100644 index 000000000000..8dcf2b76fad2 --- /dev/null +++ b/src/librustc_macros/src/lib.rs @@ -0,0 +1,14 @@ +#![feature(proc_macro_hygiene)] + +#[macro_use] +extern crate syn; +#[macro_use] +extern crate synstructure; +#[macro_use] +extern crate quote; +extern crate proc_macro; +extern crate proc_macro2; + +mod hash_stable; + +decl_derive!([HashStable] => hash_stable::hash_stable_derive); diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index f581ce1f5a37..d7683aae841c 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -137,6 +137,7 @@ const WHITELIST: &[Crate<'_>] = &[ Crate("smallvec"), Crate("stable_deref_trait"), Crate("syn"), + Crate("synstructure"), Crate("tempfile"), Crate("termcolor"), Crate("terminon"), From c3c1c8d4e0f01c869f8381e70fbd4d103534493f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sun, 13 Jan 2019 09:18:37 +0100 Subject: [PATCH 204/381] Allow linking to a proc macro on the target in metadata and still use a host proc macro to execute them --- src/librustc/session/config.rs | 2 + src/librustc/session/filesearch.rs | 1 + src/librustc_metadata/creader.rs | 159 +++++++++++++++++++---------- src/librustc_metadata/locator.rs | 16 ++- 4 files changed, 122 insertions(+), 56 deletions(-) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 774ab0333db5..a4c587b5ca76 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1232,6 +1232,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, Use with RUST_REGION_GRAPH=help for more info"), parse_only: bool = (false, parse_bool, [UNTRACKED], "parse only; do not compile, assemble, or link"), + dual_proc_macros: bool = (false, parse_bool, [TRACKED], + "load proc macros for both target and host, but only link to the target"), no_codegen: bool = (false, parse_bool, [TRACKED], "run all passes except codegen; no output"), treat_err_as_bug: bool = (false, parse_bool, [TRACKED], diff --git a/src/librustc/session/filesearch.rs b/src/librustc/session/filesearch.rs index 77f190e28122..cf09d45ca38f 100644 --- a/src/librustc/session/filesearch.rs +++ b/src/librustc/session/filesearch.rs @@ -18,6 +18,7 @@ pub enum FileMatch { // A module for searching for libraries +#[derive(Clone)] pub struct FileSearch<'a> { sysroot: &'a Path, triple: &'a str, diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 6f2718381c2e..600ec8d65b63 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -188,13 +188,15 @@ impl<'a> CrateLoader<'a> { }); } - fn register_crate(&mut self, - root: &Option, - ident: Symbol, - span: Span, - lib: Library, - dep_kind: DepKind) - -> (CrateNum, Lrc) { + fn register_crate( + &mut self, + host_lib: Option, + root: &Option, + ident: Symbol, + span: Span, + lib: Library, + dep_kind: DepKind + ) -> (CrateNum, Lrc) { let crate_root = lib.metadata.get_root(); info!("register crate `extern crate {} as {}`", crate_root.name, ident); self.verify_no_symbol_conflicts(span, &crate_root); @@ -222,7 +224,16 @@ impl<'a> CrateLoader<'a> { let dependencies: Vec = cnum_map.iter().cloned().collect(); let proc_macros = crate_root.proc_macro_decls_static.map(|_| { - self.load_derive_macros(&crate_root, dylib.clone().map(|p| p.0), span) + if self.sess.opts.debugging_opts.dual_proc_macros { + let host_lib = host_lib.unwrap(); + self.load_derive_macros( + &host_lib.metadata.get_root(), + host_lib.dylib.clone().map(|p| p.0), + span + ) + } else { + self.load_derive_macros(&crate_root, dylib.clone().map(|p| p.0), span) + } }); let def_path_table = record_time(&self.sess.perf_stats.decode_def_path_tables_time, || { @@ -269,6 +280,61 @@ impl<'a> CrateLoader<'a> { (cnum, cmeta) } + fn load_proc_macro<'b> ( + &mut self, + locate_ctxt: &mut locator::Context<'b>, + path_kind: PathKind, + ) -> Option<(LoadResult, Option)> + where + 'a: 'b + { + // Use a new locator Context so trying to load a proc macro doesn't affect the error + // message we emit + let mut proc_macro_locator = locate_ctxt.clone(); + + // Try to load a proc macro + proc_macro_locator.is_proc_macro = Some(true); + + // Load the proc macro crate for the target + let (locator, target_result) = if self.sess.opts.debugging_opts.dual_proc_macros { + proc_macro_locator.reset(); + let result = match self.load(&mut proc_macro_locator)? { + LoadResult::Previous(cnum) => return Some((LoadResult::Previous(cnum), None)), + LoadResult::Loaded(library) => Some(LoadResult::Loaded(library)) + }; + // Don't look for a matching hash when looking for the host crate. + // It won't be the same as the target crate hash + locate_ctxt.hash = None; + // Use the locate_ctxt when looking for the host proc macro crate, as that is required + // so we want it to affect the error message + (locate_ctxt, result) + } else { + (&mut proc_macro_locator, None) + }; + + // Load the proc macro crate for the host + + locator.reset(); + locator.is_proc_macro = Some(true); + locator.target = &self.sess.host; + locator.triple = TargetTriple::from_triple(config::host_triple()); + locator.filesearch = self.sess.host_filesearch(path_kind); + + let host_result = self.load(locator)?; + + Some(if self.sess.opts.debugging_opts.dual_proc_macros { + let host_result = match host_result { + LoadResult::Previous(..) => { + panic!("host and target proc macros must be loaded in lock-step") + } + LoadResult::Loaded(library) => library + }; + (target_result.unwrap(), Some(host_result)) + } else { + (host_result, None) + }) + } + fn resolve_crate<'b>( &'b mut self, root: &'b Option, @@ -281,53 +347,39 @@ impl<'a> CrateLoader<'a> { mut dep_kind: DepKind, ) -> Result<(CrateNum, Lrc), LoadError<'b>> { info!("resolving crate `extern crate {} as {}`", name, ident); + let mut locate_ctxt = locator::Context { + sess: self.sess, + span, + ident, + crate_name: name, + hash: hash.map(|a| &*a), + extra_filename: extra_filename, + filesearch: self.sess.target_filesearch(path_kind), + target: &self.sess.target.target, + triple: self.sess.opts.target_triple.clone(), + root, + rejected_via_hash: vec![], + rejected_via_triple: vec![], + rejected_via_kind: vec![], + rejected_via_version: vec![], + rejected_via_filename: vec![], + should_match_name: true, + is_proc_macro: Some(false), + metadata_loader: &*self.cstore.metadata_loader, + }; + let result = if let Some(cnum) = self.existing_match(name, hash, path_kind) { - LoadResult::Previous(cnum) + (LoadResult::Previous(cnum), None) } else { info!("falling back to a load"); - let mut locate_ctxt = locator::Context { - sess: self.sess, - span, - ident, - crate_name: name, - hash: hash.map(|a| &*a), - extra_filename: extra_filename, - filesearch: self.sess.target_filesearch(path_kind), - target: &self.sess.target.target, - triple: &self.sess.opts.target_triple, - root, - rejected_via_hash: vec![], - rejected_via_triple: vec![], - rejected_via_kind: vec![], - rejected_via_version: vec![], - rejected_via_filename: vec![], - should_match_name: true, - is_proc_macro: Some(false), - metadata_loader: &*self.cstore.metadata_loader, - }; - - self.load(&mut locate_ctxt).or_else(|| { + self.load(&mut locate_ctxt).map(|r| (r, None)).or_else(|| { dep_kind = DepKind::UnexportedMacrosOnly; - - let mut proc_macro_locator = locator::Context { - target: &self.sess.host, - triple: &TargetTriple::from_triple(config::host_triple()), - filesearch: self.sess.host_filesearch(path_kind), - rejected_via_hash: vec![], - rejected_via_triple: vec![], - rejected_via_kind: vec![], - rejected_via_version: vec![], - rejected_via_filename: vec![], - is_proc_macro: Some(true), - ..locate_ctxt - }; - - self.load(&mut proc_macro_locator) + self.load_proc_macro(&mut locate_ctxt, path_kind) }).ok_or_else(move || LoadError::LocatorError(locate_ctxt))? }; match result { - LoadResult::Previous(cnum) => { + (LoadResult::Previous(cnum), None) => { let data = self.cstore.get_crate_data(cnum); if data.root.proc_macro_decls_static.is_some() { dep_kind = DepKind::UnexportedMacrosOnly; @@ -337,9 +389,10 @@ impl<'a> CrateLoader<'a> { }); Ok((cnum, data)) } - LoadResult::Loaded(library) => { - Ok(self.register_crate(root, ident, span, library, dep_kind)) + (LoadResult::Loaded(library), host_library) => { + Ok(self.register_crate(host_library, root, ident, span, library, dep_kind)) } + _ => panic!() } } @@ -355,7 +408,7 @@ impl<'a> CrateLoader<'a> { // don't want to match a host crate against an equivalent target one // already loaded. let root = library.metadata.get_root(); - if locate_ctxt.triple == &self.sess.opts.target_triple { + if locate_ctxt.triple == self.sess.opts.target_triple { let mut result = LoadResult::Loaded(library); self.cstore.iter_crate_data(|cnum, data| { if data.root.name == root.name && root.hash == data.root.hash { @@ -451,9 +504,9 @@ impl<'a> CrateLoader<'a> { fn read_extension_crate(&mut self, span: Span, orig_name: Symbol, rename: Symbol) -> ExtensionCrate { info!("read extension crate `extern crate {} as {}`", orig_name, rename); - let target_triple = &self.sess.opts.target_triple; + let target_triple = self.sess.opts.target_triple.clone(); let host_triple = TargetTriple::from_triple(config::host_triple()); - let is_cross = target_triple != &host_triple; + let is_cross = target_triple != host_triple; let mut target_only = false; let mut locate_ctxt = locator::Context { sess: self.sess, @@ -464,7 +517,7 @@ impl<'a> CrateLoader<'a> { extra_filename: None, filesearch: self.sess.host_filesearch(PathKind::Crate), target: &self.sess.host, - triple: &host_triple, + triple: host_triple, root: &None, rejected_via_hash: vec![], rejected_via_triple: vec![], diff --git a/src/librustc_metadata/locator.rs b/src/librustc_metadata/locator.rs index 6a1aada5ac70..81878c4f687b 100644 --- a/src/librustc_metadata/locator.rs +++ b/src/librustc_metadata/locator.rs @@ -244,11 +244,13 @@ use rustc_data_structures::owning_ref::OwningRef; use log::{debug, info, warn}; +#[derive(Clone)] pub struct CrateMismatch { path: PathBuf, got: String, } +#[derive(Clone)] pub struct Context<'a> { pub sess: &'a Session, pub span: Span, @@ -258,7 +260,7 @@ pub struct Context<'a> { pub extra_filename: Option<&'a str>, // points to either self.sess.target.target or self.sess.host, must match triple pub target: &'a Target, - pub triple: &'a TargetTriple, + pub triple: TargetTriple, pub filesearch: FileSearch<'a>, pub root: &'a Option, pub rejected_via_hash: Vec, @@ -302,6 +304,14 @@ impl CratePaths { } impl<'a> Context<'a> { + pub fn reset(&mut self) { + self.rejected_via_hash.clear(); + self.rejected_via_triple.clear(); + self.rejected_via_kind.clear(); + self.rejected_via_version.clear(); + self.rejected_via_filename.clear(); + } + pub fn maybe_load_library_crate(&mut self) -> Option { let mut seen_paths = FxHashSet::default(); match self.extra_filename { @@ -399,7 +409,7 @@ impl<'a> Context<'a> { add); if (self.ident == "std" || self.ident == "core") - && self.triple != &TargetTriple::from_triple(config::host_triple()) { + && self.triple != TargetTriple::from_triple(config::host_triple()) { err.note(&format!("the `{}` target may not be installed", self.triple)); } err.span_label(self.span, "can't find crate"); @@ -718,7 +728,7 @@ impl<'a> Context<'a> { } } - if &root.triple != self.triple { + if root.triple != self.triple { info!("Rejecting via crate triple: expected {} got {}", self.triple, root.triple); From e501a87e895221dfe7475c6739feffe4bbca04eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sun, 2 Dec 2018 21:47:41 +0100 Subject: [PATCH 205/381] Bootstrap changes --- src/bootstrap/bin/rustc.rs | 21 +++++++---- src/bootstrap/builder.rs | 11 ++++++ src/bootstrap/check.rs | 12 ++++--- src/bootstrap/compile.rs | 74 ++++++++++++++++++++++++++++---------- src/bootstrap/lib.rs | 7 ++-- src/bootstrap/test.rs | 2 +- src/bootstrap/tool.rs | 5 +-- 7 files changed, 96 insertions(+), 36 deletions(-) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 70e4a69a07d4..ca86aeb8100a 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -109,6 +109,12 @@ fn main() { cmd.arg("-Zexternal-macro-backtrace"); + // Link crates to the proc macro crate for the target, but use a host proc macro crate + // to actually run the macros + if env::var_os("RUST_DUAL_PROC_MACROS").is_some() { + cmd.arg("-Zdual-proc-macros"); + } + // When we build Rust dylibs they're all intended for intermediate // usage, so make sure we pass the -Cprefer-dynamic flag instead of // linking all deps statically into the dylib. @@ -258,13 +264,6 @@ fn main() { } } - // Force all crates compiled by this compiler to (a) be unstable and (b) - // allow the `rustc_private` feature to link to other unstable crates - // also in the sysroot. - if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() { - cmd.arg("-Z").arg("force-unstable-if-unmarked"); - } - if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") { cmd.arg("--remap-path-prefix").arg(&map); } @@ -284,6 +283,14 @@ fn main() { } } + // Force all crates compiled by this compiler to (a) be unstable and (b) + // allow the `rustc_private` feature to link to other unstable crates + // also in the sysroot. We also do this for host crates, since those + // may be proc macros, in which case we might ship them. + if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() && (stage != "0" || target.is_some()) { + cmd.arg("-Z").arg("force-unstable-if-unmarked"); + } + if env::var_os("RUSTC_PARALLEL_COMPILER").is_some() { cmd.arg("--cfg").arg("parallel_compiler"); } diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 7e6c0a9f52aa..eb1a2a59fa3c 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -812,6 +812,17 @@ impl<'a> Builder<'a> { cargo.env("RUST_CHECK", "1"); } + match mode { + Mode::Std | Mode::Test | Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolTest=> {}, + Mode::Rustc | Mode::Codegen | Mode::ToolRustc => { + // Build proc macros both for the host and the target + if target != compiler.host && cmd != "check" { + cargo.arg("-Zdual-proc-macros"); + cargo.env("RUST_DUAL_PROC_MACROS", "1"); + } + }, + } + cargo.arg("-j").arg(self.jobs().to_string()); // Remove make-related flags to ensure Cargo can correctly set things up cargo.env_remove("MAKEFLAGS"); diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 20370372082b..a30b465698e2 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -42,7 +42,8 @@ impl Step for Std { true); let libdir = builder.sysroot_libdir(compiler, target); - add_to_sysroot(&builder, &libdir, &libstd_stamp(builder, compiler, target)); + let hostdir = builder.sysroot_libdir(compiler, compiler.host); + add_to_sysroot(&builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target)); } } @@ -88,7 +89,8 @@ impl Step for Rustc { true); let libdir = builder.sysroot_libdir(compiler, target); - add_to_sysroot(&builder, &libdir, &librustc_stamp(builder, compiler, target)); + let hostdir = builder.sysroot_libdir(compiler, compiler.host); + add_to_sysroot(&builder, &libdir, &hostdir, &librustc_stamp(builder, compiler, target)); } } @@ -175,7 +177,8 @@ impl Step for Test { true); let libdir = builder.sysroot_libdir(compiler, target); - add_to_sysroot(builder, &libdir, &libtest_stamp(builder, compiler, target)); + let hostdir = builder.sysroot_libdir(compiler, compiler.host); + add_to_sysroot(builder, &libdir, &hostdir, &libtest_stamp(builder, compiler, target)); } } @@ -222,7 +225,8 @@ impl Step for Rustdoc { true); let libdir = builder.sysroot_libdir(compiler, target); - add_to_sysroot(&builder, &libdir, &rustdoc_stamp(builder, compiler, target)); + let hostdir = builder.sysroot_libdir(compiler, compiler.host); + add_to_sysroot(&builder, &libdir, &hostdir, &rustdoc_stamp(builder, compiler, target)); builder.cargo(compiler, Mode::ToolRustc, target, "clean"); } } diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 249a18318904..9498dbb59523 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -224,7 +224,8 @@ impl Step for StdLink { target_compiler.host, target)); let libdir = builder.sysroot_libdir(target_compiler, target); - add_to_sysroot(builder, &libdir, &libstd_stamp(builder, compiler, target)); + let hostdir = builder.sysroot_libdir(target_compiler, compiler.host); + add_to_sysroot(builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target)); if builder.config.sanitizers && compiler.stage != 0 && target == "x86_64-apple-darwin" { // The sanitizers are only built in stage1 or above, so the dylibs will @@ -431,8 +432,12 @@ impl Step for TestLink { &compiler.host, target_compiler.host, target)); - add_to_sysroot(builder, &builder.sysroot_libdir(target_compiler, target), - &libtest_stamp(builder, compiler, target)); + add_to_sysroot( + builder, + &builder.sysroot_libdir(target_compiler, target), + &builder.sysroot_libdir(target_compiler, compiler.host), + &libtest_stamp(builder, compiler, target) + ); builder.cargo(target_compiler, Mode::ToolTest, target, "clean"); } @@ -496,8 +501,8 @@ impl Step for Rustc { return; } - // Ensure that build scripts have a std to link against. - builder.ensure(Std { + // Ensure that build scripts and proc macros have a std / libproc_macro to link against. + builder.ensure(Test { compiler: builder.compiler(self.compiler.stage, builder.config.build), target: builder.config.build, }); @@ -592,8 +597,12 @@ impl Step for RustcLink { &compiler.host, target_compiler.host, target)); - add_to_sysroot(builder, &builder.sysroot_libdir(target_compiler, target), - &librustc_stamp(builder, compiler, target)); + add_to_sysroot( + builder, + &builder.sysroot_libdir(target_compiler, target), + &builder.sysroot_libdir(target_compiler, compiler.host), + &librustc_stamp(builder, compiler, target) + ); builder.cargo(target_compiler, Mode::ToolRustc, target, "clean"); } } @@ -1015,10 +1024,20 @@ impl Step for Assemble { /// /// For a particular stage this will link the file listed in `stamp` into the /// `sysroot_dst` provided. -pub fn add_to_sysroot(builder: &Builder<'_>, sysroot_dst: &Path, stamp: &Path) { +pub fn add_to_sysroot( + builder: &Builder<'_>, + sysroot_dst: &Path, + sysroot_host_dst: &Path, + stamp: &Path +) { t!(fs::create_dir_all(&sysroot_dst)); - for path in builder.read_stamp_file(stamp) { - builder.copy(&path, &sysroot_dst.join(path.file_name().unwrap())); + t!(fs::create_dir_all(&sysroot_host_dst)); + for (path, host) in builder.read_stamp_file(stamp) { + if host { + builder.copy(&path, &sysroot_host_dst.join(path.file_name().unwrap())); + } else { + builder.copy(&path, &sysroot_dst.join(path.file_name().unwrap())); + } } } @@ -1047,8 +1066,14 @@ pub fn run_cargo(builder: &Builder<'_>, let mut deps = Vec::new(); let mut toplevel = Vec::new(); let ok = stream_cargo(builder, cargo, &mut |msg| { - let filenames = match msg { - CargoMessage::CompilerArtifact { filenames, .. } => filenames, + let (filenames, crate_types) = match msg { + CargoMessage::CompilerArtifact { + filenames, + target: CargoTarget { + crate_types, + }, + .. + } => (filenames, crate_types), _ => return, }; for filename in filenames { @@ -1063,15 +1088,19 @@ pub fn run_cargo(builder: &Builder<'_>, let filename = Path::new(&*filename); // If this was an output file in the "host dir" we don't actually - // worry about it, it's not relevant for us. + // worry about it, it's not relevant for us if filename.starts_with(&host_root_dir) { + // Unless it's a proc macro used in the compiler + if crate_types.iter().any(|t| t == "proc-macro") { + deps.push((filename.to_path_buf(), true)); + } continue; } // If this was output in the `deps` dir then this is a precise file // name (hash included) so we start tracking it. if filename.starts_with(&target_deps_dir) { - deps.push(filename.to_path_buf()); + deps.push((filename.to_path_buf(), false)); continue; } @@ -1124,10 +1153,10 @@ pub fn run_cargo(builder: &Builder<'_>, let candidate = format!("{}.lib", path_to_add); let candidate = PathBuf::from(candidate); if candidate.exists() { - deps.push(candidate); + deps.push((candidate, false)); } } - deps.push(path_to_add.into()); + deps.push((path_to_add.into(), false)); } // Now we want to update the contents of the stamp file, if necessary. First @@ -1140,12 +1169,13 @@ pub fn run_cargo(builder: &Builder<'_>, let mut new_contents = Vec::new(); let mut max = None; let mut max_path = None; - for dep in deps.iter() { + for (dep, proc_macro) in deps.iter() { let mtime = mtime(dep); if Some(mtime) > max { max = Some(mtime); max_path = Some(dep.clone()); } + new_contents.extend(if *proc_macro { b"h" } else { b"t" }); new_contents.extend(dep.to_str().unwrap().as_bytes()); new_contents.extend(b"\0"); } @@ -1157,7 +1187,7 @@ pub fn run_cargo(builder: &Builder<'_>, if contents_equal && max <= stamp_mtime { builder.verbose(&format!("not updating {:?}; contents equal and {:?} <= {:?}", stamp, max, stamp_mtime)); - return deps + return deps.into_iter().map(|(d, _)| d).collect() } if max > stamp_mtime { builder.verbose(&format!("updating {:?} as {:?} changed", stamp, max_path)); @@ -1165,7 +1195,7 @@ pub fn run_cargo(builder: &Builder<'_>, builder.verbose(&format!("updating {:?} as deps changed", stamp)); } t!(fs::write(&stamp, &new_contents)); - deps + deps.into_iter().map(|(d, _)| d).collect() } pub fn stream_cargo( @@ -1211,6 +1241,11 @@ pub fn stream_cargo( status.success() } +#[derive(Deserialize)] +pub struct CargoTarget<'a> { + crate_types: Vec>, +} + #[derive(Deserialize)] #[serde(tag = "reason", rename_all = "kebab-case")] pub enum CargoMessage<'a> { @@ -1218,6 +1253,7 @@ pub enum CargoMessage<'a> { package_id: Cow<'a, str>, features: Vec>, filenames: Vec>, + target: CargoTarget<'a>, }, BuildScriptExecuted { package_id: Cow<'a, str>, diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 84e2c5aab54a..9317a40545ea 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -1129,7 +1129,7 @@ impl Build { ret } - fn read_stamp_file(&self, stamp: &Path) -> Vec { + fn read_stamp_file(&self, stamp: &Path) -> Vec<(PathBuf, bool)> { if self.config.dry_run { return Vec::new(); } @@ -1142,8 +1142,9 @@ impl Build { if part.is_empty() { continue } - let path = PathBuf::from(t!(str::from_utf8(part))); - paths.push(path); + let host = part[0] as char == 'h'; + let path = PathBuf::from(t!(str::from_utf8(&part[1..]))); + paths.push((path, host)); } paths } diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 51412f79c3d0..6e37bf334526 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -213,7 +213,7 @@ impl Step for Cargo { }); let mut cargo = tool::prepare_tool_cargo(builder, compiler, - Mode::ToolRustc, + Mode::ToolStd, self.host, "test", "src/tools/cargo", diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index fc1a17d54667..b12ccc4f39d8 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -91,7 +91,8 @@ impl Step for ToolBuild { compile::CargoMessage::CompilerArtifact { package_id, features, - filenames + filenames, + target: _, } => { (package_id, features, filenames) } @@ -513,7 +514,7 @@ impl Step for Cargo { compiler: self.compiler, target: self.target, tool: "cargo", - mode: Mode::ToolRustc, + mode: Mode::ToolStd, path: "src/tools/cargo", is_optional_tool: false, source_type: SourceType::Submodule, From 70156fbb752d5c8726c6c47104922575164a92e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Mon, 28 Jan 2019 23:40:14 +0100 Subject: [PATCH 206/381] Encode proc macro stability --- src/librustc_metadata/decoder.rs | 2 +- src/librustc_metadata/encoder.rs | 6 +++++- src/librustc_metadata/schema.rs | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 1c4e3bc6a50e..6fe00a4ad2ff 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -648,7 +648,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_stability(&self, id: DefIndex) -> Option { match self.is_proc_macro(id) { - true => None, + true => self.root.proc_macro_stability.clone(), false => self.entry(id).stability.map(|stab| stab.decode(self)), } } diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index f79cfa3b773e..683056c9b33a 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -490,7 +490,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { } else { None }, - + proc_macro_stability: if is_proc_macro { + tcx.lookup_stability(DefId::local(CRATE_DEF_INDEX)).map(|stab| stab.clone()) + } else { + None + }, compiler_builtins: attr::contains_name(&attrs, "compiler_builtins"), needs_allocator: attr::contains_name(&attrs, "needs_allocator"), needs_panic_runtime: attr::contains_name(&attrs, "needs_panic_runtime"), diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index af79ea37dff5..afeea9947b5e 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -187,6 +187,7 @@ pub struct CrateRoot { pub has_default_lib_allocator: bool, pub plugin_registrar_fn: Option, pub proc_macro_decls_static: Option, + pub proc_macro_stability: Option, pub crate_deps: LazySeq, pub dylib_dependency_formats: LazySeq>, From 10d2008c510f088186234dbd2e43c2ba77b5e954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sun, 16 Dec 2018 04:44:12 +0100 Subject: [PATCH 207/381] Add ignore and project attributes --- src/librustc_macros/src/hash_stable.rs | 64 ++++++++++++++++++++++++-- src/librustc_macros/src/lib.rs | 2 +- 2 files changed, 61 insertions(+), 5 deletions(-) diff --git a/src/librustc_macros/src/hash_stable.rs b/src/librustc_macros/src/hash_stable.rs index 86ac0b353e5f..585f5505f1fe 100644 --- a/src/librustc_macros/src/hash_stable.rs +++ b/src/librustc_macros/src/hash_stable.rs @@ -1,13 +1,69 @@ use synstructure; -use syn; -use proc_macro2; +use syn::{self, Meta, NestedMeta}; +use proc_macro2::{self, Ident, Span}; + +struct Attributes { + ignore: bool, + project: Option, +} + +fn parse_attributes(field: &syn::Field) -> Attributes { + let mut attrs = Attributes { + ignore: false, + project: None, + }; + for attr in &field.attrs { + if let Ok(meta) = attr.parse_meta() { + if &meta.name().to_string() != "stable_hasher" { + continue; + } + let mut any_attr = false; + if let Meta::List(list) = meta { + for nested in list.nested.iter() { + if let NestedMeta::Meta(meta) = nested { + if &meta.name().to_string() == "ignore" { + attrs.ignore = true; + any_attr = true; + } + if &meta.name().to_string() == "project" { + if let Meta::List(list) = meta { + if let Some(nested) = list.nested.iter().next() { + if let NestedMeta::Meta(meta) = nested { + attrs.project = Some(meta.name().to_string()); + any_attr = true; + } + } + } + } + } + } + } + if !any_attr { + panic!("error parsing stable_hasher"); + } + } + } + attrs +} pub fn hash_stable_derive(mut s: synstructure::Structure) -> proc_macro2::TokenStream { let generic: syn::GenericParam = parse_quote!('__ctx); s.add_bounds(synstructure::AddBounds::Generics); s.add_impl_generic(generic); - let body = s.each(|bi| quote!{ - ::rustc_data_structures::stable_hasher::HashStable::hash_stable(#bi, __hcx, __hasher); + let body = s.each(|bi| { + let attrs = parse_attributes(bi.ast()); + if attrs.ignore { + quote!{} + } else if let Some(project) = attrs.project { + let project = Ident::new(&project, Span::call_site()); + quote!{ + &#bi.#project.hash_stable(__hcx, __hasher); + } + } else { + quote!{ + #bi.hash_stable(__hcx, __hasher); + } + } }); let discriminant = match s.ast().data { diff --git a/src/librustc_macros/src/lib.rs b/src/librustc_macros/src/lib.rs index 8dcf2b76fad2..460b415c5375 100644 --- a/src/librustc_macros/src/lib.rs +++ b/src/librustc_macros/src/lib.rs @@ -11,4 +11,4 @@ extern crate proc_macro2; mod hash_stable; -decl_derive!([HashStable] => hash_stable::hash_stable_derive); +decl_derive!([HashStable, attributes(stable_hasher)] => hash_stable::hash_stable_derive); From 74b6419bb66d9d32dac2a9994a1080f8d1b138d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Fri, 1 Mar 2019 01:22:10 +0100 Subject: [PATCH 208/381] Update Cargo.lock --- Cargo.lock | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 19dadaa14005..ad4af76f4b38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2365,6 +2365,7 @@ dependencies = [ "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "rustc_fs_util 0.0.0", + "rustc_macros 0.1.0", "rustc_target 0.0.0", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", @@ -2817,6 +2818,16 @@ dependencies = [ "core 0.0.0", ] +[[package]] +name = "rustc_macros" +version = "0.1.0" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc_metadata" version = "0.0.0" From cd9a0cf53776cc2b36898a530d20b6046875a510 Mon Sep 17 00:00:00 2001 From: Gabriela Alexandra Moldovan Date: Mon, 4 Mar 2019 16:56:57 +0000 Subject: [PATCH 209/381] Make the lifetime parameters of tcx consistent. --- src/librustc_codegen_llvm/lib.rs | 4 ++-- src/librustc_codegen_ssa/traits/backend.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 5b8c7461bcb6..258391ba8360 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -123,9 +123,9 @@ impl ExtraBackendMethods for LlvmCodegenBackend { ) -> EncodedMetadata { base::write_metadata(tcx, metadata) } - fn codegen_allocator( + fn codegen_allocator<'b, 'gcx>( &self, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'b, 'gcx, 'gcx>, mods: &mut ModuleLlvm, kind: AllocatorKind ) { diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index 00eae9098e74..a9e0eadb198a 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -38,9 +38,9 @@ pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Se tcx: TyCtxt<'b, 'gcx, 'gcx>, metadata: &mut Self::Module, ) -> EncodedMetadata; - fn codegen_allocator( + fn codegen_allocator<'b, 'gcx>( &self, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'b, 'gcx, 'gcx>, mods: &mut Self::Module, kind: AllocatorKind ); From cbe33441e08825201e583ce081da0eb4f24ee986 Mon Sep 17 00:00:00 2001 From: Taeguk Kwon Date: Thu, 7 Feb 2019 23:06:41 +0900 Subject: [PATCH 210/381] Add librustc, libsyntax to rust-src distribution. --- src/bootstrap/dist.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index d9bf95d13ac1..c06d5b7c3d6a 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -904,6 +904,8 @@ impl Step for Src { "src/stdsimd", "src/libproc_macro", "src/tools/rustc-std-workspace-core", + "src/librustc", + "src/libsyntax", ]; copy_src_dirs(builder, &std_src_dirs[..], &[], &dst_src); From cdbae165162653a58c38100823f182ac665b82de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Tue, 5 Mar 2019 05:53:16 +0100 Subject: [PATCH 211/381] Use Ident for project --- src/librustc_macros/src/hash_stable.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/librustc_macros/src/hash_stable.rs b/src/librustc_macros/src/hash_stable.rs index 585f5505f1fe..13899d68cd26 100644 --- a/src/librustc_macros/src/hash_stable.rs +++ b/src/librustc_macros/src/hash_stable.rs @@ -1,10 +1,10 @@ use synstructure; use syn::{self, Meta, NestedMeta}; -use proc_macro2::{self, Ident, Span}; +use proc_macro2::{self, Ident}; struct Attributes { ignore: bool, - project: Option, + project: Option, } fn parse_attributes(field: &syn::Field) -> Attributes { @@ -29,7 +29,7 @@ fn parse_attributes(field: &syn::Field) -> Attributes { if let Meta::List(list) = meta { if let Some(nested) = list.nested.iter().next() { if let NestedMeta::Meta(meta) = nested { - attrs.project = Some(meta.name().to_string()); + attrs.project = Some(meta.name()); any_attr = true; } } @@ -55,7 +55,6 @@ pub fn hash_stable_derive(mut s: synstructure::Structure) -> proc_macro2::TokenS if attrs.ignore { quote!{} } else if let Some(project) = attrs.project { - let project = Ident::new(&project, Span::call_site()); quote!{ &#bi.#project.hash_stable(__hcx, __hasher); } From 2983d9c154576dc5332d8870c39a2478d6b9f24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 4 Mar 2019 21:30:07 -0800 Subject: [PATCH 212/381] Elide invalid method receiver error when it contains TyErr Fix #58712. --- src/librustc_typeck/check/wfcheck.rs | 4 +++- src/test/ui/issues/issue-58712.rs | 15 +++++++++++++++ src/test/ui/issues/issue-58712.stderr | 15 +++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/issues/issue-58712.rs create mode 100644 src/test/ui/issues/issue-58712.stderr diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index b7c862a89a1b..1c764b724898 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -842,7 +842,9 @@ fn receiver_is_valid<'fcx, 'tcx, 'gcx>( } else { debug!("receiver_is_valid: type `{:?}` does not deref to `{:?}`", receiver_ty, self_ty); - return false + // If he receiver already has errors reported due to it, consider it valid to avoid + // unecessary errors (#58712). + return receiver_ty.references_error(); } // without the `arbitrary_self_types` feature, `receiver_ty` must directly deref to diff --git a/src/test/ui/issues/issue-58712.rs b/src/test/ui/issues/issue-58712.rs new file mode 100644 index 000000000000..577709cf2919 --- /dev/null +++ b/src/test/ui/issues/issue-58712.rs @@ -0,0 +1,15 @@ +struct AddrVec { + h: H, + a: A, +} + +impl AddrVec { + //~^ ERROR cannot find type `DeviceId` in this scope + pub fn device(&self) -> DeviceId { + //~^ ERROR cannot find type `DeviceId` in this scope + self.tail() + } +} + +fn main() {} + diff --git a/src/test/ui/issues/issue-58712.stderr b/src/test/ui/issues/issue-58712.stderr new file mode 100644 index 000000000000..6164ad7ee19b --- /dev/null +++ b/src/test/ui/issues/issue-58712.stderr @@ -0,0 +1,15 @@ +error[E0412]: cannot find type `DeviceId` in this scope + --> $DIR/issue-58712.rs:6:20 + | +LL | impl AddrVec { + | ^^^^^^^^ not found in this scope + +error[E0412]: cannot find type `DeviceId` in this scope + --> $DIR/issue-58712.rs:8:29 + | +LL | pub fn device(&self) -> DeviceId { + | ^^^^^^^^ not found in this scope + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0412`. From 33a64699b1f630640a7281be6493643904e5daa4 Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Tue, 5 Mar 2019 09:06:24 +0000 Subject: [PATCH 213/381] Unrolled await macro. Was then able to the minimise the reproduction a little further. --- .../issue-57084.rs} | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename src/test/run-pass/{issues/issue-57084-async-await.rs => generator/issue-57084.rs} (62%) diff --git a/src/test/run-pass/issues/issue-57084-async-await.rs b/src/test/run-pass/generator/issue-57084.rs similarity index 62% rename from src/test/run-pass/issues/issue-57084-async-await.rs rename to src/test/run-pass/generator/issue-57084.rs index feed68b5db10..38c86dccb808 100644 --- a/src/test/run-pass/issues/issue-57084-async-await.rs +++ b/src/test/run-pass/generator/issue-57084.rs @@ -1,7 +1,7 @@ // This issue reproduces an ICE on compile (E.g. fails on 2018-12-19 nightly). // run-pass // edition:2018 -#![feature(async_await,futures_api,await_macro,generators)] +#![feature(async_await,futures_api,generators)] pub struct Foo; @@ -16,12 +16,12 @@ impl Foo { } } - pub async fn run<'a>(&'a self, data: &'a [u8]) + pub async fn run<'a>(&'a self, data: &'a [u8]) { - await!(self.with(move || { - println!("{:p}", data); - })) + let _to_pin = self.with(move || println!("{:p}", data)); + loop { + yield + } } } - fn main() {} From 9902f8c3c2e89c87ab25a543e12c851bef955608 Mon Sep 17 00:00:00 2001 From: Saleem Jaffer Date: Sat, 23 Feb 2019 16:11:34 +0530 Subject: [PATCH 214/381] fixes rust-lang#52482 --- src/librustc/ty/context.rs | 34 ++++++++++++------------- src/librustc_mir/hair/cx/expr.rs | 7 +---- src/librustc_passes/rvalue_promotion.rs | 17 +++++-------- src/librustc_typeck/check/cast.rs | 5 ++-- src/librustc_typeck/check/writeback.rs | 16 ++++-------- 5 files changed, 32 insertions(+), 47 deletions(-) diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index b37b632f4bee..621a59611837 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -40,7 +40,7 @@ use crate::ty::steal::Steal; use crate::ty::subst::{UserSubsts, UnpackedKind}; use crate::ty::{BoundVar, BindingMode}; use crate::ty::CanonicalPolyFnSig; -use crate::util::nodemap::{DefIdMap, DefIdSet, ItemLocalMap}; +use crate::util::nodemap::{DefIdMap, DefIdSet, ItemLocalMap, ItemLocalSet}; use crate::util::nodemap::{FxHashMap, FxHashSet}; use errors::DiagnosticBuilder; use rustc_data_structures::interner::HashInterner; @@ -409,9 +409,9 @@ pub struct TypeckTables<'tcx> { /// MIR construction and hence is not serialized to metadata. fru_field_types: ItemLocalMap>>, - /// Maps a cast expression to its kind. This is keyed on the - /// *from* expression of the cast, not the cast itself. - cast_kinds: ItemLocalMap, + /// For every coercion cast we add the HIR node ID of the cast + /// expression to this set. + coercion_casts: ItemLocalSet, /// Set of trait imports actually used in the method resolution. /// This is used for warning unused imports. During type @@ -456,7 +456,7 @@ impl<'tcx> TypeckTables<'tcx> { closure_kind_origins: Default::default(), liberated_fn_sigs: Default::default(), fru_field_types: Default::default(), - cast_kinds: Default::default(), + coercion_casts: Default::default(), used_trait_imports: Lrc::new(Default::default()), tainted_by_errors: false, free_region_map: Default::default(), @@ -718,19 +718,19 @@ impl<'tcx> TypeckTables<'tcx> { } } - pub fn cast_kinds(&self) -> LocalTableInContext<'_, ty::cast::CastKind> { - LocalTableInContext { - local_id_root: self.local_id_root, - data: &self.cast_kinds - } + pub fn is_coercion_cast(&self, hir_id: hir::HirId) -> bool { + validate_hir_id_for_typeck_tables(self.local_id_root, hir_id, true); + self.coercion_casts.contains(&hir_id.local_id) } - pub fn cast_kinds_mut(&mut self) -> LocalTableInContextMut<'_, ty::cast::CastKind> { - LocalTableInContextMut { - local_id_root: self.local_id_root, - data: &mut self.cast_kinds - } + pub fn set_coercion_cast(&mut self, id: ItemLocalId) { + self.coercion_casts.insert(id); } + + pub fn coercion_casts(&self) -> &ItemLocalSet { + &self.coercion_casts + } + } impl<'a, 'gcx> HashStable> for TypeckTables<'gcx> { @@ -753,7 +753,7 @@ impl<'a, 'gcx> HashStable> for TypeckTables<'gcx> { ref liberated_fn_sigs, ref fru_field_types, - ref cast_kinds, + ref coercion_casts, ref used_trait_imports, tainted_by_errors, @@ -798,7 +798,7 @@ impl<'a, 'gcx> HashStable> for TypeckTables<'gcx> { closure_kind_origins.hash_stable(hcx, hasher); liberated_fn_sigs.hash_stable(hcx, hasher); fru_field_types.hash_stable(hcx, hasher); - cast_kinds.hash_stable(hcx, hasher); + coercion_casts.hash_stable(hcx, hasher); used_trait_imports.hash_stable(hcx, hasher); tainted_by_errors.hash_stable(hcx, hasher); free_region_map.hash_stable(hcx, hasher); diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 5548366db66e..ff5f3018acc0 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -8,7 +8,6 @@ use rustc::hir::def::{Def, CtorKind}; use rustc::mir::interpret::{GlobalId, ErrorHandled}; use rustc::ty::{self, AdtKind, Ty}; use rustc::ty::adjustment::{Adjustment, Adjust, AutoBorrow, AutoBorrowMutability}; -use rustc::ty::cast::CastKind as TyCastKind; use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::hir; use rustc::hir::def_id::LocalDefId; @@ -656,11 +655,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, // Check to see if this cast is a "coercion cast", where the cast is actually done // using a coercion (or is a no-op). - let cast = if let Some(&TyCastKind::CoercionCast) = - cx.tables() - .cast_kinds() - .get(source.hir_id) - { + let cast = if cx.tables().is_coercion_cast(source.hir_id) { // Convert the lexpr to a vexpr. ExprKind::Use { source: source.to_ref() } } else { diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 6b8e37b3b313..b0dd72030cc5 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -14,7 +14,7 @@ // - It's not possible to take the address of a static item with unsafe interior. This is enforced // by borrowck::gather_loans -use rustc::ty::cast::CastKind; +use rustc::ty::cast::CastTy; use rustc::hir::def::{Def, CtorKind}; use rustc::hir::def_id::DefId; use rustc::middle::expr_use_visitor as euv; @@ -319,15 +319,12 @@ fn check_expr_kind<'a, 'tcx>( hir::ExprKind::Cast(ref from, _) => { let expr_promotability = v.check_expr(from); debug!("Checking const cast(id={})", from.hir_id); - match v.tables.cast_kinds().get(from.hir_id) { - None => { - v.tcx.sess.delay_span_bug(e.span, "no kind for cast"); - NotPromotable - }, - Some(&CastKind::PtrAddrCast) | Some(&CastKind::FnPtrAddrCast) => { - NotPromotable - } - _ => expr_promotability + let cast_in = CastTy::from_ty(v.tables.expr_ty(from)); + let cast_out = CastTy::from_ty(v.tables.expr_ty(e)); + match (cast_in, cast_out) { + (Some(CastTy::FnPtr), Some(CastTy::Int(_))) | + (Some(CastTy::Ptr(_)), Some(CastTy::Int(_))) => NotPromotable, + (_, _) => expr_promotability } } hir::ExprKind::Path(ref qpath) => { diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index 87276b8c66ca..cad9e73bd2ac 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -428,13 +428,12 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { } else if self.try_coercion_cast(fcx) { self.trivial_cast_lint(fcx); debug!(" -> CoercionCast"); - fcx.tables.borrow_mut().cast_kinds_mut().insert(self.expr.hir_id, - CastKind::CoercionCast); + fcx.tables.borrow_mut().set_coercion_cast(self.expr.hir_id.local_id); + } else { match self.do_check(fcx) { Ok(k) => { debug!(" -> {:?}", k); - fcx.tables.borrow_mut().cast_kinds_mut().insert(self.expr.hir_id, k); } Err(e) => self.report_cast_error(fcx, e), }; diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 7c1283a6d210..73eadf6f275d 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -50,7 +50,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { wbcx.visit_liberated_fn_sigs(); wbcx.visit_fru_field_types(); wbcx.visit_opaque_types(body.value.span); - wbcx.visit_cast_types(); + wbcx.visit_coercion_casts(); wbcx.visit_free_region_map(); wbcx.visit_user_provided_tys(); wbcx.visit_user_provided_sigs(); @@ -355,19 +355,13 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { } } - fn visit_cast_types(&mut self) { + fn visit_coercion_casts(&mut self) { let fcx_tables = self.fcx.tables.borrow(); - let fcx_cast_kinds = fcx_tables.cast_kinds(); + let fcx_coercion_casts = fcx_tables.coercion_casts(); debug_assert_eq!(fcx_tables.local_id_root, self.tables.local_id_root); - let mut self_cast_kinds = self.tables.cast_kinds_mut(); - let common_local_id_root = fcx_tables.local_id_root.unwrap(); - for (&local_id, &cast_kind) in fcx_cast_kinds.iter() { - let hir_id = hir::HirId { - owner: common_local_id_root.index, - local_id, - }; - self_cast_kinds.insert(hir_id, cast_kind); + for local_id in fcx_coercion_casts { + self.tables.set_coercion_cast(*local_id); } } From c0cef3344f4bf0681c9bc4737abe6ce8efebd621 Mon Sep 17 00:00:00 2001 From: Hadley Canine Date: Tue, 5 Mar 2019 14:52:38 +0000 Subject: [PATCH 215/381] Remove JSBackend from config.toml JSBackend is implied when building the emscripten backend, and not available for the standard llvm backend. This commit also puts the example config in sync with the defaults in src/bootstrap/native.rs --- config.toml.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.toml.example b/config.toml.example index 8f6bf03489f0..0631d7c83eaf 100644 --- a/config.toml.example +++ b/config.toml.example @@ -61,7 +61,7 @@ # support. You'll need to write a target specification at least, and most # likely, teach rustc about the C ABI of the target. Get in touch with the # Rust team and file an issue if you need assistance in porting! -#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon" +#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;MSP430;Sparc;NVPTX;Hexagon" # LLVM experimental targets to build support for. These targets are specified in # the same format as above, but since these targets are experimental, they are From fcec51d1efb9f2c445d503d0e7f8837088190d09 Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Tue, 5 Mar 2019 17:47:23 +0000 Subject: [PATCH 216/381] Removed whitespace --- src/test/run-pass/generator/issue-57084.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/run-pass/generator/issue-57084.rs b/src/test/run-pass/generator/issue-57084.rs index 38c86dccb808..f6bc93cd9375 100644 --- a/src/test/run-pass/generator/issue-57084.rs +++ b/src/test/run-pass/generator/issue-57084.rs @@ -16,7 +16,7 @@ impl Foo { } } - pub async fn run<'a>(&'a self, data: &'a [u8]) + pub async fn run<'a>(&'a self, data: &'a [u8]) { let _to_pin = self.with(move || println!("{:p}", data)); loop { From 1675212eceb759039229834768e4c4b630998245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Tue, 5 Mar 2019 18:53:23 +0100 Subject: [PATCH 217/381] Move locate_ctxt back --- src/librustc_metadata/creader.rs | 42 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 600ec8d65b63..36d9bf9f50dd 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -347,31 +347,31 @@ impl<'a> CrateLoader<'a> { mut dep_kind: DepKind, ) -> Result<(CrateNum, Lrc), LoadError<'b>> { info!("resolving crate `extern crate {} as {}`", name, ident); - let mut locate_ctxt = locator::Context { - sess: self.sess, - span, - ident, - crate_name: name, - hash: hash.map(|a| &*a), - extra_filename: extra_filename, - filesearch: self.sess.target_filesearch(path_kind), - target: &self.sess.target.target, - triple: self.sess.opts.target_triple.clone(), - root, - rejected_via_hash: vec![], - rejected_via_triple: vec![], - rejected_via_kind: vec![], - rejected_via_version: vec![], - rejected_via_filename: vec![], - should_match_name: true, - is_proc_macro: Some(false), - metadata_loader: &*self.cstore.metadata_loader, - }; - let result = if let Some(cnum) = self.existing_match(name, hash, path_kind) { (LoadResult::Previous(cnum), None) } else { info!("falling back to a load"); + let mut locate_ctxt = locator::Context { + sess: self.sess, + span, + ident, + crate_name: name, + hash: hash.map(|a| &*a), + extra_filename: extra_filename, + filesearch: self.sess.target_filesearch(path_kind), + target: &self.sess.target.target, + triple: self.sess.opts.target_triple.clone(), + root, + rejected_via_hash: vec![], + rejected_via_triple: vec![], + rejected_via_kind: vec![], + rejected_via_version: vec![], + rejected_via_filename: vec![], + should_match_name: true, + is_proc_macro: Some(false), + metadata_loader: &*self.cstore.metadata_loader, + }; + self.load(&mut locate_ctxt).map(|r| (r, None)).or_else(|| { dep_kind = DepKind::UnexportedMacrosOnly; self.load_proc_macro(&mut locate_ctxt, path_kind) From 12a491fbe27eaed8200190aae017759e80cabad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Tue, 5 Mar 2019 19:27:50 +0100 Subject: [PATCH 218/381] Make rustc_macro a Rust 2018 crate --- src/librustc/lib.rs | 11 ++--------- src/librustc_macros/Cargo.toml | 3 ++- src/librustc_macros/src/hash_stable.rs | 5 +++-- src/librustc_macros/src/lib.rs | 10 ++-------- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index e1f6e1caeae9..6adfaa53946a 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -141,15 +141,8 @@ pub mod util { pub mod bug; } -// A private module so that macro-expanded idents like -// `::rustc::lint::Lint` will also work in `rustc` itself. -// -// `libstd` uses the same trick. -#[doc(hidden)] -mod rustc { - pub use crate::lint; - pub use crate::ich; -} +// Allows macros to refer to this crate as `::rustc` +extern crate self as rustc; // FIXME(#27438): right now the unit tests of librustc don't refer to any actual // functions generated in librustc_data_structures (all diff --git a/src/librustc_macros/Cargo.toml b/src/librustc_macros/Cargo.toml index c5e01e9e0a76..2fe51a22fb48 100644 --- a/src/librustc_macros/Cargo.toml +++ b/src/librustc_macros/Cargo.toml @@ -2,6 +2,7 @@ name = "rustc_macros" version = "0.1.0" authors = ["The Rust Project Developers"] +edition = "2018" [lib] proc-macro = true @@ -10,4 +11,4 @@ proc-macro = true synstructure = "0.10.1" syn = { version = "0.15.22", features = ["full"] } proc-macro2 = "0.4.24" -quote = "0.6.10" \ No newline at end of file +quote = "0.6.10" diff --git a/src/librustc_macros/src/hash_stable.rs b/src/librustc_macros/src/hash_stable.rs index 13899d68cd26..6d7590c7d1cd 100644 --- a/src/librustc_macros/src/hash_stable.rs +++ b/src/librustc_macros/src/hash_stable.rs @@ -1,6 +1,7 @@ use synstructure; -use syn::{self, Meta, NestedMeta}; +use syn::{self, Meta, NestedMeta, parse_quote}; use proc_macro2::{self, Ident}; +use quote::quote; struct Attributes { ignore: bool, @@ -46,7 +47,7 @@ fn parse_attributes(field: &syn::Field) -> Attributes { attrs } -pub fn hash_stable_derive(mut s: synstructure::Structure) -> proc_macro2::TokenStream { +pub fn hash_stable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { let generic: syn::GenericParam = parse_quote!('__ctx); s.add_bounds(synstructure::AddBounds::Generics); s.add_impl_generic(generic); diff --git a/src/librustc_macros/src/lib.rs b/src/librustc_macros/src/lib.rs index 460b415c5375..cad31264b05a 100644 --- a/src/librustc_macros/src/lib.rs +++ b/src/librustc_macros/src/lib.rs @@ -1,13 +1,7 @@ #![feature(proc_macro_hygiene)] +#![deny(rust_2018_idioms)] -#[macro_use] -extern crate syn; -#[macro_use] -extern crate synstructure; -#[macro_use] -extern crate quote; -extern crate proc_macro; -extern crate proc_macro2; +use synstructure::decl_derive; mod hash_stable; From 8052a4e5ac2c0bd6cf305cd463e105dc462d4792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Tue, 5 Mar 2019 19:28:20 +0100 Subject: [PATCH 219/381] Add a test for HashStable stability --- .../ui-fulldeps/hash-stable-is-unstable.rs | 15 ++++++ .../hash-stable-is-unstable.stderr | 48 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 src/test/ui-fulldeps/hash-stable-is-unstable.rs create mode 100644 src/test/ui-fulldeps/hash-stable-is-unstable.stderr diff --git a/src/test/ui-fulldeps/hash-stable-is-unstable.rs b/src/test/ui-fulldeps/hash-stable-is-unstable.rs new file mode 100644 index 000000000000..9f67f642df1c --- /dev/null +++ b/src/test/ui-fulldeps/hash-stable-is-unstable.rs @@ -0,0 +1,15 @@ +// ignore-stage1 + +extern crate rustc_data_structures; +//~^ use of unstable library feature 'rustc_private' +extern crate rustc; +//~^ use of unstable library feature 'rustc_private' +extern crate rustc_macros; +//~^ use of unstable library feature 'rustc_private' + +use rustc_macros::HashStable; +//~^ use of unstable library feature 'rustc_private' + +#[derive(HashStable)] +//~^ use of unstable library feature 'rustc_private' +struct Test; diff --git a/src/test/ui-fulldeps/hash-stable-is-unstable.stderr b/src/test/ui-fulldeps/hash-stable-is-unstable.stderr new file mode 100644 index 000000000000..e7007204d389 --- /dev/null +++ b/src/test/ui-fulldeps/hash-stable-is-unstable.stderr @@ -0,0 +1,48 @@ +error[E0601]: `main` function not found in crate `hash_stable_is_unstable` + | + = note: consider adding a `main` function to `$DIR/hash-stable-is-unstable.rs` + +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? (see issue #27812) + --> $DIR/hash-stable-is-unstable.rs:3:1 + | +LL | extern crate rustc_data_structures; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(rustc_private)] to the crate attributes to enable + +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? (see issue #27812) + --> $DIR/hash-stable-is-unstable.rs:5:1 + | +LL | extern crate rustc; + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(rustc_private)] to the crate attributes to enable + +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? (see issue #27812) + --> $DIR/hash-stable-is-unstable.rs:7:1 + | +LL | extern crate rustc_macros; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(rustc_private)] to the crate attributes to enable + +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? (see issue #27812) + --> $DIR/hash-stable-is-unstable.rs:10:5 + | +LL | use rustc_macros::HashStable; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(rustc_private)] to the crate attributes to enable + +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? (see issue #27812) + --> $DIR/hash-stable-is-unstable.rs:13:10 + | +LL | #[derive(HashStable)] + | ^^^^^^^^^^ + | + = help: add #![feature(rustc_private)] to the crate attributes to enable + +error: aborting due to 6 previous errors + +Some errors occurred: E0601, E0658. +For more information about an error, try `rustc --explain E0601`. From e28cf7416207111308bdd0a91196d99b009f031c Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Tue, 5 Mar 2019 14:18:26 -0600 Subject: [PATCH 220/381] remove unused Display impl --- src/librustdoc/passes/calculate_doc_coverage.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs index 6e0238b7a4d5..04f403888c1f 100644 --- a/src/librustdoc/passes/calculate_doc_coverage.rs +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -7,7 +7,6 @@ use syntax::attr; use syntax_pos::FileName; use std::collections::BTreeMap; -use std::fmt; use std::ops; pub const CALCULATE_DOC_COVERAGE: Pass = Pass { @@ -67,12 +66,6 @@ impl ops::AddAssign for ItemCount { } } -impl fmt::Display for ItemCount { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}/{}", self.with_docs, self.total) - } -} - #[derive(Default)] struct CoverageCalculator { items: BTreeMap, From 3df0b895c1ba705bd4ecf110e3f6bdac7fe20953 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Tue, 5 Mar 2019 14:23:37 -0600 Subject: [PATCH 221/381] only print coverage pass lists if running on nightly --- src/librustdoc/config.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 5cbcc2433ba5..aeff78350d37 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -228,14 +228,18 @@ impl Options { for &name in passes::DEFAULT_PRIVATE_PASSES { println!("{:>20}", name); } - println!("\nPasses run with `--show-coverage`:"); - for &name in passes::DEFAULT_COVERAGE_PASSES { - println!("{:>20}", name); - } - println!("\nPasses run with `--show-coverage --document-private-items`:"); - for &name in passes::PRIVATE_COVERAGE_PASSES { - println!("{:>20}", name); + + if nightly_options::is_nightly_build() { + println!("\nPasses run with `--show-coverage`:"); + for &name in passes::DEFAULT_COVERAGE_PASSES { + println!("{:>20}", name); + } + println!("\nPasses run with `--show-coverage --document-private-items`:"); + for &name in passes::PRIVATE_COVERAGE_PASSES { + println!("{:>20}", name); + } } + return Err(0); } From 8ebc609eecd0d91fb593b7f6c1b5e578e3fed683 Mon Sep 17 00:00:00 2001 From: Nathan West Date: Tue, 5 Mar 2019 13:51:18 -0800 Subject: [PATCH 222/381] Add self to mailmap --- .mailmap | 1 + 1 file changed, 1 insertion(+) diff --git a/.mailmap b/.mailmap index d265f45c5caf..073308628494 100644 --- a/.mailmap +++ b/.mailmap @@ -161,6 +161,7 @@ Michael Woerister Mickaël Raybaud-Roig m-r-r Ms2ger Mukilan Thiagarajan +Nathan West Nathan Wilson Nathaniel Herman Nathaniel Herman Neil Pankey From 62f23c2b0b66fdda31ff03cc688d8baa5759cec0 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:09:29 +0000 Subject: [PATCH 223/381] Add Const generic param to ty Co-Authored-By: Gabriel Smith --- src/librustc/ty/mod.rs | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 1f897d29a1eb..bd3dd78c9bb6 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -837,7 +837,8 @@ pub enum GenericParamDefKind { has_default: bool, object_lifetime_default: ObjectLifetimeDefault, synthetic: Option, - } + }, + Const, } #[derive(Clone, RustcEncodable, RustcDecodable)] @@ -880,6 +881,7 @@ impl GenericParamDef { pub struct GenericParamCount { pub lifetimes: usize, pub types: usize, + pub consts: usize, } /// Information about the formal type/lifetime parameters associated @@ -915,6 +917,7 @@ impl<'a, 'gcx, 'tcx> Generics { match param.kind { GenericParamDefKind::Lifetime => own_counts.lifetimes += 1, GenericParamDefKind::Type { .. } => own_counts.types += 1, + GenericParamDefKind::Const => own_counts.consts += 1, }; } @@ -924,7 +927,7 @@ impl<'a, 'gcx, 'tcx> Generics { pub fn requires_monomorphization(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> bool { for param in &self.params { match param.kind { - GenericParamDefKind::Type { .. } => return true, + GenericParamDefKind::Type { .. } | GenericParamDefKind::Const => return true, GenericParamDefKind::Lifetime => {} } } @@ -944,7 +947,7 @@ impl<'a, 'gcx, 'tcx> Generics { if let Some(index) = param.index.checked_sub(self.parent_count as u32) { let param = &self.params[index as usize]; match param.kind { - ty::GenericParamDefKind::Lifetime => param, + GenericParamDefKind::Lifetime => param, _ => bug!("expected lifetime parameter, but found another generic parameter") } } else { @@ -961,7 +964,7 @@ impl<'a, 'gcx, 'tcx> Generics { if let Some(index) = param.idx.checked_sub(self.parent_count as u32) { let param = &self.params[index as usize]; match param.kind { - ty::GenericParamDefKind::Type {..} => param, + GenericParamDefKind::Type { .. } => param, _ => bug!("expected type parameter, but found another generic parameter") } } else { @@ -969,6 +972,23 @@ impl<'a, 'gcx, 'tcx> Generics { .type_param(param, tcx) } } + + /// Returns the `ConstParameterDef` associated with this `ParamConst`. + pub fn const_param(&'tcx self, + param: &ParamConst, + tcx: TyCtxt<'a, 'gcx, 'tcx>) + -> &GenericParamDef { + if let Some(index) = param.index.checked_sub(self.parent_count as u32) { + let param = &self.params[index as usize]; + match param.kind { + GenericParamDefKind::Const => param, + _ => bug!("expected const parameter, but found another generic parameter") + } + } else { + tcx.generics_of(self.parent.expect("parent_count>0 but no parent?")) + .const_param(param, tcx) + } + } } /// Bounds on generics. From 11c31bb1d390c2a32e7546ab303835bfa1d48b6a Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:09:52 +0000 Subject: [PATCH 224/381] Add ParamConst Co-Authored-By: Gabriel Smith --- src/librustc/ty/sty.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 3fd2e38a3d3e..2f77ad2f1803 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -1061,6 +1061,26 @@ impl<'a, 'gcx, 'tcx> ParamTy { } } +#[derive(Copy, Clone, Hash, RustcEncodable, RustcDecodable, Eq, PartialEq, Ord, PartialOrd)] +pub struct ParamConst { + pub index: u32, + pub name: InternedString, +} + +impl<'a, 'gcx, 'tcx> ParamConst { + pub fn new(index: u32, name: InternedString) -> ParamConst { + ParamConst { index, name } + } + + pub fn for_def(def: &ty::GenericParamDef) -> ParamConst { + ParamConst::new(def.index, def.name) + } + + pub fn to_const(self, tcx: TyCtxt<'a, 'gcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx LazyConst<'tcx> { + tcx.mk_const_param(self.index, self.name, ty) + } +} + /// A [De Bruijn index][dbi] is a standard means of representing /// regions (and perhaps later types) in a higher-ranked setting. In /// particular, imagine a type like this: From a36d386c6d08b6afbaf8316242218d9644b2ab82 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:10:03 +0000 Subject: [PATCH 225/381] Add ConstVid Co-Authored-By: Gabriel Smith --- src/librustc/ty/sty.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 2f77ad2f1803..afe3dc2300a8 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -16,6 +16,7 @@ use crate::mir::interpret::{Scalar, Pointer}; use smallvec::SmallVec; use std::iter; use std::cmp::Ordering; +use std::marker::PhantomData; use rustc_target::spec::abi; use syntax::ast::{self, Ident}; use syntax::symbol::{keywords, InternedString}; @@ -1249,6 +1250,12 @@ pub struct TyVid { pub index: u32, } +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] +pub struct ConstVid<'tcx> { + pub index: u32, + pub phantom: PhantomData<&'tcx ()>, +} + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] pub struct IntVid { pub index: u32, From 8cbbbaae6c1956d2c070e7f7447a9478adbf0dcd Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:10:11 +0000 Subject: [PATCH 226/381] Add InferConst Co-Authored-By: Gabriel Smith --- src/librustc/ty/sty.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index afe3dc2300a8..3b58cca38dd1 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -2228,3 +2228,14 @@ impl<'tcx> Const<'tcx> { } impl<'tcx> serialize::UseSpecializedDecodable for &'tcx LazyConst<'tcx> {} + +/// An inference variable for a const, for use in const generics. +#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash)] +pub enum InferConst<'tcx> { + /// Infer the value of the const. + Var(ConstVid<'tcx>), + /// A fresh const variable. See `infer::freshen` for more details. + Fresh(u32), + /// Canonicalized const variable, used only when preparing a trait query. + Canonical(DebruijnIndex, BoundVar), +} From 386e9fbda225bd04039a47caad9138983faff18c Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:10:22 +0000 Subject: [PATCH 227/381] Add type_flags helper methods to consts Co-Authored-By: Gabriel Smith --- src/librustc/ty/sty.rs | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 3b58cca38dd1..1aa4ca7ff97a 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -2110,6 +2110,22 @@ impl<'tcx> LazyConst<'tcx> { pub fn unwrap_usize(&self, tcx: TyCtxt<'_, '_, '_>) -> u64 { self.assert_usize(tcx).expect("expected `LazyConst` to contain a usize") } + + pub fn type_flags(&self) -> TypeFlags { + // FIXME(const_generics): incorporate substs flags. + let flags = match self { + LazyConst::Unevaluated(..) => { + TypeFlags::HAS_NORMALIZABLE_PROJECTION | TypeFlags::HAS_PROJECTION + } + LazyConst::Evaluated(c) => { + c.type_flags() + } + }; + + debug!("type_flags({:?}) = {:?}", self, flags); + + flags + } } /// Typed constant value. @@ -2225,6 +2241,33 @@ impl<'tcx> Const<'tcx> { self.assert_usize(tcx).unwrap_or_else(|| bug!("expected constant usize, got {:#?}", self)) } + + pub fn type_flags(&self) -> TypeFlags { + let mut flags = self.ty.flags; + + match self.val { + ConstValue::Param(_) => { + flags |= TypeFlags::HAS_FREE_LOCAL_NAMES; + flags |= TypeFlags::HAS_PARAMS; + } + ConstValue::Infer(infer) => { + flags |= TypeFlags::HAS_FREE_LOCAL_NAMES; + flags |= TypeFlags::HAS_CT_INFER; + match infer { + InferConst::Fresh(_) | + InferConst::Canonical(_, _) => {} + InferConst::Var(_) => { + flags |= TypeFlags::KEEP_IN_LOCAL_TCX; + } + } + } + _ => {} + } + + debug!("type_flags({:?}) = {:?}", self, flags); + + flags + } } impl<'tcx> serialize::UseSpecializedDecodable for &'tcx LazyConst<'tcx> {} From 2ce19ae3d196043281c7572290ee09f502d8384c Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:11:10 +0000 Subject: [PATCH 228/381] Use non_erasable_generics for codegen Co-Authored-By: Gabriel Smith --- src/librustc_codegen_llvm/callee.rs | 2 +- src/librustc_codegen_ssa/back/symbol_export.rs | 2 +- src/librustc_codegen_ssa/mir/operand.rs | 2 ++ src/librustc_codegen_utils/symbol_names.rs | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/librustc_codegen_llvm/callee.rs b/src/librustc_codegen_llvm/callee.rs index 43a5767e5c68..2d732adcb913 100644 --- a/src/librustc_codegen_llvm/callee.rs +++ b/src/librustc_codegen_llvm/callee.rs @@ -113,7 +113,7 @@ pub fn get_fn( unsafe { llvm::LLVMRustSetLinkage(llfn, llvm::Linkage::ExternalLinkage); - let is_generic = instance.substs.types().next().is_some(); + let is_generic = instance.substs.non_erasable_generics().next().is_some(); if is_generic { // This is a monomorphization. Its expected visibility depends diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index 7da28c19d241..336f41b784a8 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -263,7 +263,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def: InstanceDef::Item(def_id), substs, }) = mono_item { - if substs.types().next().is_some() { + if substs.non_erasable_generics().next().is_some() { symbols.push((ExportedSymbol::Generic(def_id, substs), SymbolExportLevel::Rust)); } diff --git a/src/librustc_codegen_ssa/mir/operand.rs b/src/librustc_codegen_ssa/mir/operand.rs index 0a6549851f44..55a1eb016e0d 100644 --- a/src/librustc_codegen_ssa/mir/operand.rs +++ b/src/librustc_codegen_ssa/mir/operand.rs @@ -76,6 +76,8 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> { } let val = match val.val { + ConstValue::Param(_) => bug!("encountered a ConstValue::Param in codegen"), + ConstValue::Infer(_) => bug!("encountered a ConstValue::Infer in codegen"), ConstValue::Scalar(x) => { let scalar = match layout.abi { layout::Abi::Scalar(ref x) => x, diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index f529cf30a62e..76e74e9e2b46 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -172,7 +172,7 @@ fn get_symbol_hash<'a, 'tcx>( assert!(!substs.needs_subst()); substs.hash_stable(&mut hcx, &mut hasher); - let is_generic = substs.types().next().is_some(); + let is_generic = substs.non_erasable_generics().next().is_some(); let avoid_cross_crate_conflicts = // If this is an instance of a generic function, we also hash in // the ID of the instantiating crate. This avoids symbol conflicts From 691d054e05e37ab000a78ddf580ccb8cc96a41e2 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:11:37 +0000 Subject: [PATCH 229/381] Take const generics into account when monomorphising Co-Authored-By: Gabriel Smith --- src/librustc_mir/monomorphize/collector.rs | 28 +++++++--- src/librustc_mir/monomorphize/item.rs | 52 ++++++++++++++----- src/librustc_mir/monomorphize/partitioning.rs | 2 +- 3 files changed, 60 insertions(+), 22 deletions(-) diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 1f20c70dec50..2ce3bf43cfc7 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -466,7 +466,17 @@ fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance<'tcx>) { let type_length = instance.substs.types().flat_map(|ty| ty.walk()).count(); - debug!(" => type length={}", type_length); + let const_length = instance.substs.consts() + .filter_map(|ct| { + if let ty::LazyConst::Evaluated(ct) = ct { + Some(ct.ty.walk()) + } else { + None + } + }) + .flatten() + .count(); + debug!(" => type length={}, const length={}", type_length, const_length); // Rust code can easily create exponentially-long types using only a // polynomial recursion depth. Even with the default recursion @@ -475,7 +485,9 @@ fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // // Bail out in these cases to avoid that bad user experience. let type_length_limit = *tcx.sess.type_length_limit.get(); - if type_length > type_length_limit { + // We include the const length in the type length, as it's better + // to be overly conservative. + if type_length + const_length > type_length_limit { // The instance name is already known to be too long for rustc. Use // `{:.64}` to avoid blasting the user's terminal with thousands of // lines of type-name. @@ -490,7 +502,7 @@ fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, diag.note(&format!( "consider adding a `#![type_length_limit=\"{}\"]` attribute to your crate", - type_length_limit*2)); + type_length_limit * 2)); diag.emit(); tcx.sess.abort_if_errors(); } @@ -759,10 +771,10 @@ fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: return false } - // If this instance has no type parameters, it cannot be a shared + // If this instance has non-erasable parameters, it cannot be a shared // monomorphization. Non-generic instances are already handled above // by `is_reachable_non_generic()` - if substs.types().next().is_none() { + if substs.non_erasable_generics().next().is_none() { return false } @@ -1113,14 +1125,16 @@ fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, continue; } - if tcx.generics_of(method.def_id).own_counts().types != 0 { + let counts = tcx.generics_of(method.def_id).own_counts(); + if counts.types + counts.consts != 0 { continue; } let substs = InternalSubsts::for_item(tcx, method.def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => tcx.types.re_erased.into(), - GenericParamDefKind::Type {..} => { + GenericParamDefKind::Type { .. } | + GenericParamDefKind::Const => { trait_ref.substs[param.index as usize] } } diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index 059af2dbba94..f0d19ec8bf2f 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -1,8 +1,9 @@ use crate::monomorphize::Instance; use rustc::hir; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; +use rustc::mir::interpret::ConstValue; use rustc::session::config::OptLevel; -use rustc::ty::{self, Ty, TyCtxt, ClosureSubsts, GeneratorSubsts}; +use rustc::ty::{self, Ty, TyCtxt, Const, ClosureSubsts, GeneratorSubsts, LazyConst, ParamConst}; use rustc::ty::subst::{SubstsRef, InternalSubsts}; use syntax::ast; use syntax::attr::InlineAttr; @@ -44,7 +45,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { fn is_generic_fn(&self) -> bool { match *self.as_mono_item() { MonoItem::Fn(ref instance) => { - instance.substs.types().next().is_some() + instance.substs.non_erasable_generics().next().is_some() } MonoItem::Static(..) | MonoItem::GlobalAsm(..) => false, @@ -267,7 +268,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { ty::Float(ast::FloatTy::F64) => output.push_str("f64"), ty::Adt(adt_def, substs) => { self.push_def_path(adt_def.did, output); - self.push_type_params(substs, iter::empty(), output, debug); + self.push_generic_params(substs, iter::empty(), output, debug); }, ty::Tuple(component_types) => { output.push('('); @@ -312,7 +313,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { ty::Dynamic(ref trait_data, ..) => { if let Some(principal) = trait_data.principal() { self.push_def_path(principal.def_id(), output); - self.push_type_params( + self.push_generic_params( principal.skip_binder().substs, trait_data.projection_bounds(), output, @@ -373,7 +374,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { self.push_def_path(def_id, output); let generics = self.tcx.generics_of(self.tcx.closure_base_def_id(def_id)); let substs = substs.truncate_to(self.tcx, generics); - self.push_type_params(substs, iter::empty(), output, debug); + self.push_generic_params(substs, iter::empty(), output, debug); } ty::Error | ty::Bound(..) | @@ -394,6 +395,24 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { } } + // FIXME(const_generics): handle debug printing. + pub fn push_const_name(&self, c: &LazyConst<'tcx>, output: &mut String, debug: bool) { + match c { + LazyConst::Unevaluated(..) => output.push_str("_: _"), + LazyConst::Evaluated(Const { ty, val }) => { + match val { + ConstValue::Infer(..) => output.push_str("_"), + ConstValue::Param(ParamConst { name, .. }) => { + write!(output, "{}", name).unwrap(); + } + _ => write!(output, "{:?}", c).unwrap(), + } + output.push_str(": "); + self.push_type_name(ty, output, debug); + } + } + } + pub fn push_def_path(&self, def_id: DefId, output: &mut String) { @@ -421,15 +440,15 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { output.pop(); } - fn push_type_params(&self, - substs: SubstsRef<'tcx>, - projections: I, - output: &mut String, - debug: bool) - where I: Iterator> - { + fn push_generic_params( + &self, + substs: SubstsRef<'tcx>, + projections: I, + output: &mut String, + debug: bool, + ) where I: Iterator> { let mut projections = projections.peekable(); - if substs.types().next().is_none() && projections.peek().is_none() { + if substs.non_erasable_generics().next().is_none() && projections.peek().is_none() { return; } @@ -449,6 +468,11 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { output.push_str(", "); } + for const_parameter in substs.consts() { + self.push_const_name(const_parameter, output, debug); + output.push_str(", "); + } + output.pop(); output.pop(); @@ -460,6 +484,6 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { output: &mut String, debug: bool) { self.push_def_path(instance.def_id(), output); - self.push_type_params(instance.substs, iter::empty(), output, debug); + self.push_generic_params(instance.substs, iter::empty(), output, debug); } } diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index f342017603ed..f98bc476aafe 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -448,7 +448,7 @@ fn mono_item_visibility( return Visibility::Hidden } - let is_generic = instance.substs.types().next().is_some(); + let is_generic = instance.substs.non_erasable_generics().next().is_some(); // Upstream `DefId` instances get different handling than local ones if !def_id.is_local() { From 1ebc858e5dd01417a05b08bac067bff2c55faca7 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:12:15 +0000 Subject: [PATCH 230/381] Add const kind and UnpackedKind::Const Co-Authored-By: Gabriel Smith --- src/librustc/ty/subst.rs | 116 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 110 insertions(+), 6 deletions(-) diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 450fab81661f..35c6f980cd93 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -2,8 +2,9 @@ use crate::hir::def_id::DefId; use crate::infer::canonical::Canonical; -use crate::ty::{self, Lift, List, Ty, TyCtxt}; +use crate::ty::{self, Lift, List, Ty, TyCtxt, InferConst, ParamConst}; use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; +use crate::mir::interpret::ConstValue; use serialize::{self, Encodable, Encoder, Decodable, Decoder}; use syntax_pos::{Span, DUMMY_SP}; @@ -17,24 +18,26 @@ use std::mem; use std::num::NonZeroUsize; /// An entity in the Rust type system, which can be one of -/// several kinds (only types and lifetimes for now). +/// several kinds (types, lifetimes, and consts). /// To reduce memory usage, a `Kind` is a interned pointer, /// with the lowest 2 bits being reserved for a tag to -/// indicate the type (`Ty` or `Region`) it points to. +/// indicate the type (`Ty`, `Region`, or `Const`) it points to. #[derive(Copy, Clone, PartialEq, Eq, Hash)] pub struct Kind<'tcx> { ptr: NonZeroUsize, - marker: PhantomData<(Ty<'tcx>, ty::Region<'tcx>)> + marker: PhantomData<(Ty<'tcx>, ty::Region<'tcx>, &'tcx ty::LazyConst<'tcx>)> } const TAG_MASK: usize = 0b11; const TYPE_TAG: usize = 0b00; const REGION_TAG: usize = 0b01; +const CONST_TAG: usize = 0b10; #[derive(Debug, RustcEncodable, RustcDecodable, PartialEq, Eq, PartialOrd, Ord)] pub enum UnpackedKind<'tcx> { Lifetime(ty::Region<'tcx>), Type(Ty<'tcx>), + Const(&'tcx ty::LazyConst<'tcx>), } impl<'tcx> UnpackedKind<'tcx> { @@ -50,6 +53,11 @@ impl<'tcx> UnpackedKind<'tcx> { assert_eq!(mem::align_of_val(ty) & TAG_MASK, 0); (TYPE_TAG, ty as *const _ as usize) } + UnpackedKind::Const(ct) => { + // Ensure we can use the tag bits. + assert_eq!(mem::align_of_val(ct) & TAG_MASK, 0); + (CONST_TAG, ct as *const _ as usize) + } }; Kind { @@ -85,6 +93,12 @@ impl<'tcx> From> for Kind<'tcx> { } } +impl<'tcx> From<&'tcx ty::LazyConst<'tcx>> for Kind<'tcx> { + fn from(c: &'tcx ty::LazyConst<'tcx>) -> Kind<'tcx> { + UnpackedKind::Const(c).pack() + } +} + impl<'tcx> Kind<'tcx> { #[inline] pub fn unpack(self) -> UnpackedKind<'tcx> { @@ -93,6 +107,7 @@ impl<'tcx> Kind<'tcx> { match ptr & TAG_MASK { REGION_TAG => UnpackedKind::Lifetime(&*((ptr & !TAG_MASK) as *const _)), TYPE_TAG => UnpackedKind::Type(&*((ptr & !TAG_MASK) as *const _)), + CONST_TAG => UnpackedKind::Const(&*((ptr & !TAG_MASK) as *const _)), _ => intrinsics::unreachable() } } @@ -104,6 +119,7 @@ impl<'tcx> fmt::Debug for Kind<'tcx> { match self.unpack() { UnpackedKind::Lifetime(lt) => write!(f, "{:?}", lt), UnpackedKind::Type(ty) => write!(f, "{:?}", ty), + UnpackedKind::Const(ct) => write!(f, "{:?}", ct), } } } @@ -113,6 +129,7 @@ impl<'tcx> fmt::Display for Kind<'tcx> { match self.unpack() { UnpackedKind::Lifetime(lt) => write!(f, "{}", lt), UnpackedKind::Type(ty) => write!(f, "{}", ty), + UnpackedKind::Const(ct) => write!(f, "{}", ct), } } } @@ -122,8 +139,9 @@ impl<'a, 'tcx> Lift<'tcx> for Kind<'a> { fn lift_to_tcx<'cx, 'gcx>(&self, tcx: TyCtxt<'cx, 'gcx, 'tcx>) -> Option { match self.unpack() { - UnpackedKind::Lifetime(a) => a.lift_to_tcx(tcx).map(|a| a.into()), - UnpackedKind::Type(a) => a.lift_to_tcx(tcx).map(|a| a.into()), + UnpackedKind::Lifetime(lt) => lt.lift_to_tcx(tcx).map(|lt| lt.into()), + UnpackedKind::Type(ty) => ty.lift_to_tcx(tcx).map(|ty| ty.into()), + UnpackedKind::Const(ct) => ct.lift_to_tcx(tcx).map(|ct| ct.into()), } } } @@ -133,6 +151,7 @@ impl<'tcx> TypeFoldable<'tcx> for Kind<'tcx> { match self.unpack() { UnpackedKind::Lifetime(lt) => lt.fold_with(folder).into(), UnpackedKind::Type(ty) => ty.fold_with(folder).into(), + UnpackedKind::Const(ct) => ct.fold_with(folder).into(), } } @@ -140,6 +159,7 @@ impl<'tcx> TypeFoldable<'tcx> for Kind<'tcx> { match self.unpack() { UnpackedKind::Lifetime(lt) => lt.visit_with(visitor), UnpackedKind::Type(ty) => ty.visit_with(visitor), + UnpackedKind::Const(ct) => ct.visit_with(visitor), } } } @@ -195,6 +215,15 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { ty::BoundRegion::BrNamed(param.def_id, param.name) )).into() } + + ty::GenericParamDefKind::Const => { + tcx.mk_lazy_const(ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Infer( + InferConst::Canonical(ty::INNERMOST, ty::BoundVar::from(param.index)) + ), + ty: tcx.type_of(def_id), + })).into() + } } }) } @@ -283,6 +312,29 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { }) } + #[inline] + pub fn consts(&'a self) -> impl DoubleEndedIterator> + 'a { + self.iter().filter_map(|k| { + if let UnpackedKind::Const(ct) = k.unpack() { + Some(ct) + } else { + None + } + }) + } + + #[inline] + pub fn non_erasable_generics( + &'a self + ) -> impl DoubleEndedIterator> + 'a { + self.iter().filter_map(|k| { + match k.unpack() { + UnpackedKind::Lifetime(_) => None, + generic => Some(generic), + } + }) + } + #[inline] pub fn type_at(&self, i: usize) -> Ty<'tcx> { if let UnpackedKind::Type(ty) = self[i].unpack() { @@ -301,6 +353,15 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { } } + #[inline] + pub fn const_at(&self, i: usize) -> &'tcx ty::LazyConst<'tcx> { + if let UnpackedKind::Const(ct) = self[i].unpack() { + ct + } else { + bug!("expected const for param #{} in {:?}", i, self); + } + } + #[inline] pub fn type_for_def(&self, def: &ty::GenericParamDef) -> Kind<'tcx> { self.type_at(def.index as usize).into() @@ -469,6 +530,21 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for SubstFolder<'a, 'gcx, 'tcx> { return t1; } + + fn fold_const(&mut self, c: &'tcx ty::LazyConst<'tcx>) -> &'tcx ty::LazyConst<'tcx> { + if !c.needs_subst() { + return c; + } + + if let ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Param(p), + .. + }) = c { + self.const_for_param(*p, c) + } else { + c.super_fold_with(self) + } + } } impl<'a, 'gcx, 'tcx> SubstFolder<'a, 'gcx, 'tcx> { @@ -494,6 +570,34 @@ impl<'a, 'gcx, 'tcx> SubstFolder<'a, 'gcx, 'tcx> { self.shift_vars_through_binders(ty) } + fn const_for_param( + &self, + p: ParamConst, + source_cn: &'tcx ty::LazyConst<'tcx> + ) -> &'tcx ty::LazyConst<'tcx> { + // Look up the const in the substitutions. It really should be in there. + let opt_cn = self.substs.get(p.index as usize).map(|k| k.unpack()); + let cn = match opt_cn { + Some(UnpackedKind::Const(cn)) => cn, + _ => { + let span = self.span.unwrap_or(DUMMY_SP); + span_bug!( + span, + "Const parameter `{:?}` ({:?}/{}) out of range \ + when substituting (root type={:?}) substs={:?}", + p, + source_cn, + p.index, + self.root_ty, + self.substs, + ); + } + }; + + // FIXME(const_generics): shift const through binders + cn + } + /// It is sometimes necessary to adjust the De Bruijn indices during substitution. This occurs /// when we are substituting a type with escaping bound vars into a context where we have /// passed through binders. That's quite a mouthful. Let's see an example: From 7f2a4f78224f9442bca6ceb7739d3d86a7591153 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:12:46 +0000 Subject: [PATCH 231/381] Add ConstValue::Param and ConstValue::Infer Co-Authored-By: Gabriel Smith --- src/librustc/mir/interpret/value.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/librustc/mir/interpret/value.rs b/src/librustc/mir/interpret/value.rs index 956182fc8b27..dbbeda3e578e 100644 --- a/src/librustc/mir/interpret/value.rs +++ b/src/librustc/mir/interpret/value.rs @@ -1,6 +1,6 @@ use std::fmt; -use crate::ty::{Ty, layout::{HasDataLayout, Size}}; +use crate::ty::{Ty, InferConst, ParamConst, layout::{HasDataLayout, Size}}; use super::{EvalResult, Pointer, PointerArithmetic, Allocation, AllocId, sign_extend, truncate}; @@ -17,6 +17,12 @@ pub struct RawConst<'tcx> { /// match the `LocalState` optimizations for easy conversions between `Value` and `ConstValue`. #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash)] pub enum ConstValue<'tcx> { + /// A const generic parameter. + Param(ParamConst), + + /// Infer the value of the const. + Infer(InferConst<'tcx>), + /// Used only for types with `layout::abi::Scalar` ABI and ZSTs. /// /// Not using the enum `Value` to encode that this must not be `Undef`. @@ -43,6 +49,8 @@ impl<'tcx> ConstValue<'tcx> { #[inline] pub fn try_to_scalar(&self) -> Option { match *self { + ConstValue::Param(_) | + ConstValue::Infer(_) | ConstValue::ByRef(..) | ConstValue::Slice(..) => None, ConstValue::Scalar(val) => Some(val), From f7f60eef500cbba168bec1034a087a6feb625982 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:13:19 +0000 Subject: [PATCH 232/381] Add type constraints from const parameters Co-Authored-By: Gabriel Smith --- src/librustc_typeck/variance/constraints.rs | 49 ++++++++++++++++++--- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index d8d93b462a90..49d11150689a 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -4,7 +4,8 @@ //! We walk the set of items and, for each member, generate new constraints. use hir::def_id::DefId; -use rustc::ty::subst::{UnpackedKind, SubstsRef}; +use rustc::mir::interpret::ConstValue; +use rustc::ty::subst::{SubstsRef, UnpackedKind}; use rustc::ty::{self, Ty, TyCtxt}; use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; @@ -229,12 +230,19 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { // Trait are always invariant so we can take advantage of that. let variance_i = self.invariant(variance); - for ty in substs.types() { - self.add_constraints_from_ty(current, ty, variance_i); - } - for region in substs.regions() { - self.add_constraints_from_region(current, region, variance_i); + for k in substs { + match k.unpack() { + UnpackedKind::Lifetime(lt) => { + self.add_constraints_from_region(current, lt, variance_i) + } + UnpackedKind::Type(ty) => { + self.add_constraints_from_ty(current, ty, variance_i) + } + UnpackedKind::Const(ct) => { + self.add_constraints_from_const(current, ct, variance_i) + } + } } } @@ -267,7 +275,11 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { self.add_constraints_from_mt(current, &ty::TypeAndMut { ty, mutbl }, variance); } - ty::Array(typ, _) | + ty::Array(typ, len) => { + self.add_constraints_from_ty(current, typ, variance); + self.add_constraints_from_const(current, len, variance); + } + ty::Slice(typ) => { self.add_constraints_from_ty(current, typ, variance); } @@ -383,6 +395,9 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { UnpackedKind::Type(ty) => { self.add_constraints_from_ty(current, ty, variance_i) } + UnpackedKind::Const(ct) => { + self.add_constraints_from_const(current, ct, variance_i) + } } } } @@ -434,6 +449,26 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { } } + fn add_constraints_from_const( + &mut self, + current: &CurrentItem, + ct: &ty::LazyConst<'tcx>, + variance: VarianceTermPtr<'a> + ) { + debug!( + "add_constraints_from_const(ct={:?}, variance={:?})", + ct, + variance + ); + + if let ty::LazyConst::Evaluated(ct) = ct { + self.add_constraints_from_ty(current, ct.ty, variance); + if let ConstValue::Param(ref data) = ct.val { + self.add_constraint(current, data.index, variance); + } + } + } + /// Adds constraints appropriate for a mutability-type pair /// appearing in a context with ambient variance `variance` fn add_constraints_from_mt(&mut self, From 73a6df6079c052f789ef8d5e0aaaf855ffbc76f4 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:13:32 +0000 Subject: [PATCH 233/381] Update diagnostics to include const parameters Co-Authored-By: Gabriel Smith --- src/librustc_typeck/diagnostics.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index feff79dc3f50..399cd6f890c2 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -423,7 +423,7 @@ impl Foo for Bar { E0049: r##" This error indicates that an attempted implementation of a trait method -has the wrong number of type parameters. +has the wrong number of type or const parameters. For example, the trait below has a method `foo` with a type parameter `T`, but the implementation of `foo` for the type `Bar` is missing this parameter: @@ -1032,6 +1032,7 @@ enum NightsWatch {} ``` "##, +// FIXME(const_generics:docs): example of inferring const parameter. E0087: r##" #### Note: this error code is no longer emitted by the compiler. @@ -1152,8 +1153,8 @@ fn main() { "##, E0091: r##" -You gave an unnecessary type parameter in a type alias. Erroneous code -example: +You gave an unnecessary type or const parameter in a type alias. Erroneous +code example: ```compile_fail,E0091 type Foo = u32; // error: type parameter `T` is unused @@ -1161,7 +1162,7 @@ type Foo = u32; // error: type parameter `T` is unused type Foo = Box; // error: type parameter `B` is unused ``` -Please check you didn't write too many type parameters. Example: +Please check you didn't write too many parameters. Example: ``` type Foo = u32; // ok! From 9a9aa5b46aa0c81a6dad3a3377d6b7d2e65a93c7 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:13:49 +0000 Subject: [PATCH 234/381] Implement Hash for new types Co-Authored-By: Gabriel Smith --- src/librustc/ich/impls_ty.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index f77a88128f25..21988de90183 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -74,6 +74,7 @@ for ty::subst::UnpackedKind<'gcx> { match self { ty::subst::UnpackedKind::Lifetime(lt) => lt.hash_stable(hcx, hasher), ty::subst::UnpackedKind::Type(ty) => ty.hash_stable(hcx, hasher), + ty::subst::UnpackedKind::Const(ct) => ct.hash_stable(hcx, hasher), } } } @@ -134,6 +135,15 @@ impl<'a> HashStable> for ty::RegionVid { } } +impl<'gcx, 'tcx> HashStable> for ty::ConstVid<'tcx> { + #[inline] + fn hash_stable(&self, + hcx: &mut StableHashingContext<'gcx>, + hasher: &mut StableHasher) { + self.index.hash_stable(hcx, hasher); + } +} + impl<'gcx> HashStable> for ty::BoundVar { #[inline] fn hash_stable(&self, @@ -297,6 +307,14 @@ impl<'a> HashStable> for ty::VariantFlags { } } +impl_stable_hash_for!( + impl<'tcx> for enum ty::InferConst<'tcx> [ ty::InferConst ] { + Var(vid), + Fresh(i), + Canonical(debruijn, var), + } +); + impl_stable_hash_for!(enum ty::VariantDiscr { Explicit(def_id), Relative(distance) @@ -310,11 +328,14 @@ impl_stable_hash_for!(struct ty::FieldDef { impl_stable_hash_for!( impl<'tcx> for enum mir::interpret::ConstValue<'tcx> [ mir::interpret::ConstValue ] { + Param(param), + Infer(infer), Scalar(val), Slice(a, b), ByRef(ptr, alloc), } ); + impl_stable_hash_for!(struct crate::mir::interpret::RawConst<'tcx> { alloc_id, ty, @@ -518,6 +539,7 @@ impl_stable_hash_for!(struct ty::GenericParamDef { impl_stable_hash_for!(enum ty::GenericParamDefKind { Lifetime, Type { has_default, object_lifetime_default, synthetic }, + Const, }); impl_stable_hash_for!( @@ -736,6 +758,11 @@ for ty::FloatVid } } +impl_stable_hash_for!(struct ty::ParamConst { + index, + name +}); + impl_stable_hash_for!(struct ty::ParamTy { idx, name From 63b7572d0df999ce6d2a9e62878b36e44a81df05 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:14:18 +0000 Subject: [PATCH 235/381] Stub methods in infer Co-Authored-By: Gabriel Smith --- src/librustc/infer/canonical/mod.rs | 3 +++ src/librustc/infer/canonical/query_response.rs | 15 +++++++++++++++ src/librustc/infer/combine.rs | 2 +- src/librustc/infer/error_reporting/mod.rs | 16 +++++----------- src/librustc/infer/mod.rs | 13 ++++++++----- src/librustc/infer/nll_relate/mod.rs | 4 ++-- 6 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/librustc/infer/canonical/mod.rs b/src/librustc/infer/canonical/mod.rs index 613e153ae33d..0d067d1de856 100644 --- a/src/librustc/infer/canonical/mod.rs +++ b/src/librustc/infer/canonical/mod.rs @@ -443,6 +443,9 @@ impl<'tcx> CanonicalVarValues<'tcx> { UnpackedKind::Lifetime(..) => tcx.mk_region( ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(i)) ).into(), + UnpackedKind::Const(..) => { + unimplemented!() // FIXME(const_generics) + } }) .collect() } diff --git a/src/librustc/infer/canonical/query_response.rs b/src/librustc/infer/canonical/query_response.rs index aef0152b6ed7..008882fd5003 100644 --- a/src/librustc/infer/canonical/query_response.rs +++ b/src/librustc/infer/canonical/query_response.rs @@ -315,6 +315,10 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { obligations.extend(ok.into_obligations()); } + (UnpackedKind::Const(..), UnpackedKind::Const(..)) => { + unimplemented!() // FIXME(const_generics) + } + _ => { bug!( "kind mismatch, cannot unify {:?} and {:?}", @@ -473,6 +477,9 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { opt_values[br.assert_bound_var()] = Some(*original_value); } } + UnpackedKind::Const(..) => { + unimplemented!() // FIXME(const_generics) + } } } @@ -568,6 +575,11 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { ty::OutlivesPredicate(t1, r2) ) ), + UnpackedKind::Const(..) => { + // Consts cannot outlive one another, so we don't expect to + // ecounter this branch. + span_bug!(cause.span, "unexpected const outlives {:?}", constraint); + } } ) }) @@ -602,6 +614,9 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { obligations .extend(self.at(cause, param_env).eq(v1, v2)?.into_obligations()); } + (UnpackedKind::Const(..), UnpackedKind::Const(..)) => { + unimplemented!() // FIXME(const_generics) + } _ => { bug!("kind mismatch, cannot unify {:?} and {:?}", value1, value2,); } diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index 6ef902a47dc8..885b439ef1ca 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -449,7 +449,7 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, ' let origin = *variables.var_origin(vid); let new_var_id = variables.new_var(self.for_universe, false, origin); - let u = self.tcx().mk_var(new_var_id); + let u = self.tcx().mk_ty_var(new_var_id); debug!("generalize: replacing original vid={:?} with new={:?}", vid, u); return Ok(u); diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 3dace2f2e89b..c7936534aad2 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -691,17 +691,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { ) -> SubstsRef<'tcx> { let generics = self.tcx.generics_of(def_id); let mut num_supplied_defaults = 0; - let mut type_params = generics - .params - .iter() - .rev() - .filter_map(|param| match param.kind { - ty::GenericParamDefKind::Lifetime => None, - ty::GenericParamDefKind::Type { has_default, .. } => { - Some((param.def_id, has_default)) - } - }) - .peekable(); + let mut type_params = generics.params.iter().rev().filter_map(|param| match param.kind { + ty::GenericParamDefKind::Lifetime => None, + ty::GenericParamDefKind::Type { has_default, .. } => Some((param.def_id, has_default)), + ty::GenericParamDefKind::Const => None, // FIXME(const_generics:defaults) + }).peekable(); let has_default = { let has_default = type_params.peek().map(|(_, has_default)| has_default); *has_default.unwrap_or(&false) diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 84ad742d3c97..cc1c439f3bd9 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -656,7 +656,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { type_variables .unsolved_variables() .into_iter() - .map(|t| self.tcx.mk_var(t)) + .map(|t| self.tcx.mk_ty_var(t)) .chain( (0..int_unification_table.len()) .map(|i| ty::IntVid { index: i as u32 }) @@ -981,7 +981,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } pub fn next_ty_var(&self, origin: TypeVariableOrigin) -> Ty<'tcx> { - self.tcx.mk_var(self.next_ty_var_id(false, origin)) + self.tcx.mk_ty_var(self.next_ty_var_id(false, origin)) } pub fn next_ty_var_in_universe( @@ -992,11 +992,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let vid = self.type_variables .borrow_mut() .new_var(universe, false, origin); - self.tcx.mk_var(vid) + self.tcx.mk_ty_var(vid) } pub fn next_diverging_ty_var(&self, origin: TypeVariableOrigin) -> Ty<'tcx> { - self.tcx.mk_var(self.next_ty_var_id(true, origin)) + self.tcx.mk_ty_var(self.next_ty_var_id(true, origin)) } pub fn next_int_var_id(&self) -> IntVid { @@ -1081,7 +1081,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { TypeVariableOrigin::TypeParameterDefinition(span, param.name), ); - self.tcx.mk_var(ty_var_id).into() + self.tcx.mk_ty_var(ty_var_id).into() + } + GenericParamDefKind::Const { .. } => { + unimplemented!() // FIXME(const_generics) } } } diff --git a/src/librustc/infer/nll_relate/mod.rs b/src/librustc/infer/nll_relate/mod.rs index f37e24b292e0..7140af36acbd 100644 --- a/src/librustc/infer/nll_relate/mod.rs +++ b/src/librustc/infer/nll_relate/mod.rs @@ -310,7 +310,7 @@ where ty::Projection(projection_ty) if D::normalization() == NormalizationStrategy::Lazy => { - return Ok(self.relate_projection_ty(projection_ty, self.infcx.tcx.mk_var(vid))); + return Ok(self.relate_projection_ty(projection_ty, self.infcx.tcx.mk_ty_var(vid))); } _ => (), @@ -764,7 +764,7 @@ where // the universe `_universe`. let new_var_id = variables.new_var(self.universe, false, origin); - let u = self.tcx().mk_var(new_var_id); + let u = self.tcx().mk_ty_var(new_var_id); debug!( "generalize: replacing original vid={:?} with new={:?}", vid, From 29c272d4edcd1974c2c501a9310acbb30c65fe54 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:14:56 +0000 Subject: [PATCH 236/381] Take const into account in context Co-Authored-By: Gabriel Smith --- src/librustc/ty/context.rs | 100 +++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 26 deletions(-) diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 3c63dcb9ef30..f6e6067bb6fc 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -21,8 +21,8 @@ use crate::middle::lang_items; use crate::middle::resolve_lifetime::{self, ObjectLifetimeDefault}; use crate::middle::stability; use crate::mir::{self, Mir, interpret, ProjectionKind}; -use crate::mir::interpret::Allocation; -use crate::ty::subst::{Kind, InternalSubsts, Subst, SubstsRef}; +use crate::mir::interpret::{ConstValue, Allocation}; +use crate::ty::subst::{Kind, InternalSubsts, SubstsRef, Subst}; use crate::ty::ReprOptions; use crate::traits; use crate::traits::{Clause, Clauses, GoalKind, Goal, Goals}; @@ -31,8 +31,9 @@ use crate::ty::{TyS, TyKind, List}; use crate::ty::{AdtKind, AdtDef, ClosureSubsts, GeneratorSubsts, Region, Const, LazyConst}; use crate::ty::{PolyFnSig, InferTy, ParamTy, ProjectionTy, ExistentialPredicate, Predicate}; use crate::ty::RegionKind; -use crate::ty::{TyVar, TyVid, IntVar, IntVid, FloatVar, FloatVid}; +use crate::ty::{TyVar, TyVid, IntVar, IntVid, FloatVar, FloatVid, ConstVid}; use crate::ty::TyKind::*; +use crate::ty::{InferConst, ParamConst}; use crate::ty::GenericParamDefKind; use crate::ty::layout::{LayoutDetails, TargetDataLayout, VariantIdx}; use crate::ty::query; @@ -872,6 +873,18 @@ impl CanonicalUserType<'gcx> { } _ => false, }, + + UnpackedKind::Const(ct) => match ct { + ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Infer(InferConst::Canonical(debruijn, b)), + .. + }) => { + // We only allow a `ty::INNERMOST` index in substitutions. + assert_eq!(*debruijn, ty::INNERMOST); + cvar == *b + } + _ => false, + }, } }) }, @@ -2120,15 +2133,19 @@ macro_rules! sty_debug_print { #[derive(Copy, Clone)] struct DebugStat { total: usize, - region_infer: usize, + lt_infer: usize, ty_infer: usize, - both_infer: usize, + ct_infer: usize, + all_infer: usize, } pub fn go(tcx: TyCtxt<'_, '_, '_>) { let mut total = DebugStat { total: 0, - region_infer: 0, ty_infer: 0, both_infer: 0, + lt_infer: 0, + ty_infer: 0, + ct_infer: 0, + all_infer: 0, }; $(let mut $variant = total;)* @@ -2139,31 +2156,35 @@ macro_rules! sty_debug_print { ty::Error => /* unimportant */ continue, $(ty::$variant(..) => &mut $variant,)* }; - let region = t.flags.intersects(ty::TypeFlags::HAS_RE_INFER); + let lt = t.flags.intersects(ty::TypeFlags::HAS_RE_INFER); let ty = t.flags.intersects(ty::TypeFlags::HAS_TY_INFER); + let ct = t.flags.intersects(ty::TypeFlags::HAS_CT_INFER); variant.total += 1; total.total += 1; - if region { total.region_infer += 1; variant.region_infer += 1 } + if lt { total.lt_infer += 1; variant.lt_infer += 1 } if ty { total.ty_infer += 1; variant.ty_infer += 1 } - if region && ty { total.both_infer += 1; variant.both_infer += 1 } + if ct { total.ct_infer += 1; variant.ct_infer += 1 } + if lt && ty && ct { total.all_infer += 1; variant.all_infer += 1 } } - println!("Ty interner total ty region both"); + println!("Ty interner total ty lt ct all"); $(println!(" {:18}: {uses:6} {usespc:4.1}%, \ - {ty:4.1}% {region:5.1}% {both:4.1}%", - stringify!($variant), - uses = $variant.total, - usespc = $variant.total as f64 * 100.0 / total.total as f64, - ty = $variant.ty_infer as f64 * 100.0 / total.total as f64, - region = $variant.region_infer as f64 * 100.0 / total.total as f64, - both = $variant.both_infer as f64 * 100.0 / total.total as f64); - )* + {ty:4.1}% {lt:5.1}% {ct:4.1}% {all:4.1}%", + stringify!($variant), + uses = $variant.total, + usespc = $variant.total as f64 * 100.0 / total.total as f64, + ty = $variant.ty_infer as f64 * 100.0 / total.total as f64, + lt = $variant.lt_infer as f64 * 100.0 / total.total as f64, + ct = $variant.ct_infer as f64 * 100.0 / total.total as f64, + all = $variant.all_infer as f64 * 100.0 / total.total as f64); + )* println!(" total {uses:6} \ - {ty:4.1}% {region:5.1}% {both:4.1}%", - uses = total.total, - ty = total.ty_infer as f64 * 100.0 / total.total as f64, - region = total.region_infer as f64 * 100.0 / total.total as f64, - both = total.both_infer as f64 * 100.0 / total.total as f64) + {ty:4.1}% {lt:5.1}% {ct:4.1}% {all:4.1}%", + uses = total.total, + ty = total.ty_infer as f64 * 100.0 / total.total as f64, + lt = total.lt_infer as f64 * 100.0 / total.total as f64, + ct = total.ct_infer as f64 * 100.0 / total.total as f64, + all = total.all_infer as f64 * 100.0 / total.total as f64) } } @@ -2518,7 +2539,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let adt_def = self.adt_def(def_id); let substs = InternalSubsts::for_item(self, def_id, |param, substs| { match param.kind { - GenericParamDefKind::Lifetime => bug!(), + GenericParamDefKind::Lifetime | + GenericParamDefKind::Const => { + bug!() + } GenericParamDefKind::Type { has_default, .. } => { if param.index == 0 { ty.into() @@ -2659,10 +2683,18 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } #[inline] - pub fn mk_var(self, v: TyVid) -> Ty<'tcx> { + pub fn mk_ty_var(self, v: TyVid) -> Ty<'tcx> { self.mk_infer(TyVar(v)) } + #[inline] + pub fn mk_const_var(self, v: ConstVid<'tcx>, ty: Ty<'tcx>) -> &'tcx LazyConst<'tcx> { + self.mk_lazy_const(LazyConst::Evaluated(ty::Const { + val: ConstValue::Infer(InferConst::Var(v)), + ty, + })) + } + #[inline] pub fn mk_int_var(self, v: IntVid) -> Ty<'tcx> { self.mk_infer(IntVar(v)) @@ -2685,6 +2717,19 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.mk_ty(Param(ParamTy { idx: index, name: name })) } + #[inline] + pub fn mk_const_param( + self, + index: u32, + name: InternedString, + ty: Ty<'tcx> + ) -> &'tcx LazyConst<'tcx> { + self.mk_lazy_const(LazyConst::Evaluated(ty::Const { + val: ConstValue::Param(ParamConst { index, name }), + ty, + })) + } + #[inline] pub fn mk_self_type(self) -> Ty<'tcx> { self.mk_ty_param(0, keywords::SelfUpper.name().as_interned_str()) @@ -2695,7 +2740,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { GenericParamDefKind::Lifetime => { self.mk_region(ty::ReEarlyBound(param.to_early_bound_region_data())).into() } - GenericParamDefKind::Type {..} => self.mk_ty_param(param.index, param.name).into(), + GenericParamDefKind::Type { .. } => self.mk_ty_param(param.index, param.name).into(), + GenericParamDefKind::Const => { + self.mk_const_param(param.index, param.name, self.type_of(param.def_id)).into() + } } } From cbf5d22bcdd8674db1f3945326e4ff8d6b6986c8 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:15:21 +0000 Subject: [PATCH 237/381] Add const type flags Co-Authored-By: Gabriel Smith --- src/librustc/ty/flags.rs | 32 ++++++++++++++++++++++++-------- src/librustc/ty/fold.rs | 19 ++++++++++--------- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/librustc/ty/flags.rs b/src/librustc/ty/flags.rs index 2b12dcca93ad..64ceb9729ed1 100644 --- a/src/librustc/ty/flags.rs +++ b/src/librustc/ty/flags.rs @@ -1,5 +1,6 @@ -use crate::ty::subst::SubstsRef; -use crate::ty::{self, Ty, TypeFlags, TypeFoldable}; +use crate::ty::subst::{SubstsRef, UnpackedKind}; +use crate::ty::{self, Ty, TypeFlags, TypeFoldable, InferConst}; +use crate::mir::interpret::ConstValue; #[derive(Debug)] pub struct FlagComputation { @@ -232,6 +233,21 @@ impl FlagComputation { } } + fn add_const(&mut self, c: &ty::LazyConst<'_>) { + match c { + ty::LazyConst::Unevaluated(_, substs) => self.add_substs(substs), + // Only done to add the binder for the type. The type flags are + // included in `Const::type_flags`. + ty::LazyConst::Evaluated(ty::Const { ty, val }) => { + self.add_ty(ty); + if let ConstValue::Infer(InferConst::Canonical(debruijn, _)) = val { + self.add_binder(*debruijn) + } + } + } + self.add_flags(c.type_flags()); + } + fn add_existential_projection(&mut self, projection: &ty::ExistentialProjection<'_>) { self.add_substs(projection.substs); self.add_ty(projection.ty); @@ -242,12 +258,12 @@ impl FlagComputation { } fn add_substs(&mut self, substs: SubstsRef<'_>) { - for ty in substs.types() { - self.add_ty(ty); - } - - for r in substs.regions() { - self.add_region(r); + for kind in substs { + match kind.unpack() { + UnpackedKind::Type(ty) => self.add_ty(ty), + UnpackedKind::Lifetime(lt) => self.add_region(lt), + UnpackedKind::Const(ct) => self.add_const(ct), + } } } } diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index aa4d1e5ea90c..7f77d037bb6a 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -91,7 +91,9 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone { self.has_type_flags(TypeFlags::HAS_TY_INFER) } fn needs_infer(&self) -> bool { - self.has_type_flags(TypeFlags::HAS_TY_INFER | TypeFlags::HAS_RE_INFER) + self.has_type_flags( + TypeFlags::HAS_TY_INFER | TypeFlags::HAS_RE_INFER | TypeFlags::HAS_CT_INFER + ) } fn has_placeholders(&self) -> bool { self.has_type_flags(TypeFlags::HAS_RE_PLACEHOLDER | TypeFlags::HAS_TY_PLACEHOLDER) @@ -117,7 +119,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone { } /// Indicates whether this value references only 'global' - /// types/lifetimes that are the same regardless of what fn we are + /// generic parameters that are the same regardless of what fn we are /// in. This is used for caching. fn is_global(&self) -> bool { !self.has_type_flags(TypeFlags::HAS_FREE_LOCAL_NAMES) @@ -841,14 +843,13 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor { } fn visit_const(&mut self, c: &'tcx ty::LazyConst<'tcx>) -> bool { - if let ty::LazyConst::Unevaluated(..) = c { - let projection_flags = TypeFlags::HAS_NORMALIZABLE_PROJECTION | - TypeFlags::HAS_PROJECTION; - if projection_flags.intersects(self.flags) { - return true; - } + let flags = c.type_flags(); + debug!("HasTypeFlagsVisitor: c={:?} c.flags={:?} self.flags={:?}", c, flags, self.flags); + if flags.intersects(self.flags) { + true + } else { + c.super_visit_with(self) } - c.super_visit_with(self) } } From 0d1c9c08d7afd83644c825305804eb694bddb881 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:15:49 +0000 Subject: [PATCH 238/381] Pretty printing for const generics Co-Authored-By: Gabriel Smith --- src/librustc/util/ppaux.rs | 70 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index aecef3c5ec71..cdc0c3371ebc 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -8,7 +8,8 @@ use crate::ty::{Error, Str, Array, Slice, Float, FnDef, FnPtr}; use crate::ty::{Param, Bound, RawPtr, Ref, Never, Tuple}; use crate::ty::{Closure, Generator, GeneratorWitness, Foreign, Projection, Opaque}; use crate::ty::{Placeholder, UnnormalizedProjection, Dynamic, Int, Uint, Infer}; -use crate::ty::{self, Ty, TyCtxt, TypeFoldable, GenericParamCount, GenericParamDefKind}; +use crate::ty::{self, Ty, TyCtxt, TypeFoldable, GenericParamCount, GenericParamDefKind, ParamConst}; +use crate::mir::interpret::ConstValue; use crate::util::nodemap::FxHashSet; use std::cell::Cell; @@ -478,6 +479,7 @@ impl PrintContext { GenericParamDefKind::Type { has_default, .. } => { Some((param.def_id, has_default)) } + GenericParamDefKind::Const => None, // FIXME(const_generics:defaults) }).peekable(); let has_default = { let has_default = type_params.peek().map(|(_, has_default)| has_default); @@ -571,6 +573,14 @@ impl PrintContext { )?; } + // FIXME(const_generics::defaults) + let consts = substs.consts(); + + for ct in consts { + start_or_continue(f, "<", ", ")?; + ct.print_display(f, self)?; + } + start_or_continue(f, "", ">")?; // For values, also print their name and type parameters. @@ -763,7 +773,8 @@ impl fmt::Debug for ty::GenericParamDef { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let type_name = match self.kind { ty::GenericParamDefKind::Lifetime => "Lifetime", - ty::GenericParamDefKind::Type {..} => "Type", + ty::GenericParamDefKind::Type { .. } => "Type", + ty::GenericParamDefKind::Const => "Const", }; write!(f, "{}({}, {:?}, {})", type_name, @@ -1088,6 +1099,12 @@ impl fmt::Debug for ty::TyVid { } } +impl<'tcx> fmt::Debug for ty::ConstVid<'tcx> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "_#{}f", self.index) + } +} + impl fmt::Debug for ty::IntVid { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "_#{}i", self.index) @@ -1448,7 +1465,12 @@ define_print! { write!(f, "_")?; } ty::LazyConst::Evaluated(c) => ty::tls::with(|tcx| { - write!(f, "{}", c.unwrap_usize(tcx)) + match c.val { + ConstValue::Infer(..) => write!(f, "_"), + ConstValue::Param(ParamConst { name, .. }) => + write!(f, "{}", name), + _ => write!(f, "{}", c.unwrap_usize(tcx)), + } })?, } write!(f, "]") @@ -1472,6 +1494,37 @@ define_print! { } } +define_print! { + ('tcx) ConstValue<'tcx>, (self, f, cx) { + display { + match self { + ConstValue::Infer(..) => write!(f, "_"), + ConstValue::Param(ParamConst { name, .. }) => write!(f, "{}", name), + _ => write!(f, "{:?}", self), + } + } + } +} + +define_print! { + ('tcx) ty::Const<'tcx>, (self, f, cx) { + display { + write!(f, "{} : {}", self.val, self.ty) + } + } +} + +define_print! { + ('tcx) ty::LazyConst<'tcx>, (self, f, cx) { + display { + match self { + ty::LazyConst::Unevaluated(..) => write!(f, "_ : _"), + ty::LazyConst::Evaluated(c) => write!(f, "{}", c), + } + } + } +} + define_print! { () ty::ParamTy, (self, f, cx) { display { @@ -1483,6 +1536,17 @@ define_print! { } } +define_print! { + () ty::ParamConst, (self, f, cx) { + display { + write!(f, "{}", self.name) + } + debug { + write!(f, "{}/#{}", self.name, self.index) + } + } +} + define_print! { ('tcx, T: Print + fmt::Debug, U: Print + fmt::Debug) ty::OutlivesPredicate, (self, f, cx) { From f761c414b12f3851ddef7b5849bb8fdcf8d75d44 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:16:12 +0000 Subject: [PATCH 239/381] Make a lazy const from a const param Co-Authored-By: Gabriel Smith --- src/librustc_mir/hair/cx/expr.rs | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 65cd9f7103d6..e70756ad2f25 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -5,7 +5,7 @@ use crate::hair::cx::to_ref::ToRef; use crate::hair::util::UserAnnotatedTyHelpers; use rustc_data_structures::indexed_vec::Idx; use rustc::hir::def::{Def, CtorKind}; -use rustc::mir::interpret::{GlobalId, ErrorHandled}; +use rustc::mir::interpret::{GlobalId, ErrorHandled, ConstValue}; use rustc::ty::{self, AdtKind, Ty}; use rustc::ty::adjustment::{Adjustment, Adjust, AutoBorrow, AutoBorrowMutability}; use rustc::ty::cast::CastKind as TyCastKind; @@ -699,7 +699,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }; let source = if let Some((did, offset, var_ty)) = var { - let mk_const = |literal| Expr { + let mk_lazy_const = |literal| Expr { temp_lifetime, ty: var_ty, span: expr.span, @@ -708,7 +708,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, user_ty: None }, }.to_ref(); - let offset = mk_const(ty::LazyConst::Evaluated(ty::Const::from_bits( + let offset = mk_lazy_const(ty::LazyConst::Evaluated(ty::Const::from_bits( cx.tcx, offset as u128, cx.param_env.and(var_ty), @@ -718,7 +718,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, // in case we are offsetting from a computed discriminant // and not the beginning of discriminants (which is always `0`) let substs = InternalSubsts::identity_for_item(cx.tcx(), did); - let lhs = mk_const(ty::LazyConst::Unevaluated(did, substs)); + let lhs = mk_lazy_const(ty::LazyConst::Unevaluated(did, substs)); let bin = ExprKind::Binary { op: BinOp::Add, lhs, @@ -925,7 +925,26 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ))), user_ty, } - }, + } + + Def::ConstParam(def_id) => { + let node_id = cx.tcx.hir().as_local_node_id(def_id).unwrap(); + let item_id = cx.tcx.hir().get_parent_node(node_id); + let item_def_id = cx.tcx.hir().local_def_id(item_id); + let generics = cx.tcx.generics_of(item_def_id); + let index = generics.param_def_id_to_index[&cx.tcx.hir().local_def_id(node_id)]; + let name = cx.tcx.hir().name(node_id).as_interned_str(); + let val = ConstValue::Param(ty::ParamConst::new(index, name)); + ExprKind::Literal { + literal: cx.tcx.mk_lazy_const( + ty::LazyConst::Evaluated(ty::Const { + val, + ty: cx.tables().node_type(expr.hir_id), + }) + ), + user_ty: None, + } + } Def::Const(def_id) | Def::AssociatedConst(def_id) => { From f7cd97f7863fb9ee017aacec134589c211786c88 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:16:42 +0000 Subject: [PATCH 240/381] Add ast_const_to_const Co-Authored-By: Gabriel Smith --- src/librustc_typeck/astconv.rs | 85 +++++++++++++++++++++++++++++----- 1 file changed, 74 insertions(+), 11 deletions(-) diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 5dbcf908020b..1dec2d483b80 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -3,7 +3,7 @@ //! instance of `AstConv`. use errors::{Applicability, DiagnosticId}; -use crate::hir::{self, GenericArg, GenericArgs}; +use crate::hir::{self, GenericArg, GenericArgs, ExprKind}; use crate::hir::def::Def; use crate::hir::def_id::DefId; use crate::hir::HirVec; @@ -16,6 +16,7 @@ use rustc::ty::{self, Ty, TyCtxt, ToPredicate, TypeFoldable}; use rustc::ty::{GenericParamDef, GenericParamDefKind}; use rustc::ty::subst::{Kind, Subst, InternalSubsts, SubstsRef}; use rustc::ty::wf::object_region_bounds; +use rustc::mir::interpret::ConstValue; use rustc_data_structures::sync::Lrc; use rustc_target::spec::abi; use crate::require_c_abi_if_c_variadic; @@ -273,6 +274,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let param_counts = def.own_counts(); let arg_counts = args.own_counts(); let infer_lifetimes = position != GenericArgPosition::Type && arg_counts.lifetimes == 0; + let infer_consts = position != GenericArgPosition::Type && arg_counts.consts == 0; let mut defaults: ty::GenericParamCount = Default::default(); for param in &def.params { @@ -281,6 +283,9 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { GenericParamDefKind::Type { has_default, .. } => { defaults.types += has_default as usize } + GenericParamDefKind::Const => { + // FIXME(const_generics:defaults) + } }; } @@ -311,11 +316,15 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { } } - let check_kind_count = |kind, - required, - permitted, - provided, - offset| { + let check_kind_count = |kind, required, permitted, provided, offset| { + debug!( + "check_kind_count: kind: {} required: {} permitted: {} provided: {} offset: {}", + kind, + required, + permitted, + provided, + offset + ); // We enforce the following: `required` <= `provided` <= `permitted`. // For kinds without defaults (i.e., lifetimes), `required == permitted`. // For other kinds (i.e., types), `permitted` may be greater than `required`. @@ -384,6 +393,17 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { 0, ); } + // FIXME(const_generics:defaults) + if !infer_consts || arg_counts.consts > param_counts.consts { + check_kind_count( + "const", + param_counts.consts, + param_counts.consts, + arg_counts.consts, + arg_counts.lifetimes + arg_counts.types, + ); + } + // Note that type errors are currently be emitted *after* const errors. if !infer_types || arg_counts.types > param_counts.types - defaults.types - has_self as usize { check_kind_count( @@ -495,7 +515,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { (Some(&arg), Some(¶m)) => { match (arg, ¶m.kind) { (GenericArg::Lifetime(_), GenericParamDefKind::Lifetime) - | (GenericArg::Type(_), GenericParamDefKind::Type { .. }) => { + | (GenericArg::Type(_), GenericParamDefKind::Type { .. }) + | (GenericArg::Const(_), GenericParamDefKind::Const) => { substs.push(provided_kind(param, arg)); args.next(); params.next(); @@ -606,6 +627,9 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { (GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => { self.ast_ty_to_ty(&ty).into() } + (GenericParamDefKind::Const, GenericArg::Const(ct)) => { + self.ast_const_to_const(&ct.value, tcx.type_of(param.def_id)).into() + } _ => unreachable!(), } }, @@ -654,6 +678,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { tcx.types.err.into() } } + GenericParamDefKind::Const => { + // FIXME(const_generics:defaults) + // We've already errored above about the mismatch. + tcx.types.err.into() + } } }, ); @@ -1609,6 +1638,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { // Case 3. Reference to a top-level value. Def::Fn(def_id) | Def::Const(def_id) | + Def::ConstParam(def_id) | Def::Static(def_id, _) => { path_segs.push(PathSeg(def_id, last)); } @@ -1797,10 +1827,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { self.associated_path_to_ty(ast_ty.hir_id, ast_ty.span, ty, def, segment, false).0 } hir::TyKind::Array(ref ty, ref length) => { - let length_def_id = tcx.hir().local_def_id_from_hir_id(length.hir_id); - let substs = InternalSubsts::identity_for_item(tcx, length_def_id); - let length = ty::LazyConst::Unevaluated(length_def_id, substs); - let length = tcx.mk_lazy_const(length); + let length = self.ast_const_to_const(length, tcx.types.usize); let array_ty = tcx.mk_ty(ty::Array(self.ast_ty_to_ty(&ty), length)); self.normalize_ty(ast_ty.span, array_ty) } @@ -1837,6 +1864,42 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { result_ty } + pub fn ast_const_to_const( + &self, + ast_const: &hir::AnonConst, + ty: Ty<'tcx> + ) -> &'tcx ty::LazyConst<'tcx> { + debug!("ast_const_to_const(id={:?}, ast_const={:?})", ast_const.id, ast_const); + + let tcx = self.tcx(); + let def_id = tcx.hir().local_def_id(ast_const.id); + + let mut lazy_const = ty::LazyConst::Unevaluated( + def_id, + Substs::identity_for_item(tcx, def_id) + ); + + let expr = &tcx.hir().body(ast_const.body).value; + if let ExprKind::Path(ref qpath) = expr.node { + if let hir::QPath::Resolved(_, ref path) = qpath { + if let Def::ConstParam(def_id) = path.def { + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let item_id = tcx.hir().get_parent_node(node_id); + let item_def_id = tcx.hir().local_def_id(item_id); + let generics = tcx.generics_of(item_def_id); + let index = generics.param_def_id_to_index[&tcx.hir().local_def_id(node_id)]; + let name = tcx.hir().name(node_id).as_interned_str(); + lazy_const = ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Param(ty::ParamConst::new(index, name)), + ty, + }) + } + } + }; + + tcx.mk_lazy_const(lazy_const) + } + pub fn impl_trait_ty_to_ty( &self, def_id: DefId, From a8361eb6fa42a0cf609d7bbec493702ee2193d7b Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:16:52 +0000 Subject: [PATCH 241/381] Refactor compare_method Co-Authored-By: Gabriel Smith --- src/librustc_typeck/check/compare_method.rs | 113 ++++++++++++-------- 1 file changed, 68 insertions(+), 45 deletions(-) diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 59766e7e47d6..32640d7d9a88 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -6,7 +6,7 @@ use rustc::traits::{self, ObligationCause, ObligationCauseCode, Reveal}; use rustc::ty::error::{ExpectedFound, TypeError}; use rustc::ty::subst::{Subst, InternalSubsts, SubstsRef}; use rustc::util::common::ErrorReported; -use errors::Applicability; +use errors::{Applicability, DiagnosticId}; use syntax_pos::Span; @@ -576,55 +576,78 @@ fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, Ok(()) } -fn compare_number_of_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - impl_m: &ty::AssociatedItem, - impl_m_span: Span, - trait_m: &ty::AssociatedItem, - trait_item_span: Option) - -> Result<(), ErrorReported> { - let impl_m_generics = tcx.generics_of(impl_m.def_id); - let trait_m_generics = tcx.generics_of(trait_m.def_id); - let num_impl_m_type_params = impl_m_generics.own_counts().types; - let num_trait_m_type_params = trait_m_generics.own_counts().types; +fn compare_number_of_generics<'a, 'tcx>( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + impl_: &ty::AssociatedItem, + impl_span: Span, + trait_: &ty::AssociatedItem, + trait_span: Option, +) -> Result<(), ErrorReported> { + let trait_own_counts = tcx.generics_of(trait_.def_id).own_counts(); + let impl_own_counts = tcx.generics_of(impl_.def_id).own_counts(); - if num_impl_m_type_params != num_trait_m_type_params { - let impl_m_node_id = tcx.hir().as_local_node_id(impl_m.def_id).unwrap(); - let impl_m_item = tcx.hir().expect_impl_item(impl_m_node_id); - let span = if impl_m_item.generics.params.is_empty() - || impl_m_item.generics.span.is_dummy() // impl Trait in argument position (#55374) - { - impl_m_span - } else { - impl_m_item.generics.span - }; + let matchings = [ + ("type", trait_own_counts.types, impl_own_counts.types), + ("const", trait_own_counts.consts, impl_own_counts.consts), + ]; - let mut err = struct_span_err!(tcx.sess, span, E0049, - "method `{}` has {} but its trait declaration has {}", - trait_m.ident, - potentially_plural_count(num_impl_m_type_params, "type parameter"), - potentially_plural_count(num_trait_m_type_params, "type parameter") - ); + let mut err_occurred = false; + for &(kind, trait_count, impl_count) in &matchings { + if impl_count != trait_count { + err_occurred = true; - let mut suffix = None; + let impl_node_id = tcx.hir().as_local_node_id(impl_.def_id).unwrap(); + let impl_item = tcx.hir().expect_impl_item(impl_node_id); + let span = if impl_item.generics.params.is_empty() + || impl_item.generics.span.is_dummy() { // argument position impl Trait (#55374) + impl_span + } else { + impl_item.generics.span + }; - if let Some(span) = trait_item_span { - err.span_label(span, format!("expected {}", - potentially_plural_count(num_trait_m_type_params, "type parameter"))); - } else { - suffix = Some(format!(", expected {}", num_trait_m_type_params)); + let mut err = tcx.sess.struct_span_err_with_code( + span, + &format!( + "method `{}` has {} {kind} parameter{} but its trait \ + declaration has {} {kind} parameter{}", + trait_.ident, + impl_count, + if impl_count != 1 { "s" } else { "" }, + trait_count, + if trait_count != 1 { "s" } else { "" }, + kind = kind, + ), + DiagnosticId::Error("E0049".into()), + ); + + let mut suffix = None; + + if let Some(span) = trait_span { + err.span_label( + span, + format!("expected {} {} parameter{}", trait_count, kind, + if trait_count != 1 { "s" } else { "" }) + ); + } else { + suffix = Some(format!(", expected {}", trait_count)); + } + + err.span_label( + span, + format!("found {} {} parameter{}{}", impl_count, kind, + if impl_count != 1 { "s" } else { "" }, + suffix.unwrap_or_else(|| String::new())), + ); + + err.emit(); } - - err.span_label(span, - format!("found {}{}", - potentially_plural_count(num_impl_m_type_params, "type parameter"), - suffix.as_ref().map(|s| &s[..]).unwrap_or(""))); - - err.emit(); - - return Err(ErrorReported); } - Ok(()) + if err_occurred { + Err(ErrorReported) + } else { + Ok(()) + } } fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -725,12 +748,12 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let trait_m_generics = tcx.generics_of(trait_m.def_id); let impl_m_type_params = impl_m_generics.params.iter().filter_map(|param| match param.kind { GenericParamDefKind::Type { synthetic, .. } => Some((param.def_id, synthetic)), - GenericParamDefKind::Lifetime => None, + GenericParamDefKind::Lifetime | GenericParamDefKind::Const => None, }); let trait_m_type_params = trait_m_generics.params.iter().filter_map(|param| { match param.kind { GenericParamDefKind::Type { synthetic, .. } => Some((param.def_id, synthetic)), - GenericParamDefKind::Lifetime => None, + GenericParamDefKind::Lifetime | GenericParamDefKind::Const => None, } }); for ((impl_def_id, impl_synthetic), (trait_def_id, trait_synthetic)) From 3001ae7f94672064ca5db1a9f425644e98c3ecc6 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:17:15 +0000 Subject: [PATCH 242/381] Implement wfcheck for const parameters Co-Authored-By: Gabriel Smith --- src/librustc_typeck/check/wfcheck.rs | 59 +++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 860fa526a1b9..16cf25f0d491 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -6,6 +6,7 @@ use rustc::traits::{self, ObligationCauseCode}; use rustc::ty::{self, Lift, Ty, TyCtxt, TyKind, GenericParamDefKind, TypeFoldable, ToPredicate}; use rustc::ty::subst::{Subst, InternalSubsts}; use rustc::util::nodemap::{FxHashSet, FxHashMap}; +use rustc::mir::interpret::ConstValue; use rustc::middle::lang_items; use rustc::infer::opaque_types::may_define_existential_type; @@ -436,7 +437,7 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>( // struct Foo> { .. } // Here the default `Vec<[u32]>` is not WF because `[u32]: Sized` does not hold. for param in &generics.params { - if let GenericParamDefKind::Type {..} = param.kind { + if let GenericParamDefKind::Type { .. } = param.kind { if is_our_default(¶m) { let ty = fcx.tcx.type_of(param.def_id); // ignore dependent defaults -- that is, where the default of one type @@ -464,7 +465,7 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>( // All regions are identity. fcx.tcx.mk_param_from_def(param) } - GenericParamDefKind::Type {..} => { + GenericParamDefKind::Type { .. } => { // If the param has a default, if is_our_default(param) { let default_ty = fcx.tcx.type_of(param.def_id); @@ -477,6 +478,10 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>( // Mark unwanted params as err. fcx.tcx.types.err.into() } + GenericParamDefKind::Const => { + // FIXME(const_generics:defaults) + fcx.tcx.types.err.into() + } } }); // Now we build the substituted predicates. @@ -497,6 +502,16 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>( fn visit_region(&mut self, _: ty::Region<'tcx>) -> bool { true } + + fn visit_const(&mut self, c: &'tcx ty::LazyConst<'tcx>) -> bool { + if let ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Param(param), + .. + }) = c { + self.params.insert(param.index); + } + c.super_visit_with(self) + } } let mut param_count = CountParams::default(); let has_region = pred.visit_with(&mut param_count); @@ -617,11 +632,10 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>( for (subst, param) in substs.iter().zip(&generics.params) { match subst.unpack() { ty::subst::UnpackedKind::Type(ty) => match ty.sty { - ty::Param(..) => {}, + ty::Param(..) => {} // prevent `fn foo() -> Foo` from being defining _ => { - tcx - .sess + tcx.sess .struct_span_err( span, "non-defining existential type use \ @@ -636,8 +650,9 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>( ), ) .emit(); - }, - }, // match ty + } + } + ty::subst::UnpackedKind::Lifetime(region) => { let param_span = tcx.def_span(param.def_id); if let ty::ReStatic = region { @@ -658,7 +673,31 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>( } else { seen.entry(region).or_default().push(param_span); } - }, + } + + ty::subst::UnpackedKind::Const(ct) => match ct { + ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Param(_), + .. + }) => {} + _ => { + tcx.sess + .struct_span_err( + span, + "non-defining existential type use \ + in defining scope", + ) + .span_note( + tcx.def_span(param.def_id), + &format!( + "used non-generic const {} for \ + generic parameter", + ty, + ), + ) + .emit(); + } + } } // match subst } // for (subst, param) for (_, spans) in seen { @@ -942,7 +981,9 @@ fn reject_shadowing_parameters(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) { let parent = tcx.generics_of(generics.parent.unwrap()); let impl_params: FxHashMap<_, _> = parent.params.iter().flat_map(|param| match param.kind { GenericParamDefKind::Lifetime => None, - GenericParamDefKind::Type {..} => Some((param.name, param.def_id)), + GenericParamDefKind::Type { .. } | GenericParamDefKind::Const => { + Some((param.name, param.def_id)) + } }).collect(); for method_param in &generics.params { From eb2b8be6a0dfc2b3d1e2e83e501d0a40b0a3469e Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:17:35 +0000 Subject: [PATCH 243/381] Implement collect for const parameters Co-Authored-By: Gabriel Smith --- src/librustc_typeck/collect.rs | 235 +++++++++++++++++++++------------ 1 file changed, 150 insertions(+), 85 deletions(-) diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 594e29ab9dde..20b1ab4478a7 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -1004,67 +1004,65 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty ast_generics .params .iter() - .filter_map(|param| match param.kind { - GenericParamKind::Type { - ref default, - synthetic, - .. - } => { - if param.name.ident().name == keywords::SelfUpper.name() { - span_bug!( - param.span, - "`Self` should not be the name of a regular parameter" - ); - } - - if !allow_defaults && default.is_some() { - if !tcx.features().default_type_parameter_fallback { - tcx.lint_hir( - lint::builtin::INVALID_TYPE_PARAM_DEFAULT, - param.hir_id, + .filter_map(|param| { + let kind = match param.kind { + GenericParamKind::Type { + ref default, + synthetic, + .. + } => { + if param.name.ident().name == keywords::SelfUpper.name() { + span_bug!( param.span, - &format!( - "defaults for type parameters are only allowed in \ - `struct`, `enum`, `type`, or `trait` definitions." - ), + "`Self` should not be the name of a regular parameter" ); } - } - let ty_param = ty::GenericParamDef { - index: type_start + i as u32, - name: param.name.ident().as_interned_str(), - def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id), - pure_wrt_drop: param.pure_wrt_drop, - kind: ty::GenericParamDefKind::Type { + if !allow_defaults && default.is_some() { + if !tcx.features().default_type_parameter_fallback { + tcx.lint_node( + lint::builtin::INVALID_TYPE_PARAM_DEFAULT, + param.hir_id, + param.span, + &format!( + "defaults for type parameters are only allowed in \ + `struct`, `enum`, `type`, or `trait` definitions." + ), + ); + } + } + + ty::GenericParamDefKind::Type { has_default: default.is_some(), object_lifetime_default: object_lifetime_defaults .as_ref() .map_or(rl::Set1::Empty, |o| o[i]), synthetic, - }, - }; - i += 1; - Some(ty_param) - } - GenericParamKind::Const { .. } => { - if param.name.ident().name == keywords::SelfUpper.name() { - span_bug!( - param.span, - "`Self` should not be the name of a regular parameter", - ); + } } + GenericParamKind::Const { .. } => { + if param.name.ident().name == keywords::SelfUpper.name() { + span_bug!( + param.span, + "`Self` should not be the name of a regular parameter", + ); + } - // Emit an error, but skip the parameter rather than aborting to - // continue to get other errors. - tcx.sess.struct_span_err( - param.span, - "const generics in any position are currently unsupported", - ).emit(); - None - } - _ => None, - }), + ty::GenericParamDefKind::Const + } + _ => return None, + }; + + let param_def = ty::GenericParamDef { + index: type_start + i as u32, + name: param.name.ident().as_interned_str(), + def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id), + pure_wrt_drop: param.pure_wrt_drop, + kind, + }; + i += 1; + Some(param_def) + }) ); // provide junk type parameter defs - the only place that @@ -1284,44 +1282,111 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_closure(def_id, substs) } - Node::AnonConst(_) => match tcx.hir().get_by_hir_id( - tcx.hir().get_parent_node_by_hir_id(hir_id)) - { - Node::Ty(&hir::Ty { - node: hir::TyKind::Array(_, ref constant), - .. - }) - | Node::Ty(&hir::Ty { - node: hir::TyKind::Typeof(ref constant), - .. - }) - | Node::Expr(&hir::Expr { - node: ExprKind::Repeat(_, ref constant), - .. - }) if constant.hir_id == hir_id => - { - tcx.types.usize - } + Node::AnonConst(_) => { + let parent_node = tcx.hir().get_by_hir_id(tcx.hir().get_parent_node_by_hir_id(hir_id)); + match parent_node { + Node::Ty(&hir::Ty { + node: hir::TyKind::Array(_, ref constant), + .. + }) + | Node::Ty(&hir::Ty { + node: hir::TyKind::Typeof(ref constant), + .. + }) + | Node::Expr(&hir::Expr { + node: ExprKind::Repeat(_, ref constant), + .. + }) if constant.hir_id == hir_id => + { + tcx.types.usize + } - Node::Variant(&Spanned { - node: - VariantKind { - disr_expr: Some(ref e), - .. - }, - .. - }) if e.hir_id == hir_id => - { - tcx.adt_def(tcx.hir().get_parent_did_by_hir_id(hir_id)) - .repr - .discr_type() - .to_ty(tcx) - } + Node::Variant(&Spanned { + node: + VariantKind { + disr_expr: Some(ref e), + .. + }, + .. + }) if e.hir_id == hir_id => + { + tcx.adt_def(tcx.hir().get_parent_did_by_hir_id(hir_id)) + .repr + .discr_type() + .to_ty(tcx) + } - x => { - bug!("unexpected const parent in type_of_def_id(): {:?}", x); + Node::Ty(&hir::Ty { node: hir::TyKind::Path(_), .. }) | + Node::Expr(&hir::Expr { node: ExprKind::Struct(..), .. }) | + Node::Expr(&hir::Expr { node: ExprKind::Path(_), .. }) => { + let path = match parent_node { + Node::Ty(&hir::Ty { node: hir::TyKind::Path(ref path), .. }) | + Node::Expr(&hir::Expr { node: ExprKind::Path(ref path), .. }) => { + path + } + Node::Expr(&hir::Expr { node: ExprKind::Struct(ref path, ..), .. }) => { + &*path + } + _ => unreachable!(), + }; + + match path { + QPath::Resolved(_, ref path) => { + let mut arg_index = 0; + let mut found_const = false; + for seg in &path.segments { + if let Some(generic_args) = &seg.args { + let args = &generic_args.args; + for arg in args { + if let GenericArg::Const(ct) = arg { + if ct.value.id == node_id { + found_const = true; + break; + } + arg_index += 1; + } + } + } + } + // Sanity check to make sure everything is as expected. + if !found_const { + bug!("no arg matching AnonConst in path") + } + match path.def { + // We've encountered an `AnonConst` in some path, so we need to + // figure out which generic parameter it corresponds to and return + // the relevant type. + Def::Struct(def_id) + | Def::Union(def_id) + | Def::Enum(def_id) + | Def::Fn(def_id) => { + let generics = tcx.generics_of(def_id); + let mut param_index = 0; + for param in &generics.params { + if let ty::GenericParamDefKind::Const = param.kind { + if param_index == arg_index { + return tcx.type_of(param.def_id); + } + param_index += 1; + } + } + // This is no generic parameter associated with the arg. This is + // probably from an extra arg where one is not needed. + return tcx.types.err; + } + Def::Err => tcx.types.err, + x => bug!("unexpected const parent path def {:?}", x), + } + } + x => bug!("unexpected const parent path {:?}", x), + } + } + + x => { + bug!("unexpected const parent in type_of_def_id(): {:?}", x); + } } - }, + } Node::GenericParam(param) => match ¶m.kind { hir::GenericParamKind::Type { default: Some(ref ty), .. } | From fc0fbe8bb5644a26d9ec17ce1d97e7cea85e76f9 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:18:04 +0000 Subject: [PATCH 244/381] Stub rustdoc const generics implementations Co-Authored-By: Gabriel Smith --- src/librustdoc/clean/mod.rs | 9 +++++++++ src/librustdoc/core.rs | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index c64a73fa308e..5d0d76507bd0 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1482,6 +1482,9 @@ impl<'tcx> Clean for ty::GenericParamDef { synthetic: None, }) } + ty::GenericParamDefKind::Const { .. } => { + unimplemented!() // FIXME(const_generics) + } }; GenericParamDef { @@ -1629,6 +1632,9 @@ impl<'a, 'tcx> Clean for (&'a ty::Generics, } Some(param.clean(cx)) } + ty::GenericParamDefKind::Const { .. } => { + unimplemented!() // FIXME(const_generics) + } }).collect::>(); let mut where_predicates = preds.predicates.iter() @@ -1678,6 +1684,9 @@ impl<'a, 'tcx> Clean for (&'a ty::Generics, .flat_map(|param| match param.kind { ty::GenericParamDefKind::Lifetime => Some(param.clean(cx)), ty::GenericParamDefKind::Type { .. } => None, + ty::GenericParamDefKind::Const { .. } => { + unimplemented!() // FIXME(const_generics) + } }).chain(simplify::ty_params(stripped_typarams).into_iter()) .collect(), where_predicates: simplify::where_clauses(cx, where_predicates), diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index fdb071638b79..07cfdde4a4e9 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -221,6 +221,9 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { ty::GenericParamDefKind::Type { .. } => { args.push(hir::GenericArg::Type(self.ty_param_to_ty(param.clone()))); } + ty::GenericParamDefKind::Const { .. } => { + unimplemented!() // FIXME(const_generics) + } } } From 133e776bf007c78c36c85d790fcd7c62f1d58ce0 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:18:30 +0000 Subject: [PATCH 245/381] Add HAS_CT_INFER Co-Authored-By: Gabriel Smith --- src/librustc/ty/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index bd3dd78c9bb6..a649e312b434 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -54,14 +54,14 @@ use crate::hir; pub use self::sty::{Binder, BoundTy, BoundTyKind, BoundVar, DebruijnIndex, INNERMOST}; pub use self::sty::{FnSig, GenSig, CanonicalPolyFnSig, PolyFnSig, PolyGenSig}; -pub use self::sty::{InferTy, ParamTy, ProjectionTy, ExistentialPredicate}; +pub use self::sty::{InferTy, ParamTy, ParamConst, InferConst, ProjectionTy, ExistentialPredicate}; pub use self::sty::{ClosureSubsts, GeneratorSubsts, UpvarSubsts, TypeAndMut}; pub use self::sty::{TraitRef, TyKind, PolyTraitRef}; pub use self::sty::{ExistentialTraitRef, PolyExistentialTraitRef}; pub use self::sty::{ExistentialProjection, PolyExistentialProjection, Const, LazyConst}; pub use self::sty::{BoundRegion, EarlyBoundRegion, FreeRegion, Region}; pub use self::sty::RegionKind; -pub use self::sty::{TyVid, IntVid, FloatVid, RegionVid}; +pub use self::sty::{TyVid, IntVid, FloatVid, ConstVid, RegionVid}; pub use self::sty::BoundRegion::*; pub use self::sty::InferTy::*; pub use self::sty::RegionKind::*; @@ -451,6 +451,8 @@ bitflags! { const HAS_TY_PLACEHOLDER = 1 << 14; + const HAS_CT_INFER = 1 << 15; + const NEEDS_SUBST = TypeFlags::HAS_PARAMS.bits | TypeFlags::HAS_SELF.bits | TypeFlags::HAS_RE_EARLY_BOUND.bits; @@ -462,6 +464,7 @@ bitflags! { TypeFlags::HAS_SELF.bits | TypeFlags::HAS_TY_INFER.bits | TypeFlags::HAS_RE_INFER.bits | + TypeFlags::HAS_CT_INFER.bits | TypeFlags::HAS_RE_PLACEHOLDER.bits | TypeFlags::HAS_RE_EARLY_BOUND.bits | TypeFlags::HAS_FREE_REGIONS.bits | From 2dfde8843885aec59c4cf90a424bf56e3658fc9e Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:18:43 +0000 Subject: [PATCH 246/381] Implement structural_impls for const generics Co-Authored-By: Gabriel Smith --- src/librustc/ty/structural_impls.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index f1a465e1f172..f9eb336a4a3e 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -5,12 +5,13 @@ use crate::mir::ProjectionKind; use crate::mir::interpret::ConstValue; -use crate::ty::{self, Lift, Ty, TyCtxt}; +use crate::ty::{self, Lift, Ty, TyCtxt, ConstVid, InferConst}; use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use rustc_data_structures::indexed_vec::{IndexVec, Idx}; use smallvec::SmallVec; use crate::mir::interpret; +use std::marker::PhantomData; use std::rc::Rc; /////////////////////////////////////////////////////////////////////////// @@ -49,6 +50,7 @@ CloneTypeFoldableAndLiftImpls! { crate::ty::BoundRegion, crate::ty::ClosureKind, crate::ty::IntVarValue, + crate::ty::ParamConst, crate::ty::ParamTy, crate::ty::UniverseIndex, crate::ty::Variance, @@ -503,6 +505,14 @@ impl<'a, 'tcx> Lift<'tcx> for ConstValue<'a> { type Lifted = ConstValue<'tcx>; fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { match *self { + ConstValue::Param(param) => Some(ConstValue::Param(param)), + ConstValue::Infer(infer) => { + Some(ConstValue::Infer(match infer { + InferConst::Var(vid) => InferConst::Var(vid.lift_to_tcx(tcx)?), + InferConst::Fresh(i) => InferConst::Fresh(i), + InferConst::Canonical(debrujin, var) => InferConst::Canonical(debrujin, var), + })) + } ConstValue::Scalar(x) => Some(ConstValue::Scalar(x)), ConstValue::Slice(x, y) => Some(ConstValue::Slice(x, y)), ConstValue::ByRef(ptr, alloc) => Some(ConstValue::ByRef( @@ -512,6 +522,16 @@ impl<'a, 'tcx> Lift<'tcx> for ConstValue<'a> { } } +impl<'a, 'tcx> Lift<'tcx> for ConstVid<'a> { + type Lifted = ConstVid<'tcx>; + fn lift_to_tcx<'b, 'gcx>(&self, _: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + Some(ConstVid { + index: self.index, + phantom: PhantomData, + }) + } +} + /////////////////////////////////////////////////////////////////////////// // TypeFoldable implementations. // From 8e56729b4da52c56c51bbabf35c3999578d0b098 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:19:13 +0000 Subject: [PATCH 247/381] Handle new ConstValue variants in mir Co-Authored-By: Gabriel Smith --- .../nll/region_infer/error_reporting/region_name.rs | 9 ++++++++- .../borrow_check/nll/type_check/constraint_conversion.rs | 5 +++++ src/librustc_mir/borrow_check/nll/type_check/mod.rs | 2 +- src/librustc_mir/interpret/operand.rs | 2 ++ src/librustc_mir/shim.rs | 9 ++------- src/librustc_mir/transform/check_unsafety.rs | 5 +++-- src/librustc_mir/transform/inline.rs | 2 +- 7 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs index cc01f632e075..fdede054e15f 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs @@ -604,7 +604,14 @@ impl<'tcx> RegionInferenceContext<'tcx> { search_stack.push((ty, hir_ty)); } - (UnpackedKind::Lifetime(_), _) | (UnpackedKind::Type(_), _) => { + (UnpackedKind::Const(_ct), hir::GenericArg::Const(_hir_ct)) => { + // Lifetimes cannot be found in consts, so we don't need + // to search anything here. + } + + (UnpackedKind::Lifetime(_), _) + | (UnpackedKind::Type(_), _) + | (UnpackedKind::Const(_), _) => { // I *think* that HIR lowering should ensure this // doesn't happen, even in erroneous // programs. Else we should use delay-span-bug. diff --git a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs b/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs index 1a72205ad7ae..bef159e996b8 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs @@ -99,6 +99,11 @@ impl<'a, 'gcx, 'tcx> ConstraintConversion<'a, 'gcx, 'tcx> { param_env, ).type_must_outlive(origin, t1, r2); } + + UnpackedKind::Const(_) => { + // Consts cannot outlive one another, so we + // don't need to handle any relations here. + } } } diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index cc03d4a0c964..5b444ab9690c 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -2533,7 +2533,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { ), )) } - UnpackedKind::Type(_) => None, + UnpackedKind::Type(_) | UnpackedKind::Const(_) => None, } }) .collect(); diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 979595d6c000..574506ed2329 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -594,6 +594,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> self.layout_of(ty) })?; let op = match val.val { + ConstValue::Param(_) => Err(EvalErrorKind::TooGeneric.into()), + ConstValue::Infer(_) => bug!(), ConstValue::ByRef(ptr, alloc) => { // We rely on mutability being set correctly in that allocation to prevent writes // where none should happen -- and for `static mut`, we copy on demand anyway. diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index db8476f3be5f..1c6b1450be86 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -2,7 +2,7 @@ use rustc::hir; use rustc::hir::def_id::DefId; use rustc::infer; use rustc::mir::*; -use rustc::ty::{self, Ty, TyCtxt, GenericParamDefKind}; +use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::layout::VariantIdx; use rustc::ty::subst::{Subst, InternalSubsts}; use rustc::ty::query::Providers; @@ -450,12 +450,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { ) { let tcx = self.tcx; - let substs = InternalSubsts::for_item(tcx, self.def_id, |param, _| { - match param.kind { - GenericParamDefKind::Lifetime => tcx.types.re_erased.into(), - GenericParamDefKind::Type {..} => ty.into(), - } - }); + let substs = tcx.mk_substs_trait(ty, &[]); // `func == Clone::clone(&ty) -> ty` let func_ty = tcx.mk_fn_def(self.def_id, substs); diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index a8816720b28b..047731e3fe6a 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -558,9 +558,10 @@ fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: D // FIXME: when we make this a hard error, this should have its // own error code. - let message = if tcx.generics_of(def_id).own_counts().types != 0 { + let counts = tcx.generics_of(def_id).own_counts(); + let message = if counts.types + counts.consts != 0 { "#[derive] can't be used on a #[repr(packed)] struct with \ - type parameters (error E0133)".to_string() + type or const parameters (error E0133)".to_string() } else { "#[derive] can't be used on a #[repr(packed)] struct that \ does not derive Copy (error E0133)".to_string() diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 4cdef015b53f..918375e426b7 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -259,7 +259,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { // inlining. This is to ensure that the final crate doesn't have MIR that // reference unexported symbols if callsite.callee.is_local() { - if callsite.substs.types().count() == 0 && !hinted { + if callsite.substs.non_erasable_generics().count() == 0 && !hinted { debug!(" callee is an exported function - not inlining"); return false; } From c236c241e66c786f1d585aec62744d4995b6227b Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:19:42 +0000 Subject: [PATCH 248/381] Handle const generics in typeck Co-Authored-By: Gabriel Smith --- src/librustc_typeck/check/closure.rs | 10 +++++---- src/librustc_typeck/check/dropck.rs | 3 +++ src/librustc_typeck/check/method/confirm.rs | 3 +++ src/librustc_typeck/check/method/mod.rs | 4 ++-- src/librustc_typeck/check/method/probe.rs | 10 +++++++-- src/librustc_typeck/check/mod.rs | 22 ++++++++++++++++++- .../constrained_type_params.rs | 15 +++++++++++++ src/librustc_typeck/impl_wf_check.rs | 11 +++++++++- src/librustc_typeck/outlives/mod.rs | 22 +++++++++++++------ src/librustc_typeck/outlives/utils.rs | 4 ++++ 10 files changed, 87 insertions(+), 17 deletions(-) diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index db89b32be7b6..f7396cbd42f2 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -99,11 +99,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let substs = base_substs.extend_to(self.tcx,expr_def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => { - span_bug!(expr.span, "closure has region param") + span_bug!(expr.span, "closure has lifetime param") } - GenericParamDefKind::Type {..} => { - self.infcx - .next_ty_var(TypeVariableOrigin::ClosureSynthetic(expr.span)).into() + GenericParamDefKind::Type { .. } => { + self.infcx.next_ty_var(TypeVariableOrigin::ClosureSynthetic(expr.span)).into() + } + GenericParamDefKind::Const => { + span_bug!(expr.span, "closure has const param") } } }); diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index 12c7484f0f92..2184555a07d3 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -313,6 +313,9 @@ pub fn check_safety_of_destructor_if_necessary<'a, 'gcx, 'tcx>( match kind.unpack() { UnpackedKind::Lifetime(r) => rcx.sub_regions(origin(), parent_scope, r), UnpackedKind::Type(ty) => rcx.type_must_outlive(origin(), ty, parent_scope), + UnpackedKind::Const(_) => { + // Generic consts don't add constraints. + } } } Ok(()) diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 996d6cfd5683..e0b96ae884f3 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -341,6 +341,9 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { (GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => { self.to_ty(ty).into() } + (GenericParamDefKind::Const, GenericArg::Const(ct)) => { + self.to_const(&ct.value, self.tcx.type_of(param.def_id)).into() + } _ => unreachable!(), } }, diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index d81d24e6d2b0..8f27b5b7dc81 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -283,8 +283,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Construct a trait-reference `self_ty : Trait` let substs = InternalSubsts::for_item(self.tcx, trait_def_id, |param, _| { match param.kind { - GenericParamDefKind::Lifetime => {} - GenericParamDefKind::Type {..} => { + GenericParamDefKind::Lifetime | GenericParamDefKind::Const => {} + GenericParamDefKind::Type { .. } => { if param.index == 0 { return self_ty.into(); } else if let Some(ref input_types) = opt_input_types { diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index a4624eebcba8..efae870c3c3a 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -1528,7 +1528,10 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { // `impl_self_ty()` for an explanation. self.tcx.types.re_erased.into() } - GenericParamDefKind::Type {..} => self.var_for_def(self.span, param), + GenericParamDefKind::Type { .. } + | GenericParamDefKind::Const => { + self.var_for_def(self.span, param) + } } } }); @@ -1545,10 +1548,13 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { InternalSubsts::for_item(self.tcx, def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => self.tcx.types.re_erased.into(), - GenericParamDefKind::Type {..} => { + GenericParamDefKind::Type { .. } => { self.next_ty_var(TypeVariableOrigin::SubstitutionPlaceholder( self.tcx.def_span(def_id))).into() } + GenericParamDefKind::Const { .. } => { + unimplemented!() // FIXME(const_generics) + } } }) } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 183667e22446..301d7d3ac562 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -2437,6 +2437,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty } + pub fn to_const(&self, ast_c: &hir::AnonConst, ty: Ty<'tcx>) -> &'tcx ty::LazyConst<'tcx> { + AstConv::ast_const_to_const(self, ast_c, ty) + } + // If the type given by the user has free regions, save it for later, since // NLL would like to enforce those. Also pass in types that involve // projections, since those can resolve to `'static` bounds (modulo #54940, @@ -5501,6 +5505,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { (GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => { self.to_ty(ty).into() } + (GenericParamDefKind::Const, GenericArg::Const(ct)) => { + self.to_const(&ct.value, self.tcx.type_of(param.def_id)).into() + } _ => unreachable!(), } }, @@ -5528,6 +5535,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.var_for_def(span, param) } } + GenericParamDefKind::Const => { + // FIXME(const_generics:defaults) + // No const parameters were provided, we have to infer them. + self.var_for_def(span, param) + } } }, ); @@ -5685,11 +5697,19 @@ pub fn check_bounds_are_used<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, generics: &ty::Generics, ty: Ty<'tcx>) { let own_counts = generics.own_counts(); - debug!("check_bounds_are_used(n_tps={}, ty={:?})", own_counts.types, ty); + debug!( + "check_bounds_are_used(n_tys={}, n_cts={}, ty={:?})", + own_counts.types, + own_counts.consts, + ty + ); + + // FIXME(const_generics): we probably want to check the bounds for const parameters too. if own_counts.types == 0 { return; } + // Make a vector of booleans initially false, set to true when used. let mut types_used = vec![false; own_counts.types]; diff --git a/src/librustc_typeck/constrained_type_params.rs b/src/librustc_typeck/constrained_type_params.rs index 6a530f454d2b..4b922c340388 100644 --- a/src/librustc_typeck/constrained_type_params.rs +++ b/src/librustc_typeck/constrained_type_params.rs @@ -1,6 +1,7 @@ use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::fold::{TypeFoldable, TypeVisitor}; use rustc::util::nodemap::FxHashSet; +use rustc::mir::interpret::ConstValue; use syntax::source_map::Span; #[derive(Clone, PartialEq, Eq, Hash, Debug)] @@ -14,6 +15,10 @@ impl From for Parameter { fn from(param: ty::EarlyBoundRegion) -> Self { Parameter(param.index) } } +impl From for Parameter { + fn from(param: ty::ParamConst) -> Self { Parameter(param.index) } +} + /// Returns the set of parameters constrained by the impl header. pub fn parameters_for_impl<'tcx>(impl_self_ty: Ty<'tcx>, impl_trait_ref: Option>) @@ -72,6 +77,16 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector { } false } + + fn visit_const(&mut self, c: &'tcx ty::LazyConst<'tcx>) -> bool { + if let ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Param(data), + .. + }) = c { + self.parameters.push(Parameter::from(*data)); + } + false + } } pub fn identify_constrained_type_params<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index b79277ffbbce..5677f2c94d8e 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -120,7 +120,7 @@ fn enforce_impl_params_are_constrained<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, for param in &impl_generics.params { match param.kind { // Disallow ANY unconstrained type parameters. - ty::GenericParamDefKind::Type {..} => { + ty::GenericParamDefKind::Type { .. } => { let param_ty = ty::ParamTy::for_def(param); if !input_parameters.contains(&ctp::Parameter::from(param_ty)) { report_unused_parameter(tcx, @@ -139,6 +139,15 @@ fn enforce_impl_params_are_constrained<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ¶m.name.to_string()); } } + ty::GenericParamDefKind::Const => { + let param_ct = ty::ParamConst::for_def(param); + if !input_parameters.contains(&ctp::Parameter::from(param_ct)) { + report_unused_parameter(tcx, + tcx.def_span(param.def_id), + "const", + ¶m_ct.to_string()); + } + } } } diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index b3634d37cc2b..1ab414c1f015 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -98,14 +98,22 @@ fn inferred_outlives_crate<'tcx>( .map(|(&def_id, set)| { let vec: Vec> = set .iter() - .map( + .filter_map( |ty::OutlivesPredicate(kind1, region2)| match kind1.unpack() { - UnpackedKind::Type(ty1) => ty::Predicate::TypeOutlives(ty::Binder::bind( - ty::OutlivesPredicate(ty1, region2), - )), - UnpackedKind::Lifetime(region1) => ty::Predicate::RegionOutlives( - ty::Binder::bind(ty::OutlivesPredicate(region1, region2)), - ), + UnpackedKind::Type(ty1) => { + Some(ty::Predicate::TypeOutlives(ty::Binder::bind( + ty::OutlivesPredicate(ty1, region2) + ))) + } + UnpackedKind::Lifetime(region1) => { + Some(ty::Predicate::RegionOutlives( + ty::Binder::bind(ty::OutlivesPredicate(region1, region2)) + )) + } + UnpackedKind::Const(_) => { + // Generic consts don't impose any constraints. + None + } }, ).collect(); (def_id, Lrc::new(vec)) diff --git a/src/librustc_typeck/outlives/utils.rs b/src/librustc_typeck/outlives/utils.rs index c886c7a4ffce..ee552ca9cbb2 100644 --- a/src/librustc_typeck/outlives/utils.rs +++ b/src/librustc_typeck/outlives/utils.rs @@ -118,6 +118,10 @@ pub fn insert_outlives_predicate<'tcx>( } required_predicates.insert(ty::OutlivesPredicate(kind, outlived_region)); } + + UnpackedKind::Const(_) => { + // Generic consts don't impose any constraints. + } } } From 54b935b9b99a8cf276bc55906b9817f8cf44bfbb Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:20:06 +0000 Subject: [PATCH 249/381] Handle const generics elsewhere Co-Authored-By: Gabriel Smith --- src/librustc/middle/resolve_lifetime.rs | 2 +- src/librustc/traits/error_reporting.rs | 3 ++- src/librustc/traits/mod.rs | 3 ++- src/librustc/traits/object_safety.rs | 3 ++- src/librustc/traits/on_unimplemented.rs | 3 ++- src/librustc/ty/relate.rs | 3 +++ src/librustc/ty/util.rs | 20 ++++++++++++++++---- src/librustc_privacy/lib.rs | 10 ++++++++-- src/librustc_traits/chalk_context/mod.rs | 13 ++++++++++++- 9 files changed, 48 insertions(+), 12 deletions(-) diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 2618d0874cbc..d2bec1070f92 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -1974,7 +1974,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { object_lifetime_default, .. } => Some(object_lifetime_default), - GenericParamDefKind::Lifetime => None, + GenericParamDefKind::Lifetime | GenericParamDefKind::Const => None, }) .collect() }) diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 3eb49092fed1..322e384e13e2 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -389,7 +389,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { for param in generics.params.iter() { let value = match param.kind { - GenericParamDefKind::Type {..} => { + GenericParamDefKind::Type { .. } | + GenericParamDefKind::Const => { trait_ref.substs[param.index as usize].to_string() }, GenericParamDefKind::Lifetime => continue, diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index ee7893a27de7..32bb7f186938 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -1010,7 +1010,8 @@ fn vtable_methods<'a, 'tcx>( InternalSubsts::for_item(tcx, def_id, |param, _| match param.kind { GenericParamDefKind::Lifetime => tcx.types.re_erased.into(), - GenericParamDefKind::Type {..} => { + GenericParamDefKind::Type { .. } | + GenericParamDefKind::Const => { trait_ref.substs[param.index as usize] } } diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index b2079c251693..e7a5138e6893 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -310,7 +310,8 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { } // We can't monomorphize things like `fn foo(...)`. - if self.generics_of(method.def_id).own_counts().types != 0 { + let own_counts = self.generics_of(method.def_id).own_counts(); + if own_counts.types + own_counts.consts != 0 { return Some(MethodViolationCode::Generic); } diff --git a/src/librustc/traits/on_unimplemented.rs b/src/librustc/traits/on_unimplemented.rs index f61c32614cc9..c86fd0d52b90 100644 --- a/src/librustc/traits/on_unimplemented.rs +++ b/src/librustc/traits/on_unimplemented.rs @@ -280,7 +280,8 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedFormatString { let generics = tcx.generics_of(trait_ref.def_id); let generic_map = generics.params.iter().filter_map(|param| { let value = match param.kind { - GenericParamDefKind::Type {..} => { + GenericParamDefKind::Type { .. } | + GenericParamDefKind::Const => { trait_ref.substs[param.index as usize].to_string() }, GenericParamDefKind::Lifetime => return None diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index 2940757fa905..3a31801b3be3 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -705,6 +705,9 @@ impl<'tcx> Relate<'tcx> for Kind<'tcx> { (UnpackedKind::Type(unpacked), x) => { bug!("impossible case reached: can't relate: {:?} with {:?}", unpacked, x) } + (UnpackedKind::Const(_), _) => { + unimplemented!() // FIXME(const_generics) + } } } } diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 4ad3ffaa93da..fb0d1e2080b0 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -12,6 +12,7 @@ use crate::ty::subst::{Subst, InternalSubsts, SubstsRef, UnpackedKind}; use crate::ty::query::TyCtxtAt; use crate::ty::TyKind::*; use crate::ty::layout::{Integer, IntegerExt}; +use crate::mir::interpret::ConstValue; use crate::util::common::ErrorReported; use crate::middle::lang_items; @@ -495,8 +496,16 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { }) => { !impl_generics.type_param(pt, self).pure_wrt_drop } - UnpackedKind::Lifetime(_) | UnpackedKind::Type(_) => { - // not a type or region param - this should be reported + UnpackedKind::Const(&ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Param(ref pc), + .. + })) => { + !impl_generics.const_param(pc, self).pure_wrt_drop + } + UnpackedKind::Lifetime(_) | + UnpackedKind::Type(_) | + UnpackedKind::Const(_) => { + // Not a type, const or region param: this should be reported // as an error. false } @@ -587,15 +596,18 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { Some(ty::Binder::bind(env_ty)) } - /// Given the `DefId` of some item that has no type parameters, make + /// Given the `DefId` of some item that has no type or const parameters, make /// a suitable "empty substs" for it. pub fn empty_substs_for_def_id(self, item_def_id: DefId) -> SubstsRef<'tcx> { InternalSubsts::for_item(self, item_def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => self.types.re_erased.into(), - GenericParamDefKind::Type {..} => { + GenericParamDefKind::Type { .. } => { bug!("empty_substs_for_def_id: {:?} has type parameters", item_def_id) } + GenericParamDefKind::Const { .. } => { + bug!("empty_substs_for_def_id: {:?} has const parameters", item_def_id) + } } }) } diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 550b333700b0..a9f05eb60db1 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -748,12 +748,15 @@ impl<'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { fn generics(&mut self) -> &mut Self { for param in &self.ev.tcx.generics_of(self.item_def_id).params { match param.kind { + GenericParamDefKind::Lifetime => {} GenericParamDefKind::Type { has_default, .. } => { if has_default { self.visit(self.ev.tcx.type_of(param.def_id)); } } - GenericParamDefKind::Lifetime => {} + GenericParamDefKind::Const => { + self.visit(self.ev.tcx.type_of(param.def_id)); + } } } self @@ -1517,12 +1520,15 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { fn generics(&mut self) -> &mut Self { for param in &self.tcx.generics_of(self.item_def_id).params { match param.kind { + GenericParamDefKind::Lifetime => {} GenericParamDefKind::Type { has_default, .. } => { if has_default { self.visit(self.tcx.type_of(param.def_id)); } } - GenericParamDefKind::Lifetime => {} + GenericParamDefKind::Const => { + self.visit(self.tcx.type_of(param.def_id)); + } } } self diff --git a/src/librustc_traits/chalk_context/mod.rs b/src/librustc_traits/chalk_context/mod.rs index a326d84725ab..6420f20a3ea2 100644 --- a/src/librustc_traits/chalk_context/mod.rs +++ b/src/librustc_traits/chalk_context/mod.rs @@ -32,11 +32,12 @@ use rustc::traits::{ InEnvironment, ChalkCanonicalGoal, }; -use rustc::ty::{self, TyCtxt}; +use rustc::ty::{self, TyCtxt, InferConst}; use rustc::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use rustc::ty::query::Providers; use rustc::ty::subst::{Kind, UnpackedKind}; use rustc_data_structures::sync::Lrc; +use rustc::mir::interpret::ConstValue; use syntax_pos::DUMMY_SP; use std::fmt::{self, Debug}; @@ -287,6 +288,16 @@ impl context::ContextOps> for ChalkContext<'cx, 'gcx> { } _ => false, }, + UnpackedKind::Const(ct) => match ct { + ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Infer(InferConst::Canonical(debruijn, bound_ct)), + .. + }) => { + debug_assert_eq!(*debruijn, ty::INNERMOST); + cvar == *bound_ct + } + _ => false, + } }) } From 4c18ee4abd572ad778aee89e2bee17e7d097f31e Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:20:22 +0000 Subject: [PATCH 250/381] Update const generics tests Co-Authored-By: Gabriel Smith --- .../const-expression-parameter.rs | 3 ++- .../const-expression-parameter.stderr | 15 +++++++++------ .../const-fn-with-const-param.rs | 1 - .../const-fn-with-const-param.stderr | 9 +-------- .../const-param-before-other-params.rs | 4 +--- .../const-param-before-other-params.stderr | 18 +++--------------- .../const-param-from-outer-fn.rs | 1 - .../const-param-from-outer-fn.stderr | 11 ++--------- .../const-parameter-uppercase-lint.rs | 4 +++- .../const-parameter-uppercase-lint.stderr | 17 +++++++++-------- 10 files changed, 30 insertions(+), 53 deletions(-) diff --git a/src/test/ui/const-generics/const-expression-parameter.rs b/src/test/ui/const-generics/const-expression-parameter.rs index f4e9008dbd0f..0883caa5c707 100644 --- a/src/test/ui/const-generics/const-expression-parameter.rs +++ b/src/test/ui/const-generics/const-expression-parameter.rs @@ -2,7 +2,6 @@ //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash fn u32_identity() -> u32 { - //~^ ERROR const generics in any position are currently unsupported 5 } @@ -16,6 +15,8 @@ fn foo_b() { fn foo_c() { u32_identity::< -1 >(); // ok + // FIXME(const_generics) + //~^^ ERROR cannot apply unary operator `-` to type `u32` [E0600] } fn main() { diff --git a/src/test/ui/const-generics/const-expression-parameter.stderr b/src/test/ui/const-generics/const-expression-parameter.stderr index 1dd3a960316d..8871aa45788e 100644 --- a/src/test/ui/const-generics/const-expression-parameter.stderr +++ b/src/test/ui/const-generics/const-expression-parameter.stderr @@ -1,11 +1,11 @@ error: expected identifier, found `<-` - --> $DIR/const-expression-parameter.rs:10:19 + --> $DIR/const-expression-parameter.rs:9:19 | LL | u32_identity::<-1>(); //~ ERROR expected identifier, found `<-` | ^^ expected identifier error: expected one of `,` or `>`, found `+` - --> $DIR/const-expression-parameter.rs:14:22 + --> $DIR/const-expression-parameter.rs:13:22 | LL | u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` | ^ expected one of `,` or `>` here @@ -16,11 +16,14 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t LL | #![feature(const_generics)] | ^^^^^^^^^^^^^^ -error: const generics in any position are currently unsupported - --> $DIR/const-expression-parameter.rs:4:23 +error[E0600]: cannot apply unary operator `-` to type `u32` + --> $DIR/const-expression-parameter.rs:17:21 | -LL | fn u32_identity() -> u32 { - | ^ +LL | u32_identity::< -1 >(); // ok + | ^^ cannot apply unary operator `-` + | + = note: unsigned values cannot be negated error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0600`. diff --git a/src/test/ui/const-generics/const-fn-with-const-param.rs b/src/test/ui/const-generics/const-fn-with-const-param.rs index 052d723d96ed..f36bf3875c34 100644 --- a/src/test/ui/const-generics/const-fn-with-const-param.rs +++ b/src/test/ui/const-generics/const-fn-with-const-param.rs @@ -3,7 +3,6 @@ const fn const_u32_identity() -> u32 { //~^ ERROR const parameters are not permitted in `const fn` - //~^^ ERROR const generics in any position are currently unsupported X } diff --git a/src/test/ui/const-generics/const-fn-with-const-param.stderr b/src/test/ui/const-generics/const-fn-with-const-param.stderr index a08ebfb0d976..94d2afa25b4f 100644 --- a/src/test/ui/const-generics/const-fn-with-const-param.stderr +++ b/src/test/ui/const-generics/const-fn-with-const-param.stderr @@ -9,16 +9,9 @@ error: const parameters are not permitted in `const fn` | LL | / const fn const_u32_identity() -> u32 { LL | | //~^ ERROR const parameters are not permitted in `const fn` -LL | | //~^^ ERROR const generics in any position are currently unsupported LL | | X LL | | } | |_^ -error: const generics in any position are currently unsupported - --> $DIR/const-fn-with-const-param.rs:4:35 - | -LL | const fn const_u32_identity() -> u32 { - | ^ - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/src/test/ui/const-generics/const-param-before-other-params.rs b/src/test/ui/const-generics/const-param-before-other-params.rs index 47f826789e03..188b5dce31ea 100644 --- a/src/test/ui/const-generics/const-param-before-other-params.rs +++ b/src/test/ui/const-generics/const-param-before-other-params.rs @@ -1,14 +1,12 @@ #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash -fn foo(_: T) { +fn foo(_: &T) { //~^ ERROR type parameters must be declared prior to const parameters - //~^^ ERROR const generics in any position are currently unsupported } fn bar(_: &'a ()) { //~^ ERROR lifetime parameters must be declared prior to const parameters - //~^^ ERROR const generics in any position are currently unsupported } fn main() {} diff --git a/src/test/ui/const-generics/const-param-before-other-params.stderr b/src/test/ui/const-generics/const-param-before-other-params.stderr index a43415d0e5a4..78f129e79ea2 100644 --- a/src/test/ui/const-generics/const-param-before-other-params.stderr +++ b/src/test/ui/const-generics/const-param-before-other-params.stderr @@ -7,26 +7,14 @@ LL | #![feature(const_generics)] error: type parameters must be declared prior to const parameters --> $DIR/const-param-before-other-params.rs:4:21 | -LL | fn foo(_: T) { +LL | fn foo(_: &T) { | --------------^- help: reorder the parameters: lifetimes, then types, then consts: `` error: lifetime parameters must be declared prior to const parameters - --> $DIR/const-param-before-other-params.rs:9:21 + --> $DIR/const-param-before-other-params.rs:8:21 | LL | fn bar(_: &'a ()) { | --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const X: ()>` -error: const generics in any position are currently unsupported - --> $DIR/const-param-before-other-params.rs:4:14 - | -LL | fn foo(_: T) { - | ^ - -error: const generics in any position are currently unsupported - --> $DIR/const-param-before-other-params.rs:9:14 - | -LL | fn bar(_: &'a ()) { - | ^ - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/const-param-from-outer-fn.rs b/src/test/ui/const-generics/const-param-from-outer-fn.rs index 5a8dd92086f8..6534bcf5ce64 100644 --- a/src/test/ui/const-generics/const-param-from-outer-fn.rs +++ b/src/test/ui/const-generics/const-param-from-outer-fn.rs @@ -2,7 +2,6 @@ //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash fn foo() { - //~^ ERROR const generics in any position are currently unsupported fn bar() -> u32 { X //~ ERROR can't use generic parameters from outer function } diff --git a/src/test/ui/const-generics/const-param-from-outer-fn.stderr b/src/test/ui/const-generics/const-param-from-outer-fn.stderr index b238b3a2aa45..f40b527d7160 100644 --- a/src/test/ui/const-generics/const-param-from-outer-fn.stderr +++ b/src/test/ui/const-generics/const-param-from-outer-fn.stderr @@ -5,22 +5,15 @@ LL | #![feature(const_generics)] | ^^^^^^^^^^^^^^ error[E0401]: can't use generic parameters from outer function - --> $DIR/const-param-from-outer-fn.rs:7:9 + --> $DIR/const-param-from-outer-fn.rs:6:9 | LL | fn foo() { | - const variable from outer function -LL | //~^ ERROR const generics in any position are currently unsupported LL | fn bar() -> u32 { | --- try adding a local generic parameter in this method instead LL | X //~ ERROR can't use generic parameters from outer function | ^ use of generic parameter from outer function -error: const generics in any position are currently unsupported - --> $DIR/const-param-from-outer-fn.rs:4:14 - | -LL | fn foo() { - | ^ - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0401`. diff --git a/src/test/ui/const-generics/const-parameter-uppercase-lint.rs b/src/test/ui/const-generics/const-parameter-uppercase-lint.rs index 37fe9af98b3d..164205dd75cb 100644 --- a/src/test/ui/const-generics/const-parameter-uppercase-lint.rs +++ b/src/test/ui/const-generics/const-parameter-uppercase-lint.rs @@ -4,5 +4,7 @@ #![deny(non_upper_case_globals)] fn noop() { - //~^ ERROR const generics in any position are currently unsupported + //~^ ERROR const parameter `x` should have an upper case name } + +fn main() {} diff --git a/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr b/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr index 9683e91cef30..190798d202be 100644 --- a/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr +++ b/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr @@ -4,16 +4,17 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t LL | #![feature(const_generics)] | ^^^^^^^^^^^^^^ -error[E0601]: `main` function not found in crate `const_parameter_uppercase_lint` - | - = note: consider adding a `main` function to `$DIR/const-parameter-uppercase-lint.rs` - -error: const generics in any position are currently unsupported +error: const parameter `x` should have an upper case name --> $DIR/const-parameter-uppercase-lint.rs:6:15 | LL | fn noop() { - | ^ + | ^ help: convert the identifier to upper case: `X` + | +note: lint level defined here + --> $DIR/const-parameter-uppercase-lint.rs:4:9 + | +LL | #![deny(non_upper_case_globals)] + | ^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0601`. From 3e3a4212e8bf8fb52088906a0cbf6a2699c7f035 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 01:20:35 +0000 Subject: [PATCH 251/381] Update test fallout Co-Authored-By: Gabriel Smith --- .../ui/derives/deriving-with-repr-packed.stderr | 4 ++-- .../feature-gates/feature-gate-const_generics.rs | 2 -- .../feature-gate-const_generics.stderr | 16 ++-------------- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/test/ui/derives/deriving-with-repr-packed.stderr b/src/test/ui/derives/deriving-with-repr-packed.stderr index 4ab14a1df84d..9d96908a0562 100644 --- a/src/test/ui/derives/deriving-with-repr-packed.stderr +++ b/src/test/ui/derives/deriving-with-repr-packed.stderr @@ -1,4 +1,4 @@ -error: #[derive] can't be used on a #[repr(packed)] struct with type parameters (error E0133) +error: #[derive] can't be used on a #[repr(packed)] struct with type or const parameters (error E0133) --> $DIR/deriving-with-repr-packed.rs:8:16 | LL | #[derive(Copy, Clone, PartialEq, Eq)] @@ -12,7 +12,7 @@ LL | #![deny(safe_packed_borrows)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #46043 -error: #[derive] can't be used on a #[repr(packed)] struct with type parameters (error E0133) +error: #[derive] can't be used on a #[repr(packed)] struct with type or const parameters (error E0133) --> $DIR/deriving-with-repr-packed.rs:8:23 | LL | #[derive(Copy, Clone, PartialEq, Eq)] diff --git a/src/test/ui/feature-gates/feature-gate-const_generics.rs b/src/test/ui/feature-gates/feature-gate-const_generics.rs index 907e00b11e55..fe1ded1c4bbc 100644 --- a/src/test/ui/feature-gates/feature-gate-const_generics.rs +++ b/src/test/ui/feature-gates/feature-gate-const_generics.rs @@ -1,7 +1,5 @@ fn foo() {} //~ ERROR const generics are unstable -//~^ const generics in any position are currently unsupported struct Foo([(); X]); //~ ERROR const generics are unstable -//~^ const generics in any position are currently unsupported fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-const_generics.stderr b/src/test/ui/feature-gates/feature-gate-const_generics.stderr index 3ab1aa2367f1..bd86a4197a76 100644 --- a/src/test/ui/feature-gates/feature-gate-const_generics.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_generics.stderr @@ -7,25 +7,13 @@ LL | fn foo() {} //~ ERROR const generics are unstable = help: add #![feature(const_generics)] to the crate attributes to enable error[E0658]: const generics are unstable (see issue #44580) - --> $DIR/feature-gate-const_generics.rs:4:18 + --> $DIR/feature-gate-const_generics.rs:3:18 | LL | struct Foo([(); X]); //~ ERROR const generics are unstable | ^ | = help: add #![feature(const_generics)] to the crate attributes to enable -error: const generics in any position are currently unsupported - --> $DIR/feature-gate-const_generics.rs:1:14 - | -LL | fn foo() {} //~ ERROR const generics are unstable - | ^ - -error: const generics in any position are currently unsupported - --> $DIR/feature-gate-const_generics.rs:4:18 - | -LL | struct Foo([(); X]); //~ ERROR const generics are unstable - | ^ - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. From 162405f2221439fc9410ecb60f3e5939c2f2fac8 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 11:01:39 +0000 Subject: [PATCH 252/381] Fix negative integer literal test Co-Authored-By: Gabriel Smith --- .../const-generics/const-expression-parameter.rs | 12 +++++------- .../const-expression-parameter.stderr | 15 +++------------ 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/test/ui/const-generics/const-expression-parameter.rs b/src/test/ui/const-generics/const-expression-parameter.rs index 0883caa5c707..662c7b767bae 100644 --- a/src/test/ui/const-generics/const-expression-parameter.rs +++ b/src/test/ui/const-generics/const-expression-parameter.rs @@ -1,24 +1,22 @@ #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash -fn u32_identity() -> u32 { +fn i32_identity() -> i32 { 5 } fn foo_a() { - u32_identity::<-1>(); //~ ERROR expected identifier, found `<-` + i32_identity::<-1>(); //~ ERROR expected identifier, found `<-` } fn foo_b() { - u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` + i32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` } fn foo_c() { - u32_identity::< -1 >(); // ok - // FIXME(const_generics) - //~^^ ERROR cannot apply unary operator `-` to type `u32` [E0600] + i32_identity::< -1 >(); // ok } fn main() { - u32_identity::<5>(); // ok + i32_identity::<5>(); // ok } diff --git a/src/test/ui/const-generics/const-expression-parameter.stderr b/src/test/ui/const-generics/const-expression-parameter.stderr index 8871aa45788e..2741d6212562 100644 --- a/src/test/ui/const-generics/const-expression-parameter.stderr +++ b/src/test/ui/const-generics/const-expression-parameter.stderr @@ -1,13 +1,13 @@ error: expected identifier, found `<-` --> $DIR/const-expression-parameter.rs:9:19 | -LL | u32_identity::<-1>(); //~ ERROR expected identifier, found `<-` +LL | i32_identity::<-1>(); //~ ERROR expected identifier, found `<-` | ^^ expected identifier error: expected one of `,` or `>`, found `+` --> $DIR/const-expression-parameter.rs:13:22 | -LL | u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` +LL | i32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` | ^ expected one of `,` or `>` here warning: the feature `const_generics` is incomplete and may cause the compiler to crash @@ -16,14 +16,5 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t LL | #![feature(const_generics)] | ^^^^^^^^^^^^^^ -error[E0600]: cannot apply unary operator `-` to type `u32` - --> $DIR/const-expression-parameter.rs:17:21 - | -LL | u32_identity::< -1 >(); // ok - | ^^ cannot apply unary operator `-` - | - = note: unsigned values cannot be negated +error: aborting due to 2 previous errors -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0600`. From 0da0457593c5c1cb09f6197782ca73617860e897 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 20 Feb 2019 12:47:19 +0000 Subject: [PATCH 253/381] Clean up some generic substs handling --- src/librustc/infer/opaque_types/mod.rs | 11 ++++++++--- src/librustc/infer/outlives/obligations.rs | 20 +++++++++++++------- src/librustc_typeck/check/regionck.rs | 22 ++++++++++++++-------- 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index 159bc1ceae26..1b7ecc7c3a67 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -381,10 +381,15 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { substs, item_def_id: _, }) => { - for r in substs.regions() { - bound_region(r); + for k in substs { + match k.unpack() { + UnpackedKind::Lifetime(lt) => bound_region(lt), + UnpackedKind::Type(ty) => types.push(ty), + UnpackedKind::Const(_) => { + // Const parameters don't impose constraints. + } + } } - types.extend(substs.types()); } Component::EscapingProjection(more_components) => { diff --git a/src/librustc/infer/outlives/obligations.rs b/src/librustc/infer/outlives/obligations.rs index bbda3d2fdbf8..ee6603284851 100644 --- a/src/librustc/infer/outlives/obligations.rs +++ b/src/librustc/infer/outlives/obligations.rs @@ -67,6 +67,7 @@ use crate::hir; use crate::traits::ObligationCause; use crate::ty::outlives::Component; use crate::ty::{self, Region, Ty, TyCtxt, TypeFoldable}; +use crate::ty::subst::UnpackedKind; impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { /// Registers that the given region obligation must be resolved @@ -430,13 +431,18 @@ where if approx_env_bounds.is_empty() && trait_bounds.is_empty() && needs_infer { debug!("projection_must_outlive: no declared bounds"); - for component_ty in projection_ty.substs.types() { - self.type_must_outlive(origin.clone(), component_ty, region); - } - - for r in projection_ty.substs.regions() { - self.delegate - .push_sub_region_constraint(origin.clone(), region, r); + for k in projection_ty.substs { + match k.unpack() { + UnpackedKind::Lifetime(lt) => { + self.delegate.push_sub_region_constraint(origin.clone(), region, lt); + } + UnpackedKind::Type(ty) => { + self.type_must_outlive(origin.clone(), ty, region); + } + UnpackedKind::Const(_) => { + // Const parameters don't impose constraints. + } + } } return; diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index b549986777c8..a03d33a3ef5b 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -81,7 +81,7 @@ use rustc::hir::def_id::DefId; use rustc::infer::outlives::env::OutlivesEnvironment; use rustc::infer::{self, RegionObligation, SuppressRegionErrors}; use rustc::ty::adjustment; -use rustc::ty::subst::SubstsRef; +use rustc::ty::subst::{SubstsRef, UnpackedKind}; use rustc::ty::{self, Ty}; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; @@ -1407,13 +1407,19 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { let origin = infer::ParameterInScope(origin, expr_span); - for region in substs.regions() { - self.sub_regions(origin.clone(), expr_region, region); - } - - for ty in substs.types() { - let ty = self.resolve_type(ty); - self.type_must_outlive(origin.clone(), ty, expr_region); + for kind in substs { + match kind.unpack() { + UnpackedKind::Lifetime(lt) => { + self.sub_regions(origin.clone(), expr_region, lt); + } + UnpackedKind::Type(ty) => { + let ty = self.resolve_type(ty); + self.type_must_outlive(origin.clone(), ty, expr_region); + } + UnpackedKind::Const(_) => { + // Const parameters don't impose constraints. + } + } } } } From 5c8b3c38f1a5a0270b29fa01f14c9db0b255ea43 Mon Sep 17 00:00:00 2001 From: varkor Date: Tue, 5 Mar 2019 22:31:06 +0000 Subject: [PATCH 254/381] Fix rebase fallout --- src/librustc_mir/interpret/operand.rs | 2 +- src/librustc_typeck/astconv.rs | 6 +++--- src/librustc_typeck/collect.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 574506ed2329..11b4aa17ec43 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -594,7 +594,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> self.layout_of(ty) })?; let op = match val.val { - ConstValue::Param(_) => Err(EvalErrorKind::TooGeneric.into()), + ConstValue::Param(_) => return Err(EvalErrorKind::TooGeneric.into()), ConstValue::Infer(_) => bug!(), ConstValue::ByRef(ptr, alloc) => { // We rely on mutability being set correctly in that allocation to prevent writes diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 1dec2d483b80..be708c78a0dd 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1869,14 +1869,14 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { ast_const: &hir::AnonConst, ty: Ty<'tcx> ) -> &'tcx ty::LazyConst<'tcx> { - debug!("ast_const_to_const(id={:?}, ast_const={:?})", ast_const.id, ast_const); + debug!("ast_const_to_const(id={:?}, ast_const={:?})", ast_const.hir_id, ast_const); let tcx = self.tcx(); - let def_id = tcx.hir().local_def_id(ast_const.id); + let def_id = tcx.hir().local_def_id_from_hir_id(ast_const.hir_id); let mut lazy_const = ty::LazyConst::Unevaluated( def_id, - Substs::identity_for_item(tcx, def_id) + InternalSubsts::identity_for_item(tcx, def_id), ); let expr = &tcx.hir().body(ast_const.body).value; diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 20b1ab4478a7..eb4bbe880693 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -1020,7 +1020,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty if !allow_defaults && default.is_some() { if !tcx.features().default_type_parameter_fallback { - tcx.lint_node( + tcx.lint_hir( lint::builtin::INVALID_TYPE_PARAM_DEFAULT, param.hir_id, param.span, @@ -1339,7 +1339,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { let args = &generic_args.args; for arg in args { if let GenericArg::Const(ct) = arg { - if ct.value.id == node_id { + if ct.value.hir_id == hir_id { found_const = true; break; } From ed9227abbdb14728777691c0d595a93c57a796bf Mon Sep 17 00:00:00 2001 From: varkor Date: Tue, 5 Mar 2019 22:49:37 +0000 Subject: [PATCH 255/381] Make adjustments for comments --- src/librustc_mir/interpret/operand.rs | 8 ++++++-- src/librustc_mir/monomorphize/collector.rs | 13 ++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 11b4aa17ec43..1ebff4115101 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -593,9 +593,13 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> let ty = self.monomorphize(val.ty)?; self.layout_of(ty) })?; - let op = match val.val { - ConstValue::Param(_) => return Err(EvalErrorKind::TooGeneric.into()), + let val = match val.val { + ConstValue::Param(_) => self.monomorphize(val)?.val, ConstValue::Infer(_) => bug!(), + val => val, + }; + let op = match val { + ConstValue::Param(_) | ConstValue::Infer(_) => unreachable!(), ConstValue::ByRef(ptr, alloc) => { // We rely on mutability being set correctly in that allocation to prevent writes // where none should happen -- and for `static mut`, we copy on demand anyway. diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 2ce3bf43cfc7..4350bfcdc7a9 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -467,14 +467,13 @@ fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, { let type_length = instance.substs.types().flat_map(|ty| ty.walk()).count(); let const_length = instance.substs.consts() - .filter_map(|ct| { - if let ty::LazyConst::Evaluated(ct) = ct { - Some(ct.ty.walk()) - } else { - None - } + .flat_map(|ct| { + let ty = match ct { + ty::LazyConst::Evaluated(ct) => ct.ty, + ty::LazyConst::Unevaluated(def_id, _) => tcx.type_of(*def_id), + }; + ty.walk() }) - .flatten() .count(); debug!(" => type length={}, const length={}", type_length, const_length); From 5384a11fcaa71d74d93f7e4ea4a2662ae28698fe Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 5 Mar 2019 16:17:50 -0800 Subject: [PATCH 256/381] Apply suggestions from code review Co-Authored-By: cuviper --- src/libcore/slice/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index b48101c23dad..4bccd44f5036 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -3291,8 +3291,8 @@ impl<'a, T> IterMut<'a, T> { /// Views the underlying data as a subslice of the original data. /// - /// To avoid creating `&mut` references that alias, this has a - /// borrowed lifetime from the iterator. + /// To avoid creating `&mut [T]` references that alias, the returned slice + /// borrows its lifetime from the iterator the method is applied on. /// /// # Examples /// @@ -3302,11 +3302,11 @@ impl<'a, T> IterMut<'a, T> { /// # #![feature(slice_iter_mut_as_slice)] /// // First, we declare a type which has `iter_mut` method to get the `IterMut` /// // struct (&[usize here]): - /// let mut slice = &mut [1, 2, 3]; + /// let mut slice: &mut [usize] = &mut [1, 2, 3]; /// /// // Then, we get the iterator: /// let mut iter = slice.iter_mut(); - /// // So if we print what `as_slice` method returns here, we have "[1, 2, 3]": + /// // So if we print what the `as_slice` method returns here, we have "[1, 2, 3]": /// println!("{:?}", iter.as_slice()); /// assert_eq!(iter.as_slice(), &[1, 2, 3]); /// From 51e0d1c2990619ed55e0a387ae4fab71992069df Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 5 Mar 2019 16:20:50 -0800 Subject: [PATCH 257/381] Clean up the example on slice::IterMut::as_slice() --- src/libcore/slice/mod.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 4bccd44f5036..5af6b9e8fe63 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -3300,20 +3300,16 @@ impl<'a, T> IterMut<'a, T> { /// /// ``` /// # #![feature(slice_iter_mut_as_slice)] - /// // First, we declare a type which has `iter_mut` method to get the `IterMut` - /// // struct (&[usize here]): /// let mut slice: &mut [usize] = &mut [1, 2, 3]; /// - /// // Then, we get the iterator: + /// // First, we get the iterator: /// let mut iter = slice.iter_mut(); - /// // So if we print what the `as_slice` method returns here, we have "[1, 2, 3]": - /// println!("{:?}", iter.as_slice()); + /// // So if we check what the `as_slice` method returns here, we have "[1, 2, 3]": /// assert_eq!(iter.as_slice(), &[1, 2, 3]); /// /// // Next, we move to the second element of the slice: /// iter.next(); /// // Now `as_slice` returns "[2, 3]": - /// println!("{:?}", iter.as_slice()); /// assert_eq!(iter.as_slice(), &[2, 3]); /// ``` #[unstable(feature = "slice_iter_mut_as_slice", reason = "recently added", issue = "0")] From e478cadbbe51e335b7248018141877b88770fe68 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 5 Mar 2019 16:28:32 -0800 Subject: [PATCH 258/381] Add a tracking issue for new as_slice methods --- src/liballoc/vec.rs | 2 +- src/libcore/slice/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 7c3cab77bfbb..adcd3d84f483 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -2481,7 +2481,7 @@ impl<'a, T> Drain<'a, T> { /// let _ = drain.next().unwrap(); /// assert_eq!(drain.as_slice(), &['b', 'c']); /// ``` - #[unstable(feature = "vec_drain_as_slice", reason = "recently added", issue = "0")] + #[unstable(feature = "vec_drain_as_slice", reason = "recently added", issue = "58957")] pub fn as_slice(&self) -> &[T] { self.iter.as_slice() } diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 5af6b9e8fe63..b3594f8a3858 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -3312,7 +3312,7 @@ impl<'a, T> IterMut<'a, T> { /// // Now `as_slice` returns "[2, 3]": /// assert_eq!(iter.as_slice(), &[2, 3]); /// ``` - #[unstable(feature = "slice_iter_mut_as_slice", reason = "recently added", issue = "0")] + #[unstable(feature = "slice_iter_mut_as_slice", reason = "recently added", issue = "58957")] pub fn as_slice(&self) -> &[T] { self.make_slice() } From 669be1a0a6ffe8e57ac9a0182e085ff9d9910743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 5 Mar 2019 19:05:03 -0800 Subject: [PATCH 259/381] On incorrect cfg literal/identifier, point at the right span --- src/libsyntax/parse/attr.rs | 2 +- .../conditional-compilation/cfg-attr-syntax-validation.stderr | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index e7937f57002f..6c02a7407e04 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -286,7 +286,7 @@ impl<'a> Parser<'a> { let found = self.this_token_to_string(); let msg = format!("expected unsuffixed literal or identifier, found {}", found); - Err(self.diagnostic().struct_span_err(lo, &msg)) + Err(self.diagnostic().struct_span_err(self.span, &msg)) } /// matches meta_seq = ( COMMASEP(meta_item_inner) ) diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index bcf13ead2f4f..0770d1038e11 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -53,10 +53,10 @@ LL | #[cfg(a = b"hi")] //~ ERROR literal in `cfg` predicate value must be a str | ^^^^^ help: consider removing the prefix: `"hi"` error: expected unsuffixed literal or identifier, found concat!("nonexistent") - --> $DIR/cfg-attr-syntax-validation.rs:30:15 + --> $DIR/cfg-attr-syntax-validation.rs:30:25 | LL | #[cfg(feature = $expr)] - | ^^^^^^^ + | ^^^^^ ... LL | generate_s10!(concat!("nonexistent")); | -------------------------------------- in this macro invocation From d5bb71c9f1042c0c931c7dddecc418233de6e30f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 23 Feb 2019 16:40:15 +0100 Subject: [PATCH 260/381] Split up privacy checking so privacy_access_levels only does computations required for AccessLevels --- src/librustc/dep_graph/dep_node.rs | 1 + src/librustc/ty/query/config.rs | 6 ++ src/librustc/ty/query/mod.rs | 3 +- src/librustc/ty/query/plumbing.rs | 1 + src/librustc_interface/passes.rs | 29 ++++-- src/librustc_privacy/lib.rs | 88 +++++++++---------- .../ui/privacy/private-inferred-type.stderr | 36 ++++---- 7 files changed, 89 insertions(+), 75 deletions(-) diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index c607eb5906e6..a46ffffe94cb 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -456,6 +456,7 @@ define_dep_nodes!( <'tcx> [eval_always] CoherenceInherentImplOverlapCheck, [] CoherenceCheckTrait(DefId), [eval_always] PrivacyAccessLevels(CrateNum), + [eval_always] CheckPrivacy(CrateNum), [eval_always] Analysis(CrateNum), // Represents the MIR for a fn; also used as the task node for diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index feca0f7170ef..0fef90c945e9 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -369,6 +369,12 @@ impl<'tcx> QueryDescription<'tcx> for queries::privacy_access_levels<'tcx> { } } +impl<'tcx> QueryDescription<'tcx> for queries::check_privacy<'tcx> { + fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> { + "privacy checking".into() + } +} + impl<'tcx> QueryDescription<'tcx> for queries::typeck_item_bodies<'tcx> { fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> { "type-checking all item bodies".into() diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs index 197b9a71b0ac..cb72ad6fe8bd 100644 --- a/src/librustc/ty/query/mod.rs +++ b/src/librustc/ty/query/mod.rs @@ -350,8 +350,9 @@ define_queries! { <'tcx> [] fn check_match: CheckMatch(DefId) -> Result<(), ErrorReported>, - /// Performs the privacy check and computes "access levels". + /// Performs part of the privacy check and computes "access levels". [] fn privacy_access_levels: PrivacyAccessLevels(CrateNum) -> Lrc, + [] fn check_privacy: CheckPrivacy(CrateNum) -> (), }, Other { diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index ebaa31d703f8..ff2639da1365 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -1251,6 +1251,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, force!(crate_inherent_impls_overlap_check, LOCAL_CRATE) }, DepKind::PrivacyAccessLevels => { force!(privacy_access_levels, LOCAL_CRATE); } + DepKind::CheckPrivacy => { force!(check_privacy, LOCAL_CRATE); } DepKind::MirBuilt => { force!(mir_built, def_id!()); } DepKind::MirConstQualif => { force!(mir_const_qualif, def_id!()); } DepKind::MirConst => { force!(mir_const, def_id!()); } diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 16ced6956380..591583a1526d 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -21,7 +21,7 @@ use rustc_borrowck as borrowck; use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::stable_hasher::StableHasher; -use rustc_data_structures::sync::Lrc; +use rustc_data_structures::sync::{Lrc, ParallelIterator, par_iter}; use rustc_incremental; use rustc_metadata::creader::CrateLoader; use rustc_metadata::cstore::{self, CStore}; @@ -278,17 +278,28 @@ fn analysis<'tcx>( time(sess, "misc checking", || { parallel!({ - time(sess, "privacy checking", || { - rustc_privacy::check_crate(tcx) + time(sess, "privacy access levels", || { + tcx.ensure().privacy_access_levels(LOCAL_CRATE); + }); + parallel!({ + time(sess, "privacy checking", || { + tcx.ensure().check_privacy(LOCAL_CRATE); + }); + }, { + time(sess, "death checking", || middle::dead::check_crate(tcx)); + }, { + time(sess, "unused lib feature checking", || { + stability::check_unused_or_stable_features(tcx) + }); + }, { + time(sess, "lint checking", || lint::check_crate(tcx)); }); }, { - time(sess, "death checking", || middle::dead::check_crate(tcx)); - }, { - time(sess, "unused lib feature checking", || { - stability::check_unused_or_stable_features(tcx) + time(sess, "privacy checking modules", || { + par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| { + tcx.ensure().check_mod_privacy(tcx.hir().local_def_id(module)); + }); }); - }, { - time(sess, "lint checking", || lint::check_crate(tcx)); }); }); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 550b333700b0..372a92306942 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1760,19 +1760,15 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> pub fn provide(providers: &mut Providers<'_>) { *providers = Providers { privacy_access_levels, + check_privacy, check_mod_privacy, ..*providers }; } -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Lrc { - tcx.privacy_access_levels(LOCAL_CRATE) -} - fn check_mod_privacy<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { let empty_tables = ty::TypeckTables::empty(None); - // Check privacy of names not checked in previous compilation stages. let mut visitor = NamePrivacyVisitor { tcx, @@ -1803,18 +1799,6 @@ fn privacy_access_levels<'tcx>( ) -> Lrc { assert_eq!(krate, LOCAL_CRATE); - let krate = tcx.hir().krate(); - - for &module in krate.modules.keys() { - tcx.ensure().check_mod_privacy(tcx.hir().local_def_id(module)); - } - - let private_crates: FxHashSet = tcx.sess.opts.extern_private.iter() - .flat_map(|c| { - tcx.crates().iter().find(|&&krate| &tcx.crate_name(krate) == c).cloned() - }).collect(); - - // Build up a set of all exported items in the AST. This is a set of all // items which are reachable from external crates based on visibility. let mut visitor = EmbargoVisitor { @@ -1824,7 +1808,7 @@ fn privacy_access_levels<'tcx>( changed: false, }; loop { - intravisit::walk_crate(&mut visitor, krate); + intravisit::walk_crate(&mut visitor, tcx.hir().krate()); if visitor.changed { visitor.changed = false; } else { @@ -1833,36 +1817,46 @@ fn privacy_access_levels<'tcx>( } visitor.update(hir::CRATE_HIR_ID, Some(AccessLevel::Public)); - { - let mut visitor = ObsoleteVisiblePrivateTypesVisitor { - tcx, - access_levels: &visitor.access_levels, - in_variant: false, - old_error_set: Default::default(), - }; - intravisit::walk_crate(&mut visitor, krate); - - - let has_pub_restricted = { - let mut pub_restricted_visitor = PubRestrictedVisitor { - tcx, - has_pub_restricted: false - }; - intravisit::walk_crate(&mut pub_restricted_visitor, krate); - pub_restricted_visitor.has_pub_restricted - }; - - // Check for private types and traits in public interfaces. - let mut visitor = PrivateItemsInPublicInterfacesVisitor { - tcx, - has_pub_restricted, - old_error_set: &visitor.old_error_set, - private_crates - }; - krate.visit_all_item_likes(&mut DeepVisitor::new(&mut visitor)); - } - Lrc::new(visitor.access_levels) } +fn check_privacy<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, krate: CrateNum) { + assert_eq!(krate, LOCAL_CRATE); + + let access_levels = tcx.privacy_access_levels(LOCAL_CRATE); + + let krate = tcx.hir().krate(); + + let mut visitor = ObsoleteVisiblePrivateTypesVisitor { + tcx, + access_levels: &access_levels, + in_variant: false, + old_error_set: Default::default(), + }; + intravisit::walk_crate(&mut visitor, krate); + + let has_pub_restricted = { + let mut pub_restricted_visitor = PubRestrictedVisitor { + tcx, + has_pub_restricted: false + }; + intravisit::walk_crate(&mut pub_restricted_visitor, krate); + pub_restricted_visitor.has_pub_restricted + }; + + let private_crates: FxHashSet = tcx.sess.opts.extern_private.iter() + .flat_map(|c| { + tcx.crates().iter().find(|&&krate| &tcx.crate_name(krate) == c).cloned() + }).collect(); + + // Check for private types and traits in public interfaces. + let mut visitor = PrivateItemsInPublicInterfacesVisitor { + tcx, + has_pub_restricted, + old_error_set: &visitor.old_error_set, + private_crates + }; + krate.visit_all_item_likes(&mut DeepVisitor::new(&mut visitor)); +} + __build_diagnostic_array! { librustc_privacy, DIAGNOSTICS } diff --git a/src/test/ui/privacy/private-inferred-type.stderr b/src/test/ui/privacy/private-inferred-type.stderr index 80a475f7dcee..568d4dadc8cc 100644 --- a/src/test/ui/privacy/private-inferred-type.stderr +++ b/src/test/ui/privacy/private-inferred-type.stderr @@ -1,3 +1,21 @@ +error[E0446]: private type `m::Priv` in public interface + --> $DIR/private-inferred-type.rs:61:36 + | +LL | struct Priv; + | - `m::Priv` declared as private +... +LL | impl TraitWithAssocTy for u8 { type AssocTy = Priv; } + | ^^^^^^^^^^^^^^^^^^^^ can't leak private type + +error[E0446]: private type `adjust::S2` in public interface + --> $DIR/private-inferred-type.rs:83:9 + | +LL | struct S2; + | - `adjust::S2` declared as private +... +LL | type Target = S2Alias; //~ ERROR private type `adjust::S2` in public interface + | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type + error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:97:9 | @@ -202,24 +220,6 @@ error: type `m::Priv` is private LL | match a { //~ ERROR type `m::Priv` is private | ^ -error[E0446]: private type `m::Priv` in public interface - --> $DIR/private-inferred-type.rs:61:36 - | -LL | struct Priv; - | - `m::Priv` declared as private -... -LL | impl TraitWithAssocTy for u8 { type AssocTy = Priv; } - | ^^^^^^^^^^^^^^^^^^^^ can't leak private type - -error[E0446]: private type `adjust::S2` in public interface - --> $DIR/private-inferred-type.rs:83:9 - | -LL | struct S2; - | - `adjust::S2` declared as private -... -LL | type Target = S2Alias; //~ ERROR private type `adjust::S2` in public interface - | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type - error: aborting due to 33 previous errors For more information about this error, try `rustc --explain E0446`. From d2923e5a77b318300c9d35d63d594125b8b9a43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 23 Feb 2019 16:47:13 +0100 Subject: [PATCH 261/381] Run the first block in a parallel! macro directly in the scope which guarantees that it will run immediately --- src/librustc_data_structures/sync.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/librustc_data_structures/sync.rs b/src/librustc_data_structures/sync.rs index ba1f6eb56fe8..14e625af2992 100644 --- a/src/librustc_data_structures/sync.rs +++ b/src/librustc_data_structures/sync.rs @@ -280,21 +280,22 @@ cfg_if! { #[macro_export] macro_rules! parallel { - (impl [$($c:tt,)*] [$block:tt $(, $rest:tt)*]) => { - parallel!(impl [$block, $($c,)*] [$($rest),*]) + (impl $fblock:tt [$($c:tt,)*] [$block:tt $(, $rest:tt)*]) => { + parallel!(impl $fblock [$block, $($c,)*] [$($rest),*]) }; - (impl [$($blocks:tt,)*] []) => { + (impl $fblock:tt [$($blocks:tt,)*] []) => { ::rustc_data_structures::sync::scope(|s| { $( s.spawn(|_| $blocks); )* + $fblock; }) }; - ($($blocks:tt),*) => { + ($fblock:tt, $($blocks:tt),*) => { // Reverse the order of the blocks since Rayon executes them in reverse order // when using a single thread. This ensures the execution order matches that // of a single threaded rustc - parallel!(impl [] [$($blocks),*]); + parallel!(impl $fblock [] [$($blocks),*]); }; } From 1745957d637d86f111f4aa96e47f68a7433f0e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 23 Feb 2019 18:12:38 +0100 Subject: [PATCH 262/381] Make misc checking 2 more parallel --- src/librustc/middle/intrinsicck.rs | 6 ---- src/librustc/middle/liveness.rs | 6 ---- src/librustc_interface/passes.rs | 33 ++++++++++---------- src/librustc_mir/hair/pattern/check_match.rs | 7 ----- src/librustc_mir/hair/pattern/mod.rs | 1 - src/librustc_mir/lib.rs | 1 - src/librustc_passes/rvalue_promotion.rs | 7 ----- 7 files changed, 17 insertions(+), 44 deletions(-) diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs index ce20ca39533b..c4071e9f354b 100644 --- a/src/librustc/middle/intrinsicck.rs +++ b/src/librustc/middle/intrinsicck.rs @@ -10,12 +10,6 @@ use syntax_pos::Span; use crate::hir::intravisit::{self, Visitor, NestedVisitorMap}; use crate::hir; -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for &module in tcx.hir().krate().modules.keys() { - tcx.ensure().check_mod_intrinsics(tcx.hir().local_def_id(module)); - } -} - fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 76933a6e3484..031d6dec090a 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -185,12 +185,6 @@ fn check_mod_liveness<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut IrMaps::new(tcx).as_deep_visitor()); } -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for &module in tcx.hir().krate().modules.keys() { - tcx.ensure().check_mod_liveness(tcx.hir().local_def_id(module)); - } -} - pub fn provide(providers: &mut Providers<'_>) { *providers = Providers { check_mod_liveness, diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 591583a1526d..cf4a3ecf555b 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -218,24 +218,25 @@ fn analysis<'tcx>( // passes are timed inside typeck typeck::check_crate(tcx)?; - time(sess, "misc checking", || { + time(sess, "misc checking 2", || { parallel!({ - time(sess, "rvalue promotion", || { - rvalue_promotion::check_crate(tcx) + time(sess, "rvalue promotion + match checking", || { + tcx.par_body_owners(|def_id| { + tcx.ensure().const_is_rvalue_promotable_to_static(def_id); + tcx.ensure().check_match(def_id); + }); }); }, { - time(sess, "intrinsic checking", || { - middle::intrinsicck::check_crate(tcx) - }); - }, { - time(sess, "match checking", || mir::matchck_crate(tcx)); - }, { - // this must run before MIR dump, because - // "not all control paths return a value" is reported here. - // - // maybe move the check to a MIR pass? - time(sess, "liveness checking", || { - middle::liveness::check_crate(tcx) + time(sess, "liveness checking + intrinsic checking", || { + par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| { + // this must run before MIR dump, because + // "not all control paths return a value" is reported here. + // + // maybe move the check to a MIR pass? + tcx.ensure().check_mod_liveness(tcx.hir().local_def_id(module)); + + tcx.ensure().check_mod_intrinsics(tcx.hir().local_def_id(module)); + }); }); }); }); @@ -276,7 +277,7 @@ fn analysis<'tcx>( return Err(ErrorReported); } - time(sess, "misc checking", || { + time(sess, "misc checking 3", || { parallel!({ time(sess, "privacy access levels", || { tcx.ensure().privacy_access_levels(LOCAL_CRATE); diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 9af513a90905..787dba15f4da 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -27,13 +27,6 @@ use std::slice; use syntax::ptr::P; use syntax_pos::{Span, DUMMY_SP, MultiSpan}; -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for def_id in tcx.body_owners() { - tcx.ensure().check_match(def_id); - } - tcx.sess.abort_if_errors(); -} - pub(crate) fn check_match<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index d5f2e7a7275e..4788454b86ab 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -3,7 +3,6 @@ mod _match; mod check_match; -pub use self::check_match::check_crate; pub(crate) use self::check_match::check_match; use crate::const_eval::{const_field, const_variant_index}; diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index 06e79dc4e709..0b735b4b39cf 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -54,7 +54,6 @@ pub mod interpret; pub mod monomorphize; pub mod const_eval; -pub use hair::pattern::check_crate as matchck_crate; use rustc::ty::query::Providers; pub fn provide(providers: &mut Providers<'_>) { diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index edd658254467..a059ab40697b 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -39,13 +39,6 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for &body_id in &tcx.hir().krate().body_ids { - let def_id = tcx.hir().body_owner_def_id(body_id); - tcx.const_is_rvalue_promotable_to_static(def_id); - } -} - fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool From 140a837fb647c5554102ec28e8713a913224cdbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 23 Feb 2019 18:32:45 +0100 Subject: [PATCH 263/381] Make misc checking 1 more parallel --- src/librustc/hir/check_attr.rs | 6 ------ src/librustc/middle/stability.rs | 6 ------ src/librustc_interface/passes.rs | 36 +++++++++++++++----------------- src/librustc_passes/loops.rs | 6 ------ 4 files changed, 17 insertions(+), 37 deletions(-) diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 8b304007a357..86f7e1499648 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -344,12 +344,6 @@ impl<'a, 'tcx> Visitor<'tcx> for CheckAttrVisitor<'a, 'tcx> { } } -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for &module in tcx.hir().krate().modules.keys() { - tcx.ensure().check_mod_attrs(tcx.hir().local_def_id(module)); - } -} - fn is_c_like_enum(item: &hir::Item) -> bool { if let hir::ItemKind::Enum(ref def, _) = item.node { for variant in &def.variants { diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index aa2392448616..1677384059e0 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -456,12 +456,6 @@ impl<'a, 'tcx> Index<'tcx> { } } -pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for &module in tcx.hir().krate().modules.keys() { - tcx.ensure().check_mod_unstable_api_usage(tcx.hir().local_def_id(module)); - } -} - /// Cross-references the feature names of unstable APIs with enabled /// features and possibly prints errors. fn check_mod_unstable_api_usage<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index cf4a3ecf555b..2066747a6ffb 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -191,27 +191,25 @@ fn analysis<'tcx>( let sess = tcx.sess; - parallel!({ - time(sess, "looking for entry point", || { - middle::entry::find_entry_point(tcx) - }); + time(sess, "misc checking 1", || { + parallel!({ + time(sess, "looking for entry point", || { + middle::entry::find_entry_point(tcx) + }); - time(sess, "looking for plugin registrar", || { - plugin::build::find_plugin_registrar(tcx) - }); + time(sess, "looking for plugin registrar", || { + plugin::build::find_plugin_registrar(tcx) + }); - time(sess, "looking for derive registrar", || { - proc_macro_decls::find(tcx) - }); - }, { - time(sess, "loop checking", || loops::check_crate(tcx)); - }, { - time(sess, "attribute checking", || { - hir::check_attr::check_crate(tcx) - }); - }, { - time(sess, "stability checking", || { - stability::check_unstable_api_usage(tcx) + time(sess, "looking for derive registrar", || { + proc_macro_decls::find(tcx) + }); + }, { + par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| { + tcx.ensure().check_mod_loops(tcx.hir().local_def_id(module)); + tcx.ensure().check_mod_attrs(tcx.hir().local_def_id(module)); + tcx.ensure().check_mod_unstable_api_usage(tcx.hir().local_def_id(module)); + }); }); }); diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index 533e043efa9d..fa7cb69fcf7d 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -46,12 +46,6 @@ struct CheckLoopVisitor<'a, 'hir: 'a> { cx: Context, } -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for &module in tcx.hir().krate().modules.keys() { - tcx.ensure().check_mod_loops(tcx.hir().local_def_id(module)); - } -} - fn check_mod_loops<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckLoopVisitor { sess: &tcx.sess, From 350f72fc671c197573585cc6919fc99b182a1f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 23 Feb 2019 19:18:14 +0100 Subject: [PATCH 264/381] Make wf checking parallel --- src/librustc_typeck/check/mod.rs | 14 +------------- src/librustc_typeck/check/wfcheck.rs | 10 +++++----- src/librustc_typeck/coherence/mod.rs | 4 +--- src/librustc_typeck/collect.rs | 6 ------ src/librustc_typeck/lib.rs | 17 +++++++++++++---- 5 files changed, 20 insertions(+), 31 deletions(-) diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 183667e22446..3d95e29082eb 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -695,15 +695,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'a, 'tcx> { pub fn check_wf_new<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.sess.track_errors(|| { let mut visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx); - tcx.hir().krate().visit_all_item_likes(&mut visit); - }) -} - -pub fn check_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), ErrorReported> { - tcx.sess.track_errors(|| { - for &module in tcx.hir().krate().modules.keys() { - tcx.ensure().check_mod_item_types(tcx.hir().local_def_id(module)); - } + tcx.hir().krate().par_visit_all_item_likes(&mut visit); }) } @@ -711,10 +703,6 @@ fn check_mod_item_types<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx }); } -pub fn check_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), ErrorReported> { - tcx.typeck_item_bodies(LOCAL_CRATE) -} - fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) -> Result<(), ErrorReported> { diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 860fa526a1b9..4103b73151be 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -14,7 +14,7 @@ use syntax::feature_gate::{self, GateIssue}; use syntax_pos::Span; use errors::{DiagnosticBuilder, DiagnosticId}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; +use rustc::hir::itemlikevisit::ParItemLikeVisitor; use rustc::hir; /// Helper type of a temporary returned by `.for_item(...)`. @@ -1015,20 +1015,20 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> { } } -impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'a, 'tcx> { - fn visit_item(&mut self, i: &'tcx hir::Item) { +impl<'a, 'tcx> ParItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'a, 'tcx> { + fn visit_item(&self, i: &'tcx hir::Item) { debug!("visit_item: {:?}", i); let def_id = self.tcx.hir().local_def_id_from_hir_id(i.hir_id); self.tcx.ensure().check_item_well_formed(def_id); } - fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) { + fn visit_trait_item(&self, trait_item: &'tcx hir::TraitItem) { debug!("visit_trait_item: {:?}", trait_item); let def_id = self.tcx.hir().local_def_id_from_hir_id(trait_item.hir_id); self.tcx.ensure().check_trait_item_well_formed(def_id); } - fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) { + fn visit_impl_item(&self, impl_item: &'tcx hir::ImplItem) { debug!("visit_impl_item: {:?}", impl_item); let def_id = self.tcx.hir().local_def_id_from_hir_id(impl_item.hir_id); self.tcx.ensure().check_impl_item_well_formed(def_id); diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 01aba658850b..39a2f5d37bd7 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -141,9 +141,7 @@ fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { for &impl_id in impls { check_impl_overlap(tcx, impl_id); } - use rustc::util::common::time; - time(tcx.sess, "builtin::check_trait checking", || - builtin::check_trait(tcx, def_id)); + builtin::check_trait(tcx, def_id); } pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 594e29ab9dde..30035094ccd2 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -56,12 +56,6 @@ struct OnlySelfBounds(bool); /////////////////////////////////////////////////////////////////////////// // Main entry point -pub fn collect_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for &module in tcx.hir().krate().modules.keys() { - tcx.ensure().collect_mod_item_types(tcx.hir().local_def_id(module)); - } -} - fn collect_mod_item_types<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index a918113b1fc0..ebb617c23c6c 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -322,8 +322,11 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) // this ensures that later parts of type checking can assume that items // have valid types and not error tcx.sess.track_errors(|| { - time(tcx.sess, "type collecting", || - collect::collect_item_types(tcx)); + time(tcx.sess, "type collecting", || { + for &module in tcx.hir().krate().modules.keys() { + tcx.ensure().collect_mod_item_types(tcx.hir().local_def_id(module)); + } + }); })?; if tcx.features().rustc_attrs { @@ -352,9 +355,15 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) time(tcx.sess, "wf checking", || check::check_wf_new(tcx))?; - time(tcx.sess, "item-types checking", || check::check_item_types(tcx))?; + time(tcx.sess, "item-types checking", || { + tcx.sess.track_errors(|| { + for &module in tcx.hir().krate().modules.keys() { + tcx.ensure().check_mod_item_types(tcx.hir().local_def_id(module)); + } + }) + })?; - time(tcx.sess, "item-bodies checking", || check::check_item_bodies(tcx))?; + time(tcx.sess, "item-bodies checking", || tcx.typeck_item_bodies(LOCAL_CRATE))?; check_unused::check_crate(tcx); check_for_entry_fn(tcx); From 01f7450ae40694a22ad5ba5df4a2d770ae9f6702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 23 Feb 2019 23:25:30 +0100 Subject: [PATCH 265/381] Update tests --- src/test/ui/issues/issue-20413.rs | 1 + src/test/ui/issues/issue-20413.stderr | 82 ++++++++++++++++++++++++- src/test/ui/issues/issue-21946.rs | 1 + src/test/ui/issues/issue-21946.stderr | 8 ++- src/test/ui/issues/issue-23122-1.rs | 1 + src/test/ui/issues/issue-23122-1.stderr | 8 ++- src/test/ui/issues/issue-23122-2.rs | 1 + src/test/ui/issues/issue-23122-2.stderr | 11 +++- 8 files changed, 109 insertions(+), 4 deletions(-) diff --git a/src/test/ui/issues/issue-20413.rs b/src/test/ui/issues/issue-20413.rs index 34094fe6a44e..7eb6d5c0ecba 100644 --- a/src/test/ui/issues/issue-20413.rs +++ b/src/test/ui/issues/issue-20413.rs @@ -8,6 +8,7 @@ struct NoData; impl Foo for T where NoData: Foo { //~^ ERROR: overflow evaluating the requirement fn answer(self) { + //~^ ERROR: overflow evaluating the requirement let val: NoData = NoData; } } diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index 1c353fec8aab..db746bebbe27 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -12,6 +12,7 @@ error[E0275]: overflow evaluating the requirement `NoData Foo for T where NoData: Foo { LL | | //~^ ERROR: overflow evaluating the requirement LL | | fn answer(self) { +LL | | //~^ ERROR: overflow evaluating the requirement LL | | let val: NoData = NoData; LL | | } LL | | } @@ -87,7 +88,86 @@ note: required by `Foo` LL | trait Foo { | ^^^^^^^^^ -error: aborting due to 2 previous errors +error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` + --> $DIR/issue-20413.rs:10:3 + | +LL | / fn answer(self) { +LL | | //~^ ERROR: overflow evaluating the requirement +LL | | let val: NoData = NoData; +LL | | } + | |___^ + | + = help: consider adding a `#![recursion_limit="128"]` attribute to your crate + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>` + = note: required because of the requirements on the impl of `Foo` for `NoData` +note: required by `Foo` + --> $DIR/issue-20413.rs:1:1 + | +LL | trait Foo { + | ^^^^^^^^^ + +error: aborting due to 3 previous errors Some errors occurred: E0275, E0392. For more information about an error, try `rustc --explain E0275`. diff --git a/src/test/ui/issues/issue-21946.rs b/src/test/ui/issues/issue-21946.rs index d7a6c656df98..2d99769cfa31 100644 --- a/src/test/ui/issues/issue-21946.rs +++ b/src/test/ui/issues/issue-21946.rs @@ -7,6 +7,7 @@ struct FooStruct; impl Foo for FooStruct { //~^ ERROR overflow evaluating the requirement `::A` type A = ::A; + //~^ ERROR overflow evaluating the requirement `::A` } fn main() {} diff --git a/src/test/ui/issues/issue-21946.stderr b/src/test/ui/issues/issue-21946.stderr index 7a178bee6ae0..5ac49f61543e 100644 --- a/src/test/ui/issues/issue-21946.stderr +++ b/src/test/ui/issues/issue-21946.stderr @@ -4,6 +4,12 @@ error[E0275]: overflow evaluating the requirement `::A` LL | impl Foo for FooStruct { | ^^^ -error: aborting due to previous error +error[E0275]: overflow evaluating the requirement `::A` + --> $DIR/issue-21946.rs:9:5 + | +LL | type A = ::A; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/issues/issue-23122-1.rs b/src/test/ui/issues/issue-23122-1.rs index a882aa36af75..d6f64650f36b 100644 --- a/src/test/ui/issues/issue-23122-1.rs +++ b/src/test/ui/issues/issue-23122-1.rs @@ -7,6 +7,7 @@ struct GetNext { t: T } impl Next for GetNext { //~^ ERROR overflow evaluating the requirement type Next = as Next>::Next; + //~^ ERROR overflow evaluating the requirement } fn main() {} diff --git a/src/test/ui/issues/issue-23122-1.stderr b/src/test/ui/issues/issue-23122-1.stderr index 39dd424a86ca..1b752b7afe2e 100644 --- a/src/test/ui/issues/issue-23122-1.stderr +++ b/src/test/ui/issues/issue-23122-1.stderr @@ -4,6 +4,12 @@ error[E0275]: overflow evaluating the requirement ` as Next>::Next` LL | impl Next for GetNext { | ^^^^ -error: aborting due to previous error +error[E0275]: overflow evaluating the requirement ` as Next>::Next` + --> $DIR/issue-23122-1.rs:9:5 + | +LL | type Next = as Next>::Next; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/issues/issue-23122-2.rs b/src/test/ui/issues/issue-23122-2.rs index b84112003430..695712d2cc92 100644 --- a/src/test/ui/issues/issue-23122-2.rs +++ b/src/test/ui/issues/issue-23122-2.rs @@ -7,6 +7,7 @@ struct GetNext { t: T } impl Next for GetNext { //~^ ERROR overflow evaluating the requirement type Next = as Next>::Next; + //~^ ERROR overflow evaluating the requirement } fn main() {} diff --git a/src/test/ui/issues/issue-23122-2.stderr b/src/test/ui/issues/issue-23122-2.stderr index 859287758110..b122dd42373c 100644 --- a/src/test/ui/issues/issue-23122-2.stderr +++ b/src/test/ui/issues/issue-23122-2.stderr @@ -7,6 +7,15 @@ LL | impl Next for GetNext { = help: consider adding a `#![recursion_limit="128"]` attribute to your crate = note: required because of the requirements on the impl of `Next` for `GetNext<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` -error: aborting due to previous error +error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: std::marker::Sized` + --> $DIR/issue-23122-2.rs:9:5 + | +LL | type Next = as Next>::Next; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding a `#![recursion_limit="128"]` attribute to your crate + = note: required because of the requirements on the impl of `Next` for `GetNext<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. From 7cc7b8f190565af501b0b4eda7be18f029a5d676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sun, 24 Feb 2019 22:37:55 +0100 Subject: [PATCH 266/381] Execute all parallel blocks even if they panic in a single-threaded compiler --- src/librustc/hir/mod.rs | 8 +++--- src/librustc_data_structures/sync.rs | 42 +++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 2d0296aa38c7..80d9c1e29984 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -30,7 +30,7 @@ use syntax::util::parser::ExprPrecedence; use crate::ty::AdtKind; use crate::ty::query::Providers; -use rustc_data_structures::sync::{ParallelIterator, par_iter, Send, Sync}; +use rustc_data_structures::sync::{par_for_each_in, Send, Sync}; use rustc_data_structures::thin_vec::ThinVec; use serialize::{self, Encoder, Encodable, Decoder, Decodable}; @@ -782,15 +782,15 @@ impl Crate { where V: itemlikevisit::ParItemLikeVisitor<'hir> + Sync + Send { parallel!({ - par_iter(&self.items).for_each(|(_, item)| { + par_for_each_in(&self.items, |(_, item)| { visitor.visit_item(item); }); }, { - par_iter(&self.trait_items).for_each(|(_, trait_item)| { + par_for_each_in(&self.trait_items, |(_, trait_item)| { visitor.visit_trait_item(trait_item); }); }, { - par_iter(&self.impl_items).for_each(|(_, impl_item)| { + par_for_each_in(&self.impl_items, |(_, impl_item)| { visitor.visit_impl_item(impl_item); }); }); diff --git a/src/librustc_data_structures/sync.rs b/src/librustc_data_structures/sync.rs index 14e625af2992..f006a95f3fa3 100644 --- a/src/librustc_data_structures/sync.rs +++ b/src/librustc_data_structures/sync.rs @@ -65,6 +65,7 @@ cfg_if! { } use std::ops::Add; + use std::panic::{resume_unwind, catch_unwind, AssertUnwindSafe}; #[derive(Debug)] pub struct Atomic(Cell); @@ -130,7 +131,19 @@ cfg_if! { #[macro_export] macro_rules! parallel { ($($blocks:tt),*) => { - $($blocks)*; + let mut panic = None; + $( + if let Err(p) = ::std::panic::catch_unwind( + ::std::panic::AssertUnwindSafe(|| $blocks) + ) { + if panic.is_none() { + panic = Some(p); + } + } + )* + if let Some(panic) = panic { + ::std::panic::resume_unwind(panic); + } } } @@ -140,6 +153,24 @@ cfg_if! { t.into_iter() } + pub fn par_for_each_in( + t: T, + for_each: + impl Fn(<::IntoIter as Iterator>::Item) + Sync + Send + ) { + let mut panic = None; + t.into_iter().for_each(|i| { + if let Err(p) = catch_unwind(AssertUnwindSafe(|| for_each(i))) { + if panic.is_none() { + panic = Some(p); + } + } + }); + if let Some(panic) = panic { + resume_unwind(panic); + } + } + pub type MetadataRef = OwningRef, [u8]>; pub use std::rc::Rc as Lrc; @@ -308,6 +339,15 @@ cfg_if! { t.into_par_iter() } + pub fn par_for_each_in( + t: T, + for_each: impl Fn( + <::Iter as ParallelIterator>::Item + ) + Sync + Send + ) { + t.into_par_iter().for_each(for_each) + } + pub type MetadataRef = OwningRef, [u8]>; /// This makes locks panic if they are already held. From db9a1c1aaf261c8505d09ac6bd3364ef0d19ee71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Wed, 6 Mar 2019 04:46:46 +0100 Subject: [PATCH 267/381] Add some comments --- src/librustc_data_structures/sync.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/librustc_data_structures/sync.rs b/src/librustc_data_structures/sync.rs index f006a95f3fa3..73247c1469ef 100644 --- a/src/librustc_data_structures/sync.rs +++ b/src/librustc_data_structures/sync.rs @@ -131,6 +131,8 @@ cfg_if! { #[macro_export] macro_rules! parallel { ($($blocks:tt),*) => { + // We catch panics here ensuring that all the blocks execute. + // This makes behavior consistent with the parallel compiler. let mut panic = None; $( if let Err(p) = ::std::panic::catch_unwind( @@ -158,6 +160,8 @@ cfg_if! { for_each: impl Fn(<::IntoIter as Iterator>::Item) + Sync + Send ) { + // We catch panics here ensuring that all the loop iterations execute. + // This makes behavior consistent with the parallel compiler. let mut panic = None; t.into_iter().for_each(|i| { if let Err(p) = catch_unwind(AssertUnwindSafe(|| for_each(i))) { @@ -309,6 +313,8 @@ cfg_if! { use std::thread; pub use rayon::{join, scope}; + /// Runs a list of blocks in parallel. The first block is executed immediately on + /// the current thread. Use that for the longest running block. #[macro_export] macro_rules! parallel { (impl $fblock:tt [$($c:tt,)*] [$block:tt $(, $rest:tt)*]) => { @@ -323,7 +329,7 @@ cfg_if! { }) }; ($fblock:tt, $($blocks:tt),*) => { - // Reverse the order of the blocks since Rayon executes them in reverse order + // Reverse the order of the later blocks since Rayon executes them in reverse order // when using a single thread. This ensures the execution order matches that // of a single threaded rustc parallel!(impl $fblock [] [$($blocks),*]); From 7985c6f8ecf680dcc960bb2ccc0c787274a449de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Wed, 6 Mar 2019 04:50:50 +0100 Subject: [PATCH 268/381] Rename check_privacy to check_private_in_public --- src/librustc/dep_graph/dep_node.rs | 2 +- src/librustc/ty/query/config.rs | 4 ++-- src/librustc/ty/query/mod.rs | 2 +- src/librustc/ty/query/plumbing.rs | 2 +- src/librustc_interface/passes.rs | 4 ++-- src/librustc_privacy/lib.rs | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index a46ffffe94cb..41a4a8031006 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -456,7 +456,7 @@ define_dep_nodes!( <'tcx> [eval_always] CoherenceInherentImplOverlapCheck, [] CoherenceCheckTrait(DefId), [eval_always] PrivacyAccessLevels(CrateNum), - [eval_always] CheckPrivacy(CrateNum), + [eval_always] CheckPrivateInPublic(CrateNum), [eval_always] Analysis(CrateNum), // Represents the MIR for a fn; also used as the task node for diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index 0fef90c945e9..835a8314959a 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -369,9 +369,9 @@ impl<'tcx> QueryDescription<'tcx> for queries::privacy_access_levels<'tcx> { } } -impl<'tcx> QueryDescription<'tcx> for queries::check_privacy<'tcx> { +impl<'tcx> QueryDescription<'tcx> for queries::check_private_in_public<'tcx> { fn describe(_: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> { - "privacy checking".into() + "checking for private elements in public interfaces".into() } } diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs index cb72ad6fe8bd..8804ed22264c 100644 --- a/src/librustc/ty/query/mod.rs +++ b/src/librustc/ty/query/mod.rs @@ -352,7 +352,7 @@ define_queries! { <'tcx> /// Performs part of the privacy check and computes "access levels". [] fn privacy_access_levels: PrivacyAccessLevels(CrateNum) -> Lrc, - [] fn check_privacy: CheckPrivacy(CrateNum) -> (), + [] fn check_private_in_public: CheckPrivateInPublic(CrateNum) -> (), }, Other { diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index ff2639da1365..e3276ba0bea7 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -1251,7 +1251,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, force!(crate_inherent_impls_overlap_check, LOCAL_CRATE) }, DepKind::PrivacyAccessLevels => { force!(privacy_access_levels, LOCAL_CRATE); } - DepKind::CheckPrivacy => { force!(check_privacy, LOCAL_CRATE); } + DepKind::CheckPrivateInPublic => { force!(check_private_in_public, LOCAL_CRATE); } DepKind::MirBuilt => { force!(mir_built, def_id!()); } DepKind::MirConstQualif => { force!(mir_const_qualif, def_id!()); } DepKind::MirConst => { force!(mir_const, def_id!()); } diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 2066747a6ffb..8277615b4650 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -281,8 +281,8 @@ fn analysis<'tcx>( tcx.ensure().privacy_access_levels(LOCAL_CRATE); }); parallel!({ - time(sess, "privacy checking", || { - tcx.ensure().check_privacy(LOCAL_CRATE); + time(sess, "private in public", || { + tcx.ensure().check_private_in_public(LOCAL_CRATE); }); }, { time(sess, "death checking", || middle::dead::check_crate(tcx)); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 372a92306942..5443f08debf7 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1760,7 +1760,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> pub fn provide(providers: &mut Providers<'_>) { *providers = Providers { privacy_access_levels, - check_privacy, + check_private_in_public, check_mod_privacy, ..*providers }; @@ -1820,7 +1820,7 @@ fn privacy_access_levels<'tcx>( Lrc::new(visitor.access_levels) } -fn check_privacy<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, krate: CrateNum) { +fn check_private_in_public<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, krate: CrateNum) { assert_eq!(krate, LOCAL_CRATE); let access_levels = tcx.privacy_access_levels(LOCAL_CRATE); From 0d39797dc0d787c8dde695a2c0ac1262fedc77cb Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Tue, 5 Mar 2019 19:33:22 -0800 Subject: [PATCH 269/381] libstd: implement Error::source for io::Error --- src/libstd/io/error.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index fdc5625ff184..614b79124cc6 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -556,6 +556,14 @@ impl error::Error for Error { Repr::Custom(ref c) => c.error.cause(), } } + + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + match self.repr { + Repr::Os(..) => None, + Repr::Simple(..) => None, + Repr::Custom(ref c) => c.error.source(), + } + } } fn _assert_error_is_sync_send() { From 143e7d57321babc6fe993df370e0b54861443c11 Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Wed, 6 Mar 2019 08:45:18 +0000 Subject: [PATCH 270/381] Desugared asyncs into generators and minimised. --- src/test/run-pass/generator/issue-57084.rs | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/test/run-pass/generator/issue-57084.rs b/src/test/run-pass/generator/issue-57084.rs index f6bc93cd9375..8aaa6a0e427d 100644 --- a/src/test/run-pass/generator/issue-57084.rs +++ b/src/test/run-pass/generator/issue-57084.rs @@ -1,27 +1,28 @@ // This issue reproduces an ICE on compile (E.g. fails on 2018-12-19 nightly). +// "cannot relate bound region: ReLateBound(DebruijnIndex(1), BrAnon(1)) <= '_#1r" // run-pass // edition:2018 -#![feature(async_await,futures_api,generators)] +#![feature(generators,generator_trait)] +use std::ops::Generator; -pub struct Foo; - -impl Foo { - async fn with<'a, F, R>(&'a self, f: F) -> R - where F: Fn() -> R + 'a, - { +fn with(f: F) -> impl Generator +where F: Fn() -> () +{ + move || { loop { match f() { _ => yield, } } } +} - pub async fn run<'a>(&'a self, data: &'a [u8]) - { - let _to_pin = self.with(move || println!("{:p}", data)); +fn main() { + let data = &vec![1]; + || { + let _to_pin = with(move || println!("{:p}", data)); loop { yield } - } + }; } -fn main() {} From de4478af91765999f51b2950bea16686ee4cd60a Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 6 Mar 2019 09:58:27 +0000 Subject: [PATCH 271/381] Refactor const_to_op --- src/librustc_mir/interpret/operand.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 1ebff4115101..206eaaf1787c 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -589,17 +589,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> val: ty::Const<'tcx>, layout: Option>, ) -> EvalResult<'tcx, OpTy<'tcx, M::PointerTag>> { + let val = self.monomorphize(val)?; let layout = from_known_layout(layout, || { - let ty = self.monomorphize(val.ty)?; - self.layout_of(ty) + self.layout_of(val.ty) })?; - let val = match val.val { - ConstValue::Param(_) => self.monomorphize(val)?.val, - ConstValue::Infer(_) => bug!(), - val => val, - }; - let op = match val { - ConstValue::Param(_) | ConstValue::Infer(_) => unreachable!(), + let op = match val.val { + ConstValue::Param(_) | ConstValue::Infer(_) => bug!(), ConstValue::ByRef(ptr, alloc) => { // We rely on mutability being set correctly in that allocation to prevent writes // where none should happen -- and for `static mut`, we copy on demand anyway. From c0767012d5658a1b88fa4bbdce56ac2ea2dd78e0 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 4 Mar 2019 13:55:32 +0100 Subject: [PATCH 272/381] Regression test for #58813 (Update: Fixed test; revision is meant to introduce compile-failure, w/o ICE.) --- src/test/incremental/cyclic-trait-hierarchy.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/test/incremental/cyclic-trait-hierarchy.rs diff --git a/src/test/incremental/cyclic-trait-hierarchy.rs b/src/test/incremental/cyclic-trait-hierarchy.rs new file mode 100644 index 000000000000..4102eb32580f --- /dev/null +++ b/src/test/incremental/cyclic-trait-hierarchy.rs @@ -0,0 +1,14 @@ +// Adapated from rust-lang/rust#58813 + +// revisions: rpass1 cfail2 + +#[cfg(rpass1)] +pub trait T2 { } +#[cfg(cfail2)] +pub trait T2: T1 { } +//[cfail2]~^ ERROR cycle detected when computing the supertraits of `T2` +//[cfail2]~| ERROR cycle detected when computing the supertraits of `T2` + +pub trait T1: T2 { } + +fn main() { } From d2482fd36ac144b5dac106026b90d112d4707d79 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 6 Mar 2019 13:49:48 +0100 Subject: [PATCH 273/381] Avoid ICE during `repr(packed)` well-formedness check via delay_span_bug. (It is possible that there is a more fundamental invariant being violated, in terms of the `check_type_defn` code assuming that lifting to tcx will always succeed. But I am unaware of any test input that hits this that isn't already type-incorrect in some fashion.) --- src/librustc_typeck/check/wfcheck.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 860fa526a1b9..e9ff8aa02967 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -250,11 +250,14 @@ fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let needs_drop_copy = || { packed && { let ty = variant.fields.last().unwrap().ty; - let ty = fcx.tcx.erase_regions(&ty).lift_to_tcx(fcx_tcx) + fcx.tcx.erase_regions(&ty).lift_to_tcx(fcx_tcx) + .map(|ty| ty.needs_drop(fcx_tcx, fcx_tcx.param_env(def_id))) .unwrap_or_else(|| { - span_bug!(item.span, "inference variables in {:?}", ty) - }); - ty.needs_drop(fcx_tcx, fcx_tcx.param_env(def_id)) + fcx_tcx.sess.delay_span_bug( + item.span, &format!("inference variables in {:?}", ty)); + // Just treat unresolved type expression as if it needs drop. + true + }) } }; let all_sized = From 533f011d46c7759b04976339ab98cfb3cf7bb058 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 6 Mar 2019 14:08:53 +0100 Subject: [PATCH 274/381] Regression test for issue #58158. --- ...-packed-on-proj-of-type-as-unimpl-trait.rs | 31 +++++++++++++++++++ ...ked-on-proj-of-type-as-unimpl-trait.stderr | 9 ++++++ 2 files changed, 40 insertions(+) create mode 100644 src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.rs create mode 100644 src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr diff --git a/src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.rs b/src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.rs new file mode 100644 index 000000000000..d0167c8c268c --- /dev/null +++ b/src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.rs @@ -0,0 +1,31 @@ +// rust-lang/rust#58158: We have special-case code to deal with case +// when a type is both packed and needs drop glue, (we move the fields +// out of their potentially unaligned locations before dropping them, +// which requires they be Sized; see PR #44884). +// +// So, we need to check if a given type needs drop-glue. That requires +// that we actually know that the concrete type, and we guard against +// the type having unknown parts (i.e. type variables) by ICE'ing in +// that scenario. +// +// But in a case where we have a projection (`Type as Trait::Assoc`) +// where `Type` does not actually implement `Trait`, we of course +// cannot have a concrete type, because there is no impl to look up +// the concrete type for the associated type `Assoc`. +// +// So, this test is just making sure that in such a case that we do +// not immediately ICE, and instead allow the underlying type error to +// surface. + +pub struct Matrix(S); +pub struct DefaultAllocator; + +pub trait Allocator { type Buffer; } + +// impl Allocator for DefaultAllocator { type Buffer = (); } + +#[repr(packed)] +struct Foo(Matrix<::Buffer>); +//~^ ERROR the trait bound `DefaultAllocator: Allocator` is not satisfied + +fn main() { } diff --git a/src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr b/src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr new file mode 100644 index 000000000000..e460cdcd3f3e --- /dev/null +++ b/src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr @@ -0,0 +1,9 @@ +error[E0277]: the trait bound `DefaultAllocator: Allocator` is not satisfied + --> $DIR/wf-packed-on-proj-of-type-as-unimpl-trait.rs:28:12 + | +LL | struct Foo(Matrix<::Buffer>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Allocator` is not implemented for `DefaultAllocator` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. From d6add90c64a27de32a63b933f8f03d0c53fca4d0 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 6 Mar 2019 15:01:30 +0100 Subject: [PATCH 275/381] Improve code --- src/tools/compiletest/src/runtest.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index f7c02e831a9a..7781ce74f411 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -291,7 +291,8 @@ impl<'test> TestCx<'test> { fn should_compile_successfully(&self) -> bool { match self.config.mode { CompileFail => self.props.compile_pass, - RunPass | JsDocTest => true, + RunPass => true, + JsDocTest => true, Ui => self.props.compile_pass, Incremental => { let revision = self.revision @@ -2728,6 +2729,8 @@ impl<'test> TestCx<'test> { if !res.status.success() { self.fatal_proc_rec("rustdoc-js test failed!", &res); } + } else { + self.fatal("no nodeJS"); } } From 9e5def9616aba274a6c3138d9f66e778d50c35e0 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Thu, 21 Feb 2019 20:21:50 -0500 Subject: [PATCH 276/381] rust-lldb: fix crash when printing empty string --- src/etc/lldb_rust_formatters.py | 2 ++ src/test/debuginfo/empty-string.rs | 35 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/test/debuginfo/empty-string.rs diff --git a/src/etc/lldb_rust_formatters.py b/src/etc/lldb_rust_formatters.py index 2c651c90f82e..fdc1c4fa0cc3 100644 --- a/src/etc/lldb_rust_formatters.py +++ b/src/etc/lldb_rust_formatters.py @@ -290,6 +290,8 @@ def print_array_of_values(array_name, data_ptr_val, length, internal_dict): def read_utf8_string(ptr_val, byte_count): + if byte_count == 0: + return '""' error = lldb.SBError() process = ptr_val.get_wrapped_value().GetProcess() data = process.ReadMemory(ptr_val.as_integer(), byte_count, error) diff --git a/src/test/debuginfo/empty-string.rs b/src/test/debuginfo/empty-string.rs new file mode 100644 index 000000000000..8c5f67a66043 --- /dev/null +++ b/src/test/debuginfo/empty-string.rs @@ -0,0 +1,35 @@ +// ignore-windows failing on win32 bot +// ignore-android: FIXME(#10381) +// compile-flags:-g +// min-gdb-version: 7.7 +// min-lldb-version: 310 + +// === GDB TESTS =================================================================================== + +// gdb-command: run + +// gdb-command: print empty_string +// gdb-check:$1 = "" + +// gdb-command: print empty_str +// gdb-check:$2 = "" + +// === LLDB TESTS ================================================================================== + +// lldb-command: run + +// lldb-command: fr v empty_string +// lldb-check:[...]empty_string = "" + +// lldb-command: fr v empty_str +// lldb-check:[...]empty_str = "" + +fn main() { + let empty_string = String::new(); + + let empty_str = ""; + + zzz(); // #break +} + +fn zzz() {} From f2ef283b7265a35ee4b6e250e1160ba28b33953a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Wed, 6 Mar 2019 18:48:08 +0100 Subject: [PATCH 277/381] Make Cargo a rustc tool again --- src/bootstrap/test.rs | 2 +- src/bootstrap/tool.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 6e37bf334526..51412f79c3d0 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -213,7 +213,7 @@ impl Step for Cargo { }); let mut cargo = tool::prepare_tool_cargo(builder, compiler, - Mode::ToolStd, + Mode::ToolRustc, self.host, "test", "src/tools/cargo", diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index b12ccc4f39d8..9dbcacf70262 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -514,7 +514,7 @@ impl Step for Cargo { compiler: self.compiler, target: self.target, tool: "cargo", - mode: Mode::ToolStd, + mode: Mode::ToolRustc, path: "src/tools/cargo", is_optional_tool: false, source_type: SourceType::Submodule, From 90bb07eca6c40ab98d31401597ba3f6c50a70c92 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 6 Mar 2019 19:57:00 +0100 Subject: [PATCH 278/381] Apply suggestions from code review Co-Authored-By: RalfJung --- src/libcore/mem.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 4b5056c5adff..2e82c8c77816 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1049,7 +1049,7 @@ impl DerefMut for ManuallyDrop { /// use std::mem::{self, MaybeUninit}; /// /// let x: &i32 = unsafe { mem::zeroed() }; // undefined behavior! -/// // equivalent code with `MaybeUninit<&i32>` +/// // The equivalent code with `MaybeUninit<&i32>`: /// let x: &i32 = unsafe { MaybeUninit::zeroed().into_initialized() }; // undefined behavior! /// ``` /// @@ -1078,7 +1078,7 @@ impl DerefMut for ManuallyDrop { /// use std::mem::{self, MaybeUninit}; /// /// let x: i32 = unsafe { mem::uninitialized() }; // undefined behavior! -/// // equivalent code with `MaybeUninit` +/// // The equivalent code with `MaybeUninit`: /// let x: i32 = unsafe { MaybeUninit::uninitialized().into_initialized() }; // undefined behavior! /// ``` /// (Notice that the rules around uninitialized integers are not finalized yet, but @@ -1231,7 +1231,7 @@ impl MaybeUninit { /// let x_vec = unsafe { &*x.as_ptr() }; /// // We have created a reference to an uninitialized vector! This is undefined behavior. /// ``` - /// (Notice that the rules around referenced to uninitialized data are not finalized yet, but + /// (Notice that the rules around references to uninitialized data are not finalized yet, but /// until they are, it is advisable to avoid them.) #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] From cefe9b09c120cfd8684fc2310ed2b295aafca01c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 6 Mar 2019 20:02:50 +0100 Subject: [PATCH 279/381] Apply suggestions from code review --- src/libcore/mem.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 2e82c8c77816..2b6e7ab9b995 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1269,7 +1269,7 @@ impl MaybeUninit { /// let x_vec = unsafe { &mut *x.as_mut_ptr() }; /// // We have created a reference to an uninitialized vector! This is undefined behavior. /// ``` - /// (Notice that the rules around referenced to uninitialized data are not finalized yet, but + /// (Notice that the rules around references to uninitialized data are not finalized yet, but /// until they are, it is advisable to avoid them.) #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] From 02eb523d91a2acbb78c9c1ca305e03d88d6dd985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 6 Mar 2019 13:16:52 -0800 Subject: [PATCH 280/381] Surround found token with ` --- src/libsyntax/parse/attr.rs | 2 +- .../ui/conditional-compilation/cfg-attr-syntax-validation.rs | 2 +- .../conditional-compilation/cfg-attr-syntax-validation.stderr | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 6c02a7407e04..e93e15f9012a 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -285,7 +285,7 @@ impl<'a> Parser<'a> { } let found = self.this_token_to_string(); - let msg = format!("expected unsuffixed literal or identifier, found {}", found); + let msg = format!("expected unsuffixed literal or identifier, found `{}`", found); Err(self.diagnostic().struct_span_err(self.span, &msg)) } diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs index c5aa903f9491..7f0648b381db 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs @@ -28,7 +28,7 @@ struct S9; macro_rules! generate_s10 { ($expr: expr) => { #[cfg(feature = $expr)] - //~^ ERROR expected unsuffixed literal or identifier, found concat!("nonexistent") + //~^ ERROR expected unsuffixed literal or identifier, found `concat!("nonexistent")` struct S10; } } diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index 0770d1038e11..7dab2b2b53f9 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -52,7 +52,7 @@ error[E0565]: literal in `cfg` predicate value must be a string LL | #[cfg(a = b"hi")] //~ ERROR literal in `cfg` predicate value must be a string | ^^^^^ help: consider removing the prefix: `"hi"` -error: expected unsuffixed literal or identifier, found concat!("nonexistent") +error: expected unsuffixed literal or identifier, found `concat!("nonexistent")` --> $DIR/cfg-attr-syntax-validation.rs:30:25 | LL | #[cfg(feature = $expr)] From 2ec7d0b2281e57a456d6122dadd5646804a9d36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 1 Mar 2019 16:28:04 -0800 Subject: [PATCH 281/381] Do not panic on missing close paren Fix #58856. --- src/libsyntax/parse/parser.rs | 4 +- src/test/ui/issues/issue-58856-1.rs | 9 ++++ src/test/ui/issues/issue-58856-1.stderr | 30 ++++++++++++++ src/test/ui/issues/issue-58856-2.rs | 13 ++++++ src/test/ui/issues/issue-58856-2.stderr | 55 +++++++++++++++++++++++++ 5 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/issues/issue-58856-1.rs create mode 100644 src/test/ui/issues/issue-58856-1.stderr create mode 100644 src/test/ui/issues/issue-58856-2.rs create mode 100644 src/test/ui/issues/issue-58856-2.stderr diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index fd5038a8614f..dd4c2393fa58 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -6332,8 +6332,10 @@ impl<'a> Parser<'a> { &token::CloseDelim(token::Paren), sep, parse_arg_fn)?; fn_inputs.append(&mut input); (fn_inputs, recovered) + } else if let Err(err) = self.expect_one_of(&[], &[]) { + return Err(err); } else { - return self.unexpected(); + (vec![self_arg], true) } } else { self.parse_seq_to_before_end(&token::CloseDelim(token::Paren), sep, parse_arg_fn)? diff --git a/src/test/ui/issues/issue-58856-1.rs b/src/test/ui/issues/issue-58856-1.rs new file mode 100644 index 000000000000..9311bb0802f2 --- /dev/null +++ b/src/test/ui/issues/issue-58856-1.rs @@ -0,0 +1,9 @@ +impl A { +//~^ ERROR cannot find type `A` in this scope + fn b(self> + //~^ ERROR expected one of `)`, `,`, or `:`, found `>` + //~| ERROR expected one of `->`, `where`, or `{`, found `>` + //~| ERROR expected one of `->`, `async`, `const`, `crate`, `default`, `existential`, +} + +fn main() {} diff --git a/src/test/ui/issues/issue-58856-1.stderr b/src/test/ui/issues/issue-58856-1.stderr new file mode 100644 index 000000000000..3cbfd375e785 --- /dev/null +++ b/src/test/ui/issues/issue-58856-1.stderr @@ -0,0 +1,30 @@ +error: expected one of `)`, `,`, or `:`, found `>` + --> $DIR/issue-58856-1.rs:3:14 + | +LL | fn b(self> + | - ^ + | | | + | | help: `)` may belong here + | unclosed delimiter + +error: expected one of `->`, `where`, or `{`, found `>` + --> $DIR/issue-58856-1.rs:3:14 + | +LL | fn b(self> + | ^ expected one of `->`, `where`, or `{` here + +error: expected one of `->`, `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, `unsafe`, `where`, or `}`, found `>` + --> $DIR/issue-58856-1.rs:3:14 + | +LL | fn b(self> + | ^ expected one of 13 possible tokens here + +error[E0412]: cannot find type `A` in this scope + --> $DIR/issue-58856-1.rs:1:6 + | +LL | impl A { + | ^ not found in this scope + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/issues/issue-58856-2.rs b/src/test/ui/issues/issue-58856-2.rs new file mode 100644 index 000000000000..4c764761e8ec --- /dev/null +++ b/src/test/ui/issues/issue-58856-2.rs @@ -0,0 +1,13 @@ +trait Howness {} +impl Howness for () { + fn how_are_you(&self -> Empty { + //~^ ERROR expected one of `)` or `,`, found `->` + //~| ERROR method `how_are_you` is not a member of trait `Howness` + //~| ERROR cannot find type `Empty` in this scope + Empty + //~^ ERROR cannot find value `Empty` in this scope + } +} +//~^ ERROR expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, + +fn main() {} diff --git a/src/test/ui/issues/issue-58856-2.stderr b/src/test/ui/issues/issue-58856-2.stderr new file mode 100644 index 000000000000..30027278e23c --- /dev/null +++ b/src/test/ui/issues/issue-58856-2.stderr @@ -0,0 +1,55 @@ +error: expected one of `)` or `,`, found `->` + --> $DIR/issue-58856-2.rs:3:26 + | +LL | fn how_are_you(&self -> Empty { + | - -^^ + | | | + | | help: `)` may belong here + | unclosed delimiter + +error: expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `)` + --> $DIR/issue-58856-2.rs:10:1 + | +LL | } + | - expected one of 11 possible tokens here +LL | } + | ^ unexpected token + +error[E0407]: method `how_are_you` is not a member of trait `Howness` + --> $DIR/issue-58856-2.rs:3:5 + | +LL | / fn how_are_you(&self -> Empty { +LL | | //~^ ERROR expected one of `)` or `,`, found `->` +LL | | //~| ERROR method `how_are_you` is not a member of trait `Howness` +LL | | //~| ERROR cannot find type `Empty` in this scope +LL | | Empty +LL | | //~^ ERROR cannot find value `Empty` in this scope +LL | | } + | |_____^ not a member of trait `Howness` + +error[E0412]: cannot find type `Empty` in this scope + --> $DIR/issue-58856-2.rs:3:29 + | +LL | fn how_are_you(&self -> Empty { + | ^^^^^ not found in this scope +help: possible candidates are found in other modules, you can import them into scope + | +LL | use std::io::Empty; + | +LL | use std::iter::Empty; + | + +error[E0425]: cannot find value `Empty` in this scope + --> $DIR/issue-58856-2.rs:7:9 + | +LL | Empty + | ^^^^^ not found in this scope +help: possible candidate is found in another module, you can import it into scope + | +LL | use std::sync::mpsc::TryRecvError::Empty; + | + +error: aborting due to 5 previous errors + +Some errors occurred: E0407, E0412, E0425. +For more information about an error, try `rustc --explain E0407`. From cc535a2a19444d7b96e80dc8f445d50452e5495d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 1 Mar 2019 21:47:06 -0800 Subject: [PATCH 282/381] Bail when encountering a second unexpected token in the same span --- src/libsyntax/parse/parser.rs | 14 +++++++--- src/test/ui/issues/issue-58856-1.rs | 7 +++-- src/test/ui/issues/issue-58856-1.stderr | 25 +++--------------- src/test/ui/issues/issue-58856-2.rs | 5 ++-- src/test/ui/issues/issue-58856-2.stderr | 35 ++++--------------------- src/test/ui/parser/recover-enum2.rs | 3 --- src/test/ui/parser/recover-enum2.stderr | 14 +--------- 7 files changed, 25 insertions(+), 78 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index dd4c2393fa58..c27a1f79d8cc 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -46,7 +46,7 @@ use crate::ThinVec; use crate::tokenstream::{self, DelimSpan, TokenTree, TokenStream, TreeAndJoint}; use crate::symbol::{Symbol, keywords}; -use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; +use errors::{Applicability, DiagnosticBuilder, DiagnosticId, FatalError}; use rustc_target::spec::abi::{self, Abi}; use syntax_pos::{Span, MultiSpan, BytePos, FileName}; use log::{debug, trace}; @@ -256,6 +256,7 @@ pub struct Parser<'a> { /// it gets removed from here. Every entry left at the end gets emitted as an independent /// error. crate unclosed_delims: Vec, + last_unexpected_token_span: Option, } @@ -582,6 +583,7 @@ impl<'a> Parser<'a> { unmatched_angle_bracket_count: 0, max_angle_bracket_count: 0, unclosed_delims: Vec::new(), + last_unexpected_token_span: None, }; let tok = parser.next_tok(); @@ -775,6 +777,8 @@ impl<'a> Parser<'a> { } else if inedible.contains(&self.token) { // leave it in the input Ok(false) + } else if self.last_unexpected_token_span == Some(self.span) { + FatalError.raise(); } else { let mut expected = edible.iter() .map(|x| TokenType::Token(x.clone())) @@ -802,6 +806,7 @@ impl<'a> Parser<'a> { (self.sess.source_map().next_point(self.prev_span), format!("expected {} here", expect))) }; + self.last_unexpected_token_span = Some(self.span); let mut err = self.fatal(&msg_exp); if self.token.is_ident_named("and") { err.span_suggestion_short( @@ -6332,10 +6337,11 @@ impl<'a> Parser<'a> { &token::CloseDelim(token::Paren), sep, parse_arg_fn)?; fn_inputs.append(&mut input); (fn_inputs, recovered) - } else if let Err(err) = self.expect_one_of(&[], &[]) { - return Err(err); } else { - (vec![self_arg], true) + match self.expect_one_of(&[], &[]) { + Err(err) => return Err(err), + Ok(recovered) => (vec![self_arg], recovered), + } } } else { self.parse_seq_to_before_end(&token::CloseDelim(token::Paren), sep, parse_arg_fn)? diff --git a/src/test/ui/issues/issue-58856-1.rs b/src/test/ui/issues/issue-58856-1.rs index 9311bb0802f2..f5edac0d2e31 100644 --- a/src/test/ui/issues/issue-58856-1.rs +++ b/src/test/ui/issues/issue-58856-1.rs @@ -1,9 +1,8 @@ +struct A; + impl A { -//~^ ERROR cannot find type `A` in this scope - fn b(self> + fn b(self> {} //~^ ERROR expected one of `)`, `,`, or `:`, found `>` - //~| ERROR expected one of `->`, `where`, or `{`, found `>` - //~| ERROR expected one of `->`, `async`, `const`, `crate`, `default`, `existential`, } fn main() {} diff --git a/src/test/ui/issues/issue-58856-1.stderr b/src/test/ui/issues/issue-58856-1.stderr index 3cbfd375e785..85101e467b13 100644 --- a/src/test/ui/issues/issue-58856-1.stderr +++ b/src/test/ui/issues/issue-58856-1.stderr @@ -1,30 +1,11 @@ error: expected one of `)`, `,`, or `:`, found `>` - --> $DIR/issue-58856-1.rs:3:14 + --> $DIR/issue-58856-1.rs:4:14 | -LL | fn b(self> +LL | fn b(self> {} | - ^ | | | | | help: `)` may belong here | unclosed delimiter -error: expected one of `->`, `where`, or `{`, found `>` - --> $DIR/issue-58856-1.rs:3:14 - | -LL | fn b(self> - | ^ expected one of `->`, `where`, or `{` here +error: aborting due to previous error -error: expected one of `->`, `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, `unsafe`, `where`, or `}`, found `>` - --> $DIR/issue-58856-1.rs:3:14 - | -LL | fn b(self> - | ^ expected one of 13 possible tokens here - -error[E0412]: cannot find type `A` in this scope - --> $DIR/issue-58856-1.rs:1:6 - | -LL | impl A { - | ^ not found in this scope - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/issues/issue-58856-2.rs b/src/test/ui/issues/issue-58856-2.rs index 4c764761e8ec..acc38e4c2016 100644 --- a/src/test/ui/issues/issue-58856-2.rs +++ b/src/test/ui/issues/issue-58856-2.rs @@ -1,11 +1,12 @@ +struct Empty; + trait Howness {} + impl Howness for () { fn how_are_you(&self -> Empty { //~^ ERROR expected one of `)` or `,`, found `->` //~| ERROR method `how_are_you` is not a member of trait `Howness` - //~| ERROR cannot find type `Empty` in this scope Empty - //~^ ERROR cannot find value `Empty` in this scope } } //~^ ERROR expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, diff --git a/src/test/ui/issues/issue-58856-2.stderr b/src/test/ui/issues/issue-58856-2.stderr index 30027278e23c..55a9e9d5cb86 100644 --- a/src/test/ui/issues/issue-58856-2.stderr +++ b/src/test/ui/issues/issue-58856-2.stderr @@ -1,5 +1,5 @@ error: expected one of `)` or `,`, found `->` - --> $DIR/issue-58856-2.rs:3:26 + --> $DIR/issue-58856-2.rs:6:26 | LL | fn how_are_you(&self -> Empty { | - -^^ @@ -8,7 +8,7 @@ LL | fn how_are_you(&self -> Empty { | unclosed delimiter error: expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `)` - --> $DIR/issue-58856-2.rs:10:1 + --> $DIR/issue-58856-2.rs:11:1 | LL | } | - expected one of 11 possible tokens here @@ -16,40 +16,15 @@ LL | } | ^ unexpected token error[E0407]: method `how_are_you` is not a member of trait `Howness` - --> $DIR/issue-58856-2.rs:3:5 + --> $DIR/issue-58856-2.rs:6:5 | LL | / fn how_are_you(&self -> Empty { LL | | //~^ ERROR expected one of `)` or `,`, found `->` LL | | //~| ERROR method `how_are_you` is not a member of trait `Howness` -LL | | //~| ERROR cannot find type `Empty` in this scope LL | | Empty -LL | | //~^ ERROR cannot find value `Empty` in this scope LL | | } | |_____^ not a member of trait `Howness` -error[E0412]: cannot find type `Empty` in this scope - --> $DIR/issue-58856-2.rs:3:29 - | -LL | fn how_are_you(&self -> Empty { - | ^^^^^ not found in this scope -help: possible candidates are found in other modules, you can import them into scope - | -LL | use std::io::Empty; - | -LL | use std::iter::Empty; - | +error: aborting due to 3 previous errors -error[E0425]: cannot find value `Empty` in this scope - --> $DIR/issue-58856-2.rs:7:9 - | -LL | Empty - | ^^^^^ not found in this scope -help: possible candidate is found in another module, you can import it into scope - | -LL | use std::sync::mpsc::TryRecvError::Empty; - | - -error: aborting due to 5 previous errors - -Some errors occurred: E0407, E0412, E0425. -For more information about an error, try `rustc --explain E0407`. +For more information about this error, try `rustc --explain E0407`. diff --git a/src/test/ui/parser/recover-enum2.rs b/src/test/ui/parser/recover-enum2.rs index 65a187737879..7f2f2cc7ab03 100644 --- a/src/test/ui/parser/recover-enum2.rs +++ b/src/test/ui/parser/recover-enum2.rs @@ -25,9 +25,6 @@ fn main() { // fail again enum Test4 { Nope(i32 {}) //~ ERROR: found `{` - //~^ ERROR: found `{` } } - // still recover later - let bad_syntax = _; //~ ERROR: expected expression, found reserved identifier `_` } diff --git a/src/test/ui/parser/recover-enum2.stderr b/src/test/ui/parser/recover-enum2.stderr index b308e644ad9f..315bfde77c73 100644 --- a/src/test/ui/parser/recover-enum2.stderr +++ b/src/test/ui/parser/recover-enum2.stderr @@ -10,17 +10,5 @@ error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `{` LL | Nope(i32 {}) //~ ERROR: found `{` | ^ expected one of 7 possible tokens here -error: expected one of `!`, `&&`, `&`, `(`, `)`, `*`, `+`, `,`, `...`, `::`, `<`, `?`, `[`, `_`, `crate`, `dyn`, `extern`, `fn`, `for`, `impl`, `pub`, `unsafe`, `}`, or lifetime, found `{` - --> $DIR/recover-enum2.rs:27:22 - | -LL | Nope(i32 {}) //~ ERROR: found `{` - | ^ expected one of 24 possible tokens here - -error: expected expression, found reserved identifier `_` - --> $DIR/recover-enum2.rs:32:22 - | -LL | let bad_syntax = _; //~ ERROR: expected expression, found reserved identifier `_` - | ^ expected expression - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors From ed2de5a8421822ecf9aa3df30bc6c2e55d4ea97d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 1 Mar 2019 22:14:22 -0800 Subject: [PATCH 283/381] Emit unclosed delimiters during recovery --- src/libsyntax/parse/parser.rs | 1 + src/test/ui/issues/issue-58856-1.rs | 4 ++++ src/test/ui/issues/issue-58856-1.stderr | 10 +++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c27a1f79d8cc..0187ad743aa7 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -778,6 +778,7 @@ impl<'a> Parser<'a> { // leave it in the input Ok(false) } else if self.last_unexpected_token_span == Some(self.span) { + emit_unclosed_delims(&self.unclosed_delims, self.diagnostic()); FatalError.raise(); } else { let mut expected = edible.iter() diff --git a/src/test/ui/issues/issue-58856-1.rs b/src/test/ui/issues/issue-58856-1.rs index f5edac0d2e31..7dc3658776e6 100644 --- a/src/test/ui/issues/issue-58856-1.rs +++ b/src/test/ui/issues/issue-58856-1.rs @@ -5,4 +5,8 @@ impl A { //~^ ERROR expected one of `)`, `,`, or `:`, found `>` } +// verify that mismatched delimiters get emitted +fn foo(] {} +//~^ ERROR incorrect close delimiter + fn main() {} diff --git a/src/test/ui/issues/issue-58856-1.stderr b/src/test/ui/issues/issue-58856-1.stderr index 85101e467b13..f26ebbe15c5b 100644 --- a/src/test/ui/issues/issue-58856-1.stderr +++ b/src/test/ui/issues/issue-58856-1.stderr @@ -7,5 +7,13 @@ LL | fn b(self> {} | | help: `)` may belong here | unclosed delimiter -error: aborting due to previous error +error: incorrect close delimiter: `]` + --> $DIR/issue-58856-1.rs:9:8 + | +LL | fn foo(] {} + | -^ incorrect close delimiter + | | + | un-closed delimiter + +error: aborting due to 2 previous errors From e38e915cdfaecb5a89d9bf2b041f19c6598ade09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 1 Mar 2019 22:35:21 -0800 Subject: [PATCH 284/381] Reduce test case --- src/test/ui/issues/issue-58856-1.rs | 8 +------- src/test/ui/issues/issue-58856-1.stderr | 14 +++----------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/test/ui/issues/issue-58856-1.rs b/src/test/ui/issues/issue-58856-1.rs index 7dc3658776e6..db3984cd1898 100644 --- a/src/test/ui/issues/issue-58856-1.rs +++ b/src/test/ui/issues/issue-58856-1.rs @@ -1,12 +1,6 @@ -struct A; - impl A { - fn b(self> {} + fn b(self> //~^ ERROR expected one of `)`, `,`, or `:`, found `>` } -// verify that mismatched delimiters get emitted -fn foo(] {} -//~^ ERROR incorrect close delimiter - fn main() {} diff --git a/src/test/ui/issues/issue-58856-1.stderr b/src/test/ui/issues/issue-58856-1.stderr index f26ebbe15c5b..20cdf55365fc 100644 --- a/src/test/ui/issues/issue-58856-1.stderr +++ b/src/test/ui/issues/issue-58856-1.stderr @@ -1,19 +1,11 @@ error: expected one of `)`, `,`, or `:`, found `>` - --> $DIR/issue-58856-1.rs:4:14 + --> $DIR/issue-58856-1.rs:2:14 | -LL | fn b(self> {} +LL | fn b(self> | - ^ | | | | | help: `)` may belong here | unclosed delimiter -error: incorrect close delimiter: `]` - --> $DIR/issue-58856-1.rs:9:8 - | -LL | fn foo(] {} - | -^ incorrect close delimiter - | | - | un-closed delimiter - -error: aborting due to 2 previous errors +error: aborting due to previous error From c70a516c23ae19ce568166a81e64c92a4ecf540a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 3 Mar 2019 11:13:19 -0800 Subject: [PATCH 285/381] Panic when unmatched delimiters aren't emitted --- src/libsyntax/ext/tt/macro_parser.rs | 2 +- src/libsyntax/parse/parser.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index fe1cffb092b1..1a419e7fadaa 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -761,7 +761,7 @@ pub fn parse( else if bb_items.is_empty() && next_items.is_empty() { return Failure( parser.span, - parser.token, + parser.token.clone(), "no rules expected this token in macro call", ); } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 0187ad743aa7..33fe81ea8c41 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -259,6 +259,13 @@ pub struct Parser<'a> { last_unexpected_token_span: Option, } +impl<'a> Drop for Parser<'a> { + fn drop(&mut self) { + if !self.unclosed_delims.is_empty() { + panic!("unclosed delimiter errors not emitted"); + } + } +} #[derive(Clone)] struct TokenCursor { From 51d0e86c221dbd937ca248f25a95dad787035b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 3 Mar 2019 12:14:25 -0800 Subject: [PATCH 286/381] Emit missing unclosed delimiter errors --- src/librustc_metadata/cstore_impl.rs | 4 +- src/libsyntax/parse/parser.rs | 14 ++++-- src/libsyntax/parse/token.rs | 12 ++--- src/libsyntax_ext/proc_macro_server.rs | 4 +- src/test/ui/parser-recovery-2.stderr | 12 ++--- src/test/ui/resolve/token-error-correct-3.rs | 16 +++--- .../ui/resolve/token-error-correct-3.stderr | 49 +++++++++---------- 7 files changed, 56 insertions(+), 55 deletions(-) diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index f49b88f14e60..67a249e605ec 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -439,8 +439,8 @@ impl cstore::CStore { let source_file = sess.parse_sess.source_map().new_source_file(source_name, def.body); let local_span = Span::new(source_file.start_pos, source_file.end_pos, NO_EXPANSION); - let (body, errors) = source_file_to_stream(&sess.parse_sess, source_file, None); - emit_unclosed_delims(&errors, &sess.diagnostic()); + let (body, mut errors) = source_file_to_stream(&sess.parse_sess, source_file, None); + emit_unclosed_delims(&mut errors, &sess.diagnostic()); // Mark the attrs as used let attrs = data.get_item_attrs(id.index, sess); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 33fe81ea8c41..bde14e192e96 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -7798,7 +7798,10 @@ impl<'a> Parser<'a> { attributes_allowed: bool, ) -> PResult<'a, Option>> { let (ret, tokens) = self.collect_tokens(|this| { - this.parse_item_implementation(attrs, macros_allowed, attributes_allowed) + let item = this.parse_item_implementation(attrs, macros_allowed, attributes_allowed); + let diag = this.diagnostic(); + emit_unclosed_delims(&mut this.unclosed_delims, diag); + item })?; // Once we've parsed an item and recorded the tokens we got while @@ -8555,8 +8558,8 @@ impl<'a> Parser<'a> { module: self.parse_mod_items(&token::Eof, lo)?, span: lo.to(self.span), }); - emit_unclosed_delims(&self.unclosed_delims, self.diagnostic()); - self.unclosed_delims.clear(); + let diag = self.diagnostic(); + emit_unclosed_delims(&mut self.unclosed_delims, diag); krate } @@ -8587,8 +8590,8 @@ impl<'a> Parser<'a> { } } -pub fn emit_unclosed_delims(unclosed_delims: &[UnmatchedBrace], handler: &errors::Handler) { - for unmatched in unclosed_delims { +pub fn emit_unclosed_delims(unclosed_delims: &mut Vec, handler: &errors::Handler) { + for unmatched in unclosed_delims.iter() { let mut err = handler.struct_span_err(unmatched.found_span, &format!( "incorrect close delimiter: `{}`", pprust::token_to_string(&token::Token::CloseDelim(unmatched.found_delim)), @@ -8602,4 +8605,5 @@ pub fn emit_unclosed_delims(unclosed_delims: &[UnmatchedBrace], handler: &errors } err.emit(); } + unclosed_delims.clear(); } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index eec422d6266c..bb4da12bae89 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -675,9 +675,9 @@ impl Nonterminal { // FIXME(#43081): Avoid this pretty-print + reparse hack let source = pprust::nonterminal_to_string(self); let filename = FileName::macro_expansion_source_code(&source); - let (tokens_for_real, errors) = + let (tokens_for_real, mut errors) = parse_stream_from_source_str(filename, source, sess, Some(span)); - emit_unclosed_delims(&errors, &sess.span_diagnostic); + emit_unclosed_delims(&mut errors, &sess.span_diagnostic); // During early phases of the compiler the AST could get modified // directly (e.g., attributes added or removed) and the internal cache @@ -740,13 +740,13 @@ fn prepend_attrs(sess: &ParseSess, let source = pprust::attr_to_string(attr); let macro_filename = FileName::macro_expansion_source_code(&source); if attr.is_sugared_doc { - let (stream, errors) = parse_stream_from_source_str( + let (stream, mut errors) = parse_stream_from_source_str( macro_filename, source, sess, Some(span), ); - emit_unclosed_delims(&errors, &sess.span_diagnostic); + emit_unclosed_delims(&mut errors, &sess.span_diagnostic); builder.push(stream); continue } @@ -763,13 +763,13 @@ fn prepend_attrs(sess: &ParseSess, // ... and for more complicated paths, fall back to a reparse hack that // should eventually be removed. } else { - let (stream, errors) = parse_stream_from_source_str( + let (stream, mut errors) = parse_stream_from_source_str( macro_filename, source, sess, Some(span), ); - emit_unclosed_delims(&errors, &sess.span_diagnostic); + emit_unclosed_delims(&mut errors, &sess.span_diagnostic); brackets.push(stream); } diff --git a/src/libsyntax_ext/proc_macro_server.rs b/src/libsyntax_ext/proc_macro_server.rs index 4c4b33c04422..5822b5607f7d 100644 --- a/src/libsyntax_ext/proc_macro_server.rs +++ b/src/libsyntax_ext/proc_macro_server.rs @@ -410,13 +410,13 @@ impl server::TokenStream for Rustc<'_> { stream.is_empty() } fn from_str(&mut self, src: &str) -> Self::TokenStream { - let (tokens, errors) = parse::parse_stream_from_source_str( + let (tokens, mut errors) = parse::parse_stream_from_source_str( FileName::proc_macro_source_code(src.clone()), src.to_string(), self.sess, Some(self.call_site), ); - emit_unclosed_delims(&errors, &self.sess.span_diagnostic); + emit_unclosed_delims(&mut errors, &self.sess.span_diagnostic); tokens } fn to_string(&mut self, stream: &Self::TokenStream) -> String { diff --git a/src/test/ui/parser-recovery-2.stderr b/src/test/ui/parser-recovery-2.stderr index 76f7af38e776..92d8cbc100a0 100644 --- a/src/test/ui/parser-recovery-2.stderr +++ b/src/test/ui/parser-recovery-2.stderr @@ -1,9 +1,3 @@ -error: unexpected token: `;` - --> $DIR/parser-recovery-2.rs:12:15 - | -LL | let x = y.; //~ ERROR unexpected token - | ^ - error: incorrect close delimiter: `)` --> $DIR/parser-recovery-2.rs:8:5 | @@ -13,6 +7,12 @@ LL | let x = foo(); //~ ERROR cannot find function `foo` in this scope LL | ) //~ ERROR incorrect close delimiter: `)` | ^ incorrect close delimiter +error: unexpected token: `;` + --> $DIR/parser-recovery-2.rs:12:15 + | +LL | let x = y.; //~ ERROR unexpected token + | ^ + error[E0425]: cannot find function `foo` in this scope --> $DIR/parser-recovery-2.rs:7:17 | diff --git a/src/test/ui/resolve/token-error-correct-3.rs b/src/test/ui/resolve/token-error-correct-3.rs index b1ca0bbfc57c..05bdbeacf72f 100644 --- a/src/test/ui/resolve/token-error-correct-3.rs +++ b/src/test/ui/resolve/token-error-correct-3.rs @@ -10,16 +10,14 @@ pub mod raw { pub fn ensure_dir_exists, F: FnOnce(&Path)>(path: P, callback: F) -> io::Result { - if !is_directory(path.as_ref()) { //~ ERROR: cannot find function `is_directory` - callback(path.as_ref(); //~ ERROR expected one of - fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types - //~^ expected (), found enum `std::result::Result` - //~| expected type `()` - //~| found type `std::result::Result` - //~| expected one of + if !is_directory(path.as_ref()) { + //~^ ERROR cannot find function `is_directory` + callback(path.as_ref(); + //~^ ERROR expected one of + //~| ERROR this function takes 1 parameter but 2 parameters were supplied + fs::create_dir_all(path.as_ref()).map(|()| true) } else { - //~^ ERROR: expected one of - //~| unexpected token + //~^ ERROR incorrect close delimiter: `}` Ok(false); } diff --git a/src/test/ui/resolve/token-error-correct-3.stderr b/src/test/ui/resolve/token-error-correct-3.stderr index a6bb83c71f31..0f1cbd6c2f77 100644 --- a/src/test/ui/resolve/token-error-correct-3.stderr +++ b/src/test/ui/resolve/token-error-correct-3.stderr @@ -1,39 +1,38 @@ -error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` - --> $DIR/token-error-correct-3.rs:14:35 +error: incorrect close delimiter: `}` + --> $DIR/token-error-correct-3.rs:19:9 | -LL | callback(path.as_ref(); //~ ERROR expected one of - | - ^ - | | | - | | help: `)` may belong here - | unclosed delimiter - -error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)` - --> $DIR/token-error-correct-3.rs:20:9 - | -LL | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types - | - expected one of `.`, `;`, `?`, `}`, or an operator here +LL | if !is_directory(path.as_ref()) { + | - close delimiter possibly meant for this +LL | //~^ ERROR cannot find function `is_directory` +LL | callback(path.as_ref(); + | - un-closed delimiter ... LL | } else { - | ^ unexpected token + | ^ incorrect close delimiter + +error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` + --> $DIR/token-error-correct-3.rs:15:35 + | +LL | callback(path.as_ref(); + | ^ expected one of `)`, `,`, `.`, `?`, or an operator here error[E0425]: cannot find function `is_directory` in this scope --> $DIR/token-error-correct-3.rs:13:13 | -LL | if !is_directory(path.as_ref()) { //~ ERROR: cannot find function `is_directory` +LL | if !is_directory(path.as_ref()) { | ^^^^^^^^^^^^ not found in this scope -error[E0308]: mismatched types +error[E0057]: this function takes 1 parameter but 2 parameters were supplied --> $DIR/token-error-correct-3.rs:15:13 | -LL | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try adding a semicolon: `;` - | | - | expected (), found enum `std::result::Result` - | - = note: expected type `()` - found type `std::result::Result` +LL | / callback(path.as_ref(); +LL | | //~^ ERROR expected one of +LL | | //~| ERROR this function takes 1 parameter but 2 parameters were supplied +LL | | fs::create_dir_all(path.as_ref()).map(|()| true) +LL | | } else { + | |_________^ expected 1 parameter error: aborting due to 4 previous errors -Some errors occurred: E0308, E0425. -For more information about an error, try `rustc --explain E0308`. +Some errors occurred: E0057, E0425. +For more information about an error, try `rustc --explain E0057`. From ac6cc2d6b0aad0b1cc97f1db6d8e9d4f117eca95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 3 Mar 2019 12:45:49 -0800 Subject: [PATCH 287/381] Collect unclosed delimiters in parent parser --- src/libsyntax/parse/parser.rs | 17 +++++-- src/test/ui/parser-recovery-2.stderr | 12 ++--- src/test/ui/resolve/token-error-correct-3.rs | 4 +- .../ui/resolve/token-error-correct-3.stderr | 47 ++++++++++--------- 4 files changed, 45 insertions(+), 35 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index bde14e192e96..348c26d2044b 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1510,9 +1510,13 @@ impl<'a> Parser<'a> { pub fn parse_trait_item(&mut self, at_end: &mut bool) -> PResult<'a, TraitItem> { maybe_whole!(self, NtTraitItem, |x| x); let attrs = self.parse_outer_attributes()?; + let mut unclosed_delims = vec![]; let (mut item, tokens) = self.collect_tokens(|this| { - this.parse_trait_item_(at_end, attrs) + let item = this.parse_trait_item_(at_end, attrs); + unclosed_delims.append(&mut this.unclosed_delims); + item })?; + self.unclosed_delims.append(&mut unclosed_delims); // See `parse_item` for why this clause is here. if !item.attrs.iter().any(|attr| attr.style == AttrStyle::Inner) { item.tokens = Some(tokens); @@ -6475,9 +6479,13 @@ impl<'a> Parser<'a> { pub fn parse_impl_item(&mut self, at_end: &mut bool) -> PResult<'a, ImplItem> { maybe_whole!(self, NtImplItem, |x| x); let attrs = self.parse_outer_attributes()?; + let mut unclosed_delims = vec![]; let (mut item, tokens) = self.collect_tokens(|this| { - this.parse_impl_item_(at_end, attrs) + let item = this.parse_impl_item_(at_end, attrs); + unclosed_delims.append(&mut this.unclosed_delims); + item })?; + self.unclosed_delims.append(&mut unclosed_delims); // See `parse_item` for why this clause is here. if !item.attrs.iter().any(|attr| attr.style == AttrStyle::Inner) { @@ -7797,12 +7805,13 @@ impl<'a> Parser<'a> { macros_allowed: bool, attributes_allowed: bool, ) -> PResult<'a, Option>> { + let mut unclosed_delims = vec![]; let (ret, tokens) = self.collect_tokens(|this| { let item = this.parse_item_implementation(attrs, macros_allowed, attributes_allowed); - let diag = this.diagnostic(); - emit_unclosed_delims(&mut this.unclosed_delims, diag); + unclosed_delims.append(&mut this.unclosed_delims); item })?; + self.unclosed_delims.append(&mut unclosed_delims); // Once we've parsed an item and recorded the tokens we got while // parsing we may want to store `tokens` into the item we're about to diff --git a/src/test/ui/parser-recovery-2.stderr b/src/test/ui/parser-recovery-2.stderr index 92d8cbc100a0..76f7af38e776 100644 --- a/src/test/ui/parser-recovery-2.stderr +++ b/src/test/ui/parser-recovery-2.stderr @@ -1,3 +1,9 @@ +error: unexpected token: `;` + --> $DIR/parser-recovery-2.rs:12:15 + | +LL | let x = y.; //~ ERROR unexpected token + | ^ + error: incorrect close delimiter: `)` --> $DIR/parser-recovery-2.rs:8:5 | @@ -7,12 +13,6 @@ LL | let x = foo(); //~ ERROR cannot find function `foo` in this scope LL | ) //~ ERROR incorrect close delimiter: `)` | ^ incorrect close delimiter -error: unexpected token: `;` - --> $DIR/parser-recovery-2.rs:12:15 - | -LL | let x = y.; //~ ERROR unexpected token - | ^ - error[E0425]: cannot find function `foo` in this scope --> $DIR/parser-recovery-2.rs:7:17 | diff --git a/src/test/ui/resolve/token-error-correct-3.rs b/src/test/ui/resolve/token-error-correct-3.rs index 05bdbeacf72f..212b88ac8b05 100644 --- a/src/test/ui/resolve/token-error-correct-3.rs +++ b/src/test/ui/resolve/token-error-correct-3.rs @@ -14,10 +14,10 @@ pub mod raw { //~^ ERROR cannot find function `is_directory` callback(path.as_ref(); //~^ ERROR expected one of - //~| ERROR this function takes 1 parameter but 2 parameters were supplied fs::create_dir_all(path.as_ref()).map(|()| true) + //~^ ERROR mismatched types } else { - //~^ ERROR incorrect close delimiter: `}` + //~^ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `)` Ok(false); } diff --git a/src/test/ui/resolve/token-error-correct-3.stderr b/src/test/ui/resolve/token-error-correct-3.stderr index 0f1cbd6c2f77..035a5ede4538 100644 --- a/src/test/ui/resolve/token-error-correct-3.stderr +++ b/src/test/ui/resolve/token-error-correct-3.stderr @@ -1,20 +1,20 @@ -error: incorrect close delimiter: `}` - --> $DIR/token-error-correct-3.rs:19:9 - | -LL | if !is_directory(path.as_ref()) { - | - close delimiter possibly meant for this -LL | //~^ ERROR cannot find function `is_directory` -LL | callback(path.as_ref(); - | - un-closed delimiter -... -LL | } else { - | ^ incorrect close delimiter - error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` --> $DIR/token-error-correct-3.rs:15:35 | LL | callback(path.as_ref(); - | ^ expected one of `)`, `,`, `.`, `?`, or an operator here + | - ^ + | | | + | | help: `)` may belong here + | unclosed delimiter + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)` + --> $DIR/token-error-correct-3.rs:19:9 + | +LL | fs::create_dir_all(path.as_ref()).map(|()| true) + | - expected one of `.`, `;`, `?`, `}`, or an operator here +LL | //~^ ERROR mismatched types +LL | } else { + | ^ unexpected token error[E0425]: cannot find function `is_directory` in this scope --> $DIR/token-error-correct-3.rs:13:13 @@ -22,17 +22,18 @@ error[E0425]: cannot find function `is_directory` in this scope LL | if !is_directory(path.as_ref()) { | ^^^^^^^^^^^^ not found in this scope -error[E0057]: this function takes 1 parameter but 2 parameters were supplied - --> $DIR/token-error-correct-3.rs:15:13 +error[E0308]: mismatched types + --> $DIR/token-error-correct-3.rs:17:13 | -LL | / callback(path.as_ref(); -LL | | //~^ ERROR expected one of -LL | | //~| ERROR this function takes 1 parameter but 2 parameters were supplied -LL | | fs::create_dir_all(path.as_ref()).map(|()| true) -LL | | } else { - | |_________^ expected 1 parameter +LL | fs::create_dir_all(path.as_ref()).map(|()| true) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try adding a semicolon: `;` + | | + | expected (), found enum `std::result::Result` + | + = note: expected type `()` + found type `std::result::Result` error: aborting due to 4 previous errors -Some errors occurred: E0057, E0425. -For more information about an error, try `rustc --explain E0057`. +Some errors occurred: E0308, E0425. +For more information about an error, try `rustc --explain E0308`. From f156d9220703d99709be32ea1be0be0d44535114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 3 Mar 2019 14:11:41 -0800 Subject: [PATCH 288/381] Always emit mismatched delim errors, never panic --- src/libsyntax/parse/parser.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 348c26d2044b..860964a736f5 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -262,7 +262,8 @@ pub struct Parser<'a> { impl<'a> Drop for Parser<'a> { fn drop(&mut self) { if !self.unclosed_delims.is_empty() { - panic!("unclosed delimiter errors not emitted"); + let diag = self.diagnostic(); + emit_unclosed_delims(&mut self.unclosed_delims, diag); } } } @@ -8567,8 +8568,6 @@ impl<'a> Parser<'a> { module: self.parse_mod_items(&token::Eof, lo)?, span: lo.to(self.span), }); - let diag = self.diagnostic(); - emit_unclosed_delims(&mut self.unclosed_delims, diag); krate } From 3818f8ba340de08f863b1c431fdf27f767dfca8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 3 Mar 2019 16:59:24 -0800 Subject: [PATCH 289/381] Add regression test for #58886 --- .../ui/parser/unclosed-delimiter-in-dep.rs | 6 +++++ .../parser/unclosed-delimiter-in-dep.stderr | 23 +++++++++++++++++++ src/test/ui/parser/unclosed_delim_mod.rs | 6 +++++ src/test/ui/parser/unclosed_delim_mod.stderr | 18 +++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 src/test/ui/parser/unclosed-delimiter-in-dep.rs create mode 100644 src/test/ui/parser/unclosed-delimiter-in-dep.stderr create mode 100644 src/test/ui/parser/unclosed_delim_mod.rs create mode 100644 src/test/ui/parser/unclosed_delim_mod.stderr diff --git a/src/test/ui/parser/unclosed-delimiter-in-dep.rs b/src/test/ui/parser/unclosed-delimiter-in-dep.rs new file mode 100644 index 000000000000..6db1b66e9f78 --- /dev/null +++ b/src/test/ui/parser/unclosed-delimiter-in-dep.rs @@ -0,0 +1,6 @@ +mod unclosed_delim_mod; + +fn main() { + let _: usize = unclosed_delim_mod::new(); + //~^ ERROR mismatched types +} diff --git a/src/test/ui/parser/unclosed-delimiter-in-dep.stderr b/src/test/ui/parser/unclosed-delimiter-in-dep.stderr new file mode 100644 index 000000000000..633c63bea910 --- /dev/null +++ b/src/test/ui/parser/unclosed-delimiter-in-dep.stderr @@ -0,0 +1,23 @@ +error: incorrect close delimiter: `}` + --> $DIR/unclosed_delim_mod.rs:5:1 + | +LL | pub fn new() -> Result { + | - close delimiter possibly meant for this +LL | Ok(Value { + | - un-closed delimiter +LL | } +LL | } + | ^ incorrect close delimiter + +error[E0308]: mismatched types + --> $DIR/unclosed-delimiter-in-dep.rs:4:20 + | +LL | let _: usize = unclosed_delim_mod::new(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected usize, found enum `std::result::Result` + | + = note: expected type `usize` + found type `std::result::Result` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/unclosed_delim_mod.rs b/src/test/ui/parser/unclosed_delim_mod.rs new file mode 100644 index 000000000000..b1664f49dc59 --- /dev/null +++ b/src/test/ui/parser/unclosed_delim_mod.rs @@ -0,0 +1,6 @@ +pub struct Value {} +pub fn new() -> Result { + Ok(Value { + } +} +//~^ ERROR incorrect close delimiter diff --git a/src/test/ui/parser/unclosed_delim_mod.stderr b/src/test/ui/parser/unclosed_delim_mod.stderr new file mode 100644 index 000000000000..cc04eb531cbe --- /dev/null +++ b/src/test/ui/parser/unclosed_delim_mod.stderr @@ -0,0 +1,18 @@ +error: incorrect close delimiter: `}` + --> $DIR/unclosed_delim_mod.rs:5:1 + | +LL | pub fn new() -> Result { + | - close delimiter possibly meant for this +LL | Ok(Value { + | - un-closed delimiter +LL | } +LL | } + | ^ incorrect close delimiter + +error[E0601]: `main` function not found in crate `unclosed_delim_mod` + | + = note: consider adding a `main` function to `$DIR/unclosed_delim_mod.rs` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0601`. From 6f0f2fc6d6ca0800c8b8b95932010d51af4e4663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 4 Mar 2019 12:59:43 -0800 Subject: [PATCH 290/381] Simplify code --- src/libsyntax/parse/mod.rs | 11 +++++++++-- src/libsyntax/parse/parser.rs | 6 ++---- src/libsyntax/parse/token.rs | 21 +++------------------ src/libsyntax_ext/proc_macro_server.rs | 7 ++----- 4 files changed, 16 insertions(+), 29 deletions(-) diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index b2d4d97d57d8..6583458b4469 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -6,6 +6,7 @@ use crate::source_map::{SourceMap, FilePathMapping}; use crate::feature_gate::UnstableFeatures; use crate::parse::parser::Parser; use crate::symbol::Symbol; +use crate::syntax::parse::parser::emit_unclosed_delims; use crate::tokenstream::{TokenStream, TokenTree}; use crate::diagnostics::plugin::ErrorMap; use crate::print::pprust::token_to_string; @@ -141,8 +142,14 @@ pub fn parse_stream_from_source_str( source: String, sess: &ParseSess, override_span: Option, -) -> (TokenStream, Vec) { - source_file_to_stream(sess, sess.source_map().new_source_file(name, source), override_span) +) -> TokenStream { + let (stream, mut errors) = source_file_to_stream( + sess, + sess.source_map().new_source_file(name, source), + override_span, + ); + emit_unclosed_delims(&mut errors, &sess.span_diagnostic); + stream } /// Creates a new parser from a source string. diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 860964a736f5..58c1c5006bbf 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -261,10 +261,8 @@ pub struct Parser<'a> { impl<'a> Drop for Parser<'a> { fn drop(&mut self) { - if !self.unclosed_delims.is_empty() { - let diag = self.diagnostic(); - emit_unclosed_delims(&mut self.unclosed_delims, diag); - } + let diag = self.diagnostic(); + emit_unclosed_delims(&mut self.unclosed_delims, diag); } } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index bb4da12bae89..2fa4f5263fbc 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -10,7 +10,6 @@ use crate::print::pprust; use crate::ptr::P; use crate::symbol::keywords; use crate::syntax::parse::parse_stream_from_source_str; -use crate::syntax::parse::parser::emit_unclosed_delims; use crate::tokenstream::{self, DelimSpan, TokenStream, TokenTree}; use syntax_pos::symbol::{self, Symbol}; @@ -675,9 +674,7 @@ impl Nonterminal { // FIXME(#43081): Avoid this pretty-print + reparse hack let source = pprust::nonterminal_to_string(self); let filename = FileName::macro_expansion_source_code(&source); - let (tokens_for_real, mut errors) = - parse_stream_from_source_str(filename, source, sess, Some(span)); - emit_unclosed_delims(&mut errors, &sess.span_diagnostic); + let tokens_for_real = parse_stream_from_source_str(filename, source, sess, Some(span)); // During early phases of the compiler the AST could get modified // directly (e.g., attributes added or removed) and the internal cache @@ -740,13 +737,7 @@ fn prepend_attrs(sess: &ParseSess, let source = pprust::attr_to_string(attr); let macro_filename = FileName::macro_expansion_source_code(&source); if attr.is_sugared_doc { - let (stream, mut errors) = parse_stream_from_source_str( - macro_filename, - source, - sess, - Some(span), - ); - emit_unclosed_delims(&mut errors, &sess.span_diagnostic); + let stream = parse_stream_from_source_str(macro_filename, source, sess, Some(span)); builder.push(stream); continue } @@ -763,13 +754,7 @@ fn prepend_attrs(sess: &ParseSess, // ... and for more complicated paths, fall back to a reparse hack that // should eventually be removed. } else { - let (stream, mut errors) = parse_stream_from_source_str( - macro_filename, - source, - sess, - Some(span), - ); - emit_unclosed_delims(&mut errors, &sess.span_diagnostic); + let stream = parse_stream_from_source_str(macro_filename, source, sess, Some(span)); brackets.push(stream); } diff --git a/src/libsyntax_ext/proc_macro_server.rs b/src/libsyntax_ext/proc_macro_server.rs index 5822b5607f7d..a7ac95ba9ef5 100644 --- a/src/libsyntax_ext/proc_macro_server.rs +++ b/src/libsyntax_ext/proc_macro_server.rs @@ -12,7 +12,6 @@ use syntax::ast; use syntax::ext::base::ExtCtxt; use syntax::parse::lexer::comments; use syntax::parse::{self, token, ParseSess}; -use syntax::parse::parser::emit_unclosed_delims; use syntax::tokenstream::{self, DelimSpan, IsJoint::*, TokenStream, TreeAndJoint}; use syntax_pos::hygiene::{SyntaxContext, Transparency}; use syntax_pos::symbol::{keywords, Symbol}; @@ -410,14 +409,12 @@ impl server::TokenStream for Rustc<'_> { stream.is_empty() } fn from_str(&mut self, src: &str) -> Self::TokenStream { - let (tokens, mut errors) = parse::parse_stream_from_source_str( + parse::parse_stream_from_source_str( FileName::proc_macro_source_code(src.clone()), src.to_string(), self.sess, Some(self.call_site), - ); - emit_unclosed_delims(&mut errors, &self.sess.span_diagnostic); - tokens + ) } fn to_string(&mut self, stream: &Self::TokenStream) -> String { stream.to_string() From 551ea65c87ef567cb22856a769df2a75f2cbb235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 6 Mar 2019 19:09:24 -0800 Subject: [PATCH 291/381] Rely on drop to emit unclosed delims --- src/libsyntax/parse/parser.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 58c1c5006bbf..7e63da270499 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -784,7 +784,6 @@ impl<'a> Parser<'a> { // leave it in the input Ok(false) } else if self.last_unexpected_token_span == Some(self.span) { - emit_unclosed_delims(&self.unclosed_delims, self.diagnostic()); FatalError.raise(); } else { let mut expected = edible.iter() From 7a55a004fa3b3eb933637a4aeec9b8576b31a033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 6 Mar 2019 19:49:39 -0800 Subject: [PATCH 292/381] Make `-Z treat-err-as-bug` take a number of errors to be emitted `-Z treat-err-as-bug=0` will cause `rustc` to panic after the first error is reported. `-Z treat-err-as-bug=2` will cause `rustc` to panic after 3 errors have been reported. --- src/librustc/session/config.rs | 4 ++-- src/librustc/session/mod.rs | 4 ++-- src/librustc_codegen_ssa/back/write.rs | 2 +- src/librustc_driver/lib.rs | 4 ++-- src/librustc_errors/diagnostic_builder.rs | 2 +- src/librustc_errors/lib.rs | 27 +++++++++++++++-------- src/librustdoc/core.rs | 2 +- src/libsyntax/parse/mod.rs | 2 +- 8 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 774ab0333db5..dfd8e4dd571b 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1234,7 +1234,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "parse only; do not compile, assemble, or link"), no_codegen: bool = (false, parse_bool, [TRACKED], "run all passes except codegen; no output"), - treat_err_as_bug: bool = (false, parse_bool, [TRACKED], + treat_err_as_bug: Option = (None, parse_opt_uint, [TRACKED], "treat all errors that occur as bugs"), report_delayed_bugs: bool = (false, parse_bool, [TRACKED], "immediately print bugs registered with `delay_span_bug`"), @@ -3212,7 +3212,7 @@ mod tests { assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); opts = reference.clone(); - opts.debugging_opts.treat_err_as_bug = true; + opts.debugging_opts.treat_err_as_bug = Some(1); assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); opts = reference.clone(); diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 774bc8b450b5..751fa7e95e3a 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -1315,7 +1315,7 @@ pub fn early_error(output: config::ErrorOutputType, msg: &str) -> ! { Box::new(EmitterWriter::stderr(color_config, None, true, false)) } }; - let handler = errors::Handler::with_emitter(true, false, emitter); + let handler = errors::Handler::with_emitter(true, None, emitter); handler.emit(&MultiSpan::new(), msg, errors::Level::Fatal); errors::FatalError.raise(); } @@ -1330,7 +1330,7 @@ pub fn early_warn(output: config::ErrorOutputType, msg: &str) { Box::new(EmitterWriter::stderr(color_config, None, true, false)) } }; - let handler = errors::Handler::with_emitter(true, false, emitter); + let handler = errors::Handler::with_emitter(true, None, emitter); handler.emit(&MultiSpan::new(), msg, errors::Level::Warning); } diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 4bccc2a6d1f7..c84b38cde818 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -247,7 +247,7 @@ pub struct CodegenContext { impl CodegenContext { pub fn create_diag_handler(&self) -> Handler { - Handler::with_emitter(true, false, Box::new(self.diag_emitter.clone())) + Handler::with_emitter(true, None, Box::new(self.diag_emitter.clone())) } pub fn config(&self, kind: ModuleKind) -> &ModuleConfig { diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index cc1b8916c107..656d8e463dbd 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -148,7 +148,7 @@ pub fn run(run_compiler: F) -> isize true, false ); - let handler = errors::Handler::with_emitter(true, false, Box::new(emitter)); + let handler = errors::Handler::with_emitter(true, None, Box::new(emitter)); handler.emit(&MultiSpan::new(), "aborting due to previous error(s)", errors::Level::Fatal); @@ -1327,7 +1327,7 @@ pub fn monitor(f: F) -> Result<(), CompilationFail None, false, false)); - let handler = errors::Handler::with_emitter(true, false, emitter); + let handler = errors::Handler::with_emitter(true, None, emitter); // a .span_bug or .bug call has already printed what // it wants to print. diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 0c808a07f9ba..a995d808bc41 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -103,7 +103,7 @@ impl<'a> DiagnosticBuilder<'a> { /// Buffers the diagnostic for later emission, unless handler /// has disabled such buffering. pub fn buffer(mut self, buffered_diagnostics: &mut Vec) { - if self.handler.flags.dont_buffer_diagnostics || self.handler.flags.treat_err_as_bug { + if self.handler.flags.dont_buffer_diagnostics || self.handler.treat_err_as_bug() { self.emit(); return; } diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 87b475152683..ae634018b935 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -330,7 +330,7 @@ pub struct HandlerFlags { pub can_emit_warnings: bool, /// If true, error-level diagnostics are upgraded to bug-level. /// (rustc: see `-Z treat-err-as-bug`) - pub treat_err_as_bug: bool, + pub treat_err_as_bug: Option, /// If true, immediately emit diagnostics that would otherwise be buffered. /// (rustc: see `-Z dont-buffer-diagnostics` and `-Z treat-err-as-bug`) pub dont_buffer_diagnostics: bool, @@ -360,7 +360,7 @@ impl Drop for Handler { impl Handler { pub fn with_tty_emitter(color_config: ColorConfig, can_emit_warnings: bool, - treat_err_as_bug: bool, + treat_err_as_bug: Option, cm: Option>) -> Handler { Handler::with_tty_emitter_and_flags( @@ -382,7 +382,7 @@ impl Handler { } pub fn with_emitter(can_emit_warnings: bool, - treat_err_as_bug: bool, + treat_err_as_bug: Option, e: Box) -> Handler { Handler::with_emitter_and_flags( @@ -516,7 +516,7 @@ impl Handler { } fn panic_if_treat_err_as_bug(&self) { - if self.flags.treat_err_as_bug { + if self.treat_err_as_bug() { panic!("encountered error with `-Z treat_err_as_bug"); } } @@ -558,7 +558,7 @@ impl Handler { panic!(ExplicitBug); } pub fn delay_span_bug>(&self, sp: S, msg: &str) { - if self.flags.treat_err_as_bug { + if self.treat_err_as_bug() { // FIXME: don't abort here if report_delayed_bugs is off self.span_bug(sp, msg); } @@ -593,14 +593,14 @@ impl Handler { DiagnosticBuilder::new(self, FailureNote, msg).emit() } pub fn fatal(&self, msg: &str) -> FatalError { - if self.flags.treat_err_as_bug { + if self.treat_err_as_bug() { self.bug(msg); } DiagnosticBuilder::new(self, Fatal, msg).emit(); FatalError } pub fn err(&self, msg: &str) { - if self.flags.treat_err_as_bug { + if self.treat_err_as_bug() { self.bug(msg); } let mut db = DiagnosticBuilder::new(self, Error, msg); @@ -610,6 +610,9 @@ impl Handler { let mut db = DiagnosticBuilder::new(self, Warning, msg); db.emit(); } + fn treat_err_as_bug(&self) -> bool { + self.flags.treat_err_as_bug.map(|c| self.err_count() >= c).unwrap_or(false) + } pub fn note_without_error(&self, msg: &str) { let mut db = DiagnosticBuilder::new(self, Note, msg); db.emit(); @@ -624,8 +627,8 @@ impl Handler { } fn bump_err_count(&self) { - self.panic_if_treat_err_as_bug(); self.err_count.fetch_add(1, SeqCst); + self.panic_if_treat_err_as_bug(); } pub fn err_count(&self) -> usize { @@ -643,7 +646,13 @@ impl Handler { _ => format!("aborting due to {} previous errors", self.err_count()) }; - let _ = self.fatal(&s); + let _ = if self.treat_err_as_bug() { + self.fatal(&s) + } else { + // only emit one backtrace when using `-Z treat-err-as-bug=X` + DiagnosticBuilder::new(self, Fatal, &s).emit(); + FatalError + }; let can_show_explain = self.emitter.borrow().should_show_explain(); let are_there_diagnostics = !self.emitted_diagnostic_codes.borrow().is_empty(); diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index fdb071638b79..f4074bcdba6f 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -266,7 +266,7 @@ impl DocAccessLevels for AccessLevels { /// will be created for the handler. pub fn new_handler(error_format: ErrorOutputType, source_map: Option>, - treat_err_as_bug: bool, + treat_err_as_bug: Option, ui_testing: bool, ) -> errors::Handler { // rustdoc doesn't override (or allow to override) anything from this that is relevant here, so diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index b2d4d97d57d8..9cfcfcd6241a 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -53,7 +53,7 @@ impl ParseSess { let cm = Lrc::new(SourceMap::new(file_path_mapping)); let handler = Handler::with_tty_emitter(ColorConfig::Auto, true, - false, + None, Some(cm.clone())); ParseSess::with_span_handler(handler, cm) } From 7694ca1105b55d4f1ce9d7b6fc6feb9c3c9033c5 Mon Sep 17 00:00:00 2001 From: Esteban Kuber Date: Wed, 6 Mar 2019 19:57:04 -0800 Subject: [PATCH 293/381] Fix incorrect default --- src/librustc/session/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index dfd8e4dd571b..70cf36c38691 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -3212,7 +3212,7 @@ mod tests { assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); opts = reference.clone(); - opts.debugging_opts.treat_err_as_bug = Some(1); + opts.debugging_opts.treat_err_as_bug = Some(0); assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); opts = reference.clone(); From cd06038b54687bb4040e3d0a8b7bc4e8a3618ba8 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 4 Mar 2019 09:00:30 +0100 Subject: [PATCH 294/381] HirIdification: replace NodeId method calls --- src/librustc/hir/map/mod.rs | 22 ++++---- src/librustc/infer/opaque_types/mod.rs | 30 +++++----- src/librustc/middle/expr_use_visitor.rs | 5 +- src/librustc/middle/liveness.rs | 3 +- src/librustc/middle/reachable.rs | 12 ++-- src/librustc/middle/region.rs | 18 +++--- src/librustc/middle/resolve_lifetime.rs | 10 ++-- src/librustc/mir/mod.rs | 15 ++--- src/librustc/mir/mono.rs | 4 +- src/librustc/traits/error_reporting.rs | 5 +- src/librustc/ty/constness.rs | 6 +- src/librustc/ty/context.rs | 10 ++-- src/librustc/ty/mod.rs | 14 ++--- src/librustc/ty/query/config.rs | 2 +- src/librustc/util/ppaux.rs | 14 ++--- src/librustc_borrowck/borrowck/check_loans.rs | 4 +- src/librustc_borrowck/borrowck/mod.rs | 13 ++--- src/librustc_codegen_llvm/consts.rs | 4 +- src/librustc_codegen_ssa/mono_item.rs | 4 +- src/librustc_codegen_utils/symbol_names.rs | 6 +- src/librustc_lint/builtin.rs | 4 +- src/librustc_metadata/encoder.rs | 13 ++--- .../borrow_check/error_reporting.rs | 25 ++++----- src/librustc_mir/borrow_check/mod.rs | 6 +- .../borrow_check/mutability_errors.rs | 4 +- src/librustc_mir/build/mod.rs | 38 ++++++------- src/librustc_mir/const_eval.rs | 4 +- src/librustc_mir/dataflow/graphviz.rs | 12 ++-- src/librustc_mir/dataflow/mod.rs | 11 ++-- src/librustc_mir/hair/cx/expr.rs | 3 +- src/librustc_mir/hair/pattern/check_match.rs | 2 +- src/librustc_mir/lints.rs | 4 +- src/librustc_mir/monomorphize/collector.rs | 3 +- src/librustc_mir/monomorphize/item.rs | 14 ++--- src/librustc_mir/monomorphize/partitioning.rs | 21 ++++--- src/librustc_mir/transform/check_unsafety.rs | 4 +- src/librustc_mir/transform/const_prop.rs | 6 +- src/librustc_mir/transform/elaborate_drops.rs | 6 +- src/librustc_mir/transform/generator.rs | 6 +- src/librustc_mir/transform/inline.rs | 6 +- src/librustc_mir/transform/mod.rs | 4 +- src/librustc_mir/transform/rustc_peek.rs | 5 +- src/librustc_mir/util/graphviz.rs | 2 +- src/librustc_mir/util/liveness.rs | 2 +- src/librustc_passes/rvalue_promotion.rs | 11 ++-- src/librustc_privacy/lib.rs | 4 +- src/librustc_traits/lowering/environment.rs | 4 +- src/librustc_typeck/astconv.rs | 4 +- src/librustc_typeck/check/coercion.rs | 4 +- src/librustc_typeck/check/compare_method.rs | 40 ++++++------- src/librustc_typeck/check/mod.rs | 13 ++--- src/librustc_typeck/check/upvar.rs | 12 ++-- src/librustc_typeck/check/wfcheck.rs | 12 ++-- src/librustc_typeck/check_unused.rs | 4 +- src/librustc_typeck/coherence/builtin.rs | 4 +- src/librustc_typeck/collect.rs | 56 +++++++++---------- src/librustc_typeck/outlives/mod.rs | 4 +- src/librustdoc/clean/auto_trait.rs | 8 +-- src/librustdoc/clean/blanket_impl.rs | 8 +-- src/librustdoc/clean/def_ctor.rs | 10 ++-- src/librustdoc/clean/inline.rs | 4 +- src/librustdoc/clean/mod.rs | 18 +++--- src/librustdoc/core.rs | 15 ++++- .../passes/collect_intra_doc_links.rs | 18 +++--- src/librustdoc/passes/collect_trait_impls.rs | 8 +-- src/librustdoc/passes/mod.rs | 2 +- .../mir-opt/inline-closure-borrows-arg.rs | 2 +- src/test/mir-opt/inline-closure.rs | 2 +- src/test/mir-opt/retag.rs | 2 +- 69 files changed, 336 insertions(+), 339 deletions(-) diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 21a9ed5ebe03..e873d5640dd9 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -501,10 +501,10 @@ impl<'hir> Map<'hir> { } /// Given a body owner's id, returns the `BodyId` associated with it. - pub fn body_owned_by(&self, id: NodeId) -> BodyId { - self.maybe_body_owned_by(id).unwrap_or_else(|| { - span_bug!(self.span(id), "body_owned_by: {} has no associated body", - self.node_to_string(id)); + pub fn body_owned_by(&self, id: HirId) -> BodyId { + self.maybe_body_owned_by_by_hir_id(id).unwrap_or_else(|| { + span_bug!(self.span_by_hir_id(id), "body_owned_by: {} has no associated body", + self.hir_to_string(id)); }) } @@ -539,19 +539,19 @@ impl<'hir> Map<'hir> { self.body_owner_kind(node_id) } - pub fn ty_param_owner(&self, id: NodeId) -> NodeId { - match self.get(id) { + pub fn ty_param_owner(&self, id: HirId) -> HirId { + match self.get_by_hir_id(id) { Node::Item(&Item { node: ItemKind::Trait(..), .. }) => id, - Node::GenericParam(_) => self.get_parent_node(id), - _ => bug!("ty_param_owner: {} not a type parameter", self.node_to_string(id)) + Node::GenericParam(_) => self.get_parent_node_by_hir_id(id), + _ => bug!("ty_param_owner: {} not a type parameter", self.hir_to_string(id)) } } - pub fn ty_param_name(&self, id: NodeId) -> Name { - match self.get(id) { + pub fn ty_param_name(&self, id: HirId) -> Name { + match self.get_by_hir_id(id) { Node::Item(&Item { node: ItemKind::Trait(..), .. }) => keywords::SelfUpper.name(), Node::GenericParam(param) => param.name.ident().name, - _ => bug!("ty_param_name: {} not a type parameter", self.node_to_string(id)), + _ => bug!("ty_param_name: {} not a type parameter", self.hir_to_string(id)), } } diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index 1b7ecc7c3a67..8bd208431632 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -4,7 +4,6 @@ use crate::hir::Node; use crate::infer::{self, InferCtxt, InferOk, TypeVariableOrigin}; use crate::infer::outlives::free_region_map::FreeRegionRelations; use rustc_data_structures::fx::FxHashMap; -use syntax::ast; use crate::traits::{self, PredicateObligation}; use crate::ty::{self, Ty, TyCtxt, GenericParamDefKind}; use crate::ty::fold::{BottomUpFolder, TypeFoldable, TypeFolder}; @@ -686,13 +685,14 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> { // let x = || foo(); // returns the Opaque assoc with `foo` // } // ``` - if let Some(opaque_node_id) = tcx.hir().as_local_node_id(def_id) { + if let Some(opaque_hir_id) = tcx.hir().as_local_hir_id(def_id) { let parent_def_id = self.parent_def_id; let def_scope_default = || { - let opaque_parent_node_id = tcx.hir().get_parent(opaque_node_id); - parent_def_id == tcx.hir().local_def_id(opaque_parent_node_id) + let opaque_parent_hir_id = tcx.hir().get_parent_item(opaque_hir_id); + parent_def_id == tcx.hir() + .local_def_id_from_hir_id(opaque_parent_hir_id) }; - let in_definition_scope = match tcx.hir().find(opaque_node_id) { + let in_definition_scope = match tcx.hir().find_by_hir_id(opaque_hir_id) { Some(Node::Item(item)) => match item.node { // impl trait hir::ItemKind::Existential(hir::ExistTy { @@ -706,7 +706,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> { }) => may_define_existential_type( tcx, self.parent_def_id, - opaque_node_id, + opaque_hir_id, ), _ => def_scope_default(), }, @@ -714,13 +714,13 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> { hir::ImplItemKind::Existential(_) => may_define_existential_type( tcx, self.parent_def_id, - opaque_node_id, + opaque_hir_id, ), _ => def_scope_default(), }, _ => bug!( "expected (impl) item, found {}", - tcx.hir().node_to_string(opaque_node_id), + tcx.hir().hir_to_string(opaque_hir_id), ), }; if in_definition_scope { @@ -839,20 +839,20 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> { pub fn may_define_existential_type( tcx: TyCtxt<'_, '_, '_>, def_id: DefId, - opaque_node_id: ast::NodeId, + opaque_hir_id: hir::HirId, ) -> bool { - let mut node_id = tcx + let mut hir_id = tcx .hir() - .as_local_node_id(def_id) + .as_local_hir_id(def_id) .unwrap(); // named existential types can be defined by any siblings or // children of siblings - let mod_id = tcx.hir().get_parent(opaque_node_id); + let mod_id = tcx.hir().get_parent_item(opaque_hir_id); // so we walk up the node tree until we hit the root or the parent // of the opaque type - while node_id != mod_id && node_id != ast::CRATE_NODE_ID { - node_id = tcx.hir().get_parent(node_id); + while hir_id != mod_id && hir_id != hir::CRATE_HIR_ID { + hir_id = tcx.hir().get_parent_item(hir_id); } // syntactically we are allowed to define the concrete type - node_id == mod_id + hir_id == mod_id } diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 6e8b661b7b89..19113d16a1ee 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -918,9 +918,8 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { fn walk_captures(&mut self, closure_expr: &hir::Expr, fn_decl_span: Span) { debug!("walk_captures({:?})", closure_expr); - let closure_node_id = self.tcx().hir().hir_to_node_id(closure_expr.hir_id); - let closure_def_id = self.tcx().hir().local_def_id(closure_node_id); - self.tcx().with_freevars(closure_node_id, |freevars| { + let closure_def_id = self.tcx().hir().local_def_id_from_hir_id(closure_expr.hir_id); + self.tcx().with_freevars(closure_expr.hir_id, |freevars| { for freevar in freevars { let var_hir_id = self.tcx().hir().node_to_hir_id(freevar.var_id()); let upvar_id = ty::UpvarId { diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 76933a6e3484..e22b3e7f1d3c 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -476,8 +476,7 @@ fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) { // in better error messages than just pointing at the closure // construction site. let mut call_caps = Vec::new(); - let node_id = ir.tcx.hir().hir_to_node_id(expr.hir_id); - ir.tcx.with_freevars(node_id, |freevars| { + ir.tcx.with_freevars(expr.hir_id, |freevars| { call_caps.extend(freevars.iter().filter_map(|fv| { if let Def::Local(rv) = fv.def { let fv_ln = ir.add_live_node(FreeVarNode(fv.span)); diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 086b3a318e6b..8ccf52b4efb2 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -51,8 +51,8 @@ fn method_might_be_inlined<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if codegen_fn_attrs.requests_inline() || generics.requires_monomorphization(tcx) { return true } - if let Some(impl_node_id) = tcx.hir().as_local_node_id(impl_src) { - match tcx.hir().find(impl_node_id) { + if let Some(impl_hir_id) = tcx.hir().as_local_hir_id(impl_src) { + match tcx.hir().find_by_hir_id(impl_hir_id) { Some(Node::Item(item)) => item_might_be_inlined(tcx, &item, codegen_fn_attrs), Some(..) | None => @@ -141,12 +141,12 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { // Returns true if the given def ID represents a local item that is // eligible for inlining and false otherwise. fn def_id_represents_local_inlined_item(&self, def_id: DefId) -> bool { - let node_id = match self.tcx.hir().as_local_node_id(def_id) { - Some(node_id) => node_id, + let hir_id = match self.tcx.hir().as_local_hir_id(def_id) { + Some(hir_id) => hir_id, None => { return false; } }; - match self.tcx.hir().find(node_id) { + match self.tcx.hir().find_by_hir_id(hir_id) { Some(Node::Item(item)) => { match item.node { hir::ItemKind::Fn(..) => @@ -173,7 +173,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { } else { let impl_did = self.tcx .hir() - .get_parent_did(node_id); + .get_parent_did_by_hir_id(hir_id); // Check the impl. If the generics on the self // type of the impl require inlining, this method // does too. diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 3499138fb791..062742bca760 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -223,7 +223,7 @@ pub struct ScopeTree { /// The parent of the root body owner, if the latter is an /// an associated const or method, as impls/traits can also /// have lifetime parameters free in this body. - root_parent: Option, + root_parent: Option, /// `parent_map` maps from a scope ID to the enclosing scope id; /// this is usually corresponding to the lexical nesting, though @@ -650,8 +650,8 @@ impl<'tcx> ScopeTree { -> Scope { let param_owner = tcx.parent_def_id(br.def_id).unwrap(); - let param_owner_id = tcx.hir().as_local_node_id(param_owner).unwrap(); - let scope = tcx.hir().maybe_body_owned_by(param_owner_id).map(|body_id| { + let param_owner_id = tcx.hir().as_local_hir_id(param_owner).unwrap(); + let scope = tcx.hir().maybe_body_owned_by_by_hir_id(param_owner_id).map(|body_id| { tcx.hir().body(body_id).value.hir_id.local_id }).unwrap_or_else(|| { // The lifetime was defined on node that doesn't own a body, @@ -661,7 +661,7 @@ impl<'tcx> ScopeTree { "free_scope: {:?} not recognized by the \ region scope tree for {:?} / {:?}", param_owner, - self.root_parent.map(|id| tcx.hir().local_def_id(id)), + self.root_parent.map(|id| tcx.hir().local_def_id_from_hir_id(id)), self.root_body.map(|hir_id| DefId::local(hir_id.owner))); // The trait/impl lifetime is in scope for the method's body. @@ -686,7 +686,7 @@ impl<'tcx> ScopeTree { // on the same function that they ended up being freed in. assert_eq!(param_owner, fr.scope); - let param_owner_id = tcx.hir().as_local_node_id(param_owner).unwrap(); + let param_owner_id = tcx.hir().as_local_hir_id(param_owner).unwrap(); let body_id = tcx.hir().body_owned_by(param_owner_id); Scope { id: tcx.hir().body(body_id).value.hir_id.local_id, data: ScopeData::CallSite } } @@ -1328,8 +1328,8 @@ fn region_scope_tree<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) return tcx.region_scope_tree(closure_base_def_id); } - let id = tcx.hir().as_local_node_id(def_id).unwrap(); - let scope_tree = if let Some(body_id) = tcx.hir().maybe_body_owned_by(id) { + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let scope_tree = if let Some(body_id) = tcx.hir().maybe_body_owned_by_by_hir_id(id) { let mut visitor = RegionResolutionVisitor { tcx, scope_tree: ScopeTree::default(), @@ -1348,10 +1348,10 @@ fn region_scope_tree<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) // If the item is an associated const or a method, // record its impl/trait parent, as it can also have // lifetime parameters free in this body. - match tcx.hir().get(id) { + match tcx.hir().get_by_hir_id(id) { Node::ImplItem(_) | Node::TraitItem(_) => { - visitor.scope_tree.root_parent = Some(tcx.hir().get_parent(id)); + visitor.scope_tree.root_parent = Some(tcx.hir().get_parent_item(id)); } _ => {} } diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index d2bec1070f92..f862b690f880 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -1585,9 +1585,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { match lifetimeuseset { Some(LifetimeUseSet::One(lifetime)) => { - let node_id = self.tcx.hir().as_local_node_id(def_id).unwrap(); - debug!("node id first={:?}", node_id); - if let Some((id, span, name)) = match self.tcx.hir().get(node_id) { + let hir_id = self.tcx.hir().as_local_hir_id(def_id).unwrap(); + debug!("hir id first={:?}", hir_id); + if let Some((id, span, name)) = match self.tcx.hir().get_by_hir_id(hir_id) { Node::Lifetime(hir_lifetime) => Some(( hir_lifetime.hir_id, hir_lifetime.span, @@ -1626,8 +1626,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { debug!("Not one use lifetime"); } None => { - let node_id = self.tcx.hir().as_local_node_id(def_id).unwrap(); - if let Some((id, span, name)) = match self.tcx.hir().get(node_id) { + let hir_id = self.tcx.hir().as_local_hir_id(def_id).unwrap(); + if let Some((id, span, name)) = match self.tcx.hir().get_by_hir_id(hir_id) { Node::Lifetime(hir_lifetime) => Some(( hir_lifetime.hir_id, hir_lifetime.span, diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 0462bb802312..7a91059b6bf4 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -2411,15 +2411,15 @@ impl<'tcx> Debug for Rvalue<'tcx> { } AggregateKind::Closure(def_id, _) => ty::tls::with(|tcx| { - if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { + if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) { let name = if tcx.sess.opts.debugging_opts.span_free_formats { - format!("[closure@{:?}]", node_id) + format!("[closure@{:?}]", hir_id) } else { - format!("[closure@{:?}]", tcx.hir().span(node_id)) + format!("[closure@{:?}]", tcx.hir().span_by_hir_id(hir_id)) }; let mut struct_fmt = fmt.debug_struct(&name); - tcx.with_freevars(node_id, |freevars| { + tcx.with_freevars(hir_id, |freevars| { for (freevar, place) in freevars.iter().zip(places) { let var_name = tcx.hir().name(freevar.var_id()); struct_fmt.field(&var_name.as_str(), place); @@ -2433,11 +2433,12 @@ impl<'tcx> Debug for Rvalue<'tcx> { }), AggregateKind::Generator(def_id, _, _) => ty::tls::with(|tcx| { - if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { - let name = format!("[generator@{:?}]", tcx.hir().span(node_id)); + if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) { + let name = format!("[generator@{:?}]", + tcx.hir().span_by_hir_id(hir_id)); let mut struct_fmt = fmt.debug_struct(&name); - tcx.with_freevars(node_id, |freevars| { + tcx.with_freevars(hir_id, |freevars| { for (freevar, place) in freevars.iter().zip(places) { let var_name = tcx.hir().name(freevar.var_id()); struct_fmt.field(&var_name.as_str(), place); diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index 2296fe5763c9..c75f7d7d1594 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -1,5 +1,5 @@ use crate::hir::def_id::{DefId, CrateNum, LOCAL_CRATE}; -use syntax::ast::NodeId; +use crate::hir::HirId; use syntax::symbol::{Symbol, InternedString}; use crate::ty::{Instance, TyCtxt}; use crate::util::nodemap::FxHashMap; @@ -14,7 +14,7 @@ use std::hash::Hash; pub enum MonoItem<'tcx> { Fn(Instance<'tcx>), Static(DefId), - GlobalAsm(NodeId), + GlobalAsm(HirId), } impl<'tcx> MonoItem<'tcx> { diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 322e384e13e2..448b0f26d561 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -761,7 +761,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let found_kind = self.closure_kind(closure_def_id, closure_substs).unwrap(); let closure_span = self.tcx.sess.source_map() .def_span(self.tcx.hir().span_if_local(closure_def_id).unwrap()); - let node_id = self.tcx.hir().as_local_node_id(closure_def_id).unwrap(); + let hir_id = self.tcx.hir().as_local_hir_id(closure_def_id).unwrap(); let mut err = struct_span_err!( self.tcx.sess, closure_span, E0525, "expected a closure that implements the `{}` trait, \ @@ -780,8 +780,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // a particular trait. if let Some(tables) = self.in_progress_tables { let tables = tables.borrow(); - let closure_hir_id = self.tcx.hir().node_to_hir_id(node_id); - match (found_kind, tables.closure_kind_origins().get(closure_hir_id)) { + match (found_kind, tables.closure_kind_origins().get(hir_id)) { (ty::ClosureKind::FnOnce, Some((span, name))) => { err.span_label(*span, format!( "closure is `FnOnce` because it moves the \ diff --git a/src/librustc/ty/constness.rs b/src/librustc/ty/constness.rs index fff5dcf433ed..e33d0a74ea01 100644 --- a/src/librustc/ty/constness.rs +++ b/src/librustc/ty/constness.rs @@ -67,10 +67,10 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { /// only checks whether the function has a `const` modifier fn is_const_fn_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { - let node_id = tcx.hir().as_local_node_id(def_id) - .expect("Non-local call to local provider is_const_fn"); + let hir_id = tcx.hir().as_local_hir_id(def_id) + .expect("Non-local call to local provider is_const_fn"); - if let Some(fn_like) = FnLikeNode::from_node(tcx.hir().get(node_id)) { + if let Some(fn_like) = FnLikeNode::from_node(tcx.hir().get_by_hir_id(hir_id)) { fn_like.constness() == hir::Constness::Const } else { false diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index f6e6067bb6fc..2a3a9d1f5f43 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1619,10 +1619,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { _ => return None, // not a free region }; - let node_id = self.hir() - .as_local_node_id(suitable_region_binding_scope) + let hir_id = self.hir() + .as_local_hir_id(suitable_region_binding_scope) .unwrap(); - let is_impl_item = match self.hir().find(node_id) { + let is_impl_item = match self.hir().find_by_hir_id(hir_id) { Some(Node::Item(..)) | Some(Node::TraitItem(..)) => false, Some(Node::ImplItem(..)) => { self.is_bound_region_in_impl_item(suitable_region_binding_scope) @@ -1642,8 +1642,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { scope_def_id: DefId, ) -> Option> { // HACK: `type_of_def_id()` will fail on these (#55796), so return None - let node_id = self.hir().as_local_node_id(scope_def_id).unwrap(); - match self.hir().get(node_id) { + let hir_id = self.hir().as_local_hir_id(scope_def_id).unwrap(); + match self.hir().get_by_hir_id(hir_id) { Node::Item(item) => { match item.node { ItemKind::Fn(..) => { /* type_of_def_id() will work */ } diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index a649e312b434..356f9c32f03d 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -5,7 +5,7 @@ pub use self::IntVarValue::*; pub use self::fold::TypeFoldable; use crate::hir::{map as hir_map, FreevarMap, GlobMap, TraitMap}; -use crate::hir::Node; +use crate::hir::{HirId, Node}; use crate::hir::def::{Def, CtorKind, ExportMap}; use crate::hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use crate::hir::map::DefPathData; @@ -2726,8 +2726,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } pub fn opt_associated_item(self, def_id: DefId) -> Option { - let is_associated_item = if let Some(node_id) = self.hir().as_local_node_id(def_id) { - match self.hir().get(node_id) { + let is_associated_item = if let Some(hir_id) = self.hir().as_local_hir_id(def_id) { + match self.hir().get_by_hir_id(hir_id) { Node::TraitItem(_) | Node::ImplItem(_) => true, _ => false, } @@ -3048,10 +3048,10 @@ impl Iterator for AssociatedItemsIterator<'_, '_, '_> { } impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { - pub fn with_freevars(self, fid: NodeId, f: F) -> T where + pub fn with_freevars(self, fid: HirId, f: F) -> T where F: FnOnce(&[hir::Freevar]) -> T, { - let def_id = self.hir().local_def_id(fid); + let def_id = self.hir().local_def_id_from_hir_id(fid); match self.freevars(def_id) { None => f(&[]), Some(d) => f(&d), @@ -3163,8 +3163,8 @@ fn trait_of_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Option /// Yields the parent function's `DefId` if `def_id` is an `impl Trait` definition. pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option { - if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { - if let Node::Item(item) = tcx.hir().get(node_id) { + if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) { + if let Node::Item(item) = tcx.hir().get_by_hir_id(hir_id) { if let hir::ItemKind::Existential(ref exist_ty) = item.node { return exist_ty.impl_trait_fn; } diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index feca0f7170ef..49aa6b9e9568 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -313,7 +313,7 @@ impl<'tcx> QueryDescription<'tcx> for queries::erase_regions_ty<'tcx> { impl<'tcx> QueryDescription<'tcx> for queries::type_param_predicates<'tcx> { fn describe(tcx: TyCtxt<'_, '_, '_>, (_, def_id): (DefId, DefId)) -> Cow<'static, str> { - let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); format!("computing the bounds for type parameter `{}`", tcx.hir().ty_param_name(id)).into() } diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index cdc0c3371ebc..a1398c69ff0c 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -1380,10 +1380,10 @@ define_print! { write!(f, "[static generator")?; } - if let Some(node_id) = tcx.hir().as_local_node_id(did) { - write!(f, "@{:?}", tcx.hir().span(node_id))?; + if let Some(hir_id) = tcx.hir().as_local_hir_id(did) { + write!(f, "@{:?}", tcx.hir().span_by_hir_id(hir_id))?; let mut sep = " "; - tcx.with_freevars(node_id, |freevars| { + tcx.with_freevars(hir_id, |freevars| { for (freevar, upvar_ty) in freevars.iter().zip(upvar_tys) { print!(f, cx, write("{}{}:", @@ -1416,14 +1416,14 @@ define_print! { let upvar_tys = substs.upvar_tys(did, tcx); write!(f, "[closure")?; - if let Some(node_id) = tcx.hir().as_local_node_id(did) { + if let Some(hir_id) = tcx.hir().as_local_hir_id(did) { if tcx.sess.opts.debugging_opts.span_free_formats { - write!(f, "@{:?}", node_id)?; + write!(f, "@{:?}", hir_id)?; } else { - write!(f, "@{:?}", tcx.hir().span(node_id))?; + write!(f, "@{:?}", tcx.hir().span_by_hir_id(hir_id))?; } let mut sep = " "; - tcx.with_freevars(node_id, |freevars| { + tcx.with_freevars(hir_id, |freevars| { for (freevar, upvar_ty) in freevars.iter().zip(upvar_tys) { print!(f, cx, write("{}{}:", diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index bd854e3aa3c8..d2d5c4fe85c9 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -188,8 +188,8 @@ pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, let def_id = bccx.tcx.hir().body_owner_def_id(body.id()); - let node_id = bccx.tcx.hir().as_local_node_id(def_id).unwrap(); - let movable_generator = !match bccx.tcx.hir().get(node_id) { + let hir_id = bccx.tcx.hir().as_local_hir_id(def_id).unwrap(); + let movable_generator = !match bccx.tcx.hir().get_by_hir_id(hir_id) { Node::Expr(&hir::Expr { node: hir::ExprKind::Closure(.., Some(hir::GeneratorMovability::Static)), .. diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 6d0efb163b8f..da065f9e05d9 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -83,9 +83,9 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId) debug!("borrowck(body_owner_def_id={:?})", owner_def_id); - let owner_id = tcx.hir().as_local_node_id(owner_def_id).unwrap(); + let owner_id = tcx.hir().as_local_hir_id(owner_def_id).unwrap(); - match tcx.hir().get(owner_id) { + match tcx.hir().get_by_hir_id(owner_id) { Node::StructCtor(_) | Node::Variant(_) => { // We get invoked with anything that has MIR, but some of @@ -681,8 +681,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { Origin::Ast); let need_note = match lp.ty.sty { ty::Closure(id, _) => { - let node_id = self.tcx.hir().as_local_node_id(id).unwrap(); - let hir_id = self.tcx.hir().node_to_hir_id(node_id); + let hir_id = self.tcx.hir().as_local_hir_id(id).unwrap(); if let Some((span, name)) = self.tables.closure_kind_origins().get(hir_id) { err.span_note(*span, &format!( "closure cannot be invoked more than once because \ @@ -1253,12 +1252,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { } } Some(ImmutabilityBlame::AdtFieldDeref(_, field)) => { - let node_id = match self.tcx.hir().as_local_node_id(field.did) { - Some(node_id) => node_id, + let hir_id = match self.tcx.hir().as_local_hir_id(field.did) { + Some(hir_id) => hir_id, None => return }; - if let Node::Field(ref field) = self.tcx.hir().get(node_id) { + if let Node::Field(ref field) = self.tcx.hir().get_by_hir_id(hir_id) { if let Some(msg) = self.suggest_mut_for_immutable(&field.ty, false) { db.span_label(field.ty.span, msg); } diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index 4c88d4f0e63c..8c83e9ef538e 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -213,10 +213,10 @@ impl CodegenCx<'ll, 'tcx> { debug!("get_static: sym={} instance={:?}", sym, instance); - let g = if let Some(id) = self.tcx.hir().as_local_node_id(def_id) { + let g = if let Some(id) = self.tcx.hir().as_local_hir_id(def_id) { let llty = self.layout_of(ty).llvm_type(self); - let (g, attrs) = match self.tcx.hir().get(id) { + let (g, attrs) = match self.tcx.hir().get_by_hir_id(id) { Node::Item(&hir::Item { ref attrs, span, node: hir::ItemKind::Static(..), .. }) => { diff --git a/src/librustc_codegen_ssa/mono_item.rs b/src/librustc_codegen_ssa/mono_item.rs index bfb6a9153809..48159d797992 100644 --- a/src/librustc_codegen_ssa/mono_item.rs +++ b/src/librustc_codegen_ssa/mono_item.rs @@ -31,8 +31,8 @@ pub trait MonoItemExt<'a, 'tcx: 'a>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> { }; cx.codegen_static(def_id, is_mutable); } - MonoItem::GlobalAsm(node_id) => { - let item = cx.tcx().hir().expect_item(node_id); + MonoItem::GlobalAsm(hir_id) => { + let item = cx.tcx().hir().expect_item_by_hir_id(hir_id); if let hir::ItemKind::GlobalAsm(ref ga) = item.node { cx.codegen_global_asm(ga); } else { diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index 76e74e9e2b46..5de5c297c30e 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -242,7 +242,7 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance debug!("symbol_name(def_id={:?}, substs={:?})", def_id, substs); - let node_id = tcx.hir().as_local_node_id(def_id); + let hir_id = tcx.hir().as_local_hir_id(def_id); if def_id.is_local() { if tcx.plugin_registrar_fn(LOCAL_CRATE) == Some(def_id) { @@ -256,8 +256,8 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance } // FIXME(eddyb) Precompute a custom symbol name based on attributes. - let is_foreign = if let Some(id) = node_id { - match tcx.hir().get(id) { + let is_foreign = if let Some(id) = hir_id { + match tcx.hir().get_by_hir_id(id) { Node::ForeignItem(_) => true, _ => false, } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 641adec82cdd..1baa2db9dad7 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -458,8 +458,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { // If the trait is private, add the impl items to private_traits so they don't get // reported for missing docs. let real_trait = trait_ref.path.def.def_id(); - if let Some(node_id) = cx.tcx.hir().as_local_node_id(real_trait) { - match cx.tcx.hir().find(node_id) { + if let Some(hir_id) = cx.tcx.hir().as_local_hir_id(real_trait) { + match cx.tcx.hir().find_by_hir_id(hir_id) { Some(Node::Item(item)) => { if let hir::VisibilityKind::Inherited = item.vis.node { for impl_item_ref in impl_item_refs { diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index f79cfa3b773e..e27f314d6b86 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -779,8 +779,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { debug!("IsolatedEncoder::encode_info_for_trait_item({:?})", def_id); let tcx = self.tcx; - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let ast_item = tcx.hir().expect_trait_item(node_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let ast_item = tcx.hir().expect_trait_item_by_hir_id(hir_id); let trait_item = tcx.associated_item(def_id); let container = match trait_item.defaultness { @@ -889,8 +889,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { debug!("IsolatedEncoder::encode_info_for_impl_item({:?})", def_id); let tcx = self.tcx; - let node_id = self.tcx.hir().as_local_node_id(def_id).unwrap(); - let ast_item = self.tcx.hir().expect_impl_item(node_id); + let hir_id = self.tcx.hir().as_local_hir_id(def_id).unwrap(); + let ast_item = self.tcx.hir().expect_impl_item_by_hir_id(hir_id); let impl_item = self.tcx.associated_item(def_id); let container = match impl_item.defaultness { @@ -1360,8 +1360,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { let tcx = self.tcx; let tables = self.tcx.typeck_tables_of(def_id); - let node_id = self.tcx.hir().as_local_node_id(def_id).unwrap(); - let hir_id = self.tcx.hir().node_to_hir_id(node_id); + let hir_id = self.tcx.hir().as_local_hir_id(def_id).unwrap(); let kind = match tables.node_type(hir_id).sty { ty::Generator(def_id, ..) => { let layout = self.tcx.generator_layout(def_id); @@ -1403,7 +1402,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { fn encode_info_for_anon_const(&mut self, def_id: DefId) -> Entry<'tcx> { debug!("IsolatedEncoder::encode_info_for_anon_const({:?})", def_id); let tcx = self.tcx; - let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); let body_id = tcx.hir().body_owned_by(id); let const_data = self.encode_rendered_const_for_body(body_id); let mir = tcx.mir_const_qualif(def_id).0; diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index dc1979b6380b..fe07cc0698a0 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -191,8 +191,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let needs_note = match ty.sty { ty::Closure(id, _) => { let tables = self.infcx.tcx.typeck_tables_of(id); - let node_id = self.infcx.tcx.hir().as_local_node_id(id).unwrap(); - let hir_id = self.infcx.tcx.hir().node_to_hir_id(node_id); + let hir_id = self.infcx.tcx.hir().as_local_hir_id(id).unwrap(); tables.closure_kind_origins().get(hir_id).is_none() } @@ -1525,8 +1524,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { debug!("add_moved_or_invoked_closure_note: closure={:?}", closure); if let ty::TyKind::Closure(did, _) = self.mir.local_decls[closure].ty.sty { - let node_id = self.infcx.tcx.hir().as_local_node_id(did).unwrap(); - let hir_id = self.infcx.tcx.hir().node_to_hir_id(node_id); + let hir_id = self.infcx.tcx.hir().as_local_hir_id(did).unwrap(); if let Some((span, name)) = self.infcx.tcx.typeck_tables_of(did) .closure_kind_origins() @@ -1549,8 +1547,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // Check if we are just moving a closure after it has been invoked. if let Some(target) = target { if let ty::TyKind::Closure(did, _) = self.mir.local_decls[target].ty.sty { - let node_id = self.infcx.tcx.hir().as_local_node_id(did).unwrap(); - let hir_id = self.infcx.tcx.hir().node_to_hir_id(node_id); + let hir_id = self.infcx.tcx.hir().as_local_hir_id(did).unwrap(); if let Some((span, name)) = self.infcx.tcx.typeck_tables_of(did) .closure_kind_origins() @@ -1790,10 +1787,10 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // the local code in the current crate, so this returns an `Option` in case // the closure comes from another crate. But in that case we wouldn't // be borrowck'ing it, so we can just unwrap: - let node_id = self.infcx.tcx.hir().as_local_node_id(def_id).unwrap(); + let hir_id = self.infcx.tcx.hir().as_local_hir_id(def_id).unwrap(); let freevar = self.infcx .tcx - .with_freevars(node_id, |fv| fv[field.index()]); + .with_freevars(hir_id, |fv| fv[field.index()]); self.infcx.tcx.hir().name(freevar.var_id()).to_string() } @@ -2105,8 +2102,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { ) -> Option> { debug!("annotate_fn_sig: did={:?} sig={:?}", did, sig); let is_closure = self.infcx.tcx.is_closure(did); - let fn_node_id = self.infcx.tcx.hir().as_local_node_id(did)?; - let fn_decl = self.infcx.tcx.hir().fn_decl(fn_node_id)?; + let fn_hir_id = self.infcx.tcx.hir().as_local_hir_id(did)?; + let fn_decl = self.infcx.tcx.hir().fn_decl_by_hir_id(fn_hir_id)?; // We need to work out which arguments to highlight. We do this by looking // at the return type, where there are three cases: @@ -2560,14 +2557,14 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { "closure_span: def_id={:?} target_place={:?} places={:?}", def_id, target_place, places ); - let node_id = self.infcx.tcx.hir().as_local_node_id(def_id)?; - let expr = &self.infcx.tcx.hir().expect_expr(node_id).node; - debug!("closure_span: node_id={:?} expr={:?}", node_id, expr); + let hir_id = self.infcx.tcx.hir().as_local_hir_id(def_id)?; + let expr = &self.infcx.tcx.hir().expect_expr_by_hir_id(hir_id).node; + debug!("closure_span: hir_id={:?} expr={:?}", hir_id, expr); if let hir::ExprKind::Closure( .., args_span, _ ) = expr { let var_span = self.infcx.tcx.with_freevars( - node_id, + hir_id, |freevars| { for (v, place) in freevars.iter().zip(places) { match place { diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 715ee856a7a6..d5dfdf0add52 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -128,7 +128,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( let param_env = tcx.param_env(def_id); let id = tcx .hir() - .as_local_node_id(def_id) + .as_local_hir_id(def_id) .expect("do_mir_borrowck: non-local DefId"); // Replace all regions with fresh inference variables. This @@ -163,7 +163,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( |bd, i| DebugFormatted::new(&bd.move_data().move_paths[i]), )); - let locals_are_invalidated_at_exit = tcx.hir().body_owner_kind(id).is_fn_or_closure(); + let locals_are_invalidated_at_exit = tcx.hir().body_owner_kind_by_hir_id(id).is_fn_or_closure(); let borrow_set = Rc::new(BorrowSet::build( tcx, mir, locals_are_invalidated_at_exit, &mdpe.move_data)); @@ -216,7 +216,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( |bd, i| DebugFormatted::new(&bd.move_data().inits[i]), )); - let movable_generator = match tcx.hir().get(id) { + let movable_generator = match tcx.hir().get_by_hir_id(id) { Node::Expr(&hir::Expr { node: hir::ExprKind::Closure(.., Some(hir::GeneratorMovability::Static)), .. diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index f68ed4422bca..66f47d719b4d 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -635,8 +635,8 @@ fn annotate_struct_field( if let ty::TyKind::Adt(def, _) = ty.sty { let field = def.all_fields().nth(field.index())?; // Use the HIR types to construct the diagnostic message. - let node_id = tcx.hir().as_local_node_id(field.did)?; - let node = tcx.hir().find(node_id)?; + let hir_id = tcx.hir().as_local_hir_id(field.did)?; + let node = tcx.hir().find_by_hir_id(hir_id)?; // Now we're dealing with the actual struct that we're going to suggest a change to, // we can expect a field that is an immutable reference to a type. if let hir::Node::Field(field) = node { diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 61ead366a87c..8bebeae8f2eb 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -28,10 +28,10 @@ use super::lints; /// Construct the MIR for a given `DefId`. pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'tcx> { - let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); // Figure out what primary body this item has. - let (body_id, return_ty_span) = match tcx.hir().get(id) { + let (body_id, return_ty_span) = match tcx.hir().get_by_hir_id(id) { Node::Variant(variant) => return create_constructor_shim(tcx, id, &variant.node.data), Node::StructCtor(ctor) => @@ -68,19 +68,18 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t (*body, tcx.hir().span_by_hir_id(*hir_id)) } - _ => span_bug!(tcx.hir().span(id), "can't build MIR for {:?}", def_id), + _ => span_bug!(tcx.hir().span_by_hir_id(id), "can't build MIR for {:?}", def_id), }; tcx.infer_ctxt().enter(|infcx| { - let fn_hir_id = tcx.hir().node_to_hir_id(id); - let cx = Cx::new(&infcx, fn_hir_id); + let cx = Cx::new(&infcx, id); let mut mir = if cx.tables().tainted_by_errors { build::construct_error(cx, body_id) } else if cx.body_owner_kind.is_fn_or_closure() { // fetch the fully liberated fn signature (that is, all bound // types/lifetimes replaced) - let fn_sig = cx.tables().liberated_fn_sigs()[fn_hir_id].clone(); - let fn_def_id = tcx.hir().local_def_id(id); + let fn_sig = cx.tables().liberated_fn_sigs()[id].clone(); + let fn_def_id = tcx.hir().local_def_id_from_hir_id(id); let ty = tcx.type_of(fn_def_id); let mut abi = fn_sig.abi; @@ -92,7 +91,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t Some(ArgInfo(liberated_closure_env_ty(tcx, id, body_id), None, None, None)) } ty::Generator(..) => { - let gen_ty = tcx.body_tables(body_id).node_type(fn_hir_id); + let gen_ty = tcx.body_tables(body_id).node_type(id); Some(ArgInfo(gen_ty, None, None, None)) } _ => None, @@ -141,7 +140,8 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t ty::Generator(gen_def_id, gen_substs, ..) => gen_substs.sig(gen_def_id, tcx), _ => - span_bug!(tcx.hir().span(id), "generator w/o generator type: {:?}", ty), + span_bug!(tcx.hir().span_by_hir_id(id), + "generator w/o generator type: {:?}", ty), }; (Some(gen_sig.yield_ty), gen_sig.return_ty) } else { @@ -224,11 +224,11 @@ impl<'a, 'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'a, 'gcx> { } fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - ctor_id: ast::NodeId, + ctor_id: hir::HirId, v: &'tcx hir::VariantData) -> Mir<'tcx> { - let span = tcx.hir().span(ctor_id); + let span = tcx.hir().span_by_hir_id(ctor_id); if let hir::VariantData::Tuple(ref fields, ctor_id) = *v { tcx.infer_ctxt().enter(|infcx| { let mut mir = shim::build_adt_ctor(&infcx, ctor_id, fields, span); @@ -259,11 +259,10 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // BuildMir -- walks a crate, looking for fn items and methods to build MIR from fn liberated_closure_env_ty<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, - closure_expr_id: ast::NodeId, + closure_expr_id: hir::HirId, body_id: hir::BodyId) -> Ty<'tcx> { - let closure_expr_hir_id = tcx.hir().node_to_hir_id(closure_expr_id); - let closure_ty = tcx.body_tables(body_id).node_type(closure_expr_hir_id); + let closure_ty = tcx.body_tables(body_id).node_type(closure_expr_id); let (closure_def_id, closure_substs) = match closure_ty.sty { ty::Closure(closure_def_id, closure_substs) => (closure_def_id, closure_substs), @@ -606,7 +605,7 @@ struct ArgInfo<'gcx>(Ty<'gcx>, Option); fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, - fn_id: ast::NodeId, + fn_id: hir::HirId, arguments: A, safety: Safety, abi: Abi, @@ -621,10 +620,10 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, let tcx = hir.tcx(); let tcx_hir = tcx.hir(); - let span = tcx_hir.span(fn_id); + let span = tcx_hir.span_by_hir_id(fn_id); let hir_tables = hir.tables(); - let fn_def_id = tcx_hir.local_def_id(fn_id); + let fn_def_id = tcx_hir.local_def_id_from_hir_id(fn_id); // Gather the upvars of a closure, if any. // In analyze_closure() in upvar.rs we gathered a list of upvars used by a @@ -718,9 +717,8 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, // RustCall pseudo-ABI untuples the last argument. spread_arg = Some(Local::new(arguments.len())); } - let closure_expr_id = tcx_hir.local_def_id(fn_id); - info!("fn_id {:?} has attrs {:?}", closure_expr_id, - tcx.get_attrs(closure_expr_id)); + info!("fn_id {:?} has attrs {:?}", fn_def_id, + tcx.get_attrs(fn_def_id)); let mut mir = builder.finish(yield_ty); mir.spread_arg = spread_arg; diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index 35ca13891876..3f5d82e5f091 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -617,7 +617,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>( let cid = key.value; let def_id = cid.instance.def.def_id(); - if let Some(id) = tcx.hir().as_local_node_id(def_id) { + if let Some(id) = tcx.hir().as_local_hir_id(def_id) { let tables = tcx.typeck_tables_of(def_id); // Do match-check before building MIR @@ -625,7 +625,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>( return Err(ErrorHandled::Reported) } - if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind(id) { + if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind_by_hir_id(id) { tcx.mir_const_qualif(def_id); } diff --git a/src/librustc_mir/dataflow/graphviz.rs b/src/librustc_mir/dataflow/graphviz.rs index c7f6983be619..da9cc118f552 100644 --- a/src/librustc_mir/dataflow/graphviz.rs +++ b/src/librustc_mir/dataflow/graphviz.rs @@ -1,6 +1,6 @@ //! Hook into libgraphviz for rendering dataflow graphs for MIR. -use syntax::ast::NodeId; +use rustc::hir::HirId; use rustc::mir::{BasicBlock, Mir}; use std::fs; @@ -14,7 +14,7 @@ use super::DebugFormatted; pub trait MirWithFlowState<'tcx> { type BD: BitDenotation<'tcx>; - fn node_id(&self) -> NodeId; + fn hir_id(&self) -> HirId; fn mir(&self) -> &Mir<'tcx>; fn flow_state(&self) -> &DataflowState<'tcx, Self::BD>; } @@ -23,7 +23,7 @@ impl<'a, 'tcx, BD> MirWithFlowState<'tcx> for DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation<'tcx> { type BD = BD; - fn node_id(&self) -> NodeId { self.node_id } + fn hir_id(&self) -> HirId { self.hir_id } fn mir(&self) -> &Mir<'tcx> { self.flow_state.mir() } fn flow_state(&self) -> &DataflowState<'tcx, Self::BD> { &self.flow_state.flow_state } } @@ -47,8 +47,8 @@ pub(crate) fn print_borrowck_graph_to<'a, 'tcx, BD, P>( let g = Graph { mbcx, phantom: PhantomData, render_idx }; let mut v = Vec::new(); dot::render(&g, &mut v)?; - debug!("print_borrowck_graph_to path: {} node_id: {}", - path.display(), mbcx.node_id); + debug!("print_borrowck_graph_to path: {} hir_id: {}", + path.display(), mbcx.hir_id); fs::write(path, v) } @@ -70,7 +70,7 @@ impl<'a, 'tcx, MWF, P> dot::Labeller<'a> for Graph<'a, 'tcx, MWF, P> type Edge = Edge; fn graph_id(&self) -> dot::Id<'_> { dot::Id::new(format!("graph_for_node_{}", - self.mbcx.node_id())) + self.mbcx.hir_id())) .unwrap() } diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index c24a776605cb..03f8ac674361 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -4,6 +4,7 @@ use rustc_data_structures::bit_set::{BitSet, BitSetOperator, HybridBitSet}; use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::work_queue::WorkQueue; +use rustc::hir::HirId; use rustc::ty::{self, TyCtxt}; use rustc::mir::{self, Mir, BasicBlock, BasicBlockData, Location, Statement, Terminator}; use rustc::mir::traversal; @@ -38,7 +39,7 @@ pub(crate) struct DataflowBuilder<'a, 'tcx: 'a, BD> where BD: BitDenotation<'tcx> { - node_id: ast::NodeId, + hir_id: HirId, flow_state: DataflowAnalysis<'a, 'tcx, BD>, print_preflow_to: Option, print_postflow_to: Option, @@ -116,7 +117,7 @@ pub struct MoveDataParamEnv<'gcx, 'tcx> { pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'a, 'gcx, 'tcx>, mir: &'a Mir<'tcx>, - node_id: ast::NodeId, + hir_id: HirId, attributes: &[ast::Attribute], dead_unwinds: &BitSet, bd: BD, @@ -126,14 +127,14 @@ pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'a, 'gcx, 'tcx>, P: Fn(&BD, BD::Idx) -> DebugFormatted { let flow_state = DataflowAnalysis::new(mir, dead_unwinds, bd); - flow_state.run(tcx, node_id, attributes, p) + flow_state.run(tcx, hir_id, attributes, p) } impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx> { pub(crate) fn run

(self, tcx: TyCtxt<'a, 'gcx, 'tcx>, - node_id: ast::NodeId, + hir_id: HirId, attributes: &[ast::Attribute], p: P) -> DataflowResults<'tcx, BD> where P: Fn(&BD, BD::Idx) -> DebugFormatted @@ -158,7 +159,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitD name_found(tcx.sess, attributes, "borrowck_graphviz_postflow"); let mut mbcx = DataflowBuilder { - node_id, + hir_id, print_preflow_to, print_postflow_to, flow_state: self, }; diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index e70756ad2f25..4e3702b478b3 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -530,8 +530,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, span_bug!(expr.span, "closure expr w/o closure type: {:?}", closure_ty); } }; - let expr_node_id = cx.tcx.hir().hir_to_node_id(expr.hir_id); - let upvars = cx.tcx.with_freevars(expr_node_id, |freevars| { + let upvars = cx.tcx.with_freevars(expr.hir_id, |freevars| { freevars.iter() .zip(substs.upvar_tys(def_id, cx.tcx)) .map(|(fv, ty)| capture_freevar(cx, expr, fv, ty)) diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 9af513a90905..c8fb4f99d018 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -38,7 +38,7 @@ pub(crate) fn check_match<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, ) -> Result<(), ErrorReported> { - let body_id = if let Some(id) = tcx.hir().as_local_node_id(def_id) { + let body_id = if let Some(id) = tcx.hir().as_local_hir_id(def_id) { tcx.hir().body_owned_by(id) } else { return Ok(()); diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index bfc977c28cd3..6d6a3f914726 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -10,9 +10,9 @@ use rustc::ty::subst::InternalSubsts; pub fn check(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &Mir<'tcx>, def_id: DefId) { - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); - if let Some(fn_like_node) = FnLikeNode::from_node(tcx.hir().get(node_id)) { + if let Some(fn_like_node) = FnLikeNode::from_node(tcx.hir().get_by_hir_id(hir_id)) { check_fn_for_unconditional_recursion(tcx, fn_like_node.kind(), mir, def_id); } } diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 4350bfcdc7a9..1e245faddf04 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -976,8 +976,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { debug!("RootCollector: ItemKind::GlobalAsm({})", def_id_to_string(self.tcx, self.tcx.hir().local_def_id_from_hir_id(item.hir_id))); - let node_id = self.tcx.hir().hir_to_node_id(item.hir_id); - self.output.push(MonoItem::GlobalAsm(node_id)); + self.output.push(MonoItem::GlobalAsm(item.hir_id)); } hir::ItemKind::Static(..) => { let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index f0d19ec8bf2f..211f9ad1735c 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -58,8 +58,8 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { MonoItem::Static(def_id) => { tcx.symbol_name(Instance::mono(tcx, def_id)) } - MonoItem::GlobalAsm(node_id) => { - let def_id = tcx.hir().local_def_id(node_id); + MonoItem::GlobalAsm(hir_id) => { + let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); ty::SymbolName { name: Symbol::intern(&format!("global_asm_{:?}", def_id)).as_interned_str() } @@ -190,15 +190,15 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { fn local_span(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option { match *self.as_mono_item() { MonoItem::Fn(Instance { def, .. }) => { - tcx.hir().as_local_node_id(def.def_id()) + tcx.hir().as_local_hir_id(def.def_id()) } MonoItem::Static(def_id) => { - tcx.hir().as_local_node_id(def_id) + tcx.hir().as_local_hir_id(def_id) } - MonoItem::GlobalAsm(node_id) => { - Some(node_id) + MonoItem::GlobalAsm(hir_id) => { + Some(hir_id) } - }.map(|node_id| tcx.hir().span(node_id)) + }.map(|hir_id| tcx.hir().span_by_hir_id(hir_id)) } } diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index f98bc476aafe..c0e2186d9f34 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -96,10 +96,9 @@ use std::collections::hash_map::Entry; use std::cmp; use std::sync::Arc; -use syntax::ast::NodeId; use syntax::symbol::InternedString; use rustc::dep_graph::{WorkProductId, WorkProduct, DepNode, DepConstructor}; -use rustc::hir::CodegenFnAttrFlags; +use rustc::hir::{CodegenFnAttrFlags, HirId}; use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE, CRATE_DEF_INDEX}; use rustc::hir::map::DefPathData; use rustc::mir::mono::{Linkage, Visibility, CodegenUnitNameBuilder}; @@ -162,19 +161,19 @@ pub trait CodegenUnitExt<'tcx> { // The codegen tests rely on items being process in the same order as // they appear in the file, so for local items, we sort by node_id first #[derive(PartialEq, Eq, PartialOrd, Ord)] - pub struct ItemSortKey(Option, ty::SymbolName); + pub struct ItemSortKey(Option, ty::SymbolName); fn item_sort_key<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: MonoItem<'tcx>) -> ItemSortKey { ItemSortKey(match item { MonoItem::Fn(ref instance) => { match instance.def { - // We only want to take NodeIds of user-defined + // We only want to take HirIds of user-defined // instances into account. The others don't matter for // the codegen tests and can even make item order // unstable. InstanceDef::Item(def_id) => { - tcx.hir().as_local_node_id(def_id) + tcx.hir().as_local_hir_id(def_id) } InstanceDef::VtableShim(..) | InstanceDef::Intrinsic(..) | @@ -188,10 +187,10 @@ pub trait CodegenUnitExt<'tcx> { } } MonoItem::Static(def_id) => { - tcx.hir().as_local_node_id(def_id) + tcx.hir().as_local_hir_id(def_id) } - MonoItem::GlobalAsm(node_id) => { - Some(node_id) + MonoItem::GlobalAsm(hir_id) => { + Some(hir_id) } }, item.symbol_name(tcx)) } @@ -404,8 +403,8 @@ fn mono_item_visibility( Visibility::Hidden }; } - MonoItem::GlobalAsm(node_id) => { - let def_id = tcx.hir().local_def_id(*node_id); + MonoItem::GlobalAsm(hir_id) => { + let def_id = tcx.hir().local_def_id_from_hir_id(*hir_id); return if tcx.is_reachable_non_generic(def_id) { *can_be_internalized = false; default_visibility(tcx, def_id, false) @@ -789,7 +788,7 @@ fn characteristic_def_id_of_mono_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, Some(def_id) } MonoItem::Static(def_id) => Some(def_id), - MonoItem::GlobalAsm(node_id) => Some(tcx.hir().local_def_id(node_id)), + MonoItem::GlobalAsm(hir_id) => Some(tcx.hir().local_def_id_from_hir_id(hir_id)), } } diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 047731e3fe6a..b494592c89f4 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -533,8 +533,8 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) let param_env = tcx.param_env(def_id); - let id = tcx.hir().as_local_node_id(def_id).unwrap(); - let (const_context, min_const_fn) = match tcx.hir().body_owner_kind(id) { + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let (const_context, min_const_fn) = match tcx.hir().body_owner_kind_by_hir_id(id) { hir::BodyOwnerKind::Closure => (false, false), hir::BodyOwnerKind::Fn => (tcx.is_const_fn(def_id), tcx.is_min_const_fn(def_id)), hir::BodyOwnerKind::Const | diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 9febe6af5b1f..23d8138efcca 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -37,10 +37,10 @@ impl MirPass for ConstProp { } use rustc::hir::map::blocks::FnLikeNode; - let node_id = tcx.hir().as_local_node_id(source.def_id()) - .expect("Non-local call to local provider is_const_fn"); + let hir_id = tcx.hir().as_local_hir_id(source.def_id()) + .expect("Non-local call to local provider is_const_fn"); - let is_fn_like = FnLikeNode::from_node(tcx.hir().get(node_id)).is_some(); + let is_fn_like = FnLikeNode::from_node(tcx.hir().get_by_hir_id(hir_id)).is_some(); let is_assoc_const = match tcx.describe_def(source.def_id()) { Some(Def::AssociatedConst(_)) => true, _ => false, diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 74175d0149ff..32c027d90a0c 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -11,11 +11,11 @@ use crate::util::elaborate_drops::{DropFlagState, Unwind, elaborate_drop}; use crate::util::elaborate_drops::{DropElaborator, DropStyle, DropFlagMode}; use rustc::ty::{self, TyCtxt}; use rustc::ty::layout::VariantIdx; +use rustc::hir; use rustc::mir::*; use rustc::util::nodemap::FxHashMap; use rustc_data_structures::bit_set::BitSet; use std::fmt; -use syntax::ast; use syntax_pos::Span; pub struct ElaborateDrops; @@ -28,7 +28,7 @@ impl MirPass for ElaborateDrops { { debug!("elaborate_drops({:?} @ {:?})", src, mir.span); - let id = tcx.hir().as_local_node_id(src.def_id()).unwrap(); + let id = tcx.hir().as_local_hir_id(src.def_id()).unwrap(); let param_env = tcx.param_env(src.def_id()).with_reveal_all(); let move_data = match MoveData::gather_moves(mir, tcx) { Ok(move_data) => move_data, @@ -80,7 +80,7 @@ impl MirPass for ElaborateDrops { fn find_dead_unwinds<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &Mir<'tcx>, - id: ast::NodeId, + id: hir::HirId, env: &MoveDataParamEnv<'tcx, 'tcx>) -> BitSet { diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 6a71b5815282..1f59802f8c6c 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -383,13 +383,13 @@ fn locals_live_across_suspend_points( FxHashMap, ) { let dead_unwinds = BitSet::new_empty(mir.basic_blocks().len()); - let node_id = tcx.hir().as_local_node_id(source.def_id()).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(source.def_id()).unwrap(); // Calculate when MIR locals have live storage. This gives us an upper bound of their // lifetimes. let storage_live_analysis = MaybeStorageLive::new(mir); let storage_live = - do_dataflow(tcx, mir, node_id, &[], &dead_unwinds, storage_live_analysis, + do_dataflow(tcx, mir, hir_id, &[], &dead_unwinds, storage_live_analysis, |bd, p| DebugFormatted::new(&bd.mir().local_decls[p])); // Find the MIR locals which do not use StorageLive/StorageDead statements. @@ -403,7 +403,7 @@ fn locals_live_across_suspend_points( let borrowed_locals = if !movable { let analysis = HaveBeenBorrowedLocals::new(mir); let result = - do_dataflow(tcx, mir, node_id, &[], &dead_unwinds, analysis, + do_dataflow(tcx, mir, hir_id, &[], &dead_unwinds, analysis, |bd, p| DebugFormatted::new(&bd.mir().local_decls[p])); Some((analysis, result)) } else { diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 918375e426b7..234483df13ad 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -72,8 +72,10 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { let param_env = self.tcx.param_env(self.source.def_id()); // Only do inlining into fn bodies. - let id = self.tcx.hir().as_local_node_id(self.source.def_id()).unwrap(); - if self.tcx.hir().body_owner_kind(id).is_fn_or_closure() && self.source.promoted.is_none() { + let id = self.tcx.hir().as_local_hir_id(self.source.def_id()).unwrap(); + if self.tcx.hir().body_owner_kind_by_hir_id(id).is_fn_or_closure() + && self.source.promoted.is_none() + { for (bb, bb_data) in caller_mir.basic_blocks().iter_enumerated() { if let Some(callsite) = self.get_valid_function_call(bb, bb_data, diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index 8f5fc6963771..0cd2cecf39c0 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -214,8 +214,8 @@ fn mir_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Stea } fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind(node_id) { + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind_by_hir_id(hir_id) { // Ensure that we compute the `mir_const_qualif` for constants at // this point, before we steal the mir-const result. let _ = tcx.mir_const_qualif(def_id); diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index a44ec526f9dd..f078316b97ce 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -3,6 +3,7 @@ use syntax::ast; use syntax_pos::Span; use rustc::ty::{self, TyCtxt}; +use rustc::hir; use rustc::mir::{self, Mir, Location}; use rustc_data_structures::bit_set::BitSet; use crate::transform::{MirPass, MirSource}; @@ -26,7 +27,7 @@ impl MirPass for SanityCheck { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource<'tcx>, mir: &mut Mir<'tcx>) { let def_id = src.def_id(); - let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); if !tcx.has_attr(def_id, "rustc_mir") { debug!("skipping rustc_peek::SanityCheck on {}", tcx.item_path_str(def_id)); return; @@ -85,7 +86,7 @@ impl MirPass for SanityCheck { /// errors are not intended to be used for unit tests.) pub fn sanity_check_via_rustc_peek<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &Mir<'tcx>, - id: ast::NodeId, + id: hir::HirId, _attributes: &[ast::Attribute], results: &DataflowResults<'tcx, O>) where O: BitDenotation<'tcx, Idx=MovePathIndex> + HasMoveData<'tcx> diff --git a/src/librustc_mir/util/graphviz.rs b/src/librustc_mir/util/graphviz.rs index 5d495fc04588..61b1a5a850d2 100644 --- a/src/librustc_mir/util/graphviz.rs +++ b/src/librustc_mir/util/graphviz.rs @@ -27,7 +27,7 @@ pub fn write_mir_fn_graphviz<'tcx, W>(tcx: TyCtxt<'_, '_, 'tcx>, w: &mut W) -> io::Result<()> where W: Write { - writeln!(w, "digraph Mir_{} {{", tcx.hir().as_local_node_id(def_id).unwrap())?; + writeln!(w, "digraph Mir_{} {{", tcx.hir().as_local_hir_id(def_id).unwrap())?; // Global graph properties writeln!(w, r#" graph [fontname="monospace"];"#)?; diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index 9cda6cfdacbe..d08fb40966c4 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -282,7 +282,7 @@ fn dump_matched_mir_node<'a, 'tcx>( ) { let mut file_path = PathBuf::new(); file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir)); - let item_id = tcx.hir().as_local_node_id(source.def_id()).unwrap(); + let item_id = tcx.hir().as_local_hir_id(source.def_id()).unwrap(); let file_name = format!("rustc.node{}{}-liveness.mir", item_id, pass_name); file_path.push(&file_name); let _ = fs::File::create(&file_path).and_then(|mut file| { diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index edd658254467..af01e38cb543 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -52,9 +52,9 @@ fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, { assert!(def_id.is_local()); - let node_id = tcx.hir().as_local_node_id(def_id) + let hir_id = tcx.hir().as_local_hir_id(def_id) .expect("rvalue_promotable_map invoked with non-local def-id"); - let body_id = tcx.hir().body_owned_by(node_id); + let body_id = tcx.hir().body_owned_by(hir_id); tcx.rvalue_promotable_map(def_id).contains(&body_id.hir_id.local_id) } @@ -79,9 +79,9 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }; // `def_id` should be a `Body` owner - let node_id = tcx.hir().as_local_node_id(def_id) + let hir_id = tcx.hir().as_local_hir_id(def_id) .expect("rvalue_promotable_map invoked with non-local def-id"); - let body_id = tcx.hir().body_owned_by(node_id); + let body_id = tcx.hir().body_owned_by(hir_id); let _ = visitor.check_nested_body(body_id); Lrc::new(visitor.result) @@ -455,10 +455,9 @@ fn check_expr_kind<'a, 'tcx>( hir::ExprKind::Closure(_capture_clause, ref _box_fn_decl, body_id, _span, _option_generator_movability) => { let nested_body_promotable = v.check_nested_body(body_id); - let node_id = v.tcx.hir().hir_to_node_id(e.hir_id); // Paths in constant contexts cannot refer to local variables, // as there are none, and thus closures can't have upvars there. - if v.tcx.with_freevars(node_id, |fv| !fv.is_empty()) { + if v.tcx.with_freevars(e.hir_id, |fv| !fv.is_empty()) { NotPromotable } else { nested_body_promotable diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index a9f05eb60db1..d07e89209e7f 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1182,10 +1182,10 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { // A path can only be private if: // it's in this crate... - if let Some(node_id) = self.tcx.hir().as_local_node_id(did) { + if let Some(hir_id) = self.tcx.hir().as_local_hir_id(did) { // .. and it corresponds to a private type in the AST (this returns // `None` for type parameters). - match self.tcx.hir().find(node_id) { + match self.tcx.hir().find_by_hir_id(hir_id) { Some(Node::Item(ref item)) => !item.vis.node.is_pub(), Some(_) | None => false, } diff --git a/src/librustc_traits/lowering/environment.rs b/src/librustc_traits/lowering/environment.rs index 962a145814c8..c908c6993e19 100644 --- a/src/librustc_traits/lowering/environment.rs +++ b/src/librustc_traits/lowering/environment.rs @@ -213,8 +213,8 @@ crate fn environment<'a, 'tcx>( // could bound lifetimes. .map(Clause::ForAll); - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let node = tcx.hir().get(node_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let node = tcx.hir().get_by_hir_id(hir_id); enum NodeKind { TraitImpl, diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index be708c78a0dd..89ec92a65216 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1223,8 +1223,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let suitable_bounds = traits::transitive_bounds(tcx, bounds) .filter(|b| self.trait_defines_associated_type_named(b.def_id(), assoc_name)); - let param_node_id = tcx.hir().as_local_node_id(ty_param_def_id).unwrap(); - let param_name = tcx.hir().ty_param_name(param_node_id); + let param_hir_id = tcx.hir().as_local_hir_id(ty_param_def_id).unwrap(); + let param_name = tcx.hir().ty_param_name(param_hir_id); self.one_bound_for_assoc_type(suitable_bounds, ¶m_name.as_str(), assoc_name, diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 64f61d5e5232..6f3cd56c7bf5 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -712,9 +712,9 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { let b = self.shallow_resolve(b); - let node_id_a = self.tcx.hir().as_local_node_id(def_id_a).unwrap(); + let hir_id_a = self.tcx.hir().as_local_hir_id(def_id_a).unwrap(); match b.sty { - ty::FnPtr(_) if self.tcx.with_freevars(node_id_a, |v| v.is_empty()) => { + ty::FnPtr(_) if self.tcx.with_freevars(hir_id_a, |v| v.is_empty()) => { // We coerce the closure, which has fn type // `extern "rust-call" fn((arg0,arg1,...)) -> _` // to diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 32640d7d9a88..292455e9d51c 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -83,8 +83,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // This node-id should be used for the `body_id` field on each // `ObligationCause` (and the `FnCtxt`). This is what // `regionck_item` expects. - let impl_m_node_id = tcx.hir().as_local_node_id(impl_m.def_id).unwrap(); - let impl_m_hir_id = tcx.hir().node_to_hir_id(impl_m_node_id); + let impl_m_hir_id = tcx.hir().as_local_hir_id(impl_m.def_id).unwrap(); let cause = ObligationCause { span: impl_m_span, @@ -416,8 +415,10 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a trait_sig: ty::FnSig<'tcx>) -> (Span, Option) { let tcx = infcx.tcx; - let impl_m_node_id = tcx.hir().as_local_node_id(impl_m.def_id).unwrap(); - let (impl_m_output, impl_m_iter) = match tcx.hir().expect_impl_item(impl_m_node_id).node { + let impl_m_hir_id = tcx.hir().as_local_hir_id(impl_m.def_id).unwrap(); + let (impl_m_output, impl_m_iter) = match tcx.hir() + .expect_impl_item_by_hir_id(impl_m_hir_id) + .node { ImplItemKind::Method(ref impl_m_sig, _) => { (&impl_m_sig.decl.output, impl_m_sig.decl.inputs.iter()) } @@ -426,8 +427,10 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a match *terr { TypeError::Mutability => { - if let Some(trait_m_node_id) = tcx.hir().as_local_node_id(trait_m.def_id) { - let trait_m_iter = match tcx.hir().expect_trait_item(trait_m_node_id).node { + if let Some(trait_m_hir_id) = tcx.hir().as_local_hir_id(trait_m.def_id) { + let trait_m_iter = match tcx.hir() + .expect_trait_item_by_hir_id(trait_m_hir_id) + .node { TraitItemKind::Method(ref trait_m_sig, _) => { trait_m_sig.decl.inputs.iter() } @@ -451,9 +454,9 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a } } TypeError::Sorts(ExpectedFound { .. }) => { - if let Some(trait_m_node_id) = tcx.hir().as_local_node_id(trait_m.def_id) { + if let Some(trait_m_hir_id) = tcx.hir().as_local_hir_id(trait_m.def_id) { let (trait_m_output, trait_m_iter) = - match tcx.hir().expect_trait_item(trait_m_node_id).node { + match tcx.hir().expect_trait_item_by_hir_id(trait_m_hir_id).node { TraitItemKind::Method(ref trait_m_sig, _) => { (&trait_m_sig.decl.output, trait_m_sig.decl.inputs.iter()) } @@ -661,9 +664,9 @@ fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let trait_number_args = trait_m_fty.inputs().skip_binder().len(); let impl_number_args = impl_m_fty.inputs().skip_binder().len(); if trait_number_args != impl_number_args { - let trait_m_node_id = tcx.hir().as_local_node_id(trait_m.def_id); - let trait_span = if let Some(trait_id) = trait_m_node_id { - match tcx.hir().expect_trait_item(trait_id).node { + let trait_m_hir_id = tcx.hir().as_local_hir_id(trait_m.def_id); + let trait_span = if let Some(trait_id) = trait_m_hir_id { + match tcx.hir().expect_trait_item_by_hir_id(trait_id).node { TraitItemKind::Method(ref trait_m_sig, _) => { let pos = if trait_number_args > 0 { trait_number_args - 1 @@ -687,8 +690,8 @@ fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } else { trait_item_span }; - let impl_m_node_id = tcx.hir().as_local_node_id(impl_m.def_id).unwrap(); - let impl_span = match tcx.hir().expect_impl_item(impl_m_node_id).node { + let impl_m_hir_id = tcx.hir().as_local_hir_id(impl_m.def_id).unwrap(); + let impl_span = match tcx.hir().expect_impl_item_by_hir_id(impl_m_hir_id).node { ImplItemKind::Method(ref impl_m_sig, _) => { let pos = if impl_number_args > 0 { impl_number_args - 1 @@ -927,8 +930,7 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Create a parameter environment that represents the implementation's // method. - let impl_c_node_id = tcx.hir().as_local_node_id(impl_c.def_id).unwrap(); - let impl_c_hir_id = tcx.hir().node_to_hir_id(impl_c_node_id); + let impl_c_hir_id = tcx.hir().as_local_hir_id(impl_c.def_id).unwrap(); // Compute placeholder form of impl and trait const tys. let impl_ty = tcx.type_of(impl_c.def_id); @@ -960,7 +962,7 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_ty); // Locate the Span containing just the type of the offending impl - match tcx.hir().expect_impl_item(impl_c_node_id).node { + match tcx.hir().expect_impl_item_by_hir_id(impl_c_hir_id).node { ImplItemKind::Const(ref ty, _) => cause.span = ty.span, _ => bug!("{:?} is not a impl const", impl_c), } @@ -972,10 +974,10 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait", trait_c.ident); - let trait_c_node_id = tcx.hir().as_local_node_id(trait_c.def_id); - let trait_c_span = trait_c_node_id.map(|trait_c_node_id| { + let trait_c_hir_id = tcx.hir().as_local_hir_id(trait_c.def_id); + let trait_c_span = trait_c_hir_id.map(|trait_c_hir_id| { // Add a label to the Span containing just the type of the const - match tcx.hir().expect_trait_item(trait_c_node_id).node { + match tcx.hir().expect_trait_item_by_hir_id(trait_c_hir_id).node { TraitItemKind::Const(ref ty, _) => ty.span, _ => bug!("{:?} is not a trait const", trait_c), } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 301d7d3ac562..8fe713d096d8 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -593,8 +593,7 @@ impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> { pub fn build(tcx: TyCtxt<'a, 'gcx, 'gcx>, def_id: DefId) -> InheritedBuilder<'a, 'gcx, 'tcx> { let hir_id_root = if def_id.is_local() { - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let hir_id = tcx.hir().definitions().node_to_hir_id(node_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); DefId::local(hir_id.owner) } else { def_id @@ -619,8 +618,8 @@ impl<'a, 'gcx, 'tcx> InheritedBuilder<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> { fn new(infcx: InferCtxt<'a, 'gcx, 'tcx>, def_id: DefId) -> Self { let tcx = infcx.tcx; - let item_id = tcx.hir().as_local_node_id(def_id); - let body_id = item_id.and_then(|id| tcx.hir().maybe_body_owned_by(id)); + let item_id = tcx.hir().as_local_hir_id(def_id); + let body_id = item_id.and_then(|id| tcx.hir().maybe_body_owned_by_by_hir_id(id)); let implicit_region_bound = body_id.map(|body_id| { let body = tcx.hir().body(body_id); tcx.mk_region(ty::ReScope(region::Scope { @@ -1920,9 +1919,9 @@ impl<'a, 'gcx, 'tcx> AstConv<'gcx, 'tcx> for FnCtxt<'a, 'gcx, 'tcx> { -> Lrc> { let tcx = self.tcx; - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let item_id = tcx.hir().ty_param_owner(node_id); - let item_def_id = tcx.hir().local_def_id(item_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let item_id = tcx.hir().ty_param_owner(hir_id); + let item_def_id = tcx.hir().local_def_id_from_hir_id(item_id); let generics = tcx.generics_of(item_def_id); let index = generics.param_def_id_to_index[&def_id]; Lrc::new(ty::GenericPredicates { diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index 89e8b2b840d1..3e6e6576b63b 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -120,9 +120,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { None }; - let closure_node_id = self.tcx.hir().hir_to_node_id(closure_hir_id); - - self.tcx.with_freevars(closure_node_id, |freevars| { + self.tcx.with_freevars(closure_hir_id, |freevars| { let mut freevar_list: Vec = Vec::with_capacity(freevars.len()); for freevar in freevars { let upvar_id = ty::UpvarId { @@ -217,10 +215,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // inference algorithm will reject it). // Equate the type variables for the upvars with the actual types. - let final_upvar_tys = self.final_upvar_tys(closure_node_id); + let final_upvar_tys = self.final_upvar_tys(closure_hir_id); debug!( "analyze_closure: id={:?} substs={:?} final_upvar_tys={:?}", - closure_node_id, substs, final_upvar_tys + closure_hir_id, substs, final_upvar_tys ); for (upvar_ty, final_upvar_ty) in substs .upvar_tys(closure_def_id, self.tcx) @@ -238,14 +236,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } // Returns a list of `ClosureUpvar`s for each upvar. - fn final_upvar_tys(&self, closure_id: ast::NodeId) -> Vec> { + fn final_upvar_tys(&self, closure_id: hir::HirId) -> Vec> { // Presently an unboxed closure type cannot "escape" out of a // function, so we will only encounter ones that originated in the // local crate or were inlined into it along with some function. // This may change if abstract return types of some sort are // implemented. let tcx = self.tcx; - let closure_def_index = tcx.hir().local_def_id(closure_id); + let closure_def_index = tcx.hir().local_def_id_from_hir_id(closure_id); tcx.with_freevars(closure_id, |freevars| { freevars diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 16cf25f0d491..208f443ffd93 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -151,8 +151,8 @@ pub fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: Def } pub fn check_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let trait_item = tcx.hir().expect_trait_item(node_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let trait_item = tcx.hir().expect_trait_item_by_hir_id(hir_id); let method_sig = match trait_item.node { hir::TraitItemKind::Method(ref sig, _) => Some(sig), @@ -162,8 +162,8 @@ pub fn check_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { } pub fn check_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let impl_item = tcx.hir().expect_impl_item(node_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let impl_item = tcx.hir().expect_impl_item_by_hir_id(hir_id); let method_sig = match impl_item.node { hir::ImplItemKind::Method(ref sig, _) => Some(sig), @@ -625,8 +625,8 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>( let generics = tcx.generics_of(def_id); // only check named existential types defined in this crate if generics.parent.is_none() && def_id.is_local() { - let opaque_node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - if may_define_existential_type(tcx, fn_def_id, opaque_node_id) { + let opaque_hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + if may_define_existential_type(tcx, fn_def_id, opaque_hir_id) { trace!("check_existential_types may define. Generics: {:#?}", generics); let mut seen: FxHashMap<_, Vec<_>> = FxHashMap::default(); for (subst, param) in substs.iter().zip(&generics.params) { diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index 6079f12936b5..cbb6d9b29f59 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -94,8 +94,8 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { // Note that if we carry through to the `extern_mod_stmt_cnum` query // below it'll cause a panic because `def_id` is actually bogus at this // point in time otherwise. - if let Some(id) = tcx.hir().as_local_node_id(def_id) { - if tcx.hir().find(id).is_none() { + if let Some(id) = tcx.hir().as_local_hir_id(def_id) { + if tcx.hir().find_by_hir_id(id).is_none() { return false; } } diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index 0996d1ff3b99..5d86bc540953 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -50,8 +50,8 @@ fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: /* do nothing */ } else { // Destructors only work on nominal types. - if let Some(impl_node_id) = tcx.hir().as_local_node_id(impl_did) { - if let Some(Node::Item(item)) = tcx.hir().find(impl_node_id) { + if let Some(impl_hir_id) = tcx.hir().as_local_hir_id(impl_did) { + if let Some(Node::Item(item)) = tcx.hir().find_by_hir_id(impl_hir_id) { let span = match item.node { ItemKind::Impl(.., ref ty, _) => ty.span, _ => item.span, diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index eb4bbe880693..d4a1d3808696 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -255,9 +255,9 @@ fn type_param_predicates<'a, 'tcx>( // written inline like `` or in a where clause like // `where T : Foo`. - let param_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let param_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let param_owner = tcx.hir().ty_param_owner(param_id); - let param_owner_def_id = tcx.hir().local_def_id(param_owner); + let param_owner_def_id = tcx.hir().local_def_id_from_hir_id(param_owner); let generics = tcx.generics_of(param_owner_def_id); let index = generics.param_def_id_to_index[&def_id]; let ty = tcx.mk_ty_param(index, tcx.hir().ty_param_name(param_id).as_interned_str()); @@ -280,8 +280,8 @@ fn type_param_predicates<'a, 'tcx>( }, ); - let item_node_id = tcx.hir().as_local_node_id(item_def_id).unwrap(); - let ast_generics = match tcx.hir().get(item_node_id) { + let item_hir_id = tcx.hir().as_local_hir_id(item_def_id).unwrap(); + let ast_generics = match tcx.hir().get_by_hir_id(item_hir_id) { Node::TraitItem(item) => &item.generics, Node::ImplItem(item) => &item.generics, @@ -301,7 +301,7 @@ fn type_param_predicates<'a, 'tcx>( | ItemKind::Union(_, ref generics) => generics, ItemKind::Trait(_, _, ref generics, ..) => { // Implied `Self: Trait` and supertrait bounds. - if param_id == item_node_id { + if param_id == item_hir_id { let identity_trait_ref = ty::TraitRef::identity(tcx, item_def_id); Lrc::make_mut(&mut result) .predicates @@ -322,10 +322,9 @@ fn type_param_predicates<'a, 'tcx>( }; let icx = ItemCtxt::new(tcx, item_def_id); - let param_hir_id = tcx.hir().node_to_hir_id(param_id); Lrc::make_mut(&mut result) .predicates - .extend(icx.type_parameter_bounds_in_generics(ast_generics, param_hir_id, ty, + .extend(icx.type_parameter_bounds_in_generics(ast_generics, param_id, ty, OnlySelfBounds(true))); result } @@ -619,8 +618,8 @@ fn convert_variant<'a, 'tcx>( fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtDef { use rustc::hir::*; - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let item = match tcx.hir().get(node_id) { + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let item = match tcx.hir().get_by_hir_id(hir_id) { Node::Item(item) => item, _ => bug!(), }; @@ -694,11 +693,11 @@ fn super_predicates_of<'a, 'tcx>( trait_def_id: DefId, ) -> Lrc> { debug!("super_predicates(trait_def_id={:?})", trait_def_id); - let trait_node_id = tcx.hir().as_local_node_id(trait_def_id).unwrap(); + let trait_hir_id = tcx.hir().as_local_hir_id(trait_def_id).unwrap(); - let item = match tcx.hir().get(trait_node_id) { + let item = match tcx.hir().get_by_hir_id(trait_hir_id) { Node::Item(item) => item, - _ => bug!("trait_node_id {} is not an item", trait_node_id), + _ => bug!("trait_node_id {} is not an item", trait_hir_id), }; let (generics, bounds) = match item.node { @@ -887,14 +886,14 @@ fn has_late_bound_regions<'a, 'tcx>( fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Generics { use rustc::hir::*; - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); - let node = tcx.hir().get(node_id); + let node = tcx.hir().get_by_hir_id(hir_id); let parent_def_id = match node { Node::ImplItem(_) | Node::TraitItem(_) | Node::Variant(_) | Node::StructCtor(_) | Node::Field(_) => { - let parent_id = tcx.hir().get_parent(node_id); - Some(tcx.hir().local_def_id(parent_id)) + let parent_id = tcx.hir().get_parent_item(hir_id); + Some(tcx.hir().local_def_id_from_hir_id(parent_id)) } Node::Expr(&hir::Expr { node: hir::ExprKind::Closure(..), @@ -994,7 +993,6 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty }), ); - let hir_id = tcx.hir().node_to_hir_id(node_id); let object_lifetime_defaults = tcx.object_lifetime_defaults(hir_id); // Now create the real type parameters. @@ -1096,7 +1094,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty }), ); - tcx.with_freevars(node_id, |fv| { + tcx.with_freevars(hir_id, |fv| { params.extend(fv.iter().zip((dummy_args.len() as u32)..).map(|(_, i)| { ty::GenericParamDef { index: type_start + i, @@ -1569,16 +1567,16 @@ fn find_existential_constraints<'a, 'tcx>( tcx, found: None, }; - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let parent = tcx.hir().get_parent(node_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let parent = tcx.hir().get_parent_item(hir_id); trace!("parent_id: {:?}", parent); - if parent == ast::CRATE_NODE_ID { + if parent == hir::CRATE_HIR_ID { intravisit::walk_crate(&mut locator, tcx.hir().krate()); } else { - trace!("parent: {:?}", tcx.hir().get(parent)); - match tcx.hir().get(parent) { + trace!("parent: {:?}", tcx.hir().get_by_hir_id(parent)); + match tcx.hir().get_by_hir_id(parent) { Node::Item(ref it) => intravisit::walk_item(&mut locator, it), Node::ImplItem(ref it) => intravisit::walk_impl_item(&mut locator, it), Node::TraitItem(ref it) => intravisit::walk_trait_item(&mut locator, it), @@ -1603,11 +1601,11 @@ fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig use rustc::hir::*; use rustc::hir::Node::*; - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let icx = ItemCtxt::new(tcx, def_id); - match tcx.hir().get(node_id) { + match tcx.hir().get_by_hir_id(hir_id) { TraitItem(hir::TraitItem { node: TraitItemKind::Method(sig, _), .. @@ -1626,7 +1624,7 @@ fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig node: ForeignItemKind::Fn(ref fn_decl, _, _), .. }) => { - let abi = tcx.hir().get_foreign_abi(node_id); + let abi = tcx.hir().get_foreign_abi_by_hir_id(hir_id); compute_sig_of_foreign_fn_decl(tcx, def_id, fn_decl, abi) } @@ -1639,7 +1637,7 @@ fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig }, .. }) => { - let ty = tcx.type_of(tcx.hir().get_parent_did(node_id)); + let ty = tcx.type_of(tcx.hir().get_parent_did_by_hir_id(hir_id)); let inputs = fields .iter() .map(|f| tcx.type_of(tcx.hir().local_def_id_from_hir_id(f.hir_id))); @@ -1878,8 +1876,8 @@ fn explicit_predicates_of<'a, 'tcx>( } } - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let node = tcx.hir().get(node_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let node = tcx.hir().get_by_hir_id(hir_id); let mut is_trait = None; let mut is_default_impl_trait = None; diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index 1ab414c1f015..913990ee8789 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -26,10 +26,10 @@ fn inferred_outlives_of<'a, 'tcx>( ) -> Lrc>> { let id = tcx .hir() - .as_local_node_id(item_def_id) + .as_local_hir_id(item_def_id) .expect("expected local def-id"); - match tcx.hir().get(id) { + match tcx.hir().get_by_hir_id(id) { Node::Item(item) => match item.node { hir::ItemKind::Struct(..) | hir::ItemKind::Enum(..) | hir::ItemKind::Union(..) => { let crate_map = tcx.inferred_outlives_crate(LOCAL_CRATE); diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index d07a4579ad5c..0b656ed44cc6 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -3,7 +3,7 @@ use rustc::traits::auto_trait as auto; use rustc::ty::{self, TypeFoldable}; use std::fmt::Debug; -use self::def_ctor::{get_def_from_def_id, get_def_from_node_id}; +use self::def_ctor::{get_def_from_def_id, get_def_from_hir_id}; use super::*; @@ -25,9 +25,9 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> { }) } - pub fn get_with_node_id(&self, id: ast::NodeId, name: String) -> Vec { - get_def_from_node_id(&self.cx, id, name, &|def_ctor, name| { - let did = self.cx.tcx.hir().local_def_id(id); + pub fn get_with_hir_id(&self, id: hir::HirId, name: String) -> Vec { + get_def_from_hir_id(&self.cx, id, name, &|def_ctor, name| { + let did = self.cx.tcx.hir().local_def_id_from_hir_id(id); self.get_auto_trait_impls(did, &def_ctor, Some(name)) }) } diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index 5a13490eeccf..86914f66c3d2 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -9,7 +9,7 @@ use crate::core::DocAccessLevels; use super::*; -use self::def_ctor::{get_def_from_def_id, get_def_from_node_id}; +use self::def_ctor::{get_def_from_def_id, get_def_from_hir_id}; pub struct BlanketImplFinder<'a, 'tcx: 'a, 'rcx: 'a> { pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>, @@ -26,9 +26,9 @@ impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> { }) } - pub fn get_with_node_id(&self, id: ast::NodeId, name: String) -> Vec { - get_def_from_node_id(&self.cx, id, name, &|def_ctor, name| { - let did = self.cx.tcx.hir().local_def_id(id); + pub fn get_with_hir_id(&self, id: hir::HirId, name: String) -> Vec { + get_def_from_hir_id(&self.cx, id, name, &|def_ctor, name| { + let did = self.cx.tcx.hir().local_def_id_from_hir_id(id); self.get_blanket_impls(did, &def_ctor, Some(name)) }) } diff --git a/src/librustdoc/clean/def_ctor.rs b/src/librustdoc/clean/def_ctor.rs index fce86d590159..17d53479a67a 100644 --- a/src/librustdoc/clean/def_ctor.rs +++ b/src/librustdoc/clean/def_ctor.rs @@ -38,13 +38,13 @@ where F: Fn(& dyn Fn(DefId) -> Def) -> Vec { } } -pub fn get_def_from_node_id(cx: &DocContext<'_, '_, '_>, - id: ast::NodeId, - name: String, - callback: &F, +pub fn get_def_from_hir_id(cx: &DocContext<'_, '_, '_>, + id: hir::HirId, + name: String, + callback: &F, ) -> Vec where F: Fn(& dyn Fn(DefId) -> Def, String) -> Vec { - let item = &cx.tcx.hir().expect_item(id).node; + let item = &cx.tcx.hir().expect_item_by_hir_id(id).node; callback(&match *item { hir::ItemKind::Struct(_, _) => Def::Struct, diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index cdffbdd540f8..abaf87f7aef0 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -422,8 +422,8 @@ fn build_module( } pub fn print_inlined_const(cx: &DocContext<'_, '_, '_>, did: DefId) -> String { - if let Some(node_id) = cx.tcx.hir().as_local_node_id(did) { - cx.tcx.hir().node_to_pretty_string(node_id) + if let Some(node_id) = cx.tcx.hir().as_local_hir_id(did) { + cx.tcx.hir().hir_to_pretty_string(node_id) } else { cx.tcx.rendered_const(did) } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 5d0d76507bd0..d39f516ee113 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1847,7 +1847,7 @@ impl<'a, A: Copy> Clean for (&'a hir::FnDecl, A) impl<'a, 'tcx> Clean for (DefId, ty::PolyFnSig<'tcx>) { fn clean(&self, cx: &DocContext<'_, '_, '_>) -> FnDecl { let (did, sig) = *self; - let mut names = if cx.tcx.hir().as_local_node_id(did).is_some() { + let mut names = if cx.tcx.hir().as_local_hir_id(did).is_some() { vec![].into_iter() } else { cx.tcx.fn_arg_names(did).into_iter() @@ -3541,13 +3541,13 @@ pub struct Impl { pub blanket_impl: Option, } -pub fn get_auto_traits_with_node_id( +pub fn get_auto_traits_with_hir_id( cx: &DocContext<'_, '_, '_>, - id: ast::NodeId, + id: hir::HirId, name: String ) -> Vec { let finder = AutoTraitFinder::new(cx); - finder.get_with_node_id(id, name) + finder.get_with_hir_id(id, name) } pub fn get_auto_traits_with_def_id( @@ -3559,13 +3559,13 @@ pub fn get_auto_traits_with_def_id( finder.get_with_def_id(id) } -pub fn get_blanket_impls_with_node_id( +pub fn get_blanket_impls_with_hir_id( cx: &DocContext<'_, '_, '_>, - id: ast::NodeId, + id: hir::HirId, name: String ) -> Vec { let finder = BlanketImplFinder::new(cx); - finder.get_with_node_id(id, name) + finder.get_with_hir_id(id, name) } pub fn get_blanket_impls_with_def_id( @@ -3902,8 +3902,8 @@ fn name_from_pat(p: &hir::Pat) -> String { fn print_const(cx: &DocContext<'_, '_, '_>, n: ty::LazyConst<'_>) -> String { match n { ty::LazyConst::Unevaluated(def_id, _) => { - if let Some(node_id) = cx.tcx.hir().as_local_node_id(def_id) { - print_const_expr(cx, cx.tcx.hir().body_owned_by(node_id)) + if let Some(hir_id) = cx.tcx.hir().as_local_hir_id(def_id) { + print_const_expr(cx, cx.tcx.hir().body_owned_by(hir_id)) } else { inline::print_inlined_const(cx, def_id) } diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 07cfdde4a4e9..eb131bf6cd10 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -3,7 +3,7 @@ use rustc_driver::{driver, abort_on_err}; use rustc::session::{self, config}; use rustc::hir::def_id::{DefId, DefIndex, DefIndexAddressSpace, CrateNum, LOCAL_CRATE}; use rustc::hir::def::Def; -use rustc::hir::{self, HirVec}; +use rustc::hir::{self, HirId, HirVec}; use rustc::middle::cstore::CrateStore; use rustc::middle::privacy::AccessLevels; use rustc::ty::{self, TyCtxt, AllArenas}; @@ -17,7 +17,7 @@ use rustc_metadata::creader::CrateLoader; use rustc_metadata::cstore::CStore; use rustc_target::spec::TargetTriple; -use syntax::ast::{self, Ident, NodeId}; +use syntax::ast::{self, Ident}; use syntax::source_map; use syntax::feature_gate::UnstableFeatures; use syntax::json::JsonEmitter; @@ -159,7 +159,7 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { /// Like the function of the same name on the HIR map, but skips calling it on fake DefIds. /// (This avoids a slice-index-out-of-bounds panic.) - pub fn as_local_node_id(&self, def_id: DefId) -> Option { + pub fn as_local_node_id(&self, def_id: DefId) -> Option { if self.all_fake_def_ids.borrow().contains(&def_id) { None } else { @@ -167,6 +167,15 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { } } + // FIXME(@ljedrz): remove the NodeId variant + pub fn as_local_hir_id(&self, def_id: DefId) -> Option { + if self.all_fake_def_ids.borrow().contains(&def_id) { + None + } else { + self.tcx.hir().as_local_hir_id(def_id) + } + } + pub fn get_real_ty(&self, def_id: DefId, def_ctor: &F, diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 25c86b24c187..c346714ab485 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -4,7 +4,7 @@ use rustc::hir::def::Def; use rustc::hir::def_id::DefId; use rustc::ty; use syntax; -use syntax::ast::{self, Ident, NodeId}; +use syntax::ast::{self, Ident}; use syntax::feature_gate::UnstableFeatures; use syntax::symbol::Symbol; use syntax_pos::DUMMY_SP; @@ -49,7 +49,7 @@ enum PathKind { struct LinkCollector<'a, 'tcx: 'a, 'rcx: 'a> { cx: &'a DocContext<'a, 'tcx, 'rcx>, - mod_ids: Vec, + mod_ids: Vec, is_nightly_build: bool, } @@ -69,7 +69,7 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> { path_str: &str, is_val: bool, current_item: &Option, - parent_id: Option) + parent_id: Option) -> Result<(Def, Option), ()> { let cx = self.cx; @@ -220,8 +220,8 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> { impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> { fn fold_item(&mut self, mut item: Item) -> Option { - let item_node_id = if item.is_mod() { - if let Some(id) = self.cx.tcx.hir().as_local_node_id(item.def_id) { + let item_hir_id = if item.is_mod() { + if let Some(id) = self.cx.tcx.hir().as_local_hir_id(item.def_id) { Some(id) } else { debug!("attempting to fold on a non-local item: {:?}", item); @@ -248,14 +248,14 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> { let current_item = match item.inner { ModuleItem(..) => { if item.attrs.inner_docs { - if item_node_id.unwrap() != NodeId::from_u32(0) { + if item_hir_id.unwrap() != hir::CRATE_HIR_ID { item.name.clone() } else { None } } else { match parent_node.or(self.mod_ids.last().cloned()) { - Some(parent) if parent != NodeId::from_u32(0) => { + Some(parent) if parent != ast::CRATE_NODE_ID => { // FIXME: can we pull the parent module's name from elsewhere? Some(self.cx.tcx.hir().name(parent).to_string()) } @@ -274,7 +274,7 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> { }; if item.is_mod() && item.attrs.inner_docs { - self.mod_ids.push(item_node_id.unwrap()); + self.mod_ids.push(self.cx.tcx.hir().hir_to_node_id(item_hir_id.unwrap())); } let cx = self.cx; @@ -421,7 +421,7 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> { } if item.is_mod() && !item.attrs.inner_docs { - self.mod_ids.push(item_node_id.unwrap()); + self.mod_ids.push(self.cx.tcx.hir().hir_to_node_id(item_hir_id.unwrap())); } if item.is_mod() { diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs index 4c90540871d2..044e48f990e4 100644 --- a/src/librustdoc/passes/collect_trait_impls.rs +++ b/src/librustdoc/passes/collect_trait_impls.rs @@ -155,11 +155,11 @@ impl<'a, 'tcx, 'rcx> SyntheticImplCollector<'a, 'tcx, 'rcx> { impl<'a, 'tcx, 'rcx> DocFolder for SyntheticImplCollector<'a, 'tcx, 'rcx> { fn fold_item(&mut self, i: Item) -> Option { if i.is_struct() || i.is_enum() || i.is_union() { - if let (Some(node_id), Some(name)) = - (self.cx.tcx.hir().as_local_node_id(i.def_id), i.name.clone()) + if let (Some(hir_id), Some(name)) = + (self.cx.tcx.hir().as_local_hir_id(i.def_id), i.name.clone()) { - self.impls.extend(get_auto_traits_with_node_id(self.cx, node_id, name.clone())); - self.impls.extend(get_blanket_impls_with_node_id(self.cx, node_id, name)); + self.impls.extend(get_auto_traits_with_hir_id(self.cx, hir_id, name.clone())); + self.impls.extend(get_blanket_impls_with_hir_id(self.cx, hir_id, name)); } else { self.impls.extend(get_auto_traits_with_def_id(self.cx, i.def_id)); self.impls.extend(get_blanket_impls_with_def_id(self.cx, i.def_id)); diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index d6f3585a04f3..48fc6f61952b 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -291,7 +291,7 @@ pub fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a>( item: &Item, check_missing_code: bool, ) { - if cx.as_local_node_id(item.def_id).is_none() { + if cx.as_local_hir_id(item.def_id).is_none() { // If non-local, no need to check anything. return; } diff --git a/src/test/mir-opt/inline-closure-borrows-arg.rs b/src/test/mir-opt/inline-closure-borrows-arg.rs index 9f925e891c0d..d09ddce09c54 100644 --- a/src/test/mir-opt/inline-closure-borrows-arg.rs +++ b/src/test/mir-opt/inline-closure-borrows-arg.rs @@ -20,7 +20,7 @@ fn foo(_t: T, q: &i32) -> i32 { // ... // bb0: { // ... -// _3 = [closure@NodeId(53)]; +// _3 = [closure@HirId { owner: DefIndex(0:4), local_id: 27 }]; // ... // _4 = &_3; // ... diff --git a/src/test/mir-opt/inline-closure.rs b/src/test/mir-opt/inline-closure.rs index 68c88da9c029..436a8c20e2b4 100644 --- a/src/test/mir-opt/inline-closure.rs +++ b/src/test/mir-opt/inline-closure.rs @@ -16,7 +16,7 @@ fn foo(_t: T, q: i32) -> i32 { // ... // bb0: { // ... -// _3 = [closure@NodeId(39)]; +// _3 = [closure@HirId { owner: DefIndex(0:4), local_id: 11 }]; // ... // _4 = &_3; // ... diff --git a/src/test/mir-opt/retag.rs b/src/test/mir-opt/retag.rs index bb794409ae01..cdf635567378 100644 --- a/src/test/mir-opt/retag.rs +++ b/src/test/mir-opt/retag.rs @@ -98,7 +98,7 @@ fn main() { // } // END rustc.main.EraseRegions.after.mir // START rustc.main-{{closure}}.EraseRegions.after.mir -// fn main::{{closure}}(_1: &[closure@NodeId(124)], _2: &i32) -> &i32 { +// fn main::{{closure}}(_1: &[closure@HirId { owner: DefIndex(0:7), local_id: 70 }], _2: &i32) -> &i32 { // ... // bb0: { // Retag([fn entry] _1); From 78f91e39766768248fa77c42a14c3a609be53904 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Wed, 6 Mar 2019 14:44:24 +0100 Subject: [PATCH 295/381] hir: remove NodeId from PathSegment --- src/librustc/hir/lowering.rs | 11 ++++------- src/librustc/hir/mod.rs | 4 ---- src/librustc/ich/impls_hir.rs | 1 - src/librustdoc/clean/mod.rs | 1 - src/librustdoc/core.rs | 1 - 5 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 52ad800e81c6..6b3111688d8c 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -1932,7 +1932,6 @@ impl<'a> LoweringContext<'a> { hir::PathSegment::new( segment.ident, - Some(id.node_id), Some(id.hir_id), Some(def), generic_args, @@ -3276,10 +3275,8 @@ impl<'a> LoweringContext<'a> { debug!("renumber_segment_ids(path = {:?})", path); let mut path = path.clone(); for seg in path.segments.iter_mut() { - if seg.id.is_some() { - let next_id = self.next_id(); - seg.id = Some(next_id.node_id); - seg.hir_id = Some(next_id.hir_id); + if seg.hir_id.is_some() { + seg.hir_id = Some(self.next_id().hir_id); } } path @@ -5024,8 +5021,8 @@ impl<'a> LoweringContext<'a> { for seg in path.segments.iter_mut() { - if let Some(id) = seg.id { - seg.id = Some(self.lower_node_id(id).node_id); + if seg.hir_id.is_some() { + seg.hir_id = Some(self.next_id().hir_id); } } path diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 2d0296aa38c7..1bf3ec88f36b 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -327,7 +327,6 @@ pub struct PathSegment { // therefore will not have 'jump to def' in IDEs, but otherwise will not be // affected. (In general, we don't bother to get the defs for synthesized // segments, only for segments which have come from the AST). - pub id: Option, pub hir_id: Option, pub def: Option, @@ -350,7 +349,6 @@ impl PathSegment { pub fn from_ident(ident: Ident) -> PathSegment { PathSegment { ident, - id: None, hir_id: None, def: None, infer_types: true, @@ -360,7 +358,6 @@ impl PathSegment { pub fn new( ident: Ident, - id: Option, hir_id: Option, def: Option, args: GenericArgs, @@ -368,7 +365,6 @@ impl PathSegment { ) -> Self { PathSegment { ident, - id, hir_id, def, infer_types, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 0803816fb03f..ff9206820ac5 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -171,7 +171,6 @@ impl_stable_hash_for!(struct hir::Path { impl_stable_hash_for!(struct hir::PathSegment { ident -> (ident.name), - id, hir_id, def, infer_types, diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index d39f516ee113..29f8c30e33ee 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -4250,7 +4250,6 @@ where F: Fn(DefId) -> Def { def: def_ctor(def_id), segments: hir::HirVec::from_vec(apb.names.iter().map(|s| hir::PathSegment { ident: ast::Ident::from_str(&s), - id: None, hir_id: None, def: None, args: None, diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index eb131bf6cd10..8fe116bd9c87 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -191,7 +191,6 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { real_name.unwrap_or(last.ident), None, None, - None, self.generics_to_path_params(generics.clone()), false, )); From 754037de130c79e4be6b48e27203dcae58e91f70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 7 Mar 2019 00:27:41 -0800 Subject: [PATCH 296/381] fix bad use of with_emitter --- src/librustdoc/test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index c3c0875bc7d2..3dd2c4a477a6 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -272,7 +272,7 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize, false); // Compile the code - let diagnostic_handler = errors::Handler::with_emitter(true, false, box emitter); + let diagnostic_handler = errors::Handler::with_emitter(true, None, box emitter); let mut sess = session::build_session_( sessopts, None, diagnostic_handler, source_map, Default::default(), @@ -424,7 +424,7 @@ pub fn make_test(s: &str, // send all the errors that libsyntax emits directly into a `Sink` instead of stderr. let cm = Lrc::new(SourceMap::new(FilePathMapping::empty())); let emitter = EmitterWriter::new(box io::sink(), None, false, false); - let handler = Handler::with_emitter(false, false, box emitter); + let handler = Handler::with_emitter(false, None, box emitter); let sess = ParseSess::with_span_handler(handler, cm); let mut found_main = false; From e5b3ed84a032b10db0c85fcfd8baf67424cac63e Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Thu, 7 Mar 2019 10:27:58 +0100 Subject: [PATCH 297/381] Actually publish miri in the manifest --- src/tools/build-manifest/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 8d87c404d0b2..d44a51a9635e 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -358,6 +358,7 @@ impl Builder { self.package("rust-src", &mut manifest.pkg, &["*"]); self.package("rls-preview", &mut manifest.pkg, HOSTS); self.package("clippy-preview", &mut manifest.pkg, HOSTS); + self.package("miri", &mut manifest.pkg, HOSTS); self.package("rustfmt-preview", &mut manifest.pkg, HOSTS); self.package("rust-analysis", &mut manifest.pkg, TARGETS); self.package("llvm-tools-preview", &mut manifest.pkg, TARGETS); @@ -375,7 +376,7 @@ impl Builder { &["rustc", "cargo", "rust-std", "rust-mingw", "rust-docs", "rustfmt-preview", "clippy-preview", "rls-preview", "rust-src", "llvm-tools-preview", - "lldb-preview", "rust-analysis"]); + "lldb-preview", "rust-analysis", "miri"]); manifest.renames.insert("rls".to_owned(), Rename { to: "rls-preview".to_owned() }); manifest.renames.insert("rustfmt".to_owned(), Rename { to: "rustfmt-preview".to_owned() }); @@ -422,6 +423,7 @@ impl Builder { // weren't built extensions.extend(vec![ Component { pkg: "clippy-preview".to_string(), target: host.to_string() }, + Component { pkg: "miri".to_string(), target: host.to_string() }, Component { pkg: "rls-preview".to_string(), target: host.to_string() }, Component { pkg: "rustfmt-preview".to_string(), target: host.to_string() }, Component { pkg: "llvm-tools-preview".to_string(), target: host.to_string() }, From c41ddf177380e96e873d625cb7ce87468eed85e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 7 Mar 2019 01:54:53 -0800 Subject: [PATCH 298/381] Keep current behavior while accepting error count --- src/librustc/session/config.rs | 13 +++++++++++-- src/librustc_errors/lib.rs | 26 ++++++++++++++++++-------- src/librustdoc/test.rs | 2 +- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 70cf36c38691..77fbe467ce01 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -816,6 +816,8 @@ macro_rules! options { Some("crate=integer"); pub const parse_unpretty: Option<&str> = Some("`string` or `string=string`"); + pub const parse_treat_err_as_bug: Option<&str> = + Some("either no value or a number bigger than 0"); pub const parse_lto: Option<&str> = Some("either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, \ `fat`, or omitted"); @@ -1022,6 +1024,13 @@ macro_rules! options { } } + fn parse_treat_err_as_bug(slot: &mut Option, v: Option<&str>) -> bool { + match v { + Some(s) => { *slot = s.parse().ok().filter(|&x| x != 0); slot.unwrap_or(0) != 0 } + None => { *slot = Some(1); true } + } + } + fn parse_lto(slot: &mut LtoCli, v: Option<&str>) -> bool { if v.is_some() { let mut bool_arg = None; @@ -1234,7 +1243,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "parse only; do not compile, assemble, or link"), no_codegen: bool = (false, parse_bool, [TRACKED], "run all passes except codegen; no output"), - treat_err_as_bug: Option = (None, parse_opt_uint, [TRACKED], + treat_err_as_bug: Option = (None, parse_treat_err_as_bug, [TRACKED], "treat all errors that occur as bugs"), report_delayed_bugs: bool = (false, parse_bool, [TRACKED], "immediately print bugs registered with `delay_span_bug`"), @@ -3212,7 +3221,7 @@ mod tests { assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); opts = reference.clone(); - opts.debugging_opts.treat_err_as_bug = Some(0); + opts.debugging_opts.treat_err_as_bug = Some(1); assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); opts = reference.clone(); diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index ae634018b935..3992d2908c78 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -517,7 +517,19 @@ impl Handler { fn panic_if_treat_err_as_bug(&self) { if self.treat_err_as_bug() { - panic!("encountered error with `-Z treat_err_as_bug"); + let s = match (self.err_count(), self.flags.treat_err_as_bug.unwrap_or(0)) { + (0, _) => return, + (1, 1) => "aborting due to `-Z treat-err-as-bug=1`".to_string(), + (1, _) => return, + (count, as_bug) => { + format!( + "aborting after {} errors due to `-Z treat-err-as-bug={}`", + count, + as_bug, + ) + } + }; + panic!(s); } } @@ -645,14 +657,12 @@ impl Handler { 1 => "aborting due to previous error".to_string(), _ => format!("aborting due to {} previous errors", self.err_count()) }; + let err_as_bug = self.flags.treat_err_as_bug.unwrap_or(0); + if self.err_count() >= err_as_bug { + return; + } - let _ = if self.treat_err_as_bug() { - self.fatal(&s) - } else { - // only emit one backtrace when using `-Z treat-err-as-bug=X` - DiagnosticBuilder::new(self, Fatal, &s).emit(); - FatalError - }; + let _ = self.fatal(&s); let can_show_explain = self.emitter.borrow().should_show_explain(); let are_there_diagnostics = !self.emitted_diagnostic_codes.borrow().is_empty(); diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 3dd2c4a477a6..856365847ae1 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -67,7 +67,7 @@ pub fn run(mut options: Options) -> isize { let source_map = Lrc::new(SourceMap::new(sessopts.file_path_mapping())); let handler = errors::Handler::with_tty_emitter(ColorConfig::Auto, - true, false, + true, None, Some(source_map.clone())); let mut sess = session::build_session_( From 558a07b89674b9a8962235c9d9a5b16e08c22210 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Thu, 7 Mar 2019 12:18:59 +0100 Subject: [PATCH 299/381] hir: remove NodeId from PatKind --- src/librustc/hir/intravisit.rs | 4 ++-- src/librustc/hir/lowering.rs | 7 +++---- src/librustc/hir/map/mod.rs | 2 +- src/librustc/hir/mod.rs | 4 ++-- src/librustc/hir/pat_util.rs | 6 +++--- src/librustc/hir/print.rs | 2 +- src/librustc/ich/impls_hir.rs | 2 +- src/librustc/middle/expr_use_visitor.rs | 2 +- src/librustc/middle/liveness.rs | 2 +- .../borrowck/gather_loans/gather_moves.rs | 2 +- src/librustc_lint/builtin.rs | 2 +- src/librustc_lint/nonstandard_style.rs | 2 +- src/librustc_metadata/encoder.rs | 2 +- .../borrow_check/mutability_errors.rs | 1 - src/librustc_mir/build/matches/mod.rs | 19 +++++++++---------- src/librustc_mir/build/mod.rs | 19 +++++++++---------- src/librustc_mir/hair/cx/expr.rs | 2 +- src/librustc_mir/hair/mod.rs | 3 +-- src/librustc_mir/hair/pattern/check_match.rs | 4 ++-- src/librustc_mir/hair/pattern/mod.rs | 6 +++--- src/librustc_save_analysis/lib.rs | 2 +- src/librustc_typeck/check/_match.rs | 2 +- src/librustc_typeck/check/mod.rs | 2 +- src/librustdoc/clean/mod.rs | 2 +- 24 files changed, 48 insertions(+), 53 deletions(-) diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 0aeac8cc440e..3c70df746124 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -697,8 +697,8 @@ pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat) { PatKind::Ref(ref subpattern, _) => { visitor.visit_pat(subpattern) } - PatKind::Binding(_, canonical_id, _hir_id, ident, ref optional_subpattern) => { - visitor.visit_def_mention(Def::Local(canonical_id)); + PatKind::Binding(_, _hir_id, ident, ref optional_subpattern) => { + // visitor.visit_def_mention(Def::Local(hir_id)); visitor.visit_ident(ident); walk_list!(visitor, visit_pat, optional_subpattern); } diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 6b3111688d8c..bcd2e500085c 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -3679,11 +3679,10 @@ impl<'a> LoweringContext<'a> { Some(Def::Local(id)) => id, _ => p.id, }; - let hir_id = self.lower_node_id(canonical_id).hir_id; + hir::PatKind::Binding( self.lower_binding_mode(binding_mode), - canonical_id, - hir_id, + self.lower_node_id(canonical_id).hir_id, ident, sub.as_ref().map(|x| self.lower_pat(x)), ) @@ -4985,7 +4984,7 @@ impl<'a> LoweringContext<'a> { ( P(hir::Pat { hir_id, - node: hir::PatKind::Binding(bm, node_id, hir_id, ident.with_span_pos(span), None), + node: hir::PatKind::Binding(bm, hir_id, ident.with_span_pos(span), None), span, }), node_id diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index e873d5640dd9..1a03ced9b4e0 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -1016,7 +1016,7 @@ impl<'hir> Map<'hir> { Node::Field(f) => f.ident.name, Node::Lifetime(lt) => lt.name.ident().name, Node::GenericParam(param) => param.name.ident().name, - Node::Binding(&Pat { node: PatKind::Binding(_, _, _, l, _), .. }) => l.name, + Node::Binding(&Pat { node: PatKind::Binding(_, _, l, _), .. }) => l.name, Node::StructCtor(_) => self.name(self.get_parent(id)), _ => bug!("no name for {}", self.node_to_string(id)) } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 1bf3ec88f36b..e24940f5f611 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -936,10 +936,10 @@ pub enum PatKind { Wild, /// A fresh binding `ref mut binding @ OPT_SUBPATTERN`. - /// The `NodeId` is the canonical ID for the variable being bound, + /// The `HirId` is the canonical ID for the variable being bound, /// (e.g., in `Ok(x) | Err(x)`, both `x` use the same canonical ID), /// which is the pattern ID of the first `x`. - Binding(BindingAnnotation, NodeId, HirId, Ident, Option>), + Binding(BindingAnnotation, HirId, Ident, Option>), /// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`). /// The `bool` is `true` in the presence of a `..`. diff --git a/src/librustc/hir/pat_util.rs b/src/librustc/hir/pat_util.rs index 312351ab850c..18a3d6708db6 100644 --- a/src/librustc/hir/pat_util.rs +++ b/src/librustc/hir/pat_util.rs @@ -70,7 +70,7 @@ impl hir::Pat { where F: FnMut(hir::BindingAnnotation, HirId, Span, ast::Ident), { self.walk(|p| { - if let PatKind::Binding(binding_mode, _, _, ident, _) = p.node { + if let PatKind::Binding(binding_mode, _, ident, _) = p.node { f(binding_mode, p.hir_id, p.span, ident); } true @@ -110,8 +110,8 @@ impl hir::Pat { pub fn simple_ident(&self) -> Option { match self.node { - PatKind::Binding(hir::BindingAnnotation::Unannotated, _, _, ident, None) | - PatKind::Binding(hir::BindingAnnotation::Mutable, _, _, ident, None) => Some(ident), + PatKind::Binding(hir::BindingAnnotation::Unannotated, _, ident, None) | + PatKind::Binding(hir::BindingAnnotation::Mutable, _, ident, None) => Some(ident), _ => None, } } diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 28e9403e9dba..54a21f2ed5c2 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -1765,7 +1765,7 @@ impl<'a> State<'a> { // is that it doesn't matter match pat.node { PatKind::Wild => self.s.word("_")?, - PatKind::Binding(binding_mode, _, _, ident, ref sub) => { + PatKind::Binding(binding_mode, _, ident, ref sub) => { match binding_mode { hir::BindingAnnotation::Ref => { self.word_nbsp("ref")?; diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index ff9206820ac5..68eb242c4dd6 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -448,7 +448,7 @@ impl_stable_hash_for!(enum hir::RangeEnd { impl_stable_hash_for!(enum hir::PatKind { Wild, - Binding(binding_mode, var, hir_id, name, sub), + Binding(binding_mode, hir_id, name, sub), Struct(path, field_pats, dotdot), TupleStruct(path, field_pats, dotdot), Path(path), diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 19113d16a1ee..78a9e406c95e 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -860,7 +860,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { // Each match binding is effectively an assignment to the // binding being produced. - let def = Def::Local(canonical_id); + let def = Def::Local(mc.tcx.hir().hir_to_node_id(canonical_id)); if let Ok(ref binding_cmt) = mc.cat_def(pat.hir_id, pat.span, pat_ty, def) { delegate.mutate(pat.hir_id, pat.span, binding_cmt, MutateMode::Init); } diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index e22b3e7f1d3c..35b8e08a5d53 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -407,7 +407,7 @@ fn add_from_pat<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, pat: &P) { while let Some(pat) = pats.pop_front() { use crate::hir::PatKind::*; match pat.node { - Binding(_, _, _, _, ref inner_pat) => { + Binding(_, _, _, ref inner_pat) => { pats.extend(inner_pat.iter()); } Struct(_, ref fields, _) => { diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index 310a9a2ef8da..a15d3d10adf0 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -98,7 +98,7 @@ pub fn gather_move_from_pat<'a, 'c, 'tcx: 'c>(bccx: &BorrowckCtxt<'a, 'tcx>, cmt: &'c mc::cmt_<'tcx>) { let source = get_pattern_source(bccx.tcx,move_pat); let pat_span_path_opt = match move_pat.node { - PatKind::Binding(_, _, _, ident, _) => { + PatKind::Binding(_, _, ident, _) => { Some(MovePlace { span: move_pat.span, name: ident.name, diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 1baa2db9dad7..aafae28b49ea 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -198,7 +198,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns { // (Issue #49588) continue; } - if let PatKind::Binding(_, _, _, ident, None) = fieldpat.node.pat.node { + if let PatKind::Binding(_, _, ident, None) = fieldpat.node.pat.node { if cx.tcx.find_field_index(ident, &variant) == Some(cx.tcx.field_index(fieldpat.node.hir_id, cx.tables)) { let mut err = cx.struct_span_lint(NON_SHORTHAND_FIELD_PATTERNS, diff --git a/src/librustc_lint/nonstandard_style.rs b/src/librustc_lint/nonstandard_style.rs index 4c4032a36956..fa18dd1eb8dd 100644 --- a/src/librustc_lint/nonstandard_style.rs +++ b/src/librustc_lint/nonstandard_style.rs @@ -358,7 +358,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase { } fn check_pat(&mut self, cx: &LateContext<'_, '_>, p: &hir::Pat) { - if let &PatKind::Binding(_, _, _, ident, _) = &p.node { + if let &PatKind::Binding(_, _, ident, _) = &p.node { self.check_snake_case(cx, "variable", &ident); } } diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index e27f314d6b86..466231347e3e 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -978,7 +978,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { let body = self.tcx.hir().body(body_id); self.lazy_seq(body.arguments.iter().map(|arg| { match arg.pat.node { - PatKind::Binding(_, _, _, ident, _) => ident.name, + PatKind::Binding(_, _, ident, _) => ident.name, _ => keywords::Invalid.name(), } })) diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index 66f47d719b4d..65703adfdff7 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -314,7 +314,6 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { if let hir::PatKind::Binding( hir::BindingAnnotation::Unannotated, _, - _, upvar_ident, _, ) = pat.node diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index 8f1301b743e9..d3731e7c1274 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -10,12 +10,13 @@ use crate::build::ForGuard::{self, OutsideGuard, RefWithinGuard}; use crate::build::{BlockAnd, BlockAndExtension, Builder}; use crate::build::{GuardFrame, GuardFrameLocal, LocalsForNode}; use crate::hair::{self, *}; +use rustc::hir::HirId; use rustc::mir::*; use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty}; use rustc::ty::layout::VariantIdx; use rustc_data_structures::bit_set::BitSet; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use syntax::ast::{Name, NodeId}; +use syntax::ast::Name; use syntax_pos::Span; // helper functions, broken out by category: @@ -530,7 +531,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { pub fn storage_live_binding( &mut self, block: BasicBlock, - var: NodeId, + var: HirId, span: Span, for_guard: ForGuard, ) -> Place<'tcx> { @@ -545,17 +546,15 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ); let place = Place::Base(PlaceBase::Local(local_id)); let var_ty = self.local_decls[local_id].ty; - let hir_id = self.hir.tcx().hir().node_to_hir_id(var); - let region_scope = self.hir.region_scope_tree.var_scope(hir_id.local_id); + let region_scope = self.hir.region_scope_tree.var_scope(var.local_id); self.schedule_drop(span, region_scope, &place, var_ty, DropKind::Storage); place } - pub fn schedule_drop_for_binding(&mut self, var: NodeId, span: Span, for_guard: ForGuard) { + pub fn schedule_drop_for_binding(&mut self, var: HirId, span: Span, for_guard: ForGuard) { let local_id = self.var_local_id(var, for_guard); let var_ty = self.local_decls[local_id].ty; - let hir_id = self.hir.tcx().hir().node_to_hir_id(var); - let region_scope = self.hir.region_scope_tree.var_scope(hir_id.local_id); + let region_scope = self.hir.region_scope_tree.var_scope(var.local_id); self.schedule_drop( span, region_scope, @@ -576,7 +575,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { Mutability, Name, BindingMode, - NodeId, + HirId, Span, Ty<'tcx>, UserTypeProjections<'tcx>, @@ -703,7 +702,7 @@ struct Binding<'tcx> { span: Span, source: Place<'tcx>, name: Name, - var_id: NodeId, + var_id: HirId, var_ty: Ty<'tcx>, mutability: Mutability, binding_mode: BindingMode, @@ -1694,7 +1693,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { mutability: Mutability, name: Name, mode: BindingMode, - var_id: NodeId, + var_id: HirId, var_ty: Ty<'tcx>, user_ty: UserTypeProjections<'tcx>, has_guard: ArmHasGuard, diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 8bebeae8f2eb..c855940cada6 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -13,13 +13,12 @@ use rustc::mir::*; use rustc::mir::visit::{MutVisitor, TyContext}; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::subst::SubstsRef; -use rustc::util::nodemap::NodeMap; +use rustc::util::nodemap::HirIdMap; use rustc_target::spec::PanicStrategy; use rustc_data_structures::indexed_vec::{IndexVec, Idx}; use std::mem; use std::u32; use rustc_target::spec::abi::Abi; -use syntax::ast; use syntax::attr::{self, UnwindAttr}; use syntax::symbol::keywords; use syntax_pos::Span; @@ -376,7 +375,7 @@ struct Builder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { /// Maps `NodeId`s of variable bindings to the `Local`s created for them. /// (A match binding can have two locals; the 2nd is for the arm's guard.) - var_indices: NodeMap, + var_indices: HirIdMap, local_decls: IndexVec>, canonical_user_type_annotations: ty::CanonicalUserTypeAnnotations<'tcx>, upvar_decls: Vec, @@ -392,11 +391,11 @@ struct Builder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { - fn is_bound_var_in_guard(&self, id: ast::NodeId) -> bool { + fn is_bound_var_in_guard(&self, id: hir::HirId) -> bool { self.guard_context.iter().any(|frame| frame.locals.iter().any(|local| local.id == id)) } - fn var_local_id(&self, id: ast::NodeId, for_guard: ForGuard) -> Local { + fn var_local_id(&self, id: hir::HirId, for_guard: ForGuard) -> Local { self.var_indices[&id].local_id(for_guard) } } @@ -471,11 +470,11 @@ enum LocalsForNode { #[derive(Debug)] struct GuardFrameLocal { - id: ast::NodeId, + id: hir::HirId, } impl GuardFrameLocal { - fn new(id: ast::NodeId, _binding_mode: BindingMode) -> Self { + fn new(id: hir::HirId, _binding_mode: BindingMode) -> Self { GuardFrameLocal { id: id, } @@ -650,7 +649,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, mutability: Mutability::Not, }; if let Some(Node::Binding(pat)) = tcx_hir.find(var_node_id) { - if let hir::PatKind::Binding(_, _, _, ident, _) = pat.node { + if let hir::PatKind::Binding(_, _, ident, _) = pat.node { decl.debug_name = ident.name; if let Some(&bm) = hir.tables.pat_binding_modes().get(pat.hir_id) { if bm == ty::BindByValue(hir::MutMutable) { @@ -855,8 +854,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let mut name = None; if let Some(pat) = pattern { match pat.node { - hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, _, ident, _) - | hir::PatKind::Binding(hir::BindingAnnotation::Mutable, _, _, ident, _) => { + hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, ident, _) + | hir::PatKind::Binding(hir::BindingAnnotation::Mutable, _, ident, _) => { name = Some(ident.name); } _ => (), diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 4e3702b478b3..f1a22b222217 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -992,7 +992,7 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, let temp_lifetime = cx.region_scope_tree.temporary_scope(expr.hir_id.local_id); match def { - Def::Local(id) => ExprKind::VarRef { id }, + Def::Local(id) => ExprKind::VarRef { id: cx.tcx.hir().node_to_hir_id(id) }, Def::Upvar(var_id, index, closure_expr_id) => { debug!("convert_var(upvar({:?}, {:?}, {:?}))", diff --git a/src/librustc_mir/hair/mod.rs b/src/librustc_mir/hair/mod.rs index 6707b01ccc11..385249ec1c13 100644 --- a/src/librustc_mir/hair/mod.rs +++ b/src/librustc_mir/hair/mod.rs @@ -12,7 +12,6 @@ use rustc::ty::subst::SubstsRef; use rustc::ty::{AdtDef, UpvarSubsts, Ty, Const, LazyConst, UserType}; use rustc::ty::layout::VariantIdx; use rustc::hir; -use syntax::ast; use syntax_pos::Span; use self::cx::Cx; @@ -230,7 +229,7 @@ pub enum ExprKind<'tcx> { index: ExprRef<'tcx>, }, VarRef { - id: ast::NodeId, + id: hir::HirId, }, /// first argument, used for self in a closure SelfRef, diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index c8fb4f99d018..9768706b37ea 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -315,7 +315,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { fn check_for_bindings_named_same_as_variants(cx: &MatchVisitor<'_, '_>, pat: &Pat) { pat.walk(|p| { - if let PatKind::Binding(_, _, _, ident, None) = p.node { + if let PatKind::Binding(_, _, ident, None) = p.node { if let Some(&bm) = cx.tables.pat_binding_modes().get(p.hir_id) { if bm != ty::BindByValue(hir::MutImmutable) { // Nothing to check. @@ -590,7 +590,7 @@ fn check_legality_of_move_bindings( for pat in pats { pat.walk(|p| { - if let PatKind::Binding(_, _, _, _, ref sub) = p.node { + if let PatKind::Binding(_, _, _, ref sub) = p.node { if let Some(&bm) = cx.tables.pat_binding_modes().get(p.hir_id) { match bm { ty::BindByValue(..) => { diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index d5f2e7a7275e..55547cd0bc64 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -126,7 +126,7 @@ pub enum PatternKind<'tcx> { mutability: Mutability, name: ast::Name, mode: BindingMode, - var: ast::NodeId, + var: hir::HirId, ty: Ty<'tcx>, subpattern: Option>, }, @@ -559,7 +559,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { } } - PatKind::Binding(_, id, _, ident, ref sub) => { + PatKind::Binding(_, id, ident, ref sub) => { let var_ty = self.tables.node_type(pat.hir_id); if let ty::Error = var_ty.sty { // Avoid ICE @@ -1090,7 +1090,7 @@ macro_rules! CloneImpls { } CloneImpls!{ <'tcx> - Span, Field, Mutability, ast::Name, ast::NodeId, usize, ty::Const<'tcx>, + Span, Field, Mutability, ast::Name, hir::HirId, usize, ty::Const<'tcx>, Region<'tcx>, Ty<'tcx>, BindingMode, &'tcx AdtDef, SubstsRef<'tcx>, &'tcx Kind<'tcx>, UserType<'tcx>, UserTypeProjection<'tcx>, PatternTypeProjection<'tcx> diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index af3f54187b0c..d80f3e5ce759 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -647,7 +647,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { Node::Binding(&hir::Pat { node: hir::PatKind::Binding(_, canonical_id, ..), .. - }) => HirDef::Local(canonical_id), + }) => HirDef::Local(self.tcx.hir().hir_to_node_id(canonical_id)), Node::Ty(ty) => if let hir::Ty { node: hir::TyKind::Path(ref qpath), diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index e27672842dbc..1a3ade7f8baf 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -227,7 +227,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.demand_eqtype_pat(pat.span, expected, rhs_ty, match_discrim_span); common_type } - PatKind::Binding(ba, _, var_id, _, ref sub) => { + PatKind::Binding(ba, var_id, _, ref sub) => { let bm = if ba == hir::BindingAnnotation::Unannotated { def_bm } else { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 8fe713d096d8..423b2fd00210 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1004,7 +1004,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for GatherLocalsVisitor<'a, 'gcx, 'tcx> { // Add pattern bindings. fn visit_pat(&mut self, p: &'gcx hir::Pat) { - if let PatKind::Binding(_, _, _, ident, _) = p.node { + if let PatKind::Binding(_, _, ident, _) = p.node { let var_ty = self.assign(p.span, p.hir_id, None); let node_id = self.fcx.tcx.hir().hir_to_node_id(p.hir_id); diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 29f8c30e33ee..5a1b4d2f8ce7 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -3869,7 +3869,7 @@ fn name_from_pat(p: &hir::Pat) -> String { match p.node { PatKind::Wild => "_".to_string(), - PatKind::Binding(_, _, _, ident, _) => ident.to_string(), + PatKind::Binding(_, _, ident, _) => ident.to_string(), PatKind::TupleStruct(ref p, ..) | PatKind::Path(ref p) => qpath_to_string(p), PatKind::Struct(ref name, ref fields, etc) => { format!("{} {{ {}{} }}", qpath_to_string(name), From 42fbcb567c30aa79b2f6d5167b8364fa18d4d51d Mon Sep 17 00:00:00 2001 From: ljedrz Date: Thu, 7 Mar 2019 12:43:27 +0100 Subject: [PATCH 300/381] hir: replace NodeId with HirId in Destination --- src/librustc/cfg/construct.rs | 8 ++++---- src/librustc/hir/intravisit.rs | 4 ++++ src/librustc/hir/lowering.rs | 7 ++++--- src/librustc/hir/mod.rs | 2 +- src/librustc/middle/liveness.rs | 16 +++++++--------- src/librustc_mir/hair/cx/expr.rs | 4 ++-- src/librustc_passes/loops.rs | 17 ++++++++--------- src/librustc_typeck/check/mod.rs | 1 - 8 files changed, 30 insertions(+), 29 deletions(-) diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs index 30a0477467d8..e96709f6d14e 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -571,9 +571,9 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { match destination.target_id { Ok(loop_id) => { for b in &self.breakable_block_scopes { - if b.block_expr_id == self.tcx.hir().node_to_hir_id(loop_id).local_id { + if b.block_expr_id == loop_id.local_id { let scope = region::Scope { - id: self.tcx.hir().node_to_hir_id(loop_id).local_id, + id: loop_id.local_id, data: region::ScopeData::Node }; return (scope, match scope_cf_kind { @@ -583,9 +583,9 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } } for l in &self.loop_scopes { - if l.loop_id == self.tcx.hir().node_to_hir_id(loop_id).local_id { + if l.loop_id == loop_id.local_id { let scope = region::Scope { - id: self.tcx.hir().node_to_hir_id(loop_id).local_id, + id: loop_id.local_id, data: region::ScopeData::Node }; return (scope, match scope_cf_kind { diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 3c70df746124..bcfd832855cf 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -1064,18 +1064,22 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) { ExprKind::Break(ref destination, ref opt_expr) => { if let Some(ref label) = destination.label { visitor.visit_label(label); + /* if let Ok(node_id) = destination.target_id { visitor.visit_def_mention(Def::Label(node_id)) } + */ } walk_list!(visitor, visit_expr, opt_expr); } ExprKind::Continue(ref destination) => { if let Some(ref label) = destination.label { visitor.visit_label(label); + /* if let Ok(node_id) = destination.target_id { visitor.visit_def_mention(Def::Label(node_id)) } + */ } } ExprKind::Ret(ref optional_expression) => { diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index bcd2e500085c..949fdd2682b9 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -1068,7 +1068,7 @@ impl<'a> LoweringContext<'a> { let target_id = match destination { Some((id, _)) => { if let Def::Label(loop_id) = self.expect_full_def(id) { - Ok(self.lower_node_id(loop_id).node_id) + Ok(self.lower_node_id(loop_id).hir_id) } else { Err(hir::LoopIdError::UnresolvedLabel) } @@ -1077,7 +1077,7 @@ impl<'a> LoweringContext<'a> { self.loop_scopes .last() .cloned() - .map(|id| Ok(self.lower_node_id(id).node_id)) + .map(|id| Ok(self.lower_node_id(id).hir_id)) .unwrap_or(Err(hir::LoopIdError::OutsideLoopScope)) .into() } @@ -4564,12 +4564,13 @@ impl<'a> LoweringContext<'a> { let thin_attrs = ThinVec::from(attrs); let catch_scope = self.catch_scopes.last().map(|x| *x); let ret_expr = if let Some(catch_node) = catch_scope { + let target_id = Ok(self.lower_node_id(catch_node).hir_id); P(self.expr( e.span, hir::ExprKind::Break( hir::Destination { label: None, - target_id: Ok(catch_node), + target_id, }, Some(from_err_expr), ), diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index e24940f5f611..1a8ea1e79941 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1618,7 +1618,7 @@ pub struct Destination { // These errors are caught and then reported during the diagnostics pass in // librustc_passes/loops.rs - pub target_id: Result, + pub target_id: Result, } #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 35b8e08a5d53..2fafc57ce4b2 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -102,7 +102,7 @@ use crate::hir::Node; use crate::ty::{self, TyCtxt}; use crate::ty::query::Providers; use crate::lint; -use crate::util::nodemap::{NodeMap, HirIdMap, HirIdSet}; +use crate::util::nodemap::{HirIdMap, HirIdSet}; use errors::Applicability; use std::collections::{BTreeMap, VecDeque}; @@ -669,8 +669,8 @@ struct Liveness<'a, 'tcx: 'a> { // mappings from loop node ID to LiveNode // ("break" label should map to loop node ID, // it probably doesn't now) - break_ln: NodeMap, - cont_ln: NodeMap, + break_ln: HirIdMap, + cont_ln: HirIdMap, } impl<'a, 'tcx> Liveness<'a, 'tcx> { @@ -951,8 +951,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { fn propagate_through_block(&mut self, blk: &hir::Block, succ: LiveNode) -> LiveNode { if blk.targeted_by_break { - let node_id = self.ir.tcx.hir().hir_to_node_id(blk.hir_id); - self.break_ln.insert(node_id, succ); + self.break_ln.insert(blk.hir_id, succ); } let succ = self.propagate_through_opt_expr(blk.expr.as_ref().map(|e| &**e), succ); blk.stmts.iter().rev().fold(succ, |succ, stmt| { @@ -1111,7 +1110,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { hir::ExprKind::Break(label, ref opt_expr) => { // Find which label this break jumps to let target = match label.target_id { - Ok(node_id) => self.break_ln.get(&node_id), + Ok(hir_id) => self.break_ln.get(&hir_id), Err(err) => span_bug!(expr.span, "loop scope error: {}", err), }.cloned(); @@ -1390,15 +1389,14 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { debug!("propagate_through_loop: using id for loop body {} {}", expr.hir_id, self.ir.tcx.hir().hir_to_pretty_string(body.hir_id)); - let node_id = self.ir.tcx.hir().hir_to_node_id(expr.hir_id); - self.break_ln.insert(node_id, succ); + self.break_ln.insert(expr.hir_id, succ); let cond_ln = match kind { LoopLoop => ln, WhileLoop(ref cond) => self.propagate_through_expr(&cond, ln), }; - self.cont_ln.insert(node_id, cond_ln); + self.cont_ln.insert(expr.hir_id, cond_ln); let body_ln = self.propagate_through_block(body, cond_ln); diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index f1a22b222217..6af45957acf0 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -591,7 +591,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, match dest.target_id { Ok(target_id) => ExprKind::Break { label: region::Scope { - id: cx.tcx.hir().node_to_hir_id(target_id).local_id, + id: target_id.local_id, data: region::ScopeData::Node }, value: value.to_ref(), @@ -603,7 +603,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, match dest.target_id { Ok(loop_id) => ExprKind::Continue { label: region::Scope { - id: cx.tcx.hir().node_to_hir_id(loop_id).local_id, + id: loop_id.local_id, data: region::ScopeData::Node }, }, diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index 533e043efa9d..2272ac97cdda 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -8,7 +8,6 @@ use rustc::hir::def_id::DefId; use rustc::hir::map::Map; use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap}; use rustc::hir::{self, Node, Destination}; -use syntax::ast; use syntax::struct_span_err; use syntax_pos::Span; use errors::Applicability; @@ -105,25 +104,25 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { let loop_id = match label.target_id.into() { Ok(loop_id) => loop_id, - Err(hir::LoopIdError::OutsideLoopScope) => ast::DUMMY_NODE_ID, + Err(hir::LoopIdError::OutsideLoopScope) => hir::DUMMY_HIR_ID, Err(hir::LoopIdError::UnlabeledCfInWhileCondition) => { self.emit_unlabled_cf_in_while_condition(e.span, "break"); - ast::DUMMY_NODE_ID + hir::DUMMY_HIR_ID }, - Err(hir::LoopIdError::UnresolvedLabel) => ast::DUMMY_NODE_ID, + Err(hir::LoopIdError::UnresolvedLabel) => hir::DUMMY_HIR_ID, }; - if loop_id != ast::DUMMY_NODE_ID { - if let Node::Block(_) = self.hir_map.find(loop_id).unwrap() { + if loop_id != hir::DUMMY_HIR_ID { + if let Node::Block(_) = self.hir_map.find_by_hir_id(loop_id).unwrap() { return } } if opt_expr.is_some() { - let loop_kind = if loop_id == ast::DUMMY_NODE_ID { + let loop_kind = if loop_id == hir::DUMMY_HIR_ID { None } else { - Some(match self.hir_map.expect_expr(loop_id).node { + Some(match self.hir_map.expect_expr_by_hir_id(loop_id).node { hir::ExprKind::While(..) => LoopKind::WhileLoop, hir::ExprKind::Loop(_, _, source) => LoopKind::Loop(source), ref r => span_bug!(e.span, @@ -162,7 +161,7 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { match destination.target_id { Ok(loop_id) => { - if let Node::Block(block) = self.hir_map.find(loop_id).unwrap() { + if let Node::Block(block) = self.hir_map.find_by_hir_id(loop_id).unwrap() { struct_span_err!(self.sess, e.span, E0696, "`continue` pointing to a labeled block") .span_label(e.span, diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 423b2fd00210..2882ed47f12c 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -4262,7 +4262,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } ExprKind::Break(destination, ref expr_opt) => { if let Ok(target_id) = destination.target_id { - let target_id = tcx.hir().node_to_hir_id(target_id); let (e_ty, cause); if let Some(ref e) = *expr_opt { // If this is a break with a value, we need to type-check From e780daf372886ac3e30e6d4580a0505da3471d02 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Thu, 7 Mar 2019 12:52:38 +0100 Subject: [PATCH 301/381] hir: remove Visitor::visit_def_mention --- src/librustc/hir/intravisit.rs | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index bcfd832855cf..977830315e23 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -34,7 +34,6 @@ use syntax::ast::{Ident, Name, Attribute}; use syntax_pos::Span; use crate::hir::*; -use crate::hir::def::Def; use crate::hir::map::Map; use super::itemlikevisit::DeepVisitor; @@ -228,9 +227,6 @@ pub trait Visitor<'v> : Sized { fn visit_id(&mut self, _hir_id: HirId) { // Nothing to do. } - fn visit_def_mention(&mut self, _def: Def) { - // Nothing to do. - } fn visit_name(&mut self, _span: Span, _name: Name) { // Nothing to do. } @@ -494,13 +490,10 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) { visitor.visit_ty(typ); visitor.visit_generics(type_parameters) } - ItemKind::Existential(ExistTy {ref generics, ref bounds, impl_trait_fn}) => { + ItemKind::Existential(ExistTy { ref generics, ref bounds, impl_trait_fn: _ }) => { visitor.visit_id(item.hir_id); walk_generics(visitor, generics); walk_list!(visitor, visit_param_bound, bounds); - if let Some(impl_trait_fn) = impl_trait_fn { - visitor.visit_def_mention(Def::Fn(impl_trait_fn)) - } } ItemKind::Enum(ref enum_definition, ref type_parameters) => { visitor.visit_generics(type_parameters); @@ -640,7 +633,6 @@ pub fn walk_qpath<'v, V: Visitor<'v>>(visitor: &mut V, qpath: &'v QPath, id: Hir } pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v Path) { - visitor.visit_def_mention(path.def); for segment in &path.segments { visitor.visit_path_segment(path.span, segment); } @@ -698,7 +690,6 @@ pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat) { visitor.visit_pat(subpattern) } PatKind::Binding(_, _hir_id, ident, ref optional_subpattern) => { - // visitor.visit_def_mention(Def::Local(hir_id)); visitor.visit_ident(ident); walk_list!(visitor, visit_pat, optional_subpattern); } @@ -1064,22 +1055,12 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) { ExprKind::Break(ref destination, ref opt_expr) => { if let Some(ref label) = destination.label { visitor.visit_label(label); - /* - if let Ok(node_id) = destination.target_id { - visitor.visit_def_mention(Def::Label(node_id)) - } - */ } walk_list!(visitor, visit_expr, opt_expr); } ExprKind::Continue(ref destination) => { if let Some(ref label) = destination.label { visitor.visit_label(label); - /* - if let Ok(node_id) = destination.target_id { - visitor.visit_def_mention(Def::Label(node_id)) - } - */ } } ExprKind::Ret(ref optional_expression) => { From d7120e400de14f4827da4b9815c466e8b253a615 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Thu, 7 Mar 2019 15:46:41 +0100 Subject: [PATCH 302/381] hir: remove some obsolete NodeId methods --- src/librustc/hir/map/mod.rs | 56 ++++++++------------- src/librustc_metadata/encoder.rs | 4 +- src/librustc_typeck/check/compare_method.rs | 18 +++---- src/librustc_typeck/check/wfcheck.rs | 4 +- src/librustc_typeck/collect.rs | 4 +- 5 files changed, 36 insertions(+), 50 deletions(-) diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 1a03ced9b4e0..86b6805cc9b4 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -618,11 +618,11 @@ impl<'hir> Map<'hir> { } for id in &module.trait_items { - visitor.visit_trait_item(self.expect_trait_item_by_hir_id(id.hir_id)); + visitor.visit_trait_item(self.expect_trait_item(id.hir_id)); } for id in &module.impl_items { - visitor.visit_impl_item(self.expect_impl_item_by_hir_id(id.hir_id)); + visitor.visit_impl_item(self.expect_impl_item(id.hir_id)); } } @@ -929,66 +929,52 @@ impl<'hir> Map<'hir> { // FIXME(@ljedrz): replace the NodeId variant pub fn expect_item_by_hir_id(&self, id: HirId) -> &'hir Item { - let node_id = self.hir_to_node_id(id); - self.expect_item(node_id) - } - - pub fn expect_impl_item(&self, id: NodeId) -> &'hir ImplItem { - match self.find(id) { - Some(Node::ImplItem(item)) => item, - _ => bug!("expected impl item, found {}", self.node_to_string(id)) + match self.find_by_hir_id(id) { // read recorded by `find` + Some(Node::Item(item)) => item, + _ => bug!("expected item, found {}", self.hir_to_string(id)) } } - // FIXME(@ljedrz): replace the NodeId variant - pub fn expect_impl_item_by_hir_id(&self, id: HirId) -> &'hir ImplItem { - let node_id = self.hir_to_node_id(id); - self.expect_impl_item(node_id) + pub fn expect_impl_item(&self, id: HirId) -> &'hir ImplItem { + match self.find_by_hir_id(id) { + Some(Node::ImplItem(item)) => item, + _ => bug!("expected impl item, found {}", self.hir_to_string(id)) + } } - // FIXME(@ljedrz): replace the NodeId variant - pub fn expect_trait_item_by_hir_id(&self, id: HirId) -> &'hir TraitItem { - let node_id = self.hir_to_node_id(id); - self.expect_trait_item(node_id) - } - - pub fn expect_trait_item(&self, id: NodeId) -> &'hir TraitItem { - match self.find(id) { + pub fn expect_trait_item(&self, id: HirId) -> &'hir TraitItem { + match self.find_by_hir_id(id) { Some(Node::TraitItem(item)) => item, - _ => bug!("expected trait item, found {}", self.node_to_string(id)) + _ => bug!("expected trait item, found {}", self.hir_to_string(id)) } } pub fn expect_variant_data(&self, id: HirId) -> &'hir VariantData { - let id = self.hir_to_node_id(id); // FIXME(@ljedrz): remove when possible - - match self.find(id) { + match self.find_by_hir_id(id) { Some(Node::Item(i)) => { match i.node { ItemKind::Struct(ref struct_def, _) | ItemKind::Union(ref struct_def, _) => struct_def, - _ => bug!("struct ID bound to non-struct {}", self.node_to_string(id)) + _ => bug!("struct ID bound to non-struct {}", self.hir_to_string(id)) } } Some(Node::StructCtor(data)) => data, Some(Node::Variant(variant)) => &variant.node.data, - _ => bug!("expected struct or variant, found {}", self.node_to_string(id)) + _ => bug!("expected struct or variant, found {}", self.hir_to_string(id)) } } pub fn expect_variant(&self, id: HirId) -> &'hir Variant { - let id = self.hir_to_node_id(id); // FIXME(@ljedrz): remove when possible - - match self.find(id) { + match self.find_by_hir_id(id) { Some(Node::Variant(variant)) => variant, - _ => bug!("expected variant, found {}", self.node_to_string(id)), + _ => bug!("expected variant, found {}", self.hir_to_string(id)), } } - pub fn expect_foreign_item(&self, id: NodeId) -> &'hir ForeignItem { - match self.find(id) { + pub fn expect_foreign_item(&self, id: HirId) -> &'hir ForeignItem { + match self.find_by_hir_id(id) { Some(Node::ForeignItem(item)) => item, - _ => bug!("expected foreign item, found {}", self.node_to_string(id)) + _ => bug!("expected foreign item, found {}", self.hir_to_string(id)) } } diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 466231347e3e..f9bd6f6e1fbf 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -780,7 +780,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { let tcx = self.tcx; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); - let ast_item = tcx.hir().expect_trait_item_by_hir_id(hir_id); + let ast_item = tcx.hir().expect_trait_item(hir_id); let trait_item = tcx.associated_item(def_id); let container = match trait_item.defaultness { @@ -890,7 +890,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { let tcx = self.tcx; let hir_id = self.tcx.hir().as_local_hir_id(def_id).unwrap(); - let ast_item = self.tcx.hir().expect_impl_item_by_hir_id(hir_id); + let ast_item = self.tcx.hir().expect_impl_item(hir_id); let impl_item = self.tcx.associated_item(def_id); let container = match impl_item.defaultness { diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 292455e9d51c..1e5f5d244e9c 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -417,7 +417,7 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a let tcx = infcx.tcx; let impl_m_hir_id = tcx.hir().as_local_hir_id(impl_m.def_id).unwrap(); let (impl_m_output, impl_m_iter) = match tcx.hir() - .expect_impl_item_by_hir_id(impl_m_hir_id) + .expect_impl_item(impl_m_hir_id) .node { ImplItemKind::Method(ref impl_m_sig, _) => { (&impl_m_sig.decl.output, impl_m_sig.decl.inputs.iter()) @@ -429,7 +429,7 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a TypeError::Mutability => { if let Some(trait_m_hir_id) = tcx.hir().as_local_hir_id(trait_m.def_id) { let trait_m_iter = match tcx.hir() - .expect_trait_item_by_hir_id(trait_m_hir_id) + .expect_trait_item(trait_m_hir_id) .node { TraitItemKind::Method(ref trait_m_sig, _) => { trait_m_sig.decl.inputs.iter() @@ -456,7 +456,7 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a TypeError::Sorts(ExpectedFound { .. }) => { if let Some(trait_m_hir_id) = tcx.hir().as_local_hir_id(trait_m.def_id) { let (trait_m_output, trait_m_iter) = - match tcx.hir().expect_trait_item_by_hir_id(trait_m_hir_id).node { + match tcx.hir().expect_trait_item(trait_m_hir_id).node { TraitItemKind::Method(ref trait_m_sig, _) => { (&trait_m_sig.decl.output, trait_m_sig.decl.inputs.iter()) } @@ -599,8 +599,8 @@ fn compare_number_of_generics<'a, 'tcx>( if impl_count != trait_count { err_occurred = true; - let impl_node_id = tcx.hir().as_local_node_id(impl_.def_id).unwrap(); - let impl_item = tcx.hir().expect_impl_item(impl_node_id); + let impl_hir_id = tcx.hir().as_local_hir_id(impl_.def_id).unwrap(); + let impl_item = tcx.hir().expect_impl_item(impl_hir_id); let span = if impl_item.generics.params.is_empty() || impl_item.generics.span.is_dummy() { // argument position impl Trait (#55374) impl_span @@ -666,7 +666,7 @@ fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if trait_number_args != impl_number_args { let trait_m_hir_id = tcx.hir().as_local_hir_id(trait_m.def_id); let trait_span = if let Some(trait_id) = trait_m_hir_id { - match tcx.hir().expect_trait_item_by_hir_id(trait_id).node { + match tcx.hir().expect_trait_item(trait_id).node { TraitItemKind::Method(ref trait_m_sig, _) => { let pos = if trait_number_args > 0 { trait_number_args - 1 @@ -691,7 +691,7 @@ fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_item_span }; let impl_m_hir_id = tcx.hir().as_local_hir_id(impl_m.def_id).unwrap(); - let impl_span = match tcx.hir().expect_impl_item_by_hir_id(impl_m_hir_id).node { + let impl_span = match tcx.hir().expect_impl_item(impl_m_hir_id).node { ImplItemKind::Method(ref impl_m_sig, _) => { let pos = if impl_number_args > 0 { impl_number_args - 1 @@ -962,7 +962,7 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_ty); // Locate the Span containing just the type of the offending impl - match tcx.hir().expect_impl_item_by_hir_id(impl_c_hir_id).node { + match tcx.hir().expect_impl_item(impl_c_hir_id).node { ImplItemKind::Const(ref ty, _) => cause.span = ty.span, _ => bug!("{:?} is not a impl const", impl_c), } @@ -977,7 +977,7 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let trait_c_hir_id = tcx.hir().as_local_hir_id(trait_c.def_id); let trait_c_span = trait_c_hir_id.map(|trait_c_hir_id| { // Add a label to the Span containing just the type of the const - match tcx.hir().expect_trait_item_by_hir_id(trait_c_hir_id).node { + match tcx.hir().expect_trait_item(trait_c_hir_id).node { TraitItemKind::Const(ref ty, _) => ty.span, _ => bug!("{:?} is not a trait const", trait_c), } diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 208f443ffd93..c7bab8d17090 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -152,7 +152,7 @@ pub fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: Def pub fn check_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); - let trait_item = tcx.hir().expect_trait_item_by_hir_id(hir_id); + let trait_item = tcx.hir().expect_trait_item(hir_id); let method_sig = match trait_item.node { hir::TraitItemKind::Method(ref sig, _) => Some(sig), @@ -163,7 +163,7 @@ pub fn check_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { pub fn check_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); - let impl_item = tcx.hir().expect_impl_item_by_hir_id(hir_id); + let impl_item = tcx.hir().expect_impl_item(hir_id); let method_sig = match impl_item.node { hir::ImplItemKind::Method(ref sig, _) => Some(sig), diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index d4a1d3808696..fb5b06470b95 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -479,7 +479,7 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: hir::HirId) { } fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_item_id: hir::HirId) { - let trait_item = tcx.hir().expect_trait_item_by_hir_id(trait_item_id); + let trait_item = tcx.hir().expect_trait_item(trait_item_id); let def_id = tcx.hir().local_def_id_from_hir_id(trait_item.hir_id); tcx.generics_of(def_id); @@ -504,7 +504,7 @@ fn convert_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_item_id: hir::H tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); - if let hir::ImplItemKind::Method(..) = tcx.hir().expect_impl_item_by_hir_id(impl_item_id).node { + if let hir::ImplItemKind::Method(..) = tcx.hir().expect_impl_item(impl_item_id).node { tcx.fn_sig(def_id); } } From 1d72037dd39e3e53172d7605f22851b75f4e1a1b Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Thu, 7 Mar 2019 03:50:50 +0000 Subject: [PATCH 303/381] Fix segfaults in release build C-variadic fns `va_start` and `va_end` must be called to initialize/cleanup the "spoofed" `VaList` in a Rust defined C-variadic function even if the `VaList` is not used. --- src/librustc_codegen_ssa/mir/block.rs | 9 +++++++-- src/librustc_codegen_ssa/mir/mod.rs | 8 +------- src/test/codegen/c-variadic-opt.rs | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 src/test/codegen/c-variadic-opt.rs diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index 02086c7730ce..35fd30f34ad2 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -233,8 +233,13 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { mut bx: Bx, ) { if self.fn_ty.c_variadic { - if let Some(va_list) = self.va_list_ref { - bx.va_end(va_list.llval); + match self.va_list_ref { + Some(va_list) => { + bx.va_end(va_list.llval); + } + None => { + bug!("C-variadic function must have a `va_list_ref`"); + } } } let llval = match self.fn_ty.ret.mode { diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 870b97401f47..c1b7502cd8fb 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -532,13 +532,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( PassMode::Ignore(IgnoreMode::Zst) => { return local(OperandRef::new_zst(bx.cx(), arg.layout)); } - PassMode::Ignore(IgnoreMode::CVarArgs) => { - let backend_type = bx.cx().immediate_backend_type(arg.layout); - return local(OperandRef { - val: OperandValue::Immediate(bx.cx().const_undef(backend_type)), - layout: arg.layout, - }); - } + PassMode::Ignore(IgnoreMode::CVarArgs) => {} PassMode::Direct(_) => { let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint); bx.set_value_name(llarg, &name); diff --git a/src/test/codegen/c-variadic-opt.rs b/src/test/codegen/c-variadic-opt.rs new file mode 100644 index 000000000000..8594d309b0a5 --- /dev/null +++ b/src/test/codegen/c-variadic-opt.rs @@ -0,0 +1,19 @@ +// compile-flags: -C opt-level=3 + +#![crate_type = "lib"] +#![feature(c_variadic)] +#![no_std] +use core::ffi::VaList; + +extern "C" { + fn vprintf(fmt: *const i8, ap: VaList) -> i32; +} + +// Ensure that `va_start` and `va_end` are properly injected even +// when the "spoofed" `VaList` is not used. +#[no_mangle] +pub unsafe extern "C" fn c_variadic_no_use(fmt: *const i8, mut ap: ...) -> i32 { + // CHECK: call void @llvm.va_start + vprintf(fmt, ap) + // CHECK: call void @llvm.va_end +} From a7563a30c0576761a0770b196e9effbaaf846be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 7 Mar 2019 08:09:41 -0800 Subject: [PATCH 304/381] fix bad logic --- src/librustc_errors/diagnostic_builder.rs | 4 +++- src/librustc_errors/lib.rs | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index a995d808bc41..c8d47339fb36 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -103,7 +103,9 @@ impl<'a> DiagnosticBuilder<'a> { /// Buffers the diagnostic for later emission, unless handler /// has disabled such buffering. pub fn buffer(mut self, buffered_diagnostics: &mut Vec) { - if self.handler.flags.dont_buffer_diagnostics || self.handler.treat_err_as_bug() { + if self.handler.flags.dont_buffer_diagnostics || + self.handler.flags.treat_err_as_bug.is_some() + { self.emit(); return; } diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 3992d2908c78..7c7698ddd3d7 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -657,8 +657,7 @@ impl Handler { 1 => "aborting due to previous error".to_string(), _ => format!("aborting due to {} previous errors", self.err_count()) }; - let err_as_bug = self.flags.treat_err_as_bug.unwrap_or(0); - if self.err_count() >= err_as_bug { + if self.treat_err_as_bug() { return; } From bc9b93629051979cec6fd078511954388bd4e9f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 7 Mar 2019 11:15:47 -0800 Subject: [PATCH 305/381] Fix with_emitter callers --- src/librustc_driver/test.rs | 2 +- src/libsyntax/parse/lexer/mod.rs | 2 +- src/libsyntax/test_snippet.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index 65f8ce75bd11..3d52f1d44ba2 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -113,7 +113,7 @@ fn test_env_with_pool( ) where F: FnOnce(Env), { - let diagnostic_handler = errors::Handler::with_emitter(true, false, emitter); + let diagnostic_handler = errors::Handler::with_emitter(true, None, emitter); let sess = session::build_session_( options, None, diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index a7cde5fbb92c..db5b8dcda4ea 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1920,7 +1920,7 @@ mod tests { false, false); ParseSess { - span_diagnostic: errors::Handler::with_emitter(true, false, Box::new(emitter)), + span_diagnostic: errors::Handler::with_emitter(true, None, Box::new(emitter)), unstable_features: UnstableFeatures::from_environment(), config: CrateConfig::default(), included_mod_stack: Lock::new(Vec::new()), diff --git a/src/libsyntax/test_snippet.rs b/src/libsyntax/test_snippet.rs index cf39090e1888..2b3d18835d54 100644 --- a/src/libsyntax/test_snippet.rs +++ b/src/libsyntax/test_snippet.rs @@ -58,7 +58,7 @@ fn test_harness(file_text: &str, span_labels: Vec, expected_output: & Some(source_map.clone()), false, false); - let handler = Handler::with_emitter(true, false, Box::new(emitter)); + let handler = Handler::with_emitter(true, None, Box::new(emitter)); handler.span_err(msp, "foo"); assert!(expected_output.chars().next() == Some('\n'), From e3299f2c0d1802be5bef67666469670629612e31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 7 Mar 2019 11:18:05 -0800 Subject: [PATCH 306/381] Update treat-err-as-bug help text --- src/librustc/session/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 77fbe467ce01..7f48fd8a4012 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1244,7 +1244,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, no_codegen: bool = (false, parse_bool, [TRACKED], "run all passes except codegen; no output"), treat_err_as_bug: Option = (None, parse_treat_err_as_bug, [TRACKED], - "treat all errors that occur as bugs"), + "treat error number `val` that occurs as bug"), report_delayed_bugs: bool = (false, parse_bool, [TRACKED], "immediately print bugs registered with `delay_span_bug`"), external_macro_backtrace: bool = (false, parse_bool, [UNTRACKED], From 29716ef4f75e0d5cb11f788c2e449db4ea3989ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 7 Mar 2019 13:13:13 -0800 Subject: [PATCH 307/381] update treat-err-as-bug test --- src/test/run-make-fulldeps/treat-err-as-bug/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/run-make-fulldeps/treat-err-as-bug/Makefile b/src/test/run-make-fulldeps/treat-err-as-bug/Makefile index f99e4611174c..9b3bcef2faf3 100644 --- a/src/test/run-make-fulldeps/treat-err-as-bug/Makefile +++ b/src/test/run-make-fulldeps/treat-err-as-bug/Makefile @@ -2,4 +2,4 @@ all: $(RUSTC) err.rs -Z treat-err-as-bug 2>&1 \ - | $(CGREP) "panicked at 'encountered error with \`-Z treat_err_as_bug'" + | $(CGREP) "panicked at 'aborting due to \`-Z treat-err-as-bug=1\`'" From 8bb62d18f3645fd4fc83096a3fec3d7e30a7674b Mon Sep 17 00:00:00 2001 From: varkor Date: Thu, 7 Mar 2019 23:39:01 +0000 Subject: [PATCH 308/381] Add a test for invalid const arguments --- src/test/ui/const-generics/invalid-constant-in-args.rs | 3 +++ .../ui/const-generics/invalid-constant-in-args.stderr | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 src/test/ui/const-generics/invalid-constant-in-args.rs create mode 100644 src/test/ui/const-generics/invalid-constant-in-args.stderr diff --git a/src/test/ui/const-generics/invalid-constant-in-args.rs b/src/test/ui/const-generics/invalid-constant-in-args.rs new file mode 100644 index 000000000000..40df237ee72e --- /dev/null +++ b/src/test/ui/const-generics/invalid-constant-in-args.rs @@ -0,0 +1,3 @@ +fn main() { + let _: Vec<&str, "a"> = Vec::new(); //~ ERROR wrong number of const arguments +} diff --git a/src/test/ui/const-generics/invalid-constant-in-args.stderr b/src/test/ui/const-generics/invalid-constant-in-args.stderr new file mode 100644 index 000000000000..1623f645124a --- /dev/null +++ b/src/test/ui/const-generics/invalid-constant-in-args.stderr @@ -0,0 +1,9 @@ +error[E0107]: wrong number of const arguments: expected 0, found 1 + --> $DIR/invalid-constant-in-args.rs:2:22 + | +LL | let _: Vec<&str, "a"> = Vec::new(); //~ ERROR wrong number of const arguments + | ^^^ unexpected const argument + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`. From 63f60b06a273072887938eea6785c1ff080e2721 Mon Sep 17 00:00:00 2001 From: Nagy Tibor Date: Thu, 7 Mar 2019 21:24:46 +0100 Subject: [PATCH 309/381] Fix documentation of from_ne_bytes and from_le_bytes --- src/libcore/num/mod.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 502e3de8c637..a0cefe5bd5b9 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1979,10 +1979,10 @@ When starting from a slice rather than an array, fallible conversion APIs can be ``` use std::convert::TryInto; -fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { +fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); *input = rest; - ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) + ", stringify!($SelfT), "::from_le_bytes(int_bytes.try_into().unwrap()) } ```"), #[stable(feature = "int_to_from_bytes", since = "1.32.0")] @@ -2020,10 +2020,10 @@ When starting from a slice rather than an array, fallible conversion APIs can be ``` use std::convert::TryInto; -fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { +fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); *input = rest; - ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) + ", stringify!($SelfT), "::from_ne_bytes(int_bytes.try_into().unwrap()) } ```"), #[stable(feature = "int_to_from_bytes", since = "1.32.0")] @@ -3695,10 +3695,10 @@ When starting from a slice rather than an array, fallible conversion APIs can be ``` use std::convert::TryInto; -fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { +fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); *input = rest; - ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) + ", stringify!($SelfT), "::from_le_bytes(int_bytes.try_into().unwrap()) } ```"), #[stable(feature = "int_to_from_bytes", since = "1.32.0")] @@ -3736,10 +3736,10 @@ When starting from a slice rather than an array, fallible conversion APIs can be ``` use std::convert::TryInto; -fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { +fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); *input = rest; - ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) + ", stringify!($SelfT), "::from_ne_bytes(int_bytes.try_into().unwrap()) } ```"), #[stable(feature = "int_to_from_bytes", since = "1.32.0")] From 24fad4c145122ba4abfdcb3bdafb3f4a2f429ba6 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Fri, 8 Mar 2019 12:29:10 +0100 Subject: [PATCH 310/381] update clippy --- src/tools/clippy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/clippy b/src/tools/clippy index caccf8bd4c3d..5d78250c75db 160000 --- a/src/tools/clippy +++ b/src/tools/clippy @@ -1 +1 @@ -Subproject commit caccf8bd4c3d490d6a4cf329a3411bbf68753642 +Subproject commit 5d78250c75db3b1923072cf1be3b03f7d0cef5e2 From 98e40170be3d8016437d421828ffc36b43f676c2 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 20 Feb 2019 22:24:32 +0100 Subject: [PATCH 311/381] Temporarily emulate the (accidentally) omitted recursion during impl Trait check. Note that the two previous visitors were omitting slightly different recursive calls, so I need two flags to properly emulate them. --- src/librustc/lint/builtin.rs | 14 +++++ src/librustc_lint/lib.rs | 5 ++ src/librustc_passes/ast_validation.rs | 80 ++++++++++++++++++++++----- 3 files changed, 84 insertions(+), 15 deletions(-) diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 655707ff9bd0..ad0ed39185c1 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -386,6 +386,12 @@ declare_lint! { "ambiguous associated items" } +declare_lint! { + pub NESTED_IMPL_TRAIT, + Warn, + "nested occurrence of `impl Trait` type" +} + /// Does nothing as a lint pass, but registers some `Lint`s /// that are used by other parts of the compiler. #[derive(Copy, Clone)] @@ -457,6 +463,7 @@ impl LintPass for HardwiredLints { parser::ILL_FORMED_ATTRIBUTE_INPUT, DEPRECATED_IN_FUTURE, AMBIGUOUS_ASSOCIATED_ITEMS, + NESTED_IMPL_TRAIT, ) } } @@ -474,6 +481,7 @@ pub enum BuiltinLintDiagnostics { ElidedLifetimesInPaths(usize, Span, bool, Span, String), UnknownCrateTypes(Span, String, String), UnusedImports(String, Vec<(Span, String)>), + NestedImplTrait { outer_impl_trait_span: Span, inner_impl_trait_span: Span }, } impl BuiltinLintDiagnostics { @@ -564,6 +572,12 @@ impl BuiltinLintDiagnostics { ); } } + BuiltinLintDiagnostics::NestedImplTrait { + outer_impl_trait_span, inner_impl_trait_span + } => { + db.span_label(outer_impl_trait_span, "outer `impl Trait`"); + db.span_label(inner_impl_trait_span, "nested `impl Trait` here"); + } } } } diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 5c243e138907..5634faff00e6 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -353,6 +353,11 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { reference: "issue #57593 ", edition: None, }, + FutureIncompatibleInfo { + id: LintId::of(NESTED_IMPL_TRAIT), + reference: "issue #59014 ", + edition: None, + }, ]); // Register renamed and removed lints. diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index f96fc3b897f8..d5b02de96989 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -9,6 +9,7 @@ use std::mem; use syntax::print::pprust; use rustc::lint; +use rustc::lint::builtin::{BuiltinLintDiagnostics, NESTED_IMPL_TRAIT}; use rustc::session::Session; use rustc_data_structures::fx::FxHashMap; use syntax::ast::*; @@ -36,9 +37,32 @@ struct AstValidator<'a> { // Used to ban `impl Trait` in path projections like `::Item` // or `Foo::Bar` is_impl_trait_banned: bool, + + // rust-lang/rust#57979: the ban of nested `impl Trait` was buggy + // until sometime after PR #57730 landed: it would jump directly + // to walk_ty rather than visit_ty (or skip recurring entirely for + // impl trait in projections), and thus miss some cases. We track + // whether we should downgrade to a warning for short-term via + // these booleans. + warning_period_57979_nested_impl_trait: bool, + warning_period_57979_impl_trait_in_proj: bool, } impl<'a> AstValidator<'a> { + fn with_nested_impl_trait_warning(&mut self, v: bool, f: impl FnOnce(&mut Self) -> T) -> T { + let old = mem::replace(&mut self.warning_period_57979_nested_impl_trait, v); + let ret = f(self); + self.warning_period_57979_nested_impl_trait = old; + ret + } + + fn with_impl_trait_in_proj_warning(&mut self, v: bool, f: impl FnOnce(&mut Self) -> T) -> T { + let old = mem::replace(&mut self.warning_period_57979_impl_trait_in_proj, v); + let ret = f(self); + self.warning_period_57979_impl_trait_in_proj = old; + ret + } + fn with_banned_impl_trait(&mut self, f: impl FnOnce(&mut Self)) { let old = mem::replace(&mut self.is_impl_trait_banned, true); f(self); @@ -406,22 +430,41 @@ impl<'a> Visitor<'a> for AstValidator<'a> { } TyKind::ImplTrait(_, ref bounds) => { if self.is_impl_trait_banned { - struct_span_err!(self.session, ty.span, E0667, - "`impl Trait` is not allowed in path parameters").emit(); + if self.warning_period_57979_impl_trait_in_proj { + self.session.buffer_lint( + NESTED_IMPL_TRAIT, ty.id, ty.span, + "`impl Trait` is not allowed in path parameters"); + } else { + struct_span_err!(self.session, ty.span, E0667, + "`impl Trait` is not allowed in path parameters").emit(); + } } if let Some(outer_impl_trait) = self.outer_impl_trait { - struct_span_err!(self.session, ty.span, E0666, - "nested `impl Trait` is not allowed") - .span_label(outer_impl_trait, "outer `impl Trait`") - .span_label(ty.span, "nested `impl Trait` here") - .emit(); - + if self.warning_period_57979_nested_impl_trait { + self.session.buffer_lint_with_diagnostic( + NESTED_IMPL_TRAIT, ty.id, ty.span, + "nested `impl Trait` is not allowed", + BuiltinLintDiagnostics::NestedImplTrait { + outer_impl_trait_span: outer_impl_trait, + inner_impl_trait_span: ty.span, + }); + } else { + struct_span_err!(self.session, ty.span, E0666, + "nested `impl Trait` is not allowed") + .span_label(outer_impl_trait, "outer `impl Trait`") + .span_label(ty.span, "nested `impl Trait` here") + .emit(); + } } + if !bounds.iter() .any(|b| if let GenericBound::Trait(..) = *b { true } else { false }) { self.err_handler().span_err(ty.span, "at least one trait must be specified"); } + + self.with_impl_trait_in_proj_warning(true, |this| this.walk_ty(ty)); + return; } _ => {} } @@ -606,18 +649,23 @@ impl<'a> Visitor<'a> for AstValidator<'a> { GenericArg::Const(..) => ParamKindOrd::Const, }, arg.span(), None) }), GenericPosition::Arg, generic_args.span()); - // Type bindings such as `Item=impl Debug` in `Iterator` - // are allowed to contain nested `impl Trait`. - self.with_impl_trait(None, |this| { - walk_list!(this, visit_assoc_type_binding, &data.bindings); + + self.with_nested_impl_trait_warning(true, |this| { + // Type bindings such as `Item=impl Debug` in `Iterator` + // are allowed to contain nested `impl Trait`. + this.with_impl_trait(None, |this| { + walk_list!(this, visit_assoc_type_binding, &data.bindings); + }); }); } GenericArgs::Parenthesized(ref data) => { walk_list!(self, visit_ty, &data.inputs); if let Some(ref type_) = data.output { - // `-> Foo` syntax is essentially an associated type binding, - // so it is also allowed to contain nested `impl Trait`. - self.with_impl_trait(None, |this| this.visit_ty(type_)); + self.with_nested_impl_trait_warning(true, |this| { + // `-> Foo` syntax is essentially an associated type binding, + // so it is also allowed to contain nested `impl Trait`. + this.with_impl_trait(None, |this| this.visit_ty(type_)); + }); } } } @@ -719,6 +767,8 @@ pub fn check_crate(session: &Session, krate: &Crate) -> (bool, bool) { has_global_allocator: false, outer_impl_trait: None, is_impl_trait_banned: false, + warning_period_57979_nested_impl_trait: false, + warning_period_57979_impl_trait_in_proj: false, }; visit::walk_crate(&mut validator, krate); From d6cee67c27cae727e24f266f76d6613e2781f7b6 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 22 Feb 2019 15:10:12 +0100 Subject: [PATCH 312/381] Unit (and regression) tests for warning cycle code. --- .../issue-57979-impl-trait-in-path.rs | 37 ++++++++++++++++ .../issue-57979-impl-trait-in-path.stderr | 30 +++++++++++++ ...e-57979-nested-impl-trait-in-assoc-proj.rs | 37 ++++++++++++++++ ...979-nested-impl-trait-in-assoc-proj.stderr | 36 ++++++++++++++++ src/test/ui/issues/issue-57979.rs | 42 ------------------- src/test/ui/issues/issue-57979.stderr | 17 -------- 6 files changed, 140 insertions(+), 59 deletions(-) create mode 100644 src/test/ui/impl-trait/issue-57979-impl-trait-in-path.rs create mode 100644 src/test/ui/impl-trait/issue-57979-impl-trait-in-path.stderr create mode 100644 src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.rs create mode 100644 src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.stderr delete mode 100644 src/test/ui/issues/issue-57979.rs delete mode 100644 src/test/ui/issues/issue-57979.stderr diff --git a/src/test/ui/impl-trait/issue-57979-impl-trait-in-path.rs b/src/test/ui/impl-trait/issue-57979-impl-trait-in-path.rs new file mode 100644 index 000000000000..84fcb5e2880a --- /dev/null +++ b/src/test/ui/impl-trait/issue-57979-impl-trait-in-path.rs @@ -0,0 +1,37 @@ +// rust-lang/rust#57979 : the initial support for `impl Trait` didn't +// properly check syntax hidden behind an associated type projection. +// Here we test behavior of occurrences of `impl Trait` within a path +// component in that context. + +mod allowed { + #![allow(nested_impl_trait)] + + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } + impl Quux for () { type Assoc = u32; } +} + +mod warned { + #![warn(nested_impl_trait)] + + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } + //~^ WARN `impl Trait` is not allowed in path parameters + //~| WARN will become a hard error in a future release! + impl Quux for () { type Assoc = u32; } +} + +mod denied { + #![deny(nested_impl_trait)] + + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } + //~^ ERROR `impl Trait` is not allowed in path parameters + //~| WARN will become a hard error in a future release! + impl Quux for () { type Assoc = u32; } +} + +fn main() { } diff --git a/src/test/ui/impl-trait/issue-57979-impl-trait-in-path.stderr b/src/test/ui/impl-trait/issue-57979-impl-trait-in-path.stderr new file mode 100644 index 000000000000..982ecba291f7 --- /dev/null +++ b/src/test/ui/impl-trait/issue-57979-impl-trait-in-path.stderr @@ -0,0 +1,30 @@ +warning: `impl Trait` is not allowed in path parameters + --> $DIR/issue-57979-impl-trait-in-path.rs:20:52 + | +LL | pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } + | ^^^^^^^^ + | +note: lint level defined here + --> $DIR/issue-57979-impl-trait-in-path.rs:16:13 + | +LL | #![warn(nested_impl_trait)] + | ^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #59014 + +error: `impl Trait` is not allowed in path parameters + --> $DIR/issue-57979-impl-trait-in-path.rs:31:52 + | +LL | pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } + | ^^^^^^^^ + | +note: lint level defined here + --> $DIR/issue-57979-impl-trait-in-path.rs:27:13 + | +LL | #![deny(nested_impl_trait)] + | ^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #59014 + +error: aborting due to previous error + diff --git a/src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.rs b/src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.rs new file mode 100644 index 000000000000..5c20ffc7c672 --- /dev/null +++ b/src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.rs @@ -0,0 +1,37 @@ +// rust-lang/rust#57979 : the initial support for `impl Trait` didn't +// properly check syntax hidden behind an associated type projection. +// Here we test behavior of occurrences of `impl Trait` within an +// `impl Trait` in that context. + +mod allowed { + #![allow(nested_impl_trait)] + + pub trait Foo { } + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux>) { } +} + +mod warned { + #![warn(nested_impl_trait)] + + pub trait Foo { } + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux>) { } + //~^ WARN nested `impl Trait` is not allowed + //~| WARN will become a hard error in a future release! +} + +mod denied { + #![deny(nested_impl_trait)] + + pub trait Foo { } + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux>) { } + //~^ ERROR nested `impl Trait` is not allowed + //~| WARN will become a hard error in a future release! +} + +fn main() { } diff --git a/src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.stderr b/src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.stderr new file mode 100644 index 000000000000..508aea243213 --- /dev/null +++ b/src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.stderr @@ -0,0 +1,36 @@ +warning: nested `impl Trait` is not allowed + --> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:21:45 + | +LL | pub fn demo(_: impl Quux>) { } + | ---------^^^^^^^^- + | | | + | | nested `impl Trait` here + | outer `impl Trait` + | +note: lint level defined here + --> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:16:13 + | +LL | #![warn(nested_impl_trait)] + | ^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #59014 + +error: nested `impl Trait` is not allowed + --> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:32:45 + | +LL | pub fn demo(_: impl Quux>) { } + | ---------^^^^^^^^- + | | | + | | nested `impl Trait` here + | outer `impl Trait` + | +note: lint level defined here + --> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:27:13 + | +LL | #![deny(nested_impl_trait)] + | ^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #59014 + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-57979.rs b/src/test/ui/issues/issue-57979.rs deleted file mode 100644 index abd46b60ab19..000000000000 --- a/src/test/ui/issues/issue-57979.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Regression test for #57979. This situation is meant to be an error. -// As noted in the issue thread, we decided to forbid nested impl -// trait of this kind: -// -// ```rust -// fn foo() -> impl Foo { .. } -// ``` -// -// Basically there are two hidden variables here, let's call them `X` -// and `Y`, and we must prove that: -// -// ``` -// X: Foo -// Y: Bar -// ``` -// -// However, the user is only giving us the return type `X`. It's true -// that in some cases, we can infer `Y` from `X`, because `X` only -// implements `Foo` for one type (and indeed the compiler does -// inference of this kind), but I do recall that we intended to forbid -// this -- in part because such inference is fragile, and there is not -// necessarily a way for the user to be more explicit should the -// inference fail (so you could get stuck with no way to port your -// code forward if, for example, more impls are added to an existing -// type). -// -// The same seems to apply in this situation. Here there are three impl traits, so we have -// -// ``` -// X: IntoIterator -// Y: Borrow> -// Z: AsRef<[u8]> -// ``` - -use std::borrow::Borrow; - -pub struct Data(TBody); - -pub fn collect(_: impl IntoIterator>>>) { - //~^ ERROR - unimplemented!() -} diff --git a/src/test/ui/issues/issue-57979.stderr b/src/test/ui/issues/issue-57979.stderr deleted file mode 100644 index 488f30ab7c5a..000000000000 --- a/src/test/ui/issues/issue-57979.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0666]: nested `impl Trait` is not allowed - --> $DIR/issue-57979.rs:39:61 - | -LL | pub fn collect(_: impl IntoIterator>>>) { - | -----------------^^^^^^^^^^^^^^^^-- - | | | - | | nested `impl Trait` here - | outer `impl Trait` - -error[E0601]: `main` function not found in crate `issue_57979` - | - = note: consider adding a `main` function to `$DIR/issue-57979.rs` - -error: aborting due to 2 previous errors - -Some errors occurred: E0601, E0666. -For more information about an error, try `rustc --explain E0601`. From 6465257e5442b489a1d4469d3f613aeb637e3665 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 8 Mar 2019 07:41:19 -0800 Subject: [PATCH 313/381] std: Delete a by-definition spuriously failing test This commit deletes the `connect_timeout_unbound` test from the standard library which, unfortunately, is by definition eventually going to be a spuriously failing test. There's no way to reserve a port as unbound so we can rely on ecosystem testing for this feature for now. Closes #52590 --- src/libstd/net/tcp.rs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index 275557da96f6..ce0c5c0bb0dc 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -1742,21 +1742,6 @@ mod tests { }) } - #[test] - fn connect_timeout_unbound() { - // bind and drop a socket to track down a "probably unassigned" port - let socket = TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = socket.local_addr().unwrap(); - drop(socket); - - let timeout = Duration::from_secs(1); - let e = TcpStream::connect_timeout(&addr, timeout).unwrap_err(); - assert!(e.kind() == io::ErrorKind::ConnectionRefused || - e.kind() == io::ErrorKind::TimedOut || - e.kind() == io::ErrorKind::Other, - "bad error: {} {:?}", e, e.kind()); - } - #[test] fn connect_timeout_valid() { let listener = TcpListener::bind("127.0.0.1:0").unwrap(); From 018d4d265fb40ea4301da5dc339bff962a6faa57 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Wed, 23 Jan 2019 13:44:43 -0500 Subject: [PATCH 314/381] improve unused doc comment diagnostic reporting Report all unused attributes on a given doc comment instead of just the first one, and extend the span of sugared doc comments to encompass the whole comment. --- src/librustc_lint/builtin.rs | 41 +++++++++++++++++++++++------- src/test/ui/useless_comment.rs | 8 +++++- src/test/ui/useless_comment.stderr | 24 +++++++++++++---- 3 files changed, 58 insertions(+), 15 deletions(-) diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index aafae28b49ea..284bfcd40149 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -802,27 +802,50 @@ impl LintPass for UnusedDocComment { } impl UnusedDocComment { - fn warn_if_doc<'a, 'tcx, - I: Iterator, - C: LintContext<'tcx>>(&self, mut attrs: I, cx: &C) { - if let Some(attr) = attrs.find(|a| a.is_value_str() && a.check_name("doc")) { - cx.struct_span_lint(UNUSED_DOC_COMMENTS, attr.span, "doc comment not used by rustdoc") - .emit(); + fn warn_if_doc(&self, cx: &EarlyContext, attrs: &[ast::Attribute]) { + let mut attrs = attrs.into_iter().peekable(); + + // Accumulate a single span for sugared doc comments. + let mut sugared_span: Option = None; + + while let Some(attr) = attrs.next() { + if attr.is_sugared_doc { + sugared_span = Some( + sugared_span.map_or_else( + || attr.span, + |span| span.with_hi(attr.span.hi()), + ), + ); + } + + if attrs.peek().map(|next_attr| next_attr.is_sugared_doc).unwrap_or_default() { + continue; + } + + let span = sugared_span.take().unwrap_or_else(|| attr.span); + + if attr.name() == "doc" { + cx.struct_span_lint( + UNUSED_DOC_COMMENTS, + span, + "doc comment not used by rustdoc", + ).emit(); + } } } } impl EarlyLintPass for UnusedDocComment { fn check_local(&mut self, cx: &EarlyContext<'_>, decl: &ast::Local) { - self.warn_if_doc(decl.attrs.iter(), cx); + self.warn_if_doc(cx, &decl.attrs); } fn check_arm(&mut self, cx: &EarlyContext<'_>, arm: &ast::Arm) { - self.warn_if_doc(arm.attrs.iter(), cx); + self.warn_if_doc(cx, &arm.attrs); } fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) { - self.warn_if_doc(expr.attrs.iter(), cx); + self.warn_if_doc(cx, &expr.attrs); } } diff --git a/src/test/ui/useless_comment.rs b/src/test/ui/useless_comment.rs index 531eec007fc4..e8a0e3c10d22 100644 --- a/src/test/ui/useless_comment.rs +++ b/src/test/ui/useless_comment.rs @@ -4,7 +4,9 @@ fn foo() { /// a //~ ERROR doc comment not used by rustdoc let x = 12; - /// b //~ doc comment not used by rustdoc + /// multi-line //~ doc comment not used by rustdoc + /// doc comment + /// that is unused match x { /// c //~ ERROR doc comment not used by rustdoc 1 => {}, @@ -13,6 +15,10 @@ fn foo() { /// foo //~ ERROR doc comment not used by rustdoc unsafe {} + + #[doc = "foo"] //~ ERROR doc comment not used by rustdoc + #[doc = "bar"] //~ ERROR doc comment not used by rustdoc + 3; } fn main() { diff --git a/src/test/ui/useless_comment.stderr b/src/test/ui/useless_comment.stderr index cc818f6ce7c3..a284c08f47ac 100644 --- a/src/test/ui/useless_comment.stderr +++ b/src/test/ui/useless_comment.stderr @@ -13,20 +13,34 @@ LL | #![deny(unused_doc_comments)] error: doc comment not used by rustdoc --> $DIR/useless_comment.rs:7:5 | -LL | /// b //~ doc comment not used by rustdoc - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / /// multi-line //~ doc comment not used by rustdoc +LL | | /// doc comment +LL | | /// that is unused + | |______________________^ error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:9:9 + --> $DIR/useless_comment.rs:11:9 | LL | /// c //~ ERROR doc comment not used by rustdoc | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:14:5 + --> $DIR/useless_comment.rs:16:5 | LL | /// foo //~ ERROR doc comment not used by rustdoc | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 4 previous errors +error: doc comment not used by rustdoc + --> $DIR/useless_comment.rs:19:5 + | +LL | #[doc = "foo"] //~ ERROR doc comment not used by rustdoc + | ^^^^^^^^^^^^^^ + +error: doc comment not used by rustdoc + --> $DIR/useless_comment.rs:20:5 + | +LL | #[doc = "bar"] //~ ERROR doc comment not used by rustdoc + | ^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors From daf80f721b0c9f3a57f13dd9d8934e851ad17dd5 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Thu, 24 Jan 2019 15:49:03 -0500 Subject: [PATCH 315/381] expand unused doc comment diagnostic Report the diagnostic on macro expansions, and add a label indicating why the comment is unused. --- src/libcore/num/mod.rs | 2 +- src/librustc/hir/mod.rs | 16 +-- src/librustc/middle/region.rs | 35 ++++--- src/librustc/ty/context.rs | 15 +-- src/librustc/ty/mod.rs | 70 ++++++------- src/librustc/ty/sty.rs | 78 +++++++-------- src/librustc_data_structures/indexed_vec.rs | 30 +++++- src/librustc_lint/builtin.rs | 53 +++++++--- src/librustc_lint/lib.rs | 2 +- .../borrow_check/nll/region_infer/values.rs | 6 +- src/librustc_mir/dataflow/move_paths/mod.rs | 30 ++++-- src/libstd/io/stdio.rs | 4 +- src/test/ui/useless_comment.rs | 31 ++++-- src/test/ui/useless_comment.stderr | 98 ++++++++++++++----- 14 files changed, 303 insertions(+), 167 deletions(-) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 502e3de8c637..98b5fcd3ee4f 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -4515,7 +4515,7 @@ macro_rules! rev { )*} } -/// intra-sign conversions +// intra-sign conversions try_from_upper_bounded!(u16, u8); try_from_upper_bounded!(u32, u16, u8); try_from_upper_bounded!(u64, u32, u16, u8); diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index b9db4523ce1d..4fb8b7168b89 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -122,15 +122,15 @@ impl fmt::Display for HirId { // hack to ensure that we don't try to access the private parts of `ItemLocalId` in this module mod item_local_id_inner { use rustc_data_structures::indexed_vec::Idx; - /// An `ItemLocalId` uniquely identifies something within a given "item-like", - /// that is within a hir::Item, hir::TraitItem, or hir::ImplItem. There is no - /// guarantee that the numerical value of a given `ItemLocalId` corresponds to - /// the node's position within the owning item in any way, but there is a - /// guarantee that the `LocalItemId`s within an owner occupy a dense range of - /// integers starting at zero, so a mapping that maps all or most nodes within - /// an "item-like" to something else can be implement by a `Vec` instead of a - /// tree or hash map. newtype_index! { + /// An `ItemLocalId` uniquely identifies something within a given "item-like", + /// that is within a hir::Item, hir::TraitItem, or hir::ImplItem. There is no + /// guarantee that the numerical value of a given `ItemLocalId` corresponds to + /// the node's position within the owning item in any way, but there is a + /// guarantee that the `LocalItemId`s within an owner occupy a dense range of + /// integers starting at zero, so a mapping that maps all or most nodes within + /// an "item-like" to something else can be implement by a `Vec` instead of a + /// tree or hash map. pub struct ItemLocalId { .. } } } diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 062742bca760..93030c98f355 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -132,25 +132,24 @@ pub enum ScopeData { Remainder(FirstStatementIndex) } -/// Represents a subscope of `block` for a binding that is introduced -/// by `block.stmts[first_statement_index]`. Such subscopes represent -/// a suffix of the block. Note that each subscope does not include -/// the initializer expression, if any, for the statement indexed by -/// `first_statement_index`. -/// -/// For example, given `{ let (a, b) = EXPR_1; let c = EXPR_2; ... }`: -/// -/// * The subscope with `first_statement_index == 0` is scope of both -/// `a` and `b`; it does not include EXPR_1, but does include -/// everything after that first `let`. (If you want a scope that -/// includes EXPR_1 as well, then do not use `Scope::Remainder`, -/// but instead another `Scope` that encompasses the whole block, -/// e.g., `Scope::Node`. -/// -/// * The subscope with `first_statement_index == 1` is scope of `c`, -/// and thus does not include EXPR_2, but covers the `...`. - newtype_index! { + /// Represents a subscope of `block` for a binding that is introduced + /// by `block.stmts[first_statement_index]`. Such subscopes represent + /// a suffix of the block. Note that each subscope does not include + /// the initializer expression, if any, for the statement indexed by + /// `first_statement_index`. + /// + /// For example, given `{ let (a, b) = EXPR_1; let c = EXPR_2; ... }`: + /// + /// * The subscope with `first_statement_index == 0` is scope of both + /// `a` and `b`; it does not include EXPR_1, but does include + /// everything after that first `let`. (If you want a scope that + /// includes EXPR_1 as well, then do not use `Scope::Remainder`, + /// but instead another `Scope` that encompasses the whole block, + /// e.g., `Scope::Node`. + /// + /// * The subscope with `first_statement_index == 1` is scope of `c`, + /// and thus does not include EXPR_2, but covers the `...`. pub struct FirstStatementIndex { .. } } diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 2a3a9d1f5f43..274721b45cba 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1892,9 +1892,11 @@ pub mod tls { rayon_core::tlv::get() } - /// A thread local variable which stores a pointer to the current ImplicitCtxt #[cfg(not(parallel_compiler))] - thread_local!(static TLV: Cell = Cell::new(0)); + thread_local! { + /// A thread local variable which stores a pointer to the current ImplicitCtxt. + static TLV: Cell = Cell::new(0); + } /// Sets TLV to `value` during the call to `f`. /// It is restored to its previous value after. @@ -2011,10 +2013,11 @@ pub mod tls { }) } - /// Stores a pointer to the GlobalCtxt if one is available. - /// This is used to access the GlobalCtxt in the deadlock handler - /// given to Rayon. - scoped_thread_local!(pub static GCX_PTR: Lock); + scoped_thread_local! { + /// Stores a pointer to the GlobalCtxt if one is available. + /// This is used to access the GlobalCtxt in the deadlock handler given to Rayon. + pub static GCX_PTR: Lock + } /// Creates a TyCtxt and ImplicitCtxt based on the GCX_PTR thread local. /// This is used in the deadlock handler. diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 356f9c32f03d..1629f1dc6302 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -1512,42 +1512,42 @@ impl<'tcx> InstantiatedPredicates<'tcx> { } } -/// "Universes" are used during type- and trait-checking in the -/// presence of `for<..>` binders to control what sets of names are -/// visible. Universes are arranged into a tree: the root universe -/// contains names that are always visible. Each child then adds a new -/// set of names that are visible, in addition to those of its parent. -/// We say that the child universe "extends" the parent universe with -/// new names. -/// -/// To make this more concrete, consider this program: -/// -/// ``` -/// struct Foo { } -/// fn bar(x: T) { -/// let y: for<'a> fn(&'a u8, Foo) = ...; -/// } -/// ``` -/// -/// The struct name `Foo` is in the root universe U0. But the type -/// parameter `T`, introduced on `bar`, is in an extended universe U1 -/// -- i.e., within `bar`, we can name both `T` and `Foo`, but outside -/// of `bar`, we cannot name `T`. Then, within the type of `y`, the -/// region `'a` is in a universe U2 that extends U1, because we can -/// name it inside the fn type but not outside. -/// -/// Universes are used to do type- and trait-checking around these -/// "forall" binders (also called **universal quantification**). The -/// idea is that when, in the body of `bar`, we refer to `T` as a -/// type, we aren't referring to any type in particular, but rather a -/// kind of "fresh" type that is distinct from all other types we have -/// actually declared. This is called a **placeholder** type, and we -/// use universes to talk about this. In other words, a type name in -/// universe 0 always corresponds to some "ground" type that the user -/// declared, but a type name in a non-zero universe is a placeholder -/// type -- an idealized representative of "types in general" that we -/// use for checking generic functions. newtype_index! { + /// "Universes" are used during type- and trait-checking in the + /// presence of `for<..>` binders to control what sets of names are + /// visible. Universes are arranged into a tree: the root universe + /// contains names that are always visible. Each child then adds a new + /// set of names that are visible, in addition to those of its parent. + /// We say that the child universe "extends" the parent universe with + /// new names. + /// + /// To make this more concrete, consider this program: + /// + /// ``` + /// struct Foo { } + /// fn bar(x: T) { + /// let y: for<'a> fn(&'a u8, Foo) = ...; + /// } + /// ``` + /// + /// The struct name `Foo` is in the root universe U0. But the type + /// parameter `T`, introduced on `bar`, is in an extended universe U1 + /// -- i.e., within `bar`, we can name both `T` and `Foo`, but outside + /// of `bar`, we cannot name `T`. Then, within the type of `y`, the + /// region `'a` is in a universe U2 that extends U1, because we can + /// name it inside the fn type but not outside. + /// + /// Universes are used to do type- and trait-checking around these + /// "forall" binders (also called **universal quantification**). The + /// idea is that when, in the body of `bar`, we refer to `T` as a + /// type, we aren't referring to any type in particular, but rather a + /// kind of "fresh" type that is distinct from all other types we have + /// actually declared. This is called a **placeholder** type, and we + /// use universes to talk about this. In other words, a type name in + /// universe 0 always corresponds to some "ground" type that the user + /// declared, but a type name in a non-zero universe is a placeholder + /// type -- an idealized representative of "types in general" that we + /// use for checking generic functions. pub struct UniverseIndex { DEBUG_FORMAT = "U{}", } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 1aa4ca7ff97a..95148834e01c 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -1082,46 +1082,46 @@ impl<'a, 'gcx, 'tcx> ParamConst { } } -/// A [De Bruijn index][dbi] is a standard means of representing -/// regions (and perhaps later types) in a higher-ranked setting. In -/// particular, imagine a type like this: -/// -/// for<'a> fn(for<'b> fn(&'b isize, &'a isize), &'a char) -/// ^ ^ | | | -/// | | | | | -/// | +------------+ 0 | | -/// | | | -/// +--------------------------------+ 1 | -/// | | -/// +------------------------------------------+ 0 -/// -/// In this type, there are two binders (the outer fn and the inner -/// fn). We need to be able to determine, for any given region, which -/// fn type it is bound by, the inner or the outer one. There are -/// various ways you can do this, but a De Bruijn index is one of the -/// more convenient and has some nice properties. The basic idea is to -/// count the number of binders, inside out. Some examples should help -/// clarify what I mean. -/// -/// Let's start with the reference type `&'b isize` that is the first -/// argument to the inner function. This region `'b` is assigned a De -/// Bruijn index of 0, meaning "the innermost binder" (in this case, a -/// fn). The region `'a` that appears in the second argument type (`&'a -/// isize`) would then be assigned a De Bruijn index of 1, meaning "the -/// second-innermost binder". (These indices are written on the arrays -/// in the diagram). -/// -/// What is interesting is that De Bruijn index attached to a particular -/// variable will vary depending on where it appears. For example, -/// the final type `&'a char` also refers to the region `'a` declared on -/// the outermost fn. But this time, this reference is not nested within -/// any other binders (i.e., it is not an argument to the inner fn, but -/// rather the outer one). Therefore, in this case, it is assigned a -/// De Bruijn index of 0, because the innermost binder in that location -/// is the outer fn. -/// -/// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index newtype_index! { + /// A [De Bruijn index][dbi] is a standard means of representing + /// regions (and perhaps later types) in a higher-ranked setting. In + /// particular, imagine a type like this: + /// + /// for<'a> fn(for<'b> fn(&'b isize, &'a isize), &'a char) + /// ^ ^ | | | + /// | | | | | + /// | +------------+ 0 | | + /// | | | + /// +--------------------------------+ 1 | + /// | | + /// +------------------------------------------+ 0 + /// + /// In this type, there are two binders (the outer fn and the inner + /// fn). We need to be able to determine, for any given region, which + /// fn type it is bound by, the inner or the outer one. There are + /// various ways you can do this, but a De Bruijn index is one of the + /// more convenient and has some nice properties. The basic idea is to + /// count the number of binders, inside out. Some examples should help + /// clarify what I mean. + /// + /// Let's start with the reference type `&'b isize` that is the first + /// argument to the inner function. This region `'b` is assigned a De + /// Bruijn index of 0, meaning "the innermost binder" (in this case, a + /// fn). The region `'a` that appears in the second argument type (`&'a + /// isize`) would then be assigned a De Bruijn index of 1, meaning "the + /// second-innermost binder". (These indices are written on the arrays + /// in the diagram). + /// + /// What is interesting is that De Bruijn index attached to a particular + /// variable will vary depending on where it appears. For example, + /// the final type `&'a char` also refers to the region `'a` declared on + /// the outermost fn. But this time, this reference is not nested within + /// any other binders (i.e., it is not an argument to the inner fn, but + /// rather the outer one). Therefore, in this case, it is assigned a + /// De Bruijn index of 0, because the innermost binder in that location + /// is the outer fn. + /// + /// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index pub struct DebruijnIndex { DEBUG_FORMAT = "DebruijnIndex({})", const INNERMOST = 0, diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs index 09aec50e4bb1..1153c3e79bfd 100644 --- a/src/librustc_data_structures/indexed_vec.rs +++ b/src/librustc_data_structures/indexed_vec.rs @@ -58,9 +58,10 @@ macro_rules! newtype_index { // ---- public rules ---- // Use default constants - ($v:vis struct $name:ident { .. }) => ( + ($(#[$attrs:meta])* $v:vis struct $name:ident { .. }) => ( newtype_index!( // Leave out derives marker so we can use its absence to ensure it comes first + @attrs [$(#[$attrs])*] @type [$name] // shave off 256 indices at the end to allow space for packing these indices into enums @max [0xFFFF_FF00] @@ -69,9 +70,10 @@ macro_rules! newtype_index { ); // Define any constants - ($v:vis struct $name:ident { $($tokens:tt)+ }) => ( + ($(#[$attrs:meta])* $v:vis struct $name:ident { $($tokens:tt)+ }) => ( newtype_index!( // Leave out derives marker so we can use its absence to ensure it comes first + @attrs [$(#[$attrs])*] @type [$name] // shave off 256 indices at the end to allow space for packing these indices into enums @max [0xFFFF_FF00] @@ -84,10 +86,12 @@ macro_rules! newtype_index { // Base case, user-defined constants (if any) have already been defined (@derives [$($derives:ident,)*] + @attrs [$(#[$attrs:meta])*] @type [$type:ident] @max [$max:expr] @vis [$v:vis] @debug_format [$debug_format:tt]) => ( + $(#[$attrs])* #[derive(Copy, PartialEq, Eq, Hash, PartialOrd, Ord, $($derives),*)] #[rustc_layout_scalar_valid_range_end($max)] $v struct $type { @@ -317,7 +321,8 @@ macro_rules! newtype_index { // By not including the @derives marker in this list nor in the default args, we can force it // to come first if it exists. When encodable isn't custom, add serialization traits by default. - (@type [$type:ident] + (@attrs [$(#[$attrs:meta])*] + @type [$type:ident] @max [$max:expr] @vis [$v:vis] @debug_format [$debug_format:tt] @@ -325,6 +330,7 @@ macro_rules! newtype_index { $($tokens:tt)*) => ( newtype_index!( @derives [$($derives,)+ RustcEncodable,] + @attrs [$(#[$attrs])*] @type [$type] @max [$max] @vis [$v] @@ -335,7 +341,8 @@ macro_rules! newtype_index { // The case where no derives are added, but encodable is overridden. Don't // derive serialization traits - (@type [$type:ident] + (@attrs [$(#[$attrs:meta])*] + @type [$type:ident] @max [$max:expr] @vis [$v:vis] @debug_format [$debug_format:tt] @@ -343,6 +350,7 @@ macro_rules! newtype_index { $($tokens:tt)*) => ( newtype_index!( @derives [] + @attrs [$(#[$attrs])*] @type [$type] @max [$max] @vis [$v] @@ -351,13 +359,15 @@ macro_rules! newtype_index { ); // The case where no derives are added, add serialization derives by default - (@type [$type:ident] + (@attrs [$(#[$attrs:meta])*] + @type [$type:ident] @max [$max:expr] @vis [$v:vis] @debug_format [$debug_format:tt] $($tokens:tt)*) => ( newtype_index!( @derives [RustcEncodable,] + @attrs [$(#[$attrs])*] @type [$type] @max [$max] @vis [$v] @@ -384,6 +394,7 @@ macro_rules! newtype_index { // Rewrite final without comma to one that includes comma (@derives [$($derives:ident,)*] + @attrs [$(#[$attrs:meta])*] @type [$type:ident] @max [$max:expr] @vis [$v:vis] @@ -391,6 +402,7 @@ macro_rules! newtype_index { $name:ident = $constant:expr) => ( newtype_index!( @derives [$($derives,)*] + @attrs [$(#[$attrs])*] @type [$type] @max [$max] @vis [$v] @@ -400,6 +412,7 @@ macro_rules! newtype_index { // Rewrite final const without comma to one that includes comma (@derives [$($derives:ident,)*] + @attrs [$(#[$attrs:meta])*] @type [$type:ident] @max [$_max:expr] @vis [$v:vis] @@ -408,6 +421,7 @@ macro_rules! newtype_index { const $name:ident = $constant:expr) => ( newtype_index!( @derives [$($derives,)*] + @attrs [$(#[$attrs])*] @type [$type] @max [$max] @vis [$v] @@ -417,6 +431,7 @@ macro_rules! newtype_index { // Replace existing default for max (@derives [$($derives:ident,)*] + @attrs [$(#[$attrs:meta])*] @type [$type:ident] @max [$_max:expr] @vis [$v:vis] @@ -425,6 +440,7 @@ macro_rules! newtype_index { $($tokens:tt)*) => ( newtype_index!( @derives [$($derives,)*] + @attrs [$(#[$attrs])*] @type [$type] @max [$max] @vis [$v] @@ -434,6 +450,7 @@ macro_rules! newtype_index { // Replace existing default for debug_format (@derives [$($derives:ident,)*] + @attrs [$(#[$attrs:meta])*] @type [$type:ident] @max [$max:expr] @vis [$v:vis] @@ -442,6 +459,7 @@ macro_rules! newtype_index { $($tokens:tt)*) => ( newtype_index!( @derives [$($derives,)*] + @attrs [$(#[$attrs])*] @type [$type] @max [$max] @vis [$v] @@ -451,6 +469,7 @@ macro_rules! newtype_index { // Assign a user-defined constant (@derives [$($derives:ident,)*] + @attrs [$(#[$attrs:meta])*] @type [$type:ident] @max [$max:expr] @vis [$v:vis] @@ -462,6 +481,7 @@ macro_rules! newtype_index { pub const $name: $type = $type::from_u32_const($constant); newtype_index!( @derives [$($derives,)*] + @attrs [$(#[$attrs])*] @type [$type] @max [$max] @vis [$v] diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 284bfcd40149..7a7c49e46042 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -36,7 +36,7 @@ use syntax::tokenstream::{TokenTree, TokenStream}; use syntax::ast; use syntax::ptr::P; use syntax::ast::Expr; -use syntax::attr; +use syntax::attr::{self, HasAttrs}; use syntax::source_map::Spanned; use syntax::edition::Edition; use syntax::feature_gate::{AttributeGate, AttributeTemplate, AttributeType}; @@ -802,7 +802,14 @@ impl LintPass for UnusedDocComment { } impl UnusedDocComment { - fn warn_if_doc(&self, cx: &EarlyContext, attrs: &[ast::Attribute]) { + fn warn_if_doc( + &self, + cx: &EarlyContext<'_>, + node_span: Span, + node_kind: &str, + is_macro_expansion: bool, + attrs: &[ast::Attribute] + ) { let mut attrs = attrs.into_iter().peekable(); // Accumulate a single span for sugared doc comments. @@ -825,27 +832,51 @@ impl UnusedDocComment { let span = sugared_span.take().unwrap_or_else(|| attr.span); if attr.name() == "doc" { - cx.struct_span_lint( - UNUSED_DOC_COMMENTS, - span, - "doc comment not used by rustdoc", - ).emit(); + let mut err = cx.struct_span_lint(UNUSED_DOC_COMMENTS, span, "unused doc comment"); + + err.span_label( + node_span, + format!("rustdoc does not generate documentation for {}", node_kind) + ); + + if is_macro_expansion { + err.help("to document an item produced by a macro, \ + the macro must produce the documentation as part of its expansion"); + } + + err.emit(); } } } } impl EarlyLintPass for UnusedDocComment { - fn check_local(&mut self, cx: &EarlyContext<'_>, decl: &ast::Local) { - self.warn_if_doc(cx, &decl.attrs); + fn check_item(&mut self, cx: &EarlyContext<'_>, item: &ast::Item) { + if let ast::ItemKind::Mac(..) = item.node { + self.warn_if_doc(cx, item.span, "macro expansions", true, &item.attrs); + } + } + + fn check_stmt(&mut self, cx: &EarlyContext<'_>, stmt: &ast::Stmt) { + let (kind, is_macro_expansion) = match stmt.node { + ast::StmtKind::Local(..) => ("statements", false), + ast::StmtKind::Item(..) => ("inner items", false), + ast::StmtKind::Mac(..) => ("macro expansions", true), + // expressions will be reported by `check_expr`. + ast::StmtKind::Semi(..) | + ast::StmtKind::Expr(..) => return, + }; + + self.warn_if_doc(cx, stmt.span, kind, is_macro_expansion, stmt.node.attrs()); } fn check_arm(&mut self, cx: &EarlyContext<'_>, arm: &ast::Arm) { - self.warn_if_doc(cx, &arm.attrs); + let arm_span = arm.pats[0].span.with_hi(arm.body.span.hi()); + self.warn_if_doc(cx, arm_span, "match arms", false, &arm.attrs); } fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) { - self.warn_if_doc(cx, &expr.attrs); + self.warn_if_doc(cx, expr.span, "expressions", false, &expr.attrs); } } diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 5c243e138907..5e375dcaa068 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -66,6 +66,7 @@ macro_rules! pre_expansion_lint_passes { ($macro:path, $args:tt) => ( $macro!($args, [ KeywordIdents: KeywordIdents, + UnusedDocComment: UnusedDocComment, ]); ) } @@ -77,7 +78,6 @@ macro_rules! early_lint_passes { UnusedImportBraces: UnusedImportBraces, UnsafeCode: UnsafeCode, AnonymousParameters: AnonymousParameters, - UnusedDocComment: UnusedDocComment, EllipsisInclusiveRangePatterns: EllipsisInclusiveRangePatterns, NonCamelCaseTypes: NonCamelCaseTypes, DeprecatedAttr: DeprecatedAttr::new(), diff --git a/src/librustc_mir/borrow_check/nll/region_infer/values.rs b/src/librustc_mir/borrow_check/nll/region_infer/values.rs index c4491778162f..2101447965a1 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/values.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/values.rs @@ -116,14 +116,14 @@ impl RegionValueElements { } } -/// A single integer representing a `Location` in the MIR control-flow -/// graph. Constructed efficiently from `RegionValueElements`. newtype_index! { + /// A single integer representing a `Location` in the MIR control-flow + /// graph. Constructed efficiently from `RegionValueElements`. pub struct PointIndex { DEBUG_FORMAT = "PointIndex({})" } } -/// A single integer representing a `ty::Placeholder`. newtype_index! { + /// A single integer representing a `ty::Placeholder`. pub struct PlaceholderIndex { DEBUG_FORMAT = "PlaceholderIndex({})" } } diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index 0c29ea8ab4af..97f84675f94b 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -23,7 +23,7 @@ pub(crate) mod indexes { use rustc_data_structures::indexed_vec::Idx; macro_rules! new_index { - ($Index:ident, $debug_name:expr) => { + ($(#[$attrs:meta])* $Index:ident, $debug_name:expr) => { #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct $Index(NonZeroUsize); @@ -44,17 +44,29 @@ pub(crate) mod indexes { } } - /// Index into MovePathData.move_paths - new_index!(MovePathIndex, "mp"); + new_index!( + /// Index into MovePathData.move_paths + MovePathIndex, + "mp" + ); - /// Index into MoveData.moves. - new_index!(MoveOutIndex, "mo"); + new_index!( + /// Index into MoveData.moves. + MoveOutIndex, + "mo" + ); - /// Index into MoveData.inits. - new_index!(InitIndex, "in"); + new_index!( + /// Index into MoveData.inits. + InitIndex, + "in" + ); - /// Index into Borrows.locations - new_index!(BorrowIndex, "bw"); + new_index!( + /// Index into Borrows.locations + BorrowIndex, + "bw" + ); } pub use self::indexes::MovePathIndex; diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 589fb455a191..d53a294fa6a9 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -11,15 +11,15 @@ use crate::sys::stdio; use crate::sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; use crate::thread::LocalKey; -/// Stdout used by print! and println! macros thread_local! { + /// Stdout used by print! and println! macros static LOCAL_STDOUT: RefCell>> = { RefCell::new(None) } } -/// Stderr used by eprint! and eprintln! macros, and panics thread_local! { + /// Stderr used by eprint! and eprintln! macros, and panics static LOCAL_STDERR: RefCell>> = { RefCell::new(None) } diff --git a/src/test/ui/useless_comment.rs b/src/test/ui/useless_comment.rs index e8a0e3c10d22..7d2e5ab6f2b7 100644 --- a/src/test/ui/useless_comment.rs +++ b/src/test/ui/useless_comment.rs @@ -1,24 +1,43 @@ +#![feature(stmt_expr_attributes)] + #![deny(unused_doc_comments)] +macro_rules! mac { + () => {} +} + +/// foo //~ ERROR unused doc comment +mac!(); + fn foo() { - /// a //~ ERROR doc comment not used by rustdoc + /// a //~ ERROR unused doc comment let x = 12; - /// multi-line //~ doc comment not used by rustdoc + /// multi-line //~ unused doc comment /// doc comment /// that is unused match x { - /// c //~ ERROR doc comment not used by rustdoc + /// c //~ ERROR unused doc comment 1 => {}, _ => {} } - /// foo //~ ERROR doc comment not used by rustdoc + /// foo //~ ERROR unused doc comment unsafe {} - #[doc = "foo"] //~ ERROR doc comment not used by rustdoc - #[doc = "bar"] //~ ERROR doc comment not used by rustdoc + #[doc = "foo"] //~ ERROR unused doc comment + #[doc = "bar"] //~ ERROR unused doc comment 3; + + /// bar //~ ERROR unused doc comment + mac!(); + + let x = /** comment */ 47; //~ ERROR unused doc comment + + /// dox //~ ERROR unused doc comment + { + + } } fn main() { diff --git a/src/test/ui/useless_comment.stderr b/src/test/ui/useless_comment.stderr index a284c08f47ac..0742a844b7f4 100644 --- a/src/test/ui/useless_comment.stderr +++ b/src/test/ui/useless_comment.stderr @@ -1,46 +1,98 @@ -error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:4:5 +error: unused doc comment + --> $DIR/useless_comment.rs:9:1 | -LL | /// a //~ ERROR doc comment not used by rustdoc - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | /// foo //~ ERROR unused doc comment + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mac!(); + | ------- rustdoc does not generate documentation for macro expansions | note: lint level defined here - --> $DIR/useless_comment.rs:1:9 + --> $DIR/useless_comment.rs:3:9 | LL | #![deny(unused_doc_comments)] | ^^^^^^^^^^^^^^^^^^^ + = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion -error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:7:5 +error: unused doc comment + --> $DIR/useless_comment.rs:13:5 | -LL | / /// multi-line //~ doc comment not used by rustdoc +LL | /// a //~ ERROR unused doc comment + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let x = 12; + | ----------- rustdoc does not generate documentation for statements + +error: unused doc comment + --> $DIR/useless_comment.rs:16:5 + | +LL | / /// multi-line //~ unused doc comment LL | | /// doc comment LL | | /// that is unused | |______________________^ +LL | / match x { +LL | | /// c //~ ERROR unused doc comment +LL | | 1 => {}, +LL | | _ => {} +LL | | } + | |_____- rustdoc does not generate documentation for expressions -error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:11:9 +error: unused doc comment + --> $DIR/useless_comment.rs:20:9 | -LL | /// c //~ ERROR doc comment not used by rustdoc - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | /// c //~ ERROR unused doc comment + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | 1 => {}, + | ------- rustdoc does not generate documentation for match arms -error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:16:5 +error: unused doc comment + --> $DIR/useless_comment.rs:25:5 | -LL | /// foo //~ ERROR doc comment not used by rustdoc - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | /// foo //~ ERROR unused doc comment + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | unsafe {} + | --------- rustdoc does not generate documentation for expressions -error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:19:5 +error: unused doc comment + --> $DIR/useless_comment.rs:28:5 | -LL | #[doc = "foo"] //~ ERROR doc comment not used by rustdoc +LL | #[doc = "foo"] //~ ERROR unused doc comment | ^^^^^^^^^^^^^^ +LL | #[doc = "bar"] //~ ERROR unused doc comment +LL | 3; + | - rustdoc does not generate documentation for expressions -error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:20:5 +error: unused doc comment + --> $DIR/useless_comment.rs:29:5 | -LL | #[doc = "bar"] //~ ERROR doc comment not used by rustdoc +LL | #[doc = "bar"] //~ ERROR unused doc comment | ^^^^^^^^^^^^^^ +LL | 3; + | - rustdoc does not generate documentation for expressions -error: aborting due to 6 previous errors +error: unused doc comment + --> $DIR/useless_comment.rs:32:5 + | +LL | /// bar //~ ERROR unused doc comment + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mac!(); + | ------- rustdoc does not generate documentation for macro expansions + | + = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion + +error: unused doc comment + --> $DIR/useless_comment.rs:35:13 + | +LL | let x = /** comment */ 47; //~ ERROR unused doc comment + | ^^^^^^^^^^^^^^ -- rustdoc does not generate documentation for expressions + +error: unused doc comment + --> $DIR/useless_comment.rs:37:5 + | +LL | /// dox //~ ERROR unused doc comment + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / { +LL | | +LL | | } + | |_____- rustdoc does not generate documentation for expressions + +error: aborting due to 10 previous errors From 9243f9c6f2013c0a31b822794934980a3f02017a Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 4 Mar 2019 13:18:44 -0800 Subject: [PATCH 316/381] Update cargo, rls --- Cargo.lock | 14 +++++++------- src/tools/cargo | 2 +- src/tools/rls | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ad4af76f4b38..bcb369d15546 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -230,7 +230,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cargo" -version = "0.35.0" +version = "0.36.0" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -238,7 +238,7 @@ dependencies = [ "bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crates-io 0.23.0", + "crates-io 0.24.0", "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -540,7 +540,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "crates-io" -version = "0.23.0" +version = "0.24.0" dependencies = [ "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1340,7 +1340,7 @@ dependencies = [ [[package]] name = "lsp-codec" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2232,7 +2232,7 @@ dependencies = [ name = "rls" version = "1.34.0" dependencies = [ - "cargo 0.35.0", + "cargo 0.36.0", "cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "clippy_lints 0.0.212", "crossbeam-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2246,7 +2246,7 @@ dependencies = [ "jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lsp-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lsp-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "lsp-types 0.55.4 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4118,7 +4118,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "949826a5ccf18c1b3a7c3d57692778d21768b79e46eb9dd07bfc4c2160036c54" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum log_settings 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19af41f0565d7c19b2058153ad0b42d4d5ce89ec4dbf06ed6741114a8b63e7cd" -"checksum lsp-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3570f641b984e3e4613a1ca34db2ea72549bbc3c0316d33f5af91ab514dcbff" +"checksum lsp-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "169d737ad89cf8ddd82d1804d9122f54568c49377665157277cc90d747b1d31a" "checksum lsp-types 0.55.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6392b5843615b8a2adeebe87b83fdd29567c0870baba3407a67e6dbfee4712f8" "checksum lzma-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d1eaa027402541975218bb0eec67d6b0412f6233af96e0d096d31dbdfd22e614" "checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" diff --git a/src/tools/cargo b/src/tools/cargo index 5c6aa46e6f28..95b45eca19ac 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 5c6aa46e6f28661270979696e7b4c2f0dff8628f +Subproject commit 95b45eca19ac785263fed98ecefe540bb47337ac diff --git a/src/tools/rls b/src/tools/rls index 0d6f53e1a4ad..6a1b5a9cfda2 160000 --- a/src/tools/rls +++ b/src/tools/rls @@ -1 +1 @@ -Subproject commit 0d6f53e1a4adbaf7d83cdc0cb54720203fcb522e +Subproject commit 6a1b5a9cfda2ae19372e0613e76ebefba36edcf5 From 06090290e21dff05ce02915102a59f1167787718 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 8 Mar 2019 12:25:36 -0800 Subject: [PATCH 317/381] Update books --- src/doc/book | 2 +- src/doc/edition-guide | 2 +- src/doc/embedded-book | 2 +- src/doc/nomicon | 2 +- src/doc/reference | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/doc/book b/src/doc/book index fab9419503f0..9cffbeabec3b 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit fab9419503f0e34c1a06f9350a6705d0ce741dc6 +Subproject commit 9cffbeabec3bcec42d09432bfe7705125c848889 diff --git a/src/doc/edition-guide b/src/doc/edition-guide index 5f3cc2a56187..aa0022c87590 160000 --- a/src/doc/edition-guide +++ b/src/doc/edition-guide @@ -1 +1 @@ -Subproject commit 5f3cc2a5618700efcde3bc00799744f21fa9ad2e +Subproject commit aa0022c875907886cae8f3ef8e9ebf6e2a5e728d diff --git a/src/doc/embedded-book b/src/doc/embedded-book index bd2778f30498..9e656ead82bf 160000 --- a/src/doc/embedded-book +++ b/src/doc/embedded-book @@ -1 +1 @@ -Subproject commit bd2778f304989ee52be8201504d6ec621dd60ca9 +Subproject commit 9e656ead82bfe869493dec82653a52e27fa6a05c diff --git a/src/doc/nomicon b/src/doc/nomicon index b7eb4a087207..f1ff93b66844 160000 --- a/src/doc/nomicon +++ b/src/doc/nomicon @@ -1 +1 @@ -Subproject commit b7eb4a087207af2405c0669fa577f8545b894c66 +Subproject commit f1ff93b66844493a7b03101c7df66ac958c62418 diff --git a/src/doc/reference b/src/doc/reference index 1c775a1dc5e2..41493ffce5d0 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 1c775a1dc5e29bc44b36604b510d6196d98077fa +Subproject commit 41493ffce5d0e17d54eaf5ec9a995054e2b9aece From 0a505a71d3b8d61e982b305caf6d39c227c05957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 2 Mar 2019 10:38:20 -0800 Subject: [PATCH 318/381] Parse lifetimes that start with a number and give specific error --- src/libsyntax/parse/lexer/mod.rs | 24 ++++++++++++++++------ src/test/ui/parser/numeric-lifetime.rs | 8 ++++++++ src/test/ui/parser/numeric-lifetime.stderr | 24 ++++++++++++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 src/test/ui/parser/numeric-lifetime.rs create mode 100644 src/test/ui/parser/numeric-lifetime.stderr diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index a7cde5fbb92c..f45f5e65312c 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1423,15 +1423,17 @@ impl<'a> StringReader<'a> { // If the character is an ident start not followed by another single // quote, then this is a lifetime name: - if ident_start(Some(c2)) && !self.ch_is('\'') { + if (ident_start(Some(c2)) || c2.is_numeric()) && !self.ch_is('\'') { while ident_continue(self.ch) { self.bump(); } // lifetimes shouldn't end with a single quote // if we find one, then this is an invalid character literal if self.ch_is('\'') { - self.err_span_(start_with_quote, self.next_pos, - "character literal may only contain one codepoint"); + self.err_span_( + start_with_quote, + self.next_pos, + "character literal may only contain one codepoint"); self.bump(); return Ok(token::Literal(token::Err(Symbol::intern("??")), None)) @@ -1444,6 +1446,16 @@ impl<'a> StringReader<'a> { self.mk_ident(&format!("'{}", lifetime_name)) }); + if c2.is_numeric() { + // this is a recovered lifetime written `'1`, error but accept it + self.err_span_( + start_with_quote, + self.pos, + "lifetimes can't start with a number", + ); + } + + return Ok(token::Lifetime(ident)); } @@ -1873,13 +1885,14 @@ fn is_block_doc_comment(s: &str) -> bool { res } +/// Determine whether `c` is a valid start for an ident. fn ident_start(c: Option) -> bool { let c = match c { Some(c) => c, None => return false, }; - (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || (c > '\x7f' && c.is_xid_start()) + (c.is_alphabetic() || c == '_' || (c > '\x7f' && c.is_xid_start())) } fn ident_continue(c: Option) -> bool { @@ -1888,8 +1901,7 @@ fn ident_continue(c: Option) -> bool { None => return false, }; - (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_' || - (c > '\x7f' && c.is_xid_continue()) + (c.is_alphabetic() || c.is_numeric() || c == '_' || (c > '\x7f' && c.is_xid_continue())) } #[inline] diff --git a/src/test/ui/parser/numeric-lifetime.rs b/src/test/ui/parser/numeric-lifetime.rs new file mode 100644 index 000000000000..3483975a3cb8 --- /dev/null +++ b/src/test/ui/parser/numeric-lifetime.rs @@ -0,0 +1,8 @@ +struct S<'1> { s: &'1 usize } +//~^ ERROR lifetimes can't start with a number +//~| ERROR lifetimes can't start with a number +fn main() { + // verify that the parse error doesn't stop type checking + let x: usize = ""; + //~^ ERROR mismatched types +} diff --git a/src/test/ui/parser/numeric-lifetime.stderr b/src/test/ui/parser/numeric-lifetime.stderr new file mode 100644 index 000000000000..1bbc508d57d4 --- /dev/null +++ b/src/test/ui/parser/numeric-lifetime.stderr @@ -0,0 +1,24 @@ +error: lifetimes can't start with a number + --> $DIR/numeric-lifetime.rs:1:10 + | +LL | struct S<'1> { s: &'1 usize } + | ^^ + +error: lifetimes can't start with a number + --> $DIR/numeric-lifetime.rs:1:20 + | +LL | struct S<'1> { s: &'1 usize } + | ^^ + +error[E0308]: mismatched types + --> $DIR/numeric-lifetime.rs:6:20 + | +LL | let x: usize = ""; + | ^^ expected usize, found reference + | + = note: expected type `usize` + found type `&'static str` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0308`. From a03e20db6d15fe1cdda64c0fbe934e36209a08f6 Mon Sep 17 00:00:00 2001 From: ishitatsuyuki Date: Thu, 31 Jan 2019 18:28:22 +0900 Subject: [PATCH 319/381] Fix fallout from #57667 --- src/libsyntax/ptr.rs | 39 ++++++--------------------------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/src/libsyntax/ptr.rs b/src/libsyntax/ptr.rs index bc43630ae59b..9afcb7c4621c 100644 --- a/src/libsyntax/ptr.rs +++ b/src/libsyntax/ptr.rs @@ -29,7 +29,7 @@ use std::fmt::{self, Display, Debug}; use std::iter::FromIterator; use std::ops::{Deref, DerefMut}; -use std::{mem, ptr, slice, vec}; +use std::{slice, vec}; use serialize::{Encodable, Decodable, Encoder, Decoder}; @@ -66,45 +66,18 @@ impl P { pub fn map(mut self, f: F) -> P where F: FnOnce(T) -> T, { - let p: *mut T = &mut *self.ptr; + let x = f(*self.ptr); + *self.ptr = x; - // Leak self in case of panic. - // FIXME(eddyb) Use some sort of "free guard" that - // only deallocates, without dropping the pointee, - // in case the call the `f` below ends in a panic. - mem::forget(self); - - unsafe { - ptr::write(p, f(ptr::read(p))); - - // Recreate self from the raw pointer. - P { ptr: Box::from_raw(p) } - } + self } /// Optionally produce a new `P` from `self` without reallocating. pub fn filter_map(mut self, f: F) -> Option> where F: FnOnce(T) -> Option, { - let p: *mut T = &mut *self.ptr; - - // Leak self in case of panic. - // FIXME(eddyb) Use some sort of "free guard" that - // only deallocates, without dropping the pointee, - // in case the call the `f` below ends in a panic. - mem::forget(self); - - unsafe { - if let Some(v) = f(ptr::read(p)) { - ptr::write(p, v); - - // Recreate self from the raw pointer. - Some(P { ptr: Box::from_raw(p) }) - } else { - drop(Box::from_raw(p)); - None - } - } + *self.ptr = f(*self.ptr)?; + Some(self) } } From 2309625941ac548c407def97eb87d03b237737cf Mon Sep 17 00:00:00 2001 From: topecongiro Date: Sat, 9 Mar 2019 21:59:54 +0900 Subject: [PATCH 320/381] Expose new_sub_parser_from_file This function is useful when external tools like rustfmt want to parse internal files without parsing a whole crate. --- src/libsyntax/parse/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 98b5fe563b8a..371e8fe5cf66 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -185,7 +185,7 @@ pub fn maybe_new_parser_from_file<'a>(sess: &'a ParseSess, path: &Path) /// Given a session, a crate config, a path, and a span, add /// the file at the given path to the source_map, and return a parser. /// On an error, use the given span as the source of the problem. -crate fn new_sub_parser_from_file<'a>(sess: &'a ParseSess, +pub fn new_sub_parser_from_file<'a>(sess: &'a ParseSess, path: &Path, directory_ownership: DirectoryOwnership, module_name: Option, From 4bbe8839dddb4a87b91dfe8af6e81b7d8b9cc478 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Wed, 16 Jan 2019 15:30:41 -0500 Subject: [PATCH 321/381] use structured suggestions for E0432 --- src/librustc_resolve/lib.rs | 94 +++++--- src/librustc_resolve/macros.rs | 17 +- src/librustc_resolve/resolve_imports.rs | 207 ++++++++++++------ src/test/ui/extenv/issue-55897.stderr | 5 +- src/test/ui/import.rs | 4 +- src/test/ui/import.stderr | 9 +- src/test/ui/imports/issue-55457.stderr | 5 +- src/test/ui/inaccessible-test-modules.stderr | 10 +- src/test/ui/issues/issue-31212.stderr | 2 +- src/test/ui/issues/issue-8208.rs | 6 +- src/test/ui/issues/issue-8208.stderr | 6 +- src/test/ui/resolve_self_super_hint.rs | 12 +- src/test/ui/resolve_self_super_hint.stderr | 20 +- src/test/ui/rust-2018/issue-54006.stderr | 2 +- .../local-path-suggestions-2015.stderr | 5 +- .../local-path-suggestions-2018.stderr | 4 +- src/test/ui/unresolved/unresolved-import.rs | 20 +- .../ui/unresolved/unresolved-import.stderr | 29 ++- .../ui/use/use-nested-groups-error.stderr | 5 +- 19 files changed, 310 insertions(+), 152 deletions(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index e9331fcd8bad..b50e37519d46 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -137,6 +137,9 @@ impl Ord for BindingError { } } +/// A span, message, replacement text, and applicability. +type Suggestion = (Span, String, String, Applicability); + enum ResolutionError<'a> { /// Error E0401: can't use type or const parameters from outer function. GenericParamsFromOuterFunction(Def), @@ -166,7 +169,7 @@ enum ResolutionError<'a> { /// Error E0431: `self` import can only appear in an import list with a non-empty prefix. SelfImportOnlyInImportListWithNonEmptyPrefix, /// Error E0433: failed to resolve. - FailedToResolve(&'a str), + FailedToResolve { label: String, suggestion: Option }, /// Error E0434: can't capture dynamic environment in a fn item. CannotCaptureDynamicEnvironmentInFnItem, /// Error E0435: attempt to use a non-constant value in a constant. @@ -380,10 +383,15 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver<'_>, err.span_label(span, "can only appear in an import list with a non-empty prefix"); err } - ResolutionError::FailedToResolve(msg) => { + ResolutionError::FailedToResolve { label, suggestion } => { let mut err = struct_span_err!(resolver.session, span, E0433, - "failed to resolve: {}", msg); - err.span_label(span, msg); + "failed to resolve: {}", &label); + err.span_label(span, label); + + if let Some((span, msg, suggestion, applicability)) = suggestion { + err.span_suggestion(span, &msg, suggestion, applicability); + } + err } ResolutionError::CannotCaptureDynamicEnvironmentInFnItem => { @@ -1050,7 +1058,12 @@ enum PathResult<'a> { Module(ModuleOrUniformRoot<'a>), NonModule(PathResolution), Indeterminate, - Failed(Span, String, bool /* is the error from the last segment? */), + Failed { + span: Span, + label: String, + suggestion: Option, + is_error_from_last_segment: bool, + }, } enum ModuleKind { @@ -1775,13 +1788,18 @@ impl<'a> Resolver<'a> { PathResult::NonModule(path_res) if path_res.unresolved_segments() == 0 => path_res.base_def(), PathResult::NonModule(..) => { - let msg = "type-relative paths are not supported in this context"; - error_callback(self, span, ResolutionError::FailedToResolve(msg)); + error_callback(self, span, ResolutionError::FailedToResolve { + label: String::from("type-relative paths are not supported in this context"), + suggestion: None, + }); Def::Err } PathResult::Module(..) | PathResult::Indeterminate => unreachable!(), - PathResult::Failed(span, msg, _) => { - error_callback(self, span, ResolutionError::FailedToResolve(&msg)); + PathResult::Failed { span, label, suggestion, .. } => { + error_callback(self, span, ResolutionError::FailedToResolve { + label, + suggestion, + }); Def::Err } }; @@ -3429,7 +3447,7 @@ impl<'a> Resolver<'a> { // Such behavior is required for backward compatibility. // The same fallback is used when `a` resolves to nothing. PathResult::Module(ModuleOrUniformRoot::Module(_)) | - PathResult::Failed(..) + PathResult::Failed { .. } if (ns == TypeNS || path.len() > 1) && self.primitive_type_table.primitive_types .contains_key(&path[0].ident.name) => { @@ -3438,11 +3456,11 @@ impl<'a> Resolver<'a> { } PathResult::Module(ModuleOrUniformRoot::Module(module)) => PathResolution::new(module.def().unwrap()), - PathResult::Failed(span, msg, false) => { - resolve_error(self, span, ResolutionError::FailedToResolve(&msg)); + PathResult::Failed { is_error_from_last_segment: false, span, label, suggestion } => { + resolve_error(self, span, ResolutionError::FailedToResolve { label, suggestion }); err_path_resolution() } - PathResult::Module(..) | PathResult::Failed(..) => return None, + PathResult::Module(..) | PathResult::Failed { .. } => return None, PathResult::Indeterminate => bug!("indetermined path result in resolve_qpath"), }; @@ -3550,7 +3568,12 @@ impl<'a> Resolver<'a> { } } let msg = "there are too many initial `super`s.".to_string(); - return PathResult::Failed(ident.span, msg, false); + return PathResult::Failed { + span: ident.span, + label: msg, + suggestion: None, + is_error_from_last_segment: false, + }; } if i == 0 { if name == keywords::SelfLower.name() { @@ -3587,12 +3610,17 @@ impl<'a> Resolver<'a> { } else { format!("`{}`", name) }; - let msg = if i == 1 && path[0].ident.name == keywords::PathRoot.name() { + let label = if i == 1 && path[0].ident.name == keywords::PathRoot.name() { format!("global paths cannot start with {}", name_str) } else { format!("{} in paths can only be used in start position", name_str) }; - return PathResult::Failed(ident.span, msg, false); + return PathResult::Failed { + span: ident.span, + label, + suggestion: None, + is_error_from_last_segment: false, + }; } let binding = if let Some(module) = module { @@ -3653,9 +3681,12 @@ impl<'a> Resolver<'a> { def, path.len() - i - 1 )); } else { - return PathResult::Failed(ident.span, - format!("not a module `{}`", ident), - is_last); + return PathResult::Failed { + span: ident.span, + label: format!("not a module `{}`", ident), + suggestion: None, + is_error_from_last_segment: is_last, + }; } } Err(Undetermined) => return PathResult::Indeterminate, @@ -3671,7 +3702,7 @@ impl<'a> Resolver<'a> { Some(ModuleOrUniformRoot::Module(module)) => module.def(), _ => None, }; - let msg = if module_def == self.graph_root.def() { + let (label, suggestion) = if module_def == self.graph_root.def() { let is_mod = |def| match def { Def::Mod(..) => true, _ => false }; let mut candidates = self.lookup_import_candidates(ident, TypeNS, is_mod); @@ -3679,19 +3710,32 @@ impl<'a> Resolver<'a> { (c.path.segments.len(), c.path.to_string()) }); if let Some(candidate) = candidates.get(0) { - format!("did you mean `{}`?", candidate.path) + ( + String::from("unresolved import"), + Some(( + ident.span, + String::from("a similar path exists"), + candidate.path.to_string(), + Applicability::MaybeIncorrect, + )), + ) } else if !ident.is_reserved() { - format!("maybe a missing `extern crate {};`?", ident) + (format!("maybe a missing `extern crate {};`?", ident), None) } else { // the parser will already have complained about the keyword being used return PathResult::NonModule(err_path_resolution()); } } else if i == 0 { - format!("use of undeclared type or module `{}`", ident) + (format!("use of undeclared type or module `{}`", ident), None) } else { - format!("could not find `{}` in `{}`", ident, path[i - 1].ident) + (format!("could not find `{}` in `{}`", ident, path[i - 1].ident), None) + }; + return PathResult::Failed { + span: ident.span, + label, + suggestion, + is_error_from_last_segment: is_last, }; - return PathResult::Failed(ident.span, msg, is_last); } } } diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 63f752ac9c94..8e4b2a9a4cb1 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -426,9 +426,9 @@ impl<'a> Resolver<'a> { Ok(path_res.base_def()) } PathResult::Indeterminate if !force => return Err(Determinacy::Undetermined), - PathResult::NonModule(..) | PathResult::Indeterminate | PathResult::Failed(..) => { - Err(Determinacy::Determined) - } + PathResult::NonModule(..) + | PathResult::Indeterminate + | PathResult::Failed { .. } => Err(Determinacy::Determined), PathResult::Module(..) => unreachable!(), }; @@ -990,14 +990,17 @@ impl<'a> Resolver<'a> { let def = path_res.base_def(); check_consistency(self, &path, path_span, kind, initial_def, def); } - path_res @ PathResult::NonModule(..) | path_res @ PathResult::Failed(..) => { - let (span, msg) = if let PathResult::Failed(span, msg, ..) = path_res { - (span, msg) + path_res @ PathResult::NonModule(..) | path_res @ PathResult::Failed { .. } => { + let (span, label) = if let PathResult::Failed { span, label, .. } = path_res { + (span, label) } else { (path_span, format!("partially resolved path in {} {}", kind.article(), kind.descr())) }; - resolve_error(self, span, ResolutionError::FailedToResolve(&msg)); + resolve_error(self, span, ResolutionError::FailedToResolve { + label, + suggestion: None + }); } PathResult::Module(..) | PathResult::Indeterminate => unreachable!(), } diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index b930c30c5119..9daffd522bf2 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -6,9 +6,11 @@ use crate::Namespace::{self, TypeNS, MacroNS}; use crate::{NameBinding, NameBindingKind, ToNameBinding, PathResult, PrivacyError}; use crate::{Resolver, Segment}; use crate::{names_to_string, module_to_string}; -use crate::{resolve_error, ResolutionError}; +use crate::{resolve_error, ResolutionError, Suggestion}; use crate::macros::ParentScope; +use errors::Applicability; + use rustc_data_structures::ptr_key::PtrKey; use rustc::ty; use rustc::lint::builtin::BuiltinLintDiagnostics; @@ -27,7 +29,7 @@ use syntax::util::lev_distance::find_best_match_for_name; use syntax::{struct_span_err, unwrap_or}; use syntax_pos::{MultiSpan, Span}; -use log::debug; +use log::*; use std::cell::{Cell, RefCell}; use std::{mem, ptr}; @@ -623,6 +625,16 @@ impl<'a> Resolver<'a> { } } +/// An error that may be transformed into a diagnostic later. Used to combine multiple unresolved +/// import errors within the same use tree into a single diagnostic. +#[derive(Debug, Clone)] +struct UnresolvedImportError { + span: Span, + label: Option, + note: Option, + suggestion: Option, +} + pub struct ImportResolver<'a, 'b: 'a> { pub resolver: &'a mut Resolver<'b>, } @@ -675,14 +687,14 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { self.finalize_resolutions_in(module); } - let mut errors = false; + let mut has_errors = false; let mut seen_spans = FxHashSet::default(); - let mut error_vec = Vec::new(); + let mut errors = vec![]; let mut prev_root_id: NodeId = NodeId::from_u32(0); for i in 0 .. self.determined_imports.len() { let import = self.determined_imports[i]; - if let Some((span, err, note)) = self.finalize_import(import) { - errors = true; + if let Some(err) = self.finalize_import(import) { + has_errors = true; if let SingleImport { source, ref source_bindings, .. } = import.subclass { if source.name == "self" { @@ -696,37 +708,36 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { // If the error is a single failed import then create a "fake" import // resolution for it so that later resolve stages won't complain. self.import_dummy_binding(import); - if prev_root_id.as_u32() != 0 && - prev_root_id.as_u32() != import.root_id.as_u32() && - !error_vec.is_empty(){ - // in case of new import line, throw diagnostic message - // for previous line. - let mut empty_vec = vec![]; - mem::swap(&mut empty_vec, &mut error_vec); - self.throw_unresolved_import_error(empty_vec, None); + if prev_root_id.as_u32() != 0 + && prev_root_id.as_u32() != import.root_id.as_u32() + && !errors.is_empty() { + // In the case of a new import line, throw a diagnostic message + // for the previous line. + self.throw_unresolved_import_error(errors, None); + errors = vec![]; } - if !seen_spans.contains(&span) { + if !seen_spans.contains(&err.span) { let path = import_path_to_string( &import.module_path.iter().map(|seg| seg.ident).collect::>(), &import.subclass, - span, + err.span, ); - error_vec.push((span, path, err, note)); - seen_spans.insert(span); + seen_spans.insert(err.span); + errors.push((path, err)); prev_root_id = import.root_id; } } } - if !error_vec.is_empty() { - self.throw_unresolved_import_error(error_vec.clone(), None); + if !errors.is_empty() { + self.throw_unresolved_import_error(errors.clone(), None); } // Report unresolved imports only if no hard error was already reported // to avoid generating multiple errors on the same import. - if !errors { + if !has_errors { for import in &self.indeterminate_imports { - self.throw_unresolved_import_error(error_vec, Some(MultiSpan::from(import.span))); + self.throw_unresolved_import_error(errors, Some(MultiSpan::from(import.span))); break; } } @@ -734,44 +745,58 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { fn throw_unresolved_import_error( &self, - error_vec: Vec<(Span, String, String, Option)>, + errors: Vec<(String, UnresolvedImportError)>, span: Option, ) { - let max_span_label_msg_count = 10; // upper limit on number of span_label message. - let (span, msg, note) = if error_vec.is_empty() { + /// Upper limit on the number of `span_label` messages. + const MAX_LABEL_COUNT: usize = 10; + + let (span, msg, note) = if errors.is_empty() { (span.unwrap(), "unresolved import".to_string(), None) } else { let span = MultiSpan::from_spans( - error_vec.clone().into_iter() - .map(|elem: (Span, String, String, Option)| elem.0) - .collect() + errors + .iter() + .map(|(_, err)| err.span) + .collect(), ); - let note: Option = error_vec.clone().into_iter() - .filter_map(|elem: (Span, String, String, Option)| elem.3) + let note = errors + .iter() + .filter_map(|(_, err)| err.note.as_ref()) .last(); - let path_vec: Vec = error_vec.clone().into_iter() - .map(|elem: (Span, String, String, Option)| format!("`{}`", elem.1)) - .collect(); - let path = path_vec.join(", "); + let paths = errors + .iter() + .map(|(path, _)| format!("`{}`", path)) + .collect::>(); + let msg = format!( "unresolved import{} {}", - if path_vec.len() > 1 { "s" } else { "" }, - path + if paths.len() > 1 { "s" } else { "" }, + paths.join(", "), ); (span, msg, note) }; - let mut err = struct_span_err!(self.resolver.session, span, E0432, "{}", &msg); - for span_error in error_vec.into_iter().take(max_span_label_msg_count) { - err.span_label(span_error.0, span_error.2); + let mut diag = struct_span_err!(self.resolver.session, span, E0432, "{}", &msg); + + if let Some(note) = ¬e { + diag.note(note); } - if let Some(note) = note { - err.note(¬e); + + for (_, err) in errors.into_iter().take(MAX_LABEL_COUNT) { + if let Some(label) = err.label { + diag.span_label(err.span, label); + } + + if let Some((span, msg, suggestion, applicability)) = err.suggestion { + diag.span_suggestion(span, &msg, suggestion, applicability); + } } - err.emit(); + + diag.emit(); } /// Attempts to resolve the given import, returning true if its resolution is determined. @@ -802,7 +827,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { match path_res { PathResult::Module(module) => module, PathResult::Indeterminate => return false, - PathResult::NonModule(..) | PathResult::Failed(..) => return true, + PathResult::NonModule(..) | PathResult::Failed { .. } => return true, } }; @@ -866,11 +891,14 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { !indeterminate } - // If appropriate, returns an error to report. + /// Performs final import resolution, consistency checks and error reporting. + /// + /// Optionally returns an unresolved import error. This error is buffered and used to + /// consolidate multiple unresolved import errors into a single diagnostic. fn finalize_import( &mut self, directive: &'b ImportDirective<'b> - ) -> Option<(Span, String, Option)> { + ) -> Option { self.current_module = directive.parent_scope.module; let orig_vis = directive.vis.replace(ty::Visibility::Invisible); @@ -896,25 +924,48 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { module } - PathResult::Failed(span, msg, false) => { + PathResult::Failed { is_error_from_last_segment: false, span, label, suggestion } => { if no_ambiguity { assert!(directive.imported_module.get().is_none()); - resolve_error(self, span, ResolutionError::FailedToResolve(&msg)); + resolve_error(self, span, ResolutionError::FailedToResolve { + label, + suggestion, + }); } return None; } - PathResult::Failed(span, msg, true) => { + PathResult::Failed { is_error_from_last_segment: true, span, label, suggestion } => { if no_ambiguity { assert!(directive.imported_module.get().is_none()); - return Some(match self.make_path_suggestion(span, directive.module_path.clone(), - &directive.parent_scope) { - Some((suggestion, note)) => ( - span, - format!("did you mean `{}`?", Segment::names_to_string(&suggestion)), - note, - ), - None => (span, msg, None), - }); + let err = match self.make_path_suggestion( + span, + directive.module_path.clone(), + &directive.parent_scope, + ) { + Some((suggestion, note)) => { + UnresolvedImportError { + span, + label: None, + note, + suggestion: Some(( + span, + String::from("a similar path exists"), + Segment::names_to_string(&suggestion), + Applicability::MaybeIncorrect, + )), + } + } + None => { + UnresolvedImportError { + span, + label: Some(label), + note: None, + suggestion, + } + } + }; + + return Some(err); } return None; } @@ -950,11 +1001,12 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { if let ModuleOrUniformRoot::Module(module) = module { if module.def_id() == directive.parent_scope.module.def_id() { // Importing a module into itself is not allowed. - return Some(( - directive.span, - "Cannot glob-import a module into itself.".to_string(), - None, - )); + return Some(UnresolvedImportError { + span: directive.span, + label: Some(String::from("cannot glob-import a module into itself")), + note: None, + suggestion: None, + }); } } if !is_prelude && @@ -1059,31 +1111,42 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { _ => Some(&i.name), } }); + let lev_suggestion = - match find_best_match_for_name(names, &ident.as_str(), None) { - Some(name) => format!(". Did you mean to use `{}`?", name), - None => String::new(), - }; - let msg = match module { + find_best_match_for_name(names, &ident.as_str(), None).map(|suggestion| { + ( + ident.span, + String::from("a similar name exists in the module"), + suggestion.to_string(), + Applicability::MaybeIncorrect, + ) + }); + + let label = match module { ModuleOrUniformRoot::Module(module) => { let module_str = module_to_string(module); if let Some(module_str) = module_str { - format!("no `{}` in `{}`{}", ident, module_str, lev_suggestion) + format!("no `{}` in `{}`", ident, module_str) } else { - format!("no `{}` in the root{}", ident, lev_suggestion) + format!("no `{}` in the root", ident) } } _ => { if !ident.is_path_segment_keyword() { - format!("no `{}` external crate{}", ident, lev_suggestion) + format!("no `{}` external crate", ident) } else { // HACK(eddyb) this shows up for `self` & `super`, which // should work instead - for now keep the same error message. - format!("no `{}` in the root{}", ident, lev_suggestion) + format!("no `{}` in the root", ident) } } }; - Some((directive.span, msg, None)) + Some(UnresolvedImportError { + span: directive.span, + label: Some(label), + note: None, + suggestion: lev_suggestion, + }) } else { // `resolve_ident_in_module` reported a privacy error. self.import_dummy_binding(directive); diff --git a/src/test/ui/extenv/issue-55897.stderr b/src/test/ui/extenv/issue-55897.stderr index 4d2e35dff462..603b29aa989f 100644 --- a/src/test/ui/extenv/issue-55897.stderr +++ b/src/test/ui/extenv/issue-55897.stderr @@ -8,7 +8,10 @@ error[E0432]: unresolved import `prelude` --> $DIR/issue-55897.rs:1:5 | LL | use prelude::*; //~ ERROR unresolved import `prelude` - | ^^^^^^^ did you mean `std::prelude`? + | ^^^^^^^ + | | + | unresolved import + | help: a similar path exists: `std::prelude` error: cannot determine resolution for the macro `env` --> $DIR/issue-55897.rs:6:22 diff --git a/src/test/ui/import.rs b/src/test/ui/import.rs index 540258daaec8..3170dd2fae10 100644 --- a/src/test/ui/import.rs +++ b/src/test/ui/import.rs @@ -1,6 +1,8 @@ use zed::bar; use zed::baz; //~ ERROR unresolved import `zed::baz` [E0432] - //~^ no `baz` in `zed`. Did you mean to use `bar`? + //~| no `baz` in `zed` + //~| HELP a similar name exists in the module + //~| SUGGESTION bar mod zed { diff --git a/src/test/ui/import.stderr b/src/test/ui/import.stderr index 737d10cdecb2..bfbb6560d49d 100644 --- a/src/test/ui/import.stderr +++ b/src/test/ui/import.stderr @@ -2,16 +2,19 @@ error[E0432]: unresolved import `zed::baz` --> $DIR/import.rs:2:5 | LL | use zed::baz; //~ ERROR unresolved import `zed::baz` [E0432] - | ^^^^^^^^ no `baz` in `zed`. Did you mean to use `bar`? + | ^^^^^--- + | | | + | | help: a similar name exists in the module: `bar` + | no `baz` in `zed` error[E0432]: unresolved import `foo` - --> $DIR/import.rs:8:9 + --> $DIR/import.rs:10:9 | LL | use foo; //~ ERROR unresolved import `foo` [E0432] | ^^^ no `foo` in the root error[E0603]: unresolved item `foo` is private - --> $DIR/import.rs:13:10 + --> $DIR/import.rs:15:10 | LL | zed::foo(); //~ ERROR `foo` is private | ^^^ diff --git a/src/test/ui/imports/issue-55457.stderr b/src/test/ui/imports/issue-55457.stderr index 4ee0332d04bc..a3474b2f7dbf 100644 --- a/src/test/ui/imports/issue-55457.stderr +++ b/src/test/ui/imports/issue-55457.stderr @@ -2,7 +2,10 @@ error[E0432]: unresolved import `NonExistent` --> $DIR/issue-55457.rs:1:5 | LL | use NonExistent; //~ ERROR unresolved import `NonExistent` - | ^^^^^^^^^^^ no `NonExistent` in the root. Did you mean to use `non_existent`? + | ^^^^^^^^^^^ + | | + | no `NonExistent` in the root + | help: a similar name exists in the module: `non_existent` error[E0432]: unresolved import `non_existent` --> $DIR/issue-55457.rs:2:5 diff --git a/src/test/ui/inaccessible-test-modules.stderr b/src/test/ui/inaccessible-test-modules.stderr index 636ef8187059..40f2b7fd2eeb 100644 --- a/src/test/ui/inaccessible-test-modules.stderr +++ b/src/test/ui/inaccessible-test-modules.stderr @@ -2,13 +2,19 @@ error[E0432]: unresolved import `__test` --> $DIR/inaccessible-test-modules.rs:5:5 | LL | use __test as x; //~ ERROR unresolved import `__test` - | ^^^^^^^^^^^ no `__test` in the root. Did you mean to use `test`? + | ------^^^^^ + | | + | no `__test` in the root + | help: a similar name exists in the module: `test` error[E0432]: unresolved import `__test_reexports` --> $DIR/inaccessible-test-modules.rs:6:5 | LL | use __test_reexports as y; //~ ERROR unresolved import `__test_reexports` - | ^^^^^^^^^^^^^^^^^^^^^ no `__test_reexports` in the root. Did you mean to use `__test_reexports`? + | ----------------^^^^^ + | | + | no `__test_reexports` in the root + | help: a similar name exists in the module: `__test_reexports` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-31212.stderr b/src/test/ui/issues/issue-31212.stderr index d964b702f221..09300ffc7879 100644 --- a/src/test/ui/issues/issue-31212.stderr +++ b/src/test/ui/issues/issue-31212.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `self::*` --> $DIR/issue-31212.rs:5:13 | LL | pub use self::*; //~ ERROR unresolved - | ^^^^^^^ Cannot glob-import a module into itself. + | ^^^^^^^ cannot glob-import a module into itself error[E0425]: cannot find function `f` in module `foo` --> $DIR/issue-31212.rs:9:10 diff --git a/src/test/ui/issues/issue-8208.rs b/src/test/ui/issues/issue-8208.rs index ad94f99098db..1c566938f9d0 100644 --- a/src/test/ui/issues/issue-8208.rs +++ b/src/test/ui/issues/issue-8208.rs @@ -1,14 +1,14 @@ use self::*; //~ ERROR: unresolved import `self::*` [E0432] - //~^ Cannot glob-import a module into itself. + //~^ cannot glob-import a module into itself mod foo { use foo::*; //~ ERROR: unresolved import `foo::*` [E0432] - //~^ Cannot glob-import a module into itself. + //~^ cannot glob-import a module into itself mod bar { use super::bar::*; //~^ ERROR: unresolved import `super::bar::*` [E0432] - //~| Cannot glob-import a module into itself. + //~| cannot glob-import a module into itself } } diff --git a/src/test/ui/issues/issue-8208.stderr b/src/test/ui/issues/issue-8208.stderr index 6de95fb953a9..a042dce1ac1d 100644 --- a/src/test/ui/issues/issue-8208.stderr +++ b/src/test/ui/issues/issue-8208.stderr @@ -2,19 +2,19 @@ error[E0432]: unresolved import `self::*` --> $DIR/issue-8208.rs:1:5 | LL | use self::*; //~ ERROR: unresolved import `self::*` [E0432] - | ^^^^^^^ Cannot glob-import a module into itself. + | ^^^^^^^ cannot glob-import a module into itself error[E0432]: unresolved import `foo::*` --> $DIR/issue-8208.rs:5:9 | LL | use foo::*; //~ ERROR: unresolved import `foo::*` [E0432] - | ^^^^^^ Cannot glob-import a module into itself. + | ^^^^^^ cannot glob-import a module into itself error[E0432]: unresolved import `super::bar::*` --> $DIR/issue-8208.rs:9:13 | LL | use super::bar::*; - | ^^^^^^^^^^^^^ Cannot glob-import a module into itself. + | ^^^^^^^^^^^^^ cannot glob-import a module into itself error: aborting due to 3 previous errors diff --git a/src/test/ui/resolve_self_super_hint.rs b/src/test/ui/resolve_self_super_hint.rs index 193a6ecf9d57..91a01cc0fa23 100644 --- a/src/test/ui/resolve_self_super_hint.rs +++ b/src/test/ui/resolve_self_super_hint.rs @@ -5,19 +5,23 @@ mod a { extern crate alloc; use alloc::HashMap; //~^ ERROR unresolved import `alloc` [E0432] - //~| did you mean `self::alloc`? + //~| HELP a similar path exists + //~| SUGGESTION self::alloc mod b { use alloc::HashMap; //~^ ERROR unresolved import `alloc` [E0432] - //~| did you mean `super::alloc`? + //~| HELP a similar path exists + //~| SUGGESTION super::alloc mod c { use alloc::HashMap; //~^ ERROR unresolved import `alloc` [E0432] - //~| did you mean `a::alloc`? + //~| HELP a similar path exists + //~| SUGGESTION a::alloc mod d { use alloc::HashMap; //~^ ERROR unresolved import `alloc` [E0432] - //~| did you mean `a::alloc`? + //~| HELP a similar path exists + //~| SUGGESTION a::alloc } } } diff --git a/src/test/ui/resolve_self_super_hint.stderr b/src/test/ui/resolve_self_super_hint.stderr index ddae0e5f6aab..03214cad8e41 100644 --- a/src/test/ui/resolve_self_super_hint.stderr +++ b/src/test/ui/resolve_self_super_hint.stderr @@ -2,25 +2,31 @@ error[E0432]: unresolved import `alloc` --> $DIR/resolve_self_super_hint.rs:6:9 | LL | use alloc::HashMap; - | ^^^^^ did you mean `self::alloc`? + | ^^^^^ help: a similar path exists: `self::alloc` error[E0432]: unresolved import `alloc` - --> $DIR/resolve_self_super_hint.rs:10:13 + --> $DIR/resolve_self_super_hint.rs:11:13 | LL | use alloc::HashMap; - | ^^^^^ did you mean `super::alloc`? + | ^^^^^ help: a similar path exists: `super::alloc` error[E0432]: unresolved import `alloc` - --> $DIR/resolve_self_super_hint.rs:14:17 + --> $DIR/resolve_self_super_hint.rs:16:17 | LL | use alloc::HashMap; - | ^^^^^ did you mean `a::alloc`? + | ^^^^^ + | | + | unresolved import + | help: a similar path exists: `a::alloc` error[E0432]: unresolved import `alloc` - --> $DIR/resolve_self_super_hint.rs:18:21 + --> $DIR/resolve_self_super_hint.rs:21:21 | LL | use alloc::HashMap; - | ^^^^^ did you mean `a::alloc`? + | ^^^^^ + | | + | unresolved import + | help: a similar path exists: `a::alloc` error: aborting due to 4 previous errors diff --git a/src/test/ui/rust-2018/issue-54006.stderr b/src/test/ui/rust-2018/issue-54006.stderr index 6c6d7720be2c..1978138a6887 100644 --- a/src/test/ui/rust-2018/issue-54006.stderr +++ b/src/test/ui/rust-2018/issue-54006.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `alloc` --> $DIR/issue-54006.rs:6:5 | LL | use alloc::vec; - | ^^^^^ did you mean `core::alloc`? + | ^^^^^ help: a similar path exists: `core::alloc` error: cannot determine resolution for the macro `vec` --> $DIR/issue-54006.rs:10:18 diff --git a/src/test/ui/rust-2018/local-path-suggestions-2015.stderr b/src/test/ui/rust-2018/local-path-suggestions-2015.stderr index be642c3bcdcb..fafb35ec50d6 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2015.stderr +++ b/src/test/ui/rust-2018/local-path-suggestions-2015.stderr @@ -2,7 +2,10 @@ error[E0432]: unresolved import `foobar` --> $DIR/local-path-suggestions-2015.rs:24:5 | LL | use foobar::Baz; //~ ERROR unresolved import `foobar` - | ^^^^^^ did you mean `aux_baz::foobar`? + | ^^^^^^ + | | + | unresolved import + | help: a similar path exists: `aux_baz::foobar` error: aborting due to previous error diff --git a/src/test/ui/rust-2018/local-path-suggestions-2018.stderr b/src/test/ui/rust-2018/local-path-suggestions-2018.stderr index 71c8289264ff..759977b3f062 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2018.stderr +++ b/src/test/ui/rust-2018/local-path-suggestions-2018.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `foo` --> $DIR/local-path-suggestions-2018.rs:10:9 | LL | use foo::Bar; //~ ERROR unresolved import `foo` - | ^^^ did you mean `crate::foo`? + | ^^^ help: a similar path exists: `crate::foo` | = note: `use` statements changed in Rust 2018; read more at @@ -10,7 +10,7 @@ error[E0432]: unresolved import `foobar` --> $DIR/local-path-suggestions-2018.rs:19:5 | LL | use foobar::Baz; //~ ERROR unresolved import `foobar` - | ^^^^^^ did you mean `baz::foobar`? + | ^^^^^^ help: a similar path exists: `baz::foobar` error: aborting due to 2 previous errors diff --git a/src/test/ui/unresolved/unresolved-import.rs b/src/test/ui/unresolved/unresolved-import.rs index be2a2c75485f..4c7d4bb93533 100644 --- a/src/test/ui/unresolved/unresolved-import.rs +++ b/src/test/ui/unresolved/unresolved-import.rs @@ -1,16 +1,20 @@ -// ignore-tidy-linelength - use foo::bar; //~ ERROR unresolved import `foo` [E0432] //~^ maybe a missing `extern crate foo;`? use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432] - //~^ no `Baz` in `bar`. Did you mean to use `Bar`? + //~| no `Baz` in `bar` + //~| HELP a similar name exists in the module + //~| SUGGESTION Bar use food::baz; //~ ERROR unresolved import `food::baz` - //~^ no `baz` in `food`. Did you mean to use `bag`? + //~| no `baz` in `food` + //~| HELP a similar name exists in the module + //~| SUGGESTION bag use food::{beens as Foo}; //~ ERROR unresolved import `food::beens` [E0432] - //~^ no `beens` in `food`. Did you mean to use `beans`? + //~| no `beens` in `food` + //~| HELP a similar name exists in the module + //~| SUGGESTION beans mod bar { pub struct Bar; @@ -32,7 +36,8 @@ mod m { } use MyEnum::*; //~ ERROR unresolved import `MyEnum` [E0432] - //~^ did you mean `self::MyEnum`? + //~| HELP a similar path exists + //~| SUGGESTION self::MyEnum } mod items { @@ -41,7 +46,8 @@ mod items { } use Enum::*; //~ ERROR unresolved import `Enum` [E0432] - //~^ did you mean `self::Enum`? + //~| HELP a similar path exists + //~| SUGGESTION self::Enum fn item() {} } diff --git a/src/test/ui/unresolved/unresolved-import.stderr b/src/test/ui/unresolved/unresolved-import.stderr index 0dc4b72208ac..4f2fef938c97 100644 --- a/src/test/ui/unresolved/unresolved-import.stderr +++ b/src/test/ui/unresolved/unresolved-import.stderr @@ -1,38 +1,47 @@ error[E0432]: unresolved import `foo` - --> $DIR/unresolved-import.rs:3:5 + --> $DIR/unresolved-import.rs:1:5 | LL | use foo::bar; //~ ERROR unresolved import `foo` [E0432] | ^^^ maybe a missing `extern crate foo;`? error[E0432]: unresolved import `bar::Baz` - --> $DIR/unresolved-import.rs:6:5 + --> $DIR/unresolved-import.rs:4:5 | LL | use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432] - | ^^^^^^^^^^^^^ no `Baz` in `bar`. Did you mean to use `Bar`? + | ^^^^^---^^^^^ + | | | + | | help: a similar name exists in the module: `Bar` + | no `Baz` in `bar` error[E0432]: unresolved import `food::baz` --> $DIR/unresolved-import.rs:9:5 | LL | use food::baz; //~ ERROR unresolved import `food::baz` - | ^^^^^^^^^ no `baz` in `food`. Did you mean to use `bag`? + | ^^^^^^--- + | | | + | | help: a similar name exists in the module: `bag` + | no `baz` in `food` error[E0432]: unresolved import `food::beens` - --> $DIR/unresolved-import.rs:12:12 + --> $DIR/unresolved-import.rs:14:12 | LL | use food::{beens as Foo}; //~ ERROR unresolved import `food::beens` [E0432] - | ^^^^^^^^^^^^ no `beens` in `food`. Did you mean to use `beans`? + | -----^^^^^^^ + | | + | no `beens` in `food` + | help: a similar name exists in the module: `beans` error[E0432]: unresolved import `MyEnum` - --> $DIR/unresolved-import.rs:34:9 + --> $DIR/unresolved-import.rs:38:9 | LL | use MyEnum::*; //~ ERROR unresolved import `MyEnum` [E0432] - | ^^^^^^ did you mean `self::MyEnum`? + | ^^^^^^ help: a similar path exists: `self::MyEnum` error[E0432]: unresolved import `Enum` - --> $DIR/unresolved-import.rs:43:9 + --> $DIR/unresolved-import.rs:48:9 | LL | use Enum::*; //~ ERROR unresolved import `Enum` [E0432] - | ^^^^ did you mean `self::Enum`? + | ^^^^ help: a similar path exists: `self::Enum` error: aborting due to 6 previous errors diff --git a/src/test/ui/use/use-nested-groups-error.stderr b/src/test/ui/use/use-nested-groups-error.stderr index 9d6fd9df6cbe..7234c8ec621c 100644 --- a/src/test/ui/use/use-nested-groups-error.stderr +++ b/src/test/ui/use/use-nested-groups-error.stderr @@ -2,7 +2,10 @@ error[E0432]: unresolved import `a::b1::C1` --> $DIR/use-nested-groups-error.rs:9:14 | LL | use a::{b1::{C1, C2}, B2}; - | ^^ no `C1` in `a::b1`. Did you mean to use `C2`? + | ^^ + | | + | no `C1` in `a::b1` + | help: a similar name exists in the module: `C2` error: aborting due to previous error From f690821d58650358f536606722a8f5531c8a6b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 8 Mar 2019 13:29:27 -0800 Subject: [PATCH 322/381] review comments --- src/libsyntax/parse/lexer/mod.rs | 8 ++++---- src/test/ui/parser/numeric-lifetime.rs | 4 ++-- src/test/ui/parser/numeric-lifetime.stderr | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index f45f5e65312c..6d2256474a3d 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1451,11 +1451,10 @@ impl<'a> StringReader<'a> { self.err_span_( start_with_quote, self.pos, - "lifetimes can't start with a number", + "lifetimes cannot start with a number", ); } - return Ok(token::Lifetime(ident)); } @@ -1892,7 +1891,7 @@ fn ident_start(c: Option) -> bool { None => return false, }; - (c.is_alphabetic() || c == '_' || (c > '\x7f' && c.is_xid_start())) + (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || (c > '\x7f' && c.is_xid_start()) } fn ident_continue(c: Option) -> bool { @@ -1901,7 +1900,8 @@ fn ident_continue(c: Option) -> bool { None => return false, }; - (c.is_alphabetic() || c.is_numeric() || c == '_' || (c > '\x7f' && c.is_xid_continue())) + (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_' || + (c > '\x7f' && c.is_xid_continue()) } #[inline] diff --git a/src/test/ui/parser/numeric-lifetime.rs b/src/test/ui/parser/numeric-lifetime.rs index 3483975a3cb8..2d82354c62cc 100644 --- a/src/test/ui/parser/numeric-lifetime.rs +++ b/src/test/ui/parser/numeric-lifetime.rs @@ -1,6 +1,6 @@ struct S<'1> { s: &'1 usize } -//~^ ERROR lifetimes can't start with a number -//~| ERROR lifetimes can't start with a number +//~^ ERROR lifetimes cannot start with a number +//~| ERROR lifetimes cannot start with a number fn main() { // verify that the parse error doesn't stop type checking let x: usize = ""; diff --git a/src/test/ui/parser/numeric-lifetime.stderr b/src/test/ui/parser/numeric-lifetime.stderr index 1bbc508d57d4..4018b24aac17 100644 --- a/src/test/ui/parser/numeric-lifetime.stderr +++ b/src/test/ui/parser/numeric-lifetime.stderr @@ -1,10 +1,10 @@ -error: lifetimes can't start with a number +error: lifetimes cannot start with a number --> $DIR/numeric-lifetime.rs:1:10 | LL | struct S<'1> { s: &'1 usize } | ^^ -error: lifetimes can't start with a number +error: lifetimes cannot start with a number --> $DIR/numeric-lifetime.rs:1:20 | LL | struct S<'1> { s: &'1 usize } From df4ea90b39c808e858e05f3b4bb05fc29f812d26 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Sat, 9 Mar 2019 19:10:28 -0800 Subject: [PATCH 323/381] Use lifetime contravariance to elide more lifetimes in core+alloc+std --- src/liballoc/boxed.rs | 8 ++--- src/liballoc/rc.rs | 4 +-- src/liballoc/string.rs | 4 +-- src/liballoc/vec.rs | 16 +++++----- src/libcore/array.rs | 2 +- src/libcore/cmp.rs | 48 ++++++++++++++-------------- src/libcore/internal_macros.rs | 12 +++---- src/libcore/ptr.rs | 16 +++++----- src/libstd/collections/hash/set.rs | 8 ++--- src/libstd/error.rs | 8 ++--- src/libstd/ffi/c_str.rs | 12 +++---- src/libstd/ffi/os_str.rs | 16 +++++----- src/libstd/path.rs | 12 +++---- src/libstd/sys/cloudabi/shims/net.rs | 4 +-- src/libstd/sys/redox/net/mod.rs | 2 +- src/libstd/sys/sgx/net.rs | 4 +-- src/libstd/sys/unix/l4re.rs | 4 +-- src/libstd/sys/wasm/net.rs | 4 +-- src/libstd/sys_common/net.rs | 2 +- 19 files changed, 93 insertions(+), 93 deletions(-) diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 74325a69e15e..9bce142b483f 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -489,7 +489,7 @@ impl From> for Pin> { } #[stable(feature = "box_from_slice", since = "1.17.0")] -impl<'a, T: Copy> From<&'a [T]> for Box<[T]> { +impl From<&[T]> for Box<[T]> { /// Converts a `&[T]` into a `Box<[T]>` /// /// This conversion allocates on the heap @@ -503,7 +503,7 @@ impl<'a, T: Copy> From<&'a [T]> for Box<[T]> { /// /// println!("{:?}", boxed_slice); /// ``` - fn from(slice: &'a [T]) -> Box<[T]> { + fn from(slice: &[T]) -> Box<[T]> { let mut boxed = unsafe { RawVec::with_capacity(slice.len()).into_box() }; boxed.copy_from_slice(slice); boxed @@ -511,7 +511,7 @@ impl<'a, T: Copy> From<&'a [T]> for Box<[T]> { } #[stable(feature = "box_from_slice", since = "1.17.0")] -impl<'a> From<&'a str> for Box { +impl From<&str> for Box { /// Converts a `&str` into a `Box` /// /// This conversion allocates on the heap @@ -523,7 +523,7 @@ impl<'a> From<&'a str> for Box { /// println!("{}", boxed); /// ``` #[inline] - fn from(s: &'a str) -> Box { + fn from(s: &str) -> Box { unsafe { from_boxed_utf8_unchecked(Box::from(s.as_bytes())) } } } diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 12f75d84211e..68eecd97ea11 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -1145,7 +1145,7 @@ impl From for Rc { } #[stable(feature = "shared_from_slice", since = "1.21.0")] -impl<'a, T: Clone> From<&'a [T]> for Rc<[T]> { +impl From<&[T]> for Rc<[T]> { #[inline] fn from(v: &[T]) -> Rc<[T]> { >::from_slice(v) @@ -1153,7 +1153,7 @@ impl<'a, T: Clone> From<&'a [T]> for Rc<[T]> { } #[stable(feature = "shared_from_slice", since = "1.21.0")] -impl<'a> From<&'a str> for Rc { +impl From<&str> for Rc { #[inline] fn from(v: &str) -> Rc { let rc = Rc::<[u8]>::from(v.as_bytes()); diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index b714df5d36b6..a3e2098695f7 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -2172,9 +2172,9 @@ impl AsRef<[u8]> for String { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> From<&'a str> for String { +impl From<&str> for String { #[inline] - fn from(s: &'a str) -> String { + fn from(s: &str) -> String { s.to_owned() } } diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index adcd3d84f483..cd62c3e05244 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -2182,25 +2182,25 @@ impl AsMut<[T]> for Vec { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: Clone> From<&'a [T]> for Vec { +impl From<&[T]> for Vec { #[cfg(not(test))] - fn from(s: &'a [T]) -> Vec { + fn from(s: &[T]) -> Vec { s.to_vec() } #[cfg(test)] - fn from(s: &'a [T]) -> Vec { + fn from(s: &[T]) -> Vec { crate::slice::to_vec(s) } } #[stable(feature = "vec_from_mut", since = "1.19.0")] -impl<'a, T: Clone> From<&'a mut [T]> for Vec { +impl From<&mut [T]> for Vec { #[cfg(not(test))] - fn from(s: &'a mut [T]) -> Vec { + fn from(s: &mut [T]) -> Vec { s.to_vec() } #[cfg(test)] - fn from(s: &'a mut [T]) -> Vec { + fn from(s: &mut [T]) -> Vec { crate::slice::to_vec(s) } } @@ -2231,8 +2231,8 @@ impl From> for Box<[T]> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> From<&'a str> for Vec { - fn from(s: &'a str) -> Vec { +impl From<&str> for Vec { + fn from(s: &str) -> Vec { From::from(s.as_bytes()) } } diff --git a/src/libcore/array.rs b/src/libcore/array.rs index 9c6ecc435024..dcd9ce6dad75 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -139,7 +139,7 @@ macro_rules! array_impls { } #[stable(feature = "try_from", since = "1.34.0")] - impl<'a, T> TryFrom<&'a [T]> for [T; $N] where T: Copy { + impl TryFrom<&[T]> for [T; $N] where T: Copy { type Error = TryFromSliceError; fn try_from(slice: &[T]) -> Result<[T; $N], TryFromSliceError> { diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 81fcdeee12d2..94bed3708369 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -1004,26 +1004,26 @@ mod impls { // & pointers #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b B> for &'a A where A: PartialEq { + impl PartialEq<&B> for &A where A: PartialEq { #[inline] - fn eq(&self, other: & &'b B) -> bool { PartialEq::eq(*self, *other) } + fn eq(&self, other: & &B) -> bool { PartialEq::eq(*self, *other) } #[inline] - fn ne(&self, other: & &'b B) -> bool { PartialEq::ne(*self, *other) } + fn ne(&self, other: & &B) -> bool { PartialEq::ne(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, 'b, A: ?Sized, B: ?Sized> PartialOrd<&'b B> for &'a A where A: PartialOrd { + impl PartialOrd<&B> for &A where A: PartialOrd { #[inline] - fn partial_cmp(&self, other: &&'b B) -> Option { + fn partial_cmp(&self, other: &&B) -> Option { PartialOrd::partial_cmp(*self, *other) } #[inline] - fn lt(&self, other: & &'b B) -> bool { PartialOrd::lt(*self, *other) } + fn lt(&self, other: & &B) -> bool { PartialOrd::lt(*self, *other) } #[inline] - fn le(&self, other: & &'b B) -> bool { PartialOrd::le(*self, *other) } + fn le(&self, other: & &B) -> bool { PartialOrd::le(*self, *other) } #[inline] - fn ge(&self, other: & &'b B) -> bool { PartialOrd::ge(*self, *other) } + fn ge(&self, other: & &B) -> bool { PartialOrd::ge(*self, *other) } #[inline] - fn gt(&self, other: & &'b B) -> bool { PartialOrd::gt(*self, *other) } + fn gt(&self, other: & &B) -> bool { PartialOrd::gt(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] impl Ord for &A where A: Ord { @@ -1036,26 +1036,26 @@ mod impls { // &mut pointers #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a mut A where A: PartialEq { + impl PartialEq<&mut B> for &mut A where A: PartialEq { #[inline] - fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) } + fn eq(&self, other: &&mut B) -> bool { PartialEq::eq(*self, *other) } #[inline] - fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) } + fn ne(&self, other: &&mut B) -> bool { PartialEq::ne(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, 'b, A: ?Sized, B: ?Sized> PartialOrd<&'b mut B> for &'a mut A where A: PartialOrd { + impl PartialOrd<&mut B> for &mut A where A: PartialOrd { #[inline] - fn partial_cmp(&self, other: &&'b mut B) -> Option { + fn partial_cmp(&self, other: &&mut B) -> Option { PartialOrd::partial_cmp(*self, *other) } #[inline] - fn lt(&self, other: &&'b mut B) -> bool { PartialOrd::lt(*self, *other) } + fn lt(&self, other: &&mut B) -> bool { PartialOrd::lt(*self, *other) } #[inline] - fn le(&self, other: &&'b mut B) -> bool { PartialOrd::le(*self, *other) } + fn le(&self, other: &&mut B) -> bool { PartialOrd::le(*self, *other) } #[inline] - fn ge(&self, other: &&'b mut B) -> bool { PartialOrd::ge(*self, *other) } + fn ge(&self, other: &&mut B) -> bool { PartialOrd::ge(*self, *other) } #[inline] - fn gt(&self, other: &&'b mut B) -> bool { PartialOrd::gt(*self, *other) } + fn gt(&self, other: &&mut B) -> bool { PartialOrd::gt(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] impl Ord for &mut A where A: Ord { @@ -1066,18 +1066,18 @@ mod impls { impl Eq for &mut A where A: Eq {} #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a A where A: PartialEq { + impl PartialEq<&mut B> for &A where A: PartialEq { #[inline] - fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) } + fn eq(&self, other: &&mut B) -> bool { PartialEq::eq(*self, *other) } #[inline] - fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) } + fn ne(&self, other: &&mut B) -> bool { PartialEq::ne(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b B> for &'a mut A where A: PartialEq { + impl PartialEq<&B> for &mut A where A: PartialEq { #[inline] - fn eq(&self, other: &&'b B) -> bool { PartialEq::eq(*self, *other) } + fn eq(&self, other: &&B) -> bool { PartialEq::eq(*self, *other) } #[inline] - fn ne(&self, other: &&'b B) -> bool { PartialEq::ne(*self, *other) } + fn ne(&self, other: &&B) -> bool { PartialEq::ne(*self, *other) } } } diff --git a/src/libcore/internal_macros.rs b/src/libcore/internal_macros.rs index faca785e488c..b5c20582986b 100644 --- a/src/libcore/internal_macros.rs +++ b/src/libcore/internal_macros.rs @@ -37,21 +37,21 @@ macro_rules! forward_ref_binop { } #[$attr] - impl<'a> $imp<&'a $u> for $t { + impl $imp<&$u> for $t { type Output = <$t as $imp<$u>>::Output; #[inline] - fn $method(self, other: &'a $u) -> <$t as $imp<$u>>::Output { + fn $method(self, other: &$u) -> <$t as $imp<$u>>::Output { $imp::$method(self, *other) } } #[$attr] - impl<'a, 'b> $imp<&'a $u> for &'b $t { + impl $imp<&$u> for &$t { type Output = <$t as $imp<$u>>::Output; #[inline] - fn $method(self, other: &'a $u) -> <$t as $imp<$u>>::Output { + fn $method(self, other: &$u) -> <$t as $imp<$u>>::Output { $imp::$method(*self, *other) } } @@ -67,9 +67,9 @@ macro_rules! forward_ref_op_assign { }; (impl $imp:ident, $method:ident for $t:ty, $u:ty, #[$attr:meta]) => { #[$attr] - impl<'a> $imp<&'a $u> for $t { + impl $imp<&$u> for $t { #[inline] - fn $method(&mut self, other: &'a $u) { + fn $method(&mut self, other: &$u) { $imp::$method(self, *other); } } diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 53d419760306..d288ca449dff 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -2837,15 +2837,15 @@ impl fmt::Pointer for Unique { } #[unstable(feature = "ptr_internals", issue = "0")] -impl<'a, T: ?Sized> From<&'a mut T> for Unique { - fn from(reference: &'a mut T) -> Self { +impl From<&mut T> for Unique { + fn from(reference: &mut T) -> Self { unsafe { Unique { pointer: reference as *mut T, _marker: PhantomData } } } } #[unstable(feature = "ptr_internals", issue = "0")] -impl<'a, T: ?Sized> From<&'a T> for Unique { - fn from(reference: &'a T) -> Self { +impl From<&T> for Unique { + fn from(reference: &T) -> Self { unsafe { Unique { pointer: reference as *const T, _marker: PhantomData } } } } @@ -3049,17 +3049,17 @@ impl From> for NonNull { } #[stable(feature = "nonnull", since = "1.25.0")] -impl<'a, T: ?Sized> From<&'a mut T> for NonNull { +impl From<&mut T> for NonNull { #[inline] - fn from(reference: &'a mut T) -> Self { + fn from(reference: &mut T) -> Self { unsafe { NonNull { pointer: reference as *mut T } } } } #[stable(feature = "nonnull", since = "1.25.0")] -impl<'a, T: ?Sized> From<&'a T> for NonNull { +impl From<&T> for NonNull { #[inline] - fn from(reference: &'a T) -> Self { + fn from(reference: &T) -> Self { unsafe { NonNull { pointer: reference as *const T } } } } diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 8a599c11b209..f2111f2d9e02 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -850,7 +850,7 @@ impl Default for HashSet } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T, S> BitOr<&'b HashSet> for &'a HashSet +impl BitOr<&HashSet> for &HashSet where T: Eq + Hash + Clone, S: BuildHasher + Default { @@ -882,7 +882,7 @@ impl<'a, 'b, T, S> BitOr<&'b HashSet> for &'a HashSet } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T, S> BitAnd<&'b HashSet> for &'a HashSet +impl BitAnd<&HashSet> for &HashSet where T: Eq + Hash + Clone, S: BuildHasher + Default { @@ -914,7 +914,7 @@ impl<'a, 'b, T, S> BitAnd<&'b HashSet> for &'a HashSet } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T, S> BitXor<&'b HashSet> for &'a HashSet +impl BitXor<&HashSet> for &HashSet where T: Eq + Hash + Clone, S: BuildHasher + Default { @@ -946,7 +946,7 @@ impl<'a, 'b, T, S> BitXor<&'b HashSet> for &'a HashSet } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T, S> Sub<&'b HashSet> for &'a HashSet +impl Sub<&HashSet> for &HashSet where T: Eq + Hash + Clone, S: BuildHasher + Default { diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 2858308e8f8d..3eb289501cb0 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -337,7 +337,7 @@ impl From for Box { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b> From<&'b str> for Box { +impl<'a> From<&str> for Box { /// Converts a [`str`] into a box of dyn [`Error`] + [`Send`] + [`Sync`]. /// /// # Examples @@ -351,13 +351,13 @@ impl<'a, 'b> From<&'b str> for Box { /// assert!( /// mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` - fn from(err: &'b str) -> Box { + fn from(err: &str) -> Box { From::from(String::from(err)) } } #[stable(feature = "string_box_error", since = "1.6.0")] -impl<'a> From<&'a str> for Box { +impl From<&str> for Box { /// Converts a [`str`] into a box of dyn [`Error`]. /// /// # Examples @@ -370,7 +370,7 @@ impl<'a> From<&'a str> for Box { /// let a_boxed_error = Box::::from(a_str_error); /// assert!(mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` - fn from(err: &'a str) -> Box { + fn from(err: &str) -> Box { From::from(String::from(err)) } } diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 139680e526fd..ad3f45bfadaf 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -690,8 +690,8 @@ impl<'a> From> for CString { } #[stable(feature = "box_from_c_str", since = "1.17.0")] -impl<'a> From<&'a CStr> for Box { - fn from(s: &'a CStr) -> Box { +impl From<&CStr> for Box { + fn from(s: &CStr) -> Box { let boxed: Box<[u8]> = Box::from(s.to_bytes_with_nul()); unsafe { Box::from_raw(Box::into_raw(boxed) as *mut CStr) } } @@ -767,7 +767,7 @@ impl From for Arc { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a CStr> for Arc { +impl From<&CStr> for Arc { #[inline] fn from(s: &CStr) -> Arc { let arc: Arc<[u8]> = Arc::from(s.to_bytes_with_nul()); @@ -789,7 +789,7 @@ impl From for Rc { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a CStr> for Rc { +impl From<&CStr> for Rc { #[inline] fn from(s: &CStr) -> Rc { let rc: Rc<[u8]> = Rc::from(s.to_bytes_with_nul()); @@ -1268,8 +1268,8 @@ impl ToOwned for CStr { } #[stable(feature = "cstring_asref", since = "1.7.0")] -impl<'a> From<&'a CStr> for CString { - fn from(s: &'a CStr) -> CString { +impl From<&CStr> for CString { + fn from(s: &CStr) -> CString { s.to_owned() } } diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index f68eaeb9c7e1..3a0590021c91 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -357,8 +357,8 @@ impl From for OsString { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized + AsRef> From<&'a T> for OsString { - fn from(s: &'a T) -> OsString { +impl> From<&T> for OsString { + fn from(s: &T) -> OsString { s.as_ref().to_os_string() } } @@ -421,8 +421,8 @@ impl PartialEq for str { } #[stable(feature = "os_str_str_ref_eq", since = "1.29.0")] -impl<'a> PartialEq<&'a str> for OsString { - fn eq(&self, other: &&'a str) -> bool { +impl PartialEq<&str> for OsString { + fn eq(&self, other: &&str) -> bool { **self == **other } } @@ -656,8 +656,8 @@ impl OsStr { } #[stable(feature = "box_from_os_str", since = "1.17.0")] -impl<'a> From<&'a OsStr> for Box { - fn from(s: &'a OsStr) -> Box { +impl From<&OsStr> for Box { + fn from(s: &OsStr) -> Box { let rw = Box::into_raw(s.inner.into_box()) as *mut OsStr; unsafe { Box::from_raw(rw) } } @@ -707,7 +707,7 @@ impl From for Arc { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a OsStr> for Arc { +impl From<&OsStr> for Arc { #[inline] fn from(s: &OsStr) -> Arc { let arc = s.inner.into_arc(); @@ -729,7 +729,7 @@ impl From for Rc { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a OsStr> for Rc { +impl From<&OsStr> for Rc { #[inline] fn from(s: &OsStr) -> Rc { let rc = s.inner.into_rc(); diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 858a5778b816..ea3fcd8ce285 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1456,8 +1456,8 @@ impl PathBuf { } #[stable(feature = "box_from_path", since = "1.17.0")] -impl<'a> From<&'a Path> for Box { - fn from(path: &'a Path) -> Box { +impl From<&Path> for Box { + fn from(path: &Path) -> Box { let boxed: Box = path.inner.into(); let rw = Box::into_raw(boxed) as *mut Path; unsafe { Box::from_raw(rw) } @@ -1494,8 +1494,8 @@ impl Clone for Box { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized + AsRef> From<&'a T> for PathBuf { - fn from(s: &'a T) -> PathBuf { +impl> From<&T> for PathBuf { + fn from(s: &T) -> PathBuf { PathBuf::from(s.as_ref().to_os_string()) } } @@ -1630,7 +1630,7 @@ impl From for Arc { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a Path> for Arc { +impl From<&Path> for Arc { /// Converts a Path into a Rc by copying the Path data into a new Rc buffer. #[inline] fn from(s: &Path) -> Arc { @@ -1650,7 +1650,7 @@ impl From for Rc { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a Path> for Rc { +impl From<&Path> for Rc { /// Converts a Path into a Rc by copying the Path data into a new Rc buffer. #[inline] fn from(s: &Path) -> Rc { diff --git a/src/libstd/sys/cloudabi/shims/net.rs b/src/libstd/sys/cloudabi/shims/net.rs index 50d72dc7b240..6d2a4962ab44 100644 --- a/src/libstd/sys/cloudabi/shims/net.rs +++ b/src/libstd/sys/cloudabi/shims/net.rs @@ -297,10 +297,10 @@ impl Iterator for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; - fn try_from(_v: &'a str) -> io::Result { + fn try_from(_v: &str) -> io::Result { unsupported() } } diff --git a/src/libstd/sys/redox/net/mod.rs b/src/libstd/sys/redox/net/mod.rs index a172763f6131..dbaa140ed8a0 100644 --- a/src/libstd/sys/redox/net/mod.rs +++ b/src/libstd/sys/redox/net/mod.rs @@ -35,7 +35,7 @@ impl Iterator for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; fn try_from(s: &str) -> io::Result { diff --git a/src/libstd/sys/sgx/net.rs b/src/libstd/sys/sgx/net.rs index ab8b2681393f..e5e42e3d0b04 100644 --- a/src/libstd/sys/sgx/net.rs +++ b/src/libstd/sys/sgx/net.rs @@ -420,10 +420,10 @@ impl Iterator for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; - fn try_from(v: &'a str) -> io::Result { + fn try_from(v: &str) -> io::Result { LookupHost::new(v.to_owned()) } } diff --git a/src/libstd/sys/unix/l4re.rs b/src/libstd/sys/unix/l4re.rs index b6e8cc738946..b9e725371a36 100644 --- a/src/libstd/sys/unix/l4re.rs +++ b/src/libstd/sys/unix/l4re.rs @@ -447,10 +447,10 @@ pub mod net { unsafe impl Send for LookupHost {} - impl<'a> TryFrom<&'a str> for LookupHost { + impl TryFrom<&str> for LookupHost { type Error = io::Error; - fn try_from(_v: &'a str) -> io::Result { + fn try_from(_v: &str) -> io::Result { unimpl!(); } } diff --git a/src/libstd/sys/wasm/net.rs b/src/libstd/sys/wasm/net.rs index 1249832fb09d..a2ea2dfbbc03 100644 --- a/src/libstd/sys/wasm/net.rs +++ b/src/libstd/sys/wasm/net.rs @@ -298,10 +298,10 @@ impl Iterator for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; - fn try_from(_v: &'a str) -> io::Result { + fn try_from(_v: &str) -> io::Result { unsupported() } } diff --git a/src/libstd/sys_common/net.rs b/src/libstd/sys_common/net.rs index 36721171b173..b9505aaa69ba 100644 --- a/src/libstd/sys_common/net.rs +++ b/src/libstd/sys_common/net.rs @@ -157,7 +157,7 @@ impl Drop for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; fn try_from(s: &str) -> io::Result { From 51938c61f6f1b26e463f9071716f543543486e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 8 Dec 2018 20:30:23 +0100 Subject: [PATCH 324/381] Make the rustc driver and interface demand driven --- src/librustc/ich/impls_ty.rs | 5 - src/librustc/session/config.rs | 36 +- src/librustc/session/mod.rs | 18 +- src/librustc/ty/context.rs | 87 +- src/librustc/ty/mod.rs | 2 +- src/librustc_codegen_llvm/lib.rs | 5 +- src/librustc_codegen_utils/codegen_backend.rs | 7 +- src/librustc_data_structures/box_region.rs | 172 +++ src/librustc_data_structures/lib.rs | 3 + src/librustc_driver/driver.rs | 1244 ----------------- src/librustc_driver/lib.rs | 743 ++++------ src/librustc_driver/pretty.rs | 285 ++-- src/librustc_driver/test.rs | 142 +- src/librustc_incremental/lib.rs | 2 +- src/librustc_incremental/persist/load.rs | 6 +- src/librustc_incremental/persist/mod.rs | 2 +- src/librustc_interface/interface.rs | 155 ++ src/librustc_interface/lib.rs | 11 +- src/librustc_interface/passes.rs | 760 +++++++++- src/librustc_interface/queries.rs | 302 ++++ src/librustc_interface/util.rs | 159 ++- src/librustdoc/clean/auto_trait.rs | 8 +- src/librustdoc/clean/blanket_impl.rs | 8 +- src/librustdoc/clean/def_ctor.rs | 4 +- src/librustdoc/clean/inline.rs | 38 +- src/librustdoc/clean/mod.rs | 214 +-- src/librustdoc/clean/simplify.rs | 4 +- src/librustdoc/config.rs | 2 +- src/librustdoc/core.rs | 205 +-- src/librustdoc/lib.rs | 11 +- src/librustdoc/markdown.rs | 4 +- .../passes/calculate_doc_coverage.rs | 2 +- .../passes/check_code_block_syntax.rs | 10 +- src/librustdoc/passes/collapse_docs.rs | 2 +- .../passes/collect_intra_doc_links.rs | 62 +- src/librustdoc/passes/collect_trait_impls.rs | 12 +- src/librustdoc/passes/mod.rs | 8 +- .../passes/private_items_doc_tests.rs | 12 +- src/librustdoc/passes/propagate_doc_cfg.rs | 2 +- src/librustdoc/passes/strip_hidden.rs | 2 +- src/librustdoc/passes/strip_priv_imports.rs | 2 +- src/librustdoc/passes/strip_private.rs | 2 +- src/librustdoc/passes/unindent_comments.rs | 2 +- src/librustdoc/test.rs | 286 ++-- src/librustdoc/visit_ast.rs | 12 +- src/librustdoc/visit_lib.rs | 10 +- src/rustc/rustc.rs | 11 - .../hotplug_codegen_backend/the_backend.rs | 5 +- src/test/run-make-fulldeps/issue-19371/foo.rs | 74 +- src/test/run-pass-fulldeps/compiler-calls.rs | 81 +- .../deny-intra-link-resolution-failure.stderr | 2 + .../rustdoc-ui/deny-missing-docs-crate.stderr | 2 +- .../rustdoc-ui/deny-missing-docs-macro.stderr | 2 +- .../rustdoc-ui/doc-without-codeblock.stderr | 2 + .../rustdoc-ui/failed-doctest-output.stdout | 7 +- .../rustdoc-ui/intra-doc-alias-ice.stderr | 2 + .../intra-link-span-ice-55723.stderr | 2 + src/test/rustdoc-ui/lint-group.stderr | 2 + .../rustdoc-ui/private-item-doc-test.stderr | 2 + src/tools/rustdoc/main.rs | 12 - 60 files changed, 2521 insertions(+), 2755 deletions(-) create mode 100644 src/librustc_data_structures/box_region.rs delete mode 100644 src/librustc_driver/driver.rs create mode 100644 src/librustc_interface/interface.rs create mode 100644 src/librustc_interface/queries.rs diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 21988de90183..7e0abf752303 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -946,11 +946,6 @@ impl_stable_hash_for!(struct ty::CrateInherentImpls { inherent_impls }); -impl_stable_hash_for!(enum crate::session::CompileIncomplete { - Stopped, - Errored(error_reported) -}); - impl_stable_hash_for!(struct crate::util::common::ErrorReported {}); impl_stable_hash_for!(tuple_struct crate::middle::reachable::ReachableSet { diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index a44d815025e9..55c4b0e54b82 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -11,6 +11,7 @@ use rustc_target::spec::{Target, TargetTriple}; use crate::lint; use crate::middle::cstore; +use syntax; use syntax::ast::{self, IntTy, UintTy, MetaItemKind}; use syntax::source_map::{FileName, FilePathMapping}; use syntax::edition::{Edition, EDITION_NAME_LIST, DEFAULT_EDITION}; @@ -1494,6 +1495,15 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig { ret } +/// Converts the crate cfg! configuration from String to Symbol. +/// `rustc_interface::interface::Config` accepts this in the compiler configuration, +/// but the symbol interner is not yet set up then, so we must convert it later. +pub fn to_crate_config(cfg: FxHashSet<(String, Option)>) -> ast::CrateConfig { + cfg.into_iter() + .map(|(a, b)| (Symbol::intern(&a), b.map(|b| Symbol::intern(&b)))) + .collect() +} + pub fn build_configuration(sess: &Session, mut user_cfg: ast::CrateConfig) -> ast::CrateConfig { // Combine the configuration requested by the session (command line) with // some default and generated configuration items @@ -1800,10 +1810,9 @@ pub fn rustc_optgroups() -> Vec { } // Convert strings provided as --cfg [cfgspec] into a crate_cfg -pub fn parse_cfgspecs(cfgspecs: Vec) -> ast::CrateConfig { - cfgspecs - .into_iter() - .map(|s| { +pub fn parse_cfgspecs(cfgspecs: Vec) -> FxHashSet<(String, Option)> { + syntax::with_globals(move || { + let cfg = cfgspecs.into_iter().map(|s| { let sess = parse::ParseSess::new(FilePathMapping::empty()); let filename = FileName::cfg_spec_source_code(&s); let mut parser = parse::new_parser_from_source_str(&sess, filename, s.to_string()); @@ -1835,8 +1844,11 @@ pub fn parse_cfgspecs(cfgspecs: Vec) -> ast::CrateConfig { } error!(r#"expected `key` or `key="value"`"#); - }) - .collect::() + }).collect::(); + cfg.into_iter().map(|(a, b)| { + (a.to_string(), b.map(|b| b.to_string())) + }).collect() + }) } pub fn get_cmd_lint_options(matches: &getopts::Matches, @@ -1864,7 +1876,7 @@ pub fn get_cmd_lint_options(matches: &getopts::Matches, pub fn build_session_options_and_crate_config( matches: &getopts::Matches, -) -> (Options, ast::CrateConfig) { +) -> (Options, FxHashSet<(String, Option)>) { let color = match matches.opt_str("color").as_ref().map(|s| &s[..]) { Some("auto") => ColorConfig::Auto, Some("always") => ColorConfig::Always, @@ -2590,7 +2602,11 @@ mod tests { use getopts; use crate::lint; use crate::middle::cstore; - use crate::session::config::{build_configuration, build_session_options_and_crate_config}; + use crate::session::config::{ + build_configuration, + build_session_options_and_crate_config, + to_crate_config + }; use crate::session::config::{LtoCli, LinkerPluginLto}; use crate::session::build_session; use crate::session::search_paths::SearchPath; @@ -2631,7 +2647,7 @@ mod tests { let registry = errors::registry::Registry::new(&[]); let (sessopts, cfg) = build_session_options_and_crate_config(matches); let sess = build_session(sessopts, None, registry); - let cfg = build_configuration(&sess, cfg); + let cfg = build_configuration(&sess, to_crate_config(cfg)); assert!(cfg.contains(&(Symbol::intern("test"), None))); }); } @@ -2649,7 +2665,7 @@ mod tests { let registry = errors::registry::Registry::new(&[]); let (sessopts, cfg) = build_session_options_and_crate_config(matches); let sess = build_session(sessopts, None, registry); - let cfg = build_configuration(&sess, cfg); + let cfg = build_configuration(&sess, to_crate_config(cfg)); let mut test_items = cfg.iter().filter(|&&(name, _)| name == "test"); assert!(test_items.next().is_some()); assert!(test_items.next().is_none()); diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 751fa7e95e3a..75a0a8195bc2 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -311,7 +311,7 @@ impl Session { pub fn abort_if_errors(&self) { self.diagnostic().abort_if_errors(); } - pub fn compile_status(&self) -> Result<(), CompileIncomplete> { + pub fn compile_status(&self) -> Result<(), ErrorReported> { compile_result_from_err_count(self.err_count()) } pub fn track_errors(&self, f: F) -> Result @@ -1124,7 +1124,7 @@ pub fn build_session_with_source_map( build_session_(sopts, local_crate_source_file, diagnostic_handler, source_map, lint_caps) } -pub fn build_session_( +fn build_session_( sopts: config::Options, local_crate_source_file: Option, span_diagnostic: errors::Handler, @@ -1334,22 +1334,12 @@ pub fn early_warn(output: config::ErrorOutputType, msg: &str) { handler.emit(&MultiSpan::new(), msg, errors::Level::Warning); } -#[derive(Copy, Clone, Debug)] -pub enum CompileIncomplete { - Stopped, - Errored(ErrorReported), -} -impl From for CompileIncomplete { - fn from(err: ErrorReported) -> CompileIncomplete { - CompileIncomplete::Errored(err) - } -} -pub type CompileResult = Result<(), CompileIncomplete>; +pub type CompileResult = Result<(), ErrorReported>; pub fn compile_result_from_err_count(err_count: usize) -> CompileResult { if err_count == 0 { Ok(()) } else { - Err(CompileIncomplete::Errored(ErrorReported)) + Err(ErrorReported) } } diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 04d503d993db..b705968ce8ae 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -78,7 +78,6 @@ use crate::hir; pub struct AllArenas<'tcx> { pub global: WorkerLocal>, pub interner: SyncDroplessArena, - global_ctxt: Option>, } impl<'tcx> AllArenas<'tcx> { @@ -86,7 +85,6 @@ impl<'tcx> AllArenas<'tcx> { AllArenas { global: WorkerLocal::new(|_| GlobalArenas::default()), interner: SyncDroplessArena::default(), - global_ctxt: None, } } } @@ -1182,20 +1180,19 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// to the context. The closure enforces that the type context and any interned /// value (types, substs, etc.) can only be used while `ty::tls` has a valid /// reference to the context, to allow formatting values that need it. - pub fn create_and_enter(s: &'tcx Session, - cstore: &'tcx CrateStoreDyn, - local_providers: ty::query::Providers<'tcx>, - extern_providers: ty::query::Providers<'tcx>, - arenas: &'tcx mut AllArenas<'tcx>, - resolutions: ty::Resolutions, - hir: hir_map::Map<'tcx>, - on_disk_query_result_cache: query::OnDiskCache<'tcx>, - crate_name: &str, - tx: mpsc::Sender>, - output_filenames: &OutputFilenames, - f: F) -> R - where F: for<'b> FnOnce(TyCtxt<'b, 'tcx, 'tcx>) -> R - { + pub fn create_global_ctxt( + s: &'tcx Session, + cstore: &'tcx CrateStoreDyn, + local_providers: ty::query::Providers<'tcx>, + extern_providers: ty::query::Providers<'tcx>, + arenas: &'tcx AllArenas<'tcx>, + resolutions: ty::Resolutions, + hir: hir_map::Map<'tcx>, + on_disk_query_result_cache: query::OnDiskCache<'tcx>, + crate_name: &str, + tx: mpsc::Sender>, + output_filenames: &OutputFilenames, + ) -> GlobalCtxt<'tcx> { let data_layout = TargetDataLayout::parse(&s.target.target).unwrap_or_else(|err| { s.fatal(&err); }); @@ -1247,7 +1244,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { Lrc::new(StableVec::new(v))); } - arenas.global_ctxt = Some(GlobalCtxt { + GlobalCtxt { sess: s, cstore, global_arenas: &arenas.global, @@ -1293,15 +1290,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { alloc_map: Lock::new(interpret::AllocMap::new()), tx_to_llvm_workers: Lock::new(tx), output_filenames: Arc::new(output_filenames.clone()), - }); - - let gcx = arenas.global_ctxt.as_ref().unwrap(); - - let r = tls::enter_global(gcx, f); - - gcx.queries.record_computed_queries(s); - - r + } } pub fn consider_optimizing String>(&self, msg: T) -> bool { @@ -1985,31 +1974,29 @@ pub mod tls { pub fn enter_global<'gcx, F, R>(gcx: &'gcx GlobalCtxt<'gcx>, f: F) -> R where F: FnOnce(TyCtxt<'gcx, 'gcx, 'gcx>) -> R { - with_thread_locals(|| { - // Update GCX_PTR to indicate there's a GlobalCtxt available - GCX_PTR.with(|lock| { - *lock.lock() = gcx as *const _ as usize; - }); - // Set GCX_PTR back to 0 when we exit - let _on_drop = OnDrop(move || { - GCX_PTR.with(|lock| *lock.lock() = 0); - }); + // Update GCX_PTR to indicate there's a GlobalCtxt available + GCX_PTR.with(|lock| { + *lock.lock() = gcx as *const _ as usize; + }); + // Set GCX_PTR back to 0 when we exit + let _on_drop = OnDrop(move || { + GCX_PTR.with(|lock| *lock.lock() = 0); + }); - let tcx = TyCtxt { - gcx, - interners: &gcx.global_interners, - dummy: PhantomData, - }; - let icx = ImplicitCtxt { - tcx, - query: None, - diagnostics: None, - layout_depth: 0, - task_deps: None, - }; - enter_context(&icx, |_| { - f(tcx) - }) + let tcx = TyCtxt { + gcx, + interners: &gcx.global_interners, + dummy: PhantomData, + }; + let icx = ImplicitCtxt { + tcx, + query: None, + diagnostics: None, + layout_depth: 0, + task_deps: None, + }; + enter_context(&icx, |_| { + f(tcx) }) } diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 1629f1dc6302..1a44dbdbb61a 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -71,7 +71,7 @@ pub use self::binding::BindingMode; pub use self::binding::BindingMode::*; pub use self::context::{TyCtxt, FreeRegionInfo, GlobalArenas, AllArenas, tls, keep_local}; -pub use self::context::{Lift, TypeckTables, CtxtInterners}; +pub use self::context::{Lift, TypeckTables, CtxtInterners, GlobalCtxt}; pub use self::context::{ UserTypeAnnotationIndex, UserType, CanonicalUserType, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, ResolvedOpaqueTy, diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 258391ba8360..7b2b9ec24ea0 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -63,11 +63,12 @@ use std::sync::{mpsc, Arc}; use rustc::dep_graph::DepGraph; use rustc::middle::allocator::AllocatorKind; use rustc::middle::cstore::{EncodedMetadata, MetadataLoader}; -use rustc::session::{Session, CompileIncomplete}; +use rustc::session::Session; use rustc::session::config::{OutputFilenames, OutputType, PrintRequest, OptLevel}; use rustc::ty::{self, TyCtxt}; use rustc::util::time_graph; use rustc::util::profiling::ProfileCategory; +use rustc::util::common::ErrorReported; use rustc_mir::monomorphize; use rustc_codegen_ssa::ModuleCodegen; use rustc_codegen_utils::codegen_backend::CodegenBackend; @@ -311,7 +312,7 @@ impl CodegenBackend for LlvmCodegenBackend { sess: &Session, dep_graph: &DepGraph, outputs: &OutputFilenames, - ) -> Result<(), CompileIncomplete>{ + ) -> Result<(), ErrorReported>{ use rustc::util::common::time; let (codegen_results, work_products) = ongoing_codegen.downcast:: diff --git a/src/librustc_codegen_utils/codegen_backend.rs b/src/librustc_codegen_utils/codegen_backend.rs index 28d7d1842284..29bcb4f2e644 100644 --- a/src/librustc_codegen_utils/codegen_backend.rs +++ b/src/librustc_codegen_utils/codegen_backend.rs @@ -21,7 +21,8 @@ use flate2::write::DeflateEncoder; use syntax::symbol::Symbol; use rustc::hir::def_id::LOCAL_CRATE; -use rustc::session::{Session, CompileIncomplete}; +use rustc::session::Session; +use rustc::util::common::ErrorReported; use rustc::session::config::{CrateType, OutputFilenames, PrintRequest}; use rustc::ty::TyCtxt; use rustc::ty::query::Providers; @@ -61,7 +62,7 @@ pub trait CodegenBackend { sess: &Session, dep_graph: &DepGraph, outputs: &OutputFilenames, - ) -> Result<(), CompileIncomplete>; + ) -> Result<(), ErrorReported>; } pub struct NoLlvmMetadataLoader; @@ -163,7 +164,7 @@ impl CodegenBackend for MetadataOnlyCodegenBackend { sess: &Session, _dep_graph: &DepGraph, outputs: &OutputFilenames, - ) -> Result<(), CompileIncomplete> { + ) -> Result<(), ErrorReported> { let ongoing_codegen = ongoing_codegen.downcast::() .expect("Expected MetadataOnlyCodegenBackend's OngoingCodegen, found Box"); for &crate_type in sess.opts.crate_types.iter() { diff --git a/src/librustc_data_structures/box_region.rs b/src/librustc_data_structures/box_region.rs new file mode 100644 index 000000000000..278dcdf2bee4 --- /dev/null +++ b/src/librustc_data_structures/box_region.rs @@ -0,0 +1,172 @@ +use std::cell::Cell; +use std::marker::PhantomData; +use std::pin::Pin; +use std::ops::{Generator, GeneratorState}; + +#[derive(Copy, Clone)] +pub struct AccessAction(*mut dyn FnMut()); + +impl AccessAction { + pub fn get(self) -> *mut dyn FnMut() { + self.0 + } +} + +#[derive(Copy, Clone)] +pub enum Action { + Access(AccessAction), + Complete, +} + +thread_local!(pub static BOX_REGION_ARG: Cell = Cell::new(Action::Complete)); + +pub struct PinnedGenerator { + generator: Pin, Return = R>>> +} + +impl PinnedGenerator { + pub fn new< + T: Generator, Return = R> + 'static + >(generator: T) -> (I, Self) { + let mut result = PinnedGenerator { + generator: Box::pin(generator) + }; + + // Run it to the first yield to set it up + let init = match Pin::new(&mut result.generator).resume() { + GeneratorState::Yielded( + YieldType::Initial(y) + ) => y, + _ => panic!() + }; + + (init, result) + } + + pub unsafe fn access(&mut self, closure: *mut dyn FnMut()) { + BOX_REGION_ARG.with(|i| { + i.set(Action::Access(AccessAction(closure))); + }); + + // Call the generator, which in turn will call the closure in BOX_REGION_ARG + if let GeneratorState::Complete(_) = Pin::new(&mut self.generator).resume() { + panic!() + } + } + + pub fn complete(&mut self) -> R { + // Tell the generator we want it to complete, consuming it and yielding a result + BOX_REGION_ARG.with(|i| { + i.set(Action::Complete) + }); + + let result = Pin::new(&mut self.generator).resume(); + if let GeneratorState::Complete(r) = result { + r + } else { + panic!() + } + } +} + +#[derive(PartialEq)] +pub struct Marker(PhantomData); + +impl Marker { + pub unsafe fn new() -> Self { + Marker(PhantomData) + } +} + +pub enum YieldType { + Initial(I), + Accessor(Marker), +} + +#[macro_export] +#[allow_internal_unstable(fn_traits)] +macro_rules! declare_box_region_type { + (impl $v:vis + $name: ident, + $yield_type:ty, + for($($lifetimes:tt)*), + ($($args:ty),*) -> ($reti:ty, $retc:ty) + ) => { + $v struct $name($crate::box_region::PinnedGenerator< + $reti, + for<$($lifetimes)*> fn(($($args,)*)), + $retc + >); + + impl $name { + fn new + 'static>( + generator: T + ) -> ($reti, Self) { + let (initial, pinned) = $crate::box_region::PinnedGenerator::new(generator); + (initial, $name(pinned)) + } + + $v fn access FnOnce($($args,)*) -> R, R>(&mut self, f: F) -> R { + // Turn the FnOnce closure into *mut dyn FnMut() + // so we can pass it in to the generator using the BOX_REGION_ARG thread local + let mut r = None; + let mut f = Some(f); + let mut_f: &mut dyn for<$($lifetimes)*> FnMut(($($args,)*)) = + &mut |args| { + let f = f.take().unwrap(); + r = Some(FnOnce::call_once(f, args)); + }; + let mut_f = mut_f as *mut dyn for<$($lifetimes)*> FnMut(($($args,)*)); + + // Get the generator to call our closure + unsafe { + self.0.access(::std::mem::transmute(mut_f)); + } + + // Unwrap the result + r.unwrap() + } + + $v fn complete(mut self) -> $retc { + self.0.complete() + } + + fn initial_yield(value: $reti) -> $yield_type { + $crate::box_region::YieldType::Initial(value) + } + } + }; + + ($v:vis $name: ident, for($($lifetimes:tt)*), ($($args:ty),*) -> ($reti:ty, $retc:ty)) => { + declare_box_region_type!( + impl $v $name, + $crate::box_region::YieldType<$reti, for<$($lifetimes)*> fn(($($args,)*))>, + for($($lifetimes)*), + ($($args),*) -> ($reti, $retc) + ); + }; +} + +#[macro_export] +#[allow_internal_unstable(fn_traits)] +macro_rules! box_region_allow_access { + (for($($lifetimes:tt)*), ($($args:ty),*), ($($exprs:expr),*) ) => { + loop { + match $crate::box_region::BOX_REGION_ARG.with(|i| i.get()) { + $crate::box_region::Action::Access(accessor) => { + let accessor: &mut dyn for<$($lifetimes)*> FnMut($($args),*) = unsafe { + ::std::mem::transmute(accessor.get()) + }; + (*accessor)(($($exprs),*)); + unsafe { + let marker = $crate::box_region::Marker::< + for<$($lifetimes)*> fn(($($args,)*)) + >::new(); + yield $crate::box_region::YieldType::Accessor(marker) + }; + } + $crate::box_region::Action::Complete => break, + } + } + } +} diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 09482340b1a1..a1d7ab8856da 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -10,6 +10,8 @@ #![feature(in_band_lifetimes)] #![feature(unboxed_closures)] +#![feature(generators)] +#![feature(generator_trait)] #![feature(fn_traits)] #![feature(unsize)] #![feature(specialization)] @@ -71,6 +73,7 @@ pub mod macros; pub mod svh; pub mod base_n; pub mod bit_set; +pub mod box_region; pub mod const_cstr; pub mod flock; pub mod fx; diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs deleted file mode 100644 index d3e295607c2b..000000000000 --- a/src/librustc_driver/driver.rs +++ /dev/null @@ -1,1244 +0,0 @@ -use rustc::dep_graph::DepGraph; -use rustc::hir; -use rustc::hir::lowering::lower_crate; -use rustc::hir::map as hir_map; -use rustc::hir::def_id::LOCAL_CRATE; -use rustc::lint; -use rustc::middle::{self, reachable, resolve_lifetime, stability}; -use rustc::ty::{self, AllArenas, Resolutions, TyCtxt}; -use rustc::traits; -use rustc::util::common::{install_panic_hook, time, ErrorReported}; -use rustc::util::profiling::ProfileCategory; -use rustc::session::{CompileResult, Session}; -use rustc::session::CompileIncomplete; -use rustc::session::config::{self, Input, OutputFilenames, OutputType}; -use rustc::session::search_paths::PathKind; -use rustc_allocator as allocator; -use rustc_borrowck as borrowck; -use rustc_codegen_utils::codegen_backend::CodegenBackend; -use rustc_data_structures::sync::{self, Lock}; -#[cfg(parallel_compiler)] -use rustc_data_structures::jobserver; -use rustc_incremental; -use rustc_metadata::creader::CrateLoader; -use rustc_metadata::cstore::{self, CStore}; -use rustc_mir as mir; -use rustc_passes::{self, ast_validation, hir_stats}; -use rustc_plugin as plugin; -use rustc_plugin::registry::Registry; -use rustc_privacy; -use rustc_resolve::{Resolver, ResolverArenas}; -use rustc_traits; -use rustc_typeck as typeck; -use syntax::{self, ast, diagnostics, visit}; -use syntax::early_buffered_lints::BufferedEarlyLint; -use syntax::ext::base::ExtCtxt; -use syntax::mut_visit::MutVisitor; -use syntax::parse::{self, PResult}; -use syntax::util::node_count::NodeCounter; -use syntax_pos::hygiene; -use syntax_ext; - -use serialize::json; - -use std::any::Any; -use std::env; -use std::ffi::OsString; -use std::fs; -use std::iter; -use std::path::{Path, PathBuf}; -use std::sync::mpsc; - -use rustc_interface::{util, profile, passes}; -use super::Compilation; - -#[cfg(not(parallel_compiler))] -pub fn spawn_thread_pool R + sync::Send, R: sync::Send>( - opts: config::Options, - f: F -) -> R { - ty::tls::GCX_PTR.set(&Lock::new(0), || { - f(opts) - }) -} - -#[cfg(parallel_compiler)] -pub fn spawn_thread_pool R + sync::Send, R: sync::Send>( - opts: config::Options, - f: F -) -> R { - use syntax; - use syntax_pos; - use rayon::{ThreadPoolBuilder, ThreadPool}; - - let gcx_ptr = &Lock::new(0); - - let config = ThreadPoolBuilder::new() - .acquire_thread_handler(jobserver::acquire_thread) - .release_thread_handler(jobserver::release_thread) - .num_threads(Session::threads_from_count(opts.debugging_opts.threads)) - .deadlock_handler(|| unsafe { ty::query::handle_deadlock() }) - .stack_size(::STACK_SIZE); - - let with_pool = move |pool: &ThreadPool| { - pool.install(move || f(opts)) - }; - - syntax::GLOBALS.with(|syntax_globals| { - syntax_pos::GLOBALS.with(|syntax_pos_globals| { - // The main handler run for each Rayon worker thread and sets up - // the thread local rustc uses. syntax_globals and syntax_pos_globals are - // captured and set on the new threads. ty::tls::with_thread_locals sets up - // thread local callbacks from libsyntax - let main_handler = move |worker: &mut dyn FnMut()| { - syntax::GLOBALS.set(syntax_globals, || { - syntax_pos::GLOBALS.set(syntax_pos_globals, || { - ty::tls::with_thread_locals(|| { - ty::tls::GCX_PTR.set(gcx_ptr, || { - worker() - }) - }) - }) - }) - }; - - ThreadPool::scoped_pool(config, main_handler, with_pool).unwrap() - }) - }) -} - -pub fn compile_input( - codegen_backend: Box, - sess: &Session, - cstore: &CStore, - input_path: &Option, - input: &Input, - outdir: &Option, - output: &Option, - addl_plugins: Option>, - control: &CompileController, -) -> CompileResult { - macro_rules! controller_entry_point { - ($point: ident, $tsess: expr, $make_state: expr, $phase_result: expr) => {{ - let state = &mut $make_state; - let phase_result: &CompileResult = &$phase_result; - if phase_result.is_ok() || control.$point.run_callback_on_error { - (control.$point.callback)(state); - } - - if control.$point.stop == Compilation::Stop { - // FIXME: shouldn't this return Err(CompileIncomplete::Stopped) - // if there are no errors? - return $tsess.compile_status(); - } - }} - } - - if sess.profile_queries() { - profile::begin(sess); - } - - // We need nested scopes here, because the intermediate results can keep - // large chunks of memory alive and we want to free them as soon as - // possible to keep the peak memory usage low - let (outputs, ongoing_codegen, dep_graph) = { - let krate = match phase_1_parse_input(control, sess, input) { - Ok(krate) => krate, - Err(mut parse_error) => { - parse_error.emit(); - return Err(CompileIncomplete::Errored(ErrorReported)); - } - }; - - let (krate, registry) = { - let mut compile_state = - CompileState::state_after_parse(input, sess, outdir, output, krate, &cstore); - controller_entry_point!(after_parse, sess, compile_state, Ok(())); - - (compile_state.krate.unwrap(), compile_state.registry) - }; - - let outputs = util::build_output_filenames(input, outdir, output, &krate.attrs, sess); - let crate_name = - ::rustc_codegen_utils::link::find_crate_name(Some(sess), &krate.attrs, input); - install_panic_hook(); - - let ExpansionResult { - expanded_crate, - defs, - resolutions, - mut hir_forest, - } = { - phase_2_configure_and_expand( - sess, - &cstore, - krate, - registry, - &crate_name, - addl_plugins, - |expanded_crate| { - let mut state = CompileState::state_after_expand( - input, - sess, - outdir, - output, - &cstore, - expanded_crate, - &crate_name, - ); - controller_entry_point!(after_expand, sess, state, Ok(())); - Ok(()) - }, - )? - }; - - let output_paths = passes::generated_output_paths( - sess, - &outputs, - output.is_some(), - &crate_name - ); - - // Ensure the source file isn't accidentally overwritten during compilation. - if let Some(ref input_path) = *input_path { - if sess.opts.will_create_output_file() { - if passes::output_contains_path(&output_paths, input_path) { - sess.err(&format!( - "the input file \"{}\" would be overwritten by the generated \ - executable", - input_path.display() - )); - return Err(CompileIncomplete::Stopped); - } - if let Some(dir_path) = passes::output_conflicts_with_dir(&output_paths) { - sess.err(&format!( - "the generated executable for the input file \"{}\" conflicts with the \ - existing directory \"{}\"", - input_path.display(), - dir_path.display() - )); - return Err(CompileIncomplete::Stopped); - } - } - } - - passes::write_out_deps(sess, &outputs, &output_paths); - if sess.opts.output_types.contains_key(&OutputType::DepInfo) - && sess.opts.output_types.len() == 1 - { - return Ok(()); - } - - if let &Some(ref dir) = outdir { - if fs::create_dir_all(dir).is_err() { - sess.err("failed to find or create the directory specified by --out-dir"); - return Err(CompileIncomplete::Stopped); - } - } - - // Construct the HIR map - let hir_map = time(sess, "indexing hir", || { - hir_map::map_crate(sess, cstore, &mut hir_forest, &defs) - }); - - { - hir_map.dep_graph.assert_ignored(); - controller_entry_point!( - after_hir_lowering, - sess, - CompileState::state_after_hir_lowering( - input, - sess, - outdir, - output, - &cstore, - &hir_map, - &resolutions, - &expanded_crate, - &hir_map.krate(), - &outputs, - &crate_name - ), - Ok(()) - ); - } - - let opt_crate = if control.keep_ast { - Some(&expanded_crate) - } else { - drop(expanded_crate); - None - }; - - let mut arenas = AllArenas::new(); - - phase_3_run_analysis_passes( - &*codegen_backend, - control, - sess, - cstore, - hir_map, - resolutions, - &mut arenas, - &crate_name, - &outputs, - |tcx, rx, result| { - { - // Eventually, we will want to track plugins. - tcx.dep_graph.with_ignore(|| { - let mut state = CompileState::state_after_analysis( - input, - sess, - outdir, - output, - opt_crate, - tcx.hir().krate(), - tcx, - &crate_name, - ); - (control.after_analysis.callback)(&mut state); - }); - - // Plugins like clippy and rust-semverver stop the analysis early, - // but want to still return an error if errors during the analysis - // happened: - tcx.sess.compile_status()?; - - if control.after_analysis.stop == Compilation::Stop { - return result.and_then(|_| Err(CompileIncomplete::Stopped)); - } - } - - result?; - - if log_enabled!(::log::Level::Info) { - println!("Pre-codegen"); - tcx.print_debug_stats(); - } - - let ongoing_codegen = phase_4_codegen(&*codegen_backend, tcx, rx); - - if log_enabled!(::log::Level::Info) { - println!("Post-codegen"); - tcx.print_debug_stats(); - } - - if tcx.sess.opts.output_types.contains_key(&OutputType::Mir) { - if let Err(e) = mir::transform::dump_mir::emit_mir(tcx, &outputs) { - sess.err(&format!("could not emit MIR: {}", e)); - sess.abort_if_errors(); - } - } - - if tcx.sess.opts.debugging_opts.query_stats { - tcx.queries.print_stats(); - } - - Ok((outputs.clone(), ongoing_codegen, tcx.dep_graph.clone())) - }, - )? - }; - - if sess.opts.debugging_opts.print_type_sizes { - sess.code_stats.borrow().print_type_sizes(); - } - - codegen_backend.join_codegen_and_link(ongoing_codegen, sess, &dep_graph, &outputs)?; - - if sess.opts.debugging_opts.perf_stats { - sess.print_perf_stats(); - } - - controller_entry_point!( - compilation_done, - sess, - CompileState::state_when_compilation_done(input, sess, outdir, output), - Ok(()) - ); - - Ok(()) -} - -/// CompileController is used to customize compilation, it allows compilation to -/// be stopped and/or to call arbitrary code at various points in compilation. -/// It also allows for various flags to be set to influence what information gets -/// collected during compilation. -/// -/// This is a somewhat higher level controller than a Session - the Session -/// controls what happens in each phase, whereas the CompileController controls -/// whether a phase is run at all and whether other code (from outside the -/// compiler) is run between phases. -/// -/// Note that if compilation is set to stop and a callback is provided for a -/// given entry point, the callback is called before compilation is stopped. -/// -/// Expect more entry points to be added in the future. -pub struct CompileController<'a> { - pub after_parse: PhaseController<'a>, - pub after_expand: PhaseController<'a>, - pub after_hir_lowering: PhaseController<'a>, - pub after_analysis: PhaseController<'a>, - pub compilation_done: PhaseController<'a>, - - // FIXME we probably want to group the below options together and offer a - // better API, rather than this ad-hoc approach. - // Whether the compiler should keep the ast beyond parsing. - pub keep_ast: bool, - // -Zcontinue-parse-after-error - pub continue_parse_after_error: bool, - - /// Allows overriding default rustc query providers, - /// after `default_provide` has installed them. - pub provide: Box, - /// Same as `provide`, but only for non-local crates, - /// applied after `default_provide_extern`. - pub provide_extern: Box, -} - -impl<'a> CompileController<'a> { - pub fn basic() -> CompileController<'a> { - sync::assert_send::(); - CompileController { - after_parse: PhaseController::basic(), - after_expand: PhaseController::basic(), - after_hir_lowering: PhaseController::basic(), - after_analysis: PhaseController::basic(), - compilation_done: PhaseController::basic(), - keep_ast: false, - continue_parse_after_error: false, - provide: box |_| {}, - provide_extern: box |_| {}, - } - } -} - -/// This implementation makes it easier to create a custom driver when you only want to hook -/// into callbacks from `CompileController`. -/// -/// # Example -/// -/// ```no_run -/// # extern crate rustc_driver; -/// # use rustc_driver::driver::CompileController; -/// let mut controller = CompileController::basic(); -/// controller.after_analysis.callback = Box::new(move |_state| {}); -/// rustc_driver::run_compiler(&[], Box::new(controller), None, None); -/// ``` -impl<'a> ::CompilerCalls<'a> for CompileController<'a> { - fn early_callback( - &mut self, - matches: &::getopts::Matches, - sopts: &config::Options, - cfg: &ast::CrateConfig, - descriptions: &::errors::registry::Registry, - output: ::ErrorOutputType, - ) -> Compilation { - ::RustcDefaultCalls.early_callback( - matches, - sopts, - cfg, - descriptions, - output, - ) - } - fn no_input( - &mut self, - matches: &::getopts::Matches, - sopts: &config::Options, - cfg: &ast::CrateConfig, - odir: &Option, - ofile: &Option, - descriptions: &::errors::registry::Registry, - ) -> Option<(Input, Option)> { - ::RustcDefaultCalls.no_input( - matches, - sopts, - cfg, - odir, - ofile, - descriptions, - ) - } - fn late_callback( - &mut self, - codegen_backend: &dyn (::CodegenBackend), - matches: &::getopts::Matches, - sess: &Session, - cstore: &CStore, - input: &Input, - odir: &Option, - ofile: &Option, - ) -> Compilation { - ::RustcDefaultCalls - .late_callback(codegen_backend, matches, sess, cstore, input, odir, ofile) - } - fn build_controller( - self: Box, - _: &Session, - _: &::getopts::Matches - ) -> CompileController<'a> { - *self - } -} - -pub struct PhaseController<'a> { - pub stop: Compilation, - // If true then the compiler will try to run the callback even if the phase - // ends with an error. Note that this is not always possible. - pub run_callback_on_error: bool, - pub callback: Box, -} - -impl<'a> PhaseController<'a> { - pub fn basic() -> PhaseController<'a> { - PhaseController { - stop: Compilation::Continue, - run_callback_on_error: false, - callback: box |_| {}, - } - } -} - -/// State that is passed to a callback. What state is available depends on when -/// during compilation the callback is made. See the various constructor methods -/// (`state_*`) in the impl to see which data is provided for any given entry point. -pub struct CompileState<'a, 'tcx: 'a> { - pub input: &'a Input, - pub session: &'tcx Session, - pub krate: Option, - pub registry: Option>, - pub cstore: Option<&'tcx CStore>, - pub crate_name: Option<&'a str>, - pub output_filenames: Option<&'a OutputFilenames>, - pub out_dir: Option<&'a Path>, - pub out_file: Option<&'a Path>, - pub expanded_crate: Option<&'a ast::Crate>, - pub hir_crate: Option<&'a hir::Crate>, - pub hir_map: Option<&'a hir_map::Map<'tcx>>, - pub resolutions: Option<&'a Resolutions>, - pub tcx: Option>, -} - -impl<'a, 'tcx> CompileState<'a, 'tcx> { - fn empty(input: &'a Input, session: &'tcx Session, out_dir: &'a Option) -> Self { - CompileState { - input, - session, - out_dir: out_dir.as_ref().map(|s| &**s), - out_file: None, - krate: None, - registry: None, - cstore: None, - crate_name: None, - output_filenames: None, - expanded_crate: None, - hir_crate: None, - hir_map: None, - resolutions: None, - tcx: None, - } - } - - fn state_after_parse( - input: &'a Input, - session: &'tcx Session, - out_dir: &'a Option, - out_file: &'a Option, - krate: ast::Crate, - cstore: &'tcx CStore, - ) -> Self { - CompileState { - // Initialize the registry before moving `krate` - registry: Some(Registry::new(&session, krate.span)), - krate: Some(krate), - cstore: Some(cstore), - out_file: out_file.as_ref().map(|s| &**s), - ..CompileState::empty(input, session, out_dir) - } - } - - fn state_after_expand( - input: &'a Input, - session: &'tcx Session, - out_dir: &'a Option, - out_file: &'a Option, - cstore: &'tcx CStore, - expanded_crate: &'a ast::Crate, - crate_name: &'a str, - ) -> Self { - CompileState { - crate_name: Some(crate_name), - cstore: Some(cstore), - expanded_crate: Some(expanded_crate), - out_file: out_file.as_ref().map(|s| &**s), - ..CompileState::empty(input, session, out_dir) - } - } - - fn state_after_hir_lowering( - input: &'a Input, - session: &'tcx Session, - out_dir: &'a Option, - out_file: &'a Option, - cstore: &'tcx CStore, - hir_map: &'a hir_map::Map<'tcx>, - resolutions: &'a Resolutions, - krate: &'a ast::Crate, - hir_crate: &'a hir::Crate, - output_filenames: &'a OutputFilenames, - crate_name: &'a str, - ) -> Self { - CompileState { - crate_name: Some(crate_name), - cstore: Some(cstore), - hir_map: Some(hir_map), - resolutions: Some(resolutions), - expanded_crate: Some(krate), - hir_crate: Some(hir_crate), - output_filenames: Some(output_filenames), - out_file: out_file.as_ref().map(|s| &**s), - ..CompileState::empty(input, session, out_dir) - } - } - - fn state_after_analysis( - input: &'a Input, - session: &'tcx Session, - out_dir: &'a Option, - out_file: &'a Option, - krate: Option<&'a ast::Crate>, - hir_crate: &'a hir::Crate, - tcx: TyCtxt<'a, 'tcx, 'tcx>, - crate_name: &'a str, - ) -> Self { - CompileState { - tcx: Some(tcx), - expanded_crate: krate, - hir_crate: Some(hir_crate), - crate_name: Some(crate_name), - out_file: out_file.as_ref().map(|s| &**s), - ..CompileState::empty(input, session, out_dir) - } - } - - fn state_when_compilation_done( - input: &'a Input, - session: &'tcx Session, - out_dir: &'a Option, - out_file: &'a Option, - ) -> Self { - CompileState { - out_file: out_file.as_ref().map(|s| &**s), - ..CompileState::empty(input, session, out_dir) - } - } -} - -pub fn phase_1_parse_input<'a>( - control: &CompileController, - sess: &'a Session, - input: &Input, -) -> PResult<'a, ast::Crate> { - sess.diagnostic() - .set_continue_after_error(control.continue_parse_after_error); - hygiene::set_default_edition(sess.edition()); - - if sess.profile_queries() { - profile::begin(sess); - } - - sess.profiler(|p| p.start_activity(ProfileCategory::Parsing)); - let krate = time(sess, "parsing", || match *input { - Input::File(ref file) => parse::parse_crate_from_file(file, &sess.parse_sess), - Input::Str { - ref input, - ref name, - } => parse::parse_crate_from_source_str(name.clone(), input.clone(), &sess.parse_sess), - })?; - sess.profiler(|p| p.end_activity(ProfileCategory::Parsing)); - - sess.diagnostic().set_continue_after_error(true); - - if sess.opts.debugging_opts.ast_json_noexpand { - println!("{}", json::as_json(&krate)); - } - - if sess.opts.debugging_opts.input_stats { - println!( - "Lines of code: {}", - sess.source_map().count_lines() - ); - println!("Pre-expansion node count: {}", count_nodes(&krate)); - } - - if let Some(ref s) = sess.opts.debugging_opts.show_span { - syntax::show_span::run(sess.diagnostic(), s, &krate); - } - - if sess.opts.debugging_opts.hir_stats { - hir_stats::print_ast_stats(&krate, "PRE EXPANSION AST STATS"); - } - - Ok(krate) -} - -fn count_nodes(krate: &ast::Crate) -> usize { - let mut counter = NodeCounter::new(); - visit::walk_crate(&mut counter, krate); - counter.count -} - -// For continuing compilation after a parsed crate has been -// modified - -pub struct ExpansionResult { - pub expanded_crate: ast::Crate, - pub defs: hir_map::Definitions, - pub resolutions: Resolutions, - pub hir_forest: hir_map::Forest, -} - -pub struct InnerExpansionResult<'a> { - pub expanded_crate: ast::Crate, - pub resolver: Resolver<'a>, - pub hir_forest: hir_map::Forest, -} - -/// Runs the "early phases" of the compiler: initial `cfg` processing, -/// loading compiler plugins (including those from `addl_plugins`), -/// syntax expansion, secondary `cfg` expansion, synthesis of a test -/// harness if one is to be provided, injection of a dependency on the -/// standard library and prelude, and name resolution. -/// -/// Returns `None` if we're aborting after handling -W help. -pub fn phase_2_configure_and_expand( - sess: &Session, - cstore: &CStore, - krate: ast::Crate, - registry: Option, - crate_name: &str, - addl_plugins: Option>, - after_expand: F, -) -> Result -where - F: FnOnce(&ast::Crate) -> CompileResult, -{ - // Currently, we ignore the name resolution data structures for the purposes of dependency - // tracking. Instead we will run name resolution and include its output in the hash of each - // item, much like we do for macro expansion. In other words, the hash reflects not just - // its contents but the results of name resolution on those contents. Hopefully we'll push - // this back at some point. - let mut crate_loader = CrateLoader::new(sess, &cstore, &crate_name); - let resolver_arenas = Resolver::arenas(); - let result = phase_2_configure_and_expand_inner( - sess, - cstore, - krate, - registry, - crate_name, - addl_plugins, - &resolver_arenas, - &mut crate_loader, - after_expand, - ); - match result { - Ok(InnerExpansionResult { - expanded_crate, - resolver, - hir_forest, - }) => Ok(ExpansionResult { - expanded_crate, - defs: resolver.definitions, - hir_forest, - resolutions: Resolutions { - freevars: resolver.freevars, - export_map: resolver.export_map, - trait_map: resolver.trait_map, - glob_map: resolver.glob_map, - maybe_unused_trait_imports: resolver.maybe_unused_trait_imports, - maybe_unused_extern_crates: resolver.maybe_unused_extern_crates, - extern_prelude: resolver.extern_prelude.iter().map(|(ident, entry)| { - (ident.name, entry.introduced_by_item) - }).collect(), - }, - }), - Err(x) => Err(x), - } -} - -/// Same as phase_2_configure_and_expand, but doesn't let you keep the resolver -/// around -pub fn phase_2_configure_and_expand_inner<'a, F>( - sess: &'a Session, - cstore: &'a CStore, - mut krate: ast::Crate, - registry: Option, - crate_name: &str, - addl_plugins: Option>, - resolver_arenas: &'a ResolverArenas<'a>, - crate_loader: &'a mut CrateLoader<'a>, - after_expand: F, -) -> Result, CompileIncomplete> -where - F: FnOnce(&ast::Crate) -> CompileResult, -{ - krate = time(sess, "attributes injection", || { - syntax::attr::inject(krate, &sess.parse_sess, &sess.opts.debugging_opts.crate_attr) - }); - - let (mut krate, features) = syntax::config::features( - krate, - &sess.parse_sess, - sess.edition(), - ); - // these need to be set "early" so that expansion sees `quote` if enabled. - sess.init_features(features); - - let crate_types = util::collect_crate_types(sess, &krate.attrs); - sess.crate_types.set(crate_types); - - let disambiguator = util::compute_crate_disambiguator(sess); - sess.crate_disambiguator.set(disambiguator); - rustc_incremental::prepare_session_directory(sess, &crate_name, disambiguator); - - if sess.opts.incremental.is_some() { - time(sess, "garbage collect incremental cache directory", || { - if let Err(e) = rustc_incremental::garbage_collect_session_directories(sess) { - warn!( - "Error while trying to garbage collect incremental \ - compilation cache directory: {}", - e - ); - } - }); - } - - // If necessary, compute the dependency graph (in the background). - let future_dep_graph = if sess.opts.build_dep_graph() { - Some(rustc_incremental::load_dep_graph(sess)) - } else { - None - }; - - time(sess, "recursion limit", || { - middle::recursion_limit::update_limits(sess, &krate); - }); - - krate = time(sess, "crate injection", || { - let alt_std_name = sess.opts.alt_std_name.as_ref().map(|s| &**s); - syntax::std_inject::maybe_inject_crates_ref(krate, alt_std_name, sess.edition()) - }); - - let mut addl_plugins = Some(addl_plugins); - let registrars = time(sess, "plugin loading", || { - plugin::load::load_plugins( - sess, - &cstore, - &krate, - crate_name, - addl_plugins.take().unwrap(), - ) - }); - - let mut registry = registry.unwrap_or_else(|| Registry::new(sess, krate.span)); - - time(sess, "plugin registration", || { - if sess.features_untracked().rustc_diagnostic_macros { - registry.register_macro( - "__diagnostic_used", - diagnostics::plugin::expand_diagnostic_used, - ); - registry.register_macro( - "__register_diagnostic", - diagnostics::plugin::expand_register_diagnostic, - ); - registry.register_macro( - "__build_diagnostic_array", - diagnostics::plugin::expand_build_diagnostic_array, - ); - } - - for registrar in registrars { - registry.args_hidden = Some(registrar.args); - (registrar.fun)(&mut registry); - } - }); - - let Registry { - syntax_exts, - early_lint_passes, - late_lint_passes, - lint_groups, - llvm_passes, - attributes, - .. - } = registry; - - sess.track_errors(|| { - let mut ls = sess.lint_store.borrow_mut(); - for pass in early_lint_passes { - ls.register_early_pass(Some(sess), true, false, pass); - } - for pass in late_lint_passes { - ls.register_late_pass(Some(sess), true, pass); - } - - for (name, (to, deprecated_name)) in lint_groups { - ls.register_group(Some(sess), true, name, deprecated_name, to); - } - - *sess.plugin_llvm_passes.borrow_mut() = llvm_passes; - *sess.plugin_attributes.borrow_mut() = attributes.clone(); - })?; - - // Lint plugins are registered; now we can process command line flags. - if sess.opts.describe_lints { - super::describe_lints(&sess, &sess.lint_store.borrow(), true); - return Err(CompileIncomplete::Stopped); - } - - time(sess, "pre ast expansion lint checks", || { - lint::check_ast_crate( - sess, - &krate, - true, - rustc_lint::BuiltinCombinedPreExpansionLintPass::new()); - }); - - let mut resolver = Resolver::new( - sess, - cstore, - &krate, - crate_name, - crate_loader, - &resolver_arenas, - ); - syntax_ext::register_builtins(&mut resolver, syntax_exts); - - // Expand all macros - sess.profiler(|p| p.start_activity(ProfileCategory::Expansion)); - krate = time(sess, "expansion", || { - // Windows dlls do not have rpaths, so they don't know how to find their - // dependencies. It's up to us to tell the system where to find all the - // dependent dlls. Note that this uses cfg!(windows) as opposed to - // targ_cfg because syntax extensions are always loaded for the host - // compiler, not for the target. - // - // This is somewhat of an inherently racy operation, however, as - // multiple threads calling this function could possibly continue - // extending PATH far beyond what it should. To solve this for now we - // just don't add any new elements to PATH which are already there - // within PATH. This is basically a targeted fix at #17360 for rustdoc - // which runs rustc in parallel but has been seen (#33844) to cause - // problems with PATH becoming too long. - let mut old_path = OsString::new(); - if cfg!(windows) { - old_path = env::var_os("PATH").unwrap_or(old_path); - let mut new_path = sess.host_filesearch(PathKind::All).search_path_dirs(); - for path in env::split_paths(&old_path) { - if !new_path.contains(&path) { - new_path.push(path); - } - } - env::set_var( - "PATH", - &env::join_paths( - new_path - .iter() - .filter(|p| env::join_paths(iter::once(p)).is_ok()), - ).unwrap(), - ); - } - - // Create the config for macro expansion - let features = sess.features_untracked(); - let cfg = syntax::ext::expand::ExpansionConfig { - features: Some(&features), - recursion_limit: *sess.recursion_limit.get(), - trace_mac: sess.opts.debugging_opts.trace_macros, - should_test: sess.opts.test, - ..syntax::ext::expand::ExpansionConfig::default(crate_name.to_string()) - }; - - let mut ecx = ExtCtxt::new(&sess.parse_sess, cfg, &mut resolver); - - // Expand macros now! - let krate = time(sess, "expand crate", || { - ecx.monotonic_expander().expand_crate(krate) - }); - - // The rest is error reporting - - time(sess, "check unused macros", || { - ecx.check_unused_macros(); - }); - - let mut missing_fragment_specifiers: Vec<_> = ecx.parse_sess - .missing_fragment_specifiers - .borrow() - .iter() - .cloned() - .collect(); - missing_fragment_specifiers.sort(); - - for span in missing_fragment_specifiers { - let lint = lint::builtin::MISSING_FRAGMENT_SPECIFIER; - let msg = "missing fragment specifier"; - sess.buffer_lint(lint, ast::CRATE_NODE_ID, span, msg); - } - if cfg!(windows) { - env::set_var("PATH", &old_path); - } - krate - }); - sess.profiler(|p| p.end_activity(ProfileCategory::Expansion)); - - time(sess, "maybe building test harness", || { - syntax::test::modify_for_testing( - &sess.parse_sess, - &mut resolver, - sess.opts.test, - &mut krate, - sess.diagnostic(), - &sess.features_untracked(), - ) - }); - - // If we're actually rustdoc then there's no need to actually compile - // anything, so switch everything to just looping - if sess.opts.actually_rustdoc { - util::ReplaceBodyWithLoop::new(sess).visit_crate(&mut krate); - } - - let (has_proc_macro_decls, has_global_allocator) = time(sess, "AST validation", || { - ast_validation::check_crate(sess, &krate) - }); - - // If we're in rustdoc we're always compiling as an rlib, but that'll trip a - // bunch of checks in the `modify` function below. For now just skip this - // step entirely if we're rustdoc as it's not too useful anyway. - if !sess.opts.actually_rustdoc { - krate = time(sess, "maybe creating a macro crate", || { - let crate_types = sess.crate_types.borrow(); - let num_crate_types = crate_types.len(); - let is_proc_macro_crate = crate_types.contains(&config::CrateType::ProcMacro); - let is_test_crate = sess.opts.test; - syntax_ext::proc_macro_decls::modify( - &sess.parse_sess, - &mut resolver, - krate, - is_proc_macro_crate, - has_proc_macro_decls, - is_test_crate, - num_crate_types, - sess.diagnostic(), - ) - }); - } - - if has_global_allocator { - // Expand global allocators, which are treated as an in-tree proc macro - time(sess, "creating allocators", || { - allocator::expand::modify( - &sess.parse_sess, - &mut resolver, - &mut krate, - crate_name.to_string(), - sess.diagnostic(), - ) - }); - } - - // Done with macro expansion! - - after_expand(&krate)?; - - if sess.opts.debugging_opts.input_stats { - println!("Post-expansion node count: {}", count_nodes(&krate)); - } - - if sess.opts.debugging_opts.hir_stats { - hir_stats::print_ast_stats(&krate, "POST EXPANSION AST STATS"); - } - - if sess.opts.debugging_opts.ast_json { - println!("{}", json::as_json(&krate)); - } - - time(sess, "name resolution", || { - resolver.resolve_crate(&krate); - }); - - // Needs to go *after* expansion to be able to check the results of macro expansion. - time(sess, "complete gated feature checking", || { - syntax::feature_gate::check_crate( - &krate, - &sess.parse_sess, - &sess.features_untracked(), - &attributes, - sess.opts.unstable_features, - ); - }); - - // Add all buffered lints from the `ParseSess` to the `Session`. - sess.parse_sess.buffered_lints.with_lock(|buffered_lints| { - info!("{} parse sess buffered_lints", buffered_lints.len()); - for BufferedEarlyLint{id, span, msg, lint_id} in buffered_lints.drain(..) { - let lint = lint::Lint::from_parser_lint_id(lint_id); - sess.buffer_lint(lint, id, span, &msg); - } - }); - - // Lower ast -> hir. - // First, we need to collect the dep_graph. - let dep_graph = match future_dep_graph { - None => DepGraph::new_disabled(), - Some(future) => { - let (prev_graph, prev_work_products) = - time(sess, "blocked while dep-graph loading finishes", || { - future - .open() - .unwrap_or_else(|e| rustc_incremental::LoadResult::Error { - message: format!("could not decode incremental cache: {:?}", e), - }) - .open(sess) - }); - DepGraph::new(prev_graph, prev_work_products) - } - }; - let hir_forest = time(sess, "lowering ast -> hir", || { - let hir_crate = lower_crate(sess, cstore, &dep_graph, &krate, &mut resolver); - - if sess.opts.debugging_opts.hir_stats { - hir_stats::print_hir_stats(&hir_crate); - } - - hir_map::Forest::new(hir_crate, &dep_graph) - }); - - time(sess, "early lint checks", || { - lint::check_ast_crate(sess, &krate, false, rustc_lint::BuiltinCombinedEarlyLintPass::new()) - }); - - // Discard hygiene data, which isn't required after lowering to HIR. - if !sess.opts.debugging_opts.keep_hygiene_data { - syntax::ext::hygiene::clear_markings(); - } - - Ok(InnerExpansionResult { - expanded_crate: krate, - resolver, - hir_forest, - }) -} - -pub fn default_provide(providers: &mut ty::query::Providers) { - rustc_interface::passes::provide(providers); - plugin::build::provide(providers); - hir::provide(providers); - borrowck::provide(providers); - mir::provide(providers); - reachable::provide(providers); - resolve_lifetime::provide(providers); - rustc_privacy::provide(providers); - typeck::provide(providers); - ty::provide(providers); - traits::provide(providers); - stability::provide(providers); - middle::intrinsicck::provide(providers); - middle::liveness::provide(providers); - reachable::provide(providers); - rustc_passes::provide(providers); - rustc_traits::provide(providers); - middle::region::provide(providers); - middle::entry::provide(providers); - cstore::provide(providers); - lint::provide(providers); -} - -pub fn default_provide_extern(providers: &mut ty::query::Providers) { - cstore::provide_extern(providers); -} - -/// Runs the resolution, type-checking, region checking and other -/// miscellaneous analysis passes on the crate. Return various -/// structures carrying the results of the analysis. -pub fn phase_3_run_analysis_passes<'tcx, F, R>( - codegen_backend: &dyn CodegenBackend, - control: &CompileController, - sess: &'tcx Session, - cstore: &'tcx CStore, - hir_map: hir_map::Map<'tcx>, - resolutions: Resolutions, - arenas: &'tcx mut AllArenas<'tcx>, - name: &str, - output_filenames: &OutputFilenames, - f: F, -) -> R -where - F: for<'a> FnOnce( - TyCtxt<'a, 'tcx, 'tcx>, - mpsc::Receiver>, - CompileResult, - ) -> R, -{ - let query_result_on_disk_cache = time(sess, "load query result cache", || { - rustc_incremental::load_query_result_cache(sess) - }); - - let mut local_providers = ty::query::Providers::default(); - default_provide(&mut local_providers); - codegen_backend.provide(&mut local_providers); - (control.provide)(&mut local_providers); - - let mut extern_providers = local_providers; - default_provide_extern(&mut extern_providers); - codegen_backend.provide_extern(&mut extern_providers); - (control.provide_extern)(&mut extern_providers); - - let (tx, rx) = mpsc::channel(); - - TyCtxt::create_and_enter( - sess, - cstore, - local_providers, - extern_providers, - arenas, - resolutions, - hir_map, - query_result_on_disk_cache, - name, - tx, - output_filenames, - |tcx| { - // Do some initialization of the DepGraph that can only be done with the - // tcx available. - time(sess, "dep graph tcx init", || rustc_incremental::dep_graph_tcx_init(tcx)); - - tcx.analysis(LOCAL_CRATE).ok(); - - f(tcx, rx, tcx.sess.compile_status()) - }, - ) -} - -/// Runs the codegen backend, after which the AST and analysis can -/// be discarded. -pub fn phase_4_codegen<'a, 'tcx>( - codegen_backend: &dyn CodegenBackend, - tcx: TyCtxt<'a, 'tcx, 'tcx>, - rx: mpsc::Receiver>, -) -> Box { - time(tcx.sess, "resolving dependency formats", || { - ::rustc::middle::dependency_format::calculate(tcx) - }); - - tcx.sess.profiler(|p| p.start_activity(ProfileCategory::Codegen)); - let codegen = time(tcx.sess, "codegen", move || codegen_backend.codegen_crate(tcx, rx)); - tcx.sess.profiler(|p| p.end_activity(ProfileCategory::Codegen)); - if tcx.sess.profile_queries() { - profile::dump(&tcx.sess, "profile_queries".to_string()) - } - - codegen -} diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 656d8e463dbd..2b75a607f168 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -51,45 +51,42 @@ extern crate syntax; extern crate syntax_ext; extern crate syntax_pos; -use driver::CompileController; use pretty::{PpMode, UserIdentifiedItem}; +//use rustc_resolve as resolve; use rustc_save_analysis as save; use rustc_save_analysis::DumpHandler; -use rustc_data_structures::sync::{self, Lrc, Ordering::SeqCst}; -use rustc_data_structures::OnDrop; -use rustc::session::{self, config, Session, build_session, CompileResult, DiagnosticOutput}; -use rustc::session::CompileIncomplete; -use rustc::session::config::{Input, PrintRequest, ErrorOutputType}; +use rustc::session::{config, Session, DiagnosticOutput}; +use rustc::session::config::{Input, PrintRequest, ErrorOutputType, OutputType}; use rustc::session::config::nightly_options; use rustc::session::{early_error, early_warn}; use rustc::lint::Lint; use rustc::lint; +use rustc::hir::def_id::LOCAL_CRATE; +use rustc::util::common::{time, ErrorReported, install_panic_hook}; use rustc_metadata::locator; use rustc_metadata::cstore::CStore; -use rustc::util::common::{time, ErrorReported}; use rustc_codegen_utils::codegen_backend::CodegenBackend; -use rustc_interface::util::{self, get_codegen_sysroot}; +use rustc_interface::interface; +use rustc_interface::util::get_codegen_sysroot; +use rustc_data_structures::sync::SeqCst; use serialize::json::ToJson; -use std::any::Any; use std::borrow::Cow; use std::cmp::max; use std::default::Default; use std::env; -use std::error::Error; use std::ffi::OsString; -use std::fmt::{self, Display}; use std::io::{self, Read, Write}; -use std::panic; +use std::panic::{self, catch_unwind}; use std::path::PathBuf; use std::process::{self, Command, Stdio}; use std::str; -use std::thread; +use std::mem; use syntax::ast; -use syntax::source_map::{SourceMap, FileLoader, RealFileLoader}; +use syntax::source_map::FileLoader; use syntax::feature_gate::{GatedCfg, UnstableFeatures}; use syntax::parse::{self, PResult}; use syntax_pos::{DUMMY_SP, MultiSpan, FileName}; @@ -97,14 +94,13 @@ use syntax_pos::{DUMMY_SP, MultiSpan, FileName}; #[cfg(test)] mod test; -pub mod driver; pub mod pretty; /// Exit status code used for successful compilation and help output. -pub const EXIT_SUCCESS: isize = 0; +pub const EXIT_SUCCESS: i32 = 0; /// Exit status code used for compilation failures and invalid flags. -pub const EXIT_FAILURE: isize = 1; +pub const EXIT_FAILURE: i32 = 1; const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.\ md#bug-reports"; @@ -115,172 +111,290 @@ const ICE_REPORT_COMPILER_FLAGS_EXCLUDE: &[&str] = &["metadata", "extra-filename const ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE: &[&str] = &["incremental"]; -pub fn abort_on_err(result: Result, sess: &Session) -> T { +pub fn source_name(input: &Input) -> FileName { + match *input { + Input::File(ref ifile) => ifile.clone().into(), + Input::Str { ref name, .. } => name.clone(), + } +} + +pub fn abort_on_err(result: Result, sess: &Session) -> T { match result { - Err(CompileIncomplete::Errored(ErrorReported)) => { + Err(..) => { sess.abort_if_errors(); panic!("error reported but abort_if_errors didn't abort???"); } - Err(CompileIncomplete::Stopped) => { - sess.fatal("compilation terminated"); - } Ok(x) => x, } } -pub fn run(run_compiler: F) -> isize - where F: FnOnce() -> (CompileResult, Option) + Send + 'static -{ - let result = monitor(move || { - syntax::with_globals(|| { - let (result, session) = run_compiler(); - if let Err(CompileIncomplete::Errored(_)) = result { - match session { - Some(sess) => { - sess.abort_if_errors(); - panic!("error reported but abort_if_errors didn't abort???"); - } - None => { - let emitter = - errors::emitter::EmitterWriter::stderr( - errors::ColorConfig::Auto, - None, - true, - false - ); - let handler = errors::Handler::with_emitter(true, None, Box::new(emitter)); - handler.emit(&MultiSpan::new(), - "aborting due to previous error(s)", - errors::Level::Fatal); - panic::resume_unwind(Box::new(errors::FatalErrorMarker)); - } - } - } - }); - }); - - match result { - Ok(()) => EXIT_SUCCESS, - Err(_) => EXIT_FAILURE, +pub trait Callbacks { + /// Called before creating the compiler instance + fn config(&mut self, _config: &mut interface::Config) {} + /// Called after parsing and returns true to continue execution + fn after_parsing(&mut self, _compiler: &interface::Compiler) -> bool { + true + } + /// Called after analysis and returns true to continue execution + fn after_analysis(&mut self, _compiler: &interface::Compiler) -> bool { + true } } +pub struct DefaultCallbacks; + +impl Callbacks for DefaultCallbacks {} + // Parse args and run the compiler. This is the primary entry point for rustc. // See comments on CompilerCalls below for details about the callbacks argument. // The FileLoader provides a way to load files from sources other than the file system. -pub fn run_compiler<'a>(args: &[String], - callbacks: Box + sync::Send + 'a>, - file_loader: Option>, - emitter_dest: Option>) - -> (CompileResult, Option) -{ +pub fn run_compiler( + args: &[String], + callbacks: &mut (dyn Callbacks + Send), + file_loader: Option>, + emitter: Option> +) -> interface::Result<()> { + let diagnostic_output = emitter.map(|emitter| DiagnosticOutput::Raw(emitter)) + .unwrap_or(DiagnosticOutput::Default); let matches = match handle_options(args) { Some(matches) => matches, - None => return (Ok(()), None), + None => return Ok(()), }; + install_panic_hook(); + let (sopts, cfg) = config::build_session_options_and_crate_config(&matches); - driver::spawn_thread_pool(sopts, |sopts| { - run_compiler_with_pool(matches, sopts, cfg, callbacks, file_loader, emitter_dest) - }) -} + let mut dummy_config = |sopts, cfg, diagnostic_output| { + let mut config = interface::Config { + opts: sopts, + crate_cfg: cfg, + input: Input::File(PathBuf::new()), + input_path: None, + output_file: None, + output_dir: None, + file_loader: None, + diagnostic_output, + stderr: None, + crate_name: None, + lint_caps: Default::default(), + }; + callbacks.config(&mut config); + config + }; -fn run_compiler_with_pool<'a>( - matches: getopts::Matches, - sopts: config::Options, - cfg: ast::CrateConfig, - mut callbacks: Box + sync::Send + 'a>, - file_loader: Option>, - emitter_dest: Option> -) -> (CompileResult, Option) { - macro_rules! do_or_return {($expr: expr, $sess: expr) => { - match $expr { - Compilation::Stop => return (Ok(()), $sess), - Compilation::Continue => {} - } - }} - - let descriptions = diagnostics_registry(); - - do_or_return!(callbacks.early_callback(&matches, - &sopts, - &cfg, - &descriptions, - sopts.error_format), - None); + if let Some(ref code) = matches.opt_str("explain") { + handle_explain(code, sopts.error_format); + return Ok(()); + } let (odir, ofile) = make_output(&matches); let (input, input_file_path, input_err) = match make_input(&matches.free) { - Some((input, input_file_path, input_err)) => { - let (input, input_file_path) = callbacks.some_input(input, input_file_path); - (input, input_file_path, input_err) - }, - None => match callbacks.no_input(&matches, &sopts, &cfg, &odir, &ofile, &descriptions) { - Some((input, input_file_path)) => (input, input_file_path, None), - None => return (Ok(()), None), - }, - }; + Some(v) => v, + None => { + match matches.free.len() { + 0 => { + let config = dummy_config(sopts, cfg, diagnostic_output); + interface::run_compiler(config, |compiler| { + let sopts = &compiler.session().opts; + if sopts.describe_lints { + describe_lints( + compiler.session(), + &*compiler.session().lint_store.borrow(), + false + ); + return; + } + let should_stop = RustcDefaultCalls::print_crate_info( + &***compiler.codegen_backend(), + compiler.session(), + None, + &odir, + &ofile + ); - let loader = file_loader.unwrap_or(box RealFileLoader); - let source_map = Lrc::new(SourceMap::with_file_loader(loader, sopts.file_path_mapping())); - let mut sess = session::build_session_with_source_map( - sopts, - input_file_path.clone(), - descriptions, - source_map, - emitter_dest.map(|e| DiagnosticOutput::Raw(e)).unwrap_or(DiagnosticOutput::Default), - Default::default(), - ); + if should_stop == Compilation::Stop { + return; + } + early_error(sopts.error_format, "no input filename given") + }); + return Ok(()); + } + 1 => panic!("make_input should have provided valid inputs"), + _ => early_error(sopts.error_format, &format!( + "multiple input filenames provided (first two filenames are `{}` and `{}`)", + matches.free[0], + matches.free[1], + )), + } + } + }; if let Some(err) = input_err { // Immediately stop compilation if there was an issue reading // the input (for example if the input stream is not UTF-8). - sess.err(&err.to_string()); - return (Err(CompileIncomplete::Stopped), Some(sess)); + interface::run_compiler(dummy_config(sopts, cfg, diagnostic_output), |compiler| { + compiler.session().err(&err.to_string()); + }); + return Err(ErrorReported); } - let codegen_backend = util::get_codegen_backend(&sess); - - rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); - - let mut cfg = config::build_configuration(&sess, cfg); - util::add_configuration(&mut cfg, &sess, &*codegen_backend); - sess.parse_sess.config = cfg; - - let result = { - let plugins = sess.opts.debugging_opts.extra_plugins.clone(); - - let cstore = CStore::new(codegen_backend.metadata_loader()); - - do_or_return!(callbacks.late_callback(&*codegen_backend, - &matches, - &sess, - &cstore, - &input, - &odir, - &ofile), Some(sess)); - - let _sess_abort_error = OnDrop(|| sess.diagnostic().print_error_count()); - - let control = callbacks.build_controller(&sess, &matches); - - driver::compile_input(codegen_backend, - &sess, - &cstore, - &input_file_path, - &input, - &odir, - &ofile, - Some(plugins), - &control) + let mut config = interface::Config { + opts: sopts, + crate_cfg: cfg, + input, + input_path: input_file_path, + output_file: ofile, + output_dir: odir, + file_loader, + diagnostic_output, + stderr: None, + crate_name: None, + lint_caps: Default::default(), }; - if sess.opts.debugging_opts.self_profile { - sess.profiler(|p| p.dump_raw_events(&sess.opts)); - } + callbacks.config(&mut config); - (result, Some(sess)) + interface::run_compiler(config, |compiler| { + let sess = compiler.session(); + let should_stop = RustcDefaultCalls::print_crate_info( + &***compiler.codegen_backend(), + sess, + Some(compiler.input()), + compiler.output_dir(), + compiler.output_file(), + ).and_then(|| RustcDefaultCalls::list_metadata( + sess, + compiler.cstore(), + &matches, + compiler.input() + )); + + if should_stop == Compilation::Stop { + return sess.compile_status(); + } + + let pretty_info = parse_pretty(sess, &matches); + + compiler.parse()?; + + if let Some((ppm, opt_uii)) = pretty_info { + if ppm.needs_ast_map(&opt_uii) { + pretty::visit_crate(sess, &mut compiler.parse()?.peek_mut(), ppm); + compiler.global_ctxt()?.peek_mut().enter(|tcx| { + let expanded_crate = compiler.expansion()?.take().0; + pretty::print_after_hir_lowering( + tcx, + compiler.input(), + &expanded_crate, + ppm, + opt_uii.clone(), + compiler.output_file().as_ref().map(|p| &**p), + ); + Ok(()) + })?; + return sess.compile_status(); + } else { + let mut krate = compiler.parse()?.take(); + pretty::visit_crate(sess, &mut krate, ppm); + pretty::print_after_parsing( + sess, + &compiler.input(), + &krate, + ppm, + compiler.output_file().as_ref().map(|p| &**p), + ); + return sess.compile_status(); + } + } + + if !callbacks.after_parsing(compiler) { + return sess.compile_status(); + } + + if sess.opts.debugging_opts.parse_only || + sess.opts.debugging_opts.show_span.is_some() || + sess.opts.debugging_opts.ast_json_noexpand { + return sess.compile_status(); + } + + compiler.register_plugins()?; + + // Lint plugins are registered; now we can process command line flags. + if sess.opts.describe_lints { + describe_lints(&sess, &sess.lint_store.borrow(), true); + return sess.compile_status(); + } + + compiler.prepare_outputs()?; + + if sess.opts.output_types.contains_key(&OutputType::DepInfo) + && sess.opts.output_types.len() == 1 + { + return sess.compile_status(); + } + + compiler.global_ctxt()?; + + if sess.opts.debugging_opts.no_analysis || + sess.opts.debugging_opts.ast_json { + return sess.compile_status(); + } + + if sess.opts.debugging_opts.save_analysis { + let expanded_crate = compiler.expansion()?.take().0; + + let crate_name = compiler.crate_name()?.peek().clone(); + compiler.global_ctxt()?.peek_mut().enter(|tcx| { + let result = tcx.analysis(LOCAL_CRATE); + + time(sess, "save analysis", || { + // FIXME: Should this run even with analysis errors? + save::process_crate( + tcx, + &expanded_crate, + &crate_name, + &compiler.input(), + None, + DumpHandler::new(compiler.output_dir().as_ref().map(|p| &**p), &crate_name) + ) + }); + + result + })?; + } else { + // Drop AST after creating GlobalCtxt to free memory + mem::drop(compiler.expansion()?.take()); + } + compiler.global_ctxt()?.peek_mut().enter(|tcx| tcx.analysis(LOCAL_CRATE))?; + + if !callbacks.after_analysis(compiler) { + return sess.compile_status(); + } + + compiler.ongoing_codegen()?; + + // Drop GlobalCtxt after starting codegen to free memory + mem::drop(compiler.global_ctxt()?.take()); + + if sess.opts.debugging_opts.print_type_sizes { + sess.code_stats.borrow().print_type_sizes(); + } + + compiler.link()?; + + if sess.opts.debugging_opts.perf_stats { + sess.print_perf_stats(); + } + + if sess.print_fuel_crate.is_some() { + eprintln!("Fuel used by {}: {}", + sess.print_fuel_crate.as_ref().unwrap(), + sess.print_fuel.load(SeqCst)); + } + + Ok(()) + }) } #[cfg(unix)] @@ -363,72 +477,6 @@ impl Compilation { } } -/// A trait for customizing the compilation process. Offers a number of hooks for -/// executing custom code or customizing input. -pub trait CompilerCalls<'a> { - /// Hook for a callback early in the process of handling arguments. This will - /// be called straight after options have been parsed but before anything - /// else (e.g., selecting input and output). - fn early_callback(&mut self, - _: &getopts::Matches, - _: &config::Options, - _: &ast::CrateConfig, - _: &errors::registry::Registry, - _: ErrorOutputType) - -> Compilation { - Compilation::Continue - } - - /// Hook for a callback late in the process of handling arguments. This will - /// be called just before actual compilation starts (and before build_controller - /// is called), after all arguments etc. have been completely handled. - fn late_callback(&mut self, - _: &dyn CodegenBackend, - _: &getopts::Matches, - _: &Session, - _: &CStore, - _: &Input, - _: &Option, - _: &Option) - -> Compilation { - Compilation::Continue - } - - /// Called after we extract the input from the arguments. Gives the implementer - /// an opportunity to change the inputs or to add some custom input handling. - /// The default behaviour is to simply pass through the inputs. - fn some_input(&mut self, - input: Input, - input_path: Option) - -> (Input, Option) { - (input, input_path) - } - - /// Called after we extract the input from the arguments if there is no valid - /// input. Gives the implementer an opportunity to supply alternate input (by - /// returning a Some value) or to add custom behaviour for this error such as - /// emitting error messages. Returning None will cause compilation to stop - /// at this point. - fn no_input(&mut self, - _: &getopts::Matches, - _: &config::Options, - _: &ast::CrateConfig, - _: &Option, - _: &Option, - _: &errors::registry::Registry) - -> Option<(Input, Option)> { - None - } - - // Create a CompilController struct for controlling the behaviour of - // compilation. - fn build_controller( - self: Box, - _: &Session, - _: &getopts::Matches - ) -> CompileController<'a>; -} - /// CompilerCalls instance for a regular rustc build. #[derive(Copy, Clone)] pub struct RustcDefaultCalls; @@ -532,178 +580,6 @@ fn show_content_with_pager(content: &String) { } } -impl<'a> CompilerCalls<'a> for RustcDefaultCalls { - fn early_callback(&mut self, - matches: &getopts::Matches, - _: &config::Options, - _: &ast::CrateConfig, - _: &errors::registry::Registry, - output: ErrorOutputType) - -> Compilation { - if let Some(ref code) = matches.opt_str("explain") { - handle_explain(code, output); - return Compilation::Stop; - } - - Compilation::Continue - } - - fn no_input(&mut self, - matches: &getopts::Matches, - sopts: &config::Options, - cfg: &ast::CrateConfig, - odir: &Option, - ofile: &Option, - descriptions: &errors::registry::Registry) - -> Option<(Input, Option)> { - match matches.free.len() { - 0 => { - let mut sess = build_session(sopts.clone(), - None, - descriptions.clone()); - if sopts.describe_lints { - let mut ls = lint::LintStore::new(); - rustc_lint::register_builtins(&mut ls, Some(&sess)); - describe_lints(&sess, &ls, false); - return None; - } - rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); - let mut cfg = config::build_configuration(&sess, cfg.clone()); - let codegen_backend = util::get_codegen_backend(&sess); - util::add_configuration(&mut cfg, &sess, &*codegen_backend); - sess.parse_sess.config = cfg; - let should_stop = RustcDefaultCalls::print_crate_info( - &*codegen_backend, - &sess, - None, - odir, - ofile - ); - - if should_stop == Compilation::Stop { - return None; - } - early_error(sopts.error_format, "no input filename given"); - } - 1 => panic!("make_input should have provided valid inputs"), - _ => - early_error( - sopts.error_format, - &format!( - "multiple input filenames provided (first two filenames are `{}` and `{}`)", - matches.free[0], - matches.free[1], - ), - ) - } - } - - fn late_callback(&mut self, - codegen_backend: &dyn CodegenBackend, - matches: &getopts::Matches, - sess: &Session, - cstore: &CStore, - input: &Input, - odir: &Option, - ofile: &Option) - -> Compilation { - RustcDefaultCalls::print_crate_info(codegen_backend, sess, Some(input), odir, ofile) - .and_then(|| RustcDefaultCalls::list_metadata(sess, cstore, matches, input)) - } - - fn build_controller(self: Box, - sess: &Session, - matches: &getopts::Matches) - -> CompileController<'a> { - let mut control = CompileController::basic(); - - control.keep_ast = sess.opts.debugging_opts.keep_ast; - control.continue_parse_after_error = sess.opts.debugging_opts.continue_parse_after_error; - - if let Some((ppm, opt_uii)) = parse_pretty(sess, matches) { - if ppm.needs_ast_map(&opt_uii) { - control.after_hir_lowering.stop = Compilation::Stop; - - control.after_parse.callback = box move |state| { - let mut krate = state.krate.take().unwrap(); - pretty::visit_crate(state.session, &mut krate, ppm); - state.krate = Some(krate); - }; - control.after_hir_lowering.callback = box move |state| { - pretty::print_after_hir_lowering(state.session, - state.cstore.unwrap(), - state.hir_map.unwrap(), - state.resolutions.unwrap(), - state.input, - &state.expanded_crate.take().unwrap(), - state.crate_name.unwrap(), - ppm, - state.output_filenames.unwrap(), - opt_uii.clone(), - state.out_file); - }; - } else { - control.after_parse.stop = Compilation::Stop; - - control.after_parse.callback = box move |state| { - let mut krate = state.krate.take().unwrap(); - pretty::visit_crate(state.session, &mut krate, ppm); - pretty::print_after_parsing(state.session, - state.input, - &krate, - ppm, - state.out_file); - }; - } - - return control; - } - - if sess.opts.debugging_opts.parse_only || - sess.opts.debugging_opts.show_span.is_some() || - sess.opts.debugging_opts.ast_json_noexpand { - control.after_parse.stop = Compilation::Stop; - } - - if sess.opts.debugging_opts.no_analysis || - sess.opts.debugging_opts.ast_json { - control.after_hir_lowering.stop = Compilation::Stop; - } - - if sess.opts.debugging_opts.save_analysis { - enable_save_analysis(&mut control); - } - - if sess.print_fuel_crate.is_some() { - let old_callback = control.compilation_done.callback; - control.compilation_done.callback = box move |state| { - old_callback(state); - let sess = state.session; - eprintln!("Fuel used by {}: {}", - sess.print_fuel_crate.as_ref().unwrap(), - sess.print_fuel.load(SeqCst)); - } - } - control - } -} - -pub fn enable_save_analysis(control: &mut CompileController) { - control.keep_ast = true; - control.after_analysis.callback = box |state| { - time(state.session, "save analysis", || { - save::process_crate(state.tcx.unwrap(), - state.expanded_crate.unwrap(), - state.crate_name.unwrap(), - state.input, - None, - DumpHandler::new(state.out_dir, - state.crate_name.unwrap())) - }); - }; - control.after_analysis.run_callback_on_error = true; -} - impl RustcDefaultCalls { pub fn list_metadata(sess: &Session, cstore: &CStore, @@ -1199,49 +1075,6 @@ fn parse_crate_attrs<'a>(sess: &'a Session, input: &Input) -> PResult<'a, Vec(name: String, f: F) -> Result> - where F: FnOnce() -> R + Send + 'static, - R: Send + 'static, -{ - // We need a thread for soundness of thread local storage in rustc. For debugging purposes - // we allow an escape hatch where everything runs on the main thread. - if env::var_os("RUSTC_UNSTABLE_NO_MAIN_THREAD").is_none() { - let mut cfg = thread::Builder::new().name(name); - - // If the env is trying to override the stack size then *don't* set it explicitly. - // The libstd thread impl will fetch the `RUST_MIN_STACK` env var itself. - if env::var_os("RUST_MIN_STACK").is_none() { - cfg = cfg.stack_size(STACK_SIZE); - } - - let thread = cfg.spawn(f); - thread.unwrap().join() - } else { - let f = panic::AssertUnwindSafe(f); - panic::catch_unwind(f) - } -} - -/// Runs `f` in a suitable thread for running `rustc`; returns a -/// `Result` with either the return value of `f` or -- if a panic -/// occurs -- the panic value. -pub fn in_rustc_thread(f: F) -> Result> - where F: FnOnce() -> R + Send + 'static, - R: Send + 'static, -{ - in_named_rustc_thread("rustc".to_string(), f) -} - /// Gets a list of extra command-line flags provided by the user, as strings. /// /// This function is used during ICEs to show more information useful for @@ -1296,28 +1129,15 @@ fn extra_compiler_flags() -> Option<(Vec, bool)> { } } -#[derive(Debug)] -pub struct CompilationFailure; - -impl Error for CompilationFailure {} - -impl Display for CompilationFailure { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "compilation had errors") - } -} - /// Runs a procedure which will detect panics in the compiler and print nicer /// error messages rather than just failing the test. /// /// The diagnostic emitter yielded to the procedure should be used for reporting /// errors of the compiler. -pub fn monitor(f: F) -> Result<(), CompilationFailure> { - in_rustc_thread(move || { - f() - }).map_err(|value| { +pub fn report_ices_to_stderr_if_any R, R>(f: F) -> Result { + catch_unwind(panic::AssertUnwindSafe(f)).map_err(|value| { if value.is::() { - CompilationFailure + ErrorReported } else { // Thread panicked without emitting a fatal diagnostic eprintln!(""); @@ -1364,25 +1184,6 @@ pub fn monitor(f: F) -> Result<(), CompilationFail }) } -pub fn diagnostics_registry() -> errors::registry::Registry { - use errors::registry::Registry; - - let mut all_errors = Vec::new(); - all_errors.extend_from_slice(&rustc::DIAGNOSTICS); - all_errors.extend_from_slice(&rustc_typeck::DIAGNOSTICS); - all_errors.extend_from_slice(&rustc_resolve::DIAGNOSTICS); - all_errors.extend_from_slice(&rustc_privacy::DIAGNOSTICS); - // FIXME: need to figure out a way to get these back in here - // all_errors.extend_from_slice(get_codegen_backend(sess).diagnostics()); - all_errors.extend_from_slice(&rustc_metadata::DIAGNOSTICS); - all_errors.extend_from_slice(&rustc_passes::DIAGNOSTICS); - all_errors.extend_from_slice(&rustc_plugin::DIAGNOSTICS); - all_errors.extend_from_slice(&rustc_mir::DIAGNOSTICS); - all_errors.extend_from_slice(&syntax::DIAGNOSTICS); - - Registry::new(&all_errors) -} - /// This allows tools to enable rust logging without having to magically match rustc's /// log crate version pub fn init_rustc_env_logger() { @@ -1391,17 +1192,17 @@ pub fn init_rustc_env_logger() { pub fn main() { init_rustc_env_logger(); - let result = run(|| { + let result = report_ices_to_stderr_if_any(|| { let args = env::args_os().enumerate() .map(|(i, arg)| arg.into_string().unwrap_or_else(|arg| { early_error(ErrorOutputType::default(), &format!("Argument {} is not valid Unicode: {:?}", i, arg)) })) .collect::>(); - run_compiler(&args, - Box::new(RustcDefaultCalls), - None, - None) + run_compiler(&args, &mut DefaultCallbacks, None, None) + }).and_then(|result| result); + process::exit(match result { + Ok(_) => EXIT_SUCCESS, + Err(_) => EXIT_FAILURE, }); - process::exit(result as i32); } diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 1750aa62dd5e..3182b2ce30c6 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -6,13 +6,14 @@ use rustc::hir; use rustc::hir::map as hir_map; use rustc::hir::map::blocks; use rustc::hir::print as pprust_hir; +use rustc::hir::def_id::LOCAL_CRATE; use rustc::session::Session; -use rustc::session::config::{Input, OutputFilenames}; -use rustc::ty::{self, TyCtxt, Resolutions, AllArenas}; -use rustc_interface::util; +use rustc::session::config::Input; +use rustc::ty::{self, TyCtxt}; +use rustc::util::common::ErrorReported; +use rustc_interface::util::ReplaceBodyWithLoop; use rustc_borrowck as borrowck; use rustc_borrowck::graphviz as borrowck_dot; -use rustc_metadata::cstore::CStore; use rustc_mir::util::{write_mir_pretty, write_mir_graphviz}; use syntax::ast; @@ -35,7 +36,8 @@ pub use self::PpSourceMode::*; pub use self::PpMode::*; use self::NodesMatchingUII::*; use abort_on_err; -use driver; + +use source_name; #[derive(Copy, Clone, PartialEq, Debug)] pub enum PpSourceMode { @@ -154,7 +156,7 @@ impl PpSourceMode { /// Constructs a `PrinterSupport` object and passes it to `f`. fn call_with_pp_support<'tcx, A, F>(&self, sess: &'tcx Session, - hir_map: Option<&hir_map::Map<'tcx>>, + tcx: Option>, f: F) -> A where F: FnOnce(&dyn PrinterSupport) -> A @@ -163,7 +165,7 @@ impl PpSourceMode { PpmNormal | PpmEveryBodyLoops | PpmExpanded => { let annotation = NoAnn { sess, - hir_map: hir_map.map(|m| m.clone()), + tcx, }; f(&annotation) } @@ -171,7 +173,7 @@ impl PpSourceMode { PpmIdentified | PpmExpandedIdentified => { let annotation = IdentifiedAnnotation { sess, - hir_map: hir_map.map(|m| m.clone()), + tcx, }; f(&annotation) } @@ -186,12 +188,7 @@ impl PpSourceMode { } fn call_with_pp_support_hir<'tcx, A, F>( &self, - sess: &'tcx Session, - cstore: &'tcx CStore, - hir_map: &hir_map::Map<'tcx>, - resolutions: &Resolutions, - output_filenames: &OutputFilenames, - id: &str, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, f: F ) -> A where F: FnOnce(&dyn HirPrinterSupport, &hir::Crate) -> A @@ -199,42 +196,29 @@ impl PpSourceMode { match *self { PpmNormal => { let annotation = NoAnn { - sess, - hir_map: Some(hir_map.clone()), + sess: tcx.sess, + tcx: Some(tcx), }; - f(&annotation, hir_map.forest.krate()) + f(&annotation, tcx.hir().forest.krate()) } PpmIdentified => { let annotation = IdentifiedAnnotation { - sess, - hir_map: Some(hir_map.clone()), + sess: tcx.sess, + tcx: Some(tcx), }; - f(&annotation, hir_map.forest.krate()) + f(&annotation, tcx.hir().forest.krate()) } PpmTyped => { - let control = &driver::CompileController::basic(); - let codegen_backend = util::get_codegen_backend(sess); - let mut arenas = AllArenas::new(); - driver::phase_3_run_analysis_passes(&*codegen_backend, - control, - sess, - cstore, - hir_map.clone(), - resolutions.clone(), - &mut arenas, - id, - output_filenames, - |tcx, _, result| { - abort_on_err(result, tcx.sess); - let empty_tables = ty::TypeckTables::empty(None); - let annotation = TypedAnnotation { - tcx, - tables: Cell::new(&empty_tables) - }; - tcx.dep_graph.with_ignore(|| { - f(&annotation, hir_map.forest.krate()) - }) + abort_on_err(tcx.analysis(LOCAL_CRATE), tcx.sess); + + let empty_tables = ty::TypeckTables::empty(None); + let annotation = TypedAnnotation { + tcx, + tables: Cell::new(&empty_tables) + }; + tcx.dep_graph.with_ignore(|| { + f(&annotation, tcx.hir().forest.krate()) }) } _ => panic!("Should use call_with_pp_support"), @@ -283,7 +267,7 @@ trait HirPrinterSupport<'hir>: pprust_hir::PpAnn { struct NoAnn<'hir> { sess: &'hir Session, - hir_map: Option>, + tcx: Option>, } impl<'hir> PrinterSupport for NoAnn<'hir> { @@ -302,7 +286,7 @@ impl<'hir> HirPrinterSupport<'hir> for NoAnn<'hir> { } fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>> { - self.hir_map.as_ref() + self.tcx.map(|tcx| tcx.hir()) } fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn { @@ -314,8 +298,8 @@ impl<'hir> pprust::PpAnn for NoAnn<'hir> {} impl<'hir> pprust_hir::PpAnn for NoAnn<'hir> { fn nested(&self, state: &mut pprust_hir::State, nested: pprust_hir::Nested) -> io::Result<()> { - if let Some(ref map) = self.hir_map { - pprust_hir::PpAnn::nested(map, state, nested) + if let Some(tcx) = self.tcx { + pprust_hir::PpAnn::nested(tcx.hir(), state, nested) } else { Ok(()) } @@ -324,7 +308,7 @@ impl<'hir> pprust_hir::PpAnn for NoAnn<'hir> { struct IdentifiedAnnotation<'hir> { sess: &'hir Session, - hir_map: Option>, + tcx: Option>, } impl<'hir> PrinterSupport for IdentifiedAnnotation<'hir> { @@ -380,7 +364,7 @@ impl<'hir> HirPrinterSupport<'hir> for IdentifiedAnnotation<'hir> { } fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'hir>> { - self.hir_map.as_ref() + self.tcx.map(|tcx| tcx.hir()) } fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn { @@ -391,8 +375,8 @@ impl<'hir> HirPrinterSupport<'hir> for IdentifiedAnnotation<'hir> { impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> { fn nested(&self, state: &mut pprust_hir::State, nested: pprust_hir::Nested) -> io::Result<()> { - if let Some(ref map) = self.hir_map { - pprust_hir::PpAnn::nested(map, state, nested) + if let Some(ref tcx) = self.tcx { + pprust_hir::PpAnn::nested(tcx.hir(), state, nested) } else { Ok(()) } @@ -691,12 +675,12 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec, pub fn visit_crate(sess: &Session, krate: &mut ast::Crate, ppm: PpMode) { if let PpmSource(PpmEveryBodyLoops) = ppm { - util::ReplaceBodyWithLoop::new(sess).visit_crate(krate); + ReplaceBodyWithLoop::new(sess).visit_crate(krate); } } fn get_source(input: &Input, sess: &Session) -> (Vec, FileName) { - let src_name = input.source_name(); + let src_name = source_name(input); let src = sess.source_map() .get_source_file(&src_name) .unwrap() @@ -752,31 +736,24 @@ pub fn print_after_parsing(sess: &Session, write_output(out, ofile); } -pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, - cstore: &'tcx CStore, - hir_map: &hir_map::Map<'tcx>, - resolutions: &Resolutions, - input: &Input, - krate: &ast::Crate, - crate_name: &str, - ppm: PpMode, - output_filenames: &OutputFilenames, - opt_uii: Option, - ofile: Option<&Path>) { +pub fn print_after_hir_lowering<'tcx>( + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + input: &Input, + krate: &ast::Crate, + ppm: PpMode, + opt_uii: Option, + ofile: Option<&Path>) { if ppm.needs_analysis() { - print_with_analysis(sess, - cstore, - hir_map, - resolutions, - crate_name, - output_filenames, - ppm, - opt_uii, - ofile); + abort_on_err(print_with_analysis( + tcx, + ppm, + opt_uii, + ofile + ), tcx.sess); return; } - let (src, src_name) = get_source(input, sess); + let (src, src_name) = get_source(input, tcx.sess); let mut rdr = &src[..]; let mut out = Vec::new(); @@ -785,7 +762,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, (PpmSource(s), _) => { // Silently ignores an identified node. let out: &mut dyn Write = &mut out; - s.call_with_pp_support(sess, Some(hir_map), move |annotation| { + s.call_with_pp_support(tcx.sess, Some(tcx), move |annotation| { debug!("pretty printing source code {:?}", s); let sess = annotation.sess(); pprust::print_crate(sess.source_map(), @@ -801,13 +778,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, (PpmHir(s), None) => { let out: &mut dyn Write = &mut out; - s.call_with_pp_support_hir(sess, - cstore, - hir_map, - resolutions, - output_filenames, - crate_name, - move |annotation, krate| { + s.call_with_pp_support_hir(tcx, move |annotation, krate| { debug!("pretty printing source code {:?}", s); let sess = annotation.sess(); pprust_hir::print_crate(sess.source_map(), @@ -823,13 +794,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, (PpmHirTree(s), None) => { let out: &mut dyn Write = &mut out; - s.call_with_pp_support_hir(sess, - cstore, - hir_map, - resolutions, - output_filenames, - crate_name, - move |_annotation, krate| { + s.call_with_pp_support_hir(tcx, move |_annotation, krate| { debug!("pretty printing source code {:?}", s); write!(out, "{:#?}", krate) }) @@ -837,13 +802,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, (PpmHir(s), Some(uii)) => { let out: &mut dyn Write = &mut out; - s.call_with_pp_support_hir(sess, - cstore, - hir_map, - resolutions, - output_filenames, - crate_name, - move |annotation, _| { + s.call_with_pp_support_hir(tcx, move |annotation, _| { debug!("pretty printing source code {:?}", s); let sess = annotation.sess(); let hir_map = annotation.hir_map().expect("-Z unpretty missing HIR map"); @@ -869,16 +828,10 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, (PpmHirTree(s), Some(uii)) => { let out: &mut dyn Write = &mut out; - s.call_with_pp_support_hir(sess, - cstore, - hir_map, - resolutions, - output_filenames, - crate_name, - move |_annotation, _krate| { + s.call_with_pp_support_hir(tcx, move |_annotation, _krate| { debug!("pretty printing source code {:?}", s); - for node_id in uii.all_matching_node_ids(hir_map) { - let node = hir_map.get(node_id); + for node_id in uii.all_matching_node_ids(tcx.hir()) { + let node = tcx.hir().get(node_id); write!(out, "{:#?}", node)?; } Ok(()) @@ -896,18 +849,15 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, // analysis is performed. However, we want to call `phase_3_run_analysis_passes` // with a different callback than the standard driver, so that isn't easy. // Instead, we call that function ourselves. -fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session, - cstore: &'a CStore, - hir_map: &hir_map::Map<'tcx>, - resolutions: &Resolutions, - crate_name: &str, - output_filenames: &OutputFilenames, - ppm: PpMode, - uii: Option, - ofile: Option<&Path>) { +fn print_with_analysis<'tcx>( + tcx: TyCtxt<'_, 'tcx, 'tcx>, + ppm: PpMode, + uii: Option, + ofile: Option<&Path> +) -> Result<(), ErrorReported> { let nodeid = if let Some(uii) = uii { debug!("pretty printing for {:?}", uii); - Some(uii.to_one_node_id("-Z unpretty", sess, &hir_map)) + Some(uii.to_one_node_id("-Z unpretty", tcx.sess, tcx.hir())) } else { debug!("pretty printing for whole crate"); None @@ -915,66 +865,57 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session, let mut out = Vec::new(); - let control = &driver::CompileController::basic(); - let codegen_backend = util::get_codegen_backend(sess); - let mut arenas = AllArenas::new(); - driver::phase_3_run_analysis_passes(&*codegen_backend, - control, - sess, - cstore, - hir_map.clone(), - resolutions.clone(), - &mut arenas, - crate_name, - output_filenames, - |tcx, _, result| { - abort_on_err(result, tcx.sess); - match ppm { - PpmMir | PpmMirCFG => { - if let Some(nodeid) = nodeid { - let def_id = tcx.hir().local_def_id(nodeid); - match ppm { - PpmMir => write_mir_pretty(tcx, Some(def_id), &mut out), - PpmMirCFG => write_mir_graphviz(tcx, Some(def_id), &mut out), - _ => unreachable!(), - }?; - } else { - match ppm { - PpmMir => write_mir_pretty(tcx, None, &mut out), - PpmMirCFG => write_mir_graphviz(tcx, None, &mut out), - _ => unreachable!(), - }?; - } - Ok(()) + tcx.analysis(LOCAL_CRATE)?; + + let mut print = || match ppm { + PpmMir | PpmMirCFG => { + if let Some(nodeid) = nodeid { + let def_id = tcx.hir().local_def_id(nodeid); + match ppm { + PpmMir => write_mir_pretty(tcx, Some(def_id), &mut out), + PpmMirCFG => write_mir_graphviz(tcx, Some(def_id), &mut out), + _ => unreachable!(), + }?; + } else { + match ppm { + PpmMir => write_mir_pretty(tcx, None, &mut out), + PpmMirCFG => write_mir_graphviz(tcx, None, &mut out), + _ => unreachable!(), + }?; } - PpmFlowGraph(mode) => { - let nodeid = - nodeid.expect("`pretty flowgraph=..` needs NodeId (int) or unique path \ - suffix (b::c::d)"); - let node = tcx.hir().find(nodeid).unwrap_or_else(|| { - tcx.sess.fatal(&format!("--pretty flowgraph couldn't find id: {}", nodeid)) - }); - - match blocks::Code::from_node(&tcx.hir(), nodeid) { - Some(code) => { - let variants = gather_flowgraph_variants(tcx.sess); - - let out: &mut dyn Write = &mut out; - - print_flowgraph(variants, tcx, code, mode, out) - } - None => { - let message = format!("--pretty=flowgraph needs block, fn, or method; \ - got {:?}", - node); - - tcx.sess.span_fatal(tcx.hir().span(nodeid), &message) - } - } - } - _ => unreachable!(), + Ok(()) } - }).unwrap(); + PpmFlowGraph(mode) => { + let nodeid = + nodeid.expect("`pretty flowgraph=..` needs NodeId (int) or unique path \ + suffix (b::c::d)"); + let node = tcx.hir().find(nodeid).unwrap_or_else(|| { + tcx.sess.fatal(&format!("--pretty flowgraph couldn't find id: {}", nodeid)) + }); + + match blocks::Code::from_node(&tcx.hir(), nodeid) { + Some(code) => { + let variants = gather_flowgraph_variants(tcx.sess); + + let out: &mut dyn Write = &mut out; + + print_flowgraph(variants, tcx, code, mode, out) + } + None => { + let message = format!("--pretty=flowgraph needs block, fn, or method; \ + got {:?}", + node); + + tcx.sess.span_fatal(tcx.hir().span(nodeid), &message) + } + } + } + _ => unreachable!(), + }; + + print().unwrap(); write_output(out, ofile); + + Ok(()) } diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index 3d52f1d44ba2..f98939eb40a8 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -1,34 +1,23 @@ //! Standalone tests for the inference module. -use driver; -use errors; use errors::emitter::Emitter; use errors::{DiagnosticBuilder, Level}; use rustc::hir; -use rustc::hir::map as hir_map; use rustc::infer::outlives::env::OutlivesEnvironment; use rustc::infer::{self, InferOk, InferResult, SuppressRegionErrors}; use rustc::middle::region; -use rustc::session::config::{OutputFilenames, OutputTypes}; -use rustc::session::{self, config}; +use rustc::session::{DiagnosticOutput, config}; use rustc::traits::ObligationCause; -use rustc::ty::query::OnDiskCache; use rustc::ty::subst::Subst; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; -use rustc_data_structures::sync::{self, Lrc}; -use rustc_interface::util; -use rustc_lint; -use rustc_metadata::cstore::CStore; +use rustc_data_structures::sync; use rustc_target::spec::abi::Abi; -use syntax; +use rustc_interface::interface; use syntax::ast; use syntax::feature_gate::UnstableFeatures; -use syntax::source_map::{FileName, FilePathMapping, SourceMap}; +use syntax::source_map::FileName; use syntax::symbol::Symbol; -use std::path::PathBuf; -use std::sync::mpsc; - struct Env<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { infcx: &'a infer::InferCtxt<'a, 'gcx, 'tcx>, region_scope_tree: &'a mut region::ScopeTree, @@ -75,102 +64,57 @@ impl Emitter for ExpectErrorEmitter { } } -fn errors(msgs: &[&str]) -> (Box, usize) { - let v = msgs.iter().map(|m| m.to_string()).collect(); +fn errors(msgs: &[&str]) -> (Box, usize) { + let mut v: Vec<_> = msgs.iter().map(|m| m.to_string()).collect(); + if !v.is_empty() { + v.push("aborting due to previous error".to_owned()); + } ( - box ExpectErrorEmitter { messages: v } as Box, + box ExpectErrorEmitter { messages: v } as Box, msgs.len(), ) } -fn test_env(source_string: &str, args: (Box, usize), body: F) -where - F: FnOnce(Env) + sync::Send, -{ - syntax::with_globals(|| { - let mut options = config::Options::default(); - options.debugging_opts.verbose = true; - options.unstable_features = UnstableFeatures::Allow; - - // When we're compiling this library with `--test` it'll run as a binary but - // not actually exercise much functionality. - // As a result most of the logic loading the codegen backend is defunkt - // (it assumes we're a dynamic library in a sysroot) - // so let's just use the metadata only backend which doesn't need to load any libraries. - options.debugging_opts.codegen_backend = Some("metadata_only".to_owned()); - - driver::spawn_thread_pool(options, |options| { - test_env_with_pool(options, source_string, args, body) - }) - }); -} - -fn test_env_with_pool( - options: config::Options, +fn test_env( source_string: &str, - (emitter, expected_err_count): (Box, usize), + (emitter, expected_err_count): (Box, usize), body: F, -) where - F: FnOnce(Env), +) +where + F: FnOnce(Env) + Send, { - let diagnostic_handler = errors::Handler::with_emitter(true, None, emitter); - let sess = session::build_session_( - options, - None, - diagnostic_handler, - Lrc::new(SourceMap::new(FilePathMapping::empty())), - Default::default(), - ); - let cstore = CStore::new(util::get_codegen_backend(&sess).metadata_loader()); - rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); + let mut opts = config::Options::default(); + opts.debugging_opts.verbose = true; + opts.unstable_features = UnstableFeatures::Allow; + + // When we're compiling this library with `--test` it'll run as a binary but + // not actually exercise much functionality. + // As a result most of the logic loading the codegen backend is defunkt + // (it assumes we're a dynamic library in a sysroot) + // so let's just use the metadata only backend which doesn't need to load any libraries. + opts.debugging_opts.codegen_backend = Some("metadata_only".to_owned()); + let input = config::Input::Str { name: FileName::anon_source_code(&source_string), input: source_string.to_string(), }; - let krate = - driver::phase_1_parse_input(&driver::CompileController::basic(), &sess, &input).unwrap(); - let driver::ExpansionResult { - defs, - resolutions, - mut hir_forest, - .. - } = { - driver::phase_2_configure_and_expand( - &sess, - &cstore, - krate, - None, - "test", - None, - |_| Ok(()), - ).expect("phase 2 aborted") + + let config = interface::Config { + opts, + crate_cfg: Default::default(), + input, + input_path: None, + output_file: None, + output_dir: None, + file_loader: None, + diagnostic_output: DiagnosticOutput::Emitter(emitter), + stderr: None, + crate_name: Some("test".to_owned()), + lint_caps: Default::default(), }; - let mut arenas = ty::AllArenas::new(); - let hir_map = hir_map::map_crate(&sess, &cstore, &mut hir_forest, &defs); - - // Run just enough stuff to build a tcx. - let (tx, _rx) = mpsc::channel(); - let outputs = OutputFilenames { - out_directory: PathBuf::new(), - out_filestem: String::new(), - single_output_file: None, - extra: String::new(), - outputs: OutputTypes::new(&[]), - }; - TyCtxt::create_and_enter( - &sess, - &cstore, - ty::query::Providers::default(), - ty::query::Providers::default(), - &mut arenas, - resolutions, - hir_map, - OnDiskCache::new_empty(sess.source_map()), - "test_crate", - tx, - &outputs, - |tcx| { + interface::run_compiler(config, |compiler| { + compiler.global_ctxt().unwrap().peek_mut().enter(|tcx| { tcx.infer_ctxt().enter(|infcx| { let mut region_scope_tree = region::ScopeTree::default(); let param_env = ty::ParamEnv::empty(); @@ -189,8 +133,8 @@ fn test_env_with_pool( ); assert_eq!(tcx.sess.err_count(), expected_err_count); }); - }, - ); + }) + }); } fn d1() -> ty::DebruijnIndex { diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs index 346ddaa48580..fe75bbc36c3b 100644 --- a/src/librustc_incremental/lib.rs +++ b/src/librustc_incremental/lib.rs @@ -21,7 +21,7 @@ mod persist; pub use assert_dep_graph::assert_dep_graph; pub use persist::dep_graph_tcx_init; -pub use persist::load_dep_graph; +pub use persist::{DepGraphFuture, load_dep_graph}; pub use persist::load_query_result_cache; pub use persist::LoadResult; pub use persist::copy_cgu_workproducts_to_incr_comp_cache_dir; diff --git a/src/librustc_incremental/persist/load.rs b/src/librustc_incremental/persist/load.rs index ecf8bc4a8808..429503469295 100644 --- a/src/librustc_incremental/persist/load.rs +++ b/src/librustc_incremental/persist/load.rs @@ -94,10 +94,10 @@ impl MaybeAsync { } } +pub type DepGraphFuture = MaybeAsync>; + /// Launch a thread and load the dependency graph in the background. -pub fn load_dep_graph(sess: &Session) -> - MaybeAsync> -{ +pub fn load_dep_graph(sess: &Session) -> DepGraphFuture { // Since `sess` isn't `Sync`, we perform all accesses to `sess` // before we fire the background thread. diff --git a/src/librustc_incremental/persist/mod.rs b/src/librustc_incremental/persist/mod.rs index 3aad4f5abb88..bf404140f18d 100644 --- a/src/librustc_incremental/persist/mod.rs +++ b/src/librustc_incremental/persist/mod.rs @@ -16,7 +16,7 @@ pub use fs::in_incr_comp_dir; pub use fs::in_incr_comp_dir_sess; pub use fs::prepare_session_directory; pub use load::dep_graph_tcx_init; -pub use load::load_dep_graph; +pub use load::{DepGraphFuture, load_dep_graph}; pub use load::load_query_result_cache; pub use load::LoadResult; pub use save::save_dep_graph; diff --git a/src/librustc_interface/interface.rs b/src/librustc_interface/interface.rs new file mode 100644 index 000000000000..ec6b26afb8c5 --- /dev/null +++ b/src/librustc_interface/interface.rs @@ -0,0 +1,155 @@ +use queries::Queries; +use rustc::lint; +use rustc::session::config::{self, Input}; +use rustc::session::{DiagnosticOutput, Session}; +use rustc::util::common::ErrorReported; +use rustc_codegen_utils::codegen_backend::CodegenBackend; +use rustc_data_structures::OnDrop; +use rustc_data_structures::sync::Lrc; +use rustc_data_structures::fx::{FxHashSet, FxHashMap}; +use rustc_metadata::cstore::CStore; +use std::collections::HashSet; +use std::io::Write; +use std::path::PathBuf; +use std::result; +use std::sync::{Arc, Mutex}; +use syntax; +use syntax::source_map::{FileLoader, SourceMap}; +use util; +use profile; + +pub use passes::BoxedResolver; + +pub type Result = result::Result; + +/// Represents a compiler session. +/// Can be used run `rustc_interface` queries. +/// Created by passing `Config` to `run_compiler`. +pub struct Compiler { + pub(crate) sess: Lrc, + codegen_backend: Lrc>, + source_map: Lrc, + pub(crate) input: Input, + pub(crate) input_path: Option, + pub(crate) output_dir: Option, + pub(crate) output_file: Option, + pub(crate) queries: Queries, + pub(crate) cstore: Lrc, + pub(crate) crate_name: Option, +} + +impl Compiler { + pub fn session(&self) -> &Lrc { + &self.sess + } + pub fn codegen_backend(&self) -> &Lrc> { + &self.codegen_backend + } + pub fn cstore(&self) -> &Lrc { + &self.cstore + } + pub fn source_map(&self) -> &Lrc { + &self.source_map + } + pub fn input(&self) -> &Input { + &self.input + } + pub fn output_dir(&self) -> &Option { + &self.output_dir + } + pub fn output_file(&self) -> &Option { + &self.output_file + } +} + +/// The compiler configuration +pub struct Config { + /// Command line options + pub opts: config::Options, + + /// cfg! configuration in addition to the default ones + pub crate_cfg: FxHashSet<(String, Option)>, + + pub input: Input, + pub input_path: Option, + pub output_dir: Option, + pub output_file: Option, + pub file_loader: Option>, + pub diagnostic_output: DiagnosticOutput, + + /// Set to capture stderr output during compiler execution + pub stderr: Option>>>, + + pub crate_name: Option, + pub lint_caps: FxHashMap, +} + +pub fn run_compiler_in_existing_thread_pool(config: Config, f: F) -> R +where + F: FnOnce(&Compiler) -> R, +{ + let (sess, codegen_backend, source_map) = util::create_session( + config.opts, + config.crate_cfg, + config.diagnostic_output, + config.file_loader, + config.input_path.clone(), + config.lint_caps, + ); + + let cstore = Lrc::new(CStore::new(codegen_backend.metadata_loader())); + + let compiler = Compiler { + sess, + codegen_backend, + source_map, + cstore, + input: config.input, + input_path: config.input_path, + output_dir: config.output_dir, + output_file: config.output_file, + queries: Default::default(), + crate_name: config.crate_name, + }; + + let _sess_abort_error = OnDrop(|| compiler.sess.diagnostic().print_error_count()); + + if compiler.sess.profile_queries() { + profile::begin(&compiler.sess); + } + + let r = f(&compiler); + + if compiler.sess.profile_queries() { + profile::dump(&compiler.sess, "profile_queries".to_string()) + } + + if compiler.sess.opts.debugging_opts.self_profile { + compiler.sess.profiler(|p| p.dump_raw_events(&compiler.sess.opts)); + } + + r +} + +pub fn run_compiler(mut config: Config, f: F) -> R +where + F: FnOnce(&Compiler) -> R + Send, + R: Send, +{ + syntax::with_globals(move || { + let stderr = config.stderr.take(); + util::spawn_thread_pool( + config.opts.debugging_opts.threads, + &stderr, + || run_compiler_in_existing_thread_pool(config, f), + ) + }) +} + +pub fn default_thread_pool(f: F) -> R +where + F: FnOnce() -> R + Send, + R: Send, +{ + util::spawn_thread_pool(None, &None, f) +} diff --git a/src/librustc_interface/lib.rs b/src/librustc_interface/lib.rs index e5c7c35a36d7..6a931c249b5b 100644 --- a/src/librustc_interface/lib.rs +++ b/src/librustc_interface/lib.rs @@ -3,6 +3,7 @@ #![feature(nll)] #![feature(arbitrary_self_types)] #![feature(generator_trait)] +#![feature(generators)] #![cfg_attr(unix, feature(libc))] #![allow(unused_imports)] @@ -37,7 +38,11 @@ extern crate syntax; extern crate syntax_pos; extern crate syntax_ext; -pub mod passes; -pub mod profile; +pub mod interface; +mod passes; +mod queries; pub mod util; -pub mod proc_macro_decls; +mod proc_macro_decls; +mod profile; + +pub use interface::{run_compiler, Config}; diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 8277615b4650..d61ccd5605b6 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -1,3 +1,4 @@ +use interface::{Compiler, Result}; use util; use proc_macro_decls; @@ -8,7 +9,7 @@ use rustc::hir::def_id::{CrateNum, LOCAL_CRATE}; use rustc::lint; use rustc::middle::{self, reachable, resolve_lifetime, stability}; use rustc::middle::privacy::AccessLevels; -use rustc::ty::{self, AllArenas, Resolutions, TyCtxt}; +use rustc::ty::{self, AllArenas, Resolutions, TyCtxt, GlobalCtxt}; use rustc::ty::steal::Steal; use rustc::traits; use rustc::util::common::{time, ErrorReported}; @@ -23,6 +24,7 @@ use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::stable_hasher::StableHasher; use rustc_data_structures::sync::{Lrc, ParallelIterator, par_iter}; use rustc_incremental; +use rustc_incremental::DepGraphFuture; use rustc_metadata::creader::CrateLoader; use rustc_metadata::cstore::{self, CStore}; use rustc_mir as mir; @@ -35,12 +37,13 @@ use rustc_traits; use rustc_typeck as typeck; use syntax::{self, ast, attr, diagnostics, visit}; use syntax::early_buffered_lints::BufferedEarlyLint; -use syntax::ext::base::ExtCtxt; +use syntax::ext::base::{NamedSyntaxExtension, ExtCtxt}; use syntax::mut_visit::MutVisitor; use syntax::parse::{self, PResult}; use syntax::util::node_count::NodeCounter; use syntax::util::lev_distance::find_best_match_for_name; use syntax::symbol::Symbol; +use syntax::feature_gate::AttributeType; use syntax_pos::{FileName, hygiene}; use syntax_ext; @@ -59,8 +62,524 @@ use std::rc::Rc; use std::mem; use std::ops::Generator; -/// Returns all the paths that correspond to generated files. -pub fn generated_output_paths( +pub fn parse<'a>(sess: &'a Session, input: &Input) -> PResult<'a, ast::Crate> { + sess.diagnostic() + .set_continue_after_error(sess.opts.debugging_opts.continue_parse_after_error); + hygiene::set_default_edition(sess.edition()); + + sess.profiler(|p| p.start_activity(ProfileCategory::Parsing)); + let krate = time(sess, "parsing", || match *input { + Input::File(ref file) => parse::parse_crate_from_file(file, &sess.parse_sess), + Input::Str { + ref input, + ref name, + } => parse::parse_crate_from_source_str(name.clone(), input.clone(), &sess.parse_sess), + })?; + sess.profiler(|p| p.end_activity(ProfileCategory::Parsing)); + + sess.diagnostic().set_continue_after_error(true); + + if sess.opts.debugging_opts.ast_json_noexpand { + println!("{}", json::as_json(&krate)); + } + + if sess.opts.debugging_opts.input_stats { + println!( + "Lines of code: {}", + sess.source_map().count_lines() + ); + println!("Pre-expansion node count: {}", count_nodes(&krate)); + } + + if let Some(ref s) = sess.opts.debugging_opts.show_span { + syntax::show_span::run(sess.diagnostic(), s, &krate); + } + + if sess.opts.debugging_opts.hir_stats { + hir_stats::print_ast_stats(&krate, "PRE EXPANSION AST STATS"); + } + + Ok(krate) +} + +fn count_nodes(krate: &ast::Crate) -> usize { + let mut counter = NodeCounter::new(); + visit::walk_crate(&mut counter, krate); + counter.count +} + +declare_box_region_type!( + pub BoxedResolver, + for(), + (&mut Resolver<'_>) -> (Result, ExpansionResult) +); + +/// Runs the "early phases" of the compiler: initial `cfg` processing, +/// loading compiler plugins (including those from `addl_plugins`), +/// syntax expansion, secondary `cfg` expansion, synthesis of a test +/// harness if one is to be provided, injection of a dependency on the +/// standard library and prelude, and name resolution. +/// +/// Returns `None` if we're aborting after handling -W help. +pub fn configure_and_expand( + sess: Lrc, + cstore: Lrc, + krate: ast::Crate, + crate_name: &str, + plugin_info: PluginInfo, +) -> Result<(ast::Crate, BoxedResolver)> { + // Currently, we ignore the name resolution data structures for the purposes of dependency + // tracking. Instead we will run name resolution and include its output in the hash of each + // item, much like we do for macro expansion. In other words, the hash reflects not just + // its contents but the results of name resolution on those contents. Hopefully we'll push + // this back at some point. + let crate_name = crate_name.to_string(); + let (result, resolver) = BoxedResolver::new(static move || { + let sess = &*sess; + let mut crate_loader = CrateLoader::new(sess, &*cstore, &crate_name); + let resolver_arenas = Resolver::arenas(); + let res = configure_and_expand_inner( + sess, + &*cstore, + krate, + &crate_name, + &resolver_arenas, + &mut crate_loader, + plugin_info, + ); + let mut resolver = match res { + Err(v) => { + yield BoxedResolver::initial_yield(Err(v)); + panic!() + } + Ok((krate, resolver)) => { + yield BoxedResolver::initial_yield(Ok(krate)); + resolver + } + }; + box_region_allow_access!(for(), (&mut Resolver<'_>), (&mut resolver)); + ExpansionResult::from_owned_resolver(resolver) + }); + result.map(|k| (k, resolver)) +} + +pub struct ExpansionResult { + pub defs: Steal, + pub resolutions: Steal, +} + +impl ExpansionResult { + fn from_owned_resolver( + resolver: Resolver<'_>, + ) -> Self { + ExpansionResult { + defs: Steal::new(resolver.definitions), + resolutions: Steal::new(Resolutions { + freevars: resolver.freevars, + export_map: resolver.export_map, + trait_map: resolver.trait_map, + glob_map: resolver.glob_map, + maybe_unused_trait_imports: resolver.maybe_unused_trait_imports, + maybe_unused_extern_crates: resolver.maybe_unused_extern_crates, + extern_prelude: resolver.extern_prelude.iter().map(|(ident, entry)| { + (ident.name, entry.introduced_by_item) + }).collect(), + }), + } + } + + pub fn from_resolver_ref( + resolver: &Resolver<'_>, + ) -> Self { + ExpansionResult { + defs: Steal::new(resolver.definitions.clone()), + resolutions: Steal::new(Resolutions { + freevars: resolver.freevars.clone(), + export_map: resolver.export_map.clone(), + trait_map: resolver.trait_map.clone(), + glob_map: resolver.glob_map.clone(), + maybe_unused_trait_imports: resolver.maybe_unused_trait_imports.clone(), + maybe_unused_extern_crates: resolver.maybe_unused_extern_crates.clone(), + extern_prelude: resolver.extern_prelude.iter().map(|(ident, entry)| { + (ident.name, entry.introduced_by_item) + }).collect(), + }), + } + } +} + +impl BoxedResolver { + pub fn to_expansion_result( + mut resolver: Rc>>, + ) -> ExpansionResult { + if let Some(resolver) = Rc::get_mut(&mut resolver) { + mem::replace(resolver, None).unwrap().into_inner().complete() + } else { + let resolver = &*resolver; + resolver.as_ref().unwrap().borrow_mut().access(|resolver| { + ExpansionResult::from_resolver_ref(resolver) + }) + } + } +} + +pub struct PluginInfo { + syntax_exts: Vec, + attributes: Vec<(String, AttributeType)>, +} + +pub fn register_plugins<'a>( + compiler: &Compiler, + sess: &'a Session, + cstore: &'a CStore, + mut krate: ast::Crate, + crate_name: &str, +) -> Result<(ast::Crate, PluginInfo)> { + krate = time(sess, "attributes injection", || { + syntax::attr::inject(krate, &sess.parse_sess, &sess.opts.debugging_opts.crate_attr) + }); + + let (mut krate, features) = syntax::config::features( + krate, + &sess.parse_sess, + sess.edition(), + ); + // these need to be set "early" so that expansion sees `quote` if enabled. + sess.init_features(features); + + let crate_types = util::collect_crate_types(sess, &krate.attrs); + sess.crate_types.set(crate_types); + + let disambiguator = util::compute_crate_disambiguator(sess); + sess.crate_disambiguator.set(disambiguator); + rustc_incremental::prepare_session_directory(sess, &crate_name, disambiguator); + + if sess.opts.incremental.is_some() { + time(sess, "garbage collect incremental cache directory", || { + if let Err(e) = rustc_incremental::garbage_collect_session_directories(sess) { + warn!( + "Error while trying to garbage collect incremental \ + compilation cache directory: {}", + e + ); + } + }); + } + + // If necessary, compute the dependency graph (in the background). + compiler.dep_graph_future().ok(); + + time(sess, "recursion limit", || { + middle::recursion_limit::update_limits(sess, &krate); + }); + + krate = time(sess, "crate injection", || { + let alt_std_name = sess.opts.alt_std_name.as_ref().map(|s| &**s); + syntax::std_inject::maybe_inject_crates_ref(krate, alt_std_name, sess.edition()) + }); + + let registrars = time(sess, "plugin loading", || { + plugin::load::load_plugins( + sess, + &cstore, + &krate, + crate_name, + Some(sess.opts.debugging_opts.extra_plugins.clone()), + ) + }); + + let mut registry = Registry::new(sess, krate.span); + + time(sess, "plugin registration", || { + if sess.features_untracked().rustc_diagnostic_macros { + registry.register_macro( + "__diagnostic_used", + diagnostics::plugin::expand_diagnostic_used, + ); + registry.register_macro( + "__register_diagnostic", + diagnostics::plugin::expand_register_diagnostic, + ); + registry.register_macro( + "__build_diagnostic_array", + diagnostics::plugin::expand_build_diagnostic_array, + ); + } + + for registrar in registrars { + registry.args_hidden = Some(registrar.args); + (registrar.fun)(&mut registry); + } + }); + + let Registry { + syntax_exts, + early_lint_passes, + late_lint_passes, + lint_groups, + llvm_passes, + attributes, + .. + } = registry; + + sess.track_errors(|| { + let mut ls = sess.lint_store.borrow_mut(); + for pass in early_lint_passes { + ls.register_early_pass(Some(sess), true, false, pass); + } + for pass in late_lint_passes { + ls.register_late_pass(Some(sess), true, pass); + } + + for (name, (to, deprecated_name)) in lint_groups { + ls.register_group(Some(sess), true, name, deprecated_name, to); + } + + *sess.plugin_llvm_passes.borrow_mut() = llvm_passes; + *sess.plugin_attributes.borrow_mut() = attributes.clone(); + })?; + + Ok((krate, PluginInfo { + syntax_exts, + attributes, + })) +} + +fn configure_and_expand_inner<'a>( + sess: &'a Session, + cstore: &'a CStore, + mut krate: ast::Crate, + crate_name: &str, + resolver_arenas: &'a ResolverArenas<'a>, + crate_loader: &'a mut CrateLoader<'a>, + plugin_info: PluginInfo, +) -> Result<(ast::Crate, Resolver<'a>)> { + let attributes = plugin_info.attributes; + time(sess, "pre ast expansion lint checks", || { + lint::check_ast_crate( + sess, + &krate, + true, + rustc_lint::BuiltinCombinedPreExpansionLintPass::new()); + }); + + let mut resolver = Resolver::new( + sess, + cstore, + &krate, + crate_name, + crate_loader, + &resolver_arenas, + ); + syntax_ext::register_builtins(&mut resolver, plugin_info.syntax_exts); + + // Expand all macros + sess.profiler(|p| p.start_activity(ProfileCategory::Expansion)); + krate = time(sess, "expansion", || { + // Windows dlls do not have rpaths, so they don't know how to find their + // dependencies. It's up to us to tell the system where to find all the + // dependent dlls. Note that this uses cfg!(windows) as opposed to + // targ_cfg because syntax extensions are always loaded for the host + // compiler, not for the target. + // + // This is somewhat of an inherently racy operation, however, as + // multiple threads calling this function could possibly continue + // extending PATH far beyond what it should. To solve this for now we + // just don't add any new elements to PATH which are already there + // within PATH. This is basically a targeted fix at #17360 for rustdoc + // which runs rustc in parallel but has been seen (#33844) to cause + // problems with PATH becoming too long. + let mut old_path = OsString::new(); + if cfg!(windows) { + old_path = env::var_os("PATH").unwrap_or(old_path); + let mut new_path = sess.host_filesearch(PathKind::All).search_path_dirs(); + for path in env::split_paths(&old_path) { + if !new_path.contains(&path) { + new_path.push(path); + } + } + env::set_var( + "PATH", + &env::join_paths( + new_path + .iter() + .filter(|p| env::join_paths(iter::once(p)).is_ok()), + ).unwrap(), + ); + } + + // Create the config for macro expansion + let features = sess.features_untracked(); + let cfg = syntax::ext::expand::ExpansionConfig { + features: Some(&features), + recursion_limit: *sess.recursion_limit.get(), + trace_mac: sess.opts.debugging_opts.trace_macros, + should_test: sess.opts.test, + ..syntax::ext::expand::ExpansionConfig::default(crate_name.to_string()) + }; + + let mut ecx = ExtCtxt::new(&sess.parse_sess, cfg, &mut resolver); + + // Expand macros now! + let krate = time(sess, "expand crate", || { + ecx.monotonic_expander().expand_crate(krate) + }); + + // The rest is error reporting + + time(sess, "check unused macros", || { + ecx.check_unused_macros(); + }); + + let mut missing_fragment_specifiers: Vec<_> = ecx.parse_sess + .missing_fragment_specifiers + .borrow() + .iter() + .cloned() + .collect(); + missing_fragment_specifiers.sort(); + + for span in missing_fragment_specifiers { + let lint = lint::builtin::MISSING_FRAGMENT_SPECIFIER; + let msg = "missing fragment specifier"; + sess.buffer_lint(lint, ast::CRATE_NODE_ID, span, msg); + } + if cfg!(windows) { + env::set_var("PATH", &old_path); + } + krate + }); + sess.profiler(|p| p.end_activity(ProfileCategory::Expansion)); + + time(sess, "maybe building test harness", || { + syntax::test::modify_for_testing( + &sess.parse_sess, + &mut resolver, + sess.opts.test, + &mut krate, + sess.diagnostic(), + &sess.features_untracked(), + ) + }); + + // If we're actually rustdoc then there's no need to actually compile + // anything, so switch everything to just looping + if sess.opts.actually_rustdoc { + util::ReplaceBodyWithLoop::new(sess).visit_crate(&mut krate); + } + + let (has_proc_macro_decls, has_global_allocator) = time(sess, "AST validation", || { + ast_validation::check_crate(sess, &krate) + }); + + // If we're in rustdoc we're always compiling as an rlib, but that'll trip a + // bunch of checks in the `modify` function below. For now just skip this + // step entirely if we're rustdoc as it's not too useful anyway. + if !sess.opts.actually_rustdoc { + krate = time(sess, "maybe creating a macro crate", || { + let crate_types = sess.crate_types.borrow(); + let num_crate_types = crate_types.len(); + let is_proc_macro_crate = crate_types.contains(&config::CrateType::ProcMacro); + let is_test_crate = sess.opts.test; + syntax_ext::proc_macro_decls::modify( + &sess.parse_sess, + &mut resolver, + krate, + is_proc_macro_crate, + has_proc_macro_decls, + is_test_crate, + num_crate_types, + sess.diagnostic(), + ) + }); + } + + if has_global_allocator { + // Expand global allocators, which are treated as an in-tree proc macro + time(sess, "creating allocators", || { + allocator::expand::modify( + &sess.parse_sess, + &mut resolver, + &mut krate, + crate_name.to_string(), + sess.diagnostic(), + ) + }); + } + + // Done with macro expansion! + + if sess.opts.debugging_opts.input_stats { + println!("Post-expansion node count: {}", count_nodes(&krate)); + } + + if sess.opts.debugging_opts.hir_stats { + hir_stats::print_ast_stats(&krate, "POST EXPANSION AST STATS"); + } + + if sess.opts.debugging_opts.ast_json { + println!("{}", json::as_json(&krate)); + } + + time(sess, "name resolution", || { + resolver.resolve_crate(&krate); + }); + + // Needs to go *after* expansion to be able to check the results of macro expansion. + time(sess, "complete gated feature checking", || { + syntax::feature_gate::check_crate( + &krate, + &sess.parse_sess, + &sess.features_untracked(), + &attributes, + sess.opts.unstable_features, + ); + }); + + // Add all buffered lints from the `ParseSess` to the `Session`. + sess.parse_sess.buffered_lints.with_lock(|buffered_lints| { + info!("{} parse sess buffered_lints", buffered_lints.len()); + for BufferedEarlyLint{id, span, msg, lint_id} in buffered_lints.drain(..) { + let lint = lint::Lint::from_parser_lint_id(lint_id); + sess.buffer_lint(lint, id, span, &msg); + } + }); + + Ok((krate, resolver)) +} + +pub fn lower_to_hir( + sess: &Session, + cstore: &CStore, + resolver: &mut Resolver<'_>, + dep_graph: &DepGraph, + krate: &ast::Crate, +) -> Result { + // Lower ast -> hir + let hir_forest = time(sess, "lowering ast -> hir", || { + let hir_crate = lower_crate(sess, cstore, &dep_graph, &krate, resolver); + + if sess.opts.debugging_opts.hir_stats { + hir_stats::print_hir_stats(&hir_crate); + } + + hir::map::Forest::new(hir_crate, &dep_graph) + }); + + time(sess, "early lint checks", || { + lint::check_ast_crate(sess, &krate, false, rustc_lint::BuiltinCombinedEarlyLintPass::new()) + }); + + // Discard hygiene data, which isn't required after lowering to HIR. + if !sess.opts.debugging_opts.keep_hygiene_data { + syntax::ext::hygiene::clear_markings(); + } + + Ok(hir_forest) +} + +// Returns all the paths that correspond to generated files. +fn generated_output_paths( sess: &Session, outputs: &OutputFilenames, exact_name: bool, @@ -106,7 +625,7 @@ where None } -pub fn output_contains_path(output_paths: &[PathBuf], input_path: &PathBuf) -> bool { +fn output_contains_path(output_paths: &[PathBuf], input_path: &PathBuf) -> bool { let input_path = input_path.canonicalize().ok(); if input_path.is_none() { return false; @@ -121,7 +640,7 @@ pub fn output_contains_path(output_paths: &[PathBuf], input_path: &PathBuf) -> b check_output(output_paths, check).is_some() } -pub fn output_conflicts_with_dir(output_paths: &[PathBuf]) -> Option { +fn output_conflicts_with_dir(output_paths: &[PathBuf]) -> Option { let check = |output_path: &PathBuf| { if output_path.is_dir() { Some(output_path.clone()) @@ -138,7 +657,7 @@ fn escape_dep_filename(filename: &FileName) -> String { filename.to_string().replace(" ", "\\ ") } -pub fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &[PathBuf]) { +fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &[PathBuf]) { // Write out dependency rules to the dep-info file if requested if !sess.opts.output_types.contains_key(&OutputType::DepInfo) { return; @@ -178,15 +697,192 @@ pub fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: } } -pub fn provide(providers: &mut ty::query::Providers) { - providers.analysis = analysis; - proc_macro_decls::provide(providers); +pub fn prepare_outputs( + sess: &Session, + compiler: &Compiler, + krate: &ast::Crate, + crate_name: &str +) -> Result { + // FIXME: rustdoc passes &[] instead of &krate.attrs here + let outputs = util::build_output_filenames( + &compiler.input, + &compiler.output_dir, + &compiler.output_file, + &krate.attrs, + sess + ); + + let output_paths = generated_output_paths( + sess, + &outputs, + compiler.output_file.is_some(), + &crate_name, + ); + + // Ensure the source file isn't accidentally overwritten during compilation. + if let Some(ref input_path) = compiler.input_path { + if sess.opts.will_create_output_file() { + if output_contains_path(&output_paths, input_path) { + sess.err(&format!( + "the input file \"{}\" would be overwritten by the generated \ + executable", + input_path.display() + )); + return Err(ErrorReported); + } + if let Some(dir_path) = output_conflicts_with_dir(&output_paths) { + sess.err(&format!( + "the generated executable for the input file \"{}\" conflicts with the \ + existing directory \"{}\"", + input_path.display(), + dir_path.display() + )); + return Err(ErrorReported); + } + } + } + + write_out_deps(sess, &outputs, &output_paths); + + let only_dep_info = sess.opts.output_types.contains_key(&OutputType::DepInfo) + && sess.opts.output_types.len() == 1; + + if !only_dep_info { + if let Some(ref dir) = compiler.output_dir { + if fs::create_dir_all(dir).is_err() { + sess.err("failed to find or create the directory specified by --out-dir"); + return Err(ErrorReported); + } + } + } + + Ok(outputs) } +pub fn default_provide(providers: &mut ty::query::Providers) { + providers.analysis = analysis; + proc_macro_decls::provide(providers); + plugin::build::provide(providers); + hir::provide(providers); + borrowck::provide(providers); + mir::provide(providers); + reachable::provide(providers); + resolve_lifetime::provide(providers); + rustc_privacy::provide(providers); + typeck::provide(providers); + ty::provide(providers); + traits::provide(providers); + stability::provide(providers); + middle::intrinsicck::provide(providers); + middle::liveness::provide(providers); + reachable::provide(providers); + rustc_passes::provide(providers); + rustc_traits::provide(providers); + middle::region::provide(providers); + middle::entry::provide(providers); + cstore::provide(providers); + lint::provide(providers); +} + +pub fn default_provide_extern(providers: &mut ty::query::Providers) { + cstore::provide_extern(providers); +} + +declare_box_region_type!( + pub BoxedGlobalCtxt, + for('gcx), + (&'gcx GlobalCtxt<'gcx>) -> ((), ()) +); + +impl BoxedGlobalCtxt { + pub fn enter(&mut self, f: F) -> R + where + F: for<'tcx> FnOnce(TyCtxt<'tcx, 'tcx, 'tcx>) -> R + { + self.access(|gcx| ty::tls::enter_global(gcx, |tcx| f(tcx))) + } +} + +pub fn create_global_ctxt( + compiler: &Compiler, + mut hir_forest: hir::map::Forest, + defs: hir::map::Definitions, + resolutions: Resolutions, + outputs: OutputFilenames, + tx: mpsc::Sender>, + crate_name: &str +) -> BoxedGlobalCtxt { + let sess = compiler.session().clone(); + let cstore = compiler.cstore.clone(); + let codegen_backend = compiler.codegen_backend().clone(); + let crate_name = crate_name.to_string(); + + let ((), result) = BoxedGlobalCtxt::new(static move || { + let sess = &*sess; + let cstore = &*cstore; + + let global_ctxt: Option>; + let arenas = AllArenas::new(); + + // Construct the HIR map + let hir_map = time(sess, "indexing hir", || { + hir::map::map_crate(sess, cstore, &mut hir_forest, &defs) + }); + + let query_result_on_disk_cache = time(sess, "load query result cache", || { + rustc_incremental::load_query_result_cache(sess) + }); + + let mut local_providers = ty::query::Providers::default(); + default_provide(&mut local_providers); + codegen_backend.provide(&mut local_providers); + + let mut extern_providers = local_providers; + default_provide_extern(&mut extern_providers); + codegen_backend.provide_extern(&mut extern_providers); + + let gcx = TyCtxt::create_global_ctxt( + sess, + cstore, + local_providers, + extern_providers, + &arenas, + resolutions, + hir_map, + query_result_on_disk_cache, + &crate_name, + tx, + &outputs + ); + + global_ctxt = Some(gcx); + let gcx = global_ctxt.as_ref().unwrap(); + + ty::tls::enter_global(gcx, |tcx| { + // Do some initialization of the DepGraph that can only be done with the + // tcx available. + time(tcx.sess, "dep graph tcx init", || rustc_incremental::dep_graph_tcx_init(tcx)); + }); + + yield BoxedGlobalCtxt::initial_yield(()); + box_region_allow_access!(for('gcx), (&'gcx GlobalCtxt<'gcx>), (gcx)); + + gcx.queries.record_computed_queries(sess); + + if sess.opts.debugging_opts.query_stats { + gcx.queries.print_stats(); + } + }); + + result +} + +/// Runs the resolution, type-checking, region checking and other +/// miscellaneous analysis passes on the crate. fn analysis<'tcx>( tcx: TyCtxt<'_, 'tcx, 'tcx>, cnum: CrateNum, -) -> Result<(), ErrorReported> { +) -> Result<()> { assert_eq!(cnum, LOCAL_CRATE); let sess = tcx.sess; @@ -249,9 +945,9 @@ fn analysis<'tcx>( } }); - time(sess, - "MIR borrow checking", - || tcx.par_body_owners(|def_id| { tcx.ensure().mir_borrowck(def_id); })); + time(sess, "MIR borrow checking", || { + tcx.par_body_owners(|def_id| tcx.ensure().mir_borrowck(def_id)); + }); time(sess, "dumping chalk-like clauses", || { rustc_traits::lowering::dump_program_clauses(tcx); @@ -304,3 +1000,39 @@ fn analysis<'tcx>( Ok(()) } + +/// Runs the codegen backend, after which the AST and analysis can +/// be discarded. +pub fn start_codegen<'tcx>( + codegen_backend: &dyn CodegenBackend, + tcx: TyCtxt<'_, 'tcx, 'tcx>, + rx: mpsc::Receiver>, + outputs: &OutputFilenames, +) -> Box { + if log_enabled!(::log::Level::Info) { + println!("Pre-codegen"); + tcx.print_debug_stats(); + } + + time(tcx.sess, "resolving dependency formats", || { + ::rustc::middle::dependency_format::calculate(tcx) + }); + + tcx.sess.profiler(|p| p.start_activity(ProfileCategory::Codegen)); + let codegen = time(tcx.sess, "codegen", move || codegen_backend.codegen_crate(tcx, rx)); + tcx.sess.profiler(|p| p.end_activity(ProfileCategory::Codegen)); + + if log_enabled!(::log::Level::Info) { + println!("Post-codegen"); + tcx.print_debug_stats(); + } + + if tcx.sess.opts.output_types.contains_key(&OutputType::Mir) { + if let Err(e) = mir::transform::dump_mir::emit_mir(tcx, outputs) { + tcx.sess.err(&format!("could not emit MIR: {}", e)); + tcx.sess.abort_if_errors(); + } + } + + codegen +} diff --git a/src/librustc_interface/queries.rs b/src/librustc_interface/queries.rs new file mode 100644 index 000000000000..57ced0464d9f --- /dev/null +++ b/src/librustc_interface/queries.rs @@ -0,0 +1,302 @@ +use interface::{Compiler, Result}; +use passes::{self, BoxedResolver, ExpansionResult, BoxedGlobalCtxt, PluginInfo}; +use rustc_incremental::DepGraphFuture; +use rustc_data_structures::sync::Lrc; +use rustc::session::config::{Input, OutputFilenames, OutputType}; +use rustc::session::Session; +use rustc::util::common::{time, ErrorReported}; +use rustc::util::profiling::ProfileCategory; +use rustc::lint; +use rustc::hir; +use rustc::hir::def_id::LOCAL_CRATE; +use rustc::ty; +use rustc::ty::steal::Steal; +use rustc::dep_graph::DepGraph; +use rustc_passes::hir_stats; +use rustc_plugin::registry::Registry; +use serialize::json; +use std::cell::{Ref, RefMut, RefCell}; +use std::ops::Deref; +use std::rc::Rc; +use std::sync::mpsc; +use std::any::Any; +use std::mem; +use syntax::parse::{self, PResult}; +use syntax::util::node_count::NodeCounter; +use syntax::{self, ast, attr, diagnostics, visit}; +use syntax_pos::hygiene; + +/// Represent the result of a query. +/// This result can be stolen with the `take` method and returned with the `give` method. +pub struct Query { + result: RefCell>>, +} + +impl Query { + fn compute Result>(&self, f: F) -> Result<&Query> { + let mut result = self.result.borrow_mut(); + if result.is_none() { + *result = Some(f()); + } + result.as_ref().unwrap().as_ref().map(|_| self).map_err(|err| *err) + } + + /// Takes ownership of the query result. Further attempts to take or peek the query + /// result will panic unless it is returned by calling the `give` method. + pub fn take(&self) -> T { + self.result + .borrow_mut() + .take() + .expect("missing query result") + .unwrap() + } + + /// Returns a stolen query result. Panics if there's already a result. + pub fn give(&self, value: T) { + let mut result = self.result.borrow_mut(); + assert!(result.is_none(), "a result already exists"); + *result = Some(Ok(value)); + } + + /// Borrows the query result using the RefCell. Panics if the result is stolen. + pub fn peek(&self) -> Ref<'_, T> { + Ref::map(self.result.borrow(), |r| { + r.as_ref().unwrap().as_ref().expect("missing query result") + }) + } + + /// Mutably borrows the query result using the RefCell. Panics if the result is stolen. + pub fn peek_mut(&self) -> RefMut<'_, T> { + RefMut::map(self.result.borrow_mut(), |r| { + r.as_mut().unwrap().as_mut().expect("missing query result") + }) + } +} + +impl Default for Query { + fn default() -> Self { + Query { + result: RefCell::new(None), + } + } +} + +#[derive(Default)] +pub(crate) struct Queries { + dep_graph_future: Query>, + parse: Query, + crate_name: Query, + register_plugins: Query<(ast::Crate, PluginInfo)>, + expansion: Query<(ast::Crate, Rc>>)>, + dep_graph: Query, + lower_to_hir: Query<(Steal, ExpansionResult)>, + prepare_outputs: Query, + codegen_channel: Query<(Steal>>, + Steal>>)>, + global_ctxt: Query, + ongoing_codegen: Query>, + link: Query<()>, +} + +impl Compiler { + pub fn dep_graph_future(&self) -> Result<&Query>> { + self.queries.dep_graph_future.compute(|| { + Ok(if self.session().opts.build_dep_graph() { + Some(rustc_incremental::load_dep_graph(self.session())) + } else { + None + }) + }) + } + + pub fn parse(&self) -> Result<&Query> { + self.queries.parse.compute(|| { + passes::parse(self.session(), &self.input).map_err( + |mut parse_error| { + parse_error.emit(); + ErrorReported + }, + ) + }) + } + + pub fn register_plugins(&self) -> Result<&Query<(ast::Crate, PluginInfo)>> { + self.queries.register_plugins.compute(|| { + let crate_name = self.crate_name()?.peek().clone(); + let krate = self.parse()?.take(); + + passes::register_plugins( + self, + self.session(), + self.cstore(), + krate, + &crate_name, + ) + }) + } + + pub fn crate_name(&self) -> Result<&Query> { + self.queries.crate_name.compute(|| { + let parse_result = self.parse()?; + let krate = parse_result.peek(); + let result = match self.crate_name { + Some(ref crate_name) => crate_name.clone(), + None => rustc_codegen_utils::link::find_crate_name( + Some(self.session()), + &krate.attrs, + &self.input + ), + }; + Ok(result) + }) + } + + pub fn expansion( + &self + ) -> Result<&Query<(ast::Crate, Rc>>)>> { + self.queries.expansion.compute(|| { + let crate_name = self.crate_name()?.peek().clone(); + let (krate, plugin_info) = self.register_plugins()?.take(); + passes::configure_and_expand( + self.sess.clone(), + self.cstore().clone(), + krate, + &crate_name, + plugin_info, + ).map(|(krate, resolver)| (krate, Rc::new(Some(RefCell::new(resolver))))) + }) + } + + pub fn dep_graph(&self) -> Result<&Query> { + self.queries.dep_graph.compute(|| { + Ok(match self.dep_graph_future()?.take() { + None => DepGraph::new_disabled(), + Some(future) => { + let (prev_graph, prev_work_products) = + time(self.session(), "blocked while dep-graph loading finishes", || { + future.open().unwrap_or_else(|e| rustc_incremental::LoadResult::Error { + message: format!("could not decode incremental cache: {:?}", e), + }).open(self.session()) + }); + DepGraph::new(prev_graph, prev_work_products) + } + }) + }) + } + + pub fn lower_to_hir(&self) -> Result<&Query<(Steal, ExpansionResult)>> { + self.queries.lower_to_hir.compute(|| { + let expansion_result = self.expansion()?; + let (krate, resolver) = expansion_result.take(); + let resolver_ref = &*resolver; + let hir = Steal::new(resolver_ref.as_ref().unwrap().borrow_mut().access(|resolver| { + passes::lower_to_hir( + self.session(), + self.cstore(), + resolver, + &*self.dep_graph()?.peek(), + &krate + ) + })?); + expansion_result.give((krate, Rc::new(None))); + Ok((hir, BoxedResolver::to_expansion_result(resolver))) + }) + } + + pub fn prepare_outputs(&self) -> Result<&Query> { + self.queries.prepare_outputs.compute(|| { + self.lower_to_hir()?; + let krate = self.expansion()?; + let krate = krate.peek(); + let crate_name = self.crate_name()?; + let crate_name = crate_name.peek(); + passes::prepare_outputs(self.session(), self, &krate.0, &*crate_name) + }) + } + + pub fn codegen_channel(&self) -> Result<&Query<(Steal>>, + Steal>>)>> { + self.queries.codegen_channel.compute(|| { + let (tx, rx) = mpsc::channel(); + Ok((Steal::new(tx), Steal::new(rx))) + }) + } + + pub fn global_ctxt(&self) -> Result<&Query> { + self.queries.global_ctxt.compute(|| { + let crate_name = self.crate_name()?.peek().clone(); + let outputs = self.prepare_outputs()?.peek().clone(); + let hir = self.lower_to_hir()?; + let hir = hir.peek(); + let (ref hir_forest, ref expansion) = *hir; + let tx = self.codegen_channel()?.peek().0.steal(); + Ok(passes::create_global_ctxt( + self, + hir_forest.steal(), + expansion.defs.steal(), + expansion.resolutions.steal(), + outputs, + tx, + &crate_name)) + }) + } + + pub fn ongoing_codegen(&self) -> Result<&Query>> { + self.queries.ongoing_codegen.compute(|| { + let rx = self.codegen_channel()?.peek().1.steal(); + let outputs = self.prepare_outputs()?; + self.global_ctxt()?.peek_mut().enter(|tcx| { + tcx.analysis(LOCAL_CRATE).ok(); + + // Don't do code generation if there were any errors + self.session().compile_status()?; + + Ok(passes::start_codegen( + &***self.codegen_backend(), + tcx, + rx, + &*outputs.peek() + )) + }) + }) + } + + pub fn link(&self) -> Result<&Query<()>> { + self.queries.link.compute(|| { + let sess = self.session(); + + let ongoing_codegen = self.ongoing_codegen()?.take(); + + self.codegen_backend().join_codegen_and_link( + ongoing_codegen, + sess, + &*self.dep_graph()?.peek(), + &*self.prepare_outputs()?.peek(), + ).map_err(|_| ErrorReported)?; + + Ok(()) + }) + } + + pub fn compile(&self) -> Result<()> { + self.prepare_outputs()?; + + if self.session().opts.output_types.contains_key(&OutputType::DepInfo) + && self.session().opts.output_types.len() == 1 + { + return Ok(()) + } + + self.global_ctxt()?; + + // Drop AST after creating GlobalCtxt to free memory + mem::drop(self.expansion()?.take()); + + self.ongoing_codegen()?; + + // Drop GlobalCtxt after starting codegen to free memory + mem::drop(self.global_ctxt()?.take()); + + self.link().map(|_| ()) + } +} diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs index 6f92c3044621..0f858d632060 100644 --- a/src/librustc_interface/util.rs +++ b/src/librustc_interface/util.rs @@ -4,6 +4,8 @@ use rustc::session::CrateDisambiguator; use rustc::ty; use rustc::lint; use rustc_codegen_utils::codegen_backend::CodegenBackend; +#[cfg(parallel_compiler)] +use rustc_data_structures::jobserver; use rustc_data_structures::sync::{Lock, Lrc}; use rustc_data_structures::stable_hasher::StableHasher; use rustc_data_structures::fingerprint::Fingerprint; @@ -79,6 +81,161 @@ pub fn add_configuration( } } +pub fn create_session( + sopts: config::Options, + cfg: FxHashSet<(String, Option)>, + diagnostic_output: DiagnosticOutput, + file_loader: Option>, + input_path: Option, + lint_caps: FxHashMap, +) -> (Lrc, Lrc>, Lrc) { + let descriptions = diagnostics_registry(); + + let loader = file_loader.unwrap_or(box RealFileLoader); + let source_map = Lrc::new(SourceMap::with_file_loader( + loader, + sopts.file_path_mapping(), + )); + let mut sess = session::build_session_with_source_map( + sopts, + input_path, + descriptions, + source_map.clone(), + diagnostic_output, + lint_caps, + ); + + let codegen_backend = get_codegen_backend(&sess); + + rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); + + let mut cfg = config::build_configuration(&sess, config::to_crate_config(cfg)); + add_configuration(&mut cfg, &sess, &*codegen_backend); + sess.parse_sess.config = cfg; + + (Lrc::new(sess), Lrc::new(codegen_backend), source_map) +} + +// Temporarily have stack size set to 32MB to deal with various crates with long method +// chains or deep syntax trees. +// FIXME(oli-obk): get https://github.com/rust-lang/rust/pull/55617 the finish line +const STACK_SIZE: usize = 32 * 1024 * 1024; // 32MB + +fn get_stack_size() -> Option { + // FIXME: Hacks on hacks. If the env is trying to override the stack size + // then *don't* set it explicitly. + if env::var_os("RUST_MIN_STACK").is_none() { + Some(STACK_SIZE) + } else { + None + } +} + +struct Sink(Arc>>); +impl Write for Sink { + fn write(&mut self, data: &[u8]) -> io::Result { + Write::write(&mut *self.0.lock().unwrap(), data) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } +} + +#[cfg(not(parallel_compiler))] +pub fn scoped_thread R + Send, R: Send>(cfg: thread::Builder, f: F) -> R { + struct Ptr(*mut ()); + unsafe impl Send for Ptr {} + unsafe impl Sync for Ptr {} + + let mut f = Some(f); + let run = Ptr(&mut f as *mut _ as *mut ()); + let mut result = None; + let result_ptr = Ptr(&mut result as *mut _ as *mut ()); + + let thread = cfg.spawn(move || { + let run = unsafe { (*(run.0 as *mut Option)).take().unwrap() }; + let result = unsafe { &mut *(result_ptr.0 as *mut Option) }; + *result = Some(run()); + }); + + match thread.unwrap().join() { + Ok(()) => result.unwrap(), + Err(p) => panic::resume_unwind(p), + } +} + +#[cfg(not(parallel_compiler))] +pub fn spawn_thread_pool R + Send, R: Send>( + _threads: Option, + stderr: &Option>>>, + f: F, +) -> R { + let mut cfg = thread::Builder::new().name("rustc".to_string()); + + if let Some(size) = get_stack_size() { + cfg = cfg.stack_size(size); + } + + scoped_thread(cfg, || { + syntax::with_globals( || { + ty::tls::GCX_PTR.set(&Lock::new(0), || { + if let Some(stderr) = stderr { + io::set_panic(Some(box Sink(stderr.clone()))); + } + ty::tls::with_thread_locals(|| f()) + }) + }) + }) +} + +#[cfg(parallel_compiler)] +pub fn spawn_thread_pool R + Send, R: Send>( + threads: Option, + stderr: &Option>>>, + f: F, +) -> R { + use rayon::{ThreadPool, ThreadPoolBuilder}; + use syntax; + use syntax_pos; + + let gcx_ptr = &Lock::new(0); + + let mut config = ThreadPoolBuilder::new() + .acquire_thread_handler(jobserver::acquire_thread) + .release_thread_handler(jobserver::release_thread) + .num_threads(Session::threads_from_count(threads)) + .deadlock_handler(|| unsafe { ty::query::handle_deadlock() }); + + if let Some(size) = get_stack_size() { + config = config.stack_size(size); + } + + let with_pool = move |pool: &ThreadPool| pool.install(move || f()); + + syntax::with_globals(|| { + syntax::GLOBALS.with(|syntax_globals| { + syntax_pos::GLOBALS.with(|syntax_pos_globals| { + // The main handler runs for each Rayon worker thread and sets up + // the thread local rustc uses. syntax_globals and syntax_pos_globals are + // captured and set on the new threads. ty::tls::with_thread_locals sets up + // thread local callbacks from libsyntax + let main_handler = move |worker: &mut dyn FnMut()| { + syntax::GLOBALS.set(syntax_globals, || { + syntax_pos::GLOBALS.set(syntax_pos_globals, || { + if let Some(stderr) = stderr { + io::set_panic(Some(box Sink(stderr.clone()))); + } + ty::tls::with_thread_locals(|| { + ty::tls::GCX_PTR.set(gcx_ptr, || worker()) + }) + }) + }) + }; + + ThreadPool::scoped_pool(config, main_handler, with_pool).unwrap() + }) + }) + }) +} + fn load_backend_from_dylib(path: &Path) -> fn() -> Box { let lib = DynamicLibrary::open(Some(path)).unwrap_or_else(|err| { let err = format!("couldn't load codegen backend {:?}: {:?}", path, err); @@ -297,7 +454,7 @@ pub fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box CrateDisambiguator { +pub(crate) fn compute_crate_disambiguator(session: &Session) -> CrateDisambiguator { use std::hash::Hasher; // The crate_disambiguator is a 128 bit hash. The disambiguator is fed diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index 0b656ed44cc6..20fa6009b310 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -7,13 +7,13 @@ use self::def_ctor::{get_def_from_def_id, get_def_from_hir_id}; use super::*; -pub struct AutoTraitFinder<'a, 'tcx: 'a, 'rcx: 'a> { - pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>, +pub struct AutoTraitFinder<'a, 'tcx> { + pub cx: &'a core::DocContext<'tcx>, pub f: auto::AutoTraitFinder<'a, 'tcx>, } -impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> { - pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> Self { +impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { + pub fn new(cx: &'a core::DocContext<'tcx>) -> Self { let f = auto::AutoTraitFinder::new(&cx.tcx); AutoTraitFinder { cx, f } diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index 86914f66c3d2..aaae0bafd9e0 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -11,12 +11,12 @@ use super::*; use self::def_ctor::{get_def_from_def_id, get_def_from_hir_id}; -pub struct BlanketImplFinder<'a, 'tcx: 'a, 'rcx: 'a> { - pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>, +pub struct BlanketImplFinder<'a, 'tcx> { + pub cx: &'a core::DocContext<'tcx>, } -impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> { - pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> Self { +impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { + pub fn new(cx: &'a core::DocContext<'tcx>) -> Self { BlanketImplFinder { cx } } diff --git a/src/librustdoc/clean/def_ctor.rs b/src/librustdoc/clean/def_ctor.rs index 17d53479a67a..405a2e66d6e5 100644 --- a/src/librustdoc/clean/def_ctor.rs +++ b/src/librustdoc/clean/def_ctor.rs @@ -2,7 +2,7 @@ use crate::core::DocContext; use super::*; -pub fn get_def_from_def_id(cx: &DocContext<'_, '_, '_>, +pub fn get_def_from_def_id(cx: &DocContext<'_>, def_id: DefId, callback: &F, ) -> Vec @@ -38,7 +38,7 @@ where F: Fn(& dyn Fn(DefId) -> Def) -> Vec { } } -pub fn get_def_from_hir_id(cx: &DocContext<'_, '_, '_>, +pub fn get_def_from_hir_id(cx: &DocContext<'_>, id: hir::HirId, name: String, callback: &F, diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index abaf87f7aef0..880f67281b96 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -36,7 +36,7 @@ use super::Clean; /// The returned value is `None` if the definition could not be inlined, /// and `Some` of a vector of items if it was successfully expanded. pub fn try_inline( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, def: Def, name: ast::Name, visited: &mut FxHashSet @@ -129,7 +129,7 @@ pub fn try_inline( Some(ret) } -pub fn try_inline_glob(cx: &DocContext<'_, '_, '_>, def: Def, visited: &mut FxHashSet) +pub fn try_inline_glob(cx: &DocContext<'_>, def: Def, visited: &mut FxHashSet) -> Option> { if def == Def::Err { return None } @@ -146,7 +146,7 @@ pub fn try_inline_glob(cx: &DocContext<'_, '_, '_>, def: Def, visited: &mut FxHa } } -pub fn load_attrs(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Attributes { +pub fn load_attrs(cx: &DocContext<'_>, did: DefId) -> clean::Attributes { cx.tcx.get_attrs(did).clean(cx) } @@ -154,7 +154,7 @@ pub fn load_attrs(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Attributes /// /// These names are used later on by HTML rendering to generate things like /// source links back to the original item. -pub fn record_extern_fqn(cx: &DocContext<'_, '_, '_>, did: DefId, kind: clean::TypeKind) { +pub fn record_extern_fqn(cx: &DocContext<'_>, did: DefId, kind: clean::TypeKind) { let mut crate_name = cx.tcx.crate_name(did.krate).to_string(); if did.is_local() { crate_name = cx.crate_name.clone().unwrap_or(crate_name); @@ -182,7 +182,7 @@ pub fn record_extern_fqn(cx: &DocContext<'_, '_, '_>, did: DefId, kind: clean::T } } -pub fn build_external_trait(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Trait { +pub fn build_external_trait(cx: &DocContext<'_>, did: DefId) -> clean::Trait { let auto_trait = cx.tcx.trait_def(did).has_auto_impl; let trait_items = cx.tcx.associated_items(did).map(|item| item.clean(cx)).collect(); let predicates = cx.tcx.predicates_of(did); @@ -202,7 +202,7 @@ pub fn build_external_trait(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::T } } -fn build_external_function(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Function { +fn build_external_function(cx: &DocContext<'_>, did: DefId) -> clean::Function { let sig = cx.tcx.fn_sig(did); let constness = if cx.tcx.is_min_const_fn(did) { @@ -224,7 +224,7 @@ fn build_external_function(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Fu } } -fn build_enum(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Enum { +fn build_enum(cx: &DocContext<'_>, did: DefId) -> clean::Enum { let predicates = cx.tcx.predicates_of(did); clean::Enum { @@ -234,7 +234,7 @@ fn build_enum(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Enum { } } -fn build_struct(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Struct { +fn build_struct(cx: &DocContext<'_>, did: DefId) -> clean::Struct { let predicates = cx.tcx.predicates_of(did); let variant = cx.tcx.adt_def(did).non_enum_variant(); @@ -250,7 +250,7 @@ fn build_struct(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Struct { } } -fn build_union(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Union { +fn build_union(cx: &DocContext<'_>, did: DefId) -> clean::Union { let predicates = cx.tcx.predicates_of(did); let variant = cx.tcx.adt_def(did).non_enum_variant(); @@ -262,7 +262,7 @@ fn build_union(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Union { } } -fn build_type_alias(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Typedef { +fn build_type_alias(cx: &DocContext<'_>, did: DefId) -> clean::Typedef { let predicates = cx.tcx.predicates_of(did); clean::Typedef { @@ -271,7 +271,7 @@ fn build_type_alias(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Typedef { } } -pub fn build_impls(cx: &DocContext<'_, '_, '_>, did: DefId) -> Vec { +pub fn build_impls(cx: &DocContext<'_>, did: DefId) -> Vec { let tcx = cx.tcx; let mut impls = Vec::new(); @@ -282,7 +282,7 @@ pub fn build_impls(cx: &DocContext<'_, '_, '_>, did: DefId) -> Vec impls } -pub fn build_impl(cx: &DocContext<'_, '_, '_>, did: DefId, ret: &mut Vec) { +pub fn build_impl(cx: &DocContext<'_>, did: DefId, ret: &mut Vec) { if !cx.renderinfo.borrow_mut().inlined.insert(did) { return } @@ -393,7 +393,7 @@ pub fn build_impl(cx: &DocContext<'_, '_, '_>, did: DefId, ret: &mut Vec, + cx: &DocContext<'_>, did: DefId, visited: &mut FxHashSet ) -> clean::Module { @@ -404,7 +404,7 @@ fn build_module( is_crate: false, }; - fn fill_in(cx: &DocContext<'_, '_, '_>, did: DefId, items: &mut Vec, + fn fill_in(cx: &DocContext<'_>, did: DefId, items: &mut Vec, visited: &mut FxHashSet) { // If we're re-exporting a re-export it may actually re-export something in // two namespaces, so the target may be listed twice. Make sure we only @@ -421,7 +421,7 @@ fn build_module( } } -pub fn print_inlined_const(cx: &DocContext<'_, '_, '_>, did: DefId) -> String { +pub fn print_inlined_const(cx: &DocContext<'_>, did: DefId) -> String { if let Some(node_id) = cx.tcx.hir().as_local_hir_id(did) { cx.tcx.hir().hir_to_pretty_string(node_id) } else { @@ -429,14 +429,14 @@ pub fn print_inlined_const(cx: &DocContext<'_, '_, '_>, did: DefId) -> String { } } -fn build_const(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Constant { +fn build_const(cx: &DocContext<'_>, did: DefId) -> clean::Constant { clean::Constant { type_: cx.tcx.type_of(did).clean(cx), expr: print_inlined_const(cx, did) } } -fn build_static(cx: &DocContext<'_, '_, '_>, did: DefId, mutable: bool) -> clean::Static { +fn build_static(cx: &DocContext<'_>, did: DefId, mutable: bool) -> clean::Static { clean::Static { type_: cx.tcx.type_of(did).clean(cx), mutability: if mutable {clean::Mutable} else {clean::Immutable}, @@ -444,7 +444,7 @@ fn build_static(cx: &DocContext<'_, '_, '_>, did: DefId, mutable: bool) -> clean } } -fn build_macro(cx: &DocContext<'_, '_, '_>, did: DefId, name: ast::Name) -> clean::ItemEnum { +fn build_macro(cx: &DocContext<'_>, did: DefId, name: ast::Name) -> clean::ItemEnum { let imported_from = cx.tcx.original_crate_name(did.krate); match cx.cstore.load_macro_untracked(did, cx.sess()) { LoadedMacro::MacroDef(def) => { @@ -546,7 +546,7 @@ fn separate_supertrait_bounds(mut g: clean::Generics) (g, ty_bounds) } -pub fn record_extern_trait(cx: &DocContext<'_, '_, '_>, did: DefId) { +pub fn record_extern_trait(cx: &DocContext<'_>, did: DefId) { if did.is_local() { return; } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 5a1b4d2f8ce7..f2bf7ead5619 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -71,56 +71,56 @@ thread_local!(pub static MAX_DEF_ID: RefCell> = Defau const FN_OUTPUT_NAME: &'static str = "Output"; // extract the stability index for a node from tcx, if possible -fn get_stability(cx: &DocContext<'_, '_, '_>, def_id: DefId) -> Option { +fn get_stability(cx: &DocContext<'_>, def_id: DefId) -> Option { cx.tcx.lookup_stability(def_id).clean(cx) } -fn get_deprecation(cx: &DocContext<'_, '_, '_>, def_id: DefId) -> Option { +fn get_deprecation(cx: &DocContext<'_>, def_id: DefId) -> Option { cx.tcx.lookup_deprecation(def_id).clean(cx) } pub trait Clean { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> T; + fn clean(&self, cx: &DocContext<'_>) -> T; } impl, U> Clean> for [T] { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec { + fn clean(&self, cx: &DocContext<'_>) -> Vec { self.iter().map(|x| x.clean(cx)).collect() } } impl, U, V: Idx> Clean> for IndexVec { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> IndexVec { + fn clean(&self, cx: &DocContext<'_>) -> IndexVec { self.iter().map(|x| x.clean(cx)).collect() } } impl, U> Clean for P { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> U { + fn clean(&self, cx: &DocContext<'_>) -> U { (**self).clean(cx) } } impl, U> Clean for Rc { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> U { + fn clean(&self, cx: &DocContext<'_>) -> U { (**self).clean(cx) } } impl, U> Clean> for Option { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, cx: &DocContext<'_>) -> Option { self.as_ref().map(|v| v.clean(cx)) } } impl Clean for ty::Binder where T: Clean { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> U { + fn clean(&self, cx: &DocContext<'_>) -> U { self.skip_binder().clean(cx) } } impl, U> Clean> for P<[T]> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec { + fn clean(&self, cx: &DocContext<'_>) -> Vec { self.iter().map(|x| x.clean(cx)).collect() } } @@ -139,8 +139,8 @@ pub struct Crate { pub masked_crates: FxHashSet, } -impl<'a, 'tcx, 'rcx> Clean for visit_ast::RustdocVisitor<'a, 'tcx, 'rcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Crate { +impl<'a, 'tcx> Clean for visit_ast::RustdocVisitor<'a, 'tcx> { + fn clean(&self, cx: &DocContext<'_>) -> Crate { use crate::visit_lib::LibEmbargoVisitor; { @@ -234,7 +234,7 @@ pub struct ExternalCrate { } impl Clean for CrateNum { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> ExternalCrate { + fn clean(&self, cx: &DocContext<'_>) -> ExternalCrate { let root = DefId { krate: *self, index: CRATE_DEF_INDEX }; let krate_span = cx.tcx.def_span(root); let krate_src = cx.sess().source_map().span_to_filename(krate_span); @@ -582,7 +582,7 @@ pub struct Module { } impl Clean for doctree::Module { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let name = if self.name.is_some() { self.name.expect("No name provided").clean(cx) } else { @@ -1023,7 +1023,7 @@ impl AttributesExt for Attributes { } impl Clean for [ast::Attribute] { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Attributes { + fn clean(&self, cx: &DocContext<'_>) -> Attributes { Attributes::from_ast(cx.sess().diagnostic(), self) } } @@ -1035,7 +1035,7 @@ pub enum GenericBound { } impl GenericBound { - fn maybe_sized(cx: &DocContext<'_, '_, '_>) -> GenericBound { + fn maybe_sized(cx: &DocContext<'_>) -> GenericBound { let did = cx.tcx.require_lang_item(lang_items::SizedTraitLangItem); let empty = cx.tcx.intern_substs(&[]); let path = external_path(cx, &cx.tcx.item_name(did).as_str(), @@ -1052,7 +1052,7 @@ impl GenericBound { }, hir::TraitBoundModifier::Maybe) } - fn is_sized_bound(&self, cx: &DocContext<'_, '_, '_>) -> bool { + fn is_sized_bound(&self, cx: &DocContext<'_>) -> bool { use rustc::hir::TraitBoundModifier as TBM; if let GenericBound::TraitBound(PolyTrait { ref trait_, .. }, TBM::None) = *self { if trait_.def_id() == cx.tcx.lang_items().sized_trait() { @@ -1078,7 +1078,7 @@ impl GenericBound { } impl Clean for hir::GenericBound { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericBound { + fn clean(&self, cx: &DocContext<'_>) -> GenericBound { match *self { hir::GenericBound::Outlives(lt) => GenericBound::Outlives(lt.clean(cx)), hir::GenericBound::Trait(ref t, modifier) => { @@ -1088,7 +1088,7 @@ impl Clean for hir::GenericBound { } } -fn external_generic_args(cx: &DocContext<'_, '_, '_>, trait_did: Option, has_self: bool, +fn external_generic_args(cx: &DocContext<'_>, trait_did: Option, has_self: bool, bindings: Vec, substs: SubstsRef<'_>) -> GenericArgs { let lifetimes = substs.regions().filter_map(|v| v.clean(cx)).collect(); let types = substs.types().skip(has_self as usize).collect::>(); @@ -1130,7 +1130,7 @@ fn external_generic_args(cx: &DocContext<'_, '_, '_>, trait_did: Option, // trait_did should be set to a trait's DefId if called on a TraitRef, in order to sugar // from Fn<(A, B,), C> to Fn(A, B) -> C -fn external_path(cx: &DocContext<'_, '_, '_>, name: &str, trait_did: Option, has_self: bool, +fn external_path(cx: &DocContext<'_>, name: &str, trait_did: Option, has_self: bool, bindings: Vec, substs: SubstsRef<'_>) -> Path { Path { global: false, @@ -1143,7 +1143,7 @@ fn external_path(cx: &DocContext<'_, '_, '_>, name: &str, trait_did: Option Clean for (&'a ty::TraitRef<'tcx>, Vec) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericBound { + fn clean(&self, cx: &DocContext<'_>) -> GenericBound { let (trait_ref, ref bounds) = *self; inline::record_extern_fqn(cx, trait_ref.def_id, TypeKind::Trait); let path = external_path(cx, &cx.tcx.item_name(trait_ref.def_id).as_str(), @@ -1187,13 +1187,13 @@ impl<'a, 'tcx> Clean for (&'a ty::TraitRef<'tcx>, Vec } impl<'tcx> Clean for ty::TraitRef<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericBound { + fn clean(&self, cx: &DocContext<'_>) -> GenericBound { (self, vec![]).clean(cx) } } impl<'tcx> Clean>> for InternalSubsts<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option> { + fn clean(&self, cx: &DocContext<'_>) -> Option> { let mut v = Vec::new(); v.extend(self.regions().filter_map(|r| r.clean(cx)).map(GenericBound::Outlives)); v.extend(self.types().map(|t| GenericBound::TraitBound(PolyTrait { @@ -1220,7 +1220,7 @@ impl Lifetime { } impl Clean for hir::Lifetime { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Lifetime { + fn clean(&self, cx: &DocContext<'_>) -> Lifetime { if self.hir_id != hir::DUMMY_HIR_ID { let def = cx.tcx.named_region(self.hir_id); match def { @@ -1239,7 +1239,7 @@ impl Clean for hir::Lifetime { } impl Clean for hir::GenericParam { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Lifetime { + fn clean(&self, _: &DocContext<'_>) -> Lifetime { match self.kind { hir::GenericParamKind::Lifetime { .. } => { if self.bounds.len() > 0 { @@ -1263,7 +1263,7 @@ impl Clean for hir::GenericParam { } impl Clean for hir::ConstArg { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Constant { + fn clean(&self, cx: &DocContext<'_>) -> Constant { Constant { type_: cx.tcx.type_of(cx.tcx.hir().body_owner_def_id(self.value.body)).clean(cx), expr: print_const_expr(cx, self.value.body), @@ -1272,13 +1272,13 @@ impl Clean for hir::ConstArg { } impl<'tcx> Clean for ty::GenericParamDef { - fn clean(&self, _cx: &DocContext<'_, '_, '_>) -> Lifetime { + fn clean(&self, _cx: &DocContext<'_>) -> Lifetime { Lifetime(self.name.to_string()) } } impl Clean> for ty::RegionKind { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, cx: &DocContext<'_>) -> Option { match *self { ty::ReStatic => Some(Lifetime::statik()), ty::ReLateBound(_, ty::BrNamed(_, name)) => Some(Lifetime(name.to_string())), @@ -1307,7 +1307,7 @@ pub enum WherePredicate { } impl Clean for hir::WherePredicate { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> WherePredicate { + fn clean(&self, cx: &DocContext<'_>) -> WherePredicate { match *self { hir::WherePredicate::BoundPredicate(ref wbp) => { WherePredicate::BoundPredicate { @@ -1334,7 +1334,7 @@ impl Clean for hir::WherePredicate { } impl<'a> Clean> for ty::Predicate<'a> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, cx: &DocContext<'_>) -> Option { use rustc::ty::Predicate; match *self { @@ -1353,7 +1353,7 @@ impl<'a> Clean> for ty::Predicate<'a> { } impl<'a> Clean for ty::TraitPredicate<'a> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> WherePredicate { + fn clean(&self, cx: &DocContext<'_>) -> WherePredicate { WherePredicate::BoundPredicate { ty: self.trait_ref.self_ty().clean(cx), bounds: vec![self.trait_ref.clean(cx)] @@ -1362,7 +1362,7 @@ impl<'a> Clean for ty::TraitPredicate<'a> { } impl<'tcx> Clean for ty::SubtypePredicate<'tcx> { - fn clean(&self, _cx: &DocContext<'_, '_, '_>) -> WherePredicate { + fn clean(&self, _cx: &DocContext<'_>) -> WherePredicate { panic!("subtype predicates are an internal rustc artifact \ and should not be seen by rustdoc") } @@ -1371,7 +1371,7 @@ impl<'tcx> Clean for ty::SubtypePredicate<'tcx> { impl<'tcx> Clean> for ty::OutlivesPredicate,ty::Region<'tcx>> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, cx: &DocContext<'_>) -> Option { let ty::OutlivesPredicate(ref a, ref b) = *self; match (a, b) { @@ -1389,7 +1389,7 @@ impl<'tcx> Clean> for } impl<'tcx> Clean> for ty::OutlivesPredicate, ty::Region<'tcx>> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, cx: &DocContext<'_>) -> Option { let ty::OutlivesPredicate(ref ty, ref lt) = *self; match lt { @@ -1405,7 +1405,7 @@ impl<'tcx> Clean> for ty::OutlivesPredicate, ty: } impl<'tcx> Clean for ty::ProjectionPredicate<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> WherePredicate { + fn clean(&self, cx: &DocContext<'_>) -> WherePredicate { WherePredicate::EqPredicate { lhs: self.projection_ty.clean(cx), rhs: self.ty.clean(cx) @@ -1414,7 +1414,7 @@ impl<'tcx> Clean for ty::ProjectionPredicate<'tcx> { } impl<'tcx> Clean for ty::ProjectionTy<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type { + fn clean(&self, cx: &DocContext<'_>) -> Type { let trait_ = match self.trait_ref(cx.tcx).clean(cx) { GenericBound::TraitBound(t, _) => t.trait_, GenericBound::Outlives(_) => panic!("cleaning a trait got a lifetime"), @@ -1462,7 +1462,7 @@ impl GenericParamDef { } impl<'tcx> Clean for ty::GenericParamDef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericParamDef { + fn clean(&self, cx: &DocContext<'_>) -> GenericParamDef { let (name, kind) = match self.kind { ty::GenericParamDefKind::Lifetime => { (self.name.to_string(), GenericParamDefKind::Lifetime) @@ -1495,7 +1495,7 @@ impl<'tcx> Clean for ty::GenericParamDef { } impl Clean for hir::GenericParam { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericParamDef { + fn clean(&self, cx: &DocContext<'_>) -> GenericParamDef { let (name, kind) = match self.kind { hir::GenericParamKind::Lifetime { .. } => { let name = if self.bounds.len() > 0 { @@ -1545,7 +1545,7 @@ pub struct Generics { } impl Clean for hir::Generics { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Generics { + fn clean(&self, cx: &DocContext<'_>) -> Generics { // Synthetic type-parameters are inserted after normal ones. // In order for normal parameters to be able to refer to synthetic ones, // scans them first. @@ -1615,7 +1615,7 @@ impl Clean for hir::Generics { impl<'a, 'tcx> Clean for (&'a ty::Generics, &'a Lrc>) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Generics { + fn clean(&self, cx: &DocContext<'_>) -> Generics { use self::WherePredicate as WP; let (gens, preds) = *self; @@ -1702,7 +1702,7 @@ pub struct Method { } impl<'a> Clean for (&'a hir::MethodSig, &'a hir::Generics, hir::BodyId) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Method { + fn clean(&self, cx: &DocContext<'_>) -> Method { let (generics, decl) = enter_impl_trait(cx, || { (self.1.clean(cx), (&*self.0.decl, self.2).clean(cx)) }); @@ -1729,7 +1729,7 @@ pub struct Function { } impl Clean for doctree::Function { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let (generics, decl) = enter_impl_trait(cx, || { (self.generics.clean(cx), (&self.decl, self.body).clean(cx)) }); @@ -1800,7 +1800,7 @@ pub struct Arguments { } impl<'a> Clean for (&'a [hir::Ty], &'a [ast::Ident]) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Arguments { + fn clean(&self, cx: &DocContext<'_>) -> Arguments { Arguments { values: self.0.iter().enumerate().map(|(i, ty)| { let mut name = self.1.get(i).map(|ident| ident.to_string()) @@ -1818,7 +1818,7 @@ impl<'a> Clean for (&'a [hir::Ty], &'a [ast::Ident]) { } impl<'a> Clean for (&'a [hir::Ty], hir::BodyId) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Arguments { + fn clean(&self, cx: &DocContext<'_>) -> Arguments { let body = cx.tcx.hir().body(self.1); Arguments { @@ -1835,7 +1835,7 @@ impl<'a> Clean for (&'a [hir::Ty], hir::BodyId) { impl<'a, A: Copy> Clean for (&'a hir::FnDecl, A) where (&'a [hir::Ty], A): Clean { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> FnDecl { + fn clean(&self, cx: &DocContext<'_>) -> FnDecl { FnDecl { inputs: (&self.0.inputs[..], self.1).clean(cx), output: self.0.output.clean(cx), @@ -1845,7 +1845,7 @@ impl<'a, A: Copy> Clean for (&'a hir::FnDecl, A) } impl<'a, 'tcx> Clean for (DefId, ty::PolyFnSig<'tcx>) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> FnDecl { + fn clean(&self, cx: &DocContext<'_>) -> FnDecl { let (did, sig) = *self; let mut names = if cx.tcx.hir().as_local_hir_id(did).is_some() { vec![].into_iter() @@ -1905,7 +1905,7 @@ pub enum FunctionRetTy { } impl Clean for hir::FunctionRetTy { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> FunctionRetTy { + fn clean(&self, cx: &DocContext<'_>) -> FunctionRetTy { match *self { hir::Return(ref typ) => Return(typ.clean(cx)), hir::DefaultReturn(..) => DefaultReturn, @@ -1934,7 +1934,7 @@ pub struct Trait { } impl Clean for doctree::Trait { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let attrs = self.attrs.clean(cx); let is_spotlight = attrs.has_doc_flag("spotlight"); Item { @@ -1965,7 +1965,7 @@ pub struct TraitAlias { } impl Clean for doctree::TraitAlias { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let attrs = self.attrs.clean(cx); Item { name: Some(self.name.clean(cx)), @@ -1984,7 +1984,7 @@ impl Clean for doctree::TraitAlias { } impl Clean for hir::IsAuto { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> bool { + fn clean(&self, _: &DocContext<'_>) -> bool { match *self { hir::IsAuto::Yes => true, hir::IsAuto::No => false, @@ -1993,13 +1993,13 @@ impl Clean for hir::IsAuto { } impl Clean for hir::TraitRef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type { + fn clean(&self, cx: &DocContext<'_>) -> Type { resolve_type(cx, self.path.clean(cx), self.hir_ref_id) } } impl Clean for hir::PolyTraitRef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> PolyTrait { + fn clean(&self, cx: &DocContext<'_>) -> PolyTrait { PolyTrait { trait_: self.trait_ref.clean(cx), generic_params: self.bound_generic_params.clean(cx) @@ -2008,7 +2008,7 @@ impl Clean for hir::PolyTraitRef { } impl Clean for hir::TraitItem { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let inner = match self.node { hir::TraitItemKind::Const(ref ty, default) => { AssociatedConstItem(ty.clean(cx), @@ -2046,7 +2046,7 @@ impl Clean for hir::TraitItem { } impl Clean for hir::ImplItem { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let inner = match self.node { hir::ImplItemKind::Const(ref ty, expr) => { AssociatedConstItem(ty.clean(cx), @@ -2079,7 +2079,7 @@ impl Clean for hir::ImplItem { } impl<'tcx> Clean for ty::AssociatedItem { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let inner = match self.kind { ty::AssociatedKind::Const => { let ty = cx.tcx.type_of(self.def_id); @@ -2524,7 +2524,7 @@ impl From for PrimitiveType { } impl Clean for hir::Ty { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type { + fn clean(&self, cx: &DocContext<'_>) -> Type { use rustc::hir::*; match self.node { @@ -2726,7 +2726,7 @@ impl Clean for hir::Ty { } impl<'tcx> Clean for Ty<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type { + fn clean(&self, cx: &DocContext<'_>) -> Type { match self.sty { ty::Never => Never, ty::Bool => Primitive(PrimitiveType::Bool), @@ -2921,7 +2921,7 @@ impl<'tcx> Clean for Ty<'tcx> { } impl Clean for hir::StructField { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id); Item { @@ -2938,7 +2938,7 @@ impl Clean for hir::StructField { } impl<'tcx> Clean for ty::FieldDef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.ident.name).clean(cx), attrs: cx.tcx.get_attrs(self.did).clean(cx), @@ -2961,7 +2961,7 @@ pub enum Visibility { } impl Clean> for hir::Visibility { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, cx: &DocContext<'_>) -> Option { Some(match self.node { hir::VisibilityKind::Public => Visibility::Public, hir::VisibilityKind::Inherited => Visibility::Inherited, @@ -2976,7 +2976,7 @@ impl Clean> for hir::Visibility { } impl Clean> for ty::Visibility { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, _: &DocContext<'_>) -> Option { Some(if *self == ty::Visibility::Public { Public } else { Inherited }) } } @@ -2998,7 +2998,7 @@ pub struct Union { } impl Clean for doctree::Struct { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3018,7 +3018,7 @@ impl Clean for doctree::Struct { } impl Clean for doctree::Union { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3048,7 +3048,7 @@ pub struct VariantStruct { } impl Clean for ::rustc::hir::VariantData { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> VariantStruct { + fn clean(&self, cx: &DocContext<'_>) -> VariantStruct { VariantStruct { struct_type: doctree::struct_type_from_def(self), fields: self.fields().iter().map(|x| x.clean(cx)).collect(), @@ -3065,7 +3065,7 @@ pub struct Enum { } impl Clean for doctree::Enum { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3089,7 +3089,7 @@ pub struct Variant { } impl Clean for doctree::Variant { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3106,7 +3106,7 @@ impl Clean for doctree::Variant { } impl<'tcx> Clean for ty::VariantDef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let kind = match self.ctor_kind { CtorKind::Const => VariantKind::CLike, CtorKind::Fn => { @@ -3154,7 +3154,7 @@ pub enum VariantKind { } impl Clean for hir::VariantData { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> VariantKind { + fn clean(&self, cx: &DocContext<'_>) -> VariantKind { if self.is_struct() { VariantKind::Struct(self.clean(cx)) } else if self.is_unit() { @@ -3185,7 +3185,7 @@ impl Span { } impl Clean for syntax_pos::Span { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Span { + fn clean(&self, cx: &DocContext<'_>) -> Span { if self.is_dummy() { return Span::empty(); } @@ -3218,7 +3218,7 @@ impl Path { } impl Clean for hir::Path { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Path { + fn clean(&self, cx: &DocContext<'_>) -> Path { Path { global: self.is_global(), def: self.def, @@ -3241,7 +3241,7 @@ pub enum GenericArgs { } impl Clean for hir::GenericArgs { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericArgs { + fn clean(&self, cx: &DocContext<'_>) -> GenericArgs { if self.parenthesized { let output = self.bindings[0].ty.clean(cx); GenericArgs::Parenthesized { @@ -3283,7 +3283,7 @@ pub struct PathSegment { } impl Clean for hir::PathSegment { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> PathSegment { + fn clean(&self, cx: &DocContext<'_>) -> PathSegment { PathSegment { name: self.ident.name.clean(cx), args: self.with_generic_args(|generic_args| generic_args.clean(cx)) @@ -3355,21 +3355,21 @@ fn qpath_to_string(p: &hir::QPath) -> String { impl Clean for Ident { #[inline] - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> String { + fn clean(&self, cx: &DocContext<'_>) -> String { self.name.clean(cx) } } impl Clean for ast::Name { #[inline] - fn clean(&self, _: &DocContext<'_, '_, '_>) -> String { + fn clean(&self, _: &DocContext<'_>) -> String { self.to_string() } } impl Clean for InternedString { #[inline] - fn clean(&self, _: &DocContext<'_, '_, '_>) -> String { + fn clean(&self, _: &DocContext<'_>) -> String { self.to_string() } } @@ -3381,7 +3381,7 @@ pub struct Typedef { } impl Clean for doctree::Typedef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3405,7 +3405,7 @@ pub struct Existential { } impl Clean for doctree::Existential { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3431,7 +3431,7 @@ pub struct BareFunctionDecl { } impl Clean for hir::BareFnTy { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> BareFunctionDecl { + fn clean(&self, cx: &DocContext<'_>) -> BareFunctionDecl { let (generic_params, decl) = enter_impl_trait(cx, || { (self.generic_params.clean(cx), (&*self.decl, &self.arg_names[..]).clean(cx)) }); @@ -3455,7 +3455,7 @@ pub struct Static { } impl Clean for doctree::Static { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { debug!("cleaning static {}: {:?}", self.name.clean(cx), self); Item { name: Some(self.name.clean(cx)), @@ -3481,7 +3481,7 @@ pub struct Constant { } impl Clean for doctree::Constant { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3505,7 +3505,7 @@ pub enum Mutability { } impl Clean for hir::Mutability { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Mutability { + fn clean(&self, _: &DocContext<'_>) -> Mutability { match self { &hir::MutMutable => Mutable, &hir::MutImmutable => Immutable, @@ -3520,7 +3520,7 @@ pub enum ImplPolarity { } impl Clean for hir::ImplPolarity { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> ImplPolarity { + fn clean(&self, _: &DocContext<'_>) -> ImplPolarity { match self { &hir::ImplPolarity::Positive => ImplPolarity::Positive, &hir::ImplPolarity::Negative => ImplPolarity::Negative, @@ -3542,7 +3542,7 @@ pub struct Impl { } pub fn get_auto_traits_with_hir_id( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, id: hir::HirId, name: String ) -> Vec { @@ -3551,7 +3551,7 @@ pub fn get_auto_traits_with_hir_id( } pub fn get_auto_traits_with_def_id( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, id: DefId ) -> Vec { let finder = AutoTraitFinder::new(cx); @@ -3560,7 +3560,7 @@ pub fn get_auto_traits_with_def_id( } pub fn get_blanket_impls_with_hir_id( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, id: hir::HirId, name: String ) -> Vec { @@ -3569,7 +3569,7 @@ pub fn get_blanket_impls_with_hir_id( } pub fn get_blanket_impls_with_def_id( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, id: DefId ) -> Vec { let finder = BlanketImplFinder::new(cx); @@ -3578,7 +3578,7 @@ pub fn get_blanket_impls_with_def_id( } impl Clean> for doctree::Impl { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec { + fn clean(&self, cx: &DocContext<'_>) -> Vec { let mut ret = Vec::new(); let trait_ = self.trait_.clean(cx); let items = self.items.clean(cx); @@ -3620,7 +3620,7 @@ impl Clean> for doctree::Impl { } } -fn build_deref_target_impls(cx: &DocContext<'_, '_, '_>, +fn build_deref_target_impls(cx: &DocContext<'_>, items: &[Item], ret: &mut Vec) { use self::PrimitiveType::*; @@ -3679,7 +3679,7 @@ fn build_deref_target_impls(cx: &DocContext<'_, '_, '_>, } impl Clean> for doctree::ExternCrate { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec { + fn clean(&self, cx: &DocContext<'_>) -> Vec { let please_inline = self.vis.node.is_pub() && self.attrs.iter().any(|a| { a.name() == "doc" && match a.meta_item_list() { @@ -3715,7 +3715,7 @@ impl Clean> for doctree::ExternCrate { } impl Clean> for doctree::Import { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec { + fn clean(&self, cx: &DocContext<'_>) -> Vec { // We consider inlining the documentation of `pub use` statements, but we // forcefully don't inline if this is not public or if the // #[doc(no_inline)] attribute is present. @@ -3789,7 +3789,7 @@ pub struct ImportSource { } impl Clean> for hir::ForeignMod { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec { + fn clean(&self, cx: &DocContext<'_>) -> Vec { let mut items = self.items.clean(cx); for item in &mut items { if let ForeignFunctionItem(ref mut f) = item.inner { @@ -3801,7 +3801,7 @@ impl Clean> for hir::ForeignMod { } impl Clean for hir::ForeignItem { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let inner = match self.node { hir::ForeignItemKind::Fn(ref decl, ref names, ref generics) => { let (generics, decl) = enter_impl_trait(cx, || { @@ -3848,11 +3848,11 @@ impl Clean for hir::ForeignItem { // Utilities pub trait ToSource { - fn to_src(&self, cx: &DocContext<'_, '_, '_>) -> String; + fn to_src(&self, cx: &DocContext<'_>) -> String; } impl ToSource for syntax_pos::Span { - fn to_src(&self, cx: &DocContext<'_, '_, '_>) -> String { + fn to_src(&self, cx: &DocContext<'_>) -> String { debug!("converting span {:?} to snippet", self.clean(cx)); let sn = match cx.sess().source_map().span_to_snippet(*self) { Ok(x) => x, @@ -3899,7 +3899,7 @@ fn name_from_pat(p: &hir::Pat) -> String { } } -fn print_const(cx: &DocContext<'_, '_, '_>, n: ty::LazyConst<'_>) -> String { +fn print_const(cx: &DocContext<'_>, n: ty::LazyConst<'_>) -> String { match n { ty::LazyConst::Unevaluated(def_id, _) => { if let Some(hir_id) = cx.tcx.hir().as_local_hir_id(def_id) { @@ -3921,12 +3921,12 @@ fn print_const(cx: &DocContext<'_, '_, '_>, n: ty::LazyConst<'_>) -> String { } } -fn print_const_expr(cx: &DocContext<'_, '_, '_>, body: hir::BodyId) -> String { +fn print_const_expr(cx: &DocContext<'_>, body: hir::BodyId) -> String { cx.tcx.hir().hir_to_pretty_string(body.hir_id) } /// Given a type Path, resolve it to a Type using the TyCtxt -fn resolve_type(cx: &DocContext<'_, '_, '_>, +fn resolve_type(cx: &DocContext<'_>, path: Path, id: hir::HirId) -> Type { if id == hir::DUMMY_HIR_ID { @@ -3957,7 +3957,7 @@ fn resolve_type(cx: &DocContext<'_, '_, '_>, ResolvedPath { path: path, typarams: None, did: did, is_generic: is_generic } } -pub fn register_def(cx: &DocContext<'_, '_, '_>, def: Def) -> DefId { +pub fn register_def(cx: &DocContext<'_>, def: Def) -> DefId { debug!("register_def({:?})", def); let (did, kind) = match def { @@ -3992,7 +3992,7 @@ pub fn register_def(cx: &DocContext<'_, '_, '_>, def: Def) -> DefId { did } -fn resolve_use_source(cx: &DocContext<'_, '_, '_>, path: Path) -> ImportSource { +fn resolve_use_source(cx: &DocContext<'_>, path: Path) -> ImportSource { ImportSource { did: if path.def.opt_def_id().is_none() { None @@ -4010,7 +4010,7 @@ pub struct Macro { } impl Clean for doctree::Macro { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let name = self.name.clean(cx); Item { name: Some(name.clone()), @@ -4039,7 +4039,7 @@ pub struct ProcMacro { } impl Clean for doctree::ProcMacro { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -4073,7 +4073,7 @@ pub struct Deprecation { } impl Clean for attr::Stability { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Stability { + fn clean(&self, _: &DocContext<'_>) -> Stability { Stability { level: stability::StabilityLevel::from_attr_level(&self.level), feature: Some(self.feature.to_string()).filter(|f| !f.is_empty()), @@ -4100,13 +4100,13 @@ impl Clean for attr::Stability { } impl<'a> Clean for &'a attr::Stability { - fn clean(&self, dc: &DocContext<'_, '_, '_>) -> Stability { + fn clean(&self, dc: &DocContext<'_>) -> Stability { (**self).clean(dc) } } impl Clean for attr::Deprecation { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Deprecation { + fn clean(&self, _: &DocContext<'_>) -> Deprecation { Deprecation { since: self.since.map(|s| s.to_string()).filter(|s| !s.is_empty()), note: self.note.map(|n| n.to_string()).filter(|n| !n.is_empty()), @@ -4122,7 +4122,7 @@ pub struct TypeBinding { } impl Clean for hir::TypeBinding { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> TypeBinding { + fn clean(&self, cx: &DocContext<'_>) -> TypeBinding { TypeBinding { name: self.ident.name.clean(cx), ty: self.ty.clean(cx) @@ -4131,7 +4131,7 @@ impl Clean for hir::TypeBinding { } pub fn def_id_to_path( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, did: DefId, name: Option ) -> Vec { @@ -4148,7 +4148,7 @@ pub fn def_id_to_path( once(crate_name).chain(relative).collect() } -pub fn enter_impl_trait(cx: &DocContext<'_, '_, '_>, f: F) -> R +pub fn enter_impl_trait(cx: &DocContext<'_>, f: F) -> R where F: FnOnce() -> R, { diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs index 8614b72dffba..8ca570cb443c 100644 --- a/src/librustdoc/clean/simplify.rs +++ b/src/librustdoc/clean/simplify.rs @@ -22,7 +22,7 @@ use crate::clean::WherePredicate as WP; use crate::clean; use crate::core::DocContext; -pub fn where_clauses(cx: &DocContext<'_, '_, '_>, clauses: Vec) -> Vec { +pub fn where_clauses(cx: &DocContext<'_>, clauses: Vec) -> Vec { // First, partition the where clause into its separate components let mut params: BTreeMap<_, Vec<_>> = BTreeMap::new(); let mut lifetimes = Vec::new(); @@ -141,7 +141,7 @@ fn ty_bounds(bounds: Vec) -> Vec { bounds } -fn trait_is_same_or_supertrait(cx: &DocContext<'_, '_, '_>, child: DefId, +fn trait_is_same_or_supertrait(cx: &DocContext<'_>, child: DefId, trait_: DefId) -> bool { if child == trait_ { return true diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index aeff78350d37..f2682e00430d 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -203,7 +203,7 @@ pub struct RenderOptions { impl Options { /// Parses the given command-line for options. If an error message or other early-return has /// been printed, returns `Err` with the exit code. - pub fn from_matches(matches: &getopts::Matches) -> Result { + pub fn from_matches(matches: &getopts::Matches) -> Result { // Check for unstable options. nightly_options::check_nightly_options(&matches, &opts()); diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 373856319f1f..47dbbc20980b 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -1,19 +1,18 @@ use rustc_lint; -use rustc_driver::{driver, abort_on_err}; use rustc::session::{self, config}; use rustc::hir::def_id::{DefId, DefIndex, DefIndexAddressSpace, CrateNum, LOCAL_CRATE}; use rustc::hir::def::Def; use rustc::hir::{self, HirId, HirVec}; use rustc::middle::cstore::CrateStore; use rustc::middle::privacy::AccessLevels; -use rustc::ty::{self, TyCtxt, AllArenas}; -use rustc::hir::map as hir_map; +use rustc::ty::{self, TyCtxt}; use rustc::lint::{self, LintPass}; use rustc::session::config::ErrorOutputType; +use rustc::session::DiagnosticOutput; use rustc::util::nodemap::{FxHashMap, FxHashSet}; -use rustc_interface::util; +use rustc_interface::interface; +use rustc_driver::abort_on_err; use rustc_resolve as resolve; -use rustc_metadata::creader::CrateLoader; use rustc_metadata::cstore::CStore; use rustc_target::spec::TargetTriple; @@ -24,15 +23,15 @@ use syntax::json::JsonEmitter; use syntax::ptr::P; use syntax::symbol::keywords; use syntax_pos::DUMMY_SP; -use errors::{self, FatalError}; +use errors; use errors::emitter::{Emitter, EmitterWriter}; use parking_lot::ReentrantMutex; use std::cell::RefCell; use std::mem; use rustc_data_structures::sync::{self, Lrc}; -use std::rc::Rc; use std::sync::Arc; +use std::rc::Rc; use crate::visit_ast::RustdocVisitor; use crate::config::{Options as RustdocOptions, RenderOptions}; @@ -47,12 +46,13 @@ pub use rustc::session::search_paths::SearchPath; pub type ExternalPaths = FxHashMap, clean::TypeKind)>; -pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a> { - pub tcx: TyCtxt<'a, 'tcx, 'tcx>, - pub resolver: &'a RefCell>, +pub struct DocContext<'tcx> { + + pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub resolver: Rc>>, /// The stack of module NodeIds up till this point pub crate_name: Option, - pub cstore: Rc, + pub cstore: Lrc, /// Later on moved into `html::render::CACHE_KEY` pub renderinfo: RefCell, /// Later on moved through `clean::Crate` into `html::render::CACHE_KEY` @@ -79,11 +79,18 @@ pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a> { pub all_traits: Vec, } -impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { +impl<'tcx> DocContext<'tcx> { pub fn sess(&self) -> &session::Session { &self.tcx.sess } + pub fn enter_resolver(&self, f: F) -> R + where F: FnOnce(&mut resolve::Resolver<'_>) -> R { + let resolver = &*self.resolver; + let resolver = resolver.as_ref().unwrap(); + resolver.borrow_mut().access(f) + } + /// Call the closure with the given parameters set as /// the substitutions for a type alias' RHS. pub fn enter_alias(&self, @@ -368,19 +375,31 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt whitelisted_lints.extend(lint_opts.iter().map(|(lint, _)| lint).cloned()); - let lints = lint::builtin::HardwiredLints.get_lints() - .into_iter() - .chain(rustc_lint::SoftLints.get_lints().into_iter()) - .filter_map(|lint| { - if lint.name == warnings_lint_name || - lint.name == intra_link_resolution_failure_name { - None - } else { - Some((lint.name_lower(), lint::Allow)) - } - }) - .chain(lint_opts.into_iter()) - .collect::>(); + let lints = || { + lint::builtin::HardwiredLints + .get_lints() + .into_iter() + .chain(rustc_lint::SoftLints.get_lints().into_iter()) + }; + + let lint_opts = lints().filter_map(|lint| { + if lint.name == warnings_lint_name || + lint.name == intra_link_resolution_failure_name { + None + } else { + Some((lint.name_lower(), lint::Allow)) + } + }).chain(lint_opts.into_iter()).collect::>(); + + let lint_caps = lints().filter_map(|lint| { + // We don't want to whitelist *all* lints so let's + // ignore those ones. + if whitelisted_lints.iter().any(|l| &lint.name == l) { + None + } else { + Some((lint::LintId::of(lint), lint::Allow)) + } + }).collect(); let host_triple = TargetTriple::from_triple(config::host_triple()); // plays with error output here! @@ -389,7 +408,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt search_paths: libs, crate_types: vec![config::CrateType::Rlib], lint_opts: if !display_warnings { - lints + lint_opts } else { vec![] }, @@ -406,116 +425,42 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt describe_lints, ..Options::default() }; - driver::spawn_thread_pool(sessopts, move |sessopts| { - let source_map = Lrc::new(source_map::SourceMap::new(sessopts.file_path_mapping())); - let diagnostic_handler = new_handler(error_format, - Some(source_map.clone()), - debugging_options.treat_err_as_bug, - debugging_options.ui_testing); - let mut sess = session::build_session_( - sessopts, cpath, diagnostic_handler, source_map, Default::default(), - ); + let config = interface::Config { + opts: sessopts, + crate_cfg: config::parse_cfgspecs(cfgs), + input, + input_path: cpath, + output_file: None, + output_dir: None, + file_loader: None, + diagnostic_output: DiagnosticOutput::Default, + stderr: None, + crate_name: crate_name.clone(), + lint_caps, + }; - lint::builtin::HardwiredLints.get_lints() - .into_iter() - .chain(rustc_lint::SoftLints.get_lints().into_iter()) - .filter_map(|lint| { - // We don't want to whitelist *all* lints so let's - // ignore those ones. - if whitelisted_lints.iter().any(|l| &lint.name == l) { - None - } else { - Some(lint) - } - }) - .for_each(|l| { - sess.driver_lint_caps.insert(lint::LintId::of(l), - lint::Allow); - }); + interface::run_compiler_in_existing_thread_pool(config, |compiler| { + let sess = compiler.session(); - let codegen_backend = util::get_codegen_backend(&sess); - let cstore = Rc::new(CStore::new(codegen_backend.metadata_loader())); - rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); - - let mut cfg = config::build_configuration(&sess, config::parse_cfgspecs(cfgs)); - util::add_configuration(&mut cfg, &sess, &*codegen_backend); - sess.parse_sess.config = cfg; - - let control = &driver::CompileController::basic(); - - let krate = match driver::phase_1_parse_input(control, &sess, &input) { - Ok(krate) => krate, - Err(mut e) => { - e.emit(); - FatalError.raise(); - } - }; - - let name = match crate_name { - Some(ref crate_name) => crate_name.clone(), - None => ::rustc_codegen_utils::link::find_crate_name(Some(&sess), &krate.attrs, &input), - }; - - let mut crate_loader = CrateLoader::new(&sess, &cstore, &name); - - let resolver_arenas = resolve::Resolver::arenas(); - let result = driver::phase_2_configure_and_expand_inner(&sess, - &cstore, - krate, - None, - &name, - None, - &resolver_arenas, - &mut crate_loader, - |_| Ok(())); - let driver::InnerExpansionResult { - mut hir_forest, - resolver, - .. - } = abort_on_err(result, &sess); - - // We need to hold on to the complete resolver, so we clone everything - // for the analysis passes to use. Suboptimal, but necessary in the + // We need to hold on to the complete resolver, so we cause everything to be + // cloned for the analysis passes to use. Suboptimal, but necessary in the // current architecture. - let defs = resolver.definitions.clone(); - let resolutions = ty::Resolutions { - freevars: resolver.freevars.clone(), - export_map: resolver.export_map.clone(), - trait_map: resolver.trait_map.clone(), - glob_map: resolver.glob_map.clone(), - maybe_unused_trait_imports: resolver.maybe_unused_trait_imports.clone(), - maybe_unused_extern_crates: resolver.maybe_unused_extern_crates.clone(), - extern_prelude: resolver.extern_prelude.iter().map(|(ident, entry)| { - (ident.name, entry.introduced_by_item) - }).collect(), - }; + let resolver = abort_on_err(compiler.expansion(), sess).peek().1.clone(); - let mut arenas = AllArenas::new(); - let hir_map = hir_map::map_crate(&sess, &*cstore, &mut hir_forest, &defs); - let output_filenames = util::build_output_filenames(&input, - &None, - &None, - &[], - &sess); + if sess.err_count() > 0 { + sess.fatal("Compilation failed, aborting rustdoc"); + } - let resolver = RefCell::new(resolver); - driver::phase_3_run_analysis_passes(&*codegen_backend, - control, - &sess, - &*cstore, - hir_map, - resolutions, - &mut arenas, - &name, - &output_filenames, - |tcx, _, result| { - if result.is_err() { - sess.fatal("Compilation failed, aborting rustdoc"); - } + let mut global_ctxt = abort_on_err(compiler.global_ctxt(), sess).take(); + + global_ctxt.enter(|tcx| { + tcx.analysis(LOCAL_CRATE).ok(); + + // Abort if there were any errors so far + sess.abort_if_errors(); let access_levels = tcx.privacy_access_levels(LOCAL_CRATE); - // Convert from a NodeId set to a DefId set since we don't always have easy access // to the map from defid -> nodeid let access_levels = AccessLevels { @@ -535,9 +480,9 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt let ctxt = DocContext { tcx, - resolver: &resolver, + resolver, crate_name, - cstore: cstore.clone(), + cstore: compiler.cstore().clone(), external_traits: Default::default(), active_extern_traits: Default::default(), renderinfo: RefCell::new(renderinfo), diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 2a0ef3222ab8..f11e268b9092 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -23,14 +23,13 @@ extern crate getopts; extern crate env_logger; extern crate rustc; extern crate rustc_data_structures; -extern crate rustc_codegen_utils; extern crate rustc_driver; extern crate rustc_resolve; extern crate rustc_lint; +extern crate rustc_interface; extern crate rustc_metadata; extern crate rustc_target; extern crate rustc_typeck; -extern crate rustc_interface; extern crate serialize; extern crate syntax; extern crate syntax_pos; @@ -91,11 +90,11 @@ pub fn main() { rustc_driver::set_sigpipe_handler(); env_logger::init(); let res = std::thread::Builder::new().stack_size(thread_stack_size).spawn(move || { - syntax::with_globals(move || { + rustc_interface::interface::default_thread_pool(move || { get_args().map(|args| main_args(&args)).unwrap_or(1) }) }).unwrap().join().unwrap_or(rustc_driver::EXIT_FAILURE); - process::exit(res as i32); + process::exit(res); } fn get_args() -> Option> { @@ -364,7 +363,7 @@ fn usage(argv0: &str) { println!("{}", options.usage(&format!("{} [options] ", argv0))); } -fn main_args(args: &[String]) -> isize { +fn main_args(args: &[String]) -> i32 { let mut options = getopts::Options::new(); for option in opts() { (option.apply)(&mut options); @@ -441,7 +440,7 @@ where R: 'static + Send, let (tx, rx) = channel(); - let result = rustc_driver::monitor(move || syntax::with_globals(move || { + let result = rustc_driver::report_ices_to_stderr_if_any(move || syntax::with_globals(move || { let crate_name = options.crate_name.clone(); let crate_version = options.crate_version.clone(); let (mut krate, renderinfo, renderopts, passes) = core::run_core(options); diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs index 0014d9ceb5ba..a2e2303bb27f 100644 --- a/src/librustdoc/markdown.rs +++ b/src/librustdoc/markdown.rs @@ -36,7 +36,7 @@ fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) { /// Render `input` (e.g., "foo.md") into an HTML file in `output` /// (e.g., output = "bar" => "bar/foo.html"). -pub fn render(input: PathBuf, options: RenderOptions, diag: &errors::Handler) -> isize { +pub fn render(input: PathBuf, options: RenderOptions, diag: &errors::Handler) -> i32 { let mut output = options.output; output.push(input.file_stem().unwrap()); output.set_extension("html"); @@ -126,7 +126,7 @@ pub fn render(input: PathBuf, options: RenderOptions, diag: &errors::Handler) -> } /// Runs any tests/code examples in the markdown file `input`. -pub fn test(mut options: Options, diag: &errors::Handler) -> isize { +pub fn test(mut options: Options, diag: &errors::Handler) -> i32 { let input_str = match load_string(&options.input, diag) { Ok(s) => s, Err(LoadStringError::ReadFail) => return 1, diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs index 04f403888c1f..fe407fa24d93 100644 --- a/src/librustdoc/passes/calculate_doc_coverage.rs +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -15,7 +15,7 @@ pub const CALCULATE_DOC_COVERAGE: Pass = Pass { description: "counts the number of items with and without documentation", }; -fn calculate_doc_coverage(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { +fn calculate_doc_coverage(krate: clean::Crate, _: &DocContext<'_>) -> clean::Crate { let mut calc = CoverageCalculator::default(); let krate = calc.fold_crate(krate); diff --git a/src/librustdoc/passes/check_code_block_syntax.rs b/src/librustdoc/passes/check_code_block_syntax.rs index 88d9c87c5289..0556852c54ac 100644 --- a/src/librustdoc/passes/check_code_block_syntax.rs +++ b/src/librustdoc/passes/check_code_block_syntax.rs @@ -16,15 +16,15 @@ pub const CHECK_CODE_BLOCK_SYNTAX: Pass = Pass { description: "validates syntax inside Rust code blocks", }; -pub fn check_code_block_syntax(krate: clean::Crate, cx: &DocContext<'_, '_, '_>) -> clean::Crate { +pub fn check_code_block_syntax(krate: clean::Crate, cx: &DocContext<'_>) -> clean::Crate { SyntaxChecker { cx }.fold_crate(krate) } -struct SyntaxChecker<'a, 'tcx: 'a, 'rcx: 'a> { - cx: &'a DocContext<'a, 'tcx, 'rcx>, +struct SyntaxChecker<'a, 'tcx: 'a> { + cx: &'a DocContext<'tcx>, } -impl<'a, 'tcx, 'rcx> SyntaxChecker<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> SyntaxChecker<'a, 'tcx> { fn check_rust_syntax(&self, item: &clean::Item, dox: &str, code_block: RustCodeBlock) { let sess = ParseSess::new(FilePathMapping::empty()); let source_file = sess.source_map().new_source_file( @@ -98,7 +98,7 @@ impl<'a, 'tcx, 'rcx> SyntaxChecker<'a, 'tcx, 'rcx> { } } -impl<'a, 'tcx, 'rcx> DocFolder for SyntaxChecker<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> DocFolder for SyntaxChecker<'a, 'tcx> { fn fold_item(&mut self, item: clean::Item) -> Option { if let Some(dox) = &item.attrs.collapsed_doc_value() { for code_block in markdown::rust_code_blocks(&dox) { diff --git a/src/librustdoc/passes/collapse_docs.rs b/src/librustdoc/passes/collapse_docs.rs index 088a6ea77c73..8666ba357b83 100644 --- a/src/librustdoc/passes/collapse_docs.rs +++ b/src/librustdoc/passes/collapse_docs.rs @@ -29,7 +29,7 @@ impl DocFragment { } } -pub fn collapse_docs(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { +pub fn collapse_docs(krate: clean::Crate, _: &DocContext<'_>) -> clean::Crate { Collapser.fold_crate(krate) } diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index c346714ab485..fefff1f3a759 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -25,7 +25,7 @@ pub const COLLECT_INTRA_DOC_LINKS: Pass = Pass { description: "reads a crate's documentation to resolve intra-doc-links", }; -pub fn collect_intra_doc_links(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate { +pub fn collect_intra_doc_links(krate: Crate, cx: &DocContext<'_>) -> Crate { if !UnstableFeatures::from_environment().is_nightly_build() { krate } else { @@ -47,14 +47,14 @@ enum PathKind { Type, } -struct LinkCollector<'a, 'tcx: 'a, 'rcx: 'a> { - cx: &'a DocContext<'a, 'tcx, 'rcx>, +struct LinkCollector<'a, 'tcx> { + cx: &'a DocContext<'tcx>, mod_ids: Vec, is_nightly_build: bool, } -impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> { - fn new(cx: &'a DocContext<'a, 'tcx, 'rcx>) -> Self { +impl<'a, 'tcx> LinkCollector<'a, 'tcx> { + fn new(cx: &'a DocContext<'tcx>) -> Self { LinkCollector { cx, mod_ids: Vec::new(), @@ -78,12 +78,11 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> { // path. if let Some(id) = parent_id.or(self.mod_ids.last().cloned()) { // FIXME: `with_scope` requires the `NodeId` of a module. - let result = cx.resolver.borrow_mut() - .with_scope(id, + let result = cx.enter_resolver(|resolver| resolver.with_scope(id, |resolver| { resolver.resolve_str_path_error(DUMMY_SP, &path_str, is_val) - }); + })); if let Ok(result) = result { // In case this is a trait item, skip the @@ -142,11 +141,9 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> { } // FIXME: `with_scope` requires the `NodeId` of a module. - let ty = cx.resolver.borrow_mut() - .with_scope(id, - |resolver| { + let ty = cx.enter_resolver(|resolver| resolver.with_scope(id, |resolver| { resolver.resolve_str_path_error(DUMMY_SP, &path, false) - })?; + }))?; match ty.def { Def::Struct(did) | Def::Union(did) | Def::Enum(did) | Def::TyAlias(did) => { let item = cx.tcx.inherent_impls(did) @@ -218,7 +215,7 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> { } } -impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> { fn fold_item(&mut self, mut item: Item) -> Option { let item_hir_id = if item.is_mod() { if let Some(id) = self.cx.tcx.hir().as_local_hir_id(item.def_id) { @@ -437,26 +434,27 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> { } /// Resolves a string as a macro. -fn macro_resolve(cx: &DocContext<'_, '_, '_>, path_str: &str) -> Option { +fn macro_resolve(cx: &DocContext<'_>, path_str: &str) -> Option { use syntax::ext::base::{MacroKind, SyntaxExtension}; let segment = ast::PathSegment::from_ident(Ident::from_str(path_str)); let path = ast::Path { segments: vec![segment], span: DUMMY_SP }; - let mut resolver = cx.resolver.borrow_mut(); - let parent_scope = resolver.dummy_parent_scope(); - if let Ok(def) = resolver.resolve_macro_to_def_inner(&path, MacroKind::Bang, - &parent_scope, false, false) { - if let Def::Macro(_, MacroKind::ProcMacroStub) = def { - // skip proc-macro stubs, they'll cause `get_macro` to crash - } else { - if let SyntaxExtension::DeclMacro { .. } = *resolver.get_macro(def) { - return Some(def); + cx.enter_resolver(|resolver| { + let parent_scope = resolver.dummy_parent_scope(); + if let Ok(def) = resolver.resolve_macro_to_def_inner(&path, MacroKind::Bang, + &parent_scope, false, false) { + if let Def::Macro(_, MacroKind::ProcMacroStub) = def { + // skip proc-macro stubs, they'll cause `get_macro` to crash + } else { + if let SyntaxExtension::DeclMacro { .. } = *resolver.get_macro(def) { + return Some(def); + } } } - } - if let Some(def) = resolver.all_macros.get(&Symbol::intern(path_str)) { - return Some(*def); - } - None + if let Some(def) = resolver.all_macros.get(&Symbol::intern(path_str)) { + return Some(*def); + } + None + }) } /// Reports a resolution failure diagnostic. @@ -465,7 +463,7 @@ fn macro_resolve(cx: &DocContext<'_, '_, '_>, path_str: &str) -> Option { /// documentation attributes themselves. This is a little heavy-handed, so we display the markdown /// line containing the failure as a note as well. fn resolution_failure( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, attrs: &Attributes, path_str: &str, dox: &str, @@ -507,7 +505,7 @@ fn resolution_failure( diag.emit(); } -fn ambiguity_error(cx: &DocContext<'_, '_, '_>, attrs: &Attributes, +fn ambiguity_error(cx: &DocContext<'_>, attrs: &Attributes, path_str: &str, article1: &str, kind1: &str, disambig1: &str, article2: &str, kind2: &str, disambig2: &str) { @@ -563,7 +561,7 @@ fn type_ns_kind(def: Def, path_str: &str) -> (&'static str, &'static str, String } /// Given an enum variant's def, return the def of its enum and the associated fragment. -fn handle_variant(cx: &DocContext<'_, '_, '_>, def: Def) -> Result<(Def, Option), ()> { +fn handle_variant(cx: &DocContext<'_>, def: Def) -> Result<(Def, Option), ()> { use rustc::ty::DefIdTree; let parent = if let Some(parent) = cx.tcx.parent(def.def_id()) { @@ -604,7 +602,7 @@ fn is_primitive(path_str: &str, is_val: bool) -> Option { } } -fn primitive_impl(cx: &DocContext<'_, '_, '_>, path_str: &str) -> Option { +fn primitive_impl(cx: &DocContext<'_>, path_str: &str) -> Option { let tcx = cx.tcx; match path_str { "u8" => tcx.lang_items().u8_impl(), diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs index 044e48f990e4..de043277c835 100644 --- a/src/librustdoc/passes/collect_trait_impls.rs +++ b/src/librustdoc/passes/collect_trait_impls.rs @@ -12,7 +12,7 @@ pub const COLLECT_TRAIT_IMPLS: Pass = Pass { description: "retrieves trait impls for items in the crate", }; -pub fn collect_trait_impls(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate { +pub fn collect_trait_impls(krate: Crate, cx: &DocContext<'_>) -> Crate { let mut synth = SyntheticImplCollector::new(cx); let mut krate = synth.fold_crate(krate); @@ -138,13 +138,13 @@ pub fn collect_trait_impls(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate { krate } -struct SyntheticImplCollector<'a, 'tcx: 'a, 'rcx: 'a> { - cx: &'a DocContext<'a, 'tcx, 'rcx>, +struct SyntheticImplCollector<'a, 'tcx> { + cx: &'a DocContext<'tcx>, impls: Vec, } -impl<'a, 'tcx, 'rcx> SyntheticImplCollector<'a, 'tcx, 'rcx> { - fn new(cx: &'a DocContext<'a, 'tcx, 'rcx>) -> Self { +impl<'a, 'tcx> SyntheticImplCollector<'a, 'tcx> { + fn new(cx: &'a DocContext<'tcx>) -> Self { SyntheticImplCollector { cx, impls: Vec::new(), @@ -152,7 +152,7 @@ impl<'a, 'tcx, 'rcx> SyntheticImplCollector<'a, 'tcx, 'rcx> { } } -impl<'a, 'tcx, 'rcx> DocFolder for SyntheticImplCollector<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> DocFolder for SyntheticImplCollector<'a, 'tcx> { fn fold_item(&mut self, i: Item) -> Option { if i.is_struct() || i.is_enum() || i.is_union() { if let (Some(hir_id), Some(name)) = diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index 3b0aebe53f38..3c403d421c8f 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -54,7 +54,7 @@ pub use self::calculate_doc_coverage::CALCULATE_DOC_COVERAGE; #[derive(Copy, Clone)] pub struct Pass { pub name: &'static str, - pub pass: fn(clean::Crate, &DocContext<'_, '_, '_>) -> clean::Crate, + pub pass: fn(clean::Crate, &DocContext<'_>) -> clean::Crate, pub description: &'static str, } @@ -308,8 +308,8 @@ impl DocFolder for ImportStripper { } } -pub fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a>( - cx: &'a DocContext<'a, 'tcx, 'rcx>, +pub fn look_for_tests<'tcx>( + cx: &DocContext<'tcx>, dox: &str, item: &Item, check_missing_code: bool, @@ -370,7 +370,7 @@ crate fn span_of_attrs(attrs: &clean::Attributes) -> Span { /// attributes are not all sugared doc comments. It's difficult to calculate the correct span in /// that case due to escaping and other source features. crate fn source_span_for_markdown_range( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, markdown: &str, md_range: &Range, attrs: &clean::Attributes, diff --git a/src/librustdoc/passes/private_items_doc_tests.rs b/src/librustdoc/passes/private_items_doc_tests.rs index 1c3977c4f85c..5560ebed9ae6 100644 --- a/src/librustdoc/passes/private_items_doc_tests.rs +++ b/src/librustdoc/passes/private_items_doc_tests.rs @@ -9,25 +9,25 @@ pub const CHECK_PRIVATE_ITEMS_DOC_TESTS: Pass = Pass { description: "check private items doc tests", }; -struct PrivateItemDocTestLinter<'a, 'tcx: 'a, 'rcx: 'a> { - cx: &'a DocContext<'a, 'tcx, 'rcx>, +struct PrivateItemDocTestLinter<'a, 'tcx> { + cx: &'a DocContext<'tcx>, } -impl<'a, 'tcx, 'rcx> PrivateItemDocTestLinter<'a, 'tcx, 'rcx> { - fn new(cx: &'a DocContext<'a, 'tcx, 'rcx>) -> Self { +impl<'a, 'tcx> PrivateItemDocTestLinter<'a, 'tcx> { + fn new(cx: &'a DocContext<'tcx>) -> Self { PrivateItemDocTestLinter { cx, } } } -pub fn check_private_items_doc_tests(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate { +pub fn check_private_items_doc_tests(krate: Crate, cx: &DocContext<'_>) -> Crate { let mut coll = PrivateItemDocTestLinter::new(cx); coll.fold_crate(krate) } -impl<'a, 'tcx, 'rcx> DocFolder for PrivateItemDocTestLinter<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> DocFolder for PrivateItemDocTestLinter<'a, 'tcx> { fn fold_item(&mut self, item: Item) -> Option { let cx = self.cx; let dox = item.attrs.collapsed_doc_value().unwrap_or_else(String::new); diff --git a/src/librustdoc/passes/propagate_doc_cfg.rs b/src/librustdoc/passes/propagate_doc_cfg.rs index aed80b5ba86f..a71a1e001fc6 100644 --- a/src/librustdoc/passes/propagate_doc_cfg.rs +++ b/src/librustdoc/passes/propagate_doc_cfg.rs @@ -12,7 +12,7 @@ pub const PROPAGATE_DOC_CFG: Pass = Pass { description: "propagates `#[doc(cfg(...))]` to child items", }; -pub fn propagate_doc_cfg(cr: Crate, _: &DocContext<'_, '_, '_>) -> Crate { +pub fn propagate_doc_cfg(cr: Crate, _: &DocContext<'_>) -> Crate { CfgPropagator { parent_cfg: None }.fold_crate(cr) } diff --git a/src/librustdoc/passes/strip_hidden.rs b/src/librustdoc/passes/strip_hidden.rs index 330057e53843..240299c212ab 100644 --- a/src/librustdoc/passes/strip_hidden.rs +++ b/src/librustdoc/passes/strip_hidden.rs @@ -14,7 +14,7 @@ pub const STRIP_HIDDEN: Pass = Pass { }; /// Strip items marked `#[doc(hidden)]` -pub fn strip_hidden(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { +pub fn strip_hidden(krate: clean::Crate, _: &DocContext<'_>) -> clean::Crate { let mut retained = DefIdSet::default(); // strip all #[doc(hidden)] items diff --git a/src/librustdoc/passes/strip_priv_imports.rs b/src/librustdoc/passes/strip_priv_imports.rs index 479f0877bd7d..516760ade666 100644 --- a/src/librustdoc/passes/strip_priv_imports.rs +++ b/src/librustdoc/passes/strip_priv_imports.rs @@ -9,6 +9,6 @@ pub const STRIP_PRIV_IMPORTS: Pass = Pass { description: "strips all private import statements (`use`, `extern crate`) from a crate", }; -pub fn strip_priv_imports(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { +pub fn strip_priv_imports(krate: clean::Crate, _: &DocContext<'_>) -> clean::Crate { ImportStripper.fold_crate(krate) } diff --git a/src/librustdoc/passes/strip_private.rs b/src/librustdoc/passes/strip_private.rs index 1ac3a90f38d3..fc742bf74d00 100644 --- a/src/librustdoc/passes/strip_private.rs +++ b/src/librustdoc/passes/strip_private.rs @@ -14,7 +14,7 @@ pub const STRIP_PRIVATE: Pass = Pass { /// Strip private items from the point of view of a crate or externally from a /// crate, specified by the `xcrate` flag. -pub fn strip_private(mut krate: clean::Crate, cx: &DocContext<'_, '_, '_>) -> clean::Crate { +pub fn strip_private(mut krate: clean::Crate, cx: &DocContext<'_>) -> clean::Crate { // This stripper collects all *retained* nodes. let mut retained = DefIdSet::default(); let access_levels = cx.renderinfo.borrow().access_levels.clone(); diff --git a/src/librustdoc/passes/unindent_comments.rs b/src/librustdoc/passes/unindent_comments.rs index b77cf68d7c63..95e322f70b2e 100644 --- a/src/librustdoc/passes/unindent_comments.rs +++ b/src/librustdoc/passes/unindent_comments.rs @@ -13,7 +13,7 @@ pub const UNINDENT_COMMENTS: Pass = Pass { description: "removes excess indentation on comments in order for markdown to like it", }; -pub fn unindent_comments(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { +pub fn unindent_comments(krate: clean::Crate, _: &DocContext<'_>) -> clean::Crate { CommentCleaner.fold_crate(krate) } diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 856365847ae1..f1d4d8470b2a 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -1,21 +1,16 @@ -use errors::{self, FatalError}; -use errors::emitter::ColorConfig; use rustc_data_structures::sync::Lrc; -use rustc_lint; -use rustc_driver::{self, driver, Compilation}; -use rustc_driver::driver::phase_2_configure_and_expand; -use rustc_metadata::cstore::CStore; -use rustc_interface::util; +use rustc_interface::interface; use rustc::hir; use rustc::hir::intravisit; -use rustc::session::{self, CompileIncomplete, config}; +use rustc::hir::def_id::LOCAL_CRATE; +use rustc::session::{self, config, DiagnosticOutput}; use rustc::session::config::{OutputType, OutputTypes, Externs, CodegenOptions}; use rustc::session::search_paths::SearchPath; +use rustc::util::common::ErrorReported; use syntax::ast; use syntax::source_map::SourceMap; use syntax::edition::Edition; use syntax::feature_gate::UnstableFeatures; -use syntax::with_globals; use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName}; use tempfile::Builder as TempFileBuilder; use testing; @@ -23,8 +18,8 @@ use testing; use std::env; use std::io::prelude::*; use std::io; -use std::path::PathBuf; use std::panic::{self, AssertUnwindSafe}; +use std::path::PathBuf; use std::process::Command; use std::str; use std::sync::{Arc, Mutex}; @@ -44,7 +39,7 @@ pub struct TestOptions { pub attrs: Vec, } -pub fn run(mut options: Options) -> isize { +pub fn run(options: Options) -> i32 { let input = config::Input::File(options.input.clone()); let sessopts = config::Options { @@ -63,52 +58,31 @@ pub fn run(mut options: Options) -> isize { edition: options.edition, ..config::Options::default() }; - driver::spawn_thread_pool(sessopts, |sessopts| { - let source_map = Lrc::new(SourceMap::new(sessopts.file_path_mapping())); - let handler = - errors::Handler::with_tty_emitter(ColorConfig::Auto, - true, None, - Some(source_map.clone())); - let mut sess = session::build_session_( - sessopts, Some(options.input), handler, source_map.clone(), Default::default(), - ); - let codegen_backend = util::get_codegen_backend(&sess); - let cstore = CStore::new(codegen_backend.metadata_loader()); - rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); + let config = interface::Config { + opts: sessopts, + crate_cfg: config::parse_cfgspecs(options.cfgs.clone()), + input, + input_path: None, + output_file: None, + output_dir: None, + file_loader: None, + diagnostic_output: DiagnosticOutput::Default, + stderr: None, + crate_name: options.crate_name.clone(), + lint_caps: Default::default(), + }; - let mut cfg = config::build_configuration(&sess, - config::parse_cfgspecs(options.cfgs.clone())); - util::add_configuration(&mut cfg, &sess, &*codegen_backend); - sess.parse_sess.config = cfg; + let mut test_args = options.test_args.clone(); + let display_warnings = options.display_warnings; - let krate = - match driver::phase_1_parse_input(&driver::CompileController::basic(), &sess, &input) { - Ok(krate) => krate, - Err(mut e) => { - e.emit(); - FatalError.raise(); - } - }; - let driver::ExpansionResult { defs, mut hir_forest, .. } = { - phase_2_configure_and_expand( - &sess, - &cstore, - krate, - None, - "rustdoc-test", - None, - |_| Ok(()), - ).expect("phase_2_configure_and_expand aborted in rustdoc!") - }; + let tests = interface::run_compiler(config, |compiler| -> Result<_, ErrorReported> { + let lower_to_hir = compiler.lower_to_hir()?; - let crate_name = options.crate_name.unwrap_or_else(|| { - ::rustc_codegen_utils::link::find_crate_name(None, &hir_forest.krate().attrs, &input) - }); - let mut opts = scrape_test_config(hir_forest.krate()); + let mut opts = scrape_test_config(lower_to_hir.peek().0.borrow().krate()); opts.display_warnings |= options.display_warnings; let mut collector = Collector::new( - crate_name, + compiler.crate_name()?.peek().to_string(), options.cfgs, options.libs, options.codegen_options, @@ -116,34 +90,40 @@ pub fn run(mut options: Options) -> isize { false, opts, options.maybe_sysroot, - Some(source_map), + Some(compiler.source_map().clone()), None, options.linker, options.edition, options.persist_doctests, ); - { - let map = hir::map::map_crate(&sess, &cstore, &mut hir_forest, &defs); - let krate = map.krate(); + let mut global_ctxt = compiler.global_ctxt()?.take(); + global_ctxt.enter(|tcx| { + let krate = tcx.hir().krate(); let mut hir_collector = HirCollector { - sess: &sess, + sess: compiler.session(), collector: &mut collector, - map: &map, - codes: ErrorCodes::from(sess.opts.unstable_features.is_nightly_build()), + map: tcx.hir(), + codes: ErrorCodes::from(compiler.session().opts + .unstable_features.is_nightly_build()), }; hir_collector.visit_testable("".to_string(), &krate.attrs, |this| { intravisit::walk_crate(this, krate); }); - } + }); - options.test_args.insert(0, "rustdoctest".to_string()); + Ok(collector.tests) + }).expect("compiler aborted in rustdoc!"); - testing::test_main(&options.test_args, - collector.tests.into_iter().collect(), - testing::Options::new().display_output(options.display_warnings)); - 0 - }) + test_args.insert(0, "rustdoctest".to_string()); + + testing::test_main( + &test_args, + tests, + testing::Options::new().display_output(display_warnings) + ); + + 0 } // Look for `#![doc(test(no_crate_inject))]`, used by crates in the std facade. @@ -239,16 +219,18 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize, } fn flush(&mut self) -> io::Result<()> { Ok(()) } } - struct Bomb(Arc>>, Box); + struct Bomb(Arc>>, Option>); impl Drop for Bomb { fn drop(&mut self) { - let _ = self.1.write_all(&self.0.lock().unwrap()); + let mut old = self.1.take().unwrap(); + let _ = old.write_all(&self.0.lock().unwrap()); + io::set_panic(Some(old)); } } let data = Arc::new(Mutex::new(Vec::new())); let old = io::set_panic(Some(box Sink(data.clone()))); - let _bomb = Bomb(data.clone(), old.unwrap_or(box io::stdout())); + let _bomb = Bomb(data.clone(), Some(old.unwrap_or(box io::stdout()))); enum DirState { Temp(tempfile::TempDir), @@ -264,91 +246,67 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize, } } - let (outdir, compile_result) = driver::spawn_thread_pool(sessopts, |sessopts| { - let source_map = Lrc::new(SourceMap::new(sessopts.file_path_mapping())); - let emitter = errors::emitter::EmitterWriter::new(box Sink(data.clone()), - Some(source_map.clone()), - false, - false); - - // Compile the code - let diagnostic_handler = errors::Handler::with_emitter(true, None, box emitter); - - let mut sess = session::build_session_( - sessopts, None, diagnostic_handler, source_map, Default::default(), + let outdir = if let Some(mut path) = persist_doctests { + path.push(format!("{}_{}", + filename + .to_string() + .rsplit('/') + .next() + .unwrap() + .replace(".", "_"), + line) ); - let codegen_backend = util::get_codegen_backend(&sess); - let cstore = CStore::new(codegen_backend.metadata_loader()); - rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); + std::fs::create_dir_all(&path) + .expect("Couldn't create directory for doctest executables"); - let outdir = Mutex::new( - if let Some(mut path) = persist_doctests { - path.push(format!("{}_{}", - filename - .to_string() - .rsplit('/') - .next() - .unwrap() - .replace(".", "_"), - line) - ); - std::fs::create_dir_all(&path) - .expect("Couldn't create directory for doctest executables"); + DirState::Perm(path) + } else { + DirState::Temp(TempFileBuilder::new() + .prefix("rustdoctest") + .tempdir() + .expect("rustdoc needs a tempdir")) + }; + let output_file = outdir.path().join("rust_out"); - DirState::Perm(path) + let config = interface::Config { + opts: sessopts, + crate_cfg: config::parse_cfgspecs(cfgs), + input, + input_path: None, + output_file: Some(output_file.clone()), + output_dir: None, + file_loader: None, + diagnostic_output: DiagnosticOutput::Raw(box Sink(data.clone())), + stderr: Some(data.clone()), + crate_name: None, + lint_caps: Default::default(), + }; + + let compile_result = panic::catch_unwind(AssertUnwindSafe(|| { + interface::run_compiler(config, |compiler| { + if no_run { + compiler.global_ctxt().and_then(|global_ctxt| global_ctxt.take().enter(|tcx| { + tcx.analysis(LOCAL_CRATE) + })).ok(); } else { - DirState::Temp(TempFileBuilder::new() - .prefix("rustdoctest") - .tempdir() - .expect("rustdoc needs a tempdir")) - } - ); - let mut control = driver::CompileController::basic(); - - let mut cfg = config::build_configuration(&sess, config::parse_cfgspecs(cfgs.clone())); - util::add_configuration(&mut cfg, &sess, &*codegen_backend); - sess.parse_sess.config = cfg; - - let out = Some(outdir.lock().unwrap().path().join("rust_out")); - - if no_run { - control.after_analysis.stop = Compilation::Stop; - } - - let res = panic::catch_unwind(AssertUnwindSafe(|| { - driver::compile_input( - codegen_backend, - &sess, - &cstore, - &None, - &input, - &None, - &out, - None, - &control - ) - })); - - let compile_result = match res { - Ok(Ok(())) | Ok(Err(CompileIncomplete::Stopped)) => Ok(()), - Err(_) | Ok(Err(CompileIncomplete::Errored(_))) => Err(()) - }; - - (outdir, compile_result) - }); + compiler.compile().ok(); + }; + compiler.session().compile_status() + }) + })).map_err(|_| ()).and_then(|s| s.map_err(|_| ())); match (compile_result, compile_fail) { (Ok(()), true) => { panic!("test compiled while it wasn't supposed to") } (Ok(()), false) => {} - (Err(()), true) => { + (Err(_), true) => { if error_codes.len() > 0 { let out = String::from_utf8(data.lock().unwrap().to_vec()).unwrap(); error_codes.retain(|err| !out.contains(err)); } } - (Err(()), false) => { + (Err(_), false) => { panic!("couldn't compile the test") } } @@ -360,7 +318,8 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize, if no_run { return } // Run the code! - let mut cmd = Command::new(&outdir.lock().unwrap().path().join("rust_out")); + let mut cmd = Command::new(output_file); + match cmd.output() { Err(e) => panic!("couldn't run the test: {}{}", e, if e.kind() == io::ErrorKind::PermissionDenied { @@ -735,35 +694,26 @@ impl Tester for Collector { allow_fail: config.allow_fail, }, testfn: testing::DynTestFn(box move || { - let panic = io::set_panic(None); - let print = io::set_print(None); - match { - rustc_driver::in_named_rustc_thread(name, move || with_globals(move || { - io::set_panic(panic); - io::set_print(print); - run_test(&test, - &cratename, - &filename, - line, - cfgs, - libs, - cg, - externs, - config.should_panic, - config.no_run, - config.test_harness, - config.compile_fail, - config.error_codes, - &opts, - maybe_sysroot, - linker, - edition, - persist_doctests) - })) - } { - Ok(()) => (), - Err(err) => panic::resume_unwind(err), - } + run_test( + &test, + &cratename, + &filename, + line, + cfgs, + libs, + cg, + externs, + config.should_panic, + config.no_run, + config.test_harness, + config.compile_fail, + config.error_codes, + &opts, + maybe_sysroot, + linker, + edition, + persist_doctests + ) }), }); } diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index c1bd1d83a5b0..0c99f6ddeddf 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -27,10 +27,10 @@ use crate::doctree::*; // Also, is there some reason that this doesn't use the 'visit' // framework from syntax?. -pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a> { +pub struct RustdocVisitor<'a, 'tcx> { pub module: Module, pub attrs: hir::HirVec, - pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>, + pub cx: &'a core::DocContext<'tcx>, view_item_stack: FxHashSet, inlining: bool, /// Are the current module and all of its parents public? @@ -38,10 +38,10 @@ pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a> { exact_paths: Option>>, } -impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { pub fn new( - cx: &'a core::DocContext<'a, 'tcx, 'rcx> - ) -> RustdocVisitor<'a, 'tcx, 'rcx> { + cx: &'a core::DocContext<'tcx> + ) -> RustdocVisitor<'a, 'tcx> { // If the root is re-exported, terminate all recursion. let mut stack = FxHashSet::default(); stack.insert(ast::CRATE_NODE_ID); @@ -269,7 +269,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { om: &mut Module, please_inline: bool) -> bool { - fn inherits_doc_hidden(cx: &core::DocContext<'_, '_, '_>, mut node: ast::NodeId) -> bool { + fn inherits_doc_hidden(cx: &core::DocContext<'_>, mut node: ast::NodeId) -> bool { while let Some(id) = cx.tcx.hir().get_enclosing_scope(node) { node = id; if cx.tcx.hir().attrs(node).lists("doc").has_word("hidden") { diff --git a/src/librustdoc/visit_lib.rs b/src/librustdoc/visit_lib.rs index f538c58c213e..def6f8b557b5 100644 --- a/src/librustdoc/visit_lib.rs +++ b/src/librustdoc/visit_lib.rs @@ -12,8 +12,8 @@ use crate::clean::{AttributesExt, NestedAttributesExt}; /// Similar to `librustc_privacy::EmbargoVisitor`, but also takes /// specific rustdoc annotations into account (i.e., `doc(hidden)`) -pub struct LibEmbargoVisitor<'a, 'tcx: 'a, 'rcx: 'a> { - cx: &'a crate::core::DocContext<'a, 'tcx, 'rcx>, +pub struct LibEmbargoVisitor<'a, 'tcx> { + cx: &'a crate::core::DocContext<'tcx>, // Accessibility levels for reachable nodes access_levels: RefMut<'a, AccessLevels>, // Previous accessibility level, None means unreachable @@ -22,10 +22,10 @@ pub struct LibEmbargoVisitor<'a, 'tcx: 'a, 'rcx: 'a> { visited_mods: FxHashSet, } -impl<'a, 'tcx, 'rcx> LibEmbargoVisitor<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> LibEmbargoVisitor<'a, 'tcx> { pub fn new( - cx: &'a crate::core::DocContext<'a, 'tcx, 'rcx> - ) -> LibEmbargoVisitor<'a, 'tcx, 'rcx> { + cx: &'a crate::core::DocContext<'tcx> + ) -> LibEmbargoVisitor<'a, 'tcx> { LibEmbargoVisitor { cx, access_levels: RefMut::map(cx.renderinfo.borrow_mut(), |ri| &mut ri.access_levels), diff --git a/src/rustc/rustc.rs b/src/rustc/rustc.rs index fef6b830040b..626fceb58143 100644 --- a/src/rustc/rustc.rs +++ b/src/rustc/rustc.rs @@ -1,14 +1,3 @@ -#![feature(link_args)] - -// Set the stack size at link time on Windows. See rustc_driver::in_rustc_thread -// for the rationale. -#[allow(unused_attributes)] -#[cfg_attr(all(windows, target_env = "msvc"), link_args = "/STACK:16777216")] -// We only build for msvc and gnu now, but we use a exhaustive condition here -// so we can expect either the stack size to be set or the build fails. -#[cfg_attr(all(windows, not(target_env = "msvc")), link_args = "-Wl,--stack,16777216")] -// Also, don't forget to set this for rustdoc. -extern {} fn main() { // Pull in jemalloc when enabled. diff --git a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index 51891ed53877..641ff18d37e9 100644 --- a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -7,12 +7,13 @@ extern crate rustc_codegen_utils; use std::any::Any; use std::sync::mpsc; use syntax::symbol::Symbol; -use rustc::session::{Session, CompileIncomplete}; +use rustc::session::Session; use rustc::session::config::OutputFilenames; use rustc::ty::TyCtxt; use rustc::ty::query::Providers; use rustc::middle::cstore::MetadataLoader; use rustc::dep_graph::DepGraph; +use rustc::util::common::ErrorReported; use rustc_codegen_utils::codegen_backend::{CodegenBackend, MetadataOnlyCodegenBackend}; struct TheBackend(Box); @@ -46,7 +47,7 @@ impl CodegenBackend for TheBackend { sess: &Session, _dep_graph: &DepGraph, outputs: &OutputFilenames, - ) -> Result<(), CompileIncomplete> { + ) -> Result<(), ErrorReported> { use std::io::Write; use rustc::session::config::CrateType; use rustc_codegen_utils::link::out_filename; diff --git a/src/test/run-make-fulldeps/issue-19371/foo.rs b/src/test/run-make-fulldeps/issue-19371/foo.rs index e9d825df2a46..0cbdf40e2f90 100644 --- a/src/test/run-make-fulldeps/issue-19371/foo.rs +++ b/src/test/run-make-fulldeps/issue-19371/foo.rs @@ -1,26 +1,16 @@ #![feature(rustc_private)] extern crate rustc; -extern crate rustc_driver; -extern crate rustc_lint; -extern crate rustc_metadata; -extern crate rustc_errors; -extern crate rustc_codegen_utils; extern crate rustc_interface; extern crate syntax; -use rustc::session::{build_session, Session}; +use rustc::session::DiagnosticOutput; use rustc::session::config::{Input, Options, OutputType, OutputTypes}; -use rustc_driver::driver::{self, compile_input, CompileController}; -use rustc_metadata::cstore::CStore; -use rustc_errors::registry::Registry; -use rustc_interface::util; +use rustc_interface::interface; use syntax::source_map::FileName; -use rustc_codegen_utils::codegen_backend::CodegenBackend; use std::path::PathBuf; -use std::rc::Rc; fn main() { let src = r#" @@ -44,39 +34,33 @@ fn main() { compile(src.to_string(), tmpdir.join("out"), sysroot.clone()); } -fn basic_sess(opts: Options) -> (Session, Rc, Box) { - let descriptions = Registry::new(&rustc::DIAGNOSTICS); - let sess = build_session(opts, None, descriptions); - let codegen_backend = util::get_codegen_backend(&sess); - let cstore = Rc::new(CStore::new(codegen_backend.metadata_loader())); - rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); - (sess, cstore, codegen_backend) -} - fn compile(code: String, output: PathBuf, sysroot: PathBuf) { - syntax::with_globals(|| { - let mut opts = Options::default(); - opts.output_types = OutputTypes::new(&[(OutputType::Exe, None)]); - opts.maybe_sysroot = Some(sysroot); - if let Ok(linker) = std::env::var("RUSTC_LINKER") { - opts.cg.linker = Some(linker.into()); - } - driver::spawn_thread_pool(opts, |opts| { - let (sess, cstore, codegen_backend) = basic_sess(opts); - let control = CompileController::basic(); - let name = FileName::anon_source_code(&code); - let input = Input::Str { name, input: code }; - let _ = compile_input( - codegen_backend, - &sess, - &cstore, - &None, - &input, - &None, - &Some(output), - None, - &control - ); - }); + let mut opts = Options::default(); + opts.output_types = OutputTypes::new(&[(OutputType::Exe, None)]); + opts.maybe_sysroot = Some(sysroot); + + if let Ok(linker) = std::env::var("RUSTC_LINKER") { + opts.cg.linker = Some(linker.into()); + } + + let name = FileName::anon_source_code(&code); + let input = Input::Str { name, input: code }; + + let config = interface::Config { + opts, + crate_cfg: Default::default(), + input, + input_path: None, + output_file: Some(output), + output_dir: None, + file_loader: None, + diagnostic_output: DiagnosticOutput::Default, + stderr: None, + crate_name: None, + lint_caps: Default::default(), + }; + + interface::run_compiler(config, |compiler| { + compiler.compile().ok(); }); } diff --git a/src/test/run-pass-fulldeps/compiler-calls.rs b/src/test/run-pass-fulldeps/compiler-calls.rs index d3a328300ba0..b4731bbaeb5c 100644 --- a/src/test/run-pass-fulldeps/compiler-calls.rs +++ b/src/test/run-pass-fulldeps/compiler-calls.rs @@ -1,91 +1,30 @@ -// Test that the CompilerCalls interface to the compiler works. +// Test that the Callbacks interface to the compiler works. // ignore-cross-compile // ignore-stage1 #![feature(rustc_private)] -extern crate getopts; -extern crate rustc; extern crate rustc_driver; -extern crate rustc_codegen_utils; -extern crate syntax; -extern crate rustc_errors as errors; -extern crate rustc_metadata; +extern crate rustc_interface; -use rustc::session::Session; -use rustc::session::config::{self, Input}; -use rustc_driver::{driver, CompilerCalls, Compilation}; -use rustc_codegen_utils::codegen_backend::CodegenBackend; -use rustc_metadata::cstore::CStore; -use syntax::ast; - -use std::path::PathBuf; +use rustc_interface::interface; struct TestCalls<'a> { count: &'a mut u32 } -impl<'a> CompilerCalls<'a> for TestCalls<'a> { - fn early_callback(&mut self, - _: &getopts::Matches, - _: &config::Options, - _: &ast::CrateConfig, - _: &errors::registry::Registry, - _: config::ErrorOutputType) - -> Compilation { +impl rustc_driver::Callbacks for TestCalls<'_> { + fn config(&mut self, _config: &mut interface::Config) { *self.count *= 2; - Compilation::Continue - } - - fn late_callback(&mut self, - _: &CodegenBackend, - _: &getopts::Matches, - _: &Session, - _: &CStore, - _: &Input, - _: &Option, - _: &Option) - -> Compilation { - *self.count *= 3; - Compilation::Stop - } - - fn some_input(&mut self, input: Input, input_path: Option) - -> (Input, Option) { - *self.count *= 5; - (input, input_path) - } - - fn no_input(&mut self, - _: &getopts::Matches, - _: &config::Options, - _: &ast::CrateConfig, - _: &Option, - _: &Option, - _: &errors::registry::Registry) - -> Option<(Input, Option)> { - panic!("This shouldn't happen"); - } - - fn build_controller(self: Box, - _: &Session, - _: &getopts::Matches) - -> driver::CompileController<'a> { - panic!("This shouldn't be called"); } } - fn main() { let mut count = 1; - { - let tc = TestCalls { count: &mut count }; - // we should never get use this filename, but lets make sure they are valid args. - let args = vec!["compiler-calls".to_string(), "foo.rs".to_string()]; - syntax::with_globals(|| { - rustc_driver::run_compiler(&args, Box::new(tc), None, None); - }); - } - assert_eq!(count, 30); + let args = vec!["compiler-calls".to_string(), "foo.rs".to_string()]; + rustc_driver::report_ices_to_stderr_if_any(|| { + rustc_driver::run_compiler(&args, &mut TestCalls { count: &mut count }, None, None).ok(); + }).ok(); + assert_eq!(count, 2); } diff --git a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr index e18b9909f586..d2c4a28ce980 100644 --- a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr +++ b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr @@ -11,3 +11,5 @@ LL | #![deny(intra_doc_link_resolution_failure)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` +error: aborting due to previous error + diff --git a/src/test/rustdoc-ui/deny-missing-docs-crate.stderr b/src/test/rustdoc-ui/deny-missing-docs-crate.stderr index 1cfd6092cb3a..4cc0f4b4128f 100644 --- a/src/test/rustdoc-ui/deny-missing-docs-crate.stderr +++ b/src/test/rustdoc-ui/deny-missing-docs-crate.stderr @@ -18,5 +18,5 @@ error: missing documentation for a struct LL | pub struct Foo; //~ ERROR | ^^^^^^^^^^^^^^^ -error: Compilation failed, aborting rustdoc +error: aborting due to 2 previous errors diff --git a/src/test/rustdoc-ui/deny-missing-docs-macro.stderr b/src/test/rustdoc-ui/deny-missing-docs-macro.stderr index b87e60d8269e..ce9584a4bb0c 100644 --- a/src/test/rustdoc-ui/deny-missing-docs-macro.stderr +++ b/src/test/rustdoc-ui/deny-missing-docs-macro.stderr @@ -10,5 +10,5 @@ note: lint level defined here LL | #![deny(missing_docs)] | ^^^^^^^^^^^^ -error: Compilation failed, aborting rustdoc +error: aborting due to previous error diff --git a/src/test/rustdoc-ui/doc-without-codeblock.stderr b/src/test/rustdoc-ui/doc-without-codeblock.stderr index c07965a6ab96..208bdedf24dd 100644 --- a/src/test/rustdoc-ui/doc-without-codeblock.stderr +++ b/src/test/rustdoc-ui/doc-without-codeblock.stderr @@ -24,3 +24,5 @@ error: Missing code example in this documentation LL | /// Or maybe not because she saved herself! | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error: aborting due to 4 previous errors + diff --git a/src/test/rustdoc-ui/failed-doctest-output.stdout b/src/test/rustdoc-ui/failed-doctest-output.stdout index 895c40e4cab2..c9f59405ce01 100644 --- a/src/test/rustdoc-ui/failed-doctest-output.stdout +++ b/src/test/rustdoc-ui/failed-doctest-output.stdout @@ -12,7 +12,10 @@ error[E0425]: cannot find value `no` in this scope 3 | no | ^^ not found in this scope -thread '$DIR/failed-doctest-output.rs - OtherStruct (line 17)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:352:13 +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. +thread '$DIR/failed-doctest-output.rs - OtherStruct (line 17)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:310:13 note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace. ---- $DIR/failed-doctest-output.rs - SomeStruct (line 11) stdout ---- @@ -21,7 +24,7 @@ thread '$DIR/failed-doctest-output.rs - SomeStruct (line 11)' panicked at 'test thread 'main' panicked at 'oh no', $DIR/failed-doctest-output.rs:3:1 note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace. -', src/librustdoc/test.rs:373:17 +', src/librustdoc/test.rs:332:17 failures: diff --git a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr index ced56897e2a2..12a56dcc4a5e 100644 --- a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr +++ b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr @@ -11,3 +11,5 @@ LL | #![deny(intra_doc_link_resolution_failure)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` +error: aborting due to previous error + diff --git a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr index 4eb186106287..93c05a0c4dd2 100644 --- a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr +++ b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr @@ -11,3 +11,5 @@ LL | #![deny(intra_doc_link_resolution_failure)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` +error: aborting due to previous error + diff --git a/src/test/rustdoc-ui/lint-group.stderr b/src/test/rustdoc-ui/lint-group.stderr index 48ae7910b0f1..76a9133147ea 100644 --- a/src/test/rustdoc-ui/lint-group.stderr +++ b/src/test/rustdoc-ui/lint-group.stderr @@ -42,3 +42,5 @@ LL | #![deny(rustdoc)] | ^^^^^^^ = note: #[deny(missing_doc_code_examples)] implied by #[deny(rustdoc)] +error: aborting due to 3 previous errors + diff --git a/src/test/rustdoc-ui/private-item-doc-test.stderr b/src/test/rustdoc-ui/private-item-doc-test.stderr index 38062758e92c..20f3eb8b1202 100644 --- a/src/test/rustdoc-ui/private-item-doc-test.stderr +++ b/src/test/rustdoc-ui/private-item-doc-test.stderr @@ -14,3 +14,5 @@ note: lint level defined here LL | #![deny(private_doc_tests)] | ^^^^^^^^^^^^^^^^^ +error: aborting due to previous error + diff --git a/src/tools/rustdoc/main.rs b/src/tools/rustdoc/main.rs index 8bdc365c4ca6..8171708e99d0 100644 --- a/src/tools/rustdoc/main.rs +++ b/src/tools/rustdoc/main.rs @@ -1,15 +1,3 @@ #![deny(rust_2018_idioms)] -#![feature(link_args)] - -#[allow(unused_attributes)] -// Set the stack size at link time on Windows. See rustc_driver::in_rustc_thread -// for the rationale. -#[cfg_attr(all(windows, target_env = "msvc"), link_args = "/STACK:16777216")] -// We only build for msvc and gnu now, but we use a exhaustive condition here -// so we can expect either the stack size to be set or the build fails. -#[cfg_attr(all(windows, not(target_env = "msvc")), link_args = "-Wl,--stack,16777216")] -// See src/rustc/rustc.rs for the corresponding rustc settings. -extern {} - fn main() { rustdoc::main() } From 609316a7df8851aeba204e4575c39140788cd964 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 9 Mar 2019 15:40:39 -0800 Subject: [PATCH 325/381] CI: Trim some tests from i686-gnu This removes some tests from the i686-gnu job. This job clocks in at 2hr 56min, and removing these should cut about 10 to 15 minutes, giving a little more breathing room. I suspect these don't need to be tested on every platform. --- src/ci/docker/i686-gnu/Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/i686-gnu/Dockerfile b/src/ci/docker/i686-gnu/Dockerfile index daa24e0e8186..17441ddb4546 100644 --- a/src/ci/docker/i686-gnu/Dockerfile +++ b/src/ci/docker/i686-gnu/Dockerfile @@ -18,4 +18,10 @@ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu -ENV SCRIPT python2.7 ../x.py test +# Exclude some tests that are unlikely to be platform specific, to speed up +# this slow job. +ENV SCRIPT python2.7 ../x.py test \ + --exclude src/bootstrap \ + --exclude src/test/rustdoc-js \ + --exclude src/tools/error_index_generator \ + --exclude src/tools/linkchecker From 1c86e475ca4ea7b2ed134d5d0bce66fde597d528 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Sun, 10 Mar 2019 17:03:05 +0100 Subject: [PATCH 326/381] Drop expanded AST later if in save_analysis mode --- src/librustc_driver/lib.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 2b75a607f168..c7b6f37fe29d 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -342,14 +342,12 @@ pub fn run_compiler( } if sess.opts.debugging_opts.save_analysis { - let expanded_crate = compiler.expansion()?.take().0; - + let expanded_crate = &compiler.expansion()?.peek().0; let crate_name = compiler.crate_name()?.peek().clone(); compiler.global_ctxt()?.peek_mut().enter(|tcx| { let result = tcx.analysis(LOCAL_CRATE); time(sess, "save analysis", || { - // FIXME: Should this run even with analysis errors? save::process_crate( tcx, &expanded_crate, @@ -361,17 +359,24 @@ pub fn run_compiler( }); result + // AST will be dropped *after* the `after_analysis` callback + // (needed by the RLS) })?; } else { // Drop AST after creating GlobalCtxt to free memory mem::drop(compiler.expansion()?.take()); } + compiler.global_ctxt()?.peek_mut().enter(|tcx| tcx.analysis(LOCAL_CRATE))?; if !callbacks.after_analysis(compiler) { return sess.compile_status(); } + if sess.opts.debugging_opts.save_analysis { + mem::drop(compiler.expansion()?.take()); + } + compiler.ongoing_codegen()?; // Drop GlobalCtxt after starting codegen to free memory From 9a6a269d56a7e1b63f744f602e96481b6559b89f Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Sun, 10 Mar 2019 17:03:32 +0100 Subject: [PATCH 327/381] Bump Clippy and RLS --- Cargo.lock | 6 ++---- src/tools/clippy | 2 +- src/tools/rls | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bcb369d15546..db2a5f9ec7c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2257,7 +2257,7 @@ dependencies = [ "rls-analysis 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)", "rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rls-data 0.18.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-rustc 0.6.0", "rls-span 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rls-vfs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2310,8 +2310,7 @@ dependencies = [ [[package]] name = "rls-rustc" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.6.0" [[package]] name = "rls-span" @@ -4210,7 +4209,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rls-analysis 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ae18d8ad01dec3b2014f4d7ae3c607d7adbcff79e5d3b48ea42ea71c10d43a71" "checksum rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ce1fdac03e138c4617ff87b194e1ff57a39bb985a044ccbd8673d30701e411" "checksum rls-data 0.18.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5f80b84551b32e26affaf7f12374913b5061730c0dcd185d9e8fa5a15e36e65c" -"checksum rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9dba7390427aefa953608429701e3665192ca810ba8ae09301e001b7c7bed0" "checksum rls-span 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "33d66f1d6c6ccd5c98029f162544131698f6ebb61d8c697681cac409dcd08805" "checksum rls-vfs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "72d56425bd5aa86d9d4372b76f0381d3b4bda9c0220e71956c9fcc929f45c1f1" "checksum rustc-ap-arena 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8be999235b541fc8eb54901b66e899a06076709ac5f53d6b2c5c59d29ad54780" diff --git a/src/tools/clippy b/src/tools/clippy index 5d78250c75db..016d92d6ed5a 160000 --- a/src/tools/clippy +++ b/src/tools/clippy @@ -1 +1 @@ -Subproject commit 5d78250c75db3b1923072cf1be3b03f7d0cef5e2 +Subproject commit 016d92d6ed5ae8a3785b65aa300768abbc26f818 diff --git a/src/tools/rls b/src/tools/rls index 6a1b5a9cfda2..6840dd69af3a 160000 --- a/src/tools/rls +++ b/src/tools/rls @@ -1 +1 @@ -Subproject commit 6a1b5a9cfda2ae19372e0613e76ebefba36edcf5 +Subproject commit 6840dd69af3ada1f8a432075f1f0be679ea8a468 From df81724000f40dea81500eb43e46ceb1bd7da1d8 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 10 Mar 2019 09:44:43 -0700 Subject: [PATCH 328/381] Update clippy --- src/tools/clippy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/clippy b/src/tools/clippy index 5d78250c75db..016d92d6ed5a 160000 --- a/src/tools/clippy +++ b/src/tools/clippy @@ -1 +1 @@ -Subproject commit 5d78250c75db3b1923072cf1be3b03f7d0cef5e2 +Subproject commit 016d92d6ed5ae8a3785b65aa300768abbc26f818 From 7285b5630b36b3e6aba135f91ded546e82775288 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Wed, 27 Feb 2019 21:01:42 +0000 Subject: [PATCH 329/381] Make migrate mode work at item level granularity --- src/librustc/middle/expr_use_visitor.rs | 8 +++-- .../borrowck/gather_loans/mod.rs | 18 +++++++++++ src/librustc_mir/borrow_check/mod.rs | 28 +++------------- ...e-58776-borrowck-scans-children.ast.stderr | 15 +++++++++ ...776-borrowck-scans-children.migrate.stderr | 32 +++++++++++++++++++ ...e-58776-borrowck-scans-children.nll.stderr | 32 +++++++++++++++++++ .../issue-58776-borrowck-scans-children.rs | 21 ++++++++++++ 7 files changed, 129 insertions(+), 25 deletions(-) create mode 100644 src/test/ui/borrowck/issue-58776-borrowck-scans-children.ast.stderr create mode 100644 src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr create mode 100644 src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr create mode 100644 src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 78a9e406c95e..8ada67efaafd 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -82,6 +82,9 @@ pub trait Delegate<'tcx> { assignment_span: Span, assignee_cmt: &mc::cmt_<'tcx>, mode: MutateMode); + + // A nested closure or generator - only one layer deep. + fn nested_body(&mut self, _body_id: hir::BodyId) {} } #[derive(Copy, Clone, PartialEq, Debug)] @@ -531,8 +534,9 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { self.consume_expr(&base); } - hir::ExprKind::Closure(.., fn_decl_span, _) => { - self.walk_captures(expr, fn_decl_span) + hir::ExprKind::Closure(_, _, body_id, fn_decl_span, _) => { + self.delegate.nested_body(body_id); + self.walk_captures(expr, fn_decl_span); } hir::ExprKind::Box(ref base) => { diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index bf730ba41f42..1e3364ecb9a3 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -153,6 +153,24 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> { .node_type(id); gather_moves::gather_decl(self.bccx, &self.move_data, id, ty); } + + fn nested_body(&mut self, body_id: hir::BodyId) { + debug!("nested_body(body_id={:?})", body_id); + // rust-lang/rust#58776: MIR and AST borrow check disagree on where + // certain closure errors are reported. As such migrate borrowck has to + // operate at the level of items, rather than bodies. Check if the + // contained closure had any errors and set `signalled_any_error` if it + // has. + let bccx = self.bccx; + if bccx.tcx.migrate_borrowck() { + if let SignalledError::NoErrorsSeen = bccx.signalled_any_error.get() { + let closure_def_id = bccx.tcx.hir().body_owner_def_id(body_id); + debug!("checking closure: {:?}", closure_def_id); + + bccx.signalled_any_error.set(bccx.tcx.borrowck(closure_def_id).signalled_any_error); + } + } + } } /// Implements the A-* rules in README.md. diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index d5dfdf0add52..0bdf44c2ae04 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -329,30 +329,12 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( // When borrowck=migrate, check if AST-borrowck would // error on the given code. - // rust-lang/rust#55492: loop over parents to ensure that - // errors that AST-borrowck only detects in some parent of - // a closure still allows NLL to signal an error. - let mut curr_def_id = def_id; - let signalled_any_error = loop { - match tcx.borrowck(curr_def_id).signalled_any_error { - SignalledError::NoErrorsSeen => { - // keep traversing (and borrow-checking) parents - } - SignalledError::SawSomeError => { - // stop search here - break SignalledError::SawSomeError; - } - } + // rust-lang/rust#55492, rust-lang/rust#58776 check the base def id + // for errors. AST borrowck is responsible for aggregating + // `signalled_any_error` from all of the nested closures here. + let base_def_id = tcx.closure_base_def_id(def_id); - if tcx.is_closure(curr_def_id) { - curr_def_id = tcx.parent_def_id(curr_def_id) - .expect("a closure must have a parent_def_id"); - } else { - break SignalledError::NoErrorsSeen; - } - }; - - match signalled_any_error { + match tcx.borrowck(base_def_id).signalled_any_error { SignalledError::NoErrorsSeen => { // if AST-borrowck signalled no errors, then // downgrade all the buffered MIR-borrowck errors diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.ast.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.ast.stderr new file mode 100644 index 000000000000..9e0b0aac1e3c --- /dev/null +++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.ast.stderr @@ -0,0 +1,15 @@ +error[E0597]: `**greeting` does not live long enough + --> $DIR/issue-58776-borrowck-scans-children.rs:10:24 + | +LL | let res = (|| (|| &greeting)())(); + | -- ^^^^^^^^ - borrowed value only lives until here + | | | + | | borrowed value does not live long enough + | capture occurs here +... +LL | } + | - borrowed value needs to live until here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr new file mode 100644 index 000000000000..bd8f2286f170 --- /dev/null +++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr @@ -0,0 +1,32 @@ +error[E0506]: cannot assign to `greeting` because it is borrowed + --> $DIR/issue-58776-borrowck-scans-children.rs:13:5 + | +LL | let res = (|| (|| &greeting)())(); + | -- -------- borrow occurs due to use in closure + | | + | borrow of `greeting` occurs here +... +LL | greeting = "DEALLOCATED".to_string(); + | ^^^^^^^^ assignment to borrowed `greeting` occurs here +... +LL | println!("thread result: {:?}", res); + | --- borrow later used here + +error[E0505]: cannot move out of `greeting` because it is borrowed + --> $DIR/issue-58776-borrowck-scans-children.rs:16:10 + | +LL | let res = (|| (|| &greeting)())(); + | -- -------- borrow occurs due to use in closure + | | + | borrow of `greeting` occurs here +... +LL | drop(greeting); + | ^^^^^^^^ move out of `greeting` occurs here +... +LL | println!("thread result: {:?}", res); + | --- borrow later used here + +error: aborting due to 2 previous errors + +Some errors occurred: E0505, E0506. +For more information about an error, try `rustc --explain E0505`. diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr new file mode 100644 index 000000000000..bd8f2286f170 --- /dev/null +++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr @@ -0,0 +1,32 @@ +error[E0506]: cannot assign to `greeting` because it is borrowed + --> $DIR/issue-58776-borrowck-scans-children.rs:13:5 + | +LL | let res = (|| (|| &greeting)())(); + | -- -------- borrow occurs due to use in closure + | | + | borrow of `greeting` occurs here +... +LL | greeting = "DEALLOCATED".to_string(); + | ^^^^^^^^ assignment to borrowed `greeting` occurs here +... +LL | println!("thread result: {:?}", res); + | --- borrow later used here + +error[E0505]: cannot move out of `greeting` because it is borrowed + --> $DIR/issue-58776-borrowck-scans-children.rs:16:10 + | +LL | let res = (|| (|| &greeting)())(); + | -- -------- borrow occurs due to use in closure + | | + | borrow of `greeting` occurs here +... +LL | drop(greeting); + | ^^^^^^^^ move out of `greeting` occurs here +... +LL | println!("thread result: {:?}", res); + | --- borrow later used here + +error: aborting due to 2 previous errors + +Some errors occurred: E0505, E0506. +For more information about an error, try `rustc --explain E0505`. diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs new file mode 100644 index 000000000000..378969f9a186 --- /dev/null +++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs @@ -0,0 +1,21 @@ +// ignore-compare-mode-nll + +// revisions: ast migrate nll + +//[migrate]compile-flags: -Z borrowck=migrate +#![cfg_attr(nll, feature(nll))] + +fn main() { + let mut greeting = "Hello world!".to_string(); + let res = (|| (|| &greeting)())(); + //[ast]~^ ERROR does not live long enough + + greeting = "DEALLOCATED".to_string(); + //[migrate]~^ ERROR cannot assign + //[nll]~^^ ERROR cannot assign + drop(greeting); + //[migrate]~^ ERROR cannot move + //[nll]~^^ ERROR cannot move + + println!("thread result: {:?}", res); +} From 37ab3dc5b3560792ae4eab0521e0c08bbbdd95d8 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 10 Mar 2019 23:10:40 +0100 Subject: [PATCH 330/381] Make js tests work even with resource-suffix option --- src/tools/rustdoc-js-std/tester.js | 33 +++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/tools/rustdoc-js-std/tester.js b/src/tools/rustdoc-js-std/tester.js index f49dd86c8c32..d5f0ab9f4292 100644 --- a/src/tools/rustdoc-js-std/tester.js +++ b/src/tools/rustdoc-js-std/tester.js @@ -219,6 +219,32 @@ function lookForEntry(entry, data) { return null; } +function findFile(dir, name, extension) { + var entries = fs.readdirSync(dir); + for (var i = 0; i < entries.length; ++i) { + var entry = entries[i]; + var file_type = fs.statSync(dir + entry); + if (file_type.isDirectory()) { + continue; + } + if (entry.startsWith(name) && entry.endsWith(extension)) { + return entry; + } + } + return null; +} + +function readFileMatching(dir, name, extension) { + if (dir.endsWith("/") === false) { + dir += "/"; + } + var f = findFile(dir, name, extension); + if (f === null) { + return ""; + } + return readFile(dir + f); +} + function main(argv) { if (argv.length !== 3) { console.error("Expected toolchain to check as argument (for example \ @@ -227,9 +253,10 @@ function main(argv) { } var toolchain = argv[2]; - var mainJs = readFile("build/" + toolchain + "/doc/main.js"); - var ALIASES = readFile("build/" + toolchain + "/doc/aliases.js"); - var searchIndex = readFile("build/" + toolchain + "/doc/search-index.js").split("\n"); + var mainJs = readFileMatching("build/" + toolchain + "/doc/", "main", ".js"); + var ALIASES = readFileMatching("build/" + toolchain + "/doc/", "aliases", ".js"); + var searchIndex = readFileMatching("build/" + toolchain + "/doc/", + "search-index", ".js").split("\n"); if (searchIndex[searchIndex.length - 1].length === 0) { searchIndex.pop(); } From d1034c19a22550c680c1be0c4aaafbdcfc518b82 Mon Sep 17 00:00:00 2001 From: Nikita Baksalyar Date: Mon, 11 Mar 2019 01:11:54 +0000 Subject: [PATCH 331/381] Fix incorrect links in librustc_codegen_llvm documentation --- src/librustc_codegen_llvm/debuginfo/doc.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_codegen_llvm/debuginfo/doc.rs b/src/librustc_codegen_llvm/debuginfo/doc.rs index cf18b995b61d..daccfc9b242f 100644 --- a/src/librustc_codegen_llvm/debuginfo/doc.rs +++ b/src/librustc_codegen_llvm/debuginfo/doc.rs @@ -1,13 +1,13 @@ //! # Debug Info Module //! //! This module serves the purpose of generating debug symbols. We use LLVM's -//! [source level debugging](http://!llvm.org/docs/SourceLevelDebugging.html) +//! [source level debugging](https://llvm.org/docs/SourceLevelDebugging.html) //! features for generating the debug information. The general principle is //! this: //! //! Given the right metadata in the LLVM IR, the LLVM code generator is able to //! create DWARF debug symbols for the given code. The -//! [metadata](http://!llvm.org/docs/LangRef.html#metadata-type) is structured +//! [metadata](https://llvm.org/docs/LangRef.html#metadata-type) is structured //! much like DWARF *debugging information entries* (DIE), representing type //! information such as datatype layout, function signatures, block layout, //! variable location and scope information, etc. It is the purpose of this @@ -15,7 +15,7 @@ //! //! As the exact format of metadata trees may change between different LLVM //! versions, we now use LLVM -//! [DIBuilder](http://!llvm.org/docs/doxygen/html/classllvm_1_1DIBuilder.html) +//! [DIBuilder](https://llvm.org/docs/doxygen/html/classllvm_1_1DIBuilder.html) //! to create metadata where possible. This will hopefully ease the adaption of //! this module to future LLVM versions. //! From 8b1742ea6a8a560736a7656db1456f69c00c0704 Mon Sep 17 00:00:00 2001 From: kyren Date: Sun, 10 Mar 2019 22:18:38 -0400 Subject: [PATCH 332/381] Fix #54822 and associated faulty tests Type checking associated constants can require trait bounds, but an empty parameter environment was provided to the trait solver. Providing an appropriate parameter environment seems to fix #54822 and also make one of the cases in src/test/ui/nll/trait-associated-constant.rs that should compile successfully do so. It also (slightly) improves the error message in src/test/ui/associated-const/associated-const-generic-obligations.rs --- src/librustc_typeck/check/compare_method.rs | 2 +- .../associated-const-generic-obligations.rs | 2 +- ...ssociated-const-generic-obligations.stderr | 14 ++++++++----- .../associated-const-trait-bound.rs | 21 +++++++++++++++++++ src/test/ui/nll/trait-associated-constant.rs | 1 - .../ui/nll/trait-associated-constant.stderr | 21 +------------------ 6 files changed, 33 insertions(+), 28 deletions(-) create mode 100644 src/test/ui/associated-const/associated-const-trait-bound.rs diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 1e5f5d244e9c..f79bf4e999d5 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -917,7 +917,7 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, debug!("compare_const_impl(impl_trait_ref={:?})", impl_trait_ref); tcx.infer_ctxt().enter(|infcx| { - let param_env = ty::ParamEnv::empty(); + let param_env = tcx.param_env(impl_c.def_id); let inh = Inherited::new(infcx, impl_c.def_id); let infcx = &inh.infcx; diff --git a/src/test/ui/associated-const/associated-const-generic-obligations.rs b/src/test/ui/associated-const/associated-const-generic-obligations.rs index e0b502edaa15..498e315b5c83 100644 --- a/src/test/ui/associated-const/associated-const-generic-obligations.rs +++ b/src/test/ui/associated-const/associated-const-generic-obligations.rs @@ -12,7 +12,7 @@ trait Bar: Foo { impl Bar for T { const FROM: &'static str = "foo"; - //~^ ERROR the trait bound `T: Foo` is not satisfied [E0277] + //~^ ERROR implemented const `FROM` has an incompatible type for trait [E0326] } fn main() {} diff --git a/src/test/ui/associated-const/associated-const-generic-obligations.stderr b/src/test/ui/associated-const/associated-const-generic-obligations.stderr index e4b86d84cafc..eeee26a75671 100644 --- a/src/test/ui/associated-const/associated-const-generic-obligations.stderr +++ b/src/test/ui/associated-const/associated-const-generic-obligations.stderr @@ -1,11 +1,15 @@ -error[E0277]: the trait bound `T: Foo` is not satisfied - --> $DIR/associated-const-generic-obligations.rs:14:5 +error[E0326]: implemented const `FROM` has an incompatible type for trait + --> $DIR/associated-const-generic-obligations.rs:14:17 | +LL | const FROM: Self::Out; + | --------- type in trait +... LL | const FROM: &'static str = "foo"; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T` + | ^^^^^^^^^^^^ expected associated type, found reference | - = help: consider adding a `where T: Foo` bound + = note: expected type `::Out` + found type `&'static str` error: aborting due to previous error -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0326`. diff --git a/src/test/ui/associated-const/associated-const-trait-bound.rs b/src/test/ui/associated-const/associated-const-trait-bound.rs new file mode 100644 index 000000000000..0ce46d312afe --- /dev/null +++ b/src/test/ui/associated-const/associated-const-trait-bound.rs @@ -0,0 +1,21 @@ +// compile-pass + +trait ConstDefault { + const DEFAULT: Self; +} + +trait Foo: Sized {} + +trait FooExt: Foo { + type T: ConstDefault; +} + +trait Bar { + const T: F::T; +} + +impl Bar for () { + const T: F::T = ::DEFAULT; +} + +fn main() {} diff --git a/src/test/ui/nll/trait-associated-constant.rs b/src/test/ui/nll/trait-associated-constant.rs index 9d3e1a690f00..2ba65e10ea70 100644 --- a/src/test/ui/nll/trait-associated-constant.rs +++ b/src/test/ui/nll/trait-associated-constant.rs @@ -26,7 +26,6 @@ struct FailStruct2 { } impl<'a: 'b, 'b> Anything<'a, 'b> for FailStruct2 { const AC: Option<&'a str> = None; - //~^ ERROR: mismatched types } fn main() {} diff --git a/src/test/ui/nll/trait-associated-constant.stderr b/src/test/ui/nll/trait-associated-constant.stderr index 78ef513f3eec..786ca8e19e4c 100644 --- a/src/test/ui/nll/trait-associated-constant.stderr +++ b/src/test/ui/nll/trait-associated-constant.stderr @@ -17,25 +17,6 @@ note: ...does not necessarily outlive the lifetime 'b as defined on the impl at LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct1 { | ^^ -error[E0308]: mismatched types - --> $DIR/trait-associated-constant.rs:28:5 - | -LL | const AC: Option<&'a str> = None; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch - | - = note: expected type `std::option::Option<&'b str>` - found type `std::option::Option<&'a str>` -note: the lifetime 'a as defined on the impl at 27:6... - --> $DIR/trait-associated-constant.rs:27:6 - | -LL | impl<'a: 'b, 'b> Anything<'a, 'b> for FailStruct2 { - | ^^ -note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 27:14 - --> $DIR/trait-associated-constant.rs:27:14 - | -LL | impl<'a: 'b, 'b> Anything<'a, 'b> for FailStruct2 { - | ^^ - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. From 01e2e1f88f4e1d82060aba4a01a6cae0343d3b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sun, 10 Mar 2019 10:11:15 +0100 Subject: [PATCH 333/381] Remove precompute_in_scope_traits_hashes --- src/librustc/ty/context.rs | 10 ---------- src/librustc_incremental/persist/load.rs | 1 - 2 files changed, 11 deletions(-) diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index b705968ce8ae..08b595c5eaa5 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1443,16 +1443,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - // This method exercises the `in_scope_traits_map` query for all possible - // values so that we have their fingerprints available in the DepGraph. - // This is only required as long as we still use the old dependency tracking - // which needs to have the fingerprints of all input nodes beforehand. - pub fn precompute_in_scope_traits_hashes(self) { - for &def_index in self.trait_map.keys() { - self.in_scope_traits_map(def_index); - } - } - pub fn serialize_query_result_cache(self, encoder: &mut E) -> Result<(), E::Error> diff --git a/src/librustc_incremental/persist/load.rs b/src/librustc_incremental/persist/load.rs index 429503469295..255a3899d118 100644 --- a/src/librustc_incremental/persist/load.rs +++ b/src/librustc_incremental/persist/load.rs @@ -21,7 +21,6 @@ pub fn dep_graph_tcx_init<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { } tcx.allocate_metadata_dep_nodes(); - tcx.precompute_in_scope_traits_hashes(); } type WorkProductMap = FxHashMap; From 749e9d460a14da95a77072b259441e3ea2539244 Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Mon, 11 Mar 2019 22:31:25 +0900 Subject: [PATCH 334/381] added a function for reducing repetition of bit operation --- src/librustc/mir/interpret/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 0c43fe4a79fa..c07b8e236fab 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -434,3 +434,9 @@ pub fn truncate(value: u128, size: Size) -> u128 { // truncate (shift left to drop out leftover values, shift right to fill with zeroes) (value << shift) >> shift } + +pub fn mask(size: Size) -> u128 { + let size = size.bits(); + let shift = 128 - size; + !0u128 >> shift +} From 4c9f7a08e5a92745772eb50b3c8f0612cc476c6b Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Mon, 11 Mar 2019 22:32:27 +0900 Subject: [PATCH 335/381] reduced some code repetitions of bit operation --- src/librustc_mir/build/matches/simplify.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/librustc_mir/build/matches/simplify.rs b/src/librustc_mir/build/matches/simplify.rs index 01f8cbfbe8e2..a69192468252 100644 --- a/src/librustc_mir/build/matches/simplify.rs +++ b/src/librustc_mir/build/matches/simplify.rs @@ -19,6 +19,7 @@ use rustc::ty; use rustc::ty::layout::{Integer, IntegerExt, Size}; use syntax::attr::{SignedInt, UnsignedInt}; use rustc::hir::RangeEnd; +use rustc::mir::interpret::mask; use std::mem; @@ -115,14 +116,14 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ty::Int(ity) => { // FIXME(49937): refactor these bit manipulations into interpret. let size = Integer::from_attr(&tcx, SignedInt(ity)).size(); - let max = !0u128 >> (128 - size.bits()); + let max = mask(size); let bias = 1u128 << (size.bits() - 1); (Some((0, max, size)), bias) } ty::Uint(uty) => { // FIXME(49937): refactor these bit manipulations into interpret. let size = Integer::from_attr(&tcx, UnsignedInt(uty)).size(); - let max = !0u128 >> (128 - size.bits()); + let max = mask(size); (Some((0, max, size)), 0) } _ => (None, 0), From c99303351dd67df8657d9f11ca00d65dcceb8438 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 11 Mar 2019 15:14:24 +0100 Subject: [PATCH 336/381] Revised warning-downgrade strategy for nested impl trait. Instead of a sticky-boolean flag that would downgrade errors to warnings during further recursion into the type (which is overly broad because we were not missing errors at arbitrarily deep levels), this instead tracks state closer to what the original bug actually was. In particular, the actual original bug was that we were failing to record the existence of an outer `impl Trait` solely when it occurred as an *immediate child* during the walk of the child types in `visit_generic_args`. Therefore, the correct way to precisely model when that bug would manifest itself (and thus downgrade the error-to-warning accordingly) is to track when those outer `impl Trait` cases were previously unrecorded. That's what this code does, by storing a flag with the recorded outer `impl Trait` indicating at which point in the compiler's control flow it had been stored. I will note that this commit passes the current test suite. A follow-up commit will also include tests illustrating the cases that this commit gets right (and were handled incorrectly by the previous sticky boolean). --- src/librustc_passes/ast_validation.rs | 104 +++++++++++++++++++------- 1 file changed, 77 insertions(+), 27 deletions(-) diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index d5b02de96989..1dc589215929 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -24,6 +24,31 @@ use syntax_pos::Span; use errors::Applicability; use log::debug; +#[derive(Copy, Clone, Debug)] +struct OuterImplTrait { + span: Span, + + /// rust-lang/rust#57979: a bug in original implementation caused + /// us to fail sometimes to record an outer `impl Trait`. + /// Therefore, in order to reliably issue a warning (rather than + /// an error) in the *precise* places where we are newly injecting + /// the diagnostic, we have to distinguish between the places + /// where the outer `impl Trait` has always been recorded, versus + /// the places where it has only recently started being recorded. + only_recorded_since_pull_request_57730: bool, +} + +impl OuterImplTrait { + /// This controls whether we should downgrade the nested impl + /// trait diagnostic to a warning rather than an error, based on + /// whether the outer impl trait had been improperly skipped in + /// earlier implementations of the analysis on the stable + /// compiler. + fn should_warn_instead_of_error(&self) -> bool { + self.only_recorded_since_pull_request_57730 + } +} + struct AstValidator<'a> { session: &'a Session, has_proc_macro_decls: bool, @@ -32,7 +57,7 @@ struct AstValidator<'a> { // Used to ban nested `impl Trait`, e.g., `impl Into`. // Nested `impl Trait` _is_ allowed in associated type position, // e.g `impl Iterator` - outer_impl_trait: Option, + outer_impl_trait: Option, // Used to ban `impl Trait` in path projections like `::Item` // or `Foo::Bar` @@ -44,18 +69,11 @@ struct AstValidator<'a> { // impl trait in projections), and thus miss some cases. We track // whether we should downgrade to a warning for short-term via // these booleans. - warning_period_57979_nested_impl_trait: bool, + warning_period_57979_didnt_record_next_impl_trait: bool, warning_period_57979_impl_trait_in_proj: bool, } impl<'a> AstValidator<'a> { - fn with_nested_impl_trait_warning(&mut self, v: bool, f: impl FnOnce(&mut Self) -> T) -> T { - let old = mem::replace(&mut self.warning_period_57979_nested_impl_trait, v); - let ret = f(self); - self.warning_period_57979_nested_impl_trait = old; - ret - } - fn with_impl_trait_in_proj_warning(&mut self, v: bool, f: impl FnOnce(&mut Self) -> T) -> T { let old = mem::replace(&mut self.warning_period_57979_impl_trait_in_proj, v); let ret = f(self); @@ -69,17 +87,53 @@ impl<'a> AstValidator<'a> { self.is_impl_trait_banned = old; } - fn with_impl_trait(&mut self, outer_impl_trait: Option, f: impl FnOnce(&mut Self)) { - let old = mem::replace(&mut self.outer_impl_trait, outer_impl_trait); + fn with_impl_trait(&mut self, outer: Option, f: impl FnOnce(&mut Self)) { + let old = mem::replace(&mut self.outer_impl_trait, outer); f(self); self.outer_impl_trait = old; } + fn visit_assoc_type_binding_from_generic_args(&mut self, type_binding: &'a TypeBinding) { + // rust-lang/rust#57979: bug in old visit_generic_args called + // walk_ty rather than visit_ty, skipping outer `impl Trait` + // if it happened to occur at `type_binding.ty` + if let TyKind::ImplTrait(..) = type_binding.ty.node { + self.warning_period_57979_didnt_record_next_impl_trait = true; + } + self.visit_assoc_type_binding(type_binding); + } + + fn visit_ty_from_generic_args(&mut self, ty: &'a Ty) { + // rust-lang/rust#57979: bug in old visit_generic_args called + // walk_ty rather than visit_ty, skippping outer `impl Trait` + // if it happened to occur at `ty` + if let TyKind::ImplTrait(..) = ty.node { + self.warning_period_57979_didnt_record_next_impl_trait = true; + } + self.visit_ty(ty); + } + + fn outer_impl_trait(&mut self, span: Span) -> OuterImplTrait { + let only_recorded_since_pull_request_57730 = + self.warning_period_57979_didnt_record_next_impl_trait; + + // (this flag is designed to be set to true and then only + // reach the construction point for the outer impl trait once, + // so its safe and easiest to unconditionally reset it to + // false) + self.warning_period_57979_didnt_record_next_impl_trait = false; + + OuterImplTrait { + span, only_recorded_since_pull_request_57730, + } + } + // Mirrors visit::walk_ty, but tracks relevant state fn walk_ty(&mut self, t: &'a Ty) { match t.node { TyKind::ImplTrait(..) => { - self.with_impl_trait(Some(t.span), |this| visit::walk_ty(this, t)) + let outer_impl_trait = self.outer_impl_trait(t.span); + self.with_impl_trait(Some(outer_impl_trait), |this| visit::walk_ty(this, t)) } TyKind::Path(ref qself, ref path) => { // We allow these: @@ -441,18 +495,18 @@ impl<'a> Visitor<'a> for AstValidator<'a> { } if let Some(outer_impl_trait) = self.outer_impl_trait { - if self.warning_period_57979_nested_impl_trait { + if outer_impl_trait.should_warn_instead_of_error() { self.session.buffer_lint_with_diagnostic( NESTED_IMPL_TRAIT, ty.id, ty.span, "nested `impl Trait` is not allowed", BuiltinLintDiagnostics::NestedImplTrait { - outer_impl_trait_span: outer_impl_trait, + outer_impl_trait_span: outer_impl_trait.span, inner_impl_trait_span: ty.span, }); } else { struct_span_err!(self.session, ty.span, E0666, "nested `impl Trait` is not allowed") - .span_label(outer_impl_trait, "outer `impl Trait`") + .span_label(outer_impl_trait.span, "outer `impl Trait`") .span_label(ty.span, "nested `impl Trait` here") .emit(); } @@ -650,22 +704,18 @@ impl<'a> Visitor<'a> for AstValidator<'a> { }, arg.span(), None) }), GenericPosition::Arg, generic_args.span()); - self.with_nested_impl_trait_warning(true, |this| { - // Type bindings such as `Item=impl Debug` in `Iterator` - // are allowed to contain nested `impl Trait`. - this.with_impl_trait(None, |this| { - walk_list!(this, visit_assoc_type_binding, &data.bindings); - }); + // Type bindings such as `Item=impl Debug` in `Iterator` + // are allowed to contain nested `impl Trait`. + self.with_impl_trait(None, |this| { + walk_list!(this, visit_assoc_type_binding_from_generic_args, &data.bindings); }); } GenericArgs::Parenthesized(ref data) => { walk_list!(self, visit_ty, &data.inputs); if let Some(ref type_) = data.output { - self.with_nested_impl_trait_warning(true, |this| { - // `-> Foo` syntax is essentially an associated type binding, - // so it is also allowed to contain nested `impl Trait`. - this.with_impl_trait(None, |this| this.visit_ty(type_)); - }); + // `-> Foo` syntax is essentially an associated type binding, + // so it is also allowed to contain nested `impl Trait`. + self.with_impl_trait(None, |this| this.visit_ty_from_generic_args(type_)); } } } @@ -767,7 +817,7 @@ pub fn check_crate(session: &Session, krate: &Crate) -> (bool, bool) { has_global_allocator: false, outer_impl_trait: None, is_impl_trait_banned: false, - warning_period_57979_nested_impl_trait: false, + warning_period_57979_didnt_record_next_impl_trait: false, warning_period_57979_impl_trait_in_proj: false, }; visit::walk_crate(&mut validator, krate); From 837856d120ec3350f1e9d194801a6a89e5d71630 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 11 Mar 2019 16:30:40 +0100 Subject: [PATCH 337/381] Test illustrating that the nested_impl_trait lint should only catch shallow cases. --- ...-deeply-nested-impl-trait-in-assoc-proj.rs | 42 +++++++++++++++++++ ...ply-nested-impl-trait-in-assoc-proj.stderr | 30 +++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs create mode 100644 src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr diff --git a/src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs b/src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs new file mode 100644 index 000000000000..5eef6a39325f --- /dev/null +++ b/src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs @@ -0,0 +1,42 @@ +// rust-lang/rust#57979 : the initial support for `impl Trait` didn't +// properly check syntax hidden behind an associated type projection, +// but it did catch *some cases*. This is checking that we continue to +// properly emit errors for those, even with the new +// future-incompatibility warnings. +// +// issue-57979-nested-impl-trait-in-assoc-proj.rs shows the main case +// that we were previously failing to catch. + +struct Deeper(T); + +mod allowed { + #![allow(nested_impl_trait)] + + pub trait Foo { } + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux>>) { } + //~^ ERROR nested `impl Trait` is not allowed +} + +mod warned { + #![warn(nested_impl_trait)] + + pub trait Foo { } + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux>>) { } + //~^ ERROR nested `impl Trait` is not allowed +} + +mod denied { + #![deny(nested_impl_trait)] + + pub trait Foo { } + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux>>) { } + //~^ ERROR nested `impl Trait` is not allowed +} + +fn main() { } diff --git a/src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr b/src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr new file mode 100644 index 000000000000..2b6f15e6d3eb --- /dev/null +++ b/src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr @@ -0,0 +1,30 @@ +error[E0666]: nested `impl Trait` is not allowed + --> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:18:59 + | +LL | pub fn demo(_: impl Quux>>) { } + | ---------^^^^^^^^- + | | | + | | nested `impl Trait` here + | outer `impl Trait` + +error[E0666]: nested `impl Trait` is not allowed + --> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:28:59 + | +LL | pub fn demo(_: impl Quux>>) { } + | ---------^^^^^^^^- + | | | + | | nested `impl Trait` here + | outer `impl Trait` + +error[E0666]: nested `impl Trait` is not allowed + --> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:38:59 + | +LL | pub fn demo(_: impl Quux>>) { } + | ---------^^^^^^^^- + | | | + | | nested `impl Trait` here + | outer `impl Trait` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0666`. From 0ede9e61e2f483f93ad9ba9e6d4c19fbfc127cd0 Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Tue, 12 Mar 2019 01:06:12 +0900 Subject: [PATCH 338/381] replaced some bit operations with truncate --- src/librustc_mir/build/matches/simplify.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_mir/build/matches/simplify.rs b/src/librustc_mir/build/matches/simplify.rs index a69192468252..d60a0941b597 100644 --- a/src/librustc_mir/build/matches/simplify.rs +++ b/src/librustc_mir/build/matches/simplify.rs @@ -19,7 +19,7 @@ use rustc::ty; use rustc::ty::layout::{Integer, IntegerExt, Size}; use syntax::attr::{SignedInt, UnsignedInt}; use rustc::hir::RangeEnd; -use rustc::mir::interpret::mask; +use rustc::mir::interpret::truncate; use std::mem; @@ -116,14 +116,14 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ty::Int(ity) => { // FIXME(49937): refactor these bit manipulations into interpret. let size = Integer::from_attr(&tcx, SignedInt(ity)).size(); - let max = mask(size); + let max = truncate(u128::max_value(), size); let bias = 1u128 << (size.bits() - 1); (Some((0, max, size)), bias) } ty::Uint(uty) => { // FIXME(49937): refactor these bit manipulations into interpret. let size = Integer::from_attr(&tcx, UnsignedInt(uty)).size(); - let max = mask(size); + let max = truncate(u128::max_value(), size); (Some((0, max, size)), 0) } _ => (None, 0), From 18b40c64136aedb78a494c0c7e44273353198b0e Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Tue, 12 Mar 2019 01:15:05 +0900 Subject: [PATCH 339/381] removed the definition of mask --- src/librustc/mir/interpret/mod.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index c07b8e236fab..0c43fe4a79fa 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -434,9 +434,3 @@ pub fn truncate(value: u128, size: Size) -> u128 { // truncate (shift left to drop out leftover values, shift right to fill with zeroes) (value << shift) >> shift } - -pub fn mask(size: Size) -> u128 { - let size = size.bits(); - let shift = 128 - size; - !0u128 >> shift -} From 2060d49c39e41a286b0425cb2f7ba6022a2d4b96 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 9 Mar 2019 14:29:55 +0300 Subject: [PATCH 340/381] compiletest: Filter away test annotations from UI test output --- src/tools/compiletest/src/runtest.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index bac41a7c5790..68ecc0527bc7 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3083,6 +3083,12 @@ impl<'test> TestCx<'test> { .replace("\\", "/") // normalize for paths on windows .replace("\r\n", "\n") // normalize for linebreaks on windows .replace("\t", "\\t"); // makes tabs visible + + // Remove test annotations like `//~ ERROR text` from the output, + // since they duplicate actual errors and make the output hard to read. + normalized = Regex::new("\\s*//~.*").unwrap() + .replace_all(&normalized, "").into_owned(); + for rule in custom_rules { let re = Regex::new(&rule.0).expect("bad regex in custom normalization rule"); normalized = re.replace_all(&normalized, &rule.1[..]).into_owned(); From fa72a81bea27f1fda4287475e4cc2f684c971e7f Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 9 Mar 2019 15:03:44 +0300 Subject: [PATCH 341/381] Update tests --- .../deny-intra-link-resolution-failure.stderr | 2 +- .../rustdoc-ui/deny-missing-docs-crate.stderr | 8 +- .../rustdoc-ui/deny-missing-docs-macro.stderr | 2 +- .../rustdoc-ui/intra-doc-alias-ice.stderr | 2 +- .../dropck_tarena_cycle_checked.stderr | 2 +- .../dropck_tarena_unsound_drop.stderr | 2 +- src/test/ui-fulldeps/issue-15778-fail.stderr | 2 +- .../lint-group-plugin-deny-cmdline.stderr | 4 +- src/test/ui-fulldeps/lint-group-plugin.stderr | 4 +- .../lint-plugin-cmdline-load.stderr | 2 +- .../ui-fulldeps/lint-plugin-deny-attr.stderr | 2 +- .../lint-plugin-deny-cmdline.stderr | 2 +- .../lint-plugin-forbid-attrs.stderr | 2 +- .../lint-plugin-forbid-cmdline.stderr | 4 +- src/test/ui-fulldeps/lint-plugin.stderr | 2 +- src/test/ui-fulldeps/lint_tool_test.stderr | 6 +- .../ui-fulldeps/plugin-as-extern-crate.stderr | 2 +- src/test/ui/E0508.stderr | 2 +- src/test/ui/E0583.stderr | 2 +- src/test/ui/E0642.stderr | 12 +- src/test/ui/E0662.stderr | 2 +- src/test/ui/E0663.stderr | 2 +- src/test/ui/E0664.stderr | 2 +- src/test/ui/E0665.stderr | 2 +- ...absolute-paths-in-nested-use-groups.stderr | 6 +- src/test/ui/access-mode-in-closures.stderr | 2 +- ...alloc-error-handler-bad-signature-1.stderr | 4 +- ...alloc-error-handler-bad-signature-2.stderr | 4 +- ...alloc-error-handler-bad-signature-3.stderr | 2 +- src/test/ui/allocator-submodule.stderr | 2 +- .../ui/allocator/function-allocator.stderr | 2 +- src/test/ui/anon-params-denied-2018.stderr | 2 +- src/test/ui/anon-params-deprecated.stderr | 2 +- .../anonymous-higher-ranked-lifetime.stderr | 44 ++-- src/test/ui/array-break-length.stderr | 4 +- src/test/ui/asm/asm-in-bad-modifier.stderr | 4 +- src/test/ui/asm/asm-out-no-modifier.stderr | 2 +- src/test/ui/asm/asm-parse-errors.stderr | 22 +- src/test/ui/assign-to-method.stderr | 4 +- .../assignment-operator-unimplemented.stderr | 2 +- src/test/ui/assoc-inherent.stderr | 2 +- .../associated-const-ambiguity-report.stderr | 2 +- .../associated-item-duplicate-names-2.stderr | 2 +- .../associated-item-duplicate-names-3.stderr | 2 +- .../associated-item-duplicate-names.stderr | 4 +- src/test/ui/associated-path-shl.stderr | 12 +- ...ted-type-projection-from-supertrait.stderr | 8 +- ...nding-to-type-defined-in-supertrait.stderr | 4 +- .../associated-types-bound-failure.stderr | 2 +- .../associated-types-eq-1.stderr | 2 +- .../associated-types-eq-hr.stderr | 4 +- .../associated-types-issue-17359.stderr | 2 +- .../associated-types-issue-20346.stderr | 2 +- ...ated-types-multiple-types-one-trait.stderr | 4 +- .../associated-types-outlives.stderr | 2 +- ...associated-types-overridden-binding.stderr | 2 +- .../associated-types-path-1.stderr | 4 +- .../associated-types-subtyping-1.stderr | 4 +- .../associated-types-unsized.stderr | 2 +- src/test/ui/attempted-access-non-fatal.stderr | 4 +- src/test/ui/attr-eq-token-tree.stderr | 2 +- src/test/ui/attr-usage-inline.stderr | 2 +- src/test/ui/attr-usage-repr.stderr | 8 +- ...-with-no-generics-in-parameter-list.stderr | 2 +- src/test/ui/augmented-assignments.stderr | 6 +- src/test/ui/auto-ref-slice-plus-ref.stderr | 8 +- .../await-keyword/2018-edition-error.stderr | 12 +- src/test/ui/bad/bad-expr-lhs.stderr | 10 +- src/test/ui/bad/bad-expr-path.stderr | 2 +- src/test/ui/bad/bad-expr-path2.stderr | 2 +- src/test/ui/bad/bad-extern-link-attrs.stderr | 6 +- src/test/ui/bad/bad-lint-cap2.stderr | 2 +- src/test/ui/bad/bad-lint-cap3.stderr | 2 +- src/test/ui/bad/bad-main.stderr | 2 +- .../ui/bad/bad-method-typaram-kind.stderr | 2 +- src/test/ui/bad/bad-type-env-capture.stderr | 2 +- ...can-live-while-the-other-survives-2.stderr | 2 +- ...can-live-while-the-other-survives-4.stderr | 2 +- src/test/ui/binop/binop-consume-args.stderr | 60 +++--- src/test/ui/binop/binop-move-semantics.stderr | 16 +- .../block-must-not-have-result-do.stderr | 2 +- .../block-must-not-have-result-res.stderr | 2 +- .../block-must-not-have-result-while.stderr | 2 +- .../consider-removing-last-semi.stderr | 4 +- src/test/ui/block-result/issue-11714.stderr | 2 +- src/test/ui/block-result/issue-13428.stderr | 4 +- src/test/ui/block-result/issue-20862.stderr | 2 +- src/test/ui/block-result/issue-22645.stderr | 4 +- .../unexpected-return-on-unit.stderr | 4 +- .../ui/borrowck/assign_mutable_fields.stderr | 6 +- .../borrow-immutable-upvar-mutation.stderr | 24 +-- .../ui/borrowck/borrow-tuple-fields.stderr | 12 +- src/test/ui/borrowck/borrowck-and-init.stderr | 2 +- .../borrowck-anon-fields-struct.stderr | 2 +- .../borrowck-anon-fields-tuple.stderr | 2 +- .../borrowck-anon-fields-variant.stderr | 2 +- src/test/ui/borrowck/borrowck-argument.stderr | 8 +- .../borrowck/borrowck-assign-comp-idx.stderr | 4 +- ...k-assign-to-andmut-in-aliasable-loc.stderr | 4 +- ...ck-assign-to-andmut-in-borrowed-loc.stderr | 2 +- .../borrowck-auto-mut-ref-to-immut-var.stderr | 2 +- .../ui/borrowck/borrowck-autoref-3261.stderr | 2 +- .../borrowck-bad-nested-calls-free.stderr | 4 +- .../borrowck-bad-nested-calls-move.stderr | 4 +- .../ui/borrowck/borrowck-block-unint.stderr | 2 +- .../borrowck-borrow-from-owned-ptr.stderr | 30 +-- ...borrowck-borrow-from-stack-variable.stderr | 22 +- .../borrowck-borrow-from-temporary.stderr | 2 +- ...orrow-mut-base-ptr-in-aliasable-loc.stderr | 6 +- .../borrowck-borrow-mut-object-twice.stderr | 2 +- ...rrowck-borrow-overloaded-auto-deref.stderr | 28 +-- .../borrowck-borrow-overloaded-deref.stderr | 14 +- .../borrowck-borrowed-uniq-rvalue-2.stderr | 2 +- .../borrowck-borrowed-uniq-rvalue.stderr | 2 +- .../borrowck/borrowck-break-uninit-2.stderr | 2 +- .../ui/borrowck/borrowck-break-uninit.stderr | 2 +- .../borrowck-closures-mut-of-imm.stderr | 2 +- .../borrowck-closures-two-mut-fail.stderr | 6 +- .../borrowck/borrowck-closures-two-mut.stderr | 18 +- .../borrowck-closures-unique-imm.stderr | 2 +- .../borrowck/borrowck-closures-unique.stderr | 14 +- .../borrowck-closures-use-after-free.stderr | 2 +- .../borrowck-consume-unsize-vec.stderr | 2 +- .../borrowck-consume-upcast-box.stderr | 2 +- .../borrowck/borrowck-drop-from-guard.stderr | 2 +- .../borrowck-field-sensitivity.stderr | 28 +-- .../ui/borrowck/borrowck-fn-in-const-c.stderr | 2 +- ...ck-for-loop-correct-cmt-for-pattern.stderr | 6 +- .../borrowck-for-loop-head-linkage.stderr | 4 +- .../ui/borrowck/borrowck-if-no-else.stderr | 2 +- .../ui/borrowck/borrowck-if-with-else.stderr | 2 +- .../ui/borrowck/borrowck-in-static.stderr | 2 +- .../borrowck-init-in-called-fn-expr.stderr | 2 +- .../borrowck/borrowck-init-in-fn-expr.stderr | 2 +- .../ui/borrowck/borrowck-init-op-equal.stderr | 2 +- .../borrowck/borrowck-init-plus-equal.stderr | 2 +- .../borrowck-insert-during-each.stderr | 2 +- .../ui/borrowck/borrowck-issue-2657-1.stderr | 2 +- .../ui/borrowck/borrowck-issue-2657-2.stderr | 2 +- .../ui/borrowck/borrowck-issue-48962.stderr | 4 +- .../ui/borrowck/borrowck-lend-flow-if.stderr | 2 +- .../ui/borrowck/borrowck-lend-flow.stderr | 2 +- .../borrowck/borrowck-loan-blocks-move.stderr | 2 +- .../borrowck-loan-blocks-mut-uniq.stderr | 2 +- ...wck-loan-of-static-data-issue-27616.stderr | 2 +- .../borrowck-loan-rcvr-overloaded-op.stderr | 4 +- .../ui/borrowck/borrowck-loan-rcvr.stderr | 4 +- .../borrowck/borrowck-loan-vec-content.stderr | 2 +- .../borrowck/borrowck-move-by-capture.stderr | 2 +- .../borrowck-move-error-with-note.stderr | 12 +- ...-move-from-subpath-of-borrowed-path.stderr | 2 +- .../borrowck-move-from-unsafe-ptr.stderr | 2 +- .../borrowck-move-mut-base-ptr.stderr | 2 +- .../borrowck-move-out-of-vec-tail.stderr | 6 +- .../borrowck-move-subcomponent.stderr | 2 +- .../borrowck-multiple-captures.stderr | 20 +- .../borrowck-mut-addr-of-imm-var.stderr | 2 +- ...borrowck-mut-borrow-of-mut-base-ptr.stderr | 4 +- .../borrowck-mut-slice-of-imm-vec.stderr | 2 +- .../borrowck-no-cycle-in-exchange-heap.stderr | 2 +- .../borrowck/borrowck-object-lifetime.stderr | 4 +- src/test/ui/borrowck/borrowck-or-init.stderr | 2 +- .../borrowck/borrowck-overloaded-call.stderr | 6 +- ...borrowck-overloaded-index-autoderef.stderr | 16 +- .../borrowck-reborrow-from-mut.stderr | 22 +- .../borrowck/borrowck-ref-mut-of-imm.stderr | 2 +- src/test/ui/borrowck/borrowck-reinit.stderr | 4 +- ...rowck-report-with-custom-diagnostic.stderr | 12 +- ...-return-variable-on-stack-via-clone.stderr | 2 +- src/test/ui/borrowck/borrowck-return.stderr | 2 +- ...borrowck-slice-pattern-element-loan.stderr | 22 +- .../ui/borrowck/borrowck-storage-dead.stderr | 4 +- .../borrowck-swap-mut-base-ptr.stderr | 2 +- .../borrowck/borrowck-unboxed-closures.stderr | 6 +- .../borrowck-uninit-after-item.stderr | 2 +- .../borrowck-uninit-in-assignop.stderr | 20 +- src/test/ui/borrowck/borrowck-uninit.stderr | 2 +- .../borrowck-union-borrow-nested.stderr | 2 +- .../ui/borrowck/borrowck-union-borrow.stderr | 24 +-- .../borrowck-union-move-assign.stderr | 2 +- .../ui/borrowck/borrowck-union-move.stderr | 12 +- .../borrowck-union-uninitialized.stderr | 4 +- .../ui/borrowck/borrowck-uniq-via-lend.stderr | 4 +- .../borrowck/borrowck-use-mut-borrow.stderr | 18 +- .../borrowck-vec-pattern-element-loan.stderr | 6 +- .../borrowck-vec-pattern-loan-from-mut.stderr | 2 +- .../borrowck-vec-pattern-nesting.stderr | 26 +-- ...rowck-vec-pattern-tail-element-loan.stderr | 2 +- .../ui/borrowck/borrowck-while-break.stderr | 2 +- .../ui/borrowck/borrowck-while-cond.stderr | 2 +- src/test/ui/borrowck/borrowck-while.stderr | 2 +- .../borrowck/index-mut-help-with-impl.stderr | 2 +- src/test/ui/borrowck/index-mut-help.stderr | 6 +- .../issue-47215-ice-from-drop-elab.stderr | 2 +- src/test/ui/borrowck/issue-51117.stderr | 2 +- src/test/ui/borrowck/issue-52713-bug.stderr | 2 +- ...7-reject-move-out-of-borrow-via-pat.stderr | 2 +- src/test/ui/borrowck/issue-7573.stderr | 2 +- .../ui/borrowck/mut-borrow-in-loop.stderr | 6 +- .../ui/borrowck/mut-borrow-of-mut-ref.stderr | 4 +- .../borrowck/mut-borrow-outside-loop.stderr | 4 +- src/test/ui/borrowck/mutability-errors.stderr | 122 +++++------ .../promote-ref-mut-in-let-issue-46557.stderr | 10 +- .../reassignment_immutable_fields.stderr | 18 +- ...gnment_immutable_fields_overlapping.stderr | 6 +- ...reassignment_immutable_fields_twice.stderr | 10 +- .../ui/borrowck/two-phase-across-loop.stderr | 2 +- ...-reservation-sharing-interference-2.stderr | 2 +- src/test/ui/bounds-lifetime.stderr | 10 +- src/test/ui/break-outside-loop.stderr | 10 +- src/test/ui/break-while-condition.stderr | 6 +- src/test/ui/by-move-pattern-binding.stderr | 2 +- src/test/ui/c-variadic/variadic-ffi-1.stderr | 2 +- src/test/ui/c-variadic/variadic-ffi-3.stderr | 16 +- src/test/ui/c-variadic/variadic-ffi-4.stderr | 82 +++---- src/test/ui/c-variadic/variadic-ffi-5.stderr | 8 +- src/test/ui/c-variadic/variadic-ffi-6.stderr | 2 +- .../ui/call-fn-never-arg-wrong-type.stderr | 2 +- src/test/ui/can-begin-expr-check.stderr | 2 +- src/test/ui/cast/cast-as-bool.stderr | 6 +- .../ui/cast/cast-errors-issue-43825.stderr | 2 +- src/test/ui/cast/cast-ptr-to-int-const.stderr | 4 +- ...-to-unsized-trait-object-suggestion.stderr | 4 +- src/test/ui/casts-differing-anon.stderr | 2 +- src/test/ui/casts-issue-46365.stderr | 2 +- src/test/ui/chalkify/lower_env1.stderr | 4 +- src/test/ui/chalkify/lower_env2.stderr | 4 +- src/test/ui/chalkify/lower_env3.stderr | 4 +- src/test/ui/chalkify/lower_impl.stderr | 4 +- src/test/ui/chalkify/lower_struct.stderr | 2 +- src/test/ui/chalkify/lower_trait.stderr | 4 +- .../chalkify/lower_trait_higher_rank.stderr | 2 +- .../chalkify/lower_trait_where_clause.stderr | 2 +- src/test/ui/chalkify/type_inference.stderr | 4 +- src/test/ui/changing-crates.stderr | 2 +- .../ui/check-static-values-constraints.stderr | 18 +- src/test/ui/check_match/issue-35609.stderr | 16 +- src/test/ui/class-cast-to-trait.stderr | 2 +- src/test/ui/class-missing-self.stderr | 4 +- src/test/ui/cleanup-rvalue-scopes-cf.stderr | 16 +- ...er-vars-supply-ty-with-bound-region.stderr | 2 +- .../closure_context/issue-26046-fn-mut.stderr | 2 +- .../issue-26046-fn-once.stderr | 2 +- src/test/ui/closure_promotion.stderr | 2 +- .../closure-array-break-length.stderr | 6 +- ...ds-cant-promote-superkind-in-struct.stderr | 2 +- .../ui/closures/closure-bounds-subtype.stderr | 2 +- .../expect-region-supply-region.stderr | 16 +- .../closure-immutable-outer-variable.stderr | 2 +- ...sure-referencing-itself-issue-25954.stderr | 2 +- .../ui/closures/closure-reform-bad.stderr | 2 +- .../ui/closures/closure-wrong-kind.stderr | 2 +- .../ui/codemap_tests/bad-format-args.stderr | 6 +- ...nce-overlapping-inherent-impl-trait.stderr | 2 +- src/test/ui/codemap_tests/empty_span.stderr | 2 +- .../huge_multispan_highlight.stderr | 2 +- src/test/ui/codemap_tests/issue-11715.stderr | 2 +- src/test/ui/codemap_tests/one_line.stderr | 2 +- .../overlapping_inherent_impls.stderr | 6 +- src/test/ui/codemap_tests/tab.stderr | 4 +- src/test/ui/codemap_tests/tab_2.stderr | 2 +- src/test/ui/codemap_tests/tab_3.stderr | 2 +- src/test/ui/codemap_tests/two_files.stderr | 2 +- src/test/ui/codemap_tests/unicode.stderr | 2 +- src/test/ui/codemap_tests/unicode_2.stderr | 6 +- .../coerce-expect-unsized-ascribed.stderr | 24 +-- .../ui/coercion/coerce-to-bang-cast.stderr | 2 +- src/test/ui/coercion/coerce-to-bang.stderr | 14 +- ...coercion-missing-tail-expected-type.stderr | 4 +- ...mpl-trait-for-marker-trait-negative.stderr | 10 +- ...mpl-trait-for-marker-trait-positive.stderr | 10 +- .../proj-outlives-region.stderr | 2 +- .../ui/compare-method/region-extra.stderr | 2 +- .../reordered-type-param.stderr | 2 +- .../trait-bound-on-type-parameter.stderr | 2 +- src/test/ui/compile_error_macro.stderr | 2 +- src/test/ui/concat.stderr | 8 +- .../cfg-attr-crate-2.stderr | 2 +- .../cfg-attr-invalid-predicate.stderr | 2 +- .../cfg-attr-multi-invalid-1.stderr | 2 +- .../cfg-attr-multi-invalid-2.stderr | 2 +- .../cfg-attr-multi-true.stderr | 10 +- .../cfg-attr-parse.stderr | 10 +- .../cfg-attr-syntax-validation.stderr | 18 +- ...r-unknown-attribute-macro-expansion.stderr | 2 +- src/test/ui/conflicting-repr-hints.stderr | 20 +- .../issue-2392.stderr | 18 +- .../issue-33784.stderr | 6 +- .../private-field.stderr | 2 +- .../const-expression-parameter.stderr | 4 +- .../const-fn-with-const-param.stderr | 2 +- .../const-param-from-outer-fn.stderr | 2 +- .../invalid-constant-in-args.stderr | 2 +- .../ui/consts/const-array-oob-arith.stderr | 4 +- .../consts/const-cast-different-types.stderr | 4 +- .../ui/consts/const-cast-wrong-type.stderr | 2 +- src/test/ui/consts/const-err-early.stderr | 10 +- ...ign-to-static-within-other-static-2.stderr | 2 +- ...ssign-to-static-within-other-static.stderr | 2 +- .../const-eval/const-eval-overflow2.stderr | 16 +- .../const-eval/const-eval-overflow2b.stderr | 16 +- .../const-eval/const-eval-overflow2c.stderr | 16 +- .../const-eval/const_raw_ptr_ops.stderr | 8 +- .../dont_promote_unstable_const_fn.stderr | 8 +- ...omote_unstable_const_fn_cross_crate.stderr | 6 +- .../ui/consts/const-eval/double_check2.stderr | 2 +- .../feature-gate-const_fn_union.stderr | 2 +- .../index_out_of_bounds_propagated.stderr | 2 +- .../ui/consts/const-eval/infinite_loop.stderr | 8 +- .../ui/consts/const-eval/issue-50814-2.stderr | 4 +- .../ui/consts/const-eval/issue-50814.stderr | 4 +- .../ui/consts/const-eval/issue-52442.stderr | 4 +- .../ui/consts/const-eval/issue-52475.stderr | 8 +- .../const-eval/match-test-ptr-null.stderr | 6 +- .../const-eval/promoted_const_fn_fail.stderr | 2 +- .../const-eval/promoted_raw_ptr_ops.stderr | 8 +- .../consts/const-eval/ref_to_int_match.stderr | 4 +- .../consts/const-eval/shift_overflow.stderr | 2 +- .../transmute-const-promotion.stderr | 2 +- .../ui/consts/const-eval/ub-upvars.stderr | 2 +- .../ui/consts/const-eval/union-ice.stderr | 6 +- .../consts/const-eval/union_promotion.stderr | 2 +- .../consts/const-fn-not-safe-for-const.stderr | 2 +- .../ui/consts/const-int-conversion.stderr | 2 +- .../ui/consts/const-int-overflowing.stderr | 8 +- src/test/ui/consts/const-int-rotate.stderr | 6 +- src/test/ui/consts/const-int-sign.stderr | 6 +- src/test/ui/consts/const-int-wrapping.stderr | 12 +- .../consts/const-pattern-irrefutable.stderr | 6 +- src/test/ui/consts/const-prop-ice.stderr | 2 +- src/test/ui/consts/const-prop-ice2.stderr | 2 +- src/test/ui/consts/const-ptr-nonnull.stderr | 2 +- src/test/ui/consts/const-ptr-unique.stderr | 2 +- src/test/ui/consts/const_let_assign3.stderr | 2 +- src/test/ui/consts/const_let_refutable.stderr | 2 +- .../ui/consts/dangling-alloc-id-ice.stderr | 2 +- src/test/ui/consts/dangling_raw_ptr.stderr | 2 +- src/test/ui/consts/issue-54224.stderr | 2 +- src/test/ui/consts/match_ice.stderr | 2 +- .../min_const_fn/bad_const_fn_body_ice.stderr | 2 +- .../min_const_fn/cmp_fn_pointers.stderr | 2 +- .../ui/consts/min_const_fn/loop_ice.stderr | 2 +- .../consts/min_const_fn/min_const_fn.stderr | 18 +- .../min_const_fn_libstd_stability.stderr | 8 +- .../min_const_fn/min_const_fn_unsafe.stderr | 4 +- ...in_const_unsafe_fn_libstd_stability.stderr | 8 +- ...n_const_unsafe_fn_libstd_stability2.stderr | 6 +- .../consts/min_const_fn/mutable_borrow.stderr | 4 +- .../ui/consts/min_const_fn/promotion.stderr | 14 +- .../consts/miri_unleashed/assoc_const.stderr | 4 +- .../miri_unleashed/assoc_const_2.stderr | 2 +- ...gate-unleash_the_miri_inside_of_you.stderr | 4 +- src/test/ui/consts/partial_qualif.stderr | 2 +- src/test/ui/consts/projection_qualif.stderr | 6 +- src/test/ui/consts/promote_const_let.stderr | 4 +- src/test/ui/consts/qualif_overwrite.stderr | 2 +- src/test/ui/consts/qualif_overwrite_2.stderr | 2 +- .../ui/consts/single_variant_match_ice.stderr | 6 +- .../ui/consts/validate_never_arrays.stderr | 2 +- src/test/ui/conversion-methods.stderr | 4 +- src/test/ui/cross/cross-borrow-trait.stderr | 2 +- src/test/ui/cross/cross-fn-cache-hole.stderr | 2 +- .../ui/custom-attribute-multisegment.stderr | 2 +- ...helper-attr-blocked-by-import-ambig.stderr | 2 +- src/test/ui/custom-derive/issue-36935.stderr | 2 +- src/test/ui/custom_attribute.stderr | 6 +- .../dep-graph-assoc-type-codegen.stderr | 2 +- .../dep-graph/dep-graph-caller-callee.stderr | 4 +- .../dep-graph-struct-signature.stderr | 44 ++-- ...h-trait-impl-two-traits-same-method.stderr | 4 +- .../dep-graph-trait-impl-two-traits.stderr | 4 +- .../ui/dep-graph/dep-graph-trait-impl.stderr | 10 +- .../ui/dep-graph/dep-graph-type-alias.stderr | 24 +-- .../dep-graph/dep-graph-variance-alias.stderr | 2 +- .../deprecated-macro_escape-inner.stderr | 2 +- .../deprecated-macro_escape.stderr | 2 +- .../deprecation-in-staged-api.stderr | 2 +- .../deprecation-lint-nested.stderr | 12 +- .../ui/deprecation/deprecation-lint.stderr | 160 +++++++------- .../ui/deprecation/deprecation-sanity.stderr | 18 +- .../ui/deprecation/invalid-literal.stderr | 2 +- .../rustc_deprecation-in-future.stderr | 2 +- src/test/ui/deref-non-pointer.stderr | 2 +- src/test/ui/deref-suggestion.stderr | 2 +- .../ui/derive-uninhabited-enum-38885.stderr | 4 +- src/test/ui/derived-errors/issue-30580.stderr | 2 +- src/test/ui/derived-errors/issue-31997.stderr | 2 +- .../derives/derive-assoc-type-not-impl.stderr | 2 +- ...ives-span-Clone-enum-struct-variant.stderr | 2 +- .../ui/derives/derives-span-Clone-enum.stderr | 2 +- .../derives/derives-span-Clone-struct.stderr | 2 +- .../derives-span-Clone-tuple-struct.stderr | 2 +- ...ives-span-Debug-enum-struct-variant.stderr | 2 +- .../ui/derives/derives-span-Debug-enum.stderr | 2 +- .../derives/derives-span-Debug-struct.stderr | 2 +- .../derives-span-Debug-tuple-struct.stderr | 2 +- .../derives-span-Default-struct.stderr | 2 +- .../derives-span-Default-tuple-struct.stderr | 2 +- ...derives-span-Eq-enum-struct-variant.stderr | 2 +- .../ui/derives/derives-span-Eq-enum.stderr | 2 +- .../ui/derives/derives-span-Eq-struct.stderr | 2 +- .../derives-span-Eq-tuple-struct.stderr | 2 +- ...rives-span-Hash-enum-struct-variant.stderr | 2 +- .../ui/derives/derives-span-Hash-enum.stderr | 2 +- .../derives/derives-span-Hash-struct.stderr | 2 +- .../derives-span-Hash-tuple-struct.stderr | 2 +- ...erives-span-Ord-enum-struct-variant.stderr | 2 +- .../ui/derives/derives-span-Ord-enum.stderr | 2 +- .../ui/derives/derives-span-Ord-struct.stderr | 2 +- .../derives-span-Ord-tuple-struct.stderr | 2 +- ...-span-PartialEq-enum-struct-variant.stderr | 4 +- .../derives-span-PartialEq-enum.stderr | 4 +- .../derives-span-PartialEq-struct.stderr | 4 +- ...derives-span-PartialEq-tuple-struct.stderr | 4 +- ...span-PartialOrd-enum-struct-variant.stderr | 2 +- .../derives-span-PartialOrd-enum.stderr | 2 +- .../derives-span-PartialOrd-struct.stderr | 2 +- ...erives-span-PartialOrd-tuple-struct.stderr | 2 +- src/test/ui/derives/deriving-copyclone.stderr | 6 +- .../deriving-meta-empty-trait-list.stderr | 2 +- ...eriving-no-inner-impl-error-message.stderr | 4 +- src/test/ui/derives/deriving-non-type.stderr | 18 +- src/test/ui/derives/deriving-primitive.stderr | 2 +- src/test/ui/destructure-trait-ref.stderr | 6 +- src/test/ui/did_you_mean/E0178.stderr | 8 +- src/test/ui/did_you_mean/issue-31424.stderr | 10 +- src/test/ui/did_you_mean/issue-34126.stderr | 2 +- src/test/ui/did_you_mean/issue-34337.stderr | 2 +- src/test/ui/did_you_mean/issue-35937.stderr | 6 +- src/test/ui/did_you_mean/issue-36798.stderr | 2 +- .../issue-36798_unknown_field.stderr | 2 +- src/test/ui/did_you_mean/issue-37139.stderr | 2 +- ...-38054-do-not-show-unresolved-names.stderr | 4 +- src/test/ui/did_you_mean/issue-38147-1.stderr | 2 +- src/test/ui/did_you_mean/issue-38147-4.stderr | 2 +- src/test/ui/did_you_mean/issue-39544.stderr | 30 +-- .../issue-39802-show-5-trait-impls.stderr | 6 +- src/test/ui/did_you_mean/issue-40006.stderr | 26 +-- src/test/ui/did_you_mean/issue-40823.stderr | 2 +- ...1679-tilde-bitwise-negation-attempt.stderr | 2 +- ...issue-43871-enum-instead-of-variant.stderr | 6 +- .../did_you_mean/multiple-pattern-typo.stderr | 2 +- .../ui/did_you_mean/pub-macro-rules.stderr | 2 +- .../ui/did_you_mean/recursion_limit.stderr | 2 +- .../did_you_mean/recursion_limit_deref.stderr | 4 +- .../did_you_mean/recursion_limit_macro.stderr | 2 +- ...reference-without-parens-suggestion.stderr | 6 +- .../non-inline-mod-restriction.stderr | 2 +- ...constructing-destructing-struct-let.stderr | 2 +- src/test/ui/discrim/discrim-overflow-2.stderr | 16 +- src/test/ui/discrim/discrim-overflow.stderr | 16 +- .../ui/diverging-tuple-parts-39485.stderr | 6 +- .../dollar-crate-is-keyword-2.stderr | 6 +- .../dollar-crate-is-keyword.stderr | 6 +- src/test/ui/double-import.stderr | 4 +- .../dropck/drop-with-active-borrows-1.stderr | 2 +- .../dropck/drop-with-active-borrows-2.stderr | 2 +- ...dropck-eyepatch-implies-unsafe-impl.stderr | 4 +- src/test/ui/dropck/dropck-union.stderr | 2 +- .../dropck_no_diverge_on_nonregular_1.stderr | 2 +- .../dropck_no_diverge_on_nonregular_2.stderr | 2 +- .../dropck_no_diverge_on_nonregular_3.stderr | 2 +- .../dropck/dropck_trait_cycle_checked.stderr | 14 +- src/test/ui/dst/dst-bad-coerce2.stderr | 8 +- src/test/ui/dst/dst-bad-coerce3.stderr | 8 +- src/test/ui/dst/dst-bad-coercions.stderr | 14 +- src/test/ui/duplicate/dupe-symbols-1.stderr | 2 +- src/test/ui/duplicate/dupe-symbols-2.stderr | 2 +- src/test/ui/duplicate/dupe-symbols-3.stderr | 2 +- src/test/ui/duplicate/dupe-symbols-5.stderr | 2 +- .../duplicate-check-macro-exports.stderr | 2 +- src/test/ui/duplicate_entry_error.stderr | 2 +- src/test/ui/e0119/complex-impl.stderr | 4 +- src/test/ui/e0119/conflict-with-std.stderr | 6 +- src/test/ui/e0119/issue-23563.stderr | 2 +- src/test/ui/e0119/issue-27403.stderr | 2 +- src/test/ui/e0119/issue-28981.stderr | 4 +- src/test/ui/e0119/so-37347311.stderr | 2 +- .../edition-deny-async-fns-2015.stderr | 18 +- .../ui/editions/edition-imports-2015.stderr | 2 +- .../ui/editions/edition-imports-2018.stderr | 2 +- ...tion-imports-virtual-2015-ambiguity.stderr | 4 +- .../edition-keywords-2015-2015-parsing.stderr | 4 +- ...dition-keywords-2015-2018-expansion.stderr | 2 +- .../edition-keywords-2015-2018-parsing.stderr | 4 +- .../edition-keywords-2018-2015-parsing.stderr | 12 +- ...dition-keywords-2018-2018-expansion.stderr | 2 +- .../edition-keywords-2018-2018-parsing.stderr | 12 +- src/test/ui/empty/empty-comment.stderr | 2 +- src/test/ui/empty/empty-linkname.stderr | 2 +- .../ui/empty/empty-struct-braces-expr.stderr | 16 +- .../ui/empty/empty-struct-braces-pat-2.stderr | 8 +- .../ui/empty/empty-struct-tuple-pat.stderr | 4 +- .../ui/empty/empty-struct-unit-expr.stderr | 4 +- .../ui/empty/empty-struct-unit-pat.stderr | 12 +- .../ui/enable-unstable-lib-feature.stderr | 2 +- .../enum/enum-and-module-in-same-scope.stderr | 2 +- .../ui/enum/enum-discrim-autosizing.stderr | 2 +- .../ui/enum/enum-discrim-too-small2.stderr | 8 +- src/test/ui/enum/enum-in-scope.stderr | 2 +- src/test/ui/enum/enum-size-variance.stderr | 2 +- src/test/ui/enum/enum-to-float-cast-2.stderr | 4 +- src/test/ui/enum/enum-to-float-cast.stderr | 4 +- src/test/ui/enum/enum-variant-type-2.stderr | 2 +- src/test/ui/enums-pats-not-idents.stderr | 2 +- src/test/ui/error-codes/E0001.stderr | 2 +- src/test/ui/error-codes/E0004-2.stderr | 2 +- src/test/ui/error-codes/E0004.stderr | 2 +- src/test/ui/error-codes/E0005.stderr | 2 +- src/test/ui/error-codes/E0010-teach.stderr | 4 +- src/test/ui/error-codes/E0010.stderr | 4 +- src/test/ui/error-codes/E0017.stderr | 10 +- src/test/ui/error-codes/E0023.stderr | 6 +- src/test/ui/error-codes/E0034.stderr | 2 +- src/test/ui/error-codes/E0045.stderr | 2 +- src/test/ui/error-codes/E0049.stderr | 2 +- src/test/ui/error-codes/E0050.stderr | 6 +- src/test/ui/error-codes/E0054.stderr | 2 +- src/test/ui/error-codes/E0057.stderr | 4 +- src/test/ui/error-codes/E0059.stderr | 2 +- src/test/ui/error-codes/E0067.stderr | 4 +- src/test/ui/error-codes/E0070.stderr | 8 +- src/test/ui/error-codes/E0075.stderr | 2 +- src/test/ui/error-codes/E0077.stderr | 2 +- src/test/ui/error-codes/E0080.stderr | 4 +- src/test/ui/error-codes/E0084.stderr | 2 +- src/test/ui/error-codes/E0091.stderr | 4 +- src/test/ui/error-codes/E0092.stderr | 2 +- src/test/ui/error-codes/E0094.stderr | 2 +- src/test/ui/error-codes/E0109.stderr | 2 +- src/test/ui/error-codes/E0110.stderr | 2 +- src/test/ui/error-codes/E0117.stderr | 4 +- src/test/ui/error-codes/E0118.stderr | 2 +- src/test/ui/error-codes/E0119.stderr | 2 +- src/test/ui/error-codes/E0121.stderr | 4 +- src/test/ui/error-codes/E0128.stderr | 2 +- src/test/ui/error-codes/E0132.stderr | 2 +- src/test/ui/error-codes/E0152.stderr | 2 +- src/test/ui/error-codes/E0164.stderr | 2 +- src/test/ui/error-codes/E0184.stderr | 2 +- src/test/ui/error-codes/E0186.stderr | 4 +- src/test/ui/error-codes/E0191.stderr | 2 +- src/test/ui/error-codes/E0192.stderr | 2 +- src/test/ui/error-codes/E0195.stderr | 2 +- src/test/ui/error-codes/E0197.stderr | 2 +- src/test/ui/error-codes/E0198.stderr | 2 +- src/test/ui/error-codes/E0199.stderr | 2 +- src/test/ui/error-codes/E0200.stderr | 2 +- src/test/ui/error-codes/E0201.stderr | 6 +- src/test/ui/error-codes/E0207.stderr | 2 +- src/test/ui/error-codes/E0220.stderr | 4 +- src/test/ui/error-codes/E0252.stderr | 4 +- src/test/ui/error-codes/E0255.stderr | 2 +- src/test/ui/error-codes/E0261.stderr | 4 +- src/test/ui/error-codes/E0262.stderr | 2 +- src/test/ui/error-codes/E0264.stderr | 2 +- src/test/ui/error-codes/E0267.stderr | 2 +- src/test/ui/error-codes/E0268.stderr | 2 +- src/test/ui/error-codes/E0271.stderr | 2 +- src/test/ui/error-codes/E0275.stderr | 2 +- src/test/ui/error-codes/E0276.stderr | 2 +- src/test/ui/error-codes/E0282.stderr | 2 +- src/test/ui/error-codes/E0283.stderr | 2 +- src/test/ui/error-codes/E0301.stderr | 2 +- src/test/ui/error-codes/E0302.stderr | 2 +- src/test/ui/error-codes/E0308-4.stderr | 2 +- src/test/ui/error-codes/E0308.stderr | 2 +- src/test/ui/error-codes/E0370.stderr | 2 +- src/test/ui/error-codes/E0374.stderr | 2 +- src/test/ui/error-codes/E0376.stderr | 2 +- src/test/ui/error-codes/E0388.stderr | 10 +- src/test/ui/error-codes/E0389.stderr | 2 +- src/test/ui/error-codes/E0390.stderr | 4 +- src/test/ui/error-codes/E0392.stderr | 2 +- src/test/ui/error-codes/E0395.stderr | 2 +- src/test/ui/error-codes/E0401.stderr | 6 +- src/test/ui/error-codes/E0403.stderr | 2 +- src/test/ui/error-codes/E0404.stderr | 4 +- src/test/ui/error-codes/E0405.stderr | 2 +- src/test/ui/error-codes/E0408.stderr | 2 +- src/test/ui/error-codes/E0411.stderr | 2 +- src/test/ui/error-codes/E0412.stderr | 2 +- src/test/ui/error-codes/E0415.stderr | 2 +- src/test/ui/error-codes/E0416.stderr | 2 +- src/test/ui/error-codes/E0423.stderr | 2 +- src/test/ui/error-codes/E0424.stderr | 4 +- src/test/ui/error-codes/E0425.stderr | 2 +- src/test/ui/error-codes/E0428.stderr | 4 +- src/test/ui/error-codes/E0429.stderr | 2 +- src/test/ui/error-codes/E0430.stderr | 4 +- src/test/ui/error-codes/E0431.stderr | 2 +- src/test/ui/error-codes/E0432.stderr | 2 +- src/test/ui/error-codes/E0433.stderr | 2 +- src/test/ui/error-codes/E0434.stderr | 2 +- src/test/ui/error-codes/E0435.stderr | 2 +- src/test/ui/error-codes/E0437.stderr | 2 +- src/test/ui/error-codes/E0438.stderr | 2 +- src/test/ui/error-codes/E0439.stderr | 2 +- src/test/ui/error-codes/E0446.stderr | 2 +- src/test/ui/error-codes/E0449.stderr | 6 +- src/test/ui/error-codes/E0451.stderr | 4 +- src/test/ui/error-codes/E0452.stderr | 2 +- src/test/ui/error-codes/E0458.stderr | 4 +- src/test/ui/error-codes/E0459.stderr | 2 +- src/test/ui/error-codes/E0478.stderr | 2 +- src/test/ui/error-codes/E0492.stderr | 2 +- src/test/ui/error-codes/E0496.stderr | 2 +- src/test/ui/error-codes/E0499.stderr | 2 +- src/test/ui/error-codes/E0502.stderr | 2 +- src/test/ui/error-codes/E0503.stderr | 2 +- src/test/ui/error-codes/E0504.stderr | 2 +- src/test/ui/error-codes/E0505.stderr | 2 +- src/test/ui/error-codes/E0507.stderr | 2 +- src/test/ui/error-codes/E0509.stderr | 2 +- src/test/ui/error-codes/E0511.stderr | 2 +- src/test/ui/error-codes/E0512.stderr | 2 +- src/test/ui/error-codes/E0516.stderr | 2 +- src/test/ui/error-codes/E0517.stderr | 8 +- src/test/ui/error-codes/E0518.stderr | 4 +- src/test/ui/error-codes/E0530.stderr | 2 +- src/test/ui/error-codes/E0534.stderr | 2 +- src/test/ui/error-codes/E0565-1.stderr | 2 +- src/test/ui/error-codes/E0565-2.stderr | 2 +- src/test/ui/error-codes/E0565.stderr | 2 +- src/test/ui/error-codes/E0572.stderr | 2 +- src/test/ui/error-codes/E0586.stderr | 2 +- src/test/ui/error-codes/E0597.stderr | 2 +- src/test/ui/error-codes/E0599.stderr | 2 +- src/test/ui/error-codes/E0600.stderr | 2 +- src/test/ui/error-codes/E0603.stderr | 2 +- src/test/ui/error-codes/E0604.stderr | 2 +- src/test/ui/error-codes/E0605.stderr | 4 +- src/test/ui/error-codes/E0606.stderr | 2 +- src/test/ui/error-codes/E0607.stderr | 2 +- src/test/ui/error-codes/E0608.stderr | 2 +- src/test/ui/error-codes/E0609.stderr | 4 +- src/test/ui/error-codes/E0610.stderr | 2 +- src/test/ui/error-codes/E0614.stderr | 2 +- src/test/ui/error-codes/E0615.stderr | 2 +- src/test/ui/error-codes/E0616.stderr | 2 +- src/test/ui/error-codes/E0620.stderr | 4 +- ...E0621-does-not-trigger-for-closures.stderr | 10 +- src/test/ui/error-codes/E0624.stderr | 2 +- src/test/ui/error-codes/E0637.stderr | 6 +- src/test/ui/error-codes/E0646.stderr | 2 +- src/test/ui/error-codes/E0647.stderr | 2 +- src/test/ui/error-codes/E0648.stderr | 2 +- src/test/ui/error-codes/E0658.stderr | 2 +- src/test/ui/error-codes/E0659.stderr | 2 +- src/test/ui/error-codes/E0718.stderr | 2 +- src/test/ui/error-codes/ex-E0611.stderr | 2 +- src/test/ui/error-codes/ex-E0612.stderr | 2 +- .../ui/error-should-say-copy-not-pod.stderr | 2 +- src/test/ui/estr-subtyping.stderr | 2 +- src/test/ui/exclusive-drop-and-copy.stderr | 4 +- ...sive_range_pattern_syntax_collision.stderr | 2 +- ...ive_range_pattern_syntax_collision2.stderr | 2 +- ...ive_range_pattern_syntax_collision3.stderr | 2 +- .../ui/exhaustive_integer_patterns.stderr | 26 +-- .../existential_types/bound_reduction2.stderr | 2 +- .../declared_but_never_defined.stderr | 2 +- .../declared_but_not_defined_in_scope.stderr | 2 +- .../different_defining_uses.stderr | 2 +- .../different_defining_uses_never_type.stderr | 4 +- .../generic_different_defining_uses.stderr | 2 +- .../generic_duplicate_lifetime_param.stderr | 2 +- .../generic_duplicate_param_use.stderr | 2 +- .../generic_duplicate_param_use2.stderr | 2 +- .../generic_duplicate_param_use3.stderr | 4 +- .../generic_duplicate_param_use4.stderr | 2 +- .../generic_duplicate_param_use5.stderr | 2 +- .../generic_duplicate_param_use6.stderr | 2 +- .../generic_duplicate_param_use8.stderr | 2 +- .../generic_duplicate_param_use9.stderr | 2 +- .../generic_nondefining_use.stderr | 2 +- .../existential_types/generic_not_used.stderr | 2 +- ...eric_type_does_not_live_long_enough.stderr | 2 +- .../generic_underconstrained.stderr | 2 +- .../never_reveal_concrete_type.stderr | 4 +- .../no_inferrable_concrete_type.stderr | 4 +- ...o_revealing_outside_defining_module.stderr | 4 +- .../not_a_defining_use.stderr | 4 +- .../existential_types/not_well_formed.stderr | 2 +- .../ui/explicit/explicit-call-to-dtor.stderr | 2 +- .../explicit-call-to-supertrait-dtor.stderr | 2 +- src/test/ui/explore-issue-38412.stderr | 36 ++-- src/test/ui/export-fully-qualified.stderr | 2 +- src/test/ui/export-tag-variant.stderr | 2 +- src/test/ui/export.stderr | 2 +- src/test/ui/export2.stderr | 2 +- src/test/ui/expr_attr_paren_order.stderr | 2 +- .../extenv-arg-2-not-string-literal.stderr | 2 +- src/test/ui/extenv/extenv-no-args.stderr | 2 +- .../extenv/extenv-not-defined-custom.stderr | 2 +- .../extenv/extenv-not-string-literal.stderr | 2 +- .../ui/extenv/extenv-too-many-args.stderr | 2 +- src/test/ui/extenv/issue-55897.stderr | 2 +- src/test/ui/extern/extern-const.stderr | 2 +- src/test/ui/extern/extern-crate-rename.stderr | 4 +- .../ui/extern/extern-crate-visibility.stderr | 4 +- src/test/ui/extern/extern-macro.stderr | 2 +- src/test/ui/extern/extern-main-fn.stderr | 2 +- .../extern/extern-types-distinct-types.stderr | 2 +- src/test/ui/extoption_env-no-args.stderr | 2 +- .../extoption_env-not-string-literal.stderr | 2 +- .../ui/extoption_env-too-many-args.stderr | 2 +- src/test/ui/fail-no-dead-code-core.stderr | 2 +- src/test/ui/fail-no-dead-code.stderr | 2 +- src/test/ui/fail-simple.stderr | 2 +- src/test/ui/fat-ptr-cast.stderr | 16 +- .../ui/feature-gate-optimize_attribute.stderr | 8 +- .../ui/feature-gate/duplicate-features.stderr | 4 +- ...issue-43106-gating-of-builtin-attrs.stderr | 28 +-- .../issue-43106-gating-of-inline.stderr | 6 +- .../issue-49983-see-issue-0.stderr | 2 +- .../ui/feature-gate/unknown-feature.stderr | 2 +- .../feature-gated-feature-in-macro-arg.stderr | 2 +- .../ui/feature-gates/feature-gate-abi.stderr | 126 +++++------ .../feature-gate-abi_unadjusted.stderr | 2 +- .../feature-gate-alloc-error-handler.stderr | 2 +- .../feature-gate-allocator_internals.stderr | 2 +- ...-allow-internal-unsafe-nested-macro.stderr | 2 +- ...llow-internal-unstable-nested-macro.stderr | 2 +- ...gate-allow-internal-unstable-struct.stderr | 2 +- ...eature-gate-allow-internal-unstable.stderr | 2 +- .../feature-gate-allow_fail.stderr | 2 +- .../feature-gate-arbitrary-self-types.stderr | 6 +- .../ui/feature-gates/feature-gate-asm.stderr | 2 +- .../ui/feature-gates/feature-gate-asm2.stderr | 2 +- .../feature-gate-assoc-type-defaults.stderr | 2 +- ...ature-gate-async-await-2015-edition.stderr | 8 +- .../feature-gate-async-await.stderr | 6 +- .../feature-gate-box-expr.stderr | 2 +- .../feature-gate-box_patterns.stderr | 2 +- .../feature-gate-compiler-builtins.stderr | 2 +- .../feature-gate-concat_idents.stderr | 4 +- .../feature-gate-concat_idents2.stderr | 4 +- .../feature-gate-concat_idents3.stderr | 4 +- .../feature-gate-const_fn.stderr | 10 +- .../feature-gate-const_generics.stderr | 4 +- ...ture-gate-crate_visibility_modifier.stderr | 2 +- .../feature-gate-custom_attribute.stderr | 26 +-- ...feature-gate-custom_test_frameworks.stderr | 2 +- .../feature-gate-decl_macro.stderr | 2 +- .../feature-gate-doc_alias.stderr | 2 +- .../feature-gate-doc_cfg-cfg-rustdoc.stderr | 2 +- .../feature-gates/feature-gate-doc_cfg.stderr | 2 +- .../feature-gate-doc_keyword.stderr | 2 +- .../feature-gate-doc_masked.stderr | 2 +- .../feature-gate-doc_spotlight.stderr | 2 +- ...eature-gate-exclusive-range-pattern.stderr | 2 +- .../feature-gate-exhaustive-patterns.stderr | 2 +- .../feature-gate-existential-type.stderr | 4 +- .../feature-gate-extern_absolute_paths.stderr | 4 +- .../feature-gate-extern_prelude.stderr | 2 +- .../feature-gate-extern_types.stderr | 2 +- .../feature-gate-external_doc.stderr | 2 +- .../feature-gate-feature-gate.stderr | 2 +- .../feature-gate-ffi_returns_twice.stderr | 2 +- .../feature-gate-format_args_nl.stderr | 2 +- .../feature-gate-fundamental.stderr | 2 +- .../feature-gate-generators.stderr | 4 +- .../feature-gate-global_asm.stderr | 2 +- ...-infer_static_outlives_requirements.stderr | 4 +- .../feature-gate-intrinsics.stderr | 8 +- .../feature-gate-label_break_value.stderr | 2 +- .../feature-gate-lang-items.stderr | 4 +- .../feature-gate-log_syntax.stderr | 2 +- .../feature-gate-log_syntax2.stderr | 2 +- .../ui/feature-gates/feature-gate-main.stderr | 2 +- .../feature-gate-min_const_fn.stderr | 10 +- .../feature-gate-needs-allocator.stderr | 2 +- .../feature-gate-never_type.stderr | 10 +- .../ui/feature-gates/feature-gate-nll.stderr | 2 +- .../feature-gate-no-debug-2.stderr | 2 +- .../feature-gate-no-debug.stderr | 2 +- .../feature-gates/feature-gate-no_core.stderr | 2 +- .../feature-gate-non_ascii_idents.stderr | 26 +-- .../feature-gate-non_exhaustive.stderr | 2 +- ...ate-omit-gdb-pretty-printer-section.stderr | 2 +- ...-gate-precise_pointer_size_matching.stderr | 4 +- .../feature-gate-prelude_import.stderr | 2 +- .../feature-gate-profiler-runtime.stderr | 2 +- .../feature-gate-repr-simd.stderr | 8 +- .../feature-gates/feature-gate-repr128.stderr | 2 +- .../feature-gate-repr_align_enum.stderr | 2 +- .../feature-gate-rustc-attrs-1.stderr | 4 +- .../feature-gate-rustc_const_unstable.stderr | 2 +- .../feature-gate-sanitizer-runtime.stderr | 2 +- .../feature-gate-simd-ffi.stderr | 4 +- .../ui/feature-gates/feature-gate-simd.stderr | 2 +- .../feature-gate-slice-patterns.stderr | 12 +- .../feature-gate-thread_local.stderr | 2 +- .../feature-gate-trace_macros.stderr | 2 +- .../feature-gate-trivial_bounds.stderr | 22 +- .../feature-gate-try_blocks.stderr | 2 +- .../feature-gate-try_reserve.stderr | 2 +- .../feature-gate-type_ascription.stderr | 2 +- ...-gate-unboxed-closures-method-calls.stderr | 6 +- ...re-gate-unboxed-closures-ufcs-calls.stderr | 6 +- ...feature-gate-underscore_const_names.stderr | 2 +- .../feature-gate-untagged_unions.stderr | 6 +- .../feature-gate-unwind-attributes.stderr | 2 +- ...underscore_const_names_feature_gate.stderr | 2 +- src/test/ui/ffi_returns_twice.stderr | 2 +- ...loat-literal-inference-restrictions.stderr | 4 +- src/test/ui/fmt/send-sync.stderr | 4 +- src/test/ui/fn_must_use.stderr | 12 +- src/test/ui/for/for-expn.stderr | 2 +- ...oop-refutable-pattern-error-message.stderr | 2 +- src/test/ui/for/for-loop-type-error.stderr | 2 +- ...for-loop-unconstrained-element-type.stderr | 2 +- src/test/ui/foreign-fn-return-lifetime.stderr | 2 +- ...unctional-struct-update-noncopyable.stderr | 2 +- .../ui/future-incompatible-lint-group.stderr | 2 +- src/test/ui/gated-bad-feature.stderr | 6 +- src/test/ui/generator/borrowing.stderr | 2 +- src/test/ui/generator/dropck.stderr | 2 +- .../ui/generator/generator-with-nll.stderr | 2 +- src/test/ui/generator/issue-48048.stderr | 2 +- .../no-arguments-on-generators.stderr | 2 +- src/test/ui/generator/pattern-borrow.stderr | 2 +- .../ref-escapes-but-not-over-yield.stderr | 2 +- src/test/ui/generator/sized-yield.stderr | 2 +- src/test/ui/generator/static-not-unpin.stderr | 2 +- src/test/ui/generator/yield-in-args.stderr | 2 +- .../ui/generator/yield-while-iterating.stderr | 4 +- .../yield-while-ref-reborrowed.stderr | 2 +- .../generic-arg-mismatch-recover.stderr | 8 +- .../ui/generic/generic-extern-lifetime.stderr | 6 +- src/test/ui/generic/generic-extern.stderr | 2 +- .../generic-lifetime-trait-impl.stderr | 2 +- src/test/ui/generic/generic-no-mangle.stderr | 4 +- src/test/ui/glob-resolve1.stderr | 22 +- .../ui/hashmap-iter-value-lifetime.stderr | 2 +- src/test/ui/hashmap-lifetimes.stderr | 2 +- src/test/ui/hidden-rt-injection.stderr | 2 +- src/test/ui/hidden-rt-injection2.stderr | 2 +- .../ui/hrtb/hrtb-cache-issue-54302.stderr | 2 +- src/test/ui/hrtb/hrtb-conflate-regions.stderr | 2 +- .../ui/hrtb/hrtb-debruijn-in-receiver.stderr | 2 +- src/test/ui/hrtb/hrtb-exists-forall-fn.stderr | 2 +- .../hrtb-exists-forall-trait-invariant.stderr | 2 +- ...igher-ranker-supertraits-transitive.stderr | 2 +- .../hrtb-higher-ranker-supertraits.stderr | 4 +- src/test/ui/hrtb/hrtb-just-for-static.stderr | 4 +- .../ui/hrtb/hrtb-perfect-forwarding.stderr | 2 +- src/test/ui/hrtb/issue-58451.stderr | 2 +- src/test/ui/hygiene/arguments.stderr | 2 +- src/test/ui/hygiene/assoc_item_ctxt.stderr | 4 +- src/test/ui/hygiene/fields-definition.stderr | 2 +- src/test/ui/hygiene/fields-move.stderr | 8 +- src/test/ui/hygiene/fields.stderr | 8 +- src/test/ui/hygiene/for-loop.stderr | 2 +- src/test/ui/hygiene/generate-mod.stderr | 12 +- src/test/ui/hygiene/globs.stderr | 10 +- src/test/ui/hygiene/hygienic-label-1.stderr | 2 +- src/test/ui/hygiene/hygienic-label-2.stderr | 2 +- src/test/ui/hygiene/hygienic-label-3.stderr | 2 +- src/test/ui/hygiene/hygienic-label-4.stderr | 2 +- src/test/ui/hygiene/impl_items.stderr | 2 +- .../ui/hygiene/nested_macro_privacy.stderr | 2 +- .../hygiene/no_implicit_prelude-2018.stderr | 2 +- .../ui/hygiene/no_implicit_prelude.stderr | 6 +- src/test/ui/hygiene/pattern-macro.stderr | 2 +- src/test/ui/hygiene/privacy.stderr | 2 +- src/test/ui/hygiene/trait_items.stderr | 2 +- src/test/ui/if/if-let-arm-types.stderr | 2 +- src/test/ui/if/if-let.stderr | 12 +- src/test/ui/if/ifmt-bad-arg.stderr | 30 +-- src/test/ui/if/ifmt-bad-format-args.stderr | 6 +- src/test/ui/illegal-ufcs-drop.stderr | 2 +- src/test/ui/impl-bounds-checking.stderr | 2 +- .../dyn-trait.stderr | 2 +- src/test/ui/impl-trait/extra-item.stderr | 2 +- .../infinite-impl-trait-issue-38064.stderr | 4 +- .../issue-55608-captures-empty-region.stderr | 2 +- .../no-method-suggested-traits.stderr | 8 +- src/test/ui/impl-trait/no-trait.stderr | 2 +- .../recursive-async-impl-trait-type.stderr | 2 +- .../recursive-impl-trait-type.stderr | 28 +-- .../impl-trait/universal-issue-48703.stderr | 2 +- .../universal-mismatched-type.stderr | 2 +- .../universal-two-impl-traits.stderr | 2 +- .../impl-trait/universal_wrong_bounds.stderr | 4 +- .../ui/impl-unused-rps-in-assoc-type.stderr | 2 +- src/test/ui/implicit-method-bind.stderr | 2 +- src/test/ui/import.stderr | 6 +- src/test/ui/import2.stderr | 2 +- src/test/ui/imports/duplicate.stderr | 8 +- .../extern-crate-self-fail.stderr | 4 +- src/test/ui/imports/extern-crate-used.stderr | 10 +- .../extern-prelude-extern-crate-fail.stderr | 2 +- ...e-extern-crate-restricted-shadowing.stderr | 2 +- .../imports/glob-conflict-cross-crate.stderr | 4 +- src/test/ui/imports/glob-shadowing.stderr | 6 +- .../ui/imports/import-from-missing.stderr | 2 +- src/test/ui/imports/import-glob-0.stderr | 2 +- .../ui/imports/import-glob-circular.stderr | 2 +- .../ui/imports/import-prefix-macro-1.stderr | 2 +- .../ui/imports/import-prefix-macro-2.stderr | 2 +- .../ui/imports/import-trait-method.stderr | 2 +- src/test/ui/imports/issue-53269.stderr | 6 +- src/test/ui/imports/issue-53512.stderr | 2 +- src/test/ui/imports/issue-55457.stderr | 8 +- src/test/ui/imports/issue-55884-1.stderr | 2 +- src/test/ui/imports/issue-55884-2.stderr | 2 +- src/test/ui/imports/issue-56125.stderr | 6 +- src/test/ui/imports/issue-57015.stderr | 2 +- src/test/ui/imports/issue-57539.stderr | 2 +- .../local-modularized-tricky-fail-1.stderr | 8 +- .../local-modularized-tricky-fail-2.stderr | 6 +- src/test/ui/imports/macro-paths.stderr | 4 +- src/test/ui/imports/macros.stderr | 4 +- src/test/ui/imports/reexports.stderr | 10 +- .../ui/imports/rfc-1560-warning-cycle.stderr | 2 +- .../ui/imports/shadow_builtin_macros.stderr | 8 +- src/test/ui/imports/unused-macro-use.stderr | 4 +- src/test/ui/imports/unused.stderr | 2 +- src/test/ui/impossible_range.stderr | 4 +- src/test/ui/in-band-lifetimes/E0687.stderr | 8 +- .../ui/in-band-lifetimes/E0687_where.stderr | 4 +- src/test/ui/in-band-lifetimes/E0688.stderr | 6 +- .../ui/in-band-lifetimes/mismatched.stderr | 4 +- .../in-band-lifetimes/mismatched_trait.stderr | 2 +- .../mismatched_trait_impl.stderr | 6 +- .../in-band-lifetimes/mut_while_borrow.stderr | 2 +- .../no_in_band_in_struct.stderr | 4 +- .../no_introducing_in_band_in_locals.stderr | 4 +- src/test/ui/in-band-lifetimes/shadow.stderr | 6 +- src/test/ui/inaccessible-test-modules.stderr | 4 +- .../ui/include-macros/mismatched-types.stderr | 4 +- src/test/ui/index-bot.stderr | 2 +- src/test/ui/index-help.stderr | 2 +- src/test/ui/index_message.stderr | 2 +- src/test/ui/indexing-requires-a-uint.stderr | 2 +- .../inference_unstable_featured.stderr | 2 +- .../inference_unstable_forced.stderr | 2 +- .../ui/infinite/infinite-instantiation.stderr | 2 +- .../infinite/infinite-macro-expansion.stderr | 2 +- .../infinite-recursion-const-fn.stderr | 2 +- .../infinite-vec-type-recursion.stderr | 2 +- src/test/ui/init-unsafe.stderr | 2 +- src/test/ui/inline-asm-bad-constraint.stderr | 6 +- src/test/ui/inline-asm-bad-operand.stderr | 14 +- .../ui/inner-static-type-parameter.stderr | 2 +- src/test/ui/integral-indexing.stderr | 16 +- .../internal-unstable-thread-local.stderr | 2 +- src/test/ui/internal/internal-unstable.stderr | 12 +- src/test/ui/invalid/invalid-crate-type.stderr | 2 +- src/test/ui/invalid/invalid-inline.stderr | 6 +- .../ui/invalid/invalid-macro-matcher.stderr | 2 +- .../ui/invalid/invalid-plugin-attr.stderr | 4 +- src/test/ui/invalid_crate_type_syntax.stderr | 2 +- .../ui/invalid_dispatch_from_dyn_impls.stderr | 6 +- src/test/ui/issue-18986.stderr | 2 +- src/test/ui/issue-42944.stderr | 4 +- .../issue-53787-inline-assembler-macro.stderr | 2 +- src/test/ui/issues/issue-10200.stderr | 2 +- src/test/ui/issues/issue-10291.stderr | 4 +- src/test/ui/issues/issue-10412.stderr | 16 +- src/test/ui/issues/issue-10465.stderr | 2 +- src/test/ui/issues/issue-10545.stderr | 2 +- src/test/ui/issues/issue-10969.stderr | 4 +- src/test/ui/issues/issue-10991.stderr | 2 +- src/test/ui/issues/issue-11004.stderr | 4 +- src/test/ui/issues/issue-11192.stderr | 2 +- src/test/ui/issues/issue-11319.stderr | 6 +- src/test/ui/issues/issue-11374.stderr | 2 +- src/test/ui/issues/issue-11515.stderr | 2 +- src/test/ui/issues/issue-11681.stderr | 2 +- src/test/ui/issues/issue-11692-1.stderr | 2 +- src/test/ui/issues/issue-11692-2.stderr | 2 +- src/test/ui/issues/issue-11844.stderr | 2 +- src/test/ui/issues/issue-11873.stderr | 2 +- src/test/ui/issues/issue-12028.stderr | 2 +- src/test/ui/issues/issue-12369.stderr | 2 +- src/test/ui/issues/issue-12470.stderr | 2 +- src/test/ui/issues/issue-12552.stderr | 4 +- src/test/ui/issues/issue-12863.stderr | 2 +- src/test/ui/issues/issue-12997-1.stderr | 4 +- src/test/ui/issues/issue-13404.stderr | 2 +- src/test/ui/issues/issue-13482-2.stderr | 2 +- src/test/ui/issues/issue-13482.stderr | 2 +- src/test/ui/issues/issue-13483.stderr | 4 +- src/test/ui/issues/issue-13497-2.stderr | 2 +- src/test/ui/issues/issue-13497.stderr | 2 +- src/test/ui/issues/issue-1362.stderr | 2 +- src/test/ui/issues/issue-13847.stderr | 2 +- src/test/ui/issues/issue-13853-2.stderr | 2 +- src/test/ui/issues/issue-13853.stderr | 6 +- src/test/ui/issues/issue-14221.stderr | 6 +- src/test/ui/issues/issue-14285.stderr | 2 +- src/test/ui/issues/issue-14309.stderr | 10 +- src/test/ui/issues/issue-1448-2.stderr | 2 +- src/test/ui/issues/issue-14721.stderr | 2 +- src/test/ui/issues/issue-1476.stderr | 2 +- src/test/ui/issues/issue-14772.stderr | 2 +- src/test/ui/issues/issue-14845.stderr | 4 +- src/test/ui/issues/issue-15207.stderr | 2 +- src/test/ui/issues/issue-15965.stderr | 2 +- src/test/ui/issues/issue-16098.stderr | 2 +- src/test/ui/issues/issue-16250.stderr | 2 +- src/test/ui/issues/issue-16683.stderr | 6 +- src/test/ui/issues/issue-16939.stderr | 2 +- src/test/ui/issues/issue-1697.stderr | 2 +- src/test/ui/issues/issue-17001.stderr | 2 +- src/test/ui/issues/issue-17033.stderr | 2 +- src/test/ui/issues/issue-17252.stderr | 2 +- src/test/ui/issues/issue-17337.stderr | 2 +- src/test/ui/issues/issue-17373.stderr | 2 +- src/test/ui/issues/issue-17385.stderr | 4 +- src/test/ui/issues/issue-17405.stderr | 2 +- src/test/ui/issues/issue-17545.stderr | 2 +- src/test/ui/issues/issue-17551.stderr | 2 +- .../issues/issue-17718-const-privacy.stderr | 4 +- .../ui/issues/issue-17718-patterns.stderr | 4 +- .../ui/issues/issue-17718-references.stderr | 4 +- .../ui/issues/issue-17718-static-move.stderr | 2 +- src/test/ui/issues/issue-17740.stderr | 16 +- src/test/ui/issues/issue-17758.stderr | 2 +- src/test/ui/issues/issue-17904-2.stderr | 2 +- src/test/ui/issues/issue-17905-2.stderr | 8 +- src/test/ui/issues/issue-17959.stderr | 2 +- src/test/ui/issues/issue-17994.stderr | 2 +- src/test/ui/issues/issue-17999.stderr | 4 +- src/test/ui/issues/issue-18118.stderr | 2 +- src/test/ui/issues/issue-18159.stderr | 2 +- src/test/ui/issues/issue-18183.stderr | 2 +- src/test/ui/issues/issue-18294.stderr | 2 +- src/test/ui/issues/issue-18389.stderr | 2 +- src/test/ui/issues/issue-18423.stderr | 2 +- src/test/ui/issues/issue-18446.stderr | 2 +- src/test/ui/issues/issue-18532.stderr | 2 +- src/test/ui/issues/issue-18611.stderr | 2 +- src/test/ui/issues/issue-1871.stderr | 2 +- src/test/ui/issues/issue-18783.stderr | 4 +- src/test/ui/issues/issue-18919.stderr | 2 +- src/test/ui/issues/issue-18937.stderr | 2 +- src/test/ui/issues/issue-19498.stderr | 6 +- src/test/ui/issues/issue-19521.stderr | 2 +- src/test/ui/issues/issue-1962.stderr | 2 +- src/test/ui/issues/issue-19692.stderr | 2 +- src/test/ui/issues/issue-19707.stderr | 4 +- src/test/ui/issues/issue-19991.stderr | 8 +- src/test/ui/issues/issue-20005.stderr | 2 +- src/test/ui/issues/issue-20313.stderr | 2 +- src/test/ui/issues/issue-20413.stderr | 6 +- src/test/ui/issues/issue-20616-1.stderr | 2 +- src/test/ui/issues/issue-20616-2.stderr | 2 +- src/test/ui/issues/issue-20714.stderr | 2 +- src/test/ui/issues/issue-20772.stderr | 8 +- .../ui/issues/issue-20831-debruijn.stderr | 24 +-- src/test/ui/issues/issue-2151.stderr | 2 +- src/test/ui/issues/issue-21600.stderr | 10 +- src/test/ui/issues/issue-21837.stderr | 2 +- src/test/ui/issues/issue-21974.stderr | 2 +- src/test/ui/issues/issue-22289.stderr | 2 +- src/test/ui/issues/issue-22560.stderr | 4 +- src/test/ui/issues/issue-22599.stderr | 2 +- src/test/ui/issues/issue-22638.stderr | 2 +- src/test/ui/issues/issue-22644.stderr | 14 +- src/test/ui/issues/issue-22684.stderr | 2 +- src/test/ui/issues/issue-2281-part1.stderr | 2 +- src/test/ui/issues/issue-22886.stderr | 2 +- src/test/ui/issues/issue-23041.stderr | 2 +- src/test/ui/issues/issue-23046.stderr | 2 +- src/test/ui/issues/issue-23073.stderr | 2 +- src/test/ui/issues/issue-23080-2.stderr | 2 +- src/test/ui/issues/issue-23080.stderr | 2 +- src/test/ui/issues/issue-23189.stderr | 2 +- src/test/ui/issues/issue-2330.stderr | 2 +- src/test/ui/issues/issue-23302-1.stderr | 4 +- src/test/ui/issues/issue-23302-2.stderr | 4 +- src/test/ui/issues/issue-23302-3.stderr | 4 +- src/test/ui/issues/issue-24081.stderr | 10 +- .../ui/issues/issue-24267-flow-exit.stderr | 4 +- src/test/ui/issues/issue-24322.stderr | 2 +- src/test/ui/issues/issue-24352.stderr | 2 +- src/test/ui/issues/issue-24357.stderr | 2 +- src/test/ui/issues/issue-24363.stderr | 4 +- src/test/ui/issues/issue-24365.stderr | 6 +- src/test/ui/issues/issue-24682.stderr | 6 +- src/test/ui/issues/issue-25076.stderr | 2 +- src/test/ui/issues/issue-25368.stderr | 2 +- src/test/ui/issues/issue-25396.stderr | 16 +- src/test/ui/issues/issue-25439.stderr | 2 +- src/test/ui/issues/issue-25700.stderr | 2 +- src/test/ui/issues/issue-2590.stderr | 2 +- src/test/ui/issues/issue-26158.stderr | 2 +- src/test/ui/issues/issue-26472.stderr | 4 +- src/test/ui/issues/issue-26548.stderr | 2 +- src/test/ui/issues/issue-26886.stderr | 4 +- src/test/ui/issues/issue-26905.stderr | 2 +- src/test/ui/issues/issue-27033.stderr | 4 +- src/test/ui/issues/issue-27042.stderr | 8 +- src/test/ui/issues/issue-27060-2.stderr | 2 +- src/test/ui/issues/issue-27060.stderr | 4 +- src/test/ui/issues/issue-27340.stderr | 2 +- src/test/ui/issues/issue-27815.stderr | 4 +- src/test/ui/issues/issue-28105.stderr | 4 +- src/test/ui/issues/issue-28109.stderr | 4 +- src/test/ui/issues/issue-28134.stderr | 2 +- src/test/ui/issues/issue-2823.stderr | 2 +- src/test/ui/issues/issue-28388-1.stderr | 2 +- src/test/ui/issues/issue-28472.stderr | 4 +- src/test/ui/issues/issue-2848.stderr | 2 +- src/test/ui/issues/issue-28576.stderr | 2 +- src/test/ui/issues/issue-28625.stderr | 2 +- src/test/ui/issues/issue-28837.stderr | 30 +-- src/test/ui/issues/issue-28848.stderr | 2 +- src/test/ui/issues/issue-28992-empty.stderr | 2 +- src/test/ui/issues/issue-29147.stderr | 2 +- src/test/ui/issues/issue-29161.stderr | 2 +- src/test/ui/issues/issue-29181.stderr | 2 +- src/test/ui/issues/issue-29184.stderr | 2 +- src/test/ui/issues/issue-2937.stderr | 2 +- src/test/ui/issues/issue-2995.stderr | 2 +- src/test/ui/issues/issue-30007.stderr | 2 +- src/test/ui/issues/issue-30079.stderr | 6 +- src/test/ui/issues/issue-3021-b.stderr | 2 +- src/test/ui/issues/issue-3021-c.stderr | 4 +- src/test/ui/issues/issue-3021-d.stderr | 4 +- src/test/ui/issues/issue-3021.stderr | 2 +- src/test/ui/issues/issue-30236.stderr | 2 +- src/test/ui/issues/issue-30240-b.stderr | 2 +- src/test/ui/issues/issue-30240.stderr | 4 +- src/test/ui/issues/issue-30302.stderr | 2 +- src/test/ui/issues/issue-3038.stderr | 2 +- src/test/ui/issues/issue-30438-a.stderr | 2 +- src/test/ui/issues/issue-30438-b.stderr | 4 +- src/test/ui/issues/issue-30438-c.stderr | 2 +- src/test/ui/issues/issue-30535.stderr | 2 +- src/test/ui/issues/issue-30560.stderr | 2 +- src/test/ui/issues/issue-30589.stderr | 2 +- src/test/ui/issues/issue-3080.stderr | 2 +- src/test/ui/issues/issue-3096-1.stderr | 2 +- src/test/ui/issues/issue-3096-2.stderr | 2 +- src/test/ui/issues/issue-3099-a.stderr | 2 +- src/test/ui/issues/issue-3099-b.stderr | 2 +- src/test/ui/issues/issue-3099.stderr | 2 +- src/test/ui/issues/issue-31173.stderr | 2 +- src/test/ui/issues/issue-31212.stderr | 4 +- src/test/ui/issues/issue-3154.stderr | 2 +- src/test/ui/issues/issue-31769.stderr | 4 +- src/test/ui/issues/issue-31804.stderr | 2 +- src/test/ui/issues/issue-31845.stderr | 2 +- src/test/ui/issues/issue-32086.stderr | 4 +- src/test/ui/issues/issue-3214.stderr | 2 +- src/test/ui/issues/issue-32326.stderr | 2 +- .../issue-32354-suggest-import-rename.stderr | 4 +- src/test/ui/issues/issue-32655.stderr | 4 +- src/test/ui/issues/issue-32709.stderr | 2 +- src/test/ui/issues/issue-32782.stderr | 2 +- src/test/ui/issues/issue-32833.stderr | 2 +- src/test/ui/issues/issue-32950.stderr | 4 +- src/test/ui/issues/issue-33140.stderr | 2 +- src/test/ui/issues/issue-3344.stderr | 2 +- src/test/ui/issues/issue-33504.stderr | 2 +- src/test/ui/issues/issue-33525.stderr | 6 +- src/test/ui/issues/issue-33571.stderr | 2 +- src/test/ui/issues/issue-33941.stderr | 4 +- src/test/ui/issues/issue-34047.stderr | 2 +- src/test/ui/issues/issue-34222-1.stderr | 2 +- src/test/ui/issues/issue-34334.stderr | 2 +- src/test/ui/issues/issue-34349.stderr | 2 +- src/test/ui/issues/issue-34373.stderr | 2 +- src/test/ui/issues/issue-35075.stderr | 8 +- src/test/ui/issues/issue-35139.stderr | 2 +- src/test/ui/issues/issue-35241.stderr | 2 +- src/test/ui/issues/issue-35450.stderr | 2 +- src/test/ui/issues/issue-3601.stderr | 2 +- src/test/ui/issues/issue-36116.stderr | 4 +- src/test/ui/issues/issue-36163.stderr | 4 +- src/test/ui/issues/issue-36400.stderr | 2 +- src/test/ui/issues/issue-36617.stderr | 2 +- src/test/ui/issues/issue-36881.stderr | 2 +- src/test/ui/issues/issue-3702-2.stderr | 2 +- src/test/ui/issues/issue-37026.stderr | 4 +- src/test/ui/issues/issue-3707.stderr | 2 +- .../issue-37311.stderr | 2 +- src/test/ui/issues/issue-37550.stderr | 2 +- src/test/ui/issues/issue-3763.stderr | 4 +- src/test/ui/issues/issue-37665.stderr | 2 +- src/test/ui/issues/issue-3779.stderr | 2 +- src/test/ui/issues/issue-37884.stderr | 8 +- src/test/ui/issues/issue-37887.stderr | 4 +- src/test/ui/issues/issue-3820.stderr | 2 +- src/test/ui/issues/issue-38293.stderr | 4 +- src/test/ui/issues/issue-38458.stderr | 2 +- src/test/ui/issues/issue-38604.stderr | 4 +- src/test/ui/issues/issue-38715.stderr | 2 +- src/test/ui/issues/issue-38868.stderr | 2 +- src/test/ui/issues/issue-38919.stderr | 2 +- src/test/ui/issues/issue-39211.stderr | 2 +- src/test/ui/issues/issue-39388.stderr | 2 +- src/test/ui/issues/issue-39616.stderr | 4 +- src/test/ui/issues/issue-3973.stderr | 2 +- src/test/ui/issues/issue-3993.stderr | 2 +- src/test/ui/issues/issue-40000.stderr | 2 +- src/test/ui/issues/issue-40288.stderr | 2 +- .../issue-40402-1.stderr | 2 +- .../issue-40402-2.stderr | 2 +- src/test/ui/issues/issue-40782.stderr | 2 +- src/test/ui/issues/issue-40845.stderr | 4 +- src/test/ui/issues/issue-41255.stderr | 18 +- src/test/ui/issues/issue-41549.stderr | 2 +- src/test/ui/issues/issue-41726.stderr | 2 +- src/test/ui/issues/issue-41742.stderr | 2 +- src/test/ui/issues/issue-41776.stderr | 2 +- src/test/ui/issues/issue-41974.stderr | 6 +- src/test/ui/issues/issue-4201.stderr | 8 +- src/test/ui/issues/issue-42060.stderr | 8 +- src/test/ui/issues/issue-42106.stderr | 2 +- src/test/ui/issues/issue-42344.stderr | 2 +- src/test/ui/issues/issue-4265.stderr | 2 +- src/test/ui/issues/issue-42755.stderr | 2 +- src/test/ui/issues/issue-42796.stderr | 2 +- src/test/ui/issues/issue-42880.stderr | 2 +- src/test/ui/issues/issue-42954.stderr | 2 +- src/test/ui/issues/issue-43023.stderr | 6 +- src/test/ui/issues/issue-43162.stderr | 8 +- src/test/ui/issues/issue-4321.stderr | 2 +- .../issues/issue-43420-no-over-suggest.stderr | 2 +- src/test/ui/issues/issue-43424.stderr | 2 +- src/test/ui/issues/issue-4366-2.stderr | 2 +- src/test/ui/issues/issue-4366.stderr | 2 +- src/test/ui/issues/issue-43733.stderr | 2 +- .../issues/issue-43784-associated-type.stderr | 2 +- .../ui/issues/issue-43784-supertrait.stderr | 2 +- src/test/ui/issues/issue-43925.stderr | 2 +- src/test/ui/issues/issue-43926.stderr | 2 +- src/test/ui/issues/issue-44021.stderr | 2 +- src/test/ui/issues/issue-44023.stderr | 2 +- src/test/ui/issues/issue-44078.stderr | 2 +- src/test/ui/issues/issue-44373.stderr | 2 +- src/test/ui/issues/issue-44406.stderr | 6 +- ...45107-unnecessary-unsafe-in-closure.stderr | 6 +- src/test/ui/issues/issue-45157.stderr | 2 +- src/test/ui/issues/issue-45296.stderr | 2 +- src/test/ui/issues/issue-45730.stderr | 6 +- src/test/ui/issues/issue-46036.stderr | 2 +- src/test/ui/issues/issue-46311.stderr | 2 +- src/test/ui/issues/issue-46438.stderr | 2 +- src/test/ui/issues/issue-46771.stderr | 2 +- src/test/ui/issues/issue-46843.stderr | 4 +- src/test/ui/issues/issue-4736.stderr | 2 +- src/test/ui/issues/issue-47623.stderr | 2 +- src/test/ui/issues/issue-47646.stderr | 2 +- src/test/ui/issues/issue-48131.stderr | 6 +- src/test/ui/issues/issue-48728.stderr | 2 +- src/test/ui/issues/issue-48803.stderr | 2 +- src/test/ui/issues/issue-48838.stderr | 2 +- src/test/ui/issues/issue-49040.stderr | 2 +- src/test/ui/issues/issue-49074.stderr | 2 +- src/test/ui/issues/issue-49257.stderr | 10 +- src/test/ui/issues/issue-4935.stderr | 2 +- src/test/ui/issues/issue-4972.stderr | 2 +- src/test/ui/issues/issue-49824.stderr | 2 +- src/test/ui/issues/issue-49934.stderr | 12 +- src/test/ui/issues/issue-50403.stderr | 2 +- src/test/ui/issues/issue-50480.stderr | 2 +- src/test/ui/issues/issue-50576.stderr | 2 +- src/test/ui/issues/issue-50581.stderr | 2 +- src/test/ui/issues/issue-50599.stderr | 2 +- src/test/ui/issues/issue-50600.stderr | 2 +- src/test/ui/issues/issue-50688.stderr | 2 +- src/test/ui/issues/issue-50714-1.stderr | 2 +- src/test/ui/issues/issue-50714.stderr | 2 +- src/test/ui/issues/issue-50781.stderr | 2 +- src/test/ui/issues/issue-50802.stderr | 2 +- src/test/ui/issues/issue-5099.stderr | 2 +- src/test/ui/issues/issue-5100.stderr | 4 +- src/test/ui/issues/issue-51116.stderr | 2 +- src/test/ui/issues/issue-51244.stderr | 2 +- src/test/ui/issues/issue-51848.stderr | 4 +- src/test/ui/issues/issue-51874.stderr | 4 +- ...issue-52023-array-size-pointer-cast.stderr | 4 +- src/test/ui/issues/issue-5216.stderr | 4 +- src/test/ui/issues/issue-52213.stderr | 2 +- src/test/ui/issues/issue-52891.stderr | 20 +- src/test/ui/issues/issue-54348.stderr | 4 +- src/test/ui/issues/issue-5439.stderr | 2 +- src/test/ui/issues/issue-55587.stderr | 2 +- src/test/ui/issues/issue-57362-1.stderr | 2 +- src/test/ui/issues/issue-57362-2.stderr | 2 +- src/test/ui/issues/issue-57843.stderr | 2 +- src/test/ui/issues/issue-5844.stderr | 2 +- src/test/ui/issues/issue-5883.stderr | 2 +- src/test/ui/issues/issue-58856-2.stderr | 4 +- src/test/ui/issues/issue-5927.stderr | 4 +- src/test/ui/issues/issue-5997-struct.stderr | 2 +- src/test/ui/issues/issue-6458-4.stderr | 2 +- src/test/ui/issues/issue-6642.stderr | 2 +- src/test/ui/issues/issue-6801.stderr | 2 +- src/test/ui/issues/issue-6804.stderr | 4 +- src/test/ui/issues/issue-6936.stderr | 8 +- src/test/ui/issues/issue-7044.stderr | 2 +- src/test/ui/issues/issue-7246.stderr | 2 +- src/test/ui/issues/issue-7607-1.stderr | 2 +- src/test/ui/issues/issue-7813.stderr | 2 +- src/test/ui/issues/issue-8153.stderr | 2 +- src/test/ui/issues/issue-8208.stderr | 4 +- src/test/ui/issues/issue-8767.stderr | 2 +- src/test/ui/issues/issue-9814.stderr | 2 +- src/test/ui/issues/issue-pr29383.stderr | 4 +- .../keyword-extern-as-identifier-expr.stderr | 2 +- .../keyword-extern-as-identifier-pat.stderr | 2 +- .../keyword-extern-as-identifier-type.stderr | 2 +- .../keyword-extern-as-identifier-use.stderr | 4 +- .../keyword-false-as-identifier.stderr | 2 +- .../keyword/keyword-self-as-identifier.stderr | 2 +- .../keyword-super-as-identifier.stderr | 2 +- src/test/ui/keyword/keyword-super.stderr | 2 +- .../keyword/keyword-true-as-identifier.stderr | 2 +- src/test/ui/kindck/kindck-copy.stderr | 22 +- .../kindck/kindck-inherited-copy-bound.stderr | 2 +- src/test/ui/label/label-static.stderr | 4 +- src/test/ui/label/label-underscore.stderr | 4 +- .../label/label_break_value_continue.stderr | 8 +- .../label_break_value_illegal_uses.stderr | 8 +- .../label_break_value_unlabeled_break.stderr | 4 +- src/test/ui/lexical-scopes.stderr | 4 +- .../lifetime-bound-will-change-warning.stderr | 4 +- .../lifetime-doesnt-live-long-enough.stderr | 12 +- ...urn-type-requires-explicit-lifetime.stderr | 10 +- .../42701_one_named_and_one_anonymous.stderr | 2 +- ...existing-name-early-bound-in-struct.stderr | 2 +- ...-return-one-existing-name-if-else-2.stderr | 2 +- ...-return-one-existing-name-if-else-3.stderr | 2 +- ...-existing-name-if-else-using-impl-2.stderr | 2 +- ...-existing-name-if-else-using-impl-3.stderr | 2 +- ...ne-existing-name-if-else-using-impl.stderr | 2 +- ...x1-return-one-existing-name-if-else.stderr | 2 +- ...e-existing-name-return-type-is-anon.stderr | 2 +- ...turn-one-existing-name-self-is-anon.stderr | 2 +- .../ex1b-return-no-names-if-else.stderr | 2 +- .../ex2a-push-one-existing-name-2.stderr | 2 +- ...-push-one-existing-name-early-bound.stderr | 2 +- .../ex2a-push-one-existing-name.stderr | 2 +- .../ex2b-push-no-existing-names.stderr | 2 +- .../ex2c-push-inference-variable.stderr | 2 +- .../ex2d-push-inference-variable-2.stderr | 2 +- .../ex2e-push-inference-variable-3.stderr | 2 +- .../ex3-both-anon-regions-2.stderr | 2 +- .../ex3-both-anon-regions-3.stderr | 4 +- ...oth-anon-regions-both-are-structs-2.stderr | 2 +- ...oth-anon-regions-both-are-structs-3.stderr | 2 +- ...both-are-structs-earlybound-regions.stderr | 2 +- ...-both-are-structs-latebound-regions.stderr | 2 +- ...-both-anon-regions-both-are-structs.stderr | 2 +- ...both-anon-regions-latebound-regions.stderr | 2 +- ...3-both-anon-regions-one-is-struct-2.stderr | 2 +- ...3-both-anon-regions-one-is-struct-3.stderr | 2 +- ...3-both-anon-regions-one-is-struct-4.stderr | 2 +- ...ex3-both-anon-regions-one-is-struct.stderr | 2 +- ...th-anon-regions-return-type-is-anon.stderr | 2 +- .../ex3-both-anon-regions-self-is-anon.stderr | 2 +- ...x3-both-anon-regions-using-fn-items.stderr | 2 +- ...-both-anon-regions-using-impl-items.stderr | 2 +- ...th-anon-regions-using-trait-objects.stderr | 2 +- .../ex3-both-anon-regions.stderr | 2 +- .../liveness-assign-imm-local-notes.stderr | 20 +- .../ui/lifetimes/lifetime-no-keyword.stderr | 8 +- .../lint/command-line-lint-group-deny.stderr | 2 +- .../command-line-lint-group-forbid.stderr | 2 +- .../issue-54538-unused-parens-lint.stderr | 12 +- .../ui/lint/lint-attr-non-item-node.stderr | 2 +- src/test/ui/lint/lint-change-warnings.stderr | 6 +- src/test/ui/lint/lint-ctypes-enum.stderr | 6 +- src/test/ui/lint/lint-ctypes.stderr | 40 ++-- src/test/ui/lint/lint-dead-code-1.stderr | 20 +- src/test/ui/lint/lint-dead-code-2.stderr | 6 +- src/test/ui/lint/lint-dead-code-3.stderr | 10 +- src/test/ui/lint/lint-dead-code-4.stderr | 20 +- src/test/ui/lint/lint-dead-code-5.stderr | 8 +- .../ui/lint/lint-dead-code-type-alias.stderr | 2 +- .../ui/lint/lint-dead-code-variant.stderr | 2 +- ...directives-on-use-items-issue-10534.stderr | 4 +- .../ui/lint/lint-exceeding-bitshifts.stderr | 36 ++-- .../ui/lint/lint-exceeding-bitshifts2.stderr | 6 +- src/test/ui/lint/lint-forbid-cmdline.stderr | 2 +- .../lint/lint-group-nonstandard-style.stderr | 10 +- src/test/ui/lint/lint-impl-fn.stderr | 6 +- src/test/ui/lint/lint-malformed.stderr | 4 +- src/test/ui/lint/lint-misplaced-attr.stderr | 8 +- .../lint-missing-copy-implementations.stderr | 2 +- src/test/ui/lint/lint-missing-doc.stderr | 38 ++-- .../ui/lint/lint-non-camel-case-types.stderr | 14 +- .../lint/lint-non-snake-case-lifetimes.stderr | 2 +- .../lint/lint-non-snake-case-modules.stderr | 2 +- .../ui/lint/lint-non-uppercase-statics.stderr | 4 +- src/test/ui/lint/lint-obsolete-attr.stderr | 4 +- src/test/ui/lint/lint-output-format.stderr | 6 +- .../ui/lint/lint-owned-heap-memory.stderr | 2 +- src/test/ui/lint/lint-qualification.stderr | 2 +- src/test/ui/lint/lint-removed-allow.stderr | 2 +- src/test/ui/lint/lint-removed.stderr | 4 +- src/test/ui/lint/lint-renamed-allow.stderr | 2 +- src/test/ui/lint/lint-renamed.stderr | 2 +- src/test/ui/lint/lint-shorthand-field.stderr | 4 +- src/test/ui/lint/lint-stability-2.stderr | 16 +- .../ui/lint/lint-stability-deprecated.stderr | 202 +++++++++--------- src/test/ui/lint/lint-stability-fields.stderr | 86 ++++---- src/test/ui/lint/lint-stability.stderr | 40 ++-- src/test/ui/lint/lint-type-limits.stderr | 18 +- src/test/ui/lint/lint-type-limits2.stderr | 4 +- src/test/ui/lint/lint-type-limits3.stderr | 4 +- src/test/ui/lint/lint-type-overflow.stderr | 36 ++-- src/test/ui/lint/lint-type-overflow2.stderr | 12 +- .../lint/lint-unconditional-recursion.stderr | 28 +-- .../ui/lint/lint-unexported-no-mangle.stderr | 4 +- src/test/ui/lint/lint-unknown-attr.stderr | 6 +- src/test/ui/lint/lint-unknown-lint.stderr | 4 +- .../lint-unnecessary-import-braces.stderr | 2 +- .../ui/lint/lint-unnecessary-parens.stderr | 24 +-- src/test/ui/lint/lint-unsafe-code.stderr | 28 +-- .../ui/lint/lint-unused-extern-crate.stderr | 4 +- src/test/ui/lint/lint-unused-imports.stderr | 12 +- src/test/ui/lint/lint-unused-mut-self.stderr | 4 +- .../ui/lint/lint-unused-mut-variables.stderr | 32 +-- .../ui/lint/lint-uppercase-variables.stderr | 6 +- .../ui/lint/lints-in-foreign-macros.stderr | 14 +- src/test/ui/lint/must_use-trait.stderr | 2 +- src/test/ui/lint/must_use-unit.stderr | 4 +- src/test/ui/lint/outer-forbid.stderr | 6 +- src/test/ui/lint/suggestions.stderr | 2 +- src/test/ui/lint/test-inner-fn.stderr | 4 +- src/test/ui/lint/type-overflow.stderr | 12 +- src/test/ui/lint/unused_labels.stderr | 2 +- .../liveness-closure-require-ret.stderr | 2 +- src/test/ui/liveness/liveness-dead.stderr | 8 +- .../ui/liveness/liveness-issue-2163.stderr | 2 +- .../ui/liveness/liveness-missing-ret2.stderr | 2 +- .../ui/liveness/liveness-move-call-arg.stderr | 2 +- .../ui/liveness/liveness-move-in-loop.stderr | 2 +- .../ui/liveness/liveness-move-in-while.stderr | 2 +- .../liveness-return-last-stmt-semi.stderr | 6 +- src/test/ui/liveness/liveness-unused.stderr | 4 +- .../liveness/liveness-use-after-move.stderr | 2 +- .../liveness/liveness-use-after-send.stderr | 2 +- .../loops/loop-break-value-no-repeat.stderr | 4 +- src/test/ui/loops/loop-break-value.stderr | 26 +-- .../ui/loops/loop-labeled-break-value.stderr | 6 +- src/test/ui/loops/loop-proper-liveness.stderr | 2 +- .../ui/loops/loop-properly-diverging-2.stderr | 2 +- .../loops-reject-duplicate-labels-2.stderr | 14 +- .../loops-reject-duplicate-labels.stderr | 14 +- src/test/ui/lub-glb/old-lub-glb-hr.stderr | 2 +- src/test/ui/lub-glb/old-lub-glb-object.stderr | 2 +- src/test/ui/lub-if.stderr | 4 +- src/test/ui/lub-match.stderr | 4 +- .../macros/ambiguity-legacy-vs-modern.stderr | 4 +- src/test/ui/macros/assert.stderr | 8 +- src/test/ui/macros/cfg.stderr | 6 +- src/test/ui/macros/format-foreign.stderr | 10 +- src/test/ui/macros/format-parse-errors.stderr | 16 +- .../ui/macros/format-unused-lables.stderr | 6 +- src/test/ui/macros/global-asm.stderr | 6 +- src/test/ui/macros/issue-54441.stderr | 2 +- ...acro-at-most-once-rep-2015-ques-rep.stderr | 4 +- ...acro-at-most-once-rep-2015-ques-sep.stderr | 4 +- .../macros/macro-at-most-once-rep-2018.stderr | 24 +-- src/test/ui/macros/macro-attribute.stderr | 2 +- .../macro-backtrace-invalid-internals.stderr | 20 +- .../ui/macros/macro-backtrace-nested.stderr | 4 +- .../ui/macros/macro-backtrace-println.stderr | 2 +- src/test/ui/macros/macro-comma-support.stderr | 4 +- src/test/ui/macros/macro-context.stderr | 8 +- .../macro-crate-nonterminal-non-root.stderr | 2 +- src/test/ui/macros/macro-error.stderr | 4 +- src/test/ui/macros/macro-follow.stderr | 170 +++++++-------- .../macros/macro-followed-by-seq-bad.stderr | 4 +- .../macros/macro-input-future-proofing.stderr | 12 +- .../ui/macros/macro-match-nonterminal.stderr | 2 +- .../ui/macros/macro-missing-delimiters.stderr | 2 +- .../ui/macros/macro-missing-fragment.stderr | 2 +- .../macro-multiple-matcher-bindings.stderr | 8 +- src/test/ui/macros/macro-name-typo.stderr | 2 +- .../ui/macros/macro-outer-attributes.stderr | 2 +- .../ui/macros/macro-parameter-span.stderr | 2 +- .../macros/macro-path-prelude-fail-1.stderr | 4 +- .../macros/macro-path-prelude-fail-2.stderr | 2 +- .../macros/macro-path-prelude-fail-3.stderr | 2 +- .../macros/macro-path-prelude-fail-4.stderr | 2 +- .../macro-path-prelude-shadowing.stderr | 2 +- .../ui/macros/macro-reexport-removed.stderr | 6 +- src/test/ui/macros/macro-shadowing.stderr | 4 +- src/test/ui/macros/macro-stability.stderr | 2 +- .../ui/macros/macro-use-bad-args-1.stderr | 2 +- .../ui/macros/macro-use-bad-args-2.stderr | 2 +- src/test/ui/macros/macro-use-undef.stderr | 2 +- .../macros/macro_path_as_generic_bound.stderr | 2 +- src/test/ui/macros/macro_undefined.stderr | 2 +- .../ui/macros/macros-nonfatal-errors.stderr | 30 +-- .../ui/macros/meta-item-absolute-path.stderr | 2 +- .../ui/macros/must-use-in-macro-55516.stderr | 2 +- .../ui/macros/nonterminal-matching.stderr | 2 +- .../macros/restricted-shadowing-legacy.stderr | 16 +- .../macros/restricted-shadowing-modern.stderr | 12 +- src/test/ui/macros/trace_faulty_macros.stderr | 4 +- .../malformed/malformed-interpolated.stderr | 6 +- .../ui/malformed/malformed-plugin-1.stderr | 2 +- .../ui/malformed/malformed-plugin-2.stderr | 2 +- .../ui/malformed/malformed-plugin-3.stderr | 2 +- .../ui/malformed/malformed-regressions.stderr | 10 +- .../malformed/malformed-special-attrs.stderr | 8 +- src/test/ui/malformed_macro_lhs.stderr | 2 +- .../marker-attribute-on-non-trait.stderr | 12 +- .../overlap-marker-trait.stderr | 2 +- .../match/match-byte-array-patterns-2.stderr | 4 +- .../ui/match/match-byte-array-patterns.stderr | 16 +- src/test/ui/match/match-ill-type2.stderr | 2 +- src/test/ui/match/match-join.stderr | 2 +- .../match-no-arms-unreachable-after.stderr | 2 +- src/test/ui/match/match-non-exhaustive.stderr | 4 +- src/test/ui/match/match-ref-ice.stderr | 2 +- .../ui/match/match-ref-mut-invariance.stderr | 2 +- .../match/match-ref-mut-let-invariance.stderr | 2 +- src/test/ui/match/match-tag-nullary.stderr | 2 +- src/test/ui/match/match-tag-unary.stderr | 2 +- .../ui/match/match-type-err-first-arm.stderr | 12 +- .../ui/match/match-unresolved-one-arm.stderr | 2 +- src/test/ui/match/match-vec-fixed.stderr | 4 +- src/test/ui/match/match-vec-mismatch.stderr | 8 +- .../ui/match/match-vec-unreachable.stderr | 6 +- src/test/ui/maybe-bounds.stderr | 6 +- ...od-ambig-one-trait-unknown-int-type.stderr | 2 +- ...method-ambig-two-traits-cross-crate.stderr | 2 +- ...method-ambig-two-traits-from-bounds.stderr | 2 +- ...mbig-two-traits-with-default-method.stderr | 2 +- .../ui/methods/method-call-err-msg.stderr | 8 +- ...ethod-call-lifetime-args-unresolved.stderr | 2 +- .../methods/method-call-type-binding.stderr | 2 +- ...e-trait-object-with-separate-params.stderr | 12 +- .../ui/methods/method-macro-backtrace.stderr | 2 +- .../ui/methods/method-missing-call.stderr | 4 +- src/test/ui/methods/method-self-arg-1.stderr | 4 +- src/test/ui/methods/method-self-arg-2.stderr | 4 +- src/test/ui/mir-dataflow/def-inits-1.stderr | 8 +- src/test/ui/mir-dataflow/inits-1.stderr | 6 +- src/test/ui/mir-dataflow/uninits-1.stderr | 10 +- src/test/ui/mir-dataflow/uninits-2.stderr | 2 +- src/test/ui/mir-unpretty.stderr | 2 +- src/test/ui/mismatched_types/E0409.stderr | 4 +- src/test/ui/mismatched_types/E0631.stderr | 8 +- src/test/ui/mismatched_types/abridged.stderr | 12 +- src/test/ui/mismatched_types/binops.stderr | 12 +- .../ui/mismatched_types/cast-rfc0401.stderr | 68 +++--- .../closure-arg-type-mismatch.stderr | 10 +- .../mismatched_types/closure-mismatch.stderr | 4 +- .../mismatched_types/const-fn-in-trait.stderr | 4 +- .../for-loop-has-unit-body.stderr | 2 +- .../ui/mismatched_types/issue-26480.stderr | 4 +- .../ui/mismatched_types/issue-35030.stderr | 2 +- .../ui/mismatched_types/issue-38371.stderr | 8 +- src/test/ui/mismatched_types/main.stderr | 2 +- .../overloaded-calls-bad.stderr | 2 +- .../trait-bounds-cant-coerce.stderr | 2 +- .../trait-impl-fn-incompatibility.stderr | 6 +- .../unboxed-closures-vtable-mismatch.stderr | 2 +- src/test/ui/missing/missing-block-hint.stderr | 4 +- .../ui/missing/missing-derivable-attr.stderr | 2 +- .../missing/missing-items/issue-40221.stderr | 2 +- src/test/ui/missing/missing-items/m2.stderr | 2 +- .../missing-type-parameter.stderr | 2 +- .../missing/missing-semicolon-warning.stderr | 4 +- src/test/ui/missing/missing-stability.stderr | 2 +- src/test/ui/missing_debug_impls.stderr | 4 +- src/test/ui/mod/mod_file_disambig.stderr | 2 +- src/test/ui/module-macro_use-arguments.stderr | 2 +- .../ui/moves/move-guard-same-consts.stderr | 2 +- src/test/ui/moves/move-in-guard-1.stderr | 2 +- src/test/ui/moves/move-in-guard-2.stderr | 2 +- .../ui/moves/move-into-dead-array-1.stderr | 2 +- .../ui/moves/move-into-dead-array-2.stderr | 2 +- src/test/ui/moves/move-out-of-array-1.stderr | 2 +- src/test/ui/moves/move-out-of-slice-1.stderr | 2 +- .../ui/moves/move-out-of-tuple-field.stderr | 4 +- ...moves-based-on-type-access-to-field.stderr | 2 +- .../moves-based-on-type-block-bad.stderr | 2 +- ...es-based-on-type-capture-clause-bad.stderr | 2 +- ...sed-on-type-cyclic-types-issue-4821.stderr | 2 +- ...-on-type-distribute-copy-over-paren.stderr | 8 +- .../ui/moves/moves-based-on-type-exprs.stderr | 22 +- .../moves-based-on-type-match-bindings.stderr | 2 +- ...-move-out-of-closure-env-issue-1965.stderr | 2 +- ...-on-type-no-recursive-stack-closure.stderr | 2 +- .../ui/moves/moves-sru-moved-field.stderr | 2 +- src/test/ui/multiple-main-2.stderr | 2 +- src/test/ui/multiple-main-3.stderr | 2 +- src/test/ui/mut/mut-cant-alias.stderr | 2 +- src/test/ui/mut/mut-cross-borrowing.stderr | 2 +- src/test/ui/mut/mut-pattern-mismatched.stderr | 4 +- src/test/ui/mut/mut-ref.stderr | 2 +- src/test/ui/mut/mutable-class-fields-2.stderr | 2 +- src/test/ui/namespace/namespace-mix.stderr | 104 ++++----- ...ed-enum-glob-import-no-impls-xcrate.stderr | 8 +- ...amespaced-enum-glob-import-no-impls.stderr | 8 +- src/test/ui/nested-cfg-attrs.stderr | 2 +- src/test/ui/never-assign-dead-code.stderr | 6 +- src/test/ui/never-assign-wrong-type.stderr | 2 +- src/test/ui/nll/borrowed-local-error.stderr | 2 +- .../nll/borrowed-referent-issue-38899.stderr | 2 +- .../ui/nll/borrowed-temporary-error.stderr | 2 +- .../ui/nll/cannot-move-block-spans.stderr | 18 +- src/test/ui/nll/closure-access-spans.stderr | 18 +- src/test/ui/nll/closure-borrow-spans.stderr | 28 +-- src/test/ui/nll/closure-captures.stderr | 44 ++-- src/test/ui/nll/closure-move-spans.stderr | 6 +- .../escape-argument.stderr | 2 +- .../escape-upvar-nested.stderr | 6 +- ...pagate-approximated-fail-no-postdom.stderr | 4 +- .../propagate-approximated-ref.stderr | 4 +- ...er-to-static-comparing-against-free.stderr | 4 +- ...oximated-shorter-to-static-no-bound.stderr | 6 +- ...mated-shorter-to-static-wrong-bound.stderr | 6 +- .../propagate-approximated-val.stderr | 4 +- ...ail-to-approximate-longer-no-bounds.stderr | 4 +- ...-to-approximate-longer-wrong-bounds.stderr | 4 +- .../propagate-from-trait-match.stderr | 4 +- .../propagate-multiple-requirements.stderr | 2 +- .../return-wrong-bound-region.stderr | 2 +- src/test/ui/nll/closure-use-spans.stderr | 6 +- src/test/ui/nll/closures-in-loops.stderr | 6 +- .../constant-thread-locals-issue-47053.stderr | 2 +- ...-not-ignore-lifetime-bounds-in-copy.stderr | 2 +- src/test/ui/nll/drop-no-may-dangle.stderr | 4 +- src/test/ui/nll/enum-drop-access.stderr | 4 +- src/test/ui/nll/guarantor-issue-46974.stderr | 4 +- .../issue-21232-partial-init-and-use.stderr | 6 +- src/test/ui/nll/issue-27868.stderr | 2 +- src/test/ui/nll/issue-31567.stderr | 2 +- src/test/ui/nll/issue-47388.stderr | 2 +- src/test/ui/nll/issue-47470.stderr | 2 +- src/test/ui/nll/issue-48238.stderr | 2 +- src/test/ui/nll/issue-48697.stderr | 2 +- src/test/ui/nll/issue-50716.stderr | 2 +- src/test/ui/nll/issue-51191.stderr | 2 +- src/test/ui/nll/issue-51268.stderr | 2 +- src/test/ui/nll/issue-52113.stderr | 2 +- src/test/ui/nll/issue-52534-2.stderr | 2 +- src/test/ui/nll/issue-52534.stderr | 4 +- src/test/ui/nll/issue-53773.stderr | 2 +- src/test/ui/nll/issue-54556-niconii.stderr | 2 +- .../ui/nll/issue-54556-stephaneyfx.stderr | 2 +- ...ssue-54556-temps-in-tail-diagnostic.stderr | 2 +- src/test/ui/nll/issue-54556-wrap-it-up.stderr | 2 +- src/test/ui/nll/issue-55394.stderr | 2 +- src/test/ui/nll/issue-55401.stderr | 2 +- src/test/ui/nll/issue-55850.stderr | 2 +- src/test/ui/nll/issue-57989.stderr | 6 +- src/test/ui/nll/issue-58299.stderr | 4 +- .../ui/nll/loan_ends_mid_block_vec.stderr | 2 +- src/test/ui/nll/match-cfg-fake-edges.stderr | 6 +- .../nll/match-guards-partially-borrow.stderr | 18 +- src/test/ui/nll/match-on-borrowed.stderr | 8 +- ...ialized-drop-implicit-fragment-drop.stderr | 2 +- ...aybe-initialized-drop-with-fragment.stderr | 2 +- ...d-drop-with-uninitialized-fragments.stderr | 2 +- src/test/ui/nll/maybe-initialized-drop.stderr | 2 +- src/test/ui/nll/move-errors.stderr | 6 +- .../ui/nll/move-subpaths-moves-root.stderr | 2 +- src/test/ui/nll/polonius-smoke-test.stderr | 8 +- src/test/ui/nll/promoted-bounds.stderr | 2 +- src/test/ui/nll/promoted-closure-pair.stderr | 2 +- .../nll/relate_tys/universe-violation.stderr | 2 +- .../nll/relate_tys/var-appears-twice.stderr | 2 +- .../ui/nll/return-ref-mut-issue-46557.stderr | 2 +- .../projection-no-regions-closure.stderr | 4 +- .../projection-one-region-closure.stderr | 4 +- ...tion-one-region-trait-bound-closure.stderr | 4 +- ...tion-two-region-trait-bound-closure.stderr | 6 +- ...ection-where-clause-env-wrong-bound.stderr | 2 +- .../projection-where-clause-none.stderr | 2 +- ...ram-closure-approximate-lower-bound.stderr | 2 +- ...m-closure-outlives-from-return-type.stderr | 2 +- ...-closure-outlives-from-where-clause.stderr | 10 +- .../ui/nll/ty-outlives/wf-unreachable.stderr | 16 +- .../ui/nll/type-alias-free-regions.stderr | 4 +- .../nll/type-check-pointer-coercions.stderr | 16 +- .../user-annotations/adt-brace-enums.stderr | 6 +- .../user-annotations/adt-brace-structs.stderr | 6 +- .../user-annotations/adt-nullary-enums.stderr | 6 +- .../user-annotations/adt-tuple-enums.stderr | 6 +- .../user-annotations/adt-tuple-struct.stderr | 6 +- .../cast_static_lifetime.stderr | 2 +- .../user-annotations/closure-substs.stderr | 8 +- .../constant-in-expr-inherent-1.stderr | 2 +- .../constant-in-expr-inherent-2.stderr | 10 +- .../constant-in-expr-normalize.stderr | 2 +- .../constant-in-expr-trait-item-1.stderr | 2 +- .../constant-in-expr-trait-item-2.stderr | 2 +- .../constant-in-expr-trait-item-3.stderr | 2 +- .../dump-adt-brace-struct.stderr | 2 +- .../user-annotations/dump-fn-method.stderr | 8 +- src/test/ui/nll/user-annotations/fns.stderr | 6 +- .../inherent-associated-constants.stderr | 2 +- .../nll/user-annotations/issue-54124.stderr | 4 +- .../issue-57731-ascibed-coupled-types.stderr | 8 +- .../nll/user-annotations/method-call.stderr | 6 +- .../nll/user-annotations/method-ufcs-1.stderr | 6 +- .../nll/user-annotations/method-ufcs-2.stderr | 6 +- .../nll/user-annotations/method-ufcs-3.stderr | 6 +- .../method-ufcs-inherent-1.stderr | 2 +- .../method-ufcs-inherent-3.stderr | 2 +- .../nll/user-annotations/normalization.stderr | 2 +- ...attern_substs_on_brace_enum_variant.stderr | 2 +- .../pattern_substs_on_brace_struct.stderr | 2 +- ...attern_substs_on_tuple_enum_variant.stderr | 2 +- .../pattern_substs_on_tuple_struct.stderr | 2 +- .../ui/nll/user-annotations/patterns.stderr | 32 +-- .../promoted-annotation.stderr | 2 +- .../type_ascription_static_lifetime.stderr | 2 +- .../nll/user-annotations/wf-self-type.stderr | 2 +- src/test/ui/no-implicit-prelude-nested.stderr | 36 ++-- src/test/ui/no-implicit-prelude.stderr | 12 +- src/test/ui/no-link-unknown-crate.stderr | 2 +- src/test/ui/no-link.stderr | 2 +- src/test/ui/no-patterns-in-args-2.stderr | 4 +- src/test/ui/no-patterns-in-args.stderr | 10 +- src/test/ui/no-reuse-move-arc.stderr | 4 +- src/test/ui/no-std-inject.stderr | 4 +- src/test/ui/no-type-for-node-ice.stderr | 2 +- src/test/ui/no_crate_type.stderr | 2 +- .../non-exhaustive-float-range-match.stderr | 2 +- .../non-exhaustive-match-nested.stderr | 4 +- .../non-exhaustive-match.stderr | 16 +- src/test/ui/noncopyable-class.stderr | 2 +- src/test/ui/nonscalar-cast.stderr | 2 +- src/test/ui/not-clone-closure.stderr | 2 +- src/test/ui/not-copy-closure.stderr | 2 +- src/test/ui/not-panic/not-panic-safe-5.stderr | 2 +- ...ect-lifetime-default-from-box-error.stderr | 4 +- ...ifetime-default-from-rptr-box-error.stderr | 2 +- ...time-default-from-rptr-struct-error.stderr | 2 +- .../object-lifetime-default-mybox.stderr | 4 +- .../object-lifetime-default.stderr | 14 +- src/test/ui/object-pointer-types.stderr | 6 +- .../object-safety-by-value-self-use.stderr | 2 +- .../ui/obsolete-syntax-impl-for-dotdot.stderr | 2 +- .../old-suffixes-are-really-forbidden.stderr | 4 +- .../expected-comma-found-token.stderr | 2 +- src/test/ui/on-unimplemented/on-trait.stderr | 2 +- .../ui/on-unimplemented/slice-index.stderr | 4 +- .../ui/once-cant-call-twice-on-heap.stderr | 2 +- src/test/ui/out-of-order-shadowing.stderr | 2 +- src/test/ui/overlap-marker-trait.stderr | 2 +- src/test/ui/overloaded-calls-nontuple.stderr | 2 +- .../panic-handler-bad-signature-1.stderr | 4 +- .../panic-handler-bad-signature-2.stderr | 2 +- .../panic-handler-bad-signature-3.stderr | 2 +- .../panic-handler-bad-signature-4.stderr | 2 +- .../panic-handler-duplicate.stderr | 2 +- .../panic-handler-wrong-location.stderr | 2 +- src/test/ui/panic-runtime/needs-gate.stderr | 4 +- src/test/ui/paren-span.stderr | 2 +- .../ui/parenthesized-deref-suggestion.stderr | 6 +- src/test/ui/parse-error-correct.stderr | 10 +- src/test/ui/parser-recovery-1.stderr | 2 +- src/test/ui/parser-recovery-2.stderr | 10 +- .../parser/ascii-only-character-escape.stderr | 6 +- src/test/ui/parser/assoc-oddities-1.stderr | 2 +- src/test/ui/parser/assoc-oddities-2.stderr | 2 +- src/test/ui/parser/attr-bad-meta-2.stderr | 2 +- src/test/ui/parser/attr-bad-meta-3.stderr | 2 +- src/test/ui/parser/attr-bad-meta.stderr | 2 +- src/test/ui/parser/attr-before-eof.stderr | 2 +- src/test/ui/parser/attr.stderr | 4 +- .../ui/parser/attrs-after-extern-mod.stderr | 2 +- src/test/ui/parser/bad-char-literals.stderr | 2 +- src/test/ui/parser/bad-lit-suffixes.stderr | 32 +-- src/test/ui/parser/bad-match.stderr | 2 +- .../ui/parser/bad-value-ident-false.stderr | 4 +- .../ui/parser/bad-value-ident-true.stderr | 4 +- src/test/ui/parser/better-expected.stderr | 2 +- .../parser/bind-struct-early-modifiers.stderr | 4 +- .../parser/bound-single-question-mark.stderr | 2 +- src/test/ui/parser/bounds-lifetime-1.stderr | 2 +- src/test/ui/parser/bounds-lifetime-2.stderr | 2 +- .../ui/parser/bounds-lifetime-where-1.stderr | 2 +- .../ui/parser/bounds-lifetime-where.stderr | 2 +- src/test/ui/parser/bounds-lifetime.stderr | 2 +- src/test/ui/parser/bounds-type.stderr | 2 +- src/test/ui/parser/byte-literals.stderr | 14 +- .../ui/parser/byte-string-literals.stderr | 10 +- .../ui/parser/circular_modules_main.stderr | 2 +- .../ui/parser/column-offset-1-based.stderr | 2 +- src/test/ui/parser/default.stderr | 6 +- src/test/ui/parser/doc-before-attr.stderr | 2 +- src/test/ui/parser/doc-before-eof.stderr | 2 +- .../ui/parser/empty-impl-semicolon.stderr | 2 +- .../extern-crate-unexpected-token.stderr | 2 +- .../parser/extern-expected-fn-or-brace.stderr | 2 +- .../ui/parser/extern-foreign-crate.stderr | 2 +- src/test/ui/parser/extern-no-fn.stderr | 2 +- src/test/ui/parser/if-in-in.stderr | 2 +- src/test/ui/parser/impl-parsing.stderr | 10 +- src/test/ui/parser/inner-attr.stderr | 2 +- src/test/ui/parser/issue-10392-2.stderr | 2 +- src/test/ui/parser/issue-10392.stderr | 4 +- src/test/ui/parser/issue-15914.stderr | 2 +- src/test/ui/parser/issue-15980.stderr | 4 +- .../ui/parser/issue-17718-const-mut.stderr | 2 +- src/test/ui/parser/issue-17904-2.stderr | 2 +- src/test/ui/parser/issue-17904.stderr | 2 +- src/test/ui/parser/issue-19096.stderr | 4 +- src/test/ui/parser/issue-19398.stderr | 2 +- src/test/ui/parser/issue-20711-2.stderr | 2 +- src/test/ui/parser/issue-20711.stderr | 2 +- src/test/ui/parser/issue-21153.stderr | 2 +- src/test/ui/parser/issue-22647.stderr | 2 +- src/test/ui/parser/issue-22712.stderr | 2 +- src/test/ui/parser/issue-2354-1.stderr | 2 +- src/test/ui/parser/issue-2354.stderr | 6 +- src/test/ui/parser/issue-24197.stderr | 2 +- src/test/ui/parser/issue-24375.stderr | 2 +- src/test/ui/parser/issue-3036.stderr | 2 +- src/test/ui/parser/issue-32446.stderr | 2 +- src/test/ui/parser/issue-32501.stderr | 2 +- src/test/ui/parser/issue-32505.stderr | 2 +- src/test/ui/parser/issue-33418.stderr | 10 +- src/test/ui/parser/issue-33455.stderr | 2 +- src/test/ui/parser/issue-41155.stderr | 2 +- src/test/ui/parser/issue-43692.stderr | 2 +- src/test/ui/parser/issue-5806.stderr | 2 +- src/test/ui/parser/issue-6610.stderr | 2 +- src/test/ui/parser/issue-8537.stderr | 2 +- src/test/ui/parser/keyword-abstract.stderr | 2 +- .../ui/parser/keyword-as-as-identifier.stderr | 2 +- .../parser/keyword-box-as-identifier.stderr | 2 +- .../parser/keyword-break-as-identifier.stderr | 2 +- .../parser/keyword-const-as-identifier.stderr | 2 +- .../keyword-continue-as-identifier.stderr | 2 +- .../parser/keyword-else-as-identifier.stderr | 2 +- .../parser/keyword-enum-as-identifier.stderr | 2 +- src/test/ui/parser/keyword-final.stderr | 2 +- .../ui/parser/keyword-fn-as-identifier.stderr | 2 +- .../parser/keyword-for-as-identifier.stderr | 2 +- .../ui/parser/keyword-if-as-identifier.stderr | 2 +- .../parser/keyword-impl-as-identifier.stderr | 2 +- .../ui/parser/keyword-in-as-identifier.stderr | 2 +- .../parser/keyword-let-as-identifier.stderr | 2 +- .../parser/keyword-loop-as-identifier.stderr | 2 +- .../parser/keyword-match-as-identifier.stderr | 2 +- .../parser/keyword-mod-as-identifier.stderr | 2 +- .../parser/keyword-move-as-identifier.stderr | 2 +- .../parser/keyword-mut-as-identifier.stderr | 2 +- src/test/ui/parser/keyword-override.stderr | 2 +- .../parser/keyword-pub-as-identifier.stderr | 2 +- .../parser/keyword-ref-as-identifier.stderr | 2 +- .../keyword-return-as-identifier.stderr | 2 +- .../keyword-static-as-identifier.stderr | 2 +- .../keyword-struct-as-identifier.stderr | 2 +- .../parser/keyword-trait-as-identifier.stderr | 2 +- ...yword-try-as-identifier-edition2018.stderr | 2 +- .../parser/keyword-type-as-identifier.stderr | 2 +- src/test/ui/parser/keyword-typeof.stderr | 2 +- .../keyword-unsafe-as-identifier.stderr | 2 +- .../parser/keyword-use-as-identifier.stderr | 2 +- .../parser/keyword-where-as-identifier.stderr | 2 +- .../parser/keyword-while-as-identifier.stderr | 2 +- .../ui/parser/lex-bad-binary-literal.stderr | 18 +- .../ui/parser/lex-bad-char-literals-1.stderr | 8 +- .../ui/parser/lex-bad-char-literals-2.stderr | 2 +- .../ui/parser/lex-bad-char-literals-4.stderr | 2 +- .../ui/parser/lex-bad-numeric-literals.stderr | 46 ++-- .../ui/parser/lex-bad-octal-literal.stderr | 4 +- src/test/ui/parser/lex-bad-token.stderr | 2 +- ...-bare-cr-string-literal-doc-comment.stderr | 8 +- src/test/ui/parser/lex-stray-backslash.stderr | 2 +- .../parser/macro-bad-delimiter-ident.stderr | 2 +- src/test/ui/parser/macro-keyword.stderr | 4 +- .../macro-mismatched-delim-brace-paren.stderr | 2 +- .../macro-mismatched-delim-paren-brace.stderr | 4 +- src/test/ui/parser/macro/issue-33569.stderr | 6 +- src/test/ui/parser/macro/issue-37113.stderr | 2 +- src/test/ui/parser/macro/issue-37234.stderr | 2 +- .../macro/macro-incomplete-parse.stderr | 6 +- src/test/ui/parser/macro/macro-repeat.stderr | 2 +- .../ui/parser/macro/pub-item-macro.stderr | 4 +- .../macro/trait-object-macro-matcher.stderr | 2 +- .../parser/macros-no-semicolon-items.stderr | 2 +- src/test/ui/parser/macros-no-semicolon.stderr | 2 +- .../match-arrows-block-then-binop.stderr | 2 +- .../ui/parser/match-refactor-to-expr.stderr | 6 +- src/test/ui/parser/match-vec-invalid.stderr | 2 +- .../parser/mod_file_not_exist_windows.stderr | 2 +- .../ui/parser/mod_file_with_path_attr.stderr | 2 +- .../multiline-comment-line-tracking.stderr | 2 +- src/test/ui/parser/mut-patterns.stderr | 2 +- .../ui/parser/new-unicode-escapes-1.stderr | 2 +- .../ui/parser/new-unicode-escapes-2.stderr | 2 +- .../ui/parser/new-unicode-escapes-3.stderr | 4 +- src/test/ui/parser/no-unsafe-self.stderr | 12 +- .../ui/parser/omitted-arg-in-item-fn.stderr | 2 +- .../ui/parser/paamayim-nekudotayim.stderr | 2 +- src/test/ui/parser/pat-lt-bracket-4.stderr | 2 +- src/test/ui/parser/pat-lt-bracket-5.stderr | 2 +- src/test/ui/parser/pat-lt-bracket-6.stderr | 2 +- src/test/ui/parser/pat-lt-bracket-7.stderr | 2 +- src/test/ui/parser/pat-ranges-1.stderr | 2 +- src/test/ui/parser/pat-ranges-2.stderr | 2 +- src/test/ui/parser/pat-ranges-3.stderr | 2 +- src/test/ui/parser/pat-ref-enum.stderr | 2 +- src/test/ui/parser/pat-tuple-1.stderr | 2 +- src/test/ui/parser/pat-tuple-4.stderr | 2 +- src/test/ui/parser/pat-tuple-5.stderr | 2 +- src/test/ui/parser/pub-method-macro.stderr | 2 +- src/test/ui/parser/range_inclusive.stderr | 2 +- .../parser/range_inclusive_dotdotdot.stderr | 24 +-- src/test/ui/parser/raw-byte-string-eof.stderr | 2 +- .../ui/parser/raw-byte-string-literals.stderr | 4 +- src/test/ui/parser/raw-str-delim.stderr | 2 +- src/test/ui/parser/raw-str-unbalanced.stderr | 2 +- .../ui/parser/raw/raw-literal-keywords.stderr | 12 +- src/test/ui/parser/recover-enum.stderr | 2 +- src/test/ui/parser/recover-enum2.stderr | 4 +- src/test/ui/parser/recover-struct.stderr | 2 +- .../parser/regions-out-of-scope-slice.stderr | 2 +- .../parser/removed-syntax-enum-newtype.stderr | 2 +- .../ui/parser/removed-syntax-fixed-vec.stderr | 2 +- .../ui/parser/removed-syntax-fn-sigil.stderr | 2 +- .../parser/removed-syntax-mut-vec-expr.stderr | 2 +- .../parser/removed-syntax-mut-vec-ty.stderr | 2 +- .../parser/removed-syntax-ptr-lifetime.stderr | 2 +- .../ui/parser/removed-syntax-record.stderr | 2 +- .../removed-syntax-uniq-mut-expr.stderr | 2 +- .../parser/removed-syntax-uniq-mut-ty.stderr | 2 +- .../ui/parser/struct-literal-in-for.stderr | 6 +- .../ui/parser/struct-literal-in-if.stderr | 6 +- ...truct-literal-in-match-discriminant.stderr | 14 +- .../ui/parser/struct-literal-in-while.stderr | 8 +- ...truct-literal-restrictions-in-lamda.stderr | 8 +- .../tag-variant-disr-non-nullary.stderr | 2 +- .../ui/parser/trait-bounds-not-on-impl.stderr | 2 +- .../trait-object-lifetime-parens.stderr | 6 +- src/test/ui/parser/unclosed-braces.stderr | 2 +- .../parser/underscore-suffix-for-float.stderr | 4 +- src/test/ui/parser/underscore_static.stderr | 2 +- .../unmatched-delimiter-at-end-of-file.stderr | 2 +- src/test/ui/parser/unsized2.stderr | 2 +- .../use-as-where-use-ends-with-mod-sep.stderr | 6 +- .../ui/parser/use-ends-with-mod-sep.stderr | 2 +- src/test/ui/partialeq_help.stderr | 2 +- src/test/ui/path-lookahead.stderr | 6 +- .../deny-irrefutable-let-patterns.stderr | 4 +- .../pat-shadow-in-nested-binding.stderr | 2 +- src/test/ui/pattern/pat-tuple-bad-type.stderr | 4 +- .../ui/pattern/pat-tuple-overfield.stderr | 4 +- .../pattern/patkind-litrange-no-expr.stderr | 4 +- .../pattern-binding-disambiguation.stderr | 16 +- .../ui/pattern/pattern-error-continue.stderr | 6 +- .../pattern-ident-path-generics.stderr | 2 +- src/test/ui/pattern/pattern-tyvar.stderr | 2 +- .../ui/pattern/slice-pattern-const-2.stderr | 6 +- .../ui/pattern/slice-pattern-const-3.stderr | 2 +- .../ui/pattern/slice-pattern-const.stderr | 16 +- ...type-err-cause-on-impl-trait-return.stderr | 4 +- .../ui/precise_pointer_size_matching.stderr | 4 +- src/test/ui/prim-with-args.stderr | 44 ++-- src/test/ui/priv-in-bad-locations.stderr | 8 +- src/test/ui/privacy/decl-macro.stderr | 2 +- src/test/ui/privacy/privacy-in-paths.stderr | 6 +- src/test/ui/privacy/privacy-ns1.stderr | 16 +- src/test/ui/privacy/privacy-ns2.stderr | 18 +- src/test/ui/privacy/privacy-sanity.stderr | 36 ++-- src/test/ui/privacy/privacy-ufcs.stderr | 2 +- src/test/ui/privacy/privacy1.stderr | 28 +-- src/test/ui/privacy/privacy4.stderr | 2 +- src/test/ui/privacy/privacy5.stderr | 96 ++++----- .../ui/privacy/private-impl-method.stderr | 2 +- .../privacy/private-in-public-assoc-ty.stderr | 12 +- .../private-in-public-ill-formed.stderr | 4 +- .../ui/privacy/private-in-public-lint.stderr | 4 +- .../private-in-public-non-principal.stderr | 2 +- .../ui/privacy/private-in-public-warn.stderr | 62 +++--- src/test/ui/privacy/private-in-public.stderr | 48 ++--- .../ui/privacy/private-inferred-type-1.stderr | 4 +- .../ui/privacy/private-inferred-type-2.stderr | 6 +- .../ui/privacy/private-inferred-type.stderr | 58 ++--- .../ui/privacy/private-item-simple.stderr | 2 +- .../privacy/private-method-cross-crate.stderr | 2 +- .../privacy/private-method-inherited.stderr | 2 +- src/test/ui/privacy/private-method.stderr | 2 +- .../privacy/private-struct-field-ctor.stderr | 2 +- .../private-struct-field-pattern.stderr | 2 +- .../ui/privacy/private-struct-field.stderr | 2 +- .../privacy/private-type-in-interface.stderr | 18 +- .../privacy/private-variant-reexport.stderr | 8 +- .../restricted/private-in-public.stderr | 4 +- .../restricted/struct-literal-field.stderr | 2 +- src/test/ui/privacy/restricted/test.stderr | 26 +-- .../ui/privacy/union-field-privacy-1.stderr | 4 +- .../ui/privacy/union-field-privacy-2.stderr | 2 +- .../ambiguous-builtin-attrs-test.stderr | 2 +- .../proc-macro/ambiguous-builtin-attrs.stderr | 12 +- .../attribute-order-restricted.stderr | 2 +- .../attribute-spans-preserved.stderr | 4 +- .../ui/proc-macro/attributes-included.stderr | 2 +- src/test/ui/proc-macro/define-two.stderr | 2 +- .../proc-macro/derive-helper-shadowing.stderr | 4 +- .../ui/proc-macro/derive-still-gated.stderr | 2 +- src/test/ui/proc-macro/dollar-crate.stderr | 4 +- src/test/ui/proc-macro/exports.stderr | 8 +- src/test/ui/proc-macro/generate-mod.stderr | 16 +- .../ui/proc-macro/invalid-attributes.stderr | 12 +- .../proc-macro/invalid-punct-ident-1.stderr | 2 +- .../proc-macro/invalid-punct-ident-2.stderr | 2 +- .../proc-macro/invalid-punct-ident-3.stderr | 2 +- .../proc-macro/invalid-punct-ident-4.stderr | 4 +- src/test/ui/proc-macro/issue-37788.stderr | 2 +- src/test/ui/proc-macro/issue-38586.stderr | 2 +- src/test/ui/proc-macro/issue-50493.stderr | 4 +- src/test/ui/proc-macro/lifetimes.stderr | 2 +- src/test/ui/proc-macro/macro-brackets.stderr | 2 +- .../macro-namespace-reserved-2.stderr | 18 +- .../macro-namespace-reserved.stderr | 6 +- src/test/ui/proc-macro/more-gates.stderr | 4 +- src/test/ui/proc-macro/multispan.stderr | 28 +-- .../ui/proc-macro/nested-item-spans.stderr | 4 +- .../ui/proc-macro/no-macro-use-attr.stderr | 2 +- .../proc-macro/proc-macro-attributes.stderr | 10 +- .../ui/proc-macro/proc-macro-gates.stderr | 34 +-- .../ui/proc-macro/proc-macro-gates2.stderr | 2 +- .../ui/proc-macro/pub-at-crate-root.stderr | 6 +- src/test/ui/proc-macro/shadow.stderr | 2 +- src/test/ui/proc-macro/signature.stderr | 2 +- .../ui/proc-macro/span-preservation.stderr | 10 +- src/test/ui/proc-macro/subspan.stderr | 32 +-- src/test/ui/proc-macro/three-equals.stderr | 14 +- src/test/ui/ptr-coercion.stderr | 6 +- .../pub/pub-reexport-priv-extern-crate.stderr | 6 +- .../ui/pub/pub-restricted-error-fn.stderr | 2 +- src/test/ui/pub/pub-restricted-error.stderr | 2 +- .../ui/pub/pub-restricted-non-path.stderr | 2 +- src/test/ui/pub/pub-restricted.stderr | 10 +- .../ui/qualified/qualified-path-params.stderr | 2 +- src/test/ui/question-mark-type-infer.stderr | 2 +- src/test/ui/range/range_traits-2.stderr | 2 +- src/test/ui/range/range_traits-3.stderr | 2 +- src/test/ui/range/range_traits-6.stderr | 2 +- src/test/ui/reachable/expr_add.stderr | 2 +- src/test/ui/reachable/expr_array.stderr | 4 +- src/test/ui/reachable/expr_assign.stderr | 6 +- src/test/ui/reachable/expr_block.stderr | 2 +- src/test/ui/reachable/expr_box.stderr | 2 +- src/test/ui/reachable/expr_call.stderr | 4 +- src/test/ui/reachable/expr_cast.stderr | 2 +- src/test/ui/reachable/expr_method.stderr | 4 +- src/test/ui/reachable/expr_repeat.stderr | 2 +- src/test/ui/reachable/expr_return.stderr | 2 +- src/test/ui/reachable/expr_struct.stderr | 8 +- src/test/ui/reachable/expr_tup.stderr | 4 +- src/test/ui/reachable/expr_type.stderr | 2 +- src/test/ui/reachable/expr_unary.stderr | 4 +- src/test/ui/recursion/recursion.stderr | 2 +- .../ui/recursion/recursive-reexports.stderr | 2 +- src/test/ui/ref-suggestion.stderr | 6 +- ...ons-fn-subtyping-return-static-fail.stderr | 4 +- ...gion-bound-on-closure-outlives-call.stderr | 6 +- ...unds-on-objects-and-type-parameters.stderr | 6 +- ...lifetime-bounds-on-fns-where-clause.stderr | 6 +- ...lifetime-bounds-on-fns-where-clause.stderr | 8 +- .../regions/region-object-lifetime-2.stderr | 6 +- .../regions/region-object-lifetime-4.stderr | 6 +- .../regions/region-object-lifetime-5.stderr | 2 +- .../ui/regions/regions-addr-of-arg.stderr | 4 +- .../ui/regions/regions-addr-of-self.stderr | 8 +- .../regions/regions-addr-of-upvar-self.stderr | 6 +- .../regions/regions-adjusted-lvalue-op.stderr | 4 +- ...s-bounded-by-trait-requiring-static.stderr | 12 +- ...-method-type-parameters-cross-crate.stderr | 2 +- ...-method-type-parameters-trait-bound.stderr | 2 +- src/test/ui/regions/regions-bounds.stderr | 4 +- ...s-close-associated-type-into-object.stderr | 16 +- .../regions-close-object-into-object-1.stderr | 2 +- .../regions-close-object-into-object-2.stderr | 4 +- .../regions-close-object-into-object-3.stderr | 2 +- .../regions-close-object-into-object-4.stderr | 4 +- ...-close-over-type-parameter-multiple.stderr | 4 +- .../regions-close-param-into-object.stderr | 16 +- .../ui/regions/regions-creating-enums.stderr | 4 +- .../ui/regions/regions-creating-enums3.stderr | 2 +- .../ui/regions/regions-creating-enums4.stderr | 2 +- .../ui/regions/regions-enum-not-wf.stderr | 18 +- .../ui/regions/regions-escape-method.stderr | 8 +- .../regions-escape-via-trait-or-not.stderr | 8 +- .../regions-fn-subtyping-return-static.stderr | 2 +- ...gions-free-region-ordering-callee-4.stderr | 2 +- ...regions-free-region-ordering-callee.stderr | 2 +- ...ions-free-region-ordering-incorrect.stderr | 6 +- .../ui/regions/regions-glb-free-free.stderr | 2 +- ...-implied-bounds-projection-gap-hr-1.stderr | 2 +- .../ui/regions/regions-in-enums-anon.stderr | 2 +- src/test/ui/regions/regions-in-enums.stderr | 4 +- .../ui/regions/regions-in-structs-anon.stderr | 2 +- src/test/ui/regions/regions-in-structs.stderr | 4 +- .../regions-infer-borrow-scope-too-big.stderr | 2 +- .../regions-infer-bound-from-trait.stderr | 8 +- ...ns-infer-contravariance-due-to-decl.stderr | 2 +- ...egions-infer-covariance-due-to-decl.stderr | 2 +- ...egions-infer-invariance-due-to-decl.stderr | 2 +- ...nfer-invariance-due-to-mutability-3.stderr | 2 +- ...nfer-invariance-due-to-mutability-4.stderr | 2 +- .../ui/regions/regions-infer-not-param.stderr | 18 +- .../regions-infer-paramd-indirect.stderr | 8 +- .../regions-infer-proc-static-upvar.stderr | 2 +- .../regions-lifetime-bounds-on-fns.stderr | 6 +- .../ui/regions/regions-name-duplicated.stderr | 2 +- .../ui/regions/regions-name-static.stderr | 2 +- .../ui/regions/regions-name-undeclared.stderr | 22 +- .../ui/regions/regions-nested-fns-2.stderr | 2 +- src/test/ui/regions/regions-nested-fns.stderr | 8 +- ...ions-normalize-in-where-clause-list.stderr | 6 +- ...gions-outlives-projection-container.stderr | 2 +- .../regions-pattern-typing-issue-19552.stderr | 2 +- .../regions/regions-proc-bound-capture.stderr | 2 +- ...borrow-from-shorter-mut-ref-mut-ref.stderr | 2 +- ...gions-reborrow-from-shorter-mut-ref.stderr | 2 +- .../ui/regions/regions-ref-in-fn-arg.stderr | 4 +- src/test/ui/regions/regions-ret.stderr | 4 +- ...ons-return-ref-to-upvar-issue-17403.stderr | 6 +- .../regions-return-stack-allocated-vec.stderr | 2 +- .../ui/regions/regions-steal-closure.stderr | 2 +- src/test/ui/regions/regions-trait-1.stderr | 4 +- .../regions-trait-object-subtyping.stderr | 8 +- .../ui/regions/regions-trait-variance.stderr | 2 +- src/test/ui/regions/regions-undeclared.stderr | 10 +- .../regions-var-type-out-of-scope.stderr | 2 +- ...nt-use-covariant-in-second-position.stderr | 2 +- ...ariance-contravariant-use-covariant.stderr | 2 +- ...ariance-covariant-use-contravariant.stderr | 2 +- ...ariance-invariant-use-contravariant.stderr | 2 +- ...ns-variance-invariant-use-covariant.stderr | 2 +- .../ui/regions/regions-wf-trait-object.stderr | 2 +- .../ui/reject-specialized-drops-8142.stderr | 4 +- src/test/ui/repr/repr-align-assign.stderr | 4 +- src/test/ui/repr/repr-align.stderr | 8 +- .../ui/repr/repr-packed-contains-align.stderr | 16 +- .../repr/repr-transparent-other-items.stderr | 18 +- .../repr/repr-transparent-other-reprs.stderr | 8 +- src/test/ui/repr/repr-transparent.stderr | 14 +- .../ui/reserved/reserved-attr-on-macro.stderr | 2 +- src/test/ui/resolve/issue-17518.stderr | 2 +- src/test/ui/resolve/issue-22692.stderr | 2 +- src/test/ui/resolve/issue-33876.stderr | 2 +- src/test/ui/resolve/issue-3907.stderr | 2 +- src/test/ui/resolve/issue-5035.stderr | 4 +- src/test/ui/resolve/issue-54379.stderr | 6 +- src/test/ui/resolve/issue-6702.stderr | 2 +- src/test/ui/resolve/name-clash-nullary.stderr | 2 +- .../resolve/resolve-bad-import-prefix.stderr | 2 +- .../ui/resolve/resolve-bad-visibility.stderr | 10 +- ...lve-conflict-import-vs-extern-crate.stderr | 4 +- ...solve-conflict-item-vs-extern-crate.stderr | 2 +- .../resolve/resolve-inconsistent-names.stderr | 4 +- src/test/ui/resolve/resolve-label.stderr | 2 +- .../ui/resolve/resolve-self-in-impl-2.stderr | 4 +- .../ui/resolve/resolve-self-in-impl.stderr | 10 +- .../resolve/resolve-variant-assoc-item.stderr | 4 +- .../ui/resolve/token-error-correct-2.stderr | 4 +- .../ui/resolve/token-error-correct-3.stderr | 2 +- .../ui/resolve/token-error-correct.stderr | 2 +- src/test/ui/resolve/tuple-struct-alias.stderr | 4 +- .../resolve/use_suggestion_placement.stderr | 6 +- src/test/ui/retslot-cast.stderr | 2 +- .../ui/return/return-from-diverging.stderr | 2 +- .../ui/return/return-match-array-const.stderr | 6 +- .../return/return-unit-from-diverging.stderr | 2 +- ...mination-trait-in-test-should-panic.stderr | 2 +- .../termination-trait-main-wrong-type.stderr | 2 +- .../termination-trait-not-satisfied.stderr | 2 +- .../termination-trait-test-wrong-type.stderr | 2 +- .../const.stderr | 2 +- .../rfc-2005-default-binding-mode/enum.stderr | 6 +- .../explicit-mut.stderr | 6 +- .../rfc-2005-default-binding-mode/lit.stderr | 4 +- .../no-double-error.stderr | 2 +- .../slice.stderr | 2 +- .../invalid-attribute.stderr | 4 +- .../ui/rfc-2008-non-exhaustive/structs.stderr | 2 +- .../cross-crate.stderr | 2 +- .../dont-infer-static.stderr | 4 +- .../ui/rfc-2093-infer-outlives/enum.stderr | 6 +- .../explicit-dyn.stderr | 2 +- .../explicit-enum.stderr | 2 +- .../explicit-projection.stderr | 2 +- .../explicit-struct.stderr | 2 +- .../explicit-union.stderr | 2 +- .../infer-static.stderr | 2 +- .../nested-enum.stderr | 2 +- .../nested-regions.stderr | 2 +- .../nested-structs.stderr | 2 +- .../nested-union.stderr | 2 +- .../rfc-2093-infer-outlives/projection.stderr | 2 +- .../rfc-2093-infer-outlives/reference.stderr | 2 +- .../regions-enum-not-wf.stderr | 18 +- ...ns-outlives-nominal-type-region-rev.stderr | 2 +- ...egions-outlives-nominal-type-region.stderr | 2 +- ...ions-outlives-nominal-type-type-rev.stderr | 2 +- .../regions-outlives-nominal-type-type.stderr | 2 +- .../regions-struct-not-wf.stderr | 10 +- .../rfc-2093-infer-outlives/self-dyn.stderr | 2 +- .../self-structs.stderr | 2 +- .../crate-path-non-absolute.stderr | 4 +- .../meta.stderr | 2 +- .../non-existent-1.stderr | 2 +- .../non-existent-3.stderr | 2 +- .../not-whitelisted.stderr | 4 +- .../single-segment.stderr | 6 +- .../rfc-2166-underscore-imports/basic.stderr | 4 +- .../unused-2018.stderr | 4 +- .../dbg-macro-move-semantics.stderr | 4 +- .../dbg-macro-requires-debug.stderr | 2 +- .../generic-associated-types-where.stderr | 2 +- src/test/ui/rmeta.stderr | 2 +- src/test/ui/rmeta_meta_main.stderr | 2 +- .../ui/rust-2018/async-ident-allowed.stderr | 2 +- src/test/ui/rust-2018/async-ident.stderr | 2 +- src/test/ui/rust-2018/dyn-keyword.stderr | 2 +- .../rust-2018/dyn-trait-compatibility.stderr | 6 +- .../rust-2018/future-proofing-locals.stderr | 18 +- ...54400-unused-extern-crate-attr-span.stderr | 2 +- .../local-path-suggestions-2015.stderr | 2 +- .../local-path-suggestions-2018.stderr | 4 +- .../rust-2018/macro-use-warned-against.stderr | 4 +- .../suggestions-not-always-applicable.stderr | 4 +- .../rust-2018/trait-import-suggestions.stderr | 8 +- .../block-scoped-shadow-nested.stderr | 2 +- .../rust-2018/uniform-paths/deadlock.stderr | 2 +- .../uniform-paths/issue-54253.stderr | 2 +- .../uniform-paths/issue-56596.stderr | 2 +- .../uniform-paths/macro-rules.stderr | 6 +- .../uniform-paths/prelude-fail-2.stderr | 8 +- .../uniform-paths/prelude-fail.stderr | 4 +- src/test/ui/rustc-args-required-const.stderr | 4 +- src/test/ui/rustc-args-required-const2.stderr | 2 +- src/test/ui/rustc-error.stderr | 2 +- src/test/ui/safe-extern-statics-mut.stderr | 8 +- src/test/ui/safe-extern-statics.stderr | 8 +- src/test/ui/self/self-infer.stderr | 4 +- .../ui/self/self-vs-path-ambiguity.stderr | 2 +- src/test/ui/self/self_type_keyword-2.stderr | 2 +- src/test/ui/seq-args.stderr | 4 +- .../ui/shadowed/shadowed-trait-methods.stderr | 2 +- .../shadowed/shadowed-use-visibility.stderr | 4 +- .../shadowing-in-the-same-pattern.stderr | 4 +- src/test/ui/simd-type.stderr | 6 +- src/test/ui/similar-tokens.stderr | 2 +- .../ui/single-primitive-inherent-impl.stderr | 4 +- .../ui/single-use-lifetime/fn-types.stderr | 2 +- .../one-use-in-fn-argument.stderr | 4 +- .../one-use-in-inherent-impl-header.stderr | 2 +- ...one-use-in-inherent-method-argument.stderr | 6 +- .../one-use-in-inherent-method-return.stderr | 2 +- .../one-use-in-trait-method-argument.stderr | 4 +- ...inherent-method-argument-and-return.stderr | 2 +- .../zero-uses-in-impl.stderr | 2 +- src/test/ui/slice-2.stderr | 8 +- src/test/ui/slice-mut-2.stderr | 2 +- src/test/ui/span/E0057.stderr | 4 +- src/test/ui/span/E0072.stderr | 2 +- src/test/ui/span/E0204.stderr | 8 +- src/test/ui/span/E0535.stderr | 2 +- src/test/ui/span/E0536.stderr | 2 +- src/test/ui/span/E0537.stderr | 2 +- ...ck-borrow-overloaded-auto-deref-mut.stderr | 20 +- ...orrowck-borrow-overloaded-deref-mut.stderr | 8 +- ...borrowck-call-is-borrow-issue-12224.stderr | 2 +- ...owck-call-method-from-mut-aliasable.stderr | 2 +- .../ui/span/borrowck-object-mutability.stderr | 4 +- .../ui/span/destructor-restrictions.stderr | 2 +- .../ui/span/dropck_arr_cycle_checked.stderr | 2 +- .../span/dropck_direct_cycle_with_drop.stderr | 2 +- .../ui/span/dropck_vec_cycle_checked.stderr | 2 +- .../ui/span/gated-features-attr-spans.stderr | 2 +- src/test/ui/span/import-ty-params.stderr | 4 +- src/test/ui/span/issue-11925.stderr | 2 +- src/test/ui/span/issue-24690.stderr | 6 +- src/test/ui/span/issue-25199.stderr | 2 +- src/test/ui/span/issue-27522.stderr | 2 +- src/test/ui/span/issue-29595.stderr | 2 +- src/test/ui/span/issue-34264.stderr | 16 +- src/test/ui/span/issue-36530.stderr | 6 +- src/test/ui/span/issue-37767.stderr | 6 +- .../issue-42234-unknown-receiver-type.stderr | 2 +- src/test/ui/span/issue28498-reject-ex1.stderr | 2 +- src/test/ui/span/lint-unused-unsafe.stderr | 18 +- .../ui/span/macro-span-replacement.stderr | 2 +- src/test/ui/span/macro-ty-params.stderr | 8 +- src/test/ui/span/missing-unit-argument.stderr | 20 +- src/test/ui/span/move-closure.stderr | 2 +- src/test/ui/span/multiline-span-E0072.stderr | 2 +- src/test/ui/span/multiline-span-simple.stderr | 2 +- src/test/ui/span/mut-arg-hint.stderr | 6 +- .../ui/span/non-existing-module-import.stderr | 2 +- src/test/ui/span/pub-struct-field.stderr | 6 +- src/test/ui/span/recursive-type-field.stderr | 4 +- .../regions-escape-loop-via-variable.stderr | 2 +- .../span/regions-escape-loop-via-vec.stderr | 8 +- .../span/send-is-not-static-std-sync.stderr | 6 +- src/test/ui/span/suggestion-non-ascii.stderr | 2 +- src/test/ui/span/typo-suggestion.stderr | 4 +- .../unused-warning-point-at-signature.stderr | 8 +- .../vec-must-not-hide-type-from-dropck.stderr | 2 +- src/test/ui/span/visibility-ty-params.stderr | 6 +- ...specialization-feature-gate-default.stderr | 2 +- .../specialization-no-default.stderr | 10 +- .../defaultimpl/validation.stderr | 8 +- src/test/ui/specialization/issue-39448.stderr | 2 +- src/test/ui/specialization/issue-52050.stderr | 2 +- .../specialization-default-projection.stderr | 4 +- .../specialization-default-types.stderr | 4 +- ...specialization-feature-gate-default.stderr | 2 +- ...specialization-feature-gate-overlap.stderr | 2 +- .../specialization-no-default.stderr | 10 +- .../specialization-overlap-negative.stderr | 2 +- .../specialization-overlap.stderr | 8 +- .../specialization-polarity.stderr | 4 +- ...missing-stability-attr-at-top-level.stderr | 2 +- .../stability-attribute-issue-43027.stderr | 2 +- ...attribute-non-staged-force-unstable.stderr | 6 +- .../stability-attribute-non-staged.stderr | 6 +- .../stability-attribute-sanity-2.stderr | 6 +- .../stability-attribute-sanity-3.stderr | 2 +- .../stability-attribute-sanity-4.stderr | 12 +- .../stability-attribute-sanity.stderr | 32 +-- .../ui/static/static-items-cant-move.stderr | 2 +- .../ui/static/static-lifetime-bound.stderr | 4 +- src/test/ui/static/static-lifetime.stderr | 4 +- .../ui/static/static-method-privacy.stderr | 2 +- .../ui/static/static-mut-bad-types.stderr | 2 +- .../static-mut-foreign-requires-unsafe.stderr | 6 +- src/test/ui/static/static-mut-not-pat.stderr | 2 +- .../static/static-mut-requires-unsafe.stderr | 6 +- .../ui/static/static-reference-to-fn-1.stderr | 2 +- .../ui/static/static-reference-to-fn-2.stderr | 6 +- src/test/ui/static/static-region-bound.stderr | 2 +- src/test/ui/std-uncopyable-atomics.stderr | 8 +- src/test/ui/stmt_expr_attrs_no_feature.stderr | 18 +- src/test/ui/str/str-as-char.stderr | 8 +- src/test/ui/str/str-idx.stderr | 8 +- src/test/ui/str/str-lit-type-mismatch.stderr | 6 +- .../structs/struct-base-wrong-type-2.stderr | 4 +- .../ui/structs/struct-base-wrong-type.stderr | 4 +- .../ui/structs/struct-field-privacy.stderr | 10 +- src/test/ui/structs/struct-fields-dupe.stderr | 2 +- .../ui/structs/struct-fields-missing.stderr | 2 +- .../struct-fields-shorthand-unresolved.stderr | 2 +- .../ui/structs/struct-fields-shorthand.stderr | 2 +- src/test/ui/structs/struct-fields-typo.stderr | 2 +- .../struct-like-enum-nonexhaustive.stderr | 2 +- .../ui/structs/struct-missing-comma.stderr | 2 +- .../structs/struct-pat-derived-error.stderr | 6 +- .../struct-path-associated-type.stderr | 10 +- .../struct-path-self-type-mismatch.stderr | 6 +- src/test/ui/structs/struct-path-self.stderr | 4 +- .../struct-pattern-match-useless.stderr | 2 +- .../structs/struct-variant-privacy-xc.stderr | 4 +- .../ui/structs/struct-variant-privacy.stderr | 4 +- ...structure-constructor-type-mismatch.stderr | 14 +- src/test/ui/suffixed-literal-meta.stderr | 24 +-- .../ui/suggestions/attribute-typos.stderr | 6 +- .../duplicate-suggestions.stderr | 18 +- .../dont-suggest-ref/simple.stderr | 32 +-- ...mpl-trait-return-trailing-semicolon.stderr | 2 +- ...ng-semicolon-between-call-and-tuple.stderr | 2 +- src/test/ui/suggestions/suggest-labels.stderr | 6 +- .../ui/suggestions/suggest-methods.stderr | 8 +- .../suggestions/suggest-move-lifetimes.stderr | 8 +- .../ui/suggestions/suggest-move-types.stderr | 8 +- .../ui/suggestions/suggest-variants.stderr | 6 +- src/test/ui/super-at-top-level.stderr | 2 +- src/test/ui/svh/svh-change-lit.stderr | 2 +- .../ui/svh/svh-change-significant-cfg.stderr | 2 +- src/test/ui/svh/svh-change-trait-bound.stderr | 2 +- src/test/ui/svh/svh-change-type-arg.stderr | 2 +- src/test/ui/svh/svh-change-type-ret.stderr | 2 +- src/test/ui/svh/svh-change-type-static.stderr | 2 +- src/test/ui/svh/svh-use-trait.stderr | 2 +- src/test/ui/switched-expectations.stderr | 2 +- src/test/ui/symbol-names/basic.stderr | 4 +- src/test/ui/symbol-names/impl1.stderr | 8 +- src/test/ui/synthetic-param.stderr | 6 +- src/test/ui/tag-type-args.stderr | 2 +- .../ui/tag-variant-cast-non-nullary.stderr | 2 +- src/test/ui/tag-variant-disr-dup.stderr | 2 +- src/test/ui/target-feature-wrong.stderr | 2 +- src/test/ui/terr-in-field.stderr | 2 +- src/test/ui/terr-sorts.stderr | 2 +- .../test-attr-non-associated-functions.stderr | 2 +- src/test/ui/test-cfg.stderr | 2 +- src/test/ui/test-warns-dead-code.stderr | 2 +- src/test/ui/thread-local-mutation.stderr | 2 +- .../tool-attributes-misplaced-1.stderr | 12 +- .../tool-attributes-misplaced-2.stderr | 4 +- .../tool-attributes-shadowing.stderr | 2 +- src/test/ui/tool_lints-fail.stderr | 2 +- src/test/ui/trace_macros-format.stderr | 12 +- src/test/ui/trace_macros-gate.stderr | 10 +- .../ui/trait-method-number-parameters.stderr | 2 +- src/test/ui/traits/trait-alias-impl.stderr | 2 +- src/test/ui/traits/trait-alias-object.stderr | 4 +- src/test/ui/traits/trait-alias-syntax.stderr | 4 +- src/test/ui/traits/trait-alias-wf.stderr | 2 +- .../traits/trait-bounds-not-on-struct.stderr | 4 +- .../trait-bounds-on-structs-and-enums.stderr | 12 +- src/test/ui/traits/trait-bounds-sugar.stderr | 2 +- .../trait-coercion-generic-regions.stderr | 2 +- .../ui/traits/trait-duplicate-methods.stderr | 2 +- src/test/ui/traits/trait-impl-1.stderr | 2 +- ...-impl-can-not-have-untraitful-items.stderr | 6 +- .../ui/traits/trait-impl-for-module.stderr | 2 +- ...trait-has-wrong-lifetime-parameters.stderr | 6 +- src/test/ui/traits/trait-item-privacy.stderr | 26 +-- .../ui/traits/trait-method-private.stderr | 2 +- .../trait-object-auto-dedup-in-impl.stderr | 2 +- .../traits/trait-object-macro-matcher.stderr | 4 +- src/test/ui/traits/trait-object-safety.stderr | 4 +- .../traits/trait-or-new-type-instead.stderr | 2 +- .../trait-resolution-in-overloaded-op.stderr | 2 +- .../traits/trait-safety-inherent-impl.stderr | 2 +- .../traits/trait-safety-trait-impl-cc.stderr | 2 +- .../ui/traits/trait-safety-trait-impl.stderr | 4 +- src/test/ui/traits/trait-test-2.stderr | 4 +- src/test/ui/traits/trait-test.stderr | 2 +- ...traits-assoc-type-in-supertrait-bad.stderr | 2 +- ...inductive-overflow-supertrait-oibit.stderr | 4 +- ...raits-inductive-overflow-supertrait.stderr | 2 +- ...raits-inductive-overflow-two-traits.stderr | 2 +- .../ui/traits/traits-multidispatch-bad.stderr | 2 +- .../traits-repeated-supertrait-ambig.stderr | 10 +- .../ui/transmute-equal-assoc-types.stderr | 2 +- src/test/ui/transmute/main.stderr | 8 +- .../transmute/transmute-fat-pointers.stderr | 8 +- src/test/ui/transmute/transmute-impl.stderr | 2 +- ...l-bounds-inconsistent-copy-reborrow.stderr | 4 +- ...ounds-inconsistent-projection-error.stderr | 2 +- .../trivial-bounds-leak-copy.stderr | 2 +- .../trivial-bounds/trivial-bounds-leak.stderr | 8 +- .../trivial-bounds/trivial-bounds-lint.stderr | 10 +- src/test/ui/trivial_casts.stderr | 36 ++-- .../try-block/try-block-bad-lifetime.stderr | 8 +- .../ui/try-block/try-block-bad-type.stderr | 10 +- .../try-block/try-block-in-edition2015.stderr | 6 +- .../ui/try-block/try-block-in-match.stderr | 2 +- .../ui/try-block/try-block-in-while.stderr | 2 +- .../try-block-maybe-bad-lifetime.stderr | 6 +- .../ui/try-block/try-block-opt-init.stderr | 2 +- src/test/ui/try-on-option.stderr | 4 +- src/test/ui/try-operator-on-main.stderr | 8 +- src/test/ui/tuple/tuple-float-index.stderr | 2 +- .../ui/tuple/tuple-struct-fields/test2.stderr | 4 +- .../ui/tuple/tuple-struct-fields/test3.stderr | 4 +- .../tuple/tuple-struct-nonexhaustive.stderr | 2 +- ...type-alias-enum-variants-priority-2.stderr | 2 +- src/test/ui/type/type-alias-bounds.stderr | 12 +- ...e-ascription-instead-of-initializer.stderr | 4 +- ...ascription-instead-of-statement-end.stderr | 4 +- .../ui/type/type-ascription-precedence.stderr | 16 +- .../ui/type/type-ascription-soundness.stderr | 8 +- .../type/type-ascription-with-fn-call.stderr | 2 +- .../cannot_infer_local_or_array.stderr | 2 +- .../ui/type/type-check/issue-22897.stderr | 2 +- .../ui/type/type-check/issue-40294.stderr | 2 +- .../ui/type/type-check/issue-41314.stderr | 4 +- .../type/type-check/missing_trait_impl.stderr | 4 +- .../unknown_type_for_closure.stderr | 2 +- .../type-dependent-def-issue-49241.stderr | 2 +- src/test/ui/type/type-mismatch.stderr | 94 ++++---- .../type-params-in-different-spaces-1.stderr | 2 +- .../type-params-in-different-spaces-2.stderr | 4 +- .../type-params-in-different-spaces-3.stderr | 2 +- .../ui/type/type-path-err-node-types.stderr | 8 +- src/test/ui/type/type-recursive.stderr | 2 +- src/test/ui/type/type-shadow.stderr | 2 +- ...e-57673-ice-on-deref-of-boxed-trait.stderr | 2 +- .../typeck-auto-trait-no-supertraits-2.stderr | 2 +- .../typeck-auto-trait-no-supertraits.stderr | 2 +- ...ypeck-default-trait-impl-assoc-type.stderr | 2 +- ...lt-trait-impl-cross-crate-coherence.stderr | 8 +- ...ypeck-default-trait-impl-send-param.stderr | 2 +- .../ui/ufcs/ufcs-explicit-self-bad.stderr | 8 +- .../ui/ufcs/ufcs-partially-resolved.stderr | 64 +++--- src/test/ui/ui-testing-optout.stderr | 6 +- .../unboxed-closure-illegal-move.stderr | 8 +- .../unboxed-closure-immutable-capture.stderr | 16 +- .../unboxed-closure-no-cyclic-sig.stderr | 2 +- .../unboxed-closure-region.stderr | 2 +- ...oxed-closure-sugar-lifetime-elision.stderr | 2 +- ...ong-number-number-type-parameters-1.stderr | 2 +- .../unboxed-closures-borrow-conflict.stderr | 2 +- ...oxed-closures-failed-recursive-fn-1.stderr | 2 +- ...-argument-types-two-region-pointers.stderr | 6 +- ...-infer-fn-once-move-from-projection.stderr | 2 +- ...es-infer-fnmut-calling-fnmut-no-mut.stderr | 6 +- ...ed-closures-infer-fnmut-missing-mut.stderr | 2 +- ...osures-infer-fnmut-move-missing-mut.stderr | 2 +- ...ed-closures-infer-fnonce-call-twice.stderr | 2 +- ...osures-infer-fnonce-move-call-twice.stderr | 2 +- .../unboxed-closures-mutate-upvar.stderr | 12 +- ...ed-closures-static-call-wrong-trait.stderr | 2 +- .../unboxed-closures-type-mismatch.stderr | 2 +- src/test/ui/unconstrained-none.stderr | 2 +- src/test/ui/unconstrained-ref.stderr | 2 +- src/test/ui/underscore-ident-matcher.stderr | 2 +- .../dyn-trait-underscore-in-struct.stderr | 4 +- .../dyn-trait-underscore.stderr | 6 +- .../in-fn-return-illegal.stderr | 2 +- .../ui/underscore-lifetime/in-struct.stderr | 4 +- .../underscore-lifetime-binders.stderr | 10 +- ...underscore-lifetime-elison-mismatch.stderr | 2 +- .../underscore-outlives-bounds.stderr | 2 +- .../underscore-lifetime/where-clauses.stderr | 4 +- .../unevaluated_fixed_size_array_len.stderr | 2 +- .../uninhabited/uninhabited-enum-cast.stderr | 2 +- .../uninhabited-irrefutable.stderr | 2 +- .../uninhabited-matches-feature-gated.stderr | 12 +- .../uninhabited/uninhabited-patterns.stderr | 8 +- .../union-borrow-move-parent-sibling.stderr | 12 +- src/test/ui/union/union-const-pat.stderr | 2 +- src/test/ui/union/union-copy.stderr | 2 +- src/test/ui/union/union-derive-clone.stderr | 4 +- src/test/ui/union/union-derive-eq.stderr | 2 +- src/test/ui/union/union-derive.stderr | 12 +- src/test/ui/union/union-empty.stderr | 2 +- src/test/ui/union/union-fields-1.stderr | 8 +- src/test/ui/union/union-fields-2.stderr | 26 +-- src/test/ui/union/union-lint-dead-code.stderr | 2 +- .../ui/union/union-nonrepresentable.stderr | 2 +- src/test/ui/union/union-repr-c.stderr | 2 +- src/test/ui/union/union-suggest-field.stderr | 4 +- src/test/ui/union/union-unsafe.stderr | 12 +- .../union/union-with-drop-fields-lint.stderr | 6 +- src/test/ui/unique-object-noncopyable.stderr | 2 +- src/test/ui/unique-pinned-nocopy.stderr | 2 +- src/test/ui/unknown-lint-tool-name.stderr | 4 +- src/test/ui/unknown-tool-name.stderr | 2 +- src/test/ui/unop-move-semantics.stderr | 10 +- src/test/ui/unop-neg-bool.stderr | 2 +- .../ui/unreachable/unreachable-arm.stderr | 2 +- .../ui/unreachable/unreachable-code.stderr | 2 +- .../ui/unreachable/unreachable-in-call.stderr | 4 +- .../ui/unreachable/unreachable-variant.stderr | 2 +- .../unwarned-match-on-never.stderr | 6 +- .../unresolved-import-recovery.stderr | 2 +- .../ui/unresolved/unresolved-import.stderr | 12 +- src/test/ui/unsafe/ranged_ints.stderr | 2 +- src/test/ui/unsafe/ranged_ints2.stderr | 2 +- src/test/ui/unsafe/ranged_ints2_const.stderr | 6 +- src/test/ui/unsafe/ranged_ints3.stderr | 2 +- src/test/ui/unsafe/ranged_ints3_const.stderr | 6 +- src/test/ui/unsafe/ranged_ints4.stderr | 2 +- ...fe-around-compiler-generated-unsafe.stderr | 2 +- .../unsafe/unsafe-fn-assign-deref-ptr.stderr | 2 +- src/test/ui/unsafe/unsafe-fn-autoderef.stderr | 2 +- .../unsafe/unsafe-fn-called-from-safe.stderr | 2 +- src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr | 2 +- .../ui/unsafe/unsafe-fn-used-as-value.stderr | 2 +- src/test/ui/unsafe/unsafe-subtyping.stderr | 2 +- src/test/ui/unsized-locals/double-move.stderr | 12 +- src/test/ui/unused/unused-attr.stderr | 30 +-- src/test/ui/unused/unused-macro-rules.stderr | 6 +- .../unused-macro-with-bad-frag-spec.stderr | 2 +- .../unused-macro-with-follow-violation.stderr | 2 +- src/test/ui/unused/unused-macro.stderr | 6 +- src/test/ui/unused/unused-result.stderr | 10 +- .../use/use-after-move-based-on-type.stderr | 2 +- .../use-after-move-self-based-on-type.stderr | 2 +- src/test/ui/use/use-after-move-self.stderr | 2 +- src/test/ui/use/use-from-trait-xc.stderr | 8 +- src/test/ui/use/use-mod/use-mod-3.stderr | 4 +- src/test/ui/use/use-mod/use-mod-4.stderr | 4 +- src/test/ui/use/use-paths-as-items.stderr | 2 +- src/test/ui/use/use-self-type.stderr | 4 +- src/test/ui/use/use-super-global-path.stderr | 6 +- src/test/ui/used.stderr | 8 +- src/test/ui/useless-pub.stderr | 6 +- src/test/ui/useless_comment.stderr | 24 +-- src/test/ui/user-defined-macro-rules.stderr | 2 +- src/test/ui/utf8_idents.stderr | 10 +- .../variance/variance-associated-types.stderr | 4 +- .../variance-btree-invariant-types.stderr | 24 +-- .../variance-cell-is-invariant.stderr | 2 +- .../variance-contravariant-arg-object.stderr | 4 +- ...iance-contravariant-arg-trait-match.stderr | 4 +- ...ance-contravariant-self-trait-match.stderr | 4 +- .../variance-covariant-arg-object.stderr | 4 +- .../variance-covariant-arg-trait-match.stderr | 4 +- ...variance-covariant-self-trait-match.stderr | 4 +- .../variance-invariant-arg-object.stderr | 4 +- .../variance-invariant-arg-trait-match.stderr | 4 +- ...variance-invariant-self-trait-match.stderr | 4 +- .../ui/variance/variance-issue-20533.stderr | 6 +- .../ui/variance/variance-object-types.stderr | 2 +- .../variance/variance-regions-direct.stderr | 14 +- .../variance/variance-regions-indirect.stderr | 10 +- .../variance-regions-unused-direct.stderr | 4 +- .../variance-regions-unused-indirect.stderr | 4 +- .../ui/variance/variance-trait-bounds.stderr | 8 +- .../variance/variance-trait-matching.stderr | 2 +- .../variance-trait-object-bound.stderr | 2 +- .../ui/variance/variance-types-bounds.stderr | 10 +- src/test/ui/variance/variance-types.stderr | 12 +- .../variance-unused-region-param.stderr | 4 +- ...variance-use-contravariant-struct-1.stderr | 2 +- .../variance-use-covariant-struct-1.stderr | 2 +- .../variance-use-invariant-struct-1.stderr | 4 +- .../variants/variant-size-differences.stderr | 2 +- .../ui/vec/vec-macro-with-comma-only.stderr | 2 +- src/test/ui/vec/vec-mut-iter-borrow.stderr | 2 +- src/test/ui/vector-cast-weirdness.stderr | 2 +- src/test/ui/vtable-res-trait-param.stderr | 2 +- src/test/ui/walk-struct-literal-with.stderr | 2 +- src/test/ui/warn-path-statement.stderr | 2 +- src/test/ui/wasm-import-module.stderr | 6 +- src/test/ui/wf/wf-array-elem-sized.stderr | 2 +- src/test/ui/wf/wf-enum-bound.stderr | 2 +- .../wf/wf-enum-fields-struct-variant.stderr | 2 +- src/test/ui/wf/wf-enum-fields.stderr | 2 +- src/test/ui/wf/wf-fn-where-clause.stderr | 2 +- .../wf/wf-impl-associated-type-region.stderr | 4 +- src/test/ui/wf/wf-in-fn-arg.stderr | 2 +- src/test/ui/wf/wf-in-fn-ret.stderr | 2 +- src/test/ui/wf/wf-in-fn-type-arg.stderr | 2 +- src/test/ui/wf/wf-in-fn-type-ret.stderr | 2 +- src/test/ui/wf/wf-in-fn-type-static.stderr | 8 +- src/test/ui/wf/wf-in-fn-where-clause.stderr | 2 +- src/test/ui/wf/wf-in-obj-type-static.stderr | 4 +- src/test/ui/wf/wf-in-obj-type-trait.stderr | 2 +- ...f-inherent-impl-method-where-clause.stderr | 2 +- .../wf/wf-inherent-impl-where-clause.stderr | 2 +- .../ui/wf/wf-misc-methods-issue-28609.stderr | 24 +-- src/test/ui/wf/wf-object-safe.stderr | 2 +- .../wf/wf-outlives-ty-in-fn-or-trait.stderr | 8 +- src/test/ui/wf/wf-static-method.stderr | 12 +- src/test/ui/wf/wf-struct-bound.stderr | 2 +- src/test/ui/wf/wf-struct-field.stderr | 2 +- .../wf/wf-trait-associated-type-bound.stderr | 2 +- src/test/ui/wf/wf-trait-bound.stderr | 2 +- src/test/ui/wf/wf-trait-default-fn-arg.stderr | 2 +- src/test/ui/wf/wf-trait-default-fn-ret.stderr | 2 +- .../wf-trait-default-fn-where-clause.stderr | 2 +- src/test/ui/wf/wf-trait-superbound.stderr | 2 +- .../ui/where-clauses/where-for-self-2.stderr | 2 +- src/test/ui/while-let.stderr | 6 +- src/test/ui/writing-to-immutable-vec.stderr | 2 +- 2648 files changed, 6703 insertions(+), 6703 deletions(-) diff --git a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr index d2c4a28ce980..e0e45d55a9e7 100644 --- a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr +++ b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr @@ -1,7 +1,7 @@ error: `[v2]` cannot be resolved, ignoring it... --> $DIR/deny-intra-link-resolution-failure.rs:3:6 | -LL | /// [v2] //~ ERROR +LL | /// [v2] | ^^ cannot be resolved, ignoring | note: lint level defined here diff --git a/src/test/rustdoc-ui/deny-missing-docs-crate.stderr b/src/test/rustdoc-ui/deny-missing-docs-crate.stderr index 4cc0f4b4128f..9cd50d26766e 100644 --- a/src/test/rustdoc-ui/deny-missing-docs-crate.stderr +++ b/src/test/rustdoc-ui/deny-missing-docs-crate.stderr @@ -1,21 +1,21 @@ error: missing documentation for crate --> $DIR/deny-missing-docs-crate.rs:1:1 | -LL | / #![deny(missing_docs)] //~ ERROR +LL | / #![deny(missing_docs)] LL | | -LL | | pub struct Foo; //~ ERROR +LL | | pub struct Foo; | |_______________^ | note: lint level defined here --> $DIR/deny-missing-docs-crate.rs:1:9 | -LL | #![deny(missing_docs)] //~ ERROR +LL | #![deny(missing_docs)] | ^^^^^^^^^^^^ error: missing documentation for a struct --> $DIR/deny-missing-docs-crate.rs:3:1 | -LL | pub struct Foo; //~ ERROR +LL | pub struct Foo; | ^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/rustdoc-ui/deny-missing-docs-macro.stderr b/src/test/rustdoc-ui/deny-missing-docs-macro.stderr index ce9584a4bb0c..ef15bf05d54e 100644 --- a/src/test/rustdoc-ui/deny-missing-docs-macro.stderr +++ b/src/test/rustdoc-ui/deny-missing-docs-macro.stderr @@ -1,7 +1,7 @@ error: missing documentation for macro --> $DIR/deny-missing-docs-macro.rs:6:1 | -LL | macro_rules! foo { //~ ERROR +LL | macro_rules! foo { | ^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr index 12a56dcc4a5e..d273ec019752 100644 --- a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr +++ b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr @@ -1,7 +1,7 @@ error: `[TypeAlias::hoge]` cannot be resolved, ignoring it... --> $DIR/intra-doc-alias-ice.rs:5:30 | -LL | /// [broken cross-reference](TypeAlias::hoge) //~ ERROR +LL | /// [broken cross-reference](TypeAlias::hoge) | ^^^^^^^^^^^^^^^ cannot be resolved, ignoring | note: lint level defined here diff --git a/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr index 34d026e957d6..37d8b964c242 100644 --- a/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr +++ b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr @@ -3,7 +3,7 @@ error[E0597]: `arena` does not live long enough | LL | f(&arena); | ^^^^^ borrowed value does not live long enough -LL | } //~^ ERROR `arena` does not live long enough +LL | } | - `arena` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr index 47754da8b78d..c791b8b451e5 100644 --- a/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr +++ b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr @@ -3,7 +3,7 @@ error[E0597]: `arena` does not live long enough | LL | f(&arena); | ^^^^^ borrowed value does not live long enough -LL | } //~^ ERROR `arena` does not live long enough +LL | } | - `arena` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui-fulldeps/issue-15778-fail.stderr b/src/test/ui-fulldeps/issue-15778-fail.stderr index 8eafd1cefa6c..d68928617764 100644 --- a/src/test/ui-fulldeps/issue-15778-fail.stderr +++ b/src/test/ui-fulldeps/issue-15778-fail.stderr @@ -1,7 +1,7 @@ error: crate is not marked with #![crate_okay] --> $DIR/issue-15778-fail.rs:5:1 | -LL | / #![feature(plugin)] //~ ERROR crate is not marked with #![crate_okay] +LL | / #![feature(plugin)] LL | | #![plugin(lint_for_crate)] LL | | LL | | pub fn main() { } diff --git a/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr index 9b629ca6778e..cd0bff92bf11 100644 --- a/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr +++ b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr @@ -1,7 +1,7 @@ error: item is named 'lintme' --> $DIR/lint-group-plugin-deny-cmdline.rs:8:1 | -LL | fn lintme() { } //~ ERROR item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | = note: `-D test-lint` implied by `-D lint-me` @@ -9,7 +9,7 @@ LL | fn lintme() { } //~ ERROR item is named 'lintme' error: item is named 'pleaselintme' --> $DIR/lint-group-plugin-deny-cmdline.rs:10:1 | -LL | fn pleaselintme() { } //~ ERROR item is named 'pleaselintme' +LL | fn pleaselintme() { } | ^^^^^^^^^^^^^^^^^^^^^ | = note: `-D please-lint` implied by `-D lint-me` diff --git a/src/test/ui-fulldeps/lint-group-plugin.stderr b/src/test/ui-fulldeps/lint-group-plugin.stderr index b566048c75ee..8ccf9700b9fc 100644 --- a/src/test/ui-fulldeps/lint-group-plugin.stderr +++ b/src/test/ui-fulldeps/lint-group-plugin.stderr @@ -1,7 +1,7 @@ warning: item is named 'lintme' --> $DIR/lint-group-plugin.rs:9:1 | -LL | fn lintme() { } //~ WARNING item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | = note: #[warn(test_lint)] on by default @@ -9,7 +9,7 @@ LL | fn lintme() { } //~ WARNING item is named 'lintme' warning: item is named 'pleaselintme' --> $DIR/lint-group-plugin.rs:10:1 | -LL | fn pleaselintme() { } //~ WARNING item is named 'pleaselintme' +LL | fn pleaselintme() { } | ^^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(please_lint)] on by default diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr b/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr index 1beb5b7816cb..0b2dbad884c5 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr @@ -1,7 +1,7 @@ warning: item is named 'lintme' --> $DIR/lint-plugin-cmdline-load.rs:8:1 | -LL | fn lintme() { } //~ WARNING item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | = note: #[warn(test_lint)] on by default diff --git a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr index 81fee10e56ff..5bfde8551ed3 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr +++ b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr @@ -1,7 +1,7 @@ error: item is named 'lintme' --> $DIR/lint-plugin-deny-attr.rs:8:1 | -LL | fn lintme() { } //~ ERROR item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr index 9b84abf704c7..e4257dfde6f9 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr +++ b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr @@ -1,7 +1,7 @@ error: item is named 'lintme' --> $DIR/lint-plugin-deny-cmdline.rs:8:1 | -LL | fn lintme() { } //~ ERROR item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | = note: requested on the command line with `-D test-lint` diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr index 11dd75621bf5..092d0eb7a81a 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr @@ -10,7 +10,7 @@ LL | #[allow(test_lint)] error: item is named 'lintme' --> $DIR/lint-plugin-forbid-attrs.rs:8:1 | -LL | fn lintme() { } //~ ERROR item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr index b03051250fca..fc2906da5f5f 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr @@ -1,7 +1,7 @@ error[E0453]: allow(test_lint) overruled by outer forbid(test_lint) --> $DIR/lint-plugin-forbid-cmdline.rs:10:9 | -LL | #[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(test_lint) +LL | #[allow(test_lint)] | ^^^^^^^^^ overruled by previous forbid | = note: `forbid` lint level was set on command line @@ -9,7 +9,7 @@ LL | #[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(te error: item is named 'lintme' --> $DIR/lint-plugin-forbid-cmdline.rs:8:1 | -LL | fn lintme() { } //~ ERROR item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | = note: requested on the command line with `-F test-lint` diff --git a/src/test/ui-fulldeps/lint-plugin.stderr b/src/test/ui-fulldeps/lint-plugin.stderr index 11e3222a1a51..94791e369fc3 100644 --- a/src/test/ui-fulldeps/lint-plugin.stderr +++ b/src/test/ui-fulldeps/lint-plugin.stderr @@ -1,7 +1,7 @@ warning: item is named 'lintme' --> $DIR/lint-plugin.rs:8:1 | -LL | fn lintme() { } //~ WARNING item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | = note: #[warn(test_lint)] on by default diff --git a/src/test/ui-fulldeps/lint_tool_test.stderr b/src/test/ui-fulldeps/lint_tool_test.stderr index 95db7ec455db..cec8800a25c7 100644 --- a/src/test/ui-fulldeps/lint_tool_test.stderr +++ b/src/test/ui-fulldeps/lint_tool_test.stderr @@ -21,7 +21,7 @@ LL | #[allow(test_group)] warning: unknown lint: `this_lint_does_not_exist` --> $DIR/lint_tool_test.rs:27:8 | -LL | #[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist` +LL | #[deny(this_lint_does_not_exist)] | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(unknown_lints)] on by default @@ -35,7 +35,7 @@ LL | #![cfg_attr(foo, warn(test_lint))] error: item is named 'lintme' --> $DIR/lint_tool_test.rs:14:1 | -LL | fn lintme() { } //~ ERROR item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | note: lint level defined here @@ -48,7 +48,7 @@ LL | #![deny(clippy_group)] error: item is named 'lintmetoo' --> $DIR/lint_tool_test.rs:22:5 | -LL | fn lintmetoo() { } //~ ERROR item is named 'lintmetoo' +LL | fn lintmetoo() { } | ^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui-fulldeps/plugin-as-extern-crate.stderr b/src/test/ui-fulldeps/plugin-as-extern-crate.stderr index 4a5a53980eb8..ccc9580a60c2 100644 --- a/src/test/ui-fulldeps/plugin-as-extern-crate.stderr +++ b/src/test/ui-fulldeps/plugin-as-extern-crate.stderr @@ -1,7 +1,7 @@ error: compiler plugin used as an ordinary library --> $DIR/plugin-as-extern-crate.rs:10:1 | -LL | extern crate attr_plugin_test; //~ ERROR compiler plugin used as an ordinary library +LL | extern crate attr_plugin_test; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/E0508.stderr b/src/test/ui/E0508.stderr index 1e7b4071d5d7..ba6cff80416f 100644 --- a/src/test/ui/E0508.stderr +++ b/src/test/ui/E0508.stderr @@ -1,7 +1,7 @@ error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array --> $DIR/E0508.rs:5:18 | -LL | let _value = array[0]; //~ ERROR [E0508] +LL | let _value = array[0]; | ^^^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/E0583.stderr b/src/test/ui/E0583.stderr index 33b584ccefeb..ef7a48bc8a48 100644 --- a/src/test/ui/E0583.stderr +++ b/src/test/ui/E0583.stderr @@ -1,7 +1,7 @@ error[E0583]: file not found for module `module_that_doesnt_exist` --> $DIR/E0583.rs:1:5 | -LL | mod module_that_doesnt_exist; //~ ERROR E0583 +LL | mod module_that_doesnt_exist; | ^^^^^^^^^^^^^^^^^^^^^^^^ | = help: name the file either module_that_doesnt_exist.rs or module_that_doesnt_exist/mod.rs inside the directory "$DIR" diff --git a/src/test/ui/E0642.stderr b/src/test/ui/E0642.stderr index 4c82a6cbd21b..da255143494d 100644 --- a/src/test/ui/E0642.stderr +++ b/src/test/ui/E0642.stderr @@ -1,31 +1,31 @@ error[E0642]: patterns aren't allowed in methods without bodies --> $DIR/E0642.rs:5:12 | -LL | fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies +LL | fn foo((x, y): (i32, i32)); | ^^^^^^ help: give this argument a name or use an underscore to ignore it | -LL | fn foo(_: (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies +LL | fn foo(_: (i32, i32)); | ^ error[E0642]: patterns aren't allowed in methods without bodies --> $DIR/E0642.rs:7:12 | -LL | fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies +LL | fn bar((x, y): (i32, i32)) {} | ^^^^^^ help: give this argument a name or use an underscore to ignore it | -LL | fn bar(_: (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies +LL | fn bar(_: (i32, i32)) {} | ^ error[E0642]: patterns aren't allowed in methods without bodies --> $DIR/E0642.rs:9:15 | -LL | fn method(S { .. }: S) {} //~ ERROR patterns aren't allowed in methods without bodies +LL | fn method(S { .. }: S) {} | ^^^^^^^^ help: give this argument a name or use an underscore to ignore it | -LL | fn method(_: S) {} //~ ERROR patterns aren't allowed in methods without bodies +LL | fn method(_: S) {} | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/E0662.stderr b/src/test/ui/E0662.stderr index 2156b43973fc..5dea744998d8 100644 --- a/src/test/ui/E0662.stderr +++ b/src/test/ui/E0662.stderr @@ -1,7 +1,7 @@ error[E0662]: input operand constraint contains '=' --> $DIR/E0662.rs:6:12 | -LL | : "=test"("a") //~ ERROR E0662 +LL | : "=test"("a") | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/E0663.stderr b/src/test/ui/E0663.stderr index 66667a6dc884..01bf89ec79af 100644 --- a/src/test/ui/E0663.stderr +++ b/src/test/ui/E0663.stderr @@ -1,7 +1,7 @@ error[E0663]: input operand constraint contains '+' --> $DIR/E0663.rs:6:12 | -LL | : "+test"("a") //~ ERROR E0663 +LL | : "+test"("a") | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/E0664.stderr b/src/test/ui/E0664.stderr index 972b10379d43..9c9f65ee6a96 100644 --- a/src/test/ui/E0664.stderr +++ b/src/test/ui/E0664.stderr @@ -1,7 +1,7 @@ error[E0664]: clobber should not be surrounded by braces --> $DIR/E0664.rs:7:12 | -LL | : "{eax}" //~ ERROR E0664 +LL | : "{eax}" | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/E0665.stderr b/src/test/ui/E0665.stderr index e044d6065312..2c2b498e39a4 100644 --- a/src/test/ui/E0665.stderr +++ b/src/test/ui/E0665.stderr @@ -1,7 +1,7 @@ error[E0665]: `Default` cannot be derived for enums, only structs --> $DIR/E0665.rs:1:10 | -LL | #[derive(Default)] //~ ERROR E0665 +LL | #[derive(Default)] | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/absolute-paths-in-nested-use-groups.stderr b/src/test/ui/absolute-paths-in-nested-use-groups.stderr index 72ad0509e46a..e41590ac45ee 100644 --- a/src/test/ui/absolute-paths-in-nested-use-groups.stderr +++ b/src/test/ui/absolute-paths-in-nested-use-groups.stderr @@ -1,19 +1,19 @@ error[E0433]: failed to resolve: crate root in paths can only be used in start position --> $DIR/absolute-paths-in-nested-use-groups.rs:6:5 | -LL | ::bar, //~ ERROR crate root in paths can only be used in start position +LL | ::bar, | ^ crate root in paths can only be used in start position error[E0433]: failed to resolve: `super` in paths can only be used in start position --> $DIR/absolute-paths-in-nested-use-groups.rs:7:5 | -LL | super::bar, //~ ERROR `super` in paths can only be used in start position +LL | super::bar, | ^^^^^ `super` in paths can only be used in start position error[E0433]: failed to resolve: `self` in paths can only be used in start position --> $DIR/absolute-paths-in-nested-use-groups.rs:8:5 | -LL | self::bar, //~ ERROR `self` in paths can only be used in start position +LL | self::bar, | ^^^^ `self` in paths can only be used in start position error: aborting due to 3 previous errors diff --git a/src/test/ui/access-mode-in-closures.stderr b/src/test/ui/access-mode-in-closures.stderr index 0423c713531f..9976dfe946fd 100644 --- a/src/test/ui/access-mode-in-closures.stderr +++ b/src/test/ui/access-mode-in-closures.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/access-mode-in-closures.rs:8:15 | -LL | match *s { S(v) => v } //~ ERROR cannot move out +LL | match *s { S(v) => v } | ^^ - hint: to prevent move, use `ref v` or `ref mut v` | | | cannot move out of borrowed content diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr index 8efbf7f78d91..34e09da45ad5 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr @@ -1,13 +1,13 @@ error: return type should be `!` --> $DIR/alloc-error-handler-bad-signature-1.rs:12:6 | -LL | ) -> () //~ ERROR return type should be `!` +LL | ) -> () | ^^ error: argument should be `Layout` --> $DIR/alloc-error-handler-bad-signature-1.rs:11:11 | -LL | info: &Layout, //~ ERROR argument should be `Layout` +LL | info: &Layout, | ^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr index 95ef9a0522c3..85544b0c3849 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr @@ -1,13 +1,13 @@ error: return type should be `!` --> $DIR/alloc-error-handler-bad-signature-2.rs:12:3 | -LL | ) { //~ ERROR return type should be `!` +LL | ) { | ^ error: argument should be `Layout` --> $DIR/alloc-error-handler-bad-signature-2.rs:11:11 | -LL | info: Layout, //~ ERROR argument should be `Layout` +LL | info: Layout, | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr index 284802f21b9d..8575e7508f12 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr @@ -1,7 +1,7 @@ error: function should have one argument --> $DIR/alloc-error-handler-bad-signature-3.rs:10:1 | -LL | fn oom() -> ! { //~ ERROR function should have one argument +LL | fn oom() -> ! { | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/allocator-submodule.stderr b/src/test/ui/allocator-submodule.stderr index 32c7211cd164..26d7aa80eee1 100644 --- a/src/test/ui/allocator-submodule.stderr +++ b/src/test/ui/allocator-submodule.stderr @@ -1,7 +1,7 @@ error: `global_allocator` cannot be used in submodules --> $DIR/allocator-submodule.rs:27:5 | -LL | static MY_HEAP: MyAlloc = MyAlloc; //~ ERROR global_allocator +LL | static MY_HEAP: MyAlloc = MyAlloc; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/allocator/function-allocator.stderr b/src/test/ui/allocator/function-allocator.stderr index ecb6e4d4ecde..5e47b0f0cc7a 100644 --- a/src/test/ui/allocator/function-allocator.stderr +++ b/src/test/ui/allocator/function-allocator.stderr @@ -1,7 +1,7 @@ error: allocators must be statics --> $DIR/function-allocator.rs:2:1 | -LL | fn foo() {} //~ ERROR: allocators must be statics +LL | fn foo() {} | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/anon-params-denied-2018.stderr b/src/test/ui/anon-params-denied-2018.stderr index dd9e933542fa..1ec0cf323e99 100644 --- a/src/test/ui/anon-params-denied-2018.stderr +++ b/src/test/ui/anon-params-denied-2018.stderr @@ -1,7 +1,7 @@ error: expected one of `:` or `@`, found `)` --> $DIR/anon-params-denied-2018.rs:6:15 | -LL | fn foo(i32); //~ expected one of `:` or `@`, found `)` +LL | fn foo(i32); | ---^ expected one of `:` or `@` here | | | help: explicitly ignore parameter: `_: i32` diff --git a/src/test/ui/anon-params-deprecated.stderr b/src/test/ui/anon-params-deprecated.stderr index 691c3159a526..e97dbc15f9cd 100644 --- a/src/test/ui/anon-params-deprecated.stderr +++ b/src/test/ui/anon-params-deprecated.stderr @@ -1,7 +1,7 @@ warning: anonymous parameters are deprecated and will be removed in the next edition. --> $DIR/anon-params-deprecated.rs:9:12 | -LL | fn foo(i32); //~ WARNING anonymous parameters are deprecated +LL | fn foo(i32); | ^^^ help: Try naming the parameter or explicitly ignoring it: `_: i32` | note: lint level defined here diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr index 378f352cb922..9e84b1495096 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr +++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr @@ -1,7 +1,7 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:2:5 | -LL | f1(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f1(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r, 's> fn(&'r (), &'s ()) -> _` @@ -15,7 +15,7 @@ LL | fn f1(_: F) where F: Fn(&(), &()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:2:5 | -LL | f1(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f1(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&(), &()) -> _` @@ -29,7 +29,7 @@ LL | fn f1(_: F) where F: Fn(&(), &()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:4:5 | -LL | f2(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f2(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'a, 'r> fn(&'a (), &'r ()) -> _` @@ -43,7 +43,7 @@ LL | fn f2(_: F) where F: for<'a> Fn(&'a (), &()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:4:5 | -LL | f2(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f2(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&'a (), &()) -> _` @@ -57,7 +57,7 @@ LL | fn f2(_: F) where F: for<'a> Fn(&'a (), &()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:6:5 | -LL | f3(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f3(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&(), &'r ()) -> _` @@ -71,7 +71,7 @@ LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:6:5 | -LL | f3(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f3(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&(), &()) -> _` @@ -85,7 +85,7 @@ LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5 | -LL | f4(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f4(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s, 'r> fn(&'s (), &'r ()) -> _` @@ -99,7 +99,7 @@ LL | fn f4(_: F) where F: for<'r> Fn(&(), &'r ()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5 | -LL | f4(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f4(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&(), &'r ()) -> _` @@ -113,7 +113,7 @@ LL | fn f4(_: F) where F: for<'r> Fn(&(), &'r ()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5 | -LL | f5(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f5(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), &'r ()) -> _` @@ -127,7 +127,7 @@ LL | fn f5(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5 | -LL | f5(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f5(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&'r (), &'r ()) -> _` @@ -141,7 +141,7 @@ LL | fn f5(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 | -LL | g1(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g1(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>) -> _` @@ -155,7 +155,7 @@ LL | fn g1(_: F) where F: Fn(&(), Box) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 | -LL | g1(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g1(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&(), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>) -> _` @@ -169,7 +169,7 @@ LL | fn g1(_: F) where F: Fn(&(), Box) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5 | -LL | g2(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g2(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), for<'s> fn(&'s ())) -> _` @@ -183,7 +183,7 @@ LL | fn g2(_: F) where F: Fn(&(), fn(&())) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5 | -LL | g2(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g2(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&(), for<'r> fn(&'r ())) -> _` @@ -197,7 +197,7 @@ LL | fn g2(_: F) where F: Fn(&(), fn(&())) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5 | -LL | g3(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g3(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s> fn(&'s (), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>) -> _` @@ -211,7 +211,7 @@ LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5 | -LL | g3(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g3(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&'s (), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>) -> _` @@ -225,7 +225,7 @@ LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5 | -LL | g4(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g4(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _` @@ -239,7 +239,7 @@ LL | fn g4(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5 | -LL | g4(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g4(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&(), for<'r> fn(&'r ())) -> _` @@ -253,7 +253,7 @@ LL | fn g4(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:20:5 | -LL | h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch +LL | h1(|_: (), _: (), _: (), _: ()| {}); | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | | | expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<(dyn for<'t0> std::ops::Fn(&'t0 ()) + 'static)>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _` @@ -267,7 +267,7 @@ LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:20:5 | -LL | h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch +LL | h1(|_: (), _: (), _: (), _: ()| {}); | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | | | expected signature of `fn(&(), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>, &(), for<'r, 's> fn(&'r (), &'s ())) -> _` @@ -281,7 +281,7 @@ LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5 | -LL | h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch +LL | h2(|_: (), _: (), _: (), _: ()| {}); | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | | | expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _` @@ -295,7 +295,7 @@ LL | fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &() error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5 | -LL | h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch +LL | h2(|_: (), _: (), _: (), _: ()| {}); | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | | | expected signature of `fn(&(), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>, &'t0 (), for<'r, 's> fn(&'r (), &'s ())) -> _` diff --git a/src/test/ui/array-break-length.stderr b/src/test/ui/array-break-length.stderr index bba475304610..1cbf77a99f87 100644 --- a/src/test/ui/array-break-length.stderr +++ b/src/test/ui/array-break-length.stderr @@ -1,13 +1,13 @@ error[E0268]: `break` outside of loop --> $DIR/array-break-length.rs:3:17 | -LL | |_: [_; break]| {} //~ ERROR: `break` outside of loop +LL | |_: [_; break]| {} | ^^^^^ cannot break outside of a loop error[E0268]: `continue` outside of loop --> $DIR/array-break-length.rs:7:17 | -LL | |_: [_; continue]| {} //~ ERROR: `continue` outside of loop +LL | |_: [_; continue]| {} | ^^^^^^^^ cannot break outside of a loop error: aborting due to 2 previous errors diff --git a/src/test/ui/asm/asm-in-bad-modifier.stderr b/src/test/ui/asm/asm-in-bad-modifier.stderr index 339875390185..21e80fb98027 100644 --- a/src/test/ui/asm/asm-in-bad-modifier.stderr +++ b/src/test/ui/asm/asm-in-bad-modifier.stderr @@ -1,13 +1,13 @@ error[E0662]: input operand constraint contains '=' --> $DIR/asm-in-bad-modifier.rs:23:39 | -LL | asm!("mov $1, $0" : "=r"(x) : "=r"(5)); //~ ERROR operand constraint contains '=' +LL | asm!("mov $1, $0" : "=r"(x) : "=r"(5)); | ^^^^ error[E0663]: input operand constraint contains '+' --> $DIR/asm-in-bad-modifier.rs:24:39 | -LL | asm!("mov $1, $0" : "=r"(y) : "+r"(5)); //~ ERROR operand constraint contains '+' +LL | asm!("mov $1, $0" : "=r"(y) : "+r"(5)); | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/asm/asm-out-no-modifier.stderr b/src/test/ui/asm/asm-out-no-modifier.stderr index 12a33e451fb0..99134ceba332 100644 --- a/src/test/ui/asm/asm-out-no-modifier.stderr +++ b/src/test/ui/asm/asm-out-no-modifier.stderr @@ -1,7 +1,7 @@ error[E0661]: output operand constraint lacks '=' or '+' --> $DIR/asm-out-no-modifier.rs:22:29 | -LL | asm!("mov $1, $0" : "r"(x) : "r"(5)); //~ ERROR output operand constraint lacks '=' +LL | asm!("mov $1, $0" : "r"(x) : "r"(5)); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/asm/asm-parse-errors.stderr b/src/test/ui/asm/asm-parse-errors.stderr index 37b61b80b2b8..9fe59d12e12c 100644 --- a/src/test/ui/asm/asm-parse-errors.stderr +++ b/src/test/ui/asm/asm-parse-errors.stderr @@ -1,67 +1,67 @@ error: macro requires a string literal as an argument --> $DIR/asm-parse-errors.rs:4:5 | -LL | asm!(); //~ ERROR requires a string literal as an argument +LL | asm!(); | ^^^^^^^ string literal required error: expected string literal --> $DIR/asm-parse-errors.rs:5:18 | -LL | asm!("nop" : struct); //~ ERROR expected string literal +LL | asm!("nop" : struct); | ^^^^^^ expected string literal error: expected string literal --> $DIR/asm-parse-errors.rs:6:30 | -LL | asm!("mov %eax, $$0x2" : struct); //~ ERROR expected string literal +LL | asm!("mov %eax, $$0x2" : struct); | ^^^^^^ expected string literal error: expected `(`, found keyword `struct` --> $DIR/asm-parse-errors.rs:7:39 | -LL | asm!("mov %eax, $$0x2" : "={eax}" struct); //~ ERROR expected `(` +LL | asm!("mov %eax, $$0x2" : "={eax}" struct); | ^^^^^^ expected `(` error: expected expression, found keyword `struct` --> $DIR/asm-parse-errors.rs:8:39 | -LL | asm!("mov %eax, $$0x2" : "={eax}"(struct)); //~ ERROR expected expression +LL | asm!("mov %eax, $$0x2" : "={eax}"(struct)); | ^^^^^^ expected expression error: expected string literal --> $DIR/asm-parse-errors.rs:9:44 | -LL | asm!("in %dx, %al" : "={al}"(result) : struct); //~ ERROR expected string literal +LL | asm!("in %dx, %al" : "={al}"(result) : struct); | ^^^^^^ expected string literal error: expected `(`, found keyword `struct` --> $DIR/asm-parse-errors.rs:10:51 | -LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); //~ ERROR expected `(` +LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); | ^^^^^^ expected `(` error: expected expression, found keyword `struct` --> $DIR/asm-parse-errors.rs:11:51 | -LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); //~ ERROR expected expression +LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); | ^^^^^^ expected expression error: expected string literal --> $DIR/asm-parse-errors.rs:12:36 | -LL | asm!("mov $$0x200, %eax" : : : struct); //~ ERROR expected string literal +LL | asm!("mov $$0x200, %eax" : : : struct); | ^^^^^^ expected string literal error: expected string literal --> $DIR/asm-parse-errors.rs:13:45 | -LL | asm!("mov eax, 2" : "={eax}"(foo) : : : struct); //~ ERROR expected string literal +LL | asm!("mov eax, 2" : "={eax}"(foo) : : : struct); | ^^^^^^ expected string literal error: inline assembly must be a string literal --> $DIR/asm-parse-errors.rs:14:10 | -LL | asm!(123); //~ ERROR inline assembly must be a string literal +LL | asm!(123); | ^^^ error: aborting due to 11 previous errors diff --git a/src/test/ui/assign-to-method.stderr b/src/test/ui/assign-to-method.stderr index f79f0750d890..feceadb67220 100644 --- a/src/test/ui/assign-to-method.stderr +++ b/src/test/ui/assign-to-method.stderr @@ -1,7 +1,7 @@ error[E0615]: attempted to take value of method `speak` on type `Cat` --> $DIR/assign-to-method.rs:20:8 | -LL | nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method +LL | nyan.speak = || println!("meow"); | ^^^^^ | = help: methods are immutable and cannot be assigned to @@ -9,7 +9,7 @@ LL | nyan.speak = || println!("meow"); //~ ERROR attempted to take value of me error[E0615]: attempted to take value of method `speak` on type `Cat` --> $DIR/assign-to-method.rs:21:8 | -LL | nyan.speak += || println!("meow"); //~ ERROR attempted to take value of method +LL | nyan.speak += || println!("meow"); | ^^^^^ | = help: methods are immutable and cannot be assigned to diff --git a/src/test/ui/assignment-operator-unimplemented.stderr b/src/test/ui/assignment-operator-unimplemented.stderr index 1d7adb129d0e..5304b09de5ef 100644 --- a/src/test/ui/assignment-operator-unimplemented.stderr +++ b/src/test/ui/assignment-operator-unimplemented.stderr @@ -1,7 +1,7 @@ error[E0368]: binary assignment operation `+=` cannot be applied to type `Foo` --> $DIR/assignment-operator-unimplemented.rs:6:3 | -LL | a += *b; //~ Error: binary assignment operation `+=` cannot be applied to type `Foo` +LL | a += *b; | -^^^^^^ | | | cannot use `+=` on type `Foo` diff --git a/src/test/ui/assoc-inherent.stderr b/src/test/ui/assoc-inherent.stderr index f438ac8df4a0..f9ea3365cb8d 100644 --- a/src/test/ui/assoc-inherent.stderr +++ b/src/test/ui/assoc-inherent.stderr @@ -1,7 +1,7 @@ error[E0202]: associated types are not yet supported in inherent impls (see #8995) --> $DIR/assoc-inherent.rs:6:5 | -LL | type Bar = isize; //~ERROR associated types are not yet supported in inherent impls (see #8995) +LL | type Bar = isize; | ^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-const/associated-const-ambiguity-report.stderr b/src/test/ui/associated-const/associated-const-ambiguity-report.stderr index 47748609b162..5f2b9c47e8c2 100644 --- a/src/test/ui/associated-const/associated-const-ambiguity-report.stderr +++ b/src/test/ui/associated-const/associated-const-ambiguity-report.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/associated-const-ambiguity-report.rs:17:16 | -LL | const X: i32 = ::ID; //~ ERROR E0034 +LL | const X: i32 = ::ID; | ^^^^^^^^^ multiple `ID` found | note: candidate #1 is defined in an impl of the trait `Foo` for the type `i32` diff --git a/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr b/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr index 6cc63de35d74..ea475ffc5547 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr +++ b/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr @@ -3,7 +3,7 @@ error[E0201]: duplicate definitions with name `bar`: | LL | const bar: bool = true; | ----------------------- previous definition of `bar` here -LL | fn bar() {} //~ ERROR duplicate definitions +LL | fn bar() {} | ^^^^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr b/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr index 07ce5e621a62..57495863c989 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr +++ b/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr @@ -3,7 +3,7 @@ error[E0201]: duplicate definitions with name `Bar`: | LL | type Bar = i16; | --------------- previous definition of `Bar` here -LL | type Bar = u16; //~ ERROR duplicate definitions +LL | type Bar = u16; | ^^^^^^^^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/associated-item/associated-item-duplicate-names.stderr b/src/test/ui/associated-item/associated-item-duplicate-names.stderr index 2bbe91252145..f4af9e029395 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names.stderr +++ b/src/test/ui/associated-item/associated-item-duplicate-names.stderr @@ -3,7 +3,7 @@ error[E0201]: duplicate definitions with name `Ty`: | LL | type Ty = (); | ------------- previous definition of `Ty` here -LL | type Ty = usize; //~ ERROR duplicate definitions +LL | type Ty = usize; | ^^^^^^^^^^^^^^^^ duplicate definition error[E0201]: duplicate definitions with name `BAR`: @@ -11,7 +11,7 @@ error[E0201]: duplicate definitions with name `BAR`: | LL | const BAR: u32 = 7; | ------------------- previous definition of `BAR` here -LL | const BAR: u32 = 8; //~ ERROR duplicate definitions +LL | const BAR: u32 = 8; | ^^^^^^^^^^^^^^^^^^^ duplicate definition error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-path-shl.stderr b/src/test/ui/associated-path-shl.stderr index 3b62b1b01f48..e1a1e6363727 100644 --- a/src/test/ui/associated-path-shl.stderr +++ b/src/test/ui/associated-path-shl.stderr @@ -1,37 +1,37 @@ error[E0412]: cannot find type `A` in this scope --> $DIR/associated-path-shl.rs:4:14 | -LL | let _: <::B>::C; //~ ERROR cannot find type `A` in this scope +LL | let _: <::B>::C; | ^ not found in this scope error[E0412]: cannot find type `A` in this scope --> $DIR/associated-path-shl.rs:5:15 | -LL | let _ = <::B>::C; //~ ERROR cannot find type `A` in this scope +LL | let _ = <::B>::C; | ^ not found in this scope error[E0412]: cannot find type `A` in this scope --> $DIR/associated-path-shl.rs:6:11 | -LL | let <::B>::C; //~ ERROR cannot find type `A` in this scope +LL | let <::B>::C; | ^ not found in this scope error[E0412]: cannot find type `A` in this scope --> $DIR/associated-path-shl.rs:7:17 | -LL | let 0 ..= <::B>::C; //~ ERROR cannot find type `A` in this scope +LL | let 0 ..= <::B>::C; | ^ not found in this scope error[E0412]: cannot find type `A` in this scope --> $DIR/associated-path-shl.rs:9:7 | -LL | <::B>::C; //~ ERROR cannot find type `A` in this scope +LL | <::B>::C; | ^ not found in this scope error[E0029]: only char and numeric types are allowed in range patterns --> $DIR/associated-path-shl.rs:7:15 | -LL | let 0 ..= <::B>::C; //~ ERROR cannot find type `A` in this scope +LL | let 0 ..= <::B>::C; | ^^^^^^^^^^^ ranges require char or numeric types | = note: start type: {integer} diff --git a/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr b/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr index 8c7b4a1333c1..06f1a1cc64c4 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr +++ b/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:33:23 | -LL | fn b() { dent(ModelT, Blue); } //~ ERROR mismatched types +LL | fn b() { dent(ModelT, Blue); } | ^^^^ expected struct `Black`, found struct `Blue` | = note: expected type `Black` @@ -10,7 +10,7 @@ LL | fn b() { dent(ModelT, Blue); } //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:34:23 | -LL | fn c() { dent(ModelU, Black); } //~ ERROR mismatched types +LL | fn c() { dent(ModelU, Black); } | ^^^^^ expected struct `Blue`, found struct `Black` | = note: expected type `Blue` @@ -19,7 +19,7 @@ LL | fn c() { dent(ModelU, Black); } //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:40:28 | -LL | fn f() { ModelT.chip_paint(Blue); } //~ ERROR mismatched types +LL | fn f() { ModelT.chip_paint(Blue); } | ^^^^ expected struct `Black`, found struct `Blue` | = note: expected type `Black` @@ -28,7 +28,7 @@ LL | fn f() { ModelT.chip_paint(Blue); } //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:41:28 | -LL | fn g() { ModelU.chip_paint(Black); } //~ ERROR mismatched types +LL | fn g() { ModelU.chip_paint(Black); } | ^^^^^ expected struct `Blue`, found struct `Black` | = note: expected type `Blue` diff --git a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr index 126fb572d992..4b548604983d 100644 --- a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr +++ b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving `::Color == Blue` --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:37:10 | -LL | fn b() { blue_car(ModelT); } //~ ERROR type mismatch +LL | fn b() { blue_car(ModelT); } | ^^^^^^^^ expected struct `Black`, found struct `Blue` | = note: expected type `Black` @@ -15,7 +15,7 @@ LL | fn blue_car>(c: C) { error[E0271]: type mismatch resolving `::Color == Black` --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:38:10 | -LL | fn c() { black_car(ModelU); } //~ ERROR type mismatch +LL | fn c() { black_car(ModelU); } | ^^^^^^^^^ expected struct `Blue`, found struct `Black` | = note: expected type `Blue` diff --git a/src/test/ui/associated-types/associated-types-bound-failure.stderr b/src/test/ui/associated-types/associated-types-bound-failure.stderr index 784a53f106a9..502fb4f1c303 100644 --- a/src/test/ui/associated-types/associated-types-bound-failure.stderr +++ b/src/test/ui/associated-types/associated-types-bound-failure.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `::R: ToInt` is not satisfied --> $DIR/associated-types-bound-failure.rs:17:5 | -LL | ToInt::to_int(&g.get()) //~ ERROR E0277 +LL | ToInt::to_int(&g.get()) | ^^^^^^^^^^^^^ the trait `ToInt` is not implemented for `::R` | = help: consider adding a `where ::R: ToInt` bound diff --git a/src/test/ui/associated-types/associated-types-eq-1.stderr b/src/test/ui/associated-types/associated-types-eq-1.stderr index 0935d6ae3e61..aa987316801a 100644 --- a/src/test/ui/associated-types/associated-types-eq-1.stderr +++ b/src/test/ui/associated-types/associated-types-eq-1.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `A` in this scope --> $DIR/associated-types-eq-1.rs:10:12 | -LL | let _: A = x.boo(); //~ ERROR cannot find type `A` in this scope +LL | let _: A = x.boo(); | ^ help: a type parameter with a similar name exists: `I` error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-eq-hr.stderr b/src/test/ui/associated-types/associated-types-eq-hr.stderr index 3721b6989887..82d15b92b55f 100644 --- a/src/test/ui/associated-types/associated-types-eq-hr.stderr +++ b/src/test/ui/associated-types/associated-types-eq-hr.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving `for<'x> >::A == &'x isize` --> $DIR/associated-types-eq-hr.rs:82:5 | -LL | foo::(); //~ ERROR type mismatch +LL | foo::(); | ^^^^^^^^^^^^^^^^^ expected usize, found isize | = note: expected type `&usize` @@ -19,7 +19,7 @@ LL | | } error[E0271]: type mismatch resolving `for<'x> >::A == &'x usize` --> $DIR/associated-types-eq-hr.rs:86:5 | -LL | bar::(); //~ ERROR type mismatch +LL | bar::(); | ^^^^^^^^^^^^^^^^ expected isize, found usize | = note: expected type `&isize` diff --git a/src/test/ui/associated-types/associated-types-issue-17359.stderr b/src/test/ui/associated-types/associated-types-issue-17359.stderr index e05da8c4e4e8..575a072c558b 100644 --- a/src/test/ui/associated-types/associated-types-issue-17359.stderr +++ b/src/test/ui/associated-types/associated-types-issue-17359.stderr @@ -4,7 +4,7 @@ error[E0046]: not all trait items implemented, missing: `Type` LL | type Type; | ---------- `Type` from trait ... -LL | impl Trait for isize {} //~ ERROR missing: `Type` +LL | impl Trait for isize {} | ^^^^^^^^^^^^^^^^^^^^ missing `Type` in implementation error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-issue-20346.stderr b/src/test/ui/associated-types/associated-types-issue-20346.stderr index 27b5b1e00f9e..7d5b16c6e62d 100644 --- a/src/test/ui/associated-types/associated-types-issue-20346.stderr +++ b/src/test/ui/associated-types/associated-types-issue-20346.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving ` as Iterator>::Item == std::option::Option` --> $DIR/associated-types-issue-20346.rs:34:5 | -LL | is_iterator_of::, _>(&adapter); //~ ERROR type mismatch +LL | is_iterator_of::, _>(&adapter); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter, found enum `std::option::Option` | = note: expected type `T` diff --git a/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr index ec8852d9f186..2926bdae0525 100644 --- a/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr +++ b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving `::Y == i32` --> $DIR/associated-types-multiple-types-one-trait.rs:13:5 | -LL | want_y(t); //~ ERROR type mismatch +LL | want_y(t); | ^^^^^^ expected associated type, found i32 | = note: expected type `::Y` @@ -15,7 +15,7 @@ LL | fn want_y>(t: &T) { } error[E0271]: type mismatch resolving `::X == u32` --> $DIR/associated-types-multiple-types-one-trait.rs:18:5 | -LL | want_x(t); //~ ERROR type mismatch +LL | want_x(t); | ^^^^^^ expected associated type, found u32 | = note: expected type `::X` diff --git a/src/test/ui/associated-types/associated-types-outlives.stderr b/src/test/ui/associated-types/associated-types-outlives.stderr index 4cf3e473cf19..e35862d718f4 100644 --- a/src/test/ui/associated-types/associated-types-outlives.stderr +++ b/src/test/ui/associated-types/associated-types-outlives.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | 's: loop { y = denormalise(&x); break } | - borrow of `x` occurs here -LL | drop(x); //~ ERROR cannot move out of `x` because it is borrowed +LL | drop(x); | ^ move out of `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-overridden-binding.stderr b/src/test/ui/associated-types/associated-types-overridden-binding.stderr index b54d2037f5d2..a26ee23894f6 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-binding.stderr @@ -1,7 +1,7 @@ error[E0284]: type annotations required: cannot resolve `::Item == i32` --> $DIR/associated-types-overridden-binding.rs:4:1 | -LL | trait Bar: Foo {} //~ ERROR type annotations required +LL | trait Bar: Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by `Foo` diff --git a/src/test/ui/associated-types/associated-types-path-1.stderr b/src/test/ui/associated-types/associated-types-path-1.stderr index 5f5fb7a273bf..b6d3b53ba59b 100644 --- a/src/test/ui/associated-types/associated-types-path-1.stderr +++ b/src/test/ui/associated-types/associated-types-path-1.stderr @@ -1,7 +1,7 @@ error[E0220]: associated type `A` not found for `T` --> $DIR/associated-types-path-1.rs:10:23 | -LL | pub fn f1(a: T, x: T::A) {} //~ERROR associated type `A` not found +LL | pub fn f1(a: T, x: T::A) {} | ^^^^ associated type `A` not found error[E0221]: ambiguous associated type `A` in bounds of `T` @@ -13,7 +13,7 @@ LL | type A; LL | type A; | ------- ambiguous `A` from `Bar` ... -LL | pub fn f2(a: T, x: T::A) {} //~ERROR ambiguous associated type `A` +LL | pub fn f2(a: T, x: T::A) {} | ^^^^ ambiguous associated type `A` error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/associated-types-subtyping-1.stderr b/src/test/ui/associated-types/associated-types-subtyping-1.stderr index 77914dbae795..58ceec9040b9 100644 --- a/src/test/ui/associated-types/associated-types-subtyping-1.stderr +++ b/src/test/ui/associated-types/associated-types-subtyping-1.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T) | ----- ----- these two types are declared with different lifetimes... ... -LL | let _c: >::Type = a; //~ ERROR E0623 +LL | let _c: >::Type = a; | ^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch @@ -13,7 +13,7 @@ error[E0623]: lifetime mismatch LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T) | ----- ----- these two types are declared with different lifetimes... ... -LL | let _c: >::Type = b; //~ ERROR E0623 +LL | let _c: >::Type = b; | ^ ...but data from `y` flows into `x` here error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/associated-types-unsized.stderr b/src/test/ui/associated-types/associated-types-unsized.stderr index c83b14374f71..b5db9743932e 100644 --- a/src/test/ui/associated-types/associated-types-unsized.stderr +++ b/src/test/ui/associated-types/associated-types-unsized.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `::Value` cannot be known at compilation time --> $DIR/associated-types-unsized.rs:7:9 | -LL | let x = t.get(); //~ ERROR the size for values of type +LL | let x = t.get(); | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `::Value` diff --git a/src/test/ui/attempted-access-non-fatal.stderr b/src/test/ui/attempted-access-non-fatal.stderr index 2fee49acdf4b..5b7db0e9d6fb 100644 --- a/src/test/ui/attempted-access-non-fatal.stderr +++ b/src/test/ui/attempted-access-non-fatal.stderr @@ -1,13 +1,13 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:4:15 | -LL | let _ = x.foo; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] +LL | let _ = x.foo; | ^^^ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:5:15 | -LL | let _ = x.bar; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] +LL | let _ = x.bar; | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/attr-eq-token-tree.stderr b/src/test/ui/attr-eq-token-tree.stderr index 57d6a4e0f16a..aae25b2721e4 100644 --- a/src/test/ui/attr-eq-token-tree.stderr +++ b/src/test/ui/attr-eq-token-tree.stderr @@ -1,7 +1,7 @@ error: unexpected token: `!` --> $DIR/attr-eq-token-tree.rs:3:11 | -LL | #[my_attr = !] //~ ERROR unexpected token: `!` +LL | #[my_attr = !] | ^ error: aborting due to previous error diff --git a/src/test/ui/attr-usage-inline.stderr b/src/test/ui/attr-usage-inline.stderr index 3030a2f8f1d6..d8d7f6adb82b 100644 --- a/src/test/ui/attr-usage-inline.stderr +++ b/src/test/ui/attr-usage-inline.stderr @@ -1,7 +1,7 @@ error[E0518]: attribute should be applied to function or closure --> $DIR/attr-usage-inline.rs:6:1 | -LL | #[inline] //~ ERROR: attribute should be applied to function or closure +LL | #[inline] | ^^^^^^^^^ LL | struct S; | --------- not a function or closure diff --git a/src/test/ui/attr-usage-repr.stderr b/src/test/ui/attr-usage-repr.stderr index abb8685e4cef..f8ad7eec454c 100644 --- a/src/test/ui/attr-usage-repr.stderr +++ b/src/test/ui/attr-usage-repr.stderr @@ -1,7 +1,7 @@ error[E0517]: attribute should be applied to struct, enum or union --> $DIR/attr-usage-repr.rs:4:8 | -LL | #[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union +LL | #[repr(C)] | ^ LL | fn f() {} | --------- not a struct, enum or union @@ -9,7 +9,7 @@ LL | fn f() {} error[E0517]: attribute should be applied to enum --> $DIR/attr-usage-repr.rs:16:8 | -LL | #[repr(i8)] //~ ERROR: attribute should be applied to enum +LL | #[repr(i8)] | ^^ LL | struct SInt(f64, f64); | ---------------------- not an enum @@ -17,7 +17,7 @@ LL | struct SInt(f64, f64); error[E0517]: attribute should be applied to struct or union --> $DIR/attr-usage-repr.rs:25:8 | -LL | #[repr(packed)] //~ ERROR: attribute should be applied to struct +LL | #[repr(packed)] | ^^^^^^ LL | enum EPacked { A, B } | --------------------- not a struct or union @@ -25,7 +25,7 @@ LL | enum EPacked { A, B } error[E0517]: attribute should be applied to struct --> $DIR/attr-usage-repr.rs:28:8 | -LL | #[repr(simd)] //~ ERROR: attribute should be applied to struct +LL | #[repr(simd)] | ^^^^ LL | enum ESimd { A, B } | ------------------- not a struct diff --git a/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr b/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr index f08f107a62ff..4c5964715db7 100644 --- a/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr +++ b/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr @@ -1,7 +1,7 @@ error: attribute without generic parameters --> $DIR/attribute-with-no-generics-in-parameter-list.rs:1:8 | -LL | fn foo<#[attr]>() {} //~ ERROR attribute without generic parameters +LL | fn foo<#[attr]>() {} | ^^^^^^^ attributes are only permitted when preceding parameters error: aborting due to previous error diff --git a/src/test/ui/augmented-assignments.stderr b/src/test/ui/augmented-assignments.stderr index 73de315e542a..e429bf2a594f 100644 --- a/src/test/ui/augmented-assignments.stderr +++ b/src/test/ui/augmented-assignments.stderr @@ -4,16 +4,16 @@ error[E0596]: cannot borrow immutable local variable `y` as mutable LL | let y = Int(2); | - help: make this binding mutable: `mut y` ... -LL | y //~ error: cannot borrow immutable local variable `y` as mutable +LL | y | ^ cannot borrow mutably error[E0382]: use of moved value: `x` --> $DIR/augmented-assignments.rs:13:5 | -LL | x //~ error: use of moved value: `x` +LL | x | ^ value used here after move ... -LL | x; //~ value moved here +LL | x; | - value moved here | = note: move occurs because `x` has type `Int`, which does not implement the `Copy` trait diff --git a/src/test/ui/auto-ref-slice-plus-ref.stderr b/src/test/ui/auto-ref-slice-plus-ref.stderr index 356e24d18a78..97b9cd961a02 100644 --- a/src/test/ui/auto-ref-slice-plus-ref.stderr +++ b/src/test/ui/auto-ref-slice-plus-ref.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `test_mut` found for type `std::vec::Vec<{integer}>` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:7:7 | -LL | a.test_mut(); //~ ERROR no method named `test_mut` found +LL | a.test_mut(); | ^^^^^^^^ help: did you mean: `get_mut` | = help: items from traits can only be used if the trait is implemented and in scope @@ -11,7 +11,7 @@ LL | a.test_mut(); //~ ERROR no method named `test_mut` found error[E0599]: no method named `test` found for type `std::vec::Vec<{integer}>` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:8:7 | -LL | a.test(); //~ ERROR no method named `test` found +LL | a.test(); | ^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -21,7 +21,7 @@ LL | a.test(); //~ ERROR no method named `test` found error[E0599]: no method named `test` found for type `[{integer}; 1]` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:10:11 | -LL | ([1]).test(); //~ ERROR no method named `test` found +LL | ([1]).test(); | ^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -31,7 +31,7 @@ LL | ([1]).test(); //~ ERROR no method named `test` found error[E0599]: no method named `test` found for type `&[{integer}; 1]` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:11:12 | -LL | (&[1]).test(); //~ ERROR no method named `test` found +LL | (&[1]).test(); | ^^^^ | = help: items from traits can only be used if the trait is implemented and in scope diff --git a/src/test/ui/await-keyword/2018-edition-error.stderr b/src/test/ui/await-keyword/2018-edition-error.stderr index 9ddb27916d18..19bf11a67d1c 100644 --- a/src/test/ui/await-keyword/2018-edition-error.stderr +++ b/src/test/ui/await-keyword/2018-edition-error.stderr @@ -1,37 +1,37 @@ error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:5:13 | -LL | pub mod await { //~ ERROR `await` is a keyword +LL | pub mod await { | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:6:20 | -LL | pub struct await; //~ ERROR `await` is a keyword +LL | pub struct await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:9:22 | -LL | use self::outer_mod::await::await; //~ ERROR `await` is a keyword +LL | use self::outer_mod::await::await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:9:29 | -LL | use self::outer_mod::await::await; //~ ERROR `await` is a keyword +LL | use self::outer_mod::await::await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:13:11 | -LL | match await { await => () } //~ ERROR `await` is a keyword +LL | match await { await => () } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:13:19 | -LL | match await { await => () } //~ ERROR `await` is a keyword +LL | match await { await => () } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error: aborting due to 6 previous errors diff --git a/src/test/ui/bad/bad-expr-lhs.stderr b/src/test/ui/bad/bad-expr-lhs.stderr index 590d73bc3f5e..3e41b7e65855 100644 --- a/src/test/ui/bad/bad-expr-lhs.stderr +++ b/src/test/ui/bad/bad-expr-lhs.stderr @@ -1,31 +1,31 @@ error[E0070]: invalid left-hand side expression --> $DIR/bad-expr-lhs.rs:2:5 | -LL | 1 = 2; //~ ERROR invalid left-hand side expression +LL | 1 = 2; | ^^^^^ left-hand of expression not valid error[E0067]: invalid left-hand side expression --> $DIR/bad-expr-lhs.rs:3:5 | -LL | 1 += 2; //~ ERROR invalid left-hand side expression +LL | 1 += 2; | ^ invalid expression for left-hand side error[E0070]: invalid left-hand side expression --> $DIR/bad-expr-lhs.rs:4:5 | -LL | (1, 2) = (3, 4); //~ ERROR invalid left-hand side expression +LL | (1, 2) = (3, 4); | ^^^^^^^^^^^^^^^ left-hand of expression not valid error[E0070]: invalid left-hand side expression --> $DIR/bad-expr-lhs.rs:7:5 | -LL | (a, b) = (3, 4); //~ ERROR invalid left-hand side expression +LL | (a, b) = (3, 4); | ^^^^^^^^^^^^^^^ left-hand of expression not valid error[E0070]: invalid left-hand side expression --> $DIR/bad-expr-lhs.rs:9:5 | -LL | None = Some(3); //~ ERROR invalid left-hand side expression +LL | None = Some(3); | ^^^^^^^^^^^^^^ left-hand of expression not valid error: aborting due to 5 previous errors diff --git a/src/test/ui/bad/bad-expr-path.stderr b/src/test/ui/bad/bad-expr-path.stderr index 71ac9a16ba62..6dec74efd718 100644 --- a/src/test/ui/bad/bad-expr-path.stderr +++ b/src/test/ui/bad/bad-expr-path.stderr @@ -19,7 +19,7 @@ LL | log(debug, m1::arguments); error[E0580]: main function has wrong type --> $DIR/bad-expr-path.rs:3:1 | -LL | fn main(arguments: Vec) { //~ ERROR main function has wrong type +LL | fn main(arguments: Vec) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters | = note: expected type `fn()` diff --git a/src/test/ui/bad/bad-expr-path2.stderr b/src/test/ui/bad/bad-expr-path2.stderr index 343de94182e9..8212b2392c4a 100644 --- a/src/test/ui/bad/bad-expr-path2.stderr +++ b/src/test/ui/bad/bad-expr-path2.stderr @@ -19,7 +19,7 @@ LL | log(debug, m1::arguments); error[E0580]: main function has wrong type --> $DIR/bad-expr-path2.rs:5:1 | -LL | fn main(arguments: Vec) { //~ ERROR main function has wrong type +LL | fn main(arguments: Vec) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters | = note: expected type `fn()` diff --git a/src/test/ui/bad/bad-extern-link-attrs.stderr b/src/test/ui/bad/bad-extern-link-attrs.stderr index 6732e8553f3f..5baba599e741 100644 --- a/src/test/ui/bad/bad-extern-link-attrs.stderr +++ b/src/test/ui/bad/bad-extern-link-attrs.stderr @@ -1,19 +1,19 @@ error[E0459]: #[link(...)] specified without `name = "foo"` --> $DIR/bad-extern-link-attrs.rs:1:1 | -LL | #[link()] //~ ERROR: specified without `name = +LL | #[link()] | ^^^^^^^^^ missing `name` argument error[E0454]: #[link(name = "")] given with empty name --> $DIR/bad-extern-link-attrs.rs:2:1 | -LL | #[link(name = "")] //~ ERROR: with empty name +LL | #[link(name = "")] | ^^^^^^^^^^^^^^^^^^ empty name given error[E0458]: unknown kind: `bar` --> $DIR/bad-extern-link-attrs.rs:4:1 | -LL | #[link(name = "foo", kind = "bar")] //~ ERROR: unknown kind +LL | #[link(name = "foo", kind = "bar")] | ^^^^^^^^^^^^^^^^^^^^^------------^^ | | | unknown kind diff --git a/src/test/ui/bad/bad-lint-cap2.stderr b/src/test/ui/bad/bad-lint-cap2.stderr index d7ec41489d15..f6e67e6d78df 100644 --- a/src/test/ui/bad/bad-lint-cap2.stderr +++ b/src/test/ui/bad/bad-lint-cap2.stderr @@ -1,7 +1,7 @@ error: unused import: `std::option` --> $DIR/bad-lint-cap2.rs:6:5 | -LL | use std::option; //~ ERROR +LL | use std::option; | ^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/bad/bad-lint-cap3.stderr b/src/test/ui/bad/bad-lint-cap3.stderr index 5bf0b089afa2..a1ea3f774b40 100644 --- a/src/test/ui/bad/bad-lint-cap3.stderr +++ b/src/test/ui/bad/bad-lint-cap3.stderr @@ -1,7 +1,7 @@ warning: unused import: `std::option` --> $DIR/bad-lint-cap3.rs:7:5 | -LL | use std::option; //~ WARN +LL | use std::option; | ^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/bad/bad-main.stderr b/src/test/ui/bad/bad-main.stderr index 1a9c11f7b42a..c7f15e7a4fa5 100644 --- a/src/test/ui/bad/bad-main.stderr +++ b/src/test/ui/bad/bad-main.stderr @@ -1,7 +1,7 @@ error[E0580]: main function has wrong type --> $DIR/bad-main.rs:1:1 | -LL | fn main(x: isize) { } //~ ERROR: main function has wrong type [E0580] +LL | fn main(x: isize) { } | ^^^^^^^^^^^^^^^^^ incorrect number of function parameters | = note: expected type `fn()` diff --git a/src/test/ui/bad/bad-method-typaram-kind.stderr b/src/test/ui/bad/bad-method-typaram-kind.stderr index 8232bdd23a64..c72b96523600 100644 --- a/src/test/ui/bad/bad-method-typaram-kind.stderr +++ b/src/test/ui/bad/bad-method-typaram-kind.stderr @@ -1,7 +1,7 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/bad-method-typaram-kind.rs:2:7 | -LL | 1.bar::(); //~ ERROR `T` cannot be sent between threads safely +LL | 1.bar::(); | ^^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` diff --git a/src/test/ui/bad/bad-type-env-capture.stderr b/src/test/ui/bad/bad-type-env-capture.stderr index ce803e96801f..a459c00634a1 100644 --- a/src/test/ui/bad/bad-type-env-capture.stderr +++ b/src/test/ui/bad/bad-type-env-capture.stderr @@ -3,7 +3,7 @@ error[E0401]: can't use generic parameters from outer function | LL | fn foo() { | - type variable from outer function -LL | fn bar(b: T) { } //~ ERROR can't use generic parameters from outer +LL | fn bar(b: T) { } | --- ^ use of generic parameter from outer function | | | help: try using a local generic parameter instead: `bar` diff --git a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr index 427b1a722d99..9157fe0b070d 100644 --- a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr +++ b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr @@ -1,7 +1,7 @@ error[E0009]: cannot bind by-move and by-ref in the same pattern --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-2.rs:12:23 | -LL | Some((ref _y, _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern +LL | Some((ref _y, _z)) => { }, | ------ ^^ by-move pattern here | | | both by-ref and by-move used diff --git a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr index 9ebbedcfe600..267a9dff926a 100644 --- a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr +++ b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr @@ -1,7 +1,7 @@ error[E0009]: cannot bind by-move and by-ref in the same pattern --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-4.rs:12:15 | -LL | Some((_y, ref _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern +LL | Some((_y, ref _z)) => { }, | ^^ ------ both by-ref and by-move used | | | by-move pattern here diff --git a/src/test/ui/binop/binop-consume-args.stderr b/src/test/ui/binop/binop-consume-args.stderr index 0b5d2200b9ff..9246c116709d 100644 --- a/src/test/ui/binop/binop-consume-args.stderr +++ b/src/test/ui/binop/binop-consume-args.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs + rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -13,8 +13,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs + rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -24,7 +24,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs - rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -34,8 +34,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs - rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -45,7 +45,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs * rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -55,8 +55,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs * rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -66,7 +66,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs / rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -76,8 +76,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs / rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -87,7 +87,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs % rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -97,8 +97,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs % rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -108,7 +108,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs & rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -118,8 +118,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs & rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -129,7 +129,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs | rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -139,8 +139,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs | rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -150,7 +150,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs ^ rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -160,8 +160,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs ^ rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -171,7 +171,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs << rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -181,8 +181,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs << rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -192,7 +192,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs >> rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -202,8 +202,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs >> rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait diff --git a/src/test/ui/binop/binop-move-semantics.stderr b/src/test/ui/binop/binop-move-semantics.stderr index b1dc70d379d4..acc2620681b6 100644 --- a/src/test/ui/binop/binop-move-semantics.stderr +++ b/src/test/ui/binop/binop-move-semantics.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | x | - value moved here LL | + -LL | x; //~ ERROR: use of moved value +LL | x; | ^ value used here after move | = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait @@ -15,7 +15,7 @@ error[E0382]: use of moved value: `x` LL | x | - value moved here LL | + -LL | x.clone(); //~ ERROR: use of moved value +LL | x.clone(); | ^ value used here after move | = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait @@ -26,7 +26,7 @@ error[E0505]: cannot move out of `x` because it is borrowed LL | let m = &x; | - borrow of `x` occurs here ... -LL | x //~ ERROR: cannot move out of `x` because it is borrowed +LL | x | ^ move out of `x` occurs here error[E0505]: cannot move out of `y` because it is borrowed @@ -35,19 +35,19 @@ error[E0505]: cannot move out of `y` because it is borrowed LL | let n = &mut y; | - borrow of `y` occurs here ... -LL | y; //~ ERROR: cannot move out of `y` because it is borrowed +LL | y; | ^ move out of `y` occurs here error[E0507]: cannot move out of borrowed content --> $DIR/binop-move-semantics.rs:30:5 | -LL | *m //~ ERROR: cannot move out of borrowed content +LL | *m | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/binop-move-semantics.rs:32:5 | -LL | *n; //~ ERROR: cannot move out of borrowed content +LL | *n; | ^^ cannot move out of borrowed content error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable @@ -56,7 +56,7 @@ error[E0502]: cannot borrow `f` as immutable because it is also borrowed as muta LL | &mut f | - mutable borrow occurs here LL | + -LL | &f; //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable +LL | &f; | ^ | | | immutable borrow occurs here @@ -68,7 +68,7 @@ error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immuta LL | &f | - immutable borrow occurs here LL | + -LL | &mut f; //~ ERROR: cannot borrow `f` as mutable because it is also borrowed as immutable +LL | &mut f; | ^ | | | mutable borrow occurs here diff --git a/src/test/ui/block-result/block-must-not-have-result-do.stderr b/src/test/ui/block-result/block-must-not-have-result-do.stderr index 151315d34f27..5981b8b60794 100644 --- a/src/test/ui/block-result/block-must-not-have-result-do.stderr +++ b/src/test/ui/block-result/block-must-not-have-result-do.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/block-must-not-have-result-do.rs:3:9 | -LL | true //~ ERROR mismatched types +LL | true | ^^^^ expected (), found bool | = note: expected type `()` diff --git a/src/test/ui/block-result/block-must-not-have-result-res.stderr b/src/test/ui/block-result/block-must-not-have-result-res.stderr index 29885cac234f..8a41f8b8e3df 100644 --- a/src/test/ui/block-result/block-must-not-have-result-res.stderr +++ b/src/test/ui/block-result/block-must-not-have-result-res.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn drop(&mut self) { | - expected `()` because of default return type -LL | true //~ ERROR mismatched types +LL | true | ^^^^ expected (), found bool | = note: expected type `()` diff --git a/src/test/ui/block-result/block-must-not-have-result-while.stderr b/src/test/ui/block-result/block-must-not-have-result-while.stderr index d41eae1a4329..302d2972f7de 100644 --- a/src/test/ui/block-result/block-must-not-have-result-while.stderr +++ b/src/test/ui/block-result/block-must-not-have-result-while.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/block-must-not-have-result-while.rs:3:9 | -LL | true //~ ERROR mismatched types +LL | true | ^^^^ expected (), found bool | = note: expected type `()` diff --git a/src/test/ui/block-result/consider-removing-last-semi.stderr b/src/test/ui/block-result/consider-removing-last-semi.stderr index 1bf17db21ac5..618d020ce08b 100644 --- a/src/test/ui/block-result/consider-removing-last-semi.stderr +++ b/src/test/ui/block-result/consider-removing-last-semi.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/consider-removing-last-semi.rs:1:11 | -LL | fn f() -> String { //~ ERROR mismatched types +LL | fn f() -> String { | - ^^^^^^ expected struct `std::string::String`, found () | | | this function's body doesn't return @@ -15,7 +15,7 @@ LL | "bla".to_string(); error[E0308]: mismatched types --> $DIR/consider-removing-last-semi.rs:6:11 | -LL | fn g() -> String { //~ ERROR mismatched types +LL | fn g() -> String { | - ^^^^^^ expected struct `std::string::String`, found () | | | this function's body doesn't return diff --git a/src/test/ui/block-result/issue-11714.stderr b/src/test/ui/block-result/issue-11714.stderr index 2c13b2876694..d73489a602df 100644 --- a/src/test/ui/block-result/issue-11714.stderr +++ b/src/test/ui/block-result/issue-11714.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-11714.rs:1:14 | -LL | fn blah() -> i32 { //~ ERROR mismatched types +LL | fn blah() -> i32 { | ---- ^^^ expected i32, found () | | | this function's body doesn't return diff --git a/src/test/ui/block-result/issue-13428.stderr b/src/test/ui/block-result/issue-13428.stderr index 91e926eb5a73..18adb15c9615 100644 --- a/src/test/ui/block-result/issue-13428.stderr +++ b/src/test/ui/block-result/issue-13428.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-13428.rs:3:13 | -LL | fn foo() -> String { //~ ERROR mismatched types +LL | fn foo() -> String { | --- ^^^^^^ expected struct `std::string::String`, found () | | | this function's body doesn't return @@ -15,7 +15,7 @@ LL | ; error[E0308]: mismatched types --> $DIR/issue-13428.rs:11:13 | -LL | fn bar() -> String { //~ ERROR mismatched types +LL | fn bar() -> String { | --- ^^^^^^ expected struct `std::string::String`, found () | | | this function's body doesn't return diff --git a/src/test/ui/block-result/issue-20862.stderr b/src/test/ui/block-result/issue-20862.stderr index fce06f5b45d2..fb4feff37134 100644 --- a/src/test/ui/block-result/issue-20862.stderr +++ b/src/test/ui/block-result/issue-20862.stderr @@ -14,7 +14,7 @@ error[E0618]: expected function, found `()` | LL | / fn foo(x: i32) { LL | | |y| x + y -LL | | //~^ ERROR: mismatched types +LL | | LL | | } | |_- `foo` defined here returns `()` ... diff --git a/src/test/ui/block-result/issue-22645.stderr b/src/test/ui/block-result/issue-22645.stderr index 9cb1a6c5d7d5..e1e6428eda25 100644 --- a/src/test/ui/block-result/issue-22645.stderr +++ b/src/test/ui/block-result/issue-22645.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `{integer}: Scalar` is not satisfied --> $DIR/issue-22645.rs:15:5 | -LL | b + 3 //~ ERROR E0277 +LL | b + 3 | ^ the trait `Scalar` is not implemented for `{integer}` | = help: the following implementations were found: @@ -14,7 +14,7 @@ error[E0308]: mismatched types LL | fn main() { | - expected `()` because of default return type LL | let b = Bob + 3.5; -LL | b + 3 //~ ERROR E0277 +LL | b + 3 | ^^^^^ expected (), found struct `Bob` | = note: expected type `()` diff --git a/src/test/ui/block-result/unexpected-return-on-unit.stderr b/src/test/ui/block-result/unexpected-return-on-unit.stderr index 50af4734202d..3ceff81ec4d6 100644 --- a/src/test/ui/block-result/unexpected-return-on-unit.stderr +++ b/src/test/ui/block-result/unexpected-return-on-unit.stderr @@ -1,14 +1,14 @@ error[E0308]: mismatched types --> $DIR/unexpected-return-on-unit.rs:9:5 | -LL | foo() //~ ERROR mismatched types +LL | foo() | ^^^^^ expected (), found usize | = note: expected type `()` found type `usize` help: try adding a semicolon | -LL | foo(); //~ ERROR mismatched types +LL | foo(); | ^ help: try adding a return type | diff --git a/src/test/ui/borrowck/assign_mutable_fields.stderr b/src/test/ui/borrowck/assign_mutable_fields.stderr index 9024e7cf01cb..904d2ed97de8 100644 --- a/src/test/ui/borrowck/assign_mutable_fields.stderr +++ b/src/test/ui/borrowck/assign_mutable_fields.stderr @@ -1,19 +1,19 @@ error[E0381]: use of possibly uninitialized variable: `x.0` --> $DIR/assign_mutable_fields.rs:11:10 | -LL | drop(x.0); //~ ERROR +LL | drop(x.0); | ^^^ use of possibly uninitialized `x.0` error[E0381]: use of possibly uninitialized variable: `x.1` --> $DIR/assign_mutable_fields.rs:12:10 | -LL | drop(x.1); //~ ERROR +LL | drop(x.1); | ^^^ use of possibly uninitialized `x.1` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/assign_mutable_fields.rs:19:10 | -LL | drop(x); //~ ERROR +LL | drop(x); | ^ use of possibly uninitialized `x` error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr index 505604ab597d..09adb350e00d 100644 --- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr +++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr @@ -1,75 +1,75 @@ error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:15:27 | -LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(|| x = 42); | ^^^^^^ | help: consider changing this closure to take self by mutable reference --> $DIR/borrow-immutable-upvar-mutation.rs:15:24 | -LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(|| x = 42); | ^^^^^^^^^ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:18:36 | -LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(|| set(&mut y)); | ^ | help: consider changing this closure to take self by mutable reference --> $DIR/borrow-immutable-upvar-mutation.rs:18:24 | -LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(|| set(&mut y)); | ^^^^^^^^^^^^^^ error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:21:55 | -LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); | ^^^^^^ | help: consider changing this closure to take self by mutable reference --> $DIR/borrow-immutable-upvar-mutation.rs:21:52 | -LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); | ^^^^^^^^^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:27:32 | -LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(move || x = 42); | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications help: consider changing this closure to take self by mutable reference --> $DIR/borrow-immutable-upvar-mutation.rs:27:24 | -LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(move || x = 42); | ^^^^^^^^^^^^^^ error[E0596]: cannot borrow captured outer variable in an `Fn` closure as mutable --> $DIR/borrow-immutable-upvar-mutation.rs:30:41 | -LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(move || set(&mut y)); | ^ | help: consider changing this closure to take self by mutable reference --> $DIR/borrow-immutable-upvar-mutation.rs:30:24 | -LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(move || set(&mut y)); | ^^^^^^^^^^^^^^^^^^^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:33:65 | -LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications help: consider changing this closure to take self by mutable reference --> $DIR/borrow-immutable-upvar-mutation.rs:33:57 | -LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); | ^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/borrowck/borrow-tuple-fields.stderr b/src/test/ui/borrowck/borrow-tuple-fields.stderr index a62e7287e683..f7fc06e1b4fb 100644 --- a/src/test/ui/borrowck/borrow-tuple-fields.stderr +++ b/src/test/ui/borrowck/borrow-tuple-fields.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let r = &x.0; | --- borrow of `x.0` occurs here -LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed +LL | let y = x; | ^ move out of `x` occurs here error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable @@ -11,7 +11,7 @@ error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immu | LL | let a = &x.0; | --- immutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as +LL | let b = &mut x.0; | ^^^ mutable borrow occurs here ... LL | } @@ -22,7 +22,7 @@ error[E0499]: cannot borrow `x.0` as mutable more than once at a time | LL | let a = &mut x.0; | --- first mutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time +LL | let b = &mut x.0; | ^^^ second mutable borrow occurs here ... LL | } @@ -33,7 +33,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let r = &x.0; | --- borrow of `x.0` occurs here -LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed +LL | let y = x; | ^ move out of `x` occurs here error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable @@ -41,7 +41,7 @@ error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immu | LL | let a = &x.0; | --- immutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as +LL | let b = &mut x.0; | ^^^ mutable borrow occurs here ... LL | } @@ -52,7 +52,7 @@ error[E0499]: cannot borrow `x.0` as mutable more than once at a time | LL | let a = &mut x.0; | --- first mutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time +LL | let b = &mut x.0; | ^^^ second mutable borrow occurs here LL | a.use_mut(); LL | } diff --git a/src/test/ui/borrowck/borrowck-and-init.stderr b/src/test/ui/borrowck/borrowck-and-init.stderr index 42b658871dfa..13696ac8347b 100644 --- a/src/test/ui/borrowck/borrowck-and-init.stderr +++ b/src/test/ui/borrowck/borrowck-and-init.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `i` --> $DIR/borrowck-and-init.rs:5:20 | -LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` +LL | println!("{}", i); | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr b/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr index 9c36a9fe875f..efe94dee2e7c 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | Y(ref mut a, _) => a | --------- first mutable borrow occurs here ... -LL | Y(ref mut b, _) => b //~ ERROR cannot borrow +LL | Y(ref mut b, _) => b | ^^^^^^^^^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr b/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr index 4b823f396afc..40f96cb712c0 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | (ref mut a, _) => a | --------- first mutable borrow occurs here ... -LL | (ref mut b, _) => b //~ ERROR cannot borrow +LL | (ref mut b, _) => b | ^^^^^^^^^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr index 1e94cdebaec6..2835cab9092f 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | Foo::Y(ref mut a, _) => a, | --------- first mutable borrow occurs here ... -LL | Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow +LL | Foo::Y(ref mut b, _) => b, | ^^^^^^^^^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-argument.stderr b/src/test/ui/borrowck/borrowck-argument.stderr index fa82b1c00cc7..6c9c411cbcf0 100644 --- a/src/test/ui/borrowck/borrowck-argument.stderr +++ b/src/test/ui/borrowck/borrowck-argument.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable argument `arg` as mutable | LL | fn func(arg: S) { | --- help: make this binding mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow mutably error[E0596]: cannot borrow immutable argument `arg` as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow immutable argument `arg` as mutable | LL | fn method(&self, arg: S) { | --- help: make this binding mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow mutably error[E0596]: cannot borrow immutable argument `arg` as mutable @@ -19,13 +19,13 @@ error[E0596]: cannot borrow immutable argument `arg` as mutable | LL | fn default(&self, arg: S) { | --- help: make this binding mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow mutably error[E0596]: cannot borrow immutable argument `arg` as mutable --> $DIR/borrowck-argument.rs:32:17 | -LL | (|arg: S| { arg.mutate() })(s); //~ ERROR: cannot borrow immutable argument +LL | (|arg: S| { arg.mutate() })(s); | --- ^^^ cannot borrow mutably | | | help: make this binding mutable: `mut arg` diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr index 9997aa4190e3..0d092e6812d9 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr +++ b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immuta LL | let q: &isize = &p[0]; | - immutable borrow occurs here LL | -LL | p[0] = 5; //~ ERROR cannot borrow +LL | p[0] = 5; | ^ mutable borrow occurs here ... LL | } @@ -15,7 +15,7 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immuta | LL | &p, | - immutable borrow occurs here -LL | || p[0] = 5); //~ ERROR cannot borrow `p` as mutable +LL | || p[0] = 5); | ^^ - - immutable borrow ends here | | | | | borrow occurs due to use of `p` in closure diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr index 76e7ee841f82..5ec1ff2c058d 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr @@ -3,7 +3,7 @@ error[E0389]: cannot assign to data in a `&` reference | LL | fn a(s: &S) { | -- use `&mut S` here to make mutable -LL | *s.pointer += 1; //~ ERROR cannot assign +LL | *s.pointer += 1; | ^^^^^^^^^^^^^^^ assignment into an immutable reference error[E0389]: cannot assign to data in a `&` reference @@ -11,7 +11,7 @@ error[E0389]: cannot assign to data in a `&` reference | LL | fn c(s: & &mut S) { | -------- use `&mut &mut S` here to make mutable -LL | *s.pointer += 1; //~ ERROR cannot assign +LL | *s.pointer += 1; | ^^^^^^^^^^^^^^^ assignment into an immutable reference error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr index d4639581223d..10d6ac5464d0 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr @@ -3,7 +3,7 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed | LL | let z = copy_borrowed_ptr(&mut y); | - borrow of `*y.pointer` occurs here -LL | *y.pointer += 1; //~ ERROR cannot assign +LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr index b48473a884c2..759b778e35c8 100644 --- a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr +++ b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable | LL | let x = Foo { x: 3 }; | - help: make this binding mutable: `mut x` -LL | x.printme(); //~ ERROR cannot borrow +LL | x.printme(); | ^ cannot borrow mutably error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-autoref-3261.stderr b/src/test/ui/borrowck/borrowck-autoref-3261.stderr index 7a5430ac15c3..280704a27151 100644 --- a/src/test/ui/borrowck/borrowck-autoref-3261.stderr +++ b/src/test/ui/borrowck/borrowck-autoref-3261.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | (&mut x).with( | - first mutable borrow occurs here -LL | |opt| { //~ ERROR cannot borrow `x` as mutable more than once at a time +LL | |opt| { | ^^^^^ second mutable borrow occurs here ... LL | x = X(Either::Left((0, 0))); diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr index 165530d270af..06ec2bdac715 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `a` as mutable because `*a` is also borrowed as immu | LL | &*a, | -- immutable borrow occurs here -LL | rewrite(&mut a)); //~ ERROR cannot borrow +LL | rewrite(&mut a)); | ^ - immutable borrow ends here | | | mutable borrow occurs here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `a` as mutable because `*a` is also borrowed as immu | LL | &*a, | -- immutable borrow occurs here -LL | rewrite(&mut a)); //~ ERROR cannot borrow +LL | rewrite(&mut a)); | ^ - immutable borrow ends here | | | mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr index b2c680f39521..3b34a61364ab 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | &*a, | -- borrow of `*a` occurs here -LL | a); //~ ERROR cannot move +LL | a); | ^ move out of `a` occurs here error[E0505]: cannot move out of `a` because it is borrowed @@ -11,7 +11,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | &*a, | -- borrow of `*a` occurs here -LL | a); //~ ERROR cannot move +LL | a); | ^ move out of `a` occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-block-unint.stderr b/src/test/ui/borrowck/borrowck-block-unint.stderr index 6e7af76fc2e8..ab55d7994d0c 100644 --- a/src/test/ui/borrowck/borrowck-block-unint.stderr +++ b/src/test/ui/borrowck/borrowck-block-unint.stderr @@ -1,7 +1,7 @@ error[E0381]: capture of possibly uninitialized variable: `x` --> $DIR/borrowck-block-unint.rs:4:11 | -LL | force(|| { //~ ERROR capture of possibly uninitialized variable: `x` +LL | force(|| { | ^^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr index e116cb70c1c3..a4fb28d0e815 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^ second mutable borrow occurs here LL | *bar1; LL | } @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1; | -------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^ immutable borrow occurs here LL | *bar1; LL | } @@ -25,7 +25,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1; | -------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^ mutable borrow occurs here LL | *bar1; LL | } @@ -36,7 +36,7 @@ error[E0499]: cannot borrow `foo` (via `foo.bar2`) as mutable more than once at | LL | let bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here (via `foo.bar1`) -LL | let _bar2 = &mut foo.bar2; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar2; | ^^^^^^^^ second mutable borrow occurs here (via `foo.bar2`) LL | *bar1; LL | } @@ -49,7 +49,7 @@ LL | Foo { bar1: ref mut _bar1, bar2: ref mut _bar2 } => {} | ------------- ^^^^^^^^^^^^^ second mutable borrow occurs here (via `foo.bar2`) | | | first mutable borrow occurs here (via `foo.bar1`) -LL | //~^ ERROR cannot borrow +LL | LL | } | - first borrow ends here @@ -70,7 +70,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is a | LL | let bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^ immutable borrow occurs here ... LL | } @@ -81,8 +81,8 @@ error[E0502]: cannot borrow `*foo` as immutable because `foo.bar1.int1` is also | LL | let bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &*foo; | ^^^^ immutable borrow occurs here LL | *bar1; LL | } @@ -93,7 +93,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^ second mutable borrow occurs here LL | *bar1; LL | } @@ -104,7 +104,7 @@ error[E0499]: cannot borrow `*foo` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^ second mutable borrow occurs here LL | *bar1; LL | } @@ -115,7 +115,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is als | LL | let bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^ mutable borrow occurs here LL | *bar1; LL | } @@ -126,7 +126,7 @@ error[E0502]: cannot borrow `*foo` as mutable because `foo.bar1.int1` is also bo | LL | let bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^ mutable borrow occurs here LL | *bar1; LL | } @@ -137,7 +137,7 @@ error[E0502]: cannot borrow `foo` (via `foo.bar2`) as immutable because `foo` is | LL | let bar1 = &mut foo.bar1; | -------- mutable borrow occurs here (via `foo.bar1`) -LL | let _foo1 = &foo.bar2; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar2; | ^^^^^^^^ immutable borrow of `foo.bar2` -- which overlaps with `foo.bar1` -- occurs here LL | *bar1; LL | } @@ -148,7 +148,7 @@ error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable | LL | let foo = make_foo(); | --- help: make this binding mutable: `mut foo` -LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let bar1 = &mut foo.bar1; | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0499]: cannot borrow `foo` (via `foo.bar2.int2`) as mutable more than once at a time @@ -156,7 +156,7 @@ error[E0499]: cannot borrow `foo` (via `foo.bar2.int2`) as mutable more than onc | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here (via `foo.bar1.int1`) -LL | let foo1 = &mut foo.bar2.int2; //~ ERROR cannot borrow +LL | let foo1 = &mut foo.bar2.int2; | ^^^^^^^^^^^^^ second mutable borrow occurs here (via `foo.bar2.int2`) ... LL | } diff --git a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr index 2c446dfee44b..fe60d944a44f 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^ second mutable borrow occurs here LL | *bar1; LL | } @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1; | -------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^ immutable borrow occurs here LL | *bar1; LL | } @@ -25,7 +25,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1; | -------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^ mutable borrow occurs here LL | *bar1; LL | } @@ -48,7 +48,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is a | LL | let bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^ immutable borrow occurs here ... LL | } @@ -59,8 +59,8 @@ error[E0502]: cannot borrow `foo` as immutable because `foo.bar1.int1` is also b | LL | let bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &foo; | ^^^ immutable borrow occurs here LL | *bar1; LL | } @@ -71,7 +71,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^ second mutable borrow occurs here LL | *bar1; LL | } @@ -82,7 +82,7 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here -LL | let _foo2 = &mut foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut foo; | ^^^ second mutable borrow occurs here LL | *bar1; LL | } @@ -93,7 +93,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is als | LL | let bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^ mutable borrow occurs here LL | *bar1; LL | } @@ -104,7 +104,7 @@ error[E0502]: cannot borrow `foo` as mutable because `foo.bar1.int1` is also bor | LL | let bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here -LL | let _foo2 = &mut foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut foo; | ^^^ mutable borrow occurs here LL | *bar1; LL | } @@ -115,7 +115,7 @@ error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable | LL | let foo = make_foo(); | --- help: make this binding mutable: `mut foo` -LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let bar1 = &mut foo.bar1; | ^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to 11 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr b/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr index 0726e3d5d5e6..6f101f690cd2 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/borrowck-borrow-from-temporary.rs:9:24 | -LL | let &Foo(ref x) = &id(Foo(3)); //~ ERROR borrowed value does not live long enough +LL | let &Foo(ref x) = &id(Foo(3)); | ^^^^^^^^^^ temporary value does not live long enough LL | x LL | } diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr index ff2969f53480..709a797edcb4 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr @@ -1,7 +1,7 @@ error[E0389]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5 | -LL | **t1 = 22; //~ ERROR cannot assign +LL | **t1 = 22; | ^^^^^^^^^ assignment into an immutable reference error[E0502]: cannot borrow `**t0` as immutable because `*t0` is also borrowed as mutable @@ -9,7 +9,7 @@ error[E0502]: cannot borrow `**t0` as immutable because `*t0` is also borrowed a | LL | let t1 = &mut *t0; | --- mutable borrow occurs here -LL | let p: &isize = &**t0; //~ ERROR cannot borrow +LL | let p: &isize = &**t0; | ^^^^ immutable borrow occurs here LL | **t1 = 22; LL | } @@ -20,7 +20,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference | LL | fn foo4(t0: & &mut isize) { | ------------ use `&mut &mut isize` here to make mutable -LL | let x: &mut isize = &mut **t0; //~ ERROR cannot borrow +LL | let x: &mut isize = &mut **t0; | ^^^^ assignment into an immutable reference error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr index abfce9857f7c..1b64ad575645 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let y = x.f1(); | - first mutable borrow occurs here -LL | x.f2(); //~ ERROR cannot borrow `*x` as mutable +LL | x.f2(); | ^ second mutable borrow occurs here LL | y.use_ref(); LL | } diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr index c6f9c655a11d..2fe1461a303d 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr @@ -1,85 +1,85 @@ error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:47:24 | -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:51:24 | -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:59:10 | -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:63:10 | -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field of immutable binding --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:67:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field of immutable binding --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:71:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field of immutable binding --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:75:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:83:5 | -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:87:5 | -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:95:5 | -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:99:5 | -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:103:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:107:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:111:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error: aborting due to 14 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr index 41e7cc210c8f..fb79ccb701fb 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr @@ -1,43 +1,43 @@ error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:23:24 | -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:27:24 | -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:35:10 | -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:39:10 | -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content --> $DIR/borrowck-borrow-overloaded-deref.rs:43:5 | -LL | *x = 3; //~ ERROR cannot assign +LL | *x = 3; | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content --> $DIR/borrowck-borrow-overloaded-deref.rs:47:5 | -LL | **x = 3; //~ ERROR cannot assign +LL | **x = 3; | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content --> $DIR/borrowck-borrow-overloaded-deref.rs:51:5 | -LL | **x = 3; //~ ERROR cannot assign +LL | **x = 3; | ^^^^^^^ cannot borrow as mutable error: aborting due to 7 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr index b94926951192..d17cf8a6fac3 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:20:20 | -LL | let x = defer(&vec!["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough +LL | let x = defer(&vec!["Goodbye", "world!"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr index bf4674035ead..32a86562da74 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/borrowck-borrowed-uniq-rvalue.rs:10:27 | -LL | buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough +LL | buggy_map.insert(42, &*Box::new(1)); | ^^^^^^^^^^^^ - borrowed value dropped here while still borrowed | | | borrowed value does not live long enough diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr index e574c0ff8a85..a6c3dfef9e87 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-break-uninit-2.rs:9:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-break-uninit.stderr b/src/test/ui/borrowck/borrowck-break-uninit.stderr index 1a853c35d00e..dcb024a3e1a0 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-break-uninit.rs:9:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr index f529247b1b6f..2f7c6a1a56a5 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr +++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr @@ -5,7 +5,7 @@ LL | let mut c1 = || set(&mut *x); | -- - previous borrow occurs due to use of `x` in closure | | | first closure is constructed here -LL | //~^ ERROR cannot borrow +LL | LL | let mut c2 = || set(&mut *x); | ^^ - borrow occurs due to use of `x` in closure | | diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr index cb8f5b4366bf..7399f8360dc3 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr +++ b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr @@ -5,7 +5,7 @@ LL | let c1 = to_fn_mut(|| x = 4); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| x = 5); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -20,7 +20,7 @@ LL | let c1 = to_fn_mut(|| set(&mut x)); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -35,7 +35,7 @@ LL | let c1 = to_fn_mut(|| x = 5); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut.stderr index bfb706946158..e881201ddfcc 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut.stderr +++ b/src/test/ui/borrowck/borrowck-closures-two-mut.stderr @@ -5,7 +5,7 @@ LL | let c1 = to_fn_mut(|| x = 4); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| x = 5); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -20,7 +20,7 @@ LL | let c1 = to_fn_mut(|| set(&mut x)); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -35,7 +35,7 @@ LL | let c1 = to_fn_mut(|| x = 5); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -80,11 +80,11 @@ LL | let c1 = to_fn_mut(|| x = 4); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| x = 5); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -LL | //~| ERROR cannot borrow `x` as mutable more than once +LL | LL | drop((c1, c2)); | -- first borrow later used here @@ -95,11 +95,11 @@ LL | let c1 = to_fn_mut(|| set(&mut x)); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -LL | //~| ERROR cannot borrow `x` as mutable more than once +LL | LL | drop((c1, c2)); | -- first borrow later used here @@ -110,11 +110,11 @@ LL | let c1 = to_fn_mut(|| x = 5); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -LL | //~| ERROR cannot borrow `x` as mutable more than once +LL | LL | drop((c1, c2)); | -- first borrow later used here diff --git a/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr b/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr index 1b661b70d7f5..3cdc9b9d4fd4 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as i | LL | let p = &this.x; | ------ immutable borrow occurs here -LL | &mut this.x; //~ ERROR cannot borrow +LL | &mut this.x; | ^^^^^^ mutable borrow occurs here LL | p.use_ref(); LL | }; diff --git a/src/test/ui/borrowck/borrowck-closures-unique.stderr b/src/test/ui/borrowck/borrowck-closures-unique.stderr index 94181ad2400d..238b16f654e3 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique.stderr @@ -5,7 +5,7 @@ LL | let c1 = || get(x); | -- - previous borrow occurs due to use of `x` in closure | | | borrow occurs here -LL | let c2 = || set(x); //~ ERROR closure requires unique access to `x` +LL | let c2 = || set(x); | ^^ - borrow occurs due to use of `x` in closure | | | closure construction occurs here @@ -20,7 +20,7 @@ LL | let c1 = || get(x); | -- - previous borrow occurs due to use of `x` in closure | | | borrow occurs here -LL | let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x` +LL | let c2 = || { get(x); set(x); }; | ^^ - borrow occurs due to use of `x` in closure | | | closure construction occurs here @@ -35,7 +35,7 @@ LL | let c1 = || set(x); | -- - previous borrow occurs due to use of `x` in closure | | | first closure is constructed here -LL | let c2 = || set(x); //~ ERROR two closures require unique access to `x` at the same time +LL | let c2 = || set(x); | ^^ - borrow occurs due to use of `x` in closure | | | second closure is constructed here @@ -46,21 +46,21 @@ LL | } error[E0595]: closure cannot assign to immutable argument `x` --> $DIR/borrowck-closures-unique.rs:47:14 | -LL | let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument +LL | let c1 = |y: &'static mut isize| x = y; | ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably help: consider removing the `&mut`, as it is an immutable binding to a mutable reference | -LL | x //~ ERROR closure cannot assign to immutable argument +LL | x | ^ error[E0595]: closure cannot assign to immutable argument `x` --> $DIR/borrowck-closures-unique.rs:52:14 | -LL | let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable argument +LL | let c1 = || x = panic!(); | ^^ cannot borrow mutably help: consider removing the `&mut`, as it is an immutable binding to a mutable reference | -LL | x //~ ERROR closure cannot assign to immutable argument +LL | x | ^ error: aborting due to 5 previous errors diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr b/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr index b41a4a0c6768..9e77d8ce1881 100644 --- a/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr +++ b/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr @@ -6,7 +6,7 @@ LL | let mut test = |foo: &Foo| { LL | ptr = box Foo { x: ptr.x + 1 }; | --- previous borrow occurs due to use of `ptr` in closure LL | }; -LL | test(&*ptr); //~ ERROR cannot borrow `*ptr` +LL | test(&*ptr); | ^^^^ immutable borrow occurs here LL | } | - mutable borrow ends here diff --git a/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr b/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr index 2fc2248000f3..02644b82f57e 100644 --- a/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr +++ b/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `b` | LL | consume(b); | - value moved here -LL | consume(b); //~ ERROR use of moved value +LL | consume(b); | ^ value used here after move | = note: move occurs because `b` has type `std::boxed::Box<[i32; 5]>`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr index aef1671342ef..7267a99b869b 100644 --- a/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr +++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `b` | LL | consume(b); | - value moved here -LL | consume(b); //~ ERROR use of moved value +LL | consume(b); | ^ value used here after move | = note: move occurs because `b` has type `std::boxed::Box<(dyn Foo + std::marker::Send + 'static)>`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-drop-from-guard.stderr b/src/test/ui/borrowck/borrowck-drop-from-guard.stderr index 07b597f480fe..a2b42fa495e0 100644 --- a/src/test/ui/borrowck/borrowck-drop-from-guard.stderr +++ b/src/test/ui/borrowck/borrowck-drop-from-guard.stderr @@ -7,7 +7,7 @@ LL | match Some(42) { LL | Some(_) if { drop(my_str); false } => {} | ------ value moved here LL | Some(_) => {} -LL | None => { foo(my_str); } //~ ERROR [E0382] +LL | None => { foo(my_str); } | ^^^^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.stderr b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr index bfab5cbe536d..0cf6f3f2182e 100644 --- a/src/test/ui/borrowck/borrowck-field-sensitivity.stderr +++ b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `*x.b` | LL | drop(x.b); | --- value moved here -LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` +LL | drop(*x.b); | ^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `*x.b` | LL | let y = A { a: 3, .. x }; | - value moved here -LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` +LL | drop(*x.b); | ^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -23,7 +23,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | let p = &x.b; //~ ERROR use of moved value: `x.b` +LL | let p = &x.b; | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -33,7 +33,7 @@ error[E0382]: use of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | - value moved here -LL | let p = &x.b; //~ ERROR use of moved value: `x.b` +LL | let p = &x.b; | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -43,7 +43,7 @@ error[E0505]: cannot move out of `x.b` because it is borrowed | LL | let p = &x.b; | --- borrow of `x.b` occurs here -LL | drop(x.b); //~ ERROR cannot move out of `x.b` because it is borrowed +LL | drop(x.b); | ^^^ move out of `x.b` occurs here error[E0505]: cannot move out of `x.b` because it is borrowed @@ -51,7 +51,7 @@ error[E0505]: cannot move out of `x.b` because it is borrowed | LL | let p = &x.b; | --- borrow of `x.b` occurs here -LL | let _y = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` because it is borrowed +LL | let _y = A { a: 3, .. x }; | ^ move out of `x.b` occurs here error[E0499]: cannot borrow `x.a` as mutable more than once at a time @@ -59,7 +59,7 @@ error[E0499]: cannot borrow `x.a` as mutable more than once at a time | LL | let p = &mut x.a; | --- first mutable borrow occurs here -LL | let q = &mut x.a; //~ ERROR cannot borrow `x.a` as mutable more than once at a time +LL | let q = &mut x.a; | ^^^ second mutable borrow occurs here ... LL | } @@ -70,7 +70,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | drop(x.b); //~ ERROR use of moved value: `x.b` +LL | drop(x.b); | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -80,7 +80,7 @@ error[E0382]: use of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | - value moved here -LL | drop(x.b); //~ ERROR use of moved value: `x.b` +LL | drop(x.b); | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -90,7 +90,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | let _z = A { a: 3, .. x }; //~ ERROR use of moved value: `x.b` +LL | let _z = A { a: 3, .. x }; | ^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -100,7 +100,7 @@ error[E0382]: use of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | - value moved here -LL | let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b` +LL | let _z = A { a: 4, .. x }; | ^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -108,19 +108,19 @@ LL | let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b` error[E0381]: use of possibly uninitialized variable: `x.a` --> $DIR/borrowck-field-sensitivity.rs:82:10 | -LL | drop(x.a); //~ ERROR use of possibly uninitialized variable: `x.a` +LL | drop(x.a); | ^^^ use of possibly uninitialized `x.a` error[E0381]: use of possibly uninitialized variable: `x.a` --> $DIR/borrowck-field-sensitivity.rs:88:14 | -LL | let p = &x.a; //~ ERROR use of possibly uninitialized variable: `x.a` +LL | let p = &x.a; | ^^^ use of possibly uninitialized `x.a` error[E0381]: use of possibly uninitialized variable: `x.b` --> $DIR/borrowck-field-sensitivity.rs:95:10 | -LL | drop(x.b); //~ ERROR use of possibly uninitialized variable: `x.b` +LL | drop(x.b); | ^^^ use of possibly uninitialized `x.b` error: aborting due to 14 previous errors diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr index f6e7e99393c8..d2ddf808d119 100644 --- a/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr +++ b/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr @@ -1,7 +1,7 @@ error[E0597]: `local.inner` does not live long enough --> $DIR/borrowck-fn-in-const-c.rs:17:17 | -LL | return &local.inner; //~ ERROR does not live long enough +LL | return &local.inner; | ^^^^^^^^^^^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr index 1a7e2cb69632..fb53b13a58de 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:9 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | ^- | || | |hint: to prevent move, use `ref a` or `ref mut a` @@ -10,7 +10,7 @@ LL | for &a in x.iter() { //~ ERROR cannot move out error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:9 | -LL | for &a in &f.a { //~ ERROR cannot move out +LL | for &a in &f.a { | ^- | || | |hint: to prevent move, use `ref a` or `ref mut a` @@ -19,7 +19,7 @@ LL | for &a in &f.a { //~ ERROR cannot move out error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:9 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | ^- | || | |hint: to prevent move, use `ref a` or `ref mut a` diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr index 85008948a1c0..a2d8908c4dd2 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr @@ -7,7 +7,7 @@ LL | for &x in &vector { | | immutable borrow ends here | immutable borrow occurs here LL | let cap = vector.capacity(); -LL | vector.extend(repeat(0)); //~ ERROR cannot borrow +LL | vector.extend(repeat(0)); | ^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable @@ -19,7 +19,7 @@ LL | for &x in &vector { | | immutable borrow ends here | immutable borrow occurs here ... -LL | vector[1] = 5; //~ ERROR cannot borrow +LL | vector[1] = 5; | ^^^^^^ mutable borrow occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-if-no-else.stderr b/src/test/ui/borrowck/borrowck-if-no-else.stderr index f6d199d788bf..1223e409d4df 100644 --- a/src/test/ui/borrowck/borrowck-if-no-else.stderr +++ b/src/test/ui/borrowck/borrowck-if-no-else.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-if-no-else.rs:5:9 | -LL | foo(x); //~ ERROR use of possibly uninitialized variable: `x` +LL | foo(x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-if-with-else.stderr b/src/test/ui/borrowck/borrowck-if-with-else.stderr index e569fbdeca1e..d11f29b05f56 100644 --- a/src/test/ui/borrowck/borrowck-if-with-else.stderr +++ b/src/test/ui/borrowck/borrowck-if-with-else.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-if-with-else.rs:10:9 | -LL | foo(x); //~ ERROR use of possibly uninitialized variable: `x` +LL | foo(x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-in-static.stderr b/src/test/ui/borrowck/borrowck-in-static.stderr index 400f3cd1c3e7..6eeaf428c5f0 100644 --- a/src/test/ui/borrowck/borrowck-in-static.stderr +++ b/src/test/ui/borrowck/borrowck-in-static.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable +LL | Box::new(|| x) | ^ cannot move out of captured outer variable in an `Fn` closure error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr index 0195dc60eb3e..82a602c6359c 100644 --- a/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr +++ b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `i` --> $DIR/borrowck-init-in-called-fn-expr.rs:4:9 | -LL | i //~ ERROR use of possibly uninitialized variable: `i` +LL | i | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr b/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr index dfa63f71c695..899739378524 100644 --- a/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr +++ b/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `i` --> $DIR/borrowck-init-in-fn-expr.rs:4:9 | -LL | i //~ ERROR use of possibly uninitialized variable: `i` +LL | i | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-init-op-equal.stderr b/src/test/ui/borrowck/borrowck-init-op-equal.stderr index 414124040aa2..9863ceb14240 100644 --- a/src/test/ui/borrowck/borrowck-init-op-equal.stderr +++ b/src/test/ui/borrowck/borrowck-init-op-equal.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `v` --> $DIR/borrowck-init-op-equal.rs:3:5 | -LL | v += 1; //~ ERROR use of possibly uninitialized variable: `v` +LL | v += 1; | ^^^^^^ use of possibly uninitialized `v` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-init-plus-equal.stderr b/src/test/ui/borrowck/borrowck-init-plus-equal.stderr index 124a60b8a502..80c4e0c80483 100644 --- a/src/test/ui/borrowck/borrowck-init-plus-equal.stderr +++ b/src/test/ui/borrowck/borrowck-init-plus-equal.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `v` --> $DIR/borrowck-init-plus-equal.rs:3:9 | -LL | v = v + 1; //~ ERROR use of possibly uninitialized variable: `v` +LL | v = v + 1; | ^ use of possibly uninitialized `v` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.stderr b/src/test/ui/borrowck/borrowck-insert-during-each.stderr index 021b5b27ae70..3b6339757c97 100644 --- a/src/test/ui/borrowck/borrowck-insert-during-each.stderr +++ b/src/test/ui/borrowck/borrowck-insert-during-each.stderr @@ -3,7 +3,7 @@ error[E0500]: closure requires unique access to `f` but `*f` is already borrowed | LL | f.foo( | - borrow occurs here -LL | |a| { //~ ERROR closure requires unique access to `f` +LL | |a| { | ^^^ closure construction occurs here LL | f.n.insert(*a); | - borrow occurs due to use of `f` in closure diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.stderr b/src/test/ui/borrowck/borrowck-issue-2657-1.stderr index 7663822094d8..d9ad86b4f884 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-1.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-1.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | Some(ref _y) => { | ------ borrow of `x.0` occurs here -LL | let _a = x; //~ ERROR cannot move +LL | let _a = x; | ^^ move out of `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.stderr index 7e718786caa3..1314b1a14f44 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-issue-2657-2.rs:7:18 | -LL | let _b = *y; //~ ERROR cannot move out +LL | let _b = *y; | ^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/borrowck/borrowck-issue-48962.stderr b/src/test/ui/borrowck/borrowck-issue-48962.stderr index de4894d5b526..a5462b413968 100644 --- a/src/test/ui/borrowck/borrowck-issue-48962.stderr +++ b/src/test/ui/borrowck/borrowck-issue-48962.stderr @@ -5,7 +5,7 @@ LL | let mut src = &mut node; | ------- move occurs because `src` has type `&mut Node`, which does not implement the `Copy` trait LL | {src}; | --- value moved here -LL | src.next = None; //~ ERROR use of moved value: `src` [E0382] +LL | src.next = None; | ^^^^^^^^ value used here after move error[E0382]: use of moved value: `src` @@ -15,7 +15,7 @@ LL | let mut src = &mut (22, 44); | ------- move occurs because `src` has type `&mut (i32, i32)`, which does not implement the `Copy` trait LL | {src}; | --- value moved here -LL | src.0 = 66; //~ ERROR use of moved value: `src` [E0382] +LL | src.0 = 66; | ^^^^^^^^^^ value used here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.stderr b/src/test/ui/borrowck/borrowck-lend-flow-if.stderr index d1b6bb0c7c96..1acd47ce58bc 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-if.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow-if.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immu LL | _w = &v; | - immutable borrow occurs here LL | } -LL | borrow_mut(&mut *v); //~ ERROR cannot borrow +LL | borrow_mut(&mut *v); | ^^ mutable borrow occurs here LL | _w.use_ref(); LL | } diff --git a/src/test/ui/borrowck/borrowck-lend-flow.stderr b/src/test/ui/borrowck/borrowck-lend-flow.stderr index d9080d005539..e39fb6c86008 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immu | LL | let _w = &v; | - immutable borrow occurs here -LL | borrow_mut(&mut *v); //~ ERROR cannot borrow +LL | borrow_mut(&mut *v); | ^^ mutable borrow occurs here LL | _w.use_ref(); LL | } diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr index ba6e34c2ec82..e6f0a691eca1 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `v` because it is borrowed | LL | let w = &v; | - borrow of `v` occurs here -LL | take(v); //~ ERROR cannot move out of `v` because it is borrowed +LL | take(v); | ^ move out of `v` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr index 6aa2d5d189d2..c916b7efc08e 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `v` as mutable because `*v` is also borrowed as immu | LL | borrow(&*v, | -- immutable borrow occurs here -LL | |w| { //~ ERROR cannot borrow `v` as mutable +LL | |w| { | ^^^ mutable borrow occurs here LL | v = box 4; | - borrow occurs due to use of `v` in closure diff --git a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr index eceb923e776b..c9d36a7f9380 100644 --- a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr +++ b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `*s` because it is borrowed LL | let alias: &'static mut String = s; | - borrow of `*s` occurs here ... -LL | *s = String::new(); //~ ERROR cannot assign +LL | *s = String::new(); | ^^^^^^^^^^^^^^^^^^ assignment to borrowed `*s` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr index b4f7a9af666f..d180e3e701c6 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr @@ -4,7 +4,7 @@ error[E0503]: cannot use `p` because it was mutably borrowed LL | let q = &mut p; | - borrow of `p` occurs here LL | -LL | p + 3; //~ ERROR cannot use `p` +LL | p + 3; | ^ use of borrowed `p` error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `p` as immutable because it is also borrowed as muta LL | let q = &mut p; | - mutable borrow occurs here ... -LL | p.times(3); //~ ERROR cannot borrow `p` +LL | p.times(3); | ^ immutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr index eb0bbec0bc77..56d33eff73f1 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr @@ -1,7 +1,7 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable --> $DIR/borrowck-loan-rcvr.rs:23:14 | -LL | p.blockm(|| { //~ ERROR cannot borrow `p` as mutable +LL | p.blockm(|| { | - ^^ mutable borrow occurs here | | | immutable borrow occurs here @@ -15,7 +15,7 @@ error[E0502]: cannot borrow `p` as immutable because it is also borrowed as muta | LL | let l = &mut p; | - mutable borrow occurs here -LL | p.impurem(); //~ ERROR cannot borrow +LL | p.impurem(); | ^ immutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-loan-vec-content.stderr b/src/test/ui/borrowck/borrowck-loan-vec-content.stderr index 6a565ff2f10d..eea6a09f0fc5 100644 --- a/src/test/ui/borrowck/borrowck-loan-vec-content.stderr +++ b/src/test/ui/borrowck/borrowck-loan-vec-content.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immuta | LL | &v[0], | - immutable borrow occurs here -LL | || { //~ ERROR cannot borrow `v` as mutable +LL | || { | ^^ mutable borrow occurs here LL | v[1] = 4; | - borrow occurs due to use of `v` in closure diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.stderr b/src/test/ui/borrowck/borrowck-move-by-capture.stderr index 9c485fb48ca7..d845a576b3dc 100644 --- a/src/test/ui/borrowck/borrowck-move-by-capture.stderr +++ b/src/test/ui/borrowck/borrowck-move-by-capture.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of captured outer variable in an `FnMut` closure LL | let bar: Box<_> = box 3; | --- captured outer variable LL | let _g = to_fn_mut(|| { -LL | let _h = to_fn_once(move || -> isize { *bar }); //~ ERROR cannot move out of +LL | let _h = to_fn_once(move || -> isize { *bar }); | ^^^^^^^^^^^^^^^^ cannot move out of captured outer variable in an `FnMut` closure error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr index 07009b42e4da..8b0722916dbf 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.stderr +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr @@ -1,9 +1,9 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-error-with-note.rs:11:11 | -LL | match *f { //~ ERROR cannot move out of +LL | match *f { | ^^ cannot move out of borrowed content -LL | //~| cannot move out +LL | LL | Foo::Foo1(num1, | ---- hint: to prevent move, use `ref num1` or `ref mut num1` LL | num2) => (), @@ -14,8 +14,8 @@ LL | Foo::Foo2(num) => (), error[E0509]: cannot move out of type `S`, which implements the `Drop` trait --> $DIR/borrowck-move-error-with-note.rs:30:9 | -LL | / S { //~ ERROR cannot move out of type `S`, which implements the `Drop` trait -LL | | //~| cannot move out of here +LL | / S { +LL | | LL | | f: _s, | | -- hint: to prevent move, use `ref _s` or `ref mut _s` LL | | g: _t @@ -26,9 +26,9 @@ LL | | } => {} error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-error-with-note.rs:47:11 | -LL | match a.a { //~ ERROR cannot move out of +LL | match a.a { | ^ cannot move out of borrowed content -LL | //~| cannot move out +LL | LL | n => { | - hint: to prevent move, use `ref n` or `ref mut n` diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr index 2ed888051f61..5e2428ef4a3e 100644 --- a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr @@ -4,7 +4,7 @@ error[E0505]: cannot move out of `*a` because it is borrowed LL | let b = &a; | - borrow of `a` occurs here LL | -LL | let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed +LL | let z = *a; | ^ move out of `*a` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr index 62a522600388..c23c5bb9c4c1 100644 --- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of dereference of raw pointer --> $DIR/borrowck-move-from-unsafe-ptr.rs:2:13 | -LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer +LL | let y = *x; | ^^ | | | cannot move out of dereference of raw pointer diff --git a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr index 224bf0fded87..d3853832c92b 100644 --- a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `t0` because it is borrowed | LL | let p: &isize = &*t0; // Freezes `*t0` | --- borrow of `*t0` occurs here -LL | let t1 = t0; //~ ERROR cannot move out of `t0` +LL | let t1 = t0; | ^^ move out of `t0` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr index 156ba0d4d7bb..5ec0dabfde58 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr @@ -5,9 +5,9 @@ LL | &[Foo { string: a }, | ^ - hint: to prevent move, use `ref a` or `ref mut a` | __________________| | | -LL | | //~^ ERROR cannot move out of type `[Foo]` -LL | | //~| cannot move out -LL | | //~| to prevent move +LL | | +LL | | +LL | | LL | | Foo { string: b }] => { | |_________________________________-__^ cannot move out of here | | diff --git a/src/test/ui/borrowck/borrowck-move-subcomponent.stderr b/src/test/ui/borrowck/borrowck-move-subcomponent.stderr index 187cdbbf8156..fd3deef6df5e 100644 --- a/src/test/ui/borrowck/borrowck-move-subcomponent.stderr +++ b/src/test/ui/borrowck/borrowck-move-subcomponent.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a.x` because it is borrowed | LL | let pb = &a; | - borrow of `a` occurs here -LL | let S { x: ax } = a; //~ ERROR cannot move out +LL | let S { x: ax } = a; | ^^ move out of `a.x` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.stderr b/src/test/ui/borrowck/borrowck-multiple-captures.stderr index 3cdd09426083..f25b19e3d2ee 100644 --- a/src/test/ui/borrowck/borrowck-multiple-captures.stderr +++ b/src/test/ui/borrowck/borrowck-multiple-captures.stderr @@ -4,7 +4,7 @@ error[E0504]: cannot move `x1` into closure because it is borrowed LL | let p1 = &x1; | -- borrow of `x1` occurs here ... -LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed +LL | drop(x1); | ^^ move into closure occurs here error[E0504]: cannot move `x2` into closure because it is borrowed @@ -13,7 +13,7 @@ error[E0504]: cannot move `x2` into closure because it is borrowed LL | let p2 = &x2; | -- borrow of `x2` occurs here ... -LL | drop(x2); //~ ERROR cannot move `x2` into closure because it is borrowed +LL | drop(x2); | ^^ move into closure occurs here error[E0382]: capture of moved value: `x1` @@ -22,7 +22,7 @@ error[E0382]: capture of moved value: `x1` LL | drop(x1); | -- value moved here ... -LL | drop(x1); //~ ERROR capture of moved value: `x1` +LL | drop(x1); | ^^ value captured here after move | = note: move occurs because `x1` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -33,7 +33,7 @@ error[E0382]: capture of moved value: `x2` LL | drop(x2); | -- value moved here ... -LL | drop(x2); //~ ERROR capture of moved value: `x2` +LL | drop(x2); | ^^ value captured here after move | = note: move occurs because `x2` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -44,15 +44,15 @@ error[E0504]: cannot move `x` into closure because it is borrowed LL | let p = &x; | - borrow of `x` occurs here LL | thread::spawn(move|| { -LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed +LL | drop(x); | ^ move into closure occurs here error[E0382]: use of moved value: `x` --> $DIR/borrowck-multiple-captures.rs:36:14 | -LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed +LL | drop(x); | - value moved here -LL | drop(x); //~ ERROR use of moved value: `x` +LL | drop(x); | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -63,7 +63,7 @@ error[E0382]: capture of moved value: `x` LL | drop(x); | - value moved here LL | thread::spawn(move|| { -LL | drop(x); //~ ERROR capture of moved value: `x` +LL | drop(x); | ^ value captured here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -71,9 +71,9 @@ LL | drop(x); //~ ERROR capture of moved value: `x` error[E0382]: use of moved value: `x` --> $DIR/borrowck-multiple-captures.rs:46:14 | -LL | drop(x); //~ ERROR capture of moved value: `x` +LL | drop(x); | - value moved here -LL | drop(x); //~ ERROR use of moved value: `x` +LL | drop(x); | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr index 95635f7f6703..aa3b39c395de 100644 --- a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr +++ b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable | LL | let x: isize = 3; | - help: make this binding mutable: `mut x` -LL | let y: &mut isize = &mut x; //~ ERROR cannot borrow +LL | let y: &mut isize = &mut x; | ^ cannot borrow mutably error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr index 154a283b43b5..fb73dbd45104 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as im | LL | let p: &isize = &*t0; // Freezes `*t0` | --- immutable borrow occurs here -LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` +LL | let mut t2 = &mut t0; | ^^ mutable borrow occurs here ... LL | } @@ -14,7 +14,7 @@ error[E0499]: cannot borrow `t0` as mutable more than once at a time | LL | let p: &mut isize = &mut *t0; // Claims `*t0` | --- first mutable borrow occurs here -LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` +LL | let mut t2 = &mut t0; | ^^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr index 41ee2adf8aa0..416091920ad1 100644 --- a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr +++ b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable local variable `v` as mutable | LL | let v = vec![1, 2, 3]; | - help: make this binding mutable: `mut v` -LL | write(&mut v); //~ ERROR cannot borrow +LL | write(&mut v); | ^ cannot borrow mutably error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr index 5aaf825a3c36..5fc169490c7e 100644 --- a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr +++ b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | Cycle::Node(ref mut y) => { | --------- borrow of `x.0` occurs here -LL | y.a = x; //~ ERROR cannot move out of +LL | y.a = x; | ^ move out of `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.stderr index b22d05b8a2a8..8f6c8e072e54 100644 --- a/src/test/ui/borrowck/borrowck-object-lifetime.stderr +++ b/src/test/ui/borrowck/borrowck-object-lifetime.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immut | LL | let y = x.borrowed(); | - immutable borrow occurs here -LL | let z = x.mut_borrowed(); //~ ERROR cannot borrow +LL | let z = x.mut_borrowed(); | ^ mutable borrow occurs here LL | y.use_ref(); LL | } @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `x` as mutable because `*x` is also borrowed as immu | LL | let y = x.borrowed(); | - immutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | let z = &mut x; | ^ mutable borrow occurs here LL | y.use_ref(); LL | } diff --git a/src/test/ui/borrowck/borrowck-or-init.stderr b/src/test/ui/borrowck/borrowck-or-init.stderr index 60024c08303a..a2b69b187b93 100644 --- a/src/test/ui/borrowck/borrowck-or-init.stderr +++ b/src/test/ui/borrowck/borrowck-or-init.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `i` --> $DIR/borrowck-or-init.rs:5:20 | -LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` +LL | println!("{}", i); | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.stderr b/src/test/ui/borrowck/borrowck-overloaded-call.stderr index 042922613065..97223a2307c6 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-call.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-call.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `s` as immutable because it is also borrowed as muta | LL | let sp = &mut s; | - mutable borrow occurs here -LL | s(3); //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable +LL | s(3); | ^ immutable borrow occurs here LL | use_mut(sp); LL | } @@ -15,7 +15,7 @@ error[E0596]: cannot borrow immutable local variable `s` as mutable LL | let s = SFnMut { | - help: make this binding mutable: `mut s` ... -LL | s(3); //~ ERROR cannot borrow immutable local variable `s` as mutable +LL | s(3); | ^ cannot borrow mutably error[E0382]: use of moved value: `s` @@ -23,7 +23,7 @@ error[E0382]: use of moved value: `s` | LL | s(" world".to_string()); | - value moved here -LL | s(" world".to_string()); //~ ERROR use of moved value: `s` +LL | s(" world".to_string()); | ^ value used here after move | = note: move occurs because `s` has type `SFnOnce`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr index 9bc83f84339c..73cab8868eab 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*f` as immutable because it is also borrowed as mut | LL | let p = &mut f[&s]; | - mutable borrow occurs here -LL | let q = &f[&s]; //~ ERROR cannot borrow +LL | let q = &f[&s]; | ^ immutable borrow occurs here LL | p.use_mut(); LL | } @@ -14,7 +14,7 @@ error[E0499]: cannot borrow `*f` as mutable more than once at a time | LL | let p = &mut f[&s]; | - first mutable borrow occurs here -LL | let q = &mut f[&s]; //~ ERROR cannot borrow +LL | let q = &mut f[&s]; | ^ second mutable borrow occurs here LL | p.use_mut(); LL | } @@ -25,7 +25,7 @@ error[E0499]: cannot borrow `f.foo` as mutable more than once at a time | LL | let p = &mut f.foo[&s]; | ----- first mutable borrow occurs here -LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow +LL | let q = &mut f.foo[&s]; | ^^^^^ second mutable borrow occurs here LL | p.use_mut(); LL | } @@ -36,7 +36,7 @@ error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as im | LL | let p = &f.foo[&s]; | ----- immutable borrow occurs here -LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow +LL | let q = &mut f.foo[&s]; | ^^^^^ mutable borrow occurs here LL | p.use_ref(); LL | } @@ -47,7 +47,7 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed | LL | let p = &f.foo[&s]; | ----- borrow of `f.foo` occurs here -LL | f.foo = g; //~ ERROR cannot assign +LL | f.foo = g; | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here error[E0506]: cannot assign to `*f` because it is borrowed @@ -55,7 +55,7 @@ error[E0506]: cannot assign to `*f` because it is borrowed | LL | let p = &f.foo[&s]; | ----- borrow of `*f` occurs here -LL | *f = g; //~ ERROR cannot assign +LL | *f = g; | ^^^^^^ assignment to borrowed `*f` occurs here error[E0506]: cannot assign to `f.foo` because it is borrowed @@ -63,7 +63,7 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed | LL | let p = &mut f.foo[&s]; | ----- borrow of `f.foo` occurs here -LL | f.foo = g; //~ ERROR cannot assign +LL | f.foo = g; | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here error[E0506]: cannot assign to `*f` because it is borrowed @@ -71,7 +71,7 @@ error[E0506]: cannot assign to `*f` because it is borrowed | LL | let p = &mut f.foo[&s]; | ----- borrow of `*f` occurs here -LL | *f = g; //~ ERROR cannot assign +LL | *f = g; | ^^^^^^ assignment to borrowed `*f` occurs here error: aborting due to 8 previous errors diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr index c20df9f5ff3f..ea624018ad4c 100644 --- a/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr +++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^ second mutable borrow occurs here LL | use_mut(_bar1); LL | } @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let _bar1 = &mut foo.bar1; | -------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^ immutable borrow occurs here LL | use_mut(_bar1); LL | } @@ -25,7 +25,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let _bar1 = &foo.bar1; | -------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^ mutable borrow occurs here LL | use_imm(_bar1); LL | } @@ -48,7 +48,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is a | LL | let _bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^ immutable borrow occurs here ... LL | } @@ -59,8 +59,8 @@ error[E0502]: cannot borrow `*foo` as immutable because `foo.bar1.int1` is also | LL | let _bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &*foo; | ^^^^ immutable borrow occurs here LL | use_mut(_bar1); LL | } @@ -71,7 +71,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^ second mutable borrow occurs here LL | use_mut(_bar1); LL | } @@ -82,7 +82,7 @@ error[E0499]: cannot borrow `*foo` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^ second mutable borrow occurs here LL | use_mut(_bar1); LL | } @@ -93,7 +93,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is als | LL | let _bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^ mutable borrow occurs here LL | use_imm(_bar1); LL | } @@ -104,7 +104,7 @@ error[E0502]: cannot borrow `*foo` as mutable because `foo.bar1.int1` is also bo | LL | let _bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^ mutable borrow occurs here LL | use_imm(_bar1); LL | } @@ -115,7 +115,7 @@ error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable | LL | fn borrow_mut_from_imm(foo: &Foo) { | ---- use `&mut Foo` here to make mutable -LL | let _bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar1 = &mut foo.bar1; | ^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to 11 previous errors diff --git a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr index 4eb41758fc19..6e0d2f699455 100644 --- a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr +++ b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow field `(x as std::prelude::v1::Some).0` of immutable LL | fn destructure(x: Option) -> isize { | - help: make this binding mutable: `mut x` ... -LL | Some(ref mut v) => *v //~ ERROR cannot borrow +LL | Some(ref mut v) => *v | ^^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-reinit.stderr b/src/test/ui/borrowck/borrowck-reinit.stderr index 96f3981ac2fe..3618a7cb2cd3 100644 --- a/src/test/ui/borrowck/borrowck-reinit.stderr +++ b/src/test/ui/borrowck/borrowck-reinit.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` (Ast) | LL | drop(x); | - value moved here -LL | let _ = (1,x); //~ ERROR use of moved value: `x` (Ast) +LL | let _ = (1,x); | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -16,7 +16,7 @@ LL | let mut x = Box::new(0); ... LL | drop(x); | - value moved here -LL | let _ = (1,x); //~ ERROR use of moved value: `x` (Ast) +LL | let _ = (1,x); | ^ value used here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr index cb65ea11205d..79aec6c2edaa 100644 --- a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr +++ b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr @@ -3,8 +3,8 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let y = &mut x; | - mutable borrow occurs here -LL | //~^ mutable borrow occurs here -LL | let z = &x; //~ ERROR cannot borrow +LL | +LL | let z = &x; | ^ immutable borrow occurs here ... LL | } @@ -15,8 +15,8 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta | LL | let y = &x; | - immutable borrow occurs here -LL | //~^ immutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | +LL | let z = &mut x; | ^ mutable borrow occurs here ... LL | } @@ -27,8 +27,8 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | - first mutable borrow occurs here -LL | //~^ first mutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | +LL | let z = &mut x; | ^ second mutable borrow occurs here ... LL | }; diff --git a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr index b54941eed1be..4d4244ba5efa 100644 --- a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr +++ b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:7:7 | -LL | (&x).clone() //~ ERROR `x` does not live long enough +LL | (&x).clone() | ^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/borrowck/borrowck-return.stderr b/src/test/ui/borrowck/borrowck-return.stderr index b8a5ce8dc99b..a2b65af5dbfc 100644 --- a/src/test/ui/borrowck/borrowck-return.stderr +++ b/src/test/ui/borrowck/borrowck-return.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-return.rs:3:12 | -LL | return x; //~ ERROR use of possibly uninitialized variable: `x` +LL | return x; | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr index b1629c0e056c..f716ee68b000 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | if let [ref first, ref second, ..] = *s { | ---------- immutable borrow occurs here -LL | if let [_, ref mut second2, ref mut third, ..] = *s { //~ERROR +LL | if let [_, ref mut second2, ref mut third, ..] = *s { | ^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second, second2, third]); | ------ immutable borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | if let [.., ref fourth, ref third, _, ref first] = *s { | --------- immutable borrow occurs here -LL | if let [.., ref mut third2, _, _] = *s { //~ERROR +LL | if let [.., ref mut third2, _, _] = *s { | ^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, third, third2, fourth]); | ----- immutable borrow later used here @@ -24,7 +24,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s { | ------------- immutable borrow occurs here ... -LL | if let [_, ref mut from_begin1, ..] = *s { //~ERROR +LL | if let [_, ref mut from_begin1, ..] = *s { | ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin1, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here @@ -35,7 +35,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s { | ------------- immutable borrow occurs here ... -LL | if let [_, _, ref mut from_begin2, ..] = *s { //~ERROR +LL | if let [_, _, ref mut from_begin2, ..] = *s { | ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin2, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here @@ -46,7 +46,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s { | ------------- immutable borrow occurs here ... -LL | if let [_, _, _, ref mut from_begin3, ..] = *s { //~ERROR +LL | if let [_, _, _, ref mut from_begin3, ..] = *s { | ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin3, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here @@ -57,7 +57,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s { | --------------- immutable borrow occurs here ... -LL | if let [.., ref mut from_end2, _] = *s { //~ERROR +LL | if let [.., ref mut from_end2, _] = *s { | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin0, from_begin1, from_begin3, from_end2]); | ----------- immutable borrow later used here @@ -68,7 +68,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s { | --------------- immutable borrow occurs here ... -LL | if let [.., ref mut from_end3, _, _] = *s { //~ERROR +LL | if let [.., ref mut from_end3, _, _] = *s { | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin0, from_begin1, from_begin3, from_end3]); | ----------- immutable borrow later used here @@ -79,7 +79,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s { | --------------- immutable borrow occurs here ... -LL | if let [.., ref mut from_end4, _, _, _] = *s { //~ERROR +LL | if let [.., ref mut from_end4, _, _, _] = *s { | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin0, from_begin1, from_begin3, from_end4]); | ----------- immutable borrow later used here @@ -89,7 +89,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | if let [ref first, ref second, ..] = *s { | ---------- immutable borrow occurs here -LL | if let [_, ref mut tail..] = *s { //~ERROR +LL | if let [_, ref mut tail..] = *s { | ^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second]); | ------ immutable borrow later used here @@ -99,7 +99,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | if let [.., ref second, ref first] = *s { | ---------- immutable borrow occurs here -LL | if let [ref mut tail.., _] = *s { //~ERROR +LL | if let [ref mut tail.., _] = *s { | ^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second]); | ------ immutable borrow later used here @@ -109,7 +109,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | if let [_, _, _, ref s1..] = *s { | ------ immutable borrow occurs here -LL | if let [ref mut s2.., _, _, _] = *s { //~ERROR +LL | if let [ref mut s2.., _, _, _] = *s { | ^^^^^^^^^^ mutable borrow occurs here LL | nop_subslice(s1); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-storage-dead.stderr b/src/test/ui/borrowck/borrowck-storage-dead.stderr index 057d40d74cfe..c291ed224eb3 100644 --- a/src/test/ui/borrowck/borrowck-storage-dead.stderr +++ b/src/test/ui/borrowck/borrowck-storage-dead.stderr @@ -1,13 +1,13 @@ error[E0381]: use of possibly uninitialized variable: `x` (Ast) --> $DIR/borrowck-storage-dead.rs:18:17 | -LL | let _ = x + 1; //~ERROR (Ast) [E0381] +LL | let _ = x + 1; | ^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` (Mir) --> $DIR/borrowck-storage-dead.rs:18:17 | -LL | let _ = x + 1; //~ERROR (Ast) [E0381] +LL | let _ = x + 1; | ^ use of possibly uninitialized `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr index 35007216dace..9efd249caf86 100644 --- a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as im | LL | let p: &isize = &*t0; // Freezes `*t0` | --- immutable borrow occurs here -LL | swap(&mut t0, &mut t1); //~ ERROR cannot borrow `t0` +LL | swap(&mut t0, &mut t1); | ^^ mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr index 044119f50895..2e0773aebc4c 100644 --- a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr +++ b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `f` as immutable because it is also borrowed as muta | LL | let g = &mut f; | - mutable borrow occurs here -LL | f(1, 2); //~ ERROR cannot borrow `f` as immutable +LL | f(1, 2); | ^ immutable borrow occurs here LL | use_mut(g); LL | } @@ -14,7 +14,7 @@ error[E0596]: cannot borrow immutable argument `f` as mutable | LL | fn b isize>(f: F) { | - help: make this binding mutable: `mut f` -LL | f(1, 2); //~ ERROR cannot borrow immutable argument +LL | f(1, 2); | ^ cannot borrow mutably error[E0382]: use of moved value: `f` @@ -22,7 +22,7 @@ error[E0382]: use of moved value: `f` | LL | f(1, 2); | - value moved here -LL | f(1, 2); //~ ERROR use of moved value +LL | f(1, 2); | ^ value used here after move | = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-uninit-after-item.stderr b/src/test/ui/borrowck/borrowck-uninit-after-item.stderr index f658b64f11f4..2d0b21dd0d6f 100644 --- a/src/test/ui/borrowck/borrowck-uninit-after-item.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-after-item.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `bar` --> $DIR/borrowck-uninit-after-item.rs:4:9 | -LL | baz(bar); //~ ERROR use of possibly uninitialized variable: `bar` +LL | baz(bar); | ^^^ use of possibly uninitialized `bar` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr b/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr index a685f0ecf3c0..163395e42d25 100644 --- a/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr @@ -1,61 +1,61 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:6:5 | -LL | x += 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x += 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:9:5 | -LL | x -= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x -= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:12:5 | -LL | x *= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x *= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:15:5 | -LL | x /= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x /= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:18:5 | -LL | x %= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x %= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:21:5 | -LL | x ^= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x ^= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:24:5 | -LL | x &= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x &= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:27:5 | -LL | x |= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x |= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:30:5 | -LL | x <<= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x <<= 1; | ^^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:33:5 | -LL | x >>= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x >>= 1; | ^^^^^^^ use of possibly uninitialized `x` error: aborting due to 10 previous errors diff --git a/src/test/ui/borrowck/borrowck-uninit.stderr b/src/test/ui/borrowck/borrowck-uninit.stderr index 5e3428e20b1f..5db9c1b250cc 100644 --- a/src/test/ui/borrowck/borrowck-uninit.stderr +++ b/src/test/ui/borrowck/borrowck-uninit.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit.rs:5:9 | -LL | foo(x); //~ ERROR use of possibly uninitialized variable: `x` +LL | foo(x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr b/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr index 199a13352c4a..71fae6f8d63b 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `u.c` because it was mutably borrowed | LL | let ra = &mut u.s.a; | ----- borrow of `u.s.a` occurs here -LL | let b = u.c; //~ ERROR cannot use `u.c` because it was mutably borrowed +LL | let b = u.c; | ^ use of borrowed `u.s.a` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-union-borrow.stderr b/src/test/ui/borrowck/borrowck-union-borrow.stderr index ef6a331eda04..1cda7e499298 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immu | LL | let ra = &u.a; | --- immutable borrow occurs here -LL | let rma = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable +LL | let rma = &mut u.a; | ^^^ mutable borrow occurs here LL | drop(ra); LL | } @@ -14,7 +14,7 @@ error[E0506]: cannot assign to `u.a` because it is borrowed | LL | let ra = &u.a; | --- borrow of `u.a` occurs here -LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed +LL | u.a = 1; | ^^^^^^^ assignment to borrowed `u.a` occurs here error[E0502]: cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) @@ -22,7 +22,7 @@ error[E0502]: cannot borrow `u` (via `u.b`) as mutable because `u` is also borro | LL | let ra = &u.a; | --- immutable borrow occurs here (via `u.a`) -LL | let rmb = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) +LL | let rmb = &mut u.b; | ^^^ mutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here LL | drop(ra); LL | } @@ -33,7 +33,7 @@ error[E0506]: cannot assign to `u.b` because it is borrowed | LL | let ra = &u.a; | --- borrow of `u.b` occurs here -LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed +LL | u.b = 1; | ^^^^^^^ assignment to borrowed `u.b` occurs here error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable @@ -41,7 +41,7 @@ error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mu | LL | let rma = &mut u.a; | --- mutable borrow occurs here -LL | let ra = &u.a; //~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable +LL | let ra = &u.a; | ^^^ immutable borrow occurs here LL | drop(rma); LL | } @@ -52,7 +52,7 @@ error[E0503]: cannot use `u.a` because it was mutably borrowed | LL | let ra = &mut u.a; | --- borrow of `u.a` occurs here -LL | let a = u.a; //~ ERROR cannot use `u.a` because it was mutably borrowed +LL | let a = u.a; | ^ use of borrowed `u.a` error[E0499]: cannot borrow `u.a` as mutable more than once at a time @@ -60,7 +60,7 @@ error[E0499]: cannot borrow `u.a` as mutable more than once at a time | LL | let rma = &mut u.a; | --- first mutable borrow occurs here -LL | let rma2 = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable more than once at a time +LL | let rma2 = &mut u.a; | ^^^ second mutable borrow occurs here LL | drop(rma); LL | } @@ -71,7 +71,7 @@ error[E0506]: cannot assign to `u.a` because it is borrowed | LL | let rma = &mut u.a; | --- borrow of `u.a` occurs here -LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed +LL | u.a = 1; | ^^^^^^^ assignment to borrowed `u.a` occurs here error[E0502]: cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) @@ -79,7 +79,7 @@ error[E0502]: cannot borrow `u` (via `u.b`) as immutable because `u` is also bor | LL | let rma = &mut u.a; | --- mutable borrow occurs here (via `u.a`) -LL | let rb = &u.b; //~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) +LL | let rb = &u.b; | ^^^ immutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here LL | drop(rma); LL | } @@ -90,7 +90,7 @@ error[E0503]: cannot use `u.b` because it was mutably borrowed | LL | let ra = &mut u.a; | --- borrow of `u.a` occurs here -LL | let b = u.b; //~ ERROR cannot use `u.b` because it was mutably borrowed +LL | let b = u.b; | ^ use of borrowed `u.a` error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time @@ -98,7 +98,7 @@ error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time | LL | let rma = &mut u.a; | --- first mutable borrow occurs here (via `u.a`) -LL | let rmb2 = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time +LL | let rmb2 = &mut u.b; | ^^^ second mutable borrow occurs here (via `u.b`) LL | drop(rma); LL | } @@ -109,7 +109,7 @@ error[E0506]: cannot assign to `u.b` because it is borrowed | LL | let rma = &mut u.a; | --- borrow of `u.b` occurs here -LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed +LL | u.b = 1; | ^^^^^^^ assignment to borrowed `u.b` occurs here error: aborting due to 12 previous errors diff --git a/src/test/ui/borrowck/borrowck-union-move-assign.stderr b/src/test/ui/borrowck/borrowck-union-move-assign.stderr index f304dc3a1242..04e67fcb9297 100644 --- a/src/test/ui/borrowck/borrowck-union-move-assign.stderr +++ b/src/test/ui/borrowck/borrowck-union-move-assign.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `u.a` | LL | let a = u.a; | - value moved here -LL | let a = u.a; //~ ERROR use of moved value: `u.a` +LL | let a = u.a; | ^ value used here after move | = note: move occurs because `u.a` has type `A`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-union-move.stderr b/src/test/ui/borrowck/borrowck-union-move.stderr index ebd8bdc69c02..4ce372aedc36 100644 --- a/src/test/ui/borrowck/borrowck-union-move.stderr +++ b/src/test/ui/borrowck/borrowck-union-move.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `u.n1` | LL | let a = u.n1; | - value moved here -LL | let a = u.n1; //~ ERROR use of moved value: `u.n1` +LL | let a = u.n1; | ^ value used here after move | = note: move occurs because `u.n1` has type `NonCopy`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of partially moved value: `u` | LL | let a = u.n1; | - value moved here -LL | let a = u; //~ ERROR use of partially moved value: `u` +LL | let a = u; | ^ value used here after move | = note: move occurs because `u.n2` has type `[type error]`, which does not implement the `Copy` trait @@ -23,7 +23,7 @@ error[E0382]: use of moved value: `u.n2` | LL | let a = u.n1; | - value moved here -LL | let a = u.n2; //~ ERROR use of moved value: `u.n2` +LL | let a = u.n2; | ^ value used here after move | = note: move occurs because `u.n2` has type `[type error]`, which does not implement the `Copy` trait @@ -33,7 +33,7 @@ error[E0382]: use of moved value: `u.n` | LL | let a = u.n; | - value moved here -LL | let a = u.n; //~ ERROR use of moved value: `u.n` +LL | let a = u.n; | ^ value used here after move | = note: move occurs because `u.n` has type `NonCopy`, which does not implement the `Copy` trait @@ -43,7 +43,7 @@ error[E0382]: use of moved value: `u.c` | LL | let a = u.n; | - value moved here -LL | let a = u.c; //~ ERROR use of moved value: `u.c` +LL | let a = u.c; | ^ value used here after move | = note: move occurs because `u.c` has type `[type error]`, which does not implement the `Copy` trait @@ -53,7 +53,7 @@ error[E0382]: use of partially moved value: `u` | LL | let a = u.n; | - value moved here -LL | let a = u; //~ ERROR use of partially moved value: `u` +LL | let a = u; | ^ value used here after move | = note: move occurs because `u.c` has type `[type error]`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-union-uninitialized.stderr b/src/test/ui/borrowck/borrowck-union-uninitialized.stderr index c8b22dd1c9ef..6a1401ff32bb 100644 --- a/src/test/ui/borrowck/borrowck-union-uninitialized.stderr +++ b/src/test/ui/borrowck/borrowck-union-uninitialized.stderr @@ -1,13 +1,13 @@ error[E0381]: use of possibly uninitialized variable: `s.a` --> $DIR/borrowck-union-uninitialized.rs:15:13 | -LL | let sa = s.a; //~ ERROR use of possibly uninitialized variable: `s.a` +LL | let sa = s.a; | ^^ use of possibly uninitialized `s.a` error[E0381]: use of possibly uninitialized variable: `u.a` --> $DIR/borrowck-union-uninitialized.rs:16:13 | -LL | let ua = u.a; //~ ERROR use of possibly uninitialized variable: `u.a` +LL | let ua = u.a; | ^^ use of possibly uninitialized `u.a` error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr b/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr index 14a9551acc6e..00fd77ed718a 100644 --- a/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr +++ b/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mu | LL | let w = &mut v; | - mutable borrow occurs here -LL | borrow(&*v); //~ ERROR cannot borrow `*v` +LL | borrow(&*v); | ^^ immutable borrow occurs here LL | w.use_mut(); LL | } @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mu | LL | x = &mut v; | - mutable borrow occurs here -LL | borrow(&*v); //~ ERROR cannot borrow `*v` +LL | borrow(&*v); | ^^ immutable borrow occurs here LL | x.use_mut(); LL | } diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr b/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr index b6b09f008a4e..5c1d72691764 100644 --- a/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr +++ b/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let p = &mut x; | - borrow of `x` occurs here -LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed +LL | drop(x); | ^ use of borrowed `x` error[E0503]: cannot use `x` because it was mutably borrowed @@ -11,7 +11,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let p = &mut x.a; | --- borrow of `x.a` occurs here -LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed +LL | drop(x); | ^ use of borrowed `x.a` error[E0503]: cannot use `x.a` because it was mutably borrowed @@ -19,7 +19,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x; | - borrow of `x` occurs here -LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | drop(x.a); | ^^^ use of borrowed `x` error[E0503]: cannot use `x.a` because it was mutably borrowed @@ -27,7 +27,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x.a; | --- borrow of `x.a` occurs here -LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | drop(x.a); | ^^^ use of borrowed `x.a` error[E0503]: cannot use `x.a` because it was mutably borrowed @@ -35,7 +35,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x; | - borrow of `x` occurs here -LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | let y = A { b: 3, .. x }; | ^ use of borrowed `x` error[E0503]: cannot use `x.a` because it was mutably borrowed @@ -43,7 +43,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x.a; | --- borrow of `x.a` occurs here -LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | let y = A { b: 3, .. x }; | ^ use of borrowed `x.a` error[E0503]: cannot use `*x` because it was mutably borrowed @@ -51,7 +51,7 @@ error[E0503]: cannot use `*x` because it was mutably borrowed | LL | let p = &mut x; | - borrow of `x` occurs here -LL | drop(*x); //~ ERROR cannot use `*x` because it was mutably borrowed +LL | drop(*x); | ^^ use of borrowed `x` error[E0503]: cannot use `*x.b` because it was mutably borrowed @@ -59,7 +59,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed | LL | let p = &mut x; | - borrow of `x` occurs here -LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed +LL | drop(*x.b); | ^^^^ use of borrowed `x` error[E0503]: cannot use `*x.b` because it was mutably borrowed @@ -67,7 +67,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed | LL | let p = &mut x.b; | --- borrow of `x.b` occurs here -LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed +LL | drop(*x.b); | ^^^^ use of borrowed `x.b` error: aborting due to 9 previous errors diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr index b2fcb2f8cd1b..b0eaee790743 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr @@ -1,7 +1,7 @@ error[E0597]: `vec` does not live long enough --> $DIR/borrowck-vec-pattern-element-loan.rs:5:26 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ^^^ borrowed value does not live long enough ... LL | } @@ -16,7 +16,7 @@ LL | fn a<'a>() -> &'a [isize] { error[E0597]: `vec` does not live long enough --> $DIR/borrowck-vec-pattern-element-loan.rs:15:26 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ^^^ borrowed value does not live long enough ... LL | } @@ -31,7 +31,7 @@ LL | fn b<'a>() -> &'a [isize] { error[E0597]: `vec` does not live long enough --> $DIR/borrowck-vec-pattern-element-loan.rs:25:26 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr index caadcb361154..1ce6a3bddce0 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time LL | let vb: &mut [isize] = &mut v; | - first mutable borrow occurs here ... -LL | v.push(tail[0] + tail[1]); //~ ERROR cannot borrow +LL | v.push(tail[0] + tail[1]); | ^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr index 25825fea1587..0e3f514c662a 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -3,8 +3,8 @@ error[E0506]: cannot assign to `vec[..]` because it is borrowed | LL | [box ref _a, _, _] => { | ------ borrow of `vec[..]` occurs here -LL | //~^ borrow of `vec[..]` occurs here -LL | vec[0] = box 4; //~ ERROR cannot assign +LL | +LL | vec[0] = box 4; | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here error[E0506]: cannot assign to `vec[..]` because it is borrowed @@ -12,19 +12,19 @@ error[E0506]: cannot assign to `vec[..]` because it is borrowed | LL | &mut [ref _b..] => { | ------ borrow of `vec[..]` occurs here -LL | //~^ borrow of `vec[..]` occurs here -LL | vec[0] = box 4; //~ ERROR cannot assign +LL | +LL | vec[0] = box 4; | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:34:14 | -LL | &mut [_a, //~ ERROR cannot move out +LL | &mut [_a, | ^-- hint: to prevent move, use `ref _a` or `ref mut _a` | ______________| | | -LL | | //~| cannot move out -LL | | //~| to prevent move +LL | | +LL | | LL | | .. LL | | ] => { | |_________^ cannot move out of here @@ -32,7 +32,7 @@ LL | | ] => { error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:47:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here @@ -41,9 +41,9 @@ LL | let a = vec[0]; //~ ERROR cannot move out error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:55:14 | -LL | &mut [ //~ ERROR cannot move out +LL | &mut [ | ______________^ -LL | | //~^ cannot move out +LL | | LL | | _b] => {} | |__________--^ cannot move out of here | | @@ -52,7 +52,7 @@ LL | | _b] => {} error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:60:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here @@ -61,7 +61,7 @@ LL | let a = vec[0]; //~ ERROR cannot move out error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:68:14 | -LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out +LL | &mut [_a, _b, _c] => {} | ^--^^--^^--^ | || | | | || | ...and here (use `ref _c` or `ref mut _c`) @@ -72,7 +72,7 @@ LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:72:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr index a4584aac0e8d..0a5f773159f4 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr @@ -1,7 +1,7 @@ error[E0597]: `vec` does not live long enough --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:5:26 | -LL | let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough +LL | let vec: &[isize] = &vec; | ^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/borrowck/borrowck-while-break.stderr b/src/test/ui/borrowck/borrowck-while-break.stderr index f35d43162b24..55969b8fb1ff 100644 --- a/src/test/ui/borrowck/borrowck-while-break.stderr +++ b/src/test/ui/borrowck/borrowck-while-break.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `v` --> $DIR/borrowck-while-break.rs:7:20 | -LL | println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v` +LL | println!("{}", v); | ^ use of possibly uninitialized `v` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-while-cond.stderr b/src/test/ui/borrowck/borrowck-while-cond.stderr index 2b5414b42cd0..06deae345ab6 100644 --- a/src/test/ui/borrowck/borrowck-while-cond.stderr +++ b/src/test/ui/borrowck/borrowck-while-cond.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-while-cond.rs:3:11 | -LL | while x { } //~ ERROR use of possibly uninitialized variable: `x` +LL | while x { } | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-while.stderr b/src/test/ui/borrowck/borrowck-while.stderr index e8aff0d22c2c..60622d648dd2 100644 --- a/src/test/ui/borrowck/borrowck-while.stderr +++ b/src/test/ui/borrowck/borrowck-while.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-while.rs:4:12 | -LL | return x; //~ ERROR use of possibly uninitialized variable: `x` +LL | return x; | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/index-mut-help-with-impl.stderr b/src/test/ui/borrowck/index-mut-help-with-impl.stderr index 260ef7c92d0f..6e6efc670610 100644 --- a/src/test/ui/borrowck/index-mut-help-with-impl.stderr +++ b/src/test/ui/borrowck/index-mut-help-with-impl.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/index-mut-help-with-impl.rs:9:5 | -LL | Index::index(&v, 1..2).make_ascii_uppercase(); //~ ERROR +LL | Index::index(&v, 1..2).make_ascii_uppercase(); | ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/index-mut-help.stderr b/src/test/ui/borrowck/index-mut-help.stderr index 985fa9f0361e..434dd11eea2e 100644 --- a/src/test/ui/borrowck/index-mut-help.stderr +++ b/src/test/ui/borrowck/index-mut-help.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable indexed content as mutable --> $DIR/index-mut-help.rs:11:5 | -LL | map["peter"].clear(); //~ ERROR +LL | map["peter"].clear(); | ^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` @@ -9,7 +9,7 @@ LL | map["peter"].clear(); //~ ERROR error[E0594]: cannot assign to immutable indexed content --> $DIR/index-mut-help.rs:12:5 | -LL | map["peter"] = "0".to_string(); //~ ERROR +LL | map["peter"] = "0".to_string(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` @@ -17,7 +17,7 @@ LL | map["peter"] = "0".to_string(); //~ ERROR error[E0596]: cannot borrow immutable indexed content as mutable --> $DIR/index-mut-help.rs:13:18 | -LL | let _ = &mut map["peter"]; //~ ERROR +LL | let _ = &mut map["peter"]; | ^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` diff --git a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr index 219a1fd2e772..b09028e6c7c4 100644 --- a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr +++ b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of thread-local static item --> $DIR/issue-47215-ice-from-drop-elab.rs:17:21 | -LL | let mut x = X; //~ ERROR cannot move out of thread-local static item [E0507] +LL | let mut x = X; | ^ | | | cannot move out of thread-local static item diff --git a/src/test/ui/borrowck/issue-51117.stderr b/src/test/ui/borrowck/issue-51117.stderr index 783ba8df1a6e..8f2a78672c6e 100644 --- a/src/test/ui/borrowck/issue-51117.stderr +++ b/src/test/ui/borrowck/issue-51117.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `*bar` as mutable more than once at a time | LL | Some(baz) => { | --- first mutable borrow occurs here -LL | bar.take(); //~ ERROR cannot borrow +LL | bar.take(); | ^^^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/issue-52713-bug.stderr b/src/test/ui/borrowck/issue-52713-bug.stderr index 4e6d0d45bf08..e3216f5d33f9 100644 --- a/src/test/ui/borrowck/issue-52713-bug.stderr +++ b/src/test/ui/borrowck/issue-52713-bug.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let y = &x; | -- borrow of `x` occurs here ... -LL | x += 1; //~ ERROR +LL | x += 1; | ^^^^^^ assignment to borrowed `x` occurs here LL | println!("{}", y); | - borrow later used here diff --git a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr index d1d7d13088bc..6a12016b2a5e 100644 --- a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr +++ b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:16:13 | -LL | *array //~ ERROR cannot move out of borrowed content +LL | *array | ^^^^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/borrowck/issue-7573.stderr b/src/test/ui/borrowck/issue-7573.stderr index fed79ef4f559..32b3ef72d8bd 100644 --- a/src/test/ui/borrowck/issue-7573.stderr +++ b/src/test/ui/borrowck/issue-7573.stderr @@ -3,7 +3,7 @@ error: borrowed data cannot be stored outside of its closure | LL | let mut lines_to_use: Vec<&CrateId> = Vec::new(); | - cannot infer an appropriate lifetime... -LL | //~^ NOTE cannot infer an appropriate lifetime +LL | LL | let push_id = |installed_id: &CrateId| { | ------- ------------------------ borrowed data cannot outlive this closure | | diff --git a/src/test/ui/borrowck/mut-borrow-in-loop.stderr b/src/test/ui/borrowck/mut-borrow-in-loop.stderr index 749e0e172f77..478d586d03e5 100644 --- a/src/test/ui/borrowck/mut-borrow-in-loop.stderr +++ b/src/test/ui/borrowck/mut-borrow-in-loop.stderr @@ -1,7 +1,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time --> $DIR/mut-borrow-in-loop.rs:10:25 | -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ^^^ mutable borrow starts here in previous iteration of loop LL | } LL | } @@ -10,7 +10,7 @@ LL | } error[E0499]: cannot borrow `*arg` as mutable more than once at a time --> $DIR/mut-borrow-in-loop.rs:16:25 | -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ^^^ mutable borrow starts here in previous iteration of loop LL | } LL | } @@ -19,7 +19,7 @@ LL | } error[E0499]: cannot borrow `*arg` as mutable more than once at a time --> $DIR/mut-borrow-in-loop.rs:23:25 | -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ^^^ mutable borrow starts here in previous iteration of loop LL | } LL | } diff --git a/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr b/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr index 5278056ac0f5..4653c353cad6 100644 --- a/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr +++ b/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr @@ -1,11 +1,11 @@ error[E0596]: cannot borrow immutable argument `b` as mutable --> $DIR/mut-borrow-of-mut-ref.rs:8:12 | -LL | g(&mut b) //~ ERROR cannot borrow +LL | g(&mut b) | ^ cannot borrow mutably help: consider removing the `&mut`, as it is an immutable binding to a mutable reference | -LL | g(b) //~ ERROR cannot borrow +LL | g(b) | ^ error: aborting due to previous error diff --git a/src/test/ui/borrowck/mut-borrow-outside-loop.stderr b/src/test/ui/borrowck/mut-borrow-outside-loop.stderr index 1b32d8589b52..45db962fbd01 100644 --- a/src/test/ui/borrowck/mut-borrow-outside-loop.stderr +++ b/src/test/ui/borrowck/mut-borrow-outside-loop.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `void` as mutable more than once at a time | LL | let first = &mut void; | ---- first mutable borrow occurs here -LL | let second = &mut void; //~ ERROR cannot borrow +LL | let second = &mut void; | ^^^^ second mutable borrow occurs here ... LL | } @@ -14,7 +14,7 @@ error[E0499]: cannot borrow `inner_void` as mutable more than once at a time | LL | let inner_first = &mut inner_void; | ---------- first mutable borrow occurs here -LL | let inner_second = &mut inner_void; //~ ERROR cannot borrow +LL | let inner_second = &mut inner_void; | ^^^^^^^^^^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/mutability-errors.stderr b/src/test/ui/borrowck/mutability-errors.stderr index b7fd6ee7214f..cf4f37edde0b 100644 --- a/src/test/ui/borrowck/mutability-errors.stderr +++ b/src/test/ui/borrowck/mutability-errors.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to immutable borrowed content `*x` | LL | fn named_ref(x: &(i32,)) { | ------- use `&mut (i32,)` here to make mutable -LL | *x = (1,); //~ ERROR +LL | *x = (1,); | ^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to field `x.0` of immutable binding @@ -11,8 +11,8 @@ error[E0594]: cannot assign to field `x.0` of immutable binding | LL | fn named_ref(x: &(i32,)) { | ------- use `&mut (i32,)` here to make mutable -LL | *x = (1,); //~ ERROR -LL | x.0 = 1; //~ ERROR +LL | *x = (1,); +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -21,7 +21,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable LL | fn named_ref(x: &(i32,)) { | ------- use `&mut (i32,)` here to make mutable ... -LL | &mut *x; //~ ERROR +LL | &mut *x; | ^^ cannot borrow as mutable error[E0596]: cannot borrow field `x.0` of immutable binding as mutable @@ -30,85 +30,85 @@ error[E0596]: cannot borrow field `x.0` of immutable binding as mutable LL | fn named_ref(x: &(i32,)) { | ------- use `&mut (i32,)` here to make mutable ... -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to immutable borrowed content --> $DIR/mutability-errors.rs:16:5 | -LL | *f() = (1,); //~ ERROR +LL | *f() = (1,); | ^^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to field of immutable binding --> $DIR/mutability-errors.rs:17:5 | -LL | f().0 = 1; //~ ERROR +LL | f().0 = 1; | ^^^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/mutability-errors.rs:18:10 | -LL | &mut *f(); //~ ERROR +LL | &mut *f(); | ^^^^ cannot borrow as mutable error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/mutability-errors.rs:19:10 | -LL | &mut f().0; //~ ERROR +LL | &mut f().0; | ^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to immutable dereference of raw pointer `*x` --> $DIR/mutability-errors.rs:23:5 | -LL | *x = (1,); //~ ERROR +LL | *x = (1,); | ^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to field `x.0` of immutable binding --> $DIR/mutability-errors.rs:24:5 | -LL | (*x).0 = 1; //~ ERROR +LL | (*x).0 = 1; | ^^^^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable dereference of raw pointer `*x` as mutable --> $DIR/mutability-errors.rs:25:10 | -LL | &mut *x; //~ ERROR +LL | &mut *x; | ^^ cannot borrow as mutable error[E0596]: cannot borrow field `x.0` of immutable binding as mutable --> $DIR/mutability-errors.rs:26:10 | -LL | &mut (*x).0; //~ ERROR +LL | &mut (*x).0; | ^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to immutable dereference of raw pointer --> $DIR/mutability-errors.rs:30:5 | -LL | *f() = (1,); //~ ERROR +LL | *f() = (1,); | ^^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to field of immutable binding --> $DIR/mutability-errors.rs:31:5 | -LL | (*f()).0 = 1; //~ ERROR +LL | (*f()).0 = 1; | ^^^^^^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable dereference of raw pointer as mutable --> $DIR/mutability-errors.rs:32:10 | -LL | &mut *f(); //~ ERROR +LL | &mut *f(); | ^^^^ cannot borrow as mutable error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/mutability-errors.rs:33:10 | -LL | &mut (*f()).0; //~ ERROR +LL | &mut (*f()).0; | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure --> $DIR/mutability-errors.rs:40:9 | -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ | help: consider changing this closure to take self by mutable reference @@ -116,17 +116,17 @@ help: consider changing this closure to take self by mutable reference | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure --> $DIR/mutability-errors.rs:41:9 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ | help: consider changing this closure to take self by mutable reference @@ -134,17 +134,17 @@ help: consider changing this closure to take self by mutable reference | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure --> $DIR/mutability-errors.rs:42:14 | -LL | &mut x; //~ ERROR +LL | &mut x; | ^ | help: consider changing this closure to take self by mutable reference @@ -152,17 +152,17 @@ help: consider changing this closure to take self by mutable reference | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure --> $DIR/mutability-errors.rs:43:14 | -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^ | help: consider changing this closure to take self by mutable reference @@ -170,17 +170,17 @@ help: consider changing this closure to take self by mutable reference | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure --> $DIR/mutability-errors.rs:46:9 | -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications @@ -189,23 +189,23 @@ help: consider changing this closure to take self by mutable reference | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0594]: cannot assign to field `x.0` of immutable binding --> $DIR/mutability-errors.rs:47:9 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow captured outer variable in an `Fn` closure as mutable --> $DIR/mutability-errors.rs:48:14 | -LL | &mut x; //~ ERROR +LL | &mut x; | ^ | help: consider changing this closure to take self by mutable reference @@ -213,17 +213,17 @@ help: consider changing this closure to take self by mutable reference | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow field `x.0` of immutable binding as mutable --> $DIR/mutability-errors.rs:49:14 | -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable argument `x` as mutable @@ -231,7 +231,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn imm_local(x: (i32,)) { | - help: make this binding mutable: `mut x` -LL | &mut x; //~ ERROR +LL | &mut x; | ^ cannot borrow mutably error[E0596]: cannot borrow field `x.0` of immutable binding as mutable @@ -239,8 +239,8 @@ error[E0596]: cannot borrow field `x.0` of immutable binding as mutable | LL | fn imm_local(x: (i32,)) { | - help: make this binding mutable: `mut x` -LL | &mut x; //~ ERROR -LL | &mut x.0; //~ ERROR +LL | &mut x; +LL | &mut x.0; | ^^^ cannot mutably borrow field of immutable binding error[E0595]: closure cannot assign to immutable argument `x` @@ -248,7 +248,7 @@ error[E0595]: closure cannot assign to immutable argument `x` | LL | fn imm_capture(x: (i32,)) { | - help: make this binding mutable: `mut x` -LL | || { //~ ERROR +LL | || { | ^^ cannot borrow mutably error[E0594]: cannot assign to captured outer variable in an `FnMut` closure @@ -257,49 +257,49 @@ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure LL | fn imm_capture(x: (i32,)) { | - help: consider making `x` mutable: `mut x` ... -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ error[E0594]: cannot assign to field `x.0` of immutable binding --> $DIR/mutability-errors.rs:67:9 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable --> $DIR/mutability-errors.rs:68:14 | -LL | &mut x; //~ ERROR +LL | &mut x; | ^ error[E0596]: cannot borrow field `x.0` of immutable binding as mutable --> $DIR/mutability-errors.rs:69:14 | -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to immutable static item --> $DIR/mutability-errors.rs:76:5 | -LL | X = (1,); //~ ERROR +LL | X = (1,); | ^^^^^^^^ error[E0594]: cannot assign to field of immutable binding --> $DIR/mutability-errors.rs:77:5 | -LL | X.0 = 1; //~ ERROR +LL | X.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable static item as mutable --> $DIR/mutability-errors.rs:78:10 | -LL | &mut X; //~ ERROR +LL | &mut X; | ^ error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/mutability-errors.rs:79:10 | -LL | &mut X.0; //~ ERROR +LL | &mut X.0; | ^^^ cannot mutably borrow field of immutable binding error: aborting due to 35 previous errors diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr index 51e47fd44d90..ae68df72aa7a 100644 --- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr +++ b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/promote-ref-mut-in-let-issue-46557.rs:5:9 | -LL | let ref mut x = 1234543; //~ ERROR +LL | let ref mut x = 1234543; | ^^^^^^^^^ temporary value does not live long enough LL | x LL | } @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promote-ref-mut-in-let-issue-46557.rs:10:10 | -LL | let (ref mut x, ) = (1234543, ); //~ ERROR +LL | let (ref mut x, ) = (1234543, ); | ^^^^^^^^^ borrowed value does not live long enough LL | x LL | } @@ -23,7 +23,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promote-ref-mut-in-let-issue-46557.rs:16:9 | -LL | ref mut x => x //~ ERROR +LL | ref mut x => x | ^^^^^^^^^ temporary value does not live long enough LL | } LL | } @@ -34,7 +34,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promote-ref-mut-in-let-issue-46557.rs:22:10 | -LL | (ref mut x,) => x, //~ ERROR +LL | (ref mut x,) => x, | ^^^^^^^^^ borrowed value does not live long enough LL | } LL | } @@ -45,7 +45,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promote-ref-mut-in-let-issue-46557.rs:27:10 | -LL | &mut 1234543 //~ ERROR +LL | &mut 1234543 | ^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.stderr index c63f56702ab6..74f0217ef8a9 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to field `x.0` of immutable binding | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.1` of immutable binding @@ -11,20 +11,20 @@ error[E0594]: cannot assign to field `x.1` of immutable binding | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` -LL | x.0 = 1; //~ ERROR -LL | x.1 = 22; //~ ERROR +LL | x.0 = 1; +LL | x.1 = 22; | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0381]: use of possibly uninitialized variable: `x.0` --> $DIR/reassignment_immutable_fields.rs:9:10 | -LL | drop(x.0); //~ ERROR +LL | drop(x.0); | ^^^ use of possibly uninitialized `x.0` error[E0381]: use of possibly uninitialized variable: `x.1` --> $DIR/reassignment_immutable_fields.rs:10:10 | -LL | drop(x.1); //~ ERROR +LL | drop(x.1); | ^^^ use of possibly uninitialized `x.1` error[E0594]: cannot assign to field `x.0` of immutable binding @@ -32,7 +32,7 @@ error[E0594]: cannot assign to field `x.0` of immutable binding | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.1` of immutable binding @@ -40,14 +40,14 @@ error[E0594]: cannot assign to field `x.1` of immutable binding | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` -LL | x.0 = 1; //~ ERROR -LL | x.1 = 22; //~ ERROR +LL | x.0 = 1; +LL | x.1 = 22; | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields.rs:17:10 | -LL | drop(x); //~ ERROR +LL | drop(x); | ^ use of possibly uninitialized `x` error: aborting due to 7 previous errors diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr index e34024736c6a..673c1572ca5f 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to field `x.a` of immutable binding | LL | let x: Foo; | - help: make this binding mutable: `mut x` -LL | x.a = 1; //~ ERROR +LL | x.a = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.b` of immutable binding @@ -11,8 +11,8 @@ error[E0594]: cannot assign to field `x.b` of immutable binding | LL | let x: Foo; | - help: make this binding mutable: `mut x` -LL | x.a = 1; //~ ERROR -LL | x.b = 22; //~ ERROR +LL | x.a = 1; +LL | x.b = 22; | ^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr index 75d7f99ed0c8..db1c74d94afb 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr @@ -4,7 +4,7 @@ error[E0594]: cannot assign to field `x.0` of immutable binding LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` LL | x = (22, 44); -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.0` of immutable binding @@ -12,7 +12,7 @@ error[E0594]: cannot assign to field `x.0` of immutable binding | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.0` of immutable binding @@ -20,8 +20,8 @@ error[E0594]: cannot assign to field `x.0` of immutable binding | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` -LL | x.0 = 1; //~ ERROR -LL | x.0 = 22; //~ ERROR +LL | x.0 = 1; +LL | x.0 = 22; | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.1` of immutable binding @@ -30,7 +30,7 @@ error[E0594]: cannot assign to field `x.1` of immutable binding LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` ... -LL | x.1 = 44; //~ ERROR +LL | x.1 = 44; | ^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to 4 previous errors diff --git a/src/test/ui/borrowck/two-phase-across-loop.stderr b/src/test/ui/borrowck/two-phase-across-loop.stderr index 10ff0ca604c5..933d3eb71117 100644 --- a/src/test/ui/borrowck/two-phase-across-loop.stderr +++ b/src/test/ui/borrowck/two-phase-across-loop.stderr @@ -1,7 +1,7 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time --> $DIR/two-phase-across-loop.rs:19:22 | -LL | strings.push(foo.get_string()); //~ ERROR cannot borrow `foo` as mutable +LL | strings.push(foo.get_string()); | ^^^ mutable borrow starts here in previous iteration of loop error: aborting due to previous error diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr index ad4636a4a91c..bcd743f47c53 100644 --- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr +++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr @@ -1,7 +1,7 @@ error: compilation successful --> $DIR/two-phase-reservation-sharing-interference-2.rs:17:1 | -LL | / fn main() { //~ ERROR compilation successful +LL | / fn main() { LL | | let mut v = vec![0, 1, 2]; LL | | let shared = &v; LL | | diff --git a/src/test/ui/bounds-lifetime.stderr b/src/test/ui/bounds-lifetime.stderr index d57cb40b2a84..21a781462674 100644 --- a/src/test/ui/bounds-lifetime.stderr +++ b/src/test/ui/bounds-lifetime.stderr @@ -1,31 +1,31 @@ error: lifetime bounds cannot be used in this context --> $DIR/bounds-lifetime.rs:1:22 | -LL | type A = for<'b, 'a: 'b> fn(); //~ ERROR lifetime bounds cannot be used in this context +LL | type A = for<'b, 'a: 'b> fn(); | ^^ error: lifetime bounds cannot be used in this context --> $DIR/bounds-lifetime.rs:2:22 | -LL | type B = for<'b, 'a: 'b,> fn(); //~ ERROR lifetime bounds cannot be used in this context +LL | type B = for<'b, 'a: 'b,> fn(); | ^^ error: lifetime bounds cannot be used in this context --> $DIR/bounds-lifetime.rs:3:22 | -LL | type C = for<'b, 'a: 'b +> fn(); //~ ERROR lifetime bounds cannot be used in this context +LL | type C = for<'b, 'a: 'b +> fn(); | ^^ error: only lifetime parameters can be used in this context --> $DIR/bounds-lifetime.rs:4:18 | -LL | type D = for<'a, T> fn(); //~ ERROR only lifetime parameters can be used in this context +LL | type D = for<'a, T> fn(); | ^ error: only lifetime parameters can be used in this context --> $DIR/bounds-lifetime.rs:5:14 | -LL | type E = for Fn(); //~ ERROR only lifetime parameters can be used in this context +LL | type E = for Fn(); | ^ error: aborting due to 5 previous errors diff --git a/src/test/ui/break-outside-loop.stderr b/src/test/ui/break-outside-loop.stderr index 5e008a064772..c1aa580f89ed 100644 --- a/src/test/ui/break-outside-loop.stderr +++ b/src/test/ui/break-outside-loop.stderr @@ -1,31 +1,31 @@ error[E0268]: `break` outside of loop --> $DIR/break-outside-loop.rs:10:15 | -LL | let pth = break; //~ ERROR: `break` outside of loop +LL | let pth = break; | ^^^^^ cannot break outside of a loop error[E0268]: `continue` outside of loop --> $DIR/break-outside-loop.rs:11:17 | -LL | if cond() { continue } //~ ERROR: `continue` outside of loop +LL | if cond() { continue } | ^^^^^^^^ cannot break outside of a loop error[E0267]: `break` inside of a closure --> $DIR/break-outside-loop.rs:17:25 | -LL | if cond() { break } //~ ERROR: `break` inside of a closure +LL | if cond() { break } | ^^^^^ cannot break inside of a closure error[E0267]: `continue` inside of a closure --> $DIR/break-outside-loop.rs:18:25 | -LL | if cond() { continue } //~ ERROR: `continue` inside of a closure +LL | if cond() { continue } | ^^^^^^^^ cannot break inside of a closure error[E0268]: `break` outside of loop --> $DIR/break-outside-loop.rs:24:25 | -LL | let unconstrained = break; //~ ERROR: `break` outside of loop +LL | let unconstrained = break; | ^^^^^ cannot break outside of a loop error: aborting due to 5 previous errors diff --git a/src/test/ui/break-while-condition.stderr b/src/test/ui/break-while-condition.stderr index 3e81753a4105..a08edee07ea0 100644 --- a/src/test/ui/break-while-condition.stderr +++ b/src/test/ui/break-while-condition.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/break-while-condition.rs:9:20 | -LL | let _: ! = { //~ ERROR mismatched types +LL | let _: ! = { | ____________________^ LL | | 'a: while break 'a {}; LL | | }; @@ -13,7 +13,7 @@ LL | | }; error[E0308]: mismatched types --> $DIR/break-while-condition.rs:16:13 | -LL | / while false { //~ ERROR mismatched types +LL | / while false { LL | | break LL | | } | |_____________^ expected !, found () @@ -24,7 +24,7 @@ LL | | } error[E0308]: mismatched types --> $DIR/break-while-condition.rs:24:13 | -LL | / while false { //~ ERROR mismatched types +LL | / while false { LL | | return LL | | } | |_____________^ expected !, found () diff --git a/src/test/ui/by-move-pattern-binding.stderr b/src/test/ui/by-move-pattern-binding.stderr index d3c5e2caa429..5135e0dadaf9 100644 --- a/src/test/ui/by-move-pattern-binding.stderr +++ b/src/test/ui/by-move-pattern-binding.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/by-move-pattern-binding.rs:16:9 | -LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move +LL | &E::Bar(identifier) => f(identifier.clone()) | ^^^^^^^^----------^ | | | | | hint: to prevent move, use `ref identifier` or `ref mut identifier` diff --git a/src/test/ui/c-variadic/variadic-ffi-1.stderr b/src/test/ui/c-variadic/variadic-ffi-1.stderr index 61d55ce0d3ef..1a2bb4419b58 100644 --- a/src/test/ui/c-variadic/variadic-ffi-1.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-1.stderr @@ -1,7 +1,7 @@ error[E0045]: C-variadic function must have C or cdecl calling convention --> $DIR/variadic-ffi-1.rs:5:5 | -LL | fn printf(_: *const u8, ...); //~ ERROR: variadic function must have C or cdecl calling +LL | fn printf(_: *const u8, ...); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention error: aborting due to previous error diff --git a/src/test/ui/c-variadic/variadic-ffi-3.stderr b/src/test/ui/c-variadic/variadic-ffi-3.stderr index 82e3c6cd06fc..6e19fc126210 100644 --- a/src/test/ui/c-variadic/variadic-ffi-3.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-3.stderr @@ -4,7 +4,7 @@ error[E0060]: this function takes at least 2 parameters but 0 parameters were su LL | fn foo(f: isize, x: u8, ...); | ----------------------------- defined here ... -LL | foo(); //~ ERROR: this function takes at least 2 parameters but 0 parameters were supplied +LL | foo(); | ^^^^^ expected at least 2 parameters error[E0060]: this function takes at least 2 parameters but 1 parameter was supplied @@ -13,7 +13,7 @@ error[E0060]: this function takes at least 2 parameters but 1 parameter was supp LL | fn foo(f: isize, x: u8, ...); | ----------------------------- defined here ... -LL | foo(1); //~ ERROR: this function takes at least 2 parameters but 1 parameter was supplied +LL | foo(1); | ^^^^^^ expected at least 2 parameters error[E0308]: mismatched types @@ -37,37 +37,37 @@ LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; error[E0617]: can't pass `f32` to variadic function --> $DIR/variadic-ffi-3.rs:22:19 | -LL | foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function +LL | foo(1, 2, 3f32); | ^^^^ help: cast the value to `c_double`: `3f32 as c_double` error[E0617]: can't pass `bool` to variadic function --> $DIR/variadic-ffi-3.rs:23:19 | -LL | foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function +LL | foo(1, 2, true); | ^^^^ help: cast the value to `c_int`: `true as c_int` error[E0617]: can't pass `i8` to variadic function --> $DIR/variadic-ffi-3.rs:24:19 | -LL | foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function +LL | foo(1, 2, 1i8); | ^^^ help: cast the value to `c_int`: `1i8 as c_int` error[E0617]: can't pass `u8` to variadic function --> $DIR/variadic-ffi-3.rs:25:19 | -LL | foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function +LL | foo(1, 2, 1u8); | ^^^ help: cast the value to `c_uint`: `1u8 as c_uint` error[E0617]: can't pass `i16` to variadic function --> $DIR/variadic-ffi-3.rs:26:19 | -LL | foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function +LL | foo(1, 2, 1i16); | ^^^^ help: cast the value to `c_int`: `1i16 as c_int` error[E0617]: can't pass `u16` to variadic function --> $DIR/variadic-ffi-3.rs:27:19 | -LL | foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function +LL | foo(1, 2, 1u16); | ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint` error: aborting due to 10 previous errors diff --git a/src/test/ui/c-variadic/variadic-ffi-4.stderr b/src/test/ui/c-variadic/variadic-ffi-4.stderr index 1d752be065c4..a3e3f81b73d8 100644 --- a/src/test/ui/c-variadic/variadic-ffi-4.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-4.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `ap` | LL | pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> { | --- help: add explicit lifetime `'a` to the type of `ap`: `core::ffi::VaList<'a>` -LL | ap //~ ERROR: explicit lifetime required +LL | ap | ^^ lifetime `'a` required error[E0621]: explicit lifetime required in the type of `ap` @@ -11,19 +11,19 @@ error[E0621]: explicit lifetime required in the type of `ap` | LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> { | --- help: add explicit lifetime `'static` to the type of `ap`: `core::ffi::VaList<'static>` -LL | ap //~ ERROR: explicit lifetime required +LL | ap | ^^ lifetime `'static` required error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/variadic-ffi-4.rs:16:28 | -LL | let _ = ap.copy(|ap| { ap }); //~ ERROR: cannot infer an appropriate lifetime +LL | let _ = ap.copy(|ap| { ap }); | ^^ | note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 16:21... --> $DIR/variadic-ffi-4.rs:16:21 | -LL | let _ = ap.copy(|ap| { ap }); //~ ERROR: cannot infer an appropriate lifetime +LL | let _ = ap.copy(|ap| { ap }); | ^^^^^^^^^^^ = note: ...so that the expression is assignable: expected core::ffi::VaList<'_> @@ -31,18 +31,18 @@ LL | let _ = ap.copy(|ap| { ap }); //~ ERROR: cannot infer an appropriate li note: but, the lifetime must be valid for the method call at 16:13... --> $DIR/variadic-ffi-4.rs:16:13 | -LL | let _ = ap.copy(|ap| { ap }); //~ ERROR: cannot infer an appropriate lifetime +LL | let _ = ap.copy(|ap| { ap }); | ^^^^^^^^^^^^^^^^^^^^ note: ...so type `core::ffi::VaList<'_>` of expression is valid during the expression --> $DIR/variadic-ffi-4.rs:16:13 | -LL | let _ = ap.copy(|ap| { ap }); //~ ERROR: cannot infer an appropriate lifetime +LL | let _ = ap.copy(|ap| { ap }); | ^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/variadic-ffi-4.rs:20:12 | -LL | *ap0 = ap1; //~ ERROR: mismatched types +LL | *ap0 = ap1; | ^^^ lifetime mismatch | = note: expected type `core::ffi::VaList<'_>` @@ -51,14 +51,14 @@ note: the anonymous lifetime #3 defined on the function body at 19:1... --> $DIR/variadic-ffi-4.rs:19:1 | LL | / pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) { -LL | | *ap0 = ap1; //~ ERROR: mismatched types +LL | | *ap0 = ap1; LL | | } | |_^ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the function body at 19:1 --> $DIR/variadic-ffi-4.rs:19:1 | LL | / pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) { -LL | | *ap0 = ap1; //~ ERROR: mismatched types +LL | | *ap0 = ap1; LL | | } | |_^ @@ -73,10 +73,10 @@ note: the type is valid for the anonymous lifetime #1 defined on the function bo | LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { LL | | ap0 = &mut ap1; -LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long -LL | | //~^^ ERROR: mismatched types -LL | | //~^^^ ERROR: mismatched types -LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | +LL | | +LL | | +LL | | LL | | } | |_^ note: but the borrow lasts for the anonymous lifetime #3 defined on the function body at 23:1 @@ -84,10 +84,10 @@ note: but the borrow lasts for the anonymous lifetime #3 defined on the function | LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { LL | | ap0 = &mut ap1; -LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long -LL | | //~^^ ERROR: mismatched types -LL | | //~^^^ ERROR: mismatched types -LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | +LL | | +LL | | +LL | | LL | | } | |_^ @@ -104,10 +104,10 @@ note: the anonymous lifetime #3 defined on the function body at 23:1... | LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { LL | | ap0 = &mut ap1; -LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long -LL | | //~^^ ERROR: mismatched types -LL | | //~^^^ ERROR: mismatched types -LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | +LL | | +LL | | +LL | | LL | | } | |_^ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the function body at 23:1 @@ -115,10 +115,10 @@ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the f | LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { LL | | ap0 = &mut ap1; -LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long -LL | | //~^^ ERROR: mismatched types -LL | | //~^^^ ERROR: mismatched types -LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | +LL | | +LL | | +LL | | LL | | } | |_^ @@ -135,10 +135,10 @@ note: the anonymous lifetime #2 defined on the function body at 23:1... | LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { LL | | ap0 = &mut ap1; -LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long -LL | | //~^^ ERROR: mismatched types -LL | | //~^^^ ERROR: mismatched types -LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | +LL | | +LL | | +LL | | LL | | } | |_^ note: ...does not necessarily outlive the anonymous lifetime #3 defined on the function body at 23:1 @@ -146,10 +146,10 @@ note: ...does not necessarily outlive the anonymous lifetime #3 defined on the f | LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { LL | | ap0 = &mut ap1; -LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long -LL | | //~^^ ERROR: mismatched types -LL | | //~^^^ ERROR: mismatched types -LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | +LL | | +LL | | +LL | | LL | | } | |_^ @@ -164,10 +164,10 @@ note: first, the lifetime cannot outlive the anonymous lifetime #3 defined on th | LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { LL | | ap0 = &mut ap1; -LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long -LL | | //~^^ ERROR: mismatched types -LL | | //~^^^ ERROR: mismatched types -LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | +LL | | +LL | | +LL | | LL | | } | |_^ note: ...so that the type `core::ffi::VaList<'_>` is not borrowed for too long @@ -180,10 +180,10 @@ note: but, the lifetime must be valid for the anonymous lifetime #1 defined on t | LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { LL | | ap0 = &mut ap1; -LL | | //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long -LL | | //~^^ ERROR: mismatched types -LL | | //~^^^ ERROR: mismatched types -LL | | //~^^^^ ERROR: cannot infer an appropriate lifetime +LL | | +LL | | +LL | | +LL | | LL | | } | |_^ note: ...so that reference does not outlive borrowed content diff --git a/src/test/ui/c-variadic/variadic-ffi-5.stderr b/src/test/ui/c-variadic/variadic-ffi-5.stderr index 2d452872baf4..2ad1964b6fc7 100644 --- a/src/test/ui/c-variadic/variadic-ffi-5.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-5.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `ap` | LL | pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> { | --- help: add explicit lifetime `'a` to the type of `ap`: `core::ffi::VaList<'a>` -LL | ap //~ ERROR: explicit lifetime required +LL | ap | ^^ lifetime `'a` required error[E0621]: explicit lifetime required in the type of `ap` @@ -11,13 +11,13 @@ error[E0621]: explicit lifetime required in the type of `ap` | LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> { | --- help: add explicit lifetime `'static` to the type of `ap`: `core::ffi::VaList<'static>` -LL | ap //~ ERROR: explicit lifetime required +LL | ap | ^^ lifetime `'static` required error: lifetime may not live long enough --> $DIR/variadic-ffi-5.rs:19:28 | -LL | let _ = ap.copy(|ap| { ap }); //~ ERROR: lifetime may not live long enough +LL | let _ = ap.copy(|ap| { ap }); | --- ^^ returning this value requires that `'1` must outlive `'2` | | | | | return type of closure is core::ffi::VaList<'2> @@ -30,7 +30,7 @@ LL | pub unsafe extern "C" fn no_escape3(_: usize, ap0: &mut VaList, mut ap1: .. | --- ------- has type `core::ffi::VaList<'1>` | | | has type `&mut core::ffi::VaList<'2>` -LL | *ap0 = ap1; //~ ERROR: lifetime may not live long enough +LL | *ap0 = ap1; | ^^^^^^^^^^ assignment requires that `'1` must outlive `'2` error: lifetime may not live long enough diff --git a/src/test/ui/c-variadic/variadic-ffi-6.stderr b/src/test/ui/c-variadic/variadic-ffi-6.stderr index 76bd18959a51..882e7f89f2a0 100644 --- a/src/test/ui/c-variadic/variadic-ffi-6.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-6.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/variadic-ffi-6.rs:7:6 | -LL | ) -> &usize { //~ ERROR missing lifetime specifier +LL | ) -> &usize { | ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static` | = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments diff --git a/src/test/ui/call-fn-never-arg-wrong-type.stderr b/src/test/ui/call-fn-never-arg-wrong-type.stderr index 602963ee89cd..7a50fd367d2d 100644 --- a/src/test/ui/call-fn-never-arg-wrong-type.stderr +++ b/src/test/ui/call-fn-never-arg-wrong-type.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/call-fn-never-arg-wrong-type.rs:10:9 | -LL | foo("wow"); //~ ERROR mismatched types +LL | foo("wow"); | ^^^^^ expected !, found reference | = note: expected type `!` diff --git a/src/test/ui/can-begin-expr-check.stderr b/src/test/ui/can-begin-expr-check.stderr index f25b348816b6..676c2cb661e7 100644 --- a/src/test/ui/can-begin-expr-check.stderr +++ b/src/test/ui/can-begin-expr-check.stderr @@ -1,7 +1,7 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `enum` --> $DIR/can-begin-expr-check.rs:19:12 | -LL | return enum; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `enum` +LL | return enum; | ^^^^ expected one of `.`, `;`, `?`, `}`, or an operator here error: aborting due to previous error diff --git a/src/test/ui/cast/cast-as-bool.stderr b/src/test/ui/cast/cast-as-bool.stderr index 6099a4195b32..30f8459c2e1e 100644 --- a/src/test/ui/cast/cast-as-bool.stderr +++ b/src/test/ui/cast/cast-as-bool.stderr @@ -1,19 +1,19 @@ error[E0054]: cannot cast as `bool` --> $DIR/cast-as-bool.rs:2:13 | -LL | let u = 5 as bool; //~ ERROR cannot cast as `bool` +LL | let u = 5 as bool; | ^^^^^^^^^ help: compare with zero instead: `5 != 0` error[E0054]: cannot cast as `bool` --> $DIR/cast-as-bool.rs:5:13 | -LL | let t = (1 + 2) as bool; //~ ERROR cannot cast as `bool` +LL | let t = (1 + 2) as bool; | ^^^^^^^^^^^^^^^ help: compare with zero instead: `(1 + 2) != 0` error[E0054]: cannot cast as `bool` --> $DIR/cast-as-bool.rs:8:13 | -LL | let v = "hello" as bool; //~ ERROR cannot cast as `bool` +LL | let v = "hello" as bool; | ^^^^^^^^^^^^^^^ unsupported cast error: aborting due to 3 previous errors diff --git a/src/test/ui/cast/cast-errors-issue-43825.stderr b/src/test/ui/cast/cast-errors-issue-43825.stderr index cfd1ca25a96a..1e77f5dbdc64 100644 --- a/src/test/ui/cast/cast-errors-issue-43825.stderr +++ b/src/test/ui/cast/cast-errors-issue-43825.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `error` in this scope --> $DIR/cast-errors-issue-43825.rs:2:17 | -LL | let error = error; //~ ERROR cannot find value `error` +LL | let error = error; | ^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/cast/cast-ptr-to-int-const.stderr b/src/test/ui/cast/cast-ptr-to-int-const.stderr index d04595ee4e88..0d4397c2e2d7 100644 --- a/src/test/ui/cast/cast-ptr-to-int-const.stderr +++ b/src/test/ui/cast/cast-ptr-to-int-const.stderr @@ -1,7 +1,7 @@ error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) --> $DIR/cast-ptr-to-int-const.rs:5:9 | -LL | main as u32 //~ ERROR casting pointers to integers in constants is unstable +LL | main as u32 | ^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | main as u32 //~ ERROR casting pointers to integers in constants is error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) --> $DIR/cast-ptr-to-int-const.rs:9:9 | -LL | &Y as *const u32 as u32 //~ ERROR is unstable +LL | &Y as *const u32 as u32 | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable diff --git a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr index 37c6ba1b909c..bd7a0e1834aa 100644 --- a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr +++ b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr @@ -1,7 +1,7 @@ error[E0620]: cast to unsized type: `&{integer}` as `dyn std::marker::Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:2:5 | -LL | &1 as Send; //~ ERROR cast to unsized +LL | &1 as Send; | ^^^^^^---- | | | help: try casting to a reference instead: `&Send` @@ -9,7 +9,7 @@ LL | &1 as Send; //~ ERROR cast to unsized error[E0620]: cast to unsized type: `std::boxed::Box<{integer}>` as `dyn std::marker::Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:3:5 | -LL | Box::new(1) as Send; //~ ERROR cast to unsized +LL | Box::new(1) as Send; | ^^^^^^^^^^^^^^^---- | | | help: try casting to a `Box` instead: `Box` diff --git a/src/test/ui/casts-differing-anon.stderr b/src/test/ui/casts-differing-anon.stderr index 8e09a7cd83b5..fbbb8e3bb332 100644 --- a/src/test/ui/casts-differing-anon.stderr +++ b/src/test/ui/casts-differing-anon.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `*mut impl std::fmt::Debug+?Sized` as `*mut impl std::fmt::Debug+?Sized` is invalid --> $DIR/casts-differing-anon.rs:21:13 | -LL | b_raw = f_raw as *mut _; //~ ERROR is invalid +LL | b_raw = f_raw as *mut _; | ^^^^^^^^^^^^^^^ | = note: vtable kinds may not match diff --git a/src/test/ui/casts-issue-46365.stderr b/src/test/ui/casts-issue-46365.stderr index 91edfaf410ea..84175473696d 100644 --- a/src/test/ui/casts-issue-46365.stderr +++ b/src/test/ui/casts-issue-46365.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `Ipsum` in this scope --> $DIR/casts-issue-46365.rs:2:12 | -LL | ipsum: Ipsum //~ ERROR cannot find type `Ipsum` +LL | ipsum: Ipsum | ^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/chalkify/lower_env1.stderr b/src/test/ui/chalkify/lower_env1.stderr index f4d16a09a367..bc426e0707b7 100644 --- a/src/test/ui/chalkify/lower_env1.stderr +++ b/src/test/ui/chalkify/lower_env1.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_env1.rs:6:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall { FromEnv(Self: Foo) :- FromEnv(Self: Bar). } @@ -11,7 +11,7 @@ LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump error: program clause dump --> $DIR/lower_env1.rs:9:1 | -LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_env_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall { FromEnv(Self: Foo) :- FromEnv(Self: Bar). } diff --git a/src/test/ui/chalkify/lower_env2.stderr b/src/test/ui/chalkify/lower_env2.stderr index f05b91c674d9..2a71fa9df5e8 100644 --- a/src/test/ui/chalkify/lower_env2.stderr +++ b/src/test/ui/chalkify/lower_env2.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_env2.rs:6:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'a, T> { FromEnv(T: Foo) :- FromEnv(S<'a, T>). } @@ -11,7 +11,7 @@ LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump error: program clause dump --> $DIR/lower_env2.rs:11:1 | -LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_env_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'a, T> { FromEnv(T: Foo) :- FromEnv(S<'a, T>). } diff --git a/src/test/ui/chalkify/lower_env3.stderr b/src/test/ui/chalkify/lower_env3.stderr index e602a8fcdaf8..46e083686895 100644 --- a/src/test/ui/chalkify/lower_env3.stderr +++ b/src/test/ui/chalkify/lower_env3.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_env3.rs:5:5 | -LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_env_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'^0, ^1> { TypeOutlives(^1: '^0) :- FromEnv(&^1). } @@ -10,7 +10,7 @@ LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump error: program clause dump --> $DIR/lower_env3.rs:10:5 | -LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_env_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'^0, ^1> { TypeOutlives(^1: '^0) :- FromEnv(&^1). } diff --git a/src/test/ui/chalkify/lower_impl.stderr b/src/test/ui/chalkify/lower_impl.stderr index 48af37edec49..d6827fbff3dd 100644 --- a/src/test/ui/chalkify/lower_impl.stderr +++ b/src/test/ui/chalkify/lower_impl.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_impl.rs:5:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall { Implemented(T: Foo) :- ProjectionEq(::Item == i32), TypeOutlives(T: 'static), Implemented(T: std::iter::Iterator), Implemented(T: std::marker::Sized). } @@ -9,7 +9,7 @@ LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump error: program clause dump --> $DIR/lower_impl.rs:13:5 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall { Normalize(::Assoc -> std::vec::Vec) :- Implemented(T: Bar). } diff --git a/src/test/ui/chalkify/lower_struct.stderr b/src/test/ui/chalkify/lower_struct.stderr index e75e71450fbc..91525c3ba55d 100644 --- a/src/test/ui/chalkify/lower_struct.stderr +++ b/src/test/ui/chalkify/lower_struct.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_struct.rs:3:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'a, T> { FromEnv(T: std::marker::Sized) :- FromEnv(Foo<'a, T>). } diff --git a/src/test/ui/chalkify/lower_trait.stderr b/src/test/ui/chalkify/lower_trait.stderr index 4546d2ede823..423c55730830 100644 --- a/src/test/ui/chalkify/lower_trait.stderr +++ b/src/test/ui/chalkify/lower_trait.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_trait.rs:5:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall { FromEnv(>::Assoc: Bar) :- FromEnv(Self: Foo). } @@ -12,7 +12,7 @@ LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump error: program clause dump --> $DIR/lower_trait.rs:7:5 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall { ProjectionEq(>::Assoc == ^3) :- Normalize(>::Assoc -> ^3). } diff --git a/src/test/ui/chalkify/lower_trait_higher_rank.stderr b/src/test/ui/chalkify/lower_trait_higher_rank.stderr index d7e18596a7d2..79bbc9fa6b3a 100644 --- a/src/test/ui/chalkify/lower_trait_higher_rank.stderr +++ b/src/test/ui/chalkify/lower_trait_higher_rank.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_trait_higher_rank.rs:3:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'a, Self, F> { FromEnv(F: std::ops::Fn<(&'a (u8, u16),)>) :- FromEnv(Self: Foo). } diff --git a/src/test/ui/chalkify/lower_trait_where_clause.stderr b/src/test/ui/chalkify/lower_trait_where_clause.stderr index 5400224bdf42..408f3712a707 100644 --- a/src/test/ui/chalkify/lower_trait_where_clause.stderr +++ b/src/test/ui/chalkify/lower_trait_where_clause.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_trait_where_clause.rs:5:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'a, 'b, Self, T, U> { FromEnv(T: std::borrow::Borrow) :- FromEnv(Self: Foo<'a, 'b, T, U>). } diff --git a/src/test/ui/chalkify/type_inference.stderr b/src/test/ui/chalkify/type_inference.stderr index d65b701307b4..d1d56d3d4a23 100644 --- a/src/test/ui/chalkify/type_inference.stderr +++ b/src/test/ui/chalkify/type_inference.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/type_inference.rs:21:14 | -LL | only_foo(x); //~ ERROR mismatched types +LL | only_foo(x); | ^ expected i32, found floating-point number | = note: expected type `i32` @@ -10,7 +10,7 @@ LL | only_foo(x); //~ ERROR mismatched types error[E0277]: the trait bound `{float}: Bar` is not satisfied --> $DIR/type_inference.rs:25:5 | -LL | only_bar(x); //~ ERROR the trait bound `{float}: Bar` is not satisfied +LL | only_bar(x); | ^^^^^^^^ the trait `Bar` is not implemented for `{float}` | = help: the following implementations were found: diff --git a/src/test/ui/changing-crates.stderr b/src/test/ui/changing-crates.stderr index a8b986d67f87..633930904983 100644 --- a/src/test/ui/changing-crates.stderr +++ b/src/test/ui/changing-crates.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/changing-crates.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/check-static-values-constraints.stderr b/src/test/ui/check-static-values-constraints.stderr index 5b1f265c34ae..91fe0feb1bcd 100644 --- a/src/test/ui/check-static-values-constraints.stderr +++ b/src/test/ui/check-static-values-constraints.stderr @@ -3,7 +3,7 @@ error[E0493]: destructors cannot be evaluated at compile-time | LL | ..SafeStruct{field1: SafeEnum::Variant3(WithDtor), | ___________________________________________^ -LL | | //~^ ERROR destructors cannot be evaluated at compile-time +LL | | LL | | field2: SafeEnum::Variant1}}; | |________________________________________________________________________________^ statics cannot evaluate destructors @@ -28,49 +28,49 @@ LL | field2: SafeEnum::Variant4("str".to_string()) error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:95:5 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:95:9 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:97:5 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:97:9 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:102:6 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:102:10 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:104:6 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:104:10 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics diff --git a/src/test/ui/check_match/issue-35609.stderr b/src/test/ui/check_match/issue-35609.stderr index 54e5c988f8cc..af22535c55e5 100644 --- a/src/test/ui/check_match/issue-35609.stderr +++ b/src/test/ui/check_match/issue-35609.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered --> $DIR/issue-35609.rs:10:11 | -LL | match (A, ()) { //~ ERROR non-exhaustive +LL | match (A, ()) { | ^^^^^^^ patterns `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -9,7 +9,7 @@ LL | match (A, ()) { //~ ERROR non-exhaustive error[E0004]: non-exhaustive patterns: `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered --> $DIR/issue-35609.rs:14:11 | -LL | match (A, A) { //~ ERROR non-exhaustive +LL | match (A, A) { | ^^^^^^ patterns `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -17,7 +17,7 @@ LL | match (A, A) { //~ ERROR non-exhaustive error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:18:11 | -LL | match ((A, ()), ()) { //~ ERROR non-exhaustive +LL | match ((A, ()), ()) { | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -25,7 +25,7 @@ LL | match ((A, ()), ()) { //~ ERROR non-exhaustive error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:22:11 | -LL | match ((A, ()), A) { //~ ERROR non-exhaustive +LL | match ((A, ()), A) { | ^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -33,7 +33,7 @@ LL | match ((A, ()), A) { //~ ERROR non-exhaustive error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:26:11 | -LL | match ((A, ()), ()) { //~ ERROR non-exhaustive +LL | match ((A, ()), ()) { | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -44,7 +44,7 @@ error[E0004]: non-exhaustive patterns: `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 mor LL | struct S(Enum, ()); | ------------------- `S` defined here ... -LL | match S(A, ()) { //~ ERROR non-exhaustive +LL | match S(A, ()) { | ^^^^^^^^ patterns `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -55,7 +55,7 @@ error[E0004]: non-exhaustive patterns: `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd LL | struct Sd { x: Enum, y: () } | ---------------------------- `Sd` defined here ... -LL | match (Sd { x: A, y: () }) { //~ ERROR non-exhaustive +LL | match (Sd { x: A, y: () }) { | ^^^^^^^^^^^^^^^^^^^^ patterns `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -63,7 +63,7 @@ LL | match (Sd { x: A, y: () }) { //~ ERROR non-exhaustive error[E0004]: non-exhaustive patterns: `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered --> $DIR/issue-35609.rs:39:11 | -LL | match Some(A) { //~ ERROR non-exhaustive +LL | match Some(A) { | ^^^^^^^ patterns `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/class-cast-to-trait.stderr b/src/test/ui/class-cast-to-trait.stderr index f5bd7a13aa48..39f308cdfd49 100644 --- a/src/test/ui/class-cast-to-trait.stderr +++ b/src/test/ui/class-cast-to-trait.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `eat` found for type `std::boxed::Box` in the current scope --> $DIR/class-cast-to-trait.rs:53:8 | -LL | nyan.eat(); //~ ERROR no method named `eat` found +LL | nyan.eat(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/class-missing-self.stderr b/src/test/ui/class-missing-self.stderr index 484778f83ec5..ec11f1253990 100644 --- a/src/test/ui/class-missing-self.stderr +++ b/src/test/ui/class-missing-self.stderr @@ -1,13 +1,13 @@ error[E0425]: cannot find value `meows` in this scope --> $DIR/class-missing-self.rs:9:7 | -LL | meows += 1; //~ ERROR cannot find value `meows` in this scope +LL | meows += 1; | ^^^^^ help: try: `self.meows` error[E0425]: cannot find function `sleep` in this scope --> $DIR/class-missing-self.rs:10:7 | -LL | sleep(); //~ ERROR cannot find function `sleep` in this scope +LL | sleep(); | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/cleanup-rvalue-scopes-cf.stderr b/src/test/ui/cleanup-rvalue-scopes-cf.stderr index 561403d1b42d..e35e71ce6e23 100644 --- a/src/test/ui/cleanup-rvalue-scopes-cf.stderr +++ b/src/test/ui/cleanup-rvalue-scopes-cf.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:28:19 | -LL | let _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough +LL | let _x = arg(&AddFlags(1)); | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough @@ -14,7 +14,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:29:14 | -LL | let _x = AddFlags(1).get(); //~ ERROR value does not live long enough +LL | let _x = AddFlags(1).get(); | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough @@ -27,7 +27,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:30:21 | -LL | let _x = &*arg(&AddFlags(1)); //~ ERROR value does not live long enough +LL | let _x = &*arg(&AddFlags(1)); | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough @@ -40,7 +40,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:31:24 | -LL | let ref _x = *arg(&AddFlags(1)); //~ ERROR value does not live long enough +LL | let ref _x = *arg(&AddFlags(1)); | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough @@ -53,7 +53,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:32:24 | -LL | let &ref _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough +LL | let &ref _x = arg(&AddFlags(1)); | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough @@ -66,11 +66,11 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:33:14 | -LL | let _x = AddFlags(1).get(); //~ ERROR value does not live long enough +LL | let _x = AddFlags(1).get(); | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough -LL | let Box { f: _x } = Box { f: AddFlags(1).get() }; //~ ERROR value does not live long enough +LL | let Box { f: _x } = Box { f: AddFlags(1).get() }; LL | } | - temporary value needs to live until here | @@ -79,7 +79,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:34:34 | -LL | let Box { f: _x } = Box { f: AddFlags(1).get() }; //~ ERROR value does not live long enough +LL | let Box { f: _x } = Box { f: AddFlags(1).get() }; | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough diff --git a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr index 7dd996cce5d4..2005bd4dd5ca 100644 --- a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr +++ b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/expect-two-infer-vars-supply-ty-with-bound-region.rs:8:27 | -LL | with_closure(|x: u32, y| {}); //~ ERROR E0282 +LL | with_closure(|x: u32, y| {}); | ^ consider giving this closure parameter a type error: aborting due to previous error diff --git a/src/test/ui/closure_context/issue-26046-fn-mut.stderr b/src/test/ui/closure_context/issue-26046-fn-mut.stderr index bdfd26f6871a..74d3c4977ee6 100644 --- a/src/test/ui/closure_context/issue-26046-fn-mut.stderr +++ b/src/test/ui/closure_context/issue-26046-fn-mut.stderr @@ -1,7 +1,7 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut` --> $DIR/issue-26046-fn-mut.rs:4:19 | -LL | let closure = || { //~ ERROR expected a closure that +LL | let closure = || { | ^^ this closure implements `FnMut`, not `Fn` LL | num += 1; | --- closure is `FnMut` because it mutates the variable `num` here diff --git a/src/test/ui/closure_context/issue-26046-fn-once.stderr b/src/test/ui/closure_context/issue-26046-fn-once.stderr index e7bcbb9e6308..473e8e8417e6 100644 --- a/src/test/ui/closure_context/issue-26046-fn-once.stderr +++ b/src/test/ui/closure_context/issue-26046-fn-once.stderr @@ -1,7 +1,7 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` --> $DIR/issue-26046-fn-once.rs:4:19 | -LL | let closure = move || { //~ ERROR expected a closure +LL | let closure = move || { | ^^^^^^^ this closure implements `FnOnce`, not `Fn` LL | vec | --- closure is `FnOnce` because it moves the variable `vec` out of its environment diff --git a/src/test/ui/closure_promotion.stderr b/src/test/ui/closure_promotion.stderr index 7b901e301178..475e28309cfb 100644 --- a/src/test/ui/closure_promotion.stderr +++ b/src/test/ui/closure_promotion.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/closure_promotion.rs:7:26 | -LL | let x: &'static _ = &|| { let z = 3; z }; //~ ERROR does not live long enough +LL | let x: &'static _ = &|| { let z = 3; z }; | ^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/closures/closure-array-break-length.stderr b/src/test/ui/closures/closure-array-break-length.stderr index fa7a63b642e6..9b78aa16a580 100644 --- a/src/test/ui/closures/closure-array-break-length.stderr +++ b/src/test/ui/closures/closure-array-break-length.stderr @@ -1,19 +1,19 @@ error[E0268]: `continue` outside of loop --> $DIR/closure-array-break-length.rs:2:13 | -LL | |_: [_; continue]| {}; //~ ERROR: `continue` outside of loop +LL | |_: [_; continue]| {}; | ^^^^^^^^ cannot break outside of a loop error[E0268]: `continue` outside of loop --> $DIR/closure-array-break-length.rs:4:19 | -LL | while |_: [_; continue]| {} {} //~ ERROR: `continue` outside of loop +LL | while |_: [_; continue]| {} {} | ^^^^^^^^ cannot break outside of a loop error[E0268]: `break` outside of loop --> $DIR/closure-array-break-length.rs:6:19 | -LL | while |_: [_; break]| {} {} //~ ERROR: `break` outside of loop +LL | while |_: [_; break]| {} {} | ^^^^^ cannot break outside of a loop error: aborting due to 3 previous errors diff --git a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr index 7d637fed8ab6..81c4f4e00aba 100644 --- a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr +++ b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr @@ -2,7 +2,7 @@ error[E0277]: `F` cannot be sent between threads safely --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:5:1 | LL | / fn foo(blk: F) -> X where F: FnOnce() + 'static { -LL | | //~^ ERROR `F` cannot be sent between threads safely +LL | | LL | | return X { field: blk }; LL | | } | |_^ `F` cannot be sent between threads safely diff --git a/src/test/ui/closures/closure-bounds-subtype.stderr b/src/test/ui/closures/closure-bounds-subtype.stderr index d018956d026c..3b9fd10af386 100644 --- a/src/test/ui/closures/closure-bounds-subtype.stderr +++ b/src/test/ui/closures/closure-bounds-subtype.stderr @@ -1,7 +1,7 @@ error[E0277]: `F` cannot be shared between threads safely --> $DIR/closure-bounds-subtype.rs:13:5 | -LL | take_const_owned(f); //~ ERROR `F` cannot be shared between threads safely [E0277] +LL | take_const_owned(f); | ^^^^^^^^^^^^^^^^ `F` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `F` diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr index 633dd4f5c62a..e3b623d55248 100644 --- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr +++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr @@ -5,7 +5,7 @@ LL | let mut f: Option<&u32> = None; | ----- borrowed data cannot be stored into here... LL | closure_expecting_bound(|x| { | --- ...because it cannot outlive this closure -LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure +LL | f = Some(x); | ^ cannot be stored outside of its closure error: borrowed data cannot be stored outside of its closure @@ -15,7 +15,7 @@ LL | let mut f: Option<&u32> = None; | ----- borrowed data cannot be stored into here... LL | closure_expecting_bound(|x: &u32| { | --------- ...because it cannot outlive this closure -LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure +LL | f = Some(x); | ^ cannot be stored outside of its closure error[E0308]: mismatched types @@ -31,11 +31,11 @@ note: the anonymous lifetime #2 defined on the body at 37:29... | LL | closure_expecting_bound(|x: &'x u32| { | _____________________________^ -LL | | //~^ ERROR mismatched types -LL | | //~| ERROR mismatched types +LL | | +LL | | LL | | ... | -LL | | //~^ ERROR borrowed data cannot be stored outside of its closure +LL | | LL | | }); | |_____^ note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 32:30 @@ -62,11 +62,11 @@ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the b | LL | closure_expecting_bound(|x: &'x u32| { | _____________________________^ -LL | | //~^ ERROR mismatched types -LL | | //~| ERROR mismatched types +LL | | +LL | | LL | | ... | -LL | | //~^ ERROR borrowed data cannot be stored outside of its closure +LL | | LL | | }); | |_____^ diff --git a/src/test/ui/closures/closure-immutable-outer-variable.stderr b/src/test/ui/closures/closure-immutable-outer-variable.stderr index c6a6ebd931c6..332320791d44 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.stderr +++ b/src/test/ui/closures/closure-immutable-outer-variable.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure | LL | let y = true; | - help: consider making `y` mutable: `mut y` -LL | foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable +LL | foo(Box::new(move || y = false) as Box<_>); | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr b/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr index f60be43bba81..8ca43cd1cffb 100644 --- a/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr +++ b/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/closure-referencing-itself-issue-25954.rs:15:13 | -LL | let q = || p.b.set(5i32); //~ ERROR mismatched types +LL | let q = || p.b.set(5i32); | ^^^^^^^^^^^^^^^^ cyclic type of infinite size error: aborting due to previous error diff --git a/src/test/ui/closures/closure-reform-bad.stderr b/src/test/ui/closures/closure-reform-bad.stderr index 76f88d049074..5c5480912be4 100644 --- a/src/test/ui/closures/closure-reform-bad.stderr +++ b/src/test/ui/closures/closure-reform-bad.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/closure-reform-bad.rs:11:15 | -LL | call_bare(f) //~ ERROR mismatched types +LL | call_bare(f) | ^ expected fn pointer, found closure | = note: expected type `for<'r> fn(&'r str)` diff --git a/src/test/ui/closures/closure-wrong-kind.stderr b/src/test/ui/closures/closure-wrong-kind.stderr index b289ea296442..65026128ae62 100644 --- a/src/test/ui/closures/closure-wrong-kind.stderr +++ b/src/test/ui/closures/closure-wrong-kind.stderr @@ -1,7 +1,7 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` --> $DIR/closure-wrong-kind.rs:10:19 | -LL | let closure = |_| foo(x); //~ ERROR E0525 +LL | let closure = |_| foo(x); | ^^^^^^^^-^ | | | | | closure is `FnOnce` because it moves the variable `x` out of its environment diff --git a/src/test/ui/codemap_tests/bad-format-args.stderr b/src/test/ui/codemap_tests/bad-format-args.stderr index 38320416b450..c424eb08a7a9 100644 --- a/src/test/ui/codemap_tests/bad-format-args.stderr +++ b/src/test/ui/codemap_tests/bad-format-args.stderr @@ -1,7 +1,7 @@ error: requires at least a format string argument --> $DIR/bad-format-args.rs:2:5 | -LL | format!(); //~ ERROR requires at least a format string argument +LL | format!(); | ^^^^^^^^^^ | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) @@ -9,13 +9,13 @@ LL | format!(); //~ ERROR requires at least a format string argument error: expected token: `,` --> $DIR/bad-format-args.rs:3:16 | -LL | format!("" 1); //~ ERROR expected token: `,` +LL | format!("" 1); | ^ error: expected token: `,` --> $DIR/bad-format-args.rs:4:19 | -LL | format!("", 1 1); //~ ERROR expected token: `,` +LL | format!("", 1 1); | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr index 5f8bc387a3d2..087084ae5dad 100644 --- a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr +++ b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr @@ -1,7 +1,7 @@ error[E0592]: duplicate definitions with name `f` --> $DIR/coherence-overlapping-inherent-impl-trait.rs:4:10 | -LL | impl C { fn f() {} } //~ ERROR duplicate +LL | impl C { fn f() {} } | ^^^^^^^^^ duplicate definitions for `f` LL | impl C { fn f() {} } | --------- other definition for `f` diff --git a/src/test/ui/codemap_tests/empty_span.stderr b/src/test/ui/codemap_tests/empty_span.stderr index f52856770978..1dd99cfd64fa 100644 --- a/src/test/ui/codemap_tests/empty_span.stderr +++ b/src/test/ui/codemap_tests/empty_span.stderr @@ -1,7 +1,7 @@ error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static main::Foo` --> $DIR/empty_span.rs:7:5 | -LL | unsafe impl Send for &'static Foo { } //~ ERROR cross-crate traits with a default impl +LL | unsafe impl Send for &'static Foo { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.stderr b/src/test/ui/codemap_tests/huge_multispan_highlight.stderr index 41df802b503d..13bd666a5077 100644 --- a/src/test/ui/codemap_tests/huge_multispan_highlight.stderr +++ b/src/test/ui/codemap_tests/huge_multispan_highlight.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable LL | let x = "foo"; | - help: make this binding mutable: `mut x` ... -LL | let y = &mut x; //~ ERROR cannot borrow +LL | let y = &mut x; | ^ cannot borrow mutably error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/issue-11715.stderr b/src/test/ui/codemap_tests/issue-11715.stderr index 8f320a4e19b2..c37e6b34727b 100644 --- a/src/test/ui/codemap_tests/issue-11715.stderr +++ b/src/test/ui/codemap_tests/issue-11715.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | - first mutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | let z = &mut x; | ^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/codemap_tests/one_line.stderr b/src/test/ui/codemap_tests/one_line.stderr index 2ea793c09694..9dcaba8748e0 100644 --- a/src/test/ui/codemap_tests/one_line.stderr +++ b/src/test/ui/codemap_tests/one_line.stderr @@ -1,7 +1,7 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/one_line.rs:3:12 | -LL | v.push(v.pop().unwrap()); //~ ERROR cannot borrow +LL | v.push(v.pop().unwrap()); | - ^ - first borrow ends here | | | | | second mutable borrow occurs here diff --git a/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr b/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr index 1b20b699d9f8..70c1093e9ed4 100644 --- a/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr +++ b/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr @@ -1,7 +1,7 @@ error[E0592]: duplicate definitions with name `id` --> $DIR/overlapping_inherent_impls.rs:9:5 | -LL | fn id() {} //~ ERROR duplicate definitions +LL | fn id() {} | ^^^^^^^^^^ duplicate definitions for `id` ... LL | fn id() {} @@ -10,7 +10,7 @@ LL | fn id() {} error[E0592]: duplicate definitions with name `bar` --> $DIR/overlapping_inherent_impls.rs:19:5 | -LL | fn bar(&self) {} //~ ERROR duplicate definitions +LL | fn bar(&self) {} | ^^^^^^^^^^^^^^^^ duplicate definitions for `bar` ... LL | fn bar(&self) {} @@ -19,7 +19,7 @@ LL | fn bar(&self) {} error[E0592]: duplicate definitions with name `baz` --> $DIR/overlapping_inherent_impls.rs:29:5 | -LL | fn baz(&self) {} //~ ERROR duplicate definitions +LL | fn baz(&self) {} | ^^^^^^^^^^^^^^^^ duplicate definitions for `baz` ... LL | fn baz(&self) {} diff --git a/src/test/ui/codemap_tests/tab.stderr b/src/test/ui/codemap_tests/tab.stderr index 80b5773fda33..bcc21e9c7ade 100644 --- a/src/test/ui/codemap_tests/tab.stderr +++ b/src/test/ui/codemap_tests/tab.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `bar` in this scope --> $DIR/tab.rs:4:2 | -LL | bar; //~ ERROR cannot find value `bar` +LL | bar; | ^^^ not found in this scope error[E0308]: mismatched types @@ -9,7 +9,7 @@ error[E0308]: mismatched types | LL | fn foo() { | - help: try adding a return type: `-> &'static str` -LL | "bar boo" //~ ERROR mismatched types +LL | "bar boo" | ^^^^^^^^^^^^^^^^^^^^ expected (), found reference | = note: expected type `()` diff --git a/src/test/ui/codemap_tests/tab_2.stderr b/src/test/ui/codemap_tests/tab_2.stderr index f7eec3eb8da8..70414bbd953d 100644 --- a/src/test/ui/codemap_tests/tab_2.stderr +++ b/src/test/ui/codemap_tests/tab_2.stderr @@ -1,7 +1,7 @@ error: unterminated double quote string --> $DIR/tab_2.rs:4:7 | -LL | """; //~ ERROR unterminated double quote +LL | """; | ___________________^ LL | | } | |__^ diff --git a/src/test/ui/codemap_tests/tab_3.stderr b/src/test/ui/codemap_tests/tab_3.stderr index 6e93ae130696..4b550dbf9ee1 100644 --- a/src/test/ui/codemap_tests/tab_3.stderr +++ b/src/test/ui/codemap_tests/tab_3.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `some_vec` LL | some_vec.into_iter(); | -------- value moved here LL | { -LL | println!("{:?}", some_vec); //~ ERROR use of moved +LL | println!("{:?}", some_vec); | ^^^^^^^^ value used here after move | = note: move occurs because `some_vec` has type `std::vec::Vec<&str>`, which does not implement the `Copy` trait diff --git a/src/test/ui/codemap_tests/two_files.stderr b/src/test/ui/codemap_tests/two_files.stderr index 65df3f382c04..5027b78b38e3 100644 --- a/src/test/ui/codemap_tests/two_files.stderr +++ b/src/test/ui/codemap_tests/two_files.stderr @@ -1,7 +1,7 @@ error[E0404]: expected trait, found type alias `Bar` --> $DIR/two_files.rs:5:6 | -LL | impl Bar for Baz { } //~ ERROR expected trait, found type alias +LL | impl Bar for Baz { } | ^^^ type aliases cannot be used as traits | = note: did you mean to use a trait alias? diff --git a/src/test/ui/codemap_tests/unicode.stderr b/src/test/ui/codemap_tests/unicode.stderr index 1ba6ac447889..7aadeb7dfc98 100644 --- a/src/test/ui/codemap_tests/unicode.stderr +++ b/src/test/ui/codemap_tests/unicode.stderr @@ -1,7 +1,7 @@ error[E0703]: invalid ABI: found `路濫狼á́́` --> $DIR/unicode.rs:1:8 | -LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI +LL | extern "路濫狼á́́" fn foo() {} | ^^^^^^^^^ invalid ABI | = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, amdgpu-kernel, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted diff --git a/src/test/ui/codemap_tests/unicode_2.stderr b/src/test/ui/codemap_tests/unicode_2.stderr index 1bc7452b9f2d..92634d8e5f94 100644 --- a/src/test/ui/codemap_tests/unicode_2.stderr +++ b/src/test/ui/codemap_tests/unicode_2.stderr @@ -1,7 +1,7 @@ error: invalid width `7` for integer literal --> $DIR/unicode_2.rs:4:25 | -LL | let _ = ("a̐éö̲", 0u7); //~ ERROR invalid width +LL | let _ = ("a̐éö̲", 0u7); | ^^^ | = help: valid widths are 8, 16, 32, 64 and 128 @@ -9,7 +9,7 @@ LL | let _ = ("a̐éö̲", 0u7); //~ ERROR invalid width error: invalid width `42` for integer literal --> $DIR/unicode_2.rs:5:20 | -LL | let _ = ("아あ", 1i42); //~ ERROR invalid width +LL | let _ = ("아あ", 1i42); | ^^^^ | = help: valid widths are 8, 16, 32, 64 and 128 @@ -17,7 +17,7 @@ LL | let _ = ("아あ", 1i42); //~ ERROR invalid width error[E0425]: cannot find value `a̐é` in this scope --> $DIR/unicode_2.rs:6:13 | -LL | let _ = a̐é; //~ ERROR cannot find +LL | let _ = a̐é; | ^^ not found in this scope error: aborting due to 3 previous errors diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr index 5ad3889666b7..be362c9a78b9 100644 --- a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:9:13 | -LL | let _ = box { [1, 2, 3] }: Box<[i32]>; //~ ERROR mismatched types +LL | let _ = box { [1, 2, 3] }: Box<[i32]>; | ^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | = note: expected type `std::boxed::Box<[i32]>` @@ -10,7 +10,7 @@ LL | let _ = box { [1, 2, 3] }: Box<[i32]>; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:10:13 | -LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; //~ ERROR mismatched types +LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | = note: expected type `std::boxed::Box<[i32]>` @@ -28,7 +28,7 @@ LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:13:13 | -LL | let _ = box { |x| (x as u8) }: Box _>; //~ ERROR mismatched types +LL | let _ = box { |x| (x as u8) }: Box _>; | ^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `std::boxed::Box u8>` @@ -37,7 +37,7 @@ LL | let _ = box { |x| (x as u8) }: Box _>; //~ ERROR mismatched error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:14:13 | -LL | let _ = box if true { false } else { true }: Box; //~ ERROR mismatched types +LL | let _ = box if true { false } else { true }: Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool | = note: expected type `std::boxed::Box` @@ -46,7 +46,7 @@ LL | let _ = box if true { false } else { true }: Box; //~ ERROR mism error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:15:13 | -LL | let _ = box match true { true => 'a', false => 'b' }: Box; //~ ERROR mismatched types +LL | let _ = box match true { true => 'a', false => 'b' }: Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char | = note: expected type `std::boxed::Box` @@ -55,7 +55,7 @@ LL | let _ = box match true { true => 'a', false => 'b' }: Box; //~ E error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:17:13 | -LL | let _ = &{ [1, 2, 3] }: &[i32]; //~ ERROR mismatched types +LL | let _ = &{ [1, 2, 3] }: &[i32]; | ^^^^^^^^^^^^^^ expected slice, found array of 3 elements | = note: expected type `&[i32]` @@ -64,7 +64,7 @@ LL | let _ = &{ [1, 2, 3] }: &[i32]; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:18:13 | -LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; //~ ERROR mismatched types +LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | = note: expected type `&[i32]` @@ -82,7 +82,7 @@ LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:21:13 | -LL | let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; //~ ERROR mismatched types +LL | let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; | ^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `&dyn std::ops::Fn(i32) -> u8` @@ -91,7 +91,7 @@ LL | let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:22:13 | -LL | let _ = &if true { false } else { true }: &Debug; //~ ERROR mismatched types +LL | let _ = &if true { false } else { true }: &Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool | = note: expected type `&dyn std::fmt::Debug` @@ -100,7 +100,7 @@ LL | let _ = &if true { false } else { true }: &Debug; //~ ERROR mismatched error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:23:13 | -LL | let _ = &match true { true => 'a', false => 'b' }: &Debug; //~ ERROR mismatched types +LL | let _ = &match true { true => 'a', false => 'b' }: &Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char | = note: expected type `&dyn std::fmt::Debug` @@ -109,7 +109,7 @@ LL | let _ = &match true { true => 'a', false => 'b' }: &Debug; //~ ERROR mi error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:25:13 | -LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; //~ ERROR mismatched types +LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; | ^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | = note: expected type `std::boxed::Box<[i32]>` @@ -118,7 +118,7 @@ LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:26:13 | -LL | let _ = Box::new(|x| (x as u8)): Box _>; //~ ERROR mismatched types +LL | let _ = Box::new(|x| (x as u8)): Box _>; | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `std::boxed::Box _>` diff --git a/src/test/ui/coercion/coerce-to-bang-cast.stderr b/src/test/ui/coercion/coerce-to-bang-cast.stderr index 2982801f4613..ff30ebc09c63 100644 --- a/src/test/ui/coercion/coerce-to-bang-cast.stderr +++ b/src/test/ui/coercion/coerce-to-bang-cast.stderr @@ -9,7 +9,7 @@ LL | let y = {return; 22} as !; error[E0605]: non-primitive cast: `i32` as `!` --> $DIR/coerce-to-bang-cast.rs:11:13 | -LL | let y = 22 as !; //~ ERROR non-primitive cast +LL | let y = 22 as !; | ^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/coercion/coerce-to-bang.stderr b/src/test/ui/coercion/coerce-to-bang.stderr index 72e7211de7a7..a46e97da8159 100644 --- a/src/test/ui/coercion/coerce-to-bang.stderr +++ b/src/test/ui/coercion/coerce-to-bang.stderr @@ -10,7 +10,7 @@ LL | foo(return, 22, 44); error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:18:13 | -LL | foo(22, 44, return); //~ ERROR mismatched types +LL | foo(22, 44, return); | ^^ expected !, found integer | = note: expected type `!` @@ -28,7 +28,7 @@ LL | foo(a, b, c); // ... and hence a reference to `a` is expected to diverg error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:36:12 | -LL | foo(a, b, c); //~ ERROR mismatched types +LL | foo(a, b, c); | ^ expected !, found integer | = note: expected type `!` @@ -37,7 +37,7 @@ LL | foo(a, b, c); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:45:12 | -LL | foo(a, b, c); //~ ERROR mismatched types +LL | foo(a, b, c); | ^ expected !, found integer | = note: expected type `!` @@ -46,7 +46,7 @@ LL | foo(a, b, c); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:50:21 | -LL | let x: [!; 2] = [return, 22]; //~ ERROR mismatched types +LL | let x: [!; 2] = [return, 22]; | ^^^^^^^^^^^^ expected !, found integer | = note: expected type `[!; 2]` @@ -55,7 +55,7 @@ LL | let x: [!; 2] = [return, 22]; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:55:22 | -LL | let x: [!; 2] = [22, return]; //~ ERROR mismatched types +LL | let x: [!; 2] = [22, return]; | ^^ expected !, found integer | = note: expected type `!` @@ -64,7 +64,7 @@ LL | let x: [!; 2] = [22, return]; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:60:37 | -LL | let x: (usize, !, usize) = (22, 44, 66); //~ ERROR mismatched types +LL | let x: (usize, !, usize) = (22, 44, 66); | ^^ expected !, found integer | = note: expected type `!` @@ -82,7 +82,7 @@ LL | let x: (usize, !, usize) = (return, 44, 66); error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:76:37 | -LL | let x: (usize, !, usize) = (22, 44, return); //~ ERROR mismatched types +LL | let x: (usize, !, usize) = (22, 44, return); | ^^ expected !, found integer | = note: expected type `!` diff --git a/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr b/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr index c8ec2f0545e6..057de5b625e8 100644 --- a/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr +++ b/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/coercion-missing-tail-expected-type.rs:3:24 | -LL | fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types +LL | fn plus_one(x: i32) -> i32 { | -------- ^^^ expected i32, found () | | | this function's body doesn't return @@ -14,7 +14,7 @@ LL | x + 1; error[E0308]: mismatched types --> $DIR/coercion-missing-tail-expected-type.rs:7:13 | -LL | fn foo() -> Result { //~ ERROR mismatched types +LL | fn foo() -> Result { | --- ^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found () | | | this function's body doesn't return diff --git a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr index c8a146cdd445..86a63eb56991 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr @@ -1,19 +1,19 @@ error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:14:1 | -LL | impl !Marker1 for dyn Object + Marker2 { } //~ ERROR E0371 +LL | impl !Marker1 for dyn Object + Marker2 { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:16:1 | -LL | impl !Marker2 for dyn Object + Marker2 { } //~ ERROR E0371 +LL | impl !Marker2 for dyn Object + Marker2 { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:22:1 | -LL | impl !Send for dyn Marker2 {} //~ ERROR E0117 +LL | impl !Send for dyn Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate @@ -22,13 +22,13 @@ LL | impl !Send for dyn Marker2 {} //~ ERROR E0117 error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:26:1 | -LL | impl !Send for dyn Object {} //~ ERROR E0321 +LL | impl !Send for dyn Object {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + Marker2 + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:27:1 | -LL | impl !Send for dyn Object + Marker2 {} //~ ERROR E0321 +LL | impl !Send for dyn Object + Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error: aborting due to 5 previous errors diff --git a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr index 78ca2f5279d6..536b4625aee2 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr @@ -1,19 +1,19 @@ error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:14:1 | -LL | impl Marker1 for dyn Object + Marker2 { } //~ ERROR E0371 +LL | impl Marker1 for dyn Object + Marker2 { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:16:1 | -LL | impl Marker2 for dyn Object + Marker2 { } //~ ERROR E0371 +LL | impl Marker2 for dyn Object + Marker2 { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:22:1 | -LL | unsafe impl Send for dyn Marker2 {} //~ ERROR E0117 +LL | unsafe impl Send for dyn Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate @@ -22,13 +22,13 @@ LL | unsafe impl Send for dyn Marker2 {} //~ ERROR E0117 error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:26:1 | -LL | unsafe impl Send for dyn Object {} //~ ERROR E0321 +LL | unsafe impl Send for dyn Object {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + Marker2 + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:27:1 | -LL | unsafe impl Send for dyn Object + Marker2 {} //~ ERROR E0321 +LL | unsafe impl Send for dyn Object + Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error: aborting due to 5 previous errors diff --git a/src/test/ui/compare-method/proj-outlives-region.stderr b/src/test/ui/compare-method/proj-outlives-region.stderr index ba0b04dca9d2..e5f5c5ed20d5 100644 --- a/src/test/ui/compare-method/proj-outlives-region.stderr +++ b/src/test/ui/compare-method/proj-outlives-region.stderr @@ -4,7 +4,7 @@ error[E0276]: impl has stricter requirements than trait LL | fn foo() where T: 'a; | --------------------- definition of `foo` from trait ... -LL | fn foo() where U: 'a { } //~ ERROR E0276 +LL | fn foo() where U: 'a { } | ^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a` error: aborting due to previous error diff --git a/src/test/ui/compare-method/region-extra.stderr b/src/test/ui/compare-method/region-extra.stderr index 48ca690f425e..5a584c7d6ed9 100644 --- a/src/test/ui/compare-method/region-extra.stderr +++ b/src/test/ui/compare-method/region-extra.stderr @@ -4,7 +4,7 @@ error[E0276]: impl has stricter requirements than trait LL | fn foo(); | --------- definition of `foo` from trait ... -LL | fn foo() where 'a: 'b { } //~ ERROR impl has stricter +LL | fn foo() where 'a: 'b { } | ^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/compare-method/reordered-type-param.stderr b/src/test/ui/compare-method/reordered-type-param.stderr index c162c720a48b..a33908c01c84 100644 --- a/src/test/ui/compare-method/reordered-type-param.stderr +++ b/src/test/ui/compare-method/reordered-type-param.stderr @@ -4,7 +4,7 @@ error[E0053]: method `b` has an incompatible type for trait LL | fn b(&self, x: C) -> C; | - type in trait ... -LL | fn b(&self, _x: G) -> G { panic!() } //~ ERROR method `b` has an incompatible type +LL | fn b(&self, _x: G) -> G { panic!() } | ^ expected type parameter, found a different type parameter | = note: expected type `fn(&E, F) -> F` diff --git a/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr b/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr index 07f5a0a6cec4..5d09038076f9 100644 --- a/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr +++ b/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr @@ -4,7 +4,7 @@ error[E0276]: impl has stricter requirements than trait LL | fn b(&self, x: C) -> C; | ---------------------------- definition of `b` from trait ... -LL | fn b(&self, _x: F) -> F { panic!() } //~ ERROR E0276 +LL | fn b(&self, _x: F) -> F { panic!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `F: std::marker::Sync` error: aborting due to previous error diff --git a/src/test/ui/compile_error_macro.stderr b/src/test/ui/compile_error_macro.stderr index 9e11db68315e..8aa1878c5d7c 100644 --- a/src/test/ui/compile_error_macro.stderr +++ b/src/test/ui/compile_error_macro.stderr @@ -1,7 +1,7 @@ error: a very descriptive error message --> $DIR/compile_error_macro.rs:2:5 | -LL | compile_error!("a very descriptive error message"); //~ ERROR: a very descriptive error message +LL | compile_error!("a very descriptive error message"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/concat.stderr b/src/test/ui/concat.stderr index b6024972c744..61fb9de1ef96 100644 --- a/src/test/ui/concat.stderr +++ b/src/test/ui/concat.stderr @@ -1,19 +1,19 @@ error: cannot concatenate a byte string literal --> $DIR/concat.rs:2:13 | -LL | concat!(b'f'); //~ ERROR: cannot concatenate a byte string literal +LL | concat!(b'f'); | ^^^^ error: cannot concatenate a byte string literal --> $DIR/concat.rs:3:13 | -LL | concat!(b"foo"); //~ ERROR: cannot concatenate a byte string literal +LL | concat!(b"foo"); | ^^^^^^ error: expected a literal --> $DIR/concat.rs:4:13 | -LL | concat!(foo); //~ ERROR: expected a literal +LL | concat!(foo); | ^^^ | = note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()` @@ -21,7 +21,7 @@ LL | concat!(foo); //~ ERROR: expected a literal error: expected a literal --> $DIR/concat.rs:5:13 | -LL | concat!(foo()); //~ ERROR: expected a literal +LL | concat!(foo()); | ^^^^^ | = note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()` diff --git a/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr b/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr index 37c7a571d0f5..8d308f0c96fb 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr @@ -1,7 +1,7 @@ error[E0658]: no_core is experimental (see issue #29639) --> $DIR/cfg-attr-crate-2.rs:6:21 | -LL | #![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental +LL | #![cfg_attr(broken, no_core)] | ^^^^^^^ | = help: add #![feature(no_core)] to the crate attributes to enable diff --git a/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr index d75a0389851a..96c571ebebdb 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr @@ -1,7 +1,7 @@ error[E0537]: invalid predicate `foo` --> $DIR/cfg-attr-invalid-predicate.rs:1:7 | -LL | #[cfg(foo(bar))] //~ ERROR invalid predicate `foo` +LL | #[cfg(foo(bar))] | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr index 8cdf4ec31e7f..8485459ca6bd 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr @@ -1,7 +1,7 @@ error[E0658]: no_core is experimental (see issue #29639) --> $DIR/cfg-attr-multi-invalid-1.rs:4:21 | -LL | #![cfg_attr(broken, no_core, no_std)] //~ ERROR no_core is experimental +LL | #![cfg_attr(broken, no_core, no_std)] | ^^^^^^^ | = help: add #![feature(no_core)] to the crate attributes to enable diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr index b3a3b0c0f97b..2a673ea81317 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr @@ -1,7 +1,7 @@ error[E0658]: no_core is experimental (see issue #29639) --> $DIR/cfg-attr-multi-invalid-2.rs:4:29 | -LL | #![cfg_attr(broken, no_std, no_core)] //~ ERROR no_core is experimental +LL | #![cfg_attr(broken, no_std, no_core)] | ^^^^^^^ | = help: add #![feature(no_core)] to the crate attributes to enable diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr b/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr index 3d14c1973979..64e9570773a6 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr @@ -1,7 +1,7 @@ warning: use of deprecated item 'MustUseDeprecated' --> $DIR/cfg-attr-multi-true.rs:12:6 | -LL | impl MustUseDeprecated { //~ warning: use of deprecated item +LL | impl MustUseDeprecated { | ^^^^^^^^^^^^^^^^^ | = note: #[warn(deprecated)] on by default @@ -9,25 +9,25 @@ LL | impl MustUseDeprecated { //~ warning: use of deprecated item warning: use of deprecated item 'MustUseDeprecated' --> $DIR/cfg-attr-multi-true.rs:19:5 | -LL | MustUseDeprecated::new(); //~ warning: use of deprecated item +LL | MustUseDeprecated::new(); | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'MustUseDeprecated' --> $DIR/cfg-attr-multi-true.rs:13:17 | -LL | fn new() -> MustUseDeprecated { //~ warning: use of deprecated item +LL | fn new() -> MustUseDeprecated { | ^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'MustUseDeprecated' --> $DIR/cfg-attr-multi-true.rs:14:9 | -LL | MustUseDeprecated {} //~ warning: use of deprecated item +LL | MustUseDeprecated {} | ^^^^^^^^^^^^^^^^^ warning: unused `MustUseDeprecated` that must be used --> $DIR/cfg-attr-multi-true.rs:19:5 | -LL | MustUseDeprecated::new(); //~ warning: use of deprecated item +LL | MustUseDeprecated::new(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/conditional-compilation/cfg-attr-parse.stderr b/src/test/ui/conditional-compilation/cfg-attr-parse.stderr index 36c7c817cb33..3dfbd6df256e 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-parse.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-parse.stderr @@ -1,31 +1,31 @@ error: expected identifier, found `)` --> $DIR/cfg-attr-parse.rs:4:12 | -LL | #[cfg_attr()] //~ error: expected identifier, found `)` +LL | #[cfg_attr()] | ^ expected identifier error: expected `,`, found `)` --> $DIR/cfg-attr-parse.rs:8:17 | -LL | #[cfg_attr(all())] //~ error: expected `,`, found `)` +LL | #[cfg_attr(all())] | ^ expected `,` error: expected identifier, found `,` --> $DIR/cfg-attr-parse.rs:16:18 | -LL | #[cfg_attr(all(),,)] //~ ERROR expected identifier +LL | #[cfg_attr(all(),,)] | ^ expected identifier error: expected identifier, found `,` --> $DIR/cfg-attr-parse.rs:28:28 | -LL | #[cfg_attr(all(), must_use,,)] //~ ERROR expected identifier +LL | #[cfg_attr(all(), must_use,,)] | ^ expected identifier error: expected identifier, found `,` --> $DIR/cfg-attr-parse.rs:40:40 | -LL | #[cfg_attr(all(), must_use, deprecated,,)] //~ ERROR expected identifier +LL | #[cfg_attr(all(), must_use, deprecated,,)] | ^ expected identifier error: aborting due to 5 previous errors diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index 7dab2b2b53f9..ae37461cab81 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -1,55 +1,55 @@ error: `cfg` is not followed by parentheses --> $DIR/cfg-attr-syntax-validation.rs:1:1 | -LL | #[cfg] //~ ERROR `cfg` is not followed by parentheses +LL | #[cfg] | ^^^^^^ help: expected syntax is: `cfg(/* predicate */)` error: `cfg` is not followed by parentheses --> $DIR/cfg-attr-syntax-validation.rs:4:1 | -LL | #[cfg = 10] //~ ERROR `cfg` is not followed by parentheses +LL | #[cfg = 10] | ^^^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)` error: `cfg` predicate is not specified --> $DIR/cfg-attr-syntax-validation.rs:7:1 | -LL | #[cfg()] //~ ERROR `cfg` predicate is not specified +LL | #[cfg()] | ^^^^^^^^ error: multiple `cfg` predicates are specified --> $DIR/cfg-attr-syntax-validation.rs:10:10 | -LL | #[cfg(a, b)] //~ ERROR multiple `cfg` predicates are specified +LL | #[cfg(a, b)] | ^ error: `cfg` predicate key cannot be a literal --> $DIR/cfg-attr-syntax-validation.rs:13:7 | -LL | #[cfg("str")] //~ ERROR `cfg` predicate key cannot be a literal +LL | #[cfg("str")] | ^^^^^ error: `cfg` predicate key must be an identifier --> $DIR/cfg-attr-syntax-validation.rs:16:7 | -LL | #[cfg(a::b)] //~ ERROR `cfg` predicate key must be an identifier +LL | #[cfg(a::b)] | ^^^^ error[E0537]: invalid predicate `a` --> $DIR/cfg-attr-syntax-validation.rs:19:7 | -LL | #[cfg(a())] //~ ERROR invalid predicate `a` +LL | #[cfg(a())] | ^^^ error[E0565]: literal in `cfg` predicate value must be a string --> $DIR/cfg-attr-syntax-validation.rs:22:11 | -LL | #[cfg(a = 10)] //~ ERROR literal in `cfg` predicate value must be a string +LL | #[cfg(a = 10)] | ^^ error[E0565]: literal in `cfg` predicate value must be a string --> $DIR/cfg-attr-syntax-validation.rs:25:11 | -LL | #[cfg(a = b"hi")] //~ ERROR literal in `cfg` predicate value must be a string +LL | #[cfg(a = b"hi")] | ^^^^^ help: consider removing the prefix: `"hi"` error: expected unsuffixed literal or identifier, found `concat!("nonexistent")` diff --git a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr index c5097c15c3c8..d0b59c3994cc 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/cfg-attr-unknown-attribute-macro-expansion.rs:3:27 | -LL | #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown +LL | #[cfg_attr(all(), unknown)] | ^^^^^^^ ... LL | foo!(); diff --git a/src/test/ui/conflicting-repr-hints.stderr b/src/test/ui/conflicting-repr-hints.stderr index 148f1211b083..c39055f01721 100644 --- a/src/test/ui/conflicting-repr-hints.stderr +++ b/src/test/ui/conflicting-repr-hints.stderr @@ -1,49 +1,49 @@ warning[E0566]: conflicting representation hints --> $DIR/conflicting-repr-hints.rs:9:8 | -LL | #[repr(C, u64)] //~ WARNING conflicting representation hints +LL | #[repr(C, u64)] | ^ ^^^ warning[E0566]: conflicting representation hints --> $DIR/conflicting-repr-hints.rs:12:8 | -LL | #[repr(u32, u64)] //~ WARNING conflicting representation hints +LL | #[repr(u32, u64)] | ^^^ ^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:19:1 | -LL | struct F(i32); //~ ERROR type has conflicting packed and align representation hints +LL | struct F(i32); | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:23:1 | -LL | struct G(i32); //~ ERROR type has conflicting packed and align representation hints +LL | struct G(i32); | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:27:1 | -LL | struct H(i32); //~ ERROR type has conflicting packed and align representation hints +LL | struct H(i32); | ^^^^^^^^^^^^^^ error[E0634]: type has conflicting packed representation hints --> $DIR/conflicting-repr-hints.rs:30:1 | -LL | struct I(i32); //~ ERROR type has conflicting packed representation hints +LL | struct I(i32); | ^^^^^^^^^^^^^^ error[E0634]: type has conflicting packed representation hints --> $DIR/conflicting-repr-hints.rs:34:1 | -LL | struct J(i32); //~ ERROR type has conflicting packed representation hints +LL | struct J(i32); | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:40:1 | -LL | / union X { //~ ERROR type has conflicting packed and align representation hints +LL | / union X { LL | | i: i32 LL | | } | |_^ @@ -51,7 +51,7 @@ LL | | } error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:46:1 | -LL | / union Y { //~ ERROR type has conflicting packed and align representation hints +LL | / union Y { LL | | i: i32 LL | | } | |_^ @@ -59,7 +59,7 @@ LL | | } error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:52:1 | -LL | / union Z { //~ ERROR type has conflicting packed and align representation hints +LL | / union Z { LL | | i: i32 LL | | } | |_^ diff --git a/src/test/ui/confuse-field-and-method/issue-2392.stderr b/src/test/ui/confuse-field-and-method/issue-2392.stderr index 0c09bd2284be..7cd1941d80e8 100644 --- a/src/test/ui/confuse-field-and-method/issue-2392.stderr +++ b/src/test/ui/confuse-field-and-method/issue-2392.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue- LL | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this ... -LL | o_closure.closure(); //~ ERROR no method named `closure` found +LL | o_closure.closure(); | ^^^^^^^ field, not a method | = help: use `(o_closure.closure)(...)` if you meant to call the function stored in the `closure` field @@ -26,7 +26,7 @@ error[E0599]: no method named `closure` found for type `Obj u32 {func}>` LL | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this ... -LL | o_func.closure(); //~ ERROR no method named `closure` found +LL | o_func.closure(); | ^^^^^^^ field, not a method | = help: use `(o_func.closure)(...)` if you meant to call the function stored in the `closure` field @@ -37,7 +37,7 @@ error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the c LL | struct BoxedObj { | --------------- method `boxed_closure` not found for this ... -LL | boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found +LL | boxed_fn.boxed_closure(); | ^^^^^^^^^^^^^ field, not a method | = help: use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field @@ -48,7 +48,7 @@ error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the c LL | struct BoxedObj { | --------------- method `boxed_closure` not found for this ... -LL | boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found +LL | boxed_closure.boxed_closure(); | ^^^^^^^^^^^^^ field, not a method | = help: use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field @@ -59,7 +59,7 @@ error[E0599]: no method named `closure` found for type `Obj u32 {func}>` LL | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this ... -LL | w.wrap.closure();//~ ERROR no method named `closure` found +LL | w.wrap.closure(); | ^^^^^^^ field, not a method | = help: use `(w.wrap.closure)(...)` if you meant to call the function stored in the `closure` field @@ -81,7 +81,7 @@ error[E0599]: no method named `closure` found for type `Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this ... -LL | check_expression().closure();//~ ERROR no method named `closure` found +LL | check_expression().closure(); | ^^^^^^^ field, not a method | = help: use `(check_expression().closure)(...)` if you meant to call the function stored in the `closure` field @@ -92,7 +92,7 @@ error[E0599]: no method named `f1` found for type `FuncContainer` in the current LL | struct FuncContainer { | -------------------- method `f1` not found for this ... -LL | (*self.container).f1(1); //~ ERROR no method named `f1` found +LL | (*self.container).f1(1); | ^^ field, not a method | = help: use `((*self.container).f1)(...)` if you meant to call the function stored in the `f1` field @@ -103,7 +103,7 @@ error[E0599]: no method named `f2` found for type `FuncContainer` in the current LL | struct FuncContainer { | -------------------- method `f2` not found for this ... -LL | (*self.container).f2(1); //~ ERROR no method named `f2` found +LL | (*self.container).f2(1); | ^^ field, not a method | = help: use `((*self.container).f2)(...)` if you meant to call the function stored in the `f2` field @@ -114,7 +114,7 @@ error[E0599]: no method named `f3` found for type `FuncContainer` in the current LL | struct FuncContainer { | -------------------- method `f3` not found for this ... -LL | (*self.container).f3(1); //~ ERROR no method named `f3` found +LL | (*self.container).f3(1); | ^^ field, not a method | = help: use `((*self.container).f3)(...)` if you meant to call the function stored in the `f3` field diff --git a/src/test/ui/confuse-field-and-method/issue-33784.stderr b/src/test/ui/confuse-field-and-method/issue-33784.stderr index 73bcf0fd9c07..cce961f1e4ed 100644 --- a/src/test/ui/confuse-field-and-method/issue-33784.stderr +++ b/src/test/ui/confuse-field-and-method/issue-33784.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `closure` found for type `&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:48]>` in the current scope --> $DIR/issue-33784.rs:27:7 | -LL | p.closure(); //~ ERROR no method named `closure` found +LL | p.closure(); | ^^^^^^^ field, not a method | = help: use `(p.closure)(...)` if you meant to call the function stored in the `closure` field @@ -9,7 +9,7 @@ LL | p.closure(); //~ ERROR no method named `closure` found error[E0599]: no method named `fn_ptr` found for type `&&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:48]>` in the current scope --> $DIR/issue-33784.rs:29:7 | -LL | q.fn_ptr(); //~ ERROR no method named `fn_ptr` found +LL | q.fn_ptr(); | ^^^^^^ field, not a method | = help: use `(q.fn_ptr)(...)` if you meant to call the function stored in the `fn_ptr` field @@ -17,7 +17,7 @@ LL | q.fn_ptr(); //~ ERROR no method named `fn_ptr` found error[E0599]: no method named `c_fn_ptr` found for type `&D` in the current scope --> $DIR/issue-33784.rs:32:7 | -LL | s.c_fn_ptr(); //~ ERROR no method named `c_fn_ptr` found +LL | s.c_fn_ptr(); | ^^^^^^^^ field, not a method | = help: use `(s.c_fn_ptr)(...)` if you meant to call the function stored in the `c_fn_ptr` field diff --git a/src/test/ui/confuse-field-and-method/private-field.stderr b/src/test/ui/confuse-field-and-method/private-field.stderr index e3058ad0a9ea..97c949e32e34 100644 --- a/src/test/ui/confuse-field-and-method/private-field.stderr +++ b/src/test/ui/confuse-field-and-method/private-field.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `dog_age` found for type `animal::Dog` in the curr LL | pub struct Dog { | -------------- method `dog_age` not found for this ... -LL | let dog_age = dog.dog_age(); //~ ERROR no method +LL | let dog_age = dog.dog_age(); | ^^^^^^^ private field, not a method error: aborting due to previous error diff --git a/src/test/ui/const-generics/const-expression-parameter.stderr b/src/test/ui/const-generics/const-expression-parameter.stderr index 2741d6212562..2f7a80f0c8fd 100644 --- a/src/test/ui/const-generics/const-expression-parameter.stderr +++ b/src/test/ui/const-generics/const-expression-parameter.stderr @@ -1,13 +1,13 @@ error: expected identifier, found `<-` --> $DIR/const-expression-parameter.rs:9:19 | -LL | i32_identity::<-1>(); //~ ERROR expected identifier, found `<-` +LL | i32_identity::<-1>(); | ^^ expected identifier error: expected one of `,` or `>`, found `+` --> $DIR/const-expression-parameter.rs:13:22 | -LL | i32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` +LL | i32_identity::<1 + 2>(); | ^ expected one of `,` or `>` here warning: the feature `const_generics` is incomplete and may cause the compiler to crash diff --git a/src/test/ui/const-generics/const-fn-with-const-param.stderr b/src/test/ui/const-generics/const-fn-with-const-param.stderr index 94d2afa25b4f..c0cd7bace471 100644 --- a/src/test/ui/const-generics/const-fn-with-const-param.stderr +++ b/src/test/ui/const-generics/const-fn-with-const-param.stderr @@ -8,7 +8,7 @@ error: const parameters are not permitted in `const fn` --> $DIR/const-fn-with-const-param.rs:4:1 | LL | / const fn const_u32_identity() -> u32 { -LL | | //~^ ERROR const parameters are not permitted in `const fn` +LL | | LL | | X LL | | } | |_^ diff --git a/src/test/ui/const-generics/const-param-from-outer-fn.stderr b/src/test/ui/const-generics/const-param-from-outer-fn.stderr index f40b527d7160..e37b34fac335 100644 --- a/src/test/ui/const-generics/const-param-from-outer-fn.stderr +++ b/src/test/ui/const-generics/const-param-from-outer-fn.stderr @@ -11,7 +11,7 @@ LL | fn foo() { | - const variable from outer function LL | fn bar() -> u32 { | --- try adding a local generic parameter in this method instead -LL | X //~ ERROR can't use generic parameters from outer function +LL | X | ^ use of generic parameter from outer function error: aborting due to previous error diff --git a/src/test/ui/const-generics/invalid-constant-in-args.stderr b/src/test/ui/const-generics/invalid-constant-in-args.stderr index 1623f645124a..b9f874ff18bb 100644 --- a/src/test/ui/const-generics/invalid-constant-in-args.stderr +++ b/src/test/ui/const-generics/invalid-constant-in-args.stderr @@ -1,7 +1,7 @@ error[E0107]: wrong number of const arguments: expected 0, found 1 --> $DIR/invalid-constant-in-args.rs:2:22 | -LL | let _: Vec<&str, "a"> = Vec::new(); //~ ERROR wrong number of const arguments +LL | let _: Vec<&str, "a"> = Vec::new(); | ^^^ unexpected const argument error: aborting due to previous error diff --git a/src/test/ui/consts/const-array-oob-arith.stderr b/src/test/ui/consts/const-array-oob-arith.stderr index edd3095b0fc7..00286b0b0e0f 100644 --- a/src/test/ui/consts/const-array-oob-arith.stderr +++ b/src/test/ui/consts/const-array-oob-arith.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/const-array-oob-arith.rs:7:45 | -LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5]; //~ ERROR: mismatched types +LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5]; | ^^^ expected an array with a fixed size of 2 elements, found one with 1 elements | = note: expected type `[i32; 2]` @@ -10,7 +10,7 @@ LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5]; //~ ERROR: mismatched type error[E0308]: mismatched types --> $DIR/const-array-oob-arith.rs:8:44 | -LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99]; //~ ERROR: mismatched types +LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99]; | ^^^^^^^ expected an array with a fixed size of 1 elements, found one with 2 elements | = note: expected type `[i32; 1]` diff --git a/src/test/ui/consts/const-cast-different-types.stderr b/src/test/ui/consts/const-cast-different-types.stderr index ced9b9fb3c7c..9960ccb4166b 100644 --- a/src/test/ui/consts/const-cast-different-types.stderr +++ b/src/test/ui/consts/const-cast-different-types.stderr @@ -1,13 +1,13 @@ error[E0606]: casting `&'static str` as `*const u8` is invalid --> $DIR/const-cast-different-types.rs:2:23 | -LL | static b: *const u8 = a as *const u8; //~ ERROR casting +LL | static b: *const u8 = a as *const u8; | ^^^^^^^^^^^^^^ error[E0606]: casting `&&'static str` as `*const u8` is invalid --> $DIR/const-cast-different-types.rs:3:23 | -LL | static c: *const u8 = &a as *const u8; //~ ERROR casting +LL | static c: *const u8 = &a as *const u8; | ^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-cast-wrong-type.stderr b/src/test/ui/consts/const-cast-wrong-type.stderr index 7684822d9393..ad816d9297bd 100644 --- a/src/test/ui/consts/const-cast-wrong-type.stderr +++ b/src/test/ui/consts/const-cast-wrong-type.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/const-cast-wrong-type.rs:2:23 | -LL | static b: *const i8 = &a as *const i8; //~ ERROR mismatched types +LL | static b: *const i8 = &a as *const i8; | ^^^^^^^^^^^^^^^ expected u8, found i8 error: aborting due to previous error diff --git a/src/test/ui/consts/const-err-early.stderr b/src/test/ui/consts/const-err-early.stderr index a64f0e259495..a61f9b303aa1 100644 --- a/src/test/ui/consts/const-err-early.stderr +++ b/src/test/ui/consts/const-err-early.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/const-err-early.rs:3:1 | -LL | pub const A: i8 = -std::i8::MIN; //~ ERROR const_err +LL | pub const A: i8 = -std::i8::MIN; | ^^^^^^^^^^^^^^^^^^-------------^ | | | attempt to negate with overflow @@ -15,7 +15,7 @@ LL | #![deny(const_err)] error: any use of this value will cause an error --> $DIR/const-err-early.rs:4:1 | -LL | pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err +LL | pub const B: u8 = 200u8 + 200u8; | ^^^^^^^^^^^^^^^^^^-------------^ | | | attempt to add with overflow @@ -23,7 +23,7 @@ LL | pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err error: any use of this value will cause an error --> $DIR/const-err-early.rs:5:1 | -LL | pub const C: u8 = 200u8 * 4; //~ ERROR const_err +LL | pub const C: u8 = 200u8 * 4; | ^^^^^^^^^^^^^^^^^^---------^ | | | attempt to multiply with overflow @@ -31,7 +31,7 @@ LL | pub const C: u8 = 200u8 * 4; //~ ERROR const_err error: any use of this value will cause an error --> $DIR/const-err-early.rs:6:1 | -LL | pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err +LL | pub const D: u8 = 42u8 - (42u8 + 1); | ^^^^^^^^^^^^^^^^^^-----------------^ | | | attempt to subtract with overflow @@ -39,7 +39,7 @@ LL | pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err error: any use of this value will cause an error --> $DIR/const-err-early.rs:7:1 | -LL | pub const E: u8 = [5u8][1]; //~ ERROR const_err +LL | pub const E: u8 = [5u8][1]; | ^^^^^^^^^^^^^^^^^^--------^ | | | index out of bounds: the len is 1 but the index is 1 diff --git a/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr index be1be6c06007..148b1210d39e 100644 --- a/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr +++ b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr @@ -1,7 +1,7 @@ error[E0019]: static contains unimplemented expression type --> $DIR/assign-to-static-within-other-static-2.rs:16:5 | -LL | *FOO.0.get() = 5; //~ ERROR contains unimplemented expression type +LL | *FOO.0.get() = 5; | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/assign-to-static-within-other-static.stderr b/src/test/ui/consts/const-eval/assign-to-static-within-other-static.stderr index 31e49dc10ca6..02b72765b377 100644 --- a/src/test/ui/consts/const-eval/assign-to-static-within-other-static.stderr +++ b/src/test/ui/consts/const-eval/assign-to-static-within-other-static.stderr @@ -1,7 +1,7 @@ error: cannot mutate statics in the initializer of another static --> $DIR/assign-to-static-within-other-static.rs:10:5 | -LL | FOO = 5; //~ ERROR cannot mutate statics in the initializer of another static +LL | FOO = 5; | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr index 5ec2a2feb097..44ee8b336c89 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:14:1 | -LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I8: (i8,) = LL | | ( LL | | i8::MIN - 1, | | ----------- attempt to subtract with overflow @@ -17,7 +17,7 @@ LL | #![deny(const_err)] error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:19:1 | -LL | / const VALS_I16: (i16,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I16: (i16,) = LL | | ( LL | | i16::MIN - 1, | | ------------ attempt to subtract with overflow @@ -27,7 +27,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:24:1 | -LL | / const VALS_I32: (i32,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I32: (i32,) = LL | | ( LL | | i32::MIN - 1, | | ------------ attempt to subtract with overflow @@ -37,7 +37,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:29:1 | -LL | / const VALS_I64: (i64,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I64: (i64,) = LL | | ( LL | | i64::MIN - 1, | | ------------ attempt to subtract with overflow @@ -47,7 +47,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:34:1 | -LL | / const VALS_U8: (u8,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_U8: (u8,) = LL | | ( LL | | u8::MIN - 1, | | ----------- attempt to subtract with overflow @@ -57,7 +57,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:39:1 | -LL | / const VALS_U16: (u16,) = ( //~ ERROR any use of this value will cause an error +LL | / const VALS_U16: (u16,) = ( LL | | u16::MIN - 1, | | ------------ attempt to subtract with overflow LL | | ); @@ -66,7 +66,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:43:1 | -LL | / const VALS_U32: (u32,) = ( //~ ERROR any use of this value will cause an error +LL | / const VALS_U32: (u32,) = ( LL | | u32::MIN - 1, | | ------------ attempt to subtract with overflow LL | | ); @@ -75,7 +75,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:47:1 | -LL | / const VALS_U64: (u64,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_U64: (u64,) = LL | | ( LL | | u64::MIN - 1, | | ------------ attempt to subtract with overflow diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr index 7866b6c30c3d..69e165bef4a7 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:14:1 | -LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I8: (i8,) = LL | | ( LL | | i8::MAX + 1, | | ----------- attempt to add with overflow @@ -17,7 +17,7 @@ LL | #![deny(const_err)] error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:19:1 | -LL | / const VALS_I16: (i16,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I16: (i16,) = LL | | ( LL | | i16::MAX + 1, | | ------------ attempt to add with overflow @@ -27,7 +27,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:24:1 | -LL | / const VALS_I32: (i32,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I32: (i32,) = LL | | ( LL | | i32::MAX + 1, | | ------------ attempt to add with overflow @@ -37,7 +37,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:29:1 | -LL | / const VALS_I64: (i64,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I64: (i64,) = LL | | ( LL | | i64::MAX + 1, | | ------------ attempt to add with overflow @@ -47,7 +47,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:34:1 | -LL | / const VALS_U8: (u8,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_U8: (u8,) = LL | | ( LL | | u8::MAX + 1, | | ----------- attempt to add with overflow @@ -57,7 +57,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:39:1 | -LL | / const VALS_U16: (u16,) = ( //~ ERROR any use of this value will cause an error +LL | / const VALS_U16: (u16,) = ( LL | | u16::MAX + 1, | | ------------ attempt to add with overflow LL | | ); @@ -66,7 +66,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:43:1 | -LL | / const VALS_U32: (u32,) = ( //~ ERROR any use of this value will cause an error +LL | / const VALS_U32: (u32,) = ( LL | | u32::MAX + 1, | | ------------ attempt to add with overflow LL | | ); @@ -75,7 +75,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:47:1 | -LL | / const VALS_U64: (u64,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_U64: (u64,) = LL | | ( LL | | u64::MAX + 1, | | ------------ attempt to add with overflow diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr index 5370fdd25d82..ba606f6d09de 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:14:1 | -LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I8: (i8,) = LL | | ( LL | | i8::MIN * 2, | | ----------- attempt to multiply with overflow @@ -17,7 +17,7 @@ LL | #![deny(const_err)] error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:19:1 | -LL | / const VALS_I16: (i16,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I16: (i16,) = LL | | ( LL | | i16::MIN * 2, | | ------------ attempt to multiply with overflow @@ -27,7 +27,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:24:1 | -LL | / const VALS_I32: (i32,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I32: (i32,) = LL | | ( LL | | i32::MIN * 2, | | ------------ attempt to multiply with overflow @@ -37,7 +37,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:29:1 | -LL | / const VALS_I64: (i64,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I64: (i64,) = LL | | ( LL | | i64::MIN * 2, | | ------------ attempt to multiply with overflow @@ -47,7 +47,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:34:1 | -LL | / const VALS_U8: (u8,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_U8: (u8,) = LL | | ( LL | | u8::MAX * 2, | | ----------- attempt to multiply with overflow @@ -57,7 +57,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:39:1 | -LL | / const VALS_U16: (u16,) = ( //~ ERROR any use of this value will cause an error +LL | / const VALS_U16: (u16,) = ( LL | | u16::MAX * 2, | | ------------ attempt to multiply with overflow LL | | ); @@ -66,7 +66,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:43:1 | -LL | / const VALS_U32: (u32,) = ( //~ ERROR any use of this value will cause an error +LL | / const VALS_U32: (u32,) = ( LL | | u32::MAX * 2, | | ------------ attempt to multiply with overflow LL | | ); @@ -75,7 +75,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:47:1 | -LL | / const VALS_U64: (u64,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_U64: (u64,) = LL | | ( LL | | u64::MAX * 2, | | ------------ attempt to multiply with overflow diff --git a/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr b/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr index 6be54c0bad4f..773441182b4b 100644 --- a/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr +++ b/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/const_raw_ptr_ops.rs:6:1 | -LL | const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 }; //~ ERROR any use of this +LL | const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ | | | "pointer arithmetic or comparison" needs an rfc before being allowed inside constants @@ -11,7 +11,7 @@ LL | const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 }; //~ ERROR error: any use of this value will cause an error --> $DIR/const_raw_ptr_ops.rs:12:1 | -LL | const Y2: usize = unsafe { &1 as *const i32 as usize + 1 }; //~ ERROR any use of this +LL | const Y2: usize = unsafe { &1 as *const i32 as usize + 1 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------^^^ | | | "pointer arithmetic or comparison" needs an rfc before being allowed inside constants @@ -19,7 +19,7 @@ LL | const Y2: usize = unsafe { &1 as *const i32 as usize + 1 }; //~ ERROR any u error: any use of this value will cause an error --> $DIR/const_raw_ptr_ops.rs:16:1 | -LL | const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR any use of this value will cause +LL | const Z2: i32 = unsafe { *(42 as *const i32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^-------------------^^^ | | | a memory access tried to interpret some bytes as a pointer @@ -27,7 +27,7 @@ LL | const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR any use of this v error: any use of this value will cause an error --> $DIR/const_raw_ptr_ops.rs:17:1 | -LL | const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR any use of this value will cause +LL | const Z3: i32 = unsafe { *(44 as *const i32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^-------------------^^^ | | | a memory access tried to interpret some bytes as a pointer diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr index fdbc4cb0c8d2..d79666688fa2 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr @@ -1,7 +1,7 @@ error: `foo` is not yet stable as a const fn --> $DIR/dont_promote_unstable_const_fn.rs:15:25 | -LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a const fn +LL | const fn bar() -> u32 { foo() } | ^^^^^ | = help: add `#![feature(foo)]` to the crate attributes to enable @@ -9,7 +9,7 @@ LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a cons error[E0597]: borrowed value does not live long enough --> $DIR/dont_promote_unstable_const_fn.rs:18:28 | -LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &foo(); | ^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here @@ -19,7 +19,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/dont_promote_unstable_const_fn.rs:22:28 | -LL | let _: &'static u32 = &meh(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &meh(); | ^^^^^ temporary value does not live long enough ... LL | } @@ -32,7 +32,7 @@ error[E0597]: borrowed value does not live long enough | LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | //~^ ERROR does not live long enough +LL | LL | } | - temporary value only lives until here | diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr index 8be7add22009..516c008e7206 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr @@ -1,9 +1,9 @@ error[E0597]: borrowed value does not live long enough --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28 | -LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &foo(); | ^^^^^ temporary value does not live long enough -LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _x: &'static u32 = &foo(); LL | } | - temporary value only lives until here | @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:9:29 | -LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _x: &'static u32 = &foo(); | ^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/const-eval/double_check2.stderr b/src/test/ui/consts/const-eval/double_check2.stderr index 06b38bf71034..2b61d33852c9 100644 --- a/src/test/ui/consts/const-eval/double_check2.stderr +++ b/src/test/ui/consts/const-eval/double_check2.stderr @@ -1,7 +1,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/double_check2.rs:15:1 | -LL | / static FOO: (&Foo, &Bar) = unsafe {( //~ undefined behavior +LL | / static FOO: (&Foo, &Bar) = unsafe {( LL | | Union { u8: &BAR }.foo, LL | | Union { u8: &BAR }.bar, LL | | )}; diff --git a/src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr b/src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr index c562c66389f9..5a72c8205b66 100644 --- a/src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr +++ b/src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr @@ -1,7 +1,7 @@ error[E0658]: unions in const fn are unstable (see issue #51909) --> $DIR/feature-gate-const_fn_union.rs:11:5 | -LL | Foo { u }.i //~ ERROR unions in const fn are unstable +LL | Foo { u }.i | ^^^^^^^^^^^ | = help: add #![feature(const_fn_union)] to the crate attributes to enable diff --git a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr index 1a9e1b0ae850..ac045f29b110 100644 --- a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr +++ b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr @@ -1,7 +1,7 @@ error: index out of bounds: the len is 1 but the index is 1 --> $DIR/index_out_of_bounds_propagated.rs:3:5 | -LL | array[1]; //~ ERROR index out of bounds +LL | array[1]; | ^^^^^^^^ | = note: #[deny(const_err)] on by default diff --git a/src/test/ui/consts/const-eval/infinite_loop.stderr b/src/test/ui/consts/const-eval/infinite_loop.stderr index 422c2bab6ea9..ee696c5439ff 100644 --- a/src/test/ui/consts/const-eval/infinite_loop.stderr +++ b/src/test/ui/consts/const-eval/infinite_loop.stderr @@ -1,9 +1,9 @@ error[E0019]: constant contains unimplemented expression type --> $DIR/infinite_loop.rs:7:9 | -LL | / while n != 0 { //~ ERROR constant contains unimplemented expression type +LL | / while n != 0 { LL | | n = if n % 2 == 0 { n/2 } else { 3*n + 1 }; -LL | | //~^ ERROR evaluation of constant value failed +LL | | LL | | } | |_________^ @@ -12,9 +12,9 @@ warning: Constant evaluating a complex constant, this might take some time | LL | let _ = [(); { | __________________^ -LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time +LL | | LL | | let mut n = 113383; // #20 in https://oeis.org/A006884 -LL | | while n != 0 { //~ ERROR constant contains unimplemented expression type +LL | | while n != 0 { ... | LL | | n LL | | }]; diff --git a/src/test/ui/consts/const-eval/issue-50814-2.stderr b/src/test/ui/consts/const-eval/issue-50814-2.stderr index 7c2cd7c5ca04..29ebc31b634a 100644 --- a/src/test/ui/consts/const-eval/issue-50814-2.stderr +++ b/src/test/ui/consts/const-eval/issue-50814-2.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/issue-50814-2.rs:12:5 | -LL | const BAR: usize = [5, 6, 7][T::BOO]; //~ ERROR any use of this value will cause an error +LL | const BAR: usize = [5, 6, 7][T::BOO]; | ^^^^^^^^^^^^^^^^^^^-----------------^ | | | index out of bounds: the len is 3 but the index is 42 @@ -11,7 +11,7 @@ LL | const BAR: usize = [5, 6, 7][T::BOO]; //~ ERROR any use of this value w error[E0080]: evaluation of constant expression failed --> $DIR/issue-50814-2.rs:16:5 | -LL | & as Foo>::BAR //~ ERROR E0080 +LL | & as Foo>::BAR | ^--------------------- | | | referenced constant has errors diff --git a/src/test/ui/consts/const-eval/issue-50814.stderr b/src/test/ui/consts/const-eval/issue-50814.stderr index 757e55fe31d3..6fbfb4d11fe5 100644 --- a/src/test/ui/consts/const-eval/issue-50814.stderr +++ b/src/test/ui/consts/const-eval/issue-50814.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/issue-50814.rs:13:5 | -LL | const MAX: u8 = A::MAX + B::MAX; //~ ERROR any use of this value will cause an error +LL | const MAX: u8 = A::MAX + B::MAX; | ^^^^^^^^^^^^^^^^---------------^ | | | attempt to add with overflow @@ -11,7 +11,7 @@ LL | const MAX: u8 = A::MAX + B::MAX; //~ ERROR any use of this value will c error[E0080]: evaluation of constant expression failed --> $DIR/issue-50814.rs:17:5 | -LL | &Sum::::MAX //~ ERROR E0080 +LL | &Sum::::MAX | ^----------------- | | | referenced constant has errors diff --git a/src/test/ui/consts/const-eval/issue-52442.stderr b/src/test/ui/consts/const-eval/issue-52442.stderr index 516796c1a42d..2352ecba6895 100644 --- a/src/test/ui/consts/const-eval/issue-52442.stderr +++ b/src/test/ui/consts/const-eval/issue-52442.stderr @@ -1,13 +1,13 @@ error[E0019]: constant contains unimplemented expression type --> $DIR/issue-52442.rs:2:14 | -LL | [(); { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type +LL | [(); { &loop { break } as *const _ as usize } ]; | ^^^^^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value --> $DIR/issue-52442.rs:2:11 | -LL | [(); { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type +LL | [(); { &loop { break } as *const _ as usize } ]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior diff --git a/src/test/ui/consts/const-eval/issue-52475.stderr b/src/test/ui/consts/const-eval/issue-52475.stderr index 4f1b2ab4c8f4..605c71d5a6b5 100644 --- a/src/test/ui/consts/const-eval/issue-52475.stderr +++ b/src/test/ui/consts/const-eval/issue-52475.stderr @@ -1,8 +1,8 @@ error[E0019]: constant contains unimplemented expression type --> $DIR/issue-52475.rs:6:9 | -LL | / while n < 5 { //~ ERROR constant contains unimplemented expression type -LL | | n = (n + 1) % 5; //~ ERROR evaluation of constant value failed +LL | / while n < 5 { +LL | | n = (n + 1) % 5; LL | | x = &0; // Materialize a new AllocId LL | | } | |_________^ @@ -12,7 +12,7 @@ warning: Constant evaluating a complex constant, this might take some time | LL | let _ = [(); { | __________________^ -LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time +LL | | LL | | let mut x = &0; LL | | let mut n = 0; ... | @@ -23,7 +23,7 @@ LL | | }]; error[E0080]: evaluation of constant value failed --> $DIR/issue-52475.rs:7:17 | -LL | n = (n + 1) % 5; //~ ERROR evaluation of constant value failed +LL | n = (n + 1) % 5; | ^^^^^^^^^^^ duplicate interpreter state observed here, const evaluation will never terminate error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-eval/match-test-ptr-null.stderr b/src/test/ui/consts/const-eval/match-test-ptr-null.stderr index 94615c019fe8..fd5647c9af3d 100644 --- a/src/test/ui/consts/const-eval/match-test-ptr-null.stderr +++ b/src/test/ui/consts/const-eval/match-test-ptr-null.stderr @@ -1,7 +1,7 @@ error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) --> $DIR/match-test-ptr-null.rs:6:15 | -LL | match &1 as *const i32 as usize { //~ ERROR casting pointers to integers in constants +LL | match &1 as *const i32 as usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable @@ -9,13 +9,13 @@ LL | match &1 as *const i32 as usize { //~ ERROR casting pointers to int error[E0019]: constant contains unimplemented expression type --> $DIR/match-test-ptr-null.rs:7:13 | -LL | 0 => 42, //~ ERROR constant contains unimplemented expression type +LL | 0 => 42, | ^ error[E0080]: evaluation of constant value failed --> $DIR/match-test-ptr-null.rs:7:13 | -LL | 0 => 42, //~ ERROR constant contains unimplemented expression type +LL | 0 => 42, | ^ "pointer arithmetic or comparison" needs an rfc before being allowed inside constants error: aborting due to 3 previous errors diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr index 9316d48ab431..c9a357d0f1bc 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/promoted_const_fn_fail.rs:20:27 | -LL | let x: &'static u8 = &(bar() + 1); //~ ERROR does not live long enough +LL | let x: &'static u8 = &(bar() + 1); | ^^^^^^^^^^^ temporary value does not live long enough ... LL | } diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr index 9d1dcfafa636..5a0654cc0c13 100644 --- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr +++ b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promoted_raw_ptr_ops.rs:6:30 | -LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough +LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough ... LL | } @@ -23,9 +23,9 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promoted_raw_ptr_ops.rs:7:28 | -LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough +LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough +LL | let a: &'static bool = &(main as fn() == main as fn()); LL | } | - temporary value only lives until here | @@ -34,7 +34,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promoted_raw_ptr_ops.rs:8:29 | -LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough +LL | let a: &'static bool = &(main as fn() == main as fn()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/const-eval/ref_to_int_match.stderr b/src/test/ui/consts/const-eval/ref_to_int_match.stderr index 888fe065a625..f8eafed68e43 100644 --- a/src/test/ui/consts/const-eval/ref_to_int_match.stderr +++ b/src/test/ui/consts/const-eval/ref_to_int_match.stderr @@ -1,7 +1,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ref_to_int_match.rs:23:1 | -LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; //~ ERROR it is undefined behavior to use this value +LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior @@ -9,7 +9,7 @@ LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; //~ ERROR it is undefined beh error: could not evaluate constant pattern --> $DIR/ref_to_int_match.rs:7:14 | -LL | 10..=BAR => {}, //~ ERROR could not evaluate constant pattern +LL | 10..=BAR => {}, | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-eval/shift_overflow.stderr b/src/test/ui/consts/const-eval/shift_overflow.stderr index e5c34f94d2c5..5db231cd5b0d 100644 --- a/src/test/ui/consts/const-eval/shift_overflow.stderr +++ b/src/test/ui/consts/const-eval/shift_overflow.stderr @@ -1,7 +1,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/shift_overflow.rs:3:9 | -LL | X = 1 << ((u32::max_value() as u64) + 1), //~ ERROR E0080 +LL | X = 1 << ((u32::max_value() as u64) + 1), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to shift left with overflow error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.stderr b/src/test/ui/consts/const-eval/transmute-const-promotion.stderr index 996e84de06dc..5829a1772d65 100644 --- a/src/test/ui/consts/const-eval/transmute-const-promotion.stderr +++ b/src/test/ui/consts/const-eval/transmute-const-promotion.stderr @@ -3,7 +3,7 @@ error[E0597]: borrowed value does not live long enough | LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) }; | ^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | //~^ ERROR value does not live long enough +LL | LL | } | - temporary value only lives until here | diff --git a/src/test/ui/consts/const-eval/ub-upvars.stderr b/src/test/ui/consts/const-eval/ub-upvars.stderr index d18339f2434a..21d2847db1e8 100644 --- a/src/test/ui/consts/const-eval/ub-upvars.stderr +++ b/src/test/ui/consts/const-eval/ub-upvars.stderr @@ -1,7 +1,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-upvars.rs:6:1 | -LL | / const BAD_UPVAR: &FnOnce() = &{ //~ ERROR it is undefined behavior to use this value +LL | / const BAD_UPVAR: &FnOnce() = &{ LL | | let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) }; LL | | let another_var = 13; LL | | move || { let _ = bad_ref; let _ = another_var; } diff --git a/src/test/ui/consts/const-eval/union-ice.stderr b/src/test/ui/consts/const-eval/union-ice.stderr index 3edc52415717..b25cb8c5aa02 100644 --- a/src/test/ui/consts/const-eval/union-ice.stderr +++ b/src/test/ui/consts/const-eval/union-ice.stderr @@ -1,7 +1,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/union-ice.rs:13:1 | -LL | const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR it is undefined behavior to use this value +LL | const FIELD3: Field3 = unsafe { UNION.field3 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior @@ -9,7 +9,7 @@ LL | const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR it is undefined b error[E0080]: it is undefined behavior to use this value --> $DIR/union-ice.rs:15:1 | -LL | / const FIELD_PATH: Struct = Struct { //~ ERROR it is undefined behavior to use this value +LL | / const FIELD_PATH: Struct = Struct { LL | | a: 42, LL | | b: unsafe { UNION.field3 }, LL | | }; @@ -20,7 +20,7 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/union-ice.rs:25:1 | -LL | / const FIELD_PATH2: Struct2 = Struct2 { //~ ERROR it is undefined behavior to use this value +LL | / const FIELD_PATH2: Struct2 = Struct2 { LL | | b: [ LL | | 21, LL | | unsafe { UNION.field3 }, diff --git a/src/test/ui/consts/const-eval/union_promotion.stderr b/src/test/ui/consts/const-eval/union_promotion.stderr index 643c784ca08f..c60f67181832 100644 --- a/src/test/ui/consts/const-eval/union_promotion.stderr +++ b/src/test/ui/consts/const-eval/union_promotion.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/union_promotion.rs:9:29 | -LL | let x: &'static bool = &unsafe { //~ borrowed value does not live long enough +LL | let x: &'static bool = &unsafe { | _____________________________^ LL | | Foo { a: &1 }.b == Foo { a: &2 }.b LL | | }; diff --git a/src/test/ui/consts/const-fn-not-safe-for-const.stderr b/src/test/ui/consts/const-fn-not-safe-for-const.stderr index 2003b137c272..a5e48074f704 100644 --- a/src/test/ui/consts/const-fn-not-safe-for-const.stderr +++ b/src/test/ui/consts/const-fn-not-safe-for-const.stderr @@ -1,7 +1,7 @@ error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants --> $DIR/const-fn-not-safe-for-const.rs:14:5 | -LL | random() //~ ERROR E0015 +LL | random() | ^^^^^^^^ error[E0013]: constant functions cannot refer to statics, use a constant instead diff --git a/src/test/ui/consts/const-int-conversion.stderr b/src/test/ui/consts/const-int-conversion.stderr index b216d41727b5..ddb1a75f1b75 100644 --- a/src/test/ui/consts/const-int-conversion.stderr +++ b/src/test/ui/consts/const-int-conversion.stderr @@ -69,7 +69,7 @@ error[E0597]: borrowed value does not live long enough | LL | let d: &'static [u8] = &(i32::min_value().to_be().to_ne_bytes()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | //~^ ERROR does not live long enough +LL | LL | } | - temporary value only lives until here | diff --git a/src/test/ui/consts/const-int-overflowing.stderr b/src/test/ui/consts/const-int-overflowing.stderr index 736909e09322..7228b5dbd4bf 100644 --- a/src/test/ui/consts/const-int-overflowing.stderr +++ b/src/test/ui/consts/const-int-overflowing.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/const-int-overflowing.rs:2:36 | -LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); //~ ERROR does not live long enough +LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough ... LL | } @@ -12,9 +12,9 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-overflowing.rs:3:36 | -LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); //~ ERROR does not live long enough +LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); LL | } | - temporary value only lives until here | @@ -23,7 +23,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-overflowing.rs:4:36 | -LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/const-int-rotate.stderr b/src/test/ui/consts/const-int-rotate.stderr index c15727961f9f..ec08e0a3f57d 100644 --- a/src/test/ui/consts/const-int-rotate.stderr +++ b/src/test/ui/consts/const-int-rotate.stderr @@ -1,9 +1,9 @@ error[E0597]: borrowed value does not live long enough --> $DIR/const-int-rotate.rs:2:28 | -LL | let x: &'static i32 = &(5_i32.rotate_left(3)); //~ ERROR does not live long enough +LL | let x: &'static i32 = &(5_i32.rotate_left(3)); | ^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.rotate_right(3)); LL | } | - temporary value only lives until here | @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-rotate.rs:3:28 | -LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.rotate_right(3)); | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/const-int-sign.stderr b/src/test/ui/consts/const-int-sign.stderr index 5a9a23af9d65..ffe09a0cfec0 100644 --- a/src/test/ui/consts/const-int-sign.stderr +++ b/src/test/ui/consts/const-int-sign.stderr @@ -1,9 +1,9 @@ error[E0597]: borrowed value does not live long enough --> $DIR/const-int-sign.rs:2:29 | -LL | let x: &'static bool = &(5_i32.is_negative()); //~ ERROR does not live long enough +LL | let x: &'static bool = &(5_i32.is_negative()); | ^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough +LL | let y: &'static bool = &(5_i32.is_positive()); LL | } | - temporary value only lives until here | @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-sign.rs:3:29 | -LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough +LL | let y: &'static bool = &(5_i32.is_positive()); | ^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/const-int-wrapping.stderr b/src/test/ui/consts/const-int-wrapping.stderr index ec9776b82119..478a6d80838d 100644 --- a/src/test/ui/consts/const-int-wrapping.stderr +++ b/src/test/ui/consts/const-int-wrapping.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/const-int-wrapping.rs:2:28 | -LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); //~ ERROR does not live long enough +LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough ... LL | } @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-wrapping.rs:3:28 | -LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough ... LL | } @@ -23,7 +23,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-wrapping.rs:4:28 | -LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough ... LL | } @@ -34,9 +34,9 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-wrapping.rs:5:28 | -LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); //~ ERROR does not live long enough +LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough +LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); LL | } | - temporary value only lives until here | @@ -45,7 +45,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-wrapping.rs:6:28 | -LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough +LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/const-pattern-irrefutable.stderr b/src/test/ui/consts/const-pattern-irrefutable.stderr index ee0d4d883740..48fe24df4d04 100644 --- a/src/test/ui/consts/const-pattern-irrefutable.stderr +++ b/src/test/ui/consts/const-pattern-irrefutable.stderr @@ -1,19 +1,19 @@ error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered --> $DIR/const-pattern-irrefutable.rs:12:9 | -LL | let a = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered +LL | let a = 4; | ^ interpreted as a constant pattern, not new variable error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered --> $DIR/const-pattern-irrefutable.rs:13:9 | -LL | let c = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered +LL | let c = 4; | ^ interpreted as a constant pattern, not new variable error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered --> $DIR/const-pattern-irrefutable.rs:14:9 | -LL | let d = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered +LL | let d = 4; | ^ interpreted as a constant pattern, not new variable error: aborting due to 3 previous errors diff --git a/src/test/ui/consts/const-prop-ice.stderr b/src/test/ui/consts/const-prop-ice.stderr index 749ef952b5dd..8ec54b4438dd 100644 --- a/src/test/ui/consts/const-prop-ice.stderr +++ b/src/test/ui/consts/const-prop-ice.stderr @@ -1,7 +1,7 @@ error: index out of bounds: the len is 3 but the index is 3 --> $DIR/const-prop-ice.rs:2:5 | -LL | [0; 3][3u64 as usize]; //~ ERROR the len is 3 but the index is 3 +LL | [0; 3][3u64 as usize]; | ^^^^^^^^^^^^^^^^^^^^^ | = note: #[deny(const_err)] on by default diff --git a/src/test/ui/consts/const-prop-ice2.stderr b/src/test/ui/consts/const-prop-ice2.stderr index 4febd0ee1e39..68a7164da3d3 100644 --- a/src/test/ui/consts/const-prop-ice2.stderr +++ b/src/test/ui/consts/const-prop-ice2.stderr @@ -1,7 +1,7 @@ error: index out of bounds: the len is 1 but the index is 1 --> $DIR/const-prop-ice2.rs:4:20 | -LL | println!("{}", xs[Enum::One as usize]); //~ ERROR the len is 1 but the index is 1 +LL | println!("{}", xs[Enum::One as usize]); | ^^^^^^^^^^^^^^^^^^^^^^ | = note: #[deny(const_err)] on by default diff --git a/src/test/ui/consts/const-ptr-nonnull.stderr b/src/test/ui/consts/const-ptr-nonnull.stderr index a9476dda6d32..a606bed1782b 100644 --- a/src/test/ui/consts/const-ptr-nonnull.stderr +++ b/src/test/ui/consts/const-ptr-nonnull.stderr @@ -14,7 +14,7 @@ error[E0597]: borrowed value does not live long enough | LL | let x: &'static NonNull = &(non_null.cast()); | ^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | } | - temporary value only lives until here | diff --git a/src/test/ui/consts/const-ptr-unique.stderr b/src/test/ui/consts/const-ptr-unique.stderr index 141465bf184d..482b78b2386f 100644 --- a/src/test/ui/consts/const-ptr-unique.stderr +++ b/src/test/ui/consts/const-ptr-unique.stderr @@ -3,7 +3,7 @@ error[E0597]: borrowed value does not live long enough | LL | let x: &'static *mut u32 = &(unique.as_ptr()); | ^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | } | - temporary value only lives until here | diff --git a/src/test/ui/consts/const_let_assign3.stderr b/src/test/ui/consts/const_let_assign3.stderr index 6649fb997cce..c0e978a0ab7a 100644 --- a/src/test/ui/consts/const_let_assign3.stderr +++ b/src/test/ui/consts/const_let_assign3.stderr @@ -7,7 +7,7 @@ LL | self.state = x; error[E0017]: references in constants may only refer to immutable values --> $DIR/const_let_assign3.rs:16:5 | -LL | s.foo(3); //~ ERROR references in constants may only refer to immutable values +LL | s.foo(3); | ^ constants require immutable values error[E0017]: references in constants may only refer to immutable values diff --git a/src/test/ui/consts/const_let_refutable.stderr b/src/test/ui/consts/const_let_refutable.stderr index c5d2ba02a70c..155c858af37e 100644 --- a/src/test/ui/consts/const_let_refutable.stderr +++ b/src/test/ui/consts/const_let_refutable.stderr @@ -1,7 +1,7 @@ error[E0005]: refutable pattern in function argument: `&[]` not covered --> $DIR/const_let_refutable.rs:3:16 | -LL | const fn slice([a, b]: &[i32]) -> i32 { //~ ERROR refutable pattern in function argument +LL | const fn slice([a, b]: &[i32]) -> i32 { | ^^^^^^ pattern `&[]` not covered error: aborting due to previous error diff --git a/src/test/ui/consts/dangling-alloc-id-ice.stderr b/src/test/ui/consts/dangling-alloc-id-ice.stderr index 2cd8711f03d3..87f84480bf66 100644 --- a/src/test/ui/consts/dangling-alloc-id-ice.stderr +++ b/src/test/ui/consts/dangling-alloc-id-ice.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/dangling-alloc-id-ice.rs:8:1 | -LL | / const FOO: &() = { //~ ERROR any use of this value will cause an error +LL | / const FOO: &() = { LL | | let y = (); LL | | unsafe { Foo { y: &y }.long_live_the_unit } LL | | }; diff --git a/src/test/ui/consts/dangling_raw_ptr.stderr b/src/test/ui/consts/dangling_raw_ptr.stderr index 091f1f785cb0..0168c08f011d 100644 --- a/src/test/ui/consts/dangling_raw_ptr.stderr +++ b/src/test/ui/consts/dangling_raw_ptr.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/dangling_raw_ptr.rs:1:1 | -LL | / const FOO: *const u32 = { //~ ERROR any use of this value will cause an error +LL | / const FOO: *const u32 = { LL | | let x = 42; LL | | &x LL | | }; diff --git a/src/test/ui/consts/issue-54224.stderr b/src/test/ui/consts/issue-54224.stderr index 451f49c1cb57..9b6638b228e7 100644 --- a/src/test/ui/consts/issue-54224.stderr +++ b/src/test/ui/consts/issue-54224.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/issue-54224.rs:3:39 | -LL | const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]); //~ ERROR temporary value dropped while borrowed +LL | const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]); | ------^^^^^^^^^- | | | | | | | temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/match_ice.stderr b/src/test/ui/consts/match_ice.stderr index d98402316959..e238fad43183 100644 --- a/src/test/ui/consts/match_ice.stderr +++ b/src/test/ui/consts/match_ice.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `&S` not covered --> $DIR/match_ice.rs:7:11 | -LL | match C { //~ ERROR non-exhaustive +LL | match C { | ^ pattern `&S` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr b/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr index 62f678790d21..b0cd57ba2eb4 100644 --- a/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr +++ b/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr @@ -1,7 +1,7 @@ error[E0723]: heap allocations are not allowed in const fn (see issue #57563) --> $DIR/bad_const_fn_body_ice.rs:2:5 | -LL | vec![1, 2, 3] //~ ERROR heap allocations are not allowed in const fn +LL | vec![1, 2, 3] | ^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr b/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr index d84e2651d4fc..0de41c65bec0 100644 --- a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr +++ b/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr @@ -1,7 +1,7 @@ error[E0723]: function pointers in const fn are unstable (see issue #57563) --> $DIR/cmp_fn_pointers.rs:1:14 | -LL | const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointers in const fn are unstable +LL | const fn cmp(x: fn(), y: fn()) -> bool { | ^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/loop_ice.stderr b/src/test/ui/consts/min_const_fn/loop_ice.stderr index 716e8380c45d..0d35e3635410 100644 --- a/src/test/ui/consts/min_const_fn/loop_ice.stderr +++ b/src/test/ui/consts/min_const_fn/loop_ice.stderr @@ -1,7 +1,7 @@ error[E0723]: loops are not allowed in const fn (see issue #57563) --> $DIR/loop_ice.rs:2:5 | -LL | loop {} //~ ERROR loops are not allowed in const fn +LL | loop {} | ^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.stderr index e095ccaf20e2..cdf6b1016b4b 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.stderr @@ -1,7 +1,7 @@ error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:37:25 | -LL | const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated +LL | const fn into_inner(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -15,7 +15,7 @@ LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 } error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:44:28 | -LL | const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated +LL | const fn into_inner_lt(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -29,7 +29,7 @@ LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:51:27 | -LL | const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors +LL | const fn into_inner_s(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -99,7 +99,7 @@ LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g } error[E0723]: cannot access `static` items in const fn (see issue #57563) --> $DIR/min_const_fn.rs:90:27 | -LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn +LL | const fn foo25() -> u32 { BAR } | ^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -107,7 +107,7 @@ LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in c error[E0723]: cannot access `static` items in const fn (see issue #57563) --> $DIR/min_const_fn.rs:91:36 | -LL | const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items +LL | const fn foo26() -> &'static u32 { &BAR } | ^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -155,7 +155,7 @@ LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } } error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563) --> $DIR/min_const_fn.rs:102:29 | -LL | const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn +LL | const fn foo30_5(b: bool) { while b { } } | ^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -227,7 +227,7 @@ LL | const fn no_apit2(_x: AlanTuring) {} error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563) --> $DIR/min_const_fn.rs:133:22 | -LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` +LL | const fn no_apit(_x: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -235,7 +235,7 @@ LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other error[E0723]: `impl Trait` in const fn is unstable (see issue #57563) --> $DIR/min_const_fn.rs:134:23 | -LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable +LL | const fn no_rpit() -> impl std::fmt::Debug {} | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -243,7 +243,7 @@ LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in con error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563) --> $DIR/min_const_fn.rs:135:23 | -LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` +LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} | ^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr index 1e6f698b3c8e..a8d0dc37e403 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr @@ -1,7 +1,7 @@ error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_fn_libstd_stability.rs:15:25 | -LL | const fn bar() -> u32 { foo() } //~ ERROR can only call other `min_const_fn` +LL | const fn bar() -> u32 { foo() } | ^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | const fn bar() -> u32 { foo() } //~ ERROR can only call other `min_const_fn error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_fn_libstd_stability.rs:22:26 | -LL | const fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min_const_fn` +LL | const fn bar2() -> u32 { foo2() } | ^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | const fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min_const_ error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563) --> $DIR/min_const_fn_libstd_stability.rs:26:26 | -LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` operations +LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } | ^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_fn_libstd_stability.rs:34:32 | -LL | const fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `min_const_fn` +LL | const fn bar2_gated() -> u32 { foo2_gated() } | ^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr index 95871749365f..48c260644a74 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr @@ -1,7 +1,7 @@ error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911) --> $DIR/min_const_fn_unsafe.rs:50:77 | -LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe +LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } | ^^^ | = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | Foo { x: () }.y error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block --> $DIR/min_const_fn_unsafe.rs:50:77 | -LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe +LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } | ^^^ dereference of raw pointer | = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr index 07d10984392d..5b2bee19acf9 100644 --- a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr @@ -1,7 +1,7 @@ error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability.rs:15:41 | -LL | const unsafe fn bar() -> u32 { unsafe { foo() } } //~ ERROR can only call other `min_const_fn` +LL | const unsafe fn bar() -> u32 { unsafe { foo() } } | ^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | const unsafe fn bar() -> u32 { unsafe { foo() } } //~ ERROR can only call o error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability.rs:22:42 | -LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } } //~ ERROR can only call other `min_const_fn` +LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } } | ^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } } //~ ERROR can only call error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability.rs:26:33 | -LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` op +LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } | ^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability.rs:34:48 | -LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } } //~ ERROR can only call other +LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } } | ^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr index 7cb8c6e62ec6..f7f630c9ae3f 100644 --- a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr @@ -1,7 +1,7 @@ error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:15:32 | -LL | const unsafe fn bar() -> u32 { foo() } //~ ERROR can only call other `min_const_fn` +LL | const unsafe fn bar() -> u32 { foo() } | ^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | const unsafe fn bar() -> u32 { foo() } //~ ERROR can only call other `min_c error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:22:33 | -LL | const unsafe fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min_const_fn` +LL | const unsafe fn bar2() -> u32 { foo2() } | ^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | const unsafe fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:30:39 | -LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `min_const_fn` +LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() } | ^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/mutable_borrow.stderr b/src/test/ui/consts/min_const_fn/mutable_borrow.stderr index e5a3502a3dc5..a2d67a041707 100644 --- a/src/test/ui/consts/min_const_fn/mutable_borrow.stderr +++ b/src/test/ui/consts/min_const_fn/mutable_borrow.stderr @@ -1,7 +1,7 @@ error[E0723]: mutable references in const fn are unstable (see issue #57563) --> $DIR/mutable_borrow.rs:3:9 | -LL | let b = &mut a; //~ ERROR mutable references in const fn +LL | let b = &mut a; | ^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | let b = &mut a; //~ ERROR mutable references in const fn error[E0723]: mutable references in const fn are unstable (see issue #57563) --> $DIR/mutable_borrow.rs:12:13 | -LL | let b = &mut a; //~ ERROR mutable references in const fn +LL | let b = &mut a; | ^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/promotion.stderr b/src/test/ui/consts/min_const_fn/promotion.stderr index 7052f68c3ec6..92d60f0c5854 100644 --- a/src/test/ui/consts/min_const_fn/promotion.stderr +++ b/src/test/ui/consts/min_const_fn/promotion.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/promotion.rs:11:27 | -LL | let x: &'static () = &foo1(); //~ ERROR does not live long enough +LL | let x: &'static () = &foo1(); | ^^^^^^ temporary value does not live long enough ... LL | } @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promotion.rs:12:28 | -LL | let y: &'static i32 = &foo2(42); //~ ERROR does not live long enough +LL | let y: &'static i32 = &foo2(42); | ^^^^^^^^ temporary value does not live long enough ... LL | } @@ -23,7 +23,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promotion.rs:13:28 | -LL | let z: &'static i32 = &foo3(); //~ ERROR does not live long enough +LL | let z: &'static i32 = &foo3(); | ^^^^^^ temporary value does not live long enough ... LL | } @@ -34,7 +34,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promotion.rs:14:34 | -LL | let a: &'static Cell = &foo4(); //~ ERROR does not live long enough +LL | let a: &'static Cell = &foo4(); | ^^^^^^ temporary value does not live long enough ... LL | } @@ -45,9 +45,9 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promotion.rs:15:42 | -LL | let a: &'static Option> = &foo5(); //~ ERROR does not live long enough +LL | let a: &'static Option> = &foo5(); | ^^^^^^ temporary value does not live long enough -LL | let a: &'static Option> = &foo6(); //~ ERROR does not live long enough +LL | let a: &'static Option> = &foo6(); LL | } | - temporary value only lives until here | @@ -56,7 +56,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promotion.rs:16:42 | -LL | let a: &'static Option> = &foo6(); //~ ERROR does not live long enough +LL | let a: &'static Option> = &foo6(); | ^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.stderr b/src/test/ui/consts/miri_unleashed/assoc_const.stderr index a40f8d46d0aa..e814303923e1 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const.stderr +++ b/src/test/ui/consts/miri_unleashed/assoc_const.stderr @@ -1,13 +1,13 @@ warning: skipping const checks --> $DIR/assoc_const.rs:12:31 | -LL | const F: u32 = (U::X, 42).1; //~ WARN skipping const checks +LL | const F: u32 = (U::X, 42).1; | ^ error[E0080]: erroneous constant used --> $DIR/assoc_const.rs:29:13 | -LL | let y = , String>>::F; //~ ERROR erroneous constant +LL | let y = , String>>::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors error: aborting due to previous error diff --git a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr index 77aab31d26ec..dbfe1d93aa40 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr +++ b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr @@ -1,7 +1,7 @@ error[E0080]: erroneous constant used --> $DIR/assoc_const_2.rs:27:13 | -LL | let y = >::F; //~ ERROR erroneous constant +LL | let y = >::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors error: aborting due to previous error diff --git a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr index e23ed1c62063..1fe3d33322fd 100644 --- a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr +++ b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr @@ -1,13 +1,13 @@ error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:11:20 | -LL | const F: u32 = (U::X, 42).1; //~ ERROR destructors cannot be evaluated at compile-time +LL | const F: u32 = (U::X, 42).1; | ^^^^^^^^^^ constants cannot evaluate destructors error: `>::new` is not yet stable as a const fn --> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:18:25 | -LL | const X: Vec = Vec::new(); //~ ERROR not yet stable as a const fn +LL | const X: Vec = Vec::new(); | ^^^^^^^^^^ | = help: add `#![feature(const_vec_new)]` to the crate attributes to enable diff --git a/src/test/ui/consts/partial_qualif.stderr b/src/test/ui/consts/partial_qualif.stderr index 967fb83b78b0..221e449b6f9a 100644 --- a/src/test/ui/consts/partial_qualif.stderr +++ b/src/test/ui/consts/partial_qualif.stderr @@ -1,7 +1,7 @@ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead --> $DIR/partial_qualif.rs:6:5 | -LL | &{a} //~ ERROR cannot borrow a constant which may contain interior mutability +LL | &{a} | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/projection_qualif.stderr b/src/test/ui/consts/projection_qualif.stderr index 410c51c4b54e..45679e3b962d 100644 --- a/src/test/ui/consts/projection_qualif.stderr +++ b/src/test/ui/consts/projection_qualif.stderr @@ -1,19 +1,19 @@ error[E0017]: references in constants may only refer to immutable values --> $DIR/projection_qualif.rs:6:27 | -LL | let b: *mut u32 = &mut a; //~ ERROR may only refer to immutable values +LL | let b: *mut u32 = &mut a; | ^^^^^^ constants require immutable values error[E0019]: constant contains unimplemented expression type --> $DIR/projection_qualif.rs:7:18 | -LL | unsafe { *b = 5; } //~ ERROR dereferencing raw pointers in constants +LL | unsafe { *b = 5; } | ^^^^^^ error[E0658]: dereferencing raw pointers in constants is unstable (see issue #51911) --> $DIR/projection_qualif.rs:7:18 | -LL | unsafe { *b = 5; } //~ ERROR dereferencing raw pointers in constants +LL | unsafe { *b = 5; } | ^^^^^^ | = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable diff --git a/src/test/ui/consts/promote_const_let.stderr b/src/test/ui/consts/promote_const_let.stderr index d37bd4918603..c4295776d0a7 100644 --- a/src/test/ui/consts/promote_const_let.stderr +++ b/src/test/ui/consts/promote_const_let.stderr @@ -1,7 +1,7 @@ error[E0597]: `y` does not live long enough --> $DIR/promote_const_let.rs:4:10 | -LL | &y //~ ERROR does not live long enough +LL | &y | ^ borrowed value does not live long enough LL | }; | - borrowed value only lives until here @@ -11,7 +11,7 @@ LL | }; error[E0597]: borrowed value does not live long enough --> $DIR/promote_const_let.rs:6:28 | -LL | let x: &'static u32 = &{ //~ ERROR does not live long enough +LL | let x: &'static u32 = &{ | ____________________________^ LL | | let y = 42; LL | | y diff --git a/src/test/ui/consts/qualif_overwrite.stderr b/src/test/ui/consts/qualif_overwrite.stderr index 30479139e314..fbaae711d7c0 100644 --- a/src/test/ui/consts/qualif_overwrite.stderr +++ b/src/test/ui/consts/qualif_overwrite.stderr @@ -1,7 +1,7 @@ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead --> $DIR/qualif_overwrite.rs:10:5 | -LL | &{a} //~ ERROR cannot borrow a constant which may contain interior mutability +LL | &{a} | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/qualif_overwrite_2.stderr b/src/test/ui/consts/qualif_overwrite_2.stderr index 8276db99a12c..a393c4e336d6 100644 --- a/src/test/ui/consts/qualif_overwrite_2.stderr +++ b/src/test/ui/consts/qualif_overwrite_2.stderr @@ -1,7 +1,7 @@ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead --> $DIR/qualif_overwrite_2.rs:8:5 | -LL | &{a.0} //~ ERROR cannot borrow a constant which may contain interior mutability +LL | &{a.0} | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/single_variant_match_ice.stderr b/src/test/ui/consts/single_variant_match_ice.stderr index 5272062ccfc1..bc80de4ce04a 100644 --- a/src/test/ui/consts/single_variant_match_ice.stderr +++ b/src/test/ui/consts/single_variant_match_ice.stderr @@ -1,19 +1,19 @@ error[E0019]: constant contains unimplemented expression type --> $DIR/single_variant_match_ice.rs:6:5 | -LL | Foo::Prob => 42, //~ ERROR unimplemented expression type +LL | Foo::Prob => 42, | ^^^^^^^^^ error[E0019]: constant contains unimplemented expression type --> $DIR/single_variant_match_ice.rs:10:5 | -LL | x => 42, //~ ERROR unimplemented expression type +LL | x => 42, | ^ error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563) --> $DIR/single_variant_match_ice.rs:18:13 | -LL | Prob => 0x1, //~ ERROR `if`, `match`, `&&` and `||` are not stable in const fn +LL | Prob => 0x1, | ^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/validate_never_arrays.stderr b/src/test/ui/consts/validate_never_arrays.stderr index b9d181a76dd9..7a7d81687335 100644 --- a/src/test/ui/consts/validate_never_arrays.stderr +++ b/src/test/ui/consts/validate_never_arrays.stderr @@ -1,7 +1,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/validate_never_arrays.rs:3:1 | -LL | const FOO: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior +LL | const FOO: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of an uninhabited type at . | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior diff --git a/src/test/ui/conversion-methods.stderr b/src/test/ui/conversion-methods.stderr index 33fff4a0f68e..b9662e760749 100644 --- a/src/test/ui/conversion-methods.stderr +++ b/src/test/ui/conversion-methods.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/conversion-methods.rs:5:41 | -LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—"; //~ ERROR mismatched types +LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—"; | ^^^^^^^^^^^^^^^^^^^^^ | | | expected struct `std::string::String`, found reference @@ -37,7 +37,7 @@ LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we sugge error[E0308]: mismatched types --> $DIR/conversion-methods.rs:12:47 | -LL | let _prove_piercing_earnest: Vec = &[1, 2, 3]; //~ ERROR mismatched types +LL | let _prove_piercing_earnest: Vec = &[1, 2, 3]; | ^^^^^^^^^^ | | | expected struct `std::vec::Vec`, found reference diff --git a/src/test/ui/cross/cross-borrow-trait.stderr b/src/test/ui/cross/cross-borrow-trait.stderr index 949b63ffbde6..b35f59658c04 100644 --- a/src/test/ui/cross/cross-borrow-trait.stderr +++ b/src/test/ui/cross/cross-borrow-trait.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/cross-borrow-trait.rs:10:22 | -LL | let _y: &Trait = x; //~ ERROR E0308 +LL | let _y: &Trait = x; | ^ | | | expected &dyn Trait, found struct `std::boxed::Box` diff --git a/src/test/ui/cross/cross-fn-cache-hole.stderr b/src/test/ui/cross/cross-fn-cache-hole.stderr index 2cd57e363d0d..3bedd0dac23b 100644 --- a/src/test/ui/cross/cross-fn-cache-hole.stderr +++ b/src/test/ui/cross/cross-fn-cache-hole.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `i32: Bar` is not satisfied --> $DIR/cross-fn-cache-hole.rs:15:1 | -LL | / fn vacuous() //~ ERROR the trait bound `i32: Bar` is not satisfied +LL | / fn vacuous() LL | | where i32: Foo LL | | { LL | | // ... the original intention was to check that we don't use that diff --git a/src/test/ui/custom-attribute-multisegment.stderr b/src/test/ui/custom-attribute-multisegment.stderr index 6f6a87dd1594..9ba9c00e55bc 100644 --- a/src/test/ui/custom-attribute-multisegment.stderr +++ b/src/test/ui/custom-attribute-multisegment.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: could not find `nonexistent` in `existent` --> $DIR/custom-attribute-multisegment.rs:7:13 | -LL | #[existent::nonexistent] //~ ERROR failed to resolve: could not find `nonexistent` in `existent` +LL | #[existent::nonexistent] | ^^^^^^^^^^^ could not find `nonexistent` in `existent` error: aborting due to previous error diff --git a/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr index 2c9d226cc9ef..e83c291c9bfe 100644 --- a/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr +++ b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr @@ -1,7 +1,7 @@ error[E0659]: `helper` is ambiguous (derive helper attribute vs any other name) --> $DIR/helper-attr-blocked-by-import-ambig.rs:9:3 | -LL | #[helper] //~ ERROR `helper` is ambiguous +LL | #[helper] | ^^^^^^ ambiguous name | note: `helper` could refer to the derive helper attribute defined here diff --git a/src/test/ui/custom-derive/issue-36935.stderr b/src/test/ui/custom-derive/issue-36935.stderr index d4c91546329a..2875bc5fce99 100644 --- a/src/test/ui/custom-derive/issue-36935.stderr +++ b/src/test/ui/custom-derive/issue-36935.stderr @@ -1,7 +1,7 @@ error: proc-macro derive panicked --> $DIR/issue-36935.rs:6:15 | -LL | #[derive(Foo, Bar)] //~ ERROR proc-macro derive panicked +LL | #[derive(Foo, Bar)] | ^^^ | = help: message: lolnope diff --git a/src/test/ui/custom_attribute.stderr b/src/test/ui/custom_attribute.stderr index 1100d82f8406..6608fb53c30d 100644 --- a/src/test/ui/custom_attribute.stderr +++ b/src/test/ui/custom_attribute.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/custom_attribute.rs:3:3 | -LL | #[foo] //~ ERROR The attribute `foo` +LL | #[foo] | ^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[foo] //~ ERROR The attribute `foo` error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/custom_attribute.rs:5:7 | -LL | #[foo] //~ ERROR The attribute `foo` +LL | #[foo] | ^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | #[foo] //~ ERROR The attribute `foo` error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/custom_attribute.rs:7:7 | -LL | #[foo] //~ ERROR The attribute `foo` +LL | #[foo] | ^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr b/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr index a25a1786e813..db6ee98bb7b1 100644 --- a/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr +++ b/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr @@ -1,7 +1,7 @@ error: OK --> $DIR/dep-graph-assoc-type-codegen.rs:28:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/dep-graph/dep-graph-caller-callee.stderr b/src/test/ui/dep-graph/dep-graph-caller-callee.stderr index d7bf63822579..2b1b7fe9a565 100644 --- a/src/test/ui/dep-graph/dep-graph-caller-callee.stderr +++ b/src/test/ui/dep-graph/dep-graph-caller-callee.stderr @@ -1,13 +1,13 @@ error: OK --> $DIR/dep-graph-caller-callee.rs:20:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `x::x` to `TypeckTables` --> $DIR/dep-graph-caller-callee.rs:31:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/dep-graph/dep-graph-struct-signature.stderr b/src/test/ui/dep-graph/dep-graph-struct-signature.stderr index d7d56f219b42..8736d1562473 100644 --- a/src/test/ui/dep-graph/dep-graph-struct-signature.stderr +++ b/src/test/ui/dep-graph/dep-graph-struct-signature.stderr @@ -1,133 +1,133 @@ error: no path from `WillChange` to `TypeOfItem` --> $DIR/dep-graph-struct-signature.rs:27:5 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `AssociatedItems` --> $DIR/dep-graph-struct-signature.rs:28:5 | -LL | #[rustc_then_this_would_need(AssociatedItems)] //~ ERROR no path +LL | #[rustc_then_this_would_need(AssociatedItems)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `TraitDefOfItem` --> $DIR/dep-graph-struct-signature.rs:29:5 | -LL | #[rustc_then_this_would_need(TraitDefOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TraitDefOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:35:5 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:36:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:39:5 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:40:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:45:5 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:52:5 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:60:9 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:62:9 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `TypeOfItem` --> $DIR/dep-graph-struct-signature.rs:67:5 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `TypeOfItem` --> $DIR/dep-graph-struct-signature.rs:74:5 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `FnSignature` --> $DIR/dep-graph-struct-signature.rs:80:5 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR no path +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `FnSignature` --> $DIR/dep-graph-struct-signature.rs:83:5 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR no path from `WillChange` +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `TypeckTables` --> $DIR/dep-graph-struct-signature.rs:84:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path from `WillChange` +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:31:9 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `FnSignature` --> $DIR/dep-graph-struct-signature.rs:76:9 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR no path +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:47:9 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:48:9 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:54:9 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:55:9 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 22 previous errors diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr index 2fa1e1edc872..2df4b9ec39d1 100644 --- a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr +++ b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr @@ -1,13 +1,13 @@ error: OK --> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:32:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `x::` to `TypeckTables` --> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:41:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr index 8670e7deb4cd..54125367f90c 100644 --- a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr +++ b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr @@ -1,13 +1,13 @@ error: no path from `x::` to `TypeckTables` --> $DIR/dep-graph-trait-impl-two-traits.rs:31:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `x::` to `TypeckTables` --> $DIR/dep-graph-trait-impl-two-traits.rs:40:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl.stderr b/src/test/ui/dep-graph/dep-graph-trait-impl.stderr index fe97846d6cc2..97072e74f429 100644 --- a/src/test/ui/dep-graph/dep-graph-trait-impl.stderr +++ b/src/test/ui/dep-graph/dep-graph-trait-impl.stderr @@ -1,31 +1,31 @@ error: OK --> $DIR/dep-graph-trait-impl.rs:27:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-trait-impl.rs:32:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-trait-impl.rs:37:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-trait-impl.rs:42:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `x::` to `TypeckTables` --> $DIR/dep-graph-trait-impl.rs:55:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/dep-graph/dep-graph-type-alias.stderr b/src/test/ui/dep-graph/dep-graph-type-alias.stderr index 72def33cbcf9..f54e511acc1f 100644 --- a/src/test/ui/dep-graph/dep-graph-type-alias.stderr +++ b/src/test/ui/dep-graph/dep-graph-type-alias.stderr @@ -1,73 +1,73 @@ error: no path from `TypeAlias` to `TypeOfItem` --> $DIR/dep-graph-type-alias.rs:17:1 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:19:5 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `TypeAlias` to `TypeOfItem` --> $DIR/dep-graph-type-alias.rs:24:1 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:27:9 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `TypeAlias` to `TypeOfItem` --> $DIR/dep-graph-type-alias.rs:33:1 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `TypeAlias` to `TypeOfItem` --> $DIR/dep-graph-type-alias.rs:41:1 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:48:1 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:51:1 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:52:1 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:35:5 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:43:5 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:44:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 12 previous errors diff --git a/src/test/ui/dep-graph/dep-graph-variance-alias.stderr b/src/test/ui/dep-graph/dep-graph-variance-alias.stderr index f7c7f01020d2..86cb0f9fe325 100644 --- a/src/test/ui/dep-graph/dep-graph-variance-alias.stderr +++ b/src/test/ui/dep-graph/dep-graph-variance-alias.stderr @@ -1,7 +1,7 @@ error: OK --> $DIR/dep-graph-variance-alias.rs:19:1 | -LL | #[rustc_then_this_would_need(ItemVariances)] //~ ERROR OK +LL | #[rustc_then_this_would_need(ItemVariances)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr b/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr index 94229386e5f5..a2cd196b21f8 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr +++ b/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr @@ -1,7 +1,7 @@ warning: macro_escape is a deprecated synonym for macro_use --> $DIR/deprecated-macro_escape-inner.rs:4:5 | -LL | #![macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use +LL | #![macro_escape] | ^^^^^^^^^^^^^^^^ | = help: consider an outer attribute, #[macro_use] mod ... diff --git a/src/test/ui/deprecation/deprecated-macro_escape.stderr b/src/test/ui/deprecation/deprecated-macro_escape.stderr index f0edd838874e..b76d6d73d972 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape.stderr +++ b/src/test/ui/deprecation/deprecated-macro_escape.stderr @@ -1,6 +1,6 @@ warning: macro_escape is a deprecated synonym for macro_use --> $DIR/deprecated-macro_escape.rs:3:1 | -LL | #[macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use +LL | #[macro_escape] | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/deprecation/deprecation-in-staged-api.stderr b/src/test/ui/deprecation/deprecation-in-staged-api.stderr index 3e64d756e7e6..6a8056ec2d9d 100644 --- a/src/test/ui/deprecation/deprecation-in-staged-api.stderr +++ b/src/test/ui/deprecation/deprecation-in-staged-api.stderr @@ -1,7 +1,7 @@ error: `#[deprecated]` cannot be used in staged api, use `#[rustc_deprecated]` instead --> $DIR/deprecation-in-staged-api.rs:8:1 | -LL | fn main() { } //~ERROR `#[deprecated]` cannot be used in staged api +LL | fn main() { } | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/deprecation/deprecation-lint-nested.stderr b/src/test/ui/deprecation/deprecation-lint-nested.stderr index b30da3493350..206e12cfb3ec 100644 --- a/src/test/ui/deprecation/deprecation-lint-nested.stderr +++ b/src/test/ui/deprecation/deprecation-lint-nested.stderr @@ -1,7 +1,7 @@ error: use of deprecated item 'loud::DeprecatedType' --> $DIR/deprecation-lint-nested.rs:55:16 | -LL | struct Foo(DeprecatedType); //~ ERROR use of deprecated item +LL | struct Foo(DeprecatedType); | ^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,31 +13,31 @@ LL | #![deny(deprecated)] error: use of deprecated item 'loud::DeprecatedTrait' --> $DIR/deprecation-lint-nested.rs:57:10 | -LL | impl DeprecatedTrait for Foo {} //~ ERROR use of deprecated item +LL | impl DeprecatedTrait for Foo {} | ^^^^^^^^^^^^^^^ error: use of deprecated item 'loud::DEPRECATED_STATIC' --> $DIR/deprecation-lint-nested.rs:66:9 | -LL | DEPRECATED_STATIC + //~ ERROR use of deprecated item +LL | DEPRECATED_STATIC + | ^^^^^^^^^^^^^^^^^ error: use of deprecated item 'loud::DEPRECATED_CONST' --> $DIR/deprecation-lint-nested.rs:67:9 | -LL | DEPRECATED_CONST //~ ERROR use of deprecated item +LL | DEPRECATED_CONST | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'loud::DeprecatedTrait' --> $DIR/deprecation-lint-nested.rs:60:19 | -LL | fn bar() { //~ ERROR use of deprecated item +LL | fn bar() { | ^^^^^^^^^^^^^^^ error: use of deprecated item 'loud::deprecated_fn' --> $DIR/deprecation-lint-nested.rs:61:13 | -LL | deprecated_fn(); //~ ERROR use of deprecated item +LL | deprecated_fn(); | ^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/deprecation/deprecation-lint.stderr b/src/test/ui/deprecation/deprecation-lint.stderr index c48d06e86154..50cbe3846bba 100644 --- a/src/test/ui/deprecation/deprecation-lint.stderr +++ b/src/test/ui/deprecation/deprecation-lint.stderr @@ -1,7 +1,7 @@ error: use of deprecated item 'deprecation_lint::deprecated': text --> $DIR/deprecation-lint.rs:17:9 | -LL | deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::deprecated' +LL | deprecated(); | ^^^^^^^^^^ | note: lint level defined here @@ -13,127 +13,127 @@ LL | #![deny(deprecated)] error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:22:9 | -LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:24:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::deprecated_text': text --> $DIR/deprecation-lint.rs:26:9 | -LL | deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_text': text +LL | deprecated_text(); | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:31:9 | -LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:33:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedStruct': text --> $DIR/deprecation-lint.rs:35:17 | -LL | let _ = DeprecatedStruct { //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedStruct': text +LL | let _ = DeprecatedStruct { | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedUnitStruct': text --> $DIR/deprecation-lint.rs:39:17 | -LL | let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedUnitStruct': text +LL | let _ = DeprecatedUnitStruct; | ^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Enum::DeprecatedVariant': text --> $DIR/deprecation-lint.rs:41:17 | -LL | let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'deprecation_lint::Enum::DeprecatedVariant': text +LL | let _ = Enum::DeprecatedVariant; | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedTupleStruct': text --> $DIR/deprecation-lint.rs:43:17 | -LL | let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedTupleStruct': text +LL | let _ = DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::nested::DeprecatedStruct': text --> $DIR/deprecation-lint.rs:45:17 | -LL | let _ = nested::DeprecatedStruct { //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedStruct': text +LL | let _ = nested::DeprecatedStruct { | ^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::nested::DeprecatedUnitStruct': text --> $DIR/deprecation-lint.rs:49:17 | -LL | let _ = nested::DeprecatedUnitStruct; //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedUnitStruct': text +LL | let _ = nested::DeprecatedUnitStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::nested::Enum::DeprecatedVariant': text --> $DIR/deprecation-lint.rs:51:17 | -LL | let _ = nested::Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'deprecation_lint::nested::Enum::DeprecatedVariant': text +LL | let _ = nested::Enum::DeprecatedVariant; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::nested::DeprecatedTupleStruct': text --> $DIR/deprecation-lint.rs:53:17 | -LL | let _ = nested::DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedTupleStruct': text +LL | let _ = nested::DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::deprecated_text': text --> $DIR/deprecation-lint.rs:60:25 | -LL | macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_text': text +LL | macro_test_arg!(deprecated_text()); | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::deprecated_text': text --> $DIR/deprecation-lint.rs:61:41 | -LL | macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_text': text +LL | macro_test_arg!(macro_test_arg!(deprecated_text())); | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:66:9 | -LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:68:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:70:9 | -LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:72:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedTrait': text --> $DIR/deprecation-lint.rs:82:10 | -LL | impl DeprecatedTrait for S {} //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedTrait': text +LL | impl DeprecatedTrait for S {} | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedTrait': text --> $DIR/deprecation-lint.rs:83:24 | -LL | trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedTrait': text +LL | trait LocalTrait : DeprecatedTrait { } | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Deprecated': text @@ -175,55 +175,55 @@ LL | let Deprecated2 error: use of deprecated item 'deprecation_lint::deprecated_mod::deprecated': text --> $DIR/deprecation-lint.rs:163:9 | -LL | deprecated_mod::deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_mod::deprecated': text +LL | deprecated_mod::deprecated(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::deprecated': text --> $DIR/deprecation-lint.rs:246:9 | -LL | deprecated(); //~ ERROR use of deprecated item 'this_crate::deprecated' +LL | deprecated(); | ^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:251:9 | -LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:253:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::deprecated_text': text --> $DIR/deprecation-lint.rs:255:9 | -LL | deprecated_text(); //~ ERROR use of deprecated item 'this_crate::deprecated_text': text +LL | deprecated_text(); | ^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:260:9 | -LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:262:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::deprecated_future': text --> $DIR/deprecation-lint.rs:265:9 | -LL | deprecated_future(); //~ ERROR use of deprecated item +LL | deprecated_future(); | ^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::deprecated_future_text': text --> $DIR/deprecation-lint.rs:266:9 | -LL | deprecated_future_text(); //~ ERROR use of deprecated item +LL | deprecated_future_text(); | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::DeprecatedStruct': text @@ -235,19 +235,19 @@ LL | let _ = DeprecatedStruct { error: use of deprecated item 'this_crate::DeprecatedUnitStruct': text --> $DIR/deprecation-lint.rs:273:17 | -LL | let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item 'this_crate::DeprecatedUnitStruct': text +LL | let _ = DeprecatedUnitStruct; | ^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Enum::DeprecatedVariant': text --> $DIR/deprecation-lint.rs:275:17 | -LL | let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'this_crate::Enum::DeprecatedVariant': text +LL | let _ = Enum::DeprecatedVariant; | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::DeprecatedTupleStruct': text --> $DIR/deprecation-lint.rs:277:17 | -LL | let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'this_crate::DeprecatedTupleStruct': text +LL | let _ = DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::nested::DeprecatedStruct': text @@ -259,61 +259,61 @@ LL | let _ = nested::DeprecatedStruct { error: use of deprecated item 'this_crate::nested::DeprecatedUnitStruct': text --> $DIR/deprecation-lint.rs:284:17 | -LL | let _ = nested::DeprecatedUnitStruct; //~ ERROR use of deprecated item 'this_crate::nested::DeprecatedUnitStruct': text +LL | let _ = nested::DeprecatedUnitStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::nested::Enum::DeprecatedVariant': text --> $DIR/deprecation-lint.rs:286:17 | -LL | let _ = nested::Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'this_crate::nested::Enum::DeprecatedVariant': text +LL | let _ = nested::Enum::DeprecatedVariant; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::nested::DeprecatedTupleStruct': text --> $DIR/deprecation-lint.rs:288:17 | -LL | let _ = nested::DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'this_crate::nested::DeprecatedTupleStruct': text +LL | let _ = nested::DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:293:9 | -LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:295:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:297:9 | -LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:299:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::test_fn_closure_body::{{closure}}::bar' --> $DIR/deprecation-lint.rs:317:13 | -LL | bar(); //~ ERROR use of deprecated item 'this_crate::test_fn_closure_body::{{closure}}::bar' +LL | bar(); | ^^^ error: use of deprecated item 'this_crate::DeprecatedTrait': text --> $DIR/deprecation-lint.rs:336:10 | -LL | impl DeprecatedTrait for S { } //~ ERROR use of deprecated item 'this_crate::DeprecatedTrait': text +LL | impl DeprecatedTrait for S { } | ^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::DeprecatedTrait': text --> $DIR/deprecation-lint.rs:338:24 | -LL | trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item 'this_crate::DeprecatedTrait': text +LL | trait LocalTrait : DeprecatedTrait { } | ^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate2::Deprecated': text @@ -355,109 +355,109 @@ LL | let Deprecated2 error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated': text --> $DIR/deprecation-lint.rs:18:13 | -LL | foo.method_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated' +LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated': text --> $DIR/deprecation-lint.rs:19:9 | -LL | Foo::method_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated' +LL | Foo::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated': text --> $DIR/deprecation-lint.rs:20:9 | -LL | ::method_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated' +LL | ::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:21:13 | -LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:23:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text --> $DIR/deprecation-lint.rs:27:13 | -LL | foo.method_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text +LL | foo.method_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text --> $DIR/deprecation-lint.rs:28:9 | -LL | Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text +LL | Foo::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text --> $DIR/deprecation-lint.rs:29:9 | -LL | ::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text +LL | ::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:30:13 | -LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:32:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedStruct::i': text --> $DIR/deprecation-lint.rs:36:13 | -LL | i: 0 //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedStruct::i': text +LL | i: 0 | ^^^^ error: use of deprecated item 'deprecation_lint::nested::DeprecatedStruct::i': text --> $DIR/deprecation-lint.rs:46:13 | -LL | i: 0 //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedStruct::i': text +LL | i: 0 | ^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:65:13 | -LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:67:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:69:13 | -LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:71:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:76:13 | -LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:77:13 | -LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Stable::override2': text @@ -547,109 +547,109 @@ LL | _) error: use of deprecated item 'this_crate::MethodTester::method_deprecated': text --> $DIR/deprecation-lint.rs:247:13 | -LL | foo.method_deprecated(); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated' +LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated': text --> $DIR/deprecation-lint.rs:248:9 | -LL | Foo::method_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated' +LL | Foo::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated': text --> $DIR/deprecation-lint.rs:249:9 | -LL | ::method_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated' +LL | ::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:250:13 | -LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:252:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text --> $DIR/deprecation-lint.rs:256:13 | -LL | foo.method_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text +LL | foo.method_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text --> $DIR/deprecation-lint.rs:257:9 | -LL | Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text +LL | Foo::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text --> $DIR/deprecation-lint.rs:258:9 | -LL | ::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text +LL | ::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:259:13 | -LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:261:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::DeprecatedStruct::i': text --> $DIR/deprecation-lint.rs:270:13 | -LL | i: 0 //~ ERROR use of deprecated item 'this_crate::DeprecatedStruct::i': text +LL | i: 0 | ^^^^ error: use of deprecated item 'this_crate::nested::DeprecatedStruct::i': text --> $DIR/deprecation-lint.rs:281:13 | -LL | i: 0 //~ ERROR use of deprecated item 'this_crate::nested::DeprecatedStruct::i': text +LL | i: 0 | ^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:292:13 | -LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:294:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:296:13 | -LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:298:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:303:13 | -LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:304:13 | -LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate2::Stable::override2': text diff --git a/src/test/ui/deprecation/deprecation-sanity.stderr b/src/test/ui/deprecation/deprecation-sanity.stderr index a071a4fc10d5..6d5e3d513632 100644 --- a/src/test/ui/deprecation/deprecation-sanity.stderr +++ b/src/test/ui/deprecation/deprecation-sanity.stderr @@ -1,55 +1,55 @@ error[E0541]: unknown meta item 'reason' --> $DIR/deprecation-sanity.rs:4:43 | -LL | #[deprecated(since = "a", note = "a", reason)] //~ ERROR unknown meta item 'reason' +LL | #[deprecated(since = "a", note = "a", reason)] | ^^^^^^ expected one of `since`, `note` error[E0551]: incorrect meta item --> $DIR/deprecation-sanity.rs:7:31 | -LL | #[deprecated(since = "a", note)] //~ ERROR incorrect meta item +LL | #[deprecated(since = "a", note)] | ^^^^ error[E0551]: incorrect meta item --> $DIR/deprecation-sanity.rs:10:18 | -LL | #[deprecated(since, note = "a")] //~ ERROR incorrect meta item +LL | #[deprecated(since, note = "a")] | ^^^^^ error[E0551]: incorrect meta item --> $DIR/deprecation-sanity.rs:13:31 | -LL | #[deprecated(since = "a", note(b))] //~ ERROR incorrect meta item +LL | #[deprecated(since = "a", note(b))] | ^^^^^^^ error[E0551]: incorrect meta item --> $DIR/deprecation-sanity.rs:16:18 | -LL | #[deprecated(since(b), note = "a")] //~ ERROR incorrect meta item +LL | #[deprecated(since(b), note = "a")] | ^^^^^^^^ error[E0565]: literal in `deprecated` value must be a string --> $DIR/deprecation-sanity.rs:19:25 | -LL | #[deprecated(note = b"test")] //~ ERROR literal in `deprecated` value must be a string +LL | #[deprecated(note = b"test")] | ^^^^^^^ help: consider removing the prefix: `"test"` error[E0565]: item in `deprecated` must be a key/value pair --> $DIR/deprecation-sanity.rs:22:18 | -LL | #[deprecated("test")] //~ ERROR item in `deprecated` must be a key/value pair +LL | #[deprecated("test")] | ^^^^^^ error[E0550]: multiple deprecated attributes --> $DIR/deprecation-sanity.rs:28:1 | -LL | fn multiple1() { } //~ ERROR multiple deprecated attributes +LL | fn multiple1() { } | ^^^^^^^^^^^^^^^^^^ error[E0538]: multiple 'since' items --> $DIR/deprecation-sanity.rs:30:27 | -LL | #[deprecated(since = "a", since = "b", note = "c")] //~ ERROR multiple 'since' items +LL | #[deprecated(since = "a", since = "b", note = "c")] | ^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/deprecation/invalid-literal.stderr b/src/test/ui/deprecation/invalid-literal.stderr index f13d599c0b13..28bc2e2c2d8f 100644 --- a/src/test/ui/deprecation/invalid-literal.stderr +++ b/src/test/ui/deprecation/invalid-literal.stderr @@ -1,7 +1,7 @@ error: attribute must be of the form `#[deprecated]` or `#[deprecated(/*opt*/ since = "version", /*opt*/ note = "reason)]` or `#[deprecated = "reason"]` --> $DIR/invalid-literal.rs:1:1 | -LL | #[deprecated = b"test"] //~ ERROR attribute must be of the form +LL | #[deprecated = b"test"] | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/deprecation/rustc_deprecation-in-future.stderr b/src/test/ui/deprecation/rustc_deprecation-in-future.stderr index bd8ade16ec0e..4bbe79b55b32 100644 --- a/src/test/ui/deprecation/rustc_deprecation-in-future.stderr +++ b/src/test/ui/deprecation/rustc_deprecation-in-future.stderr @@ -1,7 +1,7 @@ error: use of item 'S' that will be deprecated in future version 99.99.99: effectively never --> $DIR/rustc_deprecation-in-future.rs:14:13 | -LL | let _ = S; //~ ERROR use of item 'S' that will be deprecated in future version 99.99.99: effectively never +LL | let _ = S; | ^ | note: lint level defined here diff --git a/src/test/ui/deref-non-pointer.stderr b/src/test/ui/deref-non-pointer.stderr index 0852311b7b16..1297e496bcb3 100644 --- a/src/test/ui/deref-non-pointer.stderr +++ b/src/test/ui/deref-non-pointer.stderr @@ -1,7 +1,7 @@ error[E0614]: type `{integer}` cannot be dereferenced --> $DIR/deref-non-pointer.rs:2:9 | -LL | match *1 { //~ ERROR: cannot be dereferenced +LL | match *1 { | ^^ error: aborting due to previous error diff --git a/src/test/ui/deref-suggestion.stderr b/src/test/ui/deref-suggestion.stderr index 99e2b38c3f0d..8f061b3416e1 100644 --- a/src/test/ui/deref-suggestion.stderr +++ b/src/test/ui/deref-suggestion.stderr @@ -49,7 +49,7 @@ LL | foo(&mut "aaa".to_owned()); error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:2:20 | -LL | ($x:expr) => { &$x } //~ ERROR mismatched types +LL | ($x:expr) => { &$x } | ^^^ expected u32, found &{integer} ... LL | foo3(borrow!(0)); diff --git a/src/test/ui/derive-uninhabited-enum-38885.stderr b/src/test/ui/derive-uninhabited-enum-38885.stderr index 8930b1f1974f..941c98b5506b 100644 --- a/src/test/ui/derive-uninhabited-enum-38885.stderr +++ b/src/test/ui/derive-uninhabited-enum-38885.stderr @@ -1,7 +1,7 @@ warning: enum is never used: `Void` --> $DIR/derive-uninhabited-enum-38885.rs:8:1 | -LL | enum Void {} //~ WARN never used +LL | enum Void {} | ^^^^^^^^^ | = note: `-W dead-code` implied by `-W unused` @@ -9,6 +9,6 @@ LL | enum Void {} //~ WARN never used warning: enum is never used: `Foo` --> $DIR/derive-uninhabited-enum-38885.rs:11:1 | -LL | enum Foo { //~ WARN never used +LL | enum Foo { | ^^^^^^^^ diff --git a/src/test/ui/derived-errors/issue-30580.stderr b/src/test/ui/derived-errors/issue-30580.stderr index d4829ad2a1af..14c575f2699a 100644 --- a/src/test/ui/derived-errors/issue-30580.stderr +++ b/src/test/ui/derived-errors/issue-30580.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `c` on type `&Foo` --> $DIR/issue-30580.rs:12:11 | -LL | b.c; //~ ERROR no field `c` on type `&Foo` +LL | b.c; | ^ error: aborting due to previous error diff --git a/src/test/ui/derived-errors/issue-31997.stderr b/src/test/ui/derived-errors/issue-31997.stderr index 246e6f6465cd..dbceba046e2a 100644 --- a/src/test/ui/derived-errors/issue-31997.stderr +++ b/src/test/ui/derived-errors/issue-31997.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `bar` in this scope --> $DIR/issue-31997.rs:13:21 | -LL | try!(closure(|| bar(0 as *mut _))); //~ ERROR cannot find function `bar` in this scope +LL | try!(closure(|| bar(0 as *mut _))); | ^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/derives/derive-assoc-type-not-impl.stderr b/src/test/ui/derives/derive-assoc-type-not-impl.stderr index 1b25231677c7..b9e175e43d1c 100644 --- a/src/test/ui/derives/derive-assoc-type-not-impl.stderr +++ b/src/test/ui/derives/derive-assoc-type-not-impl.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `clone` found for type `Bar` in the curr LL | struct Bar { | ------------------ method `clone` not found for this ... -LL | Bar:: { x: 1 }.clone(); //~ ERROR +LL | Bar:: { x: 1 }.clone(); | ^^^^^ | = note: the method `clone` exists but the following trait bounds were not satisfied: 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 deb1cbd89b87..7db5fbe3de40 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,7 +1,7 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied --> $DIR/derives-span-Clone-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error` | = note: required by `std::clone::Clone::clone` diff --git a/src/test/ui/derives/derives-span-Clone-enum.stderr b/src/test/ui/derives/derives-span-Clone-enum.stderr index de043cd28aa6..4371dc900ac1 100644 --- a/src/test/ui/derives/derives-span-Clone-enum.stderr +++ b/src/test/ui/derives/derives-span-Clone-enum.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied --> $DIR/derives-span-Clone-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::clone::Clone` is not implemented for `Error` | = note: required by `std::clone::Clone::clone` diff --git a/src/test/ui/derives/derives-span-Clone-struct.stderr b/src/test/ui/derives/derives-span-Clone-struct.stderr index dd6fa9706c2c..cc3b602c9c0b 100644 --- a/src/test/ui/derives/derives-span-Clone-struct.stderr +++ b/src/test/ui/derives/derives-span-Clone-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied --> $DIR/derives-span-Clone-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error` | = note: required by `std::clone::Clone::clone` 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 5258240fc1f3..b2bf3527b0cc 100644 --- a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied --> $DIR/derives-span-Clone-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::clone::Clone` is not implemented for `Error` | = note: required by `std::clone::Clone::clone` 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 c981c20b762e..ca5bcfe930d6 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,7 +1,7 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` --> $DIR/derives-span-Debug-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ `Error` cannot be formatted using `{:?}` | = help: the trait `std::fmt::Debug` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Debug-enum.stderr b/src/test/ui/derives/derives-span-Debug-enum.stderr index 02cfe20616cd..cd367a334fc6 100644 --- a/src/test/ui/derives/derives-span-Debug-enum.stderr +++ b/src/test/ui/derives/derives-span-Debug-enum.stderr @@ -1,7 +1,7 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` --> $DIR/derives-span-Debug-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ `Error` cannot be formatted using `{:?}` | = help: the trait `std::fmt::Debug` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Debug-struct.stderr b/src/test/ui/derives/derives-span-Debug-struct.stderr index 5fe7d846b4c2..e00695ec0ba6 100644 --- a/src/test/ui/derives/derives-span-Debug-struct.stderr +++ b/src/test/ui/derives/derives-span-Debug-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` --> $DIR/derives-span-Debug-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ `Error` cannot be formatted using `{:?}` | = help: the trait `std::fmt::Debug` is not implemented for `Error` 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 9088b9e83b0c..37440b59ae70 100644 --- a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` --> $DIR/derives-span-Debug-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ `Error` cannot be formatted using `{:?}` | = help: the trait `std::fmt::Debug` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Default-struct.stderr b/src/test/ui/derives/derives-span-Default-struct.stderr index 1ad7cd454773..413d4ec8c291 100644 --- a/src/test/ui/derives/derives-span-Default-struct.stderr +++ b/src/test/ui/derives/derives-span-Default-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::default::Default` is not satisfied --> $DIR/derives-span-Default-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::default::Default` is not implemented for `Error` | = note: required by `std::default::Default::default` 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 447bc73ceb40..8f4d43daa519 100644 --- a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::default::Default` is not satisfied --> $DIR/derives-span-Default-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::default::Default` is not implemented for `Error` | = note: required by `std::default::Default::default` 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 e8bcec466550..52ecce4632d1 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,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied --> $DIR/derives-span-Eq-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` | = note: required by `std::cmp::AssertParamIsEq` diff --git a/src/test/ui/derives/derives-span-Eq-enum.stderr b/src/test/ui/derives/derives-span-Eq-enum.stderr index 95ff08a4332c..bf91a0edc375 100644 --- a/src/test/ui/derives/derives-span-Eq-enum.stderr +++ b/src/test/ui/derives/derives-span-Eq-enum.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied --> $DIR/derives-span-Eq-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` | = note: required by `std::cmp::AssertParamIsEq` diff --git a/src/test/ui/derives/derives-span-Eq-struct.stderr b/src/test/ui/derives/derives-span-Eq-struct.stderr index 44bbcf73dd77..531e8887cd2b 100644 --- a/src/test/ui/derives/derives-span-Eq-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied --> $DIR/derives-span-Eq-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` | = note: required by `std::cmp::AssertParamIsEq` 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 26228b389131..9e21c6c67bfc 100644 --- a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied --> $DIR/derives-span-Eq-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` | = note: required by `std::cmp::AssertParamIsEq` 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 324f2f1fd6d1..417c720c63e9 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,7 +1,7 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied --> $DIR/derives-span-Hash-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::hash::Hash` is not implemented for `Error` | = note: required by `std::hash::Hash::hash` diff --git a/src/test/ui/derives/derives-span-Hash-enum.stderr b/src/test/ui/derives/derives-span-Hash-enum.stderr index da44a8f498ea..25be8794889f 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied --> $DIR/derives-span-Hash-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::hash::Hash` is not implemented for `Error` | = note: required by `std::hash::Hash::hash` diff --git a/src/test/ui/derives/derives-span-Hash-struct.stderr b/src/test/ui/derives/derives-span-Hash-struct.stderr index 17d45e4b0dd2..c0574453a7a6 100644 --- a/src/test/ui/derives/derives-span-Hash-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied --> $DIR/derives-span-Hash-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::hash::Hash` is not implemented for `Error` | = note: required by `std::hash::Hash::hash` 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 e0e5cce107f9..6339c38578eb 100644 --- a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied --> $DIR/derives-span-Hash-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::hash::Hash` is not implemented for `Error` | = note: required by `std::hash::Hash::hash` 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 149a9475f103..5c0d4e4ebe91 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,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied --> $DIR/derives-span-Ord-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` | = note: required by `std::cmp::Ord::cmp` diff --git a/src/test/ui/derives/derives-span-Ord-enum.stderr b/src/test/ui/derives/derives-span-Ord-enum.stderr index 17ab75549e46..56268a237450 100644 --- a/src/test/ui/derives/derives-span-Ord-enum.stderr +++ b/src/test/ui/derives/derives-span-Ord-enum.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied --> $DIR/derives-span-Ord-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` | = note: required by `std::cmp::Ord::cmp` diff --git a/src/test/ui/derives/derives-span-Ord-struct.stderr b/src/test/ui/derives/derives-span-Ord-struct.stderr index 7088f8fc8901..40dc3d09dad7 100644 --- a/src/test/ui/derives/derives-span-Ord-struct.stderr +++ b/src/test/ui/derives/derives-span-Ord-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied --> $DIR/derives-span-Ord-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` | = note: required by `std::cmp::Ord::cmp` 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 5c046366993f..4a9dea8c12e9 100644 --- a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied --> $DIR/derives-span-Ord-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` | = note: required by `std::cmp::Ord::cmp` 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 7683402d8aaa..ed5468cc4dac 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,7 +1,7 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` @@ -9,7 +9,7 @@ LL | x: Error //~ ERROR error[E0369]: binary operation `!=` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` diff --git a/src/test/ui/derives/derives-span-PartialEq-enum.stderr b/src/test/ui/derives/derives-span-PartialEq-enum.stderr index 9fa1a2bf17a6..06a88c03f58a 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-enum.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` @@ -9,7 +9,7 @@ LL | Error //~ ERROR error[E0369]: binary operation `!=` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` diff --git a/src/test/ui/derives/derives-span-PartialEq-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-struct.stderr index 4a08c985b4a0..b8481048361e 100644 --- a/src/test/ui/derives/derives-span-PartialEq-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-struct.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` @@ -9,7 +9,7 @@ LL | x: Error //~ ERROR error[E0369]: binary operation `!=` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` 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 850eab4f0880..4398d2521255 100644 --- a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` @@ -9,7 +9,7 @@ LL | Error //~ ERROR error[E0369]: binary operation `!=` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` 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 0c359629d789..ac9f45046353 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,7 +1,7 @@ error[E0277]: can't compare `Error` with `Error` --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` | = help: the trait `std::cmp::PartialOrd` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr index e4036a540db2..3e684aef39f2 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr @@ -1,7 +1,7 @@ error[E0277]: can't compare `Error` with `Error` --> $DIR/derives-span-PartialOrd-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ no implementation for `Error < Error` and `Error > Error` | = help: the trait `std::cmp::PartialOrd` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr index 5c77a05e9d04..10659aac6421 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: can't compare `Error` with `Error` --> $DIR/derives-span-PartialOrd-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` | = help: the trait `std::cmp::PartialOrd` is not implemented for `Error` 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 e38a0424b3d7..cbe05e378405 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: can't compare `Error` with `Error` --> $DIR/derives-span-PartialOrd-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ no implementation for `Error < Error` and `Error > Error` | = help: the trait `std::cmp::PartialOrd` is not implemented for `Error` diff --git a/src/test/ui/derives/deriving-copyclone.stderr b/src/test/ui/derives/deriving-copyclone.stderr index 0a9fdd34fe2e..e6060c269e10 100644 --- a/src/test/ui/derives/deriving-copyclone.stderr +++ b/src/test/ui/derives/deriving-copyclone.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `C: std::marker::Copy` is not satisfied --> $DIR/deriving-copyclone.rs:31:5 | -LL | is_copy(B { a: 1, b: C }); //~ERROR Copy +LL | is_copy(B { a: 1, b: C }); | ^^^^^^^ the trait `std::marker::Copy` is not implemented for `C` | = note: required because of the requirements on the impl of `std::marker::Copy` for `B` @@ -14,7 +14,7 @@ LL | fn is_copy(_: T) {} error[E0277]: the trait bound `C: std::clone::Clone` is not satisfied --> $DIR/deriving-copyclone.rs:32:5 | -LL | is_clone(B { a: 1, b: C }); //~ERROR Clone +LL | is_clone(B { a: 1, b: C }); | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `C` | = note: required because of the requirements on the impl of `std::clone::Clone` for `B` @@ -27,7 +27,7 @@ LL | fn is_clone(_: T) {} error[E0277]: the trait bound `D: std::marker::Copy` is not satisfied --> $DIR/deriving-copyclone.rs:35:5 | -LL | is_copy(B { a: 1, b: D }); //~ERROR Copy +LL | is_copy(B { a: 1, b: D }); | ^^^^^^^ the trait `std::marker::Copy` is not implemented for `D` | = note: required because of the requirements on the impl of `std::marker::Copy` for `B` diff --git a/src/test/ui/derives/deriving-meta-empty-trait-list.stderr b/src/test/ui/derives/deriving-meta-empty-trait-list.stderr index 191bb780f7e1..f8414b6e65e6 100644 --- a/src/test/ui/derives/deriving-meta-empty-trait-list.stderr +++ b/src/test/ui/derives/deriving-meta-empty-trait-list.stderr @@ -1,6 +1,6 @@ warning: empty trait list in `derive` --> $DIR/deriving-meta-empty-trait-list.rs:3:1 | -LL | #[derive()] //~ WARNING empty trait list in `derive` +LL | #[derive()] | ^^^^^^^^^^^ diff --git a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr index 02ea6321eb8f..3206eecbe30e 100644 --- a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr +++ b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `==` cannot be applied to type `NoCloneOrEq` --> $DIR/deriving-no-inner-impl-error-message.rs:5:5 | -LL | x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq` +LL | x: NoCloneOrEq | ^^^^^^^^^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `NoCloneOrEq` @@ -9,7 +9,7 @@ LL | x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to typ error[E0369]: binary operation `!=` cannot be applied to type `NoCloneOrEq` --> $DIR/deriving-no-inner-impl-error-message.rs:5:5 | -LL | x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq` +LL | x: NoCloneOrEq | ^^^^^^^^^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `NoCloneOrEq` diff --git a/src/test/ui/derives/deriving-non-type.stderr b/src/test/ui/derives/deriving-non-type.stderr index 98594542653c..563e76dc6094 100644 --- a/src/test/ui/derives/deriving-non-type.stderr +++ b/src/test/ui/derives/deriving-non-type.stderr @@ -1,55 +1,55 @@ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:5:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:8:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:11:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:14:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:17:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:20:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:23:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:26:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:29:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/derives/deriving-primitive.stderr b/src/test/ui/derives/deriving-primitive.stderr index 377f4e870822..d1b444976ddc 100644 --- a/src/test/ui/derives/deriving-primitive.stderr +++ b/src/test/ui/derives/deriving-primitive.stderr @@ -1,7 +1,7 @@ error: cannot find derive macro `FromPrimitive` in this scope --> $DIR/deriving-primitive.rs:1:10 | -LL | #[derive(FromPrimitive)] //~ ERROR cannot find derive macro `FromPrimitive` in this scope +LL | #[derive(FromPrimitive)] | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/destructure-trait-ref.stderr b/src/test/ui/destructure-trait-ref.stderr index 4c93a6781eab..8fc2b76eb111 100644 --- a/src/test/ui/destructure-trait-ref.stderr +++ b/src/test/ui/destructure-trait-ref.stderr @@ -1,19 +1,19 @@ error[E0033]: type `&dyn T` cannot be dereferenced --> $DIR/destructure-trait-ref.rs:26:9 | -LL | let &x = &1isize as &T; //~ ERROR type `&dyn T` cannot be dereferenced +LL | let &x = &1isize as &T; | ^^ type `&dyn T` cannot be dereferenced error[E0033]: type `&dyn T` cannot be dereferenced --> $DIR/destructure-trait-ref.rs:27:10 | -LL | let &&x = &(&1isize as &T); //~ ERROR type `&dyn T` cannot be dereferenced +LL | let &&x = &(&1isize as &T); | ^^ type `&dyn T` cannot be dereferenced error[E0033]: type `std::boxed::Box` cannot be dereferenced --> $DIR/destructure-trait-ref.rs:28:9 | -LL | let box x = box 1isize as Box; //~ ERROR type `std::boxed::Box` cannot be dereferenced +LL | let box x = box 1isize as Box; | ^^^^^ type `std::boxed::Box` cannot be dereferenced error[E0308]: mismatched types diff --git a/src/test/ui/did_you_mean/E0178.stderr b/src/test/ui/did_you_mean/E0178.stderr index ad9bb57c922a..44e6ddd0eac8 100644 --- a/src/test/ui/did_you_mean/E0178.stderr +++ b/src/test/ui/did_you_mean/E0178.stderr @@ -1,25 +1,25 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` --> $DIR/E0178.rs:4:8 | -LL | w: &'a Foo + Copy, //~ ERROR expected a path +LL | w: &'a Foo + Copy, | ^^^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + Copy)` error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` --> $DIR/E0178.rs:5:8 | -LL | x: &'a Foo + 'a, //~ ERROR expected a path +LL | x: &'a Foo + 'a, | ^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + 'a)` error[E0178]: expected a path on the left-hand side of `+`, not `&'a mut Foo` --> $DIR/E0178.rs:6:8 | -LL | y: &'a mut Foo + 'a, //~ ERROR expected a path +LL | y: &'a mut Foo + 'a, | ^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'a mut (Foo + 'a)` error[E0178]: expected a path on the left-hand side of `+`, not `fn() -> Foo` --> $DIR/E0178.rs:7:8 | -LL | z: fn() -> Foo + 'a, //~ ERROR expected a path +LL | z: fn() -> Foo + 'a, | ^^^^^^^^^^^^^^^^ perhaps you forgot parentheses? error: aborting due to 4 previous errors diff --git a/src/test/ui/did_you_mean/issue-31424.stderr b/src/test/ui/did_you_mean/issue-31424.stderr index 1442666ef66a..7c351ea9bfe1 100644 --- a/src/test/ui/did_you_mean/issue-31424.stderr +++ b/src/test/ui/did_you_mean/issue-31424.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable argument `self` as mutable --> $DIR/issue-31424.rs:7:15 | -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | (&mut self).bar(); | ^^^^ | | | cannot reborrow mutably @@ -12,8 +12,8 @@ warning: function cannot return without recursing | LL | fn bar(self: &mut Self) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -LL | //~^ WARN function cannot return without recursing -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | +LL | (&mut self).bar(); | ----------------- recursive call site | = note: #[warn(unconditional_recursion)] on by default @@ -22,11 +22,11 @@ LL | (&mut self).bar(); //~ ERROR cannot borrow error[E0596]: cannot borrow immutable argument `self` as mutable --> $DIR/issue-31424.rs:14:15 | -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | (&mut self).bar(); | ^^^^ cannot borrow mutably help: consider removing the `&mut`, as it is an immutable binding to a mutable reference | -LL | self.bar(); //~ ERROR cannot borrow +LL | self.bar(); | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/did_you_mean/issue-34126.stderr b/src/test/ui/did_you_mean/issue-34126.stderr index 05ea4ef91ce4..536e295181ac 100644 --- a/src/test/ui/did_you_mean/issue-34126.stderr +++ b/src/test/ui/did_you_mean/issue-34126.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable argument `self` as mutable --> $DIR/issue-34126.rs:6:23 | -LL | self.run(&mut self); //~ ERROR cannot borrow +LL | self.run(&mut self); | ^^^^ | | | cannot reborrow mutably diff --git a/src/test/ui/did_you_mean/issue-34337.stderr b/src/test/ui/did_you_mean/issue-34337.stderr index 4bf988b72cd0..353f409b0740 100644 --- a/src/test/ui/did_you_mean/issue-34337.stderr +++ b/src/test/ui/did_you_mean/issue-34337.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable local variable `key` as mutable --> $DIR/issue-34337.rs:6:14 | -LL | get(&mut key); //~ ERROR cannot borrow +LL | get(&mut key); | ^^^ | | | cannot reborrow mutably diff --git a/src/test/ui/did_you_mean/issue-35937.stderr b/src/test/ui/did_you_mean/issue-35937.stderr index 7499a9475e88..1e70f986e83d 100644 --- a/src/test/ui/did_you_mean/issue-35937.stderr +++ b/src/test/ui/did_you_mean/issue-35937.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow field `f.v` of immutable binding as mutable | LL | let f = Foo { v: Vec::new() }; | - help: make this binding mutable: `mut f` -LL | f.v.push("cat".to_string()); //~ ERROR cannot borrow +LL | f.v.push("cat".to_string()); | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `s.x` of immutable binding @@ -11,7 +11,7 @@ error[E0594]: cannot assign to field `s.x` of immutable binding | LL | let s = S { x: 42 }; | - help: make this binding mutable: `mut s` -LL | s.x += 1; //~ ERROR cannot assign +LL | s.x += 1; | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `s.x` of immutable binding @@ -19,7 +19,7 @@ error[E0594]: cannot assign to field `s.x` of immutable binding | LL | fn bar(s: S) { | - help: make this binding mutable: `mut s` -LL | s.x += 1; //~ ERROR cannot assign +LL | s.x += 1; | ^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to 3 previous errors diff --git a/src/test/ui/did_you_mean/issue-36798.stderr b/src/test/ui/did_you_mean/issue-36798.stderr index 8273fad47646..98876e305ca0 100644 --- a/src/test/ui/did_you_mean/issue-36798.stderr +++ b/src/test/ui/did_you_mean/issue-36798.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `baz` on type `Foo` --> $DIR/issue-36798.rs:7:7 | -LL | f.baz; //~ ERROR no field +LL | f.baz; | ^^^ help: a field with a similar name exists: `bar` error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr b/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr index b884d8a53d35..2ed0a0924006 100644 --- a/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr +++ b/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `zz` on type `Foo` --> $DIR/issue-36798_unknown_field.rs:7:7 | -LL | f.zz; //~ ERROR no field +LL | f.zz; | ^^ unknown field | = note: available fields are: `bar` diff --git a/src/test/ui/did_you_mean/issue-37139.stderr b/src/test/ui/did_you_mean/issue-37139.stderr index 38617fda2afa..cd42ee8001ab 100644 --- a/src/test/ui/did_you_mean/issue-37139.stderr +++ b/src/test/ui/did_you_mean/issue-37139.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable --> $DIR/issue-37139.rs:12:23 | -LL | test(&mut x); //~ ERROR cannot borrow immutable +LL | test(&mut x); | ^ | | | cannot reborrow mutably diff --git a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr index 1f3f7c475707..852abaed724d 100644 --- a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr +++ b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `Foo` --> $DIR/issue-38054-do-not-show-unresolved-names.rs:1:5 | -LL | use Foo; //~ ERROR unresolved +LL | use Foo; | ^^^ no `Foo` in the root error[E0432]: unresolved import `Foo1` --> $DIR/issue-38054-do-not-show-unresolved-names.rs:3:5 | -LL | use Foo1; //~ ERROR unresolved +LL | use Foo1; | ^^^^ no `Foo1` in the root error: aborting due to 2 previous errors diff --git a/src/test/ui/did_you_mean/issue-38147-1.stderr b/src/test/ui/did_you_mean/issue-38147-1.stderr index 74c72edd028b..4311836be341 100644 --- a/src/test/ui/did_you_mean/issue-38147-1.stderr +++ b/src/test/ui/did_you_mean/issue-38147-1.stderr @@ -3,7 +3,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference | LL | fn f(&self) { | ----- use `&mut self` here to make mutable -LL | self.s.push('x'); //~ ERROR cannot borrow data mutably +LL | self.s.push('x'); | ^^^^^^ assignment into an immutable reference error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-38147-4.stderr b/src/test/ui/did_you_mean/issue-38147-4.stderr index 6dc4f101084b..71d44f9abad2 100644 --- a/src/test/ui/did_you_mean/issue-38147-4.stderr +++ b/src/test/ui/did_you_mean/issue-38147-4.stderr @@ -3,7 +3,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference | LL | fn f(x: usize, f: &Foo) { | ---- use `&mut Foo` here to make mutable -LL | f.s.push('x'); //~ ERROR cannot borrow data mutably +LL | f.s.push('x'); | ^^^ assignment into an immutable reference error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-39544.stderr b/src/test/ui/did_you_mean/issue-39544.stderr index 7d6a672843a2..d86ea896a141 100644 --- a/src/test/ui/did_you_mean/issue-39544.stderr +++ b/src/test/ui/did_you_mean/issue-39544.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow field `z.x` of immutable binding as mutable | LL | let z = Z { x: X::Y }; | - help: make this binding mutable: `mut z` -LL | let _ = &mut z.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `self.x` of immutable binding as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow field `self.x` of immutable binding as mutable | LL | fn foo<'z>(&'z self) { | -------- use `&'z mut self` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `self.x` of immutable binding as mutable @@ -19,7 +19,7 @@ error[E0596]: cannot borrow field `self.x` of immutable binding as mutable | LL | fn foo1(&self, other: &Z) { | ----- use `&mut self` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `other.x` of immutable binding as mutable @@ -27,8 +27,8 @@ error[E0596]: cannot borrow field `other.x` of immutable binding as mutable | LL | fn foo1(&self, other: &Z) { | -- use `&mut Z` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `self.x` of immutable binding as mutable @@ -36,7 +36,7 @@ error[E0596]: cannot borrow field `self.x` of immutable binding as mutable | LL | fn foo2<'a>(&'a self, other: &Z) { | -------- use `&'a mut self` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `other.x` of immutable binding as mutable @@ -44,8 +44,8 @@ error[E0596]: cannot borrow field `other.x` of immutable binding as mutable | LL | fn foo2<'a>(&'a self, other: &Z) { | -- use `&mut Z` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `self.x` of immutable binding as mutable @@ -53,7 +53,7 @@ error[E0596]: cannot borrow field `self.x` of immutable binding as mutable | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -------- use `&'a mut Self` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `other.x` of immutable binding as mutable @@ -61,8 +61,8 @@ error[E0596]: cannot borrow field `other.x` of immutable binding as mutable | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -- use `&mut Z` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `other.x` of immutable binding as mutable @@ -70,7 +70,7 @@ error[E0596]: cannot borrow field `other.x` of immutable binding as mutable | LL | fn foo4(other: &Z) { | -- use `&mut Z` here to make mutable -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut other.x; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `z.x` of immutable binding as mutable @@ -78,7 +78,7 @@ error[E0596]: cannot borrow field `z.x` of immutable binding as mutable | LL | pub fn with_arg(z: Z, w: &Z) { | - help: make this binding mutable: `mut z` -LL | let _ = &mut z.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `w.x` of immutable binding as mutable @@ -86,8 +86,8 @@ error[E0596]: cannot borrow field `w.x` of immutable binding as mutable | LL | pub fn with_arg(z: Z, w: &Z) { | -- use `&mut Z` here to make mutable -LL | let _ = &mut z.x; //~ ERROR cannot borrow -LL | let _ = &mut w.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; +LL | let _ = &mut w.x; | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to borrowed content `*x.0` of immutable binding diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr index 3411958be62a..cfb1da037dc0 100644 --- a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `i8: Foo` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:24:5 | -LL | Foo::::bar(&1i8); //~ ERROR is not satisfied +LL | Foo::::bar(&1i8); | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i8` | = help: the following implementations were found: @@ -19,7 +19,7 @@ LL | fn bar(&self){} error[E0277]: the trait bound `u8: Foo` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:25:5 | -LL | Foo::::bar(&1u8); //~ ERROR is not satisfied +LL | Foo::::bar(&1u8); | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u8` | = help: the following implementations were found: @@ -36,7 +36,7 @@ LL | fn bar(&self){} error[E0277]: the trait bound `bool: Foo` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:26:5 | -LL | Foo::::bar(&true); //~ ERROR is not satisfied +LL | Foo::::bar(&true); | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `bool` | = help: the following implementations were found: diff --git a/src/test/ui/did_you_mean/issue-40006.stderr b/src/test/ui/did_you_mean/issue-40006.stderr index 1b9eecb7769b..f6f7fe5fa38c 100644 --- a/src/test/ui/did_you_mean/issue-40006.stderr +++ b/src/test/ui/did_you_mean/issue-40006.stderr @@ -1,16 +1,16 @@ error: missing `fn`, `type`, or `const` for impl-item declaration --> $DIR/issue-40006.rs:1:9 | -LL | impl X { //~ ERROR cannot be made into an object +LL | impl X { | _________^ -LL | | //~^ ERROR missing +LL | | LL | | Y | |____^ missing `fn`, `type`, or `const` error: missing `fn`, `type`, or `const` for trait-item declaration --> $DIR/issue-40006.rs:8:10 | -LL | trait X { //~ ERROR missing +LL | trait X { | __________^ LL | | X() {} | |____^ missing `fn`, `type`, or `const` @@ -18,48 +18,48 @@ LL | | X() {} error: expected `[`, found `#` --> $DIR/issue-40006.rs:10:17 | -LL | fn xxx() { ### } //~ ERROR missing +LL | fn xxx() { ### } | ^ expected `[` error: missing `fn`, `type`, or `const` for trait-item declaration --> $DIR/issue-40006.rs:10:21 | -LL | fn xxx() { ### } //~ ERROR missing +LL | fn xxx() { ### } | _____________________^ -LL | | //~^ ERROR expected -LL | | L = M; //~ ERROR missing +LL | | +LL | | L = M; | |____^ missing `fn`, `type`, or `const` error: missing `fn`, `type`, or `const` for trait-item declaration --> $DIR/issue-40006.rs:12:11 | -LL | L = M; //~ ERROR missing +LL | L = M; | ___________^ -LL | | Z = { 2 + 3 }; //~ ERROR expected one of +LL | | Z = { 2 + 3 }; | |____^ missing `fn`, `type`, or `const` error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;` --> $DIR/issue-40006.rs:13:18 | -LL | Z = { 2 + 3 }; //~ ERROR expected one of +LL | Z = { 2 + 3 }; | ^ expected one of 7 possible tokens here error: expected one of `!` or `::`, found `(` --> $DIR/issue-40006.rs:14:9 | -LL | ::Y (); //~ ERROR expected one of +LL | ::Y (); | ^ expected one of `!` or `::` here error: missing `fn`, `type`, or `const` for impl-item declaration --> $DIR/issue-40006.rs:18:8 | -LL | pub hello_method(&self) { //~ ERROR missing +LL | pub hello_method(&self) { | ^ missing `fn`, `type`, or `const` error[E0038]: the trait `X` cannot be made into an object --> $DIR/issue-40006.rs:1:6 | -LL | impl X { //~ ERROR cannot be made into an object +LL | impl X { | ^ the trait `X` cannot be made into an object | = note: method `xxx` has no receiver diff --git a/src/test/ui/did_you_mean/issue-40823.stderr b/src/test/ui/did_you_mean/issue-40823.stderr index ee64e79ead93..fa2150a8d7f6 100644 --- a/src/test/ui/did_you_mean/issue-40823.stderr +++ b/src/test/ui/did_you_mean/issue-40823.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable borrowed content `*buf` as mutable --> $DIR/issue-40823.rs:3:5 | -LL | buf.iter_mut(); //~ ERROR cannot borrow immutable borrowed content +LL | buf.iter_mut(); | ^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr b/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr index d2d9abee22cd..84235ca4d637 100644 --- a/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr +++ b/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr @@ -1,7 +1,7 @@ error: `~` cannot be used as a unary operator --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:2:13 | -LL | let x = ~1; //~ ERROR cannot be used as a unary operator +LL | let x = ~1; | ^ help: use `!` to perform bitwise negation error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr index e6d10ffaae93..8a0d0096acbb 100644 --- a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr +++ b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr @@ -1,7 +1,7 @@ error[E0423]: expected function, found enum `Option` --> $DIR/issue-43871-enum-instead-of-variant.rs:4:13 | -LL | let x = Option(1); //~ ERROR expected function, found enum +LL | let x = Option(1); | ^^^^^^ | = note: did you mean to use one of the following variants? @@ -11,7 +11,7 @@ LL | let x = Option(1); //~ ERROR expected function, found enum error[E0532]: expected tuple struct/variant, found enum `Option` --> $DIR/issue-43871-enum-instead-of-variant.rs:6:12 | -LL | if let Option(_) = x { //~ ERROR expected tuple struct/variant, found enum +LL | if let Option(_) = x { | ^^^^^^ | = note: did you mean to use one of the following variants? @@ -21,7 +21,7 @@ LL | if let Option(_) = x { //~ ERROR expected tuple struct/variant, found e error[E0532]: expected tuple struct/variant, found enum `Example` --> $DIR/issue-43871-enum-instead-of-variant.rs:12:12 | -LL | if let Example(_) = y { //~ ERROR expected tuple struct/variant, found enum +LL | if let Example(_) = y { | ^^^^^^^ | = note: did you mean to use one of the following variants? diff --git a/src/test/ui/did_you_mean/multiple-pattern-typo.stderr b/src/test/ui/did_you_mean/multiple-pattern-typo.stderr index 2825ff46825a..a29fa584b292 100644 --- a/src/test/ui/did_you_mean/multiple-pattern-typo.stderr +++ b/src/test/ui/did_you_mean/multiple-pattern-typo.stderr @@ -1,7 +1,7 @@ error: unexpected token `||` after pattern --> $DIR/multiple-pattern-typo.rs:4:15 | -LL | 1 | 2 || 3 => (), //~ ERROR unexpected token `||` after pattern +LL | 1 | 2 || 3 => (), | ^^ help: use a single `|` to specify multiple patterns: `|` error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/pub-macro-rules.stderr b/src/test/ui/did_you_mean/pub-macro-rules.stderr index 7e62fc7c4fc0..0bde5783b8cc 100644 --- a/src/test/ui/did_you_mean/pub-macro-rules.stderr +++ b/src/test/ui/did_you_mean/pub-macro-rules.stderr @@ -1,7 +1,7 @@ error: can't qualify macro_rules invocation with `pub` --> $DIR/pub-macro-rules.rs:2:5 | -LL | pub macro_rules! foo { //~ ERROR can't qualify macro_rules invocation +LL | pub macro_rules! foo { | ^^^ help: try exporting the macro: `#[macro_export]` error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/recursion_limit.stderr b/src/test/ui/did_you_mean/recursion_limit.stderr index 0738c3f65b95..a646d98324e0 100644 --- a/src/test/ui/did_you_mean/recursion_limit.stderr +++ b/src/test/ui/did_you_mean/recursion_limit.stderr @@ -1,7 +1,7 @@ error[E0275]: overflow evaluating the requirement `J: std::marker::Send` --> $DIR/recursion_limit.rs:34:5 | -LL | is_send::(); //~ ERROR overflow evaluating the requirement +LL | is_send::(); | ^^^^^^^^^^^^ | = help: consider adding a `#![recursion_limit="20"]` attribute to your crate diff --git a/src/test/ui/did_you_mean/recursion_limit_deref.stderr b/src/test/ui/did_you_mean/recursion_limit_deref.stderr index f8672b20c786..08e32ade3bc3 100644 --- a/src/test/ui/did_you_mean/recursion_limit_deref.stderr +++ b/src/test/ui/did_you_mean/recursion_limit_deref.stderr @@ -1,7 +1,7 @@ error[E0055]: reached the recursion limit while auto-dereferencing `I` --> $DIR/recursion_limit_deref.rs:50:22 | -LL | let x: &Bottom = &t; //~ ERROR mismatched types +LL | let x: &Bottom = &t; | ^^ deref recursion limit reached | = help: consider adding a `#![recursion_limit="20"]` attribute to your crate @@ -9,7 +9,7 @@ LL | let x: &Bottom = &t; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/recursion_limit_deref.rs:50:22 | -LL | let x: &Bottom = &t; //~ ERROR mismatched types +LL | let x: &Bottom = &t; | ^^ expected struct `Bottom`, found struct `Top` | = note: expected type `&Bottom` diff --git a/src/test/ui/did_you_mean/recursion_limit_macro.stderr b/src/test/ui/did_you_mean/recursion_limit_macro.stderr index 5941d088f3aa..6640ced5c9ec 100644 --- a/src/test/ui/did_you_mean/recursion_limit_macro.stderr +++ b/src/test/ui/did_you_mean/recursion_limit_macro.stderr @@ -1,7 +1,7 @@ error: recursion limit reached while expanding the macro `recurse` --> $DIR/recursion_limit_macro.rs:10:31 | -LL | ($t:tt $($tail:tt)*) => { recurse!($($tail)*) }; //~ ERROR recursion limit +LL | ($t:tt $($tail:tt)*) => { recurse!($($tail)*) }; | ^^^^^^^^^^^^^^^^^^^ ... LL | recurse!(0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9); diff --git a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr index 85c052747735..a94260dc42d1 100644 --- a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr +++ b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr @@ -1,19 +1,19 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&Copy` --> $DIR/trait-object-reference-without-parens-suggestion.rs:2:12 | -LL | let _: &Copy + 'static; //~ ERROR expected a path +LL | let _: &Copy + 'static; | ^^^^^^^^^^^^^^^ help: try adding parentheses: `&(Copy + 'static)` error[E0178]: expected a path on the left-hand side of `+`, not `&'static Copy` --> $DIR/trait-object-reference-without-parens-suggestion.rs:4:12 | -LL | let _: &'static Copy + 'static; //~ ERROR expected a path +LL | let _: &'static Copy + 'static; | ^^^^^^^^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'static (Copy + 'static)` error[E0038]: the trait `std::marker::Copy` cannot be made into an object --> $DIR/trait-object-reference-without-parens-suggestion.rs:2:12 | -LL | let _: &Copy + 'static; //~ ERROR expected a path +LL | let _: &Copy + 'static; | ^^^^^ the trait `std::marker::Copy` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr b/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr index 6ceaa2e346a0..46acc7e66d8b 100644 --- a/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr +++ b/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr @@ -1,7 +1,7 @@ error: Cannot declare a non-inline module inside a block unless it has a path attribute --> $DIR/non-inline-mod-restriction.rs:4:9 | -LL | mod foo; //~ ERROR Cannot declare a non-inline module inside a block +LL | mod foo; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr index cb32616d6e6f..9984cac7a4a4 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `X`, which implements the `Drop` trait --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:9 | -LL | let X { x: y } = x; //~ ERROR cannot move out of type +LL | let X { x: y } = x; | ^^^^^^^-^^ | | | | | hint: to prevent move, use `ref y` or `ref mut y` diff --git a/src/test/ui/discrim/discrim-overflow-2.stderr b/src/test/ui/discrim/discrim-overflow-2.stderr index c490509142ac..744324d1f0ff 100644 --- a/src/test/ui/discrim/discrim-overflow-2.stderr +++ b/src/test/ui/discrim/discrim-overflow-2.stderr @@ -1,7 +1,7 @@ error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:17:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 127 | = note: explicitly set `OhNo = -128` if that is desired outcome @@ -9,7 +9,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:26:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 255 | = note: explicitly set `OhNo = 0` if that is desired outcome @@ -17,7 +17,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:35:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 32767 | = note: explicitly set `OhNo = -32768` if that is desired outcome @@ -25,7 +25,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:44:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 65535 | = note: explicitly set `OhNo = 0` if that is desired outcome @@ -33,7 +33,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:53:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 2147483647 | = note: explicitly set `OhNo = -2147483648` if that is desired outcome @@ -41,7 +41,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:62:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 4294967295 | = note: explicitly set `OhNo = 0` if that is desired outcome @@ -49,7 +49,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:71:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 9223372036854775807 | = note: explicitly set `OhNo = -9223372036854775808` if that is desired outcome @@ -57,7 +57,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:80:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 18446744073709551615 | = note: explicitly set `OhNo = 0` if that is desired outcome diff --git a/src/test/ui/discrim/discrim-overflow.stderr b/src/test/ui/discrim/discrim-overflow.stderr index e71df51e36d0..c831fdfe1a34 100644 --- a/src/test/ui/discrim/discrim-overflow.stderr +++ b/src/test/ui/discrim/discrim-overflow.stderr @@ -1,7 +1,7 @@ error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:15:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 127 | = note: explicitly set `OhNo = -128` if that is desired outcome @@ -9,7 +9,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:26:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 255 | = note: explicitly set `OhNo = 0` if that is desired outcome @@ -17,7 +17,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:37:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 32767 | = note: explicitly set `OhNo = -32768` if that is desired outcome @@ -25,7 +25,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:48:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 65535 | = note: explicitly set `OhNo = 0` if that is desired outcome @@ -33,7 +33,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:60:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 2147483647 | = note: explicitly set `OhNo = -2147483648` if that is desired outcome @@ -41,7 +41,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:72:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 4294967295 | = note: explicitly set `OhNo = 0` if that is desired outcome @@ -49,7 +49,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:84:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 9223372036854775807 | = note: explicitly set `OhNo = -9223372036854775808` if that is desired outcome @@ -57,7 +57,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:96:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 18446744073709551615 | = note: explicitly set `OhNo = 0` if that is desired outcome diff --git a/src/test/ui/diverging-tuple-parts-39485.stderr b/src/test/ui/diverging-tuple-parts-39485.stderr index 3457549a7523..70eefeb329db 100644 --- a/src/test/ui/diverging-tuple-parts-39485.stderr +++ b/src/test/ui/diverging-tuple-parts-39485.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/diverging-tuple-parts-39485.rs:8:5 | -LL | &panic!() //~ ERROR mismatched types +LL | &panic!() | ^^^^^^^^^ expected (), found reference | = note: expected type `()` @@ -12,7 +12,7 @@ LL | fn g() -> &_ { | ^^^^^ help: consider removing the borrow | -LL | panic!() //~ ERROR mismatched types +LL | panic!() | ^^^^^^^^ error[E0308]: mismatched types @@ -20,7 +20,7 @@ error[E0308]: mismatched types | LL | fn f() -> isize { | ----- expected `isize` because of return type -LL | (return 1, return 2) //~ ERROR mismatched types +LL | (return 1, return 2) | ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple | = note: expected type `isize` diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr b/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr index 206af6757b22..f9de5e14e59a 100644 --- a/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr +++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: `$crate` in paths can only be used in start position --> $DIR/dollar-crate-is-keyword-2.rs:6:16 | -LL | use a::$crate::b; //~ ERROR `$crate` in paths can only be used in start position +LL | use a::$crate::b; | ^^^^^^ `$crate` in paths can only be used in start position ... LL | m!(); @@ -10,7 +10,7 @@ LL | m!(); error[E0432]: unresolved import `a::$crate` --> $DIR/dollar-crate-is-keyword-2.rs:5:13 | -LL | use a::$crate; //~ ERROR unresolved import `a::$crate` +LL | use a::$crate; | ^^^^^^^^^ no `$crate` in `a` ... LL | m!(); @@ -19,7 +19,7 @@ LL | m!(); error[E0433]: failed to resolve: `$crate` in paths can only be used in start position --> $DIR/dollar-crate-is-keyword-2.rs:7:21 | -LL | type A = a::$crate; //~ ERROR `$crate` in paths can only be used in start position +LL | type A = a::$crate; | ^^^^^^ `$crate` in paths can only be used in start position ... LL | m!(); diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr b/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr index e94a5fe96ffc..5d4f39086cee 100644 --- a/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr +++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr @@ -1,7 +1,7 @@ error: expected identifier, found reserved identifier `$crate` --> $DIR/dollar-crate-is-keyword.rs:6:20 | -LL | struct $crate {} //~ ERROR expected identifier, found reserved identifier `$crate` +LL | struct $crate {} | ^^^^^^ expected identifier, found reserved identifier ... LL | m!(); @@ -10,7 +10,7 @@ LL | m!(); error: expected identifier, found reserved identifier `$crate` --> $DIR/dollar-crate-is-keyword.rs:11:23 | -LL | use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate` +LL | use $crate as $crate; | ^^^^^^ expected identifier, found reserved identifier ... LL | m!(); @@ -30,7 +30,7 @@ LL | m!(); warning: `$crate` may not be imported --> $DIR/dollar-crate-is-keyword.rs:11:9 | -LL | use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate` +LL | use $crate as $crate; | ^^^^^^^^^^^^^^^^^^^^^ ... LL | m!(); diff --git a/src/test/ui/double-import.stderr b/src/test/ui/double-import.stderr index 2fefdc49e9c4..7a4e8e5d3b92 100644 --- a/src/test/ui/double-import.stderr +++ b/src/test/ui/double-import.stderr @@ -3,13 +3,13 @@ error[E0252]: the name `foo` is defined multiple times | LL | use sub1::foo; | --------- previous import of the value `foo` here -LL | use sub2::foo; //~ ERROR the name `foo` is defined multiple times +LL | use sub2::foo; | ^^^^^^^^^ `foo` reimported here | = note: `foo` must be defined only once in the value namespace of this module help: you can use `as` to change the binding name of the import | -LL | use sub2::foo as other_foo; //~ ERROR the name `foo` is defined multiple times +LL | use sub2::foo as other_foo; | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/dropck/drop-with-active-borrows-1.stderr b/src/test/ui/dropck/drop-with-active-borrows-1.stderr index a4295f96205a..71960fcecb54 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-1.stderr +++ b/src/test/ui/dropck/drop-with-active-borrows-1.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let b: Vec<&str> = a.lines().collect(); | - borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` because it is borrowed +LL | drop(a); | ^ move out of `a` occurs here error: aborting due to previous error diff --git a/src/test/ui/dropck/drop-with-active-borrows-2.stderr b/src/test/ui/dropck/drop-with-active-borrows-2.stderr index 347389cb59d7..ef46c9276be2 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-2.stderr +++ b/src/test/ui/dropck/drop-with-active-borrows-2.stderr @@ -3,7 +3,7 @@ error[E0597]: `raw_lines` does not live long enough | LL | raw_lines.iter().map(|l| l.trim()).collect() | ^^^^^^^^^ borrowed value does not live long enough -LL | //~^ ERROR `raw_lines` does not live long enough +LL | LL | } | - borrowed value only lives until here | diff --git a/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr b/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr index c3139948a07d..49e55be1b49e 100644 --- a/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr +++ b/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr @@ -2,7 +2,7 @@ error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attri --> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:21:1 | LL | / impl<#[may_dangle] A, B: fmt::Debug> Drop for Pt { -LL | | //~^ ERROR requires an `unsafe impl` declaration due to `#[may_dangle]` attribute +LL | | LL | | LL | | // (unsafe to access self.1 due to #[may_dangle] on A) LL | | fn drop(&mut self) { println!("drop {} {:?}", self.0, self.2); } @@ -13,7 +13,7 @@ error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attri --> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:27:1 | LL | / impl<#[may_dangle] 'a, 'b, B: fmt::Debug> Drop for Pr<'a, 'b, B> { -LL | | //~^ ERROR requires an `unsafe impl` declaration due to `#[may_dangle]` attribute +LL | | LL | | LL | | // (unsafe to access self.1 due to #[may_dangle] on 'a) LL | | fn drop(&mut self) { println!("drop {} {:?}", self.0, self.2); } diff --git a/src/test/ui/dropck/dropck-union.stderr b/src/test/ui/dropck/dropck-union.stderr index 6cb3c139132f..4f6cd872449d 100644 --- a/src/test/ui/dropck/dropck-union.stderr +++ b/src/test/ui/dropck/dropck-union.stderr @@ -1,7 +1,7 @@ error[E0597]: `v` does not live long enough --> $DIR/dropck-union.rs:39:19 | -LL | v.0.set(Some(&v)); //~ ERROR: `v` does not live long enough +LL | v.0.set(Some(&v)); | ^ borrowed value does not live long enough LL | } | - `v` dropped here while still borrowed diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr index 317ac7674311..9bf324412c3a 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr @@ -1,7 +1,7 @@ error[E0320]: overflow while adding drop-check rules for FingerTree --> $DIR/dropck_no_diverge_on_nonregular_1.rs:24:9 | -LL | let ft = //~ ERROR overflow while adding drop-check rules for FingerTree +LL | let ft = | ^^ | = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr index b87e7a111493..0a74377ea9fd 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr @@ -1,7 +1,7 @@ error[E0320]: overflow while adding drop-check rules for FingerTree --> $DIR/dropck_no_diverge_on_nonregular_2.rs:23:9 | -LL | let ft = //~ ERROR overflow while adding drop-check rules for FingerTree +LL | let ft = | ^^ | = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr index 799ee45a2022..d484e157519c 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr @@ -1,7 +1,7 @@ error[E0320]: overflow while adding drop-check rules for std::option::Option> --> $DIR/dropck_no_diverge_on_nonregular_3.rs:32:9 | -LL | let w = //~ ERROR overflow while adding drop-check rules for std::option +LL | let w = | ^ | = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr index 0e4bd829a949..792ef46f2443 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.stderr +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr @@ -1,7 +1,7 @@ error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:111:14 | -LL | o1.set0(&o2); //~ ERROR `o2` does not live long enough +LL | o1.set0(&o2); | ^^ borrowed value does not live long enough ... LL | } @@ -12,7 +12,7 @@ LL | } error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:112:14 | -LL | o1.set1(&o3); //~ ERROR `o3` does not live long enough +LL | o1.set1(&o3); | ^^ borrowed value does not live long enough ... LL | } @@ -23,7 +23,7 @@ LL | } error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:113:14 | -LL | o2.set0(&o2); //~ ERROR `o2` does not live long enough +LL | o2.set0(&o2); | ^^ borrowed value does not live long enough ... LL | } @@ -34,7 +34,7 @@ LL | } error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:114:14 | -LL | o2.set1(&o3); //~ ERROR `o3` does not live long enough +LL | o2.set1(&o3); | ^^ borrowed value does not live long enough ... LL | } @@ -45,9 +45,9 @@ LL | } error[E0597]: `o1` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:115:14 | -LL | o3.set0(&o1); //~ ERROR `o1` does not live long enough +LL | o3.set0(&o1); | ^^ borrowed value does not live long enough -LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough +LL | o3.set1(&o2); LL | } | - borrowed value only lives until here | @@ -56,7 +56,7 @@ LL | } error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:116:14 | -LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough +LL | o3.set1(&o2); | ^^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/dst/dst-bad-coerce2.stderr b/src/test/ui/dst/dst-bad-coerce2.stderr index 6fb5c4b32ef1..cae4ec51c37c 100644 --- a/src/test/ui/dst/dst-bad-coerce2.stderr +++ b/src/test/ui/dst/dst-bad-coerce2.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce2.rs:15:33 | -LL | let f3: &mut Fat<[isize]> = f2; //~ ERROR mismatched types +LL | let f3: &mut Fat<[isize]> = f2; | ^^ types differ in mutability | = note: expected type `&mut Fat<[isize]>` @@ -10,7 +10,7 @@ LL | let f3: &mut Fat<[isize]> = f2; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coerce2.rs:20:29 | -LL | let f3: &mut Fat = f2; //~ ERROR mismatched types +LL | let f3: &mut Fat = f2; | ^^ types differ in mutability | = note: expected type `&mut Fat` @@ -19,7 +19,7 @@ LL | let f3: &mut Fat = f2; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coerce2.rs:25:31 | -LL | let f3: &mut ([isize],) = f2; //~ ERROR mismatched types +LL | let f3: &mut ([isize],) = f2; | ^^ types differ in mutability | = note: expected type `&mut ([isize],)` @@ -28,7 +28,7 @@ LL | let f3: &mut ([isize],) = f2; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coerce2.rs:30:27 | -LL | let f3: &mut (Bar,) = f2; //~ ERROR mismatched types +LL | let f3: &mut (Bar,) = f2; | ^^ types differ in mutability | = note: expected type `&mut (dyn Bar,)` diff --git a/src/test/ui/dst/dst-bad-coerce3.stderr b/src/test/ui/dst/dst-bad-coerce3.stderr index 701a869ee91e..61473269e50d 100644 --- a/src/test/ui/dst/dst-bad-coerce3.stderr +++ b/src/test/ui/dst/dst-bad-coerce3.stderr @@ -1,7 +1,7 @@ error[E0597]: `f1` does not live long enough --> $DIR/dst-bad-coerce3.rs:16:33 | -LL | let f2: &Fat<[isize; 3]> = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &Fat<[isize; 3]> = &f1; | ^^ borrowed value does not live long enough ... LL | } @@ -16,7 +16,7 @@ LL | fn baz<'a>() { error[E0597]: `f1` does not live long enough --> $DIR/dst-bad-coerce3.rs:21:26 | -LL | let f2: &Fat = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &Fat = &f1; | ^^ borrowed value does not live long enough ... LL | } @@ -31,7 +31,7 @@ LL | fn baz<'a>() { error[E0597]: `f1` does not live long enough --> $DIR/dst-bad-coerce3.rs:26:31 | -LL | let f2: &([isize; 3],) = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &([isize; 3],) = &f1; | ^^ borrowed value does not live long enough ... LL | } @@ -46,7 +46,7 @@ LL | fn baz<'a>() { error[E0597]: `f1` does not live long enough --> $DIR/dst-bad-coerce3.rs:31:24 | -LL | let f2: &(Foo,) = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &(Foo,) = &f1; | ^^ borrowed value does not live long enough LL | let f3: &'a (Bar,) = f2; LL | } diff --git a/src/test/ui/dst/dst-bad-coercions.stderr b/src/test/ui/dst/dst-bad-coercions.stderr index df223b7cb96b..27016829a07f 100644 --- a/src/test/ui/dst/dst-bad-coercions.stderr +++ b/src/test/ui/dst/dst-bad-coercions.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:14:17 | -LL | let y: &S = x; //~ ERROR mismatched types +LL | let y: &S = x; | ^ expected &S, found *-ptr | = note: expected type `&S` @@ -10,7 +10,7 @@ LL | let y: &S = x; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:15:17 | -LL | let y: &T = x; //~ ERROR mismatched types +LL | let y: &T = x; | ^ | | | expected &dyn T, found *-ptr @@ -22,7 +22,7 @@ LL | let y: &T = x; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:19:17 | -LL | let y: &S = x; //~ ERROR mismatched types +LL | let y: &S = x; | ^ expected &S, found *-ptr | = note: expected type `&S` @@ -31,7 +31,7 @@ LL | let y: &S = x; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:20:17 | -LL | let y: &T = x; //~ ERROR mismatched types +LL | let y: &T = x; | ^ | | | expected &dyn T, found *-ptr @@ -43,7 +43,7 @@ LL | let y: &T = x; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:23:21 | -LL | let x: &mut T = &S; //~ ERROR mismatched types +LL | let x: &mut T = &S; | ^^ types differ in mutability | = note: expected type `&mut dyn T` @@ -52,7 +52,7 @@ LL | let x: &mut T = &S; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:24:21 | -LL | let x: *mut T = &S; //~ ERROR mismatched types +LL | let x: *mut T = &S; | ^^ types differ in mutability | = note: expected type `*mut dyn T` @@ -61,7 +61,7 @@ LL | let x: *mut T = &S; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:25:21 | -LL | let x: *mut S = &S; //~ ERROR mismatched types +LL | let x: *mut S = &S; | ^^ types differ in mutability | = note: expected type `*mut S` diff --git a/src/test/ui/duplicate/dupe-symbols-1.stderr b/src/test/ui/duplicate/dupe-symbols-1.stderr index 58aa1e433d16..c46ac0c6ed4f 100644 --- a/src/test/ui/duplicate/dupe-symbols-1.stderr +++ b/src/test/ui/duplicate/dupe-symbols-1.stderr @@ -2,7 +2,7 @@ error: symbol `fail` is already defined --> $DIR/dupe-symbols-1.rs:10:1 | LL | / pub fn b() { -LL | | //~^ symbol `fail` is already defined +LL | | LL | | } | |_^ diff --git a/src/test/ui/duplicate/dupe-symbols-2.stderr b/src/test/ui/duplicate/dupe-symbols-2.stderr index 65185cd54290..821bdd03392b 100644 --- a/src/test/ui/duplicate/dupe-symbols-2.stderr +++ b/src/test/ui/duplicate/dupe-symbols-2.stderr @@ -2,7 +2,7 @@ error: symbol `fail` is already defined --> $DIR/dupe-symbols-2.rs:13:5 | LL | / pub extern fn fail() { -LL | | //~^ symbol `fail` is already defined +LL | | LL | | } | |_____^ diff --git a/src/test/ui/duplicate/dupe-symbols-3.stderr b/src/test/ui/duplicate/dupe-symbols-3.stderr index 5cd618bc9f65..f30c88e4760e 100644 --- a/src/test/ui/duplicate/dupe-symbols-3.stderr +++ b/src/test/ui/duplicate/dupe-symbols-3.stderr @@ -2,7 +2,7 @@ error: symbol `fail` is already defined --> $DIR/dupe-symbols-3.rs:10:1 | LL | / pub fn fail() { -LL | | //~^ symbol `fail` is already defined +LL | | LL | | } | |_^ diff --git a/src/test/ui/duplicate/dupe-symbols-5.stderr b/src/test/ui/duplicate/dupe-symbols-5.stderr index 3acfdd22a9a3..cee72660e4ff 100644 --- a/src/test/ui/duplicate/dupe-symbols-5.stderr +++ b/src/test/ui/duplicate/dupe-symbols-5.stderr @@ -2,7 +2,7 @@ error: symbol `fail` is already defined --> $DIR/dupe-symbols-5.rs:9:1 | LL | / pub fn b() { -LL | | //~^ symbol `fail` is already defined +LL | | LL | | } | |_^ diff --git a/src/test/ui/duplicate/duplicate-check-macro-exports.stderr b/src/test/ui/duplicate/duplicate-check-macro-exports.stderr index 97ee9b9b05f7..02f0206c443a 100644 --- a/src/test/ui/duplicate/duplicate-check-macro-exports.stderr +++ b/src/test/ui/duplicate/duplicate-check-macro-exports.stderr @@ -4,7 +4,7 @@ error[E0255]: the name `panic` is defined multiple times LL | pub use std::panic; | ---------- previous import of the macro `panic` here ... -LL | macro_rules! panic { () => {} } //~ ERROR the name `panic` is defined multiple times +LL | macro_rules! panic { () => {} } | ^^^^^^^^^^^^^^^^^^ `panic` redefined here | = note: `panic` must be defined only once in the macro namespace of this module diff --git a/src/test/ui/duplicate_entry_error.stderr b/src/test/ui/duplicate_entry_error.stderr index ddb11e19c03d..1892ad38a594 100644 --- a/src/test/ui/duplicate_entry_error.stderr +++ b/src/test/ui/duplicate_entry_error.stderr @@ -2,7 +2,7 @@ error[E0152]: duplicate lang item found: `panic_impl`. --> $DIR/duplicate_entry_error.rs:10:1 | LL | / fn panic_impl(info: &PanicInfo) -> ! { -LL | | //~^ ERROR: duplicate lang item found: `panic_impl`. +LL | | LL | | loop {} LL | | } | |_^ diff --git a/src/test/ui/e0119/complex-impl.stderr b/src/test/ui/e0119/complex-impl.stderr index fb0c94dcc3df..f211530dcf48 100644 --- a/src/test/ui/e0119/complex-impl.stderr +++ b/src/test/ui/e0119/complex-impl.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `complex_impl_support::External` for type `(Q, complex_impl_support::M<'_, '_, '_, std::boxed::Box<_>, _, _>)`: --> $DIR/complex-impl.rs:9:1 | -LL | impl External for (Q, R) {} //~ ERROR must be used +LL | impl External for (Q, R) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `complex_impl_support`: @@ -11,7 +11,7 @@ LL | impl External for (Q, R) {} //~ ERROR must be used error[E0210]: type parameter `R` must be used as the type parameter for some local type (e.g., `MyStruct`) --> $DIR/complex-impl.rs:9:1 | -LL | impl External for (Q, R) {} //~ ERROR must be used +LL | impl External for (Q, R) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `R` must be used as the type parameter for some local type | = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/e0119/conflict-with-std.stderr b/src/test/ui/e0119/conflict-with-std.stderr index 1cfb3c1dabae..8c12b3d0bb9a 100644 --- a/src/test/ui/e0119/conflict-with-std.stderr +++ b/src/test/ui/e0119/conflict-with-std.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `std::convert::AsRef` for type `std::boxed::Box`: --> $DIR/conflict-with-std.rs:6:1 | -LL | impl AsRef for Box { //~ ERROR conflicting implementations +LL | impl AsRef for Box { | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `alloc`: @@ -11,7 +11,7 @@ LL | impl AsRef for Box { //~ ERROR conflicting implementations error[E0119]: conflicting implementations of trait `std::convert::From` for type `S`: --> $DIR/conflict-with-std.rs:13:1 | -LL | impl From for S { //~ ERROR conflicting implementations +LL | impl From for S { | ^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: @@ -20,7 +20,7 @@ LL | impl From for S { //~ ERROR conflicting implementations error[E0119]: conflicting implementations of trait `std::convert::TryFrom` for type `X`: --> $DIR/conflict-with-std.rs:20:1 | -LL | impl TryFrom for X { //~ ERROR conflicting implementations +LL | impl TryFrom for X { | ^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: diff --git a/src/test/ui/e0119/issue-23563.stderr b/src/test/ui/e0119/issue-23563.stderr index 53f9a5e70644..8011689880df 100644 --- a/src/test/ui/e0119/issue-23563.stderr +++ b/src/test/ui/e0119/issue-23563.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `a::LolFrom<&[_]>` for type `LocalType<_>`: --> $DIR/issue-23563.rs:13:1 | -LL | impl<'a, T> LolFrom<&'a [T]> for LocalType { //~ ERROR conflicting implementations of trait +LL | impl<'a, T> LolFrom<&'a [T]> for LocalType { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `issue_23563_a`: diff --git a/src/test/ui/e0119/issue-27403.stderr b/src/test/ui/e0119/issue-27403.stderr index 76c326fb2054..cba10432a930 100644 --- a/src/test/ui/e0119/issue-27403.stderr +++ b/src/test/ui/e0119/issue-27403.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `std::convert::Into<_>` for type `GenX<_>`: --> $DIR/issue-27403.rs:5:1 | -LL | impl Into for GenX { //~ ERROR conflicting implementations +LL | impl Into for GenX { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: diff --git a/src/test/ui/e0119/issue-28981.stderr b/src/test/ui/e0119/issue-28981.stderr index 8b4cd9acac45..e1e07190d8c6 100644 --- a/src/test/ui/e0119/issue-28981.stderr +++ b/src/test/ui/e0119/issue-28981.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `std::ops::Deref` for type `&_`: --> $DIR/issue-28981.rs:5:1 | -LL | impl Deref for Foo { } //~ ERROR must be used +LL | impl Deref for Foo { } | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: @@ -11,7 +11,7 @@ LL | impl Deref for Foo { } //~ ERROR must be used error[E0210]: type parameter `Foo` must be used as the type parameter for some local type (e.g., `MyStruct`) --> $DIR/issue-28981.rs:5:1 | -LL | impl Deref for Foo { } //~ ERROR must be used +LL | impl Deref for Foo { } | ^^^^^^^^^^^^^^^^^^^^^^^ type parameter `Foo` must be used as the type parameter for some local type | = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/e0119/so-37347311.stderr b/src/test/ui/e0119/so-37347311.stderr index eb321668d13f..f2166de71f8d 100644 --- a/src/test/ui/e0119/so-37347311.stderr +++ b/src/test/ui/e0119/so-37347311.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `std::convert::From>` for type `MyError<_>`: --> $DIR/so-37347311.rs:11:1 | -LL | impl From for MyError { //~ ERROR conflicting implementations +LL | impl From for MyError { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: diff --git a/src/test/ui/editions/edition-deny-async-fns-2015.stderr b/src/test/ui/editions/edition-deny-async-fns-2015.stderr index 1ad907aa7eb4..83c8dbc7472f 100644 --- a/src/test/ui/editions/edition-deny-async-fns-2015.stderr +++ b/src/test/ui/editions/edition-deny-async-fns-2015.stderr @@ -1,55 +1,55 @@ error[E0670]: `async fn` is not permitted in the 2015 edition --> $DIR/edition-deny-async-fns-2015.rs:5:1 | -LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition +LL | async fn foo() {} | ^^^^^ error[E0670]: `async fn` is not permitted in the 2015 edition --> $DIR/edition-deny-async-fns-2015.rs:7:12 | -LL | fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in the 2015 edition +LL | fn baz() { async fn foo() {} } | ^^^^^ error[E0670]: `async fn` is not permitted in the 2015 edition --> $DIR/edition-deny-async-fns-2015.rs:10:5 | -LL | async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition +LL | async fn bar() {} | ^^^^^ error[E0670]: `async fn` is not permitted in the 2015 edition --> $DIR/edition-deny-async-fns-2015.rs:9:1 | -LL | async fn async_baz() { //~ ERROR `async fn` is not permitted in the 2015 edition +LL | async fn async_baz() { | ^^^^^ error[E0670]: `async fn` is not permitted in the 2015 edition --> $DIR/edition-deny-async-fns-2015.rs:32:9 | -LL | async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition +LL | async fn bar() {} | ^^^^^ error[E0670]: `async fn` is not permitted in the 2015 edition --> $DIR/edition-deny-async-fns-2015.rs:28:9 | -LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition +LL | async fn foo() {} | ^^^^^ error[E0670]: `async fn` is not permitted in the 2015 edition --> $DIR/edition-deny-async-fns-2015.rs:16:5 | -LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition +LL | async fn foo() {} | ^^^^^ error[E0706]: trait fns cannot be declared `async` --> $DIR/edition-deny-async-fns-2015.rs:20:5 | -LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition +LL | async fn foo() {} | ^^^^^^^^^^^^^^^^^ error[E0670]: `async fn` is not permitted in the 2015 edition --> $DIR/edition-deny-async-fns-2015.rs:20:5 | -LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition +LL | async fn foo() {} | ^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/editions/edition-imports-2015.stderr b/src/test/ui/editions/edition-imports-2015.stderr index 816ab21d8142..4aba5323cc57 100644 --- a/src/test/ui/editions/edition-imports-2015.stderr +++ b/src/test/ui/editions/edition-imports-2015.stderr @@ -1,7 +1,7 @@ error: cannot glob-import all possible crates --> $DIR/edition-imports-2015.rs:23:5 | -LL | gen_glob!(); //~ ERROR cannot glob-import all possible crates +LL | gen_glob!(); | ^^^^^^^^^^^^ | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/editions/edition-imports-2018.stderr b/src/test/ui/editions/edition-imports-2018.stderr index 944f42ee0451..6ef49b625605 100644 --- a/src/test/ui/editions/edition-imports-2018.stderr +++ b/src/test/ui/editions/edition-imports-2018.stderr @@ -1,7 +1,7 @@ error: cannot glob-import all possible crates --> $DIR/edition-imports-2018.rs:24:5 | -LL | gen_glob!(); //~ ERROR cannot glob-import all possible crates +LL | gen_glob!(); | ^^^^^^^^^^^^ | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr index ac2bf21c5c0b..1f309f5e8f03 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr +++ b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr @@ -1,7 +1,7 @@ error[E0659]: `Ambiguous` is ambiguous (name vs any other name during import resolution) --> $DIR/edition-imports-virtual-2015-ambiguity.rs:15:9 | -LL | edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous +LL | edition_imports_2015::gen_ambiguous!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name | note: `Ambiguous` could refer to the struct defined here @@ -21,7 +21,7 @@ LL | pub struct Ambiguous {} error[E0659]: `edition_imports_2015` is ambiguous (name in the crate root vs extern crate during absolute path resolution) --> $DIR/edition-imports-virtual-2015-ambiguity.rs:15:9 | -LL | edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous +LL | edition_imports_2015::gen_ambiguous!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name | = note: `edition_imports_2015` could refer to an extern crate passed with `--extern` diff --git a/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr b/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr index f2a9da71ca56..3435fdfd7257 100644 --- a/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr @@ -1,13 +1,13 @@ error: no rules expected the token `r#async` --> $DIR/edition-keywords-2015-2015-parsing.rs:16:31 | -LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` +LL | r#async = consumes_async!(r#async); | ^^^^^^^ no rules expected this token in macro call error: no rules expected the token `async` --> $DIR/edition-keywords-2015-2015-parsing.rs:17:35 | -LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` +LL | r#async = consumes_async_raw!(async); | ^^^^^ no rules expected this token in macro call error: aborting due to 2 previous errors diff --git a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr index af1ac19c837d..9724f78db661 100644 --- a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr @@ -1,7 +1,7 @@ error: expected identifier, found reserved keyword `async` --> $DIR/edition-keywords-2015-2018-expansion.rs:8:5 | -LL | produces_async! {} //~ ERROR expected identifier, found reserved keyword +LL | produces_async! {} | ^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr b/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr index fbb3b8bc7569..6e86d746f544 100644 --- a/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr @@ -1,13 +1,13 @@ error: no rules expected the token `r#async` --> $DIR/edition-keywords-2015-2018-parsing.rs:16:31 | -LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` +LL | r#async = consumes_async!(r#async); | ^^^^^^^ no rules expected this token in macro call error: no rules expected the token `async` --> $DIR/edition-keywords-2015-2018-parsing.rs:17:35 | -LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` +LL | r#async = consumes_async_raw!(async); | ^^^^^ no rules expected this token in macro call error: aborting due to 2 previous errors diff --git a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr index 52399362482b..0d8850c2397c 100644 --- a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr @@ -1,33 +1,33 @@ error: expected identifier, found reserved keyword `async` --> $DIR/edition-keywords-2018-2015-parsing.rs:8:13 | -LL | let mut async = 1; //~ ERROR expected identifier, found reserved keyword `async` +LL | let mut async = 1; | ^^^^^ expected identifier, found reserved keyword help: you can escape reserved keywords to use them as identifiers | -LL | let mut r#async = 1; //~ ERROR expected identifier, found reserved keyword `async` +LL | let mut r#async = 1; | ^^^^^^^ error: expected identifier, found reserved keyword `async` --> $DIR/edition-keywords-2018-2015-parsing.rs:18:13 | -LL | module::async(); //~ ERROR expected identifier, found reserved keyword `async` +LL | module::async(); | ^^^^^ expected identifier, found reserved keyword help: you can escape reserved keywords to use them as identifiers | -LL | module::r#async(); //~ ERROR expected identifier, found reserved keyword `async` +LL | module::r#async(); | ^^^^^^^ error: no rules expected the token `r#async` --> $DIR/edition-keywords-2018-2015-parsing.rs:12:31 | -LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` +LL | r#async = consumes_async!(r#async); | ^^^^^^^ no rules expected this token in macro call error: no rules expected the token `async` --> $DIR/edition-keywords-2018-2015-parsing.rs:13:35 | -LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` +LL | r#async = consumes_async_raw!(async); | ^^^^^ no rules expected this token in macro call error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` diff --git a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr index d997c3d8a421..ab601c8d8a70 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr @@ -1,7 +1,7 @@ error: expected identifier, found reserved keyword `async` --> $DIR/edition-keywords-2018-2018-expansion.rs:8:5 | -LL | produces_async! {} //~ ERROR expected identifier, found reserved keyword `async` +LL | produces_async! {} | ^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr index 1621368870a5..0604b600d23d 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr @@ -1,33 +1,33 @@ error: expected identifier, found reserved keyword `async` --> $DIR/edition-keywords-2018-2018-parsing.rs:8:13 | -LL | let mut async = 1; //~ ERROR expected identifier, found reserved keyword `async` +LL | let mut async = 1; | ^^^^^ expected identifier, found reserved keyword help: you can escape reserved keywords to use them as identifiers | -LL | let mut r#async = 1; //~ ERROR expected identifier, found reserved keyword `async` +LL | let mut r#async = 1; | ^^^^^^^ error: expected identifier, found reserved keyword `async` --> $DIR/edition-keywords-2018-2018-parsing.rs:18:13 | -LL | module::async(); //~ ERROR expected identifier, found reserved keyword `async` +LL | module::async(); | ^^^^^ expected identifier, found reserved keyword help: you can escape reserved keywords to use them as identifiers | -LL | module::r#async(); //~ ERROR expected identifier, found reserved keyword `async` +LL | module::r#async(); | ^^^^^^^ error: no rules expected the token `r#async` --> $DIR/edition-keywords-2018-2018-parsing.rs:12:31 | -LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` +LL | r#async = consumes_async!(r#async); | ^^^^^^^ no rules expected this token in macro call error: no rules expected the token `async` --> $DIR/edition-keywords-2018-2018-parsing.rs:13:35 | -LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` +LL | r#async = consumes_async_raw!(async); | ^^^^^ no rules expected this token in macro call error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` diff --git a/src/test/ui/empty/empty-comment.stderr b/src/test/ui/empty/empty-comment.stderr index 908d5710c8a2..116cc83fa9ce 100644 --- a/src/test/ui/empty/empty-comment.stderr +++ b/src/test/ui/empty/empty-comment.stderr @@ -4,7 +4,7 @@ error: unexpected end of macro invocation LL | macro_rules! one_arg_macro { | -------------------------- when calling this macro ... -LL | one_arg_macro!(/**/); //~ ERROR unexpected end +LL | one_arg_macro!(/**/); | ^^^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments error: aborting due to previous error diff --git a/src/test/ui/empty/empty-linkname.stderr b/src/test/ui/empty/empty-linkname.stderr index a07a4f1c5674..df41cb894139 100644 --- a/src/test/ui/empty/empty-linkname.stderr +++ b/src/test/ui/empty/empty-linkname.stderr @@ -1,7 +1,7 @@ error[E0454]: #[link(name = "")] given with empty name --> $DIR/empty-linkname.rs:1:1 | -LL | #[link(name = "")] //~ ERROR: given with empty name +LL | #[link(name = "")] | ^^^^^^^^^^^^^^^^^^ empty name given error: aborting due to previous error diff --git a/src/test/ui/empty/empty-struct-braces-expr.stderr b/src/test/ui/empty/empty-struct-braces-expr.stderr index 19844503a480..a20d79982493 100644 --- a/src/test/ui/empty/empty-struct-braces-expr.stderr +++ b/src/test/ui/empty/empty-struct-braces-expr.stderr @@ -1,7 +1,7 @@ error[E0423]: expected value, found struct `Empty1` --> $DIR/empty-struct-braces-expr.rs:15:14 | -LL | let e1 = Empty1; //~ ERROR expected value, found struct `Empty1` +LL | let e1 = Empty1; | ^^^^^^ | | | did you mean `Empty1 { /* fields */ }`? @@ -10,7 +10,7 @@ LL | let e1 = Empty1; //~ ERROR expected value, found struct `Empty1` error[E0423]: expected function, found struct `Empty1` --> $DIR/empty-struct-braces-expr.rs:16:14 | -LL | let e1 = Empty1(); //~ ERROR expected function, found struct `Empty1` +LL | let e1 = Empty1(); | ^^^^^^ | | | did you mean `Empty1 { /* fields */ }`? @@ -19,19 +19,19 @@ LL | let e1 = Empty1(); //~ ERROR expected function, found struct `Empty1` error[E0423]: expected value, found struct variant `E::Empty3` --> $DIR/empty-struct-braces-expr.rs:17:14 | -LL | let e3 = E::Empty3; //~ ERROR expected value, found struct variant `E::Empty3` +LL | let e3 = E::Empty3; | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? error[E0423]: expected function, found struct variant `E::Empty3` --> $DIR/empty-struct-braces-expr.rs:18:14 | -LL | let e3 = E::Empty3(); //~ ERROR expected function, found struct variant `E::Empty3` +LL | let e3 = E::Empty3(); | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? error[E0423]: expected value, found struct `XEmpty1` --> $DIR/empty-struct-braces-expr.rs:20:15 | -LL | let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1` +LL | let xe1 = XEmpty1; | ^^^^^^^ | | | did you mean `XEmpty1 { /* fields */ }`? @@ -40,7 +40,7 @@ LL | let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1` error[E0423]: expected function, found struct `XEmpty1` --> $DIR/empty-struct-braces-expr.rs:21:15 | -LL | let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1` +LL | let xe1 = XEmpty1(); | ^^^^^^^ | | | did you mean `XEmpty1 { /* fields */ }`? @@ -49,7 +49,7 @@ LL | let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1 error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:22:19 | -LL | let xe3 = XE::Empty3; //~ ERROR no variant named `Empty3` found for type +LL | let xe3 = XE::Empty3; | ----^^^^^^ | | | | | help: did you mean: `XEmpty3` @@ -58,7 +58,7 @@ LL | let xe3 = XE::Empty3; //~ ERROR no variant named `Empty3` found for typ error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:23:19 | -LL | let xe3 = XE::Empty3(); //~ ERROR no variant named `Empty3` found for type +LL | let xe3 = XE::Empty3(); | ----^^^^^^ | | | | | help: did you mean: `XEmpty3` diff --git a/src/test/ui/empty/empty-struct-braces-pat-2.stderr b/src/test/ui/empty/empty-struct-braces-pat-2.stderr index fc2ed79bb2e0..12047b5880c3 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-2.stderr +++ b/src/test/ui/empty/empty-struct-braces-pat-2.stderr @@ -1,7 +1,7 @@ error[E0532]: expected tuple struct/variant, found struct `Empty1` --> $DIR/empty-struct-braces-pat-2.rs:15:9 | -LL | Empty1() => () //~ ERROR expected tuple struct/variant, found struct `Empty1` +LL | Empty1() => () | ^^^^^^ | | | did you mean `Empty1 { /* fields */ }`? @@ -10,7 +10,7 @@ LL | Empty1() => () //~ ERROR expected tuple struct/variant, found struc error[E0532]: expected tuple struct/variant, found struct `XEmpty1` --> $DIR/empty-struct-braces-pat-2.rs:18:9 | -LL | XEmpty1() => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1` +LL | XEmpty1() => () | ^^^^^^^ | | | did you mean `XEmpty1 { /* fields */ }`? @@ -19,7 +19,7 @@ LL | XEmpty1() => () //~ ERROR expected tuple struct/variant, found stru error[E0532]: expected tuple struct/variant, found struct `Empty1` --> $DIR/empty-struct-braces-pat-2.rs:21:9 | -LL | Empty1(..) => () //~ ERROR expected tuple struct/variant, found struct `Empty1` +LL | Empty1(..) => () | ^^^^^^ | | | did you mean `Empty1 { /* fields */ }`? @@ -28,7 +28,7 @@ LL | Empty1(..) => () //~ ERROR expected tuple struct/variant, found str error[E0532]: expected tuple struct/variant, found struct `XEmpty1` --> $DIR/empty-struct-braces-pat-2.rs:24:9 | -LL | XEmpty1(..) => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1` +LL | XEmpty1(..) => () | ^^^^^^^ | | | did you mean `XEmpty1 { /* fields */ }`? diff --git a/src/test/ui/empty/empty-struct-tuple-pat.stderr b/src/test/ui/empty/empty-struct-tuple-pat.stderr index f92c4e5c4634..71a8141b8ddd 100644 --- a/src/test/ui/empty/empty-struct-tuple-pat.stderr +++ b/src/test/ui/empty/empty-struct-tuple-pat.stderr @@ -4,7 +4,7 @@ error[E0530]: match bindings cannot shadow tuple structs LL | struct Empty2(); | ---------------- the tuple struct `Empty2` is defined here ... -LL | Empty2 => () //~ ERROR match bindings cannot shadow tuple structs +LL | Empty2 => () | ^^^^^^ cannot be named the same as a tuple struct error[E0530]: match bindings cannot shadow tuple structs @@ -13,7 +13,7 @@ error[E0530]: match bindings cannot shadow tuple structs LL | use empty_struct::*; | --------------- the tuple struct `XEmpty6` is imported here ... -LL | XEmpty6 => () //~ ERROR match bindings cannot shadow tuple structs +LL | XEmpty6 => () | ^^^^^^^ cannot be named the same as a tuple struct error[E0532]: expected unit struct/variant or constant, found tuple variant `E::Empty4` diff --git a/src/test/ui/empty/empty-struct-unit-expr.stderr b/src/test/ui/empty/empty-struct-unit-expr.stderr index b3519948f64d..696eabe99cff 100644 --- a/src/test/ui/empty/empty-struct-unit-expr.stderr +++ b/src/test/ui/empty/empty-struct-unit-expr.stderr @@ -4,7 +4,7 @@ error[E0618]: expected function, found `Empty2` LL | struct Empty2; | -------------- `Empty2` defined here ... -LL | let e2 = Empty2(); //~ ERROR expected function, found `Empty2` +LL | let e2 = Empty2(); | ^^^^^^-- | | | call expression requires function @@ -27,7 +27,7 @@ LL | let e4 = E::Empty4; error[E0618]: expected function, found `empty_struct::XEmpty2` --> $DIR/empty-struct-unit-expr.rs:18:15 | -LL | let xe2 = XEmpty2(); //~ ERROR expected function, found `empty_struct::XEmpty2` +LL | let xe2 = XEmpty2(); | ^^^^^^^-- | | | call expression requires function diff --git a/src/test/ui/empty/empty-struct-unit-pat.stderr b/src/test/ui/empty/empty-struct-unit-pat.stderr index e62246562be6..268fc7a6e0c1 100644 --- a/src/test/ui/empty/empty-struct-unit-pat.stderr +++ b/src/test/ui/empty/empty-struct-unit-pat.stderr @@ -1,31 +1,31 @@ error[E0532]: expected tuple struct/variant, found unit struct `Empty2` --> $DIR/empty-struct-unit-pat.rs:21:9 | -LL | Empty2() => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2` +LL | Empty2() => () | ^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2` --> $DIR/empty-struct-unit-pat.rs:24:9 | -LL | XEmpty2() => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2` +LL | XEmpty2() => () | ^^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found unit struct `Empty2` --> $DIR/empty-struct-unit-pat.rs:27:9 | -LL | Empty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2` +LL | Empty2(..) => () | ^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2` --> $DIR/empty-struct-unit-pat.rs:30:9 | -LL | XEmpty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2` +LL | XEmpty2(..) => () | ^^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4` --> $DIR/empty-struct-unit-pat.rs:34:9 | -LL | E::Empty4() => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4` +LL | E::Empty4() => () | ^^^^^^^^^ not a tuple struct/variant error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4` @@ -39,7 +39,7 @@ LL | XE::XEmpty4() => (), error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4` --> $DIR/empty-struct-unit-pat.rs:42:9 | -LL | E::Empty4(..) => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4` +LL | E::Empty4(..) => () | ^^^^^^^^^ not a tuple struct/variant error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4` diff --git a/src/test/ui/enable-unstable-lib-feature.stderr b/src/test/ui/enable-unstable-lib-feature.stderr index 51cfe7beade2..5b6ebc4c0d99 100644 --- a/src/test/ui/enable-unstable-lib-feature.stderr +++ b/src/test/ui/enable-unstable-lib-feature.stderr @@ -1,7 +1,7 @@ error: function `BOGUS` should have a snake case name --> $DIR/enable-unstable-lib-feature.rs:12:8 | -LL | pub fn BOGUS() { } //~ ERROR +LL | pub fn BOGUS() { } | ^^^^^ help: convert the identifier to snake case: `bogus` | note: lint level defined here diff --git a/src/test/ui/enum/enum-and-module-in-same-scope.stderr b/src/test/ui/enum/enum-and-module-in-same-scope.stderr index 5f42af8f260d..538898c2f2a6 100644 --- a/src/test/ui/enum/enum-and-module-in-same-scope.stderr +++ b/src/test/ui/enum/enum-and-module-in-same-scope.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `Foo` is defined multiple times LL | enum Foo { | -------- previous definition of the type `Foo` here ... -LL | mod Foo { //~ ERROR the name `Foo` is defined multiple times +LL | mod Foo { | ^^^^^^^ `Foo` redefined here | = note: `Foo` must be defined only once in the type namespace of this module diff --git a/src/test/ui/enum/enum-discrim-autosizing.stderr b/src/test/ui/enum/enum-discrim-autosizing.stderr index 67b0d75d787c..8848f984cfb7 100644 --- a/src/test/ui/enum/enum-discrim-autosizing.stderr +++ b/src/test/ui/enum/enum-discrim-autosizing.stderr @@ -3,7 +3,7 @@ error[E0081]: discriminant value `0` already exists | LL | Au64 = 0, | - first use of `0` -LL | Bu64 = 0x8000_0000_0000_0000 //~ERROR already exists +LL | Bu64 = 0x8000_0000_0000_0000 | ^^^^^^^^^^^^^^^^^^^^^ enum already has `0` error: aborting due to previous error diff --git a/src/test/ui/enum/enum-discrim-too-small2.stderr b/src/test/ui/enum/enum-discrim-too-small2.stderr index 31ca01b86bdb..6340f5a856ed 100644 --- a/src/test/ui/enum/enum-discrim-too-small2.stderr +++ b/src/test/ui/enum/enum-discrim-too-small2.stderr @@ -1,7 +1,7 @@ error: literal out of range for i8 --> $DIR/enum-discrim-too-small2.rs:8:11 | -LL | Ci8 = 223, //~ ERROR literal out of range for i8 +LL | Ci8 = 223, | ^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![deny(overflowing_literals)] error: literal out of range for i16 --> $DIR/enum-discrim-too-small2.rs:15:12 | -LL | Ci16 = 55555, //~ ERROR literal out of range for i16 +LL | Ci16 = 55555, | ^^^^^ error: literal out of range for i32 --> $DIR/enum-discrim-too-small2.rs:22:12 | -LL | Ci32 = 3_000_000_000, //~ ERROR literal out of range for i32 +LL | Ci32 = 3_000_000_000, | ^^^^^^^^^^^^^ error: literal out of range for i64 --> $DIR/enum-discrim-too-small2.rs:29:12 | -LL | Ci64 = 9223372036854775809, //~ ERROR literal out of range for i64 +LL | Ci64 = 9223372036854775809, | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/enum/enum-in-scope.stderr b/src/test/ui/enum/enum-in-scope.stderr index cd0100ec2fc4..49a01abcbd69 100644 --- a/src/test/ui/enum/enum-in-scope.stderr +++ b/src/test/ui/enum/enum-in-scope.stderr @@ -4,7 +4,7 @@ error[E0530]: let bindings cannot shadow tuple structs LL | struct hello(isize); | -------------------- the tuple struct `hello` is defined here ... -LL | let hello = 0; //~ERROR let bindings cannot shadow tuple structs +LL | let hello = 0; | ^^^^^ cannot be named the same as a tuple struct error: aborting due to previous error diff --git a/src/test/ui/enum/enum-size-variance.stderr b/src/test/ui/enum/enum-size-variance.stderr index 5cc0a0d7a8f8..1ebd9b6806f8 100644 --- a/src/test/ui/enum/enum-size-variance.stderr +++ b/src/test/ui/enum/enum-size-variance.stderr @@ -1,7 +1,7 @@ warning: enum variant is more than three times larger (32 bytes) than the next largest --> $DIR/enum-size-variance.rs:18:5 | -LL | L(i64, i64, i64, i64), //~ WARNING three times larger +LL | L(i64, i64, i64, i64), | ^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/enum/enum-to-float-cast-2.stderr b/src/test/ui/enum/enum-to-float-cast-2.stderr index 42d08a11ed1b..2bc414098dcf 100644 --- a/src/test/ui/enum/enum-to-float-cast-2.stderr +++ b/src/test/ui/enum/enum-to-float-cast-2.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `E` as `f32` is invalid --> $DIR/enum-to-float-cast-2.rs:14:13 | -LL | let a = E::L0 as f32; //~ ERROR casting +LL | let a = E::L0 as f32; | ^^^^^^^^^^^^ | = help: cast through an integer first @@ -9,7 +9,7 @@ LL | let a = E::L0 as f32; //~ ERROR casting error[E0606]: casting `F` as `f32` is invalid --> $DIR/enum-to-float-cast-2.rs:15:13 | -LL | let c = F::H1 as f32; //~ ERROR casting +LL | let c = F::H1 as f32; | ^^^^^^^^^^^^ | = help: cast through an integer first diff --git a/src/test/ui/enum/enum-to-float-cast.stderr b/src/test/ui/enum/enum-to-float-cast.stderr index e6cd2ed4d0da..191606d8dc53 100644 --- a/src/test/ui/enum/enum-to-float-cast.stderr +++ b/src/test/ui/enum/enum-to-float-cast.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `E` as `f32` is invalid --> $DIR/enum-to-float-cast.rs:13:18 | -LL | static C0: f32 = E::L0 as f32; //~ ERROR casting +LL | static C0: f32 = E::L0 as f32; | ^^^^^^^^^^^^ | = help: cast through an integer first @@ -9,7 +9,7 @@ LL | static C0: f32 = E::L0 as f32; //~ ERROR casting error[E0606]: casting `F` as `f32` is invalid --> $DIR/enum-to-float-cast.rs:14:18 | -LL | static C1: f32 = F::H1 as f32; //~ ERROR casting +LL | static C1: f32 = F::H1 as f32; | ^^^^^^^^^^^^ | = help: cast through an integer first diff --git a/src/test/ui/enum/enum-variant-type-2.stderr b/src/test/ui/enum/enum-variant-type-2.stderr index 3e7a4edd66e6..7e8453c61f62 100644 --- a/src/test/ui/enum/enum-variant-type-2.stderr +++ b/src/test/ui/enum/enum-variant-type-2.stderr @@ -1,7 +1,7 @@ error[E0573]: expected type, found variant `Foo::Bar` --> $DIR/enum-variant-type-2.rs:7:11 | -LL | fn foo(x: Foo::Bar) {} //~ ERROR expected type, found variant `Foo::Bar` +LL | fn foo(x: Foo::Bar) {} | ^^^^^^^^ | | | not a type diff --git a/src/test/ui/enums-pats-not-idents.stderr b/src/test/ui/enums-pats-not-idents.stderr index 5e12f3b5eadf..6b1e6046260a 100644 --- a/src/test/ui/enums-pats-not-idents.stderr +++ b/src/test/ui/enums-pats-not-idents.stderr @@ -1,7 +1,7 @@ error[E0531]: cannot find tuple struct/variant `a` in this scope --> $DIR/enums-pats-not-idents.rs:2:9 | -LL | let a(1) = 13; //~ ERROR cannot find tuple struct/variant `a` in this scope +LL | let a(1) = 13; | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0001.stderr b/src/test/ui/error-codes/E0001.stderr index 0b884c54a82f..992345151827 100644 --- a/src/test/ui/error-codes/E0001.stderr +++ b/src/test/ui/error-codes/E0001.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/E0001.rs:8:9 | -LL | _ => {/* ... */} //~ ERROR unreachable pattern +LL | _ => {/* ... */} | ^ | note: lint level defined here diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr index c8732852a71e..db0a2b5a0859 100644 --- a/src/test/ui/error-codes/E0004-2.stderr +++ b/src/test/ui/error-codes/E0004-2.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: multiple patterns of type `std::option::Option` are not handled --> $DIR/E0004-2.rs:4:11 | -LL | match x { } //~ ERROR E0004 +LL | match x { } | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/error-codes/E0004.stderr b/src/test/ui/error-codes/E0004.stderr index 123f4b2f1b71..2940ad4bb1e2 100644 --- a/src/test/ui/error-codes/E0004.stderr +++ b/src/test/ui/error-codes/E0004.stderr @@ -8,7 +8,7 @@ LL | | TalkToMyHand, LL | | } | |_- `Terminator` defined here ... -LL | match x { //~ ERROR E0004 +LL | match x { | ^ pattern `HastaLaVistaBaby` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/error-codes/E0005.stderr b/src/test/ui/error-codes/E0005.stderr index 2a38aae0873a..56a4bcffc81a 100644 --- a/src/test/ui/error-codes/E0005.stderr +++ b/src/test/ui/error-codes/E0005.stderr @@ -1,7 +1,7 @@ error[E0005]: refutable pattern in local binding: `None` not covered --> $DIR/E0005.rs:3:9 | -LL | let Some(y) = x; //~ ERROR E0005 +LL | let Some(y) = x; | ^^^^^^^ pattern `None` not covered error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0010-teach.stderr b/src/test/ui/error-codes/E0010-teach.stderr index 77e7b5ec0e86..3e8467fad6fc 100644 --- a/src/test/ui/error-codes/E0010-teach.stderr +++ b/src/test/ui/error-codes/E0010-teach.stderr @@ -1,7 +1,7 @@ error[E0010]: allocations are not allowed in constants --> $DIR/E0010-teach.rs:6:24 | -LL | const CON : Box = box 0; //~ ERROR E0010 +LL | const CON : Box = box 0; | ^^^^^ allocation not allowed in constants | = note: The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time. @@ -9,7 +9,7 @@ LL | const CON : Box = box 0; //~ ERROR E0010 error[E0019]: constant contains unimplemented expression type --> $DIR/E0010-teach.rs:6:28 | -LL | const CON : Box = box 0; //~ ERROR E0010 +LL | const CON : Box = box 0; | ^ | = note: A function call isn't allowed in the const's initialization expression because the expression's value must be known at compile-time. diff --git a/src/test/ui/error-codes/E0010.stderr b/src/test/ui/error-codes/E0010.stderr index 1364693109e0..285570f755ed 100644 --- a/src/test/ui/error-codes/E0010.stderr +++ b/src/test/ui/error-codes/E0010.stderr @@ -1,13 +1,13 @@ error[E0010]: allocations are not allowed in constants --> $DIR/E0010.rs:4:24 | -LL | const CON : Box = box 0; //~ ERROR E0010 +LL | const CON : Box = box 0; | ^^^^^ allocation not allowed in constants error[E0019]: constant contains unimplemented expression type --> $DIR/E0010.rs:4:28 | -LL | const CON : Box = box 0; //~ ERROR E0010 +LL | const CON : Box = box 0; | ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0017.stderr b/src/test/ui/error-codes/E0017.stderr index cc202ec912e9..d0bd93eb9089 100644 --- a/src/test/ui/error-codes/E0017.stderr +++ b/src/test/ui/error-codes/E0017.stderr @@ -1,31 +1,31 @@ error[E0017]: references in constants may only refer to immutable values --> $DIR/E0017.rs:4:30 | -LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | const CR: &'static mut i32 = &mut C; | ^^^^^^ constants require immutable values error[E0017]: references in statics may only refer to immutable values --> $DIR/E0017.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ statics require immutable values error: cannot mutate statics in the initializer of another static --> $DIR/E0017.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ error[E0596]: cannot borrow immutable static item as mutable --> $DIR/E0017.rs:5:44 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^ error[E0017]: references in statics may only refer to immutable values --> $DIR/E0017.rs:8:38 | -LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ statics require immutable values error: aborting due to 5 previous errors diff --git a/src/test/ui/error-codes/E0023.stderr b/src/test/ui/error-codes/E0023.stderr index 37704fc3233c..1bc90a995fe3 100644 --- a/src/test/ui/error-codes/E0023.stderr +++ b/src/test/ui/error-codes/E0023.stderr @@ -1,19 +1,19 @@ error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields --> $DIR/E0023.rs:10:9 | -LL | Fruit::Apple(a) => {}, //~ ERROR E0023 +LL | Fruit::Apple(a) => {}, | ^^^^^^^^^^^^^^^ expected 2 fields, found 1 error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields --> $DIR/E0023.rs:11:9 | -LL | Fruit::Apple(a, b, c) => {}, //~ ERROR E0023 +LL | Fruit::Apple(a, b, c) => {}, | ^^^^^^^^^^^^^^^^^^^^^ expected 2 fields, found 3 error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field --> $DIR/E0023.rs:12:9 | -LL | Fruit::Pear(1, 2) => {}, //~ ERROR E0023 +LL | Fruit::Pear(1, 2) => {}, | ^^^^^^^^^^^^^^^^^ expected 1 field, found 2 error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0034.stderr b/src/test/ui/error-codes/E0034.stderr index 3c5569eb79f3..816a48f102dc 100644 --- a/src/test/ui/error-codes/E0034.stderr +++ b/src/test/ui/error-codes/E0034.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/E0034.rs:20:5 | -LL | Test::foo() //~ ERROR multiple applicable items in scope +LL | Test::foo() | ^^^^^^^^^ multiple `foo` found | note: candidate #1 is defined in an impl of the trait `Trait1` for the type `Test` diff --git a/src/test/ui/error-codes/E0045.stderr b/src/test/ui/error-codes/E0045.stderr index 0ce91f0a4010..d163128bc8b6 100644 --- a/src/test/ui/error-codes/E0045.stderr +++ b/src/test/ui/error-codes/E0045.stderr @@ -1,7 +1,7 @@ error[E0045]: C-variadic function must have C or cdecl calling convention --> $DIR/E0045.rs:1:17 | -LL | extern "Rust" { fn foo(x: u8, ...); } //~ ERROR E0045 +LL | extern "Rust" { fn foo(x: u8, ...); } | ^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0049.stderr b/src/test/ui/error-codes/E0049.stderr index 0d132bdbbdda..7e9b9e8efb9a 100644 --- a/src/test/ui/error-codes/E0049.stderr +++ b/src/test/ui/error-codes/E0049.stderr @@ -4,7 +4,7 @@ error[E0049]: method `foo` has 0 type parameters but its trait declaration has 1 LL | fn foo(x: T) -> Self; | --------------------------------- expected 1 type parameter ... -LL | fn foo(x: bool) -> Self { Bar } //~ ERROR E0049 +LL | fn foo(x: bool) -> Self { Bar } | ^^^^^^^^^^^^^^^^^^^^^^^ found 0 type parameters error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0050.stderr b/src/test/ui/error-codes/E0050.stderr index 2c1fd111d26f..fe9ac5e8eb02 100644 --- a/src/test/ui/error-codes/E0050.stderr +++ b/src/test/ui/error-codes/E0050.stderr @@ -4,7 +4,7 @@ error[E0050]: method `foo` has 1 parameter but the declaration in trait `Foo::fo LL | fn foo(&self, x: u8) -> bool; | ------------ trait requires 2 parameters ... -LL | fn foo(&self) -> bool { true } //~ ERROR E0050 +LL | fn foo(&self) -> bool { true } | ^^^^^ expected 2 parameters, found 1 error[E0050]: method `bar` has 1 parameter but the declaration in trait `Foo::bar` has 4 @@ -13,7 +13,7 @@ error[E0050]: method `bar` has 1 parameter but the declaration in trait `Foo::ba LL | fn bar(&self, x: u8, y: u8, z: u8); | -------------------------- trait requires 4 parameters ... -LL | fn bar(&self) { } //~ ERROR E0050 +LL | fn bar(&self) { } | ^^^^^ expected 4 parameters, found 1 error[E0050]: method `less` has 4 parameters but the declaration in trait `Foo::less` has 1 @@ -22,7 +22,7 @@ error[E0050]: method `less` has 4 parameters but the declaration in trait `Foo:: LL | fn less(&self); | ----- trait requires 1 parameter ... -LL | fn less(&self, x: u8, y: u8, z: u8) { } //~ ERROR E0050 +LL | fn less(&self, x: u8, y: u8, z: u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 parameter, found 4 error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0054.stderr b/src/test/ui/error-codes/E0054.stderr index cce32fa29440..6b1092760fb4 100644 --- a/src/test/ui/error-codes/E0054.stderr +++ b/src/test/ui/error-codes/E0054.stderr @@ -1,7 +1,7 @@ error[E0054]: cannot cast as `bool` --> $DIR/E0054.rs:3:24 | -LL | let x_is_nonzero = x as bool; //~ ERROR E0054 +LL | let x_is_nonzero = x as bool; | ^^^^^^^^^ help: compare with zero instead: `x != 0` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0057.stderr b/src/test/ui/error-codes/E0057.stderr index 5906a05c32c9..6b5890cac36c 100644 --- a/src/test/ui/error-codes/E0057.stderr +++ b/src/test/ui/error-codes/E0057.stderr @@ -1,13 +1,13 @@ error[E0057]: this function takes 1 parameter but 0 parameters were supplied --> $DIR/E0057.rs:3:13 | -LL | let a = f(); //~ ERROR E0057 +LL | let a = f(); | ^^^ expected 1 parameter error[E0057]: this function takes 1 parameter but 2 parameters were supplied --> $DIR/E0057.rs:5:13 | -LL | let c = f(2, 3); //~ ERROR E0057 +LL | let c = f(2, 3); | ^^^^^^^ expected 1 parameter error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0059.stderr b/src/test/ui/error-codes/E0059.stderr index a96e1a0beab3..a1b8aeaedbb8 100644 --- a/src/test/ui/error-codes/E0059.stderr +++ b/src/test/ui/error-codes/E0059.stderr @@ -1,7 +1,7 @@ error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit --> $DIR/E0059.rs:3:41 | -LL | fn foo>(f: F) -> F::Output { f(3) } //~ ERROR E0059 +LL | fn foo>(f: F) -> F::Output { f(3) } | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0067.stderr b/src/test/ui/error-codes/E0067.stderr index fd4ca7c9f707..024c8681b550 100644 --- a/src/test/ui/error-codes/E0067.stderr +++ b/src/test/ui/error-codes/E0067.stderr @@ -1,7 +1,7 @@ error[E0368]: binary assignment operation `+=` cannot be applied to type `std::collections::LinkedList<_>` --> $DIR/E0067.rs:4:5 | -LL | LinkedList::new() += 1; //~ ERROR E0368 +LL | LinkedList::new() += 1; | -----------------^^^^^ | | | cannot use `+=` on type `std::collections::LinkedList<_>` @@ -11,7 +11,7 @@ LL | LinkedList::new() += 1; //~ ERROR E0368 error[E0067]: invalid left-hand side expression --> $DIR/E0067.rs:4:5 | -LL | LinkedList::new() += 1; //~ ERROR E0368 +LL | LinkedList::new() += 1; | ^^^^^^^^^^^^^^^^^ invalid expression for left-hand side error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0070.stderr b/src/test/ui/error-codes/E0070.stderr index 4c1cfd858e6c..6592ad328be5 100644 --- a/src/test/ui/error-codes/E0070.stderr +++ b/src/test/ui/error-codes/E0070.stderr @@ -1,19 +1,19 @@ error[E0070]: invalid left-hand side expression --> $DIR/E0070.rs:6:5 | -LL | SOME_CONST = 14; //~ ERROR E0070 +LL | SOME_CONST = 14; | ^^^^^^^^^^^^^^^ left-hand of expression not valid error[E0070]: invalid left-hand side expression --> $DIR/E0070.rs:7:5 | -LL | 1 = 3; //~ ERROR E0070 +LL | 1 = 3; | ^^^^^ left-hand of expression not valid error[E0308]: mismatched types --> $DIR/E0070.rs:8:25 | -LL | some_other_func() = 4; //~ ERROR E0070 +LL | some_other_func() = 4; | ^ expected (), found integer | = note: expected type `()` @@ -22,7 +22,7 @@ LL | some_other_func() = 4; //~ ERROR E0070 error[E0070]: invalid left-hand side expression --> $DIR/E0070.rs:8:5 | -LL | some_other_func() = 4; //~ ERROR E0070 +LL | some_other_func() = 4; | ^^^^^^^^^^^^^^^^^^^^^ left-hand of expression not valid error: aborting due to 4 previous errors diff --git a/src/test/ui/error-codes/E0075.stderr b/src/test/ui/error-codes/E0075.stderr index abf688970969..d8b90d0691da 100644 --- a/src/test/ui/error-codes/E0075.stderr +++ b/src/test/ui/error-codes/E0075.stderr @@ -1,7 +1,7 @@ error[E0075]: SIMD vector cannot be empty --> $DIR/E0075.rs:4:1 | -LL | struct Bad; //~ ERROR E0075 +LL | struct Bad; | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0077.stderr b/src/test/ui/error-codes/E0077.stderr index 9f3e1fa5c358..4f85d175ce65 100644 --- a/src/test/ui/error-codes/E0077.stderr +++ b/src/test/ui/error-codes/E0077.stderr @@ -1,7 +1,7 @@ error[E0077]: SIMD vector element type should be machine type --> $DIR/E0077.rs:4:1 | -LL | struct Bad(String); //~ ERROR E0077 +LL | struct Bad(String); | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0080.stderr b/src/test/ui/error-codes/E0080.stderr index 4d37881c1e12..3113fd2189b4 100644 --- a/src/test/ui/error-codes/E0080.stderr +++ b/src/test/ui/error-codes/E0080.stderr @@ -1,13 +1,13 @@ error[E0080]: evaluation of constant value failed --> $DIR/E0080.rs:2:9 | -LL | X = (1 << 500), //~ ERROR E0080 +LL | X = (1 << 500), | ^^^^^^^^^^ attempt to shift left with overflow error[E0080]: evaluation of constant value failed --> $DIR/E0080.rs:4:9 | -LL | Y = (1 / 0) //~ ERROR E0080 +LL | Y = (1 / 0) | ^^^^^^^ attempt to divide by zero error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0084.stderr b/src/test/ui/error-codes/E0084.stderr index 353c825f5280..1f818da25bb0 100644 --- a/src/test/ui/error-codes/E0084.stderr +++ b/src/test/ui/error-codes/E0084.stderr @@ -1,7 +1,7 @@ error[E0084]: unsupported representation for zero-variant enum --> $DIR/E0084.rs:1:1 | -LL | #[repr(i32)] //~ ERROR: E0084 +LL | #[repr(i32)] | ^^^^^^^^^^^^ LL | enum Foo {} | ----------- zero-variant enum diff --git a/src/test/ui/error-codes/E0091.stderr b/src/test/ui/error-codes/E0091.stderr index d32960f82cbc..a596b75e481d 100644 --- a/src/test/ui/error-codes/E0091.stderr +++ b/src/test/ui/error-codes/E0091.stderr @@ -1,13 +1,13 @@ error[E0091]: type parameter `T` is unused --> $DIR/E0091.rs:1:10 | -LL | type Foo = u32; //~ ERROR E0091 +LL | type Foo = u32; | ^ unused type parameter error[E0091]: type parameter `B` is unused --> $DIR/E0091.rs:2:14 | -LL | type Foo2 = Box; //~ ERROR E0091 +LL | type Foo2 = Box; | ^ unused type parameter error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0092.stderr b/src/test/ui/error-codes/E0092.stderr index a45351775269..2d590a8e1d70 100644 --- a/src/test/ui/error-codes/E0092.stderr +++ b/src/test/ui/error-codes/E0092.stderr @@ -1,7 +1,7 @@ error[E0092]: unrecognized atomic operation function: `foo` --> $DIR/E0092.rs:3:5 | -LL | fn atomic_foo(); //~ ERROR E0092 +LL | fn atomic_foo(); | ^^^^^^^^^^^^^^^^ unrecognized atomic operation error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0094.stderr b/src/test/ui/error-codes/E0094.stderr index 97bdbfbe5ab5..da97f3a014b0 100644 --- a/src/test/ui/error-codes/E0094.stderr +++ b/src/test/ui/error-codes/E0094.stderr @@ -1,7 +1,7 @@ error[E0094]: intrinsic has wrong number of type parameters: found 2, expected 1 --> $DIR/E0094.rs:3:15 | -LL | fn size_of() -> usize; //~ ERROR E0094 +LL | fn size_of() -> usize; | ^^^^^^ expected 1 type parameter error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0109.stderr b/src/test/ui/error-codes/E0109.stderr index a5508f980857..a807f2d44a6f 100644 --- a/src/test/ui/error-codes/E0109.stderr +++ b/src/test/ui/error-codes/E0109.stderr @@ -1,7 +1,7 @@ error[E0109]: type arguments are not allowed on this entity --> $DIR/E0109.rs:1:14 | -LL | type X = u32; //~ ERROR E0109 +LL | type X = u32; | ^^^ type argument not allowed error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0110.stderr b/src/test/ui/error-codes/E0110.stderr index a644ac92cefb..3bc4775bdc12 100644 --- a/src/test/ui/error-codes/E0110.stderr +++ b/src/test/ui/error-codes/E0110.stderr @@ -1,7 +1,7 @@ error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/E0110.rs:1:14 | -LL | type X = u32<'static>; //~ ERROR E0110 +LL | type X = u32<'static>; | ^^^^^^^ lifetime argument not allowed error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0117.stderr b/src/test/ui/error-codes/E0117.stderr index b007ca05ab2c..80b3a4e714ae 100644 --- a/src/test/ui/error-codes/E0117.stderr +++ b/src/test/ui/error-codes/E0117.stderr @@ -1,13 +1,13 @@ error[E0120]: the Drop trait may only be implemented on structures --> $DIR/E0117.rs:1:15 | -LL | impl Drop for u32 {} //~ ERROR E0117 +LL | impl Drop for u32 {} | ^^^ implementing Drop requires a struct error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/E0117.rs:1:1 | -LL | impl Drop for u32 {} //~ ERROR E0117 +LL | impl Drop for u32 {} | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate diff --git a/src/test/ui/error-codes/E0118.stderr b/src/test/ui/error-codes/E0118.stderr index 787f8caec7f4..b0afaeb5c1fa 100644 --- a/src/test/ui/error-codes/E0118.stderr +++ b/src/test/ui/error-codes/E0118.stderr @@ -1,7 +1,7 @@ error[E0118]: no base type found for inherent implementation --> $DIR/E0118.rs:1:6 | -LL | impl (u8, u8) { //~ ERROR E0118 +LL | impl (u8, u8) { | ^^^^^^^^ impl requires a base type | = note: either implement a trait on it or create a newtype to wrap it instead diff --git a/src/test/ui/error-codes/E0119.stderr b/src/test/ui/error-codes/E0119.stderr index af9acb294bcd..e7690aa30bd2 100644 --- a/src/test/ui/error-codes/E0119.stderr +++ b/src/test/ui/error-codes/E0119.stderr @@ -4,7 +4,7 @@ error[E0119]: conflicting implementations of trait `MyTrait` for type `Foo`: LL | impl MyTrait for T { | --------------------- first implementation here ... -LL | impl MyTrait for Foo { //~ ERROR E0119 +LL | impl MyTrait for Foo { | ^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Foo` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0121.stderr b/src/test/ui/error-codes/E0121.stderr index 75e03c659b77..b7f4ce4d230e 100644 --- a/src/test/ui/error-codes/E0121.stderr +++ b/src/test/ui/error-codes/E0121.stderr @@ -1,13 +1,13 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/E0121.rs:1:13 | -LL | fn foo() -> _ { 5 } //~ ERROR E0121 +LL | fn foo() -> _ { 5 } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/E0121.rs:3:13 | -LL | static BAR: _ = "test"; //~ ERROR E0121 +LL | static BAR: _ = "test"; | ^ not allowed in type signatures error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0128.stderr b/src/test/ui/error-codes/E0128.stderr index 9ea3c09e63f5..253aa166bd37 100644 --- a/src/test/ui/error-codes/E0128.stderr +++ b/src/test/ui/error-codes/E0128.stderr @@ -1,7 +1,7 @@ error[E0128]: type parameters with a default cannot use forward declared identifiers --> $DIR/E0128.rs:1:14 | -LL | struct Foo { //~ ERROR E0128 +LL | struct Foo { | ^ defaulted type parameters cannot be forward declared error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0132.stderr b/src/test/ui/error-codes/E0132.stderr index e19b421bfdb9..c21363756b3e 100644 --- a/src/test/ui/error-codes/E0132.stderr +++ b/src/test/ui/error-codes/E0132.stderr @@ -1,7 +1,7 @@ error[E0132]: start function is not allowed to have type parameters --> $DIR/E0132.rs:4:5 | -LL | fn f< T >() {} //~ ERROR E0132 +LL | fn f< T >() {} | ^^^^^ start function cannot have type parameters error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0152.stderr b/src/test/ui/error-codes/E0152.stderr index 401c1755fa8b..26e6e2e1bce7 100644 --- a/src/test/ui/error-codes/E0152.stderr +++ b/src/test/ui/error-codes/E0152.stderr @@ -1,7 +1,7 @@ error[E0152]: duplicate lang item found: `arc`. --> $DIR/E0152.rs:4:1 | -LL | struct Foo; //~ ERROR E0152 +LL | struct Foo; | ^^^^^^^^^^^ | = note: first defined in crate `alloc`. diff --git a/src/test/ui/error-codes/E0164.stderr b/src/test/ui/error-codes/E0164.stderr index 0debc8092e86..0a153d85b421 100644 --- a/src/test/ui/error-codes/E0164.stderr +++ b/src/test/ui/error-codes/E0164.stderr @@ -1,7 +1,7 @@ error[E0164]: expected tuple struct/variant, found associated constant `::B` --> $DIR/E0164.rs:9:9 | -LL | Foo::B(i) => i, //~ ERROR E0164 +LL | Foo::B(i) => i, | ^^^^^^^^^ not a tuple variant or struct error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0184.stderr b/src/test/ui/error-codes/E0184.stderr index 471ba3870e21..b4128b956066 100644 --- a/src/test/ui/error-codes/E0184.stderr +++ b/src/test/ui/error-codes/E0184.stderr @@ -1,7 +1,7 @@ error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor --> $DIR/E0184.rs:1:10 | -LL | #[derive(Copy)] //~ ERROR E0184 +LL | #[derive(Copy)] | ^^^^ Copy not allowed on types with destructors error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0186.stderr b/src/test/ui/error-codes/E0186.stderr index 7fed0426ee87..8971d61fc758 100644 --- a/src/test/ui/error-codes/E0186.stderr +++ b/src/test/ui/error-codes/E0186.stderr @@ -1,10 +1,10 @@ error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl --> $DIR/E0186.rs:8:5 | -LL | fn foo(&self); //~ `&self` used in trait +LL | fn foo(&self); | -------------- `&self` used in trait ... -LL | fn foo() {} //~ ERROR E0186 +LL | fn foo() {} | ^^^^^^^^ expected `&self` in impl error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0191.stderr b/src/test/ui/error-codes/E0191.stderr index 570b0ddc3131..2d9fdfe5d29c 100644 --- a/src/test/ui/error-codes/E0191.stderr +++ b/src/test/ui/error-codes/E0191.stderr @@ -4,7 +4,7 @@ error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) mu LL | type Bar; | --------- `Bar` defined here ... -LL | type Foo = Trait; //~ ERROR E0191 +LL | type Foo = Trait; | ^^^^^ associated type `Bar` must be specified error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0192.stderr b/src/test/ui/error-codes/E0192.stderr index bdfe717afe27..8faa550a5093 100644 --- a/src/test/ui/error-codes/E0192.stderr +++ b/src/test/ui/error-codes/E0192.stderr @@ -1,7 +1,7 @@ error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) --> $DIR/E0192.rs:9:1 | -LL | impl !Trait for Foo { } //~ ERROR E0192 +LL | impl !Trait for Foo { } | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0195.stderr b/src/test/ui/error-codes/E0195.stderr index 57032c6b0c84..6eaa1750ee35 100644 --- a/src/test/ui/error-codes/E0195.stderr +++ b/src/test/ui/error-codes/E0195.stderr @@ -4,7 +4,7 @@ error[E0195]: lifetime parameters or bounds on method `bar` do not match the tra LL | fn bar<'a,'b:'a>(x: &'a str, y: &'b str); | ---------- lifetimes in impl do not match this method in trait ... -LL | fn bar<'a,'b>(x: &'a str, y: &'b str) { //~ ERROR E0195 +LL | fn bar<'a,'b>(x: &'a str, y: &'b str) { | ^^^^^^^ lifetimes do not match method in trait error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0197.stderr b/src/test/ui/error-codes/E0197.stderr index f58dcd791da1..bb7b6474d3e3 100644 --- a/src/test/ui/error-codes/E0197.stderr +++ b/src/test/ui/error-codes/E0197.stderr @@ -1,7 +1,7 @@ error[E0197]: inherent impls cannot be unsafe --> $DIR/E0197.rs:3:1 | -LL | unsafe impl Foo { } //~ ERROR E0197 +LL | unsafe impl Foo { } | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0198.stderr b/src/test/ui/error-codes/E0198.stderr index e182cbd2ec15..0d3706336a9c 100644 --- a/src/test/ui/error-codes/E0198.stderr +++ b/src/test/ui/error-codes/E0198.stderr @@ -1,7 +1,7 @@ error[E0198]: negative impls cannot be unsafe --> $DIR/E0198.rs:5:1 | -LL | unsafe impl !Send for Foo { } //~ ERROR E0198 +LL | unsafe impl !Send for Foo { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0199.stderr b/src/test/ui/error-codes/E0199.stderr index ba55c4a58e47..3632d26cd32e 100644 --- a/src/test/ui/error-codes/E0199.stderr +++ b/src/test/ui/error-codes/E0199.stderr @@ -1,7 +1,7 @@ error[E0199]: implementing the trait `Bar` is not unsafe --> $DIR/E0199.rs:6:1 | -LL | unsafe impl Bar for Foo { } //~ ERROR implementing the trait `Bar` is not unsafe [E0199] +LL | unsafe impl Bar for Foo { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0200.stderr b/src/test/ui/error-codes/E0200.stderr index f6a8f32d2384..677271aad445 100644 --- a/src/test/ui/error-codes/E0200.stderr +++ b/src/test/ui/error-codes/E0200.stderr @@ -1,7 +1,7 @@ error[E0200]: the trait `Bar` requires an `unsafe impl` declaration --> $DIR/E0200.rs:5:1 | -LL | impl Bar for Foo { } //~ ERROR E0200 +LL | impl Bar for Foo { } | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0201.stderr b/src/test/ui/error-codes/E0201.stderr index 5d2f9f3e362e..89cfd4024230 100644 --- a/src/test/ui/error-codes/E0201.stderr +++ b/src/test/ui/error-codes/E0201.stderr @@ -3,7 +3,7 @@ error[E0201]: duplicate definitions with name `bar`: | LL | fn bar(&self) -> bool { self.0 > 5 } | ------------------------------------ previous definition of `bar` here -LL | fn bar() {} //~ ERROR E0201 +LL | fn bar() {} | ^^^^^^^^^^^ duplicate definition error[E0201]: duplicate definitions with name `baz`: @@ -11,7 +11,7 @@ error[E0201]: duplicate definitions with name `baz`: | LL | fn baz(&self) -> bool { true } | ------------------------------ previous definition of `baz` here -LL | fn baz(&self) -> bool { self.0 > 5 } //~ ERROR E0201 +LL | fn baz(&self) -> bool { self.0 > 5 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definition error[E0201]: duplicate definitions with name `Quux`: @@ -20,7 +20,7 @@ error[E0201]: duplicate definitions with name `Quux`: LL | type Quux = u32; | ---------------- previous definition of `Quux` here ... -LL | type Quux = u32; //~ ERROR E0201 +LL | type Quux = u32; | ^^^^^^^^^^^^^^^^ duplicate definition error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0207.stderr b/src/test/ui/error-codes/E0207.stderr index c82859a9867e..5ef51ed86926 100644 --- a/src/test/ui/error-codes/E0207.stderr +++ b/src/test/ui/error-codes/E0207.stderr @@ -1,7 +1,7 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates --> $DIR/E0207.rs:3:6 | -LL | impl Foo { //~ ERROR E0207 +LL | impl Foo { | ^ unconstrained type parameter error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0220.stderr b/src/test/ui/error-codes/E0220.stderr index 0eb812a5ef07..43949833e21d 100644 --- a/src/test/ui/error-codes/E0220.stderr +++ b/src/test/ui/error-codes/E0220.stderr @@ -1,7 +1,7 @@ error[E0220]: associated type `F` not found for `Trait` --> $DIR/E0220.rs:5:18 | -LL | type Foo = Trait; //~ ERROR E0220 +LL | type Foo = Trait; | ^^^^^ associated type `F` not found error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) must be specified @@ -10,7 +10,7 @@ error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) mu LL | type Bar; | --------- `Bar` defined here ... -LL | type Foo = Trait; //~ ERROR E0220 +LL | type Foo = Trait; | ^^^^^^^^^^^^ associated type `Bar` must be specified error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0252.stderr b/src/test/ui/error-codes/E0252.stderr index bd06241fc76d..8486806c6729 100644 --- a/src/test/ui/error-codes/E0252.stderr +++ b/src/test/ui/error-codes/E0252.stderr @@ -3,13 +3,13 @@ error[E0252]: the name `baz` is defined multiple times | LL | use foo::baz; | -------- previous import of the type `baz` here -LL | use bar::baz; //~ ERROR E0252 +LL | use bar::baz; | ^^^^^^^^ `baz` reimported here | = note: `baz` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use bar::baz as other_baz; //~ ERROR E0252 +LL | use bar::baz as other_baz; | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0255.stderr b/src/test/ui/error-codes/E0255.stderr index a47aa7c6592d..36e4eeeaeea7 100644 --- a/src/test/ui/error-codes/E0255.stderr +++ b/src/test/ui/error-codes/E0255.stderr @@ -4,7 +4,7 @@ error[E0255]: the name `foo` is defined multiple times LL | use bar::foo; | -------- previous import of the value `foo` here LL | -LL | fn foo() {} //~ ERROR E0255 +LL | fn foo() {} | ^^^^^^^^ `foo` redefined here | = note: `foo` must be defined only once in the value namespace of this module diff --git a/src/test/ui/error-codes/E0261.stderr b/src/test/ui/error-codes/E0261.stderr index 9e64f6c3f149..3bf5e9d81548 100644 --- a/src/test/ui/error-codes/E0261.stderr +++ b/src/test/ui/error-codes/E0261.stderr @@ -1,13 +1,13 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/E0261.rs:1:12 | -LL | fn foo(x: &'a str) { } //~ ERROR E0261 +LL | fn foo(x: &'a str) { } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/E0261.rs:5:9 | -LL | x: &'a str, //~ ERROR E0261 +LL | x: &'a str, | ^^ undeclared lifetime error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0262.stderr b/src/test/ui/error-codes/E0262.stderr index 8f01889a470b..ad90b7171266 100644 --- a/src/test/ui/error-codes/E0262.stderr +++ b/src/test/ui/error-codes/E0262.stderr @@ -1,7 +1,7 @@ error[E0262]: invalid lifetime parameter name: `'static` --> $DIR/E0262.rs:1:8 | -LL | fn foo<'static>(x: &'static str) { } //~ ERROR E0262 +LL | fn foo<'static>(x: &'static str) { } | ^^^^^^^ 'static is a reserved lifetime name error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0264.stderr b/src/test/ui/error-codes/E0264.stderr index bc6a0d9f96c3..403c0aa4146c 100644 --- a/src/test/ui/error-codes/E0264.stderr +++ b/src/test/ui/error-codes/E0264.stderr @@ -1,7 +1,7 @@ error[E0264]: unknown external lang item: `cake` --> $DIR/E0264.rs:5:5 | -LL | fn cake(); //~ ERROR E0264 +LL | fn cake(); | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0267.stderr b/src/test/ui/error-codes/E0267.stderr index 3506c1c0f165..b14cfd1a52d4 100644 --- a/src/test/ui/error-codes/E0267.stderr +++ b/src/test/ui/error-codes/E0267.stderr @@ -1,7 +1,7 @@ error[E0267]: `break` inside of a closure --> $DIR/E0267.rs:2:18 | -LL | let w = || { break; }; //~ ERROR E0267 +LL | let w = || { break; }; | ^^^^^ cannot break inside of a closure error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0268.stderr b/src/test/ui/error-codes/E0268.stderr index 3e276bd1acb0..3c77e7f3df2b 100644 --- a/src/test/ui/error-codes/E0268.stderr +++ b/src/test/ui/error-codes/E0268.stderr @@ -1,7 +1,7 @@ error[E0268]: `break` outside of loop --> $DIR/E0268.rs:2:5 | -LL | break; //~ ERROR E0268 +LL | break; | ^^^^^ cannot break outside of a loop error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0271.stderr b/src/test/ui/error-codes/E0271.stderr index 8fcb68e434f8..16c3ab9d7425 100644 --- a/src/test/ui/error-codes/E0271.stderr +++ b/src/test/ui/error-codes/E0271.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving `::AssociatedType == u32` --> $DIR/E0271.rs:10:5 | -LL | foo(3_i8); //~ ERROR E0271 +LL | foo(3_i8); | ^^^ expected reference, found u32 | = note: expected type `&'static str` diff --git a/src/test/ui/error-codes/E0275.stderr b/src/test/ui/error-codes/E0275.stderr index f2b0f392bc8b..01a923a53a2b 100644 --- a/src/test/ui/error-codes/E0275.stderr +++ b/src/test/ui/error-codes/E0275.stderr @@ -1,7 +1,7 @@ error[E0275]: overflow evaluating the requirement `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` --> $DIR/E0275.rs:5:1 | -LL | impl Foo for T where Bar: Foo {} //~ ERROR E0275 +LL | impl Foo for T where Bar: Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding a `#![recursion_limit="128"]` attribute to your crate diff --git a/src/test/ui/error-codes/E0276.stderr b/src/test/ui/error-codes/E0276.stderr index 393ad8c81a07..a8b016ebf52a 100644 --- a/src/test/ui/error-codes/E0276.stderr +++ b/src/test/ui/error-codes/E0276.stderr @@ -4,7 +4,7 @@ error[E0276]: impl has stricter requirements than trait LL | fn foo(x: T); | ---------------- definition of `foo` from trait ... -LL | fn foo(x: T) where T: Copy {} //~ ERROR E0276 +LL | fn foo(x: T) where T: Copy {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: std::marker::Copy` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0282.stderr b/src/test/ui/error-codes/E0282.stderr index 49165d1e42bb..3a5040eb6daa 100644 --- a/src/test/ui/error-codes/E0282.stderr +++ b/src/test/ui/error-codes/E0282.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/E0282.rs:2:9 | -LL | let x = "hello".chars().rev().collect(); //~ ERROR E0282 +LL | let x = "hello".chars().rev().collect(); | ^ | | | cannot infer type diff --git a/src/test/ui/error-codes/E0283.stderr b/src/test/ui/error-codes/E0283.stderr index 598ec672ce63..e1f53e592fc8 100644 --- a/src/test/ui/error-codes/E0283.stderr +++ b/src/test/ui/error-codes/E0283.stderr @@ -1,7 +1,7 @@ error[E0283]: type annotations required: cannot resolve `_: Generator` --> $DIR/E0283.rs:18:21 | -LL | let cont: u32 = Generator::create(); //~ ERROR E0283 +LL | let cont: u32 = Generator::create(); | ^^^^^^^^^^^^^^^^^ | note: required by `Generator::create` diff --git a/src/test/ui/error-codes/E0301.stderr b/src/test/ui/error-codes/E0301.stderr index 3cfacd5983f0..80ee681a5179 100644 --- a/src/test/ui/error-codes/E0301.stderr +++ b/src/test/ui/error-codes/E0301.stderr @@ -1,7 +1,7 @@ error[E0301]: cannot mutably borrow in a pattern guard --> $DIR/E0301.rs:4:19 | -LL | option if option.take().is_none() => {}, //~ ERROR E0301 +LL | option if option.take().is_none() => {}, | ^^^^^^ borrowed mutably in pattern guard error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0302.stderr b/src/test/ui/error-codes/E0302.stderr index 66b31361762d..69ebb6bb9c9f 100644 --- a/src/test/ui/error-codes/E0302.stderr +++ b/src/test/ui/error-codes/E0302.stderr @@ -1,7 +1,7 @@ error[E0302]: cannot assign in a pattern guard --> $DIR/E0302.rs:4:21 | -LL | option if { option = None; false } => { }, //~ ERROR E0302 +LL | option if { option = None; false } => { }, | ^^^^^^^^^^^^^ assignment in pattern guard error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0308-4.stderr b/src/test/ui/error-codes/E0308-4.stderr index f69a38933659..3c51106cae8c 100644 --- a/src/test/ui/error-codes/E0308-4.stderr +++ b/src/test/ui/error-codes/E0308-4.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | match x { | - this match expression has type `u8` -LL | 0u8..=3i8 => (), //~ ERROR E0308 +LL | 0u8..=3i8 => (), | ^^^^^^^^^ expected u8, found i8 error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0308.stderr b/src/test/ui/error-codes/E0308.stderr index 8c71747fbcdf..bd9834ceb9fe 100644 --- a/src/test/ui/error-codes/E0308.stderr +++ b/src/test/ui/error-codes/E0308.stderr @@ -1,7 +1,7 @@ error[E0308]: intrinsic has wrong type --> $DIR/E0308.rs:4:5 | -LL | fn size_of(); //~ ERROR E0308 +LL | fn size_of(); | ^^^^^^^^^^^^^^^^ expected (), found usize | = note: expected type `extern "rust-intrinsic" fn()` diff --git a/src/test/ui/error-codes/E0370.stderr b/src/test/ui/error-codes/E0370.stderr index cd1903bd7e26..7fb622ee80bb 100644 --- a/src/test/ui/error-codes/E0370.stderr +++ b/src/test/ui/error-codes/E0370.stderr @@ -1,7 +1,7 @@ error[E0370]: enum discriminant overflowed --> $DIR/E0370.rs:7:5 | -LL | Y, //~ ERROR E0370 +LL | Y, | ^ overflowed on value after 9223372036854775807 | = note: explicitly set `Y = -9223372036854775808` if that is desired outcome diff --git a/src/test/ui/error-codes/E0374.stderr b/src/test/ui/error-codes/E0374.stderr index 9226ca0e478d..7ab0f82fc236 100644 --- a/src/test/ui/error-codes/E0374.stderr +++ b/src/test/ui/error-codes/E0374.stderr @@ -1,7 +1,7 @@ error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced, none found --> $DIR/E0374.rs:8:1 | -LL | / impl CoerceUnsized> for Foo //~ ERROR E0374 +LL | / impl CoerceUnsized> for Foo LL | | where T: CoerceUnsized {} | |________________________________^ diff --git a/src/test/ui/error-codes/E0376.stderr b/src/test/ui/error-codes/E0376.stderr index 2894a9196320..015448c39eaa 100644 --- a/src/test/ui/error-codes/E0376.stderr +++ b/src/test/ui/error-codes/E0376.stderr @@ -1,7 +1,7 @@ error[E0376]: the trait `CoerceUnsized` may only be implemented for a coercion between structures --> $DIR/E0376.rs:8:1 | -LL | impl CoerceUnsized for Foo {} //~ ERROR E0376 +LL | impl CoerceUnsized for Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0388.stderr b/src/test/ui/error-codes/E0388.stderr index f641830ae9ff..3f662459c841 100644 --- a/src/test/ui/error-codes/E0388.stderr +++ b/src/test/ui/error-codes/E0388.stderr @@ -1,31 +1,31 @@ error[E0017]: references in constants may only refer to immutable values --> $DIR/E0388.rs:4:30 | -LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | const CR: &'static mut i32 = &mut C; | ^^^^^^ constants require immutable values error[E0017]: references in statics may only refer to immutable values --> $DIR/E0388.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ statics require immutable values error: cannot mutate statics in the initializer of another static --> $DIR/E0388.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ error[E0596]: cannot borrow immutable static item as mutable --> $DIR/E0388.rs:5:44 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^ error[E0017]: references in statics may only refer to immutable values --> $DIR/E0388.rs:8:38 | -LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ statics require immutable values error: aborting due to 5 previous errors diff --git a/src/test/ui/error-codes/E0389.stderr b/src/test/ui/error-codes/E0389.stderr index cc8914ef3a6f..927eace727ee 100644 --- a/src/test/ui/error-codes/E0389.stderr +++ b/src/test/ui/error-codes/E0389.stderr @@ -1,7 +1,7 @@ error[E0389]: cannot assign to data in a `&` reference --> $DIR/E0389.rs:8:5 | -LL | fancy_ref.num = 6; //~ ERROR E0389 +LL | fancy_ref.num = 6; | ^^^^^^^^^^^^^^^^^ assignment into an immutable reference error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0390.stderr b/src/test/ui/error-codes/E0390.stderr index 7632229360ee..3ca3a77c74fb 100644 --- a/src/test/ui/error-codes/E0390.stderr +++ b/src/test/ui/error-codes/E0390.stderr @@ -1,13 +1,13 @@ error[E0390]: only a single inherent implementation marked with `#[lang = "mut_ptr"]` is allowed for the `*mut T` primitive --> $DIR/E0390.rs:5:1 | -LL | impl *mut Foo {} //~ ERROR E0390 +LL | impl *mut Foo {} | ^^^^^^^^^^^^^^^^ | help: consider using a trait to implement these methods --> $DIR/E0390.rs:5:1 | -LL | impl *mut Foo {} //~ ERROR E0390 +LL | impl *mut Foo {} | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0392.stderr b/src/test/ui/error-codes/E0392.stderr index 4bb3b87bb4a2..18419572233e 100644 --- a/src/test/ui/error-codes/E0392.stderr +++ b/src/test/ui/error-codes/E0392.stderr @@ -1,7 +1,7 @@ error[E0392]: parameter `T` is never used --> $DIR/E0392.rs:1:10 | -LL | enum Foo { Bar } //~ ERROR E0392 +LL | enum Foo { Bar } | ^ unused type parameter | = help: consider removing `T` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/error-codes/E0395.stderr b/src/test/ui/error-codes/E0395.stderr index cc7d94e22eb6..9d80acb515d5 100644 --- a/src/test/ui/error-codes/E0395.stderr +++ b/src/test/ui/error-codes/E0395.stderr @@ -1,7 +1,7 @@ error[E0658]: comparing raw pointers inside static (see issue #53020) --> $DIR/E0395.rs:6:29 | -LL | static BAZ: bool = unsafe { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020 +LL | static BAZ: bool = unsafe { (&FOO as *const i32) == (&BAR as *const i32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_compare_raw_pointers)] to the crate attributes to enable diff --git a/src/test/ui/error-codes/E0401.stderr b/src/test/ui/error-codes/E0401.stderr index 27f281ee4378..7c54e5b4edba 100644 --- a/src/test/ui/error-codes/E0401.stderr +++ b/src/test/ui/error-codes/E0401.stderr @@ -3,7 +3,7 @@ error[E0401]: can't use generic parameters from outer function | LL | fn foo(x: T) { | - type variable from outer function -LL | fn bfnr, W: Fn()>(y: T) { //~ ERROR E0401 +LL | fn bfnr, W: Fn()>(y: T) { | --------------------------- ^ use of generic parameter from outer function | | | help: try using a local generic parameter instead: `bfnr, W: Fn(), T>` @@ -17,7 +17,7 @@ LL | fn foo(x: T) { LL | fn baz Iterator for A { | ---- `Self` type implicitly declared here, by this `impl` ... -LL | fn helper(sel: &Self) -> u8 { //~ ERROR E0401 +LL | fn helper(sel: &Self) -> u8 { | ^^^^ | | | use of generic parameter from outer function diff --git a/src/test/ui/error-codes/E0403.stderr b/src/test/ui/error-codes/E0403.stderr index b92464750296..2bd7de6c2461 100644 --- a/src/test/ui/error-codes/E0403.stderr +++ b/src/test/ui/error-codes/E0403.stderr @@ -1,7 +1,7 @@ error[E0403]: the name `T` is already used for a generic parameter in this list of generic parameters --> $DIR/E0403.rs:1:11 | -LL | fn foo(s: T, u: T) {} //~ ERROR E0403 +LL | fn foo(s: T, u: T) {} | - ^ already used | | | first use of `T` diff --git a/src/test/ui/error-codes/E0404.stderr b/src/test/ui/error-codes/E0404.stderr index f84fd52c851a..4ccb6c5728e8 100644 --- a/src/test/ui/error-codes/E0404.stderr +++ b/src/test/ui/error-codes/E0404.stderr @@ -1,13 +1,13 @@ error[E0404]: expected trait, found struct `Foo` --> $DIR/E0404.rs:4:6 | -LL | impl Foo for Bar {} //~ ERROR E0404 +LL | impl Foo for Bar {} | ^^^ not a trait error[E0404]: expected trait, found struct `Foo` --> $DIR/E0404.rs:8:11 | -LL | fn baz(_: T) {} //~ ERROR E0404 +LL | fn baz(_: T) {} | ^^^ not a trait error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0405.stderr b/src/test/ui/error-codes/E0405.stderr index 2f09a525e450..a22afe6f3e8c 100644 --- a/src/test/ui/error-codes/E0405.stderr +++ b/src/test/ui/error-codes/E0405.stderr @@ -1,7 +1,7 @@ error[E0405]: cannot find trait `SomeTrait` in this scope --> $DIR/E0405.rs:3:6 | -LL | impl SomeTrait for Foo {} //~ ERROR E0405 +LL | impl SomeTrait for Foo {} | ^^^^^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0408.stderr b/src/test/ui/error-codes/E0408.stderr index dc0a41e6eb0f..132a9432254f 100644 --- a/src/test/ui/error-codes/E0408.stderr +++ b/src/test/ui/error-codes/E0408.stderr @@ -1,7 +1,7 @@ error[E0408]: variable `y` is not bound in all patterns --> $DIR/E0408.rs:5:19 | -LL | Some(y) | None => {} //~ ERROR variable `y` is not bound in all patterns +LL | Some(y) | None => {} | - ^^^^ pattern doesn't bind `y` | | | variable not in all patterns diff --git a/src/test/ui/error-codes/E0411.stderr b/src/test/ui/error-codes/E0411.stderr index fe78d8d957ea..c1c25e835c14 100644 --- a/src/test/ui/error-codes/E0411.stderr +++ b/src/test/ui/error-codes/E0411.stderr @@ -1,7 +1,7 @@ error[E0411]: cannot find type `Self` in this scope --> $DIR/E0411.rs:2:6 | -LL | ::foo; //~ ERROR E0411 +LL | ::foo; | ^^^^ `Self` is only available in impls, traits, and type definitions error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0412.stderr b/src/test/ui/error-codes/E0412.stderr index 68d636ffae0b..7bdaa1807307 100644 --- a/src/test/ui/error-codes/E0412.stderr +++ b/src/test/ui/error-codes/E0412.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `Something` in this scope --> $DIR/E0412.rs:1:6 | -LL | impl Something {} //~ ERROR E0412 +LL | impl Something {} | ^^^^^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0415.stderr b/src/test/ui/error-codes/E0415.stderr index 6e848f9bfd39..c2b8fdc7c558 100644 --- a/src/test/ui/error-codes/E0415.stderr +++ b/src/test/ui/error-codes/E0415.stderr @@ -1,7 +1,7 @@ error[E0415]: identifier `f` is bound more than once in this parameter list --> $DIR/E0415.rs:1:16 | -LL | fn foo(f: i32, f: i32) {} //~ ERROR E0415 +LL | fn foo(f: i32, f: i32) {} | ^ used as parameter more than once error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0416.stderr b/src/test/ui/error-codes/E0416.stderr index 4baf5006cf40..78acac5c6617 100644 --- a/src/test/ui/error-codes/E0416.stderr +++ b/src/test/ui/error-codes/E0416.stderr @@ -1,7 +1,7 @@ error[E0416]: identifier `x` is bound more than once in the same pattern --> $DIR/E0416.rs:3:13 | -LL | (x, x) => {} //~ ERROR E0416 +LL | (x, x) => {} | ^ used in a pattern more than once error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0423.stderr b/src/test/ui/error-codes/E0423.stderr index d0deb8ce7ea2..bdcfaae60a01 100644 --- a/src/test/ui/error-codes/E0423.stderr +++ b/src/test/ui/error-codes/E0423.stderr @@ -19,7 +19,7 @@ LL | for _ in std::ops::Range { start: 0, end: 10 } {} error[E0423]: expected function, found struct `Foo` --> $DIR/E0423.rs:4:13 | -LL | let f = Foo(); //~ ERROR E0423 +LL | let f = Foo(); | ^^^ | | | did you mean `Foo { /* fields */ }`? diff --git a/src/test/ui/error-codes/E0424.stderr b/src/test/ui/error-codes/E0424.stderr index b91f061db345..d67a2660dac3 100644 --- a/src/test/ui/error-codes/E0424.stderr +++ b/src/test/ui/error-codes/E0424.stderr @@ -1,13 +1,13 @@ error[E0424]: expected value, found module `self` --> $DIR/E0424.rs:7:9 | -LL | self.bar(); //~ ERROR E0424 +LL | self.bar(); | ^^^^ `self` value is a keyword only available in methods with `self` parameter error[E0424]: expected unit struct/variant or constant, found module `self` --> $DIR/E0424.rs:12:9 | -LL | let self = "self"; //~ ERROR E0424 +LL | let self = "self"; | ^^^^ `self` value is a keyword and may not be bound to variables or shadowed error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0425.stderr b/src/test/ui/error-codes/E0425.stderr index 391027a51840..9ef4608da7da 100644 --- a/src/test/ui/error-codes/E0425.stderr +++ b/src/test/ui/error-codes/E0425.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `elf` in this scope --> $DIR/E0425.rs:3:9 | -LL | elf; //~ ERROR E0425 +LL | elf; | ^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0428.stderr b/src/test/ui/error-codes/E0428.stderr index 2154cb0ead28..205bcf342f1a 100644 --- a/src/test/ui/error-codes/E0428.stderr +++ b/src/test/ui/error-codes/E0428.stderr @@ -1,9 +1,9 @@ error[E0428]: the name `Bar` is defined multiple times --> $DIR/E0428.rs:2:1 | -LL | struct Bar; //~ previous definition of the type `Bar` here +LL | struct Bar; | ----------- previous definition of the type `Bar` here -LL | struct Bar; //~ ERROR E0428 +LL | struct Bar; | ^^^^^^^^^^^ `Bar` redefined here | = note: `Bar` must be defined only once in the type namespace of this module diff --git a/src/test/ui/error-codes/E0429.stderr b/src/test/ui/error-codes/E0429.stderr index 13cdb0d8861f..b5f76a1fcd84 100644 --- a/src/test/ui/error-codes/E0429.stderr +++ b/src/test/ui/error-codes/E0429.stderr @@ -1,7 +1,7 @@ error[E0429]: `self` imports are only allowed within a { } list --> $DIR/E0429.rs:1:5 | -LL | use std::fmt::self; //~ ERROR E0429 +LL | use std::fmt::self; | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0430.stderr b/src/test/ui/error-codes/E0430.stderr index 78e4e43ac2f3..9f8b053de2ca 100644 --- a/src/test/ui/error-codes/E0430.stderr +++ b/src/test/ui/error-codes/E0430.stderr @@ -1,7 +1,7 @@ error[E0430]: `self` import can only appear once in an import list --> $DIR/E0430.rs:1:16 | -LL | use std::fmt::{self, self}; //~ ERROR E0430 +LL | use std::fmt::{self, self}; | ^^^^ ---- another `self` import appears here | | | can only appear once in an import list @@ -9,7 +9,7 @@ LL | use std::fmt::{self, self}; //~ ERROR E0430 error[E0252]: the name `fmt` is defined multiple times --> $DIR/E0430.rs:1:22 | -LL | use std::fmt::{self, self}; //~ ERROR E0430 +LL | use std::fmt::{self, self}; | ------^^^^ | | | | | | | `fmt` reimported here diff --git a/src/test/ui/error-codes/E0431.stderr b/src/test/ui/error-codes/E0431.stderr index 240e6bd4a829..adfd2d923c78 100644 --- a/src/test/ui/error-codes/E0431.stderr +++ b/src/test/ui/error-codes/E0431.stderr @@ -1,7 +1,7 @@ error[E0431]: `self` import can only appear in an import list with a non-empty prefix --> $DIR/E0431.rs:1:6 | -LL | use {self}; //~ ERROR E0431 +LL | use {self}; | ^^^^ can only appear in an import list with a non-empty prefix error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0432.stderr b/src/test/ui/error-codes/E0432.stderr index bb6b31242cb5..137a1af6f95b 100644 --- a/src/test/ui/error-codes/E0432.stderr +++ b/src/test/ui/error-codes/E0432.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `something` --> $DIR/E0432.rs:1:5 | -LL | use something::Foo; //~ ERROR E0432 +LL | use something::Foo; | ^^^^^^^^^ maybe a missing `extern crate something;`? error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0433.stderr b/src/test/ui/error-codes/E0433.stderr index 7fbb7fa0413b..d852e1883844 100644 --- a/src/test/ui/error-codes/E0433.stderr +++ b/src/test/ui/error-codes/E0433.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: use of undeclared type or module `HashMap` --> $DIR/E0433.rs:2:15 | -LL | let map = HashMap::new(); //~ ERROR E0433 +LL | let map = HashMap::new(); | ^^^^^^^ use of undeclared type or module `HashMap` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0434.stderr b/src/test/ui/error-codes/E0434.stderr index 0e2bc701b7fb..14508ccbc9a7 100644 --- a/src/test/ui/error-codes/E0434.stderr +++ b/src/test/ui/error-codes/E0434.stderr @@ -1,7 +1,7 @@ error[E0434]: can't capture dynamic environment in a fn item --> $DIR/E0434.rs:4:9 | -LL | y //~ ERROR E0434 +LL | y | ^ | = help: use the `|| { ... }` closure form instead diff --git a/src/test/ui/error-codes/E0435.stderr b/src/test/ui/error-codes/E0435.stderr index 09c9d19e1140..349aa0d07c5d 100644 --- a/src/test/ui/error-codes/E0435.stderr +++ b/src/test/ui/error-codes/E0435.stderr @@ -1,7 +1,7 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/E0435.rs:3:17 | -LL | let _: [u8; foo]; //~ ERROR E0435 +LL | let _: [u8; foo]; | ^^^ non-constant value error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0437.stderr b/src/test/ui/error-codes/E0437.stderr index 9470cbf176ae..217b164036f8 100644 --- a/src/test/ui/error-codes/E0437.stderr +++ b/src/test/ui/error-codes/E0437.stderr @@ -1,7 +1,7 @@ error[E0437]: type `Bar` is not a member of trait `Foo` --> $DIR/E0437.rs:4:5 | -LL | type Bar = bool; //~ ERROR E0437 +LL | type Bar = bool; | ^^^^^^^^^^^^^^^^ not a member of trait `Foo` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0438.stderr b/src/test/ui/error-codes/E0438.stderr index 6a11577bb0f3..853f0c3c2399 100644 --- a/src/test/ui/error-codes/E0438.stderr +++ b/src/test/ui/error-codes/E0438.stderr @@ -1,7 +1,7 @@ error[E0438]: const `BAR` is not a member of trait `Bar` --> $DIR/E0438.rs:4:5 | -LL | const BAR: bool = true; //~ ERROR E0438 +LL | const BAR: bool = true; | ^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Bar` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0439.stderr b/src/test/ui/error-codes/E0439.stderr index e3b8fbfb2536..8021f7d3951a 100644 --- a/src/test/ui/error-codes/E0439.stderr +++ b/src/test/ui/error-codes/E0439.stderr @@ -1,7 +1,7 @@ error[E0439]: invalid `simd_shuffle`, needs length: `simd_shuffle` --> $DIR/E0439.rs:4:5 | -LL | fn simd_shuffle(a: A, b: A, c: [u32; 8]) -> B; //~ ERROR E0439 +LL | fn simd_shuffle(a: A, b: A, c: [u32; 8]) -> B; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0446.stderr b/src/test/ui/error-codes/E0446.stderr index 9c7399515f43..a0f5f7079b34 100644 --- a/src/test/ui/error-codes/E0446.stderr +++ b/src/test/ui/error-codes/E0446.stderr @@ -4,7 +4,7 @@ error[E0446]: private type `foo::Bar` in public interface LL | struct Bar(u32); | - `foo::Bar` declared as private LL | -LL | / pub fn bar() -> Bar { //~ ERROR E0446 +LL | / pub fn bar() -> Bar { LL | | Bar(0) LL | | } | |_____^ can't leak private type diff --git a/src/test/ui/error-codes/E0449.stderr b/src/test/ui/error-codes/E0449.stderr index d623c8abbd92..8221a5e0ad67 100644 --- a/src/test/ui/error-codes/E0449.stderr +++ b/src/test/ui/error-codes/E0449.stderr @@ -1,7 +1,7 @@ error[E0449]: unnecessary visibility qualifier --> $DIR/E0449.rs:7:1 | -LL | pub impl Bar {} //~ ERROR E0449 +LL | pub impl Bar {} | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual impl items instead @@ -9,13 +9,13 @@ LL | pub impl Bar {} //~ ERROR E0449 error[E0449]: unnecessary visibility qualifier --> $DIR/E0449.rs:9:1 | -LL | pub impl Foo for Bar { //~ ERROR E0449 +LL | pub impl Foo for Bar { | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/E0449.rs:10:5 | -LL | pub fn foo() {} //~ ERROR E0449 +LL | pub fn foo() {} | ^^^ `pub` not permitted here because it's implied error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0451.stderr b/src/test/ui/error-codes/E0451.stderr index 11f086772462..655f3a98d7f0 100644 --- a/src/test/ui/error-codes/E0451.stderr +++ b/src/test/ui/error-codes/E0451.stderr @@ -1,13 +1,13 @@ error[E0451]: field `b` of struct `bar::Foo` is private --> $DIR/E0451.rs:14:21 | -LL | let bar::Foo{a, b} = foo; //~ ERROR E0451 +LL | let bar::Foo{a, b} = foo; | ^ field `b` is private error[E0451]: field `b` of struct `bar::Foo` is private --> $DIR/E0451.rs:18:29 | -LL | let f = bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451 +LL | let f = bar::Foo{ a: 0, b: 0 }; | ^^^^ field `b` is private error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0452.stderr b/src/test/ui/error-codes/E0452.stderr index 62f268cd432b..7c3093309f9e 100644 --- a/src/test/ui/error-codes/E0452.stderr +++ b/src/test/ui/error-codes/E0452.stderr @@ -1,7 +1,7 @@ error[E0452]: malformed lint attribute --> $DIR/E0452.rs:1:10 | -LL | #![allow(foo = "")] //~ ERROR E0452 +LL | #![allow(foo = "")] | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0458.stderr b/src/test/ui/error-codes/E0458.stderr index 8b071e0b315e..9cfe7cccac1a 100644 --- a/src/test/ui/error-codes/E0458.stderr +++ b/src/test/ui/error-codes/E0458.stderr @@ -1,7 +1,7 @@ error[E0458]: unknown kind: `wonderful_unicorn` --> $DIR/E0458.rs:1:1 | -LL | #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458 +LL | #[link(kind = "wonderful_unicorn")] extern {} | ^^^^^^^--------------------------^^ | | | unknown kind @@ -9,7 +9,7 @@ LL | #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458 error[E0459]: #[link(...)] specified without `name = "foo"` --> $DIR/E0458.rs:1:1 | -LL | #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458 +LL | #[link(kind = "wonderful_unicorn")] extern {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0459.stderr b/src/test/ui/error-codes/E0459.stderr index d3591cd5f606..da7069fbb477 100644 --- a/src/test/ui/error-codes/E0459.stderr +++ b/src/test/ui/error-codes/E0459.stderr @@ -1,7 +1,7 @@ error[E0459]: #[link(...)] specified without `name = "foo"` --> $DIR/E0459.rs:1:1 | -LL | #[link(kind = "dylib")] extern {} //~ ERROR E0459 +LL | #[link(kind = "dylib")] extern {} | ^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0478.stderr b/src/test/ui/error-codes/E0478.stderr index 5147bf245599..71e490364d7a 100644 --- a/src/test/ui/error-codes/E0478.stderr +++ b/src/test/ui/error-codes/E0478.stderr @@ -1,7 +1,7 @@ error[E0478]: lifetime bound not satisfied --> $DIR/E0478.rs:4:5 | -LL | child: Box + 'SnowWhite>, //~ ERROR E0478 +LL | child: Box + 'SnowWhite>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'SnowWhite as defined on the struct at 3:22 diff --git a/src/test/ui/error-codes/E0492.stderr b/src/test/ui/error-codes/E0492.stderr index b73db6c975ea..5f337dd7f422 100644 --- a/src/test/ui/error-codes/E0492.stderr +++ b/src/test/ui/error-codes/E0492.stderr @@ -1,7 +1,7 @@ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead --> $DIR/E0492.rs:4:34 | -LL | static B: &'static AtomicUsize = &A; //~ ERROR E0492 +LL | static B: &'static AtomicUsize = &A; | ^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0496.stderr b/src/test/ui/error-codes/E0496.stderr index 515d71ba05ec..b0294eef04ef 100644 --- a/src/test/ui/error-codes/E0496.stderr +++ b/src/test/ui/error-codes/E0496.stderr @@ -3,7 +3,7 @@ error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scop | LL | impl<'a> Foo<'a> { | -- first declared here -LL | fn f<'a>(x: &'a i32) { //~ ERROR E0496 +LL | fn f<'a>(x: &'a i32) { | ^^ lifetime 'a already in scope error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0499.stderr b/src/test/ui/error-codes/E0499.stderr index 92157e4eba6c..82270162b38c 100644 --- a/src/test/ui/error-codes/E0499.stderr +++ b/src/test/ui/error-codes/E0499.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `i` as mutable more than once at a time | LL | let mut x = &mut i; | - first mutable borrow occurs here -LL | let mut a = &mut i; //~ ERROR E0499 +LL | let mut a = &mut i; | ^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/error-codes/E0502.stderr b/src/test/ui/error-codes/E0502.stderr index 9193886b0096..26a2c3bf3534 100644 --- a/src/test/ui/error-codes/E0502.stderr +++ b/src/test/ui/error-codes/E0502.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*a` as mutable because `a` is also borrowed as immu | LL | let ref y = a; | ----- immutable borrow occurs here -LL | bar(a); //~ ERROR E0502 +LL | bar(a); | ^ mutable borrow occurs here LL | y.use_ref(); LL | } diff --git a/src/test/ui/error-codes/E0503.stderr b/src/test/ui/error-codes/E0503.stderr index 83391146b602..62cb3afca783 100644 --- a/src/test/ui/error-codes/E0503.stderr +++ b/src/test/ui/error-codes/E0503.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `value` because it was mutably borrowed | LL | let _borrow = &mut value; | ----- borrow of `value` occurs here -LL | let _sum = value + 1; //~ ERROR E0503 +LL | let _sum = value + 1; | ^^^^^ use of borrowed `value` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0504.stderr b/src/test/ui/error-codes/E0504.stderr index 7f4a611c5d53..a987713a11d1 100644 --- a/src/test/ui/error-codes/E0504.stderr +++ b/src/test/ui/error-codes/E0504.stderr @@ -4,7 +4,7 @@ error[E0504]: cannot move `fancy_num` into closure because it is borrowed LL | let fancy_ref = &fancy_num; | --------- borrow of `fancy_num` occurs here ... -LL | println!("child function: {}", fancy_num.num); //~ ERROR E0504 +LL | println!("child function: {}", fancy_num.num); | ^^^^^^^^^ move into closure occurs here error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0505.stderr b/src/test/ui/error-codes/E0505.stderr index 268eb8801922..28dfb25986fd 100644 --- a/src/test/ui/error-codes/E0505.stderr +++ b/src/test/ui/error-codes/E0505.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let _ref_to_val: &Value = &x; | - borrow of `x` occurs here -LL | eat(x); //~ ERROR E0505 +LL | eat(x); | ^ move out of `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0507.stderr b/src/test/ui/error-codes/E0507.stderr index c24b8ecf61ac..1a596af1572c 100644 --- a/src/test/ui/error-codes/E0507.stderr +++ b/src/test/ui/error-codes/E0507.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/E0507.rs:12:5 | -LL | x.borrow().nothing_is_true(); //~ ERROR E0507 +LL | x.borrow().nothing_is_true(); | ^^^^^^^^^^ cannot move out of borrowed content error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0509.stderr b/src/test/ui/error-codes/E0509.stderr index b1f256d2d9e3..25b6d8a47d28 100644 --- a/src/test/ui/error-codes/E0509.stderr +++ b/src/test/ui/error-codes/E0509.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `DropStruct`, which implements the `Drop` trait --> $DIR/E0509.rs:16:23 | -LL | let fancy_field = drop_struct.fancy; //~ ERROR E0509 +LL | let fancy_field = drop_struct.fancy; | ^^^^^^^^^^^^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/error-codes/E0511.stderr b/src/test/ui/error-codes/E0511.stderr index f1e3c0135bfb..1362a3d1f254 100644 --- a/src/test/ui/error-codes/E0511.stderr +++ b/src/test/ui/error-codes/E0511.stderr @@ -1,7 +1,7 @@ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32` --> $DIR/E0511.rs:8:14 | -LL | unsafe { simd_add(0, 1); } //~ ERROR E0511 +LL | unsafe { simd_add(0, 1); } | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0512.stderr b/src/test/ui/error-codes/E0512.stderr index 998f6403f0b2..3fecce542ce9 100644 --- a/src/test/ui/error-codes/E0512.stderr +++ b/src/test/ui/error-codes/E0512.stderr @@ -1,7 +1,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/E0512.rs:4:23 | -LL | unsafe { takes_u8(::std::mem::transmute(0u16)); } //~ ERROR E0512 +LL | unsafe { takes_u8(::std::mem::transmute(0u16)); } | ^^^^^^^^^^^^^^^^^^^^^ | = note: source type: `u16` (16 bits) diff --git a/src/test/ui/error-codes/E0516.stderr b/src/test/ui/error-codes/E0516.stderr index 034c17933645..2e6de5053d57 100644 --- a/src/test/ui/error-codes/E0516.stderr +++ b/src/test/ui/error-codes/E0516.stderr @@ -1,7 +1,7 @@ error[E0516]: `typeof` is a reserved keyword but unimplemented --> $DIR/E0516.rs:2:12 | -LL | let x: typeof(92) = 92; //~ ERROR E0516 +LL | let x: typeof(92) = 92; | ^^^^^^^^^^ reserved keyword error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0517.stderr b/src/test/ui/error-codes/E0517.stderr index 366ab1bca63f..e256c07de267 100644 --- a/src/test/ui/error-codes/E0517.stderr +++ b/src/test/ui/error-codes/E0517.stderr @@ -1,7 +1,7 @@ error[E0517]: attribute should be applied to struct, enum or union --> $DIR/E0517.rs:1:8 | -LL | #[repr(C)] //~ ERROR: E0517 +LL | #[repr(C)] | ^ LL | type Foo = u8; | -------------- not a struct, enum or union @@ -9,7 +9,7 @@ LL | type Foo = u8; error[E0517]: attribute should be applied to struct or union --> $DIR/E0517.rs:4:8 | -LL | #[repr(packed)] //~ ERROR: E0517 +LL | #[repr(packed)] | ^^^^^^ LL | enum Foo2 {Bar, Baz} | -------------------- not a struct or union @@ -17,7 +17,7 @@ LL | enum Foo2 {Bar, Baz} error[E0517]: attribute should be applied to enum --> $DIR/E0517.rs:7:8 | -LL | #[repr(u8)] //~ ERROR: E0517 +LL | #[repr(u8)] | ^^ LL | struct Foo3 {bar: bool, baz: bool} | ---------------------------------- not an enum @@ -25,7 +25,7 @@ LL | struct Foo3 {bar: bool, baz: bool} error[E0517]: attribute should be applied to struct, enum or union --> $DIR/E0517.rs:10:8 | -LL | #[repr(C)] //~ ERROR: E0517 +LL | #[repr(C)] | ^ LL | / impl Foo3 { LL | | } diff --git a/src/test/ui/error-codes/E0518.stderr b/src/test/ui/error-codes/E0518.stderr index 6391a69c24e8..561446f8175d 100644 --- a/src/test/ui/error-codes/E0518.stderr +++ b/src/test/ui/error-codes/E0518.stderr @@ -1,7 +1,7 @@ error[E0518]: attribute should be applied to function or closure --> $DIR/E0518.rs:1:1 | -LL | #[inline(always)] //~ ERROR: E0518 +LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ LL | struct Foo; | ----------- not a function or closure @@ -9,7 +9,7 @@ LL | struct Foo; error[E0518]: attribute should be applied to function or closure --> $DIR/E0518.rs:4:1 | -LL | #[inline(never)] //~ ERROR: E0518 +LL | #[inline(never)] | ^^^^^^^^^^^^^^^^ LL | / impl Foo { LL | | } diff --git a/src/test/ui/error-codes/E0530.stderr b/src/test/ui/error-codes/E0530.stderr index 2ef80253eaf5..c312144132d3 100644 --- a/src/test/ui/error-codes/E0530.stderr +++ b/src/test/ui/error-codes/E0530.stderr @@ -4,7 +4,7 @@ error[E0530]: match bindings cannot shadow statics LL | static TEST: i32 = 0; | --------------------- the static `TEST` is defined here ... -LL | TEST => {} //~ ERROR E0530 +LL | TEST => {} | ^^^^ cannot be named the same as a static error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0534.stderr b/src/test/ui/error-codes/E0534.stderr index d2829e1643bb..23f9cd7ce2db 100644 --- a/src/test/ui/error-codes/E0534.stderr +++ b/src/test/ui/error-codes/E0534.stderr @@ -1,7 +1,7 @@ error[E0534]: expected one argument --> $DIR/E0534.rs:1:1 | -LL | #[inline()] //~ ERROR E0534 +LL | #[inline()] | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0565-1.stderr b/src/test/ui/error-codes/E0565-1.stderr index c320918a3bfd..1283a9c5ef65 100644 --- a/src/test/ui/error-codes/E0565-1.stderr +++ b/src/test/ui/error-codes/E0565-1.stderr @@ -1,7 +1,7 @@ error[E0565]: item in `deprecated` must be a key/value pair --> $DIR/E0565-1.rs:2:14 | -LL | #[deprecated("since")] //~ ERROR E0565 +LL | #[deprecated("since")] | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0565-2.stderr b/src/test/ui/error-codes/E0565-2.stderr index 8e2ce09059a3..bb30bd7befb3 100644 --- a/src/test/ui/error-codes/E0565-2.stderr +++ b/src/test/ui/error-codes/E0565-2.stderr @@ -1,7 +1,7 @@ error[E0565]: literal in `deprecated` value must be a string --> $DIR/E0565-2.rs:2:22 | -LL | #[deprecated(since = b"1.29", note = "hi")] //~ ERROR E0565 +LL | #[deprecated(since = b"1.29", note = "hi")] | ^^^^^^^ help: consider removing the prefix: `"1.29"` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0565.stderr b/src/test/ui/error-codes/E0565.stderr index 2c172f811496..6ed90c0ae4ff 100644 --- a/src/test/ui/error-codes/E0565.stderr +++ b/src/test/ui/error-codes/E0565.stderr @@ -1,7 +1,7 @@ error[E0565]: meta item in `repr` must be an identifier --> $DIR/E0565.rs:2:8 | -LL | #[repr("C")] //~ ERROR E0565 +LL | #[repr("C")] | ^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0572.stderr b/src/test/ui/error-codes/E0572.stderr index 295a518c336d..36619f8dee4c 100644 --- a/src/test/ui/error-codes/E0572.stderr +++ b/src/test/ui/error-codes/E0572.stderr @@ -1,7 +1,7 @@ error[E0572]: return statement outside of function body --> $DIR/E0572.rs:1:18 | -LL | const FOO: u32 = return 0; //~ ERROR E0572 +LL | const FOO: u32 = return 0; | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0586.stderr b/src/test/ui/error-codes/E0586.stderr index 394b4be3340f..d1e7e3f47442 100644 --- a/src/test/ui/error-codes/E0586.stderr +++ b/src/test/ui/error-codes/E0586.stderr @@ -1,7 +1,7 @@ error[E0586]: inclusive range with no end --> $DIR/E0586.rs:3:22 | -LL | let x = &tmp[1..=]; //~ ERROR E0586 +LL | let x = &tmp[1..=]; | ^ | = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) diff --git a/src/test/ui/error-codes/E0597.stderr b/src/test/ui/error-codes/E0597.stderr index a5b0cc49d0c8..cab978585310 100644 --- a/src/test/ui/error-codes/E0597.stderr +++ b/src/test/ui/error-codes/E0597.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | x.x = Some(&y); | ^ borrowed value does not live long enough -LL | //~^ `y` does not live long enough [E0597] +LL | LL | } | - `y` dropped here while still borrowed | diff --git a/src/test/ui/error-codes/E0599.stderr b/src/test/ui/error-codes/E0599.stderr index 85110889e9a7..6fb53e727630 100644 --- a/src/test/ui/error-codes/E0599.stderr +++ b/src/test/ui/error-codes/E0599.stderr @@ -4,7 +4,7 @@ error[E0599]: no associated item named `NotEvenReal` found for type `Foo` in the LL | struct Foo; | ----------- associated item `NotEvenReal` not found for this ... -LL | || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599 +LL | || if let Foo::NotEvenReal() = Foo {}; | -----^^^^^^^^^^^-- associated item not found in `Foo` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0600.stderr b/src/test/ui/error-codes/E0600.stderr index 6c6d922290fc..95ac4510ca88 100644 --- a/src/test/ui/error-codes/E0600.stderr +++ b/src/test/ui/error-codes/E0600.stderr @@ -1,7 +1,7 @@ error[E0600]: cannot apply unary operator `!` to type `&'static str` --> $DIR/E0600.rs:2:5 | -LL | !"a"; //~ ERROR E0600 +LL | !"a"; | ^^^^ cannot apply unary operator `!` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0603.stderr b/src/test/ui/error-codes/E0603.stderr index ee8fd2809bc7..444005e086f1 100644 --- a/src/test/ui/error-codes/E0603.stderr +++ b/src/test/ui/error-codes/E0603.stderr @@ -1,7 +1,7 @@ error[E0603]: constant `PRIVATE` is private --> $DIR/E0603.rs:6:17 | -LL | SomeModule::PRIVATE; //~ ERROR E0603 +LL | SomeModule::PRIVATE; | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0604.stderr b/src/test/ui/error-codes/E0604.stderr index 2bd92db86e36..5861bdcb7a95 100644 --- a/src/test/ui/error-codes/E0604.stderr +++ b/src/test/ui/error-codes/E0604.stderr @@ -1,7 +1,7 @@ error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/E0604.rs:2:5 | -LL | 1u32 as char; //~ ERROR E0604 +LL | 1u32 as char; | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0605.stderr b/src/test/ui/error-codes/E0605.stderr index 4dc074b222ac..95e899db8b7e 100644 --- a/src/test/ui/error-codes/E0605.stderr +++ b/src/test/ui/error-codes/E0605.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `u8` as `std::vec::Vec` --> $DIR/E0605.rs:3:5 | -LL | x as Vec; //~ ERROR E0605 +LL | x as Vec; | ^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -9,7 +9,7 @@ LL | x as Vec; //~ ERROR E0605 error[E0605]: non-primitive cast: `*const u8` as `&u8` --> $DIR/E0605.rs:6:5 | -LL | v as &u8; //~ ERROR E0605 +LL | v as &u8; | ^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/error-codes/E0606.stderr b/src/test/ui/error-codes/E0606.stderr index 89ec4896a2b4..fce24886eb0d 100644 --- a/src/test/ui/error-codes/E0606.stderr +++ b/src/test/ui/error-codes/E0606.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `&u8` as `u8` is invalid --> $DIR/E0606.rs:2:5 | -LL | &0u8 as u8; //~ ERROR E0606 +LL | &0u8 as u8; | ----^^^^^^ | | | cannot cast `&u8` as `u8` diff --git a/src/test/ui/error-codes/E0607.stderr b/src/test/ui/error-codes/E0607.stderr index 1fbe4b9c5bcc..a0fe02c1c4d9 100644 --- a/src/test/ui/error-codes/E0607.stderr +++ b/src/test/ui/error-codes/E0607.stderr @@ -1,7 +1,7 @@ error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]` --> $DIR/E0607.rs:3:5 | -LL | v as *const [u8]; //~ ERROR E0607 +LL | v as *const [u8]; | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0608.stderr b/src/test/ui/error-codes/E0608.stderr index b228b2eddfd9..3aec509934bc 100644 --- a/src/test/ui/error-codes/E0608.stderr +++ b/src/test/ui/error-codes/E0608.stderr @@ -1,7 +1,7 @@ error[E0608]: cannot index into a value of type `u8` --> $DIR/E0608.rs:2:5 | -LL | 0u8[2]; //~ ERROR E0608 +LL | 0u8[2]; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0609.stderr b/src/test/ui/error-codes/E0609.stderr index b5cf09b2201d..797e95d02dda 100644 --- a/src/test/ui/error-codes/E0609.stderr +++ b/src/test/ui/error-codes/E0609.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `foo` on type `Foo` --> $DIR/E0609.rs:8:15 | -LL | let _ = x.foo; //~ ERROR E0609 +LL | let _ = x.foo; | ^^^ unknown field | = note: available fields are: `x` @@ -9,7 +9,7 @@ LL | let _ = x.foo; //~ ERROR E0609 error[E0609]: no field `1` on type `Bar` --> $DIR/E0609.rs:11:7 | -LL | y.1; //~ ERROR E0609 +LL | y.1; | ^ unknown field error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0610.stderr b/src/test/ui/error-codes/E0610.stderr index c46b1f2b2d56..a2966eea44c0 100644 --- a/src/test/ui/error-codes/E0610.stderr +++ b/src/test/ui/error-codes/E0610.stderr @@ -1,7 +1,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/E0610.rs:3:15 | -LL | let _ = x.foo; //~ ERROR E0610 +LL | let _ = x.foo; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0614.stderr b/src/test/ui/error-codes/E0614.stderr index 5b1a4a93c4c0..598117c2b605 100644 --- a/src/test/ui/error-codes/E0614.stderr +++ b/src/test/ui/error-codes/E0614.stderr @@ -1,7 +1,7 @@ error[E0614]: type `u32` cannot be dereferenced --> $DIR/E0614.rs:3:5 | -LL | *y; //~ ERROR E0614 +LL | *y; | ^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0615.stderr b/src/test/ui/error-codes/E0615.stderr index d86ee5b9b4b9..772058719ae0 100644 --- a/src/test/ui/error-codes/E0615.stderr +++ b/src/test/ui/error-codes/E0615.stderr @@ -1,7 +1,7 @@ error[E0615]: attempted to take value of method `method` on type `Foo` --> $DIR/E0615.rs:11:7 | -LL | f.method; //~ ERROR E0615 +LL | f.method; | ^^^^^^ help: use parentheses to call the method: `method()` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0616.stderr b/src/test/ui/error-codes/E0616.stderr index f600bfa8cd31..556e5db10a94 100644 --- a/src/test/ui/error-codes/E0616.stderr +++ b/src/test/ui/error-codes/E0616.stderr @@ -1,7 +1,7 @@ error[E0616]: field `x` of struct `a::Foo` is private --> $DIR/E0616.rs:13:5 | -LL | f.x; //~ ERROR E0616 +LL | f.x; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0620.stderr b/src/test/ui/error-codes/E0620.stderr index f7319a878c27..65152b2b74dd 100644 --- a/src/test/ui/error-codes/E0620.stderr +++ b/src/test/ui/error-codes/E0620.stderr @@ -1,13 +1,13 @@ error[E0620]: cast to unsized type: `&[usize; 2]` as `[usize]` --> $DIR/E0620.rs:2:16 | -LL | let _foo = &[1_usize, 2] as [usize]; //~ ERROR E0620 +LL | let _foo = &[1_usize, 2] as [usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using an implicit coercion to `&[usize]` instead --> $DIR/E0620.rs:2:16 | -LL | let _foo = &[1_usize, 2] as [usize]; //~ ERROR E0620 +LL | let _foo = &[1_usize, 2] as [usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr index f763c82eff80..feca7f10b706 100644 --- a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr +++ b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr @@ -1,28 +1,28 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5 | -LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 +LL | invoke(&x, |a, b| if a > b { a } else { b }); | ^^^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 15:16... --> $DIR/E0621-does-not-trigger-for-closures.rs:15:16 | -LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 +LL | invoke(&x, |a, b| if a > b { a } else { b }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...so that reference does not outlive borrowed content --> $DIR/E0621-does-not-trigger-for-closures.rs:15:45 | -LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 +LL | invoke(&x, |a, b| if a > b { a } else { b }); | ^ note: but, the lifetime must be valid for the call at 15:5... --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5 | -LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 +LL | invoke(&x, |a, b| if a > b { a } else { b }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...so type `&i32` of expression is valid during the expression --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5 | -LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 +LL | invoke(&x, |a, b| if a > b { a } else { b }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0624.stderr b/src/test/ui/error-codes/E0624.stderr index 31a2f607e582..01ac24cfbbe1 100644 --- a/src/test/ui/error-codes/E0624.stderr +++ b/src/test/ui/error-codes/E0624.stderr @@ -1,7 +1,7 @@ error[E0624]: method `method` is private --> $DIR/E0624.rs:11:9 | -LL | foo.method(); //~ ERROR method `method` is private [E0624] +LL | foo.method(); | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0637.stderr b/src/test/ui/error-codes/E0637.stderr index f744520ef6ee..d19ebfd15a52 100644 --- a/src/test/ui/error-codes/E0637.stderr +++ b/src/test/ui/error-codes/E0637.stderr @@ -1,19 +1,19 @@ error[E0637]: `'_` cannot be used here --> $DIR/E0637.rs:1:16 | -LL | struct Foo<'a: '_>(&'a u8); //~ ERROR cannot be used here +LL | struct Foo<'a: '_>(&'a u8); | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here --> $DIR/E0637.rs:2:12 | -LL | fn foo<'a: '_>(_: &'a u8) {} //~ ERROR cannot be used here +LL | fn foo<'a: '_>(_: &'a u8) {} | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here --> $DIR/E0637.rs:5:10 | -LL | impl<'a: '_> Bar<'a> { //~ ERROR cannot be used here +LL | impl<'a: '_> Bar<'a> { | ^^ `'_` is a reserved lifetime name error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0646.stderr b/src/test/ui/error-codes/E0646.stderr index 502200c1d008..976cdd45f576 100644 --- a/src/test/ui/error-codes/E0646.stderr +++ b/src/test/ui/error-codes/E0646.stderr @@ -1,7 +1,7 @@ error[E0646]: `main` function is not allowed to have a `where` clause --> $DIR/E0646.rs:1:17 | -LL | fn main() where (): Copy {} //~ ERROR [E0646] +LL | fn main() where (): Copy {} | ^^^^^^^^ `main` cannot have a `where` clause error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0647.stderr b/src/test/ui/error-codes/E0647.stderr index da9ba5bf34bc..465cc7702eef 100644 --- a/src/test/ui/error-codes/E0647.stderr +++ b/src/test/ui/error-codes/E0647.stderr @@ -1,7 +1,7 @@ error[E0647]: start function is not allowed to have a `where` clause --> $DIR/E0647.rs:7:56 | -LL | fn start(_: isize, _: *const *const u8) -> isize where (): Copy { //~ ERROR [E0647] +LL | fn start(_: isize, _: *const *const u8) -> isize where (): Copy { | ^^^^^^^^ start function cannot have a `where` clause error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0648.stderr b/src/test/ui/error-codes/E0648.stderr index 090157fb0d77..f682b4f41e52 100644 --- a/src/test/ui/error-codes/E0648.stderr +++ b/src/test/ui/error-codes/E0648.stderr @@ -1,7 +1,7 @@ error[E0648]: `export_name` may not contain null characters --> $DIR/E0648.rs:1:1 | -LL | #[export_name="/0foo"] //~ ERROR E0648 +LL | #[export_name="/0foo"] | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0658.stderr b/src/test/ui/error-codes/E0658.stderr index 58802b23db38..292c49fa84e5 100644 --- a/src/test/ui/error-codes/E0658.stderr +++ b/src/test/ui/error-codes/E0658.stderr @@ -1,7 +1,7 @@ error[E0658]: repr with 128-bit type is unstable (see issue #35118) --> $DIR/E0658.rs:2:1 | -LL | / enum Foo { //~ ERROR E0658 +LL | / enum Foo { LL | | Bar(u64), LL | | } | |_^ diff --git a/src/test/ui/error-codes/E0659.stderr b/src/test/ui/error-codes/E0659.stderr index b5aa1b21b096..2f01f54c2d1c 100644 --- a/src/test/ui/error-codes/E0659.stderr +++ b/src/test/ui/error-codes/E0659.stderr @@ -1,7 +1,7 @@ error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) --> $DIR/E0659.rs:15:15 | -LL | collider::foo(); //~ ERROR E0659 +LL | collider::foo(); | ^^^ ambiguous name | note: `foo` could refer to the function imported here diff --git a/src/test/ui/error-codes/E0718.stderr b/src/test/ui/error-codes/E0718.stderr index 4f9734d1acff..412c856ce065 100644 --- a/src/test/ui/error-codes/E0718.stderr +++ b/src/test/ui/error-codes/E0718.stderr @@ -1,7 +1,7 @@ error[E0718]: `arc` language item must be applied to a struct --> $DIR/E0718.rs:4:1 | -LL | #[lang = "arc"] //~ ERROR language item must be applied to a struct +LL | #[lang = "arc"] | ^^^^^^^^^^^^^^^ attribute should be applied to a struct, not a static item error: aborting due to previous error diff --git a/src/test/ui/error-codes/ex-E0611.stderr b/src/test/ui/error-codes/ex-E0611.stderr index f8c7cd8c1464..8bd00a392d4f 100644 --- a/src/test/ui/error-codes/ex-E0611.stderr +++ b/src/test/ui/error-codes/ex-E0611.stderr @@ -1,7 +1,7 @@ error[E0616]: field `0` of struct `a::Foo` is private --> $DIR/ex-E0611.rs:11:4 | -LL | y.0; //~ ERROR field `0` of struct `a::Foo` is private +LL | y.0; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/ex-E0612.stderr b/src/test/ui/error-codes/ex-E0612.stderr index 0f498d164390..b21b6fdfcf1f 100644 --- a/src/test/ui/error-codes/ex-E0612.stderr +++ b/src/test/ui/error-codes/ex-E0612.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `1` on type `Foo` --> $DIR/ex-E0612.rs:5:6 | -LL | y.1; //~ ERROR no field `1` on type `Foo` +LL | y.1; | ^ help: a field with a similar name exists: `0` error: aborting due to previous error diff --git a/src/test/ui/error-should-say-copy-not-pod.stderr b/src/test/ui/error-should-say-copy-not-pod.stderr index d42fea708128..7143f8c914dd 100644 --- a/src/test/ui/error-should-say-copy-not-pod.stderr +++ b/src/test/ui/error-should-say-copy-not-pod.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/error-should-say-copy-not-pod.rs:6:5 | -LL | check_bound("nocopy".to_string()); //~ ERROR : std::marker::Copy` is not satisfied +LL | check_bound("nocopy".to_string()); | ^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` | note: required by `check_bound` diff --git a/src/test/ui/estr-subtyping.stderr b/src/test/ui/estr-subtyping.stderr index 7a7dce98f2d1..29f210803dd1 100644 --- a/src/test/ui/estr-subtyping.stderr +++ b/src/test/ui/estr-subtyping.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/estr-subtyping.rs:10:15 | -LL | wants_uniq(x); //~ ERROR mismatched types +LL | wants_uniq(x); | ^ | | | expected struct `std::string::String`, found &str diff --git a/src/test/ui/exclusive-drop-and-copy.stderr b/src/test/ui/exclusive-drop-and-copy.stderr index 2fbeaec23a79..9983aac4f9c0 100644 --- a/src/test/ui/exclusive-drop-and-copy.stderr +++ b/src/test/ui/exclusive-drop-and-copy.stderr @@ -1,13 +1,13 @@ error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor --> $DIR/exclusive-drop-and-copy.rs:3:10 | -LL | #[derive(Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented +LL | #[derive(Copy, Clone)] | ^^^^ Copy not allowed on types with destructors error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor --> $DIR/exclusive-drop-and-copy.rs:10:10 | -LL | #[derive(Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented +LL | #[derive(Copy, Clone)] | ^^^^ Copy not allowed on types with destructors error: aborting due to 2 previous errors diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr index 01c7e8817568..03867a8e43b1 100644 --- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr +++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr @@ -1,7 +1,7 @@ error: unexpected token: `,` --> $DIR/exclusive_range_pattern_syntax_collision.rs:5:15 | -LL | [_, 99.., _] => {}, //~ ERROR unexpected token: `,` +LL | [_, 99.., _] => {}, | ^^ error: aborting due to previous error diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr index 91109a645664..5ac435bf011e 100644 --- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr +++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr @@ -1,7 +1,7 @@ error: unexpected token: `]` --> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:15 | -LL | [_, 99..] => {}, //~ ERROR unexpected token: `]` +LL | [_, 99..] => {}, | ^^ error: aborting due to previous error diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr index 9c76a66c265b..a09ba3562e09 100644 --- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr +++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr @@ -1,7 +1,7 @@ error: expected one of `,` or `]`, found `9` --> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:12 | -LL | [..9, 99..100, _] => {}, //~ ERROR expected one of `,` or `]`, found `9` +LL | [..9, 99..100, _] => {}, | ^ expected one of `,` or `]` here error: aborting due to previous error diff --git a/src/test/ui/exhaustive_integer_patterns.stderr b/src/test/ui/exhaustive_integer_patterns.stderr index d9513710d446..82b0b4841446 100644 --- a/src/test/ui/exhaustive_integer_patterns.stderr +++ b/src/test/ui/exhaustive_integer_patterns.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/exhaustive_integer_patterns.rs:23:9 | -LL | 200 => {} //~ ERROR unreachable pattern +LL | 200 => {} | ^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unreachable_patterns)] error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered --> $DIR/exhaustive_integer_patterns.rs:28:11 | -LL | match x { //~ ERROR non-exhaustive patterns +LL | match x { | ^ pattern `128u8..=255u8` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -21,7 +21,7 @@ LL | match x { //~ ERROR non-exhaustive patterns error[E0004]: non-exhaustive patterns: `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more not covered --> $DIR/exhaustive_integer_patterns.rs:33:11 | -LL | match x { //~ ERROR non-exhaustive patterns +LL | match x { | ^ patterns `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -29,13 +29,13 @@ LL | match x { //~ ERROR non-exhaustive patterns error: unreachable pattern --> $DIR/exhaustive_integer_patterns.rs:44:9 | -LL | -2..=20 => {} //~ ERROR unreachable pattern +LL | -2..=20 => {} | ^^^^^^^ error[E0004]: non-exhaustive patterns: `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered --> $DIR/exhaustive_integer_patterns.rs:41:11 | -LL | match x { //~ ERROR non-exhaustive patterns +LL | match x { | ^ patterns `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -43,7 +43,7 @@ LL | match x { //~ ERROR non-exhaustive patterns error[E0004]: non-exhaustive patterns: `-128i8` not covered --> $DIR/exhaustive_integer_patterns.rs:82:11 | -LL | match 0i8 { //~ ERROR non-exhaustive patterns +LL | match 0i8 { | ^^^ pattern `-128i8` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -51,7 +51,7 @@ LL | match 0i8 { //~ ERROR non-exhaustive patterns error[E0004]: non-exhaustive patterns: `0i16` not covered --> $DIR/exhaustive_integer_patterns.rs:90:11 | -LL | match 0i16 { //~ ERROR non-exhaustive patterns +LL | match 0i16 { | ^^^^ pattern `0i16` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -59,7 +59,7 @@ LL | match 0i16 { //~ ERROR non-exhaustive patterns error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered --> $DIR/exhaustive_integer_patterns.rs:108:11 | -LL | match 0u8 { //~ ERROR non-exhaustive patterns +LL | match 0u8 { | ^^^ pattern `128u8..=255u8` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -67,7 +67,7 @@ LL | match 0u8 { //~ ERROR non-exhaustive patterns error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered --> $DIR/exhaustive_integer_patterns.rs:120:11 | -LL | match (0u8, Some(())) { //~ ERROR non-exhaustive patterns +LL | match (0u8, Some(())) { | ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -75,7 +75,7 @@ LL | match (0u8, Some(())) { //~ ERROR non-exhaustive patterns error[E0004]: non-exhaustive patterns: `(126u8..=127u8, false)` not covered --> $DIR/exhaustive_integer_patterns.rs:125:11 | -LL | match (0u8, true) { //~ ERROR non-exhaustive patterns +LL | match (0u8, true) { | ^^^^^^^^^^^ pattern `(126u8..=127u8, false)` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -83,7 +83,7 @@ LL | match (0u8, true) { //~ ERROR non-exhaustive patterns error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211455u128` not covered --> $DIR/exhaustive_integer_patterns.rs:145:11 | -LL | match 0u128 { //~ ERROR non-exhaustive patterns +LL | match 0u128 { | ^^^^^ pattern `340282366920938463463374607431768211455u128` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -91,7 +91,7 @@ LL | match 0u128 { //~ ERROR non-exhaustive patterns error[E0004]: non-exhaustive patterns: `5u128..=340282366920938463463374607431768211455u128` not covered --> $DIR/exhaustive_integer_patterns.rs:149:11 | -LL | match 0u128 { //~ ERROR non-exhaustive patterns +LL | match 0u128 { | ^^^^^ pattern `5u128..=340282366920938463463374607431768211455u128` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -99,7 +99,7 @@ LL | match 0u128 { //~ ERROR non-exhaustive patterns error[E0004]: non-exhaustive patterns: `0u128..=3u128` not covered --> $DIR/exhaustive_integer_patterns.rs:153:11 | -LL | match 0u128 { //~ ERROR non-exhaustive patterns +LL | match 0u128 { | ^^^^^ pattern `0u128..=3u128` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/existential_types/bound_reduction2.stderr b/src/test/ui/existential_types/bound_reduction2.stderr index f51f1c9a4e56..b8bad7db6b65 100644 --- a/src/test/ui/existential_types/bound_reduction2.stderr +++ b/src/test/ui/existential_types/bound_reduction2.stderr @@ -1,7 +1,7 @@ error: defining existential type use does not fully define existential type --> $DIR/bound_reduction2.rs:17:1 | -LL | / fn foo_desugared(_: T) -> Foo { //~ ERROR does not fully define +LL | / fn foo_desugared(_: T) -> Foo { LL | | () LL | | } | |_^ diff --git a/src/test/ui/existential_types/declared_but_never_defined.stderr b/src/test/ui/existential_types/declared_but_never_defined.stderr index 681b1cf0fa7c..7294a074db65 100644 --- a/src/test/ui/existential_types/declared_but_never_defined.stderr +++ b/src/test/ui/existential_types/declared_but_never_defined.stderr @@ -1,7 +1,7 @@ error: could not find defining uses --> $DIR/declared_but_never_defined.rs:6:1 | -LL | existential type Bar: std::fmt::Debug; //~ ERROR could not find defining uses +LL | existential type Bar: std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/existential_types/declared_but_not_defined_in_scope.stderr b/src/test/ui/existential_types/declared_but_not_defined_in_scope.stderr index e9cc92d78ea7..a72709f71943 100644 --- a/src/test/ui/existential_types/declared_but_not_defined_in_scope.stderr +++ b/src/test/ui/existential_types/declared_but_not_defined_in_scope.stderr @@ -1,7 +1,7 @@ error: could not find defining uses --> $DIR/declared_but_not_defined_in_scope.rs:7:5 | -LL | pub existential type Boo: ::std::fmt::Debug; //~ ERROR could not find defining uses +LL | pub existential type Boo: ::std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/existential_types/different_defining_uses.stderr b/src/test/ui/existential_types/different_defining_uses.stderr index 3f9ed96400b5..fddba584798b 100644 --- a/src/test/ui/existential_types/different_defining_uses.stderr +++ b/src/test/ui/existential_types/different_defining_uses.stderr @@ -1,7 +1,7 @@ error: concrete type differs from previous defining existential type use --> $DIR/different_defining_uses.rs:12:1 | -LL | / fn bar() -> Foo { //~ ERROR concrete type differs from previous +LL | / fn bar() -> Foo { LL | | 42i32 LL | | } | |_^ expected `&'static str`, got `i32` diff --git a/src/test/ui/existential_types/different_defining_uses_never_type.stderr b/src/test/ui/existential_types/different_defining_uses_never_type.stderr index e29256a5014f..14b7a810be2e 100644 --- a/src/test/ui/existential_types/different_defining_uses_never_type.stderr +++ b/src/test/ui/existential_types/different_defining_uses_never_type.stderr @@ -1,7 +1,7 @@ error: concrete type differs from previous defining existential type use --> $DIR/different_defining_uses_never_type.rs:12:1 | -LL | / fn bar() -> Foo { //~ ERROR concrete type differs from previous +LL | / fn bar() -> Foo { LL | | panic!() LL | | } | |_^ expected `&'static str`, got `()` @@ -17,7 +17,7 @@ LL | | } error: concrete type differs from previous defining existential type use --> $DIR/different_defining_uses_never_type.rs:16:1 | -LL | / fn boo() -> Foo { //~ ERROR concrete type differs from previous +LL | / fn boo() -> Foo { LL | | loop {} LL | | } | |_^ expected `&'static str`, got `()` diff --git a/src/test/ui/existential_types/generic_different_defining_uses.stderr b/src/test/ui/existential_types/generic_different_defining_uses.stderr index 3f129658b8fd..e5b1539ccbb9 100644 --- a/src/test/ui/existential_types/generic_different_defining_uses.stderr +++ b/src/test/ui/existential_types/generic_different_defining_uses.stderr @@ -1,7 +1,7 @@ error: concrete type differs from previous defining existential type use --> $DIR/generic_different_defining_uses.rs:11:1 | -LL | / fn my_iter2(t: T) -> MyIter { //~ ERROR concrete type differs from previous +LL | / fn my_iter2(t: T) -> MyIter { LL | | Some(t).into_iter() LL | | } | |_^ expected `std::iter::Once`, got `std::option::IntoIter` diff --git a/src/test/ui/existential_types/generic_duplicate_lifetime_param.stderr b/src/test/ui/existential_types/generic_duplicate_lifetime_param.stderr index 7b09d3ceab0b..29bd252babe5 100644 --- a/src/test/ui/existential_types/generic_duplicate_lifetime_param.stderr +++ b/src/test/ui/existential_types/generic_duplicate_lifetime_param.stderr @@ -1,7 +1,7 @@ error: non-defining existential type use in defining scope --> $DIR/generic_duplicate_lifetime_param.rs:7:1 | -LL | / fn one<'a>(t: &'a ()) -> Two<'a, 'a> { //~ ERROR non-defining existential type use +LL | / fn one<'a>(t: &'a ()) -> Two<'a, 'a> { LL | | t LL | | } | |_^ diff --git a/src/test/ui/existential_types/generic_duplicate_param_use.stderr b/src/test/ui/existential_types/generic_duplicate_param_use.stderr index d4deda999da1..a3827943b6df 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use.stderr @@ -2,7 +2,7 @@ error: defining existential type use restricts existential type by using the gen --> $DIR/generic_duplicate_param_use.rs:11:1 | LL | / fn one(t: T) -> Two { -LL | | //~^ ERROR defining existential type use restricts existential type +LL | | LL | | t LL | | } | |_^ diff --git a/src/test/ui/existential_types/generic_duplicate_param_use2.stderr b/src/test/ui/existential_types/generic_duplicate_param_use2.stderr index 0a8be3218c75..74f2802449a7 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use2.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use2.stderr @@ -2,7 +2,7 @@ error: defining existential type use restricts existential type by using the gen --> $DIR/generic_duplicate_param_use2.rs:10:1 | LL | / fn one(t: T) -> Two { -LL | | //~^ defining existential type use restricts existential type +LL | | LL | | t LL | | } | |_^ diff --git a/src/test/ui/existential_types/generic_duplicate_param_use3.stderr b/src/test/ui/existential_types/generic_duplicate_param_use3.stderr index 1c96c15a7691..22d5467c363f 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use3.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use3.stderr @@ -2,7 +2,7 @@ error: defining existential type use restricts existential type by using the gen --> $DIR/generic_duplicate_param_use3.rs:10:1 | LL | / fn one(t: T) -> Two { -LL | | //~^ defining existential type use restricts existential type +LL | | LL | | t LL | | } | |_^ @@ -11,7 +11,7 @@ error: concrete type's generic parameters differ from previous defining use --> $DIR/generic_duplicate_param_use3.rs:19:1 | LL | / fn three(_: T, u: U) -> Two { -LL | | //~^ concrete type's generic parameters differ from previous defining use +LL | | LL | | u LL | | } | |_^ expected [`T`], got [`U`] diff --git a/src/test/ui/existential_types/generic_duplicate_param_use4.stderr b/src/test/ui/existential_types/generic_duplicate_param_use4.stderr index 24b1caf7c1bf..d7e695578d39 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use4.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use4.stderr @@ -2,7 +2,7 @@ error: defining existential type use restricts existential type by using the gen --> $DIR/generic_duplicate_param_use4.rs:10:1 | LL | / fn one(t: T) -> Two { -LL | | //~^ ERROR defining existential type use restricts existential type +LL | | LL | | t LL | | } | |_^ diff --git a/src/test/ui/existential_types/generic_duplicate_param_use5.stderr b/src/test/ui/existential_types/generic_duplicate_param_use5.stderr index 166623801c24..cf4535d6c2c6 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use5.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use5.stderr @@ -2,7 +2,7 @@ error: concrete type differs from previous defining existential type use --> $DIR/generic_duplicate_param_use5.rs:14:1 | LL | / fn three(t: T, u: U) -> Two { -LL | | //~^ concrete type differs from previous +LL | | LL | | (u, t) LL | | } | |_^ expected `(T, U)`, got `(U, T)` diff --git a/src/test/ui/existential_types/generic_duplicate_param_use6.stderr b/src/test/ui/existential_types/generic_duplicate_param_use6.stderr index da49a83be1f7..1f767dacea8d 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use6.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use6.stderr @@ -2,7 +2,7 @@ error: concrete type differs from previous defining existential type use --> $DIR/generic_duplicate_param_use6.rs:14:1 | LL | / fn three(t: T, u: U) -> Two { -LL | | //~^ concrete type differs from previous +LL | | LL | | (u, t) LL | | } | |_^ expected `(T, T)`, got `(U, T)` diff --git a/src/test/ui/existential_types/generic_duplicate_param_use8.stderr b/src/test/ui/existential_types/generic_duplicate_param_use8.stderr index 80c7441c857d..58f4f97b2411 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use8.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use8.stderr @@ -2,7 +2,7 @@ error: concrete type differs from previous defining existential type use --> $DIR/generic_duplicate_param_use8.rs:13:1 | LL | / fn three(_: T, u: U) -> Two { -LL | | //~^ concrete type differs from previous +LL | | LL | | (u, 4u32) LL | | } | |_^ expected `(T, u32)`, got `(U, u32)` diff --git a/src/test/ui/existential_types/generic_duplicate_param_use9.stderr b/src/test/ui/existential_types/generic_duplicate_param_use9.stderr index a3ce480d66dc..fe4ae6cfdd07 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use9.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use9.stderr @@ -2,7 +2,7 @@ error: concrete type differs from previous defining existential type use --> $DIR/generic_duplicate_param_use9.rs:18:1 | LL | / fn three(t: T, u: U) -> Two { -LL | | (t, u, 42) //~^ ERROR concrete type differs from previous +LL | | (t, u, 42) LL | | } | |_^ expected `(A, B, ::Bar)`, got `(A, B, i32)` | diff --git a/src/test/ui/existential_types/generic_nondefining_use.stderr b/src/test/ui/existential_types/generic_nondefining_use.stderr index 8dd88006be9c..ef579260f061 100644 --- a/src/test/ui/existential_types/generic_nondefining_use.stderr +++ b/src/test/ui/existential_types/generic_nondefining_use.stderr @@ -1,7 +1,7 @@ error: defining existential type use does not fully define existential type --> $DIR/generic_nondefining_use.rs:9:1 | -LL | / fn cmp() -> Cmp { //~ ERROR defining existential type use does not fully define +LL | / fn cmp() -> Cmp { LL | | 5u32 LL | | } | |_^ diff --git a/src/test/ui/existential_types/generic_not_used.stderr b/src/test/ui/existential_types/generic_not_used.stderr index b22cffeea289..1ae4ab65929f 100644 --- a/src/test/ui/existential_types/generic_not_used.stderr +++ b/src/test/ui/existential_types/generic_not_used.stderr @@ -3,7 +3,7 @@ error: type parameter `V` is part of concrete type but not used in parameter lis | LL | fn wrong_generic(_: U, v: V) -> WrongGeneric { | _________________________________________________________________________^ -LL | | //~^ ERROR type parameter `V` is part of concrete type but not used in parameter list +LL | | LL | | v LL | | } | |_^ diff --git a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr index d9bb37328bd5..e3e5481a96c5 100644 --- a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr +++ b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/generic_type_does_not_live_long_enough.rs:6:18 | -LL | let z: i32 = x; //~ ERROR mismatched types +LL | let z: i32 = x; | ^ expected i32, found opaque type | = note: expected type `i32` diff --git a/src/test/ui/existential_types/generic_underconstrained.stderr b/src/test/ui/existential_types/generic_underconstrained.stderr index 57924e0ce213..8551a939e8ed 100644 --- a/src/test/ui/existential_types/generic_underconstrained.stderr +++ b/src/test/ui/existential_types/generic_underconstrained.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: Trait` is not satisfied --> $DIR/generic_underconstrained.rs:6:1 | -LL | existential type Underconstrained: 'static; //~ ERROR the trait bound `T: Trait` +LL | existential type Underconstrained: 'static; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` | = help: consider adding a `where T: Trait` bound diff --git a/src/test/ui/existential_types/never_reveal_concrete_type.stderr b/src/test/ui/existential_types/never_reveal_concrete_type.stderr index 33a71fc4356b..81b6584ae90d 100644 --- a/src/test/ui/existential_types/never_reveal_concrete_type.stderr +++ b/src/test/ui/existential_types/never_reveal_concrete_type.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/never_reveal_concrete_type.rs:13:27 | -LL | let _: &'static str = x; //~ mismatched types +LL | let _: &'static str = x; | ^ expected reference, found opaque type | = note: expected type `&'static str` @@ -10,7 +10,7 @@ LL | let _: &'static str = x; //~ mismatched types error[E0605]: non-primitive cast: `NoReveal` as `&'static str` --> $DIR/never_reveal_concrete_type.rs:14:13 | -LL | let _ = x as &'static str; //~ non-primitive cast +LL | let _ = x as &'static str; | ^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/existential_types/no_inferrable_concrete_type.stderr b/src/test/ui/existential_types/no_inferrable_concrete_type.stderr index fab61bd9ed06..4605332ef5b3 100644 --- a/src/test/ui/existential_types/no_inferrable_concrete_type.stderr +++ b/src/test/ui/existential_types/no_inferrable_concrete_type.stderr @@ -1,7 +1,7 @@ error[E0391]: cycle detected when processing `Foo` --> $DIR/no_inferrable_concrete_type.rs:6:1 | -LL | existential type Foo: Copy; //~ cycle detected +LL | existential type Foo: Copy; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...which requires processing `bar`... @@ -15,7 +15,7 @@ note: cycle used when collecting item types in top-level module | LL | / #![feature(existential_type)] LL | | -LL | | existential type Foo: Copy; //~ cycle detected +LL | | existential type Foo: Copy; LL | | ... | LL | | let _: Foo = std::mem::transmute(0u8); diff --git a/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr b/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr index 4ffce58f8de7..5e5826978fc7 100644 --- a/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr +++ b/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/no_revealing_outside_defining_module.rs:15:19 | -LL | let _: &str = bomp(); //~ ERROR mismatched types +LL | let _: &str = bomp(); | ^^^^^^ expected &str, found opaque type | = note: expected type `&str` @@ -12,7 +12,7 @@ error[E0308]: mismatched types | LL | fn bomp() -> boo::Boo { | -------- expected `Boo` because of return type -LL | "" //~ ERROR mismatched types +LL | "" | ^^ expected opaque type, found reference | = note: expected type `Boo` diff --git a/src/test/ui/existential_types/not_a_defining_use.stderr b/src/test/ui/existential_types/not_a_defining_use.stderr index 288a32fc14ed..f315811cdb42 100644 --- a/src/test/ui/existential_types/not_a_defining_use.stderr +++ b/src/test/ui/existential_types/not_a_defining_use.stderr @@ -2,7 +2,7 @@ error: defining existential type use does not fully define existential type --> $DIR/not_a_defining_use.rs:9:1 | LL | / fn two(t: T) -> Two { -LL | | //~^ ERROR defining existential type use does not fully define existential type +LL | | LL | | (t, 4i8) LL | | } | |_^ @@ -10,7 +10,7 @@ LL | | } error: concrete type differs from previous defining existential type use --> $DIR/not_a_defining_use.rs:30:1 | -LL | / fn four(t: T) -> Two { //~ concrete type differs from previous +LL | / fn four(t: T) -> Two { LL | | (t, ::FOO) LL | | } | |_^ expected `(T, i8)`, got `(T, ::Blub)` diff --git a/src/test/ui/existential_types/not_well_formed.stderr b/src/test/ui/existential_types/not_well_formed.stderr index 17ea57805d2b..05f84d576234 100644 --- a/src/test/ui/existential_types/not_well_formed.stderr +++ b/src/test/ui/existential_types/not_well_formed.stderr @@ -1,7 +1,7 @@ error[E0220]: associated type `Assoc` not found for `V` --> $DIR/not_well_formed.rs:10:32 | -LL | existential type Foo: Trait; //~ associated type `Assoc` not found for `V` +LL | existential type Foo: Trait; | ^^^^^^^^ associated type `Assoc` not found error: aborting due to previous error diff --git a/src/test/ui/explicit/explicit-call-to-dtor.stderr b/src/test/ui/explicit/explicit-call-to-dtor.stderr index db09b23bf26e..cbbe967179ef 100644 --- a/src/test/ui/explicit/explicit-call-to-dtor.stderr +++ b/src/test/ui/explicit/explicit-call-to-dtor.stderr @@ -1,7 +1,7 @@ error[E0040]: explicit use of destructor method --> $DIR/explicit-call-to-dtor.rs:13:7 | -LL | x.drop(); //~ ERROR explicit use of destructor method +LL | x.drop(); | ^^^^ explicit destructor calls not allowed error: aborting due to previous error diff --git a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr index dfd122b3ea40..0b302e30b64f 100644 --- a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr +++ b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr @@ -1,7 +1,7 @@ error[E0040]: explicit use of destructor method --> $DIR/explicit-call-to-supertrait-dtor.rs:17:14 | -LL | self.drop(); //~ ERROR explicit use of destructor method +LL | self.drop(); | ^^^^ explicit destructor calls not allowed error: aborting due to previous error diff --git a/src/test/ui/explore-issue-38412.stderr b/src/test/ui/explore-issue-38412.stderr index e3ce6c1317f5..5e5d952bcec8 100644 --- a/src/test/ui/explore-issue-38412.stderr +++ b/src/test/ui/explore-issue-38412.stderr @@ -9,7 +9,7 @@ LL | let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_un error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) --> $DIR/explore-issue-38412.rs:30:5 | -LL | r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature +LL | r.a_unstable_undeclared_pub; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_undeclared)] to the crate attributes to enable @@ -17,25 +17,25 @@ LL | r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature error[E0616]: field `b_crate` of struct `pub_and_stability::Record` is private --> $DIR/explore-issue-38412.rs:31:5 | -LL | r.b_crate; //~ ERROR is private +LL | r.b_crate; | ^^^^^^^^^ error[E0616]: field `c_mod` of struct `pub_and_stability::Record` is private --> $DIR/explore-issue-38412.rs:32:5 | -LL | r.c_mod; //~ ERROR is private +LL | r.c_mod; | ^^^^^^^ error[E0616]: field `d_priv` of struct `pub_and_stability::Record` is private --> $DIR/explore-issue-38412.rs:33:5 | -LL | r.d_priv; //~ ERROR is private +LL | r.d_priv; | ^^^^^^^^ error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) --> $DIR/explore-issue-38412.rs:37:5 | -LL | t.2; //~ ERROR use of unstable library feature +LL | t.2; | ^^^ | = help: add #![feature(unstable_undeclared)] to the crate attributes to enable @@ -43,25 +43,25 @@ LL | t.2; //~ ERROR use of unstable library feature error[E0616]: field `3` of struct `pub_and_stability::Tuple` is private --> $DIR/explore-issue-38412.rs:38:5 | -LL | t.3; //~ ERROR is private +LL | t.3; | ^^^ error[E0616]: field `4` of struct `pub_and_stability::Tuple` is private --> $DIR/explore-issue-38412.rs:39:5 | -LL | t.4; //~ ERROR is private +LL | t.4; | ^^^ error[E0616]: field `5` of struct `pub_and_stability::Tuple` is private --> $DIR/explore-issue-38412.rs:40:5 | -LL | t.5; //~ ERROR is private +LL | t.5; | ^^^ error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) --> $DIR/explore-issue-38412.rs:44:7 | -LL | r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature +LL | r.unstable_undeclared_trait_method(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_undeclared)] to the crate attributes to enable @@ -69,7 +69,7 @@ LL | r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) --> $DIR/explore-issue-38412.rs:48:7 | -LL | r.unstable_undeclared(); //~ ERROR use of unstable library feature +LL | r.unstable_undeclared(); | ^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_undeclared)] to the crate attributes to enable @@ -77,25 +77,25 @@ LL | r.unstable_undeclared(); //~ ERROR use of unstable library error[E0624]: method `pub_crate` is private --> $DIR/explore-issue-38412.rs:50:7 | -LL | r.pub_crate(); //~ ERROR `pub_crate` is private +LL | r.pub_crate(); | ^^^^^^^^^ error[E0624]: method `pub_mod` is private --> $DIR/explore-issue-38412.rs:51:7 | -LL | r.pub_mod(); //~ ERROR `pub_mod` is private +LL | r.pub_mod(); | ^^^^^^^ error[E0624]: method `private` is private --> $DIR/explore-issue-38412.rs:52:7 | -LL | r.private(); //~ ERROR `private` is private +LL | r.private(); | ^^^^^^^ error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) --> $DIR/explore-issue-38412.rs:57:7 | -LL | t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature +LL | t.unstable_undeclared_trait_method(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_undeclared)] to the crate attributes to enable @@ -103,7 +103,7 @@ LL | t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) --> $DIR/explore-issue-38412.rs:61:7 | -LL | t.unstable_undeclared(); //~ ERROR use of unstable library feature +LL | t.unstable_undeclared(); | ^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_undeclared)] to the crate attributes to enable @@ -111,19 +111,19 @@ LL | t.unstable_undeclared(); //~ ERROR use of unstable library error[E0624]: method `pub_crate` is private --> $DIR/explore-issue-38412.rs:63:7 | -LL | t.pub_crate(); //~ ERROR `pub_crate` is private +LL | t.pub_crate(); | ^^^^^^^^^ error[E0624]: method `pub_mod` is private --> $DIR/explore-issue-38412.rs:64:7 | -LL | t.pub_mod(); //~ ERROR `pub_mod` is private +LL | t.pub_mod(); | ^^^^^^^ error[E0624]: method `private` is private --> $DIR/explore-issue-38412.rs:65:7 | -LL | t.private(); //~ ERROR `private` is private +LL | t.private(); | ^^^^^^^ error: aborting due to 19 previous errors diff --git a/src/test/ui/export-fully-qualified.stderr b/src/test/ui/export-fully-qualified.stderr index dd7e3219c76a..c2ec1600868a 100644 --- a/src/test/ui/export-fully-qualified.stderr +++ b/src/test/ui/export-fully-qualified.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: use of undeclared type or module `foo` --> $DIR/export-fully-qualified.rs:6:20 | -LL | pub fn bar() { foo::baz(); } //~ ERROR failed to resolve: use of undeclared type or module `foo` +LL | pub fn bar() { foo::baz(); } | ^^^ use of undeclared type or module `foo` error: aborting due to previous error diff --git a/src/test/ui/export-tag-variant.stderr b/src/test/ui/export-tag-variant.stderr index eb202b3b31b0..b5a2c12c436d 100644 --- a/src/test/ui/export-tag-variant.stderr +++ b/src/test/ui/export-tag-variant.stderr @@ -1,7 +1,7 @@ error[E0603]: enum `Y` is private --> $DIR/export-tag-variant.rs:7:26 | -LL | fn main() { let z = foo::Y::Y1; } //~ ERROR: enum `Y` is private +LL | fn main() { let z = foo::Y::Y1; } | ^ error: aborting due to previous error diff --git a/src/test/ui/export.stderr b/src/test/ui/export.stderr index ff7763bbd899..76ec91e181d5 100644 --- a/src/test/ui/export.stderr +++ b/src/test/ui/export.stderr @@ -25,7 +25,7 @@ LL | fn z(y: isize) { log(debug, y); } error[E0603]: function `z` is private --> $DIR/export.rs:10:18 | -LL | fn main() { foo::z(10); } //~ ERROR function `z` is private +LL | fn main() { foo::z(10); } | ^ error: aborting due to 5 previous errors diff --git a/src/test/ui/export2.stderr b/src/test/ui/export2.stderr index 6233c6d074e6..e0cd4404d377 100644 --- a/src/test/ui/export2.stderr +++ b/src/test/ui/export2.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: use of undeclared type or module `bar` --> $DIR/export2.rs:2:18 | -LL | pub fn x() { bar::x(); } //~ ERROR failed to resolve: use of undeclared type or module `bar` +LL | pub fn x() { bar::x(); } | ^^^ use of undeclared type or module `bar` error: aborting due to previous error diff --git a/src/test/ui/expr_attr_paren_order.stderr b/src/test/ui/expr_attr_paren_order.stderr index 8155514191ce..89f615f53ddd 100644 --- a/src/test/ui/expr_attr_paren_order.stderr +++ b/src/test/ui/expr_attr_paren_order.stderr @@ -1,7 +1,7 @@ error: variable `X` should have a snake case name --> $DIR/expr_attr_paren_order.rs:19:17 | -LL | let X = 0; //~ ERROR snake case name +LL | let X = 0; | ^ help: convert the identifier to snake case: `x` | note: lint level defined here diff --git a/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr b/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr index 92c04f9fe8a5..258e2b347fba 100644 --- a/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr +++ b/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr @@ -1,7 +1,7 @@ error: expected string literal --> $DIR/extenv-arg-2-not-string-literal.rs:1:25 | -LL | fn main() { env!("one", 10); } //~ ERROR: expected string literal +LL | fn main() { env!("one", 10); } | ^^ error: aborting due to previous error diff --git a/src/test/ui/extenv/extenv-no-args.stderr b/src/test/ui/extenv/extenv-no-args.stderr index 7ae8a6f1858a..acdde84afa4d 100644 --- a/src/test/ui/extenv/extenv-no-args.stderr +++ b/src/test/ui/extenv/extenv-no-args.stderr @@ -1,7 +1,7 @@ error: env! takes 1 or 2 arguments --> $DIR/extenv-no-args.rs:1:13 | -LL | fn main() { env!(); } //~ ERROR: env! takes 1 or 2 arguments +LL | fn main() { env!(); } | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/extenv/extenv-not-defined-custom.stderr b/src/test/ui/extenv/extenv-not-defined-custom.stderr index 34e5b7f9f236..523982dd0196 100644 --- a/src/test/ui/extenv/extenv-not-defined-custom.stderr +++ b/src/test/ui/extenv/extenv-not-defined-custom.stderr @@ -1,7 +1,7 @@ error: my error message --> $DIR/extenv-not-defined-custom.rs:1:13 | -LL | fn main() { env!("__HOPEFULLY_NOT_DEFINED__", "my error message"); } //~ ERROR: my error message +LL | fn main() { env!("__HOPEFULLY_NOT_DEFINED__", "my error message"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/extenv/extenv-not-string-literal.stderr b/src/test/ui/extenv/extenv-not-string-literal.stderr index 66645b24a49a..342a9f7096e7 100644 --- a/src/test/ui/extenv/extenv-not-string-literal.stderr +++ b/src/test/ui/extenv/extenv-not-string-literal.stderr @@ -1,7 +1,7 @@ error: expected string literal --> $DIR/extenv-not-string-literal.rs:1:18 | -LL | fn main() { env!(10, "two"); } //~ ERROR: expected string literal +LL | fn main() { env!(10, "two"); } | ^^ error: aborting due to previous error diff --git a/src/test/ui/extenv/extenv-too-many-args.stderr b/src/test/ui/extenv/extenv-too-many-args.stderr index 43695d88eaf6..3351da0d5476 100644 --- a/src/test/ui/extenv/extenv-too-many-args.stderr +++ b/src/test/ui/extenv/extenv-too-many-args.stderr @@ -1,7 +1,7 @@ error: env! takes 1 or 2 arguments --> $DIR/extenv-too-many-args.rs:1:13 | -LL | fn main() { env!("one", "two", "three"); } //~ ERROR: env! takes 1 or 2 arguments +LL | fn main() { env!("one", "two", "three"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/extenv/issue-55897.stderr b/src/test/ui/extenv/issue-55897.stderr index 603b29aa989f..9f6570ab2a0f 100644 --- a/src/test/ui/extenv/issue-55897.stderr +++ b/src/test/ui/extenv/issue-55897.stderr @@ -7,7 +7,7 @@ LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs")); error[E0432]: unresolved import `prelude` --> $DIR/issue-55897.rs:1:5 | -LL | use prelude::*; //~ ERROR unresolved import `prelude` +LL | use prelude::*; | ^^^^^^^ | | | unresolved import diff --git a/src/test/ui/extern/extern-const.stderr b/src/test/ui/extern/extern-const.stderr index 7ebaec0368e3..77406be2095c 100644 --- a/src/test/ui/extern/extern-const.stderr +++ b/src/test/ui/extern/extern-const.stderr @@ -1,7 +1,7 @@ error: extern items cannot be `const` --> $DIR/extern-const.rs:15:5 | -LL | const rust_dbg_static_mut: libc::c_int; //~ ERROR extern items cannot be `const` +LL | const rust_dbg_static_mut: libc::c_int; | ^^^^^ help: try using a static value: `static` error: aborting due to previous error diff --git a/src/test/ui/extern/extern-crate-rename.stderr b/src/test/ui/extern/extern-crate-rename.stderr index 204e7dd64df4..787c11f2a81a 100644 --- a/src/test/ui/extern/extern-crate-rename.stderr +++ b/src/test/ui/extern/extern-crate-rename.stderr @@ -3,13 +3,13 @@ error[E0259]: the name `m1` is defined multiple times | LL | extern crate m1; | ---------------- previous import of the extern crate `m1` here -LL | extern crate m2 as m1; //~ ERROR is defined multiple times +LL | extern crate m2 as m1; | ^^^^^^^^^^^^^^^^^^^^^^ `m1` reimported here | = note: `m1` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate m2 as other_m1; //~ ERROR is defined multiple times +LL | extern crate m2 as other_m1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/extern/extern-crate-visibility.stderr b/src/test/ui/extern/extern-crate-visibility.stderr index 8baac1a902b8..8bc9f9a67e7e 100644 --- a/src/test/ui/extern/extern-crate-visibility.stderr +++ b/src/test/ui/extern/extern-crate-visibility.stderr @@ -1,13 +1,13 @@ error[E0603]: extern crate `core` is private --> $DIR/extern-crate-visibility.rs:6:10 | -LL | use foo::core::cell; //~ ERROR extern crate `core` is private +LL | use foo::core::cell; | ^^^^ error[E0603]: extern crate `core` is private --> $DIR/extern-crate-visibility.rs:9:10 | -LL | foo::core::cell::Cell::new(0); //~ ERROR extern crate `core` is private +LL | foo::core::cell::Cell::new(0); | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/extern/extern-macro.stderr b/src/test/ui/extern/extern-macro.stderr index d70b6ef79ea8..5b7a720736a1 100644 --- a/src/test/ui/extern/extern-macro.stderr +++ b/src/test/ui/extern/extern-macro.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: partially resolved path in a macro --> $DIR/extern-macro.rs:5:13 | -LL | let _ = Foo::bar!(); //~ ERROR failed to resolve: partially resolved path in a macro +LL | let _ = Foo::bar!(); | ^^^^^^^^ partially resolved path in a macro error: aborting due to previous error diff --git a/src/test/ui/extern/extern-main-fn.stderr b/src/test/ui/extern/extern-main-fn.stderr index f2134701deee..14f064060a62 100644 --- a/src/test/ui/extern/extern-main-fn.stderr +++ b/src/test/ui/extern/extern-main-fn.stderr @@ -1,7 +1,7 @@ error[E0580]: main function has wrong type --> $DIR/extern-main-fn.rs:1:1 | -LL | extern fn main() {} //~ ERROR: main function has wrong type [E0580] +LL | extern fn main() {} | ^^^^^^^^^^^^^^^^ expected "Rust" fn, found "C" fn | = note: expected type `fn()` diff --git a/src/test/ui/extern/extern-types-distinct-types.stderr b/src/test/ui/extern/extern-types-distinct-types.stderr index b7b6f2cf04ae..eb632ee395f2 100644 --- a/src/test/ui/extern/extern-types-distinct-types.stderr +++ b/src/test/ui/extern/extern-types-distinct-types.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/extern-types-distinct-types.rs:9:5 | -LL | r //~ ERROR mismatched types +LL | r | ^ expected extern type `B`, found extern type `A` | = note: expected type `&B` diff --git a/src/test/ui/extoption_env-no-args.stderr b/src/test/ui/extoption_env-no-args.stderr index 34fe289cd98a..386d517a4460 100644 --- a/src/test/ui/extoption_env-no-args.stderr +++ b/src/test/ui/extoption_env-no-args.stderr @@ -1,7 +1,7 @@ error: option_env! takes 1 argument --> $DIR/extoption_env-no-args.rs:1:13 | -LL | fn main() { option_env!(); } //~ ERROR: option_env! takes 1 argument +LL | fn main() { option_env!(); } | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/extoption_env-not-string-literal.stderr b/src/test/ui/extoption_env-not-string-literal.stderr index 8c97b57e0ab9..272751916f5b 100644 --- a/src/test/ui/extoption_env-not-string-literal.stderr +++ b/src/test/ui/extoption_env-not-string-literal.stderr @@ -1,7 +1,7 @@ error: argument must be a string literal --> $DIR/extoption_env-not-string-literal.rs:1:25 | -LL | fn main() { option_env!(10); } //~ ERROR: argument must be a string literal +LL | fn main() { option_env!(10); } | ^^ error: aborting due to previous error diff --git a/src/test/ui/extoption_env-too-many-args.stderr b/src/test/ui/extoption_env-too-many-args.stderr index 6b5ade6daef2..2ec559470326 100644 --- a/src/test/ui/extoption_env-too-many-args.stderr +++ b/src/test/ui/extoption_env-too-many-args.stderr @@ -1,7 +1,7 @@ error: option_env! takes 1 argument --> $DIR/extoption_env-too-many-args.rs:1:13 | -LL | fn main() { option_env!("one", "two"); } //~ ERROR: option_env! takes 1 argument +LL | fn main() { option_env!("one", "two"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/fail-no-dead-code-core.stderr b/src/test/ui/fail-no-dead-code-core.stderr index b78aed456830..2540242f9f68 100644 --- a/src/test/ui/fail-no-dead-code-core.stderr +++ b/src/test/ui/fail-no-dead-code-core.stderr @@ -1,7 +1,7 @@ error: function is never used: `foo` --> $DIR/fail-no-dead-code-core.rs:7:1 | -LL | fn foo() { //~ ERROR function is never used +LL | fn foo() { | ^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/fail-no-dead-code.stderr b/src/test/ui/fail-no-dead-code.stderr index a43582959311..8babcffaa8dd 100644 --- a/src/test/ui/fail-no-dead-code.stderr +++ b/src/test/ui/fail-no-dead-code.stderr @@ -1,7 +1,7 @@ error: function is never used: `foo` --> $DIR/fail-no-dead-code.rs:4:1 | -LL | fn foo() { //~ ERROR function is never used +LL | fn foo() { | ^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/fail-simple.stderr b/src/test/ui/fail-simple.stderr index 31be4e2c87a6..26ed918e94d9 100644 --- a/src/test/ui/fail-simple.stderr +++ b/src/test/ui/fail-simple.stderr @@ -1,7 +1,7 @@ error: no rules expected the token `@` --> $DIR/fail-simple.rs:2:12 | -LL | panic!(@); //~ ERROR no rules expected the token `@` +LL | panic!(@); | ^ no rules expected this token in macro call error: aborting due to previous error diff --git a/src/test/ui/fat-ptr-cast.stderr b/src/test/ui/fat-ptr-cast.stderr index 936cdc559bd1..fb1602423938 100644 --- a/src/test/ui/fat-ptr-cast.stderr +++ b/src/test/ui/fat-ptr-cast.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `&[i32]` as `usize` is invalid --> $DIR/fat-ptr-cast.rs:10:5 | -LL | a as usize; //~ ERROR casting +LL | a as usize; | ^^^^^^^^^^ | = help: cast through a raw pointer first @@ -9,7 +9,7 @@ LL | a as usize; //~ ERROR casting error[E0606]: casting `&[i32]` as `isize` is invalid --> $DIR/fat-ptr-cast.rs:11:5 | -LL | a as isize; //~ ERROR casting +LL | a as isize; | ^^^^^^^^^^ | = help: cast through a raw pointer first @@ -17,7 +17,7 @@ LL | a as isize; //~ ERROR casting error[E0606]: casting `&[i32]` as `i16` is invalid --> $DIR/fat-ptr-cast.rs:12:5 | -LL | a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid +LL | a as i16; | ^^^^^^^^ | = help: cast through a raw pointer first @@ -25,7 +25,7 @@ LL | a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid error[E0606]: casting `&[i32]` as `u32` is invalid --> $DIR/fat-ptr-cast.rs:13:5 | -LL | a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid +LL | a as u32; | ^^^^^^^^ | = help: cast through a raw pointer first @@ -33,7 +33,7 @@ LL | a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid error[E0605]: non-primitive cast: `std::boxed::Box<[i32]>` as `usize` --> $DIR/fat-ptr-cast.rs:14:5 | -LL | b as usize; //~ ERROR non-primitive cast +LL | b as usize; | ^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -49,19 +49,19 @@ LL | p as usize; error[E0607]: cannot cast thin pointer `*const i32` to fat pointer `*const [i32]` --> $DIR/fat-ptr-cast.rs:19:5 | -LL | q as *const [i32]; //~ ERROR cannot cast +LL | q as *const [i32]; | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `usize` as `*mut (dyn Trait + 'static)` is invalid --> $DIR/fat-ptr-cast.rs:22:37 | -LL | let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR casting +LL | let t: *mut (Trait + 'static) = 0 as *mut _; | ^^^^^^^^^^^ error[E0606]: casting `usize` as `*const str` is invalid --> $DIR/fat-ptr-cast.rs:23:32 | -LL | let mut fail: *const str = 0 as *const str; //~ ERROR casting +LL | let mut fail: *const str = 0 as *const str; | ^^^^^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/feature-gate-optimize_attribute.stderr b/src/test/ui/feature-gate-optimize_attribute.stderr index ddd4c457d731..7635af6ce46f 100644 --- a/src/test/ui/feature-gate-optimize_attribute.stderr +++ b/src/test/ui/feature-gate-optimize_attribute.stderr @@ -1,7 +1,7 @@ error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882) --> $DIR/feature-gate-optimize_attribute.rs:7:1 | -LL | #[optimize(size)] //~ ERROR #54882 +LL | #[optimize(size)] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(optimize_attribute)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[optimize(size)] //~ ERROR #54882 error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882) --> $DIR/feature-gate-optimize_attribute.rs:10:1 | -LL | #[optimize(speed)] //~ ERROR #54882 +LL | #[optimize(speed)] | ^^^^^^^^^^^^^^^^^^ | = help: add #![feature(optimize_attribute)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | #[optimize(banana)] error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882) --> $DIR/feature-gate-optimize_attribute.rs:4:1 | -LL | #[optimize(size)] //~ ERROR #54882 +LL | #[optimize(size)] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(optimize_attribute)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | #[optimize(size)] //~ ERROR #54882 error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882) --> $DIR/feature-gate-optimize_attribute.rs:2:1 | -LL | #![optimize(speed)] //~ ERROR #54882 +LL | #![optimize(speed)] | ^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(optimize_attribute)] to the crate attributes to enable diff --git a/src/test/ui/feature-gate/duplicate-features.stderr b/src/test/ui/feature-gate/duplicate-features.stderr index 18adf3a880ac..dbde806f6cc4 100644 --- a/src/test/ui/feature-gate/duplicate-features.stderr +++ b/src/test/ui/feature-gate/duplicate-features.stderr @@ -1,13 +1,13 @@ error[E0636]: the feature `if_let` has already been declared --> $DIR/duplicate-features.rs:7:12 | -LL | #![feature(if_let)] //~ ERROR the feature `if_let` has already been declared +LL | #![feature(if_let)] | ^^^^^^ error[E0636]: the feature `rust1` has already been declared --> $DIR/duplicate-features.rs:4:12 | -LL | #![feature(rust1)] //~ ERROR the feature `rust1` has already been declared +LL | #![feature(rust1)] | ^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index 4d15ccb300a8..c539e24c01b1 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -1,7 +1,7 @@ warning: unknown lint: `x5400` --> $DIR/issue-43106-gating-of-builtin-attrs.rs:38:9 | -LL | #![warn(x5400)] //~ WARN unknown lint: `x5400` +LL | #![warn(x5400)] | ^^^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![warn(unused_attributes, unknown_lints)] warning: unknown lint: `x5300` --> $DIR/issue-43106-gating-of-builtin-attrs.rs:39:10 | -LL | #![allow(x5300)] //~ WARN unknown lint: `x5300` +LL | #![allow(x5300)] | ^^^^^ warning: unknown lint: `x5200` --> $DIR/issue-43106-gating-of-builtin-attrs.rs:40:11 | -LL | #![forbid(x5200)] //~ WARN unknown lint: `x5200` +LL | #![forbid(x5200)] | ^^^^^ warning: unknown lint: `x5100` --> $DIR/issue-43106-gating-of-builtin-attrs.rs:41:9 | -LL | #![deny(x5100)] //~ WARN unknown lint: `x5100` +LL | #![deny(x5100)] | ^^^^^ warning: unknown lint: `x5400` @@ -1113,25 +1113,25 @@ LL | #[type_length_limit="0100"] warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:43:1 | -LL | #![macro_export] //~ WARN unused attribute +LL | #![macro_export] | ^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:44:1 | -LL | #![plugin_registrar] //~ WARN unused attribute +LL | #![plugin_registrar] | ^^^^^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:47:1 | -LL | #![main] //~ WARN unused attribute +LL | #![main] | ^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:48:1 | -LL | #![start] //~ WARN unused attribute +LL | #![start] | ^^^^^^^^^ warning: unused attribute @@ -1143,37 +1143,37 @@ LL | #![repr()] warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1 | -LL | #![path = "3800"] //~ WARN unused attribute +LL | #![path = "3800"] | ^^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:54:1 | -LL | #![automatically_derived] //~ WARN unused attribute +LL | #![automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1 | -LL | #![no_link] //~ WARN unused attribute +LL | #![no_link] | ^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:58:1 | -LL | #![should_panic] //~ WARN unused attribute +LL | #![should_panic] | ^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:59:1 | -LL | #![ignore] //~ WARN unused attribute +LL | #![ignore] | ^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:65:1 | -LL | #![proc_macro_derive()] //~ WARN unused attribute +LL | #![proc_macro_derive()] | ^^^^^^^^^^^^^^^^^^^^^^^ error: invalid windows subsystem `1000`, only `windows` and `console` are allowed diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr index 71e8f11ff078..ef89a887fd44 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr @@ -13,13 +13,13 @@ error[E0518]: attribute should be applied to function or closure | LL | #[inline] | ^^^^^^^^^ -LL | //~^ ERROR attribute should be applied to function or closure +LL | LL | / mod inline { LL | | mod inner { #![inline] } -LL | | //~^ ERROR attribute should be applied to function or closure +LL | | LL | | ... | -LL | | //~^ ERROR attribute should be applied to function or closure +LL | | LL | | } | |_- not a function or closure diff --git a/src/test/ui/feature-gate/issue-49983-see-issue-0.stderr b/src/test/ui/feature-gate/issue-49983-see-issue-0.stderr index 22ad8c8b77e9..83775322a270 100644 --- a/src/test/ui/feature-gate/issue-49983-see-issue-0.stderr +++ b/src/test/ui/feature-gate/issue-49983-see-issue-0.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'ptr_internals': use NonNull instead and consider PhantomData (if you also use #[may_dangle]), Send, and/or Sync --> $DIR/issue-49983-see-issue-0.rs:4:30 | -LL | #[allow(unused_imports)] use core::ptr::Unique; //~ ERROR use of unstable library feature +LL | #[allow(unused_imports)] use core::ptr::Unique; | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(ptr_internals)] to the crate attributes to enable diff --git a/src/test/ui/feature-gate/unknown-feature.stderr b/src/test/ui/feature-gate/unknown-feature.stderr index 2f8bf20ce467..e5c05872dbf8 100644 --- a/src/test/ui/feature-gate/unknown-feature.stderr +++ b/src/test/ui/feature-gate/unknown-feature.stderr @@ -1,7 +1,7 @@ error[E0635]: unknown feature `unknown_rust_feature` --> $DIR/unknown-feature.rs:1:12 | -LL | #![feature(unknown_rust_feature)] //~ ERROR unknown feature +LL | #![feature(unknown_rust_feature)] | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/feature-gated-feature-in-macro-arg.stderr b/src/test/ui/feature-gated-feature-in-macro-arg.stderr index b262a6f7005e..5cbd1023b3cc 100644 --- a/src/test/ui/feature-gated-feature-in-macro-arg.stderr +++ b/src/test/ui/feature-gated-feature-in-macro-arg.stderr @@ -1,7 +1,7 @@ error[E0658]: intrinsics are subject to change --> $DIR/feature-gated-feature-in-macro-arg.rs:8:9 | -LL | / extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change +LL | / extern "rust-intrinsic" { LL | | fn atomic_fence(); LL | | } | |_________^ diff --git a/src/test/ui/feature-gates/feature-gate-abi.stderr b/src/test/ui/feature-gates/feature-gate-abi.stderr index d528788f7c22..7417f310921d 100644 --- a/src/test/ui/feature-gates/feature-gate-abi.stderr +++ b/src/test/ui/feature-gates/feature-gate-abi.stderr @@ -1,7 +1,7 @@ error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:12:1 | -LL | extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" fn f1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to chan error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:13:1 | -LL | extern "platform-intrinsic" fn f2() {} //~ ERROR platform intrinsics are experimental +LL | extern "platform-intrinsic" fn f2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | extern "platform-intrinsic" fn f2() {} //~ ERROR platform intrinsics are ex error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:14:1 | -LL | extern "vectorcall" fn f3() {} //~ ERROR vectorcall is experimental and subject to change +LL | extern "vectorcall" fn f3() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | extern "vectorcall" fn f3() {} //~ ERROR vectorcall is experimental and sub error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:15:1 | -LL | extern "rust-call" fn f4() {} //~ ERROR rust-call ABI is subject to change +LL | extern "rust-call" fn f4() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | extern "rust-call" fn f4() {} //~ ERROR rust-call ABI is subject to change error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:16:1 | -LL | extern "msp430-interrupt" fn f5() {} //~ ERROR msp430-interrupt ABI is experimental +LL | extern "msp430-interrupt" fn f5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -41,7 +41,7 @@ LL | extern "msp430-interrupt" fn f5() {} //~ ERROR msp430-interrupt ABI is expe error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:17:1 | -LL | extern "ptx-kernel" fn f6() {} //~ ERROR PTX ABIs are experimental and subject to change +LL | extern "ptx-kernel" fn f6() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -49,7 +49,7 @@ LL | extern "ptx-kernel" fn f6() {} //~ ERROR PTX ABIs are experimental and subj error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:18:1 | -LL | extern "x86-interrupt" fn f7() {} //~ ERROR x86-interrupt ABI is experimental +LL | extern "x86-interrupt" fn f7() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -57,7 +57,7 @@ LL | extern "x86-interrupt" fn f7() {} //~ ERROR x86-interrupt ABI is experiment error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:19:1 | -LL | extern "thiscall" fn f8() {} //~ ERROR thiscall is experimental and subject to change +LL | extern "thiscall" fn f8() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -65,7 +65,7 @@ LL | extern "thiscall" fn f8() {} //~ ERROR thiscall is experimental and subject error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:20:1 | -LL | extern "amdgpu-kernel" fn f9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | extern "amdgpu-kernel" fn f9() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable @@ -73,7 +73,7 @@ LL | extern "amdgpu-kernel" fn f9() {} //~ ERROR amdgpu-kernel ABI is experiment error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:24:5 | -LL | extern "rust-intrinsic" fn m1(); //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" fn m1(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -81,7 +81,7 @@ LL | extern "rust-intrinsic" fn m1(); //~ ERROR intrinsics are subject to ch error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:25:5 | -LL | extern "platform-intrinsic" fn m2(); //~ ERROR platform intrinsics are experimental +LL | extern "platform-intrinsic" fn m2(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -89,7 +89,7 @@ LL | extern "platform-intrinsic" fn m2(); //~ ERROR platform intrinsics are error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:26:5 | -LL | extern "vectorcall" fn m3(); //~ ERROR vectorcall is experimental and subject to change +LL | extern "vectorcall" fn m3(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -97,7 +97,7 @@ LL | extern "vectorcall" fn m3(); //~ ERROR vectorcall is experimental and s error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:27:5 | -LL | extern "rust-call" fn m4(); //~ ERROR rust-call ABI is subject to change +LL | extern "rust-call" fn m4(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -105,7 +105,7 @@ LL | extern "rust-call" fn m4(); //~ ERROR rust-call ABI is subject to chang error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:28:5 | -LL | extern "msp430-interrupt" fn m5(); //~ ERROR msp430-interrupt ABI is experimental +LL | extern "msp430-interrupt" fn m5(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -113,7 +113,7 @@ LL | extern "msp430-interrupt" fn m5(); //~ ERROR msp430-interrupt ABI is ex error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:29:5 | -LL | extern "ptx-kernel" fn m6(); //~ ERROR PTX ABIs are experimental and subject to change +LL | extern "ptx-kernel" fn m6(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -121,7 +121,7 @@ LL | extern "ptx-kernel" fn m6(); //~ ERROR PTX ABIs are experimental and su error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:30:5 | -LL | extern "x86-interrupt" fn m7(); //~ ERROR x86-interrupt ABI is experimental +LL | extern "x86-interrupt" fn m7(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -129,7 +129,7 @@ LL | extern "x86-interrupt" fn m7(); //~ ERROR x86-interrupt ABI is experime error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:31:5 | -LL | extern "thiscall" fn m8(); //~ ERROR thiscall is experimental and subject to change +LL | extern "thiscall" fn m8(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -137,7 +137,7 @@ LL | extern "thiscall" fn m8(); //~ ERROR thiscall is experimental and subje error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:32:5 | -LL | extern "amdgpu-kernel" fn m9(); //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | extern "amdgpu-kernel" fn m9(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable @@ -145,7 +145,7 @@ LL | extern "amdgpu-kernel" fn m9(); //~ ERROR amdgpu-kernel ABI is experime error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:34:5 | -LL | extern "rust-intrinsic" fn dm1() {} //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" fn dm1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -153,7 +153,7 @@ LL | extern "rust-intrinsic" fn dm1() {} //~ ERROR intrinsics are subject to error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:35:5 | -LL | extern "platform-intrinsic" fn dm2() {} //~ ERROR platform intrinsics are experimental +LL | extern "platform-intrinsic" fn dm2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -161,7 +161,7 @@ LL | extern "platform-intrinsic" fn dm2() {} //~ ERROR platform intrinsics a error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:36:5 | -LL | extern "vectorcall" fn dm3() {} //~ ERROR vectorcall is experimental and subject to change +LL | extern "vectorcall" fn dm3() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -169,7 +169,7 @@ LL | extern "vectorcall" fn dm3() {} //~ ERROR vectorcall is experimental an error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:37:5 | -LL | extern "rust-call" fn dm4() {} //~ ERROR rust-call ABI is subject to change +LL | extern "rust-call" fn dm4() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -177,7 +177,7 @@ LL | extern "rust-call" fn dm4() {} //~ ERROR rust-call ABI is subject to ch error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:38:5 | -LL | extern "msp430-interrupt" fn dm5() {} //~ ERROR msp430-interrupt ABI is experimental +LL | extern "msp430-interrupt" fn dm5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -185,7 +185,7 @@ LL | extern "msp430-interrupt" fn dm5() {} //~ ERROR msp430-interrupt ABI is error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:39:5 | -LL | extern "ptx-kernel" fn dm6() {} //~ ERROR PTX ABIs are experimental and subject to change +LL | extern "ptx-kernel" fn dm6() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -193,7 +193,7 @@ LL | extern "ptx-kernel" fn dm6() {} //~ ERROR PTX ABIs are experimental and error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:40:5 | -LL | extern "x86-interrupt" fn dm7() {} //~ ERROR x86-interrupt ABI is experimental +LL | extern "x86-interrupt" fn dm7() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -201,7 +201,7 @@ LL | extern "x86-interrupt" fn dm7() {} //~ ERROR x86-interrupt ABI is exper error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:41:5 | -LL | extern "thiscall" fn dm8() {} //~ ERROR thiscall is experimental and subject to change +LL | extern "thiscall" fn dm8() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -209,7 +209,7 @@ LL | extern "thiscall" fn dm8() {} //~ ERROR thiscall is experimental and su error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:42:5 | -LL | extern "amdgpu-kernel" fn dm9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | extern "amdgpu-kernel" fn dm9() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable @@ -217,7 +217,7 @@ LL | extern "amdgpu-kernel" fn dm9() {} //~ ERROR amdgpu-kernel ABI is exper error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:49:5 | -LL | extern "rust-intrinsic" fn m1() {} //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" fn m1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -225,7 +225,7 @@ LL | extern "rust-intrinsic" fn m1() {} //~ ERROR intrinsics are subject to error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:50:5 | -LL | extern "platform-intrinsic" fn m2() {} //~ ERROR platform intrinsics are experimental +LL | extern "platform-intrinsic" fn m2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -233,7 +233,7 @@ LL | extern "platform-intrinsic" fn m2() {} //~ ERROR platform intrinsics ar error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:51:5 | -LL | extern "vectorcall" fn m3() {} //~ ERROR vectorcall is experimental and subject to change +LL | extern "vectorcall" fn m3() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -241,7 +241,7 @@ LL | extern "vectorcall" fn m3() {} //~ ERROR vectorcall is experimental and error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:52:5 | -LL | extern "rust-call" fn m4() {} //~ ERROR rust-call ABI is subject to change +LL | extern "rust-call" fn m4() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -249,7 +249,7 @@ LL | extern "rust-call" fn m4() {} //~ ERROR rust-call ABI is subject to cha error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:53:5 | -LL | extern "msp430-interrupt" fn m5() {} //~ ERROR msp430-interrupt ABI is experimental +LL | extern "msp430-interrupt" fn m5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -257,7 +257,7 @@ LL | extern "msp430-interrupt" fn m5() {} //~ ERROR msp430-interrupt ABI is error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:54:5 | -LL | extern "ptx-kernel" fn m6() {} //~ ERROR PTX ABIs are experimental and subject to change +LL | extern "ptx-kernel" fn m6() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -265,7 +265,7 @@ LL | extern "ptx-kernel" fn m6() {} //~ ERROR PTX ABIs are experimental and error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:55:5 | -LL | extern "x86-interrupt" fn m7() {} //~ ERROR x86-interrupt ABI is experimental +LL | extern "x86-interrupt" fn m7() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -273,7 +273,7 @@ LL | extern "x86-interrupt" fn m7() {} //~ ERROR x86-interrupt ABI is experi error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:56:5 | -LL | extern "thiscall" fn m8() {} //~ ERROR thiscall is experimental and subject to change +LL | extern "thiscall" fn m8() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -281,7 +281,7 @@ LL | extern "thiscall" fn m8() {} //~ ERROR thiscall is experimental and sub error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:57:5 | -LL | extern "amdgpu-kernel" fn m9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | extern "amdgpu-kernel" fn m9() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable @@ -289,7 +289,7 @@ LL | extern "amdgpu-kernel" fn m9() {} //~ ERROR amdgpu-kernel ABI is experi error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:62:5 | -LL | extern "rust-intrinsic" fn im1() {} //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" fn im1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -297,7 +297,7 @@ LL | extern "rust-intrinsic" fn im1() {} //~ ERROR intrinsics are subject to error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:63:5 | -LL | extern "platform-intrinsic" fn im2() {} //~ ERROR platform intrinsics are experimental +LL | extern "platform-intrinsic" fn im2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -305,7 +305,7 @@ LL | extern "platform-intrinsic" fn im2() {} //~ ERROR platform intrinsics a error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:64:5 | -LL | extern "vectorcall" fn im3() {} //~ ERROR vectorcall is experimental and subject to change +LL | extern "vectorcall" fn im3() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -313,7 +313,7 @@ LL | extern "vectorcall" fn im3() {} //~ ERROR vectorcall is experimental an error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:65:5 | -LL | extern "rust-call" fn im4() {} //~ ERROR rust-call ABI is subject to change +LL | extern "rust-call" fn im4() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -321,7 +321,7 @@ LL | extern "rust-call" fn im4() {} //~ ERROR rust-call ABI is subject to ch error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:66:5 | -LL | extern "msp430-interrupt" fn im5() {} //~ ERROR msp430-interrupt ABI is experimental +LL | extern "msp430-interrupt" fn im5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -329,7 +329,7 @@ LL | extern "msp430-interrupt" fn im5() {} //~ ERROR msp430-interrupt ABI is error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:67:5 | -LL | extern "ptx-kernel" fn im6() {} //~ ERROR PTX ABIs are experimental and subject to change +LL | extern "ptx-kernel" fn im6() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -337,7 +337,7 @@ LL | extern "ptx-kernel" fn im6() {} //~ ERROR PTX ABIs are experimental and error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:68:5 | -LL | extern "x86-interrupt" fn im7() {} //~ ERROR x86-interrupt ABI is experimental +LL | extern "x86-interrupt" fn im7() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -345,7 +345,7 @@ LL | extern "x86-interrupt" fn im7() {} //~ ERROR x86-interrupt ABI is exper error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:69:5 | -LL | extern "thiscall" fn im8() {} //~ ERROR thiscall is experimental and subject to change +LL | extern "thiscall" fn im8() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -353,7 +353,7 @@ LL | extern "thiscall" fn im8() {} //~ ERROR thiscall is experimental and su error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:70:5 | -LL | extern "amdgpu-kernel" fn im9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | extern "amdgpu-kernel" fn im9() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable @@ -361,7 +361,7 @@ LL | extern "amdgpu-kernel" fn im9() {} //~ ERROR amdgpu-kernel ABI is exper error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:74:11 | -LL | type A1 = extern "rust-intrinsic" fn(); //~ ERROR intrinsics are subject to change +LL | type A1 = extern "rust-intrinsic" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -369,7 +369,7 @@ LL | type A1 = extern "rust-intrinsic" fn(); //~ ERROR intrinsics are subject to error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:75:11 | -LL | type A2 = extern "platform-intrinsic" fn(); //~ ERROR platform intrinsics are experimental +LL | type A2 = extern "platform-intrinsic" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -377,7 +377,7 @@ LL | type A2 = extern "platform-intrinsic" fn(); //~ ERROR platform intrinsics a error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:76:11 | -LL | type A3 = extern "vectorcall" fn(); //~ ERROR vectorcall is experimental and subject to change +LL | type A3 = extern "vectorcall" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -385,7 +385,7 @@ LL | type A3 = extern "vectorcall" fn(); //~ ERROR vectorcall is experimental an error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:77:11 | -LL | type A4 = extern "rust-call" fn(); //~ ERROR rust-call ABI is subject to change +LL | type A4 = extern "rust-call" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -393,7 +393,7 @@ LL | type A4 = extern "rust-call" fn(); //~ ERROR rust-call ABI is subject to ch error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:78:11 | -LL | type A5 = extern "msp430-interrupt" fn(); //~ ERROR msp430-interrupt ABI is experimental +LL | type A5 = extern "msp430-interrupt" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -401,7 +401,7 @@ LL | type A5 = extern "msp430-interrupt" fn(); //~ ERROR msp430-interrupt ABI is error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:79:11 | -LL | type A6 = extern "ptx-kernel" fn (); //~ ERROR PTX ABIs are experimental and subject to change +LL | type A6 = extern "ptx-kernel" fn (); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -409,7 +409,7 @@ LL | type A6 = extern "ptx-kernel" fn (); //~ ERROR PTX ABIs are experimental an error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:80:11 | -LL | type A7 = extern "x86-interrupt" fn(); //~ ERROR x86-interrupt ABI is experimental +LL | type A7 = extern "x86-interrupt" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -417,7 +417,7 @@ LL | type A7 = extern "x86-interrupt" fn(); //~ ERROR x86-interrupt ABI is exper error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:81:11 | -LL | type A8 = extern "thiscall" fn(); //~ ERROR thiscall is experimental and subject to change +LL | type A8 = extern "thiscall" fn(); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -425,7 +425,7 @@ LL | type A8 = extern "thiscall" fn(); //~ ERROR thiscall is experimental and su error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:82:11 | -LL | type A9 = extern "amdgpu-kernel" fn(); //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | type A9 = extern "amdgpu-kernel" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable @@ -433,7 +433,7 @@ LL | type A9 = extern "amdgpu-kernel" fn(); //~ ERROR amdgpu-kernel ABI is exper error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:85:1 | -LL | extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -441,7 +441,7 @@ LL | extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:86:1 | -LL | extern "platform-intrinsic" {} //~ ERROR platform intrinsics are experimental +LL | extern "platform-intrinsic" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -449,7 +449,7 @@ LL | extern "platform-intrinsic" {} //~ ERROR platform intrinsics are experiment error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:87:1 | -LL | extern "vectorcall" {} //~ ERROR vectorcall is experimental and subject to change +LL | extern "vectorcall" {} | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -457,7 +457,7 @@ LL | extern "vectorcall" {} //~ ERROR vectorcall is experimental and subject to error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:88:1 | -LL | extern "rust-call" {} //~ ERROR rust-call ABI is subject to change +LL | extern "rust-call" {} | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -465,7 +465,7 @@ LL | extern "rust-call" {} //~ ERROR rust-call ABI is subject to change error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:89:1 | -LL | extern "msp430-interrupt" {} //~ ERROR msp430-interrupt ABI is experimental +LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -473,7 +473,7 @@ LL | extern "msp430-interrupt" {} //~ ERROR msp430-interrupt ABI is experimental error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:90:1 | -LL | extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental and subject to change +LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -481,7 +481,7 @@ LL | extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental and subject to c error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:91:1 | -LL | extern "x86-interrupt" {} //~ ERROR x86-interrupt ABI is experimental +LL | extern "x86-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -489,7 +489,7 @@ LL | extern "x86-interrupt" {} //~ ERROR x86-interrupt ABI is experimental error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:92:1 | -LL | extern "thiscall" {} //~ ERROR thiscall is experimental and subject to change +LL | extern "thiscall" {} | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -497,7 +497,7 @@ LL | extern "thiscall" {} //~ ERROR thiscall is experimental and subject to chan error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:93:1 | -LL | extern "amdgpu-kernel" {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | extern "amdgpu-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr b/src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr index 707b6bc75b17..fb32ebb18882 100644 --- a/src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr +++ b/src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr @@ -2,7 +2,7 @@ error[E0658]: unadjusted ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi_unadjusted.rs:1:1 | LL | / extern "unadjusted" fn foo() { -LL | | //~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable +LL | | LL | | } | |_^ | diff --git a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr index c20b21fa43d6..5e64ac50c3c4 100644 --- a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr +++ b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr @@ -1,7 +1,7 @@ error[E0658]: #[alloc_error_handler] is an unstable feature (see issue #51540) --> $DIR/feature-gate-alloc-error-handler.rs:8:1 | -LL | #[alloc_error_handler] //~ ERROR #[alloc_error_handler] is an unstable feature (see issue #51540) +LL | #[alloc_error_handler] | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(alloc_error_handler)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-allocator_internals.stderr b/src/test/ui/feature-gates/feature-gate-allocator_internals.stderr index 5103b7214f50..c41dca0ec471 100644 --- a/src/test/ui/feature-gates/feature-gate-allocator_internals.stderr +++ b/src/test/ui/feature-gates/feature-gate-allocator_internals.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[default_lib_allocator]` attribute is an experimental feature --> $DIR/feature-gate-allocator_internals.rs:1:1 | -LL | #![default_lib_allocator] //~ ERROR: attribute is an experimental feature +LL | #![default_lib_allocator] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(allocator_internals)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr index 1cadfb28214c..27324d703a8f 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr @@ -1,7 +1,7 @@ error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint --> $DIR/feature-gate-allow-internal-unsafe-nested-macro.rs:8:9 | -LL | #[allow_internal_unsafe] //~ ERROR allow_internal_unsafe side-steps +LL | #[allow_internal_unsafe] | ^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | bar!(); diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr index 802c74239d71..76afd217b816 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr @@ -1,7 +1,7 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks --> $DIR/feature-gate-allow-internal-unstable-nested-macro.rs:8:9 | -LL | #[allow_internal_unstable()] //~ ERROR allow_internal_unstable side-steps +LL | #[allow_internal_unstable()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | bar!(); diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr index d619f1e3239c..d512e56d0a84 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr @@ -1,7 +1,7 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks --> $DIR/feature-gate-allow-internal-unstable-struct.rs:4:1 | -LL | #[allow_internal_unstable()] //~ ERROR allow_internal_unstable side-steps +LL | #[allow_internal_unstable()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(allow_internal_unstable)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr index aa4f6648c4fb..baba7f4bfb5a 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr @@ -1,7 +1,7 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks --> $DIR/feature-gate-allow-internal-unstable.rs:3:1 | -LL | #[allow_internal_unstable()] //~ ERROR allow_internal_unstable side-steps +LL | #[allow_internal_unstable()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(allow_internal_unstable)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-allow_fail.stderr b/src/test/ui/feature-gates/feature-gate-allow_fail.stderr index 18c7ac9c3c92..5de1706dd4aa 100644 --- a/src/test/ui/feature-gates/feature-gate-allow_fail.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow_fail.stderr @@ -1,7 +1,7 @@ error[E0658]: allow_fail attribute is currently unstable (see issue #46488) --> $DIR/feature-gate-allow_fail.rs:3:1 | -LL | #[allow_fail] //~ ERROR allow_fail attribute is currently unstable +LL | #[allow_fail] | ^^^^^^^^^^^^^ | = help: add #![feature(allow_fail)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr index 8ec3c682850d..e1089bc345e8 100644 --- a/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr +++ b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr @@ -1,7 +1,7 @@ error[E0658]: `Ptr` cannot be used as the type of `self` without the `arbitrary_self_types` feature (see issue #44874) --> $DIR/feature-gate-arbitrary-self-types.rs:16:18 | -LL | fn foo(self: Ptr); //~ ERROR `Ptr` cannot be used as the type of `self` without +LL | fn foo(self: Ptr); | ^^^^^^^^^ | = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable @@ -10,7 +10,7 @@ LL | fn foo(self: Ptr); //~ ERROR `Ptr` cannot be used as the ty error[E0658]: `Ptr` cannot be used as the type of `self` without the `arbitrary_self_types` feature (see issue #44874) --> $DIR/feature-gate-arbitrary-self-types.rs:22:18 | -LL | fn foo(self: Ptr) {} //~ ERROR `Ptr` cannot be used as the type of `self` without +LL | fn foo(self: Ptr) {} | ^^^^^^^^^ | = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable @@ -19,7 +19,7 @@ LL | fn foo(self: Ptr) {} //~ ERROR `Ptr` cannot be used as the t error[E0658]: `std::boxed::Box>` cannot be used as the type of `self` without the `arbitrary_self_types` feature (see issue #44874) --> $DIR/feature-gate-arbitrary-self-types.rs:26:18 | -LL | fn bar(self: Box>) {} //~ ERROR `std::boxed::Box>` cannot be used as the +LL | fn bar(self: Box>) {} | ^^^^^^^^^^^^^^ | = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-asm.stderr b/src/test/ui/feature-gates/feature-gate-asm.stderr index eee38e12c2aa..6ad0ea673135 100644 --- a/src/test/ui/feature-gates/feature-gate-asm.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm.stderr @@ -1,7 +1,7 @@ error[E0658]: inline assembly is not stable enough for use and is subject to change (see issue #29722) --> $DIR/feature-gate-asm.rs:3:9 | -LL | asm!(""); //~ ERROR inline assembly is not stable enough +LL | asm!(""); | ^^^^^^^^^ | = help: add #![feature(asm)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-asm2.stderr b/src/test/ui/feature-gates/feature-gate-asm2.stderr index fc4aa57718ce..466f20281987 100644 --- a/src/test/ui/feature-gates/feature-gate-asm2.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm2.stderr @@ -1,7 +1,7 @@ error[E0658]: inline assembly is not stable enough for use and is subject to change (see issue #29722) --> $DIR/feature-gate-asm2.rs:5:26 | -LL | println!("{:?}", asm!("")); //~ ERROR inline assembly is not stable +LL | println!("{:?}", asm!("")); | ^^^^^^^^ | = help: add #![feature(asm)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr b/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr index a23962fe3189..fe206d3dfca4 100644 --- a/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr +++ b/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr @@ -1,7 +1,7 @@ error[E0658]: associated type defaults are unstable (see issue #29661) --> $DIR/feature-gate-assoc-type-defaults.rs:4:5 | -LL | type Bar = u8; //~ ERROR associated type defaults are unstable +LL | type Bar = u8; | ^^^^^^^^^^^^^^ | = help: add #![feature(associated_type_defaults)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr index 58051153e1f0..b67949b61555 100644 --- a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr +++ b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr @@ -1,25 +1,25 @@ error[E0670]: `async fn` is not permitted in the 2015 edition --> $DIR/feature-gate-async-await-2015-edition.rs:5:1 | -LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition +LL | async fn foo() {} | ^^^^^ error[E0422]: cannot find struct, variant or union type `async` in this scope --> $DIR/feature-gate-async-await-2015-edition.rs:9:13 | -LL | let _ = async {}; //~ ERROR cannot find struct, variant or union type `async` +LL | let _ = async {}; | ^^^^^ not found in this scope error[E0425]: cannot find value `async` in this scope --> $DIR/feature-gate-async-await-2015-edition.rs:10:13 | -LL | let _ = async || { true }; //~ ERROR cannot find value `async` in this scope +LL | let _ = async || { true }; | ^^^^^ not found in this scope error[E0658]: async fn is unstable (see issue #50547) --> $DIR/feature-gate-async-await-2015-edition.rs:5:1 | -LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition +LL | async fn foo() {} | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(async_await)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-async-await.stderr b/src/test/ui/feature-gates/feature-gate-async-await.stderr index 3a3165ba3e69..beec28765c8d 100644 --- a/src/test/ui/feature-gates/feature-gate-async-await.stderr +++ b/src/test/ui/feature-gates/feature-gate-async-await.stderr @@ -1,7 +1,7 @@ error[E0658]: async fn is unstable (see issue #50547) --> $DIR/feature-gate-async-await.rs:5:1 | -LL | async fn foo() {} //~ ERROR async fn is unstable +LL | async fn foo() {} | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(async_await)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | async fn foo() {} //~ ERROR async fn is unstable error[E0658]: async blocks are unstable (see issue #50547) --> $DIR/feature-gate-async-await.rs:8:13 | -LL | let _ = async {}; //~ ERROR async blocks are unstable +LL | let _ = async {}; | ^^^^^^^^ | = help: add #![feature(async_await)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | let _ = async {}; //~ ERROR async blocks are unstable error[E0658]: async closures are unstable (see issue #50547) --> $DIR/feature-gate-async-await.rs:9:13 | -LL | let _ = async || {}; //~ ERROR async closures are unstable +LL | let _ = async || {}; | ^^^^^^^^^^^ | = help: add #![feature(async_await)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-box-expr.stderr b/src/test/ui/feature-gates/feature-gate-box-expr.stderr index 9ebff2e044c9..7b202042878e 100644 --- a/src/test/ui/feature-gates/feature-gate-box-expr.stderr +++ b/src/test/ui/feature-gates/feature-gate-box-expr.stderr @@ -1,7 +1,7 @@ error[E0658]: box expression syntax is experimental; you can call `Box::new` instead. (see issue #49733) --> $DIR/feature-gate-box-expr.rs:12:13 | -LL | let x = box 'c'; //~ ERROR box expression syntax is experimental +LL | let x = box 'c'; | ^^^^^^^ | = help: add #![feature(box_syntax)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-box_patterns.stderr b/src/test/ui/feature-gates/feature-gate-box_patterns.stderr index 1379ba526f5d..39404aa39c85 100644 --- a/src/test/ui/feature-gates/feature-gate-box_patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-box_patterns.stderr @@ -1,7 +1,7 @@ error[E0658]: box pattern syntax is experimental (see issue #29641) --> $DIR/feature-gate-box_patterns.rs:2:9 | -LL | let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental +LL | let box x = Box::new('c'); | ^^^^^ | = help: add #![feature(box_patterns)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr b/src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr index 5bda76e2bfeb..278a184bae21 100644 --- a/src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr +++ b/src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate which contains compiler-rt intrinsics and will never be stable --> $DIR/feature-gate-compiler-builtins.rs:1:1 | -LL | #![compiler_builtins] //~ ERROR the `#[compiler_builtins]` attribute is +LL | #![compiler_builtins] | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(compiler_builtins)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-concat_idents.stderr b/src/test/ui/feature-gates/feature-gate-concat_idents.stderr index d465512527a6..3f4ce6d3b94a 100644 --- a/src/test/ui/feature-gates/feature-gate-concat_idents.stderr +++ b/src/test/ui/feature-gates/feature-gate-concat_idents.stderr @@ -1,7 +1,7 @@ error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) --> $DIR/feature-gate-concat_idents.rs:5:13 | -LL | let a = concat_idents!(X, Y_1); //~ ERROR `concat_idents` is not stable +LL | let a = concat_idents!(X, Y_1); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(concat_idents)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | let a = concat_idents!(X, Y_1); //~ ERROR `concat_idents` is not stable error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) --> $DIR/feature-gate-concat_idents.rs:6:13 | -LL | let b = concat_idents!(X, Y_2); //~ ERROR `concat_idents` is not stable +LL | let b = concat_idents!(X, Y_2); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(concat_idents)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr b/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr index cae409019f7a..105b3d5cff5c 100644 --- a/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr +++ b/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr @@ -1,7 +1,7 @@ error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) --> $DIR/feature-gate-concat_idents2.rs:4:5 | -LL | concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough +LL | concat_idents!(a, b); | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(concat_idents)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough error[E0425]: cannot find value `ab` in this scope --> $DIR/feature-gate-concat_idents2.rs:4:5 | -LL | concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough +LL | concat_idents!(a, b); | ^^^^^^^^^^^^^^^^^^^^^ not found in this scope error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-concat_idents3.stderr b/src/test/ui/feature-gates/feature-gate-concat_idents3.stderr index e9b9f240e8cd..9568b1d88019 100644 --- a/src/test/ui/feature-gates/feature-gate-concat_idents3.stderr +++ b/src/test/ui/feature-gates/feature-gate-concat_idents3.stderr @@ -1,7 +1,7 @@ error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) --> $DIR/feature-gate-concat_idents3.rs:7:20 | -LL | assert_eq!(10, concat_idents!(X, Y_1)); //~ ERROR `concat_idents` is not stable +LL | assert_eq!(10, concat_idents!(X, Y_1)); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(concat_idents)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | assert_eq!(10, concat_idents!(X, Y_1)); //~ ERROR `concat_idents` is no error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) --> $DIR/feature-gate-concat_idents3.rs:8:20 | -LL | assert_eq!(20, concat_idents!(X, Y_2)); //~ ERROR `concat_idents` is not stable +LL | assert_eq!(20, concat_idents!(X, Y_2)); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(concat_idents)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-const_fn.stderr b/src/test/ui/feature-gates/feature-gate-const_fn.stderr index be5237fbfcf3..7f88d30acc66 100644 --- a/src/test/ui/feature-gates/feature-gate-const_fn.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_fn.stderr @@ -1,25 +1,25 @@ error[E0379]: trait fns cannot be declared const --> $DIR/feature-gate-const_fn.rs:6:5 | -LL | const fn foo() -> u32; //~ ERROR const fn is unstable +LL | const fn foo() -> u32; | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const --> $DIR/feature-gate-const_fn.rs:8:5 | -LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable +LL | const fn bar() -> u32 { 0 } | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const --> $DIR/feature-gate-const_fn.rs:13:5 | -LL | const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const +LL | const fn foo() -> u32 { 0 } | ^^^^^ trait fns cannot be const error[E0658]: const fn is unstable (see issue #57563) --> $DIR/feature-gate-const_fn.rs:6:5 | -LL | const fn foo() -> u32; //~ ERROR const fn is unstable +LL | const fn foo() -> u32; | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -27,7 +27,7 @@ LL | const fn foo() -> u32; //~ ERROR const fn is unstable error[E0658]: const fn is unstable (see issue #57563) --> $DIR/feature-gate-const_fn.rs:8:5 | -LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable +LL | const fn bar() -> u32 { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-const_generics.stderr b/src/test/ui/feature-gates/feature-gate-const_generics.stderr index bd86a4197a76..dce400025353 100644 --- a/src/test/ui/feature-gates/feature-gate-const_generics.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_generics.stderr @@ -1,7 +1,7 @@ error[E0658]: const generics are unstable (see issue #44580) --> $DIR/feature-gate-const_generics.rs:1:14 | -LL | fn foo() {} //~ ERROR const generics are unstable +LL | fn foo() {} | ^ | = help: add #![feature(const_generics)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | fn foo() {} //~ ERROR const generics are unstable error[E0658]: const generics are unstable (see issue #44580) --> $DIR/feature-gate-const_generics.rs:3:18 | -LL | struct Foo([(); X]); //~ ERROR const generics are unstable +LL | struct Foo([(); X]); | ^ | = help: add #![feature(const_generics)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr b/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr index 2b28bbca6454..25b26de60ef7 100644 --- a/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr +++ b/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr @@ -1,7 +1,7 @@ error[E0658]: `crate` visibility modifier is experimental (see issue #53120) --> $DIR/feature-gate-crate_visibility_modifier.rs:1:1 | -LL | crate struct Bender { //~ ERROR `crate` visibility modifier is experimental +LL | crate struct Bender { | ^^^^^ | = help: add #![feature(crate_visibility_modifier)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr b/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr index 51fefcfaff72..8b79c752e457 100644 --- a/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr +++ b/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:7:3 | -LL | #[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:8:3 | -LL | #[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(100)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | #[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:9:3 | -LL | #[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(1, 2, 3)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | #[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:10:3 | -LL | #[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr("hello")] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | #[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:11:3 | -LL | #[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(name = "hello")] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -41,7 +41,7 @@ LL | #[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently u error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:12:3 | -LL | #[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(1, "hi", key = 12, true, false)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -49,7 +49,7 @@ LL | #[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:13:3 | -LL | #[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(key = "hello", val = 10)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -57,7 +57,7 @@ LL | #[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is cu error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:14:3 | -LL | #[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(key("hello"), val(10))] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -65,7 +65,7 @@ LL | #[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is curr error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:15:3 | -LL | #[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(enabled = true, disabled = false)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -73,7 +73,7 @@ LL | #[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_at error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:16:3 | -LL | #[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(true)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -81,7 +81,7 @@ LL | #[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:17:3 | -LL | #[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(pi = 3.14159)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -89,7 +89,7 @@ LL | #[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unk error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:18:3 | -LL | #[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(b"hi")] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -97,7 +97,7 @@ LL | #[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown error[E0658]: The attribute `fake_doc` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:19:3 | -LL | #[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown +LL | #[fake_doc(r"doc")] | ^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-custom_test_frameworks.stderr b/src/test/ui/feature-gates/feature-gate-custom_test_frameworks.stderr index 1aec87f06696..bac23b3a60d2 100644 --- a/src/test/ui/feature-gates/feature-gate-custom_test_frameworks.stderr +++ b/src/test/ui/feature-gates/feature-gate-custom_test_frameworks.stderr @@ -1,7 +1,7 @@ error[E0658]: custom test frameworks are an unstable feature (see issue #50297) --> $DIR/feature-gate-custom_test_frameworks.rs:1:1 | -LL | #![test_runner(main)] //~ ERROR custom test frameworks are an unstable feature +LL | #![test_runner(main)] | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(custom_test_frameworks)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-decl_macro.stderr b/src/test/ui/feature-gates/feature-gate-decl_macro.stderr index 01ec3d8b2e21..2d4b622843d3 100644 --- a/src/test/ui/feature-gates/feature-gate-decl_macro.stderr +++ b/src/test/ui/feature-gates/feature-gate-decl_macro.stderr @@ -1,7 +1,7 @@ error[E0658]: `macro` is experimental (see issue #39412) --> $DIR/feature-gate-decl_macro.rs:3:1 | -LL | macro m() {} //~ ERROR `macro` is experimental (see issue #39412) +LL | macro m() {} | ^^^^^^^^^^^^ | = help: add #![feature(decl_macro)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-doc_alias.stderr b/src/test/ui/feature-gates/feature-gate-doc_alias.stderr index 91845329534e..c585a96adf63 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_alias.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_alias.stderr @@ -1,7 +1,7 @@ error[E0658]: #[doc(alias = "...")] is experimental (see issue #50146) --> $DIR/feature-gate-doc_alias.rs:1:1 | -LL | #[doc(alias = "foo")] //~ ERROR: #[doc(alias = "...")] is experimental +LL | #[doc(alias = "foo")] | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(doc_alias)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr b/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr index 5bc56adb8adf..f018ff4a9d74 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr @@ -1,7 +1,7 @@ error[E0658]: `cfg(rustdoc)` is experimental and subject to change (see issue #43781) --> $DIR/feature-gate-doc_cfg-cfg-rustdoc.rs:1:7 | -LL | #[cfg(rustdoc)] //~ ERROR: `cfg(rustdoc)` is experimental and subject to change +LL | #[cfg(rustdoc)] | ^^^^^^^ | = help: add #![feature(doc_cfg)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-doc_cfg.stderr b/src/test/ui/feature-gates/feature-gate-doc_cfg.stderr index 20e3a4dbbca4..2a0aa4ff3c2e 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_cfg.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_cfg.stderr @@ -1,7 +1,7 @@ error[E0658]: #[doc(cfg(...))] is experimental (see issue #43781) --> $DIR/feature-gate-doc_cfg.rs:1:1 | -LL | #[doc(cfg(unix))] //~ ERROR: #[doc(cfg(...))] is experimental +LL | #[doc(cfg(unix))] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(doc_cfg)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr b/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr index 96f165d5a515..c2cc1dceda33 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr @@ -1,7 +1,7 @@ error[E0658]: #[doc(keyword = "...")] is experimental (see issue #51315) --> $DIR/feature-gate-doc_keyword.rs:1:1 | -LL | #[doc(keyword = "match")] //~ ERROR: #[doc(keyword = "...")] is experimental +LL | #[doc(keyword = "match")] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(doc_keyword)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-doc_masked.stderr b/src/test/ui/feature-gates/feature-gate-doc_masked.stderr index 044f21a98336..77d3a6f6fb31 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_masked.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_masked.stderr @@ -1,7 +1,7 @@ error[E0658]: #[doc(masked)] is experimental (see issue #44027) --> $DIR/feature-gate-doc_masked.rs:1:1 | -LL | #[doc(masked)] //~ ERROR: #[doc(masked)] is experimental +LL | #[doc(masked)] | ^^^^^^^^^^^^^^ | = help: add #![feature(doc_masked)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr b/src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr index c7101b436e26..60f5c0821881 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr @@ -1,7 +1,7 @@ error[E0658]: #[doc(spotlight)] is experimental (see issue #45040) --> $DIR/feature-gate-doc_spotlight.rs:1:1 | -LL | #[doc(spotlight)] //~ ERROR: #[doc(spotlight)] is experimental +LL | #[doc(spotlight)] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(doc_spotlight)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr index 2b43a480c6b9..afb402174fb1 100644 --- a/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr +++ b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr @@ -1,7 +1,7 @@ error[E0658]: exclusive range pattern syntax is experimental (see issue #37854) --> $DIR/feature-gate-exclusive-range-pattern.rs:3:9 | -LL | 0 .. 3 => {} //~ ERROR exclusive range pattern syntax is experimental +LL | 0 .. 3 => {} | ^^^^^^ | = help: add #![feature(exclusive_range_pattern)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr index cbe6d5677559..dd4ca1f67e33 100644 --- a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr @@ -1,7 +1,7 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered --> $DIR/feature-gate-exhaustive-patterns.rs:7:9 | -LL | let Ok(_x) = foo(); //~ ERROR refutable pattern in local binding +LL | let Ok(_x) = foo(); | ^^^^^^ pattern `Err(_)` not covered error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-existential-type.stderr b/src/test/ui/feature-gates/feature-gate-existential-type.stderr index e83d5cdbde1e..6b8b850b5cc0 100644 --- a/src/test/ui/feature-gates/feature-gate-existential-type.stderr +++ b/src/test/ui/feature-gates/feature-gate-existential-type.stderr @@ -1,7 +1,7 @@ error[E0658]: existential types are unstable (see issue #34511) --> $DIR/feature-gate-existential-type.rs:3:1 | -LL | existential type Foo: std::fmt::Debug; //~ ERROR existential types are unstable +LL | existential type Foo: std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(existential_type)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | existential type Foo: std::fmt::Debug; //~ ERROR existential types are unst error[E0658]: existential types are unstable (see issue #34511) --> $DIR/feature-gate-existential-type.rs:11:5 | -LL | existential type Baa: std::fmt::Debug; //~ ERROR existential types are unstable +LL | existential type Baa: std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(existential_type)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr index 1629547acb1c..e31d888f0078 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr +++ b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `core` --> $DIR/feature-gate-extern_absolute_paths.rs:1:5 | -LL | use core::default; //~ ERROR unresolved import `core` +LL | use core::default; | ^^^^ maybe a missing `extern crate core;`? error[E0433]: failed to resolve: maybe a missing `extern crate core;`? --> $DIR/feature-gate-extern_absolute_paths.rs:4:19 | -LL | let _: u8 = ::core::default::Default(); //~ ERROR failed to resolve +LL | let _: u8 = ::core::default::Default(); | ^^^^ maybe a missing `extern crate core;`? error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-extern_prelude.stderr b/src/test/ui/feature-gates/feature-gate-extern_prelude.stderr index 7a13f61a27ea..c15a8b33037f 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_prelude.stderr +++ b/src/test/ui/feature-gates/feature-gate-extern_prelude.stderr @@ -1,7 +1,7 @@ error: expected one of `!` or `::`, found `-` --> $DIR/feature-gate-extern_prelude.rs:1:4 | -LL | can-only-test-this-in-run-make-fulldeps //~ ERROR expected one of `!` or `::`, found `-` +LL | can-only-test-this-in-run-make-fulldeps | ^ expected one of `!` or `::` here error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-extern_types.stderr b/src/test/ui/feature-gates/feature-gate-extern_types.stderr index 70ba06cde45c..7035d85ec2a8 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_types.stderr +++ b/src/test/ui/feature-gates/feature-gate-extern_types.stderr @@ -1,7 +1,7 @@ error[E0658]: extern types are experimental (see issue #43467) --> $DIR/feature-gate-extern_types.rs:2:5 | -LL | type T; //~ ERROR extern types are experimental +LL | type T; | ^^^^^^^ | = help: add #![feature(extern_types)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-external_doc.stderr b/src/test/ui/feature-gates/feature-gate-external_doc.stderr index b5cb9f564a3b..16507bf596f1 100644 --- a/src/test/ui/feature-gates/feature-gate-external_doc.stderr +++ b/src/test/ui/feature-gates/feature-gate-external_doc.stderr @@ -1,7 +1,7 @@ error[E0658]: #[doc(include = "...")] is experimental (see issue #44732) --> $DIR/feature-gate-external_doc.rs:1:1 | -LL | #[doc(include="asdf.md")] //~ ERROR: #[doc(include = "...")] is experimental +LL | #[doc(include="asdf.md")] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(external_doc)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-feature-gate.stderr b/src/test/ui/feature-gates/feature-gate-feature-gate.stderr index aee4f7ba47db..d79404263e45 100644 --- a/src/test/ui/feature-gates/feature-gate-feature-gate.stderr +++ b/src/test/ui/feature-gates/feature-gate-feature-gate.stderr @@ -1,7 +1,7 @@ error: unstable feature --> $DIR/feature-gate-feature-gate.rs:2:12 | -LL | #![feature(intrinsics)] //~ ERROR unstable feature +LL | #![feature(intrinsics)] | ^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/feature-gates/feature-gate-ffi_returns_twice.stderr b/src/test/ui/feature-gates/feature-gate-ffi_returns_twice.stderr index 5c111fe78f48..f85ce8eeeace 100644 --- a/src/test/ui/feature-gates/feature-gate-ffi_returns_twice.stderr +++ b/src/test/ui/feature-gates/feature-gate-ffi_returns_twice.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[ffi_returns_twice]` attribute is an experimental feature (see issue #58314) --> $DIR/feature-gate-ffi_returns_twice.rs:5:5 | -LL | #[ffi_returns_twice] //~ ERROR the `#[ffi_returns_twice]` attribute is an experimental feature (see issue #58314) +LL | #[ffi_returns_twice] | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(ffi_returns_twice)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-format_args_nl.stderr b/src/test/ui/feature-gates/feature-gate-format_args_nl.stderr index 135ec5eb0c09..58d2c790ffe8 100644 --- a/src/test/ui/feature-gates/feature-gate-format_args_nl.stderr +++ b/src/test/ui/feature-gates/feature-gate-format_args_nl.stderr @@ -1,7 +1,7 @@ error[E0658]: `format_args_nl` is only for internal language use and is subject to change --> $DIR/feature-gate-format_args_nl.rs:2:5 | -LL | format_args_nl!(""); //~ ERROR `format_args_nl` is only for internal language use +LL | format_args_nl!(""); | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(format_args_nl)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-fundamental.stderr b/src/test/ui/feature-gates/feature-gate-fundamental.stderr index 47cf241cc3f9..9faf2a88a6b1 100644 --- a/src/test/ui/feature-gates/feature-gate-fundamental.stderr +++ b/src/test/ui/feature-gates/feature-gate-fundamental.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[fundamental]` attribute is an experimental feature (see issue #29635) --> $DIR/feature-gate-fundamental.rs:1:1 | -LL | #[fundamental] //~ ERROR the `#[fundamental]` attribute is an experimental feature +LL | #[fundamental] | ^^^^^^^^^^^^^^ | = help: add #![feature(fundamental)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-generators.stderr b/src/test/ui/feature-gates/feature-gate-generators.stderr index aea1e00d698a..554eeae8deca 100644 --- a/src/test/ui/feature-gates/feature-gate-generators.stderr +++ b/src/test/ui/feature-gates/feature-gate-generators.stderr @@ -1,7 +1,7 @@ error[E0658]: yield syntax is experimental (see issue #43122) --> $DIR/feature-gate-generators.rs:2:5 | -LL | yield true; //~ ERROR yield syntax is experimental +LL | yield true; | ^^^^^^^^^^ | = help: add #![feature(generators)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | yield true; //~ ERROR yield syntax is experimental error[E0627]: yield statement outside of generator literal --> $DIR/feature-gate-generators.rs:2:5 | -LL | yield true; //~ ERROR yield syntax is experimental +LL | yield true; | ^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-global_asm.stderr b/src/test/ui/feature-gates/feature-gate-global_asm.stderr index b698777f6234..fb9b47bd49c0 100644 --- a/src/test/ui/feature-gates/feature-gate-global_asm.stderr +++ b/src/test/ui/feature-gates/feature-gate-global_asm.stderr @@ -1,7 +1,7 @@ error[E0658]: `global_asm!` is not stable enough for use and is subject to change (see issue #35119) --> $DIR/feature-gate-global_asm.rs:1:1 | -LL | global_asm!(""); //~ ERROR `global_asm!` is not stable +LL | global_asm!(""); | ^^^^^^^^^^^^^^^^ | = help: add #![feature(global_asm)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr index 9f60a047cb47..689a3757343b 100644 --- a/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr +++ b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr @@ -3,13 +3,13 @@ error[E0310]: the parameter type `U` may not live long enough | LL | struct Foo { | - help: consider adding an explicit lifetime bound `U: 'static`... -LL | bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] +LL | bar: Bar | ^^^^^^^^^^^ | note: ...so that the type `U` will meet its required lifetime bounds --> $DIR/feature-gate-infer_static_outlives_requirements.rs:5:5 | -LL | bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] +LL | bar: Bar | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-intrinsics.stderr b/src/test/ui/feature-gates/feature-gate-intrinsics.stderr index 092cb98a2f96..5b032c6f1ea3 100644 --- a/src/test/ui/feature-gates/feature-gate-intrinsics.stderr +++ b/src/test/ui/feature-gates/feature-gate-intrinsics.stderr @@ -1,8 +1,8 @@ error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-intrinsics.rs:1:1 | -LL | / extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change -LL | | fn bar(); //~ ERROR unrecognized intrinsic function: `bar` +LL | / extern "rust-intrinsic" { +LL | | fn bar(); LL | | } | |_^ | @@ -11,7 +11,7 @@ LL | | } error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-intrinsics.rs:5:1 | -LL | extern "rust-intrinsic" fn baz() {} //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" fn baz() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -19,7 +19,7 @@ LL | extern "rust-intrinsic" fn baz() {} //~ ERROR intrinsics are subject to cha error[E0093]: unrecognized intrinsic function: `bar` --> $DIR/feature-gate-intrinsics.rs:2:5 | -LL | fn bar(); //~ ERROR unrecognized intrinsic function: `bar` +LL | fn bar(); | ^^^^^^^^^ unrecognized intrinsic error: aborting due to 3 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-label_break_value.stderr b/src/test/ui/feature-gates/feature-gate-label_break_value.stderr index 347b8a9710ee..b23db3c216d0 100644 --- a/src/test/ui/feature-gates/feature-gate-label_break_value.stderr +++ b/src/test/ui/feature-gates/feature-gate-label_break_value.stderr @@ -1,7 +1,7 @@ error[E0658]: labels on blocks are unstable (see issue #48594) --> $DIR/feature-gate-label_break_value.rs:2:5 | -LL | 'a: { //~ ERROR labels on blocks are unstable +LL | 'a: { | ^^ | = help: add #![feature(label_break_value)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-lang-items.stderr b/src/test/ui/feature-gates/feature-gate-lang-items.stderr index ccbb711fe6d4..f4c238d9f3ff 100644 --- a/src/test/ui/feature-gates/feature-gate-lang-items.stderr +++ b/src/test/ui/feature-gates/feature-gate-lang-items.stderr @@ -1,7 +1,7 @@ error[E0658]: language items are subject to change --> $DIR/feature-gate-lang-items.rs:1:1 | -LL | #[lang = "foo"] //~ ERROR language items are subject to change +LL | #[lang = "foo"] | ^^^^^^^^^^^^^^^ | = help: add #![feature(lang_items)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[lang = "foo"] //~ ERROR language items are subject to change error[E0522]: definition of an unknown language item: `foo` --> $DIR/feature-gate-lang-items.rs:1:1 | -LL | #[lang = "foo"] //~ ERROR language items are subject to change +LL | #[lang = "foo"] | ^^^^^^^^^^^^^^^ definition of unknown language item `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-log_syntax.stderr b/src/test/ui/feature-gates/feature-gate-log_syntax.stderr index 33d1f07aa362..f29ee0b5a78c 100644 --- a/src/test/ui/feature-gates/feature-gate-log_syntax.stderr +++ b/src/test/ui/feature-gates/feature-gate-log_syntax.stderr @@ -1,7 +1,7 @@ error[E0658]: `log_syntax!` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/feature-gate-log_syntax.rs:2:5 | -LL | log_syntax!() //~ ERROR `log_syntax!` is not stable enough +LL | log_syntax!() | ^^^^^^^^^^^^^ | = help: add #![feature(log_syntax)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-log_syntax2.stderr b/src/test/ui/feature-gates/feature-gate-log_syntax2.stderr index bdcd922c6e1e..c5a9b493728c 100644 --- a/src/test/ui/feature-gates/feature-gate-log_syntax2.stderr +++ b/src/test/ui/feature-gates/feature-gate-log_syntax2.stderr @@ -1,7 +1,7 @@ error[E0658]: `log_syntax!` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/feature-gate-log_syntax2.rs:4:22 | -LL | println!("{:?}", log_syntax!()); //~ ERROR `log_syntax!` is not stable +LL | println!("{:?}", log_syntax!()); | ^^^^^^^^^^^^^ | = help: add #![feature(log_syntax)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-main.stderr b/src/test/ui/feature-gates/feature-gate-main.stderr index c92887eded64..870cf1aa2868 100644 --- a/src/test/ui/feature-gates/feature-gate-main.stderr +++ b/src/test/ui/feature-gates/feature-gate-main.stderr @@ -1,7 +1,7 @@ error[E0658]: declaration of a nonstandard #[main] function may change over time, for now a top-level `fn main()` is required (see issue #29634) --> $DIR/feature-gate-main.rs:2:1 | -LL | fn foo() {} //~ ERROR: declaration of a nonstandard #[main] function may change over time +LL | fn foo() {} | ^^^^^^^^^^^ | = help: add #![feature(main)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr b/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr index 056e33111f0d..f6666b40f3e6 100644 --- a/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr +++ b/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr @@ -1,25 +1,25 @@ error[E0379]: trait fns cannot be declared const --> $DIR/feature-gate-min_const_fn.rs:6:5 | -LL | const fn foo() -> u32; //~ ERROR const fn is unstable +LL | const fn foo() -> u32; | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const --> $DIR/feature-gate-min_const_fn.rs:8:5 | -LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable +LL | const fn bar() -> u32 { 0 } | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const --> $DIR/feature-gate-min_const_fn.rs:13:5 | -LL | const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const +LL | const fn foo() -> u32 { 0 } | ^^^^^ trait fns cannot be const error[E0658]: const fn is unstable (see issue #57563) --> $DIR/feature-gate-min_const_fn.rs:6:5 | -LL | const fn foo() -> u32; //~ ERROR const fn is unstable +LL | const fn foo() -> u32; | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -27,7 +27,7 @@ LL | const fn foo() -> u32; //~ ERROR const fn is unstable error[E0658]: const fn is unstable (see issue #57563) --> $DIR/feature-gate-min_const_fn.rs:8:5 | -LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable +LL | const fn bar() -> u32 { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-needs-allocator.stderr b/src/test/ui/feature-gates/feature-gate-needs-allocator.stderr index 8897f393dbd5..012664e9b6bf 100644 --- a/src/test/ui/feature-gates/feature-gate-needs-allocator.stderr +++ b/src/test/ui/feature-gates/feature-gate-needs-allocator.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[needs_allocator]` attribute is an experimental feature --> $DIR/feature-gate-needs-allocator.rs:1:1 | -LL | #![needs_allocator] //~ ERROR the `#[needs_allocator]` attribute is +LL | #![needs_allocator] | ^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(allocator_internals)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-never_type.stderr b/src/test/ui/feature-gates/feature-gate-never_type.stderr index c4f8771171e8..13166db213e2 100644 --- a/src/test/ui/feature-gates/feature-gate-never_type.stderr +++ b/src/test/ui/feature-gates/feature-gate-never_type.stderr @@ -1,7 +1,7 @@ error[E0658]: The `!` type is experimental (see issue #35121) --> $DIR/feature-gate-never_type.rs:7:17 | -LL | type Ma = (u32, !, i32); //~ ERROR type is experimental +LL | type Ma = (u32, !, i32); | ^ | = help: add #![feature(never_type)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | type Ma = (u32, !, i32); //~ ERROR type is experimental error[E0658]: The `!` type is experimental (see issue #35121) --> $DIR/feature-gate-never_type.rs:8:20 | -LL | type Meeshka = Vec; //~ ERROR type is experimental +LL | type Meeshka = Vec; | ^ | = help: add #![feature(never_type)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | type Meeshka = Vec; //~ ERROR type is experimental error[E0658]: The `!` type is experimental (see issue #35121) --> $DIR/feature-gate-never_type.rs:9:24 | -LL | type Mow = &'static fn(!) -> !; //~ ERROR type is experimental +LL | type Mow = &'static fn(!) -> !; | ^ | = help: add #![feature(never_type)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | type Mow = &'static fn(!) -> !; //~ ERROR type is experimental error[E0658]: The `!` type is experimental (see issue #35121) --> $DIR/feature-gate-never_type.rs:10:27 | -LL | type Skwoz = &'static mut !; //~ ERROR type is experimental +LL | type Skwoz = &'static mut !; | ^ | = help: add #![feature(never_type)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | type Skwoz = &'static mut !; //~ ERROR type is experimental error[E0658]: The `!` type is experimental (see issue #35121) --> $DIR/feature-gate-never_type.rs:13:16 | -LL | type Wub = !; //~ ERROR type is experimental +LL | type Wub = !; | ^ | = help: add #![feature(never_type)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-nll.stderr b/src/test/ui/feature-gates/feature-gate-nll.stderr index f7b431d19be7..cc004e3a1da0 100644 --- a/src/test/ui/feature-gates/feature-gate-nll.stderr +++ b/src/test/ui/feature-gates/feature-gate-nll.stderr @@ -3,7 +3,7 @@ error[E0506]: cannot assign to `x` because it is borrowed | LL | let p = &x; | - borrow of `x` occurs here -LL | x = 22; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 22; | ^^^^^^ assignment to borrowed `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr b/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr index 9299ac739ce3..1f8f114d7da5 100644 --- a/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr +++ b/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr @@ -1,7 +1,7 @@ error: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand. See https://github.com/rust-lang/rust/issues/29721 --> $DIR/feature-gate-no-debug-2.rs:4:1 | -LL | #[no_debug] //~ ERROR use of deprecated attribute `no_debug` +LL | #[no_debug] | ^^^^^^^^^^^ help: remove this attribute | note: lint level defined here diff --git a/src/test/ui/feature-gates/feature-gate-no-debug.stderr b/src/test/ui/feature-gates/feature-gate-no-debug.stderr index bdb732af7d2e..1ee2ec3c8818 100644 --- a/src/test/ui/feature-gates/feature-gate-no-debug.stderr +++ b/src/test/ui/feature-gates/feature-gate-no-debug.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand (see issue #29721) --> $DIR/feature-gate-no-debug.rs:3:1 | -LL | #[no_debug] //~ ERROR the `#[no_debug]` attribute was +LL | #[no_debug] | ^^^^^^^^^^^ | = help: add #![feature(no_debug)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-no_core.stderr b/src/test/ui/feature-gates/feature-gate-no_core.stderr index 7390051b95da..279f2198a808 100644 --- a/src/test/ui/feature-gates/feature-gate-no_core.stderr +++ b/src/test/ui/feature-gates/feature-gate-no_core.stderr @@ -1,7 +1,7 @@ error[E0658]: no_core is experimental (see issue #29639) --> $DIR/feature-gate-no_core.rs:3:1 | -LL | #![no_core] //~ ERROR no_core is experimental +LL | #![no_core] | ^^^^^^^^^^^ | = help: add #![feature(no_core)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr b/src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr index 5c441189ea7c..5e4c4649d012 100644 --- a/src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr +++ b/src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr @@ -1,7 +1,7 @@ error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:1:22 | -LL | extern crate core as bäz; //~ ERROR non-ascii idents +LL | extern crate core as bäz; | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | extern crate core as bäz; //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:3:5 | -LL | use föö::bar; //~ ERROR non-ascii idents +LL | use föö::bar; | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | use föö::bar; //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:5:5 | -LL | mod föö { //~ ERROR non-ascii idents +LL | mod föö { | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | mod föö { //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:9:4 | -LL | fn bär( //~ ERROR non-ascii idents +LL | fn bär( | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | fn bär( //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:10:5 | -LL | bäz: isize //~ ERROR non-ascii idents +LL | bäz: isize | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -41,7 +41,7 @@ LL | bäz: isize //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:12:9 | -LL | let _ö: isize; //~ ERROR non-ascii idents +LL | let _ö: isize; | ^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -49,7 +49,7 @@ LL | let _ö: isize; //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:15:10 | -LL | (_ä, _) => {} //~ ERROR non-ascii idents +LL | (_ä, _) => {} | ^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -57,7 +57,7 @@ LL | (_ä, _) => {} //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:19:8 | -LL | struct Föö { //~ ERROR non-ascii idents +LL | struct Föö { | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -65,7 +65,7 @@ LL | struct Föö { //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:20:5 | -LL | föö: isize //~ ERROR non-ascii idents +LL | föö: isize | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -73,7 +73,7 @@ LL | föö: isize //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:23:6 | -LL | enum Bär { //~ ERROR non-ascii idents +LL | enum Bär { | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -81,7 +81,7 @@ LL | enum Bär { //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:24:5 | -LL | Bäz { //~ ERROR non-ascii idents +LL | Bäz { | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -89,7 +89,7 @@ LL | Bäz { //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:25:9 | -LL | qüx: isize //~ ERROR non-ascii idents +LL | qüx: isize | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -97,7 +97,7 @@ LL | qüx: isize //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:30:8 | -LL | fn qüx(); //~ ERROR non-ascii idents +LL | fn qüx(); | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr b/src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr index 9b45e19c3a3c..524f77902f68 100644 --- a/src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr +++ b/src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr @@ -1,7 +1,7 @@ error[E0658]: non exhaustive is an experimental feature (see issue #44109) --> $DIR/feature-gate-non_exhaustive.rs:3:1 | -LL | #[non_exhaustive] //~ERROR non exhaustive is an experimental feature (see issue #44109) +LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(non_exhaustive)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr b/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr index de1f03cc170b..683424899a2d 100644 --- a/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr +++ b/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite --> $DIR/feature-gate-omit-gdb-pretty-printer-section.rs:1:1 | -LL | #[omit_gdb_pretty_printer_section] //~ ERROR the `#[omit_gdb_pretty_printer_section]` attribute is +LL | #[omit_gdb_pretty_printer_section] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(omit_gdb_pretty_printer_section)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr index fd1e5392e69e..12b796d2e60a 100644 --- a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr +++ b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/feature-gate-precise_pointer_size_matching.rs:6:11 | -LL | match 0usize { //~ERROR non-exhaustive patterns: `_` not covered +LL | match 0usize { | ^^^^^^ pattern `_` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -9,7 +9,7 @@ LL | match 0usize { //~ERROR non-exhaustive patterns: `_` not covered error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11 | -LL | match 0isize { //~ERROR non-exhaustive patterns: `_` not covered +LL | match 0isize { | ^^^^^^ pattern `_` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/feature-gates/feature-gate-prelude_import.stderr b/src/test/ui/feature-gates/feature-gate-prelude_import.stderr index c0016d24f35e..7501954f904e 100644 --- a/src/test/ui/feature-gates/feature-gate-prelude_import.stderr +++ b/src/test/ui/feature-gates/feature-gate-prelude_import.stderr @@ -1,7 +1,7 @@ error[E0658]: `#[prelude_import]` is for use by rustc only --> $DIR/feature-gate-prelude_import.rs:1:1 | -LL | #[prelude_import] //~ ERROR `#[prelude_import]` is for use by rustc only +LL | #[prelude_import] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(prelude_import)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr b/src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr index 2d6ef277572b..1f335401f996 100644 --- a/src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr +++ b/src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate which contains the profiler runtime and will never be stable --> $DIR/feature-gate-profiler-runtime.rs:1:1 | -LL | #![profiler_runtime] //~ ERROR the `#[profiler_runtime]` attribute is +LL | #![profiler_runtime] | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(profiler_runtime)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-repr-simd.stderr b/src/test/ui/feature-gates/feature-gate-repr-simd.stderr index 20cdbceeb689..c47ce70eaae7 100644 --- a/src/test/ui/feature-gates/feature-gate-repr-simd.stderr +++ b/src/test/ui/feature-gates/feature-gate-repr-simd.stderr @@ -1,7 +1,7 @@ error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-repr-simd.rs:1:1 | -LL | #[repr(simd)] //~ error: SIMD types are experimental +LL | #[repr(simd)] | ^^^^^^^^^^^^^ | = help: add #![feature(repr_simd)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[repr(simd)] //~ error: SIMD types are experimental error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-repr-simd.rs:5:1 | -LL | #[repr(simd)] //~ error: SIMD types are experimental +LL | #[repr(simd)] | ^^^^^^^^^^^^^ | = help: add #![feature(repr_simd)] to the crate attributes to enable @@ -17,9 +17,9 @@ LL | #[repr(simd)] //~ error: SIMD types are experimental warning[E0566]: conflicting representation hints --> $DIR/feature-gate-repr-simd.rs:4:8 | -LL | #[repr(C)] //~ warn: conflicting representation hints +LL | #[repr(C)] | ^ -LL | #[repr(simd)] //~ error: SIMD types are experimental +LL | #[repr(simd)] | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-repr128.stderr b/src/test/ui/feature-gates/feature-gate-repr128.stderr index ddd11f6daab9..a2fd65935992 100644 --- a/src/test/ui/feature-gates/feature-gate-repr128.stderr +++ b/src/test/ui/feature-gates/feature-gate-repr128.stderr @@ -1,7 +1,7 @@ error[E0658]: repr with 128-bit type is unstable (see issue #35118) --> $DIR/feature-gate-repr128.rs:2:1 | -LL | / enum A { //~ ERROR repr with 128-bit type is unstable +LL | / enum A { LL | | A(u64) LL | | } | |_^ diff --git a/src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr b/src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr index 6def25f96511..ae4066ceb801 100644 --- a/src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr +++ b/src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr @@ -1,7 +1,7 @@ error[E0658]: `#[repr(align(x))]` on enums is experimental (see issue #57996) --> $DIR/feature-gate-repr_align_enum.rs:4:1 | -LL | #[repr(align(8))] //~ ERROR `#[repr(align(x))]` on enums is experimental (see issue #57996) +LL | #[repr(align(8))] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(repr_align_enum)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr b/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr index 2b90699384b4..73cd28fe7498 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr +++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable (see issue #29642) --> $DIR/feature-gate-rustc-attrs-1.rs:5:1 | -LL | #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable +LL | #[rustc_variance] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(rustc_attrs)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used error[E0658]: the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable (see issue #29642) --> $DIR/feature-gate-rustc-attrs-1.rs:6:1 | -LL | #[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable +LL | #[rustc_error] | ^^^^^^^^^^^^^^ | = help: add #![feature(rustc_attrs)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr index 52d9b8db2fbe..8f584c333ac7 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr +++ b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[rustc_const_unstable]` attribute is an internal feature --> $DIR/feature-gate-rustc_const_unstable.rs:8:1 | -LL | #[rustc_const_unstable(feature="fzzzzzt")] //~ERROR internal feature +LL | #[rustc_const_unstable(feature="fzzzzzt")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(rustc_const_unstable)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr b/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr index 37e9b35c0ba7..71d9890cb2c3 100644 --- a/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr +++ b/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[sanitizer_runtime]` attribute is used to identify crates that contain the runtime of a sanitizer and will never be stable --> $DIR/feature-gate-sanitizer-runtime.rs:1:1 | -LL | #![sanitizer_runtime] //~ ERROR the `#[sanitizer_runtime]` attribute is +LL | #![sanitizer_runtime] | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(sanitizer_runtime)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-simd-ffi.stderr b/src/test/ui/feature-gates/feature-gate-simd-ffi.stderr index 01005138a607..11e095fef3da 100644 --- a/src/test/ui/feature-gates/feature-gate-simd-ffi.stderr +++ b/src/test/ui/feature-gates/feature-gate-simd-ffi.stderr @@ -1,7 +1,7 @@ error: use of SIMD type `LocalSimd` in FFI is highly experimental and may result in invalid code --> $DIR/feature-gate-simd-ffi.rs:9:17 | -LL | fn baz() -> LocalSimd; //~ ERROR use of SIMD type +LL | fn baz() -> LocalSimd; | ^^^^^^^^^ | = help: add #![feature(simd_ffi)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | fn baz() -> LocalSimd; //~ ERROR use of SIMD type error: use of SIMD type `LocalSimd` in FFI is highly experimental and may result in invalid code --> $DIR/feature-gate-simd-ffi.rs:10:15 | -LL | fn qux(x: LocalSimd); //~ ERROR use of SIMD type +LL | fn qux(x: LocalSimd); | ^^^^^^^^^ | = help: add #![feature(simd_ffi)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-simd.stderr b/src/test/ui/feature-gates/feature-gate-simd.stderr index ad5ffa5e7852..b37f138fbb5e 100644 --- a/src/test/ui/feature-gates/feature-gate-simd.stderr +++ b/src/test/ui/feature-gates/feature-gate-simd.stderr @@ -1,7 +1,7 @@ error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-simd.rs:3:1 | -LL | #[repr(simd)] //~ ERROR SIMD types are experimental +LL | #[repr(simd)] | ^^^^^^^^^^^^^ | = help: add #![feature(repr_simd)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr b/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr index 65dec6e10990..58eb57516eb0 100644 --- a/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr @@ -1,7 +1,7 @@ error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) --> $DIR/feature-gate-slice-patterns.rs:6:16 | -LL | [1, 2, ..] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized +LL | [1, 2, ..] => {} | ^^ | = help: add #![feature(slice_patterns)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | [1, 2, ..] => {} //~ ERROR syntax for subslices in slice patterns i error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) --> $DIR/feature-gate-slice-patterns.rs:7:13 | -LL | [1, .., 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized +LL | [1, .., 5] => {} | ^^ | = help: add #![feature(slice_patterns)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | [1, .., 5] => {} //~ ERROR syntax for subslices in slice patterns i error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) --> $DIR/feature-gate-slice-patterns.rs:8:10 | -LL | [.., 4, 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized +LL | [.., 4, 5] => {} | ^^ | = help: add #![feature(slice_patterns)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | [.., 4, 5] => {} //~ ERROR syntax for subslices in slice patterns i error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) --> $DIR/feature-gate-slice-patterns.rs:13:11 | -LL | [ xs.., 4, 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized +LL | [ xs.., 4, 5 ] => {} | ^^ | = help: add #![feature(slice_patterns)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | [ xs.., 4, 5 ] => {} //~ ERROR syntax for subslices in slice patter error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) --> $DIR/feature-gate-slice-patterns.rs:14:14 | -LL | [ 1, xs.., 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized +LL | [ 1, xs.., 5 ] => {} | ^^ | = help: add #![feature(slice_patterns)] to the crate attributes to enable @@ -41,7 +41,7 @@ LL | [ 1, xs.., 5 ] => {} //~ ERROR syntax for subslices in slice patter error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) --> $DIR/feature-gate-slice-patterns.rs:15:17 | -LL | [ 1, 2, xs.. ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized +LL | [ 1, 2, xs.. ] => {} | ^^ | = help: add #![feature(slice_patterns)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-thread_local.stderr b/src/test/ui/feature-gates/feature-gate-thread_local.stderr index dc7d67a20537..38064a6bc94b 100644 --- a/src/test/ui/feature-gates/feature-gate-thread_local.stderr +++ b/src/test/ui/feature-gates/feature-gate-thread_local.stderr @@ -1,7 +1,7 @@ error[E0658]: `#[thread_local]` is an experimental feature, and does not currently handle destructors. (see issue #29594) --> $DIR/feature-gate-thread_local.rs:8:1 | -LL | #[thread_local] //~ ERROR `#[thread_local]` is an experimental feature +LL | #[thread_local] | ^^^^^^^^^^^^^^^ | = help: add #![feature(thread_local)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-trace_macros.stderr b/src/test/ui/feature-gates/feature-gate-trace_macros.stderr index 9f4b01e45b6a..ee22bd25091a 100644 --- a/src/test/ui/feature-gates/feature-gate-trace_macros.stderr +++ b/src/test/ui/feature-gates/feature-gate-trace_macros.stderr @@ -1,7 +1,7 @@ error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/feature-gate-trace_macros.rs:2:5 | -LL | trace_macros!(true); //~ ERROR: `trace_macros` is not stable +LL | trace_macros!(true); | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(trace_macros)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr index 1f35efa59b69..b04a6e4d671b 100644 --- a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:10:1 | -LL | enum E where i32: Foo { V } //~ ERROR +LL | enum E where i32: Foo { V } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 @@ -10,7 +10,7 @@ LL | enum E where i32: Foo { V } //~ ERROR error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:12:1 | -LL | struct S where i32: Foo; //~ ERROR +LL | struct S where i32: Foo; | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 @@ -19,7 +19,7 @@ LL | struct S where i32: Foo; //~ ERROR error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:14:1 | -LL | trait T where i32: Foo {} //~ ERROR +LL | trait T where i32: Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 @@ -28,7 +28,7 @@ LL | trait T where i32: Foo {} //~ ERROR error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:16:1 | -LL | union U where i32: Foo { f: i32 } //~ ERROR +LL | union U where i32: Foo { f: i32 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 @@ -37,7 +37,7 @@ LL | union U where i32: Foo { f: i32 } //~ ERROR error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:20:1 | -LL | / impl Foo for () where i32: Foo { //~ ERROR +LL | / impl Foo for () where i32: Foo { LL | | fn test(&self) { LL | | 3i32.test(); LL | | Foo::test(&4i32); @@ -52,7 +52,7 @@ LL | | } error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:28:1 | -LL | / fn f() where i32: Foo //~ ERROR +LL | / fn f() where i32: Foo LL | | { LL | | let s = S; LL | | 3i32.test(); @@ -67,7 +67,7 @@ LL | | } error[E0277]: the trait bound `std::string::String: std::ops::Neg` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:36:1 | -LL | / fn use_op(s: String) -> String where String: ::std::ops::Neg { //~ ERROR +LL | / fn use_op(s: String) -> String where String: ::std::ops::Neg { LL | | -s LL | | } | |_^ the trait `std::ops::Neg` is not implemented for `std::string::String` @@ -78,7 +78,7 @@ LL | | } error[E0277]: `i32` is not an iterator --> $DIR/feature-gate-trivial_bounds.rs:40:1 | -LL | / fn use_for() where i32: Iterator { //~ ERROR +LL | / fn use_for() where i32: Iterator { LL | | for _ in 2i32 {} LL | | } | |_^ `i32` is not an iterator @@ -91,7 +91,7 @@ LL | | } error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:52:1 | -LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR +LL | struct TwoStrs(str, str) where str: Sized; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` @@ -102,7 +102,7 @@ LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:55:1 | -LL | / fn unsized_local() where Dst: Sized { //~ ERROR +LL | / fn unsized_local() where Dst: Sized { LL | | let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); LL | | } | |_^ doesn't have a size known at compile-time @@ -116,7 +116,7 @@ LL | | } error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:59:1 | -LL | / fn return_str() -> str where str: Sized { //~ ERROR +LL | / fn return_str() -> str where str: Sized { LL | | *"Sized".to_string().into_boxed_str() LL | | } | |_^ doesn't have a size known at compile-time diff --git a/src/test/ui/feature-gates/feature-gate-try_blocks.stderr b/src/test/ui/feature-gates/feature-gate-try_blocks.stderr index 209a445194da..74ad0e70c961 100644 --- a/src/test/ui/feature-gates/feature-gate-try_blocks.stderr +++ b/src/test/ui/feature-gates/feature-gate-try_blocks.stderr @@ -1,7 +1,7 @@ error[E0658]: `try` expression is experimental (see issue #31436) --> $DIR/feature-gate-try_blocks.rs:4:33 | -LL | let try_result: Option<_> = try { //~ ERROR `try` expression is experimental +LL | let try_result: Option<_> = try { | _________________________________^ LL | | let x = 5; LL | | x diff --git a/src/test/ui/feature-gates/feature-gate-try_reserve.stderr b/src/test/ui/feature-gates/feature-gate-try_reserve.stderr index 4ced5037f38b..61a3249c2ab9 100644 --- a/src/test/ui/feature-gates/feature-gate-try_reserve.stderr +++ b/src/test/ui/feature-gates/feature-gate-try_reserve.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'try_reserve': new API (see issue #48043) --> $DIR/feature-gate-try_reserve.rs:3:7 | -LL | v.try_reserve(10); //~ ERROR: use of unstable library feature 'try_reserve' +LL | v.try_reserve(10); | ^^^^^^^^^^^ | = help: add #![feature(try_reserve)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-type_ascription.stderr b/src/test/ui/feature-gates/feature-gate-type_ascription.stderr index 4cf1f29f1ab0..13dbb6029673 100644 --- a/src/test/ui/feature-gates/feature-gate-type_ascription.stderr +++ b/src/test/ui/feature-gates/feature-gate-type_ascription.stderr @@ -1,7 +1,7 @@ error[E0658]: type ascription is experimental (see issue #23416) --> $DIR/feature-gate-type_ascription.rs:4:13 | -LL | let a = 10: u8; //~ ERROR type ascription is experimental +LL | let a = 10: u8; | ^^^^^^ | = help: add #![feature(type_ascription)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr index 8730bf678fd3..519f6528323f 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) --> $DIR/feature-gate-unboxed-closures-method-calls.rs:4:7 | -LL | f.call(()); //~ ERROR use of unstable library feature 'fn_traits' +LL | f.call(()); | ^^^^ | = help: add #![feature(fn_traits)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | f.call(()); //~ ERROR use of unstable library feature 'fn_traits' error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) --> $DIR/feature-gate-unboxed-closures-method-calls.rs:5:7 | -LL | f.call_mut(()); //~ ERROR use of unstable library feature 'fn_traits' +LL | f.call_mut(()); | ^^^^^^^^ | = help: add #![feature(fn_traits)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | f.call_mut(()); //~ ERROR use of unstable library feature 'fn_traits' error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) --> $DIR/feature-gate-unboxed-closures-method-calls.rs:6:7 | -LL | f.call_once(()); //~ ERROR use of unstable library feature 'fn_traits' +LL | f.call_once(()); | ^^^^^^^^^ | = help: add #![feature(fn_traits)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr index 266775484a90..a49a8b4cdb2b 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:4:5 | -LL | Fn::call(&f, ()); //~ ERROR use of unstable library feature 'fn_traits' +LL | Fn::call(&f, ()); | ^^^^^^^^ | = help: add #![feature(fn_traits)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | Fn::call(&f, ()); //~ ERROR use of unstable library feature 'fn_traits' error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:5:5 | -LL | FnMut::call_mut(&mut f, ()); //~ ERROR use of unstable library feature 'fn_traits' +LL | FnMut::call_mut(&mut f, ()); | ^^^^^^^^^^^^^^^ | = help: add #![feature(fn_traits)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | FnMut::call_mut(&mut f, ()); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:6:5 | -LL | FnOnce::call_once(f, ()); //~ ERROR use of unstable library feature 'fn_traits' +LL | FnOnce::call_once(f, ()); | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(fn_traits)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr b/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr index d608f3d37cf2..ef93bb97ab44 100644 --- a/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr +++ b/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr @@ -2,7 +2,7 @@ error[E0658]: naming constants with `_` is unstable (see issue #54912) --> $DIR/feature-gate-underscore_const_names.rs:6:1 | LL | / const _ : () = { -LL | | //~^ ERROR is unstable +LL | | LL | | use std::marker::PhantomData; LL | | struct ImplementsTrait(PhantomData); LL | | let _ = ImplementsTrait::(PhantomData); diff --git a/src/test/ui/feature-gates/feature-gate-untagged_unions.stderr b/src/test/ui/feature-gates/feature-gate-untagged_unions.stderr index f9f8cfe9171a..6faa0528dc71 100644 --- a/src/test/ui/feature-gates/feature-gate-untagged_unions.stderr +++ b/src/test/ui/feature-gates/feature-gate-untagged_unions.stderr @@ -1,7 +1,7 @@ error[E0658]: unions with non-`Copy` fields are unstable (see issue #32836) --> $DIR/feature-gate-untagged_unions.rs:9:1 | -LL | / union U3 { //~ ERROR unions with non-`Copy` fields are unstable +LL | / union U3 { LL | | a: String, LL | | } | |_^ @@ -11,7 +11,7 @@ LL | | } error[E0658]: unions with non-`Copy` fields are unstable (see issue #32836) --> $DIR/feature-gate-untagged_unions.rs:13:1 | -LL | / union U4 { //~ ERROR unions with non-`Copy` fields are unstable +LL | / union U4 { LL | | a: T, LL | | } | |_^ @@ -21,7 +21,7 @@ LL | | } error[E0658]: unions with `Drop` implementations are unstable (see issue #32836) --> $DIR/feature-gate-untagged_unions.rs:17:1 | -LL | / union U5 { //~ ERROR unions with `Drop` implementations are unstable +LL | / union U5 { LL | | a: u8, LL | | } | |_^ diff --git a/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr b/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr index 77f2f13c99ee..149ce9e4f82a 100644 --- a/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr +++ b/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr @@ -1,7 +1,7 @@ error[E0658]: #[unwind] is experimental (see issue #58760) --> $DIR/feature-gate-unwind-attributes.rs:11:5 | -LL | #[unwind(allowed)] //~ ERROR #[unwind] is experimental +LL | #[unwind(allowed)] | ^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unwind_attributes)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/underscore_const_names_feature_gate.stderr b/src/test/ui/feature-gates/underscore_const_names_feature_gate.stderr index a42b8e579c9b..83b3017a4cdf 100644 --- a/src/test/ui/feature-gates/underscore_const_names_feature_gate.stderr +++ b/src/test/ui/feature-gates/underscore_const_names_feature_gate.stderr @@ -1,7 +1,7 @@ error[E0658]: naming constants with `_` is unstable (see issue #54912) --> $DIR/underscore_const_names_feature_gate.rs:1:1 | -LL | const _: () = (); //~ ERROR is unstable +LL | const _: () = (); | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(underscore_const_names)] to the crate attributes to enable diff --git a/src/test/ui/ffi_returns_twice.stderr b/src/test/ui/ffi_returns_twice.stderr index c2105ae1dac7..e4137c79939a 100644 --- a/src/test/ui/ffi_returns_twice.stderr +++ b/src/test/ui/ffi_returns_twice.stderr @@ -1,7 +1,7 @@ error[E0724]: `#[ffi_returns_twice]` may only be used on foreign functions --> $DIR/ffi_returns_twice.rs:5:1 | -LL | #[ffi_returns_twice] //~ ERROR `#[ffi_returns_twice]` may only be used on foreign functions +LL | #[ffi_returns_twice] | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/float-literal-inference-restrictions.stderr b/src/test/ui/float-literal-inference-restrictions.stderr index a69c13507e6b..6ac49b7ccd13 100644 --- a/src/test/ui/float-literal-inference-restrictions.stderr +++ b/src/test/ui/float-literal-inference-restrictions.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/float-literal-inference-restrictions.rs:2:18 | -LL | let x: f32 = 1; //~ ERROR mismatched types +LL | let x: f32 = 1; | ^ | | | expected f32, found integer @@ -13,7 +13,7 @@ LL | let x: f32 = 1; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/float-literal-inference-restrictions.rs:3:18 | -LL | let y: f32 = 1f64; //~ ERROR mismatched types +LL | let y: f32 = 1f64; | ^^^^ expected f32, found f64 error: aborting due to 2 previous errors diff --git a/src/test/ui/fmt/send-sync.stderr b/src/test/ui/fmt/send-sync.stderr index 5abe0d0c50b4..1f698c90cb9a 100644 --- a/src/test/ui/fmt/send-sync.stderr +++ b/src/test/ui/fmt/send-sync.stderr @@ -1,7 +1,7 @@ error[E0277]: `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely --> $DIR/send-sync.rs:8:5 | -LL | send(format_args!("{:?}", c)); //~ ERROR E0277 +LL | send(format_args!("{:?}", c)); | ^^^^ `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely | = help: within `[std::fmt::ArgumentV1<'_>]`, the trait `std::marker::Sync` is not implemented for `*mut (dyn std::ops::Fn() + 'static)` @@ -21,7 +21,7 @@ LL | fn send(_: T) {} error[E0277]: `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely --> $DIR/send-sync.rs:9:5 | -LL | sync(format_args!("{:?}", c)); //~ ERROR E0277 +LL | sync(format_args!("{:?}", c)); | ^^^^ `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely | = help: within `std::fmt::Arguments<'_>`, the trait `std::marker::Sync` is not implemented for `*mut (dyn std::ops::Fn() + 'static)` diff --git a/src/test/ui/fn_must_use.stderr b/src/test/ui/fn_must_use.stderr index 4bba638c4e9b..5a1a4e36e06d 100644 --- a/src/test/ui/fn_must_use.stderr +++ b/src/test/ui/fn_must_use.stderr @@ -1,7 +1,7 @@ warning: unused return value of `need_to_use_this_value` that must be used --> $DIR/fn_must_use.rs:55:5 | -LL | need_to_use_this_value(); //~ WARN unused return value +LL | need_to_use_this_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![warn(unused_must_use)] warning: unused return value of `MyStruct::need_to_use_this_method_value` that must be used --> $DIR/fn_must_use.rs:60:5 | -LL | m.need_to_use_this_method_value(); //~ WARN unused return value +LL | m.need_to_use_this_method_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused return value of `EvenNature::is_even` that must be used @@ -34,24 +34,24 @@ LL | MyStruct::need_to_use_this_associated_function_value(); warning: unused return value of `std::cmp::PartialEq::eq` that must be used --> $DIR/fn_must_use.rs:70:5 | -LL | 2.eq(&3); //~ WARN unused return value +LL | 2.eq(&3); | ^^^^^^^^^ warning: unused return value of `std::cmp::PartialEq::eq` that must be used --> $DIR/fn_must_use.rs:71:5 | -LL | m.eq(&n); //~ WARN unused return value +LL | m.eq(&n); | ^^^^^^^^^ warning: unused comparison that must be used --> $DIR/fn_must_use.rs:74:5 | -LL | 2 == 3; //~ WARN unused comparison +LL | 2 == 3; | ^^^^^^ warning: unused comparison that must be used --> $DIR/fn_must_use.rs:75:5 | -LL | m == n; //~ WARN unused comparison +LL | m == n; | ^^^^^^ diff --git a/src/test/ui/for/for-expn.stderr b/src/test/ui/for/for-expn.stderr index b598032e4c9b..cdb211555274 100644 --- a/src/test/ui/for/for-expn.stderr +++ b/src/test/ui/for/for-expn.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `foo` in this scope --> $DIR/for-expn.rs:6:7 | -LL | foo //~ ERROR cannot find value `foo` in this scope +LL | foo | ^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr b/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr index 88d82187716d..da2b0dc234f4 100644 --- a/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr +++ b/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr @@ -1,7 +1,7 @@ error[E0005]: refutable pattern in `for` loop binding: `&-2147483648i32..=0i32` not covered --> $DIR/for-loop-refutable-pattern-error-message.rs:2:9 | -LL | for &1 in [1].iter() {} //~ ERROR refutable pattern in `for` loop binding +LL | for &1 in [1].iter() {} | ^^ pattern `&-2147483648i32..=0i32` not covered error: aborting due to previous error diff --git a/src/test/ui/for/for-loop-type-error.stderr b/src/test/ui/for/for-loop-type-error.stderr index b5a4a5240d9d..f1c1d0a53887 100644 --- a/src/test/ui/for/for-loop-type-error.stderr +++ b/src/test/ui/for/for-loop-type-error.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `+` cannot be applied to type `()` --> $DIR/for-loop-type-error.rs:2:13 | -LL | let x = () + (); //~ ERROR binary operation +LL | let x = () + (); | ^^^^^^^ | = note: an implementation of `std::ops::Add` might be missing for `()` diff --git a/src/test/ui/for/for-loop-unconstrained-element-type.stderr b/src/test/ui/for/for-loop-unconstrained-element-type.stderr index aaaad658de7b..02fdb808da44 100644 --- a/src/test/ui/for/for-loop-unconstrained-element-type.stderr +++ b/src/test/ui/for/for-loop-unconstrained-element-type.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/for-loop-unconstrained-element-type.rs:8:14 | -LL | for i in Vec::new() { } //~ ERROR type annotations needed +LL | for i in Vec::new() { } | ^^^^^^^^^^ | | | cannot infer type diff --git a/src/test/ui/foreign-fn-return-lifetime.stderr b/src/test/ui/foreign-fn-return-lifetime.stderr index 00fda5dbd0c4..575da18f2404 100644 --- a/src/test/ui/foreign-fn-return-lifetime.stderr +++ b/src/test/ui/foreign-fn-return-lifetime.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/foreign-fn-return-lifetime.rs:5:19 | -LL | pub fn f() -> &u8; //~ ERROR missing lifetime specifier +LL | pub fn f() -> &u8; | ^ help: consider giving it a 'static lifetime: `&'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from diff --git a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr index a3497c59a52b..5549adc8d0e1 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr +++ b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `A`, which implements the `Drop` trait --> $DIR/functional-struct-update-noncopyable.rs:12:36 | -LL | let _b = A { y: Arc::new(3), ..a }; //~ ERROR cannot move out of type `A` +LL | let _b = A { y: Arc::new(3), ..a }; | ^ cannot move out of here error: aborting due to previous error diff --git a/src/test/ui/future-incompatible-lint-group.stderr b/src/test/ui/future-incompatible-lint-group.stderr index 79183fca9d3a..65c37e01eaa9 100644 --- a/src/test/ui/future-incompatible-lint-group.stderr +++ b/src/test/ui/future-incompatible-lint-group.stderr @@ -1,7 +1,7 @@ error: anonymous parameters are deprecated and will be removed in the next edition. --> $DIR/future-incompatible-lint-group.rs:4:10 | -LL | fn f(u8) {} //~ ERROR anonymous parameters are deprecated +LL | fn f(u8) {} | ^^ help: Try naming the parameter or explicitly ignoring it: `_: u8` | note: lint level defined here diff --git a/src/test/ui/gated-bad-feature.stderr b/src/test/ui/gated-bad-feature.stderr index 141c51609b7c..b208da3645d8 100644 --- a/src/test/ui/gated-bad-feature.stderr +++ b/src/test/ui/gated-bad-feature.stderr @@ -13,19 +13,19 @@ LL | foo = "baz" error[E0557]: feature has been removed --> $DIR/gated-bad-feature.rs:12:12 | -LL | #![feature(test_removed_feature)] //~ ERROR: feature has been removed +LL | #![feature(test_removed_feature)] | ^^^^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[feature(name1, name1, ...)]` --> $DIR/gated-bad-feature.rs:9:1 | -LL | #![feature] //~ ERROR: attribute must be of the form +LL | #![feature] | ^^^^^^^^^^^ error: attribute must be of the form `#[feature(name1, name1, ...)]` --> $DIR/gated-bad-feature.rs:10:1 | -LL | #![feature = "foo"] //~ ERROR: attribute must be of the form +LL | #![feature = "foo"] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/generator/borrowing.stderr b/src/test/ui/generator/borrowing.stderr index 169e4a8561c1..38502aa8e0b4 100644 --- a/src/test/ui/generator/borrowing.stderr +++ b/src/test/ui/generator/borrowing.stderr @@ -5,7 +5,7 @@ LL | Pin::new(&mut || yield &a).resume() | -- ^ borrowed value does not live long enough | | | capture occurs here -LL | //~^ ERROR: `a` does not live long enough +LL | LL | }; | - borrowed value only lives until here ... diff --git a/src/test/ui/generator/dropck.stderr b/src/test/ui/generator/dropck.stderr index fdaa5cfbae3e..977f388a626f 100644 --- a/src/test/ui/generator/dropck.stderr +++ b/src/test/ui/generator/dropck.stderr @@ -15,7 +15,7 @@ error[E0597]: `ref_` does not live long enough LL | gen = || { | -- capture occurs here LL | // but the generator can use it to drop a `Ref<'a, i32>`. -LL | let _d = ref_.take(); //~ ERROR `ref_` does not live long enough +LL | let _d = ref_.take(); | ^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/generator/generator-with-nll.stderr b/src/test/ui/generator/generator-with-nll.stderr index c683ea1a3094..bd5abb202068 100644 --- a/src/test/ui/generator/generator-with-nll.stderr +++ b/src/test/ui/generator/generator-with-nll.stderr @@ -3,7 +3,7 @@ error[E0626]: borrow may still be in use when generator yields | LL | let b = &mut true; | ^^^^^^^^^ -LL | //~^ borrow may still be in use when generator yields +LL | LL | yield (); | -------- possible yield occurs here diff --git a/src/test/ui/generator/issue-48048.stderr b/src/test/ui/generator/issue-48048.stderr index aeea10225091..234235839164 100644 --- a/src/test/ui/generator/issue-48048.stderr +++ b/src/test/ui/generator/issue-48048.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/issue-48048.rs:9:9 | -LL | x.0({ //~ ERROR borrow may still be in use when generator yields +LL | x.0({ | ^^^ LL | yield; | ----- possible yield occurs here diff --git a/src/test/ui/generator/no-arguments-on-generators.stderr b/src/test/ui/generator/no-arguments-on-generators.stderr index 521001293afa..47a12bbacc02 100644 --- a/src/test/ui/generator/no-arguments-on-generators.stderr +++ b/src/test/ui/generator/no-arguments-on-generators.stderr @@ -1,7 +1,7 @@ error[E0628]: generators cannot have explicit arguments --> $DIR/no-arguments-on-generators.rs:4:15 | -LL | let gen = |start| { //~ ERROR generators cannot have explicit arguments +LL | let gen = |start| { | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/generator/pattern-borrow.stderr b/src/test/ui/generator/pattern-borrow.stderr index 50442828d8df..d78da5104915 100644 --- a/src/test/ui/generator/pattern-borrow.stderr +++ b/src/test/ui/generator/pattern-borrow.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/pattern-borrow.rs:9:24 | -LL | if let Test::A(ref _a) = test { //~ ERROR borrow may still be in use when generator yields +LL | if let Test::A(ref _a) = test { | ^^^^^^ LL | yield (); | -------- possible yield occurs here diff --git a/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr b/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr index 29299b2405a0..20a06abebd6a 100644 --- a/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr +++ b/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr @@ -3,7 +3,7 @@ error[E0597]: `b` does not live long enough | LL | a = &b; | ^ borrowed value does not live long enough -LL | //~^ ERROR `b` does not live long enough +LL | LL | }; | - `b` dropped here while still borrowed LL | } diff --git a/src/test/ui/generator/sized-yield.stderr b/src/test/ui/generator/sized-yield.stderr index c98f42e62168..c2caac7ebe2e 100644 --- a/src/test/ui/generator/sized-yield.stderr +++ b/src/test/ui/generator/sized-yield.stderr @@ -3,7 +3,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t | LL | let mut gen = move || { | __________________________^ -LL | | //~^ ERROR the size for values of type +LL | | LL | | yield s[..]; LL | | }; | |____^ doesn't have a size known at compile-time diff --git a/src/test/ui/generator/static-not-unpin.stderr b/src/test/ui/generator/static-not-unpin.stderr index caf92f0ec693..404d3069f79f 100644 --- a/src/test/ui/generator/static-not-unpin.stderr +++ b/src/test/ui/generator/static-not-unpin.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6 _]: std::marker::Unpin` is not satisfied --> $DIR/static-not-unpin.rs:14:5 | -LL | assert_unpin(generator); //~ ERROR std::marker::Unpin` is not satisfied +LL | assert_unpin(generator); | ^^^^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6 _]` | note: required by `assert_unpin` diff --git a/src/test/ui/generator/yield-in-args.stderr b/src/test/ui/generator/yield-in-args.stderr index f53677b5312e..2f22dea4e91f 100644 --- a/src/test/ui/generator/yield-in-args.stderr +++ b/src/test/ui/generator/yield-in-args.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/yield-in-args.rs:8:14 | -LL | foo(&b, yield); //~ ERROR +LL | foo(&b, yield); | ^ ----- possible yield occurs here error: aborting due to previous error diff --git a/src/test/ui/generator/yield-while-iterating.stderr b/src/test/ui/generator/yield-while-iterating.stderr index 1e3e31470e9d..bcfe4f64bc3d 100644 --- a/src/test/ui/generator/yield-while-iterating.stderr +++ b/src/test/ui/generator/yield-while-iterating.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/yield-while-iterating.rs:13:19 | -LL | for p in &x { //~ ERROR +LL | for p in &x { | ^ LL | yield(); | ------- possible yield occurs here @@ -14,7 +14,7 @@ LL | let mut b = || { LL | for p in &mut x { | - previous borrow occurs due to use of `x` in closure ... -LL | println!("{}", x[0]); //~ ERROR +LL | println!("{}", x[0]); | ^ immutable borrow occurs here LL | Pin::new(&mut b).resume(); LL | } diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.stderr b/src/test/ui/generator/yield-while-ref-reborrowed.stderr index 5c9de279c02d..155f2770d3d5 100644 --- a/src/test/ui/generator/yield-while-ref-reborrowed.stderr +++ b/src/test/ui/generator/yield-while-ref-reborrowed.stderr @@ -6,7 +6,7 @@ LL | let mut b = || { LL | let a = &mut *x; | - previous borrow occurs due to use of `x` in closure ... -LL | println!("{}", x); //~ ERROR +LL | println!("{}", x); | ^ borrow occurs here LL | Pin::new(&mut b).resume(); LL | } diff --git a/src/test/ui/generic/generic-arg-mismatch-recover.stderr b/src/test/ui/generic/generic-arg-mismatch-recover.stderr index 37f6c61f06df..e16ad9120a65 100644 --- a/src/test/ui/generic/generic-arg-mismatch-recover.stderr +++ b/src/test/ui/generic/generic-arg-mismatch-recover.stderr @@ -1,13 +1,13 @@ error[E0107]: wrong number of lifetime arguments: expected 1, found 2 --> $DIR/generic-arg-mismatch-recover.rs:6:20 | -LL | Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arguments +LL | Foo::<'static, 'static, ()>(&0); | ^^^^^^^ unexpected lifetime argument error[E0308]: mismatched types --> $DIR/generic-arg-mismatch-recover.rs:6:33 | -LL | Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arguments +LL | Foo::<'static, 'static, ()>(&0); | ^^ expected (), found integer | = note: expected type `&'static ()` @@ -16,13 +16,13 @@ LL | Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arg error[E0107]: wrong number of lifetime arguments: expected 1, found 2 --> $DIR/generic-arg-mismatch-recover.rs:9:20 | -LL | Bar::<'static, 'static, ()>(&()); //~ ERROR wrong number of lifetime arguments +LL | Bar::<'static, 'static, ()>(&()); | ^^^^^^^ unexpected lifetime argument error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/generic-arg-mismatch-recover.rs:9:29 | -LL | Bar::<'static, 'static, ()>(&()); //~ ERROR wrong number of lifetime arguments +LL | Bar::<'static, 'static, ()>(&()); | ^^ unexpected type argument error: aborting due to 4 previous errors diff --git a/src/test/ui/generic/generic-extern-lifetime.stderr b/src/test/ui/generic/generic-extern-lifetime.stderr index b31d2a88044c..39372c931583 100644 --- a/src/test/ui/generic/generic-extern-lifetime.stderr +++ b/src/test/ui/generic/generic-extern-lifetime.stderr @@ -1,19 +1,19 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic-extern-lifetime.rs:6:24 | -LL | pub fn life2<'b>(x:&'a i32, y:&'b i32); //~ ERROR use of undeclared lifetime name `'a` +LL | pub fn life2<'b>(x:&'a i32, y:&'b i32); | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic-extern-lifetime.rs:8:36 | -LL | pub fn life4<'b>(x: for<'c> fn(&'a i32)); //~ ERROR use of undeclared lifetime name `'a` +LL | pub fn life4<'b>(x: for<'c> fn(&'a i32)); | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic-extern-lifetime.rs:11:38 | -LL | pub fn life7<'b>() -> for<'c> fn(&'a i32); //~ ERROR use of undeclared lifetime name `'a` +LL | pub fn life7<'b>() -> for<'c> fn(&'a i32); | ^^ undeclared lifetime error: aborting due to 3 previous errors diff --git a/src/test/ui/generic/generic-extern.stderr b/src/test/ui/generic/generic-extern.stderr index 1c978245f9c6..e7625abb1c83 100644 --- a/src/test/ui/generic/generic-extern.stderr +++ b/src/test/ui/generic/generic-extern.stderr @@ -1,7 +1,7 @@ error[E0044]: foreign items may not have type parameters --> $DIR/generic-extern.rs:2:5 | -LL | fn foo(); //~ ERROR foreign items may not have type parameters +LL | fn foo(); | ^^^^^^^^^^^^ can't have type parameters | = help: use specialization instead of type parameters by replacing them with concrete types like `u32` diff --git a/src/test/ui/generic/generic-lifetime-trait-impl.stderr b/src/test/ui/generic/generic-lifetime-trait-impl.stderr index 8f4a0f23670b..4ae5098a121f 100644 --- a/src/test/ui/generic/generic-lifetime-trait-impl.stderr +++ b/src/test/ui/generic/generic-lifetime-trait-impl.stderr @@ -4,7 +4,7 @@ error[E0195]: lifetime parameters or bounds on method `bar` do not match the tra LL | fn bar<'b, T: Bar<'b>>(self) -> &'b str; | ---------------- lifetimes in impl do not match this method in trait ... -LL | fn bar>(self) -> &'a str { panic!() } //~ ERROR lifetime +LL | fn bar>(self) -> &'a str { panic!() } | ^^^^^^^^^^^^ lifetimes do not match method in trait error: aborting due to previous error diff --git a/src/test/ui/generic/generic-no-mangle.stderr b/src/test/ui/generic/generic-no-mangle.stderr index 3da39f1dc17c..f055a3ab83f7 100644 --- a/src/test/ui/generic/generic-no-mangle.stderr +++ b/src/test/ui/generic/generic-no-mangle.stderr @@ -3,7 +3,7 @@ error: functions generic over types or consts must be mangled | LL | #[no_mangle] | ------------ help: remove this attribute -LL | pub fn foo() {} //~ ERROR functions generic over types or consts must be mangled +LL | pub fn foo() {} | ^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -17,7 +17,7 @@ error: functions generic over types or consts must be mangled | LL | #[no_mangle] | ------------ help: remove this attribute -LL | pub extern fn bar() {} //~ ERROR functions generic over types or consts must be mangled +LL | pub extern fn bar() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/glob-resolve1.stderr b/src/test/ui/glob-resolve1.stderr index 10a57aa6ca64..01730c4d6956 100644 --- a/src/test/ui/glob-resolve1.stderr +++ b/src/test/ui/glob-resolve1.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `fpriv` in this scope --> $DIR/glob-resolve1.rs:22:5 | -LL | fpriv(); //~ ERROR cannot find function `fpriv` in this scope +LL | fpriv(); | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -11,7 +11,7 @@ LL | use bar::fpriv; error[E0425]: cannot find function `epriv` in this scope --> $DIR/glob-resolve1.rs:23:5 | -LL | epriv(); //~ ERROR cannot find function `epriv` in this scope +LL | epriv(); | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -21,7 +21,7 @@ LL | use bar::epriv; error[E0423]: expected value, found enum `B` --> $DIR/glob-resolve1.rs:24:5 | -LL | B; //~ ERROR expected value, found enum `B` +LL | B; | ^ | = note: did you mean to use one of the following variants? @@ -30,7 +30,7 @@ LL | B; //~ ERROR expected value, found enum `B` error[E0425]: cannot find value `C` in this scope --> $DIR/glob-resolve1.rs:25:5 | -LL | C; //~ ERROR cannot find value `C` in this scope +LL | C; | ^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -40,17 +40,17 @@ LL | use bar::C; error[E0425]: cannot find function `import` in this scope --> $DIR/glob-resolve1.rs:26:5 | -LL | import(); //~ ERROR: cannot find function `import` in this scope +LL | import(); | ^^^^^^ not found in this scope error[E0412]: cannot find type `A` in this scope --> $DIR/glob-resolve1.rs:28:11 | -LL | foo::(); //~ ERROR: cannot find type `A` in this scope +LL | foo::(); | ^ help: an enum with a similar name exists | -LL | foo::(); //~ ERROR: cannot find type `A` in this scope +LL | foo::(); | ^ help: possible candidate is found in another module, you can import it into scope | @@ -60,11 +60,11 @@ LL | use bar::A; error[E0412]: cannot find type `C` in this scope --> $DIR/glob-resolve1.rs:29:11 | -LL | foo::(); //~ ERROR: cannot find type `C` in this scope +LL | foo::(); | ^ help: an enum with a similar name exists | -LL | foo::(); //~ ERROR: cannot find type `C` in this scope +LL | foo::(); | ^ help: possible candidate is found in another module, you can import it into scope | @@ -74,11 +74,11 @@ LL | use bar::C; error[E0412]: cannot find type `D` in this scope --> $DIR/glob-resolve1.rs:30:11 | -LL | foo::(); //~ ERROR: cannot find type `D` in this scope +LL | foo::(); | ^ help: an enum with a similar name exists | -LL | foo::(); //~ ERROR: cannot find type `D` in this scope +LL | foo::(); | ^ help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/hashmap-iter-value-lifetime.stderr b/src/test/ui/hashmap-iter-value-lifetime.stderr index 99761dd1cd7f..0f7e04dae0ce 100644 --- a/src/test/ui/hashmap-iter-value-lifetime.stderr +++ b/src/test/ui/hashmap-iter-value-lifetime.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as LL | let (_, thing) = my_stuff.iter().next().unwrap(); | -------- immutable borrow occurs here LL | -LL | my_stuff.clear(); //~ ERROR cannot borrow +LL | my_stuff.clear(); | ^^^^^^^^ mutable borrow occurs here ... LL | } diff --git a/src/test/ui/hashmap-lifetimes.stderr b/src/test/ui/hashmap-lifetimes.stderr index 81b2304f3810..728946ca13a6 100644 --- a/src/test/ui/hashmap-lifetimes.stderr +++ b/src/test/ui/hashmap-lifetimes.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as | LL | let mut it = my_stuff.iter(); | -------- immutable borrow occurs here -LL | my_stuff.insert(1, 43); //~ ERROR cannot borrow +LL | my_stuff.insert(1, 43); | ^^^^^^^^ mutable borrow occurs here LL | it; LL | } diff --git a/src/test/ui/hidden-rt-injection.stderr b/src/test/ui/hidden-rt-injection.stderr index 6d63344882b2..3e288b72ec63 100644 --- a/src/test/ui/hidden-rt-injection.stderr +++ b/src/test/ui/hidden-rt-injection.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `native` --> $DIR/hidden-rt-injection.rs:5:9 | -LL | use native; //~ ERROR unresolved import +LL | use native; | ^^^^^^ no `native` in the root error: aborting due to previous error diff --git a/src/test/ui/hidden-rt-injection2.stderr b/src/test/ui/hidden-rt-injection2.stderr index bbb45552f2c1..73f89b5856da 100644 --- a/src/test/ui/hidden-rt-injection2.stderr +++ b/src/test/ui/hidden-rt-injection2.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `rt` --> $DIR/hidden-rt-injection2.rs:5:9 | -LL | use rt; //~ ERROR unresolved import +LL | use rt; | ^^ no `rt` in the root error: aborting due to previous error diff --git a/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr b/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr index 21d154eb2316..77a5491cb63a 100644 --- a/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr +++ b/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr @@ -1,7 +1,7 @@ error: implementation of `Deserialize` is not general enough --> $DIR/hrtb-cache-issue-54302.rs:19:5 | -LL | assert_deserialize_owned::<&'static str>(); //~ ERROR +LL | assert_deserialize_owned::<&'static str>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `&'static str` must implement `Deserialize<'0>`, for any lifetime `'0` diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.stderr b/src/test/ui/hrtb/hrtb-conflate-regions.stderr index 50e1af8f1423..3fb6baa35e14 100644 --- a/src/test/ui/hrtb/hrtb-conflate-regions.stderr +++ b/src/test/ui/hrtb/hrtb-conflate-regions.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `for<'a, 'b> SomeStruct: Foo<(&'a isize, &'b isize)>` is not satisfied --> $DIR/hrtb-conflate-regions.rs:28:10 | -LL | fn b() { want_foo2::(); } //~ ERROR +LL | fn b() { want_foo2::(); } | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Foo<(&'a isize, &'b isize)>` is not implemented for `SomeStruct` | = help: the following implementations were found: diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr index 85bff4ce7911..e498a9ad0222 100644 --- a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr +++ b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time | LL | foo.insert(); | --- first mutable borrow occurs here -LL | foo.insert(); //~ ERROR cannot borrow +LL | foo.insert(); | ^^^ second mutable borrow occurs here LL | } | - first borrow ends here diff --git a/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr b/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr index 8e8892552b70..d893cd606f1e 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/hrtb-exists-forall-fn.rs:17:34 | -LL | let _: for<'b> fn(&'b u32) = foo(); //~ ERROR mismatched types +LL | let _: for<'b> fn(&'b u32) = foo(); | ^^^^^ expected concrete lifetime, found bound lifetime parameter 'b | = note: expected type `for<'b> fn(&'b u32)` diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr index f56b81759fed..f10e427a545f 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `(): Trait fn(std::cell::Cell<&'b u32>)>` is not satisfied --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:5 | -LL | foo::<()>(); //~ ERROR not satisfied +LL | foo::<()>(); | ^^^^^^^^^ the trait `Trait fn(std::cell::Cell<&'b u32>)>` is not implemented for `()` | = help: the following implementations were found: diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr index 77c1789852e5..b5d945fe15ca 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:47:5 | -LL | want_bar_for_any_ccx(b); //~ ERROR +LL | want_bar_for_any_ccx(b); | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` | = help: consider adding a `where for<'ccx> B: Bar<'ccx>` bound diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr index 5914cb3eaa49..20a8fd459fa4 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `for<'tcx> F: Foo<'tcx>` is not satisfied --> $DIR/hrtb-higher-ranker-supertraits.rs:18:5 | -LL | want_foo_for_any_tcx(f); //~ ERROR not satisfied +LL | want_foo_for_any_tcx(f); | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F` | = help: consider adding a `where for<'tcx> F: Foo<'tcx>` bound @@ -19,7 +19,7 @@ LL | | } error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied --> $DIR/hrtb-higher-ranker-supertraits.rs:35:5 | -LL | want_bar_for_any_ccx(b); //~ ERROR not satisfied +LL | want_bar_for_any_ccx(b); | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` | = help: consider adding a `where for<'ccx> B: Bar<'ccx>` bound diff --git a/src/test/ui/hrtb/hrtb-just-for-static.stderr b/src/test/ui/hrtb/hrtb-just-for-static.stderr index fe2bc1f22250..115851ddf938 100644 --- a/src/test/ui/hrtb/hrtb-just-for-static.stderr +++ b/src/test/ui/hrtb/hrtb-just-for-static.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `for<'a> StaticInt: Foo<&'a isize>` is not satisfied --> $DIR/hrtb-just-for-static.rs:24:5 | -LL | want_hrtb::() //~ ERROR +LL | want_hrtb::() | ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo<&'a isize>` is not implemented for `StaticInt` | = help: the following implementations were found: @@ -18,7 +18,7 @@ LL | | } error[E0277]: the trait bound `for<'a> &'a u32: Foo<&'a isize>` is not satisfied --> $DIR/hrtb-just-for-static.rs:30:5 | -LL | want_hrtb::<&'a u32>() //~ ERROR +LL | want_hrtb::<&'a u32>() | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo<&'a isize>` is not implemented for `&'a u32` | = help: the following implementations were found: diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr index ea08af016406..9bc8cd67a82a 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/hrtb-perfect-forwarding.rs:46:5 | -LL | foo_hrtb_bar_not(&mut t); //~ ERROR mismatched types +LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^ one type is more general than the other | = note: expected type `Bar<&'a isize>` diff --git a/src/test/ui/hrtb/issue-58451.stderr b/src/test/ui/hrtb/issue-58451.stderr index 79c24855dc96..4648c0182b98 100644 --- a/src/test/ui/hrtb/issue-58451.stderr +++ b/src/test/ui/hrtb/issue-58451.stderr @@ -8,7 +8,7 @@ LL | | I::Item: for<'a> Into<&'a ()>, LL | | {} | |__- defined here ... -LL | f(&[f()]); //~ ERROR this function takes 1 parameter +LL | f(&[f()]); | ^^^ expected 1 parameter error: aborting due to previous error diff --git a/src/test/ui/hygiene/arguments.stderr b/src/test/ui/hygiene/arguments.stderr index 4cf35be22fad..d072086e086d 100644 --- a/src/test/ui/hygiene/arguments.stderr +++ b/src/test/ui/hygiene/arguments.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `S` in this scope --> $DIR/arguments.rs:16:8 | -LL | m!(S, S); //~ ERROR cannot find type `S` in this scope +LL | m!(S, S); | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/hygiene/assoc_item_ctxt.stderr b/src/test/ui/hygiene/assoc_item_ctxt.stderr index d89f395d8c17..ebe38b7c41a6 100644 --- a/src/test/ui/hygiene/assoc_item_ctxt.stderr +++ b/src/test/ui/hygiene/assoc_item_ctxt.stderr @@ -1,7 +1,7 @@ error[E0407]: method `method` is not a member of trait `Tr` --> $DIR/assoc_item_ctxt.rs:35:13 | -LL | fn method() {} //~ ERROR method `method` is not a member of trait `Tr` +LL | fn method() {} | ^^^^^^^^^^^^^^ not a member of trait `Tr` ... LL | mac_trait_impl!(); @@ -13,7 +13,7 @@ error[E0046]: not all trait items implemented, missing: `method` LL | fn method(); | ------------ `method` from trait ... -LL | impl Tr for u8 { //~ ERROR not all trait items implemented, missing: `method` +LL | impl Tr for u8 { | ^^^^^^^^^^^^^^ missing `method` in implementation ... LL | mac_trait_impl!(); diff --git a/src/test/ui/hygiene/fields-definition.stderr b/src/test/ui/hygiene/fields-definition.stderr index d6d25d7fa0c2..a30650d88e28 100644 --- a/src/test/ui/hygiene/fields-definition.stderr +++ b/src/test/ui/hygiene/fields-definition.stderr @@ -3,7 +3,7 @@ error[E0124]: field `a` is already declared | LL | a: u8, | ----- `a` first declared here -LL | $a: u8, //~ ERROR field `a` is already declared +LL | $a: u8, | ^^ field already declared ... LL | legacy!(a); diff --git a/src/test/ui/hygiene/fields-move.stderr b/src/test/ui/hygiene/fields-move.stderr index a5eeadff4dc0..43d55fdc68fb 100644 --- a/src/test/ui/hygiene/fields-move.stderr +++ b/src/test/ui/hygiene/fields-move.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `foo.x` LL | $foo.x | ------ value moved here ... -LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_modern!(foo), foo.x); | ^^^^^ value used here after move | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait @@ -15,10 +15,10 @@ error[E0382]: use of moved value: `foo.x` LL | $foo.x | ------ value moved here ... -LL | $foo.x //~ ERROR use of moved value: `foo.x` +LL | $foo.x | ^^^^^^ value used here after move ... -LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_legacy!(foo), foo.x); | ----------------- in this macro invocation | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait @@ -29,7 +29,7 @@ error[E0382]: use of moved value: `foo.x` LL | $foo.x | ------ value moved here ... -LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_legacy!(foo), foo.x); | ^^^^^ value used here after move | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait diff --git a/src/test/ui/hygiene/fields.stderr b/src/test/ui/hygiene/fields.stderr index 6d5b60fcb5b7..20ea4e91067b 100644 --- a/src/test/ui/hygiene/fields.stderr +++ b/src/test/ui/hygiene/fields.stderr @@ -1,7 +1,7 @@ error: type `foo::S` is private --> $DIR/fields.rs:15:17 | -LL | let s = S { x: 0 }; //~ ERROR type `foo::S` is private +LL | let s = S { x: 0 }; | ^^^^^^^^^^ ... LL | let s = foo::m!(S, x); @@ -10,7 +10,7 @@ LL | let s = foo::m!(S, x); error: type `foo::S` is private --> $DIR/fields.rs:16:17 | -LL | let _ = s.x; //~ ERROR type `foo::S` is private +LL | let _ = s.x; | ^ ... LL | let s = foo::m!(S, x); @@ -19,7 +19,7 @@ LL | let s = foo::m!(S, x); error: type `foo::T` is private --> $DIR/fields.rs:18:17 | -LL | let t = T(0); //~ ERROR type `foo::T` is private +LL | let t = T(0); | ^^^^ ... LL | let s = foo::m!(S, x); @@ -28,7 +28,7 @@ LL | let s = foo::m!(S, x); error: type `foo::T` is private --> $DIR/fields.rs:19:17 | -LL | let _ = t.0; //~ ERROR type `foo::T` is private +LL | let _ = t.0; | ^ ... LL | let s = foo::m!(S, x); diff --git a/src/test/ui/hygiene/for-loop.stderr b/src/test/ui/hygiene/for-loop.stderr index 755bf3e55f71..932c951e7a54 100644 --- a/src/test/ui/hygiene/for-loop.stderr +++ b/src/test/ui/hygiene/for-loop.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `iter` in this scope --> $DIR/for-loop.rs:6:9 | -LL | iter.next(); //~ ERROR cannot find value `iter` in this scope +LL | iter.next(); | ^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/hygiene/generate-mod.stderr b/src/test/ui/hygiene/generate-mod.stderr index d9342d911592..5e2c56d4bf4d 100644 --- a/src/test/ui/hygiene/generate-mod.stderr +++ b/src/test/ui/hygiene/generate-mod.stderr @@ -1,19 +1,19 @@ error[E0412]: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:35:13 | -LL | genmod!(FromOutside, Outer); //~ ERROR cannot find type `FromOutside` in this scope +LL | genmod!(FromOutside, Outer); | ^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `Outer` in this scope --> $DIR/generate-mod.rs:35:26 | -LL | genmod!(FromOutside, Outer); //~ ERROR cannot find type `FromOutside` in this scope +LL | genmod!(FromOutside, Outer); | ^^^^^ not found in this scope error[E0412]: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:19:18 | -LL | type A = FromOutside; //~ ERROR cannot find type `FromOutside` in this scope +LL | type A = FromOutside; | ^^^^^^^^^^^ not found in this scope ... LL | genmod_transparent!(); @@ -22,7 +22,7 @@ LL | genmod_transparent!(); error[E0412]: cannot find type `Outer` in this scope --> $DIR/generate-mod.rs:20:22 | -LL | type Inner = Outer; //~ ERROR cannot find type `Outer` in this scope +LL | type Inner = Outer; | ^^^^^ not found in this scope ... LL | genmod_transparent!(); @@ -31,7 +31,7 @@ LL | genmod_transparent!(); error[E0412]: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:28:18 | -LL | type A = FromOutside; //~ ERROR cannot find type `FromOutside` in this scope +LL | type A = FromOutside; | ^^^^^^^^^^^ not found in this scope ... LL | genmod_legacy!(); @@ -40,7 +40,7 @@ LL | genmod_legacy!(); error[E0412]: cannot find type `Outer` in this scope --> $DIR/generate-mod.rs:29:22 | -LL | type Inner = Outer; //~ ERROR cannot find type `Outer` in this scope +LL | type Inner = Outer; | ^^^^^ not found in this scope ... LL | genmod_legacy!(); diff --git a/src/test/ui/hygiene/globs.stderr b/src/test/ui/hygiene/globs.stderr index ad62b976251f..7e0f4e4e0b8f 100644 --- a/src/test/ui/hygiene/globs.stderr +++ b/src/test/ui/hygiene/globs.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `f` in this scope --> $DIR/globs.rs:22:9 | -LL | f(); //~ ERROR cannot find function `f` in this scope +LL | f(); | ^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -15,13 +15,13 @@ LL | use foo::f; error[E0425]: cannot find function `g` in this scope --> $DIR/globs.rs:15:5 | -LL | g(); //~ ERROR cannot find function `g` in this scope +LL | g(); | ^ not found in this scope ... LL | / m! { LL | | use bar::*; LL | | g(); -LL | | f(); //~ ERROR cannot find function `f` in this scope +LL | | f(); LL | | } | |_____- in this macro invocation help: possible candidates are found in other modules, you can import them into scope @@ -42,7 +42,7 @@ error[E0425]: cannot find function `f` in this scope LL | n!(f); | ------ in this macro invocation ... -LL | n!(f); //~ ERROR cannot find function `f` in this scope +LL | n!(f); | ^ not found in this scope error[E0425]: cannot find function `f` in this scope @@ -51,7 +51,7 @@ error[E0425]: cannot find function `f` in this scope LL | n!(f); | ------ in this macro invocation ... -LL | f //~ ERROR cannot find function `f` in this scope +LL | f | ^ not found in this scope error: aborting due to 4 previous errors diff --git a/src/test/ui/hygiene/hygienic-label-1.stderr b/src/test/ui/hygiene/hygienic-label-1.stderr index 9a55965d85fe..80cd1547b45e 100644 --- a/src/test/ui/hygiene/hygienic-label-1.stderr +++ b/src/test/ui/hygiene/hygienic-label-1.stderr @@ -1,7 +1,7 @@ error[E0426]: use of undeclared label `'x` --> $DIR/hygienic-label-1.rs:2:19 | -LL | () => { break 'x; } //~ ERROR use of undeclared label `'x` +LL | () => { break 'x; } | ^^ did you mean `'x`? ... LL | 'x: loop { foo!() } diff --git a/src/test/ui/hygiene/hygienic-label-2.stderr b/src/test/ui/hygiene/hygienic-label-2.stderr index b7cb91d94f1b..c20cbd9f6879 100644 --- a/src/test/ui/hygiene/hygienic-label-2.stderr +++ b/src/test/ui/hygiene/hygienic-label-2.stderr @@ -1,7 +1,7 @@ error[E0426]: use of undeclared label `'x` --> $DIR/hygienic-label-2.rs:6:16 | -LL | foo!(break 'x); //~ ERROR use of undeclared label `'x` +LL | foo!(break 'x); | ^^ did you mean `'x`? error: aborting due to previous error diff --git a/src/test/ui/hygiene/hygienic-label-3.stderr b/src/test/ui/hygiene/hygienic-label-3.stderr index 227a39512b74..b5839fe5c3d2 100644 --- a/src/test/ui/hygiene/hygienic-label-3.stderr +++ b/src/test/ui/hygiene/hygienic-label-3.stderr @@ -1,7 +1,7 @@ error[E0426]: use of undeclared label `'x` --> $DIR/hygienic-label-3.rs:2:19 | -LL | () => { break 'x; } //~ ERROR use of undeclared label `'x` +LL | () => { break 'x; } | ^^ did you mean `'x`? ... LL | foo!() diff --git a/src/test/ui/hygiene/hygienic-label-4.stderr b/src/test/ui/hygiene/hygienic-label-4.stderr index 4f9a68ca8311..1dd748957462 100644 --- a/src/test/ui/hygiene/hygienic-label-4.stderr +++ b/src/test/ui/hygiene/hygienic-label-4.stderr @@ -1,7 +1,7 @@ error[E0426]: use of undeclared label `'x` --> $DIR/hygienic-label-4.rs:6:16 | -LL | foo!(break 'x); //~ ERROR use of undeclared label `'x` +LL | foo!(break 'x); | ^^ did you mean `'x`? error: aborting due to previous error diff --git a/src/test/ui/hygiene/impl_items.stderr b/src/test/ui/hygiene/impl_items.stderr index cb3705e5513c..418c2c73ba15 100644 --- a/src/test/ui/hygiene/impl_items.stderr +++ b/src/test/ui/hygiene/impl_items.stderr @@ -1,7 +1,7 @@ error: type `for<'r> fn(&'r foo::S) {foo::S::f}` is private --> $DIR/impl_items.rs:12:23 | -LL | let _: () = S.f(); //~ ERROR type `for<'r> fn(&'r foo::S) {foo::S::f}` is private +LL | let _: () = S.f(); | ^ ... LL | foo::m!(); diff --git a/src/test/ui/hygiene/nested_macro_privacy.stderr b/src/test/ui/hygiene/nested_macro_privacy.stderr index 4fca86d521ba..6e78cb86d80f 100644 --- a/src/test/ui/hygiene/nested_macro_privacy.stderr +++ b/src/test/ui/hygiene/nested_macro_privacy.stderr @@ -1,7 +1,7 @@ error[E0616]: field `i` of struct `foo::S` is private --> $DIR/nested_macro_privacy.rs:15:5 | -LL | S::default().i; //~ ERROR field `i` of struct `foo::S` is private +LL | S::default().i; | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/hygiene/no_implicit_prelude-2018.stderr b/src/test/ui/hygiene/no_implicit_prelude-2018.stderr index 370fc9784ad4..e7ae7afa02aa 100644 --- a/src/test/ui/hygiene/no_implicit_prelude-2018.stderr +++ b/src/test/ui/hygiene/no_implicit_prelude-2018.stderr @@ -1,7 +1,7 @@ error: cannot find macro `print!` in this scope --> $DIR/no_implicit_prelude-2018.rs:7:9 | -LL | print!(); //~ ERROR cannot find macro `print!` in this scope +LL | print!(); | ^^^^^ | = help: have you added the `#[macro_use]` on the module/import? diff --git a/src/test/ui/hygiene/no_implicit_prelude.stderr b/src/test/ui/hygiene/no_implicit_prelude.stderr index b1de7700edb3..7948f1667d77 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.stderr +++ b/src/test/ui/hygiene/no_implicit_prelude.stderr @@ -4,13 +4,13 @@ error[E0433]: failed to resolve: use of undeclared type or module `Vec` LL | fn f() { ::bar::m!(); } | ------------ in this macro invocation ... -LL | Vec::new(); //~ ERROR failed to resolve +LL | Vec::new(); | ^^^ use of undeclared type or module `Vec` error: cannot find macro `print!` in this scope --> $DIR/no_implicit_prelude.rs:16:9 | -LL | println!(); //~ ERROR cannot find macro `print!` in this scope +LL | println!(); | ^^^^^^^^^^^ | = help: have you added the `#[macro_use]` on the module/import? @@ -22,7 +22,7 @@ error[E0599]: no method named `clone` found for type `()` in the current scope LL | fn f() { ::bar::m!(); } | ------------ in this macro invocation ... -LL | ().clone() //~ ERROR no method named `clone` found +LL | ().clone() | ^^^^^ | = help: items from traits can only be used if the trait is in scope diff --git a/src/test/ui/hygiene/pattern-macro.stderr b/src/test/ui/hygiene/pattern-macro.stderr index 8a170dccd5c4..edd05916ede2 100644 --- a/src/test/ui/hygiene/pattern-macro.stderr +++ b/src/test/ui/hygiene/pattern-macro.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/pattern-macro.rs:5:5 | -LL | x + 1; //~ ERROR cannot find value `x` in this scope +LL | x + 1; | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/hygiene/privacy.stderr b/src/test/ui/hygiene/privacy.stderr index bc056c7cf3cb..80fb4dd0f314 100644 --- a/src/test/ui/hygiene/privacy.stderr +++ b/src/test/ui/hygiene/privacy.stderr @@ -1,7 +1,7 @@ error[E0603]: function `f` is private --> $DIR/privacy.rs:16:14 | -LL | foo::f() //~ ERROR `f` is private +LL | foo::f() | ^ error: aborting due to previous error diff --git a/src/test/ui/hygiene/trait_items.stderr b/src/test/ui/hygiene/trait_items.stderr index 677bd08b6af5..4192b97e7506 100644 --- a/src/test/ui/hygiene/trait_items.stderr +++ b/src/test/ui/hygiene/trait_items.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `f` found for type `()` in the current scope LL | fn f() { ::baz::m!(); } | ------------ in this macro invocation ... -LL | pub macro m() { ().f() } //~ ERROR no method named `f` found for type `()` in the current scope +LL | pub macro m() { ().f() } | ^ | = help: items from traits can only be used if the trait is in scope diff --git a/src/test/ui/if/if-let-arm-types.stderr b/src/test/ui/if/if-let-arm-types.stderr index 6401a62c06ba..b986973fe91f 100644 --- a/src/test/ui/if/if-let-arm-types.stderr +++ b/src/test/ui/if/if-let-arm-types.stderr @@ -2,7 +2,7 @@ error[E0308]: `if let` arms have incompatible types --> $DIR/if-let-arm-types.rs:6:9 | LL | / if let Some(b) = None { -LL | | //~^ NOTE if let` arms have incompatible types +LL | | LL | | () LL | | } else { LL | | 1 diff --git a/src/test/ui/if/if-let.stderr b/src/test/ui/if/if-let.stderr index b2a104bfacff..04bca1b76a09 100644 --- a/src/test/ui/if/if-let.stderr +++ b/src/test/ui/if/if-let.stderr @@ -4,7 +4,7 @@ warning: irrefutable if-let pattern LL | if let $p = $e $b | ^^ ... -LL | / foo!(a, 1, { //~ WARN irrefutable if-let +LL | / foo!(a, 1, { LL | | println!("irrefutable pattern"); LL | | }); | |_______- in this macro invocation @@ -17,7 +17,7 @@ warning: irrefutable if-let pattern LL | if let $p = $e $b | ^^ ... -LL | / bar!(a, 1, { //~ WARN irrefutable if-let +LL | / bar!(a, 1, { LL | | println!("irrefutable pattern"); LL | | }); | |_______- in this macro invocation @@ -25,7 +25,7 @@ LL | | }); warning: irrefutable if-let pattern --> $DIR/if-let.rs:24:5 | -LL | / if let a = 1 { //~ WARN irrefutable if-let +LL | / if let a = 1 { LL | | println!("irrefutable pattern"); LL | | } | |_____^ @@ -33,7 +33,7 @@ LL | | } warning: irrefutable if-let pattern --> $DIR/if-let.rs:28:5 | -LL | / if let a = 1 { //~ WARN irrefutable if-let +LL | / if let a = 1 { LL | | println!("irrefutable pattern"); LL | | } else if true { LL | | println!("else-if in irrefutable if-let"); @@ -45,7 +45,7 @@ LL | | } warning: irrefutable if-let pattern --> $DIR/if-let.rs:38:12 | -LL | } else if let a = 1 { //~ WARN irrefutable if-let +LL | } else if let a = 1 { | ____________^ LL | | println!("irrefutable pattern"); LL | | } @@ -54,7 +54,7 @@ LL | | } warning: irrefutable if-let pattern --> $DIR/if-let.rs:44:12 | -LL | } else if let a = 1 { //~ WARN irrefutable if-let +LL | } else if let a = 1 { | ____________^ LL | | println!("irrefutable pattern"); LL | | } diff --git a/src/test/ui/if/ifmt-bad-arg.stderr b/src/test/ui/if/ifmt-bad-arg.stderr index d4153ac94acd..65be86eaf257 100644 --- a/src/test/ui/if/ifmt-bad-arg.stderr +++ b/src/test/ui/if/ifmt-bad-arg.stderr @@ -73,13 +73,13 @@ LL | format!("{} {foo} {} {bar} {}", 1, 2, 3); error: there is no argument named `foo` --> $DIR/ifmt-bad-arg.rs:31:14 | -LL | format!("{foo}"); //~ ERROR: no argument named `foo` +LL | format!("{foo}"); | ^^^^^ error: multiple unused formatting arguments --> $DIR/ifmt-bad-arg.rs:32:17 | -LL | format!("", 1, 2); //~ ERROR: multiple unused formatting arguments +LL | format!("", 1, 2); | -- ^ ^ argument never used | | | | | argument never used @@ -88,7 +88,7 @@ LL | format!("", 1, 2); //~ ERROR: multiple unused formatting error: argument never used --> $DIR/ifmt-bad-arg.rs:33:22 | -LL | format!("{}", 1, 2); //~ ERROR: argument never used +LL | format!("{}", 1, 2); | ---- ^ argument never used | | | formatting specifier missing @@ -96,7 +96,7 @@ LL | format!("{}", 1, 2); //~ ERROR: argument never used error: argument never used --> $DIR/ifmt-bad-arg.rs:34:20 | -LL | format!("{1}", 1, 2); //~ ERROR: argument never used +LL | format!("{1}", 1, 2); | ----- ^ argument never used | | | formatting specifier missing @@ -104,7 +104,7 @@ LL | format!("{1}", 1, 2); //~ ERROR: argument never used error: named argument never used --> $DIR/ifmt-bad-arg.rs:35:26 | -LL | format!("{}", 1, foo=2); //~ ERROR: named argument never used +LL | format!("{}", 1, foo=2); | ---- ^ named argument never used | | | formatting specifier missing @@ -112,7 +112,7 @@ LL | format!("{}", 1, foo=2); //~ ERROR: named argument never used error: argument never used --> $DIR/ifmt-bad-arg.rs:36:22 | -LL | format!("{foo}", 1, foo=2); //~ ERROR: argument never used +LL | format!("{foo}", 1, foo=2); | ------- ^ argument never used | | | formatting specifier missing @@ -120,7 +120,7 @@ LL | format!("{foo}", 1, foo=2); //~ ERROR: argument never used error: named argument never used --> $DIR/ifmt-bad-arg.rs:37:21 | -LL | format!("", foo=2); //~ ERROR: named argument never used +LL | format!("", foo=2); | -- ^ named argument never used | | | formatting specifier missing @@ -128,7 +128,7 @@ LL | format!("", foo=2); //~ ERROR: named argument never used error: multiple unused formatting arguments --> $DIR/ifmt-bad-arg.rs:38:32 | -LL | format!("{} {}", 1, 2, foo=1, bar=2); //~ ERROR: multiple unused formatting arguments +LL | format!("{} {}", 1, 2, foo=1, bar=2); | ------- ^ ^ named argument never used | | | | | named argument never used @@ -137,19 +137,19 @@ LL | format!("{} {}", 1, 2, foo=1, bar=2); //~ ERROR: multiple unused forma error: duplicate argument named `foo` --> $DIR/ifmt-bad-arg.rs:40:33 | -LL | format!("{foo}", foo=1, foo=2); //~ ERROR: duplicate argument +LL | format!("{foo}", foo=1, foo=2); | ^ | note: previously here --> $DIR/ifmt-bad-arg.rs:40:26 | -LL | format!("{foo}", foo=1, foo=2); //~ ERROR: duplicate argument +LL | format!("{foo}", foo=1, foo=2); | ^ error: expected ident, positional arguments cannot follow named arguments --> $DIR/ifmt-bad-arg.rs:41:24 | -LL | format!("", foo=1, 2); //~ ERROR: positional arguments cannot follow +LL | format!("", foo=1, 2); | ^ error: there is no argument named `valueb` @@ -169,7 +169,7 @@ LL | format!("{valuea} {valueb}", valuea=5, valuec=7); error: invalid format string: expected `'}'` but string was terminated --> $DIR/ifmt-bad-arg.rs:51:15 | -LL | format!("{"); //~ ERROR: expected `'}'` but string was terminated +LL | format!("{"); | -^ expected `'}'` in format string | | | because of this opening brace @@ -179,7 +179,7 @@ LL | format!("{"); //~ ERROR: expected `'}'` but string was terminated error: invalid format string: unmatched `}` found --> $DIR/ifmt-bad-arg.rs:53:18 | -LL | format!("foo } bar"); //~ ERROR: unmatched `}` found +LL | format!("foo } bar"); | ^ unmatched `}` in format string | = note: if you intended to print `}`, you can escape it using `}}` @@ -187,7 +187,7 @@ LL | format!("foo } bar"); //~ ERROR: unmatched `}` found error: invalid format string: unmatched `}` found --> $DIR/ifmt-bad-arg.rs:54:18 | -LL | format!("foo }"); //~ ERROR: unmatched `}` found +LL | format!("foo }"); | ^ unmatched `}` in format string | = note: if you intended to print `}`, you can escape it using `}}` @@ -195,7 +195,7 @@ LL | format!("foo }"); //~ ERROR: unmatched `}` found error: argument never used --> $DIR/ifmt-bad-arg.rs:56:27 | -LL | format!("foo %s baz", "bar"); //~ ERROR: argument never used +LL | format!("foo %s baz", "bar"); | -- ^^^^^ argument never used | | | help: format specifiers use curly braces: `{}` diff --git a/src/test/ui/if/ifmt-bad-format-args.stderr b/src/test/ui/if/ifmt-bad-format-args.stderr index 966c8d916a3b..9dc2b8f9a739 100644 --- a/src/test/ui/if/ifmt-bad-format-args.stderr +++ b/src/test/ui/if/ifmt-bad-format-args.stderr @@ -1,17 +1,17 @@ error: requires at least a format string argument --> $DIR/ifmt-bad-format-args.rs:2:5 | -LL | format_args!(); //~ ERROR: requires at least a format string argument +LL | format_args!(); | ^^^^^^^^^^^^^^^ error: format argument must be a string literal --> $DIR/ifmt-bad-format-args.rs:3:18 | -LL | format_args!(|| {}); //~ ERROR: must be a string literal +LL | format_args!(|| {}); | ^^^^^ help: you might be missing a string literal to format with | -LL | format_args!("{}", || {}); //~ ERROR: must be a string literal +LL | format_args!("{}", || {}); | ^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/illegal-ufcs-drop.stderr b/src/test/ui/illegal-ufcs-drop.stderr index d8e2dc6e8700..d35d376962c1 100644 --- a/src/test/ui/illegal-ufcs-drop.stderr +++ b/src/test/ui/illegal-ufcs-drop.stderr @@ -1,7 +1,7 @@ error[E0040]: explicit use of destructor method --> $DIR/illegal-ufcs-drop.rs:8:5 | -LL | Drop::drop(&mut Foo) //~ ERROR explicit use of destructor method +LL | Drop::drop(&mut Foo) | ^^^^^^^^^^ explicit destructor calls not allowed error: aborting due to previous error diff --git a/src/test/ui/impl-bounds-checking.stderr b/src/test/ui/impl-bounds-checking.stderr index 618a9f94aa45..b52f3d6b839d 100644 --- a/src/test/ui/impl-bounds-checking.stderr +++ b/src/test/ui/impl-bounds-checking.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `isize: Clone2` is not satisfied --> $DIR/impl-bounds-checking.rs:10:6 | -LL | impl Getter for isize { //~ ERROR `isize: Clone2` is not satisfied +LL | impl Getter for isize { | ^^^^^^^^^^^^^ the trait `Clone2` is not implemented for `isize` error: aborting due to previous error diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr index 53cd2b144118..af120fa977ca 100644 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/dyn-trait.rs:20:16 | -LL | static_val(x); //~ ERROR cannot infer +LL | static_val(x); | ^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 19:26... diff --git a/src/test/ui/impl-trait/extra-item.stderr b/src/test/ui/impl-trait/extra-item.stderr index de3c7ba5d311..728bcc0aa865 100644 --- a/src/test/ui/impl-trait/extra-item.stderr +++ b/src/test/ui/impl-trait/extra-item.stderr @@ -1,7 +1,7 @@ error[E0407]: method `extra` is not a member of trait `extra_item::MyTrait` --> $DIR/extra-item.rs:7:5 | -LL | fn extra() {} //~ ERROR method `extra` is not a member of trait `extra_item::MyTrait` +LL | fn extra() {} | ^^^^^^^^^^^^^ not a member of trait `extra_item::MyTrait` error: aborting due to previous error diff --git a/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr b/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr index 99c8fe35c66d..fb48ecd12b6d 100644 --- a/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr +++ b/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr @@ -1,7 +1,7 @@ error[E0720]: opaque type expands to a recursive type --> $DIR/infinite-impl-trait-issue-38064.rs:8:13 | -LL | fn foo() -> impl Quux { //~ opaque type expands to a recursive type +LL | fn foo() -> impl Quux { | ^^^^^^^^^ expands to self-referential type | = note: expanded type is `foo::Foo>` @@ -9,7 +9,7 @@ LL | fn foo() -> impl Quux { //~ opaque type expands to a recursive type error[E0720]: opaque type expands to a recursive type --> $DIR/infinite-impl-trait-issue-38064.rs:14:13 | -LL | fn bar() -> impl Quux { //~ opaque type expands to a recursive type +LL | fn bar() -> impl Quux { | ^^^^^^^^^ expands to self-referential type | = note: expanded type is `bar::Bar>` diff --git a/src/test/ui/impl-trait/issue-55608-captures-empty-region.stderr b/src/test/ui/impl-trait/issue-55608-captures-empty-region.stderr index d1f147834d2e..6311a7f00674 100644 --- a/src/test/ui/impl-trait/issue-55608-captures-empty-region.stderr +++ b/src/test/ui/impl-trait/issue-55608-captures-empty-region.stderr @@ -1,7 +1,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/issue-55608-captures-empty-region.rs:6:16 | -LL | fn server() -> impl FilterBase2 { //~ ERROR [E0700] +LL | fn server() -> impl FilterBase2 { | ^^^^^^^^^^^^^^^^ | = note: hidden type `Map2<[closure@$DIR/issue-55608-captures-empty-region.rs:7:36: 7:41]>` captures an empty lifetime diff --git a/src/test/ui/impl-trait/no-method-suggested-traits.stderr b/src/test/ui/impl-trait/no-method-suggested-traits.stderr index a3b118efa62c..d980d7cccadd 100644 --- a/src/test/ui/impl-trait/no-method-suggested-traits.stderr +++ b/src/test/ui/impl-trait/no-method-suggested-traits.stderr @@ -220,19 +220,19 @@ LL | std::rc::Rc::new(&mut Box::new(&Bar::X)).method3(); error[E0599]: no method named `method3` found for type `usize` in the current scope --> $DIR/no-method-suggested-traits.rs:69:13 | -LL | 1_usize.method3(); //~ ERROR no method named +LL | 1_usize.method3(); | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&usize>>` in the current scope --> $DIR/no-method-suggested-traits.rs:70:47 | -LL | std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR no method named +LL | std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); | ^^^^^^^ error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:71:37 | -LL | no_method_suggested_traits::Foo.method3(); //~ ERROR no method named +LL | no_method_suggested_traits::Foo.method3(); | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` in the current scope @@ -244,7 +244,7 @@ LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).metho error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Bar` in the current scope --> $DIR/no-method-suggested-traits.rs:74:40 | -LL | no_method_suggested_traits::Bar::X.method3(); //~ ERROR no method named +LL | no_method_suggested_traits::Bar::X.method3(); | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` in the current scope diff --git a/src/test/ui/impl-trait/no-trait.stderr b/src/test/ui/impl-trait/no-trait.stderr index 84ac1bd5ca4a..3a636f2524ff 100644 --- a/src/test/ui/impl-trait/no-trait.stderr +++ b/src/test/ui/impl-trait/no-trait.stderr @@ -1,7 +1,7 @@ error: at least one trait must be specified --> $DIR/no-trait.rs:1:11 | -LL | fn f() -> impl 'static {} //~ ERROR at least one trait must be specified +LL | fn f() -> impl 'static {} | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/impl-trait/recursive-async-impl-trait-type.stderr b/src/test/ui/impl-trait/recursive-async-impl-trait-type.stderr index acdeabb2f989..abc9ff54bdee 100644 --- a/src/test/ui/impl-trait/recursive-async-impl-trait-type.stderr +++ b/src/test/ui/impl-trait/recursive-async-impl-trait-type.stderr @@ -1,7 +1,7 @@ error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-async-impl-trait-type.rs:7:40 | -LL | async fn recursive_async_function() -> () { //~ ERROR +LL | async fn recursive_async_function() -> () { | ^^ expands to self-referential type | = note: expanded type is `std::future::GenFuture<[static generator@$DIR/recursive-async-impl-trait-type.rs:7:43: 9:2 {impl std::future::Future, ()}]>` diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type.stderr b/src/test/ui/impl-trait/recursive-impl-trait-type.stderr index 96494229fd33..fce234eb87ce 100644 --- a/src/test/ui/impl-trait/recursive-impl-trait-type.stderr +++ b/src/test/ui/impl-trait/recursive-impl-trait-type.stderr @@ -1,7 +1,7 @@ error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:6:22 | -LL | fn option(i: i32) -> impl Sized { //~ ERROR +LL | fn option(i: i32) -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `std::option::Option<(impl Sized, i32)>` @@ -9,7 +9,7 @@ LL | fn option(i: i32) -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:14:15 | -LL | fn tuple() -> impl Sized { //~ ERROR +LL | fn tuple() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `(impl Sized,)` @@ -17,7 +17,7 @@ LL | fn tuple() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:18:15 | -LL | fn array() -> impl Sized { //~ ERROR +LL | fn array() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[impl Sized; 1]` @@ -25,7 +25,7 @@ LL | fn array() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:22:13 | -LL | fn ptr() -> impl Sized { //~ ERROR +LL | fn ptr() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `*const impl Sized` @@ -33,7 +33,7 @@ LL | fn ptr() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:26:16 | -LL | fn fn_ptr() -> impl Sized { //~ ERROR +LL | fn fn_ptr() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `fn() -> impl Sized` @@ -41,7 +41,7 @@ LL | fn fn_ptr() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:30:25 | -LL | fn closure_capture() -> impl Sized { //~ ERROR +LL | fn closure_capture() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[closure@$DIR/recursive-impl-trait-type.rs:32:5: 32:19 x:impl Sized]` @@ -49,7 +49,7 @@ LL | fn closure_capture() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:35:29 | -LL | fn closure_ref_capture() -> impl Sized { //~ ERROR +LL | fn closure_ref_capture() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[closure@$DIR/recursive-impl-trait-type.rs:37:5: 37:20 x:impl Sized]` @@ -57,7 +57,7 @@ LL | fn closure_ref_capture() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:40:21 | -LL | fn closure_sig() -> impl Sized { //~ ERROR +LL | fn closure_sig() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[closure@$DIR/recursive-impl-trait-type.rs:41:5: 41:21]` @@ -65,7 +65,7 @@ LL | fn closure_sig() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:44:23 | -LL | fn generator_sig() -> impl Sized { //~ ERROR +LL | fn generator_sig() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[closure@$DIR/recursive-impl-trait-type.rs:45:5: 45:23]` @@ -73,7 +73,7 @@ LL | fn generator_sig() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:48:27 | -LL | fn generator_capture() -> impl Sized { //~ ERROR +LL | fn generator_capture() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[generator@$DIR/recursive-impl-trait-type.rs:50:5: 50:26 x:impl Sized {()}]` @@ -81,7 +81,7 @@ LL | fn generator_capture() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:53:26 | -LL | fn substs_change() -> impl Sized { //~ ERROR +LL | fn substs_change() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `(impl Sized,)` @@ -89,7 +89,7 @@ LL | fn substs_change() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:57:24 | -LL | fn generator_hold() -> impl Sized { //~ ERROR +LL | fn generator_hold() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[generator@$DIR/recursive-impl-trait-type.rs:58:5: 62:6 {impl Sized, ()}]` @@ -97,7 +97,7 @@ LL | fn generator_hold() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:69:26 | -LL | fn mutual_recursion() -> impl Sync { //~ ERROR +LL | fn mutual_recursion() -> impl Sync { | ^^^^^^^^^ expands to self-referential type | = note: type resolves to itself @@ -105,7 +105,7 @@ LL | fn mutual_recursion() -> impl Sync { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:73:28 | -LL | fn mutual_recursion_b() -> impl Sized { //~ ERROR +LL | fn mutual_recursion_b() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: type resolves to itself diff --git a/src/test/ui/impl-trait/universal-issue-48703.stderr b/src/test/ui/impl-trait/universal-issue-48703.stderr index 920b44fc909a..26ed8dbb9c75 100644 --- a/src/test/ui/impl-trait/universal-issue-48703.stderr +++ b/src/test/ui/impl-trait/universal-issue-48703.stderr @@ -1,7 +1,7 @@ error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position. --> $DIR/universal-issue-48703.rs:8:5 | -LL | foo::('a'); //~ ERROR cannot provide explicit type parameters +LL | foo::('a'); | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/impl-trait/universal-mismatched-type.stderr b/src/test/ui/impl-trait/universal-mismatched-type.stderr index 55e1216d3a8a..d223b9672cfd 100644 --- a/src/test/ui/impl-trait/universal-mismatched-type.stderr +++ b/src/test/ui/impl-trait/universal-mismatched-type.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn foo(x: impl Debug) -> String { | ------ expected `std::string::String` because of return type -LL | x //~ ERROR mismatched types +LL | x | ^ expected struct `std::string::String`, found type parameter | = note: expected type `std::string::String` diff --git a/src/test/ui/impl-trait/universal-two-impl-traits.stderr b/src/test/ui/impl-trait/universal-two-impl-traits.stderr index 43bf2862feea..145d6a8431bf 100644 --- a/src/test/ui/impl-trait/universal-two-impl-traits.stderr +++ b/src/test/ui/impl-trait/universal-two-impl-traits.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/universal-two-impl-traits.rs:5:9 | -LL | a = y; //~ ERROR mismatched +LL | a = y; | ^ expected type parameter, found a different type parameter | = note: expected type `impl Debug` (type parameter) diff --git a/src/test/ui/impl-trait/universal_wrong_bounds.stderr b/src/test/ui/impl-trait/universal_wrong_bounds.stderr index f0b685bd5ee9..1fd3ebff62a8 100644 --- a/src/test/ui/impl-trait/universal_wrong_bounds.stderr +++ b/src/test/ui/impl-trait/universal_wrong_bounds.stderr @@ -1,7 +1,7 @@ error[E0405]: cannot find trait `Debug` in this scope --> $DIR/universal_wrong_bounds.rs:9:24 | -LL | fn wants_debug(g: impl Debug) { } //~ ERROR cannot find +LL | fn wants_debug(g: impl Debug) { } | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -11,7 +11,7 @@ LL | use std::fmt::Debug; error[E0405]: cannot find trait `Debug` in this scope --> $DIR/universal_wrong_bounds.rs:10:26 | -LL | fn wants_display(g: impl Debug) { } //~ ERROR cannot find +LL | fn wants_display(g: impl Debug) { } | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/impl-unused-rps-in-assoc-type.stderr b/src/test/ui/impl-unused-rps-in-assoc-type.stderr index 80fc0504558f..c7ad1b4e608f 100644 --- a/src/test/ui/impl-unused-rps-in-assoc-type.stderr +++ b/src/test/ui/impl-unused-rps-in-assoc-type.stderr @@ -1,7 +1,7 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates --> $DIR/impl-unused-rps-in-assoc-type.rs:11:6 | -LL | impl<'a> Fun for Holder { //~ ERROR E0207 +LL | impl<'a> Fun for Holder { | ^^ unconstrained lifetime parameter error: aborting due to previous error diff --git a/src/test/ui/implicit-method-bind.stderr b/src/test/ui/implicit-method-bind.stderr index 7c70709c6b97..968272d4d2c1 100644 --- a/src/test/ui/implicit-method-bind.stderr +++ b/src/test/ui/implicit-method-bind.stderr @@ -1,7 +1,7 @@ error[E0615]: attempted to take value of method `abs` on type `i32` --> $DIR/implicit-method-bind.rs:2:20 | -LL | let _f = 10i32.abs; //~ ERROR attempted to take value of method +LL | let _f = 10i32.abs; | ^^^ help: use parentheses to call the method: `abs()` error: aborting due to previous error diff --git a/src/test/ui/import.stderr b/src/test/ui/import.stderr index bfbb6560d49d..685fff25a149 100644 --- a/src/test/ui/import.stderr +++ b/src/test/ui/import.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `zed::baz` --> $DIR/import.rs:2:5 | -LL | use zed::baz; //~ ERROR unresolved import `zed::baz` [E0432] +LL | use zed::baz; | ^^^^^--- | | | | | help: a similar name exists in the module: `bar` @@ -10,13 +10,13 @@ LL | use zed::baz; //~ ERROR unresolved import `zed::baz` [E0432] error[E0432]: unresolved import `foo` --> $DIR/import.rs:10:9 | -LL | use foo; //~ ERROR unresolved import `foo` [E0432] +LL | use foo; | ^^^ no `foo` in the root error[E0603]: unresolved item `foo` is private --> $DIR/import.rs:15:10 | -LL | zed::foo(); //~ ERROR `foo` is private +LL | zed::foo(); | ^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/import2.stderr b/src/test/ui/import2.stderr index f0509204f2ce..da888979c30f 100644 --- a/src/test/ui/import2.stderr +++ b/src/test/ui/import2.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `baz::zed` --> $DIR/import2.rs:1:10 | -LL | use baz::zed::bar; //~ ERROR unresolved import `baz::zed` [E0432] +LL | use baz::zed::bar; | ^^^ could not find `zed` in `baz` error: aborting due to previous error diff --git a/src/test/ui/imports/duplicate.stderr b/src/test/ui/imports/duplicate.stderr index 29660d908e48..7c43c642ec36 100644 --- a/src/test/ui/imports/duplicate.stderr +++ b/src/test/ui/imports/duplicate.stderr @@ -3,7 +3,7 @@ error[E0252]: the name `foo` is defined multiple times | LL | use a::foo; | ------ previous import of the value `foo` here -LL | use a::foo; //~ ERROR the name `foo` is defined multiple times +LL | use a::foo; | ----^^^^^^- | | | | | `foo` reimported here @@ -14,7 +14,7 @@ LL | use a::foo; //~ ERROR the name `foo` is defined multiple times error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) --> $DIR/duplicate.rs:46:15 | -LL | use self::foo::bar; //~ ERROR `foo` is ambiguous +LL | use self::foo::bar; | ^^^ ambiguous name | note: `foo` could refer to the module imported here @@ -33,7 +33,7 @@ LL | use self::m2::*; error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) --> $DIR/duplicate.rs:35:8 | -LL | f::foo(); //~ ERROR `foo` is ambiguous +LL | f::foo(); | ^^^ ambiguous name | note: `foo` could refer to the function imported here @@ -52,7 +52,7 @@ LL | pub use b::*; error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) --> $DIR/duplicate.rs:49:9 | -LL | foo::bar(); //~ ERROR `foo` is ambiguous +LL | foo::bar(); | ^^^ ambiguous name | note: `foo` could refer to the module imported here diff --git a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr index b47d10343f68..f26bb2f5a0ec 100644 --- a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr +++ b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr @@ -1,13 +1,13 @@ error: `extern crate self;` requires renaming --> $DIR/extern-crate-self-fail.rs:1:1 | -LL | extern crate self; //~ ERROR `extern crate self;` requires renaming +LL | extern crate self; | ^^^^^^^^^^^^^^^^^^ help: try: `extern crate self as name;` error: `macro_use` is not supported on `extern crate self` --> $DIR/extern-crate-self-fail.rs:3:1 | -LL | #[macro_use] //~ ERROR `macro_use` is not supported on `extern crate self` +LL | #[macro_use] | ^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/imports/extern-crate-used.stderr b/src/test/ui/imports/extern-crate-used.stderr index 3f9aab9dc79c..c0783feb7947 100644 --- a/src/test/ui/imports/extern-crate-used.stderr +++ b/src/test/ui/imports/extern-crate-used.stderr @@ -1,7 +1,7 @@ error: `extern crate` is not idiomatic in the new edition --> $DIR/extern-crate-used.rs:8:1 | -LL | extern crate core as iso1; //~ ERROR `extern crate` is not idiomatic in the new edition +LL | extern crate core as iso1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` | note: lint level defined here @@ -13,25 +13,25 @@ LL | #![deny(unused_extern_crates)] error: `extern crate` is not idiomatic in the new edition --> $DIR/extern-crate-used.rs:9:1 | -LL | extern crate core as iso2; //~ ERROR `extern crate` is not idiomatic in the new edition +LL | extern crate core as iso2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` error: `extern crate` is not idiomatic in the new edition --> $DIR/extern-crate-used.rs:10:1 | -LL | extern crate core as iso3; //~ ERROR `extern crate` is not idiomatic in the new edition +LL | extern crate core as iso3; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` error: `extern crate` is not idiomatic in the new edition --> $DIR/extern-crate-used.rs:11:1 | -LL | extern crate core as iso4; //~ ERROR `extern crate` is not idiomatic in the new edition +LL | extern crate core as iso4; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` error: unused extern crate --> $DIR/extern-crate-used.rs:14:1 | -LL | extern crate core; //~ ERROR unused extern crate +LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ help: remove it error: aborting due to 5 previous errors diff --git a/src/test/ui/imports/extern-prelude-extern-crate-fail.stderr b/src/test/ui/imports/extern-prelude-extern-crate-fail.stderr index baeed02517d1..e067432b3923 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-fail.stderr +++ b/src/test/ui/imports/extern-prelude-extern-crate-fail.stderr @@ -10,7 +10,7 @@ LL | define_std_as_non_existent!(); error[E0433]: failed to resolve: use of undeclared type or module `two_macros` --> $DIR/extern-prelude-extern-crate-fail.rs:10:9 | -LL | two_macros::m!(); //~ ERROR failed to resolve: use of undeclared type or module `two_macros` +LL | two_macros::m!(); | ^^^^^^^^^^ use of undeclared type or module `two_macros` error: aborting due to 2 previous errors 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 795e1761ccdb..24b1b582d1ea 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 @@ -10,7 +10,7 @@ LL | define_other_core!(); 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:13:9 | -LL | Vec::panic!(); //~ ERROR `Vec` is ambiguous +LL | Vec::panic!(); | ^^^ ambiguous name | = note: `Vec` could refer to a struct from prelude diff --git a/src/test/ui/imports/glob-conflict-cross-crate.stderr b/src/test/ui/imports/glob-conflict-cross-crate.stderr index f5a82ef1b3b0..ad70b7d5b91b 100644 --- a/src/test/ui/imports/glob-conflict-cross-crate.stderr +++ b/src/test/ui/imports/glob-conflict-cross-crate.stderr @@ -1,13 +1,13 @@ error[E0425]: cannot find function `f` in module `glob_conflict` --> $DIR/glob-conflict-cross-crate.rs:6:20 | -LL | glob_conflict::f(); //~ ERROR cannot find function `f` in module `glob_conflict` +LL | glob_conflict::f(); | ^ not found in `glob_conflict` error[E0425]: cannot find function `f` in module `glob_conflict::glob` --> $DIR/glob-conflict-cross-crate.rs:7:26 | -LL | glob_conflict::glob::f(); //~ ERROR cannot find function `f` in module `glob_conflict::glob` +LL | glob_conflict::glob::f(); | ^ not found in `glob_conflict::glob` error: aborting due to 2 previous errors diff --git a/src/test/ui/imports/glob-shadowing.stderr b/src/test/ui/imports/glob-shadowing.stderr index c43ab00e718a..7962fcb9aec1 100644 --- a/src/test/ui/imports/glob-shadowing.stderr +++ b/src/test/ui/imports/glob-shadowing.stderr @@ -1,7 +1,7 @@ error[E0659]: `env` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) --> $DIR/glob-shadowing.rs:11:17 | -LL | let x = env!("PATH"); //~ ERROR `env` is ambiguous +LL | let x = env!("PATH"); | ^^^ ambiguous name | = note: `env` could refer to a built-in macro @@ -16,7 +16,7 @@ LL | use m::*; error[E0659]: `env` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) --> $DIR/glob-shadowing.rs:19:21 | -LL | let x = env!("PATH"); //~ ERROR `env` is ambiguous +LL | let x = env!("PATH"); | ^^^ ambiguous name | = note: `env` could refer to a built-in macro @@ -30,7 +30,7 @@ LL | use m::*; error[E0659]: `fenv` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) --> $DIR/glob-shadowing.rs:29:21 | -LL | let x = fenv!(); //~ ERROR `fenv` is ambiguous +LL | let x = fenv!(); | ^^^^ ambiguous name | note: `fenv` could refer to the macro imported here diff --git a/src/test/ui/imports/import-from-missing.stderr b/src/test/ui/imports/import-from-missing.stderr index 0524b1675645..4254bfb5efb5 100644 --- a/src/test/ui/imports/import-from-missing.stderr +++ b/src/test/ui/imports/import-from-missing.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `spam::eggs` --> $DIR/import-from-missing.rs:1:17 | -LL | use spam::{ham, eggs}; //~ ERROR unresolved import `spam::eggs` [E0432] +LL | use spam::{ham, eggs}; | ^^^^ no `eggs` in `spam` error: aborting due to previous error diff --git a/src/test/ui/imports/import-glob-0.stderr b/src/test/ui/imports/import-glob-0.stderr index 4fecf80bff22..820ff1bb536d 100644 --- a/src/test/ui/imports/import-glob-0.stderr +++ b/src/test/ui/imports/import-glob-0.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `f999` in this scope --> $DIR/import-glob-0.rs:14:5 | -LL | f999(); //~ ERROR cannot find function `f999` in this scope +LL | f999(); | ^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/imports/import-glob-circular.stderr b/src/test/ui/imports/import-glob-circular.stderr index 30586132c352..86bbea579ae2 100644 --- a/src/test/ui/imports/import-glob-circular.stderr +++ b/src/test/ui/imports/import-glob-circular.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `f1066` in this scope --> $DIR/import-glob-circular.rs:16:17 | -LL | fn test() { f1066(); } //~ ERROR cannot find function `f1066` in this scope +LL | fn test() { f1066(); } | ^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/imports/import-prefix-macro-1.stderr b/src/test/ui/imports/import-prefix-macro-1.stderr index 76e543a9f271..577f12824716 100644 --- a/src/test/ui/imports/import-prefix-macro-1.stderr +++ b/src/test/ui/imports/import-prefix-macro-1.stderr @@ -1,7 +1,7 @@ error: expected one of `::`, `;`, or `as`, found `{` --> $DIR/import-prefix-macro-1.rs:11:27 | -LL | ($p: path) => (use $p {S, Z}); //~ERROR expected one of `::`, `;`, or `as`, found `{` +LL | ($p: path) => (use $p {S, Z}); | ^ expected one of `::`, `;`, or `as` here ... LL | import! { a::b::c } diff --git a/src/test/ui/imports/import-prefix-macro-2.stderr b/src/test/ui/imports/import-prefix-macro-2.stderr index fa3c90d9ed29..8428dce2728a 100644 --- a/src/test/ui/imports/import-prefix-macro-2.stderr +++ b/src/test/ui/imports/import-prefix-macro-2.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `a::b::c` --> $DIR/import-prefix-macro-2.rs:11:26 | -LL | ($p: path) => (use ::$p {S, Z}); //~ERROR expected identifier, found `a::b::c` +LL | ($p: path) => (use ::$p {S, Z}); | ^^ expected identifier ... LL | import! { a::b::c } diff --git a/src/test/ui/imports/import-trait-method.stderr b/src/test/ui/imports/import-trait-method.stderr index 00cfb42ddd4f..3c26907d3d06 100644 --- a/src/test/ui/imports/import-trait-method.stderr +++ b/src/test/ui/imports/import-trait-method.stderr @@ -1,7 +1,7 @@ error[E0253]: `foo` is not directly importable --> $DIR/import-trait-method.rs:5:5 | -LL | use Foo::foo; //~ ERROR not directly importable +LL | use Foo::foo; | ^^^^^^^^ cannot be imported directly error: aborting due to previous error diff --git a/src/test/ui/imports/issue-53269.stderr b/src/test/ui/imports/issue-53269.stderr index 0163ee8bceb4..fc4ca3d0e53f 100644 --- a/src/test/ui/imports/issue-53269.stderr +++ b/src/test/ui/imports/issue-53269.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `nonexistent_module` --> $DIR/issue-53269.rs:6:9 | -LL | use nonexistent_module::mac; //~ ERROR unresolved import `nonexistent_module` +LL | use nonexistent_module::mac; | ^^^^^^^^^^^^^^^^^^ maybe a missing `extern crate nonexistent_module;`? error[E0659]: `mac` is ambiguous (`macro_rules` vs non-`macro_rules` from other module) --> $DIR/issue-53269.rs:8:5 | -LL | mac!(); //~ ERROR `mac` is ambiguous +LL | mac!(); | ^^^ ambiguous name | note: `mac` could refer to the macro defined here @@ -18,7 +18,7 @@ LL | macro_rules! mac { () => () } note: `mac` could also refer to the unresolved item imported here --> $DIR/issue-53269.rs:6:9 | -LL | use nonexistent_module::mac; //~ ERROR unresolved import `nonexistent_module` +LL | use nonexistent_module::mac; | ^^^^^^^^^^^^^^^^^^^^^^^ = help: use `self::mac` to refer to this unresolved item unambiguously diff --git a/src/test/ui/imports/issue-53512.stderr b/src/test/ui/imports/issue-53512.stderr index a733013be5f2..f902fc488882 100644 --- a/src/test/ui/imports/issue-53512.stderr +++ b/src/test/ui/imports/issue-53512.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `std::assert` --> $DIR/issue-53512.rs:3:5 | -LL | use std::assert; //~ ERROR unresolved import `std::assert` +LL | use std::assert; | ^^^^^^^^^^^ no `assert` in the root error: aborting due to previous error diff --git a/src/test/ui/imports/issue-55457.stderr b/src/test/ui/imports/issue-55457.stderr index a3474b2f7dbf..86a76c1d89c7 100644 --- a/src/test/ui/imports/issue-55457.stderr +++ b/src/test/ui/imports/issue-55457.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `NonExistent` --> $DIR/issue-55457.rs:1:5 | -LL | use NonExistent; //~ ERROR unresolved import `NonExistent` +LL | use NonExistent; | ^^^^^^^^^^^ | | | no `NonExistent` in the root @@ -10,13 +10,13 @@ LL | use NonExistent; //~ ERROR unresolved import `NonExistent` error[E0432]: unresolved import `non_existent` --> $DIR/issue-55457.rs:2:5 | -LL | use non_existent::non_existent; //~ ERROR unresolved import `non_existent` +LL | use non_existent::non_existent; | ^^^^^^^^^^^^ maybe a missing `extern crate non_existent;`? error: cannot determine resolution for the derive macro `NonExistent` --> $DIR/issue-55457.rs:5:10 | -LL | #[derive(NonExistent)] //~ ERROR cannot determine resolution for the derive macro `NonExistent` +LL | #[derive(NonExistent)] | ^^^^^^^^^^^ | = note: import resolution is stuck, try simplifying macro imports @@ -24,7 +24,7 @@ LL | #[derive(NonExistent)] //~ ERROR cannot determine resolution for the derive error: cannot determine resolution for the attribute macro `non_existent` --> $DIR/issue-55457.rs:4:3 | -LL | #[non_existent] //~ ERROR cannot determine resolution for the attribute macro `non_existent` +LL | #[non_existent] | ^^^^^^^^^^^^ | = note: import resolution is stuck, try simplifying macro imports diff --git a/src/test/ui/imports/issue-55884-1.stderr b/src/test/ui/imports/issue-55884-1.stderr index 477e859d0815..a7a7cc8879e6 100644 --- a/src/test/ui/imports/issue-55884-1.stderr +++ b/src/test/ui/imports/issue-55884-1.stderr @@ -1,7 +1,7 @@ error[E0659]: `S` is ambiguous (glob import vs glob import in the same module) --> $DIR/issue-55884-1.rs:19:12 | -LL | use m::S; //~ ERROR `S` is ambiguous +LL | use m::S; | ^ ambiguous name | note: `S` could refer to the struct imported here diff --git a/src/test/ui/imports/issue-55884-2.stderr b/src/test/ui/imports/issue-55884-2.stderr index f8a6cb4a5809..d3b43783ee9c 100644 --- a/src/test/ui/imports/issue-55884-2.stderr +++ b/src/test/ui/imports/issue-55884-2.stderr @@ -1,7 +1,7 @@ error[E0603]: struct `ParseOptions` is private --> $DIR/issue-55884-2.rs:12:17 | -LL | pub use parser::ParseOptions; //~ ERROR struct `ParseOptions` is private +LL | pub use parser::ParseOptions; | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/imports/issue-56125.stderr b/src/test/ui/imports/issue-56125.stderr index 844962b910a6..26d2fa06dd27 100644 --- a/src/test/ui/imports/issue-56125.stderr +++ b/src/test/ui/imports/issue-56125.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `empty::issue_56125` --> $DIR/issue-56125.rs:17:9 | -LL | use empty::issue_56125; //~ ERROR unresolved import `empty::issue_56125` +LL | use empty::issue_56125; | ^^^^^^^^^^^^^^^^^^ no `issue_56125` in `m3::empty` error[E0659]: `issue_56125` is ambiguous (name vs any other name during import resolution) @@ -37,7 +37,7 @@ LL | use issue_56125::non_last_segment::non_last_segment::*; error[E0659]: `issue_56125` is ambiguous (name vs any other name during import resolution) --> $DIR/issue-56125.rs:18:9 | -LL | use issue_56125::*; //~ ERROR `issue_56125` is ambiguous +LL | use issue_56125::*; | ^^^^^^^^^^^ ambiguous name | = note: `issue_56125` could refer to an extern crate passed with `--extern` @@ -45,7 +45,7 @@ LL | use issue_56125::*; //~ ERROR `issue_56125` is ambiguous note: `issue_56125` could also refer to the module imported here --> $DIR/issue-56125.rs:18:9 | -LL | use issue_56125::*; //~ ERROR `issue_56125` is ambiguous +LL | use issue_56125::*; | ^^^^^^^^^^^^^^ = help: use `self::issue_56125` to refer to this module unambiguously diff --git a/src/test/ui/imports/issue-57015.stderr b/src/test/ui/imports/issue-57015.stderr index b0fcf5bec6a7..d200d23ab28e 100644 --- a/src/test/ui/imports/issue-57015.stderr +++ b/src/test/ui/imports/issue-57015.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `single_err::something` --> $DIR/issue-57015.rs:10:5 | -LL | use single_err::something; //~ ERROR unresolved import `single_err::something` +LL | use single_err::something; | ^^^^^^^^^^^^^^^^^^^^^ no `something` in `single_err` error: aborting due to previous error diff --git a/src/test/ui/imports/issue-57539.stderr b/src/test/ui/imports/issue-57539.stderr index 3f745fd8204b..ebf27ca54bc4 100644 --- a/src/test/ui/imports/issue-57539.stderr +++ b/src/test/ui/imports/issue-57539.stderr @@ -1,7 +1,7 @@ error[E0659]: `core` is ambiguous (name vs any other name during import resolution) --> $DIR/issue-57539.rs:4:9 | -LL | use core; //~ ERROR `core` is ambiguous +LL | use core; | ^^^^ ambiguous name | = note: `core` could refer to a built-in extern crate diff --git a/src/test/ui/imports/local-modularized-tricky-fail-1.stderr b/src/test/ui/imports/local-modularized-tricky-fail-1.stderr index 21f75afb3f74..d7ae8e6d505d 100644 --- a/src/test/ui/imports/local-modularized-tricky-fail-1.stderr +++ b/src/test/ui/imports/local-modularized-tricky-fail-1.stderr @@ -1,7 +1,7 @@ error[E0659]: `exported` is ambiguous (glob import vs macro-expanded name in the same module during import/macro resolution) --> $DIR/local-modularized-tricky-fail-1.rs:28:1 | -LL | exported!(); //~ ERROR `exported` is ambiguous +LL | exported!(); | ^^^^^^^^ ambiguous name | note: `exported` could refer to the macro defined here @@ -24,7 +24,7 @@ LL | use inner1::*; error[E0659]: `include` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/local-modularized-tricky-fail-1.rs:47:1 | -LL | include!(); //~ ERROR `include` is ambiguous +LL | include!(); | ^^^^^^^ ambiguous name | = note: `include` could refer to a built-in macro @@ -43,7 +43,7 @@ LL | define_include!(); error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/local-modularized-tricky-fail-1.rs:35:5 | -LL | panic!(); //~ ERROR `panic` is ambiguous +LL | panic!(); | ^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude @@ -62,7 +62,7 @@ LL | define_panic!(); error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/local-modularized-tricky-fail-1.rs:35:5 | -LL | panic!(); //~ ERROR `panic` is ambiguous +LL | panic!(); | ^^^^^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude diff --git a/src/test/ui/imports/local-modularized-tricky-fail-2.stderr b/src/test/ui/imports/local-modularized-tricky-fail-2.stderr index 40cb10ced16f..a26f0cbec724 100644 --- a/src/test/ui/imports/local-modularized-tricky-fail-2.stderr +++ b/src/test/ui/imports/local-modularized-tricky-fail-2.stderr @@ -4,7 +4,7 @@ error[E0658]: non-ascii idents are not fully supported. (see issue #55467) LL | exported!(); | ------------ in this macro invocation ... -LL | () => ( struct Б; ) //~ ERROR non-ascii idents are not fully supported +LL | () => ( struct Б; ) | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -15,7 +15,7 @@ error[E0658]: non-ascii idents are not fully supported. (see issue #55467) LL | panic!(); | --------- in this macro invocation ... -LL | () => ( struct Г; ) //~ ERROR non-ascii idents are not fully supported +LL | () => ( struct Г; ) | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -26,7 +26,7 @@ error[E0658]: non-ascii idents are not fully supported. (see issue #55467) LL | include!(); | ----------- in this macro invocation ... -LL | () => ( struct Д; ) //~ ERROR non-ascii idents are not fully supported +LL | () => ( struct Д; ) | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable diff --git a/src/test/ui/imports/macro-paths.stderr b/src/test/ui/imports/macro-paths.stderr index 36290b2d93e6..a5b90008272c 100644 --- a/src/test/ui/imports/macro-paths.stderr +++ b/src/test/ui/imports/macro-paths.stderr @@ -1,7 +1,7 @@ error[E0659]: `bar` is ambiguous (glob import vs macro-expanded name in the same module during import/macro resolution) --> $DIR/macro-paths.rs:13:5 | -LL | bar::m! { //~ ERROR ambiguous +LL | bar::m! { | ^^^ ambiguous name | note: `bar` could refer to the module defined here @@ -19,7 +19,7 @@ LL | use foo::*; error[E0659]: `baz` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/macro-paths.rs:23:5 | -LL | baz::m! { //~ ERROR ambiguous +LL | baz::m! { | ^^^ ambiguous name | note: `baz` could refer to the module defined here diff --git a/src/test/ui/imports/macros.stderr b/src/test/ui/imports/macros.stderr index 5a15bf0ae71c..3b9e6feebd7e 100644 --- a/src/test/ui/imports/macros.stderr +++ b/src/test/ui/imports/macros.stderr @@ -1,7 +1,7 @@ error[E0659]: `m` is ambiguous (glob import vs macro-expanded name in the same module during import/macro resolution) --> $DIR/macros.rs:16:5 | -LL | m! { //~ ERROR ambiguous +LL | m! { | ^ ambiguous name | note: `m` could refer to the macro imported here @@ -19,7 +19,7 @@ LL | use two_macros::*; error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/macros.rs:29:9 | -LL | m! { //~ ERROR ambiguous +LL | m! { | ^ ambiguous name | note: `m` could refer to the macro imported here diff --git a/src/test/ui/imports/reexports.stderr b/src/test/ui/imports/reexports.stderr index 964e847392af..7726343ba6e3 100644 --- a/src/test/ui/imports/reexports.stderr +++ b/src/test/ui/imports/reexports.stderr @@ -1,31 +1,31 @@ error[E0364]: `foo` is private, and cannot be re-exported --> $DIR/reexports.rs:6:17 | -LL | pub use super::foo; //~ ERROR cannot be re-exported +LL | pub use super::foo; | ^^^^^^^^^^ | note: consider marking `foo` as `pub` in the imported module --> $DIR/reexports.rs:6:17 | -LL | pub use super::foo; //~ ERROR cannot be re-exported +LL | pub use super::foo; | ^^^^^^^^^^ error: A non-empty glob must import something with the glob's visibility --> $DIR/reexports.rs:7:17 | -LL | pub use super::*; //~ ERROR must import something with the glob's visibility +LL | pub use super::*; | ^^^^^^^^ error[E0603]: module `foo` is private --> $DIR/reexports.rs:28:15 | -LL | use b::a::foo::S; //~ ERROR `foo` +LL | use b::a::foo::S; | ^^^ error[E0603]: module `foo` is private --> $DIR/reexports.rs:29:15 | -LL | use b::b::foo::S as T; //~ ERROR `foo` +LL | use b::b::foo::S as T; | ^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/imports/rfc-1560-warning-cycle.stderr b/src/test/ui/imports/rfc-1560-warning-cycle.stderr index 16caf68e14fd..d79c719d8264 100644 --- a/src/test/ui/imports/rfc-1560-warning-cycle.stderr +++ b/src/test/ui/imports/rfc-1560-warning-cycle.stderr @@ -1,7 +1,7 @@ error[E0659]: `Foo` is ambiguous (glob import vs glob import in the same module) --> $DIR/rfc-1560-warning-cycle.rs:9:17 | -LL | fn f(_: Foo) {} //~ ERROR `Foo` is ambiguous +LL | fn f(_: Foo) {} | ^^^ ambiguous name | note: `Foo` could refer to the struct imported here diff --git a/src/test/ui/imports/shadow_builtin_macros.stderr b/src/test/ui/imports/shadow_builtin_macros.stderr index db4ee1128f42..c84226ef313c 100644 --- a/src/test/ui/imports/shadow_builtin_macros.stderr +++ b/src/test/ui/imports/shadow_builtin_macros.stderr @@ -1,7 +1,7 @@ error[E0659]: `panic` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) --> $DIR/shadow_builtin_macros.rs:15:14 | -LL | fn f() { panic!(); } //~ ERROR ambiguous +LL | fn f() { panic!(); } | ^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude @@ -16,7 +16,7 @@ LL | use foo::*; error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/shadow_builtin_macros.rs:20:14 | -LL | fn f() { panic!(); } //~ ERROR ambiguous +LL | fn f() { panic!(); } | ^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude @@ -30,7 +30,7 @@ LL | ::two_macros::m!(use foo::panic;); error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/shadow_builtin_macros.rs:33:5 | -LL | panic!(); //~ ERROR `panic` is ambiguous +LL | panic!(); | ^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude @@ -46,7 +46,7 @@ LL | m!(); error[E0659]: `n` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) --> $DIR/shadow_builtin_macros.rs:49:5 | -LL | n!(); //~ ERROR ambiguous +LL | n!(); | ^ ambiguous name | note: `n` could refer to the macro imported here diff --git a/src/test/ui/imports/unused-macro-use.stderr b/src/test/ui/imports/unused-macro-use.stderr index 2d20b3114426..78683147f7ba 100644 --- a/src/test/ui/imports/unused-macro-use.stderr +++ b/src/test/ui/imports/unused-macro-use.stderr @@ -1,7 +1,7 @@ error: unused `#[macro_use]` import --> $DIR/unused-macro-use.rs:3:1 | -LL | #[macro_use] //~ ERROR unused `#[macro_use]` import +LL | #[macro_use] | ^^^^^^^^^^^^ | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![deny(unused)] error: unused `#[macro_use]` import --> $DIR/unused-macro-use.rs:7:5 | -LL | panic //~ ERROR unused `#[macro_use]` import +LL | panic | ^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/imports/unused.stderr b/src/test/ui/imports/unused.stderr index b56e930158cc..259ed9586962 100644 --- a/src/test/ui/imports/unused.stderr +++ b/src/test/ui/imports/unused.stderr @@ -1,7 +1,7 @@ error: unused import: `super::f` --> $DIR/unused.rs:7:24 | -LL | pub(super) use super::f; //~ ERROR unused +LL | pub(super) use super::f; | ^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/impossible_range.stderr b/src/test/ui/impossible_range.stderr index 1d26030625fc..091fe37c7a1f 100644 --- a/src/test/ui/impossible_range.stderr +++ b/src/test/ui/impossible_range.stderr @@ -1,7 +1,7 @@ error[E0586]: inclusive range with no end --> $DIR/impossible_range.rs:8:8 | -LL | ..=; //~ERROR inclusive range with no end +LL | ..=; | ^ | = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) @@ -9,7 +9,7 @@ LL | ..=; //~ERROR inclusive range with no end error[E0586]: inclusive range with no end --> $DIR/impossible_range.rs:15:9 | -LL | 0..=; //~ERROR inclusive range with no end +LL | 0..=; | ^ | = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) diff --git a/src/test/ui/in-band-lifetimes/E0687.stderr b/src/test/ui/in-band-lifetimes/E0687.stderr index 74245e16e7f2..7aea2f220466 100644 --- a/src/test/ui/in-band-lifetimes/E0687.stderr +++ b/src/test/ui/in-band-lifetimes/E0687.stderr @@ -1,25 +1,25 @@ error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders --> $DIR/E0687.rs:4:15 | -LL | fn foo(x: fn(&'a u32)) {} //~ ERROR must be explicitly +LL | fn foo(x: fn(&'a u32)) {} | ^^ in-band lifetime definition error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders --> $DIR/E0687.rs:6:16 | -LL | fn bar(x: &Fn(&'a u32)) {} //~ ERROR must be explicitly +LL | fn bar(x: &Fn(&'a u32)) {} | ^^ in-band lifetime definition error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders --> $DIR/E0687.rs:8:15 | -LL | fn baz(x: fn(&'a u32), y: &'a u32) {} //~ ERROR must be explicitly +LL | fn baz(x: fn(&'a u32), y: &'a u32) {} | ^^ in-band lifetime definition error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders --> $DIR/E0687.rs:13:26 | -LL | fn bar(&self, x: fn(&'a u32)) {} //~ ERROR must be explicitly +LL | fn bar(&self, x: fn(&'a u32)) {} | ^^ in-band lifetime definition error: aborting due to 4 previous errors diff --git a/src/test/ui/in-band-lifetimes/E0687_where.stderr b/src/test/ui/in-band-lifetimes/E0687_where.stderr index 4533c3b10f79..af0f9665f5d0 100644 --- a/src/test/ui/in-band-lifetimes/E0687_where.stderr +++ b/src/test/ui/in-band-lifetimes/E0687_where.stderr @@ -1,13 +1,13 @@ error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders --> $DIR/E0687_where.rs:4:31 | -LL | fn bar(x: &F) where F: Fn(&'a u32) {} //~ ERROR must be explicitly +LL | fn bar(x: &F) where F: Fn(&'a u32) {} | ^^ in-band lifetime definition error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders --> $DIR/E0687_where.rs:6:21 | -LL | fn baz(x: &impl Fn(&'a u32)) {} //~ ERROR must be explicitly +LL | fn baz(x: &impl Fn(&'a u32)) {} | ^^ in-band lifetime definition error: aborting due to 2 previous errors diff --git a/src/test/ui/in-band-lifetimes/E0688.stderr b/src/test/ui/in-band-lifetimes/E0688.stderr index f02b8db4669e..afefcd9fc2c6 100644 --- a/src/test/ui/in-band-lifetimes/E0688.stderr +++ b/src/test/ui/in-band-lifetimes/E0688.stderr @@ -1,7 +1,7 @@ error[E0688]: cannot mix in-band and explicit lifetime definitions --> $DIR/E0688.rs:4:28 | -LL | fn foo<'a>(x: &'a u32, y: &'b u32) {} //~ ERROR cannot mix +LL | fn foo<'a>(x: &'a u32, y: &'b u32) {} | -- ^^ in-band lifetime definition here | | | explicit lifetime definition here @@ -9,7 +9,7 @@ LL | fn foo<'a>(x: &'a u32, y: &'b u32) {} //~ ERROR cannot mix error[E0688]: cannot mix in-band and explicit lifetime definitions --> $DIR/E0688.rs:9:44 | -LL | fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} //~ ERROR cannot mix +LL | fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} | -- ^^ in-band lifetime definition here | | | explicit lifetime definition here @@ -17,7 +17,7 @@ LL | fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} //~ ERROR cannot mix error[E0688]: cannot mix in-band and explicit lifetime definitions --> $DIR/E0688.rs:12:14 | -LL | impl<'b> Foo<'a> { //~ ERROR cannot mix +LL | impl<'b> Foo<'a> { | -- ^^ in-band lifetime definition here | | | explicit lifetime definition here diff --git a/src/test/ui/in-band-lifetimes/mismatched.stderr b/src/test/ui/in-band-lifetimes/mismatched.stderr index abc6d42910fb..9d33aaf4c36f 100644 --- a/src/test/ui/in-band-lifetimes/mismatched.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched.stderr @@ -1,7 +1,7 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/mismatched.rs:4:42 | -LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required +LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } | ---- ^ lifetime `'a` required | | | help: add explicit lifetime `'a` to the type of `y`: `&'a u32` @@ -9,7 +9,7 @@ LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime re error[E0623]: lifetime mismatch --> $DIR/mismatched.rs:6:46 | -LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch +LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } | ------- ------- ^ ...but data from `y` is returned here | | | this parameter and the return type are declared with different lifetimes... diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait.stderr index dd28aa226b7f..ac66daa21c7a 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `y` | LL | fn baz(&self, x: &'a u32, y: &u32) -> &'a u32 { | ---- help: add explicit lifetime `'a` to the type of `y`: `&'a u32` -LL | y //~ ERROR explicit lifetime required +LL | y | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr index 4af991cede43..a80ebaf8dd29 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr @@ -1,20 +1,20 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements --> $DIR/mismatched_trait_impl.rs:9:5 | -LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer +LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 9:5... --> $DIR/mismatched_trait_impl.rs:9:5 | -LL | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer +LL | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { LL | | x LL | | } | |_____^ note: ...but the lifetime must also be valid for the lifetime 'a as defined on the method body at 9:32... --> $DIR/mismatched_trait_impl.rs:9:32 | -LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer +LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { | ^^ = note: ...so that the method type is compatible with trait: expected fn(&i32, &'a u32, &u32) -> &'a u32 diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr b/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr index e710986c7217..556c15d0edbb 100644 --- a/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr +++ b/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr @@ -3,7 +3,7 @@ error[E0506]: cannot assign to `p` because it is borrowed | LL | let r = foo(&p); | - borrow of `p` occurs here -LL | p += 1; //~ ERROR cannot assign to `p` because it is borrowed +LL | p += 1; | ^^^^^^ assignment to borrowed `p` occurs here error: aborting due to previous error diff --git a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr index 9076bdc946a3..a270dd03926d 100644 --- a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr +++ b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr @@ -1,13 +1,13 @@ error[E0261]: use of undeclared lifetime name `'test` --> $DIR/no_in_band_in_struct.rs:5:9 | -LL | x: &'test u32, //~ ERROR undeclared lifetime +LL | x: &'test u32, | ^^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'test` --> $DIR/no_in_band_in_struct.rs:9:10 | -LL | Baz(&'test u32), //~ ERROR undeclared lifetime +LL | Baz(&'test u32), | ^^^^^ undeclared lifetime error: aborting due to 2 previous errors diff --git a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr index 932dea5b2a95..c307066be6b4 100644 --- a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr +++ b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr @@ -1,13 +1,13 @@ error[E0261]: use of undeclared lifetime name `'test` --> $DIR/no_introducing_in_band_in_locals.rs:5:13 | -LL | let y: &'test u32 = x; //~ ERROR use of undeclared lifetime +LL | let y: &'test u32 = x; | ^^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'test` --> $DIR/no_introducing_in_band_in_locals.rs:10:16 | -LL | let y: fn(&'test u32) = foo2; //~ ERROR use of undeclared lifetime +LL | let y: fn(&'test u32) = foo2; | ^^^^^ undeclared lifetime error: aborting due to 2 previous errors diff --git a/src/test/ui/in-band-lifetimes/shadow.stderr b/src/test/ui/in-band-lifetimes/shadow.stderr index ac5bd5b5a332..a0a15d3aa888 100644 --- a/src/test/ui/in-band-lifetimes/shadow.stderr +++ b/src/test/ui/in-band-lifetimes/shadow.stderr @@ -3,7 +3,7 @@ error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scop | LL | impl Foo<&'s u8> { | -- first declared here -LL | fn bar<'s>(&self, x: &'s u8) {} //~ ERROR shadows a lifetime name +LL | fn bar<'s>(&self, x: &'s u8) {} | ^^ lifetime 's already in scope error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scope @@ -11,8 +11,8 @@ error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scop | LL | impl Foo<&'s u8> { | -- first declared here -LL | fn bar<'s>(&self, x: &'s u8) {} //~ ERROR shadows a lifetime name -LL | fn baz(x: for<'s> fn(&'s u32)) {} //~ ERROR shadows a lifetime name +LL | fn bar<'s>(&self, x: &'s u8) {} +LL | fn baz(x: for<'s> fn(&'s u32)) {} | ^^ lifetime 's already in scope error: aborting due to 2 previous errors diff --git a/src/test/ui/inaccessible-test-modules.stderr b/src/test/ui/inaccessible-test-modules.stderr index 40f2b7fd2eeb..b6a817e6b1d3 100644 --- a/src/test/ui/inaccessible-test-modules.stderr +++ b/src/test/ui/inaccessible-test-modules.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `__test` --> $DIR/inaccessible-test-modules.rs:5:5 | -LL | use __test as x; //~ ERROR unresolved import `__test` +LL | use __test as x; | ------^^^^^ | | | no `__test` in the root @@ -10,7 +10,7 @@ LL | use __test as x; //~ ERROR unresolved import `__test` error[E0432]: unresolved import `__test_reexports` --> $DIR/inaccessible-test-modules.rs:6:5 | -LL | use __test_reexports as y; //~ ERROR unresolved import `__test_reexports` +LL | use __test_reexports as y; | ----------------^^^^^ | | | no `__test_reexports` in the root diff --git a/src/test/ui/include-macros/mismatched-types.stderr b/src/test/ui/include-macros/mismatched-types.stderr index 1ee223b23f05..33204f1cfce9 100644 --- a/src/test/ui/include-macros/mismatched-types.stderr +++ b/src/test/ui/include-macros/mismatched-types.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/mismatched-types.rs:2:20 | -LL | let b: &[u8] = include_str!("file.txt"); //~ ERROR mismatched types +LL | let b: &[u8] = include_str!("file.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found str | = note: expected type `&[u8]` @@ -10,7 +10,7 @@ LL | let b: &[u8] = include_str!("file.txt"); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/mismatched-types.rs:3:19 | -LL | let s: &str = include_bytes!("file.txt"); //~ ERROR mismatched types +LL | let s: &str = include_bytes!("file.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found array of 0 elements | = note: expected type `&str` diff --git a/src/test/ui/index-bot.stderr b/src/test/ui/index-bot.stderr index 2e2a98d1d80a..b5d78297505d 100644 --- a/src/test/ui/index-bot.stderr +++ b/src/test/ui/index-bot.stderr @@ -1,7 +1,7 @@ error[E0608]: cannot index into a value of type `!` --> $DIR/index-bot.rs:2:5 | -LL | (return)[0]; //~ ERROR cannot index into a value of type `!` +LL | (return)[0]; | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/index-help.stderr b/src/test/ui/index-help.stderr index 4c585a958c14..cd4d8356749a 100644 --- a/src/test/ui/index-help.stderr +++ b/src/test/ui/index-help.stderr @@ -1,7 +1,7 @@ error[E0277]: the type `[{integer}]` cannot be indexed by `i32` --> $DIR/index-help.rs:3:5 | -LL | x[0i32]; //~ ERROR E0277 +LL | x[0i32]; | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[{integer}]>` is not implemented for `i32` diff --git a/src/test/ui/index_message.stderr b/src/test/ui/index_message.stderr index 62a14523fe9a..6c2b126734b0 100644 --- a/src/test/ui/index_message.stderr +++ b/src/test/ui/index_message.stderr @@ -1,7 +1,7 @@ error[E0608]: cannot index into a value of type `()` --> $DIR/index_message.rs:3:13 | -LL | let _ = z[0]; //~ ERROR cannot index into a value of type `()` +LL | let _ = z[0]; | ^^^^ help: to access tuple elements, use: `z.0` error: aborting due to previous error diff --git a/src/test/ui/indexing-requires-a-uint.stderr b/src/test/ui/indexing-requires-a-uint.stderr index 363c3d0d4585..0b879581ec69 100644 --- a/src/test/ui/indexing-requires-a-uint.stderr +++ b/src/test/ui/indexing-requires-a-uint.stderr @@ -1,7 +1,7 @@ error[E0277]: the type `[{integer}]` cannot be indexed by `u8` --> $DIR/indexing-requires-a-uint.rs:6:5 | -LL | [0][0u8]; //~ ERROR: the type `[{integer}]` cannot be indexed by `u8` +LL | [0][0u8]; | ^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[{integer}]>` is not implemented for `u8` diff --git a/src/test/ui/inference/inference_unstable_featured.stderr b/src/test/ui/inference/inference_unstable_featured.stderr index 5f0257851271..08cdb8cc6883 100644 --- a/src/test/ui/inference/inference_unstable_featured.stderr +++ b/src/test/ui/inference/inference_unstable_featured.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/inference_unstable_featured.rs:16:20 | -LL | assert_eq!('x'.ipu_flatten(), 0); //~ ERROR E0034 +LL | assert_eq!('x'.ipu_flatten(), 0); | ^^^^^^^^^^^ multiple `ipu_flatten` found | = note: candidate #1 is defined in an impl of the trait `inference_unstable_iterator::IpuIterator` for the type `char` diff --git a/src/test/ui/inference/inference_unstable_forced.stderr b/src/test/ui/inference/inference_unstable_forced.stderr index 3c07085a648f..067bf44bda8e 100644 --- a/src/test/ui/inference/inference_unstable_forced.stderr +++ b/src/test/ui/inference/inference_unstable_forced.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'ipu_flatten' (see issue #99999) --> $DIR/inference_unstable_forced.rs:11:20 | -LL | assert_eq!('x'.ipu_flatten(), 0); //~ ERROR E0658 +LL | assert_eq!('x'.ipu_flatten(), 0); | ^^^^^^^^^^^ | = help: add #![feature(ipu_flatten)] to the crate attributes to enable diff --git a/src/test/ui/infinite/infinite-instantiation.stderr b/src/test/ui/infinite/infinite-instantiation.stderr index 42be1411b686..976b9e36cf8c 100644 --- a/src/test/ui/infinite/infinite-instantiation.stderr +++ b/src/test/ui/infinite/infinite-instantiation.stderr @@ -2,7 +2,7 @@ error: reached the recursion limit while instantiating `function:: $DIR/infinite-instantiation.rs:23:1 | LL | / fn function(counter: usize, t: T) { -LL | | //~^ ERROR reached the recursion limit while instantiating `function:: 0 { LL | | function(counter - 1, t.to_option()); ... | diff --git a/src/test/ui/infinite/infinite-macro-expansion.stderr b/src/test/ui/infinite/infinite-macro-expansion.stderr index 9b64fba8b94d..0faf29f0b3eb 100644 --- a/src/test/ui/infinite/infinite-macro-expansion.stderr +++ b/src/test/ui/infinite/infinite-macro-expansion.stderr @@ -1,7 +1,7 @@ error: recursion limit reached while expanding the macro `recursive` --> $DIR/infinite-macro-expansion.rs:2:12 | -LL | () => (recursive!()) //~ ERROR recursion limit reached while expanding the macro `recursive` +LL | () => (recursive!()) | ^^^^^^^^^^^^ ... LL | recursive!() diff --git a/src/test/ui/infinite/infinite-recursion-const-fn.stderr b/src/test/ui/infinite/infinite-recursion-const-fn.stderr index 3ed7957d14d9..9e0530de425f 100644 --- a/src/test/ui/infinite/infinite-recursion-const-fn.stderr +++ b/src/test/ui/infinite/infinite-recursion-const-fn.stderr @@ -1,7 +1,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/infinite-recursion-const-fn.rs:3:25 | -LL | const fn a() -> usize { b() } //~ ERROR evaluation of constant value failed +LL | const fn a() -> usize { b() } | ^^^ | | | reached the configured maximum number of stack frames diff --git a/src/test/ui/infinite/infinite-vec-type-recursion.stderr b/src/test/ui/infinite/infinite-vec-type-recursion.stderr index daa18a7e9b1c..be0db56f0344 100644 --- a/src/test/ui/infinite/infinite-vec-type-recursion.stderr +++ b/src/test/ui/infinite/infinite-vec-type-recursion.stderr @@ -9,7 +9,7 @@ note: cycle used when collecting item types in top-level module --> $DIR/infinite-vec-type-recursion.rs:1:1 | LL | / type X = Vec; -LL | | //~^ ERROR cycle detected +LL | | LL | | LL | | fn main() { let b: X = Vec::new(); } | |____________________________________^ diff --git a/src/test/ui/init-unsafe.stderr b/src/test/ui/init-unsafe.stderr index dba8cc43ff22..857142dff64b 100644 --- a/src/test/ui/init-unsafe.stderr +++ b/src/test/ui/init-unsafe.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block --> $DIR/init-unsafe.rs:7:17 | -LL | let stuff = init::(); //~ ERROR call to unsafe function is unsafe +LL | let stuff = init::(); | ^^^^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/inline-asm-bad-constraint.stderr b/src/test/ui/inline-asm-bad-constraint.stderr index 1f63d4c2a48c..59066e5e7fc7 100644 --- a/src/test/ui/inline-asm-bad-constraint.stderr +++ b/src/test/ui/inline-asm-bad-constraint.stderr @@ -1,19 +1,19 @@ error[E0668]: malformed inline assembly --> $DIR/inline-asm-bad-constraint.rs:21:9 | -LL | asm!("" :"={rax"(rax)) //~ ERROR E0668 +LL | asm!("" :"={rax"(rax)) | ^^^^^^^^^^^^^^^^^^^^^^ error[E0668]: malformed inline assembly --> $DIR/inline-asm-bad-constraint.rs:29:9 | -LL | asm!("callq $0" : : "0"(foo)) //~ ERROR E0668 +LL | asm!("callq $0" : : "0"(foo)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0668]: malformed inline assembly --> $DIR/inline-asm-bad-constraint.rs:36:9 | -LL | asm!("addb $1, $0" : "={rax}"((0i32, rax))); //~ ERROR E0668 +LL | asm!("addb $1, $0" : "={rax}"((0i32, rax))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/inline-asm-bad-operand.stderr b/src/test/ui/inline-asm-bad-operand.stderr index f1de38efc036..3bb1cdda2497 100644 --- a/src/test/ui/inline-asm-bad-operand.stderr +++ b/src/test/ui/inline-asm-bad-operand.stderr @@ -1,43 +1,43 @@ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:21:24 | -LL | asm!("" :: "r"("")); //~ ERROR E0669 +LL | asm!("" :: "r"("")); | ^^ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:26:32 | -LL | asm!("ret" : : "{rdi}"(target)); //~ ERROR E0669 +LL | asm!("ret" : : "{rdi}"(target)); | ^^^^^^ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:33:29 | -LL | unsafe { asm!("" :: "i"(hello)) }; //~ ERROR E0669 +LL | unsafe { asm!("" :: "i"(hello)) }; | ^^^^^ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:41:38 | -LL | asm!("movups $1, %xmm0"::"m"(arr)); //~ ERROR E0669 +LL | asm!("movups $1, %xmm0"::"m"(arr)); | ^^^ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:48:32 | -LL | asm!("mov sp, $0"::"r"(addr)); //~ ERROR E0669 +LL | asm!("mov sp, $0"::"r"(addr)); | ^^^^ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:55:32 | -LL | asm!("mov sp, $0"::"r"(addr), //~ ERROR E0669 +LL | asm!("mov sp, $0"::"r"(addr), | ^^^^ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:56:32 | -LL | "r"("hello e0669")); //~ ERROR E0669 +LL | "r"("hello e0669")); | ^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/inner-static-type-parameter.stderr b/src/test/ui/inner-static-type-parameter.stderr index 87fb364954d9..3c14e217aeb8 100644 --- a/src/test/ui/inner-static-type-parameter.stderr +++ b/src/test/ui/inner-static-type-parameter.stderr @@ -11,7 +11,7 @@ LL | static a: Bar = Bar::What; error[E0392]: parameter `T` is never used --> $DIR/inner-static-type-parameter.rs:3:10 | -LL | enum Bar { What } //~ ERROR parameter `T` is never used +LL | enum Bar { What } | ^ unused type parameter | = help: consider removing `T` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/integral-indexing.stderr b/src/test/ui/integral-indexing.stderr index efbad86c4d31..28ef5937eaa4 100644 --- a/src/test/ui/integral-indexing.stderr +++ b/src/test/ui/integral-indexing.stderr @@ -1,7 +1,7 @@ error[E0277]: the type `[isize]` cannot be indexed by `u8` --> $DIR/integral-indexing.rs:6:5 | -LL | v[3u8]; //~ERROR : the type `[isize]` cannot be indexed by `u8` +LL | v[3u8]; | ^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `u8` @@ -10,7 +10,7 @@ LL | v[3u8]; //~ERROR : the type `[isize]` cannot be indexed by `u8` error[E0277]: the type `[isize]` cannot be indexed by `i8` --> $DIR/integral-indexing.rs:7:5 | -LL | v[3i8]; //~ERROR : the type `[isize]` cannot be indexed by `i8` +LL | v[3i8]; | ^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `i8` @@ -19,7 +19,7 @@ LL | v[3i8]; //~ERROR : the type `[isize]` cannot be indexed by `i8` error[E0277]: the type `[isize]` cannot be indexed by `u32` --> $DIR/integral-indexing.rs:8:5 | -LL | v[3u32]; //~ERROR : the type `[isize]` cannot be indexed by `u32` +LL | v[3u32]; | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `u32` @@ -28,7 +28,7 @@ LL | v[3u32]; //~ERROR : the type `[isize]` cannot be indexed by `u32` error[E0277]: the type `[isize]` cannot be indexed by `i32` --> $DIR/integral-indexing.rs:9:5 | -LL | v[3i32]; //~ERROR : the type `[isize]` cannot be indexed by `i32` +LL | v[3i32]; | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `i32` @@ -37,7 +37,7 @@ LL | v[3i32]; //~ERROR : the type `[isize]` cannot be indexed by `i32` error[E0277]: the type `[u8]` cannot be indexed by `u8` --> $DIR/integral-indexing.rs:12:5 | -LL | s.as_bytes()[3u8]; //~ERROR : the type `[u8]` cannot be indexed by `u8` +LL | s.as_bytes()[3u8]; | ^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `u8` @@ -46,7 +46,7 @@ LL | s.as_bytes()[3u8]; //~ERROR : the type `[u8]` cannot be indexed by `u8 error[E0277]: the type `[u8]` cannot be indexed by `i8` --> $DIR/integral-indexing.rs:13:5 | -LL | s.as_bytes()[3i8]; //~ERROR : the type `[u8]` cannot be indexed by `i8` +LL | s.as_bytes()[3i8]; | ^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `i8` @@ -55,7 +55,7 @@ LL | s.as_bytes()[3i8]; //~ERROR : the type `[u8]` cannot be indexed by `i8 error[E0277]: the type `[u8]` cannot be indexed by `u32` --> $DIR/integral-indexing.rs:14:5 | -LL | s.as_bytes()[3u32]; //~ERROR : the type `[u8]` cannot be indexed by `u32` +LL | s.as_bytes()[3u32]; | ^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `u32` @@ -64,7 +64,7 @@ LL | s.as_bytes()[3u32]; //~ERROR : the type `[u8]` cannot be indexed by `u3 error[E0277]: the type `[u8]` cannot be indexed by `i32` --> $DIR/integral-indexing.rs:15:5 | -LL | s.as_bytes()[3i32]; //~ERROR : the type `[u8]` cannot be indexed by `i32` +LL | s.as_bytes()[3i32]; | ^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `i32` diff --git a/src/test/ui/internal/internal-unstable-thread-local.stderr b/src/test/ui/internal/internal-unstable-thread-local.stderr index 0e25592b103c..603bdc39bdd0 100644 --- a/src/test/ui/internal/internal-unstable-thread-local.stderr +++ b/src/test/ui/internal/internal-unstable-thread-local.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'function' --> $DIR/internal-unstable-thread-local.rs:9:32 | -LL | thread_local!(static BAR: () = internal_unstable::unstable()); //~ ERROR use of unstable +LL | thread_local!(static BAR: () = internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(function)] to the crate attributes to enable diff --git a/src/test/ui/internal/internal-unstable.stderr b/src/test/ui/internal/internal-unstable.stderr index 3e1a44f082ee..5c14fed568f2 100644 --- a/src/test/ui/internal/internal-unstable.stderr +++ b/src/test/ui/internal/internal-unstable.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'function' --> $DIR/internal-unstable.rs:33:25 | -LL | pass_through_allow!(internal_unstable::unstable()); //~ ERROR use of unstable +LL | pass_through_allow!(internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(function)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | pass_through_allow!(internal_unstable::unstable()); //~ ERROR use of un error[E0658]: use of unstable library feature 'function' --> $DIR/internal-unstable.rs:35:27 | -LL | pass_through_noallow!(internal_unstable::unstable()); //~ ERROR use of unstable +LL | pass_through_noallow!(internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(function)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | pass_through_noallow!(internal_unstable::unstable()); //~ ERROR use of error[E0658]: use of unstable library feature 'function' --> $DIR/internal-unstable.rs:39:22 | -LL | println!("{:?}", internal_unstable::unstable()); //~ ERROR use of unstable +LL | println!("{:?}", internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(function)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | println!("{:?}", internal_unstable::unstable()); //~ ERROR use of unsta error[E0658]: use of unstable library feature 'function' --> $DIR/internal-unstable.rs:41:10 | -LL | bar!(internal_unstable::unstable()); //~ ERROR use of unstable +LL | bar!(internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(function)] to the crate attributes to enable @@ -33,10 +33,10 @@ LL | bar!(internal_unstable::unstable()); //~ ERROR use of unstable error[E0658]: use of unstable library feature 'function' --> $DIR/internal-unstable.rs:12:9 | -LL | internal_unstable::unstable(); //~ ERROR use of unstable +LL | internal_unstable::unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... -LL | bar!(internal_unstable::unstable()); //~ ERROR use of unstable +LL | bar!(internal_unstable::unstable()); | ------------------------------------ in this macro invocation | = help: add #![feature(function)] to the crate attributes to enable diff --git a/src/test/ui/invalid/invalid-crate-type.stderr b/src/test/ui/invalid/invalid-crate-type.stderr index 63edd04650b2..030dc96c6d64 100644 --- a/src/test/ui/invalid/invalid-crate-type.stderr +++ b/src/test/ui/invalid/invalid-crate-type.stderr @@ -1,7 +1,7 @@ error: invalid `crate_type` value --> $DIR/invalid-crate-type.rs:2:15 | -LL | #![crate_type="foo"] //~ ERROR invalid `crate_type` value +LL | #![crate_type="foo"] | ^^^^^ | = note: #[deny(unknown_crate_types)] on by default diff --git a/src/test/ui/invalid/invalid-inline.stderr b/src/test/ui/invalid/invalid-inline.stderr index fdbd25070f7f..ce29951822fd 100644 --- a/src/test/ui/invalid/invalid-inline.stderr +++ b/src/test/ui/invalid/invalid-inline.stderr @@ -1,19 +1,19 @@ error[E0535]: invalid argument --> $DIR/invalid-inline.rs:3:10 | -LL | #[inline(please_no)] //~ ERROR invalid argument +LL | #[inline(please_no)] | ^^^^^^^^^ error[E0534]: expected one argument --> $DIR/invalid-inline.rs:7:1 | -LL | #[inline(please,no)] //~ ERROR expected one argument +LL | #[inline(please,no)] | ^^^^^^^^^^^^^^^^^^^^ error[E0534]: expected one argument --> $DIR/invalid-inline.rs:11:1 | -LL | #[inline()] //~ ERROR expected one argument +LL | #[inline()] | ^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/invalid/invalid-macro-matcher.stderr b/src/test/ui/invalid/invalid-macro-matcher.stderr index 5d6c70fa30b8..dbe025b7330b 100644 --- a/src/test/ui/invalid/invalid-macro-matcher.stderr +++ b/src/test/ui/invalid/invalid-macro-matcher.stderr @@ -1,7 +1,7 @@ error: invalid macro matcher; matchers must be contained in balanced delimiters --> $DIR/invalid-macro-matcher.rs:4:5 | -LL | _ => (); //~ ERROR invalid macro matcher +LL | _ => (); | ^ error: aborting due to previous error diff --git a/src/test/ui/invalid/invalid-plugin-attr.stderr b/src/test/ui/invalid/invalid-plugin-attr.stderr index 2d7ae1f5cfed..c7b2ce47489a 100644 --- a/src/test/ui/invalid/invalid-plugin-attr.stderr +++ b/src/test/ui/invalid/invalid-plugin-attr.stderr @@ -1,7 +1,7 @@ error: unused attribute --> $DIR/invalid-plugin-attr.rs:4:1 | -LL | #[plugin(bla)] //~ ERROR unused attribute +LL | #[plugin(bla)] | ^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_attributes)] error: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] --> $DIR/invalid-plugin-attr.rs:4:1 | -LL | #[plugin(bla)] //~ ERROR unused attribute +LL | #[plugin(bla)] | ^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/invalid_crate_type_syntax.stderr b/src/test/ui/invalid_crate_type_syntax.stderr index 8d6948b583c5..cb3faedfedb8 100644 --- a/src/test/ui/invalid_crate_type_syntax.stderr +++ b/src/test/ui/invalid_crate_type_syntax.stderr @@ -1,7 +1,7 @@ error: attribute must be of the form `#[crate_type = "bin|lib|..."]` --> $DIR/invalid_crate_type_syntax.rs:2:1 | -LL | #![crate_type(lib)] //~ ERROR attribute must be of the form +LL | #![crate_type(lib)] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/invalid_dispatch_from_dyn_impls.stderr b/src/test/ui/invalid_dispatch_from_dyn_impls.stderr index 8ee0a40a529c..bd016466300d 100644 --- a/src/test/ui/invalid_dispatch_from_dyn_impls.stderr +++ b/src/test/ui/invalid_dispatch_from_dyn_impls.stderr @@ -4,7 +4,7 @@ error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs co LL | / impl DispatchFromDyn> for WrapperWithExtraField LL | | where LL | | T: DispatchFromDyn, -LL | | {} //~^^^ ERROR [E0378] +LL | | {} | |__^ | = note: extra field `1` of type `i32` is not allowed @@ -15,7 +15,7 @@ error[E0378]: implementing the `DispatchFromDyn` trait requires multiple coercio LL | / impl DispatchFromDyn> for MultiplePointers LL | | where LL | | T: Unsize, -LL | | {} //~^^^ ERROR [E0378] +LL | | {} | |__^ | = note: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced @@ -33,7 +33,7 @@ error[E0378]: structs implementing `DispatchFromDyn` may not have `#[repr(packed LL | / impl DispatchFromDyn> for HasReprC LL | | where LL | | T: Unsize, -LL | | {} //~^^^ ERROR [E0378] +LL | | {} | |__^ error: aborting due to 4 previous errors diff --git a/src/test/ui/issue-18986.stderr b/src/test/ui/issue-18986.stderr index 440782b0b1f2..6c23178c7001 100644 --- a/src/test/ui/issue-18986.stderr +++ b/src/test/ui/issue-18986.stderr @@ -1,7 +1,7 @@ error[E0574]: expected struct, variant or union type, found trait `Trait` --> $DIR/issue-18986.rs:8:9 | -LL | Trait { x: 42 } => () //~ ERROR expected struct, variant or union type, found trait `Trait` +LL | Trait { x: 42 } => () | ^^^^^ not a struct, variant or union type error: aborting due to previous error diff --git a/src/test/ui/issue-42944.stderr b/src/test/ui/issue-42944.stderr index 43fd0ffb7243..0613be0b3d0f 100644 --- a/src/test/ui/issue-42944.stderr +++ b/src/test/ui/issue-42944.stderr @@ -1,13 +1,13 @@ error[E0423]: expected function, found struct `B` --> $DIR/issue-42944.rs:9:9 | -LL | B(()); //~ ERROR expected function, found struct `B` [E0423] +LL | B(()); | ^ constructor is not visible here due to private fields error[E0425]: cannot find function `B` in this scope --> $DIR/issue-42944.rs:15:9 | -LL | B(()); //~ ERROR cannot find function `B` in this scope [E0425] +LL | B(()); | ^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/issue-53787-inline-assembler-macro.stderr b/src/test/ui/issue-53787-inline-assembler-macro.stderr index 69f380bdc9c0..047ba341cfc7 100644 --- a/src/test/ui/issue-53787-inline-assembler-macro.stderr +++ b/src/test/ui/issue-53787-inline-assembler-macro.stderr @@ -1,7 +1,7 @@ error[E0669]: invalid value for constraint in inline assembly --> $DIR/issue-53787-inline-assembler-macro.rs:21:16 | -LL | fake_jump!("FirstFunc"); //~ ERROR invalid value for constraint in inline assembly +LL | fake_jump!("FirstFunc"); | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-10200.stderr b/src/test/ui/issues/issue-10200.stderr index ac1ad118a715..544716e89b39 100644 --- a/src/test/ui/issues/issue-10200.stderr +++ b/src/test/ui/issues/issue-10200.stderr @@ -1,7 +1,7 @@ error[E0532]: expected tuple struct/variant, found function `foo` --> $DIR/issue-10200.rs:6:9 | -LL | foo(x) //~ ERROR expected tuple struct/variant, found function `foo` +LL | foo(x) | ^^^ help: a tuple struct with a similar name exists: `Foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-10291.stderr b/src/test/ui/issues/issue-10291.stderr index 9bd428950179..89ffd4537a27 100644 --- a/src/test/ui/issues/issue-10291.stderr +++ b/src/test/ui/issues/issue-10291.stderr @@ -1,7 +1,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/issue-10291.rs:3:9 | -LL | x //~ ERROR E0312 +LL | x | ^ | note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 2:65... @@ -9,7 +9,7 @@ note: ...the reference is valid for the anonymous lifetime #2 defined on the bod | LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | _________________________________________________________________^ -LL | | x //~ ERROR E0312 +LL | | x LL | | })); | |_____^ note: ...but the borrowed content is only valid for the lifetime 'x as defined on the function body at 1:9 diff --git a/src/test/ui/issues/issue-10412.stderr b/src/test/ui/issues/issue-10412.stderr index 8128ba22fdeb..48920813ae10 100644 --- a/src/test/ui/issues/issue-10412.stderr +++ b/src/test/ui/issues/issue-10412.stderr @@ -1,49 +1,49 @@ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:1:20 | -LL | trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names +LL | trait Serializable<'self, T> { | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:2:25 | -LL | fn serialize(val : &'self T) -> Vec; //~ ERROR lifetimes cannot use keyword names +LL | fn serialize(val : &'self T) -> Vec; | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:3:38 | -LL | fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names +LL | fn deserialize(repr : &[u8]) -> &'self T; | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:6:6 | -LL | impl<'self> Serializable for &'self str { //~ ERROR lifetimes cannot use keyword names +LL | impl<'self> Serializable for &'self str { | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:6:36 | -LL | impl<'self> Serializable for &'self str { //~ ERROR lifetimes cannot use keyword names +LL | impl<'self> Serializable for &'self str { | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:9:25 | -LL | fn serialize(val : &'self str) -> Vec { //~ ERROR lifetimes cannot use keyword names +LL | fn serialize(val : &'self str) -> Vec { | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:12:37 | -LL | fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names +LL | fn deserialize(repr: &[u8]) -> &'self str { | ^^^^^ error[E0106]: missing lifetime specifier --> $DIR/issue-10412.rs:6:13 | -LL | impl<'self> Serializable for &'self str { //~ ERROR lifetimes cannot use keyword names +LL | impl<'self> Serializable for &'self str { | ^^^^^^^^^^^^^^^^^ expected lifetime parameter error: aborting due to 8 previous errors diff --git a/src/test/ui/issues/issue-10465.stderr b/src/test/ui/issues/issue-10465.stderr index 41613cfa0105..6efbd8e40ef6 100644 --- a/src/test/ui/issues/issue-10465.stderr +++ b/src/test/ui/issues/issue-10465.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `foo` found for type `&b::B` in the current scope --> $DIR/issue-10465.rs:17:15 | -LL | b.foo(); //~ ERROR: no method named `foo` found +LL | b.foo(); | ^^^ | = help: items from traits can only be used if the trait is in scope diff --git a/src/test/ui/issues/issue-10545.stderr b/src/test/ui/issues/issue-10545.stderr index e486a17bda94..59d4fedcd2b4 100644 --- a/src/test/ui/issues/issue-10545.stderr +++ b/src/test/ui/issues/issue-10545.stderr @@ -1,7 +1,7 @@ error[E0603]: struct `S` is private --> $DIR/issue-10545.rs:6:14 | -LL | fn foo(_: a::S) { //~ ERROR: struct `S` is private +LL | fn foo(_: a::S) { | ^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-10969.stderr b/src/test/ui/issues/issue-10969.stderr index 0eaed9464b41..9e28a665e30f 100644 --- a/src/test/ui/issues/issue-10969.stderr +++ b/src/test/ui/issues/issue-10969.stderr @@ -3,7 +3,7 @@ error[E0618]: expected function, found `i32` | LL | fn func(i: i32) { | - `i32` defined here -LL | i(); //~ERROR expected function, found `i32` +LL | i(); | ^-- | | | call expression requires function @@ -13,7 +13,7 @@ error[E0618]: expected function, found `i32` | LL | let i = 0i32; | - `i32` defined here -LL | i(); //~ERROR expected function, found `i32` +LL | i(); | ^-- | | | call expression requires function diff --git a/src/test/ui/issues/issue-10991.stderr b/src/test/ui/issues/issue-10991.stderr index c91b15cb3fb3..f12539b47cf4 100644 --- a/src/test/ui/issues/issue-10991.stderr +++ b/src/test/ui/issues/issue-10991.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `()` as `usize` --> $DIR/issue-10991.rs:3:14 | -LL | let _t = nil as usize; //~ ERROR: non-primitive cast: `()` as `usize` +LL | let _t = nil as usize; | ^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/issues/issue-11004.stderr b/src/test/ui/issues/issue-11004.stderr index a5c63e9c31d4..b5831e42e399 100644 --- a/src/test/ui/issues/issue-11004.stderr +++ b/src/test/ui/issues/issue-11004.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `x` on type `*mut A` --> $DIR/issue-11004.rs:7:21 | -LL | let x : i32 = n.x; //~ no field `x` on type `*mut A` +LL | let x : i32 = n.x; | --^ | | | help: `n` is a raw pointer; try dereferencing it: `(*n).x` @@ -9,7 +9,7 @@ LL | let x : i32 = n.x; //~ no field `x` on type `*mut A` error[E0609]: no field `y` on type `*mut A` --> $DIR/issue-11004.rs:8:21 | -LL | let y : f64 = n.y; //~ no field `y` on type `*mut A` +LL | let y : f64 = n.y; | --^ | | | help: `n` is a raw pointer; try dereferencing it: `(*n).y` diff --git a/src/test/ui/issues/issue-11192.stderr b/src/test/ui/issues/issue-11192.stderr index 37ae73685b4f..ce90b16207f0 100644 --- a/src/test/ui/issues/issue-11192.stderr +++ b/src/test/ui/issues/issue-11192.stderr @@ -9,7 +9,7 @@ LL | ptr = box Foo { x: ptr.x + 1 }; ... LL | test(&*ptr); | ^^^^ immutable borrow occurs here -LL | //~^ ERROR: cannot borrow `*ptr` as immutable +LL | LL | } | - mutable borrow ends here diff --git a/src/test/ui/issues/issue-11319.stderr b/src/test/ui/issues/issue-11319.stderr index 10db477b8ca7..6179f9d3fe00 100644 --- a/src/test/ui/issues/issue-11319.stderr +++ b/src/test/ui/issues/issue-11319.stderr @@ -2,13 +2,13 @@ error[E0308]: match arms have incompatible types --> $DIR/issue-11319.rs:8:20 | LL | / match Some(10) { -LL | | //~^ NOTE `match` arms have incompatible types +LL | | LL | | Some(5) => false, | | ----- this is found to be of type `bool` -LL | | //~^ NOTE this is found to be of type `bool` +LL | | LL | | Some(2) => true, | | ---- this is found to be of type `bool` -LL | | //~^ NOTE this is found to be of type `bool` +LL | | LL | | None => (), | | ^^ expected bool, found () ... | diff --git a/src/test/ui/issues/issue-11374.stderr b/src/test/ui/issues/issue-11374.stderr index 6cd552f86e15..8d7e6c81f4fc 100644 --- a/src/test/ui/issues/issue-11374.stderr +++ b/src/test/ui/issues/issue-11374.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-11374.rs:26:15 | -LL | c.read_to(v); //~ ERROR E0308 +LL | c.read_to(v); | ^ | | | expected &mut [u8], found struct `std::vec::Vec` diff --git a/src/test/ui/issues/issue-11515.stderr b/src/test/ui/issues/issue-11515.stderr index d7d51a32414c..0ab0c7dba0b7 100644 --- a/src/test/ui/issues/issue-11515.stderr +++ b/src/test/ui/issues/issue-11515.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-11515.rs:9:33 | -LL | let test = box Test { func: closure }; //~ ERROR mismatched types +LL | let test = box Test { func: closure }; | ^^^^^^^ expected trait `std::ops::FnMut`, found trait `std::ops::Fn` | = note: expected type `std::boxed::Box<(dyn std::ops::FnMut() + 'static)>` diff --git a/src/test/ui/issues/issue-11681.stderr b/src/test/ui/issues/issue-11681.stderr index 210c6dc5a00b..f59ddb076420 100644 --- a/src/test/ui/issues/issue-11681.stderr +++ b/src/test/ui/issues/issue-11681.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/issue-11681.rs:12:20 | -LL | let testValue = &Test; //~ ERROR borrowed value does not live long enough +LL | let testValue = &Test; | ^^^^ temporary value does not live long enough LL | return testValue; LL | } diff --git a/src/test/ui/issues/issue-11692-1.stderr b/src/test/ui/issues/issue-11692-1.stderr index 57a6a999544c..bfd1647e8bee 100644 --- a/src/test/ui/issues/issue-11692-1.stderr +++ b/src/test/ui/issues/issue-11692-1.stderr @@ -1,7 +1,7 @@ error: cannot find macro `testo!` in this scope --> $DIR/issue-11692-1.rs:2:12 | -LL | print!(testo!()); //~ ERROR cannot find macro `testo!` in this scope +LL | print!(testo!()); | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-11692-2.stderr b/src/test/ui/issues/issue-11692-2.stderr index 5d4467080f14..740c3555e52f 100644 --- a/src/test/ui/issues/issue-11692-2.stderr +++ b/src/test/ui/issues/issue-11692-2.stderr @@ -1,7 +1,7 @@ error: cannot find macro `test!` in this scope --> $DIR/issue-11692-2.rs:2:13 | -LL | concat!(test!()); //~ ERROR cannot find macro `test!` in this scope +LL | concat!(test!()); | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-11844.stderr b/src/test/ui/issues/issue-11844.stderr index 683ad48ff52c..1c4321f1b4ab 100644 --- a/src/test/ui/issues/issue-11844.stderr +++ b/src/test/ui/issues/issue-11844.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | match a { | - this match expression has type `std::option::Option>` -LL | Ok(a) => //~ ERROR: mismatched types +LL | Ok(a) => | ^^^^^ expected enum `std::option::Option`, found enum `std::result::Result` | = note: expected type `std::option::Option>` diff --git a/src/test/ui/issues/issue-11873.stderr b/src/test/ui/issues/issue-11873.stderr index 1e44754c707d..63bb4e7bd042 100644 --- a/src/test/ui/issues/issue-11873.stderr +++ b/src/test/ui/issues/issue-11873.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `v` because it is borrowed | LL | let mut f = || v.push(2); | -- borrow of `v` occurs here -LL | let _w = v; //~ ERROR: cannot move out of `v` +LL | let _w = v; | ^^ move out of `v` occurs here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-12028.stderr b/src/test/ui/issues/issue-12028.stderr index 7b0850581cec..64694c7a8d0b 100644 --- a/src/test/ui/issues/issue-12028.stderr +++ b/src/test/ui/issues/issue-12028.stderr @@ -1,7 +1,7 @@ error[E0284]: type annotations required: cannot resolve `<_ as StreamHasher>::S == ::S` --> $DIR/issue-12028.rs:29:14 | -LL | self.input_stream(&mut stream); //~ ERROR type annotations required +LL | self.input_stream(&mut stream); | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-12369.stderr b/src/test/ui/issues/issue-12369.stderr index 6906c7b7920c..fec9078dc409 100644 --- a/src/test/ui/issues/issue-12369.stderr +++ b/src/test/ui/issues/issue-12369.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/issue-12369.rs:10:9 | -LL | &[10,a, ref rest..] => 10 //~ ERROR: unreachable pattern +LL | &[10,a, ref rest..] => 10 | ^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/issues/issue-12470.stderr b/src/test/ui/issues/issue-12470.stderr index 59056aaca902..fadfb75cde64 100644 --- a/src/test/ui/issues/issue-12470.stderr +++ b/src/test/ui/issues/issue-12470.stderr @@ -1,7 +1,7 @@ error[E0597]: `*b` does not live long enough --> $DIR/issue-12470.rs:28:19 | -LL | let bb: &B = &*b; //~ ERROR does not live long enough +LL | let bb: &B = &*b; | ^^ borrowed value does not live long enough LL | make_a(bb) LL | } diff --git a/src/test/ui/issues/issue-12552.stderr b/src/test/ui/issues/issue-12552.stderr index 768d11bf899a..6eaac1b35776 100644 --- a/src/test/ui/issues/issue-12552.stderr +++ b/src/test/ui/issues/issue-12552.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | match t { | - this match expression has type `std::result::Result<_, {integer}>` -LL | Some(k) => match k { //~ ERROR mismatched types +LL | Some(k) => match k { | ^^^^^^^ expected enum `std::result::Result`, found enum `std::option::Option` | = note: expected type `std::result::Result<_, {integer}>` @@ -12,7 +12,7 @@ LL | Some(k) => match k { //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/issue-12552.rs:9:5 | -LL | None => () //~ ERROR mismatched types +LL | None => () | ^^^^ expected enum `std::result::Result`, found enum `std::option::Option` | = note: expected type `std::result::Result<_, {integer}>` diff --git a/src/test/ui/issues/issue-12863.stderr b/src/test/ui/issues/issue-12863.stderr index 3f1a6bf598de..bec70a5fb95a 100644 --- a/src/test/ui/issues/issue-12863.stderr +++ b/src/test/ui/issues/issue-12863.stderr @@ -1,7 +1,7 @@ error[E0532]: expected unit struct/variant or constant, found function `foo::bar` --> $DIR/issue-12863.rs:5:9 | -LL | foo::bar => {} //~ ERROR expected unit struct/variant or constant, found function `foo::bar` +LL | foo::bar => {} | ^^^^^^^^ not a unit struct/variant or constant error: aborting due to previous error diff --git a/src/test/ui/issues/issue-12997-1.stderr b/src/test/ui/issues/issue-12997-1.stderr index 050e753dd1a4..e036896812ec 100644 --- a/src/test/ui/issues/issue-12997-1.stderr +++ b/src/test/ui/issues/issue-12997-1.stderr @@ -1,13 +1,13 @@ error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination` --> $DIR/issue-12997-1.rs:6:1 | -LL | fn foo() { } //~ ERROR functions used as benches +LL | fn foo() { } | ^^^^^^^^^^^^ error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination` --> $DIR/issue-12997-1.rs:9:1 | -LL | fn bar(x: isize, y: isize) { } //~ ERROR functions used as benches +LL | fn bar(x: isize, y: isize) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-13404.stderr b/src/test/ui/issues/issue-13404.stderr index 45cddffef710..1f50debb07b1 100644 --- a/src/test/ui/issues/issue-13404.stderr +++ b/src/test/ui/issues/issue-13404.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `b::f` --> $DIR/issue-13404.rs:2:5 | -LL | use b::f; //~ ERROR: unresolved import `b::f` [E0432] +LL | use b::f; | ^^^^ no `f` in `b` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13482-2.stderr b/src/test/ui/issues/issue-13482-2.stderr index 0c036f1d0e68..ccab95878b52 100644 --- a/src/test/ui/issues/issue-13482-2.stderr +++ b/src/test/ui/issues/issue-13482-2.stderr @@ -1,7 +1,7 @@ error[E0527]: pattern requires 0 elements but array has 2 --> $DIR/issue-13482-2.rs:6:9 | -LL | [] => None, //~ ERROR pattern requires 0 elements but array has 2 +LL | [] => None, | ^^ expected 2 elements error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13482.stderr b/src/test/ui/issues/issue-13482.stderr index 5776dedf0a2c..3eb05f504c23 100644 --- a/src/test/ui/issues/issue-13482.stderr +++ b/src/test/ui/issues/issue-13482.stderr @@ -1,7 +1,7 @@ error[E0527]: pattern requires 0 elements but array has 2 --> $DIR/issue-13482.rs:4:5 | -LL | [] => None, //~ ERROR pattern requires 0 elements but array has 2 +LL | [] => None, | ^^ expected 2 elements error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13483.stderr b/src/test/ui/issues/issue-13483.stderr index 1ab67d285c0d..739f06123669 100644 --- a/src/test/ui/issues/issue-13483.stderr +++ b/src/test/ui/issues/issue-13483.stderr @@ -1,13 +1,13 @@ error: missing condition for `if` statemement --> $DIR/issue-13483.rs:3:14 | -LL | } else if { //~ ERROR missing condition +LL | } else if { | ^ expected if condition here error: missing condition for `if` statemement --> $DIR/issue-13483.rs:10:14 | -LL | } else if { //~ ERROR missing condition +LL | } else if { | ^ expected if condition here error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-13497-2.stderr b/src/test/ui/issues/issue-13497-2.stderr index c91ab789fe8a..5fde55cce005 100644 --- a/src/test/ui/issues/issue-13497-2.stderr +++ b/src/test/ui/issues/issue-13497-2.stderr @@ -1,7 +1,7 @@ error[E0597]: `rawLines` does not live long enough --> $DIR/issue-13497-2.rs:3:5 | -LL | rawLines //~ ERROR `rawLines` does not live long enough +LL | rawLines | ^^^^^^^^ borrowed value does not live long enough LL | .iter().map(|l| l.trim()).collect() LL | } diff --git a/src/test/ui/issues/issue-13497.stderr b/src/test/ui/issues/issue-13497.stderr index eb053c1003e3..b72f0277052b 100644 --- a/src/test/ui/issues/issue-13497.stderr +++ b/src/test/ui/issues/issue-13497.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/issue-13497.rs:2:5 | -LL | &str //~ ERROR missing lifetime specifier +LL | &str | ^ help: consider giving it a 'static lifetime: `&'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from diff --git a/src/test/ui/issues/issue-1362.stderr b/src/test/ui/issues/issue-1362.stderr index dd97e0cf04a9..5fef8497cde5 100644 --- a/src/test/ui/issues/issue-1362.stderr +++ b/src/test/ui/issues/issue-1362.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-1362.rs:4:16 | -LL | let x: u32 = 20i32; //~ ERROR mismatched types +LL | let x: u32 = 20i32; | ^^^^^ expected u32, found i32 error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13847.stderr b/src/test/ui/issues/issue-13847.stderr index 9199199d7305..52b8dc049702 100644 --- a/src/test/ui/issues/issue-13847.stderr +++ b/src/test/ui/issues/issue-13847.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `is_failure` on type `!` --> $DIR/issue-13847.rs:2:12 | -LL | return.is_failure //~ ERROR no field `is_failure` on type `!` +LL | return.is_failure | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13853-2.stderr b/src/test/ui/issues/issue-13853-2.stderr index 3e711243b4e1..0853f5cffb76 100644 --- a/src/test/ui/issues/issue-13853-2.stderr +++ b/src/test/ui/issues/issue-13853-2.stderr @@ -1,7 +1,7 @@ error[E0615]: attempted to take value of method `get` on type `std::boxed::Box<(dyn ResponseHook + 'static)>` --> $DIR/issue-13853-2.rs:5:39 | -LL | fn foo(res : Box) { res.get } //~ ERROR attempted to take value of method +LL | fn foo(res : Box) { res.get } | ^^^ help: use parentheses to call the method: `get()` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13853.stderr b/src/test/ui/issues/issue-13853.stderr index 6da5da04fb16..b4efd5511c35 100644 --- a/src/test/ui/issues/issue-13853.stderr +++ b/src/test/ui/issues/issue-13853.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn nodes<'a, I: Iterator>(&self) -> I | - expected `I` because of return type ... -LL | self.iter() //~ ERROR mismatched types +LL | self.iter() | ^^^^^^^^^^^ expected type parameter, found struct `std::slice::Iter` | = note: expected type `I` @@ -13,13 +13,13 @@ LL | self.iter() //~ ERROR mismatched types error[E0599]: no method named `iter` found for type `&G` in the current scope --> $DIR/issue-13853.rs:27:23 | -LL | for node in graph.iter() { //~ ERROR no method named `iter` found +LL | for node in graph.iter() { | ^^^^ error[E0308]: mismatched types --> $DIR/issue-13853.rs:37:13 | -LL | iterate(graph); //~ ERROR mismatched types +LL | iterate(graph); | ^^^^^ | | | expected reference, found struct `std::vec::Vec` diff --git a/src/test/ui/issues/issue-14221.stderr b/src/test/ui/issues/issue-14221.stderr index bf12480a5d37..3e5e25a9f6d1 100644 --- a/src/test/ui/issues/issue-14221.stderr +++ b/src/test/ui/issues/issue-14221.stderr @@ -7,7 +7,7 @@ LL | A => "A", warning[E0170]: pattern binding `B` is named the same as one of the variants of the type `E` --> $DIR/issue-14221.rs:15:13 | -LL | B => "B", //~ ERROR: unreachable pattern +LL | B => "B", | ^ help: to match on the variant, qualify the path: `E::B` error: unreachable pattern @@ -15,8 +15,8 @@ error: unreachable pattern | LL | A => "A", | - matches any value -LL | //~^ WARN pattern binding `A` is named the same as one of the variants of the type `E` -LL | B => "B", //~ ERROR: unreachable pattern +LL | +LL | B => "B", | ^ unreachable pattern | note: lint level defined here diff --git a/src/test/ui/issues/issue-14285.stderr b/src/test/ui/issues/issue-14285.stderr index e5d0ab0684a0..c180ed03e540 100644 --- a/src/test/ui/issues/issue-14285.stderr +++ b/src/test/ui/issues/issue-14285.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `a` | LL | fn foo<'a>(a: &Foo) -> B<'a> { | ---- help: add explicit lifetime `'a` to the type of `a`: `&'a (dyn Foo + 'a)` -LL | B(a) //~ ERROR explicit lifetime required in the type of `a` [E0621] +LL | B(a) | ^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14309.stderr b/src/test/ui/issues/issue-14309.stderr index b8d82aadd482..4376876ecd69 100644 --- a/src/test/ui/issues/issue-14309.stderr +++ b/src/test/ui/issues/issue-14309.stderr @@ -1,7 +1,7 @@ error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout --> $DIR/issue-14309.rs:30:15 | -LL | fn foo(x: A); //~ ERROR type `A` which is not FFI-safe +LL | fn foo(x: A); | ^ | note: lint level defined here @@ -21,7 +21,7 @@ LL | | } error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout --> $DIR/issue-14309.rs:31:15 | -LL | fn bar(x: B); //~ ERROR type `A` +LL | fn bar(x: B); | ^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct @@ -36,7 +36,7 @@ LL | | } error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout --> $DIR/issue-14309.rs:33:15 | -LL | fn qux(x: A2); //~ ERROR type `A` +LL | fn qux(x: A2); | ^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct @@ -51,7 +51,7 @@ LL | | } error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout --> $DIR/issue-14309.rs:34:16 | -LL | fn quux(x: B2); //~ ERROR type `A` +LL | fn quux(x: B2); | ^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct @@ -66,7 +66,7 @@ LL | | } error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout --> $DIR/issue-14309.rs:36:16 | -LL | fn fred(x: D); //~ ERROR type `A` +LL | fn fred(x: D); | ^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct diff --git a/src/test/ui/issues/issue-1448-2.stderr b/src/test/ui/issues/issue-1448-2.stderr index b06a6162712f..487b061eba13 100644 --- a/src/test/ui/issues/issue-1448-2.stderr +++ b/src/test/ui/issues/issue-1448-2.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-1448-2.rs:6:24 | -LL | println!("{}", foo(10i32)); //~ ERROR mismatched types +LL | println!("{}", foo(10i32)); | ^^^^^ expected u32, found i32 error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14721.stderr b/src/test/ui/issues/issue-14721.stderr index 8029318419a6..49ebb2976e8a 100644 --- a/src/test/ui/issues/issue-14721.stderr +++ b/src/test/ui/issues/issue-14721.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `desc` on type `&str` --> $DIR/issue-14721.rs:3:24 | -LL | println!("{}", foo.desc); //~ no field `desc` on type `&str` +LL | println!("{}", foo.desc); | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-1476.stderr b/src/test/ui/issues/issue-1476.stderr index a0c0a8fb1f29..670bd546335f 100644 --- a/src/test/ui/issues/issue-1476.stderr +++ b/src/test/ui/issues/issue-1476.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/issue-1476.rs:2:20 | -LL | println!("{}", x); //~ ERROR cannot find value `x` in this scope +LL | println!("{}", x); | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14772.stderr b/src/test/ui/issues/issue-14772.stderr index a7448ad5b88d..253fec5e5783 100644 --- a/src/test/ui/issues/issue-14772.stderr +++ b/src/test/ui/issues/issue-14772.stderr @@ -1,7 +1,7 @@ error: only functions may be used as tests --> $DIR/issue-14772.rs:4:1 | -LL | mod foo {} //~ ERROR only functions may be used as tests +LL | mod foo {} | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14845.stderr b/src/test/ui/issues/issue-14845.stderr index 94e7ac74ff0c..2fa9fbaa887b 100644 --- a/src/test/ui/issues/issue-14845.stderr +++ b/src/test/ui/issues/issue-14845.stderr @@ -1,13 +1,13 @@ error[E0606]: casting `&[u8; 1]` as `*mut u8` is invalid --> $DIR/issue-14845.rs:7:14 | -LL | let _f = &x.a as *mut u8; //~ ERROR casting +LL | let _f = &x.a as *mut u8; | ^^^^^^^^^^^^^^^ error[E0606]: casting `&[u8; 1]` as `*mut u8` is invalid --> $DIR/issue-14845.rs:10:14 | -LL | let _v = &local as *mut u8; //~ ERROR casting +LL | let _v = &local as *mut u8; | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-15207.stderr b/src/test/ui/issues/issue-15207.stderr index 7149444b5668..2d90eb80fc54 100644 --- a/src/test/ui/issues/issue-15207.stderr +++ b/src/test/ui/issues/issue-15207.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `push` found for type `!` in the current scope --> $DIR/issue-15207.rs:3:15 | -LL | break.push(1) //~ ERROR no method named `push` found for type `!` +LL | break.push(1) | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-15965.stderr b/src/test/ui/issues/issue-15965.stderr index 904656cb3b1c..90377c19dee0 100644 --- a/src/test/ui/issues/issue-15965.stderr +++ b/src/test/ui/issues/issue-15965.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed --> $DIR/issue-15965.rs:3:9 | LL | / { return () } -LL | | //~^ ERROR type annotations needed [E0282] +LL | | LL | | () | |______^ cannot infer type | diff --git a/src/test/ui/issues/issue-16098.stderr b/src/test/ui/issues/issue-16098.stderr index 4a62cea20b8a..cdab76ca70ba 100644 --- a/src/test/ui/issues/issue-16098.stderr +++ b/src/test/ui/issues/issue-16098.stderr @@ -1,7 +1,7 @@ error: recursion limit reached while expanding the macro `prob1` --> $DIR/issue-16098.rs:7:18 | -LL | $n + prob1!($n - 1); //~ ERROR recursion limit reached while expanding the macro `prob1` +LL | $n + prob1!($n - 1); | ^^^^^^^^^^^^^^ ... LL | println!("Problem 1: {}", prob1!(1000)); diff --git a/src/test/ui/issues/issue-16250.stderr b/src/test/ui/issues/issue-16250.stderr index fc6f26f04399..a8ff2548b73d 100644 --- a/src/test/ui/issues/issue-16250.stderr +++ b/src/test/ui/issues/issue-16250.stderr @@ -1,7 +1,7 @@ error: `extern` block uses type `Foo` which is not FFI-safe: this struct has unspecified layout --> $DIR/issue-16250.rs:6:20 | -LL | pub fn foo(x: (Foo)); //~ ERROR unspecified layout +LL | pub fn foo(x: (Foo)); | ^^^ | note: lint level defined here diff --git a/src/test/ui/issues/issue-16683.stderr b/src/test/ui/issues/issue-16683.stderr index 23e67bb2de9b..a047893a168a 100644 --- a/src/test/ui/issues/issue-16683.stderr +++ b/src/test/ui/issues/issue-16683.stderr @@ -1,20 +1,20 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements --> $DIR/issue-16683.rs:4:14 | -LL | self.a(); //~ ERROR cannot infer +LL | self.a(); | ^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 3:5... --> $DIR/issue-16683.rs:3:5 | LL | / fn b(&self) { -LL | | self.a(); //~ ERROR cannot infer +LL | | self.a(); LL | | } | |_____^ note: ...so that reference does not outlive borrowed content --> $DIR/issue-16683.rs:4:9 | -LL | self.a(); //~ ERROR cannot infer +LL | self.a(); | ^^^^ note: but, the lifetime must be valid for the lifetime 'a as defined on the trait at 1:9... --> $DIR/issue-16683.rs:1:9 diff --git a/src/test/ui/issues/issue-16939.stderr b/src/test/ui/issues/issue-16939.stderr index 7281f6a73556..5df2119c1412 100644 --- a/src/test/ui/issues/issue-16939.stderr +++ b/src/test/ui/issues/issue-16939.stderr @@ -1,7 +1,7 @@ error[E0057]: this function takes 0 parameters but 1 parameter was supplied --> $DIR/issue-16939.rs:5:9 | -LL | |t| f(t); //~ ERROR E0057 +LL | |t| f(t); | ^^^^ expected 0 parameters error: aborting due to previous error diff --git a/src/test/ui/issues/issue-1697.stderr b/src/test/ui/issues/issue-1697.stderr index 00e136cb1ce8..6ae5bd1fc264 100644 --- a/src/test/ui/issues/issue-1697.stderr +++ b/src/test/ui/issues/issue-1697.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `unresolved` --> $DIR/issue-1697.rs:3:5 | -LL | use unresolved::*; //~ ERROR unresolved import `unresolved` [E0432] +LL | use unresolved::*; | ^^^^^^^^^^ maybe a missing `extern crate unresolved;`? error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17001.stderr b/src/test/ui/issues/issue-17001.stderr index bdd082496380..d7e6069977b4 100644 --- a/src/test/ui/issues/issue-17001.stderr +++ b/src/test/ui/issues/issue-17001.stderr @@ -1,7 +1,7 @@ error[E0574]: expected struct, variant or union type, found module `foo` --> $DIR/issue-17001.rs:4:13 | -LL | let p = foo { x: () }; //~ ERROR expected struct, variant or union type, found module `foo` +LL | let p = foo { x: () }; | ^^^ not a struct, variant or union type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17033.stderr b/src/test/ui/issues/issue-17033.stderr index 181a9992c6d8..ba78aa2bc6a5 100644 --- a/src/test/ui/issues/issue-17033.stderr +++ b/src/test/ui/issues/issue-17033.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-17033.rs:2:10 | -LL | (*p)(()) //~ ERROR mismatched types +LL | (*p)(()) | ^^ | | | expected &mut (), found () diff --git a/src/test/ui/issues/issue-17252.stderr b/src/test/ui/issues/issue-17252.stderr index e333e1506511..c993588f5531 100644 --- a/src/test/ui/issues/issue-17252.stderr +++ b/src/test/ui/issues/issue-17252.stderr @@ -1,7 +1,7 @@ error[E0391]: cycle detected when processing `FOO` --> $DIR/issue-17252.rs:1:20 | -LL | const FOO: usize = FOO; //~ ERROR E0391 +LL | const FOO: usize = FOO; | ^^^ | = note: ...which again requires processing `FOO`, completing the cycle diff --git a/src/test/ui/issues/issue-17337.stderr b/src/test/ui/issues/issue-17337.stderr index 4c3ffe92cccd..8973afb80681 100644 --- a/src/test/ui/issues/issue-17337.stderr +++ b/src/test/ui/issues/issue-17337.stderr @@ -1,7 +1,7 @@ error: use of deprecated item 'Foo::foo': text --> $DIR/issue-17337.rs:16:6 | -LL | .foo(); //~ ERROR use of deprecated item +LL | .foo(); | ^^^ | note: lint level defined here diff --git a/src/test/ui/issues/issue-17373.stderr b/src/test/ui/issues/issue-17373.stderr index e1a9f097b226..5c429d1113df 100644 --- a/src/test/ui/issues/issue-17373.stderr +++ b/src/test/ui/issues/issue-17373.stderr @@ -1,7 +1,7 @@ error[E0614]: type `!` cannot be dereferenced --> $DIR/issue-17373.rs:2:5 | -LL | *return //~ ERROR type `!` cannot be dereferenced +LL | *return | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17385.stderr b/src/test/ui/issues/issue-17385.stderr index 5f28a3c2c278..ee55d862e13d 100644 --- a/src/test/ui/issues/issue-17385.stderr +++ b/src/test/ui/issues/issue-17385.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `foo` | LL | drop(foo); | --- value moved here -LL | match foo { //~ ERROR use of moved value +LL | match foo { | ^^^ value used here after move | = note: move occurs because `foo` has type `X`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `e` | LL | drop(e); | - value moved here -LL | match e { //~ ERROR use of moved value +LL | match e { | ^ value used here after move | = note: move occurs because `e` has type `Enum`, which does not implement the `Copy` trait diff --git a/src/test/ui/issues/issue-17405.stderr b/src/test/ui/issues/issue-17405.stderr index 2bfc85cc7de8..37274e239ba0 100644 --- a/src/test/ui/issues/issue-17405.stderr +++ b/src/test/ui/issues/issue-17405.stderr @@ -1,7 +1,7 @@ error[E0574]: expected struct, variant or union type, found enum `Foo` --> $DIR/issue-17405.rs:7:9 | -LL | Foo { i } => () //~ ERROR expected struct, variant or union type, found enum `Foo` +LL | Foo { i } => () | ^^^ not a struct, variant or union type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17545.stderr b/src/test/ui/issues/issue-17545.stderr index 62ec25e1d1a4..c4acaf2278e6 100644 --- a/src/test/ui/issues/issue-17545.stderr +++ b/src/test/ui/issues/issue-17545.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/issue-17545.rs:7:10 | -LL | &id(()), //~ ERROR borrowed value does not live long enough +LL | &id(()), | ^^^^^^ temporary value does not live long enough LL | )); | - temporary value only lives until here diff --git a/src/test/ui/issues/issue-17551.stderr b/src/test/ui/issues/issue-17551.stderr index df693591e7c2..40e7727752b7 100644 --- a/src/test/ui/issues/issue-17551.stderr +++ b/src/test/ui/issues/issue-17551.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/issue-17551.rs:6:15 | -LL | let foo = B(marker::PhantomData); //~ ERROR type annotations needed +LL | let foo = B(marker::PhantomData); | --- ^ cannot infer type for `T` | | | consider giving `foo` a type diff --git a/src/test/ui/issues/issue-17718-const-privacy.stderr b/src/test/ui/issues/issue-17718-const-privacy.stderr index 5025aaca777d..0b0de8a52590 100644 --- a/src/test/ui/issues/issue-17718-const-privacy.stderr +++ b/src/test/ui/issues/issue-17718-const-privacy.stderr @@ -1,13 +1,13 @@ error[E0603]: constant `B` is private --> $DIR/issue-17718-const-privacy.rs:5:8 | -LL | use a::B; //~ ERROR: constant `B` is private +LL | use a::B; | ^ error[E0603]: constant `BAR` is private --> $DIR/issue-17718-const-privacy.rs:8:5 | -LL | BAR, //~ ERROR: constant `BAR` is private +LL | BAR, | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-17718-patterns.stderr b/src/test/ui/issues/issue-17718-patterns.stderr index 698bd857a580..109091c2af0c 100644 --- a/src/test/ui/issues/issue-17718-patterns.stderr +++ b/src/test/ui/issues/issue-17718-patterns.stderr @@ -4,7 +4,7 @@ error[E0530]: match bindings cannot shadow statics LL | static A1: usize = 1; | --------------------- the static `A1` is defined here ... -LL | A1 => {} //~ ERROR: match bindings cannot shadow statics +LL | A1 => {} | ^^ cannot be named the same as a static error[E0530]: match bindings cannot shadow statics @@ -13,7 +13,7 @@ error[E0530]: match bindings cannot shadow statics LL | static mut A2: usize = 1; | ------------------------- the static `A2` is defined here ... -LL | A2 => {} //~ ERROR: match bindings cannot shadow statics +LL | A2 => {} | ^^ cannot be named the same as a static error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-17718-references.stderr b/src/test/ui/issues/issue-17718-references.stderr index ef49dcfeef9f..15c3e67f7a1a 100644 --- a/src/test/ui/issues/issue-17718-references.stderr +++ b/src/test/ui/issues/issue-17718-references.stderr @@ -1,13 +1,13 @@ error[E0013]: constants cannot refer to statics, use a constant instead --> $DIR/issue-17718-references.rs:9:28 | -LL | const T2: &'static usize = &S; //~ ERROR: constants cannot refer to statics +LL | const T2: &'static usize = &S; | ^^ error[E0013]: constants cannot refer to statics, use a constant instead --> $DIR/issue-17718-references.rs:14:19 | -LL | const T6: usize = S; //~ ERROR: constants cannot refer to statics +LL | const T6: usize = S; | ^ error[E0013]: constants cannot refer to statics, use a constant instead diff --git a/src/test/ui/issues/issue-17718-static-move.stderr b/src/test/ui/issues/issue-17718-static-move.stderr index dd473f0a4c45..064a991e4a3d 100644 --- a/src/test/ui/issues/issue-17718-static-move.stderr +++ b/src/test/ui/issues/issue-17718-static-move.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of static item --> $DIR/issue-17718-static-move.rs:6:14 | -LL | let _a = FOO; //~ ERROR: cannot move out of static item +LL | let _a = FOO; | ^^^ | | | cannot move out of static item diff --git a/src/test/ui/issues/issue-17740.stderr b/src/test/ui/issues/issue-17740.stderr index c7a76c558ee8..7ab0fa4d818b 100644 --- a/src/test/ui/issues/issue-17740.stderr +++ b/src/test/ui/issues/issue-17740.stderr @@ -10,11 +10,11 @@ note: the anonymous lifetime #2 defined on the method body at 6:5... --> $DIR/issue-17740.rs:6:5 | LL | / fn bar(self: &mut Foo) { -LL | | //~^ mismatched method receiver -LL | | //~| expected type `Foo<'a>` -LL | | //~| found type `Foo<'_>` +LL | | +LL | | +LL | | ... | -LL | | //~| lifetime mismatch +LL | | LL | | } | |_____^ note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 5:7 @@ -40,11 +40,11 @@ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the m --> $DIR/issue-17740.rs:6:5 | LL | / fn bar(self: &mut Foo) { -LL | | //~^ mismatched method receiver -LL | | //~| expected type `Foo<'a>` -LL | | //~| found type `Foo<'_>` +LL | | +LL | | +LL | | ... | -LL | | //~| lifetime mismatch +LL | | LL | | } | |_____^ diff --git a/src/test/ui/issues/issue-17758.stderr b/src/test/ui/issues/issue-17758.stderr index b376757091dd..28a1be59840a 100644 --- a/src/test/ui/issues/issue-17758.stderr +++ b/src/test/ui/issues/issue-17758.stderr @@ -9,7 +9,7 @@ note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on th | LL | / fn bar(&self) { LL | | self.foo(); -LL | | //~^ ERROR cannot infer +LL | | LL | | } | |_____^ note: ...so that reference does not outlive borrowed content diff --git a/src/test/ui/issues/issue-17904-2.stderr b/src/test/ui/issues/issue-17904-2.stderr index b4f974525749..b8fabd3b13f4 100644 --- a/src/test/ui/issues/issue-17904-2.stderr +++ b/src/test/ui/issues/issue-17904-2.stderr @@ -1,7 +1,7 @@ error[E0392]: parameter `T` is never used --> $DIR/issue-17904-2.rs:4:12 | -LL | struct Foo where T: Copy; //~ ERROR parameter `T` is never used +LL | struct Foo where T: Copy; | ^ unused type parameter | = help: consider removing `T` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/issues/issue-17905-2.stderr b/src/test/ui/issues/issue-17905-2.stderr index 39e5f8ffc9f9..f185f49b9b92 100644 --- a/src/test/ui/issues/issue-17905-2.stderr +++ b/src/test/ui/issues/issue-17905-2.stderr @@ -10,8 +10,8 @@ note: the anonymous lifetime #2 defined on the method body at 8:5... --> $DIR/issue-17905-2.rs:8:5 | LL | / fn say(self: &Pair<&str, isize>) { -LL | | //~^ ERROR mismatched method receiver -LL | | //~| ERROR mismatched method receiver +LL | | +LL | | LL | | println!("{:?}", self); LL | | } | |_____^ @@ -38,8 +38,8 @@ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the m --> $DIR/issue-17905-2.rs:8:5 | LL | / fn say(self: &Pair<&str, isize>) { -LL | | //~^ ERROR mismatched method receiver -LL | | //~| ERROR mismatched method receiver +LL | | +LL | | LL | | println!("{:?}", self); LL | | } | |_____^ diff --git a/src/test/ui/issues/issue-17959.stderr b/src/test/ui/issues/issue-17959.stderr index 790e8f7c7982..de742e48aea9 100644 --- a/src/test/ui/issues/issue-17959.stderr +++ b/src/test/ui/issues/issue-17959.stderr @@ -2,7 +2,7 @@ error[E0367]: The requirement `T: std::marker::Sized` is added only by the Drop --> $DIR/issue-17959.rs:11:1 | LL | / impl Drop for G { -LL | | //~^ ERROR: The requirement `T: std::marker::Sized` is added only by the Drop impl. [E0367] +LL | | LL | | fn drop(&mut self) { LL | | if !self._ptr.is_null() { LL | | } diff --git a/src/test/ui/issues/issue-17994.stderr b/src/test/ui/issues/issue-17994.stderr index e22b2c071973..61e1e496f795 100644 --- a/src/test/ui/issues/issue-17994.stderr +++ b/src/test/ui/issues/issue-17994.stderr @@ -1,7 +1,7 @@ error[E0091]: type parameter `T` is unused --> $DIR/issue-17994.rs:2:10 | -LL | type Huh where T: Tr = isize; //~ ERROR type parameter `T` is unused +LL | type Huh where T: Tr = isize; | ^ unused type parameter error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17999.stderr b/src/test/ui/issues/issue-17999.stderr index 51c0c757a80c..b9ae03356e9b 100644 --- a/src/test/ui/issues/issue-17999.stderr +++ b/src/test/ui/issues/issue-17999.stderr @@ -1,7 +1,7 @@ error: unused variable: `x` --> $DIR/issue-17999.rs:5:13 | -LL | let x = (); //~ ERROR: unused variable: `x` +LL | let x = (); | ^ help: consider prefixing with an underscore: `_x` | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_variables)] error: unused variable: `a` --> $DIR/issue-17999.rs:7:13 | -LL | a => {} //~ ERROR: unused variable: `a` +LL | a => {} | ^ help: consider prefixing with an underscore: `_a` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-18118.stderr b/src/test/ui/issues/issue-18118.stderr index 9b21ece341a9..07fa1f60e063 100644 --- a/src/test/ui/issues/issue-18118.stderr +++ b/src/test/ui/issues/issue-18118.stderr @@ -1,7 +1,7 @@ error[E0597]: `p` does not live long enough --> $DIR/issue-18118.rs:4:10 | -LL | &p //~ ERROR `p` does not live long enough +LL | &p | ^ borrowed value does not live long enough LL | }; | - borrowed value only lives until here diff --git a/src/test/ui/issues/issue-18159.stderr b/src/test/ui/issues/issue-18159.stderr index 25b7051a8800..6048344125c5 100644 --- a/src/test/ui/issues/issue-18159.stderr +++ b/src/test/ui/issues/issue-18159.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/issue-18159.rs:2:9 | -LL | let x; //~ ERROR type annotations needed +LL | let x; | ^ | | | cannot infer type diff --git a/src/test/ui/issues/issue-18183.stderr b/src/test/ui/issues/issue-18183.stderr index cf33124bc950..c8f8ac9296dc 100644 --- a/src/test/ui/issues/issue-18183.stderr +++ b/src/test/ui/issues/issue-18183.stderr @@ -1,7 +1,7 @@ error[E0128]: type parameters with a default cannot use forward declared identifiers --> $DIR/issue-18183.rs:1:20 | -LL | pub struct Foo(Bar); //~ ERROR E0128 +LL | pub struct Foo(Bar); | ^^^ defaulted type parameters cannot be forward declared error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18294.stderr b/src/test/ui/issues/issue-18294.stderr index f3e8ab1a3130..a7d0392f7f08 100644 --- a/src/test/ui/issues/issue-18294.stderr +++ b/src/test/ui/issues/issue-18294.stderr @@ -1,7 +1,7 @@ error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) --> $DIR/issue-18294.rs:3:31 | -LL | const Y: usize = unsafe { &X as *const u32 as usize }; //~ ERROR is unstable +LL | const Y: usize = unsafe { &X as *const u32 as usize }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-18389.stderr b/src/test/ui/issues/issue-18389.stderr index 02ff6b6d5bff..090487ee8fdb 100644 --- a/src/test/ui/issues/issue-18389.stderr +++ b/src/test/ui/issues/issue-18389.stderr @@ -5,7 +5,7 @@ LL | trait Private { | - `Private<::P, ::R>` declared as private ... LL | / pub trait Public: Private< -LL | | //~^ ERROR private trait `Private<::P, ::R>` in public interface +LL | | LL | | ::P, LL | | ::R ... | diff --git a/src/test/ui/issues/issue-18423.stderr b/src/test/ui/issues/issue-18423.stderr index 96652767a05c..141fd27be364 100644 --- a/src/test/ui/issues/issue-18423.stderr +++ b/src/test/ui/issues/issue-18423.stderr @@ -1,7 +1,7 @@ error[E0107]: wrong number of lifetime arguments: expected 0, found 1 --> $DIR/issue-18423.rs:4:12 | -LL | x: Box<'a, isize> //~ ERROR wrong number of lifetime arguments +LL | x: Box<'a, isize> | ^^ unexpected lifetime argument error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18446.stderr b/src/test/ui/issues/issue-18446.stderr index 8aff0309aa77..e6afc4c13a91 100644 --- a/src/test/ui/issues/issue-18446.stderr +++ b/src/test/ui/issues/issue-18446.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/issue-18446.rs:18:7 | -LL | x.foo(); //~ ERROR multiple applicable items in scope [E0034] +LL | x.foo(); | ^^^ multiple `foo` found | note: candidate #1 is defined in an impl for the type `dyn T` diff --git a/src/test/ui/issues/issue-18532.stderr b/src/test/ui/issues/issue-18532.stderr index 400890348a12..4c224eb2d243 100644 --- a/src/test/ui/issues/issue-18532.stderr +++ b/src/test/ui/issues/issue-18532.stderr @@ -1,7 +1,7 @@ error[E0618]: expected function, found `!` --> $DIR/issue-18532.rs:6:5 | -LL | (return)((),()); //~ ERROR expected function, found `!` +LL | (return)((),()); | ^^^^^^^^------- | | | call expression requires function diff --git a/src/test/ui/issues/issue-18611.stderr b/src/test/ui/issues/issue-18611.stderr index 8fa7694dc6c3..22c3470b61ed 100644 --- a/src/test/ui/issues/issue-18611.stderr +++ b/src/test/ui/issues/issue-18611.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `isize: HasState` is not satisfied --> $DIR/issue-18611.rs:1:1 | LL | / fn add_state(op: ::State) { -LL | | //~^ ERROR `isize: HasState` is not satisfied +LL | | LL | | } | |_^ the trait `HasState` is not implemented for `isize` diff --git a/src/test/ui/issues/issue-1871.stderr b/src/test/ui/issues/issue-1871.stderr index 10b0825c34e1..fecd689251b3 100644 --- a/src/test/ui/issues/issue-1871.stderr +++ b/src/test/ui/issues/issue-1871.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `honk` found for type `{integer}` in the current scope --> $DIR/issue-1871.rs:7:9 | -LL | f.honk() //~ ERROR no method named `honk` found +LL | f.honk() | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18783.stderr b/src/test/ui/issues/issue-18783.stderr index 68eb5167ecbd..f88c42552e33 100644 --- a/src/test/ui/issues/issue-18783.stderr +++ b/src/test/ui/issues/issue-18783.stderr @@ -9,7 +9,7 @@ LL | c.push(Box::new(|| y = 0)); | ^^ - borrow occurs due to use of `y` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time +LL | LL | } | - first borrow ends here @@ -24,7 +24,7 @@ LL | Push::push(&c, Box::new(|| y = 0)); | ^^ - borrow occurs due to use of `y` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time +LL | LL | } | - first borrow ends here diff --git a/src/test/ui/issues/issue-18919.stderr b/src/test/ui/issues/issue-18919.stderr index ca717a3c49b8..87528652bd48 100644 --- a/src/test/ui/issues/issue-18919.stderr +++ b/src/test/ui/issues/issue-18919.stderr @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `dyn for<'r> std::ops::Fn(&'r isize) - --> $DIR/issue-18919.rs:3:1 | LL | / fn ho_func(f: Option) { -LL | | //~^ ERROR the size for values of type +LL | | LL | | } | |_^ doesn't have a size known at compile-time | diff --git a/src/test/ui/issues/issue-18937.stderr b/src/test/ui/issues/issue-18937.stderr index 91182224ad0a..ac302caecc33 100644 --- a/src/test/ui/issues/issue-18937.stderr +++ b/src/test/ui/issues/issue-18937.stderr @@ -6,7 +6,7 @@ LL | | where F: fmt::Debug + 'a, LL | | Self: Sized; | |__________________________- definition of `foo` from trait ... -LL | / fn foo(&mut self, f: F) //~ ERROR impl has stricter +LL | / fn foo(&mut self, f: F) LL | | where F: fmt::Debug + 'static, LL | | { LL | | self.list.push(Box::new(f)); diff --git a/src/test/ui/issues/issue-19498.stderr b/src/test/ui/issues/issue-19498.stderr index fd5e48bde160..cc1d649d6109 100644 --- a/src/test/ui/issues/issue-19498.stderr +++ b/src/test/ui/issues/issue-19498.stderr @@ -4,7 +4,7 @@ error[E0255]: the name `A` is defined multiple times LL | use self::A; | ------- previous import of the module `A` here LL | use self::B; -LL | mod A {} //~ ERROR the name `A` is defined multiple times +LL | mod A {} | ^^^^^ `A` redefined here | = note: `A` must be defined only once in the type namespace of this module @@ -19,7 +19,7 @@ error[E0255]: the name `B` is defined multiple times LL | use self::B; | ------- previous import of the module `B` here ... -LL | pub mod B {} //~ ERROR the name `B` is defined multiple times +LL | pub mod B {} | ^^^^^^^^^ `B` redefined here | = note: `B` must be defined only once in the type namespace of this module @@ -33,7 +33,7 @@ error[E0255]: the name `D` is defined multiple times | LL | use C::D; | ---- previous import of the module `D` here -LL | mod D {} //~ ERROR the name `D` is defined multiple times +LL | mod D {} | ^^^^^ `D` redefined here | = note: `D` must be defined only once in the type namespace of this module diff --git a/src/test/ui/issues/issue-19521.stderr b/src/test/ui/issues/issue-19521.stderr index 9005317736a9..a43368be5833 100644 --- a/src/test/ui/issues/issue-19521.stderr +++ b/src/test/ui/issues/issue-19521.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `homura` found for type `&'static str` in the current scope --> $DIR/issue-19521.rs:2:8 | -LL | "".homura()(); //~ ERROR no method named `homura` found +LL | "".homura()(); | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-1962.stderr b/src/test/ui/issues/issue-1962.stderr index f2c540b74515..afef59c52642 100644 --- a/src/test/ui/issues/issue-1962.stderr +++ b/src/test/ui/issues/issue-1962.stderr @@ -1,7 +1,7 @@ error: denote infinite loops with `loop { ... }` --> $DIR/issue-1962.rs:4:3 | -LL | while true { //~ ERROR denote infinite loops with `loop +LL | while true { | ^^^^^^^^^^ help: use `loop` | = note: requested on the command line with `-D while-true` diff --git a/src/test/ui/issues/issue-19692.stderr b/src/test/ui/issues/issue-19692.stderr index 1ed196766744..5e576f11583e 100644 --- a/src/test/ui/issues/issue-19692.stderr +++ b/src/test/ui/issues/issue-19692.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `kaname` found for type `Homura` in the current sc LL | struct Homura; | -------------- method `kaname` not found for this ... -LL | let Some(ref madoka) = Some(homura.kaname()); //~ ERROR no method named `kaname` found +LL | let Some(ref madoka) = Some(homura.kaname()); | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-19707.stderr b/src/test/ui/issues/issue-19707.stderr index 7ba683a6891b..c85ce0eb3a75 100644 --- a/src/test/ui/issues/issue-19707.stderr +++ b/src/test/ui/issues/issue-19707.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/issue-19707.rs:3:28 | -LL | type Foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier +LL | type Foo = fn(&u8, &u8) -> &u8; | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 @@ -9,7 +9,7 @@ LL | type Foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier error[E0106]: missing lifetime specifier --> $DIR/issue-19707.rs:5:27 | -LL | fn bar &u8>(f: &F) {} //~ ERROR missing lifetime specifier +LL | fn bar &u8>(f: &F) {} | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 diff --git a/src/test/ui/issues/issue-19991.stderr b/src/test/ui/issues/issue-19991.stderr index ee5d363c4bd2..4c6d150229a3 100644 --- a/src/test/ui/issues/issue-19991.stderr +++ b/src/test/ui/issues/issue-19991.stderr @@ -1,10 +1,10 @@ error[E0317]: if may be missing an else clause --> $DIR/issue-19991.rs:5:5 | -LL | / if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause -LL | | //~| expected type `()` -LL | | //~| found type `{integer}` -LL | | //~| expected (), found integer +LL | / if let Some(homura) = Some("madoka") { +LL | | +LL | | +LL | | LL | | 765 LL | | }; | |_____^ expected (), found integer diff --git a/src/test/ui/issues/issue-20005.stderr b/src/test/ui/issues/issue-20005.stderr index 672d78f65e9f..e271005e74d1 100644 --- a/src/test/ui/issues/issue-20005.stderr +++ b/src/test/ui/issues/issue-20005.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/issue-20005.rs:8:5 | -LL | / fn to( //~ ERROR the size for values of type +LL | / fn to( LL | | self LL | | ) -> >::Result where Dst: From { LL | | From::from(self) diff --git a/src/test/ui/issues/issue-20313.stderr b/src/test/ui/issues/issue-20313.stderr index 01673630cf18..87e2e899d3f8 100644 --- a/src/test/ui/issues/issue-20313.stderr +++ b/src/test/ui/issues/issue-20313.stderr @@ -1,7 +1,7 @@ error[E0658]: linking to LLVM intrinsics is experimental (see issue #29602) --> $DIR/issue-20313.rs:3:5 | -LL | fn sqrt(x: f32) -> f32; //~ ERROR linking to LLVM intrinsics is experimental +LL | fn sqrt(x: f32) -> f32; | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(link_llvm_intrinsics)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index db746bebbe27..893f4faab0d5 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -10,9 +10,9 @@ error[E0275]: overflow evaluating the requirement `NoData $DIR/issue-20413.rs:8:1 | LL | / impl Foo for T where NoData: Foo { -LL | | //~^ ERROR: overflow evaluating the requirement +LL | | LL | | fn answer(self) { -LL | | //~^ ERROR: overflow evaluating the requirement +LL | | LL | | let val: NoData = NoData; LL | | } LL | | } @@ -92,7 +92,7 @@ error[E0275]: overflow evaluating the requirement `NoData $DIR/issue-20413.rs:10:3 | LL | / fn answer(self) { -LL | | //~^ ERROR: overflow evaluating the requirement +LL | | LL | | let val: NoData = NoData; LL | | } | |___^ diff --git a/src/test/ui/issues/issue-20616-1.stderr b/src/test/ui/issues/issue-20616-1.stderr index 522db4124122..143486c8f5ad 100644 --- a/src/test/ui/issues/issue-20616-1.stderr +++ b/src/test/ui/issues/issue-20616-1.stderr @@ -1,7 +1,7 @@ error: expected one of `,`, `:`, or `>`, found `T` --> $DIR/issue-20616-1.rs:9:16 | -LL | type Type_1<'a T> = &'a T; //~ error: expected one of `,`, `:`, or `>`, found `T` +LL | type Type_1<'a T> = &'a T; | ^ expected one of `,`, `:`, or `>` here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20616-2.stderr b/src/test/ui/issues/issue-20616-2.stderr index 544219eb6cfa..1152dec8bad1 100644 --- a/src/test/ui/issues/issue-20616-2.stderr +++ b/src/test/ui/issues/issue-20616-2.stderr @@ -1,7 +1,7 @@ error: expected one of `,` or `>`, found `(` --> $DIR/issue-20616-2.rs:12:31 | -LL | type Type_2 = Type_1_<'static ()>; //~ error: expected one of `,` or `>`, found `(` +LL | type Type_2 = Type_1_<'static ()>; | ^ expected one of `,` or `>` here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20714.stderr b/src/test/ui/issues/issue-20714.stderr index 9cd6a27c12a2..456aff05750d 100644 --- a/src/test/ui/issues/issue-20714.stderr +++ b/src/test/ui/issues/issue-20714.stderr @@ -4,7 +4,7 @@ error[E0618]: expected function, found `G` LL | struct G; | --------- `G` defined here ... -LL | let g = G(); //~ ERROR: expected function, found `G` +LL | let g = G(); | ^-- | | | call expression requires function diff --git a/src/test/ui/issues/issue-20772.stderr b/src/test/ui/issues/issue-20772.stderr index 7dc4e43fd573..e67fedc5a9eb 100644 --- a/src/test/ui/issues/issue-20772.stderr +++ b/src/test/ui/issues/issue-20772.stderr @@ -2,8 +2,8 @@ error[E0391]: cycle detected when computing the supertraits of `T` --> $DIR/issue-20772.rs:1:1 | LL | / trait T : Iterator -LL | | //~^ ERROR cycle detected -LL | | //~| ERROR associated type `Item` not found for `Self` +LL | | +LL | | LL | | {} | |__^ | @@ -12,8 +12,8 @@ note: cycle used when collecting item types in top-level module --> $DIR/issue-20772.rs:1:1 | LL | / trait T : Iterator -LL | | //~^ ERROR cycle detected -LL | | //~| ERROR associated type `Item` not found for `Self` +LL | | +LL | | LL | | {} | |__^ diff --git a/src/test/ui/issues/issue-20831-debruijn.stderr b/src/test/ui/issues/issue-20831-debruijn.stderr index fa7704cf17e3..b2a05551837c 100644 --- a/src/test/ui/issues/issue-20831-debruijn.stderr +++ b/src/test/ui/issues/issue-20831-debruijn.stderr @@ -3,8 +3,8 @@ error[E0308]: mismatched types | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ -LL | | //~^^ ERROR cannot infer -LL | | //~| ERROR mismatched types +LL | | +LL | | ... | LL | | self.sub = t; LL | | } @@ -17,8 +17,8 @@ note: the anonymous lifetime #2 defined on the method body at 28:5... | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ -LL | | //~^^ ERROR cannot infer -LL | | //~| ERROR mismatched types +LL | | +LL | | ... | LL | | self.sub = t; LL | | } @@ -34,8 +34,8 @@ error[E0308]: mismatched types | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ -LL | | //~^^ ERROR cannot infer -LL | | //~| ERROR mismatched types +LL | | +LL | | ... | LL | | self.sub = t; LL | | } @@ -53,8 +53,8 @@ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the m | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ -LL | | //~^^ ERROR cannot infer -LL | | //~| ERROR mismatched types +LL | | +LL | | ... | LL | | self.sub = t; LL | | } @@ -65,8 +65,8 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` d | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ -LL | | //~^^ ERROR cannot infer -LL | | //~| ERROR mismatched types +LL | | +LL | | ... | LL | | self.sub = t; LL | | } @@ -77,8 +77,8 @@ note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on th | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ -LL | | //~^^ ERROR cannot infer -LL | | //~| ERROR mismatched types +LL | | +LL | | ... | LL | | self.sub = t; LL | | } diff --git a/src/test/ui/issues/issue-2151.stderr b/src/test/ui/issues/issue-2151.stderr index 23f3c58653e5..a2bcc8a8ceaf 100644 --- a/src/test/ui/issues/issue-2151.stderr +++ b/src/test/ui/issues/issue-2151.stderr @@ -3,7 +3,7 @@ error[E0282]: type annotations needed | LL | let x = panic!(); | - consider giving `x` a type -LL | x.clone(); //~ ERROR type annotations needed +LL | x.clone(); | ^ cannot infer type | = note: type must be known at this point diff --git a/src/test/ui/issues/issue-21600.stderr b/src/test/ui/issues/issue-21600.stderr index ccb75f4cc005..a20838c6c9b3 100644 --- a/src/test/ui/issues/issue-21600.stderr +++ b/src/test/ui/issues/issue-21600.stderr @@ -1,7 +1,7 @@ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure --> $DIR/issue-21600.rs:14:17 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^^ | help: consider changing this to accept closures that implement `FnMut` @@ -10,21 +10,21 @@ help: consider changing this to accept closures that implement `FnMut` LL | call_it(|| { | _____________^ LL | | call_it(|| x.gen()); -LL | | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer -LL | | //~^ ERROR cannot borrow data mutably in a captured outer +LL | | call_it(|| x.gen_mut()); +LL | | LL | | }); | |_____^ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure --> $DIR/issue-21600.rs:14:20 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^ | help: consider changing this closure to take self by mutable reference --> $DIR/issue-21600.rs:14:17 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-21837.stderr b/src/test/ui/issues/issue-21837.stderr index 464a65fa695a..3111d3a47414 100644 --- a/src/test/ui/issues/issue-21837.stderr +++ b/src/test/ui/issues/issue-21837.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: Bound` is not satisfied --> $DIR/issue-21837.rs:8:9 | -LL | impl Trait2 for Foo {} //~ ERROR the trait bound `T: Bound` is not satisfied +LL | impl Trait2 for Foo {} | ^^^^^^ the trait `Bound` is not implemented for `T` | = help: consider adding a `where T: Bound` bound diff --git a/src/test/ui/issues/issue-21974.stderr b/src/test/ui/issues/issue-21974.stderr index d5c48db4500e..85e59d7bede5 100644 --- a/src/test/ui/issues/issue-21974.stderr +++ b/src/test/ui/issues/issue-21974.stderr @@ -1,7 +1,7 @@ error[E0283]: type annotations required: cannot resolve `&'a T: Foo` --> $DIR/issue-21974.rs:10:1 | -LL | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations required +LL | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) LL | | where &'a T : Foo, LL | | &'b T : Foo LL | | { diff --git a/src/test/ui/issues/issue-22289.stderr b/src/test/ui/issues/issue-22289.stderr index 5214ec1ad163..e9846b848f43 100644 --- a/src/test/ui/issues/issue-22289.stderr +++ b/src/test/ui/issues/issue-22289.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `i32` as `&(dyn std::any::Any + 'static)` --> $DIR/issue-22289.rs:2:5 | -LL | 0 as &std::any::Any; //~ ERROR non-primitive cast +LL | 0 as &std::any::Any; | ^^^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/issues/issue-22560.stderr b/src/test/ui/issues/issue-22560.stderr index c6de479aac04..be4f3dda0cbc 100644 --- a/src/test/ui/issues/issue-22560.stderr +++ b/src/test/ui/issues/issue-22560.stderr @@ -25,8 +25,8 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op | LL | type Test = Add + | _____________^ -LL | | //~^ ERROR E0393 -LL | | //~| ERROR E0191 +LL | | +LL | | LL | | Sub; | |_______________^ associated type `Output` must be specified diff --git a/src/test/ui/issues/issue-22599.stderr b/src/test/ui/issues/issue-22599.stderr index bc4949da6f78..12234293ac99 100644 --- a/src/test/ui/issues/issue-22599.stderr +++ b/src/test/ui/issues/issue-22599.stderr @@ -1,7 +1,7 @@ error: unused variable: `a` --> $DIR/issue-22599.rs:8:19 | -LL | v = match 0 { a => 0 }; //~ ERROR: unused variable: `a` +LL | v = match 0 { a => 0 }; | ^ help: consider prefixing with an underscore: `_a` | note: lint level defined here diff --git a/src/test/ui/issues/issue-22638.stderr b/src/test/ui/issues/issue-22638.stderr index ba7d5f070170..aff968f3618c 100644 --- a/src/test/ui/issues/issue-22638.stderr +++ b/src/test/ui/issues/issue-22638.stderr @@ -2,7 +2,7 @@ error: reached the type-length limit while instantiating `D::matches::$CLOSURE` --> $DIR/issue-22638.rs:52:5 | LL | / pub fn matches(&self, f: &F) { -LL | | //~^ ERROR reached the type-length limit while instantiating `D::matches::<[closure +LL | | LL | | let &D(ref a) = self; LL | | a.matches(f) LL | | } diff --git a/src/test/ui/issues/issue-22644.stderr b/src/test/ui/issues/issue-22644.stderr index de97b2271b10..cbff5575ed20 100644 --- a/src/test/ui/issues/issue-22644.stderr +++ b/src/test/ui/issues/issue-22644.stderr @@ -1,7 +1,7 @@ error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison --> $DIR/issue-22644.rs:8:31 | -LL | println!("{}", a as usize < long_name); //~ ERROR `<` is interpreted as a start of generic +LL | println!("{}", a as usize < long_name); | ---------- ^ --------- interpreted as generic arguments | | | | | not interpreted as comparison @@ -19,7 +19,7 @@ LL | println!("{}{}", a as usize < long_name, long_name); error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison --> $DIR/issue-22644.rs:11:31 | -LL | println!("{}", a as usize < 4); //~ ERROR `<` is interpreted as a start of generic +LL | println!("{}", a as usize < 4); | ---------- ^ - interpreted as generic arguments | | | | | not interpreted as comparison @@ -37,7 +37,7 @@ LL | println!("{}{}", a: usize < long_name, long_name); error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison --> $DIR/issue-22644.rs:15:29 | -LL | println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start of generic +LL | println!("{}", a: usize < 4); | -------- ^ - interpreted as generic arguments | | | | | not interpreted as comparison @@ -46,7 +46,7 @@ LL | println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start o error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison --> $DIR/issue-22644.rs:20:20 | -LL | < //~ ERROR `<` is interpreted as a start of generic +LL | < | ^ not interpreted as comparison LL | 4); | - interpreted as generic arguments @@ -60,7 +60,7 @@ LL | usize) error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison --> $DIR/issue-22644.rs:29:20 | -LL | < //~ ERROR `<` is interpreted as a start of generic +LL | < | ^ not interpreted as comparison LL | 5); | - interpreted as generic arguments @@ -77,7 +77,7 @@ LL | error: `<` is interpreted as a start of generic arguments for `usize`, not a shift --> $DIR/issue-22644.rs:32:31 | -LL | println!("{}", a as usize << long_name); //~ ERROR `<` is interpreted as a start of generic +LL | println!("{}", a as usize << long_name); | ---------- ^^ --------- interpreted as generic arguments | | | | | not interpreted as shift @@ -86,7 +86,7 @@ LL | println!("{}", a as usize << long_name); //~ ERROR `<` is interpreted a error: expected type, found `4` --> $DIR/issue-22644.rs:34:28 | -LL | println!("{}", a: &mut 4); //~ ERROR expected type, found `4` +LL | println!("{}", a: &mut 4); | ^ expecting a type here because of type ascription error: aborting due to 9 previous errors diff --git a/src/test/ui/issues/issue-22684.stderr b/src/test/ui/issues/issue-22684.stderr index 6e2b2357a05d..738123ec4d41 100644 --- a/src/test/ui/issues/issue-22684.stderr +++ b/src/test/ui/issues/issue-22684.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-22684.rs:17:17 | -LL | let _: () = foo::Foo.bar(); //~ ERROR mismatched types +LL | let _: () = foo::Foo.bar(); | ^^^^^^^^^^^^^^ expected (), found bool | = note: expected type `()` diff --git a/src/test/ui/issues/issue-2281-part1.stderr b/src/test/ui/issues/issue-2281-part1.stderr index faf31c7bd4af..c2391a7c0911 100644 --- a/src/test/ui/issues/issue-2281-part1.stderr +++ b/src/test/ui/issues/issue-2281-part1.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `foobar` in this scope --> $DIR/issue-2281-part1.rs:1:28 | -LL | fn main() { println!("{}", foobar); } //~ ERROR cannot find value `foobar` in this scope +LL | fn main() { println!("{}", foobar); } | ^^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22886.stderr b/src/test/ui/issues/issue-22886.stderr index ff206e8113e1..c4b396559241 100644 --- a/src/test/ui/issues/issue-22886.stderr +++ b/src/test/ui/issues/issue-22886.stderr @@ -1,7 +1,7 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates --> $DIR/issue-22886.rs:13:6 | -LL | impl<'a> Iterator for Newtype { //~ ERROR E0207 +LL | impl<'a> Iterator for Newtype { | ^^ unconstrained lifetime parameter error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23041.stderr b/src/test/ui/issues/issue-23041.stderr index aa6ffdd2570f..401086b20443 100644 --- a/src/test/ui/issues/issue-23041.stderr +++ b/src/test/ui/issues/issue-23041.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/issue-23041.rs:6:22 | -LL | b.downcast_ref::_>(); //~ ERROR E0282 +LL | b.downcast_ref::_>(); | ^^^^^^^^ cannot infer type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23046.stderr b/src/test/ui/issues/issue-23046.stderr index 9b7599e1e35d..aab90a9d4403 100644 --- a/src/test/ui/issues/issue-23046.stderr +++ b/src/test/ui/issues/issue-23046.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/issue-23046.rs:17:15 | -LL | let ex = |x| { //~ ERROR type annotations needed +LL | let ex = |x| { | ^ consider giving this closure parameter a type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23073.stderr b/src/test/ui/issues/issue-23073.stderr index e3ddd190d4f8..3a10a1ab11ac 100644 --- a/src/test/ui/issues/issue-23073.stderr +++ b/src/test/ui/issues/issue-23073.stderr @@ -1,7 +1,7 @@ error[E0223]: ambiguous associated type --> $DIR/issue-23073.rs:6:17 | -LL | type FooT = <::Foo>::T; //~ ERROR ambiguous associated type +LL | type FooT = <::Foo>::T; | ^^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<::Foo as Trait>::T` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23080-2.stderr b/src/test/ui/issues/issue-23080-2.stderr index db9a6488851a..38998469e42d 100644 --- a/src/test/ui/issues/issue-23080-2.stderr +++ b/src/test/ui/issues/issue-23080-2.stderr @@ -2,7 +2,7 @@ error[E0380]: auto traits cannot have methods or associated items --> $DIR/issue-23080-2.rs:7:1 | LL | / unsafe auto trait Trait { -LL | | //~^ ERROR E0380 +LL | | LL | | type Output; LL | | } | |_^ diff --git a/src/test/ui/issues/issue-23080.stderr b/src/test/ui/issues/issue-23080.stderr index cace9a57507f..ed843e793bee 100644 --- a/src/test/ui/issues/issue-23080.stderr +++ b/src/test/ui/issues/issue-23080.stderr @@ -2,7 +2,7 @@ error[E0380]: auto traits cannot have methods or associated items --> $DIR/issue-23080.rs:5:1 | LL | / unsafe auto trait Trait { -LL | | //~^ ERROR E0380 +LL | | LL | | fn method(&self) { LL | | println!("Hello"); LL | | } diff --git a/src/test/ui/issues/issue-23189.stderr b/src/test/ui/issues/issue-23189.stderr index 82c6ed9c062b..ed065212c560 100644 --- a/src/test/ui/issues/issue-23189.stderr +++ b/src/test/ui/issues/issue-23189.stderr @@ -1,7 +1,7 @@ error[E0574]: expected struct, variant or union type, found module `module` --> $DIR/issue-23189.rs:4:13 | -LL | let _ = module { x: 0 }; //~ERROR expected struct +LL | let _ = module { x: 0 }; | ^^^^^^ not a struct, variant or union type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2330.stderr b/src/test/ui/issues/issue-2330.stderr index 472ad199a639..877cf68b5866 100644 --- a/src/test/ui/issues/issue-2330.stderr +++ b/src/test/ui/issues/issue-2330.stderr @@ -1,7 +1,7 @@ error[E0404]: expected trait, found enum `Chan` --> $DIR/issue-2330.rs:8:6 | -LL | impl Chan for isize { //~ ERROR expected trait, found enum `Chan` +LL | impl Chan for isize { | ^^^^ not a trait error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23302-1.stderr b/src/test/ui/issues/issue-23302-1.stderr index ed422e10c985..5fa82f8b7863 100644 --- a/src/test/ui/issues/issue-23302-1.stderr +++ b/src/test/ui/issues/issue-23302-1.stderr @@ -1,14 +1,14 @@ error[E0391]: cycle detected when processing `X::A::{{constant}}` --> $DIR/issue-23302-1.rs:4:9 | -LL | A = X::A as isize, //~ ERROR E0391 +LL | A = X::A as isize, | ^^^^^^^^^^^^^ | = note: ...which again requires processing `X::A::{{constant}}`, completing the cycle note: cycle used when const-evaluating `X::A::{{constant}}` --> $DIR/issue-23302-1.rs:4:9 | -LL | A = X::A as isize, //~ ERROR E0391 +LL | A = X::A as isize, | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23302-2.stderr b/src/test/ui/issues/issue-23302-2.stderr index b6d44ceec9d7..5b77baed73c3 100644 --- a/src/test/ui/issues/issue-23302-2.stderr +++ b/src/test/ui/issues/issue-23302-2.stderr @@ -1,14 +1,14 @@ error[E0391]: cycle detected when processing `Y::A::{{constant}}` --> $DIR/issue-23302-2.rs:4:9 | -LL | A = Y::B as isize, //~ ERROR E0391 +LL | A = Y::B as isize, | ^^^^^^^^^^^^^ | = note: ...which again requires processing `Y::A::{{constant}}`, completing the cycle note: cycle used when const-evaluating `Y::A::{{constant}}` --> $DIR/issue-23302-2.rs:4:9 | -LL | A = Y::B as isize, //~ ERROR E0391 +LL | A = Y::B as isize, | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23302-3.stderr b/src/test/ui/issues/issue-23302-3.stderr index b3ca736622a2..a7d643987f71 100644 --- a/src/test/ui/issues/issue-23302-3.stderr +++ b/src/test/ui/issues/issue-23302-3.stderr @@ -1,13 +1,13 @@ error[E0391]: cycle detected when const checking if rvalue is promotable to static `A` --> $DIR/issue-23302-3.rs:1:1 | -LL | const A: i32 = B; //~ ERROR cycle detected +LL | const A: i32 = B; | ^^^^^^^^^^^^^^^^^ | note: ...which requires checking which parts of `A` are promotable to static... --> $DIR/issue-23302-3.rs:1:16 | -LL | const A: i32 = B; //~ ERROR cycle detected +LL | const A: i32 = B; | ^ note: ...which requires const checking if rvalue is promotable to static `B`... --> $DIR/issue-23302-3.rs:3:1 diff --git a/src/test/ui/issues/issue-24081.stderr b/src/test/ui/issues/issue-24081.stderr index 999ac0d5570e..647048c7c201 100644 --- a/src/test/ui/issues/issue-24081.stderr +++ b/src/test/ui/issues/issue-24081.stderr @@ -4,7 +4,7 @@ error[E0255]: the name `Add` is defined multiple times LL | use std::ops::Add; | ------------- previous import of the trait `Add` here ... -LL | type Add = bool; //~ ERROR the name `Add` is defined multiple times +LL | type Add = bool; | ^^^^^^^^^^^^^^^^ `Add` redefined here | = note: `Add` must be defined only once in the type namespace of this module @@ -19,7 +19,7 @@ error[E0255]: the name `Sub` is defined multiple times LL | use std::ops::Sub; | ------------- previous import of the trait `Sub` here ... -LL | struct Sub { x: f32 } //~ ERROR the name `Sub` is defined multiple times +LL | struct Sub { x: f32 } | ^^^^^^^^^^ `Sub` redefined here | = note: `Sub` must be defined only once in the type namespace of this module @@ -34,7 +34,7 @@ error[E0255]: the name `Mul` is defined multiple times LL | use std::ops::Mul; | ------------- previous import of the trait `Mul` here ... -LL | enum Mul { A, B } //~ ERROR the name `Mul` is defined multiple times +LL | enum Mul { A, B } | ^^^^^^^^ `Mul` redefined here | = note: `Mul` must be defined only once in the type namespace of this module @@ -49,7 +49,7 @@ error[E0255]: the name `Div` is defined multiple times LL | use std::ops::Div; | ------------- previous import of the trait `Div` here ... -LL | mod Div { } //~ ERROR the name `Div` is defined multiple times +LL | mod Div { } | ^^^^^^^ `Div` redefined here | = note: `Div` must be defined only once in the type namespace of this module @@ -64,7 +64,7 @@ error[E0255]: the name `Rem` is defined multiple times LL | use std::ops::Rem; | ------------- previous import of the trait `Rem` here ... -LL | trait Rem { } //~ ERROR the name `Rem` is defined multiple times +LL | trait Rem { } | ^^^^^^^^^ `Rem` redefined here | = note: `Rem` must be defined only once in the type namespace of this module diff --git a/src/test/ui/issues/issue-24267-flow-exit.stderr b/src/test/ui/issues/issue-24267-flow-exit.stderr index 0d226e01809b..2b9e2ee9011e 100644 --- a/src/test/ui/issues/issue-24267-flow-exit.stderr +++ b/src/test/ui/issues/issue-24267-flow-exit.stderr @@ -1,13 +1,13 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/issue-24267-flow-exit.rs:12:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/issue-24267-flow-exit.rs:18:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-24322.stderr b/src/test/ui/issues/issue-24322.stderr index b42854387518..def373cf2c0a 100644 --- a/src/test/ui/issues/issue-24322.stderr +++ b/src/test/ui/issues/issue-24322.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-24322.rs:8:29 | -LL | let x: &fn(&B) -> u32 = &B::func; //~ ERROR mismatched types +LL | let x: &fn(&B) -> u32 = &B::func; | ^^^^^^^^ expected fn pointer, found fn item | = note: expected type `&for<'r> fn(&'r B) -> u32` diff --git a/src/test/ui/issues/issue-24352.stderr b/src/test/ui/issues/issue-24352.stderr index 835706d015b5..a315ca8b08f5 100644 --- a/src/test/ui/issues/issue-24352.stderr +++ b/src/test/ui/issues/issue-24352.stderr @@ -1,7 +1,7 @@ error[E0277]: cannot subtract `{integer}` from `f64` --> $DIR/issue-24352.rs:3:12 | -LL | 1.0f64 - 1 //~ ERROR E0277 +LL | 1.0f64 - 1 | ^ no implementation for `f64 - {integer}` | = help: the trait `std::ops::Sub<{integer}>` is not implemented for `f64` diff --git a/src/test/ui/issues/issue-24357.stderr b/src/test/ui/issues/issue-24357.stderr index 3bc84cba0f53..ced24ffc5edd 100644 --- a/src/test/ui/issues/issue-24357.stderr +++ b/src/test/ui/issues/issue-24357.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | let f = move || { let y = x; }; | ------- value moved (into closure) here -LL | //~^ NOTE value moved (into closure) here +LL | LL | let z = x; | ^ value used here after move | diff --git a/src/test/ui/issues/issue-24363.stderr b/src/test/ui/issues/issue-24363.stderr index ff02887a1539..3399856d3f9a 100644 --- a/src/test/ui/issues/issue-24363.stderr +++ b/src/test/ui/issues/issue-24363.stderr @@ -1,13 +1,13 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/issue-24363.rs:2:7 | -LL | 1.create_a_type_error[ //~ `{integer}` is a primitive type and therefore doesn't have fields +LL | 1.create_a_type_error[ | ^^^^^^^^^^^^^^^^^^^ error[E0369]: binary operation `+` cannot be applied to type `()` --> $DIR/issue-24363.rs:3:9 | -LL | ()+() //~ ERROR binary operation `+` cannot be applied +LL | ()+() | ^^^^^ | = note: an implementation of `std::ops::Add` might be missing for `()` diff --git a/src/test/ui/issues/issue-24365.stderr b/src/test/ui/issues/issue-24365.stderr index 7d02f117f9f5..f9eead8a4f21 100644 --- a/src/test/ui/issues/issue-24365.stderr +++ b/src/test/ui/issues/issue-24365.stderr @@ -1,19 +1,19 @@ error[E0609]: no field `b` on type `Foo` --> $DIR/issue-24365.rs:10:22 | -LL | println!("{}", a.b); //~ no field `b` on type `Foo` +LL | println!("{}", a.b); | ^ error[E0609]: no field `attr_name_idx` on type `&Attribute` --> $DIR/issue-24365.rs:17:18 | -LL | let z = (&x).attr_name_idx; //~ no field `attr_name_idx` on type `&Attribute` +LL | let z = (&x).attr_name_idx; | ^^^^^^^^^^^^^ error[E0609]: no field `attr_name_idx` on type `Attribute` --> $DIR/issue-24365.rs:18:15 | -LL | let y = x.attr_name_idx; //~ no field `attr_name_idx` on type `Attribute` +LL | let y = x.attr_name_idx; | ^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-24682.stderr b/src/test/ui/issues/issue-24682.stderr index f6d03f6c18fd..e1943bf4d683 100644 --- a/src/test/ui/issues/issue-24682.stderr +++ b/src/test/ui/issues/issue-24682.stderr @@ -1,20 +1,20 @@ error[E0229]: associated type bindings are not allowed here --> $DIR/issue-24682.rs:5:11 | -LL | / N= //~ ERROR associated type bindings are not allowed here +LL | / N= LL | | Self::N> { | |_________________^ associated type not allowed here error[E0229]: associated type bindings are not allowed here --> $DIR/issue-24682.rs:11:13 | -LL | //~ ERROR associated type bindings are not allowed here +LL | | ^^^^ associated type not allowed here error[E0229]: associated type bindings are not allowed here --> $DIR/issue-24682.rs:15:13 | -LL | u32 //~ ERROR associated type bindings are not allowed here +LL | u32 | ^^^^ associated type not allowed here error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-25076.stderr b/src/test/ui/issues/issue-25076.stderr index 8793475e6d4e..435ab13edada 100644 --- a/src/test/ui/issues/issue-25076.stderr +++ b/src/test/ui/issues/issue-25076.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `(): InOut<_>` is not satisfied --> $DIR/issue-25076.rs:10:5 | -LL | do_fold(bot(), ()); //~ ERROR `(): InOut<_>` is not satisfied +LL | do_fold(bot(), ()); | ^^^^^^^ the trait `InOut<_>` is not implemented for `()` | note: required by `do_fold` diff --git a/src/test/ui/issues/issue-25368.stderr b/src/test/ui/issues/issue-25368.stderr index 2e6a02e7389a..3ad6a2569be4 100644 --- a/src/test/ui/issues/issue-25368.stderr +++ b/src/test/ui/issues/issue-25368.stderr @@ -4,7 +4,7 @@ error[E0282]: type annotations needed LL | let (tx, rx) = channel(); | -------- consider giving the pattern a type ... -LL | tx.send(Foo{ foo: PhantomData }); //~ ERROR E0282 +LL | tx.send(Foo{ foo: PhantomData }); | ^^^ cannot infer type for `T` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-25396.stderr b/src/test/ui/issues/issue-25396.stderr index aae62b688d4a..38dc9ef10351 100644 --- a/src/test/ui/issues/issue-25396.stderr +++ b/src/test/ui/issues/issue-25396.stderr @@ -3,13 +3,13 @@ error[E0252]: the name `baz` is defined multiple times | LL | use foo::baz; | -------- previous import of the module `baz` here -LL | use bar::baz; //~ ERROR the name `baz` is defined multiple times +LL | use bar::baz; | ^^^^^^^^ `baz` reimported here | = note: `baz` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use bar::baz as other_baz; //~ ERROR the name `baz` is defined multiple times +LL | use bar::baz as other_baz; | ^^^^^^^^^^^^^^^^^^^^^ error[E0252]: the name `Quux` is defined multiple times @@ -17,13 +17,13 @@ error[E0252]: the name `Quux` is defined multiple times | LL | use foo::Quux; | --------- previous import of the trait `Quux` here -LL | use bar::Quux; //~ ERROR the name `Quux` is defined multiple times +LL | use bar::Quux; | ^^^^^^^^^ `Quux` reimported here | = note: `Quux` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use bar::Quux as OtherQuux; //~ ERROR the name `Quux` is defined multiple times +LL | use bar::Quux as OtherQuux; | ^^^^^^^^^^^^^^^^^^^^^^ error[E0252]: the name `blah` is defined multiple times @@ -31,13 +31,13 @@ error[E0252]: the name `blah` is defined multiple times | LL | use foo::blah; | --------- previous import of the type `blah` here -LL | use bar::blah; //~ ERROR the name `blah` is defined multiple times +LL | use bar::blah; | ^^^^^^^^^ `blah` reimported here | = note: `blah` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use bar::blah as other_blah; //~ ERROR the name `blah` is defined multiple times +LL | use bar::blah as other_blah; | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0252]: the name `WOMP` is defined multiple times @@ -45,13 +45,13 @@ error[E0252]: the name `WOMP` is defined multiple times | LL | use foo::WOMP; | --------- previous import of the value `WOMP` here -LL | use bar::WOMP; //~ ERROR the name `WOMP` is defined multiple times +LL | use bar::WOMP; | ^^^^^^^^^ `WOMP` reimported here | = note: `WOMP` must be defined only once in the value namespace of this module help: you can use `as` to change the binding name of the import | -LL | use bar::WOMP as OtherWOMP; //~ ERROR the name `WOMP` is defined multiple times +LL | use bar::WOMP as OtherWOMP; | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-25439.stderr b/src/test/ui/issues/issue-25439.stderr index 9e9ab4e39d34..9b0414831325 100644 --- a/src/test/ui/issues/issue-25439.stderr +++ b/src/test/ui/issues/issue-25439.stderr @@ -1,7 +1,7 @@ error[E0644]: closure/generator type that references itself --> $DIR/issue-25439.rs:8:9 | -LL | fix(|_, x| x); //~ ERROR closure/generator type that references itself [E0644] +LL | fix(|_, x| x); | ^^^^^^^^ cyclic type of infinite size | = note: closures cannot capture themselves or take themselves as argument; diff --git a/src/test/ui/issues/issue-25700.stderr b/src/test/ui/issues/issue-25700.stderr index d4cf89d0abd5..4a203c7c2578 100644 --- a/src/test/ui/issues/issue-25700.stderr +++ b/src/test/ui/issues/issue-25700.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `t` | LL | drop(t); | - value moved here -LL | drop(t); //~ ERROR use of moved value +LL | drop(t); | ^ value used here after move | = note: move occurs because `t` has type `S<()>`, which does not implement the `Copy` trait diff --git a/src/test/ui/issues/issue-2590.stderr b/src/test/ui/issues/issue-2590.stderr index f93b5db3adfb..c50652d32841 100644 --- a/src/test/ui/issues/issue-2590.stderr +++ b/src/test/ui/issues/issue-2590.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-2590.rs:11:9 | -LL | self.tokens //~ ERROR cannot move out of borrowed content +LL | self.tokens | ^^^^ cannot move out of borrowed content error: aborting due to previous error diff --git a/src/test/ui/issues/issue-26158.stderr b/src/test/ui/issues/issue-26158.stderr index 868ffd191cba..3a4dd79e8105 100644 --- a/src/test/ui/issues/issue-26158.stderr +++ b/src/test/ui/issues/issue-26158.stderr @@ -1,7 +1,7 @@ error[E0005]: refutable pattern in local binding: `&[]` not covered --> $DIR/issue-26158.rs:5:9 | -LL | let &[[ref _a, ref _b..]..] = x; //~ ERROR refutable pattern +LL | let &[[ref _a, ref _b..]..] = x; | ^^^^^^^^^^^^^^^^^^^^^^^ pattern `&[]` not covered error: aborting due to previous error diff --git a/src/test/ui/issues/issue-26472.stderr b/src/test/ui/issues/issue-26472.stderr index 8c261d2a3f3e..245ebeaf972e 100644 --- a/src/test/ui/issues/issue-26472.stderr +++ b/src/test/ui/issues/issue-26472.stderr @@ -1,7 +1,7 @@ error[E0616]: field `len` of struct `sub::S` is private --> $DIR/issue-26472.rs:11:13 | -LL | let v = s.len; //~ ERROR field `len` of struct `sub::S` is private +LL | let v = s.len; | ^^--- | | | help: a method `len` also exists, call it with parentheses: `len()` @@ -9,7 +9,7 @@ LL | let v = s.len; //~ ERROR field `len` of struct `sub::S` is private error[E0616]: field `len` of struct `sub::S` is private --> $DIR/issue-26472.rs:12:5 | -LL | s.len = v; //~ ERROR field `len` of struct `sub::S` is private +LL | s.len = v; | ^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-26548.stderr b/src/test/ui/issues/issue-26548.stderr index ff197eeeb0fe..7c1789cc1e99 100644 --- a/src/test/ui/issues/issue-26548.stderr +++ b/src/test/ui/issues/issue-26548.stderr @@ -5,7 +5,7 @@ error[E0391]: cycle detected when computing layout of `std::option::Option` note: cycle used when processing `main` --> $DIR/issue-26548.rs:9:1 | -LL | fn main() { //~ NOTE cycle used when processing `main` +LL | fn main() { | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-26886.stderr b/src/test/ui/issues/issue-26886.stderr index 70dacb353fe0..fa7f922707ab 100644 --- a/src/test/ui/issues/issue-26886.stderr +++ b/src/test/ui/issues/issue-26886.stderr @@ -3,7 +3,7 @@ error[E0252]: the name `Arc` is defined multiple times | LL | use std::sync::{self, Arc}; | --- previous import of the type `Arc` here -LL | use std::sync::Arc; //~ ERROR the name `Arc` is defined multiple times +LL | use std::sync::Arc; | ----^^^^^^^^^^^^^^- | | | | | `Arc` reimported here @@ -17,7 +17,7 @@ error[E0252]: the name `sync` is defined multiple times LL | use std::sync::{self, Arc}; | ---- previous import of the module `sync` here ... -LL | use std::sync; //~ ERROR the name `sync` is defined multiple times +LL | use std::sync; | ----^^^^^^^^^- | | | | | `sync` reimported here diff --git a/src/test/ui/issues/issue-26905.stderr b/src/test/ui/issues/issue-26905.stderr index 93b4d7e36e81..10dbb7325859 100644 --- a/src/test/ui/issues/issue-26905.stderr +++ b/src/test/ui/issues/issue-26905.stderr @@ -1,7 +1,7 @@ error[E0375]: implementing the trait `CoerceUnsized` requires multiple coercions --> $DIR/issue-26905.rs:16:40 | -LL | impl, U: ?Sized> CoerceUnsized> for MyRc{ } //~ERROR +LL | impl, U: ?Sized> CoerceUnsized> for MyRc{ } | ^^^^^^^^^^^^^^^^^^^^^^ requires multiple coercions | = note: `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced diff --git a/src/test/ui/issues/issue-27033.stderr b/src/test/ui/issues/issue-27033.stderr index b343924bb024..ab9543322803 100644 --- a/src/test/ui/issues/issue-27033.stderr +++ b/src/test/ui/issues/issue-27033.stderr @@ -1,7 +1,7 @@ error[E0530]: match bindings cannot shadow unit variants --> $DIR/issue-27033.rs:3:9 | -LL | None @ _ => {} //~ ERROR match bindings cannot shadow unit variants +LL | None @ _ => {} | ^^^^ cannot be named the same as a unit variant error[E0530]: match bindings cannot shadow constants @@ -10,7 +10,7 @@ error[E0530]: match bindings cannot shadow constants LL | const C: u8 = 1; | ---------------- the constant `C` is defined here LL | match 1 { -LL | C @ 2 => { //~ ERROR match bindings cannot shadow constant +LL | C @ 2 => { | ^ cannot be named the same as a constant error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-27042.stderr b/src/test/ui/issues/issue-27042.stderr index bcefb29c18b0..cce7d24a5f60 100644 --- a/src/test/ui/issues/issue-27042.stderr +++ b/src/test/ui/issues/issue-27042.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-27042.rs:6:16 | -LL | loop { break }; //~ ERROR mismatched types +LL | loop { break }; | ^^^^^ expected (), found i32 | = note: expected type `()` @@ -10,7 +10,7 @@ LL | loop { break }; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/issue-27042.rs:8:9 | -LL | / 'b: //~ ERROR mismatched types +LL | / 'b: LL | | while true { break }; // but here we cite the whole loop | |____________________________^ expected i32, found () | @@ -20,7 +20,7 @@ LL | | while true { break }; // but here we cite the whole loop error[E0308]: mismatched types --> $DIR/issue-27042.rs:11:9 | -LL | / 'c: //~ ERROR mismatched types +LL | / 'c: LL | | for _ in None { break }; // but here we cite the whole loop | |_______________________________^ expected i32, found () | @@ -30,7 +30,7 @@ LL | | for _ in None { break }; // but here we cite the whole loop error[E0308]: mismatched types --> $DIR/issue-27042.rs:14:9 | -LL | / 'd: //~ ERROR mismatched types +LL | / 'd: LL | | while let Some(_) = None { break }; | |__________________________________________^ expected i32, found () | diff --git a/src/test/ui/issues/issue-27060-2.stderr b/src/test/ui/issues/issue-27060-2.stderr index b95c298b6e67..f7227c341014 100644 --- a/src/test/ui/issues/issue-27060-2.stderr +++ b/src/test/ui/issues/issue-27060-2.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/issue-27060-2.rs:3:5 | -LL | data: T, //~ ERROR the size for values of type +LL | data: T, | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` diff --git a/src/test/ui/issues/issue-27060.stderr b/src/test/ui/issues/issue-27060.stderr index 023f90eb9fea..bc44c1a4ac57 100644 --- a/src/test/ui/issues/issue-27060.stderr +++ b/src/test/ui/issues/issue-27060.stderr @@ -1,7 +1,7 @@ error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) --> $DIR/issue-27060.rs:26:13 | -LL | let _ = &good.data; //~ ERROR borrow of packed field is unsafe +LL | let _ = &good.data; | ^^^^^^^^^^ | note: lint level defined here @@ -16,7 +16,7 @@ LL | #[deny(safe_packed_borrows)] error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) --> $DIR/issue-27060.rs:28:13 | -LL | let _ = &good.data2[0]; //~ ERROR borrow of packed field is unsafe +LL | let _ = &good.data2[0]; | ^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/issues/issue-27340.stderr b/src/test/ui/issues/issue-27340.stderr index 634a31a89d55..05b213b293cb 100644 --- a/src/test/ui/issues/issue-27340.stderr +++ b/src/test/ui/issues/issue-27340.stderr @@ -3,7 +3,7 @@ error[E0204]: the trait `Copy` may not be implemented for this type | LL | #[derive(Copy, Clone)] | ^^^^ -LL | //~^ ERROR the trait `Copy` may not be implemented for this type +LL | LL | struct Bar(Foo); | --- this field does not implement `Copy` diff --git a/src/test/ui/issues/issue-27815.stderr b/src/test/ui/issues/issue-27815.stderr index fbddd3be9dce..43f78ccf6395 100644 --- a/src/test/ui/issues/issue-27815.stderr +++ b/src/test/ui/issues/issue-27815.stderr @@ -1,13 +1,13 @@ error[E0574]: expected struct, variant or union type, found module `A` --> $DIR/issue-27815.rs:4:13 | -LL | let u = A { x: 1 }; //~ ERROR expected struct, variant or union type, found module `A` +LL | let u = A { x: 1 }; | ^ not a struct, variant or union type error[E0574]: expected struct, variant or union type, found builtin type `u32` --> $DIR/issue-27815.rs:5:13 | -LL | let v = u32 { x: 1 }; //~ ERROR expected struct, variant or union type, found builtin type `u32` +LL | let v = u32 { x: 1 }; | ^^^ not a struct, variant or union type error[E0574]: expected struct, variant or union type, found module `A` diff --git a/src/test/ui/issues/issue-28105.stderr b/src/test/ui/issues/issue-28105.stderr index 900bc43bfc8a..0e1b90e65209 100644 --- a/src/test/ui/issues/issue-28105.stderr +++ b/src/test/ui/issues/issue-28105.stderr @@ -1,13 +1,13 @@ error[E0268]: `continue` outside of loop --> $DIR/issue-28105.rs:4:5 | -LL | continue //~ ERROR `continue` outside of loop +LL | continue | ^^^^^^^^ cannot break outside of a loop error[E0268]: `break` outside of loop --> $DIR/issue-28105.rs:6:5 | -LL | break //~ ERROR `break` outside of loop +LL | break | ^^^^^ cannot break outside of a loop error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-28109.stderr b/src/test/ui/issues/issue-28109.stderr index 91a829725643..0f918d3b6f70 100644 --- a/src/test/ui/issues/issue-28109.stderr +++ b/src/test/ui/issues/issue-28109.stderr @@ -1,13 +1,13 @@ error[E0426]: use of undeclared label `'b` --> $DIR/issue-28109.rs:6:9 | -LL | 'b //~ ERROR use of undeclared label +LL | 'b | ^^ undeclared label `'b` error[E0426]: use of undeclared label `'c` --> $DIR/issue-28109.rs:9:9 | -LL | 'c //~ ERROR use of undeclared label +LL | 'c | ^^ undeclared label `'c` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-28134.stderr b/src/test/ui/issues/issue-28134.stderr index 5b967b31c29e..b9189480048d 100644 --- a/src/test/ui/issues/issue-28134.stderr +++ b/src/test/ui/issues/issue-28134.stderr @@ -1,7 +1,7 @@ error: only functions may be used as tests --> $DIR/issue-28134.rs:3:1 | -LL | #![test] //~ ERROR only functions may be used as tests +LL | #![test] | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2823.stderr b/src/test/ui/issues/issue-2823.stderr index b51ff611dbd7..4c1dfb8501a9 100644 --- a/src/test/ui/issues/issue-2823.stderr +++ b/src/test/ui/issues/issue-2823.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `clone` found for type `C` in the current scope LL | struct C { | -------- method `clone` not found for this ... -LL | let _d = c.clone(); //~ ERROR no method named `clone` found +LL | let _d = c.clone(); | ^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope diff --git a/src/test/ui/issues/issue-28388-1.stderr b/src/test/ui/issues/issue-28388-1.stderr index 6aabf6535120..7f5e47aa84fb 100644 --- a/src/test/ui/issues/issue-28388-1.stderr +++ b/src/test/ui/issues/issue-28388-1.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `foo` --> $DIR/issue-28388-1.rs:3:5 | -LL | use foo::{}; //~ ERROR unresolved import `foo` +LL | use foo::{}; | ^^^^^^^ no `foo` in the root error: aborting due to previous error diff --git a/src/test/ui/issues/issue-28472.stderr b/src/test/ui/issues/issue-28472.stderr index 8288a1d9bb78..92b598252bf7 100644 --- a/src/test/ui/issues/issue-28472.stderr +++ b/src/test/ui/issues/issue-28472.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `foo` is defined multiple times LL | fn foo(); | --------- previous definition of the value `foo` here LL | -LL | / pub //~ ERROR the name `foo` is defined multiple times +LL | / pub LL | | fn foo(); | |___________^ `foo` redefined here | @@ -16,7 +16,7 @@ error[E0428]: the name `foo` is defined multiple times LL | fn foo(); | --------- previous definition of the value `foo` here ... -LL | / pub //~ ERROR the name `foo` is defined multiple times +LL | / pub LL | | static mut foo: u32; | |______________________^ `foo` redefined here | diff --git a/src/test/ui/issues/issue-2848.stderr b/src/test/ui/issues/issue-2848.stderr index d9466405dd2a..71ed7d70b5b8 100644 --- a/src/test/ui/issues/issue-2848.stderr +++ b/src/test/ui/issues/issue-2848.stderr @@ -1,7 +1,7 @@ error[E0408]: variable `beta` is not bound in all patterns --> $DIR/issue-2848.rs:14:7 | -LL | alpha | beta => {} //~ ERROR variable `beta` is not bound in all patterns +LL | alpha | beta => {} | ^^^^^ ---- variable not in all patterns | | | pattern doesn't bind `beta` diff --git a/src/test/ui/issues/issue-28576.stderr b/src/test/ui/issues/issue-28576.stderr index b04715f23f49..cf6174ba857b 100644 --- a/src/test/ui/issues/issue-28576.stderr +++ b/src/test/ui/issues/issue-28576.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/issue-28576.rs:7:12 | -LL | / Bar //~ ERROR the trait `Bar` cannot be made into an object +LL | / Bar LL | | | |________________________^ the trait `Bar` cannot be made into an object | diff --git a/src/test/ui/issues/issue-28625.stderr b/src/test/ui/issues/issue-28625.stderr index 36cb47944f23..7ee0cd486707 100644 --- a/src/test/ui/issues/issue-28625.stderr +++ b/src/test/ui/issues/issue-28625.stderr @@ -1,7 +1,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/issue-28625.rs:12:14 | -LL | unsafe { std::mem::transmute(a) } //~ ERROR cannot transmute between types of different sizes +LL | unsafe { std::mem::transmute(a) } | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `&ArrayPeano` (N bits) diff --git a/src/test/ui/issues/issue-28837.stderr b/src/test/ui/issues/issue-28837.stderr index 833493e5cda5..aeb25ce12867 100644 --- a/src/test/ui/issues/issue-28837.stderr +++ b/src/test/ui/issues/issue-28837.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `+` cannot be applied to type `A` --> $DIR/issue-28837.rs:6:5 | -LL | a + a; //~ ERROR binary operation `+` cannot be applied to type `A` +LL | a + a; | ^^^^^ | = note: an implementation of `std::ops::Add` might be missing for `A` @@ -9,7 +9,7 @@ LL | a + a; //~ ERROR binary operation `+` cannot be applied to type `A` error[E0369]: binary operation `-` cannot be applied to type `A` --> $DIR/issue-28837.rs:8:5 | -LL | a - a; //~ ERROR binary operation `-` cannot be applied to type `A` +LL | a - a; | ^^^^^ | = note: an implementation of `std::ops::Sub` might be missing for `A` @@ -17,7 +17,7 @@ LL | a - a; //~ ERROR binary operation `-` cannot be applied to type `A` error[E0369]: binary operation `*` cannot be applied to type `A` --> $DIR/issue-28837.rs:10:5 | -LL | a * a; //~ ERROR binary operation `*` cannot be applied to type `A` +LL | a * a; | ^^^^^ | = note: an implementation of `std::ops::Mul` might be missing for `A` @@ -25,7 +25,7 @@ LL | a * a; //~ ERROR binary operation `*` cannot be applied to type `A` error[E0369]: binary operation `/` cannot be applied to type `A` --> $DIR/issue-28837.rs:12:5 | -LL | a / a; //~ ERROR binary operation `/` cannot be applied to type `A` +LL | a / a; | ^^^^^ | = note: an implementation of `std::ops::Div` might be missing for `A` @@ -33,7 +33,7 @@ LL | a / a; //~ ERROR binary operation `/` cannot be applied to type `A` error[E0369]: binary operation `%` cannot be applied to type `A` --> $DIR/issue-28837.rs:14:5 | -LL | a % a; //~ ERROR binary operation `%` cannot be applied to type `A` +LL | a % a; | ^^^^^ | = note: an implementation of `std::ops::Rem` might be missing for `A` @@ -41,7 +41,7 @@ LL | a % a; //~ ERROR binary operation `%` cannot be applied to type `A` error[E0369]: binary operation `&` cannot be applied to type `A` --> $DIR/issue-28837.rs:16:5 | -LL | a & a; //~ ERROR binary operation `&` cannot be applied to type `A` +LL | a & a; | ^^^^^ | = note: an implementation of `std::ops::BitAnd` might be missing for `A` @@ -49,7 +49,7 @@ LL | a & a; //~ ERROR binary operation `&` cannot be applied to type `A` error[E0369]: binary operation `|` cannot be applied to type `A` --> $DIR/issue-28837.rs:18:5 | -LL | a | a; //~ ERROR binary operation `|` cannot be applied to type `A` +LL | a | a; | ^^^^^ | = note: an implementation of `std::ops::BitOr` might be missing for `A` @@ -57,7 +57,7 @@ LL | a | a; //~ ERROR binary operation `|` cannot be applied to type `A` error[E0369]: binary operation `<<` cannot be applied to type `A` --> $DIR/issue-28837.rs:20:5 | -LL | a << a; //~ ERROR binary operation `<<` cannot be applied to type `A` +LL | a << a; | ^^^^^^ | = note: an implementation of `std::ops::Shl` might be missing for `A` @@ -65,7 +65,7 @@ LL | a << a; //~ ERROR binary operation `<<` cannot be applied to type `A` error[E0369]: binary operation `>>` cannot be applied to type `A` --> $DIR/issue-28837.rs:22:5 | -LL | a >> a; //~ ERROR binary operation `>>` cannot be applied to type `A` +LL | a >> a; | ^^^^^^ | = note: an implementation of `std::ops::Shr` might be missing for `A` @@ -73,7 +73,7 @@ LL | a >> a; //~ ERROR binary operation `>>` cannot be applied to type `A` error[E0369]: binary operation `==` cannot be applied to type `A` --> $DIR/issue-28837.rs:24:5 | -LL | a == a; //~ ERROR binary operation `==` cannot be applied to type `A` +LL | a == a; | ^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `A` @@ -81,7 +81,7 @@ LL | a == a; //~ ERROR binary operation `==` cannot be applied to type `A` error[E0369]: binary operation `!=` cannot be applied to type `A` --> $DIR/issue-28837.rs:26:5 | -LL | a != a; //~ ERROR binary operation `!=` cannot be applied to type `A` +LL | a != a; | ^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `A` @@ -89,7 +89,7 @@ LL | a != a; //~ ERROR binary operation `!=` cannot be applied to type `A` error[E0369]: binary operation `<` cannot be applied to type `A` --> $DIR/issue-28837.rs:28:5 | -LL | a < a; //~ ERROR binary operation `<` cannot be applied to type `A` +LL | a < a; | ^^^^^ | = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` @@ -97,7 +97,7 @@ LL | a < a; //~ ERROR binary operation `<` cannot be applied to type `A` error[E0369]: binary operation `<=` cannot be applied to type `A` --> $DIR/issue-28837.rs:30:5 | -LL | a <= a; //~ ERROR binary operation `<=` cannot be applied to type `A` +LL | a <= a; | ^^^^^^ | = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` @@ -105,7 +105,7 @@ LL | a <= a; //~ ERROR binary operation `<=` cannot be applied to type `A` error[E0369]: binary operation `>` cannot be applied to type `A` --> $DIR/issue-28837.rs:32:5 | -LL | a > a; //~ ERROR binary operation `>` cannot be applied to type `A` +LL | a > a; | ^^^^^ | = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` @@ -113,7 +113,7 @@ LL | a > a; //~ ERROR binary operation `>` cannot be applied to type `A` error[E0369]: binary operation `>=` cannot be applied to type `A` --> $DIR/issue-28837.rs:34:5 | -LL | a >= a; //~ ERROR binary operation `>=` cannot be applied to type `A` +LL | a >= a; | ^^^^^^ | = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` diff --git a/src/test/ui/issues/issue-28848.stderr b/src/test/ui/issues/issue-28848.stderr index d9cdccac9fca..5f0f202c0b27 100644 --- a/src/test/ui/issues/issue-28848.stderr +++ b/src/test/ui/issues/issue-28848.stderr @@ -1,7 +1,7 @@ error[E0478]: lifetime bound not satisfied --> $DIR/issue-28848.rs:10:5 | -LL | Foo::<'a, 'b>::xmute(u) //~ ERROR lifetime bound not satisfied +LL | Foo::<'a, 'b>::xmute(u) | ^^^^^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'b as defined on the function body at 9:16 diff --git a/src/test/ui/issues/issue-28992-empty.stderr b/src/test/ui/issues/issue-28992-empty.stderr index 1eb1c67d106c..68be37252cb5 100644 --- a/src/test/ui/issues/issue-28992-empty.stderr +++ b/src/test/ui/issues/issue-28992-empty.stderr @@ -1,7 +1,7 @@ error[E0532]: expected tuple struct/variant, found constant `C1` --> $DIR/issue-28992-empty.rs:13:12 | -LL | if let C1(..) = 0 {} //~ ERROR expected tuple struct/variant, found constant `C1` +LL | if let C1(..) = 0 {} | ^^ not a tuple struct/variant error[E0164]: expected tuple struct/variant, found associated constant `::C2` diff --git a/src/test/ui/issues/issue-29147.stderr b/src/test/ui/issues/issue-29147.stderr index c6d850925ec6..3b42186b2513 100644 --- a/src/test/ui/issues/issue-29147.stderr +++ b/src/test/ui/issues/issue-29147.stderr @@ -1,7 +1,7 @@ error[E0283]: type annotations required: cannot resolve `S5<_>: Foo` --> $DIR/issue-29147.rs:21:13 | -LL | let _ = >::xxx; //~ ERROR cannot resolve `S5<_>: Foo` +LL | let _ = >::xxx; | ^^^^^^^^^^^^ | note: required by `Foo::xxx` diff --git a/src/test/ui/issues/issue-29161.stderr b/src/test/ui/issues/issue-29161.stderr index e0215157b369..50c257ad6f17 100644 --- a/src/test/ui/issues/issue-29161.stderr +++ b/src/test/ui/issues/issue-29161.stderr @@ -1,7 +1,7 @@ error[E0449]: unnecessary visibility qualifier --> $DIR/issue-29161.rs:5:9 | -LL | pub fn default() -> A { //~ ERROR unnecessary visibility qualifier +LL | pub fn default() -> A { | ^^^ `pub` not permitted here because it's implied error[E0603]: struct `A` is private diff --git a/src/test/ui/issues/issue-29181.stderr b/src/test/ui/issues/issue-29181.stderr index b277753608a1..092014281546 100644 --- a/src/test/ui/issues/issue-29181.stderr +++ b/src/test/ui/issues/issue-29181.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `homura` found for type `{integer}` in the current scope --> $DIR/issue-29181.rs:6:7 | -LL | 0.homura(); //~ ERROR no method named `homura` found +LL | 0.homura(); | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-29184.stderr b/src/test/ui/issues/issue-29184.stderr index 6c1eeb9c0dc8..87d3632ee42e 100644 --- a/src/test/ui/issues/issue-29184.stderr +++ b/src/test/ui/issues/issue-29184.stderr @@ -1,7 +1,7 @@ error[E0516]: `typeof` is a reserved keyword but unimplemented --> $DIR/issue-29184.rs:2:12 | -LL | let x: typeof(92) = 92; //~ ERROR `typeof` is a reserved keyword +LL | let x: typeof(92) = 92; | ^^^^^^^^^^ reserved keyword error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2937.stderr b/src/test/ui/issues/issue-2937.stderr index e63ee42d99c0..428634828f9b 100644 --- a/src/test/ui/issues/issue-2937.stderr +++ b/src/test/ui/issues/issue-2937.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `m::f` --> $DIR/issue-2937.rs:1:5 | -LL | use m::f as x; //~ ERROR unresolved import `m::f` [E0432] +LL | use m::f as x; | ^^^^^^^^^ no `f` in `m` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2995.stderr b/src/test/ui/issues/issue-2995.stderr index 68cb283e453d..c316780d5f6a 100644 --- a/src/test/ui/issues/issue-2995.stderr +++ b/src/test/ui/issues/issue-2995.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `*const isize` as `&isize` --> $DIR/issue-2995.rs:2:22 | -LL | let _q: &isize = p as &isize; //~ ERROR non-primitive cast +LL | let _q: &isize = p as &isize; | ^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/issues/issue-30007.stderr b/src/test/ui/issues/issue-30007.stderr index fb069e8ff989..87e770e1543d 100644 --- a/src/test/ui/issues/issue-30007.stderr +++ b/src/test/ui/issues/issue-30007.stderr @@ -1,7 +1,7 @@ error: macro expansion ignores token `;` and any following --> $DIR/issue-30007.rs:2:20 | -LL | () => ( String ; ); //~ ERROR macro expansion ignores token `;` +LL | () => ( String ; ); | ^ ... LL | let i: Vec; diff --git a/src/test/ui/issues/issue-30079.stderr b/src/test/ui/issues/issue-30079.stderr index b62482add304..57ca57215448 100644 --- a/src/test/ui/issues/issue-30079.stderr +++ b/src/test/ui/issues/issue-30079.stderr @@ -1,7 +1,7 @@ warning: private type `m1::Priv` in public interface (error E0446) --> $DIR/issue-30079.rs:6:9 | -LL | pub fn f(_: Priv) {} //~ WARN private type `m1::Priv` in public interface +LL | pub fn f(_: Priv) {} | ^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(private_in_public)] on by default @@ -14,7 +14,7 @@ error[E0446]: private type `m2::Priv` in public interface LL | struct Priv; | - `m2::Priv` declared as private LL | impl ::std::ops::Deref for ::SemiPriv { -LL | type Target = Priv; //~ ERROR private type `m2::Priv` in public interface +LL | type Target = Priv; | ^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `m3::Priv` in public interface @@ -23,7 +23,7 @@ error[E0446]: private type `m3::Priv` in public interface LL | struct Priv; | - `m3::Priv` declared as private LL | impl ::SemiPrivTrait for () { -LL | type Assoc = Priv; //~ ERROR private type `m3::Priv` in public interface +LL | type Assoc = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-3021-b.stderr b/src/test/ui/issues/issue-3021-b.stderr index 375da43c1973..72289c5f9c34 100644 --- a/src/test/ui/issues/issue-3021-b.stderr +++ b/src/test/ui/issues/issue-3021-b.stderr @@ -1,7 +1,7 @@ error[E0434]: can't capture dynamic environment in a fn item --> $DIR/issue-3021-b.rs:9:22 | -LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment +LL | self.v0 = k0 ^ 0x736f6d6570736575; | ^^ | = help: use the `|| { ... }` closure form instead diff --git a/src/test/ui/issues/issue-3021-c.stderr b/src/test/ui/issues/issue-3021-c.stderr index 5eadf7837c7d..cef30acd6023 100644 --- a/src/test/ui/issues/issue-3021-c.stderr +++ b/src/test/ui/issues/issue-3021-c.stderr @@ -4,7 +4,7 @@ error[E0401]: can't use generic parameters from outer function LL | fn siphash() { | - type variable from outer function ... -LL | fn g(&self, x: T) -> T; //~ ERROR can't use generic parameters from outer function +LL | fn g(&self, x: T) -> T; | - ^ use of generic parameter from outer function | | | help: try using a local generic parameter instead: `g` @@ -15,7 +15,7 @@ error[E0401]: can't use generic parameters from outer function LL | fn siphash() { | - type variable from outer function ... -LL | fn g(&self, x: T) -> T; //~ ERROR can't use generic parameters from outer function +LL | fn g(&self, x: T) -> T; | - ^ use of generic parameter from outer function | | | help: try using a local generic parameter instead: `g` diff --git a/src/test/ui/issues/issue-3021-d.stderr b/src/test/ui/issues/issue-3021-d.stderr index ffefab19725f..39e6e8c43e94 100644 --- a/src/test/ui/issues/issue-3021-d.stderr +++ b/src/test/ui/issues/issue-3021-d.stderr @@ -1,7 +1,7 @@ error[E0434]: can't capture dynamic environment in a fn item --> $DIR/issue-3021-d.rs:21:23 | -LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment +LL | self.v0 = k0 ^ 0x736f6d6570736575; | ^^ | = help: use the `|| { ... }` closure form instead @@ -9,7 +9,7 @@ LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dyna error[E0434]: can't capture dynamic environment in a fn item --> $DIR/issue-3021-d.rs:22:23 | -LL | self.v1 = k1 ^ 0x646f72616e646f6d; //~ ERROR can't capture dynamic environment +LL | self.v1 = k1 ^ 0x646f72616e646f6d; | ^^ | = help: use the `|| { ... }` closure form instead diff --git a/src/test/ui/issues/issue-3021.stderr b/src/test/ui/issues/issue-3021.stderr index 38c5bd2b94af..d5b015eec350 100644 --- a/src/test/ui/issues/issue-3021.stderr +++ b/src/test/ui/issues/issue-3021.stderr @@ -1,7 +1,7 @@ error[E0434]: can't capture dynamic environment in a fn item --> $DIR/issue-3021.rs:12:22 | -LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment +LL | self.v0 = k0 ^ 0x736f6d6570736575; | ^^ | = help: use the `|| { ... }` closure form instead diff --git a/src/test/ui/issues/issue-30236.stderr b/src/test/ui/issues/issue-30236.stderr index e60babd9559e..64cbd58d6954 100644 --- a/src/test/ui/issues/issue-30236.stderr +++ b/src/test/ui/issues/issue-30236.stderr @@ -1,7 +1,7 @@ error[E0091]: type parameter `Unused` is unused --> $DIR/issue-30236.rs:2:5 | -LL | Unused //~ ERROR type parameter `Unused` is unused +LL | Unused | ^^^^^^ unused type parameter error: aborting due to previous error diff --git a/src/test/ui/issues/issue-30240-b.stderr b/src/test/ui/issues/issue-30240-b.stderr index 5613a18f404a..e0dd4794db59 100644 --- a/src/test/ui/issues/issue-30240-b.stderr +++ b/src/test/ui/issues/issue-30240-b.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/issue-30240-b.rs:12:9 | -LL | "hello" => {} //~ ERROR unreachable pattern +LL | "hello" => {} | ^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/issues/issue-30240.stderr b/src/test/ui/issues/issue-30240.stderr index bc538abf3bdf..8b683b4af65c 100644 --- a/src/test/ui/issues/issue-30240.stderr +++ b/src/test/ui/issues/issue-30240.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `&_` not covered --> $DIR/issue-30240.rs:2:11 | -LL | match "world" { //~ ERROR non-exhaustive patterns: `&_` +LL | match "world" { | ^^^^^^^ pattern `&_` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -9,7 +9,7 @@ LL | match "world" { //~ ERROR non-exhaustive patterns: `&_` error[E0004]: non-exhaustive patterns: `&_` not covered --> $DIR/issue-30240.rs:6:11 | -LL | match "world" { //~ ERROR non-exhaustive patterns: `&_` +LL | match "world" { | ^^^^^^^ pattern `&_` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/issues/issue-30302.stderr b/src/test/ui/issues/issue-30302.stderr index 193a8c4916c6..d762d6f2b3d5 100644 --- a/src/test/ui/issues/issue-30302.stderr +++ b/src/test/ui/issues/issue-30302.stderr @@ -9,7 +9,7 @@ error: unreachable pattern | LL | Nil => true, | --- matches any value -LL | //~^ WARN pattern binding `Nil` is named the same as one of the variants of the type `Stack` +LL | LL | _ => false | ^ unreachable pattern | diff --git a/src/test/ui/issues/issue-3038.stderr b/src/test/ui/issues/issue-3038.stderr index 8638c1965240..210da2ceff9b 100644 --- a/src/test/ui/issues/issue-3038.stderr +++ b/src/test/ui/issues/issue-3038.stderr @@ -13,7 +13,7 @@ LL | H::I(J::L(x, _), K::M(_, x)) error[E0416]: identifier `x` is bound more than once in the same pattern --> $DIR/issue-3038.rs:23:13 | -LL | (x, x) => { x } //~ ERROR identifier `x` is bound more than once in the same pattern +LL | (x, x) => { x } | ^ used in a pattern more than once error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-30438-a.stderr b/src/test/ui/issues/issue-30438-a.stderr index 94aca7f03199..89f8e623dc47 100644 --- a/src/test/ui/issues/issue-30438-a.stderr +++ b/src/test/ui/issues/issue-30438-a.stderr @@ -11,7 +11,7 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the | LL | / fn index(&self, _: usize) -> &Self::Output { LL | | return &Test { s: &self.s}; -LL | | //~^ ERROR: borrowed value does not live long enough +LL | | LL | | } | |_____^ = note: consider using a `let` binding to increase its lifetime diff --git a/src/test/ui/issues/issue-30438-b.stderr b/src/test/ui/issues/issue-30438-b.stderr index b99801dad81d..49208ed696ae 100644 --- a/src/test/ui/issues/issue-30438-b.stderr +++ b/src/test/ui/issues/issue-30438-b.stderr @@ -3,7 +3,7 @@ error[E0597]: borrowed value does not live long enough | LL | &Test { s: &self.s} | ^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | //~^ ERROR: borrowed value does not live long enough +LL | LL | } | - temporary value only lives until here | @@ -12,7 +12,7 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the | LL | / fn index(&self, _: usize) -> &Self::Output { LL | | &Test { s: &self.s} -LL | | //~^ ERROR: borrowed value does not live long enough +LL | | LL | | } | |_____^ diff --git a/src/test/ui/issues/issue-30438-c.stderr b/src/test/ui/issues/issue-30438-c.stderr index 71c2ed9dfc93..a003e27f055e 100644 --- a/src/test/ui/issues/issue-30438-c.stderr +++ b/src/test/ui/issues/issue-30438-c.stderr @@ -3,7 +3,7 @@ error[E0597]: `x` does not live long enough | LL | &x | ^ borrowed value does not live long enough -LL | //~^ ERROR: `x` does not live long enough +LL | LL | } | - borrowed value only lives until here | diff --git a/src/test/ui/issues/issue-30535.stderr b/src/test/ui/issues/issue-30535.stderr index b93ed8d9c2aa..e3692934b62a 100644 --- a/src/test/ui/issues/issue-30535.stderr +++ b/src/test/ui/issues/issue-30535.stderr @@ -1,7 +1,7 @@ error[E0573]: expected type, found variant `foo::Foo::FooV` --> $DIR/issue-30535.rs:6:8 | -LL | _: foo::Foo::FooV //~ ERROR expected type, found variant `foo::Foo::FooV` +LL | _: foo::Foo::FooV | ^^^^^^^^^^^^^^ | | | not a type diff --git a/src/test/ui/issues/issue-30560.stderr b/src/test/ui/issues/issue-30560.stderr index 27fa9e16bf24..5225f190f9ed 100644 --- a/src/test/ui/issues/issue-30560.stderr +++ b/src/test/ui/issues/issue-30560.stderr @@ -1,7 +1,7 @@ error: items in traits are not importable. --> $DIR/issue-30560.rs:10:5 | -LL | use T::*; //~ ERROR items in traits are not importable +LL | use T::*; | ^^^^ error[E0432]: unresolved import `Alias` diff --git a/src/test/ui/issues/issue-30589.stderr b/src/test/ui/issues/issue-30589.stderr index 17ba4051fb4e..4b88547a1aff 100644 --- a/src/test/ui/issues/issue-30589.stderr +++ b/src/test/ui/issues/issue-30589.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `DecoderError` in this scope --> $DIR/issue-30589.rs:3:23 | -LL | impl fmt::Display for DecoderError { //~ ERROR cannot find type `DecoderError` in this scope +LL | impl fmt::Display for DecoderError { | ^^^^^^^^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3080.stderr b/src/test/ui/issues/issue-3080.stderr index 44f16c708e0f..138d6df679fc 100644 --- a/src/test/ui/issues/issue-3080.stderr +++ b/src/test/ui/issues/issue-3080.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block --> $DIR/issue-3080.rs:7:5 | -LL | X(()).with(); //~ ERROR requires unsafe function or block +LL | X(()).with(); | ^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/issues/issue-3096-1.stderr b/src/test/ui/issues/issue-3096-1.stderr index fee58474031e..c5a7fa7e0eb8 100644 --- a/src/test/ui/issues/issue-3096-1.stderr +++ b/src/test/ui/issues/issue-3096-1.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: type `()` is non-empty --> $DIR/issue-3096-1.rs:2:11 | -LL | match () { } //~ ERROR non-exhaustive +LL | match () { } | ^^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/issues/issue-3096-2.stderr b/src/test/ui/issues/issue-3096-2.stderr index 93119d377441..6f2e0e760d7f 100644 --- a/src/test/ui/issues/issue-3096-2.stderr +++ b/src/test/ui/issues/issue-3096-2.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: type `*const Bottom` is non-empty --> $DIR/issue-3096-2.rs:5:11 | -LL | match x { } //~ ERROR non-exhaustive patterns +LL | match x { } | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/issues/issue-3099-a.stderr b/src/test/ui/issues/issue-3099-a.stderr index d3da944cb533..d6e0a799921f 100644 --- a/src/test/ui/issues/issue-3099-a.stderr +++ b/src/test/ui/issues/issue-3099-a.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `A` is defined multiple times LL | enum A { B, C } | ------ previous definition of the type `A` here LL | -LL | enum A { D, E } //~ ERROR the name `A` is defined multiple times +LL | enum A { D, E } | ^^^^^^ `A` redefined here | = note: `A` must be defined only once in the type namespace of this module diff --git a/src/test/ui/issues/issue-3099-b.stderr b/src/test/ui/issues/issue-3099-b.stderr index cc49325805e3..3ba8b189da67 100644 --- a/src/test/ui/issues/issue-3099-b.stderr +++ b/src/test/ui/issues/issue-3099-b.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `a` is defined multiple times LL | pub mod a {} | --------- previous definition of the module `a` here LL | -LL | pub mod a {} //~ ERROR the name `a` is defined multiple times +LL | pub mod a {} | ^^^^^^^^^ `a` redefined here | = note: `a` must be defined only once in the type namespace of this module diff --git a/src/test/ui/issues/issue-3099.stderr b/src/test/ui/issues/issue-3099.stderr index a650d3caa640..32ee2e1d2073 100644 --- a/src/test/ui/issues/issue-3099.stderr +++ b/src/test/ui/issues/issue-3099.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `a` is defined multiple times LL | fn a(x: String) -> String { | ------------------------- previous definition of the value `a` here ... -LL | fn a(x: String, y: String) -> String { //~ ERROR the name `a` is defined multiple times +LL | fn a(x: String, y: String) -> String { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `a` redefined here | = note: `a` must be defined only once in the value namespace of this module diff --git a/src/test/ui/issues/issue-31173.stderr b/src/test/ui/issues/issue-31173.stderr index 76f245a22cf8..d5f8cc8f8390 100644 --- a/src/test/ui/issues/issue-31173.stderr +++ b/src/test/ui/issues/issue-31173.stderr @@ -10,7 +10,7 @@ LL | .cloned() error[E0599]: no method named `collect` found for type `std::iter::Cloned, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>>` in the current scope --> $DIR/issue-31173.rs:14:10 | -LL | .collect(); //~ ERROR no method named `collect` +LL | .collect(); | ^^^^^^^ | = note: the method `collect` exists but the following trait bounds were not satisfied: diff --git a/src/test/ui/issues/issue-31212.stderr b/src/test/ui/issues/issue-31212.stderr index 09300ffc7879..5daf900c31ff 100644 --- a/src/test/ui/issues/issue-31212.stderr +++ b/src/test/ui/issues/issue-31212.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `self::*` --> $DIR/issue-31212.rs:5:13 | -LL | pub use self::*; //~ ERROR unresolved +LL | pub use self::*; | ^^^^^^^ cannot glob-import a module into itself error[E0425]: cannot find function `f` in module `foo` --> $DIR/issue-31212.rs:9:10 | -LL | foo::f(); //~ ERROR cannot find function `f` in module `foo` +LL | foo::f(); | ^ not found in `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-3154.stderr b/src/test/ui/issues/issue-3154.stderr index 6f3b37a8a3fa..da2af83ff03c 100644 --- a/src/test/ui/issues/issue-3154.stderr +++ b/src/test/ui/issues/issue-3154.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x` | LL | fn thing<'a,Q>(x: &Q) -> Thing<'a,Q> { | -- help: add explicit lifetime `'a` to the type of `x`: `&'a Q` -LL | Thing { x: x } //~ ERROR explicit lifetime required in the type of `x` [E0621] +LL | Thing { x: x } | ^^^^^^^^^^^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/issues/issue-31769.stderr b/src/test/ui/issues/issue-31769.stderr index 7e5e5673bafc..29fcefc08037 100644 --- a/src/test/ui/issues/issue-31769.stderr +++ b/src/test/ui/issues/issue-31769.stderr @@ -1,13 +1,13 @@ error[E0518]: attribute should be applied to function or closure --> $DIR/issue-31769.rs:2:5 | -LL | #[inline] struct Foo; //~ ERROR attribute should be applied to function or closure +LL | #[inline] struct Foo; | ^^^^^^^^^ ----------- not a function or closure error[E0517]: attribute should be applied to struct, enum or union --> $DIR/issue-31769.rs:3:12 | -LL | #[repr(C)] fn foo() {} //~ ERROR attribute should be applied to struct, enum or union +LL | #[repr(C)] fn foo() {} | ^ ----------- not a struct, enum or union error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-31804.stderr b/src/test/ui/issues/issue-31804.stderr index 67e2f2bf2ecf..76e68b0b3524 100644 --- a/src/test/ui/issues/issue-31804.stderr +++ b/src/test/ui/issues/issue-31804.stderr @@ -1,7 +1,7 @@ error: expected pattern, found `}` --> $DIR/issue-31804.rs:6:1 | -LL | } //~ ERROR expected pattern, found `}` +LL | } | ^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/issues/issue-31845.stderr b/src/test/ui/issues/issue-31845.stderr index 7ee1a41a3870..10cb398cb24f 100644 --- a/src/test/ui/issues/issue-31845.stderr +++ b/src/test/ui/issues/issue-31845.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `g` in this scope --> $DIR/issue-31845.rs:7:12 | -LL | g(); //~ ERROR cannot find function `g` in this scope +LL | g(); | ^ help: a function with a similar name exists: `h` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-32086.stderr b/src/test/ui/issues/issue-32086.stderr index bb2cc7c101b7..b5a120c4b9ce 100644 --- a/src/test/ui/issues/issue-32086.stderr +++ b/src/test/ui/issues/issue-32086.stderr @@ -1,13 +1,13 @@ error[E0532]: expected tuple struct/variant, found constant `C` --> $DIR/issue-32086.rs:5:9 | -LL | let C(a) = S(11); //~ ERROR expected tuple struct/variant, found constant `C` +LL | let C(a) = S(11); | ^ help: a tuple struct with a similar name exists: `S` error[E0532]: expected tuple struct/variant, found constant `C` --> $DIR/issue-32086.rs:6:9 | -LL | let C(..) = S(11); //~ ERROR expected tuple struct/variant, found constant `C` +LL | let C(..) = S(11); | ^ help: a tuple struct with a similar name exists: `S` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-3214.stderr b/src/test/ui/issues/issue-3214.stderr index e6526bad3e0d..9c2585688e96 100644 --- a/src/test/ui/issues/issue-3214.stderr +++ b/src/test/ui/issues/issue-3214.stderr @@ -6,7 +6,7 @@ LL | fn foo() { | | | try adding a local generic parameter in this method instead LL | struct Foo { -LL | x: T, //~ ERROR can't use generic parameters from outer function +LL | x: T, | ^ use of generic parameter from outer function error[E0107]: wrong number of type arguments: expected 0, found 1 diff --git a/src/test/ui/issues/issue-32326.stderr b/src/test/ui/issues/issue-32326.stderr index 0f56e94bd196..5967627e51a4 100644 --- a/src/test/ui/issues/issue-32326.stderr +++ b/src/test/ui/issues/issue-32326.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `Expr` has infinite size --> $DIR/issue-32326.rs:5:1 | -LL | enum Expr { //~ ERROR E0072 +LL | enum Expr { | ^^^^^^^^^ recursive type has infinite size LL | Plus(Expr, Expr), | ---- ---- recursive without indirection diff --git a/src/test/ui/issues/issue-32354-suggest-import-rename.stderr b/src/test/ui/issues/issue-32354-suggest-import-rename.stderr index 9e115143fbd2..96684309a008 100644 --- a/src/test/ui/issues/issue-32354-suggest-import-rename.stderr +++ b/src/test/ui/issues/issue-32354-suggest-import-rename.stderr @@ -3,13 +3,13 @@ error[E0252]: the name `ConstructorExtension` is defined multiple times | LL | use extension1::ConstructorExtension; | -------------------------------- previous import of the trait `ConstructorExtension` here -LL | use extension2::ConstructorExtension; //~ ERROR is defined multiple times +LL | use extension2::ConstructorExtension; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ConstructorExtension` reimported here | = note: `ConstructorExtension` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use extension2::ConstructorExtension as OtherConstructorExtension; //~ ERROR is defined multiple times +LL | use extension2::ConstructorExtension as OtherConstructorExtension; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-32655.stderr b/src/test/ui/issues/issue-32655.stderr index ae0cf49a7911..7b3c8e75beb2 100644 --- a/src/test/ui/issues/issue-32655.stderr +++ b/src/test/ui/issues/issue-32655.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `derive_Clone` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/issue-32655.rs:6:11 | -LL | #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown +LL | #[derive_Clone] | ^^^^^^^^^^^^ ... LL | foo!(); @@ -12,7 +12,7 @@ LL | foo!(); error[E0658]: The attribute `derive_Clone` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/issue-32655.rs:18:7 | -LL | #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown +LL | #[derive_Clone] | ^^^^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-32709.stderr b/src/test/ui/issues/issue-32709.stderr index 9161e64ef0a8..9127c7546582 100644 --- a/src/test/ui/issues/issue-32709.stderr +++ b/src/test/ui/issues/issue-32709.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `(): std::convert::From<{integer}>` is not satisfied --> $DIR/issue-32709.rs:4:5 | -LL | Err(5)?; //~ ERROR +LL | Err(5)?; | ^^^^^^^ the trait `std::convert::From<{integer}>` is not implemented for `()` | = note: required by `std::convert::From::from` diff --git a/src/test/ui/issues/issue-32782.stderr b/src/test/ui/issues/issue-32782.stderr index 5d583ee843f6..886f5297156f 100644 --- a/src/test/ui/issues/issue-32782.stderr +++ b/src/test/ui/issues/issue-32782.stderr @@ -1,7 +1,7 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks --> $DIR/issue-32782.rs:7:9 | -LL | #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps +LL | #[allow_internal_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | foo!(); diff --git a/src/test/ui/issues/issue-32833.stderr b/src/test/ui/issues/issue-32833.stderr index c7f0eb1a4329..430cc0fda26d 100644 --- a/src/test/ui/issues/issue-32833.stderr +++ b/src/test/ui/issues/issue-32833.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `bar::Foo` --> $DIR/issue-32833.rs:1:5 | -LL | use bar::Foo; //~ ERROR unresolved import `bar::Foo` [E0432] +LL | use bar::Foo; | ^^^^^^^^ no `Foo` in `bar` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-32950.stderr b/src/test/ui/issues/issue-32950.stderr index 13aed4a1756b..3cdf35af1d86 100644 --- a/src/test/ui/issues/issue-32950.stderr +++ b/src/test/ui/issues/issue-32950.stderr @@ -1,13 +1,13 @@ error: `derive` cannot be used on items with type macros --> $DIR/issue-32950.rs:5:5 | -LL | concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros +LL | concat_idents!(Foo, Bar) | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0412]: cannot find type `FooBar` in this scope --> $DIR/issue-32950.rs:5:5 | -LL | concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros +LL | concat_idents!(Foo, Bar) | ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-33140.stderr b/src/test/ui/issues/issue-33140.stderr index e2631e971c51..43065a2e2d48 100644 --- a/src/test/ui/issues/issue-33140.stderr +++ b/src/test/ui/issues/issue-33140.stderr @@ -19,7 +19,7 @@ LL | impl Trait2 for dyn Sync + Send + Sync { error[E0592]: duplicate definitions with name `abc` --> $DIR/issue-33140.rs:29:5 | -LL | / fn abc() -> bool { //~ ERROR duplicate definitions with name `abc` +LL | / fn abc() -> bool { LL | | false LL | | } | |_____^ duplicate definitions for `abc` diff --git a/src/test/ui/issues/issue-3344.stderr b/src/test/ui/issues/issue-3344.stderr index 8e4a14fb4fae..6593e07b1897 100644 --- a/src/test/ui/issues/issue-3344.stderr +++ b/src/test/ui/issues/issue-3344.stderr @@ -1,7 +1,7 @@ error[E0046]: not all trait items implemented, missing: `partial_cmp` --> $DIR/issue-3344.rs:3:1 | -LL | impl PartialOrd for Thing { //~ ERROR not all trait items implemented, missing: `partial_cmp` +LL | impl PartialOrd for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `partial_cmp` in implementation | = note: `partial_cmp` from trait: `fn(&Self, &Rhs) -> std::option::Option` diff --git a/src/test/ui/issues/issue-33504.stderr b/src/test/ui/issues/issue-33504.stderr index 716aa8a86329..7af555eaa2ce 100644 --- a/src/test/ui/issues/issue-33504.stderr +++ b/src/test/ui/issues/issue-33504.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-33504.rs:7:13 | -LL | let Test = 1; //~ ERROR mismatched types +LL | let Test = 1; | ^^^^ expected integer, found struct `Test` | = note: expected type `{integer}` diff --git a/src/test/ui/issues/issue-33525.stderr b/src/test/ui/issues/issue-33525.stderr index 2c97a39a183f..584b903c2efc 100644 --- a/src/test/ui/issues/issue-33525.stderr +++ b/src/test/ui/issues/issue-33525.stderr @@ -1,19 +1,19 @@ error[E0425]: cannot find value `a` in this scope --> $DIR/issue-33525.rs:2:5 | -LL | a; //~ ERROR cannot find value `a` +LL | a; | ^ not found in this scope error[E0609]: no field `lorem` on type `&'static str` --> $DIR/issue-33525.rs:3:8 | -LL | "".lorem; //~ ERROR no field +LL | "".lorem; | ^^^^^ error[E0609]: no field `ipsum` on type `&'static str` --> $DIR/issue-33525.rs:4:8 | -LL | "".ipsum; //~ ERROR no field +LL | "".ipsum; | ^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-33571.stderr b/src/test/ui/issues/issue-33571.stderr index 2fae447c5e8c..5d83a08e9075 100644 --- a/src/test/ui/issues/issue-33571.stderr +++ b/src/test/ui/issues/issue-33571.stderr @@ -1,7 +1,7 @@ error: this unsafe trait should be implemented explicitly --> $DIR/issue-33571.rs:2:10 | -LL | Sync, //~ ERROR this unsafe trait should be implemented explicitly +LL | Sync, | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr index 43cd7af81d98..596921e526d9 100644 --- a/src/test/ui/issues/issue-33941.stderr +++ b/src/test/ui/issues/issue-33941.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving ` as std::iter::Iterator>::Item == &_` --> $DIR/issue-33941.rs:4:36 | -LL | for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch +LL | for _ in HashMap::new().iter().cloned() {} | ^^^^^^ expected tuple, found reference | = note: expected type `(&_, &_)` @@ -10,7 +10,7 @@ LL | for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch error[E0271]: type mismatch resolving ` as std::iter::Iterator>::Item == &_` --> $DIR/issue-33941.rs:4:14 | -LL | for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch +LL | for _ in HashMap::new().iter().cloned() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference | = note: expected type `(&_, &_)` diff --git a/src/test/ui/issues/issue-34047.stderr b/src/test/ui/issues/issue-34047.stderr index 8d552f24cd67..f770ded50d0f 100644 --- a/src/test/ui/issues/issue-34047.stderr +++ b/src/test/ui/issues/issue-34047.stderr @@ -4,7 +4,7 @@ error[E0530]: match bindings cannot shadow constants LL | const C: u8 = 0; | ---------------- the constant `C` is defined here ... -LL | mut C => {} //~ ERROR match bindings cannot shadow constants +LL | mut C => {} | ^ cannot be named the same as a constant error: aborting due to previous error diff --git a/src/test/ui/issues/issue-34222-1.stderr b/src/test/ui/issues/issue-34222-1.stderr index beb6b589766b..0799656b06bd 100644 --- a/src/test/ui/issues/issue-34222-1.stderr +++ b/src/test/ui/issues/issue-34222-1.stderr @@ -1,7 +1,7 @@ error[E0585]: found a documentation comment that doesn't document anything --> $DIR/issue-34222-1.rs:2:5 | -LL | /// comment //~ ERROR found a documentation comment that doesn't document anything +LL | /// comment | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: doc comments must come before what they document, maybe a comment was intended with `//`? diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr index 9571d0436351..1b0babf93904 100644 --- a/src/test/ui/issues/issue-34334.stderr +++ b/src/test/ui/issues/issue-34334.stderr @@ -1,7 +1,7 @@ error: expected one of `,` or `>`, found `=` --> $DIR/issue-34334.rs:2:29 | -LL | let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `,` or `>`, found `=` +LL | let sr: Vec<(u32, _, _) = vec![]; | -- ^ expected one of `,` or `>` here | | | while parsing the type for `sr` diff --git a/src/test/ui/issues/issue-34349.stderr b/src/test/ui/issues/issue-34349.stderr index f0cd8f948815..d0b51961b44a 100644 --- a/src/test/ui/issues/issue-34349.stderr +++ b/src/test/ui/issues/issue-34349.stderr @@ -1,7 +1,7 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut` --> $DIR/issue-34349.rs:16:17 | -LL | let diary = || { //~ ERROR E0525 +LL | let diary = || { | ^^ this closure implements `FnMut`, not `Fn` LL | farewell.push_str("!!!"); | -------- closure is `FnMut` because it mutates the variable `farewell` here diff --git a/src/test/ui/issues/issue-34373.stderr b/src/test/ui/issues/issue-34373.stderr index 07ac421455cf..f260a8477431 100644 --- a/src/test/ui/issues/issue-34373.stderr +++ b/src/test/ui/issues/issue-34373.stderr @@ -1,7 +1,7 @@ error[E0391]: cycle detected when processing `Foo::T` --> $DIR/issue-34373.rs:7:30 | -LL | pub struct Foo>>; //~ ERROR cycle detected +LL | pub struct Foo>>; | ^^^^^^^^^^ | note: ...which requires processing `DefaultFoo`... diff --git a/src/test/ui/issues/issue-35075.stderr b/src/test/ui/issues/issue-35075.stderr index 5372996d1cbb..2aeb6b152242 100644 --- a/src/test/ui/issues/issue-35075.stderr +++ b/src/test/ui/issues/issue-35075.stderr @@ -1,21 +1,21 @@ error[E0412]: cannot find type `Foo` in this scope --> $DIR/issue-35075.rs:2:12 | -LL | inner: Foo //~ ERROR cannot find type `Foo` in this scope +LL | inner: Foo | ^^^ not found in this scope help: there is an enum variant `Baz::Foo`; try using the variant's enum | -LL | inner: Baz //~ ERROR cannot find type `Foo` in this scope +LL | inner: Baz | ^^^ error[E0412]: cannot find type `Foo` in this scope --> $DIR/issue-35075.rs:6:9 | -LL | Foo(Foo) //~ ERROR cannot find type `Foo` in this scope +LL | Foo(Foo) | ^^^ not found in this scope help: there is an enum variant `Baz::Foo`; try using the variant's enum | -LL | Foo(Baz) //~ ERROR cannot find type `Foo` in this scope +LL | Foo(Baz) | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-35139.stderr b/src/test/ui/issues/issue-35139.stderr index 1e3d24fa514c..79e889b7e599 100644 --- a/src/test/ui/issues/issue-35139.stderr +++ b/src/test/ui/issues/issue-35139.stderr @@ -1,7 +1,7 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates --> $DIR/issue-35139.rs:9:6 | -LL | impl<'a> MethodType for MTFn { //~ ERROR E0207 +LL | impl<'a> MethodType for MTFn { | ^^ unconstrained lifetime parameter error: aborting due to previous error diff --git a/src/test/ui/issues/issue-35241.stderr b/src/test/ui/issues/issue-35241.stderr index 022bc7baa34c..8fda58abadb6 100644 --- a/src/test/ui/issues/issue-35241.stderr +++ b/src/test/ui/issues/issue-35241.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-35241.rs:3:20 | -LL | fn test() -> Foo { Foo } //~ ERROR mismatched types +LL | fn test() -> Foo { Foo } | --- ^^^ | | | | | expected struct `Foo`, found fn item diff --git a/src/test/ui/issues/issue-35450.stderr b/src/test/ui/issues/issue-35450.stderr index 7edee5c41e62..f2065689f444 100644 --- a/src/test/ui/issues/issue-35450.stderr +++ b/src/test/ui/issues/issue-35450.stderr @@ -1,7 +1,7 @@ error: expected expression, found `$` --> $DIR/issue-35450.rs:4:8 | -LL | m!($t); //~ ERROR expected expression +LL | m!($t); | ^ expected expression error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3601.stderr b/src/test/ui/issues/issue-3601.stderr index 85b534434342..fa0fa3345f5e 100644 --- a/src/test/ui/issues/issue-3601.stderr +++ b/src/test/ui/issues/issue-3601.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/issue-3601.rs:30:44 | -LL | box NodeKind::Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns +LL | box NodeKind::Element(ed) => match ed.kind { | ^^^^^^^ pattern `_` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/issues/issue-36116.stderr b/src/test/ui/issues/issue-36116.stderr index e8f9a472b07b..5236db29ae4a 100644 --- a/src/test/ui/issues/issue-36116.stderr +++ b/src/test/ui/issues/issue-36116.stderr @@ -1,12 +1,12 @@ warning: unnecessary path disambiguator --> $DIR/issue-36116.rs:20:50 | -LL | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::); //~ WARN unnecessary path disambiguator +LL | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::); | ^^ try removing `::` warning: unnecessary path disambiguator --> $DIR/issue-36116.rs:21:15 | -LL | let g: Foo:: = Foo { _a: 42 }; //~ WARN unnecessary path disambiguator +LL | let g: Foo:: = Foo { _a: 42 }; | ^^ try removing `::` diff --git a/src/test/ui/issues/issue-36163.stderr b/src/test/ui/issues/issue-36163.stderr index c114e58e4d94..94de4c76927a 100644 --- a/src/test/ui/issues/issue-36163.stderr +++ b/src/test/ui/issues/issue-36163.stderr @@ -1,7 +1,7 @@ error[E0391]: cycle detected when processing `Foo::B::{{constant}}` --> $DIR/issue-36163.rs:4:9 | -LL | B = A, //~ ERROR E0391 +LL | B = A, | ^ | note: ...which requires processing `A`... @@ -13,7 +13,7 @@ LL | const A: isize = Foo::B as isize; note: cycle used when const-evaluating `Foo::B::{{constant}}` --> $DIR/issue-36163.rs:4:9 | -LL | B = A, //~ ERROR E0391 +LL | B = A, | ^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-36400.stderr b/src/test/ui/issues/issue-36400.stderr index d9394277050d..1494324eea30 100644 --- a/src/test/ui/issues/issue-36400.stderr +++ b/src/test/ui/issues/issue-36400.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable `Box` content `*x` as mutable | LL | let x = Box::new(3); | - help: make this binding mutable: `mut x` -LL | f(&mut *x); //~ ERROR cannot borrow immutable +LL | f(&mut *x); | ^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/issues/issue-36617.stderr b/src/test/ui/issues/issue-36617.stderr index 7685b84bea7b..296fec46d80a 100644 --- a/src/test/ui/issues/issue-36617.stderr +++ b/src/test/ui/issues/issue-36617.stderr @@ -1,7 +1,7 @@ error: `derive` may only be applied to structs, enums and unions --> $DIR/issue-36617.rs:1:1 | -LL | #![derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions +LL | #![derive(Copy)] | ^^^^^^^^^^^^^^^^ help: try an outer attribute: `#[derive(Copy)]` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-36881.stderr b/src/test/ui/issues/issue-36881.stderr index b08b229384d0..2ec636fde60b 100644 --- a/src/test/ui/issues/issue-36881.stderr +++ b/src/test/ui/issues/issue-36881.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `issue_36881_aux` --> $DIR/issue-36881.rs:6:9 | -LL | use issue_36881_aux::Foo; //~ ERROR unresolved import +LL | use issue_36881_aux::Foo; | ^^^^^^^^^^^^^^^ maybe a missing `extern crate issue_36881_aux;`? error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3702-2.stderr b/src/test/ui/issues/issue-3702-2.stderr index 11d24b38061e..347a19b687fb 100644 --- a/src/test/ui/issues/issue-3702-2.stderr +++ b/src/test/ui/issues/issue-3702-2.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/issue-3702-2.rs:16:14 | -LL | self.to_int() + other.to_int() //~ ERROR multiple applicable items in scope +LL | self.to_int() + other.to_int() | ^^^^^^ multiple `to_int` found | note: candidate #1 is defined in an impl of the trait `ToPrimitive` for the type `isize` diff --git a/src/test/ui/issues/issue-37026.stderr b/src/test/ui/issues/issue-37026.stderr index 39a500cf5653..1f81264ffdb4 100644 --- a/src/test/ui/issues/issue-37026.stderr +++ b/src/test/ui/issues/issue-37026.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-37026.rs:6:9 | -LL | let empty_struct::XEmpty2 = (); //~ ERROR mismatched types +LL | let empty_struct::XEmpty2 = (); | ^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `empty_struct::XEmpty2` | = note: expected type `()` @@ -10,7 +10,7 @@ LL | let empty_struct::XEmpty2 = (); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/issue-37026.rs:7:9 | -LL | let empty_struct::XEmpty6(..) = (); //~ ERROR mismatched types +LL | let empty_struct::XEmpty6(..) = (); | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `empty_struct::XEmpty6` | = note: expected type `()` diff --git a/src/test/ui/issues/issue-3707.stderr b/src/test/ui/issues/issue-3707.stderr index 436dcbee862a..05c8ce4c3f11 100644 --- a/src/test/ui/issues/issue-3707.stderr +++ b/src/test/ui/issues/issue-3707.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `boom` found for type `&Obj` in the current scope --> $DIR/issue-3707.rs:10:14 | -LL | self.boom(); //~ ERROR no method named `boom` found for type `&Obj` in the current scope +LL | self.boom(); | -----^^^^ | | | | | this is an associated function, not a method diff --git a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr index fa1ee227f0bf..24b31f43a85a 100644 --- a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr +++ b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr @@ -1,7 +1,7 @@ error: reached the type-length limit while instantiating `<(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(), &()), &(&()...` --> $DIR/issue-37311.rs:13:5 | -LL | / fn recurse(&self) { //~ ERROR reached the type-length limit +LL | / fn recurse(&self) { LL | | (self, self).recurse(); LL | | } | |_____^ diff --git a/src/test/ui/issues/issue-37550.stderr b/src/test/ui/issues/issue-37550.stderr index 97160af43bee..41f33a38fbd0 100644 --- a/src/test/ui/issues/issue-37550.stderr +++ b/src/test/ui/issues/issue-37550.stderr @@ -1,7 +1,7 @@ error[E0723]: function pointers in const fn are unstable (see issue #57563) --> $DIR/issue-37550.rs:3:9 | -LL | let x = || t; //~ ERROR function pointers in const fn are unstable +LL | let x = || t; | ^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-3763.stderr b/src/test/ui/issues/issue-3763.stderr index f37b923d5dcf..cc95d221c511 100644 --- a/src/test/ui/issues/issue-3763.stderr +++ b/src/test/ui/issues/issue-3763.stderr @@ -13,13 +13,13 @@ LL | let _woohoo = (Box::new(my_struct)).priv_field; error[E0624]: method `happyfun` is private --> $DIR/issue-3763.rs:21:18 | -LL | (&my_struct).happyfun(); //~ ERROR method `happyfun` is private +LL | (&my_struct).happyfun(); | ^^^^^^^^ error[E0624]: method `happyfun` is private --> $DIR/issue-3763.rs:23:27 | -LL | (Box::new(my_struct)).happyfun(); //~ ERROR method `happyfun` is private +LL | (Box::new(my_struct)).happyfun(); | ^^^^^^^^ error[E0616]: field `priv_field` of struct `my_mod::MyStruct` is private diff --git a/src/test/ui/issues/issue-37665.stderr b/src/test/ui/issues/issue-37665.stderr index c3599fab6850..c27494699515 100644 --- a/src/test/ui/issues/issue-37665.stderr +++ b/src/test/ui/issues/issue-37665.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-37665.rs:10:17 | -LL | let x: () = 0; //~ ERROR: mismatched types +LL | let x: () = 0; | ^ expected (), found integer | = note: expected type `()` diff --git a/src/test/ui/issues/issue-3779.stderr b/src/test/ui/issues/issue-3779.stderr index 3538cb199c3e..ba1e842c610b 100644 --- a/src/test/ui/issues/issue-3779.stderr +++ b/src/test/ui/issues/issue-3779.stderr @@ -3,7 +3,7 @@ error[E0072]: recursive type `S` has infinite size | LL | struct S { | ^^^^^^^^ recursive type has infinite size -LL | //~^ ERROR E0072 +LL | LL | element: Option | ------------------ recursive without indirection | diff --git a/src/test/ui/issues/issue-37884.stderr b/src/test/ui/issues/issue-37884.stderr index f791c6df72f2..9a5f659da160 100644 --- a/src/test/ui/issues/issue-37884.stderr +++ b/src/test/ui/issues/issue-37884.stderr @@ -2,8 +2,8 @@ error[E0308]: method not compatible with trait --> $DIR/issue-37884.rs:6:5 | LL | / fn next(&'a mut self) -> Option -LL | | //~^ ERROR method not compatible with trait -LL | | //~| lifetime mismatch +LL | | +LL | | LL | | { LL | | Some(&mut self.0) LL | | } @@ -15,8 +15,8 @@ note: the anonymous lifetime #1 defined on the method body at 6:5... --> $DIR/issue-37884.rs:6:5 | LL | / fn next(&'a mut self) -> Option -LL | | //~^ ERROR method not compatible with trait -LL | | //~| lifetime mismatch +LL | | +LL | | LL | | { LL | | Some(&mut self.0) LL | | } diff --git a/src/test/ui/issues/issue-37887.stderr b/src/test/ui/issues/issue-37887.stderr index 3b3ce8b39bc9..24543a5efaf1 100644 --- a/src/test/ui/issues/issue-37887.stderr +++ b/src/test/ui/issues/issue-37887.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `libc` --> $DIR/issue-37887.rs:3:9 | -LL | use libc::*; //~ ERROR unresolved import +LL | use libc::*; | ^^^^ maybe a missing `extern crate libc;`? 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? (see issue #27812) --> $DIR/issue-37887.rs:2:5 | -LL | extern crate libc; //~ ERROR use of unstable +LL | extern crate libc; | ^^^^^^^^^^^^^^^^^^ | = help: add #![feature(rustc_private)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-3820.stderr b/src/test/ui/issues/issue-3820.stderr index 0a36ac7616bb..b4af9c2d27db 100644 --- a/src/test/ui/issues/issue-3820.stderr +++ b/src/test/ui/issues/issue-3820.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `*` cannot be applied to type `Thing` --> $DIR/issue-3820.rs:14:13 | -LL | let w = u * 3; //~ ERROR binary operation `*` cannot be applied to type `Thing` +LL | let w = u * 3; | ^^^^^ | = note: an implementation of `std::ops::Mul` might be missing for `Thing` diff --git a/src/test/ui/issues/issue-38293.stderr b/src/test/ui/issues/issue-38293.stderr index 409670074d9f..e0b2fe4fe054 100644 --- a/src/test/ui/issues/issue-38293.stderr +++ b/src/test/ui/issues/issue-38293.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `foo::f` --> $DIR/issue-38293.rs:6:14 | -LL | use foo::f::{self}; //~ ERROR unresolved import `foo::f` +LL | use foo::f::{self}; | ^^^^ no `f` in `foo` error[E0423]: expected function, found module `baz` --> $DIR/issue-38293.rs:15:5 | -LL | baz(); //~ ERROR expected function, found module `baz` +LL | baz(); | ^^^ not a function help: possible better candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/issues/issue-38458.stderr b/src/test/ui/issues/issue-38458.stderr index 541a36233ca2..c04a01118a44 100644 --- a/src/test/ui/issues/issue-38458.stderr +++ b/src/test/ui/issues/issue-38458.stderr @@ -1,7 +1,7 @@ error[E0572]: return statement outside of function body --> $DIR/issue-38458.rs:2:5 | -LL | return; //~ ERROR return statement outside of function body +LL | return; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-38604.stderr b/src/test/ui/issues/issue-38604.stderr index 30b4d2b53ff3..77b42b80613c 100644 --- a/src/test/ui/issues/issue-38604.stderr +++ b/src/test/ui/issues/issue-38604.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/issue-38604.rs:14:13 | -LL | let _f: Box = //~ ERROR `Foo` cannot be made into an object +LL | let _f: Box = | ^^^^^^^^ the trait `Foo` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses @@ -9,7 +9,7 @@ LL | let _f: Box = //~ ERROR `Foo` cannot be made into an object error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/issue-38604.rs:15:9 | -LL | Box::new(()); //~ ERROR `Foo` cannot be made into an object +LL | Box::new(()); | ^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses diff --git a/src/test/ui/issues/issue-38715.stderr b/src/test/ui/issues/issue-38715.stderr index 21d96d36e274..34e08bfc93aa 100644 --- a/src/test/ui/issues/issue-38715.stderr +++ b/src/test/ui/issues/issue-38715.stderr @@ -1,7 +1,7 @@ error: a macro named `foo` has already been exported --> $DIR/issue-38715.rs:5:1 | -LL | macro_rules! foo { () => {} } //~ ERROR a macro named `foo` has already been exported +LL | macro_rules! foo { () => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `foo` already exported | = note: #[deny(duplicate_macro_exports)] on by default diff --git a/src/test/ui/issues/issue-38868.stderr b/src/test/ui/issues/issue-38868.stderr index ae975ca78c11..fe932c744bf7 100644 --- a/src/test/ui/issues/issue-38868.stderr +++ b/src/test/ui/issues/issue-38868.stderr @@ -1,7 +1,7 @@ error[E0366]: Implementations of Drop cannot be specialized --> $DIR/issue-38868.rs:5:1 | -LL | / impl Drop for List { //~ ERROR E0366 +LL | / impl Drop for List { LL | | fn drop(&mut self) { LL | | panic!() LL | | } diff --git a/src/test/ui/issues/issue-38919.stderr b/src/test/ui/issues/issue-38919.stderr index 8c0943647956..d23a4dfd0a49 100644 --- a/src/test/ui/issues/issue-38919.stderr +++ b/src/test/ui/issues/issue-38919.stderr @@ -1,7 +1,7 @@ error[E0599]: no associated item named `Item` found for type `T` in the current scope --> $DIR/issue-38919.rs:2:8 | -LL | T::Item; //~ ERROR no associated item named `Item` found for type `T` in the current scope +LL | T::Item; | ---^^^^ | | | associated item not found in `T` diff --git a/src/test/ui/issues/issue-39211.stderr b/src/test/ui/issues/issue-39211.stderr index b9134445455a..ea850ea57d5b 100644 --- a/src/test/ui/issues/issue-39211.stderr +++ b/src/test/ui/issues/issue-39211.stderr @@ -1,7 +1,7 @@ error[E0220]: associated type `Row` not found for `M` --> $DIR/issue-39211.rs:11:17 | -LL | let a = [3; M::Row::DIM]; //~ ERROR associated type `Row` not found for `M` +LL | let a = [3; M::Row::DIM]; | ^^^^^^^^^^^ associated type `Row` not found error: aborting due to previous error diff --git a/src/test/ui/issues/issue-39388.stderr b/src/test/ui/issues/issue-39388.stderr index 00d6598aeaf2..e04e16e2a037 100644 --- a/src/test/ui/issues/issue-39388.stderr +++ b/src/test/ui/issues/issue-39388.stderr @@ -1,7 +1,7 @@ error: expected `*` or `+` --> $DIR/issue-39388.rs:4:22 | -LL | (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected `*` or `+` +LL | (($($a:tt)*) = ($($b:tt))*) => { | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-39616.stderr b/src/test/ui/issues/issue-39616.stderr index 082c3a6853a1..e24ffcdb0d99 100644 --- a/src/test/ui/issues/issue-39616.stderr +++ b/src/test/ui/issues/issue-39616.stderr @@ -1,13 +1,13 @@ error: expected type, found `0` --> $DIR/issue-39616.rs:1:12 | -LL | fn foo(a: [0; 1]) {} //~ ERROR expected type, found `0` +LL | fn foo(a: [0; 1]) {} | ^ error: expected one of `)`, `,`, `->`, `where`, or `{`, found `]` --> $DIR/issue-39616.rs:1:16 | -LL | fn foo(a: [0; 1]) {} //~ ERROR expected type, found `0` +LL | fn foo(a: [0; 1]) {} | ^ expected one of `)`, `,`, `->`, `where`, or `{` here error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-3973.stderr b/src/test/ui/issues/issue-3973.stderr index 8e46d8801811..2ece4c396067 100644 --- a/src/test/ui/issues/issue-3973.stderr +++ b/src/test/ui/issues/issue-3973.stderr @@ -2,7 +2,7 @@ error[E0407]: method `new` is not a member of trait `ToString_` --> $DIR/issue-3973.rs:11:5 | LL | / fn new(x: f64, y: f64) -> Point { -LL | | //~^ ERROR method `new` is not a member of trait `ToString_` +LL | | LL | | Point { x: x, y: y } LL | | } | |_____^ not a member of trait `ToString_` diff --git a/src/test/ui/issues/issue-3993.stderr b/src/test/ui/issues/issue-3993.stderr index 090bca3a759c..ce594a3f9bb2 100644 --- a/src/test/ui/issues/issue-3993.stderr +++ b/src/test/ui/issues/issue-3993.stderr @@ -1,7 +1,7 @@ error[E0603]: function `fly` is private --> $DIR/issue-3993.rs:1:10 | -LL | use zoo::fly; //~ ERROR: function `fly` is private +LL | use zoo::fly; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40000.stderr b/src/test/ui/issues/issue-40000.stderr index ce0c44c14756..c48fb24ea17d 100644 --- a/src/test/ui/issues/issue-40000.stderr +++ b/src/test/ui/issues/issue-40000.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-40000.rs:6:9 | -LL | foo(bar); //~ ERROR E0308 +LL | foo(bar); | ^^^ expected concrete lifetime, found bound lifetime parameter | = note: expected type `std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r i32) + 'static)>` diff --git a/src/test/ui/issues/issue-40288.stderr b/src/test/ui/issues/issue-40288.stderr index 2ac5964f5da7..5e8ad323ccb0 100644 --- a/src/test/ui/issues/issue-40288.stderr +++ b/src/test/ui/issues/issue-40288.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `*refr` because it is borrowed LL | save_ref(&*refr, &mut out); | ----- borrow of `*refr` occurs here ... -LL | *refr = 3; //~ ERROR cannot assign to `*refr` because it is borrowed +LL | *refr = 3; | ^^^^^^^^^ assignment to borrowed `*refr` occurs here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr index 87b98bbcedb6..5e7be1a31012 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of indexed content --> $DIR/issue-40402-1.rs:9:13 | -LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content +LL | let e = f.v[0]; | ^^^^^^ | | | cannot move out of indexed content diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr index d64cd96e959f..b672029f717f 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of indexed content --> $DIR/issue-40402-2.rs:5:18 | -LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content +LL | let (a, b) = x[0]; | - - ^^^^ cannot move out of indexed content | | | | | ...and here (use `ref b` or `ref mut b`) diff --git a/src/test/ui/issues/issue-40782.stderr b/src/test/ui/issues/issue-40782.stderr index 03f051adc6e3..fdc57466f3ca 100644 --- a/src/test/ui/issues/issue-40782.stderr +++ b/src/test/ui/issues/issue-40782.stderr @@ -1,7 +1,7 @@ error: missing `in` in `for` loop --> $DIR/issue-40782.rs:2:10 | -LL | for i 0..2 { //~ ERROR missing `in` +LL | for i 0..2 { | ^ help: try adding `in` here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40845.stderr b/src/test/ui/issues/issue-40845.stderr index a8d75025279d..a8be38ebf065 100644 --- a/src/test/ui/issues/issue-40845.stderr +++ b/src/test/ui/issues/issue-40845.stderr @@ -1,13 +1,13 @@ error: cannot find macro `m!` in this scope --> $DIR/issue-40845.rs:4:10 | -LL | impl S { m!(); } //~ ERROR cannot find macro `m!` in this scope +LL | impl S { m!(); } | ^ error: cannot find macro `m!` in this scope --> $DIR/issue-40845.rs:1:11 | -LL | trait T { m!(); } //~ ERROR cannot find macro `m!` in this scope +LL | trait T { m!(); } | ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-41255.stderr b/src/test/ui/issues/issue-41255.stderr index 05e930de27af..9ccfc9a00160 100644 --- a/src/test/ui/issues/issue-41255.stderr +++ b/src/test/ui/issues/issue-41255.stderr @@ -1,7 +1,7 @@ error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:10:9 | -LL | 5.0 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | 5.0 => {}, | ^^^ | note: lint level defined here @@ -15,7 +15,7 @@ LL | #![forbid(illegal_floating_point_literal_pattern)] error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:12:9 | -LL | 5.0f32 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | 5.0f32 => {}, | ^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -24,7 +24,7 @@ LL | 5.0f32 => {}, //~ ERROR floating-point types cannot be used in patt error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:14:10 | -LL | -5.0 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | -5.0 => {}, | ^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -33,7 +33,7 @@ LL | -5.0 => {}, //~ ERROR floating-point types cannot be used in patter error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:16:9 | -LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | 1.0 .. 33.0 => {}, | ^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -42,7 +42,7 @@ LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:16:16 | -LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | 1.0 .. 33.0 => {}, | ^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -51,7 +51,7 @@ LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:20:9 | -LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | 39.0 ..= 70.0 => {}, | ^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -60,7 +60,7 @@ LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:20:18 | -LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | 39.0 ..= 70.0 => {}, | ^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -69,7 +69,7 @@ LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:29:10 | -LL | (3.14, 1) => {}, //~ ERROR floating-point types cannot be used +LL | (3.14, 1) => {}, | ^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -78,7 +78,7 @@ LL | (3.14, 1) => {}, //~ ERROR floating-point types cannot be used error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:36:18 | -LL | Foo { x: 2.0 } => {}, //~ ERROR floating-point types cannot be used +LL | Foo { x: 2.0 } => {}, | ^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/issues/issue-41549.stderr b/src/test/ui/issues/issue-41549.stderr index b144387ac44b..5e102dcbf411 100644 --- a/src/test/ui/issues/issue-41549.stderr +++ b/src/test/ui/issues/issue-41549.stderr @@ -1,7 +1,7 @@ error[E0326]: implemented const `CONST` has an incompatible type for trait --> $DIR/issue-41549.rs:9:18 | -LL | const CONST: () = (); //~ ERROR incompatible type for trait +LL | const CONST: () = (); | ^^ expected u32, found () | = note: expected type `u32` diff --git a/src/test/ui/issues/issue-41726.stderr b/src/test/ui/issues/issue-41726.stderr index e6b92dc9dfea..e29c163b8177 100644 --- a/src/test/ui/issues/issue-41726.stderr +++ b/src/test/ui/issues/issue-41726.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable indexed content as mutable --> $DIR/issue-41726.rs:5:9 | -LL | things[src.as_str()].sort(); //~ ERROR cannot borrow immutable +LL | things[src.as_str()].sort(); | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap>` diff --git a/src/test/ui/issues/issue-41742.stderr b/src/test/ui/issues/issue-41742.stderr index 03a9710f6797..f205abf55768 100644 --- a/src/test/ui/issues/issue-41742.stderr +++ b/src/test/ui/issues/issue-41742.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-41742.rs:24:7 | -LL | H["?"].f(); //~ ERROR mismatched types +LL | H["?"].f(); | ^^^ expected u32, found reference | = note: expected type `u32` diff --git a/src/test/ui/issues/issue-41776.stderr b/src/test/ui/issues/issue-41776.stderr index 1806f68f14ae..e06873b50265 100644 --- a/src/test/ui/issues/issue-41776.stderr +++ b/src/test/ui/issues/issue-41776.stderr @@ -1,7 +1,7 @@ error: argument must be a string literal --> $DIR/issue-41776.rs:2:14 | -LL | include!(line!()); //~ ERROR argument must be a string literal +LL | include!(line!()); | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-41974.stderr b/src/test/ui/issues/issue-41974.stderr index 68712e0f0549..54fa48e8bb26 100644 --- a/src/test/ui/issues/issue-41974.stderr +++ b/src/test/ui/issues/issue-41974.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `std::boxed::Box<_>`: --> $DIR/issue-41974.rs:7:1 | -LL | impl Drop for T where T: A { //~ ERROR E0119 +LL | impl Drop for T where T: A { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `alloc`: @@ -12,13 +12,13 @@ LL | impl Drop for T where T: A { //~ ERROR E0119 error[E0120]: the Drop trait may only be implemented on structures --> $DIR/issue-41974.rs:7:18 | -LL | impl Drop for T where T: A { //~ ERROR E0119 +LL | impl Drop for T where T: A { | ^ implementing Drop requires a struct error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) --> $DIR/issue-41974.rs:7:1 | -LL | impl Drop for T where T: A { //~ ERROR E0119 +LL | impl Drop for T where T: A { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type | = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/issues/issue-4201.stderr b/src/test/ui/issues/issue-4201.stderr index 4f8ec96d5315..d436c929a729 100644 --- a/src/test/ui/issues/issue-4201.stderr +++ b/src/test/ui/issues/issue-4201.stderr @@ -3,10 +3,10 @@ error[E0317]: if may be missing an else clause | LL | } else if false { | ____________^ -LL | | //~^ ERROR if may be missing an else clause -LL | | //~| expected type `()` -LL | | //~| found type `{integer}` -LL | | //~| expected (), found integer +LL | | +LL | | +LL | | +LL | | LL | | 1 LL | | }; | |_____^ expected (), found integer diff --git a/src/test/ui/issues/issue-42060.stderr b/src/test/ui/issues/issue-42060.stderr index cad2bb2a67be..6f42c86e84aa 100644 --- a/src/test/ui/issues/issue-42060.stderr +++ b/src/test/ui/issues/issue-42060.stderr @@ -1,25 +1,25 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-42060.rs:3:23 | -LL | let other: typeof(thing) = thing; //~ ERROR attempt to use a non-constant value in a constant +LL | let other: typeof(thing) = thing; | ^^^^^ non-constant value error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-42060.rs:9:13 | -LL | ::N //~ ERROR attempt to use a non-constant value in a constant +LL | ::N | ^ non-constant value error[E0516]: `typeof` is a reserved keyword but unimplemented --> $DIR/issue-42060.rs:3:16 | -LL | let other: typeof(thing) = thing; //~ ERROR attempt to use a non-constant value in a constant +LL | let other: typeof(thing) = thing; | ^^^^^^^^^^^^^ reserved keyword error[E0516]: `typeof` is a reserved keyword but unimplemented --> $DIR/issue-42060.rs:9:6 | -LL | ::N //~ ERROR attempt to use a non-constant value in a constant +LL | ::N | ^^^^^^^^^ reserved keyword error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-42106.stderr b/src/test/ui/issues/issue-42106.stderr index e1018a89d209..9e3ce9878c22 100644 --- a/src/test/ui/issues/issue-42106.stderr +++ b/src/test/ui/issues/issue-42106.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*collection` as mutable because `collection` is als | LL | let _a = &collection; | ---------- immutable borrow occurs here -LL | collection.swap(1, 2); //~ ERROR also borrowed as immutable +LL | collection.swap(1, 2); | ^^^^^^^^^^ mutable borrow occurs here LL | _a.use_ref(); LL | } diff --git a/src/test/ui/issues/issue-42344.stderr b/src/test/ui/issues/issue-42344.stderr index cb0fe78d1020..6bf26c2cf5c5 100644 --- a/src/test/ui/issues/issue-42344.stderr +++ b/src/test/ui/issues/issue-42344.stderr @@ -1,7 +1,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference --> $DIR/issue-42344.rs:4:5 | -LL | TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389] +LL | TAB[0].iter_mut(); | ^^^^^^ assignment into an immutable reference error: aborting due to previous error diff --git a/src/test/ui/issues/issue-4265.stderr b/src/test/ui/issues/issue-4265.stderr index b5fce14914d6..4faf5d3a9230 100644 --- a/src/test/ui/issues/issue-4265.stderr +++ b/src/test/ui/issues/issue-4265.stderr @@ -6,7 +6,7 @@ LL | | Foo { baz: 0 }.bar(); LL | | } | |_____- previous definition of `bar` here LL | -LL | / fn bar() { //~ ERROR duplicate definitions +LL | / fn bar() { LL | | } | |_____^ duplicate definition diff --git a/src/test/ui/issues/issue-42755.stderr b/src/test/ui/issues/issue-42755.stderr index 4b490f8e87f9..12047e22f1b0 100644 --- a/src/test/ui/issues/issue-42755.stderr +++ b/src/test/ui/issues/issue-42755.stderr @@ -1,7 +1,7 @@ error: repetition matches empty token tree --> $DIR/issue-42755.rs:2:7 | -LL | ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree +LL | ($($p:vis)*) => {} | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-42796.stderr b/src/test/ui/issues/issue-42796.stderr index 530eedd68e6a..d180e6478ef1 100644 --- a/src/test/ui/issues/issue-42796.stderr +++ b/src/test/ui/issues/issue-42796.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `s` LL | let mut s_copy = s; | ---------- value moved here ... -LL | println!("{}", s); //~ ERROR use of moved value +LL | println!("{}", s); | ^ value used here after move | = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/issues/issue-42880.stderr b/src/test/ui/issues/issue-42880.stderr index 36b9e8a1e8af..8a40a49c0def 100644 --- a/src/test/ui/issues/issue-42880.stderr +++ b/src/test/ui/issues/issue-42880.stderr @@ -1,7 +1,7 @@ error[E0599]: no associated item named `String` found for type `std::string::String` in the current scope --> $DIR/issue-42880.rs:4:22 | -LL | let f = |&Value::String(_)| (); //~ ERROR no associated item named +LL | let f = |&Value::String(_)| (); | -------^^^^^^--- associated item not found in `std::string::String` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-42954.stderr b/src/test/ui/issues/issue-42954.stderr index 6a89724de5f7..8c35088a1bbe 100644 --- a/src/test/ui/issues/issue-42954.stderr +++ b/src/test/ui/issues/issue-42954.stderr @@ -1,7 +1,7 @@ error: `<` is interpreted as a start of generic arguments for `u32`, not a comparison --> $DIR/issue-42954.rs:7:19 | -LL | $i as u32 < 0 //~ `<` is interpreted as a start of generic arguments +LL | $i as u32 < 0 | --------- ^ - interpreted as generic arguments | | | | | not interpreted as comparison diff --git a/src/test/ui/issues/issue-43023.stderr b/src/test/ui/issues/issue-43023.stderr index b620cc5d74e8..206a51645fe6 100644 --- a/src/test/ui/issues/issue-43023.stderr +++ b/src/test/ui/issues/issue-43023.stderr @@ -1,19 +1,19 @@ error: `derive` may only be applied to structs, enums and unions --> $DIR/issue-43023.rs:4:5 | -LL | #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/issue-43023.rs:11:5 | -LL | #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/issue-43023.rs:16:5 | -LL | #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-43162.stderr b/src/test/ui/issues/issue-43162.stderr index 3fc5317830e4..d3ff9002b967 100644 --- a/src/test/ui/issues/issue-43162.stderr +++ b/src/test/ui/issues/issue-43162.stderr @@ -1,13 +1,13 @@ error[E0268]: `break` outside of loop --> $DIR/issue-43162.rs:3:5 | -LL | break true; //~ ERROR E0268 +LL | break true; | ^^^^^^^^^^ cannot break outside of a loop error[E0268]: `break` outside of loop --> $DIR/issue-43162.rs:7:5 | -LL | break {}; //~ ERROR E0268 +LL | break {}; | ^^^^^^^^ cannot break outside of a loop error[E0308]: mismatched types @@ -17,8 +17,8 @@ LL | fn foo() -> bool { | --- ^^^^ expected bool, found () | | | this function's body doesn't return -LL | //~^ ERROR E0308 -LL | break true; //~ ERROR E0268 +LL | +LL | break true; | - help: consider removing this semicolon | = note: expected type `bool` diff --git a/src/test/ui/issues/issue-4321.stderr b/src/test/ui/issues/issue-4321.stderr index 731e63fbb2b0..afb4fe775d58 100644 --- a/src/test/ui/issues/issue-4321.stderr +++ b/src/test/ui/issues/issue-4321.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `(true, false)` not covered --> $DIR/issue-4321.rs:3:31 | -LL | println!("foo {:}", match tup { //~ ERROR non-exhaustive patterns: `(true, false)` not covered +LL | println!("foo {:}", match tup { | ^^^ pattern `(true, false)` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/issues/issue-43420-no-over-suggest.stderr b/src/test/ui/issues/issue-43420-no-over-suggest.stderr index bd51d7e11695..7a3722e4bd72 100644 --- a/src/test/ui/issues/issue-43420-no-over-suggest.stderr +++ b/src/test/ui/issues/issue-43420-no-over-suggest.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-43420-no-over-suggest.rs:8:9 | -LL | foo(&a); //~ ERROR mismatched types +LL | foo(&a); | ^^ expected slice, found struct `std::vec::Vec` | = note: expected type `&[u16]` diff --git a/src/test/ui/issues/issue-43424.stderr b/src/test/ui/issues/issue-43424.stderr index c81ea20170c7..6274a7928ba0 100644 --- a/src/test/ui/issues/issue-43424.stderr +++ b/src/test/ui/issues/issue-43424.stderr @@ -1,7 +1,7 @@ error: unexpected generic arguments in path --> $DIR/issue-43424.rs:10:4 | -LL | m!(inline); //~ ERROR: unexpected generic arguments in path +LL | m!(inline); | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-4366-2.stderr b/src/test/ui/issues/issue-4366-2.stderr index 8cf0e3bd520d..76f08d77232c 100644 --- a/src/test/ui/issues/issue-4366-2.stderr +++ b/src/test/ui/issues/issue-4366-2.stderr @@ -11,7 +11,7 @@ LL | use a::b::Bar; error[E0423]: expected function, found module `foo` --> $DIR/issue-4366-2.rs:25:5 | -LL | foo(); //~ ERROR expected function, found module `foo` +LL | foo(); | ^^^ not a function help: possible better candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/issues/issue-4366.stderr b/src/test/ui/issues/issue-4366.stderr index 2bad7b17d642..c59ab0045570 100644 --- a/src/test/ui/issues/issue-4366.stderr +++ b/src/test/ui/issues/issue-4366.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `foo` in this scope --> $DIR/issue-4366.rs:18:29 | -LL | fn sub() -> isize { foo(); 1 } //~ ERROR cannot find function `foo` in this scope +LL | fn sub() -> isize { foo(); 1 } | ^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/issues/issue-43733.stderr b/src/test/ui/issues/issue-43733.stderr index 38fa93d44618..c48f9baf2719 100644 --- a/src/test/ui/issues/issue-43733.stderr +++ b/src/test/ui/issues/issue-43733.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block --> $DIR/issue-43733.rs:20:5 | -LL | __KEY.get() //~ ERROR call to unsafe function is unsafe +LL | __KEY.get() | ^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/issues/issue-43784-associated-type.stderr b/src/test/ui/issues/issue-43784-associated-type.stderr index 4beb854b0f31..fc05d280693b 100644 --- a/src/test/ui/issues/issue-43784-associated-type.stderr +++ b/src/test/ui/issues/issue-43784-associated-type.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/issue-43784-associated-type.rs:13:9 | -LL | impl Complete for T { //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied +LL | impl Complete for T { | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound diff --git a/src/test/ui/issues/issue-43784-supertrait.stderr b/src/test/ui/issues/issue-43784-supertrait.stderr index 7771f9abfb8a..4c423f2e77fe 100644 --- a/src/test/ui/issues/issue-43784-supertrait.stderr +++ b/src/test/ui/issues/issue-43784-supertrait.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/issue-43784-supertrait.rs:8:9 | -LL | impl Complete for T {} //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied +LL | impl Complete for T {} | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound diff --git a/src/test/ui/issues/issue-43925.stderr b/src/test/ui/issues/issue-43925.stderr index e73c2122a03f..739ace10aa6a 100644 --- a/src/test/ui/issues/issue-43925.stderr +++ b/src/test/ui/issues/issue-43925.stderr @@ -1,7 +1,7 @@ error: invalid argument for `cfg(..)` --> $DIR/issue-43925.rs:1:24 | -LL | #[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)` +LL | #[link(name="foo", cfg("rlib"))] | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-43926.stderr b/src/test/ui/issues/issue-43926.stderr index 9dc9cfe5db2a..d9d6b3a34fe2 100644 --- a/src/test/ui/issues/issue-43926.stderr +++ b/src/test/ui/issues/issue-43926.stderr @@ -1,7 +1,7 @@ error: `cfg()` must have an argument --> $DIR/issue-43926.rs:1:20 | -LL | #[link(name="foo", cfg())] //~ ERROR `cfg()` must have an argument +LL | #[link(name="foo", cfg())] | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-44021.stderr b/src/test/ui/issues/issue-44021.stderr index 03f11312d465..94500087e553 100644 --- a/src/test/ui/issues/issue-44021.stderr +++ b/src/test/ui/issues/issue-44021.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `@`, or `|`, found `}` --> $DIR/issue-44021.rs:3:18 | -LL | fn f() {|x, y} //~ ERROR expected one of `:`, `@`, or `|`, found `}` +LL | fn f() {|x, y} | ^ expected one of `:`, `@`, or `|` here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-44023.stderr b/src/test/ui/issues/issue-44023.stderr index f1962a86ee03..153be363c1de 100644 --- a/src/test/ui/issues/issue-44023.stderr +++ b/src/test/ui/issues/issue-44023.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-44023.rs:5:36 | -LL | fn საჭმელად_გემრიელი_სადილი ( ) -> isize { //~ ERROR mismatched types +LL | fn საჭმელად_გემრიელი_სადილი ( ) -> isize { | ------------------------ ^^^^^ expected isize, found () | | | this function's body doesn't return diff --git a/src/test/ui/issues/issue-44078.stderr b/src/test/ui/issues/issue-44078.stderr index e7f46130f112..43b49e463128 100644 --- a/src/test/ui/issues/issue-44078.stderr +++ b/src/test/ui/issues/issue-44078.stderr @@ -1,7 +1,7 @@ error: unterminated double quote string --> $DIR/issue-44078.rs:2:8 | -LL | "😊""; //~ ERROR unterminated double quote +LL | "😊""; | _________^ LL | | } | |__^ diff --git a/src/test/ui/issues/issue-44373.stderr b/src/test/ui/issues/issue-44373.stderr index 5a4bf18f3d5a..c52955833904 100644 --- a/src/test/ui/issues/issue-44373.stderr +++ b/src/test/ui/issues/issue-44373.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/issue-44373.rs:4:42 | -LL | let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR borrowed value does not live long enough +LL | let _val: &'static [&'static u32] = &[&FOO]; | ^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/issues/issue-44406.stderr b/src/test/ui/issues/issue-44406.stderr index 105dbb677dc0..14b3b8cc5c85 100644 --- a/src/test/ui/issues/issue-44406.stderr +++ b/src/test/ui/issues/issue-44406.stderr @@ -1,11 +1,11 @@ error: expected identifier, found keyword `true` --> $DIR/issue-44406.rs:8:10 | -LL | foo!(true); //~ ERROR expected type, found keyword +LL | foo!(true); | ^^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | foo!(r#true); //~ ERROR expected type, found keyword +LL | foo!(r#true); | ^^^^^^ error: expected type, found keyword `true` @@ -14,7 +14,7 @@ error: expected type, found keyword `true` LL | bar(baz: $rest) | - help: try using a semicolon: `;` ... -LL | foo!(true); //~ ERROR expected type, found keyword +LL | foo!(true); | ^^^^ expecting a type here because of type ascription error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr b/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr index 3510112daf0a..71fbba562cae 100644 --- a/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr +++ b/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr @@ -4,7 +4,7 @@ error: unnecessary `unsafe` block LL | unsafe { | ------ because it's nested under this `unsafe` block LL | let f = |v: &mut Vec<_>| { -LL | unsafe { //~ ERROR unnecessary `unsafe` +LL | unsafe { | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here @@ -19,7 +19,7 @@ error: unnecessary `unsafe` block LL | unsafe { | ------ because it's nested under this `unsafe` block ... -LL | |w: &mut Vec| { unsafe { //~ ERROR unnecessary `unsafe` +LL | |w: &mut Vec| { unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block @@ -28,7 +28,7 @@ error: unnecessary `unsafe` block LL | unsafe { | ------ because it's nested under this `unsafe` block ... -LL | |x: &mut Vec| { unsafe { //~ ERROR unnecessary `unsafe` +LL | |x: &mut Vec| { unsafe { | ^^^^^^ unnecessary `unsafe` block error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-45157.stderr b/src/test/ui/issues/issue-45157.stderr index 3b15a8dbd9ef..fbfa1d199566 100644 --- a/src/test/ui/issues/issue-45157.stderr +++ b/src/test/ui/issues/issue-45157.stderr @@ -6,7 +6,7 @@ LL | let mref = &mut u.s.a; ... LL | let nref = &u.z.c; | ^^^^^^ immutable borrow of `u.z.c` -- which overlaps with `u.s.a` -- occurs here -LL | //~^ ERROR cannot borrow `u` (via `u.z.c`) as immutable because it is also borrowed as mutable (via `u.s.a`) [E0502] +LL | LL | println!("{} {}", mref, nref) | ---- mutable borrow later used here | diff --git a/src/test/ui/issues/issue-45296.stderr b/src/test/ui/issues/issue-45296.stderr index afea28fb7aaf..bc14d20b6238 100644 --- a/src/test/ui/issues/issue-45296.stderr +++ b/src/test/ui/issues/issue-45296.stderr @@ -1,7 +1,7 @@ error: an inner attribute is not permitted in this context --> $DIR/issue-45296.rs:4:7 | -LL | #![allow(unused_variables)] //~ ERROR not permitted in this context +LL | #![allow(unused_variables)] | ^ | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. diff --git a/src/test/ui/issues/issue-45730.stderr b/src/test/ui/issues/issue-45730.stderr index 4f2784c6c362..3c400d6eefaa 100644 --- a/src/test/ui/issues/issue-45730.stderr +++ b/src/test/ui/issues/issue-45730.stderr @@ -1,7 +1,7 @@ error[E0641]: cannot cast to a pointer of an unknown kind --> $DIR/issue-45730.rs:3:23 | -LL | let x: *const _ = 0 as _; //~ ERROR cannot cast +LL | let x: *const _ = 0 as _; | ^^^^^- | | | help: consider giving more type information @@ -11,7 +11,7 @@ LL | let x: *const _ = 0 as _; //~ ERROR cannot cast error[E0641]: cannot cast to a pointer of an unknown kind --> $DIR/issue-45730.rs:5:23 | -LL | let x: *const _ = 0 as *const _; //~ ERROR cannot cast +LL | let x: *const _ = 0 as *const _; | ^^^^^-------- | | | help: consider giving more type information @@ -21,7 +21,7 @@ LL | let x: *const _ = 0 as *const _; //~ ERROR cannot cast error[E0641]: cannot cast to a pointer of an unknown kind --> $DIR/issue-45730.rs:8:13 | -LL | let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast +LL | let x = 0 as *const i32 as *const _ as *mut _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------ | | | help: consider giving more type information diff --git a/src/test/ui/issues/issue-46036.stderr b/src/test/ui/issues/issue-46036.stderr index 40a77f925b94..9c1746e0fa1e 100644 --- a/src/test/ui/issues/issue-46036.stderr +++ b/src/test/ui/issues/issue-46036.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/issue-46036.rs:9:24 | -LL | let foo = Foo { x: &a }; //~ ERROR E0597 +LL | let foo = Foo { x: &a }; | ^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/issues/issue-46311.stderr b/src/test/ui/issues/issue-46311.stderr index 8ceb1d62c25c..d72d6477db64 100644 --- a/src/test/ui/issues/issue-46311.stderr +++ b/src/test/ui/issues/issue-46311.stderr @@ -1,7 +1,7 @@ error: invalid label name `'break` --> $DIR/issue-46311.rs:2:5 | -LL | 'break: loop { //~ ERROR invalid label name `'break` +LL | 'break: loop { | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-46438.stderr b/src/test/ui/issues/issue-46438.stderr index c670459c7816..c1fad44b885f 100644 --- a/src/test/ui/issues/issue-46438.stderr +++ b/src/test/ui/issues/issue-46438.stderr @@ -1,7 +1,7 @@ error: expected a trait, found type --> $DIR/issue-46438.rs:11:4 | -LL | m!(&'static u8); //~ ERROR expected a trait, found type +LL | m!(&'static u8); | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-46771.stderr b/src/test/ui/issues/issue-46771.stderr index 3c9c679ece43..76c86d7aa907 100644 --- a/src/test/ui/issues/issue-46771.stderr +++ b/src/test/ui/issues/issue-46771.stderr @@ -3,7 +3,7 @@ error[E0618]: expected function, found `main::Foo` | LL | struct Foo; | ----------- `main::Foo` defined here -LL | (1 .. 2).find(|_| Foo(0) == 0); //~ ERROR expected function, found `main::Foo` +LL | (1 .. 2).find(|_| Foo(0) == 0); | ^^^--- | | | call expression requires function diff --git a/src/test/ui/issues/issue-46843.stderr b/src/test/ui/issues/issue-46843.stderr index d02561e4a272..c252f0d0758c 100644 --- a/src/test/ui/issues/issue-46843.stderr +++ b/src/test/ui/issues/issue-46843.stderr @@ -1,13 +1,13 @@ error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants --> $DIR/issue-46843.rs:7:26 | -LL | pub const Q: i32 = match non_const() { //~ ERROR E0015 +LL | pub const Q: i32 = match non_const() { | ^^^^^^^^^^^ error[E0019]: constant contains unimplemented expression type --> $DIR/issue-46843.rs:8:5 | -LL | Thing::This => 1, //~ ERROR unimplemented expression type +LL | Thing::This => 1, | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-4736.stderr b/src/test/ui/issues/issue-4736.stderr index 39c649ba3e0e..b4ac12643bca 100644 --- a/src/test/ui/issues/issue-4736.stderr +++ b/src/test/ui/issues/issue-4736.stderr @@ -1,7 +1,7 @@ error[E0560]: struct `NonCopyable` has no field named `p` --> $DIR/issue-4736.rs:4:26 | -LL | let z = NonCopyable{ p: () }; //~ ERROR struct `NonCopyable` has no field named `p` +LL | let z = NonCopyable{ p: () }; | ^ help: a field with a similar name exists: `0` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-47623.stderr b/src/test/ui/issues/issue-47623.stderr index eb160ff86aec..53968a2960cc 100644 --- a/src/test/ui/issues/issue-47623.stderr +++ b/src/test/ui/issues/issue-47623.stderr @@ -1,7 +1,7 @@ error[E0429]: `self` imports are only allowed within a { } list --> $DIR/issue-47623.rs:1:5 | -LL | use self; //~ERROR `self` imports are only allowed within a { } list +LL | use self; | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-47646.stderr b/src/test/ui/issues/issue-47646.stderr index c30fedeea73d..db9f227d6b77 100644 --- a/src/test/ui/issues/issue-47646.stderr +++ b/src/test/ui/issues/issue-47646.stderr @@ -7,7 +7,7 @@ LL | LL | match (borrow, ()) { | ------------ a temporary with access to the mutable borrow is created here ... LL | (Some(_), ()) => { -LL | println!("{:?}", heap); //~ ERROR cannot borrow `heap` as immutable +LL | println!("{:?}", heap); | ^^^^ immutable borrow occurs here ... LL | }; diff --git a/src/test/ui/issues/issue-48131.stderr b/src/test/ui/issues/issue-48131.stderr index 6e454173f8bc..adc36e266c27 100644 --- a/src/test/ui/issues/issue-48131.stderr +++ b/src/test/ui/issues/issue-48131.stderr @@ -1,19 +1,19 @@ error: unnecessary `unsafe` block --> $DIR/issue-48131.rs:8:9 | -LL | unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe` +LL | unsafe { /* unnecessary */ } | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here --> $DIR/issue-48131.rs:3:9 | -LL | #![deny(unused_unsafe)] //~ NOTE +LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block --> $DIR/issue-48131.rs:19:13 | -LL | unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe` +LL | unsafe { /* unnecessary */ } | ^^^^^^ unnecessary `unsafe` block error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-48728.stderr b/src/test/ui/issues/issue-48728.stderr index e2f549ac4256..99a9bf9903e2 100644 --- a/src/test/ui/issues/issue-48728.stderr +++ b/src/test/ui/issues/issue-48728.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `std::clone::Clone` for type `Node<[_]>`: --> $DIR/issue-48728.rs:4:10 | -LL | #[derive(Clone)] //~ ERROR conflicting implementations of trait `std::clone::Clone` +LL | #[derive(Clone)] | ^^^^^ conflicting implementation for `Node<[_]>` ... LL | impl Clone for Node<[T]> { diff --git a/src/test/ui/issues/issue-48803.stderr b/src/test/ui/issues/issue-48803.stderr index 2635520ef078..9a6da9e625da 100644 --- a/src/test/ui/issues/issue-48803.stderr +++ b/src/test/ui/issues/issue-48803.stderr @@ -6,7 +6,7 @@ LL | let y = &x; ... LL | x = "modified"; | ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here -LL | //~^ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | LL | println!("{}", w); // prints "modified" | - borrow later used here diff --git a/src/test/ui/issues/issue-48838.stderr b/src/test/ui/issues/issue-48838.stderr index 32eea5e5fbb8..3007d67336b5 100644 --- a/src/test/ui/issues/issue-48838.stderr +++ b/src/test/ui/issues/issue-48838.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-48838.rs:2:14 | -LL | Square = |x| x, //~ ERROR mismatched types +LL | Square = |x| x, | ^^^^^ expected isize, found closure | = note: expected type `isize` diff --git a/src/test/ui/issues/issue-49040.stderr b/src/test/ui/issues/issue-49040.stderr index 12e78e2f3bc9..de78b8d3c14a 100644 --- a/src/test/ui/issues/issue-49040.stderr +++ b/src/test/ui/issues/issue-49040.stderr @@ -1,7 +1,7 @@ error: expected item, found `;` --> $DIR/issue-49040.rs:1:28 | -LL | #![allow(unused_variables)]; //~ ERROR expected item, found `;` +LL | #![allow(unused_variables)]; | ^ help: remove this semicolon error[E0601]: `main` function not found in crate `issue_49040` diff --git a/src/test/ui/issues/issue-49074.stderr b/src/test/ui/issues/issue-49074.stderr index a25d8ee35268..b41d9130f122 100644 --- a/src/test/ui/issues/issue-49074.stderr +++ b/src/test/ui/issues/issue-49074.stderr @@ -9,7 +9,7 @@ LL | #[marco_use] // typo error: cannot find macro `bar!` in this scope --> $DIR/issue-49074.rs:12:4 | -LL | bar!(); //~ ERROR cannot find macro `bar!` in this scope +LL | bar!(); | ^^^ | = help: have you added the `#[macro_use]` on the module/import? diff --git a/src/test/ui/issues/issue-49257.stderr b/src/test/ui/issues/issue-49257.stderr index 0bccfbbf7e5a..43a505cfe85f 100644 --- a/src/test/ui/issues/issue-49257.stderr +++ b/src/test/ui/issues/issue-49257.stderr @@ -1,33 +1,33 @@ error: expected `}`, found `,` --> $DIR/issue-49257.rs:10:19 | -LL | let Point { .., y, } = p; //~ ERROR expected `}`, found `,` +LL | let Point { .., y, } = p; | --^ | | | | | expected `}` | `..` must be at the end and cannot have a trailing comma help: move the `..` to the end of the field list | -LL | let Point { y, .. } = p; //~ ERROR expected `}`, found `,` +LL | let Point { y, .. } = p; | -- ^^^^ error: expected `}`, found `,` --> $DIR/issue-49257.rs:11:19 | -LL | let Point { .., y } = p; //~ ERROR expected `}`, found `,` +LL | let Point { .., y } = p; | --^ | | | | | expected `}` | `..` must be at the end and cannot have a trailing comma help: move the `..` to the end of the field list | -LL | let Point { y , .. } = p; //~ ERROR expected `}`, found `,` +LL | let Point { y , .. } = p; | -- ^^^^^^ error: expected `}`, found `,` --> $DIR/issue-49257.rs:12:19 | -LL | let Point { .., } = p; //~ ERROR expected `}`, found `,` +LL | let Point { .., } = p; | --^ | | | | | expected `}` diff --git a/src/test/ui/issues/issue-4935.stderr b/src/test/ui/issues/issue-4935.stderr index 42869ab48318..a99581fdca18 100644 --- a/src/test/ui/issues/issue-4935.stderr +++ b/src/test/ui/issues/issue-4935.stderr @@ -3,7 +3,7 @@ error[E0061]: this function takes 1 parameter but 2 parameters were supplied | LL | fn foo(a: usize) {} | ---------------- defined here -LL | //~^ defined here +LL | LL | fn main() { foo(5, 6) } | ^^^^^^^^^ expected 1 parameter diff --git a/src/test/ui/issues/issue-4972.stderr b/src/test/ui/issues/issue-4972.stderr index 30664c90ce81..b1947e2a9dff 100644 --- a/src/test/ui/issues/issue-4972.stderr +++ b/src/test/ui/issues/issue-4972.stderr @@ -1,7 +1,7 @@ error[E0033]: type `std::boxed::Box<(dyn MyTrait + 'static)>` cannot be dereferenced --> $DIR/issue-4972.rs:14:25 | -LL | TraitWrapper::A(box ref map) => map, //~ ERROR cannot be dereferenced +LL | TraitWrapper::A(box ref map) => map, | ^^^^^^^^^^^ type `std::boxed::Box<(dyn MyTrait + 'static)>` cannot be dereferenced error: aborting due to previous error diff --git a/src/test/ui/issues/issue-49824.stderr b/src/test/ui/issues/issue-49824.stderr index f487c363ea67..4ad537f3eb5d 100644 --- a/src/test/ui/issues/issue-49824.stderr +++ b/src/test/ui/issues/issue-49824.stderr @@ -2,7 +2,7 @@ error: compilation successful --> $DIR/issue-49824.rs:8:1 | LL | / fn main() { -LL | | //~^ compilation successful +LL | | LL | | let mut x = 0; LL | | || { ... | diff --git a/src/test/ui/issues/issue-49934.stderr b/src/test/ui/issues/issue-49934.stderr index 295f4f1b559a..6ca751a47c47 100644 --- a/src/test/ui/issues/issue-49934.stderr +++ b/src/test/ui/issues/issue-49934.stderr @@ -9,31 +9,31 @@ LL | #[derive(Debug)] warning: unused attribute --> $DIR/issue-49934.rs:6:8 | -LL | fn foo<#[derive(Debug)] T>() { //~ WARN unused attribute +LL | fn foo<#[derive(Debug)] T>() { | ^^^^^^^^^^^^^^^^ | note: lint level defined here --> $DIR/issue-49934.rs:4:9 | -LL | #![warn(unused_attributes)] //~ NOTE lint level defined here +LL | #![warn(unused_attributes)] | ^^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-49934.rs:8:9 | -LL | #[derive(Debug)] //~ WARN unused attribute +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-49934.rs:26:5 | -LL | #[derive(Debug)] //~ WARN unused attribute +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-49934.rs:30:5 | -LL | #[derive(Debug)] //~ WARN unused attribute +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ warning: unused attribute @@ -45,6 +45,6 @@ LL | let _ = #[derive(Debug)] "Hello, world!"; warning: unused attribute --> $DIR/issue-49934.rs:39:9 | -LL | #[derive(Debug)] //~ WARN unused attribute +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-50403.stderr b/src/test/ui/issues/issue-50403.stderr index f84d9d7769da..d20a98ecc6ad 100644 --- a/src/test/ui/issues/issue-50403.stderr +++ b/src/test/ui/issues/issue-50403.stderr @@ -1,7 +1,7 @@ error: concat_idents! takes 1 or more arguments. --> $DIR/issue-50403.rs:4:13 | -LL | let x = concat_idents!(); //~ ERROR concat_idents! takes 1 or more arguments +LL | let x = concat_idents!(); | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50480.stderr b/src/test/ui/issues/issue-50480.stderr index 240a0f222864..fb111e87d185 100644 --- a/src/test/ui/issues/issue-50480.stderr +++ b/src/test/ui/issues/issue-50480.stderr @@ -18,7 +18,7 @@ error[E0204]: the trait `Copy` may not be implemented for this type | LL | #[derive(Clone, Copy)] | ^^^^ -LL | //~^ ERROR the trait `Copy` may not be implemented for this type +LL | LL | struct Foo(NotDefined, ::Item, Vec, String); | -------- ------ this field does not implement `Copy` | | diff --git a/src/test/ui/issues/issue-50576.stderr b/src/test/ui/issues/issue-50576.stderr index 98624d141a61..22d978262c46 100644 --- a/src/test/ui/issues/issue-50576.stderr +++ b/src/test/ui/issues/issue-50576.stderr @@ -13,7 +13,7 @@ LL | |bool: [u8; break 'L]| 0; error[E0268]: `break` outside of loop --> $DIR/issue-50576.rs:5:16 | -LL | Vec::<[u8; break]>::new(); //~ ERROR [E0268] +LL | Vec::<[u8; break]>::new(); | ^^^^^ cannot break outside of a loop error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-50581.stderr b/src/test/ui/issues/issue-50581.stderr index 70ac9ecc9edf..01a5f9b3c443 100644 --- a/src/test/ui/issues/issue-50581.stderr +++ b/src/test/ui/issues/issue-50581.stderr @@ -1,7 +1,7 @@ error[E0268]: `break` outside of loop --> $DIR/issue-50581.rs:2:14 | -LL | |_: [u8; break]| (); //~ ERROR [E0268] +LL | |_: [u8; break]| (); | ^^^^^ cannot break outside of a loop error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50599.stderr b/src/test/ui/issues/issue-50599.stderr index cf2f309340de..e0c9bea4023d 100644 --- a/src/test/ui/issues/issue-50599.stderr +++ b/src/test/ui/issues/issue-50599.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `LOG10_2` in module `std::f64` --> $DIR/issue-50599.rs:3:48 | -LL | const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; //~ ERROR cannot find value +LL | const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; | ^^^^^^^ not found in `std::f64` help: possible candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/issues/issue-50600.stderr b/src/test/ui/issues/issue-50600.stderr index 36219390c519..2d97c2781c2d 100644 --- a/src/test/ui/issues/issue-50600.stderr +++ b/src/test/ui/issues/issue-50600.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-50600.rs:2:13 | -LL | fn([u8; |x: u8| {}]), //~ ERROR mismatched types +LL | fn([u8; |x: u8| {}]), | ^^^^^^^^^^ expected usize, found closure | = note: expected type `usize` diff --git a/src/test/ui/issues/issue-50688.stderr b/src/test/ui/issues/issue-50688.stderr index 2a1315c9a015..13eec8361ba8 100644 --- a/src/test/ui/issues/issue-50688.stderr +++ b/src/test/ui/issues/issue-50688.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-50688.rs:2:9 | -LL | [1; || {}]; //~ ERROR mismatched types +LL | [1; || {}]; | ^^^^^ expected usize, found closure | = note: expected type `usize` diff --git a/src/test/ui/issues/issue-50714-1.stderr b/src/test/ui/issues/issue-50714-1.stderr index e5fdd18d3328..427b200adf43 100644 --- a/src/test/ui/issues/issue-50714-1.stderr +++ b/src/test/ui/issues/issue-50714-1.stderr @@ -1,7 +1,7 @@ error[E0647]: start function is not allowed to have a `where` clause --> $DIR/issue-50714-1.rs:9:56 | -LL | fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq { //~ ERROR [E0647] +LL | fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq { | ^^^^^^^^^^^ start function cannot have a `where` clause error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50714.stderr b/src/test/ui/issues/issue-50714.stderr index d7631adc7b26..e048f39260c5 100644 --- a/src/test/ui/issues/issue-50714.stderr +++ b/src/test/ui/issues/issue-50714.stderr @@ -1,7 +1,7 @@ error[E0646]: `main` function is not allowed to have a `where` clause --> $DIR/issue-50714.rs:3:17 | -LL | fn main() where fn(&()): Eq {} //~ ERROR [E0646] +LL | fn main() where fn(&()): Eq {} | ^^^^^^^^^^^ `main` cannot have a `where` clause error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50781.stderr b/src/test/ui/issues/issue-50781.stderr index 11de59f9f009..c98f78c51ee5 100644 --- a/src/test/ui/issues/issue-50781.stderr +++ b/src/test/ui/issues/issue-50781.stderr @@ -1,7 +1,7 @@ error: the trait `X` cannot be made into an object --> $DIR/issue-50781.rs:6:5 | -LL | fn foo(&self) where Self: Trait; //~ ERROR the trait `X` cannot be made into an object +LL | fn foo(&self) where Self: Trait; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/issues/issue-50802.stderr b/src/test/ui/issues/issue-50802.stderr index 9a2ae7942939..e064fabccd04 100644 --- a/src/test/ui/issues/issue-50802.stderr +++ b/src/test/ui/issues/issue-50802.stderr @@ -1,7 +1,7 @@ error[E0590]: `break` or `continue` with no label in the condition of a `while` loop --> $DIR/issue-50802.rs:5:21 | -LL | break while continue { //~ ERROR E0590 +LL | break while continue { | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop error: aborting due to previous error diff --git a/src/test/ui/issues/issue-5099.stderr b/src/test/ui/issues/issue-5099.stderr index d103c968979a..cc11db9c5eca 100644 --- a/src/test/ui/issues/issue-5099.stderr +++ b/src/test/ui/issues/issue-5099.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `this` in this scope --> $DIR/issue-5099.rs:1:31 | -LL | trait B < A > { fn a() -> A { this.a } } //~ ERROR cannot find value `this` in this scope +LL | trait B < A > { fn a() -> A { this.a } } | ^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/issues/issue-5100.stderr b/src/test/ui/issues/issue-5100.stderr index 0a918a789703..0c1a0289cf27 100644 --- a/src/test/ui/issues/issue-5100.stderr +++ b/src/test/ui/issues/issue-5100.stderr @@ -48,7 +48,7 @@ LL | &(true, false) => () error[E0618]: expected function, found `(char, char)` --> $DIR/issue-5100.rs:48:14 | -LL | let v = [('a', 'b') //~ ERROR expected function, found `(char, char)` +LL | let v = [('a', 'b') | ______________-^^^^^^^^^ LL | | ('c', 'd'), | |_______________________- call expression requires function @@ -56,7 +56,7 @@ LL | | ('c', 'd'), error[E0308]: mismatched types --> $DIR/issue-5100.rs:55:19 | -LL | let x: char = true; //~ ERROR mismatched types +LL | let x: char = true; | ^^^^ expected char, found bool error: aborting due to 7 previous errors diff --git a/src/test/ui/issues/issue-51116.stderr b/src/test/ui/issues/issue-51116.stderr index 4c1870eb8c9f..8501ae6a1d02 100644 --- a/src/test/ui/issues/issue-51116.stderr +++ b/src/test/ui/issues/issue-51116.stderr @@ -3,7 +3,7 @@ error[E0282]: type annotations needed | LL | for tile in row { | --- the element type for this iterator is not specified -LL | //~^ NOTE the element type for this iterator is not specified +LL | LL | *tile = 0; | ^^^^^ cannot infer type | diff --git a/src/test/ui/issues/issue-51244.stderr b/src/test/ui/issues/issue-51244.stderr index a5b06aa22829..f798b5f1fce2 100644 --- a/src/test/ui/issues/issue-51244.stderr +++ b/src/test/ui/issues/issue-51244.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to immutable borrowed content `*my_ref` | LL | let ref my_ref @ _ = 0; | -------------- help: use a mutable reference instead: `ref mut my_ref @ _` -LL | *my_ref = 0; //~ ERROR cannot assign to immutable borrowed content `*my_ref` [E0594] +LL | *my_ref = 0; | ^^^^^^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/issues/issue-51848.stderr b/src/test/ui/issues/issue-51848.stderr index 1bb6f3c1f1ff..31faaab6141c 100644 --- a/src/test/ui/issues/issue-51848.stderr +++ b/src/test/ui/issues/issue-51848.stderr @@ -1,7 +1,7 @@ error: invalid format string: expected `'}'` but string was terminated --> $DIR/issue-51848.rs:6:20 | -LL | println!("{"); //~ ERROR invalid +LL | println!("{"); | -^ expected `'}'` in format string | | | because of this opening brace @@ -14,7 +14,7 @@ LL | macro_with_error!(); error: invalid format string: unmatched `}` found --> $DIR/issue-51848.rs:18:15 | -LL | println!("}"); //~ ERROR invalid +LL | println!("}"); | ^ unmatched `}` in format string | = note: if you intended to print `}`, you can escape it using `}}` diff --git a/src/test/ui/issues/issue-51874.stderr b/src/test/ui/issues/issue-51874.stderr index 38c380c4bab8..9b1a6bf2e12d 100644 --- a/src/test/ui/issues/issue-51874.stderr +++ b/src/test/ui/issues/issue-51874.stderr @@ -1,11 +1,11 @@ error[E0689]: can't call method `pow` on ambiguous numeric type `{float}` --> $DIR/issue-51874.rs:2:19 | -LL | let a = (1.0).pow(1.0); //~ ERROR can't call method `pow` on ambiguous numeric type +LL | let a = (1.0).pow(1.0); | ^^^ help: you must specify a concrete type for this numeric value, like `f32` | -LL | let a = (1.0_f32).pow(1.0); //~ ERROR can't call method `pow` on ambiguous numeric type +LL | let a = (1.0_f32).pow(1.0); | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr b/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr index f687be5edb09..60e0792954ae 100644 --- a/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr +++ b/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr @@ -1,7 +1,7 @@ error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) --> $DIR/issue-52023-array-size-pointer-cast.rs:2:17 | -LL | let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants +LL | let _ = [0; (&0 as *const i32) as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to error[E0080]: it is undefined behavior to use this value --> $DIR/issue-52023-array-size-pointer-cast.rs:2:17 | -LL | let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants +LL | let _ = [0; (&0 as *const i32) as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior diff --git a/src/test/ui/issues/issue-5216.stderr b/src/test/ui/issues/issue-5216.stderr index 5afea5873d56..ccfe7e04a2cf 100644 --- a/src/test/ui/issues/issue-5216.stderr +++ b/src/test/ui/issues/issue-5216.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-5216.rs:3:21 | -LL | pub static C: S = S(f); //~ ERROR mismatched types +LL | pub static C: S = S(f); | ^ expected struct `std::boxed::Box`, found fn item | = note: expected type `std::boxed::Box<(dyn std::ops::FnMut() + 'static)>` @@ -10,7 +10,7 @@ LL | pub static C: S = S(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/issue-5216.rs:8:19 | -LL | pub static D: T = g; //~ ERROR mismatched types +LL | pub static D: T = g; | ^ expected struct `std::boxed::Box`, found fn item | = note: expected type `std::boxed::Box<(dyn std::ops::FnMut() + 'static)>` diff --git a/src/test/ui/issues/issue-52213.stderr b/src/test/ui/issues/issue-52213.stderr index 4d3346f325dd..8d74b8ecb881 100644 --- a/src/test/ui/issues/issue-52213.stderr +++ b/src/test/ui/issues/issue-52213.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/issue-52213.rs:2:11 | -LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime +LL | match (&t,) { | ^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 1:23... diff --git a/src/test/ui/issues/issue-52891.stderr b/src/test/ui/issues/issue-52891.stderr index 65b2b9460bc9..1385693e91ae 100644 --- a/src/test/ui/issues/issue-52891.stderr +++ b/src/test/ui/issues/issue-52891.stderr @@ -3,7 +3,7 @@ error[E0252]: the name `a` is defined multiple times | LL | use issue_52891::a; | -------------- previous import of the module `a` here -LL | use issue_52891::a; //~ ERROR `a` is defined multiple times +LL | use issue_52891::a; | ----^^^^^^^^^^^^^^- | | | | | `a` reimported here @@ -17,7 +17,7 @@ error[E0252]: the name `a` is defined multiple times LL | use issue_52891::a; | -------------- previous import of the module `a` here ... -LL | use issue_52891::{a, b, c}; //~ ERROR `a` is defined multiple times +LL | use issue_52891::{a, b, c}; | ^-- | | | `a` reimported here @@ -31,7 +31,7 @@ error[E0252]: the name `a` is defined multiple times LL | use issue_52891::a; | -------------- previous import of the module `a` here ... -LL | use issue_52891::{d, a, e}; //~ ERROR `a` is defined multiple times +LL | use issue_52891::{d, a, e}; | ^-- | | | `a` reimported here @@ -45,7 +45,7 @@ error[E0252]: the name `a` is defined multiple times LL | use issue_52891::a; | -------------- previous import of the module `a` here ... -LL | use issue_52891::{f, g, a}; //~ ERROR `a` is defined multiple times +LL | use issue_52891::{f, g, a}; | --^ | | | | | `a` reimported here @@ -59,7 +59,7 @@ error[E0252]: the name `a` is defined multiple times LL | use issue_52891::a; | -------------- previous import of the module `a` here ... -LL | use issue_52891::{a, //~ ERROR `a` is defined multiple times +LL | use issue_52891::{a, | ^-- | | | `a` reimported here @@ -73,7 +73,7 @@ error[E0252]: the name `a` is defined multiple times LL | use issue_52891::a; | -------------- previous import of the module `a` here ... -LL | a, //~ ERROR `a` is defined multiple times +LL | a, | ^-- | | | `a` reimported here @@ -89,7 +89,7 @@ LL | use issue_52891::a; ... LL | m, | ______- -LL | | a}; //~ ERROR `a` is defined multiple times +LL | | a}; | | ^ | | | | |_____`a` reimported here @@ -102,13 +102,13 @@ error[E0252]: the name `inner` is defined multiple times | LL | use issue_52891::a::inner; | --------------------- previous import of the module `inner` here -LL | use issue_52891::b::inner; //~ ERROR `inner` is defined multiple times +LL | use issue_52891::b::inner; | ^^^^^^^^^^^^^^^^^^^^^ `inner` reimported here | = note: `inner` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use issue_52891::b::inner as other_inner; //~ ERROR `inner` is defined multiple times +LL | use issue_52891::b::inner as other_inner; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0254]: the name `issue_52891` is defined multiple times @@ -134,7 +134,7 @@ LL | use issue_52891::n; | | previous import of the module `n` here | help: remove unnecessary import LL | #[macro_use] -LL | use issue_52891::n; //~ ERROR `n` is defined multiple times +LL | use issue_52891::n; | ^^^^^^^^^^^^^^ `n` reimported here | = note: `n` must be defined only once in the type namespace of this module diff --git a/src/test/ui/issues/issue-54348.stderr b/src/test/ui/issues/issue-54348.stderr index d4ee94aa411b..e39a1cb20cff 100644 --- a/src/test/ui/issues/issue-54348.stderr +++ b/src/test/ui/issues/issue-54348.stderr @@ -1,7 +1,7 @@ error: index out of bounds: the len is 1 but the index is 1 --> $DIR/issue-54348.rs:3:5 | -LL | [1][1.5 as usize]; //~ ERROR index out of bounds +LL | [1][1.5 as usize]; | ^^^^^^^^^^^^^^^^^ | = note: #[deny(const_err)] on by default @@ -9,7 +9,7 @@ LL | [1][1.5 as usize]; //~ ERROR index out of bounds error: index out of bounds: the len is 1 but the index is 1 --> $DIR/issue-54348.rs:4:5 | -LL | [1][1u64 as usize]; //~ ERROR index out of bounds +LL | [1][1u64 as usize]; | ^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-5439.stderr b/src/test/ui/issues/issue-5439.stderr index 847bc7695807..bd0cb670bc21 100644 --- a/src/test/ui/issues/issue-5439.stderr +++ b/src/test/ui/issues/issue-5439.stderr @@ -1,7 +1,7 @@ error[E0560]: struct `Foo` has no field named `nonexistent` --> $DIR/issue-5439.rs:13:26 | -LL | return box Foo { nonexistent: self, foo: i }; //~ ERROR: no field named +LL | return box Foo { nonexistent: self, foo: i }; | ^^^^^^^^^^^ `Foo` does not have this field | = note: available fields are: `foo` diff --git a/src/test/ui/issues/issue-55587.stderr b/src/test/ui/issues/issue-55587.stderr index 876fb4391b1b..1334f249256d 100644 --- a/src/test/ui/issues/issue-55587.stderr +++ b/src/test/ui/issues/issue-55587.stderr @@ -1,7 +1,7 @@ error[E0164]: expected tuple struct/variant, found method `::new` --> $DIR/issue-55587.rs:4:9 | -LL | let Path::new(); //~ ERROR expected tuple struct/variant +LL | let Path::new(); | ^^^^^^^^^^^ not a tuple variant or struct error: aborting due to previous error diff --git a/src/test/ui/issues/issue-57362-1.stderr b/src/test/ui/issues/issue-57362-1.stderr index b21b35849b17..1d2ff7669c09 100644 --- a/src/test/ui/issues/issue-57362-1.stderr +++ b/src/test/ui/issues/issue-57362-1.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `f` found for type `fn(&u8)` in the current scope --> $DIR/issue-57362-1.rs:20:7 | -LL | a.f(); //~ ERROR no method named `f` +LL | a.f(); | ^ | = note: a is a function, perhaps you wish to call it diff --git a/src/test/ui/issues/issue-57362-2.stderr b/src/test/ui/issues/issue-57362-2.stderr index b8211691f7be..522b201ec78c 100644 --- a/src/test/ui/issues/issue-57362-2.stderr +++ b/src/test/ui/issues/issue-57362-2.stderr @@ -1,7 +1,7 @@ error[E0599]: no function or associated item named `make_g` found for type `for<'r> fn(&'r ())` in the current scope --> $DIR/issue-57362-2.rs:22:25 | -LL | let x = ::make_g(); //~ ERROR no function or associated item +LL | let x = ::make_g(); | ------------^^^^^^ | | | function or associated item not found in `for<'r> fn(&'r ())` diff --git a/src/test/ui/issues/issue-57843.stderr b/src/test/ui/issues/issue-57843.stderr index 4ef884cb3f58..57b206d7bff6 100644 --- a/src/test/ui/issues/issue-57843.stderr +++ b/src/test/ui/issues/issue-57843.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-57843.rs:23:9 | -LL | Foo(Box::new(|_| ())); //~ ERROR mismatched types +LL | Foo(Box::new(|_| ())); | ^^^^^^^^^^^^^^^^ one type is more general than the other | = note: expected type `std::ops::FnOnce<(&'a bool,)>` diff --git a/src/test/ui/issues/issue-5844.stderr b/src/test/ui/issues/issue-5844.stderr index 876151fb25cb..ed5a3dc6b1e1 100644 --- a/src/test/ui/issues/issue-5844.stderr +++ b/src/test/ui/issues/issue-5844.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block --> $DIR/issue-5844.rs:6:5 | -LL | issue_5844_aux::rand(); //~ ERROR: requires unsafe +LL | issue_5844_aux::rand(); | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/issues/issue-5883.stderr b/src/test/ui/issues/issue-5883.stderr index ad463d4c478c..7753881f7368 100644 --- a/src/test/ui/issues/issue-5883.stderr +++ b/src/test/ui/issues/issue-5883.stderr @@ -12,7 +12,7 @@ LL | fn new_struct(r: A+'static) error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time --> $DIR/issue-5883.rs:8:8 | -LL | -> Struct { //~^ ERROR the size for values of type +LL | -> Struct { | ^^^^^^ doesn't have a size known at compile-time | = help: within `Struct`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)` diff --git a/src/test/ui/issues/issue-58856-2.stderr b/src/test/ui/issues/issue-58856-2.stderr index 55a9e9d5cb86..b760fd6768af 100644 --- a/src/test/ui/issues/issue-58856-2.stderr +++ b/src/test/ui/issues/issue-58856-2.stderr @@ -19,8 +19,8 @@ error[E0407]: method `how_are_you` is not a member of trait `Howness` --> $DIR/issue-58856-2.rs:6:5 | LL | / fn how_are_you(&self -> Empty { -LL | | //~^ ERROR expected one of `)` or `,`, found `->` -LL | | //~| ERROR method `how_are_you` is not a member of trait `Howness` +LL | | +LL | | LL | | Empty LL | | } | |_____^ not a member of trait `Howness` diff --git a/src/test/ui/issues/issue-5927.stderr b/src/test/ui/issues/issue-5927.stderr index 189eefe51b91..6b0a2b7b935e 100644 --- a/src/test/ui/issues/issue-5927.stderr +++ b/src/test/ui/issues/issue-5927.stderr @@ -1,13 +1,13 @@ error[E0531]: cannot find tuple struct/variant `x` in this scope --> $DIR/issue-5927.rs:3:9 | -LL | x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope +LL | x(1) => x(1) | ^ not found in this scope error[E0425]: cannot find function `x` in this scope --> $DIR/issue-5927.rs:3:17 | -LL | x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope +LL | x(1) => x(1) | ^ not found in this scope error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-5997-struct.stderr b/src/test/ui/issues/issue-5997-struct.stderr index a60987b3f98b..cb1b5146b6c8 100644 --- a/src/test/ui/issues/issue-5997-struct.stderr +++ b/src/test/ui/issues/issue-5997-struct.stderr @@ -5,7 +5,7 @@ LL | fn f() -> bool { | - - type variable from outer function | | | try adding a local generic parameter in this method instead -LL | struct S(T); //~ ERROR can't use generic parameters from outer function +LL | struct S(T); | ^ use of generic parameter from outer function error: aborting due to previous error diff --git a/src/test/ui/issues/issue-6458-4.stderr b/src/test/ui/issues/issue-6458-4.stderr index c087292e978c..90b493e1634c 100644 --- a/src/test/ui/issues/issue-6458-4.stderr +++ b/src/test/ui/issues/issue-6458-4.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-6458-4.rs:1:20 | -LL | fn foo(b: bool) -> Result { //~ ERROR mismatched types +LL | fn foo(b: bool) -> Result { | --- ^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found () | | | this function's body doesn't return diff --git a/src/test/ui/issues/issue-6642.stderr b/src/test/ui/issues/issue-6642.stderr index a99d9b3cd77c..6668108d0245 100644 --- a/src/test/ui/issues/issue-6642.stderr +++ b/src/test/ui/issues/issue-6642.stderr @@ -1,7 +1,7 @@ error[E0434]: can't capture dynamic environment in a fn item --> $DIR/issue-6642.rs:5:13 | -LL | self.m() //~ ERROR can't capture dynamic environment in a fn item +LL | self.m() | ^^^^ | = help: use the `|| { ... }` closure form instead diff --git a/src/test/ui/issues/issue-6801.stderr b/src/test/ui/issues/issue-6801.stderr index fa0e1928ba4b..482e4873f3a7 100644 --- a/src/test/ui/issues/issue-6801.stderr +++ b/src/test/ui/issues/issue-6801.stderr @@ -4,7 +4,7 @@ error[E0505]: cannot move out of `x` because it is borrowed LL | let sq = || { *x * *x }; | -- borrow of `x` occurs here LL | -LL | twice(x); //~ ERROR: cannot move out of +LL | twice(x); | ^ move out of `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-6804.stderr b/src/test/ui/issues/issue-6804.stderr index 965148d478e0..1c251ed8445f 100644 --- a/src/test/ui/issues/issue-6804.stderr +++ b/src/test/ui/issues/issue-6804.stderr @@ -1,7 +1,7 @@ error: floating-point types cannot be used in patterns --> $DIR/issue-6804.rs:11:9 | -LL | NAN => {}, //~ ERROR floating-point types cannot be used +LL | NAN => {}, | ^^^ | note: lint level defined here @@ -15,7 +15,7 @@ LL | #![deny(illegal_floating_point_literal_pattern)] error: floating-point types cannot be used in patterns --> $DIR/issue-6804.rs:17:10 | -LL | [NAN, _] => {}, //~ ERROR floating-point types cannot be used +LL | [NAN, _] => {}, | ^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/issues/issue-6936.stderr b/src/test/ui/issues/issue-6936.stderr index b3fe1ddc4834..9292d60ca68f 100644 --- a/src/test/ui/issues/issue-6936.stderr +++ b/src/test/ui/issues/issue-6936.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `Foo` is defined multiple times | LL | type Foo = ::T; | --------------- previous definition of the type `Foo` here -LL | mod Foo {} //~ ERROR the name `Foo` is defined multiple times +LL | mod Foo {} | ^^^^^^^ `Foo` redefined here | = note: `Foo` must be defined only once in the type namespace of this module @@ -13,7 +13,7 @@ error[E0428]: the name `Foo` is defined multiple times | LL | type Foo = ::T; | --------------- previous definition of the type `Foo` here -LL | struct Foo; //~ ERROR the name `Foo` is defined multiple times +LL | struct Foo; | ^^^^^^^^^^^ `Foo` redefined here | = note: `Foo` must be defined only once in the type namespace of this module @@ -23,7 +23,7 @@ error[E0428]: the name `Foo` is defined multiple times | LL | type Foo = ::T; | --------------- previous definition of the type `Foo` here -LL | enum Foo {} //~ ERROR the name `Foo` is defined multiple times +LL | enum Foo {} | ^^^^^^^^ `Foo` redefined here | = note: `Foo` must be defined only once in the type namespace of this module @@ -33,7 +33,7 @@ error[E0428]: the name `Bar` is defined multiple times | LL | type Bar = T; | ---------------- previous definition of the type `Bar` here -LL | mod Bar {} //~ ERROR the name `Bar` is defined multiple times +LL | mod Bar {} | ^^^^^^^ `Bar` redefined here | = note: `Bar` must be defined only once in the type namespace of this module diff --git a/src/test/ui/issues/issue-7044.stderr b/src/test/ui/issues/issue-7044.stderr index 46c5d164e42c..2ad67ec23be8 100644 --- a/src/test/ui/issues/issue-7044.stderr +++ b/src/test/ui/issues/issue-7044.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `X` is defined multiple times | LL | static X: isize = 0; | -------------------- previous definition of the value `X` here -LL | struct X; //~ ERROR the name `X` is defined multiple times +LL | struct X; | ^^^^^^^^^ `X` redefined here | = note: `X` must be defined only once in the value namespace of this module diff --git a/src/test/ui/issues/issue-7246.stderr b/src/test/ui/issues/issue-7246.stderr index 5b8652597d3f..e049295e9136 100644 --- a/src/test/ui/issues/issue-7246.stderr +++ b/src/test/ui/issues/issue-7246.stderr @@ -1,7 +1,7 @@ error: unreachable statement --> $DIR/issue-7246.rs:7:5 | -LL | if *ptr::null() {}; //~ ERROR unreachable +LL | if *ptr::null() {}; | ^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/issues/issue-7607-1.stderr b/src/test/ui/issues/issue-7607-1.stderr index aa0a6c761bf0..9320943a8276 100644 --- a/src/test/ui/issues/issue-7607-1.stderr +++ b/src/test/ui/issues/issue-7607-1.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `Fo` in this scope --> $DIR/issue-7607-1.rs:5:6 | -LL | impl Fo { //~ ERROR cannot find type `Fo` in this scope +LL | impl Fo { | ^^ help: a trait with a similar name exists: `Fn` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-7813.stderr b/src/test/ui/issues/issue-7813.stderr index da5fc6357a66..45b9c915885b 100644 --- a/src/test/ui/issues/issue-7813.stderr +++ b/src/test/ui/issues/issue-7813.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/issue-7813.rs:2:13 | -LL | let v = &[]; //~ ERROR type annotations needed +LL | let v = &[]; | - ^^^ cannot infer type | | | consider giving `v` a type diff --git a/src/test/ui/issues/issue-8153.stderr b/src/test/ui/issues/issue-8153.stderr index 800b0277c9ac..4389c3dc288f 100644 --- a/src/test/ui/issues/issue-8153.stderr +++ b/src/test/ui/issues/issue-8153.stderr @@ -3,7 +3,7 @@ error[E0201]: duplicate definitions with name `bar`: | LL | fn bar(&self) -> isize {1} | -------------------------- previous definition of `bar` here -LL | fn bar(&self) -> isize {2} //~ ERROR duplicate definitions +LL | fn bar(&self) -> isize {2} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/issues/issue-8208.stderr b/src/test/ui/issues/issue-8208.stderr index a042dce1ac1d..e59aea12cda2 100644 --- a/src/test/ui/issues/issue-8208.stderr +++ b/src/test/ui/issues/issue-8208.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `self::*` --> $DIR/issue-8208.rs:1:5 | -LL | use self::*; //~ ERROR: unresolved import `self::*` [E0432] +LL | use self::*; | ^^^^^^^ cannot glob-import a module into itself error[E0432]: unresolved import `foo::*` --> $DIR/issue-8208.rs:5:9 | -LL | use foo::*; //~ ERROR: unresolved import `foo::*` [E0432] +LL | use foo::*; | ^^^^^^ cannot glob-import a module into itself error[E0432]: unresolved import `super::bar::*` diff --git a/src/test/ui/issues/issue-8767.stderr b/src/test/ui/issues/issue-8767.stderr index 80280f8c5358..91d99f393b61 100644 --- a/src/test/ui/issues/issue-8767.stderr +++ b/src/test/ui/issues/issue-8767.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `B` in this scope --> $DIR/issue-8767.rs:1:6 | -LL | impl B { //~ ERROR cannot find type `B` in this scope +LL | impl B { | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/issues/issue-9814.stderr b/src/test/ui/issues/issue-9814.stderr index fe105a9c3cef..bd9e7df4991b 100644 --- a/src/test/ui/issues/issue-9814.stderr +++ b/src/test/ui/issues/issue-9814.stderr @@ -1,7 +1,7 @@ error[E0614]: type `Foo` cannot be dereferenced --> $DIR/issue-9814.rs:7:13 | -LL | let _ = *Foo::Bar(2); //~ ERROR type `Foo` cannot be dereferenced +LL | let _ = *Foo::Bar(2); | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-pr29383.stderr b/src/test/ui/issues/issue-pr29383.stderr index 1fe49f8fb14a..9695e1e3c07f 100644 --- a/src/test/ui/issues/issue-pr29383.stderr +++ b/src/test/ui/issues/issue-pr29383.stderr @@ -1,13 +1,13 @@ error[E0532]: expected tuple struct/variant, found unit variant `E::A` --> $DIR/issue-pr29383.rs:9:14 | -LL | Some(E::A(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::A` +LL | Some(E::A(..)) => {} | ^^^^ not a tuple struct/variant error[E0532]: expected tuple struct/variant, found unit variant `E::B` --> $DIR/issue-pr29383.rs:10:14 | -LL | Some(E::B(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::B` +LL | Some(E::B(..)) => {} | ^^^^ not a tuple struct/variant error: aborting due to 2 previous errors diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr index 150fc88e7efc..8bb89d2ee215 100644 --- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr @@ -1,7 +1,7 @@ error: expected expression, found keyword `extern` --> $DIR/keyword-extern-as-identifier-expr.rs:2:13 | -LL | let s = extern::foo::Bar; //~ ERROR expected expression, found keyword `extern` +LL | let s = extern::foo::Bar; | ^^^^^^ expected expression error: aborting due to previous error diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr index 426b4eef0569..d7b9ad2abe97 100644 --- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `extern` --> $DIR/keyword-extern-as-identifier-pat.rs:2:9 | -LL | let extern = 0; //~ ERROR expected pattern, found keyword `extern` +LL | let extern = 0; | ^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.stderr index 97b641fbea55..447c76a5bbce 100644 --- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.stderr +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.stderr @@ -1,7 +1,7 @@ error: expected `fn`, found `::` --> $DIR/keyword-extern-as-identifier-type.rs:1:16 | -LL | type A = extern::foo::bar; //~ ERROR expected `fn`, found `::` +LL | type A = extern::foo::bar; | ^^ expected `fn` here error: aborting due to previous error diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr index 31b575a92e0c..4b833f806819 100644 --- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr @@ -1,11 +1,11 @@ error: expected identifier, found keyword `extern` --> $DIR/keyword-extern-as-identifier-use.rs:1:5 | -LL | use extern::foo; //~ ERROR expected identifier, found keyword `extern` +LL | use extern::foo; | ^^^^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | use r#extern::foo; //~ ERROR expected identifier, found keyword `extern` +LL | use r#extern::foo; | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/keyword/keyword-false-as-identifier.stderr b/src/test/ui/keyword/keyword-false-as-identifier.stderr index 6c8dffa7e22c..954460459983 100644 --- a/src/test/ui/keyword/keyword-false-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-false-as-identifier.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/keyword-false-as-identifier.rs:2:9 | -LL | let false = 22; //~ error: mismatched types +LL | let false = 22; | ^^^^^ expected integer, found bool | = note: expected type `{integer}` diff --git a/src/test/ui/keyword/keyword-self-as-identifier.stderr b/src/test/ui/keyword/keyword-self-as-identifier.stderr index 6ea19620a660..be57c6ad26fd 100644 --- a/src/test/ui/keyword/keyword-self-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-self-as-identifier.stderr @@ -1,7 +1,7 @@ error[E0531]: cannot find unit struct/variant or constant `Self` in this scope --> $DIR/keyword-self-as-identifier.rs:2:9 | -LL | let Self = 22; //~ ERROR cannot find unit struct/variant or constant `Self` in this scope +LL | let Self = 22; | ^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/keyword/keyword-super-as-identifier.stderr b/src/test/ui/keyword/keyword-super-as-identifier.stderr index b0973bd170e5..bbeaed942879 100644 --- a/src/test/ui/keyword/keyword-super-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-super-as-identifier.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: there are too many initial `super`s. --> $DIR/keyword-super-as-identifier.rs:2:9 | -LL | let super = 22; //~ ERROR failed to resolve: there are too many initial `super`s +LL | let super = 22; | ^^^^^ there are too many initial `super`s. error: aborting due to previous error diff --git a/src/test/ui/keyword/keyword-super.stderr b/src/test/ui/keyword/keyword-super.stderr index 5ec33ae30a69..63394c7852a5 100644 --- a/src/test/ui/keyword/keyword-super.stderr +++ b/src/test/ui/keyword/keyword-super.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: there are too many initial `super`s. --> $DIR/keyword-super.rs:2:9 | -LL | let super: isize; //~ ERROR failed to resolve: there are too many initial `super`s +LL | let super: isize; | ^^^^^ there are too many initial `super`s. error: aborting due to previous error diff --git a/src/test/ui/keyword/keyword-true-as-identifier.stderr b/src/test/ui/keyword/keyword-true-as-identifier.stderr index e5d3938e54ac..36b1d882a347 100644 --- a/src/test/ui/keyword/keyword-true-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-true-as-identifier.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/keyword-true-as-identifier.rs:2:9 | -LL | let true = 22; //~ error: mismatched types +LL | let true = 22; | ^^^^ expected integer, found bool | = note: expected type `{integer}` diff --git a/src/test/ui/kindck/kindck-copy.stderr b/src/test/ui/kindck/kindck-copy.stderr index 65c06b8308c9..2680cb7c012f 100644 --- a/src/test/ui/kindck/kindck-copy.stderr +++ b/src/test/ui/kindck/kindck-copy.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `&'static mut isize: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:27:5 | -LL | assert_copy::<&'static mut isize>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::<&'static mut isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'static mut isize` | = help: the following implementations were found: @@ -15,7 +15,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `&'a mut isize: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:28:5 | -LL | assert_copy::<&'a mut isize>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::<&'a mut isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut isize` | = help: the following implementations were found: @@ -29,7 +29,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:31:5 | -LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` | note: required by `assert_copy` @@ -41,7 +41,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:32:5 | -LL | assert_copy::(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::(); | ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` | note: required by `assert_copy` @@ -53,7 +53,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::vec::Vec: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:33:5 | -LL | assert_copy:: >(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy:: >(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::vec::Vec` | note: required by `assert_copy` @@ -65,7 +65,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::boxed::Box<&'a mut isize>: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:34:5 | -LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<&'a mut isize>` | note: required by `assert_copy` @@ -77,7 +77,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:42:5 | -LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` | note: required by `assert_copy` @@ -89,7 +89,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:43:5 | -LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` | note: required by `assert_copy` @@ -101,7 +101,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `&'a mut (dyn Dummy + std::marker::Send + 'a): std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:46:5 | -LL | assert_copy::<&'a mut (Dummy+Send)>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::<&'a mut (Dummy+Send)>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut (dyn Dummy + std::marker::Send + 'a)` | note: required by `assert_copy` @@ -113,7 +113,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `MyNoncopyStruct: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:64:5 | -LL | assert_copy::(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `MyNoncopyStruct` | note: required by `assert_copy` @@ -125,7 +125,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::rc::Rc: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:67:5 | -LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::rc::Rc` | note: required by `assert_copy` diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr index fe8e02e35477..1b7f9cd55173 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.stderr +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `std::boxed::Box<{integer}>: std::marker::Copy` is not satisfied --> $DIR/kindck-inherited-copy-bound.rs:18:5 | -LL | take_param(&x); //~ ERROR E0277 +LL | take_param(&x); | ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<{integer}>` | = note: required because of the requirements on the impl of `Foo` for `std::boxed::Box<{integer}>` diff --git a/src/test/ui/label/label-static.stderr b/src/test/ui/label/label-static.stderr index 52ab547aa7bb..1d3251d1b5f4 100644 --- a/src/test/ui/label/label-static.stderr +++ b/src/test/ui/label/label-static.stderr @@ -1,13 +1,13 @@ error: invalid label name `'static` --> $DIR/label-static.rs:2:5 | -LL | 'static: loop { //~ ERROR invalid label name `'static` +LL | 'static: loop { | ^^^^^^^ error: invalid label name `'static` --> $DIR/label-static.rs:3:15 | -LL | break 'static //~ ERROR invalid label name `'static` +LL | break 'static | ^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/label/label-underscore.stderr b/src/test/ui/label/label-underscore.stderr index a4925c8619ed..4558ec4cb41f 100644 --- a/src/test/ui/label/label-underscore.stderr +++ b/src/test/ui/label/label-underscore.stderr @@ -1,13 +1,13 @@ error: invalid label name `'_` --> $DIR/label-underscore.rs:2:5 | -LL | '_: loop { //~ ERROR invalid label name `'_` +LL | '_: loop { | ^^ error: invalid label name `'_` --> $DIR/label-underscore.rs:3:15 | -LL | break '_ //~ ERROR invalid label name `'_` +LL | break '_ | ^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/label/label_break_value_continue.stderr b/src/test/ui/label/label_break_value_continue.stderr index c0decc825524..bd1dd5938988 100644 --- a/src/test/ui/label/label_break_value_continue.stderr +++ b/src/test/ui/label/label_break_value_continue.stderr @@ -1,27 +1,27 @@ error[E0695]: unlabeled `continue` inside of a labeled block --> $DIR/label_break_value_continue.rs:7:9 | -LL | continue; //~ ERROR unlabeled `continue` inside of a labeled block +LL | continue; | ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label error[E0696]: `continue` pointing to a labeled block --> $DIR/label_break_value_continue.rs:14:9 | -LL | continue 'b; //~ ERROR `continue` pointing to a labeled block +LL | continue 'b; | ^^^^^^^^^^^ labeled blocks cannot be `continue`'d | note: labeled block the continue points to --> $DIR/label_break_value_continue.rs:13:5 | LL | / 'b: { -LL | | continue 'b; //~ ERROR `continue` pointing to a labeled block +LL | | continue 'b; LL | | } | |_____^ error[E0695]: unlabeled `continue` inside of a labeled block --> $DIR/label_break_value_continue.rs:22:13 | -LL | continue; //~ ERROR unlabeled `continue` inside of a labeled block +LL | continue; | ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label error: aborting due to 3 previous errors diff --git a/src/test/ui/label/label_break_value_illegal_uses.stderr b/src/test/ui/label/label_break_value_illegal_uses.stderr index 889df17de44d..0b9754c3c70e 100644 --- a/src/test/ui/label/label_break_value_illegal_uses.stderr +++ b/src/test/ui/label/label_break_value_illegal_uses.stderr @@ -1,13 +1,13 @@ error: expected one of `extern`, `fn`, or `{`, found `'b` --> $DIR/label_break_value_illegal_uses.rs:6:12 | -LL | unsafe 'b: {} //~ ERROR expected one of `extern`, `fn`, or `{` +LL | unsafe 'b: {} | ^^ expected one of `extern`, `fn`, or `{` here error: expected `{`, found `'b` --> $DIR/label_break_value_illegal_uses.rs:10:13 | -LL | if true 'b: {} //~ ERROR expected `{`, found `'b` +LL | if true 'b: {} | -- ^^---- | | | | | expected `{` @@ -17,7 +17,7 @@ LL | if true 'b: {} //~ ERROR expected `{`, found `'b` error: expected `{`, found `'b` --> $DIR/label_break_value_illegal_uses.rs:14:21 | -LL | if true {} else 'b: {} //~ ERROR expected `{`, found `'b` +LL | if true {} else 'b: {} | ^^---- | | | expected `{` @@ -26,7 +26,7 @@ LL | if true {} else 'b: {} //~ ERROR expected `{`, found `'b` error: expected one of `.`, `?`, `{`, or an operator, found `'b` --> $DIR/label_break_value_illegal_uses.rs:18:17 | -LL | match false 'b: {} //~ ERROR expected one of `.`, `?`, `{`, or an operator +LL | match false 'b: {} | ----- ^^ expected one of `.`, `?`, `{`, or an operator here | | | while parsing this match expression diff --git a/src/test/ui/label/label_break_value_unlabeled_break.stderr b/src/test/ui/label/label_break_value_unlabeled_break.stderr index 1d6e27d4c3d0..0c4f573d27db 100644 --- a/src/test/ui/label/label_break_value_unlabeled_break.stderr +++ b/src/test/ui/label/label_break_value_unlabeled_break.stderr @@ -1,13 +1,13 @@ error[E0695]: unlabeled `break` inside of a labeled block --> $DIR/label_break_value_unlabeled_break.rs:7:9 | -LL | break; //~ ERROR unlabeled `break` inside of a labeled block +LL | break; | ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label error[E0695]: unlabeled `break` inside of a labeled block --> $DIR/label_break_value_unlabeled_break.rs:15:13 | -LL | break; //~ ERROR unlabeled `break` inside of a labeled block +LL | break; | ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label error: aborting due to 2 previous errors diff --git a/src/test/ui/lexical-scopes.stderr b/src/test/ui/lexical-scopes.stderr index 51313033a02d..fb823ebde2ed 100644 --- a/src/test/ui/lexical-scopes.stderr +++ b/src/test/ui/lexical-scopes.stderr @@ -1,7 +1,7 @@ error[E0574]: expected struct, variant or union type, found type parameter `T` --> $DIR/lexical-scopes.rs:3:13 | -LL | let t = T { i: 0 }; //~ ERROR expected struct, variant or union type, found type parameter `T` +LL | let t = T { i: 0 }; | ^ not a struct, variant or union type help: possible better candidate is found in another module, you can import it into scope | @@ -11,7 +11,7 @@ LL | use T; error[E0599]: no function or associated item named `f` found for type `Foo` in the current scope --> $DIR/lexical-scopes.rs:10:10 | -LL | Foo::f(); //~ ERROR no function or associated item named `f` +LL | Foo::f(); | -----^ | | | function or associated item not found in `Foo` diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr index a283a0b29e6c..1af4bd501ba4 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/lifetime-bound-will-change-warning.rs:34:13 | -LL | ref_obj(x) //~ ERROR mismatched types +LL | ref_obj(x) | ^ lifetime mismatch | = note: expected type `&std::boxed::Box<(dyn std::ops::Fn() + 'static)>` @@ -16,7 +16,7 @@ LL | fn test2<'a>(x: &'a Box) { error[E0308]: mismatched types --> $DIR/lifetime-bound-will-change-warning.rs:39:18 | -LL | lib::ref_obj(x) //~ ERROR mismatched types +LL | lib::ref_obj(x) | ^ lifetime mismatch | = note: expected type `&std::boxed::Box<(dyn std::ops::Fn() + 'static)>` diff --git a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr index d4ca1aec6978..90bec01df63e 100644 --- a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr +++ b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr @@ -46,7 +46,7 @@ LL | fn baz<'a, L, M: X<&'a Nested>>() { | ^ - help: consider adding an explicit lifetime bound `L: 'a`... | _____| | | -LL | | //~^ ERROR may not live long enough +LL | | LL | | } | |_____^ | @@ -54,7 +54,7 @@ note: ...so that the reference type `&'a Nested` does not outlive the data it --> $DIR/lifetime-doesnt-live-long-enough.rs:32:5 | LL | / fn baz<'a, L, M: X<&'a Nested>>() { -LL | | //~^ ERROR may not live long enough +LL | | LL | | } | |_____^ @@ -64,7 +64,7 @@ error[E0309]: the parameter type `K` may not live long enough LL | impl Nested { | - help: consider adding an explicit lifetime bound `K: 'a`... LL | / fn generic_in_parent<'a, L: X<&'a Nested>>() { -LL | | //~^ ERROR may not live long enough +LL | | LL | | } | |_____^ | @@ -72,7 +72,7 @@ note: ...so that the reference type `&'a Nested` does not outlive the data it --> $DIR/lifetime-doesnt-live-long-enough.rs:41:5 | LL | / fn generic_in_parent<'a, L: X<&'a Nested>>() { -LL | | //~^ ERROR may not live long enough +LL | | LL | | } | |_____^ @@ -83,7 +83,7 @@ LL | fn generic_in_child<'a, 'b, L: X<&'a Nested>, M: 'b>() { | ^ -- help: consider adding an explicit lifetime bound `M: 'a`... | _____| | | -LL | | //~^ ERROR may not live long enough +LL | | LL | | } | |_____^ | @@ -91,7 +91,7 @@ note: ...so that the reference type `&'a Nested` does not outlive the data it --> $DIR/lifetime-doesnt-live-long-enough.rs:44:5 | LL | / fn generic_in_child<'a, 'b, L: X<&'a Nested>, M: 'b>() { -LL | | //~^ ERROR may not live long enough +LL | | LL | | } | |_____^ diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr index cf825c52f569..3f7c3934a0ba 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:2:11 | -LL | fn f() -> &isize { //~ ERROR missing lifetime specifier +LL | fn f() -> &isize { | ^ help: consider giving it a 'static lifetime: `&'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from @@ -9,7 +9,7 @@ LL | fn f() -> &isize { //~ ERROR missing lifetime specifier error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:7:33 | -LL | fn g(_x: &isize, _y: &isize) -> &isize { //~ ERROR missing lifetime specifier +LL | fn g(_x: &isize, _y: &isize) -> &isize { | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_x` or `_y` @@ -17,7 +17,7 @@ LL | fn g(_x: &isize, _y: &isize) -> &isize { //~ ERROR missing lifetime spec error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:17:19 | -LL | fn h(_x: &Foo) -> &isize { //~ ERROR missing lifetime specifier +LL | fn h(_x: &Foo) -> &isize { | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of `_x`'s 2 lifetimes it is borrowed from @@ -25,7 +25,7 @@ LL | fn h(_x: &Foo) -> &isize { //~ ERROR missing lifetime specifier error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:21:20 | -LL | fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier +LL | fn i(_x: isize) -> &isize { | ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static` | = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments @@ -33,7 +33,7 @@ LL | fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:34:24 | -LL | fn j(_x: StaticStr) -> &isize { //~ ERROR missing lifetime specifier +LL | fn j(_x: StaticStr) -> &isize { | ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static` | = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments diff --git a/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr b/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr index 6211a9a11417..63d00875dd33 100644 --- a/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `x` LL | fn foo2<'a>(a: &'a Foo, x: &i32) -> &'a i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` ... -LL | &*x //~ ERROR explicit lifetime +LL | &*x | ^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr index 9fe1679936d8..64aa8361cd5e 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `other` LL | fn bar(&self, other: Foo) -> Foo<'a> { | --- help: add explicit lifetime `'a` to the type of `other`: `Foo<'a>` ... -LL | other //~ ERROR explicit lifetime +LL | other | ^^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr index 94ec5248eb00..b40481ecdc40 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x` | LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` -LL | if x > y { x } else { y } //~ ERROR explicit lifetime +LL | if x > y { x } else { y } | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr index 4be638bf4c21..194fd95891eb 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in parameter type | LL | fn foo<'a>((x, y): (&'a i32, &i32)) -> &'a i32 { | --------------- help: add explicit lifetime `'a` to type: `(&'a i32, &'a i32)` -LL | if x > y { x } else { y } //~ ERROR explicit lifetime +LL | if x > y { x } else { y } | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr index d61271b81ac1..64f4bd0fc706 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x` | LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` -LL | if x > y { x } else { y } //~ ERROR explicit lifetime +LL | if x > y { x } else { y } | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr index 15642be44b7e..f764ec43ad1c 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `x` LL | fn foo<'a>(&'a self, x: &i32) -> &i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` LL | -LL | if true { &self.field } else { x } //~ ERROR explicit lifetime +LL | if true { &self.field } else { x } | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr index 1eaa9c8339f7..e9f5fc311dfc 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr @@ -6,7 +6,7 @@ LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | | | this parameter and the return type are declared with different lifetimes... LL | -LL | if x > y { x } else { y } //~ ERROR lifetime mismatch +LL | if x > y { x } else { y } | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr index d48adf168080..29a70695710f 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `y` | LL | fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 { | ---- help: add explicit lifetime `'a` to the type of `y`: `&'a i32` -LL | if x > y { x } else { y } //~ ERROR explicit lifetime +LL | if x > y { x } else { y } | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr index f4b2efa8438c..0d506f2b9fcb 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr @@ -6,7 +6,7 @@ LL | fn foo<'a>(&self, x: &'a i32) -> &i32 { | | | this parameter and the return type are declared with different lifetimes... LL | -LL | x //~ ERROR lifetime mismatch +LL | x | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr index 328c69bb6586..98a23613c363 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr @@ -6,7 +6,7 @@ LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { | | | this parameter and the return type are declared with different lifetimes... LL | -LL | if true { x } else { self } //~ ERROR lifetime mismatch +LL | if true { x } else { self } | ^^^^ ...but data from `self` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr index 9fc1124685c5..a4e0d71a3fa6 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/ex1b-return-no-names-if-else.rs:1:29 | -LL | fn foo(x: &i32, y: &i32) -> &i32 { //~ ERROR missing lifetime +LL | fn foo(x: &i32, y: &i32) -> &i32 { | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `x` or `y` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr index 3df29e62a283..412cac435636 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x` | LL | fn foo<'a>(x: Ref, y: &mut Vec>) { | -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>` -LL | y.push(x); //~ ERROR explicit lifetime +LL | y.push(x); | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr index 0fd085c39f28..30826c3613c5 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `y` LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T) | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` ... -LL | x.push(y); //~ ERROR explicit lifetime required +LL | x.push(y); | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr index a669e33ab098..13d0835287d0 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `y` | LL | fn foo<'a>(x: &mut Vec>, y: Ref) { | -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>` -LL | x.push(y); //~ ERROR explicit lifetime +LL | x.push(y); | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr index 7ac61df49548..e505c9c0dc26 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(x: &mut Vec>, y: Ref) { | -------- -------- these two types are declared with different lifetimes... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr index bfa9c0d15f0f..63b1c6db28f1 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... LL | let z = Ref { data: y.data }; -LL | x.push(z); //~ ERROR lifetime mismatch +LL | x.push(z); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr index 2db81f8aba6e..2f669efcf1eb 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... -LL | let a: &mut Vec> = x; //~ ERROR lifetime mismatch +LL | let a: &mut Vec> = x; | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr index 85a6dba92893..258b6805acd5 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... -LL | let a: &mut Vec> = x; //~ ERROR lifetime mismatch +LL | let a: &mut Vec> = x; | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr index b8f97d145772..0aff80c6fbdd 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) { | --- --- these two types are declared with different lifetimes... -LL | *v = x; //~ ERROR lifetime mismatch +LL | *v = x; | ^ ...but data from `x` flows here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr index acfe809b6785..2e5ff6782d3b 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { | --- --- these two types are declared with different lifetimes... -LL | z.push((x,y)); //~ ERROR lifetime mismatch +LL | z.push((x,y)); | ^ ...but data flows into `z` here error[E0623]: lifetime mismatch @@ -11,7 +11,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { | --- --- these two types are declared with different lifetimes... -LL | z.push((x,y)); //~ ERROR lifetime mismatch +LL | z.push((x,y)); | ^ ...but data flows into `z` here error: aborting due to 2 previous errors diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr index cb1ca5e1485b..8e41d7c54e68 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(mut x: Ref, y: Ref) { | --- --- these two types are declared with different lifetimes... -LL | x.b = y.b; //~ ERROR lifetime mismatch +LL | x.b = y.b; | ^^^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr index 863ec9806fca..da83ebc984c4 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr @@ -5,7 +5,7 @@ LL | fn foo(mut x: Ref) { | --- | | | this type is declared with multiple lifetimes... -LL | x.a = x.b; //~ ERROR lifetime mismatch +LL | x.a = x.b; | ^^^ ...but data with one lifetime flows into the other here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr index 57174385b4dd..374bbd93d087 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) | ------- ------- these two types are declared with different lifetimes... ... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr index caa7397979bc..94798d1ce2ab 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) { | ------- ------- these two types are declared with different lifetimes... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr index 27d5f5da7e53..9f5a79ed333d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(mut x: Vec, y: Ref) { | --- --- these two types are declared with different lifetimes... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr index 97da7f8ac6df..2c87f8dbd2c2 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { | ------ ------ these two types are declared with different lifetimes... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr index 8c4e3daed4ca..60b92ed2b324 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr @@ -5,7 +5,7 @@ LL | fn foo(mut x: Ref, y: &u32) { | --- ---- | | | these two types are declared with different lifetimes... -LL | y = x.b; //~ ERROR lifetime mismatch +LL | y = x.b; | ^^^ ...but data from `x` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr index b443707bbae4..a220c8ddb2be 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(mut y: Ref, x: &u32) { | --- ---- these two types are declared with different lifetimes... -LL | y.b = x; //~ ERROR lifetime mismatch +LL | y.b = x; | ^ ...but data from `x` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr index 77d43cd17c8f..73472a8d0225 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(mut y: Ref, x: &u32) { | --- ---- these two types are declared with different lifetimes... -LL | y.b = x; //~ ERROR lifetime mismatch +LL | y.b = x; | ^ ...but data from `x` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr index eef3aa50e0f2..eb6e6f2e95e7 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(mut x: Ref, y: &u32) { | --- ---- these two types are declared with different lifetimes... -LL | x.b = y; //~ ERROR lifetime mismatch +LL | x.b = y; | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr index 917b90fd47f9..199f880b3c48 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr @@ -5,7 +5,7 @@ LL | fn foo<'a>(&self, x: &i32) -> &i32 { | ---- ---- | | | this parameter and the return type are declared with different lifetimes... -LL | x //~ ERROR lifetime mismatch +LL | x | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr index a2ba41ef4f09..838f43b37747 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr @@ -5,7 +5,7 @@ LL | fn foo<'a>(&self, x: &Foo) -> &Foo { | ---- ---- | | | this parameter and the return type are declared with different lifetimes... -LL | if true { x } else { self } //~ ERROR lifetime mismatch +LL | if true { x } else { self } | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr index 43e54d640859..d2cc3dba6a43 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { | --- --- these two types are declared with different lifetimes... -LL | y.push(z); //~ ERROR lifetime mismatch +LL | y.push(z); | ^ ...but data from `z` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr index 39896a3c8a05..e8b0208f092f 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { | --- --- these two types are declared with different lifetimes... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr index 46eca5ea64f6..5ad85c97e72d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { | --- --- these two types are declared with different lifetimes... -LL | y.push(z); //~ ERROR lifetime mismatch +LL | y.push(z); | ^ ...but data from `z` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr index 07d6cafd6339..b2784827672b 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { | --- --- these two types are declared with different lifetimes... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr index f66bd3b35f78..e15290f0b9ee 100644 --- a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr @@ -3,7 +3,7 @@ error[E0384]: cannot assign twice to immutable variable `x` (Ast) | LL | x = 2; | ----- first assignment to `x` -LL | x = 3; //~ ERROR (Ast) [E0384] +LL | x = 3; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Ast) @@ -11,22 +11,22 @@ error[E0384]: cannot assign twice to immutable variable `x` (Ast) | LL | x = 2; | ----- first assignment to `x` -LL | x = 3; //~ ERROR (Ast) [E0384] +LL | x = 3; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Ast) --> $DIR/liveness-assign-imm-local-notes.rs:35:13 | -LL | x = 1; //~ ERROR (Ast) [E0384] +LL | x = 1; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Ast) --> $DIR/liveness-assign-imm-local-notes.rs:38:13 | -LL | x = 1; //~ ERROR (Ast) [E0384] +LL | x = 1; | ----- first assignment to `x` ... -LL | x = 2; //~ ERROR (Ast) [E0384] +LL | x = 2; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Mir) @@ -37,7 +37,7 @@ LL | let x; ... LL | x = 2; | ----- first assignment to `x` -LL | x = 3; //~ ERROR (Ast) [E0384] +LL | x = 3; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Mir) @@ -48,7 +48,7 @@ LL | let x; ... LL | x = 2; | ----- first assignment to `x` -LL | x = 3; //~ ERROR (Ast) [E0384] +LL | x = 3; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Mir) @@ -57,7 +57,7 @@ error[E0384]: cannot assign twice to immutable variable `x` (Mir) LL | let x; | - help: make this binding mutable: `mut x` ... -LL | x = 1; //~ ERROR (Ast) [E0384] +LL | x = 1; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Mir) @@ -66,10 +66,10 @@ error[E0384]: cannot assign twice to immutable variable `x` (Mir) LL | let x; | - help: make this binding mutable: `mut x` ... -LL | x = 1; //~ ERROR (Ast) [E0384] +LL | x = 1; | ----- first assignment to `x` ... -LL | x = 2; //~ ERROR (Ast) [E0384] +LL | x = 2; | ^^^^^ cannot assign twice to immutable variable error: aborting due to 8 previous errors diff --git a/src/test/ui/lifetimes/lifetime-no-keyword.stderr b/src/test/ui/lifetimes/lifetime-no-keyword.stderr index 912befff01cc..ba8ceb80fe0f 100644 --- a/src/test/ui/lifetimes/lifetime-no-keyword.stderr +++ b/src/test/ui/lifetimes/lifetime-no-keyword.stderr @@ -1,25 +1,25 @@ error: lifetimes cannot use keyword names --> $DIR/lifetime-no-keyword.rs:3:8 | -LL | fn baz<'let>(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names +LL | fn baz<'let>(a: &'let isize) { } | ^^^^ error: lifetimes cannot use keyword names --> $DIR/lifetime-no-keyword.rs:3:18 | -LL | fn baz<'let>(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names +LL | fn baz<'let>(a: &'let isize) { } | ^^^^ error: lifetimes cannot use keyword names --> $DIR/lifetime-no-keyword.rs:5:8 | -LL | fn zab<'self>(a: &'self isize) { } //~ ERROR lifetimes cannot use keyword names +LL | fn zab<'self>(a: &'self isize) { } | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/lifetime-no-keyword.rs:5:19 | -LL | fn zab<'self>(a: &'self isize) { } //~ ERROR lifetimes cannot use keyword names +LL | fn zab<'self>(a: &'self isize) { } | ^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/lint/command-line-lint-group-deny.stderr b/src/test/ui/lint/command-line-lint-group-deny.stderr index 3250a41ee0ec..04c3f6f26379 100644 --- a/src/test/ui/lint/command-line-lint-group-deny.stderr +++ b/src/test/ui/lint/command-line-lint-group-deny.stderr @@ -1,7 +1,7 @@ error: variable `_InappropriateCamelCasing` should have a snake case name --> $DIR/command-line-lint-group-deny.rs:4:9 | -LL | let _InappropriateCamelCasing = true; //~ ERROR should have a snake +LL | let _InappropriateCamelCasing = true; | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing` | = note: `-D non-snake-case` implied by `-D bad-style` diff --git a/src/test/ui/lint/command-line-lint-group-forbid.stderr b/src/test/ui/lint/command-line-lint-group-forbid.stderr index 39f6da400c49..736782140639 100644 --- a/src/test/ui/lint/command-line-lint-group-forbid.stderr +++ b/src/test/ui/lint/command-line-lint-group-forbid.stderr @@ -1,7 +1,7 @@ error: variable `_InappropriateCamelCasing` should have a snake case name --> $DIR/command-line-lint-group-forbid.rs:4:9 | -LL | let _InappropriateCamelCasing = true; //~ ERROR should have a snake +LL | let _InappropriateCamelCasing = true; | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing` | = note: `-F non-snake-case` implied by `-F bad-style` diff --git a/src/test/ui/lint/issue-54538-unused-parens-lint.stderr b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr index fd55ffbdf437..3cf321b072f4 100644 --- a/src/test/ui/lint/issue-54538-unused-parens-lint.stderr +++ b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr @@ -1,7 +1,7 @@ warning: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:9:9 | -LL | (_) => {} //~ WARNING: unnecessary parentheses around pattern +LL | (_) => {} | ^^^ help: remove these parentheses | note: lint level defined here @@ -13,30 +13,30 @@ LL | #![warn(unused_parens)] warning: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:10:9 | -LL | (y) => {} //~ WARNING: unnecessary parentheses around pattern +LL | (y) => {} | ^^^ help: remove these parentheses warning: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:11:9 | -LL | (ref r) => {} //~ WARNING: unnecessary parentheses around pattern +LL | (ref r) => {} | ^^^^^^^ help: remove these parentheses warning: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:12:9 | -LL | (e @ 1..=2) => {} //~ WARNING: unnecessary parentheses around outer pattern +LL | (e @ 1..=2) => {} | ^^^^^^^^^^^ help: remove these parentheses warning: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:18:9 | -LL | (e @ &(1...2)) => {} //~ WARNING: unnecessary parentheses around outer pattern +LL | (e @ &(1...2)) => {} | ^^^^^^^^^^^^^^ help: remove these parentheses warning: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:19:10 | -LL | &(_) => {} //~ WARNING: unnecessary parentheses around pattern +LL | &(_) => {} | ^^^ help: remove these parentheses diff --git a/src/test/ui/lint/lint-attr-non-item-node.stderr b/src/test/ui/lint/lint-attr-non-item-node.stderr index 2c95831f3759..6eb72c098df5 100644 --- a/src/test/ui/lint/lint-attr-non-item-node.stderr +++ b/src/test/ui/lint/lint-attr-non-item-node.stderr @@ -1,7 +1,7 @@ error: unreachable statement --> $DIR/lint-attr-non-item-node.rs:7:9 | -LL | "unreachable"; //~ ERROR unreachable statement +LL | "unreachable"; | ^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-change-warnings.stderr b/src/test/ui/lint/lint-change-warnings.stderr index 7d7a066613ac..c4b8ab5fc185 100644 --- a/src/test/ui/lint/lint-change-warnings.stderr +++ b/src/test/ui/lint/lint-change-warnings.stderr @@ -1,7 +1,7 @@ error: denote infinite loops with `loop { ... }` --> $DIR/lint-change-warnings.rs:5:5 | -LL | while true {} //~ ERROR: infinite +LL | while true {} | ^^^^^^^^^^ help: use `loop` | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![deny(warnings)] warning: denote infinite loops with `loop { ... }` --> $DIR/lint-change-warnings.rs:15:5 | -LL | while true {} //~ WARNING: infinite +LL | while true {} | ^^^^^^^^^^ help: use `loop` | = note: #[warn(while_true)] on by default @@ -22,7 +22,7 @@ LL | while true {} //~ WARNING: infinite error: denote infinite loops with `loop { ... }` --> $DIR/lint-change-warnings.rs:20:5 | -LL | while true {} //~ ERROR: infinite +LL | while true {} | ^^^^^^^^^^ help: use `loop` | note: lint level defined here diff --git a/src/test/ui/lint/lint-ctypes-enum.stderr b/src/test/ui/lint/lint-ctypes-enum.stderr index dd33cc77458d..92f76cfc38a7 100644 --- a/src/test/ui/lint/lint-ctypes-enum.stderr +++ b/src/test/ui/lint/lint-ctypes-enum.stderr @@ -1,7 +1,7 @@ error: `extern` block uses type `U` which is not FFI-safe: enum has no representation hint --> $DIR/lint-ctypes-enum.rs:20:13 | -LL | fn uf(x: U); //~ ERROR enum has no representation hint +LL | fn uf(x: U); | ^ | note: lint level defined here @@ -19,7 +19,7 @@ LL | enum U { A } error: `extern` block uses type `B` which is not FFI-safe: enum has no representation hint --> $DIR/lint-ctypes-enum.rs:21:13 | -LL | fn bf(x: B); //~ ERROR enum has no representation hint +LL | fn bf(x: B); | ^ | = help: consider adding a #[repr(...)] attribute to this enum @@ -32,7 +32,7 @@ LL | enum B { C, D } error: `extern` block uses type `T` which is not FFI-safe: enum has no representation hint --> $DIR/lint-ctypes-enum.rs:22:13 | -LL | fn tf(x: T); //~ ERROR enum has no representation hint +LL | fn tf(x: T); | ^ | = help: consider adding a #[repr(...)] attribute to this enum diff --git a/src/test/ui/lint/lint-ctypes.stderr b/src/test/ui/lint/lint-ctypes.stderr index 51211c876317..67ba30a81c50 100644 --- a/src/test/ui/lint/lint-ctypes.stderr +++ b/src/test/ui/lint/lint-ctypes.stderr @@ -1,7 +1,7 @@ error: `extern` block uses type `Foo` which is not FFI-safe: this struct has unspecified layout --> $DIR/lint-ctypes.rs:46:28 | -LL | pub fn ptr_type1(size: *const Foo); //~ ERROR: uses type `Foo` +LL | pub fn ptr_type1(size: *const Foo); | ^^^^^^^^^^ | note: lint level defined here @@ -19,7 +19,7 @@ LL | pub struct Foo; error: `extern` block uses type `Foo` which is not FFI-safe: this struct has unspecified layout --> $DIR/lint-ctypes.rs:47:28 | -LL | pub fn ptr_type2(size: *const Foo); //~ ERROR: uses type `Foo` +LL | pub fn ptr_type2(size: *const Foo); | ^^^^^^^^^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct @@ -32,7 +32,7 @@ LL | pub struct Foo; error: `extern` block uses type `[u32]` which is not FFI-safe: slices have no C equivalent --> $DIR/lint-ctypes.rs:48:26 | -LL | pub fn slice_type(p: &[u32]); //~ ERROR: uses type `[u32]` +LL | pub fn slice_type(p: &[u32]); | ^^^^^^ | = help: consider using a raw pointer instead @@ -40,7 +40,7 @@ LL | pub fn slice_type(p: &[u32]); //~ ERROR: uses type `[u32]` error: `extern` block uses type `str` which is not FFI-safe: string slices have no C equivalent --> $DIR/lint-ctypes.rs:49:24 | -LL | pub fn str_type(p: &str); //~ ERROR: uses type `str` +LL | pub fn str_type(p: &str); | ^^^^ | = help: consider using `*const u8` and a length instead @@ -48,7 +48,7 @@ LL | pub fn str_type(p: &str); //~ ERROR: uses type `str` error: `extern` block uses type `std::boxed::Box` which is not FFI-safe: this struct has unspecified layout --> $DIR/lint-ctypes.rs:50:24 | -LL | pub fn box_type(p: Box); //~ ERROR uses type `std::boxed::Box` +LL | pub fn box_type(p: Box); | ^^^^^^^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct @@ -56,7 +56,7 @@ LL | pub fn box_type(p: Box); //~ ERROR uses type `std::boxed::Box error: `extern` block uses type `char` which is not FFI-safe: the `char` type has no C equivalent --> $DIR/lint-ctypes.rs:51:25 | -LL | pub fn char_type(p: char); //~ ERROR uses type `char` +LL | pub fn char_type(p: char); | ^^^^ | = help: consider using `u32` or `libc::wchar_t` instead @@ -64,25 +64,25 @@ LL | pub fn char_type(p: char); //~ ERROR uses type `char` error: `extern` block uses type `i128` which is not FFI-safe: 128-bit integers don't currently have a known stable ABI --> $DIR/lint-ctypes.rs:52:25 | -LL | pub fn i128_type(p: i128); //~ ERROR uses type `i128` +LL | pub fn i128_type(p: i128); | ^^^^ error: `extern` block uses type `u128` which is not FFI-safe: 128-bit integers don't currently have a known stable ABI --> $DIR/lint-ctypes.rs:53:25 | -LL | pub fn u128_type(p: u128); //~ ERROR uses type `u128` +LL | pub fn u128_type(p: u128); | ^^^^ error: `extern` block uses type `dyn std::clone::Clone` which is not FFI-safe: trait objects have no C equivalent --> $DIR/lint-ctypes.rs:54:26 | -LL | pub fn trait_type(p: &Clone); //~ ERROR uses type `dyn std::clone::Clone` +LL | pub fn trait_type(p: &Clone); | ^^^^^^ error: `extern` block uses type `(i32, i32)` which is not FFI-safe: tuples have unspecified layout --> $DIR/lint-ctypes.rs:55:26 | -LL | pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)` +LL | pub fn tuple_type(p: (i32, i32)); | ^^^^^^^^^^ | = help: consider using a struct instead @@ -90,7 +90,7 @@ LL | pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)` error: `extern` block uses type `(i32, i32)` which is not FFI-safe: tuples have unspecified layout --> $DIR/lint-ctypes.rs:56:27 | -LL | pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)` +LL | pub fn tuple_type2(p: I32Pair); | ^^^^^^^ | = help: consider using a struct instead @@ -98,7 +98,7 @@ LL | pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)` error: `extern` block uses type `ZeroSize` which is not FFI-safe: this struct has no fields --> $DIR/lint-ctypes.rs:57:25 | -LL | pub fn zero_size(p: ZeroSize); //~ ERROR struct has no fields +LL | pub fn zero_size(p: ZeroSize); | ^^^^^^^^ | = help: consider adding a member to this struct @@ -111,19 +111,19 @@ LL | pub struct ZeroSize; error: `extern` block uses type `ZeroSizeWithPhantomData` which is not FFI-safe: composed only of PhantomData --> $DIR/lint-ctypes.rs:58:33 | -LL | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); //~ ERROR composed only of PhantomData +LL | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); | ^^^^^^^^^^^^^^^^^^^^^^^ error: `extern` block uses type `std::marker::PhantomData` which is not FFI-safe: composed only of PhantomData --> $DIR/lint-ctypes.rs:60:12 | -LL | -> ::std::marker::PhantomData; //~ ERROR: composed only of PhantomData +LL | -> ::std::marker::PhantomData; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `extern` block uses type `fn()` which is not FFI-safe: this function pointer has Rust-specific calling convention --> $DIR/lint-ctypes.rs:61:23 | -LL | pub fn fn_type(p: RustFn); //~ ERROR function pointer has Rust-specific +LL | pub fn fn_type(p: RustFn); | ^^^^^^ | = help: consider using an `extern fn(...) -> ...` function pointer instead @@ -131,7 +131,7 @@ LL | pub fn fn_type(p: RustFn); //~ ERROR function pointer has Rust-specific error: `extern` block uses type `fn()` which is not FFI-safe: this function pointer has Rust-specific calling convention --> $DIR/lint-ctypes.rs:62:24 | -LL | pub fn fn_type2(p: fn()); //~ ERROR function pointer has Rust-specific +LL | pub fn fn_type2(p: fn()); | ^^^^ | = help: consider using an `extern fn(...) -> ...` function pointer instead @@ -139,7 +139,7 @@ LL | pub fn fn_type2(p: fn()); //~ ERROR function pointer has Rust-specific error: `extern` block uses type `std::boxed::Box` which is not FFI-safe: this struct has unspecified layout --> $DIR/lint-ctypes.rs:63:28 | -LL | pub fn fn_contained(p: RustBadRet); //~ ERROR: uses type `std::boxed::Box` +LL | pub fn fn_contained(p: RustBadRet); | ^^^^^^^^^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct @@ -147,13 +147,13 @@ LL | pub fn fn_contained(p: RustBadRet); //~ ERROR: uses type `std::boxed::B error: `extern` block uses type `i128` which is not FFI-safe: 128-bit integers don't currently have a known stable ABI --> $DIR/lint-ctypes.rs:64:32 | -LL | pub fn transparent_i128(p: TransparentI128); //~ ERROR: uses type `i128` +LL | pub fn transparent_i128(p: TransparentI128); | ^^^^^^^^^^^^^^^ error: `extern` block uses type `str` which is not FFI-safe: string slices have no C equivalent --> $DIR/lint-ctypes.rs:65:31 | -LL | pub fn transparent_str(p: TransparentStr); //~ ERROR: uses type `str` +LL | pub fn transparent_str(p: TransparentStr); | ^^^^^^^^^^^^^^ | = help: consider using `*const u8` and a length instead @@ -161,7 +161,7 @@ LL | pub fn transparent_str(p: TransparentStr); //~ ERROR: uses type `str` error: `extern` block uses type `std::boxed::Box` which is not FFI-safe: this struct has unspecified layout --> $DIR/lint-ctypes.rs:66:30 | -LL | pub fn transparent_fn(p: TransparentBadFn); //~ ERROR: uses type `std::boxed::Box` +LL | pub fn transparent_fn(p: TransparentBadFn); | ^^^^^^^^^^^^^^^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct diff --git a/src/test/ui/lint/lint-dead-code-1.stderr b/src/test/ui/lint/lint-dead-code-1.stderr index 6d0295002f1c..be96c697d994 100644 --- a/src/test/ui/lint/lint-dead-code-1.stderr +++ b/src/test/ui/lint/lint-dead-code-1.stderr @@ -1,7 +1,7 @@ error: struct is never constructed: `Bar` --> $DIR/lint-dead-code-1.rs:12:5 | -LL | pub struct Bar; //~ ERROR: struct is never constructed +LL | pub struct Bar; | ^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,55 +13,55 @@ LL | #![deny(dead_code)] error: static item is never used: `priv_static` --> $DIR/lint-dead-code-1.rs:20:1 | -LL | static priv_static: isize = 0; //~ ERROR: static item is never used +LL | static priv_static: isize = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: constant item is never used: `priv_const` --> $DIR/lint-dead-code-1.rs:27:1 | -LL | const priv_const: isize = 0; //~ ERROR: constant item is never used +LL | const priv_const: isize = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: struct is never constructed: `PrivStruct` --> $DIR/lint-dead-code-1.rs:35:1 | -LL | struct PrivStruct; //~ ERROR: struct is never constructed +LL | struct PrivStruct; | ^^^^^^^^^^^^^^^^^^ error: enum is never used: `priv_enum` --> $DIR/lint-dead-code-1.rs:64:1 | -LL | enum priv_enum { foo2, bar2 } //~ ERROR: enum is never used +LL | enum priv_enum { foo2, bar2 } | ^^^^^^^^^^^^^^ error: variant is never constructed: `bar3` --> $DIR/lint-dead-code-1.rs:67:5 | -LL | bar3 //~ ERROR variant is never constructed +LL | bar3 | ^^^^ error: function is never used: `priv_fn` --> $DIR/lint-dead-code-1.rs:88:1 | -LL | fn priv_fn() { //~ ERROR: function is never used +LL | fn priv_fn() { | ^^^^^^^^^^^^ error: function is never used: `foo` --> $DIR/lint-dead-code-1.rs:93:1 | -LL | fn foo() { //~ ERROR: function is never used +LL | fn foo() { | ^^^^^^^^ error: function is never used: `bar` --> $DIR/lint-dead-code-1.rs:98:1 | -LL | fn bar() { //~ ERROR: function is never used +LL | fn bar() { | ^^^^^^^^ error: function is never used: `baz` --> $DIR/lint-dead-code-1.rs:102:1 | -LL | fn baz() -> impl Copy { //~ ERROR: function is never used +LL | fn baz() -> impl Copy { | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 10 previous errors diff --git a/src/test/ui/lint/lint-dead-code-2.stderr b/src/test/ui/lint/lint-dead-code-2.stderr index d17149104dba..1226f9823ac5 100644 --- a/src/test/ui/lint/lint-dead-code-2.stderr +++ b/src/test/ui/lint/lint-dead-code-2.stderr @@ -1,7 +1,7 @@ error: function is never used: `dead_fn` --> $DIR/lint-dead-code-2.rs:22:1 | -LL | fn dead_fn() {} //~ ERROR: function is never used +LL | fn dead_fn() {} | ^^^^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(dead_code)] error: function is never used: `dead_fn2` --> $DIR/lint-dead-code-2.rs:25:1 | -LL | fn dead_fn2() {} //~ ERROR: function is never used +LL | fn dead_fn2() {} | ^^^^^^^^^^^^^ error: function is never used: `main` --> $DIR/lint-dead-code-2.rs:38:1 | -LL | fn main() { //~ ERROR: function is never used +LL | fn main() { | ^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/lint-dead-code-3.stderr b/src/test/ui/lint/lint-dead-code-3.stderr index 72bcac22de8c..2408da0af89e 100644 --- a/src/test/ui/lint/lint-dead-code-3.stderr +++ b/src/test/ui/lint/lint-dead-code-3.stderr @@ -1,7 +1,7 @@ error: struct is never constructed: `Foo` --> $DIR/lint-dead-code-3.rs:13:1 | -LL | struct Foo; //~ ERROR: struct is never constructed +LL | struct Foo; | ^^^^^^^^^^^ | note: lint level defined here @@ -13,25 +13,25 @@ LL | #![deny(dead_code)] error: method is never used: `foo` --> $DIR/lint-dead-code-3.rs:15:5 | -LL | fn foo(&self) { //~ ERROR: method is never used +LL | fn foo(&self) { | ^^^^^^^^^^^^^ error: function is never used: `bar` --> $DIR/lint-dead-code-3.rs:20:1 | -LL | fn bar() { //~ ERROR: function is never used +LL | fn bar() { | ^^^^^^^^ error: enum is never used: `c_void` --> $DIR/lint-dead-code-3.rs:59:1 | -LL | enum c_void {} //~ ERROR: enum is never used +LL | enum c_void {} | ^^^^^^^^^^^ error: foreign function is never used: `free` --> $DIR/lint-dead-code-3.rs:61:5 | -LL | fn free(p: *const c_void); //~ ERROR: foreign function is never used +LL | fn free(p: *const c_void); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/lint/lint-dead-code-4.stderr b/src/test/ui/lint/lint-dead-code-4.stderr index 62de048d5e91..b7ceee99998d 100644 --- a/src/test/ui/lint/lint-dead-code-4.stderr +++ b/src/test/ui/lint/lint-dead-code-4.stderr @@ -1,7 +1,7 @@ error: field is never used: `b` --> $DIR/lint-dead-code-4.rs:7:5 | -LL | b: bool, //~ ERROR: field is never used +LL | b: bool, | ^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(dead_code)] error: variant is never constructed: `X` --> $DIR/lint-dead-code-4.rs:15:5 | -LL | X, //~ ERROR variant is never constructed +LL | X, | ^ error: variant is never constructed: `Y` --> $DIR/lint-dead-code-4.rs:16:5 | -LL | / Y { //~ ERROR variant is never constructed +LL | / Y { LL | | a: String, LL | | b: i32, LL | | c: i32, @@ -29,43 +29,43 @@ LL | | }, error: enum is never used: `ABC` --> $DIR/lint-dead-code-4.rs:24:1 | -LL | enum ABC { //~ ERROR enum is never used +LL | enum ABC { | ^^^^^^^^ error: variant is never constructed: `I` --> $DIR/lint-dead-code-4.rs:36:5 | -LL | I, //~ ERROR variant is never constructed +LL | I, | ^ error: field is never used: `b` --> $DIR/lint-dead-code-4.rs:39:9 | -LL | b: i32, //~ ERROR field is never used +LL | b: i32, | ^^^^^^ error: field is never used: `c` --> $DIR/lint-dead-code-4.rs:40:9 | -LL | c: i32, //~ ERROR field is never used +LL | c: i32, | ^^^^^^ error: variant is never constructed: `K` --> $DIR/lint-dead-code-4.rs:42:5 | -LL | K //~ ERROR variant is never constructed +LL | K | ^ error: field is never used: `x` --> $DIR/lint-dead-code-4.rs:61:5 | -LL | x: usize, //~ ERROR: field is never used +LL | x: usize, | ^^^^^^^^ error: field is never used: `c` --> $DIR/lint-dead-code-4.rs:63:5 | -LL | c: bool, //~ ERROR: field is never used +LL | c: bool, | ^^^^^^^ error: aborting due to 10 previous errors diff --git a/src/test/ui/lint/lint-dead-code-5.stderr b/src/test/ui/lint/lint-dead-code-5.stderr index e6c2354783a2..740cfde2c069 100644 --- a/src/test/ui/lint/lint-dead-code-5.stderr +++ b/src/test/ui/lint/lint-dead-code-5.stderr @@ -1,7 +1,7 @@ error: variant is never constructed: `Variant2` --> $DIR/lint-dead-code-5.rs:6:5 | -LL | Variant2 //~ ERROR: variant is never constructed +LL | Variant2 | ^^^^^^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![deny(dead_code)] error: variant is never constructed: `Variant5` --> $DIR/lint-dead-code-5.rs:13:5 | -LL | Variant5 { _x: isize }, //~ ERROR: variant is never constructed: `Variant5` +LL | Variant5 { _x: isize }, | ^^^^^^^^^^^^^^^^^^^^^^ error: variant is never constructed: `Variant6` --> $DIR/lint-dead-code-5.rs:14:5 | -LL | Variant6(isize), //~ ERROR: variant is never constructed: `Variant6` +LL | Variant6(isize), | ^^^^^^^^^^^^^^^ error: enum is never used: `Enum3` --> $DIR/lint-dead-code-5.rs:18:1 | -LL | enum Enum3 { //~ ERROR: enum is never used +LL | enum Enum3 { | ^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/lint/lint-dead-code-type-alias.stderr b/src/test/ui/lint/lint-dead-code-type-alias.stderr index a4d4727be7ca..4198ddfb6cb0 100644 --- a/src/test/ui/lint/lint-dead-code-type-alias.stderr +++ b/src/test/ui/lint/lint-dead-code-type-alias.stderr @@ -1,7 +1,7 @@ error: type alias is never used: `Unused` --> $DIR/lint-dead-code-type-alias.rs:4:1 | -LL | type Unused = u8; //~ ERROR type alias is never used +LL | type Unused = u8; | ^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-dead-code-variant.stderr b/src/test/ui/lint/lint-dead-code-variant.stderr index b9465e73b0d7..a79432dc68d6 100644 --- a/src/test/ui/lint/lint-dead-code-variant.stderr +++ b/src/test/ui/lint/lint-dead-code-variant.stderr @@ -1,7 +1,7 @@ error: variant is never constructed: `Variant1` --> $DIR/lint-dead-code-variant.rs:5:5 | -LL | Variant1, //~ ERROR: variant is never constructed +LL | Variant1, | ^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr index 170b98a12a84..020591ccff74 100644 --- a/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr +++ b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr @@ -1,7 +1,7 @@ error: unused import: `a::x` --> $DIR/lint-directives-on-use-items-issue-10534.rs:12:9 | -LL | use a::x; //~ ERROR: unused import +LL | use a::x; | ^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_imports)] error: unused import: `a::y` --> $DIR/lint-directives-on-use-items-issue-10534.rs:21:9 | -LL | use a::y; //~ ERROR: unused import +LL | use a::y; | ^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.stderr index be739eb41bd3..f9f168c14dee 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.stderr @@ -1,7 +1,7 @@ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:7:15 | -LL | let n = 1u8 << 8; //~ ERROR: attempt to shift left with overflow +LL | let n = 1u8 << 8; | ^^^^^^^^ | note: lint level defined here @@ -13,103 +13,103 @@ LL | #![deny(exceeding_bitshifts, const_err)] error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:9:15 | -LL | let n = 1u16 << 16; //~ ERROR: attempt to shift left with overflow +LL | let n = 1u16 << 16; | ^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:11:15 | -LL | let n = 1u32 << 32; //~ ERROR: attempt to shift left with overflow +LL | let n = 1u32 << 32; | ^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:13:15 | -LL | let n = 1u64 << 64; //~ ERROR: attempt to shift left with overflow +LL | let n = 1u64 << 64; | ^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:15:15 | -LL | let n = 1i8 << 8; //~ ERROR: attempt to shift left with overflow +LL | let n = 1i8 << 8; | ^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:17:15 | -LL | let n = 1i16 << 16; //~ ERROR: attempt to shift left with overflow +LL | let n = 1i16 << 16; | ^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:19:15 | -LL | let n = 1i32 << 32; //~ ERROR: attempt to shift left with overflow +LL | let n = 1i32 << 32; | ^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:21:15 | -LL | let n = 1i64 << 64; //~ ERROR: attempt to shift left with overflow +LL | let n = 1i64 << 64; | ^^^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:24:15 | -LL | let n = 1u8 >> 8; //~ ERROR: attempt to shift right with overflow +LL | let n = 1u8 >> 8; | ^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:26:15 | -LL | let n = 1u16 >> 16; //~ ERROR: attempt to shift right with overflow +LL | let n = 1u16 >> 16; | ^^^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:28:15 | -LL | let n = 1u32 >> 32; //~ ERROR: attempt to shift right with overflow +LL | let n = 1u32 >> 32; | ^^^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:30:15 | -LL | let n = 1u64 >> 64; //~ ERROR: attempt to shift right with overflow +LL | let n = 1u64 >> 64; | ^^^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:32:15 | -LL | let n = 1i8 >> 8; //~ ERROR: attempt to shift right with overflow +LL | let n = 1i8 >> 8; | ^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:34:15 | -LL | let n = 1i16 >> 16; //~ ERROR: attempt to shift right with overflow +LL | let n = 1i16 >> 16; | ^^^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:36:15 | -LL | let n = 1i32 >> 32; //~ ERROR: attempt to shift right with overflow +LL | let n = 1i32 >> 32; | ^^^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:38:15 | -LL | let n = 1i64 >> 64; //~ ERROR: attempt to shift right with overflow +LL | let n = 1i64 >> 64; | ^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:42:15 | -LL | let n = n << 8; //~ ERROR: attempt to shift left with overflow +LL | let n = n << 8; | ^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:44:15 | -LL | let n = 1u8 << -8; //~ ERROR: attempt to shift left with overflow +LL | let n = 1u8 << -8; | ^^^^^^^^^ error: aborting due to 18 previous errors diff --git a/src/test/ui/lint/lint-exceeding-bitshifts2.stderr b/src/test/ui/lint/lint-exceeding-bitshifts2.stderr index 0adcde02acb7..8a6d2a89c706 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts2.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts2.stderr @@ -1,7 +1,7 @@ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts2.rs:7:15 | -LL | let n = 1u8 << (4+4); //~ ERROR: attempt to shift left with overflow +LL | let n = 1u8 << (4+4); | ^^^^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(exceeding_bitshifts, const_err)] error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts2.rs:15:15 | -LL | let n = 1_isize << BITS; //~ ERROR: attempt to shift left with overflow +LL | let n = 1_isize << BITS; | ^^^^^^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts2.rs:16:15 | -LL | let n = 1_usize << BITS; //~ ERROR: attempt to shift left with overflow +LL | let n = 1_usize << BITS; | ^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/lint-forbid-cmdline.stderr b/src/test/ui/lint/lint-forbid-cmdline.stderr index 35539f0e8777..bece4775abb9 100644 --- a/src/test/ui/lint/lint-forbid-cmdline.stderr +++ b/src/test/ui/lint/lint-forbid-cmdline.stderr @@ -1,7 +1,7 @@ error[E0453]: allow(deprecated) overruled by outer forbid(deprecated) --> $DIR/lint-forbid-cmdline.rs:3:9 | -LL | #[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated) +LL | #[allow(deprecated)] | ^^^^^^^^^^ overruled by previous forbid | = note: `forbid` lint level was set on command line diff --git a/src/test/ui/lint/lint-group-nonstandard-style.stderr b/src/test/ui/lint/lint-group-nonstandard-style.stderr index ab36cda57ec8..a365204f12ad 100644 --- a/src/test/ui/lint/lint-group-nonstandard-style.stderr +++ b/src/test/ui/lint/lint-group-nonstandard-style.stderr @@ -1,7 +1,7 @@ warning: type `snake_case` should have an upper camel case name --> $DIR/lint-group-nonstandard-style.rs:22:16 | -LL | struct snake_case; //~ WARN should have an upper camel +LL | struct snake_case; | ^^^^^^^^^^ help: convert the identifier to upper camel case: `SnakeCase` | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![warn(nonstandard_style)] error: function `CamelCase` should have a snake case name --> $DIR/lint-group-nonstandard-style.rs:4:4 | -LL | fn CamelCase() {} //~ ERROR should have a snake +LL | fn CamelCase() {} | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` | note: lint level defined here @@ -27,7 +27,7 @@ LL | #![deny(nonstandard_style)] error: function `CamelCase` should have a snake case name --> $DIR/lint-group-nonstandard-style.rs:12:12 | -LL | fn CamelCase() {} //~ ERROR should have a snake +LL | fn CamelCase() {} | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` | note: lint level defined here @@ -40,7 +40,7 @@ LL | #[forbid(nonstandard_style)] error: static variable `bad` should have an upper case name --> $DIR/lint-group-nonstandard-style.rs:14:16 | -LL | static bad: isize = 1; //~ ERROR should have an upper +LL | static bad: isize = 1; | ^^^ help: convert the identifier to upper case: `BAD` | note: lint level defined here @@ -53,7 +53,7 @@ LL | #[forbid(nonstandard_style)] warning: function `CamelCase` should have a snake case name --> $DIR/lint-group-nonstandard-style.rs:20:12 | -LL | fn CamelCase() {} //~ WARN should have a snake +LL | fn CamelCase() {} | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` | note: lint level defined here diff --git a/src/test/ui/lint/lint-impl-fn.stderr b/src/test/ui/lint/lint-impl-fn.stderr index b0a3f6197843..2c9a264287c9 100644 --- a/src/test/ui/lint/lint-impl-fn.stderr +++ b/src/test/ui/lint/lint-impl-fn.stderr @@ -1,7 +1,7 @@ error: denote infinite loops with `loop { ... }` --> $DIR/lint-impl-fn.rs:10:21 | -LL | fn bar(&self) { while true {} } //~ ERROR: infinite loops +LL | fn bar(&self) { while true {} } | ^^^^^^^^^^ help: use `loop` | note: lint level defined here @@ -13,7 +13,7 @@ LL | #[deny(while_true)] error: denote infinite loops with `loop { ... }` --> $DIR/lint-impl-fn.rs:18:25 | -LL | fn foo(&self) { while true {} } //~ ERROR: infinite loops +LL | fn foo(&self) { while true {} } | ^^^^^^^^^^ help: use `loop` | note: lint level defined here @@ -25,7 +25,7 @@ LL | #[deny(while_true)] error: denote infinite loops with `loop { ... }` --> $DIR/lint-impl-fn.rs:27:5 | -LL | while true {} //~ ERROR: infinite loops +LL | while true {} | ^^^^^^^^^^ help: use `loop` | note: lint level defined here diff --git a/src/test/ui/lint/lint-malformed.stderr b/src/test/ui/lint/lint-malformed.stderr index 98a7cecc2bb2..f5b9e2b0a0f6 100644 --- a/src/test/ui/lint/lint-malformed.stderr +++ b/src/test/ui/lint/lint-malformed.stderr @@ -1,13 +1,13 @@ error[E0452]: malformed lint attribute --> $DIR/lint-malformed.rs:2:10 | -LL | #![allow(bar = "baz")] //~ ERROR malformed lint attribute +LL | #![allow(bar = "baz")] | ^^^^^^^^^^^ error: attribute must be of the form `#[deny(lint1, lint2, ..., /*opt*/ reason = "...")]` --> $DIR/lint-malformed.rs:1:1 | -LL | #![deny = "foo"] //~ ERROR attribute must be of the form +LL | #![deny = "foo"] | ^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/lint-misplaced-attr.stderr b/src/test/ui/lint/lint-misplaced-attr.stderr index 2a28d54619c6..1419f858f8e7 100644 --- a/src/test/ui/lint/lint-misplaced-attr.stderr +++ b/src/test/ui/lint/lint-misplaced-attr.stderr @@ -1,7 +1,7 @@ error: unused attribute --> $DIR/lint-misplaced-attr.rs:7:5 | -LL | #![crate_type = "bin"] //~ ERROR unused attribute +LL | #![crate_type = "bin"] | ^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![deny(unused_attributes)] error: crate-level attribute should be in the root module --> $DIR/lint-misplaced-attr.rs:7:5 | -LL | #![crate_type = "bin"] //~ ERROR unused attribute +LL | #![crate_type = "bin"] | ^^^^^^^^^^^^^^^^^^^^^^ error: unused attribute --> $DIR/lint-misplaced-attr.rs:11:1 | -LL | #[crate_type = "bin"] fn main() {} //~ ERROR unused attribute +LL | #[crate_type = "bin"] fn main() {} | ^^^^^^^^^^^^^^^^^^^^^ error: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] --> $DIR/lint-misplaced-attr.rs:11:1 | -LL | #[crate_type = "bin"] fn main() {} //~ ERROR unused attribute +LL | #[crate_type = "bin"] fn main() {} | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/lint/lint-missing-copy-implementations.stderr b/src/test/ui/lint/lint-missing-copy-implementations.stderr index 30da3ac879ea..7b6674e71bf1 100644 --- a/src/test/ui/lint/lint-missing-copy-implementations.stderr +++ b/src/test/ui/lint/lint-missing-copy-implementations.stderr @@ -1,7 +1,7 @@ error: type could implement `Copy`; consider adding `impl Copy` --> $DIR/lint-missing-copy-implementations.rs:6:5 | -LL | / pub struct Foo { //~ ERROR type could implement `Copy`; consider adding `impl Copy` +LL | / pub struct Foo { LL | | pub field: i32 LL | | } | |_____^ diff --git a/src/test/ui/lint/lint-missing-doc.stderr b/src/test/ui/lint/lint-missing-doc.stderr index ea5a14bca7cf..3532c9315d8d 100644 --- a/src/test/ui/lint/lint-missing-doc.stderr +++ b/src/test/ui/lint/lint-missing-doc.stderr @@ -1,7 +1,7 @@ error: missing documentation for a type alias --> $DIR/lint-missing-doc.rs:11:1 | -LL | pub type PubTypedef = String; //~ ERROR: missing documentation for a type alias +LL | pub type PubTypedef = String; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,109 +13,109 @@ LL | #![deny(missing_docs)] error: missing documentation for a struct --> $DIR/lint-missing-doc.rs:18:1 | -LL | pub struct PubFoo { //~ ERROR: missing documentation for a struct +LL | pub struct PubFoo { | ^^^^^^^^^^^^^^^^^ error: missing documentation for a struct field --> $DIR/lint-missing-doc.rs:19:5 | -LL | pub a: isize, //~ ERROR: missing documentation for a struct field +LL | pub a: isize, | ^^^^^^^^^^^^ error: missing documentation for a module --> $DIR/lint-missing-doc.rs:30:1 | -LL | pub mod pub_module_no_dox {} //~ ERROR: missing documentation for a module +LL | pub mod pub_module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function --> $DIR/lint-missing-doc.rs:34:1 | -LL | pub fn foo2() {} //~ ERROR: missing documentation for a function +LL | pub fn foo2() {} | ^^^^^^^^^^^^^ error: missing documentation for a trait --> $DIR/lint-missing-doc.rs:52:1 | -LL | pub trait C { //~ ERROR: missing documentation for a trait +LL | pub trait C { | ^^^^^^^^^^^ error: missing documentation for a trait method --> $DIR/lint-missing-doc.rs:53:5 | -LL | fn foo(&self); //~ ERROR: missing documentation for a trait method +LL | fn foo(&self); | ^^^^^^^^^^^^^^ error: missing documentation for a trait method --> $DIR/lint-missing-doc.rs:54:5 | -LL | fn foo_with_impl(&self) {} //~ ERROR: missing documentation for a trait method +LL | fn foo_with_impl(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated type --> $DIR/lint-missing-doc.rs:64:5 | -LL | type AssociatedType; //~ ERROR: missing documentation for an associated type +LL | type AssociatedType; | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated type --> $DIR/lint-missing-doc.rs:65:5 | -LL | type AssociatedTypeDef = Self; //~ ERROR: missing documentation for an associated type +LL | type AssociatedTypeDef = Self; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a method --> $DIR/lint-missing-doc.rs:81:5 | -LL | pub fn foo() {} //~ ERROR: missing documentation for a method +LL | pub fn foo() {} | ^^^^^^^^^^^^ error: missing documentation for an enum --> $DIR/lint-missing-doc.rs:118:1 | -LL | pub enum PubBaz { //~ ERROR: missing documentation for an enum +LL | pub enum PubBaz { | ^^^^^^^^^^^^^^^ error: missing documentation for a variant --> $DIR/lint-missing-doc.rs:119:5 | -LL | PubBazA { //~ ERROR: missing documentation for a variant +LL | PubBazA { | ^^^^^^^ error: missing documentation for a struct field --> $DIR/lint-missing-doc.rs:120:9 | -LL | a: isize, //~ ERROR: missing documentation for a struct field +LL | a: isize, | ^^^^^^^^ error: missing documentation for a constant --> $DIR/lint-missing-doc.rs:151:1 | -LL | pub const FOO4: u32 = 0; //~ ERROR: missing documentation for a const +LL | pub const FOO4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static --> $DIR/lint-missing-doc.rs:161:1 | -LL | pub static BAR4: u32 = 0; //~ ERROR: missing documentation for a static +LL | pub static BAR4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function --> $DIR/lint-missing-doc.rs:167:5 | -LL | pub fn undocumented1() {} //~ ERROR: missing documentation for a function +LL | pub fn undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function --> $DIR/lint-missing-doc.rs:168:5 | -LL | pub fn undocumented2() {} //~ ERROR: missing documentation for a function +LL | pub fn undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function --> $DIR/lint-missing-doc.rs:174:9 | -LL | pub fn also_undocumented1() {} //~ ERROR: missing documentation for a function +LL | pub fn also_undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 19 previous errors diff --git a/src/test/ui/lint/lint-non-camel-case-types.stderr b/src/test/ui/lint/lint-non-camel-case-types.stderr index 7afacf64d877..432a16debc69 100644 --- a/src/test/ui/lint/lint-non-camel-case-types.stderr +++ b/src/test/ui/lint/lint-non-camel-case-types.stderr @@ -13,43 +13,43 @@ LL | #![forbid(non_camel_case_types)] error: type `foo` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:7:8 | -LL | struct foo { //~ ERROR type `foo` should have an upper camel case name +LL | struct foo { | ^^^ help: convert the identifier to upper camel case: `Foo` error: type `foo2` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:11:6 | -LL | enum foo2 { //~ ERROR type `foo2` should have an upper camel case name +LL | enum foo2 { | ^^^^ help: convert the identifier to upper camel case: `Foo2` error: type `foo3` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:15:8 | -LL | struct foo3 { //~ ERROR type `foo3` should have an upper camel case name +LL | struct foo3 { | ^^^^ help: convert the identifier to upper camel case: `Foo3` error: type `foo4` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:19:6 | -LL | type foo4 = isize; //~ ERROR type `foo4` should have an upper camel case name +LL | type foo4 = isize; | ^^^^ help: convert the identifier to upper camel case: `Foo4` error: variant `bar` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:22:5 | -LL | bar //~ ERROR variant `bar` should have an upper camel case name +LL | bar | ^^^ help: convert the identifier to upper camel case: `Bar` error: trait `foo6` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:25:7 | -LL | trait foo6 { //~ ERROR trait `foo6` should have an upper camel case name +LL | trait foo6 { | ^^^^ help: convert the identifier to upper camel case: `Foo6` error: type parameter `ty` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:29:6 | -LL | fn f(_: ty) {} //~ ERROR type parameter `ty` should have an upper camel case name +LL | fn f(_: ty) {} | ^^ help: convert the identifier to upper camel case: `Ty` error: aborting due to 8 previous errors diff --git a/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr b/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr index 970666ebcfdc..d638626495ac 100644 --- a/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr +++ b/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr @@ -1,7 +1,7 @@ error: lifetime `'FooBar` should have a snake case name --> $DIR/lint-non-snake-case-lifetimes.rs:4:6 | -LL | fn f<'FooBar>( //~ ERROR lifetime `'FooBar` should have a snake case name +LL | fn f<'FooBar>( | ^^^^^^^ help: convert the identifier to snake case: `'foo_bar` | note: lint level defined here diff --git a/src/test/ui/lint/lint-non-snake-case-modules.stderr b/src/test/ui/lint/lint-non-snake-case-modules.stderr index 651132e49d91..847c43e1b04e 100644 --- a/src/test/ui/lint/lint-non-snake-case-modules.stderr +++ b/src/test/ui/lint/lint-non-snake-case-modules.stderr @@ -1,7 +1,7 @@ error: module `FooBar` should have a snake case name --> $DIR/lint-non-snake-case-modules.rs:4:5 | -LL | mod FooBar { //~ ERROR module `FooBar` should have a snake case name +LL | mod FooBar { | ^^^^^^ help: convert the identifier to snake case: `foo_bar` | note: lint level defined here diff --git a/src/test/ui/lint/lint-non-uppercase-statics.stderr b/src/test/ui/lint/lint-non-uppercase-statics.stderr index f5bba5f145de..8b477276efc9 100644 --- a/src/test/ui/lint/lint-non-uppercase-statics.stderr +++ b/src/test/ui/lint/lint-non-uppercase-statics.stderr @@ -1,7 +1,7 @@ error: static variable `foo` should have an upper case name --> $DIR/lint-non-uppercase-statics.rs:4:8 | -LL | static foo: isize = 1; //~ ERROR static variable `foo` should have an upper case name +LL | static foo: isize = 1; | ^^^ help: convert the identifier to upper case: `FOO` | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![forbid(non_upper_case_globals)] error: static variable `bar` should have an upper case name --> $DIR/lint-non-uppercase-statics.rs:6:12 | -LL | static mut bar: isize = 1; //~ ERROR static variable `bar` should have an upper case name +LL | static mut bar: isize = 1; | ^^^ help: convert the identifier to upper case: `BAR` error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/lint-obsolete-attr.stderr b/src/test/ui/lint/lint-obsolete-attr.stderr index c71bde54acfb..c06bd26df2b9 100644 --- a/src/test/ui/lint/lint-obsolete-attr.stderr +++ b/src/test/ui/lint/lint-obsolete-attr.stderr @@ -1,7 +1,7 @@ error: unused attribute --> $DIR/lint-obsolete-attr.rs:8:1 | -LL | #[ab_isize="stdcall"] extern {} //~ ERROR unused attribute +LL | #[ab_isize="stdcall"] extern {} | ^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_attributes)] error: unused attribute --> $DIR/lint-obsolete-attr.rs:10:1 | -LL | #[fixed_stack_segment] fn f() {} //~ ERROR unused attribute +LL | #[fixed_stack_segment] fn f() {} | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/lint-output-format.stderr b/src/test/ui/lint/lint-output-format.stderr index 4dcd8c231643..21b12301e2c7 100644 --- a/src/test/ui/lint/lint-output-format.stderr +++ b/src/test/ui/lint/lint-output-format.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-output-format.rs:6:1 | -LL | extern crate lint_output_format; //~ ERROR use of unstable library feature +LL | extern crate lint_output_format; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | extern crate lint_output_format; //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-output-format.rs:7:31 | -LL | use lint_output_format::{foo, bar}; //~ ERROR use of unstable library feature +LL | use lint_output_format::{foo, bar}; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | use lint_output_format::{foo, bar}; //~ ERROR use of unstable library featu error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-output-format.rs:11:14 | -LL | let _y = bar(); //~ ERROR use of unstable library feature +LL | let _y = bar(); | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable diff --git a/src/test/ui/lint/lint-owned-heap-memory.stderr b/src/test/ui/lint/lint-owned-heap-memory.stderr index 572b82b3366b..c61b3d31558c 100644 --- a/src/test/ui/lint/lint-owned-heap-memory.stderr +++ b/src/test/ui/lint/lint-owned-heap-memory.stderr @@ -1,7 +1,7 @@ error: type uses owned (Box type) pointers: std::boxed::Box --> $DIR/lint-owned-heap-memory.rs:6:5 | -LL | x: Box //~ ERROR type uses owned +LL | x: Box | ^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-qualification.stderr b/src/test/ui/lint/lint-qualification.stderr index 953ff0f5f652..78f7e32a30cd 100644 --- a/src/test/ui/lint/lint-qualification.stderr +++ b/src/test/ui/lint/lint-qualification.stderr @@ -1,7 +1,7 @@ error: unnecessary qualification --> $DIR/lint-qualification.rs:9:5 | -LL | foo::bar(); //~ ERROR: unnecessary qualification +LL | foo::bar(); | ^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-removed-allow.stderr b/src/test/ui/lint/lint-removed-allow.stderr index f796a14d6379..32af7389b6c7 100644 --- a/src/test/ui/lint/lint-removed-allow.stderr +++ b/src/test/ui/lint/lint-removed-allow.stderr @@ -1,7 +1,7 @@ error: unused variable: `unused` --> $DIR/lint-removed-allow.rs:8:17 | -LL | fn main() { let unused = (); } //~ ERROR unused +LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here diff --git a/src/test/ui/lint/lint-removed.stderr b/src/test/ui/lint/lint-removed.stderr index 55f010348fe1..cde494f22f09 100644 --- a/src/test/ui/lint/lint-removed.stderr +++ b/src/test/ui/lint/lint-removed.stderr @@ -1,7 +1,7 @@ warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok` --> $DIR/lint-removed.rs:6:8 | -LL | #[deny(raw_pointer_derive)] //~ WARN `raw_pointer_derive` has been removed +LL | #[deny(raw_pointer_derive)] | ^^^^^^^^^^^^^^^^^^ | = note: #[warn(renamed_and_removed_lints)] on by default @@ -9,7 +9,7 @@ LL | #[deny(raw_pointer_derive)] //~ WARN `raw_pointer_derive` has been removed error: unused variable: `unused` --> $DIR/lint-removed.rs:8:17 | -LL | fn main() { let unused = (); } //~ ERROR unused +LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here diff --git a/src/test/ui/lint/lint-renamed-allow.stderr b/src/test/ui/lint/lint-renamed-allow.stderr index b2eeeae8f8e6..383a800b54a8 100644 --- a/src/test/ui/lint/lint-renamed-allow.stderr +++ b/src/test/ui/lint/lint-renamed-allow.stderr @@ -1,7 +1,7 @@ error: unused variable: `unused` --> $DIR/lint-renamed-allow.rs:8:17 | -LL | fn main() { let unused = (); } //~ ERROR unused +LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here diff --git a/src/test/ui/lint/lint-renamed.stderr b/src/test/ui/lint/lint-renamed.stderr index b140a93ab38b..2174b22ffb9d 100644 --- a/src/test/ui/lint/lint-renamed.stderr +++ b/src/test/ui/lint/lint-renamed.stderr @@ -9,7 +9,7 @@ LL | #[deny(bare_trait_object)] error: unused variable: `unused` --> $DIR/lint-renamed.rs:4:17 | -LL | fn main() { let unused = (); } //~ ERROR unused +LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here diff --git a/src/test/ui/lint/lint-shorthand-field.stderr b/src/test/ui/lint/lint-shorthand-field.stderr index 32c69fdddcbf..366ab55d7d4d 100644 --- a/src/test/ui/lint/lint-shorthand-field.stderr +++ b/src/test/ui/lint/lint-shorthand-field.stderr @@ -1,7 +1,7 @@ error: the `x:` in this pattern is redundant --> $DIR/lint-shorthand-field.rs:12:13 | -LL | x: x, //~ ERROR the `x:` in this pattern is redundant +LL | x: x, | --^^ | | | help: remove this @@ -15,7 +15,7 @@ LL | #![deny(non_shorthand_field_patterns)] error: the `y:` in this pattern is redundant --> $DIR/lint-shorthand-field.rs:13:13 | -LL | y: ref y, //~ ERROR the `y:` in this pattern is redundant +LL | y: ref y, | --^^^^^^ | | | help: remove this diff --git a/src/test/ui/lint/lint-stability-2.stderr b/src/test/ui/lint/lint-stability-2.stderr index 4142ce5af793..808c16c95a49 100644 --- a/src/test/ui/lint/lint-stability-2.stderr +++ b/src/test/ui/lint/lint-stability-2.stderr @@ -81,7 +81,7 @@ LL | ::trait_deprecated_unstable_text(&foo); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:62:13 | -LL | foo.method_unstable(); //~ ERROR use of unstable library feature +LL | foo.method_unstable(); | ^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -89,7 +89,7 @@ LL | foo.method_unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:63:9 | -LL | Foo::method_unstable(&foo); //~ ERROR use of unstable library feature +LL | Foo::method_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -97,7 +97,7 @@ LL | Foo::method_unstable(&foo); //~ ERROR use of unstable library featu error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:64:9 | -LL | ::method_unstable(&foo); //~ ERROR use of unstable library feature +LL | ::method_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -105,7 +105,7 @@ LL | ::method_unstable(&foo); //~ ERROR use of unstable library fea error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:65:13 | -LL | foo.trait_unstable(); //~ ERROR use of unstable library feature +LL | foo.trait_unstable(); | ^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -113,7 +113,7 @@ LL | foo.trait_unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:66:9 | -LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feature +LL | ::trait_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -193,7 +193,7 @@ LL | ::trait_deprecated_unstable_text(&foo); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:139:13 | -LL | foo.trait_unstable(); //~ ERROR use of unstable library feature +LL | foo.trait_unstable(); | ^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -201,7 +201,7 @@ LL | foo.trait_unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:140:9 | -LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feature +LL | ::trait_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -241,7 +241,7 @@ LL | foo.trait_deprecated_unstable_text(); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:158:13 | -LL | foo.trait_unstable(); //~ ERROR use of unstable library feature +LL | foo.trait_unstable(); | ^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable diff --git a/src/test/ui/lint/lint-stability-deprecated.stderr b/src/test/ui/lint/lint-stability-deprecated.stderr index a1748ac59fb4..811004ee12cc 100644 --- a/src/test/ui/lint/lint-stability-deprecated.stderr +++ b/src/test/ui/lint/lint-stability-deprecated.stderr @@ -1,7 +1,7 @@ warning: use of deprecated item 'lint_stability::deprecated': text --> $DIR/lint-stability-deprecated.rs:26:9 | -LL | deprecated(); //~ WARN use of deprecated item 'lint_stability::deprecated' +LL | deprecated(); | ^^^^^^^^^^ | note: lint level defined here @@ -13,73 +13,73 @@ LL | #![warn(deprecated)] warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:31:9 | -LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:33:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_text': text --> $DIR/lint-stability-deprecated.rs:35:9 | -LL | deprecated_text(); //~ WARN use of deprecated item 'lint_stability::deprecated_text': text +LL | deprecated_text(); | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:40:9 | -LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:42:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:44:9 | -LL | deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::deprecated_unstable' +LL | deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:49:9 | -LL | Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | Trait::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:51:9 | -LL | ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | ::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:53:9 | -LL | deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::deprecated_unstable_text': text +LL | deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:58:9 | -LL | Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | Trait::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:60:9 | -LL | ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | ::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedStruct': text --> $DIR/lint-stability-deprecated.rs:107:17 | -LL | let _ = DeprecatedStruct { //~ WARN use of deprecated item 'lint_stability::DeprecatedStruct' +LL | let _ = DeprecatedStruct { | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedUnstableStruct': text @@ -91,157 +91,157 @@ LL | let _ = DeprecatedUnstableStruct { warning: use of deprecated item 'lint_stability::DeprecatedUnitStruct': text --> $DIR/lint-stability-deprecated.rs:117:17 | -LL | let _ = DeprecatedUnitStruct; //~ WARN use of deprecated item 'lint_stability::DeprecatedUnitStruct' +LL | let _ = DeprecatedUnitStruct; | ^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedUnstableUnitStruct': text --> $DIR/lint-stability-deprecated.rs:118:17 | -LL | let _ = DeprecatedUnstableUnitStruct; //~ WARN use of deprecated item 'lint_stability::DeprecatedUnstableUnitStruct' +LL | let _ = DeprecatedUnstableUnitStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Enum::DeprecatedVariant': text --> $DIR/lint-stability-deprecated.rs:122:17 | -LL | let _ = Enum::DeprecatedVariant; //~ WARN use of deprecated item 'lint_stability::Enum::DeprecatedVariant' +LL | let _ = Enum::DeprecatedVariant; | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Enum::DeprecatedUnstableVariant': text --> $DIR/lint-stability-deprecated.rs:123:17 | -LL | let _ = Enum::DeprecatedUnstableVariant; //~ WARN use of deprecated item 'lint_stability::Enum::DeprecatedUnstableVariant' +LL | let _ = Enum::DeprecatedUnstableVariant; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedTupleStruct': text --> $DIR/lint-stability-deprecated.rs:127:17 | -LL | let _ = DeprecatedTupleStruct (1); //~ WARN use of deprecated item 'lint_stability::DeprecatedTupleStruct' +LL | let _ = DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedUnstableTupleStruct': text --> $DIR/lint-stability-deprecated.rs:128:17 | -LL | let _ = DeprecatedUnstableTupleStruct (1); //~ WARN use of deprecated item 'lint_stability::DeprecatedUnstableTupleStruct' +LL | let _ = DeprecatedUnstableTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_text': text --> $DIR/lint-stability-deprecated.rs:137:25 | -LL | macro_test_arg!(deprecated_text()); //~ WARN use of deprecated item 'lint_stability::deprecated_text': text +LL | macro_test_arg!(deprecated_text()); | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:138:25 | -LL | macro_test_arg!(deprecated_unstable_text()); //~ WARN use of deprecated item 'lint_stability::deprecated_unstable_text': text +LL | macro_test_arg!(deprecated_unstable_text()); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_text': text --> $DIR/lint-stability-deprecated.rs:139:41 | -LL | macro_test_arg!(macro_test_arg!(deprecated_text())); //~ WARN use of deprecated item 'lint_stability::deprecated_text': text +LL | macro_test_arg!(macro_test_arg!(deprecated_text())); | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:144:9 | -LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:146:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:148:9 | -LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:150:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:152:9 | -LL | Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | Trait::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:154:9 | -LL | ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | ::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:156:9 | -LL | Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | Trait::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:158:9 | -LL | ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | ::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedTrait': text --> $DIR/lint-stability-deprecated.rs:186:10 | -LL | impl DeprecatedTrait for S {} //~ WARN use of deprecated item 'lint_stability::DeprecatedTrait': text +LL | impl DeprecatedTrait for S {} | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedTrait': text --> $DIR/lint-stability-deprecated.rs:188:25 | -LL | trait LocalTrait2 : DeprecatedTrait { } //~ WARN use of deprecated item 'lint_stability::DeprecatedTrait': text +LL | trait LocalTrait2 : DeprecatedTrait { } | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'inheritance::inherited_stability::unstable_mod::deprecated': text --> $DIR/lint-stability-deprecated.rs:207:9 | -LL | unstable_mod::deprecated(); //~ WARN use of deprecated item 'inheritance::inherited_stability::unstable_mod::deprecated': text +LL | unstable_mod::deprecated(); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::deprecated': text --> $DIR/lint-stability-deprecated.rs:329:9 | -LL | deprecated(); //~ WARN use of deprecated item 'this_crate::deprecated' +LL | deprecated(); | ^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:334:9 | -LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:336:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::deprecated_text': text --> $DIR/lint-stability-deprecated.rs:338:9 | -LL | deprecated_text(); //~ WARN use of deprecated item 'this_crate::deprecated_text': text +LL | deprecated_text(); | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:343:9 | -LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:345:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedStruct': text @@ -253,67 +253,67 @@ LL | let _ = DeprecatedStruct { warning: use of deprecated item 'this_crate::DeprecatedUnitStruct': text --> $DIR/lint-stability-deprecated.rs:390:17 | -LL | let _ = DeprecatedUnitStruct; //~ WARN use of deprecated item 'this_crate::DeprecatedUnitStruct' +LL | let _ = DeprecatedUnitStruct; | ^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Enum::DeprecatedVariant': text --> $DIR/lint-stability-deprecated.rs:394:17 | -LL | let _ = Enum::DeprecatedVariant; //~ WARN use of deprecated item 'this_crate::Enum::DeprecatedVariant' +LL | let _ = Enum::DeprecatedVariant; | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedTupleStruct': text --> $DIR/lint-stability-deprecated.rs:398:17 | -LL | let _ = DeprecatedTupleStruct (1); //~ WARN use of deprecated item 'this_crate::DeprecatedTupleStruct' +LL | let _ = DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:405:9 | -LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:407:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:409:9 | -LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:411:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::test_fn_body::fn_in_body': text --> $DIR/lint-stability-deprecated.rs:438:9 | -LL | fn_in_body(); //~ WARN use of deprecated item 'this_crate::test_fn_body::fn_in_body': text +LL | fn_in_body(); | ^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedTrait': text --> $DIR/lint-stability-deprecated.rs:458:10 | -LL | impl DeprecatedTrait for S { } //~ WARN use of deprecated item 'this_crate::DeprecatedTrait' +LL | impl DeprecatedTrait for S { } | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedTrait': text --> $DIR/lint-stability-deprecated.rs:460:24 | -LL | trait LocalTrait : DeprecatedTrait { } //~ WARN use of deprecated item 'this_crate::DeprecatedTrait' +LL | trait LocalTrait : DeprecatedTrait { } | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::test_method_body::fn_in_body': text --> $DIR/lint-stability-deprecated.rs:446:13 | -LL | fn_in_body(); //~ WARN use of deprecated item 'this_crate::MethodTester::test_method_body::fn_in_body': text +LL | fn_in_body(); | ^^^^^^^^^^ warning: use of deprecated item 'lint_stability::TraitWithAssociatedTypes::TypeDeprecated': text @@ -331,306 +331,306 @@ LL | TypeDeprecated = u16, warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated': text --> $DIR/lint-stability-deprecated.rs:27:13 | -LL | foo.method_deprecated(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated' +LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated': text --> $DIR/lint-stability-deprecated.rs:28:9 | -LL | Foo::method_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated' +LL | Foo::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated': text --> $DIR/lint-stability-deprecated.rs:29:9 | -LL | ::method_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated' +LL | ::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:30:13 | -LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:32:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:36:13 | -LL | foo.method_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text +LL | foo.method_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:37:9 | -LL | Foo::method_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text +LL | Foo::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:38:9 | -LL | ::method_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text +LL | ::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:39:13 | -LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:41:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:45:13 | -LL | foo.method_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable' +LL | foo.method_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:46:9 | -LL | Foo::method_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable' +LL | Foo::method_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:47:9 | -LL | ::method_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable' +LL | ::method_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:48:13 | -LL | foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:50:9 | -LL | ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | ::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:54:13 | -LL | foo.method_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text +LL | foo.method_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:55:9 | -LL | Foo::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text +LL | Foo::method_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:56:9 | -LL | ::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text +LL | ::method_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:57:13 | -LL | foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:59:9 | -LL | ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | ::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedStruct::i': text --> $DIR/lint-stability-deprecated.rs:108:13 | -LL | i: 0 //~ WARN use of deprecated item 'lint_stability::DeprecatedStruct::i' +LL | i: 0 | ^^^^ warning: use of deprecated item 'lint_stability::DeprecatedUnstableStruct::i': text --> $DIR/lint-stability-deprecated.rs:112:13 | -LL | i: 0 //~ WARN use of deprecated item 'lint_stability::DeprecatedUnstableStruct::i' +LL | i: 0 | ^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:143:13 | -LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:145:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:147:13 | -LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:149:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:151:13 | -LL | foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:153:9 | -LL | ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | ::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:155:13 | -LL | foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:157:9 | -LL | ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | ::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:174:13 | -LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:175:13 | -LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:176:13 | -LL | foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:177:13 | -LL | foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated': text --> $DIR/lint-stability-deprecated.rs:330:13 | -LL | foo.method_deprecated(); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated' +LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated': text --> $DIR/lint-stability-deprecated.rs:331:9 | -LL | Foo::method_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated' +LL | Foo::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated': text --> $DIR/lint-stability-deprecated.rs:332:9 | -LL | ::method_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated' +LL | ::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:333:13 | -LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:335:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:339:13 | -LL | foo.method_deprecated_text(); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text +LL | foo.method_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:340:9 | -LL | Foo::method_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text +LL | Foo::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:341:9 | -LL | ::method_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text +LL | ::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:342:13 | -LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:344:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedStruct::i': text --> $DIR/lint-stability-deprecated.rs:385:13 | -LL | i: 0 //~ WARN use of deprecated item 'this_crate::DeprecatedStruct::i' +LL | i: 0 | ^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:404:13 | -LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:406:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:408:13 | -LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:410:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:427:13 | -LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:428:13 | -LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-stability-fields.stderr b/src/test/ui/lint/lint-stability-fields.stderr index 93f8075b2b27..e80e745922de 100644 --- a/src/test/ui/lint/lint-stability-fields.stderr +++ b/src/test/ui/lint/lint-stability-fields.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:51:17 | -LL | let x = Unstable { //~ ERROR use of unstable +LL | let x = Unstable { | ^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | let x = Unstable { //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:61:13 | -LL | let Unstable { //~ ERROR use of unstable +LL | let Unstable { | ^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | let Unstable { //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:67:13 | -LL | let Unstable //~ ERROR use of unstable +LL | let Unstable | ^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | let Unstable //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:72:17 | -LL | let x = reexport::Unstable2(1, 2, 3); //~ ERROR use of unstable +LL | let x = reexport::Unstable2(1, 2, 3); | ^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | let x = reexport::Unstable2(1, 2, 3); //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:74:17 | -LL | let x = Unstable2(1, 2, 3); //~ ERROR use of unstable +LL | let x = Unstable2(1, 2, 3); | ^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -41,7 +41,7 @@ LL | let x = Unstable2(1, 2, 3); //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:80:13 | -LL | let Unstable2 //~ ERROR use of unstable +LL | let Unstable2 | ^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -49,7 +49,7 @@ LL | let Unstable2 //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:85:13 | -LL | let Unstable2 //~ ERROR use of unstable +LL | let Unstable2 | ^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -57,7 +57,7 @@ LL | let Unstable2 //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:90:17 | -LL | let x = Deprecated { //~ ERROR use of unstable +LL | let x = Deprecated { | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -65,7 +65,7 @@ LL | let x = Deprecated { //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:100:13 | -LL | let Deprecated { //~ ERROR use of unstable +LL | let Deprecated { | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -73,7 +73,7 @@ LL | let Deprecated { //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:106:13 | -LL | let Deprecated //~ ERROR use of unstable +LL | let Deprecated | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -81,7 +81,7 @@ LL | let Deprecated //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:110:17 | -LL | let x = Deprecated2(1, 2, 3); //~ ERROR use of unstable +LL | let x = Deprecated2(1, 2, 3); | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -89,7 +89,7 @@ LL | let x = Deprecated2(1, 2, 3); //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:116:13 | -LL | let Deprecated2 //~ ERROR use of unstable +LL | let Deprecated2 | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -97,7 +97,7 @@ LL | let Deprecated2 //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:121:13 | -LL | let Deprecated2 //~ ERROR use of unstable +LL | let Deprecated2 | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -105,7 +105,7 @@ LL | let Deprecated2 //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:21:13 | -LL | override1: 2, //~ ERROR use of unstable +LL | override1: 2, | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -113,7 +113,7 @@ LL | override1: 2, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:22:13 | -LL | override2: 3, //~ ERROR use of unstable +LL | override2: 3, | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -121,7 +121,7 @@ LL | override2: 3, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:26:17 | -LL | let _ = x.override1; //~ ERROR use of unstable +LL | let _ = x.override1; | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -129,7 +129,7 @@ LL | let _ = x.override1; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:27:17 | -LL | let _ = x.override2; //~ ERROR use of unstable +LL | let _ = x.override2; | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -137,7 +137,7 @@ LL | let _ = x.override2; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:31:13 | -LL | override1: _, //~ ERROR use of unstable +LL | override1: _, | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -145,7 +145,7 @@ LL | override1: _, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:32:13 | -LL | override2: _ //~ ERROR use of unstable +LL | override2: _ | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -153,7 +153,7 @@ LL | override2: _ //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:40:17 | -LL | let _ = x.1; //~ ERROR use of unstable +LL | let _ = x.1; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -161,7 +161,7 @@ LL | let _ = x.1; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:41:17 | -LL | let _ = x.2; //~ ERROR use of unstable +LL | let _ = x.2; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -169,7 +169,7 @@ LL | let _ = x.2; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:44:20 | -LL | _, //~ ERROR use of unstable +LL | _, | ^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -177,7 +177,7 @@ LL | _, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:45:20 | -LL | _) //~ ERROR use of unstable +LL | _) | ^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -185,7 +185,7 @@ LL | _) //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:52:13 | -LL | inherit: 1, //~ ERROR use of unstable +LL | inherit: 1, | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -193,7 +193,7 @@ LL | inherit: 1, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:54:13 | -LL | override2: 3, //~ ERROR use of unstable +LL | override2: 3, | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -201,7 +201,7 @@ LL | override2: 3, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:57:17 | -LL | let _ = x.inherit; //~ ERROR use of unstable +LL | let _ = x.inherit; | ^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -209,7 +209,7 @@ LL | let _ = x.inherit; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:59:17 | -LL | let _ = x.override2; //~ ERROR use of unstable +LL | let _ = x.override2; | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -217,7 +217,7 @@ LL | let _ = x.override2; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:62:13 | -LL | inherit: _, //~ ERROR use of unstable +LL | inherit: _, | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -225,7 +225,7 @@ LL | inherit: _, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:64:13 | -LL | override2: _ //~ ERROR use of unstable +LL | override2: _ | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -233,7 +233,7 @@ LL | override2: _ //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:76:17 | -LL | let _ = x.0; //~ ERROR use of unstable +LL | let _ = x.0; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -241,7 +241,7 @@ LL | let _ = x.0; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:78:17 | -LL | let _ = x.2; //~ ERROR use of unstable +LL | let _ = x.2; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -249,7 +249,7 @@ LL | let _ = x.2; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:81:14 | -LL | (_, //~ ERROR use of unstable +LL | (_, | ^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -257,7 +257,7 @@ LL | (_, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:83:14 | -LL | _) //~ ERROR use of unstable +LL | _) | ^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -265,7 +265,7 @@ LL | _) //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:91:13 | -LL | inherit: 1, //~ ERROR use of unstable +LL | inherit: 1, | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -273,7 +273,7 @@ LL | inherit: 1, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:93:13 | -LL | override2: 3, //~ ERROR use of unstable +LL | override2: 3, | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -281,7 +281,7 @@ LL | override2: 3, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:96:17 | -LL | let _ = x.inherit; //~ ERROR use of unstable +LL | let _ = x.inherit; | ^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -289,7 +289,7 @@ LL | let _ = x.inherit; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:98:17 | -LL | let _ = x.override2; //~ ERROR use of unstable +LL | let _ = x.override2; | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -297,7 +297,7 @@ LL | let _ = x.override2; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:101:13 | -LL | inherit: _, //~ ERROR use of unstable +LL | inherit: _, | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -305,7 +305,7 @@ LL | inherit: _, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:103:13 | -LL | override2: _ //~ ERROR use of unstable +LL | override2: _ | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -313,7 +313,7 @@ LL | override2: _ //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:112:17 | -LL | let _ = x.0; //~ ERROR use of unstable +LL | let _ = x.0; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -321,7 +321,7 @@ LL | let _ = x.0; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:114:17 | -LL | let _ = x.2; //~ ERROR use of unstable +LL | let _ = x.2; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -329,7 +329,7 @@ LL | let _ = x.2; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:117:14 | -LL | (_, //~ ERROR use of unstable +LL | (_, | ^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -337,7 +337,7 @@ LL | (_, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:119:14 | -LL | _) //~ ERROR use of unstable +LL | _) | ^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable diff --git a/src/test/ui/lint/lint-stability.stderr b/src/test/ui/lint/lint-stability.stderr index 03c42e59c679..dd7f7182530b 100644 --- a/src/test/ui/lint/lint-stability.stderr +++ b/src/test/ui/lint/lint-stability.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:17:5 | -LL | extern crate stability_cfg2; //~ ERROR use of unstable library feature +LL | extern crate stability_cfg2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -57,7 +57,7 @@ LL | ::trait_deprecated_unstable_text(&foo); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:59:9 | -LL | unstable(); //~ ERROR use of unstable library feature +LL | unstable(); | ^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -65,7 +65,7 @@ LL | unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:60:9 | -LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature +LL | Trait::trait_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -73,7 +73,7 @@ LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feat error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:61:9 | -LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feature +LL | ::trait_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -113,7 +113,7 @@ LL | let _ = DeprecatedUnstableStruct { error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:103:17 | -LL | let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable library feature +LL | let _ = UnstableStruct { i: 0 }; | ^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -129,7 +129,7 @@ LL | let _ = DeprecatedUnstableUnitStruct; error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:109:17 | -LL | let _ = UnstableUnitStruct; //~ ERROR use of unstable library feature +LL | let _ = UnstableUnitStruct; | ^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -145,7 +145,7 @@ LL | let _ = Enum::DeprecatedUnstableVariant; error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:115:17 | -LL | let _ = Enum::UnstableVariant; //~ ERROR use of unstable library feature +LL | let _ = Enum::UnstableVariant; | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -161,7 +161,7 @@ LL | let _ = DeprecatedUnstableTupleStruct (1); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:121:17 | -LL | let _ = UnstableTupleStruct (1); //~ ERROR use of unstable library feature +LL | let _ = UnstableTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -209,7 +209,7 @@ LL | ::trait_deprecated_unstable_text(&foo); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:152:9 | -LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature +LL | Trait::trait_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -217,7 +217,7 @@ LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feat error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:153:9 | -LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feature +LL | ::trait_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -241,7 +241,7 @@ LL | ::trait_unstable_text(&foo); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:172:10 | -LL | impl UnstableTrait for S { } //~ ERROR use of unstable library feature +LL | impl UnstableTrait for S { } | ^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -249,7 +249,7 @@ LL | impl UnstableTrait for S { } //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:174:24 | -LL | trait LocalTrait : UnstableTrait { } //~ ERROR use of unstable library feature +LL | trait LocalTrait : UnstableTrait { } | ^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -257,7 +257,7 @@ LL | trait LocalTrait : UnstableTrait { } //~ ERROR use of unstable library error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:179:9 | -LL | fn trait_unstable(&self) {} //~ ERROR use of unstable library feature +LL | fn trait_unstable(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -265,7 +265,7 @@ LL | fn trait_unstable(&self) {} //~ ERROR use of unstable library featu error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:184:5 | -LL | extern crate inherited_stability; //~ ERROR use of unstable library feature +LL | extern crate inherited_stability; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -273,7 +273,7 @@ LL | extern crate inherited_stability; //~ ERROR use of unstable library fea error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:185:9 | -LL | use self::inherited_stability::*; //~ ERROR use of unstable library feature +LL | use self::inherited_stability::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -281,7 +281,7 @@ LL | use self::inherited_stability::*; //~ ERROR use of unstable library fea error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:188:9 | -LL | unstable(); //~ ERROR use of unstable library feature +LL | unstable(); | ^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -289,7 +289,7 @@ LL | unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:191:9 | -LL | stable_mod::unstable(); //~ ERROR use of unstable library feature +LL | stable_mod::unstable(); | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -297,7 +297,7 @@ LL | stable_mod::unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:195:9 | -LL | unstable_mod::unstable(); //~ ERROR use of unstable library feature +LL | unstable_mod::unstable(); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -305,7 +305,7 @@ LL | unstable_mod::unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:197:17 | -LL | let _ = Unstable::UnstableVariant; //~ ERROR use of unstable library feature +LL | let _ = Unstable::UnstableVariant; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -321,7 +321,7 @@ LL | struct S1(T::TypeUnstable); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:92:13 | -LL | TypeUnstable = u8, //~ ERROR use of unstable library feature +LL | TypeUnstable = u8, | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable diff --git a/src/test/ui/lint/lint-type-limits.stderr b/src/test/ui/lint/lint-type-limits.stderr index 14ef953d294e..71a2b3bfda8c 100644 --- a/src/test/ui/lint/lint-type-limits.stderr +++ b/src/test/ui/lint/lint-type-limits.stderr @@ -1,7 +1,7 @@ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:8:11 | -LL | while i >= 0 { //~ ERROR comparison is useless due to type limits +LL | while i >= 0 { | ^^^^^^ | = note: requested on the command line with `-D unused-comparisons` @@ -9,49 +9,49 @@ LL | while i >= 0 { //~ ERROR comparison is useless due to type limits error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:19:13 | -LL | let _ = u > 255; //~ ERROR comparison is useless due to type limits +LL | let _ = u > 255; | ^^^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:20:13 | -LL | let _ = 255 < u; //~ ERROR comparison is useless due to type limits +LL | let _ = 255 < u; | ^^^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:21:13 | -LL | let _ = u < 0; //~ ERROR comparison is useless due to type limits +LL | let _ = u < 0; | ^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:22:13 | -LL | let _ = 0 > u; //~ ERROR comparison is useless due to type limits +LL | let _ = 0 > u; | ^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:23:13 | -LL | let _ = u <= 255; //~ ERROR comparison is useless due to type limits +LL | let _ = u <= 255; | ^^^^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:24:13 | -LL | let _ = 255 >= u; //~ ERROR comparison is useless due to type limits +LL | let _ = 255 >= u; | ^^^^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:25:13 | -LL | let _ = u >= 0; //~ ERROR comparison is useless due to type limits +LL | let _ = u >= 0; | ^^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:26:13 | -LL | let _ = 0 <= u; //~ ERROR comparison is useless due to type limits +LL | let _ = 0 <= u; | ^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/lint/lint-type-limits2.stderr b/src/test/ui/lint/lint-type-limits2.stderr index f88fff62e21f..e7bc407422a1 100644 --- a/src/test/ui/lint/lint-type-limits2.stderr +++ b/src/test/ui/lint/lint-type-limits2.stderr @@ -1,7 +1,7 @@ error: comparison is useless due to type limits --> $DIR/lint-type-limits2.rs:13:5 | -LL | 128 > bar() //~ ERROR comparison is useless due to type limits +LL | 128 > bar() | ^^^^^^^^^^^ | = note: requested on the command line with `-D unused-comparisons` @@ -9,7 +9,7 @@ LL | 128 > bar() //~ ERROR comparison is useless due to type limits warning: literal out of range for i8 --> $DIR/lint-type-limits2.rs:13:5 | -LL | 128 > bar() //~ ERROR comparison is useless due to type limits +LL | 128 > bar() | ^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-type-limits3.stderr b/src/test/ui/lint/lint-type-limits3.stderr index 4f47a7ce3166..742b6695c24f 100644 --- a/src/test/ui/lint/lint-type-limits3.stderr +++ b/src/test/ui/lint/lint-type-limits3.stderr @@ -1,7 +1,7 @@ error: comparison is useless due to type limits --> $DIR/lint-type-limits3.rs:9:11 | -LL | while 200 != i { //~ ERROR comparison is useless due to type limits +LL | while 200 != i { | ^^^^^^^^ | = note: requested on the command line with `-D unused-comparisons` @@ -9,7 +9,7 @@ LL | while 200 != i { //~ ERROR comparison is useless due to type limits warning: literal out of range for i8 --> $DIR/lint-type-limits3.rs:9:11 | -LL | while 200 != i { //~ ERROR comparison is useless due to type limits +LL | while 200 != i { | ^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-type-overflow.stderr b/src/test/ui/lint/lint-type-overflow.stderr index 987ee8a640c9..9da007457aa8 100644 --- a/src/test/ui/lint/lint-type-overflow.stderr +++ b/src/test/ui/lint/lint-type-overflow.stderr @@ -1,7 +1,7 @@ error: literal out of range for u8 --> $DIR/lint-type-overflow.rs:12:18 | -LL | let x1: u8 = 256; //~ error: literal out of range for u8 +LL | let x1: u8 = 256; | ^^^ | note: lint level defined here @@ -13,103 +13,103 @@ LL | #![deny(overflowing_literals)] error: literal out of range for u8 --> $DIR/lint-type-overflow.rs:15:14 | -LL | let x1 = 256_u8; //~ error: literal out of range for u8 +LL | let x1 = 256_u8; | ^^^^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:18:18 | -LL | let x1: i8 = 128; //~ error: literal out of range for i8 +LL | let x1: i8 = 128; | ^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:20:19 | -LL | let x3: i8 = -129; //~ error: literal out of range for i8 +LL | let x3: i8 = -129; | ^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:21:19 | -LL | let x3: i8 = -(129); //~ error: literal out of range for i8 +LL | let x3: i8 = -(129); | ^^^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:22:20 | -LL | let x3: i8 = -{129}; //~ error: literal out of range for i8 +LL | let x3: i8 = -{129}; | ^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:24:10 | -LL | test(1000); //~ error: literal out of range for i8 +LL | test(1000); | ^^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:26:13 | -LL | let x = 128_i8; //~ error: literal out of range for i8 +LL | let x = 128_i8; | ^^^^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:30:14 | -LL | let x = -129_i8; //~ error: literal out of range for i8 +LL | let x = -129_i8; | ^^^^^^ error: literal out of range for i32 --> $DIR/lint-type-overflow.rs:34:18 | -LL | let x: i32 = 2147483648; //~ error: literal out of range for i32 +LL | let x: i32 = 2147483648; | ^^^^^^^^^^ error: literal out of range for i32 --> $DIR/lint-type-overflow.rs:35:13 | -LL | let x = 2147483648_i32; //~ error: literal out of range for i32 +LL | let x = 2147483648_i32; | ^^^^^^^^^^^^^^ error: literal out of range for i32 --> $DIR/lint-type-overflow.rs:38:19 | -LL | let x: i32 = -2147483649; //~ error: literal out of range for i32 +LL | let x: i32 = -2147483649; | ^^^^^^^^^^ error: literal out of range for i32 --> $DIR/lint-type-overflow.rs:39:14 | -LL | let x = -2147483649_i32; //~ error: literal out of range for i32 +LL | let x = -2147483649_i32; | ^^^^^^^^^^^^^^ error: literal out of range for i32 --> $DIR/lint-type-overflow.rs:40:13 | -LL | let x = 2147483648; //~ error: literal out of range for i32 +LL | let x = 2147483648; | ^^^^^^^^^^ error: literal out of range for i64 --> $DIR/lint-type-overflow.rs:42:13 | -LL | let x = 9223372036854775808_i64; //~ error: literal out of range for i64 +LL | let x = 9223372036854775808_i64; | ^^^^^^^^^^^^^^^^^^^^^^^ error: literal out of range for i64 --> $DIR/lint-type-overflow.rs:44:13 | -LL | let x = 18446744073709551615_i64; //~ error: literal out of range for i64 +LL | let x = 18446744073709551615_i64; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: literal out of range for i64 --> $DIR/lint-type-overflow.rs:45:19 | -LL | let x: i64 = -9223372036854775809; //~ error: literal out of range for i64 +LL | let x: i64 = -9223372036854775809; | ^^^^^^^^^^^^^^^^^^^ error: literal out of range for i64 --> $DIR/lint-type-overflow.rs:46:14 | -LL | let x = -9223372036854775809_i64; //~ error: literal out of range for i64 +LL | let x = -9223372036854775809_i64; | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 18 previous errors diff --git a/src/test/ui/lint/lint-type-overflow2.stderr b/src/test/ui/lint/lint-type-overflow2.stderr index 5f63ce49680b..5255f6c75934 100644 --- a/src/test/ui/lint/lint-type-overflow2.stderr +++ b/src/test/ui/lint/lint-type-overflow2.stderr @@ -1,7 +1,7 @@ warning: literal out of range for i8 --> $DIR/lint-type-overflow2.rs:9:20 | -LL | let x2: i8 = --128; //~ warn: literal out of range for i8 +LL | let x2: i8 = --128; | ^^^ | note: lint level defined here @@ -13,31 +13,31 @@ LL | #![warn(overflowing_literals)] warning: literal out of range for f32 --> $DIR/lint-type-overflow2.rs:11:14 | -LL | let x = -3.40282357e+38_f32; //~ warn: literal out of range for f32 +LL | let x = -3.40282357e+38_f32; | ^^^^^^^^^^^^^^^^^^ warning: literal out of range for f32 --> $DIR/lint-type-overflow2.rs:12:14 | -LL | let x = 3.40282357e+38_f32; //~ warn: literal out of range for f32 +LL | let x = 3.40282357e+38_f32; | ^^^^^^^^^^^^^^^^^^ warning: literal out of range for f64 --> $DIR/lint-type-overflow2.rs:13:14 | -LL | let x = -1.7976931348623159e+308_f64; //~ warn: literal out of range for f64 +LL | let x = -1.7976931348623159e+308_f64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: literal out of range for f64 --> $DIR/lint-type-overflow2.rs:14:14 | -LL | let x = 1.7976931348623159e+308_f64; //~ warn: literal out of range for f64 +LL | let x = 1.7976931348623159e+308_f64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: this expression will panic at runtime --> $DIR/lint-type-overflow2.rs:9:18 | -LL | let x2: i8 = --128; //~ warn: literal out of range for i8 +LL | let x2: i8 = --128; | ^^^^^ attempt to negate with overflow | note: lint level defined here diff --git a/src/test/ui/lint/lint-unconditional-recursion.stderr b/src/test/ui/lint/lint-unconditional-recursion.stderr index 50daa537591b..5d2e8201b142 100644 --- a/src/test/ui/lint/lint-unconditional-recursion.stderr +++ b/src/test/ui/lint/lint-unconditional-recursion.stderr @@ -1,7 +1,7 @@ error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:4:1 | -LL | fn foo() { //~ ERROR function cannot return without recursing +LL | fn foo() { | ^^^^^^^^ cannot return without recursing LL | foo(); | ----- recursive call site @@ -16,7 +16,7 @@ LL | #![deny(unconditional_recursion)] error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:14:1 | -LL | fn baz() { //~ ERROR function cannot return without recursing +LL | fn baz() { | ^^^^^^^^ cannot return without recursing LL | if true { LL | baz() @@ -30,7 +30,7 @@ LL | baz() error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:26:1 | -LL | fn quz() -> bool { //~ ERROR function cannot return without recursing +LL | fn quz() -> bool { | ^^^^^^^^^^^^^^^^ cannot return without recursing LL | if true { LL | while quz() {} @@ -44,7 +44,7 @@ LL | loop { quz(); } error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:37:5 | -LL | fn bar(&self) { //~ ERROR function cannot return without recursing +LL | fn bar(&self) { | ^^^^^^^^^^^^^ cannot return without recursing LL | self.bar() | ---------- recursive call site @@ -54,7 +54,7 @@ LL | self.bar() error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:43:5 | -LL | fn bar(&self) { //~ ERROR function cannot return without recursing +LL | fn bar(&self) { | ^^^^^^^^^^^^^ cannot return without recursing LL | loop { LL | self.bar() @@ -65,7 +65,7 @@ LL | self.bar() error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:52:5 | -LL | fn bar(&self) { //~ ERROR function cannot return without recursing +LL | fn bar(&self) { | ^^^^^^^^^^^^^ cannot return without recursing LL | 0.bar() | ------- recursive call site @@ -75,7 +75,7 @@ LL | 0.bar() error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:65:5 | -LL | fn bar(&self) { //~ ERROR function cannot return without recursing +LL | fn bar(&self) { | ^^^^^^^^^^^^^ cannot return without recursing LL | Foo2::bar(self) | --------------- recursive call site @@ -85,7 +85,7 @@ LL | Foo2::bar(self) error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:71:5 | -LL | fn bar(&self) { //~ ERROR function cannot return without recursing +LL | fn bar(&self) { | ^^^^^^^^^^^^^ cannot return without recursing LL | loop { LL | Foo2::bar(self) @@ -96,7 +96,7 @@ LL | Foo2::bar(self) error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:81:5 | -LL | fn qux(&self) { //~ ERROR function cannot return without recursing +LL | fn qux(&self) { | ^^^^^^^^^^^^^ cannot return without recursing LL | self.qux(); | ---------- recursive call site @@ -106,7 +106,7 @@ LL | self.qux(); error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:86:5 | -LL | fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recursing +LL | fn as_ref(&self) -> &Self { | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing LL | Baz::as_ref(self) | ----------------- recursive call site @@ -116,7 +116,7 @@ LL | Baz::as_ref(self) error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:93:5 | -LL | fn default() -> Baz { //~ ERROR function cannot return without recursing +LL | fn default() -> Baz { | ^^^^^^^^^^^^^^^^^^^ cannot return without recursing LL | let x = Default::default(); | ------------------ recursive call site @@ -126,7 +126,7 @@ LL | let x = Default::default(); error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:102:5 | -LL | fn deref(&self) -> &() { //~ ERROR function cannot return without recursing +LL | fn deref(&self) -> &() { | ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing LL | &**self | ------ recursive call site @@ -136,7 +136,7 @@ LL | &**self error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:109:5 | -LL | fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recursing +LL | fn index(&self, x: usize) -> &Baz { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing LL | &self[x] | ------- recursive call site @@ -146,7 +146,7 @@ LL | &self[x] error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:118:5 | -LL | fn deref(&self) -> &Baz { //~ ERROR function cannot return without recursing +LL | fn deref(&self) -> &Baz { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing LL | self.as_ref() | ---- recursive call site diff --git a/src/test/ui/lint/lint-unexported-no-mangle.stderr b/src/test/ui/lint/lint-unexported-no-mangle.stderr index f6a1087635af..586ee8ed411c 100644 --- a/src/test/ui/lint/lint-unexported-no-mangle.stderr +++ b/src/test/ui/lint/lint-unexported-no-mangle.stderr @@ -9,7 +9,7 @@ warning: lint `private_no_mangle_statics` has been removed: `no longer a warning error: const items should never be #[no_mangle] --> $DIR/lint-unexported-no-mangle.rs:9:1 | -LL | const FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle] +LL | const FOO: u64 = 1; | -----^^^^^^^^^^^^^^ | | | help: try a static value: `pub static` @@ -19,7 +19,7 @@ LL | const FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle] error: const items should never be #[no_mangle] --> $DIR/lint-unexported-no-mangle.rs:12:1 | -LL | pub const PUB_FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle] +LL | pub const PUB_FOO: u64 = 1; | ---------^^^^^^^^^^^^^^^^^^ | | | help: try a static value: `pub static` diff --git a/src/test/ui/lint/lint-unknown-attr.stderr b/src/test/ui/lint/lint-unknown-attr.stderr index 435b03b1f658..9817760c2247 100644 --- a/src/test/ui/lint/lint-unknown-attr.stderr +++ b/src/test/ui/lint/lint-unknown-attr.stderr @@ -1,7 +1,7 @@ error: unused attribute --> $DIR/lint-unknown-attr.rs:9:1 | -LL | #[dance] mod a {} //~ ERROR unused attribute +LL | #[dance] mod a {} | ^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unused_attributes)] error: unused attribute --> $DIR/lint-unknown-attr.rs:11:1 | -LL | #[dance] fn main() {} //~ ERROR unused attribute +LL | #[dance] fn main() {} | ^^^^^^^^ error: unused attribute --> $DIR/lint-unknown-attr.rs:7:1 | -LL | #![mutable_doc] //~ ERROR unused attribute +LL | #![mutable_doc] | ^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/lint-unknown-lint.stderr b/src/test/ui/lint/lint-unknown-lint.stderr index 976c88c11d0c..b3ba6e31bc1e 100644 --- a/src/test/ui/lint/lint-unknown-lint.stderr +++ b/src/test/ui/lint/lint-unknown-lint.stderr @@ -1,7 +1,7 @@ error: unknown lint: `not_a_real_lint` --> $DIR/lint-unknown-lint.rs:3:10 | -LL | #![allow(not_a_real_lint)] //~ ERROR unknown lint +LL | #![allow(not_a_real_lint)] | ^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unknown_lints)] error: unknown lint: `dead_cod` --> $DIR/lint-unknown-lint.rs:5:9 | -LL | #![deny(dead_cod)] //~ ERROR unknown lint +LL | #![deny(dead_cod)] | ^^^^^^^^ help: did you mean: `dead_code` error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/lint-unnecessary-import-braces.stderr b/src/test/ui/lint/lint-unnecessary-import-braces.stderr index 40e7ab4dd139..41e274bc5450 100644 --- a/src/test/ui/lint/lint-unnecessary-import-braces.stderr +++ b/src/test/ui/lint/lint-unnecessary-import-braces.stderr @@ -1,7 +1,7 @@ error: braces around A is unnecessary --> $DIR/lint-unnecessary-import-braces.rs:3:1 | -LL | use test::{A}; //~ ERROR braces around A is unnecessary +LL | use test::{A}; | ^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-unnecessary-parens.stderr b/src/test/ui/lint/lint-unnecessary-parens.stderr index c14ebb6be976..fe2ee38eb42a 100644 --- a/src/test/ui/lint/lint-unnecessary-parens.stderr +++ b/src/test/ui/lint/lint-unnecessary-parens.stderr @@ -1,7 +1,7 @@ error: unnecessary parentheses around `return` value --> $DIR/lint-unnecessary-parens.rs:10:12 | -LL | return (1); //~ ERROR unnecessary parentheses around `return` value +LL | return (1); | ^^^ help: remove these parentheses | note: lint level defined here @@ -13,67 +13,67 @@ LL | #![deny(unused_parens)] error: unnecessary parentheses around `return` value --> $DIR/lint-unnecessary-parens.rs:13:12 | -LL | return (X { y }); //~ ERROR unnecessary parentheses around `return` value +LL | return (X { y }); | ^^^^^^^^^ help: remove these parentheses error: unnecessary parentheses around function argument --> $DIR/lint-unnecessary-parens.rs:18:9 | -LL | bar((true)); //~ ERROR unnecessary parentheses around function argument +LL | bar((true)); | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around `if` condition --> $DIR/lint-unnecessary-parens.rs:20:8 | -LL | if (true) {} //~ ERROR unnecessary parentheses around `if` condition +LL | if (true) {} | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around `while` condition --> $DIR/lint-unnecessary-parens.rs:21:11 | -LL | while (true) {} //~ ERROR unnecessary parentheses around `while` condition +LL | while (true) {} | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around `match` head expression --> $DIR/lint-unnecessary-parens.rs:22:11 | -LL | match (true) { //~ ERROR unnecessary parentheses around `match` head expression +LL | match (true) { | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around `if let` head expression --> $DIR/lint-unnecessary-parens.rs:25:16 | -LL | if let 1 = (1) {} //~ ERROR unnecessary parentheses around `if let` head expression +LL | if let 1 = (1) {} | ^^^ help: remove these parentheses error: unnecessary parentheses around `while let` head expression --> $DIR/lint-unnecessary-parens.rs:26:19 | -LL | while let 1 = (2) {} //~ ERROR unnecessary parentheses around `while let` head expression +LL | while let 1 = (2) {} | ^^^ help: remove these parentheses error: unnecessary parentheses around method argument --> $DIR/lint-unnecessary-parens.rs:40:24 | -LL | X { y: false }.foo((true)); //~ ERROR unnecessary parentheses around method argument +LL | X { y: false }.foo((true)); | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:42:18 | -LL | let mut _a = (0); //~ ERROR unnecessary parentheses around assigned value +LL | let mut _a = (0); | ^^^ help: remove these parentheses error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:43:10 | -LL | _a = (0); //~ ERROR unnecessary parentheses around assigned value +LL | _a = (0); | ^^^ help: remove these parentheses error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:44:11 | -LL | _a += (1); //~ ERROR unnecessary parentheses around assigned value +LL | _a += (1); | ^^^ help: remove these parentheses error: aborting due to 12 previous errors diff --git a/src/test/ui/lint/lint-unsafe-code.stderr b/src/test/ui/lint/lint-unsafe-code.stderr index e2dd45e2c8a3..96ad0c33691d 100644 --- a/src/test/ui/lint/lint-unsafe-code.stderr +++ b/src/test/ui/lint/lint-unsafe-code.stderr @@ -1,7 +1,7 @@ error: declaration of an `unsafe` function --> $DIR/lint-unsafe-code.rs:23:1 | -LL | unsafe fn baz() {} //~ ERROR: declaration of an `unsafe` function +LL | unsafe fn baz() {} | ^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,79 +13,79 @@ LL | #![deny(unsafe_code)] error: declaration of an `unsafe` trait --> $DIR/lint-unsafe-code.rs:24:1 | -LL | unsafe trait Foo {} //~ ERROR: declaration of an `unsafe` trait +LL | unsafe trait Foo {} | ^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` trait --> $DIR/lint-unsafe-code.rs:25:1 | -LL | unsafe impl Foo for Bar {} //~ ERROR: implementation of an `unsafe` trait +LL | unsafe impl Foo for Bar {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: declaration of an `unsafe` method --> $DIR/lint-unsafe-code.rs:28:5 | -LL | unsafe fn baz(&self); //~ ERROR: declaration of an `unsafe` method +LL | unsafe fn baz(&self); | ^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:29:5 | -LL | unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn provided(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:30:5 | -LL | unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn provided_override(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:34:5 | -LL | unsafe fn baz(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn baz(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:35:5 | -LL | unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn provided_override(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:54:5 | -LL | unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn provided_override(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:65:5 | -LL | unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn provided(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:71:5 | -LL | unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn provided(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:75:5 | -LL | unsafe fn baz(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn baz(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^ error: usage of an `unsafe` block --> $DIR/lint-unsafe-code.rs:86:5 | -LL | unsafe {} //~ ERROR: usage of an `unsafe` block +LL | unsafe {} | ^^^^^^^^^ error: usage of an `unsafe` block --> $DIR/lint-unsafe-code.rs:19:9 | -LL | unsafe {} //~ ERROR: usage of an `unsafe` block +LL | unsafe {} | ^^^^^^^^^ ... LL | unsafe_in_macro!() diff --git a/src/test/ui/lint/lint-unused-extern-crate.stderr b/src/test/ui/lint/lint-unused-extern-crate.stderr index 46499515fa75..aa4a8dad24c9 100644 --- a/src/test/ui/lint/lint-unused-extern-crate.stderr +++ b/src/test/ui/lint/lint-unused-extern-crate.stderr @@ -1,7 +1,7 @@ error: unused extern crate --> $DIR/lint-unused-extern-crate.rs:11:1 | -LL | extern crate lint_unused_extern_crate5; //~ ERROR: unused extern crate +LL | extern crate lint_unused_extern_crate5; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_extern_crates)] error: unused extern crate --> $DIR/lint-unused-extern-crate.rs:29:5 | -LL | extern crate lint_unused_extern_crate2; //~ ERROR unused extern crate +LL | extern crate lint_unused_extern_crate2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/lint-unused-imports.stderr b/src/test/ui/lint/lint-unused-imports.stderr index 18f2fae0067e..f9a54f477f99 100644 --- a/src/test/ui/lint/lint-unused-imports.stderr +++ b/src/test/ui/lint/lint-unused-imports.stderr @@ -19,37 +19,37 @@ LL | use std::option::Option::{Some, None}; error: unused import: `test::A` --> $DIR/lint-unused-imports.rs:15:5 | -LL | use test::A; //~ ERROR unused import: `test::A` +LL | use test::A; | ^^^^^^^ error: unused import: `bar` --> $DIR/lint-unused-imports.rs:24:18 | -LL | use test2::{foo, bar}; //~ ERROR unused import: `bar` +LL | use test2::{foo, bar}; | ^^^ error: unused import: `foo::Square` --> $DIR/lint-unused-imports.rs:52:13 | -LL | use foo::Square; //~ ERROR unused import: `foo::Square` +LL | use foo::Square; | ^^^^^^^^^^^ error: unused import: `self::g` --> $DIR/lint-unused-imports.rs:68:9 | -LL | use self::g; //~ ERROR unused import: `self::g` +LL | use self::g; | ^^^^^^^ error: unused import: `test2::foo` --> $DIR/lint-unused-imports.rs:77:9 | -LL | use test2::foo; //~ ERROR unused import: `test2::foo` +LL | use test2::foo; | ^^^^^^^^^^ error: unused import: `test::B2` --> $DIR/lint-unused-imports.rs:20:5 | -LL | use test::B2; //~ ERROR unused import: `test::B2` +LL | use test::B2; | ^^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/lint/lint-unused-mut-self.stderr b/src/test/ui/lint/lint-unused-mut-self.stderr index 62be0c8f159c..b5f6b717dc39 100644 --- a/src/test/ui/lint/lint-unused-mut-self.stderr +++ b/src/test/ui/lint/lint-unused-mut-self.stderr @@ -1,7 +1,7 @@ error: variable does not need to be mutable --> $DIR/lint-unused-mut-self.rs:8:12 | -LL | fn foo(mut self) {} //~ ERROR: variable does not need to be mutable +LL | fn foo(mut self) {} | ----^^^^ | | | help: remove this `mut` @@ -15,7 +15,7 @@ LL | #![deny(unused_mut)] error: variable does not need to be mutable --> $DIR/lint-unused-mut-self.rs:9:12 | -LL | fn bar(mut self: Box) {} //~ ERROR: variable does not need to be mutable +LL | fn bar(mut self: Box) {} | ----^^^^ | | | help: remove this `mut` diff --git a/src/test/ui/lint/lint-unused-mut-variables.stderr b/src/test/ui/lint/lint-unused-mut-variables.stderr index a90cc964a84d..e41d8f8ac740 100644 --- a/src/test/ui/lint/lint-unused-mut-variables.stderr +++ b/src/test/ui/lint/lint-unused-mut-variables.stderr @@ -1,7 +1,7 @@ error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:46:14 | -LL | let x = |mut y: isize| 10; //~ ERROR: variable does not need to be mutable +LL | let x = |mut y: isize| 10; | ----^ | | | help: remove this `mut` @@ -15,7 +15,7 @@ LL | #![deny(unused_mut)] error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:11:9 | -LL | let mut a = 3; //~ ERROR: variable does not need to be mutable +LL | let mut a = 3; | ----^ | | | help: remove this `mut` @@ -23,7 +23,7 @@ LL | let mut a = 3; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:13:9 | -LL | let mut a = 2; //~ ERROR: variable does not need to be mutable +LL | let mut a = 2; | ----^ | | | help: remove this `mut` @@ -31,7 +31,7 @@ LL | let mut a = 2; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:15:9 | -LL | let mut b = 3; //~ ERROR: variable does not need to be mutable +LL | let mut b = 3; | ----^ | | | help: remove this `mut` @@ -39,7 +39,7 @@ LL | let mut b = 3; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:17:9 | -LL | let mut a = vec![3]; //~ ERROR: variable does not need to be mutable +LL | let mut a = vec![3]; | ----^ | | | help: remove this `mut` @@ -47,7 +47,7 @@ LL | let mut a = vec![3]; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:19:10 | -LL | let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutable +LL | let (mut a, b) = (1, 2); | ----^ | | | help: remove this `mut` @@ -55,7 +55,7 @@ LL | let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutabl error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:21:9 | -LL | let mut a; //~ ERROR: variable does not need to be mutable +LL | let mut a; | ----^ | | | help: remove this `mut` @@ -63,7 +63,7 @@ LL | let mut a; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:25:9 | -LL | let mut b; //~ ERROR: variable does not need to be mutable +LL | let mut b; | ----^ | | | help: remove this `mut` @@ -71,7 +71,7 @@ LL | let mut b; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:34:9 | -LL | mut x => {} //~ ERROR: variable does not need to be mutable +LL | mut x => {} | ----^ | | | help: remove this `mut` @@ -79,7 +79,7 @@ LL | mut x => {} //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:38:8 | -LL | (mut x, 1) | //~ ERROR: variable does not need to be mutable +LL | (mut x, 1) | | ----^ | | | help: remove this `mut` @@ -87,7 +87,7 @@ LL | (mut x, 1) | //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:51:9 | -LL | let mut a = &mut 5; //~ ERROR: variable does not need to be mutable +LL | let mut a = &mut 5; | ----^ | | | help: remove this `mut` @@ -95,7 +95,7 @@ LL | let mut a = &mut 5; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:56:9 | -LL | let mut b = (&mut a,); //~ ERROR: variable does not need to be mutable +LL | let mut b = (&mut a,); | ----^ | | | help: remove this `mut` @@ -103,7 +103,7 @@ LL | let mut b = (&mut a,); //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:59:9 | -LL | let mut x = &mut 1; //~ ERROR: variable does not need to be mutable +LL | let mut x = &mut 1; | ----^ | | | help: remove this `mut` @@ -111,7 +111,7 @@ LL | let mut x = &mut 1; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:71:9 | -LL | let mut v : &mut Vec<()> = &mut vec![]; //~ ERROR: variable does not need to be mutable +LL | let mut v : &mut Vec<()> = &mut vec![]; | ----^ | | | help: remove this `mut` @@ -119,7 +119,7 @@ LL | let mut v : &mut Vec<()> = &mut vec![]; //~ ERROR: variable does not ne error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:48:13 | -LL | fn what(mut foo: isize) {} //~ ERROR: variable does not need to be mutable +LL | fn what(mut foo: isize) {} | ----^^^ | | | help: remove this `mut` @@ -135,7 +135,7 @@ LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] { error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:130:9 | -LL | let mut b = vec![2]; //~ ERROR: variable does not need to be mutable +LL | let mut b = vec![2]; | ----^ | | | help: remove this `mut` diff --git a/src/test/ui/lint/lint-uppercase-variables.stderr b/src/test/ui/lint/lint-uppercase-variables.stderr index f2267f351ddd..40c13231c182 100644 --- a/src/test/ui/lint/lint-uppercase-variables.stderr +++ b/src/test/ui/lint/lint-uppercase-variables.stderr @@ -20,7 +20,7 @@ LL | #![warn(unused)] error: structure field `X` should have a snake case name --> $DIR/lint-uppercase-variables.rs:10:5 | -LL | X: usize //~ ERROR structure field `X` should have a snake case name +LL | X: usize | ^ help: convert the identifier to snake case: `x` | note: lint level defined here @@ -32,13 +32,13 @@ LL | #![deny(non_snake_case)] error: variable `Xx` should have a snake case name --> $DIR/lint-uppercase-variables.rs:13:9 | -LL | fn test(Xx: usize) { //~ ERROR variable `Xx` should have a snake case name +LL | fn test(Xx: usize) { | ^^ help: convert the identifier to snake case: `xx` error: variable `Test` should have a snake case name --> $DIR/lint-uppercase-variables.rs:18:9 | -LL | let Test: usize = 0; //~ ERROR variable `Test` should have a snake case name +LL | let Test: usize = 0; | ^^^^ help: convert the identifier to snake case: `test` error: variable `Foo` should have a snake case name diff --git a/src/test/ui/lint/lints-in-foreign-macros.stderr b/src/test/ui/lint/lints-in-foreign-macros.stderr index 8287ca5692bd..3fc3c2281f2e 100644 --- a/src/test/ui/lint/lints-in-foreign-macros.stderr +++ b/src/test/ui/lint/lints-in-foreign-macros.stderr @@ -1,7 +1,7 @@ warning: unused import: `std::string::ToString` --> $DIR/lints-in-foreign-macros.rs:11:16 | -LL | () => {use std::string::ToString;} //~ WARN: unused import +LL | () => {use std::string::ToString;} | ^^^^^^^^^^^^^^^^^^^^^ ... LL | mod a { foo!(); } @@ -10,25 +10,25 @@ LL | mod a { foo!(); } note: lint level defined here --> $DIR/lints-in-foreign-macros.rs:4:9 | -LL | #![warn(unused_imports)] //~ missing documentation for crate [missing_docs] +LL | #![warn(unused_imports)] | ^^^^^^^^^^^^^^ warning: unused import: `std::string::ToString` --> $DIR/lints-in-foreign-macros.rs:16:18 | -LL | mod c { baz!(use std::string::ToString;); } //~ WARN: unused import +LL | mod c { baz!(use std::string::ToString;); } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused import: `std::string::ToString` --> $DIR/lints-in-foreign-macros.rs:17:19 | -LL | mod d { baz2!(use std::string::ToString;); } //~ WARN: unused import +LL | mod d { baz2!(use std::string::ToString;); } | ^^^^^^^^^^^^^^^^^^^^^ warning: missing documentation for crate --> $DIR/lints-in-foreign-macros.rs:4:1 | -LL | / #![warn(unused_imports)] //~ missing documentation for crate [missing_docs] +LL | / #![warn(unused_imports)] LL | | #![warn(missing_docs)] LL | | LL | | #[macro_use] @@ -46,12 +46,12 @@ LL | #![warn(missing_docs)] warning: missing documentation for a function --> $DIR/lints-in-foreign-macros.rs:18:6 | -LL | baz!(pub fn undocumented() {}); //~ WARN: missing documentation for a function +LL | baz!(pub fn undocumented() {}); | ^^^^^^^^^^^^^^^^^^^^^ warning: missing documentation for a function --> $DIR/lints-in-foreign-macros.rs:19:7 | -LL | baz2!(pub fn undocumented2() {}); //~ WARN: missing documentation for a function +LL | baz2!(pub fn undocumented2() {}); | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/must_use-trait.stderr b/src/test/ui/lint/must_use-trait.stderr index 94f5f4f40d2d..7e2b2f67964a 100644 --- a/src/test/ui/lint/must_use-trait.stderr +++ b/src/test/ui/lint/must_use-trait.stderr @@ -1,7 +1,7 @@ error: unused implementer of `Critical` that must be used --> $DIR/must_use-trait.rs:21:5 | -LL | get_critical(); //~ ERROR unused implementer of `Critical` that must be used +LL | get_critical(); | ^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/must_use-unit.stderr b/src/test/ui/lint/must_use-unit.stderr index ee61c2d1dbc5..f6229c0442f9 100644 --- a/src/test/ui/lint/must_use-unit.stderr +++ b/src/test/ui/lint/must_use-unit.stderr @@ -1,7 +1,7 @@ error: unused return value of `foo` that must be used --> $DIR/must_use-unit.rs:14:5 | -LL | foo(); //~ unused return value of `foo` +LL | foo(); | ^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_must_use)] error: unused return value of `bar` that must be used --> $DIR/must_use-unit.rs:16:5 | -LL | bar(); //~ unused return value of `bar` +LL | bar(); | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/outer-forbid.stderr b/src/test/ui/lint/outer-forbid.stderr index 57ad55a37f05..310a5d88f8c1 100644 --- a/src/test/ui/lint/outer-forbid.stderr +++ b/src/test/ui/lint/outer-forbid.stderr @@ -4,7 +4,7 @@ error[E0453]: allow(unused_variables) overruled by outer forbid(unused) LL | #![forbid(unused, non_snake_case)] | ------ `forbid` level set here LL | -LL | #[allow(unused_variables)] //~ ERROR overruled +LL | #[allow(unused_variables)] | ^^^^^^^^^^^^^^^^ overruled by previous forbid error[E0453]: allow(unused) overruled by outer forbid(unused) @@ -13,7 +13,7 @@ error[E0453]: allow(unused) overruled by outer forbid(unused) LL | #![forbid(unused, non_snake_case)] | ------ `forbid` level set here ... -LL | #[allow(unused)] //~ ERROR overruled +LL | #[allow(unused)] | ^^^^^^ overruled by previous forbid error[E0453]: allow(nonstandard_style) overruled by outer forbid(non_snake_case) @@ -22,7 +22,7 @@ error[E0453]: allow(nonstandard_style) overruled by outer forbid(non_snake_case) LL | #![forbid(unused, non_snake_case)] | -------------- `forbid` level set here ... -LL | #[allow(nonstandard_style)] //~ ERROR overruled +LL | #[allow(nonstandard_style)] | ^^^^^^^^^^^^^^^^^ overruled by previous forbid error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/suggestions.stderr b/src/test/ui/lint/suggestions.stderr index 1e4eabc9db0f..c28814aeee8f 100644 --- a/src/test/ui/lint/suggestions.stderr +++ b/src/test/ui/lint/suggestions.stderr @@ -59,7 +59,7 @@ warning: functions generic over types or consts must be mangled | LL | #[no_mangle] | ------------ help: remove this attribute -LL | //~^ HELP remove this attribute +LL | LL | pub fn defiant(_t: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/src/test/ui/lint/test-inner-fn.stderr b/src/test/ui/lint/test-inner-fn.stderr index 12838cec0247..bf476a45f772 100644 --- a/src/test/ui/lint/test-inner-fn.stderr +++ b/src/test/ui/lint/test-inner-fn.stderr @@ -1,7 +1,7 @@ error: cannot test inner items --> $DIR/test-inner-fn.rs:5:5 | -LL | #[test] //~ ERROR cannot test inner items [unnameable_test_items] +LL | #[test] | ^^^^^^^ | = note: requested on the command line with `-D unnameable-test-items` @@ -9,7 +9,7 @@ LL | #[test] //~ ERROR cannot test inner items [unnameable_test_items] error: cannot test inner items --> $DIR/test-inner-fn.rs:13:9 | -LL | #[test] //~ ERROR cannot test inner items [unnameable_test_items] +LL | #[test] | ^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/type-overflow.stderr b/src/test/ui/lint/type-overflow.stderr index 349d0be01649..5235c9851b53 100644 --- a/src/test/ui/lint/type-overflow.stderr +++ b/src/test/ui/lint/type-overflow.stderr @@ -1,7 +1,7 @@ warning: literal out of range for i8 --> $DIR/type-overflow.rs:5:17 | -LL | let error = 255i8; //~WARNING literal out of range for i8 +LL | let error = 255i8; | ^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![warn(overflowing_literals)] warning: literal out of range for i8 --> $DIR/type-overflow.rs:10:16 | -LL | let fail = 0b1000_0001i8; //~WARNING literal out of range for i8 +LL | let fail = 0b1000_0001i8; | ^^^^^^^^^^^^^ help: consider using `u8` instead: `0b1000_0001u8` | = note: the literal `0b1000_0001i8` (decimal `129`) does not fit into an `i8` and will become `-127i8` @@ -21,7 +21,7 @@ LL | let fail = 0b1000_0001i8; //~WARNING literal out of range for i8 warning: literal out of range for i64 --> $DIR/type-overflow.rs:12:16 | -LL | let fail = 0x8000_0000_0000_0000i64; //~WARNING literal out of range for i64 +LL | let fail = 0x8000_0000_0000_0000i64; | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `u64` instead: `0x8000_0000_0000_0000u64` | = note: the literal `0x8000_0000_0000_0000i64` (decimal `9223372036854775808`) does not fit into an `i64` and will become `-9223372036854775808i64` @@ -29,7 +29,7 @@ LL | let fail = 0x8000_0000_0000_0000i64; //~WARNING literal out of range fo warning: literal out of range for u32 --> $DIR/type-overflow.rs:14:16 | -LL | let fail = 0x1_FFFF_FFFFu32; //~WARNING literal out of range for u32 +LL | let fail = 0x1_FFFF_FFFFu32; | ^^^^^^^^^^^^^^^^ help: consider using `u64` instead: `0x1_FFFF_FFFFu64` | = note: the literal `0x1_FFFF_FFFFu32` (decimal `8589934591`) does not fit into an `u32` and will become `4294967295u32` @@ -46,7 +46,7 @@ LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; warning: literal out of range for i32 --> $DIR/type-overflow.rs:19:16 | -LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; //~WARNING literal out of range for i32 +LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; | ^^^^^^^^^^^^^^^^^^^^^ | = note: the literal `0x8FFF_FFFF_FFFF_FFFE` (decimal `10376293541461622782`) does not fit into an `i32` and will become `-2i32` @@ -55,7 +55,7 @@ LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; //~WARNING literal out of range for i warning: literal out of range for i8 --> $DIR/type-overflow.rs:21:17 | -LL | let fail = -0b1111_1111i8; //~WARNING literal out of range for i8 +LL | let fail = -0b1111_1111i8; | ^^^^^^^^^^^^^ help: consider using `i16` instead: `0b1111_1111i16` | = note: the literal `0b1111_1111i8` (decimal `255`) does not fit into an `i8` and will become `-1i8` diff --git a/src/test/ui/lint/unused_labels.stderr b/src/test/ui/lint/unused_labels.stderr index 39d0a7850efa..08f8548e0493 100644 --- a/src/test/ui/lint/unused_labels.stderr +++ b/src/test/ui/lint/unused_labels.stderr @@ -57,7 +57,7 @@ warning: label name `'many_used_shadowed` shadows a label name that is already i | LL | 'many_used_shadowed: for _ in 0..10 { | ------------------- first declared here -LL | //~^ WARN unused label +LL | LL | 'many_used_shadowed: for _ in 0..10 { | ^^^^^^^^^^^^^^^^^^^ lifetime 'many_used_shadowed already in scope diff --git a/src/test/ui/liveness/liveness-closure-require-ret.stderr b/src/test/ui/liveness/liveness-closure-require-ret.stderr index 3133efdedd76..e8f185a5cb27 100644 --- a/src/test/ui/liveness/liveness-closure-require-ret.stderr +++ b/src/test/ui/liveness/liveness-closure-require-ret.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/liveness-closure-require-ret.rs:2:37 | -LL | fn main() { println!("{}", force(|| {})); } //~ ERROR mismatched types +LL | fn main() { println!("{}", force(|| {})); } | ^^ expected isize, found () | = note: expected type `isize` diff --git a/src/test/ui/liveness/liveness-dead.stderr b/src/test/ui/liveness/liveness-dead.stderr index c89135e5135f..d054b1d497e5 100644 --- a/src/test/ui/liveness/liveness-dead.stderr +++ b/src/test/ui/liveness/liveness-dead.stderr @@ -1,7 +1,7 @@ error: value assigned to `x` is never read --> $DIR/liveness-dead.rs:9:13 | -LL | let mut x: isize = 3; //~ ERROR: value assigned to `x` is never read +LL | let mut x: isize = 3; | ^ | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![deny(unused_assignments)] error: value assigned to `x` is never read --> $DIR/liveness-dead.rs:17:5 | -LL | x = 4; //~ ERROR: value assigned to `x` is never read +LL | x = 4; | ^ | = help: maybe it is overwritten before being read? @@ -22,7 +22,7 @@ LL | x = 4; //~ ERROR: value assigned to `x` is never read error: value passed to `x` is never read --> $DIR/liveness-dead.rs:20:11 | -LL | fn f4(mut x: i32) { //~ ERROR: value passed to `x` is never read +LL | fn f4(mut x: i32) { | ^ | = help: maybe it is overwritten before being read? @@ -30,7 +30,7 @@ LL | fn f4(mut x: i32) { //~ ERROR: value passed to `x` is never read error: value assigned to `x` is never read --> $DIR/liveness-dead.rs:27:5 | -LL | x = 4; //~ ERROR: value assigned to `x` is never read +LL | x = 4; | ^ | = help: maybe it is overwritten before being read? diff --git a/src/test/ui/liveness/liveness-issue-2163.stderr b/src/test/ui/liveness/liveness-issue-2163.stderr index e91994d9a229..780a2548f1f8 100644 --- a/src/test/ui/liveness/liveness-issue-2163.stderr +++ b/src/test/ui/liveness/liveness-issue-2163.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | a.iter().all(|_| -> bool { | ______________________________^ -LL | | //~^ ERROR mismatched types +LL | | LL | | }); | |_____^ expected bool, found () | diff --git a/src/test/ui/liveness/liveness-missing-ret2.stderr b/src/test/ui/liveness/liveness-missing-ret2.stderr index 58d0249ee3b2..ab7d411880bb 100644 --- a/src/test/ui/liveness/liveness-missing-ret2.stderr +++ b/src/test/ui/liveness/liveness-missing-ret2.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/liveness-missing-ret2.rs:1:11 | -LL | fn f() -> isize { //~ ERROR mismatched types +LL | fn f() -> isize { | - ^^^^^ expected isize, found () | | | this function's body doesn't return diff --git a/src/test/ui/liveness/liveness-move-call-arg.stderr b/src/test/ui/liveness/liveness-move-call-arg.stderr index 21d285463e38..c50c01e2a9e6 100644 --- a/src/test/ui/liveness/liveness-move-call-arg.stderr +++ b/src/test/ui/liveness/liveness-move-call-arg.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `x` --> $DIR/liveness-move-call-arg.rs:9:14 | -LL | take(x); //~ ERROR use of moved value: `x` +LL | take(x); | ^ value moved here in previous iteration of loop | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/liveness/liveness-move-in-loop.stderr b/src/test/ui/liveness/liveness-move-in-loop.stderr index d00c2d6ac35e..52e83a6a68f2 100644 --- a/src/test/ui/liveness/liveness-move-in-loop.stderr +++ b/src/test/ui/liveness/liveness-move-in-loop.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `y` --> $DIR/liveness-move-in-loop.rs:11:25 | -LL | x = y; //~ ERROR use of moved value +LL | x = y; | ^ value moved here in previous iteration of loop | = note: move occurs because `y` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/liveness/liveness-move-in-while.stderr b/src/test/ui/liveness/liveness-move-in-while.stderr index 91f722cb4228..61b4cd8c630e 100644 --- a/src/test/ui/liveness/liveness-move-in-while.stderr +++ b/src/test/ui/liveness/liveness-move-in-while.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `y` --> $DIR/liveness-move-in-while.rs:7:24 | -LL | println!("{}", y); //~ ERROR use of moved value: `y` +LL | println!("{}", y); | ^ value used here after move LL | while true { while true { while true { x = y; x.clone(); } } } | - value moved here diff --git a/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr b/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr index c6d166d8b31a..a5d9734c069e 100644 --- a/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr +++ b/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr @@ -16,7 +16,7 @@ LL | test!(); error[E0308]: mismatched types --> $DIR/liveness-return-last-stmt-semi.rs:7:19 | -LL | fn no_return() -> i32 {} //~ ERROR mismatched types +LL | fn no_return() -> i32 {} | --------- ^^^ expected i32, found () | | | this function's body doesn't return @@ -27,7 +27,7 @@ LL | fn no_return() -> i32 {} //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/liveness-return-last-stmt-semi.rs:9:19 | -LL | fn bar(x: u32) -> u32 { //~ ERROR mismatched types +LL | fn bar(x: u32) -> u32 { | --- ^^^ expected u32, found () | | | this function's body doesn't return @@ -40,7 +40,7 @@ LL | x * 2; error[E0308]: mismatched types --> $DIR/liveness-return-last-stmt-semi.rs:13:19 | -LL | fn baz(x: u64) -> u32 { //~ ERROR mismatched types +LL | fn baz(x: u64) -> u32 { | --- ^^^ expected u32, found () | | | this function's body doesn't return diff --git a/src/test/ui/liveness/liveness-unused.stderr b/src/test/ui/liveness/liveness-unused.stderr index 49795faa59c8..d6077111f71b 100644 --- a/src/test/ui/liveness/liveness-unused.stderr +++ b/src/test/ui/liveness/liveness-unused.stderr @@ -1,7 +1,7 @@ warning: unreachable statement --> $DIR/liveness-unused.rs:92:9 | -LL | drop(*x as i32); //~ WARNING unreachable statement +LL | drop(*x as i32); | ^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -105,7 +105,7 @@ LL | let x; error: value assigned to `x` is never read --> $DIR/liveness-unused.rs:116:9 | -LL | x = 0; //~ ERROR value assigned to `x` is never read +LL | x = 0; | ^ | = help: maybe it is overwritten before being read? diff --git a/src/test/ui/liveness/liveness-use-after-move.stderr b/src/test/ui/liveness/liveness-use-after-move.stderr index 62475943d0e3..ce192ae05f01 100644 --- a/src/test/ui/liveness/liveness-use-after-move.stderr +++ b/src/test/ui/liveness/liveness-use-after-move.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `*x` | LL | let y = x; | - value moved here -LL | println!("{}", *x); //~ ERROR use of moved value: `*x` +LL | println!("{}", *x); | ^^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/liveness/liveness-use-after-send.stderr b/src/test/ui/liveness/liveness-use-after-send.stderr index 1fdb1d3ec39b..28173285fb45 100644 --- a/src/test/ui/liveness/liveness-use-after-send.stderr +++ b/src/test/ui/liveness/liveness-use-after-send.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `message` | LL | send(ch, message); | ------- value moved here -LL | println!("{}", message); //~ ERROR use of moved value: `message` +LL | println!("{}", message); | ^^^^^^^ value used here after move | = note: move occurs because `message` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/loops/loop-break-value-no-repeat.stderr b/src/test/ui/loops/loop-break-value-no-repeat.stderr index f5c6544a815a..066dce531a54 100644 --- a/src/test/ui/loops/loop-break-value-no-repeat.stderr +++ b/src/test/ui/loops/loop-break-value-no-repeat.stderr @@ -1,11 +1,11 @@ error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value-no-repeat.rs:12:9 | -LL | break 22 //~ ERROR `break` with value from a `for` loop +LL | break 22 | ^^^^^^^^ can only break with a value inside `loop` or breakable block help: instead, use `break` on its own without a value inside this `for` loop | -LL | break //~ ERROR `break` with value from a `for` loop +LL | break | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/loops/loop-break-value.stderr b/src/test/ui/loops/loop-break-value.stderr index 3e009c007e08..8823eecab646 100644 --- a/src/test/ui/loops/loop-break-value.stderr +++ b/src/test/ui/loops/loop-break-value.stderr @@ -1,11 +1,11 @@ error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:28:9 | -LL | break (); //~ ERROR `break` with value from a `while` loop +LL | break (); | ^^^^^^^^ can only break with a value inside `loop` or breakable block help: instead, use `break` on its own without a value inside this `while` loop | -LL | break; //~ ERROR `break` with value from a `while` loop +LL | break; | ^^^^^ error[E0571]: `break` with value from a `while` loop @@ -21,11 +21,11 @@ LL | break; error[E0571]: `break` with value from a `while let` loop --> $DIR/loop-break-value.rs:38:12 | -LL | if break () { //~ ERROR `break` with value from a `while let` loop +LL | if break () { | ^^^^^^^^ can only break with a value inside `loop` or breakable block help: instead, use `break` on its own without a value inside this `while let` loop | -LL | if break { //~ ERROR `break` with value from a `while let` loop +LL | if break { | ^^^^^ error[E0571]: `break` with value from a `while let` loop @@ -51,11 +51,11 @@ LL | break; error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value.rs:56:9 | -LL | break (); //~ ERROR `break` with value from a `for` loop +LL | break (); | ^^^^^^^^ can only break with a value inside `loop` or breakable block help: instead, use `break` on its own without a value inside this `for` loop | -LL | break; //~ ERROR `break` with value from a `for` loop +LL | break; | ^^^^^ error[E0571]: `break` with value from a `for` loop @@ -90,7 +90,7 @@ LL | let val: ! = loop { break break; }; error[E0308]: mismatched types --> $DIR/loop-break-value.rs:11:19 | -LL | break 123; //~ ERROR mismatched types +LL | break 123; | ^^^ expected &str, found integer | = note: expected type `&str` @@ -99,7 +99,7 @@ LL | break 123; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-break-value.rs:16:15 | -LL | break "asdf"; //~ ERROR mismatched types +LL | break "asdf"; | ^^^^^^ expected i32, found reference | = note: expected type `i32` @@ -108,7 +108,7 @@ LL | break "asdf"; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-break-value.rs:21:31 | -LL | break 'outer_loop "nope"; //~ ERROR mismatched types +LL | break 'outer_loop "nope"; | ^^^^^^ expected i32, found reference | = note: expected type `i32` @@ -117,7 +117,7 @@ LL | break 'outer_loop "nope"; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-break-value.rs:73:26 | -LL | break 'c 123; //~ ERROR mismatched types +LL | break 'c 123; | ^^^ expected (), found integer | = note: expected type `()` @@ -126,7 +126,7 @@ LL | break 'c 123; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-break-value.rs:80:15 | -LL | break (break, break); //~ ERROR mismatched types +LL | break (break, break); | ^^^^^^^^^^^^^^ expected (), found tuple | = note: expected type `()` @@ -135,7 +135,7 @@ LL | break (break, break); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-break-value.rs:85:15 | -LL | break 2; //~ ERROR mismatched types +LL | break 2; | ^ expected (), found integer | = note: expected type `()` @@ -144,7 +144,7 @@ LL | break 2; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-break-value.rs:90:9 | -LL | break; //~ ERROR mismatched types +LL | break; | ^^^^^ expected (), found integer | = note: expected type `()` diff --git a/src/test/ui/loops/loop-labeled-break-value.stderr b/src/test/ui/loops/loop-labeled-break-value.stderr index 5cfd86ea5047..ad7cb4b0c2e5 100644 --- a/src/test/ui/loops/loop-labeled-break-value.stderr +++ b/src/test/ui/loops/loop-labeled-break-value.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/loop-labeled-break-value.rs:3:29 | -LL | let _: i32 = loop { break }; //~ ERROR mismatched types +LL | let _: i32 = loop { break }; | ^^^^^ expected (), found i32 | = note: expected type `()` @@ -10,7 +10,7 @@ LL | let _: i32 = loop { break }; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-labeled-break-value.rs:6:37 | -LL | let _: i32 = 'inner: loop { break 'inner }; //~ ERROR mismatched types +LL | let _: i32 = 'inner: loop { break 'inner }; | ^^^^^^^^^^^^ expected (), found i32 | = note: expected type `()` @@ -19,7 +19,7 @@ LL | let _: i32 = 'inner: loop { break 'inner }; //~ ERROR mismatched ty error[E0308]: mismatched types --> $DIR/loop-labeled-break-value.rs:9:45 | -LL | let _: i32 = 'inner2: loop { loop { break 'inner2 } }; //~ ERROR mismatched types +LL | let _: i32 = 'inner2: loop { loop { break 'inner2 } }; | ^^^^^^^^^^^^^ expected (), found i32 | = note: expected type `()` diff --git a/src/test/ui/loops/loop-proper-liveness.stderr b/src/test/ui/loops/loop-proper-liveness.stderr index b8fb3fe00ee5..392b961fa075 100644 --- a/src/test/ui/loops/loop-proper-liveness.stderr +++ b/src/test/ui/loops/loop-proper-liveness.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/loop-proper-liveness.rs:9:22 | -LL | println!("{:?}", x); //~ ERROR use of possibly uninitialized variable +LL | println!("{:?}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/loops/loop-properly-diverging-2.stderr b/src/test/ui/loops/loop-properly-diverging-2.stderr index 5bd088fa0114..6293fdb058a0 100644 --- a/src/test/ui/loops/loop-properly-diverging-2.stderr +++ b/src/test/ui/loops/loop-properly-diverging-2.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/loop-properly-diverging-2.rs:2:23 | -LL | let x: i32 = loop { break }; //~ ERROR mismatched types +LL | let x: i32 = loop { break }; | ^^^^^ expected (), found i32 | = note: expected type `()` diff --git a/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr b/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr index 4d1a29f71658..fc42449aa58b 100644 --- a/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr +++ b/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr @@ -3,7 +3,7 @@ warning: label name `'fl` shadows a label name that is already in scope | LL | { 'fl: for _ in 0..10 { break; } } | --- first declared here -LL | { 'fl: loop { break; } } //~ WARN label name `'fl` shadows a label name that is already in scope +LL | { 'fl: loop { break; } } | ^^^ lifetime 'fl already in scope warning: label name `'lf` shadows a label name that is already in scope @@ -11,7 +11,7 @@ warning: label name `'lf` shadows a label name that is already in scope | LL | { 'lf: loop { break; } } | --- first declared here -LL | { 'lf: for _ in 0..10 { break; } } //~ WARN label name `'lf` shadows a label name that is already in scope +LL | { 'lf: for _ in 0..10 { break; } } | ^^^ lifetime 'lf already in scope warning: label name `'wl` shadows a label name that is already in scope @@ -19,7 +19,7 @@ warning: label name `'wl` shadows a label name that is already in scope | LL | { 'wl: while 2 > 1 { break; } } | --- first declared here -LL | { 'wl: loop { break; } } //~ WARN label name `'wl` shadows a label name that is already in scope +LL | { 'wl: loop { break; } } | ^^^ lifetime 'wl already in scope warning: label name `'lw` shadows a label name that is already in scope @@ -27,7 +27,7 @@ warning: label name `'lw` shadows a label name that is already in scope | LL | { 'lw: loop { break; } } | --- first declared here -LL | { 'lw: while 2 > 1 { break; } } //~ WARN label name `'lw` shadows a label name that is already in scope +LL | { 'lw: while 2 > 1 { break; } } | ^^^ lifetime 'lw already in scope warning: label name `'fw` shadows a label name that is already in scope @@ -35,7 +35,7 @@ warning: label name `'fw` shadows a label name that is already in scope | LL | { 'fw: for _ in 0..10 { break; } } | --- first declared here -LL | { 'fw: while 2 > 1 { break; } } //~ WARN label name `'fw` shadows a label name that is already in scope +LL | { 'fw: while 2 > 1 { break; } } | ^^^ lifetime 'fw already in scope warning: label name `'wf` shadows a label name that is already in scope @@ -43,7 +43,7 @@ warning: label name `'wf` shadows a label name that is already in scope | LL | { 'wf: while 2 > 1 { break; } } | --- first declared here -LL | { 'wf: for _ in 0..10 { break; } } //~ WARN label name `'wf` shadows a label name that is already in scope +LL | { 'wf: for _ in 0..10 { break; } } | ^^^ lifetime 'wf already in scope warning: label name `'tl` shadows a label name that is already in scope @@ -51,7 +51,7 @@ warning: label name `'tl` shadows a label name that is already in scope | LL | { 'tl: while let Some(_) = None:: { break; } } | --- first declared here -LL | { 'tl: loop { break; } } //~ WARN label name `'tl` shadows a label name that is already in scope +LL | { 'tl: loop { break; } } | ^^^ lifetime 'tl already in scope warning: label name `'lt` shadows a label name that is already in scope diff --git a/src/test/ui/loops/loops-reject-duplicate-labels.stderr b/src/test/ui/loops/loops-reject-duplicate-labels.stderr index f9a19ad57f04..4574c5ca0bd5 100644 --- a/src/test/ui/loops/loops-reject-duplicate-labels.stderr +++ b/src/test/ui/loops/loops-reject-duplicate-labels.stderr @@ -3,7 +3,7 @@ warning: label name `'fl` shadows a label name that is already in scope | LL | 'fl: for _ in 0..10 { break; } | --- first declared here -LL | 'fl: loop { break; } //~ WARN label name `'fl` shadows a label name that is already in scope +LL | 'fl: loop { break; } | ^^^ lifetime 'fl already in scope warning: label name `'lf` shadows a label name that is already in scope @@ -11,7 +11,7 @@ warning: label name `'lf` shadows a label name that is already in scope | LL | 'lf: loop { break; } | --- first declared here -LL | 'lf: for _ in 0..10 { break; } //~ WARN label name `'lf` shadows a label name that is already in scope +LL | 'lf: for _ in 0..10 { break; } | ^^^ lifetime 'lf already in scope warning: label name `'wl` shadows a label name that is already in scope @@ -19,7 +19,7 @@ warning: label name `'wl` shadows a label name that is already in scope | LL | 'wl: while 2 > 1 { break; } | --- first declared here -LL | 'wl: loop { break; } //~ WARN label name `'wl` shadows a label name that is already in scope +LL | 'wl: loop { break; } | ^^^ lifetime 'wl already in scope warning: label name `'lw` shadows a label name that is already in scope @@ -27,7 +27,7 @@ warning: label name `'lw` shadows a label name that is already in scope | LL | 'lw: loop { break; } | --- first declared here -LL | 'lw: while 2 > 1 { break; } //~ WARN label name `'lw` shadows a label name that is already in scope +LL | 'lw: while 2 > 1 { break; } | ^^^ lifetime 'lw already in scope warning: label name `'fw` shadows a label name that is already in scope @@ -35,7 +35,7 @@ warning: label name `'fw` shadows a label name that is already in scope | LL | 'fw: for _ in 0..10 { break; } | --- first declared here -LL | 'fw: while 2 > 1 { break; } //~ WARN label name `'fw` shadows a label name that is already in scope +LL | 'fw: while 2 > 1 { break; } | ^^^ lifetime 'fw already in scope warning: label name `'wf` shadows a label name that is already in scope @@ -43,7 +43,7 @@ warning: label name `'wf` shadows a label name that is already in scope | LL | 'wf: while 2 > 1 { break; } | --- first declared here -LL | 'wf: for _ in 0..10 { break; } //~ WARN label name `'wf` shadows a label name that is already in scope +LL | 'wf: for _ in 0..10 { break; } | ^^^ lifetime 'wf already in scope warning: label name `'tl` shadows a label name that is already in scope @@ -51,7 +51,7 @@ warning: label name `'tl` shadows a label name that is already in scope | LL | 'tl: while let Some(_) = None:: { break; } | --- first declared here -LL | 'tl: loop { break; } //~ WARN label name `'tl` shadows a label name that is already in scope +LL | 'tl: loop { break; } | ^^^ lifetime 'tl already in scope warning: label name `'lt` shadows a label name that is already in scope diff --git a/src/test/ui/lub-glb/old-lub-glb-hr.stderr b/src/test/ui/lub-glb/old-lub-glb-hr.stderr index 8f228ea4cad4..475c1801ca12 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-hr.stderr @@ -5,7 +5,7 @@ LL | let z = match 22 { | _____________- LL | | 0 => x, | | - this is found to be of type `for<'r, 's> fn(&'r u8, &'s u8)` -LL | | _ => y, //~ ERROR match arms have incompatible types +LL | | _ => y, | | ^ expected bound lifetime parameter, found concrete lifetime LL | | }; | |_____- `match` arms have incompatible types diff --git a/src/test/ui/lub-glb/old-lub-glb-object.stderr b/src/test/ui/lub-glb/old-lub-glb-object.stderr index 056f9131dd21..e02ede399e6a 100644 --- a/src/test/ui/lub-glb/old-lub-glb-object.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-object.stderr @@ -5,7 +5,7 @@ LL | let z = match 22 { | _____________- LL | | 0 => x, | | - this is found to be of type `&dyn for<'a, 'b> Foo<&'a u8, &'b u8>` -LL | | _ => y, //~ ERROR match arms have incompatible types +LL | | _ => y, | | ^ expected bound lifetime parameter 'a, found concrete lifetime LL | | }; | |_____- `match` arms have incompatible types diff --git a/src/test/ui/lub-if.stderr b/src/test/ui/lub-if.stderr index 2cf12ba60414..26f756c91833 100644 --- a/src/test/ui/lub-if.stderr +++ b/src/test/ui/lub-if.stderr @@ -1,7 +1,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/lub-if.rs:28:9 | -LL | s //~ ERROR E0312 +LL | s | ^ | = note: ...the reference is valid for the static lifetime... @@ -14,7 +14,7 @@ LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/lub-if.rs:35:9 | -LL | s //~ ERROR E0312 +LL | s | ^ | = note: ...the reference is valid for the static lifetime... diff --git a/src/test/ui/lub-match.stderr b/src/test/ui/lub-match.stderr index 0db27f91717b..0cb0a23c6f2d 100644 --- a/src/test/ui/lub-match.stderr +++ b/src/test/ui/lub-match.stderr @@ -1,7 +1,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/lub-match.rs:30:13 | -LL | s //~ ERROR E0312 +LL | s | ^ | = note: ...the reference is valid for the static lifetime... @@ -14,7 +14,7 @@ LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/lub-match.rs:39:13 | -LL | s //~ ERROR E0312 +LL | s | ^ | = note: ...the reference is valid for the static lifetime... diff --git a/src/test/ui/macros/ambiguity-legacy-vs-modern.stderr b/src/test/ui/macros/ambiguity-legacy-vs-modern.stderr index 2785594585dd..d9a0a9f00543 100644 --- a/src/test/ui/macros/ambiguity-legacy-vs-modern.stderr +++ b/src/test/ui/macros/ambiguity-legacy-vs-modern.stderr @@ -1,7 +1,7 @@ error[E0659]: `m` is ambiguous (`macro_rules` vs non-`macro_rules` from other module) --> $DIR/ambiguity-legacy-vs-modern.rs:31:9 | -LL | m!() //~ ERROR `m` is ambiguous +LL | m!() | ^ ambiguous name | note: `m` could refer to the macro defined here @@ -18,7 +18,7 @@ LL | macro m() { 0 } error[E0659]: `m` is ambiguous (`macro_rules` vs non-`macro_rules` from other module) --> $DIR/ambiguity-legacy-vs-modern.rs:43:5 | -LL | m!() //~ ERROR `m` is ambiguous +LL | m!() | ^ ambiguous name | note: `m` could refer to the macro defined here diff --git a/src/test/ui/macros/assert.stderr b/src/test/ui/macros/assert.stderr index 2cfcebabcb93..fa604506b946 100644 --- a/src/test/ui/macros/assert.stderr +++ b/src/test/ui/macros/assert.stderr @@ -1,19 +1,19 @@ error: macro requires a boolean expression as an argument --> $DIR/assert.rs:2:5 | -LL | assert!(); //~ ERROR requires a boolean expression +LL | assert!(); | ^^^^^^^^^^ boolean expression required error: expected expression, found keyword `struct` --> $DIR/assert.rs:3:13 | -LL | assert!(struct); //~ ERROR expected expression +LL | assert!(struct); | ^^^^^^ expected expression error: macro requires a boolean expression as an argument --> $DIR/assert.rs:4:5 | -LL | debug_assert!(); //~ ERROR requires a boolean expression +LL | debug_assert!(); | ^^^^^^^^^^^^^^^^ boolean expression required | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) @@ -21,7 +21,7 @@ LL | debug_assert!(); //~ ERROR requires a boolean expression error: expected expression, found keyword `struct` --> $DIR/assert.rs:5:19 | -LL | debug_assert!(struct); //~ ERROR expected expression +LL | debug_assert!(struct); | ^^^^^^ expected expression error: aborting due to 4 previous errors diff --git a/src/test/ui/macros/cfg.stderr b/src/test/ui/macros/cfg.stderr index a7aca88f3e56..0fdb62922a75 100644 --- a/src/test/ui/macros/cfg.stderr +++ b/src/test/ui/macros/cfg.stderr @@ -1,19 +1,19 @@ error: macro requires a cfg-pattern as an argument --> $DIR/cfg.rs:2:5 | -LL | cfg!(); //~ ERROR macro requires a cfg-pattern +LL | cfg!(); | ^^^^^^^ cfg-pattern required error: expected identifier, found `123` --> $DIR/cfg.rs:3:10 | -LL | cfg!(123); //~ ERROR expected identifier +LL | cfg!(123); | ^^^ expected identifier error[E0565]: literal in `cfg` predicate value must be a string --> $DIR/cfg.rs:4:16 | -LL | cfg!(foo = 123); //~ ERROR literal in `cfg` predicate value must be a string +LL | cfg!(foo = 123); | ^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/macros/format-foreign.stderr b/src/test/ui/macros/format-foreign.stderr index 0b8bfcbdc17b..87cadada3c78 100644 --- a/src/test/ui/macros/format-foreign.stderr +++ b/src/test/ui/macros/format-foreign.stderr @@ -1,7 +1,7 @@ error: multiple unused formatting arguments --> $DIR/format-foreign.rs:2:30 | -LL | println!("%.*3$s %s!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments +LL | println!("%.*3$s %s!/n", "Hello,", "World", 4); | -------------- ^^^^^^^^ ^^^^^^^ ^ argument never used | | | | | | | argument never used @@ -11,13 +11,13 @@ LL | println!("%.*3$s %s!/n", "Hello,", "World", 4); //~ ERROR multiple unus = note: printf formatting not supported; see the documentation for `std::fmt` help: format specifiers use curly braces | -LL | println!("{:.2$} {}!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments +LL | println!("{:.2$} {}!/n", "Hello,", "World", 4); | ^^^^^^ ^^ error: argument never used --> $DIR/format-foreign.rs:3:29 | -LL | println!("%1$*2$.*3$f", 123.456); //~ ERROR never used +LL | println!("%1$*2$.*3$f", 123.456); | ----------- ^^^^^^^ argument never used | | | help: format specifiers use curly braces: `{0:1$.2$}` @@ -47,7 +47,7 @@ LL | {}!/n error: argument never used --> $DIR/format-foreign.rs:12:30 | -LL | println!("{} %f", "one", 2.0); //~ ERROR never used +LL | println!("{} %f", "one", 2.0); | ------- ^^^ argument never used | | | formatting specifier missing @@ -55,7 +55,7 @@ LL | println!("{} %f", "one", 2.0); //~ ERROR never used error: named argument never used --> $DIR/format-foreign.rs:14:39 | -LL | println!("Hi there, $NAME.", NAME="Tim"); //~ ERROR never used +LL | println!("Hi there, $NAME.", NAME="Tim"); | ----- ^^^^^ named argument never used | | | help: format specifiers use curly braces: `{NAME}` diff --git a/src/test/ui/macros/format-parse-errors.stderr b/src/test/ui/macros/format-parse-errors.stderr index a3d2786bce11..b634cf2d9944 100644 --- a/src/test/ui/macros/format-parse-errors.stderr +++ b/src/test/ui/macros/format-parse-errors.stderr @@ -1,7 +1,7 @@ error: requires at least a format string argument --> $DIR/format-parse-errors.rs:2:5 | -LL | format!(); //~ ERROR requires at least a format string argument +LL | format!(); | ^^^^^^^^^^ | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) @@ -9,41 +9,41 @@ LL | format!(); //~ ERROR requires at least a format string argument error: expected expression, found keyword `struct` --> $DIR/format-parse-errors.rs:3:13 | -LL | format!(struct); //~ ERROR expected expression +LL | format!(struct); | ^^^^^^ expected expression error: expected expression, found `` --> $DIR/format-parse-errors.rs:4:23 | -LL | format!("s", name =); //~ ERROR expected expression +LL | format!("s", name =); | ^ expected expression error: expected `=`, found `` --> $DIR/format-parse-errors.rs:5:29 | -LL | format!("s", foo = foo, bar); //~ ERROR expected `=` +LL | format!("s", foo = foo, bar); | ^^^ expected `=` error: expected expression, found keyword `struct` --> $DIR/format-parse-errors.rs:6:24 | -LL | format!("s", foo = struct); //~ ERROR expected expression +LL | format!("s", foo = struct); | ^^^^^^ expected expression error: expected expression, found keyword `struct` --> $DIR/format-parse-errors.rs:7:18 | -LL | format!("s", struct); //~ ERROR expected expression +LL | format!("s", struct); | ^^^^^^ expected expression error: format argument must be a string literal --> $DIR/format-parse-errors.rs:10:13 | -LL | format!(123); //~ ERROR format argument must be a string literal +LL | format!(123); | ^^^ help: you might be missing a string literal to format with | -LL | format!("{}", 123); //~ ERROR format argument must be a string literal +LL | format!("{}", 123); | ^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/macros/format-unused-lables.stderr b/src/test/ui/macros/format-unused-lables.stderr index 0a5e379a4adb..7423c7b7c8b4 100644 --- a/src/test/ui/macros/format-unused-lables.stderr +++ b/src/test/ui/macros/format-unused-lables.stderr @@ -13,7 +13,7 @@ error: multiple unused formatting arguments | LL | println!("Test2", | ------- multiple missing formatting specifiers -LL | 123, //~ ERROR multiple unused formatting arguments +LL | 123, | ^^^ argument never used LL | 456, | ^^^ argument never used @@ -23,7 +23,7 @@ LL | 789 error: named argument never used --> $DIR/format-unused-lables.rs:11:35 | -LL | println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used +LL | println!("Some stuff", UNUSED="args"); | ------------ ^^^^^^ named argument never used | | | formatting specifier missing @@ -36,7 +36,7 @@ LL | println!("Some more $STUFF", | | | | | help: format specifiers use curly braces: `{STUFF}` | multiple missing formatting specifiers -LL | "woo!", //~ ERROR multiple unused formatting arguments +LL | "woo!", | ^^^^^^ argument never used LL | STUFF= LL | "things" diff --git a/src/test/ui/macros/global-asm.stderr b/src/test/ui/macros/global-asm.stderr index 94664c96db39..c43bf83fe191 100644 --- a/src/test/ui/macros/global-asm.stderr +++ b/src/test/ui/macros/global-asm.stderr @@ -1,19 +1,19 @@ error: macro requires a string literal as an argument --> $DIR/global-asm.rs:4:5 | -LL | global_asm!(); //~ ERROR requires a string literal as an argument +LL | global_asm!(); | ^^^^^^^^^^^^^^ string literal required error: expected expression, found keyword `struct` --> $DIR/global-asm.rs:5:17 | -LL | global_asm!(struct); //~ ERROR expected expression +LL | global_asm!(struct); | ^^^^^^ expected expression error: inline assembly must be a string literal --> $DIR/global-asm.rs:6:17 | -LL | global_asm!(123); //~ ERROR inline assembly must be a string literal +LL | global_asm!(123); | ^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/macros/issue-54441.stderr b/src/test/ui/macros/issue-54441.stderr index e27056b412a0..b0fafdc3b632 100644 --- a/src/test/ui/macros/issue-54441.stderr +++ b/src/test/ui/macros/issue-54441.stderr @@ -1,7 +1,7 @@ error: expected one of `crate`, `fn`, `pub`, `static`, or `type`, found `let` --> $DIR/issue-54441.rs:5:9 | -LL | let //~ ERROR expected +LL | let | ^^^ unexpected token ... LL | m!(); diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr index cb0a9163b747..e78f2833078c 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr +++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr @@ -1,7 +1,7 @@ error: expected `*` or `+` --> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:6:10 | -LL | ($(a)?) => {} //~ERROR expected `*` or `+` +LL | ($(a)?) => {} | ^ | = note: `?` is not a macro repetition operator in the 2015 edition, but is accepted in the 2018 edition @@ -9,7 +9,7 @@ LL | ($(a)?) => {} //~ERROR expected `*` or `+` error: expected `*` or `+` --> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:10:11 | -LL | ($(a),?) => {} //~ERROR expected `*` or `+` +LL | ($(a),?) => {} | ^ | = note: `?` is not a macro repetition operator in the 2015 edition, but is accepted in the 2018 edition diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr index b171cf8b34df..bf1861ae5405 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr +++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr @@ -1,7 +1,7 @@ warning: using `?` as a separator is deprecated and will be a hard error in an upcoming edition --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:10:10 | -LL | ($(a)?*) => {} //~WARN using `?` as a separator +LL | ($(a)?*) => {} | ^ | note: lint level defined here @@ -16,7 +16,7 @@ LL | #![warn(rust_2018_compatibility)] warning: using `?` as a separator is deprecated and will be a hard error in an upcoming edition --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:15:10 | -LL | ($(a)?+) => {} //~WARN using `?` as a separator +LL | ($(a)?+) => {} | ^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! diff --git a/src/test/ui/macros/macro-at-most-once-rep-2018.stderr b/src/test/ui/macros/macro-at-most-once-rep-2018.stderr index 657c7e54d976..f285c7cc7c27 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2018.stderr +++ b/src/test/ui/macros/macro-at-most-once-rep-2018.stderr @@ -1,7 +1,7 @@ error: the `?` macro repetition operator does not take a separator --> $DIR/macro-at-most-once-rep-2018.rs:10:10 | -LL | ($(a),?) => {}; //~ERROR the `?` macro repetition operator +LL | ($(a),?) => {}; | ^ error: no rules expected the token `?` @@ -10,7 +10,7 @@ error: no rules expected the token `?` LL | macro_rules! foo { | ---------------- when calling this macro ... -LL | foo!(a?); //~ ERROR no rules expected the token `?` +LL | foo!(a?); | ^ no rules expected this token in macro call error: no rules expected the token `?` @@ -19,7 +19,7 @@ error: no rules expected the token `?` LL | macro_rules! foo { | ---------------- when calling this macro ... -LL | foo!(a?a); //~ ERROR no rules expected the token `?` +LL | foo!(a?a); | ^ no rules expected this token in macro call error: no rules expected the token `?` @@ -28,7 +28,7 @@ error: no rules expected the token `?` LL | macro_rules! foo { | ---------------- when calling this macro ... -LL | foo!(a?a?a); //~ ERROR no rules expected the token `?` +LL | foo!(a?a?a); | ^ no rules expected this token in macro call error: unexpected end of macro invocation @@ -37,7 +37,7 @@ error: unexpected end of macro invocation LL | macro_rules! barplus { | -------------------- when calling this macro ... -LL | barplus!(); //~ERROR unexpected end of macro invocation +LL | barplus!(); | ^^^^^^^^^^^ missing tokens in macro arguments error: unexpected end of macro invocation @@ -46,7 +46,7 @@ error: unexpected end of macro invocation LL | macro_rules! barplus { | -------------------- when calling this macro ... -LL | barplus!(a); //~ERROR unexpected end of macro invocation +LL | barplus!(a); | ^ missing tokens in macro arguments error: no rules expected the token `?` @@ -55,7 +55,7 @@ error: no rules expected the token `?` LL | macro_rules! barplus { | -------------------- when calling this macro ... -LL | barplus!(a?); //~ ERROR no rules expected the token `?` +LL | barplus!(a?); | ^ no rules expected this token in macro call error: no rules expected the token `?` @@ -64,7 +64,7 @@ error: no rules expected the token `?` LL | macro_rules! barplus { | -------------------- when calling this macro ... -LL | barplus!(a?a); //~ ERROR no rules expected the token `?` +LL | barplus!(a?a); | ^ no rules expected this token in macro call error: unexpected end of macro invocation @@ -73,7 +73,7 @@ error: unexpected end of macro invocation LL | macro_rules! barstar { | -------------------- when calling this macro ... -LL | barstar!(); //~ERROR unexpected end of macro invocation +LL | barstar!(); | ^^^^^^^^^^^ missing tokens in macro arguments error: unexpected end of macro invocation @@ -82,7 +82,7 @@ error: unexpected end of macro invocation LL | macro_rules! barstar { | -------------------- when calling this macro ... -LL | barstar!(a); //~ERROR unexpected end of macro invocation +LL | barstar!(a); | ^ missing tokens in macro arguments error: no rules expected the token `?` @@ -91,7 +91,7 @@ error: no rules expected the token `?` LL | macro_rules! barstar { | -------------------- when calling this macro ... -LL | barstar!(a?); //~ ERROR no rules expected the token `?` +LL | barstar!(a?); | ^ no rules expected this token in macro call error: no rules expected the token `?` @@ -100,7 +100,7 @@ error: no rules expected the token `?` LL | macro_rules! barstar { | -------------------- when calling this macro ... -LL | barstar!(a?a); //~ ERROR no rules expected the token `?` +LL | barstar!(a?a); | ^ no rules expected this token in macro call error: aborting due to 12 previous errors diff --git a/src/test/ui/macros/macro-attribute.stderr b/src/test/ui/macros/macro-attribute.stderr index 7314e4833489..aa1cd94b0c63 100644 --- a/src/test/ui/macros/macro-attribute.stderr +++ b/src/test/ui/macros/macro-attribute.stderr @@ -1,7 +1,7 @@ error: unexpected token: `$` --> $DIR/macro-attribute.rs:1:7 | -LL | #[doc = $not_there] //~ ERROR unexpected token: `$` +LL | #[doc = $not_there] | ^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr index 353ae1d0ea69..11a4b44eff10 100644 --- a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr +++ b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:5:13 | -LL | 1.fake() //~ ERROR no method +LL | 1.fake() | ^^^^ ... LL | fake_method_stmt!(); @@ -10,7 +10,7 @@ LL | fake_method_stmt!(); error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:11:13 | -LL | 1.fake //~ ERROR doesn't have fields +LL | 1.fake | ^^^^ ... LL | fake_field_stmt!(); @@ -19,7 +19,7 @@ LL | fake_field_stmt!(); error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:17:15 | -LL | (1).0 //~ ERROR doesn't have fields +LL | (1).0 | ^ ... LL | fake_anon_field_stmt!(); @@ -28,20 +28,20 @@ LL | fake_anon_field_stmt!(); error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` --> $DIR/macro-backtrace-invalid-internals.rs:41:15 | -LL | 2.0.neg() //~ ERROR can't call method `neg` on ambiguous numeric type `{float}` +LL | 2.0.neg() | ^^^ ... LL | real_method_stmt!(); | -------------------- in this macro invocation help: you must specify a concrete type for this numeric value, like `f32` | -LL | 2.0_f32.neg() //~ ERROR can't call method `neg` on ambiguous numeric type `{float}` +LL | 2.0_f32.neg() | ^^^^^^^ error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:23:13 | -LL | 1.fake() //~ ERROR no method +LL | 1.fake() | ^^^^ ... LL | let _ = fake_method_expr!(); @@ -50,7 +50,7 @@ LL | let _ = fake_method_expr!(); error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:29:13 | -LL | 1.fake //~ ERROR doesn't have fields +LL | 1.fake | ^^^^ ... LL | let _ = fake_field_expr!(); @@ -59,7 +59,7 @@ LL | let _ = fake_field_expr!(); error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:35:15 | -LL | (1).0 //~ ERROR doesn't have fields +LL | (1).0 | ^ ... LL | let _ = fake_anon_field_expr!(); @@ -68,14 +68,14 @@ LL | let _ = fake_anon_field_expr!(); error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` --> $DIR/macro-backtrace-invalid-internals.rs:47:15 | -LL | 2.0.neg() //~ ERROR can't call method `neg` on ambiguous numeric type `{float}` +LL | 2.0.neg() | ^^^ ... LL | let _ = real_method_expr!(); | ------------------- in this macro invocation help: you must specify a concrete type for this numeric value, like `f32` | -LL | 2.0_f32.neg() //~ ERROR can't call method `neg` on ambiguous numeric type `{float}` +LL | 2.0_f32.neg() | ^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/macros/macro-backtrace-nested.stderr b/src/test/ui/macros/macro-backtrace-nested.stderr index 61a11231efef..501f525a05f7 100644 --- a/src/test/ui/macros/macro-backtrace-nested.stderr +++ b/src/test/ui/macros/macro-backtrace-nested.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `fake` in this scope --> $DIR/macro-backtrace-nested.rs:5:12 | -LL | () => (fake) //~ ERROR cannot find +LL | () => (fake) | ^^^^ not found in this scope ... LL | 1 + call_nested_expr!(); @@ -10,7 +10,7 @@ LL | 1 + call_nested_expr!(); error[E0425]: cannot find value `fake` in this scope --> $DIR/macro-backtrace-nested.rs:5:12 | -LL | () => (fake) //~ ERROR cannot find +LL | () => (fake) | ^^^^ not found in this scope ... LL | call_nested_expr_sum!(); diff --git a/src/test/ui/macros/macro-backtrace-println.stderr b/src/test/ui/macros/macro-backtrace-println.stderr index c24a88c4159f..573184b63b1e 100644 --- a/src/test/ui/macros/macro-backtrace-println.stderr +++ b/src/test/ui/macros/macro-backtrace-println.stderr @@ -1,7 +1,7 @@ error: 1 positional argument in format string, but no arguments were given --> $DIR/macro-backtrace-println.rs:14:30 | -LL | ($fmt:expr) => (myprint!(concat!($fmt, "/n"))); //~ ERROR no arguments were given +LL | ($fmt:expr) => (myprint!(concat!($fmt, "/n"))); | ^^^^^^^^^^^^^^^^^^^ ... LL | myprintln!("{}"); diff --git a/src/test/ui/macros/macro-comma-support.stderr b/src/test/ui/macros/macro-comma-support.stderr index a4bb8a9b32fb..28d064f7f5bd 100644 --- a/src/test/ui/macros/macro-comma-support.stderr +++ b/src/test/ui/macros/macro-comma-support.stderr @@ -1,13 +1,13 @@ error: lel --> $DIR/macro-comma-support.rs:6:5 | -LL | compile_error!("lel"); //~ ERROR lel +LL | compile_error!("lel"); | ^^^^^^^^^^^^^^^^^^^^^^ error: lel --> $DIR/macro-comma-support.rs:7:5 | -LL | compile_error!("lel",); //~ ERROR lel +LL | compile_error!("lel",); | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/macros/macro-context.stderr b/src/test/ui/macros/macro-context.stderr index 9a4a8e31985f..2a0779190f57 100644 --- a/src/test/ui/macros/macro-context.stderr +++ b/src/test/ui/macros/macro-context.stderr @@ -1,7 +1,7 @@ error: macro expansion ignores token `;` and any following --> $DIR/macro-context.rs:3:15 | -LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` +LL | () => ( i ; typeof ); | ^ ... LL | let a: m!(); @@ -12,7 +12,7 @@ LL | let a: m!(); error: macro expansion ignores token `typeof` and any following --> $DIR/macro-context.rs:3:17 | -LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` +LL | () => ( i ; typeof ); | ^^^^^^ ... LL | let i = m!(); @@ -23,7 +23,7 @@ LL | let i = m!(); error: macro expansion ignores token `;` and any following --> $DIR/macro-context.rs:3:15 | -LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` +LL | () => ( i ; typeof ); | ^ ... LL | m!() => {} @@ -34,7 +34,7 @@ LL | m!() => {} error: expected expression, found reserved keyword `typeof` --> $DIR/macro-context.rs:3:17 | -LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` +LL | () => ( i ; typeof ); | ^^^^^^ expected expression ... LL | m!(); diff --git a/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr b/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr index a1af9ba17584..1eca0186da95 100644 --- a/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr +++ b/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr @@ -1,7 +1,7 @@ error[E0468]: an `extern crate` loading macros must be at the crate root --> $DIR/macro-crate-nonterminal-non-root.rs:5:5 | -LL | extern crate macro_crate_nonterminal; //~ ERROR must be at the crate root +LL | extern crate macro_crate_nonterminal; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-error.stderr b/src/test/ui/macros/macro-error.stderr index f56b67e7cd06..b3aed8c2cef2 100644 --- a/src/test/ui/macros/macro-error.stderr +++ b/src/test/ui/macros/macro-error.stderr @@ -1,13 +1,13 @@ error: macro rhs must be delimited --> $DIR/macro-error.rs:2:18 | -LL | ($a:expr) => a; //~ ERROR macro rhs must be delimited +LL | ($a:expr) => a; | ^ error: non-type macro in type position: cfg --> $DIR/macro-error.rs:8:12 | -LL | let _: cfg!(foo) = (); //~ ERROR non-type macro in type position +LL | let _: cfg!(foo) = (); | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/macros/macro-follow.stderr b/src/test/ui/macros/macro-follow.stderr index e3302eac4ac0..d3f081bb4a28 100644 --- a/src/test/ui/macros/macro-follow.stderr +++ b/src/test/ui/macros/macro-follow.stderr @@ -1,7 +1,7 @@ error: `$p:pat` is followed by `(`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:8:14 | -LL | ($p:pat ()) => {}; //~ERROR `$p:pat` is followed by `(` +LL | ($p:pat ()) => {}; | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -9,7 +9,7 @@ LL | ($p:pat ()) => {}; //~ERROR `$p:pat` is followed by `(` error: `$p:pat` is followed by `[`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:9:14 | -LL | ($p:pat []) => {}; //~ERROR `$p:pat` is followed by `[` +LL | ($p:pat []) => {}; | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -17,7 +17,7 @@ LL | ($p:pat []) => {}; //~ERROR `$p:pat` is followed by `[` error: `$p:pat` is followed by `{`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:10:14 | -LL | ($p:pat {}) => {}; //~ERROR `$p:pat` is followed by `{` +LL | ($p:pat {}) => {}; | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -25,7 +25,7 @@ LL | ($p:pat {}) => {}; //~ERROR `$p:pat` is followed by `{` error: `$p:pat` is followed by `:`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:11:13 | -LL | ($p:pat :) => {}; //~ERROR `$p:pat` is followed by `:` +LL | ($p:pat :) => {}; | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -33,7 +33,7 @@ LL | ($p:pat :) => {}; //~ERROR `$p:pat` is followed by `:` error: `$p:pat` is followed by `>`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:12:13 | -LL | ($p:pat >) => {}; //~ERROR `$p:pat` is followed by `>` +LL | ($p:pat >) => {}; | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -41,7 +41,7 @@ LL | ($p:pat >) => {}; //~ERROR `$p:pat` is followed by `>` error: `$p:pat` is followed by `+`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:13:13 | -LL | ($p:pat +) => {}; //~ERROR `$p:pat` is followed by `+` +LL | ($p:pat +) => {}; | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -49,7 +49,7 @@ LL | ($p:pat +) => {}; //~ERROR `$p:pat` is followed by `+` error: `$p:pat` is followed by `ident`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:14:13 | -LL | ($p:pat ident) => {}; //~ERROR `$p:pat` is followed by `ident` +LL | ($p:pat ident) => {}; | ^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -57,7 +57,7 @@ LL | ($p:pat ident) => {}; //~ERROR `$p:pat` is followed by `ident` error: `$p:pat` is followed by `$q:pat`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:15:13 | -LL | ($p:pat $q:pat) => {}; //~ERROR `$p:pat` is followed by `$q:pat` +LL | ($p:pat $q:pat) => {}; | ^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -65,7 +65,7 @@ LL | ($p:pat $q:pat) => {}; //~ERROR `$p:pat` is followed by `$q:pat` error: `$p:pat` is followed by `$e:expr`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:16:13 | -LL | ($p:pat $e:expr) => {}; //~ERROR `$p:pat` is followed by `$e:expr` +LL | ($p:pat $e:expr) => {}; | ^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -73,7 +73,7 @@ LL | ($p:pat $e:expr) => {}; //~ERROR `$p:pat` is followed by `$e:expr` error: `$p:pat` is followed by `$t:ty`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:17:13 | -LL | ($p:pat $t:ty) => {}; //~ERROR `$p:pat` is followed by `$t:ty` +LL | ($p:pat $t:ty) => {}; | ^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -81,7 +81,7 @@ LL | ($p:pat $t:ty) => {}; //~ERROR `$p:pat` is followed by `$t:ty` error: `$p:pat` is followed by `$s:stmt`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:18:13 | -LL | ($p:pat $s:stmt) => {}; //~ERROR `$p:pat` is followed by `$s:stmt` +LL | ($p:pat $s:stmt) => {}; | ^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -89,7 +89,7 @@ LL | ($p:pat $s:stmt) => {}; //~ERROR `$p:pat` is followed by `$s:stmt` error: `$p:pat` is followed by `$q:path`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:19:13 | -LL | ($p:pat $q:path) => {}; //~ERROR `$p:pat` is followed by `$q:path` +LL | ($p:pat $q:path) => {}; | ^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -97,7 +97,7 @@ LL | ($p:pat $q:path) => {}; //~ERROR `$p:pat` is followed by `$q:path` error: `$p:pat` is followed by `$b:block`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:20:13 | -LL | ($p:pat $b:block) => {}; //~ERROR `$p:pat` is followed by `$b:block` +LL | ($p:pat $b:block) => {}; | ^^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -105,7 +105,7 @@ LL | ($p:pat $b:block) => {}; //~ERROR `$p:pat` is followed by `$b:block` error: `$p:pat` is followed by `$i:ident`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:21:13 | -LL | ($p:pat $i:ident) => {}; //~ERROR `$p:pat` is followed by `$i:ident` +LL | ($p:pat $i:ident) => {}; | ^^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -113,7 +113,7 @@ LL | ($p:pat $i:ident) => {}; //~ERROR `$p:pat` is followed by `$i:ident` error: `$p:pat` is followed by `$t:tt`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:22:13 | -LL | ($p:pat $t:tt) => {}; //~ERROR `$p:pat` is followed by `$t:tt` +LL | ($p:pat $t:tt) => {}; | ^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -121,7 +121,7 @@ LL | ($p:pat $t:tt) => {}; //~ERROR `$p:pat` is followed by `$t:tt` error: `$p:pat` is followed by `$i:item`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:23:13 | -LL | ($p:pat $i:item) => {}; //~ERROR `$p:pat` is followed by `$i:item` +LL | ($p:pat $i:item) => {}; | ^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -129,7 +129,7 @@ LL | ($p:pat $i:item) => {}; //~ERROR `$p:pat` is followed by `$i:item` error: `$p:pat` is followed by `$m:meta`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:24:13 | -LL | ($p:pat $m:meta) => {}; //~ERROR `$p:pat` is followed by `$m:meta` +LL | ($p:pat $m:meta) => {}; | ^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -137,7 +137,7 @@ LL | ($p:pat $m:meta) => {}; //~ERROR `$p:pat` is followed by `$m:meta` error: `$e:expr` is followed by `(`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:28:15 | -LL | ($e:expr ()) => {}; //~ERROR `$e:expr` is followed by `(` +LL | ($e:expr ()) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -145,7 +145,7 @@ LL | ($e:expr ()) => {}; //~ERROR `$e:expr` is followed by `(` error: `$e:expr` is followed by `[`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:29:15 | -LL | ($e:expr []) => {}; //~ERROR `$e:expr` is followed by `[` +LL | ($e:expr []) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -153,7 +153,7 @@ LL | ($e:expr []) => {}; //~ERROR `$e:expr` is followed by `[` error: `$e:expr` is followed by `{`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:30:15 | -LL | ($e:expr {}) => {}; //~ERROR `$e:expr` is followed by `{` +LL | ($e:expr {}) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -161,7 +161,7 @@ LL | ($e:expr {}) => {}; //~ERROR `$e:expr` is followed by `{` error: `$e:expr` is followed by `=`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:31:14 | -LL | ($e:expr =) => {}; //~ERROR `$e:expr` is followed by `=` +LL | ($e:expr =) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -169,7 +169,7 @@ LL | ($e:expr =) => {}; //~ERROR `$e:expr` is followed by `=` error: `$e:expr` is followed by `|`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:32:14 | -LL | ($e:expr |) => {}; //~ERROR `$e:expr` is followed by `|` +LL | ($e:expr |) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -177,7 +177,7 @@ LL | ($e:expr |) => {}; //~ERROR `$e:expr` is followed by `|` error: `$e:expr` is followed by `:`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:33:14 | -LL | ($e:expr :) => {}; //~ERROR `$e:expr` is followed by `:` +LL | ($e:expr :) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -185,7 +185,7 @@ LL | ($e:expr :) => {}; //~ERROR `$e:expr` is followed by `:` error: `$e:expr` is followed by `>`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:34:14 | -LL | ($e:expr >) => {}; //~ERROR `$e:expr` is followed by `>` +LL | ($e:expr >) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -193,7 +193,7 @@ LL | ($e:expr >) => {}; //~ERROR `$e:expr` is followed by `>` error: `$e:expr` is followed by `+`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:35:14 | -LL | ($e:expr +) => {}; //~ERROR `$e:expr` is followed by `+` +LL | ($e:expr +) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -201,7 +201,7 @@ LL | ($e:expr +) => {}; //~ERROR `$e:expr` is followed by `+` error: `$e:expr` is followed by `ident`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:36:14 | -LL | ($e:expr ident) => {}; //~ERROR `$e:expr` is followed by `ident` +LL | ($e:expr ident) => {}; | ^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -209,7 +209,7 @@ LL | ($e:expr ident) => {}; //~ERROR `$e:expr` is followed by `ident` error: `$e:expr` is followed by `if`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:37:14 | -LL | ($e:expr if) => {}; //~ERROR `$e:expr` is followed by `if` +LL | ($e:expr if) => {}; | ^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -217,7 +217,7 @@ LL | ($e:expr if) => {}; //~ERROR `$e:expr` is followed by `if` error: `$e:expr` is followed by `in`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:38:14 | -LL | ($e:expr in) => {}; //~ERROR `$e:expr` is followed by `in` +LL | ($e:expr in) => {}; | ^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -225,7 +225,7 @@ LL | ($e:expr in) => {}; //~ERROR `$e:expr` is followed by `in` error: `$e:expr` is followed by `$p:pat`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:39:14 | -LL | ($e:expr $p:pat) => {}; //~ERROR `$e:expr` is followed by `$p:pat` +LL | ($e:expr $p:pat) => {}; | ^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -233,7 +233,7 @@ LL | ($e:expr $p:pat) => {}; //~ERROR `$e:expr` is followed by `$p:pat` error: `$e:expr` is followed by `$f:expr`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:40:14 | -LL | ($e:expr $f:expr) => {}; //~ERROR `$e:expr` is followed by `$f:expr` +LL | ($e:expr $f:expr) => {}; | ^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -241,7 +241,7 @@ LL | ($e:expr $f:expr) => {}; //~ERROR `$e:expr` is followed by `$f:expr` error: `$e:expr` is followed by `$t:ty`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:41:14 | -LL | ($e:expr $t:ty) => {}; //~ERROR `$e:expr` is followed by `$t:ty` +LL | ($e:expr $t:ty) => {}; | ^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -249,7 +249,7 @@ LL | ($e:expr $t:ty) => {}; //~ERROR `$e:expr` is followed by `$t:ty` error: `$e:expr` is followed by `$s:stmt`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:42:14 | -LL | ($e:expr $s:stmt) => {}; //~ERROR `$e:expr` is followed by `$s:stmt` +LL | ($e:expr $s:stmt) => {}; | ^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -257,7 +257,7 @@ LL | ($e:expr $s:stmt) => {}; //~ERROR `$e:expr` is followed by `$s:stmt` error: `$e:expr` is followed by `$p:path`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:43:14 | -LL | ($e:expr $p:path) => {}; //~ERROR `$e:expr` is followed by `$p:path` +LL | ($e:expr $p:path) => {}; | ^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -265,7 +265,7 @@ LL | ($e:expr $p:path) => {}; //~ERROR `$e:expr` is followed by `$p:path` error: `$e:expr` is followed by `$b:block`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:44:14 | -LL | ($e:expr $b:block) => {}; //~ERROR `$e:expr` is followed by `$b:block` +LL | ($e:expr $b:block) => {}; | ^^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -273,7 +273,7 @@ LL | ($e:expr $b:block) => {}; //~ERROR `$e:expr` is followed by `$b:block` error: `$e:expr` is followed by `$i:ident`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:45:14 | -LL | ($e:expr $i:ident) => {}; //~ERROR `$e:expr` is followed by `$i:ident` +LL | ($e:expr $i:ident) => {}; | ^^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -281,7 +281,7 @@ LL | ($e:expr $i:ident) => {}; //~ERROR `$e:expr` is followed by `$i:ident` error: `$e:expr` is followed by `$t:tt`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:46:14 | -LL | ($e:expr $t:tt) => {}; //~ERROR `$e:expr` is followed by `$t:tt` +LL | ($e:expr $t:tt) => {}; | ^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -289,7 +289,7 @@ LL | ($e:expr $t:tt) => {}; //~ERROR `$e:expr` is followed by `$t:tt` error: `$e:expr` is followed by `$i:item`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:47:14 | -LL | ($e:expr $i:item) => {}; //~ERROR `$e:expr` is followed by `$i:item` +LL | ($e:expr $i:item) => {}; | ^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -297,7 +297,7 @@ LL | ($e:expr $i:item) => {}; //~ERROR `$e:expr` is followed by `$i:item` error: `$e:expr` is followed by `$m:meta`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:48:14 | -LL | ($e:expr $m:meta) => {}; //~ERROR `$e:expr` is followed by `$m:meta` +LL | ($e:expr $m:meta) => {}; | ^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -305,7 +305,7 @@ LL | ($e:expr $m:meta) => {}; //~ERROR `$e:expr` is followed by `$m:meta` error: `$t:ty` is followed by `(`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:53:13 | -LL | ($t:ty ()) => {}; //~ERROR `$t:ty` is followed by `(` +LL | ($t:ty ()) => {}; | ^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -313,7 +313,7 @@ LL | ($t:ty ()) => {}; //~ERROR `$t:ty` is followed by `(` error: `$t:ty` is followed by `+`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:55:12 | -LL | ($t:ty +) => {}; //~ERROR `$t:ty` is followed by `+` +LL | ($t:ty +) => {}; | ^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -321,7 +321,7 @@ LL | ($t:ty +) => {}; //~ERROR `$t:ty` is followed by `+` error: `$t:ty` is followed by `ident`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:56:12 | -LL | ($t:ty ident) => {}; //~ERROR `$t:ty` is followed by `ident` +LL | ($t:ty ident) => {}; | ^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -329,7 +329,7 @@ LL | ($t:ty ident) => {}; //~ERROR `$t:ty` is followed by `ident` error: `$t:ty` is followed by `if`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:57:12 | -LL | ($t:ty if) => {}; //~ERROR `$t:ty` is followed by `if` +LL | ($t:ty if) => {}; | ^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -337,7 +337,7 @@ LL | ($t:ty if) => {}; //~ERROR `$t:ty` is followed by `if` error: `$t:ty` is followed by `$p:pat`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:58:12 | -LL | ($t:ty $p:pat) => {}; //~ERROR `$t:ty` is followed by `$p:pat` +LL | ($t:ty $p:pat) => {}; | ^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -345,7 +345,7 @@ LL | ($t:ty $p:pat) => {}; //~ERROR `$t:ty` is followed by `$p:pat` error: `$t:ty` is followed by `$e:expr`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:59:12 | -LL | ($t:ty $e:expr) => {}; //~ERROR `$t:ty` is followed by `$e:expr` +LL | ($t:ty $e:expr) => {}; | ^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -353,7 +353,7 @@ LL | ($t:ty $e:expr) => {}; //~ERROR `$t:ty` is followed by `$e:expr` error: `$t:ty` is followed by `$r:ty`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:60:12 | -LL | ($t:ty $r:ty) => {}; //~ERROR `$t:ty` is followed by `$r:ty` +LL | ($t:ty $r:ty) => {}; | ^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -361,7 +361,7 @@ LL | ($t:ty $r:ty) => {}; //~ERROR `$t:ty` is followed by `$r:ty` error: `$t:ty` is followed by `$s:stmt`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:61:12 | -LL | ($t:ty $s:stmt) => {}; //~ERROR `$t:ty` is followed by `$s:stmt` +LL | ($t:ty $s:stmt) => {}; | ^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -369,7 +369,7 @@ LL | ($t:ty $s:stmt) => {}; //~ERROR `$t:ty` is followed by `$s:stmt` error: `$t:ty` is followed by `$p:path`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:62:12 | -LL | ($t:ty $p:path) => {}; //~ERROR `$t:ty` is followed by `$p:path` +LL | ($t:ty $p:path) => {}; | ^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -377,7 +377,7 @@ LL | ($t:ty $p:path) => {}; //~ERROR `$t:ty` is followed by `$p:path` error: `$t:ty` is followed by `$i:ident`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:64:12 | -LL | ($t:ty $i:ident) => {}; //~ERROR `$t:ty` is followed by `$i:ident` +LL | ($t:ty $i:ident) => {}; | ^^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -385,7 +385,7 @@ LL | ($t:ty $i:ident) => {}; //~ERROR `$t:ty` is followed by `$i:ident` error: `$t:ty` is followed by `$r:tt`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:65:12 | -LL | ($t:ty $r:tt) => {}; //~ERROR `$t:ty` is followed by `$r:tt` +LL | ($t:ty $r:tt) => {}; | ^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -393,7 +393,7 @@ LL | ($t:ty $r:tt) => {}; //~ERROR `$t:ty` is followed by `$r:tt` error: `$t:ty` is followed by `$i:item`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:66:12 | -LL | ($t:ty $i:item) => {}; //~ERROR `$t:ty` is followed by `$i:item` +LL | ($t:ty $i:item) => {}; | ^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -401,7 +401,7 @@ LL | ($t:ty $i:item) => {}; //~ERROR `$t:ty` is followed by `$i:item` error: `$t:ty` is followed by `$m:meta`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:67:12 | -LL | ($t:ty $m:meta) => {}; //~ERROR `$t:ty` is followed by `$m:meta` +LL | ($t:ty $m:meta) => {}; | ^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -409,7 +409,7 @@ LL | ($t:ty $m:meta) => {}; //~ERROR `$t:ty` is followed by `$m:meta` error: `$s:stmt` is followed by `(`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:71:15 | -LL | ($s:stmt ()) => {}; //~ERROR `$s:stmt` is followed by `(` +LL | ($s:stmt ()) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -417,7 +417,7 @@ LL | ($s:stmt ()) => {}; //~ERROR `$s:stmt` is followed by `(` error: `$s:stmt` is followed by `[`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:72:15 | -LL | ($s:stmt []) => {}; //~ERROR `$s:stmt` is followed by `[` +LL | ($s:stmt []) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -425,7 +425,7 @@ LL | ($s:stmt []) => {}; //~ERROR `$s:stmt` is followed by `[` error: `$s:stmt` is followed by `{`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:73:15 | -LL | ($s:stmt {}) => {}; //~ERROR `$s:stmt` is followed by `{` +LL | ($s:stmt {}) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -433,7 +433,7 @@ LL | ($s:stmt {}) => {}; //~ERROR `$s:stmt` is followed by `{` error: `$s:stmt` is followed by `=`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:74:14 | -LL | ($s:stmt =) => {}; //~ERROR `$s:stmt` is followed by `=` +LL | ($s:stmt =) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -441,7 +441,7 @@ LL | ($s:stmt =) => {}; //~ERROR `$s:stmt` is followed by `=` error: `$s:stmt` is followed by `|`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:75:14 | -LL | ($s:stmt |) => {}; //~ERROR `$s:stmt` is followed by `|` +LL | ($s:stmt |) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -449,7 +449,7 @@ LL | ($s:stmt |) => {}; //~ERROR `$s:stmt` is followed by `|` error: `$s:stmt` is followed by `:`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:76:14 | -LL | ($s:stmt :) => {}; //~ERROR `$s:stmt` is followed by `:` +LL | ($s:stmt :) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -457,7 +457,7 @@ LL | ($s:stmt :) => {}; //~ERROR `$s:stmt` is followed by `:` error: `$s:stmt` is followed by `>`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:77:14 | -LL | ($s:stmt >) => {}; //~ERROR `$s:stmt` is followed by `>` +LL | ($s:stmt >) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -465,7 +465,7 @@ LL | ($s:stmt >) => {}; //~ERROR `$s:stmt` is followed by `>` error: `$s:stmt` is followed by `+`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:78:14 | -LL | ($s:stmt +) => {}; //~ERROR `$s:stmt` is followed by `+` +LL | ($s:stmt +) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -473,7 +473,7 @@ LL | ($s:stmt +) => {}; //~ERROR `$s:stmt` is followed by `+` error: `$s:stmt` is followed by `ident`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:79:14 | -LL | ($s:stmt ident) => {}; //~ERROR `$s:stmt` is followed by `ident` +LL | ($s:stmt ident) => {}; | ^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -481,7 +481,7 @@ LL | ($s:stmt ident) => {}; //~ERROR `$s:stmt` is followed by `ident` error: `$s:stmt` is followed by `if`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:80:14 | -LL | ($s:stmt if) => {}; //~ERROR `$s:stmt` is followed by `if` +LL | ($s:stmt if) => {}; | ^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -489,7 +489,7 @@ LL | ($s:stmt if) => {}; //~ERROR `$s:stmt` is followed by `if` error: `$s:stmt` is followed by `in`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:81:14 | -LL | ($s:stmt in) => {}; //~ERROR `$s:stmt` is followed by `in` +LL | ($s:stmt in) => {}; | ^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -497,7 +497,7 @@ LL | ($s:stmt in) => {}; //~ERROR `$s:stmt` is followed by `in` error: `$s:stmt` is followed by `$p:pat`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:82:14 | -LL | ($s:stmt $p:pat) => {}; //~ERROR `$s:stmt` is followed by `$p:pat` +LL | ($s:stmt $p:pat) => {}; | ^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -505,7 +505,7 @@ LL | ($s:stmt $p:pat) => {}; //~ERROR `$s:stmt` is followed by `$p:pat` error: `$s:stmt` is followed by `$e:expr`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:83:14 | -LL | ($s:stmt $e:expr) => {}; //~ERROR `$s:stmt` is followed by `$e:expr` +LL | ($s:stmt $e:expr) => {}; | ^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -513,7 +513,7 @@ LL | ($s:stmt $e:expr) => {}; //~ERROR `$s:stmt` is followed by `$e:expr` error: `$s:stmt` is followed by `$t:ty`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:84:14 | -LL | ($s:stmt $t:ty) => {}; //~ERROR `$s:stmt` is followed by `$t:ty` +LL | ($s:stmt $t:ty) => {}; | ^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -521,7 +521,7 @@ LL | ($s:stmt $t:ty) => {}; //~ERROR `$s:stmt` is followed by `$t:ty` error: `$s:stmt` is followed by `$t:stmt`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:85:14 | -LL | ($s:stmt $t:stmt) => {}; //~ERROR `$s:stmt` is followed by `$t:stmt` +LL | ($s:stmt $t:stmt) => {}; | ^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -529,7 +529,7 @@ LL | ($s:stmt $t:stmt) => {}; //~ERROR `$s:stmt` is followed by `$t:stmt` error: `$s:stmt` is followed by `$p:path`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:86:14 | -LL | ($s:stmt $p:path) => {}; //~ERROR `$s:stmt` is followed by `$p:path` +LL | ($s:stmt $p:path) => {}; | ^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -537,7 +537,7 @@ LL | ($s:stmt $p:path) => {}; //~ERROR `$s:stmt` is followed by `$p:path` error: `$s:stmt` is followed by `$b:block`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:87:14 | -LL | ($s:stmt $b:block) => {}; //~ERROR `$s:stmt` is followed by `$b:block` +LL | ($s:stmt $b:block) => {}; | ^^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -545,7 +545,7 @@ LL | ($s:stmt $b:block) => {}; //~ERROR `$s:stmt` is followed by `$b:block` error: `$s:stmt` is followed by `$i:ident`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:88:14 | -LL | ($s:stmt $i:ident) => {}; //~ERROR `$s:stmt` is followed by `$i:ident` +LL | ($s:stmt $i:ident) => {}; | ^^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -553,7 +553,7 @@ LL | ($s:stmt $i:ident) => {}; //~ERROR `$s:stmt` is followed by `$i:ident` error: `$s:stmt` is followed by `$t:tt`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:89:14 | -LL | ($s:stmt $t:tt) => {}; //~ERROR `$s:stmt` is followed by `$t:tt` +LL | ($s:stmt $t:tt) => {}; | ^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -561,7 +561,7 @@ LL | ($s:stmt $t:tt) => {}; //~ERROR `$s:stmt` is followed by `$t:tt` error: `$s:stmt` is followed by `$i:item`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:90:14 | -LL | ($s:stmt $i:item) => {}; //~ERROR `$s:stmt` is followed by `$i:item` +LL | ($s:stmt $i:item) => {}; | ^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -569,7 +569,7 @@ LL | ($s:stmt $i:item) => {}; //~ERROR `$s:stmt` is followed by `$i:item` error: `$s:stmt` is followed by `$m:meta`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:91:14 | -LL | ($s:stmt $m:meta) => {}; //~ERROR `$s:stmt` is followed by `$m:meta` +LL | ($s:stmt $m:meta) => {}; | ^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -577,7 +577,7 @@ LL | ($s:stmt $m:meta) => {}; //~ERROR `$s:stmt` is followed by `$m:meta` error: `$p:path` is followed by `(`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:95:15 | -LL | ($p:path ()) => {}; //~ERROR `$p:path` is followed by `(` +LL | ($p:path ()) => {}; | ^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -585,7 +585,7 @@ LL | ($p:path ()) => {}; //~ERROR `$p:path` is followed by `(` error: `$p:path` is followed by `+`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:97:14 | -LL | ($p:path +) => {}; //~ERROR `$p:path` is followed by `+` +LL | ($p:path +) => {}; | ^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -593,7 +593,7 @@ LL | ($p:path +) => {}; //~ERROR `$p:path` is followed by `+` error: `$p:path` is followed by `ident`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:98:14 | -LL | ($p:path ident) => {}; //~ERROR `$p:path` is followed by `ident` +LL | ($p:path ident) => {}; | ^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -601,7 +601,7 @@ LL | ($p:path ident) => {}; //~ERROR `$p:path` is followed by `ident` error: `$p:path` is followed by `if`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:99:14 | -LL | ($p:path if) => {}; //~ERROR `$p:path` is followed by `if` +LL | ($p:path if) => {}; | ^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -609,7 +609,7 @@ LL | ($p:path if) => {}; //~ERROR `$p:path` is followed by `if` error: `$p:path` is followed by `$q:pat`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:100:14 | -LL | ($p:path $q:pat) => {}; //~ERROR `$p:path` is followed by `$q:pat` +LL | ($p:path $q:pat) => {}; | ^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -617,7 +617,7 @@ LL | ($p:path $q:pat) => {}; //~ERROR `$p:path` is followed by `$q:pat` error: `$p:path` is followed by `$e:expr`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:101:14 | -LL | ($p:path $e:expr) => {}; //~ERROR `$p:path` is followed by `$e:expr` +LL | ($p:path $e:expr) => {}; | ^^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -625,7 +625,7 @@ LL | ($p:path $e:expr) => {}; //~ERROR `$p:path` is followed by `$e:expr` error: `$p:path` is followed by `$t:ty`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:102:14 | -LL | ($p:path $t:ty) => {}; //~ERROR `$p:path` is followed by `$t:ty` +LL | ($p:path $t:ty) => {}; | ^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -633,7 +633,7 @@ LL | ($p:path $t:ty) => {}; //~ERROR `$p:path` is followed by `$t:ty` error: `$p:path` is followed by `$s:stmt`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:103:14 | -LL | ($p:path $s:stmt) => {}; //~ERROR `$p:path` is followed by `$s:stmt` +LL | ($p:path $s:stmt) => {}; | ^^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -641,7 +641,7 @@ LL | ($p:path $s:stmt) => {}; //~ERROR `$p:path` is followed by `$s:stmt` error: `$p:path` is followed by `$q:path`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:104:14 | -LL | ($p:path $q:path) => {}; //~ERROR `$p:path` is followed by `$q:path` +LL | ($p:path $q:path) => {}; | ^^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -649,7 +649,7 @@ LL | ($p:path $q:path) => {}; //~ERROR `$p:path` is followed by `$q:path` error: `$p:path` is followed by `$i:ident`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:106:14 | -LL | ($p:path $i:ident) => {}; //~ERROR `$p:path` is followed by `$i:ident` +LL | ($p:path $i:ident) => {}; | ^^^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -657,7 +657,7 @@ LL | ($p:path $i:ident) => {}; //~ERROR `$p:path` is followed by `$i:ident` error: `$p:path` is followed by `$t:tt`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:107:14 | -LL | ($p:path $t:tt) => {}; //~ERROR `$p:path` is followed by `$t:tt` +LL | ($p:path $t:tt) => {}; | ^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -665,7 +665,7 @@ LL | ($p:path $t:tt) => {}; //~ERROR `$p:path` is followed by `$t:tt` error: `$p:path` is followed by `$i:item`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:108:14 | -LL | ($p:path $i:item) => {}; //~ERROR `$p:path` is followed by `$i:item` +LL | ($p:path $i:item) => {}; | ^^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -673,7 +673,7 @@ LL | ($p:path $i:item) => {}; //~ERROR `$p:path` is followed by `$i:item` error: `$p:path` is followed by `$m:meta`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:109:14 | -LL | ($p:path $m:meta) => {}; //~ERROR `$p:path` is followed by `$m:meta` +LL | ($p:path $m:meta) => {}; | ^^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` diff --git a/src/test/ui/macros/macro-followed-by-seq-bad.stderr b/src/test/ui/macros/macro-followed-by-seq-bad.stderr index 18403fd248d8..7097979aeddf 100644 --- a/src/test/ui/macros/macro-followed-by-seq-bad.stderr +++ b/src/test/ui/macros/macro-followed-by-seq-bad.stderr @@ -1,7 +1,7 @@ error: `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments --> $DIR/macro-followed-by-seq-bad.rs:7:15 | -LL | ( $a:expr $($b:tt)* ) => { }; //~ ERROR not allowed for `expr` fragments +LL | ( $a:expr $($b:tt)* ) => { }; | ^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -9,7 +9,7 @@ LL | ( $a:expr $($b:tt)* ) => { }; //~ ERROR not allowed for `expr` fragments error: `$a:ty` is followed by `$b:tt`, which is not allowed for `ty` fragments --> $DIR/macro-followed-by-seq-bad.rs:8:13 | -LL | ( $a:ty $($b:tt)* ) => { }; //~ ERROR not allowed for `ty` fragments +LL | ( $a:ty $($b:tt)* ) => { }; | ^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` diff --git a/src/test/ui/macros/macro-input-future-proofing.stderr b/src/test/ui/macros/macro-input-future-proofing.stderr index fa39fc6a2125..a35f6283afb2 100644 --- a/src/test/ui/macros/macro-input-future-proofing.stderr +++ b/src/test/ui/macros/macro-input-future-proofing.stderr @@ -1,7 +1,7 @@ error: `$ty:ty` is followed by `<`, which is not allowed for `ty` fragments --> $DIR/macro-input-future-proofing.rs:4:13 | -LL | ($ty:ty <) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not allowed for `ty` +LL | ($ty:ty <) => (); | ^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -9,7 +9,7 @@ LL | ($ty:ty <) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not a error: `$ty:ty` is followed by `<`, which is not allowed for `ty` fragments --> $DIR/macro-input-future-proofing.rs:5:13 | -LL | ($ty:ty < foo ,) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not allowed for `ty` +LL | ($ty:ty < foo ,) => (); | ^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -17,7 +17,7 @@ LL | ($ty:ty < foo ,) => (); //~ ERROR `$ty:ty` is followed by `<`, which is error: `$pa:pat` is followed by `>`, which is not allowed for `pat` fragments --> $DIR/macro-input-future-proofing.rs:11:14 | -LL | ($pa:pat >) => (); //~ ERROR `$pa:pat` is followed by `>`, which is not allowed for `pat` +LL | ($pa:pat >) => (); | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -41,7 +41,7 @@ LL | ($pa:pat $pb:pat $ty:ty ,) => (); error: `$ty:ty` is followed by `-`, which is not allowed for `ty` fragments --> $DIR/macro-input-future-proofing.rs:16:17 | -LL | ($($ty:ty)* -) => (); //~ ERROR `$ty:ty` is followed by `-` +LL | ($($ty:ty)* -) => (); | ^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -49,7 +49,7 @@ LL | ($($ty:ty)* -) => (); //~ ERROR `$ty:ty` is followed by `-` error: `$b:ty` is followed by `-`, which is not allowed for `ty` fragments --> $DIR/macro-input-future-proofing.rs:17:23 | -LL | ($($a:ty, $b:ty)* -) => (); //~ ERROR `$b:ty` is followed by `-` +LL | ($($a:ty, $b:ty)* -) => (); | ^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -57,7 +57,7 @@ LL | ($($a:ty, $b:ty)* -) => (); //~ ERROR `$b:ty` is followed by `-` error: `$ty:ty` is followed by `-`, which is not allowed for `ty` fragments --> $DIR/macro-input-future-proofing.rs:18:7 | -LL | ($($ty:ty)-+) => (); //~ ERROR `$ty:ty` is followed by `-`, which is not allowed for `ty` +LL | ($($ty:ty)-+) => (); | ^^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` diff --git a/src/test/ui/macros/macro-match-nonterminal.stderr b/src/test/ui/macros/macro-match-nonterminal.stderr index 15eafbde0a23..1de8c5bd4b47 100644 --- a/src/test/ui/macros/macro-match-nonterminal.stderr +++ b/src/test/ui/macros/macro-match-nonterminal.stderr @@ -1,7 +1,7 @@ error: missing fragment specifier --> $DIR/macro-match-nonterminal.rs:1:24 | -LL | macro_rules! test { ($a, $b) => (()); } //~ ERROR missing fragment +LL | macro_rules! test { ($a, $b) => (()); } | ^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-missing-delimiters.stderr b/src/test/ui/macros/macro-missing-delimiters.stderr index 63cf1826f772..e7c37c8ddbeb 100644 --- a/src/test/ui/macros/macro-missing-delimiters.stderr +++ b/src/test/ui/macros/macro-missing-delimiters.stderr @@ -1,7 +1,7 @@ error: invalid macro matcher; matchers must be contained in balanced delimiters --> $DIR/macro-missing-delimiters.rs:2:5 | -LL | baz => () //~ ERROR invalid macro matcher; +LL | baz => () | ^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-missing-fragment.stderr b/src/test/ui/macros/macro-missing-fragment.stderr index 8c4026760ca1..b7871c0ec3a6 100644 --- a/src/test/ui/macros/macro-missing-fragment.stderr +++ b/src/test/ui/macros/macro-missing-fragment.stderr @@ -1,7 +1,7 @@ error: missing fragment specifier --> $DIR/macro-missing-fragment.rs:2:20 | -LL | ( $( any_token $field_rust_type )* ) => {}; //~ ERROR missing fragment +LL | ( $( any_token $field_rust_type )* ) => {}; | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-multiple-matcher-bindings.stderr b/src/test/ui/macros/macro-multiple-matcher-bindings.stderr index bc78b471a2d1..41e9a3286aef 100644 --- a/src/test/ui/macros/macro-multiple-matcher-bindings.stderr +++ b/src/test/ui/macros/macro-multiple-matcher-bindings.stderr @@ -1,7 +1,7 @@ warning: duplicate matcher binding --> $DIR/macro-multiple-matcher-bindings.rs:11:6 | -LL | ($a:ident, $a:ident) => {}; //~WARNING duplicate matcher binding +LL | ($a:ident, $a:ident) => {}; | ^^^^^^^^ ^^^^^^^^ | = note: #[warn(duplicate_matcher_binding_name)] on by default @@ -11,7 +11,7 @@ LL | ($a:ident, $a:ident) => {}; //~WARNING duplicate matcher binding warning: duplicate matcher binding --> $DIR/macro-multiple-matcher-bindings.rs:12:6 | -LL | ($a:ident, $a:path) => {}; //~WARNING duplicate matcher binding +LL | ($a:ident, $a:path) => {}; | ^^^^^^^^ ^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -20,7 +20,7 @@ LL | ($a:ident, $a:path) => {}; //~WARNING duplicate matcher binding warning: duplicate matcher binding --> $DIR/macro-multiple-matcher-bindings.rs:21:6 | -LL | ($a:ident, $($a:ident),*) => {}; //~WARNING duplicate matcher binding +LL | ($a:ident, $($a:ident),*) => {}; | ^^^^^^^^ ^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -29,7 +29,7 @@ LL | ($a:ident, $($a:ident),*) => {}; //~WARNING duplicate matcher binding warning: duplicate matcher binding --> $DIR/macro-multiple-matcher-bindings.rs:22:8 | -LL | ($($a:ident)+ # $($($a:path),+);*) => {}; //~WARNING duplicate matcher binding +LL | ($($a:ident)+ # $($($a:path),+);*) => {}; | ^^^^^^^^ ^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/macros/macro-name-typo.stderr b/src/test/ui/macros/macro-name-typo.stderr index 5af9828fd982..a8930f243f8f 100644 --- a/src/test/ui/macros/macro-name-typo.stderr +++ b/src/test/ui/macros/macro-name-typo.stderr @@ -1,7 +1,7 @@ error: cannot find macro `printlx!` in this scope --> $DIR/macro-name-typo.rs:2:5 | -LL | printlx!("oh noes!"); //~ ERROR cannot find +LL | printlx!("oh noes!"); | ^^^^^^^ help: you could try the macro: `println` error: aborting due to previous error diff --git a/src/test/ui/macros/macro-outer-attributes.stderr b/src/test/ui/macros/macro-outer-attributes.stderr index f9413250076b..838333b95c0d 100644 --- a/src/test/ui/macros/macro-outer-attributes.stderr +++ b/src/test/ui/macros/macro-outer-attributes.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `bar` in module `a` --> $DIR/macro-outer-attributes.rs:18:8 | -LL | a::bar(); //~ ERROR cannot find function `bar` in module `a` +LL | a::bar(); | ^^^ not found in `a` help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/macros/macro-parameter-span.stderr b/src/test/ui/macros/macro-parameter-span.stderr index c7dcb12d3d10..24e3e89ea9bf 100644 --- a/src/test/ui/macros/macro-parameter-span.stderr +++ b/src/test/ui/macros/macro-parameter-span.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/macro-parameter-span.rs:11:9 | -LL | x //~ ERROR cannot find value `x` in this scope +LL | x | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/macros/macro-path-prelude-fail-1.stderr b/src/test/ui/macros/macro-path-prelude-fail-1.stderr index 4bf51bd893a8..551d2fe8ce04 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-1.stderr +++ b/src/test/ui/macros/macro-path-prelude-fail-1.stderr @@ -1,13 +1,13 @@ error[E0433]: failed to resolve: not a module `Vec` --> $DIR/macro-path-prelude-fail-1.rs:5:9 | -LL | Vec::clone!(); //~ ERROR failed to resolve: not a module `Vec` +LL | Vec::clone!(); | ^^^ not a module `Vec` error[E0433]: failed to resolve: not a module `u8` --> $DIR/macro-path-prelude-fail-1.rs:6:9 | -LL | u8::clone!(); //~ ERROR failed to resolve: not a module `u8` +LL | u8::clone!(); | ^^ not a module `u8` error: aborting due to 2 previous errors diff --git a/src/test/ui/macros/macro-path-prelude-fail-2.stderr b/src/test/ui/macros/macro-path-prelude-fail-2.stderr index 6b1a5b3741a3..9574b7a1e25f 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-2.stderr +++ b/src/test/ui/macros/macro-path-prelude-fail-2.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: partially resolved path in a macro --> $DIR/macro-path-prelude-fail-2.rs:3:9 | -LL | Result::Ok!(); //~ ERROR failed to resolve: partially resolved path in a macro +LL | Result::Ok!(); | ^^^^^^^^^^ partially resolved path in a macro error: aborting due to previous error diff --git a/src/test/ui/macros/macro-path-prelude-fail-3.stderr b/src/test/ui/macros/macro-path-prelude-fail-3.stderr index 177232511817..7eeddb885479 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-3.stderr +++ b/src/test/ui/macros/macro-path-prelude-fail-3.stderr @@ -1,7 +1,7 @@ error: cannot find macro `inline!` in this scope --> $DIR/macro-path-prelude-fail-3.rs:2:5 | -LL | inline!(); //~ ERROR cannot find macro `inline!` in this scope +LL | inline!(); | ^^^^^^ help: you could try the macro: `line` error: aborting due to previous error diff --git a/src/test/ui/macros/macro-path-prelude-fail-4.stderr b/src/test/ui/macros/macro-path-prelude-fail-4.stderr index e354f345a4c2..f08445e1f775 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-4.stderr +++ b/src/test/ui/macros/macro-path-prelude-fail-4.stderr @@ -1,7 +1,7 @@ error: expected a macro, found built-in attribute --> $DIR/macro-path-prelude-fail-4.rs:1:10 | -LL | #[derive(inline)] //~ ERROR expected a macro, found built-in attribute +LL | #[derive(inline)] | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-path-prelude-shadowing.stderr b/src/test/ui/macros/macro-path-prelude-shadowing.stderr index 9c0214346a6a..e7b381daf934 100644 --- a/src/test/ui/macros/macro-path-prelude-shadowing.stderr +++ b/src/test/ui/macros/macro-path-prelude-shadowing.stderr @@ -1,7 +1,7 @@ error[E0659]: `std` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) --> $DIR/macro-path-prelude-shadowing.rs:29:9 | -LL | std::panic!(); //~ ERROR `std` is ambiguous +LL | std::panic!(); | ^^^ ambiguous name | = note: `std` could refer to a built-in extern crate diff --git a/src/test/ui/macros/macro-reexport-removed.stderr b/src/test/ui/macros/macro-reexport-removed.stderr index 6cfec3ee762d..302952909beb 100644 --- a/src/test/ui/macros/macro-reexport-removed.stderr +++ b/src/test/ui/macros/macro-reexport-removed.stderr @@ -1,19 +1,19 @@ error[E0557]: feature has been removed --> $DIR/macro-reexport-removed.rs:3:12 | -LL | #![feature(macro_reexport)] //~ ERROR feature has been removed +LL | #![feature(macro_reexport)] | ^^^^^^^^^^^^^^ | note: subsumed by `pub use` --> $DIR/macro-reexport-removed.rs:3:12 | -LL | #![feature(macro_reexport)] //~ ERROR feature has been removed +LL | #![feature(macro_reexport)] | ^^^^^^^^^^^^^^ error[E0658]: The attribute `macro_reexport` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/macro-reexport-removed.rs:5:3 | -LL | #[macro_reexport(macro_one)] //~ ERROR attribute `macro_reexport` is currently unknown +LL | #[macro_reexport(macro_one)] | ^^^^^^^^^^^^^^ help: a built-in attribute with a similar name exists: `macro_export` | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/macros/macro-shadowing.stderr b/src/test/ui/macros/macro-shadowing.stderr index c297f0ef52d7..033e12a31ae0 100644 --- a/src/test/ui/macros/macro-shadowing.stderr +++ b/src/test/ui/macros/macro-shadowing.stderr @@ -1,7 +1,7 @@ error: `macro_two` is already in scope --> $DIR/macro-shadowing.rs:12:5 | -LL | #[macro_use] //~ ERROR `macro_two` is already in scope +LL | #[macro_use] | ^^^^^^^^^^^^ ... LL | m1!(); @@ -12,7 +12,7 @@ LL | m1!(); error[E0659]: `foo` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/macro-shadowing.rs:17:1 | -LL | foo!(); //~ ERROR `foo` is ambiguous +LL | foo!(); | ^^^ ambiguous name | note: `foo` could refer to the macro defined here diff --git a/src/test/ui/macros/macro-stability.stderr b/src/test/ui/macros/macro-stability.stderr index e5c535a08e1c..a0e0c351a483 100644 --- a/src/test/ui/macros/macro-stability.stderr +++ b/src/test/ui/macros/macro-stability.stderr @@ -1,7 +1,7 @@ error[E0658]: macro unstable_macro! is unstable --> $DIR/macro-stability.rs:11:5 | -LL | unstable_macro!(); //~ ERROR: macro unstable_macro! is unstable +LL | unstable_macro!(); | ^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_macros)] to the crate attributes to enable diff --git a/src/test/ui/macros/macro-use-bad-args-1.stderr b/src/test/ui/macros/macro-use-bad-args-1.stderr index 1eb8cc3f4c49..f403c8a36608 100644 --- a/src/test/ui/macros/macro-use-bad-args-1.stderr +++ b/src/test/ui/macros/macro-use-bad-args-1.stderr @@ -1,7 +1,7 @@ error[E0466]: bad macro import --> $DIR/macro-use-bad-args-1.rs:4:13 | -LL | #[macro_use(foo(bar))] //~ ERROR bad macro import +LL | #[macro_use(foo(bar))] | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-use-bad-args-2.stderr b/src/test/ui/macros/macro-use-bad-args-2.stderr index 7ed6b26b1b77..93617edeeaea 100644 --- a/src/test/ui/macros/macro-use-bad-args-2.stderr +++ b/src/test/ui/macros/macro-use-bad-args-2.stderr @@ -1,7 +1,7 @@ error[E0466]: bad macro import --> $DIR/macro-use-bad-args-2.rs:4:13 | -LL | #[macro_use(foo="bar")] //~ ERROR bad macro import +LL | #[macro_use(foo="bar")] | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-use-undef.stderr b/src/test/ui/macros/macro-use-undef.stderr index 4d9fa3aeb137..85b86e2211f2 100644 --- a/src/test/ui/macros/macro-use-undef.stderr +++ b/src/test/ui/macros/macro-use-undef.stderr @@ -1,7 +1,7 @@ error[E0469]: imported macro not found --> $DIR/macro-use-undef.rs:3:24 | -LL | #[macro_use(macro_two, no_way)] //~ ERROR imported macro not found +LL | #[macro_use(macro_two, no_way)] | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro_path_as_generic_bound.stderr b/src/test/ui/macros/macro_path_as_generic_bound.stderr index 2f0e67c1ba8a..48c33575ad2a 100644 --- a/src/test/ui/macros/macro_path_as_generic_bound.stderr +++ b/src/test/ui/macros/macro_path_as_generic_bound.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: use of undeclared type or module `m` --> $DIR/macro_path_as_generic_bound.rs:7:6 | -LL | foo!(m::m2::A); //~ ERROR failed to resolve +LL | foo!(m::m2::A); | ^ use of undeclared type or module `m` error: aborting due to previous error diff --git a/src/test/ui/macros/macro_undefined.stderr b/src/test/ui/macros/macro_undefined.stderr index b9a76e07a007..b516f91c67d1 100644 --- a/src/test/ui/macros/macro_undefined.stderr +++ b/src/test/ui/macros/macro_undefined.stderr @@ -1,7 +1,7 @@ error: cannot find macro `k!` in this scope --> $DIR/macro_undefined.rs:11:5 | -LL | k!(); //~ ERROR cannot find +LL | k!(); | ^ help: you could try the macro: `kl` error: aborting due to previous error diff --git a/src/test/ui/macros/macros-nonfatal-errors.stderr b/src/test/ui/macros/macros-nonfatal-errors.stderr index ce7035ee2746..8a8455c262b4 100644 --- a/src/test/ui/macros/macros-nonfatal-errors.stderr +++ b/src/test/ui/macros/macros-nonfatal-errors.stderr @@ -1,89 +1,89 @@ error[E0665]: `Default` cannot be derived for enums, only structs --> $DIR/macros-nonfatal-errors.rs:9:10 | -LL | #[derive(Default)] //~ ERROR +LL | #[derive(Default)] | ^^^^^^^ error: inline assembly must be a string literal --> $DIR/macros-nonfatal-errors.rs:13:10 | -LL | asm!(invalid); //~ ERROR +LL | asm!(invalid); | ^^^^^^^ error: concat_idents! requires ident args. --> $DIR/macros-nonfatal-errors.rs:15:5 | -LL | concat_idents!("not", "idents"); //~ ERROR +LL | concat_idents!("not", "idents"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: argument must be a string literal --> $DIR/macros-nonfatal-errors.rs:17:17 | -LL | option_env!(invalid); //~ ERROR +LL | option_env!(invalid); | ^^^^^^^ error: expected string literal --> $DIR/macros-nonfatal-errors.rs:18:10 | -LL | env!(invalid); //~ ERROR +LL | env!(invalid); | ^^^^^^^ error: expected string literal --> $DIR/macros-nonfatal-errors.rs:19:10 | -LL | env!(foo, abr, baz); //~ ERROR +LL | env!(foo, abr, baz); | ^^^ error: environment variable `RUST_HOPEFULLY_THIS_DOESNT_EXIST` not defined --> $DIR/macros-nonfatal-errors.rs:20:5 | -LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST"); //~ ERROR +LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: format argument must be a string literal --> $DIR/macros-nonfatal-errors.rs:22:13 | -LL | format!(invalid); //~ ERROR +LL | format!(invalid); | ^^^^^^^ help: you might be missing a string literal to format with | -LL | format!("{}", invalid); //~ ERROR +LL | format!("{}", invalid); | ^^^^^ error: argument must be a string literal --> $DIR/macros-nonfatal-errors.rs:24:14 | -LL | include!(invalid); //~ ERROR +LL | include!(invalid); | ^^^^^^^ error: argument must be a string literal --> $DIR/macros-nonfatal-errors.rs:26:18 | -LL | include_str!(invalid); //~ ERROR +LL | include_str!(invalid); | ^^^^^^^ error: couldn't read $DIR/i'd be quite surprised if a file with this name existed: $FILE_NOT_FOUND_MSG (os error 2) --> $DIR/macros-nonfatal-errors.rs:27:5 | -LL | include_str!("i'd be quite surprised if a file with this name existed"); //~ ERROR +LL | include_str!("i'd be quite surprised if a file with this name existed"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: argument must be a string literal --> $DIR/macros-nonfatal-errors.rs:28:20 | -LL | include_bytes!(invalid); //~ ERROR +LL | include_bytes!(invalid); | ^^^^^^^ error: couldn't read $DIR/i'd be quite surprised if a file with this name existed: $FILE_NOT_FOUND_MSG (os error 2) --> $DIR/macros-nonfatal-errors.rs:29:5 | -LL | include_bytes!("i'd be quite surprised if a file with this name existed"); //~ ERROR +LL | include_bytes!("i'd be quite surprised if a file with this name existed"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` --> $DIR/macros-nonfatal-errors.rs:31:5 | -LL | trace_macros!(invalid); //~ ERROR +LL | trace_macros!(invalid); | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 14 previous errors diff --git a/src/test/ui/macros/meta-item-absolute-path.stderr b/src/test/ui/macros/meta-item-absolute-path.stderr index 31b0a27bbc8d..23933f730aae 100644 --- a/src/test/ui/macros/meta-item-absolute-path.stderr +++ b/src/test/ui/macros/meta-item-absolute-path.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: maybe a missing `extern crate Absolute;`? --> $DIR/meta-item-absolute-path.rs:1:12 | -LL | #[derive(::Absolute)] //~ ERROR failed to resolve +LL | #[derive(::Absolute)] | ^^^^^^^^ maybe a missing `extern crate Absolute;`? error: aborting due to previous error diff --git a/src/test/ui/macros/must-use-in-macro-55516.stderr b/src/test/ui/macros/must-use-in-macro-55516.stderr index 47874b809727..623b5745a357 100644 --- a/src/test/ui/macros/must-use-in-macro-55516.stderr +++ b/src/test/ui/macros/must-use-in-macro-55516.stderr @@ -1,7 +1,7 @@ warning: unused `std::result::Result` that must be used --> $DIR/must-use-in-macro-55516.rs:9:5 | -LL | write!(&mut example, "{}", 42); //~WARN must be used +LL | write!(&mut example, "{}", 42); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-W unused-must-use` implied by `-W unused` diff --git a/src/test/ui/macros/nonterminal-matching.stderr b/src/test/ui/macros/nonterminal-matching.stderr index f2a191ae149c..5fba8002e1c4 100644 --- a/src/test/ui/macros/nonterminal-matching.stderr +++ b/src/test/ui/macros/nonterminal-matching.stderr @@ -1,7 +1,7 @@ error: no rules expected the token `enum E { }` --> $DIR/nonterminal-matching.rs:19:10 | -LL | n!(a $nt_item b); //~ ERROR no rules expected the token `enum E { }` +LL | n!(a $nt_item b); | ^^^^^^^^ no rules expected this token in macro call ... LL | complex_nonterminal!(enum E {}); diff --git a/src/test/ui/macros/restricted-shadowing-legacy.stderr b/src/test/ui/macros/restricted-shadowing-legacy.stderr index 9d61799713b0..8378286bdadf 100644 --- a/src/test/ui/macros/restricted-shadowing-legacy.stderr +++ b/src/test/ui/macros/restricted-shadowing-legacy.stderr @@ -1,7 +1,7 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:101:13 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -27,7 +27,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:139:42 | -LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous +LL | macro_rules! gen_invoc { () => { m!() } } | ^ ambiguous name ... LL | include!(); @@ -53,7 +53,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:148:9 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -79,7 +79,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:164:9 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -105,7 +105,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:180:13 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -131,7 +131,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:218:42 | -LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous +LL | macro_rules! gen_invoc { () => { m!() } } | ^ ambiguous name ... LL | include!(); @@ -157,7 +157,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:232:9 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -183,7 +183,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:262:42 | -LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous +LL | macro_rules! gen_invoc { () => { m!() } } | ^ ambiguous name ... LL | include!(); diff --git a/src/test/ui/macros/restricted-shadowing-modern.stderr b/src/test/ui/macros/restricted-shadowing-modern.stderr index 398a7660d309..d147debeb51b 100644 --- a/src/test/ui/macros/restricted-shadowing-modern.stderr +++ b/src/test/ui/macros/restricted-shadowing-modern.stderr @@ -1,7 +1,7 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-modern.rs:106:17 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -27,7 +27,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-modern.rs:149:33 | -LL | macro gen_invoc() { m!() } //~ ERROR `m` is ambiguous +LL | macro gen_invoc() { m!() } | ^ ambiguous name ... LL | include!(); @@ -53,7 +53,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-modern.rs:158:13 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -79,7 +79,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-modern.rs:174:13 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -105,7 +105,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-modern.rs:192:17 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -131,7 +131,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-modern.rs:235:33 | -LL | macro gen_invoc() { m!() } //~ ERROR `m` is ambiguous +LL | macro gen_invoc() { m!() } | ^ ambiguous name ... LL | include!(); diff --git a/src/test/ui/macros/trace_faulty_macros.stderr b/src/test/ui/macros/trace_faulty_macros.stderr index a645590f005a..233d3dcfcb6d 100644 --- a/src/test/ui/macros/trace_faulty_macros.stderr +++ b/src/test/ui/macros/trace_faulty_macros.stderr @@ -4,7 +4,7 @@ error: no rules expected the token `bcd` LL | macro_rules! my_faulty_macro { | ---------------------------- when calling this macro LL | () => { -LL | my_faulty_macro!(bcd); //~ ERROR no rules +LL | my_faulty_macro!(bcd); | ^^^ no rules expected this token in macro call ... LL | my_faulty_macro!(); @@ -23,7 +23,7 @@ LL | my_faulty_macro!(); error: recursion limit reached while expanding the macro `my_recursive_macro` --> $DIR/trace_faulty_macros.rs:22:9 | -LL | my_recursive_macro!(); //~ ERROR recursion limit +LL | my_recursive_macro!(); | ^^^^^^^^^^^^^^^^^^^^^^ ... LL | my_recursive_macro!(); diff --git a/src/test/ui/malformed/malformed-interpolated.stderr b/src/test/ui/malformed/malformed-interpolated.stderr index 24aa590c4d90..efeede0148da 100644 --- a/src/test/ui/malformed/malformed-interpolated.stderr +++ b/src/test/ui/malformed/malformed-interpolated.stderr @@ -1,7 +1,7 @@ error: suffixed literals are not allowed in attributes --> $DIR/malformed-interpolated.rs:5:21 | -LL | #[my_attr = $expr] //~ ERROR suffixed literals are not allowed in attributes +LL | #[my_attr = $expr] | ^^^^^ ... LL | check!(0u8); // ERROR, see above @@ -12,7 +12,7 @@ LL | check!(0u8); // ERROR, see above error: unexpected token: `-0` --> $DIR/malformed-interpolated.rs:5:19 | -LL | #[my_attr = $expr] //~ ERROR suffixed literals are not allowed in attributes +LL | #[my_attr = $expr] | ^ ... LL | check!(-0); // ERROR, see above @@ -21,7 +21,7 @@ LL | check!(-0); // ERROR, see above error: unexpected token: `0 + 0` --> $DIR/malformed-interpolated.rs:5:19 | -LL | #[my_attr = $expr] //~ ERROR suffixed literals are not allowed in attributes +LL | #[my_attr = $expr] | ^ ... LL | check!(0 + 0); // ERROR, see above diff --git a/src/test/ui/malformed/malformed-plugin-1.stderr b/src/test/ui/malformed/malformed-plugin-1.stderr index f42e66e2b32f..cc0ac182d706 100644 --- a/src/test/ui/malformed/malformed-plugin-1.stderr +++ b/src/test/ui/malformed/malformed-plugin-1.stderr @@ -1,7 +1,7 @@ error: attribute must be of the form `#[plugin(name|name(args))]` --> $DIR/malformed-plugin-1.rs:2:1 | -LL | #![plugin] //~ ERROR attribute must be of the form +LL | #![plugin] | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/malformed/malformed-plugin-2.stderr b/src/test/ui/malformed/malformed-plugin-2.stderr index 923cbc188607..617b13b2654f 100644 --- a/src/test/ui/malformed/malformed-plugin-2.stderr +++ b/src/test/ui/malformed/malformed-plugin-2.stderr @@ -1,7 +1,7 @@ error: attribute must be of the form `#[plugin(name|name(args))]` --> $DIR/malformed-plugin-2.rs:2:1 | -LL | #![plugin="bleh"] //~ ERROR attribute must be of the form +LL | #![plugin="bleh"] | ^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/malformed/malformed-plugin-3.stderr b/src/test/ui/malformed/malformed-plugin-3.stderr index 6f19a1171490..5739770ad98b 100644 --- a/src/test/ui/malformed/malformed-plugin-3.stderr +++ b/src/test/ui/malformed/malformed-plugin-3.stderr @@ -1,7 +1,7 @@ error[E0498]: malformed plugin attribute --> $DIR/malformed-plugin-3.rs:2:1 | -LL | #![plugin(foo="bleh")] //~ ERROR malformed plugin attribute +LL | #![plugin(foo="bleh")] | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/malformed/malformed-regressions.stderr b/src/test/ui/malformed/malformed-regressions.stderr index a3b2bda07f62..9a81c1056ca9 100644 --- a/src/test/ui/malformed/malformed-regressions.stderr +++ b/src/test/ui/malformed/malformed-regressions.stderr @@ -1,7 +1,7 @@ warning: attribute must be of the form `#[doc(hidden|inline|...)]` or `#[doc = "string"]` --> $DIR/malformed-regressions.rs:3:1 | -LL | #[doc] //~ WARN attribute must be of the form +LL | #[doc] | ^^^^^^ | = note: #[warn(ill_formed_attribute_input)] on by default @@ -11,7 +11,7 @@ LL | #[doc] //~ WARN attribute must be of the form warning: attribute must be of the form `#[ignore]` or `#[ignore = "reason"]` --> $DIR/malformed-regressions.rs:4:1 | -LL | #[ignore()] //~ WARN attribute must be of the form +LL | #[ignore()] | ^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -20,7 +20,7 @@ LL | #[ignore()] //~ WARN attribute must be of the form warning: attribute must be of the form `#[inline]` or `#[inline(always|never)]` --> $DIR/malformed-regressions.rs:5:1 | -LL | #[inline = ""] //~ WARN attribute must be of the form +LL | #[inline = ""] | ^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -30,7 +30,7 @@ warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dyl /*opt*/ cfg = "...")]` --> $DIR/malformed-regressions.rs:6:1 | -LL | #[link] //~ WARN attribute must be of the form +LL | #[link] | ^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -40,7 +40,7 @@ warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dyl /*opt*/ cfg = "...")]` --> $DIR/malformed-regressions.rs:7:1 | -LL | #[link = ""] //~ WARN attribute must be of the form +LL | #[link = ""] | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/malformed/malformed-special-attrs.stderr b/src/test/ui/malformed/malformed-special-attrs.stderr index 1653aa150d57..8c23424087c0 100644 --- a/src/test/ui/malformed/malformed-special-attrs.stderr +++ b/src/test/ui/malformed/malformed-special-attrs.stderr @@ -3,22 +3,22 @@ error: expected `(`, found `` error: expected `(`, found `=` --> $DIR/malformed-special-attrs.rs:4:12 | -LL | #[cfg_attr] //~ ERROR expected `(`, found `` +LL | #[cfg_attr] | - expected `(` ... -LL | #[cfg_attr = ""] //~ ERROR expected `(`, found `=` +LL | #[cfg_attr = ""] | ^ unexpected token error: attribute must be of the form `#[derive(Trait1, Trait2, ...)]` --> $DIR/malformed-special-attrs.rs:7:1 | -LL | #[derive] //~ ERROR attribute must be of the form +LL | #[derive] | ^^^^^^^^^ error: attribute must be of the form `#[derive(Trait1, Trait2, ...)]` --> $DIR/malformed-special-attrs.rs:10:1 | -LL | #[derive = ""] //~ ERROR attribute must be of the form +LL | #[derive = ""] | ^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/malformed_macro_lhs.stderr b/src/test/ui/malformed_macro_lhs.stderr index ab09bc10b86f..adf64b089350 100644 --- a/src/test/ui/malformed_macro_lhs.stderr +++ b/src/test/ui/malformed_macro_lhs.stderr @@ -1,7 +1,7 @@ error: invalid macro matcher; matchers must be contained in balanced delimiters --> $DIR/malformed_macro_lhs.rs:2:5 | -LL | t => (1); //~ ERROR invalid macro matcher +LL | t => (1); | ^ error: aborting due to previous error diff --git a/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr b/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr index b88c125d968d..d30b990caac2 100644 --- a/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr +++ b/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr @@ -1,7 +1,7 @@ error: attribute can only be applied to a trait --> $DIR/marker-attribute-on-non-trait.rs:3:1 | -LL | #[marker] //~ ERROR attribute can only be applied to a trait +LL | #[marker] | ^^^^^^^^^ LL | struct Struct {} | ---------------- not a trait @@ -9,7 +9,7 @@ LL | struct Struct {} error: attribute can only be applied to a trait --> $DIR/marker-attribute-on-non-trait.rs:6:1 | -LL | #[marker] //~ ERROR attribute can only be applied to a trait +LL | #[marker] | ^^^^^^^^^ LL | impl Struct {} | -------------- not a trait @@ -17,7 +17,7 @@ LL | impl Struct {} error: attribute can only be applied to a trait --> $DIR/marker-attribute-on-non-trait.rs:9:1 | -LL | #[marker] //~ ERROR attribute can only be applied to a trait +LL | #[marker] | ^^^^^^^^^ LL | / union Union { LL | | x: i32, @@ -27,7 +27,7 @@ LL | | } error: attribute can only be applied to a trait --> $DIR/marker-attribute-on-non-trait.rs:14:1 | -LL | #[marker] //~ ERROR attribute can only be applied to a trait +LL | #[marker] | ^^^^^^^^^ LL | const CONST: usize = 10; | ------------------------ not a trait @@ -35,7 +35,7 @@ LL | const CONST: usize = 10; error: attribute can only be applied to a trait --> $DIR/marker-attribute-on-non-trait.rs:17:1 | -LL | #[marker] //~ ERROR attribute can only be applied to a trait +LL | #[marker] | ^^^^^^^^^ LL | fn function() {} | ---------------- not a trait @@ -43,7 +43,7 @@ LL | fn function() {} error: attribute can only be applied to a trait --> $DIR/marker-attribute-on-non-trait.rs:20:1 | -LL | #[marker] //~ ERROR attribute can only be applied to a trait +LL | #[marker] | ^^^^^^^^^ LL | type Type = (); | --------------- not a trait diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr b/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr index 4579ec261164..f4a52a65af6a 100644 --- a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr +++ b/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied --> $DIR/overlap-marker-trait.rs:27:5 | -LL | is_marker::(); //~ ERROR +LL | is_marker::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` | note: required by `is_marker` diff --git a/src/test/ui/match/match-byte-array-patterns-2.stderr b/src/test/ui/match/match-byte-array-patterns-2.stderr index 83dbecfcac65..d53e2e25b3db 100644 --- a/src/test/ui/match/match-byte-array-patterns-2.stderr +++ b/src/test/ui/match/match-byte-array-patterns-2.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `&[_, _, _, _]` not covered --> $DIR/match-byte-array-patterns-2.rs:4:11 | -LL | match buf { //~ ERROR non-exhaustive +LL | match buf { | ^^^ pattern `&[_, _, _, _]` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -9,7 +9,7 @@ LL | match buf { //~ ERROR non-exhaustive error[E0004]: non-exhaustive patterns: `&[]`, `&[_]`, `&[_, _]` and 3 more not covered --> $DIR/match-byte-array-patterns-2.rs:10:11 | -LL | match buf { //~ ERROR non-exhaustive +LL | match buf { | ^^^ patterns `&[]`, `&[_]`, `&[_, _]` and 3 more not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/match/match-byte-array-patterns.stderr b/src/test/ui/match/match-byte-array-patterns.stderr index a23f18536666..b28646b50cf0 100644 --- a/src/test/ui/match/match-byte-array-patterns.stderr +++ b/src/test/ui/match/match-byte-array-patterns.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:9:9 | -LL | &[0x41, 0x41, 0x41, 0x41] => {} //~ ERROR unreachable pattern +LL | &[0x41, 0x41, 0x41, 0x41] => {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,43 +13,43 @@ LL | #![deny(unreachable_patterns)] error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:15:9 | -LL | b"AAAA" => {}, //~ ERROR unreachable pattern +LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:21:9 | -LL | b"AAAA" => {}, //~ ERROR unreachable pattern +LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:27:9 | -LL | b"AAAA" => {}, //~ ERROR unreachable pattern +LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:35:9 | -LL | &[0x41, 0x41, 0x41, 0x41] => {} //~ ERROR unreachable pattern +LL | &[0x41, 0x41, 0x41, 0x41] => {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:41:9 | -LL | b"AAAA" => {}, //~ ERROR unreachable pattern +LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:47:9 | -LL | b"AAAA" => {}, //~ ERROR unreachable pattern +LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:53:9 | -LL | b"AAAA" => {}, //~ ERROR unreachable pattern +LL | b"AAAA" => {}, | ^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/match/match-ill-type2.stderr b/src/test/ui/match/match-ill-type2.stderr index 116d26ac7121..83fae10d4cb4 100644 --- a/src/test/ui/match/match-ill-type2.stderr +++ b/src/test/ui/match/match-ill-type2.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/match-ill-type2.rs:4:9 | -LL | 2u32 => 1, //~ ERROR mismatched types +LL | 2u32 => 1, | ^^^^ expected i32, found u32 error: aborting due to previous error diff --git a/src/test/ui/match/match-join.stderr b/src/test/ui/match/match-join.stderr index 6e08c92bedb5..27a82c1242cc 100644 --- a/src/test/ui/match/match-join.stderr +++ b/src/test/ui/match/match-join.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/match-join.rs:9:20 | -LL | println!("{}", x); //~ ERROR cannot find value `x` in this scope +LL | println!("{}", x); | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/match/match-no-arms-unreachable-after.stderr b/src/test/ui/match/match-no-arms-unreachable-after.stderr index bd136245c1ae..65dcc6ee4655 100644 --- a/src/test/ui/match/match-no-arms-unreachable-after.stderr +++ b/src/test/ui/match/match-no-arms-unreachable-after.stderr @@ -1,7 +1,7 @@ error: unreachable statement --> $DIR/match-no-arms-unreachable-after.rs:8:5 | -LL | let x = 2; //~ ERROR unreachable +LL | let x = 2; | ^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/match/match-non-exhaustive.stderr b/src/test/ui/match/match-non-exhaustive.stderr index 9921e4f63b64..00c2bfff7eb4 100644 --- a/src/test/ui/match/match-non-exhaustive.stderr +++ b/src/test/ui/match/match-non-exhaustive.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `-2147483648i32..=0i32` and `2i32..=2147483647i32` not covered --> $DIR/match-non-exhaustive.rs:2:11 | -LL | match 0 { 1 => () } //~ ERROR non-exhaustive patterns +LL | match 0 { 1 => () } | ^ patterns `-2147483648i32..=0i32` and `2i32..=2147483647i32` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -9,7 +9,7 @@ LL | match 0 { 1 => () } //~ ERROR non-exhaustive patterns error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/match-non-exhaustive.rs:3:11 | -LL | match 0 { 0 if false => () } //~ ERROR non-exhaustive patterns +LL | match 0 { 0 if false => () } | ^ pattern `_` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/match/match-ref-ice.stderr b/src/test/ui/match/match-ref-ice.stderr index faefd9f21290..c4bfa0afcc27 100644 --- a/src/test/ui/match/match-ref-ice.stderr +++ b/src/test/ui/match/match-ref-ice.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/match-ref-ice.rs:13:9 | -LL | [1, 2, 3] => (), //~ ERROR unreachable pattern +LL | [1, 2, 3] => (), | ^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/match/match-ref-mut-invariance.stderr b/src/test/ui/match/match-ref-mut-invariance.stderr index 61552b44c275..30bbb8d7800f 100644 --- a/src/test/ui/match/match-ref-mut-invariance.stderr +++ b/src/test/ui/match/match-ref-mut-invariance.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/match-ref-mut-invariance.rs:10:37 | -LL | match self.0 { ref mut x => x } //~ ERROR mismatched types +LL | match self.0 { ref mut x => x } | ^ lifetime mismatch | = note: expected type `&'a mut &'a i32` diff --git a/src/test/ui/match/match-ref-mut-let-invariance.stderr b/src/test/ui/match/match-ref-mut-let-invariance.stderr index 26ec0697f410..6ca222d9c2ff 100644 --- a/src/test/ui/match/match-ref-mut-let-invariance.stderr +++ b/src/test/ui/match/match-ref-mut-let-invariance.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/match-ref-mut-let-invariance.rs:11:9 | -LL | x //~ ERROR mismatched types +LL | x | ^ lifetime mismatch | = note: expected type `&'a mut &'a i32` diff --git a/src/test/ui/match/match-tag-nullary.stderr b/src/test/ui/match/match-tag-nullary.stderr index 014581ea4bd0..902ccc94dde2 100644 --- a/src/test/ui/match/match-tag-nullary.stderr +++ b/src/test/ui/match/match-tag-nullary.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/match-tag-nullary.rs:4:40 | -LL | fn main() { let x: A = A::A; match x { B::B => { } } } //~ ERROR mismatched types +LL | fn main() { let x: A = A::A; match x { B::B => { } } } | ^^^^ expected enum `A`, found enum `B` | = note: expected type `A` diff --git a/src/test/ui/match/match-tag-unary.stderr b/src/test/ui/match/match-tag-unary.stderr index 53b663513696..da599c374074 100644 --- a/src/test/ui/match/match-tag-unary.stderr +++ b/src/test/ui/match/match-tag-unary.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/match-tag-unary.rs:4:43 | -LL | fn main() { let x: A = A::A(0); match x { B::B(y) => { } } } //~ ERROR mismatched types +LL | fn main() { let x: A = A::A(0); match x { B::B(y) => { } } } | - ^^^^^^^ expected enum `A`, found enum `B` | | | this match expression has type `A` diff --git a/src/test/ui/match/match-type-err-first-arm.stderr b/src/test/ui/match/match-type-err-first-arm.stderr index db8bef8dc775..a318e6cffb93 100644 --- a/src/test/ui/match/match-type-err-first-arm.stderr +++ b/src/test/ui/match/match-type-err-first-arm.stderr @@ -12,14 +12,14 @@ error[E0308]: match arms have incompatible types | LL | let x = match n { | _____________- -LL | | //~^ NOTE `match` arms have incompatible types +LL | | LL | | 12 => 'b', | | --- this is found to be of type `char` -LL | | //~^ NOTE this is found to be of type `char` +LL | | LL | | _ => 42, | | ^^ expected char, found integer ... | -LL | | //~| NOTE expected type `char` +LL | | LL | | }; | |_____- `match` arms have incompatible types | @@ -31,17 +31,17 @@ error[E0308]: match arms have incompatible types | LL | let x = match n { | _____________- -LL | | //~^ NOTE `match` arms have incompatible types +LL | | LL | | 1 => 'b', LL | | 2 => 'b', ... | LL | | 6 => 'b', | | --- this and all prior arms are found to be of type `char` -LL | | //~^ NOTE this and all prior arms are found to be of type `char` +LL | | LL | | _ => 42, | | ^^ expected char, found integer ... | -LL | | //~| NOTE expected type `char` +LL | | LL | | }; | |_____- `match` arms have incompatible types | diff --git a/src/test/ui/match/match-unresolved-one-arm.stderr b/src/test/ui/match/match-unresolved-one-arm.stderr index b013933eaae6..ad8569b4802f 100644 --- a/src/test/ui/match/match-unresolved-one-arm.stderr +++ b/src/test/ui/match/match-unresolved-one-arm.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/match-unresolved-one-arm.rs:4:9 | -LL | let x = match () { //~ ERROR type annotations needed +LL | let x = match () { | ^ | | | cannot infer type diff --git a/src/test/ui/match/match-vec-fixed.stderr b/src/test/ui/match/match-vec-fixed.stderr index f4b426bea325..ae2dd87b6954 100644 --- a/src/test/ui/match/match-vec-fixed.stderr +++ b/src/test/ui/match/match-vec-fixed.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/match-vec-fixed.rs:7:9 | -LL | [_, _, _] => {} //~ ERROR unreachable pattern +LL | [_, _, _] => {} | ^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unreachable_patterns)] error: unreachable pattern --> $DIR/match-vec-fixed.rs:11:9 | -LL | [_, 1, _] => {} //~ ERROR unreachable pattern +LL | [_, 1, _] => {} | ^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/match/match-vec-mismatch.stderr b/src/test/ui/match/match-vec-mismatch.stderr index 93a407760a51..e19a0f956ce3 100644 --- a/src/test/ui/match/match-vec-mismatch.stderr +++ b/src/test/ui/match/match-vec-mismatch.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `does_not_exist` in this scope --> $DIR/match-vec-mismatch.rs:28:11 | -LL | match does_not_exist { //~ ERROR cannot find value `does_not_exist` in this scope +LL | match does_not_exist { | ^^^^^^^^^^^^^^ not found in this scope error[E0529]: expected an array or slice, found `std::string::String` @@ -13,19 +13,19 @@ LL | ['f', 'o', ..] => {} error[E0527]: pattern requires 1 elements but array has 3 --> $DIR/match-vec-mismatch.rs:20:9 | -LL | [0] => {}, //~ ERROR pattern requires +LL | [0] => {}, | ^^^ expected 3 elements error[E0528]: pattern requires at least 4 elements but array has 3 --> $DIR/match-vec-mismatch.rs:25:9 | -LL | [0, 1, 2, 3, x..] => {} //~ ERROR pattern requires +LL | [0, 1, 2, 3, x..] => {} | ^^^^^^^^^^^^^^^^^ pattern cannot match array of 3 elements error[E0282]: type annotations needed --> $DIR/match-vec-mismatch.rs:36:9 | -LL | [] => {} //~ ERROR type annotations needed +LL | [] => {} | ^^ cannot infer type | = note: type must be known at this point diff --git a/src/test/ui/match/match-vec-unreachable.stderr b/src/test/ui/match/match-vec-unreachable.stderr index 71e3d8c5e31c..415c24ae77ef 100644 --- a/src/test/ui/match/match-vec-unreachable.stderr +++ b/src/test/ui/match/match-vec-unreachable.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/match-vec-unreachable.rs:9:9 | -LL | [(1, 2), (2, 3), b] => (), //~ ERROR unreachable pattern +LL | [(1, 2), (2, 3), b] => (), | ^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unreachable_patterns)] error: unreachable pattern --> $DIR/match-vec-unreachable.rs:19:9 | -LL | [_, _, _, _, _] => { } //~ ERROR unreachable pattern +LL | [_, _, _, _, _] => { } | ^^^^^^^^^^^^^^^ error: unreachable pattern --> $DIR/match-vec-unreachable.rs:27:9 | -LL | ['a', 'b', 'c'] => {} //~ ERROR unreachable pattern +LL | ['a', 'b', 'c'] => {} | ^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/maybe-bounds.stderr b/src/test/ui/maybe-bounds.stderr index 58f5b790c097..20446c257df0 100644 --- a/src/test/ui/maybe-bounds.stderr +++ b/src/test/ui/maybe-bounds.stderr @@ -1,7 +1,7 @@ error: `?Trait` is not permitted in supertraits --> $DIR/maybe-bounds.rs:1:11 | -LL | trait Tr: ?Sized {} //~ ERROR `?Trait` is not permitted in supertraits +LL | trait Tr: ?Sized {} | ^^^^^^ | = note: traits are `?Sized` by default @@ -9,13 +9,13 @@ LL | trait Tr: ?Sized {} //~ ERROR `?Trait` is not permitted in supertraits error: `?Trait` is not permitted in trait object types --> $DIR/maybe-bounds.rs:3:16 | -LL | type A1 = Tr + (?Sized); //~ ERROR `?Trait` is not permitted in trait object types +LL | type A1 = Tr + (?Sized); | ^^^^^^^^ error: `?Trait` is not permitted in trait object types --> $DIR/maybe-bounds.rs:4:24 | -LL | type A2 = for<'a> Tr + (?Sized); //~ ERROR `?Trait` is not permitted in trait object types +LL | type A2 = for<'a> Tr + (?Sized); | ^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr index 53a07f5196e4..9e5f2ee4ce5f 100644 --- a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr +++ b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr @@ -9,7 +9,7 @@ LL | let mut x = Vec::new(); error[E0308]: mismatched types --> $DIR/method-ambig-one-trait-unknown-int-type.rs:33:20 | -LL | let y: usize = x.foo(); //~ ERROR mismatched types +LL | let y: usize = x.foo(); | ^^^^^^^ expected usize, found isize error: aborting due to 2 previous errors diff --git a/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr b/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr index 15379194777c..2b87ddfdf98e 100644 --- a/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/method-ambig-two-traits-cross-crate.rs:11:21 | -LL | fn main() { 1_usize.me(); } //~ ERROR E0034 +LL | fn main() { 1_usize.me(); } | ^^ multiple `me` found | note: candidate #1 is defined in an impl of the trait `Me2` for the type `usize` diff --git a/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr b/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr index a805ca3ca56b..6c493c67e29d 100644 --- a/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/method-ambig-two-traits-from-bounds.rs:5:7 | -LL | t.foo(); //~ ERROR E0034 +LL | t.foo(); | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `A` diff --git a/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr b/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr index cbb1754935a9..5d508d570225 100644 --- a/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/method-ambig-two-traits-with-default-method.rs:12:13 | -LL | 1_usize.method(); //~ ERROR E0034 +LL | 1_usize.method(); | ^^^^^^ multiple `method` found | note: candidate #1 is defined in an impl of the trait `Foo` for the type `usize` diff --git a/src/test/ui/methods/method-call-err-msg.stderr b/src/test/ui/methods/method-call-err-msg.stderr index 2113add63d61..0e901a98348b 100644 --- a/src/test/ui/methods/method-call-err-msg.stderr +++ b/src/test/ui/methods/method-call-err-msg.stderr @@ -4,7 +4,7 @@ error[E0061]: this function takes 0 parameters but 1 parameter was supplied LL | fn zero(self) -> Foo { self } | -------------------- defined here ... -LL | x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied +LL | x.zero(0) | ^^^^ expected 0 parameters error[E0061]: this function takes 1 parameter but 0 parameters were supplied @@ -13,7 +13,7 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied LL | fn one(self, _: isize) -> Foo { self } | ----------------------------- defined here ... -LL | .one() //~ ERROR this function takes 1 parameter but 0 parameters were supplied +LL | .one() | ^^^ expected 1 parameter error[E0061]: this function takes 2 parameters but 1 parameter was supplied @@ -22,7 +22,7 @@ error[E0061]: this function takes 2 parameters but 1 parameter was supplied LL | fn two(self, _: isize, _: isize) -> Foo { self } | --------------------------------------- defined here ... -LL | .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied +LL | .two(0); | ^^^ expected 2 parameters error[E0599]: no method named `take` found for type `Foo` in the current scope @@ -31,7 +31,7 @@ error[E0599]: no method named `take` found for type `Foo` in the current scope LL | pub struct Foo; | --------------- method `take` not found for this ... -LL | .take() //~ ERROR no method named `take` found for type `Foo` in the current scope +LL | .take() | ^^^^ | = note: the method `take` exists but the following trait bounds were not satisfied: diff --git a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr index 25432177a859..67fd8d7a13eb 100644 --- a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr @@ -1,7 +1,7 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/method-call-lifetime-args-unresolved.rs:2:15 | -LL | 0.clone::<'a>(); //~ ERROR use of undeclared lifetime name `'a` +LL | 0.clone::<'a>(); | ^^ undeclared lifetime error: aborting due to previous error diff --git a/src/test/ui/methods/method-call-type-binding.stderr b/src/test/ui/methods/method-call-type-binding.stderr index 27d6f93490bb..4b93082ace57 100644 --- a/src/test/ui/methods/method-call-type-binding.stderr +++ b/src/test/ui/methods/method-call-type-binding.stderr @@ -1,7 +1,7 @@ error[E0229]: associated type bindings are not allowed here --> $DIR/method-call-type-binding.rs:2:15 | -LL | 0.clone::(); //~ ERROR associated type bindings are not allowed here +LL | 0.clone::(); | ^^^^^^ associated type not allowed here error: aborting due to previous error diff --git a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr index 2d8449b96de4..3c2e9b017671 100644 --- a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr +++ b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:85:24 | -LL | let _seetype: () = z; //~ ERROR mismatched types +LL | let _seetype: () = z; | ^ expected (), found u32 | = note: expected type `()` @@ -10,7 +10,7 @@ LL | let _seetype: () = z; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:102:24 | -LL | let _seetype: () = z; //~ ERROR mismatched types +LL | let _seetype: () = z; | ^ expected (), found u64 | = note: expected type `()` @@ -19,7 +19,7 @@ LL | let _seetype: () = z; //~ ERROR mismatched types error[E0034]: multiple applicable items in scope --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:120:15 | -LL | let z = x.foo(); //~ ERROR multiple applicable items in scope +LL | let z = x.foo(); | ^^^ multiple `foo` found | note: candidate #1 is defined in an impl of the trait `internal::X` for the type `_` @@ -42,7 +42,7 @@ LL | fn foo(&self) -> u8; error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:137:24 | -LL | let _seetype: () = z; //~ ERROR mismatched types +LL | let _seetype: () = z; | ^ expected (), found u8 | = note: expected type `()` @@ -51,7 +51,7 @@ LL | let _seetype: () = z; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:155:24 | -LL | let _seetype: () = z; //~ ERROR mismatched types +LL | let _seetype: () = z; | ^ expected (), found u32 | = note: expected type `()` @@ -60,7 +60,7 @@ LL | let _seetype: () = z; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:172:24 | -LL | let _seetype: () = z; //~ ERROR mismatched types +LL | let _seetype: () = z; | ^ expected (), found u32 | = note: expected type `()` diff --git a/src/test/ui/methods/method-macro-backtrace.stderr b/src/test/ui/methods/method-macro-backtrace.stderr index 81098bbceb05..7860365476a3 100644 --- a/src/test/ui/methods/method-macro-backtrace.stderr +++ b/src/test/ui/methods/method-macro-backtrace.stderr @@ -3,7 +3,7 @@ error[E0201]: duplicate definitions with name `bar`: | LL | fn bar(&self) { } | ----------------- previous definition of `bar` here -LL | fn bar(&self) { } //~ ERROR duplicate definitions +LL | fn bar(&self) { } | ^^^^^^^^^^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/methods/method-missing-call.stderr b/src/test/ui/methods/method-missing-call.stderr index 886d92aa9253..3ab5f66a0c3f 100644 --- a/src/test/ui/methods/method-missing-call.stderr +++ b/src/test/ui/methods/method-missing-call.stderr @@ -1,13 +1,13 @@ error[E0615]: attempted to take value of method `get_x` on type `Point` --> $DIR/method-missing-call.rs:22:26 | -LL | .get_x;//~ ERROR attempted to take value of method `get_x` on type `Point` +LL | .get_x; | ^^^^^ help: use parentheses to call the method: `get_x()` error[E0615]: attempted to take value of method `filter_map` on type `std::iter::Filter, [closure@$DIR/method-missing-call.rs:27:20: 27:25]>, [closure@$DIR/method-missing-call.rs:28:23: 28:35]>` --> $DIR/method-missing-call.rs:29:16 | -LL | .filter_map; //~ ERROR attempted to take value of method `filter_map` on type +LL | .filter_map; | ^^^^^^^^^^ help: use parentheses to call the method: `filter_map(...)` error: aborting due to 2 previous errors diff --git a/src/test/ui/methods/method-self-arg-1.stderr b/src/test/ui/methods/method-self-arg-1.stderr index 8c80d01b18cb..8485a5403ff8 100644 --- a/src/test/ui/methods/method-self-arg-1.stderr +++ b/src/test/ui/methods/method-self-arg-1.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/method-self-arg-1.rs:11:14 | -LL | Foo::bar(x); //~ ERROR mismatched types +LL | Foo::bar(x); | ^ | | | expected &Foo, found struct `Foo` @@ -13,7 +13,7 @@ LL | Foo::bar(x); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/method-self-arg-1.rs:15:14 | -LL | Foo::bar(&42); //~ ERROR mismatched types +LL | Foo::bar(&42); | ^^^ expected struct `Foo`, found integer | = note: expected type `&Foo` diff --git a/src/test/ui/methods/method-self-arg-2.stderr b/src/test/ui/methods/method-self-arg-2.stderr index 9746ac316d92..56cc8c83fe14 100644 --- a/src/test/ui/methods/method-self-arg-2.stderr +++ b/src/test/ui/methods/method-self-arg-2.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let y = &mut x; | - mutable borrow occurs here -LL | Foo::bar(&x); //~ERROR cannot borrow `x` +LL | Foo::bar(&x); | ^ immutable borrow occurs here ... LL | } @@ -14,7 +14,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | - first mutable borrow occurs here -LL | Foo::baz(&mut x); //~ERROR cannot borrow `x` +LL | Foo::baz(&mut x); | ^ second mutable borrow occurs here LL | y.use_mut(); LL | } diff --git a/src/test/ui/mir-dataflow/def-inits-1.stderr b/src/test/ui/mir-dataflow/def-inits-1.stderr index 93debd6c15d5..6bc5f7dcb99f 100644 --- a/src/test/ui/mir-dataflow/def-inits-1.stderr +++ b/src/test/ui/mir-dataflow/def-inits-1.stderr @@ -1,25 +1,25 @@ error: rustc_peek: bit not set --> $DIR/def-inits-1.rs:15:14 | -LL | unsafe { rustc_peek(&ret); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&ret); } | ^^^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/def-inits-1.rs:31:14 | -LL | unsafe { rustc_peek(&z); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&z); } | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/def-inits-1.rs:34:14 | -LL | unsafe { rustc_peek(&y); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&y); } | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/def-inits-1.rs:42:14 | -LL | unsafe { rustc_peek(&x); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&x); } | ^^^^^^^^^^^^^^ error: stop_after_dataflow ended compilation diff --git a/src/test/ui/mir-dataflow/inits-1.stderr b/src/test/ui/mir-dataflow/inits-1.stderr index 7ee61e6be2c8..38a9c60b168d 100644 --- a/src/test/ui/mir-dataflow/inits-1.stderr +++ b/src/test/ui/mir-dataflow/inits-1.stderr @@ -1,19 +1,19 @@ error: rustc_peek: bit not set --> $DIR/inits-1.rs:15:14 | -LL | unsafe { rustc_peek(&ret); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&ret); } | ^^^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/inits-1.rs:35:14 | -LL | unsafe { rustc_peek(&y); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&y); } | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/inits-1.rs:43:14 | -LL | unsafe { rustc_peek(&x); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&x); } | ^^^^^^^^^^^^^^ error: stop_after_dataflow ended compilation diff --git a/src/test/ui/mir-dataflow/uninits-1.stderr b/src/test/ui/mir-dataflow/uninits-1.stderr index 21ad0b3c2c16..c60987050e63 100644 --- a/src/test/ui/mir-dataflow/uninits-1.stderr +++ b/src/test/ui/mir-dataflow/uninits-1.stderr @@ -1,31 +1,31 @@ error: rustc_peek: bit not set --> $DIR/uninits-1.rs:19:14 | -LL | unsafe { rustc_peek(&x) }; //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&x) }; | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/uninits-1.rs:20:14 | -LL | unsafe { rustc_peek(&y) }; //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&y) }; | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/uninits-1.rs:21:14 | -LL | unsafe { rustc_peek(&z) }; //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&z) }; | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/uninits-1.rs:37:14 | -LL | unsafe { rustc_peek(&x); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&x); } | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/uninits-1.rs:45:14 | -LL | unsafe { rustc_peek(&ret); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&ret); } | ^^^^^^^^^^^^^^^^ error: stop_after_dataflow ended compilation diff --git a/src/test/ui/mir-dataflow/uninits-2.stderr b/src/test/ui/mir-dataflow/uninits-2.stderr index 08959ce3b132..de3e58e52de4 100644 --- a/src/test/ui/mir-dataflow/uninits-2.stderr +++ b/src/test/ui/mir-dataflow/uninits-2.stderr @@ -1,7 +1,7 @@ error: rustc_peek: bit not set --> $DIR/uninits-2.rs:15:14 | -LL | unsafe { rustc_peek(&x) }; //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&x) }; | ^^^^^^^^^^^^^^ error: stop_after_dataflow ended compilation diff --git a/src/test/ui/mir-unpretty.stderr b/src/test/ui/mir-unpretty.stderr index 59e8c0bf0902..6e5dac226692 100644 --- a/src/test/ui/mir-unpretty.stderr +++ b/src/test/ui/mir-unpretty.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/mir-unpretty.rs:4:17 | -LL | let x: () = 0; //~ ERROR: mismatched types +LL | let x: () = 0; | ^ expected (), found integer | = note: expected type `()` diff --git a/src/test/ui/mismatched_types/E0409.stderr b/src/test/ui/mismatched_types/E0409.stderr index 08f132efd052..93115bfb998e 100644 --- a/src/test/ui/mismatched_types/E0409.stderr +++ b/src/test/ui/mismatched_types/E0409.stderr @@ -1,7 +1,7 @@ error[E0409]: variable `y` is bound in inconsistent ways within the same match arm --> $DIR/E0409.rs:5:23 | -LL | (0, ref y) | (y, 0) => {} //~ ERROR E0409 +LL | (0, ref y) | (y, 0) => {} | - ^ bound in different ways | | | first binding @@ -9,7 +9,7 @@ LL | (0, ref y) | (y, 0) => {} //~ ERROR E0409 error[E0308]: mismatched types --> $DIR/E0409.rs:5:23 | -LL | (0, ref y) | (y, 0) => {} //~ ERROR E0409 +LL | (0, ref y) | (y, 0) => {} | ^ expected &{integer}, found integer | = note: expected type `&{integer}` diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr index df320a2059b8..f2bc6e1692f7 100644 --- a/src/test/ui/mismatched_types/E0631.stderr +++ b/src/test/ui/mismatched_types/E0631.stderr @@ -1,7 +1,7 @@ error[E0631]: type mismatch in closure arguments --> $DIR/E0631.rs:7:5 | -LL | foo(|_: isize| {}); //~ ERROR type mismatch +LL | foo(|_: isize| {}); | ^^^ ---------- found signature of `fn(isize) -> _` | | | expected signature of `fn(usize) -> _` @@ -15,7 +15,7 @@ LL | fn foo(_: F) {} error[E0631]: type mismatch in closure arguments --> $DIR/E0631.rs:8:5 | -LL | bar(|_: isize| {}); //~ ERROR type mismatch +LL | bar(|_: isize| {}); | ^^^ ---------- found signature of `fn(isize) -> _` | | | expected signature of `fn(usize) -> _` @@ -32,7 +32,7 @@ error[E0631]: type mismatch in function arguments LL | fn f(_: u64) {} | ------------ found signature of `fn(u64) -> _` ... -LL | foo(f); //~ ERROR type mismatch +LL | foo(f); | ^^^ expected signature of `fn(usize) -> _` | note: required by `foo` @@ -47,7 +47,7 @@ error[E0631]: type mismatch in function arguments LL | fn f(_: u64) {} | ------------ found signature of `fn(u64) -> _` ... -LL | bar(f); //~ ERROR type mismatch +LL | bar(f); | ^^^ expected signature of `fn(usize) -> _` | note: required by `bar` diff --git a/src/test/ui/mismatched_types/abridged.stderr b/src/test/ui/mismatched_types/abridged.stderr index 6a5cf7db4eed..b7f3b3dde8a9 100644 --- a/src/test/ui/mismatched_types/abridged.stderr +++ b/src/test/ui/mismatched_types/abridged.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn a() -> Foo { | --- expected `Foo` because of return type -LL | Some(Foo { bar: 1 }) //~ ERROR mismatched types +LL | Some(Foo { bar: 1 }) | ^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::option::Option` | = note: expected type `Foo` @@ -14,7 +14,7 @@ error[E0308]: mismatched types | LL | fn a2() -> Foo { | --- expected `Foo` because of return type -LL | Ok(Foo { bar: 1}) //~ ERROR mismatched types +LL | Ok(Foo { bar: 1}) | ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::result::Result` | = note: expected type `Foo` @@ -25,7 +25,7 @@ error[E0308]: mismatched types | LL | fn b() -> Option { | ----------- expected `std::option::Option` because of return type -LL | Foo { bar: 1 } //~ ERROR mismatched types +LL | Foo { bar: 1 } | ^^^^^^^^^^^^^^ expected enum `std::option::Option`, found struct `Foo` | = note: expected type `std::option::Option` @@ -36,7 +36,7 @@ error[E0308]: mismatched types | LL | fn c() -> Result { | ---------------- expected `std::result::Result` because of return type -LL | Foo { bar: 1 } //~ ERROR mismatched types +LL | Foo { bar: 1 } | ^^^^^^^^^^^^^^ expected enum `std::result::Result`, found struct `Foo` | = note: expected type `std::result::Result` @@ -48,7 +48,7 @@ error[E0308]: mismatched types LL | fn d() -> X, String> { | ---------------------------- expected `X, std::string::String>` because of return type ... -LL | x //~ ERROR mismatched types +LL | x | ^ expected struct `std::string::String`, found integer | = note: expected type `X, std::string::String>` @@ -60,7 +60,7 @@ error[E0308]: mismatched types LL | fn e() -> X, String> { | ---------------------------- expected `X, std::string::String>` because of return type ... -LL | x //~ ERROR mismatched types +LL | x | ^ expected struct `std::string::String`, found integer | = note: expected type `X, _>` diff --git a/src/test/ui/mismatched_types/binops.stderr b/src/test/ui/mismatched_types/binops.stderr index 76ea0ab54c3d..9dda44a85686 100644 --- a/src/test/ui/mismatched_types/binops.stderr +++ b/src/test/ui/mismatched_types/binops.stderr @@ -1,7 +1,7 @@ error[E0277]: cannot add `std::option::Option<{integer}>` to `{integer}` --> $DIR/binops.rs:2:7 | -LL | 1 + Some(1); //~ ERROR cannot add `std::option::Option<{integer}>` to `{integer}` +LL | 1 + Some(1); | ^ no implementation for `{integer} + std::option::Option<{integer}>` | = help: the trait `std::ops::Add>` is not implemented for `{integer}` @@ -9,7 +9,7 @@ LL | 1 + Some(1); //~ ERROR cannot add `std::option::Option<{integer}>` to ` error[E0277]: cannot subtract `std::option::Option<{integer}>` from `usize` --> $DIR/binops.rs:3:16 | -LL | 2 as usize - Some(1); //~ ERROR cannot subtract `std::option::Option<{integer}>` from `usize` +LL | 2 as usize - Some(1); | ^ no implementation for `usize - std::option::Option<{integer}>` | = help: the trait `std::ops::Sub>` is not implemented for `usize` @@ -17,7 +17,7 @@ LL | 2 as usize - Some(1); //~ ERROR cannot subtract `std::option::Option<{i error[E0277]: cannot multiply `()` to `{integer}` --> $DIR/binops.rs:4:7 | -LL | 3 * (); //~ ERROR cannot multiply `()` to `{integer}` +LL | 3 * (); | ^ no implementation for `{integer} * ()` | = help: the trait `std::ops::Mul<()>` is not implemented for `{integer}` @@ -25,7 +25,7 @@ LL | 3 * (); //~ ERROR cannot multiply `()` to `{integer}` error[E0277]: cannot divide `{integer}` by `&str` --> $DIR/binops.rs:5:7 | -LL | 4 / ""; //~ ERROR cannot divide `{integer}` by `&str` +LL | 4 / ""; | ^ no implementation for `{integer} / &str` | = help: the trait `std::ops::Div<&str>` is not implemented for `{integer}` @@ -33,7 +33,7 @@ LL | 4 / ""; //~ ERROR cannot divide `{integer}` by `&str` error[E0277]: can't compare `{integer}` with `std::string::String` --> $DIR/binops.rs:6:7 | -LL | 5 < String::new(); //~ ERROR can't compare `{integer}` with `std::string::String` +LL | 5 < String::new(); | ^ no implementation for `{integer} < std::string::String` and `{integer} > std::string::String` | = help: the trait `std::cmp::PartialOrd` is not implemented for `{integer}` @@ -41,7 +41,7 @@ LL | 5 < String::new(); //~ ERROR can't compare `{integer}` with `std::strin error[E0277]: can't compare `{integer}` with `std::result::Result<{integer}, _>` --> $DIR/binops.rs:7:7 | -LL | 6 == Ok(1); //~ ERROR can't compare `{integer}` with `std::result::Result<{integer}, _>` +LL | 6 == Ok(1); | ^^ no implementation for `{integer} == std::result::Result<{integer}, _>` | = help: the trait `std::cmp::PartialEq>` is not implemented for `{integer}` diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index 76091f2d09ed..c30f0acaa57d 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `*const U` as `*const V` is invalid --> $DIR/cast-rfc0401.rs:3:5 | -LL | u as *const V //~ ERROR is invalid +LL | u as *const V | ^^^^^^^^^^^^^ | = note: vtable kinds may not match @@ -9,7 +9,7 @@ LL | u as *const V //~ ERROR is invalid error[E0606]: casting `*const U` as `*const str` is invalid --> $DIR/cast-rfc0401.rs:8:5 | -LL | u as *const str //~ ERROR is invalid +LL | u as *const str | ^^^^^^^^^^^^^^^ | = note: vtable kinds may not match @@ -17,13 +17,13 @@ LL | u as *const str //~ ERROR is invalid error[E0609]: no field `f` on type `fn() {main}` --> $DIR/cast-rfc0401.rs:65:18 | -LL | let _ = main.f as *const u32; //~ ERROR no field +LL | let _ = main.f as *const u32; | ^ error[E0605]: non-primitive cast: `*const u8` as `&u8` --> $DIR/cast-rfc0401.rs:29:13 | -LL | let _ = v as &u8; //~ ERROR non-primitive cast +LL | let _ = v as &u8; | ^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -31,7 +31,7 @@ LL | let _ = v as &u8; //~ ERROR non-primitive cast error[E0605]: non-primitive cast: `*const u8` as `E` --> $DIR/cast-rfc0401.rs:30:13 | -LL | let _ = v as E; //~ ERROR non-primitive cast +LL | let _ = v as E; | ^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -39,7 +39,7 @@ LL | let _ = v as E; //~ ERROR non-primitive cast error[E0605]: non-primitive cast: `*const u8` as `fn()` --> $DIR/cast-rfc0401.rs:31:13 | -LL | let _ = v as fn(); //~ ERROR non-primitive cast +LL | let _ = v as fn(); | ^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -47,7 +47,7 @@ LL | let _ = v as fn(); //~ ERROR non-primitive cast error[E0605]: non-primitive cast: `*const u8` as `(u32,)` --> $DIR/cast-rfc0401.rs:32:13 | -LL | let _ = v as (u32,); //~ ERROR non-primitive cast +LL | let _ = v as (u32,); | ^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -55,7 +55,7 @@ LL | let _ = v as (u32,); //~ ERROR non-primitive cast error[E0605]: non-primitive cast: `std::option::Option<&*const u8>` as `*const u8` --> $DIR/cast-rfc0401.rs:33:13 | -LL | let _ = Some(&v) as *const u8; //~ ERROR non-primitive cast +LL | let _ = Some(&v) as *const u8; | ^^^^^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -63,19 +63,19 @@ LL | let _ = Some(&v) as *const u8; //~ ERROR non-primitive cast error[E0606]: casting `*const u8` as `f32` is invalid --> $DIR/cast-rfc0401.rs:35:13 | -LL | let _ = v as f32; //~ ERROR is invalid +LL | let _ = v as f32; | ^^^^^^^^ error[E0606]: casting `fn() {main}` as `f64` is invalid --> $DIR/cast-rfc0401.rs:36:13 | -LL | let _ = main as f64; //~ ERROR is invalid +LL | let _ = main as f64; | ^^^^^^^^^^^ error[E0606]: casting `&*const u8` as `usize` is invalid --> $DIR/cast-rfc0401.rs:37:13 | -LL | let _ = &v as usize; //~ ERROR is invalid +LL | let _ = &v as usize; | ^^^^^^^^^^^ | = help: cast through a raw pointer first @@ -83,31 +83,31 @@ LL | let _ = &v as usize; //~ ERROR is invalid error[E0606]: casting `f32` as `*const u8` is invalid --> $DIR/cast-rfc0401.rs:38:13 | -LL | let _ = f as *const u8; //~ ERROR is invalid +LL | let _ = f as *const u8; | ^^^^^^^^^^^^^^ error[E0054]: cannot cast as `bool` --> $DIR/cast-rfc0401.rs:39:13 | -LL | let _ = 3_i32 as bool; //~ ERROR cannot cast +LL | let _ = 3_i32 as bool; | ^^^^^^^^^^^^^ help: compare with zero instead: `3_i32 != 0` error[E0054]: cannot cast as `bool` --> $DIR/cast-rfc0401.rs:40:13 | -LL | let _ = E::A as bool; //~ ERROR cannot cast +LL | let _ = E::A as bool; | ^^^^^^^^^^^^ unsupported cast error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/cast-rfc0401.rs:41:13 | -LL | let _ = 0x61u32 as char; //~ ERROR can be cast as +LL | let _ = 0x61u32 as char; | ^^^^^^^^^^^^^^^ error[E0606]: casting `bool` as `f32` is invalid --> $DIR/cast-rfc0401.rs:43:13 | -LL | let _ = false as f32; //~ ERROR is invalid +LL | let _ = false as f32; | ^^^^^^^^^^^^ | = help: cast through an integer first @@ -115,7 +115,7 @@ LL | let _ = false as f32; //~ ERROR is invalid error[E0606]: casting `E` as `f32` is invalid --> $DIR/cast-rfc0401.rs:44:13 | -LL | let _ = E::A as f32; //~ ERROR is invalid +LL | let _ = E::A as f32; | ^^^^^^^^^^^ | = help: cast through an integer first @@ -123,7 +123,7 @@ LL | let _ = E::A as f32; //~ ERROR is invalid error[E0606]: casting `char` as `f32` is invalid --> $DIR/cast-rfc0401.rs:45:13 | -LL | let _ = 'a' as f32; //~ ERROR is invalid +LL | let _ = 'a' as f32; | ^^^^^^^^^^ | = help: cast through an integer first @@ -131,67 +131,67 @@ LL | let _ = 'a' as f32; //~ ERROR is invalid error[E0606]: casting `bool` as `*const u8` is invalid --> $DIR/cast-rfc0401.rs:47:13 | -LL | let _ = false as *const u8; //~ ERROR is invalid +LL | let _ = false as *const u8; | ^^^^^^^^^^^^^^^^^^ error[E0606]: casting `E` as `*const u8` is invalid --> $DIR/cast-rfc0401.rs:48:13 | -LL | let _ = E::A as *const u8; //~ ERROR is invalid +LL | let _ = E::A as *const u8; | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `char` as `*const u8` is invalid --> $DIR/cast-rfc0401.rs:49:13 | -LL | let _ = 'a' as *const u8; //~ ERROR is invalid +LL | let _ = 'a' as *const u8; | ^^^^^^^^^^^^^^^^ error[E0606]: casting `usize` as `*const [u8]` is invalid --> $DIR/cast-rfc0401.rs:51:13 | -LL | let _ = 42usize as *const [u8]; //~ ERROR is invalid +LL | let _ = 42usize as *const [u8]; | ^^^^^^^^^^^^^^^^^^^^^^ error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]` --> $DIR/cast-rfc0401.rs:52:13 | -LL | let _ = v as *const [u8]; //~ ERROR cannot cast +LL | let _ = v as *const [u8]; | ^^^^^^^^^^^^^^^^ error[E0606]: casting `&dyn Foo` as `*const str` is invalid --> $DIR/cast-rfc0401.rs:54:13 | -LL | let _ = foo as *const str; //~ ERROR is invalid +LL | let _ = foo as *const str; | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `&dyn Foo` as `*mut str` is invalid --> $DIR/cast-rfc0401.rs:55:13 | -LL | let _ = foo as *mut str; //~ ERROR is invalid +LL | let _ = foo as *mut str; | ^^^^^^^^^^^^^^^ error[E0606]: casting `fn() {main}` as `*mut str` is invalid --> $DIR/cast-rfc0401.rs:56:13 | -LL | let _ = main as *mut str; //~ ERROR is invalid +LL | let _ = main as *mut str; | ^^^^^^^^^^^^^^^^ error[E0606]: casting `&f32` as `*mut f32` is invalid --> $DIR/cast-rfc0401.rs:57:13 | -LL | let _ = &f as *mut f32; //~ ERROR is invalid +LL | let _ = &f as *mut f32; | ^^^^^^^^^^^^^^ error[E0606]: casting `&f32` as `*const f64` is invalid --> $DIR/cast-rfc0401.rs:58:13 | -LL | let _ = &f as *const f64; //~ ERROR is invalid +LL | let _ = &f as *const f64; | ^^^^^^^^^^^^^^^^ error[E0606]: casting `*const [i8]` as `usize` is invalid --> $DIR/cast-rfc0401.rs:59:13 | -LL | let _ = fat_sv as usize; //~ ERROR is invalid +LL | let _ = fat_sv as usize; | ^^^^^^^^^^^^^^^ | = help: cast through a thin pointer first @@ -199,7 +199,7 @@ LL | let _ = fat_sv as usize; //~ ERROR is invalid error[E0606]: casting `*const dyn Foo` as `*const [u16]` is invalid --> $DIR/cast-rfc0401.rs:68:13 | -LL | let _ = cf as *const [u16]; //~ ERROR is invalid +LL | let _ = cf as *const [u16]; | ^^^^^^^^^^^^^^^^^^ | = note: vtable kinds may not match @@ -207,7 +207,7 @@ LL | let _ = cf as *const [u16]; //~ ERROR is invalid error[E0606]: casting `*const dyn Foo` as `*const dyn Bar` is invalid --> $DIR/cast-rfc0401.rs:69:13 | -LL | let _ = cf as *const Bar; //~ ERROR is invalid +LL | let _ = cf as *const Bar; | ^^^^^^^^^^^^^^^^ | = note: vtable kinds may not match @@ -215,7 +215,7 @@ LL | let _ = cf as *const Bar; //~ ERROR is invalid error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/cast-rfc0401.rs:53:13 | -LL | let _ = fat_v as *const Foo; //~ ERROR the size for values of type +LL | let _ = fat_v as *const Foo; | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` @@ -225,7 +225,7 @@ LL | let _ = fat_v as *const Foo; //~ ERROR the size for values of type error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/cast-rfc0401.rs:62:13 | -LL | let _ = a as *const Foo; //~ ERROR the size for values of type +LL | let _ = a as *const Foo; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` @@ -235,7 +235,7 @@ LL | let _ = a as *const Foo; //~ ERROR the size for values of type error[E0606]: casting `&{float}` as `f32` is invalid --> $DIR/cast-rfc0401.rs:71:30 | -LL | vec![0.0].iter().map(|s| s as f32).collect::>(); //~ ERROR is invalid +LL | vec![0.0].iter().map(|s| s as f32).collect::>(); | -^^^^^^^ | | | cannot cast `&{float}` as `f32` diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index 5dd6887005e8..cf392e1731b0 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -1,7 +1,7 @@ error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:3:14 | -LL | a.iter().map(|_: (u32, u32)| 45); //~ ERROR type mismatch +LL | a.iter().map(|_: (u32, u32)| 45); | ^^^ ------------------ found signature of `fn((u32, u32)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` @@ -9,7 +9,7 @@ LL | a.iter().map(|_: (u32, u32)| 45); //~ ERROR type mismatch error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:4:14 | -LL | a.iter().map(|_: &(u16, u16)| 45); //~ ERROR type mismatch +LL | a.iter().map(|_: &(u16, u16)| 45); | ^^^ ------------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` @@ -17,7 +17,7 @@ LL | a.iter().map(|_: &(u16, u16)| 45); //~ ERROR type mismatch error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:5:14 | -LL | a.iter().map(|_: (u16, u16)| 45); //~ ERROR type mismatch +LL | a.iter().map(|_: (u16, u16)| 45); | ^^^ ------------------ found signature of `fn((u16, u16)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` @@ -25,7 +25,7 @@ LL | a.iter().map(|_: (u16, u16)| 45); //~ ERROR type mismatch error[E0631]: type mismatch in function arguments --> $DIR/closure-arg-type-mismatch.rs:10:5 | -LL | baz(f); //~ ERROR type mismatch +LL | baz(f); | ^^^ | | | expected signature of `for<'r> fn(*mut &'r u32) -> _` @@ -40,7 +40,7 @@ LL | fn baz(_: F) {} error[E0271]: type mismatch resolving `for<'r> >::Output == ()` --> $DIR/closure-arg-type-mismatch.rs:10:5 | -LL | baz(f); //~ ERROR type mismatch +LL | baz(f); | ^^^ expected bound lifetime parameter, found concrete lifetime | note: required by `baz` diff --git a/src/test/ui/mismatched_types/closure-mismatch.stderr b/src/test/ui/mismatched_types/closure-mismatch.stderr index e55047e96c29..6fbc92256125 100644 --- a/src/test/ui/mismatched_types/closure-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-mismatch.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/closure-mismatch.rs:8:9: 8:15] as std::ops::FnOnce<(&'r (),)>>::Output == ()` --> $DIR/closure-mismatch.rs:8:5 | -LL | baz(|_| ()); //~ ERROR type mismatch +LL | baz(|_| ()); | ^^^ expected bound lifetime parameter, found concrete lifetime | = note: required because of the requirements on the impl of `Foo` for `[closure@$DIR/closure-mismatch.rs:8:9: 8:15]` @@ -14,7 +14,7 @@ LL | fn baz(_: T) {} error[E0631]: type mismatch in closure arguments --> $DIR/closure-mismatch.rs:8:5 | -LL | baz(|_| ()); //~ ERROR type mismatch +LL | baz(|_| ()); | ^^^ ------ found signature of `fn(_) -> _` | | | expected signature of `for<'r> fn(&'r ()) -> _` diff --git a/src/test/ui/mismatched_types/const-fn-in-trait.stderr b/src/test/ui/mismatched_types/const-fn-in-trait.stderr index e1482d7c4507..ec1f36bf0877 100644 --- a/src/test/ui/mismatched_types/const-fn-in-trait.stderr +++ b/src/test/ui/mismatched_types/const-fn-in-trait.stderr @@ -1,13 +1,13 @@ error[E0379]: trait fns cannot be declared const --> $DIR/const-fn-in-trait.rs:7:5 | -LL | const fn g(); //~ ERROR cannot be declared const +LL | const fn g(); | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const --> $DIR/const-fn-in-trait.rs:11:5 | -LL | const fn f() -> u32 { 22 } //~ ERROR cannot be declared const +LL | const fn f() -> u32 { 22 } | ^^^^^ trait fns cannot be const error: aborting due to 2 previous errors diff --git a/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr b/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr index 25203d6f35d2..3c8ba8057c55 100644 --- a/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr +++ b/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/for-loop-has-unit-body.rs:3:9 | -LL | x //~ ERROR mismatched types +LL | x | ^ expected (), found integer | = note: expected type `()` diff --git a/src/test/ui/mismatched_types/issue-26480.stderr b/src/test/ui/mismatched_types/issue-26480.stderr index 11aa6cd7c1ba..ef7a8d385374 100644 --- a/src/test/ui/mismatched_types/issue-26480.stderr +++ b/src/test/ui/mismatched_types/issue-26480.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-26480.rs:16:19 | -LL | $arr.len() * size_of($arr[0])); //~ ERROR mismatched types +LL | $arr.len() * size_of($arr[0])); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found usize ... LL | write!(hello); @@ -10,7 +10,7 @@ LL | write!(hello); error[E0605]: non-primitive cast: `{integer}` as `()` --> $DIR/issue-26480.rs:22:19 | -LL | ($x:expr) => ($x as ()) //~ ERROR non-primitive cast +LL | ($x:expr) => ($x as ()) | ^^^^^^^^ ... LL | cast!(2); diff --git a/src/test/ui/mismatched_types/issue-35030.stderr b/src/test/ui/mismatched_types/issue-35030.stderr index 6a3e7d930cf2..f03067016134 100644 --- a/src/test/ui/mismatched_types/issue-35030.stderr +++ b/src/test/ui/mismatched_types/issue-35030.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-35030.rs:9:14 | -LL | Some(true) //~ ERROR mismatched types +LL | Some(true) | ^^^^ expected type parameter, found bool | = note: expected type `bool` (type parameter) diff --git a/src/test/ui/mismatched_types/issue-38371.stderr b/src/test/ui/mismatched_types/issue-38371.stderr index f702a4f47f10..d16869237302 100644 --- a/src/test/ui/mismatched_types/issue-38371.stderr +++ b/src/test/ui/mismatched_types/issue-38371.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-38371.rs:4:8 | -LL | fn foo(&foo: Foo) { //~ ERROR mismatched types +LL | fn foo(&foo: Foo) { | ^^^^ expected struct `Foo`, found reference | = note: expected type `Foo` @@ -11,7 +11,7 @@ LL | fn foo(&foo: Foo) { //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/issue-38371.rs:18:9 | -LL | fn agh(&&bar: &u32) { //~ ERROR mismatched types +LL | fn agh(&&bar: &u32) { | ^^^^ expected u32, found reference | = note: expected type `u32` @@ -21,7 +21,7 @@ LL | fn agh(&&bar: &u32) { //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/issue-38371.rs:21:8 | -LL | fn bgh(&&bar: u32) { //~ ERROR mismatched types +LL | fn bgh(&&bar: u32) { | ^^^^^ expected u32, found reference | = note: expected type `u32` @@ -30,7 +30,7 @@ LL | fn bgh(&&bar: u32) { //~ ERROR mismatched types error[E0529]: expected an array or slice, found `u32` --> $DIR/issue-38371.rs:24:9 | -LL | fn ugh(&[bar]: &u32) { //~ ERROR expected an array or slice +LL | fn ugh(&[bar]: &u32) { | ^^^^^ pattern cannot match with input type `u32` error: aborting due to 4 previous errors diff --git a/src/test/ui/mismatched_types/main.stderr b/src/test/ui/mismatched_types/main.stderr index 57e95e413337..1d53cfdd2527 100644 --- a/src/test/ui/mismatched_types/main.stderr +++ b/src/test/ui/mismatched_types/main.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/main.rs:2:18 | -LL | let x: u32 = ( //~ ERROR mismatched types +LL | let x: u32 = ( | __________________^ LL | | ); | |_____^ expected u32, found () diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr index 51975abd720f..3551e4105f8c 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/overloaded-calls-bad.rs:28:17 | -LL | let ans = s("what"); //~ ERROR mismatched types +LL | let ans = s("what"); | ^^^^^^ expected isize, found reference | = note: expected type `isize` diff --git a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr index a9b637c81a78..6475cce5aa62 100644 --- a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr +++ b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/trait-bounds-cant-coerce.rs:13:7 | -LL | a(x); //~ ERROR mismatched types [E0308] +LL | a(x); | ^ expected trait `Foo + std::marker::Send`, found trait `Foo` | = note: expected type `std::boxed::Box<(dyn Foo + std::marker::Send + 'static)>` diff --git a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr index 4e54b35029a5..8ea3567b948c 100644 --- a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr +++ b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr @@ -4,7 +4,7 @@ error[E0053]: method `foo` has an incompatible type for trait LL | fn foo(x: u16); | --- type in trait ... -LL | fn foo(x: i16) { } //~ ERROR incompatible type +LL | fn foo(x: i16) { } | ^^^ expected u16, found i16 | = note: expected type `fn(u16)` @@ -16,14 +16,14 @@ error[E0053]: method `bar` has an incompatible type for trait LL | fn bar(&mut self, bar: &mut Bar); | -------- type in trait ... -LL | fn bar(&mut self, bar: &Bar) { } //~ ERROR incompatible type +LL | fn bar(&mut self, bar: &Bar) { } | ^^^^ types differ in mutability | = note: expected type `fn(&mut Bar, &mut Bar)` found type `fn(&mut Bar, &Bar)` help: consider change the type to match the mutability in trait | -LL | fn bar(&mut self, bar: &mut Bar) { } //~ ERROR incompatible type +LL | fn bar(&mut self, bar: &mut Bar) { } | ^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index 8db81a8c6835..ad0eefa27a10 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -3,7 +3,7 @@ error[E0631]: type mismatch in closure arguments | LL | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); | ----------------------------- found signature of `fn(usize, isize) -> _` -LL | //~^ NOTE found signature of `fn(usize, isize) -> _` +LL | LL | let z = call_it(3, f); | ^^^^^^^ expected signature of `fn(isize, isize) -> _` | diff --git a/src/test/ui/missing/missing-block-hint.stderr b/src/test/ui/missing/missing-block-hint.stderr index 576a6268a99d..ee86a3241e82 100644 --- a/src/test/ui/missing/missing-block-hint.stderr +++ b/src/test/ui/missing/missing-block-hint.stderr @@ -1,7 +1,7 @@ error: expected `{`, found `=>` --> $DIR/missing-block-hint.rs:3:18 | -LL | if (foo) => {} //~ ERROR expected `{`, found `=>` +LL | if (foo) => {} | -- ^^ expected `{` | | | this `if` statement has a condition, but no block @@ -11,7 +11,7 @@ error: expected `{`, found `bar` | LL | if (foo) | -- this `if` statement has a condition, but no block -LL | bar; //~ ERROR expected `{`, found `bar` +LL | bar; | ^^^- | | | expected `{` diff --git a/src/test/ui/missing/missing-derivable-attr.stderr b/src/test/ui/missing/missing-derivable-attr.stderr index e3e61bcb391e..9b8c0c583a1c 100644 --- a/src/test/ui/missing/missing-derivable-attr.stderr +++ b/src/test/ui/missing/missing-derivable-attr.stderr @@ -4,7 +4,7 @@ error[E0046]: not all trait items implemented, missing: `eq` LL | fn eq(&self, other: &Self) -> bool; | ----------------------------------- `eq` from trait ... -LL | impl MyEq for A {} //~ ERROR not all trait items implemented, missing: `eq` +LL | impl MyEq for A {} | ^^^^^^^^^^^^^^^ missing `eq` in implementation error: aborting due to previous error diff --git a/src/test/ui/missing/missing-items/issue-40221.stderr b/src/test/ui/missing/missing-items/issue-40221.stderr index 9e4ce7c81b70..8e5286f21001 100644 --- a/src/test/ui/missing/missing-items/issue-40221.stderr +++ b/src/test/ui/missing/missing-items/issue-40221.stderr @@ -7,7 +7,7 @@ LL | | C(PC), LL | | } | |_- `P` defined here ... -LL | match proto { //~ ERROR non-exhaustive patterns +LL | match proto { | ^^^^^ pattern `C(QA)` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/missing/missing-items/m2.stderr b/src/test/ui/missing/missing-items/m2.stderr index b2245750518b..d2dac4ca6454 100644 --- a/src/test/ui/missing/missing-items/m2.stderr +++ b/src/test/ui/missing/missing-items/m2.stderr @@ -1,7 +1,7 @@ error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method` --> $DIR/m2.rs:9:1 | -LL | impl m1::X for X { //~ ERROR not all trait items implemented +LL | impl m1::X for X { | ^^^^^^^^^^^^^^^^ missing `CONSTANT`, `Type`, `method` in implementation | = note: `CONSTANT` from trait: `const CONSTANT: u32;` diff --git a/src/test/ui/missing/missing-items/missing-type-parameter.stderr b/src/test/ui/missing/missing-items/missing-type-parameter.stderr index 619377198e1f..dbb467d60f9e 100644 --- a/src/test/ui/missing/missing-items/missing-type-parameter.stderr +++ b/src/test/ui/missing/missing-items/missing-type-parameter.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/missing-type-parameter.rs:4:5 | -LL | foo(); //~ ERROR type annotations needed +LL | foo(); | ^^^ cannot infer type for `X` error: aborting due to previous error diff --git a/src/test/ui/missing/missing-semicolon-warning.stderr b/src/test/ui/missing/missing-semicolon-warning.stderr index 50627c3252dd..b3f3ebc855da 100644 --- a/src/test/ui/missing/missing-semicolon-warning.stderr +++ b/src/test/ui/missing/missing-semicolon-warning.stderr @@ -1,7 +1,7 @@ warning: expected `;`, found keyword `let` --> $DIR/missing-semicolon-warning.rs:6:12 | -LL | $( let x = $e1 )*; //~ WARN expected `;` +LL | $( let x = $e1 )*; | ^^^ ... LL | fn main() { m!(0, 0; 0, 0); } @@ -12,7 +12,7 @@ LL | fn main() { m!(0, 0; 0, 0); } warning: expected `;`, found `println` --> $DIR/missing-semicolon-warning.rs:7:12 | -LL | $( println!("{}", $e2) )*; //~ WARN expected `;` +LL | $( println!("{}", $e2) )*; | ^^^^^^^ ... LL | fn main() { m!(0, 0; 0, 0); } diff --git a/src/test/ui/missing/missing-stability.stderr b/src/test/ui/missing/missing-stability.stderr index 6c81f2bac578..659f8c78cae6 100644 --- a/src/test/ui/missing/missing-stability.stderr +++ b/src/test/ui/missing/missing-stability.stderr @@ -2,7 +2,7 @@ error: function has missing stability attribute --> $DIR/missing-stability.rs:8:1 | LL | / pub fn unmarked() { -LL | | //~^ ERROR function has missing stability attribute +LL | | LL | | () LL | | } | |_^ diff --git a/src/test/ui/missing_debug_impls.stderr b/src/test/ui/missing_debug_impls.stderr index cceab4b4c0bf..bb8390a8f313 100644 --- a/src/test/ui/missing_debug_impls.stderr +++ b/src/test/ui/missing_debug_impls.stderr @@ -1,7 +1,7 @@ error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation --> $DIR/missing_debug_impls.rs:7:1 | -LL | pub enum A {} //~ ERROR type does not implement `fmt::Debug` +LL | pub enum A {} | ^^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(missing_debug_implementations)] error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation --> $DIR/missing_debug_impls.rs:20:1 | -LL | pub struct Foo; //~ ERROR type does not implement `fmt::Debug` +LL | pub struct Foo; | ^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/mod/mod_file_disambig.stderr b/src/test/ui/mod/mod_file_disambig.stderr index 1720ca420ca2..2b77d866fb30 100644 --- a/src/test/ui/mod/mod_file_disambig.stderr +++ b/src/test/ui/mod/mod_file_disambig.stderr @@ -1,7 +1,7 @@ error[E0584]: file for module `mod_file_disambig_aux` found at both mod_file_disambig_aux.rs and mod_file_disambig_aux/mod.rs --> $DIR/mod_file_disambig.rs:1:5 | -LL | mod mod_file_disambig_aux; //~ ERROR file for module `mod_file_disambig_aux` found at both +LL | mod mod_file_disambig_aux; | ^^^^^^^^^^^^^^^^^^^^^ | = help: delete or rename one of them to remove the ambiguity diff --git a/src/test/ui/module-macro_use-arguments.stderr b/src/test/ui/module-macro_use-arguments.stderr index 4dc6df39a479..2a75736a2c69 100644 --- a/src/test/ui/module-macro_use-arguments.stderr +++ b/src/test/ui/module-macro_use-arguments.stderr @@ -1,7 +1,7 @@ error: arguments to macro_use are not allowed here --> $DIR/module-macro_use-arguments.rs:1:1 | -LL | #[macro_use(foo, bar)] //~ ERROR arguments to macro_use are not allowed here +LL | #[macro_use(foo, bar)] | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/moves/move-guard-same-consts.stderr b/src/test/ui/moves/move-guard-same-consts.stderr index 78a76a47b8a5..65f6f1239fe6 100644 --- a/src/test/ui/moves/move-guard-same-consts.stderr +++ b/src/test/ui/moves/move-guard-same-consts.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | (1, 2) if take(x) => (), | - value moved here -LL | (1, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (1, 2) if take(x) => (), | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/move-in-guard-1.stderr b/src/test/ui/moves/move-in-guard-1.stderr index d4cb538e05d1..af49fa82b0f6 100644 --- a/src/test/ui/moves/move-in-guard-1.stderr +++ b/src/test/ui/moves/move-in-guard-1.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | (1, _) if take(x) => (), | - value moved here -LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (_, 2) if take(x) => (), | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/move-in-guard-2.stderr b/src/test/ui/moves/move-in-guard-2.stderr index d4e747c9f61d..5228abe86efb 100644 --- a/src/test/ui/moves/move-in-guard-2.stderr +++ b/src/test/ui/moves/move-in-guard-2.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `x` --> $DIR/move-in-guard-2.rs:10:24 | -LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (_, 2) if take(x) => (), | ^ value moved here in previous iteration of loop | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/move-into-dead-array-1.stderr b/src/test/ui/moves/move-into-dead-array-1.stderr index 36f98a76b547..3a1bbe97d288 100644 --- a/src/test/ui/moves/move-into-dead-array-1.stderr +++ b/src/test/ui/moves/move-into-dead-array-1.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `a` --> $DIR/move-into-dead-array-1.rs:14:5 | -LL | a[i] = d(); //~ ERROR use of possibly uninitialized variable: `a` +LL | a[i] = d(); | ^^^^^^^^^^ use of possibly uninitialized `a` error: aborting due to previous error diff --git a/src/test/ui/moves/move-into-dead-array-2.stderr b/src/test/ui/moves/move-into-dead-array-2.stderr index 417b1ab20540..4521fa9bcb01 100644 --- a/src/test/ui/moves/move-into-dead-array-2.stderr +++ b/src/test/ui/moves/move-into-dead-array-2.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `a` | LL | drop(a); | - value moved here -LL | a[i] = d(); //~ ERROR use of moved value: `a` +LL | a[i] = d(); | ^^^^^^^^^^ value used here after move | = note: move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/move-out-of-array-1.stderr b/src/test/ui/moves/move-out-of-array-1.stderr index 677f0b42f5a2..fb191b89bda4 100644 --- a/src/test/ui/moves/move-out-of-array-1.stderr +++ b/src/test/ui/moves/move-out-of-array-1.stderr @@ -1,7 +1,7 @@ error[E0508]: cannot move out of type `[D; 4]`, a non-copy array --> $DIR/move-out-of-array-1.rs:17:5 | -LL | a[i] //~ ERROR cannot move out of type `[D; 4]`, a non-copy array +LL | a[i] | ^^^^ cannot move out of here error: aborting due to previous error diff --git a/src/test/ui/moves/move-out-of-slice-1.stderr b/src/test/ui/moves/move-out-of-slice-1.stderr index bfdf64198690..f84e3a3f3e31 100644 --- a/src/test/ui/moves/move-out-of-slice-1.stderr +++ b/src/test/ui/moves/move-out-of-slice-1.stderr @@ -1,7 +1,7 @@ error[E0508]: cannot move out of type `[A]`, a non-copy slice --> $DIR/move-out-of-slice-1.rs:8:13 | -LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice +LL | box [a] => {}, | ^-^ | || | |hint: to prevent move, use `ref a` or `ref mut a` diff --git a/src/test/ui/moves/move-out-of-tuple-field.stderr b/src/test/ui/moves/move-out-of-tuple-field.stderr index 6839c49c8296..89662c8303da 100644 --- a/src/test/ui/moves/move-out-of-tuple-field.stderr +++ b/src/test/ui/moves/move-out-of-tuple-field.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x.0` | LL | let y = x.0; | - value moved here -LL | let z = x.0; //~ ERROR use of moved value: `x.0` +LL | let z = x.0; | ^ value used here after move | = note: move occurs because `x.0` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x.0` | LL | let y = x.0; | - value moved here -LL | let z = x.0; //~ ERROR use of moved value: `x.0` +LL | let z = x.0; | ^ value used here after move | = note: move occurs because `x.0` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr index 882c1fe1706d..ed4d69f838e9 100644 --- a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr +++ b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | consume(x.into_iter().next().unwrap()); | - value moved here -LL | touch(&x[0]); //~ ERROR use of moved value: `x` +LL | touch(&x[0]); | ^ value used here after move | = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.stderr index 4ecaed3b69b5..f5328edfcc20 100644 --- a/src/test/ui/moves/moves-based-on-type-block-bad.stderr +++ b/src/test/ui/moves/moves-based-on-type-block-bad.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/moves-based-on-type-block-bad.rs:24:19 | -LL | match hellothere.x { //~ ERROR cannot move out +LL | match hellothere.x { | ^^^^^^^^^^ cannot move out of borrowed content ... LL | box E::Bar(x) => println!("{}", x.to_string()), diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr index 88e58fdf58bc..39119ff3aaad 100644 --- a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr +++ b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | thread::spawn(move|| { | ------ value moved (into closure) here ... -LL | println!("{}", x); //~ ERROR use of moved value +LL | println!("{}", x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr index 7624ba5fe28d..8b904c7169bd 100644 --- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr +++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr @@ -4,7 +4,7 @@ error[E0382]: use of partially moved value: `node` LL | Some(right) => consume(right), | ----- value moved here ... -LL | consume(node) + r //~ ERROR use of partially moved value: `node` +LL | consume(node) + r | ^^^^ value used here after move | = note: move occurs because the value has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr index 374ac61e7f5e..edf521a896fe 100644 --- a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr +++ b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr @@ -3,8 +3,8 @@ error[E0382]: use of moved value: `x` | LL | let _y = Foo { f:x }; | - value moved here -LL | //~^ NOTE value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -14,8 +14,8 @@ error[E0382]: use of moved value: `x` | LL | let _y = Foo { f:(((x))) }; | ------- value moved here -LL | //~^ NOTE value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-exprs.stderr b/src/test/ui/moves/moves-based-on-type-exprs.stderr index e6177c6b6c83..6cb297cbd633 100644 --- a/src/test/ui/moves/moves-based-on-type-exprs.stderr +++ b/src/test/ui/moves/moves-based-on-type-exprs.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = Foo { f:x }; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = (x, 3); | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -24,7 +24,7 @@ error[E0382]: use of moved value: `x` LL | x | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -35,7 +35,7 @@ error[E0382]: use of moved value: `y` LL | y | - value moved here ... -LL | touch(&y); //~ ERROR use of moved value: `y` +LL | touch(&y); | ^ value used here after move | = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait @@ -46,7 +46,7 @@ error[E0382]: use of moved value: `x` LL | true => x, | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -57,7 +57,7 @@ error[E0382]: use of moved value: `y` LL | false => y | - value moved here ... -LL | touch(&y); //~ ERROR use of moved value: `y` +LL | touch(&y); | ^ value used here after move | = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait @@ -68,7 +68,7 @@ error[E0382]: use of moved value: `x` LL | _ if guard(x) => 10, | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -78,7 +78,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = [x]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -88,7 +88,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = vec![x]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -98,7 +98,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = x.into_iter().next().unwrap(); | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait @@ -108,7 +108,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = [x.into_iter().next().unwrap(); 1]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.stderr b/src/test/ui/moves/moves-based-on-type-match-bindings.stderr index 41ced9dfd935..9174cfa122c3 100644 --- a/src/test/ui/moves/moves-based-on-type-match-bindings.stderr +++ b/src/test/ui/moves/moves-based-on-type-match-bindings.stderr @@ -4,7 +4,7 @@ error[E0382]: use of partially moved value: `x` LL | Foo {f} => {} | - value moved here ... -LL | touch(&x); //~ ERROR use of partially moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x.f` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr index 49113a57d2fa..654881d25e68 100644 --- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr +++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure | LL | let i = box 3; | - captured outer variable -LL | let _f = to_fn(|| test(i)); //~ ERROR cannot move out +LL | let _f = to_fn(|| test(i)); | ^ cannot move out of captured outer variable in an `Fn` closure error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr index 05ced7f0107a..fe91a488d10d 100644 --- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr +++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr @@ -12,7 +12,7 @@ error[E0382]: use of moved value: `f` | LL | let mut r = R {c: Box::new(f)}; | - value moved here -LL | f(&mut r, false) //~ ERROR use of moved value +LL | f(&mut r, false) | ^ value used here after move | = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-sru-moved-field.stderr b/src/test/ui/moves/moves-sru-moved-field.stderr index 3d38faa20a1e..aac399ea4a15 100644 --- a/src/test/ui/moves/moves-sru-moved-field.stderr +++ b/src/test/ui/moves/moves-sru-moved-field.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `f.moved` | LL | let _b = Foo {noncopyable: g, ..f}; | - value moved here -LL | let _c = Foo {noncopyable: h, ..f}; //~ ERROR use of moved value: `f.moved` +LL | let _c = Foo {noncopyable: h, ..f}; | ^ value used here after move | = note: move occurs because `f.moved` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/multiple-main-2.stderr b/src/test/ui/multiple-main-2.stderr index c761e74bb872..ae33e01cd26e 100644 --- a/src/test/ui/multiple-main-2.stderr +++ b/src/test/ui/multiple-main-2.stderr @@ -5,7 +5,7 @@ LL | / fn bar() { LL | | } | |_- first #[main] function ... -LL | / fn foo() { //~ ERROR multiple functions with a #[main] attribute +LL | / fn foo() { LL | | } | |_^ additional #[main] function diff --git a/src/test/ui/multiple-main-3.stderr b/src/test/ui/multiple-main-3.stderr index 2574f0ef6d81..b85637b8a56e 100644 --- a/src/test/ui/multiple-main-3.stderr +++ b/src/test/ui/multiple-main-3.stderr @@ -5,7 +5,7 @@ LL | / fn main1() { LL | | } | |_- first #[main] function ... -LL | / fn main2() { //~ ERROR multiple functions with a #[main] attribute +LL | / fn main2() { LL | | } | |_____^ additional #[main] function diff --git a/src/test/ui/mut/mut-cant-alias.stderr b/src/test/ui/mut/mut-cant-alias.stderr index ce942677bed6..5fc194bc3db6 100644 --- a/src/test/ui/mut/mut-cant-alias.stderr +++ b/src/test/ui/mut/mut-cant-alias.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `b` as mutable more than once at a time | LL | let b1 = &mut *b; | - first mutable borrow occurs here -LL | let b2 = &mut *b; //~ ERROR cannot borrow +LL | let b2 = &mut *b; | ^ second mutable borrow occurs here LL | b1.use_mut(); LL | } diff --git a/src/test/ui/mut/mut-cross-borrowing.stderr b/src/test/ui/mut/mut-cross-borrowing.stderr index 8708a135360b..e2eea195dafb 100644 --- a/src/test/ui/mut/mut-cross-borrowing.stderr +++ b/src/test/ui/mut/mut-cross-borrowing.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/mut-cross-borrowing.rs:7:7 | -LL | f(x) //~ ERROR mismatched types +LL | f(x) | ^ | | | expected &mut isize, found struct `std::boxed::Box` diff --git a/src/test/ui/mut/mut-pattern-mismatched.stderr b/src/test/ui/mut/mut-pattern-mismatched.stderr index d50a1a8f273b..d1adc9915196 100644 --- a/src/test/ui/mut/mut-pattern-mismatched.stderr +++ b/src/test/ui/mut/mut-pattern-mismatched.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/mut-pattern-mismatched.rs:6:10 | -LL | let &_ //~ ERROR mismatched types +LL | let &_ | ^^ types differ in mutability | = note: expected type `&mut {integer}` @@ -10,7 +10,7 @@ LL | let &_ //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/mut-pattern-mismatched.rs:15:9 | -LL | let &mut _ //~ ERROR mismatched types +LL | let &mut _ | ^^^^^^ types differ in mutability | = note: expected type `&{integer}` diff --git a/src/test/ui/mut/mut-ref.stderr b/src/test/ui/mut/mut-ref.stderr index 339da7f8a020..e6d4901aafb1 100644 --- a/src/test/ui/mut/mut-ref.stderr +++ b/src/test/ui/mut/mut-ref.stderr @@ -1,7 +1,7 @@ error: the order of `mut` and `ref` is incorrect --> $DIR/mut-ref.rs:2:9 | -LL | let mut ref x = 10; //~ ERROR the order of `mut` and `ref` is incorrect +LL | let mut ref x = 10; | ^^^^^^^ help: try switching the order: `ref mut` error: aborting due to previous error diff --git a/src/test/ui/mut/mutable-class-fields-2.stderr b/src/test/ui/mut/mutable-class-fields-2.stderr index daeee1117bcc..b0dea3082dda 100644 --- a/src/test/ui/mut/mutable-class-fields-2.stderr +++ b/src/test/ui/mut/mutable-class-fields-2.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to field `self.how_hungry` of immutable binding | LL | pub fn eat(&self) { | ----- use `&mut self` here to make mutable -LL | self.how_hungry -= 5; //~ ERROR cannot assign +LL | self.how_hungry -= 5; | ^^^^^^^^^^^^^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to previous error diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr index 5ebb40e75b39..22c871dd3c04 100644 --- a/src/test/ui/namespace/namespace-mix.stderr +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -1,13 +1,13 @@ error[E0423]: expected value, found type alias `m1::S` --> $DIR/namespace-mix.rs:34:11 | -LL | check(m1::S); //~ ERROR expected value, found type alias `m1::S` +LL | check(m1::S); | ^^^^^ | = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL | check(m1::TS); //~ ERROR expected value, found type alias `m1::S` +LL | check(m1::TS); | ^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -19,13 +19,13 @@ LL | use namespace_mix::xm2::S; error[E0423]: expected value, found type alias `xm1::S` --> $DIR/namespace-mix.rs:40:11 | -LL | check(xm1::S); //~ ERROR expected value, found type alias `xm1::S` +LL | check(xm1::S); | ^^^^^^ | = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL | check(xm1::TS); //~ ERROR expected value, found type alias `xm1::S` +LL | check(xm1::TS); | ^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -37,11 +37,11 @@ LL | use namespace_mix::xm2::S; error[E0423]: expected value, found struct variant `m7::V` --> $DIR/namespace-mix.rs:100:11 | -LL | check(m7::V); //~ ERROR expected value, found struct variant `m7::V` +LL | check(m7::V); | ^^^^^ did you mean `m7::V { /* fields */ }`? help: a tuple variant with a similar name exists | -LL | check(m7::TV); //~ ERROR expected value, found struct variant `m7::V` +LL | check(m7::TV); | ^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -53,11 +53,11 @@ LL | use namespace_mix::xm8::V; error[E0423]: expected value, found struct variant `xm7::V` --> $DIR/namespace-mix.rs:106:11 | -LL | check(xm7::V); //~ ERROR expected value, found struct variant `xm7::V` +LL | check(xm7::V); | ^^^^^^ did you mean `xm7::V { /* fields */ }`? help: a tuple variant with a similar name exists | -LL | check(xm7::TV); //~ ERROR expected value, found struct variant `xm7::V` +LL | check(xm7::TV); | ^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -69,7 +69,7 @@ LL | use namespace_mix::xm8::V; error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:33:5 | -LL | check(m1::S{}); //~ ERROR c::Item +LL | check(m1::S{}); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -81,7 +81,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::S: Impossible` is not satisfied --> $DIR/namespace-mix.rs:35:5 | -LL | check(m2::S{}); //~ ERROR c::S +LL | check(m2::S{}); | ^^^^^ the trait `Impossible` is not implemented for `c::S` | note: required by `check` @@ -93,7 +93,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:36:5 | -LL | check(m2::S); //~ ERROR c::Item +LL | check(m2::S); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -105,7 +105,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:39:5 | -LL | check(xm1::S{}); //~ ERROR c::Item +LL | check(xm1::S{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -117,7 +117,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::S: Impossible` is not satisfied --> $DIR/namespace-mix.rs:41:5 | -LL | check(xm2::S{}); //~ ERROR c::S +LL | check(xm2::S{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::S` | note: required by `check` @@ -129,7 +129,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:42:5 | -LL | check(xm2::S); //~ ERROR c::Item +LL | check(xm2::S); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -141,7 +141,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:55:5 | -LL | check(m3::TS{}); //~ ERROR c::Item +LL | check(m3::TS{}); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -153,7 +153,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `fn() -> c::TS {c::TS}: Impossible` is not satisfied --> $DIR/namespace-mix.rs:56:5 | -LL | check(m3::TS); //~ ERROR c::TS +LL | check(m3::TS); | ^^^^^ the trait `Impossible` is not implemented for `fn() -> c::TS {c::TS}` | note: required by `check` @@ -165,7 +165,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::TS: Impossible` is not satisfied --> $DIR/namespace-mix.rs:57:5 | -LL | check(m4::TS{}); //~ ERROR c::TS +LL | check(m4::TS{}); | ^^^^^ the trait `Impossible` is not implemented for `c::TS` | note: required by `check` @@ -177,7 +177,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:58:5 | -LL | check(m4::TS); //~ ERROR c::Item +LL | check(m4::TS); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -189,7 +189,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:61:5 | -LL | check(xm3::TS{}); //~ ERROR c::Item +LL | check(xm3::TS{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -201,7 +201,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}: Impossible` is not satisfied --> $DIR/namespace-mix.rs:62:5 | -LL | check(xm3::TS); //~ ERROR c::TS +LL | check(xm3::TS); | ^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}` | note: required by `check` @@ -213,7 +213,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::TS: Impossible` is not satisfied --> $DIR/namespace-mix.rs:63:5 | -LL | check(xm4::TS{}); //~ ERROR c::TS +LL | check(xm4::TS{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::TS` | note: required by `check` @@ -225,7 +225,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:64:5 | -LL | check(xm4::TS); //~ ERROR c::Item +LL | check(xm4::TS); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -237,7 +237,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:77:5 | -LL | check(m5::US{}); //~ ERROR c::Item +LL | check(m5::US{}); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -249,7 +249,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:78:5 | -LL | check(m5::US); //~ ERROR c::US +LL | check(m5::US); | ^^^^^ the trait `Impossible` is not implemented for `c::US` | note: required by `check` @@ -261,7 +261,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:79:5 | -LL | check(m6::US{}); //~ ERROR c::US +LL | check(m6::US{}); | ^^^^^ the trait `Impossible` is not implemented for `c::US` | note: required by `check` @@ -273,7 +273,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:80:5 | -LL | check(m6::US); //~ ERROR c::Item +LL | check(m6::US); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -285,7 +285,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:83:5 | -LL | check(xm5::US{}); //~ ERROR c::Item +LL | check(xm5::US{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -297,7 +297,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:84:5 | -LL | check(xm5::US); //~ ERROR c::US +LL | check(xm5::US); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` | note: required by `check` @@ -309,7 +309,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:85:5 | -LL | check(xm6::US{}); //~ ERROR c::US +LL | check(xm6::US{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` | note: required by `check` @@ -321,7 +321,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:86:5 | -LL | check(xm6::US); //~ ERROR c::Item +LL | check(xm6::US); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -333,7 +333,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:99:5 | -LL | check(m7::V{}); //~ ERROR c::Item +LL | check(m7::V{}); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -345,7 +345,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:101:5 | -LL | check(m8::V{}); //~ ERROR c::E +LL | check(m8::V{}); | ^^^^^ the trait `Impossible` is not implemented for `c::E` | note: required by `check` @@ -357,7 +357,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:102:5 | -LL | check(m8::V); //~ ERROR c::Item +LL | check(m8::V); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -369,7 +369,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:105:5 | -LL | check(xm7::V{}); //~ ERROR c::Item +LL | check(xm7::V{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -381,7 +381,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:107:5 | -LL | check(xm8::V{}); //~ ERROR c::E +LL | check(xm8::V{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` | note: required by `check` @@ -393,7 +393,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:108:5 | -LL | check(xm8::V); //~ ERROR c::Item +LL | check(xm8::V); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -405,7 +405,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:121:5 | -LL | check(m9::TV{}); //~ ERROR c::Item +LL | check(m9::TV{}); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -417,7 +417,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `fn() -> c::E {c::E::TV}: Impossible` is not satisfied --> $DIR/namespace-mix.rs:122:5 | -LL | check(m9::TV); //~ ERROR c::E +LL | check(m9::TV); | ^^^^^ the trait `Impossible` is not implemented for `fn() -> c::E {c::E::TV}` | note: required by `check` @@ -429,7 +429,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:123:5 | -LL | check(mA::TV{}); //~ ERROR c::E +LL | check(mA::TV{}); | ^^^^^ the trait `Impossible` is not implemented for `c::E` | note: required by `check` @@ -441,7 +441,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:124:5 | -LL | check(mA::TV); //~ ERROR c::Item +LL | check(mA::TV); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -453,7 +453,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:127:5 | -LL | check(xm9::TV{}); //~ ERROR c::Item +LL | check(xm9::TV{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -465,7 +465,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `fn() -> namespace_mix::c::E {namespace_mix::c::E::TV}: Impossible` is not satisfied --> $DIR/namespace-mix.rs:128:5 | -LL | check(xm9::TV); //~ ERROR c::E +LL | check(xm9::TV); | ^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::E {namespace_mix::c::E::TV}` | note: required by `check` @@ -477,7 +477,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:129:5 | -LL | check(xmA::TV{}); //~ ERROR c::E +LL | check(xmA::TV{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` | note: required by `check` @@ -489,7 +489,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:130:5 | -LL | check(xmA::TV); //~ ERROR c::Item +LL | check(xmA::TV); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -501,7 +501,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:143:5 | -LL | check(mB::UV{}); //~ ERROR c::Item +LL | check(mB::UV{}); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -513,7 +513,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:144:5 | -LL | check(mB::UV); //~ ERROR c::E +LL | check(mB::UV); | ^^^^^ the trait `Impossible` is not implemented for `c::E` | note: required by `check` @@ -525,7 +525,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:145:5 | -LL | check(mC::UV{}); //~ ERROR c::E +LL | check(mC::UV{}); | ^^^^^ the trait `Impossible` is not implemented for `c::E` | note: required by `check` @@ -537,7 +537,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:146:5 | -LL | check(mC::UV); //~ ERROR c::Item +LL | check(mC::UV); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -549,7 +549,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:149:5 | -LL | check(xmB::UV{}); //~ ERROR c::Item +LL | check(xmB::UV{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -561,7 +561,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:150:5 | -LL | check(xmB::UV); //~ ERROR c::E +LL | check(xmB::UV); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` | note: required by `check` @@ -573,7 +573,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:151:5 | -LL | check(xmC::UV{}); //~ ERROR c::E +LL | check(xmC::UV{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` | note: required by `check` @@ -585,7 +585,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:152:5 | -LL | check(xmC::UV); //~ ERROR c::Item +LL | check(xmC::UV); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr index 691061f05108..f3dbcc2d7b24 100644 --- a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr +++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr @@ -1,25 +1,25 @@ error[E0425]: cannot find function `foo` in this scope --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:11:5 | -LL | foo(); //~ ERROR cannot find function `foo` in this scope +LL | foo(); | ^^^ not found in this scope error[E0425]: cannot find function `foo` in module `m` --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:12:8 | -LL | m::foo(); //~ ERROR cannot find function `foo` in module `m` +LL | m::foo(); | ^^^ not found in `m` error[E0425]: cannot find function `bar` in this scope --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:13:5 | -LL | bar(); //~ ERROR cannot find function `bar` in this scope +LL | bar(); | ^^^ not found in this scope error[E0425]: cannot find function `bar` in module `m` --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:14:8 | -LL | m::bar(); //~ ERROR cannot find function `bar` in module `m` +LL | m::bar(); | ^^^ not found in `m` error: aborting due to 4 previous errors diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr index f53f299fe4dc..98784de8e593 100644 --- a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr +++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr @@ -1,25 +1,25 @@ error[E0425]: cannot find function `foo` in this scope --> $DIR/namespaced-enum-glob-import-no-impls.rs:21:5 | -LL | foo(); //~ ERROR cannot find function `foo` in this scope +LL | foo(); | ^^^ not found in this scope error[E0425]: cannot find function `foo` in module `m` --> $DIR/namespaced-enum-glob-import-no-impls.rs:22:8 | -LL | m::foo(); //~ ERROR cannot find function `foo` in module `m` +LL | m::foo(); | ^^^ not found in `m` error[E0425]: cannot find function `bar` in this scope --> $DIR/namespaced-enum-glob-import-no-impls.rs:23:5 | -LL | bar(); //~ ERROR cannot find function `bar` in this scope +LL | bar(); | ^^^ not found in this scope error[E0425]: cannot find function `bar` in module `m` --> $DIR/namespaced-enum-glob-import-no-impls.rs:24:8 | -LL | m::bar(); //~ ERROR cannot find function `bar` in module `m` +LL | m::bar(); | ^^^ not found in `m` error: aborting due to 4 previous errors diff --git a/src/test/ui/nested-cfg-attrs.stderr b/src/test/ui/nested-cfg-attrs.stderr index e7cd39114eda..f63888b2f8ad 100644 --- a/src/test/ui/nested-cfg-attrs.stderr +++ b/src/test/ui/nested-cfg-attrs.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `f` in this scope --> $DIR/nested-cfg-attrs.rs:4:13 | -LL | fn main() { f() } //~ ERROR cannot find function `f` in this scope +LL | fn main() { f() } | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/never-assign-dead-code.stderr b/src/test/ui/never-assign-dead-code.stderr index bcc20a0d703c..6735310da8b9 100644 --- a/src/test/ui/never-assign-dead-code.stderr +++ b/src/test/ui/never-assign-dead-code.stderr @@ -1,7 +1,7 @@ warning: unreachable statement --> $DIR/never-assign-dead-code.rs:10:5 | -LL | drop(x); //~ WARN unreachable +LL | drop(x); | ^^^^^^^^ | note: lint level defined here @@ -14,13 +14,13 @@ LL | #![warn(unused)] warning: unreachable expression --> $DIR/never-assign-dead-code.rs:10:5 | -LL | drop(x); //~ WARN unreachable +LL | drop(x); | ^^^^^^^ warning: unused variable: `x` --> $DIR/never-assign-dead-code.rs:9:9 | -LL | let x: ! = panic!("aah"); //~ WARN unused +LL | let x: ! = panic!("aah"); | ^ help: consider prefixing with an underscore: `_x` | note: lint level defined here diff --git a/src/test/ui/never-assign-wrong-type.stderr b/src/test/ui/never-assign-wrong-type.stderr index bc61996db99b..da2e77d023d1 100644 --- a/src/test/ui/never-assign-wrong-type.stderr +++ b/src/test/ui/never-assign-wrong-type.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/never-assign-wrong-type.rs:7:16 | -LL | let x: ! = "hello"; //~ ERROR mismatched types +LL | let x: ! = "hello"; | ^^^^^^^ expected !, found reference | = note: expected type `!` diff --git a/src/test/ui/nll/borrowed-local-error.stderr b/src/test/ui/nll/borrowed-local-error.stderr index 318b62a0fdb1..799eec9d3422 100644 --- a/src/test/ui/nll/borrowed-local-error.stderr +++ b/src/test/ui/nll/borrowed-local-error.stderr @@ -6,7 +6,7 @@ LL | let x = gimme({ LL | let v = (22,); LL | &v | ^^ borrowed value does not live long enough -LL | //~^ ERROR `v` does not live long enough [E0597] +LL | LL | }); | - `v` dropped here while still borrowed diff --git a/src/test/ui/nll/borrowed-referent-issue-38899.stderr b/src/test/ui/nll/borrowed-referent-issue-38899.stderr index 1b58b21fff05..5c9c48f5b1d8 100644 --- a/src/test/ui/nll/borrowed-referent-issue-38899.stderr +++ b/src/test/ui/nll/borrowed-referent-issue-38899.stderr @@ -6,7 +6,7 @@ LL | let x = &mut block; LL | println!("{}", x.current); LL | let p: &'a u8 = &*block.current; | ^^^^^^^^^^^^^^^ immutable borrow occurs here -LL | //~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable +LL | LL | drop(x); | - mutable borrow later used here diff --git a/src/test/ui/nll/borrowed-temporary-error.stderr b/src/test/ui/nll/borrowed-temporary-error.stderr index 31d1dfde1ce8..c0d42312eb1a 100644 --- a/src/test/ui/nll/borrowed-temporary-error.stderr +++ b/src/test/ui/nll/borrowed-temporary-error.stderr @@ -3,7 +3,7 @@ error[E0716]: temporary value dropped while borrowed | LL | &(v,) | ^^^^ creates a temporary which is freed while still in use -LL | //~^ ERROR temporary value dropped while borrowed [E0716] +LL | LL | }); | - temporary value is freed at the end of this statement LL | println!("{:?}", x); diff --git a/src/test/ui/nll/cannot-move-block-spans.stderr b/src/test/ui/nll/cannot-move-block-spans.stderr index e37c6ff06f7e..6de67a45fb9a 100644 --- a/src/test/ui/nll/cannot-move-block-spans.stderr +++ b/src/test/ui/nll/cannot-move-block-spans.stderr @@ -1,55 +1,55 @@ error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:5:15 | -LL | let x = { *r }; //~ ERROR +LL | let x = { *r }; | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:6:22 | -LL | let y = unsafe { *r }; //~ ERROR +LL | let y = unsafe { *r }; | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:7:26 | -LL | let z = loop { break *r; }; //~ ERROR +LL | let z = loop { break *r; }; | ^^ cannot move out of borrowed content error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:11:15 | -LL | let x = { arr[0] }; //~ ERROR +LL | let x = { arr[0] }; | ^^^^^^ cannot move out of here error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:12:22 | -LL | let y = unsafe { arr[0] }; //~ ERROR +LL | let y = unsafe { arr[0] }; | ^^^^^^ cannot move out of here error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:13:26 | -LL | let z = loop { break arr[0]; }; //~ ERROR +LL | let z = loop { break arr[0]; }; | ^^^^^^ cannot move out of here error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:17:38 | -LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR +LL | let x = { let mut u = 0; u += 1; *r }; | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:18:45 | -LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR +LL | let y = unsafe { let mut u = 0; u += 1; *r }; | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:19:49 | -LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR +LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; | ^^ cannot move out of borrowed content error: aborting due to 9 previous errors diff --git a/src/test/ui/nll/closure-access-spans.stderr b/src/test/ui/nll/closure-access-spans.stderr index 3ca0aefb592e..6c4cad923b62 100644 --- a/src/test/ui/nll/closure-access-spans.stderr +++ b/src/test/ui/nll/closure-access-spans.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let r = &mut x; | ------ mutable borrow occurs here -LL | || x; //~ ERROR +LL | || x; | ^^ - second borrow occurs due to use of `x` in closure | | | immutable borrow occurs here @@ -15,7 +15,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let r = &mut x; | ------ first mutable borrow occurs here -LL | || x = 2; //~ ERROR +LL | || x = 2; | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -27,7 +27,7 @@ error[E0500]: closure requires unique access to `x` but it is already borrowed | LL | let r = &mut x; | ------ borrow occurs here -LL | || *x = 2; //~ ERROR +LL | || *x = 2; | ^^ - second borrow occurs due to use of `x` in closure | | | closure construction occurs here @@ -39,7 +39,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let r = &mut x; | ------ borrow of `x` occurs here -LL | move || x; //~ ERROR +LL | move || x; | ^ use of borrowed `x` LL | r.use_ref(); | - borrow later used here @@ -49,7 +49,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let r = &x; | -- borrow of `x` occurs here -LL | || x; //~ ERROR +LL | || x; | ^^ - move occurs due to use in closure | | | move out of `x` occurs here @@ -63,7 +63,7 @@ LL | fn closure_imm_capture_moved(mut x: String) { | ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let r = x; | - value moved here -LL | || x.len(); //~ ERROR +LL | || x.len(); | ^^ - borrow occurs due to use in closure | | | value borrowed here after move @@ -75,7 +75,7 @@ LL | fn closure_mut_capture_moved(mut x: String) { | ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let r = x; | - value moved here -LL | || x = String::new(); //~ ERROR +LL | || x = String::new(); | ^^ - borrow occurs due to use in closure | | | value borrowed here after move @@ -87,7 +87,7 @@ LL | fn closure_unique_capture_moved(x: &mut String) { | - move occurs because `x` has type `&mut std::string::String`, which does not implement the `Copy` trait LL | let r = x; | - value moved here -LL | || *x = String::new(); //~ ERROR +LL | || *x = String::new(); | ^^ - borrow occurs due to use in closure | | | value borrowed here after move @@ -99,7 +99,7 @@ LL | fn closure_move_capture_moved(x: &mut String) { | - move occurs because `x` has type `&mut std::string::String`, which does not implement the `Copy` trait LL | let r = x; | - value moved here -LL | || x; //~ ERROR +LL | || x; | ^^ - use occurs due to use in closure | | | value used here after move diff --git a/src/test/ui/nll/closure-borrow-spans.stderr b/src/test/ui/nll/closure-borrow-spans.stderr index cf88b309f74d..fcb699a7562f 100644 --- a/src/test/ui/nll/closure-borrow-spans.stderr +++ b/src/test/ui/nll/closure-borrow-spans.stderr @@ -5,7 +5,7 @@ LL | let f = || x.len(); | -- - borrow occurs due to use in closure | | | borrow of `x` occurs here -LL | let y = x; //~ ERROR +LL | let y = x; | ^ move out of `x` occurs here LL | f.use_ref(); | - borrow later used here @@ -17,7 +17,7 @@ LL | let f = || x; | -- - first borrow occurs due to use of `x` in closure | | | immutable borrow occurs here -LL | let y = &mut x; //~ ERROR +LL | let y = &mut x; | ^^^^^^ mutable borrow occurs here LL | f.use_ref(); | - immutable borrow later used here @@ -25,7 +25,7 @@ LL | f.use_ref(); error[E0597]: `x` does not live long enough --> $DIR/closure-borrow-spans.rs:21:16 | -LL | f = || x; //~ ERROR +LL | f = || x; | -- ^ borrowed value does not live long enough | | | value captured here @@ -41,7 +41,7 @@ LL | let f = || x; | -- - borrow occurs due to use in closure | | | borrow of `x` occurs here -LL | x = 1; //~ ERROR +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | f.use_ref(); | - borrow later used here @@ -53,7 +53,7 @@ LL | let f = || x = 0; | -- - borrow occurs due to use of `x` in closure | | | borrow of `x` occurs here -LL | let y = x; //~ ERROR +LL | let y = x; | ^ use of borrowed `x` LL | f.use_ref(); | - borrow later used here @@ -65,7 +65,7 @@ LL | let f = || x = 0; | -- - first borrow occurs due to use of `x` in closure | | | mutable borrow occurs here -LL | let y = &x; //~ ERROR +LL | let y = &x; | ^^ immutable borrow occurs here LL | f.use_ref(); | - mutable borrow later used here @@ -77,7 +77,7 @@ LL | let f = || x = 0; | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let y = &mut x; //~ ERROR +LL | let y = &mut x; | ^^^^^^ second mutable borrow occurs here LL | f.use_ref(); | - first borrow later used here @@ -85,7 +85,7 @@ LL | f.use_ref(); error[E0597]: `x` does not live long enough --> $DIR/closure-borrow-spans.rs:54:16 | -LL | f = || x = 0; //~ ERROR +LL | f = || x = 0; | -- ^ borrowed value does not live long enough | | | value captured here @@ -101,7 +101,7 @@ LL | let f = || x = 0; | -- - borrow occurs due to use in closure | | | borrow of `x` occurs here -LL | x = 1; //~ ERROR +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | f.use_ref(); | - borrow later used here @@ -113,7 +113,7 @@ LL | let f = || *x = 0; | -- - borrow occurs due to use in closure | | | borrow of `x` occurs here -LL | let y = x; //~ ERROR +LL | let y = x; | ^ move out of `x` occurs here LL | f.use_ref(); | - borrow later used here @@ -125,7 +125,7 @@ LL | let f = || *x = 0; | -- - first borrow occurs due to use of `x` in closure | | | closure construction occurs here -LL | let y = &x; //~ ERROR +LL | let y = &x; | ^^ second borrow occurs here LL | f.use_ref(); | - first borrow later used here @@ -137,7 +137,7 @@ LL | let f = || *x = 0; | -- - first borrow occurs due to use of `x` in closure | | | closure construction occurs here -LL | let y = &mut x; //~ ERROR +LL | let y = &mut x; | ^^^^^^ second borrow occurs here LL | f.use_ref(); | - first borrow later used here @@ -145,7 +145,7 @@ LL | f.use_ref(); error[E0597]: `x` does not live long enough --> $DIR/closure-borrow-spans.rs:88:17 | -LL | f = || *x = 0; //~ ERROR +LL | f = || *x = 0; | -- ^ borrowed value does not live long enough | | | value captured here @@ -161,7 +161,7 @@ LL | let f = || *x = 0; | -- - borrow occurs due to use in closure | | | borrow of `*x` occurs here -LL | *x = 1; //~ ERROR +LL | *x = 1; | ^^^^^^ assignment to borrowed `*x` occurs here LL | f.use_ref(); | - borrow later used here diff --git a/src/test/ui/nll/closure-captures.stderr b/src/test/ui/nll/closure-captures.stderr index cdc055f2a37a..7dc1c59cebe4 100644 --- a/src/test/ui/nll/closure-captures.stderr +++ b/src/test/ui/nll/closure-captures.stderr @@ -4,7 +4,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn one_closure(x: i32) { | - help: consider changing this to be mutable: `mut x` LL | || -LL | x = 1; //~ ERROR +LL | x = 1; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -13,7 +13,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn one_closure(x: i32) { | - help: consider changing this to be mutable: `mut x` ... -LL | x = 1; //~ ERROR +LL | x = 1; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -22,7 +22,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn two_closures(x: i32) { | - help: consider changing this to be mutable: `mut x` ... -LL | x = 1; //~ ERROR +LL | x = 1; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -31,13 +31,13 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn two_closures(x: i32) { | - help: consider changing this to be mutable: `mut x` ... -LL | x = 1; //~ ERROR +LL | x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:30:9 | -LL | || //~ ERROR +LL | || | ^^ cannot borrow as mutable LL | x = 1;} | - mutable borrow occurs due to use of `x` in closure @@ -47,14 +47,14 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | || //~ ERROR +LL | | || LL | | x = 1;} | |________________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:34:9 | -LL | || //~ ERROR +LL | || | ^^ cannot borrow as mutable LL | x = 1;}); | - mutable borrow occurs due to use of `x` in closure @@ -64,7 +64,7 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | || //~ ERROR +LL | | || LL | | x = 1;}); | |___________^ @@ -74,15 +74,15 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn two_closures_ref(x: i32) { | - help: consider changing this to be mutable: `mut x` ... -LL | x = 1;} //~ ERROR +LL | x = 1;} | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:41:9 | -LL | || //~ ERROR +LL | || | ^^ cannot borrow as mutable -LL | x = 1;} //~ ERROR +LL | x = 1;} | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` @@ -90,8 +90,8 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | || //~ ERROR -LL | | x = 1;} //~ ERROR +LL | | || +LL | | x = 1;} | |________________^ error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -100,15 +100,15 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn two_closures_ref(x: i32) { | - help: consider changing this to be mutable: `mut x` ... -LL | x = 1;}); //~ ERROR +LL | x = 1;}); | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:45:9 | -LL | || //~ ERROR +LL | || | ^^ cannot borrow as mutable -LL | x = 1;}); //~ ERROR +LL | x = 1;}); | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` @@ -116,14 +116,14 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | || //~ ERROR -LL | | x = 1;}); //~ ERROR +LL | | || +LL | | x = 1;}); | |___________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:51:9 | -LL | || //~ ERROR +LL | || | ^^ cannot borrow as mutable LL | *x = 1;}); | - mutable borrow occurs due to use of `x` in closure @@ -133,14 +133,14 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | || //~ ERROR +LL | | || LL | | *x = 1;}); | |________________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:54:9 | -LL | || //~ ERROR +LL | || | ^^ cannot borrow as mutable LL | *x = 1;}); | - mutable borrow occurs due to use of `x` in closure @@ -150,7 +150,7 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | || //~ ERROR +LL | | || LL | | *x = 1;}); | |________________^ diff --git a/src/test/ui/nll/closure-move-spans.stderr b/src/test/ui/nll/closure-move-spans.stderr index 6750c4047601..1cc4ca85b9ff 100644 --- a/src/test/ui/nll/closure-move-spans.stderr +++ b/src/test/ui/nll/closure-move-spans.stderr @@ -7,7 +7,7 @@ LL | || x; | -- - variable moved due to use in closure | | | value moved into closure here -LL | let y = x; //~ ERROR +LL | let y = x; | ^ value used here after move error[E0382]: borrow of moved value: `x` @@ -19,7 +19,7 @@ LL | || x; | -- - variable moved due to use in closure | | | value moved into closure here -LL | let y = &x; //~ ERROR +LL | let y = &x; | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -31,7 +31,7 @@ LL | || x; | -- - variable moved due to use in closure | | | value moved into closure here -LL | let y = &mut x; //~ ERROR +LL | let y = &mut x; | ^^^^^^ value borrowed here after move error: aborting due to 3 previous errors diff --git a/src/test/ui/nll/closure-requirements/escape-argument.stderr b/src/test/ui/nll/closure-requirements/escape-argument.stderr index 9b66abc40f07..d47b326f48ed 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument.stderr @@ -28,7 +28,7 @@ error[E0597]: `y` does not live long enough | LL | closure(&mut p, &y); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `y` does not live long enough [E0597] +LL | LL | } | - `y` dropped here while still borrowed LL | diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr index 8214ff1fcec1..dec4a6b811fc 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr @@ -1,7 +1,7 @@ note: External requirements --> $DIR/escape-upvar-nested.rs:21:32 | -LL | let mut closure1 = || p = &y; //~ ERROR `y` does not live long enough [E0597] +LL | let mut closure1 = || p = &y; | ^^^^^^^^^ | = note: defining type: DefId(0/1:10 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [ @@ -18,7 +18,7 @@ note: External requirements | LL | let mut closure = || { | ___________________________^ -LL | | let mut closure1 = || p = &y; //~ ERROR `y` does not live long enough [E0597] +LL | | let mut closure1 = || p = &y; LL | | closure1(); LL | | }; | |_________^ @@ -51,7 +51,7 @@ error[E0597]: `y` does not live long enough | LL | let mut closure = || { | -- value captured here -LL | let mut closure1 = || p = &y; //~ ERROR `y` does not live long enough [E0597] +LL | let mut closure1 = || p = &y; | ^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr index 55e4573e60bb..067bd08220df 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr @@ -4,7 +4,7 @@ note: No external requirements LL | / |_outlives1, _outlives2, _outlives3, x, y| { LL | | // Only works if 'x: 'y: LL | | let p = x.get(); -LL | | demand_y(x, y, p) //~ ERROR +LL | | demand_y(x, y, p) LL | | }, | |_________^ | @@ -24,7 +24,7 @@ LL | |_outlives1, _outlives2, _outlives3, x, y| { | | | has type `std::cell::Cell<&&'1 u32>` ... -LL | demand_y(x, y, p) //~ ERROR +LL | demand_y(x, y, p) | ^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` note: No external requirements diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr index 5863b9bc8409..a1a1024bccd5 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -5,7 +5,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, | _______________________________________________^ LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) -LL | | //~^ ERROR lifetime may not live long enough +LL | | LL | | }); | |_____^ | @@ -25,7 +25,7 @@ LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) -LL | | //~^ ERROR lifetime may not live long enough +LL | | LL | | }); LL | | } | |_^ diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index a9aeee8a3190..ad2a5cae62e0 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -4,7 +4,7 @@ note: No external requirements LL | foo(cell, |cell_a, cell_x| { | _______________^ LL | | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure -LL | | //~^ ERROR +LL | | LL | | }) | |_____^ | @@ -59,7 +59,7 @@ note: No external requirements LL | / fn case2() { LL | | let a = 0; LL | | let cell = Cell::new(&a); -LL | | //~^ ERROR `a` does not live long enough +LL | | ... | LL | | }) LL | | } diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index daeb3b9ab5c5..f5167c2197b3 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -3,7 +3,7 @@ note: External requirements | LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | _______________________________________________^ -LL | | //~^ ERROR borrowed data escapes outside of function +LL | | LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) @@ -24,7 +24,7 @@ note: No external requirements | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { -LL | | //~^ ERROR borrowed data escapes outside of function +LL | | LL | | ... | LL | | }); @@ -39,7 +39,7 @@ error[E0521]: borrowed data escapes outside of function LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { | ------ `cell_a` is a reference that is only valid in the function body LL | / establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { -LL | | //~^ ERROR borrowed data escapes outside of function +LL | | LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index 95e5ce0ae74c..b4e1b0d22476 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -3,7 +3,7 @@ note: External requirements | LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | _______________________________________________^ -LL | | //~^ ERROR borrowed data escapes outside of function +LL | | LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) @@ -24,7 +24,7 @@ note: No external requirements | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -LL | | //~^ ERROR borrowed data escapes outside of function +LL | | LL | | ... | LL | | }); @@ -39,7 +39,7 @@ error[E0521]: borrowed data escapes outside of function LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { | ------ `cell_a` is a reference that is only valid in the function body LL | / establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -LL | | //~^ ERROR borrowed data escapes outside of function +LL | | LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr index b6d9d8529cf5..6ab2104a51c6 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -5,7 +5,7 @@ LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| | _____________________________________________^ LL | | // Only works if 'x: 'y: LL | | demand_y(outlives1, outlives2, x.get()) -LL | | //~^ ERROR lifetime may not live long enough +LL | | LL | | }); | |_____^ | @@ -25,7 +25,7 @@ LL | / fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { LL | | // Only works if 'x: 'y: LL | | demand_y(outlives1, outlives2, x.get()) -LL | | //~^ ERROR lifetime may not live long enough +LL | | LL | | }); LL | | } | |_^ diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr index 93eb93bdc063..5cf37bedb885 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr @@ -5,7 +5,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | _______________________________________________^ LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) -LL | | //~^ ERROR +LL | | LL | | }); | |_____^ | @@ -34,7 +34,7 @@ LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) -LL | | //~^ ERROR +LL | | LL | | }); LL | | } | |_^ diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr index c7809de88b92..671a8b9a9357 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr @@ -5,7 +5,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, | _______________________________________________^ LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) -LL | | //~^ ERROR +LL | | LL | | }); | |_____^ | @@ -34,7 +34,7 @@ LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) -LL | | //~^ ERROR +LL | | LL | | }); LL | | } | |_^ diff --git a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr index 3bcd8e1e2568..c2bbd8138142 100644 --- a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr @@ -3,7 +3,7 @@ note: External requirements | LL | establish_relationships(value, |value| { | ____________________________________^ -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | LL | | // This function call requires that ... | @@ -42,7 +42,7 @@ error[E0309]: the parameter type `T` may not live long enough | LL | establish_relationships(value, |value| { | ____________________________________^ -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | LL | | // This function call requires that ... | diff --git a/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr b/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr index 2ad4577869a5..332724daaa8b 100644 --- a/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr @@ -6,7 +6,7 @@ LL | let mut out: &mut &'static [i32] = &mut (&[1] as _); LL | once(|mut z: &[i32], mut out_val: &mut &[i32]| { | ----------------------------------------- value captured here ... -LL | z = &local_arr; //~ ERROR +LL | z = &local_arr; | ^^^^^^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr index 4a035d0c9cd8..d5bfa3f9894d 100644 --- a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr +++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr @@ -23,7 +23,7 @@ note: No external requirements | LL | / fn test() { LL | | expect_sig(|a, b| b); // ought to return `a` -LL | | //~^ ERROR +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/closure-use-spans.stderr b/src/test/ui/nll/closure-use-spans.stderr index b2abfcacd0ea..20696da3b8e8 100644 --- a/src/test/ui/nll/closure-use-spans.stderr +++ b/src/test/ui/nll/closure-use-spans.stderr @@ -3,7 +3,7 @@ error[E0506]: cannot assign to `x` because it is borrowed | LL | let y = &x; | -- borrow of `x` occurs here -LL | x = 0; //~ ERROR +LL | x = 0; | ^^^^^ assignment to borrowed `x` occurs here LL | || *y; | - borrow later captured here by closure @@ -13,7 +13,7 @@ error[E0506]: cannot assign to `x` because it is borrowed | LL | let y = &mut x; | ------ borrow of `x` occurs here -LL | x = 0; //~ ERROR +LL | x = 0; | ^^^^^ assignment to borrowed `x` occurs here LL | || *y = 1; | - borrow later captured here by closure @@ -23,7 +23,7 @@ error[E0506]: cannot assign to `x` because it is borrowed | LL | let y = &x; | -- borrow of `x` occurs here -LL | x = 0; //~ ERROR +LL | x = 0; | ^^^^^ assignment to borrowed `x` occurs here LL | move || *y; | - borrow later captured here by closure diff --git a/src/test/ui/nll/closures-in-loops.stderr b/src/test/ui/nll/closures-in-loops.stderr index 6c9e1639f88d..6408293aeea2 100644 --- a/src/test/ui/nll/closures-in-loops.stderr +++ b/src/test/ui/nll/closures-in-loops.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | fn repreated_move(x: String) { | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | for i in 0..10 { -LL | || x; //~ ERROR +LL | || x; | ^^ - use occurs due to use in closure | | | value moved into closure here, in previous iteration of loop @@ -12,7 +12,7 @@ LL | || x; //~ ERROR error[E0499]: cannot borrow `x` as mutable more than once at a time --> $DIR/closures-in-loops.rs:15:16 | -LL | v.push(|| x = String::new()); //~ ERROR +LL | v.push(|| x = String::new()); | ^^ - borrows occur due to use of `x` in closure | | | mutable borrow starts here in previous iteration of loop @@ -20,7 +20,7 @@ LL | v.push(|| x = String::new()); //~ ERROR error[E0524]: two closures require unique access to `x` at the same time --> $DIR/closures-in-loops.rs:22:16 | -LL | v.push(|| *x = String::new()); //~ ERROR +LL | v.push(|| *x = String::new()); | ^^ - borrows occur due to use of `x` in closure | | | closures are constructed here in different iterations of loop diff --git a/src/test/ui/nll/constant-thread-locals-issue-47053.stderr b/src/test/ui/nll/constant-thread-locals-issue-47053.stderr index 77cffbfa72d2..ae056a978408 100644 --- a/src/test/ui/nll/constant-thread-locals-issue-47053.stderr +++ b/src/test/ui/nll/constant-thread-locals-issue-47053.stderr @@ -1,7 +1,7 @@ error[E0594]: cannot assign to immutable static item `FOO` --> $DIR/constant-thread-locals-issue-47053.rs:10:5 | -LL | FOO = 6; //~ ERROR cannot assign to immutable static item `FOO` [E0594] +LL | FOO = 6; | ^^^^^^^ cannot assign error: aborting due to previous error diff --git a/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr b/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr index db5a549106bf..bf5c571b455b 100644 --- a/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr +++ b/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr @@ -1,7 +1,7 @@ error[E0597]: `s` does not live long enough --> $DIR/do-not-ignore-lifetime-bounds-in-copy.rs:10:17 | -LL | let a = Foo(&s); //~ ERROR `s` does not live long enough [E0597] +LL | let a = Foo(&s); | ^^ borrowed value does not live long enough LL | drop(a); | - copying this value requires that `s` is borrowed for `'static` diff --git a/src/test/ui/nll/drop-no-may-dangle.stderr b/src/test/ui/nll/drop-no-may-dangle.stderr index efa825be295f..e1d2b038ec8b 100644 --- a/src/test/ui/nll/drop-no-may-dangle.stderr +++ b/src/test/ui/nll/drop-no-may-dangle.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `v[_]` because it is borrowed LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] }; | ----- borrow of `v[_]` occurs here ... -LL | v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed +LL | v[0] += 1; | ^^^^^^^^^ assignment to borrowed `v[_]` occurs here ... LL | } @@ -16,7 +16,7 @@ error[E0506]: cannot assign to `v[_]` because it is borrowed LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] }; | ----- borrow of `v[_]` occurs here ... -LL | v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed +LL | v[0] += 1; | ^^^^^^^^^ assignment to borrowed `v[_]` occurs here LL | } | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle` diff --git a/src/test/ui/nll/enum-drop-access.stderr b/src/test/ui/nll/enum-drop-access.stderr index da9c96f7bc2e..699179fd52fd 100644 --- a/src/test/ui/nll/enum-drop-access.stderr +++ b/src/test/ui/nll/enum-drop-access.stderr @@ -4,7 +4,7 @@ error[E0713]: borrow may still be in use when destructor runs LL | fn drop_enum(opt: DropOption<&mut i32>) -> Option<&mut i32> { | - let's call the lifetime of this reference `'1` LL | match opt { -LL | DropOption::Some(&mut ref mut r) => { //~ ERROR +LL | DropOption::Some(&mut ref mut r) => { | ^^^^^^^^^ LL | Some(r) | ------- returning this value requires that `*opt.0` is borrowed for `'1` @@ -18,7 +18,7 @@ error[E0713]: borrow may still be in use when destructor runs LL | fn optional_drop_enum(opt: Option>) -> Option<&mut i32> { | - let's call the lifetime of this reference `'1` LL | match opt { -LL | Some(DropOption::Some(&mut ref mut r)) => { //~ ERROR +LL | Some(DropOption::Some(&mut ref mut r)) => { | ^^^^^^^^^ LL | Some(r) | ------- returning this value requires that `*opt.0.0` is borrowed for `'1` diff --git a/src/test/ui/nll/guarantor-issue-46974.stderr b/src/test/ui/nll/guarantor-issue-46974.stderr index b2ed4c8fcab7..8486c7d48580 100644 --- a/src/test/ui/nll/guarantor-issue-46974.stderr +++ b/src/test/ui/nll/guarantor-issue-46974.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `*s` because it is borrowed LL | let t = &mut *s; // this borrow should last for the entire function | ------- borrow of `*s` occurs here LL | let x = &t.0; -LL | *s = (2,); //~ ERROR cannot assign to `*s` +LL | *s = (2,); | ^^^^^^^^^ assignment to borrowed `*s` occurs here LL | *x | -- borrow later used here @@ -15,7 +15,7 @@ error[E0621]: explicit lifetime required in the type of `s` LL | fn bar(s: &Box<(i32,)>) -> &'static i32 { | ------------ help: add explicit lifetime `'static` to the type of `s`: `&'static std::boxed::Box<(i32,)>` LL | // FIXME(#46983): error message should be better -LL | &s.0 //~ ERROR explicit lifetime required in the type of `s` [E0621] +LL | &s.0 | ^^^^ lifetime `'static` required error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/issue-21232-partial-init-and-use.stderr b/src/test/ui/nll/issue-21232-partial-init-and-use.stderr index 23da533252cb..ab85caabb316 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-use.stderr +++ b/src/test/ui/nll/issue-21232-partial-init-and-use.stderr @@ -158,7 +158,7 @@ LL | let mut c = (1, "".to_owned()); LL | match c { LL | c2 => { | -- value moved here -LL | c.0 = 2; //~ ERROR assign to part of moved value +LL | c.0 = 2; | ^^^^^^^ value partially assigned here after move error[E0382]: assign to part of moved value: `c` @@ -169,7 +169,7 @@ LL | let mut c = (1, (1, "".to_owned())); LL | match c { LL | c2 => { | -- value moved here -LL | (c.1).0 = 2; //~ ERROR assign to part of moved value +LL | (c.1).0 = 2; | ^^^^^^^^^^^ value partially assigned here after move error[E0382]: assign to part of moved value: `c.1` @@ -177,7 +177,7 @@ error[E0382]: assign to part of moved value: `c.1` | LL | c2 => { | -- value moved here -LL | ((c.1).1).0 = 3; //~ ERROR assign to part of moved value +LL | ((c.1).1).0 = 3; | ^^^^^^^^^^^^^^^ value partially assigned here after move | = note: move occurs because `c.1` has type `(i32, (i32, std::string::String))`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/issue-27868.stderr b/src/test/ui/nll/issue-27868.stderr index 4cbd74fe272d..c83cb0b300b2 100644 --- a/src/test/ui/nll/issue-27868.stderr +++ b/src/test/ui/nll/issue-27868.stderr @@ -8,7 +8,7 @@ LL | vecvec[0] += { | | LL | | vecvec = vec![]; | | ^^^^^^ assignment to borrowed `vecvec` occurs here -LL | | //~^ ERROR cannot assign to `vecvec` because it is borrowed [E0506] +LL | | LL | | 0 LL | | }; | |_____- borrow later used here diff --git a/src/test/ui/nll/issue-31567.stderr b/src/test/ui/nll/issue-31567.stderr index c76365095df3..d098ff82d34f 100644 --- a/src/test/ui/nll/issue-31567.stderr +++ b/src/test/ui/nll/issue-31567.stderr @@ -3,7 +3,7 @@ error[E0713]: borrow may still be in use when destructor runs | LL | fn get_dangling<'a>(v: VecWrapper<'a>) -> &'a u32 { | -- lifetime `'a` defined here -LL | let s_inner: &'a S = &*v.0; //~ ERROR borrow may still be in use when destructor runs [E0713] +LL | let s_inner: &'a S = &*v.0; | ----- ^^^^^ | | | type annotation requires that `*v.0` is borrowed for `'a` diff --git a/src/test/ui/nll/issue-47388.stderr b/src/test/ui/nll/issue-47388.stderr index dda324c2e989..91f758a60a57 100644 --- a/src/test/ui/nll/issue-47388.stderr +++ b/src/test/ui/nll/issue-47388.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference | LL | let fancy_ref = &(&mut fancy); | ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)` -LL | fancy_ref.num = 6; //~ ERROR E0594 +LL | fancy_ref.num = 6; | ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error diff --git a/src/test/ui/nll/issue-47470.stderr b/src/test/ui/nll/issue-47470.stderr index ff1f1e2c1f19..d23cee3fc7c4 100644 --- a/src/test/ui/nll/issue-47470.stderr +++ b/src/test/ui/nll/issue-47470.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to local variable `local` --> $DIR/issue-47470.rs:17:9 | -LL | &local //~ ERROR cannot return reference to local variable `local` +LL | &local | ^^^^^^ returns a reference to data owned by the current function error: aborting due to previous error diff --git a/src/test/ui/nll/issue-48238.stderr b/src/test/ui/nll/issue-48238.stderr index 7cb5eb736c0e..05a90eec05c3 100644 --- a/src/test/ui/nll/issue-48238.stderr +++ b/src/test/ui/nll/issue-48238.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/issue-48238.rs:11:13 | -LL | move || use_val(&orig); //~ ERROR +LL | move || use_val(&orig); | ------- ^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | | | return type of closure is &'2 u8 diff --git a/src/test/ui/nll/issue-48697.stderr b/src/test/ui/nll/issue-48697.stderr index 16b46c15b90b..73832fd57879 100644 --- a/src/test/ui/nll/issue-48697.stderr +++ b/src/test/ui/nll/issue-48697.stderr @@ -3,7 +3,7 @@ error[E0515]: cannot return value referencing local variable `z` | LL | let k = f(&z); | -- `z` is borrowed here -LL | f(x) //~ cannot return value referencing local variable +LL | f(x) | ^^^^ returns a value referencing data owned by the current function error: aborting due to previous error diff --git a/src/test/ui/nll/issue-50716.stderr b/src/test/ui/nll/issue-50716.stderr index 229bb1777cc5..7e5ffb515011 100644 --- a/src/test/ui/nll/issue-50716.stderr +++ b/src/test/ui/nll/issue-50716.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>) | -- lifetime `'a` defined here ... -LL | let _x = *s; //~ ERROR +LL | let _x = *s; | ^^ proving this value is `Sized` requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-51191.stderr b/src/test/ui/nll/issue-51191.stderr index e2348d36d33e..e80cd873d5ac 100644 --- a/src/test/ui/nll/issue-51191.stderr +++ b/src/test/ui/nll/issue-51191.stderr @@ -3,7 +3,7 @@ warning: function cannot return without recursing | LL | fn bar(self: &mut Self) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -LL | //~^ WARN function cannot return without recursing +LL | LL | (&mut self).bar(); | ----------------- recursive call site | diff --git a/src/test/ui/nll/issue-51268.stderr b/src/test/ui/nll/issue-51268.stderr index ce93d3787ef2..0be181745fde 100644 --- a/src/test/ui/nll/issue-51268.stderr +++ b/src/test/ui/nll/issue-51268.stderr @@ -6,7 +6,7 @@ LL | self.thing.bar(|| { | | | | _________| immutable borrow later used by call | | -LL | | //~^ ERROR cannot borrow `self.thing` as mutable because it is also borrowed as immutable [E0502] +LL | | LL | | &self.number; | | ---- first borrow occurs due to use of `self` in closure LL | | }); diff --git a/src/test/ui/nll/issue-52113.stderr b/src/test/ui/nll/issue-52113.stderr index ceae16185bbb..8638fe257698 100644 --- a/src/test/ui/nll/issue-52113.stderr +++ b/src/test/ui/nll/issue-52113.stderr @@ -6,7 +6,7 @@ LL | fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> i | | | lifetime `'a` defined here ... -LL | x //~ ERROR lifetime may not live long enough +LL | x | ^ returning this value requires that `'a` must outlive `'b` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-52534-2.stderr b/src/test/ui/nll/issue-52534-2.stderr index a4396ae386dc..f98deaea7183 100644 --- a/src/test/ui/nll/issue-52534-2.stderr +++ b/src/test/ui/nll/issue-52534-2.stderr @@ -3,7 +3,7 @@ error[E0597]: `x` does not live long enough | LL | y = &x | ^^^^^^ borrowed value does not live long enough -LL | //~^ ERROR does not live long enough +LL | LL | } | - `x` dropped here while still borrowed LL | diff --git a/src/test/ui/nll/issue-52534.stderr b/src/test/ui/nll/issue-52534.stderr index e83374af3b06..9ac79eda1614 100644 --- a/src/test/ui/nll/issue-52534.stderr +++ b/src/test/ui/nll/issue-52534.stderr @@ -5,7 +5,7 @@ LL | foo(|a| &x) | - ^ `x` would have to be valid for `'0`... | | | has type `&'0 u32` -LL | //~^ ERROR does not live long enough +LL | LL | } | - ...but `x` will be dropped here, when the function `bar` returns | @@ -19,7 +19,7 @@ LL | baz(|first, second| &y) | ----- ^ `y` would have to be valid for `'0`... | | | has type `&'0 u32` -LL | //~^ ERROR does not live long enough +LL | LL | } | - ...but `y` will be dropped here, when the function `foobar` returns | diff --git a/src/test/ui/nll/issue-53773.stderr b/src/test/ui/nll/issue-53773.stderr index 92a9946068cf..1933ef7a2dbc 100644 --- a/src/test/ui/nll/issue-53773.stderr +++ b/src/test/ui/nll/issue-53773.stderr @@ -3,7 +3,7 @@ error[E0713]: borrow may still be in use when destructor runs | LL | members.push(child.raw); | ^^^^^^^^^ -LL | //~^ ERROR borrow may still be in use when destructor runs [E0713] +LL | LL | } | - here, drop of `child` needs exclusive access to `*child.raw`, because the type `C<'_>` implements the `Drop` trait LL | members.len(); diff --git a/src/test/ui/nll/issue-54556-niconii.stderr b/src/test/ui/nll/issue-54556-niconii.stderr index 03a7b94d181b..2d0de26ab309 100644 --- a/src/test/ui/nll/issue-54556-niconii.stderr +++ b/src/test/ui/nll/issue-54556-niconii.stderr @@ -1,7 +1,7 @@ error[E0597]: `counter` does not live long enough --> $DIR/issue-54556-niconii.rs:22:20 | -LL | if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough +LL | if let Ok(_) = counter.lock() { } | ^^^^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/nll/issue-54556-stephaneyfx.stderr b/src/test/ui/nll/issue-54556-stephaneyfx.stderr index bf3285a73c7c..4e581a516b2d 100644 --- a/src/test/ui/nll/issue-54556-stephaneyfx.stderr +++ b/src/test/ui/nll/issue-54556-stephaneyfx.stderr @@ -1,7 +1,7 @@ error[E0597]: `stmt` does not live long enough --> $DIR/issue-54556-stephaneyfx.rs:27:22 | -LL | let rows = Rows(&stmt); //~ ERROR does not live long enough +LL | let rows = Rows(&stmt); | ^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr index ca636e761326..a74970f71182 100644 --- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr +++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr @@ -1,7 +1,7 @@ error[E0597]: `_thing1` does not live long enough --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:12 | -LL | D(&_thing1).end() //~ ERROR does not live long enough +LL | D(&_thing1).end() | ^^^^^^^ borrowed value does not live long enough LL | } | - `_thing1` dropped here while still borrowed diff --git a/src/test/ui/nll/issue-54556-wrap-it-up.stderr b/src/test/ui/nll/issue-54556-wrap-it-up.stderr index a0c19b963879..c98b3a9fafb2 100644 --- a/src/test/ui/nll/issue-54556-wrap-it-up.stderr +++ b/src/test/ui/nll/issue-54556-wrap-it-up.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let wrap = Wrap { p: &mut x }; | - borrow of `x` occurs here ... -LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/nll/issue-55394.stderr b/src/test/ui/nll/issue-55394.stderr index bcdd78248eb4..e9a70fd6b161 100644 --- a/src/test/ui/nll/issue-55394.stderr +++ b/src/test/ui/nll/issue-55394.stderr @@ -5,7 +5,7 @@ LL | fn new(bar: &mut Bar) -> Self { | - ---- return type is Foo<'2> | | | let's call the lifetime of this reference `'1` -LL | Foo { bar } //~ERROR lifetime may not live long enough +LL | Foo { bar } | ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-55401.stderr b/src/test/ui/nll/issue-55401.stderr index 952b5441f86f..622bc5a3f341 100644 --- a/src/test/ui/nll/issue-55401.stderr +++ b/src/test/ui/nll/issue-55401.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let (ref y, _z): (&'a u32, u32) = (&22, 44); -LL | *y //~ ERROR +LL | *y | ^^ returning this value requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-55850.stderr b/src/test/ui/nll/issue-55850.stderr index 2a24cba1a684..7deee1d541ae 100644 --- a/src/test/ui/nll/issue-55850.stderr +++ b/src/test/ui/nll/issue-55850.stderr @@ -1,7 +1,7 @@ error[E0597]: `s` does not live long enough --> $DIR/issue-55850.rs:28:16 | -LL | yield &s[..] //~ ERROR `s` does not live long enough [E0597] +LL | yield &s[..] | ^ borrowed value does not live long enough LL | }) | - borrowed value only lives until here diff --git a/src/test/ui/nll/issue-57989.stderr b/src/test/ui/nll/issue-57989.stderr index 4561c99096f1..db28787a0468 100644 --- a/src/test/ui/nll/issue-57989.stderr +++ b/src/test/ui/nll/issue-57989.stderr @@ -4,7 +4,7 @@ error[E0594]: cannot assign to `*x` which is behind a `&` reference LL | fn f(x: &i32) { | ---- help: consider changing this to be a mutable reference: `&mut i32` LL | let g = &x; -LL | *x = 0; //~ ERROR cannot assign to `*x` which is behind a `&` reference +LL | *x = 0; | ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0506]: cannot assign to `*x` because it is borrowed @@ -12,9 +12,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed | LL | let g = &x; | -- borrow of `*x` occurs here -LL | *x = 0; //~ ERROR cannot assign to `*x` which is behind a `&` reference +LL | *x = 0; | ^^^^^^ assignment to borrowed `*x` occurs here -LL | //~| ERROR cannot assign to `*x` because it is borrowed +LL | LL | g; | - borrow later used here diff --git a/src/test/ui/nll/issue-58299.stderr b/src/test/ui/nll/issue-58299.stderr index b87d0de51a37..0c69b70a97c7 100644 --- a/src/test/ui/nll/issue-58299.stderr +++ b/src/test/ui/nll/issue-58299.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | fn foo<'a>(x: i32) { | -- lifetime `'a` defined here ... -LL | A::<'a>::X..=A::<'static>::X => (), //~ ERROR lifetime may not live long enough +LL | A::<'a>::X..=A::<'static>::X => (), | ^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -13,7 +13,7 @@ error: lifetime may not live long enough LL | fn bar<'a>(x: i32) { | -- lifetime `'a` defined here ... -LL | A::<'static>::X..=A::<'a>::X => (), //~ ERROR lifetime may not live long enough +LL | A::<'static>::X..=A::<'a>::X => (), | ^^^^^^^^^^ requires that `'a` must outlive `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/loan_ends_mid_block_vec.stderr b/src/test/ui/nll/loan_ends_mid_block_vec.stderr index 18d4e010946b..a3f1391f0014 100644 --- a/src/test/ui/nll/loan_ends_mid_block_vec.stderr +++ b/src/test/ui/nll/loan_ends_mid_block_vec.stderr @@ -66,7 +66,7 @@ LL | let slice = &mut data; ... LL | data.push('f'); | ^^^^ second mutable borrow occurs here -LL | //~^ ERROR (Ast) [E0499] +LL | LL | } | - first borrow ends here diff --git a/src/test/ui/nll/match-cfg-fake-edges.stderr b/src/test/ui/nll/match-cfg-fake-edges.stderr index a855b28a978d..72c6a6cd4202 100644 --- a/src/test/ui/nll/match-cfg-fake-edges.stderr +++ b/src/test/ui/nll/match-cfg-fake-edges.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/match-cfg-fake-edges.rs:23:13 | -LL | x; //~ ERROR use of possibly uninitialized variable: `x` +LL | x; | ^ use of possibly uninitialized `x` error[E0382]: use of moved value: `x` @@ -13,7 +13,7 @@ LL | let x = String::new(); LL | false if { drop(x); true } => 1, | - value moved here LL | true => { -LL | x; //~ ERROR use of moved value: `x` +LL | x; | ^ value used here after move error[E0503]: cannot use `y.1` because it was mutably borrowed @@ -22,7 +22,7 @@ error[E0503]: cannot use `y.1` because it was mutably borrowed LL | let r = &mut y.1; | -------- borrow of `y.1` occurs here ... -LL | (false, true) => 1, //~ ERROR cannot use `y.1` because it was mutably borrowed +LL | (false, true) => 1, | ^^^^ use of borrowed `y.1` LL | (true, _) => { LL | r; diff --git a/src/test/ui/nll/match-guards-partially-borrow.stderr b/src/test/ui/nll/match-guards-partially-borrow.stderr index baff2fda9f5d..a646b7d84bc0 100644 --- a/src/test/ui/nll/match-guards-partially-borrow.stderr +++ b/src/test/ui/nll/match-guards-partially-borrow.stderr @@ -4,7 +4,7 @@ error[E0510]: cannot assign `q` in match guard LL | match q { | - value is immutable in match guard ... -LL | q = true; //~ ERROR +LL | q = true; | ^^^^^^^^ cannot assign error[E0510]: cannot assign `r` in match guard @@ -13,7 +13,7 @@ error[E0510]: cannot assign `r` in match guard LL | match r { | - value is immutable in match guard ... -LL | r = true; //~ ERROR +LL | r = true; | ^^^^^^^^ cannot assign error[E0510]: cannot assign `t` in match guard @@ -22,7 +22,7 @@ error[E0510]: cannot assign `t` in match guard LL | match t { | - value is immutable in match guard ... -LL | t = true; //~ ERROR +LL | t = true; | ^^^^^^^^ cannot assign error[E0510]: cannot mutably borrow `x.0` in match guard @@ -31,7 +31,7 @@ error[E0510]: cannot mutably borrow `x.0` in match guard LL | match x { | - value is immutable in match guard ... -LL | Some(ref mut r) => *r = None, //~ ERROR +LL | Some(ref mut r) => *r = None, | ^^^^^^^^^ cannot mutably borrow error[E0506]: cannot assign to `t` because it is borrowed @@ -39,7 +39,7 @@ error[E0506]: cannot assign to `t` because it is borrowed | LL | s if { | - borrow of `t` occurs here -LL | t = !t; //~ ERROR +LL | t = !t; | ^^^^^^ assignment to borrowed `t` occurs here LL | false LL | } => (), // What value should `s` have in the arm? @@ -51,7 +51,7 @@ error[E0510]: cannot assign `y` in match guard LL | match *y { | -- value is immutable in match guard ... -LL | y = &true; //~ ERROR +LL | y = &true; | ^^^^^^^^^ cannot assign error[E0510]: cannot assign `z` in match guard @@ -60,7 +60,7 @@ error[E0510]: cannot assign `z` in match guard LL | match z { | - value is immutable in match guard ... -LL | z = &true; //~ ERROR +LL | z = &true; | ^^^^^^^^^ cannot assign error[E0510]: cannot assign `a` in match guard @@ -69,7 +69,7 @@ error[E0510]: cannot assign `a` in match guard LL | match a { | - value is immutable in match guard ... -LL | a = &true; //~ ERROR +LL | a = &true; | ^^^^^^^^^ cannot assign error[E0510]: cannot assign `b` in match guard @@ -78,7 +78,7 @@ error[E0510]: cannot assign `b` in match guard LL | match b { | - value is immutable in match guard ... -LL | b = &true; //~ ERROR +LL | b = &true; | ^^^^^^^^^ cannot assign error: aborting due to 9 previous errors diff --git a/src/test/ui/nll/match-on-borrowed.stderr b/src/test/ui/nll/match-on-borrowed.stderr index 2d34dd7805db..e8db0626a7ba 100644 --- a/src/test/ui/nll/match-on-borrowed.stderr +++ b/src/test/ui/nll/match-on-borrowed.stderr @@ -4,7 +4,7 @@ error[E0503]: cannot use `e` because it was mutably borrowed LL | E::V(ref mut x, _) => x, | --------- borrow of `e.0` occurs here ... -LL | E::V(_, r) => (), //~ ERROR +LL | E::V(_, r) => (), | ^^^^^^^^^^ use of borrowed `e.0` ... LL | x; @@ -16,7 +16,7 @@ error[E0503]: cannot use `*f` because it was mutably borrowed LL | E::V(ref mut x, _) => x, | --------- borrow of `f.0` occurs here ... -LL | E::V(_, r) => (), //~ ERROR +LL | E::V(_, r) => (), | ^^^^^^^^^^ use of borrowed `f.0` ... LL | x; @@ -28,7 +28,7 @@ error[E0503]: cannot use `t` because it was mutably borrowed LL | let x = &mut t; | ------ borrow of `t` occurs here LL | match t { -LL | true => (), //~ ERROR +LL | true => (), | ^^^^ use of borrowed `t` ... LL | x; @@ -37,7 +37,7 @@ LL | x; error[E0381]: use of possibly uninitialized variable: `n` --> $DIR/match-on-borrowed.rs:92:11 | -LL | match n {} //~ ERROR +LL | match n {} | ^ use of possibly uninitialized `n` error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr index 3ff778675bcf..e7755bdb89cc 100644 --- a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr +++ b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here ... -LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | // FIXME ^ Should not error in the future with implicit dtors, only manually implemented ones LL | } diff --git a/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr b/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr index 5585e69f090a..e4efd98253c0 100644 --- a/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr +++ b/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here ... -LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr index aa9544927f89..0e2be68c6d3a 100644 --- a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr +++ b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here ... -LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | // FIXME ^ This currently errors and it should not. LL | } diff --git a/src/test/ui/nll/maybe-initialized-drop.stderr b/src/test/ui/nll/maybe-initialized-drop.stderr index 331f846dfd09..10b9a6dcf5a0 100644 --- a/src/test/ui/nll/maybe-initialized-drop.stderr +++ b/src/test/ui/nll/maybe-initialized-drop.stderr @@ -3,7 +3,7 @@ error[E0506]: cannot assign to `x` because it is borrowed | LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here -LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | } | - borrow might be used here, when `wrap` is dropped and runs the `Drop` code for type `Wrap` diff --git a/src/test/ui/nll/move-errors.stderr b/src/test/ui/nll/move-errors.stderr index 86bb8e3a4b33..f329748139e5 100644 --- a/src/test/ui/nll/move-errors.stderr +++ b/src/test/ui/nll/move-errors.stderr @@ -87,7 +87,7 @@ LL | match x[0] { | | | cannot move out of here | help: consider borrowing here: `&x[0]` -LL | //~^ ERROR +LL | LL | B::U(d) => (), | - data moved here LL | B::V(s) => (), @@ -151,7 +151,7 @@ error[E0509]: cannot move out of type `F`, which implements the `Drop` trait | LL | match x { | ^ cannot move out of here -LL | //~^ ERROR +LL | LL | F(s, mut t) => (), | - ----- ...and here | | @@ -171,7 +171,7 @@ LL | match *x { | | | cannot move out of borrowed content | help: consider removing the `*`: `x` -LL | //~^ ERROR +LL | LL | Ok(s) | Err(s) => (), | - data moved here | diff --git a/src/test/ui/nll/move-subpaths-moves-root.stderr b/src/test/ui/nll/move-subpaths-moves-root.stderr index 8b52cc113ccc..bdbc25e9ee3d 100644 --- a/src/test/ui/nll/move-subpaths-moves-root.stderr +++ b/src/test/ui/nll/move-subpaths-moves-root.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | drop(x.0); | --- value moved here -LL | drop(x); //~ ERROR use of moved value +LL | drop(x); | ^ value used here after partial move | = note: move occurs because `x.0` has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/polonius-smoke-test.stderr b/src/test/ui/nll/polonius-smoke-test.stderr index c4aab0b8b1d6..fb3e9cfd2597 100644 --- a/src/test/ui/nll/polonius-smoke-test.stderr +++ b/src/test/ui/nll/polonius-smoke-test.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to local variable `x` --> $DIR/polonius-smoke-test.rs:7:5 | -LL | &x //~ ERROR +LL | &x | ^^ returns a reference to data owned by the current function error[E0503]: cannot use `x` because it was mutably borrowed @@ -9,7 +9,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let y = &mut x; | ------ borrow of `x` occurs here -LL | let z = x; //~ ERROR +LL | let z = x; | ^ use of borrowed `x` LL | let w = y; | - borrow later used here @@ -19,7 +19,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let y = &mut *x; | ------- borrow of `*x` occurs here -LL | let z = x; //~ ERROR +LL | let z = x; | ^ move out of `x` occurs here LL | y | - borrow later used here @@ -30,7 +30,7 @@ error[E0505]: cannot move out of `s` because it is borrowed LL | let r = &mut *s; | ------- borrow of `*s` occurs here LL | let tmp = foo(&r); -LL | s; //~ ERROR +LL | s; | ^ move out of `s` occurs here LL | tmp; | --- borrow later used here diff --git a/src/test/ui/nll/promoted-bounds.stderr b/src/test/ui/nll/promoted-bounds.stderr index 9798f238fc4d..de185cc0d294 100644 --- a/src/test/ui/nll/promoted-bounds.stderr +++ b/src/test/ui/nll/promoted-bounds.stderr @@ -4,7 +4,7 @@ error[E0597]: `l` does not live long enough LL | let ptr = { | --- borrow later stored here LL | let l = 3; -LL | let b = &l; //~ ERROR does not live long enough +LL | let b = &l; | ^^ borrowed value does not live long enough ... LL | }; diff --git a/src/test/ui/nll/promoted-closure-pair.stderr b/src/test/ui/nll/promoted-closure-pair.stderr index 5f4a6037668b..b04d1a9ccba7 100644 --- a/src/test/ui/nll/promoted-closure-pair.stderr +++ b/src/test/ui/nll/promoted-closure-pair.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local variable `z` --> $DIR/promoted-closure-pair.rs:9:5 | -LL | p.1(&z) //~ ERROR cannot return +LL | p.1(&z) | ^^^^--^ | | | | | `z` is borrowed here diff --git a/src/test/ui/nll/relate_tys/universe-violation.stderr b/src/test/ui/nll/relate_tys/universe-violation.stderr index 0a2e0ed7b2db..6dc78789564c 100644 --- a/src/test/ui/nll/relate_tys/universe-violation.stderr +++ b/src/test/ui/nll/relate_tys/universe-violation.stderr @@ -1,7 +1,7 @@ error: higher-ranked subtype error --> $DIR/universe-violation.rs:15:31 | -LL | let b: fn(&u32) -> &u32 = a; //~ ERROR higher-ranked subtype error +LL | let b: fn(&u32) -> &u32 = a; | ^ error: aborting due to previous error diff --git a/src/test/ui/nll/relate_tys/var-appears-twice.stderr b/src/test/ui/nll/relate_tys/var-appears-twice.stderr index da6930455760..7c078d226dc0 100644 --- a/src/test/ui/nll/relate_tys/var-appears-twice.stderr +++ b/src/test/ui/nll/relate_tys/var-appears-twice.stderr @@ -1,7 +1,7 @@ error[E0597]: `b` does not live long enough --> $DIR/var-appears-twice.rs:23:38 | -LL | let x: DoubleCell<_> = make_cell(&b); //~ ERROR +LL | let x: DoubleCell<_> = make_cell(&b); | ------------- ^^ borrowed value does not live long enough | | | type annotation requires that `b` is borrowed for `'static` diff --git a/src/test/ui/nll/return-ref-mut-issue-46557.stderr b/src/test/ui/nll/return-ref-mut-issue-46557.stderr index 7603d8b5bb5c..cc201136ff21 100644 --- a/src/test/ui/nll/return-ref-mut-issue-46557.stderr +++ b/src/test/ui/nll/return-ref-mut-issue-46557.stderr @@ -3,7 +3,7 @@ error[E0515]: cannot return value referencing temporary value | LL | let ref mut x = 1234543; | ------- temporary value created here -LL | x //~ ERROR cannot return value referencing temporary value [E0515] +LL | x | ^ returns a value referencing data owned by the current function error: aborting due to previous error diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr index fc7a4570a180..a7679aac219f 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -21,7 +21,7 @@ LL | | where LL | | T: Iterator, LL | | { LL | | with_signature(x, |mut y| Box::new(y.next())) -LL | | //~^ ERROR the associated type `::Item` may not live long enough +LL | | LL | | } | |_^ | @@ -93,7 +93,7 @@ LL | | where LL | | T: 'b + Iterator, LL | | { LL | | with_signature(x, |mut y| Box::new(y.next())) -LL | | //~^ ERROR the associated type `::Item` may not live long enough +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr index e8283d1ab5da..7ba7164b35b8 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -23,7 +23,7 @@ LL | | where LL | | T: Anything<'b>, LL | | { ... | -LL | | //~| ERROR +LL | | LL | | } | |_^ | @@ -76,7 +76,7 @@ LL | | where LL | | T: Anything<'b>, LL | | 'a: 'a, ... | -LL | | //~| ERROR +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 78a8c803dd97..63ead49adfcb 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -22,7 +22,7 @@ LL | | where LL | | T: Anything<'b>, LL | | { LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | //~^ ERROR +LL | | LL | | } | |_^ | @@ -66,7 +66,7 @@ LL | | where LL | | T: Anything<'b>, LL | | 'a: 'a, ... | -LL | | //~^ ERROR +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index d8725dc4284f..f5daae286709 100644 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -23,7 +23,7 @@ LL | | where LL | | T: Anything<'b, 'c>, LL | | { LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | //~^ ERROR associated type `>::AssocType` may not live long enough +LL | | LL | | } | |_^ | @@ -66,7 +66,7 @@ LL | | where LL | | T: Anything<'b, 'c>, LL | | 'a: 'a, ... | -LL | | //~^ ERROR associated type `>::AssocType` may not live long enough +LL | | LL | | } | |_^ | @@ -217,7 +217,7 @@ LL | | where LL | | T: Anything<'b, 'b>, LL | | { LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | //~^ ERROR lifetime may not live long enough +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr index 597b096dbe60..1aed0a545b47 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr @@ -1,7 +1,7 @@ error[E0309]: the associated type `>::Output` may not live long enough --> $DIR/projection-where-clause-env-wrong-bound.rs:17:5 | -LL | bar::() //~ ERROR may not live long enough +LL | bar::() | ^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `>::Output: 'a`... diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr index 3c2ac474778f..8175c302155a 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr @@ -1,7 +1,7 @@ error[E0309]: the parameter type `T` may not live long enough --> $DIR/projection-where-clause-none.rs:16:5 | -LL | bar::() //~ ERROR the parameter type `T` may not live long enough +LL | bar::() | ^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `T: 'a`... diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr index 24bd97f04691..41c2916dca3b 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr @@ -45,7 +45,7 @@ note: No external requirements | LL | / fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) { LL | | twice(cell, value, |a, b| invoke(a, b)); -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr index 30c1dbc9027b..6a201b8523ad 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -21,7 +21,7 @@ LL | | where LL | | T: Debug, LL | | { ... | -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr index a76a9463cc80..4ddc54717fbb 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr @@ -3,7 +3,7 @@ note: External requirements | LL | with_signature(a, b, |x, y| { | __________________________^ -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | // LL | | // See `correct_region`, which explains the point of this ... | @@ -25,7 +25,7 @@ note: No external requirements | LL | / fn no_region<'a, T>(a: Cell<&'a ()>, b: T) { LL | | with_signature(a, b, |x, y| { -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | // ... | LL | | }) @@ -41,7 +41,7 @@ error[E0309]: the parameter type `T` may not live long enough | LL | with_signature(a, b, |x, y| { | __________________________^ -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | // LL | | // See `correct_region`, which explains the point of this ... | @@ -95,7 +95,7 @@ note: External requirements | LL | with_signature(a, b, |x, y| { | __________________________^ -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | // See `correct_region` LL | | require(&x, &y) LL | | }) @@ -133,7 +133,7 @@ error[E0309]: the parameter type `T` may not live long enough | LL | with_signature(a, b, |x, y| { | __________________________^ -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | // See `correct_region` LL | | require(&x, &y) LL | | }) diff --git a/src/test/ui/nll/ty-outlives/wf-unreachable.stderr b/src/test/ui/nll/ty-outlives/wf-unreachable.stderr index 14642a1e615d..9128fd164795 100644 --- a/src/test/ui/nll/ty-outlives/wf-unreachable.stderr +++ b/src/test/ui/nll/ty-outlives/wf-unreachable.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | fn uninit<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let x: &'static &'a (); //~ ERROR lifetime may not live long enough +LL | let x: &'static &'a (); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -13,7 +13,7 @@ error: lifetime may not live long enough LL | fn var_type<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let x: &'static &'a () = &&(); //~ ERROR lifetime may not live long enough +LL | let x: &'static &'a () = &&(); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -21,7 +21,7 @@ error: lifetime may not live long enough | LL | fn uninit_infer<'a>() { | -- lifetime `'a` defined here -LL | let x: &'static &'a _; //~ ERROR lifetime may not live long enough +LL | let x: &'static &'a _; | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -30,7 +30,7 @@ error: lifetime may not live long enough LL | fn infer<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let x: &'static &'a _ = &&(); //~ ERROR lifetime may not live long enough +LL | let x: &'static &'a _ = &&(); | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -39,7 +39,7 @@ error: lifetime may not live long enough LL | fn uninit_no_var<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let _: &'static &'a (); //~ ERROR lifetime may not live long enough +LL | let _: &'static &'a (); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -48,7 +48,7 @@ error: lifetime may not live long enough LL | fn no_var<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let _: &'static &'a () = &&(); //~ ERROR lifetime may not live long enough +LL | let _: &'static &'a () = &&(); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -57,7 +57,7 @@ error: lifetime may not live long enough LL | fn infer_no_var<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let _: &'static &'a _ = &&(); //~ ERROR lifetime may not live long enough +LL | let _: &'static &'a _ = &&(); | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -66,7 +66,7 @@ error: lifetime may not live long enough LL | fn required_substs<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let _: C<'static, 'a, _> = C((), &(), &()); //~ ERROR lifetime may not live long enough +LL | let _: C<'static, 'a, _> = C((), &(), &()); | ^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: aborting due to 8 previous errors diff --git a/src/test/ui/nll/type-alias-free-regions.stderr b/src/test/ui/nll/type-alias-free-regions.stderr index bcd141bb406b..4facc2d0da0e 100644 --- a/src/test/ui/nll/type-alias-free-regions.stderr +++ b/src/test/ui/nll/type-alias-free-regions.stderr @@ -5,7 +5,7 @@ LL | impl<'a> FromBox<'a> for C<'a> { | -- lifetime `'a` defined here LL | fn from_box(b: Box) -> Self { | - has type `std::boxed::Box>` -LL | C { f: b } //~ ERROR +LL | C { f: b } | ^^^^^^^^^^ returning this value requires that `'1` must outlive `'a` error: lifetime may not live long enough @@ -15,7 +15,7 @@ LL | impl<'a> FromTuple<'a> for C<'a> { | -- lifetime `'a` defined here LL | fn from_tuple(b: (B,)) -> Self { | - has type `(std::boxed::Box<&'1 isize>,)` -LL | C { f: Box::new(b.0) } //~ ERROR +LL | C { f: Box::new(b.0) } | ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'a` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/type-check-pointer-coercions.stderr b/src/test/ui/nll/type-check-pointer-coercions.stderr index 3b8d99421242..9aa78dfbd4ac 100644 --- a/src/test/ui/nll/type-check-pointer-coercions.stderr +++ b/src/test/ui/nll/type-check-pointer-coercions.stderr @@ -5,7 +5,7 @@ LL | fn shared_to_const<'a, 'b>(x: &&'a i32) -> *const &'b i32 { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here -LL | x //~ ERROR +LL | x | ^ returning this value requires that `'a` must outlive `'b` error: lifetime may not live long enough @@ -15,7 +15,7 @@ LL | fn unique_to_const<'a, 'b>(x: &mut &'a i32) -> *const &'b i32 { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here -LL | x //~ ERROR +LL | x | ^ returning this value requires that `'a` must outlive `'b` error: lifetime may not live long enough @@ -26,7 +26,7 @@ LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 { | | | lifetime `'a` defined here LL | // Two errors because *mut is invariant -LL | x //~ ERROR +LL | x | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` error: lifetime may not live long enough @@ -37,7 +37,7 @@ LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 { | | | lifetime `'a` defined here LL | // Two errors because *mut is invariant -LL | x //~ ERROR +LL | x | ^ returning this value requires that `'a` must outlive `'b` error: lifetime may not live long enough @@ -47,7 +47,7 @@ LL | fn mut_to_const<'a, 'b>(x: *mut &'a i32) -> *const &'b i32 { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here -LL | x //~ ERROR +LL | x | ^ returning this value requires that `'a` must outlive `'b` error: lifetime may not live long enough @@ -58,7 +58,7 @@ LL | fn array_elem<'a, 'b>(x: &'a i32) -> *const &'b i32 { | | | lifetime `'a` defined here ... -LL | y //~ ERROR +LL | y | ^ returning this value requires that `'a` must outlive `'b` error: lifetime may not live long enough @@ -69,7 +69,7 @@ LL | fn array_coerce<'a, 'b>(x: &'a i32) -> *const [&'b i32; 3] { | | | lifetime `'a` defined here ... -LL | y //~ ERROR +LL | y | ^ returning this value requires that `'a` must outlive `'b` error: lifetime may not live long enough @@ -80,7 +80,7 @@ LL | fn nested_array<'a, 'b>(x: &'a i32) -> *const [&'b i32; 2] { | | | lifetime `'a` defined here ... -LL | y //~ ERROR +LL | y | ^ returning this value requires that `'a` must outlive `'b` error: aborting due to 8 previous errors diff --git a/src/test/ui/nll/user-annotations/adt-brace-enums.stderr b/src/test/ui/nll/user-annotations/adt-brace-enums.stderr index fd1a4b96fe34..38f068746a67 100644 --- a/src/test/ui/nll/user-annotations/adt-brace-enums.stderr +++ b/src/test/ui/nll/user-annotations/adt-brace-enums.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-brace-enums.rs:27:48 | -LL | SomeEnum::SomeVariant::<&'static u32> { t: &c }; //~ ERROR +LL | SomeEnum::SomeVariant::<&'static u32> { t: &c }; | ^^ | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; -LL | SomeEnum::SomeVariant::<&'a u32> { t: &c }; //~ ERROR +LL | SomeEnum::SomeVariant::<&'a u32> { t: &c }; | ^^ | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | SomeEnum::SomeVariant::<&'a u32> { t: &c }; //~ ERROR +LL | SomeEnum::SomeVariant::<&'a u32> { t: &c }; | ^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/adt-brace-structs.stderr b/src/test/ui/nll/user-annotations/adt-brace-structs.stderr index e614e00ac00c..25a9de480b2c 100644 --- a/src/test/ui/nll/user-annotations/adt-brace-structs.stderr +++ b/src/test/ui/nll/user-annotations/adt-brace-structs.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-brace-structs.rs:25:37 | -LL | SomeStruct::<&'static u32> { t: &c }; //~ ERROR +LL | SomeStruct::<&'static u32> { t: &c }; | ^^ | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; -LL | SomeStruct::<&'a u32> { t: &c }; //~ ERROR +LL | SomeStruct::<&'a u32> { t: &c }; | ^^ | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | SomeStruct::<&'a u32> { t: &c }; //~ ERROR +LL | SomeStruct::<&'a u32> { t: &c }; | ^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr b/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr index c72e56c619f3..1afbac7c4b2e 100644 --- a/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr +++ b/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-nullary-enums.rs:34:41 | -LL | SomeEnum::SomeVariant(Cell::new(&c)), //~ ERROR +LL | SomeEnum::SomeVariant(Cell::new(&c)), | ----------^^- | | | | | borrowed value does not live long enough @@ -16,7 +16,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... -LL | SomeEnum::SomeVariant(Cell::new(&c)), //~ ERROR +LL | SomeEnum::SomeVariant(Cell::new(&c)), | ----------^^- | | | | | borrowed value does not live long enough @@ -31,7 +31,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | SomeEnum::SomeVariant(Cell::new(&c)), //~ ERROR +LL | SomeEnum::SomeVariant(Cell::new(&c)), | ----------^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr b/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr index dc5b5a0dd7fd..cd625653ace2 100644 --- a/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr +++ b/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-tuple-enums.rs:29:43 | -LL | SomeEnum::SomeVariant::<&'static u32>(&c); //~ ERROR +LL | SomeEnum::SomeVariant::<&'static u32>(&c); | ^^ | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; -LL | SomeEnum::SomeVariant::<&'a u32>(&c); //~ ERROR +LL | SomeEnum::SomeVariant::<&'a u32>(&c); | ^^ | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | SomeEnum::SomeVariant::<&'a u32>(&c); //~ ERROR +LL | SomeEnum::SomeVariant::<&'a u32>(&c); | ^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr b/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr index 38acfcb4b613..2bb58bb2590b 100644 --- a/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr +++ b/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-tuple-struct.rs:25:32 | -LL | SomeStruct::<&'static u32>(&c); //~ ERROR +LL | SomeStruct::<&'static u32>(&c); | ^^ | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; -LL | SomeStruct::<&'a u32>(&c); //~ ERROR +LL | SomeStruct::<&'a u32>(&c); | ^^ | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | SomeStruct::<&'a u32>(&c); //~ ERROR +LL | SomeStruct::<&'a u32>(&c); | ^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr b/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr index 7e795ce17a8d..0228b56d761f 100644 --- a/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr +++ b/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/cast_static_lifetime.rs:6:19 | -LL | let y: &u32 = (&x) as &'static u32; //~ ERROR `x` does not live long enough +LL | let y: &u32 = (&x) as &'static u32; | ^^^^---------------- | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/closure-substs.stderr b/src/test/ui/nll/user-annotations/closure-substs.stderr index a46ab61418ef..55bb3a6090c0 100644 --- a/src/test/ui/nll/user-annotations/closure-substs.stderr +++ b/src/test/ui/nll/user-annotations/closure-substs.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here ... -LL | return x; //~ ERROR lifetime may not live long enough +LL | return x; | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -12,7 +12,7 @@ error: lifetime may not live long enough | LL | |x: &i32| -> &'static i32 { | - let's call the lifetime of this reference `'1` -LL | return x; //~ ERROR lifetime may not live long enough +LL | return x; | ^ returning this value requires that `'1` must outlive `'static` error: lifetime may not live long enough @@ -21,7 +21,7 @@ error: lifetime may not live long enough LL | fn bar<'a>() { | -- lifetime `'a` defined here ... -LL | b(x); //~ ERROR lifetime may not live long enough +LL | b(x); | ^^^^ argument requires that `'a` must outlive `'static` error[E0521]: borrowed data escapes outside of closure @@ -29,7 +29,7 @@ error[E0521]: borrowed data escapes outside of closure | LL | |x: &i32, b: fn(&'static i32)| { | - `x` is a reference that is only valid in the closure body -LL | b(x); //~ ERROR borrowed data escapes outside of closure +LL | b(x); | ^^^^ `x` escapes the closure body here error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr index 541a7113ec74..9a28fbd11339 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here -LL | >::C //~ ERROR +LL | >::C | ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr index 57cfaa2db043..07e2e1e85cb7 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:25:9 | -LL | FUN(&x); //~ ERROR `x` does not live long enough +LL | FUN(&x); | ----^^- | | | | | borrowed value does not live long enough @@ -13,7 +13,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:26:23 | -LL | A::ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough +LL | A::ASSOCIATED_FUN(&x); | ------------------^^- | | | | | borrowed value does not live long enough @@ -25,19 +25,19 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:27:28 | -LL | B::ALSO_ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough +LL | B::ALSO_ASSOCIATED_FUN(&x); | -----------------------^^- | | | | | borrowed value does not live long enough | argument requires that `x` is borrowed for `'static` -LL | <_>::TRAIT_ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough +LL | <_>::TRAIT_ASSOCIATED_FUN(&x); LL | } | - `x` dropped here while still borrowed error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:28:31 | -LL | <_>::TRAIT_ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough +LL | <_>::TRAIT_ASSOCIATED_FUN(&x); | --------------------------^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr index 5b97c12b626b..5e66a30d7c33 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here -LL | <() as Foo<'a>>::C //~ ERROR +LL | <() as Foo<'a>>::C | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr index 10e48b5bc348..c96838f259a8 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here -LL | <() as Foo<'a>>::C //~ ERROR +LL | <() as Foo<'a>>::C | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr index 5bfa32ec6449..fcc3c40e43f7 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { | -- lifetime `'a` defined here -LL | >::C //~ ERROR +LL | >::C | ^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr index a1e60db05d08..c91370c810c8 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { | -- lifetime `'a` defined here -LL | T::C //~ ERROR +LL | T::C | ^^^^ returning this value requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr b/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr index 6e24da094e0d..ae123b8ab545 100644 --- a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr +++ b/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr @@ -1,7 +1,7 @@ error: user substs: UserSubsts { substs: [&ReStatic u32], user_self_ty: None } --> $DIR/dump-adt-brace-struct.rs:20:5 | -LL | SomeStruct::<&'static u32> { t: &22 }; //~ ERROR [&ReStatic u32] +LL | SomeStruct::<&'static u32> { t: &22 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/dump-fn-method.stderr b/src/test/ui/nll/user-annotations/dump-fn-method.stderr index 04ceb8e5f849..631bcde4ee87 100644 --- a/src/test/ui/nll/user-annotations/dump-fn-method.stderr +++ b/src/test/ui/nll/user-annotations/dump-fn-method.stderr @@ -1,25 +1,25 @@ error: user substs: UserSubsts { substs: [&ReStatic u32], user_self_ty: None } --> $DIR/dump-fn-method.rs:30:13 | -LL | let x = foo::<&'static u32>; //~ ERROR [&ReStatic u32] +LL | let x = foo::<&'static u32>; | ^^^^^^^^^^^^^^^^^^^ error: user substs: UserSubsts { substs: [^0, u32, ^1], user_self_ty: None } --> $DIR/dump-fn-method.rs:36:13 | -LL | let x = <_ as Bazoom>::method::<_>; //~ ERROR [^0, u32, ^1] +LL | let x = <_ as Bazoom>::method::<_>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: user substs: UserSubsts { substs: [u8, &ReStatic u16, u32], user_self_ty: None } --> $DIR/dump-fn-method.rs:45:13 | -LL | let x = >::method::; //~ ERROR [u8, &ReStatic u16, u32] +LL | let x = >::method::; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: user substs: UserSubsts { substs: [^0, ^1, u32], user_self_ty: None } --> $DIR/dump-fn-method.rs:53:5 | -LL | y.method::(44, 66); //~ ERROR [^0, ^1, u32] +LL | y.method::(44, 66); | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/user-annotations/fns.stderr b/src/test/ui/nll/user-annotations/fns.stderr index 65af2f68bcf8..dadce24159e8 100644 --- a/src/test/ui/nll/user-annotations/fns.stderr +++ b/src/test/ui/nll/user-annotations/fns.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/fns.rs:25:29 | -LL | some_fn::<&'static u32>(&c); //~ ERROR +LL | some_fn::<&'static u32>(&c); | ------------------------^^- | | | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; -LL | some_fn::<&'a u32>(&c); //~ ERROR +LL | some_fn::<&'a u32>(&c); | -------------------^^- | | | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | some_fn::<&'a u32>(&c); //~ ERROR +LL | some_fn::<&'a u32>(&c); | -------------------^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr b/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr index 785b39ec887a..768454698987 100644 --- a/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr +++ b/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn non_wf_associated_const<'a>(x: i32) { | -- lifetime `'a` defined here -LL | A::<'a>::IC; //~ ERROR lifetime may not live long enough +LL | A::<'a>::IC; | ^^^^^^^^^^^ requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/issue-54124.stderr b/src/test/ui/nll/user-annotations/issue-54124.stderr index b1c2411e46c0..6cfccf7cb69c 100644 --- a/src/test/ui/nll/user-annotations/issue-54124.stderr +++ b/src/test/ui/nll/user-annotations/issue-54124.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn test<'a>() { | -- lifetime `'a` defined here -LL | let _:fn(&()) = |_:&'a ()| {}; //~ ERROR lifetime may not live long enough +LL | let _:fn(&()) = |_:&'a ()| {}; | ^ - let's call the lifetime of this reference `'1` | | | requires that `'1` must outlive `'a` @@ -13,7 +13,7 @@ error: lifetime may not live long enough | LL | fn test<'a>() { | -- lifetime `'a` defined here -LL | let _:fn(&()) = |_:&'a ()| {}; //~ ERROR lifetime may not live long enough +LL | let _:fn(&()) = |_:&'a ()| {}; | ^ requires that `'a` must outlive `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr index 76be637220a1..c99f53c5aa4c 100644 --- a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr +++ b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | fn coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let ((y, _z),) = ((s, _x),): (PairCoupledTypes<_>,); -LL | y //~ ERROR lifetime may not live long enough +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -13,7 +13,7 @@ error: lifetime may not live long enough LL | fn coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let ((y, _z),) = ((s, _x),): (PairCoupledRegions<_>,); -LL | y //~ ERROR lifetime may not live long enough +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -22,7 +22,7 @@ error: lifetime may not live long enough LL | fn cast_coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let ((y, _z),) = ((s, _x),) as (PairCoupledTypes<_>,); -LL | y //~ ERROR lifetime may not live long enough +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -31,7 +31,7 @@ error: lifetime may not live long enough LL | fn cast_coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let ((y, _z),) = ((s, _x),) as (PairCoupledRegions<_>,); -LL | y //~ ERROR lifetime may not live long enough +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/user-annotations/method-call.stderr b/src/test/ui/nll/user-annotations/method-call.stderr index 2e23e6e2a650..7e5314614f34 100644 --- a/src/test/ui/nll/user-annotations/method-call.stderr +++ b/src/test/ui/nll/user-annotations/method-call.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/method-call.rs:38:34 | -LL | a.method::<&'static u32>(b, &c); //~ ERROR +LL | a.method::<&'static u32>(b, &c); | -----------------------------^^- | | | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... -LL | a.method::<&'a u32>(b, &c); //~ ERROR +LL | a.method::<&'a u32>(b, &c); | ------------------------^^- | | | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | a.method::<&'a u32>(b, &c); //~ ERROR +LL | a.method::<&'a u32>(b, &c); | ------------------------^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/method-ufcs-1.stderr b/src/test/ui/nll/user-annotations/method-ufcs-1.stderr index 30cf01f54bd1..12b02ba33f72 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-1.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-1.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/method-ufcs-1.rs:32:7 | -LL | x(&a, b, c); //~ ERROR +LL | x(&a, b, c); | --^^------- | | | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `a` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... -LL | <&'a u32 as Bazoom<_>>::method(&a, b, c); //~ ERROR +LL | <&'a u32 as Bazoom<_>>::method(&a, b, c); | -------------------------------^^------- | | | | | borrowed value does not live long enough @@ -32,7 +32,7 @@ LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { LL | let _closure = || { | -- value captured here LL | let c = 66; -LL | <&'a u32 as Bazoom<_>>::method(&a, b, c); //~ ERROR +LL | <&'a u32 as Bazoom<_>>::method(&a, b, c); | --------------------------------^------- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/method-ufcs-2.stderr b/src/test/ui/nll/user-annotations/method-ufcs-2.stderr index 140bb750469b..a55ed1aa272a 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-2.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-2.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/method-ufcs-2.rs:32:7 | -LL | x(&a, b, c); //~ ERROR +LL | x(&a, b, c); | --^^------- | | | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `b` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... -LL | <_ as Bazoom<&'a u32>>::method(a, &b, c); //~ ERROR +LL | <_ as Bazoom<&'a u32>>::method(a, &b, c); | ----------------------------------^^---- | | | | | borrowed value does not live long enough @@ -32,7 +32,7 @@ LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { LL | let _closure = || { | -- value captured here LL | let c = 66; -LL | <_ as Bazoom<&'a u32>>::method(a, &b, c); //~ ERROR +LL | <_ as Bazoom<&'a u32>>::method(a, &b, c); | -----------------------------------^---- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/method-ufcs-3.stderr b/src/test/ui/nll/user-annotations/method-ufcs-3.stderr index 12b9685bdb87..140bda2df414 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-3.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-3.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/method-ufcs-3.rs:38:53 | -LL | <_ as Bazoom<_>>::method::<&'static u32>(&a, b, &c); //~ ERROR +LL | <_ as Bazoom<_>>::method::<&'static u32>(&a, b, &c); | ------------------------------------------------^^- | | | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... -LL | <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); //~ ERROR +LL | <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); | -------------------------------------------^^- | | | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); //~ ERROR +LL | <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); | -------------------------------------------^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr index cb6cc6479646..70e1cda004b0 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr @@ -9,7 +9,7 @@ LL | let x = A::<'a>::new(&v, 22); | | | | | borrowed value does not live long enough | argument requires that `v` is borrowed for `'a` -LL | //~^ ERROR +LL | LL | } | - `v` dropped here while still borrowed diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr index 2f83283ef912..50e4fb259918 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr @@ -9,7 +9,7 @@ LL | let x = >::new(&v, 22); | | | | | borrowed value does not live long enough | argument requires that `v` is borrowed for `'a` -LL | //~^ ERROR +LL | LL | } | - `v` dropped here while still borrowed diff --git a/src/test/ui/nll/user-annotations/normalization.stderr b/src/test/ui/nll/user-annotations/normalization.stderr index 71bf8507a735..fe93c3edba87 100644 --- a/src/test/ui/nll/user-annotations/normalization.stderr +++ b/src/test/ui/nll/user-annotations/normalization.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/normalization.rs:11:31 | -LL | let b: <() as Foo>::Out = &a; //~ ERROR +LL | let b: <() as Foo>::Out = &a; | ---------------- ^^ borrowed value does not live long enough | | | type annotation requires that `a` is borrowed for `'static` diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr index 800c822058d0..b483f219c900 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | let foo = Foo::Bar { field: &y }; | ^^ borrowed value does not live long enough -LL | //~^ ERROR `y` does not live long enough +LL | LL | let Foo::Bar::<'static> { field: _z } = foo; | --------------------------------- type annotation requires that `y` is borrowed for `'static` LL | } diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr index 8adadfb8b679..9c888b0bffe5 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | let foo = Foo { field: &y }; | ^^ borrowed value does not live long enough -LL | //~^ ERROR `y` does not live long enough +LL | LL | let Foo::<'static> { field: _z } = foo; | ---------------------------- type annotation requires that `y` is borrowed for `'static` LL | } diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr index 0fd5fc3578d5..698cff51126f 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | let foo = Foo::Bar(&y); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `y` does not live long enough +LL | LL | let Foo::Bar::<'static>(_z) = foo; | ----------------------- type annotation requires that `y` is borrowed for `'static` LL | } diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr index 3d114fa5d753..b5f2cb8e321a 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | let foo = Foo(&y); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `y` does not live long enough +LL | LL | let Foo::<'static>(_z) = foo; | ------------------ type annotation requires that `y` is borrowed for `'static` LL | } diff --git a/src/test/ui/nll/user-annotations/patterns.stderr b/src/test/ui/nll/user-annotations/patterns.stderr index 476578e074da..1ac62832315d 100644 --- a/src/test/ui/nll/user-annotations/patterns.stderr +++ b/src/test/ui/nll/user-annotations/patterns.stderr @@ -3,7 +3,7 @@ error[E0597]: `x` does not live long enough | LL | let y: &'static u32; | ------------ type annotation requires that `x` is borrowed for `'static` -LL | y = &x; //~ ERROR +LL | y = &x; | ^^ borrowed value does not live long enough LL | } | - `x` dropped here while still borrowed @@ -13,7 +13,7 @@ error[E0597]: `x` does not live long enough | LL | let (y, z): (&'static u32, &'static u32); | ---------------------------- type annotation requires that `x` is borrowed for `'static` -LL | y = &x; //~ ERROR +LL | y = &x; | ^^ borrowed value does not live long enough LL | } | - `x` dropped here while still borrowed @@ -21,7 +21,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:22:13 | -LL | let y = &x; //~ ERROR +LL | let y = &x; | ^^ borrowed value does not live long enough LL | let ref z: &'static u32 = y; | ------------ type annotation requires that `x` is borrowed for `'static` @@ -34,7 +34,7 @@ error[E0597]: `x` does not live long enough | LL | let Single { value: y }: Single<&'static u32>; | -------------------- type annotation requires that `x` is borrowed for `'static` -LL | y = &x; //~ ERROR +LL | y = &x; | ^^ borrowed value does not live long enough LL | } | - `x` dropped here while still borrowed @@ -44,7 +44,7 @@ error[E0597]: `x` does not live long enough | LL | let Single2 { value: mut _y }: Single2; | ------------------ type annotation requires that `x` is borrowed for `'static` -LL | _y = &x; //~ ERROR +LL | _y = &x; | ^^ borrowed value does not live long enough LL | } | - `x` dropped here while still borrowed @@ -52,7 +52,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:58:27 | -LL | let y: &'static u32 = &x; //~ ERROR +LL | let y: &'static u32 = &x; | ------------ ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` @@ -62,7 +62,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:63:27 | -LL | let _: &'static u32 = &x; //~ ERROR +LL | let _: &'static u32 = &x; | ------------ ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` @@ -100,7 +100,7 @@ LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44); error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:77:40 | -LL | let (_, _): (&'static u32, u32) = (&x, 44); //~ ERROR +LL | let (_, _): (&'static u32, u32) = (&x, 44); | ------------------- ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` @@ -110,7 +110,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:82:40 | -LL | let (y, _): (&'static u32, u32) = (&x, 44); //~ ERROR +LL | let (y, _): (&'static u32, u32) = (&x, 44); | ------------------- ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` @@ -120,7 +120,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:87:69 | -LL | let Single { value: y }: Single<&'static u32> = Single { value: &x }; //~ ERROR +LL | let Single { value: y }: Single<&'static u32> = Single { value: &x }; | -------------------- ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` @@ -130,7 +130,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:92:69 | -LL | let Single { value: _ }: Single<&'static u32> = Single { value: &x }; //~ ERROR +LL | let Single { value: _ }: Single<&'static u32> = Single { value: &x }; | -------------------- ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` @@ -142,7 +142,7 @@ error[E0597]: `x` does not live long enough | LL | let Double { value1: _, value2: _ }: Double<&'static u32> = Double { | -------------------- type annotation requires that `x` is borrowed for `'static` -LL | value1: &x, //~ ERROR +LL | value1: &x, | ^^ borrowed value does not live long enough ... LL | } @@ -154,7 +154,7 @@ error: lifetime may not live long enough LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here ... -LL | y //~ ERROR +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -163,7 +163,7 @@ error: lifetime may not live long enough LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here ... -LL | y //~ ERROR +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -172,7 +172,7 @@ error: lifetime may not live long enough LL | fn static_to_a_to_static_through_struct<'a>(_x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let Single { value: y }: Single<&'a u32> = Single { value: &22 }; -LL | y //~ ERROR +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -180,7 +180,7 @@ error: lifetime may not live long enough | LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here -LL | let (y, _z): (&'static u32, u32) = (x, 44); //~ ERROR +LL | let (y, _z): (&'static u32, u32) = (x, 44); | ^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: aborting due to 19 previous errors diff --git a/src/test/ui/nll/user-annotations/promoted-annotation.stderr b/src/test/ui/nll/user-annotations/promoted-annotation.stderr index 144af1e0ec12..d8b01f22145d 100644 --- a/src/test/ui/nll/user-annotations/promoted-annotation.stderr +++ b/src/test/ui/nll/user-annotations/promoted-annotation.stderr @@ -8,7 +8,7 @@ LL | let f = &drop::<&'a i32>; | ---------------- assignment requires that `x` is borrowed for `'a` LL | f(&x); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `x` does not live long enough +LL | LL | } | - `x` dropped here while still borrowed diff --git a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr index a88ff6df3d79..93dbf7cb1b31 100644 --- a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr +++ b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/type_ascription_static_lifetime.rs:7:19 | -LL | let y: &u32 = &x: &'static u32; //~ ERROR E0597 +LL | let y: &u32 = &x: &'static u32; | ^^-------------- | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/wf-self-type.stderr b/src/test/ui/nll/user-annotations/wf-self-type.stderr index 00500c8d6541..8f8e1bc28f6f 100644 --- a/src/test/ui/nll/user-annotations/wf-self-type.stderr +++ b/src/test/ui/nll/user-annotations/wf-self-type.stderr @@ -5,7 +5,7 @@ LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here -LL | Foo::xmute(u) //~ ERROR lifetime may not live long enough +LL | Foo::xmute(u) | ^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a` error: aborting due to previous error diff --git a/src/test/ui/no-implicit-prelude-nested.stderr b/src/test/ui/no-implicit-prelude-nested.stderr index 7ef4bfbaf992..521ed8f2cf3b 100644 --- a/src/test/ui/no-implicit-prelude-nested.stderr +++ b/src/test/ui/no-implicit-prelude-nested.stderr @@ -1,7 +1,7 @@ error[E0405]: cannot find trait `Add` in this scope --> $DIR/no-implicit-prelude-nested.rs:11:14 | -LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope +LL | impl Add for Test {} | ^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -11,7 +11,7 @@ LL | use std::ops::Add; error[E0405]: cannot find trait `Clone` in this scope --> $DIR/no-implicit-prelude-nested.rs:12:14 | -LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope +LL | impl Clone for Test {} | ^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -23,7 +23,7 @@ LL | use std::prelude::v1::Clone; error[E0405]: cannot find trait `Iterator` in this scope --> $DIR/no-implicit-prelude-nested.rs:13:14 | -LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope +LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -35,7 +35,7 @@ LL | use std::prelude::v1::Iterator; error[E0405]: cannot find trait `ToString` in this scope --> $DIR/no-implicit-prelude-nested.rs:14:14 | -LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope +LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -47,13 +47,13 @@ LL | use std::string::ToString; error[E0405]: cannot find trait `Writer` in this scope --> $DIR/no-implicit-prelude-nested.rs:15:14 | -LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope +LL | impl Writer for Test {} | ^^^^^^ not found in this scope error[E0425]: cannot find function `drop` in this scope --> $DIR/no-implicit-prelude-nested.rs:18:13 | -LL | drop(2) //~ ERROR cannot find function `drop` in this scope +LL | drop(2) | ^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -65,7 +65,7 @@ LL | use std::prelude::v1::drop; error[E0405]: cannot find trait `Add` in this scope --> $DIR/no-implicit-prelude-nested.rs:23:10 | -LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope +LL | impl Add for Test {} | ^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -75,7 +75,7 @@ LL | use std::ops::Add; error[E0405]: cannot find trait `Clone` in this scope --> $DIR/no-implicit-prelude-nested.rs:24:10 | -LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope +LL | impl Clone for Test {} | ^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -87,7 +87,7 @@ LL | use std::prelude::v1::Clone; error[E0405]: cannot find trait `Iterator` in this scope --> $DIR/no-implicit-prelude-nested.rs:25:10 | -LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope +LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -99,7 +99,7 @@ LL | use std::prelude::v1::Iterator; error[E0405]: cannot find trait `ToString` in this scope --> $DIR/no-implicit-prelude-nested.rs:26:10 | -LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope +LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -111,13 +111,13 @@ LL | use std::string::ToString; error[E0405]: cannot find trait `Writer` in this scope --> $DIR/no-implicit-prelude-nested.rs:27:10 | -LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope +LL | impl Writer for Test {} | ^^^^^^ not found in this scope error[E0425]: cannot find function `drop` in this scope --> $DIR/no-implicit-prelude-nested.rs:30:9 | -LL | drop(2) //~ ERROR cannot find function `drop` in this scope +LL | drop(2) | ^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -129,7 +129,7 @@ LL | use std::prelude::v1::drop; error[E0405]: cannot find trait `Add` in this scope --> $DIR/no-implicit-prelude-nested.rs:38:14 | -LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope +LL | impl Add for Test {} | ^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -139,7 +139,7 @@ LL | use std::ops::Add; error[E0405]: cannot find trait `Clone` in this scope --> $DIR/no-implicit-prelude-nested.rs:39:14 | -LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope +LL | impl Clone for Test {} | ^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -151,7 +151,7 @@ LL | use std::prelude::v1::Clone; error[E0405]: cannot find trait `Iterator` in this scope --> $DIR/no-implicit-prelude-nested.rs:40:14 | -LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope +LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -163,7 +163,7 @@ LL | use std::prelude::v1::Iterator; error[E0405]: cannot find trait `ToString` in this scope --> $DIR/no-implicit-prelude-nested.rs:41:14 | -LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope +LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -175,13 +175,13 @@ LL | use std::string::ToString; error[E0405]: cannot find trait `Writer` in this scope --> $DIR/no-implicit-prelude-nested.rs:42:14 | -LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope +LL | impl Writer for Test {} | ^^^^^^ not found in this scope error[E0425]: cannot find function `drop` in this scope --> $DIR/no-implicit-prelude-nested.rs:45:13 | -LL | drop(2) //~ ERROR cannot find function `drop` in this scope +LL | drop(2) | ^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/no-implicit-prelude.stderr b/src/test/ui/no-implicit-prelude.stderr index fa82ac6cbe72..e5c54ddd1035 100644 --- a/src/test/ui/no-implicit-prelude.stderr +++ b/src/test/ui/no-implicit-prelude.stderr @@ -1,7 +1,7 @@ error[E0405]: cannot find trait `Add` in this scope --> $DIR/no-implicit-prelude.rs:10:6 | -LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope +LL | impl Add for Test {} | ^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -11,7 +11,7 @@ LL | use std::ops::Add; error[E0405]: cannot find trait `Clone` in this scope --> $DIR/no-implicit-prelude.rs:11:6 | -LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope +LL | impl Clone for Test {} | ^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -23,7 +23,7 @@ LL | use std::prelude::v1::Clone; error[E0405]: cannot find trait `Iterator` in this scope --> $DIR/no-implicit-prelude.rs:12:6 | -LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope +LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -35,7 +35,7 @@ LL | use std::prelude::v1::Iterator; error[E0405]: cannot find trait `ToString` in this scope --> $DIR/no-implicit-prelude.rs:13:6 | -LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope +LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -47,13 +47,13 @@ LL | use std::string::ToString; error[E0405]: cannot find trait `Writer` in this scope --> $DIR/no-implicit-prelude.rs:14:6 | -LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope +LL | impl Writer for Test {} | ^^^^^^ not found in this scope error[E0425]: cannot find function `drop` in this scope --> $DIR/no-implicit-prelude.rs:17:5 | -LL | drop(2) //~ ERROR cannot find function `drop` in this scope +LL | drop(2) | ^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/no-link-unknown-crate.stderr b/src/test/ui/no-link-unknown-crate.stderr index db76b74fdad0..068c7139ed9e 100644 --- a/src/test/ui/no-link-unknown-crate.stderr +++ b/src/test/ui/no-link-unknown-crate.stderr @@ -1,7 +1,7 @@ error[E0463]: can't find crate for `doesnt_exist` --> $DIR/no-link-unknown-crate.rs:2:1 | -LL | extern crate doesnt_exist; //~ ERROR can't find crate +LL | extern crate doesnt_exist; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate error: aborting due to previous error diff --git a/src/test/ui/no-link.stderr b/src/test/ui/no-link.stderr index 928ad4232024..c9c8468eba43 100644 --- a/src/test/ui/no-link.stderr +++ b/src/test/ui/no-link.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `XEmpty1` in module `empty_struct` --> $DIR/no-link.rs:7:19 | -LL | empty_struct::XEmpty1; //~ ERROR cannot find value `XEmpty1` in module `empty_struct` +LL | empty_struct::XEmpty1; | ^^^^^^^ not found in `empty_struct` error: aborting due to previous error diff --git a/src/test/ui/no-patterns-in-args-2.stderr b/src/test/ui/no-patterns-in-args-2.stderr index 161e7bb4b005..ec7d2d9f0d11 100644 --- a/src/test/ui/no-patterns-in-args-2.stderr +++ b/src/test/ui/no-patterns-in-args-2.stderr @@ -1,13 +1,13 @@ error[E0642]: patterns aren't allowed in methods without bodies --> $DIR/no-patterns-in-args-2.rs:6:11 | -LL | fn f2(&arg: u8); //~ ERROR patterns aren't allowed in methods without bodies +LL | fn f2(&arg: u8); | ^^^^ error: patterns aren't allowed in methods without bodies --> $DIR/no-patterns-in-args-2.rs:4:11 | -LL | fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in methods without bodies +LL | fn f1(mut arg: u8); | ^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/no-patterns-in-args.stderr b/src/test/ui/no-patterns-in-args.stderr index 3fd476c4d720..0768c3f4de8b 100644 --- a/src/test/ui/no-patterns-in-args.stderr +++ b/src/test/ui/no-patterns-in-args.stderr @@ -1,31 +1,31 @@ error[E0130]: patterns aren't allowed in foreign function declarations --> $DIR/no-patterns-in-args.rs:2:11 | -LL | fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations +LL | fn f1(mut arg: u8); | ^^^^^^^ pattern not allowed in foreign function error[E0130]: patterns aren't allowed in foreign function declarations --> $DIR/no-patterns-in-args.rs:3:11 | -LL | fn f2(&arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations +LL | fn f2(&arg: u8); | ^^^^ pattern not allowed in foreign function error[E0130]: patterns aren't allowed in foreign function declarations --> $DIR/no-patterns-in-args.rs:4:11 | -LL | fn f3(arg @ _: u8); //~ ERROR patterns aren't allowed in foreign function declarations +LL | fn f3(arg @ _: u8); | ^^^^^^^ pattern not allowed in foreign function error[E0561]: patterns aren't allowed in function pointer types --> $DIR/no-patterns-in-args.rs:10:14 | -LL | type A1 = fn(mut arg: u8); //~ ERROR patterns aren't allowed in function pointer types +LL | type A1 = fn(mut arg: u8); | ^^^^^^^ error[E0561]: patterns aren't allowed in function pointer types --> $DIR/no-patterns-in-args.rs:11:14 | -LL | type A2 = fn(&arg: u8); //~ ERROR patterns aren't allowed in function pointer types +LL | type A2 = fn(&arg: u8); | ^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/no-reuse-move-arc.stderr b/src/test/ui/no-reuse-move-arc.stderr index d8ab314e7625..d71233147868 100644 --- a/src/test/ui/no-reuse-move-arc.stderr +++ b/src/test/ui/no-reuse-move-arc.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `arc_v` LL | thread::spawn(move|| { | ------ value moved (into closure) here ... -LL | assert_eq!((*arc_v)[2], 3); //~ ERROR use of moved value: `arc_v` +LL | assert_eq!((*arc_v)[2], 3); | ^^^^^ value used here after move | = note: move occurs because `arc_v` has type `std::sync::Arc>`, which does not implement the `Copy` trait @@ -15,7 +15,7 @@ error[E0382]: use of moved value: `arc_v` LL | thread::spawn(move|| { | ------ value moved (into closure) here ... -LL | println!("{:?}", *arc_v); //~ ERROR use of moved value: `arc_v` +LL | println!("{:?}", *arc_v); | ^^^^^ value used here after move | = note: move occurs because `arc_v` has type `std::sync::Arc>`, which does not implement the `Copy` trait diff --git a/src/test/ui/no-std-inject.stderr b/src/test/ui/no-std-inject.stderr index 0ccd567e7a95..975f5c2f50c5 100644 --- a/src/test/ui/no-std-inject.stderr +++ b/src/test/ui/no-std-inject.stderr @@ -1,13 +1,13 @@ error[E0259]: the name `core` is defined multiple times --> $DIR/no-std-inject.rs:4:1 | -LL | extern crate core; //~ ERROR: the name `core` is defined multiple times +LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ `core` reimported here | = note: `core` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate core as other_core; //~ ERROR: the name `core` is defined multiple times +LL | extern crate core as other_core; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/no-type-for-node-ice.stderr b/src/test/ui/no-type-for-node-ice.stderr index cd1a7ee6fe53..b50241fb1a05 100644 --- a/src/test/ui/no-type-for-node-ice.stderr +++ b/src/test/ui/no-type-for-node-ice.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `homura` on type `&'static str` --> $DIR/no-type-for-node-ice.rs:4:8 | -LL | "".homura[""]; //~ no field `homura` on type `&'static str` +LL | "".homura[""]; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/no_crate_type.stderr b/src/test/ui/no_crate_type.stderr index 6b76ab68658c..ec79420d4dd4 100644 --- a/src/test/ui/no_crate_type.stderr +++ b/src/test/ui/no_crate_type.stderr @@ -1,7 +1,7 @@ error: attribute must be of the form `#[crate_type = "bin|lib|..."]` --> $DIR/no_crate_type.rs:2:1 | -LL | #![crate_type] //~ ERROR attribute must be of the form +LL | #![crate_type] | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr b/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr index 03215f72ebcd..6de615c3de4f 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/non-exhaustive-float-range-match.rs:10:11 | -LL | match 0.0 { //~ ERROR non-exhaustive patterns +LL | match 0.0 { | ^^^ pattern `_` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr b/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr index d5beac4b7163..67c818e19cbd 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `(Some(&[]), Err(_))` not covered --> $DIR/non-exhaustive-match-nested.rs:7:11 | -LL | match (l1, l2) { //~ ERROR non-exhaustive patterns: `(Some(&[]), Err(_))` not covered +LL | match (l1, l2) { | ^^^^^^^^ pattern `(Some(&[]), Err(_))` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -15,7 +15,7 @@ LL | enum T { A(U), B } | | not covered | `T` defined here ... -LL | match x { //~ ERROR non-exhaustive patterns: `A(C)` not covered +LL | match x { | ^ pattern `A(C)` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match.stderr b/src/test/ui/non-exhaustive/non-exhaustive-match.stderr index 112e18432b44..58e3309fd267 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-match.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-match.stderr @@ -7,7 +7,7 @@ LL | enum T { A, B } | | not covered | `T` defined here ... -LL | match x { T::B => { } } //~ ERROR non-exhaustive patterns: `A` not covered +LL | match x { T::B => { } } | ^ pattern `A` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -15,7 +15,7 @@ LL | match x { T::B => { } } //~ ERROR non-exhaustive patterns: `A` not cove error[E0004]: non-exhaustive patterns: `false` not covered --> $DIR/non-exhaustive-match.rs:9:11 | -LL | match true { //~ ERROR non-exhaustive patterns: `false` not covered +LL | match true { | ^^^^ pattern `false` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -23,7 +23,7 @@ LL | match true { //~ ERROR non-exhaustive patterns: `false` not covered error[E0004]: non-exhaustive patterns: `Some(_)` not covered --> $DIR/non-exhaustive-match.rs:12:11 | -LL | match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered +LL | match Some(10) { | ^^^^^^^^ pattern `Some(_)` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -31,7 +31,7 @@ LL | match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not cover error[E0004]: non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)` and `(_, _, 5i32..=2147483647i32)` not covered --> $DIR/non-exhaustive-match.rs:15:11 | -LL | match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)` +LL | match (2, 3, 4) { | ^^^^^^^^^ patterns `(_, _, -2147483648i32..=3i32)` and `(_, _, 5i32..=2147483647i32)` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -39,7 +39,7 @@ LL | match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, -214748364 error[E0004]: non-exhaustive patterns: `(A, A)` not covered --> $DIR/non-exhaustive-match.rs:19:11 | -LL | match (T::A, T::A) { //~ ERROR non-exhaustive patterns: `(A, A)` not covered +LL | match (T::A, T::A) { | ^^^^^^^^^^^^ pattern `(A, A)` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -53,7 +53,7 @@ LL | enum T { A, B } | | not covered | `T` defined here ... -LL | match T::A { //~ ERROR non-exhaustive patterns: `B` not covered +LL | match T::A { | ^^^^ pattern `B` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -61,7 +61,7 @@ LL | match T::A { //~ ERROR non-exhaustive patterns: `B` not covered error[E0004]: non-exhaustive patterns: `[]` not covered --> $DIR/non-exhaustive-match.rs:34:11 | -LL | match *vec { //~ ERROR non-exhaustive patterns: `[]` not covered +LL | match *vec { | ^^^^ pattern `[]` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -69,7 +69,7 @@ LL | match *vec { //~ ERROR non-exhaustive patterns: `[]` not covered error[E0004]: non-exhaustive patterns: `[_, _, _, _]` not covered --> $DIR/non-exhaustive-match.rs:47:11 | -LL | match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _]` not covered +LL | match *vec { | ^^^^ pattern `[_, _, _, _]` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/noncopyable-class.stderr b/src/test/ui/noncopyable-class.stderr index 1876de873627..eb47a33a7292 100644 --- a/src/test/ui/noncopyable-class.stderr +++ b/src/test/ui/noncopyable-class.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `clone` found for type `Foo` in the current scope LL | struct Foo { | ---------- method `clone` not found for this ... -LL | let _y = x.clone(); //~ ERROR no method named `clone` found +LL | let _y = x.clone(); | ^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope diff --git a/src/test/ui/nonscalar-cast.stderr b/src/test/ui/nonscalar-cast.stderr index eb482b337e64..9338688b037f 100644 --- a/src/test/ui/nonscalar-cast.stderr +++ b/src/test/ui/nonscalar-cast.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `Foo` as `isize` --> $DIR/nonscalar-cast.rs:7:20 | -LL | println!("{}", Foo { x: 1 } as isize); //~ non-primitive cast: `Foo` as `isize` [E0605] +LL | println!("{}", Foo { x: 1 } as isize); | ^^^^^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/not-clone-closure.stderr b/src/test/ui/not-clone-closure.stderr index b583db1e4ba2..b66391b83b8d 100644 --- a/src/test/ui/not-clone-closure.stderr +++ b/src/test/ui/not-clone-closure.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `S: std::clone::Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]` --> $DIR/not-clone-closure.rs:11:23 | -LL | let hello = hello.clone(); //~ ERROR the trait bound `S: std::clone::Clone` is not satisfied +LL | let hello = hello.clone(); | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]`, the trait `std::clone::Clone` is not implemented for `S` | = note: required because it appears within the type `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]` diff --git a/src/test/ui/not-copy-closure.stderr b/src/test/ui/not-copy-closure.stderr index bdae06d3a66c..41447537978b 100644 --- a/src/test/ui/not-copy-closure.stderr +++ b/src/test/ui/not-copy-closure.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `hello` | LL | let b = hello; | - value moved here -LL | let c = hello; //~ ERROR use of moved value: `hello` [E0382] +LL | let c = hello; | ^ value used here after move | note: closure cannot be invoked more than once because it moves the variable `a` out of its environment diff --git a/src/test/ui/not-panic/not-panic-safe-5.stderr b/src/test/ui/not-panic/not-panic-safe-5.stderr index 46400a4b03c1..a603acb2f1fe 100644 --- a/src/test/ui/not-panic/not-panic-safe-5.stderr +++ b/src/test/ui/not-panic/not-panic-safe-5.stderr @@ -1,7 +1,7 @@ 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/not-panic-safe-5.rs:9:5 | -LL | assert::<*const UnsafeCell>(); //~ ERROR E0277 +LL | assert::<*const UnsafeCell>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell` diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr index a7cb32ec7b8b..0077c95139f4 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `ss` LL | fn load(ss: &mut SomeStruct) -> Box { | --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>` ... -LL | ss.r //~ ERROR explicit lifetime required in the type of `ss` [E0621] +LL | ss.r | ^^^^ lifetime `'static` required error[E0621]: explicit lifetime required in the type of `ss` @@ -13,7 +13,7 @@ error[E0621]: explicit lifetime required in the type of `ss` LL | fn store1<'b>(ss: &mut SomeStruct, b: Box) { | --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>` ... -LL | ss.r = b; //~ ERROR explicit lifetime required in the type of `ss` [E0621] +LL | ss.r = b; | ^ lifetime `'b` required error: aborting due to 2 previous errors diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr index 165f6311ffdf..d7e3a171333e 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/object-lifetime-default-from-rptr-box-error.rs:15:12 | -LL | ss.t = t; //~ ERROR mismatched types +LL | ss.t = t; | ^ lifetime mismatch | = note: expected type `&'a std::boxed::Box<(dyn Test + 'static)>` diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr index 2f042c05f25b..4d082530dc52 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:21:12 | -LL | ss.t = t; //~ ERROR mismatched types +LL | ss.t = t; | ^ lifetime mismatch | = note: expected type `&'a MyBox<(dyn Test + 'static)>` diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr index 1a21096741cb..402448cde311 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr @@ -7,13 +7,13 @@ LL | b: &'b MyBox) LL | -> &'b MyBox | -------------------- LL | { -LL | a //~ ERROR lifetime mismatch +LL | a | ^ ...but data from `a` is returned here error[E0308]: mismatched types --> $DIR/object-lifetime-default-mybox.rs:31:11 | -LL | load0(ss) //~ ERROR mismatched types +LL | load0(ss) | ^^ lifetime mismatch | = note: expected type `&MyBox<(dyn SomeTrait + 'static)>` diff --git a/src/test/ui/object-lifetime/object-lifetime-default.stderr b/src/test/ui/object-lifetime/object-lifetime-default.stderr index 443d4ff6537e..2642cdff2bf6 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default.stderr @@ -1,43 +1,43 @@ error: 'a,Ambiguous --> $DIR/object-lifetime-default.rs:24:1 | -LL | struct G<'a,'b,T:'a,U:'a+'b>(&'a T, &'b U); //~ ERROR 'a,Ambiguous +LL | struct G<'a,'b,T:'a,U:'a+'b>(&'a T, &'b U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: 'a,'b --> $DIR/object-lifetime-default.rs:21:1 | -LL | struct F<'a,'b,T:'a,U:'b>(&'a T, &'b U); //~ ERROR 'a,'b +LL | struct F<'a,'b,T:'a,U:'b>(&'a T, &'b U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: 'b --> $DIR/object-lifetime-default.rs:18:1 | -LL | struct E<'a,'b:'a,T:'b>(&'a T, &'b T); //~ ERROR 'b +LL | struct E<'a,'b:'a,T:'b>(&'a T, &'b T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Ambiguous --> $DIR/object-lifetime-default.rs:15:1 | -LL | struct D<'a,'b,T:'a+'b>(&'a T, &'b T); //~ ERROR Ambiguous +LL | struct D<'a,'b,T:'a+'b>(&'a T, &'b T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: 'a --> $DIR/object-lifetime-default.rs:12:1 | -LL | struct C<'a,T:'a>(&'a T); //~ ERROR 'a +LL | struct C<'a,T:'a>(&'a T); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: BaseDefault --> $DIR/object-lifetime-default.rs:9:1 | -LL | struct B<'a,T>(&'a (), T); //~ ERROR BaseDefault +LL | struct B<'a,T>(&'a (), T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: BaseDefault --> $DIR/object-lifetime-default.rs:6:1 | -LL | struct A(T); //~ ERROR BaseDefault +LL | struct A(T); | ^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/object-pointer-types.stderr b/src/test/ui/object-pointer-types.stderr index c5738edb6cf0..0c7e4e991a51 100644 --- a/src/test/ui/object-pointer-types.stderr +++ b/src/test/ui/object-pointer-types.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `owned` found for type `&dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:11:7 | -LL | x.owned(); //~ ERROR no method named `owned` found +LL | x.owned(); | ^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -11,7 +11,7 @@ LL | x.owned(); //~ ERROR no method named `owned` found error[E0599]: no method named `owned` found for type `&mut dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:17:7 | -LL | x.owned(); //~ ERROR no method named `owned` found +LL | x.owned(); | ^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -21,7 +21,7 @@ LL | x.owned(); //~ ERROR no method named `owned` found error[E0599]: no method named `managed` found for type `std::boxed::Box<(dyn Foo + 'static)>` in the current scope --> $DIR/object-pointer-types.rs:23:7 | -LL | x.managed(); //~ ERROR no method named `managed` found +LL | x.managed(); | ^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.stderr b/src/test/ui/object-safety/object-safety-by-value-self-use.stderr index 0711981a5215..0ab881687e91 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self-use.stderr +++ b/src/test/ui/object-safety/object-safety-by-value-self-use.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type (dyn Bar + 'static): the size of (dyn Bar + 'static) cannot be statically determined --> $DIR/object-safety-by-value-self-use.rs:15:5 | -LL | t.bar() //~ ERROR cannot move a value of type (dyn Bar + 'static) +LL | t.bar() | ^ error: aborting due to previous error diff --git a/src/test/ui/obsolete-syntax-impl-for-dotdot.stderr b/src/test/ui/obsolete-syntax-impl-for-dotdot.stderr index 793ed26ca688..b7108ced0d76 100644 --- a/src/test/ui/obsolete-syntax-impl-for-dotdot.stderr +++ b/src/test/ui/obsolete-syntax-impl-for-dotdot.stderr @@ -1,7 +1,7 @@ error: `impl Trait for .. {}` is an obsolete syntax --> $DIR/obsolete-syntax-impl-for-dotdot.rs:7:1 | -LL | impl Trait2 for .. {} //~ ERROR `impl Trait for .. {}` is an obsolete syntax +LL | impl Trait2 for .. {} | ^^^^^^^^^^^^^^^^^^^^^ | = help: use `auto trait Trait {}` instead diff --git a/src/test/ui/old-suffixes-are-really-forbidden.stderr b/src/test/ui/old-suffixes-are-really-forbidden.stderr index c54b72a3585d..9d1e8d071f06 100644 --- a/src/test/ui/old-suffixes-are-really-forbidden.stderr +++ b/src/test/ui/old-suffixes-are-really-forbidden.stderr @@ -1,7 +1,7 @@ error: invalid suffix `is` for numeric literal --> $DIR/old-suffixes-are-really-forbidden.rs:2:13 | -LL | let a = 1_is; //~ ERROR invalid suffix +LL | let a = 1_is; | ^^^^ invalid suffix `is` | = help: the suffix must be one of the integral types (`u32`, `isize`, etc) @@ -9,7 +9,7 @@ LL | let a = 1_is; //~ ERROR invalid suffix error: invalid suffix `us` for numeric literal --> $DIR/old-suffixes-are-really-forbidden.rs:3:13 | -LL | let b = 2_us; //~ ERROR invalid suffix +LL | let b = 2_us; | ^^^^ invalid suffix `us` | = help: the suffix must be one of the integral types (`u32`, `isize`, etc) diff --git a/src/test/ui/on-unimplemented/expected-comma-found-token.stderr b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr index 1e0808e1d840..5bbdbe29416c 100644 --- a/src/test/ui/on-unimplemented/expected-comma-found-token.stderr +++ b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr @@ -3,7 +3,7 @@ error: expected one of `)` or `,`, found `label` | LL | message="the message" | - expected one of `)` or `,` here -LL | label="the label" //~ ERROR expected one of `)` or `,`, found `label` +LL | label="the label" | ^^^^^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/on-unimplemented/on-trait.stderr b/src/test/ui/on-unimplemented/on-trait.stderr index 939c2725cc47..ece8dee0afe9 100644 --- a/src/test/ui/on-unimplemented/on-trait.stderr +++ b/src/test/ui/on-unimplemented/on-trait.stderr @@ -14,7 +14,7 @@ LL | fn collect, B: MyFromIterator>(it: I) -> B { error[E0277]: the trait bound `std::string::String: Bar::Foo` is not satisfied --> $DIR/on-trait.rs:31:21 | -LL | let x: String = foobar(); //~ ERROR +LL | let x: String = foobar(); | ^^^^^^ test error `std::string::String` with `u8` `_` `u32` in `Bar::Foo` | = help: the trait `Bar::Foo` is not implemented for `std::string::String` diff --git a/src/test/ui/on-unimplemented/slice-index.stderr b/src/test/ui/on-unimplemented/slice-index.stderr index 7b45d848c97b..c1d884929a0c 100644 --- a/src/test/ui/on-unimplemented/slice-index.stderr +++ b/src/test/ui/on-unimplemented/slice-index.stderr @@ -1,7 +1,7 @@ error[E0277]: the type `[i32]` cannot be indexed by `i32` --> $DIR/slice-index.rs:11:5 | -LL | x[1i32]; //~ ERROR E0277 +LL | x[1i32]; | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[i32]>` is not implemented for `i32` @@ -10,7 +10,7 @@ LL | x[1i32]; //~ ERROR E0277 error[E0277]: the type `[i32]` cannot be indexed by `std::ops::RangeTo` --> $DIR/slice-index.rs:12:5 | -LL | x[..1i32]; //~ ERROR E0277 +LL | x[..1i32]; | ^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[i32]>` is not implemented for `std::ops::RangeTo` diff --git a/src/test/ui/once-cant-call-twice-on-heap.stderr b/src/test/ui/once-cant-call-twice-on-heap.stderr index 4559425e5be0..40034dae5bcd 100644 --- a/src/test/ui/once-cant-call-twice-on-heap.stderr +++ b/src/test/ui/once-cant-call-twice-on-heap.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `blk` | LL | blk(); | --- value moved here -LL | blk(); //~ ERROR use of moved value +LL | blk(); | ^^^ value used here after move | = note: move occurs because `blk` has type `F`, which does not implement the `Copy` trait diff --git a/src/test/ui/out-of-order-shadowing.stderr b/src/test/ui/out-of-order-shadowing.stderr index 17bda18f8f63..2a120dee482d 100644 --- a/src/test/ui/out-of-order-shadowing.stderr +++ b/src/test/ui/out-of-order-shadowing.stderr @@ -1,7 +1,7 @@ error[E0659]: `bar` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/out-of-order-shadowing.rs:5:1 | -LL | bar!(); //~ ERROR `bar` is ambiguous +LL | bar!(); | ^^^ ambiguous name | note: `bar` could refer to the macro defined here diff --git a/src/test/ui/overlap-marker-trait.stderr b/src/test/ui/overlap-marker-trait.stderr index 21ba2367901c..a59af8dcdbcf 100644 --- a/src/test/ui/overlap-marker-trait.stderr +++ b/src/test/ui/overlap-marker-trait.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied --> $DIR/overlap-marker-trait.rs:30:5 | -LL | is_marker::(); //~ ERROR +LL | is_marker::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` | note: required by `is_marker` diff --git a/src/test/ui/overloaded-calls-nontuple.stderr b/src/test/ui/overloaded-calls-nontuple.stderr index 31b5697addaf..82c12c4b6e19 100644 --- a/src/test/ui/overloaded-calls-nontuple.stderr +++ b/src/test/ui/overloaded-calls-nontuple.stderr @@ -1,7 +1,7 @@ error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit --> $DIR/overloaded-calls-nontuple.rs:26:10 | -LL | drop(s(3)) //~ ERROR cannot use call notation +LL | drop(s(3)) | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr index e36644895492..8b044f7669c7 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr @@ -1,13 +1,13 @@ error: return type should be `!` --> $DIR/panic-handler-bad-signature-1.rs:11:6 | -LL | ) -> () //~ ERROR return type should be `!` +LL | ) -> () | ^^ error: argument should be `&PanicInfo` --> $DIR/panic-handler-bad-signature-1.rs:10:11 | -LL | info: PanicInfo, //~ ERROR argument should be `&PanicInfo` +LL | info: PanicInfo, | ^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr index 737ff313d0be..5ab6934202e9 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr @@ -1,7 +1,7 @@ error: argument should be `&PanicInfo` --> $DIR/panic-handler-bad-signature-2.rs:10:11 | -LL | info: &'static PanicInfo, //~ ERROR argument should be `&PanicInfo` +LL | info: &'static PanicInfo, | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr index c0b39769a49b..0a70181fdace 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr @@ -1,7 +1,7 @@ error: function should have one argument --> $DIR/panic-handler-bad-signature-3.rs:9:1 | -LL | fn panic() -> ! { //~ ERROR function should have one argument +LL | fn panic() -> ! { | ^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr index bd25c8b02f80..3a5fc76efbbd 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr @@ -2,7 +2,7 @@ error: should have no type parameters --> $DIR/panic-handler-bad-signature-4.rs:9:1 | LL | / fn panic(pi: &PanicInfo) -> ! { -LL | | //~^ ERROR should have no type parameters +LL | | LL | | loop {} LL | | } | |_^ diff --git a/src/test/ui/panic-handler/panic-handler-duplicate.stderr b/src/test/ui/panic-handler/panic-handler-duplicate.stderr index 80deff23a87d..e9b194536437 100644 --- a/src/test/ui/panic-handler/panic-handler-duplicate.stderr +++ b/src/test/ui/panic-handler/panic-handler-duplicate.stderr @@ -1,7 +1,7 @@ error[E0152]: duplicate lang item found: `panic_impl`. --> $DIR/panic-handler-duplicate.rs:15:1 | -LL | / fn panic2(info: &PanicInfo) -> ! { //~ ERROR duplicate lang item found: `panic_impl`. +LL | / fn panic2(info: &PanicInfo) -> ! { LL | | loop {} LL | | } | |_^ diff --git a/src/test/ui/panic-handler/panic-handler-wrong-location.stderr b/src/test/ui/panic-handler/panic-handler-wrong-location.stderr index cab45d8bfad6..ae3ed5ab12b4 100644 --- a/src/test/ui/panic-handler/panic-handler-wrong-location.stderr +++ b/src/test/ui/panic-handler/panic-handler-wrong-location.stderr @@ -1,7 +1,7 @@ error[E0718]: `panic_impl` language item must be applied to a function --> $DIR/panic-handler-wrong-location.rs:6:1 | -LL | #[panic_handler] //~ ERROR `panic_impl` language item must be applied to a function +LL | #[panic_handler] | ^^^^^^^^^^^^^^^^ attribute should be applied to a function, not a static item error: `#[panic_handler]` function required, but not found diff --git a/src/test/ui/panic-runtime/needs-gate.stderr b/src/test/ui/panic-runtime/needs-gate.stderr index 75ddda79b2d0..5b8ff82d1fd8 100644 --- a/src/test/ui/panic-runtime/needs-gate.stderr +++ b/src/test/ui/panic-runtime/needs-gate.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[panic_runtime]` attribute is an experimental feature (see issue #32837) --> $DIR/needs-gate.rs:4:1 | -LL | #![panic_runtime] //~ ERROR: is an experimental feature +LL | #![panic_runtime] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(panic_runtime)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #![panic_runtime] //~ ERROR: is an experimental feature error[E0658]: the `#[needs_panic_runtime]` attribute is an experimental feature (see issue #32837) --> $DIR/needs-gate.rs:5:1 | -LL | #![needs_panic_runtime] //~ ERROR: is an experimental feature +LL | #![needs_panic_runtime] | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(needs_panic_runtime)] to the crate attributes to enable diff --git a/src/test/ui/paren-span.stderr b/src/test/ui/paren-span.stderr index 23e6ade04695..141378752d6f 100644 --- a/src/test/ui/paren-span.stderr +++ b/src/test/ui/paren-span.stderr @@ -1,7 +1,7 @@ error[E0616]: field `x` of struct `m::S` is private --> $DIR/paren-span.rs:19:12 | -LL | paren!(s.x); //~ ERROR field `x` of struct `m::S` is private +LL | paren!(s.x); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/parenthesized-deref-suggestion.stderr b/src/test/ui/parenthesized-deref-suggestion.stderr index fd9b0e8216b4..a16510055f54 100644 --- a/src/test/ui/parenthesized-deref-suggestion.stderr +++ b/src/test/ui/parenthesized-deref-suggestion.stderr @@ -1,17 +1,17 @@ error[E0609]: no field `opts` on type `*const Session` --> $DIR/parenthesized-deref-suggestion.rs:7:30 | -LL | (sess as *const Session).opts; //~ ERROR no field `opts` on type `*const Session` +LL | (sess as *const Session).opts; | ^^^^ help: `(sess as *const Session)` is a raw pointer; try dereferencing it | -LL | (*(sess as *const Session)).opts; //~ ERROR no field `opts` on type `*const Session` +LL | (*(sess as *const Session)).opts; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0609]: no field `0` on type `[u32; 1]` --> $DIR/parenthesized-deref-suggestion.rs:10:21 | -LL | (x as [u32; 1]).0; //~ ERROR no field `0` on type `[u32; 1]` +LL | (x as [u32; 1]).0; | ----------------^ | | | help: instead of using tuple indexing, use array indexing: `(x as [u32; 1])[0]` diff --git a/src/test/ui/parse-error-correct.stderr b/src/test/ui/parse-error-correct.stderr index 529a93cf3042..b0d2b2d0c0a1 100644 --- a/src/test/ui/parse-error-correct.stderr +++ b/src/test/ui/parse-error-correct.stderr @@ -1,13 +1,13 @@ error: unexpected token: `;` --> $DIR/parse-error-correct.rs:8:15 | -LL | let x = y.; //~ ERROR unexpected token +LL | let x = y.; | ^ error: unexpected token: `(` --> $DIR/parse-error-correct.rs:9:15 | -LL | let x = y.(); //~ ERROR unexpected token +LL | let x = y.(); | ^ error[E0618]: expected function, found `{integer}` @@ -15,8 +15,8 @@ error[E0618]: expected function, found `{integer}` | LL | let y = 42; | - `{integer}` defined here -LL | let x = y.; //~ ERROR unexpected token -LL | let x = y.(); //~ ERROR unexpected token +LL | let x = y.; +LL | let x = y.(); | ^--- | | | call expression requires function @@ -24,7 +24,7 @@ LL | let x = y.(); //~ ERROR unexpected token error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/parse-error-correct.rs:11:15 | -LL | let x = y.foo; //~ ERROR `{integer}` is a primitive type and therefore doesn't have fields [E061 +LL | let x = y.foo; | ^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/parser-recovery-1.stderr b/src/test/ui/parser-recovery-1.stderr index 28505a8a0565..cd02710c40b7 100644 --- a/src/test/ui/parser-recovery-1.stderr +++ b/src/test/ui/parser-recovery-1.stderr @@ -9,7 +9,7 @@ LL | fn bar() { LL | } | - ...as it matches this but it has different indentation ... -LL | } //~ ERROR this file contains an un-closed delimiter +LL | } | ^ error: unexpected token: `;` diff --git a/src/test/ui/parser-recovery-2.stderr b/src/test/ui/parser-recovery-2.stderr index 76f7af38e776..c246fa80b0a0 100644 --- a/src/test/ui/parser-recovery-2.stderr +++ b/src/test/ui/parser-recovery-2.stderr @@ -1,7 +1,7 @@ error: unexpected token: `;` --> $DIR/parser-recovery-2.rs:12:15 | -LL | let x = y.; //~ ERROR unexpected token +LL | let x = y.; | ^ error: incorrect close delimiter: `)` @@ -9,20 +9,20 @@ error: incorrect close delimiter: `)` | LL | fn bar() { | - un-closed delimiter -LL | let x = foo(); //~ ERROR cannot find function `foo` in this scope -LL | ) //~ ERROR incorrect close delimiter: `)` +LL | let x = foo(); +LL | ) | ^ incorrect close delimiter error[E0425]: cannot find function `foo` in this scope --> $DIR/parser-recovery-2.rs:7:17 | -LL | let x = foo(); //~ ERROR cannot find function `foo` in this scope +LL | let x = foo(); | ^^^ not found in this scope error[E0425]: cannot find value `y` in this scope --> $DIR/parser-recovery-2.rs:12:13 | -LL | let x = y.; //~ ERROR unexpected token +LL | let x = y.; | ^ not found in this scope error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/ascii-only-character-escape.stderr b/src/test/ui/parser/ascii-only-character-escape.stderr index d3330a405c06..7524c4eccd98 100644 --- a/src/test/ui/parser/ascii-only-character-escape.stderr +++ b/src/test/ui/parser/ascii-only-character-escape.stderr @@ -1,19 +1,19 @@ error: this form of character escape may only be used with characters in the range [/x00-/x7f] --> $DIR/ascii-only-character-escape.rs:4:16 | -LL | let x = "/x80"; //~ ERROR may only be used +LL | let x = "/x80"; | ^^ error: this form of character escape may only be used with characters in the range [/x00-/x7f] --> $DIR/ascii-only-character-escape.rs:5:16 | -LL | let y = "/xff"; //~ ERROR may only be used +LL | let y = "/xff"; | ^^ error: this form of character escape may only be used with characters in the range [/x00-/x7f] --> $DIR/ascii-only-character-escape.rs:6:16 | -LL | let z = "/xe2"; //~ ERROR may only be used +LL | let z = "/xe2"; | ^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/assoc-oddities-1.stderr b/src/test/ui/parser/assoc-oddities-1.stderr index 076bca0fc3a2..376ddf4d68b7 100644 --- a/src/test/ui/parser/assoc-oddities-1.stderr +++ b/src/test/ui/parser/assoc-oddities-1.stderr @@ -1,7 +1,7 @@ error: expected one of `.`, `;`, `?`, or `}`, found `[` --> $DIR/assoc-oddities-1.rs:10:28 | -LL | ..if c { a } else { b }[n]; //~ ERROR expected one of +LL | ..if c { a } else { b }[n]; | ^ expected one of `.`, `;`, `?`, or `}` here error: aborting due to previous error diff --git a/src/test/ui/parser/assoc-oddities-2.stderr b/src/test/ui/parser/assoc-oddities-2.stderr index 568102912521..4b3893d2c17d 100644 --- a/src/test/ui/parser/assoc-oddities-2.stderr +++ b/src/test/ui/parser/assoc-oddities-2.stderr @@ -1,7 +1,7 @@ error: expected one of `.`, `;`, `?`, or `}`, found `[` --> $DIR/assoc-oddities-2.rs:5:29 | -LL | x..if c { a } else { b }[n]; //~ ERROR expected one of +LL | x..if c { a } else { b }[n]; | ^ expected one of `.`, `;`, `?`, or `}` here error: aborting due to previous error diff --git a/src/test/ui/parser/attr-bad-meta-2.stderr b/src/test/ui/parser/attr-bad-meta-2.stderr index 36e566b5aa41..ffbfc583e8a7 100644 --- a/src/test/ui/parser/attr-bad-meta-2.stderr +++ b/src/test/ui/parser/attr-bad-meta-2.stderr @@ -1,7 +1,7 @@ error: unexpected token: `]` --> $DIR/attr-bad-meta-2.rs:1:8 | -LL | #[path =] //~ ERROR unexpected token: `]` +LL | #[path =] | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/attr-bad-meta-3.stderr b/src/test/ui/parser/attr-bad-meta-3.stderr index 863a2d2069fc..4fa420c79fcc 100644 --- a/src/test/ui/parser/attr-bad-meta-3.stderr +++ b/src/test/ui/parser/attr-bad-meta-3.stderr @@ -1,7 +1,7 @@ error: expected `]`, found `token` --> $DIR/attr-bad-meta-3.rs:1:10 | -LL | #[path() token] //~ ERROR expected `]`, found `token` +LL | #[path() token] | ^^^^^ expected `]` error: aborting due to previous error diff --git a/src/test/ui/parser/attr-bad-meta.stderr b/src/test/ui/parser/attr-bad-meta.stderr index 693da95017d2..a452df5e90cb 100644 --- a/src/test/ui/parser/attr-bad-meta.stderr +++ b/src/test/ui/parser/attr-bad-meta.stderr @@ -1,7 +1,7 @@ error: expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*` --> $DIR/attr-bad-meta.rs:1:7 | -LL | #[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*` +LL | #[path*] | ^ expected one of `(`, `::`, `=`, `[`, `]`, or `{` here error: aborting due to previous error diff --git a/src/test/ui/parser/attr-before-eof.stderr b/src/test/ui/parser/attr-before-eof.stderr index a81dc52417a4..eb5daf849811 100644 --- a/src/test/ui/parser/attr-before-eof.stderr +++ b/src/test/ui/parser/attr-before-eof.stderr @@ -1,7 +1,7 @@ error: expected item after attributes --> $DIR/attr-before-eof.rs:3:16 | -LL | #[derive(Debug)] //~ERROR expected item after attributes +LL | #[derive(Debug)] | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/attr.stderr b/src/test/ui/parser/attr.stderr index 8151bd7cdd7b..5111b40603c4 100644 --- a/src/test/ui/parser/attr.stderr +++ b/src/test/ui/parser/attr.stderr @@ -1,7 +1,7 @@ error: an inner attribute is not permitted in this context --> $DIR/attr.rs:5:3 | -LL | #![lang = "foo"] //~ ERROR an inner attribute is not permitted in this context +LL | #![lang = "foo"] | ^ | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. @@ -9,7 +9,7 @@ LL | #![lang = "foo"] //~ ERROR an inner attribute is not permitted in this cont error[E0522]: definition of an unknown language item: `foo` --> $DIR/attr.rs:5:1 | -LL | #![lang = "foo"] //~ ERROR an inner attribute is not permitted in this context +LL | #![lang = "foo"] | ^^^^^^^^^^^^^^^^ definition of unknown language item `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/attrs-after-extern-mod.stderr b/src/test/ui/parser/attrs-after-extern-mod.stderr index 067c4192ce6a..cecdab4d6319 100644 --- a/src/test/ui/parser/attrs-after-extern-mod.stderr +++ b/src/test/ui/parser/attrs-after-extern-mod.stderr @@ -1,7 +1,7 @@ error: expected item after attributes --> $DIR/attrs-after-extern-mod.rs:10:19 | -LL | #[cfg(stage37)] //~ ERROR expected item after attributes +LL | #[cfg(stage37)] | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/bad-char-literals.stderr b/src/test/ui/parser/bad-char-literals.stderr index 0335a4b83eab..eb048b08c71b 100644 --- a/src/test/ui/parser/bad-char-literals.stderr +++ b/src/test/ui/parser/bad-char-literals.stderr @@ -15,7 +15,7 @@ LL | | '; error: character constant must be escaped: /r --> $DIR/bad-char-literals.rs:16:6 | -LL | ' '; //~ ERROR: character constant must be escaped: /r +LL | ' '; | ^ error: character constant must be escaped: /t diff --git a/src/test/ui/parser/bad-lit-suffixes.stderr b/src/test/ui/parser/bad-lit-suffixes.stderr index 608c5fda2482..3d4d7b4a78b4 100644 --- a/src/test/ui/parser/bad-lit-suffixes.stderr +++ b/src/test/ui/parser/bad-lit-suffixes.stderr @@ -1,55 +1,55 @@ error: ABI spec with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:5:5 | -LL | "C"suffix //~ ERROR ABI spec with a suffix is invalid +LL | "C"suffix | ^^^^^^^^^ ABI spec with a suffix is invalid error: ABI spec with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:9:5 | -LL | "C"suffix //~ ERROR ABI spec with a suffix is invalid +LL | "C"suffix | ^^^^^^^^^ ABI spec with a suffix is invalid error: string literal with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:13:5 | -LL | ""suffix; //~ ERROR string literal with a suffix is invalid +LL | ""suffix; | ^^^^^^^^ string literal with a suffix is invalid error: byte string literal with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:14:5 | -LL | b""suffix; //~ ERROR byte string literal with a suffix is invalid +LL | b""suffix; | ^^^^^^^^^ byte string literal with a suffix is invalid error: string literal with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:15:5 | -LL | r#""#suffix; //~ ERROR string literal with a suffix is invalid +LL | r#""#suffix; | ^^^^^^^^^^^ string literal with a suffix is invalid error: byte string literal with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:16:5 | -LL | br#""#suffix; //~ ERROR byte string literal with a suffix is invalid +LL | br#""#suffix; | ^^^^^^^^^^^^ byte string literal with a suffix is invalid error: char literal with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:17:5 | -LL | 'a'suffix; //~ ERROR char literal with a suffix is invalid +LL | 'a'suffix; | ^^^^^^^^^ char literal with a suffix is invalid error: byte literal with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:18:5 | -LL | b'a'suffix; //~ ERROR byte literal with a suffix is invalid +LL | b'a'suffix; | ^^^^^^^^^^ byte literal with a suffix is invalid error: invalid width `1024` for integer literal --> $DIR/bad-lit-suffixes.rs:20:5 | -LL | 1234u1024; //~ ERROR invalid width `1024` for integer literal +LL | 1234u1024; | ^^^^^^^^^ | = help: valid widths are 8, 16, 32, 64 and 128 @@ -57,7 +57,7 @@ LL | 1234u1024; //~ ERROR invalid width `1024` for integer literal error: invalid width `1024` for integer literal --> $DIR/bad-lit-suffixes.rs:21:5 | -LL | 1234i1024; //~ ERROR invalid width `1024` for integer literal +LL | 1234i1024; | ^^^^^^^^^ | = help: valid widths are 8, 16, 32, 64 and 128 @@ -65,7 +65,7 @@ LL | 1234i1024; //~ ERROR invalid width `1024` for integer literal error: invalid width `1024` for float literal --> $DIR/bad-lit-suffixes.rs:22:5 | -LL | 1234f1024; //~ ERROR invalid width `1024` for float literal +LL | 1234f1024; | ^^^^^^^^^ | = help: valid widths are 32 and 64 @@ -73,7 +73,7 @@ LL | 1234f1024; //~ ERROR invalid width `1024` for float literal error: invalid width `1024` for float literal --> $DIR/bad-lit-suffixes.rs:23:5 | -LL | 1234.5f1024; //~ ERROR invalid width `1024` for float literal +LL | 1234.5f1024; | ^^^^^^^^^^^ | = help: valid widths are 32 and 64 @@ -81,7 +81,7 @@ LL | 1234.5f1024; //~ ERROR invalid width `1024` for float literal error: invalid suffix `suffix` for numeric literal --> $DIR/bad-lit-suffixes.rs:25:5 | -LL | 1234suffix; //~ ERROR invalid suffix `suffix` for numeric literal +LL | 1234suffix; | ^^^^^^^^^^ invalid suffix `suffix` | = help: the suffix must be one of the integral types (`u32`, `isize`, etc) @@ -89,7 +89,7 @@ LL | 1234suffix; //~ ERROR invalid suffix `suffix` for numeric literal error: invalid suffix `suffix` for numeric literal --> $DIR/bad-lit-suffixes.rs:26:5 | -LL | 0b101suffix; //~ ERROR invalid suffix `suffix` for numeric literal +LL | 0b101suffix; | ^^^^^^^^^^^ invalid suffix `suffix` | = help: the suffix must be one of the integral types (`u32`, `isize`, etc) @@ -97,7 +97,7 @@ LL | 0b101suffix; //~ ERROR invalid suffix `suffix` for numeric literal error: invalid suffix `suffix` for float literal --> $DIR/bad-lit-suffixes.rs:27:5 | -LL | 1.0suffix; //~ ERROR invalid suffix `suffix` for float literal +LL | 1.0suffix; | ^^^^^^^^^ invalid suffix `suffix` | = help: valid suffixes are `f32` and `f64` @@ -105,7 +105,7 @@ LL | 1.0suffix; //~ ERROR invalid suffix `suffix` for float literal error: invalid suffix `suffix` for float literal --> $DIR/bad-lit-suffixes.rs:28:5 | -LL | 1.0e10suffix; //~ ERROR invalid suffix `suffix` for float literal +LL | 1.0e10suffix; | ^^^^^^^^^^^^ invalid suffix `suffix` | = help: valid suffixes are `f32` and `f64` diff --git a/src/test/ui/parser/bad-match.stderr b/src/test/ui/parser/bad-match.stderr index dd3a2d2a27a0..2f29b978e9c9 100644 --- a/src/test/ui/parser/bad-match.stderr +++ b/src/test/ui/parser/bad-match.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, `=`, or `@`, found `x` --> $DIR/bad-match.rs:2:13 | -LL | let isize x = 5; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `x` +LL | let isize x = 5; | ^ expected one of `:`, `;`, `=`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/bad-value-ident-false.stderr b/src/test/ui/parser/bad-value-ident-false.stderr index 69a496f3a0c3..9ddca101567f 100644 --- a/src/test/ui/parser/bad-value-ident-false.stderr +++ b/src/test/ui/parser/bad-value-ident-false.stderr @@ -1,11 +1,11 @@ error: expected identifier, found keyword `false` --> $DIR/bad-value-ident-false.rs:1:4 | -LL | fn false() { } //~ ERROR expected identifier, found keyword `false` +LL | fn false() { } | ^^^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | fn r#false() { } //~ ERROR expected identifier, found keyword `false` +LL | fn r#false() { } | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/bad-value-ident-true.stderr b/src/test/ui/parser/bad-value-ident-true.stderr index 2606b7450aef..ec497dbe4073 100644 --- a/src/test/ui/parser/bad-value-ident-true.stderr +++ b/src/test/ui/parser/bad-value-ident-true.stderr @@ -1,11 +1,11 @@ error: expected identifier, found keyword `true` --> $DIR/bad-value-ident-true.rs:1:4 | -LL | fn true() { } //~ ERROR expected identifier, found keyword `true` +LL | fn true() { } | ^^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | fn r#true() { } //~ ERROR expected identifier, found keyword `true` +LL | fn r#true() { } | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/better-expected.stderr b/src/test/ui/parser/better-expected.stderr index 3495353c6f90..d100d01e78ff 100644 --- a/src/test/ui/parser/better-expected.stderr +++ b/src/test/ui/parser/better-expected.stderr @@ -1,7 +1,7 @@ error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `3` --> $DIR/better-expected.rs:2:19 | -LL | let x: [isize 3]; //~ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `3` +LL | let x: [isize 3]; | - ^ expected one of 7 possible tokens here | | | while parsing the type for `x` diff --git a/src/test/ui/parser/bind-struct-early-modifiers.stderr b/src/test/ui/parser/bind-struct-early-modifiers.stderr index 618e577e4e22..50c95b8cf402 100644 --- a/src/test/ui/parser/bind-struct-early-modifiers.stderr +++ b/src/test/ui/parser/bind-struct-early-modifiers.stderr @@ -1,13 +1,13 @@ error: expected `,` --> $DIR/bind-struct-early-modifiers.rs:4:19 | -LL | Foo { ref x: ref x } => {}, //~ ERROR expected `,` +LL | Foo { ref x: ref x } => {}, | ^ error[E0027]: pattern does not mention field `x` --> $DIR/bind-struct-early-modifiers.rs:4:9 | -LL | Foo { ref x: ref x } => {}, //~ ERROR expected `,` +LL | Foo { ref x: ref x } => {}, | ^^^^^^^^^^^^^^^^^^^^ missing field `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/bound-single-question-mark.stderr b/src/test/ui/parser/bound-single-question-mark.stderr index e30b32f41b41..82937a517b5e 100644 --- a/src/test/ui/parser/bound-single-question-mark.stderr +++ b/src/test/ui/parser/bound-single-question-mark.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `>` --> $DIR/bound-single-question-mark.rs:1:10 | -LL | fn f() {} //~ ERROR expected identifier, found `>` +LL | fn f() {} | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/parser/bounds-lifetime-1.stderr b/src/test/ui/parser/bounds-lifetime-1.stderr index 33bba35f692d..17d65314d962 100644 --- a/src/test/ui/parser/bounds-lifetime-1.stderr +++ b/src/test/ui/parser/bounds-lifetime-1.stderr @@ -1,7 +1,7 @@ error: expected one of `,`, `:`, or `>`, found `'b` --> $DIR/bounds-lifetime-1.rs:1:17 | -LL | type A = for<'a 'b> fn(); //~ ERROR expected one of `,`, `:`, or `>`, found `'b` +LL | type A = for<'a 'b> fn(); | ^^ expected one of `,`, `:`, or `>` here error: aborting due to previous error diff --git a/src/test/ui/parser/bounds-lifetime-2.stderr b/src/test/ui/parser/bounds-lifetime-2.stderr index a8a22aaafce3..587e527f0a85 100644 --- a/src/test/ui/parser/bounds-lifetime-2.stderr +++ b/src/test/ui/parser/bounds-lifetime-2.stderr @@ -1,7 +1,7 @@ error: expected one of `,`, `:`, or `>`, found `+` --> $DIR/bounds-lifetime-2.rs:1:17 | -LL | type A = for<'a + 'b> fn(); //~ ERROR expected one of `,`, `:`, or `>`, found `+` +LL | type A = for<'a + 'b> fn(); | ^ expected one of `,`, `:`, or `>` here error: aborting due to previous error diff --git a/src/test/ui/parser/bounds-lifetime-where-1.stderr b/src/test/ui/parser/bounds-lifetime-where-1.stderr index 0300fe989101..b6bd866938be 100644 --- a/src/test/ui/parser/bounds-lifetime-where-1.stderr +++ b/src/test/ui/parser/bounds-lifetime-where-1.stderr @@ -1,7 +1,7 @@ error: expected `:`, found `;` --> $DIR/bounds-lifetime-where-1.rs:1:16 | -LL | type A where 'a; //~ ERROR expected `:`, found `;` +LL | type A where 'a; | ^ expected `:` error: aborting due to previous error diff --git a/src/test/ui/parser/bounds-lifetime-where.stderr b/src/test/ui/parser/bounds-lifetime-where.stderr index 6a8d7e9d4a16..9507a4598581 100644 --- a/src/test/ui/parser/bounds-lifetime-where.stderr +++ b/src/test/ui/parser/bounds-lifetime-where.stderr @@ -1,7 +1,7 @@ error: expected one of `=`, lifetime, or type, found `,` --> $DIR/bounds-lifetime-where.rs:8:14 | -LL | type A where , = u8; //~ ERROR expected one of `=`, lifetime, or type, found `,` +LL | type A where , = u8; | ^ expected one of `=`, lifetime, or type here error: aborting due to previous error diff --git a/src/test/ui/parser/bounds-lifetime.stderr b/src/test/ui/parser/bounds-lifetime.stderr index 191ea3ebd070..facbd2800709 100644 --- a/src/test/ui/parser/bounds-lifetime.stderr +++ b/src/test/ui/parser/bounds-lifetime.stderr @@ -1,7 +1,7 @@ error: expected one of `>`, `const`, identifier, or lifetime, found `,` --> $DIR/bounds-lifetime.rs:9:14 | -LL | type A = for<,> fn(); //~ ERROR expected one of `>`, `const`, identifier, or lifetime, found `,` +LL | type A = for<,> fn(); | ^ expected one of `>`, `const`, identifier, or lifetime here error: aborting due to previous error diff --git a/src/test/ui/parser/bounds-type.stderr b/src/test/ui/parser/bounds-type.stderr index 046e0ce8c7ab..0b714e40a101 100644 --- a/src/test/ui/parser/bounds-type.stderr +++ b/src/test/ui/parser/bounds-type.stderr @@ -1,7 +1,7 @@ error: `?` may only modify trait bounds, not lifetime bounds --> $DIR/bounds-type.rs:10:8 | -LL | T: ?'a, //~ ERROR `?` may only modify trait bounds, not lifetime bounds +LL | T: ?'a, | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/byte-literals.stderr b/src/test/ui/parser/byte-literals.stderr index ab14eeede663..36cb0170a140 100644 --- a/src/test/ui/parser/byte-literals.stderr +++ b/src/test/ui/parser/byte-literals.stderr @@ -1,43 +1,43 @@ error: unknown byte escape: f --> $DIR/byte-literals.rs:6:21 | -LL | static FOO: u8 = b'/f'; //~ ERROR unknown byte escape +LL | static FOO: u8 = b'/f'; | ^ error: unknown byte escape: f --> $DIR/byte-literals.rs:9:8 | -LL | b'/f'; //~ ERROR unknown byte escape +LL | b'/f'; | ^ error: invalid character in numeric character escape: Z --> $DIR/byte-literals.rs:10:10 | -LL | b'/x0Z'; //~ ERROR invalid character in numeric character escape: Z +LL | b'/x0Z'; | ^ error: byte constant must be escaped: /t --> $DIR/byte-literals.rs:11:7 | -LL | b' '; //~ ERROR byte constant must be escaped +LL | b' '; | ^^^^ error: byte constant must be escaped: ' --> $DIR/byte-literals.rs:12:7 | -LL | b'''; //~ ERROR byte constant must be escaped +LL | b'''; | ^ error: byte constant must be ASCII. Use a /xHH escape for a non-ASCII byte --> $DIR/byte-literals.rs:13:7 | -LL | b'é'; //~ ERROR byte constant must be ASCII +LL | b'é'; | ^ error: unterminated byte constant: b'a --> $DIR/byte-literals.rs:14:5 | -LL | b'a //~ ERROR unterminated byte constant +LL | b'a | ^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/parser/byte-string-literals.stderr b/src/test/ui/parser/byte-string-literals.stderr index 669f5585cb24..2e9b13b933e2 100644 --- a/src/test/ui/parser/byte-string-literals.stderr +++ b/src/test/ui/parser/byte-string-literals.stderr @@ -1,31 +1,31 @@ error: unknown byte escape: f --> $DIR/byte-string-literals.rs:6:32 | -LL | static FOO: &'static [u8] = b"/f"; //~ ERROR unknown byte escape +LL | static FOO: &'static [u8] = b"/f"; | ^ error: unknown byte escape: f --> $DIR/byte-string-literals.rs:9:8 | -LL | b"/f"; //~ ERROR unknown byte escape +LL | b"/f"; | ^ error: invalid character in numeric character escape: Z --> $DIR/byte-string-literals.rs:10:10 | -LL | b"/x0Z"; //~ ERROR invalid character in numeric character escape: Z +LL | b"/x0Z"; | ^ error: byte constant must be ASCII. Use a /xHH escape for a non-ASCII byte --> $DIR/byte-string-literals.rs:11:7 | -LL | b"é"; //~ ERROR byte constant must be ASCII +LL | b"é"; | ^ error: unterminated double quote byte string --> $DIR/byte-string-literals.rs:12:7 | -LL | b"a //~ ERROR unterminated double quote byte string +LL | b"a | _______^ LL | | } | |__^ diff --git a/src/test/ui/parser/circular_modules_main.stderr b/src/test/ui/parser/circular_modules_main.stderr index 7751a8c0f38a..33865fb7bca9 100644 --- a/src/test/ui/parser/circular_modules_main.stderr +++ b/src/test/ui/parser/circular_modules_main.stderr @@ -1,7 +1,7 @@ error: circular modules: $DIR/circular_modules_hello.rs -> $DIR/circular_modules_main.rs -> $DIR/circular_modules_hello.rs --> $DIR/circular_modules_main.rs:2:5 | -LL | mod circular_modules_hello; //~ ERROR: circular modules +LL | mod circular_modules_hello; | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/column-offset-1-based.stderr b/src/test/ui/parser/column-offset-1-based.stderr index b12b47b67ce1..5cbf3d3e9596 100644 --- a/src/test/ui/parser/column-offset-1-based.stderr +++ b/src/test/ui/parser/column-offset-1-based.stderr @@ -1,7 +1,7 @@ error: expected `[`, found `` --> $DIR/column-offset-1-based.rs:1:1 | -LL | # //~ ERROR expected `[`, found `` +LL | # | ^ expected `[` error: aborting due to previous error diff --git a/src/test/ui/parser/default.stderr b/src/test/ui/parser/default.stderr index 27193672903a..c43fffd58af2 100644 --- a/src/test/ui/parser/default.stderr +++ b/src/test/ui/parser/default.stderr @@ -1,13 +1,13 @@ error: expected one of `async`, `const`, `existential`, `extern`, `fn`, `type`, or `unsafe`, found `pub` --> $DIR/default.rs:22:13 | -LL | default pub fn foo() -> T { T::default() } //~ ERROR expected one of +LL | default pub fn foo() -> T { T::default() } | ^^^ expected one of 7 possible tokens here error[E0449]: unnecessary visibility qualifier --> $DIR/default.rs:16:5 | -LL | pub default fn foo() -> T { //~ ERROR unnecessary visibility qualifier +LL | pub default fn foo() -> T { | ^^^ `pub` not permitted here because it's implied error[E0046]: not all trait items implemented, missing: `foo` @@ -16,7 +16,7 @@ error[E0046]: not all trait items implemented, missing: `foo` LL | fn foo() -> T; | -------------------------- `foo` from trait ... -LL | impl Foo for u32 { //~ ERROR not all trait items implemented, missing: `foo` +LL | impl Foo for u32 { | ^^^^^^^^^^^^^^^^ missing `foo` in implementation error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/doc-before-attr.stderr b/src/test/ui/parser/doc-before-attr.stderr index 0cd6aa81ec5f..0fae44ce5c80 100644 --- a/src/test/ui/parser/doc-before-attr.stderr +++ b/src/test/ui/parser/doc-before-attr.stderr @@ -1,7 +1,7 @@ error: expected item after attributes --> $DIR/doc-before-attr.rs:4:16 | -LL | #[derive(Debug)] //~ERROR expected item after attributes +LL | #[derive(Debug)] | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/doc-before-eof.stderr b/src/test/ui/parser/doc-before-eof.stderr index 5809d64e8067..82756626765b 100644 --- a/src/test/ui/parser/doc-before-eof.stderr +++ b/src/test/ui/parser/doc-before-eof.stderr @@ -1,7 +1,7 @@ error: expected item after doc comment --> $DIR/doc-before-eof.rs:3:1 | -LL | /// hi //~ERROR expected item after doc comment +LL | /// hi | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment doesn't document anything error: aborting due to previous error diff --git a/src/test/ui/parser/empty-impl-semicolon.stderr b/src/test/ui/parser/empty-impl-semicolon.stderr index 965a8a45aede..46f2393cd832 100644 --- a/src/test/ui/parser/empty-impl-semicolon.stderr +++ b/src/test/ui/parser/empty-impl-semicolon.stderr @@ -1,7 +1,7 @@ error: expected one of `!`, `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `;` --> $DIR/empty-impl-semicolon.rs:1:9 | -LL | impl Foo; //~ ERROR expected one of `!`, `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `;` +LL | impl Foo; | ^ expected one of 8 possible tokens here error: aborting due to previous error diff --git a/src/test/ui/parser/extern-crate-unexpected-token.stderr b/src/test/ui/parser/extern-crate-unexpected-token.stderr index ed888eb1a8ea..04edd46936a6 100644 --- a/src/test/ui/parser/extern-crate-unexpected-token.stderr +++ b/src/test/ui/parser/extern-crate-unexpected-token.stderr @@ -1,7 +1,7 @@ error: expected one of `crate`, `fn`, or `{`, found `crte` --> $DIR/extern-crate-unexpected-token.rs:1:8 | -LL | extern crte foo; //~ ERROR expected one of `crate`, `fn`, or `{`, found `crte` +LL | extern crte foo; | ^^^^ expected one of `crate`, `fn`, or `{` here error: aborting due to previous error diff --git a/src/test/ui/parser/extern-expected-fn-or-brace.stderr b/src/test/ui/parser/extern-expected-fn-or-brace.stderr index 94b2d1d7b7e8..0fb993553417 100644 --- a/src/test/ui/parser/extern-expected-fn-or-brace.stderr +++ b/src/test/ui/parser/extern-expected-fn-or-brace.stderr @@ -1,7 +1,7 @@ error: expected one of `fn` or `{`, found `mod` --> $DIR/extern-expected-fn-or-brace.rs:4:12 | -LL | extern "C" mod foo; //~ERROR expected one of `fn` or `{`, found `mod` +LL | extern "C" mod foo; | ^^^ expected one of `fn` or `{` here error: aborting due to previous error diff --git a/src/test/ui/parser/extern-foreign-crate.stderr b/src/test/ui/parser/extern-foreign-crate.stderr index d2fe8b77ce66..de9f0c932327 100644 --- a/src/test/ui/parser/extern-foreign-crate.stderr +++ b/src/test/ui/parser/extern-foreign-crate.stderr @@ -1,7 +1,7 @@ error: expected one of `;` or `as`, found `{` --> $DIR/extern-foreign-crate.rs:4:18 | -LL | extern crate foo {} //~ERROR expected one of `;` or `as`, found `{` +LL | extern crate foo {} | ^ expected one of `;` or `as` here error: aborting due to previous error diff --git a/src/test/ui/parser/extern-no-fn.stderr b/src/test/ui/parser/extern-no-fn.stderr index e764cd084019..d2d5e3c46874 100644 --- a/src/test/ui/parser/extern-no-fn.stderr +++ b/src/test/ui/parser/extern-no-fn.stderr @@ -1,7 +1,7 @@ error: missing `fn`, `type`, or `static` for extern-item declaration --> $DIR/extern-no-fn.rs:1:9 | -LL | extern { //~ ERROR missing `fn`, `type`, or `static` for extern-item declaration +LL | extern { | _________^ LL | | f(); | |____^ missing `fn`, `type`, or `static` diff --git a/src/test/ui/parser/if-in-in.stderr b/src/test/ui/parser/if-in-in.stderr index 2938bba77d71..9926fcc0858e 100644 --- a/src/test/ui/parser/if-in-in.stderr +++ b/src/test/ui/parser/if-in-in.stderr @@ -1,7 +1,7 @@ error: expected iterable, found keyword `in` --> $DIR/if-in-in.rs:2:14 | -LL | for i in in 1..2 { //~ ERROR expected iterable, found keyword `in` +LL | for i in in 1..2 { | ---^^ | | | help: remove the duplicated `in` diff --git a/src/test/ui/parser/impl-parsing.stderr b/src/test/ui/parser/impl-parsing.stderr index 353f5e21ee64..935e93963e1e 100644 --- a/src/test/ui/parser/impl-parsing.stderr +++ b/src/test/ui/parser/impl-parsing.stderr @@ -1,31 +1,31 @@ error: missing `for` in a trait impl --> $DIR/impl-parsing.rs:6:11 | -LL | impl Trait Type {} //~ ERROR missing `for` in a trait impl +LL | impl Trait Type {} | ^ help: add `for` here error: missing `for` in a trait impl --> $DIR/impl-parsing.rs:7:11 | -LL | impl Trait .. {} //~ ERROR missing `for` in a trait impl +LL | impl Trait .. {} | ^ help: add `for` here error: expected a trait, found type --> $DIR/impl-parsing.rs:8:6 | -LL | impl ?Sized for Type {} //~ ERROR expected a trait, found type +LL | impl ?Sized for Type {} | ^^^^^^ error: expected a trait, found type --> $DIR/impl-parsing.rs:9:6 | -LL | impl ?Sized for .. {} //~ ERROR expected a trait, found type +LL | impl ?Sized for .. {} | ^^^^^^ error: expected `impl`, found `FAIL` --> $DIR/impl-parsing.rs:11:16 | -LL | default unsafe FAIL //~ ERROR expected `impl`, found `FAIL` +LL | default unsafe FAIL | ^^^^ expected `impl` here error: aborting due to 5 previous errors diff --git a/src/test/ui/parser/inner-attr.stderr b/src/test/ui/parser/inner-attr.stderr index 001eab226dc2..11a37bc139b3 100644 --- a/src/test/ui/parser/inner-attr.stderr +++ b/src/test/ui/parser/inner-attr.stderr @@ -1,7 +1,7 @@ error: an inner attribute is not permitted following an outer attribute --> $DIR/inner-attr.rs:3:3 | -LL | #![recursion_limit="100"] //~ ERROR an inner attribute is not permitted following an outer attribute +LL | #![recursion_limit="100"] | ^ | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. diff --git a/src/test/ui/parser/issue-10392-2.stderr b/src/test/ui/parser/issue-10392-2.stderr index 47e1f7adf25e..ccc5dd938b5f 100644 --- a/src/test/ui/parser/issue-10392-2.stderr +++ b/src/test/ui/parser/issue-10392-2.stderr @@ -1,7 +1,7 @@ error: expected `}`, found `,` --> $DIR/issue-10392-2.rs:6:15 | -LL | let A { .., } = a(); //~ ERROR: expected `}` +LL | let A { .., } = a(); | --^ | | | | | expected `}` diff --git a/src/test/ui/parser/issue-10392.stderr b/src/test/ui/parser/issue-10392.stderr index 9c9858aa26cb..7bf5aa93f0a5 100644 --- a/src/test/ui/parser/issue-10392.stderr +++ b/src/test/ui/parser/issue-10392.stderr @@ -1,13 +1,13 @@ error: expected identifier, found `,` --> $DIR/issue-10392.rs:6:13 | -LL | let A { , } = a(); //~ ERROR expected ident +LL | let A { , } = a(); | ^ expected identifier error[E0027]: pattern does not mention field `foo` --> $DIR/issue-10392.rs:6:9 | -LL | let A { , } = a(); //~ ERROR expected ident +LL | let A { , } = a(); | ^^^^^^^ missing field `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/issue-15914.stderr b/src/test/ui/parser/issue-15914.stderr index 3a886c4c481f..ea26453f8089 100644 --- a/src/test/ui/parser/issue-15914.stderr +++ b/src/test/ui/parser/issue-15914.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `(` --> $DIR/issue-15914.rs:3:9 | -LL | (); //~ ERROR expected identifier, found `(` +LL | (); | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/parser/issue-15980.stderr b/src/test/ui/parser/issue-15980.stderr index c91595208c86..879bcb2b4a1f 100644 --- a/src/test/ui/parser/issue-15980.stderr +++ b/src/test/ui/parser/issue-15980.stderr @@ -3,7 +3,7 @@ error: expected identifier, found keyword `return` | LL | Err(ref e) if e.kind == io::EndOfFile { | ------------- while parsing this struct -LL | //~^ NOTE while parsing this struct +LL | LL | return | ^^^^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers @@ -16,7 +16,7 @@ error: expected one of `.`, `=>`, `?`, or an operator, found `_` | LL | } | - expected one of `.`, `=>`, `?`, or an operator here -LL | //~^ NOTE expected one of `.`, `=>`, `?`, or an operator here +LL | LL | _ => {} | ^ unexpected token diff --git a/src/test/ui/parser/issue-17718-const-mut.stderr b/src/test/ui/parser/issue-17718-const-mut.stderr index 19f9fe19ef5a..8251ce9993fa 100644 --- a/src/test/ui/parser/issue-17718-const-mut.stderr +++ b/src/test/ui/parser/issue-17718-const-mut.stderr @@ -3,7 +3,7 @@ error: const globals cannot be mutable | LL | const | ----- help: you might want to declare a static instead: `static` -LL | mut //~ ERROR: const globals cannot be mutable +LL | mut | ^^^ cannot be mutable error: aborting due to previous error diff --git a/src/test/ui/parser/issue-17904-2.stderr b/src/test/ui/parser/issue-17904-2.stderr index 8322dc00cade..03e556da268f 100644 --- a/src/test/ui/parser/issue-17904-2.stderr +++ b/src/test/ui/parser/issue-17904-2.stderr @@ -1,7 +1,7 @@ error: expected item, found keyword `where` --> $DIR/issue-17904-2.rs:3:24 | -LL | struct Bar { x: T } where T: Copy //~ ERROR expected item, found keyword `where` +LL | struct Bar { x: T } where T: Copy | ^^^^^ expected item error: aborting due to previous error diff --git a/src/test/ui/parser/issue-17904.stderr b/src/test/ui/parser/issue-17904.stderr index f2f0b411e9ad..a44700936200 100644 --- a/src/test/ui/parser/issue-17904.stderr +++ b/src/test/ui/parser/issue-17904.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `==`, or `=`, found `;` --> $DIR/issue-17904.rs:6:33 | -LL | struct Foo where T: Copy, (T); //~ ERROR expected one of `:`, `==`, or `=`, found `;` +LL | struct Foo where T: Copy, (T); | ^ expected one of `:`, `==`, or `=` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-19096.stderr b/src/test/ui/parser/issue-19096.stderr index f92604d0067c..6aa97add7b0f 100644 --- a/src/test/ui/parser/issue-19096.stderr +++ b/src/test/ui/parser/issue-19096.stderr @@ -1,7 +1,7 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `::` --> $DIR/issue-19096.rs:3:8 | -LL | t.0::; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `::` +LL | t.0::; | ^^ expected one of `.`, `;`, `?`, `}`, or an operator here error[E0308]: mismatched types @@ -10,7 +10,7 @@ error[E0308]: mismatched types LL | fn main() { | - expected `()` because of default return type LL | let t = (42, 42); -LL | t.0::; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `::` +LL | t.0::; | ^^^ expected (), found integer | = note: expected type `()` diff --git a/src/test/ui/parser/issue-19398.stderr b/src/test/ui/parser/issue-19398.stderr index 627b74ff8f7b..d5f1f972d553 100644 --- a/src/test/ui/parser/issue-19398.stderr +++ b/src/test/ui/parser/issue-19398.stderr @@ -1,7 +1,7 @@ error: expected `fn`, found `unsafe` --> $DIR/issue-19398.rs:2:19 | -LL | extern "Rust" unsafe fn foo(); //~ ERROR expected `fn`, found `unsafe` +LL | extern "Rust" unsafe fn foo(); | ^^^^^^ expected `fn` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-20711-2.stderr b/src/test/ui/parser/issue-20711-2.stderr index e06eb7a9846e..f67dfa09aca8 100644 --- a/src/test/ui/parser/issue-20711-2.stderr +++ b/src/test/ui/parser/issue-20711-2.stderr @@ -3,7 +3,7 @@ error: expected one of `async`, `const`, `crate`, `default`, `existential`, `ext | LL | #[stable(feature = "rust1", since = "1.0.0")] | - expected one of 10 possible tokens here -LL | } //~ ERROR expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, or +LL | } | ^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/issue-20711.stderr b/src/test/ui/parser/issue-20711.stderr index 6cf39608fcc9..26b819fa2984 100644 --- a/src/test/ui/parser/issue-20711.stderr +++ b/src/test/ui/parser/issue-20711.stderr @@ -3,7 +3,7 @@ error: expected one of `async`, `const`, `crate`, `default`, `existential`, `ext | LL | #[stable(feature = "rust1", since = "1.0.0")] | - expected one of 10 possible tokens here -LL | } //~ ERROR expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, or +LL | } | ^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/issue-21153.stderr b/src/test/ui/parser/issue-21153.stderr index 1e0244c2e1d3..70f55f0aeb9f 100644 --- a/src/test/ui/parser/issue-21153.stderr +++ b/src/test/ui/parser/issue-21153.stderr @@ -1,7 +1,7 @@ error: missing `fn`, `type`, or `const` for trait-item declaration --> $DIR/issue-21153.rs:1:29 | -LL | trait MyTrait: Iterator { //~ ERROR missing `fn`, `type`, or `const` +LL | trait MyTrait: Iterator { | _____________________________^ LL | | Item = T; | |____^ missing `fn`, `type`, or `const` diff --git a/src/test/ui/parser/issue-22647.stderr b/src/test/ui/parser/issue-22647.stderr index 8935ea9c6c12..2dc56a5eca3a 100644 --- a/src/test/ui/parser/issue-22647.stderr +++ b/src/test/ui/parser/issue-22647.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, `=`, or `@`, found `<` --> $DIR/issue-22647.rs:2:15 | -LL | let caller = |f: F| //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<` +LL | let caller = |f: F| | ^ expected one of `:`, `;`, `=`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-22712.stderr b/src/test/ui/parser/issue-22712.stderr index 3a4fa9a5e7ba..167eaf962e0f 100644 --- a/src/test/ui/parser/issue-22712.stderr +++ b/src/test/ui/parser/issue-22712.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, `=`, or `@`, found `<` --> $DIR/issue-22712.rs:6:12 | -LL | let Foo> //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<` +LL | let Foo> | ^ expected one of `:`, `;`, `=`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-2354-1.stderr b/src/test/ui/parser/issue-2354-1.stderr index da25aac486e3..7c083751228b 100644 --- a/src/test/ui/parser/issue-2354-1.stderr +++ b/src/test/ui/parser/issue-2354-1.stderr @@ -1,7 +1,7 @@ error: unexpected close delimiter: `}` --> $DIR/issue-2354-1.rs:1:24 | -LL | static foo: isize = 2; } //~ ERROR unexpected close delimiter: +LL | static foo: isize = 2; } | ^ unexpected close delimiter error: aborting due to previous error diff --git a/src/test/ui/parser/issue-2354.stderr b/src/test/ui/parser/issue-2354.stderr index 0f4cd5724ce1..7098da738b8d 100644 --- a/src/test/ui/parser/issue-2354.stderr +++ b/src/test/ui/parser/issue-2354.stderr @@ -1,7 +1,7 @@ error: this file contains an un-closed delimiter --> $DIR/issue-2354.rs:15:66 | -LL | fn foo() { //~ NOTE un-closed delimiter +LL | fn foo() { | - un-closed delimiter LL | match Some(10) { | - this delimiter might not be properly closed... @@ -9,7 +9,7 @@ LL | match Some(10) { LL | } | - ...as it matches this but it has different indentation ... -LL | //~ ERROR this file contains an un-closed delimiter +LL | | ^ error[E0601]: `main` function not found in crate `issue_2354` @@ -18,7 +18,7 @@ error[E0601]: `main` function not found in crate `issue_2354` note: here is a function named 'main' --> $DIR/issue-2354.rs:14:1 | -LL | fn main() {} //~ NOTE here is a function named 'main' +LL | fn main() {} | ^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/issue-24197.stderr b/src/test/ui/parser/issue-24197.stderr index 4e073d8c58aa..2dfb31432bc9 100644 --- a/src/test/ui/parser/issue-24197.stderr +++ b/src/test/ui/parser/issue-24197.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, `=`, or `@`, found `[` --> $DIR/issue-24197.rs:2:12 | -LL | let buf[0] = 0; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `[` +LL | let buf[0] = 0; | ^ expected one of `:`, `;`, `=`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-24375.stderr b/src/test/ui/parser/issue-24375.stderr index f773a7df4fed..e45b08be9ab6 100644 --- a/src/test/ui/parser/issue-24375.stderr +++ b/src/test/ui/parser/issue-24375.stderr @@ -1,7 +1,7 @@ error: expected one of `=>`, `@`, `if`, or `|`, found `[` --> $DIR/issue-24375.rs:6:12 | -LL | tmp[0] => {} //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `[` +LL | tmp[0] => {} | ^ expected one of `=>`, `@`, `if`, or `|` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-3036.stderr b/src/test/ui/parser/issue-3036.stderr index eadf5546d850..18947b8fa401 100644 --- a/src/test/ui/parser/issue-3036.stderr +++ b/src/test/ui/parser/issue-3036.stderr @@ -3,7 +3,7 @@ error: expected one of `.`, `;`, `?`, or an operator, found `}` | LL | let x = 3 | - expected one of `.`, `;`, `?`, or an operator here -LL | } //~ ERROR: expected one of `.`, `;`, `?`, or an operator, found `}` +LL | } | ^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/issue-32446.stderr b/src/test/ui/parser/issue-32446.stderr index 07eafdde9071..b0c18f4ec5a4 100644 --- a/src/test/ui/parser/issue-32446.stderr +++ b/src/test/ui/parser/issue-32446.stderr @@ -1,7 +1,7 @@ error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `...` --> $DIR/issue-32446.rs:4:11 | -LL | trait T { ... } //~ ERROR +LL | trait T { ... } | ^^^ expected one of 7 possible tokens here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-32501.stderr b/src/test/ui/parser/issue-32501.stderr index d74c539abfe5..97efb8959357 100644 --- a/src/test/ui/parser/issue-32501.stderr +++ b/src/test/ui/parser/issue-32501.stderr @@ -1,7 +1,7 @@ error: expected identifier, found reserved identifier `_` --> $DIR/issue-32501.rs:7:13 | -LL | let mut _ = 0; //~ ERROR expected identifier, found reserved identifier `_` +LL | let mut _ = 0; | ^ expected identifier, found reserved identifier error: aborting due to previous error diff --git a/src/test/ui/parser/issue-32505.stderr b/src/test/ui/parser/issue-32505.stderr index 1ea4c36a5255..f812646ca588 100644 --- a/src/test/ui/parser/issue-32505.stderr +++ b/src/test/ui/parser/issue-32505.stderr @@ -1,7 +1,7 @@ error: expected expression, found `)` --> $DIR/issue-32505.rs:4:12 | -LL | foo(|_|) //~ ERROR expected expression, found `)` +LL | foo(|_|) | ^ expected expression error: aborting due to previous error diff --git a/src/test/ui/parser/issue-33418.stderr b/src/test/ui/parser/issue-33418.stderr index bfe44588a5b0..acbe597ef31a 100644 --- a/src/test/ui/parser/issue-33418.stderr +++ b/src/test/ui/parser/issue-33418.stderr @@ -1,13 +1,13 @@ error: negative trait bounds are not supported --> $DIR/issue-33418.rs:3:9 | -LL | trait Tr: !SuperA {} //~ ERROR negative trait bounds are not supported +LL | trait Tr: !SuperA {} | ^^^^^^^^^ help: remove the trait bound error: negative trait bounds are not supported --> $DIR/issue-33418.rs:4:19 | -LL | trait Tr2: SuperA + !SuperB {} //~ ERROR negative trait bounds are not supported +LL | trait Tr2: SuperA + !SuperB {} | ---------^^^^^^^^^ | | | help: remove the trait bound @@ -15,7 +15,7 @@ LL | trait Tr2: SuperA + !SuperB {} //~ ERROR negative trait bounds are not supp error: negative trait bounds are not supported --> $DIR/issue-33418.rs:5:10 | -LL | trait Tr3: !SuperA + SuperB {} //~ ERROR negative trait bounds are not supported +LL | trait Tr3: !SuperA + SuperB {} | ^^^^^^^^^--------- | | | help: remove the trait bound @@ -23,7 +23,7 @@ LL | trait Tr3: !SuperA + SuperB {} //~ ERROR negative trait bounds are not supp error: negative trait bounds are not supported --> $DIR/issue-33418.rs:6:10 | -LL | trait Tr4: !SuperA + SuperB //~ ERROR negative trait bounds are not supported +LL | trait Tr4: !SuperA + SuperB | __________-^^^^^^^^ LL | | + !SuperC + SuperD {} | |_____^^^^^^^^^________- help: remove the trait bounds @@ -31,7 +31,7 @@ LL | | + !SuperC + SuperD {} error: negative trait bounds are not supported --> $DIR/issue-33418.rs:8:10 | -LL | trait Tr5: !SuperA //~ ERROR negative trait bounds are not supported +LL | trait Tr5: !SuperA | __________-^^^^^^^^ LL | | + !SuperB {} | | ^^^^^^^^- diff --git a/src/test/ui/parser/issue-33455.stderr b/src/test/ui/parser/issue-33455.stderr index 38d00a0ea0b4..4516c388afcb 100644 --- a/src/test/ui/parser/issue-33455.stderr +++ b/src/test/ui/parser/issue-33455.stderr @@ -1,7 +1,7 @@ error: expected one of `::`, `;`, or `as`, found `.` --> $DIR/issue-33455.rs:1:8 | -LL | use foo.bar; //~ ERROR expected one of `::`, `;`, or `as`, found `.` +LL | use foo.bar; | ^ expected one of `::`, `;`, or `as` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-41155.stderr b/src/test/ui/parser/issue-41155.stderr index ac75829f2e35..719845e69993 100644 --- a/src/test/ui/parser/issue-41155.stderr +++ b/src/test/ui/parser/issue-41155.stderr @@ -3,7 +3,7 @@ error: expected one of `(`, `async`, `const`, `default`, `existential`, `extern` | LL | pub | - expected one of 9 possible tokens here -LL | } //~ ERROR expected one of +LL | } | ^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/issue-43692.stderr b/src/test/ui/parser/issue-43692.stderr index 780f63a66386..9408182f9527 100644 --- a/src/test/ui/parser/issue-43692.stderr +++ b/src/test/ui/parser/issue-43692.stderr @@ -1,7 +1,7 @@ error: invalid start of unicode escape --> $DIR/issue-43692.rs:2:9 | -LL | '/u{_10FFFF}'; //~ ERROR invalid start of unicode escape +LL | '/u{_10FFFF}'; | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/issue-5806.stderr b/src/test/ui/parser/issue-5806.stderr index f9f00f70f0b9..6cf902ca86e7 100644 --- a/src/test/ui/parser/issue-5806.stderr +++ b/src/test/ui/parser/issue-5806.stderr @@ -1,7 +1,7 @@ error: couldn't read $DIR/../parser: $ACCESS_DENIED_MSG (os error $ACCESS_DENIED_CODE) --> $DIR/issue-5806.rs:5:5 | -LL | mod foo; //~ ERROR couldn't read +LL | mod foo; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/issue-6610.stderr b/src/test/ui/parser/issue-6610.stderr index b4760161a62a..22d93bffeade 100644 --- a/src/test/ui/parser/issue-6610.stderr +++ b/src/test/ui/parser/issue-6610.stderr @@ -1,7 +1,7 @@ error: expected `;` or `{`, found `}` --> $DIR/issue-6610.rs:1:20 | -LL | trait Foo { fn a() } //~ ERROR expected `;` or `{`, found `}` +LL | trait Foo { fn a() } | ^ expected `;` or `{` error: aborting due to previous error diff --git a/src/test/ui/parser/issue-8537.stderr b/src/test/ui/parser/issue-8537.stderr index 4442cd0ff011..82ca61421543 100644 --- a/src/test/ui/parser/issue-8537.stderr +++ b/src/test/ui/parser/issue-8537.stderr @@ -1,7 +1,7 @@ error[E0703]: invalid ABI: found `invalid-ab_isize` --> $DIR/issue-8537.rs:2:3 | -LL | "invalid-ab_isize" //~ ERROR invalid ABI +LL | "invalid-ab_isize" | ^^^^^^^^^^^^^^^^^^ invalid ABI | = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, amdgpu-kernel, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted diff --git a/src/test/ui/parser/keyword-abstract.stderr b/src/test/ui/parser/keyword-abstract.stderr index 4185ae034b50..2c79598a81b1 100644 --- a/src/test/ui/parser/keyword-abstract.stderr +++ b/src/test/ui/parser/keyword-abstract.stderr @@ -1,7 +1,7 @@ error: expected pattern, found reserved keyword `abstract` --> $DIR/keyword-abstract.rs:2:9 | -LL | let abstract = (); //~ ERROR expected pattern, found reserved keyword `abstract` +LL | let abstract = (); | ^^^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-as-as-identifier.stderr b/src/test/ui/parser/keyword-as-as-identifier.stderr index 6eaf5e2ed93e..ef466488ad06 100644 --- a/src/test/ui/parser/keyword-as-as-identifier.stderr +++ b/src/test/ui/parser/keyword-as-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `as` --> $DIR/keyword-as-as-identifier.rs:4:9 | -LL | let as = "foo"; //~ error: expected pattern, found keyword `as` +LL | let as = "foo"; | ^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-box-as-identifier.stderr b/src/test/ui/parser/keyword-box-as-identifier.stderr index 07a134442b8d..8b185948498d 100644 --- a/src/test/ui/parser/keyword-box-as-identifier.stderr +++ b/src/test/ui/parser/keyword-box-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found `=` --> $DIR/keyword-box-as-identifier.rs:2:13 | -LL | let box = "foo"; //~ error: expected pattern, found `=` +LL | let box = "foo"; | ^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-break-as-identifier.stderr b/src/test/ui/parser/keyword-break-as-identifier.stderr index 69af97374455..690bd84221a9 100644 --- a/src/test/ui/parser/keyword-break-as-identifier.stderr +++ b/src/test/ui/parser/keyword-break-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `break` --> $DIR/keyword-break-as-identifier.rs:4:9 | -LL | let break = "foo"; //~ error: expected pattern, found keyword `break` +LL | let break = "foo"; | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-const-as-identifier.stderr b/src/test/ui/parser/keyword-const-as-identifier.stderr index c727f1754c77..6da47f88d04e 100644 --- a/src/test/ui/parser/keyword-const-as-identifier.stderr +++ b/src/test/ui/parser/keyword-const-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `const` --> $DIR/keyword-const-as-identifier.rs:4:9 | -LL | let const = "foo"; //~ error: expected pattern, found keyword `const` +LL | let const = "foo"; | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-continue-as-identifier.stderr b/src/test/ui/parser/keyword-continue-as-identifier.stderr index 7fd2761884f7..4b0a659f9ad7 100644 --- a/src/test/ui/parser/keyword-continue-as-identifier.stderr +++ b/src/test/ui/parser/keyword-continue-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `continue` --> $DIR/keyword-continue-as-identifier.rs:4:9 | -LL | let continue = "foo"; //~ error: expected pattern, found keyword `continue` +LL | let continue = "foo"; | ^^^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-else-as-identifier.stderr b/src/test/ui/parser/keyword-else-as-identifier.stderr index 6d180bb56da5..bec7b7ba01e1 100644 --- a/src/test/ui/parser/keyword-else-as-identifier.stderr +++ b/src/test/ui/parser/keyword-else-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `else` --> $DIR/keyword-else-as-identifier.rs:4:9 | -LL | let else = "foo"; //~ error: expected pattern, found keyword `else` +LL | let else = "foo"; | ^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-enum-as-identifier.stderr b/src/test/ui/parser/keyword-enum-as-identifier.stderr index dc7e37824dc6..51a834f797c3 100644 --- a/src/test/ui/parser/keyword-enum-as-identifier.stderr +++ b/src/test/ui/parser/keyword-enum-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `enum` --> $DIR/keyword-enum-as-identifier.rs:4:9 | -LL | let enum = "foo"; //~ error: expected pattern, found keyword `enum` +LL | let enum = "foo"; | ^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-final.stderr b/src/test/ui/parser/keyword-final.stderr index 897624279e5e..e8372643be6b 100644 --- a/src/test/ui/parser/keyword-final.stderr +++ b/src/test/ui/parser/keyword-final.stderr @@ -1,7 +1,7 @@ error: expected pattern, found reserved keyword `final` --> $DIR/keyword-final.rs:2:9 | -LL | let final = (); //~ ERROR expected pattern, found reserved keyword `final` +LL | let final = (); | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-fn-as-identifier.stderr b/src/test/ui/parser/keyword-fn-as-identifier.stderr index 945fc77c3102..a071a40a70e0 100644 --- a/src/test/ui/parser/keyword-fn-as-identifier.stderr +++ b/src/test/ui/parser/keyword-fn-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `fn` --> $DIR/keyword-fn-as-identifier.rs:4:9 | -LL | let fn = "foo"; //~ error: expected pattern, found keyword `fn` +LL | let fn = "foo"; | ^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-for-as-identifier.stderr b/src/test/ui/parser/keyword-for-as-identifier.stderr index 32263e9f6e20..090046cebdc5 100644 --- a/src/test/ui/parser/keyword-for-as-identifier.stderr +++ b/src/test/ui/parser/keyword-for-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `for` --> $DIR/keyword-for-as-identifier.rs:4:9 | -LL | let for = "foo"; //~ error: expected pattern, found keyword `for` +LL | let for = "foo"; | ^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-if-as-identifier.stderr b/src/test/ui/parser/keyword-if-as-identifier.stderr index 11ba41015cbd..98bfdb46e977 100644 --- a/src/test/ui/parser/keyword-if-as-identifier.stderr +++ b/src/test/ui/parser/keyword-if-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `if` --> $DIR/keyword-if-as-identifier.rs:4:9 | -LL | let if = "foo"; //~ error: expected pattern, found keyword `if` +LL | let if = "foo"; | ^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-impl-as-identifier.stderr b/src/test/ui/parser/keyword-impl-as-identifier.stderr index 960a42df429e..2672959b7c68 100644 --- a/src/test/ui/parser/keyword-impl-as-identifier.stderr +++ b/src/test/ui/parser/keyword-impl-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `impl` --> $DIR/keyword-impl-as-identifier.rs:4:9 | -LL | let impl = "foo"; //~ error: expected pattern, found keyword `impl` +LL | let impl = "foo"; | ^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-in-as-identifier.stderr b/src/test/ui/parser/keyword-in-as-identifier.stderr index 2300a257a02b..98332b723f27 100644 --- a/src/test/ui/parser/keyword-in-as-identifier.stderr +++ b/src/test/ui/parser/keyword-in-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `in` --> $DIR/keyword-in-as-identifier.rs:4:9 | -LL | let in = "foo"; //~ error: expected pattern, found keyword `in` +LL | let in = "foo"; | ^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-let-as-identifier.stderr b/src/test/ui/parser/keyword-let-as-identifier.stderr index ed2c8a4eb9c4..99dbc0530f3f 100644 --- a/src/test/ui/parser/keyword-let-as-identifier.stderr +++ b/src/test/ui/parser/keyword-let-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `let` --> $DIR/keyword-let-as-identifier.rs:4:9 | -LL | let let = "foo"; //~ error: expected pattern, found keyword `let` +LL | let let = "foo"; | ^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-loop-as-identifier.stderr b/src/test/ui/parser/keyword-loop-as-identifier.stderr index f91cab029533..783507eb35cd 100644 --- a/src/test/ui/parser/keyword-loop-as-identifier.stderr +++ b/src/test/ui/parser/keyword-loop-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `loop` --> $DIR/keyword-loop-as-identifier.rs:4:9 | -LL | let loop = "foo"; //~ error: expected pattern, found keyword `loop` +LL | let loop = "foo"; | ^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-match-as-identifier.stderr b/src/test/ui/parser/keyword-match-as-identifier.stderr index 4c8e76695bc8..e56a115c9163 100644 --- a/src/test/ui/parser/keyword-match-as-identifier.stderr +++ b/src/test/ui/parser/keyword-match-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `match` --> $DIR/keyword-match-as-identifier.rs:4:9 | -LL | let match = "foo"; //~ error: expected pattern, found keyword `match` +LL | let match = "foo"; | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-mod-as-identifier.stderr b/src/test/ui/parser/keyword-mod-as-identifier.stderr index 8aeebcebec95..a8be2ceb037d 100644 --- a/src/test/ui/parser/keyword-mod-as-identifier.stderr +++ b/src/test/ui/parser/keyword-mod-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `mod` --> $DIR/keyword-mod-as-identifier.rs:4:9 | -LL | let mod = "foo"; //~ error: expected pattern, found keyword `mod` +LL | let mod = "foo"; | ^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-move-as-identifier.stderr b/src/test/ui/parser/keyword-move-as-identifier.stderr index 37e06708e25f..e0687e27eb58 100644 --- a/src/test/ui/parser/keyword-move-as-identifier.stderr +++ b/src/test/ui/parser/keyword-move-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `move` --> $DIR/keyword-move-as-identifier.rs:4:9 | -LL | let move = "foo"; //~ error: expected pattern, found keyword `move` +LL | let move = "foo"; | ^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-mut-as-identifier.stderr b/src/test/ui/parser/keyword-mut-as-identifier.stderr index b0266060903c..040960835d81 100644 --- a/src/test/ui/parser/keyword-mut-as-identifier.stderr +++ b/src/test/ui/parser/keyword-mut-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `=` --> $DIR/keyword-mut-as-identifier.rs:2:13 | -LL | let mut = "foo"; //~ error: expected identifier, found `=` +LL | let mut = "foo"; | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-override.stderr b/src/test/ui/parser/keyword-override.stderr index 69a6415908c2..1bfc6c9b3858 100644 --- a/src/test/ui/parser/keyword-override.stderr +++ b/src/test/ui/parser/keyword-override.stderr @@ -1,7 +1,7 @@ error: expected pattern, found reserved keyword `override` --> $DIR/keyword-override.rs:2:9 | -LL | let override = (); //~ ERROR expected pattern, found reserved keyword `override` +LL | let override = (); | ^^^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-pub-as-identifier.stderr b/src/test/ui/parser/keyword-pub-as-identifier.stderr index 8b595673ec4c..526ddcd6ee0f 100644 --- a/src/test/ui/parser/keyword-pub-as-identifier.stderr +++ b/src/test/ui/parser/keyword-pub-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `pub` --> $DIR/keyword-pub-as-identifier.rs:4:9 | -LL | let pub = "foo"; //~ error: expected pattern, found keyword `pub` +LL | let pub = "foo"; | ^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-ref-as-identifier.stderr b/src/test/ui/parser/keyword-ref-as-identifier.stderr index 656df196f09b..618043d89ffa 100644 --- a/src/test/ui/parser/keyword-ref-as-identifier.stderr +++ b/src/test/ui/parser/keyword-ref-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `=` --> $DIR/keyword-ref-as-identifier.rs:2:13 | -LL | let ref = "foo"; //~ error: expected identifier, found `=` +LL | let ref = "foo"; | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-return-as-identifier.stderr b/src/test/ui/parser/keyword-return-as-identifier.stderr index 903137542d6f..c0156a63fa9d 100644 --- a/src/test/ui/parser/keyword-return-as-identifier.stderr +++ b/src/test/ui/parser/keyword-return-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `return` --> $DIR/keyword-return-as-identifier.rs:4:9 | -LL | let return = "foo"; //~ error: expected pattern, found keyword `return` +LL | let return = "foo"; | ^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-static-as-identifier.stderr b/src/test/ui/parser/keyword-static-as-identifier.stderr index 4830e6f1bef4..00a65977732f 100644 --- a/src/test/ui/parser/keyword-static-as-identifier.stderr +++ b/src/test/ui/parser/keyword-static-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `static` --> $DIR/keyword-static-as-identifier.rs:4:9 | -LL | let static = "foo"; //~ error: expected pattern, found keyword `static` +LL | let static = "foo"; | ^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-struct-as-identifier.stderr b/src/test/ui/parser/keyword-struct-as-identifier.stderr index 50ac690e425a..b2d6639e72ec 100644 --- a/src/test/ui/parser/keyword-struct-as-identifier.stderr +++ b/src/test/ui/parser/keyword-struct-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `struct` --> $DIR/keyword-struct-as-identifier.rs:4:9 | -LL | let struct = "foo"; //~ error: expected pattern, found keyword `struct` +LL | let struct = "foo"; | ^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-trait-as-identifier.stderr b/src/test/ui/parser/keyword-trait-as-identifier.stderr index 3736f366cbd4..b31c0df28c00 100644 --- a/src/test/ui/parser/keyword-trait-as-identifier.stderr +++ b/src/test/ui/parser/keyword-trait-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `trait` --> $DIR/keyword-trait-as-identifier.rs:4:9 | -LL | let trait = "foo"; //~ error: expected pattern, found keyword `trait` +LL | let trait = "foo"; | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr b/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr index 73e8d64b56c1..c342e3a76fbb 100644 --- a/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr +++ b/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr @@ -1,7 +1,7 @@ error: expected pattern, found reserved keyword `try` --> $DIR/keyword-try-as-identifier-edition2018.rs:4:9 | -LL | let try = "foo"; //~ error: expected pattern, found reserved keyword `try` +LL | let try = "foo"; | ^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-type-as-identifier.stderr b/src/test/ui/parser/keyword-type-as-identifier.stderr index f7db20034a10..b749c708d441 100644 --- a/src/test/ui/parser/keyword-type-as-identifier.stderr +++ b/src/test/ui/parser/keyword-type-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `type` --> $DIR/keyword-type-as-identifier.rs:4:9 | -LL | let type = "foo"; //~ error: expected pattern, found keyword `type` +LL | let type = "foo"; | ^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-typeof.stderr b/src/test/ui/parser/keyword-typeof.stderr index 07c9f883b60f..e7b18023e61a 100644 --- a/src/test/ui/parser/keyword-typeof.stderr +++ b/src/test/ui/parser/keyword-typeof.stderr @@ -1,7 +1,7 @@ error: expected pattern, found reserved keyword `typeof` --> $DIR/keyword-typeof.rs:2:9 | -LL | let typeof = (); //~ ERROR expected pattern, found reserved keyword `typeof` +LL | let typeof = (); | ^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-unsafe-as-identifier.stderr b/src/test/ui/parser/keyword-unsafe-as-identifier.stderr index ddd5e4d7b115..67935ce43ba0 100644 --- a/src/test/ui/parser/keyword-unsafe-as-identifier.stderr +++ b/src/test/ui/parser/keyword-unsafe-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `unsafe` --> $DIR/keyword-unsafe-as-identifier.rs:4:9 | -LL | let unsafe = "foo"; //~ error: expected pattern, found keyword `unsafe` +LL | let unsafe = "foo"; | ^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-use-as-identifier.stderr b/src/test/ui/parser/keyword-use-as-identifier.stderr index 7e798a3f0b9d..2c69d0a8744a 100644 --- a/src/test/ui/parser/keyword-use-as-identifier.stderr +++ b/src/test/ui/parser/keyword-use-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `use` --> $DIR/keyword-use-as-identifier.rs:4:9 | -LL | let use = "foo"; //~ error: expected pattern, found keyword `use` +LL | let use = "foo"; | ^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-where-as-identifier.stderr b/src/test/ui/parser/keyword-where-as-identifier.stderr index 5285520cc20c..fc01183ca046 100644 --- a/src/test/ui/parser/keyword-where-as-identifier.stderr +++ b/src/test/ui/parser/keyword-where-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `where` --> $DIR/keyword-where-as-identifier.rs:4:9 | -LL | let where = "foo"; //~ error: expected pattern, found keyword `where` +LL | let where = "foo"; | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-while-as-identifier.stderr b/src/test/ui/parser/keyword-while-as-identifier.stderr index b84a652dc5c8..f72ac8774209 100644 --- a/src/test/ui/parser/keyword-while-as-identifier.stderr +++ b/src/test/ui/parser/keyword-while-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `while` --> $DIR/keyword-while-as-identifier.rs:4:9 | -LL | let while = "foo"; //~ error: expected pattern, found keyword `while` +LL | let while = "foo"; | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/lex-bad-binary-literal.stderr b/src/test/ui/parser/lex-bad-binary-literal.stderr index 9750906aaf21..15959f671b63 100644 --- a/src/test/ui/parser/lex-bad-binary-literal.stderr +++ b/src/test/ui/parser/lex-bad-binary-literal.stderr @@ -1,55 +1,55 @@ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:4:8 | -LL | 0b121; //~ ERROR invalid digit for a base 2 literal +LL | 0b121; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:5:12 | -LL | 0b10_10301; //~ ERROR invalid digit for a base 2 literal +LL | 0b10_10301; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:6:7 | -LL | 0b30; //~ ERROR invalid digit for a base 2 literal +LL | 0b30; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:7:7 | -LL | 0b41; //~ ERROR invalid digit for a base 2 literal +LL | 0b41; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:8:7 | -LL | 0b5; //~ ERROR invalid digit for a base 2 literal +LL | 0b5; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:9:7 | -LL | 0b6; //~ ERROR invalid digit for a base 2 literal +LL | 0b6; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:10:7 | -LL | 0b7; //~ ERROR invalid digit for a base 2 literal +LL | 0b7; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:11:7 | -LL | 0b8; //~ ERROR invalid digit for a base 2 literal +LL | 0b8; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:12:7 | -LL | 0b9; //~ ERROR invalid digit for a base 2 literal +LL | 0b9; | ^ error: aborting due to 9 previous errors diff --git a/src/test/ui/parser/lex-bad-char-literals-1.stderr b/src/test/ui/parser/lex-bad-char-literals-1.stderr index c22bf7d00109..3c8550e3dbe6 100644 --- a/src/test/ui/parser/lex-bad-char-literals-1.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-1.stderr @@ -1,25 +1,25 @@ error: numeric character escape is too short --> $DIR/lex-bad-char-literals-1.rs:3:8 | -LL | '/x1' //~ ERROR: numeric character escape is too short +LL | '/x1' | ^ error: numeric character escape is too short --> $DIR/lex-bad-char-literals-1.rs:7:8 | -LL | "/x1" //~ ERROR: numeric character escape is too short +LL | "/x1" | ^ error: unknown character escape: /u{25cf} --> $DIR/lex-bad-char-literals-1.rs:11:7 | -LL | '/●' //~ ERROR: unknown character escape +LL | '/●' | ^ error: unknown character escape: /u{25cf} --> $DIR/lex-bad-char-literals-1.rs:15:7 | -LL | "/●" //~ ERROR: unknown character escape +LL | "/●" | ^ error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/lex-bad-char-literals-2.stderr b/src/test/ui/parser/lex-bad-char-literals-2.stderr index 7eadb8ebfe06..4c1c5c29f472 100644 --- a/src/test/ui/parser/lex-bad-char-literals-2.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-2.stderr @@ -1,7 +1,7 @@ error: character literal may only contain one codepoint --> $DIR/lex-bad-char-literals-2.rs:3:5 | -LL | 'nope' //~ ERROR: character literal may only contain one codepoint +LL | 'nope' | ^^^^^^ error[E0601]: `main` function not found in crate `lex_bad_char_literals_2` diff --git a/src/test/ui/parser/lex-bad-char-literals-4.stderr b/src/test/ui/parser/lex-bad-char-literals-4.stderr index 881e3d5276bb..7bcca3761fc6 100644 --- a/src/test/ui/parser/lex-bad-char-literals-4.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-4.stderr @@ -1,7 +1,7 @@ error: character literal may only contain one codepoint: '● --> $DIR/lex-bad-char-literals-4.rs:4:5 | -LL | '● //~ ERROR: character literal may only contain one codepoint +LL | '● | ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/lex-bad-numeric-literals.stderr b/src/test/ui/parser/lex-bad-numeric-literals.stderr index 1fa23b8b73c9..466d7af1bda4 100644 --- a/src/test/ui/parser/lex-bad-numeric-literals.stderr +++ b/src/test/ui/parser/lex-bad-numeric-literals.stderr @@ -1,139 +1,139 @@ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:4:5 | -LL | 0o1.0; //~ ERROR: octal float literal is not supported +LL | 0o1.0; | ^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:6:5 | -LL | 0o3.0f32; //~ ERROR: octal float literal is not supported +LL | 0o3.0f32; | ^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:7:5 | -LL | 0o4e4; //~ ERROR: octal float literal is not supported +LL | 0o4e4; | ^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:8:5 | -LL | 0o5.0e5; //~ ERROR: octal float literal is not supported +LL | 0o5.0e5; | ^^^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:9:5 | -LL | 0o6e6f32; //~ ERROR: octal float literal is not supported +LL | 0o6e6f32; | ^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:10:5 | -LL | 0o7.0e7f64; //~ ERROR: octal float literal is not supported +LL | 0o7.0e7f64; | ^^^^^^^ error: hexadecimal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:11:5 | -LL | 0x8.0e+9; //~ ERROR: hexadecimal float literal is not supported +LL | 0x8.0e+9; | ^^^^^^^^ error: hexadecimal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:12:5 | -LL | 0x9.0e-9; //~ ERROR: hexadecimal float literal is not supported +LL | 0x9.0e-9; | ^^^^^^^^ error: no valid digits found for number --> $DIR/lex-bad-numeric-literals.rs:13:5 | -LL | 0o; //~ ERROR: no valid digits +LL | 0o; | ^^ error: expected at least one digit in exponent --> $DIR/lex-bad-numeric-literals.rs:14:8 | -LL | 1e+; //~ ERROR: expected at least one digit in exponent +LL | 1e+; | ^ error: hexadecimal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:15:5 | -LL | 0x539.0; //~ ERROR: hexadecimal float literal is not supported +LL | 0x539.0; | ^^^^^^^ error: no valid digits found for number --> $DIR/lex-bad-numeric-literals.rs:18:5 | -LL | 0x; //~ ERROR: no valid digits +LL | 0x; | ^^ error: no valid digits found for number --> $DIR/lex-bad-numeric-literals.rs:19:5 | -LL | 0xu32; //~ ERROR: no valid digits +LL | 0xu32; | ^^ error: no valid digits found for number --> $DIR/lex-bad-numeric-literals.rs:20:5 | -LL | 0ou32; //~ ERROR: no valid digits +LL | 0ou32; | ^^ error: no valid digits found for number --> $DIR/lex-bad-numeric-literals.rs:21:5 | -LL | 0bu32; //~ ERROR: no valid digits +LL | 0bu32; | ^^ error: no valid digits found for number --> $DIR/lex-bad-numeric-literals.rs:22:5 | -LL | 0b; //~ ERROR: no valid digits +LL | 0b; | ^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:24:5 | -LL | 0o123.456; //~ ERROR: octal float literal is not supported +LL | 0o123.456; | ^^^^^^^^^ error: binary float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:26:5 | -LL | 0b111.101; //~ ERROR: binary float literal is not supported +LL | 0b111.101; | ^^^^^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:5:5 | -LL | 0o2f32; //~ ERROR: octal float literal is not supported +LL | 0o2f32; | ^^^^^^ not supported error: int literal is too large --> $DIR/lex-bad-numeric-literals.rs:16:5 | -LL | 9900000000000000000000000000999999999999999999999999999999; //~ ERROR: int literal is too large +LL | 9900000000000000000000000000999999999999999999999999999999; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: int literal is too large --> $DIR/lex-bad-numeric-literals.rs:17:5 | -LL | 9900000000000000000000000000999999999999999999999999999999; //~ ERROR: int literal is too large +LL | 9900000000000000000000000000999999999999999999999999999999; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:23:5 | -LL | 0o123f64; //~ ERROR: octal float literal is not supported +LL | 0o123f64; | ^^^^^^^^ not supported error: binary float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:25:5 | -LL | 0b101f64; //~ ERROR: binary float literal is not supported +LL | 0b101f64; | ^^^^^^^^ not supported error: aborting due to 23 previous errors diff --git a/src/test/ui/parser/lex-bad-octal-literal.stderr b/src/test/ui/parser/lex-bad-octal-literal.stderr index 542247d69df6..01f4c236c9f3 100644 --- a/src/test/ui/parser/lex-bad-octal-literal.stderr +++ b/src/test/ui/parser/lex-bad-octal-literal.stderr @@ -1,13 +1,13 @@ error: invalid digit for a base 8 literal --> $DIR/lex-bad-octal-literal.rs:4:8 | -LL | 0o18; //~ ERROR invalid digit for a base 8 literal +LL | 0o18; | ^ error: invalid digit for a base 8 literal --> $DIR/lex-bad-octal-literal.rs:5:12 | -LL | 0o1234_9_5670; //~ ERROR invalid digit for a base 8 literal +LL | 0o1234_9_5670; | ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/lex-bad-token.stderr b/src/test/ui/parser/lex-bad-token.stderr index 284ffde9efbe..c0c2e542058b 100644 --- a/src/test/ui/parser/lex-bad-token.stderr +++ b/src/test/ui/parser/lex-bad-token.stderr @@ -1,7 +1,7 @@ error: unknown start of token: /u{25cf} --> $DIR/lex-bad-token.rs:1:1 | -LL | ● //~ ERROR: unknown start of token +LL | ● | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr index e9f3537ab743..19117bfa9c97 100644 --- a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr +++ b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr @@ -25,25 +25,25 @@ LL | /*! block doc comment with bare CR: ' ' */ error: bare CR not allowed in string, use /r instead --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:21:18 | -LL | let _s = "foo bar"; //~ ERROR: bare CR not allowed in string +LL | let _s = "foo bar"; | ^ error: bare CR not allowed in raw string, use /r instead --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:24:14 | -LL | let _s = r"bar foo"; //~ ERROR: bare CR not allowed in raw string +LL | let _s = r"bar foo"; | ^^^^^ error: unknown character escape: /r --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:27:19 | -LL | let _s = "foo/ bar"; //~ ERROR: unknown character escape: /r +LL | let _s = "foo/ bar"; | ^ | help: this is an isolated carriage return; consider checking your editor and version control settings --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:27:19 | -LL | let _s = "foo/ bar"; //~ ERROR: unknown character escape: /r +LL | let _s = "foo/ bar"; | ^ error: aborting due to 7 previous errors diff --git a/src/test/ui/parser/lex-stray-backslash.stderr b/src/test/ui/parser/lex-stray-backslash.stderr index 40e0cc1d786d..7ce061b8be07 100644 --- a/src/test/ui/parser/lex-stray-backslash.stderr +++ b/src/test/ui/parser/lex-stray-backslash.stderr @@ -1,7 +1,7 @@ error: unknown start of token: / --> $DIR/lex-stray-backslash.rs:1:1 | -LL | / //~ ERROR: unknown start of token: / +LL | / | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/macro-bad-delimiter-ident.stderr b/src/test/ui/parser/macro-bad-delimiter-ident.stderr index 59762e021652..6a17d39e8bfe 100644 --- a/src/test/ui/parser/macro-bad-delimiter-ident.stderr +++ b/src/test/ui/parser/macro-bad-delimiter-ident.stderr @@ -1,7 +1,7 @@ error: expected `(` or `{`, found `<` --> $DIR/macro-bad-delimiter-ident.rs:2:14 | -LL | foo! bar < //~ ERROR expected `(` or `{`, found `<` +LL | foo! bar < | ^ expected `(` or `{` error: aborting due to previous error diff --git a/src/test/ui/parser/macro-keyword.stderr b/src/test/ui/parser/macro-keyword.stderr index 4a10dd50b234..f74c8aa57e70 100644 --- a/src/test/ui/parser/macro-keyword.stderr +++ b/src/test/ui/parser/macro-keyword.stderr @@ -1,11 +1,11 @@ error: expected identifier, found reserved keyword `macro` --> $DIR/macro-keyword.rs:1:4 | -LL | fn macro() { //~ ERROR expected identifier, found reserved keyword `macro` +LL | fn macro() { | ^^^^^ expected identifier, found reserved keyword help: you can escape reserved keywords to use them as identifiers | -LL | fn r#macro() { //~ ERROR expected identifier, found reserved keyword `macro` +LL | fn r#macro() { | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr b/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr index 21c3d1771aad..f411ee8ce2cc 100644 --- a/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr +++ b/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr @@ -4,7 +4,7 @@ error: incorrect close delimiter: `)` LL | foo! { | - un-closed delimiter LL | bar, "baz", 1, 2.0 -LL | ) //~ ERROR incorrect close delimiter +LL | ) | ^ incorrect close delimiter error: aborting due to previous error diff --git a/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr b/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr index abb082097953..b68433936117 100644 --- a/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr +++ b/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr @@ -1,7 +1,7 @@ error: unexpected close delimiter: `}` --> $DIR/macro-mismatched-delim-paren-brace.rs:5:1 | -LL | } //~ ERROR unexpected close delimiter: `}` +LL | } | ^ unexpected close delimiter error: incorrect close delimiter: `}` @@ -10,7 +10,7 @@ error: incorrect close delimiter: `}` LL | foo! ( | - un-closed delimiter LL | bar, "baz", 1, 2.0 -LL | } //~ ERROR incorrect close delimiter +LL | } | ^ incorrect close delimiter error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/macro/issue-33569.stderr b/src/test/ui/parser/macro/issue-33569.stderr index 213d72363f59..8ba72fc88862 100644 --- a/src/test/ui/parser/macro/issue-33569.stderr +++ b/src/test/ui/parser/macro/issue-33569.stderr @@ -1,19 +1,19 @@ error: expected identifier, found `+` --> $DIR/issue-33569.rs:2:8 | -LL | { $+ } => { //~ ERROR expected identifier, found `+` +LL | { $+ } => { | ^ error: expected `*` or `+` --> $DIR/issue-33569.rs:4:13 | -LL | $(x)(y) //~ ERROR expected `*` or `+` +LL | $(x)(y) | ^^^ error: missing fragment specifier --> $DIR/issue-33569.rs:2:8 | -LL | { $+ } => { //~ ERROR expected identifier, found `+` +LL | { $+ } => { | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/macro/issue-37113.stderr b/src/test/ui/parser/macro/issue-37113.stderr index 36589667c4bc..7aadc0aa4b5c 100644 --- a/src/test/ui/parser/macro/issue-37113.stderr +++ b/src/test/ui/parser/macro/issue-37113.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `String` --> $DIR/issue-37113.rs:4:16 | -LL | $( $t, )* //~ ERROR expected identifier, found `String` +LL | $( $t, )* | ^^ expected identifier ... LL | test_macro!(String,); diff --git a/src/test/ui/parser/macro/issue-37234.stderr b/src/test/ui/parser/macro/issue-37234.stderr index dcc24fca5cc4..004de9d905f1 100644 --- a/src/test/ui/parser/macro/issue-37234.stderr +++ b/src/test/ui/parser/macro/issue-37234.stderr @@ -1,7 +1,7 @@ error: expected one of `.`, `;`, `?`, or an operator, found `""` --> $DIR/issue-37234.rs:3:19 | -LL | let x = 5 ""; //~ ERROR found `""` +LL | let x = 5 ""; | ^^ expected one of `.`, `;`, `?`, or an operator here ... LL | failed!(); diff --git a/src/test/ui/parser/macro/macro-incomplete-parse.stderr b/src/test/ui/parser/macro/macro-incomplete-parse.stderr index 3fcc8e08520d..b37bd583060c 100644 --- a/src/test/ui/parser/macro/macro-incomplete-parse.stderr +++ b/src/test/ui/parser/macro/macro-incomplete-parse.stderr @@ -1,7 +1,7 @@ error: macro expansion ignores token `,` and any following --> $DIR/macro-incomplete-parse.rs:7:9 | -LL | , //~ ERROR macro expansion ignores token `,` +LL | , | ^ ... LL | ignored_item!(); @@ -12,7 +12,7 @@ LL | ignored_item!(); error: expected one of `.`, `;`, `?`, `}`, or an operator, found `,` --> $DIR/macro-incomplete-parse.rs:12:14 | -LL | () => ( 1, //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `,` +LL | () => ( 1, | ^ expected one of `.`, `;`, `?`, `}`, or an operator here ... LL | ignored_expr!(); @@ -21,7 +21,7 @@ LL | ignored_expr!(); error: macro expansion ignores token `,` and any following --> $DIR/macro-incomplete-parse.rs:18:14 | -LL | () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,` +LL | () => ( 1, 2 ) | ^ ... LL | ignored_pat!() => (), diff --git a/src/test/ui/parser/macro/macro-repeat.stderr b/src/test/ui/parser/macro/macro-repeat.stderr index 310d60c8dbda..c86684de7443 100644 --- a/src/test/ui/parser/macro/macro-repeat.stderr +++ b/src/test/ui/parser/macro/macro-repeat.stderr @@ -1,7 +1,7 @@ error: variable 'v' is still repeating at this depth --> $DIR/macro-repeat.rs:3:9 | -LL | $v //~ ERROR still repeating at this depth +LL | $v | ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/macro/pub-item-macro.stderr b/src/test/ui/parser/macro/pub-item-macro.stderr index a624d574c456..fa25161ab50b 100644 --- a/src/test/ui/parser/macro/pub-item-macro.stderr +++ b/src/test/ui/parser/macro/pub-item-macro.stderr @@ -1,7 +1,7 @@ error: can't qualify macro invocation with `pub` --> $DIR/pub-item-macro.rs:8:5 | -LL | pub priv_x!(); //~ ERROR can't qualify macro invocation with `pub` +LL | pub priv_x!(); | ^^^ ... LL | pub_x!(); @@ -12,7 +12,7 @@ LL | pub_x!(); error[E0603]: static `x` is private --> $DIR/pub-item-macro.rs:17:23 | -LL | let y: u32 = foo::x; //~ ERROR static `x` is private +LL | let y: u32 = foo::x; | ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/macro/trait-object-macro-matcher.stderr b/src/test/ui/parser/macro/trait-object-macro-matcher.stderr index 185a9e718098..19c5c82f82cd 100644 --- a/src/test/ui/parser/macro/trait-object-macro-matcher.stderr +++ b/src/test/ui/parser/macro/trait-object-macro-matcher.stderr @@ -1,7 +1,7 @@ error: expected type, found `'static` --> $DIR/trait-object-macro-matcher.rs:9:8 | -LL | m!('static); //~ ERROR expected type, found `'static` +LL | m!('static); | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/macros-no-semicolon-items.stderr b/src/test/ui/parser/macros-no-semicolon-items.stderr index 84dd302b4a8e..a869a53c1eee 100644 --- a/src/test/ui/parser/macros-no-semicolon-items.stderr +++ b/src/test/ui/parser/macros-no-semicolon-items.stderr @@ -1,7 +1,7 @@ error: macros that expand to items must either be surrounded with braces or followed by a semicolon --> $DIR/macros-no-semicolon-items.rs:1:17 | -LL | macro_rules! foo() //~ ERROR semicolon +LL | macro_rules! foo() | ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/macros-no-semicolon.stderr b/src/test/ui/parser/macros-no-semicolon.stderr index 4f9e7fb5de85..09925eae51d2 100644 --- a/src/test/ui/parser/macros-no-semicolon.stderr +++ b/src/test/ui/parser/macros-no-semicolon.stderr @@ -3,7 +3,7 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `assert_eq` | LL | assert_eq!(1, 2) | - expected one of `.`, `;`, `?`, `}`, or an operator here -LL | assert_eq!(3, 4) //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `assert_eq` +LL | assert_eq!(3, 4) | ^^^^^^^^^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/match-arrows-block-then-binop.stderr b/src/test/ui/parser/match-arrows-block-then-binop.stderr index 2782af49e66b..a844cac189aa 100644 --- a/src/test/ui/parser/match-arrows-block-then-binop.stderr +++ b/src/test/ui/parser/match-arrows-block-then-binop.stderr @@ -1,7 +1,7 @@ error: expected pattern, found `+` --> $DIR/match-arrows-block-then-binop.rs:5:9 | -LL | } + 5 //~ ERROR expected pattern, found `+` +LL | } + 5 | ^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/match-refactor-to-expr.stderr b/src/test/ui/parser/match-refactor-to-expr.stderr index 692b116123a6..bf20bc935002 100644 --- a/src/test/ui/parser/match-refactor-to-expr.stderr +++ b/src/test/ui/parser/match-refactor-to-expr.stderr @@ -1,15 +1,15 @@ error: expected one of `.`, `?`, `{`, or an operator, found `;` --> $DIR/match-refactor-to-expr.rs:6:9 | -LL | match //~ NOTE while parsing this match expression +LL | match | ----- | | | while parsing this match expression | help: try removing this `match` LL | Some(4).unwrap_or_else(5) | - expected one of `.`, `?`, `{`, or an operator here -LL | //~^ NOTE expected one of `.`, `?`, `{`, or an operator here -LL | ; //~ NOTE unexpected token +LL | +LL | ; | ^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/match-vec-invalid.stderr b/src/test/ui/parser/match-vec-invalid.stderr index 5a5fc9c45098..fee8d248dcf0 100644 --- a/src/test/ui/parser/match-vec-invalid.stderr +++ b/src/test/ui/parser/match-vec-invalid.stderr @@ -1,7 +1,7 @@ error: expected one of `,` or `@`, found `..` --> $DIR/match-vec-invalid.rs:4:25 | -LL | [1, tail.., tail..] => {}, //~ ERROR: expected one of `,` or `@`, found `..` +LL | [1, tail.., tail..] => {}, | ^^ expected one of `,` or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/mod_file_not_exist_windows.stderr b/src/test/ui/parser/mod_file_not_exist_windows.stderr index 67abd6304d51..60ae00abab1e 100644 --- a/src/test/ui/parser/mod_file_not_exist_windows.stderr +++ b/src/test/ui/parser/mod_file_not_exist_windows.stderr @@ -1,7 +1,7 @@ error[E0583]: file not found for module `not_a_real_file` --> $DIR/mod_file_not_exist_windows.rs:3:5 | -LL | mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file` +LL | mod not_a_real_file; | ^^^^^^^^^^^^^^^ | = help: name the file either not_a_real_file.rs or not_a_real_file/mod.rs inside the directory "$DIR" diff --git a/src/test/ui/parser/mod_file_with_path_attr.stderr b/src/test/ui/parser/mod_file_with_path_attr.stderr index a3a3486dd9e3..004b5d7963a1 100644 --- a/src/test/ui/parser/mod_file_with_path_attr.stderr +++ b/src/test/ui/parser/mod_file_with_path_attr.stderr @@ -1,7 +1,7 @@ error: couldn't read $DIR/not_a_real_file.rs: $FILE_NOT_FOUND_MSG (os error 2) --> $DIR/mod_file_with_path_attr.rs:4:5 | -LL | mod m; //~ ERROR not_a_real_file.rs +LL | mod m; | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/multiline-comment-line-tracking.stderr b/src/test/ui/parser/multiline-comment-line-tracking.stderr index c9404d8b9e4d..cac0c801a599 100644 --- a/src/test/ui/parser/multiline-comment-line-tracking.stderr +++ b/src/test/ui/parser/multiline-comment-line-tracking.stderr @@ -1,7 +1,7 @@ error: expected expression, found `%` --> $DIR/multiline-comment-line-tracking.rs:8:3 | -LL | %; //~ ERROR expected expression, found `%` +LL | %; | ^ expected expression error: aborting due to previous error diff --git a/src/test/ui/parser/mut-patterns.stderr b/src/test/ui/parser/mut-patterns.stderr index 5bbb4ce569f0..286956440ec3 100644 --- a/src/test/ui/parser/mut-patterns.stderr +++ b/src/test/ui/parser/mut-patterns.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, `=`, or `@`, found `{` --> $DIR/mut-patterns.rs:5:17 | -LL | let mut Foo { x: x } = Foo { x: 3 }; //~ ERROR: expected one of `:`, `;`, `=`, or `@`, found `{` +LL | let mut Foo { x: x } = Foo { x: 3 }; | ^ expected one of `:`, `;`, `=`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/new-unicode-escapes-1.stderr b/src/test/ui/parser/new-unicode-escapes-1.stderr index 828e72e56eac..5a191735307a 100644 --- a/src/test/ui/parser/new-unicode-escapes-1.stderr +++ b/src/test/ui/parser/new-unicode-escapes-1.stderr @@ -1,7 +1,7 @@ error: unterminated unicode escape (needed a `}`) --> $DIR/new-unicode-escapes-1.rs:2:21 | -LL | let s = "/u{2603"; //~ ERROR unterminated unicode escape (needed a `}`) +LL | let s = "/u{2603"; | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/new-unicode-escapes-2.stderr b/src/test/ui/parser/new-unicode-escapes-2.stderr index 97ba3fb2cb66..0fb8befa45b0 100644 --- a/src/test/ui/parser/new-unicode-escapes-2.stderr +++ b/src/test/ui/parser/new-unicode-escapes-2.stderr @@ -1,7 +1,7 @@ error: overlong unicode escape (must have at most 6 hex digits) --> $DIR/new-unicode-escapes-2.rs:2:17 | -LL | let s = "/u{260311111111}"; //~ ERROR overlong unicode escape (must have at most 6 hex digits) +LL | let s = "/u{260311111111}"; | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/new-unicode-escapes-3.stderr b/src/test/ui/parser/new-unicode-escapes-3.stderr index 038002ae05e5..427426788f6f 100644 --- a/src/test/ui/parser/new-unicode-escapes-3.stderr +++ b/src/test/ui/parser/new-unicode-escapes-3.stderr @@ -1,7 +1,7 @@ error: invalid unicode character escape --> $DIR/new-unicode-escapes-3.rs:2:14 | -LL | let s1 = "/u{d805}"; //~ ERROR invalid unicode character escape +LL | let s1 = "/u{d805}"; | ^^^^^^^^^^ | = help: unicode escape must not be a surrogate @@ -9,7 +9,7 @@ LL | let s1 = "/u{d805}"; //~ ERROR invalid unicode character escape error: invalid unicode character escape --> $DIR/new-unicode-escapes-3.rs:3:14 | -LL | let s2 = "/u{ffffff}"; //~ ERROR invalid unicode character escape +LL | let s2 = "/u{ffffff}"; | ^^^^^^^^^^^^ | = help: unicode escape must be at most 10FFFF diff --git a/src/test/ui/parser/no-unsafe-self.stderr b/src/test/ui/parser/no-unsafe-self.stderr index 84779b09dc7c..96d8b56bf9ac 100644 --- a/src/test/ui/parser/no-unsafe-self.stderr +++ b/src/test/ui/parser/no-unsafe-self.stderr @@ -1,37 +1,37 @@ error: cannot pass `self` by raw pointer --> $DIR/no-unsafe-self.rs:4:17 | -LL | fn foo(*mut self); //~ ERROR cannot pass `self` by raw pointer +LL | fn foo(*mut self); | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer --> $DIR/no-unsafe-self.rs:5:19 | -LL | fn baz(*const self); //~ ERROR cannot pass `self` by raw pointer +LL | fn baz(*const self); | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer --> $DIR/no-unsafe-self.rs:6:13 | -LL | fn bar(*self); //~ ERROR cannot pass `self` by raw pointer +LL | fn bar(*self); | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer --> $DIR/no-unsafe-self.rs:11:17 | -LL | fn foo(*mut self) { } //~ ERROR cannot pass `self` by raw pointer +LL | fn foo(*mut self) { } | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer --> $DIR/no-unsafe-self.rs:12:19 | -LL | fn baz(*const self) { } //~ ERROR cannot pass `self` by raw pointer +LL | fn baz(*const self) { } | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer --> $DIR/no-unsafe-self.rs:13:13 | -LL | fn bar(*self) { } //~ ERROR cannot pass `self` by raw pointer +LL | fn bar(*self) { } | ^^^^ cannot pass `self` by raw pointer error: aborting due to 6 previous errors diff --git a/src/test/ui/parser/omitted-arg-in-item-fn.stderr b/src/test/ui/parser/omitted-arg-in-item-fn.stderr index b21a1bd08315..4f2a76d2d256 100644 --- a/src/test/ui/parser/omitted-arg-in-item-fn.stderr +++ b/src/test/ui/parser/omitted-arg-in-item-fn.stderr @@ -1,7 +1,7 @@ error: expected one of `:` or `@`, found `)` --> $DIR/omitted-arg-in-item-fn.rs:1:9 | -LL | fn foo(x) { //~ ERROR expected one of `:` or `@`, found `)` +LL | fn foo(x) { | ^ expected one of `:` or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/paamayim-nekudotayim.stderr b/src/test/ui/parser/paamayim-nekudotayim.stderr index 6423aa2dc2fd..6ceba07f4691 100644 --- a/src/test/ui/parser/paamayim-nekudotayim.stderr +++ b/src/test/ui/parser/paamayim-nekudotayim.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `;` --> $DIR/paamayim-nekudotayim.rs:4:7 | -LL | ::; //~ ERROR expected identifier, found `;` +LL | ::; | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/parser/pat-lt-bracket-4.stderr b/src/test/ui/parser/pat-lt-bracket-4.stderr index 18e0e9e8f0c4..d14702acee6e 100644 --- a/src/test/ui/parser/pat-lt-bracket-4.stderr +++ b/src/test/ui/parser/pat-lt-bracket-4.stderr @@ -1,7 +1,7 @@ error: expected one of `=>`, `@`, `if`, or `|`, found `<` --> $DIR/pat-lt-bracket-4.rs:8:12 | -LL | Foo::A(value) => value, //~ error: expected one of `=>`, `@`, `if`, or `|`, found `<` +LL | Foo::A(value) => value, | ^ expected one of `=>`, `@`, `if`, or `|` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-lt-bracket-5.stderr b/src/test/ui/parser/pat-lt-bracket-5.stderr index 7e76a04ce6f5..ce4cc05db19b 100644 --- a/src/test/ui/parser/pat-lt-bracket-5.stderr +++ b/src/test/ui/parser/pat-lt-bracket-5.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, `=`, or `@`, found `[` --> $DIR/pat-lt-bracket-5.rs:2:10 | -LL | let v[0] = v[1]; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `[` +LL | let v[0] = v[1]; | ^ expected one of `:`, `;`, `=`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-lt-bracket-6.stderr b/src/test/ui/parser/pat-lt-bracket-6.stderr index bf5b61907614..2ee4bdb20fe8 100644 --- a/src/test/ui/parser/pat-lt-bracket-6.stderr +++ b/src/test/ui/parser/pat-lt-bracket-6.stderr @@ -1,7 +1,7 @@ error: expected one of `)`, `,`, or `@`, found `[` --> $DIR/pat-lt-bracket-6.rs:2:19 | -LL | let Test(&desc[..]) = x; //~ ERROR: expected one of `)`, `,`, or `@`, found `[` +LL | let Test(&desc[..]) = x; | ^ expected one of `)`, `,`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-lt-bracket-7.stderr b/src/test/ui/parser/pat-lt-bracket-7.stderr index 44394c300215..5552ea46d9b9 100644 --- a/src/test/ui/parser/pat-lt-bracket-7.stderr +++ b/src/test/ui/parser/pat-lt-bracket-7.stderr @@ -1,7 +1,7 @@ error: expected one of `)`, `,`, or `@`, found `[` --> $DIR/pat-lt-bracket-7.rs:2:16 | -LL | for thing(x[]) in foo {} //~ ERROR: expected one of `)`, `,`, or `@`, found `[` +LL | for thing(x[]) in foo {} | ^ expected one of `)`, `,`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-ranges-1.stderr b/src/test/ui/parser/pat-ranges-1.stderr index 378caf630005..6e0deccab8ca 100644 --- a/src/test/ui/parser/pat-ranges-1.stderr +++ b/src/test/ui/parser/pat-ranges-1.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, or `=`, found `..=` --> $DIR/pat-ranges-1.rs:4:21 | -LL | let macropus!() ..= 11 = 12; //~ error: expected one of `:`, `;`, or `=`, found `..=` +LL | let macropus!() ..= 11 = 12; | ^^^ expected one of `:`, `;`, or `=` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-ranges-2.stderr b/src/test/ui/parser/pat-ranges-2.stderr index ef8b4f94ef49..d180bb429110 100644 --- a/src/test/ui/parser/pat-ranges-2.stderr +++ b/src/test/ui/parser/pat-ranges-2.stderr @@ -1,7 +1,7 @@ error: expected one of `::`, `:`, `;`, or `=`, found `!` --> $DIR/pat-ranges-2.rs:4:26 | -LL | let 10 ..= makropulos!() = 12; //~ error: expected one of `::`, `:`, `;`, or `=`, found `!` +LL | let 10 ..= makropulos!() = 12; | ^ expected one of `::`, `:`, `;`, or `=` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-ranges-3.stderr b/src/test/ui/parser/pat-ranges-3.stderr index f923228710bf..aaa85e3c2ddd 100644 --- a/src/test/ui/parser/pat-ranges-3.stderr +++ b/src/test/ui/parser/pat-ranges-3.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, or `=`, found `+` --> $DIR/pat-ranges-3.rs:4:19 | -LL | let 10 ..= 10 + 3 = 12; //~ expected one of `:`, `;`, or `=`, found `+` +LL | let 10 ..= 10 + 3 = 12; | ^ expected one of `:`, `;`, or `=` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-ref-enum.stderr b/src/test/ui/parser/pat-ref-enum.stderr index 8729e8c5854f..a3bce3372646 100644 --- a/src/test/ui/parser/pat-ref-enum.stderr +++ b/src/test/ui/parser/pat-ref-enum.stderr @@ -1,7 +1,7 @@ error: expected identifier, found enum pattern --> $DIR/pat-ref-enum.rs:3:11 | -LL | ref Some(i) => {} //~ ERROR expected identifier, found enum pattern +LL | ref Some(i) => {} | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/pat-tuple-1.stderr b/src/test/ui/parser/pat-tuple-1.stderr index 33c69deda42c..391f2c428bf2 100644 --- a/src/test/ui/parser/pat-tuple-1.stderr +++ b/src/test/ui/parser/pat-tuple-1.stderr @@ -1,7 +1,7 @@ error: expected pattern, found `,` --> $DIR/pat-tuple-1.rs:3:10 | -LL | (, ..) => {} //~ ERROR expected pattern, found `,` +LL | (, ..) => {} | ^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/pat-tuple-4.stderr b/src/test/ui/parser/pat-tuple-4.stderr index fe4b4deaa60d..26b92fae3139 100644 --- a/src/test/ui/parser/pat-tuple-4.stderr +++ b/src/test/ui/parser/pat-tuple-4.stderr @@ -1,7 +1,7 @@ error: expected one of `)` or `,`, found `pat` --> $DIR/pat-tuple-4.rs:3:13 | -LL | (.. pat) => {} //~ ERROR expected one of `)` or `,`, found `pat` +LL | (.. pat) => {} | ^^^ expected one of `)` or `,` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-tuple-5.stderr b/src/test/ui/parser/pat-tuple-5.stderr index 2ca10f697604..61ae40b355d3 100644 --- a/src/test/ui/parser/pat-tuple-5.stderr +++ b/src/test/ui/parser/pat-tuple-5.stderr @@ -1,7 +1,7 @@ error: unexpected token: `)` --> $DIR/pat-tuple-5.rs:3:14 | -LL | (pat ..) => {} //~ ERROR unexpected token: `)` +LL | (pat ..) => {} | ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/pub-method-macro.stderr b/src/test/ui/parser/pub-method-macro.stderr index 2b4920a792f0..7b0fe4934610 100644 --- a/src/test/ui/parser/pub-method-macro.stderr +++ b/src/test/ui/parser/pub-method-macro.stderr @@ -1,7 +1,7 @@ error: can't qualify macro invocation with `pub` --> $DIR/pub-method-macro.rs:17:9 | -LL | pub defn!(f); //~ ERROR can't qualify macro invocation with `pub` +LL | pub defn!(f); | ^^^ | = help: try adjusting the macro to put `pub` inside the invocation diff --git a/src/test/ui/parser/range_inclusive.stderr b/src/test/ui/parser/range_inclusive.stderr index f50b2fa49fb0..12b7edae79f5 100644 --- a/src/test/ui/parser/range_inclusive.stderr +++ b/src/test/ui/parser/range_inclusive.stderr @@ -1,7 +1,7 @@ error[E0586]: inclusive range with no end --> $DIR/range_inclusive.rs:4:19 | -LL | for _ in 1..= {} //~ERROR inclusive range with no end +LL | for _ in 1..= {} | ^ | = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) diff --git a/src/test/ui/parser/range_inclusive_dotdotdot.stderr b/src/test/ui/parser/range_inclusive_dotdotdot.stderr index 9fad20848a63..21ad26d8d255 100644 --- a/src/test/ui/parser/range_inclusive_dotdotdot.stderr +++ b/src/test/ui/parser/range_inclusive_dotdotdot.stderr @@ -1,57 +1,57 @@ error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:8:12 | -LL | return ...1; //~ERROR unexpected token: `...` +LL | return ...1; | ^^^ help: use `..` for an exclusive range | -LL | return ..1; //~ERROR unexpected token: `...` +LL | return ..1; | ^^ help: or `..=` for an inclusive range | -LL | return ..=1; //~ERROR unexpected token: `...` +LL | return ..=1; | ^^^ error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:14:13 | -LL | let x = ...0; //~ERROR unexpected token: `...` +LL | let x = ...0; | ^^^ help: use `..` for an exclusive range | -LL | let x = ..0; //~ERROR unexpected token: `...` +LL | let x = ..0; | ^^ help: or `..=` for an inclusive range | -LL | let x = ..=0; //~ERROR unexpected token: `...` +LL | let x = ..=0; | ^^^ error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:18:14 | -LL | let x = 5...5; //~ERROR unexpected token: `...` +LL | let x = 5...5; | ^^^ help: use `..` for an exclusive range | -LL | let x = 5..5; //~ERROR unexpected token: `...` +LL | let x = 5..5; | ^^ help: or `..=` for an inclusive range | -LL | let x = 5..=5; //~ERROR unexpected token: `...` +LL | let x = 5..=5; | ^^^ error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:22:15 | -LL | for _ in 0...1 {} //~ERROR unexpected token: `...` +LL | for _ in 0...1 {} | ^^^ help: use `..` for an exclusive range | -LL | for _ in 0..1 {} //~ERROR unexpected token: `...` +LL | for _ in 0..1 {} | ^^ help: or `..=` for an inclusive range | -LL | for _ in 0..=1 {} //~ERROR unexpected token: `...` +LL | for _ in 0..=1 {} | ^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/raw-byte-string-eof.stderr b/src/test/ui/parser/raw-byte-string-eof.stderr index 071cd6241da2..2ba50e8fb2a3 100644 --- a/src/test/ui/parser/raw-byte-string-eof.stderr +++ b/src/test/ui/parser/raw-byte-string-eof.stderr @@ -1,7 +1,7 @@ error: unterminated raw string --> $DIR/raw-byte-string-eof.rs:2:6 | -LL | br##"a"#; //~ unterminated raw string +LL | br##"a"#; | ^ unterminated raw string | = note: this raw string should be terminated with `"##` diff --git a/src/test/ui/parser/raw-byte-string-literals.stderr b/src/test/ui/parser/raw-byte-string-literals.stderr index 1131e0015bb5..5670ed6590a1 100644 --- a/src/test/ui/parser/raw-byte-string-literals.stderr +++ b/src/test/ui/parser/raw-byte-string-literals.stderr @@ -1,13 +1,13 @@ error: raw byte string must be ASCII: /u{e9} --> $DIR/raw-byte-string-literals.rs:5:8 | -LL | br"é"; //~ ERROR raw byte string must be ASCII +LL | br"é"; | ^ error: found invalid character; only `#` is allowed in raw string delimitation: ~ --> $DIR/raw-byte-string-literals.rs:6:6 | -LL | br##~"a"~##; //~ ERROR only `#` is allowed in raw string delimitation +LL | br##~"a"~##; | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/raw-str-delim.stderr b/src/test/ui/parser/raw-str-delim.stderr index 47fd331969df..b86b9e90e73a 100644 --- a/src/test/ui/parser/raw-str-delim.stderr +++ b/src/test/ui/parser/raw-str-delim.stderr @@ -1,7 +1,7 @@ error: found invalid character; only `#` is allowed in raw string delimitation: ~ --> $DIR/raw-str-delim.rs:2:5 | -LL | r#~"#"~# //~ ERROR found invalid character; only `#` is allowed in raw string delimitation +LL | r#~"#"~# | ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/raw-str-unbalanced.stderr b/src/test/ui/parser/raw-str-unbalanced.stderr index 6dedcfb6a0aa..26910ff64f57 100644 --- a/src/test/ui/parser/raw-str-unbalanced.stderr +++ b/src/test/ui/parser/raw-str-unbalanced.stderr @@ -1,7 +1,7 @@ error: expected one of `.`, `;`, `?`, or an operator, found `#` --> $DIR/raw-str-unbalanced.rs:3:9 | -LL | "## //~ ERROR expected one of `.`, `;`, `?`, or an operator, found `#` +LL | "## | ^ expected one of `.`, `;`, `?`, or an operator here error: aborting due to previous error diff --git a/src/test/ui/parser/raw/raw-literal-keywords.stderr b/src/test/ui/parser/raw/raw-literal-keywords.stderr index 8465b6a6e849..8b8b71373b50 100644 --- a/src/test/ui/parser/raw/raw-literal-keywords.stderr +++ b/src/test/ui/parser/raw/raw-literal-keywords.stderr @@ -1,37 +1,37 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `true` --> $DIR/raw-literal-keywords.rs:2:10 | -LL | r#if true { } //~ ERROR found `true` +LL | r#if true { } | ^^^^ expected one of 8 possible tokens here error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test` --> $DIR/raw-literal-keywords.rs:7:14 | -LL | r#struct Test; //~ ERROR found `Test` +LL | r#struct Test; | ^^^^ expected one of 8 possible tokens here error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test` --> $DIR/raw-literal-keywords.rs:12:13 | -LL | r#union Test; //~ ERROR found `Test` +LL | r#union Test; | ^^^^ expected one of 8 possible tokens here error[E0425]: cannot find value `if` in this scope --> $DIR/raw-literal-keywords.rs:2:5 | -LL | r#if true { } //~ ERROR found `true` +LL | r#if true { } | ^^^^ not found in this scope error[E0425]: cannot find value `struct` in this scope --> $DIR/raw-literal-keywords.rs:7:5 | -LL | r#struct Test; //~ ERROR found `Test` +LL | r#struct Test; | ^^^^^^^^ not found in this scope error[E0425]: cannot find value `union` in this scope --> $DIR/raw-literal-keywords.rs:12:5 | -LL | r#union Test; //~ ERROR found `Test` +LL | r#union Test; | ^^^^^^^ not found in this scope error: aborting due to 6 previous errors diff --git a/src/test/ui/parser/recover-enum.stderr b/src/test/ui/parser/recover-enum.stderr index 81e292939b02..8c3448d6fbe4 100644 --- a/src/test/ui/parser/recover-enum.stderr +++ b/src/test/ui/parser/recover-enum.stderr @@ -3,7 +3,7 @@ error: expected one of `(`, `,`, `=`, `{`, or `}`, found `Bad` | LL | Very | - expected one of `(`, `,`, `=`, `{`, or `}` here -LL | Bad //~ ERROR found `Bad` +LL | Bad | ^^^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/recover-enum2.stderr b/src/test/ui/parser/recover-enum2.stderr index 315bfde77c73..d1984a54e2f0 100644 --- a/src/test/ui/parser/recover-enum2.stderr +++ b/src/test/ui/parser/recover-enum2.stderr @@ -1,13 +1,13 @@ error: expected type, found `{` --> $DIR/recover-enum2.rs:8:18 | -LL | abc: {}, //~ ERROR: expected type, found `{` +LL | abc: {}, | ^ error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `{` --> $DIR/recover-enum2.rs:27:22 | -LL | Nope(i32 {}) //~ ERROR: found `{` +LL | Nope(i32 {}) | ^ expected one of 7 possible tokens here error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/recover-struct.stderr b/src/test/ui/parser/recover-struct.stderr index edb3cb95cab2..8e11d6b29a58 100644 --- a/src/test/ui/parser/recover-struct.stderr +++ b/src/test/ui/parser/recover-struct.stderr @@ -3,7 +3,7 @@ error: expected `:`, found `Bad` | LL | Very | - expected `:` -LL | Bad //~ ERROR found `Bad` +LL | Bad | ^^^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/regions-out-of-scope-slice.stderr b/src/test/ui/parser/regions-out-of-scope-slice.stderr index cd56dfa6aeb7..8d9bf0b7a044 100644 --- a/src/test/ui/parser/regions-out-of-scope-slice.stderr +++ b/src/test/ui/parser/regions-out-of-scope-slice.stderr @@ -1,7 +1,7 @@ error: expected `:`, found `[` --> $DIR/regions-out-of-scope-slice.rs:7:19 | -LL | x = &'blk [1,2,3]; //~ ERROR expected `:`, found `[` +LL | x = &'blk [1,2,3]; | ^ expected `:` error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-enum-newtype.stderr b/src/test/ui/parser/removed-syntax-enum-newtype.stderr index 4c710dec5ba3..a6d0ff4eaf2a 100644 --- a/src/test/ui/parser/removed-syntax-enum-newtype.stderr +++ b/src/test/ui/parser/removed-syntax-enum-newtype.stderr @@ -1,7 +1,7 @@ error: expected one of `<`, `where`, or `{`, found `=` --> $DIR/removed-syntax-enum-newtype.rs:1:8 | -LL | enum e = isize; //~ ERROR expected one of `<`, `where`, or `{`, found `=` +LL | enum e = isize; | ^ expected one of `<`, `where`, or `{` here error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-fixed-vec.stderr b/src/test/ui/parser/removed-syntax-fixed-vec.stderr index 318591e5cc0a..ca6969d1e873 100644 --- a/src/test/ui/parser/removed-syntax-fixed-vec.stderr +++ b/src/test/ui/parser/removed-syntax-fixed-vec.stderr @@ -1,7 +1,7 @@ error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `*` --> $DIR/removed-syntax-fixed-vec.rs:1:17 | -LL | type v = [isize * 3]; //~ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `*` +LL | type v = [isize * 3]; | ^ expected one of 7 possible tokens here error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-fn-sigil.stderr b/src/test/ui/parser/removed-syntax-fn-sigil.stderr index 9303a67a8cc7..196a5af47293 100644 --- a/src/test/ui/parser/removed-syntax-fn-sigil.stderr +++ b/src/test/ui/parser/removed-syntax-fn-sigil.stderr @@ -1,7 +1,7 @@ error: expected `(`, found `~` --> $DIR/removed-syntax-fn-sigil.rs:2:14 | -LL | let x: fn~() = || (); //~ ERROR expected `(`, found `~` +LL | let x: fn~() = || (); | - ^ expected `(` | | | while parsing the type for `x` diff --git a/src/test/ui/parser/removed-syntax-mut-vec-expr.stderr b/src/test/ui/parser/removed-syntax-mut-vec-expr.stderr index 8164645b01b7..313420fb9a4f 100644 --- a/src/test/ui/parser/removed-syntax-mut-vec-expr.stderr +++ b/src/test/ui/parser/removed-syntax-mut-vec-expr.stderr @@ -1,7 +1,7 @@ error: expected expression, found keyword `mut` --> $DIR/removed-syntax-mut-vec-expr.rs:2:14 | -LL | let v = [mut 1, 2, 3, 4]; //~ ERROR expected expression, found keyword `mut` +LL | let v = [mut 1, 2, 3, 4]; | ^^^ expected expression error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-mut-vec-ty.stderr b/src/test/ui/parser/removed-syntax-mut-vec-ty.stderr index f0eafa3d00a6..a759716b5a96 100644 --- a/src/test/ui/parser/removed-syntax-mut-vec-ty.stderr +++ b/src/test/ui/parser/removed-syntax-mut-vec-ty.stderr @@ -1,7 +1,7 @@ error: expected type, found keyword `mut` --> $DIR/removed-syntax-mut-vec-ty.rs:1:11 | -LL | type v = [mut isize]; //~ ERROR expected type, found keyword `mut` +LL | type v = [mut isize]; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr b/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr index 689ed35668ec..7beef9883bd7 100644 --- a/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr +++ b/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr @@ -1,7 +1,7 @@ error: expected one of `!`, `(`, `::`, `;`, or `<`, found `/` --> $DIR/removed-syntax-ptr-lifetime.rs:1:22 | -LL | type bptr = &lifetime/isize; //~ ERROR expected one of `!`, `(`, `::`, `;`, or `<`, found `/` +LL | type bptr = &lifetime/isize; | ^ expected one of `!`, `(`, `::`, `;`, or `<` here error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-record.stderr b/src/test/ui/parser/removed-syntax-record.stderr index f9b98596ae39..730d5e2712b9 100644 --- a/src/test/ui/parser/removed-syntax-record.stderr +++ b/src/test/ui/parser/removed-syntax-record.stderr @@ -1,7 +1,7 @@ error: expected type, found `{` --> $DIR/removed-syntax-record.rs:1:10 | -LL | type t = { f: () }; //~ ERROR expected type, found `{` +LL | type t = { f: () }; | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-uniq-mut-expr.stderr b/src/test/ui/parser/removed-syntax-uniq-mut-expr.stderr index 90d0764def0b..63d2fdb8cd4a 100644 --- a/src/test/ui/parser/removed-syntax-uniq-mut-expr.stderr +++ b/src/test/ui/parser/removed-syntax-uniq-mut-expr.stderr @@ -1,7 +1,7 @@ error: expected expression, found keyword `mut` --> $DIR/removed-syntax-uniq-mut-expr.rs:2:21 | -LL | let a_box = box mut 42; //~ ERROR expected expression, found keyword `mut` +LL | let a_box = box mut 42; | ^^^ expected expression error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr b/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr index b2759778d031..b6c5749c031e 100644 --- a/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr +++ b/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr @@ -1,7 +1,7 @@ error: expected one of `>`, const, lifetime, or type, found `mut` --> $DIR/removed-syntax-uniq-mut-ty.rs:1:20 | -LL | type mut_box = Box; //~ ERROR expected one of `>`, const, lifetime, or type, found `mut` +LL | type mut_box = Box; | ^^^ expected one of `>`, const, lifetime, or type here error: aborting due to previous error diff --git a/src/test/ui/parser/struct-literal-in-for.stderr b/src/test/ui/parser/struct-literal-in-for.stderr index 38a5e22e3f7b..b319c64f406f 100644 --- a/src/test/ui/parser/struct-literal-in-for.stderr +++ b/src/test/ui/parser/struct-literal-in-for.stderr @@ -1,19 +1,19 @@ error: expected type, found `3` --> $DIR/struct-literal-in-for.rs:13:12 | -LL | x: 3 //~ ERROR expected type, found `3` +LL | x: 3 | ^ expecting a type here because of type ascription error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` --> $DIR/struct-literal-in-for.rs:14:12 | -LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` +LL | }.hi() { | ^ expected one of `.`, `;`, `?`, `}`, or an operator here error[E0423]: expected value, found struct `Foo` --> $DIR/struct-literal-in-for.rs:12:14 | -LL | for x in Foo { //~ ERROR expected value, found struct `Foo` +LL | for x in Foo { | ^^^ did you mean `(Foo { /* fields */ })`? error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/struct-literal-in-if.stderr b/src/test/ui/parser/struct-literal-in-if.stderr index 49b9a52aff91..27672eeda830 100644 --- a/src/test/ui/parser/struct-literal-in-if.stderr +++ b/src/test/ui/parser/struct-literal-in-if.stderr @@ -1,19 +1,19 @@ error: expected type, found `3` --> $DIR/struct-literal-in-if.rs:13:12 | -LL | x: 3 //~ ERROR expected type, found `3` +LL | x: 3 | ^ expecting a type here because of type ascription error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` --> $DIR/struct-literal-in-if.rs:14:12 | -LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` +LL | }.hi() { | ^ expected one of `.`, `;`, `?`, `}`, or an operator here error[E0423]: expected value, found struct `Foo` --> $DIR/struct-literal-in-if.rs:12:8 | -LL | if Foo { //~ ERROR expected value, found struct `Foo` +LL | if Foo { | ^^^ did you mean `(Foo { /* fields */ })`? error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/struct-literal-in-match-discriminant.stderr b/src/test/ui/parser/struct-literal-in-match-discriminant.stderr index 64ddde0e9e97..94a758eb5268 100644 --- a/src/test/ui/parser/struct-literal-in-match-discriminant.stderr +++ b/src/test/ui/parser/struct-literal-in-match-discriminant.stderr @@ -1,25 +1,25 @@ error: expected one of `=>`, `@`, `if`, or `|`, found `:` --> $DIR/struct-literal-in-match-discriminant.rs:7:10 | -LL | x: 3 //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `:` +LL | x: 3 | ^ expected one of `=>`, `@`, `if`, or `|` here error: expected one of `.`, `;`, `?`, `}`, or an operator, found `=>` --> $DIR/struct-literal-in-match-discriminant.rs:11:11 | -LL | } => {} //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `=>` +LL | } => {} | ^^ expected one of `.`, `;`, `?`, `}`, or an operator here error[E0423]: expected value, found struct `Foo` --> $DIR/struct-literal-in-match-discriminant.rs:6:11 | -LL | match Foo { //~ ERROR expected value, found struct `Foo` +LL | match Foo { | ^^^ did you mean `(Foo { /* fields */ })`? error[E0425]: cannot find value `x` in this scope --> $DIR/struct-literal-in-match-discriminant.rs:10:16 | -LL | x: x //~ ERROR cannot find value `x` in this scope +LL | x: x | ^ not found in this scope error[E0308]: mismatched types @@ -28,9 +28,9 @@ error[E0308]: mismatched types LL | fn main() { | - expected `()` because of default return type ... -LL | / Foo { //~ ERROR mismatched types -LL | | x: x //~ ERROR cannot find value `x` in this scope -LL | | } => {} //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `=>` +LL | / Foo { +LL | | x: x +LL | | } => {} | |_________^ expected (), found struct `Foo` | = note: expected type `()` diff --git a/src/test/ui/parser/struct-literal-in-while.stderr b/src/test/ui/parser/struct-literal-in-while.stderr index 9a6ab81e7c02..8a130f441a3e 100644 --- a/src/test/ui/parser/struct-literal-in-while.stderr +++ b/src/test/ui/parser/struct-literal-in-while.stderr @@ -1,25 +1,25 @@ error: expected type, found `3` --> $DIR/struct-literal-in-while.rs:13:12 | -LL | x: 3 //~ ERROR expected type, found `3` +LL | x: 3 | ^ expecting a type here because of type ascription error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` --> $DIR/struct-literal-in-while.rs:14:12 | -LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` +LL | }.hi() { | ^ expected one of `.`, `;`, `?`, `}`, or an operator here error[E0423]: expected value, found struct `Foo` --> $DIR/struct-literal-in-while.rs:12:11 | -LL | while Foo { //~ ERROR expected value, found struct `Foo` +LL | while Foo { | ^^^ did you mean `(Foo { /* fields */ })`? error[E0599]: no method named `hi` found for type `()` in the current scope --> $DIR/struct-literal-in-while.rs:14:7 | -LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` +LL | }.hi() { | ^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr b/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr index 2303df93810c..3505d00b64b7 100644 --- a/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr +++ b/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr @@ -1,25 +1,25 @@ error: expected type, found `3` --> $DIR/struct-literal-restrictions-in-lamda.rs:13:12 | -LL | x: 3 //~ ERROR expected type, found `3` +LL | x: 3 | ^ expecting a type here because of type ascription error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` --> $DIR/struct-literal-restrictions-in-lamda.rs:14:12 | -LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` +LL | }.hi() { | ^ expected one of `.`, `;`, `?`, `}`, or an operator here error[E0423]: expected value, found struct `Foo` --> $DIR/struct-literal-restrictions-in-lamda.rs:12:14 | -LL | while || Foo { //~ ERROR expected value, found struct `Foo` +LL | while || Foo { | ^^^ did you mean `(Foo { /* fields */ })`? error[E0599]: no method named `hi` found for type `()` in the current scope --> $DIR/struct-literal-restrictions-in-lamda.rs:14:7 | -LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` +LL | }.hi() { | ^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/tag-variant-disr-non-nullary.stderr b/src/test/ui/parser/tag-variant-disr-non-nullary.stderr index cc6312b45455..884e9672cb12 100644 --- a/src/test/ui/parser/tag-variant-disr-non-nullary.stderr +++ b/src/test/ui/parser/tag-variant-disr-non-nullary.stderr @@ -3,7 +3,7 @@ error: discriminator values can only be used with a field-less enum | LL | Red = 0xff0000, | ^^^^^^^^ only valid in field-less enums -LL | //~^ ERROR discriminator values can only be used with a field-less enum +LL | LL | Green = 0x00ff00, | ^^^^^^^^ only valid in field-less enums LL | Blue = 0x0000ff, diff --git a/src/test/ui/parser/trait-bounds-not-on-impl.stderr b/src/test/ui/parser/trait-bounds-not-on-impl.stderr index 3c0346c96b28..a712f68044ec 100644 --- a/src/test/ui/parser/trait-bounds-not-on-impl.stderr +++ b/src/test/ui/parser/trait-bounds-not-on-impl.stderr @@ -1,7 +1,7 @@ error: expected a trait, found type --> $DIR/trait-bounds-not-on-impl.rs:8:6 | -LL | impl Foo + Owned for Bar { //~ ERROR expected a trait, found type +LL | impl Foo + Owned for Bar { | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/trait-object-lifetime-parens.stderr b/src/test/ui/parser/trait-object-lifetime-parens.stderr index 94ca66aef729..084e6d5b11fc 100644 --- a/src/test/ui/parser/trait-object-lifetime-parens.stderr +++ b/src/test/ui/parser/trait-object-lifetime-parens.stderr @@ -1,19 +1,19 @@ error: parenthesized lifetime bounds are not supported --> $DIR/trait-object-lifetime-parens.rs:5:21 | -LL | fn f<'a, T: Trait + ('a)>() {} //~ ERROR parenthesized lifetime bounds are not supported +LL | fn f<'a, T: Trait + ('a)>() {} | ^^^^ help: remove the parentheses error: parenthesized lifetime bounds are not supported --> $DIR/trait-object-lifetime-parens.rs:8:24 | -LL | let _: Box; //~ ERROR parenthesized lifetime bounds are not supported +LL | let _: Box; | ^^^^ help: remove the parentheses error: expected type, found `'a` --> $DIR/trait-object-lifetime-parens.rs:9:17 | -LL | let _: Box<('a) + Trait>; //~ ERROR expected type, found `'a` +LL | let _: Box<('a) + Trait>; | - ^^ | | | while parsing the type for `_` diff --git a/src/test/ui/parser/unclosed-braces.stderr b/src/test/ui/parser/unclosed-braces.stderr index 3ab366446d86..44c7e930a3a4 100644 --- a/src/test/ui/parser/unclosed-braces.stderr +++ b/src/test/ui/parser/unclosed-braces.stderr @@ -10,7 +10,7 @@ LL | { LL | } | - ...as it matches this but it has different indentation ... -LL | //~ ERROR this file contains an un-closed delimiter +LL | | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/underscore-suffix-for-float.stderr b/src/test/ui/parser/underscore-suffix-for-float.stderr index 58adcbbba76b..a5f3b6551aa2 100644 --- a/src/test/ui/parser/underscore-suffix-for-float.stderr +++ b/src/test/ui/parser/underscore-suffix-for-float.stderr @@ -1,13 +1,13 @@ error: expected identifier, found reserved identifier `_` --> $DIR/underscore-suffix-for-float.rs:2:16 | -LL | let a = 42._; //~ ERROR expected identifier, found reserved identifier `_` +LL | let a = 42._; | ^ expected identifier, found reserved identifier error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/underscore-suffix-for-float.rs:2:16 | -LL | let a = 42._; //~ ERROR expected identifier, found reserved identifier `_` +LL | let a = 42._; | ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/underscore_static.stderr b/src/test/ui/parser/underscore_static.stderr index 3bf3ce88a63c..4c41afdc3f09 100644 --- a/src/test/ui/parser/underscore_static.stderr +++ b/src/test/ui/parser/underscore_static.stderr @@ -1,7 +1,7 @@ error: expected identifier, found reserved identifier `_` --> $DIR/underscore_static.rs:1:8 | -LL | static _: () = (); //~ ERROR expected identifier, found reserved identifier `_` +LL | static _: () = (); | ^ expected identifier, found reserved identifier error: aborting due to previous error diff --git a/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr b/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr index 442837e58080..bfbdb0363ef6 100644 --- a/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr +++ b/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr @@ -1,7 +1,7 @@ error: this file contains an un-closed delimiter --> $DIR/unmatched-delimiter-at-end-of-file.rs:11:64 | -LL | fn foo() { //~ ERROR this file contains an un-closed delimiter +LL | fn foo() { | - un-closed delimiter ^ error: aborting due to previous error diff --git a/src/test/ui/parser/unsized2.stderr b/src/test/ui/parser/unsized2.stderr index fd12d86144c9..17e39b292005 100644 --- a/src/test/ui/parser/unsized2.stderr +++ b/src/test/ui/parser/unsized2.stderr @@ -1,7 +1,7 @@ error: expected expression, found keyword `type` --> $DIR/unsized2.rs:6:7 | -LL | f(); //~ ERROR expected expression, found keyword `type` +LL | f(); | ^^^^ expected expression error: aborting due to previous error diff --git a/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr b/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr index 51e1a02cbd76..36917523555b 100644 --- a/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr +++ b/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr @@ -1,17 +1,17 @@ error: expected identifier, found keyword `as` --> $DIR/use-as-where-use-ends-with-mod-sep.rs:3:16 | -LL | use std::any:: as foo; //~ ERROR expected identifier, found keyword `as` +LL | use std::any:: as foo; | ^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | use std::any:: r#as foo; //~ ERROR expected identifier, found keyword `as` +LL | use std::any:: r#as foo; | ^^^^ error: expected one of `::`, `;`, or `as`, found `foo` --> $DIR/use-as-where-use-ends-with-mod-sep.rs:3:19 | -LL | use std::any:: as foo; //~ ERROR expected identifier, found keyword `as` +LL | use std::any:: as foo; | ^^^ expected one of `::`, `;`, or `as` here error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/use-ends-with-mod-sep.stderr b/src/test/ui/parser/use-ends-with-mod-sep.stderr index 4a2b95ada6d2..bd0d881a06c3 100644 --- a/src/test/ui/parser/use-ends-with-mod-sep.stderr +++ b/src/test/ui/parser/use-ends-with-mod-sep.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `;` --> $DIR/use-ends-with-mod-sep.rs:1:15 | -LL | use std::any::; //~ ERROR expected identifier, found `;` +LL | use std::any::; | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/partialeq_help.stderr b/src/test/ui/partialeq_help.stderr index 04eb9770c468..9021bd30a778 100644 --- a/src/test/ui/partialeq_help.stderr +++ b/src/test/ui/partialeq_help.stderr @@ -1,7 +1,7 @@ error[E0277]: can't compare `&T` with `T` --> $DIR/partialeq_help.rs:2:7 | -LL | a == b; //~ ERROR E0277 +LL | a == b; | ^^ no implementation for `&T == T` | = help: the trait `std::cmp::PartialEq` is not implemented for `&T` diff --git a/src/test/ui/path-lookahead.stderr b/src/test/ui/path-lookahead.stderr index 73c6884679dd..50593e45230b 100644 --- a/src/test/ui/path-lookahead.stderr +++ b/src/test/ui/path-lookahead.stderr @@ -1,7 +1,7 @@ warning: unnecessary parentheses around `return` value --> $DIR/path-lookahead.rs:8:10 | -LL | return (::to_string(&arg)); //~WARN unnecessary parentheses around `return` value +LL | return (::to_string(&arg)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![warn(unused)] warning: function is never used: `with_parens` --> $DIR/path-lookahead.rs:7:1 | -LL | fn with_parens(arg: T) -> String { //~WARN function is never used: `with_parens` +LL | fn with_parens(arg: T) -> String { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -27,6 +27,6 @@ LL | #![warn(unused)] warning: function is never used: `no_parens` --> $DIR/path-lookahead.rs:11:1 | -LL | fn no_parens(arg: T) -> String { //~WARN function is never used: `no_parens` +LL | fn no_parens(arg: T) -> String { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr b/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr index ad8cc2ef8973..b32cf8cbb0ef 100644 --- a/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr +++ b/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr @@ -1,7 +1,7 @@ error: irrefutable if-let pattern --> $DIR/deny-irrefutable-let-patterns.rs:4:5 | -LL | if let _ = 5 {} //~ ERROR irrefutable if-let pattern +LL | if let _ = 5 {} | ^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(irrefutable_let_patterns)] error: irrefutable while-let pattern --> $DIR/deny-irrefutable-let-patterns.rs:6:5 | -LL | / while let _ = 5 { //~ ERROR irrefutable while-let pattern +LL | / while let _ = 5 { LL | | break; LL | | } | |_____^ diff --git a/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr b/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr index 7dbe23a8f283..0c5824be95df 100644 --- a/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr +++ b/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr @@ -4,7 +4,7 @@ error[E0530]: let bindings cannot shadow tuple structs LL | struct foo(usize); | ------------------ the tuple struct `foo` is defined here ... -LL | let (foo, _) = (2, 3); //~ ERROR let bindings cannot shadow tuple structs +LL | let (foo, _) = (2, 3); | ^^^ cannot be named the same as a tuple struct error: aborting due to previous error diff --git a/src/test/ui/pattern/pat-tuple-bad-type.stderr b/src/test/ui/pattern/pat-tuple-bad-type.stderr index 28aa52856c55..84b9a622431e 100644 --- a/src/test/ui/pattern/pat-tuple-bad-type.stderr +++ b/src/test/ui/pattern/pat-tuple-bad-type.stderr @@ -4,7 +4,7 @@ error[E0282]: type annotations needed LL | let x; | - consider giving `x` a type ... -LL | (..) => {} //~ ERROR type annotations needed +LL | (..) => {} | ^^^^ cannot infer type | = note: type must be known at this point @@ -12,7 +12,7 @@ LL | (..) => {} //~ ERROR type annotations needed error[E0308]: mismatched types --> $DIR/pat-tuple-bad-type.rs:10:9 | -LL | (..) => {} //~ ERROR mismatched types +LL | (..) => {} | ^^^^ expected u8, found () | = note: expected type `u8` diff --git a/src/test/ui/pattern/pat-tuple-overfield.stderr b/src/test/ui/pattern/pat-tuple-overfield.stderr index 4bd374affb36..9bf14e15fcea 100644 --- a/src/test/ui/pattern/pat-tuple-overfield.stderr +++ b/src/test/ui/pattern/pat-tuple-overfield.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/pat-tuple-overfield.rs:5:9 | -LL | (1, 2, 3, 4) => {} //~ ERROR mismatched types +LL | (1, 2, 3, 4) => {} | ^^^^^^^^^^^^ expected a tuple with 3 elements, found one with 4 elements | = note: expected type `({integer}, {integer}, {integer})` @@ -10,7 +10,7 @@ LL | (1, 2, 3, 4) => {} //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/pat-tuple-overfield.rs:6:9 | -LL | (1, 2, .., 3, 4) => {} //~ ERROR mismatched types +LL | (1, 2, .., 3, 4) => {} | ^^^^^^^^^^^^^^^^ expected a tuple with 3 elements, found one with 4 elements | = note: expected type `({integer}, {integer}, {integer})` diff --git a/src/test/ui/pattern/patkind-litrange-no-expr.stderr b/src/test/ui/pattern/patkind-litrange-no-expr.stderr index 4caafa7d3e84..7474d3267936 100644 --- a/src/test/ui/pattern/patkind-litrange-no-expr.stderr +++ b/src/test/ui/pattern/patkind-litrange-no-expr.stderr @@ -1,13 +1,13 @@ error: arbitrary expressions aren't allowed in patterns --> $DIR/patkind-litrange-no-expr.rs:20:13 | -LL | Arith = 1 + 1, //~ ERROR arbitrary expressions aren't allowed in patterns +LL | Arith = 1 + 1, | ^^^^^ error[E0029]: only char and numeric types are allowed in range patterns --> $DIR/patkind-litrange-no-expr.rs:20:13 | -LL | Arith = 1 + 1, //~ ERROR arbitrary expressions aren't allowed in patterns +LL | Arith = 1 + 1, | ^^^^^ ranges require char or numeric types | = note: start type: {integer} diff --git a/src/test/ui/pattern/pattern-binding-disambiguation.stderr b/src/test/ui/pattern/pattern-binding-disambiguation.stderr index 958934c301ff..faa0d7c30743 100644 --- a/src/test/ui/pattern/pattern-binding-disambiguation.stderr +++ b/src/test/ui/pattern/pattern-binding-disambiguation.stderr @@ -4,7 +4,7 @@ error[E0530]: match bindings cannot shadow tuple structs LL | struct TupleStruct(); | --------------------- the tuple struct `TupleStruct` is defined here ... -LL | TupleStruct => {} //~ ERROR match bindings cannot shadow tuple structs +LL | TupleStruct => {} | ^^^^^^^^^^^ cannot be named the same as a tuple struct error[E0530]: match bindings cannot shadow tuple variants @@ -13,7 +13,7 @@ error[E0530]: match bindings cannot shadow tuple variants LL | use E::*; | ---- the tuple variant `TupleVariant` is imported here ... -LL | TupleVariant => {} //~ ERROR match bindings cannot shadow tuple variants +LL | TupleVariant => {} | ^^^^^^^^^^^^ cannot be named the same as a tuple variant error[E0530]: match bindings cannot shadow struct variants @@ -22,7 +22,7 @@ error[E0530]: match bindings cannot shadow struct variants LL | use E::*; | ---- the struct variant `BracedVariant` is imported here ... -LL | BracedVariant => {} //~ ERROR match bindings cannot shadow struct variants +LL | BracedVariant => {} | ^^^^^^^^^^^^^ cannot be named the same as a struct variant error[E0530]: match bindings cannot shadow statics @@ -31,7 +31,7 @@ error[E0530]: match bindings cannot shadow statics LL | static STATIC: () = (); | ----------------------- the static `STATIC` is defined here ... -LL | STATIC => {} //~ ERROR match bindings cannot shadow statics +LL | STATIC => {} | ^^^^^^ cannot be named the same as a static error[E0530]: let bindings cannot shadow tuple structs @@ -40,7 +40,7 @@ error[E0530]: let bindings cannot shadow tuple structs LL | struct TupleStruct(); | --------------------- the tuple struct `TupleStruct` is defined here ... -LL | let TupleStruct = doesnt_matter; //~ ERROR let bindings cannot shadow tuple structs +LL | let TupleStruct = doesnt_matter; | ^^^^^^^^^^^ cannot be named the same as a tuple struct error[E0530]: let bindings cannot shadow tuple variants @@ -49,7 +49,7 @@ error[E0530]: let bindings cannot shadow tuple variants LL | use E::*; | ---- the tuple variant `TupleVariant` is imported here ... -LL | let TupleVariant = doesnt_matter; //~ ERROR let bindings cannot shadow tuple variants +LL | let TupleVariant = doesnt_matter; | ^^^^^^^^^^^^ cannot be named the same as a tuple variant error[E0530]: let bindings cannot shadow struct variants @@ -58,7 +58,7 @@ error[E0530]: let bindings cannot shadow struct variants LL | use E::*; | ---- the struct variant `BracedVariant` is imported here ... -LL | let BracedVariant = doesnt_matter; //~ ERROR let bindings cannot shadow struct variants +LL | let BracedVariant = doesnt_matter; | ^^^^^^^^^^^^^ cannot be named the same as a struct variant error[E0530]: let bindings cannot shadow statics @@ -67,7 +67,7 @@ error[E0530]: let bindings cannot shadow statics LL | static STATIC: () = (); | ----------------------- the static `STATIC` is defined here ... -LL | let STATIC = doesnt_matter; //~ ERROR let bindings cannot shadow statics +LL | let STATIC = doesnt_matter; | ^^^^^^ cannot be named the same as a static error: aborting due to 8 previous errors diff --git a/src/test/ui/pattern/pattern-error-continue.stderr b/src/test/ui/pattern/pattern-error-continue.stderr index 654814afcfe1..11e0c31cfa62 100644 --- a/src/test/ui/pattern/pattern-error-continue.stderr +++ b/src/test/ui/pattern/pattern-error-continue.stderr @@ -1,13 +1,13 @@ error[E0433]: failed to resolve: use of undeclared type or module `E` --> $DIR/pattern-error-continue.rs:35:9 | -LL | E::V => {} //~ ERROR failed to resolve: use of undeclared type or module `E` +LL | E::V => {} | ^ use of undeclared type or module `E` error[E0532]: expected tuple struct/variant, found unit variant `A::D` --> $DIR/pattern-error-continue.rs:18:9 | -LL | A::D(_) => (), //~ ERROR expected tuple struct/variant, found unit variant `A::D` +LL | A::D(_) => (), | ^^^- | | | help: a tuple variant with a similar name exists: `B` @@ -15,7 +15,7 @@ LL | A::D(_) => (), //~ ERROR expected tuple struct/variant, found error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields --> $DIR/pattern-error-continue.rs:17:9 | -LL | A::B(_, _, _) => (), //~ ERROR this pattern has 3 fields, but +LL | A::B(_, _, _) => (), | ^^^^^^^^^^^^^ expected 2 fields, found 3 error[E0308]: mismatched types diff --git a/src/test/ui/pattern/pattern-ident-path-generics.stderr b/src/test/ui/pattern/pattern-ident-path-generics.stderr index 278b3d19d8bc..bfc10c5f8665 100644 --- a/src/test/ui/pattern/pattern-ident-path-generics.stderr +++ b/src/test/ui/pattern/pattern-ident-path-generics.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/pattern-ident-path-generics.rs:3:9 | -LL | None:: => {} //~ ERROR mismatched types +LL | None:: => {} | ^^^^^^^^^^^^^ expected &str, found isize | = note: expected type `std::option::Option<&str>` diff --git a/src/test/ui/pattern/pattern-tyvar.stderr b/src/test/ui/pattern/pattern-tyvar.stderr index 69cd552aabd1..548347034671 100644 --- a/src/test/ui/pattern/pattern-tyvar.stderr +++ b/src/test/ui/pattern/pattern-tyvar.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | match t { | - this match expression has type `std::option::Option>` -LL | Bar::T1(_, Some::(x)) => { //~ ERROR mismatched types +LL | Bar::T1(_, Some::(x)) => { | ^^^^^^^^^^^^^^^^ expected struct `std::vec::Vec`, found isize | = note: expected type `std::option::Option>` diff --git a/src/test/ui/pattern/slice-pattern-const-2.stderr b/src/test/ui/pattern/slice-pattern-const-2.stderr index 95651ccc401e..e2c408a90e4e 100644 --- a/src/test/ui/pattern/slice-pattern-const-2.stderr +++ b/src/test/ui/pattern/slice-pattern-const-2.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/slice-pattern-const-2.rs:9:9 | -LL | [4, 5, 6, 7] => (), //~ ERROR unreachable pattern +LL | [4, 5, 6, 7] => (), | ^^^^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unreachable_patterns)] error: unreachable pattern --> $DIR/slice-pattern-const-2.rs:15:9 | -LL | [4, 5, 6, 7] => (), //~ ERROR unreachable pattern +LL | [4, 5, 6, 7] => (), | ^^^^^^^^^^^^ error: unreachable pattern --> $DIR/slice-pattern-const-2.rs:28:9 | -LL | FOO => (), //~ ERROR unreachable pattern +LL | FOO => (), | ^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/pattern/slice-pattern-const-3.stderr b/src/test/ui/pattern/slice-pattern-const-3.stderr index 531bbbc84d03..eab4fc3f086d 100644 --- a/src/test/ui/pattern/slice-pattern-const-3.stderr +++ b/src/test/ui/pattern/slice-pattern-const-3.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/slice-pattern-const-3.rs:28:9 | -LL | FOO => (), //~ ERROR unreachable pattern +LL | FOO => (), | ^^^ | note: lint level defined here diff --git a/src/test/ui/pattern/slice-pattern-const.stderr b/src/test/ui/pattern/slice-pattern-const.stderr index 412e0158c01c..2dd10a0478ab 100644 --- a/src/test/ui/pattern/slice-pattern-const.stderr +++ b/src/test/ui/pattern/slice-pattern-const.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/slice-pattern-const.rs:9:9 | -LL | [84, 69, 83, 84] => (), //~ ERROR unreachable pattern +LL | [84, 69, 83, 84] => (), | ^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,43 +13,43 @@ LL | #![deny(unreachable_patterns)] error: unreachable pattern --> $DIR/slice-pattern-const.rs:15:9 | -LL | [84, 69, 83, 84] => (), //~ ERROR unreachable pattern +LL | [84, 69, 83, 84] => (), | ^^^^^^^^^^^^^^^^ error: unreachable pattern --> $DIR/slice-pattern-const.rs:21:9 | -LL | MAGIC_TEST => (), //~ ERROR unreachable pattern +LL | MAGIC_TEST => (), | ^^^^^^^^^^ error: unreachable pattern --> $DIR/slice-pattern-const.rs:28:9 | -LL | FOO => (), //~ ERROR unreachable pattern +LL | FOO => (), | ^^^ error: unreachable pattern --> $DIR/slice-pattern-const.rs:35:9 | -LL | BAR => (), //~ ERROR unreachable pattern +LL | BAR => (), | ^^^ error: unreachable pattern --> $DIR/slice-pattern-const.rs:43:9 | -LL | BOO => (), //~ ERROR unreachable pattern +LL | BOO => (), | ^^^ error: unreachable pattern --> $DIR/slice-pattern-const.rs:44:9 | -LL | b"" => (), //~ ERROR unreachable pattern +LL | b"" => (), | ^^^ error: unreachable pattern --> $DIR/slice-pattern-const.rs:45:9 | -LL | _ => (), //~ ERROR unreachable pattern +LL | _ => (), | ^ error: aborting due to 8 previous errors diff --git a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr index 5ebe00e624fc..ee1e36081e77 100644 --- a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr +++ b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr @@ -34,7 +34,7 @@ error[E0308]: mismatched types LL | fn baz() -> impl std::fmt::Display { | ---------------------- expected because this return type... LL | / if false { -LL | | //~^ ERROR mismatched types +LL | | LL | | return 0i32; | | ---- ...is found to be `i32` here LL | | } else { @@ -54,7 +54,7 @@ LL | | 0i32 LL | | } else { LL | | 1u32 | | ^^^^ expected i32, found u32 -LL | | //~^ ERROR if and else have incompatible types +LL | | LL | | } | |_____- if and else have incompatible types | diff --git a/src/test/ui/precise_pointer_size_matching.stderr b/src/test/ui/precise_pointer_size_matching.stderr index a8906a43003a..6f0322fd9b95 100644 --- a/src/test/ui/precise_pointer_size_matching.stderr +++ b/src/test/ui/precise_pointer_size_matching.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `$ISIZE_MIN..=-6isize` and `21isize..=$ISIZE_MAX` not covered --> $DIR/precise_pointer_size_matching.rs:24:11 | -LL | match 0isize { //~ ERROR non-exhaustive patterns +LL | match 0isize { | ^^^^^^ patterns `$ISIZE_MIN..=-6isize` and `21isize..=$ISIZE_MAX` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -9,7 +9,7 @@ LL | match 0isize { //~ ERROR non-exhaustive patterns error[E0004]: non-exhaustive patterns: `0usize` and `21usize..=$USIZE_MAX` not covered --> $DIR/precise_pointer_size_matching.rs:29:11 | -LL | match 0usize { //~ ERROR non-exhaustive patterns +LL | match 0usize { | ^^^^^^ patterns `0usize` and `21usize..=$USIZE_MAX` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/prim-with-args.stderr b/src/test/ui/prim-with-args.stderr index 91259e87efc0..4535633bc6f3 100644 --- a/src/test/ui/prim-with-args.stderr +++ b/src/test/ui/prim-with-args.stderr @@ -1,133 +1,133 @@ error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:3:14 | -LL | let x: isize; //~ ERROR type arguments are not allowed on this entity +LL | let x: isize; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:4:11 | -LL | let x: i8; //~ ERROR type arguments are not allowed on this entity +LL | let x: i8; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:5:12 | -LL | let x: i16; //~ ERROR type arguments are not allowed on this entity +LL | let x: i16; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:6:12 | -LL | let x: i32; //~ ERROR type arguments are not allowed on this entity +LL | let x: i32; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:7:12 | -LL | let x: i64; //~ ERROR type arguments are not allowed on this entity +LL | let x: i64; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:8:14 | -LL | let x: usize; //~ ERROR type arguments are not allowed on this entity +LL | let x: usize; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:9:11 | -LL | let x: u8; //~ ERROR type arguments are not allowed on this entity +LL | let x: u8; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:10:12 | -LL | let x: u16; //~ ERROR type arguments are not allowed on this entity +LL | let x: u16; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:11:12 | -LL | let x: u32; //~ ERROR type arguments are not allowed on this entity +LL | let x: u32; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:12:12 | -LL | let x: u64; //~ ERROR type arguments are not allowed on this entity +LL | let x: u64; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:13:13 | -LL | let x: char; //~ ERROR type arguments are not allowed on this entity +LL | let x: char; | ^^^^^ type argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:15:14 | -LL | let x: isize<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: isize<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:16:11 | -LL | let x: i8<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: i8<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:17:12 | -LL | let x: i16<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: i16<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:18:12 | -LL | let x: i32<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: i32<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:19:12 | -LL | let x: i64<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: i64<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:20:14 | -LL | let x: usize<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: usize<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:21:11 | -LL | let x: u8<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: u8<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:22:12 | -LL | let x: u16<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: u16<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:23:12 | -LL | let x: u32<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: u32<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:24:12 | -LL | let x: u64<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: u64<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:25:13 | -LL | let x: char<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: char<'static>; | ^^^^^^^ lifetime argument not allowed error: aborting due to 22 previous errors diff --git a/src/test/ui/priv-in-bad-locations.stderr b/src/test/ui/priv-in-bad-locations.stderr index 09706a6d255b..713568f879da 100644 --- a/src/test/ui/priv-in-bad-locations.stderr +++ b/src/test/ui/priv-in-bad-locations.stderr @@ -1,7 +1,7 @@ error[E0449]: unnecessary visibility qualifier --> $DIR/priv-in-bad-locations.rs:1:1 | -LL | pub extern { //~ ERROR unnecessary visibility qualifier +LL | pub extern { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual foreign items instead @@ -9,7 +9,7 @@ LL | pub extern { //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/priv-in-bad-locations.rs:11:1 | -LL | pub impl B {} //~ ERROR unnecessary visibility qualifier +LL | pub impl B {} | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual impl items instead @@ -17,13 +17,13 @@ LL | pub impl B {} //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/priv-in-bad-locations.rs:13:1 | -LL | pub impl A for B { //~ ERROR unnecessary visibility qualifier +LL | pub impl A for B { | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/priv-in-bad-locations.rs:14:5 | -LL | pub fn foo(&self) {} //~ ERROR unnecessary visibility qualifier +LL | pub fn foo(&self) {} | ^^^ `pub` not permitted here because it's implied error: aborting due to 4 previous errors diff --git a/src/test/ui/privacy/decl-macro.stderr b/src/test/ui/privacy/decl-macro.stderr index c8b043d1b5f3..230cf95de620 100644 --- a/src/test/ui/privacy/decl-macro.stderr +++ b/src/test/ui/privacy/decl-macro.stderr @@ -1,7 +1,7 @@ error[E0603]: macro `mac` is private --> $DIR/decl-macro.rs:8:8 | -LL | m::mac!(); //~ ERROR macro `mac` is private +LL | m::mac!(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/privacy-in-paths.stderr b/src/test/ui/privacy/privacy-in-paths.stderr index 563aaec89aa3..4b9faca04570 100644 --- a/src/test/ui/privacy/privacy-in-paths.stderr +++ b/src/test/ui/privacy/privacy-in-paths.stderr @@ -1,19 +1,19 @@ error[E0603]: module `bar` is private --> $DIR/privacy-in-paths.rs:24:16 | -LL | ::foo::bar::baz::f(); //~ERROR module `bar` is private +LL | ::foo::bar::baz::f(); | ^^^ error[E0603]: module `bar` is private --> $DIR/privacy-in-paths.rs:25:16 | -LL | ::foo::bar::S::f(); //~ERROR module `bar` is private +LL | ::foo::bar::S::f(); | ^^^ error[E0603]: trait `T` is private --> $DIR/privacy-in-paths.rs:26:23 | -LL | <() as ::foo::T>::Assoc::f(); //~ERROR trait `T` is private +LL | <() as ::foo::T>::Assoc::f(); | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/privacy/privacy-ns1.stderr b/src/test/ui/privacy/privacy-ns1.stderr index 6ba2dbe41a2b..07b013be7251 100644 --- a/src/test/ui/privacy/privacy-ns1.stderr +++ b/src/test/ui/privacy/privacy-ns1.stderr @@ -1,11 +1,11 @@ error[E0423]: expected function, found trait `Bar` --> $DIR/privacy-ns1.rs:20:5 | -LL | Bar(); //~ ERROR expected function, found trait `Bar` +LL | Bar(); | ^^^ help: a unit struct with a similar name exists | -LL | Baz(); //~ ERROR expected function, found trait `Bar` +LL | Baz(); | ^^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -19,11 +19,11 @@ LL | use foo3::Bar; error[E0573]: expected type, found function `Bar` --> $DIR/privacy-ns1.rs:35:17 | -LL | let _x: Box; //~ ERROR expected type, found function `Bar` +LL | let _x: Box; | ^^^ help: a struct with a similar name exists | -LL | let _x: Box; //~ ERROR expected type, found function `Bar` +LL | let _x: Box; | ^^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -37,11 +37,11 @@ LL | use foo3::Bar; error[E0425]: cannot find function `Bar` in this scope --> $DIR/privacy-ns1.rs:50:5 | -LL | Bar(); //~ ERROR cannot find function `Bar` in this scope +LL | Bar(); | ^^^ help: a unit struct with a similar name exists | -LL | Baz(); //~ ERROR cannot find function `Bar` in this scope +LL | Baz(); | ^^^ help: possible candidates are found in other modules, you can import them into scope | @@ -55,11 +55,11 @@ LL | use foo3::Bar; error[E0412]: cannot find type `Bar` in this scope --> $DIR/privacy-ns1.rs:51:17 | -LL | let _x: Box; //~ ERROR cannot find type `Bar` in this scope +LL | let _x: Box; | ^^^ help: a struct with a similar name exists | -LL | let _x: Box; //~ ERROR cannot find type `Bar` in this scope +LL | let _x: Box; | ^^^ help: possible candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/privacy/privacy-ns2.stderr b/src/test/ui/privacy/privacy-ns2.stderr index 0012072ed113..cd5b53690644 100644 --- a/src/test/ui/privacy/privacy-ns2.stderr +++ b/src/test/ui/privacy/privacy-ns2.stderr @@ -1,7 +1,7 @@ error[E0423]: expected function, found trait `Bar` --> $DIR/privacy-ns2.rs:20:5 | -LL | Bar(); //~ ERROR expected function, found trait `Bar` +LL | Bar(); | ^^^ not a function help: possible better candidates are found in other modules, you can import them into scope | @@ -15,11 +15,11 @@ LL | use foo3::Bar; error[E0423]: expected function, found trait `Bar` --> $DIR/privacy-ns2.rs:26:5 | -LL | Bar(); //~ ERROR expected function, found trait `Bar` +LL | Bar(); | ^^^ help: a unit struct with a similar name exists | -LL | Baz(); //~ ERROR expected function, found trait `Bar` +LL | Baz(); | ^^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -33,7 +33,7 @@ LL | use foo3::Bar; error[E0573]: expected type, found function `Bar` --> $DIR/privacy-ns2.rs:41:18 | -LL | let _x : Box; //~ ERROR expected type, found function `Bar` +LL | let _x : Box; | ^^^ not a type help: possible better candidates are found in other modules, you can import them into scope | @@ -47,11 +47,11 @@ LL | use foo3::Bar; error[E0573]: expected type, found function `Bar` --> $DIR/privacy-ns2.rs:47:17 | -LL | let _x: Box; //~ ERROR expected type, found function `Bar` +LL | let _x: Box; | ^^^ help: a struct with a similar name exists | -LL | let _x: Box; //~ ERROR expected type, found function `Bar` +LL | let _x: Box; | ^^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -65,19 +65,19 @@ LL | use foo3::Bar; error[E0603]: trait `Bar` is private --> $DIR/privacy-ns2.rs:60:15 | -LL | use foo3::Bar; //~ ERROR `Bar` is private +LL | use foo3::Bar; | ^^^ error[E0603]: trait `Bar` is private --> $DIR/privacy-ns2.rs:64:15 | -LL | use foo3::Bar; //~ ERROR `Bar` is private +LL | use foo3::Bar; | ^^^ error[E0603]: trait `Bar` is private --> $DIR/privacy-ns2.rs:71:16 | -LL | use foo3::{Bar,Baz}; //~ ERROR `Bar` is private +LL | use foo3::{Bar,Baz}; | ^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/privacy/privacy-sanity.stderr b/src/test/ui/privacy/privacy-sanity.stderr index b1e3127645e0..c92553fd1a16 100644 --- a/src/test/ui/privacy/privacy-sanity.stderr +++ b/src/test/ui/privacy/privacy-sanity.stderr @@ -1,31 +1,31 @@ error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:13:1 | -LL | pub impl Tr for S { //~ ERROR unnecessary visibility qualifier +LL | pub impl Tr for S { | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:14:5 | -LL | pub fn f() {} //~ ERROR unnecessary visibility qualifier +LL | pub fn f() {} | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:15:5 | -LL | pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier +LL | pub const C: u8 = 0; | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:16:5 | -LL | pub type T = u8; //~ ERROR unnecessary visibility qualifier +LL | pub type T = u8; | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:18:1 | -LL | pub impl S { //~ ERROR unnecessary visibility qualifier +LL | pub impl S { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual impl items instead @@ -33,7 +33,7 @@ LL | pub impl S { //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:23:1 | -LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier +LL | pub extern "C" { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual foreign items instead @@ -41,31 +41,31 @@ LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:39:5 | -LL | pub impl Tr for S { //~ ERROR unnecessary visibility qualifier +LL | pub impl Tr for S { | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:40:9 | -LL | pub fn f() {} //~ ERROR unnecessary visibility qualifier +LL | pub fn f() {} | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:41:9 | -LL | pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier +LL | pub const C: u8 = 0; | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:42:9 | -LL | pub type T = u8; //~ ERROR unnecessary visibility qualifier +LL | pub type T = u8; | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:44:5 | -LL | pub impl S { //~ ERROR unnecessary visibility qualifier +LL | pub impl S { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual impl items instead @@ -73,7 +73,7 @@ LL | pub impl S { //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:49:5 | -LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier +LL | pub extern "C" { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual foreign items instead @@ -81,31 +81,31 @@ LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:68:5 | -LL | pub impl Tr for S { //~ ERROR unnecessary visibility qualifier +LL | pub impl Tr for S { | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:69:9 | -LL | pub fn f() {} //~ ERROR unnecessary visibility qualifier +LL | pub fn f() {} | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:70:9 | -LL | pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier +LL | pub const C: u8 = 0; | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:71:9 | -LL | pub type T = u8; //~ ERROR unnecessary visibility qualifier +LL | pub type T = u8; | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:73:5 | -LL | pub impl S { //~ ERROR unnecessary visibility qualifier +LL | pub impl S { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual impl items instead @@ -113,7 +113,7 @@ LL | pub impl S { //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:78:5 | -LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier +LL | pub extern "C" { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual foreign items instead diff --git a/src/test/ui/privacy/privacy-ufcs.stderr b/src/test/ui/privacy/privacy-ufcs.stderr index c70afe5061d3..6be14df89d20 100644 --- a/src/test/ui/privacy/privacy-ufcs.stderr +++ b/src/test/ui/privacy/privacy-ufcs.stderr @@ -1,7 +1,7 @@ error[E0603]: trait `Bar` is private --> $DIR/privacy-ufcs.rs:12:20 | -LL | ::baz(); //~ERROR trait `Bar` is private +LL | ::baz(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/privacy1.stderr b/src/test/ui/privacy/privacy1.stderr index 7feebabe781a..73672d1c214f 100644 --- a/src/test/ui/privacy/privacy1.stderr +++ b/src/test/ui/privacy/privacy1.stderr @@ -13,55 +13,55 @@ LL | use bar::baz; error[E0603]: module `i` is private --> $DIR/privacy1.rs:164:20 | -LL | use self::foo::i::A; //~ ERROR: module `i` is private +LL | use self::foo::i::A; | ^ error[E0603]: module `baz` is private --> $DIR/privacy1.rs:104:16 | -LL | ::bar::baz::A::foo(); //~ ERROR: module `baz` is private +LL | ::bar::baz::A::foo(); | ^^^ error[E0603]: module `baz` is private --> $DIR/privacy1.rs:105:16 | -LL | ::bar::baz::A::bar(); //~ ERROR: module `baz` is private +LL | ::bar::baz::A::bar(); | ^^^ error[E0603]: module `baz` is private --> $DIR/privacy1.rs:107:16 | -LL | ::bar::baz::A.foo2(); //~ ERROR: module `baz` is private +LL | ::bar::baz::A.foo2(); | ^^^ error[E0603]: module `baz` is private --> $DIR/privacy1.rs:108:16 | -LL | ::bar::baz::A.bar2(); //~ ERROR: module `baz` is private +LL | ::bar::baz::A.bar2(); | ^^^ error[E0603]: trait `B` is private --> $DIR/privacy1.rs:112:16 | -LL | ::bar::B::foo(); //~ ERROR: trait `B` is private +LL | ::bar::B::foo(); | ^ error[E0603]: function `epriv` is private --> $DIR/privacy1.rs:118:20 | -LL | ::bar::epriv(); //~ ERROR: function `epriv` is private +LL | ::bar::epriv(); | ^^^^^ error[E0603]: module `baz` is private --> $DIR/privacy1.rs:127:16 | -LL | ::bar::baz::foo(); //~ ERROR: module `baz` is private +LL | ::bar::baz::foo(); | ^^^ error[E0603]: module `baz` is private --> $DIR/privacy1.rs:128:16 | -LL | ::bar::baz::bar(); //~ ERROR: module `baz` is private +LL | ::bar::baz::bar(); | ^^^ error[E0603]: trait `B` is private @@ -73,31 +73,31 @@ LL | impl ::bar::B for f32 { fn foo() -> f32 { 1.0 } } error[E0624]: method `bar` is private --> $DIR/privacy1.rs:77:9 | -LL | self::baz::A::bar(); //~ ERROR: method `bar` is private +LL | self::baz::A::bar(); | ^^^^^^^^^^^^^^^^^ error[E0624]: method `bar` is private --> $DIR/privacy1.rs:95:5 | -LL | bar::A::bar(); //~ ERROR: method `bar` is private +LL | bar::A::bar(); | ^^^^^^^^^^^ error[E0624]: method `bar` is private --> $DIR/privacy1.rs:102:9 | -LL | ::bar::A::bar(); //~ ERROR: method `bar` is private +LL | ::bar::A::bar(); | ^^^^^^^^^^^^^ error[E0624]: method `bar` is private --> $DIR/privacy1.rs:105:9 | -LL | ::bar::baz::A::bar(); //~ ERROR: module `baz` is private +LL | ::bar::baz::A::bar(); | ^^^^^^^^^^^^^^^^^^ error[E0624]: method `bar2` is private --> $DIR/privacy1.rs:108:23 | -LL | ::bar::baz::A.bar2(); //~ ERROR: module `baz` is private +LL | ::bar::baz::A.bar2(); | ^^^^ error: aborting due to 17 previous errors diff --git a/src/test/ui/privacy/privacy4.stderr b/src/test/ui/privacy/privacy4.stderr index 9e3e48272f90..e4a20f920a06 100644 --- a/src/test/ui/privacy/privacy4.stderr +++ b/src/test/ui/privacy/privacy4.stderr @@ -1,7 +1,7 @@ error[E0603]: module `glob` is private --> $DIR/privacy4.rs:21:14 | -LL | use bar::glob::gpriv; //~ ERROR: module `glob` is private +LL | use bar::glob::gpriv; | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/privacy5.stderr b/src/test/ui/privacy/privacy5.stderr index cdd9b2cefbba..7568c346b248 100644 --- a/src/test/ui/privacy/privacy5.stderr +++ b/src/test/ui/privacy/privacy5.stderr @@ -1,289 +1,289 @@ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:51:16 | -LL | let a = a::A(()); //~ ERROR tuple struct `A` is private +LL | let a = a::A(()); | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:52:16 | -LL | let b = a::B(2); //~ ERROR tuple struct `B` is private +LL | let b = a::B(2); | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:53:16 | -LL | let c = a::C(2, 3); //~ ERROR tuple struct `C` is private +LL | let c = a::C(2, 3); | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:56:12 | -LL | let a::A(()) = a; //~ ERROR tuple struct `A` is private +LL | let a::A(()) = a; | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:57:12 | -LL | let a::A(_) = a; //~ ERROR tuple struct `A` is private +LL | let a::A(_) = a; | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:58:18 | -LL | match a { a::A(()) => {} } //~ ERROR tuple struct `A` is private +LL | match a { a::A(()) => {} } | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:59:18 | -LL | match a { a::A(_) => {} } //~ ERROR tuple struct `A` is private +LL | match a { a::A(_) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:61:12 | -LL | let a::B(_) = b; //~ ERROR tuple struct `B` is private +LL | let a::B(_) = b; | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:62:12 | -LL | let a::B(_b) = b; //~ ERROR tuple struct `B` is private +LL | let a::B(_b) = b; | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:63:18 | -LL | match b { a::B(_) => {} } //~ ERROR tuple struct `B` is private +LL | match b { a::B(_) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:64:18 | -LL | match b { a::B(_b) => {} } //~ ERROR tuple struct `B` is private +LL | match b { a::B(_b) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:65:18 | -LL | match b { a::B(1) => {} a::B(_) => {} } //~ ERROR tuple struct `B` is private +LL | match b { a::B(1) => {} a::B(_) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:65:32 | -LL | match b { a::B(1) => {} a::B(_) => {} } //~ ERROR tuple struct `B` is private +LL | match b { a::B(1) => {} a::B(_) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:68:12 | -LL | let a::C(_, _) = c; //~ ERROR tuple struct `C` is private +LL | let a::C(_, _) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:69:12 | -LL | let a::C(_a, _) = c; //~ ERROR tuple struct `C` is private +LL | let a::C(_a, _) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:70:12 | -LL | let a::C(_, _b) = c; //~ ERROR tuple struct `C` is private +LL | let a::C(_, _b) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:71:12 | -LL | let a::C(_a, _b) = c; //~ ERROR tuple struct `C` is private +LL | let a::C(_a, _b) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:72:18 | -LL | match c { a::C(_, _) => {} } //~ ERROR tuple struct `C` is private +LL | match c { a::C(_, _) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:73:18 | -LL | match c { a::C(_a, _) => {} } //~ ERROR tuple struct `C` is private +LL | match c { a::C(_a, _) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:74:18 | -LL | match c { a::C(_, _b) => {} } //~ ERROR tuple struct `C` is private +LL | match c { a::C(_, _b) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:75:18 | -LL | match c { a::C(_a, _b) => {} } //~ ERROR tuple struct `C` is private +LL | match c { a::C(_a, _b) => {} } | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:83:17 | -LL | let a2 = a::A; //~ ERROR tuple struct `A` is private +LL | let a2 = a::A; | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:84:17 | -LL | let b2 = a::B; //~ ERROR tuple struct `B` is private +LL | let b2 = a::B; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:85:17 | -LL | let c2 = a::C; //~ ERROR tuple struct `C` is private +LL | let c2 = a::C; | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:90:20 | -LL | let a = other::A(()); //~ ERROR tuple struct `A` is private +LL | let a = other::A(()); | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:91:20 | -LL | let b = other::B(2); //~ ERROR tuple struct `B` is private +LL | let b = other::B(2); | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:92:20 | -LL | let c = other::C(2, 3); //~ ERROR tuple struct `C` is private +LL | let c = other::C(2, 3); | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:95:16 | -LL | let other::A(()) = a; //~ ERROR tuple struct `A` is private +LL | let other::A(()) = a; | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:96:16 | -LL | let other::A(_) = a; //~ ERROR tuple struct `A` is private +LL | let other::A(_) = a; | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:97:22 | -LL | match a { other::A(()) => {} } //~ ERROR tuple struct `A` is private +LL | match a { other::A(()) => {} } | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:98:22 | -LL | match a { other::A(_) => {} } //~ ERROR tuple struct `A` is private +LL | match a { other::A(_) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:100:16 | -LL | let other::B(_) = b; //~ ERROR tuple struct `B` is private +LL | let other::B(_) = b; | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:101:16 | -LL | let other::B(_b) = b; //~ ERROR tuple struct `B` is private +LL | let other::B(_b) = b; | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:102:22 | -LL | match b { other::B(_) => {} } //~ ERROR tuple struct `B` is private +LL | match b { other::B(_) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:103:22 | -LL | match b { other::B(_b) => {} } //~ ERROR tuple struct `B` is private +LL | match b { other::B(_b) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:104:22 | -LL | match b { other::B(1) => {} other::B(_) => {} } //~ ERROR tuple struct `B` is private +LL | match b { other::B(1) => {} other::B(_) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:104:40 | -LL | match b { other::B(1) => {} other::B(_) => {} } //~ ERROR tuple struct `B` is private +LL | match b { other::B(1) => {} other::B(_) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:107:16 | -LL | let other::C(_, _) = c; //~ ERROR tuple struct `C` is private +LL | let other::C(_, _) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:108:16 | -LL | let other::C(_a, _) = c; //~ ERROR tuple struct `C` is private +LL | let other::C(_a, _) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:109:16 | -LL | let other::C(_, _b) = c; //~ ERROR tuple struct `C` is private +LL | let other::C(_, _b) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:110:16 | -LL | let other::C(_a, _b) = c; //~ ERROR tuple struct `C` is private +LL | let other::C(_a, _b) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:111:22 | -LL | match c { other::C(_, _) => {} } //~ ERROR tuple struct `C` is private +LL | match c { other::C(_, _) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:112:22 | -LL | match c { other::C(_a, _) => {} } //~ ERROR tuple struct `C` is private +LL | match c { other::C(_a, _) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:113:22 | -LL | match c { other::C(_, _b) => {} } //~ ERROR tuple struct `C` is private +LL | match c { other::C(_, _b) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:114:22 | -LL | match c { other::C(_a, _b) => {} } //~ ERROR tuple struct `C` is private +LL | match c { other::C(_a, _b) => {} } | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:122:21 | -LL | let a2 = other::A; //~ ERROR tuple struct `A` is private +LL | let a2 = other::A; | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:123:21 | -LL | let b2 = other::B; //~ ERROR tuple struct `B` is private +LL | let b2 = other::B; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:124:21 | -LL | let c2 = other::C; //~ ERROR tuple struct `C` is private +LL | let c2 = other::C; | ^ error: aborting due to 48 previous errors diff --git a/src/test/ui/privacy/private-impl-method.stderr b/src/test/ui/privacy/private-impl-method.stderr index 8e254b15c789..e1da3f47a4ef 100644 --- a/src/test/ui/privacy/private-impl-method.stderr +++ b/src/test/ui/privacy/private-impl-method.stderr @@ -1,7 +1,7 @@ error[E0624]: method `foo` is private --> $DIR/private-impl-method.rs:20:7 | -LL | s.foo(); //~ ERROR method `foo` is private +LL | s.foo(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/private-in-public-assoc-ty.stderr b/src/test/ui/privacy/private-in-public-assoc-ty.stderr index 0e5dab1a08c3..a610b4759231 100644 --- a/src/test/ui/privacy/private-in-public-assoc-ty.stderr +++ b/src/test/ui/privacy/private-in-public-assoc-ty.stderr @@ -2,9 +2,9 @@ warning: private trait `m::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-assoc-ty.rs:15:5 | LL | / pub trait PubTr { -LL | | //~^ WARN private trait `m::PrivTr` in public interface -LL | | //~| WARN this was previously accepted -LL | | //~| WARN private type `m::Priv` in public interface +LL | | +LL | | +LL | | ... | LL | | fn infer_exist() -> Self::Exist; LL | | } @@ -18,9 +18,9 @@ warning: private type `m::Priv` in public interface (error E0446) --> $DIR/private-in-public-assoc-ty.rs:15:5 | LL | / pub trait PubTr { -LL | | //~^ WARN private trait `m::PrivTr` in public interface -LL | | //~| WARN this was previously accepted -LL | | //~| WARN private type `m::Priv` in public interface +LL | | +LL | | +LL | | ... | LL | | fn infer_exist() -> Self::Exist; LL | | } diff --git a/src/test/ui/privacy/private-in-public-ill-formed.stderr b/src/test/ui/privacy/private-in-public-ill-formed.stderr index ab6531cc748e..a1a326f2873e 100644 --- a/src/test/ui/privacy/private-in-public-ill-formed.stderr +++ b/src/test/ui/privacy/private-in-public-ill-formed.stderr @@ -1,7 +1,7 @@ error[E0118]: no base type found for inherent implementation --> $DIR/private-in-public-ill-formed.rs:14:10 | -LL | impl ::AssocAlias { //~ ERROR no base type found for inherent implementation +LL | impl ::AssocAlias { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a base type | = note: either implement a trait on it or create a newtype to wrap it instead @@ -9,7 +9,7 @@ LL | impl ::AssocAlias { //~ ERROR no base type found for in error[E0118]: no base type found for inherent implementation --> $DIR/private-in-public-ill-formed.rs:30:10 | -LL | impl ::AssocAlias { //~ ERROR no base type found for inherent implementation +LL | impl ::AssocAlias { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a base type | = note: either implement a trait on it or create a newtype to wrap it instead diff --git a/src/test/ui/privacy/private-in-public-lint.stderr b/src/test/ui/privacy/private-in-public-lint.stderr index 730ac24d5e54..441a4d5cffd4 100644 --- a/src/test/ui/privacy/private-in-public-lint.stderr +++ b/src/test/ui/privacy/private-in-public-lint.stderr @@ -4,7 +4,7 @@ error[E0446]: private type `m1::Priv` in public interface LL | struct Priv; | - `m1::Priv` declared as private ... -LL | pub fn f() -> Priv {Priv} //~ ERROR private type `m1::Priv` in public interface +LL | pub fn f() -> Priv {Priv} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `m2::Priv` in public interface @@ -13,7 +13,7 @@ error[E0446]: private type `m2::Priv` in public interface LL | struct Priv; | - `m2::Priv` declared as private ... -LL | pub fn f() -> Priv {Priv} //~ ERROR private type `m2::Priv` in public interface +LL | pub fn f() -> Priv {Priv} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error: aborting due to 2 previous errors diff --git a/src/test/ui/privacy/private-in-public-non-principal.stderr b/src/test/ui/privacy/private-in-public-non-principal.stderr index 996740558977..729b94ed8926 100644 --- a/src/test/ui/privacy/private-in-public-non-principal.stderr +++ b/src/test/ui/privacy/private-in-public-non-principal.stderr @@ -11,7 +11,7 @@ LL | pub fn leak_dyn_nonprincipal() -> Box { lo error: missing documentation for a method --> $DIR/private-in-public-non-principal.rs:13:9 | -LL | pub fn check_doc_lint() {} //~ ERROR missing documentation for a method +LL | pub fn check_doc_lint() {} | ^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/privacy/private-in-public-warn.stderr b/src/test/ui/privacy/private-in-public-warn.stderr index 621d9a57fa07..16b7e5103283 100644 --- a/src/test/ui/privacy/private-in-public-warn.stderr +++ b/src/test/ui/privacy/private-in-public-warn.stderr @@ -1,7 +1,7 @@ error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:15:5 | -LL | pub type Alias = Priv; //~ ERROR private type `types::Priv` in public interface +LL | pub type Alias = Priv; | ^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -15,7 +15,7 @@ LL | #![deny(private_in_public)] error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:18:12 | -LL | V1(Priv), //~ ERROR private type `types::Priv` in public interface +LL | V1(Priv), | ^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -24,7 +24,7 @@ LL | V1(Priv), //~ ERROR private type `types::Priv` in public interface error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:20:14 | -LL | V2 { field: Priv }, //~ ERROR private type `types::Priv` in public interface +LL | V2 { field: Priv }, | ^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -33,7 +33,7 @@ LL | V2 { field: Priv }, //~ ERROR private type `types::Priv` in public error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:24:9 | -LL | const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface +LL | const C: Priv = Priv; | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -45,13 +45,13 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | type Alias = Priv; //~ ERROR private type `types::Priv` in public interface +LL | type Alias = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:27:9 | -LL | fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface +LL | fn f1(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -60,7 +60,7 @@ LL | fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:29:9 | -LL | fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface +LL | fn f2() -> Priv { panic!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -69,7 +69,7 @@ LL | fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` i error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:33:9 | -LL | pub static ES: Priv; //~ ERROR private type `types::Priv` in public interface +LL | pub static ES: Priv; | ^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -78,7 +78,7 @@ LL | pub static ES: Priv; //~ ERROR private type `types::Priv` in public error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:35:9 | -LL | pub fn ef1(arg: Priv); //~ ERROR private type `types::Priv` in public interface +LL | pub fn ef1(arg: Priv); | ^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -87,7 +87,7 @@ LL | pub fn ef1(arg: Priv); //~ ERROR private type `types::Priv` in publ error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:37:9 | -LL | pub fn ef2() -> Priv; //~ ERROR private type `types::Priv` in public interface +LL | pub fn ef2() -> Priv; | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -99,13 +99,13 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | type Alias = Priv; //~ ERROR private type `types::Priv` in public interface +LL | type Alias = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:50:5 | -LL | pub type Alias = T; //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub type Alias = T; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -114,7 +114,7 @@ LL | pub type Alias = T; //~ ERROR private trait `traits::PrivTr` error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:53:5 | -LL | pub trait Tr1: PrivTr {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub trait Tr1: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -123,7 +123,7 @@ LL | pub trait Tr1: PrivTr {} //~ ERROR private trait `traits::PrivTr` in pu error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:55:5 | -LL | pub trait Tr2 {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub trait Tr2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -133,11 +133,11 @@ error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:57:5 | LL | / pub trait Tr3 { -LL | | //~^ ERROR private trait `traits::PrivTr` in public interface -LL | | //~| WARNING hard error +LL | | +LL | | LL | | type Alias: PrivTr; -LL | | fn f(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface -LL | | //~^ WARNING hard error +LL | | fn f(arg: T) {} +LL | | LL | | } | |_____^ | @@ -147,7 +147,7 @@ LL | | } error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:61:9 | -LL | fn f(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | fn f(arg: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -156,7 +156,7 @@ LL | fn f(arg: T) {} //~ ERROR private trait `traits::PrivTr` error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:64:5 | -LL | impl Pub {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | impl Pub {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -165,7 +165,7 @@ LL | impl Pub {} //~ ERROR private trait `traits::PrivTr` in p error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:66:5 | -LL | impl PubTr for Pub {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | impl PubTr for Pub {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -228,7 +228,7 @@ LL | pub trait Tr1: PrivTr {} error: private type `generics::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:104:5 | -LL | pub trait Tr2: PubTr {} //~ ERROR private type `generics::Priv` in public interface +LL | pub trait Tr2: PubTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -237,7 +237,7 @@ LL | pub trait Tr2: PubTr {} //~ ERROR private type `generics::Priv` i error: private type `generics::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:106:5 | -LL | pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR private type `generics::Priv` in public interface +LL | pub trait Tr3: PubTr<[Priv; 1]> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -246,7 +246,7 @@ LL | pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR private type `generics::Pr error: private type `generics::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:108:5 | -LL | pub trait Tr4: PubTr> {} //~ ERROR private type `generics::Priv` in public interface +LL | pub trait Tr4: PubTr> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -258,13 +258,13 @@ error[E0446]: private type `impls::Priv` in public interface LL | struct Priv; | - `impls::Priv` declared as private ... -LL | type Alias = Priv; //~ ERROR private type `impls::Priv` in public interface +LL | type Alias = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private type `aliases_pub::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:206:9 | -LL | pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface +LL | pub fn f(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -276,7 +276,7 @@ error[E0446]: private type `aliases_pub::Priv` in public interface LL | struct Priv; | - `aliases_pub::Priv` declared as private ... -LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface +LL | type Check = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface @@ -285,7 +285,7 @@ error[E0446]: private type `aliases_pub::Priv` in public interface LL | struct Priv; | - `aliases_pub::Priv` declared as private ... -LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface +LL | type Check = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface @@ -294,7 +294,7 @@ error[E0446]: private type `aliases_pub::Priv` in public interface LL | struct Priv; | - `aliases_pub::Priv` declared as private ... -LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface +LL | type Check = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface @@ -303,7 +303,7 @@ error[E0446]: private type `aliases_pub::Priv` in public interface LL | struct Priv; | - `aliases_pub::Priv` declared as private ... -LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface +LL | type Check = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private trait `aliases_priv::PrivTr1` in public interface (error E0445) @@ -336,7 +336,7 @@ LL | pub trait Tr2: PrivUseAliasTr {} warning: bounds on generic parameters are not enforced in type aliases --> $DIR/private-in-public-warn.rs:50:23 | -LL | pub type Alias = T; //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub type Alias = T; | ^^^^^^ | = note: #[warn(type_alias_bounds)] on by default diff --git a/src/test/ui/privacy/private-in-public.stderr b/src/test/ui/privacy/private-in-public.stderr index bf88a83e633c..3c57e50cfedf 100644 --- a/src/test/ui/privacy/private-in-public.stderr +++ b/src/test/ui/privacy/private-in-public.stderr @@ -4,7 +4,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface +LL | pub const C: Priv = Priv; | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -13,7 +13,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub static S: Priv = Priv; //~ ERROR private type `types::Priv` in public interface +LL | pub static S: Priv = Priv; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -22,7 +22,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface +LL | pub fn f1(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -31,7 +31,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface +LL | pub fn f2() -> Priv { panic!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -40,7 +40,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub struct S1(pub Priv); //~ ERROR private type `types::Priv` in public interface +LL | pub struct S1(pub Priv); | ^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -49,7 +49,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub struct S2 { pub field: Priv } //~ ERROR private type `types::Priv` in public interface +LL | pub struct S2 { pub field: Priv } | ^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -58,7 +58,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface +LL | pub const C: Priv = Priv; | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -67,7 +67,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface +LL | pub fn f1(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -76,7 +76,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface +LL | pub fn f2() -> Priv { panic!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0445]: private trait `traits::PrivTr` in public interface @@ -85,7 +85,7 @@ error[E0445]: private trait `traits::PrivTr` in public interface LL | trait PrivTr {} | - `traits::PrivTr` declared as private ... -LL | pub enum E { V(T) } //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub enum E { V(T) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface @@ -94,7 +94,7 @@ error[E0445]: private trait `traits::PrivTr` in public interface LL | trait PrivTr {} | - `traits::PrivTr` declared as private ... -LL | pub fn f(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub fn f(arg: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface @@ -103,7 +103,7 @@ error[E0445]: private trait `traits::PrivTr` in public interface LL | trait PrivTr {} | - `traits::PrivTr` declared as private ... -LL | pub struct S1(T); //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub struct S1(T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface @@ -112,8 +112,8 @@ error[E0445]: private trait `traits::PrivTr` in public interface LL | trait PrivTr {} | - `traits::PrivTr` declared as private ... -LL | / impl Pub { //~ ERROR private trait `traits::PrivTr` in public interface -LL | | pub fn f(arg: U) {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | / impl Pub { +LL | | pub fn f(arg: U) {} LL | | } | |_____^ can't leak private trait @@ -123,7 +123,7 @@ error[E0445]: private trait `traits::PrivTr` in public interface LL | trait PrivTr {} | - `traits::PrivTr` declared as private ... -LL | pub fn f(arg: U) {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub fn f(arg: U) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface @@ -160,9 +160,9 @@ LL | trait PrivTr {} | - `traits_where::PrivTr` declared as private ... LL | / impl Pub where T: PrivTr { -LL | | //~^ ERROR private trait `traits_where::PrivTr` in public interface +LL | | LL | | pub fn f(arg: U) where U: PrivTr {} -LL | | //~^ ERROR private trait `traits_where::PrivTr` in public interface +LL | | LL | | } | |_____^ can't leak private trait @@ -181,7 +181,7 @@ error[E0446]: private type `generics::Priv` in public interface LL | struct Priv(T); | - `generics::Priv` declared as private ... -LL | pub fn f1(arg: [Priv; 1]) {} //~ ERROR private type `generics::Priv` in public interface +LL | pub fn f1(arg: [Priv; 1]) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `generics::Priv` in public interface @@ -190,7 +190,7 @@ error[E0446]: private type `generics::Priv` in public interface LL | struct Priv(T); | - `generics::Priv` declared as private ... -LL | pub fn f2(arg: Pub) {} //~ ERROR private type `generics::Priv` in public interface +LL | pub fn f2(arg: Pub) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `generics::Priv` in public interface @@ -208,7 +208,7 @@ error[E0446]: private type `impls::Priv` in public interface LL | struct Priv; | - `impls::Priv` declared as private ... -LL | pub fn f(arg: Priv) {} //~ ERROR private type `impls::Priv` in public interface +LL | pub fn f(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0445]: private trait `aliases_pub::PrivTr` in public interface @@ -235,7 +235,7 @@ error[E0446]: private type `aliases_pub::Priv` in public interface LL | struct Priv; | - `aliases_pub::Priv` declared as private ... -LL | pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface +LL | pub fn f(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_priv::Priv1` in public interface @@ -244,7 +244,7 @@ error[E0446]: private type `aliases_priv::Priv1` in public interface LL | struct Priv1; | - `aliases_priv::Priv1` declared as private ... -LL | pub fn f1(arg: PrivUseAlias) {} //~ ERROR private type `aliases_priv::Priv1` in public interface +LL | pub fn f1(arg: PrivUseAlias) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_priv::Priv2` in public interface @@ -253,7 +253,7 @@ error[E0446]: private type `aliases_priv::Priv2` in public interface LL | struct Priv2; | - `aliases_priv::Priv2` declared as private ... -LL | pub fn f2(arg: PrivAlias) {} //~ ERROR private type `aliases_priv::Priv2` in public interface +LL | pub fn f2(arg: PrivAlias) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0445]: private trait `aliases_priv::PrivTr` in public interface @@ -289,7 +289,7 @@ error[E0446]: private type `aliases_params::Priv` in public interface LL | struct Priv; | - `aliases_params::Priv` declared as private ... -LL | pub fn f3(arg: Result) {} //~ ERROR private type `aliases_params::Priv` in public interface +LL | pub fn f3(arg: Result) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error: aborting due to 32 previous errors diff --git a/src/test/ui/privacy/private-inferred-type-1.stderr b/src/test/ui/privacy/private-inferred-type-1.stderr index 06df7e847837..097b8b9a61ef 100644 --- a/src/test/ui/privacy/private-inferred-type-1.stderr +++ b/src/test/ui/privacy/private-inferred-type-1.stderr @@ -1,13 +1,13 @@ error: type `m::Priv` is private --> $DIR/private-inferred-type-1.rs:16:5 | -LL | [].arr0_secret(); //~ ERROR type `m::Priv` is private +LL | [].arr0_secret(); | ^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type-1.rs:17:5 | -LL | None.ty_param_secret(); //~ ERROR type `m::Priv` is private +LL | None.ty_param_secret(); | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/privacy/private-inferred-type-2.stderr b/src/test/ui/privacy/private-inferred-type-2.stderr index 7a3f52fa05df..da95cc49241a 100644 --- a/src/test/ui/privacy/private-inferred-type-2.stderr +++ b/src/test/ui/privacy/private-inferred-type-2.stderr @@ -1,19 +1,19 @@ error: type `m::Priv` is private --> $DIR/private-inferred-type-2.rs:16:5 | -LL | m::Pub::get_priv; //~ ERROR type `m::Priv` is private +LL | m::Pub::get_priv; | ^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type-2.rs:17:5 | -LL | m::Pub::static_method; //~ ERROR type `m::Priv` is private +LL | m::Pub::static_method; | ^^^^^^^^^^^^^^^^^^^^^ error: type `ext::Priv` is private --> $DIR/private-inferred-type-2.rs:18:5 | -LL | ext::Pub::static_method; //~ ERROR type `ext::Priv` is private +LL | ext::Pub::static_method; | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/privacy/private-inferred-type.stderr b/src/test/ui/privacy/private-inferred-type.stderr index 568d4dadc8cc..baa98292b67b 100644 --- a/src/test/ui/privacy/private-inferred-type.stderr +++ b/src/test/ui/privacy/private-inferred-type.stderr @@ -13,103 +13,103 @@ error[E0446]: private type `adjust::S2` in public interface LL | struct S2; | - `adjust::S2` declared as private ... -LL | type Target = S2Alias; //~ ERROR private type `adjust::S2` in public interface +LL | type Target = S2Alias; | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:97:9 | -LL | let _: m::Alias; //~ ERROR type `m::Priv` is private +LL | let _: m::Alias; | ^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:97:12 | -LL | let _: m::Alias; //~ ERROR type `m::Priv` is private +LL | let _: m::Alias; | ^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:99:13 | -LL | let _: ::AssocTy; //~ ERROR type `m::Priv` is private +LL | let _: ::AssocTy; | ^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:100:5 | -LL | m::Alias {}; //~ ERROR type `m::Priv` is private +LL | m::Alias {}; | ^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:101:5 | -LL | m::Pub { 0: m::Alias {} }; //~ ERROR type `m::Priv` is private +LL | m::Pub { 0: m::Alias {} }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:103:5 | -LL | m::Pub::static_method; //~ ERROR type `m::Priv` is private +LL | m::Pub::static_method; | ^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:104:5 | -LL | m::Pub::INHERENT_ASSOC_CONST; //~ ERROR type `m::Priv` is private +LL | m::Pub::INHERENT_ASSOC_CONST; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:105:5 | -LL | m::Pub(0u8).method_with_substs::(); //~ ERROR type `m::Priv` is private +LL | m::Pub(0u8).method_with_substs::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:106:17 | -LL | m::Pub(0u8).method_with_priv_params(loop{}); //~ ERROR type `m::Priv` is private +LL | m::Pub(0u8).method_with_priv_params(loop{}); | ^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:107:5 | -LL | ::TRAIT_ASSOC_CONST; //~ ERROR type `m::Priv` is private +LL | ::TRAIT_ASSOC_CONST; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:108:6 | -LL | >::INHERENT_ASSOC_CONST; //~ ERROR type `m::Priv` is private +LL | >::INHERENT_ASSOC_CONST; | ^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:109:5 | -LL | >::INHERENT_ASSOC_CONST_GENERIC_SELF; //~ ERROR type `m::Priv` is private +LL | >::INHERENT_ASSOC_CONST_GENERIC_SELF; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:110:5 | -LL | >::static_method_generic_self; //~ ERROR type `m::Priv` is private +LL | >::static_method_generic_self; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:112:5 | -LL | u8::pub_method; //~ ERROR type `m::Priv` is private +LL | u8::pub_method; | ^^^^^^^^^^^^^^ error: type `adjust::S2` is private --> $DIR/private-inferred-type.rs:114:5 | -LL | adjust::S1.method_s3(); //~ ERROR type `adjust::S2` is private +LL | adjust::S1.method_s3(); | ^^^^^^^^^^ error: type `fn() {m::priv_fn}` is private --> $DIR/private-inferred-type.rs:39:9 | -LL | priv_fn; //~ ERROR type `fn() {m::priv_fn}` is private +LL | priv_fn; | ^^^^^^^ ... LL | m::m!(); @@ -118,7 +118,7 @@ LL | m::m!(); error: type `m::PrivEnum` is private --> $DIR/private-inferred-type.rs:41:9 | -LL | PrivEnum::Variant; //~ ERROR type `m::PrivEnum` is private +LL | PrivEnum::Variant; | ^^^^^^^^^^^^^^^^^ ... LL | m::m!(); @@ -127,7 +127,7 @@ LL | m::m!(); error: type `fn() {::method}` is private --> $DIR/private-inferred-type.rs:43:9 | -LL | ::method; //~ ERROR type `fn() {::method}` is private +LL | ::method; | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | m::m!(); @@ -163,61 +163,61 @@ LL | m::m!(); error: trait `m::Trait` is private --> $DIR/private-inferred-type.rs:118:5 | -LL | m::leak_anon1(); //~ ERROR trait `m::Trait` is private +LL | m::leak_anon1(); | ^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:119:5 | -LL | m::leak_anon2(); //~ ERROR type `m::Priv` is private +LL | m::leak_anon2(); | ^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:120:5 | -LL | m::leak_anon3(); //~ ERROR type `m::Priv` is private +LL | m::leak_anon3(); | ^^^^^^^^^^^^^^^ error: trait `m::Trait` is private --> $DIR/private-inferred-type.rs:122:5 | -LL | m::leak_dyn1(); //~ ERROR trait `m::Trait` is private +LL | m::leak_dyn1(); | ^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:123:5 | -LL | m::leak_dyn2(); //~ ERROR type `m::Priv` is private +LL | m::leak_dyn2(); | ^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:124:5 | -LL | m::leak_dyn3(); //~ ERROR type `m::Priv` is private +LL | m::leak_dyn3(); | ^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:127:13 | -LL | let a = m::Alias {}; //~ ERROR type `m::Priv` is private +LL | let a = m::Alias {}; | ^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:128:17 | -LL | let mut b = a; //~ ERROR type `m::Priv` is private +LL | let mut b = a; | ^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:129:9 | -LL | b = a; //~ ERROR type `m::Priv` is private +LL | b = a; | ^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:130:11 | -LL | match a { //~ ERROR type `m::Priv` is private +LL | match a { | ^ error: aborting due to 33 previous errors diff --git a/src/test/ui/privacy/private-item-simple.stderr b/src/test/ui/privacy/private-item-simple.stderr index 2ac694f35d46..0d5435e1c504 100644 --- a/src/test/ui/privacy/private-item-simple.stderr +++ b/src/test/ui/privacy/private-item-simple.stderr @@ -1,7 +1,7 @@ error[E0603]: function `f` is private --> $DIR/private-item-simple.rs:6:8 | -LL | a::f(); //~ ERROR function `f` is private +LL | a::f(); | ^ error: aborting due to previous error diff --git a/src/test/ui/privacy/private-method-cross-crate.stderr b/src/test/ui/privacy/private-method-cross-crate.stderr index bd28f2e5a8ba..10e0bfe5b136 100644 --- a/src/test/ui/privacy/private-method-cross-crate.stderr +++ b/src/test/ui/privacy/private-method-cross-crate.stderr @@ -1,7 +1,7 @@ error[E0624]: method `nap` is private --> $DIR/private-method-cross-crate.rs:7:8 | -LL | nyan.nap(); //~ ERROR method `nap` is private +LL | nyan.nap(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/private-method-inherited.stderr b/src/test/ui/privacy/private-method-inherited.stderr index 30c1e99ceddb..d2ba591ef0cc 100644 --- a/src/test/ui/privacy/private-method-inherited.stderr +++ b/src/test/ui/privacy/private-method-inherited.stderr @@ -1,7 +1,7 @@ error[E0624]: method `f` is private --> $DIR/private-method-inherited.rs:13:7 | -LL | x.f(); //~ ERROR method `f` is private +LL | x.f(); | ^ error: aborting due to previous error diff --git a/src/test/ui/privacy/private-method.stderr b/src/test/ui/privacy/private-method.stderr index 64820e5ea8c7..61fc122e318e 100644 --- a/src/test/ui/privacy/private-method.stderr +++ b/src/test/ui/privacy/private-method.stderr @@ -1,7 +1,7 @@ error[E0624]: method `nap` is private --> $DIR/private-method.rs:22:8 | -LL | nyan.nap(); //~ ERROR method `nap` is private +LL | nyan.nap(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/private-struct-field-ctor.stderr b/src/test/ui/privacy/private-struct-field-ctor.stderr index 943abeed114c..97585c1d8805 100644 --- a/src/test/ui/privacy/private-struct-field-ctor.stderr +++ b/src/test/ui/privacy/private-struct-field-ctor.stderr @@ -1,7 +1,7 @@ error[E0451]: field `x` of struct `a::Foo` is private --> $DIR/private-struct-field-ctor.rs:8:22 | -LL | let s = a::Foo { x: 1 }; //~ ERROR field `x` of struct `a::Foo` is private +LL | let s = a::Foo { x: 1 }; | ^^^^ field `x` is private error: aborting due to previous error diff --git a/src/test/ui/privacy/private-struct-field-pattern.stderr b/src/test/ui/privacy/private-struct-field-pattern.stderr index 05e6d3d72431..69bd58aacfc5 100644 --- a/src/test/ui/privacy/private-struct-field-pattern.stderr +++ b/src/test/ui/privacy/private-struct-field-pattern.stderr @@ -1,7 +1,7 @@ error[E0451]: field `x` of struct `a::Foo` is private --> $DIR/private-struct-field-pattern.rs:15:15 | -LL | Foo { x: _ } => {} //~ ERROR field `x` of struct `a::Foo` is private +LL | Foo { x: _ } => {} | ^^^^ field `x` is private error: aborting due to previous error diff --git a/src/test/ui/privacy/private-struct-field.stderr b/src/test/ui/privacy/private-struct-field.stderr index 7cb6d6ab4d7e..da53c73b4311 100644 --- a/src/test/ui/privacy/private-struct-field.stderr +++ b/src/test/ui/privacy/private-struct-field.stderr @@ -1,7 +1,7 @@ error[E0616]: field `meows` of struct `cat::Cat` is private --> $DIR/private-struct-field.rs:13:16 | -LL | assert_eq!(nyan.meows, 52); //~ ERROR field `meows` of struct `cat::Cat` is private +LL | assert_eq!(nyan.meows, 52); | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/private-type-in-interface.stderr b/src/test/ui/privacy/private-type-in-interface.stderr index b436f20fce98..aa4bfb7fc9a1 100644 --- a/src/test/ui/privacy/private-type-in-interface.stderr +++ b/src/test/ui/privacy/private-type-in-interface.stderr @@ -1,55 +1,55 @@ error: type `m::Priv` is private --> $DIR/private-type-in-interface.rs:15:9 | -LL | fn f(_: m::Alias) {} //~ ERROR type `m::Priv` is private +LL | fn f(_: m::Alias) {} | ^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-type-in-interface.rs:15:6 | -LL | fn f(_: m::Alias) {} //~ ERROR type `m::Priv` is private +LL | fn f(_: m::Alias) {} | ^ error: type `ext::Priv` is private --> $DIR/private-type-in-interface.rs:17:13 | -LL | fn f_ext(_: ext::Alias) {} //~ ERROR type `ext::Priv` is private +LL | fn f_ext(_: ext::Alias) {} | ^^^^^^^^^^ error: type `ext::Priv` is private --> $DIR/private-type-in-interface.rs:17:10 | -LL | fn f_ext(_: ext::Alias) {} //~ ERROR type `ext::Priv` is private +LL | fn f_ext(_: ext::Alias) {} | ^ error: type `m::Priv` is private --> $DIR/private-type-in-interface.rs:21:6 | -LL | impl m::Alias {} //~ ERROR type `m::Priv` is private +LL | impl m::Alias {} | ^^^^^^^^ error: type `ext::Priv` is private --> $DIR/private-type-in-interface.rs:22:14 | -LL | impl Tr1 for ext::Alias {} //~ ERROR type `ext::Priv` is private +LL | impl Tr1 for ext::Alias {} | ^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-type-in-interface.rs:23:10 | -LL | type A = ::X; //~ ERROR type `m::Priv` is private +LL | type A = ::X; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-type-in-interface.rs:27:11 | -LL | fn g() -> impl Tr2 { 0 } //~ ERROR type `m::Priv` is private +LL | fn g() -> impl Tr2 { 0 } | ^^^^^^^^^^^^^^^^^^ error: type `ext::Priv` is private --> $DIR/private-type-in-interface.rs:28:15 | -LL | fn g_ext() -> impl Tr2 { 0 } //~ ERROR type `ext::Priv` is private +LL | fn g_ext() -> impl Tr2 { 0 } | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/privacy/private-variant-reexport.stderr b/src/test/ui/privacy/private-variant-reexport.stderr index 99f4a41272cd..8e4c34528624 100644 --- a/src/test/ui/privacy/private-variant-reexport.stderr +++ b/src/test/ui/privacy/private-variant-reexport.stderr @@ -1,7 +1,7 @@ error: variant `V` is private and cannot be re-exported --> $DIR/private-variant-reexport.rs:2:13 | -LL | pub use ::E::V; //~ ERROR variant `V` is private and cannot be re-exported +LL | pub use ::E::V; | ^^^^^^ ... LL | enum E { V } @@ -10,19 +10,19 @@ LL | enum E { V } error: variant `V` is private and cannot be re-exported --> $DIR/private-variant-reexport.rs:6:19 | -LL | pub use ::E::{V}; //~ ERROR variant `V` is private and cannot be re-exported +LL | pub use ::E::{V}; | ^ error: variant `V` is private and cannot be re-exported --> $DIR/private-variant-reexport.rs:10:22 | -LL | pub use ::E::V::{self}; //~ ERROR variant `V` is private and cannot be re-exported +LL | pub use ::E::V::{self}; | ^^^^ error: enum is private and its variants cannot be re-exported --> $DIR/private-variant-reexport.rs:14:13 | -LL | pub use ::E::*; //~ ERROR enum is private and its variants cannot be re-exported +LL | pub use ::E::*; | ^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/privacy/restricted/private-in-public.stderr b/src/test/ui/privacy/restricted/private-in-public.stderr index 2fb7059e0d40..87c96d31f092 100644 --- a/src/test/ui/privacy/restricted/private-in-public.stderr +++ b/src/test/ui/privacy/restricted/private-in-public.stderr @@ -4,7 +4,7 @@ error[E0446]: private type `foo::Priv` in public interface LL | struct Priv; | - `foo::Priv` declared as private ... -LL | pub(crate) fn g(_: Priv) {} //~ ERROR E0446 +LL | pub(crate) fn g(_: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `foo::Priv` in public interface @@ -13,7 +13,7 @@ error[E0446]: private type `foo::Priv` in public interface LL | struct Priv; | - `foo::Priv` declared as private ... -LL | crate fn h(_: Priv) {} //~ ERROR E0446 +LL | crate fn h(_: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error: aborting due to 2 previous errors diff --git a/src/test/ui/privacy/restricted/struct-literal-field.stderr b/src/test/ui/privacy/restricted/struct-literal-field.stderr index 0109cae91a0c..dd609944a4b3 100644 --- a/src/test/ui/privacy/restricted/struct-literal-field.stderr +++ b/src/test/ui/privacy/restricted/struct-literal-field.stderr @@ -1,7 +1,7 @@ error[E0451]: field `x` of struct `foo::bar::S` is private --> $DIR/struct-literal-field.rs:18:9 | -LL | S { x: 0 }; //~ ERROR private +LL | S { x: 0 }; | ^^^^ field `x` is private error: aborting due to previous error diff --git a/src/test/ui/privacy/restricted/test.stderr b/src/test/ui/privacy/restricted/test.stderr index 7539b0e1af4c..b4ef7b8e3f79 100644 --- a/src/test/ui/privacy/restricted/test.stderr +++ b/src/test/ui/privacy/restricted/test.stderr @@ -1,79 +1,79 @@ error[E0433]: failed to resolve: maybe a missing `extern crate bad;`? --> $DIR/test.rs:50:12 | -LL | pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: maybe a missing `extern crate bad;`? +LL | pub(in bad::path) mod m1 {} | ^^^ maybe a missing `extern crate bad;`? error: visibilities can only be restricted to ancestor modules --> $DIR/test.rs:51:12 | -LL | pub(in foo) mod m2 {} //~ ERROR visibilities can only be restricted to ancestor modules +LL | pub(in foo) mod m2 {} | ^^^ error[E0364]: `f` is private, and cannot be re-exported --> $DIR/test.rs:21:24 | -LL | pub(super) use foo::bar::f as g; //~ ERROR cannot be re-exported +LL | pub(super) use foo::bar::f as g; | ^^^^^^^^^^^^^^^^ | note: consider marking `f` as `pub` in the imported module --> $DIR/test.rs:21:24 | -LL | pub(super) use foo::bar::f as g; //~ ERROR cannot be re-exported +LL | pub(super) use foo::bar::f as g; | ^^^^^^^^^^^^^^^^ error[E0603]: struct `Crate` is private --> $DIR/test.rs:38:25 | -LL | use pub_restricted::Crate; //~ ERROR private +LL | use pub_restricted::Crate; | ^^^^^ error[E0603]: function `f` is private --> $DIR/test.rs:30:19 | -LL | use foo::bar::f; //~ ERROR private +LL | use foo::bar::f; | ^ error[E0616]: field `x` of struct `foo::bar::S` is private --> $DIR/test.rs:31:5 | -LL | S::default().x; //~ ERROR private +LL | S::default().x; | ^^^^^^^^^^^^^^ error[E0624]: method `f` is private --> $DIR/test.rs:32:18 | -LL | S::default().f(); //~ ERROR private +LL | S::default().f(); | ^ error[E0624]: method `g` is private --> $DIR/test.rs:33:5 | -LL | S::g(); //~ ERROR private +LL | S::g(); | ^^^^ error[E0616]: field `y` of struct `pub_restricted::Universe` is private --> $DIR/test.rs:42:13 | -LL | let _ = u.y; //~ ERROR private +LL | let _ = u.y; | ^^^ error[E0616]: field `z` of struct `pub_restricted::Universe` is private --> $DIR/test.rs:43:13 | -LL | let _ = u.z; //~ ERROR private +LL | let _ = u.z; | ^^^ error[E0624]: method `g` is private --> $DIR/test.rs:45:7 | -LL | u.g(); //~ ERROR private +LL | u.g(); | ^ error[E0624]: method `h` is private --> $DIR/test.rs:46:7 | -LL | u.h(); //~ ERROR private +LL | u.h(); | ^ error: aborting due to 12 previous errors diff --git a/src/test/ui/privacy/union-field-privacy-1.stderr b/src/test/ui/privacy/union-field-privacy-1.stderr index d31360dbe651..96a1d7ed5090 100644 --- a/src/test/ui/privacy/union-field-privacy-1.stderr +++ b/src/test/ui/privacy/union-field-privacy-1.stderr @@ -1,13 +1,13 @@ error[E0451]: field `c` of union `m::U` is private --> $DIR/union-field-privacy-1.rs:12:20 | -LL | let u = m::U { c: 0 }; //~ ERROR field `c` of union `m::U` is private +LL | let u = m::U { c: 0 }; | ^^^^ field `c` is private error[E0451]: field `c` of union `m::U` is private --> $DIR/union-field-privacy-1.rs:16:16 | -LL | let m::U { c } = u; //~ ERROR field `c` of union `m::U` is private +LL | let m::U { c } = u; | ^ field `c` is private error: aborting due to 2 previous errors diff --git a/src/test/ui/privacy/union-field-privacy-2.stderr b/src/test/ui/privacy/union-field-privacy-2.stderr index bd2c834c966d..df054b8cff8a 100644 --- a/src/test/ui/privacy/union-field-privacy-2.stderr +++ b/src/test/ui/privacy/union-field-privacy-2.stderr @@ -1,7 +1,7 @@ error[E0616]: field `c` of struct `m::U` is private --> $DIR/union-field-privacy-2.rs:14:13 | -LL | let c = u.c; //~ ERROR field `c` of struct `m::U` is private +LL | let c = u.c; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.stderr b/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.stderr index db07055b6a10..316eb636ba82 100644 --- a/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.stderr +++ b/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `NonExistent` in this scope --> $DIR/ambiguous-builtin-attrs-test.rs:19:5 | -LL | NonExistent; //~ ERROR cannot find value `NonExistent` in this scope +LL | NonExistent; | ^^^^^^^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr b/src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr index 79dc922b9db2..975be7ce03b8 100644 --- a/src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr +++ b/src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr @@ -1,13 +1,13 @@ error[E0425]: cannot find value `NonExistent` in this scope --> $DIR/ambiguous-builtin-attrs.rs:30:5 | -LL | NonExistent; //~ ERROR cannot find value `NonExistent` in this scope +LL | NonExistent; | ^^^^^^^^^^^ not found in this scope error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:9:3 | -LL | #[repr(C)] //~ ERROR `repr` is ambiguous +LL | #[repr(C)] | ^^^^ ambiguous name | = note: `repr` could refer to a built-in attribute @@ -21,7 +21,7 @@ LL | use builtin_attrs::*; error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:11:19 | -LL | #[cfg_attr(all(), repr(C))] //~ ERROR `repr` is ambiguous +LL | #[cfg_attr(all(), repr(C))] | ^^^^ ambiguous name | = note: `repr` could refer to a built-in attribute @@ -35,7 +35,7 @@ LL | use builtin_attrs::*; error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:20:34 | -LL | fn non_macro_expanded_location<#[repr(C)] T>() { //~ ERROR `repr` is ambiguous +LL | fn non_macro_expanded_location<#[repr(C)] T>() { | ^^^^ ambiguous name | = note: `repr` could refer to a built-in attribute @@ -49,7 +49,7 @@ LL | use builtin_attrs::*; error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:22:11 | -LL | #[repr(C)] //~ ERROR `repr` is ambiguous +LL | #[repr(C)] | ^^^^ ambiguous name | = note: `repr` could refer to a built-in attribute @@ -63,7 +63,7 @@ LL | use builtin_attrs::*; error[E0659]: `feature` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:3:4 | -LL | #![feature(decl_macro)] //~ ERROR `feature` is ambiguous +LL | #![feature(decl_macro)] | ^^^^^^^ ambiguous name | = note: `feature` could refer to a built-in attribute diff --git a/src/test/ui/proc-macro/attribute-order-restricted.stderr b/src/test/ui/proc-macro/attribute-order-restricted.stderr index a4f165cd1b52..39db45cf569a 100644 --- a/src/test/ui/proc-macro/attribute-order-restricted.stderr +++ b/src/test/ui/proc-macro/attribute-order-restricted.stderr @@ -1,7 +1,7 @@ error: macro attributes must be placed before `#[derive]` --> $DIR/attribute-order-restricted.rs:11:1 | -LL | #[attr_proc_macro] //~ ERROR macro attributes must be placed before `#[derive]` +LL | #[attr_proc_macro] | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/proc-macro/attribute-spans-preserved.stderr b/src/test/ui/proc-macro/attribute-spans-preserved.stderr index 8371088c4c20..6c571dbdb476 100644 --- a/src/test/ui/proc-macro/attribute-spans-preserved.stderr +++ b/src/test/ui/proc-macro/attribute-spans-preserved.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/attribute-spans-preserved.rs:7:23 | -LL | #[ foo ( let y: u32 = "z"; ) ] //~ ERROR: mismatched types +LL | #[ foo ( let y: u32 = "z"; ) ] | ^^^ expected u32, found reference | = note: expected type `u32` @@ -10,7 +10,7 @@ LL | #[ foo ( let y: u32 = "z"; ) ] //~ ERROR: mismatched types error[E0308]: mismatched types --> $DIR/attribute-spans-preserved.rs:8:23 | -LL | #[ bar { let x: u32 = "y"; } ] //~ ERROR: mismatched types +LL | #[ bar { let x: u32 = "y"; } ] | ^^^ expected u32, found reference | = note: expected type `u32` diff --git a/src/test/ui/proc-macro/attributes-included.stderr b/src/test/ui/proc-macro/attributes-included.stderr index 87b6fb9539fb..fcd77b2d383d 100644 --- a/src/test/ui/proc-macro/attributes-included.stderr +++ b/src/test/ui/proc-macro/attributes-included.stderr @@ -1,7 +1,7 @@ warning: unused variable: `a` --> $DIR/attributes-included.rs:17:9 | -LL | let a: i32 = "foo"; //~ WARN: unused variable +LL | let a: i32 = "foo"; | ^ help: consider prefixing with an underscore: `_a` | note: lint level defined here diff --git a/src/test/ui/proc-macro/define-two.stderr b/src/test/ui/proc-macro/define-two.stderr index c74215f415e0..bf1bd8427c83 100644 --- a/src/test/ui/proc-macro/define-two.stderr +++ b/src/test/ui/proc-macro/define-two.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `A` is defined multiple times LL | #[proc_macro_derive(A)] | - previous definition of the macro `A` here ... -LL | #[proc_macro_derive(A)] //~ ERROR the name `A` is defined multiple times +LL | #[proc_macro_derive(A)] | ^ `A` redefined here | = note: `A` must be defined only once in the macro namespace of this module diff --git a/src/test/ui/proc-macro/derive-helper-shadowing.stderr b/src/test/ui/proc-macro/derive-helper-shadowing.stderr index 8180c84d3f6e..5f2009b384b1 100644 --- a/src/test/ui/proc-macro/derive-helper-shadowing.stderr +++ b/src/test/ui/proc-macro/derive-helper-shadowing.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `my_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/derive-helper-shadowing.rs:20:15 | -LL | #[my_attr] //~ ERROR attribute `my_attr` is currently unknown +LL | #[my_attr] | ^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[my_attr] //~ ERROR attribute `my_attr` is currently unknown error[E0659]: `my_attr` is ambiguous (derive helper attribute vs any other name) --> $DIR/derive-helper-shadowing.rs:6:3 | -LL | #[my_attr] //~ ERROR `my_attr` is ambiguous +LL | #[my_attr] | ^^^^^^^ ambiguous name | note: `my_attr` could refer to the derive helper attribute defined here diff --git a/src/test/ui/proc-macro/derive-still-gated.stderr b/src/test/ui/proc-macro/derive-still-gated.stderr index ece1b6212914..f7c8960372ec 100644 --- a/src/test/ui/proc-macro/derive-still-gated.stderr +++ b/src/test/ui/proc-macro/derive-still-gated.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `derive_A` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/derive-still-gated.rs:8:3 | -LL | #[derive_A] //~ ERROR attribute `derive_A` is currently unknown +LL | #[derive_A] | ^^^^^^^^ help: a built-in attribute with a similar name exists: `derive` | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/proc-macro/dollar-crate.stderr b/src/test/ui/proc-macro/dollar-crate.stderr index 08de3c7d1a66..d1b836e7f6f2 100644 --- a/src/test/ui/proc-macro/dollar-crate.stderr +++ b/src/test/ui/proc-macro/dollar-crate.stderr @@ -1,7 +1,7 @@ error[E0428]: the name `D` is defined multiple times --> $DIR/dollar-crate.rs:27:13 | -LL | struct D($crate::S); //~ ERROR the name `D` is defined multiple times +LL | struct D($crate::S); | ^^^^^^^^^^^^^^^^^^^^ | | | `D` redefined here @@ -15,7 +15,7 @@ LL | local!(); error[E0428]: the name `D` is defined multiple times --> $DIR/dollar-crate.rs:37:5 | -LL | dollar_crate_external::external!(); //~ ERROR the name `D` is defined multiple times +LL | dollar_crate_external::external!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | `D` redefined here diff --git a/src/test/ui/proc-macro/exports.stderr b/src/test/ui/proc-macro/exports.stderr index 6cf5c63d2da4..2f81921358df 100644 --- a/src/test/ui/proc-macro/exports.stderr +++ b/src/test/ui/proc-macro/exports.stderr @@ -1,25 +1,25 @@ error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently --> $DIR/exports.rs:7:1 | -LL | pub fn a() {} //~ ERROR: cannot export any items +LL | pub fn a() {} | ^^^^^^^^^^^^^ error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently --> $DIR/exports.rs:8:1 | -LL | pub struct B; //~ ERROR: cannot export any items +LL | pub struct B; | ^^^^^^^^^^^^^ error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently --> $DIR/exports.rs:9:1 | -LL | pub enum C {} //~ ERROR: cannot export any items +LL | pub enum C {} | ^^^^^^^^^^^^^ error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently --> $DIR/exports.rs:10:1 | -LL | pub mod d {} //~ ERROR: cannot export any items +LL | pub mod d {} | ^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/proc-macro/generate-mod.stderr b/src/test/ui/proc-macro/generate-mod.stderr index 1177fc6e575a..1b828b4f03f2 100644 --- a/src/test/ui/proc-macro/generate-mod.stderr +++ b/src/test/ui/proc-macro/generate-mod.stderr @@ -1,31 +1,31 @@ error[E0412]: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:9:1 | -LL | generate_mod::check!(); //~ ERROR cannot find type `FromOutside` in this scope +LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `Outer` in this scope --> $DIR/generate-mod.rs:9:1 | -LL | generate_mod::check!(); //~ ERROR cannot find type `FromOutside` in this scope +LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:12:1 | -LL | #[generate_mod::check_attr] //~ ERROR cannot find type `FromOutside` in this scope +LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `OuterAttr` in this scope --> $DIR/generate-mod.rs:12:1 | -LL | #[generate_mod::check_attr] //~ ERROR cannot find type `FromOutside` in this scope +LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope warning: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:16:10 | -LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope +LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import | = note: #[warn(proc_macro_derive_resolution_fallback)] on by default @@ -35,7 +35,7 @@ LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside warning: cannot find type `OuterDerive` in this scope --> $DIR/generate-mod.rs:16:10 | -LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope +LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -44,7 +44,7 @@ LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside warning: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:23:14 | -LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope +LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -53,7 +53,7 @@ LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOut warning: cannot find type `OuterDerive` in this scope --> $DIR/generate-mod.rs:23:14 | -LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope +LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/proc-macro/invalid-attributes.stderr b/src/test/ui/proc-macro/invalid-attributes.stderr index 06a7ef2b206c..8dff60d0dc55 100644 --- a/src/test/ui/proc-macro/invalid-attributes.stderr +++ b/src/test/ui/proc-macro/invalid-attributes.stderr @@ -1,37 +1,37 @@ error: attribute must be of the form `#[proc_macro]` --> $DIR/invalid-attributes.rs:10:1 | -LL | #[proc_macro = "test"] //~ ERROR attribute must be of the form +LL | #[proc_macro = "test"] | ^^^^^^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[proc_macro]` --> $DIR/invalid-attributes.rs:13:1 | -LL | #[proc_macro()] //~ ERROR attribute must be of the form +LL | #[proc_macro()] | ^^^^^^^^^^^^^^^ error: attribute must be of the form `#[proc_macro]` --> $DIR/invalid-attributes.rs:16:1 | -LL | #[proc_macro(x)] //~ ERROR attribute must be of the form +LL | #[proc_macro(x)] | ^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[proc_macro_attribute]` --> $DIR/invalid-attributes.rs:19:1 | -LL | #[proc_macro_attribute = "test"] //~ ERROR attribute must be of the form +LL | #[proc_macro_attribute = "test"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[proc_macro_attribute]` --> $DIR/invalid-attributes.rs:22:1 | -LL | #[proc_macro_attribute()] //~ ERROR attribute must be of the form +LL | #[proc_macro_attribute()] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[proc_macro_attribute]` --> $DIR/invalid-attributes.rs:25:1 | -LL | #[proc_macro_attribute(x)] //~ ERROR attribute must be of the form +LL | #[proc_macro_attribute(x)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/proc-macro/invalid-punct-ident-1.stderr b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr index 875941303787..9a53741f94f9 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-1.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr @@ -1,7 +1,7 @@ error: proc macro panicked --> $DIR/invalid-punct-ident-1.rs:6:1 | -LL | invalid_punct!(); //~ ERROR proc macro panicked +LL | invalid_punct!(); | ^^^^^^^^^^^^^^^^^ | = help: message: unsupported character `'`'` diff --git a/src/test/ui/proc-macro/invalid-punct-ident-2.stderr b/src/test/ui/proc-macro/invalid-punct-ident-2.stderr index 384d30650f10..77a26b830d98 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-2.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-2.stderr @@ -1,7 +1,7 @@ error: proc macro panicked --> $DIR/invalid-punct-ident-2.rs:6:1 | -LL | invalid_ident!(); //~ ERROR proc macro panicked +LL | invalid_ident!(); | ^^^^^^^^^^^^^^^^^ | = help: message: `"*"` is not a valid identifier diff --git a/src/test/ui/proc-macro/invalid-punct-ident-3.stderr b/src/test/ui/proc-macro/invalid-punct-ident-3.stderr index fd34459e8976..6ff47e3752c5 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-3.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-3.stderr @@ -1,7 +1,7 @@ error: proc macro panicked --> $DIR/invalid-punct-ident-3.rs:6:1 | -LL | invalid_raw_ident!(); //~ ERROR proc macro panicked +LL | invalid_raw_ident!(); | ^^^^^^^^^^^^^^^^^^^^^ | = help: message: `"self"` is not a valid raw identifier diff --git a/src/test/ui/proc-macro/invalid-punct-ident-4.stderr b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr index 39eb64e555c1..da2bf07a1a3a 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-4.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr @@ -1,13 +1,13 @@ error: unexpected close delimiter: `)` --> $DIR/invalid-punct-ident-4.rs:6:1 | -LL | lexer_failure!(); //~ ERROR proc macro panicked +LL | lexer_failure!(); | ^^^^^^^^^^^^^^^^^ unexpected close delimiter error: proc macro panicked --> $DIR/invalid-punct-ident-4.rs:6:1 | -LL | lexer_failure!(); //~ ERROR proc macro panicked +LL | lexer_failure!(); | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/proc-macro/issue-37788.stderr b/src/test/ui/proc-macro/issue-37788.stderr index 40f28460b163..0727e8c8ed16 100644 --- a/src/test/ui/proc-macro/issue-37788.stderr +++ b/src/test/ui/proc-macro/issue-37788.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn main() { | - expected `()` because of default return type LL | // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE. -LL | std::cell::Cell::new(0) //~ ERROR mismatched types +LL | std::cell::Cell::new(0) | ^^^^^^^^^^^^^^^^^^^^^^^- help: try adding a semicolon: `;` | | | expected (), found struct `std::cell::Cell` diff --git a/src/test/ui/proc-macro/issue-38586.stderr b/src/test/ui/proc-macro/issue-38586.stderr index 9657914f49bb..2584e0c62eec 100644 --- a/src/test/ui/proc-macro/issue-38586.stderr +++ b/src/test/ui/proc-macro/issue-38586.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `foo` in this scope --> $DIR/issue-38586.rs:6:10 | -LL | #[derive(A)] //~ ERROR `foo` +LL | #[derive(A)] | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/proc-macro/issue-50493.stderr b/src/test/ui/proc-macro/issue-50493.stderr index 559e8f0f2225..28c61a2f52fe 100644 --- a/src/test/ui/proc-macro/issue-50493.stderr +++ b/src/test/ui/proc-macro/issue-50493.stderr @@ -1,13 +1,13 @@ error: visibilities can only be restricted to ancestor modules --> $DIR/issue-50493.rs:8:12 | -LL | pub(in restricted) field: usize, //~ visibilities can only be restricted to ancestor modules +LL | pub(in restricted) field: usize, | ^^^^^^^^^^ error[E0616]: field `field` of struct `Restricted` is private --> $DIR/issue-50493.rs:6:10 | -LL | #[derive(Derive)] //~ ERROR field `field` of struct `Restricted` is private +LL | #[derive(Derive)] | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/proc-macro/lifetimes.stderr b/src/test/ui/proc-macro/lifetimes.stderr index c873ab68654b..2356a119530b 100644 --- a/src/test/ui/proc-macro/lifetimes.stderr +++ b/src/test/ui/proc-macro/lifetimes.stderr @@ -1,7 +1,7 @@ error: expected type, found `'` --> $DIR/lifetimes.rs:9:10 | -LL | type A = single_quote_alone!(); //~ ERROR expected type, found `'` +LL | type A = single_quote_alone!(); | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/proc-macro/macro-brackets.stderr b/src/test/ui/proc-macro/macro-brackets.stderr index a3cc7d485cd3..7447b5c15eef 100644 --- a/src/test/ui/proc-macro/macro-brackets.stderr +++ b/src/test/ui/proc-macro/macro-brackets.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/macro-brackets.rs:11:21 | -LL | id![static X: u32 = 'a';]; //~ ERROR: mismatched types +LL | id![static X: u32 = 'a';]; | ^^^ expected u32, found char error: aborting due to previous error diff --git a/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr index c1821199e30b..548f9e3051dd 100644 --- a/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr +++ b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr @@ -1,55 +1,55 @@ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:25:5 | -LL | my_macro!(); //~ ERROR can't use a procedural macro from the same crate that defines it +LL | my_macro!(); | ^^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:28:5 | -LL | my_macro_attr!(); //~ ERROR can't use a procedural macro from the same crate that defines it +LL | my_macro_attr!(); | ^^^^^^^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:31:5 | -LL | MyTrait!(); //~ ERROR can't use a procedural macro from the same crate that defines it +LL | MyTrait!(); | ^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:34:3 | -LL | #[my_macro] //~ ERROR can't use a procedural macro from the same crate that defines it +LL | #[my_macro] | ^^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:36:3 | -LL | #[my_macro_attr] //~ ERROR can't use a procedural macro from the same crate that defines it +LL | #[my_macro_attr] | ^^^^^^^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:38:3 | -LL | #[MyTrait] //~ ERROR can't use a procedural macro from the same crate that defines it +LL | #[MyTrait] | ^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:41:10 | -LL | #[derive(my_macro)] //~ ERROR can't use a procedural macro from the same crate that defines it +LL | #[derive(my_macro)] | ^^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:43:10 | -LL | #[derive(my_macro_attr)] //~ ERROR can't use a procedural macro from the same crate that defines it +LL | #[derive(my_macro_attr)] | ^^^^^^^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:45:10 | -LL | #[derive(MyTrait)] //~ ERROR can't use a procedural macro from the same crate that defines it +LL | #[derive(MyTrait)] | ^^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/proc-macro/macro-namespace-reserved.stderr b/src/test/ui/proc-macro/macro-namespace-reserved.stderr index 2192e6d2b17a..f5d589c3ac6e 100644 --- a/src/test/ui/proc-macro/macro-namespace-reserved.stderr +++ b/src/test/ui/proc-macro/macro-namespace-reserved.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `my_macro` is defined multiple times LL | pub fn my_macro(input: TokenStream) -> TokenStream { | -------------------------------------------------- previous definition of the macro `my_macro` here ... -LL | macro my_macro() {} //~ ERROR the name `my_macro` is defined multiple times +LL | macro my_macro() {} | ^^^^^^^^^^^^^^^^ `my_macro` redefined here | = note: `my_macro` must be defined only once in the macro namespace of this module @@ -15,7 +15,7 @@ error[E0428]: the name `my_macro_attr` is defined multiple times LL | pub fn my_macro_attr(input: TokenStream, _: TokenStream) -> TokenStream { | ----------------------------------------------------------------------- previous definition of the macro `my_macro_attr` here ... -LL | macro my_macro_attr() {} //~ ERROR the name `my_macro_attr` is defined multiple times +LL | macro my_macro_attr() {} | ^^^^^^^^^^^^^^^^^^^^^ `my_macro_attr` redefined here | = note: `my_macro_attr` must be defined only once in the macro namespace of this module @@ -26,7 +26,7 @@ error[E0428]: the name `MyTrait` is defined multiple times LL | #[proc_macro_derive(MyTrait)] | ------- previous definition of the macro `MyTrait` here ... -LL | macro MyTrait() {} //~ ERROR the name `MyTrait` is defined multiple times +LL | macro MyTrait() {} | ^^^^^^^^^^^^^^^ `MyTrait` redefined here | = note: `MyTrait` must be defined only once in the macro namespace of this module diff --git a/src/test/ui/proc-macro/more-gates.stderr b/src/test/ui/proc-macro/more-gates.stderr index 21e75027e487..c6c2954f9398 100644 --- a/src/test/ui/proc-macro/more-gates.stderr +++ b/src/test/ui/proc-macro/more-gates.stderr @@ -17,7 +17,7 @@ LL | #[attr2mac2] error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) --> $DIR/more-gates.rs:16:1 | -LL | mac2mac1!(); //~ ERROR: cannot expand to macro definitions +LL | mac2mac1!(); | ^^^^^^^^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | mac2mac1!(); //~ ERROR: cannot expand to macro definitions error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) --> $DIR/more-gates.rs:17:1 | -LL | mac2mac2!(); //~ ERROR: cannot expand to macro definitions +LL | mac2mac2!(); | ^^^^^^^^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable diff --git a/src/test/ui/proc-macro/multispan.stderr b/src/test/ui/proc-macro/multispan.stderr index 7519f778e9e7..44af07a79423 100644 --- a/src/test/ui/proc-macro/multispan.stderr +++ b/src/test/ui/proc-macro/multispan.stderr @@ -1,85 +1,85 @@ error: hello to you, too! --> $DIR/multispan.rs:14:5 | -LL | hello!(hi); //~ ERROR hello to you, too! +LL | hello!(hi); | ^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:14:12 | -LL | hello!(hi); //~ ERROR hello to you, too! +LL | hello!(hi); | ^^ error: hello to you, too! --> $DIR/multispan.rs:17:5 | -LL | hello!(hi hi); //~ ERROR hello to you, too! +LL | hello!(hi hi); | ^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:17:12 | -LL | hello!(hi hi); //~ ERROR hello to you, too! +LL | hello!(hi hi); | ^^ ^^ error: hello to you, too! --> $DIR/multispan.rs:20:5 | -LL | hello!(hi hi hi); //~ ERROR hello to you, too! +LL | hello!(hi hi hi); | ^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:20:12 | -LL | hello!(hi hi hi); //~ ERROR hello to you, too! +LL | hello!(hi hi hi); | ^^ ^^ ^^ error: hello to you, too! --> $DIR/multispan.rs:23:5 | -LL | hello!(hi hey hi yo hi beep beep hi hi); //~ ERROR hello to you, too! +LL | hello!(hi hey hi yo hi beep beep hi hi); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:23:12 | -LL | hello!(hi hey hi yo hi beep beep hi hi); //~ ERROR hello to you, too! +LL | hello!(hi hey hi yo hi beep beep hi hi); | ^^ ^^ ^^ ^^ ^^ error: hello to you, too! --> $DIR/multispan.rs:24:5 | -LL | hello!(hi there, hi how are you? hi... hi.); //~ ERROR hello to you, too! +LL | hello!(hi there, hi how are you? hi... hi.); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:24:12 | -LL | hello!(hi there, hi how are you? hi... hi.); //~ ERROR hello to you, too! +LL | hello!(hi there, hi how are you? hi... hi.); | ^^ ^^ ^^ ^^ error: hello to you, too! --> $DIR/multispan.rs:25:5 | -LL | hello!(whoah. hi di hi di ho); //~ ERROR hello to you, too! +LL | hello!(whoah. hi di hi di ho); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:25:19 | -LL | hello!(whoah. hi di hi di ho); //~ ERROR hello to you, too! +LL | hello!(whoah. hi di hi di ho); | ^^ ^^ error: hello to you, too! --> $DIR/multispan.rs:26:5 | -LL | hello!(hi good hi and good bye); //~ ERROR hello to you, too! +LL | hello!(hi good hi and good bye); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:26:12 | -LL | hello!(hi good hi and good bye); //~ ERROR hello to you, too! +LL | hello!(hi good hi and good bye); | ^^ ^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/proc-macro/nested-item-spans.stderr b/src/test/ui/proc-macro/nested-item-spans.stderr index cba4b73486c1..011a91d44629 100644 --- a/src/test/ui/proc-macro/nested-item-spans.stderr +++ b/src/test/ui/proc-macro/nested-item-spans.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/nested-item-spans.rs:10:22 | -LL | let x: u32 = "x"; //~ ERROR: mismatched types +LL | let x: u32 = "x"; | ^^^ expected u32, found reference | = note: expected type `u32` @@ -10,7 +10,7 @@ LL | let x: u32 = "x"; //~ ERROR: mismatched types error[E0308]: mismatched types --> $DIR/nested-item-spans.rs:19:22 | -LL | let x: u32 = "x"; //~ ERROR: mismatched types +LL | let x: u32 = "x"; | ^^^ expected u32, found reference | = note: expected type `u32` diff --git a/src/test/ui/proc-macro/no-macro-use-attr.stderr b/src/test/ui/proc-macro/no-macro-use-attr.stderr index fe5107e17cb9..4b2fce7f6e4c 100644 --- a/src/test/ui/proc-macro/no-macro-use-attr.stderr +++ b/src/test/ui/proc-macro/no-macro-use-attr.stderr @@ -13,7 +13,7 @@ LL | #![warn(unused_extern_crates)] error: compilation successful --> $DIR/no-macro-use-attr.rs:10:1 | -LL | fn main() {} //~ ERROR compilation successful +LL | fn main() {} | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/proc-macro/proc-macro-attributes.stderr b/src/test/ui/proc-macro/proc-macro-attributes.stderr index a5ec787ac67e..f8f1e7cd988f 100644 --- a/src/test/ui/proc-macro/proc-macro-attributes.stderr +++ b/src/test/ui/proc-macro/proc-macro-attributes.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `C` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/proc-macro-attributes.rs:7:3 | -LL | #[C] //~ ERROR attribute `C` is currently unknown to the compiler +LL | #[C] | ^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[C] //~ ERROR attribute `C` is currently unknown to the compiler error[E0659]: `B` is ambiguous (derive helper attribute vs any other name) --> $DIR/proc-macro-attributes.rs:6:3 | -LL | #[B] //~ ERROR `B` is ambiguous +LL | #[B] | ^ ambiguous name | note: `B` could refer to the derive helper attribute defined here @@ -26,7 +26,7 @@ LL | #[macro_use] error[E0659]: `B` is ambiguous (derive helper attribute vs any other name) --> $DIR/proc-macro-attributes.rs:8:3 | -LL | #[B(D)] //~ ERROR `B` is ambiguous +LL | #[B(D)] | ^ ambiguous name | note: `B` could refer to the derive helper attribute defined here @@ -43,7 +43,7 @@ LL | #[macro_use] error[E0659]: `B` is ambiguous (derive helper attribute vs any other name) --> $DIR/proc-macro-attributes.rs:9:3 | -LL | #[B(E = "foo")] //~ ERROR `B` is ambiguous +LL | #[B(E = "foo")] | ^ ambiguous name | note: `B` could refer to the derive helper attribute defined here @@ -60,7 +60,7 @@ LL | #[macro_use] error[E0659]: `B` is ambiguous (derive helper attribute vs any other name) --> $DIR/proc-macro-attributes.rs:10:3 | -LL | #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous +LL | #[B(arbitrary tokens)] | ^ ambiguous name | note: `B` could refer to the derive helper attribute defined here diff --git a/src/test/ui/proc-macro/proc-macro-gates.stderr b/src/test/ui/proc-macro/proc-macro-gates.stderr index abfcf09bfaf6..4ae8e63df724 100644 --- a/src/test/ui/proc-macro/proc-macro-gates.stderr +++ b/src/test/ui/proc-macro/proc-macro-gates.stderr @@ -1,7 +1,7 @@ error[E0658]: non-builtin inner attributes are unstable (see issue #54726) --> $DIR/proc-macro-gates.rs:11:5 | -LL | #![a] //~ ERROR: non-builtin inner attributes are unstable +LL | #![a] | ^^^^^ | = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #![a] //~ ERROR: non-builtin inner attributes are unstable error[E0658]: non-builtin inner attributes are unstable (see issue #54726) --> $DIR/proc-macro-gates.rs:18:5 | -LL | #![a] //~ ERROR: custom attributes cannot be applied to modules +LL | #![a] | ^^^^^ | = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | #![a] //~ ERROR: custom attributes cannot be applied to modules error[E0658]: custom attributes cannot be applied to modules (see issue #54727) --> $DIR/proc-macro-gates.rs:14:1 | -LL | #[a] //~ ERROR: custom attributes cannot be applied to modules +LL | #[a] | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | #[a] //~ ERROR: custom attributes cannot be applied to modules error[E0658]: custom attributes cannot be applied to modules (see issue #54727) --> $DIR/proc-macro-gates.rs:18:5 | -LL | #![a] //~ ERROR: custom attributes cannot be applied to modules +LL | #![a] | ^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -33,13 +33,13 @@ LL | #![a] //~ ERROR: custom attributes cannot be applied to modules error: custom attribute invocations must be of the form #[foo] or #[foo(..)], the macro name must only be followed by a delimiter token --> $DIR/proc-macro-gates.rs:22:1 | -LL | #[a = "y"] //~ ERROR: must only be followed by a delimiter token +LL | #[a = "y"] | ^^^^^^^^^^ error[E0658]: custom attributes cannot be applied to statements (see issue #54727) --> $DIR/proc-macro-gates.rs:31:5 | -LL | #[a] //~ ERROR: custom attributes cannot be applied to statements +LL | #[a] | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -47,7 +47,7 @@ LL | #[a] //~ ERROR: custom attributes cannot be applied to statements error[E0658]: custom attributes cannot be applied to statements (see issue #54727) --> $DIR/proc-macro-gates.rs:35:5 | -LL | #[a] //~ ERROR: custom attributes cannot be applied to statements +LL | #[a] | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -55,7 +55,7 @@ LL | #[a] //~ ERROR: custom attributes cannot be applied to statements error[E0658]: custom attributes cannot be applied to statements (see issue #54727) --> $DIR/proc-macro-gates.rs:39:5 | -LL | #[a] //~ ERROR: custom attributes cannot be applied to statements +LL | #[a] | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -63,7 +63,7 @@ LL | #[a] //~ ERROR: custom attributes cannot be applied to statements error[E0658]: custom attributes cannot be applied to expressions (see issue #54727) --> $DIR/proc-macro-gates.rs:43:14 | -LL | let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expressions +LL | let _x = #[a] 2; | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -71,7 +71,7 @@ LL | let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expr error[E0658]: custom attributes cannot be applied to expressions (see issue #54727) --> $DIR/proc-macro-gates.rs:46:15 | -LL | let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to expressions +LL | let _x = [#[a] 2]; | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -79,7 +79,7 @@ LL | let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to ex error[E0658]: custom attributes cannot be applied to expressions (see issue #54727) --> $DIR/proc-macro-gates.rs:49:14 | -LL | let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applied to expressions +LL | let _x = #[a] println!(); | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -87,7 +87,7 @@ LL | let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applie error[E0658]: procedural macros cannot be expanded to types (see issue #54727) --> $DIR/proc-macro-gates.rs:53:13 | -LL | let _x: m!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to types +LL | let _x: m!(u32) = 3; | ^^^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -95,7 +95,7 @@ LL | let _x: m!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to error[E0658]: procedural macros cannot be expanded to patterns (see issue #54727) --> $DIR/proc-macro-gates.rs:54:12 | -LL | if let m!(Some(_x)) = Some(3) {} //~ ERROR: procedural macros cannot be expanded to patterns +LL | if let m!(Some(_x)) = Some(3) {} | ^^^^^^^^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -103,7 +103,7 @@ LL | if let m!(Some(_x)) = Some(3) {} //~ ERROR: procedural macros cannot be error[E0658]: procedural macros cannot be expanded to statements (see issue #54727) --> $DIR/proc-macro-gates.rs:56:5 | -LL | m!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements +LL | m!(struct S;); | ^^^^^^^^^^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -111,7 +111,7 @@ LL | m!(struct S;); //~ ERROR: procedural macros cannot be expanded to state error[E0658]: procedural macros cannot be expanded to statements (see issue #54727) --> $DIR/proc-macro-gates.rs:57:5 | -LL | m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements +LL | m!(let _x = 3;); | ^^^^^^^^^^^^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -119,7 +119,7 @@ LL | m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to sta error[E0658]: procedural macros cannot be expanded to expressions (see issue #54727) --> $DIR/proc-macro-gates.rs:59:14 | -LL | let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expressions +LL | let _x = m!(3); | ^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -127,7 +127,7 @@ LL | let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expr error[E0658]: procedural macros cannot be expanded to expressions (see issue #54727) --> $DIR/proc-macro-gates.rs:60:15 | -LL | let _x = [m!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions +LL | let _x = [m!(3)]; | ^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable diff --git a/src/test/ui/proc-macro/proc-macro-gates2.stderr b/src/test/ui/proc-macro/proc-macro-gates2.stderr index 262482aea345..89ad527a43c8 100644 --- a/src/test/ui/proc-macro/proc-macro-gates2.stderr +++ b/src/test/ui/proc-macro/proc-macro-gates2.stderr @@ -9,7 +9,7 @@ LL | fn _test6<#[a] T>() {} error[E0658]: The attribute `a` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/proc-macro-gates2.rs:18:9 | -LL | #[a] //~ ERROR: unknown to the compiler +LL | #[a] | ^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/proc-macro/pub-at-crate-root.stderr b/src/test/ui/proc-macro/pub-at-crate-root.stderr index 47be1c44d2d8..66fa499d33bb 100644 --- a/src/test/ui/proc-macro/pub-at-crate-root.stderr +++ b/src/test/ui/proc-macro/pub-at-crate-root.stderr @@ -1,7 +1,7 @@ error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently --> $DIR/pub-at-crate-root.rs:8:1 | -LL | / pub mod a { //~ `proc-macro` crate types cannot export any items +LL | / pub mod a { LL | | use proc_macro::TokenStream; LL | | LL | | #[proc_macro_derive(B)] @@ -14,7 +14,7 @@ error: functions tagged with `#[proc_macro_derive]` must currently reside in the --> $DIR/pub-at-crate-root.rs:12:5 | LL | / pub fn bar(a: TokenStream) -> TokenStream { -LL | | //~^ ERROR: must currently reside in the root of the crate +LL | | LL | | a LL | | } | |_____^ @@ -23,7 +23,7 @@ error: functions tagged with `#[proc_macro_derive]` must be `pub` --> $DIR/pub-at-crate-root.rs:19:1 | LL | / fn bar(a: proc_macro::TokenStream) -> proc_macro::TokenStream { -LL | | //~^ ERROR: functions tagged with `#[proc_macro_derive]` must be `pub` +LL | | LL | | a LL | | } | |_^ diff --git a/src/test/ui/proc-macro/shadow.stderr b/src/test/ui/proc-macro/shadow.stderr index 2dfe2a94c88e..91b73903aca2 100644 --- a/src/test/ui/proc-macro/shadow.stderr +++ b/src/test/ui/proc-macro/shadow.stderr @@ -4,7 +4,7 @@ error[E0259]: the name `derive_a` is defined multiple times LL | extern crate derive_a; | ---------------------- previous import of the extern crate `derive_a` here LL | / #[macro_use] -LL | | extern crate derive_a; //~ ERROR the name `derive_a` is defined multiple times +LL | | extern crate derive_a; | | ^^^^^^^^^^^^^^^^^^^^^- | |_|____________________| | | help: remove unnecessary import diff --git a/src/test/ui/proc-macro/signature.stderr b/src/test/ui/proc-macro/signature.stderr index 99cb3316533a..4743e3031a34 100644 --- a/src/test/ui/proc-macro/signature.stderr +++ b/src/test/ui/proc-macro/signature.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/signature.rs:10:1 | LL | / pub unsafe extern fn foo(a: i32, b: u32) -> u32 { -LL | | //~^ ERROR: mismatched types +LL | | LL | | loop {} LL | | } | |_^ expected normal fn, found unsafe fn diff --git a/src/test/ui/proc-macro/span-preservation.stderr b/src/test/ui/proc-macro/span-preservation.stderr index db524907b656..fbccde28f59b 100644 --- a/src/test/ui/proc-macro/span-preservation.stderr +++ b/src/test/ui/proc-macro/span-preservation.stderr @@ -6,7 +6,7 @@ error[E0308]: mismatched types error[E0308]: mismatched types --> $DIR/span-preservation.rs:13:20 | -LL | let x: usize = "hello";;;;; //~ ERROR mismatched types +LL | let x: usize = "hello";;;;; | ^^^^^^^ expected usize, found reference | = note: expected type `usize` @@ -18,19 +18,19 @@ error[E0308]: mismatched types LL | fn b(x: Option) -> usize { | ----- expected `usize` because of return type LL | match x { -LL | Some(x) => { return x }, //~ ERROR mismatched types +LL | Some(x) => { return x }, | ^ expected usize, found isize error[E0308]: mismatched types --> $DIR/span-preservation.rs:35:22 | -LL | let x = Foo { a: 10isize }; //~ ERROR mismatched types +LL | let x = Foo { a: 10isize }; | ^^^^^^^ expected usize, found isize error[E0560]: struct `c::Foo` has no field named `b` --> $DIR/span-preservation.rs:36:26 | -LL | let y = Foo { a: 10, b: 10isize }; //~ ERROR has no field named `b` +LL | let y = Foo { a: 10, b: 10isize }; | ^ `c::Foo` does not have this field | = note: available fields are: `a` @@ -40,7 +40,7 @@ error[E0308]: mismatched types | LL | extern "C" fn baz() { | - possibly return type missing here? -LL | 0 //~ ERROR mismatched types +LL | 0 | ^ expected (), found integer | = note: expected type `()` diff --git a/src/test/ui/proc-macro/subspan.stderr b/src/test/ui/proc-macro/subspan.stderr index 94f1be6021fa..5117dd6d32d4 100644 --- a/src/test/ui/proc-macro/subspan.stderr +++ b/src/test/ui/proc-macro/subspan.stderr @@ -1,97 +1,97 @@ error: found 'hi's --> $DIR/subspan.rs:11:1 | -LL | subspan!("hi"); //~ ERROR found 'hi's +LL | subspan!("hi"); | ^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:11:11 | -LL | subspan!("hi"); //~ ERROR found 'hi's +LL | subspan!("hi"); | ^^ error: found 'hi's --> $DIR/subspan.rs:14:1 | -LL | subspan!("hihi"); //~ ERROR found 'hi's +LL | subspan!("hihi"); | ^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:14:11 | -LL | subspan!("hihi"); //~ ERROR found 'hi's +LL | subspan!("hihi"); | ^^^^ error: found 'hi's --> $DIR/subspan.rs:17:1 | -LL | subspan!("hihihi"); //~ ERROR found 'hi's +LL | subspan!("hihihi"); | ^^^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:17:11 | -LL | subspan!("hihihi"); //~ ERROR found 'hi's +LL | subspan!("hihihi"); | ^^^^^^ error: found 'hi's --> $DIR/subspan.rs:20:1 | -LL | subspan!("why I hide? hi!"); //~ ERROR found 'hi's +LL | subspan!("why I hide? hi!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:20:17 | -LL | subspan!("why I hide? hi!"); //~ ERROR found 'hi's +LL | subspan!("why I hide? hi!"); | ^^ ^^ error: found 'hi's --> $DIR/subspan.rs:21:1 | -LL | subspan!("hey, hi, hidy, hidy, hi hi"); //~ ERROR found 'hi's +LL | subspan!("hey, hi, hidy, hidy, hi hi"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:21:16 | -LL | subspan!("hey, hi, hidy, hidy, hi hi"); //~ ERROR found 'hi's +LL | subspan!("hey, hi, hidy, hidy, hi hi"); | ^^ ^^ ^^ ^^ ^^ error: found 'hi's --> $DIR/subspan.rs:22:1 | -LL | subspan!("this is a hi, and this is another hi"); //~ ERROR found 'hi's +LL | subspan!("this is a hi, and this is another hi"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:22:12 | -LL | subspan!("this is a hi, and this is another hi"); //~ ERROR found 'hi's +LL | subspan!("this is a hi, and this is another hi"); | ^^ ^^ ^^ ^^ error: found 'hi's --> $DIR/subspan.rs:23:1 | -LL | subspan!("how are you this evening"); //~ ERROR found 'hi's +LL | subspan!("how are you this evening"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:23:24 | -LL | subspan!("how are you this evening"); //~ ERROR found 'hi's +LL | subspan!("how are you this evening"); | ^^ error: found 'hi's --> $DIR/subspan.rs:24:1 | -LL | subspan!("this is highly eradic"); //~ ERROR found 'hi's +LL | subspan!("this is highly eradic"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:24:12 | -LL | subspan!("this is highly eradic"); //~ ERROR found 'hi's +LL | subspan!("this is highly eradic"); | ^^ ^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/proc-macro/three-equals.stderr b/src/test/ui/proc-macro/three-equals.stderr index e38343348dd9..f8dfa841d4f3 100644 --- a/src/test/ui/proc-macro/three-equals.stderr +++ b/src/test/ui/proc-macro/three-equals.stderr @@ -1,7 +1,7 @@ error: found 2 equal signs, need exactly 3 --> $DIR/three-equals.rs:15:5 | -LL | three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3 +LL | three_equals!(==); | ^^^^^^^^^^^^^^^^^^ | = help: input must be: `===` @@ -9,38 +9,38 @@ LL | three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3 error: expected EOF, found `=`. --> $DIR/three-equals.rs:18:21 | -LL | three_equals!(=====); //~ ERROR expected EOF +LL | three_equals!(=====); | ^^ | note: last good input was here --> $DIR/three-equals.rs:18:21 | -LL | three_equals!(=====); //~ ERROR expected EOF +LL | three_equals!(=====); | ^^ = help: input must be: `===` error: expected `=`, found `abc`. --> $DIR/three-equals.rs:21:19 | -LL | three_equals!(abc); //~ ERROR expected `=` +LL | three_equals!(abc); | ^^^ error: expected `=`, found `!`. --> $DIR/three-equals.rs:24:19 | -LL | three_equals!(!!); //~ ERROR expected `=` +LL | three_equals!(!!); | ^ error: expected EOF, found `a`. --> $DIR/three-equals.rs:27:22 | -LL | three_equals!(===a); //~ ERROR expected EOF +LL | three_equals!(===a); | ^ | note: last good input was here --> $DIR/three-equals.rs:27:21 | -LL | three_equals!(===a); //~ ERROR expected EOF +LL | three_equals!(===a); | ^ = help: input must be: `===` diff --git a/src/test/ui/ptr-coercion.stderr b/src/test/ui/ptr-coercion.stderr index 2499e90db7d9..019241d6874a 100644 --- a/src/test/ui/ptr-coercion.stderr +++ b/src/test/ui/ptr-coercion.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/ptr-coercion.rs:7:25 | -LL | let x: *mut isize = x; //~ ERROR mismatched types +LL | let x: *mut isize = x; | ^ types differ in mutability | = note: expected type `*mut isize` @@ -10,7 +10,7 @@ LL | let x: *mut isize = x; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/ptr-coercion.rs:13:25 | -LL | let x: *mut isize = &42; //~ ERROR mismatched types +LL | let x: *mut isize = &42; | ^^^ types differ in mutability | = note: expected type `*mut isize` @@ -19,7 +19,7 @@ LL | let x: *mut isize = &42; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/ptr-coercion.rs:19:25 | -LL | let x: *mut isize = x; //~ ERROR mismatched types +LL | let x: *mut isize = x; | ^ types differ in mutability | = note: expected type `*mut isize` diff --git a/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr b/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr index e895d51a848b..61c148bf2df2 100644 --- a/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr +++ b/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr @@ -1,7 +1,7 @@ error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub` --> $DIR/pub-reexport-priv-extern-crate.rs:4:9 | -LL | pub use core as reexported_core; //~ ERROR `core` is private, and cannot be re-exported +LL | pub use core as reexported_core; | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[deny(pub_use_of_private_extern_crate)] on by default @@ -11,7 +11,7 @@ LL | pub use core as reexported_core; //~ ERROR `core` is private, and cannot be error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub` --> $DIR/pub-reexport-priv-extern-crate.rs:12:9 | -LL | use foo1::core; //~ ERROR `core` is private, and cannot be re-exported +LL | use foo1::core; | ^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -20,7 +20,7 @@ LL | use foo1::core; //~ ERROR `core` is private, and cannot be re-exported error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub` --> $DIR/pub-reexport-priv-extern-crate.rs:20:13 | -LL | pub use foo2::bar::core; //~ ERROR `core` is private, and cannot be re-exported +LL | pub use foo2::bar::core; | ^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/pub/pub-restricted-error-fn.stderr b/src/test/ui/pub/pub-restricted-error-fn.stderr index 86fe1b2186f4..fcff5334890e 100644 --- a/src/test/ui/pub/pub-restricted-error-fn.stderr +++ b/src/test/ui/pub/pub-restricted-error-fn.stderr @@ -1,7 +1,7 @@ error: unmatched visibility `pub` --> $DIR/pub-restricted-error-fn.rs:3:10 | -LL | pub(crate) () fn foo() {} //~ unmatched visibility +LL | pub(crate) () fn foo() {} | ^ error: aborting due to previous error diff --git a/src/test/ui/pub/pub-restricted-error.stderr b/src/test/ui/pub/pub-restricted-error.stderr index ca720279946f..d856833d04fb 100644 --- a/src/test/ui/pub/pub-restricted-error.stderr +++ b/src/test/ui/pub/pub-restricted-error.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `(` --> $DIR/pub-restricted-error.rs:6:16 | -LL | pub(crate) () foo: usize, //~ ERROR expected identifier +LL | pub(crate) () foo: usize, | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/pub/pub-restricted-non-path.stderr b/src/test/ui/pub/pub-restricted-non-path.stderr index 526e964f8ee3..e0ea50621f75 100644 --- a/src/test/ui/pub/pub-restricted-non-path.stderr +++ b/src/test/ui/pub/pub-restricted-non-path.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `.` --> $DIR/pub-restricted-non-path.rs:3:6 | -LL | pub (.) fn afn() {} //~ ERROR expected identifier +LL | pub (.) fn afn() {} | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/pub/pub-restricted.stderr b/src/test/ui/pub/pub-restricted.stderr index 40cf398023b2..7eeefa955054 100644 --- a/src/test/ui/pub/pub-restricted.stderr +++ b/src/test/ui/pub/pub-restricted.stderr @@ -1,7 +1,7 @@ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:5:6 | -LL | pub (a) fn afn() {} //~ incorrect visibility restriction +LL | pub (a) fn afn() {} | ^ help: make this visible only to module `a` with `in`: `in a` | = help: some possible visibility restrictions are: @@ -12,7 +12,7 @@ LL | pub (a) fn afn() {} //~ incorrect visibility restriction error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:6:6 | -LL | pub (b) fn bfn() {} //~ incorrect visibility restriction +LL | pub (b) fn bfn() {} | ^ help: make this visible only to module `b` with `in`: `in b` | = help: some possible visibility restrictions are: @@ -23,7 +23,7 @@ LL | pub (b) fn bfn() {} //~ incorrect visibility restriction error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:22:14 | -LL | pub (a) invalid: usize, //~ incorrect visibility restriction +LL | pub (a) invalid: usize, | ^ help: make this visible only to module `a` with `in`: `in a` | = help: some possible visibility restrictions are: @@ -34,7 +34,7 @@ LL | pub (a) invalid: usize, //~ incorrect visibility restriction error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:31:6 | -LL | pub (xyz) fn xyz() {} //~ incorrect visibility restriction +LL | pub (xyz) fn xyz() {} | ^^^ help: make this visible only to module `xyz` with `in`: `in xyz` | = help: some possible visibility restrictions are: @@ -45,7 +45,7 @@ LL | pub (xyz) fn xyz() {} //~ incorrect visibility restriction error: visibilities can only be restricted to ancestor modules --> $DIR/pub-restricted.rs:23:17 | -LL | pub (in x) non_parent_invalid: usize, //~ ERROR visibilities can only be restricted +LL | pub (in x) non_parent_invalid: usize, | ^ error: aborting due to 5 previous errors diff --git a/src/test/ui/qualified/qualified-path-params.stderr b/src/test/ui/qualified/qualified-path-params.stderr index 18fca2e30469..926b098040f1 100644 --- a/src/test/ui/qualified/qualified-path-params.stderr +++ b/src/test/ui/qualified/qualified-path-params.stderr @@ -7,7 +7,7 @@ LL | ::A::f:: => {} error[E0029]: only char and numeric types are allowed in range patterns --> $DIR/qualified-path-params.rs:22:15 | -LL | 0 ..= ::A::f:: => {} //~ ERROR only char and numeric types are allowed in range +LL | 0 ..= ::A::f:: => {} | ^^^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types | = note: start type: {integer} diff --git a/src/test/ui/question-mark-type-infer.stderr b/src/test/ui/question-mark-type-infer.stderr index c998bdc086f1..f62a540572c9 100644 --- a/src/test/ui/question-mark-type-infer.stderr +++ b/src/test/ui/question-mark-type-infer.stderr @@ -1,7 +1,7 @@ error[E0284]: type annotations required: cannot resolve `<_ as std::ops::Try>::Ok == _` --> $DIR/question-mark-type-infer.rs:12:5 | -LL | l.iter().map(f).collect()? //~ ERROR type annotations required: cannot resolve +LL | l.iter().map(f).collect()? | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/range/range_traits-2.stderr b/src/test/ui/range/range_traits-2.stderr index f7f887006ed5..598a0b3ed037 100644 --- a/src/test/ui/range/range_traits-2.stderr +++ b/src/test/ui/range/range_traits-2.stderr @@ -1,7 +1,7 @@ error[E0204]: the trait `Copy` may not be implemented for this type --> $DIR/range_traits-2.rs:3:10 | -LL | #[derive(Copy, Clone)] //~ ERROR Copy +LL | #[derive(Copy, Clone)] | ^^^^ LL | struct R(Range); | ------------ this field does not implement `Copy` diff --git a/src/test/ui/range/range_traits-3.stderr b/src/test/ui/range/range_traits-3.stderr index 910ba5172767..e2713a2bd5ed 100644 --- a/src/test/ui/range/range_traits-3.stderr +++ b/src/test/ui/range/range_traits-3.stderr @@ -1,7 +1,7 @@ error[E0204]: the trait `Copy` may not be implemented for this type --> $DIR/range_traits-3.rs:3:10 | -LL | #[derive(Copy, Clone)] //~ ERROR Copy +LL | #[derive(Copy, Clone)] | ^^^^ LL | struct R(RangeFrom); | ---------------- this field does not implement `Copy` diff --git a/src/test/ui/range/range_traits-6.stderr b/src/test/ui/range/range_traits-6.stderr index c1916e24bfee..226d72ce0262 100644 --- a/src/test/ui/range/range_traits-6.stderr +++ b/src/test/ui/range/range_traits-6.stderr @@ -1,7 +1,7 @@ error[E0204]: the trait `Copy` may not be implemented for this type --> $DIR/range_traits-6.rs:3:10 | -LL | #[derive(Copy, Clone)] //~ ERROR Copy +LL | #[derive(Copy, Clone)] | ^^^^ LL | struct R(RangeInclusive); | --------------------- this field does not implement `Copy` diff --git a/src/test/ui/reachable/expr_add.stderr b/src/test/ui/reachable/expr_add.stderr index 548600f26ec8..02b29021cb61 100644 --- a/src/test/ui/reachable/expr_add.stderr +++ b/src/test/ui/reachable/expr_add.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_add.rs:17:13 | -LL | let x = Foo + return; //~ ERROR unreachable +LL | let x = Foo + return; | ^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_array.stderr b/src/test/ui/reachable/expr_array.stderr index b6e79e551cd8..18d7ffe74bd1 100644 --- a/src/test/ui/reachable/expr_array.stderr +++ b/src/test/ui/reachable/expr_array.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_array.rs:9:34 | -LL | let x: [usize; 2] = [return, 22]; //~ ERROR unreachable +LL | let x: [usize; 2] = [return, 22]; | ^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/expr_array.rs:14:25 | -LL | let x: [usize; 2] = [22, return]; //~ ERROR unreachable +LL | let x: [usize; 2] = [22, return]; | ^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/reachable/expr_assign.stderr b/src/test/ui/reachable/expr_assign.stderr index 949009b72996..def16d90a749 100644 --- a/src/test/ui/reachable/expr_assign.stderr +++ b/src/test/ui/reachable/expr_assign.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_assign.rs:10:5 | -LL | x = return; //~ ERROR unreachable +LL | x = return; | ^^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/expr_assign.rs:20:14 | -LL | *p = return; //~ ERROR unreachable +LL | *p = return; | ^^^^^^ error: unreachable expression --> $DIR/expr_assign.rs:26:15 | -LL | *{return; &mut i} = 22; //~ ERROR unreachable +LL | *{return; &mut i} = 22; | ^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/reachable/expr_block.stderr b/src/test/ui/reachable/expr_block.stderr index d71d12b744a6..a498502e6cb1 100644 --- a/src/test/ui/reachable/expr_block.stderr +++ b/src/test/ui/reachable/expr_block.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_block.rs:10:9 | -LL | 22 //~ ERROR unreachable +LL | 22 | ^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_box.stderr b/src/test/ui/reachable/expr_box.stderr index 289cef24bcec..63137ce3da18 100644 --- a/src/test/ui/reachable/expr_box.stderr +++ b/src/test/ui/reachable/expr_box.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_box.rs:6:13 | -LL | let x = box return; //~ ERROR unreachable +LL | let x = box return; | ^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_call.stderr b/src/test/ui/reachable/expr_call.stderr index aecaf24adc44..df5cff16f9a4 100644 --- a/src/test/ui/reachable/expr_call.stderr +++ b/src/test/ui/reachable/expr_call.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_call.rs:13:17 | -LL | foo(return, 22); //~ ERROR unreachable +LL | foo(return, 22); | ^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/expr_call.rs:18:5 | -LL | bar(return); //~ ERROR unreachable +LL | bar(return); | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/reachable/expr_cast.stderr b/src/test/ui/reachable/expr_cast.stderr index 21f8a0f418e5..3086745d28ed 100644 --- a/src/test/ui/reachable/expr_cast.stderr +++ b/src/test/ui/reachable/expr_cast.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_cast.rs:9:13 | -LL | let x = {return} as !; //~ ERROR unreachable +LL | let x = {return} as !; | ^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_method.stderr b/src/test/ui/reachable/expr_method.stderr index f1770df2f9ea..bbfa2ef529ad 100644 --- a/src/test/ui/reachable/expr_method.stderr +++ b/src/test/ui/reachable/expr_method.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_method.rs:16:21 | -LL | Foo.foo(return, 22); //~ ERROR unreachable +LL | Foo.foo(return, 22); | ^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/expr_method.rs:21:5 | -LL | Foo.bar(return); //~ ERROR unreachable +LL | Foo.bar(return); | ^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/reachable/expr_repeat.stderr b/src/test/ui/reachable/expr_repeat.stderr index 288c18d5d659..0536cdef7212 100644 --- a/src/test/ui/reachable/expr_repeat.stderr +++ b/src/test/ui/reachable/expr_repeat.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_repeat.rs:9:25 | -LL | let x: [usize; 2] = [return; 2]; //~ ERROR unreachable +LL | let x: [usize; 2] = [return; 2]; | ^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_return.stderr b/src/test/ui/reachable/expr_return.stderr index e5ce660d6959..3317da58aba1 100644 --- a/src/test/ui/reachable/expr_return.stderr +++ b/src/test/ui/reachable/expr_return.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_return.rs:10:22 | -LL | let x = {return {return {return;}}}; //~ ERROR unreachable +LL | let x = {return {return {return;}}}; | ^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_struct.stderr b/src/test/ui/reachable/expr_struct.stderr index 5fbf603602ba..dcccb7a4db30 100644 --- a/src/test/ui/reachable/expr_struct.stderr +++ b/src/test/ui/reachable/expr_struct.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_struct.rs:14:13 | -LL | let x = Foo { a: 22, b: 33, ..return }; //~ ERROR unreachable +LL | let x = Foo { a: 22, b: 33, ..return }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/expr_struct.rs:19:33 | -LL | let x = Foo { a: return, b: 33, ..return }; //~ ERROR unreachable +LL | let x = Foo { a: return, b: 33, ..return }; | ^^ error: unreachable expression --> $DIR/expr_struct.rs:24:39 | -LL | let x = Foo { a: 22, b: return, ..return }; //~ ERROR unreachable +LL | let x = Foo { a: 22, b: return, ..return }; | ^^^^^^ error: unreachable expression --> $DIR/expr_struct.rs:29:13 | -LL | let x = Foo { a: 22, b: return }; //~ ERROR unreachable +LL | let x = Foo { a: 22, b: return }; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/reachable/expr_tup.stderr b/src/test/ui/reachable/expr_tup.stderr index def678ec93ea..1837031107d5 100644 --- a/src/test/ui/reachable/expr_tup.stderr +++ b/src/test/ui/reachable/expr_tup.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_tup.rs:9:38 | -LL | let x: (usize, usize) = (return, 2); //~ ERROR unreachable +LL | let x: (usize, usize) = (return, 2); | ^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/expr_tup.rs:14:29 | -LL | let x: (usize, usize) = (2, return); //~ ERROR unreachable +LL | let x: (usize, usize) = (2, return); | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/reachable/expr_type.stderr b/src/test/ui/reachable/expr_type.stderr index b90cd7903417..f867c8916341 100644 --- a/src/test/ui/reachable/expr_type.stderr +++ b/src/test/ui/reachable/expr_type.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_type.rs:9:13 | -LL | let x = {return}: !; //~ ERROR unreachable +LL | let x = {return}: !; | ^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_unary.stderr b/src/test/ui/reachable/expr_unary.stderr index 44887f0ee523..61982289cdc6 100644 --- a/src/test/ui/reachable/expr_unary.stderr +++ b/src/test/ui/reachable/expr_unary.stderr @@ -1,13 +1,13 @@ error[E0600]: cannot apply unary operator `!` to type `!` --> $DIR/expr_unary.rs:8:16 | -LL | let x: ! = ! { return; }; //~ ERROR unreachable +LL | let x: ! = ! { return; }; | ^^^^^^^^^^^^^ cannot apply unary operator `!` error: unreachable expression --> $DIR/expr_unary.rs:8:16 | -LL | let x: ! = ! { return; }; //~ ERROR unreachable +LL | let x: ! = ! { return; }; | ^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/recursion/recursion.stderr b/src/test/ui/recursion/recursion.stderr index 1bef37ad5888..9213ba052a9e 100644 --- a/src/test/ui/recursion/recursion.stderr +++ b/src/test/ui/recursion/recursion.stderr @@ -1,7 +1,7 @@ error: reached the recursion limit while instantiating `test::>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` --> $DIR/recursion.rs:12:1 | -LL | / fn test (n:isize, i:isize, first:T, second:T) ->isize { //~ ERROR recursion limit +LL | / fn test (n:isize, i:isize, first:T, second:T) ->isize { LL | | match n { 0 => {first.dot(second)} LL | | // FIXME(#4287) Error message should be here. It should be LL | | // a type error to instantiate `test` at a type other than T. diff --git a/src/test/ui/recursion/recursive-reexports.stderr b/src/test/ui/recursion/recursive-reexports.stderr index 681931ef830f..01afc1458afb 100644 --- a/src/test/ui/recursion/recursive-reexports.stderr +++ b/src/test/ui/recursion/recursive-reexports.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `S` in module `recursive_reexports` --> $DIR/recursive-reexports.rs:5:32 | -LL | fn f() -> recursive_reexports::S {} //~ ERROR cannot find type `S` in module `recursive_reexports` +LL | fn f() -> recursive_reexports::S {} | ^ not found in `recursive_reexports` error: aborting due to previous error diff --git a/src/test/ui/ref-suggestion.stderr b/src/test/ui/ref-suggestion.stderr index 1f871bafeec9..df677a611cd5 100644 --- a/src/test/ui/ref-suggestion.stderr +++ b/src/test/ui/ref-suggestion.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | let y = x; | - value moved here -LL | x; //~ ERROR use of moved value +LL | x; | ^ value used here after move | = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x` | LL | let mut y = x; | ----- value moved here -LL | x; //~ ERROR use of moved value +LL | x; | ^ value used here after move | = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait @@ -24,7 +24,7 @@ error[E0382]: use of partially moved value: `x` LL | (Some(y), ()) => {}, | - value moved here ... -LL | x; //~ ERROR use of partially moved value +LL | x; | ^ value used here after move | = note: move occurs because the value has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/regions-fn-subtyping-return-static-fail.stderr b/src/test/ui/regions-fn-subtyping-return-static-fail.stderr index 66e6a615b33b..35478a7db860 100644 --- a/src/test/ui/regions-fn-subtyping-return-static-fail.stderr +++ b/src/test/ui/regions-fn-subtyping-return-static-fail.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-fn-subtyping-return-static-fail.rs:40:12 | -LL | want_F(bar); //~ ERROR mismatched types +LL | want_F(bar); | ^^^ expected concrete lifetime, found bound lifetime parameter 'cx | = note: expected type `for<'cx> fn(&'cx S) -> &'cx S` @@ -10,7 +10,7 @@ LL | want_F(bar); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/regions-fn-subtyping-return-static-fail.rs:48:12 | -LL | want_G(baz); //~ ERROR mismatched types +LL | want_G(baz); | ^^^ expected concrete lifetime, found bound lifetime parameter 'cx | = note: expected type `for<'cx> fn(&'cx S) -> &'static S` diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr b/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr index 3e60efd14720..cb888ab66c47 100644 --- a/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr +++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr @@ -3,8 +3,8 @@ warning: function cannot return without recursing | LL | fn call_rec(mut f: F) -> usize where F: FnMut(usize) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -LL | //~^ WARN function cannot return without recursing -LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` +LL | +LL | (|x| f(x))(call_rec(f)) | ----------- recursive call site | = note: #[warn(unconditional_recursion)] on by default @@ -13,7 +13,7 @@ LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` error[E0505]: cannot move out of `f` because it is borrowed --> $DIR/region-bound-on-closure-outlives-call.rs:3:25 | -LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` +LL | (|x| f(x))(call_rec(f)) | --- ^ move out of `f` occurs here | | | borrow of `f` occurs here diff --git a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr index 16c31fbcac0f..ec71d55705e8 100644 --- a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr +++ b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr @@ -13,18 +13,18 @@ LL | z: Box+'b+'c>, note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 11:15 --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:15 | -LL | struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used +LL | struct Foo<'a,'b,'c> { | ^^ note: but lifetime parameter must outlive the lifetime 'a as defined on the struct at 11:12 --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:12 | -LL | struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used +LL | struct Foo<'a,'b,'c> { | ^^ error[E0392]: parameter `'c` is never used --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:18 | -LL | struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used +LL | struct Foo<'a,'b,'c> { | ^^ unused type parameter | = help: consider removing `'c` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr index 5c8b3d3ba692..7b901c2f9601 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... LL | // Illegal now because there is no `'b:'a` declaration. -LL | *x = *y; //~ ERROR E0623 +LL | *x = *y; | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch @@ -13,13 +13,13 @@ error[E0623]: lifetime mismatch LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... ... -LL | a(x, y); //~ ERROR lifetime mismatch [E0623] +LL | a(x, y); | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:43 | -LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types +LL | let _: fn(&mut &isize, &mut &isize) = a; | ^ expected concrete lifetime, found bound lifetime parameter | = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr index f36885f7aeb9..3e42cfcffb43 100644 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | --------- --------- these two types are declared with different lifetimes... LL | // Illegal now because there is no `'b:'a` declaration. -LL | *x = *y; //~ ERROR E0623 +LL | *x = *y; | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch @@ -15,7 +15,7 @@ LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | | | these two types are declared with different lifetimes... ... -LL | *z = *y; //~ ERROR E0623 +LL | *z = *y; | ^^ ...but data from `y` flows into `z` here error[E0623]: lifetime mismatch @@ -24,13 +24,13 @@ error[E0623]: lifetime mismatch LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | --------- --------- these two types are declared with different lifetimes... ... -LL | a(x, y, z); //~ ERROR lifetime mismatch [E0623] +LL | a(x, y, z); | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:56 | -LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR E0308 +LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; | ^ expected concrete lifetime, found bound lifetime parameter | = note: expected type `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)` diff --git a/src/test/ui/regions/region-object-lifetime-2.stderr b/src/test/ui/regions/region-object-lifetime-2.stderr index f1e87ebf4749..8817ad1c9f73 100644 --- a/src/test/ui/regions/region-object-lifetime-2.stderr +++ b/src/test/ui/regions/region-object-lifetime-2.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements --> $DIR/region-object-lifetime-2.rs:10:7 | -LL | x.borrowed() //~ ERROR cannot infer +LL | x.borrowed() | ^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:42... @@ -12,7 +12,7 @@ LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-2.rs:10:5 | -LL | x.borrowed() //~ ERROR cannot infer +LL | x.borrowed() | ^ note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 9:45... --> $DIR/region-object-lifetime-2.rs:9:45 @@ -22,7 +22,7 @@ LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-2.rs:10:5 | -LL | x.borrowed() //~ ERROR cannot infer +LL | x.borrowed() | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/region-object-lifetime-4.stderr b/src/test/ui/regions/region-object-lifetime-4.stderr index 862a469ddb98..fee7f40efd48 100644 --- a/src/test/ui/regions/region-object-lifetime-4.stderr +++ b/src/test/ui/regions/region-object-lifetime-4.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements --> $DIR/region-object-lifetime-4.rs:12:7 | -LL | x.borrowed() //~ ERROR cannot infer +LL | x.borrowed() | ^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 11:41... @@ -12,7 +12,7 @@ LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-4.rs:12:5 | -LL | x.borrowed() //~ ERROR cannot infer +LL | x.borrowed() | ^ note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 11:44... --> $DIR/region-object-lifetime-4.rs:11:44 @@ -22,7 +22,7 @@ LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-4.rs:12:5 | -LL | x.borrowed() //~ ERROR cannot infer +LL | x.borrowed() | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/region-object-lifetime-5.stderr b/src/test/ui/regions/region-object-lifetime-5.stderr index 002bae18b1c0..1efaee181cb7 100644 --- a/src/test/ui/regions/region-object-lifetime-5.stderr +++ b/src/test/ui/regions/region-object-lifetime-5.stderr @@ -1,7 +1,7 @@ error[E0597]: `*x` does not live long enough --> $DIR/region-object-lifetime-5.rs:11:5 | -LL | x.borrowed() //~ ERROR `*x` does not live long enough +LL | x.borrowed() | ^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/regions/regions-addr-of-arg.stderr b/src/test/ui/regions/regions-addr-of-arg.stderr index 61e28b8bbead..3e76a7dda992 100644 --- a/src/test/ui/regions/regions-addr-of-arg.stderr +++ b/src/test/ui/regions/regions-addr-of-arg.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/regions-addr-of-arg.rs:5:31 | -LL | let _p: &'static isize = &a; //~ ERROR `a` does not live long enough +LL | let _p: &'static isize = &a; | ^ borrowed value does not live long enough LL | } | - borrowed value only lives until here @@ -11,7 +11,7 @@ LL | } error[E0597]: `a` does not live long enough --> $DIR/regions-addr-of-arg.rs:13:6 | -LL | &a //~ ERROR `a` does not live long enough +LL | &a | ^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/regions/regions-addr-of-self.stderr b/src/test/ui/regions/regions-addr-of-self.stderr index 2ea8aecacdae..a0b8b6b51e5a 100644 --- a/src/test/ui/regions/regions-addr-of-self.stderr +++ b/src/test/ui/regions/regions-addr-of-self.stderr @@ -1,27 +1,27 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-addr-of-self.rs:7:37 | -LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer +LL | let p: &'static mut usize = &mut self.cats_chased; | ^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 6:5... --> $DIR/regions-addr-of-self.rs:6:5 | LL | / pub fn chase_cat(&mut self) { -LL | | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer +LL | | let p: &'static mut usize = &mut self.cats_chased; LL | | *p += 1; LL | | } | |_____^ note: ...so that reference does not outlive borrowed content --> $DIR/regions-addr-of-self.rs:7:37 | -LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer +LL | let p: &'static mut usize = &mut self.cats_chased; | ^^^^^^^^^^^^^^^^^^^^^ = note: but, the lifetime must be valid for the static lifetime... note: ...so that reference does not outlive borrowed content --> $DIR/regions-addr-of-self.rs:7:37 | -LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer +LL | let p: &'static mut usize = &mut self.cats_chased; | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.stderr index 97470aae54a0..01b2631a5371 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.stderr +++ b/src/test/ui/regions/regions-addr-of-upvar-self.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-addr-of-upvar-self.rs:10:41 | -LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer +LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime as defined on the body at 9:18... @@ -12,13 +12,13 @@ LL | let _f = || { note: ...so that reference does not outlive borrowed content --> $DIR/regions-addr-of-upvar-self.rs:10:41 | -LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer +LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^ = note: but, the lifetime must be valid for the static lifetime... note: ...so that reference does not outlive borrowed content --> $DIR/regions-addr-of-upvar-self.rs:10:41 | -LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer +LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-adjusted-lvalue-op.stderr b/src/test/ui/regions/regions-adjusted-lvalue-op.stderr index 9988289b91e6..2c4c75f323ce 100644 --- a/src/test/ui/regions/regions-adjusted-lvalue-op.stderr +++ b/src/test/ui/regions/regions-adjusted-lvalue-op.stderr @@ -1,7 +1,7 @@ error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable --> $DIR/regions-adjusted-lvalue-op.rs:14:17 | -LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because +LL | v[0].oh_no(&v); | - ^- mutable borrow ends here | | | | | immutable borrow occurs here @@ -10,7 +10,7 @@ LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable --> $DIR/regions-adjusted-lvalue-op.rs:15:17 | -LL | (*v).oh_no(&v); //~ ERROR cannot borrow `v` as immutable because +LL | (*v).oh_no(&v); | - ^- mutable borrow ends here | | | | | immutable borrow occurs here diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr index dbda9f4067b0..c72d6483c28f 100644 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr @@ -1,7 +1,7 @@ error[E0477]: the type `&'a isize` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:22:5 | -LL | assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lifetime +LL | assert_send::<&'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime @@ -9,7 +9,7 @@ LL | assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lif error[E0477]: the type `&'a str` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 | -LL | assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifetime +LL | assert_send::<&'a str>(); | ^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime @@ -17,7 +17,7 @@ LL | assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifet error[E0477]: the type `&'a [isize]` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5 | -LL | assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required lifetime +LL | assert_send::<&'a [isize]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime @@ -25,7 +25,7 @@ LL | assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required l error[E0477]: the type `std::boxed::Box<&'a isize>` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5 | -LL | assert_send::>(); //~ ERROR does not fulfill the required lifetime +LL | assert_send::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime @@ -33,7 +33,7 @@ LL | assert_send::>(); //~ ERROR does not fulfill the require error[E0477]: the type `*const &'a isize` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5 | -LL | assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the required lifetime +LL | assert_send::<*const &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime @@ -41,7 +41,7 @@ LL | assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the requi error[E0477]: the type `*mut &'a isize` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5 | -LL | assert_send::<*mut &'a isize>(); //~ ERROR does not fulfill the required lifetime +LL | assert_send::<*mut &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr index 50339590ee54..eb205a303dbd 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) { | ------- ------- these two types are declared with different lifetimes... LL | // Here the value provided for 'y is 'y, and hence 'y:'x does not hold. -LL | a.bigger_region(b) //~ ERROR lifetime mismatch [E0623] +LL | a.bigger_region(b) | ^^^^^^^^^^^^^ ...but data from `b` flows into `a` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr index c9cbacded907..de1073cd1d9d 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { | ------- ------- these two types are declared with different lifetimes... LL | // Here the value provided for 'y is 'b, and hence 'b:'a does not hold. -LL | f.method(b); //~ ERROR lifetime mismatch [E0623] +LL | f.method(b); | ^^^^^^ ...but data from `b` flows into `a` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-bounds.stderr b/src/test/ui/regions/regions-bounds.stderr index 95857e987751..27eb8891c6c0 100644 --- a/src/test/ui/regions/regions-bounds.stderr +++ b/src/test/ui/regions/regions-bounds.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-bounds.rs:9:12 | -LL | return e; //~ ERROR mismatched types +LL | return e; | ^ lifetime mismatch | = note: expected type `TupleStruct<'b>` @@ -20,7 +20,7 @@ LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { error[E0308]: mismatched types --> $DIR/regions-bounds.rs:13:12 | -LL | return e; //~ ERROR mismatched types +LL | return e; | ^ lifetime mismatch | = note: expected type `Struct<'b>` diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.stderr b/src/test/ui/regions/regions-close-associated-type-into-object.stderr index 182081ede0c6..89c0c2534266 100644 --- a/src/test/ui/regions/regions-close-associated-type-into-object.stderr +++ b/src/test/ui/regions/regions-close-associated-type-into-object.stderr @@ -1,53 +1,53 @@ error[E0310]: the associated type `::Item` may not live long enough --> $DIR/regions-close-associated-type-into-object.rs:15:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `::Item: 'static`... note: ...so that the type `::Item` will meet its required lifetime bounds --> $DIR/regions-close-associated-type-into-object.rs:15:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ error[E0310]: the associated type `::Item` may not live long enough --> $DIR/regions-close-associated-type-into-object.rs:22:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `::Item: 'static`... note: ...so that the type `std::boxed::Box<::Item>` will meet its required lifetime bounds --> $DIR/regions-close-associated-type-into-object.rs:22:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ error[E0309]: the associated type `::Item` may not live long enough --> $DIR/regions-close-associated-type-into-object.rs:28:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `::Item: 'a`... note: ...so that the type `::Item` will meet its required lifetime bounds --> $DIR/regions-close-associated-type-into-object.rs:28:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ error[E0309]: the associated type `::Item` may not live long enough --> $DIR/regions-close-associated-type-into-object.rs:35:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `::Item: 'a`... note: ...so that the type `std::boxed::Box<::Item>` will meet its required lifetime bounds --> $DIR/regions-close-associated-type-into-object.rs:35:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/regions/regions-close-object-into-object-1.stderr b/src/test/ui/regions/regions-close-object-into-object-1.stderr index 817f664db45d..c7bde8dbd6df 100644 --- a/src/test/ui/regions/regions-close-object-into-object-1.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-1.stderr @@ -1,7 +1,7 @@ error[E0597]: `*v` does not live long enough --> $DIR/regions-close-object-into-object-1.rs:12:12 | -LL | box B(&*v) as Box //~ ERROR `*v` does not live long enough +LL | box B(&*v) as Box | ^^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/regions/regions-close-object-into-object-2.stderr b/src/test/ui/regions/regions-close-object-into-object-2.stderr index de9a250ced66..d5e228e1f0d9 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-close-object-into-object-2.rs:10:11 | -LL | box B(&*v) as Box //~ ERROR cannot infer +LL | box B(&*v) as Box | ^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:6... @@ -12,7 +12,7 @@ LL | fn g<'a, T: 'static>(v: Box+'a>) -> Box { note: ...so that the type `(dyn A + 'a)` is not borrowed for too long --> $DIR/regions-close-object-into-object-2.rs:10:11 | -LL | box B(&*v) as Box //~ ERROR cannot infer +LL | box B(&*v) as Box | ^^^ = note: but, the lifetime must be valid for the static lifetime... = note: ...so that the expression is assignable: diff --git a/src/test/ui/regions/regions-close-object-into-object-3.stderr b/src/test/ui/regions/regions-close-object-into-object-3.stderr index 1736a5f215cd..122e57a3250c 100644 --- a/src/test/ui/regions/regions-close-object-into-object-3.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-3.stderr @@ -1,7 +1,7 @@ error[E0597]: `*v` does not live long enough --> $DIR/regions-close-object-into-object-3.rs:11:12 | -LL | box B(&*v) as Box //~ ERROR `*v` does not live long enough +LL | box B(&*v) as Box | ^^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/regions/regions-close-object-into-object-4.stderr b/src/test/ui/regions/regions-close-object-into-object-4.stderr index 87bf28d74d4d..c9ad95d31d6a 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-close-object-into-object-4.rs:10:11 | -LL | box B(&*v) as Box //~ ERROR cannot infer +LL | box B(&*v) as Box | ^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:6... @@ -12,7 +12,7 @@ LL | fn i<'a, T, U>(v: Box+'a>) -> Box { note: ...so that the type `(dyn A + 'a)` is not borrowed for too long --> $DIR/regions-close-object-into-object-4.rs:10:11 | -LL | box B(&*v) as Box //~ ERROR cannot infer +LL | box B(&*v) as Box | ^^^ = note: but, the lifetime must be valid for the static lifetime... = note: ...so that the expression is assignable: diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr index 4803ae844151..68809eb548b2 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | -LL | box v as Box //~ ERROR cannot infer an appropriate lifetime +LL | box v as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 18:20... @@ -12,7 +12,7 @@ LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { note: ...so that the declared lifetime parameter bounds are satisfied --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | -LL | box v as Box //~ ERROR cannot infer an appropriate lifetime +LL | box v as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^ note: but, the lifetime must be valid for the lifetime 'c as defined on the function body at 18:26... --> $DIR/regions-close-over-type-parameter-multiple.rs:18:26 diff --git a/src/test/ui/regions/regions-close-param-into-object.stderr b/src/test/ui/regions/regions-close-param-into-object.stderr index 58028fc7bd8c..a7f05723817e 100644 --- a/src/test/ui/regions/regions-close-param-into-object.stderr +++ b/src/test/ui/regions/regions-close-param-into-object.stderr @@ -4,13 +4,13 @@ error[E0310]: the parameter type `T` may not live long enough LL | fn p1(v: T) -> Box | - help: consider adding an explicit lifetime bound `T: 'static`... ... -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-close-param-into-object.rs:6:5 | -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ error[E0310]: the parameter type `T` may not live long enough @@ -19,13 +19,13 @@ error[E0310]: the parameter type `T` may not live long enough LL | fn p2(v: Box) -> Box | - help: consider adding an explicit lifetime bound `T: 'static`... ... -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ | note: ...so that the type `std::boxed::Box` will meet its required lifetime bounds --> $DIR/regions-close-param-into-object.rs:12:5 | -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -34,13 +34,13 @@ error[E0309]: the parameter type `T` may not live long enough LL | fn p3<'a,T>(v: T) -> Box | - help: consider adding an explicit lifetime bound `T: 'a`... ... -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-close-param-into-object.rs:18:5 | -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -49,13 +49,13 @@ error[E0309]: the parameter type `T` may not live long enough LL | fn p4<'a,T>(v: Box) -> Box | - help: consider adding an explicit lifetime bound `T: 'a`... ... -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ | note: ...so that the type `std::boxed::Box` will meet its required lifetime bounds --> $DIR/regions-close-param-into-object.rs:24:5 | -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/regions/regions-creating-enums.stderr b/src/test/ui/regions/regions-creating-enums.stderr index 36cd6d0c22e5..bb11be9b7581 100644 --- a/src/test/ui/regions/regions-creating-enums.stderr +++ b/src/test/ui/regions/regions-creating-enums.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/regions-creating-enums.rs:23:17 | -LL | return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Num((*f)(x)); | ^^^^^^^^^^^^^^^^^- temporary value only lives until here | | | temporary value does not live long enough @@ -16,7 +16,7 @@ LL | fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usi error[E0597]: borrowed value does not live long enough --> $DIR/regions-creating-enums.rs:28:17 | -LL | return &Ast::Add(m_x, m_y); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Add(m_x, m_y); | ^^^^^^^^^^^^^^^^^^- temporary value only lives until here | | | temporary value does not live long enough diff --git a/src/test/ui/regions/regions-creating-enums3.stderr b/src/test/ui/regions/regions-creating-enums3.stderr index 2a0efaa598c7..2fc1fc3f6812 100644 --- a/src/test/ui/regions/regions-creating-enums3.stderr +++ b/src/test/ui/regions/regions-creating-enums3.stderr @@ -5,7 +5,7 @@ LL | fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { | ----------- ------- | | | this parameter and the return type are declared with different lifetimes... -LL | Ast::Add(x, y) //~ ERROR lifetime mismatch [E0623] +LL | Ast::Add(x, y) | ^^^^^^^^^^^^^^ ...but data from `y` is returned here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-creating-enums4.stderr b/src/test/ui/regions/regions-creating-enums4.stderr index 569530768b83..4d00783d180b 100644 --- a/src/test/ui/regions/regions-creating-enums4.stderr +++ b/src/test/ui/regions/regions-creating-enums4.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements --> $DIR/regions-creating-enums4.rs:7:5 | -LL | Ast::Add(x, y) //~ ERROR cannot infer +LL | Ast::Add(x, y) | ^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 6:16... diff --git a/src/test/ui/regions/regions-enum-not-wf.stderr b/src/test/ui/regions/regions-enum-not-wf.stderr index d10f7ed28fc2..870140856675 100644 --- a/src/test/ui/regions/regions-enum-not-wf.stderr +++ b/src/test/ui/regions/regions-enum-not-wf.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | enum Ref1<'a, T> { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | Ref1Variant1(RequireOutlives<'a, T>) //~ ERROR the parameter type `T` may not live long enough +LL | Ref1Variant1(RequireOutlives<'a, T>) | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-enum-not-wf.rs:18:18 | -LL | Ref1Variant1(RequireOutlives<'a, T>) //~ ERROR the parameter type `T` may not live long enough +LL | Ref1Variant1(RequireOutlives<'a, T>) | ^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -18,40 +18,40 @@ error[E0309]: the parameter type `T` may not live long enough LL | enum Ref2<'a, T> { | - help: consider adding an explicit lifetime bound `T: 'a`... LL | Ref2Variant1, -LL | Ref2Variant2(isize, RequireOutlives<'a, T>), //~ ERROR the parameter type `T` may not live long enough +LL | Ref2Variant2(isize, RequireOutlives<'a, T>), | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-enum-not-wf.rs:23:25 | -LL | Ref2Variant2(isize, RequireOutlives<'a, T>), //~ ERROR the parameter type `T` may not live long enough +LL | Ref2Variant2(isize, RequireOutlives<'a, T>), | ^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-enum-not-wf.rs:35:1 | -LL | enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] +LL | enum RefDouble<'a, 'b, T> { | ^ - help: consider adding an explicit lifetime bound `T: 'b`... | _| | | LL | | RefDoubleVariant1(&'a RequireOutlives<'b, T>) -LL | | //~^ the parameter type `T` may not live long enough [E0309] +LL | | LL | | } | |_^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-enum-not-wf.rs:35:1 | -LL | / enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] +LL | / enum RefDouble<'a, 'b, T> { LL | | RefDoubleVariant1(&'a RequireOutlives<'b, T>) -LL | | //~^ the parameter type `T` may not live long enough [E0309] +LL | | LL | | } | |_^ error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-enum-not-wf.rs:36:23 | -LL | enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] +LL | enum RefDouble<'a, 'b, T> { | - help: consider adding an explicit lifetime bound `T: 'b`... LL | RefDoubleVariant1(&'a RequireOutlives<'b, T>) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-escape-method.stderr b/src/test/ui/regions/regions-escape-method.stderr index 8575a24281d0..b93dd0d4c57c 100644 --- a/src/test/ui/regions/regions-escape-method.stderr +++ b/src/test/ui/regions/regions-escape-method.stderr @@ -1,13 +1,13 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/regions-escape-method.rs:15:13 | -LL | s.f(|p| p) //~ ERROR cannot infer +LL | s.f(|p| p) | ^ | note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 15:9... --> $DIR/regions-escape-method.rs:15:9 | -LL | s.f(|p| p) //~ ERROR cannot infer +LL | s.f(|p| p) | ^^^^^ = note: ...so that the expression is assignable: expected &i32 @@ -15,12 +15,12 @@ LL | s.f(|p| p) //~ ERROR cannot infer note: but, the lifetime must be valid for the method call at 15:5... --> $DIR/regions-escape-method.rs:15:5 | -LL | s.f(|p| p) //~ ERROR cannot infer +LL | s.f(|p| p) | ^^^^^^^^^^ note: ...so that a type/lifetime parameter is in scope here --> $DIR/regions-escape-method.rs:15:5 | -LL | s.f(|p| p) //~ ERROR cannot infer +LL | s.f(|p| p) | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-escape-via-trait-or-not.stderr b/src/test/ui/regions/regions-escape-via-trait-or-not.stderr index 8f4bfd889a83..a6b165e2d444 100644 --- a/src/test/ui/regions/regions-escape-via-trait-or-not.stderr +++ b/src/test/ui/regions/regions-escape-via-trait-or-not.stderr @@ -1,13 +1,13 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/regions-escape-via-trait-or-not.rs:18:14 | -LL | with(|o| o) //~ ERROR cannot infer +LL | with(|o| o) | ^ | note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 18:10... --> $DIR/regions-escape-via-trait-or-not.rs:18:10 | -LL | with(|o| o) //~ ERROR cannot infer +LL | with(|o| o) | ^^^^^ = note: ...so that the expression is assignable: expected &isize @@ -15,12 +15,12 @@ LL | with(|o| o) //~ ERROR cannot infer note: but, the lifetime must be valid for the expression at 18:5... --> $DIR/regions-escape-via-trait-or-not.rs:18:5 | -LL | with(|o| o) //~ ERROR cannot infer +LL | with(|o| o) | ^^^^ note: ...so type `fn([closure@$DIR/regions-escape-via-trait-or-not.rs:18:10: 18:15]) -> isize {with::<&isize, [closure@$DIR/regions-escape-via-trait-or-not.rs:18:10: 18:15]>}` of expression is valid during the expression --> $DIR/regions-escape-via-trait-or-not.rs:18:5 | -LL | with(|o| o) //~ ERROR cannot infer +LL | with(|o| o) | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-fn-subtyping-return-static.stderr b/src/test/ui/regions/regions-fn-subtyping-return-static.stderr index 42a5a7c806e0..cda5ce273bd9 100644 --- a/src/test/ui/regions/regions-fn-subtyping-return-static.stderr +++ b/src/test/ui/regions/regions-fn-subtyping-return-static.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-fn-subtyping-return-static.rs:41:12 | -LL | want_F(bar); //~ ERROR mismatched types +LL | want_F(bar); | ^^^ expected concrete lifetime, found bound lifetime parameter 'cx | = note: expected type `for<'cx> fn(&'cx S) -> &'cx S` diff --git a/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr b/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr index e3f42d592283..3b8f09f1ad80 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr @@ -2,7 +2,7 @@ error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the --> $DIR/regions-free-region-ordering-callee-4.rs:5:1 | LL | / fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { -LL | | //~^ ERROR reference has a longer lifetime than the data it references +LL | | LL | | // Do not infer ordering from closure argument types. LL | | let z: Option<&'a &'b usize> = None; LL | | } diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.stderr index b5c66386341a..4648bf046bc7 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee.stderr @@ -6,7 +6,7 @@ LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize { | | | this parameter and the return type are declared with different lifetimes... LL | // However, it is not safe to assume that 'b <= 'a -LL | &*y //~ ERROR lifetime mismatch [E0623] +LL | &*y | ^^^ ...but data from `x` is returned here error[E0623]: lifetime mismatch diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr index 12e080726763..676e96a038b4 100644 --- a/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-free-region-ordering-incorrect.rs:17:21 | -LL | None => &self.val //~ ERROR cannot infer +LL | None => &self.val | ^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the method body at 14:12... @@ -12,7 +12,7 @@ LL | fn get<'a>(&'a self) -> &'b T { note: ...so that reference does not outlive borrowed content --> $DIR/regions-free-region-ordering-incorrect.rs:17:21 | -LL | None => &self.val //~ ERROR cannot infer +LL | None => &self.val | ^^^^^^^^^ note: but, the lifetime must be valid for the lifetime 'b as defined on the impl at 13:6... --> $DIR/regions-free-region-ordering-incorrect.rs:13:6 @@ -24,7 +24,7 @@ note: ...so that reference does not outlive borrowed content | LL | / match self.next { LL | | Some(ref next) => next.get(), -LL | | None => &self.val //~ ERROR cannot infer +LL | | None => &self.val LL | | } | |_________^ diff --git a/src/test/ui/regions/regions-glb-free-free.stderr b/src/test/ui/regions/regions-glb-free-free.stderr index 23492b3c718e..575037a0a4d6 100644 --- a/src/test/ui/regions/regions-glb-free-free.stderr +++ b/src/test/ui/regions/regions-glb-free-free.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `s` | LL | pub fn set_desc(self, s: &str) -> Flag<'a> { | ---- help: add explicit lifetime `'a` to the type of `s`: `&'a str` -LL | / Flag { //~ ERROR explicit lifetime required in the type of `s` [E0621] +LL | / Flag { LL | | name: self.name, LL | | desc: s, LL | | max_count: self.max_count, diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr index e2a4a1eec425..ca86eb7edae1 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr @@ -2,7 +2,7 @@ error[E0491]: in type `&'x (dyn for<'z> Trait1<>::Foo> + 'x) --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:1 | LL | / fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< >::Foo >) -LL | | //~^ ERROR reference has a longer lifetime than the data it references +LL | | LL | | { LL | | } | |_^ diff --git a/src/test/ui/regions/regions-in-enums-anon.stderr b/src/test/ui/regions/regions-in-enums-anon.stderr index 9cfdb67939f1..ae06e7653dbe 100644 --- a/src/test/ui/regions/regions-in-enums-anon.stderr +++ b/src/test/ui/regions/regions-in-enums-anon.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/regions-in-enums-anon.rs:4:9 | -LL | Bar(&isize) //~ ERROR missing lifetime specifier +LL | Bar(&isize) | ^ expected lifetime parameter error: aborting due to previous error diff --git a/src/test/ui/regions/regions-in-enums.stderr b/src/test/ui/regions/regions-in-enums.stderr index d0137d1afefb..cfed9feba4b8 100644 --- a/src/test/ui/regions/regions-in-enums.stderr +++ b/src/test/ui/regions/regions-in-enums.stderr @@ -1,13 +1,13 @@ error[E0261]: use of undeclared lifetime name `'foo` --> $DIR/regions-in-enums.rs:13:9 | -LL | X5(&'foo usize) //~ ERROR use of undeclared lifetime name `'foo` +LL | X5(&'foo usize) | ^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-in-enums.rs:17:9 | -LL | X6(&'a usize) //~ ERROR use of undeclared lifetime name `'a` +LL | X6(&'a usize) | ^^ undeclared lifetime error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-in-structs-anon.stderr b/src/test/ui/regions/regions-in-structs-anon.stderr index 9defd82aed59..a1d4ebb597b4 100644 --- a/src/test/ui/regions/regions-in-structs-anon.stderr +++ b/src/test/ui/regions/regions-in-structs-anon.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/regions-in-structs-anon.rs:4:8 | -LL | x: &isize //~ ERROR missing lifetime specifier +LL | x: &isize | ^ expected lifetime parameter error: aborting due to previous error diff --git a/src/test/ui/regions/regions-in-structs.stderr b/src/test/ui/regions/regions-in-structs.stderr index dea7f1054183..8314942759d1 100644 --- a/src/test/ui/regions/regions-in-structs.stderr +++ b/src/test/ui/regions/regions-in-structs.stderr @@ -1,13 +1,13 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-in-structs.rs:10:9 | -LL | a: &'a isize, //~ ERROR use of undeclared lifetime name `'a` +LL | a: &'a isize, | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-in-structs.rs:11:9 | -LL | b: &'a isize, //~ ERROR use of undeclared lifetime name `'a` +LL | b: &'a isize, | ^^ undeclared lifetime error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr b/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr index 562ec649a48e..ed4bc155040f 100644 --- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr +++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr @@ -1,7 +1,7 @@ error[E0597]: `*p` does not live long enough --> $DIR/regions-infer-borrow-scope-too-big.rs:11:23 | -LL | let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough +LL | let xc = x_coord(&*p); | ^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.stderr b/src/test/ui/regions/regions-infer-bound-from-trait.stderr index 100ac7633584..382d932e81ad 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `A` may not live long enough | LL | fn bar1<'a,A>(x: Inv<'a>, a: A) { | - help: consider adding an explicit lifetime bound `A: 'a`... -LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough +LL | check_bound(x, a) | ^^^^^^^^^^^ | note: ...so that the type `A` will meet its required lifetime bounds --> $DIR/regions-infer-bound-from-trait.rs:33:5 | -LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough +LL | check_bound(x, a) | ^^^^^^^^^^^ error[E0309]: the parameter type `A` may not live long enough @@ -17,13 +17,13 @@ error[E0309]: the parameter type `A` may not live long enough | LL | fn bar2<'a,'b,A:Is<'b>>(x: Inv<'a>, y: Inv<'b>, a: A) { | -- help: consider adding an explicit lifetime bound `A: 'a`... -LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough +LL | check_bound(x, a) | ^^^^^^^^^^^ | note: ...so that the type `A` will meet its required lifetime bounds --> $DIR/regions-infer-bound-from-trait.rs:37:5 | -LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough +LL | check_bound(x, a) | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr index 9dafc1680866..f3a0358b90fb 100644 --- a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr @@ -7,7 +7,7 @@ LL | s: &'short isize, LL | l: &'long isize, | ------------ ... -LL | let _: Contravariant<'long> = c; //~ ERROR E0623 +LL | let _: Contravariant<'long> = c; | ^ ...but data from `c` flows into `l` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr index a47427036661..c3e2075fbc37 100644 --- a/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr @@ -6,7 +6,7 @@ LL | fn use_<'short,'long>(c: Covariant<'long>, LL | s: &'short isize, | ------------- these two types are declared with different lifetimes... ... -LL | let _: Covariant<'short> = c; //~ ERROR E0623 +LL | let _: Covariant<'short> = c; | ^ ...but data from `s` flows into `c` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr index 8d8c218958a2..d31ed3ede36f 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-infer-invariance-due-to-decl.rs:12:5 | -LL | b_isize //~ ERROR mismatched types +LL | b_isize | ^^^^^^^ lifetime mismatch | = note: expected type `Invariant<'static>` diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr index 7058757f908e..f8bdd014db7c 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:10:5 | -LL | b_isize //~ ERROR mismatched types +LL | b_isize | ^^^^^^^ lifetime mismatch | = note: expected type `Invariant<'static>` diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr index 51b2330b658f..1de6f22f08e5 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:10:5 | -LL | b_isize //~ ERROR mismatched types +LL | b_isize | ^^^^^^^ lifetime mismatch | = note: expected type `Invariant<'static>` diff --git a/src/test/ui/regions/regions-infer-not-param.stderr b/src/test/ui/regions/regions-infer-not-param.stderr index d0d41c271c6b..f43ab8291218 100644 --- a/src/test/ui/regions/regions-infer-not-param.stderr +++ b/src/test/ui/regions/regions-infer-not-param.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-infer-not-param.rs:15:54 | -LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types +LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^ lifetime mismatch | = note: expected type `Direct<'b>` @@ -9,18 +9,18 @@ LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatch note: the lifetime 'a as defined on the function body at 15:16... --> $DIR/regions-infer-not-param.rs:15:16 | -LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types +LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^^ note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 15:19 --> $DIR/regions-infer-not-param.rs:15:19 | -LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types +LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^^ error[E0308]: mismatched types --> $DIR/regions-infer-not-param.rs:19:63 | -LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^ lifetime mismatch | = note: expected type `Indirect2<'b>` @@ -28,18 +28,18 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR note: the lifetime 'a as defined on the function body at 19:19... --> $DIR/regions-infer-not-param.rs:19:19 | -LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 19:22 --> $DIR/regions-infer-not-param.rs:19:22 | -LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ error[E0308]: mismatched types --> $DIR/regions-infer-not-param.rs:19:63 | -LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^ lifetime mismatch | = note: expected type `Indirect2<'b>` @@ -47,12 +47,12 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR note: the lifetime 'b as defined on the function body at 19:22... --> $DIR/regions-infer-not-param.rs:19:22 | -LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 19:19 --> $DIR/regions-infer-not-param.rs:19:19 | -LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.stderr index 47de228e31d2..1b999ed059c4 100644 --- a/src/test/ui/regions/regions-infer-paramd-indirect.stderr +++ b/src/test/ui/regions/regions-infer-paramd-indirect.stderr @@ -11,10 +11,10 @@ note: the anonymous lifetime #2 defined on the method body at 21:5... | LL | / fn set_f_bad(&mut self, b: Box) { LL | | self.f = b; -LL | | //~^ ERROR mismatched types -LL | | //~| expected type `std::boxed::Box>` -LL | | //~| found type `std::boxed::Box>` -LL | | //~| lifetime mismatch +LL | | +LL | | +LL | | +LL | | LL | | } | |_____^ note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 16:6 diff --git a/src/test/ui/regions/regions-infer-proc-static-upvar.stderr b/src/test/ui/regions/regions-infer-proc-static-upvar.stderr index f929a06bad75..21b2e881a79a 100644 --- a/src/test/ui/regions/regions-infer-proc-static-upvar.stderr +++ b/src/test/ui/regions/regions-infer-proc-static-upvar.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/regions-infer-proc-static-upvar.rs:10:14 | -LL | let y = &x; //~ ERROR `x` does not live long enough +LL | let y = &x; | ^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr index 99d85e9e4b5a..46200e4d84bc 100644 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... LL | // Illegal now because there is no `'b:'a` declaration. -LL | *x = *y; //~ ERROR E0623 +LL | *x = *y; | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch @@ -13,13 +13,13 @@ error[E0623]: lifetime mismatch LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... ... -LL | a(x, y); //~ ERROR lifetime mismatch [E0623] +LL | a(x, y); | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types --> $DIR/regions-lifetime-bounds-on-fns.rs:20:43 | -LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR E0308 +LL | let _: fn(&mut &isize, &mut &isize) = a; | ^ expected concrete lifetime, found bound lifetime parameter | = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` diff --git a/src/test/ui/regions/regions-name-duplicated.stderr b/src/test/ui/regions/regions-name-duplicated.stderr index 1b552006a934..a7e03a61adcf 100644 --- a/src/test/ui/regions/regions-name-duplicated.stderr +++ b/src/test/ui/regions/regions-name-duplicated.stderr @@ -1,7 +1,7 @@ error[E0263]: lifetime name `'a` declared twice in the same scope --> $DIR/regions-name-duplicated.rs:1:16 | -LL | struct Foo<'a, 'a> { //~ ERROR lifetime name `'a` declared twice +LL | struct Foo<'a, 'a> { | -- ^^ declared twice | | | previous declaration here diff --git a/src/test/ui/regions/regions-name-static.stderr b/src/test/ui/regions/regions-name-static.stderr index bf7b021f9fe5..4b7026e65eac 100644 --- a/src/test/ui/regions/regions-name-static.stderr +++ b/src/test/ui/regions/regions-name-static.stderr @@ -1,7 +1,7 @@ error[E0262]: invalid lifetime parameter name: `'static` --> $DIR/regions-name-static.rs:1:12 | -LL | struct Foo<'static> { //~ ERROR invalid lifetime parameter name: `'static` +LL | struct Foo<'static> { | ^^^^^^^ 'static is a reserved lifetime name error: aborting due to previous error diff --git a/src/test/ui/regions/regions-name-undeclared.stderr b/src/test/ui/regions/regions-name-undeclared.stderr index 7b041d5dad5e..4840d751f7f5 100644 --- a/src/test/ui/regions/regions-name-undeclared.stderr +++ b/src/test/ui/regions/regions-name-undeclared.stderr @@ -1,67 +1,67 @@ error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:15:24 | -LL | fn m4(&self, arg: &'b isize) { } //~ ERROR undeclared lifetime +LL | fn m4(&self, arg: &'b isize) { } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:16:12 | -LL | fn m5(&'b self) { } //~ ERROR undeclared lifetime +LL | fn m5(&'b self) { } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:17:27 | -LL | fn m6(&self, arg: Foo<'b>) { } //~ ERROR undeclared lifetime +LL | fn m6(&self, arg: Foo<'b>) { } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:25:22 | -LL | type X = Option<&'a isize>; //~ ERROR undeclared lifetime +LL | type X = Option<&'a isize>; | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:27:13 | -LL | E1(&'a isize) //~ ERROR undeclared lifetime +LL | E1(&'a isize) | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:30:13 | -LL | f: &'a isize //~ ERROR undeclared lifetime +LL | f: &'a isize | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:32:14 | -LL | fn f(a: &'a isize) { } //~ ERROR undeclared lifetime +LL | fn f(a: &'a isize) { } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:40:17 | -LL | fn fn_types(a: &'a isize, //~ ERROR undeclared lifetime +LL | fn fn_types(a: &'a isize, | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:42:36 | -LL | &'b isize, //~ ERROR undeclared lifetime +LL | &'b isize, | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:45:36 | -LL | &'b isize)>, //~ ERROR undeclared lifetime +LL | &'b isize)>, | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:46:17 | -LL | c: &'a isize) //~ ERROR undeclared lifetime +LL | c: &'a isize) | ^^ undeclared lifetime error: aborting due to 11 previous errors diff --git a/src/test/ui/regions/regions-nested-fns-2.stderr b/src/test/ui/regions/regions-nested-fns-2.stderr index 924eac6fdd41..08bab6e98063 100644 --- a/src/test/ui/regions/regions-nested-fns-2.stderr +++ b/src/test/ui/regions/regions-nested-fns-2.stderr @@ -3,7 +3,7 @@ error[E0373]: closure may outlive the current function, but it borrows `y`, whic | LL | |z| { | ^^^ may outlive borrowed value `y` -LL | //~^ ERROR E0373 +LL | LL | if false { &y } else { z } | - `y` is borrowed here help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword diff --git a/src/test/ui/regions/regions-nested-fns.stderr b/src/test/ui/regions/regions-nested-fns.stderr index d6d4c44de61d..3cecd4ee83ca 100644 --- a/src/test/ui/regions/regions-nested-fns.stderr +++ b/src/test/ui/regions/regions-nested-fns.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/regions-nested-fns.rs:5:18 | -LL | let mut ay = &y; //~ ERROR E0495 +LL | let mut ay = &y; | ^^ | note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 7:54... @@ -24,7 +24,7 @@ note: but, the lifetime must be valid for the anonymous lifetime #2 defined on t | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ____________________________________________________________________^ -LL | | if false { return x; } //~ ERROR E0312 +LL | | if false { return x; } LL | | if false { return ay; } LL | | return z; LL | | })); @@ -36,7 +36,7 @@ LL | | })); error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/regions-nested-fns.rs:14:27 | -LL | if false { return x; } //~ ERROR E0312 +LL | if false { return x; } | ^ | note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 13:68... @@ -44,7 +44,7 @@ note: ...the reference is valid for the anonymous lifetime #2 defined on the bod | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ____________________________________________________________________^ -LL | | if false { return x; } //~ ERROR E0312 +LL | | if false { return x; } LL | | if false { return ay; } LL | | return z; LL | | })); diff --git a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr index a4197eed2252..c44edf1f03bc 100644 --- a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr +++ b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements --> $DIR/regions-normalize-in-where-clause-list.rs:22:1 | -LL | / fn bar<'a, 'b>() //~ ERROR cannot infer +LL | / fn bar<'a, 'b>() LL | | where <() as Project<'a, 'b>>::Item : Eq LL | | { LL | | } @@ -10,12 +10,12 @@ LL | | } note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 22:8... --> $DIR/regions-normalize-in-where-clause-list.rs:22:8 | -LL | fn bar<'a, 'b>() //~ ERROR cannot infer +LL | fn bar<'a, 'b>() | ^^ note: ...but the lifetime must also be valid for the lifetime 'b as defined on the function body at 22:12... --> $DIR/regions-normalize-in-where-clause-list.rs:22:12 | -LL | fn bar<'a, 'b>() //~ ERROR cannot infer +LL | fn bar<'a, 'b>() | ^^ = note: ...so that the types are compatible: expected Project<'a, 'b> diff --git a/src/test/ui/regions/regions-outlives-projection-container.stderr b/src/test/ui/regions/regions-outlives-projection-container.stderr index 884314f421a1..b50347ac9642 100644 --- a/src/test/ui/regions/regions-outlives-projection-container.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container.stderr @@ -52,7 +52,7 @@ LL | fn call_with_assoc<'a,'b>() { error[E0491]: in type `&'a WithoutAssoc>`, reference has a longer lifetime than the data it references --> $DIR/regions-outlives-projection-container.rs:74:12 | -LL | call::<&'a WithoutAssoc>>(); //~ ERROR reference has a longer lifetime +LL | call::<&'a WithoutAssoc>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime 'a as defined on the function body at 71:23 diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr index ad80925cad7d..3e3201db240c 100644 --- a/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr +++ b/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr @@ -1,7 +1,7 @@ error[E0597]: `line` does not live long enough --> $DIR/regions-pattern-typing-issue-19552.rs:5:14 | -LL | match [&*line] { //~ ERROR `line` does not live long enough +LL | match [&*line] { | ^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/regions/regions-proc-bound-capture.stderr b/src/test/ui/regions/regions-proc-bound-capture.stderr index 31be3ab4d3d5..aea7347d53c2 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.stderr +++ b/src/test/ui/regions/regions-proc-bound-capture.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `x` LL | fn static_proc(x: &isize) -> Box(isize) + 'static> { | ------ help: add explicit lifetime `'static` to the type of `x`: `&'static isize` LL | // This is illegal, because the region bound on `proc` is 'static. -LL | Box::new(move|| { *x }) //~ ERROR explicit lifetime required in the type of `x` [E0621] +LL | Box::new(move|| { *x }) | ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required error: aborting due to previous error diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr index 5670e5305ebb..aca3a1ed0572 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr @@ -5,7 +5,7 @@ LL | fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b m | ----------------------------- ------------- | | | this parameter and the return type are declared with different lifetimes... -LL | &mut ***p //~ ERROR lifetime mismatch [E0623] +LL | &mut ***p | ^^^^^^^^^ ...but data from `p` is returned here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr index 90004e27d95c..a9916dbe4f5e 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr @@ -5,7 +5,7 @@ LL | fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize { | --------------------- ------------- | | | this parameter and the return type are declared with different lifetimes... -LL | &mut **p //~ ERROR lifetime mismatch [E0623] +LL | &mut **p | ^^^^^^^^ ...but data from `p` is returned here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.stderr b/src/test/ui/regions/regions-ref-in-fn-arg.stderr index 748508ecbcd3..9ecd327510a8 100644 --- a/src/test/ui/regions/regions-ref-in-fn-arg.stderr +++ b/src/test/ui/regions/regions-ref-in-fn-arg.stderr @@ -3,7 +3,7 @@ error[E0597]: borrowed value does not live long enough | LL | fn arg_item(box ref x: Box) -> &'static isize { | ^^^^^ borrowed value does not live long enough -LL | x //~^ ERROR borrowed value does not live long enough +LL | x LL | } | - borrowed value only lives until here | @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/regions-ref-in-fn-arg.rs:11:15 | -LL | with(|box ref x| x) //~ ERROR borrowed value does not live long enough +LL | with(|box ref x| x) | ^^^^^ - borrowed value only lives until here | | | borrowed value does not live long enough diff --git a/src/test/ui/regions/regions-ret.stderr b/src/test/ui/regions/regions-ret.stderr index 001f62ab60cd..77820a34e40b 100644 --- a/src/test/ui/regions/regions-ret.stderr +++ b/src/test/ui/regions/regions-ret.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/regions-ret.rs:4:13 | -LL | return &id(3); //~ ERROR borrowed value does not live long enough +LL | return &id(3); | ^^^^^- temporary value only lives until here | | | temporary value does not live long enough @@ -10,7 +10,7 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the --> $DIR/regions-ret.rs:3:1 | LL | / fn f(_x: &isize) -> &isize { -LL | | return &id(3); //~ ERROR borrowed value does not live long enough +LL | | return &id(3); LL | | } | |_^ = note: consider using a `let` binding to increase its lifetime diff --git a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr index e4b14811d907..9cf0b0ffabde 100644 --- a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr +++ b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr @@ -1,18 +1,18 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24 | -LL | let mut f = || &mut x; //~ ERROR cannot infer +LL | let mut f = || &mut x; | ^^^^^^ | note: first, the lifetime cannot outlive the lifetime as defined on the body at 7:21... --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:21 | -LL | let mut f = || &mut x; //~ ERROR cannot infer +LL | let mut f = || &mut x; | ^^^^^^^^^ note: ...so that closure can access `x` --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24 | -LL | let mut f = || &mut x; //~ ERROR cannot infer +LL | let mut f = || &mut x; | ^^^^^^ note: but, the lifetime must be valid for the call at 9:17... --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:9:17 diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.stderr b/src/test/ui/regions/regions-return-stack-allocated-vec.stderr index 78eec7cc456e..3256294473f1 100644 --- a/src/test/ui/regions/regions-return-stack-allocated-vec.stderr +++ b/src/test/ui/regions/regions-return-stack-allocated-vec.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/regions-return-stack-allocated-vec.rs:4:6 | -LL | &[x] //~ ERROR borrowed value does not live long enough +LL | &[x] | ^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/regions/regions-steal-closure.stderr b/src/test/ui/regions/regions-steal-closure.stderr index dc5c16715352..8cfd5b503121 100644 --- a/src/test/ui/regions/regions-steal-closure.stderr +++ b/src/test/ui/regions/regions-steal-closure.stderr @@ -1,7 +1,7 @@ error[E0597]: `i` does not live long enough --> $DIR/regions-steal-closure.rs:14:28 | -LL | box_it(Box::new(|| i += 1)) //~ ERROR `i` does not live long enough +LL | box_it(Box::new(|| i += 1)) | -- ^ borrowed value does not live long enough | | | capture occurs here diff --git a/src/test/ui/regions/regions-trait-1.stderr b/src/test/ui/regions/regions-trait-1.stderr index e1aa2a2c2993..421f826ccc54 100644 --- a/src/test/ui/regions/regions-trait-1.stderr +++ b/src/test/ui/regions/regions-trait-1.stderr @@ -1,7 +1,7 @@ error[E0308]: method not compatible with trait --> $DIR/regions-trait-1.rs:16:5 | -LL | fn get_ctxt(&self) -> &'a Ctxt { //~ ERROR method not compatible with trait +LL | fn get_ctxt(&self) -> &'a Ctxt { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `fn(&HasCtxt<'a>) -> &Ctxt` @@ -14,7 +14,7 @@ LL | impl<'a> GetCtxt for HasCtxt<'a> { note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 16:5 --> $DIR/regions-trait-1.rs:16:5 | -LL | / fn get_ctxt(&self) -> &'a Ctxt { //~ ERROR method not compatible with trait +LL | / fn get_ctxt(&self) -> &'a Ctxt { LL | | self.c LL | | } | |_____^ diff --git a/src/test/ui/regions/regions-trait-object-subtyping.stderr b/src/test/ui/regions/regions-trait-object-subtyping.stderr index dc5ce34d7d89..3b30ddd16ccc 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.stderr @@ -1,7 +1,7 @@ error[E0478]: lifetime bound not satisfied --> $DIR/regions-trait-object-subtyping.rs:15:5 | -LL | x //~ ERROR lifetime bound not satisfied +LL | x | ^ | note: lifetime parameter instantiated with the lifetime 'a as defined on the function body at 13:9 @@ -18,7 +18,7 @@ LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements --> $DIR/regions-trait-object-subtyping.rs:15:5 | -LL | x //~ ERROR lifetime bound not satisfied +LL | x | ^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 13:9... @@ -29,7 +29,7 @@ LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { note: ...so that reference does not outlive borrowed content --> $DIR/regions-trait-object-subtyping.rs:15:5 | -LL | x //~ ERROR lifetime bound not satisfied +LL | x | ^ note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 13:12... --> $DIR/regions-trait-object-subtyping.rs:13:12 @@ -43,7 +43,7 @@ LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { error[E0308]: mismatched types --> $DIR/regions-trait-object-subtyping.rs:22:5 | -LL | x //~ ERROR mismatched types +LL | x | ^ lifetime mismatch | = note: expected type `Wrapper<&'b mut (dyn Dummy + 'b)>` diff --git a/src/test/ui/regions/regions-trait-variance.stderr b/src/test/ui/regions/regions-trait-variance.stderr index ddc8ce9796d6..32c89b8eeff5 100644 --- a/src/test/ui/regions/regions-trait-variance.stderr +++ b/src/test/ui/regions/regions-trait-variance.stderr @@ -1,7 +1,7 @@ error[E0597]: `*b` does not live long enough --> $DIR/regions-trait-variance.rs:37:19 | -LL | let bb: &B = &*b; //~ ERROR `*b` does not live long enough +LL | let bb: &B = &*b; | ^^ borrowed value does not live long enough LL | make_a(bb) LL | } diff --git a/src/test/ui/regions/regions-undeclared.stderr b/src/test/ui/regions/regions-undeclared.stderr index 7e35dc1c4741..495aec3fde5f 100644 --- a/src/test/ui/regions/regions-undeclared.stderr +++ b/src/test/ui/regions/regions-undeclared.stderr @@ -1,31 +1,31 @@ error[E0261]: use of undeclared lifetime name `'blk` --> $DIR/regions-undeclared.rs:1:14 | -LL | static c_x: &'blk isize = &22; //~ ERROR use of undeclared lifetime name `'blk` +LL | static c_x: &'blk isize = &22; | ^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:4:10 | -LL | Foo(&'a isize), //~ ERROR use of undeclared lifetime name `'a` +LL | Foo(&'a isize), | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:5:10 | -LL | Bar(&'a isize), //~ ERROR use of undeclared lifetime name `'a` +LL | Bar(&'a isize), | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:8:15 | -LL | fn fnDecl(x: &'a isize, //~ ERROR use of undeclared lifetime name `'a` +LL | fn fnDecl(x: &'a isize, | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:9:15 | -LL | y: &'a isize) //~ ERROR use of undeclared lifetime name `'a` +LL | y: &'a isize) | ^^ undeclared lifetime error: aborting due to 5 previous errors diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.stderr index f474b9a2343c..0363fe0d19f1 100644 --- a/src/test/ui/regions/regions-var-type-out-of-scope.stderr +++ b/src/test/ui/regions/regions-var-type-out-of-scope.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/regions-var-type-out-of-scope.rs:9:14 | -LL | x = &id(3); //~ ERROR borrowed value does not live long enough +LL | x = &id(3); | ^^^^^- temporary value dropped here while still borrowed | | | temporary value does not live long enough diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr index 20615e6a3d7b..e135007604b8 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr @@ -6,7 +6,7 @@ LL | fn use_<'short,'long>(c: S<'long, 'short>, | | | this type is declared with multiple lifetimes... ... -LL | let _: S<'long, 'long> = c; //~ ERROR E0623 +LL | let _: S<'long, 'long> = c; | ^ ...but data with one lifetime flows into the other here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr index da8d21881919..e7c106cbbe3d 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr @@ -7,7 +7,7 @@ LL | s: &'short isize, LL | l: &'long isize, | ------------ ... -LL | let _: Contravariant<'long> = c; //~ ERROR E0623 +LL | let _: Contravariant<'long> = c; | ^ ...but data from `c` flows into `l` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr b/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr index 74a6aee26276..e5e5261ba993 100644 --- a/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr +++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr @@ -6,7 +6,7 @@ LL | fn use_<'short,'long>(c: Covariant<'long>, LL | s: &'short isize, | ------------- these two types are declared with different lifetimes... ... -LL | let _: Covariant<'short> = c; //~ ERROR E0623 +LL | let _: Covariant<'short> = c; | ^ ...but data from `s` flows into `c` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr b/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr index 2332acdf8321..2a2d5d019a12 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr @@ -6,7 +6,7 @@ LL | fn use_<'short,'long>(c: Invariant<'long>, LL | s: &'short isize, | ------------- these two types are declared with different lifetimes... ... -LL | let _: Invariant<'short> = c; //~ ERROR E0623 +LL | let _: Invariant<'short> = c; | ^ ...but data from `s` flows into `c` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr index f1d1a14f52b8..90b37ce935a6 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-variance-invariant-use-covariant.rs:17:33 | -LL | let _: Invariant<'static> = c; //~ ERROR mismatched types +LL | let _: Invariant<'static> = c; | ^ lifetime mismatch | = note: expected type `Invariant<'static>` diff --git a/src/test/ui/regions/regions-wf-trait-object.stderr b/src/test/ui/regions/regions-wf-trait-object.stderr index c26895773761..3dc1c4dcd22d 100644 --- a/src/test/ui/regions/regions-wf-trait-object.stderr +++ b/src/test/ui/regions/regions-wf-trait-object.stderr @@ -1,7 +1,7 @@ error[E0478]: lifetime bound not satisfied --> $DIR/regions-wf-trait-object.rs:7:5 | -LL | x: Box+'b> //~ ERROR E0478 +LL | x: Box+'b> | ^^^^^^^^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 6:15 diff --git a/src/test/ui/reject-specialized-drops-8142.stderr b/src/test/ui/reject-specialized-drops-8142.stderr index 1782d3b31058..7dacc1f27402 100644 --- a/src/test/ui/reject-specialized-drops-8142.stderr +++ b/src/test/ui/reject-specialized-drops-8142.stderr @@ -2,7 +2,7 @@ error[E0367]: The requirement `'adds_bnd : 'al` is added only by the Drop impl. --> $DIR/reject-specialized-drops-8142.rs:19:1 | LL | / impl<'al,'adds_bnd:'al> Drop for K<'al,'adds_bnd> { // REJECT -LL | | //~^ ERROR The requirement `'adds_bnd : 'al` is added only by the Drop impl. +LL | | LL | | fn drop(&mut self) { } } | |____________________________^ | @@ -16,7 +16,7 @@ error[E0367]: The requirement `'adds_bnd : 'al` is added only by the Drop impl. --> $DIR/reject-specialized-drops-8142.rs:23:1 | LL | / impl<'al,'adds_bnd> Drop for L<'al,'adds_bnd> where 'adds_bnd:'al { // REJECT -LL | | //~^ ERROR The requirement `'adds_bnd : 'al` is added only by the Drop impl. +LL | | LL | | fn drop(&mut self) { } } | |____________________________^ | diff --git a/src/test/ui/repr/repr-align-assign.stderr b/src/test/ui/repr/repr-align-assign.stderr index 884a99357cdb..cc046e04de54 100644 --- a/src/test/ui/repr/repr-align-assign.stderr +++ b/src/test/ui/repr/repr-align-assign.stderr @@ -1,13 +1,13 @@ error[E0693]: incorrect `repr(align)` attribute format --> $DIR/repr-align-assign.rs:5:8 | -LL | #[repr(align=8)] //~ ERROR incorrect `repr(align)` attribute format +LL | #[repr(align=8)] | ^^^^^^^ help: use parentheses instead: `align(8)` error[E0693]: incorrect `repr(align)` attribute format --> $DIR/repr-align-assign.rs:8:8 | -LL | #[repr(align="8")] //~ ERROR incorrect `repr(align)` attribute format +LL | #[repr(align="8")] | ^^^^^^^^^ help: use parentheses instead: `align(8)` error: aborting due to 2 previous errors diff --git a/src/test/ui/repr/repr-align.stderr b/src/test/ui/repr/repr-align.stderr index f1a5d88ace1f..641f117a7171 100644 --- a/src/test/ui/repr/repr-align.stderr +++ b/src/test/ui/repr/repr-align.stderr @@ -1,25 +1,25 @@ error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer --> $DIR/repr-align.rs:4:8 | -LL | #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer +LL | #[repr(align(16.0))] | ^^^^^^^^^^^ error[E0589]: invalid `repr(align)` attribute: not a power of two --> $DIR/repr-align.rs:7:8 | -LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two +LL | #[repr(align(15))] | ^^^^^^^^^ error[E0589]: invalid `repr(align)` attribute: larger than 2^29 --> $DIR/repr-align.rs:10:8 | -LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29 +LL | #[repr(align(4294967296))] | ^^^^^^^^^^^^^^^^^ error[E0589]: invalid `repr(align)` attribute: not a power of two --> $DIR/repr-align.rs:16:8 | -LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two +LL | #[repr(align(15))] | ^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/repr/repr-packed-contains-align.stderr b/src/test/ui/repr/repr-packed-contains-align.stderr index 59f8b359d1f5..df001d6b5f2a 100644 --- a/src/test/ui/repr/repr-packed-contains-align.stderr +++ b/src/test/ui/repr/repr-packed-contains-align.stderr @@ -1,31 +1,31 @@ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:19:1 | -LL | struct SC(SA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | struct SC(SA); | ^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:22:1 | -LL | struct SD(SB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | struct SD(SB); | ^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:25:1 | -LL | struct SE(UA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | struct SE(UA); | ^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:28:1 | -LL | struct SF(UB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | struct SF(UB); | ^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:31:1 | -LL | / union UC { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | / union UC { LL | | a: UA LL | | } | |_^ @@ -33,7 +33,7 @@ LL | | } error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:36:1 | -LL | / union UD { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | / union UD { LL | | n: UB LL | | } | |_^ @@ -41,7 +41,7 @@ LL | | } error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:41:1 | -LL | / union UE { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | / union UE { LL | | a: SA LL | | } | |_^ @@ -49,7 +49,7 @@ LL | | } error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:46:1 | -LL | / union UF { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | / union UF { LL | | n: SB LL | | } | |_^ diff --git a/src/test/ui/repr/repr-transparent-other-items.stderr b/src/test/ui/repr/repr-transparent-other-items.stderr index 5b7f9650d0c0..c3fb1d9e21e6 100644 --- a/src/test/ui/repr/repr-transparent-other-items.stderr +++ b/src/test/ui/repr/repr-transparent-other-items.stderr @@ -1,15 +1,15 @@ error[E0517]: attribute should be applied to struct --> $DIR/repr-transparent-other-items.rs:3:8 | -LL | #[repr(transparent)] //~ ERROR unsupported representation for zero-variant enum +LL | #[repr(transparent)] | ^^^^^^^^^^^ -LL | enum Void {} //~| ERROR should be applied to struct +LL | enum Void {} | ------------ not a struct error[E0517]: attribute should be applied to struct --> $DIR/repr-transparent-other-items.rs:6:8 | -LL | #[repr(transparent)] //~ ERROR should be applied to struct +LL | #[repr(transparent)] | ^^^^^^^^^^^ LL | / enum FieldlessEnum { LL | | Foo, @@ -20,7 +20,7 @@ LL | | } error[E0517]: attribute should be applied to struct --> $DIR/repr-transparent-other-items.rs:12:8 | -LL | #[repr(transparent)] //~ ERROR should be applied to struct +LL | #[repr(transparent)] | ^^^^^^^^^^^ LL | / enum Enum { LL | | Foo(String), @@ -31,7 +31,7 @@ LL | | } error[E0517]: attribute should be applied to struct --> $DIR/repr-transparent-other-items.rs:18:8 | -LL | #[repr(transparent)] //~ ERROR should be applied to struct +LL | #[repr(transparent)] | ^^^^^^^^^^^ LL | / union Foo { LL | | u: u32, @@ -42,7 +42,7 @@ LL | | } error[E0517]: attribute should be applied to struct --> $DIR/repr-transparent-other-items.rs:24:8 | -LL | #[repr(transparent)] //~ ERROR should be applied to struct +LL | #[repr(transparent)] | ^^^^^^^^^^^ LL | fn cant_repr_this() {} | ---------------------- not a struct @@ -50,7 +50,7 @@ LL | fn cant_repr_this() {} error[E0517]: attribute should be applied to struct --> $DIR/repr-transparent-other-items.rs:27:8 | -LL | #[repr(transparent)] //~ ERROR should be applied to struct +LL | #[repr(transparent)] | ^^^^^^^^^^^ LL | static CANT_REPR_THIS: u32 = 0; | ------------------------------- not a struct @@ -58,9 +58,9 @@ LL | static CANT_REPR_THIS: u32 = 0; error[E0084]: unsupported representation for zero-variant enum --> $DIR/repr-transparent-other-items.rs:3:1 | -LL | #[repr(transparent)] //~ ERROR unsupported representation for zero-variant enum +LL | #[repr(transparent)] | ^^^^^^^^^^^^^^^^^^^^ -LL | enum Void {} //~| ERROR should be applied to struct +LL | enum Void {} | ------------ zero-variant enum error: aborting due to 7 previous errors diff --git a/src/test/ui/repr/repr-transparent-other-reprs.stderr b/src/test/ui/repr/repr-transparent-other-reprs.stderr index 1aafa4362492..9b48bb3a43d2 100644 --- a/src/test/ui/repr/repr-transparent-other-reprs.stderr +++ b/src/test/ui/repr/repr-transparent-other-reprs.stderr @@ -1,25 +1,25 @@ error[E0692]: transparent struct cannot have other repr hints --> $DIR/repr-transparent-other-reprs.rs:5:8 | -LL | #[repr(transparent, C)] //~ ERROR cannot have other repr +LL | #[repr(transparent, C)] | ^^^^^^^^^^^ ^ error[E0692]: transparent struct cannot have other repr hints --> $DIR/repr-transparent-other-reprs.rs:10:8 | -LL | #[repr(transparent, packed)] //~ ERROR cannot have other repr +LL | #[repr(transparent, packed)] | ^^^^^^^^^^^ ^^^^^^ error[E0692]: transparent struct cannot have other repr hints --> $DIR/repr-transparent-other-reprs.rs:13:8 | -LL | #[repr(transparent, align(2))] //~ ERROR cannot have other repr +LL | #[repr(transparent, align(2))] | ^^^^^^^^^^^ ^^^^^^^^ error[E0692]: transparent struct cannot have other repr hints --> $DIR/repr-transparent-other-reprs.rs:16:8 | -LL | #[repr(transparent)] //~ ERROR cannot have other repr +LL | #[repr(transparent)] | ^^^^^^^^^^^ LL | #[repr(C)] | ^ diff --git a/src/test/ui/repr/repr-transparent.stderr b/src/test/ui/repr/repr-transparent.stderr index 02bf2154fe59..2ecee838be14 100644 --- a/src/test/ui/repr/repr-transparent.stderr +++ b/src/test/ui/repr/repr-transparent.stderr @@ -1,7 +1,7 @@ error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 --> $DIR/repr-transparent.rs:11:1 | -LL | struct NoFields; //~ ERROR needs exactly one non-zero-sized field +LL | struct NoFields; | ^^^^^^^^^^^^^^^^ | = note: non-zero-sized field @@ -9,7 +9,7 @@ LL | struct NoFields; //~ ERROR needs exactly one non-zero-sized field error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 --> $DIR/repr-transparent.rs:14:1 | -LL | struct ContainsOnlyZst(()); //~ ERROR needs exactly one non-zero-sized field +LL | struct ContainsOnlyZst(()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: non-zero-sized field @@ -17,7 +17,7 @@ LL | struct ContainsOnlyZst(()); //~ ERROR needs exactly one non-zero-sized fiel error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 --> $DIR/repr-transparent.rs:17:1 | -LL | struct ContainsOnlyZstArray([bool; 0]); //~ ERROR needs exactly one non-zero-sized field +LL | struct ContainsOnlyZstArray([bool; 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: non-zero-sized field @@ -33,13 +33,13 @@ LL | struct ContainsMultipleZst(PhantomData<*const i32>, NoFields); error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 2 --> $DIR/repr-transparent.rs:24:1 | -LL | struct MultipleNonZst(u8, u8); //~ ERROR needs exactly one non-zero-sized field +LL | struct MultipleNonZst(u8, u8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: non-zero-sized field --> $DIR/repr-transparent.rs:24:23 | -LL | struct MultipleNonZst(u8, u8); //~ ERROR needs exactly one non-zero-sized field +LL | struct MultipleNonZst(u8, u8); | ^^ ^^ error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 2 @@ -57,13 +57,13 @@ LL | pub struct StructWithProjection(f32, ::It); error[E0691]: zero-sized field in transparent struct has alignment larger than 1 --> $DIR/repr-transparent.rs:34:32 | -LL | struct NontrivialAlignZst(u32, [u16; 0]); //~ ERROR alignment larger than 1 +LL | struct NontrivialAlignZst(u32, [u16; 0]); | ^^^^^^^^ error[E0691]: zero-sized field in transparent struct has alignment larger than 1 --> $DIR/repr-transparent.rs:40:24 | -LL | struct GenericAlign(ZstAlign32, u32); //~ ERROR alignment larger than 1 +LL | struct GenericAlign(ZstAlign32, u32); | ^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/reserved/reserved-attr-on-macro.stderr b/src/test/ui/reserved/reserved-attr-on-macro.stderr index 46d3478b6284..3e082e53ca83 100644 --- a/src/test/ui/reserved/reserved-attr-on-macro.stderr +++ b/src/test/ui/reserved/reserved-attr-on-macro.stderr @@ -9,7 +9,7 @@ LL | #[rustc_attribute_should_be_reserved] error: cannot determine resolution for the macro `foo` --> $DIR/reserved-attr-on-macro.rs:8:5 | -LL | foo!(); //~ ERROR cannot determine resolution for the macro `foo` +LL | foo!(); | ^^^ | = note: import resolution is stuck, try simplifying macro imports diff --git a/src/test/ui/resolve/issue-17518.stderr b/src/test/ui/resolve/issue-17518.stderr index 5d080d989446..057aac25234d 100644 --- a/src/test/ui/resolve/issue-17518.stderr +++ b/src/test/ui/resolve/issue-17518.stderr @@ -1,7 +1,7 @@ error[E0422]: cannot find struct, variant or union type `E` in this scope --> $DIR/issue-17518.rs:6:5 | -LL | E { name: "foobar" }; //~ ERROR cannot find struct, variant or union type `E` +LL | E { name: "foobar" }; | ^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/resolve/issue-22692.stderr b/src/test/ui/resolve/issue-22692.stderr index 1c8d959d60d6..13752430e714 100644 --- a/src/test/ui/resolve/issue-22692.stderr +++ b/src/test/ui/resolve/issue-22692.stderr @@ -1,7 +1,7 @@ error[E0423]: expected value, found struct `String` --> $DIR/issue-22692.rs:2:13 | -LL | let _ = String.new(); //~ ERROR expected value, found struct `String` +LL | let _ = String.new(); | ^^^^^^---- | | | help: use `::` to access an associated function: `String::new` diff --git a/src/test/ui/resolve/issue-33876.stderr b/src/test/ui/resolve/issue-33876.stderr index fb61abc95054..29a63fdd11fe 100644 --- a/src/test/ui/resolve/issue-33876.stderr +++ b/src/test/ui/resolve/issue-33876.stderr @@ -1,7 +1,7 @@ error[E0423]: expected value, found trait `Bar` --> $DIR/issue-33876.rs:10:22 | -LL | let any: &Any = &Bar; //~ ERROR expected value, found trait `Bar` +LL | let any: &Any = &Bar; | ^^^ not a value error: aborting due to previous error diff --git a/src/test/ui/resolve/issue-3907.stderr b/src/test/ui/resolve/issue-3907.stderr index 55bd555676ab..49f7ae844910 100644 --- a/src/test/ui/resolve/issue-3907.stderr +++ b/src/test/ui/resolve/issue-3907.stderr @@ -1,7 +1,7 @@ error[E0404]: expected trait, found type alias `Foo` --> $DIR/issue-3907.rs:10:6 | -LL | impl Foo for S { //~ ERROR expected trait, found type alias `Foo` +LL | impl Foo for S { | ^^^ type aliases cannot be used as traits | = note: did you mean to use a trait alias? diff --git a/src/test/ui/resolve/issue-5035.stderr b/src/test/ui/resolve/issue-5035.stderr index 57ad5f22f4c2..68d35f3b5fef 100644 --- a/src/test/ui/resolve/issue-5035.stderr +++ b/src/test/ui/resolve/issue-5035.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `ImportError` --> $DIR/issue-5035.rs:5:5 | -LL | use ImportError; //~ ERROR unresolved import `ImportError` [E0432] +LL | use ImportError; | ^^^^^^^^^^^ no `ImportError` in the root error[E0404]: expected trait, found type alias `K` --> $DIR/issue-5035.rs:3:6 | -LL | impl K for isize {} //~ ERROR expected trait, found type alias `K` +LL | impl K for isize {} | ^ | | | type aliases cannot be used as traits diff --git a/src/test/ui/resolve/issue-54379.stderr b/src/test/ui/resolve/issue-54379.stderr index 9dbab6917c7e..60a6f904610b 100644 --- a/src/test/ui/resolve/issue-54379.stderr +++ b/src/test/ui/resolve/issue-54379.stderr @@ -1,7 +1,7 @@ error: expected `}`, found `,` --> $DIR/issue-54379.rs:9:22 | -LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` +LL | MyStruct { .., Some(_) } => {}, | --^ | | | | | expected `}` @@ -10,13 +10,13 @@ LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention error: expected `,` --> $DIR/issue-54379.rs:9:24 | -LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` +LL | MyStruct { .., Some(_) } => {}, | ^^^^ error[E0027]: pattern does not mention field `s1` --> $DIR/issue-54379.rs:9:9 | -LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` +LL | MyStruct { .., Some(_) } => {}, | ^^^^^^^^^^^^^^^^^^^^^^^^ missing field `s1` error: aborting due to 3 previous errors diff --git a/src/test/ui/resolve/issue-6702.stderr b/src/test/ui/resolve/issue-6702.stderr index 906ac2808aa9..9a46f0d77426 100644 --- a/src/test/ui/resolve/issue-6702.stderr +++ b/src/test/ui/resolve/issue-6702.stderr @@ -1,7 +1,7 @@ error[E0423]: expected function, found struct `Monster` --> $DIR/issue-6702.rs:7:14 | -LL | let _m = Monster(); //~ ERROR expected function, found struct `Monster` +LL | let _m = Monster(); | ^^^^^^^ did you mean `Monster { /* fields */ }`? error: aborting due to previous error diff --git a/src/test/ui/resolve/name-clash-nullary.stderr b/src/test/ui/resolve/name-clash-nullary.stderr index 5bb9371da6d2..51793f426d6d 100644 --- a/src/test/ui/resolve/name-clash-nullary.stderr +++ b/src/test/ui/resolve/name-clash-nullary.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/name-clash-nullary.rs:2:7 | -LL | let None: isize = 42; //~ ERROR mismatched types +LL | let None: isize = 42; | ^^^^ expected isize, found enum `std::option::Option` | = note: expected type `isize` diff --git a/src/test/ui/resolve/resolve-bad-import-prefix.stderr b/src/test/ui/resolve/resolve-bad-import-prefix.stderr index f39e1edb6134..852b9c6afff3 100644 --- a/src/test/ui/resolve/resolve-bad-import-prefix.stderr +++ b/src/test/ui/resolve/resolve-bad-import-prefix.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `Nonexistent` --> $DIR/resolve-bad-import-prefix.rs:12:5 | -LL | use Nonexistent::{}; //~ ERROR unresolved import `Nonexistent` +LL | use Nonexistent::{}; | ^^^^^^^^^^^^^^^ no `Nonexistent` in the root error: aborting due to previous error diff --git a/src/test/ui/resolve/resolve-bad-visibility.stderr b/src/test/ui/resolve/resolve-bad-visibility.stderr index 519e7a946e14..32b85f202f1d 100644 --- a/src/test/ui/resolve/resolve-bad-visibility.stderr +++ b/src/test/ui/resolve/resolve-bad-visibility.stderr @@ -1,31 +1,31 @@ error: visibilities can only be restricted to ancestor modules --> $DIR/resolve-bad-visibility.rs:6:8 | -LL | pub(in std::vec) struct F; //~ ERROR visibilities can only be restricted to ancestor modules +LL | pub(in std::vec) struct F; | ^^^^^^^^ error[E0577]: expected module, found enum `E` --> $DIR/resolve-bad-visibility.rs:4:8 | -LL | pub(in E) struct S; //~ ERROR expected module, found enum `E` +LL | pub(in E) struct S; | ^ not a module error[E0577]: expected module, found trait `Tr` --> $DIR/resolve-bad-visibility.rs:5:8 | -LL | pub(in Tr) struct Z; //~ ERROR expected module, found trait `Tr` +LL | pub(in Tr) struct Z; | ^^ not a module error[E0578]: cannot find module `nonexistent` in the crate root --> $DIR/resolve-bad-visibility.rs:7:8 | -LL | pub(in nonexistent) struct G; //~ ERROR cannot find module `nonexistent` in the crate root +LL | pub(in nonexistent) struct G; | ^^^^^^^^^^^ not found in the crate root error[E0578]: cannot find module `too_soon` in the crate root --> $DIR/resolve-bad-visibility.rs:8:8 | -LL | pub(in too_soon) struct H; //~ ERROR cannot find module `too_soon` in the crate root +LL | pub(in too_soon) struct H; | ^^^^^^^^ not found in the crate root error: aborting due to 5 previous errors diff --git a/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr b/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr index 24889a0a820e..a0a858209019 100644 --- a/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr +++ b/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr @@ -1,13 +1,13 @@ error[E0254]: the name `std` is defined multiple times --> $DIR/resolve-conflict-import-vs-extern-crate.rs:1:5 | -LL | use std::slice as std; //~ ERROR the name `std` is defined multiple times +LL | use std::slice as std; | ^^^^^^^^^^^^^^^^^ `std` reimported here | = note: `std` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use std::slice as other_std; //~ ERROR the name `std` is defined multiple times +LL | use std::slice as other_std; | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr b/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr index 5e190bf31853..7b9fb6c63f67 100644 --- a/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr +++ b/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr @@ -1,7 +1,7 @@ error[E0260]: the name `std` is defined multiple times --> $DIR/resolve-conflict-item-vs-extern-crate.rs:2:1 | -LL | mod std {} //~ ERROR the name `std` is defined multiple times +LL | mod std {} | ^^^^^^^ `std` redefined here | = note: `std` must be defined only once in the type namespace of this module diff --git a/src/test/ui/resolve/resolve-inconsistent-names.stderr b/src/test/ui/resolve/resolve-inconsistent-names.stderr index 20346d5aefe7..c75718149fa4 100644 --- a/src/test/ui/resolve/resolve-inconsistent-names.stderr +++ b/src/test/ui/resolve/resolve-inconsistent-names.stderr @@ -1,7 +1,7 @@ error[E0408]: variable `a` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:4:12 | -LL | a | b => {} //~ ERROR variable `a` is not bound in all patterns +LL | a | b => {} | - ^ pattern doesn't bind `a` | | | variable not in all patterns @@ -9,7 +9,7 @@ LL | a | b => {} //~ ERROR variable `a` is not bound in all patterns error[E0408]: variable `b` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:4:8 | -LL | a | b => {} //~ ERROR variable `a` is not bound in all patterns +LL | a | b => {} | ^ - variable not in all patterns | | | pattern doesn't bind `b` diff --git a/src/test/ui/resolve/resolve-label.stderr b/src/test/ui/resolve/resolve-label.stderr index fecfd922347b..72a8e443bac9 100644 --- a/src/test/ui/resolve/resolve-label.stderr +++ b/src/test/ui/resolve/resolve-label.stderr @@ -1,7 +1,7 @@ error[E0426]: use of undeclared label `'l` --> $DIR/resolve-label.rs:5:23 | -LL | break 'l; //~ ERROR use of undeclared label +LL | break 'l; | ^^ undeclared label `'l` error: aborting due to previous error diff --git a/src/test/ui/resolve/resolve-self-in-impl-2.stderr b/src/test/ui/resolve/resolve-self-in-impl-2.stderr index 1f5887e1352e..765f150ebc74 100644 --- a/src/test/ui/resolve/resolve-self-in-impl-2.stderr +++ b/src/test/ui/resolve/resolve-self-in-impl-2.stderr @@ -1,13 +1,13 @@ error[E0411]: expected trait, found self type `Self` --> $DIR/resolve-self-in-impl-2.rs:4:6 | -LL | impl Self for S {} //~ ERROR expected trait, found self type `Self` +LL | impl Self for S {} | ^^^^ `Self` is only available in impls, traits, and type definitions error[E0405]: cannot find trait `N` in `Self` --> $DIR/resolve-self-in-impl-2.rs:5:12 | -LL | impl Self::N for S {} //~ ERROR cannot find trait `N` in `Self` +LL | impl Self::N for S {} | ^ not found in `Self` error: aborting due to 2 previous errors diff --git a/src/test/ui/resolve/resolve-self-in-impl.stderr b/src/test/ui/resolve/resolve-self-in-impl.stderr index 1940c0cd2a4b..58e851e5c12c 100644 --- a/src/test/ui/resolve/resolve-self-in-impl.stderr +++ b/src/test/ui/resolve/resolve-self-in-impl.stderr @@ -1,7 +1,7 @@ error[E0391]: cycle detected when processing `` --> $DIR/resolve-self-in-impl.rs:14:13 | -LL | impl Tr for Self {} //~ ERROR cycle detected +LL | impl Tr for Self {} | ^^^^ | = note: ...which again requires processing ``, completing the cycle @@ -20,7 +20,7 @@ LL | | fn main() {} error[E0391]: cycle detected when processing `` --> $DIR/resolve-self-in-impl.rs:15:15 | -LL | impl Tr for S {} //~ ERROR cycle detected +LL | impl Tr for S {} | ^^^^ | = note: ...which again requires processing ``, completing the cycle @@ -39,7 +39,7 @@ LL | | fn main() {} error[E0391]: cycle detected when processing `` --> $DIR/resolve-self-in-impl.rs:16:6 | -LL | impl Self {} //~ ERROR cycle detected +LL | impl Self {} | ^^^^ | = note: ...which again requires processing ``, completing the cycle @@ -58,7 +58,7 @@ LL | | fn main() {} error[E0391]: cycle detected when processing `` --> $DIR/resolve-self-in-impl.rs:17:8 | -LL | impl S {} //~ ERROR cycle detected +LL | impl S {} | ^^^^ | = note: ...which again requires processing ``, completing the cycle @@ -77,7 +77,7 @@ LL | | fn main() {} error[E0391]: cycle detected when processing `` --> $DIR/resolve-self-in-impl.rs:18:1 | -LL | impl Tr for S {} //~ ERROR cycle detected +LL | impl Tr for S {} | ^^^^^^^^^^^^^^^^^^^^^^ | = note: ...which again requires processing ``, completing the cycle diff --git a/src/test/ui/resolve/resolve-variant-assoc-item.stderr b/src/test/ui/resolve/resolve-variant-assoc-item.stderr index b93005849f43..173976d707c7 100644 --- a/src/test/ui/resolve/resolve-variant-assoc-item.stderr +++ b/src/test/ui/resolve/resolve-variant-assoc-item.stderr @@ -1,13 +1,13 @@ error[E0433]: failed to resolve: not a module `V` --> $DIR/resolve-variant-assoc-item.rs:5:8 | -LL | E::V::associated_item; //~ ERROR failed to resolve: not a module `V` +LL | E::V::associated_item; | ^ not a module `V` error[E0433]: failed to resolve: not a module `V` --> $DIR/resolve-variant-assoc-item.rs:6:5 | -LL | V::associated_item; //~ ERROR failed to resolve: not a module `V` +LL | V::associated_item; | ^ not a module `V` error: aborting due to 2 previous errors diff --git a/src/test/ui/resolve/token-error-correct-2.stderr b/src/test/ui/resolve/token-error-correct-2.stderr index 481ed8828897..d568117d6762 100644 --- a/src/test/ui/resolve/token-error-correct-2.stderr +++ b/src/test/ui/resolve/token-error-correct-2.stderr @@ -3,8 +3,8 @@ error: incorrect close delimiter: `)` | LL | if foo { | - un-closed delimiter -LL | //~^ ERROR: cannot find value `foo` -LL | ) //~ ERROR: incorrect close delimiter: `)` +LL | +LL | ) | ^ incorrect close delimiter error[E0425]: cannot find value `foo` in this scope diff --git a/src/test/ui/resolve/token-error-correct-3.stderr b/src/test/ui/resolve/token-error-correct-3.stderr index 035a5ede4538..52a3117ff3ac 100644 --- a/src/test/ui/resolve/token-error-correct-3.stderr +++ b/src/test/ui/resolve/token-error-correct-3.stderr @@ -12,7 +12,7 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)` | LL | fs::create_dir_all(path.as_ref()).map(|()| true) | - expected one of `.`, `;`, `?`, `}`, or an operator here -LL | //~^ ERROR mismatched types +LL | LL | } else { | ^ unexpected token diff --git a/src/test/ui/resolve/token-error-correct.stderr b/src/test/ui/resolve/token-error-correct.stderr index b0827ea7367c..9452e2d68dec 100644 --- a/src/test/ui/resolve/token-error-correct.stderr +++ b/src/test/ui/resolve/token-error-correct.stderr @@ -5,7 +5,7 @@ LL | fn main() { | - close delimiter possibly meant for this LL | foo(bar(; | - un-closed delimiter -LL | //~^ ERROR cannot find function `bar` in this scope +LL | LL | } | ^ incorrect close delimiter diff --git a/src/test/ui/resolve/tuple-struct-alias.stderr b/src/test/ui/resolve/tuple-struct-alias.stderr index f299aa40a31e..fc701b1644d1 100644 --- a/src/test/ui/resolve/tuple-struct-alias.stderr +++ b/src/test/ui/resolve/tuple-struct-alias.stderr @@ -1,7 +1,7 @@ error[E0423]: expected function, found type alias `A` --> $DIR/tuple-struct-alias.rs:5:13 | -LL | let s = A(0, 1); //~ ERROR expected function +LL | let s = A(0, 1); | ^ help: a tuple struct with a similar name exists: `S` | = note: can't use a type alias as a constructor @@ -9,7 +9,7 @@ LL | let s = A(0, 1); //~ ERROR expected function error[E0532]: expected tuple struct/variant, found type alias `A` --> $DIR/tuple-struct-alias.rs:7:9 | -LL | A(..) => {} //~ ERROR expected tuple struct/variant +LL | A(..) => {} | ^ help: a tuple struct with a similar name exists: `S` | = note: can't use a type alias as a constructor diff --git a/src/test/ui/resolve/use_suggestion_placement.stderr b/src/test/ui/resolve/use_suggestion_placement.stderr index dcbb8dfe665c..8d2fdd530f10 100644 --- a/src/test/ui/resolve/use_suggestion_placement.stderr +++ b/src/test/ui/resolve/use_suggestion_placement.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `Path` in this scope --> $DIR/use_suggestion_placement.rs:17:16 | -LL | type Bar = Path; //~ ERROR cannot find +LL | type Bar = Path; | ^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -11,7 +11,7 @@ LL | use std::path::Path; error[E0425]: cannot find value `A` in this scope --> $DIR/use_suggestion_placement.rs:22:13 | -LL | let _ = A; //~ ERROR cannot find +LL | let _ = A; | ^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -21,7 +21,7 @@ LL | use m::A; error[E0412]: cannot find type `HashMap` in this scope --> $DIR/use_suggestion_placement.rs:27:23 | -LL | type Dict = HashMap; //~ ERROR cannot find +LL | type Dict = HashMap; | ^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/retslot-cast.stderr b/src/test/ui/retslot-cast.stderr index 855aa501082b..3c58285bdb35 100644 --- a/src/test/ui/retslot-cast.stderr +++ b/src/test/ui/retslot-cast.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/retslot-cast.rs:13:5 | -LL | inner(x) //~ ERROR mismatched types +LL | inner(x) | ^^^^^^^^ expected trait `std::iter::Iterator`, found trait `std::iter::Iterator + std::marker::Send` | = note: expected type `std::option::Option<&dyn std::iter::Iterator>` diff --git a/src/test/ui/return/return-from-diverging.stderr b/src/test/ui/return/return-from-diverging.stderr index 2862ae641df1..3dd029c14c0f 100644 --- a/src/test/ui/return/return-from-diverging.stderr +++ b/src/test/ui/return/return-from-diverging.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn fail() -> ! { | - expected `!` because of return type -LL | return "wow"; //~ ERROR mismatched types +LL | return "wow"; | ^^^^^ expected !, found reference | = note: expected type `!` diff --git a/src/test/ui/return/return-match-array-const.stderr b/src/test/ui/return/return-match-array-const.stderr index 763b3d987d7c..6e8c9ed40bbe 100644 --- a/src/test/ui/return/return-match-array-const.stderr +++ b/src/test/ui/return/return-match-array-const.stderr @@ -1,19 +1,19 @@ error[E0572]: return statement outside of function body --> $DIR/return-match-array-const.rs:2:10 | -LL | [(); return match 0 { n => n }]; //~ ERROR: return statement outside of function body +LL | [(); return match 0 { n => n }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0572]: return statement outside of function body --> $DIR/return-match-array-const.rs:4:10 | -LL | [(); return match 0 { 0 => 0 }]; //~ ERROR: return statement outside of function body +LL | [(); return match 0 { 0 => 0 }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0572]: return statement outside of function body --> $DIR/return-match-array-const.rs:6:10 | -LL | [(); return match () { 'a' => 0, _ => 0 }]; //~ ERROR: return statement outside of function body +LL | [(); return match () { 'a' => 0, _ => 0 }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/return/return-unit-from-diverging.stderr b/src/test/ui/return/return-unit-from-diverging.stderr index 19eccac34338..befc57563a9c 100644 --- a/src/test/ui/return/return-unit-from-diverging.stderr +++ b/src/test/ui/return/return-unit-from-diverging.stderr @@ -3,7 +3,7 @@ error[E0069]: `return;` in a function whose return type is not `()` | LL | fn fail() -> ! { | - expected `!` because of this return type -LL | return; //~ ERROR in a function whose return type is not +LL | return; | ^^^^^^ return type is not `()` error: aborting due to previous error diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.stderr index 23a56bf8fec1..7f6749fc9ccb 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.stderr @@ -2,7 +2,7 @@ error: functions using `#[should_panic]` must return `()` --> $DIR/termination-trait-in-test-should-panic.rs:11:1 | LL | / fn not_a_num() -> Result<(), ParseIntError> { -LL | | //~^ ERROR functions using `#[should_panic]` must return `()` +LL | | LL | | let _: u32 = "abc".parse()?; LL | | Ok(()) LL | | } diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.stderr index c1be04ca881e..31b90340d79f 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.stderr @@ -1,7 +1,7 @@ error[E0277]: `main` has invalid return type `char` --> $DIR/termination-trait-main-wrong-type.rs:1:14 | -LL | fn main() -> char { //~ ERROR +LL | fn main() -> char { | ^^^^ `main` can only return types that implement `std::process::Termination` | = help: consider using `()`, or a `Result` diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr index 2f05f9b0f7a1..72a58a04170f 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr @@ -1,7 +1,7 @@ error[E0277]: `main` has invalid return type `ReturnType` --> $DIR/termination-trait-not-satisfied.rs:3:14 | -LL | fn main() -> ReturnType { //~ ERROR `main` has invalid return type `ReturnType` +LL | fn main() -> ReturnType { | ^^^^^^^^^^ `main` can only return types that implement `std::process::Termination` | = help: consider using `()`, or a `Result` 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 a99f852d99bc..18115541af95 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,7 +1,7 @@ error[E0277]: `main` has invalid return type `std::result::Result` --> $DIR/termination-trait-test-wrong-type.rs:6:1 | -LL | / fn can_parse_zero_as_f32() -> Result { //~ ERROR +LL | / fn can_parse_zero_as_f32() -> Result { LL | | "0".parse() LL | | } | |_^ `main` can only return types that implement `std::process::Termination` diff --git a/src/test/ui/rfc-2005-default-binding-mode/const.stderr b/src/test/ui/rfc-2005-default-binding-mode/const.stderr index 7ce8a3256327..210b4f6be63d 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/const.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/const.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/const.rs:14:9 | -LL | FOO => {}, //~ ERROR mismatched types +LL | FOO => {}, | ^^^ expected &Foo, found struct `Foo` | = note: expected type `&Foo` diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.stderr b/src/test/ui/rfc-2005-default-binding-mode/enum.stderr index d29b0111d8bb..5106618af64d 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/enum.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/enum.stderr @@ -1,19 +1,19 @@ error[E0594]: cannot assign to immutable borrowed content `*x` --> $DIR/enum.rs:9:5 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*x` --> $DIR/enum.rs:13:9 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*x` --> $DIR/enum.rs:19:9 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ cannot borrow as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr index e03f67760d7e..b6424f842648 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr @@ -1,19 +1,19 @@ error[E0594]: cannot assign to immutable borrowed content `*n` --> $DIR/explicit-mut.rs:7:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*n` --> $DIR/explicit-mut.rs:15:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*n` --> $DIR/explicit-mut.rs:23:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ cannot borrow as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2005-default-binding-mode/lit.stderr b/src/test/ui/rfc-2005-default-binding-mode/lit.stderr index b78b4432bbe3..9be1876b7145 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/lit.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/lit.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/lit.rs:7:13 | -LL | "abc" => true, //~ ERROR mismatched types +LL | "abc" => true, | ^^^^^ expected &str, found str | = note: expected type `&&str` @@ -10,7 +10,7 @@ LL | "abc" => true, //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/lit.rs:16:9 | -LL | b"abc" => true, //~ ERROR mismatched types +LL | b"abc" => true, | ^^^^^^ expected &[u8], found array of 3 elements | = note: expected type `&&[u8]` diff --git a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr index 9d35e167075a..1bf9b09fcc5e 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr @@ -1,7 +1,7 @@ error[E0599]: no associated item named `XXX` found for type `u32` in the current scope --> $DIR/no-double-error.rs:8:14 | -LL | u32::XXX => { } //~ ERROR no associated item named +LL | u32::XXX => { } | -----^^^ | | | associated item not found in `u32` diff --git a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr index e24c8f155590..f1e91a05f082 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `&[]` not covered --> $DIR/slice.rs:6:11 | -LL | match sl { //~ ERROR non-exhaustive patterns +LL | match sl { | ^^ pattern `&[]` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr index 1d055fe8d4cb..ff082e6fc429 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr @@ -9,7 +9,7 @@ error[E0701]: attribute can only be applied to a struct or enum | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ -LL | //~^ ERROR attribute can only be applied to a struct or enum [E0701] +LL | LL | trait Bar { } | ------------- not a struct or enum @@ -18,7 +18,7 @@ error[E0701]: attribute can only be applied to a struct or enum | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ -LL | //~^ ERROR attribute can only be applied to a struct or enum [E0701] +LL | LL | / union Baz { LL | | f1: u16, LL | | f2: u16 diff --git a/src/test/ui/rfc-2008-non-exhaustive/structs.stderr b/src/test/ui/rfc-2008-non-exhaustive/structs.stderr index 4532b5c34cc0..6213c392a9b4 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/structs.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/structs.stderr @@ -27,7 +27,7 @@ error[E0639]: cannot create non-exhaustive struct using struct expression | LL | let fr = FunctionalRecord { | ______________^ -LL | | //~^ ERROR cannot create non-exhaustive struct +LL | | LL | | first_field: 1920, LL | | second_field: 1080, LL | | ..FunctionalRecord::default() diff --git a/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr b/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr index 850e7caec548..3368e35d304f 100644 --- a/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/cross-crate.rs:4:1 | -LL | / struct Foo<'a, T> { //~ ERROR rustc_outlives +LL | / struct Foo<'a, T> { LL | | bar: std::slice::IterMut<'a, T> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr b/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr index e4f4b58fb33a..26cbeeaf5acd 100644 --- a/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr @@ -3,13 +3,13 @@ error[E0310]: the parameter type `U` may not live long enough | LL | struct Foo { | - help: consider adding an explicit lifetime bound `U: 'static`... -LL | bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] +LL | bar: Bar | ^^^^^^^^^^^ | note: ...so that the type `U` will meet its required lifetime bounds --> $DIR/dont-infer-static.rs:10:5 | -LL | bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] +LL | bar: Bar | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/rfc-2093-infer-outlives/enum.stderr b/src/test/ui/rfc-2093-infer-outlives/enum.stderr index c8e730090fc3..e81d10a66dff 100644 --- a/src/test/ui/rfc-2093-infer-outlives/enum.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/enum.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/enum.rs:9:1 | -LL | / enum Foo<'a, T> { //~ ERROR rustc_outlives +LL | / enum Foo<'a, T> { LL | | One(Bar<'a, T>) LL | | } | |_^ @@ -11,7 +11,7 @@ LL | | } error: rustc_outlives --> $DIR/enum.rs:15:1 | -LL | / struct Bar<'b, U> { //~ ERROR rustc_outlives +LL | / struct Bar<'b, U> { LL | | field2: &'b U LL | | } | |_^ @@ -21,7 +21,7 @@ LL | | } error: rustc_outlives --> $DIR/enum.rs:21:1 | -LL | / enum Ying<'c, K> { //~ ERROR rustc_outlives +LL | / enum Ying<'c, K> { LL | | One(&'c Yang) LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr index a5bee93a1509..c87ef6c391b1 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/explicit-dyn.rs:8:1 | -LL | / struct Foo<'a, A> //~ ERROR rustc_outlives +LL | / struct Foo<'a, A> LL | | { LL | | foo: Box> LL | | } diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr index 2149e0533c61..611df047cffc 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/explicit-enum.rs:4:1 | -LL | / enum Foo<'a, U> { //~ ERROR rustc_outlives +LL | / enum Foo<'a, U> { LL | | One(Bar<'a, U>) LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr index 46793b1690a8..8e9b158ab7c9 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/explicit-projection.rs:8:1 | -LL | / struct Foo<'a, A, B> where A: Trait<'a, B> //~ ERROR rustc_outlives +LL | / struct Foo<'a, A, B> where A: Trait<'a, B> LL | | { LL | | foo: >::Type LL | | } diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr index b694b7a95436..cbff2b777fe7 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/explicit-struct.rs:4:1 | -LL | / struct Foo<'b, U> { //~ ERROR rustc_outlives +LL | / struct Foo<'b, U> { LL | | bar: Bar<'b, U> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr index d70fad9d8304..adf62651cacb 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/explicit-union.rs:6:1 | -LL | / union Foo<'b, U> { //~ ERROR rustc_outlives +LL | / union Foo<'b, U> { LL | | bar: Bar<'b, U> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/infer-static.stderr b/src/test/ui/rfc-2093-infer-outlives/infer-static.stderr index b3a827f38c55..106db765f7ea 100644 --- a/src/test/ui/rfc-2093-infer-outlives/infer-static.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/infer-static.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/infer-static.rs:5:1 | -LL | / struct Foo { //~ ERROR rustc_outlives +LL | / struct Foo { LL | | bar: Bar LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr index 76d18bbee9d6..6b143ba7eb96 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/nested-enum.rs:4:1 | -LL | / enum Foo<'a, T> { //~ ERROR rustc_outlives +LL | / enum Foo<'a, T> { LL | | LL | | One(Bar<'a, T>) LL | | } diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr index 2900a29ed7c0..4d8f7b7c8c46 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/nested-regions.rs:4:1 | -LL | / struct Foo<'a, 'b, T> { //~ ERROR rustc_outlives +LL | / struct Foo<'a, 'b, T> { LL | | x: &'a &'b T LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr index e8b822df9503..17d7c014e102 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/nested-structs.rs:4:1 | -LL | / struct Foo<'a, T> { //~ ERROR rustc_outlives +LL | / struct Foo<'a, T> { LL | | field1: Bar<'a, T> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr index 56a2f873c768..fc4b1a223294 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/nested-union.rs:6:1 | -LL | / union Foo<'a, T> { //~ ERROR rustc_outlives +LL | / union Foo<'a, T> { LL | | field1: Bar<'a, T> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/projection.stderr b/src/test/ui/rfc-2093-infer-outlives/projection.stderr index 73d2420af00d..8a91c44c5806 100644 --- a/src/test/ui/rfc-2093-infer-outlives/projection.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/projection.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/projection.rs:4:1 | -LL | / struct Foo<'a, T: Iterator> { //~ ERROR rustc_outlives +LL | / struct Foo<'a, T: Iterator> { LL | | bar: &'a T::Item LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/reference.stderr b/src/test/ui/rfc-2093-infer-outlives/reference.stderr index 41a8de2d84bc..adb1c4a62904 100644 --- a/src/test/ui/rfc-2093-infer-outlives/reference.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/reference.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/reference.rs:4:1 | -LL | / struct Foo<'a, T> { //~ ERROR rustc_outlives +LL | / struct Foo<'a, T> { LL | | bar: &'a T, LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.stderr index d10f7ed28fc2..870140856675 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | enum Ref1<'a, T> { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | Ref1Variant1(RequireOutlives<'a, T>) //~ ERROR the parameter type `T` may not live long enough +LL | Ref1Variant1(RequireOutlives<'a, T>) | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-enum-not-wf.rs:18:18 | -LL | Ref1Variant1(RequireOutlives<'a, T>) //~ ERROR the parameter type `T` may not live long enough +LL | Ref1Variant1(RequireOutlives<'a, T>) | ^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -18,40 +18,40 @@ error[E0309]: the parameter type `T` may not live long enough LL | enum Ref2<'a, T> { | - help: consider adding an explicit lifetime bound `T: 'a`... LL | Ref2Variant1, -LL | Ref2Variant2(isize, RequireOutlives<'a, T>), //~ ERROR the parameter type `T` may not live long enough +LL | Ref2Variant2(isize, RequireOutlives<'a, T>), | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-enum-not-wf.rs:23:25 | -LL | Ref2Variant2(isize, RequireOutlives<'a, T>), //~ ERROR the parameter type `T` may not live long enough +LL | Ref2Variant2(isize, RequireOutlives<'a, T>), | ^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-enum-not-wf.rs:35:1 | -LL | enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] +LL | enum RefDouble<'a, 'b, T> { | ^ - help: consider adding an explicit lifetime bound `T: 'b`... | _| | | LL | | RefDoubleVariant1(&'a RequireOutlives<'b, T>) -LL | | //~^ the parameter type `T` may not live long enough [E0309] +LL | | LL | | } | |_^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-enum-not-wf.rs:35:1 | -LL | / enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] +LL | / enum RefDouble<'a, 'b, T> { LL | | RefDoubleVariant1(&'a RequireOutlives<'b, T>) -LL | | //~^ the parameter type `T` may not live long enough [E0309] +LL | | LL | | } | |_^ error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-enum-not-wf.rs:36:23 | -LL | enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] +LL | enum RefDouble<'a, 'b, T> { | - help: consider adding an explicit lifetime bound `T: 'b`... LL | RefDoubleVariant1(&'a RequireOutlives<'b, T>) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr index 4b7732251b0d..be8b5c6446ca 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr @@ -1,7 +1,7 @@ error[E0491]: in type `&'a rev_variant_struct_region::Foo<'b>`, reference has a longer lifetime than the data it references --> $DIR/regions-outlives-nominal-type-region-rev.rs:17:9 | -LL | type Out = &'a Foo<'b>; //~ ERROR reference has a longer lifetime +LL | type Out = &'a Foo<'b>; | ^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime 'a as defined on the impl at 16:10 diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr index 9cabc973d1a9..9a3ba2d65cad 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr @@ -1,7 +1,7 @@ error[E0491]: in type `&'a variant_struct_region::Foo<'b>`, reference has a longer lifetime than the data it references --> $DIR/regions-outlives-nominal-type-region.rs:17:9 | -LL | type Out = &'a Foo<'b>; //~ ERROR reference has a longer lifetime +LL | type Out = &'a Foo<'b>; | ^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime 'a as defined on the impl at 16:10 diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr index 6142228664a4..5389beea3a70 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr @@ -1,7 +1,7 @@ error[E0491]: in type `&'a variant_struct_type::Foo<&'b i32>`, reference has a longer lifetime than the data it references --> $DIR/regions-outlives-nominal-type-type-rev.rs:17:9 | -LL | type Out = &'a Foo<&'b i32>; //~ ERROR reference has a longer lifetime +LL | type Out = &'a Foo<&'b i32>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime 'a as defined on the impl at 16:10 diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr index 0831f3acef28..2f3ef48a0544 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr @@ -1,7 +1,7 @@ error[E0491]: in type `&'a variant_struct_type::Foo<&'b i32>`, reference has a longer lifetime than the data it references --> $DIR/regions-outlives-nominal-type-type.rs:17:9 | -LL | type Out = &'a Foo<&'b i32>; //~ ERROR reference has a longer lifetime +LL | type Out = &'a Foo<&'b i32>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime 'a as defined on the impl at 16:10 diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr index 2485c7c3659a..8130f5de5587 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for usize { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a T; //~ ERROR `T` may not live long enough +LL | type Out = &'a T; | ^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a T` does not outlive the data it points at --> $DIR/regions-struct-not-wf.rs:13:5 | -LL | type Out = &'a T; //~ ERROR `T` may not live long enough +LL | type Out = &'a T; | ^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -17,19 +17,19 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for u32 { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = RefOk<'a, T>; //~ ERROR `T` may not live long enough +LL | type Out = RefOk<'a, T>; | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-struct-not-wf.rs:21:5 | -LL | type Out = RefOk<'a, T>; //~ ERROR `T` may not live long enough +LL | type Out = RefOk<'a, T>; | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references --> $DIR/regions-struct-not-wf.rs:25:5 | -LL | type Out = &'a &'b T; //~ ERROR reference has a longer lifetime than the data +LL | type Out = &'a &'b T; | ^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime 'a as defined on the impl at 24:6 diff --git a/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr b/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr index 62b546adfc14..0be14a6956f4 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/self-dyn.rs:9:1 | -LL | / struct Foo<'a, 'b, A> //~ ERROR rustc_outlives +LL | / struct Foo<'a, 'b, A> LL | | { LL | | foo: Box> LL | | } diff --git a/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr index 15ff6009e5c6..9ae05dab74d5 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/self-structs.rs:4:1 | -LL | / struct Foo<'a, 'b, T> { //~ ERROR rustc_outlives +LL | / struct Foo<'a, 'b, T> { LL | | field1: Bar<'a, 'b, T> LL | | } | |_^ diff --git a/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr b/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr index 23485f7a5599..e4c47901455c 100644 --- a/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr +++ b/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr @@ -1,13 +1,13 @@ error[E0433]: failed to resolve: `crate` in paths can only be used in start position --> $DIR/crate-path-non-absolute.rs:7:22 | -LL | let s = ::m::crate::S; //~ ERROR failed to resolve +LL | let s = ::m::crate::S; | ^^^^^ `crate` in paths can only be used in start position error[E0433]: failed to resolve: global paths cannot start with `crate` --> $DIR/crate-path-non-absolute.rs:8:20 | -LL | let s1 = ::crate::S; //~ ERROR failed to resolve +LL | let s1 = ::crate::S; | ^^^^^ global paths cannot start with `crate` error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr index e9de20edb505..eb4b9dea41bd 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr @@ -1,7 +1,7 @@ error[E0463]: can't find crate for `meta` --> $DIR/meta.rs:5:5 | -LL | use meta; //~ ERROR can't find crate for `meta` +LL | use meta; | ^^^^ can't find crate error: aborting due to previous error diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr index 23aeb92f4871..64b920e9aa7e 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `xcrate` --> $DIR/non-existent-1.rs:3:5 | -LL | use xcrate::S; //~ ERROR unresolved import `xcrate` +LL | use xcrate::S; | ^^^^^^ use of undeclared type or module `xcrate` error: aborting due to previous error diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr index b4982d5083c6..bfce180789cb 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `ycrate` --> $DIR/non-existent-3.rs:3:5 | -LL | use ycrate; //~ ERROR unresolved import `ycrate` +LL | use ycrate; | ^^^^^^ no `ycrate` external crate error: aborting due to previous error diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr index 3bea7816b306..4e3fff98e6f4 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr @@ -1,13 +1,13 @@ error: cannot import a built-in macro --> $DIR/not-whitelisted.rs:6:5 | -LL | use test; //~ ERROR cannot import a built-in macro +LL | use test; | ^^^^ error[E0432]: unresolved import `alloc` --> $DIR/not-whitelisted.rs:5:5 | -LL | use alloc; //~ ERROR unresolved import `alloc` +LL | use alloc; | ^^^^^ no `alloc` external crate error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr index d32835a49f88..396a798c8204 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr @@ -1,19 +1,19 @@ error: crate root imports need to be explicitly named: `use crate as name;` --> $DIR/single-segment.rs:5:5 | -LL | use crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` +LL | use crate; | ^^^^^ error: cannot glob-import all possible crates --> $DIR/single-segment.rs:6:5 | -LL | use *; //~ ERROR cannot glob-import all possible crates +LL | use *; | ^ error[E0423]: expected value, found module `xcrate` --> $DIR/single-segment.rs:9:13 | -LL | let s = ::xcrate; //~ ERROR expected value, found module `xcrate` +LL | let s = ::xcrate; | ^^^^^^^^ not a value error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2166-underscore-imports/basic.stderr b/src/test/ui/rfc-2166-underscore-imports/basic.stderr index 308035919260..9ca60e8e0a95 100644 --- a/src/test/ui/rfc-2166-underscore-imports/basic.stderr +++ b/src/test/ui/rfc-2166-underscore-imports/basic.stderr @@ -1,7 +1,7 @@ warning: unused import: `m::Tr1 as _` --> $DIR/basic.rs:26:9 | -LL | use m::Tr1 as _; //~ WARN unused import +LL | use m::Tr1 as _; | ^^^^^^^^^^^ | note: lint level defined here @@ -13,6 +13,6 @@ LL | #![warn(unused_imports, unused_extern_crates)] warning: unused import: `S as _` --> $DIR/basic.rs:27:9 | -LL | use S as _; //~ WARN unused import +LL | use S as _; | ^^^^^^ diff --git a/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr b/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr index 4163c2876074..861b3f1d4fd1 100644 --- a/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr +++ b/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr @@ -1,7 +1,7 @@ error: unused import: `core::any` --> $DIR/unused-2018.rs:6:9 | -LL | use core::any; //~ ERROR unused import: `core::any` +LL | use core::any; | ^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_imports)] error: unused import: `core` --> $DIR/unused-2018.rs:10:9 | -LL | use core; //~ ERROR unused import: `core` +LL | use core; | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr index 5f3a6b414e04..cfc318c1cd0f 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `a` | LL | let _ = dbg!(a); | ------- value moved here -LL | let _ = dbg!(a); //~ ERROR use of moved value +LL | let _ = dbg!(a); | ^ value used here after move | = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait @@ -14,7 +14,7 @@ error[E0382]: use of moved value: `a` | LL | let _ = dbg!(a); | ------- value moved here -LL | let _ = dbg!(a); //~ ERROR use of moved value +LL | let _ = dbg!(a); | ^^^^^^^ value used here after move | = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr index bd41f7b34053..ecab673953d6 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr @@ -1,7 +1,7 @@ error[E0277]: `NotDebug` doesn't implement `std::fmt::Debug` --> $DIR/dbg-macro-requires-debug.rs:6:23 | -LL | let _: NotDebug = dbg!(NotDebug); //~ ERROR `NotDebug` doesn't implement `std::fmt::Debug` +LL | let _: NotDebug = dbg!(NotDebug); | ^^^^^^^^^^^^^^ `NotDebug` cannot be formatted using `{:?}` | = help: the trait `std::fmt::Debug` is not implemented for `NotDebug` diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr index 5aa34bca1301..b323104048f6 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr @@ -1,6 +1,6 @@ warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash --> $DIR/generic-associated-types-where.rs:1:12 | -LL | #![feature(generic_associated_types)] //~ WARN `generic_associated_types` is incomplete +LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rmeta.stderr b/src/test/ui/rmeta.stderr index d36b3a746e6a..d15caeb66981 100644 --- a/src/test/ui/rmeta.stderr +++ b/src/test/ui/rmeta.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `Foo` in this scope --> $DIR/rmeta.rs:7:13 | -LL | let _ = Foo; //~ ERROR cannot find value `Foo` in this scope +LL | let _ = Foo; | ^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/rmeta_meta_main.stderr b/src/test/ui/rmeta_meta_main.stderr index bed9076d84cb..347e5e97d7a0 100644 --- a/src/test/ui/rmeta_meta_main.stderr +++ b/src/test/ui/rmeta_meta_main.stderr @@ -1,7 +1,7 @@ error[E0560]: struct `rmeta_meta::Foo` has no field named `field2` --> $DIR/rmeta_meta_main.rs:13:19 | -LL | let _ = Foo { field2: 42 }; //~ ERROR struct `rmeta_meta::Foo` has no field named `field2` +LL | let _ = Foo { field2: 42 }; | ^^^^^^ help: a field with a similar name exists: `field` error: aborting due to previous error diff --git a/src/test/ui/rust-2018/async-ident-allowed.stderr b/src/test/ui/rust-2018/async-ident-allowed.stderr index 61e1facd30e5..d3e450e9be0b 100644 --- a/src/test/ui/rust-2018/async-ident-allowed.stderr +++ b/src/test/ui/rust-2018/async-ident-allowed.stderr @@ -1,7 +1,7 @@ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident-allowed.rs:9:9 | -LL | let async = 3; //~ ERROR: is a keyword +LL | let async = 3; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | note: lint level defined here diff --git a/src/test/ui/rust-2018/async-ident.stderr b/src/test/ui/rust-2018/async-ident.stderr index b33c043c9ea2..b14953377563 100644 --- a/src/test/ui/rust-2018/async-ident.stderr +++ b/src/test/ui/rust-2018/async-ident.stderr @@ -1,7 +1,7 @@ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:7:4 | -LL | fn async() {} //~ ERROR async +LL | fn async() {} | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | note: lint level defined here diff --git a/src/test/ui/rust-2018/dyn-keyword.stderr b/src/test/ui/rust-2018/dyn-keyword.stderr index 5a3e00ab1d96..fa79df49fb66 100644 --- a/src/test/ui/rust-2018/dyn-keyword.stderr +++ b/src/test/ui/rust-2018/dyn-keyword.stderr @@ -1,7 +1,7 @@ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-keyword.rs:8:9 | -LL | let dyn = (); //~ ERROR dyn +LL | let dyn = (); | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | note: lint level defined here diff --git a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr index 6be005204658..e1f099e91907 100644 --- a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr +++ b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr @@ -1,17 +1,17 @@ error: expected identifier, found keyword `dyn` --> $DIR/dyn-trait-compatibility.rs:4:16 | -LL | type A1 = dyn::dyn; //~ERROR expected identifier, found keyword `dyn` +LL | type A1 = dyn::dyn; | ^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | type A1 = dyn::r#dyn; //~ERROR expected identifier, found keyword `dyn` +LL | type A1 = dyn::r#dyn; | ^^^^^ error: expected identifier, found `<` --> $DIR/dyn-trait-compatibility.rs:5:14 | -LL | type A2 = dyn; //~ERROR expected identifier, found `<` +LL | type A2 = dyn; | ^ expected identifier error: aborting due to 2 previous errors diff --git a/src/test/ui/rust-2018/future-proofing-locals.stderr b/src/test/ui/rust-2018/future-proofing-locals.stderr index 413e199cd646..4d666d22afed 100644 --- a/src/test/ui/rust-2018/future-proofing-locals.stderr +++ b/src/test/ui/rust-2018/future-proofing-locals.stderr @@ -1,55 +1,55 @@ error: imports cannot refer to type parameters --> $DIR/future-proofing-locals.rs:13:9 | -LL | use T as _; //~ ERROR imports cannot refer to type parameters +LL | use T as _; | ^ error: imports cannot refer to type parameters --> $DIR/future-proofing-locals.rs:14:9 | -LL | use T::U; //~ ERROR imports cannot refer to type parameters +LL | use T::U; | ^ error: imports cannot refer to type parameters --> $DIR/future-proofing-locals.rs:15:9 | -LL | use T::*; //~ ERROR imports cannot refer to type parameters +LL | use T::*; | ^ error: imports cannot refer to type parameters --> $DIR/future-proofing-locals.rs:19:9 | -LL | use T; //~ ERROR imports cannot refer to type parameters +LL | use T; | ^ error: imports cannot refer to local variables --> $DIR/future-proofing-locals.rs:25:9 | -LL | use x as _; //~ ERROR imports cannot refer to local variables +LL | use x as _; | ^ error: imports cannot refer to local variables --> $DIR/future-proofing-locals.rs:31:9 | -LL | use x; //~ ERROR imports cannot refer to local variables +LL | use x; | ^ error: imports cannot refer to local variables --> $DIR/future-proofing-locals.rs:37:17 | -LL | use x; //~ ERROR imports cannot refer to local variables +LL | use x; | ^ error: imports cannot refer to type parameters --> $DIR/future-proofing-locals.rs:45:10 | -LL | use {T as _, x}; //~ ERROR imports cannot refer to type parameters +LL | use {T as _, x}; | ^ error: imports cannot refer to local variables --> $DIR/future-proofing-locals.rs:45:18 | -LL | use {T as _, x}; //~ ERROR imports cannot refer to type parameters +LL | use {T as _, x}; | ^ error: aborting due to 9 previous errors diff --git a/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr b/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr index 7f3f6ccf39e0..49aaff620d66 100644 --- a/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr +++ b/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr @@ -1,7 +1,7 @@ error: unused extern crate --> $DIR/issue-54400-unused-extern-crate-attr-span.rs:12:1 | -LL | / #[cfg(blandiloquence)] //~ HELP remove it +LL | / #[cfg(blandiloquence)] LL | | extern crate edition_lint_paths; | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | |________________________________| diff --git a/src/test/ui/rust-2018/local-path-suggestions-2015.stderr b/src/test/ui/rust-2018/local-path-suggestions-2015.stderr index fafb35ec50d6..666864a18af8 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2015.stderr +++ b/src/test/ui/rust-2018/local-path-suggestions-2015.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `foobar` --> $DIR/local-path-suggestions-2015.rs:24:5 | -LL | use foobar::Baz; //~ ERROR unresolved import `foobar` +LL | use foobar::Baz; | ^^^^^^ | | | unresolved import diff --git a/src/test/ui/rust-2018/local-path-suggestions-2018.stderr b/src/test/ui/rust-2018/local-path-suggestions-2018.stderr index 759977b3f062..40f3d6bf1cf1 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2018.stderr +++ b/src/test/ui/rust-2018/local-path-suggestions-2018.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `foo` --> $DIR/local-path-suggestions-2018.rs:10:9 | -LL | use foo::Bar; //~ ERROR unresolved import `foo` +LL | use foo::Bar; | ^^^ help: a similar path exists: `crate::foo` | = note: `use` statements changed in Rust 2018; read more at @@ -9,7 +9,7 @@ LL | use foo::Bar; //~ ERROR unresolved import `foo` error[E0432]: unresolved import `foobar` --> $DIR/local-path-suggestions-2018.rs:19:5 | -LL | use foobar::Baz; //~ ERROR unresolved import `foobar` +LL | use foobar::Baz; | ^^^^^^ help: a similar path exists: `baz::foobar` error: aborting due to 2 previous errors diff --git a/src/test/ui/rust-2018/macro-use-warned-against.stderr b/src/test/ui/rust-2018/macro-use-warned-against.stderr index 55213a77a2c0..c3e459606e10 100644 --- a/src/test/ui/rust-2018/macro-use-warned-against.stderr +++ b/src/test/ui/rust-2018/macro-use-warned-against.stderr @@ -1,7 +1,7 @@ warning: deprecated `#[macro_use]` directive used to import macros should be replaced at use sites with a `use` statement to import the macro instead --> $DIR/macro-use-warned-against.rs:7:1 | -LL | #[macro_use] //~ WARN should be replaced at use sites with a `use` statement +LL | #[macro_use] | ^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![warn(macro_use_extern_crate, unused)] warning: unused `#[macro_use]` import --> $DIR/macro-use-warned-against.rs:9:1 | -LL | #[macro_use] //~ WARN unused `#[macro_use]` +LL | #[macro_use] | ^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr b/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr index 53ea9e645726..19e87b664cc9 100644 --- a/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr +++ b/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr @@ -1,7 +1,7 @@ warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/suggestions-not-always-applicable.rs:17:5 | -LL | #[foo] //~ WARN: absolute paths must start with +LL | #[foo] | ^^^^^^ | note: lint level defined here @@ -16,7 +16,7 @@ LL | #![warn(rust_2018_compatibility)] warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/suggestions-not-always-applicable.rs:17:5 | -LL | #[foo] //~ WARN: absolute paths must start with +LL | #[foo] | ^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! diff --git a/src/test/ui/rust-2018/trait-import-suggestions.stderr b/src/test/ui/rust-2018/trait-import-suggestions.stderr index e4c17680c90a..e2ffeaee4b42 100644 --- a/src/test/ui/rust-2018/trait-import-suggestions.stderr +++ b/src/test/ui/rust-2018/trait-import-suggestions.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `foobar` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:22:11 | -LL | x.foobar(); //~ ERROR no method named `foobar` +LL | x.foobar(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope @@ -11,7 +11,7 @@ LL | x.foobar(); //~ ERROR no method named `foobar` error[E0599]: no method named `bar` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:28:7 | -LL | x.bar(); //~ ERROR no method named `bar` +LL | x.bar(); | ^^^ | = help: items from traits can only be used if the trait is in scope @@ -23,13 +23,13 @@ LL | use crate::foo::Bar; error[E0599]: no method named `baz` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:29:7 | -LL | x.baz(); //~ ERROR no method named `baz` +LL | x.baz(); | ^^^ error[E0599]: no function or associated item named `from_str` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:30:18 | -LL | let y = u32::from_str("33"); //~ ERROR no function or associated item named `from_str` +LL | let y = u32::from_str("33"); | -----^^^^^^^^ | | | function or associated item not found in `u32` diff --git a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr index 4a01ba5088f6..db176876382d 100644 --- a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr +++ b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr @@ -1,7 +1,7 @@ error[E0659]: `sub` is ambiguous (name vs any other name during import resolution) --> $DIR/block-scoped-shadow-nested.rs:16:13 | -LL | use sub::bar; //~ ERROR `sub` is ambiguous +LL | use sub::bar; | ^^^ ambiguous name | note: `sub` could refer to the module imported here diff --git a/src/test/ui/rust-2018/uniform-paths/deadlock.stderr b/src/test/ui/rust-2018/uniform-paths/deadlock.stderr index 8bbc8f33039b..b4ac15c588eb 100644 --- a/src/test/ui/rust-2018/uniform-paths/deadlock.stderr +++ b/src/test/ui/rust-2018/uniform-paths/deadlock.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import --> $DIR/deadlock.rs:4:5 | -LL | use foo::bar; //~ ERROR unresolved import +LL | use foo::bar; | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/rust-2018/uniform-paths/issue-54253.stderr b/src/test/ui/rust-2018/uniform-paths/issue-54253.stderr index 3d7176265a27..adde63590351 100644 --- a/src/test/ui/rust-2018/uniform-paths/issue-54253.stderr +++ b/src/test/ui/rust-2018/uniform-paths/issue-54253.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `crate::version` --> $DIR/issue-54253.rs:10:9 | -LL | use crate::version; //~ ERROR unresolved import `crate::version` +LL | use crate::version; | ^^^^^^^^^^^^^^ no `version` in the root error: aborting due to previous error diff --git a/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr b/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr index 293d0ec6a720..b1c0b461db4a 100644 --- a/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr +++ b/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr @@ -1,7 +1,7 @@ error[E0659]: `issue_56596` is ambiguous (name vs any other name during import resolution) --> $DIR/issue-56596.rs:12:5 | -LL | use issue_56596; //~ ERROR `issue_56596` is ambiguous +LL | use issue_56596; | ^^^^^^^^^^^ ambiguous name | = note: `issue_56596` could refer to an extern crate passed with `--extern` diff --git a/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr b/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr index 684f5fceac15..e1000e588fa0 100644 --- a/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr +++ b/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr @@ -1,19 +1,19 @@ error[E0364]: `legacy_macro` is private, and cannot be re-exported --> $DIR/macro-rules.rs:11:13 | -LL | pub use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported +LL | pub use legacy_macro as _; | ^^^^^^^^^^^^^^^^^ | note: consider marking `legacy_macro` as `pub` in the imported module --> $DIR/macro-rules.rs:11:13 | -LL | pub use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported +LL | pub use legacy_macro as _; | ^^^^^^^^^^^^^^^^^ error[E0659]: `legacy_macro` is ambiguous (name vs any other name during import resolution) --> $DIR/macro-rules.rs:31:13 | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous +LL | use legacy_macro as _; | ^^^^^^^^^^^^ ambiguous name | note: `legacy_macro` could refer to the macro defined here diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr b/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr index 40b8fcf7158e..fc6453193bc9 100644 --- a/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr +++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr @@ -1,7 +1,7 @@ error: cannot use a built-in attribute through an import --> $DIR/prelude-fail-2.rs:15:3 | -LL | #[imported_inline] //~ ERROR cannot use a built-in attribute through an import +LL | #[imported_inline] | ^^^^^^^^^^^^^^^ | note: the built-in attribute imported here @@ -13,13 +13,13 @@ LL | use inline as imported_inline; error: cannot use a built-in attribute through an import --> $DIR/prelude-fail-2.rs:16:3 | -LL | #[builtin::imported_inline] //~ ERROR cannot use a built-in attribute through an import +LL | #[builtin::imported_inline] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: cannot use a tool module through an import --> $DIR/prelude-fail-2.rs:17:3 | -LL | #[imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import +LL | #[imported_rustfmt::skip] | ^^^^^^^^^^^^^^^^ | note: the tool module imported here @@ -31,7 +31,7 @@ LL | use rustfmt as imported_rustfmt; error: cannot use a tool module through an import --> $DIR/prelude-fail-2.rs:18:13 | -LL | #[tool_mod::imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import +LL | #[tool_mod::imported_rustfmt::skip] | ^^^^^^^^^^^^^^^^ | note: the tool module imported here diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr b/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr index fdfea416b12f..a61af699cdc3 100644 --- a/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr +++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr @@ -1,13 +1,13 @@ error: cannot import a built-in macro --> $DIR/prelude-fail.rs:4:5 | -LL | use env as env_imported; //~ ERROR cannot import a built-in macro +LL | use env as env_imported; | ^^^^^^^^^^^^^^^^^^^ error[E0432]: unresolved import `rustfmt` --> $DIR/prelude-fail.rs:7:5 | -LL | use rustfmt::skip as imported_rustfmt_skip; //~ ERROR unresolved import `rustfmt` +LL | use rustfmt::skip as imported_rustfmt_skip; | ^^^^^^^ not a module `rustfmt` error: aborting due to 2 previous errors diff --git a/src/test/ui/rustc-args-required-const.stderr b/src/test/ui/rustc-args-required-const.stderr index 7a1caf3c40fe..8b302692053a 100644 --- a/src/test/ui/rustc-args-required-const.stderr +++ b/src/test/ui/rustc-args-required-const.stderr @@ -1,13 +1,13 @@ error: argument 1 is required to be a constant --> $DIR/rustc-args-required-const.rs:24:5 | -LL | foo(a); //~ ERROR: argument 1 is required to be a constant +LL | foo(a); | ^^^^^^ error: argument 2 is required to be a constant --> $DIR/rustc-args-required-const.rs:26:5 | -LL | bar(a, a); //~ ERROR: argument 2 is required to be a constant +LL | bar(a, a); | ^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/rustc-args-required-const2.stderr b/src/test/ui/rustc-args-required-const2.stderr index 005f68fa2e64..a8906ad3bc55 100644 --- a/src/test/ui/rustc-args-required-const2.stderr +++ b/src/test/ui/rustc-args-required-const2.stderr @@ -1,7 +1,7 @@ error: this function can only be invoked directly, not through a function pointer --> $DIR/rustc-args-required-const2.rs:8:13 | -LL | let a = foo; //~ ERROR: this function can only be invoked directly +LL | let a = foo; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/rustc-error.stderr b/src/test/ui/rustc-error.stderr index c6b9cf77e588..dcbc0e1feb21 100644 --- a/src/test/ui/rustc-error.stderr +++ b/src/test/ui/rustc-error.stderr @@ -2,7 +2,7 @@ error: compilation successful --> $DIR/rustc-error.rs:4:1 | LL | / fn main() { -LL | | //~^ ERROR compilation successful +LL | | LL | | } | |_^ diff --git a/src/test/ui/safe-extern-statics-mut.stderr b/src/test/ui/safe-extern-statics-mut.stderr index 4eecce6d3d31..388038834144 100644 --- a/src/test/ui/safe-extern-statics-mut.stderr +++ b/src/test/ui/safe-extern-statics-mut.stderr @@ -1,7 +1,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/safe-extern-statics-mut.rs:11:13 | -LL | let b = B; //~ ERROR use of mutable static is unsafe +LL | let b = B; | ^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -9,7 +9,7 @@ LL | let b = B; //~ ERROR use of mutable static is unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/safe-extern-statics-mut.rs:12:14 | -LL | let rb = &B; //~ ERROR use of mutable static is unsafe +LL | let rb = &B; | ^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -17,7 +17,7 @@ LL | let rb = &B; //~ ERROR use of mutable static is unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/safe-extern-statics-mut.rs:13:14 | -LL | let xb = XB; //~ ERROR use of mutable static is unsafe +LL | let xb = XB; | ^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -25,7 +25,7 @@ LL | let xb = XB; //~ ERROR use of mutable static is unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/safe-extern-statics-mut.rs:14:15 | -LL | let xrb = &XB; //~ ERROR use of mutable static is unsafe +LL | let xrb = &XB; | ^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior diff --git a/src/test/ui/safe-extern-statics.stderr b/src/test/ui/safe-extern-statics.stderr index 11ade798ba47..86976a2c932d 100644 --- a/src/test/ui/safe-extern-statics.stderr +++ b/src/test/ui/safe-extern-statics.stderr @@ -1,7 +1,7 @@ error: use of extern static is unsafe and requires unsafe function or block (error E0133) --> $DIR/safe-extern-statics.rs:13:13 | -LL | let a = A; //~ ERROR use of extern static is unsafe +LL | let a = A; | ^ | = note: #[deny(safe_extern_statics)] on by default @@ -12,7 +12,7 @@ LL | let a = A; //~ ERROR use of extern static is unsafe error: use of extern static is unsafe and requires unsafe function or block (error E0133) --> $DIR/safe-extern-statics.rs:15:14 | -LL | let ra = &A; //~ ERROR use of extern static is unsafe +LL | let ra = &A; | ^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -22,7 +22,7 @@ LL | let ra = &A; //~ ERROR use of extern static is unsafe error: use of extern static is unsafe and requires unsafe function or block (error E0133) --> $DIR/safe-extern-statics.rs:17:14 | -LL | let xa = XA; //~ ERROR use of extern static is unsafe +LL | let xa = XA; | ^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -32,7 +32,7 @@ LL | let xa = XA; //~ ERROR use of extern static is unsafe error: use of extern static is unsafe and requires unsafe function or block (error E0133) --> $DIR/safe-extern-statics.rs:19:15 | -LL | let xra = &XA; //~ ERROR use of extern static is unsafe +LL | let xra = &XA; | ^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/self/self-infer.stderr b/src/test/ui/self/self-infer.stderr index 4b8fd7037795..f91cfe5eb621 100644 --- a/src/test/ui/self/self-infer.stderr +++ b/src/test/ui/self/self-infer.stderr @@ -1,13 +1,13 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/self-infer.rs:4:16 | -LL | fn f(self: _) {} //~ERROR the type placeholder `_` is not allowed within types on item sig +LL | fn f(self: _) {} | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/self-infer.rs:5:17 | -LL | fn g(self: &_) {} //~ERROR the type placeholder `_` is not allowed within types on item sig +LL | fn g(self: &_) {} | ^ not allowed in type signatures error: aborting due to 2 previous errors diff --git a/src/test/ui/self/self-vs-path-ambiguity.stderr b/src/test/ui/self/self-vs-path-ambiguity.stderr index 954d240e71b6..5ce6a81bfcfd 100644 --- a/src/test/ui/self/self-vs-path-ambiguity.stderr +++ b/src/test/ui/self/self-vs-path-ambiguity.stderr @@ -1,7 +1,7 @@ error: unexpected lifetime `'a` in pattern --> $DIR/self-vs-path-ambiguity.rs:9:11 | -LL | fn i(&'a self::S: &S) {} //~ ERROR unexpected lifetime `'a` in pattern +LL | fn i(&'a self::S: &S) {} | ^^ unexpected lifetime error: aborting due to previous error diff --git a/src/test/ui/self/self_type_keyword-2.stderr b/src/test/ui/self/self_type_keyword-2.stderr index 55c8796e158f..eedec6896f47 100644 --- a/src/test/ui/self/self_type_keyword-2.stderr +++ b/src/test/ui/self/self_type_keyword-2.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `self::Self` --> $DIR/self_type_keyword-2.rs:1:5 | -LL | use self::Self as Foo; //~ ERROR unresolved import `self::Self` +LL | use self::Self as Foo; | ^^^^^^^^^^^^^^^^^ no `Self` in the root error[E0531]: cannot find unit struct/variant or constant `Self` in this scope diff --git a/src/test/ui/seq-args.stderr b/src/test/ui/seq-args.stderr index 81ba1abcd6dc..2e7d901640e8 100644 --- a/src/test/ui/seq-args.stderr +++ b/src/test/ui/seq-args.stderr @@ -1,13 +1,13 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/seq-args.rs:4:13 | -LL | impl Seq for Vec { //~ ERROR wrong number of type arguments +LL | impl Seq for Vec { | ^ unexpected type argument error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/seq-args.rs:7:10 | -LL | impl Seq for u32 { //~ ERROR wrong number of type arguments +LL | impl Seq for u32 { | ^^^^ unexpected type argument error: aborting due to 2 previous errors diff --git a/src/test/ui/shadowed/shadowed-trait-methods.stderr b/src/test/ui/shadowed/shadowed-trait-methods.stderr index 38b604af2900..e05da17983f8 100644 --- a/src/test/ui/shadowed/shadowed-trait-methods.stderr +++ b/src/test/ui/shadowed/shadowed-trait-methods.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `f` found for type `()` in the current scope --> $DIR/shadowed-trait-methods.rs:13:8 | -LL | ().f() //~ ERROR no method +LL | ().f() | ^ | = help: items from traits can only be used if the trait is in scope diff --git a/src/test/ui/shadowed/shadowed-use-visibility.stderr b/src/test/ui/shadowed/shadowed-use-visibility.stderr index 60e474a845fe..7c66fdf60b1d 100644 --- a/src/test/ui/shadowed/shadowed-use-visibility.stderr +++ b/src/test/ui/shadowed/shadowed-use-visibility.stderr @@ -1,13 +1,13 @@ error[E0603]: module `bar` is private --> $DIR/shadowed-use-visibility.rs:9:14 | -LL | use foo::bar::f as g; //~ ERROR module `bar` is private +LL | use foo::bar::f as g; | ^^^ error[E0603]: module `f` is private --> $DIR/shadowed-use-visibility.rs:15:10 | -LL | use bar::f::f; //~ ERROR module `f` is private +LL | use bar::f::f; | ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr b/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr index 5d0fc912d95c..71197efcaba5 100644 --- a/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr +++ b/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr @@ -1,13 +1,13 @@ error[E0416]: identifier `a` is bound more than once in the same pattern --> $DIR/shadowing-in-the-same-pattern.rs:3:10 | -LL | fn f((a, a): (isize, isize)) {} //~ ERROR identifier `a` is bound more than once +LL | fn f((a, a): (isize, isize)) {} | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern --> $DIR/shadowing-in-the-same-pattern.rs:6:13 | -LL | let (a, a) = (1, 1); //~ ERROR identifier `a` is bound more than once +LL | let (a, a) = (1, 1); | ^ used in a pattern more than once error: aborting due to 2 previous errors diff --git a/src/test/ui/simd-type.stderr b/src/test/ui/simd-type.stderr index 5e309cea6ef1..027afcb981a0 100644 --- a/src/test/ui/simd-type.stderr +++ b/src/test/ui/simd-type.stderr @@ -1,19 +1,19 @@ error[E0075]: SIMD vector cannot be empty --> $DIR/simd-type.rs:5:1 | -LL | struct empty; //~ ERROR SIMD vector cannot be empty +LL | struct empty; | ^^^^^^^^^^^^^ error[E0076]: SIMD vector should be homogeneous --> $DIR/simd-type.rs:8:1 | -LL | struct i64f64(i64, f64); //~ ERROR SIMD vector should be homogeneous +LL | struct i64f64(i64, f64); | ^^^^^^^^^^^^^^^^^^^^^^^^ SIMD elements must have the same type error[E0077]: SIMD vector element type should be machine type --> $DIR/simd-type.rs:11:1 | -LL | struct int4(isize, isize, isize, isize); //~ ERROR SIMD vector element type should be machine type +LL | struct int4(isize, isize, isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/similar-tokens.stderr b/src/test/ui/similar-tokens.stderr index 898c3a0aa95c..3113d4a872d8 100644 --- a/src/test/ui/similar-tokens.stderr +++ b/src/test/ui/similar-tokens.stderr @@ -1,7 +1,7 @@ error: expected one of `,`, `::`, `as`, or `}`, found `.` --> $DIR/similar-tokens.rs:7:10 | -LL | use x::{A. B}; //~ ERROR expected one of `,`, `::`, `as`, or `}`, found `.` +LL | use x::{A. B}; | ^ expected one of `,`, `::`, `as`, or `}` here error: aborting due to previous error diff --git a/src/test/ui/single-primitive-inherent-impl.stderr b/src/test/ui/single-primitive-inherent-impl.stderr index 21bbbe693466..d357afa3b384 100644 --- a/src/test/ui/single-primitive-inherent-impl.stderr +++ b/src/test/ui/single-primitive-inherent-impl.stderr @@ -2,7 +2,7 @@ error[E0390]: only a single inherent implementation marked with `#[lang = "str"] --> $DIR/single-primitive-inherent-impl.rs:11:1 | LL | / impl str { -LL | | //~^ error: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive +LL | | LL | | } | |_^ | @@ -10,7 +10,7 @@ help: consider using a trait to implement these methods --> $DIR/single-primitive-inherent-impl.rs:11:1 | LL | / impl str { -LL | | //~^ error: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive +LL | | LL | | } | |_^ diff --git a/src/test/ui/single-use-lifetime/fn-types.stderr b/src/test/ui/single-use-lifetime/fn-types.stderr index 7e23d75c4e58..bec24be07af6 100644 --- a/src/test/ui/single-use-lifetime/fn-types.stderr +++ b/src/test/ui/single-use-lifetime/fn-types.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'a` only used once --> $DIR/fn-types.rs:9:10 | -LL | a: for<'a> fn(&'a u32), //~ ERROR `'a` only used once +LL | a: for<'a> fn(&'a u32), | ^^ -- ...is used only here | | | this lifetime... diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr index 0199074ad64d..4bf08534b8c4 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'a` only used once --> $DIR/one-use-in-fn-argument.rs:8:6 | -LL | fn a<'a>(x: &'a u32) { //~ ERROR `'a` only used once +LL | fn a<'a>(x: &'a u32) { | ^^ -- ...is used only here | | | this lifetime... @@ -13,7 +13,7 @@ LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ help: elide the single-use lifetime | -LL | fn a(x: &u32) { //~ ERROR `'a` only used once +LL | fn a(x: &u32) { | -- -- error: aborting due to previous error diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr index 094894bf2d1e..8115a1e64011 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'f` only used once --> $DIR/one-use-in-inherent-impl-header.rs:12:6 | -LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once +LL | impl<'f> Foo<'f> { | ^^ -- ...is used only here | | | this lifetime... diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr index 5bd4efb6bb1e..48bd9f19126b 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'a` only used once --> $DIR/one-use-in-inherent-method-argument.rs:12:19 | -LL | fn inherent_a<'a>(&self, data: &'a u32) { //~ ERROR `'a` only used once +LL | fn inherent_a<'a>(&self, data: &'a u32) { | ^^ -- ...is used only here | | | this lifetime... @@ -13,13 +13,13 @@ LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ help: elide the single-use lifetime | -LL | fn inherent_a(&self, data: &u32) { //~ ERROR `'a` only used once +LL | fn inherent_a(&self, data: &u32) { | -- -- error: lifetime parameter `'f` only used once --> $DIR/one-use-in-inherent-method-argument.rs:11:6 | -LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once +LL | impl<'f> Foo<'f> { | ^^ -- ...is used only here | | | this lifetime... diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr index f0e4ac411c2b..9c93da462715 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'f` only used once --> $DIR/one-use-in-inherent-method-return.rs:12:6 | -LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once +LL | impl<'f> Foo<'f> { | ^^ -- ...is used only here | | | this lifetime... diff --git a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr index 7d3fc82abf40..047e0591e4b9 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'g` only used once --> $DIR/one-use-in-trait-method-argument.rs:15:13 | -LL | fn next<'g>(&'g mut self) -> Option { //~ ERROR `'g` only used once +LL | fn next<'g>(&'g mut self) -> Option { | ^^ -- ...is used only here | | | this lifetime... @@ -13,7 +13,7 @@ LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ help: elide the single-use lifetime | -LL | fn next(&mut self) -> Option { //~ ERROR `'g` only used once +LL | fn next(&mut self) -> Option { | ---- error: aborting due to previous error diff --git a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr index 7a1af1323d8d..6f0ba02b5067 100644 --- a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr +++ b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'f` only used once --> $DIR/two-uses-in-inherent-method-argument-and-return.rs:12:6 | -LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once +LL | impl<'f> Foo<'f> { | ^^ -- ...is used only here | | | this lifetime... diff --git a/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr b/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr index 3f9d907ade67..650a9b4600ea 100644 --- a/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr +++ b/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'a` never used --> $DIR/zero-uses-in-impl.rs:8:6 | -LL | impl<'a> Foo {} //~ ERROR `'a` never used +LL | impl<'a> Foo {} | -^^- help: elide the unused lifetime | note: lint level defined here diff --git a/src/test/ui/slice-2.stderr b/src/test/ui/slice-2.stderr index ef0eeb7a8da3..561feb90f0a5 100644 --- a/src/test/ui/slice-2.stderr +++ b/src/test/ui/slice-2.stderr @@ -1,25 +1,25 @@ error[E0608]: cannot index into a value of type `Foo` --> $DIR/slice-2.rs:7:6 | -LL | &x[..]; //~ ERROR cannot index into a value of type `Foo` +LL | &x[..]; | ^^^^^ error[E0608]: cannot index into a value of type `Foo` --> $DIR/slice-2.rs:8:6 | -LL | &x[Foo..]; //~ ERROR cannot index into a value of type `Foo` +LL | &x[Foo..]; | ^^^^^^^^ error[E0608]: cannot index into a value of type `Foo` --> $DIR/slice-2.rs:9:6 | -LL | &x[..Foo]; //~ ERROR cannot index into a value of type `Foo` +LL | &x[..Foo]; | ^^^^^^^^ error[E0608]: cannot index into a value of type `Foo` --> $DIR/slice-2.rs:10:6 | -LL | &x[Foo..Foo]; //~ ERROR cannot index into a value of type `Foo` +LL | &x[Foo..Foo]; | ^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/slice-mut-2.stderr b/src/test/ui/slice-mut-2.stderr index 07a8bd7699ec..78dbfa56d45d 100644 --- a/src/test/ui/slice-mut-2.stderr +++ b/src/test/ui/slice-mut-2.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable --> $DIR/slice-mut-2.rs:7:18 | -LL | let _ = &mut x[2..4]; //~ERROR cannot borrow immutable borrowed content `*x` as mutable +LL | let _ = &mut x[2..4]; | ^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/span/E0057.stderr b/src/test/ui/span/E0057.stderr index 5906a05c32c9..6b5890cac36c 100644 --- a/src/test/ui/span/E0057.stderr +++ b/src/test/ui/span/E0057.stderr @@ -1,13 +1,13 @@ error[E0057]: this function takes 1 parameter but 0 parameters were supplied --> $DIR/E0057.rs:3:13 | -LL | let a = f(); //~ ERROR E0057 +LL | let a = f(); | ^^^ expected 1 parameter error[E0057]: this function takes 1 parameter but 2 parameters were supplied --> $DIR/E0057.rs:5:13 | -LL | let c = f(2, 3); //~ ERROR E0057 +LL | let c = f(2, 3); | ^^^^^^^ expected 1 parameter error: aborting due to 2 previous errors diff --git a/src/test/ui/span/E0072.stderr b/src/test/ui/span/E0072.stderr index 4cb9eb308022..d4a5e7400d2a 100644 --- a/src/test/ui/span/E0072.stderr +++ b/src/test/ui/span/E0072.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `ListNode` has infinite size --> $DIR/E0072.rs:1:1 | -LL | struct ListNode { //~ ERROR has infinite size +LL | struct ListNode { | ^^^^^^^^^^^^^^^ recursive type has infinite size LL | head: u8, LL | tail: Option, diff --git a/src/test/ui/span/E0204.stderr b/src/test/ui/span/E0204.stderr index acb7cd2a557d..5a981a4a6e48 100644 --- a/src/test/ui/span/E0204.stderr +++ b/src/test/ui/span/E0204.stderr @@ -4,13 +4,13 @@ error[E0204]: the trait `Copy` may not be implemented for this type LL | foo: Vec, | ------------- this field does not implement `Copy` ... -LL | impl Copy for Foo { } //~ ERROR may not be implemented for this type +LL | impl Copy for Foo { } | ^^^^ error[E0204]: the trait `Copy` may not be implemented for this type --> $DIR/E0204.rs:7:10 | -LL | #[derive(Copy)] //~ ERROR may not be implemented for this type +LL | #[derive(Copy)] | ^^^^ LL | struct Foo2<'a> { LL | ty: &'a mut bool, @@ -22,13 +22,13 @@ error[E0204]: the trait `Copy` may not be implemented for this type LL | Bar { x: Vec }, | ----------- this field does not implement `Copy` ... -LL | impl Copy for EFoo { } //~ ERROR may not be implemented for this type +LL | impl Copy for EFoo { } | ^^^^ error[E0204]: the trait `Copy` may not be implemented for this type --> $DIR/E0204.rs:19:10 | -LL | #[derive(Copy)] //~ ERROR may not be implemented for this type +LL | #[derive(Copy)] | ^^^^ LL | enum EFoo2<'a> { LL | Bar(&'a mut bool), diff --git a/src/test/ui/span/E0535.stderr b/src/test/ui/span/E0535.stderr index 8502776eb168..f52c3f9f2c04 100644 --- a/src/test/ui/span/E0535.stderr +++ b/src/test/ui/span/E0535.stderr @@ -1,7 +1,7 @@ error[E0535]: invalid argument --> $DIR/E0535.rs:1:10 | -LL | #[inline(unknown)] //~ ERROR E0535 +LL | #[inline(unknown)] | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/span/E0536.stderr b/src/test/ui/span/E0536.stderr index 18e2104f7ad8..820b0d7441b4 100644 --- a/src/test/ui/span/E0536.stderr +++ b/src/test/ui/span/E0536.stderr @@ -1,7 +1,7 @@ error[E0536]: expected 1 cfg-pattern --> $DIR/E0536.rs:1:7 | -LL | #[cfg(not())] //~ ERROR E0536 +LL | #[cfg(not())] | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/span/E0537.stderr b/src/test/ui/span/E0537.stderr index 53e8637ea302..5478c3fbcdda 100644 --- a/src/test/ui/span/E0537.stderr +++ b/src/test/ui/span/E0537.stderr @@ -1,7 +1,7 @@ error[E0537]: invalid predicate `unknown` --> $DIR/E0537.rs:1:7 | -LL | #[cfg(unknown())] //~ ERROR E0537 +LL | #[cfg(unknown())] | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr index e0524be6b0c4..63baa7c8cb52 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn deref_mut_field1(x: Own) { | - help: make this binding mutable: `mut x` -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable | LL | fn deref_extend_mut_field1(x: &Own) -> &mut isize { | ----------- use `&mut Own` here to make mutable -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^ cannot borrow as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time @@ -19,7 +19,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let _x = &mut x.x; | - first mutable borrow occurs here -LL | let _y = &mut x.y; //~ ERROR cannot borrow +LL | let _y = &mut x.y; | ^ second mutable borrow occurs here LL | use_mut(_x); LL | } @@ -30,7 +30,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn assign_field1<'a>(x: Own) { | - help: make this binding mutable: `mut x` -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -38,7 +38,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable | LL | fn assign_field2<'a>(x: &'a Own) { | -------------- use `&'a mut Own` here to make mutable -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ cannot borrow as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time @@ -46,7 +46,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let _p: &mut Point = &mut **x; | -- first mutable borrow occurs here -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ second mutable borrow occurs here LL | use_mut(_p); LL | } @@ -57,7 +57,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn deref_mut_method1(x: Own) { | - help: make this binding mutable: `mut x` -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -65,7 +65,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable | LL | fn deref_extend_mut_method1(x: &Own) -> &mut isize { | ----------- use `&mut Own` here to make mutable -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable argument `x` as mutable @@ -73,7 +73,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn assign_method1<'a>(x: Own) { | - help: make this binding mutable: `mut x` -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -81,7 +81,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable | LL | fn assign_method2<'a>(x: &'a Own) { | -------------- use `&'a mut Own` here to make mutable -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error: aborting due to 10 previous errors diff --git a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr index 46d11065a86e..77f3982b2b41 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn deref_mut1(x: Own) { | - help: make this binding mutable: `mut x` -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable | LL | fn deref_extend_mut1<'a>(x: &'a Own) -> &'a mut isize { | -------------- use `&'a mut Own` here to make mutable -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^ cannot borrow as mutable error[E0596]: cannot borrow immutable argument `x` as mutable @@ -19,7 +19,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn assign1<'a>(x: Own) { | - help: make this binding mutable: `mut x` -LL | *x = 3; //~ ERROR cannot borrow +LL | *x = 3; | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -27,7 +27,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable | LL | fn assign2<'a>(x: &'a Own) { | -------------- use `&'a mut Own` here to make mutable -LL | **x = 3; //~ ERROR cannot borrow +LL | **x = 3; | ^^ cannot borrow as mutable error: aborting due to 4 previous errors diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr index d81d402fce73..6c8f477e3106 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -5,7 +5,7 @@ LL | f(Box::new(|| { | - ^^ second mutable borrow occurs here | | | first mutable borrow occurs here -LL | //~^ ERROR: cannot borrow `f` as mutable more than once +LL | LL | f((Box::new(|| {}))) | - borrow occurs due to use of `f` in closure LL | })); diff --git a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr index 4875e27ef455..440c5c9c7c9d 100644 --- a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr +++ b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable LL | fn b(x: &Foo) { | ---- use `&mut Foo` here to make mutable LL | x.f(); -LL | x.h(); //~ ERROR cannot borrow +LL | x.h(); | ^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/span/borrowck-object-mutability.stderr b/src/test/ui/span/borrowck-object-mutability.stderr index e846331dc0b8..073a70e36106 100644 --- a/src/test/ui/span/borrowck-object-mutability.stderr +++ b/src/test/ui/span/borrowck-object-mutability.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable LL | fn borrowed_receiver(x: &Foo) { | ---- use `&mut Foo` here to make mutable LL | x.borrowed(); -LL | x.borrowed_mut(); //~ ERROR cannot borrow +LL | x.borrowed_mut(); | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable `Box` content `*x` as mutable @@ -13,7 +13,7 @@ error[E0596]: cannot borrow immutable `Box` content `*x` as mutable LL | fn owned_receiver(x: Box) { | - help: make this binding mutable: `mut x` LL | x.borrowed(); -LL | x.borrowed_mut(); //~ ERROR cannot borrow +LL | x.borrowed_mut(); | ^ cannot borrow as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/span/destructor-restrictions.stderr b/src/test/ui/span/destructor-restrictions.stderr index 8fec87746781..a82e24b9391e 100644 --- a/src/test/ui/span/destructor-restrictions.stderr +++ b/src/test/ui/span/destructor-restrictions.stderr @@ -3,7 +3,7 @@ error[E0597]: `*a` does not live long enough | LL | *a.borrow() + 1 | ^ borrowed value does not live long enough -LL | }; //~^ ERROR `*a` does not live long enough +LL | }; | -- borrowed value needs to live until here | | | `*a` dropped here while still borrowed diff --git a/src/test/ui/span/dropck_arr_cycle_checked.stderr b/src/test/ui/span/dropck_arr_cycle_checked.stderr index aae71799e30f..b2bacc7f6789 100644 --- a/src/test/ui/span/dropck_arr_cycle_checked.stderr +++ b/src/test/ui/span/dropck_arr_cycle_checked.stderr @@ -58,7 +58,7 @@ error[E0597]: `b2` does not live long enough | LL | b3.a[1].v.set(Some(&b2)); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `b2` does not live long enough +LL | LL | } | - `b2` dropped here while still borrowed | diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.stderr b/src/test/ui/span/dropck_direct_cycle_with_drop.stderr index bc4b517c51d6..497924208ab7 100644 --- a/src/test/ui/span/dropck_direct_cycle_with_drop.stderr +++ b/src/test/ui/span/dropck_direct_cycle_with_drop.stderr @@ -14,7 +14,7 @@ error[E0597]: `d1` does not live long enough | LL | d2.p.set(Some(&d1)); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `d1` does not live long enough +LL | LL | } | - `d1` dropped here while still borrowed | diff --git a/src/test/ui/span/dropck_vec_cycle_checked.stderr b/src/test/ui/span/dropck_vec_cycle_checked.stderr index 35e4314d0c66..7f902388fac1 100644 --- a/src/test/ui/span/dropck_vec_cycle_checked.stderr +++ b/src/test/ui/span/dropck_vec_cycle_checked.stderr @@ -58,7 +58,7 @@ error[E0597]: `c2` does not live long enough | LL | c3.v[1].v.set(Some(&c2)); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `c2` does not live long enough +LL | LL | } | - `c2` dropped here while still borrowed | diff --git a/src/test/ui/span/gated-features-attr-spans.stderr b/src/test/ui/span/gated-features-attr-spans.stderr index 9c4c12ba0768..45d14f32f96e 100644 --- a/src/test/ui/span/gated-features-attr-spans.stderr +++ b/src/test/ui/span/gated-features-attr-spans.stderr @@ -1,7 +1,7 @@ error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731) --> $DIR/gated-features-attr-spans.rs:1:1 | -LL | #[repr(simd)] //~ ERROR are experimental +LL | #[repr(simd)] | ^^^^^^^^^^^^^ | = help: add #![feature(repr_simd)] to the crate attributes to enable diff --git a/src/test/ui/span/import-ty-params.stderr b/src/test/ui/span/import-ty-params.stderr index cff71bf2e62d..a02a1edc1349 100644 --- a/src/test/ui/span/import-ty-params.stderr +++ b/src/test/ui/span/import-ty-params.stderr @@ -1,13 +1,13 @@ error: unexpected generic arguments in path --> $DIR/import-ty-params.rs:14:15 | -LL | import! { a::b::c::S } //~ ERROR unexpected generic arguments in path +LL | import! { a::b::c::S } | ^^^^^^^^^^^^^^ error: unexpected generic arguments in path --> $DIR/import-ty-params.rs:17:15 | -LL | import! { a::b::c::S<> } //~ ERROR unexpected generic arguments in path +LL | import! { a::b::c::S<> } | ^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/span/issue-11925.stderr b/src/test/ui/span/issue-11925.stderr index 46e2a41b3c34..c75022261a80 100644 --- a/src/test/ui/span/issue-11925.stderr +++ b/src/test/ui/span/issue-11925.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/issue-11925.rs:8:36 | -LL | let f = to_fn_once(move|| &x); //~ ERROR does not live long enough +LL | let f = to_fn_once(move|| &x); | ^ | | | borrowed value does not live long enough diff --git a/src/test/ui/span/issue-24690.stderr b/src/test/ui/span/issue-24690.stderr index 964e323b83ed..0864497911d3 100644 --- a/src/test/ui/span/issue-24690.stderr +++ b/src/test/ui/span/issue-24690.stderr @@ -1,7 +1,7 @@ warning: unused variable: `theOtherTwo` --> $DIR/issue-24690.rs:13:9 | -LL | let theOtherTwo = 2; //~ WARN should have a snake case name +LL | let theOtherTwo = 2; | ^^^^^^^^^^^ help: consider prefixing with an underscore: `_theOtherTwo` | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![warn(unused)] warning: variable `theTwo` should have a snake case name --> $DIR/issue-24690.rs:12:9 | -LL | let theTwo = 2; //~ WARN should have a snake case name +LL | let theTwo = 2; | ^^^^^^ help: convert the identifier to snake case: `the_two` | = note: #[warn(non_snake_case)] on by default @@ -22,6 +22,6 @@ LL | let theTwo = 2; //~ WARN should have a snake case name warning: variable `theOtherTwo` should have a snake case name --> $DIR/issue-24690.rs:13:9 | -LL | let theOtherTwo = 2; //~ WARN should have a snake case name +LL | let theOtherTwo = 2; | ^^^^^^^^^^^ help: convert the identifier to snake case: `the_other_two` diff --git a/src/test/ui/span/issue-25199.stderr b/src/test/ui/span/issue-25199.stderr index 135d8150c34e..6d8320bc053c 100644 --- a/src/test/ui/span/issue-25199.stderr +++ b/src/test/ui/span/issue-25199.stderr @@ -14,7 +14,7 @@ error[E0597]: `container` does not live long enough | LL | container.store(test); | ^^^^^^^^^ borrowed value does not live long enough -LL | //~^ ERROR `container` does not live long enough +LL | LL | } | - `container` dropped here while still borrowed | diff --git a/src/test/ui/span/issue-27522.stderr b/src/test/ui/span/issue-27522.stderr index 1fcb839d1705..c99231a5336b 100644 --- a/src/test/ui/span/issue-27522.stderr +++ b/src/test/ui/span/issue-27522.stderr @@ -1,7 +1,7 @@ error[E0307]: invalid method receiver type: &SomeType --> $DIR/issue-27522.rs:6:22 | -LL | fn handler(self: &SomeType); //~ ERROR invalid method receiver type +LL | fn handler(self: &SomeType); | ^^^^^^^^^ | = note: type must be `Self` or a type that dereferences to it diff --git a/src/test/ui/span/issue-29595.stderr b/src/test/ui/span/issue-29595.stderr index dbb1743ec0ef..24dfdf8ebc29 100644 --- a/src/test/ui/span/issue-29595.stderr +++ b/src/test/ui/span/issue-29595.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `u8: Tr` is not satisfied --> $DIR/issue-29595.rs:6:17 | -LL | let a: u8 = Tr::C; //~ ERROR the trait bound `u8: Tr` is not satisfied +LL | let a: u8 = Tr::C; | ^^^^^ the trait `Tr` is not implemented for `u8` | note: required by `Tr::C` diff --git a/src/test/ui/span/issue-34264.stderr b/src/test/ui/span/issue-34264.stderr index 9b3b68f6ff46..c5b6245572c6 100644 --- a/src/test/ui/span/issue-34264.stderr +++ b/src/test/ui/span/issue-34264.stderr @@ -1,34 +1,34 @@ error: expected one of `:` or `@`, found `<` --> $DIR/issue-34264.rs:1:14 | -LL | fn foo(Option, String) {} //~ ERROR expected one of +LL | fn foo(Option, String) {} | ^ expected one of `:` or `@` here error: expected one of `:` or `@`, found `)` --> $DIR/issue-34264.rs:1:27 | -LL | fn foo(Option, String) {} //~ ERROR expected one of +LL | fn foo(Option, String) {} | ^ expected one of `:` or `@` here error: expected one of `:` or `@`, found `,` --> $DIR/issue-34264.rs:3:9 | -LL | fn bar(x, y: usize) {} //~ ERROR expected one of +LL | fn bar(x, y: usize) {} | ^ expected one of `:` or `@` here error[E0061]: this function takes 2 parameters but 3 parameters were supplied --> $DIR/issue-34264.rs:7:5 | -LL | fn foo(Option, String) {} //~ ERROR expected one of +LL | fn foo(Option, String) {} | --------------------------- defined here ... -LL | foo(Some(42), 2, ""); //~ ERROR this function takes +LL | foo(Some(42), 2, ""); | ^^^^^^^^^^^^^^^^^^^^ expected 2 parameters error[E0308]: mismatched types --> $DIR/issue-34264.rs:8:13 | -LL | bar("", ""); //~ ERROR mismatched types +LL | bar("", ""); | ^^ expected usize, found reference | = note: expected type `usize` @@ -37,10 +37,10 @@ LL | bar("", ""); //~ ERROR mismatched types error[E0061]: this function takes 2 parameters but 3 parameters were supplied --> $DIR/issue-34264.rs:10:5 | -LL | fn bar(x, y: usize) {} //~ ERROR expected one of +LL | fn bar(x, y: usize) {} | ------------------- defined here ... -LL | bar(1, 2, 3); //~ ERROR this function takes +LL | bar(1, 2, 3); | ^^^^^^^^^^^^ expected 2 parameters error: aborting due to 6 previous errors diff --git a/src/test/ui/span/issue-36530.stderr b/src/test/ui/span/issue-36530.stderr index b2b494a2c9c3..05b2ca90570e 100644 --- a/src/test/ui/span/issue-36530.stderr +++ b/src/test/ui/span/issue-36530.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/issue-36530.rs:3:3 | -LL | #[foo] //~ ERROR is currently unknown to the compiler +LL | #[foo] | ^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[foo] //~ ERROR is currently unknown to the compiler error[E0658]: non-builtin inner attributes are unstable (see issue #54726) --> $DIR/issue-36530.rs:5:5 | -LL | #![foo] //~ ERROR is currently unknown to the compiler +LL | #![foo] | ^^^^^^^ | = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | #![foo] //~ ERROR is currently unknown to the compiler error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/issue-36530.rs:5:8 | -LL | #![foo] //~ ERROR is currently unknown to the compiler +LL | #![foo] | ^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/span/issue-37767.stderr b/src/test/ui/span/issue-37767.stderr index f91f2a50e859..0bbff45436c2 100644 --- a/src/test/ui/span/issue-37767.stderr +++ b/src/test/ui/span/issue-37767.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/issue-37767.rs:10:7 | -LL | a.foo() //~ ERROR multiple applicable items +LL | a.foo() | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `A` @@ -20,7 +20,7 @@ LL | fn foo(&mut self) {} error[E0034]: multiple applicable items in scope --> $DIR/issue-37767.rs:22:7 | -LL | a.foo() //~ ERROR multiple applicable items +LL | a.foo() | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `C` @@ -39,7 +39,7 @@ LL | fn foo(&self) {} error[E0034]: multiple applicable items in scope --> $DIR/issue-37767.rs:34:7 | -LL | a.foo() //~ ERROR multiple applicable items +LL | a.foo() | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `E` diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.stderr b/src/test/ui/span/issue-42234-unknown-receiver-type.stderr index 1899a4e55d5a..8923de5705b1 100644 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.stderr +++ b/src/test/ui/span/issue-42234-unknown-receiver-type.stderr @@ -11,7 +11,7 @@ LL | x.unwrap().method_that_could_exist_on_some_type(); error[E0282]: type annotations needed --> $DIR/issue-42234-unknown-receiver-type.rs:12:5 | -LL | / data.iter() //~ ERROR type annotations needed +LL | / data.iter() LL | | .sum::<_>() | |___________________^ cannot infer type | diff --git a/src/test/ui/span/issue28498-reject-ex1.stderr b/src/test/ui/span/issue28498-reject-ex1.stderr index 8daef82f8bbd..1438b95d7334 100644 --- a/src/test/ui/span/issue28498-reject-ex1.stderr +++ b/src/test/ui/span/issue28498-reject-ex1.stderr @@ -14,7 +14,7 @@ error[E0597]: `foo.data` does not live long enough | LL | foo.data[1].1.set(Some(&foo.data[0])); | ^^^^^^^^ borrowed value does not live long enough -LL | //~^ ERROR `foo.data` does not live long enough +LL | LL | } | - `foo.data` dropped here while still borrowed | diff --git a/src/test/ui/span/lint-unused-unsafe.stderr b/src/test/ui/span/lint-unused-unsafe.stderr index 7f16cfae859e..ac8107990c2b 100644 --- a/src/test/ui/span/lint-unused-unsafe.stderr +++ b/src/test/ui/span/lint-unused-unsafe.stderr @@ -1,7 +1,7 @@ error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:16:13 | -LL | fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block +LL | fn bad1() { unsafe {} } | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unused_unsafe)] error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:17:13 | -LL | fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block +LL | fn bad2() { unsafe { bad1() } } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:18:20 | -LL | unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block +LL | unsafe fn bad3() { unsafe {} } | ---------------- ^^^^^^ unnecessary `unsafe` block | | | because it's nested under this `unsafe` fn @@ -27,13 +27,13 @@ LL | unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` bl error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:19:13 | -LL | fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block +LL | fn bad4() { unsafe { callback(||{}) } } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:20:20 | -LL | unsafe fn bad5() { unsafe { unsf() } } //~ ERROR: unnecessary `unsafe` block +LL | unsafe fn bad5() { unsafe { unsf() } } | ---------------- ^^^^^^ unnecessary `unsafe` block | | | because it's nested under this `unsafe` fn @@ -43,7 +43,7 @@ error: unnecessary `unsafe` block | LL | unsafe { // don't put the warning here | ------ because it's nested under this `unsafe` block -LL | unsafe { //~ ERROR: unnecessary `unsafe` block +LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block @@ -51,7 +51,7 @@ error: unnecessary `unsafe` block | LL | unsafe fn bad7() { | ---------------- because it's nested under this `unsafe` fn -LL | unsafe { //~ ERROR: unnecessary `unsafe` block +LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block @@ -59,8 +59,8 @@ error: unnecessary `unsafe` block | LL | unsafe fn bad7() { | ---------------- because it's nested under this `unsafe` fn -LL | unsafe { //~ ERROR: unnecessary `unsafe` block -LL | unsafe { //~ ERROR: unnecessary `unsafe` block +LL | unsafe { +LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: aborting due to 8 previous errors diff --git a/src/test/ui/span/macro-span-replacement.stderr b/src/test/ui/span/macro-span-replacement.stderr index f6c303164bfd..128e4ec1212c 100644 --- a/src/test/ui/span/macro-span-replacement.stderr +++ b/src/test/ui/span/macro-span-replacement.stderr @@ -1,7 +1,7 @@ warning: struct is never constructed: `S` --> $DIR/macro-span-replacement.rs:7:14 | -LL | $b $a; //~ WARN struct is never constructed +LL | $b $a; | ^ ... LL | m!(S struct); diff --git a/src/test/ui/span/macro-ty-params.stderr b/src/test/ui/span/macro-ty-params.stderr index 965ca7000be8..39b3edc67033 100644 --- a/src/test/ui/span/macro-ty-params.stderr +++ b/src/test/ui/span/macro-ty-params.stderr @@ -1,25 +1,25 @@ error: generic arguments in macro path --> $DIR/macro-ty-params.rs:10:10 | -LL | foo::!(); //~ ERROR generic arguments in macro path +LL | foo::!(); | ^^^ error: generic arguments in macro path --> $DIR/macro-ty-params.rs:11:10 | -LL | foo::<>!(); //~ ERROR generic arguments in macro path +LL | foo::<>!(); | ^^ error: unexpected generic arguments in path --> $DIR/macro-ty-params.rs:12:8 | -LL | m!(Default<>); //~ ERROR generic arguments in macro path +LL | m!(Default<>); | ^^^^^^^^^ error: generic arguments in macro path --> $DIR/macro-ty-params.rs:12:15 | -LL | m!(Default<>); //~ ERROR generic arguments in macro path +LL | m!(Default<>); | ^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/span/missing-unit-argument.stderr b/src/test/ui/span/missing-unit-argument.stderr index bf19eb694618..f1a29bed32b1 100644 --- a/src/test/ui/span/missing-unit-argument.stderr +++ b/src/test/ui/span/missing-unit-argument.stderr @@ -1,11 +1,11 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied --> $DIR/missing-unit-argument.rs:11:33 | -LL | let _: Result<(), String> = Ok(); //~ ERROR this function takes +LL | let _: Result<(), String> = Ok(); | ^^^^ help: expected the unit value `()`; create it with empty parentheses | -LL | let _: Result<(), String> = Ok(()); //~ ERROR this function takes +LL | let _: Result<(), String> = Ok(()); | ^^ error[E0061]: this function takes 2 parameters but 0 parameters were supplied @@ -14,7 +14,7 @@ error[E0061]: this function takes 2 parameters but 0 parameters were supplied LL | fn foo(():(), ():()) {} | -------------------- defined here ... -LL | foo(); //~ ERROR this function takes +LL | foo(); | ^^^^^ expected 2 parameters error[E0061]: this function takes 2 parameters but 1 parameter was supplied @@ -23,7 +23,7 @@ error[E0061]: this function takes 2 parameters but 1 parameter was supplied LL | fn foo(():(), ():()) {} | -------------------- defined here ... -LL | foo(()); //~ ERROR this function takes +LL | foo(()); | ^^^^^^^ expected 2 parameters error[E0061]: this function takes 1 parameter but 0 parameters were supplied @@ -32,11 +32,11 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied LL | fn bar(():()) {} | ------------- defined here ... -LL | bar(); //~ ERROR this function takes +LL | bar(); | ^^^^^ help: expected the unit value `()`; create it with empty parentheses | -LL | bar(()); //~ ERROR this function takes +LL | bar(()); | ^^ error[E0061]: this function takes 1 parameter but 0 parameters were supplied @@ -45,11 +45,11 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied LL | fn baz(self, (): ()) { } | -------------------- defined here ... -LL | S.baz(); //~ ERROR this function takes +LL | S.baz(); | ^^^ help: expected the unit value `()`; create it with empty parentheses | -LL | S.baz(()); //~ ERROR this function takes +LL | S.baz(()); | ^^ error[E0061]: this function takes 1 parameter but 0 parameters were supplied @@ -58,11 +58,11 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied LL | fn generic(self, _: T) { } | ------------------------- defined here ... -LL | S.generic::<()>(); //~ ERROR this function takes +LL | S.generic::<()>(); | ^^^^^^^ help: expected the unit value `()`; create it with empty parentheses | -LL | S.generic::<()>(()); //~ ERROR this function takes +LL | S.generic::<()>(()); | ^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/span/move-closure.stderr b/src/test/ui/span/move-closure.stderr index f09e052f6530..e2226b197aeb 100644 --- a/src/test/ui/span/move-closure.stderr +++ b/src/test/ui/span/move-closure.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/move-closure.rs:5:17 | -LL | let x: () = move || (); //~ ERROR mismatched types +LL | let x: () = move || (); | ^^^^^^^^^^ expected (), found closure | = note: expected type `()` diff --git a/src/test/ui/span/multiline-span-E0072.stderr b/src/test/ui/span/multiline-span-E0072.stderr index ee392f5994c8..dd322fe833b4 100644 --- a/src/test/ui/span/multiline-span-E0072.stderr +++ b/src/test/ui/span/multiline-span-E0072.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `ListNode` has infinite size --> $DIR/multiline-span-E0072.rs:2:1 | -LL | / struct //~ ERROR has infinite size +LL | / struct LL | | ListNode LL | | { LL | | head: u8, diff --git a/src/test/ui/span/multiline-span-simple.stderr b/src/test/ui/span/multiline-span-simple.stderr index 18b6cd06afbb..6495d9bc7397 100644 --- a/src/test/ui/span/multiline-span-simple.stderr +++ b/src/test/ui/span/multiline-span-simple.stderr @@ -1,7 +1,7 @@ error[E0277]: cannot add `()` to `u32` --> $DIR/multiline-span-simple.rs:13:18 | -LL | foo(1 as u32 + //~ ERROR cannot add `()` to `u32` +LL | foo(1 as u32 + | ^ no implementation for `u32 + ()` | = help: the trait `std::ops::Add<()>` is not implemented for `u32` diff --git a/src/test/ui/span/mut-arg-hint.stderr b/src/test/ui/span/mut-arg-hint.stderr index ea6fc8bee637..ce5786186ea5 100644 --- a/src/test/ui/span/mut-arg-hint.stderr +++ b/src/test/ui/span/mut-arg-hint.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable borrowed content `*a` as mutable | LL | fn foo(mut a: &String) { | ------- use `&mut String` here to make mutable -LL | a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("bar"); | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content `*a` as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow immutable borrowed content `*a` as mutable | LL | pub fn foo<'a>(mut a: &'a String) { | ---------- use `&'a mut String` here to make mutable -LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("foo"); | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content `*a` as mutable @@ -19,7 +19,7 @@ error[E0596]: cannot borrow immutable borrowed content `*a` as mutable | LL | pub fn foo(mut a: &String) { | ------- use `&mut String` here to make mutable -LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("foo"); | ^ cannot borrow as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/span/non-existing-module-import.stderr b/src/test/ui/span/non-existing-module-import.stderr index 5ac5df1b4c73..25c09959047a 100644 --- a/src/test/ui/span/non-existing-module-import.stderr +++ b/src/test/ui/span/non-existing-module-import.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `std::bar` --> $DIR/non-existing-module-import.rs:1:10 | -LL | use std::bar::{foo1, foo2}; //~ ERROR unresolved import +LL | use std::bar::{foo1, foo2}; | ^^^ could not find `bar` in `std` error: aborting due to previous error diff --git a/src/test/ui/span/pub-struct-field.stderr b/src/test/ui/span/pub-struct-field.stderr index 66afbf253c9b..065340f446a7 100644 --- a/src/test/ui/span/pub-struct-field.stderr +++ b/src/test/ui/span/pub-struct-field.stderr @@ -3,7 +3,7 @@ error[E0124]: field `bar` is already declared | LL | bar: u8, | ------- `bar` first declared here -LL | pub bar: u8, //~ ERROR is already declared +LL | pub bar: u8, | ^^^^^^^^^^^ field already declared error[E0124]: field `bar` is already declared @@ -11,8 +11,8 @@ error[E0124]: field `bar` is already declared | LL | bar: u8, | ------- `bar` first declared here -LL | pub bar: u8, //~ ERROR is already declared -LL | pub(crate) bar: u8, //~ ERROR is already declared +LL | pub bar: u8, +LL | pub(crate) bar: u8, | ^^^^^^^^^^^^^^^^^^ field already declared error: aborting due to 2 previous errors diff --git a/src/test/ui/span/recursive-type-field.stderr b/src/test/ui/span/recursive-type-field.stderr index 3a8f0e60038e..d240872647e5 100644 --- a/src/test/ui/span/recursive-type-field.stderr +++ b/src/test/ui/span/recursive-type-field.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `Foo` has infinite size --> $DIR/recursive-type-field.rs:3:1 | -LL | struct Foo<'a> { //~ ERROR recursive type +LL | struct Foo<'a> { | ^^^^^^^^^^^^^^ recursive type has infinite size LL | bar: Bar<'a>, | ------------ recursive without indirection @@ -11,7 +11,7 @@ LL | bar: Bar<'a>, error[E0072]: recursive type `Bar` has infinite size --> $DIR/recursive-type-field.rs:8:1 | -LL | struct Bar<'a> { //~ ERROR recursive type +LL | struct Bar<'a> { | ^^^^^^^^^^^^^^ recursive type has infinite size LL | y: (Foo<'a>, Foo<'a>), | --------------------- recursive without indirection diff --git a/src/test/ui/span/regions-escape-loop-via-variable.stderr b/src/test/ui/span/regions-escape-loop-via-variable.stderr index e3870db0c668..ef36b81f4936 100644 --- a/src/test/ui/span/regions-escape-loop-via-variable.stderr +++ b/src/test/ui/span/regions-escape-loop-via-variable.stderr @@ -5,7 +5,7 @@ LL | p = &x; | ^ borrowed value does not live long enough LL | } | - `x` dropped here while still borrowed -LL | //~^^ ERROR `x` does not live long enough +LL | LL | } | - borrowed value needs to live until here diff --git a/src/test/ui/span/regions-escape-loop-via-vec.stderr b/src/test/ui/span/regions-escape-loop-via-vec.stderr index 09a7123d8f04..1d604b58d7e7 100644 --- a/src/test/ui/span/regions-escape-loop-via-vec.stderr +++ b/src/test/ui/span/regions-escape-loop-via-vec.stderr @@ -14,7 +14,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let mut _y = vec![&mut x]; | - borrow of `x` occurs here -LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed +LL | while x < 10 { | ^ use of borrowed `x` error[E0503]: cannot use `x` because it was mutably borrowed @@ -22,8 +22,8 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let mut _y = vec![&mut x]; | - borrow of `x` occurs here -LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed -LL | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed +LL | while x < 10 { +LL | let mut z = x; | ^^^^^ use of borrowed `x` error[E0506]: cannot assign to `x` because it is borrowed @@ -32,7 +32,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let mut _y = vec![&mut x]; | - borrow of `x` occurs here ... -LL | x += 1; //~ ERROR cannot assign +LL | x += 1; | ^^^^^^ assignment to borrowed `x` occurs here error: aborting due to 4 previous errors diff --git a/src/test/ui/span/send-is-not-static-std-sync.stderr b/src/test/ui/span/send-is-not-static-std-sync.stderr index 74c2bad24dea..aa9e1c2de221 100644 --- a/src/test/ui/span/send-is-not-static-std-sync.stderr +++ b/src/test/ui/span/send-is-not-static-std-sync.stderr @@ -14,7 +14,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | *lock.lock().unwrap() = &*y; | -- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here error[E0597]: `z` does not live long enough @@ -33,7 +33,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | *lock.write().unwrap() = &*y; | -- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here error[E0597]: `z` does not live long enough @@ -52,7 +52,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | tx.send(&*y); | -- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here error: aborting due to 6 previous errors diff --git a/src/test/ui/span/suggestion-non-ascii.stderr b/src/test/ui/span/suggestion-non-ascii.stderr index 40b11695d752..b14632d4e1bd 100644 --- a/src/test/ui/span/suggestion-non-ascii.stderr +++ b/src/test/ui/span/suggestion-non-ascii.stderr @@ -1,7 +1,7 @@ error[E0608]: cannot index into a value of type `({integer},)` --> $DIR/suggestion-non-ascii.rs:3:21 | -LL | println!("☃{}", tup[0]); //~ ERROR cannot index into a value of type +LL | println!("☃{}", tup[0]); | ^^^^^^ help: to access tuple elements, use: `tup.0` error: aborting due to previous error diff --git a/src/test/ui/span/typo-suggestion.stderr b/src/test/ui/span/typo-suggestion.stderr index 7b12c4430ed4..61d4e06119c4 100644 --- a/src/test/ui/span/typo-suggestion.stderr +++ b/src/test/ui/span/typo-suggestion.stderr @@ -1,13 +1,13 @@ error[E0425]: cannot find value `bar` in this scope --> $DIR/typo-suggestion.rs:5:26 | -LL | println!("Hello {}", bar); //~ ERROR cannot find value +LL | println!("Hello {}", bar); | ^^^ not found in this scope error[E0425]: cannot find value `fob` in this scope --> $DIR/typo-suggestion.rs:8:26 | -LL | println!("Hello {}", fob); //~ ERROR cannot find value +LL | println!("Hello {}", fob); | ^^^ help: a local variable with a similar name exists: `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/span/unused-warning-point-at-signature.stderr b/src/test/ui/span/unused-warning-point-at-signature.stderr index e07548121b52..3007d90c9900 100644 --- a/src/test/ui/span/unused-warning-point-at-signature.stderr +++ b/src/test/ui/span/unused-warning-point-at-signature.stderr @@ -1,7 +1,7 @@ warning: enum is never used: `Enum` --> $DIR/unused-warning-point-at-signature.rs:5:1 | -LL | enum Enum { //~ WARN enum is never used +LL | enum Enum { | ^^^^^^^^^ | note: lint level defined here @@ -14,19 +14,19 @@ LL | #![warn(unused)] warning: struct is never constructed: `Struct` --> $DIR/unused-warning-point-at-signature.rs:12:1 | -LL | struct Struct { //~ WARN struct is never constructed +LL | struct Struct { | ^^^^^^^^^^^^^ warning: function is never used: `func` --> $DIR/unused-warning-point-at-signature.rs:19:1 | -LL | fn func() -> usize { //~ WARN function is never used +LL | fn func() -> usize { | ^^^^^^^^^^^^^^^^^^ warning: function is never used: `func_complete_span` --> $DIR/unused-warning-point-at-signature.rs:23:1 | -LL | / fn //~ WARN function is never used +LL | / fn LL | | func_complete_span() LL | | -> usize LL | | { diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr b/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr index 1eee88ad21af..b957243018de 100644 --- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr +++ b/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr @@ -14,7 +14,7 @@ error[E0597]: `c1` does not live long enough | LL | c2.v[0].v.set(Some(&c1)); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `c1` does not live long enough +LL | LL | } | - `c1` dropped here while still borrowed | diff --git a/src/test/ui/span/visibility-ty-params.stderr b/src/test/ui/span/visibility-ty-params.stderr index d7914528f468..ddc13bb1c76a 100644 --- a/src/test/ui/span/visibility-ty-params.stderr +++ b/src/test/ui/span/visibility-ty-params.stderr @@ -1,19 +1,19 @@ error: unexpected generic arguments in path --> $DIR/visibility-ty-params.rs:6:5 | -LL | m!{ S } //~ ERROR unexpected generic arguments in path +LL | m!{ S } | ^^^^^ error: unexpected generic arguments in path --> $DIR/visibility-ty-params.rs:10:9 | -LL | m!{ m<> } //~ ERROR unexpected generic arguments in path +LL | m!{ m<> } | ^^^ error[E0577]: expected module, found struct `S` --> $DIR/visibility-ty-params.rs:6:5 | -LL | m!{ S } //~ ERROR unexpected generic arguments in path +LL | m!{ S } | -^^^^ | | | help: a module with a similar name exists: `m` diff --git a/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr b/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr index 3b3076cc6723..0b20a19d2e1c 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr @@ -1,7 +1,7 @@ error[E0658]: specialization is unstable (see issue #31844) --> $DIR/specialization-feature-gate-default.rs:7:1 | -LL | / default impl Foo for T { //~ ERROR specialization is unstable +LL | / default impl Foo for T { LL | | fn foo(&self) {} LL | | } | |_^ diff --git a/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr b/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr index 7ca9df9f5d93..91690f64d948 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr @@ -7,7 +7,7 @@ LL | | fn bar(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn foo(&self) {} //~ ERROR E0520 +LL | fn foo(&self) {} | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo` | = note: to specialize, `foo` in the parent `impl` must be marked `default` @@ -21,7 +21,7 @@ LL | | fn bar(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn bar(&self) {} //~ ERROR E0520 +LL | fn bar(&self) {} | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar` | = note: to specialize, `bar` in the parent `impl` must be marked `default` @@ -34,7 +34,7 @@ LL | | type T = u8; LL | | } | |_- parent `impl` is here ... -LL | type T = (); //~ ERROR E0520 +LL | type T = (); | ^^^^^^^^^^^^ cannot specialize default item `T` | = note: to specialize, `T` in the parent `impl` must be marked `default` @@ -47,7 +47,7 @@ LL | | fn baz(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn baz(&self) {} //~ ERROR E0520 +LL | fn baz(&self) {} | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz` | = note: to specialize, `baz` in the parent `impl` must be marked `default` @@ -60,7 +60,7 @@ LL | | fn redundant(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn redundant(&self) {} //~ ERROR E0520 +LL | fn redundant(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` | = note: to specialize, `redundant` in the parent `impl` must be marked `default` diff --git a/src/test/ui/specialization/defaultimpl/validation.stderr b/src/test/ui/specialization/defaultimpl/validation.stderr index 2778cac7ae57..14a06c39088d 100644 --- a/src/test/ui/specialization/defaultimpl/validation.stderr +++ b/src/test/ui/specialization/defaultimpl/validation.stderr @@ -1,7 +1,7 @@ error: inherent impls cannot be default --> $DIR/validation.rs:7:1 | -LL | default impl S {} //~ ERROR inherent impls cannot be default +LL | default impl S {} | ^^^^^^^^^^^^^^^^^ | = note: only trait implementations may be annotated with default @@ -9,19 +9,19 @@ LL | default impl S {} //~ ERROR inherent impls cannot be default error: impls of auto traits cannot be default --> $DIR/validation.rs:9:1 | -LL | default unsafe impl Send for S {} //~ ERROR impls of auto traits cannot be default +LL | default unsafe impl Send for S {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: impls of auto traits cannot be default --> $DIR/validation.rs:10:1 | -LL | default impl !Send for Z {} //~ ERROR impls of auto traits cannot be default +LL | default impl !Send for Z {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) --> $DIR/validation.rs:13:1 | -LL | default impl !Tr for S {} //~ ERROR negative impls are only allowed for auto traits +LL | default impl !Tr for S {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/specialization/issue-39448.stderr b/src/test/ui/specialization/issue-39448.stderr index 0b0fd2c4af59..861a1d9e8fc6 100644 --- a/src/test/ui/specialization/issue-39448.stderr +++ b/src/test/ui/specialization/issue-39448.stderr @@ -1,7 +1,7 @@ error[E0275]: overflow evaluating the requirement `T: FromA` --> $DIR/issue-39448.rs:45:13 | -LL | x.foo(y.to()).to() //~ ERROR overflow evaluating the requirement +LL | x.foo(y.to()).to() | ^^ | = note: required because of the requirements on the impl of `FromA` for `T` diff --git a/src/test/ui/specialization/issue-52050.stderr b/src/test/ui/specialization/issue-52050.stderr index 9187d04cfce6..dcb34f3ad483 100644 --- a/src/test/ui/specialization/issue-52050.stderr +++ b/src/test/ui/specialization/issue-52050.stderr @@ -8,7 +8,7 @@ LL | | { LL | | } | |_- first implementation here LL | -LL | impl IntoPyDictPointer for () //~ ERROR conflicting implementations +LL | impl IntoPyDictPointer for () | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` | = note: upstream crates may add new impl of trait `std::iter::Iterator` for type `()` in future versions diff --git a/src/test/ui/specialization/specialization-default-projection.stderr b/src/test/ui/specialization/specialization-default-projection.stderr index b781c35ea391..ab0bdc44cff1 100644 --- a/src/test/ui/specialization/specialization-default-projection.stderr +++ b/src/test/ui/specialization/specialization-default-projection.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn generic() -> ::Assoc { | ----------------- expected `::Assoc` because of return type ... -LL | () //~ ERROR mismatched types +LL | () | ^^ expected associated type, found () | = note: expected type `::Assoc` @@ -16,7 +16,7 @@ error[E0308]: mismatched types LL | fn monomorphic() -> () { | -- expected `()` because of return type ... -LL | generic::<()>() //~ ERROR mismatched types +LL | generic::<()>() | ^^^^^^^^^^^^^^^- help: try adding a semicolon: `;` | | | expected (), found associated type diff --git a/src/test/ui/specialization/specialization-default-types.stderr b/src/test/ui/specialization/specialization-default-types.stderr index 3b4ae2d82177..1192b0e5cfa5 100644 --- a/src/test/ui/specialization/specialization-default-types.stderr +++ b/src/test/ui/specialization/specialization-default-types.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | default fn generate(self) -> Self::Output { | ------------ expected `::Output` because of return type -LL | Box::new(self) //~ ERROR mismatched types +LL | Box::new(self) | ^^^^^^^^^^^^^^ expected associated type, found struct `std::boxed::Box` | = note: expected type `::Output` @@ -14,7 +14,7 @@ error[E0308]: mismatched types | LL | fn trouble(t: T) -> Box { | ------ expected `std::boxed::Box` because of return type -LL | Example::generate(t) //~ ERROR mismatched types +LL | Example::generate(t) | ^^^^^^^^^^^^^^^^^^^^ expected struct `std::boxed::Box`, found associated type | = note: expected type `std::boxed::Box` diff --git a/src/test/ui/specialization/specialization-feature-gate-default.stderr b/src/test/ui/specialization/specialization-feature-gate-default.stderr index 13d656bd060e..ad33908eff63 100644 --- a/src/test/ui/specialization/specialization-feature-gate-default.stderr +++ b/src/test/ui/specialization/specialization-feature-gate-default.stderr @@ -1,7 +1,7 @@ error[E0658]: specialization is unstable (see issue #31844) --> $DIR/specialization-feature-gate-default.rs:10:5 | -LL | default fn foo(&self) {} //~ ERROR specialization is unstable +LL | default fn foo(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(specialization)] to the crate attributes to enable diff --git a/src/test/ui/specialization/specialization-feature-gate-overlap.stderr b/src/test/ui/specialization/specialization-feature-gate-overlap.stderr index d6714375d16e..baaf7aa43321 100644 --- a/src/test/ui/specialization/specialization-feature-gate-overlap.stderr +++ b/src/test/ui/specialization/specialization-feature-gate-overlap.stderr @@ -4,7 +4,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `u8`: LL | impl Foo for T { | ----------------- first implementation here ... -LL | impl Foo for u8 { //~ ERROR E0119 +LL | impl Foo for u8 { | ^^^^^^^^^^^^^^^ conflicting implementation for `u8` error: aborting due to previous error diff --git a/src/test/ui/specialization/specialization-no-default.stderr b/src/test/ui/specialization/specialization-no-default.stderr index c57f98ac74de..c39986de38dc 100644 --- a/src/test/ui/specialization/specialization-no-default.stderr +++ b/src/test/ui/specialization/specialization-no-default.stderr @@ -7,7 +7,7 @@ LL | | fn bar(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn foo(&self) {} //~ ERROR E0520 +LL | fn foo(&self) {} | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo` | = note: to specialize, `foo` in the parent `impl` must be marked `default` @@ -21,7 +21,7 @@ LL | | fn bar(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn bar(&self) {} //~ ERROR E0520 +LL | fn bar(&self) {} | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar` | = note: to specialize, `bar` in the parent `impl` must be marked `default` @@ -34,7 +34,7 @@ LL | | type T = u8; LL | | } | |_- parent `impl` is here ... -LL | type T = (); //~ ERROR E0520 +LL | type T = (); | ^^^^^^^^^^^^ cannot specialize default item `T` | = note: to specialize, `T` in the parent `impl` must be marked `default` @@ -47,7 +47,7 @@ LL | | fn baz(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn baz(&self) {} //~ ERROR E0520 +LL | fn baz(&self) {} | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz` | = note: to specialize, `baz` in the parent `impl` must be marked `default` @@ -60,7 +60,7 @@ LL | | fn redundant(&self) {} LL | | } | |_- parent `impl` is here ... -LL | default fn redundant(&self) {} //~ ERROR E0520 +LL | default fn redundant(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` | = note: to specialize, `redundant` in the parent `impl` must be marked `default` diff --git a/src/test/ui/specialization/specialization-overlap-negative.stderr b/src/test/ui/specialization/specialization-overlap-negative.stderr index b9ab1bd637cc..947aad824ea8 100644 --- a/src/test/ui/specialization/specialization-overlap-negative.stderr +++ b/src/test/ui/specialization/specialization-overlap-negative.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Send` for type | LL | unsafe impl Send for TestType {} | ------------------------------------------ first implementation here -LL | impl !Send for TestType {} //~ ERROR E0119 +LL | impl !Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` error: aborting due to previous error diff --git a/src/test/ui/specialization/specialization-overlap.stderr b/src/test/ui/specialization/specialization-overlap.stderr index eef8cb44b888..4275e7bdd85e 100644 --- a/src/test/ui/specialization/specialization-overlap.stderr +++ b/src/test/ui/specialization/specialization-overlap.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `std::vec::Vec | LL | impl Foo for T {} | ------------------------ first implementation here -LL | impl Foo for Vec {} //~ ERROR E0119 +LL | impl Foo for Vec {} | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::vec::Vec<_>` error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`: @@ -11,7 +11,7 @@ error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`: | LL | impl Bar for (T, u8) {} | ----------------------- first implementation here -LL | impl Bar for (u8, T) {} //~ ERROR E0119 +LL | impl Bar for (u8, T) {} | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(u8, u8)` error[E0119]: conflicting implementations of trait `Baz` for type `u8`: @@ -19,7 +19,7 @@ error[E0119]: conflicting implementations of trait `Baz` for type `u8`: | LL | impl Baz for u8 {} | --------------------- first implementation here -LL | impl Baz for T {} //~ ERROR E0119 +LL | impl Baz for T {} | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8` error[E0119]: conflicting implementations of trait `Qux`: @@ -27,7 +27,7 @@ error[E0119]: conflicting implementations of trait `Qux`: | LL | impl Qux for T {} | ------------------------ first implementation here -LL | impl Qux for T {} //~ ERROR E0119 +LL | impl Qux for T {} | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error: aborting due to 4 previous errors diff --git a/src/test/ui/specialization/specialization-polarity.stderr b/src/test/ui/specialization/specialization-polarity.stderr index d1f48b78864c..bc1b2aeb70fc 100644 --- a/src/test/ui/specialization/specialization-polarity.stderr +++ b/src/test/ui/specialization/specialization-polarity.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `u8`: | LL | impl Foo for T {} | ----------------- first implementation here -LL | impl !Foo for u8 {} //~ ERROR E0119 +LL | impl !Foo for u8 {} | ^^^^^^^^^^^^^^^^ conflicting implementation for `u8` error[E0119]: conflicting implementations of trait `Bar` for type `u8`: @@ -11,7 +11,7 @@ error[E0119]: conflicting implementations of trait `Bar` for type `u8`: | LL | impl !Bar for T {} | ------------------ first implementation here -LL | impl Bar for u8 {} //~ ERROR E0119 +LL | impl Bar for u8 {} | ^^^^^^^^^^^^^^^ conflicting implementation for `u8` error: aborting due to 2 previous errors diff --git a/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.stderr b/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.stderr index f67479769455..b6c9564e904c 100644 --- a/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.stderr +++ b/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.stderr @@ -2,7 +2,7 @@ error: crate has missing stability attribute --> $DIR/missing-stability-attr-at-top-level.rs:1:1 | LL | / #![feature(staged_api)] -LL | | //~^ ERROR crate has missing stability attribute +LL | | LL | | LL | | fn main() {} | |____________^ diff --git a/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr b/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr index 7ffb4bb487a7..280c72acccb1 100644 --- a/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr @@ -1,7 +1,7 @@ error: field has missing stability attribute --> $DIR/stability-attribute-issue-43027.rs:5:23 | -LL | pub struct Reverse(pub T); //~ ERROR field has missing stability attribute +LL | pub struct Reverse(pub T); | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr index cd8ea921d303..77f896a86d58 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr @@ -1,19 +1,19 @@ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged-force-unstable.rs:3:1 | -LL | #[unstable()] //~ ERROR: stability attributes may not be used +LL | #[unstable()] | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged-force-unstable.rs:4:1 | -LL | #[stable()] //~ ERROR: stability attributes may not be used +LL | #[stable()] | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged-force-unstable.rs:5:1 | -LL | #[rustc_deprecated()] //~ ERROR: stability attributes may not be used +LL | #[rustc_deprecated()] | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr index 67f6ef857f17..e98f789f54c7 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr @@ -1,19 +1,19 @@ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged.rs:1:1 | -LL | #[unstable()] //~ ERROR: stability attributes may not be used +LL | #[unstable()] | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged.rs:2:1 | -LL | #[stable()] //~ ERROR: stability attributes may not be used +LL | #[stable()] | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged.rs:3:1 | -LL | #[rustc_deprecated()] //~ ERROR: stability attributes may not be used +LL | #[rustc_deprecated()] | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr index 6f5c844a6571..2bc544d107da 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr @@ -1,19 +1,19 @@ error[E0538]: multiple 'feature' items --> $DIR/stability-attribute-sanity-2.rs:7:25 | -LL | #[stable(feature = "a", feature = "b", since = "1.0.0")] //~ ERROR multiple 'feature' items +LL | #[stable(feature = "a", feature = "b", since = "1.0.0")] | ^^^^^^^^^^^^^ error[E0541]: unknown meta item 'sinse' --> $DIR/stability-attribute-sanity-2.rs:10:25 | -LL | #[stable(feature = "a", sinse = "1.0.0")] //~ ERROR unknown meta item 'sinse' +LL | #[stable(feature = "a", sinse = "1.0.0")] | ^^^^^^^^^^^^^^^ expected one of `since`, `note` error[E0545]: incorrect 'issue' --> $DIR/stability-attribute-sanity-2.rs:13:1 | -LL | #[unstable(feature = "a", issue = "no")] //~ ERROR incorrect 'issue' +LL | #[unstable(feature = "a", issue = "no")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr index 1c759d49b994..b1c56ef224ae 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr @@ -1,7 +1,7 @@ error: macro has missing stability attribute --> $DIR/stability-attribute-sanity-3.rs:8:1 | -LL | / macro_rules! mac { //~ ERROR macro has missing stability attribute +LL | / macro_rules! mac { LL | | () => () LL | | } | |_^ diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr index 4b4efe9d8cad..d85b628c3c34 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr @@ -1,37 +1,37 @@ error: attribute must be of the form `#[unstable(feature = "name", reason = "...", issue = "N")]` --> $DIR/stability-attribute-sanity-4.rs:8:5 | -LL | #[unstable] //~ ERROR attribute must be of the form +LL | #[unstable] | ^^^^^^^^^^^ error: attribute must be of the form `#[unstable(feature = "name", reason = "...", issue = "N")]` --> $DIR/stability-attribute-sanity-4.rs:11:5 | -LL | #[unstable = "b"] //~ ERROR attribute must be of the form +LL | #[unstable = "b"] | ^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[stable(feature = "name", since = "version")]` --> $DIR/stability-attribute-sanity-4.rs:14:5 | -LL | #[stable] //~ ERROR attribute must be of the form +LL | #[stable] | ^^^^^^^^^ error: attribute must be of the form `#[stable(feature = "name", since = "version")]` --> $DIR/stability-attribute-sanity-4.rs:17:5 | -LL | #[stable = "a"] //~ ERROR attribute must be of the form +LL | #[stable = "a"] | ^^^^^^^^^^^^^^^ error: attribute must be of the form `#[rustc_deprecated(since = "version", reason = "...")]` --> $DIR/stability-attribute-sanity-4.rs:21:5 | -LL | #[rustc_deprecated] //~ ERROR attribute must be of the form +LL | #[rustc_deprecated] | ^^^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[rustc_deprecated(since = "version", reason = "...")]` --> $DIR/stability-attribute-sanity-4.rs:25:5 | -LL | #[rustc_deprecated = "a"] //~ ERROR attribute must be of the form +LL | #[rustc_deprecated = "a"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr index 74c1bbfed6f7..5343e3bd537f 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr @@ -1,97 +1,97 @@ error[E0541]: unknown meta item 'reason' --> $DIR/stability-attribute-sanity.rs:8:42 | -LL | #[stable(feature = "a", since = "b", reason)] //~ ERROR unknown meta item 'reason' [E0541] +LL | #[stable(feature = "a", since = "b", reason)] | ^^^^^^ expected one of `since`, `note` error[E0539]: incorrect meta item --> $DIR/stability-attribute-sanity.rs:11:29 | -LL | #[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539] +LL | #[stable(feature = "a", since)] | ^^^^^ error[E0539]: incorrect meta item --> $DIR/stability-attribute-sanity.rs:14:14 | -LL | #[stable(feature, since = "a")] //~ ERROR incorrect meta item [E0539] +LL | #[stable(feature, since = "a")] | ^^^^^^^ error[E0539]: incorrect meta item --> $DIR/stability-attribute-sanity.rs:17:29 | -LL | #[stable(feature = "a", since(b))] //~ ERROR incorrect meta item [E0539] +LL | #[stable(feature = "a", since(b))] | ^^^^^^^^ error[E0539]: incorrect meta item --> $DIR/stability-attribute-sanity.rs:20:14 | -LL | #[stable(feature(b), since = "a")] //~ ERROR incorrect meta item [E0539] +LL | #[stable(feature(b), since = "a")] | ^^^^^^^^^^ error[E0546]: missing 'feature' --> $DIR/stability-attribute-sanity.rs:25:5 | -LL | #[unstable(issue = "0")] //~ ERROR missing 'feature' [E0546] +LL | #[unstable(issue = "0")] | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0547]: missing 'issue' --> $DIR/stability-attribute-sanity.rs:28:5 | -LL | #[unstable(feature = "b")] //~ ERROR missing 'issue' [E0547] +LL | #[unstable(feature = "b")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0546]: missing 'feature' --> $DIR/stability-attribute-sanity.rs:31:5 | -LL | #[stable(since = "a")] //~ ERROR missing 'feature' [E0546] +LL | #[stable(since = "a")] | ^^^^^^^^^^^^^^^^^^^^^^ error[E0542]: missing 'since' --> $DIR/stability-attribute-sanity.rs:36:5 | -LL | #[stable(feature = "a")] //~ ERROR missing 'since' [E0542] +LL | #[stable(feature = "a")] | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0542]: missing 'since' --> $DIR/stability-attribute-sanity.rs:40:5 | -LL | #[rustc_deprecated(reason = "a")] //~ ERROR missing 'since' [E0542] +LL | #[rustc_deprecated(reason = "a")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0544]: multiple stability levels --> $DIR/stability-attribute-sanity.rs:45:1 | -LL | #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544] +LL | #[stable(feature = "a", since = "b")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0544]: multiple stability levels --> $DIR/stability-attribute-sanity.rs:49:1 | -LL | #[unstable(feature = "b", issue = "0")] //~ ERROR multiple stability levels [E0544] +LL | #[unstable(feature = "b", issue = "0")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0544]: multiple stability levels --> $DIR/stability-attribute-sanity.rs:53:1 | -LL | #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544] +LL | #[stable(feature = "a", since = "b")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0540]: multiple rustc_deprecated attributes --> $DIR/stability-attribute-sanity.rs:61:1 | -LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540] +LL | pub const fn multiple4() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0553]: multiple rustc_const_unstable attributes --> $DIR/stability-attribute-sanity.rs:61:1 | -LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540] +LL | pub const fn multiple4() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Invalid stability or deprecation version found --> $DIR/stability-attribute-sanity.rs:61:1 | -LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540] +LL | pub const fn multiple4() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0549]: rustc_deprecated attribute must be paired with either stable or unstable attribute diff --git a/src/test/ui/static/static-items-cant-move.stderr b/src/test/ui/static/static-items-cant-move.stderr index 1ac772a46018..fc1ed9b8d613 100644 --- a/src/test/ui/static/static-items-cant-move.stderr +++ b/src/test/ui/static/static-items-cant-move.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of static item --> $DIR/static-items-cant-move.rs:18:10 | -LL | test(BAR); //~ ERROR cannot move out of static item +LL | test(BAR); | ^^^ cannot move out of static item error: aborting due to previous error diff --git a/src/test/ui/static/static-lifetime-bound.stderr b/src/test/ui/static/static-lifetime-bound.stderr index dc8e83610d4b..b9aa4d8722bf 100644 --- a/src/test/ui/static/static-lifetime-bound.stderr +++ b/src/test/ui/static/static-lifetime-bound.stderr @@ -1,7 +1,7 @@ warning: unnecessary lifetime parameter `'a` --> $DIR/static-lifetime-bound.rs:1:6 | -LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a` +LL | fn f<'a: 'static>(_: &'a i32) {} | ^^^^^^^^^^^ | = help: you can use the `'static` lifetime directly, in place of `'a` @@ -9,7 +9,7 @@ LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a error[E0597]: `x` does not live long enough --> $DIR/static-lifetime-bound.rs:5:8 | -LL | f(&x); //~ERROR does not live long enough +LL | f(&x); | ^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/static/static-lifetime.stderr b/src/test/ui/static/static-lifetime.stderr index 65c60ceb2e37..8516ac07b6cf 100644 --- a/src/test/ui/static/static-lifetime.stderr +++ b/src/test/ui/static/static-lifetime.stderr @@ -1,13 +1,13 @@ error[E0478]: lifetime bound not satisfied --> $DIR/static-lifetime.rs:3:20 | -LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound +LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} | ^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'a as defined on the impl at 3:6 --> $DIR/static-lifetime.rs:3:6 | -LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound +LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} | ^^ = note: but lifetime parameter must outlive the static lifetime diff --git a/src/test/ui/static/static-method-privacy.stderr b/src/test/ui/static/static-method-privacy.stderr index c72295f97ca1..14ca9f58301e 100644 --- a/src/test/ui/static/static-method-privacy.stderr +++ b/src/test/ui/static/static-method-privacy.stderr @@ -1,7 +1,7 @@ error[E0624]: method `new` is private --> $DIR/static-method-privacy.rs:9:13 | -LL | let _ = a::S::new(); //~ ERROR method `new` is private +LL | let _ = a::S::new(); | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/static/static-mut-bad-types.stderr b/src/test/ui/static/static-mut-bad-types.stderr index e97165705ca7..88d62011fc4e 100644 --- a/src/test/ui/static/static-mut-bad-types.stderr +++ b/src/test/ui/static/static-mut-bad-types.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/static-mut-bad-types.rs:5:13 | -LL | a = true; //~ ERROR: mismatched types +LL | a = true; | ^^^^ expected isize, found bool error: aborting due to previous error diff --git a/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr b/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr index 9964e1d98b11..e7ed0b710b2f 100644 --- a/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr +++ b/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr @@ -1,7 +1,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/static-mut-foreign-requires-unsafe.rs:6:5 | -LL | a += 3; //~ ERROR: requires unsafe +LL | a += 3; | ^^^^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -9,7 +9,7 @@ LL | a += 3; //~ ERROR: requires unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/static-mut-foreign-requires-unsafe.rs:7:5 | -LL | a = 4; //~ ERROR: requires unsafe +LL | a = 4; | ^^^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -17,7 +17,7 @@ LL | a = 4; //~ ERROR: requires unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/static-mut-foreign-requires-unsafe.rs:8:14 | -LL | let _b = a; //~ ERROR: requires unsafe +LL | let _b = a; | ^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior diff --git a/src/test/ui/static/static-mut-not-pat.stderr b/src/test/ui/static/static-mut-not-pat.stderr index 0714df0d11dc..33c1cd6a5950 100644 --- a/src/test/ui/static/static-mut-not-pat.stderr +++ b/src/test/ui/static/static-mut-not-pat.stderr @@ -4,7 +4,7 @@ error[E0530]: match bindings cannot shadow statics LL | static mut a: isize = 3; | ------------------------ the static `a` is defined here ... -LL | a => {} //~ ERROR match bindings cannot shadow statics +LL | a => {} | ^ cannot be named the same as a static error[E0530]: match bindings cannot shadow statics diff --git a/src/test/ui/static/static-mut-requires-unsafe.stderr b/src/test/ui/static/static-mut-requires-unsafe.stderr index 66ee6989b01e..85e468b333c2 100644 --- a/src/test/ui/static/static-mut-requires-unsafe.stderr +++ b/src/test/ui/static/static-mut-requires-unsafe.stderr @@ -1,7 +1,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/static-mut-requires-unsafe.rs:4:5 | -LL | a += 3; //~ ERROR: requires unsafe +LL | a += 3; | ^^^^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -9,7 +9,7 @@ LL | a += 3; //~ ERROR: requires unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/static-mut-requires-unsafe.rs:5:5 | -LL | a = 4; //~ ERROR: requires unsafe +LL | a = 4; | ^^^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -17,7 +17,7 @@ LL | a = 4; //~ ERROR: requires unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/static-mut-requires-unsafe.rs:6:14 | -LL | let _b = a; //~ ERROR: requires unsafe +LL | let _b = a; | ^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior diff --git a/src/test/ui/static/static-reference-to-fn-1.stderr b/src/test/ui/static/static-reference-to-fn-1.stderr index 84cd6db4c4a9..f6d2385ac69a 100644 --- a/src/test/ui/static/static-reference-to-fn-1.stderr +++ b/src/test/ui/static/static-reference-to-fn-1.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/static-reference-to-fn-1.rs:17:15 | -LL | func: &foo, //~ ERROR mismatched types +LL | func: &foo, | ^^^^ expected fn pointer, found fn item | = note: expected type `&fn() -> std::option::Option` diff --git a/src/test/ui/static/static-reference-to-fn-2.stderr b/src/test/ui/static/static-reference-to-fn-2.stderr index d94913c7e222..17d4a3612578 100644 --- a/src/test/ui/static/static-reference-to-fn-2.stderr +++ b/src/test/ui/static/static-reference-to-fn-2.stderr @@ -11,7 +11,7 @@ note: borrowed value must be valid for the anonymous lifetime #2 defined on the | LL | / fn state1(self_: &mut StateMachineIter) -> Option<&'static str> { LL | | self_.statefn = &id(state2 as StateMachineFunc); -LL | | //~^ ERROR borrowed value does not live long enough +LL | | LL | | return Some("state1"); LL | | } | |_^ @@ -30,7 +30,7 @@ note: borrowed value must be valid for the anonymous lifetime #2 defined on the | LL | / fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> { LL | | self_.statefn = &id(state3 as StateMachineFunc); -LL | | //~^ ERROR borrowed value does not live long enough +LL | | LL | | return Some("state2"); LL | | } | |_^ @@ -49,7 +49,7 @@ note: borrowed value must be valid for the anonymous lifetime #2 defined on the | LL | / fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> { LL | | self_.statefn = &id(finished as StateMachineFunc); -LL | | //~^ ERROR borrowed value does not live long enough +LL | | LL | | return Some("state3"); LL | | } | |_^ diff --git a/src/test/ui/static/static-region-bound.stderr b/src/test/ui/static/static-region-bound.stderr index 611f47ddfde7..f6bbfcecf6f1 100644 --- a/src/test/ui/static/static-region-bound.stderr +++ b/src/test/ui/static/static-region-bound.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/static-region-bound.rs:10:14 | -LL | let x = &id(3); //~ ERROR borrowed value does not live long enough +LL | let x = &id(3); | ^^^^^ temporary value does not live long enough LL | f(x); LL | } diff --git a/src/test/ui/std-uncopyable-atomics.stderr b/src/test/ui/std-uncopyable-atomics.stderr index ecf9963c145f..7f01434838c1 100644 --- a/src/test/ui/std-uncopyable-atomics.stderr +++ b/src/test/ui/std-uncopyable-atomics.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:9:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -10,7 +10,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:11:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -19,7 +19,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:13:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -28,7 +28,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:15:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/stmt_expr_attrs_no_feature.stderr b/src/test/ui/stmt_expr_attrs_no_feature.stderr index c4d735915a16..c644126535d3 100644 --- a/src/test/ui/stmt_expr_attrs_no_feature.stderr +++ b/src/test/ui/stmt_expr_attrs_no_feature.stderr @@ -1,7 +1,7 @@ error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:13:5 | -LL | #[attr] //~ ERROR attributes on expressions are experimental +LL | #[attr] | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[attr] //~ ERROR attributes on expressions are experimental error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:94:18 | -LL | fn y(a: [u8; #[attr] 5]); //~ ERROR 15701 +LL | fn y(a: [u8; #[attr] 5]); | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | fn y(a: [u8; #[attr] 5]); //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:101:19 | -LL | const Y: u8 = #[attr] 5; //~ ERROR 15701 +LL | const Y: u8 = #[attr] 5; | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | const Y: u8 = #[attr] 5; //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:107:19 | -LL | const Y: [u8; #[attr] 5]; //~ ERROR 15701 +LL | const Y: [u8; #[attr] 5]; | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | const Y: [u8; #[attr] 5]; //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:113:18 | -LL | field2: [u8; #[attr] 5] //~ ERROR 15701 +LL | field2: [u8; #[attr] 5] | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -41,7 +41,7 @@ LL | field2: [u8; #[attr] 5] //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:118:10 | -LL | [u8; #[attr] 5] //~ ERROR 15701 +LL | [u8; #[attr] 5] | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -49,7 +49,7 @@ LL | [u8; #[attr] 5] //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:124:14 | -LL | [u8; #[attr] 5] //~ ERROR 15701 +LL | [u8; #[attr] 5] | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -57,7 +57,7 @@ LL | [u8; #[attr] 5] //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:129:22 | -LL | field2: [u8; #[attr] 5] //~ ERROR 15701 +LL | field2: [u8; #[attr] 5] | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -65,7 +65,7 @@ LL | field2: [u8; #[attr] 5] //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:137:14 | -LL | 6 => #[attr] (), //~ ERROR 15701 +LL | 6 => #[attr] (), | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable diff --git a/src/test/ui/str/str-as-char.stderr b/src/test/ui/str/str-as-char.stderr index 4ca430a4cde9..162f0888a294 100644 --- a/src/test/ui/str/str-as-char.stderr +++ b/src/test/ui/str/str-as-char.stderr @@ -1,21 +1,21 @@ error: character literal may only contain one codepoint --> $DIR/str-as-char.rs:4:14 | -LL | println!('●●'); //~ ERROR character literal may only contain one codepoint +LL | println!('●●'); | ^^^^ help: if you meant to write a `str` literal, use double quotes | -LL | println!("●●"); //~ ERROR character literal may only contain one codepoint +LL | println!("●●"); | ^^^^ error: format argument must be a string literal --> $DIR/str-as-char.rs:4:14 | -LL | println!('●●'); //~ ERROR character literal may only contain one codepoint +LL | println!('●●'); | ^^^^ help: you might be missing a string literal to format with | -LL | println!("{}", '●●'); //~ ERROR character literal may only contain one codepoint +LL | println!("{}", '●●'); | ^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/str/str-idx.stderr b/src/test/ui/str/str-idx.stderr index 99df85d92fd9..e388534f132d 100644 --- a/src/test/ui/str/str-idx.stderr +++ b/src/test/ui/str/str-idx.stderr @@ -1,7 +1,7 @@ error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:3:17 | -LL | let _: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}` +LL | let _: u8 = s[4]; | ^^^^ string indices are ranges of `usize` | = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` @@ -12,7 +12,7 @@ LL | let _: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integ error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:4:15 | -LL | let _ = s.get(4); //~ ERROR the type `str` cannot be indexed by `{integer}` +LL | let _ = s.get(4); | ^^^ string indices are ranges of `usize` | = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` @@ -22,7 +22,7 @@ LL | let _ = s.get(4); //~ ERROR the type `str` cannot be indexed by `{integ error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:5:15 | -LL | let _ = s.get_unchecked(4); //~ ERROR the type `str` cannot be indexed by `{integer}` +LL | let _ = s.get_unchecked(4); | ^^^^^^^^^^^^^ string indices are ranges of `usize` | = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` @@ -32,7 +32,7 @@ LL | let _ = s.get_unchecked(4); //~ ERROR the type `str` cannot be indexed error[E0277]: the type `str` cannot be indexed by `char` --> $DIR/str-idx.rs:6:17 | -LL | let _: u8 = s['c']; //~ ERROR the type `str` cannot be indexed by `char` +LL | let _: u8 = s['c']; | ^^^^^^ string indices are ranges of `usize` | = help: the trait `std::slice::SliceIndex` is not implemented for `char` diff --git a/src/test/ui/str/str-lit-type-mismatch.stderr b/src/test/ui/str/str-lit-type-mismatch.stderr index c14e9090fef9..ef40faa8e26e 100644 --- a/src/test/ui/str/str-lit-type-mismatch.stderr +++ b/src/test/ui/str/str-lit-type-mismatch.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:2:20 | -LL | let x: &[u8] = "foo"; //~ ERROR mismatched types +LL | let x: &[u8] = "foo"; | ^^^^^ | | | expected slice, found str @@ -13,7 +13,7 @@ LL | let x: &[u8] = "foo"; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:3:23 | -LL | let y: &[u8; 4] = "baaa"; //~ ERROR mismatched types +LL | let y: &[u8; 4] = "baaa"; | ^^^^^^ | | | expected array of 4 elements, found str @@ -25,7 +25,7 @@ LL | let y: &[u8; 4] = "baaa"; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:4:19 | -LL | let z: &str = b"foo"; //~ ERROR mismatched types +LL | let z: &str = b"foo"; | ^^^^^^ | | | expected str, found array of 3 elements diff --git a/src/test/ui/structs/struct-base-wrong-type-2.stderr b/src/test/ui/structs/struct-base-wrong-type-2.stderr index b15ea51bb2d4..d02ed205e927 100644 --- a/src/test/ui/structs/struct-base-wrong-type-2.stderr +++ b/src/test/ui/structs/struct-base-wrong-type-2.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/struct-base-wrong-type-2.rs:11:27 | -LL | let f = Foo { a: 2, ..b }; //~ ERROR mismatched types +LL | let f = Foo { a: 2, ..b }; | ^ expected struct `Foo`, found struct `Bar` | = note: expected type `Foo` @@ -10,7 +10,7 @@ LL | let f = Foo { a: 2, ..b }; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/struct-base-wrong-type-2.rs:15:34 | -LL | let f__isize = Foo { a: 2, ..4 }; //~ ERROR mismatched types +LL | let f__isize = Foo { a: 2, ..4 }; | ^ expected struct `Foo`, found integer | = note: expected type `Foo` diff --git a/src/test/ui/structs/struct-base-wrong-type.stderr b/src/test/ui/structs/struct-base-wrong-type.stderr index 045eb610f7d1..2491296c5eff 100644 --- a/src/test/ui/structs/struct-base-wrong-type.stderr +++ b/src/test/ui/structs/struct-base-wrong-type.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/struct-base-wrong-type.rs:10:33 | -LL | static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types +LL | static foo: Foo = Foo { a: 2, ..bar }; | ^^^ expected struct `Foo`, found struct `Bar` | = note: expected type `Foo` @@ -10,7 +10,7 @@ LL | static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/struct-base-wrong-type.rs:14:35 | -LL | static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types +LL | static foo_i: Foo = Foo { a: 2, ..4 }; | ^ expected struct `Foo`, found integer | = note: expected type `Foo` diff --git a/src/test/ui/structs/struct-field-privacy.stderr b/src/test/ui/structs/struct-field-privacy.stderr index 5e30a4e403de..91d000b8672e 100644 --- a/src/test/ui/structs/struct-field-privacy.stderr +++ b/src/test/ui/structs/struct-field-privacy.stderr @@ -1,31 +1,31 @@ error[E0616]: field `a` of struct `inner::A` is private --> $DIR/struct-field-privacy.rs:23:5 | -LL | b.a; //~ ERROR: field `a` of struct `inner::A` is private +LL | b.a; | ^^^ error[E0616]: field `b` of struct `inner::B` is private --> $DIR/struct-field-privacy.rs:26:5 | -LL | c.b; //~ ERROR: field `b` of struct `inner::B` is private +LL | c.b; | ^^^ error[E0616]: field `a` of struct `xc::A` is private --> $DIR/struct-field-privacy.rs:28:5 | -LL | d.a; //~ ERROR: field `a` of struct `xc::A` is private +LL | d.a; | ^^^ error[E0616]: field `b` of struct `xc::B` is private --> $DIR/struct-field-privacy.rs:32:5 | -LL | e.b; //~ ERROR: field `b` of struct `xc::B` is private +LL | e.b; | ^^^ error[E0616]: field `1` of struct `inner::Z` is private --> $DIR/struct-field-privacy.rs:35:5 | -LL | z.1; //~ ERROR: field `1` of struct `inner::Z` is private +LL | z.1; | ^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/structs/struct-fields-dupe.stderr b/src/test/ui/structs/struct-fields-dupe.stderr index 7739ef80fc87..aaf2533dc011 100644 --- a/src/test/ui/structs/struct-fields-dupe.stderr +++ b/src/test/ui/structs/struct-fields-dupe.stderr @@ -3,7 +3,7 @@ error[E0062]: field `foo` specified more than once | LL | foo: 0, | ------ first use of `foo` -LL | foo: 0 //~ ERROR field `foo` specified more than once +LL | foo: 0 | ^^^ used more than once error: aborting due to previous error diff --git a/src/test/ui/structs/struct-fields-missing.stderr b/src/test/ui/structs/struct-fields-missing.stderr index edbac000dea0..b3e42a94809d 100644 --- a/src/test/ui/structs/struct-fields-missing.stderr +++ b/src/test/ui/structs/struct-fields-missing.stderr @@ -1,7 +1,7 @@ error[E0063]: missing field `bar` in initializer of `BuildData` --> $DIR/struct-fields-missing.rs:7:15 | -LL | let foo = BuildData { //~ ERROR missing field `bar` in initializer of `BuildData` +LL | let foo = BuildData { | ^^^^^^^^^ missing `bar` error: aborting due to previous error diff --git a/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr b/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr index 37ec6c0f015f..09fc4f7ee586 100644 --- a/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr +++ b/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `y` in this scope --> $DIR/struct-fields-shorthand-unresolved.rs:10:9 | -LL | y //~ ERROR cannot find value `y` in this scope +LL | y | ^ help: a local variable with a similar name exists: `x` error: aborting due to previous error diff --git a/src/test/ui/structs/struct-fields-shorthand.stderr b/src/test/ui/structs/struct-fields-shorthand.stderr index 0d3d633f61cf..a285a392168c 100644 --- a/src/test/ui/structs/struct-fields-shorthand.stderr +++ b/src/test/ui/structs/struct-fields-shorthand.stderr @@ -1,7 +1,7 @@ error[E0560]: struct `Foo` has no field named `z` --> $DIR/struct-fields-shorthand.rs:9:15 | -LL | x, y, z //~ ERROR struct `Foo` has no field named `z` +LL | x, y, z | ^ `Foo` does not have this field | = note: available fields are: `x`, `y` diff --git a/src/test/ui/structs/struct-fields-typo.stderr b/src/test/ui/structs/struct-fields-typo.stderr index c2fab714f7c1..6949a0a4a682 100644 --- a/src/test/ui/structs/struct-fields-typo.stderr +++ b/src/test/ui/structs/struct-fields-typo.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `baa` on type `BuildData` --> $DIR/struct-fields-typo.rs:11:17 | -LL | let x = foo.baa; //~ ERROR no field `baa` on type `BuildData` +LL | let x = foo.baa; | ^^^ help: a field with a similar name exists: `bar` error: aborting due to previous error diff --git a/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr b/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr index 0aa85eb7253e..d6b5af179640 100644 --- a/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr +++ b/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr @@ -8,7 +8,7 @@ LL | | C LL | | } | |_- `A` defined here ... -LL | match x { //~ ERROR non-exhaustive patterns +LL | match x { | ^ pattern `B { x: Some(_) }` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/structs/struct-missing-comma.stderr b/src/test/ui/structs/struct-missing-comma.stderr index 00ef1a7ff926..f5b79f54001e 100644 --- a/src/test/ui/structs/struct-missing-comma.stderr +++ b/src/test/ui/structs/struct-missing-comma.stderr @@ -1,7 +1,7 @@ error: expected `,`, or `}`, found `bar` --> $DIR/struct-missing-comma.rs:4:13 | -LL | foo: u32 //~ expected `,`, or `}`, found `bar` +LL | foo: u32 | ^ help: try adding a comma: `,` error: aborting due to previous error diff --git a/src/test/ui/structs/struct-pat-derived-error.stderr b/src/test/ui/structs/struct-pat-derived-error.stderr index dd1dc71f7fd8..92a88defc52d 100644 --- a/src/test/ui/structs/struct-pat-derived-error.stderr +++ b/src/test/ui/structs/struct-pat-derived-error.stderr @@ -1,19 +1,19 @@ error[E0609]: no field `d` on type `&A` --> $DIR/struct-pat-derived-error.rs:8:31 | -LL | let A { x, y } = self.d; //~ ERROR no field `d` on type `&A` +LL | let A { x, y } = self.d; | ^ error[E0026]: struct `A` does not have fields named `x`, `y` --> $DIR/struct-pat-derived-error.rs:8:17 | -LL | let A { x, y } = self.d; //~ ERROR no field `d` on type `&A` +LL | let A { x, y } = self.d; | ^ ^ struct `A` does not have these fields error[E0027]: pattern does not mention fields `b`, `c` --> $DIR/struct-pat-derived-error.rs:8:13 | -LL | let A { x, y } = self.d; //~ ERROR no field `d` on type `&A` +LL | let A { x, y } = self.d; | ^^^^^^^^^^ missing fields `b`, `c` error: aborting due to 3 previous errors diff --git a/src/test/ui/structs/struct-path-associated-type.stderr b/src/test/ui/structs/struct-path-associated-type.stderr index 80824d984783..0ca64ed40a50 100644 --- a/src/test/ui/structs/struct-path-associated-type.stderr +++ b/src/test/ui/structs/struct-path-associated-type.stderr @@ -25,31 +25,31 @@ LL | T::A {} => {} error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-associated-type.rs:25:20 | -LL | let z = T::A:: {}; //~ ERROR type arguments are not allowed on this entity +LL | let z = T::A:: {}; | ^^ type argument not allowed error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:32:13 | -LL | let s = S::A {}; //~ ERROR ambiguous associated type +LL | let s = S::A {}; | ^^^^ help: use fully-qualified syntax: `::A` error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-associated-type.rs:33:20 | -LL | let z = S::A:: {}; //~ ERROR ambiguous associated type +LL | let z = S::A:: {}; | ^^ type argument not allowed error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:33:13 | -LL | let z = S::A:: {}; //~ ERROR ambiguous associated type +LL | let z = S::A:: {}; | ^^^^^^^^^^ help: use fully-qualified syntax: `::A` error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:36:9 | -LL | S::A {} => {} //~ ERROR ambiguous associated type +LL | S::A {} => {} | ^^^^ help: use fully-qualified syntax: `::A` error: aborting due to 9 previous errors diff --git a/src/test/ui/structs/struct-path-self-type-mismatch.stderr b/src/test/ui/structs/struct-path-self-type-mismatch.stderr index 0b1b1e83400a..72c6d7ae22b4 100644 --- a/src/test/ui/structs/struct-path-self-type-mismatch.stderr +++ b/src/test/ui/structs/struct-path-self-type-mismatch.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/struct-path-self-type-mismatch.rs:7:23 | -LL | Self { inner: 1.5f32 }; //~ ERROR mismatched types +LL | Self { inner: 1.5f32 }; | ^^^^^^ expected i32, found f32 error[E0308]: mismatched types @@ -19,9 +19,9 @@ error[E0308]: mismatched types LL | fn new(u: U) -> Foo { | ------ expected `Foo` because of return type LL | / Self { -LL | | //~^ ERROR mismatched types +LL | | LL | | inner: u -LL | | //~^ ERROR mismatched types +LL | | LL | | } | |_________^ expected type parameter, found a different type parameter | diff --git a/src/test/ui/structs/struct-path-self.stderr b/src/test/ui/structs/struct-path-self.stderr index cda6b7a533f6..0fb02b9c44b5 100644 --- a/src/test/ui/structs/struct-path-self.stderr +++ b/src/test/ui/structs/struct-path-self.stderr @@ -25,13 +25,13 @@ LL | Self { .. } => {} error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-self.rs:20:24 | -LL | let z = Self:: {}; //~ ERROR type arguments are not allowed on this entity +LL | let z = Self:: {}; | ^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-self.rs:30:24 | -LL | let z = Self:: {}; //~ ERROR type arguments are not allowed on this entity +LL | let z = Self:: {}; | ^^ type argument not allowed error: aborting due to 6 previous errors diff --git a/src/test/ui/structs/struct-pattern-match-useless.stderr b/src/test/ui/structs/struct-pattern-match-useless.stderr index 561964bcb24b..5b0c9305448a 100644 --- a/src/test/ui/structs/struct-pattern-match-useless.stderr +++ b/src/test/ui/structs/struct-pattern-match-useless.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/struct-pattern-match-useless.rs:12:9 | -LL | Foo { .. } => () //~ ERROR unreachable pattern +LL | Foo { .. } => () | ^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/structs/struct-variant-privacy-xc.stderr b/src/test/ui/structs/struct-variant-privacy-xc.stderr index da61fc83c262..39241b6b3fc1 100644 --- a/src/test/ui/structs/struct-variant-privacy-xc.stderr +++ b/src/test/ui/structs/struct-variant-privacy-xc.stderr @@ -1,13 +1,13 @@ error[E0603]: enum `Bar` is private --> $DIR/struct-variant-privacy-xc.rs:4:33 | -LL | fn f(b: struct_variant_privacy::Bar) { //~ ERROR enum `Bar` is private +LL | fn f(b: struct_variant_privacy::Bar) { | ^^^ error[E0603]: enum `Bar` is private --> $DIR/struct-variant-privacy-xc.rs:6:33 | -LL | struct_variant_privacy::Bar::Baz { a: _a } => {} //~ ERROR enum `Bar` is private +LL | struct_variant_privacy::Bar::Baz { a: _a } => {} | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/structs/struct-variant-privacy.stderr b/src/test/ui/structs/struct-variant-privacy.stderr index 0895b52998c4..127a65010448 100644 --- a/src/test/ui/structs/struct-variant-privacy.stderr +++ b/src/test/ui/structs/struct-variant-privacy.stderr @@ -1,13 +1,13 @@ error[E0603]: enum `Bar` is private --> $DIR/struct-variant-privacy.rs:7:14 | -LL | fn f(b: foo::Bar) { //~ ERROR enum `Bar` is private +LL | fn f(b: foo::Bar) { | ^^^ error[E0603]: enum `Bar` is private --> $DIR/struct-variant-privacy.rs:9:14 | -LL | foo::Bar::Baz { a: _a } => {} //~ ERROR enum `Bar` is private +LL | foo::Bar::Baz { a: _a } => {} | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/structs/structure-constructor-type-mismatch.stderr b/src/test/ui/structs/structure-constructor-type-mismatch.stderr index cc62316bec18..375678b7cee5 100644 --- a/src/test/ui/structs/structure-constructor-type-mismatch.stderr +++ b/src/test/ui/structs/structure-constructor-type-mismatch.stderr @@ -73,13 +73,13 @@ LL | x: 7, error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/structure-constructor-type-mismatch.rs:48:24 | -LL | let pt3 = PointF:: { //~ ERROR wrong number of type arguments +LL | let pt3 = PointF:: { | ^^^ unexpected type argument error[E0308]: mismatched types --> $DIR/structure-constructor-type-mismatch.rs:49:12 | -LL | x: 9, //~ ERROR mismatched types +LL | x: 9, | ^ | | | expected f32, found integer @@ -91,7 +91,7 @@ LL | x: 9, //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/structure-constructor-type-mismatch.rs:50:12 | -LL | y: 10, //~ ERROR mismatched types +LL | y: 10, | ^^ | | | expected f32, found integer @@ -103,7 +103,7 @@ LL | y: 10, //~ ERROR mismatched types error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/structure-constructor-type-mismatch.rs:54:18 | -LL | PointF:: { .. } => {} //~ ERROR wrong number of type arguments +LL | PointF:: { .. } => {} | ^^^ unexpected type argument error[E0308]: mismatched types @@ -111,7 +111,7 @@ error[E0308]: mismatched types | LL | match (Point { x: 1, y: 2 }) { | ---------------------- this match expression has type `Point<{integer}>` -LL | PointF:: { .. } => {} //~ ERROR wrong number of type arguments +LL | PointF:: { .. } => {} | ^^^^^^^^^^^^^^^^^^^^ expected integer, found f32 | = note: expected type `Point<{integer}>` @@ -122,7 +122,7 @@ error[E0308]: mismatched types | LL | match (Point { x: 1, y: 2 }) { | ---------------------- this match expression has type `Point<{integer}>` -LL | PointF { .. } => {} //~ ERROR mismatched types +LL | PointF { .. } => {} | ^^^^^^^^^^^^^ expected integer, found f32 | = note: expected type `Point<{integer}>` @@ -133,7 +133,7 @@ error[E0308]: mismatched types | LL | match (Pair { x: 1, y: 2 }) { | --------------------- this match expression has type `Pair<{integer}, {integer}>` -LL | PairF:: { .. } => {} //~ ERROR mismatched types +LL | PairF:: { .. } => {} | ^^^^^^^^^^^^^^^^^^^ expected integer, found f32 | = note: expected type `Pair<{integer}, {integer}>` diff --git a/src/test/ui/suffixed-literal-meta.stderr b/src/test/ui/suffixed-literal-meta.stderr index 265aa78d53f1..495404af3e8a 100644 --- a/src/test/ui/suffixed-literal-meta.stderr +++ b/src/test/ui/suffixed-literal-meta.stderr @@ -1,7 +1,7 @@ error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:3:13 | -LL | #[my_attr = 1usize] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1usize] | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -9,7 +9,7 @@ LL | #[my_attr = 1usize] //~ ERROR: suffixed literals are not allowed in attribu error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:4:13 | -LL | #[my_attr = 1u8] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1u8] | ^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -17,7 +17,7 @@ LL | #[my_attr = 1u8] //~ ERROR: suffixed literals are not allowed in attributes error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:5:13 | -LL | #[my_attr = 1u16] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1u16] | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -25,7 +25,7 @@ LL | #[my_attr = 1u16] //~ ERROR: suffixed literals are not allowed in attribute error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:6:13 | -LL | #[my_attr = 1u32] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1u32] | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -33,7 +33,7 @@ LL | #[my_attr = 1u32] //~ ERROR: suffixed literals are not allowed in attribute error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:7:13 | -LL | #[my_attr = 1u64] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1u64] | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -41,7 +41,7 @@ LL | #[my_attr = 1u64] //~ ERROR: suffixed literals are not allowed in attribute error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:8:13 | -LL | #[my_attr = 1isize] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1isize] | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -49,7 +49,7 @@ LL | #[my_attr = 1isize] //~ ERROR: suffixed literals are not allowed in attribu error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:9:13 | -LL | #[my_attr = 1i8] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1i8] | ^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -57,7 +57,7 @@ LL | #[my_attr = 1i8] //~ ERROR: suffixed literals are not allowed in attributes error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:10:13 | -LL | #[my_attr = 1i16] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1i16] | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -65,7 +65,7 @@ LL | #[my_attr = 1i16] //~ ERROR: suffixed literals are not allowed in attribute error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:11:13 | -LL | #[my_attr = 1i32] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1i32] | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -73,7 +73,7 @@ LL | #[my_attr = 1i32] //~ ERROR: suffixed literals are not allowed in attribute error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:12:13 | -LL | #[my_attr = 1i64] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1i64] | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -81,7 +81,7 @@ LL | #[my_attr = 1i64] //~ ERROR: suffixed literals are not allowed in attribute error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:13:13 | -LL | #[my_attr = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1.0f32] | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -89,7 +89,7 @@ LL | #[my_attr = 1.0f32] //~ ERROR: suffixed literals are not allowed in attribu error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:14:13 | -LL | #[my_attr = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1.0f64] | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). diff --git a/src/test/ui/suggestions/attribute-typos.stderr b/src/test/ui/suggestions/attribute-typos.stderr index e40da787e96c..077c955431ab 100644 --- a/src/test/ui/suggestions/attribute-typos.stderr +++ b/src/test/ui/suggestions/attribute-typos.stderr @@ -1,7 +1,7 @@ error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642) --> $DIR/attribute-typos.rs:11:3 | -LL | #[rustc_err] //~ ERROR E0658 +LL | #[rustc_err] | ^^^^^^^^^ | = help: add #![feature(rustc_attrs)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[rustc_err] //~ ERROR E0658 error[E0658]: The attribute `tests` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/attribute-typos.rs:6:3 | -LL | #[tests] //~ ERROR E0658 +LL | #[tests] | ^^^^^ help: a built-in attribute with a similar name exists: `test` | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | #[tests] //~ ERROR E0658 error[E0658]: The attribute `deprcated` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/attribute-typos.rs:1:3 | -LL | #[deprcated] //~ ERROR E0658 +LL | #[deprcated] | ^^^^^^^^^ help: a built-in attribute with a similar name exists: `deprecated` | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr index 4b51294f86a0..b1aaab6a7544 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr @@ -51,7 +51,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &(Either::One(_t), Either::Two(_u)) => (), | -- -- ...and here | | @@ -82,7 +82,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &(Either::One(_t), Either::Two(_u)) | ----------------------------------- | | | | @@ -101,7 +101,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &(Either::One(_t), Either::Two(_u)) => (), | ----------------------------------- | | | | @@ -120,7 +120,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &(Either::One(_t), Either::Two(_u)) => (), | ----------------------------------- | | | | @@ -187,7 +187,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | -- -- ...and here | | @@ -218,7 +218,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut (Either::One(_t), Either::Two(_u)) | --------------------------------------- | | | | @@ -237,7 +237,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | --------------------------------------- | | | | @@ -256,7 +256,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | --------------------------------------- | | | | @@ -275,7 +275,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | --------------------------------------- | | | | diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr index 296fcef0c4a3..6a8b17ca8704 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr @@ -420,7 +420,7 @@ error[E0507]: cannot move out of borrowed content | LL | match r { | ^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &Either::One(_t) | ---------------- | | | @@ -438,7 +438,7 @@ error[E0507]: cannot move out of borrowed content | LL | match r { | ^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &Either::One(_t) => (), | ---------------- | | | @@ -456,7 +456,7 @@ error[E0507]: cannot move out of borrowed content | LL | match r { | ^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &Either::One(_t) => (), | ---------------- | | | @@ -519,7 +519,7 @@ error[E0507]: cannot move out of borrowed content | LL | match rm { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -- data moved here ... @@ -548,7 +548,7 @@ error[E0507]: cannot move out of borrowed content | LL | match rm { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -------------------- | | | @@ -566,7 +566,7 @@ error[E0507]: cannot move out of borrowed content | LL | match rm { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -------------------- | | | @@ -584,7 +584,7 @@ error[E0507]: cannot move out of borrowed content | LL | match rm { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -------------------- | | | @@ -644,7 +644,7 @@ error[E0507]: cannot move out of borrowed content | LL | match (&e.clone(),) { | ^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | (&Either::One(_t),) | -- data moved here | @@ -701,7 +701,7 @@ error[E0507]: cannot move out of borrowed content | LL | match (&mut em.clone(),) { | ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | (&mut Either::One(_t),) => (), | -- data moved here LL | (&mut Either::Two(_t),) => (), @@ -765,7 +765,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &e { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &Either::One(_t) | ---------------- | | | @@ -783,7 +783,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &e { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &Either::One(_t) => (), | ---------------- | | | @@ -801,7 +801,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &e { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &Either::One(_t) => (), | ---------------- | | | @@ -864,7 +864,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) | -------------------- | | | @@ -882,7 +882,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -------------------- | | | @@ -900,7 +900,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -------------------- | | | @@ -918,7 +918,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -------------------- | | | diff --git a/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr index f26fb141ccf8..cc3a2b9419ca 100644 --- a/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr +++ b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr @@ -3,7 +3,7 @@ error[E0277]: the trait bound `(): Bar` is not satisfied | LL | fn foo() -> impl Bar { | ^^^^^^^^ the trait `Bar` is not implemented for `()` -LL | 5; //~^ ERROR the trait bound `(): Bar` is not satisfied +LL | 5; | - consider removing this semicolon | = note: the return type of a function must have a statically known size diff --git a/src/test/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr b/src/test/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr index 40ddb5ec53c2..f81c45e2f8da 100644 --- a/src/test/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr +++ b/src/test/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr @@ -4,7 +4,7 @@ error[E0618]: expected function, found `bool` LL | fn vindictive() -> bool { true } | -------------------------------- `vindictive` defined here returns `bool` ... -LL | vindictive() //~ ERROR expected function, found `bool` +LL | vindictive() | -^^^^^^^^^^^- help: try adding a semicolon: `;` | _____| | | diff --git a/src/test/ui/suggestions/suggest-labels.stderr b/src/test/ui/suggestions/suggest-labels.stderr index 88a0f9698877..ead8f94209bd 100644 --- a/src/test/ui/suggestions/suggest-labels.stderr +++ b/src/test/ui/suggestions/suggest-labels.stderr @@ -1,19 +1,19 @@ error[E0426]: use of undeclared label `'fo` --> $DIR/suggest-labels.rs:4:15 | -LL | break 'fo; //~ ERROR use of undeclared label +LL | break 'fo; | ^^^ did you mean `'foo`? error[E0426]: use of undeclared label `'bor` --> $DIR/suggest-labels.rs:8:18 | -LL | continue 'bor; //~ ERROR use of undeclared label +LL | continue 'bor; | ^^^^ did you mean `'bar`? error[E0426]: use of undeclared label `'longlable` --> $DIR/suggest-labels.rs:13:19 | -LL | break 'longlable; //~ ERROR use of undeclared label +LL | break 'longlable; | ^^^^^^^^^^ did you mean `'longlabel1`? error: aborting due to 3 previous errors diff --git a/src/test/ui/suggestions/suggest-methods.stderr b/src/test/ui/suggestions/suggest-methods.stderr index b7727cf03a4e..09d58575d97d 100644 --- a/src/test/ui/suggestions/suggest-methods.stderr +++ b/src/test/ui/suggestions/suggest-methods.stderr @@ -4,25 +4,25 @@ error[E0599]: no method named `bat` found for type `Foo` in the current scope LL | struct Foo; | ----------- method `bat` not found for this ... -LL | f.bat(1.0); //~ ERROR no method named +LL | f.bat(1.0); | ^^^ help: did you mean: `bar` error[E0599]: no method named `is_emtpy` found for type `std::string::String` in the current scope --> $DIR/suggest-methods.rs:21:15 | -LL | let _ = s.is_emtpy(); //~ ERROR no method named +LL | let _ = s.is_emtpy(); | ^^^^^^^^ help: did you mean: `is_empty` error[E0599]: no method named `count_eos` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:25:19 | -LL | let _ = 63u32.count_eos(); //~ ERROR no method named +LL | let _ = 63u32.count_eos(); | ^^^^^^^^^ help: did you mean: `count_zeros` error[E0599]: no method named `count_o` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:28:19 | -LL | let _ = 63u32.count_o(); //~ ERROR no method named +LL | let _ = 63u32.count_o(); | ^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/suggest-move-lifetimes.stderr b/src/test/ui/suggestions/suggest-move-lifetimes.stderr index 2d6dee062166..657914d1c8c0 100644 --- a/src/test/ui/suggestions/suggest-move-lifetimes.stderr +++ b/src/test/ui/suggestions/suggest-move-lifetimes.stderr @@ -1,25 +1,25 @@ error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:1:13 | -LL | struct A { //~ ERROR lifetime parameters must be declared +LL | struct A { | ----^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T>` error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:5:13 | -LL | struct B { //~ ERROR lifetime parameters must be declared +LL | struct B { | ----^^---- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, U>` error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:10:16 | -LL | struct C { //~ ERROR lifetime parameters must be declared +LL | struct C { | -------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, U>` error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:15:16 | -LL | struct D { //~ ERROR lifetime parameters must be declared +LL | struct D { | -------^^--^^-----^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, 'c, T, U, V>` error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/suggest-move-types.stderr b/src/test/ui/suggestions/suggest-move-types.stderr index 0901b71911d4..552fb78cd3fd 100644 --- a/src/test/ui/suggestions/suggest-move-types.stderr +++ b/src/test/ui/suggestions/suggest-move-types.stderr @@ -1,7 +1,7 @@ error: associated type bindings must be declared after generic parameters --> $DIR/suggest-move-types.rs:28:20 | -LL | struct A> { //~ ERROR associated type bindings must be declared after generic parameters +LL | struct A> { | ----^^^ | | | this associated type binding should be moved after the generic parameters @@ -17,7 +17,7 @@ LL | struct Al<'a, T, M: OneWithLifetime> { error: associated type bindings must be declared after generic parameters --> $DIR/suggest-move-types.rs:41:28 | -LL | struct B> { //~ ERROR associated type bindings must be declared after generic parameters +LL | struct B> { | ----^^----^^----^^^^^^^^^ | | | | | | | this associated type binding should be moved after the generic parameters @@ -37,7 +37,7 @@ LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime $DIR/suggest-move-types.rs:57:28 | -LL | struct C> { //~ ERROR associated type bindings must be declared after generic parameters +LL | struct C> { | ^^^----^^----^^----^^^^^^ | | | | | | | this associated type binding should be moved after the generic parameters @@ -57,7 +57,7 @@ LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime $DIR/suggest-move-types.rs:73:28 | -LL | struct D> { //~ ERROR associated type bindings must be declared after generic parameters +LL | struct D> { | ^^^----^^----^^^^^----^^^ | | | | | | | this associated type binding should be moved after the generic parameters diff --git a/src/test/ui/suggestions/suggest-variants.stderr b/src/test/ui/suggestions/suggest-variants.stderr index 36abda2a89bb..08ae68ea7130 100644 --- a/src/test/ui/suggestions/suggest-variants.stderr +++ b/src/test/ui/suggestions/suggest-variants.stderr @@ -1,19 +1,19 @@ error: no variant `Squareee` on enum `Shape` --> $DIR/suggest-variants.rs:12:34 | -LL | println!("My shape is {:?}", Shape::Squareee { size: 5}); //~ ERROR no variant `Squareee` +LL | println!("My shape is {:?}", Shape::Squareee { size: 5}); | ^^^^^^^^^^^^^^^ help: did you mean: `Shape::Square` error: no variant `Circl` on enum `Shape` --> $DIR/suggest-variants.rs:13:34 | -LL | println!("My shape is {:?}", Shape::Circl { size: 5}); //~ ERROR no variant `Circl` +LL | println!("My shape is {:?}", Shape::Circl { size: 5}); | ^^^^^^^^^^^^ help: did you mean: `Shape::Circle` error: no variant `Rombus` on enum `Shape` --> $DIR/suggest-variants.rs:14:34 | -LL | println!("My shape is {:?}", Shape::Rombus{ size: 5}); //~ ERROR no variant `Rombus` +LL | println!("My shape is {:?}", Shape::Rombus{ size: 5}); | ^^^^^^^^^^^^^ unknown variant error: aborting due to 3 previous errors diff --git a/src/test/ui/super-at-top-level.stderr b/src/test/ui/super-at-top-level.stderr index ce7a39339767..d04ce384fe88 100644 --- a/src/test/ui/super-at-top-level.stderr +++ b/src/test/ui/super-at-top-level.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: there are too many initial `super`s. --> $DIR/super-at-top-level.rs:1:5 | -LL | use super::f; //~ ERROR there are too many initial `super`s +LL | use super::f; | ^^^^^ there are too many initial `super`s. error: aborting due to previous error diff --git a/src/test/ui/svh/svh-change-lit.stderr b/src/test/ui/svh/svh-change-lit.stderr index ebb39224caa5..1b1501331b70 100644 --- a/src/test/ui/svh/svh-change-lit.stderr +++ b/src/test/ui/svh/svh-change-lit.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/svh-change-lit.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/svh/svh-change-significant-cfg.stderr b/src/test/ui/svh/svh-change-significant-cfg.stderr index d7196fc21f84..2357a4387d41 100644 --- a/src/test/ui/svh/svh-change-significant-cfg.stderr +++ b/src/test/ui/svh/svh-change-significant-cfg.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/svh-change-significant-cfg.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/svh/svh-change-trait-bound.stderr b/src/test/ui/svh/svh-change-trait-bound.stderr index 38678d7ec2ce..9fe949b2e7d1 100644 --- a/src/test/ui/svh/svh-change-trait-bound.stderr +++ b/src/test/ui/svh/svh-change-trait-bound.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/svh-change-trait-bound.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/svh/svh-change-type-arg.stderr b/src/test/ui/svh/svh-change-type-arg.stderr index 037d7867b0dc..a8b35d29c997 100644 --- a/src/test/ui/svh/svh-change-type-arg.stderr +++ b/src/test/ui/svh/svh-change-type-arg.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/svh-change-type-arg.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/svh/svh-change-type-ret.stderr b/src/test/ui/svh/svh-change-type-ret.stderr index 184ac9e0e7c7..ebe44a7bee59 100644 --- a/src/test/ui/svh/svh-change-type-ret.stderr +++ b/src/test/ui/svh/svh-change-type-ret.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/svh-change-type-ret.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/svh/svh-change-type-static.stderr b/src/test/ui/svh/svh-change-type-static.stderr index d3aeb073cd7a..da09c3230a1c 100644 --- a/src/test/ui/svh/svh-change-type-static.stderr +++ b/src/test/ui/svh/svh-change-type-static.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/svh-change-type-static.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/svh/svh-use-trait.stderr b/src/test/ui/svh/svh-use-trait.stderr index 0af44502375f..4676143a06e2 100644 --- a/src/test/ui/svh/svh-use-trait.stderr +++ b/src/test/ui/svh/svh-use-trait.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `uta` which `utb` depends on --> $DIR/svh-use-trait.rs:15:1 | -LL | extern crate utb; //~ ERROR: found possibly newer version of crate `uta` which `utb` depends +LL | extern crate utb; | ^^^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/switched-expectations.stderr b/src/test/ui/switched-expectations.stderr index bbb9b51650e0..043d130051d7 100644 --- a/src/test/ui/switched-expectations.stderr +++ b/src/test/ui/switched-expectations.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/switched-expectations.rs:3:30 | -LL | let ref string: String = var; //~ ERROR mismatched types [E0308] +LL | let ref string: String = var; | ^^^ expected struct `std::string::String`, found i32 | = note: expected type `std::string::String` diff --git a/src/test/ui/symbol-names/basic.stderr b/src/test/ui/symbol-names/basic.stderr index ca789df9bd18..e23a326d5f88 100644 --- a/src/test/ui/symbol-names/basic.stderr +++ b/src/test/ui/symbol-names/basic.stderr @@ -1,13 +1,13 @@ error: symbol-name(_ZN5basic4main17h08bcaf310214ed52E) --> $DIR/basic.rs:3:1 | -LL | #[rustc_symbol_name] //~ ERROR _ZN5basic4main +LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: item-path(main) --> $DIR/basic.rs:4:1 | -LL | #[rustc_item_path] //~ ERROR item-path(main) +LL | #[rustc_item_path] | ^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/symbol-names/impl1.stderr b/src/test/ui/symbol-names/impl1.stderr index 75d3e40e1b2f..e4fefeb601fe 100644 --- a/src/test/ui/symbol-names/impl1.stderr +++ b/src/test/ui/symbol-names/impl1.stderr @@ -1,25 +1,25 @@ error: symbol-name(_ZN5impl13foo3Foo3bar17hc487d6ec13fe9124E) --> $DIR/impl1.rs:8:9 | -LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13foo3Foo3bar +LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: item-path(foo::Foo::bar) --> $DIR/impl1.rs:9:9 | -LL | #[rustc_item_path] //~ ERROR item-path(foo::Foo::bar) +LL | #[rustc_item_path] | ^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17h38577281258e1527E) --> $DIR/impl1.rs:18:9 | -LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz +LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: item-path(bar::::baz) --> $DIR/impl1.rs:19:9 | -LL | #[rustc_item_path] //~ ERROR item-path(bar::::baz) +LL | #[rustc_item_path] | ^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/synthetic-param.stderr b/src/test/ui/synthetic-param.stderr index 7bdab439572b..b63a57a20183 100644 --- a/src/test/ui/synthetic-param.stderr +++ b/src/test/ui/synthetic-param.stderr @@ -1,19 +1,19 @@ error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position. --> $DIR/synthetic-param.rs:20:5 | -LL | func::(42); //~ ERROR cannot provide explicit type parameters +LL | func::(42); | ^^^^^^^^^^ error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position. --> $DIR/synthetic-param.rs:23:5 | -LL | Foo::func::(42); //~ ERROR cannot provide explicit type parameters +LL | Foo::func::(42); | ^^^^^^^^^^^^^^^ error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position. --> $DIR/synthetic-param.rs:26:5 | -LL | Bar::::func::(42); //~ ERROR cannot provide explicit type parameters +LL | Bar::::func::(42); | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/tag-type-args.stderr b/src/test/ui/tag-type-args.stderr index 40523ee907b8..ac44dad4a888 100644 --- a/src/test/ui/tag-type-args.stderr +++ b/src/test/ui/tag-type-args.stderr @@ -1,7 +1,7 @@ error[E0107]: wrong number of type arguments: expected 1, found 0 --> $DIR/tag-type-args.rs:3:11 | -LL | fn foo(c: Quux) { assert!((false)); } //~ ERROR wrong number of type arguments +LL | fn foo(c: Quux) { assert!((false)); } | ^^^^ expected 1 type argument error: aborting due to previous error diff --git a/src/test/ui/tag-variant-cast-non-nullary.stderr b/src/test/ui/tag-variant-cast-non-nullary.stderr index 797a55f65fe1..87ec20f20d78 100644 --- a/src/test/ui/tag-variant-cast-non-nullary.stderr +++ b/src/test/ui/tag-variant-cast-non-nullary.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `NonNullary` as `isize` --> $DIR/tag-variant-cast-non-nullary.rs:8:15 | -LL | let val = v as isize; //~ ERROR non-primitive cast: `NonNullary` as `isize` [E0605] +LL | let val = v as isize; | ^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/tag-variant-disr-dup.stderr b/src/test/ui/tag-variant-disr-dup.stderr index b3de25e87b35..ca12894c0429 100644 --- a/src/test/ui/tag-variant-disr-dup.stderr +++ b/src/test/ui/tag-variant-disr-dup.stderr @@ -3,7 +3,7 @@ error[E0081]: discriminant value `0` already exists | LL | Black = 0x000000, | -------- first use of `0` -LL | White = 0x000000, //~ ERROR discriminant value `0` already exists +LL | White = 0x000000, | ^^^^^^^^ enum already has `0` error: aborting due to previous error diff --git a/src/test/ui/target-feature-wrong.stderr b/src/test/ui/target-feature-wrong.stderr index 236f5c4afec3..3662ea976a46 100644 --- a/src/test/ui/target-feature-wrong.stderr +++ b/src/test/ui/target-feature-wrong.stderr @@ -33,7 +33,7 @@ error: attribute should be applied to a function | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | //~^ ERROR: should be applied to a function +LL | LL | mod another {} | -------------- not a function diff --git a/src/test/ui/terr-in-field.stderr b/src/test/ui/terr-in-field.stderr index 5a9c0898aad1..91c3b3014a20 100644 --- a/src/test/ui/terr-in-field.stderr +++ b/src/test/ui/terr-in-field.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/terr-in-field.rs:13:14 | -LL | want_foo(b); //~ ERROR mismatched types +LL | want_foo(b); | ^ expected struct `Foo`, found struct `Bar` | = note: expected type `Foo` diff --git a/src/test/ui/terr-sorts.stderr b/src/test/ui/terr-sorts.stderr index dfaf8186fc38..05b9fb43fe1b 100644 --- a/src/test/ui/terr-sorts.stderr +++ b/src/test/ui/terr-sorts.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/terr-sorts.rs:10:14 | -LL | want_foo(b); //~ ERROR mismatched types +LL | want_foo(b); | ^ expected struct `Foo`, found struct `std::boxed::Box` | = note: expected type `Foo` diff --git a/src/test/ui/test-attr-non-associated-functions.stderr b/src/test/ui/test-attr-non-associated-functions.stderr index 8a1cc6fa367f..6176aa03d84d 100644 --- a/src/test/ui/test-attr-non-associated-functions.stderr +++ b/src/test/ui/test-attr-non-associated-functions.stderr @@ -1,7 +1,7 @@ error: #[test] attribute is only allowed on non associated functions --> $DIR/test-attr-non-associated-functions.rs:9:5 | -LL | / fn new() -> A { //~ ERROR #[test] attribute is only allowed on non associated functions +LL | / fn new() -> A { LL | | A {} LL | | } | |_____^ diff --git a/src/test/ui/test-cfg.stderr b/src/test/ui/test-cfg.stderr index 93ca9a27de23..c35fe2f9458d 100644 --- a/src/test/ui/test-cfg.stderr +++ b/src/test/ui/test-cfg.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `foo` in this scope --> $DIR/test-cfg.rs:7:5 | -LL | foo(); //~ ERROR cannot find function `foo` in this scope +LL | foo(); | ^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/test-warns-dead-code.stderr b/src/test/ui/test-warns-dead-code.stderr index fe74ad133405..62e99225dd90 100644 --- a/src/test/ui/test-warns-dead-code.stderr +++ b/src/test/ui/test-warns-dead-code.stderr @@ -1,7 +1,7 @@ error: function is never used: `dead` --> $DIR/test-warns-dead-code.rs:5:1 | -LL | fn dead() {} //~ error: function is never used: `dead` +LL | fn dead() {} | ^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/thread-local-mutation.stderr b/src/test/ui/thread-local-mutation.stderr index bf298523e1b7..685e7c6585a0 100644 --- a/src/test/ui/thread-local-mutation.stderr +++ b/src/test/ui/thread-local-mutation.stderr @@ -1,7 +1,7 @@ error[E0594]: cannot assign to immutable thread-local static item --> $DIR/thread-local-mutation.rs:11:5 | -LL | S = "after"; //~ ERROR cannot assign to immutable +LL | S = "after"; | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr index dd1de22f3da0..1e9d1609f02b 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr @@ -1,37 +1,37 @@ error: cannot find derive macro `rustfmt` in this scope --> $DIR/tool-attributes-misplaced-1.rs:6:10 | -LL | #[derive(rustfmt)] //~ ERROR cannot find derive macro `rustfmt` in this scope +LL | #[derive(rustfmt)] | ^^^^^^^ error: cannot find macro `rustfmt!` in this scope --> $DIR/tool-attributes-misplaced-1.rs:15:5 | -LL | rustfmt!(); //~ ERROR cannot find macro `rustfmt!` in this scope +LL | rustfmt!(); | ^^^^^^^ error[E0573]: expected type, found tool module `rustfmt` --> $DIR/tool-attributes-misplaced-1.rs:3:10 | -LL | type A = rustfmt; //~ ERROR expected type, found tool module `rustfmt` +LL | type A = rustfmt; | ^^^^^^^ not a type error[E0573]: expected type, found tool attribute `rustfmt::skip` --> $DIR/tool-attributes-misplaced-1.rs:4:10 | -LL | type B = rustfmt::skip; //~ ERROR expected type, found tool attribute `rustfmt::skip` +LL | type B = rustfmt::skip; | ^^^^^^^^^^^^^ not a type error[E0423]: expected value, found tool module `rustfmt` --> $DIR/tool-attributes-misplaced-1.rs:14:5 | -LL | rustfmt; //~ ERROR expected value, found tool module `rustfmt` +LL | rustfmt; | ^^^^^^^ not a value error[E0423]: expected value, found tool attribute `rustfmt::skip` --> $DIR/tool-attributes-misplaced-1.rs:17:5 | -LL | rustfmt::skip; //~ ERROR expected value, found tool attribute `rustfmt::skip` +LL | rustfmt::skip; | ^^^^^^^^^^^^^ not a value error: aborting due to 6 previous errors diff --git a/src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr b/src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr index 50a7b5973283..c5f5f59c32c3 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr @@ -1,13 +1,13 @@ error: expected a macro, found tool attribute --> $DIR/tool-attributes-misplaced-2.rs:1:10 | -LL | #[derive(rustfmt::skip)] //~ ERROR expected a macro, found tool attribute +LL | #[derive(rustfmt::skip)] | ^^^^^^^^^^^^^ error: expected a macro, found tool attribute --> $DIR/tool-attributes-misplaced-2.rs:5:5 | -LL | rustfmt::skip!(); //~ ERROR expected a macro, found tool attribute +LL | rustfmt::skip!(); | ^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/tool-attributes/tool-attributes-shadowing.stderr b/src/test/ui/tool-attributes/tool-attributes-shadowing.stderr index 62b5b8e2ac23..98ad109a07e8 100644 --- a/src/test/ui/tool-attributes/tool-attributes-shadowing.stderr +++ b/src/test/ui/tool-attributes/tool-attributes-shadowing.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: could not find `skip` in `rustfmt` --> $DIR/tool-attributes-shadowing.rs:3:12 | -LL | #[rustfmt::skip] //~ ERROR failed to resolve: could not find `skip` in `rustfmt` +LL | #[rustfmt::skip] | ^^^^ could not find `skip` in `rustfmt` error: aborting due to previous error diff --git a/src/test/ui/tool_lints-fail.stderr b/src/test/ui/tool_lints-fail.stderr index 6b027eecf268..a61157f21b8e 100644 --- a/src/test/ui/tool_lints-fail.stderr +++ b/src/test/ui/tool_lints-fail.stderr @@ -1,7 +1,7 @@ error: unknown lint: `clippy` --> $DIR/tool_lints-fail.rs:6:9 | -LL | #![deny(clippy)] //~ ERROR: unknown lint: `clippy` +LL | #![deny(clippy)] | ^^^^^^ | note: lint level defined here diff --git a/src/test/ui/trace_macros-format.stderr b/src/test/ui/trace_macros-format.stderr index a180c360b4a7..650b87076981 100644 --- a/src/test/ui/trace_macros-format.stderr +++ b/src/test/ui/trace_macros-format.stderr @@ -1,37 +1,37 @@ error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-format.rs:4:5 | -LL | trace_macros!(); //~ ERROR trace_macros! accepts only `true` or `false` +LL | trace_macros!(); | ^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-format.rs:5:5 | -LL | trace_macros!(1); //~ ERROR trace_macros! accepts only `true` or `false` +LL | trace_macros!(1); | ^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-format.rs:6:5 | -LL | trace_macros!(ident); //~ ERROR trace_macros! accepts only `true` or `false` +LL | trace_macros!(ident); | ^^^^^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-format.rs:7:5 | -LL | trace_macros!(for); //~ ERROR trace_macros! accepts only `true` or `false` +LL | trace_macros!(for); | ^^^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-format.rs:8:5 | -LL | trace_macros!(true,); //~ ERROR trace_macros! accepts only `true` or `false` +LL | trace_macros!(true,); | ^^^^^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-format.rs:9:5 | -LL | trace_macros!(false 1); //~ ERROR trace_macros! accepts only `true` or `false` +LL | trace_macros!(false 1); | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/trace_macros-gate.stderr b/src/test/ui/trace_macros-gate.stderr index 4831aa158dbc..4d2fd554a06d 100644 --- a/src/test/ui/trace_macros-gate.stderr +++ b/src/test/ui/trace_macros-gate.stderr @@ -1,7 +1,7 @@ error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/trace_macros-gate.rs:4:5 | -LL | trace_macros!(); //~ ERROR `trace_macros` is not stable +LL | trace_macros!(); | ^^^^^^^^^^^^^^^^ | = help: add #![feature(trace_macros)] to the crate attributes to enable @@ -9,13 +9,13 @@ LL | trace_macros!(); //~ ERROR `trace_macros` is not stable error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-gate.rs:4:5 | -LL | trace_macros!(); //~ ERROR `trace_macros` is not stable +LL | trace_macros!(); | ^^^^^^^^^^^^^^^^ error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/trace_macros-gate.rs:6:5 | -LL | trace_macros!(true); //~ ERROR `trace_macros` is not stable +LL | trace_macros!(true); | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(trace_macros)] to the crate attributes to enable @@ -23,7 +23,7 @@ LL | trace_macros!(true); //~ ERROR `trace_macros` is not stable error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/trace_macros-gate.rs:7:5 | -LL | trace_macros!(false); //~ ERROR `trace_macros` is not stable +LL | trace_macros!(false); | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(trace_macros)] to the crate attributes to enable @@ -31,7 +31,7 @@ LL | trace_macros!(false); //~ ERROR `trace_macros` is not stable error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/trace_macros-gate.rs:10:26 | -LL | ($x: ident) => { trace_macros!($x) } //~ ERROR `trace_macros` is not stable +LL | ($x: ident) => { trace_macros!($x) } | ^^^^^^^^^^^^^^^^^ ... LL | expando!(true); diff --git a/src/test/ui/trait-method-number-parameters.stderr b/src/test/ui/trait-method-number-parameters.stderr index 32101239e66c..e47fe1a8026d 100644 --- a/src/test/ui/trait-method-number-parameters.stderr +++ b/src/test/ui/trait-method-number-parameters.stderr @@ -4,7 +4,7 @@ error[E0050]: method `foo` has 2 parameters but the declaration in trait `Foo::f LL | fn foo(&mut self, x: i32, y: i32) -> i32; | ------------------------- trait requires 3 parameters ... -LL | / &mut self, //~ ERROR +LL | / &mut self, LL | | x: i32, | |______________^ expected 3 parameters, found 2 diff --git a/src/test/ui/traits/trait-alias-impl.stderr b/src/test/ui/traits/trait-alias-impl.stderr index 6a6cedb014a7..301db4fb71c6 100644 --- a/src/test/ui/traits/trait-alias-impl.stderr +++ b/src/test/ui/traits/trait-alias-impl.stderr @@ -1,7 +1,7 @@ error[E0404]: expected trait, found trait alias `DefaultAlias` --> $DIR/trait-alias-impl.rs:5:6 | -LL | impl DefaultAlias for () {} //~ ERROR expected trait, found trait alias +LL | impl DefaultAlias for () {} | ^^^^^^^^^^^^ not a trait error: aborting due to previous error diff --git a/src/test/ui/traits/trait-alias-object.stderr b/src/test/ui/traits/trait-alias-object.stderr index 604db6f7e189..c6b61eae4a1b 100644 --- a/src/test/ui/traits/trait-alias-object.stderr +++ b/src/test/ui/traits/trait-alias-object.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `EqAlias` cannot be made into an object --> $DIR/trait-alias-object.rs:7:13 | -LL | let _: &dyn EqAlias = &123; //~ ERROR `EqAlias` cannot be made into an object +LL | let _: &dyn EqAlias = &123; | ^^^^^^^^^^^ the trait `EqAlias` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses @@ -9,7 +9,7 @@ LL | let _: &dyn EqAlias = &123; //~ ERROR `EqAlias` cannot be made into an error[E0191]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) must be specified --> $DIR/trait-alias-object.rs:8:13 | -LL | let _: &dyn IteratorAlias = &vec![123].into_iter(); //~ ERROR must be specified +LL | let _: &dyn IteratorAlias = &vec![123].into_iter(); | ^^^^^^^^^^^^^^^^^ associated type `Item` must be specified error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-alias-syntax.stderr b/src/test/ui/traits/trait-alias-syntax.stderr index fc96f6274393..f99cc45d8ae9 100644 --- a/src/test/ui/traits/trait-alias-syntax.stderr +++ b/src/test/ui/traits/trait-alias-syntax.stderr @@ -1,13 +1,13 @@ error: trait aliases cannot be `auto` --> $DIR/trait-alias-syntax.rs:4:19 | -LL | auto trait A = Foo; //~ ERROR trait aliases cannot be `auto` +LL | auto trait A = Foo; | ^ trait aliases cannot be `auto` error: trait aliases cannot be `unsafe` --> $DIR/trait-alias-syntax.rs:5:21 | -LL | unsafe trait B = Foo; //~ ERROR trait aliases cannot be `unsafe` +LL | unsafe trait B = Foo; | ^ trait aliases cannot be `unsafe` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-alias-wf.stderr b/src/test/ui/traits/trait-alias-wf.stderr index 1f64ce76dc6b..ee2dd5b24afe 100644 --- a/src/test/ui/traits/trait-alias-wf.stderr +++ b/src/test/ui/traits/trait-alias-wf.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: Foo` is not satisfied --> $DIR/trait-alias-wf.rs:5:1 | -LL | trait B = A; //~ ERROR `T: Foo` is not satisfied +LL | trait B = A; | ^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T` | = help: consider adding a `where T: Foo` bound diff --git a/src/test/ui/traits/trait-bounds-not-on-struct.stderr b/src/test/ui/traits/trait-bounds-not-on-struct.stderr index 1595fff618f0..a649a4eee557 100644 --- a/src/test/ui/traits/trait-bounds-not-on-struct.stderr +++ b/src/test/ui/traits/trait-bounds-not-on-struct.stderr @@ -1,13 +1,13 @@ error[E0404]: expected trait, found struct `Foo` --> $DIR/trait-bounds-not-on-struct.rs:5:16 | -LL | fn foo(_x: Box) { } //~ ERROR expected trait, found struct `Foo` +LL | fn foo(_x: Box) { } | ^^^ not a trait error[E0404]: expected trait, found struct `Vec` --> $DIR/trait-bounds-not-on-struct.rs:7:21 | -LL | type A = Box>; //~ ERROR expected trait, found struct `Vec` +LL | type A = Box>; | ^^^^^^ not a trait error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr index 5429029c1ec9..9a4cc90f3a5e 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr @@ -14,7 +14,7 @@ LL | struct Foo { error[E0277]: the trait bound `isize: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:19:5 | -LL | a: Foo, //~ ERROR E0277 +LL | a: Foo, | ^^^^^^^^^^^^^ the trait `Trait` is not implemented for `isize` | note: required by `Foo` @@ -26,7 +26,7 @@ LL | struct Foo { error[E0277]: the trait bound `usize: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:23:10 | -LL | Quux(Bar), //~ ERROR E0277 +LL | Quux(Bar), | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` | note: required by `Bar` @@ -38,7 +38,7 @@ LL | enum Bar { error[E0277]: the trait bound `U: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:27:5 | -LL | b: Foo, //~ ERROR E0277 +LL | b: Foo, | ^^^^^^^^^ the trait `Trait` is not implemented for `U` | = help: consider adding a `where U: Trait` bound @@ -51,7 +51,7 @@ LL | struct Foo { error[E0277]: the trait bound `V: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:31:21 | -LL | EvenMoreBadness(Bar), //~ ERROR E0277 +LL | EvenMoreBadness(Bar), | ^^^^^^ the trait `Trait` is not implemented for `V` | = help: consider adding a `where V: Trait` bound @@ -64,7 +64,7 @@ LL | enum Bar { error[E0277]: the trait bound `i32: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:35:5 | -LL | Foo, //~ ERROR E0277 +LL | Foo, | ^^^^^^^^ the trait `Trait` is not implemented for `i32` | note: required by `Foo` @@ -76,7 +76,7 @@ LL | struct Foo { error[E0277]: the trait bound `u8: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:39:22 | -LL | DictionaryLike { field: Bar }, //~ ERROR E0277 +LL | DictionaryLike { field: Bar }, | ^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u8` | note: required by `Bar` diff --git a/src/test/ui/traits/trait-bounds-sugar.stderr b/src/test/ui/traits/trait-bounds-sugar.stderr index eb45a16afb1c..2aa025cb7a68 100644 --- a/src/test/ui/traits/trait-bounds-sugar.stderr +++ b/src/test/ui/traits/trait-bounds-sugar.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/trait-bounds-sugar.rs:12:7 | -LL | a(x); //~ ERROR mismatched types +LL | a(x); | ^ expected trait `Foo + std::marker::Send`, found trait `Foo + std::marker::Sync` | = note: expected type `std::boxed::Box<(dyn Foo + std::marker::Send + 'static)>` diff --git a/src/test/ui/traits/trait-coercion-generic-regions.stderr b/src/test/ui/traits/trait-coercion-generic-regions.stderr index 23c2a72743ee..2a9ca4f95f0b 100644 --- a/src/test/ui/traits/trait-coercion-generic-regions.stderr +++ b/src/test/ui/traits/trait-coercion-generic-regions.stderr @@ -1,7 +1,7 @@ error[E0597]: `person` does not live long enough --> $DIR/trait-coercion-generic-regions.rs:17:25 | -LL | let person: &str = &person; //~ ERROR `person` does not live long enough +LL | let person: &str = &person; | ^^^^^^ borrowed value does not live long enough LL | let s: Box> = Box::new(Struct { person: person }); LL | } diff --git a/src/test/ui/traits/trait-duplicate-methods.stderr b/src/test/ui/traits/trait-duplicate-methods.stderr index bb6d0b6d7f14..7cba4cb63e6b 100644 --- a/src/test/ui/traits/trait-duplicate-methods.stderr +++ b/src/test/ui/traits/trait-duplicate-methods.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `orange` is defined multiple times | LL | fn orange(&self); | ----------------- previous definition of the value `orange` here -LL | fn orange(&self); //~ ERROR the name `orange` is defined multiple times +LL | fn orange(&self); | ^^^^^^^^^^^^^^^^^ `orange` redefined here | = note: `orange` must be defined only once in the value namespace of this trait diff --git a/src/test/ui/traits/trait-impl-1.stderr b/src/test/ui/traits/trait-impl-1.stderr index 8ee642974b72..71d5cc26bf14 100644 --- a/src/test/ui/traits/trait-impl-1.stderr +++ b/src/test/ui/traits/trait-impl-1.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `foo` found for type `&i32` in the current scope --> $DIR/trait-impl-1.rs:15:7 | -LL | x.foo(); //~ERROR: no method named `foo` found for type `&i32` in the current scope +LL | x.foo(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr b/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr index 5a50a1108632..84565bdaa135 100644 --- a/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr +++ b/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr @@ -1,19 +1,19 @@ error[E0438]: const `BAR` is not a member of trait `A` --> $DIR/trait-impl-can-not-have-untraitful-items.rs:4:5 | -LL | const BAR: () = (); //~ ERROR const `BAR` is not a member of trait `A` +LL | const BAR: () = (); | ^^^^^^^^^^^^^^^^^^^ not a member of trait `A` error[E0437]: type `Baz` is not a member of trait `A` --> $DIR/trait-impl-can-not-have-untraitful-items.rs:5:5 | -LL | type Baz = (); //~ ERROR type `Baz` is not a member of trait `A` +LL | type Baz = (); | ^^^^^^^^^^^^^^ not a member of trait `A` error[E0407]: method `foo` is not a member of trait `A` --> $DIR/trait-impl-can-not-have-untraitful-items.rs:6:5 | -LL | fn foo(&self) { } //~ ERROR method `foo` is not a member of trait `A` +LL | fn foo(&self) { } | ^^^^^^^^^^^^^^^^^ not a member of trait `A` error: aborting due to 3 previous errors diff --git a/src/test/ui/traits/trait-impl-for-module.stderr b/src/test/ui/traits/trait-impl-for-module.stderr index 99da4b7c87af..c62bcfca94de 100644 --- a/src/test/ui/traits/trait-impl-for-module.stderr +++ b/src/test/ui/traits/trait-impl-for-module.stderr @@ -1,7 +1,7 @@ error[E0573]: expected type, found module `a` --> $DIR/trait-impl-for-module.rs:7:12 | -LL | impl A for a { //~ ERROR expected type, found module +LL | impl A for a { | ^ help: a trait with a similar name exists: `A` error: aborting due to previous error diff --git a/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr index 95dc6364e13c..4c63d6097758 100644 --- a/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr +++ b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr @@ -1,18 +1,18 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:13 | -LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { //~ ERROR cannot infer an appropriate lifetime +LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { | ^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 24:6... --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:6 | -LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { //~ ERROR cannot infer an appropriate lifetime +LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { | ^^ note: ...but the lifetime must also be valid for the lifetime 'b as defined on the impl at 24:9... --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:9 | -LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { //~ ERROR cannot infer an appropriate lifetime +LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { | ^^ = note: ...so that the types are compatible: expected T1<'a> diff --git a/src/test/ui/traits/trait-item-privacy.stderr b/src/test/ui/traits/trait-item-privacy.stderr index c65a9a3ed945..97e7ed0ebb07 100644 --- a/src/test/ui/traits/trait-item-privacy.stderr +++ b/src/test/ui/traits/trait-item-privacy.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `a` found for type `S` in the current scope LL | struct S; | --------- method `a` not found for this ... -LL | S.a(); //~ ERROR no method named `a` found for type `S` in the current scope +LL | S.a(); | ^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -17,7 +17,7 @@ error[E0599]: no method named `b` found for type `S` in the current scope LL | struct S; | --------- method `b` not found for this ... -LL | S.b(); //~ ERROR no method named `b` found for type `S` in the current scope +LL | S.b(); | ^ | = help: items from traits can only be used if the trait is in scope @@ -29,7 +29,7 @@ LL | use method::B; error[E0624]: method `a` is private --> $DIR/trait-item-privacy.rs:72:7 | -LL | c.a(); //~ ERROR method `a` is private +LL | c.a(); | ^ error[E0599]: no function or associated item named `a` found for type `S` in the current scope @@ -67,7 +67,7 @@ LL | use method::B; error[E0624]: method `a` is private --> $DIR/trait-item-privacy.rs:84:5 | -LL | C::a(&S); //~ ERROR method `a` is private +LL | C::a(&S); | ^^^^ error[E0599]: no associated item named `A` found for type `S` in the current scope @@ -76,7 +76,7 @@ error[E0599]: no associated item named `A` found for type `S` in the current sco LL | struct S; | --------- associated item `A` not found for this ... -LL | S::A; //~ ERROR no associated item named `A` found for type `S` in the current scope +LL | S::A; | ---^ | | | associated item not found in `S` @@ -91,7 +91,7 @@ error[E0599]: no associated item named `B` found for type `S` in the current sco LL | struct S; | --------- associated item `B` not found for this ... -LL | S::B; //~ ERROR no associated item named `B` found for type `S` in the current scope +LL | S::B; | ---^ | | | associated item not found in `S` @@ -105,13 +105,13 @@ LL | use assoc_const::B; error[E0624]: associated constant `A` is private --> $DIR/trait-item-privacy.rs:101:5 | -LL | C::A; //~ ERROR associated constant `A` is private +LL | C::A; | ^^^^ error[E0038]: the trait `assoc_const::C` cannot be made into an object --> $DIR/trait-item-privacy.rs:101:5 | -LL | C::A; //~ ERROR associated constant `A` is private +LL | C::A; | ^^^^ the trait `assoc_const::C` cannot be made into an object | = note: the trait cannot contain associated consts like `C` @@ -121,31 +121,31 @@ LL | C::A; //~ ERROR associated constant `A` is private error[E0223]: ambiguous associated type --> $DIR/trait-item-privacy.rs:115:12 | -LL | let _: S::A; //~ ERROR ambiguous associated type +LL | let _: S::A; | ^^^^ help: use fully-qualified syntax: `::A` error[E0223]: ambiguous associated type --> $DIR/trait-item-privacy.rs:116:12 | -LL | let _: S::B; //~ ERROR ambiguous associated type +LL | let _: S::B; | ^^^^ help: use fully-qualified syntax: `::B` error[E0223]: ambiguous associated type --> $DIR/trait-item-privacy.rs:117:12 | -LL | let _: S::C; //~ ERROR ambiguous associated type +LL | let _: S::C; | ^^^^ help: use fully-qualified syntax: `::C` error: associated type `A` is private --> $DIR/trait-item-privacy.rs:119:12 | -LL | let _: T::A; //~ ERROR associated type `A` is private +LL | let _: T::A; | ^^^^ error: associated type `A` is private --> $DIR/trait-item-privacy.rs:128:9 | -LL | A = u8, //~ ERROR associated type `A` is private +LL | A = u8, | ^^^^^^ error: aborting due to 15 previous errors diff --git a/src/test/ui/traits/trait-method-private.stderr b/src/test/ui/traits/trait-method-private.stderr index ed6aeeb9c898..c1dd9387ebc4 100644 --- a/src/test/ui/traits/trait-method-private.stderr +++ b/src/test/ui/traits/trait-method-private.stderr @@ -1,7 +1,7 @@ error[E0624]: method `method` is private --> $DIR/trait-method-private.rs:19:9 | -LL | foo.method(); //~ ERROR is private +LL | foo.method(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope diff --git a/src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr b/src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr index 2d2c3843548e..2570db0212aa 100644 --- a/src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr +++ b/src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr @@ -1,7 +1,7 @@ error[E0592]: duplicate definitions with name `test` --> $DIR/trait-object-auto-dedup-in-impl.rs:14:5 | -LL | fn test(&self) { println!("one"); } //~ ERROR duplicate definitions with name `test` +LL | fn test(&self) { println!("one"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `test` ... LL | fn test(&self) { println!("two"); } diff --git a/src/test/ui/traits/trait-object-macro-matcher.stderr b/src/test/ui/traits/trait-object-macro-matcher.stderr index 678f4fb59557..3a6bf3dcc8ce 100644 --- a/src/test/ui/traits/trait-object-macro-matcher.stderr +++ b/src/test/ui/traits/trait-object-macro-matcher.stderr @@ -1,13 +1,13 @@ error[E0224]: at least one non-builtin trait is required for an object type --> $DIR/trait-object-macro-matcher.rs:10:8 | -LL | m!('static +); //~ ERROR at least one non-builtin trait is required for an object type +LL | m!('static +); | ^^^^^^^^^ error[E0038]: the trait `std::marker::Copy` cannot be made into an object --> $DIR/trait-object-macro-matcher.rs:8:8 | -LL | m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object +LL | m!(Copy + Send + 'static); | ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/traits/trait-object-safety.stderr b/src/test/ui/traits/trait-object-safety.stderr index 0a0c5ff086b5..a7fe83cb7564 100644 --- a/src/test/ui/traits/trait-object-safety.stderr +++ b/src/test/ui/traits/trait-object-safety.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `Tr` cannot be made into an object --> $DIR/trait-object-safety.rs:15:18 | -LL | let _: &Tr = &St; //~ ERROR E0038 +LL | let _: &Tr = &St; | ^^^ the trait `Tr` cannot be made into an object | = note: method `foo` has no receiver @@ -10,7 +10,7 @@ LL | let _: &Tr = &St; //~ ERROR E0038 error[E0038]: the trait `Tr` cannot be made into an object --> $DIR/trait-object-safety.rs:15:12 | -LL | let _: &Tr = &St; //~ ERROR E0038 +LL | let _: &Tr = &St; | ^^^ the trait `Tr` cannot be made into an object | = note: method `foo` has no receiver diff --git a/src/test/ui/traits/trait-or-new-type-instead.stderr b/src/test/ui/traits/trait-or-new-type-instead.stderr index e8bd20019a89..4726b0668e51 100644 --- a/src/test/ui/traits/trait-or-new-type-instead.stderr +++ b/src/test/ui/traits/trait-or-new-type-instead.stderr @@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/trait-or-new-type-instead.rs:1:1 | LL | / impl Option { -LL | | //~^ ERROR cannot define inherent `impl` for a type outside of the crate where the type is defined +LL | | LL | | pub fn foo(&self) { } LL | | } | |_^ impl for type defined outside of crate. diff --git a/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr b/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr index 2c644480f0a5..3b10632b818c 100644 --- a/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr +++ b/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `*` cannot be applied to type `&T` --> $DIR/trait-resolution-in-overloaded-op.rs:8:5 | -LL | a * b //~ ERROR binary operation `*` cannot be applied to type `&T` +LL | a * b | ^^^^^ | = note: an implementation of `std::ops::Mul` might be missing for `&T` diff --git a/src/test/ui/traits/trait-safety-inherent-impl.stderr b/src/test/ui/traits/trait-safety-inherent-impl.stderr index 969b16633ce3..3911261083ec 100644 --- a/src/test/ui/traits/trait-safety-inherent-impl.stderr +++ b/src/test/ui/traits/trait-safety-inherent-impl.stderr @@ -1,7 +1,7 @@ error[E0197]: inherent impls cannot be unsafe --> $DIR/trait-safety-inherent-impl.rs:5:1 | -LL | / unsafe impl SomeStruct { //~ ERROR inherent impls cannot be unsafe +LL | / unsafe impl SomeStruct { LL | | fn foo(self) { } LL | | } | |_^ diff --git a/src/test/ui/traits/trait-safety-trait-impl-cc.stderr b/src/test/ui/traits/trait-safety-trait-impl-cc.stderr index 3be72fbfdd72..5234e205a84b 100644 --- a/src/test/ui/traits/trait-safety-trait-impl-cc.stderr +++ b/src/test/ui/traits/trait-safety-trait-impl-cc.stderr @@ -1,7 +1,7 @@ error[E0200]: the trait `lib::Foo` requires an `unsafe impl` declaration --> $DIR/trait-safety-trait-impl-cc.rs:9:1 | -LL | / impl lib::Foo for Bar { //~ ERROR requires an `unsafe impl` declaration +LL | / impl lib::Foo for Bar { LL | | fn foo(&self) -> isize { LL | | panic!(); LL | | } diff --git a/src/test/ui/traits/trait-safety-trait-impl.stderr b/src/test/ui/traits/trait-safety-trait-impl.stderr index 22e9b4d4035e..c83a2cd71e55 100644 --- a/src/test/ui/traits/trait-safety-trait-impl.stderr +++ b/src/test/ui/traits/trait-safety-trait-impl.stderr @@ -1,13 +1,13 @@ error[E0200]: the trait `UnsafeTrait` requires an `unsafe impl` declaration --> $DIR/trait-safety-trait-impl.rs:14:1 | -LL | impl UnsafeTrait for u16 { } //~ ERROR requires an `unsafe impl` declaration +LL | impl UnsafeTrait for u16 { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0199]: implementing the trait `SafeTrait` is not unsafe --> $DIR/trait-safety-trait-impl.rs:16:1 | -LL | unsafe impl SafeTrait for u32 { } //~ ERROR the trait `SafeTrait` is not unsafe +LL | unsafe impl SafeTrait for u32 { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-test-2.stderr b/src/test/ui/traits/trait-test-2.stderr index c01317f3d5b9..4d61ac67deda 100644 --- a/src/test/ui/traits/trait-test-2.stderr +++ b/src/test/ui/traits/trait-test-2.stderr @@ -1,13 +1,13 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/trait-test-2.rs:9:14 | -LL | 10.dup::(); //~ ERROR wrong number of type arguments: expected 0, found 1 +LL | 10.dup::(); | ^^^ unexpected type argument error[E0107]: wrong number of type arguments: expected 1, found 2 --> $DIR/trait-test-2.rs:10:20 | -LL | 10.blah::(); //~ ERROR wrong number of type arguments: expected 1, found 2 +LL | 10.blah::(); | ^^^ unexpected type argument error[E0038]: the trait `bar` cannot be made into an object diff --git a/src/test/ui/traits/trait-test.stderr b/src/test/ui/traits/trait-test.stderr index 2383175d513b..f5e47e51526c 100644 --- a/src/test/ui/traits/trait-test.stderr +++ b/src/test/ui/traits/trait-test.stderr @@ -1,7 +1,7 @@ error[E0404]: expected trait, found builtin type `isize` --> $DIR/trait-test.rs:4:6 | -LL | impl isize for usize { fn foo(&self) {} } //~ ERROR trait +LL | impl isize for usize { fn foo(&self) {} } | ^^^^^ not a trait error: aborting due to previous error diff --git a/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr b/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr index ce1aadca597c..44643e8c8de4 100644 --- a/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr +++ b/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving ` as std::iter::Iterator>::Item == u32` --> $DIR/traits-assoc-type-in-supertrait-bad.rs:11:6 | -LL | impl Foo for IntoIter { //~ ERROR type mismatch +LL | impl Foo for IntoIter { | ^^^ expected i32, found u32 | = note: expected type `i32` diff --git a/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr index 7aa9809c0745..a91be8e69ac3 100644 --- a/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr +++ b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr @@ -1,13 +1,13 @@ error[E0568]: auto traits cannot have super traits --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:7:1 | -LL | auto trait Magic: Copy {} //~ ERROR E0568 +LL | auto trait Magic: Copy {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `NoClone: std::marker::Copy` is not satisfied --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:15:18 | -LL | let (a, b) = copy(NoClone); //~ ERROR +LL | let (a, b) = copy(NoClone); | ^^^^ the trait `std::marker::Copy` is not implemented for `NoClone` | = note: required because of the requirements on the impl of `Magic` for `NoClone` diff --git a/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr b/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr index d4b3b6b7d716..769582a778bc 100644 --- a/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr +++ b/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr @@ -1,7 +1,7 @@ error[E0275]: overflow evaluating the requirement `NoClone: Magic` --> $DIR/traits-inductive-overflow-supertrait.rs:13:18 | -LL | let (a, b) = copy(NoClone); //~ ERROR E0275 +LL | let (a, b) = copy(NoClone); | ^^^^ | = note: required because of the requirements on the impl of `Magic` for `NoClone` diff --git a/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr b/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr index cee9aa348c38..61adbf00f718 100644 --- a/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr +++ b/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr @@ -1,7 +1,7 @@ error[E0275]: overflow evaluating the requirement `*mut (): Magic` --> $DIR/traits-inductive-overflow-two-traits.rs:19:5 | -LL | wizard::<*mut ()>(); //~ ERROR E0275 +LL | wizard::<*mut ()>(); | ^^^^^^^^^^^^^^^^^ | note: required by `wizard` diff --git a/src/test/ui/traits/traits-multidispatch-bad.stderr b/src/test/ui/traits/traits-multidispatch-bad.stderr index d6c6697c3c0e..5b800114aa8d 100644 --- a/src/test/ui/traits/traits-multidispatch-bad.stderr +++ b/src/test/ui/traits/traits-multidispatch-bad.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/traits-multidispatch-bad.rs:19:17 | -LL | test(22i32, 44i32); //~ ERROR mismatched types +LL | test(22i32, 44i32); | ^^^^^ expected u32, found i32 error: aborting due to previous error diff --git a/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr b/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr index f906378eb3cb..5d1c91376868 100644 --- a/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr +++ b/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr @@ -1,13 +1,13 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:26:7 | -LL | c.same_as(22) //~ ERROR `dyn CompareToInts: CompareTo` is not satisfied +LL | c.same_as(22) | ^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` error[E0277]: the trait bound `C: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:30:7 | -LL | c.same_as(22) //~ ERROR `C: CompareTo` is not satisfied +LL | c.same_as(22) | ^^^^^^^ the trait `CompareTo` is not implemented for `C` | = help: consider adding a `where C: CompareTo` bound @@ -15,7 +15,7 @@ LL | c.same_as(22) //~ ERROR `C: CompareTo` is not satisfied error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:34:5 | -LL | CompareToInts::same_as(c, 22) //~ ERROR `dyn CompareToInts: CompareTo` is not satisfied +LL | CompareToInts::same_as(c, 22) | ^^^^^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` | note: required by `CompareTo::same_as` @@ -27,7 +27,7 @@ LL | fn same_as(&self, t: T) -> bool; error[E0277]: the trait bound `C: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:38:5 | -LL | CompareTo::same_as(c, 22) //~ ERROR `C: CompareTo` is not satisfied +LL | CompareTo::same_as(c, 22) | ^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `C` | = help: consider adding a `where C: CompareTo` bound @@ -40,7 +40,7 @@ LL | fn same_as(&self, t: T) -> bool; error[E0277]: the trait bound `i64: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:42:23 | -LL | assert_eq!(22_i64.same_as(22), true); //~ ERROR `i64: CompareTo` is not satisfied +LL | assert_eq!(22_i64.same_as(22), true); | ^^^^^^^ the trait `CompareTo` is not implemented for `i64` | = help: the following implementations were found: diff --git a/src/test/ui/transmute-equal-assoc-types.stderr b/src/test/ui/transmute-equal-assoc-types.stderr index 46bbf1c18588..ce7657f9640b 100644 --- a/src/test/ui/transmute-equal-assoc-types.stderr +++ b/src/test/ui/transmute-equal-assoc-types.stderr @@ -1,7 +1,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-equal-assoc-types.rs:6:5 | -LL | ::std::mem::transmute(foo) //~ ERROR cannot transmute between types of different sizes +LL | ::std::mem::transmute(foo) | ^^^^^^^^^^^^^^^^^^^^^ | = note: `::Bar` does not have a fixed size diff --git a/src/test/ui/transmute/main.stderr b/src/test/ui/transmute/main.stderr index f4e88fc860ac..c72876e050f0 100644 --- a/src/test/ui/transmute/main.stderr +++ b/src/test/ui/transmute/main.stderr @@ -1,7 +1,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/main.rs:16:5 | -LL | transmute(x) //~ ERROR cannot transmute between types of different sizes +LL | transmute(x) | ^^^^^^^^^ | = note: source type: `>::T` (size can vary because of ::T) @@ -10,7 +10,7 @@ LL | transmute(x) //~ ERROR cannot transmute between types of different size error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/main.rs:20:17 | -LL | let x: u8 = transmute(10u16); //~ ERROR cannot transmute between types of different sizes +LL | let x: u8 = transmute(10u16); | ^^^^^^^^^ | = note: source type: `u16` (16 bits) @@ -19,7 +19,7 @@ LL | let x: u8 = transmute(10u16); //~ ERROR cannot transmute between types error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/main.rs:24:17 | -LL | let x: u8 = transmute("test"); //~ ERROR cannot transmute between types of different sizes +LL | let x: u8 = transmute("test"); | ^^^^^^^^^ | = note: source type: `&str` ($STR bits) @@ -28,7 +28,7 @@ LL | let x: u8 = transmute("test"); //~ ERROR cannot transmute between types error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/main.rs:29:18 | -LL | let x: Foo = transmute(10); //~ ERROR cannot transmute between types of different sizes +LL | let x: Foo = transmute(10); | ^^^^^^^^^ | = note: source type: `i32` (32 bits) diff --git a/src/test/ui/transmute/transmute-fat-pointers.stderr b/src/test/ui/transmute/transmute-fat-pointers.stderr index 4b34950881a4..e8335fcbed9d 100644 --- a/src/test/ui/transmute/transmute-fat-pointers.stderr +++ b/src/test/ui/transmute/transmute-fat-pointers.stderr @@ -1,7 +1,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-fat-pointers.rs:10:14 | -LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes +LL | unsafe { transmute(x) } | ^^^^^^^^^ | = note: source type: `&[T]` (N bits) @@ -10,7 +10,7 @@ LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of dif error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-fat-pointers.rs:14:14 | -LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes +LL | unsafe { transmute(x) } | ^^^^^^^^^ | = note: source type: `&T` (pointer to `T`) @@ -19,7 +19,7 @@ LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of dif error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-fat-pointers.rs:26:14 | -LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes +LL | unsafe { transmute(x) } | ^^^^^^^^^ | = note: source type: `&T` (pointer to `T`) @@ -28,7 +28,7 @@ LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of dif error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-fat-pointers.rs:30:14 | -LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes +LL | unsafe { transmute(x) } | ^^^^^^^^^ | = note: source type: `&T` (N bits) diff --git a/src/test/ui/transmute/transmute-impl.stderr b/src/test/ui/transmute/transmute-impl.stderr index 8acc0aaf3ab5..dd19bcd54e32 100644 --- a/src/test/ui/transmute/transmute-impl.stderr +++ b/src/test/ui/transmute/transmute-impl.stderr @@ -1,7 +1,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-impl.rs:21:18 | -LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes +LL | unsafe { transmute(x) } | ^^^^^^^^^ | = note: source type: `&T` (pointer to `T`) diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr index a3995b7edefa..adaeb9b5d5da 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr @@ -3,7 +3,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference | LL | fn reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- use `&'a mut &'a mut i32` here to make mutable -LL | *t //~ ERROR +LL | *t | ^^ assignment into an immutable reference error[E0389]: cannot borrow data mutably in a `&` reference @@ -11,7 +11,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference | LL | fn copy_reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- use `&'a mut &'a mut i32` here to make mutable -LL | {*t} //~ ERROR +LL | {*t} | ^^ assignment into an immutable reference error: aborting due to 2 previous errors diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr index f769f23f115f..7c1a83344274 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn global_bound_is_hidden() -> u8 | -- expected `u8` because of return type ... -LL | B::get_x() //~ ERROR +LL | B::get_x() | ^^^^^^^^^^ expected u8, found i32 error: aborting due to previous error diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr index b8e669d4a7c3..68d8129843e6 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/trivial-bounds-leak-copy.rs:9:5 | -LL | *t //~ ERROR +LL | *t | ^^ cannot move out of borrowed content error: aborting due to previous error diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr index aa055d3dc03f..3de683e5661a 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/trivial-bounds-leak.rs:12:25 | -LL | fn cant_return_str() -> str { //~ ERROR +LL | fn cant_return_str() -> str { | ^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` @@ -11,7 +11,7 @@ LL | fn cant_return_str() -> str { //~ ERROR error[E0599]: no method named `test` found for type `i32` in the current scope --> $DIR/trivial-bounds-leak.rs:24:10 | -LL | 3i32.test(); //~ ERROR +LL | 3i32.test(); | ^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -21,7 +21,7 @@ LL | 3i32.test(); //~ ERROR error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/trivial-bounds-leak.rs:25:5 | -LL | Foo::test(&4i32); //~ ERROR +LL | Foo::test(&4i32); | ^^^^^^^^^ the trait `Foo` is not implemented for `i32` | note: required by `Foo::test` @@ -33,7 +33,7 @@ LL | fn test(&self); error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/trivial-bounds-leak.rs:26:5 | -LL | generic_function(5i32); //~ ERROR +LL | generic_function(5i32); | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | note: required by `generic_function` diff --git a/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr b/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr index 6518e9028788..2f4b2df24cd5 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr @@ -1,7 +1,7 @@ error: Trait bound i32: std::marker::Copy does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-lint.rs:5:21 | -LL | struct A where i32: Copy; //~ ERROR +LL | struct A where i32: Copy; | ^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(trivial_bounds)] error: Trait bound i32: X<()> does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-lint.rs:18:30 | -LL | fn global_param() where i32: X<()> {} //~ ERROR +LL | fn global_param() where i32: X<()> {} | ^^^^^ error: Trait bound i32: Z does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-lint.rs:22:35 | -LL | fn global_projection() where i32: Z {} //~ ERROR +LL | fn global_projection() where i32: Z {} | ^^^^^^^^^^ error: Lifetime bound i32 : 'static does not depend on any type or lifetime parameters @@ -37,13 +37,13 @@ LL | fn global_lifetimes() where i32: 'static, &'static str: 'static {} error: Lifetime bound 'static : 'static does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-lint.rs:35:37 | -LL | fn global_outlives() where 'static: 'static {} //~ ERROR +LL | fn global_outlives() where 'static: 'static {} | ^^^^^^^ error: Trait bound i32: std::marker::Copy does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-lint.rs:38:46 | -LL | fn mixed_bounds() where i32: X + Copy {} //~ ERROR +LL | fn mixed_bounds() where i32: X + Copy {} | ^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/trivial_casts.stderr b/src/test/ui/trivial_casts.stderr index fb1db76b1389..524eb7feaafb 100644 --- a/src/test/ui/trivial_casts.stderr +++ b/src/test/ui/trivial_casts.stderr @@ -1,7 +1,7 @@ error: trivial numeric cast: `i32` as `i32` --> $DIR/trivial_casts.rs:16:13 | -LL | let _ = 42_i32 as i32; //~ ERROR trivial numeric cast: `i32` as `i32` +LL | let _ = 42_i32 as i32; | ^^^^^^^^^^^^^ | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![deny(trivial_casts, trivial_numeric_casts)] error: trivial numeric cast: `u8` as `u8` --> $DIR/trivial_casts.rs:19:13 | -LL | let _ = 42_u8 as u8; //~ ERROR trivial numeric cast: `u8` as `u8` +LL | let _ = 42_u8 as u8; | ^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -22,7 +22,7 @@ LL | let _ = 42_u8 as u8; //~ ERROR trivial numeric cast: `u8` as `u8` error: trivial cast: `&u32` as `*const u32` --> $DIR/trivial_casts.rs:24:13 | -LL | let _ = x as *const u32; //~ERROR trivial cast: `&u32` as `*const u32` +LL | let _ = x as *const u32; | ^^^^^^^^^^^^^^^ | note: lint level defined here @@ -35,7 +35,7 @@ LL | #![deny(trivial_casts, trivial_numeric_casts)] error: trivial cast: `&mut u32` as `*mut u32` --> $DIR/trivial_casts.rs:28:13 | -LL | let _ = x as *mut u32; //~ERROR trivial cast: `&mut u32` as `*mut u32` +LL | let _ = x as *mut u32; | ^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -43,7 +43,7 @@ LL | let _ = x as *mut u32; //~ERROR trivial cast: `&mut u32` as `*mut u32` error: trivial cast: `&[u32; 3]` as `&[u32]` --> $DIR/trivial_casts.rs:33:13 | -LL | let _ = x as &[u32]; //~ERROR trivial cast: `&[u32; 3]` as `&[u32]` +LL | let _ = x as &[u32]; | ^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -51,7 +51,7 @@ LL | let _ = x as &[u32]; //~ERROR trivial cast: `&[u32; 3]` as `&[u32]` error: trivial cast: `&[u32; 3]` as `*const [u32]` --> $DIR/trivial_casts.rs:34:13 | -LL | let _ = x as *const [u32]; //~ERROR trivial cast: `&[u32; 3]` as `*const [u32]` +LL | let _ = x as *const [u32]; | ^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -59,7 +59,7 @@ LL | let _ = x as *const [u32]; //~ERROR trivial cast: `&[u32; 3]` as `*cons error: trivial cast: `&mut [u32; 3]` as `&mut [u32]` --> $DIR/trivial_casts.rs:39:13 | -LL | let _ = x as &mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `&mut [u32]` +LL | let _ = x as &mut [u32]; | ^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -67,7 +67,7 @@ LL | let _ = x as &mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `&mu error: trivial cast: `&mut [u32; 3]` as `*mut [u32]` --> $DIR/trivial_casts.rs:40:13 | -LL | let _ = x as *mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `*mut [u32]` +LL | let _ = x as *mut [u32]; | ^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -83,7 +83,7 @@ LL | let _ = x as Box<[u32]>; error: trivial cast: `&Bar` as `&dyn Foo` --> $DIR/trivial_casts.rs:52:13 | -LL | let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo` +LL | let _ = x as &Foo; | ^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -91,7 +91,7 @@ LL | let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo` error: trivial cast: `&Bar` as `*const dyn Foo` --> $DIR/trivial_casts.rs:53:13 | -LL | let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const dyn Foo` +LL | let _ = x as *const Foo; | ^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -99,7 +99,7 @@ LL | let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const dyn F error: trivial cast: `&mut Bar` as `&mut dyn Foo` --> $DIR/trivial_casts.rs:58:13 | -LL | let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn Foo` +LL | let _ = x as &mut Foo; | ^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -107,7 +107,7 @@ LL | let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn F error: trivial cast: `&mut Bar` as `*mut dyn Foo` --> $DIR/trivial_casts.rs:59:13 | -LL | let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn Foo` +LL | let _ = x as *mut Foo; | ^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -115,7 +115,7 @@ LL | let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn F error: trivial cast: `std::boxed::Box` as `std::boxed::Box` --> $DIR/trivial_casts.rs:64:13 | -LL | let _ = x as Box; //~ERROR `std::boxed::Box` as `std::boxed::Box` +LL | let _ = x as Box; | ^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -123,7 +123,7 @@ LL | let _ = x as Box; //~ERROR `std::boxed::Box` as `std::boxed:: error: trivial cast: `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)` --> $DIR/trivial_casts.rs:70:13 | -LL | let _ = &baz as &Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)` +LL | let _ = &baz as &Fn(i32); | ^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -131,7 +131,7 @@ LL | let _ = &baz as &Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std: error: trivial cast: `&[closure@$DIR/trivial_casts.rs:72:13: 72:25]` as `&dyn std::ops::Fn(i32)` --> $DIR/trivial_casts.rs:73:13 | -LL | let _ = &x as &Fn(i32); //~ERROR trivial cast +LL | let _ = &x as &Fn(i32); | ^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -139,7 +139,7 @@ LL | let _ = &x as &Fn(i32); //~ERROR trivial cast error: trivial cast: `&'a Bar` as `&'a Bar` --> $DIR/trivial_casts.rs:79:13 | -LL | let _ = a as &'a Bar; //~ERROR trivial cast +LL | let _ = a as &'a Bar; | ^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -147,7 +147,7 @@ LL | let _ = a as &'a Bar; //~ERROR trivial cast error: trivial cast: `&'b Bar` as `&'a Bar` --> $DIR/trivial_casts.rs:81:13 | -LL | let _ = b as &'a Bar; //~ERROR trivial cast +LL | let _ = b as &'a Bar; | ^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -155,7 +155,7 @@ LL | let _ = b as &'a Bar; //~ERROR trivial cast error: trivial cast: `&'b Bar` as `&'b Bar` --> $DIR/trivial_casts.rs:83:13 | -LL | let _ = b as &'b Bar; //~ERROR trivial cast +LL | let _ = b as &'b Bar; | ^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable diff --git a/src/test/ui/try-block/try-block-bad-lifetime.stderr b/src/test/ui/try-block/try-block-bad-lifetime.stderr index b1b925d694ff..a236cb90557b 100644 --- a/src/test/ui/try-block/try-block-bad-lifetime.stderr +++ b/src/test/ui/try-block/try-block-bad-lifetime.stderr @@ -16,10 +16,10 @@ error[E0506]: cannot assign to `i` because it is borrowed LL | let k = &mut i; | ------ borrow of `i` occurs here ... -LL | i = 10; //~ ERROR cannot assign to `i` because it is borrowed +LL | i = 10; | ^^^^^^ assignment to borrowed `i` occurs here LL | }; -LL | ::std::mem::drop(k); //~ ERROR use of moved value: `k` +LL | ::std::mem::drop(k); | - borrow later used here error[E0382]: use of moved value: `k` @@ -31,7 +31,7 @@ LL | let mut j: Result<(), &mut i32> = try { LL | Err(k) ?; | - value moved here ... -LL | ::std::mem::drop(k); //~ ERROR use of moved value: `k` +LL | ::std::mem::drop(k); | ^ value used here after move error[E0506]: cannot assign to `i` because it is borrowed @@ -40,7 +40,7 @@ error[E0506]: cannot assign to `i` because it is borrowed LL | let k = &mut i; | ------ borrow of `i` occurs here ... -LL | i = 40; //~ ERROR cannot assign to `i` because it is borrowed +LL | i = 40; | ^^^^^^ assignment to borrowed `i` occurs here LL | LL | let i_ptr = if let Err(i_ptr) = j { i_ptr } else { panic ! ("") }; diff --git a/src/test/ui/try-block/try-block-bad-type.stderr b/src/test/ui/try-block/try-block-bad-type.stderr index df8e646280c9..6687bd9d9e1f 100644 --- a/src/test/ui/try-block/try-block-bad-type.stderr +++ b/src/test/ui/try-block/try-block-bad-type.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `i32: std::convert::From<&str>` is not satisfied --> $DIR/try-block-bad-type.rs:7:9 | -LL | Err("")?; //~ ERROR the trait bound `i32: std::convert::From<&str>` is not satisfied +LL | Err("")?; | ^^^^^^^^ the trait `std::convert::From<&str>` is not implemented for `i32` | = help: the following implementations were found: @@ -15,7 +15,7 @@ LL | Err("")?; //~ ERROR the trait bound `i32: std::convert::From<&str>` error[E0271]: type mismatch resolving ` as std::ops::Try>::Ok == &str` --> $DIR/try-block-bad-type.rs:12:9 | -LL | "" //~ ERROR type mismatch +LL | "" | ^^ expected i32, found &str | = note: expected type `i32` @@ -24,7 +24,7 @@ LL | "" //~ ERROR type mismatch error[E0271]: type mismatch resolving ` as std::ops::Try>::Ok == ()` --> $DIR/try-block-bad-type.rs:15:39 | -LL | let res: Result = try { }; //~ ERROR type mismatch +LL | let res: Result = try { }; | ^ expected i32, found () | = note: expected type `i32` @@ -33,7 +33,7 @@ LL | let res: Result = try { }; //~ ERROR type mismatch error[E0277]: the trait bound `(): std::ops::Try` is not satisfied --> $DIR/try-block-bad-type.rs:17:23 | -LL | let res: () = try { }; //~ the trait bound `(): std::ops::Try` is not satisfied +LL | let res: () = try { }; | ^^^ the trait `std::ops::Try` is not implemented for `()` | = note: required by `std::ops::Try::from_ok` @@ -41,7 +41,7 @@ LL | let res: () = try { }; //~ the trait bound `(): std::ops::Try` is not s error[E0277]: the trait bound `i32: std::ops::Try` is not satisfied --> $DIR/try-block-bad-type.rs:19:24 | -LL | let res: i32 = try { 5 }; //~ ERROR the trait bound `i32: std::ops::Try` is not satisfied +LL | let res: i32 = try { 5 }; | ^^^^^ the trait `std::ops::Try` is not implemented for `i32` | = note: required by `std::ops::Try::from_ok` diff --git a/src/test/ui/try-block/try-block-in-edition2015.stderr b/src/test/ui/try-block/try-block-in-edition2015.stderr index 7394fec6f366..c94e43131faf 100644 --- a/src/test/ui/try-block/try-block-in-edition2015.stderr +++ b/src/test/ui/try-block/try-block-in-edition2015.stderr @@ -3,12 +3,12 @@ error: expected identifier, found keyword `let` | LL | let try_result: Option<_> = try { | --- while parsing this struct -LL | //~^ ERROR expected struct, variant or union type, found macro `try` -LL | let x = 5; //~ ERROR expected identifier, found keyword +LL | +LL | let x = 5; | ^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | r#let x = 5; //~ ERROR expected identifier, found keyword +LL | r#let x = 5; | ^^^^^ error[E0574]: expected struct, variant or union type, found macro `try` diff --git a/src/test/ui/try-block/try-block-in-match.stderr b/src/test/ui/try-block/try-block-in-match.stderr index 089347073b5c..936e0fe19baf 100644 --- a/src/test/ui/try-block/try-block-in-match.stderr +++ b/src/test/ui/try-block/try-block-in-match.stderr @@ -1,7 +1,7 @@ error: expected expression, found reserved keyword `try` --> $DIR/try-block-in-match.rs:6:11 | -LL | match try { false } { _ => {} } //~ ERROR expected expression, found reserved keyword `try` +LL | match try { false } { _ => {} } | ----- ^^^ expected expression | | | while parsing this match expression diff --git a/src/test/ui/try-block/try-block-in-while.stderr b/src/test/ui/try-block/try-block-in-while.stderr index b4f17778b298..026df15eb877 100644 --- a/src/test/ui/try-block/try-block-in-while.stderr +++ b/src/test/ui/try-block/try-block-in-while.stderr @@ -1,7 +1,7 @@ error: expected expression, found reserved keyword `try` --> $DIR/try-block-in-while.rs:6:11 | -LL | while try { false } {} //~ ERROR expected expression, found reserved keyword `try` +LL | while try { false } {} | ^^^ expected expression error: aborting due to previous error diff --git a/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr index dafbde6a5150..665a6262d3ae 100644 --- a/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr +++ b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `i` because it is borrowed LL | &i | -- borrow of `i` occurs here LL | }; -LL | i = 0; //~ ERROR cannot assign to `i` because it is borrowed +LL | i = 0; | ^^^^^ assignment to borrowed `i` occurs here LL | let _ = i; LL | do_something_with(x); @@ -19,7 +19,7 @@ LL | let x = String::new(); LL | ::std::mem::drop(x); | - value moved here LL | }; -LL | println!("{}", x); //~ ERROR borrow of moved value: `x` +LL | println!("{}", x); | ^ value borrowed here after move error[E0506]: cannot assign to `i` because it is borrowed @@ -28,7 +28,7 @@ error[E0506]: cannot assign to `i` because it is borrowed LL | j = &i; | -- borrow of `i` occurs here LL | }; -LL | i = 0; //~ ERROR cannot assign to `i` because it is borrowed +LL | i = 0; | ^^^^^ assignment to borrowed `i` occurs here LL | let _ = i; LL | do_something_with(j); diff --git a/src/test/ui/try-block/try-block-opt-init.stderr b/src/test/ui/try-block/try-block-opt-init.stderr index a0bc45d4fcd5..ec0128dbdf0f 100644 --- a/src/test/ui/try-block/try-block-opt-init.stderr +++ b/src/test/ui/try-block/try-block-opt-init.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `cfg_res` --> $DIR/try-block-opt-init.rs:15:5 | -LL | assert_eq!(cfg_res, 5); //~ ERROR borrow of possibly uninitialized variable: `cfg_res` +LL | assert_eq!(cfg_res, 5); | ^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `cfg_res` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/try-on-option.stderr b/src/test/ui/try-on-option.stderr index 438b3c2e343f..7dfa1a7d3a0c 100644 --- a/src/test/ui/try-on-option.stderr +++ b/src/test/ui/try-on-option.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `(): std::convert::From` is not satisfied --> $DIR/try-on-option.rs:7:5 | -LL | x?; //~ the trait bound +LL | x?; | ^^ the trait `std::convert::From` is not implemented for `()` | = note: required by `std::convert::From::from` @@ -9,7 +9,7 @@ LL | x?; //~ the trait bound error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`) --> $DIR/try-on-option.rs:13:5 | -LL | x?; //~ the `?` operator +LL | x?; | ^^ cannot use the `?` operator in a function that returns `u32` | = help: the trait `std::ops::Try` is not implemented for `u32` diff --git a/src/test/ui/try-operator-on-main.stderr b/src/test/ui/try-operator-on-main.stderr index 9a2052f72835..9f120e009485 100644 --- a/src/test/ui/try-operator-on-main.stderr +++ b/src/test/ui/try-operator-on-main.stderr @@ -1,7 +1,7 @@ error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`) --> $DIR/try-operator-on-main.rs:9:5 | -LL | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only +LL | std::fs::File::open("foo")?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `()` | = help: the trait `std::ops::Try` is not implemented for `()` @@ -10,7 +10,7 @@ LL | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` --> $DIR/try-operator-on-main.rs:12:5 | -LL | ()?; //~ ERROR the `?` operator can only +LL | ()?; | ^^^ the `?` operator cannot be applied to type `()` | = help: the trait `std::ops::Try` is not implemented for `()` @@ -19,7 +19,7 @@ LL | ()?; //~ ERROR the `?` operator can only error[E0277]: the trait bound `(): std::ops::Try` is not satisfied --> $DIR/try-operator-on-main.rs:15:5 | -LL | try_trait_generic::<()>(); //~ ERROR the trait bound +LL | try_trait_generic::<()>(); | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `()` | note: required by `try_trait_generic` @@ -31,7 +31,7 @@ LL | fn try_trait_generic() -> T { error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` --> $DIR/try-operator-on-main.rs:22:5 | -LL | ()?; //~ ERROR the `?` operator can only +LL | ()?; | ^^^ the `?` operator cannot be applied to type `()` | = help: the trait `std::ops::Try` is not implemented for `()` diff --git a/src/test/ui/tuple/tuple-float-index.stderr b/src/test/ui/tuple/tuple-float-index.stderr index 9a3e384b9d1c..a0ea0e0a30a7 100644 --- a/src/test/ui/tuple/tuple-float-index.stderr +++ b/src/test/ui/tuple/tuple-float-index.stderr @@ -1,7 +1,7 @@ error: unexpected token: `1.1` --> $DIR/tuple-float-index.rs:4:17 | -LL | (1, (2, 3)).1.1; //~ ERROR unexpected token: `1.1` +LL | (1, (2, 3)).1.1; | ------------^^^ | | | | | unexpected token diff --git a/src/test/ui/tuple/tuple-struct-fields/test2.stderr b/src/test/ui/tuple/tuple-struct-fields/test2.stderr index 80f0ddc0e4fc..78176c67ed20 100644 --- a/src/test/ui/tuple/tuple-struct-fields/test2.stderr +++ b/src/test/ui/tuple/tuple-struct-fields/test2.stderr @@ -4,13 +4,13 @@ error: expected one of `)` or `,`, found `(` LL | struct S3(pub $t ()); | ^ expected one of `)` or `,` here ... -LL | define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope +LL | define_struct! { (foo) } | ------------------------ in this macro invocation error[E0412]: cannot find type `foo` in this scope --> $DIR/test2.rs:11:23 | -LL | define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope +LL | define_struct! { (foo) } | ^^^ not found in this scope error: aborting due to 2 previous errors diff --git a/src/test/ui/tuple/tuple-struct-fields/test3.stderr b/src/test/ui/tuple/tuple-struct-fields/test3.stderr index fbc01744fe44..e105aad09e6b 100644 --- a/src/test/ui/tuple/tuple-struct-fields/test3.stderr +++ b/src/test/ui/tuple/tuple-struct-fields/test3.stderr @@ -4,13 +4,13 @@ error: expected one of `)` or `,`, found `(` LL | struct S3(pub($t) ()); | ^ expected one of `)` or `,` here ... -LL | define_struct! { foo } //~ ERROR cannot find type `foo` in this scope +LL | define_struct! { foo } | ---------------------- in this macro invocation error[E0412]: cannot find type `foo` in this scope --> $DIR/test3.rs:11:22 | -LL | define_struct! { foo } //~ ERROR cannot find type `foo` in this scope +LL | define_struct! { foo } | ^^^ not found in this scope error: aborting due to 2 previous errors diff --git a/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr b/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr index 58d0862be6d2..bbdf9ceed23a 100644 --- a/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr +++ b/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr @@ -4,7 +4,7 @@ error[E0004]: non-exhaustive patterns: `Foo(_, _)` not covered LL | struct Foo(isize, isize); | ------------------------- `Foo` defined here ... -LL | match x { //~ ERROR non-exhaustive +LL | match x { | ^ pattern `Foo(_, _)` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/type-alias-enum-variants-priority-2.stderr b/src/test/ui/type-alias-enum-variants-priority-2.stderr index c6ec96ebb7d3..10a4b44084a4 100644 --- a/src/test/ui/type-alias-enum-variants-priority-2.stderr +++ b/src/test/ui/type-alias-enum-variants-priority-2.stderr @@ -4,7 +4,7 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied LL | V(u8) | ----- defined here ... -LL | ::V(); //~ ERROR this function takes 1 parameter but 0 parameters were supplied +LL | ::V(); | ^^^^^^^^ expected 1 parameter error: aborting due to previous error diff --git a/src/test/ui/type/type-alias-bounds.stderr b/src/test/ui/type/type-alias-bounds.stderr index b13e40010521..3cc844365fdd 100644 --- a/src/test/ui/type/type-alias-bounds.stderr +++ b/src/test/ui/type/type-alias-bounds.stderr @@ -42,33 +42,33 @@ LL | type W2Vec<'b, T> where T: 'b, T: 'b = (&'b u32, Vec); warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:47:12 | -LL | type T1 = U::Assoc; //~ WARN not enforced in type aliases +LL | type T1 = U::Assoc; | ^^^^^ | = help: the bound will not be checked when the type alias is used, and should be removed help: use fully disambiguated paths (i.e., `::Assoc`) to refer to associated types in type aliases --> $DIR/type-alias-bounds.rs:47:21 | -LL | type T1 = U::Assoc; //~ WARN not enforced in type aliases +LL | type T1 = U::Assoc; | ^^^^^^^^ warning: where clauses are not enforced in type aliases --> $DIR/type-alias-bounds.rs:48:18 | -LL | type T2 where U: Bound = U::Assoc; //~ WARN not enforced in type aliases +LL | type T2 where U: Bound = U::Assoc; | ^^^^^^^^ | = help: the clause will not be checked when the type alias is used, and should be removed help: use fully disambiguated paths (i.e., `::Assoc`) to refer to associated types in type aliases --> $DIR/type-alias-bounds.rs:48:29 | -LL | type T2 where U: Bound = U::Assoc; //~ WARN not enforced in type aliases +LL | type T2 where U: Bound = U::Assoc; | ^^^^^^^^ warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:56:12 | -LL | type T5 = ::Assoc; //~ WARN not enforced in type aliases +LL | type T5 = ::Assoc; | ^^^^^ | = help: the bound will not be checked when the type alias is used, and should be removed @@ -76,7 +76,7 @@ LL | type T5 = ::Assoc; //~ WARN not enforced in type ali warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:57:12 | -LL | type T6 = ::std::vec::Vec; //~ WARN not enforced in type aliases +LL | type T6 = ::std::vec::Vec; | ^^^^^ | = help: the bound will not be checked when the type alias is used, and should be removed diff --git a/src/test/ui/type/type-ascription-instead-of-initializer.stderr b/src/test/ui/type/type-ascription-instead-of-initializer.stderr index 8ce367d70f01..a22d25697d8b 100644 --- a/src/test/ui/type/type-ascription-instead-of-initializer.stderr +++ b/src/test/ui/type/type-ascription-instead-of-initializer.stderr @@ -1,7 +1,7 @@ error: expected type, found `10` --> $DIR/type-ascription-instead-of-initializer.rs:2:31 | -LL | let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` +LL | let x: Vec::with_capacity(10, 20); | -- ^^ | || | |help: use `=` if you meant to assign @@ -10,7 +10,7 @@ LL | let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` error[E0061]: this function takes 1 parameter but 2 parameters were supplied --> $DIR/type-ascription-instead-of-initializer.rs:2:12 | -LL | let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` +LL | let x: Vec::with_capacity(10, 20); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 parameter error: aborting due to 2 previous errors diff --git a/src/test/ui/type/type-ascription-instead-of-statement-end.stderr b/src/test/ui/type/type-ascription-instead-of-statement-end.stderr index db99d1ec07be..bc5a923a3f32 100644 --- a/src/test/ui/type/type-ascription-instead-of-statement-end.stderr +++ b/src/test/ui/type/type-ascription-instead-of-statement-end.stderr @@ -3,13 +3,13 @@ error: expected type, found `0` | LL | println!("test"): | - help: try using a semicolon: `;` -LL | 0; //~ ERROR expected type, found `0` +LL | 0; | ^ expecting a type here because of type ascription error: expected type, found `0` --> $DIR/type-ascription-instead-of-statement-end.rs:9:23 | -LL | println!("test"): 0; //~ ERROR expected type, found `0` +LL | println!("test"): 0; | ^ expecting a type here because of type ascription error: aborting due to 2 previous errors diff --git a/src/test/ui/type/type-ascription-precedence.stderr b/src/test/ui/type/type-ascription-precedence.stderr index e52e2bc5e9a7..992974eef642 100644 --- a/src/test/ui/type/type-ascription-precedence.stderr +++ b/src/test/ui/type/type-ascription-precedence.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:31:7 | -LL | &(S: &S); //~ ERROR mismatched types +LL | &(S: &S); | ^ expected &S, found struct `S` | = note: expected type `&S` @@ -10,7 +10,7 @@ LL | &(S: &S); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:35:7 | -LL | *(S: Z); //~ ERROR mismatched types +LL | *(S: Z); | ^ expected struct `Z`, found struct `S` | = note: expected type `Z` @@ -19,13 +19,13 @@ LL | *(S: Z); //~ ERROR mismatched types error[E0614]: type `Z` cannot be dereferenced --> $DIR/type-ascription-precedence.rs:35:5 | -LL | *(S: Z); //~ ERROR mismatched types +LL | *(S: Z); | ^^^^^^^ error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:40:7 | -LL | -(S: Z); //~ ERROR mismatched types +LL | -(S: Z); | ^ expected struct `Z`, found struct `S` | = note: expected type `Z` @@ -34,7 +34,7 @@ LL | -(S: Z); //~ ERROR mismatched types error[E0600]: cannot apply unary operator `-` to type `Z` --> $DIR/type-ascription-precedence.rs:40:5 | -LL | -(S: Z); //~ ERROR mismatched types +LL | -(S: Z); | ^^^^^^^ cannot apply unary operator `-` | = note: an implementation of `std::ops::Neg` might be missing for `Z` @@ -42,7 +42,7 @@ LL | -(S: Z); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:45:5 | -LL | (S + Z): Z; //~ ERROR mismatched types +LL | (S + Z): Z; | ^^^^^^^ expected struct `Z`, found struct `S` | = note: expected type `Z` @@ -51,7 +51,7 @@ LL | (S + Z): Z; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:49:5 | -LL | (S * Z): Z; //~ ERROR mismatched types +LL | (S * Z): Z; | ^^^^^^^ expected struct `Z`, found struct `S` | = note: expected type `Z` @@ -60,7 +60,7 @@ LL | (S * Z): Z; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:53:5 | -LL | (S .. S): S; //~ ERROR mismatched types +LL | (S .. S): S; | ^^^^^^^^ expected struct `S`, found struct `std::ops::Range` | = note: expected type `S` diff --git a/src/test/ui/type/type-ascription-soundness.stderr b/src/test/ui/type/type-ascription-soundness.stderr index f681a0423024..150e19020fea 100644 --- a/src/test/ui/type/type-ascription-soundness.stderr +++ b/src/test/ui/type/type-ascription-soundness.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/type-ascription-soundness.rs:7:17 | -LL | let ref x = arr: &[u8]; //~ ERROR mismatched types +LL | let ref x = arr: &[u8]; | ^^^ expected slice, found array of 3 elements | = note: expected type `&[u8]` @@ -10,7 +10,7 @@ LL | let ref x = arr: &[u8]; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-soundness.rs:8:21 | -LL | let ref mut x = arr: &[u8]; //~ ERROR mismatched types +LL | let ref mut x = arr: &[u8]; | ^^^ expected slice, found array of 3 elements | = note: expected type `&[u8]` @@ -19,7 +19,7 @@ LL | let ref mut x = arr: &[u8]; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-soundness.rs:9:11 | -LL | match arr: &[u8] { //~ ERROR mismatched types +LL | match arr: &[u8] { | ^^^ expected slice, found array of 3 elements | = note: expected type `&[u8]` @@ -28,7 +28,7 @@ LL | match arr: &[u8] { //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-soundness.rs:12:17 | -LL | let _len = (arr: &[u8]).len(); //~ ERROR mismatched types +LL | let _len = (arr: &[u8]).len(); | ^^^ expected slice, found array of 3 elements | = note: expected type `&[u8]` diff --git a/src/test/ui/type/type-ascription-with-fn-call.stderr b/src/test/ui/type/type-ascription-with-fn-call.stderr index a290e69e0cb6..eeaca5300f9b 100644 --- a/src/test/ui/type/type-ascription-with-fn-call.stderr +++ b/src/test/ui/type/type-ascription-with-fn-call.stderr @@ -3,7 +3,7 @@ error[E0573]: expected type, found function `f` | LL | f() : | - help: did you mean to use `;` here instead? -LL | f(); //~ ERROR expected type, found function +LL | f(); | ^^^ | | | not a type diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr b/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr index a2df3dcd8e70..17be67c6c3a0 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr +++ b/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/cannot_infer_local_or_array.rs:2:13 | -LL | let x = []; //~ ERROR type annotations needed +LL | let x = []; | - ^^ cannot infer type | | | consider giving `x` a type diff --git a/src/test/ui/type/type-check/issue-22897.stderr b/src/test/ui/type/type-check/issue-22897.stderr index a4f1c4d5d4df..2b3f0696f3c2 100644 --- a/src/test/ui/type/type-check/issue-22897.stderr +++ b/src/test/ui/type/type-check/issue-22897.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/issue-22897.rs:4:5 | -LL | []; //~ ERROR type annotations needed +LL | []; | ^^ cannot infer type for `[_; 0]` error: aborting due to previous error diff --git a/src/test/ui/type/type-check/issue-40294.stderr b/src/test/ui/type/type-check/issue-40294.stderr index d63abdbeb5d4..254875fcaab3 100644 --- a/src/test/ui/type/type-check/issue-40294.stderr +++ b/src/test/ui/type/type-check/issue-40294.stderr @@ -1,7 +1,7 @@ error[E0283]: type annotations required: cannot resolve `&'a T: Foo` --> $DIR/issue-40294.rs:5:1 | -LL | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations required +LL | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) LL | | where &'a T : Foo, LL | | &'b T : Foo LL | | { diff --git a/src/test/ui/type/type-check/issue-41314.stderr b/src/test/ui/type/type-check/issue-41314.stderr index a4ae2a97134e..3461ab4df60b 100644 --- a/src/test/ui/type/type-check/issue-41314.stderr +++ b/src/test/ui/type/type-check/issue-41314.stderr @@ -1,13 +1,13 @@ error[E0026]: variant `X::Y` does not have a field named `number` --> $DIR/issue-41314.rs:7:16 | -LL | X::Y { number } => {} //~ ERROR does not have a field named `number` +LL | X::Y { number } => {} | ^^^^^^ variant `X::Y` does not have this field error[E0027]: pattern does not mention field `0` --> $DIR/issue-41314.rs:7:9 | -LL | X::Y { number } => {} //~ ERROR does not have a field named `number` +LL | X::Y { number } => {} | ^^^^^^^^^^^^^^^ missing field `0` | = note: trying to match a tuple variant with a struct variant pattern diff --git a/src/test/ui/type/type-check/missing_trait_impl.stderr b/src/test/ui/type/type-check/missing_trait_impl.stderr index 9f59e7162e07..69b531d0c846 100644 --- a/src/test/ui/type/type-check/missing_trait_impl.stderr +++ b/src/test/ui/type/type-check/missing_trait_impl.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `+` cannot be applied to type `T` --> $DIR/missing_trait_impl.rs:5:13 | -LL | let z = x + y; //~ ERROR binary operation `+` cannot be applied to type `T` +LL | let z = x + y; | ^^^^^ | = note: `T` might need a bound for `std::ops::Add` @@ -9,7 +9,7 @@ LL | let z = x + y; //~ ERROR binary operation `+` cannot be applied to type error[E0368]: binary assignment operation `+=` cannot be applied to type `T` --> $DIR/missing_trait_impl.rs:9:5 | -LL | x += x; //~ ERROR binary assignment operation `+=` cannot be applied to type `T` +LL | x += x; | -^^^^^ | | | cannot use `+=` on type `T` diff --git a/src/test/ui/type/type-check/unknown_type_for_closure.stderr b/src/test/ui/type/type-check/unknown_type_for_closure.stderr index 45142b556ecd..5971f56c97f7 100644 --- a/src/test/ui/type/type-check/unknown_type_for_closure.stderr +++ b/src/test/ui/type/type-check/unknown_type_for_closure.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/unknown_type_for_closure.rs:2:14 | -LL | let x = |_| { }; //~ ERROR type annotations needed +LL | let x = |_| { }; | ^ consider giving this closure parameter a type error: aborting due to previous error diff --git a/src/test/ui/type/type-dependent-def-issue-49241.stderr b/src/test/ui/type/type-dependent-def-issue-49241.stderr index 0af777fdcf90..5040b728c539 100644 --- a/src/test/ui/type/type-dependent-def-issue-49241.stderr +++ b/src/test/ui/type/type-dependent-def-issue-49241.stderr @@ -1,7 +1,7 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/type-dependent-def-issue-49241.rs:3:22 | -LL | const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant +LL | const l: usize = v.count(); | ^ non-constant value error[E0080]: evaluation of constant value failed diff --git a/src/test/ui/type/type-mismatch.stderr b/src/test/ui/type/type-mismatch.stderr index 0b239e91eb80..7aea9db6167a 100644 --- a/src/test/ui/type/type-mismatch.stderr +++ b/src/test/ui/type/type-mismatch.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:17:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `foo`, found usize | = note: expected type `foo` @@ -10,7 +10,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:18:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `bar`, found usize | = note: expected type `bar` @@ -19,7 +19,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:19:24 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found usize | = note: expected type `Foo` @@ -28,7 +28,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:20:27 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found usize | = note: expected type `Foo` @@ -37,7 +37,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:21:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found usize | = note: expected type `Foo` @@ -46,7 +46,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:22:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found usize | = note: expected type `Foo` @@ -55,7 +55,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:23:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found usize | = note: expected type `Foo` @@ -64,7 +64,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:24:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found usize | = note: expected type `Foo` @@ -73,7 +73,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:28:19 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected usize, found struct `foo` | = note: expected type `usize` @@ -82,7 +82,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:29:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `bar` @@ -91,7 +91,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:30:24 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found struct `foo` | = note: expected type `Foo` @@ -100,7 +100,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:31:27 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found struct `foo` | = note: expected type `Foo` @@ -109,7 +109,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:32:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found struct `foo` | = note: expected type `Foo` @@ -118,7 +118,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:33:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found struct `foo` | = note: expected type `Foo` @@ -127,7 +127,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:34:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found struct `foo` | = note: expected type `Foo` @@ -136,7 +136,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:35:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found struct `foo` | = note: expected type `Foo` @@ -145,7 +145,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:39:19 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected usize, found struct `Foo` | = note: expected type `usize` @@ -154,7 +154,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:40:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `foo`, found struct `Foo` | = note: expected type `foo` @@ -163,7 +163,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:41:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `bar`, found struct `Foo` | = note: expected type `bar` @@ -172,7 +172,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:42:24 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected usize, found struct `foo` | = note: expected type `Foo` @@ -181,7 +181,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:43:27 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected usize, found struct `foo` | = note: expected type `Foo` @@ -190,7 +190,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:44:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `B`, found struct `A` | = note: expected type `Foo<_, B>` @@ -199,7 +199,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:45:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `Foo` @@ -208,7 +208,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:46:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `Foo` @@ -217,7 +217,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:47:23 | -LL | want::<&Foo>(f); //~ ERROR mismatched types +LL | want::<&Foo>(f); | ^ | | | expected &Foo, found struct `Foo` @@ -229,7 +229,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:48:26 | -LL | want::<&Foo>(f); //~ ERROR mismatched types +LL | want::<&Foo>(f); | ^ expected reference, found struct `Foo` | = note: expected type `&Foo` @@ -238,7 +238,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:52:19 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected usize, found struct `Foo` | = note: expected type `usize` @@ -247,7 +247,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:53:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `foo`, found struct `Foo` | = note: expected type `foo` @@ -256,7 +256,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:54:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `bar`, found struct `Foo` | = note: expected type `bar` @@ -265,7 +265,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:55:24 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected usize, found struct `foo` | = note: expected type `Foo` @@ -274,7 +274,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:56:27 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected usize, found struct `foo` | = note: expected type `Foo` @@ -283,7 +283,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:57:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `A`, found struct `B` | = note: expected type `Foo<_, A>` @@ -292,7 +292,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:58:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `Foo` @@ -301,7 +301,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:59:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `Foo` @@ -310,7 +310,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:60:23 | -LL | want::<&Foo>(f); //~ ERROR mismatched types +LL | want::<&Foo>(f); | ^ expected &Foo, found struct `Foo` | = note: expected type `&Foo` @@ -319,7 +319,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:61:26 | -LL | want::<&Foo>(f); //~ ERROR mismatched types +LL | want::<&Foo>(f); | ^ | | | expected reference, found struct `Foo` @@ -331,7 +331,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:65:19 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected usize, found struct `Foo` | = note: expected type `usize` @@ -340,7 +340,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:66:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `foo`, found struct `Foo` | = note: expected type `foo` @@ -349,7 +349,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:67:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `bar`, found struct `Foo` | = note: expected type `bar` @@ -358,7 +358,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:68:24 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected usize, found struct `foo` | = note: expected type `Foo` @@ -367,7 +367,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:69:27 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected usize, found struct `foo` | = note: expected type `Foo` @@ -376,7 +376,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:70:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `A`, found struct `B` | = note: expected type `Foo<_, A, B>` @@ -385,7 +385,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:71:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `B`, found struct `A` | = note: expected type `Foo<_, _, B>` @@ -394,7 +394,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:72:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `Foo` @@ -403,7 +403,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:73:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `Foo` @@ -412,7 +412,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:74:23 | -LL | want::<&Foo>(f); //~ ERROR mismatched types +LL | want::<&Foo>(f); | ^ expected &Foo, found struct `Foo` | = note: expected type `&Foo` @@ -421,7 +421,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:75:26 | -LL | want::<&Foo>(f); //~ ERROR mismatched types +LL | want::<&Foo>(f); | ^ expected reference, found struct `Foo` | = note: expected type `&Foo` diff --git a/src/test/ui/type/type-params-in-different-spaces-1.stderr b/src/test/ui/type/type-params-in-different-spaces-1.stderr index e1b8ff70a631..b3b78424fd90 100644 --- a/src/test/ui/type/type-params-in-different-spaces-1.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-1.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/type-params-in-different-spaces-1.rs:5:17 | -LL | *self + rhs //~ ERROR mismatched types +LL | *self + rhs | ^^^ expected Self, found type parameter | = note: expected type `Self` diff --git a/src/test/ui/type/type-params-in-different-spaces-2.stderr b/src/test/ui/type/type-params-in-different-spaces-2.stderr index 3d50c2c8baf8..15db94ef1e3c 100644 --- a/src/test/ui/type/type-params-in-different-spaces-2.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-2.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Self: Tr` is not satisfied --> $DIR/type-params-in-different-spaces-2.rs:10:9 | -LL | Tr::op(u) //~ ERROR E0277 +LL | Tr::op(u) | ^^^^^^ the trait `Tr` is not implemented for `Self` | = help: consider adding a `where Self: Tr` bound @@ -14,7 +14,7 @@ LL | fn op(_: T) -> Self; error[E0277]: the trait bound `Self: Tr` is not satisfied --> $DIR/type-params-in-different-spaces-2.rs:16:9 | -LL | Tr::op(u) //~ ERROR E0277 +LL | Tr::op(u) | ^^^^^^ the trait `Tr` is not implemented for `Self` | = help: consider adding a `where Self: Tr` bound diff --git a/src/test/ui/type/type-params-in-different-spaces-3.stderr b/src/test/ui/type/type-params-in-different-spaces-3.stderr index 69288ea491da..4e8134da2ddf 100644 --- a/src/test/ui/type/type-params-in-different-spaces-3.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-3.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn test(u: X) -> Self { | ---- expected `Self` because of return type -LL | u //~ ERROR mismatched types +LL | u | ^ expected Self, found type parameter | = note: expected type `Self` diff --git a/src/test/ui/type/type-path-err-node-types.stderr b/src/test/ui/type/type-path-err-node-types.stderr index e73b1fb029ce..29a438a23c7a 100644 --- a/src/test/ui/type/type-path-err-node-types.stderr +++ b/src/test/ui/type/type-path-err-node-types.stderr @@ -1,25 +1,25 @@ error[E0433]: failed to resolve: use of undeclared type or module `NonExistent` --> $DIR/type-path-err-node-types.rs:15:5 | -LL | NonExistent::Assoc::; //~ ERROR undeclared type or module `NonExistent` +LL | NonExistent::Assoc::; | ^^^^^^^^^^^ use of undeclared type or module `NonExistent` error[E0412]: cannot find type `Nonexistent` in this scope --> $DIR/type-path-err-node-types.rs:7:12 | -LL | let _: Nonexistent; //~ ERROR cannot find type `Nonexistent` in this scope +LL | let _: Nonexistent; | ^^^^^^^^^^^ not found in this scope error[E0576]: cannot find method or associated constant `nonexistent` in trait `Tr` --> $DIR/type-path-err-node-types.rs:11:21 | -LL | >::nonexistent(); //~ ERROR cannot find method or associated constant `nonexistent` +LL | >::nonexistent(); | ^^^^^^^^^^^ not found in `Tr` error[E0425]: cannot find value `nonexistent` in this scope --> $DIR/type-path-err-node-types.rs:19:5 | -LL | nonexistent.nonexistent::(); //~ ERROR cannot find value `nonexistent` +LL | nonexistent.nonexistent::(); | ^^^^^^^^^^^ not found in this scope error: aborting due to 4 previous errors diff --git a/src/test/ui/type/type-recursive.stderr b/src/test/ui/type/type-recursive.stderr index b1ecc1f91cbc..72bf372e561d 100644 --- a/src/test/ui/type/type-recursive.stderr +++ b/src/test/ui/type/type-recursive.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `T1` has infinite size --> $DIR/type-recursive.rs:1:1 | -LL | struct T1 { //~ ERROR E0072 +LL | struct T1 { | ^^^^^^^^^ recursive type has infinite size LL | foo: isize, LL | foolish: T1 diff --git a/src/test/ui/type/type-shadow.stderr b/src/test/ui/type/type-shadow.stderr index 4c7aa00565ad..f15bdc16d514 100644 --- a/src/test/ui/type/type-shadow.stderr +++ b/src/test/ui/type/type-shadow.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/type-shadow.rs:6:20 | -LL | let y: Y = "hello"; //~ ERROR mismatched types +LL | let y: Y = "hello"; | ^^^^^^^ expected isize, found reference | = note: expected type `isize` diff --git a/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr b/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr index bb63917fc086..f1118709962a 100644 --- a/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr +++ b/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn ice(x: Box>) { | - possibly return type missing here? -LL | *x //~ ERROR mismatched types [E0308] +LL | *x | ^^ expected (), found trait std::iter::Iterator | = note: expected type `()` diff --git a/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr b/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr index 41bf3fd1c446..8755bcded9d2 100644 --- a/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr +++ b/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr @@ -1,7 +1,7 @@ error[E0568]: auto traits cannot have super traits --> $DIR/typeck-auto-trait-no-supertraits-2.rs:3:1 | -LL | auto trait Magic : Sized where Option : Magic {} //~ ERROR E0568 +LL | auto trait Magic : Sized where Option : Magic {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr b/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr index bf40eaad6539..5a3888349095 100644 --- a/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr +++ b/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr @@ -1,7 +1,7 @@ error[E0568]: auto traits cannot have super traits --> $DIR/typeck-auto-trait-no-supertraits.rs:27:1 | -LL | auto trait Magic: Copy {} //~ ERROR E0568 +LL | auto trait Magic: Copy {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr b/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr index 3f7e4a674e65..a31ee83ae1cc 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr @@ -1,7 +1,7 @@ error[E0277]: `::AssocType` cannot be sent between threads safely --> $DIR/typeck-default-trait-impl-assoc-type.rs:9:5 | -LL | is_send::(); //~ ERROR E0277 +LL | is_send::(); | ^^^^^^^^^^^^^^^^^^^^^^^ `::AssocType` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `::AssocType` diff --git a/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr index 2bfb4110603f..154b4042c681 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr @@ -1,7 +1,7 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:13:1 | -LL | impl DefaultedTrait for (A,) { } //~ ERROR E0117 +LL | impl DefaultedTrait for (A,) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate @@ -10,7 +10,7 @@ LL | impl DefaultedTrait for (A,) { } //~ ERROR E0117 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:16:1 | -LL | impl !DefaultedTrait for (B,) { } //~ ERROR E0117 +LL | impl !DefaultedTrait for (B,) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate @@ -19,13 +19,13 @@ LL | impl !DefaultedTrait for (B,) { } //~ ERROR E0117 error[E0321]: cross-crate traits with a default impl, like `lib::DefaultedTrait`, can only be implemented for a struct/enum type defined in the current crate --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:20:1 | -LL | impl DefaultedTrait for Box { } //~ ERROR E0321 +LL | impl DefaultedTrait for Box { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait for type in another crate error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:21:1 | -LL | impl DefaultedTrait for lib::Something { } //~ ERROR E0117 +LL | impl DefaultedTrait for lib::Something { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate diff --git a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr index 736e1b8da7f3..a850cc7b377d 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr @@ -1,7 +1,7 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/typeck-default-trait-impl-send-param.rs:5:5 | -LL | is_send::() //~ ERROR E0277 +LL | is_send::() | ^^^^^^^^^^^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` diff --git a/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr b/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr index 759a16cdafde..2187c61fabf1 100644 --- a/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr +++ b/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr @@ -28,7 +28,7 @@ LL | fn bar(self: &Bar, x: isize) -> isize { error[E0308]: mismatched method receiver --> $DIR/ufcs-explicit-self-bad.rs:37:21 | -LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver +LL | fn dummy2(self: &Bar) {} | ^^^^^^^ lifetime mismatch | = note: expected type `&'a Bar` @@ -36,7 +36,7 @@ LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver note: the anonymous lifetime #1 defined on the method body at 37:5... --> $DIR/ufcs-explicit-self-bad.rs:37:5 | -LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver +LL | fn dummy2(self: &Bar) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 35:6 --> $DIR/ufcs-explicit-self-bad.rs:35:6 @@ -47,7 +47,7 @@ LL | impl<'a, T> SomeTrait for &'a Bar { error[E0308]: mismatched method receiver --> $DIR/ufcs-explicit-self-bad.rs:37:21 | -LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver +LL | fn dummy2(self: &Bar) {} | ^^^^^^^ lifetime mismatch | = note: expected type `&'a Bar` @@ -60,7 +60,7 @@ LL | impl<'a, T> SomeTrait for &'a Bar { note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 37:5 --> $DIR/ufcs-explicit-self-bad.rs:37:5 | -LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver +LL | fn dummy2(self: &Bar) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched method receiver diff --git a/src/test/ui/ufcs/ufcs-partially-resolved.stderr b/src/test/ui/ufcs/ufcs-partially-resolved.stderr index 3cd1cac71fa7..799dbf7a6d20 100644 --- a/src/test/ui/ufcs/ufcs-partially-resolved.stderr +++ b/src/test/ui/ufcs/ufcs-partially-resolved.stderr @@ -1,163 +1,163 @@ error[E0433]: failed to resolve: not a module `Y` --> $DIR/ufcs-partially-resolved.rs:48:22 | -LL | let _: ::NN; //~ ERROR failed to resolve: not a module `Y` +LL | let _: ::NN; | ^ not a module `Y` error[E0433]: failed to resolve: not a module `Y` --> $DIR/ufcs-partially-resolved.rs:50:15 | -LL | ::NN; //~ ERROR failed to resolve: not a module `Y` +LL | ::NN; | ^ not a module `Y` error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:19:24 | -LL | let _: ::N; //~ ERROR cannot find associated type `N` in trait `Tr` +LL | let _: ::N; | ^ help: an associated type with a similar name exists: `Y` error[E0576]: cannot find associated type `N` in enum `E` --> $DIR/ufcs-partially-resolved.rs:20:23 | -LL | let _: ::N; //~ ERROR cannot find associated type `N` in enum `E` +LL | let _: ::N; | ^ not found in `E` error[E0576]: cannot find associated type `N` in `A` --> $DIR/ufcs-partially-resolved.rs:21:23 | -LL | let _: ::N; //~ ERROR cannot find associated type `N` in `A` +LL | let _: ::N; | ^ not found in `A` error[E0576]: cannot find method or associated constant `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:22:17 | -LL | ::N; //~ ERROR cannot find method or associated constant `N` in trait `Tr` +LL | ::N; | ^ help: a method with a similar name exists: `Y` error[E0576]: cannot find method or associated constant `N` in enum `E` --> $DIR/ufcs-partially-resolved.rs:23:16 | -LL | ::N; //~ ERROR cannot find method or associated constant `N` in enum `E` +LL | ::N; | ^ not found in `E` error[E0576]: cannot find method or associated constant `N` in `A` --> $DIR/ufcs-partially-resolved.rs:24:16 | -LL | ::N; //~ ERROR cannot find method or associated constant `N` in `A` +LL | ::N; | ^ not found in `A` error[E0575]: expected associated type, found variant `E::Y` --> $DIR/ufcs-partially-resolved.rs:26:12 | -LL | let _: ::Y; //~ ERROR expected associated type, found variant `E::Y` +LL | let _: ::Y; | ^^^^^^^^^^^^ not a associated type error[E0575]: expected method or associated constant, found unit variant `E::Y` --> $DIR/ufcs-partially-resolved.rs:28:5 | -LL | ::Y; //~ ERROR expected method or associated constant, found unit variant `E::Y` +LL | ::Y; | ^^^^^^^^^^^^ not a method or associated constant error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:30:24 | -LL | let _: ::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` +LL | let _: ::N::NN; | ^ help: an associated type with a similar name exists: `Y` error[E0576]: cannot find associated type `N` in enum `E` --> $DIR/ufcs-partially-resolved.rs:31:23 | -LL | let _: ::N::NN; //~ ERROR cannot find associated type `N` in enum `E` +LL | let _: ::N::NN; | ^ not found in `E` error[E0576]: cannot find associated type `N` in `A` --> $DIR/ufcs-partially-resolved.rs:32:23 | -LL | let _: ::N::NN; //~ ERROR cannot find associated type `N` in `A` +LL | let _: ::N::NN; | ^ not found in `A` error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:33:17 | -LL | ::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` +LL | ::N::NN; | ^ help: an associated type with a similar name exists: `Y` error[E0576]: cannot find associated type `N` in enum `E` --> $DIR/ufcs-partially-resolved.rs:34:16 | -LL | ::N::NN; //~ ERROR cannot find associated type `N` in enum `E` +LL | ::N::NN; | ^ not found in `E` error[E0576]: cannot find associated type `N` in `A` --> $DIR/ufcs-partially-resolved.rs:35:16 | -LL | ::N::NN; //~ ERROR cannot find associated type `N` in `A` +LL | ::N::NN; | ^ not found in `A` error[E0575]: expected associated type, found variant `E::Y` --> $DIR/ufcs-partially-resolved.rs:37:12 | -LL | let _: ::Y::NN; //~ ERROR expected associated type, found variant `E::Y` +LL | let _: ::Y::NN; | ^^^^^^^^^^^^^^^^ not a associated type error[E0575]: expected associated type, found variant `E::Y` --> $DIR/ufcs-partially-resolved.rs:39:5 | -LL | ::Y::NN; //~ ERROR expected associated type, found variant `E::Y` +LL | ::Y::NN; | ^^^^^^^^^^^^^^^^ not a associated type error[E0576]: cannot find associated type `NN` in `Tr::N` --> $DIR/ufcs-partially-resolved.rs:41:27 | -LL | let _: ::NN; //~ ERROR cannot find associated type `NN` in `Tr::N` +LL | let _: ::NN; | ^^ not found in `Tr::N` error[E0576]: cannot find associated type `NN` in `E::N` --> $DIR/ufcs-partially-resolved.rs:42:26 | -LL | let _: ::NN; //~ ERROR cannot find associated type `NN` in `E::N` +LL | let _: ::NN; | ^^ not found in `E::N` error[E0576]: cannot find associated type `NN` in `A::N` --> $DIR/ufcs-partially-resolved.rs:43:26 | -LL | let _: ::NN; //~ ERROR cannot find associated type `NN` in `A::N` +LL | let _: ::NN; | ^^ not found in `A::N` error[E0576]: cannot find method or associated constant `NN` in `Tr::N` --> $DIR/ufcs-partially-resolved.rs:44:20 | -LL | ::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::N` +LL | ::NN; | ^^ not found in `Tr::N` error[E0576]: cannot find method or associated constant `NN` in `E::N` --> $DIR/ufcs-partially-resolved.rs:45:19 | -LL | ::NN; //~ ERROR cannot find method or associated constant `NN` in `E::N` +LL | ::NN; | ^^ not found in `E::N` error[E0576]: cannot find method or associated constant `NN` in `A::N` --> $DIR/ufcs-partially-resolved.rs:46:19 | -LL | ::NN; //~ ERROR cannot find method or associated constant `NN` in `A::N` +LL | ::NN; | ^^ not found in `A::N` error[E0576]: cannot find associated type `NN` in `Tr::Y` --> $DIR/ufcs-partially-resolved.rs:47:27 | -LL | let _: ::NN; //~ ERROR cannot find associated type `NN` in `Tr::Y` +LL | let _: ::NN; | ^^ not found in `Tr::Y` error[E0576]: cannot find method or associated constant `NN` in `Tr::Y` --> $DIR/ufcs-partially-resolved.rs:49:20 | -LL | ::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::Y` +LL | ::NN; | ^^ not found in `Tr::Y` error[E0575]: expected associated type, found method `Dr::Z` --> $DIR/ufcs-partially-resolved.rs:52:12 | -LL | let _: ::Z; //~ ERROR expected associated type, found method `Dr::Z` +LL | let _: ::Z; | ^^^^^^^^^^^^- | | | help: an associated type with a similar name exists: `X` @@ -165,7 +165,7 @@ LL | let _: ::Z; //~ ERROR expected associated type, found method error[E0575]: expected method or associated constant, found associated type `Dr::X` --> $DIR/ufcs-partially-resolved.rs:53:5 | -LL | ::X; //~ ERROR expected method or associated constant, found associated type `Dr::X` +LL | ::X; | ^^^^^^^^^^^^- | | | help: a method with a similar name exists: `Z` @@ -175,7 +175,7 @@ LL | ::X; //~ ERROR expected method or associated constant, found error[E0575]: expected associated type, found method `Dr::Z` --> $DIR/ufcs-partially-resolved.rs:54:12 | -LL | let _: ::Z::N; //~ ERROR expected associated type, found method `Dr::Z` +LL | let _: ::Z::N; | ^^^^^^^^^^^^-^^^ | | | help: an associated type with a similar name exists: `X` @@ -183,13 +183,13 @@ LL | let _: ::Z::N; //~ ERROR expected associated type, found meth error[E0223]: ambiguous associated type --> $DIR/ufcs-partially-resolved.rs:36:12 | -LL | let _: ::Y::NN; //~ ERROR ambiguous associated type +LL | let _: ::Y::NN; | ^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<::Y as Trait>::NN` error[E0599]: no associated item named `NN` found for type `::Y` in the current scope --> $DIR/ufcs-partially-resolved.rs:38:20 | -LL | ::Y::NN; //~ ERROR no associated item named `NN` found for type `::Y` +LL | ::Y::NN; | ---------------^^ | | | associated item not found in `::Y` @@ -197,7 +197,7 @@ LL | ::Y::NN; //~ ERROR no associated item named `NN` found for ty error[E0599]: no associated item named `N` found for type `::X` in the current scope --> $DIR/ufcs-partially-resolved.rs:55:20 | -LL | ::X::N; //~ ERROR no associated item named `N` found for type `::X` +LL | ::X::N; | ---------------^ | | | associated item not found in `::X` diff --git a/src/test/ui/ui-testing-optout.stderr b/src/test/ui/ui-testing-optout.stderr index 5a662e0ea89c..313e198e39e3 100644 --- a/src/test/ui/ui-testing-optout.stderr +++ b/src/test/ui/ui-testing-optout.stderr @@ -1,19 +1,19 @@ error[E0412]: cannot find type `B` in this scope --> $DIR/ui-testing-optout.rs:4:10 | -4 | type A = B; //~ ERROR +4 | type A = B; | ^ help: a type alias with a similar name exists: `A` error[E0412]: cannot find type `D` in this scope --> $DIR/ui-testing-optout.rs:10:10 | -10 | type C = D; //~ ERROR +10 | type C = D; | ^ help: a type alias with a similar name exists: `A` error[E0412]: cannot find type `F` in this scope --> $DIR/ui-testing-optout.rs:95:10 | -95 | type E = F; //~ ERROR +95 | type E = F; | ^ help: a type alias with a similar name exists: `A` error: aborting due to 3 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr index ae83242d5349..7620f6a3cbee 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move +LL | let f = to_fn(|| drop(x)); | ^ cannot move out of captured outer variable in an `Fn` closure error[E0507]: cannot move out of captured outer variable in an `FnMut` closure @@ -11,7 +11,7 @@ error[E0507]: cannot move out of captured outer variable in an `FnMut` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn_mut(|| drop(x)); //~ ERROR cannot move +LL | let f = to_fn_mut(|| drop(x)); | ^ cannot move out of captured outer variable in an `FnMut` closure error[E0507]: cannot move out of captured outer variable in an `Fn` closure @@ -19,7 +19,7 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move +LL | let f = to_fn(move || drop(x)); | ^ cannot move out of captured outer variable in an `Fn` closure error[E0507]: cannot move out of captured outer variable in an `FnMut` closure @@ -27,7 +27,7 @@ error[E0507]: cannot move out of captured outer variable in an `FnMut` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move +LL | let f = to_fn_mut(move || drop(x)); | ^ cannot move out of captured outer variable in an `FnMut` closure error: aborting due to 4 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr index 1865e2486f14..e4aa54032e3f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr @@ -4,7 +4,7 @@ error[E0595]: closure cannot assign to immutable local variable `x` LL | let x = 0; | - help: make this binding mutable: `mut x` ... -LL | || x = 1; //~ ERROR cannot assign +LL | || x = 1; | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable local variable `x` @@ -13,7 +13,7 @@ error[E0595]: closure cannot assign to immutable local variable `x` LL | let x = 0; | - help: make this binding mutable: `mut x` ... -LL | || set(&mut x); //~ ERROR cannot assign +LL | || set(&mut x); | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable local variable `x` @@ -22,7 +22,7 @@ error[E0595]: closure cannot assign to immutable local variable `x` LL | let x = 0; | - help: make this binding mutable: `mut x` ... -LL | || x = 1; //~ ERROR cannot assign +LL | || x = 1; | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable local variable `x` @@ -31,7 +31,7 @@ error[E0595]: closure cannot assign to immutable local variable `x` LL | let x = 0; | - help: make this binding mutable: `mut x` ... -LL | || set(&mut x); //~ ERROR cannot assign +LL | || set(&mut x); | ^^ cannot borrow mutably error[E0594]: cannot assign to captured outer variable in an `FnMut` closure @@ -39,13 +39,13 @@ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure | LL | let x = 0; | - help: consider making `x` mutable: `mut x` -LL | move || x = 1; //~ ERROR cannot assign +LL | move || x = 1; | ^^^^^ error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable --> $DIR/unboxed-closure-immutable-capture.rs:10:22 | -LL | move || set(&mut x); //~ ERROR cannot borrow +LL | move || set(&mut x); | ^ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure @@ -54,13 +54,13 @@ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure LL | let x = 0; | - help: consider making `x` mutable: `mut x` ... -LL | move || x = 1; //~ ERROR cannot assign +LL | move || x = 1; | ^^^^^ error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable --> $DIR/unboxed-closure-immutable-capture.rs:12:22 | -LL | move || set(&mut x); //~ ERROR cannot borrow +LL | move || set(&mut x); | ^ error: aborting due to 8 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr index fc4552085188..0d3766426bd2 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr @@ -1,7 +1,7 @@ error[E0644]: closure/generator type that references itself --> $DIR/unboxed-closure-no-cyclic-sig.rs:8:7 | -LL | g(|_| { }); //~ ERROR closure/generator type that references itself +LL | g(|_| { }); | ^^^^^^^^ cyclic type of infinite size | = note: closures cannot capture themselves or take themselves as argument; diff --git a/src/test/ui/unboxed-closures/unboxed-closure-region.stderr b/src/test/ui/unboxed-closures/unboxed-closure-region.stderr index a0f009c0689c..f710342e2ce5 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-region.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-region.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/unboxed-closure-region.rs:8:12 | -LL | || x //~ ERROR `x` does not live long enough +LL | || x | -- ^ borrowed value does not live long enough | | | capture occurs here diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr index e631c3367886..8c3480744fe3 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/unboxed-closure-sugar-lifetime-elision.rs:26:35 | -LL | let _: Foo(&isize, &usize) -> &usize; //~ ERROR missing lifetime specifier +LL | let _: Foo(&isize, &usize) -> &usize; | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr index 84ed797450c2..304339c89e64 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr @@ -1,7 +1,7 @@ error[E0220]: associated type `Output` not found for `One<()>` --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:5:15 | -LL | fn foo(_: &One()) //~ ERROR associated type `Output` not found for `One<()>` +LL | fn foo(_: &One()) | ^^ associated type `Output` not found error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr index 461eebc59c02..ac0e4ff13c7e 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let f = || x += 1; | -- borrow of `x` occurs here -LL | let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed +LL | let _y = x; | ^^ use of borrowed `x` error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr index 85d98c18d7ff..47fe0ee72dc8 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr @@ -16,7 +16,7 @@ error[E0373]: closure may outlive the current function, but it borrows `factoria | LL | let f = |x: u32| -> u32 { | ^^^^^^^^^^^^^^^ may outlive borrowed value `factorial` -LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial` +LL | LL | let g = factorial.as_ref().unwrap(); | --------- `factorial` is borrowed here help: to force the closure to take ownership of `factorial` (and any other referenced variables), use the `move` keyword diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr index bf43dc62744f..526055ba04b6 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr @@ -1,7 +1,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:15 | -LL | x.set(y); //~ ERROR E0312 +LL | x.set(y); | ^ | note: ...the reference is valid for the anonymous lifetime #3 defined on the body at 16:14... @@ -9,7 +9,7 @@ note: ...the reference is valid for the anonymous lifetime #3 defined on the bod | LL | doit(0, &|x, y| { | ______________^ -LL | | x.set(y); //~ ERROR E0312 +LL | | x.set(y); LL | | }); | |_____^ note: ...but the borrowed content is only valid for the anonymous lifetime #4 defined on the body at 16:14 @@ -17,7 +17,7 @@ note: ...but the borrowed content is only valid for the anonymous lifetime #4 de | LL | doit(0, &|x, y| { | ______________^ -LL | | x.set(y); //~ ERROR E0312 +LL | | x.set(y); LL | | }); | |_____^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr index 384cd090cb3c..9287353245e9 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr @@ -1,7 +1,7 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` --> $DIR/unboxed-closures-infer-fn-once-move-from-projection.rs:14:13 | -LL | let c = || drop(y.0); //~ ERROR expected a closure that implements the `Fn` trait +LL | let c = || drop(y.0); | ^^^^^^^^-^^^ | | | | | closure is `FnOnce` because it moves the variable `y` out of its environment diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr index bc839d7b5362..c90c15074988 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr @@ -4,16 +4,16 @@ error[E0595]: closure cannot assign to immutable local variable `tick1` LL | let tick1 = || { | ----- help: make this binding mutable: `mut tick1` ... -LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1` +LL | let tick2 = || { | ^^ cannot borrow mutably error[E0596]: cannot borrow immutable local variable `tick2` as mutable --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:20:5 | -LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1` +LL | let tick2 = || { | ----- help: make this binding mutable: `mut tick2` ... -LL | tick2(); //~ ERROR cannot borrow +LL | tick2(); | ^^^^^ cannot borrow mutably error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr index d4d285275e9e..33e215448585 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable local variable `tick` as mutable | LL | let tick = || counter += 1; | ---- help: make this binding mutable: `mut tick` -LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable +LL | tick(); | ^^^^ cannot borrow mutably error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr index 2137f9904ce1..585577ae82aa 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable local variable `tick` as mutable | LL | let tick = move || counter += 1; | ---- help: make this binding mutable: `mut tick` -LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable +LL | tick(); | ^^^^ cannot borrow mutably error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr index 52650903ba3f..0b9aa61a765f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `tick` | LL | tick(); | ---- value moved here -LL | tick(); //~ ERROR use of moved value: `tick` +LL | tick(); | ^^^^ value used here after move | note: closure cannot be invoked more than once because it moves the variable `counter` out of its environment diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr index 23d61c33ffe0..20773d561f9f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `tick` | LL | tick(); | ---- value moved here -LL | tick(); //~ ERROR use of moved value: `tick` +LL | tick(); | ^^^^ value used here after move | note: closure cannot be invoked more than once because it moves the variable `counter` out of its environment diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr index 99fc287b1eef..055a1748db62 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr @@ -3,7 +3,7 @@ error[E0595]: closure cannot assign to immutable local variable `n` | LL | let n = 0; | - help: make this binding mutable: `mut n` -LL | let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign +LL | let mut f = to_fn_mut(|| { | ^^ cannot borrow mutably error[E0594]: cannot assign to captured outer variable in an `FnMut` closure @@ -12,13 +12,13 @@ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure LL | let n = 0; | - help: consider making `n` mutable: `mut n` ... -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure --> $DIR/unboxed-closures-mutate-upvar.rs:46:9 | -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications @@ -27,14 +27,14 @@ help: consider changing this closure to take self by mutable reference | LL | let mut f = to_fn(move || { | _______________________^ -LL | | n += 1; //~ ERROR cannot assign +LL | | n += 1; LL | | }); | |_____^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure --> $DIR/unboxed-closures-mutate-upvar.rs:53:9 | -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications @@ -43,7 +43,7 @@ help: consider changing this closure to take self by mutable reference | LL | let mut f = to_fn(move || { | _______________________^ -LL | | n += 1; //~ ERROR cannot assign +LL | | n += 1; LL | | }); | |_____^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr index 1fccbb9c8572..2e1845888a2f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `call` found for type `[closure@$DIR/unboxed-closures-static-call-wrong-trait.rs:6:26: 6:31]` in the current scope --> $DIR/unboxed-closures-static-call-wrong-trait.rs:7:10 | -LL | mut_.call((0, )); //~ ERROR no method named `call` found +LL | mut_.call((0, )); | ^^^^ | = note: mut_ is a function, perhaps you wish to call it diff --git a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr index 82e8c63ce27e..df31a8d6104e 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/unboxed-closures-type-mismatch.rs:5:15 | -LL | let z = f(1_usize, 2); //~ ERROR mismatched types +LL | let z = f(1_usize, 2); | ^^^^^^^ expected isize, found usize error: aborting due to previous error diff --git a/src/test/ui/unconstrained-none.stderr b/src/test/ui/unconstrained-none.stderr index e0ddae4cc899..eb918b25d2be 100644 --- a/src/test/ui/unconstrained-none.stderr +++ b/src/test/ui/unconstrained-none.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/unconstrained-none.rs:4:5 | -LL | None; //~ ERROR type annotations needed [E0282] +LL | None; | ^^^^ cannot infer type for `T` error: aborting due to previous error diff --git a/src/test/ui/unconstrained-ref.stderr b/src/test/ui/unconstrained-ref.stderr index 7722963293f3..d9a129a2d7b2 100644 --- a/src/test/ui/unconstrained-ref.stderr +++ b/src/test/ui/unconstrained-ref.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/unconstrained-ref.rs:6:5 | -LL | S { o: &None }; //~ ERROR type annotations needed [E0282] +LL | S { o: &None }; | ^ cannot infer type for `T` error: aborting due to previous error diff --git a/src/test/ui/underscore-ident-matcher.stderr b/src/test/ui/underscore-ident-matcher.stderr index 29fb9157b681..241c3d3d8ce6 100644 --- a/src/test/ui/underscore-ident-matcher.stderr +++ b/src/test/ui/underscore-ident-matcher.stderr @@ -4,7 +4,7 @@ error: no rules expected the token `_` LL | macro_rules! identity { | --------------------- when calling this macro ... -LL | let identity!(_) = 10; //~ ERROR no rules expected the token `_` +LL | let identity!(_) = 10; | ^ no rules expected this token in macro call error: aborting due to previous error diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr index 904c6c23def1..1ea9c423e5a6 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr @@ -1,13 +1,13 @@ error[E0106]: missing lifetime specifier --> $DIR/dyn-trait-underscore-in-struct.rs:9:24 | -LL | x: Box, //~ ERROR missing lifetime specifier +LL | x: Box, | ^^ expected lifetime parameter error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound --> $DIR/dyn-trait-underscore-in-struct.rs:9:12 | -LL | x: Box, //~ ERROR missing lifetime specifier +LL | x: Box, | ^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr index 4eb959311ca4..69a9fd7a60c9 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements --> $DIR/dyn-trait-underscore.rs:8:20 | -LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime +LL | Box::new(items.iter()) | ^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 6:1... @@ -9,13 +9,13 @@ note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on th | LL | / fn a(items: &[T]) -> Box> { LL | | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static` -LL | | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime +LL | | Box::new(items.iter()) LL | | } | |_^ note: ...so that reference does not outlive borrowed content --> $DIR/dyn-trait-underscore.rs:8:14 | -LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime +LL | Box::new(items.iter()) | ^^^^^ = note: but, the lifetime must be valid for the static lifetime... = note: ...so that the expression is assignable: diff --git a/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr b/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr index ec9fe6ad9ae1..ed61bdfdddab 100644 --- a/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr +++ b/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/in-fn-return-illegal.rs:5:30 | -LL | fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } //~ ERROR missing lifetime specifier +LL | fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } | ^^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `x` or `y` diff --git a/src/test/ui/underscore-lifetime/in-struct.stderr b/src/test/ui/underscore-lifetime/in-struct.stderr index 2b19c6865dc0..6bbdc71195a5 100644 --- a/src/test/ui/underscore-lifetime/in-struct.stderr +++ b/src/test/ui/underscore-lifetime/in-struct.stderr @@ -1,13 +1,13 @@ error[E0106]: missing lifetime specifier --> $DIR/in-struct.rs:6:9 | -LL | x: &'_ u32, //~ ERROR missing lifetime specifier +LL | x: &'_ u32, | ^^ expected lifetime parameter error[E0106]: missing lifetime specifier --> $DIR/in-struct.rs:10:14 | -LL | Variant(&'_ u32), //~ ERROR missing lifetime specifier +LL | Variant(&'_ u32), | ^^ expected lifetime parameter error: aborting due to 2 previous errors diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr index e0c2c89c08c3..104e63884777 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr @@ -1,25 +1,25 @@ error[E0637]: `'_` cannot be used here --> $DIR/underscore-lifetime-binders.rs:4:8 | -LL | fn foo<'_> //~ ERROR cannot be used here +LL | fn foo<'_> | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here --> $DIR/underscore-lifetime-binders.rs:10:21 | -LL | fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here +LL | fn meh() -> Box Meh<'_>> | ^^ `'_` is a reserved lifetime name error[E0106]: missing lifetime specifier --> $DIR/underscore-lifetime-binders.rs:2:17 | -LL | struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier +LL | struct Baz<'a>(&'_ &'a u8); | ^^ expected lifetime parameter error[E0106]: missing lifetime specifier --> $DIR/underscore-lifetime-binders.rs:10:29 | -LL | fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here +LL | fn meh() -> Box Meh<'_>> | ^^ help: consider giving it a 'static lifetime: `'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from @@ -27,7 +27,7 @@ LL | fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here error[E0106]: missing lifetime specifier --> $DIR/underscore-lifetime-binders.rs:16:35 | -LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } //~ ERROR missing lifetime specifier +LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } | ^^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_` or `y` diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr index b653b30bf6b7..76c14ccc14b4 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr @@ -1,7 +1,7 @@ error[E0623]: lifetime mismatch --> $DIR/underscore-lifetime-elison-mismatch.rs:1:49 | -LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } //~ ERROR lifetime mismatch +LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } | ------ ------ ^ ...but data from `y` flows into `x` here | | | these two types are declared with different lifetimes... diff --git a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr index e4ff653f3ad4..4b38a26f957f 100644 --- a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr +++ b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr @@ -1,7 +1,7 @@ error[E0637]: `'_` cannot be used here --> $DIR/underscore-outlives-bounds.rs:7:10 | -LL | impl<'b: '_> Foo<'b> for i32 {} //~ ERROR `'_` cannot be used here +LL | impl<'b: '_> Foo<'b> for i32 {} | ^^ `'_` is a reserved lifetime name error: aborting due to previous error diff --git a/src/test/ui/underscore-lifetime/where-clauses.stderr b/src/test/ui/underscore-lifetime/where-clauses.stderr index 57fe2456f4cc..1a3ea4af7e12 100644 --- a/src/test/ui/underscore-lifetime/where-clauses.stderr +++ b/src/test/ui/underscore-lifetime/where-clauses.stderr @@ -1,13 +1,13 @@ error[E0637]: `'_` cannot be used here --> $DIR/where-clauses.rs:3:10 | -LL | impl<'b: '_> Foo<'b> for i32 {} //~ ERROR `'_` cannot be used here +LL | impl<'b: '_> Foo<'b> for i32 {} | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here --> $DIR/where-clauses.rs:5:9 | -LL | impl Foo<'static> for Vec {} //~ ERROR `'_` cannot be used here +LL | impl Foo<'static> for Vec {} | ^^ `'_` is a reserved lifetime name error: aborting due to 2 previous errors diff --git a/src/test/ui/unevaluated_fixed_size_array_len.stderr b/src/test/ui/unevaluated_fixed_size_array_len.stderr index 200cf2a994d8..be6ed8d56232 100644 --- a/src/test/ui/unevaluated_fixed_size_array_len.stderr +++ b/src/test/ui/unevaluated_fixed_size_array_len.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `[(); 0]: Foo` is not satisfied --> $DIR/unevaluated_fixed_size_array_len.rs:12:5 | -LL | <[(); 0] as Foo>::foo() //~ ERROR E0277 +LL | <[(); 0] as Foo>::foo() | ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `[(); 0]` | = help: the following implementations were found: diff --git a/src/test/ui/uninhabited/uninhabited-enum-cast.stderr b/src/test/ui/uninhabited/uninhabited-enum-cast.stderr index 36dab0c43eb7..a39af7832f8c 100644 --- a/src/test/ui/uninhabited/uninhabited-enum-cast.stderr +++ b/src/test/ui/uninhabited/uninhabited-enum-cast.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `E` as `isize` --> $DIR/uninhabited-enum-cast.rs:4:20 | -LL | println!("{}", (e as isize).to_string()); //~ ERROR non-primitive cast +LL | println!("{}", (e as isize).to_string()); | ^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr index 2424252af2ad..45976f8ac56a 100644 --- a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr +++ b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr @@ -9,7 +9,7 @@ LL | | D(u32), LL | | } | |_- `Foo` defined here ... -LL | let Foo::D(_y) = x; //~ ERROR refutable pattern in local binding: `A(_)` not covered +LL | let Foo::D(_y) = x; | ^^^^^^^^^^ pattern `A(_)` not covered error: aborting due to previous error diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr index fec95ca14943..533cf595ef0c 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -1,7 +1,7 @@ error[E0004]: non-exhaustive patterns: `Err(_)` not covered --> $DIR/uninhabited-matches-feature-gated.rs:5:19 | -LL | let _ = match x { //~ ERROR non-exhaustive +LL | let _ = match x { | ^ pattern `Err(_)` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -9,7 +9,7 @@ LL | let _ = match x { //~ ERROR non-exhaustive error[E0004]: non-exhaustive patterns: type `&Void` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:10:19 | -LL | let _ = match x {}; //~ ERROR non-exhaustive +LL | let _ = match x {}; | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -17,7 +17,7 @@ LL | let _ = match x {}; //~ ERROR non-exhaustive error[E0004]: non-exhaustive patterns: type `(Void,)` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:13:19 | -LL | let _ = match x {}; //~ ERROR non-exhaustive +LL | let _ = match x {}; | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -25,7 +25,7 @@ LL | let _ = match x {}; //~ ERROR non-exhaustive error[E0004]: non-exhaustive patterns: type `[Void; 1]` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:16:19 | -LL | let _ = match x {}; //~ ERROR non-exhaustive +LL | let _ = match x {}; | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -33,7 +33,7 @@ LL | let _ = match x {}; //~ ERROR non-exhaustive error[E0004]: non-exhaustive patterns: `&[_]` not covered --> $DIR/uninhabited-matches-feature-gated.rs:19:19 | -LL | let _ = match x { //~ ERROR non-exhaustive +LL | let _ = match x { | ^ pattern `&[_]` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms @@ -41,7 +41,7 @@ LL | let _ = match x { //~ ERROR non-exhaustive error[E0004]: non-exhaustive patterns: `Err(_)` not covered --> $DIR/uninhabited-matches-feature-gated.rs:27:19 | -LL | let _ = match x { //~ ERROR non-exhaustive +LL | let _ = match x { | ^ pattern `Err(_)` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms diff --git a/src/test/ui/uninhabited/uninhabited-patterns.stderr b/src/test/ui/uninhabited/uninhabited-patterns.stderr index eaae024cbf91..3e5329cfb301 100644 --- a/src/test/ui/uninhabited/uninhabited-patterns.stderr +++ b/src/test/ui/uninhabited/uninhabited-patterns.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/uninhabited-patterns.rs:27:9 | -LL | &[..] => (), //~ ERROR unreachable pattern +LL | &[..] => (), | ^^^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![deny(unreachable_patterns)] error: unreachable pattern --> $DIR/uninhabited-patterns.rs:32:9 | -LL | Ok(box _) => (), //~ ERROR unreachable pattern +LL | Ok(box _) => (), | ^^^^^^^^^ error: unreachable pattern --> $DIR/uninhabited-patterns.rs:34:9 | -LL | Err(&[..]) => (), //~ ERROR unreachable pattern +LL | Err(&[..]) => (), | ^^^^^^^^^^ error: unreachable pattern --> $DIR/uninhabited-patterns.rs:41:9 | -LL | Err(Ok(_y)) => (), //~ ERROR unreachable pattern +LL | Err(Ok(_y)) => (), | ^^^^^^^^^^^ error: unreachable pattern diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.stderr index 9058707e5051..c1c6932e1e25 100644 --- a/src/test/ui/union/union-borrow-move-parent-sibling.stderr +++ b/src/test/ui/union/union-borrow-move-parent-sibling.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `u.y` as immutable because `u.x.0` is also borrowed | LL | let a = &mut u.x.0; | ----- mutable borrow occurs here -LL | let b = &u.y; //~ ERROR cannot borrow `u.y` +LL | let b = &u.y; | ^^^ immutable borrow occurs here LL | use_borrow(a); LL | } @@ -14,7 +14,7 @@ error[E0382]: use of moved value: `u.y` | LL | let a = u.x.0; | - value moved here -LL | let b = u.y; //~ ERROR use of moved value: `u.y` +LL | let b = u.y; | ^ value used here after move | = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait @@ -24,7 +24,7 @@ error[E0502]: cannot borrow `u.y` as immutable because `u.x.0.0` is also borrowe | LL | let a = &mut (u.x.0).0; | --------- mutable borrow occurs here -LL | let b = &u.y; //~ ERROR cannot borrow `u.y` +LL | let b = &u.y; | ^^^ immutable borrow occurs here LL | use_borrow(a); LL | } @@ -35,7 +35,7 @@ error[E0382]: use of moved value: `u.y` | LL | let a = (u.x.0).0; | - value moved here -LL | let b = u.y; //~ ERROR use of moved value: `u.y` +LL | let b = u.y; | ^ value used here after move | = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait @@ -45,7 +45,7 @@ error[E0502]: cannot borrow `u` (via `u.x`) as immutable because `u` is also bor | LL | let a = &mut *u.y; | ---- mutable borrow occurs here (via `*u.y`) -LL | let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`) +LL | let b = &u.x; | ^^^ immutable borrow of `u.x` -- which overlaps with `*u.y` -- occurs here LL | use_borrow(a); LL | } @@ -56,7 +56,7 @@ error[E0382]: use of moved value: `u.x` | LL | let a = *u.y; | - value moved here -LL | let b = u.x; //~ ERROR use of moved value: `u.x` +LL | let b = u.x; | ^ value used here after move | = note: move occurs because `u.x` has type `[type error]`, which does not implement the `Copy` trait diff --git a/src/test/ui/union/union-const-pat.stderr b/src/test/ui/union/union-const-pat.stderr index 5106721f310e..dc87f4de5219 100644 --- a/src/test/ui/union/union-const-pat.stderr +++ b/src/test/ui/union/union-const-pat.stderr @@ -1,7 +1,7 @@ error: cannot use unions in constant patterns --> $DIR/union-const-pat.rs:10:9 | -LL | C => {} //~ ERROR cannot use unions in constant patterns +LL | C => {} | ^ error: aborting due to previous error diff --git a/src/test/ui/union/union-copy.stderr b/src/test/ui/union/union-copy.stderr index b3991b5ba6a5..a875ff660f97 100644 --- a/src/test/ui/union/union-copy.stderr +++ b/src/test/ui/union/union-copy.stderr @@ -4,7 +4,7 @@ error[E0204]: the trait `Copy` may not be implemented for this type LL | a: String | --------- this field does not implement `Copy` ... -LL | impl Copy for W {} //~ ERROR the trait `Copy` may not be implemented for this type +LL | impl Copy for W {} | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/union/union-derive-clone.stderr b/src/test/ui/union/union-derive-clone.stderr index 9580a9710e1f..7421bb73ec9d 100644 --- a/src/test/ui/union/union-derive-clone.stderr +++ b/src/test/ui/union/union-derive-clone.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U1: std::marker::Copy` is not satisfied --> $DIR/union-derive-clone.rs:3:10 | -LL | #[derive(Clone)] //~ ERROR the trait bound `U1: std::marker::Copy` is not satisfied +LL | #[derive(Clone)] | ^^^^^ the trait `std::marker::Copy` is not implemented for `U1` | = note: required by `std::clone::AssertParamIsCopy` @@ -12,7 +12,7 @@ error[E0599]: no method named `clone` found for type `U4` in the cu LL | union U4 { | ----------- method `clone` not found for this ... -LL | let w = u.clone(); //~ ERROR no method named `clone` found for type `U4` +LL | let w = u.clone(); | ^^^^^ | = note: the method `clone` exists but the following trait bounds were not satisfied: diff --git a/src/test/ui/union/union-derive-eq.stderr b/src/test/ui/union/union-derive-eq.stderr index d93dcd64efc0..f63ab1704c49 100644 --- a/src/test/ui/union/union-derive-eq.stderr +++ b/src/test/ui/union/union-derive-eq.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `PartialEqNotEq: std::cmp::Eq` is not satisfied --> $DIR/union-derive-eq.rs:15:5 | -LL | a: PartialEqNotEq, //~ ERROR the trait bound `PartialEqNotEq: std::cmp::Eq` is not satisfied +LL | a: PartialEqNotEq, | ^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `PartialEqNotEq` | = note: required by `std::cmp::AssertParamIsEq` diff --git a/src/test/ui/union/union-derive.stderr b/src/test/ui/union/union-derive.stderr index 0ec873553f30..919c6d5ceda6 100644 --- a/src/test/ui/union/union-derive.stderr +++ b/src/test/ui/union/union-derive.stderr @@ -1,37 +1,37 @@ error: this trait cannot be derived for unions --> $DIR/union-derive.rs:9:5 | -LL | Debug, //~ ERROR this trait cannot be derived for unions +LL | Debug, | ^^^^^ error: this trait cannot be derived for unions --> $DIR/union-derive.rs:8:5 | -LL | Default, //~ ERROR this trait cannot be derived for unions +LL | Default, | ^^^^^^^ error: this trait cannot be derived for unions --> $DIR/union-derive.rs:7:5 | -LL | Hash, //~ ERROR this trait cannot be derived for unions +LL | Hash, | ^^^^ error: this trait cannot be derived for unions --> $DIR/union-derive.rs:6:5 | -LL | Ord, //~ ERROR this trait cannot be derived for unions +LL | Ord, | ^^^ error: this trait cannot be derived for unions --> $DIR/union-derive.rs:5:5 | -LL | PartialOrd, //~ ERROR this trait cannot be derived for unions +LL | PartialOrd, | ^^^^^^^^^^ error: this trait cannot be derived for unions --> $DIR/union-derive.rs:4:5 | -LL | PartialEq, //~ ERROR this trait cannot be derived for unions +LL | PartialEq, | ^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/union/union-empty.stderr b/src/test/ui/union/union-empty.stderr index 71bba8fda2eb..a80b27e6eb56 100644 --- a/src/test/ui/union/union-empty.stderr +++ b/src/test/ui/union/union-empty.stderr @@ -1,7 +1,7 @@ error: unions cannot have zero fields --> $DIR/union-empty.rs:1:1 | -LL | union U {} //~ ERROR unions cannot have zero fields +LL | union U {} | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/union/union-fields-1.stderr b/src/test/ui/union/union-fields-1.stderr index 3f165db4763e..f848db726f9e 100644 --- a/src/test/ui/union/union-fields-1.stderr +++ b/src/test/ui/union/union-fields-1.stderr @@ -1,7 +1,7 @@ error: field is never used: `c` --> $DIR/union-fields-1.rs:6:5 | -LL | c: u8, //~ ERROR field is never used +LL | c: u8, | ^^^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![deny(dead_code)] error: field is never used: `a` --> $DIR/union-fields-1.rs:9:5 | -LL | a: u8, //~ ERROR field is never used +LL | a: u8, | ^^^^^ error: field is never used: `a` --> $DIR/union-fields-1.rs:13:20 | -LL | union NoDropLike { a: u8 } //~ ERROR field is never used +LL | union NoDropLike { a: u8 } | ^^^^^ error: field is never used: `c` --> $DIR/union-fields-1.rs:18:5 | -LL | c: u8, //~ ERROR field is never used +LL | c: u8, | ^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/union/union-fields-2.stderr b/src/test/ui/union/union-fields-2.stderr index 959554f6d220..b4d6ed9b0201 100644 --- a/src/test/ui/union/union-fields-2.stderr +++ b/src/test/ui/union/union-fields-2.stderr @@ -1,19 +1,19 @@ error: union expressions should have exactly one field --> $DIR/union-fields-2.rs:7:13 | -LL | let u = U {}; //~ ERROR union expressions should have exactly one field +LL | let u = U {}; | ^ error: union expressions should have exactly one field --> $DIR/union-fields-2.rs:9:13 | -LL | let u = U { a: 0, b: 1 }; //~ ERROR union expressions should have exactly one field +LL | let u = U { a: 0, b: 1 }; | ^ error[E0560]: union `U` has no field named `c` --> $DIR/union-fields-2.rs:10:29 | -LL | let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field +LL | let u = U { a: 0, b: 1, c: 2 }; | ^ `U` does not have this field | = note: available fields are: `a`, `b` @@ -21,61 +21,61 @@ LL | let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have error: union expressions should have exactly one field --> $DIR/union-fields-2.rs:10:13 | -LL | let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field +LL | let u = U { a: 0, b: 1, c: 2 }; | ^ error: union expressions should have exactly one field --> $DIR/union-fields-2.rs:12:13 | -LL | let u = U { ..u }; //~ ERROR union expressions should have exactly one field +LL | let u = U { ..u }; | ^ error[E0436]: functional record update syntax requires a struct --> $DIR/union-fields-2.rs:12:19 | -LL | let u = U { ..u }; //~ ERROR union expressions should have exactly one field +LL | let u = U { ..u }; | ^ error: union patterns should have exactly one field --> $DIR/union-fields-2.rs:15:9 | -LL | let U {} = u; //~ ERROR union patterns should have exactly one field +LL | let U {} = u; | ^^^^ error: union patterns should have exactly one field --> $DIR/union-fields-2.rs:17:9 | -LL | let U { a, b } = u; //~ ERROR union patterns should have exactly one field +LL | let U { a, b } = u; | ^^^^^^^^^^ error[E0026]: union `U` does not have a field named `c` --> $DIR/union-fields-2.rs:18:19 | -LL | let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field +LL | let U { a, b, c } = u; | ^ union `U` does not have this field error: union patterns should have exactly one field --> $DIR/union-fields-2.rs:18:9 | -LL | let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field +LL | let U { a, b, c } = u; | ^^^^^^^^^^^^^ error: union patterns should have exactly one field --> $DIR/union-fields-2.rs:20:9 | -LL | let U { .. } = u; //~ ERROR union patterns should have exactly one field +LL | let U { .. } = u; | ^^^^^^^^ error: `..` cannot be used in union patterns --> $DIR/union-fields-2.rs:20:9 | -LL | let U { .. } = u; //~ ERROR union patterns should have exactly one field +LL | let U { .. } = u; | ^^^^^^^^ error: `..` cannot be used in union patterns --> $DIR/union-fields-2.rs:22:9 | -LL | let U { a, .. } = u; //~ ERROR `..` cannot be used in union patterns +LL | let U { a, .. } = u; | ^^^^^^^^^^^ error: aborting due to 13 previous errors diff --git a/src/test/ui/union/union-lint-dead-code.stderr b/src/test/ui/union/union-lint-dead-code.stderr index 6551523c54df..79c38a468144 100644 --- a/src/test/ui/union/union-lint-dead-code.stderr +++ b/src/test/ui/union/union-lint-dead-code.stderr @@ -1,7 +1,7 @@ error: field is never used: `b` --> $DIR/union-lint-dead-code.rs:5:5 | -LL | b: bool, //~ ERROR: field is never used +LL | b: bool, | ^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/union/union-nonrepresentable.stderr b/src/test/ui/union/union-nonrepresentable.stderr index 1a7603a46374..746c1033ea34 100644 --- a/src/test/ui/union/union-nonrepresentable.stderr +++ b/src/test/ui/union/union-nonrepresentable.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `U` has infinite size --> $DIR/union-nonrepresentable.rs:3:1 | -LL | union U { //~ ERROR recursive type `U` has infinite size +LL | union U { | ^^^^^^^ recursive type has infinite size LL | a: u8, LL | b: U, diff --git a/src/test/ui/union/union-repr-c.stderr b/src/test/ui/union/union-repr-c.stderr index bac09c34b8b1..40d9a50f1fa4 100644 --- a/src/test/ui/union/union-repr-c.stderr +++ b/src/test/ui/union/union-repr-c.stderr @@ -1,7 +1,7 @@ error: `extern` block uses type `W` which is not FFI-safe: this union has unspecified layout --> $DIR/union-repr-c.rs:15:22 | -LL | static FOREIGN2: W; //~ ERROR union has unspecified layout +LL | static FOREIGN2: W; | ^ | note: lint level defined here diff --git a/src/test/ui/union/union-suggest-field.stderr b/src/test/ui/union/union-suggest-field.stderr index 8ea07360d0f2..c737bc29d947 100644 --- a/src/test/ui/union/union-suggest-field.stderr +++ b/src/test/ui/union/union-suggest-field.stderr @@ -7,13 +7,13 @@ LL | let u = U { principle: 0 }; error[E0609]: no field `principial` on type `U` --> $DIR/union-suggest-field.rs:14:15 | -LL | let w = u.principial; //~ ERROR no field `principial` on type `U` +LL | let w = u.principial; | ^^^^^^^^^^ help: a field with a similar name exists: `principal` error[E0615]: attempted to take value of method `calculate` on type `U` --> $DIR/union-suggest-field.rs:18:15 | -LL | let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U` +LL | let y = u.calculate; | ^^^^^^^^^ help: use parentheses to call the method: `calculate()` error: aborting due to 3 previous errors diff --git a/src/test/ui/union/union-unsafe.stderr b/src/test/ui/union/union-unsafe.stderr index 35051485f6ad..ab62508fcf66 100644 --- a/src/test/ui/union/union-unsafe.stderr +++ b/src/test/ui/union/union-unsafe.stderr @@ -1,7 +1,7 @@ error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block --> $DIR/union-unsafe.rs:21:5 | -LL | u3.a = T::default(); //~ ERROR assignment to non-`Copy` union field is unsafe +LL | u3.a = T::default(); | ^^^^ assignment to non-`Copy` union field | = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized @@ -9,7 +9,7 @@ LL | u3.a = T::default(); //~ ERROR assignment to non-`Copy` union field is error[E0133]: access to union field is unsafe and requires unsafe function or block --> $DIR/union-unsafe.rs:33:13 | -LL | let a = u1.a; //~ ERROR access to union field is unsafe +LL | let a = u1.a; | ^^^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior @@ -17,7 +17,7 @@ LL | let a = u1.a; //~ ERROR access to union field is unsafe error[E0133]: access to union field is unsafe and requires unsafe function or block --> $DIR/union-unsafe.rs:35:14 | -LL | let U1 { a } = u1; //~ ERROR access to union field is unsafe +LL | let U1 { a } = u1; | ^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior @@ -25,7 +25,7 @@ LL | let U1 { a } = u1; //~ ERROR access to union field is unsafe error[E0133]: access to union field is unsafe and requires unsafe function or block --> $DIR/union-unsafe.rs:36:20 | -LL | if let U1 { a: 12 } = u1 {} //~ ERROR access to union field is unsafe +LL | if let U1 { a: 12 } = u1 {} | ^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior @@ -33,7 +33,7 @@ LL | if let U1 { a: 12 } = u1 {} //~ ERROR access to union field is unsafe error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block --> $DIR/union-unsafe.rs:40:5 | -LL | u2.a = String::from("new"); //~ ERROR assignment to non-`Copy` union field is unsafe +LL | u2.a = String::from("new"); | ^^^^ assignment to non-`Copy` union field | = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized @@ -41,7 +41,7 @@ LL | u2.a = String::from("new"); //~ ERROR assignment to non-`Copy` union fi error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block --> $DIR/union-unsafe.rs:44:5 | -LL | u3.a = String::from("new"); //~ ERROR assignment to non-`Copy` union field is unsafe +LL | u3.a = String::from("new"); | ^^^^ assignment to non-`Copy` union field | = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized diff --git a/src/test/ui/union/union-with-drop-fields-lint.stderr b/src/test/ui/union/union-with-drop-fields-lint.stderr index d8f456f2aefb..2f90f240d2e1 100644 --- a/src/test/ui/union/union-with-drop-fields-lint.stderr +++ b/src/test/ui/union/union-with-drop-fields-lint.stderr @@ -1,7 +1,7 @@ error: union contains a field with possibly non-trivial drop code, drop code of union fields is ignored when dropping the union --> $DIR/union-with-drop-fields-lint.rs:10:5 | -LL | a: String, //~ ERROR union contains a field with possibly non-trivial drop code +LL | a: String, | ^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unions_with_drop_fields)] error: union contains a field with possibly non-trivial drop code, drop code of union fields is ignored when dropping the union --> $DIR/union-with-drop-fields-lint.rs:18:5 | -LL | a: S, //~ ERROR union contains a field with possibly non-trivial drop code +LL | a: S, | ^^^^ error: union contains a field with possibly non-trivial drop code, drop code of union fields is ignored when dropping the union --> $DIR/union-with-drop-fields-lint.rs:23:5 | -LL | a: T, //~ ERROR union contains a field with possibly non-trivial drop code +LL | a: T, | ^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/unique-object-noncopyable.stderr b/src/test/ui/unique-object-noncopyable.stderr index 78b46027c95e..407905f52e75 100644 --- a/src/test/ui/unique-object-noncopyable.stderr +++ b/src/test/ui/unique-object-noncopyable.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `clone` found for type `std::boxed::Box` in the current scope --> $DIR/unique-object-noncopyable.rs:24:16 | -LL | let _z = y.clone(); //~ ERROR no method named `clone` found +LL | let _z = y.clone(); | ^^^^^ | = note: the method `clone` exists but the following trait bounds were not satisfied: diff --git a/src/test/ui/unique-pinned-nocopy.stderr b/src/test/ui/unique-pinned-nocopy.stderr index c7cabd172eb3..0f6ba90afacf 100644 --- a/src/test/ui/unique-pinned-nocopy.stderr +++ b/src/test/ui/unique-pinned-nocopy.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `clone` found for type `std::boxed::Box` in the current scope --> $DIR/unique-pinned-nocopy.rs:12:16 | -LL | let _j = i.clone(); //~ ERROR no method named `clone` found +LL | let _j = i.clone(); | ^^^^^ | = note: the method `clone` exists but the following trait bounds were not satisfied: diff --git a/src/test/ui/unknown-lint-tool-name.stderr b/src/test/ui/unknown-lint-tool-name.stderr index e9d44e2e3bce..a127af633dcf 100644 --- a/src/test/ui/unknown-lint-tool-name.stderr +++ b/src/test/ui/unknown-lint-tool-name.stderr @@ -1,13 +1,13 @@ error[E0710]: an unknown tool name found in scoped lint: `foo::bar` --> $DIR/unknown-lint-tool-name.rs:1:9 | -LL | #![deny(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar` +LL | #![deny(foo::bar)] | ^^^ error[E0710]: an unknown tool name found in scoped lint: `foo::bar` --> $DIR/unknown-lint-tool-name.rs:3:9 | -LL | #[allow(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar` +LL | #[allow(foo::bar)] | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/unknown-tool-name.stderr b/src/test/ui/unknown-tool-name.stderr index 7bd2da285980..7a6ed57bda6f 100644 --- a/src/test/ui/unknown-tool-name.stderr +++ b/src/test/ui/unknown-tool-name.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: use of undeclared type or module `foo` --> $DIR/unknown-tool-name.rs:1:3 | -LL | #[foo::bar] //~ ERROR failed to resolve: use of undeclared type or module `foo` +LL | #[foo::bar] | ^^^ use of undeclared type or module `foo` error: aborting due to previous error diff --git a/src/test/ui/unop-move-semantics.stderr b/src/test/ui/unop-move-semantics.stderr index 65d2967c61ee..e2fb42549207 100644 --- a/src/test/ui/unop-move-semantics.stderr +++ b/src/test/ui/unop-move-semantics.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | !x; | - value moved here LL | -LL | x.clone(); //~ ERROR: use of moved value +LL | x.clone(); | ^ value used here after move | = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait @@ -15,7 +15,7 @@ error[E0505]: cannot move out of `x` because it is borrowed LL | let m = &x; | - borrow of `x` occurs here ... -LL | !x; //~ ERROR: cannot move out of `x` because it is borrowed +LL | !x; | ^ move out of `x` occurs here error[E0505]: cannot move out of `y` because it is borrowed @@ -24,19 +24,19 @@ error[E0505]: cannot move out of `y` because it is borrowed LL | let n = &mut y; | - borrow of `y` occurs here ... -LL | !y; //~ ERROR: cannot move out of `y` because it is borrowed +LL | !y; | ^ move out of `y` occurs here error[E0507]: cannot move out of borrowed content --> $DIR/unop-move-semantics.rs:24:6 | -LL | !*m; //~ ERROR: cannot move out of borrowed content +LL | !*m; | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/unop-move-semantics.rs:26:6 | -LL | !*n; //~ ERROR: cannot move out of borrowed content +LL | !*n; | ^^ cannot move out of borrowed content error: aborting due to 5 previous errors diff --git a/src/test/ui/unop-neg-bool.stderr b/src/test/ui/unop-neg-bool.stderr index c13c1a15a7cd..182730137492 100644 --- a/src/test/ui/unop-neg-bool.stderr +++ b/src/test/ui/unop-neg-bool.stderr @@ -1,7 +1,7 @@ error[E0600]: cannot apply unary operator `-` to type `bool` --> $DIR/unop-neg-bool.rs:2:5 | -LL | -true; //~ ERROR cannot apply unary operator `-` to type `bool` +LL | -true; | ^^^^^ cannot apply unary operator `-` | = note: an implementation of `std::ops::Neg` might be missing for `bool` diff --git a/src/test/ui/unreachable/unreachable-arm.stderr b/src/test/ui/unreachable/unreachable-arm.stderr index 5b34482b59bb..8e65745c7b09 100644 --- a/src/test/ui/unreachable/unreachable-arm.stderr +++ b/src/test/ui/unreachable/unreachable-arm.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/unreachable-arm.rs:11:9 | -LL | Foo::A(_, 1) => { } //~ ERROR unreachable pattern +LL | Foo::A(_, 1) => { } | ^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/unreachable/unreachable-code.stderr b/src/test/ui/unreachable/unreachable-code.stderr index afb3629d5fda..803bb966be8f 100644 --- a/src/test/ui/unreachable/unreachable-code.stderr +++ b/src/test/ui/unreachable/unreachable-code.stderr @@ -1,7 +1,7 @@ error: unreachable statement --> $DIR/unreachable-code.rs:7:3 | -LL | let a = 3; //~ ERROR: unreachable statement +LL | let a = 3; | ^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/unreachable/unreachable-in-call.stderr b/src/test/ui/unreachable/unreachable-in-call.stderr index b78070d3fb12..f8dd54590f6a 100644 --- a/src/test/ui/unreachable/unreachable-in-call.stderr +++ b/src/test/ui/unreachable/unreachable-in-call.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/unreachable-in-call.rs:14:10 | -LL | get_u8()); //~ ERROR unreachable expression +LL | get_u8()); | ^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/unreachable-in-call.rs:17:5 | -LL | / call( //~ ERROR unreachable expression +LL | / call( LL | | get_u8(), LL | | diverge()); | |__________________^ diff --git a/src/test/ui/unreachable/unreachable-variant.stderr b/src/test/ui/unreachable/unreachable-variant.stderr index 60fdae5cbcee..276c77f9b424 100644 --- a/src/test/ui/unreachable/unreachable-variant.stderr +++ b/src/test/ui/unreachable/unreachable-variant.stderr @@ -1,7 +1,7 @@ error[E0603]: module `super_sekrit` is private --> $DIR/unreachable-variant.rs:6:21 | -LL | let _x = other::super_sekrit::sooper_sekrit::baz; //~ ERROR is private +LL | let _x = other::super_sekrit::sooper_sekrit::baz; | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/unreachable/unwarned-match-on-never.stderr b/src/test/ui/unreachable/unwarned-match-on-never.stderr index 8807e5f04e58..ccb70d743114 100644 --- a/src/test/ui/unreachable/unwarned-match-on-never.stderr +++ b/src/test/ui/unreachable/unwarned-match-on-never.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/unwarned-match-on-never.rs:10:5 | -LL | match x {} //~ ERROR unreachable expression +LL | match x {} | ^^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unreachable_code)] error: unreachable arm --> $DIR/unwarned-match-on-never.rs:15:15 | -LL | () => () //~ ERROR unreachable arm +LL | () => () | ^^ error: unreachable expression --> $DIR/unwarned-match-on-never.rs:21:5 | -LL | / match () { //~ ERROR unreachable expression +LL | / match () { LL | | () => (), LL | | } | |_____^ diff --git a/src/test/ui/unresolved/unresolved-import-recovery.stderr b/src/test/ui/unresolved/unresolved-import-recovery.stderr index 0154d002efee..5e371b70bfa5 100644 --- a/src/test/ui/unresolved/unresolved-import-recovery.stderr +++ b/src/test/ui/unresolved/unresolved-import-recovery.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `unresolved` --> $DIR/unresolved-import-recovery.rs:4:13 | -LL | pub use unresolved; //~ ERROR unresolved import `unresolved` +LL | pub use unresolved; | ^^^^^^^^^^ no `unresolved` in the root error: aborting due to previous error diff --git a/src/test/ui/unresolved/unresolved-import.stderr b/src/test/ui/unresolved/unresolved-import.stderr index 4f2fef938c97..fb5c0760d158 100644 --- a/src/test/ui/unresolved/unresolved-import.stderr +++ b/src/test/ui/unresolved/unresolved-import.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `foo` --> $DIR/unresolved-import.rs:1:5 | -LL | use foo::bar; //~ ERROR unresolved import `foo` [E0432] +LL | use foo::bar; | ^^^ maybe a missing `extern crate foo;`? error[E0432]: unresolved import `bar::Baz` --> $DIR/unresolved-import.rs:4:5 | -LL | use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432] +LL | use bar::Baz as x; | ^^^^^---^^^^^ | | | | | help: a similar name exists in the module: `Bar` @@ -16,7 +16,7 @@ LL | use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432] error[E0432]: unresolved import `food::baz` --> $DIR/unresolved-import.rs:9:5 | -LL | use food::baz; //~ ERROR unresolved import `food::baz` +LL | use food::baz; | ^^^^^^--- | | | | | help: a similar name exists in the module: `bag` @@ -25,7 +25,7 @@ LL | use food::baz; //~ ERROR unresolved import `food::baz` error[E0432]: unresolved import `food::beens` --> $DIR/unresolved-import.rs:14:12 | -LL | use food::{beens as Foo}; //~ ERROR unresolved import `food::beens` [E0432] +LL | use food::{beens as Foo}; | -----^^^^^^^ | | | no `beens` in `food` @@ -34,13 +34,13 @@ LL | use food::{beens as Foo}; //~ ERROR unresolved import `food::beens` [E0432] error[E0432]: unresolved import `MyEnum` --> $DIR/unresolved-import.rs:38:9 | -LL | use MyEnum::*; //~ ERROR unresolved import `MyEnum` [E0432] +LL | use MyEnum::*; | ^^^^^^ help: a similar path exists: `self::MyEnum` error[E0432]: unresolved import `Enum` --> $DIR/unresolved-import.rs:48:9 | -LL | use Enum::*; //~ ERROR unresolved import `Enum` [E0432] +LL | use Enum::*; | ^^^^ help: a similar path exists: `self::Enum` error: aborting due to 6 previous errors diff --git a/src/test/ui/unsafe/ranged_ints.stderr b/src/test/ui/unsafe/ranged_ints.stderr index f59a930b5a90..4e43df495c0d 100644 --- a/src/test/ui/unsafe/ranged_ints.stderr +++ b/src/test/ui/unsafe/ranged_ints.stderr @@ -1,7 +1,7 @@ error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block --> $DIR/ranged_ints.rs:7:14 | -LL | let _x = NonZero(0); //~ ERROR initializing type with `rustc_layout_scalar_valid_range` attr +LL | let _x = NonZero(0); | ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr | = note: initializing a layout restricted type's field with a value outside the valid range is undefined behavior diff --git a/src/test/ui/unsafe/ranged_ints2.stderr b/src/test/ui/unsafe/ranged_ints2.stderr index ae63f47ed74a..ee1d1f10e71b 100644 --- a/src/test/ui/unsafe/ranged_ints2.stderr +++ b/src/test/ui/unsafe/ranged_ints2.stderr @@ -1,7 +1,7 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block --> $DIR/ranged_ints2.rs:8:13 | -LL | let y = &mut x.0; //~ ERROR mutation of layout constrained field is unsafe +LL | let y = &mut x.0; | ^^^^^^^^ mutation of layout constrained field | = note: mutating layout constrained fields cannot statically be checked for valid values diff --git a/src/test/ui/unsafe/ranged_ints2_const.stderr b/src/test/ui/unsafe/ranged_ints2_const.stderr index fb3841948f11..7d3e141ba709 100644 --- a/src/test/ui/unsafe/ranged_ints2_const.stderr +++ b/src/test/ui/unsafe/ranged_ints2_const.stderr @@ -1,7 +1,7 @@ error[E0723]: mutable references in const fn are unstable (see issue #57563) --> $DIR/ranged_ints2_const.rs:11:9 | -LL | let y = &mut x.0; //~ ERROR references in const fn are unstable +LL | let y = &mut x.0; | ^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | let y = &mut x.0; //~ ERROR references in const fn are unstable error[E0723]: mutable references in const fn are unstable (see issue #57563) --> $DIR/ranged_ints2_const.rs:18:9 | -LL | let y = unsafe { &mut x.0 }; //~ ERROR mutable references in const fn are unstable +LL | let y = unsafe { &mut x.0 }; | ^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | let y = unsafe { &mut x.0 }; //~ ERROR mutable references in const fn a error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block --> $DIR/ranged_ints2_const.rs:11:13 | -LL | let y = &mut x.0; //~ ERROR references in const fn are unstable +LL | let y = &mut x.0; | ^^^^^^^^ mutation of layout constrained field | = note: mutating layout constrained fields cannot statically be checked for valid values diff --git a/src/test/ui/unsafe/ranged_ints3.stderr b/src/test/ui/unsafe/ranged_ints3.stderr index 311a058fdb07..4d4c9167150e 100644 --- a/src/test/ui/unsafe/ranged_ints3.stderr +++ b/src/test/ui/unsafe/ranged_ints3.stderr @@ -1,7 +1,7 @@ error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block --> $DIR/ranged_ints3.rs:10:13 | -LL | let y = &x.0; //~ ERROR borrow of layout constrained field with interior mutability +LL | let y = &x.0; | ^^^^ borrow of layout constrained field with interior mutability | = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values diff --git a/src/test/ui/unsafe/ranged_ints3_const.stderr b/src/test/ui/unsafe/ranged_ints3_const.stderr index d83d75787d94..ea15cd5e901b 100644 --- a/src/test/ui/unsafe/ranged_ints3_const.stderr +++ b/src/test/ui/unsafe/ranged_ints3_const.stderr @@ -1,19 +1,19 @@ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead --> $DIR/ranged_ints3_const.rs:12:13 | -LL | let y = &x.0; //~ ERROR cannot borrow a constant which may contain interior mutability +LL | let y = &x.0; | ^^^^ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead --> $DIR/ranged_ints3_const.rs:19:22 | -LL | let y = unsafe { &x.0 }; //~ ERROR cannot borrow a constant which may contain interior mut +LL | let y = unsafe { &x.0 }; | ^^^^ error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block --> $DIR/ranged_ints3_const.rs:12:13 | -LL | let y = &x.0; //~ ERROR cannot borrow a constant which may contain interior mutability +LL | let y = &x.0; | ^^^^ borrow of layout constrained field with interior mutability | = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values diff --git a/src/test/ui/unsafe/ranged_ints4.stderr b/src/test/ui/unsafe/ranged_ints4.stderr index c6468b643b41..68c22589d3ff 100644 --- a/src/test/ui/unsafe/ranged_ints4.stderr +++ b/src/test/ui/unsafe/ranged_ints4.stderr @@ -1,7 +1,7 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block --> $DIR/ranged_ints4.rs:8:5 | -LL | x.0 = 0; //~ ERROR mutation of layout constrained field is unsafe +LL | x.0 = 0; | ^^^^^^^ mutation of layout constrained field | = note: mutating layout constrained fields cannot statically be checked for valid values diff --git a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr index 7751fe017b8e..28b18d50fff1 100644 --- a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr +++ b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr @@ -1,7 +1,7 @@ error: unnecessary `unsafe` block --> $DIR/unsafe-around-compiler-generated-unsafe.rs:6:5 | -LL | unsafe { println!("foo"); } //~ ERROR unnecessary `unsafe` +LL | unsafe { println!("foo"); } | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here diff --git a/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr b/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr index 1e000062cc3e..8f621d6ed11c 100644 --- a/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr +++ b/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr @@ -1,7 +1,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block --> $DIR/unsafe-fn-assign-deref-ptr.rs:6:5 | -LL | *p = 0; //~ ERROR dereference of raw pointer is unsafe +LL | *p = 0; | ^^^^^^ dereference of raw pointer | = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior diff --git a/src/test/ui/unsafe/unsafe-fn-autoderef.stderr b/src/test/ui/unsafe/unsafe-fn-autoderef.stderr index ded64ba69e89..20a88c356108 100644 --- a/src/test/ui/unsafe/unsafe-fn-autoderef.stderr +++ b/src/test/ui/unsafe/unsafe-fn-autoderef.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `f` on type `*const Rec` --> $DIR/unsafe-fn-autoderef.rs:19:14 | -LL | return p.f; //~ ERROR no field `f` on type `*const Rec` +LL | return p.f; | --^ | | | help: `p` is a raw pointer; try dereferencing it: `(*p).f` diff --git a/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr b/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr index 4ad7c6e5c75d..80d2c6ced24c 100644 --- a/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr +++ b/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block --> $DIR/unsafe-fn-called-from-safe.rs:4:5 | -LL | f(); //~ ERROR call to unsafe function is unsafe +LL | f(); | ^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr b/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr index d48a7681cadc..e8e82dec0b0b 100644 --- a/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr +++ b/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr @@ -1,7 +1,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block --> $DIR/unsafe-fn-deref-ptr.rs:2:12 | -LL | return *p; //~ ERROR dereference of raw pointer is unsafe +LL | return *p; | ^^ dereference of raw pointer | = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior diff --git a/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr b/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr index f68e849341b9..a7b73ec53429 100644 --- a/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr +++ b/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block --> $DIR/unsafe-fn-used-as-value.rs:5:5 | -LL | x(); //~ ERROR call to unsafe function is unsafe +LL | x(); | ^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/unsafe/unsafe-subtyping.stderr b/src/test/ui/unsafe/unsafe-subtyping.stderr index 3db0bcba81bf..cac5ee07089e 100644 --- a/src/test/ui/unsafe/unsafe-subtyping.stderr +++ b/src/test/ui/unsafe/unsafe-subtyping.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn foo(x: Option) -> Option { | ---------------------- expected `std::option::Option` because of return type -LL | x //~ ERROR mismatched types +LL | x | ^ expected unsafe fn, found normal fn | = note: expected type `std::option::Option` diff --git a/src/test/ui/unsized-locals/double-move.stderr b/src/test/ui/unsized-locals/double-move.stderr index 1009e913b7b6..e6573af5a368 100644 --- a/src/test/ui/unsized-locals/double-move.stderr +++ b/src/test/ui/unsized-locals/double-move.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `y` | LL | drop_unsized(y); | - value moved here -LL | drop_unsized(y); //~ERROR use of moved value +LL | drop_unsized(y); | ^ value used here after move | = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = *x; | -- value moved here -LL | drop_unsized(x); //~ERROR use of moved value +LL | drop_unsized(x); | ^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait @@ -23,7 +23,7 @@ error[E0382]: use of moved value: `*x` | LL | drop_unsized(x); | - value moved here -LL | let _y = *x; //~ERROR use of moved value +LL | let _y = *x; | ^^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -33,7 +33,7 @@ error[E0382]: use of moved value: `y` | LL | y.foo(); | - value moved here -LL | y.foo(); //~ERROR use of moved value +LL | y.foo(); | ^ value used here after move | = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait @@ -43,7 +43,7 @@ error[E0382]: use of moved value: `*x` | LL | let _y = *x; | -- value moved here -LL | x.foo(); //~ERROR use of moved value +LL | x.foo(); | ^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait @@ -53,7 +53,7 @@ error[E0382]: use of moved value: `*x` | LL | x.foo(); | - value moved here -LL | let _y = *x; //~ERROR use of moved value +LL | let _y = *x; | ^^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait diff --git a/src/test/ui/unused/unused-attr.stderr b/src/test/ui/unused/unused-attr.stderr index 6d8a4dd84e65..6f096d741444 100644 --- a/src/test/ui/unused/unused-attr.stderr +++ b/src/test/ui/unused/unused-attr.stderr @@ -1,7 +1,7 @@ error: unused attribute --> $DIR/unused-attr.rs:7:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ | note: lint level defined here @@ -13,85 +13,85 @@ LL | #![deny(unused_attributes)] error: unused attribute --> $DIR/unused-attr.rs:10:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:15:5 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:13:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:23:9 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:21:5 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:19:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:31:9 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:28:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:38:5 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:36:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:44:5 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:46:5 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:42:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:5:1 | -LL | #![foo] //~ ERROR unused attribute +LL | #![foo] | ^^^^^^^ error: aborting due to 15 previous errors diff --git a/src/test/ui/unused/unused-macro-rules.stderr b/src/test/ui/unused/unused-macro-rules.stderr index c6ec064096b1..5c0b9f262b8c 100644 --- a/src/test/ui/unused/unused-macro-rules.stderr +++ b/src/test/ui/unused/unused-macro-rules.stderr @@ -1,7 +1,7 @@ error: unused macro definition --> $DIR/unused-macro-rules.rs:4:1 | -LL | / macro_rules! unused { //~ ERROR: unused macro definition +LL | / macro_rules! unused { LL | | () => {}; LL | | } | |_^ @@ -15,7 +15,7 @@ LL | #![deny(unused_macros)] error: unused macro definition --> $DIR/unused-macro-rules.rs:11:9 | -LL | / macro_rules! m { //~ ERROR: unused macro definition +LL | / macro_rules! m { LL | | () => {}; LL | | } | |_________^ @@ -26,7 +26,7 @@ LL | create_macro!(); error: unused macro definition --> $DIR/unused-macro-rules.rs:24:5 | -LL | / macro_rules! unused { //~ ERROR: unused macro definition +LL | / macro_rules! unused { LL | | () => {}; LL | | } | |_____^ diff --git a/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr b/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr index e4624a5fe058..6edf0a2cf8d5 100644 --- a/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr +++ b/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr @@ -1,7 +1,7 @@ error: invalid fragment specifier `t_ty` --> $DIR/unused-macro-with-bad-frag-spec.rs:6:6 | -LL | ($wrong:t_ty) => () //~ ERROR invalid fragment specifier `t_ty` +LL | ($wrong:t_ty) => () | ^^^^^^^^^^^ | = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis` diff --git a/src/test/ui/unused/unused-macro-with-follow-violation.stderr b/src/test/ui/unused/unused-macro-with-follow-violation.stderr index dfeb3a407e58..5eced4f06c0c 100644 --- a/src/test/ui/unused/unused-macro-with-follow-violation.stderr +++ b/src/test/ui/unused/unused-macro-with-follow-violation.stderr @@ -1,7 +1,7 @@ error: `$e:expr` is followed by `+`, which is not allowed for `expr` fragments --> $DIR/unused-macro-with-follow-violation.rs:4:14 | -LL | ($e:expr +) => () //~ ERROR not allowed for `expr` fragments +LL | ($e:expr +) => () | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` diff --git a/src/test/ui/unused/unused-macro.stderr b/src/test/ui/unused/unused-macro.stderr index a83b5be5fbf7..d18fe82564e0 100644 --- a/src/test/ui/unused/unused-macro.stderr +++ b/src/test/ui/unused/unused-macro.stderr @@ -1,7 +1,7 @@ error: unused macro definition --> $DIR/unused-macro.rs:5:1 | -LL | / macro unused { //~ ERROR: unused macro definition +LL | / macro unused { LL | | () => {} LL | | } | |_^ @@ -15,7 +15,7 @@ LL | #![deny(unused_macros)] error: unused macro definition --> $DIR/unused-macro.rs:15:5 | -LL | / macro unused { //~ ERROR: unused macro definition +LL | / macro unused { LL | | () => {} LL | | } | |_____^ @@ -29,7 +29,7 @@ LL | #[deny(unused_macros)] error: unused macro definition --> $DIR/unused-macro.rs:21:5 | -LL | / pub(crate) macro unused { //~ ERROR: unused macro definition +LL | / pub(crate) macro unused { LL | | () => {} LL | | } | |_____^ diff --git a/src/test/ui/unused/unused-result.stderr b/src/test/ui/unused/unused-result.stderr index 2eb53eac4064..e2aee75f3ed3 100644 --- a/src/test/ui/unused/unused-result.stderr +++ b/src/test/ui/unused/unused-result.stderr @@ -1,7 +1,7 @@ error: unused `MustUse` that must be used --> $DIR/unused-result.rs:21:5 | -LL | foo::(); //~ ERROR: unused `MustUse` that must be used +LL | foo::(); | ^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_results, unused_must_use)] error: unused `MustUseMsg` that must be used --> $DIR/unused-result.rs:22:5 | -LL | foo::(); //~ ERROR: unused `MustUseMsg` that must be used +LL | foo::(); | ^^^^^^^^^^^^^^^^^^^^ | = note: some message @@ -21,7 +21,7 @@ LL | foo::(); //~ ERROR: unused `MustUseMsg` that must be used error: unused result --> $DIR/unused-result.rs:34:5 | -LL | foo::(); //~ ERROR: unused result +LL | foo::(); | ^^^^^^^^^^^^^^^ | note: lint level defined here @@ -33,13 +33,13 @@ LL | #![deny(unused_results, unused_must_use)] error: unused `MustUse` that must be used --> $DIR/unused-result.rs:35:5 | -LL | foo::(); //~ ERROR: unused `MustUse` that must be used +LL | foo::(); | ^^^^^^^^^^^^^^^^^ error: unused `MustUseMsg` that must be used --> $DIR/unused-result.rs:36:5 | -LL | foo::(); //~ ERROR: unused `MustUseMsg` that must be used +LL | foo::(); | ^^^^^^^^^^^^^^^^^^^^ | = note: some message diff --git a/src/test/ui/use/use-after-move-based-on-type.stderr b/src/test/ui/use/use-after-move-based-on-type.stderr index 2282cdfad14d..b9e0aaf1f848 100644 --- a/src/test/ui/use/use-after-move-based-on-type.stderr +++ b/src/test/ui/use/use-after-move-based-on-type.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = x; | -- value moved here -LL | println!("{}", x); //~ ERROR use of moved value +LL | println!("{}", x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/use/use-after-move-self-based-on-type.stderr b/src/test/ui/use/use-after-move-self-based-on-type.stderr index a3acc1aad0f0..d1d26069fdf0 100644 --- a/src/test/ui/use/use-after-move-self-based-on-type.stderr +++ b/src/test/ui/use/use-after-move-self-based-on-type.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `self.x` | LL | self.bar(); | ---- value moved here -LL | return self.x; //~ ERROR use of moved value: `self.x` +LL | return self.x; | ^^^^^^ value used here after move | = note: move occurs because `self` has type `S`, which does not implement the `Copy` trait diff --git a/src/test/ui/use/use-after-move-self.stderr b/src/test/ui/use/use-after-move-self.stderr index 3cb77acaf3dd..2c4bd202681d 100644 --- a/src/test/ui/use/use-after-move-self.stderr +++ b/src/test/ui/use/use-after-move-self.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `*self.x` | LL | self.bar(); | ---- value moved here -LL | return *self.x; //~ ERROR use of moved value: `*self.x` +LL | return *self.x; | ^^^^^^^ value used here after move | = note: move occurs because `self` has type `S`, which does not implement the `Copy` trait diff --git a/src/test/ui/use/use-from-trait-xc.stderr b/src/test/ui/use/use-from-trait-xc.stderr index 8ff75b503d5a..97dc603f9eb2 100644 --- a/src/test/ui/use/use-from-trait-xc.stderr +++ b/src/test/ui/use/use-from-trait-xc.stderr @@ -19,13 +19,13 @@ LL | use use_from_trait_xc::Trait::CONST; error[E0432]: unresolved import `use_from_trait_xc::Foo` --> $DIR/use-from-trait-xc.rs:14:24 | -LL | use use_from_trait_xc::Foo::new; //~ ERROR struct `Foo` is private +LL | use use_from_trait_xc::Foo::new; | ^^^ not a module `Foo` error[E0432]: unresolved import `use_from_trait_xc::Foo` --> $DIR/use-from-trait-xc.rs:17:24 | -LL | use use_from_trait_xc::Foo::C; //~ ERROR struct `Foo` is private +LL | use use_from_trait_xc::Foo::C; | ^^^ not a module `Foo` error[E0432]: unresolved import `use_from_trait_xc::Bar` @@ -43,13 +43,13 @@ LL | use use_from_trait_xc::Baz::new as baznew; error[E0603]: struct `Foo` is private --> $DIR/use-from-trait-xc.rs:14:24 | -LL | use use_from_trait_xc::Foo::new; //~ ERROR struct `Foo` is private +LL | use use_from_trait_xc::Foo::new; | ^^^ error[E0603]: struct `Foo` is private --> $DIR/use-from-trait-xc.rs:17:24 | -LL | use use_from_trait_xc::Foo::C; //~ ERROR struct `Foo` is private +LL | use use_from_trait_xc::Foo::C; | ^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/use/use-mod/use-mod-3.stderr b/src/test/ui/use/use-mod/use-mod-3.stderr index c644ec752f90..0c800ec35e40 100644 --- a/src/test/ui/use/use-mod/use-mod-3.stderr +++ b/src/test/ui/use/use-mod/use-mod-3.stderr @@ -1,13 +1,13 @@ error[E0603]: module `bar` is private --> $DIR/use-mod-3.rs:1:10 | -LL | use foo::bar::{ //~ ERROR module `bar` is private +LL | use foo::bar::{ | ^^^ error[E0603]: module `bar` is private --> $DIR/use-mod-3.rs:4:10 | -LL | use foo::bar::{ //~ ERROR module `bar` is private +LL | use foo::bar::{ | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/use/use-mod/use-mod-4.stderr b/src/test/ui/use/use-mod/use-mod-4.stderr index fc0f8952c479..99f5c352184d 100644 --- a/src/test/ui/use/use-mod/use-mod-4.stderr +++ b/src/test/ui/use/use-mod/use-mod-4.stderr @@ -1,7 +1,7 @@ error[E0429]: `self` imports are only allowed within a { } list --> $DIR/use-mod-4.rs:1:5 | -LL | use foo::self; //~ ERROR unresolved import `foo` +LL | use foo::self; | ^^^^^^^^^ error[E0429]: `self` imports are only allowed within a { } list @@ -13,7 +13,7 @@ LL | use std::mem::self; error[E0432]: unresolved import `foo` --> $DIR/use-mod-4.rs:1:5 | -LL | use foo::self; //~ ERROR unresolved import `foo` +LL | use foo::self; | ^^^ maybe a missing `extern crate foo;`? error: aborting due to 3 previous errors diff --git a/src/test/ui/use/use-paths-as-items.stderr b/src/test/ui/use/use-paths-as-items.stderr index 00f468cdf316..334e145098be 100644 --- a/src/test/ui/use/use-paths-as-items.stderr +++ b/src/test/ui/use/use-paths-as-items.stderr @@ -3,7 +3,7 @@ error[E0252]: the name `mem` is defined multiple times | LL | use std::{mem, ptr}; | --- previous import of the module `mem` here -LL | use std::mem; //~ ERROR the name `mem` is defined multiple times +LL | use std::mem; | ----^^^^^^^^- | | | | | `mem` reimported here diff --git a/src/test/ui/use/use-self-type.stderr b/src/test/ui/use/use-self-type.stderr index 50b4cdf357d8..38c09c2be76f 100644 --- a/src/test/ui/use/use-self-type.stderr +++ b/src/test/ui/use/use-self-type.stderr @@ -1,13 +1,13 @@ error[E0433]: failed to resolve: use of undeclared type or module `Self` --> $DIR/use-self-type.rs:7:16 | -LL | pub(in Self::f) struct Z; //~ ERROR use of undeclared type or module `Self` +LL | pub(in Self::f) struct Z; | ^^^^ use of undeclared type or module `Self` error[E0432]: unresolved import `Self` --> $DIR/use-self-type.rs:6:13 | -LL | use Self::f; //~ ERROR unresolved import +LL | use Self::f; | ^^^^ use of undeclared type or module `Self` error: aborting due to 2 previous errors diff --git a/src/test/ui/use/use-super-global-path.stderr b/src/test/ui/use/use-super-global-path.stderr index ee7deb264df5..a513d37738df 100644 --- a/src/test/ui/use/use-super-global-path.stderr +++ b/src/test/ui/use/use-super-global-path.stderr @@ -1,19 +1,19 @@ error[E0433]: failed to resolve: global paths cannot start with `super` --> $DIR/use-super-global-path.rs:7:11 | -LL | use ::super::{S, Z}; //~ ERROR global paths cannot start with `super` +LL | use ::super::{S, Z}; | ^^^^^ global paths cannot start with `super` error[E0433]: failed to resolve: global paths cannot start with `super` --> $DIR/use-super-global-path.rs:10:15 | -LL | use ::super::main; //~ ERROR global paths cannot start with `super` +LL | use ::super::main; | ^^^^^ global paths cannot start with `super` error[E0425]: cannot find function `main` in this scope --> $DIR/use-super-global-path.rs:11:9 | -LL | main(); //~ ERROR cannot find function `main` in this scope +LL | main(); | ^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/used.stderr b/src/test/ui/used.stderr index c998e27c531e..ea77f129d8ef 100644 --- a/src/test/ui/used.stderr +++ b/src/test/ui/used.stderr @@ -1,25 +1,25 @@ error: attribute must be applied to a `static` variable --> $DIR/used.rs:4:1 | -LL | #[used] //~ ERROR attribute must be applied to a `static` variable +LL | #[used] | ^^^^^^^ error: attribute must be applied to a `static` variable --> $DIR/used.rs:7:1 | -LL | #[used] //~ ERROR attribute must be applied to a `static` variable +LL | #[used] | ^^^^^^^ error: attribute must be applied to a `static` variable --> $DIR/used.rs:10:1 | -LL | #[used] //~ ERROR attribute must be applied to a `static` variable +LL | #[used] | ^^^^^^^ error: attribute must be applied to a `static` variable --> $DIR/used.rs:13:1 | -LL | #[used] //~ ERROR attribute must be applied to a `static` variable +LL | #[used] | ^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/useless-pub.stderr b/src/test/ui/useless-pub.stderr index 5bca980f21e1..14c4983ae29b 100644 --- a/src/test/ui/useless-pub.stderr +++ b/src/test/ui/useless-pub.stderr @@ -1,19 +1,19 @@ error[E0449]: unnecessary visibility qualifier --> $DIR/useless-pub.rs:8:5 | -LL | pub fn foo(&self) {} //~ ERROR: unnecessary visibility qualifier +LL | pub fn foo(&self) {} | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/useless-pub.rs:12:10 | -LL | V1 { pub f: i32 }, //~ ERROR unnecessary visibility qualifier +LL | V1 { pub f: i32 }, | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/useless-pub.rs:13:8 | -LL | V2(pub i32), //~ ERROR unnecessary visibility qualifier +LL | V2(pub i32), | ^^^ `pub` not permitted here because it's implied error: aborting due to 3 previous errors diff --git a/src/test/ui/useless_comment.stderr b/src/test/ui/useless_comment.stderr index 0742a844b7f4..10d8ee60f99f 100644 --- a/src/test/ui/useless_comment.stderr +++ b/src/test/ui/useless_comment.stderr @@ -1,7 +1,7 @@ error: unused doc comment --> $DIR/useless_comment.rs:9:1 | -LL | /// foo //~ ERROR unused doc comment +LL | /// foo | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | mac!(); | ------- rustdoc does not generate documentation for macro expansions @@ -16,7 +16,7 @@ LL | #![deny(unused_doc_comments)] error: unused doc comment --> $DIR/useless_comment.rs:13:5 | -LL | /// a //~ ERROR unused doc comment +LL | /// a | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | let x = 12; | ----------- rustdoc does not generate documentation for statements @@ -24,12 +24,12 @@ LL | let x = 12; error: unused doc comment --> $DIR/useless_comment.rs:16:5 | -LL | / /// multi-line //~ unused doc comment +LL | / /// multi-line LL | | /// doc comment LL | | /// that is unused | |______________________^ LL | / match x { -LL | | /// c //~ ERROR unused doc comment +LL | | /// c LL | | 1 => {}, LL | | _ => {} LL | | } @@ -38,7 +38,7 @@ LL | | } error: unused doc comment --> $DIR/useless_comment.rs:20:9 | -LL | /// c //~ ERROR unused doc comment +LL | /// c | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | 1 => {}, | ------- rustdoc does not generate documentation for match arms @@ -46,7 +46,7 @@ LL | 1 => {}, error: unused doc comment --> $DIR/useless_comment.rs:25:5 | -LL | /// foo //~ ERROR unused doc comment +LL | /// foo | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | unsafe {} | --------- rustdoc does not generate documentation for expressions @@ -54,16 +54,16 @@ LL | unsafe {} error: unused doc comment --> $DIR/useless_comment.rs:28:5 | -LL | #[doc = "foo"] //~ ERROR unused doc comment +LL | #[doc = "foo"] | ^^^^^^^^^^^^^^ -LL | #[doc = "bar"] //~ ERROR unused doc comment +LL | #[doc = "bar"] LL | 3; | - rustdoc does not generate documentation for expressions error: unused doc comment --> $DIR/useless_comment.rs:29:5 | -LL | #[doc = "bar"] //~ ERROR unused doc comment +LL | #[doc = "bar"] | ^^^^^^^^^^^^^^ LL | 3; | - rustdoc does not generate documentation for expressions @@ -71,7 +71,7 @@ LL | 3; error: unused doc comment --> $DIR/useless_comment.rs:32:5 | -LL | /// bar //~ ERROR unused doc comment +LL | /// bar | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | mac!(); | ------- rustdoc does not generate documentation for macro expansions @@ -81,13 +81,13 @@ LL | mac!(); error: unused doc comment --> $DIR/useless_comment.rs:35:13 | -LL | let x = /** comment */ 47; //~ ERROR unused doc comment +LL | let x = /** comment */ 47; | ^^^^^^^^^^^^^^ -- rustdoc does not generate documentation for expressions error: unused doc comment --> $DIR/useless_comment.rs:37:5 | -LL | /// dox //~ ERROR unused doc comment +LL | /// dox | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | / { LL | | diff --git a/src/test/ui/user-defined-macro-rules.stderr b/src/test/ui/user-defined-macro-rules.stderr index a2d7b171a73a..057515228e0d 100644 --- a/src/test/ui/user-defined-macro-rules.stderr +++ b/src/test/ui/user-defined-macro-rules.stderr @@ -1,7 +1,7 @@ error: user-defined macros may not be named `macro_rules` --> $DIR/user-defined-macro-rules.rs:3:1 | -LL | macro_rules! macro_rules { () => {} } //~ ERROR user-defined macros may not be named `macro_rules` +LL | macro_rules! macro_rules { () => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/utf8_idents.stderr b/src/test/ui/utf8_idents.stderr index 52fb607af5b2..330ba3e0a8cc 100644 --- a/src/test/ui/utf8_idents.stderr +++ b/src/test/ui/utf8_idents.stderr @@ -1,7 +1,7 @@ error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/utf8_idents.rs:2:5 | -LL | 'β, //~ ERROR non-ascii idents are not fully supported +LL | 'β, | ^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | 'β, //~ ERROR non-ascii idents are not fully supported error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/utf8_idents.rs:3:5 | -LL | γ //~ ERROR non-ascii idents are not fully supported +LL | γ | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | γ //~ ERROR non-ascii idents are not fully supported error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/utf8_idents.rs:8:5 | -LL | δ: usize //~ ERROR non-ascii idents are not fully supported +LL | δ: usize | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | δ: usize //~ ERROR non-ascii idents are not fully supported error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/utf8_idents.rs:12:9 | -LL | let α = 0.00001f64; //~ ERROR non-ascii idents are not fully supported +LL | let α = 0.00001f64; | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | let α = 0.00001f64; //~ ERROR non-ascii idents are not fully supported warning: type parameter `γ` should have an upper camel case name --> $DIR/utf8_idents.rs:3:5 | -LL | γ //~ ERROR non-ascii idents are not fully supported +LL | γ | ^ help: convert the identifier to upper camel case: `Γ` | = note: #[warn(non_camel_case_types)] on by default diff --git a/src/test/ui/variance/variance-associated-types.stderr b/src/test/ui/variance/variance-associated-types.stderr index 75ebc8668981..c0231aead4a4 100644 --- a/src/test/ui/variance/variance-associated-types.stderr +++ b/src/test/ui/variance/variance-associated-types.stderr @@ -1,7 +1,7 @@ error[E0208]: [-, +] --> $DIR/variance-associated-types.rs:13:1 | -LL | / struct Foo<'a, T : Trait<'a>> { //~ ERROR [-, +] +LL | / struct Foo<'a, T : Trait<'a>> { LL | | field: (T, &'a ()) LL | | } | |_^ @@ -9,7 +9,7 @@ LL | | } error[E0208]: [o, o] --> $DIR/variance-associated-types.rs:18:1 | -LL | / struct Bar<'a, T : Trait<'a>> { //~ ERROR [o, o] +LL | / struct Bar<'a, T : Trait<'a>> { LL | | field: >::Type LL | | } | |_^ diff --git a/src/test/ui/variance/variance-btree-invariant-types.stderr b/src/test/ui/variance/variance-btree-invariant-types.stderr index 0d8b4dddc68c..49222fc7fa62 100644 --- a/src/test/ui/variance/variance-btree-invariant-types.stderr +++ b/src/test/ui/variance/variance-btree-invariant-types.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:4:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::IterMut<'_, &'new (), _>` @@ -16,7 +16,7 @@ LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, & error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:7:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::IterMut<'_, _, &'new ()>` @@ -31,7 +31,7 @@ LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, ( error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:10:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::IterMut<'_, &'static (), _>` @@ -46,7 +46,7 @@ LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, & error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:13:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::IterMut<'_, _, &'static ()>` @@ -61,7 +61,7 @@ LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, ( error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:18:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>` @@ -76,7 +76,7 @@ LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:22:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>` @@ -91,7 +91,7 @@ LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:26:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>` @@ -106,7 +106,7 @@ LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:30:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>` @@ -121,7 +121,7 @@ LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:35:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::VacantEntry<'_, &'new (), _>` @@ -136,7 +136,7 @@ LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:39:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::VacantEntry<'_, _, &'new ()>` @@ -151,7 +151,7 @@ LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:43:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::VacantEntry<'_, &'static (), _>` @@ -166,7 +166,7 @@ LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:47:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::VacantEntry<'_, _, &'static ()>` diff --git a/src/test/ui/variance/variance-cell-is-invariant.stderr b/src/test/ui/variance/variance-cell-is-invariant.stderr index ba76c2efec48..6fcd6460fe30 100644 --- a/src/test/ui/variance/variance-cell-is-invariant.stderr +++ b/src/test/ui/variance/variance-cell-is-invariant.stderr @@ -7,7 +7,7 @@ LL | s: &'short isize, LL | l: &'long isize, | ------------ LL | _where:Option<&'short &'long ()>) { -LL | let _: Foo<'long> = c; //~ ERROR E0623 +LL | let _: Foo<'long> = c; | ^ ...but data from `c` flows into `l` here error: aborting due to previous error diff --git a/src/test/ui/variance/variance-contravariant-arg-object.stderr b/src/test/ui/variance/variance-contravariant-arg-object.stderr index 79681c776736..beac05e04a8e 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-object.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-contravariant-arg-object.rs:14:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `dyn Get<&'min i32>` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max>(v: Box>) error[E0308]: mismatched types --> $DIR/variance-contravariant-arg-object.rs:22:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `dyn Get<&'max i32>` diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr b/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr index 4c97a5892f14..ffe690dd2207 100644 --- a/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-contravariant-arg-trait-match.rs:13:5 | -LL | impls_get::() //~ ERROR mismatched types +LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'min i32>` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max, G>() error[E0308]: mismatched types --> $DIR/variance-contravariant-arg-trait-match.rs:21:5 | -LL | impls_get::() //~ ERROR mismatched types +LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'max i32>` diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.stderr b/src/test/ui/variance/variance-contravariant-self-trait-match.stderr index 30a7b02de76f..6f445d79bf5d 100644 --- a/src/test/ui/variance/variance-contravariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-contravariant-self-trait-match.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-contravariant-self-trait-match.rs:13:5 | -LL | impls_get::<&'min G>(); //~ ERROR mismatched types +LL | impls_get::<&'min G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max, G>() error[E0308]: mismatched types --> $DIR/variance-contravariant-self-trait-match.rs:22:5 | -LL | impls_get::<&'max G>(); //~ ERROR mismatched types +LL | impls_get::<&'max G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` diff --git a/src/test/ui/variance/variance-covariant-arg-object.stderr b/src/test/ui/variance/variance-covariant-arg-object.stderr index afdcccd21192..cdcc7a6fd55a 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.stderr +++ b/src/test/ui/variance/variance-covariant-arg-object.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-covariant-arg-object.rs:15:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `dyn Get<&'min i32>` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max>(v: Box>) error[E0308]: mismatched types --> $DIR/variance-covariant-arg-object.rs:22:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `dyn Get<&'max i32>` diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.stderr b/src/test/ui/variance/variance-covariant-arg-trait-match.stderr index 3c1f43943a00..c0209edc9155 100644 --- a/src/test/ui/variance/variance-covariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-covariant-arg-trait-match.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-covariant-arg-trait-match.rs:14:5 | -LL | impls_get::() //~ ERROR mismatched types +LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'min i32>` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max, G>() error[E0308]: mismatched types --> $DIR/variance-covariant-arg-trait-match.rs:20:5 | -LL | impls_get::() //~ ERROR mismatched types +LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'max i32>` diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.stderr b/src/test/ui/variance/variance-covariant-self-trait-match.stderr index c3a15662f729..fe5fe105c6b3 100644 --- a/src/test/ui/variance/variance-covariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-covariant-self-trait-match.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-covariant-self-trait-match.rs:14:5 | -LL | impls_get::<&'min G>(); //~ ERROR mismatched types +LL | impls_get::<&'min G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max, G>() error[E0308]: mismatched types --> $DIR/variance-covariant-self-trait-match.rs:20:5 | -LL | impls_get::<&'max G>(); //~ ERROR mismatched types +LL | impls_get::<&'max G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` diff --git a/src/test/ui/variance/variance-invariant-arg-object.stderr b/src/test/ui/variance/variance-invariant-arg-object.stderr index b0dddd6ed497..e2ee35de1a27 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.stderr +++ b/src/test/ui/variance/variance-invariant-arg-object.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-invariant-arg-object.rs:11:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `dyn Get<&'min i32>` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max>(v: Box>) error[E0308]: mismatched types --> $DIR/variance-invariant-arg-object.rs:18:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `dyn Get<&'max i32>` diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.stderr b/src/test/ui/variance/variance-invariant-arg-trait-match.stderr index 32aac2e3a2b8..c8a1111e6237 100644 --- a/src/test/ui/variance/variance-invariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-invariant-arg-trait-match.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-invariant-arg-trait-match.rs:10:5 | -LL | impls_get::() //~ ERROR mismatched types +LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'min i32>` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max, G>() error[E0308]: mismatched types --> $DIR/variance-invariant-arg-trait-match.rs:16:5 | -LL | impls_get::() //~ ERROR mismatched types +LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'max i32>` diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.stderr b/src/test/ui/variance/variance-invariant-self-trait-match.stderr index ba96fbdaa14d..cb03d95f7710 100644 --- a/src/test/ui/variance/variance-invariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-invariant-self-trait-match.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-invariant-self-trait-match.rs:10:5 | -LL | impls_get::<&'min G>(); //~ ERROR mismatched types +LL | impls_get::<&'min G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max, G>() error[E0308]: mismatched types --> $DIR/variance-invariant-self-trait-match.rs:16:5 | -LL | impls_get::<&'max G>(); //~ ERROR mismatched types +LL | impls_get::<&'max G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` diff --git a/src/test/ui/variance/variance-issue-20533.stderr b/src/test/ui/variance/variance-issue-20533.stderr index 27aca3401f92..bcf99bcb9629 100644 --- a/src/test/ui/variance/variance-issue-20533.stderr +++ b/src/test/ui/variance/variance-issue-20533.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = foo(&a); | - borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here error[E0505]: cannot move out of `a` because it is borrowed @@ -11,7 +11,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = bar(&a); | - borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here error[E0505]: cannot move out of `a` because it is borrowed @@ -19,7 +19,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = baz(&a); | - borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here error: aborting due to 3 previous errors diff --git a/src/test/ui/variance/variance-object-types.stderr b/src/test/ui/variance/variance-object-types.stderr index 3ba86c2620e0..385d8dc5c773 100644 --- a/src/test/ui/variance/variance-object-types.stderr +++ b/src/test/ui/variance/variance-object-types.stderr @@ -1,7 +1,7 @@ error[E0208]: [o] --> $DIR/variance-object-types.rs:11:1 | -LL | / struct Foo<'a> { //~ ERROR [o] +LL | / struct Foo<'a> { LL | | x: Box &'a i32 + 'static> LL | | } | |_^ diff --git a/src/test/ui/variance/variance-regions-direct.stderr b/src/test/ui/variance/variance-regions-direct.stderr index 82dc8df37268..bbc34799449a 100644 --- a/src/test/ui/variance/variance-regions-direct.stderr +++ b/src/test/ui/variance/variance-regions-direct.stderr @@ -1,7 +1,7 @@ error[E0208]: [-, -, -] --> $DIR/variance-regions-direct.rs:9:1 | -LL | / struct Test2<'a, 'b, 'c> { //~ ERROR [-, -, -] +LL | / struct Test2<'a, 'b, 'c> { LL | | x: &'a isize, LL | | y: &'b [isize], LL | | c: &'c str @@ -11,7 +11,7 @@ LL | | } error[E0208]: [+, +, +] --> $DIR/variance-regions-direct.rs:18:1 | -LL | / struct Test3<'a, 'b, 'c> { //~ ERROR [+, +, +] +LL | / struct Test3<'a, 'b, 'c> { LL | | x: extern "Rust" fn(&'a isize), LL | | y: extern "Rust" fn(&'b [isize]), LL | | c: extern "Rust" fn(&'c str), @@ -21,7 +21,7 @@ LL | | } error[E0208]: [-, o] --> $DIR/variance-regions-direct.rs:27:1 | -LL | / struct Test4<'a, 'b:'a> { //~ ERROR [-, o] +LL | / struct Test4<'a, 'b:'a> { LL | | x: &'a mut &'b isize, LL | | } | |_^ @@ -29,7 +29,7 @@ LL | | } error[E0208]: [+, o] --> $DIR/variance-regions-direct.rs:35:1 | -LL | / struct Test5<'a, 'b:'a> { //~ ERROR [+, o] +LL | / struct Test5<'a, 'b:'a> { LL | | x: extern "Rust" fn(&'a mut &'b isize), LL | | } | |_^ @@ -37,7 +37,7 @@ LL | | } error[E0208]: [-, o] --> $DIR/variance-regions-direct.rs:45:1 | -LL | / struct Test6<'a, 'b:'a> { //~ ERROR [-, o] +LL | / struct Test6<'a, 'b:'a> { LL | | x: &'a mut extern "Rust" fn(&'b isize), LL | | } | |_^ @@ -45,7 +45,7 @@ LL | | } error[E0208]: [*] --> $DIR/variance-regions-direct.rs:52:1 | -LL | / struct Test7<'a> { //~ ERROR [*] +LL | / struct Test7<'a> { LL | | x: isize LL | | } | |_^ @@ -53,7 +53,7 @@ LL | | } error[E0208]: [+, -, o] --> $DIR/variance-regions-direct.rs:59:1 | -LL | / enum Test8<'a, 'b, 'c:'b> { //~ ERROR [+, -, o] +LL | / enum Test8<'a, 'b, 'c:'b> { LL | | Test8A(extern "Rust" fn(&'a isize)), LL | | Test8B(&'b [isize]), LL | | Test8C(&'b mut &'c str), diff --git a/src/test/ui/variance/variance-regions-indirect.stderr b/src/test/ui/variance/variance-regions-indirect.stderr index 401fa2f3baa3..ccd4335f5004 100644 --- a/src/test/ui/variance/variance-regions-indirect.stderr +++ b/src/test/ui/variance/variance-regions-indirect.stderr @@ -1,7 +1,7 @@ error[E0208]: [+, -, o, *] --> $DIR/variance-regions-indirect.rs:8:1 | -LL | / enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR [+, -, o, *] +LL | / enum Base<'a, 'b, 'c:'b, 'd> { LL | | Test8A(extern "Rust" fn(&'a isize)), LL | | Test8B(&'b [isize]), LL | | Test8C(&'b mut &'c str), @@ -11,7 +11,7 @@ LL | | } error[E0208]: [*, o, -, +] --> $DIR/variance-regions-indirect.rs:15:1 | -LL | / struct Derived1<'w, 'x:'y, 'y, 'z> { //~ ERROR [*, o, -, +] +LL | / struct Derived1<'w, 'x:'y, 'y, 'z> { LL | | f: Base<'z, 'y, 'x, 'w> LL | | } | |_^ @@ -19,7 +19,7 @@ LL | | } error[E0208]: [o, o, *] --> $DIR/variance-regions-indirect.rs:20:1 | -LL | / struct Derived2<'a, 'b:'a, 'c> { //~ ERROR [o, o, *] +LL | / struct Derived2<'a, 'b:'a, 'c> { LL | | f: Base<'a, 'a, 'b, 'c> LL | | } | |_^ @@ -27,7 +27,7 @@ LL | | } error[E0208]: [o, -, *] --> $DIR/variance-regions-indirect.rs:25:1 | -LL | / struct Derived3<'a:'b, 'b, 'c> { //~ ERROR [o, -, *] +LL | / struct Derived3<'a:'b, 'b, 'c> { LL | | f: Base<'a, 'b, 'a, 'c> LL | | } | |_^ @@ -35,7 +35,7 @@ LL | | } error[E0208]: [+, -, o] --> $DIR/variance-regions-indirect.rs:30:1 | -LL | / struct Derived4<'a, 'b, 'c:'b> { //~ ERROR [+, -, o] +LL | / struct Derived4<'a, 'b, 'c:'b> { LL | | f: Base<'a, 'b, 'c, 'a> LL | | } | |_^ diff --git a/src/test/ui/variance/variance-regions-unused-direct.stderr b/src/test/ui/variance/variance-regions-unused-direct.stderr index 207cc9147f1c..ab5dce03fa0a 100644 --- a/src/test/ui/variance/variance-regions-unused-direct.stderr +++ b/src/test/ui/variance/variance-regions-unused-direct.stderr @@ -1,7 +1,7 @@ error[E0392]: parameter `'a` is never used --> $DIR/variance-regions-unused-direct.rs:5:18 | -LL | struct Bivariant<'a>; //~ ERROR parameter `'a` is never used +LL | struct Bivariant<'a>; | ^^ unused type parameter | = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` @@ -9,7 +9,7 @@ LL | struct Bivariant<'a>; //~ ERROR parameter `'a` is never used error[E0392]: parameter `'d` is never used --> $DIR/variance-regions-unused-direct.rs:7:19 | -LL | struct Struct<'a, 'd> { //~ ERROR parameter `'d` is never used +LL | struct Struct<'a, 'd> { | ^^ unused type parameter | = help: consider removing `'d` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/variance/variance-regions-unused-indirect.stderr b/src/test/ui/variance/variance-regions-unused-indirect.stderr index 08d1189ea2c9..69631b4a504d 100644 --- a/src/test/ui/variance/variance-regions-unused-indirect.stderr +++ b/src/test/ui/variance/variance-regions-unused-indirect.stderr @@ -1,7 +1,7 @@ error[E0392]: parameter `'a` is never used --> $DIR/variance-regions-unused-indirect.rs:3:10 | -LL | enum Foo<'a> { //~ ERROR parameter `'a` is never used +LL | enum Foo<'a> { | ^^ unused type parameter | = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` @@ -9,7 +9,7 @@ LL | enum Foo<'a> { //~ ERROR parameter `'a` is never used error[E0392]: parameter `'a` is never used --> $DIR/variance-regions-unused-indirect.rs:7:10 | -LL | enum Bar<'a> { //~ ERROR parameter `'a` is never used +LL | enum Bar<'a> { | ^^ unused type parameter | = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/variance/variance-trait-bounds.stderr b/src/test/ui/variance/variance-trait-bounds.stderr index 1fabadabbcbb..f136bd121d0d 100644 --- a/src/test/ui/variance/variance-trait-bounds.stderr +++ b/src/test/ui/variance/variance-trait-bounds.stderr @@ -1,7 +1,7 @@ error[E0208]: [+, +] --> $DIR/variance-trait-bounds.rs:16:1 | -LL | / struct TestStruct> { //~ ERROR [+, +] +LL | / struct TestStruct> { LL | | t: T, u: U LL | | } | |_^ @@ -9,7 +9,7 @@ LL | | } error[E0208]: [*, +] --> $DIR/variance-trait-bounds.rs:21:1 | -LL | / enum TestEnum> { //~ ERROR [*, +] +LL | / enum TestEnum> { LL | | Foo(T) LL | | } | |_^ @@ -17,7 +17,7 @@ LL | | } error[E0208]: [*, +] --> $DIR/variance-trait-bounds.rs:26:1 | -LL | / struct TestContraStruct> { //~ ERROR [*, +] +LL | / struct TestContraStruct> { LL | | t: T LL | | } | |_^ @@ -25,7 +25,7 @@ LL | | } error[E0208]: [*, +] --> $DIR/variance-trait-bounds.rs:31:1 | -LL | / struct TestBox+Setter> { //~ ERROR [*, +] +LL | / struct TestBox+Setter> { LL | | t: T LL | | } | |_^ diff --git a/src/test/ui/variance/variance-trait-matching.stderr b/src/test/ui/variance/variance-trait-matching.stderr index 2d11515a19c0..514153103bea 100644 --- a/src/test/ui/variance/variance-trait-matching.stderr +++ b/src/test/ui/variance/variance-trait-matching.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `get` LL | fn get<'a, G>(get: &G) -> i32 | -- help: add explicit lifetime `'a` to the type of `get`: `&'a G` ... -LL | pick(get, &22) //~ ERROR explicit lifetime required in the type of `get` [E0621] +LL | pick(get, &22) | ^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/variance/variance-trait-object-bound.stderr b/src/test/ui/variance/variance-trait-object-bound.stderr index c824f5a6db73..4fa4a2e8ab45 100644 --- a/src/test/ui/variance/variance-trait-object-bound.stderr +++ b/src/test/ui/variance/variance-trait-object-bound.stderr @@ -1,7 +1,7 @@ error[E0208]: [-] --> $DIR/variance-trait-object-bound.rs:14:1 | -LL | / struct TOption<'a> { //~ ERROR [-] +LL | / struct TOption<'a> { LL | | v: Option>, LL | | } | |_^ diff --git a/src/test/ui/variance/variance-types-bounds.stderr b/src/test/ui/variance/variance-types-bounds.stderr index 31271952f776..991bfd33a2e2 100644 --- a/src/test/ui/variance/variance-types-bounds.stderr +++ b/src/test/ui/variance/variance-types-bounds.stderr @@ -1,7 +1,7 @@ error[E0208]: [+, +] --> $DIR/variance-types-bounds.rs:7:1 | -LL | / struct TestImm { //~ ERROR [+, +] +LL | / struct TestImm { LL | | x: A, LL | | y: B, LL | | } @@ -10,7 +10,7 @@ LL | | } error[E0208]: [+, o] --> $DIR/variance-types-bounds.rs:13:1 | -LL | / struct TestMut { //~ ERROR [+, o] +LL | / struct TestMut { LL | | x: A, LL | | y: &'static mut B, LL | | } @@ -19,7 +19,7 @@ LL | | } error[E0208]: [+, o] --> $DIR/variance-types-bounds.rs:19:1 | -LL | / struct TestIndirect { //~ ERROR [+, o] +LL | / struct TestIndirect { LL | | m: TestMut LL | | } | |_^ @@ -27,7 +27,7 @@ LL | | } error[E0208]: [o, o] --> $DIR/variance-types-bounds.rs:24:1 | -LL | / struct TestIndirect2 { //~ ERROR [o, o] +LL | / struct TestIndirect2 { LL | | n: TestMut, LL | | m: TestMut LL | | } @@ -36,7 +36,7 @@ LL | | } error[E0208]: [o, o] --> $DIR/variance-types-bounds.rs:38:1 | -LL | / struct TestObject { //~ ERROR [o, o] +LL | / struct TestObject { LL | | n: Box+Send>, LL | | m: Box+Send>, LL | | } diff --git a/src/test/ui/variance/variance-types.stderr b/src/test/ui/variance/variance-types.stderr index 4362f6942026..f68a2666729d 100644 --- a/src/test/ui/variance/variance-types.stderr +++ b/src/test/ui/variance/variance-types.stderr @@ -1,7 +1,7 @@ error[E0208]: [-, o, o] --> $DIR/variance-types.rs:10:1 | -LL | / struct InvariantMut<'a,A:'a,B:'a> { //~ ERROR [-, o, o] +LL | / struct InvariantMut<'a,A:'a,B:'a> { LL | | t: &'a mut (A,B) LL | | } | |_^ @@ -9,7 +9,7 @@ LL | | } error[E0208]: [o] --> $DIR/variance-types.rs:15:1 | -LL | / struct InvariantCell { //~ ERROR [o] +LL | / struct InvariantCell { LL | | t: Cell LL | | } | |_^ @@ -17,7 +17,7 @@ LL | | } error[E0208]: [o] --> $DIR/variance-types.rs:20:1 | -LL | / struct InvariantIndirect { //~ ERROR [o] +LL | / struct InvariantIndirect { LL | | t: InvariantCell LL | | } | |_^ @@ -25,7 +25,7 @@ LL | | } error[E0208]: [+] --> $DIR/variance-types.rs:25:1 | -LL | / struct Covariant { //~ ERROR [+] +LL | / struct Covariant { LL | | t: A, u: fn() -> A LL | | } | |_^ @@ -33,7 +33,7 @@ LL | | } error[E0208]: [-] --> $DIR/variance-types.rs:30:1 | -LL | / struct Contravariant { //~ ERROR [-] +LL | / struct Contravariant { LL | | t: fn(A) LL | | } | |_^ @@ -41,7 +41,7 @@ LL | | } error[E0208]: [+, -, o] --> $DIR/variance-types.rs:35:1 | -LL | / enum Enum { //~ ERROR [+, -, o] +LL | / enum Enum { LL | | Foo(Covariant), LL | | Bar(Contravariant), LL | | Zed(Covariant,Contravariant) diff --git a/src/test/ui/variance/variance-unused-region-param.stderr b/src/test/ui/variance/variance-unused-region-param.stderr index 9cd133bbc937..6c103f168f47 100644 --- a/src/test/ui/variance/variance-unused-region-param.stderr +++ b/src/test/ui/variance/variance-unused-region-param.stderr @@ -1,7 +1,7 @@ error[E0392]: parameter `'a` is never used --> $DIR/variance-unused-region-param.rs:3:19 | -LL | struct SomeStruct<'a> { x: u32 } //~ ERROR parameter `'a` is never used +LL | struct SomeStruct<'a> { x: u32 } | ^^ unused type parameter | = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` @@ -9,7 +9,7 @@ LL | struct SomeStruct<'a> { x: u32 } //~ ERROR parameter `'a` is never used error[E0392]: parameter `'a` is never used --> $DIR/variance-unused-region-param.rs:4:15 | -LL | enum SomeEnum<'a> { Nothing } //~ ERROR parameter `'a` is never used +LL | enum SomeEnum<'a> { Nothing } | ^^ unused type parameter | = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.stderr index 89a49a00b34e..7c433378df5c 100644 --- a/src/test/ui/variance/variance-use-contravariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-contravariant-struct-1.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-use-contravariant-struct-1.rs:12:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `SomeStruct<&'min ()>` diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.stderr index a6f298c9bfbe..6ae7d12c4633 100644 --- a/src/test/ui/variance/variance-use-covariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-covariant-struct-1.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-use-covariant-struct-1.rs:10:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `SomeStruct<&'max ()>` diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.stderr index 2bd39d5a831f..793954e3a1f0 100644 --- a/src/test/ui/variance/variance-use-invariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-invariant-struct-1.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-use-invariant-struct-1.rs:12:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `SomeStruct<&'min ()>` @@ -20,7 +20,7 @@ LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) error[E0308]: mismatched types --> $DIR/variance-use-invariant-struct-1.rs:19:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `SomeStruct<&'max ()>` diff --git a/src/test/ui/variants/variant-size-differences.stderr b/src/test/ui/variants/variant-size-differences.stderr index 5cd168df5382..c82c253f610d 100644 --- a/src/test/ui/variants/variant-size-differences.stderr +++ b/src/test/ui/variants/variant-size-differences.stderr @@ -1,7 +1,7 @@ error: enum variant is more than three times larger (1024 bytes) than the next largest --> $DIR/variant-size-differences.rs:5:5 | -LL | VBig([u8; 1024]), //~ ERROR variant is more than three times larger +LL | VBig([u8; 1024]), | ^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/vec/vec-macro-with-comma-only.stderr b/src/test/ui/vec/vec-macro-with-comma-only.stderr index 92e704c3fb4b..abbee347c00b 100644 --- a/src/test/ui/vec/vec-macro-with-comma-only.stderr +++ b/src/test/ui/vec/vec-macro-with-comma-only.stderr @@ -1,7 +1,7 @@ error: no rules expected the token `,` --> $DIR/vec-macro-with-comma-only.rs:2:10 | -LL | vec![,]; //~ ERROR no rules expected the token `,` +LL | vec![,]; | ^ no rules expected this token in macro call error: aborting due to previous error diff --git a/src/test/ui/vec/vec-mut-iter-borrow.stderr b/src/test/ui/vec/vec-mut-iter-borrow.stderr index 9b4b56737915..ec16d2bebd6b 100644 --- a/src/test/ui/vec/vec-mut-iter-borrow.stderr +++ b/src/test/ui/vec/vec-mut-iter-borrow.stderr @@ -6,7 +6,7 @@ LL | for x in &mut xs { | || | |first borrow ends here | first mutable borrow occurs here -LL | xs.push(1) //~ ERROR cannot borrow `xs` +LL | xs.push(1) | ^^ second mutable borrow occurs here error: aborting due to previous error diff --git a/src/test/ui/vector-cast-weirdness.stderr b/src/test/ui/vector-cast-weirdness.stderr index 330b87801ebb..37055bb75f55 100644 --- a/src/test/ui/vector-cast-weirdness.stderr +++ b/src/test/ui/vector-cast-weirdness.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `&mut [u8; 2]` as `*mut u8` is invalid --> $DIR/vector-cast-weirdness.rs:21:23 | -LL | let p1: *mut u8 = &mut x1.y as *mut _; //~ ERROR casting +LL | let p1: *mut u8 = &mut x1.y as *mut _; | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/vtable-res-trait-param.stderr b/src/test/ui/vtable-res-trait-param.stderr index 6dac9fe335f6..58a88979b2fa 100644 --- a/src/test/ui/vtable-res-trait-param.stderr +++ b/src/test/ui/vtable-res-trait-param.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `{integer}: TraitA` is not satisfied --> $DIR/vtable-res-trait-param.rs:17:7 | -LL | b.gimme_an_a(y) //~ ERROR `{integer}: TraitA` is not satisfied +LL | b.gimme_an_a(y) | ^^^^^^^^^^ the trait `TraitA` is not implemented for `{integer}` error: aborting due to previous error diff --git a/src/test/ui/walk-struct-literal-with.stderr b/src/test/ui/walk-struct-literal-with.stderr index 9362301b4081..d5351eb0ce5a 100644 --- a/src/test/ui/walk-struct-literal-with.stderr +++ b/src/test/ui/walk-struct-literal-with.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `start.test` | LL | let end = Mine{other_val:1, ..start.make_string_bar()}; | ----- value moved here -LL | println!("{}", start.test); //~ ERROR use of moved value: `start.test` +LL | println!("{}", start.test); | ^^^^^^^^^^ value used here after move | = note: move occurs because `start` has type `Mine`, which does not implement the `Copy` trait diff --git a/src/test/ui/warn-path-statement.stderr b/src/test/ui/warn-path-statement.stderr index 55d33058c17f..30afb99e5f02 100644 --- a/src/test/ui/warn-path-statement.stderr +++ b/src/test/ui/warn-path-statement.stderr @@ -1,7 +1,7 @@ error: path statement with no effect --> $DIR/warn-path-statement.rs:5:5 | -LL | x; //~ ERROR path statement with no effect +LL | x; | ^^ | = note: requested on the command line with `-D path-statements` diff --git a/src/test/ui/wasm-import-module.stderr b/src/test/ui/wasm-import-module.stderr index a3955bb676e9..20eec4c9f59b 100644 --- a/src/test/ui/wasm-import-module.stderr +++ b/src/test/ui/wasm-import-module.stderr @@ -1,19 +1,19 @@ error: must be of the form #[link(wasm_import_module = "...")] --> $DIR/wasm-import-module.rs:1:22 | -LL | #[link(name = "...", wasm_import_module)] //~ ERROR: must be of the form +LL | #[link(name = "...", wasm_import_module)] | ^^^^^^^^^^^^^^^^^^ error: must be of the form #[link(wasm_import_module = "...")] --> $DIR/wasm-import-module.rs:4:22 | -LL | #[link(name = "...", wasm_import_module(x))] //~ ERROR: must be of the form +LL | #[link(name = "...", wasm_import_module(x))] | ^^^^^^^^^^^^^^^^^^^^^ error: must be of the form #[link(wasm_import_module = "...")] --> $DIR/wasm-import-module.rs:7:22 | -LL | #[link(name = "...", wasm_import_module())] //~ ERROR: must be of the form +LL | #[link(name = "...", wasm_import_module())] | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/wf/wf-array-elem-sized.stderr b/src/test/ui/wf/wf-array-elem-sized.stderr index 69df9ea7857d..b222d07580ea 100644 --- a/src/test/ui/wf/wf-array-elem-sized.stderr +++ b/src/test/ui/wf/wf-array-elem-sized.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/wf-array-elem-sized.rs:7:5 | -LL | foo: [[u8]], //~ ERROR E0277 +LL | foo: [[u8]], | ^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` diff --git a/src/test/ui/wf/wf-enum-bound.stderr b/src/test/ui/wf/wf-enum-bound.stderr index 487592dcaca6..de28a882f13c 100644 --- a/src/test/ui/wf/wf-enum-bound.stderr +++ b/src/test/ui/wf/wf-enum-bound.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-enum-bound.rs:9:1 | -LL | / enum SomeEnum //~ ERROR E0277 +LL | / enum SomeEnum LL | | where T: ExtraCopy LL | | { LL | | SomeVariant(T,U) diff --git a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr index f4b8ec0c6687..6c1267cf7e1b 100644 --- a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr +++ b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied --> $DIR/wf-enum-fields-struct-variant.rs:13:9 | -LL | f: IsCopy //~ ERROR E0277 +LL | f: IsCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | = help: consider adding a `where A: std::marker::Copy` bound diff --git a/src/test/ui/wf/wf-enum-fields.stderr b/src/test/ui/wf/wf-enum-fields.stderr index 600dd3dc03de..9c4eec6c5fbf 100644 --- a/src/test/ui/wf/wf-enum-fields.stderr +++ b/src/test/ui/wf/wf-enum-fields.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied --> $DIR/wf-enum-fields.rs:12:17 | -LL | SomeVariant(IsCopy) //~ ERROR E0277 +LL | SomeVariant(IsCopy) | ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | = help: consider adding a `where A: std::marker::Copy` bound diff --git a/src/test/ui/wf/wf-fn-where-clause.stderr b/src/test/ui/wf/wf-fn-where-clause.stderr index 594ce7d2f49c..f1648aa12acd 100644 --- a/src/test/ui/wf/wf-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-fn-where-clause.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-fn-where-clause.rs:8:1 | -LL | / fn foo() where T: ExtraCopy //~ ERROR E0277 +LL | / fn foo() where T: ExtraCopy LL | | { LL | | } | |_^ the trait `std::marker::Copy` is not implemented for `U` diff --git a/src/test/ui/wf/wf-impl-associated-type-region.stderr b/src/test/ui/wf/wf-impl-associated-type-region.stderr index de7e8fa9a28a..9cc36025305f 100644 --- a/src/test/ui/wf/wf-impl-associated-type-region.stderr +++ b/src/test/ui/wf/wf-impl-associated-type-region.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Foo<'a> for T { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Bar = &'a T; //~ ERROR E0309 +LL | type Bar = &'a T; | ^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a T` does not outlive the data it points at --> $DIR/wf-impl-associated-type-region.rs:10:5 | -LL | type Bar = &'a T; //~ ERROR E0309 +LL | type Bar = &'a T; | ^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-arg.stderr b/src/test/ui/wf/wf-in-fn-arg.stderr index 987984060e69..8635dad85166 100644 --- a/src/test/ui/wf/wf-in-fn-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-arg.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-in-fn-arg.rs:10:1 | -LL | / fn bar(_: &MustBeCopy) //~ ERROR E0277 +LL | / fn bar(_: &MustBeCopy) LL | | { LL | | } | |_^ the trait `std::marker::Copy` is not implemented for `T` diff --git a/src/test/ui/wf/wf-in-fn-ret.stderr b/src/test/ui/wf/wf-in-fn-ret.stderr index 81aae855b843..3879f7b0a4bf 100644 --- a/src/test/ui/wf/wf-in-fn-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-ret.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-in-fn-ret.rs:10:1 | -LL | / fn bar() -> MustBeCopy //~ ERROR E0277 +LL | / fn bar() -> MustBeCopy LL | | { LL | | } | |_^ the trait `std::marker::Copy` is not implemented for `T` diff --git a/src/test/ui/wf/wf-in-fn-type-arg.stderr b/src/test/ui/wf/wf-in-fn-type-arg.stderr index e60529dba1ed..40cb4a7050cc 100644 --- a/src/test/ui/wf/wf-in-fn-type-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-type-arg.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-in-fn-type-arg.rs:9:5 | -LL | x: fn(MustBeCopy) //~ ERROR E0277 +LL | x: fn(MustBeCopy) | ^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound diff --git a/src/test/ui/wf/wf-in-fn-type-ret.stderr b/src/test/ui/wf/wf-in-fn-type-ret.stderr index 9f18a00926d7..059f164e25c2 100644 --- a/src/test/ui/wf/wf-in-fn-type-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-type-ret.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-in-fn-type-ret.rs:9:5 | -LL | x: fn() -> MustBeCopy //~ ERROR E0277 +LL | x: fn() -> MustBeCopy | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound diff --git a/src/test/ui/wf/wf-in-fn-type-static.stderr b/src/test/ui/wf/wf-in-fn-type-static.stderr index 1fabfb04adde..8952c78aacd7 100644 --- a/src/test/ui/wf/wf-in-fn-type-static.stderr +++ b/src/test/ui/wf/wf-in-fn-type-static.stderr @@ -4,13 +4,13 @@ error[E0310]: the parameter type `T` may not live long enough LL | struct Foo { | - help: consider adding an explicit lifetime bound `T: 'static`... LL | // needs T: 'static -LL | x: fn() -> &'static T //~ ERROR E0310 +LL | x: fn() -> &'static T | ^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/wf-in-fn-type-static.rs:13:5 | -LL | x: fn() -> &'static T //~ ERROR E0310 +LL | x: fn() -> &'static T | ^^^^^^^^^^^^^^^^^^^^^ error[E0310]: the parameter type `T` may not live long enough @@ -19,13 +19,13 @@ error[E0310]: the parameter type `T` may not live long enough LL | struct Bar { | - help: consider adding an explicit lifetime bound `T: 'static`... LL | // needs T: Copy -LL | x: fn(&'static T) //~ ERROR E0310 +LL | x: fn(&'static T) | ^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/wf-in-fn-type-static.rs:18:5 | -LL | x: fn(&'static T) //~ ERROR E0310 +LL | x: fn(&'static T) | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/wf/wf-in-fn-where-clause.stderr b/src/test/ui/wf/wf-in-fn-where-clause.stderr index 8d6700e35714..1e732a3341c0 100644 --- a/src/test/ui/wf/wf-in-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-in-fn-where-clause.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-in-fn-where-clause.rs:9:1 | -LL | / fn bar() //~ ERROR E0277 +LL | / fn bar() LL | | where T: MustBeCopy LL | | { LL | | } diff --git a/src/test/ui/wf/wf-in-obj-type-static.stderr b/src/test/ui/wf/wf-in-obj-type-static.stderr index 9e0628e3ec61..cc06b9243f70 100644 --- a/src/test/ui/wf/wf-in-obj-type-static.stderr +++ b/src/test/ui/wf/wf-in-obj-type-static.stderr @@ -4,13 +4,13 @@ error[E0310]: the parameter type `T` may not live long enough LL | struct Foo { | - help: consider adding an explicit lifetime bound `T: 'static`... LL | // needs T: 'static -LL | x: Object<&'static T> //~ ERROR E0310 +LL | x: Object<&'static T> | ^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/wf-in-obj-type-static.rs:14:5 | -LL | x: Object<&'static T> //~ ERROR E0310 +LL | x: Object<&'static T> | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-obj-type-trait.stderr b/src/test/ui/wf/wf-in-obj-type-trait.stderr index a4a14817d3f7..94b3de78898a 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.stderr +++ b/src/test/ui/wf/wf-in-obj-type-trait.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-in-obj-type-trait.rs:11:5 | -LL | x: Object> //~ ERROR E0277 +LL | x: Object> | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound diff --git a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr index ba9d3d7877dd..b79093f7d023 100644 --- a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-inherent-impl-method-where-clause.rs:12:5 | -LL | / fn foo(self) where T: ExtraCopy //~ ERROR E0277 +LL | / fn foo(self) where T: ExtraCopy LL | | {} | |______^ the trait `std::marker::Copy` is not implemented for `U` | diff --git a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr index 2ed9cc56f94a..f10ff841acbf 100644 --- a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-inherent-impl-where-clause.rs:11:1 | -LL | / impl Foo where T: ExtraCopy //~ ERROR E0277 +LL | / impl Foo where T: ExtraCopy LL | | { LL | | } | |_^ the trait `std::marker::Copy` is not implemented for `U` diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.stderr b/src/test/ui/wf/wf-misc-methods-issue-28609.stderr index 46dc4dc8870d..d470aecd2660 100644 --- a/src/test/ui/wf/wf-misc-methods-issue-28609.stderr +++ b/src/test/ui/wf/wf-misc-methods-issue-28609.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/wf-misc-methods-issue-28609.rs:22:31 | -LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough +LL | s.transmute_inherent(&mut 42) | ^^ temporary value does not live long enough LL | } | - temporary value only lives until here @@ -11,14 +11,14 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the | LL | / fn return_dangling_pointer_inherent(s: S2) -> &u32 { LL | | let s = s; -LL | | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough +LL | | s.transmute_inherent(&mut 42) LL | | } | |_^ error[E0597]: `four` does not live long enough --> $DIR/wf-misc-methods-issue-28609.rs:35:20 | -LL | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | s.bomb = Some(&four); | ^^^^ borrowed value does not live long enough LL | &s LL | } @@ -30,7 +30,7 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the LL | / fn return_dangling_pointer_coerce(s: S2) -> &u32 { LL | | let four = 4; LL | | let mut s = s; -LL | | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | | s.bomb = Some(&four); LL | | &s LL | | } | |_^ @@ -38,7 +38,7 @@ LL | | } error[E0597]: `four` does not live long enough --> $DIR/wf-misc-methods-issue-28609.rs:42:20 | -LL | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | s.bomb = Some(&four); | ^^^^ borrowed value does not live long enough LL | &*s LL | } @@ -50,7 +50,7 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the LL | / fn return_dangling_pointer_unary_op(s: S2) -> &u32 { LL | | let four = 4; LL | | let mut s = s; -LL | | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | | s.bomb = Some(&four); LL | | &*s LL | | } | |_^ @@ -58,7 +58,7 @@ LL | | } error[E0597]: borrowed value does not live long enough --> $DIR/wf-misc-methods-issue-28609.rs:53:15 | -LL | s << &mut 3 //~ ERROR does not live long enough +LL | s << &mut 3 | ^ temporary value does not live long enough LL | } | - temporary value only lives until here @@ -68,14 +68,14 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the | LL | / fn return_dangling_pointer_binary_op(s: S2) -> &u32 { LL | | let s = s; -LL | | s << &mut 3 //~ ERROR does not live long enough +LL | | s << &mut 3 LL | | } | |_^ error[E0597]: borrowed value does not live long enough --> $DIR/wf-misc-methods-issue-28609.rs:58:16 | -LL | s.shl(&mut 3) //~ ERROR does not live long enough +LL | s.shl(&mut 3) | ^ temporary value does not live long enough LL | } | - temporary value only lives until here @@ -85,14 +85,14 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the | LL | / fn return_dangling_pointer_method(s: S2) -> &u32 { LL | | let s = s; -LL | | s.shl(&mut 3) //~ ERROR does not live long enough +LL | | s.shl(&mut 3) LL | | } | |_^ error[E0597]: borrowed value does not live long enough --> $DIR/wf-misc-methods-issue-28609.rs:63:21 | -LL | S2::shl(s, &mut 3) //~ ERROR does not live long enough +LL | S2::shl(s, &mut 3) | ^ temporary value does not live long enough LL | } | - temporary value only lives until here @@ -102,7 +102,7 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the | LL | / fn return_dangling_pointer_ufcs(s: S2) -> &u32 { LL | | let s = s; -LL | | S2::shl(s, &mut 3) //~ ERROR does not live long enough +LL | | S2::shl(s, &mut 3) LL | | } | |_^ diff --git a/src/test/ui/wf/wf-object-safe.stderr b/src/test/ui/wf/wf-object-safe.stderr index 2a514d9d2c2b..87e8105d4aff 100644 --- a/src/test/ui/wf/wf-object-safe.stderr +++ b/src/test/ui/wf/wf-object-safe.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `A` cannot be made into an object --> $DIR/wf-object-safe.rs:9:13 | -LL | let _x: &A; //~ ERROR E0038 +LL | let _x: &A; | ^^ the trait `A` cannot be made into an object | = note: method `foo` references the `Self` type in its arguments or return type diff --git a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr index 04f8c70bbf42..8649506c870d 100644 --- a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr +++ b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for usize { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a fn(T); //~ ERROR `T` may not live long enough +LL | type Out = &'a fn(T); | ^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a fn(T)` does not outlive the data it points at --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:9:5 | -LL | type Out = &'a fn(T); //~ ERROR `T` may not live long enough +LL | type Out = &'a fn(T); | ^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -17,13 +17,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for u32 { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a Baz; //~ ERROR `T` may not live long enough +LL | type Out = &'a Baz; | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a (dyn Baz + 'a)` does not outlive the data it points at --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:5 | -LL | type Out = &'a Baz; //~ ERROR `T` may not live long enough +LL | type Out = &'a Baz; | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/wf/wf-static-method.stderr b/src/test/ui/wf/wf-static-method.stderr index 78ea903e699c..32832ceb79ca 100644 --- a/src/test/ui/wf/wf-static-method.stderr +++ b/src/test/ui/wf/wf-static-method.stderr @@ -1,7 +1,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/wf-static-method.rs:17:9 | -LL | u //~ ERROR E0312 +LL | u | ^ | note: ...the reference is valid for the lifetime 'a as defined on the impl at 14:6... @@ -18,7 +18,7 @@ LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () { error[E0478]: lifetime bound not satisfied --> $DIR/wf-static-method.rs:26:18 | -LL | let me = Self::make_me(); //~ ERROR lifetime bound not satisfied +LL | let me = Self::make_me(); | ^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'b as defined on the impl at 23:10 @@ -35,7 +35,7 @@ LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> { error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/wf-static-method.rs:33:9 | -LL | u //~ ERROR E0312 +LL | u | ^ | note: ...the reference is valid for the lifetime 'a as defined on the impl at 31:6... @@ -52,7 +52,7 @@ LL | impl<'a, 'b> Evil<'a, 'b> { error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements --> $DIR/wf-static-method.rs:41:5 | -LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime +LL | <()>::static_evil(b) | ^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'b as defined on the function body at 40:13... @@ -63,7 +63,7 @@ LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { note: ...so that reference does not outlive borrowed content --> $DIR/wf-static-method.rs:41:23 | -LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime +LL | <()>::static_evil(b) | ^ note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 40:9... --> $DIR/wf-static-method.rs:40:9 @@ -73,7 +73,7 @@ LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { note: ...so that reference does not outlive borrowed content --> $DIR/wf-static-method.rs:41:5 | -LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime +LL | <()>::static_evil(b) | ^^^^^^^^^^^^^^^^^^^^ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements diff --git a/src/test/ui/wf/wf-struct-bound.stderr b/src/test/ui/wf/wf-struct-bound.stderr index 37defb87ee52..1fdcced90cc5 100644 --- a/src/test/ui/wf/wf-struct-bound.stderr +++ b/src/test/ui/wf/wf-struct-bound.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-struct-bound.rs:9:1 | -LL | / struct SomeStruct //~ ERROR E0277 +LL | / struct SomeStruct LL | | where T: ExtraCopy LL | | { LL | | data: (T,U) diff --git a/src/test/ui/wf/wf-struct-field.stderr b/src/test/ui/wf/wf-struct-field.stderr index e31552b40895..e609f93ff700 100644 --- a/src/test/ui/wf/wf-struct-field.stderr +++ b/src/test/ui/wf/wf-struct-field.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied --> $DIR/wf-struct-field.rs:12:5 | -LL | data: IsCopy //~ ERROR E0277 +LL | data: IsCopy | ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | = help: consider adding a `where A: std::marker::Copy` bound diff --git a/src/test/ui/wf/wf-trait-associated-type-bound.stderr b/src/test/ui/wf/wf-trait-associated-type-bound.stderr index f8ba74a2fdc3..658d41218e48 100644 --- a/src/test/ui/wf/wf-trait-associated-type-bound.stderr +++ b/src/test/ui/wf/wf-trait-associated-type-bound.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-trait-associated-type-bound.rs:9:1 | -LL | / trait SomeTrait { //~ ERROR E0277 +LL | / trait SomeTrait { LL | | type Type1: ExtraCopy; LL | | } | |_^ the trait `std::marker::Copy` is not implemented for `T` diff --git a/src/test/ui/wf/wf-trait-bound.stderr b/src/test/ui/wf/wf-trait-bound.stderr index 585571a6a3cb..5cc9451bf5ca 100644 --- a/src/test/ui/wf/wf-trait-bound.stderr +++ b/src/test/ui/wf/wf-trait-bound.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-trait-bound.rs:9:1 | -LL | / trait SomeTrait //~ ERROR E0277 +LL | / trait SomeTrait LL | | where T: ExtraCopy LL | | { LL | | } diff --git a/src/test/ui/wf/wf-trait-default-fn-arg.stderr b/src/test/ui/wf/wf-trait-default-fn-arg.stderr index eeafc06db347..e71338922365 100644 --- a/src/test/ui/wf/wf-trait-default-fn-arg.stderr +++ b/src/test/ui/wf/wf-trait-default-fn-arg.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied --> $DIR/wf-trait-default-fn-arg.rs:11:5 | LL | / fn bar(&self, x: &Bar) { -LL | | //~^ ERROR E0277 +LL | | LL | | // LL | | // Here, Eq ought to be implemented. LL | | } diff --git a/src/test/ui/wf/wf-trait-default-fn-ret.stderr b/src/test/ui/wf/wf-trait-default-fn-ret.stderr index 7fabd6b47136..5a310a826dd9 100644 --- a/src/test/ui/wf/wf-trait-default-fn-ret.stderr +++ b/src/test/ui/wf/wf-trait-default-fn-ret.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied --> $DIR/wf-trait-default-fn-ret.rs:11:5 | LL | / fn bar(&self) -> Bar { -LL | | //~^ ERROR E0277 +LL | | LL | | // LL | | // Here, Eq ought to be implemented. LL | | loop { } diff --git a/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr b/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr index 669dd08b21f9..d5a00be6d346 100644 --- a/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied --> $DIR/wf-trait-default-fn-where-clause.rs:11:5 | LL | / fn bar(&self) where A: Bar { -LL | | //~^ ERROR E0277 +LL | | LL | | // LL | | // Here, Eq ought to be implemented. LL | | } diff --git a/src/test/ui/wf/wf-trait-superbound.stderr b/src/test/ui/wf/wf-trait-superbound.stderr index 0bcda407d9cd..a3c4ab58f65f 100644 --- a/src/test/ui/wf/wf-trait-superbound.stderr +++ b/src/test/ui/wf/wf-trait-superbound.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-trait-superbound.rs:9:1 | -LL | / trait SomeTrait: ExtraCopy { //~ ERROR E0277 +LL | / trait SomeTrait: ExtraCopy { LL | | } | |_^ the trait `std::marker::Copy` is not implemented for `T` | diff --git a/src/test/ui/where-clauses/where-for-self-2.stderr b/src/test/ui/where-clauses/where-for-self-2.stderr index bbcb61a856d8..dbe68b82c24c 100644 --- a/src/test/ui/where-clauses/where-for-self-2.stderr +++ b/src/test/ui/where-clauses/where-for-self-2.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `for<'a> &'a _: Bar` is not satisfied --> $DIR/where-for-self-2.rs:21:5 | -LL | foo(&X); //~ ERROR trait bound +LL | foo(&X); | ^^^ the trait `for<'a> Bar` is not implemented for `&'a _` | = help: the following implementations were found: diff --git a/src/test/ui/while-let.stderr b/src/test/ui/while-let.stderr index 6d61143d33c8..156d0e6c33d8 100644 --- a/src/test/ui/while-let.stderr +++ b/src/test/ui/while-let.stderr @@ -4,7 +4,7 @@ warning: irrefutable while-let pattern LL | while let $p = $e $b | ^^^^^ ... -LL | / foo!(a, 1, { //~ WARN irrefutable while-let +LL | / foo!(a, 1, { LL | | println!("irrefutable pattern"); LL | | }); | |_______- in this macro invocation @@ -17,7 +17,7 @@ warning: irrefutable while-let pattern LL | while let $p = $e $b | ^^^^^ ... -LL | / bar!(a, 1, { //~ WARN irrefutable while-let +LL | / bar!(a, 1, { LL | | println!("irrefutable pattern"); LL | | }); | |_______- in this macro invocation @@ -25,7 +25,7 @@ LL | | }); warning: irrefutable while-let pattern --> $DIR/while-let.rs:24:5 | -LL | / while let a = 1 { //~ WARN irrefutable while-let +LL | / while let a = 1 { LL | | println!("irrefutable pattern"); LL | | break; LL | | } diff --git a/src/test/ui/writing-to-immutable-vec.stderr b/src/test/ui/writing-to-immutable-vec.stderr index 3a99186b46f6..9bc82dfd3589 100644 --- a/src/test/ui/writing-to-immutable-vec.stderr +++ b/src/test/ui/writing-to-immutable-vec.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable local variable `v` as mutable | LL | let v: Vec = vec![1, 2, 3]; | - help: make this binding mutable: `mut v` -LL | v[1] = 4; //~ ERROR cannot borrow immutable local variable `v` as mutable +LL | v[1] = 4; | ^ cannot borrow mutably error: aborting due to previous error From c1cfacfb13f2bdf6bd94e81164c90b2449ec60a1 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Mon, 11 Mar 2019 23:18:35 +0300 Subject: [PATCH 342/381] Update NLL tests --- src/test/ui/E0508.nll.stderr | 2 +- .../ui/access-mode-in-closures.nll.stderr | 4 +- .../associated-types-outlives.nll.stderr | 2 +- src/test/ui/augmented-assignments.nll.stderr | 8 +- .../ui/binop/binop-consume-args.nll.stderr | 60 ++++---- .../ui/binop/binop-move-semantics.nll.stderr | 16 +- ...borrow-immutable-upvar-mutation.nll.stderr | 24 +-- .../borrowck/borrow-tuple-fields.nll.stderr | 12 +- .../ui/borrowck/borrowck-and-init.nll.stderr | 2 +- .../borrowck-anon-fields-struct.nll.stderr | 2 +- .../borrowck-anon-fields-tuple.nll.stderr | 2 +- .../borrowck-anon-fields-variant.nll.stderr | 4 +- .../ui/borrowck/borrowck-argument.nll.stderr | 8 +- .../borrowck-assign-comp-idx.nll.stderr | 4 +- ...sign-to-andmut-in-aliasable-loc.nll.stderr | 4 +- ...ssign-to-andmut-in-borrowed-loc.nll.stderr | 4 +- ...rowck-auto-mut-ref-to-immut-var.nll.stderr | 2 +- .../borrowck/borrowck-autoref-3261.nll.stderr | 2 +- .../borrowck-bad-nested-calls-free.nll.stderr | 4 +- .../borrowck-bad-nested-calls-move.nll.stderr | 4 +- .../borrowck/borrowck-block-unint.nll.stderr | 2 +- .../borrowck-borrow-from-owned-ptr.nll.stderr | 24 +-- ...owck-borrow-from-stack-variable.nll.stderr | 24 +-- .../borrowck-borrow-from-temporary.nll.stderr | 2 +- ...w-mut-base-ptr-in-aliasable-loc.nll.stderr | 6 +- ...orrowck-borrow-mut-object-twice.nll.stderr | 2 +- ...ck-borrow-overloaded-auto-deref.nll.stderr | 28 ++-- ...orrowck-borrow-overloaded-deref.nll.stderr | 14 +- ...borrowck-borrowed-uniq-rvalue-2.nll.stderr | 2 +- .../borrowck-borrowed-uniq-rvalue.nll.stderr | 2 +- .../borrowck-break-uninit-2.nll.stderr | 2 +- .../borrowck/borrowck-break-uninit.nll.stderr | 2 +- .../borrowck-closures-mut-of-imm.nll.stderr | 2 +- .../borrowck-closures-mut-of-mut.nll.stderr | 2 +- .../borrowck-closures-two-mut-fail.nll.stderr | 10 +- .../borrowck-closures-unique-imm.nll.stderr | 2 +- .../borrowck-closures-unique.nll.stderr | 8 +- ...orrowck-closures-use-after-free.nll.stderr | 2 +- .../borrowck-consume-unsize-vec.nll.stderr | 2 +- .../borrowck-consume-upcast-box.nll.stderr | 2 +- .../borrowck-field-sensitivity.nll.stderr | 22 +-- .../borrowck-fn-in-const-c.nll.stderr | 2 +- ...or-loop-correct-cmt-for-pattern.nll.stderr | 12 +- .../borrowck-for-loop-head-linkage.nll.stderr | 4 +- .../ui/borrowck/borrowck-in-static.nll.stderr | 2 +- .../borrowck-insert-during-each.nll.stderr | 4 +- .../borrowck/borrowck-issue-2657-1.nll.stderr | 2 +- .../borrowck/borrowck-issue-2657-2.nll.stderr | 2 +- .../borrowck/borrowck-lend-flow-if.nll.stderr | 2 +- .../ui/borrowck/borrowck-lend-flow.nll.stderr | 2 +- .../borrowck-loan-blocks-move.nll.stderr | 2 +- .../borrowck-loan-blocks-mut-uniq.nll.stderr | 2 +- ...loan-of-static-data-issue-27616.nll.stderr | 2 +- ...orrowck-loan-rcvr-overloaded-op.nll.stderr | 4 +- .../ui/borrowck/borrowck-loan-rcvr.nll.stderr | 4 +- .../borrowck-loan-vec-content.nll.stderr | 2 +- .../borrowck-move-by-capture.nll.stderr | 2 +- .../borrowck-move-error-with-note.nll.stderr | 8 +- ...e-from-subpath-of-borrowed-path.nll.stderr | 2 +- .../borrowck-move-from-unsafe-ptr.nll.stderr | 2 +- .../borrowck-move-mut-base-ptr.nll.stderr | 2 +- .../borrowck-move-out-of-vec-tail.nll.stderr | 6 +- .../borrowck-move-subcomponent.nll.stderr | 2 +- .../borrowck-multiple-captures.nll.stderr | 24 +-- .../borrowck-mut-addr-of-imm-var.nll.stderr | 2 +- ...owck-mut-borrow-of-mut-base-ptr.nll.stderr | 4 +- .../borrowck-mut-slice-of-imm-vec.nll.stderr | 2 +- ...rowck-no-cycle-in-exchange-heap.nll.stderr | 2 +- .../borrowck-object-lifetime.nll.stderr | 4 +- .../ui/borrowck/borrowck-or-init.nll.stderr | 2 +- .../borrowck-overloaded-call.nll.stderr | 6 +- ...owck-overloaded-index-autoderef.nll.stderr | 16 +- .../borrowck-reborrow-from-mut.nll.stderr | 24 +-- .../borrowck-ref-mut-of-imm.nll.stderr | 2 +- ...k-report-with-custom-diagnostic.nll.stderr | 12 +- ...urn-variable-on-stack-via-clone.nll.stderr | 2 +- .../borrowck-swap-mut-base-ptr.nll.stderr | 2 +- .../borrowck-unboxed-closures.nll.stderr | 6 +- .../borrowck-union-borrow-nested.nll.stderr | 2 +- .../borrowck/borrowck-union-borrow.nll.stderr | 24 +-- .../borrowck-union-move-assign.nll.stderr | 2 +- .../borrowck/borrowck-union-move.nll.stderr | 12 +- .../borrowck-uniq-via-lend.nll.stderr | 4 +- .../borrowck-use-mut-borrow.nll.stderr | 18 +-- ...rrowck-vec-pattern-element-loan.nll.stderr | 6 +- ...rowck-vec-pattern-loan-from-mut.nll.stderr | 2 +- .../borrowck-vec-pattern-nesting.nll.stderr | 36 ++--- ...k-vec-pattern-tail-element-loan.nll.stderr | 2 +- .../borrowck/borrowck-while-break.nll.stderr | 2 +- .../index-mut-help-with-impl.nll.stderr | 2 +- .../ui/borrowck/index-mut-help.nll.stderr | 6 +- .../issue-47215-ice-from-drop-elab.nll.stderr | 2 +- src/test/ui/borrowck/issue-51117.nll.stderr | 2 +- .../ui/borrowck/mut-borrow-in-loop.nll.stderr | 6 +- .../borrowck/mut-borrow-of-mut-ref.nll.stderr | 2 +- .../mut-borrow-outside-loop.nll.stderr | 4 +- .../ui/borrowck/mutability-errors.nll.stderr | 140 +++++++++--------- ...mote-ref-mut-in-let-issue-46557.nll.stderr | 10 +- .../reassignment_immutable_fields.nll.stderr | 4 +- ...nt_immutable_fields_overlapping.nll.stderr | 6 +- ...signment_immutable_fields_twice.nll.stderr | 4 +- .../ui/by-move-pattern-binding.nll.stderr | 4 +- ...check-static-values-constraints.nll.stderr | 18 +-- ...losure-immutable-outer-variable.nll.stderr | 2 +- .../huge_multispan_highlight.nll.stderr | 2 +- .../ui/codemap_tests/issue-11715.nll.stderr | 2 +- src/test/ui/codemap_tests/one_line.nll.stderr | 2 +- src/test/ui/codemap_tests/tab_3.nll.stderr | 2 +- .../dont_promote_unstable_const_fn.nll.stderr | 8 +- ...e_unstable_const_fn_cross_crate.nll.stderr | 6 +- .../promoted_const_fn_fail.nll.stderr | 2 +- .../promoted_raw_ptr_ops.nll.stderr | 8 +- .../transmute-const-promotion.nll.stderr | 2 +- .../const-eval/union_promotion.nll.stderr | 2 +- .../ui/consts/const-int-conversion.nll.stderr | 2 +- .../consts/const-int-overflowing.nll.stderr | 8 +- .../ui/consts/const-int-rotate.nll.stderr | 6 +- src/test/ui/consts/const-int-sign.nll.stderr | 6 +- .../ui/consts/const-int-wrapping.nll.stderr | 12 +- .../ui/consts/const-ptr-nonnull.nll.stderr | 2 +- .../ui/consts/const-ptr-unique.nll.stderr | 2 +- .../min_const_fn/min_const_fn.nll.stderr | 18 +-- .../consts/min_const_fn/promotion.nll.stderr | 14 +- .../ui/consts/promote_const_let.nll.stderr | 4 +- .../ui/did_you_mean/issue-31424.nll.stderr | 8 +- .../ui/did_you_mean/issue-34126.nll.stderr | 4 +- .../ui/did_you_mean/issue-34337.nll.stderr | 2 +- .../ui/did_you_mean/issue-35937.nll.stderr | 6 +- .../ui/did_you_mean/issue-37139.nll.stderr | 2 +- .../ui/did_you_mean/issue-38147-1.nll.stderr | 2 +- .../ui/did_you_mean/issue-38147-4.nll.stderr | 2 +- .../ui/did_you_mean/issue-39544.nll.stderr | 30 ++-- .../ui/did_you_mean/issue-40823.nll.stderr | 2 +- ...tructing-destructing-struct-let.nll.stderr | 4 +- .../drop-with-active-borrows-1.nll.stderr | 2 +- src/test/ui/dropck/dropck-union.nll.stderr | 2 +- .../dropck_trait_cycle_checked.nll.stderr | 16 +- src/test/ui/dst/dst-bad-coerce3.nll.stderr | 8 +- src/test/ui/error-codes/E0017.nll.stderr | 10 +- src/test/ui/error-codes/E0301.nll.stderr | 2 +- src/test/ui/error-codes/E0388.nll.stderr | 10 +- src/test/ui/error-codes/E0389.nll.stderr | 2 +- src/test/ui/error-codes/E0499.nll.stderr | 2 +- src/test/ui/error-codes/E0502.nll.stderr | 2 +- src/test/ui/error-codes/E0503.nll.stderr | 2 +- src/test/ui/error-codes/E0504.nll.stderr | 2 +- src/test/ui/error-codes/E0505.nll.stderr | 2 +- src/test/ui/error-codes/E0509.nll.stderr | 2 +- src/test/ui/error-codes/E0597.nll.stderr | 2 +- ...ional-struct-update-noncopyable.nll.stderr | 2 +- src/test/ui/generator/borrowing.nll.stderr | 2 +- src/test/ui/generator/dropck.nll.stderr | 2 +- .../ui/generator/yield-in-args.nll.stderr | 2 +- .../yield-while-iterating.nll.stderr | 4 +- .../yield-while-ref-reborrowed.nll.stderr | 2 +- .../ui/hashmap-iter-value-lifetime.nll.stderr | 2 +- src/test/ui/hashmap-lifetimes.nll.stderr | 2 +- .../hrtb/hrtb-debruijn-in-receiver.nll.stderr | 2 +- src/test/ui/hygiene/fields-move.nll.stderr | 12 +- .../mut_while_borrow.nll.stderr | 2 +- src/test/ui/issues/issue-11681.nll.stderr | 2 +- src/test/ui/issues/issue-11873.nll.stderr | 2 +- src/test/ui/issues/issue-12470.nll.stderr | 2 +- src/test/ui/issues/issue-13497-2.nll.stderr | 2 +- src/test/ui/issues/issue-17385.nll.stderr | 4 +- src/test/ui/issues/issue-17545.nll.stderr | 2 +- .../issues/issue-17718-static-move.nll.stderr | 2 +- src/test/ui/issues/issue-18118.nll.stderr | 2 +- src/test/ui/issues/issue-18783.nll.stderr | 4 +- src/test/ui/issues/issue-21600.nll.stderr | 10 +- .../issues/issue-24267-flow-exit.nll.stderr | 4 +- src/test/ui/issues/issue-24357.nll.stderr | 2 +- src/test/ui/issues/issue-25700.nll.stderr | 2 +- src/test/ui/issues/issue-2590.nll.stderr | 2 +- src/test/ui/issues/issue-36400.nll.stderr | 2 +- src/test/ui/issues/issue-40288.nll.stderr | 2 +- .../issue-40402-1.nll.stderr | 2 +- .../issue-40402-2.nll.stderr | 4 +- src/test/ui/issues/issue-41726.nll.stderr | 2 +- src/test/ui/issues/issue-42106.nll.stderr | 2 +- src/test/ui/issues/issue-42344.nll.stderr | 2 +- src/test/ui/issues/issue-42796.nll.stderr | 2 +- src/test/ui/issues/issue-44373.nll.stderr | 2 +- src/test/ui/issues/issue-49824.nll.stderr | 2 +- src/test/ui/issues/issue-51244.nll.stderr | 2 +- src/test/ui/issues/issue-6801.nll.stderr | 2 +- .../borrowck-let-suggestion.nll.stderr | 2 +- .../liveness-move-call-arg.nll.stderr | 2 +- .../liveness/liveness-move-in-loop.nll.stderr | 2 +- .../liveness-move-in-while.nll.stderr | 2 +- .../liveness-use-after-move.nll.stderr | 2 +- .../liveness-use-after-send.nll.stderr | 2 +- .../ui/loops/loop-proper-liveness.nll.stderr | 2 +- .../ui/methods/method-self-arg-2.nll.stderr | 4 +- .../moves/move-guard-same-consts.nll.stderr | 2 +- src/test/ui/moves/move-in-guard-1.nll.stderr | 2 +- src/test/ui/moves/move-in-guard-2.nll.stderr | 2 +- .../moves/move-into-dead-array-1.nll.stderr | 2 +- .../moves/move-into-dead-array-2.nll.stderr | 2 +- .../ui/moves/move-out-of-slice-1.nll.stderr | 4 +- .../moves/move-out-of-tuple-field.nll.stderr | 4 +- ...s-based-on-type-access-to-field.nll.stderr | 2 +- .../moves-based-on-type-block-bad.nll.stderr | 2 +- ...ased-on-type-capture-clause-bad.nll.stderr | 2 +- ...on-type-cyclic-types-issue-4821.nll.stderr | 2 +- ...type-distribute-copy-over-paren.nll.stderr | 8 +- .../moves-based-on-type-exprs.nll.stderr | 22 +-- ...es-based-on-type-match-bindings.nll.stderr | 2 +- ...e-out-of-closure-env-issue-1965.nll.stderr | 2 +- ...type-no-recursive-stack-closure.nll.stderr | 2 +- .../ui/moves/moves-sru-moved-field.nll.stderr | 2 +- src/test/ui/mut/mut-cant-alias.nll.stderr | 2 +- .../ui/mut/mutable-class-fields-2.nll.stderr | 2 +- .../ui/nll/cannot-move-block-spans.nll.stderr | 18 +-- .../ui/nll/issue-54556-niconii.nll.stderr | 2 +- .../ui/nll/issue-54556-stephaneyfx.nll.stderr | 2 +- ...-54556-temps-in-tail-diagnostic.nll.stderr | 2 +- .../ui/nll/issue-54556-wrap-it-up.nll.stderr | 2 +- src/test/ui/nll/issue-55850.nll.stderr | 4 +- src/test/ui/no-reuse-move-arc.nll.stderr | 2 +- src/test/ui/not-copy-closure.nll.stderr | 2 +- ...object-safety-by-value-self-use.nll.stderr | 2 +- .../once-cant-call-twice-on-heap.nll.stderr | 2 +- src/test/ui/ref-suggestion.nll.stderr | 6 +- ...-bound-on-closure-outlives-call.nll.stderr | 6 +- .../region-object-lifetime-5.nll.stderr | 2 +- .../ui/regions/regions-addr-of-arg.nll.stderr | 4 +- .../regions-adjusted-lvalue-op.nll.stderr | 4 +- ...ions-close-object-into-object-1.nll.stderr | 2 +- ...ions-close-object-into-object-3.nll.stderr | 2 +- .../regions/regions-creating-enums.nll.stderr | 4 +- ...ions-infer-borrow-scope-too-big.nll.stderr | 2 +- ...regions-infer-proc-static-upvar.nll.stderr | 2 +- ...etime-of-struct-or-enum-variant.nll.stderr | 4 +- .../regions/regions-nested-fns-2.nll.stderr | 2 +- ...ions-pattern-typing-issue-19552.nll.stderr | 2 +- .../regions/regions-ref-in-fn-arg.nll.stderr | 4 +- src/test/ui/regions/regions-ret.nll.stderr | 2 +- ...ions-return-stack-allocated-vec.nll.stderr | 2 +- .../regions/regions-steal-closure.nll.stderr | 2 +- .../regions/regions-trait-variance.nll.stderr | 2 +- .../regions-var-type-out-of-scope.nll.stderr | 2 +- .../borrowck-issue-49631.nll.stderr | 2 +- .../enum.nll.stderr | 6 +- .../explicit-mut.nll.stderr | 6 +- .../dbg-macro-move-semantics.nll.stderr | 2 +- src/test/ui/slice-mut-2.nll.stderr | 2 +- ...orrow-overloaded-auto-deref-mut.nll.stderr | 20 +-- ...wck-borrow-overloaded-deref-mut.nll.stderr | 8 +- ...owck-call-is-borrow-issue-12224.nll.stderr | 2 +- ...-call-method-from-mut-aliasable.nll.stderr | 2 +- .../borrowck-object-mutability.nll.stderr | 4 +- .../span/destructor-restrictions.nll.stderr | 2 +- .../dropck_direct_cycle_with_drop.nll.stderr | 2 +- src/test/ui/span/issue-11925.nll.stderr | 2 +- src/test/ui/span/mut-arg-hint.nll.stderr | 6 +- .../span/mut-ptr-cant-outlive-ref.nll.stderr | 2 +- .../regions-escape-loop-via-vec.nll.stderr | 12 +- .../send-is-not-static-std-sync.nll.stderr | 10 +- ...-must-not-hide-type-from-dropck.nll.stderr | 2 +- .../static/static-lifetime-bound.nll.stderr | 4 +- .../static-reference-to-fn-2.nll.stderr | 2 +- .../ui/static/static-region-bound.nll.stderr | 2 +- src/test/ui/std-uncopyable-atomics.nll.stderr | 8 +- src/test/ui/thread-local-mutation.nll.stderr | 2 +- .../trait-coercion-generic-regions.nll.stderr | 2 +- ...unds-inconsistent-copy-reborrow.nll.stderr | 4 +- .../unboxed-closure-illegal-move.nll.stderr | 8 +- ...boxed-closure-immutable-capture.nll.stderr | 18 +-- .../unboxed-closure-region.nll.stderr | 2 +- ...nboxed-closures-borrow-conflict.nll.stderr | 2 +- ...-closures-failed-recursive-fn-1.nll.stderr | 4 +- ...nfer-fnmut-calling-fnmut-no-mut.nll.stderr | 4 +- ...losures-infer-fnmut-missing-mut.nll.stderr | 2 +- ...es-infer-fnmut-move-missing-mut.nll.stderr | 2 +- .../unboxed-closures-mutate-upvar.nll.stderr | 10 +- ...nion-borrow-move-parent-sibling.nll.stderr | 12 +- src/test/ui/unop-move-semantics.nll.stderr | 10 +- .../ui/unsized-locals/double-move.nll.stderr | 12 +- .../use-after-move-based-on-type.nll.stderr | 2 +- ...e-after-move-self-based-on-type.nll.stderr | 2 +- .../ui/use/use-after-move-self.nll.stderr | 2 +- .../variance/variance-issue-20533.nll.stderr | 6 +- .../ui/vec/vec-mut-iter-borrow.nll.stderr | 2 +- .../ui/walk-struct-literal-with.nll.stderr | 2 +- .../wf/wf-misc-methods-issue-28609.nll.stderr | 12 +- .../ui/writing-to-immutable-vec.nll.stderr | 2 +- 287 files changed, 794 insertions(+), 794 deletions(-) diff --git a/src/test/ui/E0508.nll.stderr b/src/test/ui/E0508.nll.stderr index 82fdce2112ec..983062e450ea 100644 --- a/src/test/ui/E0508.nll.stderr +++ b/src/test/ui/E0508.nll.stderr @@ -1,7 +1,7 @@ error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array --> $DIR/E0508.rs:5:18 | -LL | let _value = array[0]; //~ ERROR [E0508] +LL | let _value = array[0]; | ^^^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/access-mode-in-closures.nll.stderr b/src/test/ui/access-mode-in-closures.nll.stderr index 0c9a62351d20..713eeba54597 100644 --- a/src/test/ui/access-mode-in-closures.nll.stderr +++ b/src/test/ui/access-mode-in-closures.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/access-mode-in-closures.rs:8:15 | -LL | match *s { S(v) => v } //~ ERROR cannot move out +LL | match *s { S(v) => v } | ^^ - data moved here | | | cannot move out of borrowed content @@ -10,7 +10,7 @@ LL | match *s { S(v) => v } //~ ERROR cannot move out note: move occurs because `v` has type `std::vec::Vec`, which does not implement the `Copy` trait --> $DIR/access-mode-in-closures.rs:8:22 | -LL | match *s { S(v) => v } //~ ERROR cannot move out +LL | match *s { S(v) => v } | ^ error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-outlives.nll.stderr b/src/test/ui/associated-types/associated-types-outlives.nll.stderr index c58dc314e8a9..840e33b4b8a8 100644 --- a/src/test/ui/associated-types/associated-types-outlives.nll.stderr +++ b/src/test/ui/associated-types/associated-types-outlives.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | 's: loop { y = denormalise(&x); break } | -- borrow of `x` occurs here -LL | drop(x); //~ ERROR cannot move out of `x` because it is borrowed +LL | drop(x); | ^ move out of `x` occurs here LL | return f(y); | - borrow later used here diff --git a/src/test/ui/augmented-assignments.nll.stderr b/src/test/ui/augmented-assignments.nll.stderr index 33c94d6e3a59..08f06e90162b 100644 --- a/src/test/ui/augmented-assignments.nll.stderr +++ b/src/test/ui/augmented-assignments.nll.stderr @@ -1,14 +1,14 @@ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/augmented-assignments.rs:16:5 | -LL | x //~ error: use of moved value: `x` +LL | x | - | | | _____borrow of `x` occurs here | | -LL | | //~^ value used here after move +LL | | LL | | += -LL | | x; //~ value moved here +LL | | x; | | ^ | | | | |_____move out of `x` occurs here @@ -20,7 +20,7 @@ error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable LL | let y = Int(2); | - help: consider changing this to be mutable: `mut y` ... -LL | y //~ error: cannot borrow immutable local variable `y` as mutable +LL | y | ^ cannot borrow as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/binop/binop-consume-args.nll.stderr b/src/test/ui/binop/binop-consume-args.nll.stderr index 59b5aba93cad..5751af27fcb4 100644 --- a/src/test/ui/binop/binop-consume-args.nll.stderr +++ b/src/test/ui/binop/binop-consume-args.nll.stderr @@ -7,7 +7,7 @@ LL | fn add, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs + rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -19,8 +19,8 @@ LL | fn add, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs + rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -32,7 +32,7 @@ LL | fn sub, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs - rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -44,8 +44,8 @@ LL | fn sub, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs - rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -57,7 +57,7 @@ LL | fn mul, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs * rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -69,8 +69,8 @@ LL | fn mul, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs * rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -82,7 +82,7 @@ LL | fn div, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs / rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -94,8 +94,8 @@ LL | fn div, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs / rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -107,7 +107,7 @@ LL | fn rem, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs % rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -119,8 +119,8 @@ LL | fn rem, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs % rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -132,7 +132,7 @@ LL | fn bitand, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs & rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -144,8 +144,8 @@ LL | fn bitand, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs & rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -157,7 +157,7 @@ LL | fn bitor, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs | rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -169,8 +169,8 @@ LL | fn bitor, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs | rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -182,7 +182,7 @@ LL | fn bitxor, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs ^ rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -194,8 +194,8 @@ LL | fn bitxor, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs ^ rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -207,7 +207,7 @@ LL | fn shl, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs << rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -219,8 +219,8 @@ LL | fn shl, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs << rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -232,7 +232,7 @@ LL | fn shr, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs >> rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -244,8 +244,8 @@ LL | fn shr, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs >> rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error: aborting due to 20 previous errors diff --git a/src/test/ui/binop/binop-move-semantics.nll.stderr b/src/test/ui/binop/binop-move-semantics.nll.stderr index 7c84e8833a9e..7d54de655bf5 100644 --- a/src/test/ui/binop/binop-move-semantics.nll.stderr +++ b/src/test/ui/binop/binop-move-semantics.nll.stderr @@ -8,7 +8,7 @@ LL | fn double_move>(x: T) { LL | x | - value moved here LL | + -LL | x; //~ ERROR: use of moved value +LL | x; | ^ value used here after move error[E0382]: borrow of moved value: `x` @@ -21,7 +21,7 @@ LL | fn move_then_borrow + Clone>(x: T) { LL | x | - value moved here LL | + -LL | x.clone(); //~ ERROR: use of moved value +LL | x.clone(); | ^ value borrowed here after move error[E0505]: cannot move out of `x` because it is borrowed @@ -30,7 +30,7 @@ error[E0505]: cannot move out of `x` because it is borrowed LL | let m = &x; | -- borrow of `x` occurs here ... -LL | x //~ ERROR: cannot move out of `x` because it is borrowed +LL | x | ^ move out of `x` occurs here ... LL | use_mut(n); use_imm(m); @@ -42,7 +42,7 @@ error[E0505]: cannot move out of `y` because it is borrowed LL | let n = &mut y; | ------ borrow of `y` occurs here ... -LL | y; //~ ERROR: cannot move out of `y` because it is borrowed +LL | y; | ^ move out of `y` occurs here LL | use_mut(n); use_imm(m); | - borrow later used here @@ -50,13 +50,13 @@ LL | use_mut(n); use_imm(m); error[E0507]: cannot move out of borrowed content --> $DIR/binop-move-semantics.rs:30:5 | -LL | *m //~ ERROR: cannot move out of borrowed content +LL | *m | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/binop-move-semantics.rs:32:5 | -LL | *n; //~ ERROR: cannot move out of borrowed content +LL | *n; | ^^ cannot move out of borrowed content error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable @@ -68,7 +68,7 @@ LL | &mut f | _____mutable borrow occurs here | | LL | | + -LL | | &f; //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable +LL | | &f; | | ^- | |_____|| | |mutable borrow later used here @@ -83,7 +83,7 @@ LL | &f | _____immutable borrow occurs here | | LL | | + -LL | | &mut f; //~ ERROR: cannot borrow `f` as mutable because it is also borrowed as immutable +LL | | &mut f; | | ^^^^^- | |_____|____| | | immutable borrow later used here diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr index 9174a6976113..af45c8a980df 100644 --- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr +++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr @@ -1,73 +1,73 @@ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:15:27 | -LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(|| x = 42); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:15:24 | -LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(|| x = 42); | ^^^^^^^^^ error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:18:31 | -LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(|| set(&mut y)); | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:18:24 | -LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(|| set(&mut y)); | ^^^^^^^^^^^^^^ error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:21:55 | -LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:21:52 | -LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); | ^^^^^^^^^ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:27:32 | -LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(move || x = 42); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:27:24 | -LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(move || x = 42); | ^^^^^^^^^^^^^^ error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:30:36 | -LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(move || set(&mut y)); | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:30:24 | -LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(move || set(&mut y)); | ^^^^^^^^^^^^^^^^^^^ error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:33:65 | -LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:33:57 | -LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); | ^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr b/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr index 72a29b864a4f..5c40555c501c 100644 --- a/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr +++ b/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let r = &x.0; | ---- borrow of `x.0` occurs here -LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed +LL | let y = x; | ^ move out of `x` occurs here LL | LL | r.use_ref(); @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immu | LL | let a = &x.0; | ---- immutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as +LL | let b = &mut x.0; | ^^^^^^^^ mutable borrow occurs here LL | a.use_ref(); | - immutable borrow later used here @@ -24,7 +24,7 @@ error[E0499]: cannot borrow `x.0` as mutable more than once at a time | LL | let a = &mut x.0; | -------- first mutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time +LL | let b = &mut x.0; | ^^^^^^^^ second mutable borrow occurs here LL | a.use_ref(); | - first borrow later used here @@ -34,7 +34,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let r = &x.0; | ---- borrow of `x.0` occurs here -LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed +LL | let y = x; | ^ move out of `x` occurs here LL | r.use_ref(); | - borrow later used here @@ -44,7 +44,7 @@ error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immu | LL | let a = &x.0; | ---- immutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as +LL | let b = &mut x.0; | ^^^^^^^^ mutable borrow occurs here LL | a.use_ref(); | - immutable borrow later used here @@ -54,7 +54,7 @@ error[E0499]: cannot borrow `x.0` as mutable more than once at a time | LL | let a = &mut x.0; | -------- first mutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time +LL | let b = &mut x.0; | ^^^^^^^^ second mutable borrow occurs here LL | a.use_mut(); | - first borrow later used here diff --git a/src/test/ui/borrowck/borrowck-and-init.nll.stderr b/src/test/ui/borrowck/borrowck-and-init.nll.stderr index b4b02cf208ae..2db075194810 100644 --- a/src/test/ui/borrowck/borrowck-and-init.nll.stderr +++ b/src/test/ui/borrowck/borrowck-and-init.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `i` --> $DIR/borrowck-and-init.rs:5:20 | -LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` +LL | println!("{}", i); | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr index 43c74988f9ea..7a959fb6ec62 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | Y(ref mut a, _) => a | --------- first mutable borrow occurs here ... -LL | Y(ref mut b, _) => b //~ ERROR cannot borrow +LL | Y(ref mut b, _) => b | ^^^^^^^^^ second mutable borrow occurs here ... LL | *a += 1; diff --git a/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr index 15859040f060..88a8867f5ee0 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | (ref mut a, _) => a | --------- first mutable borrow occurs here ... -LL | (ref mut b, _) => b //~ ERROR cannot borrow +LL | (ref mut b, _) => b | ^^^^^^^^^ second mutable borrow occurs here ... LL | *a += 1; diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr index 2f4cf7dd800e..6c8a32ee3916 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr @@ -19,7 +19,7 @@ error[E0503]: cannot use `y` because it was mutably borrowed LL | Foo::Y(ref mut a, _) => a, | --------- borrow of `y.0` occurs here ... -LL | Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow +LL | Foo::Y(ref mut b, _) => b, | ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0` ... LL | *a += 1; @@ -31,7 +31,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | Foo::Y(ref mut a, _) => a, | --------- first mutable borrow occurs here ... -LL | Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow +LL | Foo::Y(ref mut b, _) => b, | ^^^^^^^^^ second mutable borrow occurs here ... LL | *a += 1; diff --git a/src/test/ui/borrowck/borrowck-argument.nll.stderr b/src/test/ui/borrowck/borrowck-argument.nll.stderr index 9e7f0930ee57..cf1583314092 100644 --- a/src/test/ui/borrowck/borrowck-argument.nll.stderr +++ b/src/test/ui/borrowck/borrowck-argument.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable | LL | fn func(arg: S) { | --- help: consider changing this to be mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow as mutable error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable | LL | fn method(&self, arg: S) { | --- help: consider changing this to be mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow as mutable error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable @@ -19,13 +19,13 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable | LL | fn default(&self, arg: S) { | --- help: consider changing this to be mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow as mutable error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable --> $DIR/borrowck-argument.rs:32:17 | -LL | (|arg: S| { arg.mutate() })(s); //~ ERROR: cannot borrow immutable argument +LL | (|arg: S| { arg.mutate() })(s); | --- ^^^ cannot borrow as mutable | | | help: consider changing this to be mutable: `mut arg` diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr b/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr index 71f36c2b045a..93f1d8c52586 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immuta LL | let q: &isize = &p[0]; | - immutable borrow occurs here LL | -LL | p[0] = 5; //~ ERROR cannot borrow +LL | p[0] = 5; | ^ mutable borrow occurs here LL | LL | println!("{}", *q); @@ -17,7 +17,7 @@ LL | borrow( | ------ immutable borrow later used by call LL | &p, | -- immutable borrow occurs here -LL | || p[0] = 5); //~ ERROR cannot borrow `p` as mutable +LL | || p[0] = 5); | ^^ - second borrow occurs due to use of `p` in closure | | | mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr index 469199d69b91..d8ccf36852a5 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference | LL | fn a(s: &S) { | -- help: consider changing this to be a mutable reference: `&mut S<'_>` -LL | *s.pointer += 1; //~ ERROR cannot assign +LL | *s.pointer += 1; | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference @@ -11,7 +11,7 @@ error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference | LL | fn c(s: & &mut S) { | -------- help: consider changing this to be a mutable reference: `&mut &mut S<'_>` -LL | *s.pointer += 1; //~ ERROR cannot assign +LL | *s.pointer += 1; | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr index 8e3e9d41f8c0..0aacaf9cf479 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `*y.pointer` because it was mutably borrowed | LL | let z = copy_borrowed_ptr(&mut y); | ------ borrow of `y` occurs here -LL | *y.pointer += 1; //~ ERROR cannot assign +LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ use of borrowed `y` LL | *z.pointer += 1; | --------------- borrow later used here @@ -13,7 +13,7 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed | LL | let z = copy_borrowed_ptr(&mut y); | ------ borrow of `*y.pointer` occurs here -LL | *y.pointer += 1; //~ ERROR cannot assign +LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here LL | *z.pointer += 1; | --------------- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr index 53aaa4a2957e..3ed76c13f6a7 100644 --- a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr +++ b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | let x = Foo { x: 3 }; | - help: consider changing this to be mutable: `mut x` -LL | x.printme(); //~ ERROR cannot borrow +LL | x.printme(); | ^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr b/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr index 9e62534c6718..c2dfb687e8ee 100644 --- a/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr +++ b/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr @@ -5,7 +5,7 @@ LL | (&mut x).with( | -------- ---- first borrow later used by call | | | first mutable borrow occurs here -LL | |opt| { //~ ERROR cannot borrow `x` as mutable more than once at a time +LL | |opt| { | ^^^^^ second mutable borrow occurs here ... LL | x = X(Either::Left((0, 0))); diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr index 1732628d40f8..e273a778fdad 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr @@ -5,7 +5,7 @@ LL | add( | --- immutable borrow later used by call LL | &*a, | --- immutable borrow occurs here -LL | rewrite(&mut a)); //~ ERROR cannot borrow +LL | rewrite(&mut a)); | ^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `a` as mutable because it is also borrowed as immutable @@ -15,7 +15,7 @@ LL | add( | --- immutable borrow later used by call LL | &*a, | --- immutable borrow occurs here -LL | rewrite(&mut a)); //~ ERROR cannot borrow +LL | rewrite(&mut a)); | ^^^^^^ mutable borrow occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr index 117567cba192..371bcf2b69cf 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr @@ -5,7 +5,7 @@ LL | add( | --- borrow later used by call LL | &*a, | --- borrow of `*a` occurs here -LL | a); //~ ERROR cannot move +LL | a); | ^ move out of `a` occurs here error[E0505]: cannot move out of `a` because it is borrowed @@ -15,7 +15,7 @@ LL | add( | --- borrow later used by call LL | &*a, | --- borrow of `*a` occurs here -LL | a); //~ ERROR cannot move +LL | a); | ^ move out of `a` occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-block-unint.nll.stderr b/src/test/ui/borrowck/borrowck-block-unint.nll.stderr index ea17fafc9390..d2a49962bafc 100644 --- a/src/test/ui/borrowck/borrowck-block-unint.nll.stderr +++ b/src/test/ui/borrowck/borrowck-block-unint.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/borrowck-block-unint.rs:4:11 | -LL | force(|| { //~ ERROR capture of possibly uninitialized variable: `x` +LL | force(|| { | ^^ use of possibly uninitialized `x` LL | println!("{}", x); | - borrow occurs due to use in closure diff --git a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr index d1377fd439a4..ad6bd7dc9426 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1; | ------------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here LL | *bar1; | ----- mutable borrow later used here @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1; | --------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -45,9 +45,9 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo2 = &*foo; LL | *bar1; | ----- mutable borrow later used here @@ -56,8 +56,8 @@ error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as m | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &*foo; | ^^^^^ immutable borrow occurs here LL | *bar1; | ----- mutable borrow later used here @@ -67,7 +67,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -77,7 +77,7 @@ error[E0499]: cannot borrow `*foo` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -87,7 +87,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -97,7 +97,7 @@ error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as imm | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -107,7 +107,7 @@ error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as m | LL | let foo = make_foo(); | --- help: consider changing this to be mutable: `mut foo` -LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let bar1 = &mut foo.bar1; | ^^^^^^^^^^^^^ cannot borrow as mutable error: aborting due to 11 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr index f53cb32a5679..b5c618479187 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1; | ------------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here LL | *bar1; | ----- mutable borrow later used here @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1; | --------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -45,9 +45,9 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here -LL | let _foo2 = &foo; //~ ERROR cannot borrow +LL | let _foo2 = &foo; LL | *bar1; | ----- mutable borrow later used here @@ -56,8 +56,8 @@ error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mu | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &foo; | ^^^^ immutable borrow occurs here LL | *bar1; | ----- mutable borrow later used here @@ -67,7 +67,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -77,7 +77,7 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo2 = &mut foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut foo; | ^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -87,7 +87,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -97,7 +97,7 @@ error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immu | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo2 = &mut foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut foo; | ^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -107,7 +107,7 @@ error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as m | LL | let foo = make_foo(); | --- help: consider changing this to be mutable: `mut foo` -LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let bar1 = &mut foo.bar1; | ^^^^^^^^^^^^^ cannot borrow as mutable error: aborting due to 11 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr index 52bc3e982967..71bf052c93d6 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing temporary value --> $DIR/borrowck-borrow-from-temporary.rs:10:5 | -LL | let &Foo(ref x) = &id(Foo(3)); //~ ERROR borrowed value does not live long enough +LL | let &Foo(ref x) = &id(Foo(3)); | ---------- temporary value created here LL | x | ^ returns a value referencing data owned by the current function diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr index 82b9449de507..7c1c063d260b 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr @@ -4,7 +4,7 @@ error[E0594]: cannot assign to `**t1` which is behind a `&` reference LL | let t1 = t0; | -- help: consider changing this to be a mutable reference: `&mut &mut isize` LL | let p: &isize = &**t0; -LL | **t1 = 22; //~ ERROR cannot assign +LL | **t1 = 22; | ^^^^^^^^^ `t1` is a `&` reference, so the data it refers to cannot be written error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as mutable @@ -12,7 +12,7 @@ error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as m | LL | let t1 = &mut *t0; | -------- mutable borrow occurs here -LL | let p: &isize = &**t0; //~ ERROR cannot borrow +LL | let p: &isize = &**t0; | ^^^^^ immutable borrow occurs here LL | **t1 = 22; | --------- mutable borrow later used here @@ -22,7 +22,7 @@ error[E0596]: cannot borrow `**t0` as mutable, as it is behind a `&` reference | LL | fn foo4(t0: & &mut isize) { | ------------ help: consider changing this to be a mutable reference: `&mut &mut isize` -LL | let x: &mut isize = &mut **t0; //~ ERROR cannot borrow +LL | let x: &mut isize = &mut **t0; | ^^^^^^^^^ `t0` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr index c329fc9e9108..fa0ae318e72c 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let y = x.f1(); | - first mutable borrow occurs here -LL | x.f2(); //~ ERROR cannot borrow `*x` as mutable +LL | x.f2(); | ^ second mutable borrow occurs here LL | y.use_ref(); | - first borrow later used here diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr index ecb013b7a160..4fc320c50594 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr @@ -1,85 +1,85 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:47:19 | -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:51:19 | -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:59:5 | -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:63:5 | -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:67:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:71:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:75:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:83:5 | -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:87:5 | -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:95:5 | -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:99:5 | -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:103:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:107:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:111:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error: aborting due to 14 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr index 1c3131806be2..cc4d91a58e93 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr @@ -1,43 +1,43 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:23:19 | -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:27:19 | -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:35:5 | -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:39:5 | -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-deref.rs:43:5 | -LL | *x = 3; //~ ERROR cannot assign +LL | *x = 3; | ^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-deref.rs:47:5 | -LL | **x = 3; //~ ERROR cannot assign +LL | **x = 3; | ^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-deref.rs:51:5 | -LL | **x = 3; //~ ERROR cannot assign +LL | **x = 3; | ^^^^^^^ cannot assign error: aborting due to 7 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr index 97dc59c95438..1dd18c12fc8d 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:20:20 | -LL | let x = defer(&vec!["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough +LL | let x = defer(&vec!["Goodbye", "world!"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary which is freed while still in use diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr index d6e599d1abf9..c91a4377b4c6 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-borrowed-uniq-rvalue.rs:10:28 | -LL | buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough +LL | buggy_map.insert(42, &*Box::new(1)); | ^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary which is freed while still in use diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr index 177a27387728..e40d8d9dfccb 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/borrowck-break-uninit-2.rs:9:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr b/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr index 64d1e629fecd..bbf9b9f1241a 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/borrowck-break-uninit.rs:9:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr index 8123e17ce9da..0064417c57bf 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr @@ -17,7 +17,7 @@ LL | let mut c1 = || set(&mut *x); | -- - first borrow occurs due to use of `x` in closure | | | first closure is constructed here -LL | //~^ ERROR cannot borrow +LL | LL | let mut c2 = || set(&mut *x); | ^^ - second borrow occurs due to use of `x` in closure | | diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr index 18f95f232cdd..471173e595f4 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr @@ -9,7 +9,7 @@ LL | let mut c2 = || set(&mut *x); | ^^ - second borrow occurs due to use of `x` in closure | | | second closure is constructed here -LL | //~^ ERROR two closures require unique access to `x` at the same time +LL | LL | c2(); c1(); | -- first borrow later used here diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr index d3d11e8451cf..07f477d17868 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr @@ -5,7 +5,7 @@ LL | let c1 = to_fn_mut(|| x = 4); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| x = 5); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -19,7 +19,7 @@ LL | let c1 = to_fn_mut(|| set(&mut x)); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -33,7 +33,7 @@ LL | let c1 = to_fn_mut(|| x = 5); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -51,7 +51,7 @@ LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nes | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `x` as mutable more than once +LL | LL | c1; | -- first borrow later used here @@ -66,7 +66,7 @@ LL | let c2 = to_fn_mut(|| set(&mut *x.f)); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `x` as mutable more than once +LL | LL | c1; | -- first borrow later used here diff --git a/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr index 80e042fc8fc4..b8bbb31a3550 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as i | LL | let p = &this.x; | ------- immutable borrow occurs here -LL | &mut this.x; //~ ERROR cannot borrow +LL | &mut this.x; | ^^^^^^^^^^^ mutable borrow occurs here LL | p.use_ref(); | - immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr index d6082734451f..3106f36ac8ba 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr @@ -5,7 +5,7 @@ LL | let c1 = || get(x); | -- - first borrow occurs due to use of `x` in closure | | | borrow occurs here -LL | let c2 = || set(x); //~ ERROR closure requires unique access to `x` +LL | let c2 = || set(x); | ^^ - second borrow occurs due to use of `x` in closure | | | closure construction occurs here @@ -19,7 +19,7 @@ LL | let c1 = || get(x); | -- - first borrow occurs due to use of `x` in closure | | | borrow occurs here -LL | let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x` +LL | let c2 = || { get(x); set(x); }; | ^^ - second borrow occurs due to use of `x` in closure | | | closure construction occurs here @@ -33,7 +33,7 @@ LL | let c1 = || set(x); | -- - first borrow occurs due to use of `x` in closure | | | first closure is constructed here -LL | let c2 = || set(x); //~ ERROR two closures require unique access to `x` at the same time +LL | let c2 = || set(x); | ^^ - second borrow occurs due to use of `x` in closure | | | second closure is constructed here @@ -45,7 +45,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable | LL | fn e(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` -LL | let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument +LL | let c1 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error: aborting due to 4 previous errors diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr b/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr index 4501e28a1881..a6dbcf36077a 100644 --- a/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr @@ -6,7 +6,7 @@ LL | let mut test = |foo: &Foo| { LL | ptr = box Foo { x: ptr.x + 1 }; | --- first borrow occurs due to use of `ptr` in closure LL | }; -LL | test(&*ptr); //~ ERROR cannot borrow `*ptr` +LL | test(&*ptr); | ---- ^^^^^ immutable borrow occurs here | | | mutable borrow later used by call diff --git a/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr b/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr index ea7683a91adf..c69237fa95f6 100644 --- a/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr +++ b/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr @@ -5,7 +5,7 @@ LL | fn foo(b: Box<[i32;5]>) { | - move occurs because `b` has type `std::boxed::Box<[i32; 5]>`, which does not implement the `Copy` trait LL | consume(b); | - value moved here -LL | consume(b); //~ ERROR use of moved value +LL | consume(b); | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr b/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr index 15cf359326be..e8194ad69440 100644 --- a/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr +++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr @@ -5,7 +5,7 @@ LL | fn foo(b: Box) { | - move occurs because `b` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | consume(b); | - value moved here -LL | consume(b); //~ ERROR use of moved value +LL | consume(b); | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr b/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr index 25a9a1120443..b3451659bec5 100644 --- a/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr +++ b/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` +LL | drop(*x.b); | ^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x.b` | LL | let y = A { a: 3, .. x }; | ---------------- value moved here -LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` +LL | drop(*x.b); | ^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -23,7 +23,7 @@ error[E0382]: borrow of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | let p = &x.b; //~ ERROR use of moved value: `x.b` +LL | let p = &x.b; | ^^^^ value borrowed here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -33,7 +33,7 @@ error[E0382]: borrow of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | ---------------- value moved here -LL | let p = &x.b; //~ ERROR use of moved value: `x.b` +LL | let p = &x.b; | ^^^^ value borrowed here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -43,7 +43,7 @@ error[E0505]: cannot move out of `x.b` because it is borrowed | LL | let p = &x.b; | ---- borrow of `x.b` occurs here -LL | drop(x.b); //~ ERROR cannot move out of `x.b` because it is borrowed +LL | drop(x.b); | ^^^ move out of `x.b` occurs here LL | drop(**p); | --- borrow later used here @@ -53,7 +53,7 @@ error[E0505]: cannot move out of `x.b` because it is borrowed | LL | let p = &x.b; | ---- borrow of `x.b` occurs here -LL | let _y = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` because it is borrowed +LL | let _y = A { a: 3, .. x }; | ^^^^^^^^^^^^^^^^ move out of `x.b` occurs here LL | drop(**p); | --- borrow later used here @@ -63,7 +63,7 @@ error[E0499]: cannot borrow `x.a` as mutable more than once at a time | LL | let p = &mut x.a; | -------- first mutable borrow occurs here -LL | let q = &mut x.a; //~ ERROR cannot borrow `x.a` as mutable more than once at a time +LL | let q = &mut x.a; | ^^^^^^^^ second mutable borrow occurs here LL | drop(*p); | -- first borrow later used here @@ -73,7 +73,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | drop(x.b); //~ ERROR use of moved value: `x.b` +LL | drop(x.b); | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -83,7 +83,7 @@ error[E0382]: use of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | ---------------- value moved here -LL | drop(x.b); //~ ERROR use of moved value: `x.b` +LL | drop(x.b); | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -93,7 +93,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | let _z = A { a: 3, .. x }; //~ ERROR use of moved value: `x.b` +LL | let _z = A { a: 3, .. x }; | ^^^^^^^^^^^^^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -103,7 +103,7 @@ error[E0382]: use of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | ---------------- value moved here -LL | let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b` +LL | let _z = A { a: 4, .. x }; | ^^^^^^^^^^^^^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr index 7d8618e16d97..d48866dce042 100644 --- a/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr +++ b/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr @@ -1,7 +1,7 @@ error[E0713]: borrow may still be in use when destructor runs --> $DIR/borrowck-fn-in-const-c.rs:17:16 | -LL | return &local.inner; //~ ERROR does not live long enough +LL | return &local.inner; | ^^^^^^^^^^^^ returning this value requires that `local.inner` is borrowed for `'static` LL | } | - here, drop of `local` needs exclusive access to `local.inner`, because the type `DropString` implements the `Drop` trait diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr index 8ba6a07b3d2d..08cafa7da7aa 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:15 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | -- ^^^^^^^^ cannot move out of borrowed content | || | |data moved here @@ -10,13 +10,13 @@ LL | for &a in x.iter() { //~ ERROR cannot move out note: move occurs because `a` has type `&mut i32`, which does not implement the `Copy` trait --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:10 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | ^ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:15 | -LL | for &a in &f.a { //~ ERROR cannot move out +LL | for &a in &f.a { | -- ^^^^ cannot move out of borrowed content | || | |data moved here @@ -25,13 +25,13 @@ LL | for &a in &f.a { //~ ERROR cannot move out note: move occurs because `a` has type `std::boxed::Box`, which does not implement the `Copy` trait --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:10 | -LL | for &a in &f.a { //~ ERROR cannot move out +LL | for &a in &f.a { | ^ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | -- ^^^^^^^^ cannot move out of borrowed content | || | |data moved here @@ -40,7 +40,7 @@ LL | for &a in x.iter() { //~ ERROR cannot move out note: move occurs because `a` has type `std::boxed::Box`, which does not implement the `Copy` trait --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr index 32ca24ba6ec4..f47dce453696 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr @@ -7,7 +7,7 @@ LL | for &x in &vector { | immutable borrow occurs here | immutable borrow later used here LL | let cap = vector.capacity(); -LL | vector.extend(repeat(0)); //~ ERROR cannot borrow +LL | vector.extend(repeat(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable @@ -19,7 +19,7 @@ LL | for &x in &vector { | immutable borrow occurs here | immutable borrow later used here ... -LL | vector[1] = 5; //~ ERROR cannot borrow +LL | vector[1] = 5; | ^^^^^^ mutable borrow occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-in-static.nll.stderr b/src/test/ui/borrowck/borrowck-in-static.nll.stderr index ff094ecf7074..da639a837aa5 100644 --- a/src/test/ui/borrowck/borrowck-in-static.nll.stderr +++ b/src/test/ui/borrowck/borrowck-in-static.nll.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable +LL | Box::new(|| x) | ^ cannot move out of captured variable in an `Fn` closure error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr b/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr index b99d5e813c7c..b004447bf45f 100644 --- a/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr +++ b/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr @@ -5,7 +5,7 @@ LL | f.foo( | ^ --- first borrow later used by call | ___| | | -LL | | |a| { //~ ERROR closure requires unique access to `f` +LL | | |a| { | | --- closure construction occurs here LL | | f.n.insert(*a); | | - first borrow occurs due to use of `f` in closure @@ -19,7 +19,7 @@ LL | f.foo( | - --- first borrow later used by call | | | borrow occurs here -LL | |a| { //~ ERROR closure requires unique access to `f` +LL | |a| { | ^^^ closure construction occurs here LL | f.n.insert(*a); | - second borrow occurs due to use of `f` in closure diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr index 3da8d8f8c475..4ea4eb8f0075 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | Some(ref _y) => { | ------ borrow of `x.0` occurs here -LL | let _a = x; //~ ERROR cannot move +LL | let _a = x; | ^ move out of `x` occurs here LL | _y.use_ref(); | -- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr index 061c458f73e5..4ef36df52df5 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-issue-2657-2.rs:7:18 | -LL | let _b = *y; //~ ERROR cannot move out +LL | let _b = *y; | ^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr index 0c99edeb1a45..68a82bdb57c5 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `*v` as mutable because it is also borrowed as immut LL | _w = &v; | -- immutable borrow occurs here LL | } -LL | borrow_mut(&mut *v); //~ ERROR cannot borrow +LL | borrow_mut(&mut *v); | ^^^^^^^ mutable borrow occurs here LL | _w.use_ref(); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr index ae3313597a3e..07b11b3e7282 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*v` as mutable because it is also borrowed as immut | LL | let _w = &v; | -- immutable borrow occurs here -LL | borrow_mut(&mut *v); //~ ERROR cannot borrow +LL | borrow_mut(&mut *v); | ^^^^^^^ mutable borrow occurs here LL | _w.use_ref(); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr index 450102f0c662..615660febbce 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `v` because it is borrowed | LL | let w = &v; | -- borrow of `v` occurs here -LL | take(v); //~ ERROR cannot move out of `v` because it is borrowed +LL | take(v); | ^ move out of `v` occurs here LL | w.use_ref(); | - borrow later used here diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr index 281a8103f977..1d1522a15b1e 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr @@ -5,7 +5,7 @@ LL | borrow(&*v, | ------ --- immutable borrow occurs here | | | immutable borrow later used by call -LL | |w| { //~ ERROR cannot borrow `v` as mutable +LL | |w| { | ^^^ mutable borrow occurs here LL | v = box 4; | - second borrow occurs due to use of `v` in closure diff --git a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr index 698457589030..6994c837dfcb 100644 --- a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr @@ -6,7 +6,7 @@ LL | let alias: &'static mut String = s; | | | type annotation requires that `*s` is borrowed for `'static` ... -LL | *s = String::new(); //~ ERROR cannot assign +LL | *s = String::new(); | ^^ assignment to borrowed `*s` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr index 421af61ff78c..ad74a89f6689 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr @@ -4,7 +4,7 @@ error[E0503]: cannot use `p` because it was mutably borrowed LL | let q = &mut p; | ------ borrow of `p` occurs here LL | -LL | p + 3; //~ ERROR cannot use `p` +LL | p + 3; | ^ use of borrowed `p` ... LL | *q + 3; // OK to use the new alias `q` @@ -16,7 +16,7 @@ error[E0502]: cannot borrow `p` as immutable because it is also borrowed as muta LL | let q = &mut p; | ------ mutable borrow occurs here ... -LL | p.times(3); //~ ERROR cannot borrow `p` +LL | p.times(3); | ^ immutable borrow occurs here LL | LL | *q + 3; // OK to use the new alias `q` diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr index bded4d1e0a3b..ec3edc80323f 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr @@ -1,7 +1,7 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable --> $DIR/borrowck-loan-rcvr.rs:23:14 | -LL | p.blockm(|| { //~ ERROR cannot borrow `p` as mutable +LL | p.blockm(|| { | - ------ ^^ mutable borrow occurs here | | | | | immutable borrow later used by call @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `p` as immutable because it is also borrowed as muta | LL | let l = &mut p; | ------ mutable borrow occurs here -LL | p.impurem(); //~ ERROR cannot borrow +LL | p.impurem(); | ^ immutable borrow occurs here LL | LL | l.x += 1; diff --git a/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr b/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr index be48f217ef19..6691a2396a1d 100644 --- a/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr @@ -5,7 +5,7 @@ LL | takes_imm_elt( | ------------- immutable borrow later used by call LL | &v[0], | - immutable borrow occurs here -LL | || { //~ ERROR cannot borrow `v` as mutable +LL | || { | ^^ mutable borrow occurs here LL | v[1] = 4; | - second borrow occurs due to use of `v` in closure diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr b/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr index b8a011744177..38f6ca7be752 100644 --- a/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of captured variable in an `FnMut` closure LL | let bar: Box<_> = box 3; | --- captured outer variable LL | let _g = to_fn_mut(|| { -LL | let _h = to_fn_once(move || -> isize { *bar }); //~ ERROR cannot move out of +LL | let _h = to_fn_once(move || -> isize { *bar }); | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of captured variable in an `FnMut` closure error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr index 9386278886f6..25eb8d0134c3 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr @@ -1,12 +1,12 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-error-with-note.rs:11:11 | -LL | match *f { //~ ERROR cannot move out of +LL | match *f { | ^^ | | | cannot move out of borrowed content | help: consider removing the `*`: `f` -LL | //~| cannot move out +LL | LL | Foo::Foo1(num1, | ---- data moved here LL | num2) => (), @@ -46,12 +46,12 @@ LL | g: _t error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-error-with-note.rs:47:11 | -LL | match a.a { //~ ERROR cannot move out of +LL | match a.a { | ^^^ | | | cannot move out of borrowed content | help: consider borrowing here: `&a.a` -LL | //~| cannot move out +LL | LL | n => { | - data moved here | diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr index b7fa2247e32f..e4840fba6729 100644 --- a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr @@ -4,7 +4,7 @@ error[E0505]: cannot move out of `*a` because it is borrowed LL | let b = &a; | -- borrow of `a` occurs here LL | -LL | let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed +LL | let z = *a; | ^^ move out of `*a` occurs here LL | b.use_ref(); | - borrow later used here diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr index 5b7846579536..615e3fd18001 100644 --- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of dereference of raw pointer --> $DIR/borrowck-move-from-unsafe-ptr.rs:2:13 | -LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer +LL | let y = *x; | ^^ | | | cannot move out of dereference of raw pointer diff --git a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr index ce6433d5a527..77f5b72e51c5 100644 --- a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `t0` because it is borrowed | LL | let p: &isize = &*t0; // Freezes `*t0` | ---- borrow of `*t0` occurs here -LL | let t1 = t0; //~ ERROR cannot move out of `t0` +LL | let t1 = t0; | ^^ move out of `t0` occurs here LL | *t1 = 22; LL | p.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr index 9aaeefd4cfc3..51caf60da6e0 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr @@ -20,9 +20,9 @@ LL | Foo { string: b }] => { help: consider removing the `&` | LL | [Foo { string: a }, -LL | //~^ ERROR cannot move out of type `[Foo]` -LL | //~| cannot move out -LL | //~| to prevent move +LL | +LL | +LL | LL | Foo { string: b }] => { | diff --git a/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr b/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr index 3bb5351f97ba..8c9083fcf135 100644 --- a/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a.x` because it is borrowed | LL | let pb = &a; | -- borrow of `a` occurs here -LL | let S { x: ax } = a; //~ ERROR cannot move out +LL | let S { x: ax } = a; | ^^ move out of `a.x` occurs here LL | f(pb); | -- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr b/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr index d0065a2e7dc3..32c7067acc89 100644 --- a/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr +++ b/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr @@ -6,7 +6,7 @@ LL | let p1 = &x1; ... LL | thread::spawn(move|| { | ^^^^^^ move out of `x1` occurs here -LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed +LL | drop(x1); | -- move occurs due to use in closure ... LL | borrow(&*p1); @@ -19,8 +19,8 @@ LL | let p2 = &x2; | --- borrow of `x2` occurs here LL | thread::spawn(move|| { | ^^^^^^ move out of `x2` occurs here -LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed -LL | drop(x2); //~ ERROR cannot move `x2` into closure because it is borrowed +LL | drop(x1); +LL | drop(x2); | -- move occurs due to use in closure ... LL | borrow(&*p2); @@ -36,7 +36,7 @@ LL | drop(x1); ... LL | thread::spawn(move|| { | ^^^^^^ value used here after move -LL | drop(x1); //~ ERROR capture of moved value: `x1` +LL | drop(x1); | -- use occurs due to use in closure error[E0382]: use of moved value: `x2` @@ -48,16 +48,16 @@ LL | drop(x2); | -- value moved here LL | thread::spawn(move|| { | ^^^^^^ value used here after move -LL | drop(x1); //~ ERROR capture of moved value: `x1` -LL | drop(x2); //~ ERROR capture of moved value: `x2` +LL | drop(x1); +LL | drop(x2); | -- use occurs due to use in closure error[E0382]: use of moved value: `x` --> $DIR/borrowck-multiple-captures.rs:36:14 | -LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed +LL | drop(x); | - value moved here -LL | drop(x); //~ ERROR use of moved value: `x` +LL | drop(x); | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -69,7 +69,7 @@ LL | let p = &x; | -- borrow of `x` occurs here LL | thread::spawn(move|| { | ^^^^^^ move out of `x` occurs here -LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed +LL | drop(x); | - move occurs due to use in closure ... LL | borrow(&*p); @@ -78,9 +78,9 @@ LL | borrow(&*p); error[E0382]: use of moved value: `x` --> $DIR/borrowck-multiple-captures.rs:46:14 | -LL | drop(x); //~ ERROR capture of moved value: `x` +LL | drop(x); | - value moved here -LL | drop(x); //~ ERROR use of moved value: `x` +LL | drop(x); | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -94,7 +94,7 @@ LL | drop(x); | - value moved here LL | thread::spawn(move|| { | ^^^^^^ value used here after move -LL | drop(x); //~ ERROR capture of moved value: `x` +LL | drop(x); | - use occurs due to use in closure error: aborting due to 8 previous errors diff --git a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr index be69be634117..d58548f22049 100644 --- a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | let x: isize = 3; | - help: consider changing this to be mutable: `mut x` -LL | let y: &mut isize = &mut x; //~ ERROR cannot borrow +LL | let y: &mut isize = &mut x; | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr index 666ccf35a7c9..925930acf865 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immut | LL | let p: &isize = &*t0; // Freezes `*t0` | ---- immutable borrow occurs here -LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` +LL | let mut t2 = &mut t0; | ^^^^^^^ mutable borrow occurs here LL | **t2 += 1; // Mutates `*t0` LL | p.use_ref(); @@ -14,7 +14,7 @@ error[E0499]: cannot borrow `t0` as mutable more than once at a time | LL | let p: &mut isize = &mut *t0; // Claims `*t0` | -------- first mutable borrow occurs here -LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` +LL | let mut t2 = &mut t0; | ^^^^^^^ second mutable borrow occurs here LL | **t2 += 1; // Mutates `*t0` but not through `*p` LL | p.use_mut(); diff --git a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr index 5a9ec98a2db0..8e7ffdc6819a 100644 --- a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable | LL | let v = vec![1, 2, 3]; | - help: consider changing this to be mutable: `mut v` -LL | write(&mut v); //~ ERROR cannot borrow +LL | write(&mut v); | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr index b106708352ef..3462b7610d38 100644 --- a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr +++ b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | Cycle::Node(ref mut y) => { | --------- borrow of `x.0` occurs here -LL | y.a = x; //~ ERROR cannot move out of +LL | y.a = x; | --- ^ move out of `x` occurs here | | | borrow later used here diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr index ff0cc9332325..cf94c74dec22 100644 --- a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr +++ b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immut | LL | let y = x.borrowed(); | - immutable borrow occurs here -LL | let z = x.mut_borrowed(); //~ ERROR cannot borrow +LL | let z = x.mut_borrowed(); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | y.use_ref(); | - immutable borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta | LL | let y = x.borrowed(); | - immutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | let z = &mut x; | ^^^^^^ mutable borrow occurs here LL | y.use_ref(); | - immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-or-init.nll.stderr b/src/test/ui/borrowck/borrowck-or-init.nll.stderr index dcd2c18dcaa2..122f5192720c 100644 --- a/src/test/ui/borrowck/borrowck-or-init.nll.stderr +++ b/src/test/ui/borrowck/borrowck-or-init.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `i` --> $DIR/borrowck-or-init.rs:5:20 | -LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` +LL | println!("{}", i); | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr index c5a4c4e005aa..b7fcaa645af2 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `s` as immutable because it is also borrowed as muta | LL | let sp = &mut s; | ------ mutable borrow occurs here -LL | s(3); //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable +LL | s(3); | ^ immutable borrow occurs here LL | use_mut(sp); | -- mutable borrow later used here @@ -14,7 +14,7 @@ error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable LL | let s = SFnMut { | - help: consider changing this to be mutable: `mut s` ... -LL | s(3); //~ ERROR cannot borrow immutable local variable `s` as mutable +LL | s(3); | ^ cannot borrow as mutable error[E0382]: use of moved value: `s` @@ -25,7 +25,7 @@ LL | let s = SFnOnce { ... LL | s(" world".to_string()); | - value moved here -LL | s(" world".to_string()); //~ ERROR use of moved value: `s` +LL | s(" world".to_string()); | ^ value used here after move error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr index 13ace0178f89..5f34749ca89e 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*f` as immutable because it is also borrowed as mut | LL | let p = &mut f[&s]; | - mutable borrow occurs here -LL | let q = &f[&s]; //~ ERROR cannot borrow +LL | let q = &f[&s]; | ^ immutable borrow occurs here LL | p.use_mut(); | - mutable borrow later used here @@ -13,7 +13,7 @@ error[E0499]: cannot borrow `*f` as mutable more than once at a time | LL | let p = &mut f[&s]; | - first mutable borrow occurs here -LL | let q = &mut f[&s]; //~ ERROR cannot borrow +LL | let q = &mut f[&s]; | ^ second mutable borrow occurs here LL | p.use_mut(); | - first borrow later used here @@ -23,7 +23,7 @@ error[E0499]: cannot borrow `f.foo` as mutable more than once at a time | LL | let p = &mut f.foo[&s]; | ----- first mutable borrow occurs here -LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow +LL | let q = &mut f.foo[&s]; | ^^^^^ second mutable borrow occurs here LL | p.use_mut(); | - first borrow later used here @@ -33,7 +33,7 @@ error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as im | LL | let p = &f.foo[&s]; | ----- immutable borrow occurs here -LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow +LL | let q = &mut f.foo[&s]; | ^^^^^ mutable borrow occurs here LL | p.use_ref(); | - immutable borrow later used here @@ -43,7 +43,7 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed | LL | let p = &f.foo[&s]; | ----- borrow of `f.foo` occurs here -LL | f.foo = g; //~ ERROR cannot assign +LL | f.foo = g; | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here LL | p.use_ref(); | - borrow later used here @@ -53,7 +53,7 @@ error[E0506]: cannot assign to `*f` because it is borrowed | LL | let p = &f.foo[&s]; | ----- borrow of `*f` occurs here -LL | *f = g; //~ ERROR cannot assign +LL | *f = g; | ^^^^^^ assignment to borrowed `*f` occurs here LL | p.use_ref(); | - borrow later used here @@ -63,7 +63,7 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed | LL | let p = &mut f.foo[&s]; | ----- borrow of `f.foo` occurs here -LL | f.foo = g; //~ ERROR cannot assign +LL | f.foo = g; | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here LL | p.use_mut(); | - borrow later used here @@ -73,7 +73,7 @@ error[E0506]: cannot assign to `*f` because it is borrowed | LL | let p = &mut f.foo[&s]; | ----- borrow of `*f` occurs here -LL | *f = g; //~ ERROR cannot assign +LL | *f = g; | ^^^^^^ assignment to borrowed `*f` occurs here LL | p.use_mut(); | - borrow later used here diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr index 6b41b6f9c4fd..21bc8bb06cc0 100644 --- a/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr +++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | use_mut(_bar1); | ----- first borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let _bar1 = &mut foo.bar1; | ------------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here LL | use_mut(_bar1); | ----- mutable borrow later used here @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let _bar1 = &foo.bar1; | --------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | use_imm(_bar1); | ----- immutable borrow later used here @@ -45,9 +45,9 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo2 = &*foo; LL | use_mut(_bar1); | ----- mutable borrow later used here @@ -56,8 +56,8 @@ error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as m | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &*foo; | ^^^^^ immutable borrow occurs here LL | use_mut(_bar1); | ----- mutable borrow later used here @@ -67,7 +67,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | use_mut(_bar1); | ----- first borrow later used here @@ -77,7 +77,7 @@ error[E0499]: cannot borrow `*foo` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^^^^^^ second mutable borrow occurs here LL | use_mut(_bar1); | ----- first borrow later used here @@ -87,7 +87,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let _bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | use_imm(_bar1); | ----- immutable borrow later used here @@ -97,7 +97,7 @@ error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as imm | LL | let _bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^^^^^^ mutable borrow occurs here LL | use_imm(_bar1); | ----- immutable borrow later used here @@ -107,7 +107,7 @@ error[E0596]: cannot borrow `foo.bar1` as mutable, as it is behind a `&` referen | LL | fn borrow_mut_from_imm(foo: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut Foo` -LL | let _bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar1 = &mut foo.bar1; | ^^^^^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 11 previous errors diff --git a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr index 67948ad38792..e744fc6b54b1 100644 --- a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr +++ b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable LL | fn destructure(x: Option) -> isize { | - help: consider changing this to be mutable: `mut x` ... -LL | Some(ref mut v) => *v //~ ERROR cannot borrow +LL | Some(ref mut v) => *v | ^^^^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr index 7b026ee99511..ee8f90edcd3f 100644 --- a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr +++ b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr @@ -3,8 +3,8 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let y = &mut x; | ------ mutable borrow occurs here -LL | //~^ mutable borrow occurs here -LL | let z = &x; //~ ERROR cannot borrow +LL | +LL | let z = &x; | ^^ immutable borrow occurs here ... LL | y.use_mut(); @@ -15,8 +15,8 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta | LL | let y = &x; | -- immutable borrow occurs here -LL | //~^ immutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | +LL | let z = &mut x; | ^^^^^^ mutable borrow occurs here ... LL | y.use_ref(); @@ -27,8 +27,8 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | ------ first mutable borrow occurs here -LL | //~^ first mutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | +LL | let z = &mut x; | ^^^^^^ second mutable borrow occurs here ... LL | y.use_mut(); diff --git a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr index 65f910de4c3b..d54449ac4ad4 100644 --- a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr +++ b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing function parameter `x` --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:7:5 | -LL | (&x).clone() //~ ERROR `x` does not live long enough +LL | (&x).clone() | ----^^^^^^^^ | | | returns a value referencing data owned by the current function diff --git a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr index 8fdd5ef4ca6b..1c55953c91fb 100644 --- a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immut | LL | let p: &isize = &*t0; // Freezes `*t0` | ---- immutable borrow occurs here -LL | swap(&mut t0, &mut t1); //~ ERROR cannot borrow `t0` +LL | swap(&mut t0, &mut t1); | ^^^^^^^ mutable borrow occurs here LL | *t1 = 22; LL | p.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr index 363a5a69a07e..ec1cf4a4e2b0 100644 --- a/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr +++ b/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `f` as immutable because it is also borrowed as muta | LL | let g = &mut f; | ------ mutable borrow occurs here -LL | f(1, 2); //~ ERROR cannot borrow `f` as immutable +LL | f(1, 2); | ^ immutable borrow occurs here LL | use_mut(g); | - mutable borrow later used here @@ -13,7 +13,7 @@ error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable | LL | fn b isize>(f: F) { | - help: consider changing this to be mutable: `mut f` -LL | f(1, 2); //~ ERROR cannot borrow immutable argument +LL | f(1, 2); | ^ cannot borrow as mutable error[E0382]: use of moved value: `f` @@ -25,7 +25,7 @@ LL | fn c isize>(f: F) { | consider adding a `Copy` constraint to this type argument LL | f(1, 2); | - value moved here -LL | f(1, 2); //~ ERROR use of moved value +LL | f(1, 2); | ^ value used here after move error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr b/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr index 6bb6fc4cf29a..61569b9cac10 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `u.c` because it was mutably borrowed | LL | let ra = &mut u.s.a; | ---------- borrow of `u.s.a` occurs here -LL | let b = u.c; //~ ERROR cannot use `u.c` because it was mutably borrowed +LL | let b = u.c; | ^^^ use of borrowed `u.s.a` LL | ra.use_mut(); | -- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr b/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr index 5cba30b43b8a..518f062ba1af 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immu | LL | let ra = &u.a; | ---- immutable borrow occurs here -LL | let rma = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable +LL | let rma = &mut u.a; | ^^^^^^^^ mutable borrow occurs here LL | drop(ra); | -- immutable borrow later used here @@ -13,7 +13,7 @@ error[E0506]: cannot assign to `u.a` because it is borrowed | LL | let ra = &u.a; | ---- borrow of `u.a` occurs here -LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed +LL | u.a = 1; | ^^^^^^^ assignment to borrowed `u.a` occurs here LL | drop(ra); | -- borrow later used here @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `u` (via `u.b`) as mutable because it is also borrow | LL | let ra = &u.a; | ---- immutable borrow occurs here (via `u.a`) -LL | let rmb = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) +LL | let rmb = &mut u.b; | ^^^^^^^^ mutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here LL | drop(ra); | -- immutable borrow later used here @@ -35,7 +35,7 @@ error[E0506]: cannot assign to `u.b` because it is borrowed | LL | let ra = &u.a; | ---- borrow of `u.b` occurs here -LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed +LL | u.b = 1; | ^^^^^^^ assignment to borrowed `u.b` occurs here LL | drop(ra); | -- borrow later used here @@ -45,7 +45,7 @@ error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mu | LL | let rma = &mut u.a; | -------- mutable borrow occurs here -LL | let ra = &u.a; //~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable +LL | let ra = &u.a; | ^^^^ immutable borrow occurs here LL | drop(rma); | --- mutable borrow later used here @@ -55,7 +55,7 @@ error[E0503]: cannot use `u.a` because it was mutably borrowed | LL | let ra = &mut u.a; | -------- borrow of `u.a` occurs here -LL | let a = u.a; //~ ERROR cannot use `u.a` because it was mutably borrowed +LL | let a = u.a; | ^^^ use of borrowed `u.a` LL | drop(ra); | -- borrow later used here @@ -65,7 +65,7 @@ error[E0499]: cannot borrow `u.a` as mutable more than once at a time | LL | let rma = &mut u.a; | -------- first mutable borrow occurs here -LL | let rma2 = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable more than once at a time +LL | let rma2 = &mut u.a; | ^^^^^^^^ second mutable borrow occurs here LL | drop(rma); | --- first borrow later used here @@ -75,7 +75,7 @@ error[E0506]: cannot assign to `u.a` because it is borrowed | LL | let rma = &mut u.a; | -------- borrow of `u.a` occurs here -LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed +LL | u.a = 1; | ^^^^^^^ assignment to borrowed `u.a` occurs here LL | drop(rma); | --- borrow later used here @@ -85,7 +85,7 @@ error[E0502]: cannot borrow `u` (via `u.b`) as immutable because it is also borr | LL | let rma = &mut u.a; | -------- mutable borrow occurs here (via `u.a`) -LL | let rb = &u.b; //~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) +LL | let rb = &u.b; | ^^^^ immutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here LL | drop(rma); | --- mutable borrow later used here @@ -97,7 +97,7 @@ error[E0503]: cannot use `u.b` because it was mutably borrowed | LL | let ra = &mut u.a; | -------- borrow of `u.a` occurs here -LL | let b = u.b; //~ ERROR cannot use `u.b` because it was mutably borrowed +LL | let b = u.b; | ^^^ use of borrowed `u.a` LL | LL | drop(ra); @@ -108,7 +108,7 @@ error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time | LL | let rma = &mut u.a; | -------- first mutable borrow occurs here (via `u.a`) -LL | let rmb2 = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time +LL | let rmb2 = &mut u.b; | ^^^^^^^^ second mutable borrow occurs here (via `u.b`) LL | drop(rma); | --- first borrow later used here @@ -120,7 +120,7 @@ error[E0506]: cannot assign to `u.b` because it is borrowed | LL | let rma = &mut u.a; | -------- borrow of `u.b` occurs here -LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed +LL | u.b = 1; | ^^^^^^^ assignment to borrowed `u.b` occurs here LL | drop(rma); | --- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr b/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr index e59fef2dc0d2..0b1714fd75dc 100644 --- a/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr @@ -5,7 +5,7 @@ LL | let mut u = U { a: A }; | ----- move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = u.a; | --- value moved here -LL | let a = u.a; //~ ERROR use of moved value: `u.a` +LL | let a = u.a; | ^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-union-move.nll.stderr b/src/test/ui/borrowck/borrowck-union-move.nll.stderr index 1392a7931c30..abbb0142a9c3 100644 --- a/src/test/ui/borrowck/borrowck-union-move.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-move.nll.stderr @@ -5,7 +5,7 @@ LL | let mut u = Unn { n1: NonCopy }; | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait LL | let a = u.n1; | ---- value moved here -LL | let a = u.n1; //~ ERROR use of moved value: `u.n1` +LL | let a = u.n1; | ^^^^ value used here after move error[E0382]: use of moved value: `u` @@ -15,7 +15,7 @@ LL | let mut u = Unn { n1: NonCopy }; | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait LL | let a = u.n1; | ---- value moved here -LL | let a = u; //~ ERROR use of partially moved value: `u` +LL | let a = u; | ^ value used here after move error[E0382]: use of moved value: `u` @@ -25,7 +25,7 @@ LL | let mut u = Unn { n1: NonCopy }; | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait LL | let a = u.n1; | ---- value moved here -LL | let a = u.n2; //~ ERROR use of moved value: `u.n2` +LL | let a = u.n2; | ^^^^ value used here after move error[E0382]: use of moved value: `u` @@ -35,7 +35,7 @@ LL | let mut u = Ucn { c: Copy }; | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait LL | let a = u.n; | --- value moved here -LL | let a = u.n; //~ ERROR use of moved value: `u.n` +LL | let a = u.n; | ^^^ value used here after move error[E0382]: use of moved value: `u` @@ -45,7 +45,7 @@ LL | let mut u = Ucn { c: Copy }; | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait LL | let a = u.n; | --- value moved here -LL | let a = u.c; //~ ERROR use of moved value: `u.c` +LL | let a = u.c; | ^^^ value used here after move error[E0382]: use of moved value: `u` @@ -55,7 +55,7 @@ LL | let mut u = Ucn { c: Copy }; | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait LL | let a = u.n; | --- value moved here -LL | let a = u; //~ ERROR use of partially moved value: `u` +LL | let a = u; | ^ value used here after move error: aborting due to 6 previous errors diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr b/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr index 7ca277ac0742..923edc8edae7 100644 --- a/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr +++ b/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mut | LL | let w = &mut v; | ------ mutable borrow occurs here -LL | borrow(&*v); //~ ERROR cannot borrow `*v` +LL | borrow(&*v); | ^^^ immutable borrow occurs here LL | w.use_mut(); | - mutable borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mut | LL | x = &mut v; | ------ mutable borrow occurs here -LL | borrow(&*v); //~ ERROR cannot borrow `*v` +LL | borrow(&*v); | ^^^ immutable borrow occurs here LL | x.use_mut(); | - mutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr b/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr index e7b972fb0141..91d69c51e818 100644 --- a/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr +++ b/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed +LL | drop(x); | ^ use of borrowed `x` LL | *p = 2; | ------ borrow later used here @@ -13,7 +13,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let p = &mut x.a; | -------- borrow of `x.a` occurs here -LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed +LL | drop(x); | ^ use of borrowed `x.a` LL | *p = 3; | ------ borrow later used here @@ -23,7 +23,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | drop(x.a); | ^^^ use of borrowed `x` LL | p.a = 3; | ------- borrow later used here @@ -33,7 +33,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x.a; | -------- borrow of `x.a` occurs here -LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | drop(x.a); | ^^^ use of borrowed `x.a` LL | *p = 3; | ------ borrow later used here @@ -43,7 +43,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | let y = A { b: 3, .. x }; | ^^^^^^^^^^^^^^^^ use of borrowed `x` LL | drop(y); LL | p.a = 4; @@ -54,7 +54,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x.a; | -------- borrow of `x.a` occurs here -LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | let y = A { b: 3, .. x }; | ^^^^^^^^^^^^^^^^ use of borrowed `x.a` LL | drop(y); LL | *p = 4; @@ -65,7 +65,7 @@ error[E0503]: cannot use `*x` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | drop(*x); //~ ERROR cannot use `*x` because it was mutably borrowed +LL | drop(*x); | ^^ use of borrowed `x` LL | **p = 2; | ------- borrow later used here @@ -75,7 +75,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed +LL | drop(*x.b); | ^^^^ use of borrowed `x` LL | p.a = 3; | ------- borrow later used here @@ -85,7 +85,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed | LL | let p = &mut x.b; | -------- borrow of `x.b` occurs here -LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed +LL | drop(*x.b); | ^^^^ use of borrowed `x.b` LL | **p = 3; | ------- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr index eabd0731388d..da6d9293b408 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local variable `vec` --> $DIR/borrowck-vec-pattern-element-loan.rs:10:5 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here ... LL | tail @@ -10,7 +10,7 @@ LL | tail error[E0515]: cannot return value referencing local variable `vec` --> $DIR/borrowck-vec-pattern-element-loan.rs:20:5 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here ... LL | init @@ -19,7 +19,7 @@ LL | init error[E0515]: cannot return value referencing local variable `vec` --> $DIR/borrowck-vec-pattern-element-loan.rs:30:5 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here ... LL | slice diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr index 0059dd60f840..251f44592905 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time LL | let vb: &mut [isize] = &mut v; | ------ first mutable borrow occurs here ... -LL | v.push(tail[0] + tail[1]); //~ ERROR cannot borrow +LL | v.push(tail[0] + tail[1]); | ^ ------- first borrow later used here | | | second mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr index 018a3173af1b..aafcb3160d17 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr @@ -3,10 +3,10 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed | LL | [box ref _a, _, _] => { | ------ borrow of `vec[_]` occurs here -LL | //~^ borrow of `vec[..]` occurs here -LL | vec[0] = box 4; //~ ERROR cannot assign +LL | +LL | vec[0] = box 4; | ^^^^^^ assignment to borrowed `vec[_]` occurs here -LL | //~^ assignment to borrowed `vec[..]` occurs here +LL | LL | _a.use_ref(); | -- borrow later used here @@ -15,10 +15,10 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed | LL | &mut [ref _b..] => { | ------ borrow of `vec[_]` occurs here -LL | //~^ borrow of `vec[..]` occurs here -LL | vec[0] = box 4; //~ ERROR cannot assign +LL | +LL | vec[0] = box 4; | ^^^^^^ assignment to borrowed `vec[_]` occurs here -LL | //~^ assignment to borrowed `vec[..]` occurs here +LL | LL | _b.use_ref(); | -- borrow later used here @@ -27,19 +27,19 @@ error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy sli | LL | match vec { | ^^^ cannot move out of here -LL | &mut [_a, //~ ERROR cannot move out +LL | &mut [_a, | -- data moved here | note: move occurs because `_a` has type `std::boxed::Box`, which does not implement the `Copy` trait --> $DIR/borrowck-vec-pattern-nesting.rs:34:15 | -LL | &mut [_a, //~ ERROR cannot move out +LL | &mut [_a, | ^^ help: consider removing the `&mut` | -LL | [_a, //~ ERROR cannot move out -LL | //~| cannot move out -LL | //~| to prevent move +LL | [_a, +LL | +LL | LL | .. LL | ] => { | @@ -47,7 +47,7 @@ LL | ] => { error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:47:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here @@ -69,15 +69,15 @@ LL | _b] => {} | ^^ help: consider removing the `&mut` | -LL | [ //~ ERROR cannot move out -LL | //~^ cannot move out +LL | [ +LL | LL | _b] => {} | error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:60:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here @@ -88,7 +88,7 @@ error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy sli | LL | match vec { | ^^^ cannot move out of here -LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out +LL | &mut [_a, _b, _c] => {} | ----------------- | | | | | | | | | ...and here @@ -99,13 +99,13 @@ LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out note: move occurs because these variables have types that don't implement the `Copy` trait --> $DIR/borrowck-vec-pattern-nesting.rs:68:15 | -LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out +LL | &mut [_a, _b, _c] => {} | ^^ ^^ ^^ error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:72:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr index d9d3930dc49a..c1290a6f63f3 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local variable `vec` --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:10:5 | -LL | let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough +LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here ... LL | tail diff --git a/src/test/ui/borrowck/borrowck-while-break.nll.stderr b/src/test/ui/borrowck/borrowck-while-break.nll.stderr index 1defa3da60ce..0fe3cdc96a87 100644 --- a/src/test/ui/borrowck/borrowck-while-break.nll.stderr +++ b/src/test/ui/borrowck/borrowck-while-break.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `v` --> $DIR/borrowck-while-break.rs:7:20 | -LL | println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v` +LL | println!("{}", v); | ^ use of possibly uninitialized `v` error: aborting due to previous error diff --git a/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr b/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr index cd88e25cc42c..4b29beb02b35 100644 --- a/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr +++ b/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/index-mut-help-with-impl.rs:9:5 | -LL | Index::index(&v, 1..2).make_ascii_uppercase(); //~ ERROR +LL | Index::index(&v, 1..2).make_ascii_uppercase(); | ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content diff --git a/src/test/ui/borrowck/index-mut-help.nll.stderr b/src/test/ui/borrowck/index-mut-help.nll.stderr index e7047f0048db..92b94209c4e4 100644 --- a/src/test/ui/borrowck/index-mut-help.nll.stderr +++ b/src/test/ui/borrowck/index-mut-help.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/index-mut-help.rs:11:5 | -LL | map["peter"].clear(); //~ ERROR +LL | map["peter"].clear(); | ^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` @@ -9,13 +9,13 @@ LL | map["peter"].clear(); //~ ERROR error[E0594]: cannot assign to data in a `&` reference --> $DIR/index-mut-help.rs:12:5 | -LL | map["peter"] = "0".to_string(); //~ ERROR +LL | map["peter"] = "0".to_string(); | ^^^^^^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/index-mut-help.rs:13:13 | -LL | let _ = &mut map["peter"]; //~ ERROR +LL | let _ = &mut map["peter"]; | ^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` diff --git a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr index 255eb757a498..eb71ab0b7ec0 100644 --- a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr +++ b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of static item --> $DIR/issue-47215-ice-from-drop-elab.rs:17:21 | -LL | let mut x = X; //~ ERROR cannot move out of thread-local static item [E0507] +LL | let mut x = X; | ^ | | | cannot move out of static item diff --git a/src/test/ui/borrowck/issue-51117.nll.stderr b/src/test/ui/borrowck/issue-51117.nll.stderr index 140be098a99d..f8a9608ad373 100644 --- a/src/test/ui/borrowck/issue-51117.nll.stderr +++ b/src/test/ui/borrowck/issue-51117.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `*bar` as mutable more than once at a time | LL | Some(baz) => { | --- first mutable borrow occurs here -LL | bar.take(); //~ ERROR cannot borrow +LL | bar.take(); | ^^^ second mutable borrow occurs here LL | drop(baz); | --- first borrow later used here diff --git a/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr b/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr index ab05358d03f8..eda2f518f924 100644 --- a/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr +++ b/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time LL | impl<'a, T : 'a> FuncWrapper<'a, T> { | -- lifetime `'a` defined here ... -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ------------^^^- | | | | | mutable borrow starts here in previous iteration of loop @@ -16,7 +16,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time LL | impl<'a, T : 'a> FuncWrapper<'a, T> { | -- lifetime `'a` defined here ... -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ------------^^^- | | | | | mutable borrow starts here in previous iteration of loop @@ -28,7 +28,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time LL | impl<'a, T : 'a> FuncWrapper<'a, T> { | -- lifetime `'a` defined here ... -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ------------^^^- | | | | | mutable borrow starts here in previous iteration of loop diff --git a/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr b/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr index 5ee31b5efd09..09dabbc89b42 100644 --- a/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr +++ b/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable | LL | fn f(b: &mut i32) { | - help: consider changing this to be mutable: `mut b` -LL | g(&mut b) //~ ERROR cannot borrow +LL | g(&mut b) | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr b/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr index 9b20fc023193..4fcb693f1bf1 100644 --- a/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr +++ b/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `void` as mutable more than once at a time | LL | let first = &mut void; | --------- first mutable borrow occurs here -LL | let second = &mut void; //~ ERROR cannot borrow +LL | let second = &mut void; | ^^^^^^^^^ second mutable borrow occurs here LL | first.use_mut(); | ----- first borrow later used here @@ -13,7 +13,7 @@ error[E0499]: cannot borrow `inner_void` as mutable more than once at a time | LL | let inner_first = &mut inner_void; | --------------- first mutable borrow occurs here -LL | let inner_second = &mut inner_void; //~ ERROR cannot borrow +LL | let inner_second = &mut inner_void; | ^^^^^^^^^^^^^^^ second mutable borrow occurs here LL | inner_second.use_mut(); LL | inner_first.use_mut(); diff --git a/src/test/ui/borrowck/mutability-errors.nll.stderr b/src/test/ui/borrowck/mutability-errors.nll.stderr index 6dd3582f95f5..11bc78894432 100644 --- a/src/test/ui/borrowck/mutability-errors.nll.stderr +++ b/src/test/ui/borrowck/mutability-errors.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `*x` which is behind a `&` reference | LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` -LL | *x = (1,); //~ ERROR +LL | *x = (1,); | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `x.0` which is behind a `&` reference @@ -11,8 +11,8 @@ error[E0594]: cannot assign to `x.0` which is behind a `&` reference | LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` -LL | *x = (1,); //~ ERROR -LL | x.0 = 1; //~ ERROR +LL | *x = (1,); +LL | x.0 = 1; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -21,7 +21,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` ... -LL | &mut *x; //~ ERROR +LL | &mut *x; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference @@ -30,31 +30,31 @@ error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` ... -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0594]: cannot assign to data in a `&` reference --> $DIR/mutability-errors.rs:16:5 | -LL | *f() = (1,); //~ ERROR +LL | *f() = (1,); | ^^^^^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/mutability-errors.rs:17:5 | -LL | f().0 = 1; //~ ERROR +LL | f().0 = 1; | ^^^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/mutability-errors.rs:18:5 | -LL | &mut *f(); //~ ERROR +LL | &mut *f(); | ^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/mutability-errors.rs:19:5 | -LL | &mut f().0; //~ ERROR +LL | &mut f().0; | ^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `*x` which is behind a `*const` pointer @@ -62,7 +62,7 @@ error[E0594]: cannot assign to `*x` which is behind a `*const` pointer | LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` -LL | *x = (1,); //~ ERROR +LL | *x = (1,); | ^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written error[E0594]: cannot assign to `x.0` which is behind a `*const` pointer @@ -70,8 +70,8 @@ error[E0594]: cannot assign to `x.0` which is behind a `*const` pointer | LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` -LL | *x = (1,); //~ ERROR -LL | (*x).0 = 1; //~ ERROR +LL | *x = (1,); +LL | (*x).0 = 1; | ^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer @@ -80,7 +80,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` ... -LL | &mut *x; //~ ERROR +LL | &mut *x; | ^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer @@ -89,37 +89,37 @@ error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` ... -LL | &mut (*x).0; //~ ERROR +LL | &mut (*x).0; | ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable error[E0594]: cannot assign to data in a `*const` pointer --> $DIR/mutability-errors.rs:30:5 | -LL | *f() = (1,); //~ ERROR +LL | *f() = (1,); | ^^^^^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `*const` pointer --> $DIR/mutability-errors.rs:31:5 | -LL | (*f()).0 = 1; //~ ERROR +LL | (*f()).0 = 1; | ^^^^^^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `*const` pointer as mutable --> $DIR/mutability-errors.rs:32:5 | -LL | &mut *f(); //~ ERROR +LL | &mut *f(); | ^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `*const` pointer as mutable --> $DIR/mutability-errors.rs:33:5 | -LL | &mut (*f()).0; //~ ERROR +LL | &mut (*f()).0; | ^^^^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/mutability-errors.rs:40:9 | -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -127,17 +127,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables --> $DIR/mutability-errors.rs:41:9 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -145,17 +145,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/mutability-errors.rs:42:9 | -LL | &mut x; //~ ERROR +LL | &mut x; | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` @@ -163,17 +163,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables --> $DIR/mutability-errors.rs:43:9 | -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` @@ -181,17 +181,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/mutability-errors.rs:46:9 | -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -199,17 +199,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables --> $DIR/mutability-errors.rs:47:9 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -217,17 +217,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/mutability-errors.rs:48:9 | -LL | &mut x; //~ ERROR +LL | &mut x; | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` @@ -235,17 +235,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables --> $DIR/mutability-errors.rs:49:9 | -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` @@ -253,10 +253,10 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ @@ -265,7 +265,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn imm_local(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` -LL | &mut x; //~ ERROR +LL | &mut x; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable @@ -273,8 +273,8 @@ error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable | LL | fn imm_local(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` -LL | &mut x; //~ ERROR -LL | &mut x.0; //~ ERROR +LL | &mut x; +LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -282,7 +282,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable | LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` -LL | || { //~ ERROR +LL | || { LL | x = (1,); | ^^^^^^^^ cannot assign @@ -319,7 +319,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` ... -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable @@ -328,7 +328,7 @@ error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` ... -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -337,7 +337,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` ... -LL | &mut x; //~ ERROR +LL | &mut x; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable @@ -346,31 +346,31 @@ error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` ... -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable static item `X` --> $DIR/mutability-errors.rs:76:5 | -LL | X = (1,); //~ ERROR +LL | X = (1,); | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `X.0`, as `X` is an immutable static item --> $DIR/mutability-errors.rs:77:5 | -LL | X.0 = 1; //~ ERROR +LL | X.0 = 1; | ^^^^^^^ cannot assign error[E0596]: cannot borrow immutable static item `X` as mutable --> $DIR/mutability-errors.rs:78:5 | -LL | &mut X; //~ ERROR +LL | &mut X; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item --> $DIR/mutability-errors.rs:79:5 | -LL | &mut X.0; //~ ERROR +LL | &mut X.0; | ^^^^^^^^ cannot borrow as mutable error: aborting due to 38 previous errors diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr index 66e3c4056a22..60af41237354 100644 --- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr +++ b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing temporary value --> $DIR/promote-ref-mut-in-let-issue-46557.rs:6:5 | -LL | let ref mut x = 1234543; //~ ERROR +LL | let ref mut x = 1234543; | ------- temporary value created here LL | x | ^ returns a value referencing data owned by the current function @@ -9,7 +9,7 @@ LL | x error[E0515]: cannot return value referencing temporary value --> $DIR/promote-ref-mut-in-let-issue-46557.rs:11:5 | -LL | let (ref mut x, ) = (1234543, ); //~ ERROR +LL | let (ref mut x, ) = (1234543, ); | ----------- temporary value created here LL | x | ^ returns a value referencing data owned by the current function @@ -21,7 +21,7 @@ LL | match 1234543 { | ^ ------- temporary value created here | _____| | | -LL | | ref mut x => x //~ ERROR +LL | | ref mut x => x LL | | } | |_____^ returns a value referencing data owned by the current function @@ -32,14 +32,14 @@ LL | match (123443,) { | ^ --------- temporary value created here | _____| | | -LL | | (ref mut x,) => x, //~ ERROR +LL | | (ref mut x,) => x, LL | | } | |_____^ returns a value referencing data owned by the current function error[E0515]: cannot return reference to temporary value --> $DIR/promote-ref-mut-in-let-issue-46557.rs:27:5 | -LL | &mut 1234543 //~ ERROR +LL | &mut 1234543 | ^^^^^------- | | | | | temporary value created here diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr index bf9084259c83..d455a8f07874 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr @@ -1,13 +1,13 @@ error[E0381]: assign to part of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields.rs:7:5 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ use of possibly uninitialized `x` error[E0381]: assign to part of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields.rs:15:5 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ use of possibly uninitialized `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr index 53b51eb894ae..5f1313f286ee 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: assign to part of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields_overlapping.rs:12:5 | -LL | x.a = 1; //~ ERROR +LL | x.a = 1; | ^^^^^^^ use of possibly uninitialized `x` error[E0594]: cannot assign to `x.b`, as `x` is not declared as mutable @@ -9,8 +9,8 @@ error[E0594]: cannot assign to `x.b`, as `x` is not declared as mutable | LL | let x: Foo; | - help: consider changing this to be mutable: `mut x` -LL | x.a = 1; //~ ERROR -LL | x.b = 22; //~ ERROR +LL | x.a = 1; +LL | x.b = 22; | ^^^^^^^^ cannot assign error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr index 910b8292ec8f..553ee24cca23 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr @@ -4,13 +4,13 @@ error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable LL | let x: (u32, u32); | - help: consider changing this to be mutable: `mut x` LL | x = (22, 44); -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot assign error[E0381]: assign to part of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields_twice.rs:12:5 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ use of possibly uninitialized `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/by-move-pattern-binding.nll.stderr b/src/test/ui/by-move-pattern-binding.nll.stderr index 4b4a989368a7..8b531474553d 100644 --- a/src/test/ui/by-move-pattern-binding.nll.stderr +++ b/src/test/ui/by-move-pattern-binding.nll.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of borrowed content LL | match &s.x { | ^^^^ cannot move out of borrowed content LL | &E::Foo => {} -LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move +LL | &E::Bar(identifier) => f(identifier.clone()) | ------------------- | | | | | data moved here @@ -13,7 +13,7 @@ LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move note: move occurs because `identifier` has type `std::string::String`, which does not implement the `Copy` trait --> $DIR/by-move-pattern-binding.rs:16:17 | -LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move +LL | &E::Bar(identifier) => f(identifier.clone()) | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/check-static-values-constraints.nll.stderr b/src/test/ui/check-static-values-constraints.nll.stderr index f1a231249081..fe014fa10596 100644 --- a/src/test/ui/check-static-values-constraints.nll.stderr +++ b/src/test/ui/check-static-values-constraints.nll.stderr @@ -3,7 +3,7 @@ error[E0493]: destructors cannot be evaluated at compile-time | LL | ..SafeStruct{field1: SafeEnum::Variant3(WithDtor), | ___________________________________________^ -LL | | //~^ ERROR destructors cannot be evaluated at compile-time +LL | | LL | | field2: SafeEnum::Variant1}}; | |________________________________________________________________________________^ statics cannot evaluate destructors @@ -28,49 +28,49 @@ LL | field2: SafeEnum::Variant4("str".to_string()) error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:95:5 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:95:9 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:97:5 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:97:9 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:102:6 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:102:10 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:104:6 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:104:10 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics diff --git a/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr b/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr index 0c4d90f4c531..7e60f3cd8ffa 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr +++ b/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `y`, as it is not declared as mutable | LL | let y = true; | - help: consider changing this to be mutable: `mut y` -LL | foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable +LL | foo(Box::new(move || y = false) as Box<_>); | ^^^^^^^^^ cannot assign error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr b/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr index 7fdeb03acbd6..a60f1c77a586 100644 --- a/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr +++ b/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | let x = "foo"; | - help: consider changing this to be mutable: `mut x` ... -LL | let y = &mut x; //~ ERROR cannot borrow +LL | let y = &mut x; | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/issue-11715.nll.stderr b/src/test/ui/codemap_tests/issue-11715.nll.stderr index 9f30f3854254..d0c29c768eb6 100644 --- a/src/test/ui/codemap_tests/issue-11715.nll.stderr +++ b/src/test/ui/codemap_tests/issue-11715.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | ------ first mutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | let z = &mut x; | ^^^^^^ second mutable borrow occurs here LL | z.use_mut(); LL | y.use_mut(); diff --git a/src/test/ui/codemap_tests/one_line.nll.stderr b/src/test/ui/codemap_tests/one_line.nll.stderr index 0eb257c5976a..eddbd29c0ef8 100644 --- a/src/test/ui/codemap_tests/one_line.nll.stderr +++ b/src/test/ui/codemap_tests/one_line.nll.stderr @@ -1,7 +1,7 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/one_line.rs:3:12 | -LL | v.push(v.pop().unwrap()); //~ ERROR cannot borrow +LL | v.push(v.pop().unwrap()); | - ---- ^ second mutable borrow occurs here | | | | | first borrow later used by call diff --git a/src/test/ui/codemap_tests/tab_3.nll.stderr b/src/test/ui/codemap_tests/tab_3.nll.stderr index 3b8507a067de..97816a76004d 100644 --- a/src/test/ui/codemap_tests/tab_3.nll.stderr +++ b/src/test/ui/codemap_tests/tab_3.nll.stderr @@ -6,7 +6,7 @@ LL | let some_vec = vec!["hi"]; LL | some_vec.into_iter(); | -------- value moved here LL | { -LL | println!("{:?}", some_vec); //~ ERROR use of moved +LL | println!("{:?}", some_vec); | ^^^^^^^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr index 238db527e388..ca80a9ab3911 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr @@ -1,7 +1,7 @@ error: `foo` is not yet stable as a const fn --> $DIR/dont_promote_unstable_const_fn.rs:15:25 | -LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a const fn +LL | const fn bar() -> u32 { foo() } | ^^^^^ | = help: add `#![feature(foo)]` to the crate attributes to enable @@ -9,7 +9,7 @@ LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a cons error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn.rs:18:28 | -LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &foo(); | ------------ ^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -19,7 +19,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn.rs:22:28 | -LL | let _: &'static u32 = &meh(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &meh(); | ------------ ^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -34,7 +34,7 @@ LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | //~^ ERROR does not live long enough +LL | LL | } | - temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr index 4355401987b0..129f06151074 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr @@ -1,18 +1,18 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28 | -LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &foo(); | ------------ ^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _x: &'static u32 = &foo(); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:9:29 | -LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _x: &'static u32 = &foo(); | ------------ ^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr index a2a71fc2ce36..519ba7d84b08 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_const_fn_fail.rs:20:27 | -LL | let x: &'static u8 = &(bar() + 1); //~ ERROR does not live long enough +LL | let x: &'static u8 = &(bar() + 1); | ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr index 117090d89fd7..a8bb6976da75 100644 --- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr +++ b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr @@ -12,7 +12,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_raw_ptr_ops.rs:6:30 | -LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough +LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -23,18 +23,18 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_raw_ptr_ops.rs:7:28 | -LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough +LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough +LL | let a: &'static bool = &(main as fn() == main as fn()); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_raw_ptr_ops.rs:8:29 | -LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough +LL | let a: &'static bool = &(main as fn() == main as fn()); | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr b/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr index 90fe7eebe4a7..5aae8c12d16e 100644 --- a/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr +++ b/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr @@ -5,7 +5,7 @@ LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) }; | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | //~^ ERROR value does not live long enough +LL | LL | } | - temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/const-eval/union_promotion.nll.stderr b/src/test/ui/consts/const-eval/union_promotion.nll.stderr index 11bc7f9da35f..b530c02f2fb9 100644 --- a/src/test/ui/consts/const-eval/union_promotion.nll.stderr +++ b/src/test/ui/consts/const-eval/union_promotion.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/union_promotion.rs:9:29 | -LL | let x: &'static bool = &unsafe { //~ borrowed value does not live long enough +LL | let x: &'static bool = &unsafe { | ____________-------------____^ | | | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-int-conversion.nll.stderr b/src/test/ui/consts/const-int-conversion.nll.stderr index afc051013ed7..65330e282c96 100644 --- a/src/test/ui/consts/const-int-conversion.nll.stderr +++ b/src/test/ui/consts/const-int-conversion.nll.stderr @@ -71,7 +71,7 @@ LL | let d: &'static [u8] = &(i32::min_value().to_be().to_ne_bytes()); | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | //~^ ERROR does not live long enough +LL | LL | } | - temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/const-int-overflowing.nll.stderr b/src/test/ui/consts/const-int-overflowing.nll.stderr index ffcac69c1af8..bd061ab33318 100644 --- a/src/test/ui/consts/const-int-overflowing.nll.stderr +++ b/src/test/ui/consts/const-int-overflowing.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-overflowing.rs:2:36 | -LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); //~ ERROR does not live long enough +LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -12,18 +12,18 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-overflowing.rs:3:36 | -LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); //~ ERROR does not live long enough +LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-overflowing.rs:4:36 | -LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-int-rotate.nll.stderr b/src/test/ui/consts/const-int-rotate.nll.stderr index 9923096f46d6..2b7cdf5746ed 100644 --- a/src/test/ui/consts/const-int-rotate.nll.stderr +++ b/src/test/ui/consts/const-int-rotate.nll.stderr @@ -1,18 +1,18 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-rotate.rs:2:28 | -LL | let x: &'static i32 = &(5_i32.rotate_left(3)); //~ ERROR does not live long enough +LL | let x: &'static i32 = &(5_i32.rotate_left(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.rotate_right(3)); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-rotate.rs:3:28 | -LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.rotate_right(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-int-sign.nll.stderr b/src/test/ui/consts/const-int-sign.nll.stderr index 43fd002ff3a6..0ad7a39d5955 100644 --- a/src/test/ui/consts/const-int-sign.nll.stderr +++ b/src/test/ui/consts/const-int-sign.nll.stderr @@ -1,18 +1,18 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-sign.rs:2:29 | -LL | let x: &'static bool = &(5_i32.is_negative()); //~ ERROR does not live long enough +LL | let x: &'static bool = &(5_i32.is_negative()); | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough +LL | let y: &'static bool = &(5_i32.is_positive()); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-sign.rs:3:29 | -LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough +LL | let y: &'static bool = &(5_i32.is_positive()); | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-int-wrapping.nll.stderr b/src/test/ui/consts/const-int-wrapping.nll.stderr index 036c8b9d95e1..a186854ce0cb 100644 --- a/src/test/ui/consts/const-int-wrapping.nll.stderr +++ b/src/test/ui/consts/const-int-wrapping.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:2:28 | -LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); //~ ERROR does not live long enough +LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -12,7 +12,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:3:28 | -LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -23,7 +23,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:4:28 | -LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -34,18 +34,18 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:5:28 | -LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); //~ ERROR does not live long enough +LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough +LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:6:28 | -LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough +LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-ptr-nonnull.nll.stderr b/src/test/ui/consts/const-ptr-nonnull.nll.stderr index 6977e7fdc118..26946fb99024 100644 --- a/src/test/ui/consts/const-ptr-nonnull.nll.stderr +++ b/src/test/ui/consts/const-ptr-nonnull.nll.stderr @@ -16,7 +16,7 @@ LL | let x: &'static NonNull = &(non_null.cast()); | --------------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | } | - temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/const-ptr-unique.nll.stderr b/src/test/ui/consts/const-ptr-unique.nll.stderr index b201994c894e..3644cf4cec7d 100644 --- a/src/test/ui/consts/const-ptr-unique.nll.stderr +++ b/src/test/ui/consts/const-ptr-unique.nll.stderr @@ -5,7 +5,7 @@ LL | let x: &'static *mut u32 = &(unique.as_ptr()); | ----------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | } | - temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr index feb4960e0c74..95b809712ffe 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr @@ -1,7 +1,7 @@ error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:37:25 | -LL | const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated +LL | const fn into_inner(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -15,7 +15,7 @@ LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 } error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:44:28 | -LL | const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated +LL | const fn into_inner_lt(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -29,7 +29,7 @@ LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:51:27 | -LL | const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors +LL | const fn into_inner_s(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -99,7 +99,7 @@ LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g } error[E0723]: cannot access `static` items in const fn (see issue #57563) --> $DIR/min_const_fn.rs:90:27 | -LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn +LL | const fn foo25() -> u32 { BAR } | ^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -107,7 +107,7 @@ LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in c error[E0723]: cannot access `static` items in const fn (see issue #57563) --> $DIR/min_const_fn.rs:91:36 | -LL | const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items +LL | const fn foo26() -> &'static u32 { &BAR } | ^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -155,7 +155,7 @@ LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } } error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563) --> $DIR/min_const_fn.rs:102:29 | -LL | const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn +LL | const fn foo30_5(b: bool) { while b { } } | ^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -227,7 +227,7 @@ LL | const fn no_apit2(_x: AlanTuring) {} error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563) --> $DIR/min_const_fn.rs:133:22 | -LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` +LL | const fn no_apit(_x: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -235,7 +235,7 @@ LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other error[E0723]: `impl Trait` in const fn is unstable (see issue #57563) --> $DIR/min_const_fn.rs:134:23 | -LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable +LL | const fn no_rpit() -> impl std::fmt::Debug {} | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -243,7 +243,7 @@ LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in con error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563) --> $DIR/min_const_fn.rs:135:23 | -LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` +LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} | ^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/promotion.nll.stderr b/src/test/ui/consts/min_const_fn/promotion.nll.stderr index eb186ce49513..550423c2d933 100644 --- a/src/test/ui/consts/min_const_fn/promotion.nll.stderr +++ b/src/test/ui/consts/min_const_fn/promotion.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:11:27 | -LL | let x: &'static () = &foo1(); //~ ERROR does not live long enough +LL | let x: &'static () = &foo1(); | ----------- ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -12,7 +12,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:12:28 | -LL | let y: &'static i32 = &foo2(42); //~ ERROR does not live long enough +LL | let y: &'static i32 = &foo2(42); | ------------ ^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -23,7 +23,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:13:28 | -LL | let z: &'static i32 = &foo3(); //~ ERROR does not live long enough +LL | let z: &'static i32 = &foo3(); | ------------ ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -34,7 +34,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:14:34 | -LL | let a: &'static Cell = &foo4(); //~ ERROR does not live long enough +LL | let a: &'static Cell = &foo4(); | ------------------ ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -45,18 +45,18 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:15:42 | -LL | let a: &'static Option> = &foo5(); //~ ERROR does not live long enough +LL | let a: &'static Option> = &foo5(); | -------------------------- ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let a: &'static Option> = &foo6(); //~ ERROR does not live long enough +LL | let a: &'static Option> = &foo6(); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:16:42 | -LL | let a: &'static Option> = &foo6(); //~ ERROR does not live long enough +LL | let a: &'static Option> = &foo6(); | -------------------------- ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/promote_const_let.nll.stderr b/src/test/ui/consts/promote_const_let.nll.stderr index e6ee1523a3b2..a0af949bf71e 100644 --- a/src/test/ui/consts/promote_const_let.nll.stderr +++ b/src/test/ui/consts/promote_const_let.nll.stderr @@ -4,7 +4,7 @@ error[E0597]: `y` does not live long enough LL | let x: &'static u32 = { | ------------ type annotation requires that `y` is borrowed for `'static` LL | let y = 42; -LL | &y //~ ERROR does not live long enough +LL | &y | ^^ borrowed value does not live long enough LL | }; | - `y` dropped here while still borrowed @@ -12,7 +12,7 @@ LL | }; error[E0716]: temporary value dropped while borrowed --> $DIR/promote_const_let.rs:6:28 | -LL | let x: &'static u32 = &{ //~ ERROR does not live long enough +LL | let x: &'static u32 = &{ | ____________------------____^ | | | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/did_you_mean/issue-31424.nll.stderr b/src/test/ui/did_you_mean/issue-31424.nll.stderr index 91368dded375..147225f1be59 100644 --- a/src/test/ui/did_you_mean/issue-31424.nll.stderr +++ b/src/test/ui/did_you_mean/issue-31424.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable --> $DIR/issue-31424.rs:7:9 | -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | (&mut self).bar(); | ^^^^^^^^^^^ | | | cannot borrow as mutable @@ -12,8 +12,8 @@ warning: function cannot return without recursing | LL | fn bar(self: &mut Self) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -LL | //~^ WARN function cannot return without recursing -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | +LL | (&mut self).bar(); | ----------------- recursive call site | = note: #[warn(unconditional_recursion)] on by default @@ -22,7 +22,7 @@ LL | (&mut self).bar(); //~ ERROR cannot borrow error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable --> $DIR/issue-31424.rs:14:9 | -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | (&mut self).bar(); | ^^^^^^^^^^^ | | | cannot borrow as mutable diff --git a/src/test/ui/did_you_mean/issue-34126.nll.stderr b/src/test/ui/did_you_mean/issue-34126.nll.stderr index ed73cca435fd..e738df1b732e 100644 --- a/src/test/ui/did_you_mean/issue-34126.nll.stderr +++ b/src/test/ui/did_you_mean/issue-34126.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable --> $DIR/issue-34126.rs:6:18 | -LL | self.run(&mut self); //~ ERROR cannot borrow +LL | self.run(&mut self); | ^^^^^^^^^ | | | cannot borrow as mutable @@ -10,7 +10,7 @@ LL | self.run(&mut self); //~ ERROR cannot borrow error[E0502]: cannot borrow `self` as mutable because it is also borrowed as immutable --> $DIR/issue-34126.rs:6:18 | -LL | self.run(&mut self); //~ ERROR cannot borrow +LL | self.run(&mut self); | ---- --- ^^^^^^^^^ mutable borrow occurs here | | | | | immutable borrow later used by call diff --git a/src/test/ui/did_you_mean/issue-34337.nll.stderr b/src/test/ui/did_you_mean/issue-34337.nll.stderr index 5e46889866d4..81f7b6dbf1b2 100644 --- a/src/test/ui/did_you_mean/issue-34337.nll.stderr +++ b/src/test/ui/did_you_mean/issue-34337.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `key` as mutable, as it is not declared as mutable --> $DIR/issue-34337.rs:6:9 | -LL | get(&mut key); //~ ERROR cannot borrow +LL | get(&mut key); | ^^^^^^^^ | | | cannot borrow as mutable diff --git a/src/test/ui/did_you_mean/issue-35937.nll.stderr b/src/test/ui/did_you_mean/issue-35937.nll.stderr index 76fb1e229536..216cb14dcf63 100644 --- a/src/test/ui/did_you_mean/issue-35937.nll.stderr +++ b/src/test/ui/did_you_mean/issue-35937.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `f.v` as mutable, as `f` is not declared as mutable | LL | let f = Foo { v: Vec::new() }; | - help: consider changing this to be mutable: `mut f` -LL | f.v.push("cat".to_string()); //~ ERROR cannot borrow +LL | f.v.push("cat".to_string()); | ^^^ cannot borrow as mutable error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable @@ -11,7 +11,7 @@ error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable | LL | let s = S { x: 42 }; | - help: consider changing this to be mutable: `mut s` -LL | s.x += 1; //~ ERROR cannot assign +LL | s.x += 1; | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable @@ -19,7 +19,7 @@ error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable | LL | fn bar(s: S) { | - help: consider changing this to be mutable: `mut s` -LL | s.x += 1; //~ ERROR cannot assign +LL | s.x += 1; | ^^^^^^^^ cannot assign error: aborting due to 3 previous errors diff --git a/src/test/ui/did_you_mean/issue-37139.nll.stderr b/src/test/ui/did_you_mean/issue-37139.nll.stderr index 4d1c8a6b0eb1..163817dd9bf5 100644 --- a/src/test/ui/did_you_mean/issue-37139.nll.stderr +++ b/src/test/ui/did_you_mean/issue-37139.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/issue-37139.rs:12:18 | -LL | test(&mut x); //~ ERROR cannot borrow immutable +LL | test(&mut x); | ^^^^^^ | | | cannot borrow as mutable diff --git a/src/test/ui/did_you_mean/issue-38147-1.nll.stderr b/src/test/ui/did_you_mean/issue-38147-1.nll.stderr index 838673b21d1e..6efac371c028 100644 --- a/src/test/ui/did_you_mean/issue-38147-1.nll.stderr +++ b/src/test/ui/did_you_mean/issue-38147-1.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` referenc | LL | fn f(&self) { | ----- help: consider changing this to be a mutable reference: `&mut self` -LL | self.s.push('x'); //~ ERROR cannot borrow data mutably +LL | self.s.push('x'); | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-38147-4.nll.stderr b/src/test/ui/did_you_mean/issue-38147-4.nll.stderr index 458e41f6aae7..db3e6b894264 100644 --- a/src/test/ui/did_you_mean/issue-38147-4.nll.stderr +++ b/src/test/ui/did_you_mean/issue-38147-4.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*f.s` as mutable, as it is behind a `&` reference | LL | fn f(x: usize, f: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut Foo<'_>` -LL | f.s.push('x'); //~ ERROR cannot borrow data mutably +LL | f.s.push('x'); | ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-39544.nll.stderr b/src/test/ui/did_you_mean/issue-39544.nll.stderr index 2fb8e3db68cb..899a42b54e61 100644 --- a/src/test/ui/did_you_mean/issue-39544.nll.stderr +++ b/src/test/ui/did_you_mean/issue-39544.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable | LL | let z = Z { x: X::Y }; | - help: consider changing this to be mutable: `mut z` -LL | let _ = &mut z.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference | LL | fn foo<'z>(&'z self) { | -------- help: consider changing this to be a mutable reference: `&'z mut self` -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference @@ -19,7 +19,7 @@ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference | LL | fn foo1(&self, other: &Z) { | ----- help: consider changing this to be a mutable reference: `&mut self` -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference @@ -27,8 +27,8 @@ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` referenc | LL | fn foo1(&self, other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference @@ -36,7 +36,7 @@ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference | LL | fn foo2<'a>(&'a self, other: &Z) { | -------- help: consider changing this to be a mutable reference: `&'a mut self` -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference @@ -44,8 +44,8 @@ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` referenc | LL | fn foo2<'a>(&'a self, other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference @@ -53,7 +53,7 @@ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -------- help: consider changing this to be a mutable reference: `&'a mut Self` -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference @@ -61,8 +61,8 @@ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` referenc | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference @@ -70,7 +70,7 @@ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` referenc | LL | fn foo4(other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut other.x; | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable @@ -78,7 +78,7 @@ error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable | LL | pub fn with_arg(z: Z, w: &Z) { | - help: consider changing this to be mutable: `mut z` -LL | let _ = &mut z.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `w.x` as mutable, as it is behind a `&` reference @@ -86,8 +86,8 @@ error[E0596]: cannot borrow `w.x` as mutable, as it is behind a `&` reference | LL | pub fn with_arg(z: Z, w: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut z.x; //~ ERROR cannot borrow -LL | let _ = &mut w.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; +LL | let _ = &mut w.x; | ^^^^^^^^ `w` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0594]: cannot assign to `*x.0` which is behind a `&` reference diff --git a/src/test/ui/did_you_mean/issue-40823.nll.stderr b/src/test/ui/did_you_mean/issue-40823.nll.stderr index 0389cf5499d9..73473406a9ac 100644 --- a/src/test/ui/did_you_mean/issue-40823.nll.stderr +++ b/src/test/ui/did_you_mean/issue-40823.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*buf` as mutable, as it is behind a `&` reference | LL | let mut buf = &[1, 2, 3, 4]; | ------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4]` -LL | buf.iter_mut(); //~ ERROR cannot borrow immutable borrowed content +LL | buf.iter_mut(); | ^^^ `buf` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr index 59cb804a801f..fff3a64ff296 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `X`, which implements the `Drop` trait --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:22 | -LL | let X { x: y } = x; //~ ERROR cannot move out of type +LL | let X { x: y } = x; | - ^ cannot move out of here | | | data moved here @@ -9,7 +9,7 @@ LL | let X { x: y } = x; //~ ERROR cannot move out of type note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:16 | -LL | let X { x: y } = x; //~ ERROR cannot move out of type +LL | let X { x: y } = x; | ^ error: aborting due to previous error diff --git a/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr b/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr index 9c6c9341be77..7fed27adaff2 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr +++ b/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let b: Vec<&str> = a.lines().collect(); | - borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` because it is borrowed +LL | drop(a); | ^ move out of `a` occurs here LL | for s in &b { | -- borrow later used here diff --git a/src/test/ui/dropck/dropck-union.nll.stderr b/src/test/ui/dropck/dropck-union.nll.stderr index 667bb7221aac..228744326f94 100644 --- a/src/test/ui/dropck/dropck-union.nll.stderr +++ b/src/test/ui/dropck/dropck-union.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `v` does not live long enough --> $DIR/dropck-union.rs:39:18 | -LL | v.0.set(Some(&v)); //~ ERROR: `v` does not live long enough +LL | v.0.set(Some(&v)); | ^^ borrowed value does not live long enough LL | } | - diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr index 28b9656c6fd1..8c669b597c3c 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr @@ -3,7 +3,7 @@ error[E0597]: `o2` does not live long enough | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o2` is borrowed for `'static` -LL | o1.set0(&o2); //~ ERROR `o2` does not live long enough +LL | o1.set0(&o2); | ^^^ borrowed value does not live long enough ... LL | } @@ -14,8 +14,8 @@ error[E0597]: `o3` does not live long enough | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o3` is borrowed for `'static` -LL | o1.set0(&o2); //~ ERROR `o2` does not live long enough -LL | o1.set1(&o3); //~ ERROR `o3` does not live long enough +LL | o1.set0(&o2); +LL | o1.set1(&o3); | ^^^ borrowed value does not live long enough ... LL | } @@ -27,7 +27,7 @@ error[E0597]: `o2` does not live long enough LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o2` is borrowed for `'static` ... -LL | o2.set0(&o2); //~ ERROR `o2` does not live long enough +LL | o2.set0(&o2); | ^^^ borrowed value does not live long enough ... LL | } @@ -39,7 +39,7 @@ error[E0597]: `o3` does not live long enough LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o3` is borrowed for `'static` ... -LL | o2.set1(&o3); //~ ERROR `o3` does not live long enough +LL | o2.set1(&o3); | ^^^ borrowed value does not live long enough ... LL | } @@ -51,9 +51,9 @@ error[E0597]: `o1` does not live long enough LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o1` is borrowed for `'static` ... -LL | o3.set0(&o1); //~ ERROR `o1` does not live long enough +LL | o3.set0(&o1); | ^^^ borrowed value does not live long enough -LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough +LL | o3.set1(&o2); LL | } | - `o1` dropped here while still borrowed @@ -63,7 +63,7 @@ error[E0597]: `o2` does not live long enough LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o2` is borrowed for `'static` ... -LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough +LL | o3.set1(&o2); | ^^^ borrowed value does not live long enough LL | } | - `o2` dropped here while still borrowed diff --git a/src/test/ui/dst/dst-bad-coerce3.nll.stderr b/src/test/ui/dst/dst-bad-coerce3.nll.stderr index 8f1289845e37..289d451f02a7 100644 --- a/src/test/ui/dst/dst-bad-coerce3.nll.stderr +++ b/src/test/ui/dst/dst-bad-coerce3.nll.stderr @@ -4,7 +4,7 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... -LL | let f2: &Fat<[isize; 3]> = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &Fat<[isize; 3]> = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a Fat<[isize]> = f2; | ---------------- type annotation requires that `f1` is borrowed for `'a` @@ -18,7 +18,7 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... -LL | let f2: &Fat = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &Fat = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a Fat = f2; | ------------ type annotation requires that `f1` is borrowed for `'a` @@ -32,7 +32,7 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... -LL | let f2: &([isize; 3],) = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &([isize; 3],) = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a ([isize],) = f2; | -------------- type annotation requires that `f1` is borrowed for `'a` @@ -46,7 +46,7 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... -LL | let f2: &(Foo,) = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &(Foo,) = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a (Bar,) = f2; | ---------- type annotation requires that `f1` is borrowed for `'a` diff --git a/src/test/ui/error-codes/E0017.nll.stderr b/src/test/ui/error-codes/E0017.nll.stderr index 0477f06010b0..3c2a07265f4f 100644 --- a/src/test/ui/error-codes/E0017.nll.stderr +++ b/src/test/ui/error-codes/E0017.nll.stderr @@ -1,31 +1,31 @@ error[E0017]: references in constants may only refer to immutable values --> $DIR/E0017.rs:4:30 | -LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | const CR: &'static mut i32 = &mut C; | ^^^^^^ constants require immutable values error[E0017]: references in statics may only refer to immutable values --> $DIR/E0017.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ statics require immutable values error: cannot mutate statics in the initializer of another static --> $DIR/E0017.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ error[E0596]: cannot borrow immutable static item `X` as mutable --> $DIR/E0017.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ cannot borrow as mutable error[E0017]: references in statics may only refer to immutable values --> $DIR/E0017.rs:8:38 | -LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ statics require immutable values error: aborting due to 5 previous errors diff --git a/src/test/ui/error-codes/E0301.nll.stderr b/src/test/ui/error-codes/E0301.nll.stderr index 898c30a75b28..24234c9929e4 100644 --- a/src/test/ui/error-codes/E0301.nll.stderr +++ b/src/test/ui/error-codes/E0301.nll.stderr @@ -1,7 +1,7 @@ error[E0301]: cannot mutably borrow in a pattern guard --> $DIR/E0301.rs:4:19 | -LL | option if option.take().is_none() => {}, //~ ERROR E0301 +LL | option if option.take().is_none() => {}, | ^^^^^^ borrowed mutably in pattern guard | = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable diff --git a/src/test/ui/error-codes/E0388.nll.stderr b/src/test/ui/error-codes/E0388.nll.stderr index a898d60a9859..0fc8a76820cf 100644 --- a/src/test/ui/error-codes/E0388.nll.stderr +++ b/src/test/ui/error-codes/E0388.nll.stderr @@ -1,31 +1,31 @@ error[E0017]: references in constants may only refer to immutable values --> $DIR/E0388.rs:4:30 | -LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | const CR: &'static mut i32 = &mut C; | ^^^^^^ constants require immutable values error[E0017]: references in statics may only refer to immutable values --> $DIR/E0388.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ statics require immutable values error: cannot mutate statics in the initializer of another static --> $DIR/E0388.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ error[E0596]: cannot borrow immutable static item `X` as mutable --> $DIR/E0388.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ cannot borrow as mutable error[E0017]: references in statics may only refer to immutable values --> $DIR/E0388.rs:8:38 | -LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ statics require immutable values error: aborting due to 5 previous errors diff --git a/src/test/ui/error-codes/E0389.nll.stderr b/src/test/ui/error-codes/E0389.nll.stderr index 13d2f8cfaa59..c47750b6f4e6 100644 --- a/src/test/ui/error-codes/E0389.nll.stderr +++ b/src/test/ui/error-codes/E0389.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference | LL | let fancy_ref = &(&mut fancy); | ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)` -LL | fancy_ref.num = 6; //~ ERROR E0389 +LL | fancy_ref.num = 6; | ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0499.nll.stderr b/src/test/ui/error-codes/E0499.nll.stderr index c1acef10e6e6..d56baf722720 100644 --- a/src/test/ui/error-codes/E0499.nll.stderr +++ b/src/test/ui/error-codes/E0499.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `i` as mutable more than once at a time | LL | let mut x = &mut i; | ------ first mutable borrow occurs here -LL | let mut a = &mut i; //~ ERROR E0499 +LL | let mut a = &mut i; | ^^^^^^ second mutable borrow occurs here LL | a.use_mut(); LL | x.use_mut(); diff --git a/src/test/ui/error-codes/E0502.nll.stderr b/src/test/ui/error-codes/E0502.nll.stderr index 64ca8f0e6b9a..cade6d71852f 100644 --- a/src/test/ui/error-codes/E0502.nll.stderr +++ b/src/test/ui/error-codes/E0502.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*a` as mutable because it is also borrowed as immut | LL | let ref y = a; | ----- immutable borrow occurs here -LL | bar(a); //~ ERROR E0502 +LL | bar(a); | ^^^^^^ mutable borrow occurs here LL | y.use_ref(); | - immutable borrow later used here diff --git a/src/test/ui/error-codes/E0503.nll.stderr b/src/test/ui/error-codes/E0503.nll.stderr index 7b483a5eaa58..106dda2bc226 100644 --- a/src/test/ui/error-codes/E0503.nll.stderr +++ b/src/test/ui/error-codes/E0503.nll.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `value` because it was mutably borrowed | LL | let _borrow = &mut value; | ---------- borrow of `value` occurs here -LL | let _sum = value + 1; //~ ERROR E0503 +LL | let _sum = value + 1; | ^^^^^ use of borrowed `value` LL | _borrow.use_mut(); | ------- borrow later used here diff --git a/src/test/ui/error-codes/E0504.nll.stderr b/src/test/ui/error-codes/E0504.nll.stderr index 8d7387e86e52..1f2a0407a396 100644 --- a/src/test/ui/error-codes/E0504.nll.stderr +++ b/src/test/ui/error-codes/E0504.nll.stderr @@ -6,7 +6,7 @@ LL | let fancy_ref = &fancy_num; LL | LL | let x = move || { | ^^^^^^^ move out of `fancy_num` occurs here -LL | println!("child function: {}", fancy_num.num); //~ ERROR E0504 +LL | println!("child function: {}", fancy_num.num); | --------- move occurs due to use in closure ... LL | println!("main function: {}", fancy_ref.num); diff --git a/src/test/ui/error-codes/E0505.nll.stderr b/src/test/ui/error-codes/E0505.nll.stderr index 181e5e33d29d..4d9d1ef121c6 100644 --- a/src/test/ui/error-codes/E0505.nll.stderr +++ b/src/test/ui/error-codes/E0505.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let _ref_to_val: &Value = &x; | -- borrow of `x` occurs here -LL | eat(x); //~ ERROR E0505 +LL | eat(x); | ^ move out of `x` occurs here LL | _ref_to_val.use_ref(); | ----------- borrow later used here diff --git a/src/test/ui/error-codes/E0509.nll.stderr b/src/test/ui/error-codes/E0509.nll.stderr index 0233c7d6d165..e5c0cf6e24e5 100644 --- a/src/test/ui/error-codes/E0509.nll.stderr +++ b/src/test/ui/error-codes/E0509.nll.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `DropStruct`, which implements the `Drop` trait --> $DIR/E0509.rs:16:23 | -LL | let fancy_field = drop_struct.fancy; //~ ERROR E0509 +LL | let fancy_field = drop_struct.fancy; | ^^^^^^^^^^^^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/error-codes/E0597.nll.stderr b/src/test/ui/error-codes/E0597.nll.stderr index 88a8a46930d2..b4a1180ad546 100644 --- a/src/test/ui/error-codes/E0597.nll.stderr +++ b/src/test/ui/error-codes/E0597.nll.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | x.x = Some(&y); | ^^ borrowed value does not live long enough -LL | //~^ `y` does not live long enough [E0597] +LL | LL | } | - | | diff --git a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr index 67cca25ac0ca..e7b457534211 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr +++ b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `A`, which implements the `Drop` trait --> $DIR/functional-struct-update-noncopyable.rs:12:14 | -LL | let _b = A { y: Arc::new(3), ..a }; //~ ERROR cannot move out of type `A` +LL | let _b = A { y: Arc::new(3), ..a }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here error: aborting due to previous error diff --git a/src/test/ui/generator/borrowing.nll.stderr b/src/test/ui/generator/borrowing.nll.stderr index 3c9221d28e74..3d58873f826d 100644 --- a/src/test/ui/generator/borrowing.nll.stderr +++ b/src/test/ui/generator/borrowing.nll.stderr @@ -7,7 +7,7 @@ LL | Pin::new(&mut || yield &a).resume() | | borrowed value does not live long enough | value captured here by generator | a temporary with access to the borrow is created here ... -LL | //~^ ERROR: `a` does not live long enough +LL | LL | }; | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator | | diff --git a/src/test/ui/generator/dropck.nll.stderr b/src/test/ui/generator/dropck.nll.stderr index a90a47fe9aa0..8bb860f288f1 100644 --- a/src/test/ui/generator/dropck.nll.stderr +++ b/src/test/ui/generator/dropck.nll.stderr @@ -18,7 +18,7 @@ error[E0597]: `ref_` does not live long enough LL | gen = || { | -- value captured here by generator LL | // but the generator can use it to drop a `Ref<'a, i32>`. -LL | let _d = ref_.take(); //~ ERROR `ref_` does not live long enough +LL | let _d = ref_.take(); | ^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/generator/yield-in-args.nll.stderr b/src/test/ui/generator/yield-in-args.nll.stderr index f753daafa974..ee6d22c27cde 100644 --- a/src/test/ui/generator/yield-in-args.nll.stderr +++ b/src/test/ui/generator/yield-in-args.nll.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/yield-in-args.rs:8:13 | -LL | foo(&b, yield); //~ ERROR +LL | foo(&b, yield); | ^^ ----- possible yield occurs here error: aborting due to previous error diff --git a/src/test/ui/generator/yield-while-iterating.nll.stderr b/src/test/ui/generator/yield-while-iterating.nll.stderr index 2dc12f843b22..43e29ceb5e66 100644 --- a/src/test/ui/generator/yield-while-iterating.nll.stderr +++ b/src/test/ui/generator/yield-while-iterating.nll.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/yield-while-iterating.rs:13:18 | -LL | for p in &x { //~ ERROR +LL | for p in &x { | ^^ LL | yield(); | ------- possible yield occurs here @@ -14,7 +14,7 @@ LL | let mut b = || { LL | for p in &mut x { | - first borrow occurs due to use of `x` in generator ... -LL | println!("{}", x[0]); //~ ERROR +LL | println!("{}", x[0]); | ^ immutable borrow occurs here LL | Pin::new(&mut b).resume(); | ------ mutable borrow later used here diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr b/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr index d0d6a98301e5..4c37cd351732 100644 --- a/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr +++ b/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr @@ -6,7 +6,7 @@ LL | let mut b = || { LL | let a = &mut *x; | - first borrow occurs due to use of `x` in generator ... -LL | println!("{}", x); //~ ERROR +LL | println!("{}", x); | ^ second borrow occurs here LL | Pin::new(&mut b).resume(); | ------ first borrow later used here diff --git a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr index cff58af3775c..f7626b13bad3 100644 --- a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr +++ b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as LL | let (_, thing) = my_stuff.iter().next().unwrap(); | -------- immutable borrow occurs here LL | -LL | my_stuff.clear(); //~ ERROR cannot borrow +LL | my_stuff.clear(); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | LL | println!("{}", *thing); diff --git a/src/test/ui/hashmap-lifetimes.nll.stderr b/src/test/ui/hashmap-lifetimes.nll.stderr index 08b8e3e443a9..497c7d1216cd 100644 --- a/src/test/ui/hashmap-lifetimes.nll.stderr +++ b/src/test/ui/hashmap-lifetimes.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as | LL | let mut it = my_stuff.iter(); | -------- immutable borrow occurs here -LL | my_stuff.insert(1, 43); //~ ERROR cannot borrow +LL | my_stuff.insert(1, 43); | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | it; | -- immutable borrow later used here diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr index 80ecc4741a2e..70d5b3c2ec58 100644 --- a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr +++ b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time | LL | foo.insert(); | --- first mutable borrow occurs here -LL | foo.insert(); //~ ERROR cannot borrow +LL | foo.insert(); | ^^^ | | | second mutable borrow occurs here diff --git a/src/test/ui/hygiene/fields-move.nll.stderr b/src/test/ui/hygiene/fields-move.nll.stderr index f72a52e2535d..562f60e31b5d 100644 --- a/src/test/ui/hygiene/fields-move.nll.stderr +++ b/src/test/ui/hygiene/fields-move.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: use of moved value: `foo.x` --> $DIR/fields-move.rs:18:9 | -LL | $foo.x //~ ERROR use of moved value: `foo.x` +LL | $foo.x | ^^^^^^ value used here after move ... -LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_modern!(foo), foo.x); | ----- value moved here -LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_legacy!(foo), foo.x); | ----------------- in this macro invocation | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait @@ -17,7 +17,7 @@ error[E0382]: use of moved value: `foo.x` LL | $foo.x | ------ value moved here ... -LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_modern!(foo), foo.x); | ^^^^^ value used here after move | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait @@ -25,10 +25,10 @@ LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved val error[E0382]: use of moved value: `foo.x` --> $DIR/fields-move.rs:29:42 | -LL | $foo.x //~ ERROR use of moved value: `foo.x` +LL | $foo.x | ------ value moved here ... -LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_legacy!(foo), foo.x); | ^^^^^ value used here after move | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr b/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr index 3f5dbb850cc7..f96ff9dd4e67 100644 --- a/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr +++ b/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr @@ -3,7 +3,7 @@ error[E0506]: cannot assign to `p` because it is borrowed | LL | let r = foo(&p); | -- borrow of `p` occurs here -LL | p += 1; //~ ERROR cannot assign to `p` because it is borrowed +LL | p += 1; | ^^^^^^ assignment to borrowed `p` occurs here LL | println!("{}", r); | - borrow later used here diff --git a/src/test/ui/issues/issue-11681.nll.stderr b/src/test/ui/issues/issue-11681.nll.stderr index a3c71ffe95a8..f2f930766719 100644 --- a/src/test/ui/issues/issue-11681.nll.stderr +++ b/src/test/ui/issues/issue-11681.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing temporary value --> $DIR/issue-11681.rs:13:10 | -LL | let testValue = &Test; //~ ERROR borrowed value does not live long enough +LL | let testValue = &Test; | ---- temporary value created here LL | return testValue; | ^^^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/issues/issue-11873.nll.stderr b/src/test/ui/issues/issue-11873.nll.stderr index e5abf0742023..4475bdf14740 100644 --- a/src/test/ui/issues/issue-11873.nll.stderr +++ b/src/test/ui/issues/issue-11873.nll.stderr @@ -5,7 +5,7 @@ LL | let mut f = || v.push(2); | -- - borrow occurs due to use in closure | | | borrow of `v` occurs here -LL | let _w = v; //~ ERROR: cannot move out of `v` +LL | let _w = v; | ^ move out of `v` occurs here LL | LL | f(); diff --git a/src/test/ui/issues/issue-12470.nll.stderr b/src/test/ui/issues/issue-12470.nll.stderr index 27878e7718be..c97e59195ed0 100644 --- a/src/test/ui/issues/issue-12470.nll.stderr +++ b/src/test/ui/issues/issue-12470.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*b` --> $DIR/issue-12470.rs:29:5 | -LL | let bb: &B = &*b; //~ ERROR does not live long enough +LL | let bb: &B = &*b; | --- `*b` is borrowed here LL | make_a(bb) | ^^^^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/issues/issue-13497-2.nll.stderr b/src/test/ui/issues/issue-13497-2.nll.stderr index fb0d606690d0..8ad921027e2e 100644 --- a/src/test/ui/issues/issue-13497-2.nll.stderr +++ b/src/test/ui/issues/issue-13497-2.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local variable `rawLines` --> $DIR/issue-13497-2.rs:3:5 | -LL | rawLines //~ ERROR `rawLines` does not live long enough +LL | rawLines | ^------- | | | _____`rawLines` is borrowed here diff --git a/src/test/ui/issues/issue-17385.nll.stderr b/src/test/ui/issues/issue-17385.nll.stderr index 20198f19dd5f..28c22260c388 100644 --- a/src/test/ui/issues/issue-17385.nll.stderr +++ b/src/test/ui/issues/issue-17385.nll.stderr @@ -5,7 +5,7 @@ LL | let foo = X(1); | --- move occurs because `foo` has type `X`, which does not implement the `Copy` trait LL | drop(foo); | --- value moved here -LL | match foo { //~ ERROR use of moved value +LL | match foo { LL | X(1) => (), | ^ value used here after move @@ -16,7 +16,7 @@ LL | let e = Enum::Variant2; | - move occurs because `e` has type `Enum`, which does not implement the `Copy` trait LL | drop(e); | - value moved here -LL | match e { //~ ERROR use of moved value +LL | match e { | ^ value used here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-17545.nll.stderr b/src/test/ui/issues/issue-17545.nll.stderr index 527f8df9ccbb..79a1e09bd7cc 100644 --- a/src/test/ui/issues/issue-17545.nll.stderr +++ b/src/test/ui/issues/issue-17545.nll.stderr @@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) { | -- lifetime `'a` defined here LL | / bar.call(( -LL | | &id(()), //~ ERROR borrowed value does not live long enough +LL | | &id(()), | | ^^^^^^ creates a temporary which is freed while still in use LL | | )); | | -- temporary value is freed at the end of this statement diff --git a/src/test/ui/issues/issue-17718-static-move.nll.stderr b/src/test/ui/issues/issue-17718-static-move.nll.stderr index 86e7a1849104..c3e6267d30ff 100644 --- a/src/test/ui/issues/issue-17718-static-move.nll.stderr +++ b/src/test/ui/issues/issue-17718-static-move.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of static item --> $DIR/issue-17718-static-move.rs:6:14 | -LL | let _a = FOO; //~ ERROR: cannot move out of static item +LL | let _a = FOO; | ^^^ | | | cannot move out of static item diff --git a/src/test/ui/issues/issue-18118.nll.stderr b/src/test/ui/issues/issue-18118.nll.stderr index 1920e1637d14..49798a148dee 100644 --- a/src/test/ui/issues/issue-18118.nll.stderr +++ b/src/test/ui/issues/issue-18118.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `p` does not live long enough --> $DIR/issue-18118.rs:4:9 | -LL | &p //~ ERROR `p` does not live long enough +LL | &p | ^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/issues/issue-18783.nll.stderr b/src/test/ui/issues/issue-18783.nll.stderr index f49a2d7a2b2f..047b42578a22 100644 --- a/src/test/ui/issues/issue-18783.nll.stderr +++ b/src/test/ui/issues/issue-18783.nll.stderr @@ -9,7 +9,7 @@ LL | c.push(Box::new(|| y = 0)); | ^^ - second borrow occurs due to use of `y` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time +LL | LL | } | - first borrow might be used here, when `c` is dropped and runs the destructor for type `std::cell::RefCell>>` @@ -24,7 +24,7 @@ LL | Push::push(&c, Box::new(|| y = 0)); | ^^ - second borrow occurs due to use of `y` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time +LL | LL | } | - first borrow might be used here, when `c` is dropped and runs the destructor for type `std::cell::RefCell>>` diff --git a/src/test/ui/issues/issue-21600.nll.stderr b/src/test/ui/issues/issue-21600.nll.stderr index 05837e92cdbc..21f3774c0564 100644 --- a/src/test/ui/issues/issue-21600.nll.stderr +++ b/src/test/ui/issues/issue-21600.nll.stderr @@ -1,19 +1,19 @@ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/issue-21600.rs:14:20 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` --> $DIR/issue-21600.rs:14:17 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^^^^^^^^^^^^^^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/issue-21600.rs:14:17 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^^ - mutable borrow occurs due to use of `x` in closure | | | cannot borrow as mutable @@ -24,8 +24,8 @@ help: consider changing this to accept closures that implement `FnMut` LL | call_it(|| { | _____________^ LL | | call_it(|| x.gen()); -LL | | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer -LL | | //~^ ERROR cannot borrow data mutably in a captured outer +LL | | call_it(|| x.gen_mut()); +LL | | LL | | }); | |_____^ diff --git a/src/test/ui/issues/issue-24267-flow-exit.nll.stderr b/src/test/ui/issues/issue-24267-flow-exit.nll.stderr index 52e637a3f0b0..3b4f27621f69 100644 --- a/src/test/ui/issues/issue-24267-flow-exit.nll.stderr +++ b/src/test/ui/issues/issue-24267-flow-exit.nll.stderr @@ -1,13 +1,13 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/issue-24267-flow-exit.rs:12:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/issue-24267-flow-exit.rs:18:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-24357.nll.stderr b/src/test/ui/issues/issue-24357.nll.stderr index 310535434cd0..a9c43a8f0d91 100644 --- a/src/test/ui/issues/issue-24357.nll.stderr +++ b/src/test/ui/issues/issue-24357.nll.stderr @@ -7,7 +7,7 @@ LL | let f = move || { let y = x; }; | ------- - variable moved due to use in closure | | | value moved into closure here -LL | //~^ NOTE value moved (into closure) here +LL | LL | let z = x; | ^ value used here after move diff --git a/src/test/ui/issues/issue-25700.nll.stderr b/src/test/ui/issues/issue-25700.nll.stderr index ba5403cca4d0..fa309a55c3c2 100644 --- a/src/test/ui/issues/issue-25700.nll.stderr +++ b/src/test/ui/issues/issue-25700.nll.stderr @@ -5,7 +5,7 @@ LL | let t = S::<()>(None); | - move occurs because `t` has type `S<()>`, which does not implement the `Copy` trait LL | drop(t); | - value moved here -LL | drop(t); //~ ERROR use of moved value +LL | drop(t); | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2590.nll.stderr b/src/test/ui/issues/issue-2590.nll.stderr index 1252578419a8..e19e83dc747e 100644 --- a/src/test/ui/issues/issue-2590.nll.stderr +++ b/src/test/ui/issues/issue-2590.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-2590.rs:11:9 | -LL | self.tokens //~ ERROR cannot move out of borrowed content +LL | self.tokens | ^^^^^^^^^^^ cannot move out of borrowed content error: aborting due to previous error diff --git a/src/test/ui/issues/issue-36400.nll.stderr b/src/test/ui/issues/issue-36400.nll.stderr index e260fab77911..3b37578f3c45 100644 --- a/src/test/ui/issues/issue-36400.nll.stderr +++ b/src/test/ui/issues/issue-36400.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable | LL | let x = Box::new(3); | - help: consider changing this to be mutable: `mut x` -LL | f(&mut *x); //~ ERROR cannot borrow immutable +LL | f(&mut *x); | ^^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40288.nll.stderr b/src/test/ui/issues/issue-40288.nll.stderr index bb4110948d54..fb4ecab362db 100644 --- a/src/test/ui/issues/issue-40288.nll.stderr +++ b/src/test/ui/issues/issue-40288.nll.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `*refr` because it is borrowed LL | save_ref(&*refr, &mut out); | ------ borrow of `*refr` occurs here ... -LL | *refr = 3; //~ ERROR cannot assign to `*refr` because it is borrowed +LL | *refr = 3; | ^^^^^^^^^ assignment to borrowed `*refr` occurs here ... LL | println!("{:?}", out[0]); diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr index a4847568ba0c..fbfbc0cb9777 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-40402-1.rs:9:13 | -LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content +LL | let e = f.v[0]; | ^^^^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr index 5c23021ee2c8..0c4a85b59016 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-40402-2.rs:5:18 | -LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content +LL | let (a, b) = x[0]; | - - ^^^^ | | | | | | | cannot move out of borrowed content @@ -12,7 +12,7 @@ LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content note: move occurs because these variables have types that don't implement the `Copy` trait --> $DIR/issue-40402-2.rs:5:10 | -LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content +LL | let (a, b) = x[0]; | ^ ^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-41726.nll.stderr b/src/test/ui/issues/issue-41726.nll.stderr index 087f557a0d4f..c92753d6e3db 100644 --- a/src/test/ui/issues/issue-41726.nll.stderr +++ b/src/test/ui/issues/issue-41726.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/issue-41726.rs:5:9 | -LL | things[src.as_str()].sort(); //~ ERROR cannot borrow immutable +LL | things[src.as_str()].sort(); | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap>` diff --git a/src/test/ui/issues/issue-42106.nll.stderr b/src/test/ui/issues/issue-42106.nll.stderr index 3a31e439c078..d5a9d233bc96 100644 --- a/src/test/ui/issues/issue-42106.nll.stderr +++ b/src/test/ui/issues/issue-42106.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*collection` as mutable because it is also borrowed | LL | let _a = &collection; | ----------- immutable borrow occurs here -LL | collection.swap(1, 2); //~ ERROR also borrowed as immutable +LL | collection.swap(1, 2); | ^^^^^^^^^^ mutable borrow occurs here LL | _a.use_ref(); | -- immutable borrow later used here diff --git a/src/test/ui/issues/issue-42344.nll.stderr b/src/test/ui/issues/issue-42344.nll.stderr index 9770d26fb12d..5cffa1b51219 100644 --- a/src/test/ui/issues/issue-42344.nll.stderr +++ b/src/test/ui/issues/issue-42344.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable static item --> $DIR/issue-42344.rs:4:5 | -LL | TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389] +LL | TAB[0].iter_mut(); | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/issues/issue-42796.nll.stderr b/src/test/ui/issues/issue-42796.nll.stderr index 23cc88bab52d..d9dfbc999f36 100644 --- a/src/test/ui/issues/issue-42796.nll.stderr +++ b/src/test/ui/issues/issue-42796.nll.stderr @@ -6,7 +6,7 @@ LL | let s = "Hello!".to_owned(); LL | let mut s_copy = s; | - value moved here ... -LL | println!("{}", s); //~ ERROR use of moved value +LL | println!("{}", s); | ^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/issues/issue-44373.nll.stderr b/src/test/ui/issues/issue-44373.nll.stderr index 8359e5af2b8d..6f92fbb1eb68 100644 --- a/src/test/ui/issues/issue-44373.nll.stderr +++ b/src/test/ui/issues/issue-44373.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/issue-44373.rs:4:42 | -LL | let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR borrowed value does not live long enough +LL | let _val: &'static [&'static u32] = &[&FOO]; | ----------------------- ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/issues/issue-49824.nll.stderr b/src/test/ui/issues/issue-49824.nll.stderr index 4e2f3f59a644..bfa07059c685 100644 --- a/src/test/ui/issues/issue-49824.nll.stderr +++ b/src/test/ui/issues/issue-49824.nll.stderr @@ -17,7 +17,7 @@ error: compilation successful --> $DIR/issue-49824.rs:8:1 | LL | / fn main() { -LL | | //~^ compilation successful +LL | | LL | | let mut x = 0; LL | | || { ... | diff --git a/src/test/ui/issues/issue-51244.nll.stderr b/src/test/ui/issues/issue-51244.nll.stderr index 7a4935fafc6e..c91083955b82 100644 --- a/src/test/ui/issues/issue-51244.nll.stderr +++ b/src/test/ui/issues/issue-51244.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `*my_ref` which is behind a `&` reference | LL | let ref my_ref @ _ = 0; | -------------- help: consider changing this to be a mutable reference: `ref mut my_ref @ _` -LL | *my_ref = 0; //~ ERROR cannot assign to immutable borrowed content `*my_ref` [E0594] +LL | *my_ref = 0; | ^^^^^^^^^^^ `my_ref` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error diff --git a/src/test/ui/issues/issue-6801.nll.stderr b/src/test/ui/issues/issue-6801.nll.stderr index 2c0fedf351a2..dbb8e6530c05 100644 --- a/src/test/ui/issues/issue-6801.nll.stderr +++ b/src/test/ui/issues/issue-6801.nll.stderr @@ -6,7 +6,7 @@ LL | let sq = || { *x * *x }; | | | borrow of `x` occurs here LL | -LL | twice(x); //~ ERROR: cannot move out of +LL | twice(x); | ^ move out of `x` occurs here LL | invoke(sq); | -- borrow later used here diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr b/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr index d70524b2387f..0e2fc0a0fe97 100644 --- a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr +++ b/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr @@ -5,7 +5,7 @@ LL | let mut x = vec![1].iter(); | ^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary which is freed while still in use -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | x.use_mut(); | - borrow later used here | diff --git a/src/test/ui/liveness/liveness-move-call-arg.nll.stderr b/src/test/ui/liveness/liveness-move-call-arg.nll.stderr index 521304d56055..ab4460a32684 100644 --- a/src/test/ui/liveness/liveness-move-call-arg.nll.stderr +++ b/src/test/ui/liveness/liveness-move-call-arg.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | let x: Box = box 25; | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | loop { -LL | take(x); //~ ERROR use of moved value: `x` +LL | take(x); | ^ value moved here, in previous iteration of loop error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-move-in-loop.nll.stderr b/src/test/ui/liveness/liveness-move-in-loop.nll.stderr index b7e973bc9140..150c1ec82b83 100644 --- a/src/test/ui/liveness/liveness-move-in-loop.nll.stderr +++ b/src/test/ui/liveness/liveness-move-in-loop.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `y` LL | let y: Box = box 42; | - move occurs because `y` has type `std::boxed::Box`, which does not implement the `Copy` trait ... -LL | x = y; //~ ERROR use of moved value +LL | x = y; | ^ value moved here, in previous iteration of loop error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-move-in-while.nll.stderr b/src/test/ui/liveness/liveness-move-in-while.nll.stderr index 167dcc6b6437..e1eed1b59f47 100644 --- a/src/test/ui/liveness/liveness-move-in-while.nll.stderr +++ b/src/test/ui/liveness/liveness-move-in-while.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `y` LL | let y: Box = box 42; | - move occurs because `y` has type `std::boxed::Box`, which does not implement the `Copy` trait ... -LL | println!("{}", y); //~ ERROR use of moved value: `y` +LL | println!("{}", y); | ^ value borrowed here after move LL | while true { while true { while true { x = y; x.clone(); } } } | - value moved here, in previous iteration of loop diff --git a/src/test/ui/liveness/liveness-use-after-move.nll.stderr b/src/test/ui/liveness/liveness-use-after-move.nll.stderr index 36c25882ccd4..383b89afaa75 100644 --- a/src/test/ui/liveness/liveness-use-after-move.nll.stderr +++ b/src/test/ui/liveness/liveness-use-after-move.nll.stderr @@ -5,7 +5,7 @@ LL | let x: Box<_> = box 5; | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | let y = x; | - value moved here -LL | println!("{}", *x); //~ ERROR use of moved value: `*x` +LL | println!("{}", *x); | ^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-use-after-send.nll.stderr b/src/test/ui/liveness/liveness-use-after-send.nll.stderr index d9367c871165..ccf9499f6440 100644 --- a/src/test/ui/liveness/liveness-use-after-send.nll.stderr +++ b/src/test/ui/liveness/liveness-use-after-send.nll.stderr @@ -5,7 +5,7 @@ LL | fn test00_start(ch: Chan>, message: Box, _count: Box`, which does not implement the `Copy` trait LL | send(ch, message); | ------- value moved here -LL | println!("{}", message); //~ ERROR use of moved value: `message` +LL | println!("{}", message); | ^^^^^^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/loops/loop-proper-liveness.nll.stderr b/src/test/ui/loops/loop-proper-liveness.nll.stderr index 745f0876b404..c87720659fd7 100644 --- a/src/test/ui/loops/loop-proper-liveness.nll.stderr +++ b/src/test/ui/loops/loop-proper-liveness.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/loop-proper-liveness.rs:9:22 | -LL | println!("{:?}", x); //~ ERROR use of possibly uninitialized variable +LL | println!("{:?}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/methods/method-self-arg-2.nll.stderr b/src/test/ui/methods/method-self-arg-2.nll.stderr index 8cfecdba41c0..82092dd4c0f8 100644 --- a/src/test/ui/methods/method-self-arg-2.nll.stderr +++ b/src/test/ui/methods/method-self-arg-2.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let y = &mut x; | ------ mutable borrow occurs here -LL | Foo::bar(&x); //~ERROR cannot borrow `x` +LL | Foo::bar(&x); | ^^ immutable borrow occurs here LL | y.use_mut(); | - mutable borrow later used here @@ -13,7 +13,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | ------ first mutable borrow occurs here -LL | Foo::baz(&mut x); //~ERROR cannot borrow `x` +LL | Foo::baz(&mut x); | ^^^^^^ second mutable borrow occurs here LL | y.use_mut(); | - first borrow later used here diff --git a/src/test/ui/moves/move-guard-same-consts.nll.stderr b/src/test/ui/moves/move-guard-same-consts.nll.stderr index 43f99cabcae9..0945fbe68a0f 100644 --- a/src/test/ui/moves/move-guard-same-consts.nll.stderr +++ b/src/test/ui/moves/move-guard-same-consts.nll.stderr @@ -6,7 +6,7 @@ LL | let x: Box<_> = box 1; ... LL | (1, 2) if take(x) => (), | - value moved here -LL | (1, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (1, 2) if take(x) => (), | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/moves/move-in-guard-1.nll.stderr b/src/test/ui/moves/move-in-guard-1.nll.stderr index 41abe6fa72a5..542fd1698637 100644 --- a/src/test/ui/moves/move-in-guard-1.nll.stderr +++ b/src/test/ui/moves/move-in-guard-1.nll.stderr @@ -6,7 +6,7 @@ LL | let x: Box<_> = box 1; ... LL | (1, _) if take(x) => (), | - value moved here -LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (_, 2) if take(x) => (), | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/moves/move-in-guard-2.nll.stderr b/src/test/ui/moves/move-in-guard-2.nll.stderr index 0b14c1620d3c..8bd405279c52 100644 --- a/src/test/ui/moves/move-in-guard-2.nll.stderr +++ b/src/test/ui/moves/move-in-guard-2.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | let x: Box<_> = box 1; | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait ... -LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (_, 2) if take(x) => (), | ^ value moved here, in previous iteration of loop error: aborting due to previous error diff --git a/src/test/ui/moves/move-into-dead-array-1.nll.stderr b/src/test/ui/moves/move-into-dead-array-1.nll.stderr index e3a2a601246d..33da0e54a1e4 100644 --- a/src/test/ui/moves/move-into-dead-array-1.nll.stderr +++ b/src/test/ui/moves/move-into-dead-array-1.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `a` --> $DIR/move-into-dead-array-1.rs:14:5 | -LL | a[i] = d(); //~ ERROR use of possibly uninitialized variable: `a` +LL | a[i] = d(); | ^^^^ use of possibly uninitialized `a` error: aborting due to previous error diff --git a/src/test/ui/moves/move-into-dead-array-2.nll.stderr b/src/test/ui/moves/move-into-dead-array-2.nll.stderr index 20bfdc2bbac7..19e476c04ea0 100644 --- a/src/test/ui/moves/move-into-dead-array-2.nll.stderr +++ b/src/test/ui/moves/move-into-dead-array-2.nll.stderr @@ -5,7 +5,7 @@ LL | fn foo(mut a: [D; 4], i: usize) { | ----- move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait LL | drop(a); | - value moved here -LL | a[i] = d(); //~ ERROR use of moved value: `a` +LL | a[i] = d(); | ^^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/moves/move-out-of-slice-1.nll.stderr b/src/test/ui/moves/move-out-of-slice-1.nll.stderr index c8c09b31d36b..b4b1fe97ca9d 100644 --- a/src/test/ui/moves/move-out-of-slice-1.nll.stderr +++ b/src/test/ui/moves/move-out-of-slice-1.nll.stderr @@ -3,13 +3,13 @@ error[E0508]: cannot move out of type `[A]`, a non-copy slice | LL | match a { | ^ cannot move out of here -LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice +LL | box [a] => {}, | - data moved here | note: move occurs because `a` has type `A`, which does not implement the `Copy` trait --> $DIR/move-out-of-slice-1.rs:8:14 | -LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice +LL | box [a] => {}, | ^ error: aborting due to previous error diff --git a/src/test/ui/moves/move-out-of-tuple-field.nll.stderr b/src/test/ui/moves/move-out-of-tuple-field.nll.stderr index 2efdc84ca37d..888ef3352e26 100644 --- a/src/test/ui/moves/move-out-of-tuple-field.nll.stderr +++ b/src/test/ui/moves/move-out-of-tuple-field.nll.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x.0` | LL | let y = x.0; | --- value moved here -LL | let z = x.0; //~ ERROR use of moved value: `x.0` +LL | let z = x.0; | ^^^ value used here after move | = note: move occurs because `x.0` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x.0` | LL | let y = x.0; | --- value moved here -LL | let z = x.0; //~ ERROR use of moved value: `x.0` +LL | let z = x.0; | ^^^ value used here after move | = note: move occurs because `x.0` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr index 6ad9a2d414c7..71a3c4506eaf 100644 --- a/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr @@ -5,7 +5,7 @@ LL | let x = vec!["hi".to_string()]; | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | consume(x.into_iter().next().unwrap()); | - value moved here -LL | touch(&x[0]); //~ ERROR use of moved value: `x` +LL | touch(&x[0]); | ^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr index 6950a56a5335..b83a15c9d4da 100644 --- a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/moves-based-on-type-block-bad.rs:24:19 | -LL | match hellothere.x { //~ ERROR cannot move out +LL | match hellothere.x { | ^^^^^^^^^^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr index bed0ae7275cc..3a05a1305bee 100644 --- a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr @@ -8,7 +8,7 @@ LL | thread::spawn(move|| { LL | println!("{}", x); | - variable moved due to use in closure LL | }); -LL | println!("{}", x); //~ ERROR use of moved value +LL | println!("{}", x); | ^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr index 5f0d2b42671d..fb8562d00ead 100644 --- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `node` LL | Some(right) => consume(right), | ----- value moved here ... -LL | consume(node) + r //~ ERROR use of partially moved value: `node` +LL | consume(node) + r | ^^^^ value used here after partial move | = note: move occurs because value has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr index 07f40274f9e3..25f88fe157ae 100644 --- a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr @@ -5,8 +5,8 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = Foo { f:x }; | - value moved here -LL | //~^ NOTE value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -16,8 +16,8 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = Foo { f:(((x))) }; | ------- value moved here -LL | //~^ NOTE value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | +LL | touch(&x); | ^^ value borrowed here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr b/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr index 162aec45f5f5..67fae606c4e4 100644 --- a/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr @@ -5,7 +5,7 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = Foo { f:x }; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -15,7 +15,7 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = (x, 3); | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -27,7 +27,7 @@ LL | let x = "hi".to_string(); LL | x | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `y` @@ -39,7 +39,7 @@ LL | let y = "ho".to_string(); LL | y | - value moved here ... -LL | touch(&y); //~ ERROR use of moved value: `y` +LL | touch(&y); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -51,7 +51,7 @@ LL | let x = "hi".to_string(); LL | true => x, | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `y` @@ -63,7 +63,7 @@ LL | let y = "ho".to_string(); LL | false => y | - value moved here ... -LL | touch(&y); //~ ERROR use of moved value: `y` +LL | touch(&y); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -75,7 +75,7 @@ LL | let x = "hi".to_string(); LL | _ if guard(x) => 10, | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -85,7 +85,7 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = [x]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -95,7 +95,7 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = vec![x]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -105,7 +105,7 @@ LL | let x = vec!["hi".to_string()]; | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | let _y = x.into_iter().next().unwrap(); | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -115,7 +115,7 @@ LL | let x = vec!["hi".to_string()]; | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | let _y = [x.into_iter().next().unwrap(); 1]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error: aborting due to 11 previous errors diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr b/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr index 6d523fc09c08..322999a1f0ff 100644 --- a/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `x` LL | Foo {f} => {} | - value moved here ... -LL | touch(&x); //~ ERROR use of partially moved value: `x` +LL | touch(&x); | ^^ value borrowed here after partial move | = note: move occurs because `x.f` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr index 7d410f6cabc8..0568a2e94a71 100644 --- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure | LL | let i = box 3; | - captured outer variable -LL | let _f = to_fn(|| test(i)); //~ ERROR cannot move out +LL | let _f = to_fn(|| test(i)); | ^ cannot move out of captured variable in an `Fn` closure error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr index 391dd67dbf60..dde54eee83b6 100644 --- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr @@ -16,7 +16,7 @@ LL | fn conspirator(mut f: F) where F: FnMut(&mut R, bool) { | consider adding a `Copy` constraint to this type argument LL | let mut r = R {c: Box::new(f)}; | - value moved here -LL | f(&mut r, false) //~ ERROR use of moved value +LL | f(&mut r, false) | ^ value borrowed here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/moves/moves-sru-moved-field.nll.stderr b/src/test/ui/moves/moves-sru-moved-field.nll.stderr index e5daab36f6ee..a012c2d9b7b7 100644 --- a/src/test/ui/moves/moves-sru-moved-field.nll.stderr +++ b/src/test/ui/moves/moves-sru-moved-field.nll.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `f.moved` | LL | let _b = Foo {noncopyable: g, ..f}; | ------------------------- value moved here -LL | let _c = Foo {noncopyable: h, ..f}; //~ ERROR use of moved value: `f.moved` +LL | let _c = Foo {noncopyable: h, ..f}; | ^^^^^^^^^^^^^^^^^^^^^^^^^ value used here after move | = note: move occurs because `f.moved` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/mut/mut-cant-alias.nll.stderr b/src/test/ui/mut/mut-cant-alias.nll.stderr index 2d7104b39c4b..d56e45db13d0 100644 --- a/src/test/ui/mut/mut-cant-alias.nll.stderr +++ b/src/test/ui/mut/mut-cant-alias.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `b` as mutable more than once at a time | LL | let b1 = &mut *b; | - first mutable borrow occurs here -LL | let b2 = &mut *b; //~ ERROR cannot borrow +LL | let b2 = &mut *b; | ^ second mutable borrow occurs here LL | b1.use_mut(); | -- first borrow later used here diff --git a/src/test/ui/mut/mutable-class-fields-2.nll.stderr b/src/test/ui/mut/mutable-class-fields-2.nll.stderr index 53127922263c..15323ce9a975 100644 --- a/src/test/ui/mut/mutable-class-fields-2.nll.stderr +++ b/src/test/ui/mut/mutable-class-fields-2.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `self.how_hungry` which is behind a `&` reference | LL | pub fn eat(&self) { | ----- help: consider changing this to be a mutable reference: `&mut self` -LL | self.how_hungry -= 5; //~ ERROR cannot assign +LL | self.how_hungry -= 5; | ^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error diff --git a/src/test/ui/nll/cannot-move-block-spans.nll.stderr b/src/test/ui/nll/cannot-move-block-spans.nll.stderr index 30b4bf75af69..5d50ed67e2f3 100644 --- a/src/test/ui/nll/cannot-move-block-spans.nll.stderr +++ b/src/test/ui/nll/cannot-move-block-spans.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:5:15 | -LL | let x = { *r }; //~ ERROR +LL | let x = { *r }; | ^^ | | | cannot move out of borrowed content @@ -10,7 +10,7 @@ LL | let x = { *r }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:6:22 | -LL | let y = unsafe { *r }; //~ ERROR +LL | let y = unsafe { *r }; | ^^ | | | cannot move out of borrowed content @@ -19,7 +19,7 @@ LL | let y = unsafe { *r }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:7:26 | -LL | let z = loop { break *r; }; //~ ERROR +LL | let z = loop { break *r; }; | ^^ | | | cannot move out of borrowed content @@ -28,7 +28,7 @@ LL | let z = loop { break *r; }; //~ ERROR error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:11:15 | -LL | let x = { arr[0] }; //~ ERROR +LL | let x = { arr[0] }; | ^^^^^^ | | | cannot move out of here @@ -37,7 +37,7 @@ LL | let x = { arr[0] }; //~ ERROR error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:12:22 | -LL | let y = unsafe { arr[0] }; //~ ERROR +LL | let y = unsafe { arr[0] }; | ^^^^^^ | | | cannot move out of here @@ -46,7 +46,7 @@ LL | let y = unsafe { arr[0] }; //~ ERROR error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:13:26 | -LL | let z = loop { break arr[0]; }; //~ ERROR +LL | let z = loop { break arr[0]; }; | ^^^^^^ | | | cannot move out of here @@ -55,7 +55,7 @@ LL | let z = loop { break arr[0]; }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:17:38 | -LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR +LL | let x = { let mut u = 0; u += 1; *r }; | ^^ | | | cannot move out of borrowed content @@ -64,7 +64,7 @@ LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:18:45 | -LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR +LL | let y = unsafe { let mut u = 0; u += 1; *r }; | ^^ | | | cannot move out of borrowed content @@ -73,7 +73,7 @@ LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:19:49 | -LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR +LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; | ^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/nll/issue-54556-niconii.nll.stderr b/src/test/ui/nll/issue-54556-niconii.nll.stderr index 58239fe6e888..40cd04de5ecc 100644 --- a/src/test/ui/nll/issue-54556-niconii.nll.stderr +++ b/src/test/ui/nll/issue-54556-niconii.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `counter` does not live long enough --> $DIR/issue-54556-niconii.rs:22:20 | -LL | if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough +LL | if let Ok(_) = counter.lock() { } | ^^^^^^^------- | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr b/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr index b58454427af8..0bf76485eef2 100644 --- a/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr +++ b/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `stmt` does not live long enough --> $DIR/issue-54556-stephaneyfx.rs:27:21 | -LL | let rows = Rows(&stmt); //~ ERROR does not live long enough +LL | let rows = Rows(&stmt); | ^^^^^ borrowed value does not live long enough LL | rows.map(|row| row).next() | ------------------- a temporary with access to the borrow is created here ... diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr index 1bc43017bc67..513dca7950af 100644 --- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr +++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `_thing1` does not live long enough --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:11 | -LL | D(&_thing1).end() //~ ERROR does not live long enough +LL | D(&_thing1).end() | --^^^^^^^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr b/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr index a13e59fa48b5..9f27fac15a7f 100644 --- a/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr +++ b/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here ... -LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/src/test/ui/nll/issue-55850.nll.stderr b/src/test/ui/nll/issue-55850.nll.stderr index e09711f74fd7..bf0c6986ef2c 100644 --- a/src/test/ui/nll/issue-55850.nll.stderr +++ b/src/test/ui/nll/issue-55850.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `s` does not live long enough --> $DIR/issue-55850.rs:28:16 | -LL | yield &s[..] //~ ERROR `s` does not live long enough [E0597] +LL | yield &s[..] | ^ borrowed value does not live long enough LL | }) | - `s` dropped here while still borrowed @@ -9,7 +9,7 @@ LL | }) error[E0626]: borrow may still be in use when generator yields --> $DIR/issue-55850.rs:28:16 | -LL | yield &s[..] //~ ERROR `s` does not live long enough [E0597] +LL | yield &s[..] | -------^---- possible yield occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/no-reuse-move-arc.nll.stderr b/src/test/ui/no-reuse-move-arc.nll.stderr index 0b14f65a7707..3f7169e6fcbb 100644 --- a/src/test/ui/no-reuse-move-arc.nll.stderr +++ b/src/test/ui/no-reuse-move-arc.nll.stderr @@ -9,7 +9,7 @@ LL | thread::spawn(move|| { LL | assert_eq!((*arc_v)[3], 4); | ----- variable moved due to use in closure ... -LL | assert_eq!((*arc_v)[2], 3); //~ ERROR use of moved value: `arc_v` +LL | assert_eq!((*arc_v)[2], 3); | ^^^^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/not-copy-closure.nll.stderr b/src/test/ui/not-copy-closure.nll.stderr index 1a65bcf44731..10bf570727fa 100644 --- a/src/test/ui/not-copy-closure.nll.stderr +++ b/src/test/ui/not-copy-closure.nll.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `hello` | LL | let b = hello; | ----- value moved here -LL | let c = hello; //~ ERROR use of moved value: `hello` [E0382] +LL | let c = hello; | ^^^^^ value used here after move | note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `a` out of its environment diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr b/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr index 0dd50b280267..1497aa42082d 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr +++ b/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined --> $DIR/object-safety-by-value-self-use.rs:15:5 | -LL | t.bar() //~ ERROR cannot move a value of type (dyn Bar + 'static) +LL | t.bar() | ^ error: aborting due to previous error diff --git a/src/test/ui/once-cant-call-twice-on-heap.nll.stderr b/src/test/ui/once-cant-call-twice-on-heap.nll.stderr index ea53abc1b0f2..f98d3d838453 100644 --- a/src/test/ui/once-cant-call-twice-on-heap.nll.stderr +++ b/src/test/ui/once-cant-call-twice-on-heap.nll.stderr @@ -7,7 +7,7 @@ LL | fn foo(blk: F) { | consider adding a `Copy` constraint to this type argument LL | blk(); | --- value moved here -LL | blk(); //~ ERROR use of moved value +LL | blk(); | ^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/ref-suggestion.nll.stderr b/src/test/ui/ref-suggestion.nll.stderr index 402f3c77cdb7..9ff8e21bb58b 100644 --- a/src/test/ui/ref-suggestion.nll.stderr +++ b/src/test/ui/ref-suggestion.nll.stderr @@ -5,7 +5,7 @@ LL | let x = vec![1]; | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | let y = x; | - value moved here -LL | x; //~ ERROR use of moved value +LL | x; | ^ value used here after move error[E0382]: use of moved value: `x` @@ -15,7 +15,7 @@ LL | let x = vec![1]; | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | let mut y = x; | - value moved here -LL | x; //~ ERROR use of moved value +LL | x; | ^ value used here after move error[E0382]: use of moved value: `x` @@ -24,7 +24,7 @@ error[E0382]: use of moved value: `x` LL | (Some(y), ()) => {}, | - value moved here ... -LL | x; //~ ERROR use of partially moved value +LL | x; | ^ value used here after partial move | = note: move occurs because value has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr b/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr index fa4c8a9dc6d8..bce310bafaa9 100644 --- a/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr +++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr @@ -3,8 +3,8 @@ warning: function cannot return without recursing | LL | fn call_rec(mut f: F) -> usize where F: FnMut(usize) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -LL | //~^ WARN function cannot return without recursing -LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` +LL | +LL | (|x| f(x))(call_rec(f)) | ----------- recursive call site | = note: #[warn(unconditional_recursion)] on by default @@ -13,7 +13,7 @@ LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` error[E0505]: cannot move out of `f` because it is borrowed --> $DIR/region-bound-on-closure-outlives-call.rs:3:25 | -LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` +LL | (|x| f(x))(call_rec(f)) | ---------- ^ move out of `f` occurs here | || | | || borrow occurs due to use in closure diff --git a/src/test/ui/regions/region-object-lifetime-5.nll.stderr b/src/test/ui/regions/region-object-lifetime-5.nll.stderr index c6d7135a2dbc..b86f6e3a2a12 100644 --- a/src/test/ui/regions/region-object-lifetime-5.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-5.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*x` --> $DIR/region-object-lifetime-5.rs:11:5 | -LL | x.borrowed() //~ ERROR `*x` does not live long enough +LL | x.borrowed() | -^^^^^^^^^^^ | | | returns a value referencing data owned by the current function diff --git a/src/test/ui/regions/regions-addr-of-arg.nll.stderr b/src/test/ui/regions/regions-addr-of-arg.nll.stderr index 0f60bc669b2d..54f44b98b919 100644 --- a/src/test/ui/regions/regions-addr-of-arg.nll.stderr +++ b/src/test/ui/regions/regions-addr-of-arg.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/regions-addr-of-arg.rs:5:30 | -LL | let _p: &'static isize = &a; //~ ERROR `a` does not live long enough +LL | let _p: &'static isize = &a; | -------------- ^^ borrowed value does not live long enough | | | type annotation requires that `a` is borrowed for `'static` @@ -11,7 +11,7 @@ LL | } error[E0515]: cannot return reference to function parameter `a` --> $DIR/regions-addr-of-arg.rs:13:5 | -LL | &a //~ ERROR `a` does not live long enough +LL | &a | ^^ returns a reference to data owned by the current function error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr b/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr index f188da5038d8..2c55634445d8 100644 --- a/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr +++ b/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr @@ -1,7 +1,7 @@ error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable --> $DIR/regions-adjusted-lvalue-op.rs:14:16 | -LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because +LL | v[0].oh_no(&v); | - ----- ^^ immutable borrow occurs here | | | | | mutable borrow later used by call @@ -10,7 +10,7 @@ LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable --> $DIR/regions-adjusted-lvalue-op.rs:15:16 | -LL | (*v).oh_no(&v); //~ ERROR cannot borrow `v` as immutable because +LL | (*v).oh_no(&v); | - ----- ^^ immutable borrow occurs here | | | | | mutable borrow later used by call diff --git a/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr index 0e68a0548e62..8e119c4f5355 100644 --- a/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-1.rs:12:5 | -LL | box B(&*v) as Box //~ ERROR `*v` does not live long enough +LL | box B(&*v) as Box | ^^^^^^---^^^^^^^^^^^ | | | | | `*v` is borrowed here diff --git a/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr index 6225575ddf3a..9ea13638f5ca 100644 --- a/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-3.rs:11:5 | -LL | box B(&*v) as Box //~ ERROR `*v` does not live long enough +LL | box B(&*v) as Box | ^^^^^^---^^^^^^^^^^^ | | | | | `*v` is borrowed here diff --git a/src/test/ui/regions/regions-creating-enums.nll.stderr b/src/test/ui/regions/regions-creating-enums.nll.stderr index fe4b97a33b5c..a95d84629013 100644 --- a/src/test/ui/regions/regions-creating-enums.nll.stderr +++ b/src/test/ui/regions/regions-creating-enums.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to temporary value --> $DIR/regions-creating-enums.rs:23:16 | -LL | return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Num((*f)(x)); | ^----------------- | || | |temporary value created here @@ -10,7 +10,7 @@ LL | return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live l error[E0515]: cannot return reference to temporary value --> $DIR/regions-creating-enums.rs:28:16 | -LL | return &Ast::Add(m_x, m_y); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Add(m_x, m_y); | ^------------------ | || | |temporary value created here diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr b/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr index 62f0ceba94f2..2c7a6e8b5c0b 100644 --- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr +++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*p` --> $DIR/regions-infer-borrow-scope-too-big.rs:13:12 | -LL | let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough +LL | let xc = x_coord(&*p); | --- `*p` is borrowed here LL | assert_eq!(*xc, 3); LL | return xc; diff --git a/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr b/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr index b44f8c1e7a8d..803d0d744910 100644 --- a/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr +++ b/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/regions-infer-proc-static-upvar.rs:10:13 | -LL | let y = &x; //~ ERROR `x` does not live long enough +LL | let y = &x; | ^^ borrowed value does not live long enough LL | / foo(move|| { LL | | let _a = *y; diff --git a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr index 48daff1dbd87..7984f4f0e546 100644 --- a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr +++ b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr @@ -3,7 +3,7 @@ error[E0515]: cannot return value referencing temporary value | LL | let testValue = &id(Test); | -------- temporary value created here -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | testValue | ^^^^^^^^^ returns a value referencing data owned by the current function @@ -12,7 +12,7 @@ error[E0515]: cannot return value referencing temporary value | LL | let testValue = &id(MyEnum::Variant1); | -------------------- temporary value created here -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | testValue | ^^^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/regions/regions-nested-fns-2.nll.stderr b/src/test/ui/regions/regions-nested-fns-2.nll.stderr index ebcc31d3a20e..8627dac54592 100644 --- a/src/test/ui/regions/regions-nested-fns-2.nll.stderr +++ b/src/test/ui/regions/regions-nested-fns-2.nll.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | |z| { | --- value captured here -LL | //~^ ERROR E0373 +LL | LL | if false { &y } else { z } | -^ | || diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr index 8809cf4b09e5..f77d94a24b88 100644 --- a/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr +++ b/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `line` does not live long enough --> $DIR/regions-pattern-typing-issue-19552.rs:5:14 | -LL | match [&*line] { //~ ERROR `line` does not live long enough +LL | match [&*line] { | ^^^^ borrowed value does not live long enough LL | [ word ] => { assert_static(word); } | ------------------- argument requires that `line` is borrowed for `'static` diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr index bead12356f1f..ccba6c59b616 100644 --- a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr +++ b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr @@ -3,13 +3,13 @@ error[E0515]: cannot return value referencing function parameter | LL | fn arg_item(box ref x: Box) -> &'static isize { | --------- function parameter borrowed here -LL | x //~^ ERROR borrowed value does not live long enough +LL | x | ^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing function parameter --> $DIR/regions-ref-in-fn-arg.rs:11:22 | -LL | with(|box ref x| x) //~ ERROR borrowed value does not live long enough +LL | with(|box ref x| x) | --------- ^ returns a value referencing data owned by the current function | | | function parameter borrowed here diff --git a/src/test/ui/regions/regions-ret.nll.stderr b/src/test/ui/regions/regions-ret.nll.stderr index b8b4ce56bb24..0e4875ac9855 100644 --- a/src/test/ui/regions/regions-ret.nll.stderr +++ b/src/test/ui/regions/regions-ret.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to temporary value --> $DIR/regions-ret.rs:4:12 | -LL | return &id(3); //~ ERROR borrowed value does not live long enough +LL | return &id(3); | ^----- | || | |temporary value created here diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr b/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr index 1bdcf83521d0..9d87fe266b15 100644 --- a/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr +++ b/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to temporary value --> $DIR/regions-return-stack-allocated-vec.rs:4:5 | -LL | &[x] //~ ERROR borrowed value does not live long enough +LL | &[x] | ^--- | || | |temporary value created here diff --git a/src/test/ui/regions/regions-steal-closure.nll.stderr b/src/test/ui/regions/regions-steal-closure.nll.stderr index c30f9c52363a..5b0efaf95597 100644 --- a/src/test/ui/regions/regions-steal-closure.nll.stderr +++ b/src/test/ui/regions/regions-steal-closure.nll.stderr @@ -4,7 +4,7 @@ error[E0597]: `i` does not live long enough LL | let mut cl_box = { | ---------- borrow later stored here LL | let mut i = 3; -LL | box_it(Box::new(|| i += 1)) //~ ERROR `i` does not live long enough +LL | box_it(Box::new(|| i += 1)) | -- ^ borrowed value does not live long enough | | | value captured here diff --git a/src/test/ui/regions/regions-trait-variance.nll.stderr b/src/test/ui/regions/regions-trait-variance.nll.stderr index ca05c93a7ece..56c9f89e1f59 100644 --- a/src/test/ui/regions/regions-trait-variance.nll.stderr +++ b/src/test/ui/regions/regions-trait-variance.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*b` --> $DIR/regions-trait-variance.rs:38:5 | -LL | let bb: &B = &*b; //~ ERROR `*b` does not live long enough +LL | let bb: &B = &*b; | --- `*b` is borrowed here LL | make_a(bb) | ^^^^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr index e38574e774d1..146fb8fd81fc 100644 --- a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr +++ b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/regions-var-type-out-of-scope.rs:9:14 | -LL | x = &id(3); //~ ERROR borrowed value does not live long enough +LL | x = &id(3); | ^^^^^- temporary value is freed at the end of this statement | | | creates a temporary which is freed while still in use diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr index 3a6f66ca4dac..04572920ee41 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr @@ -5,7 +5,7 @@ LL | while let Some(Ok(string)) = foo.get() { | --- immutable borrow occurs here LL | foo.mutate(); | ^^^^^^^^^^^^ mutable borrow occurs here -LL | //~^ ERROR cannot borrow `foo` as mutable +LL | LL | println!("foo={:?}", *string); | ------- immutable borrow later used here diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr index 5920be4132a9..d6a89006bc0f 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr @@ -1,19 +1,19 @@ error[E0594]: cannot assign to `*x` which is behind a `&` reference --> $DIR/enum.rs:9:5 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*x` which is behind a `&` reference --> $DIR/enum.rs:13:9 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*x` which is behind a `&` reference --> $DIR/enum.rs:19:9 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr index 2206c2f340e1..a6f2f3ec3096 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr @@ -1,19 +1,19 @@ error[E0594]: cannot assign to `*n` which is behind a `&` reference --> $DIR/explicit-mut.rs:7:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*n` which is behind a `&` reference --> $DIR/explicit-mut.rs:15:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*n` which is behind a `&` reference --> $DIR/explicit-mut.rs:23:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr index 5a730ad2be42..5f0b3a1d40b7 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr @@ -5,7 +5,7 @@ LL | let a = NoCopy(0); | - move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait LL | let _ = dbg!(a); | ------- value moved here -LL | let _ = dbg!(a); //~ ERROR use of moved value +LL | let _ = dbg!(a); | ^ value used here after move | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/slice-mut-2.nll.stderr b/src/test/ui/slice-mut-2.nll.stderr index eeef23e694b7..bad0268772b7 100644 --- a/src/test/ui/slice-mut-2.nll.stderr +++ b/src/test/ui/slice-mut-2.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference LL | let x: &[isize] = &[1, 2, 3, 4, 5]; | ---------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4, 5]` ... -LL | let _ = &mut x[2..4]; //~ERROR cannot borrow immutable borrowed content `*x` as mutable +LL | let _ = &mut x[2..4]; | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr index 0aa44fa3a3ae..0a9bc3ac51c6 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn deref_mut_field1(x: Own) { | - help: consider changing this to be mutable: `mut x` -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn deref_extend_mut_field1(x: &Own) -> &mut isize { | ----------- help: consider changing this to be a mutable reference: `&mut Own` -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time @@ -19,7 +19,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let _x = &mut x.x; | - first mutable borrow occurs here -LL | let _y = &mut x.y; //~ ERROR cannot borrow +LL | let _y = &mut x.y; | ^ second mutable borrow occurs here LL | use_mut(_x); | -- first borrow later used here @@ -29,7 +29,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn assign_field1<'a>(x: Own) { | - help: consider changing this to be mutable: `mut x` -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -37,7 +37,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn assign_field2<'a>(x: &'a Own) { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time @@ -45,7 +45,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let _p: &mut Point = &mut **x; | -- first mutable borrow occurs here -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ second mutable borrow occurs here LL | use_mut(_p); | -- first borrow later used here @@ -55,7 +55,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn deref_mut_method1(x: Own) { | - help: consider changing this to be mutable: `mut x` -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -63,7 +63,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn deref_extend_mut_method1(x: &Own) -> &mut isize { | ----------- help: consider changing this to be a mutable reference: `&mut Own` -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -71,7 +71,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn assign_method1<'a>(x: Own) { | - help: consider changing this to be mutable: `mut x` -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -79,7 +79,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn assign_method2<'a>(x: &'a Own) { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 10 previous errors diff --git a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr index ef80e4bc3d64..3ebfba7e4deb 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn deref_mut1(x: Own) { | - help: consider changing this to be mutable: `mut x` -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn deref_extend_mut1<'a>(x: &'a Own) -> &'a mut isize { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -19,7 +19,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn assign1<'a>(x: Own) { | - help: consider changing this to be mutable: `mut x` -LL | *x = 3; //~ ERROR cannot borrow +LL | *x = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -27,7 +27,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn assign2<'a>(x: &'a Own) { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` -LL | **x = 3; //~ ERROR cannot borrow +LL | **x = 3; | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 4 previous errors diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr index e752a467edcf..80dc3ef2f80f 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr @@ -6,7 +6,7 @@ LL | f(Box::new(|| { | | | first mutable borrow occurs here | first borrow later used by call -LL | //~^ ERROR: cannot borrow `f` as mutable more than once +LL | LL | f((Box::new(|| {}))) | - second borrow occurs due to use of `f` in closure diff --git a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr index 16c482b575aa..6b5e0779e5fa 100644 --- a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr +++ b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference LL | fn b(x: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut Foo` LL | x.f(); -LL | x.h(); //~ ERROR cannot borrow +LL | x.h(); | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/span/borrowck-object-mutability.nll.stderr b/src/test/ui/span/borrowck-object-mutability.nll.stderr index 1a5802e98114..fe6014cd5ad8 100644 --- a/src/test/ui/span/borrowck-object-mutability.nll.stderr +++ b/src/test/ui/span/borrowck-object-mutability.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference LL | fn borrowed_receiver(x: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut dyn Foo` LL | x.borrowed(); -LL | x.borrowed_mut(); //~ ERROR cannot borrow +LL | x.borrowed_mut(); | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable @@ -13,7 +13,7 @@ error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable LL | fn owned_receiver(x: Box) { | - help: consider changing this to be mutable: `mut x` LL | x.borrowed(); -LL | x.borrowed_mut(); //~ ERROR cannot borrow +LL | x.borrowed_mut(); | ^ cannot borrow as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/span/destructor-restrictions.nll.stderr b/src/test/ui/span/destructor-restrictions.nll.stderr index 981c5a23816f..a3c6cfb6ae44 100644 --- a/src/test/ui/span/destructor-restrictions.nll.stderr +++ b/src/test/ui/span/destructor-restrictions.nll.stderr @@ -6,7 +6,7 @@ LL | *a.borrow() + 1 | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... -LL | }; //~^ ERROR `*a` does not live long enough +LL | }; | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::cell::Ref<'_, i32>` | | | `*a` dropped here while still borrowed diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr b/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr index 5774ac13cb7e..07ae138ac71e 100644 --- a/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr +++ b/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr @@ -17,7 +17,7 @@ error[E0597]: `d1` does not live long enough | LL | d2.p.set(Some(&d1)); | ^^^ borrowed value does not live long enough -LL | //~^ ERROR `d1` does not live long enough +LL | LL | } | - | | diff --git a/src/test/ui/span/issue-11925.nll.stderr b/src/test/ui/span/issue-11925.nll.stderr index f5e329f6c397..1d317fc331f7 100644 --- a/src/test/ui/span/issue-11925.nll.stderr +++ b/src/test/ui/span/issue-11925.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to local data `x` --> $DIR/issue-11925.rs:8:35 | -LL | let f = to_fn_once(move|| &x); //~ ERROR does not live long enough +LL | let f = to_fn_once(move|| &x); | ^^ returns a reference to data owned by the current function error: aborting due to previous error diff --git a/src/test/ui/span/mut-arg-hint.nll.stderr b/src/test/ui/span/mut-arg-hint.nll.stderr index e0fa3c3a1e6f..8027cf69cf4b 100644 --- a/src/test/ui/span/mut-arg-hint.nll.stderr +++ b/src/test/ui/span/mut-arg-hint.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference | LL | fn foo(mut a: &String) { | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -LL | a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("bar"); | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference | LL | pub fn foo<'a>(mut a: &'a String) { | ---------- help: consider changing this to be a mutable reference: `&'a mut String` -LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("foo"); | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference @@ -19,7 +19,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference | LL | pub fn foo(mut a: &String) { | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("foo"); | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr b/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr index d3ba848fe6bb..21b29464df50 100644 --- a/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr +++ b/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr @@ -5,7 +5,7 @@ LL | p = &*b; | ^ borrowed value does not live long enough LL | } | - `b` dropped here while still borrowed -LL | //~^^ ERROR `b` does not live long enough +LL | LL | p.use_ref(); | - borrow later used here diff --git a/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr b/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr index e07fb7277821..284981e93419 100644 --- a/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr +++ b/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr @@ -3,9 +3,9 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let mut _y = vec![&mut x]; | ------ borrow of `x` occurs here -LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed +LL | while x < 10 { | ^ use of borrowed `x` -LL | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed +LL | let mut z = x; LL | _y.push(&mut z); | -- borrow later used here @@ -14,8 +14,8 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let mut _y = vec![&mut x]; | ------ borrow of `x` occurs here -LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed -LL | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed +LL | while x < 10 { +LL | let mut z = x; | ^ use of borrowed `x` LL | _y.push(&mut z); | -- borrow later used here @@ -39,8 +39,8 @@ LL | let mut _y = vec![&mut x]; ... LL | _y.push(&mut z); | -- borrow later used here -LL | //~^ ERROR `z` does not live long enough -LL | x += 1; //~ ERROR cannot assign +LL | +LL | x += 1; | ^^^^^^ use of borrowed `x` error: aborting due to 4 previous errors diff --git a/src/test/ui/span/send-is-not-static-std-sync.nll.stderr b/src/test/ui/span/send-is-not-static-std-sync.nll.stderr index 54960c16405d..93473a86b5a5 100644 --- a/src/test/ui/span/send-is-not-static-std-sync.nll.stderr +++ b/src/test/ui/span/send-is-not-static-std-sync.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | *lock.lock().unwrap() = &*y; | --- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here ... LL | *lock.lock().unwrap() = &z; @@ -16,7 +16,7 @@ LL | *lock.lock().unwrap() = &z; | ^^ borrowed value does not live long enough LL | } | - `z` dropped here while still borrowed -LL | //~^^ ERROR `z` does not live long enough +LL | LL | lock.use_ref(); // (Mutex is #[may_dangle] so its dtor does not use `z` => needs explicit use) | ---- borrow later used here @@ -25,7 +25,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | *lock.write().unwrap() = &*y; | --- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here ... LL | *lock.write().unwrap() = &z; @@ -38,7 +38,7 @@ LL | *lock.write().unwrap() = &z; | ^^ borrowed value does not live long enough LL | } | - `z` dropped here while still borrowed -LL | //~^^ ERROR `z` does not live long enough +LL | LL | lock.use_ref(); // (RwLock is #[may_dangle] so its dtor does not use `z` => needs explicit use) | ---- borrow later used here @@ -47,7 +47,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | tx.send(&*y); | --- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here ... LL | tx.send(&z).unwrap(); diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr b/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr index c5e2ca2e28f3..f87c32d1ad0c 100644 --- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr +++ b/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr @@ -17,7 +17,7 @@ error[E0597]: `c1` does not live long enough | LL | c2.v[0].v.set(Some(&c1)); | ^^^ borrowed value does not live long enough -LL | //~^ ERROR `c1` does not live long enough +LL | LL | } | - | | diff --git a/src/test/ui/static/static-lifetime-bound.nll.stderr b/src/test/ui/static/static-lifetime-bound.nll.stderr index 9a8a344cbd87..90d728204e70 100644 --- a/src/test/ui/static/static-lifetime-bound.nll.stderr +++ b/src/test/ui/static/static-lifetime-bound.nll.stderr @@ -1,7 +1,7 @@ warning: unnecessary lifetime parameter `'a` --> $DIR/static-lifetime-bound.rs:1:6 | -LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a` +LL | fn f<'a: 'static>(_: &'a i32) {} | ^^^^^^^^^^^ | = help: you can use the `'static` lifetime directly, in place of `'a` @@ -9,7 +9,7 @@ LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a error[E0597]: `x` does not live long enough --> $DIR/static-lifetime-bound.rs:5:7 | -LL | f(&x); //~ERROR does not live long enough +LL | f(&x); | --^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/static/static-reference-to-fn-2.nll.stderr b/src/test/ui/static/static-reference-to-fn-2.nll.stderr index 2e00c9491d7c..07c8b48eb1d9 100644 --- a/src/test/ui/static/static-reference-to-fn-2.nll.stderr +++ b/src/test/ui/static/static-reference-to-fn-2.nll.stderr @@ -37,7 +37,7 @@ error[E0515]: cannot return value referencing temporary value LL | / StateMachineIter { LL | | statefn: &id(state1 as StateMachineFunc) | | ------------------------------ temporary value created here -LL | | //~^ ERROR borrowed value does not live long enough +LL | | LL | | } | |_____^ returns a value referencing data owned by the current function diff --git a/src/test/ui/static/static-region-bound.nll.stderr b/src/test/ui/static/static-region-bound.nll.stderr index 0a5686051cda..15261259ed41 100644 --- a/src/test/ui/static/static-region-bound.nll.stderr +++ b/src/test/ui/static/static-region-bound.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/static-region-bound.rs:10:14 | -LL | let x = &id(3); //~ ERROR borrowed value does not live long enough +LL | let x = &id(3); | ^^^^^ creates a temporary which is freed while still in use LL | f(x); | ---- argument requires that borrow lasts for `'static` diff --git a/src/test/ui/std-uncopyable-atomics.nll.stderr b/src/test/ui/std-uncopyable-atomics.nll.stderr index 0a5e7c64b1a8..8241f6f1fdbc 100644 --- a/src/test/ui/std-uncopyable-atomics.nll.stderr +++ b/src/test/ui/std-uncopyable-atomics.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:9:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -10,7 +10,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:11:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -19,7 +19,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:13:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -28,7 +28,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:15:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/thread-local-mutation.nll.stderr b/src/test/ui/thread-local-mutation.nll.stderr index 0a3664b0d9d4..e5dc0e72edfc 100644 --- a/src/test/ui/thread-local-mutation.nll.stderr +++ b/src/test/ui/thread-local-mutation.nll.stderr @@ -1,7 +1,7 @@ error[E0594]: cannot assign to immutable static item `S` --> $DIR/thread-local-mutation.rs:11:5 | -LL | S = "after"; //~ ERROR cannot assign to immutable +LL | S = "after"; | ^^^^^^^^^^^ cannot assign error: aborting due to previous error diff --git a/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr b/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr index 6092a9dc10d3..4ee3e4cacc37 100644 --- a/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr +++ b/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `person` does not live long enough --> $DIR/trait-coercion-generic-regions.rs:17:24 | -LL | let person: &str = &person; //~ ERROR `person` does not live long enough +LL | let person: &str = &person; | ^^^^^^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr index 8b86dd9a4c92..aac119afda54 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference | LL | fn reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- help: consider changing this to be a mutable reference: `&'a mut &'a mut i32` -LL | *t //~ ERROR +LL | *t | ^^ `t` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference | LL | fn copy_reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- help: consider changing this to be a mutable reference: `&'a mut &'a mut i32` -LL | {*t} //~ ERROR +LL | {*t} | ^^ `t` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr index 0e996902d621..934d057ea092 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move +LL | let f = to_fn(|| drop(x)); | ^ cannot move out of captured variable in an `Fn` closure error[E0507]: cannot move out of captured variable in an `FnMut` closure @@ -11,7 +11,7 @@ error[E0507]: cannot move out of captured variable in an `FnMut` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn_mut(|| drop(x)); //~ ERROR cannot move +LL | let f = to_fn_mut(|| drop(x)); | ^ cannot move out of captured variable in an `FnMut` closure error[E0507]: cannot move out of captured variable in an `Fn` closure @@ -19,7 +19,7 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move +LL | let f = to_fn(move || drop(x)); | ^ cannot move out of captured variable in an `Fn` closure error[E0507]: cannot move out of captured variable in an `FnMut` closure @@ -27,7 +27,7 @@ error[E0507]: cannot move out of captured variable in an `FnMut` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move +LL | let f = to_fn_mut(move || drop(x)); | ^ cannot move out of captured variable in an `FnMut` closure error: aborting due to 4 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr index 51a0a6e57564..3e7f79040fe8 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` -LL | move || x = 1; //~ ERROR cannot assign +LL | move || x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -11,8 +11,8 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` -LL | move || x = 1; //~ ERROR cannot assign -LL | move || set(&mut x); //~ ERROR cannot borrow +LL | move || x = 1; +LL | move || set(&mut x); | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -21,7 +21,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | move || x = 1; //~ ERROR cannot assign +LL | move || x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -30,7 +30,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | move || set(&mut x); //~ ERROR cannot borrow +LL | move || set(&mut x); | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -39,7 +39,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | || x = 1; //~ ERROR cannot assign +LL | || x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -48,7 +48,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | || set(&mut x); //~ ERROR cannot assign +LL | || set(&mut x); | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -57,7 +57,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | || x = 1; //~ ERROR cannot assign +LL | || x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -66,7 +66,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | || set(&mut x); //~ ERROR cannot assign +LL | || set(&mut x); | ^^^^^^ cannot borrow as mutable error: aborting due to 8 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr index 1c55a6bb08eb..b40b2f67d9ba 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr @@ -4,7 +4,7 @@ error[E0597]: `x` does not live long enough LL | let _f = { | -- borrow later stored here LL | let x = 0; -LL | || x //~ ERROR `x` does not live long enough +LL | || x | -- ^ borrowed value does not live long enough | | | value captured here diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr index a47d33d29e15..21d6b4fde7e9 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr @@ -5,7 +5,7 @@ LL | let f = || x += 1; | -- - borrow occurs due to use of `x` in closure | | | borrow of `x` occurs here -LL | let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed +LL | let _y = x; | ^ use of borrowed `x` LL | f; | - borrow later used here diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr index 1749c20b582b..19cb2cb73381 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr @@ -34,7 +34,7 @@ LL | let mut factorial: Option u32 + 'static>> = None; LL | LL | let f = |x: u32| -> u32 { | --------------- value captured here -LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial` +LL | LL | let g = factorial.as_ref().unwrap(); | ^^^^^^^^^ borrowed value does not live long enough ... @@ -49,7 +49,7 @@ LL | let mut factorial: Option u32 + 'static>> = None; LL | LL | let f = |x: u32| -> u32 { | --------------- borrow of `factorial` occurs here -LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial` +LL | LL | let g = factorial.as_ref().unwrap(); | --------- borrow occurs due to use in closure ... diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr index 89ac402b5e02..1e1172cdbf2f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr @@ -10,10 +10,10 @@ LL | tick1(); error[E0596]: cannot borrow `tick2` as mutable, as it is not declared as mutable --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:20:5 | -LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1` +LL | let tick2 = || { | ----- help: consider changing this to be mutable: `mut tick2` ... -LL | tick2(); //~ ERROR cannot borrow +LL | tick2(); | ^^^^^ cannot borrow as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr index 9c0a71e73f52..eb398628846d 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable | LL | let tick = || counter += 1; | ---- help: consider changing this to be mutable: `mut tick` -LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable +LL | tick(); | ^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr index fa3426a1f709..b9d76d9a752c 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable | LL | let tick = move || counter += 1; | ---- help: consider changing this to be mutable: `mut tick` -LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable +LL | tick(); | ^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr index 9b2f1cd4ae33..6bba38510b67 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `n`, as it is not declared as mutable | LL | let n = 0; | - help: consider changing this to be mutable: `mut n` -LL | let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign +LL | let mut f = to_fn_mut(|| { LL | n += 1; | ^^^^^^ cannot assign @@ -13,7 +13,7 @@ error[E0594]: cannot assign to `n`, as it is not declared as mutable LL | let n = 0; | - help: consider changing this to be mutable: `mut n` ... -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ cannot assign error[E0594]: cannot assign to `n`, as it is not declared as mutable @@ -22,13 +22,13 @@ error[E0594]: cannot assign to `n`, as it is not declared as mutable LL | let n = 0; | - help: consider changing this to be mutable: `mut n` LL | let mut f = to_fn(move || { -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ cannot assign error[E0594]: cannot assign to `n`, as it is a captured variable in a `Fn` closure --> $DIR/unboxed-closures-mutate-upvar.rs:53:9 | -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -36,7 +36,7 @@ help: consider changing this to accept closures that implement `FnMut` | LL | let mut f = to_fn(move || { | _______________________^ -LL | | n += 1; //~ ERROR cannot assign +LL | | n += 1; LL | | }); | |_____^ diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr index 29d161fe150e..70860c822ebd 100644 --- a/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr +++ b/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borr | LL | let a = &mut u.x.0; | ---------- mutable borrow occurs here (via `u.x.0`) -LL | let b = &u.y; //~ ERROR cannot borrow `u.y` +LL | let b = &u.y; | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0` -- occurs here LL | use_borrow(a); | - mutable borrow later used here @@ -17,7 +17,7 @@ LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; | - move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = u.x.0; | ----- value moved here -LL | let b = u.y; //~ ERROR use of moved value: `u.y` +LL | let b = u.y; | ^^^ value used here after move error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0.0`) @@ -25,7 +25,7 @@ error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borr | LL | let a = &mut (u.x.0).0; | -------------- mutable borrow occurs here (via `u.x.0.0`) -LL | let b = &u.y; //~ ERROR cannot borrow `u.y` +LL | let b = &u.y; | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0.0` -- occurs here LL | use_borrow(a); | - mutable borrow later used here @@ -39,7 +39,7 @@ LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; | - move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = (u.x.0).0; | --------- value moved here -LL | let b = u.y; //~ ERROR use of moved value: `u.y` +LL | let b = u.y; | ^^^ value used here after move error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `*u.y`) @@ -47,7 +47,7 @@ error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borr | LL | let a = &mut *u.y; | --------- mutable borrow occurs here (via `*u.y`) -LL | let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`) +LL | let b = &u.x; | ^^^^ immutable borrow of `u.x` -- which overlaps with `*u.y` -- occurs here LL | use_borrow(a); | - mutable borrow later used here @@ -61,7 +61,7 @@ LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; | - move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = *u.y; | ---- value moved here -LL | let b = u.x; //~ ERROR use of moved value: `u.x` +LL | let b = u.x; | ^^^ value used here after move error: aborting due to 6 previous errors diff --git a/src/test/ui/unop-move-semantics.nll.stderr b/src/test/ui/unop-move-semantics.nll.stderr index 58953d55b1fb..c11445c8adf5 100644 --- a/src/test/ui/unop-move-semantics.nll.stderr +++ b/src/test/ui/unop-move-semantics.nll.stderr @@ -8,7 +8,7 @@ LL | fn move_then_borrow + Clone>(x: T) { LL | !x; | - value moved here LL | -LL | x.clone(); //~ ERROR: use of moved value +LL | x.clone(); | ^ value borrowed here after move error[E0505]: cannot move out of `x` because it is borrowed @@ -17,7 +17,7 @@ error[E0505]: cannot move out of `x` because it is borrowed LL | let m = &x; | -- borrow of `x` occurs here ... -LL | !x; //~ ERROR: cannot move out of `x` because it is borrowed +LL | !x; | ^ move out of `x` occurs here ... LL | use_mut(n); use_imm(m); @@ -29,7 +29,7 @@ error[E0505]: cannot move out of `y` because it is borrowed LL | let n = &mut y; | ------ borrow of `y` occurs here ... -LL | !y; //~ ERROR: cannot move out of `y` because it is borrowed +LL | !y; | ^ move out of `y` occurs here LL | use_mut(n); use_imm(m); | - borrow later used here @@ -37,13 +37,13 @@ LL | use_mut(n); use_imm(m); error[E0507]: cannot move out of borrowed content --> $DIR/unop-move-semantics.rs:24:6 | -LL | !*m; //~ ERROR: cannot move out of borrowed content +LL | !*m; | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/unop-move-semantics.rs:26:6 | -LL | !*n; //~ ERROR: cannot move out of borrowed content +LL | !*n; | ^^ cannot move out of borrowed content error: aborting due to 5 previous errors diff --git a/src/test/ui/unsized-locals/double-move.nll.stderr b/src/test/ui/unsized-locals/double-move.nll.stderr index c0c3e436f535..47fa0d4a437b 100644 --- a/src/test/ui/unsized-locals/double-move.nll.stderr +++ b/src/test/ui/unsized-locals/double-move.nll.stderr @@ -5,7 +5,7 @@ LL | let y = *x; | - move occurs because `y` has type `str`, which does not implement the `Copy` trait LL | drop_unsized(y); | - value moved here -LL | drop_unsized(y); //~ERROR use of moved value +LL | drop_unsized(y); | ^ value used here after move error[E0382]: use of moved value: `x` @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = *x; | -- value moved here -LL | drop_unsized(x); //~ERROR use of moved value +LL | drop_unsized(x); | ^ value used here after partial move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait @@ -25,7 +25,7 @@ LL | let x = "hello".to_owned().into_boxed_str(); | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | drop_unsized(x); | - value moved here -LL | let _y = *x; //~ERROR use of moved value +LL | let _y = *x; | ^^ value used here after move error[E0382]: use of moved value: `y` @@ -35,7 +35,7 @@ LL | let y = *x; | - move occurs because `y` has type `str`, which does not implement the `Copy` trait LL | y.foo(); | - value moved here -LL | y.foo(); //~ERROR use of moved value +LL | y.foo(); | ^ value used here after move error[E0382]: use of moved value: `*x` @@ -43,7 +43,7 @@ error[E0382]: use of moved value: `*x` | LL | let _y = *x; | -- value moved here -LL | x.foo(); //~ERROR use of moved value +LL | x.foo(); | ^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait @@ -53,7 +53,7 @@ error[E0382]: use of moved value: `*x` | LL | x.foo(); | - value moved here -LL | let _y = *x; //~ERROR use of moved value +LL | let _y = *x; | ^^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait diff --git a/src/test/ui/use/use-after-move-based-on-type.nll.stderr b/src/test/ui/use/use-after-move-based-on-type.nll.stderr index 8160ada9d62e..520f88f55dc1 100644 --- a/src/test/ui/use/use-after-move-based-on-type.nll.stderr +++ b/src/test/ui/use/use-after-move-based-on-type.nll.stderr @@ -5,7 +5,7 @@ LL | let x = "Hello!".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = x; | - value moved here -LL | println!("{}", x); //~ ERROR use of moved value +LL | println!("{}", x); | ^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr b/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr index 4119741d805c..9bf1175430c8 100644 --- a/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr +++ b/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr @@ -5,7 +5,7 @@ LL | pub fn foo(self) -> isize { | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait LL | self.bar(); | ---- value moved here -LL | return self.x; //~ ERROR use of moved value: `self.x` +LL | return self.x; | ^^^^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/use/use-after-move-self.nll.stderr b/src/test/ui/use/use-after-move-self.nll.stderr index e2ce3690cb90..3be0a65550b7 100644 --- a/src/test/ui/use/use-after-move-self.nll.stderr +++ b/src/test/ui/use/use-after-move-self.nll.stderr @@ -5,7 +5,7 @@ LL | pub fn foo(self) -> isize { | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait LL | self.bar(); | ---- value moved here -LL | return *self.x; //~ ERROR use of moved value: `*self.x` +LL | return *self.x; | ^^^^^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/variance/variance-issue-20533.nll.stderr b/src/test/ui/variance/variance-issue-20533.nll.stderr index 469adaf6f0ee..008e2a002bbb 100644 --- a/src/test/ui/variance/variance-issue-20533.nll.stderr +++ b/src/test/ui/variance/variance-issue-20533.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = foo(&a); | -- borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here LL | drop(x); | - borrow later used here @@ -13,7 +13,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = bar(&a); | -- borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here LL | drop(x); | - borrow later used here @@ -23,7 +23,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = baz(&a); | -- borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here LL | drop(x); | - borrow later used here diff --git a/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr b/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr index c77be26f0193..679fd8997733 100644 --- a/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr +++ b/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr @@ -6,7 +6,7 @@ LL | for x in &mut xs { | | | first mutable borrow occurs here | first borrow later used here -LL | xs.push(1) //~ ERROR cannot borrow `xs` +LL | xs.push(1) | ^^ second mutable borrow occurs here error: aborting due to previous error diff --git a/src/test/ui/walk-struct-literal-with.nll.stderr b/src/test/ui/walk-struct-literal-with.nll.stderr index 2263747607b9..eeb594a21f38 100644 --- a/src/test/ui/walk-struct-literal-with.nll.stderr +++ b/src/test/ui/walk-struct-literal-with.nll.stderr @@ -5,7 +5,7 @@ LL | let start = Mine{test:"Foo".to_string(), other_val:0}; | ----- move occurs because `start` has type `Mine`, which does not implement the `Copy` trait LL | let end = Mine{other_val:1, ..start.make_string_bar()}; | ----- value moved here -LL | println!("{}", start.test); //~ ERROR use of moved value: `start.test` +LL | println!("{}", start.test); | ^^^^^^^^^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr index 21ac2031d040..fc58984345a9 100644 --- a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr +++ b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing temporary value --> $DIR/wf-misc-methods-issue-28609.rs:22:5 | -LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough +LL | s.transmute_inherent(&mut 42) | ^^^^^^^^^^^^^^^^^^^^^^^^^^--^ | | | | | temporary value created here @@ -10,7 +10,7 @@ LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough error[E0515]: cannot return value referencing local variable `four` --> $DIR/wf-misc-methods-issue-28609.rs:36:5 | -LL | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | s.bomb = Some(&four); | ----- `four` is borrowed here LL | &s | ^^ returns a value referencing data owned by the current function @@ -18,7 +18,7 @@ LL | &s error[E0515]: cannot return value referencing local variable `four` --> $DIR/wf-misc-methods-issue-28609.rs:43:5 | -LL | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | s.bomb = Some(&four); | ----- `four` is borrowed here LL | &*s | ^^^ returns a value referencing data owned by the current function @@ -26,7 +26,7 @@ LL | &*s error[E0515]: cannot return value referencing temporary value --> $DIR/wf-misc-methods-issue-28609.rs:53:5 | -LL | s << &mut 3 //~ ERROR does not live long enough +LL | s << &mut 3 | ^^^^^^^^^^- | | | | | temporary value created here @@ -35,7 +35,7 @@ LL | s << &mut 3 //~ ERROR does not live long enough error[E0515]: cannot return value referencing temporary value --> $DIR/wf-misc-methods-issue-28609.rs:58:5 | -LL | s.shl(&mut 3) //~ ERROR does not live long enough +LL | s.shl(&mut 3) | ^^^^^^^^^^^-^ | | | | | temporary value created here @@ -44,7 +44,7 @@ LL | s.shl(&mut 3) //~ ERROR does not live long enough error[E0515]: cannot return value referencing temporary value --> $DIR/wf-misc-methods-issue-28609.rs:63:5 | -LL | S2::shl(s, &mut 3) //~ ERROR does not live long enough +LL | S2::shl(s, &mut 3) | ^^^^^^^^^^^^^^^^-^ | | | | | temporary value created here diff --git a/src/test/ui/writing-to-immutable-vec.nll.stderr b/src/test/ui/writing-to-immutable-vec.nll.stderr index 6ec56f90ca47..a65765c86c8b 100644 --- a/src/test/ui/writing-to-immutable-vec.nll.stderr +++ b/src/test/ui/writing-to-immutable-vec.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable | LL | let v: Vec = vec![1, 2, 3]; | - help: consider changing this to be mutable: `mut v` -LL | v[1] = 4; //~ ERROR cannot borrow immutable local variable `v` as mutable +LL | v[1] = 4; | ^ cannot borrow as mutable error: aborting due to previous error From 07f99b9fec4ba0c549596e8e7d99553e86763d35 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Mon, 11 Mar 2019 23:30:10 +0300 Subject: [PATCH 343/381] Update tests that don't run on my platform --- src/test/ui/error-codes/E0161.stderr | 16 ---------- src/test/ui/parser/mod_file_not_exist.stderr | 2 +- ...regions-free-region-ordering-caller.stderr | 32 ------------------- .../ui/wasm-custom-section-relocations.stderr | 4 +-- 4 files changed, 3 insertions(+), 51 deletions(-) delete mode 100644 src/test/ui/error-codes/E0161.stderr delete mode 100644 src/test/ui/regions/regions-free-region-ordering-caller.stderr diff --git a/src/test/ui/error-codes/E0161.stderr b/src/test/ui/error-codes/E0161.stderr deleted file mode 100644 index 0135e495c16b..000000000000 --- a/src/test/ui/error-codes/E0161.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0161]: cannot move a value of type str: the size of str cannot be statically determined - --> $DIR/E0161.rs:14:28 - | -LL | let _x: Box = box *"hello"; //~ ERROR E0161 - | ^^^^^^^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/E0161.rs:14:28 - | -LL | let _x: Box = box *"hello"; //~ ERROR E0161 - | ^^^^^^^^ cannot move out of borrowed content - -error: aborting due to 2 previous errors - -Some errors occurred: E0161, E0507. -For more information about an error, try `rustc --explain E0161`. diff --git a/src/test/ui/parser/mod_file_not_exist.stderr b/src/test/ui/parser/mod_file_not_exist.stderr index f7f0e2d2d116..dadf4b29dcf3 100644 --- a/src/test/ui/parser/mod_file_not_exist.stderr +++ b/src/test/ui/parser/mod_file_not_exist.stderr @@ -1,7 +1,7 @@ error[E0583]: file not found for module `not_a_real_file` --> $DIR/mod_file_not_exist.rs:3:5 | -LL | mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file` +LL | mod not_a_real_file; | ^^^^^^^^^^^^^^^ | = help: name the file either not_a_real_file.rs or not_a_real_file/mod.rs inside the directory "$DIR" diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.stderr deleted file mode 100644 index 67ee950ae8f5..000000000000 --- a/src/test/ui/regions/regions-free-region-ordering-caller.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-caller.rs:8:12 - | -LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { - | --------- --------- - | | - | these two types are declared with different lifetimes... -LL | let z: Option<&'b &'a usize> = None;//~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here - -error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-caller.rs:13:12 - | -LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { - | --------- --------- - | | - | these two types are declared with different lifetimes... -LL | let y: Paramd<'a> = Paramd { x: a }; -LL | let z: Option<&'b Paramd<'a>> = None;//~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here - -error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-caller.rs:17:12 - | -LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { - | --------- --------- these two types are declared with different lifetimes... -LL | let z: Option<&'a &'b usize> = None;//~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^^^^^ ...but data from `b` flows into `a` here - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/wasm-custom-section-relocations.stderr b/src/test/ui/wasm-custom-section-relocations.stderr index 272dd8d524d6..eb8ab2644a33 100644 --- a/src/test/ui/wasm-custom-section-relocations.stderr +++ b/src/test/ui/wasm-custom-section-relocations.stderr @@ -1,13 +1,13 @@ error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references --> $DIR/wasm-custom-section-relocations.rs:4:1 | -LL | pub static A: &[u8] = &[1]; //~ ERROR: no extra levels of indirection +LL | pub static A: &[u8] = &[1]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references --> $DIR/wasm-custom-section-relocations.rs:13:1 | -LL | pub static D: &usize = &C; //~ ERROR: no extra levels of indirection +LL | pub static D: &usize = &C; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors From 95fc3f47672a417d9027b61a4604d42e462f311e Mon Sep 17 00:00:00 2001 From: Chris Gregory Date: Sun, 10 Mar 2019 01:02:38 -0500 Subject: [PATCH 344/381] Standardize `Range*` documentation This updates the final example in the documentation for the types `Range`, `RangeFrom`, `RangeFull`, `RangeInclusive`, `RangeTo`, `RangeToInclusive`. --- src/libcore/ops/range.rs | 68 +++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 998b597d5e11..2552cf3a9748 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -26,11 +26,13 @@ use hash::{Hash, Hasher}; /// Used as a [slicing index], `RangeFull` produces the full array as a slice. /// /// ``` -/// let arr = [0, 1, 2, 3]; -/// assert_eq!(arr[ .. ], [0,1,2,3]); // RangeFull -/// assert_eq!(arr[ ..3], [0,1,2 ]); -/// assert_eq!(arr[1.. ], [ 1,2,3]); -/// assert_eq!(arr[1..3], [ 1,2 ]); +/// let arr = [0, 1, 2, 3, 4]; +/// assert_eq!(arr[ .. ], [0,1,2,3,4]); // RangeFull +/// assert_eq!(arr[ .. 3], [0,1,2 ]); +/// assert_eq!(arr[ ..=3], [0,1,2,3 ]); +/// assert_eq!(arr[1.. ], [ 1,2,3,4]); +/// assert_eq!(arr[1.. 3], [ 1,2 ]); +/// assert_eq!(arr[1..=3], [ 1,2,3 ]); /// ``` /// /// [`IntoIterator`]: ../iter/trait.Iterator.html @@ -60,11 +62,13 @@ impl fmt::Debug for RangeFull { /// assert_eq!((3..5), std::ops::Range { start: 3, end: 5 }); /// assert_eq!(3 + 4 + 5, (3..6).sum()); /// -/// let arr = ['a', 'b', 'c', 'd']; -/// assert_eq!(arr[ .. ], ['a', 'b', 'c', 'd']); -/// assert_eq!(arr[ ..3], ['a', 'b', 'c', ]); -/// assert_eq!(arr[1.. ], [ 'b', 'c', 'd']); -/// assert_eq!(arr[1..3], [ 'b', 'c' ]); // Range +/// let arr = [0, 1, 2, 3, 4]; +/// assert_eq!(arr[ .. ], [0,1,2,3,4]); +/// assert_eq!(arr[ .. 3], [0,1,2 ]); +/// assert_eq!(arr[ ..=3], [0,1,2,3 ]); +/// assert_eq!(arr[1.. ], [ 1,2,3,4]); +/// assert_eq!(arr[1.. 3], [ 1,2 ]); // Range +/// assert_eq!(arr[1..=3], [ 1,2,3 ]); /// ``` #[doc(alias = "..")] #[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186 @@ -160,11 +164,13 @@ impl> Range { /// assert_eq!((2..), std::ops::RangeFrom { start: 2 }); /// assert_eq!(2 + 3 + 4, (2..).take(3).sum()); /// -/// let arr = [0, 1, 2, 3]; -/// assert_eq!(arr[ .. ], [0,1,2,3]); -/// assert_eq!(arr[ ..3], [0,1,2 ]); -/// assert_eq!(arr[1.. ], [ 1,2,3]); // RangeFrom -/// assert_eq!(arr[1..3], [ 1,2 ]); +/// let arr = [0, 1, 2, 3, 4]; +/// assert_eq!(arr[ .. ], [0,1,2,3,4]); +/// assert_eq!(arr[ .. 3], [0,1,2 ]); +/// assert_eq!(arr[ ..=3], [0,1,2,3 ]); +/// assert_eq!(arr[1.. ], [ 1,2,3,4]); // RangeFrom +/// assert_eq!(arr[1.. 3], [ 1,2 ]); +/// assert_eq!(arr[1..=3], [ 1,2,3 ]); /// ``` /// /// [`Iterator`]: ../iter/trait.IntoIterator.html @@ -240,11 +246,13 @@ impl> RangeFrom { /// elements before the index indicated by `end`. /// /// ``` -/// let arr = [0, 1, 2, 3]; -/// assert_eq!(arr[ .. ], [0,1,2,3]); -/// assert_eq!(arr[ ..3], [0,1,2 ]); // RangeTo -/// assert_eq!(arr[1.. ], [ 1,2,3]); -/// assert_eq!(arr[1..3], [ 1,2 ]); +/// let arr = [0, 1, 2, 3, 4]; +/// assert_eq!(arr[ .. ], [0,1,2,3,4]); +/// assert_eq!(arr[ .. 3], [0,1,2 ]); // RangeTo +/// assert_eq!(arr[ ..=3], [0,1,2,3 ]); +/// assert_eq!(arr[1.. ], [ 1,2,3,4]); +/// assert_eq!(arr[1.. 3], [ 1,2 ]); +/// assert_eq!(arr[1..=3], [ 1,2,3 ]); /// ``` /// /// [`IntoIterator`]: ../iter/trait.Iterator.html @@ -312,9 +320,13 @@ impl> RangeTo { /// assert_eq!((3..=5), std::ops::RangeInclusive::new(3, 5)); /// assert_eq!(3 + 4 + 5, (3..=5).sum()); /// -/// let arr = [0, 1, 2, 3]; -/// assert_eq!(arr[ ..=2], [0,1,2 ]); -/// assert_eq!(arr[1..=2], [ 1,2 ]); // RangeInclusive +/// let arr = [0, 1, 2, 3, 4]; +/// assert_eq!(arr[ .. ], [0,1,2,3,4]); +/// assert_eq!(arr[ .. 3], [0,1,2 ]); +/// assert_eq!(arr[ ..=3], [0,1,2,3 ]); +/// assert_eq!(arr[1.. ], [ 1,2,3,4]); +/// assert_eq!(arr[1.. 3], [ 1,2 ]); +/// assert_eq!(arr[1..=3], [ 1,2,3 ]); // RangeInclusive /// ``` #[doc(alias = "..=")] #[derive(Clone)] // not Copy -- see #27186 @@ -569,9 +581,13 @@ impl> RangeInclusive { /// array elements up to and including the index indicated by `end`. /// /// ``` -/// let arr = [0, 1, 2, 3]; -/// assert_eq!(arr[ ..=2], [0,1,2 ]); // RangeToInclusive -/// assert_eq!(arr[1..=2], [ 1,2 ]); +/// let arr = [0, 1, 2, 3, 4]; +/// assert_eq!(arr[ .. ], [0,1,2,3,4]); +/// assert_eq!(arr[ .. 3], [0,1,2 ]); +/// assert_eq!(arr[ ..=3], [0,1,2,3 ]); // RangeToInclusive +/// assert_eq!(arr[1.. ], [ 1,2,3,4]); +/// assert_eq!(arr[1.. 3], [ 1,2 ]); +/// assert_eq!(arr[1..=3], [ 1,2,3 ]); /// ``` /// /// [`IntoIterator`]: ../iter/trait.Iterator.html From c46f75882f2c16de5956b64d186fea2968c303b6 Mon Sep 17 00:00:00 2001 From: Chris Gregory Date: Sun, 10 Mar 2019 01:21:30 -0500 Subject: [PATCH 345/381] Fix RangeBounds documentation to include inclusive operations --- src/libcore/ops/range.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 2552cf3a9748..81a8d001dd9c 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -692,7 +692,7 @@ pub enum Bound { #[stable(feature = "collections_range", since = "1.28.0")] /// `RangeBounds` is implemented by Rust's built-in range types, produced -/// by range syntax like `..`, `a..`, `..b` or `c..d`. +/// by range syntax like `..`, `a..`, `..b`, `..=c`, `d..e`, or `f..=g`. pub trait RangeBounds { /// Start index bound. /// From 6b88c905046411fc906faac634f133f6e70bc92c Mon Sep 17 00:00:00 2001 From: Chris Gregory Date: Mon, 11 Mar 2019 21:04:34 -0400 Subject: [PATCH 346/381] impl FromIterator for Result: Use assert_eq! instead of assert! --- src/libcore/result.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 92d29f6ee8a3..2bd6b536301e 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -1200,7 +1200,7 @@ impl> FromIterator> for Result { /// let res: Result, &'static str> = v.iter().map(|x: &u32| /// x.checked_add(1).ok_or("Overflow!") /// ).collect(); - /// assert!(res == Ok(vec![2, 3])); + /// assert_eq!(res, Ok(vec![2, 3])); /// ``` #[inline] fn from_iter>>(iter: I) -> Result { From 365d918b31421c13fcbdd19b387b592b404e1282 Mon Sep 17 00:00:00 2001 From: Sayan Nandan <17377258+sntdevco@users.noreply.github.com> Date: Tue, 12 Mar 2019 10:08:57 +0530 Subject: [PATCH 347/381] Replace assert with assert_eq for better debugging --- src/libcore/tests/fmt/num.rs | 236 +++++++++++++++++------------------ 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/src/libcore/tests/fmt/num.rs b/src/libcore/tests/fmt/num.rs index 6d9494ec289a..10fcf8b76ccb 100644 --- a/src/libcore/tests/fmt/num.rs +++ b/src/libcore/tests/fmt/num.rs @@ -3,146 +3,146 @@ fn test_format_int() { // Formatting integers should select the right implementation based off // the type of the argument. Also, hex/octal/binary should be defined // for integers, but they shouldn't emit the negative sign. - assert!(format!("{}", 1isize) == "1"); - assert!(format!("{}", 1i8) == "1"); - assert!(format!("{}", 1i16) == "1"); - assert!(format!("{}", 1i32) == "1"); - assert!(format!("{}", 1i64) == "1"); - assert!(format!("{}", -1isize) == "-1"); - assert!(format!("{}", -1i8) == "-1"); - assert!(format!("{}", -1i16) == "-1"); - assert!(format!("{}", -1i32) == "-1"); - assert!(format!("{}", -1i64) == "-1"); - assert!(format!("{:?}", 1isize) == "1"); - assert!(format!("{:?}", 1i8) == "1"); - assert!(format!("{:?}", 1i16) == "1"); - assert!(format!("{:?}", 1i32) == "1"); - assert!(format!("{:?}", 1i64) == "1"); - assert!(format!("{:b}", 1isize) == "1"); - assert!(format!("{:b}", 1i8) == "1"); - assert!(format!("{:b}", 1i16) == "1"); - assert!(format!("{:b}", 1i32) == "1"); - assert!(format!("{:b}", 1i64) == "1"); - assert!(format!("{:x}", 1isize) == "1"); - assert!(format!("{:x}", 1i8) == "1"); - assert!(format!("{:x}", 1i16) == "1"); - assert!(format!("{:x}", 1i32) == "1"); - assert!(format!("{:x}", 1i64) == "1"); - assert!(format!("{:X}", 1isize) == "1"); - assert!(format!("{:X}", 1i8) == "1"); - assert!(format!("{:X}", 1i16) == "1"); - assert!(format!("{:X}", 1i32) == "1"); - assert!(format!("{:X}", 1i64) == "1"); - assert!(format!("{:o}", 1isize) == "1"); - assert!(format!("{:o}", 1i8) == "1"); - assert!(format!("{:o}", 1i16) == "1"); - assert!(format!("{:o}", 1i32) == "1"); - assert!(format!("{:o}", 1i64) == "1"); + assert_eq!(format!("{}", 1isize), "1"); + assert_eq!(format!("{}", 1i8), "1"); + assert_eq!(format!("{}", 1i16), "1"); + assert_eq!(format!("{}", 1i32), "1"); + assert_eq!(format!("{}", 1i64), "1"); + assert_eq!(format!("{}", -1isize), "-1"); + assert_eq!(format!("{}", -1i8), "-1"); + assert_eq!(format!("{}", -1i16), "-1"); + assert_eq!(format!("{}", -1i32), "-1"); + assert_eq!(format!("{}", -1i64), "-1"); + assert_eq!(format!("{:?}", 1isize), "1"); + assert_eq!(format!("{:?}", 1i8), "1"); + assert_eq!(format!("{:?}", 1i16), "1"); + assert_eq!(format!("{:?}", 1i32), "1"); + assert_eq!(format!("{:?}", 1i64), "1"); + assert_eq!(format!("{:b}", 1isize), "1"); + assert_eq!(format!("{:b}", 1i8), "1"); + assert_eq!(format!("{:b}", 1i16), "1"); + assert_eq!(format!("{:b}", 1i32), "1"); + assert_eq!(format!("{:b}", 1i64), "1"); + assert_eq!(format!("{:x}", 1isize), "1"); + assert_eq!(format!("{:x}", 1i8), "1"); + assert_eq!(format!("{:x}", 1i16), "1"); + assert_eq!(format!("{:x}", 1i32), "1"); + assert_eq!(format!("{:x}", 1i64), "1"); + assert_eq!(format!("{:X}", 1isize), "1"); + assert_eq!(format!("{:X}", 1i8), "1"); + assert_eq!(format!("{:X}", 1i16), "1"); + assert_eq!(format!("{:X}", 1i32), "1"); + assert_eq!(format!("{:X}", 1i64), "1"); + assert_eq!(format!("{:o}", 1isize), "1"); + assert_eq!(format!("{:o}", 1i8), "1"); + assert_eq!(format!("{:o}", 1i16), "1"); + assert_eq!(format!("{:o}", 1i32), "1"); + assert_eq!(format!("{:o}", 1i64), "1"); - assert!(format!("{}", 1usize) == "1"); - assert!(format!("{}", 1u8) == "1"); - assert!(format!("{}", 1u16) == "1"); - assert!(format!("{}", 1u32) == "1"); - assert!(format!("{}", 1u64) == "1"); - assert!(format!("{:?}", 1usize) == "1"); - assert!(format!("{:?}", 1u8) == "1"); - assert!(format!("{:?}", 1u16) == "1"); - assert!(format!("{:?}", 1u32) == "1"); - assert!(format!("{:?}", 1u64) == "1"); - assert!(format!("{:b}", 1usize) == "1"); - assert!(format!("{:b}", 1u8) == "1"); - assert!(format!("{:b}", 1u16) == "1"); - assert!(format!("{:b}", 1u32) == "1"); - assert!(format!("{:b}", 1u64) == "1"); - assert!(format!("{:x}", 1usize) == "1"); - assert!(format!("{:x}", 1u8) == "1"); - assert!(format!("{:x}", 1u16) == "1"); - assert!(format!("{:x}", 1u32) == "1"); - assert!(format!("{:x}", 1u64) == "1"); - assert!(format!("{:X}", 1usize) == "1"); - assert!(format!("{:X}", 1u8) == "1"); - assert!(format!("{:X}", 1u16) == "1"); - assert!(format!("{:X}", 1u32) == "1"); - assert!(format!("{:X}", 1u64) == "1"); - assert!(format!("{:o}", 1usize) == "1"); - assert!(format!("{:o}", 1u8) == "1"); - assert!(format!("{:o}", 1u16) == "1"); - assert!(format!("{:o}", 1u32) == "1"); - assert!(format!("{:o}", 1u64) == "1"); + assert_eq!(format!("{}", 1usize), "1"); + assert_eq!(format!("{}", 1u8), "1"); + assert_eq!(format!("{}", 1u16), "1"); + assert_eq!(format!("{}", 1u32), "1"); + assert_eq!(format!("{}", 1u64), "1"); + assert_eq!(format!("{:?}", 1usize), "1"); + assert_eq!(format!("{:?}", 1u8), "1"); + assert_eq!(format!("{:?}", 1u16), "1"); + assert_eq!(format!("{:?}", 1u32), "1"); + assert_eq!(format!("{:?}", 1u64), "1"); + assert_eq!(format!("{:b}", 1usize), "1"); + assert_eq!(format!("{:b}", 1u8), "1"); + assert_eq!(format!("{:b}", 1u16), "1"); + assert_eq!(format!("{:b}", 1u32), "1"); + assert_eq!(format!("{:b}", 1u64), "1"); + assert_eq!(format!("{:x}", 1usize), "1"); + assert_eq!(format!("{:x}", 1u8), "1"); + assert_eq!(format!("{:x}", 1u16), "1"); + assert_eq!(format!("{:x}", 1u32), "1"); + assert_eq!(format!("{:x}", 1u64), "1"); + assert_eq!(format!("{:X}", 1usize), "1"); + assert_eq!(format!("{:X}", 1u8), "1"); + assert_eq!(format!("{:X}", 1u16), "1"); + assert_eq!(format!("{:X}", 1u32), "1"); + assert_eq!(format!("{:X}", 1u64), "1"); + assert_eq!(format!("{:o}", 1usize), "1"); + assert_eq!(format!("{:o}", 1u8), "1"); + assert_eq!(format!("{:o}", 1u16), "1"); + assert_eq!(format!("{:o}", 1u32), "1"); + assert_eq!(format!("{:o}", 1u64), "1"); // Test a larger number - assert!(format!("{:b}", 55) == "110111"); - assert!(format!("{:o}", 55) == "67"); - assert!(format!("{}", 55) == "55"); - assert!(format!("{:x}", 55) == "37"); - assert!(format!("{:X}", 55) == "37"); + assert_eq!(format!("{:b}", 55), "110111"); + assert_eq!(format!("{:o}", 55), "67"); + assert_eq!(format!("{}", 55), "55"); + assert_eq!(format!("{:x}", 55), "37"); + assert_eq!(format!("{:X}", 55), "37"); } #[test] fn test_format_int_zero() { - assert!(format!("{}", 0) == "0"); - assert!(format!("{:?}", 0) == "0"); - assert!(format!("{:b}", 0) == "0"); - assert!(format!("{:o}", 0) == "0"); - assert!(format!("{:x}", 0) == "0"); - assert!(format!("{:X}", 0) == "0"); + assert_eq!(format!("{}", 0), "0"); + assert_eq!(format!("{:?}", 0), "0"); + assert_eq!(format!("{:b}", 0), "0"); + assert_eq!(format!("{:o}", 0), "0"); + assert_eq!(format!("{:x}", 0), "0"); + assert_eq!(format!("{:X}", 0), "0"); - assert!(format!("{}", 0u32) == "0"); - assert!(format!("{:?}", 0u32) == "0"); - assert!(format!("{:b}", 0u32) == "0"); - assert!(format!("{:o}", 0u32) == "0"); - assert!(format!("{:x}", 0u32) == "0"); - assert!(format!("{:X}", 0u32) == "0"); + assert_eq!(format!("{}", 0u32), "0"); + assert_eq!(format!("{:?}", 0u32), "0"); + assert_eq!(format!("{:b}", 0u32), "0"); + assert_eq!(format!("{:o}", 0u32), "0"); + assert_eq!(format!("{:x}", 0u32), "0"); + assert_eq!(format!("{:X}", 0u32), "0"); } #[test] fn test_format_int_flags() { - assert!(format!("{:3}", 1) == " 1"); - assert!(format!("{:>3}", 1) == " 1"); - assert!(format!("{:>+3}", 1) == " +1"); - assert!(format!("{:<3}", 1) == "1 "); - assert!(format!("{:#}", 1) == "1"); - assert!(format!("{:#x}", 10) == "0xa"); - assert!(format!("{:#X}", 10) == "0xA"); - assert!(format!("{:#5x}", 10) == " 0xa"); - assert!(format!("{:#o}", 10) == "0o12"); - assert!(format!("{:08x}", 10) == "0000000a"); - assert!(format!("{:8x}", 10) == " a"); - assert!(format!("{:<8x}", 10) == "a "); - assert!(format!("{:>8x}", 10) == " a"); - assert!(format!("{:#08x}", 10) == "0x00000a"); - assert!(format!("{:08}", -10) == "-0000010"); - assert!(format!("{:x}", !0u8) == "ff"); - assert!(format!("{:X}", !0u8) == "FF"); - assert!(format!("{:b}", !0u8) == "11111111"); - assert!(format!("{:o}", !0u8) == "377"); - assert!(format!("{:#x}", !0u8) == "0xff"); - assert!(format!("{:#X}", !0u8) == "0xFF"); - assert!(format!("{:#b}", !0u8) == "0b11111111"); - assert!(format!("{:#o}", !0u8) == "0o377"); + assert_eq!(format!("{:3}", 1), " 1"); + assert_eq!(format!("{:>3}", 1), " 1"); + assert_eq!(format!("{:>+3}", 1), " +1"); + assert_eq!(format!("{:<3}", 1), "1 "); + assert_eq!(format!("{:#}", 1), "1"); + assert_eq!(format!("{:#x}", 10), "0xa"); + assert_eq!(format!("{:#X}", 10), "0xA"); + assert_eq!(format!("{:#5x}", 10), " 0xa"); + assert_eq!(format!("{:#o}", 10), "0o12"); + assert_eq!(format!("{:08x}", 10), "0000000a"); + assert_eq!(format!("{:8x}", 10), " a"); + assert_eq!(format!("{:<8x}", 10), "a "); + assert_eq!(format!("{:>8x}", 10), " a"); + assert_eq!(format!("{:#08x}", 10), "0x00000a"); + assert_eq!(format!("{:08}", -10), "-0000010"); + assert_eq!(format!("{:x}", !0u8), "ff"); + assert_eq!(format!("{:X}", !0u8), "FF"); + assert_eq!(format!("{:b}", !0u8), "11111111"); + assert_eq!(format!("{:o}", !0u8), "377"); + assert_eq!(format!("{:#x}", !0u8), "0xff"); + assert_eq!(format!("{:#X}", !0u8), "0xFF"); + assert_eq!(format!("{:#b}", !0u8), "0b11111111"); + assert_eq!(format!("{:#o}", !0u8), "0o377"); } #[test] fn test_format_int_sign_padding() { - assert!(format!("{:+5}", 1) == " +1"); - assert!(format!("{:+5}", -1) == " -1"); - assert!(format!("{:05}", 1) == "00001"); - assert!(format!("{:05}", -1) == "-0001"); - assert!(format!("{:+05}", 1) == "+0001"); - assert!(format!("{:+05}", -1) == "-0001"); + assert_eq!(format!("{:+5}", 1), " +1"); + assert_eq!(format!("{:+5}", -1), " -1"); + assert_eq!(format!("{:05}", 1), "00001"); + assert_eq!(format!("{:05}", -1), "-0001"); + assert_eq!(format!("{:+05}", 1), "+0001"); + assert_eq!(format!("{:+05}", -1), "-0001"); } #[test] fn test_format_int_twos_complement() { - use core::{i8, i16, i32, i64}; - assert!(format!("{}", i8::MIN) == "-128"); - assert!(format!("{}", i16::MIN) == "-32768"); - assert!(format!("{}", i32::MIN) == "-2147483648"); - assert!(format!("{}", i64::MIN) == "-9223372036854775808"); + use core::{i16, i32, i64, i8}; + assert_eq!(format!("{}", i8::MIN), "-128"); + assert_eq!(format!("{}", i16::MIN), "-32768"); + assert_eq!(format!("{}", i32::MIN), "-2147483648"); + assert_eq!(format!("{}", i64::MIN), "-9223372036854775808"); } #[test] fn test_format_debug_hex() { - assert!(format!("{:02x?}", b"Foo\0") == "[46, 6f, 6f, 00]"); - assert!(format!("{:02X?}", b"Foo\0") == "[46, 6F, 6F, 00]"); + assert_eq!(format!("{:02x?}", b"Foo\0"), "[46, 6f, 6f, 00]"); + assert_eq!(format!("{:02X?}", b"Foo\0"), "[46, 6F, 6F, 00]"); } From 0a03ca74935efab546298a8394a0ed0b31ccb646 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Tue, 12 Mar 2019 13:00:50 +0100 Subject: [PATCH 348/381] Addressed review feedback regarding comment phrasing. --- src/librustc_passes/ast_validation.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index 1dc589215929..b85429cd3cfd 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -64,8 +64,8 @@ struct AstValidator<'a> { is_impl_trait_banned: bool, // rust-lang/rust#57979: the ban of nested `impl Trait` was buggy - // until sometime after PR #57730 landed: it would jump directly - // to walk_ty rather than visit_ty (or skip recurring entirely for + // until PRs #57730 and #57981 landed: it would jump directly to + // walk_ty rather than visit_ty (or skip recurring entirely for // impl trait in projections), and thus miss some cases. We track // whether we should downgrade to a warning for short-term via // these booleans. From 2027459f77eb38450374367bc2335d5162cc1bcf Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Tue, 12 Mar 2019 21:35:20 +0900 Subject: [PATCH 349/381] Visit impl Trait for dead_code lint --- src/librustc/middle/dead.rs | 13 ++++++++++++- src/test/ui/lint/lint-dead-code-impl-trait.rs | 18 ++++++++++++++++++ .../ui/lint/lint-dead-code-impl-trait.stderr | 14 ++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/lint/lint-dead-code-impl-trait.rs create mode 100644 src/test/ui/lint/lint-dead-code-impl-trait.stderr diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 8ffd119f95c0..94de999c25da 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -3,7 +3,7 @@ // from live codes are live, and everything else is dead. use crate::hir::Node; -use crate::hir::{self, PatKind}; +use crate::hir::{self, PatKind, TyKind}; use crate::hir::intravisit::{self, Visitor, NestedVisitorMap}; use crate::hir::itemlikevisit::ItemLikeVisitor; @@ -282,6 +282,17 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> { self.handle_definition(path.def); intravisit::walk_path(self, path); } + + fn visit_ty(&mut self, ty: &'tcx hir::Ty) { + match ty.node { + TyKind::Def(item_id, _) => { + let item = self.tcx.hir().expect_item(item_id.id); + intravisit::walk_item(self, item); + } + _ => () + } + intravisit::walk_ty(self, ty); + } } fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>, diff --git a/src/test/ui/lint/lint-dead-code-impl-trait.rs b/src/test/ui/lint/lint-dead-code-impl-trait.rs new file mode 100644 index 000000000000..a2736d97308a --- /dev/null +++ b/src/test/ui/lint/lint-dead-code-impl-trait.rs @@ -0,0 +1,18 @@ +#![deny(dead_code)] + +trait Trait { + type Type; +} + +impl Trait for () { + type Type = (); +} + +type Used = (); +type Unused = (); //~ ERROR type alias is never used + +fn foo() -> impl Trait {} + +fn main() { + foo(); +} diff --git a/src/test/ui/lint/lint-dead-code-impl-trait.stderr b/src/test/ui/lint/lint-dead-code-impl-trait.stderr new file mode 100644 index 000000000000..61d0954bf314 --- /dev/null +++ b/src/test/ui/lint/lint-dead-code-impl-trait.stderr @@ -0,0 +1,14 @@ +error: type alias is never used: `Unused` + --> $DIR/lint-dead-code-impl-trait.rs:12:1 + | +LL | type Unused = (); + | ^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint-dead-code-impl-trait.rs:1:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: aborting due to previous error + From 7fcdb93cf55ad7ddfd07f5265b363379ae16b3b6 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 12 Mar 2019 13:41:12 +0100 Subject: [PATCH 350/381] Note that NonNull does not launder shared references for mutation --- src/libcore/ptr.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 53d419760306..a3cf8b63483f 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -2874,6 +2874,15 @@ impl<'a, T: ?Sized> From> for Unique { /// Usually this won't be necessary; covariance is correct for most safe abstractions, /// such as Box, Rc, Arc, Vec, and LinkedList. This is the case because they /// provide a public API that follows the normal shared XOR mutable rules of Rust. +/// +/// Notice that `NonNull` has a `From` instance for `&T`. However, this does +/// not change the fact that mutating through a (pointer derived from a) shared +/// reference is undefined behavior unless the mutation happens inside an +/// [`UnsafeCell`]. When using this `From` instance without an `UnsafeCell`, +/// it is your responsibility to ensure that `as_mut` is never called, and `as_ptr` +/// is never used for mutation. +/// +/// [`UnsafeCell`]: ../cell/struct.UnsafeCell.html #[stable(feature = "nonnull", since = "1.25.0")] #[repr(transparent)] #[rustc_layout_scalar_valid_range_start(1)] From 8ec8639bf3f8c7b17d91028f698abc3067cd56ea Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 12 Mar 2019 13:44:09 +0100 Subject: [PATCH 351/381] expand --- src/libcore/ptr.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index a3cf8b63483f..19648fe76cf9 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -2878,7 +2878,8 @@ impl<'a, T: ?Sized> From> for Unique { /// Notice that `NonNull` has a `From` instance for `&T`. However, this does /// not change the fact that mutating through a (pointer derived from a) shared /// reference is undefined behavior unless the mutation happens inside an -/// [`UnsafeCell`]. When using this `From` instance without an `UnsafeCell`, +/// [`UnsafeCell`]. The same goes for creating a mutable reference from a shared +/// reference. When using this `From` instance without an `UnsafeCell`, /// it is your responsibility to ensure that `as_mut` is never called, and `as_ptr` /// is never used for mutation. /// From 4632e3345b77b3262dd2b33654d9d11d0fc0912d Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 12 Mar 2019 10:52:29 -0400 Subject: [PATCH 352/381] add a useful debug printout --- src/librustc/traits/fulfill.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index 7648bde1d3c8..8c684c0775ee 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -275,6 +275,8 @@ impl<'a, 'b, 'gcx, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'gcx, self.selcx.infcx().resolve_type_vars_if_possible(&obligation.predicate); } + debug!("process_obligation: obligation = {:?}", obligation); + match obligation.predicate { ty::Predicate::Trait(ref data) => { let trait_obligation = obligation.with(data.clone()); From 261daf27c9e4b9332ac8d17fc4f9997fcd1ded3f Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 12 Mar 2019 10:57:06 -0400 Subject: [PATCH 353/381] ignore higher-ranked WF requirements for trait objects In the `issue-53548` test added in this commit, the `Box` type is expanded to `Box`, but the generator "witness" that results is `for<'r> { Box }`. The WF code was encountering an ICE (when debug-assertions were enabled) and an unexpected compilation error (without debug-asserions) when trying to process this `'r` region bound. In particular, to be WF, the region bound must meet the requirements of the trait, and hence we got `for<'r> { 'r: 'static }`. This would ICE because the `Binder` constructor we were using was assering that no higher-ranked regions were involved (because the WF code is supposed to skip those). The error (if debug-asserions were disabled) came because we obviously cannot prove that `'r: 'static` for any region `'r`. Pursuant with our "lazy WF" strategy for higher-ranked regions, the fix is not to require that `for<'r> { 'r: 'static }` holds (this is also analogous to what we would do for higher-ranked regions appearing within the trait in other positions). --- src/librustc/ty/wf.rs | 3 +- src/test/ui/generator/issue-53548-1.rs | 20 +++++++++++++ src/test/ui/generator/issue-53548.rs | 39 ++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 src/test/ui/generator/issue-53548-1.rs create mode 100644 src/test/ui/generator/issue-53548.rs diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index 599d38bc4ab6..fa35416cdd49 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -482,8 +482,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { // // Note: in fact we only permit builtin traits, not `Bar<'d>`, I // am looking forward to the future here. - - if !data.has_escaping_bound_vars() { + if !data.has_escaping_bound_vars() && !region.has_escaping_bound_vars() { let implicit_bounds = object_region_bounds(self.infcx.tcx, data); diff --git a/src/test/ui/generator/issue-53548-1.rs b/src/test/ui/generator/issue-53548-1.rs new file mode 100644 index 000000000000..df11800731c7 --- /dev/null +++ b/src/test/ui/generator/issue-53548-1.rs @@ -0,0 +1,20 @@ +// A variant of #53548 that does not actually require generators, +// but which encountered the same ICE/error. See `issue-53548.rs` +// for details. +// +// compile-pass + +use std::cell::RefCell; +use std::rc::Rc; + +trait Trait: 'static {} + +struct Store { + inner: Rc>>, +} + +fn main() { + let store = Store:: fn(&(dyn Trait + 'a))>> { + inner: Default::default(), + }; +} diff --git a/src/test/ui/generator/issue-53548.rs b/src/test/ui/generator/issue-53548.rs new file mode 100644 index 000000000000..00fdb91faab7 --- /dev/null +++ b/src/test/ui/generator/issue-53548.rs @@ -0,0 +1,39 @@ +// Regression test for #53548. The `Box` type below is +// expanded to `Box`, but the generator "witness" +// that results is `for<'r> { Box }`. The WF code was +// encountering an ICE (when debug-assertions were enabled) and an +// unexpected compilation error (without debug-asserions) when trying +// to process this `'r` region bound. In particular, to be WF, the +// region bound must meet the requirements of the trait, and hence we +// got `for<'r> { 'r: 'static }`. This would ICE because the `Binder` +// constructor we were using was assering that no higher-ranked +// regions were involved (because the WF code is supposed to skip +// those). The error (if debug-asserions were disabled) came because +// we obviously cannot prove that `'r: 'static` for any region `'r`. +// Pursuant with our "lazy WF" strategy for higher-ranked regions, the +// fix is not to require that `for<'r> { 'r: 'static }` holds (this is +// also analogous to what we would do for higher-ranked regions +// appearing within the trait in other positions). +// +// compile-pass + +#![feature(generators)] + +use std::cell::RefCell; +use std::rc::Rc; + +trait Trait: 'static {} + +struct Store { + inner: Rc>>, +} + +fn main() { + Box::new(static move || { + let store = Store::> { + inner: Default::default(), + }; + yield (); + }); +} + From db99a3bccdc21e80d832b061defe1002527c1c46 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Tue, 12 Mar 2019 17:42:42 +0100 Subject: [PATCH 354/381] Remove stabilized feature gate in doctest --- src/libcore/convert.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 0fc182348c6c..774d648558b4 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -415,7 +415,6 @@ pub trait TryInto: Sized { /// As described, [`i32`] implements `TryFrom`: /// /// ``` -/// #![feature(try_from)] /// use std::convert::TryFrom; /// /// let big_number = 1_000_000_000_000i64; From 8d18e57b8a957bee7de4586eb1aeecac0ed718d3 Mon Sep 17 00:00:00 2001 From: Tim Vermeulen Date: Tue, 12 Mar 2019 17:52:10 +0100 Subject: [PATCH 355/381] Fix the bench_max and bench_max_by_key benchmarks --- src/libcore/benches/iter.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/benches/iter.rs b/src/libcore/benches/iter.rs index 1dd2bd3ee78a..825bd368bdf1 100644 --- a/src/libcore/benches/iter.rs +++ b/src/libcore/benches/iter.rs @@ -35,7 +35,7 @@ fn scatter(x: i32) -> i32 { (x * 31) % 127 } fn bench_max_by_key(b: &mut Bencher) { b.iter(|| { let it = 0..100; - it.max_by_key(|&x| scatter(x)) + it.map(black_box).max_by_key(|&x| scatter(x)) }) } @@ -56,7 +56,7 @@ fn bench_max_by_key2(b: &mut Bencher) { fn bench_max(b: &mut Bencher) { b.iter(|| { let it = 0..100; - it.map(scatter).max() + it.map(black_box).map(scatter).max() }) } From b23a0473b366134ffa792fc52f538c0577a3a397 Mon Sep 17 00:00:00 2001 From: Tim Vermeulen Date: Tue, 12 Mar 2019 17:52:26 +0100 Subject: [PATCH 356/381] Remove the projection part of select_fold1 --- src/libcore/iter/traits/iterator.rs | 77 ++++++++--------------------- 1 file changed, 21 insertions(+), 56 deletions(-) diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index 861e9c3157a7..199c6cdfa48b 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -2008,12 +2008,8 @@ pub trait Iterator { #[stable(feature = "rust1", since = "1.0.0")] fn max(self) -> Option where Self: Sized, Self::Item: Ord { - select_fold1(self, - |_| (), - // switch to y even if it is only equal, to preserve - // stability. - |_, x, _, y| *x <= *y) - .map(|(_, x)| x) + // switch to y even if it is only equal, to preserve stability. + select_fold1(self, |x, y| x <= y) } /// Returns the minimum element of an iterator. @@ -2038,12 +2034,8 @@ pub trait Iterator { #[stable(feature = "rust1", since = "1.0.0")] fn min(self) -> Option where Self: Sized, Self::Item: Ord { - select_fold1(self, - |_| (), - // only switch to y if it is strictly smaller, to - // preserve stability. - |_, x, _, y| *x > *y) - .map(|(_, x)| x) + // only switch to y if it is strictly smaller, to preserve stability. + select_fold1(self, |x, y| x > y) } /// Returns the element that gives the maximum value from the @@ -2062,15 +2054,11 @@ pub trait Iterator { /// ``` #[inline] #[stable(feature = "iter_cmp_by_key", since = "1.6.0")] - fn max_by_key(self, f: F) -> Option + fn max_by_key(self, mut f: F) -> Option where Self: Sized, F: FnMut(&Self::Item) -> B, { - select_fold1(self, - f, - // switch to y even if it is only equal, to preserve - // stability. - |x_p, _, y_p, _| x_p <= y_p) - .map(|(_, x)| x) + // switch to y even if it is only equal, to preserve stability. + select_fold1(self.map(|x| (f(&x), x)), |(x_p, _), (y_p, _)| x_p <= y_p).map(|(_, x)| x) } /// Returns the element that gives the maximum value with respect to the @@ -2092,12 +2080,8 @@ pub trait Iterator { fn max_by(self, mut compare: F) -> Option where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering, { - select_fold1(self, - |_| (), - // switch to y even if it is only equal, to preserve - // stability. - |_, x, _, y| Ordering::Greater != compare(x, y)) - .map(|(_, x)| x) + // switch to y even if it is only equal, to preserve stability. + select_fold1(self, |x, y| compare(x, y) != Ordering::Greater) } /// Returns the element that gives the minimum value from the @@ -2115,15 +2099,11 @@ pub trait Iterator { /// assert_eq!(*a.iter().min_by_key(|x| x.abs()).unwrap(), 0); /// ``` #[stable(feature = "iter_cmp_by_key", since = "1.6.0")] - fn min_by_key(self, f: F) -> Option + fn min_by_key(self, mut f: F) -> Option where Self: Sized, F: FnMut(&Self::Item) -> B, { - select_fold1(self, - f, - // only switch to y if it is strictly smaller, to - // preserve stability. - |x_p, _, y_p, _| x_p > y_p) - .map(|(_, x)| x) + // only switch to y if it is strictly smaller, to preserve stability. + select_fold1(self.map(|x| (f(&x), x)), |(x_p, _), (y_p, _)| x_p > y_p).map(|(_, x)| x) } /// Returns the element that gives the minimum value with respect to the @@ -2145,12 +2125,8 @@ pub trait Iterator { fn min_by(self, mut compare: F) -> Option where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering, { - select_fold1(self, - |_| (), - // switch to y even if it is strictly smaller, to - // preserve stability. - |_, x, _, y| Ordering::Greater == compare(x, y)) - .map(|(_, x)| x) + // switch to y even if it is strictly smaller, to preserve stability. + select_fold1(self, |x, y| compare(x, y) == Ordering::Greater) } @@ -2693,34 +2669,23 @@ pub trait Iterator { } } -/// Select an element from an iterator based on the given "projection" -/// and "comparison" function. +/// Select an element from an iterator based on the given "comparison" +/// function. /// /// This is an idiosyncratic helper to try to factor out the /// commonalities of {max,min}{,_by}. In particular, this avoids /// having to implement optimizations several times. #[inline] -fn select_fold1(mut it: I, - mut f_proj: FProj, - mut f_cmp: FCmp) -> Option<(B, I::Item)> - where I: Iterator, - FProj: FnMut(&I::Item) -> B, - FCmp: FnMut(&B, &I::Item, &B, &I::Item) -> bool +fn select_fold1(mut it: I, mut f: F) -> Option + where + I: Iterator, + F: FnMut(&I::Item, &I::Item) -> bool, { // start with the first element as our selection. This avoids // having to use `Option`s inside the loop, translating to a // sizeable performance gain (6x in one case). it.next().map(|first| { - let first_p = f_proj(&first); - - it.fold((first_p, first), |(sel_p, sel), x| { - let x_p = f_proj(&x); - if f_cmp(&sel_p, &sel, &x_p, &x) { - (x_p, x) - } else { - (sel_p, sel) - } - }) + it.fold(first, |sel, x| if f(&sel, &x) { x } else { sel }) }) } From 0de63d901b8ec550179b17ea06756e679b9fd461 Mon Sep 17 00:00:00 2001 From: Tim Vermeulen Date: Tue, 12 Mar 2019 17:53:25 +0100 Subject: [PATCH 357/381] Fix comment --- src/libcore/iter/traits/iterator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index 199c6cdfa48b..980de229fa66 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -2125,7 +2125,7 @@ pub trait Iterator { fn min_by(self, mut compare: F) -> Option where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering, { - // switch to y even if it is strictly smaller, to preserve stability. + // only switch to y if it is strictly smaller, to preserve stability. select_fold1(self, |x, y| compare(x, y) == Ordering::Greater) } From 18192505568ce4c58995ca69652eaf088b17345b Mon Sep 17 00:00:00 2001 From: Tim Vermeulen Date: Tue, 12 Mar 2019 19:25:44 +0100 Subject: [PATCH 358/381] Add tests to ensure that Iterator::min and Iterator::max are stable --- src/libcore/tests/iter.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs index d880abb181c2..a9db9b35d8d8 100644 --- a/src/libcore/tests/iter.rs +++ b/src/libcore/tests/iter.rs @@ -1082,12 +1082,39 @@ fn test_iterator_product_result() { assert_eq!(v.iter().cloned().product::>(), Err(())); } +/// A wrapper struct that implements `Eq` and `Ord` based on the wrapped +/// integer modulo 3. Used to test that `Iterator::max` and `Iterator::min` +/// return the correct element if some of them are equal. +#[derive(Debug)] +struct Mod3(i32); + +impl PartialEq for Mod3 { + fn eq(&self, other: &Self) -> bool { + self.0 % 3 == other.0 % 3 + } +} + +impl Eq for Mod3 {} + +impl PartialOrd for Mod3 { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for Mod3 { + fn cmp(&self, other: &Self) -> core::cmp::Ordering { + (self.0 % 3).cmp(&(other.0 % 3)) + } +} + #[test] fn test_iterator_max() { let v: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(v[..4].iter().cloned().max(), Some(3)); assert_eq!(v.iter().cloned().max(), Some(10)); assert_eq!(v[..0].iter().cloned().max(), None); + assert_eq!(v.iter().cloned().map(Mod3).max().map(|x| x.0), Some(8)); } #[test] @@ -1096,6 +1123,7 @@ fn test_iterator_min() { assert_eq!(v[..4].iter().cloned().min(), Some(0)); assert_eq!(v.iter().cloned().min(), Some(0)); assert_eq!(v[..0].iter().cloned().min(), None); + assert_eq!(v.iter().cloned().map(Mod3).min().map(|x| x.0), Some(0)); } #[test] From 5c563f98b89434eb0aada9a65f256df74d63befc Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 23:07:12 +0000 Subject: [PATCH 359/381] Add a test for #10876 --- src/test/ui/borrowck/issue-10876.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/test/ui/borrowck/issue-10876.rs diff --git a/src/test/ui/borrowck/issue-10876.rs b/src/test/ui/borrowck/issue-10876.rs new file mode 100644 index 000000000000..d8fff5f17760 --- /dev/null +++ b/src/test/ui/borrowck/issue-10876.rs @@ -0,0 +1,19 @@ +// run-pass + +#![feature(nll)] + +enum Nat { + S(Box), + Z +} +fn test(x: &mut Nat) { + let mut p = &mut *x; + loop { + match p { + &mut Nat::Z => break, + &mut Nat::S(ref mut n) => p = &mut *n + } + } +} + +fn main() {} From 651c1abfb74b0e190fa5a010e59578fa967e2e94 Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 23:54:49 +0000 Subject: [PATCH 360/381] Add tests for #26448 --- src/test/ui/issues/issue-26448-1.rs | 13 +++++++++++++ src/test/ui/issues/issue-26448-2.rs | 21 +++++++++++++++++++++ src/test/ui/issues/issue-26448-3.rs | 25 +++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 src/test/ui/issues/issue-26448-1.rs create mode 100644 src/test/ui/issues/issue-26448-2.rs create mode 100644 src/test/ui/issues/issue-26448-3.rs diff --git a/src/test/ui/issues/issue-26448-1.rs b/src/test/ui/issues/issue-26448-1.rs new file mode 100644 index 000000000000..7d2d75bf2e87 --- /dev/null +++ b/src/test/ui/issues/issue-26448-1.rs @@ -0,0 +1,13 @@ +// run-pass + +pub trait Foo { + fn foo(self) -> T; +} + +impl<'a, T> Foo for &'a str where &'a str: Into { + fn foo(self) -> T { + panic!(); + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-26448-2.rs b/src/test/ui/issues/issue-26448-2.rs new file mode 100644 index 000000000000..17e7c1f977a6 --- /dev/null +++ b/src/test/ui/issues/issue-26448-2.rs @@ -0,0 +1,21 @@ +// run-pass + +pub struct Bar { + items: Vec<&'static str>, + inner: T, +} + +pub trait IntoBar { + fn into_bar(self) -> Bar; +} + +impl<'a, T> IntoBar for &'a str where &'a str: Into { + fn into_bar(self) -> Bar { + Bar { + items: Vec::new(), + inner: self.into(), + } + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-26448-3.rs b/src/test/ui/issues/issue-26448-3.rs new file mode 100644 index 000000000000..e57352e57f4f --- /dev/null +++ b/src/test/ui/issues/issue-26448-3.rs @@ -0,0 +1,25 @@ +// run-pass + +pub struct Item { + _inner: &'static str, +} + +pub struct Bar { + items: Vec, + inner: T, +} + +pub trait IntoBar { + fn into_bar(self) -> Bar; +} + +impl<'a, T> IntoBar for &'a str where &'a str: Into { + fn into_bar(self) -> Bar { + Bar { + items: Vec::new(), + inner: self.into(), + } + } +} + +fn main() {} From d49f4f86d91c41b6908140347045dbfa9d35d213 Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 23:55:00 +0000 Subject: [PATCH 361/381] Add a test for #26619 --- src/test/ui/issues/issue-26619.rs | 24 ++++++++++++++++++++++++ src/test/ui/issues/issue-26619.stderr | 12 ++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/test/ui/issues/issue-26619.rs create mode 100644 src/test/ui/issues/issue-26619.stderr diff --git a/src/test/ui/issues/issue-26619.rs b/src/test/ui/issues/issue-26619.rs new file mode 100644 index 000000000000..cd89c674e499 --- /dev/null +++ b/src/test/ui/issues/issue-26619.rs @@ -0,0 +1,24 @@ +#![feature(slice_patterns)] + +pub struct History<'a> { pub _s: &'a str } + +impl<'a> History<'a> { + pub fn get_page(&self) { + for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) { + //~^ ERROR borrowed value does not live long enough + println!("{:?}", s); + } + } + + fn make_entry(&self, s: &'a String) -> Option<&str> { + let parts: Vec<_> = s.split('|').collect(); + println!("{:?} -> {:?}", s, parts); + + if let [commit, ..] = &parts[..] { Some(commit) } else { None } + } +} + +fn main() { + let h = History{ _s: "" }; + h.get_page(); +} diff --git a/src/test/ui/issues/issue-26619.stderr b/src/test/ui/issues/issue-26619.stderr new file mode 100644 index 000000000000..3ac6c4e308d2 --- /dev/null +++ b/src/test/ui/issues/issue-26619.stderr @@ -0,0 +1,12 @@ +error[E0597]: borrowed value does not live long enough + --> $DIR/issue-26619.rs:7:66 + | +LL | for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) { + | ^^^^^^^^ -- temporary value needs to live until here + | | | + | | temporary value dropped here while still borrowed + | temporary value does not live long enough + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. From 3f16518c054c5bfe8093250ed3c1a5b4db2209b1 Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 23:55:08 +0000 Subject: [PATCH 362/381] Add a test for #44127 --- src/test/ui/issues/issue-44127.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/ui/issues/issue-44127.rs diff --git a/src/test/ui/issues/issue-44127.rs b/src/test/ui/issues/issue-44127.rs new file mode 100644 index 000000000000..21b2e68264a1 --- /dev/null +++ b/src/test/ui/issues/issue-44127.rs @@ -0,0 +1,17 @@ +// run-pass + +#![feature(decl_macro)] + +pub struct Foo { + bar: u32, +} +pub macro pattern($a:pat) { + Foo { bar: $a } +} + +fn main() { + match (Foo { bar: 3 }) { + pattern!(3) => println!("Test OK"), + _ => unreachable!(), + } +} From ec56d6e5b95a88314af608756f54b4fccb16353e Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 23:55:16 +0000 Subject: [PATCH 363/381] Add a test for #44255 --- src/test/ui/issues/issue-44255.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/test/ui/issues/issue-44255.rs diff --git a/src/test/ui/issues/issue-44255.rs b/src/test/ui/issues/issue-44255.rs new file mode 100644 index 000000000000..224503204325 --- /dev/null +++ b/src/test/ui/issues/issue-44255.rs @@ -0,0 +1,29 @@ +// run-pass + +use std::marker::PhantomData; + +fn main() { + let _arr = [1; >::VAL]; +} + +trait TypeVal { + const VAL: T; +} + +struct Five; + +impl TypeVal for Five { + const VAL: usize = 5; +} + +struct Multiply { + _n: PhantomData, + _m: PhantomData, +} + +impl TypeVal for Multiply + where N: TypeVal, + M: TypeVal, +{ + const VAL: usize = N::VAL * M::VAL; +} From 776411bb5aceef649b8d090783a809f7888a6265 Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 23:55:25 +0000 Subject: [PATCH 364/381] Add a test for #46101 --- src/test/ui/issues/issue-46101.rs | 4 ++++ src/test/ui/issues/issue-46101.stderr | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/test/ui/issues/issue-46101.rs create mode 100644 src/test/ui/issues/issue-46101.stderr diff --git a/src/test/ui/issues/issue-46101.rs b/src/test/ui/issues/issue-46101.rs new file mode 100644 index 000000000000..2d9111e9b3a9 --- /dev/null +++ b/src/test/ui/issues/issue-46101.rs @@ -0,0 +1,4 @@ +#![feature(use_extern_macros)] +trait Foo {} +#[derive(Foo::Anything)] //~ ERROR failed to resolve: partially resolved path in a derive macro +struct S; diff --git a/src/test/ui/issues/issue-46101.stderr b/src/test/ui/issues/issue-46101.stderr new file mode 100644 index 000000000000..f8b95d7a23bf --- /dev/null +++ b/src/test/ui/issues/issue-46101.stderr @@ -0,0 +1,14 @@ +error[E0433]: failed to resolve: partially resolved path in a derive macro + --> $DIR/issue-46101.rs:3:10 + | +LL | #[derive(Foo::Anything)] //~ ERROR failed to resolve: partially resolved path in a derive macro + | ^^^^^^^^^^^^^ partially resolved path in a derive macro + +error[E0601]: `main` function not found in crate `issue_46101` + | + = note: consider adding a `main` function to `$DIR/issue-46101.rs` + +error: aborting due to 2 previous errors + +Some errors occurred: E0433, E0601. +For more information about an error, try `rustc --explain E0433`. From b7763af5267be200ffcb75e1ed35a0f3979c7d51 Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 23:55:34 +0000 Subject: [PATCH 365/381] Add a test for #55731 --- src/test/ui/issues/issue-55731.rs | 52 +++++++++++++++++++++++++++ src/test/ui/issues/issue-55731.stderr | 12 +++++++ 2 files changed, 64 insertions(+) create mode 100644 src/test/ui/issues/issue-55731.rs create mode 100644 src/test/ui/issues/issue-55731.stderr diff --git a/src/test/ui/issues/issue-55731.rs b/src/test/ui/issues/issue-55731.rs new file mode 100644 index 000000000000..7b4f4e2cd3b4 --- /dev/null +++ b/src/test/ui/issues/issue-55731.rs @@ -0,0 +1,52 @@ +use std::marker::PhantomData; + +trait DistributedIterator { + fn reduce(self) + where + Self: Sized, + { + unreachable!() + } +} + +trait DistributedIteratorMulti { + type Item; +} + +struct Connect(PhantomData); +impl DistributedIteratorMulti<&'a ()>> DistributedIterator for Connect where {} + +struct Cloned(PhantomData); +impl<'a, Source> DistributedIteratorMulti<&'a Source> for Cloned<&'a Source> { + type Item = (); +} + +struct Map { + i: I, + f: F, +} +impl, F, Source> DistributedIteratorMulti for Map +where + F: A<>::Item>, +{ + type Item = (); +} + +trait A {} + +struct X; +impl A<()> for X {} + +fn multi(_reducer: I) +where + I: for<'a> DistributedIteratorMulti<&'a ()>, +{ + DistributedIterator::reduce(Connect::(PhantomData)) +} + +fn main() { + multi(Map { //~ ERROR implementation of `DistributedIteratorMulti` is not general enough + i: Cloned(PhantomData), + f: X, + }); +} diff --git a/src/test/ui/issues/issue-55731.stderr b/src/test/ui/issues/issue-55731.stderr new file mode 100644 index 000000000000..67f2053de1eb --- /dev/null +++ b/src/test/ui/issues/issue-55731.stderr @@ -0,0 +1,12 @@ +error: implementation of `DistributedIteratorMulti` is not general enough + --> $DIR/issue-55731.rs:48:5 + | +LL | multi(Map { //~ ERROR implementation of `DistributedIteratorMulti` is not general enough + | ^^^^^ + | + = note: Due to a where-clause on `multi`, + = note: `Map, X>` must implement `DistributedIteratorMulti<&'0 ()>`, for any lifetime `'0` + = note: but `Map, X>` actually implements `DistributedIteratorMulti<&'1 ()>`, for some specific lifetime `'1` + +error: aborting due to previous error + From e3297e7ce36a53d22088cd187e66454956eb659e Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 23:55:43 +0000 Subject: [PATCH 366/381] Add a test for #57781 --- src/test/ui/issues/issue-57781.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/test/ui/issues/issue-57781.rs diff --git a/src/test/ui/issues/issue-57781.rs b/src/test/ui/issues/issue-57781.rs new file mode 100644 index 000000000000..f5015aaf5d81 --- /dev/null +++ b/src/test/ui/issues/issue-57781.rs @@ -0,0 +1,20 @@ +// run-pass + +use std::cell::UnsafeCell; +use std::collections::HashMap; + +struct OnceCell { + _value: UnsafeCell>, +} + +impl OnceCell { + const INIT: OnceCell = OnceCell { + _value: UnsafeCell::new(None), + }; +} + +pub fn crash() { + let _ = OnceCell::>::INIT; +} + +fn main() {} From 295b6fd0f77c3c63c9bdfcec16e603749e21bc2f Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 23:56:10 +0000 Subject: [PATCH 367/381] Add a test for #22892 --- src/test/ui/asm/invalid-inline-asm.rs | 9 +++++++++ src/test/ui/asm/invalid-inline-asm.stderr | 8 ++++++++ 2 files changed, 17 insertions(+) create mode 100644 src/test/ui/asm/invalid-inline-asm.rs create mode 100644 src/test/ui/asm/invalid-inline-asm.stderr diff --git a/src/test/ui/asm/invalid-inline-asm.rs b/src/test/ui/asm/invalid-inline-asm.rs new file mode 100644 index 000000000000..1dcded0be0b7 --- /dev/null +++ b/src/test/ui/asm/invalid-inline-asm.rs @@ -0,0 +1,9 @@ +#![feature(asm)] + +fn main() { + let byte = 0; + let port = 0x80; + + unsafe { asm!("out %al, %dx" :: "a" (byte), "d" (port) :: "volatile"); } + //~^ ERROR couldn't allocate input reg for constraint 'a' +} diff --git a/src/test/ui/asm/invalid-inline-asm.stderr b/src/test/ui/asm/invalid-inline-asm.stderr new file mode 100644 index 000000000000..11a32d3141e0 --- /dev/null +++ b/src/test/ui/asm/invalid-inline-asm.stderr @@ -0,0 +1,8 @@ +error: couldn't allocate input reg for constraint 'a' + --> $DIR/invalid-inline-asm.rs:7:14 + | +LL | unsafe { asm!("out %al, %dx" :: "a" (byte), "d" (port) :: "volatile"); } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + From 5917d9fc62522d50b45e5fd682a905aef2e1723b Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 23:56:27 +0000 Subject: [PATCH 368/381] Add a test for #28587 --- src/test/ui/asm/invalid-inline-asm-2.rs | 10 ++++++++++ src/test/ui/asm/invalid-inline-asm-2.stderr | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/test/ui/asm/invalid-inline-asm-2.rs create mode 100644 src/test/ui/asm/invalid-inline-asm-2.stderr diff --git a/src/test/ui/asm/invalid-inline-asm-2.rs b/src/test/ui/asm/invalid-inline-asm-2.rs new file mode 100644 index 000000000000..7b3f1cdd6794 --- /dev/null +++ b/src/test/ui/asm/invalid-inline-asm-2.rs @@ -0,0 +1,10 @@ +#![feature(asm)] + +fn main() { + let a: usize; + + unsafe { + asm!("" : "=d"(a) : : : ); + //~^ ERROR couldn't allocate output register for constraint 'd' + } +} diff --git a/src/test/ui/asm/invalid-inline-asm-2.stderr b/src/test/ui/asm/invalid-inline-asm-2.stderr new file mode 100644 index 000000000000..3534a2ea58c7 --- /dev/null +++ b/src/test/ui/asm/invalid-inline-asm-2.stderr @@ -0,0 +1,8 @@ +error: couldn't allocate output register for constraint 'd' + --> $DIR/invalid-inline-asm-2.rs:7:9 + | +LL | asm!("" : "=d"(a) : : : ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + From b4b8a6e0bb6177ef8129805d80c14e0100345dff Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 23:56:53 +0000 Subject: [PATCH 369/381] Add a test for #26577 --- .../ui/block-expression-remove-semicolon.rs | 10 ++++++++++ .../ui/block-expression-remove-semicolon.stderr | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 src/test/ui/block-expression-remove-semicolon.rs create mode 100644 src/test/ui/block-expression-remove-semicolon.stderr diff --git a/src/test/ui/block-expression-remove-semicolon.rs b/src/test/ui/block-expression-remove-semicolon.rs new file mode 100644 index 000000000000..afa10b38b914 --- /dev/null +++ b/src/test/ui/block-expression-remove-semicolon.rs @@ -0,0 +1,10 @@ +fn foo() -> i32 { + 0 +} + +fn main() { + let x: i32 = { + //~^ ERROR mismatched types + foo(); //~ HELP consider removing this semicolon + }; +} diff --git a/src/test/ui/block-expression-remove-semicolon.stderr b/src/test/ui/block-expression-remove-semicolon.stderr new file mode 100644 index 000000000000..aa4889fc5a57 --- /dev/null +++ b/src/test/ui/block-expression-remove-semicolon.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/block-expression-remove-semicolon.rs:6:18 + | +LL | let x: i32 = { + | __________________^ +LL | | //~^ ERROR mismatched types +LL | | foo(); //~ HELP consider removing this semicolon + | | - help: consider removing this semicolon +LL | | }; + | |_____^ expected i32, found () + | + = note: expected type `i32` + found type `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. From 1dea6e00def29caf081458f78c711c62dd992726 Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 25 Feb 2019 23:57:08 +0000 Subject: [PATCH 370/381] Add a test for #27054 --- src/test/ui/primitive-binop-lhs-mut.rs | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/test/ui/primitive-binop-lhs-mut.rs diff --git a/src/test/ui/primitive-binop-lhs-mut.rs b/src/test/ui/primitive-binop-lhs-mut.rs new file mode 100644 index 000000000000..4f1c456ace35 --- /dev/null +++ b/src/test/ui/primitive-binop-lhs-mut.rs @@ -0,0 +1,6 @@ +// run-pass + +fn main() { + let x = Box::new(0); + assert_eq!(0, *x + { drop(x); let _ = Box::new(main); 0 }); +} From 4aa5fd080660ec542ea32f646e9932d0f0daf879 Mon Sep 17 00:00:00 2001 From: varkor Date: Tue, 26 Feb 2019 20:56:52 +0000 Subject: [PATCH 371/381] Update test for issue #55731 --- src/test/ui/issues/issue-55731.stderr | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test/ui/issues/issue-55731.stderr b/src/test/ui/issues/issue-55731.stderr index 67f2053de1eb..f490b45bf976 100644 --- a/src/test/ui/issues/issue-55731.stderr +++ b/src/test/ui/issues/issue-55731.stderr @@ -4,9 +4,8 @@ error: implementation of `DistributedIteratorMulti` is not general enough LL | multi(Map { //~ ERROR implementation of `DistributedIteratorMulti` is not general enough | ^^^^^ | - = note: Due to a where-clause on `multi`, - = note: `Map, X>` must implement `DistributedIteratorMulti<&'0 ()>`, for any lifetime `'0` - = note: but `Map, X>` actually implements `DistributedIteratorMulti<&'1 ()>`, for some specific lifetime `'1` + = note: `DistributedIteratorMulti<&'0 ()>` would have to be implemented for the type `Cloned<&()>`, for any lifetime `'0` + = note: but `DistributedIteratorMulti<&'1 ()>` is actually implemented for the type `Cloned<&'1 ()>`, for some specific lifetime `'1` error: aborting due to previous error From 216bee499f7831dc5f092fc7077526494f98d18b Mon Sep 17 00:00:00 2001 From: varkor Date: Sat, 2 Mar 2019 12:47:39 +0000 Subject: [PATCH 372/381] Ignore WASM on asm tests --- src/test/ui/asm/invalid-inline-asm-2.rs | 3 +++ src/test/ui/asm/invalid-inline-asm-2.stderr | 2 +- src/test/ui/asm/invalid-inline-asm.rs | 3 +++ src/test/ui/asm/invalid-inline-asm.stderr | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/test/ui/asm/invalid-inline-asm-2.rs b/src/test/ui/asm/invalid-inline-asm-2.rs index 7b3f1cdd6794..faa7249ff811 100644 --- a/src/test/ui/asm/invalid-inline-asm-2.rs +++ b/src/test/ui/asm/invalid-inline-asm-2.rs @@ -1,3 +1,6 @@ +// ignore-wasm +// ignore-emscripten + #![feature(asm)] fn main() { diff --git a/src/test/ui/asm/invalid-inline-asm-2.stderr b/src/test/ui/asm/invalid-inline-asm-2.stderr index 3534a2ea58c7..41232b9f4b01 100644 --- a/src/test/ui/asm/invalid-inline-asm-2.stderr +++ b/src/test/ui/asm/invalid-inline-asm-2.stderr @@ -1,5 +1,5 @@ error: couldn't allocate output register for constraint 'd' - --> $DIR/invalid-inline-asm-2.rs:7:9 + --> $DIR/invalid-inline-asm-2.rs:10:9 | LL | asm!("" : "=d"(a) : : : ); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/asm/invalid-inline-asm.rs b/src/test/ui/asm/invalid-inline-asm.rs index 1dcded0be0b7..0d9470cf1733 100644 --- a/src/test/ui/asm/invalid-inline-asm.rs +++ b/src/test/ui/asm/invalid-inline-asm.rs @@ -1,3 +1,6 @@ +// ignore-wasm +// ignore-emscripten + #![feature(asm)] fn main() { diff --git a/src/test/ui/asm/invalid-inline-asm.stderr b/src/test/ui/asm/invalid-inline-asm.stderr index 11a32d3141e0..53e95084f3aa 100644 --- a/src/test/ui/asm/invalid-inline-asm.stderr +++ b/src/test/ui/asm/invalid-inline-asm.stderr @@ -1,5 +1,5 @@ error: couldn't allocate input reg for constraint 'a' - --> $DIR/invalid-inline-asm.rs:7:14 + --> $DIR/invalid-inline-asm.rs:10:14 | LL | unsafe { asm!("out %al, %dx" :: "a" (byte), "d" (port) :: "volatile"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From 57c6a0b17b36705e397ef53def7e364080536566 Mon Sep 17 00:00:00 2001 From: varkor Date: Sat, 9 Mar 2019 17:02:11 +0000 Subject: [PATCH 373/381] Remove invalid ASM tests These still fail on some architectures. --- src/test/ui/asm/invalid-inline-asm-2.rs | 13 ------------- src/test/ui/asm/invalid-inline-asm-2.stderr | 8 -------- src/test/ui/asm/invalid-inline-asm.rs | 12 ------------ src/test/ui/asm/invalid-inline-asm.stderr | 8 -------- 4 files changed, 41 deletions(-) delete mode 100644 src/test/ui/asm/invalid-inline-asm-2.rs delete mode 100644 src/test/ui/asm/invalid-inline-asm-2.stderr delete mode 100644 src/test/ui/asm/invalid-inline-asm.rs delete mode 100644 src/test/ui/asm/invalid-inline-asm.stderr diff --git a/src/test/ui/asm/invalid-inline-asm-2.rs b/src/test/ui/asm/invalid-inline-asm-2.rs deleted file mode 100644 index faa7249ff811..000000000000 --- a/src/test/ui/asm/invalid-inline-asm-2.rs +++ /dev/null @@ -1,13 +0,0 @@ -// ignore-wasm -// ignore-emscripten - -#![feature(asm)] - -fn main() { - let a: usize; - - unsafe { - asm!("" : "=d"(a) : : : ); - //~^ ERROR couldn't allocate output register for constraint 'd' - } -} diff --git a/src/test/ui/asm/invalid-inline-asm-2.stderr b/src/test/ui/asm/invalid-inline-asm-2.stderr deleted file mode 100644 index 41232b9f4b01..000000000000 --- a/src/test/ui/asm/invalid-inline-asm-2.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: couldn't allocate output register for constraint 'd' - --> $DIR/invalid-inline-asm-2.rs:10:9 - | -LL | asm!("" : "=d"(a) : : : ); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/asm/invalid-inline-asm.rs b/src/test/ui/asm/invalid-inline-asm.rs deleted file mode 100644 index 0d9470cf1733..000000000000 --- a/src/test/ui/asm/invalid-inline-asm.rs +++ /dev/null @@ -1,12 +0,0 @@ -// ignore-wasm -// ignore-emscripten - -#![feature(asm)] - -fn main() { - let byte = 0; - let port = 0x80; - - unsafe { asm!("out %al, %dx" :: "a" (byte), "d" (port) :: "volatile"); } - //~^ ERROR couldn't allocate input reg for constraint 'a' -} diff --git a/src/test/ui/asm/invalid-inline-asm.stderr b/src/test/ui/asm/invalid-inline-asm.stderr deleted file mode 100644 index 53e95084f3aa..000000000000 --- a/src/test/ui/asm/invalid-inline-asm.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: couldn't allocate input reg for constraint 'a' - --> $DIR/invalid-inline-asm.rs:10:14 - | -LL | unsafe { asm!("out %al, %dx" :: "a" (byte), "d" (port) :: "volatile"); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - From d17da3a17eec2608592dc723254028ebe117dfe8 Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 11 Mar 2019 23:06:34 +0000 Subject: [PATCH 374/381] Add NLL test error output --- src/test/ui/issues/issue-26619.nll.stderr | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/test/ui/issues/issue-26619.nll.stderr diff --git a/src/test/ui/issues/issue-26619.nll.stderr b/src/test/ui/issues/issue-26619.nll.stderr new file mode 100644 index 000000000000..d1157cda92bf --- /dev/null +++ b/src/test/ui/issues/issue-26619.nll.stderr @@ -0,0 +1,11 @@ +error[E0515]: cannot return value referencing function parameter + --> $DIR/issue-26619.rs:7:76 + | +LL | for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) { + | -------- ^^^^^^^^^^^^^^^^^^^^^ returns a value referencing data owned by the current function + | | + | function parameter borrowed here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. From 1d6f4d66ad9004d406169742c3098748a0419384 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Thu, 17 Jan 2019 02:17:22 +0300 Subject: [PATCH 375/381] resolve: Simplify import resolution for mixed 2015/2018 edition mode --- src/librustc_resolve/build_reduced_graph.rs | 5 +- src/librustc_resolve/lib.rs | 3 -- src/librustc_resolve/macros.rs | 50 ++----------------- .../edition-imports-virtual-2015-ambiguity.rs | 4 +- ...tion-imports-virtual-2015-ambiguity.stderr | 40 --------------- .../edition-imports-virtual-2015-gated.rs | 3 +- .../edition-imports-virtual-2015-gated.stderr | 17 ++----- 7 files changed, 11 insertions(+), 111 deletions(-) delete mode 100644 src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 29de5308a3cd..5c9927011a70 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -131,12 +131,9 @@ impl<'a> Resolver<'a> { // so prefixes are prepended with crate root segment if necessary. // The root is prepended lazily, when the first non-empty prefix or terminating glob // appears, so imports in braced groups can have roots prepended independently. - // 2015 identifiers used on global 2018 edition enter special "virtual 2015 mode", don't - // get crate root prepended, but get special treatment during in-scope resolution instead. let is_glob = if let ast::UseTreeKind::Glob = use_tree.kind { true } else { false }; let crate_root = match prefix_iter.peek() { - Some(seg) if !seg.ident.is_path_segment_keyword() && - seg.ident.span.rust_2015() && self.session.rust_2015() => { + Some(seg) if !seg.ident.is_path_segment_keyword() && seg.ident.span.rust_2015() => { Some(seg.ident.span.ctxt()) } None if is_glob && use_tree.span.rust_2015() => { diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index b50e37519d46..ac149be4b2a8 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1273,7 +1273,6 @@ struct UseError<'a> { #[derive(Clone, Copy, PartialEq, Debug)] enum AmbiguityKind { Import, - AbsolutePath, BuiltinAttr, DeriveHelper, LegacyHelperVsPrelude, @@ -1289,8 +1288,6 @@ impl AmbiguityKind { match self { AmbiguityKind::Import => "name vs any other name during import resolution", - AmbiguityKind::AbsolutePath => - "name in the crate root vs extern crate during absolute path resolution", AmbiguityKind::BuiltinAttr => "built-in attribute vs any other name", AmbiguityKind::DeriveHelper => diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 8e4b2a9a4cb1..21ca8ea369fd 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -572,7 +572,7 @@ impl<'a> Resolver<'a> { ScopeSet::Module => (TypeNS, None, false, false), }; let mut where_to_resolve = match ns { - _ if is_absolute_path || is_import && rust_2015 => WhereToResolve::CrateRoot, + _ if is_absolute_path => WhereToResolve::CrateRoot, TypeNS | ValueNS => WhereToResolve::Module(parent_scope.module), MacroNS => WhereToResolve::DeriveHelpers, }; @@ -770,8 +770,6 @@ impl<'a> Resolver<'a> { let ambiguity_error_kind = if is_import { Some(AmbiguityKind::Import) - } else if is_absolute_path { - Some(AmbiguityKind::AbsolutePath) } else if innermost_def == builtin || def == builtin { Some(AmbiguityKind::BuiltinAttr) } else if innermost_def == derive_helper || def == derive_helper { @@ -841,18 +839,13 @@ impl<'a> Resolver<'a> { LegacyScope::Empty => WhereToResolve::Module(parent_scope.module), LegacyScope::Uninitialized => unreachable!(), } - WhereToResolve::CrateRoot if is_import => match ns { - TypeNS | ValueNS => WhereToResolve::Module(parent_scope.module), - MacroNS => WhereToResolve::DeriveHelpers, - } - WhereToResolve::CrateRoot if is_absolute_path => match ns { + WhereToResolve::CrateRoot => match ns { TypeNS => { ident.span.adjust(Mark::root()); WhereToResolve::ExternPrelude } ValueNS | MacroNS => break, } - WhereToResolve::CrateRoot => unreachable!(), WhereToResolve::Module(module) => { match self.hygienic_lexical_parent(module, &mut ident.span) { Some(parent_module) => WhereToResolve::Module(parent_module), @@ -885,44 +878,7 @@ impl<'a> Resolver<'a> { } // The first found solution was the only one, return it. - if let Some((binding, flags)) = innermost_result { - // We get to here only if there's no ambiguity, in ambiguous cases an error will - // be reported anyway, so there's no reason to report an additional feature error. - // The `binding` can actually be introduced by something other than `--extern`, - // but its `Def` should coincide with a crate passed with `--extern` - // (otherwise there would be ambiguity) and we can skip feature error in this case. - 'ok: { - if !is_import || !rust_2015 { - break 'ok; - } - if ns == TypeNS && use_prelude && self.extern_prelude_get(ident, true).is_some() { - break 'ok; - } - let root_ident = Ident::new(keywords::PathRoot.name(), orig_ident.span); - let root_module = self.resolve_crate_root(root_ident); - if self.resolve_ident_in_module_ext(ModuleOrUniformRoot::Module(root_module), - orig_ident, ns, None, false, path_span) - .is_ok() { - break 'ok; - } - - let msg = "imports can only refer to extern crate names passed with \ - `--extern` in macros originating from 2015 edition"; - let mut err = self.session.struct_span_err(ident.span, msg); - let what = self.binding_description(binding, ident, - flags.contains(Flags::MISC_FROM_PRELUDE)); - let note_msg = format!("this import refers to {what}", what = what); - let label_span = if binding.span.is_dummy() { - err.note(¬e_msg); - ident.span - } else { - err.span_note(binding.span, ¬e_msg); - binding.span - }; - err.span_label(label_span, "not an extern crate passed with `--extern`"); - err.emit(); - } - + if let Some((binding, _)) = innermost_result { return Ok(binding); } diff --git a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs index 53ec3867f011..940b0c3c63db 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs +++ b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs @@ -1,3 +1,4 @@ +// compile-pass // edition:2018 // compile-flags:--extern edition_imports_2015 // aux-build:edition-imports-2015.rs @@ -12,8 +13,7 @@ mod check { pub struct Ambiguous {} fn check() { - edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous - //~| ERROR `edition_imports_2015` is ambiguous + edition_imports_2015::gen_ambiguous!(); // OK } } diff --git a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr deleted file mode 100644 index 1f309f5e8f03..000000000000 --- a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr +++ /dev/null @@ -1,40 +0,0 @@ -error[E0659]: `Ambiguous` is ambiguous (name vs any other name during import resolution) - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:15:9 - | -LL | edition_imports_2015::gen_ambiguous!(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name - | -note: `Ambiguous` could refer to the struct defined here - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:9:1 - | -LL | pub struct Ambiguous {} - | ^^^^^^^^^^^^^^^^^^^^^^^ - = help: use `crate::Ambiguous` to refer to this struct unambiguously -note: `Ambiguous` could also refer to the struct defined here - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:12:5 - | -LL | pub struct Ambiguous {} - | ^^^^^^^^^^^^^^^^^^^^^^^ - = help: use `self::Ambiguous` to refer to this struct unambiguously - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error[E0659]: `edition_imports_2015` is ambiguous (name in the crate root vs extern crate during absolute path resolution) - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:15:9 - | -LL | edition_imports_2015::gen_ambiguous!(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name - | - = note: `edition_imports_2015` could refer to an extern crate passed with `--extern` -note: `edition_imports_2015` could also refer to the module defined here - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:5:1 - | -LL | / mod edition_imports_2015 { -LL | | pub struct Path; -LL | | } - | |_^ - = help: use `crate::edition_imports_2015` to refer to this module unambiguously - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/editions/edition-imports-virtual-2015-gated.rs b/src/test/ui/editions/edition-imports-virtual-2015-gated.rs index a1bf4f5eb51d..634d3e9a443f 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-gated.rs +++ b/src/test/ui/editions/edition-imports-virtual-2015-gated.rs @@ -1,12 +1,11 @@ // edition:2018 // aux-build:edition-imports-2015.rs -// error-pattern: imports can only refer to extern crate names passed with `--extern` #[macro_use] extern crate edition_imports_2015; mod check { - gen_gated!(); + gen_gated!(); //~ ERROR unresolved import `E` } fn main() {} diff --git a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr index 7c78fbb26a1b..e6d0f18a6772 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr +++ b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr @@ -1,20 +1,11 @@ -error: imports can only refer to extern crate names passed with `--extern` in macros originating from 2015 edition - --> <::edition_imports_2015::gen_gated macros>:1:50 - | -LL | ( ) => { fn check_gated ( ) { enum E { A } use E :: * ; } } - | ^ - | - ::: $DIR/edition-imports-virtual-2015-gated.rs:9:5 +error[E0432]: unresolved import `E` + --> $DIR/edition-imports-virtual-2015-gated.rs:8:5 | LL | gen_gated!(); - | ------------- not an extern crate passed with `--extern` + | ^^^^^^^^^^^^^ could not find `E` in `{{root}}` | -note: this import refers to the enum defined here - --> $DIR/edition-imports-virtual-2015-gated.rs:9:5 - | -LL | gen_gated!(); - | ^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error +For more information about this error, try `rustc --explain E0432`. From 5b3e1be7249cc60ac325f2c380267162a65dda40 Mon Sep 17 00:00:00 2001 From: varkor Date: Tue, 12 Mar 2019 19:06:13 +0000 Subject: [PATCH 376/381] Remove compiletest comments from tests --- src/test/ui/block-expression-remove-semicolon.stderr | 4 ++-- src/test/ui/issues/issue-46101.stderr | 2 +- src/test/ui/issues/issue-55731.stderr | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/ui/block-expression-remove-semicolon.stderr b/src/test/ui/block-expression-remove-semicolon.stderr index aa4889fc5a57..51942f3d920f 100644 --- a/src/test/ui/block-expression-remove-semicolon.stderr +++ b/src/test/ui/block-expression-remove-semicolon.stderr @@ -3,8 +3,8 @@ error[E0308]: mismatched types | LL | let x: i32 = { | __________________^ -LL | | //~^ ERROR mismatched types -LL | | foo(); //~ HELP consider removing this semicolon +LL | | +LL | | foo(); | | - help: consider removing this semicolon LL | | }; | |_____^ expected i32, found () diff --git a/src/test/ui/issues/issue-46101.stderr b/src/test/ui/issues/issue-46101.stderr index f8b95d7a23bf..3ad5383294a5 100644 --- a/src/test/ui/issues/issue-46101.stderr +++ b/src/test/ui/issues/issue-46101.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: partially resolved path in a derive macro --> $DIR/issue-46101.rs:3:10 | -LL | #[derive(Foo::Anything)] //~ ERROR failed to resolve: partially resolved path in a derive macro +LL | #[derive(Foo::Anything)] | ^^^^^^^^^^^^^ partially resolved path in a derive macro error[E0601]: `main` function not found in crate `issue_46101` diff --git a/src/test/ui/issues/issue-55731.stderr b/src/test/ui/issues/issue-55731.stderr index f490b45bf976..f25e18e5d90c 100644 --- a/src/test/ui/issues/issue-55731.stderr +++ b/src/test/ui/issues/issue-55731.stderr @@ -1,7 +1,7 @@ error: implementation of `DistributedIteratorMulti` is not general enough --> $DIR/issue-55731.rs:48:5 | -LL | multi(Map { //~ ERROR implementation of `DistributedIteratorMulti` is not general enough +LL | multi(Map { | ^^^^^ | = note: `DistributedIteratorMulti<&'0 ()>` would have to be implemented for the type `Cloned<&()>`, for any lifetime `'0` From 6cc5a3d9cc470e2db2b2a45fcddb2350ac0b039e Mon Sep 17 00:00:00 2001 From: Tim Vermeulen Date: Tue, 12 Mar 2019 20:24:10 +0100 Subject: [PATCH 377/381] Forward `max` and `min` to `max_by` and `min_by` respectively --- src/libcore/iter/traits/iterator.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index 980de229fa66..ca7feed0712d 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -2008,8 +2008,7 @@ pub trait Iterator { #[stable(feature = "rust1", since = "1.0.0")] fn max(self) -> Option where Self: Sized, Self::Item: Ord { - // switch to y even if it is only equal, to preserve stability. - select_fold1(self, |x, y| x <= y) + self.max_by(Ord::cmp) } /// Returns the minimum element of an iterator. @@ -2034,8 +2033,7 @@ pub trait Iterator { #[stable(feature = "rust1", since = "1.0.0")] fn min(self) -> Option where Self: Sized, Self::Item: Ord { - // only switch to y if it is strictly smaller, to preserve stability. - select_fold1(self, |x, y| x > y) + self.min_by(Ord::cmp) } /// Returns the element that gives the maximum value from the From aa9bd68fa8134e55ded5e65abef745f96ba0e622 Mon Sep 17 00:00:00 2001 From: kyren Date: Tue, 12 Mar 2019 18:33:27 -0400 Subject: [PATCH 378/381] Rename test struct names to something more sensible --- src/test/ui/nll/trait-associated-constant.rs | 12 ++++++------ src/test/ui/nll/trait-associated-constant.stderr | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/ui/nll/trait-associated-constant.rs b/src/test/ui/nll/trait-associated-constant.rs index 2ba65e10ea70..31dc58185e90 100644 --- a/src/test/ui/nll/trait-associated-constant.rs +++ b/src/test/ui/nll/trait-associated-constant.rs @@ -9,22 +9,22 @@ trait Anything<'a: 'b, 'b> { const AC: Option<&'b str>; } -struct OKStruct { } +struct OKStruct1 { } -impl<'a: 'b, 'b> Anything<'a, 'b> for OKStruct { +impl<'a: 'b, 'b> Anything<'a, 'b> for OKStruct1 { const AC: Option<&'b str> = None; } -struct FailStruct1 { } +struct FailStruct { } -impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct1 { +impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct { const AC: Option<&'c str> = None; //~^ ERROR: mismatched types } -struct FailStruct2 { } +struct OKStruct2 { } -impl<'a: 'b, 'b> Anything<'a, 'b> for FailStruct2 { +impl<'a: 'b, 'b> Anything<'a, 'b> for OKStruct2 { const AC: Option<&'a str> = None; } diff --git a/src/test/ui/nll/trait-associated-constant.stderr b/src/test/ui/nll/trait-associated-constant.stderr index 786ca8e19e4c..f39f668e2329 100644 --- a/src/test/ui/nll/trait-associated-constant.stderr +++ b/src/test/ui/nll/trait-associated-constant.stderr @@ -9,12 +9,12 @@ LL | const AC: Option<&'c str> = None; note: the lifetime 'c as defined on the impl at 20:18... --> $DIR/trait-associated-constant.rs:20:18 | -LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct1 { +LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct { | ^^ note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 20:14 --> $DIR/trait-associated-constant.rs:20:14 | -LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct1 { +LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct { | ^^ error: aborting due to previous error From 48757a70a382afe27d5469fdcfbe5d434c9d4097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 9 Mar 2019 22:04:00 +0100 Subject: [PATCH 379/381] Fix newtype_index --- src/librustc_data_structures/indexed_vec.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs index 1153c3e79bfd..359b89f683dc 100644 --- a/src/librustc_data_structures/indexed_vec.rs +++ b/src/librustc_data_structures/indexed_vec.rs @@ -286,13 +286,15 @@ macro_rules! newtype_index { ); // Append comma to end of derives list if it's missing - (@type [$type:ident] + (@attrs [$(#[$attrs:meta])*] + @type [$type:ident] @max [$max:expr] @vis [$v:vis] @debug_format [$debug_format:tt] derive [$($derives:ident),*] $($tokens:tt)*) => ( newtype_index!( + @attrs [$(#[$attrs])*] @type [$type] @max [$max] @vis [$v] @@ -303,7 +305,8 @@ macro_rules! newtype_index { // By not including the @derives marker in this list nor in the default args, we can force it // to come first if it exists. When encodable is custom, just use the derives list as-is. - (@type [$type:ident] + (@attrs [$(#[$attrs:meta])*] + @type [$type:ident] @max [$max:expr] @vis [$v:vis] @debug_format [$debug_format:tt] @@ -311,6 +314,7 @@ macro_rules! newtype_index { ENCODABLE = custom $($tokens:tt)*) => ( newtype_index!( + @attrs [$(#[$attrs])*] @derives [$($derives,)+] @type [$type] @max [$max] From 3936aff2169a1f61633de2bc475face3a2682efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Mon, 3 Dec 2018 01:14:35 +0100 Subject: [PATCH 380/381] Use derive macro for HashStable --- src/librustc/hir/def.rs | 9 +- src/librustc/hir/mod.rs | 197 ++-- src/librustc/ich/impls_cstore.rs | 53 -- src/librustc/ich/impls_hir.rs | 753 ---------------- src/librustc/ich/impls_mir.rs | 504 ----------- src/librustc/ich/impls_misc.rs | 9 - src/librustc/ich/impls_ty.rs | 1050 ---------------------- src/librustc/ich/mod.rs | 2 - src/librustc/infer/canonical/mod.rs | 15 +- src/librustc/middle/cstore.rs | 19 +- src/librustc/middle/lang_items.rs | 2 + src/librustc/middle/lib_features.rs | 2 + src/librustc/middle/privacy.rs | 3 +- src/librustc/middle/reachable.rs | 3 +- src/librustc/middle/region.rs | 7 +- src/librustc/middle/resolve_lifetime.rs | 7 +- src/librustc/mir/interpret/allocation.rs | 3 +- src/librustc/mir/interpret/error.rs | 7 +- src/librustc/mir/interpret/mod.rs | 5 +- src/librustc/mir/interpret/pointer.rs | 4 +- src/librustc/mir/interpret/value.rs | 9 +- src/librustc/mir/mod.rs | 92 +- src/librustc/session/search_paths.rs | 3 +- src/librustc/traits/mod.rs | 41 +- src/librustc/traits/project.rs | 3 +- src/librustc/ty/adjustment.rs | 17 +- src/librustc/ty/cast.rs | 3 +- src/librustc/ty/context.rs | 8 +- src/librustc/ty/instance.rs | 5 +- src/librustc/ty/mod.rs | 64 +- src/librustc/ty/sty.rs | 54 +- src/librustc/ty/subst.rs | 7 +- src/librustc/ty/trait_def.rs | 4 + src/librustc/ty/util.rs | 3 +- src/librustc/util/common.rs | 3 +- src/librustc_data_structures/thin_vec.rs | 10 + 36 files changed, 358 insertions(+), 2622 deletions(-) delete mode 100644 src/librustc/ich/impls_cstore.rs delete mode 100644 src/librustc/ich/impls_mir.rs diff --git a/src/librustc/hir/def.rs b/src/librustc/hir/def.rs index f6d864f5b404..b45fc3ffd82f 100644 --- a/src/librustc/hir/def.rs +++ b/src/librustc/hir/def.rs @@ -3,12 +3,13 @@ use crate::util::nodemap::{NodeMap, DefIdMap}; use syntax::ast; use syntax::ext::base::MacroKind; use syntax_pos::Span; +use rustc_macros::HashStable; use crate::hir; use crate::ty; use self::Namespace::*; -#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, HashStable)] pub enum CtorKind { /// Constructor function automatically created by a tuple struct/variant. Fn, @@ -18,7 +19,7 @@ pub enum CtorKind { Fictive, } -#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, HashStable)] pub enum NonMacroAttrKind { /// Single-segment attribute defined by the language (`#[inline]`) Builtin, @@ -32,7 +33,7 @@ pub enum NonMacroAttrKind { Custom, } -#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, HashStable)] pub enum Def { // Type namespace Mod(DefId), @@ -209,7 +210,7 @@ pub type ExportMap = DefIdMap>; /// namespace. pub type ImportMap = NodeMap>>; -#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct Export { /// The name of the target. pub ident: ast::Ident, diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index e47bc3d1c253..14e39748eb08 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -122,6 +122,7 @@ impl fmt::Display for HirId { // hack to ensure that we don't try to access the private parts of `ItemLocalId` in this module mod item_local_id_inner { use rustc_data_structures::indexed_vec::Idx; + use rustc_macros::HashStable; newtype_index! { /// An `ItemLocalId` uniquely identifies something within a given "item-like", /// that is within a hir::Item, hir::TraitItem, or hir::ImplItem. There is no @@ -131,7 +132,9 @@ mod item_local_id_inner { /// integers starting at zero, so a mapping that maps all or most nodes within /// an "item-like" to something else can be implement by a `Vec` instead of a /// tree or hash map. - pub struct ItemLocalId { .. } + pub struct ItemLocalId { + derive [HashStable] + } } } @@ -164,7 +167,7 @@ pub struct Lifetime { pub name: LifetimeName, } -#[derive(Debug, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +#[derive(Debug, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy, HashStable)] pub enum ParamName { /// Some user-given name like `T` or `'x`. Plain(Ident), @@ -207,7 +210,7 @@ impl ParamName { } } -#[derive(Debug, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +#[derive(Debug, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy, HashStable)] pub enum LifetimeName { /// User-given names or fresh (synthetic) names. Param(ParamName), @@ -290,7 +293,7 @@ impl Lifetime { /// A `Path` is essentially Rust's notion of a name; for instance, /// `std::cmp::PartialEq`. It's represented as a sequence of identifiers, /// along with a bunch of supporting information. -#[derive(Clone, RustcEncodable, RustcDecodable)] +#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] pub struct Path { pub span: Span, /// The definition that the path resolved to. @@ -319,9 +322,10 @@ impl fmt::Display for Path { /// A segment of a path: an identifier, an optional lifetime, and a set of /// types. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct PathSegment { /// The identifier portion of this path segment. + #[stable_hasher(project(name))] pub ident: Ident, // `id` and `def` are optional. We currently only use these in save-analysis, // any path segments without these will not have save-analysis info and @@ -391,13 +395,13 @@ impl PathSegment { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct ConstArg { pub value: AnonConst, pub span: Span, } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum GenericArg { Lifetime(Lifetime), Type(Ty), @@ -422,7 +426,7 @@ impl GenericArg { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct GenericArgs { /// The generic arguments for this path segment. pub args: HirVec, @@ -486,7 +490,7 @@ impl GenericArgs { /// A modifier on a bound, currently this is only used for `?Sized`, where the /// modifier is `Maybe`. Negative bounds should also be handled here. -#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, HashStable)] pub enum TraitBoundModifier { None, Maybe, @@ -496,7 +500,7 @@ pub enum TraitBoundModifier { /// `typeck::collect::compute_bounds` matches these against /// the "special" built-in traits (see `middle::lang_items`) and /// detects `Copy`, `Send` and `Sync`. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum GenericBound { Trait(PolyTraitRef, TraitBoundModifier), Outlives(Lifetime), @@ -513,7 +517,7 @@ impl GenericBound { pub type GenericBounds = HirVec; -#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum LifetimeParamKind { // Indicates that the lifetime definition was explicitly declared (e.g., in // `fn foo<'a>(x: &'a u8) -> &'a u8 { x }`). @@ -532,7 +536,7 @@ pub enum LifetimeParamKind { Error, } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum GenericParamKind { /// A lifetime definition (e.g., `'a: 'b + 'c + 'd`). Lifetime { @@ -547,7 +551,7 @@ pub enum GenericParamKind { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct GenericParam { pub hir_id: HirId, pub name: ParamName, @@ -568,7 +572,7 @@ pub struct GenericParamCount { /// Represents lifetimes and type parameters attached to a declaration /// of a function, enum, trait, etc. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct Generics { pub params: HirVec, pub where_clause: WhereClause, @@ -616,13 +620,13 @@ impl Generics { /// Synthetic type parameters are converted to another form during lowering; this allows /// us to track the original form they had, and is useful for error messages. -#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, HashStable)] pub enum SyntheticTyParamKind { ImplTrait } /// A where-clause in a definition. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct WhereClause { pub hir_id: HirId, pub predicates: HirVec, @@ -641,7 +645,7 @@ impl WhereClause { } /// A single predicate in a where-clause. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum WherePredicate { /// A type binding (e.g., `for<'c> Foo: Send + Clone + 'c`). BoundPredicate(WhereBoundPredicate), @@ -662,7 +666,7 @@ impl WherePredicate { } /// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`). -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct WhereBoundPredicate { pub span: Span, /// Any generics from a `for` binding. @@ -674,7 +678,7 @@ pub struct WhereBoundPredicate { } /// A lifetime predicate (e.g., `'a: 'b + 'c`). -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct WhereRegionPredicate { pub span: Span, pub lifetime: Lifetime, @@ -682,7 +686,7 @@ pub struct WhereRegionPredicate { } /// An equality predicate (e.g., `T = int`); currently unsupported. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct WhereEqPredicate { pub hir_id: HirId, pub span: Span, @@ -801,7 +805,7 @@ impl Crate { /// A macro definition, in this crate or imported from another. /// /// Not parsed directly, but created on macro import or `macro_rules!` expansion. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct MacroDef { pub name: Name, pub vis: Visibility, @@ -812,13 +816,14 @@ pub struct MacroDef { pub legacy: bool, } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct Block { /// Statements in a block. pub stmts: HirVec, /// An expression at the end of the block /// without a semicolon, if any. pub expr: Option>, + #[stable_hasher(ignore)] pub hir_id: HirId, /// Distinguishes between `unsafe { ... }` and `{ ... }`. pub rules: BlockCheckMode, @@ -829,8 +834,9 @@ pub struct Block { pub targeted_by_break: bool, } -#[derive(Clone, RustcEncodable, RustcDecodable)] +#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] pub struct Pat { + #[stable_hasher(ignore)] pub hir_id: HirId, pub node: PatKind, pub span: Span, @@ -891,10 +897,12 @@ impl Pat { /// Patterns like the fields of Foo `{ x, ref y, ref mut z }` /// are treated the same as` x: x, y: ref y, z: ref mut z`, /// except `is_shorthand` is true. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct FieldPat { + #[stable_hasher(ignore)] pub hir_id: HirId, /// The identifier for the field. + #[stable_hasher(project(name))] pub ident: Ident, /// The pattern the field is destructured to. pub pat: P, @@ -904,7 +912,7 @@ pub struct FieldPat { /// Explicit binding annotations given in the HIR for a binding. Note /// that this is not the final binding *mode* that we infer after type /// inference. -#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub enum BindingAnnotation { /// No binding annotation given: this means that the final binding mode /// will depend on whether we have skipped through a `&` reference @@ -925,13 +933,13 @@ pub enum BindingAnnotation { RefMut, } -#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)] +#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum RangeEnd { Included, Excluded, } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum PatKind { /// Represents a wildcard pattern (i.e., `_`). Wild, @@ -976,7 +984,8 @@ pub enum PatKind { Slice(HirVec>, Option>, HirVec>), } -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, HashStable, + RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum Mutability { MutMutable, MutImmutable, @@ -992,7 +1001,7 @@ impl Mutability { } } -#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, Hash)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, Hash, HashStable)] pub enum BinOpKind { /// The `+` operator (addition). Add, @@ -1126,7 +1135,7 @@ impl Into for BinOpKind { pub type BinOp = Spanned; -#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, Hash)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, Hash, HashStable)] pub enum UnOp { /// The `*` operator (deferencing). UnDeref, @@ -1169,7 +1178,7 @@ impl fmt::Debug for Stmt { } } -#[derive(Clone, RustcEncodable, RustcDecodable)] +#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] pub enum StmtKind { /// A local (`let`) binding. Local(P), @@ -1196,7 +1205,7 @@ impl StmtKind { } /// Represents a `let` statement (i.e., `let : = ;`). -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct Local { pub pat: P, pub ty: Option>, @@ -1209,7 +1218,7 @@ pub struct Local { } /// Represents a single arm of a `match` expression. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct Arm { pub attrs: HirVec, pub pats: HirVec>, @@ -1217,13 +1226,14 @@ pub struct Arm { pub body: P, } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum Guard { If(P), } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct Field { + #[stable_hasher(ignore)] pub hir_id: HirId, pub ident: Ident, pub expr: P, @@ -1231,7 +1241,7 @@ pub struct Field { pub is_shorthand: bool, } -#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub enum BlockCheckMode { DefaultBlock, UnsafeBlock(UnsafeSource), @@ -1239,7 +1249,7 @@ pub enum BlockCheckMode { PopUnsafeBlock(UnsafeSource), } -#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub enum UnsafeSource { CompilerGenerated, UserProvided, @@ -1315,7 +1325,7 @@ impl BodyOwnerKind { /// These are usually found nested inside types (e.g., array lengths) /// or expressions (e.g., repeat counts), and also used to define /// explicit discriminant values for enum variants. -#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct AnonConst { pub hir_id: HirId, pub body: BodyId, @@ -1431,7 +1441,7 @@ impl fmt::Debug for Expr { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum ExprKind { /// A `box x` expression. Box(P), @@ -1537,7 +1547,7 @@ pub enum ExprKind { } /// Optionally `Self`-qualified value/type path or associated extension. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum QPath { /// Path to a definition, optionally "fully-qualified" with a `Self` /// type, if the path points to an associated item in a trait. @@ -1557,7 +1567,7 @@ pub enum QPath { } /// Hints at the original code for a let statement. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub enum LocalSource { /// A `match _ { .. }`. Normal, @@ -1566,7 +1576,7 @@ pub enum LocalSource { } /// Hints at the original code for a `match _ { .. }`. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy, HashStable)] pub enum MatchSource { /// A `match _ { .. }`. Normal, @@ -1584,7 +1594,7 @@ pub enum MatchSource { } /// The loop type that yielded an `ExprKind::Loop`. -#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub enum LoopSource { /// A `loop { .. }` loop. Loop, @@ -1594,7 +1604,7 @@ pub enum LoopSource { ForLoop, } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub enum LoopIdError { OutsideLoopScope, UnlabeledCfInWhileCondition, @@ -1612,7 +1622,7 @@ impl fmt::Display for LoopIdError { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub struct Destination { // This is `Some(_)` iff there is an explicit user-specified `label pub label: Option::new` and /// so forth. -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)] pub enum UserType<'tcx> { Ty(Ty<'tcx>), diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index 49ebd202813f..e0b7bbc68e25 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -3,18 +3,19 @@ use crate::hir::def_id::DefId; use crate::ty::{self, Ty, PolyFnSig, TypeFoldable, SubstsRef, TyCtxt}; use crate::traits; use rustc_target::spec::abi::Abi; +use rustc_macros::HashStable; use crate::util::ppaux; use std::fmt; use std::iter; -#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct Instance<'tcx> { pub def: InstanceDef<'tcx>, pub substs: SubstsRef<'tcx>, } -#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable, HashStable)] pub enum InstanceDef<'tcx> { Item(DefId), Intrinsic(DefId), diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 1a44dbdbb61a..68bdae7d744c 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -10,6 +10,7 @@ use crate::hir::def::{Def, CtorKind, ExportMap}; use crate::hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use crate::hir::map::DefPathData; use rustc_data_structures::svh::Svh; +use rustc_macros::HashStable; use crate::ich::Fingerprint; use crate::ich::StableHashingContext; use crate::infer::canonical::Canonical; @@ -128,7 +129,7 @@ pub struct Resolutions { pub extern_prelude: FxHashMap, } -#[derive(Clone, Copy, PartialEq, Eq, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, Debug, HashStable)] pub enum AssociatedItemContainer { TraitContainer(DefId), ImplContainer(DefId), @@ -163,9 +164,10 @@ pub struct ImplHeader<'tcx> { pub predicates: Vec>, } -#[derive(Copy, Clone, Debug, PartialEq)] +#[derive(Copy, Clone, Debug, PartialEq, HashStable)] pub struct AssociatedItem { pub def_id: DefId, + #[stable_hasher(project(name))] pub ident: Ident, pub kind: AssociatedKind, pub vis: Visibility, @@ -177,7 +179,7 @@ pub struct AssociatedItem { pub method_has_self_argument: bool, } -#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, RustcEncodable, RustcDecodable, HashStable)] pub enum AssociatedKind { Const, Method, @@ -225,7 +227,7 @@ impl AssociatedItem { } } -#[derive(Clone, Debug, PartialEq, Eq, Copy, RustcEncodable, RustcDecodable)] +#[derive(Clone, Debug, PartialEq, Eq, Copy, RustcEncodable, RustcDecodable, HashStable)] pub enum Visibility { /// Visible everywhere (including in other crates). Public, @@ -312,7 +314,7 @@ impl Visibility { } } -#[derive(Copy, Clone, PartialEq, Eq, RustcDecodable, RustcEncodable, Hash)] +#[derive(Copy, Clone, PartialEq, Eq, RustcDecodable, RustcEncodable, Hash, HashStable)] pub enum Variance { Covariant, // T <: T iff A <: B -- e.g., function return type Invariant, // T <: T iff B == A -- e.g., type of mutable cell @@ -326,6 +328,7 @@ pub enum Variance { /// HIR of every item in the local crate. Instead, use /// `tcx.variances_of()` to get the variance for a *particular* /// item. +#[derive(HashStable)] pub struct CrateVariancesMap { /// For each item with generics, maps to a vector of the variance /// of its generics. If an item has no generics, it will have no @@ -333,6 +336,7 @@ pub struct CrateVariancesMap { pub variances: FxHashMap>>, /// An empty vector, useful for cloning. + #[stable_hasher(ignore)] pub empty_variance: Lrc>, } @@ -718,7 +722,7 @@ impl List { } } -#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)] pub struct UpvarPath { pub hir_id: hir::HirId, } @@ -726,13 +730,13 @@ pub struct UpvarPath { /// Upvars do not get their own `NodeId`. Instead, we use the pair of /// the original var ID (that is, the root variable that is referenced /// by the upvar) and the ID of the closure expression. -#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)] pub struct UpvarId { pub var_path: UpvarPath, pub closure_expr_id: LocalDefId, } -#[derive(Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable, Copy)] +#[derive(Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable, Copy, HashStable)] pub enum BorrowKind { /// Data must be immutable and is aliasable. ImmBorrow, @@ -780,7 +784,7 @@ pub enum BorrowKind { /// Information describing the capture of an upvar. This is computed /// during `typeck`, specifically by `regionck`. -#[derive(PartialEq, Clone, Debug, Copy, RustcEncodable, RustcDecodable)] +#[derive(PartialEq, Clone, Debug, Copy, RustcEncodable, RustcDecodable, HashStable)] pub enum UpvarCapture<'tcx> { /// Upvar is captured by value. This is always true when the /// closure is labeled `move`, but can also be true in other cases @@ -791,7 +795,7 @@ pub enum UpvarCapture<'tcx> { ByRef(UpvarBorrow<'tcx>), } -#[derive(PartialEq, Clone, Copy, RustcEncodable, RustcDecodable)] +#[derive(PartialEq, Clone, Copy, RustcEncodable, RustcDecodable, HashStable)] pub struct UpvarBorrow<'tcx> { /// The kind of borrow: by-ref upvars have access to shared /// immutable borrows, which are not part of the normal language @@ -833,7 +837,7 @@ impl ty::EarlyBoundRegion { } } -#[derive(Clone, Debug, RustcEncodable, RustcDecodable)] +#[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable)] pub enum GenericParamDefKind { Lifetime, Type { @@ -844,7 +848,7 @@ pub enum GenericParamDefKind { Const, } -#[derive(Clone, RustcEncodable, RustcDecodable)] +#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] pub struct GenericParamDef { pub name: InternedString, pub def_id: DefId, @@ -892,13 +896,14 @@ pub struct GenericParamCount { /// /// The ordering of parameters is the same as in `Subst` (excluding child generics): /// `Self` (optionally), `Lifetime` params..., `Type` params... -#[derive(Clone, Debug, RustcEncodable, RustcDecodable)] +#[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct Generics { pub parent: Option, pub parent_count: usize, pub params: Vec, /// Reverse map to the `index` field of each `GenericParamDef` + #[stable_hasher(ignore)] pub param_def_id_to_index: FxHashMap, pub has_self: bool, @@ -995,7 +1000,7 @@ impl<'a, 'gcx, 'tcx> Generics { } /// Bounds on generics. -#[derive(Clone, Default)] +#[derive(Clone, Default, HashStable)] pub struct GenericPredicates<'tcx> { pub parent: Option, pub predicates: Vec<(Predicate<'tcx>, Span)>, @@ -1058,7 +1063,7 @@ impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> { } } -#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)] pub enum Predicate<'tcx> { /// Corresponds to `where Foo: Bar`. `Foo` here would be /// the `Self` type of the trait reference and `A`, `B`, and `C` @@ -1099,6 +1104,7 @@ pub enum Predicate<'tcx> { /// HIR of every item in the local crate. Instead, use /// `tcx.inferred_outlives_of()` to get the outlives for a *particular* /// item. +#[derive(HashStable)] pub struct CratePredicatesMap<'tcx> { /// For each struct with outlive bounds, maps to a vector of the /// predicate of its outlive bounds. If an item has no outlives @@ -1106,6 +1112,7 @@ pub struct CratePredicatesMap<'tcx> { pub predicates: FxHashMap>>>, /// An empty vector, useful for cloning. + #[stable_hasher(ignore)] pub empty_predicate: Lrc>>, } @@ -1209,7 +1216,7 @@ impl<'a, 'gcx, 'tcx> Predicate<'tcx> { } } -#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)] pub struct TraitPredicate<'tcx> { pub trait_ref: TraitRef<'tcx> } @@ -1237,7 +1244,8 @@ impl<'tcx> PolyTraitPredicate<'tcx> { } } -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, + Hash, Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct OutlivesPredicate(pub A, pub B); // `A: B` pub type PolyOutlivesPredicate = ty::Binder>; pub type RegionOutlivesPredicate<'tcx> = OutlivesPredicate, @@ -1247,7 +1255,7 @@ pub type TypeOutlivesPredicate<'tcx> = OutlivesPredicate, pub type PolyRegionOutlivesPredicate<'tcx> = ty::Binder>; pub type PolyTypeOutlivesPredicate<'tcx> = ty::Binder>; -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct SubtypePredicate<'tcx> { pub a_is_expected: bool, pub a: Ty<'tcx>, @@ -1267,7 +1275,7 @@ pub type PolySubtypePredicate<'tcx> = ty::Binder>; /// equality between arbitrary types. Processing an instance of /// Form #2 eventually yields one of these `ProjectionPredicate` /// instances to normalize the LHS. -#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)] pub struct ProjectionPredicate<'tcx> { pub projection_ty: ProjectionTy<'tcx>, pub ty: Ty<'tcx>, @@ -1622,7 +1630,7 @@ pub type PlaceholderType = Placeholder; /// When type checking, we use the `ParamEnv` to track /// details about the set of where-clauses that are in scope at this /// particular point. -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)] pub struct ParamEnv<'tcx> { /// Obligations that the caller must satisfy. This is basically /// the set of bounds on the in-scope type parameters, translated @@ -1757,13 +1765,14 @@ impl<'a, 'gcx, T> HashStable> for ParamEnvAnd<'gcx, T> } } -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, HashStable)] pub struct Destructor { /// The `DefId` of the destructor method pub did: DefId, } bitflags! { + #[derive(HashStable)] pub struct AdtFlags: u32 { const NO_ADT_FLAGS = 0; const IS_ENUM = 1 << 0; @@ -1784,6 +1793,7 @@ bitflags! { } bitflags! { + #[derive(HashStable)] pub struct VariantFlags: u32 { const NO_VARIANT_FLAGS = 0; /// Indicates whether the field list of this variant is `#[non_exhaustive]`. @@ -1861,7 +1871,7 @@ impl_stable_hash_for!(struct VariantDef { flags }); -#[derive(Copy, Clone, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable, HashStable)] pub enum VariantDiscr { /// Explicit value for this variant, i.e., `X = 123`. /// The `DefId` corresponds to the embedded constant. @@ -1874,9 +1884,10 @@ pub enum VariantDiscr { Relative(u32), } -#[derive(Debug)] +#[derive(Debug, HashStable)] pub struct FieldDef { pub did: DefId, + #[stable_hasher(project(name))] pub ident: Ident, pub vis: Visibility, } @@ -2497,7 +2508,8 @@ impl<'a, 'gcx, 'tcx> FieldDef { /// /// You can get the environment type of a closure using /// `tcx.closure_env_ty()`. -#[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)] +#[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, Debug, + RustcEncodable, RustcDecodable, HashStable)] pub enum ClosureKind { // Warning: Ordering is significant here! The ordering is chosen // because the trait Fn is a subtrait of FnMut and so in turn, and @@ -3092,7 +3104,7 @@ fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Asso parent_item.node) } -#[derive(Clone)] +#[derive(Clone, HashStable)] pub struct AdtSizedConstraint<'tcx>(pub &'tcx [Ty<'tcx>]); /// Calculates the `Sized` constraint. @@ -3325,7 +3337,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { /// rather, you should request the vector for a specific type via /// `tcx.inherent_impls(def_id)` so as to minimize your dependencies /// (constructing this map requires touching the entire crate). -#[derive(Clone, Debug, Default)] +#[derive(Clone, Debug, Default, HashStable)] pub struct CrateInherentImpls { pub inherent_impls: DefIdMap>>, } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 95148834e01c..39728cc8cd5c 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -7,6 +7,7 @@ use crate::mir::interpret::{ConstValue, truncate}; use crate::middle::region; use polonius_engine::Atom; use rustc_data_structures::indexed_vec::Idx; +use rustc_macros::HashStable; use crate::ty::subst::{InternalSubsts, Subst, SubstsRef, Kind, UnpackedKind}; use crate::ty::{self, AdtDef, TypeFlags, Ty, TyCtxt, TypeFoldable}; use crate::ty::{List, TyS, ParamEnvAnd, ParamEnv}; @@ -25,14 +26,15 @@ use serialize; use self::InferTy::*; use self::TyKind::*; -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, + Hash, Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct TypeAndMut<'tcx> { pub ty: Ty<'tcx>, pub mutbl: hir::Mutability, } #[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, - RustcEncodable, RustcDecodable, Copy)] + RustcEncodable, RustcDecodable, Copy, HashStable)] /// A "free" region `fr` can be interpreted as "some region /// at least as big as the scope `fr.scope`". pub struct FreeRegion { @@ -41,7 +43,7 @@ pub struct FreeRegion { } #[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, - RustcEncodable, RustcDecodable, Copy)] + RustcEncodable, RustcDecodable, Copy, HashStable)] pub enum BoundRegion { /// An anonymous region parameter for a given fn (&T) BrAnon(u32), @@ -82,7 +84,8 @@ impl BoundRegion { /// N.B., if you change this, you'll probably want to change the corresponding /// AST structure in `libsyntax/ast.rs` as well. -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, + RustcEncodable, RustcDecodable, HashStable)] pub enum TyKind<'tcx> { /// The primitive boolean type. Written as `bool`. Bool, @@ -303,7 +306,8 @@ static_assert!(MEM_SIZE_OF_TY_KIND: ::std::mem::size_of::>() == 24); /// /// It'd be nice to split this struct into ClosureSubsts and /// GeneratorSubsts, I believe. -nmatsakis -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, + Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct ClosureSubsts<'tcx> { /// Lifetime and type parameters from the enclosing function, /// concatenated with the types of the upvars. @@ -386,7 +390,8 @@ impl<'tcx> ClosureSubsts<'tcx> { } } -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, + RustcEncodable, RustcDecodable, HashStable)] pub struct GeneratorSubsts<'tcx> { pub substs: SubstsRef<'tcx>, } @@ -519,7 +524,8 @@ impl<'tcx> UpvarSubsts<'tcx> { } } -#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Ord, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Ord, Eq, Hash, + RustcEncodable, RustcDecodable, HashStable)] pub enum ExistentialPredicate<'tcx> { /// E.g., `Iterator`. Trait(ExistentialTraitRef<'tcx>), @@ -670,7 +676,7 @@ impl<'tcx> Binder<&'tcx List>> { /// Note that a `TraitRef` introduces a level of region binding, to /// account for higher-ranked trait bounds like `T: for<'a> Foo<&'a U>` /// or higher-ranked object types. -#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)] pub struct TraitRef<'tcx> { pub def_id: DefId, pub substs: SubstsRef<'tcx>, @@ -740,7 +746,8 @@ impl<'tcx> PolyTraitRef<'tcx> { /// /// The substitutions don't include the erased `Self`, only trait /// type and lifetime parameters (`[X, Y]` and `['a, 'b]` above). -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, + RustcEncodable, RustcDecodable, HashStable)] pub struct ExistentialTraitRef<'tcx> { pub def_id: DefId, pub substs: SubstsRef<'tcx>, @@ -913,7 +920,8 @@ impl Binder { /// Represents the projection of an associated type. In explicit UFCS /// form this would be written `>::N`. -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, + Hash, Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct ProjectionTy<'tcx> { /// The parameters of the associated item. pub substs: SubstsRef<'tcx>, @@ -958,7 +966,7 @@ impl<'a, 'tcx> ProjectionTy<'tcx> { } } -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)] pub struct GenSig<'tcx> { pub yield_ty: Ty<'tcx>, pub return_ty: Ty<'tcx>, @@ -981,7 +989,8 @@ impl<'tcx> PolyGenSig<'tcx> { /// - `inputs`: is the list of arguments and their modes. /// - `output`: is the return type. /// - `c_variadic`: indicates whether this is a C-variadic function. -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, + Hash, RustcEncodable, RustcDecodable, HashStable)] pub struct FnSig<'tcx> { pub inputs_and_output: &'tcx List>, pub c_variadic: bool, @@ -1031,7 +1040,8 @@ impl<'tcx> PolyFnSig<'tcx> { pub type CanonicalPolyFnSig<'tcx> = Canonical<'tcx, Binder>>; -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, + Hash, RustcEncodable, RustcDecodable, HashStable)] pub struct ParamTy { pub idx: u32, pub name: InternedString, @@ -1062,7 +1072,8 @@ impl<'a, 'gcx, 'tcx> ParamTy { } } -#[derive(Copy, Clone, Hash, RustcEncodable, RustcDecodable, Eq, PartialEq, Ord, PartialOrd)] +#[derive(Copy, Clone, Hash, RustcEncodable, RustcDecodable, + Eq, PartialEq, Ord, PartialOrd, HashStable)] pub struct ParamConst { pub index: u32, pub name: InternedString, @@ -1278,7 +1289,8 @@ impl Atom for RegionVid { } } -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, + Hash, RustcEncodable, RustcDecodable, HashStable)] pub enum InferTy { TyVar(TyVid), IntVar(IntVid), @@ -1321,7 +1333,8 @@ impl From for BoundTy { } /// A `ProjectionPredicate` for an `ExistentialTraitRef`. -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, + Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct ExistentialProjection<'tcx> { pub item_def_id: DefId, pub substs: SubstsRef<'tcx>, @@ -2083,7 +2096,8 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } -#[derive(Copy, Clone, Debug, Hash, RustcEncodable, RustcDecodable, Eq, PartialEq, Ord, PartialOrd)] +#[derive(Copy, Clone, Debug, Hash, RustcEncodable, RustcDecodable, + Eq, PartialEq, Ord, PartialOrd, HashStable)] /// Used in the HIR by using `Unevaluated` everywhere and later normalizing to `Evaluated` if the /// code is monomorphic enough for that. pub enum LazyConst<'tcx> { @@ -2129,7 +2143,8 @@ impl<'tcx> LazyConst<'tcx> { } /// Typed constant value. -#[derive(Copy, Clone, Debug, Hash, RustcEncodable, RustcDecodable, Eq, PartialEq, Ord, PartialOrd)] +#[derive(Copy, Clone, Debug, Hash, RustcEncodable, RustcDecodable, + Eq, PartialEq, Ord, PartialOrd, HashStable)] pub struct Const<'tcx> { pub ty: Ty<'tcx>, @@ -2273,7 +2288,8 @@ impl<'tcx> Const<'tcx> { impl<'tcx> serialize::UseSpecializedDecodable for &'tcx LazyConst<'tcx> {} /// An inference variable for a const, for use in const generics. -#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, + Ord, RustcEncodable, RustcDecodable, Hash, HashStable)] pub enum InferConst<'tcx> { /// Infer the value of the const. Var(ConstVid<'tcx>), diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 35c6f980cd93..38be19a71c48 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -9,6 +9,7 @@ use crate::mir::interpret::ConstValue; use serialize::{self, Encodable, Encoder, Decodable, Decoder}; use syntax_pos::{Span, DUMMY_SP}; use smallvec::SmallVec; +use rustc_macros::HashStable; use core::intrinsics; use std::cmp::Ordering; @@ -33,7 +34,7 @@ const TYPE_TAG: usize = 0b00; const REGION_TAG: usize = 0b01; const CONST_TAG: usize = 0b10; -#[derive(Debug, RustcEncodable, RustcDecodable, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, RustcEncodable, RustcDecodable, PartialEq, Eq, PartialOrd, Ord, HashStable)] pub enum UnpackedKind<'tcx> { Lifetime(ty::Region<'tcx>), Type(Ty<'tcx>), @@ -666,7 +667,7 @@ pub type CanonicalUserSubsts<'tcx> = Canonical<'tcx, UserSubsts<'tcx>>; /// Stores the user-given substs to reach some fully qualified path /// (e.g., `::Item` or `::Item`). -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)] pub struct UserSubsts<'tcx> { /// The substitutions for the item as given by the user. pub substs: SubstsRef<'tcx>, @@ -707,7 +708,7 @@ BraceStructLiftImpl! { /// the impl (with the substs from `UserSubsts`) and apply those to /// the self type, giving `Foo`. Finally, we unify that with /// the self type here, which contains `?A` to be `&'static u32` -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)] pub struct UserSelfTy<'tcx> { pub impl_def_id: DefId, pub self_ty: Ty<'tcx>, diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs index 9ce8bf2e60a3..b25a6c4f28c7 100644 --- a/src/librustc/ty/trait_def.rs +++ b/src/librustc/ty/trait_def.rs @@ -11,9 +11,13 @@ use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult}; use rustc_data_structures::sync::Lrc; +use rustc_macros::HashStable; /// A trait's definition with type information. +#[derive(HashStable)] pub struct TraitDef { + // We already have the def_path_hash below, no need to hash it twice + #[stable_hasher(ignore)] pub def_id: DefId, pub unsafety: hir::Unsafety, diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index fb0d1e2080b0..422f97b29964 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -18,6 +18,7 @@ use crate::middle::lang_items; use rustc_data_structures::stable_hasher::{StableHasher, HashStable}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_macros::HashStable; use std::{cmp, fmt}; use syntax::ast; use syntax::attr::{self, SignedInt, UnsignedInt}; @@ -1005,7 +1006,7 @@ fn is_freeze_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, )) } -#[derive(Clone)] +#[derive(Clone, HashStable)] pub struct NeedsDrop(pub bool); fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index dd635e5c946f..5622fe434363 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -12,6 +12,7 @@ use std::time::{Duration, Instant}; use std::sync::mpsc::{Sender}; use syntax_pos::{SpanData}; +use rustc_macros::HashStable; use crate::ty::TyCtxt; use crate::dep_graph::{DepNode}; use lazy_static; @@ -22,7 +23,7 @@ pub const FN_OUTPUT_NAME: &str = "Output"; // Useful type to use with `Result<>` indicate that an error has already // been reported to the user, so no need to continue checking. -#[derive(Clone, Copy, Debug, RustcEncodable, RustcDecodable)] +#[derive(Clone, Copy, Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct ErrorReported; thread_local!(static TIME_DEPTH: Cell = Cell::new(0)); diff --git a/src/librustc_data_structures/thin_vec.rs b/src/librustc_data_structures/thin_vec.rs index ed57c528f51e..52f23f4893ee 100644 --- a/src/librustc_data_structures/thin_vec.rs +++ b/src/librustc_data_structures/thin_vec.rs @@ -1,3 +1,5 @@ +use crate::stable_hasher::{StableHasher, StableHasherResult, HashStable}; + /// A vector type optimized for cases where this size is usually 0 (cf. `SmallVector`). /// The `Option>` wrapping allows us to represent a zero sized vector with `None`, /// which uses only a single (null) pointer. @@ -56,3 +58,11 @@ impl Extend for ThinVec { } } } + +impl, CTX> HashStable for ThinVec { + fn hash_stable(&self, + hcx: &mut CTX, + hasher: &mut StableHasher) { + (**self).hash_stable(hcx, hasher) + } +} From bc3a84a7f33d8652cbf53c0877731265e3ecc1bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Wed, 13 Mar 2019 00:08:36 +0100 Subject: [PATCH 381/381] Add missing project attributes --- src/librustc/hir/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 14e39748eb08..88ab58d10fc3 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -2039,6 +2039,7 @@ pub struct EnumDef { #[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct VariantKind { + #[stable_hasher(project(name))] pub ident: Ident, pub attrs: HirVec, pub data: VariantData, @@ -2383,6 +2384,7 @@ pub enum AssociatedItemKind { #[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct ForeignItem { + #[stable_hasher(project(name))] pub ident: Ident, pub attrs: HirVec, pub node: ForeignItemKind,