From 6f13708299c22cf8450e239c4ab06aada2d1cf07 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 25 Nov 2018 16:08:43 +0300 Subject: [PATCH] resolve: Suggest `crate::` for resolving ambiguities when appropriate More precise spans for ambiguities from macros --- src/librustc_resolve/lib.rs | 20 +++++++++++---- src/librustc_resolve/macros.rs | 25 +++++++++++-------- ...helper-attr-blocked-by-import-ambig.stderr | 2 +- .../proc-macro/ambiguous-builtin-attrs.stderr | 10 ++++---- .../proc-macro/derive-helper-shadowing.stderr | 2 +- .../edition-imports-virtual-2015-ambiguity.rs | 5 ++-- ...tion-imports-virtual-2015-ambiguity.stderr | 23 +++++++++-------- .../local-modularized-tricky-fail-1.rs | 1 + .../local-modularized-tricky-fail-1.stderr | 15 +++++------ src/test/ui/imports/macro-paths.stderr | 2 +- .../macros/restricted-shadowing-legacy.stderr | 24 ++++++++++++++++++ .../macros/restricted-shadowing-modern.stderr | 18 +++++++++++++ .../uniform-paths/ambiguity-macros.stderr | 2 +- .../rust-2018/uniform-paths/ambiguity.stderr | 2 +- .../block-scoped-shadow-nested.stderr | 2 +- .../uniform-paths/block-scoped-shadow.stderr | 6 ++--- 16 files changed, 110 insertions(+), 49 deletions(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 0be9881f910..cbf82a80266 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1292,6 +1292,7 @@ impl AmbiguityKind { /// Miscellaneous bits of metadata for better ambiguity error reporting. #[derive(Clone, Copy, PartialEq)] enum AmbiguityErrorMisc { + SuggestCrate, SuggestSelf, FromPrelude, None, @@ -4870,12 +4871,21 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { `{ident}` to disambiguate", ident = ident)) } if b.is_extern_crate() && ident.span.rust_2018() { - help_msgs.push(format!("use `::{ident}` to refer to this {thing} unambiguously", - ident = ident, thing = b.descr())) + help_msgs.push(format!( + "use `::{ident}` to refer to this {thing} unambiguously", + ident = ident, thing = b.descr(), + )) } - if misc == AmbiguityErrorMisc::SuggestSelf { - help_msgs.push(format!("use `self::{ident}` to refer to this {thing} unambiguously", - ident = ident, thing = b.descr())) + if misc == AmbiguityErrorMisc::SuggestCrate { + help_msgs.push(format!( + "use `crate::{ident}` to refer to this {thing} unambiguously", + ident = ident, thing = b.descr(), + )) + } else if misc == AmbiguityErrorMisc::SuggestSelf { + help_msgs.push(format!( + "use `self::{ident}` to refer to this {thing} unambiguously", + ident = ident, thing = b.descr(), + )) } if b.span.is_dummy() { diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index d306e9ebe32..5db3efee9f6 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -42,7 +42,7 @@ use syntax_pos::{Span, DUMMY_SP}; use errors::Applicability; use std::cell::Cell; -use std::mem; +use std::{mem, ptr}; use rustc_data_structures::sync::Lrc; #[derive(Clone, Debug)] @@ -594,11 +594,12 @@ impl<'a, 'cl> Resolver<'a, 'cl> { bitflags! { struct Flags: u8 { - const MACRO_RULES = 1 << 0; - const MODULE = 1 << 1; - const PRELUDE = 1 << 2; - const MISC_SUGGEST_SELF = 1 << 3; - const MISC_FROM_PRELUDE = 1 << 4; + const MACRO_RULES = 1 << 0; + const MODULE = 1 << 1; + const PRELUDE = 1 << 2; + const MISC_SUGGEST_CRATE = 1 << 3; + const MISC_SUGGEST_SELF = 1 << 4; + const MISC_FROM_PRELUDE = 1 << 5; } } @@ -684,7 +685,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { path_span, ); match binding { - Ok(binding) => Ok((binding, Flags::MODULE)), + Ok(binding) => Ok((binding, Flags::MODULE | Flags::MISC_SUGGEST_CRATE)), Err((Determinacy::Undetermined, Weak::No)) => return Err(Determinacy::determined(force)), Err((Determinacy::Undetermined, Weak::Yes)) => @@ -706,7 +707,9 @@ impl<'a, 'cl> Resolver<'a, 'cl> { self.current_module = orig_current_module; match binding { Ok(binding) => { - let misc_flags = if module.is_normal() { + let misc_flags = if ptr::eq(module, self.graph_root) { + Flags::MISC_SUGGEST_CRATE + } else if module.is_normal() { Flags::MISC_SUGGEST_SELF } else { Flags::empty() @@ -857,7 +860,9 @@ impl<'a, 'cl> Resolver<'a, 'cl> { None }; if let Some(kind) = ambiguity_error_kind { - let misc = |f: Flags| if f.contains(Flags::MISC_SUGGEST_SELF) { + let misc = |f: Flags| if f.contains(Flags::MISC_SUGGEST_CRATE) { + AmbiguityErrorMisc::SuggestCrate + } else if f.contains(Flags::MISC_SUGGEST_SELF) { AmbiguityErrorMisc::SuggestSelf } else if f.contains(Flags::MISC_FROM_PRELUDE) { AmbiguityErrorMisc::FromPrelude @@ -866,7 +871,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { }; self.ambiguity_errors.push(AmbiguityError { kind, - ident, + ident: orig_ident, b1: innermost_binding, b2: binding, misc1: misc(innermost_flags), diff --git a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.stderr b/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.stderr index ee98873064f..d288d729512 100644 --- a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.stderr +++ b/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.stderr @@ -14,7 +14,7 @@ note: `helper` could also refer to the attribute macro imported here | LL | use plugin::helper; | ^^^^^^^^^^^^^^ - = help: use `self::helper` to refer to this attribute macro unambiguously + = help: use `crate::helper` to refer to this attribute macro unambiguously error: aborting due to previous error diff --git a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.stderr b/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.stderr index 34b21ea2683..79dc922b9db 100644 --- a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.stderr +++ b/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.stderr @@ -16,7 +16,7 @@ note: `repr` could also refer to the attribute macro imported here | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ - = help: use `self::repr` to refer to this attribute macro unambiguously + = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:11:19 @@ -30,7 +30,7 @@ note: `repr` could also refer to the attribute macro imported here | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ - = help: use `self::repr` to refer to this attribute macro unambiguously + = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:20:34 @@ -44,7 +44,7 @@ note: `repr` could also refer to the attribute macro imported here | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ - = help: use `self::repr` to refer to this attribute macro unambiguously + = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:22:11 @@ -58,7 +58,7 @@ note: `repr` could also refer to the attribute macro imported here | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ - = help: use `self::repr` to refer to this attribute macro unambiguously + = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `feature` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:3:4 @@ -72,7 +72,7 @@ note: `feature` could also refer to the attribute macro imported here | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ - = help: use `self::feature` to refer to this attribute macro unambiguously + = help: use `crate::feature` to refer to this attribute macro unambiguously error: aborting due to 6 previous errors diff --git a/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.stderr b/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.stderr index f04782fac4d..cc50fefc464 100644 --- a/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.stderr +++ b/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.stderr @@ -14,7 +14,7 @@ note: `my_attr` could also refer to the attribute macro imported here | LL | use derive_helper_shadowing::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - = help: use `self::my_attr` to refer to this attribute macro unambiguously + = help: use `crate::my_attr` to refer to this attribute macro unambiguously error: aborting due to previous error 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 562d3c9e70f..53ec3867f01 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs +++ b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs @@ -1,8 +1,6 @@ // edition:2018 // compile-flags:--extern edition_imports_2015 // aux-build:edition-imports-2015.rs -// error-pattern: `Ambiguous` is ambiguous -// error-pattern: `edition_imports_2015` is ambiguous mod edition_imports_2015 { pub struct Path; @@ -14,7 +12,8 @@ mod check { pub struct Ambiguous {} fn check() { - edition_imports_2015::gen_ambiguous!(); + edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous + //~| ERROR `edition_imports_2015` is ambiguous } } 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 d0897d081c3..ac2bf21c5c0 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr +++ b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr @@ -1,36 +1,39 @@ error[E0659]: `Ambiguous` is ambiguous (name vs any other name during import resolution) - --> <::edition_imports_2015::gen_ambiguous macros>:1:15 + --> $DIR/edition-imports-virtual-2015-ambiguity.rs:15:9 | -LL | ( ) => { use Ambiguous ; type A = :: edition_imports_2015 :: Path ; } - | ^^^^^^^^^ ambiguous name +LL | edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name | note: `Ambiguous` could refer to the struct defined here - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:11:1 + --> $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:14:5 + --> $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) - --> <::edition_imports_2015::gen_ambiguous macros>:1:39 + --> $DIR/edition-imports-virtual-2015-ambiguity.rs:15:9 | -LL | ( ) => { use Ambiguous ; type A = :: edition_imports_2015 :: Path ; } - | ^^^^^^^^^^^^^^^^^^^^ ambiguous name +LL | edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name | = note: `edition_imports_2015` could refer to an extern crate passed with `--extern` - = help: use `::edition_imports_2015` to refer to this extern crate unambiguously note: `edition_imports_2015` could also refer to the module defined here - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:7:1 + --> $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 diff --git a/src/test/ui/imports/local-modularized-tricky-fail-1.rs b/src/test/ui/imports/local-modularized-tricky-fail-1.rs index fb05b95a96d..37633c7a441 100644 --- a/src/test/ui/imports/local-modularized-tricky-fail-1.rs +++ b/src/test/ui/imports/local-modularized-tricky-fail-1.rs @@ -43,6 +43,7 @@ mod inner2 { fn main() { panic!(); //~ ERROR `panic` is ambiguous + //~| ERROR `panic` is ambiguous } mod inner3 { 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 962294e48ca..1978648e206 100644 --- a/src/test/ui/imports/local-modularized-tricky-fail-1.stderr +++ b/src/test/ui/imports/local-modularized-tricky-fail-1.stderr @@ -22,7 +22,7 @@ LL | use inner1::*; = help: consider adding an explicit import of `exported` to disambiguate 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:56:1 + --> $DIR/local-modularized-tricky-fail-1.rs:57:1 | LL | include!(); //~ ERROR `include` is ambiguous | ^^^^^^^ ambiguous name @@ -38,7 +38,7 @@ LL | | } ... LL | define_include!(); | ------------------ in this macro invocation - = help: use `self::include` to refer to this macro unambiguously + = help: use `crate::include` to refer to this macro unambiguously 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:45:5 @@ -57,13 +57,13 @@ LL | | } ... LL | define_panic!(); | ---------------- in this macro invocation - = help: use `self::panic` to refer to this macro unambiguously + = help: use `crate::panic` to refer to this macro unambiguously error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> <::std::macros::panic macros>:1:13 + --> $DIR/local-modularized-tricky-fail-1.rs:45:5 | -LL | ( ) => ( { panic ! ( "explicit panic" ) } ) ; ( $ msg : expr ) => ( - | ^^^^^ ambiguous name +LL | panic!(); //~ ERROR `panic` is ambiguous + | ^^^^^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude note: `panic` could also refer to the macro defined here @@ -76,7 +76,8 @@ LL | | } ... LL | define_panic!(); | ---------------- in this macro invocation - = help: use `self::panic` to refer to this macro unambiguously + = help: use `crate::panic` to refer to this macro 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 4 previous errors diff --git a/src/test/ui/imports/macro-paths.stderr b/src/test/ui/imports/macro-paths.stderr index 8e8742f849b..3f481b0cfb0 100644 --- a/src/test/ui/imports/macro-paths.stderr +++ b/src/test/ui/imports/macro-paths.stderr @@ -34,7 +34,7 @@ LL | / pub mod baz { LL | | pub use two_macros::m; LL | | } | |_^ - = help: use `self::baz` to refer to this module unambiguously + = help: use `crate::baz` to refer to this module unambiguously error: aborting due to 2 previous errors diff --git a/src/test/ui/macros/restricted-shadowing-legacy.stderr b/src/test/ui/macros/restricted-shadowing-legacy.stderr index 2135d63c80e..9d61799713b 100644 --- a/src/test/ui/macros/restricted-shadowing-legacy.stderr +++ b/src/test/ui/macros/restricted-shadowing-legacy.stderr @@ -3,6 +3,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -26,6 +29,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -49,6 +55,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -72,6 +81,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -95,6 +107,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -118,6 +133,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -141,6 +159,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -164,6 +185,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 diff --git a/src/test/ui/macros/restricted-shadowing-modern.stderr b/src/test/ui/macros/restricted-shadowing-modern.stderr index 2449e8512d3..398a7660d30 100644 --- a/src/test/ui/macros/restricted-shadowing-modern.stderr +++ b/src/test/ui/macros/restricted-shadowing-modern.stderr @@ -3,6 +3,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-modern.rs:91:9 @@ -26,6 +29,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | macro gen_invoc() { m!() } //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-modern.rs:91:9 @@ -49,6 +55,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-modern.rs:91:9 @@ -72,6 +81,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-modern.rs:91:9 @@ -95,6 +107,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-modern.rs:91:9 @@ -118,6 +133,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | macro gen_invoc() { m!() } //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-modern.rs:91:9 diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr index ac8d3b9d0cb..a9e6da8f211 100644 --- a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr +++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr @@ -16,7 +16,7 @@ LL | | } ... LL | m!(); | ----- in this macro invocation - = help: use `self::std` to refer to this module unambiguously + = help: use `crate::std` to refer to this module unambiguously error: aborting due to previous error diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity.stderr b/src/test/ui/rust-2018/uniform-paths/ambiguity.stderr index beeb74654e5..b1feb82fba9 100644 --- a/src/test/ui/rust-2018/uniform-paths/ambiguity.stderr +++ b/src/test/ui/rust-2018/uniform-paths/ambiguity.stderr @@ -13,7 +13,7 @@ LL | / mod std { LL | | pub struct io; LL | | } | |_^ - = help: use `self::std` to refer to this module unambiguously + = help: use `crate::std` to refer to this module unambiguously error: aborting due to previous error 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 aa46947f93f..0088296b1a4 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 @@ -16,7 +16,7 @@ LL | / mod sub { LL | | pub fn bar() {} LL | | } | |_^ - = help: use `self::sub` to refer to this module unambiguously + = help: use `crate::sub` to refer to this module unambiguously error: aborting due to previous error diff --git a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr index 010b9efad39..213f723385b 100644 --- a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr +++ b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr @@ -14,7 +14,7 @@ note: `Foo` could also refer to the enum defined here | LL | enum Foo {} | ^^^^^^^^^^^ - = help: use `self::Foo` to refer to this enum unambiguously + = help: use `crate::Foo` to refer to this enum unambiguously error[E0659]: `std` is ambiguous (name vs any other name during import resolution) --> $DIR/block-scoped-shadow.rs:26:9 @@ -32,7 +32,7 @@ note: `std` could also refer to the struct defined here | LL | struct std; | ^^^^^^^^^^^ - = help: use `self::std` to refer to this struct unambiguously + = help: use `crate::std` to refer to this struct unambiguously error[E0659]: `std` is ambiguous (name vs any other name during import resolution) --> $DIR/block-scoped-shadow.rs:26:9 @@ -50,7 +50,7 @@ note: `std` could also refer to the unit struct defined here | LL | struct std; | ^^^^^^^^^^^ - = help: use `self::std` to refer to this unit struct unambiguously + = help: use `crate::std` to refer to this unit struct unambiguously error: aborting due to 3 previous errors