diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 6fd45e78f2d9..411a72447a4f 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -782,7 +782,10 @@ impl<'a> Resolver<'a> { ); let def_span = suggestion.res.opt_def_id().and_then(|def_id| match def_id.krate { LOCAL_CRATE => self.definitions.opt_span(def_id), - _ => Some(self.cstore().get_span_untracked(def_id, self.session)), + _ => Some(self.session.source_map().def_span(self.cstore().get_span_untracked( + def_id, + self.session, + ))), }); if let Some(span) = def_span { err.span_label( diff --git a/src/test/ui/derives/deriving-meta-unknown-trait.stderr b/src/test/ui/derives/deriving-meta-unknown-trait.stderr index ab382e9284eb..666cc69f6e96 100644 --- a/src/test/ui/derives/deriving-meta-unknown-trait.stderr +++ b/src/test/ui/derives/deriving-meta-unknown-trait.stderr @@ -7,7 +7,7 @@ LL | #[derive(Eqr)] ::: $SRC_DIR/libcore/cmp.rs:LL:COL | LL | pub macro Eq($item:item) { /* compiler built-in */ } - | ---------------------------------------------------- similarly named derive macro `Eq` defined here + | ------------------------ similarly named derive macro `Eq` defined here error: cannot find derive macro `Eqr` in this scope --> $DIR/deriving-meta-unknown-trait.rs:1:10 diff --git a/src/test/ui/issues/issue-17546.stderr b/src/test/ui/issues/issue-17546.stderr index 255521a0be90..5bbe6d3b1717 100644 --- a/src/test/ui/issues/issue-17546.stderr +++ b/src/test/ui/issues/issue-17546.stderr @@ -1,19 +1,13 @@ error[E0573]: expected type, found variant `NoResult` --> $DIR/issue-17546.rs:12:17 | -LL | fn new() -> NoResult { - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn new() -> NoResult { + | ^^^^^^^^^^^^^^^^^^^^^^^^ | ::: $SRC_DIR/libcore/result.rs:LL:COL | -LL | / pub enum Result { -LL | | /// Contains the success value -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), -... | -LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E), -LL | | } - | |_- similarly named enum `Result` defined here +LL | pub enum Result { + | --------------------- similarly named enum `Result` defined here | help: try using the variant's enum | @@ -63,19 +57,13 @@ LL | use std::result::Result; error[E0573]: expected type, found variant `NoResult` --> $DIR/issue-17546.rs:33:15 | -LL | fn newer() -> NoResult { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn newer() -> NoResult { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ::: $SRC_DIR/libcore/result.rs:LL:COL | -LL | / pub enum Result { -LL | | /// Contains the success value -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), -... | -LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E), -LL | | } - | |_- similarly named enum `Result` defined here +LL | pub enum Result { + | --------------------- similarly named enum `Result` defined here | help: try using the variant's enum | diff --git a/src/test/ui/issues/issue-7607-1.stderr b/src/test/ui/issues/issue-7607-1.stderr index 40c25b9f78c5..472f8e013a92 100644 --- a/src/test/ui/issues/issue-7607-1.stderr +++ b/src/test/ui/issues/issue-7607-1.stderr @@ -1,17 +1,13 @@ error[E0412]: cannot find type `Fo` in this scope --> $DIR/issue-7607-1.rs:5:6 | -LL | impl Fo { - | ^^ help: a trait with a similar name exists: `Fn` +LL | impl Fo { + | ^^ help: a trait with a similar name exists: `Fn` | ::: $SRC_DIR/libcore/ops/function.rs:LL:COL | -LL | / pub trait Fn : FnMut { -LL | | /// Performs the call operation. -LL | | #[unstable(feature = "fn_traits", issue = "29625")] -LL | | extern "rust-call" fn call(&self, args: Args) -> Self::Output; -LL | | } - | |_- similarly named trait `Fn` defined here +LL | pub trait Fn : FnMut { + | -------------------------------- similarly named trait `Fn` defined here error: aborting due to previous error diff --git a/src/test/ui/macros/macro-name-typo.stderr b/src/test/ui/macros/macro-name-typo.stderr index 7e5dfe20e961..5604341fa34d 100644 --- a/src/test/ui/macros/macro-name-typo.stderr +++ b/src/test/ui/macros/macro-name-typo.stderr @@ -1,18 +1,13 @@ error: cannot find macro `printlx` in this scope --> $DIR/macro-name-typo.rs:2:5 | -LL | printlx!("oh noes!"); - | ^^^^^^^ help: a macro with a similar name exists: `println` +LL | printlx!("oh noes!"); + | ^^^^^^^ help: a macro with a similar name exists: `println` | ::: $SRC_DIR/libstd/macros.rs:LL:COL | -LL | / macro_rules! println { -LL | | () => ($crate::print!("\n")); -LL | | ($($arg:tt)*) => ({ -LL | | $crate::io::_print($crate::format_args_nl!($($arg)*)); -LL | | }) -LL | | } - | |_- similarly named macro `println` defined here +LL | macro_rules! println { + | -------------------- similarly named macro `println` defined here 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 3d72cc82cbdf..e26a914e243e 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-3.stderr +++ b/src/test/ui/macros/macro-path-prelude-fail-3.stderr @@ -7,7 +7,7 @@ LL | inline!(); ::: $SRC_DIR/libcore/macros.rs:LL:COL | LL | macro_rules! line { () => { /* compiler built-in */ } } - | ------------------------------------------------------- similarly named macro `line` defined here + | ----------------- similarly named macro `line` defined here error: aborting due to previous error diff --git a/src/test/ui/macros/macro-use-wrong-name.stderr b/src/test/ui/macros/macro-use-wrong-name.stderr index d76eb69b3c4c..74fb519cc82f 100644 --- a/src/test/ui/macros/macro-use-wrong-name.stderr +++ b/src/test/ui/macros/macro-use-wrong-name.stderr @@ -7,7 +7,7 @@ LL | macro_two!(); ::: $DIR/auxiliary/two_macros.rs:2:1 | LL | macro_rules! macro_one { () => ("one") } - | ---------------------------------------- similarly named macro `macro_one` defined here + | ---------------------- similarly named macro `macro_one` defined here error: aborting due to previous error diff --git a/src/test/ui/proc-macro/resolve-error.stderr b/src/test/ui/proc-macro/resolve-error.stderr index 4663a8df9daf..61868f4203bb 100644 --- a/src/test/ui/proc-macro/resolve-error.stderr +++ b/src/test/ui/proc-macro/resolve-error.stderr @@ -1,15 +1,13 @@ error: cannot find macro `bang_proc_macrp` in this scope --> $DIR/resolve-error.rs:60:5 | -LL | bang_proc_macrp!(); - | ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `bang_proc_macro` +LL | bang_proc_macrp!(); + | ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `bang_proc_macro` | ::: $DIR/auxiliary/test-macros.rs:15:1 | -LL | / pub fn empty(_: TokenStream) -> TokenStream { -LL | | TokenStream::new() -LL | | } - | |_- similarly named macro `bang_proc_macro` defined here +LL | pub fn empty(_: TokenStream) -> TokenStream { + | ------------------------------------------- similarly named macro `bang_proc_macro` defined here error: cannot find macro `Dlona` in this scope --> $DIR/resolve-error.rs:57:5 @@ -60,15 +58,13 @@ LL | #[derive(Dlona)] error: cannot find derive macro `Dlona` in this scope --> $DIR/resolve-error.rs:40:10 | -LL | #[derive(Dlona)] - | ^^^^^ help: a derive macro with a similar name exists: `Clona` +LL | #[derive(Dlona)] + | ^^^^^ help: a derive macro with a similar name exists: `Clona` | ::: $DIR/auxiliary/derive-clona.rs:11:1 | -LL | / pub fn derive_clonea(input: TokenStream) -> TokenStream { -LL | | "".parse().unwrap() -LL | | } - | |_- similarly named derive macro `Clona` defined here +LL | pub fn derive_clonea(input: TokenStream) -> TokenStream { + | ------------------------------------------------------- similarly named derive macro `Clona` defined here error: cannot find derive macro `Dlone` in this scope --> $DIR/resolve-error.rs:35:10 @@ -85,7 +81,7 @@ LL | #[derive(Dlone)] ::: $SRC_DIR/libcore/clone.rs:LL:COL | LL | pub macro Clone($item:item) { /* compiler built-in */ } - | ------------------------------------------------------- similarly named derive macro `Clone` defined here + | --------------------------- similarly named derive macro `Clone` defined here error: cannot find attribute `FooWithLongNan` in this scope --> $DIR/resolve-error.rs:32:3 @@ -96,28 +92,24 @@ LL | #[FooWithLongNan] error: cannot find attribute `attr_proc_macra` in this scope --> $DIR/resolve-error.rs:28:3 | -LL | #[attr_proc_macra] - | ^^^^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `attr_proc_macro` +LL | #[attr_proc_macra] + | ^^^^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `attr_proc_macro` | ::: $DIR/auxiliary/test-macros.rs:20:1 | -LL | / pub fn empty_attr(_: TokenStream, _: TokenStream) -> TokenStream { -LL | | TokenStream::new() -LL | | } - | |_- similarly named attribute macro `attr_proc_macro` defined here +LL | pub fn empty_attr(_: TokenStream, _: TokenStream) -> TokenStream { + | ---------------------------------------------------------------- similarly named attribute macro `attr_proc_macro` defined here error: cannot find derive macro `FooWithLongNan` in this scope --> $DIR/resolve-error.rs:22:10 | -LL | #[derive(FooWithLongNan)] - | ^^^^^^^^^^^^^^ help: a derive macro with a similar name exists: `FooWithLongName` +LL | #[derive(FooWithLongNan)] + | ^^^^^^^^^^^^^^ help: a derive macro with a similar name exists: `FooWithLongName` | ::: $DIR/auxiliary/derive-foo.rs:11:1 | -LL | / pub fn derive_foo(input: TokenStream) -> TokenStream { -LL | | "".parse().unwrap() -LL | | } - | |_- similarly named derive macro `FooWithLongName` defined here +LL | pub fn derive_foo(input: TokenStream) -> TokenStream { + | ---------------------------------------------------- similarly named derive macro `FooWithLongName` defined here error: cannot find derive macro `FooWithLongNan` in this scope --> $DIR/resolve-error.rs:22:10 diff --git a/src/test/ui/resolve/levenshtein.stderr b/src/test/ui/resolve/levenshtein.stderr index c7497afd0257..a176a19da08a 100644 --- a/src/test/ui/resolve/levenshtein.stderr +++ b/src/test/ui/resolve/levenshtein.stderr @@ -16,19 +16,13 @@ LL | type A = Baz; // Misspelled type name. error[E0412]: cannot find type `Opiton` in this scope --> $DIR/levenshtein.rs:12:10 | -LL | type B = Opiton; // Misspelled type name from the prelude. - | ^^^^^^ help: an enum with a similar name exists: `Option` +LL | type B = Opiton; // Misspelled type name from the prelude. + | ^^^^^^ help: an enum with a similar name exists: `Option` | ::: $SRC_DIR/libcore/option.rs:LL:COL | -LL | / pub enum Option { -LL | | /// No value -LL | | #[stable(feature = "rust1", since = "1.0.0")] -LL | | None, -... | -LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T), -LL | | } - | |_- similarly named enum `Option` defined here +LL | pub enum Option { + | ------------------ similarly named enum `Option` defined here error[E0412]: cannot find type `Baz` in this scope --> $DIR/levenshtein.rs:16:14 diff --git a/src/test/ui/suggestions/attribute-typos.stderr b/src/test/ui/suggestions/attribute-typos.stderr index d91b1cc707cb..952ed26ccc07 100644 --- a/src/test/ui/suggestions/attribute-typos.stderr +++ b/src/test/ui/suggestions/attribute-typos.stderr @@ -22,7 +22,7 @@ LL | #[tests] ::: $SRC_DIR/libcore/macros.rs:LL:COL | LL | pub macro test($item:item) { /* compiler built-in */ } - | ------------------------------------------------------ similarly named attribute macro `test` defined here + | -------------------------- similarly named attribute macro `test` defined here error: cannot find attribute `deprcated` in this scope --> $DIR/attribute-typos.rs:1:3