err
}
ResolutionError::BindingShadowsSomethingUnacceptable(what_binding, name, binding) => {
- let (shadows_what, article) = (binding.descr(), binding.article());
+ let shadows_what = binding.descr();
let mut err = struct_span_err!(resolver.session, span, E0530, "{}s cannot shadow {}s",
what_binding, shadows_what);
err.span_label(span, format!("cannot be named the same as {} {}",
- article, shadows_what));
+ binding.article(), shadows_what));
let participle = if binding.is_import() { "imported" } else { "defined" };
- let msg = format!("{} {} `{}` is {} here", article, shadows_what, name, participle);
+ let msg = format!("the {} `{}` is {} here", shadows_what, name, participle);
err.span_label(binding.span, msg);
err
}
`{ident}` to disambiguate", ident = ident))
}
if b.is_extern_crate() && self.session.rust_2018() {
- help_msgs.push(format!("use `::{ident}` to refer to the {thing} unambiguously",
+ 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 the {thing} unambiguously",
+ help_msgs.push(format!("use `self::{ident}` to refer to this {thing} unambiguously",
ident = ident, thing = b.descr()))
}
|
LL | use plugin::helper;
| ^^^^^^^^^^^^^^
- = help: use `self::helper` to refer to the attribute macro unambiguously
+ = help: use `self::helper` to refer to this attribute macro unambiguously
error: aborting due to previous error
|
LL | use builtin_attrs::*;
| ^^^^^^^^^^^^^^^^
- = help: use `self::repr` to refer to the attribute macro unambiguously
+ = help: use `self::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
|
LL | use builtin_attrs::*;
| ^^^^^^^^^^^^^^^^
- = help: use `self::repr` to refer to the attribute macro unambiguously
+ = help: use `self::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
|
LL | use builtin_attrs::*;
| ^^^^^^^^^^^^^^^^
- = help: use `self::repr` to refer to the attribute macro unambiguously
+ = help: use `self::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
|
LL | use builtin_attrs::*;
| ^^^^^^^^^^^^^^^^
- = help: use `self::repr` to refer to the attribute macro unambiguously
+ = help: use `self::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
|
LL | use builtin_attrs::*;
| ^^^^^^^^^^^^^^^^
- = help: use `self::feature` to refer to the attribute macro unambiguously
+ = help: use `self::feature` to refer to this attribute macro unambiguously
error: aborting due to 6 previous errors
|
LL | use derive_helper_shadowing::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
- = help: use `self::my_attr` to refer to the attribute macro unambiguously
+ = help: use `self::my_attr` to refer to this attribute macro unambiguously
error: aborting due to previous error
--> $DIR/empty-struct-tuple-pat.rs:32:9
|
LL | struct Empty2();
- | ---------------- a tuple struct `Empty2` is defined here
+ | ---------------- the tuple struct `Empty2` is defined here
...
LL | Empty2 => () //~ ERROR match bindings cannot shadow tuple structs
| ^^^^^^ cannot be named the same as a tuple struct
--> $DIR/empty-struct-tuple-pat.rs:35:9
|
LL | use empty_struct::*;
- | --------------- a tuple struct `XEmpty6` is imported here
+ | --------------- the tuple struct `XEmpty6` is imported here
...
LL | XEmpty6 => () //~ ERROR match bindings cannot shadow tuple structs
| ^^^^^^^ cannot be named the same as a tuple struct
--> $DIR/enum-in-scope.rs:14:9
|
LL | struct hello(isize);
- | -------------------- a tuple struct `hello` is defined here
+ | -------------------- the tuple struct `hello` is defined here
...
LL | let hello = 0; //~ERROR let bindings cannot shadow tuple structs
| ^^^^^ cannot be named the same as a tuple struct
--> $DIR/E0530.rs:16:9
|
LL | static TEST: i32 = 0;
- | --------------------- a static `TEST` is defined here
+ | --------------------- the static `TEST` is defined here
...
LL | TEST => {} //~ ERROR E0530
| ^^^^ cannot be named the same as a static
LL | use m::*;
| ^^^^
= help: consider adding an explicit import of `env` to disambiguate
- = help: or use `self::env` to refer to the macro unambiguously
+ = help: or use `self::env` to refer to this macro unambiguously
error[E0659]: `env` is ambiguous (glob import vs any other name from outer scope during import/macro resolution)
--> $DIR/glob-shadowing.rs:29:21
|
LL | pub macro fenv($e: expr) { $e }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = help: use `self::fenv` to refer to the macro unambiguously
+ = help: use `self::fenv` to refer to this macro unambiguously
error: aborting due to 3 previous errors
|
LL | use nonexistent_module::mac; //~ ERROR unresolved import `nonexistent_module`
| ^^^^^^^^^^^^^^^^^^^^^^^
- = help: use `self::mac` to refer to the unresolved item unambiguously
+ = help: use `self::mac` to refer to this unresolved item unambiguously
error: aborting due to 2 previous errors
...
LL | define_include!();
| ------------------ in this macro invocation
- = help: use `self::include` to refer to the macro unambiguously
+ = help: use `self::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
...
LL | define_panic!();
| ---------------- in this macro invocation
- = help: use `self::panic` to refer to the macro unambiguously
+ = help: use `self::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
...
LL | define_panic!();
| ---------------- in this macro invocation
- = help: use `self::panic` to refer to the macro unambiguously
+ = help: use `self::panic` to refer to this macro unambiguously
error: aborting due to 4 previous errors
LL | | pub use two_macros::m;
LL | | }
| |_^
- = help: use `self::baz` to refer to the module unambiguously
+ = help: use `self::baz` to refer to this module unambiguously
error: aborting due to 2 previous errors
|
LL | use two_macros::m;
| ^^^^^^^^^^^^^
- = help: use `self::m` to refer to the macro unambiguously
+ = help: use `self::m` to refer to this macro unambiguously
error: aborting due to 2 previous errors
LL | use foo::*;
| ^^^^^^
= help: consider adding an explicit import of `panic` to disambiguate
- = help: or use `self::panic` to refer to the macro unambiguously
+ = help: or use `self::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)
--> $DIR/shadow_builtin_macros.rs:30:14
|
LL | ::two_macros::m!(use foo::panic;);
| ^^^^^^^^^^
- = help: use `self::panic` to refer to the macro unambiguously
+ = help: use `self::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)
--> $DIR/shadow_builtin_macros.rs:43:5
LL | use bar::*;
| ^^^^^^
= help: consider adding an explicit import of `n` to disambiguate
- = help: or use `self::n` to refer to the macro unambiguously
+ = help: or use `self::n` to refer to this macro unambiguously
note: `n` could also refer to the macro imported here
--> $DIR/shadow_builtin_macros.rs:46:13
|
--> $DIR/issue-16149.rs:17:9
|
LL | static externalValue: isize;
- | ---------------------------- a static `externalValue` is defined here
+ | ---------------------------- the static `externalValue` is defined here
...
LL | externalValue => true,
| ^^^^^^^^^^^^^ cannot be named the same as a static
--> $DIR/issue-17718-patterns.rs:17:9
|
LL | static A1: usize = 1;
- | --------------------- a static `A1` is defined here
+ | --------------------- the static `A1` is defined here
...
LL | A1 => {} //~ ERROR: match bindings cannot shadow statics
| ^^ cannot be named the same as a static
--> $DIR/issue-17718-patterns.rs:18:9
|
LL | static mut A2: usize = 1;
- | ------------------------- a static `A2` is defined here
+ | ------------------------- the static `A2` is defined here
...
LL | A2 => {} //~ ERROR: match bindings cannot shadow statics
| ^^ cannot be named the same as a static
--> $DIR/issue-23716.rs:13:8
|
LL | static foo: i32 = 0;
- | -------------------- a static `foo` is defined here
+ | -------------------- the static `foo` is defined here
LL |
LL | fn bar(foo: i32) {}
| ^^^ cannot be named the same as a static
--> $DIR/issue-23716.rs:23:13
|
LL | use self::submod::answer;
- | -------------------- a static `answer` is imported here
+ | -------------------- the static `answer` is imported here
LL |
LL | fn question(answer: i32) {}
| ^^^^^^ cannot be named the same as a static
--> $DIR/issue-27033.rs:17:9
|
LL | const C: u8 = 1;
- | ---------------- a constant `C` is defined here
+ | ---------------- the constant `C` is defined here
LL | match 1 {
LL | C @ 2 => { //~ ERROR match bindings cannot shadow constant
| ^ cannot be named the same as a constant
--> $DIR/issue-34047.rs:15:13
|
LL | const C: u8 = 0;
- | ---------------- a constant `C` is defined here
+ | ---------------- the constant `C` is defined here
...
LL | mut C => {} //~ ERROR match bindings cannot shadow constants
| ^ cannot be named the same as a constant
LL | use m2::*; // glob-import user-defined `std`
| ^^^^^
= help: consider adding an explicit import of `std` to disambiguate
- = help: or use `self::std` to refer to the module unambiguously
+ = help: or use `self::std` to refer to this module unambiguously
error: aborting due to previous error
--> $DIR/pat-shadow-in-nested-binding.rs:14:10
|
LL | struct foo(usize);
- | ------------------ a tuple struct `foo` is defined here
+ | ------------------ the tuple struct `foo` is defined here
...
LL | let (foo, _) = (2, 3); //~ ERROR let bindings cannot shadow tuple structs
| ^^^ cannot be named the same as a tuple struct
--> $DIR/pattern-binding-disambiguation.rs:34:9
|
LL | struct TupleStruct();
- | --------------------- a tuple struct `TupleStruct` is defined here
+ | --------------------- the tuple struct `TupleStruct` is defined here
...
LL | TupleStruct => {} //~ ERROR match bindings cannot shadow tuple structs
| ^^^^^^^^^^^ cannot be named the same as a tuple struct
--> $DIR/pattern-binding-disambiguation.rs:43:9
|
LL | use E::*;
- | ---- a tuple variant `TupleVariant` is imported here
+ | ---- the tuple variant `TupleVariant` is imported here
...
LL | TupleVariant => {} //~ ERROR match bindings cannot shadow tuple variants
| ^^^^^^^^^^^^ cannot be named the same as a tuple variant
--> $DIR/pattern-binding-disambiguation.rs:46:9
|
LL | use E::*;
- | ---- a struct variant `BracedVariant` is imported here
+ | ---- the struct variant `BracedVariant` is imported here
...
LL | BracedVariant => {} //~ ERROR match bindings cannot shadow struct variants
| ^^^^^^^^^^^^^ cannot be named the same as a struct variant
--> $DIR/pattern-binding-disambiguation.rs:52:9
|
LL | static STATIC: () = ();
- | ----------------------- a static `STATIC` is defined here
+ | ----------------------- the static `STATIC` is defined here
...
LL | STATIC => {} //~ ERROR match bindings cannot shadow statics
| ^^^^^^ cannot be named the same as a static
--> $DIR/pattern-binding-disambiguation.rs:59:9
|
LL | struct TupleStruct();
- | --------------------- a tuple struct `TupleStruct` is defined here
+ | --------------------- the tuple struct `TupleStruct` is defined here
...
LL | let TupleStruct = doesnt_matter; //~ ERROR let bindings cannot shadow tuple structs
| ^^^^^^^^^^^ cannot be named the same as a tuple struct
--> $DIR/pattern-binding-disambiguation.rs:62:9
|
LL | use E::*;
- | ---- a tuple variant `TupleVariant` is imported here
+ | ---- the tuple variant `TupleVariant` is imported here
...
LL | let TupleVariant = doesnt_matter; //~ ERROR let bindings cannot shadow tuple variants
| ^^^^^^^^^^^^ cannot be named the same as a tuple variant
--> $DIR/pattern-binding-disambiguation.rs:63:9
|
LL | use E::*;
- | ---- a struct variant `BracedVariant` is imported here
+ | ---- the struct variant `BracedVariant` is imported here
...
LL | let BracedVariant = doesnt_matter; //~ ERROR let bindings cannot shadow struct variants
| ^^^^^^^^^^^^^ cannot be named the same as a struct variant
--> $DIR/pattern-binding-disambiguation.rs:65:9
|
LL | static STATIC: () = ();
- | ----------------------- a static `STATIC` is defined here
+ | ----------------------- the static `STATIC` is defined here
...
LL | let STATIC = doesnt_matter; //~ ERROR let bindings cannot shadow statics
| ^^^^^^ cannot be named the same as a static
| ^^^ ambiguous name
|
= note: `std` could refer to a built-in extern crate
- = help: use `::std` to refer to the extern crate unambiguously
+ = help: use `::std` to refer to this extern crate unambiguously
note: `std` could also refer to the module defined here
--> $DIR/ambiguity-macros-nested.rs:21:13
|
...
LL | m!();
| ----- in this macro invocation
- = help: use `self::std` to refer to the module unambiguously
+ = help: use `self::std` to refer to this module unambiguously
error: aborting due to previous error
| ^^^ ambiguous name
|
= note: `std` could refer to a built-in extern crate
- = help: use `::std` to refer to the extern crate unambiguously
+ = help: use `::std` to refer to this extern crate unambiguously
note: `std` could also refer to the module defined here
--> $DIR/ambiguity-macros.rs:20:9
|
...
LL | m!();
| ----- in this macro invocation
- = help: use `self::std` to refer to the module unambiguously
+ = help: use `self::std` to refer to this module unambiguously
error: aborting due to previous error
| ^^^ ambiguous name
|
= note: `std` could refer to a built-in extern crate
- = help: use `::std` to refer to the extern crate unambiguously
+ = help: use `::std` to refer to this extern crate unambiguously
note: `std` could also refer to the module defined here
--> $DIR/ambiguity-nested.rs:19:5
|
LL | | pub struct io;
LL | | }
| |_____^
- = help: use `self::std` to refer to the module unambiguously
+ = help: use `self::std` to refer to this module unambiguously
error: aborting due to previous error
| ^^^ ambiguous name
|
= note: `std` could refer to a built-in extern crate
- = help: use `::std` to refer to the extern crate unambiguously
+ = help: use `::std` to refer to this extern crate unambiguously
note: `std` could also refer to the module defined here
--> $DIR/ambiguity.rs:16:1
|
LL | | pub struct io;
LL | | }
| |_^
- = help: use `self::std` to refer to the module unambiguously
+ = help: use `self::std` to refer to this module unambiguously
error: aborting due to previous error
|
LL | struct std;
| ^^^^^^^^^^^
- = help: use `self::std` to refer to the struct unambiguously
+ = help: use `self::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:18:9
|
LL | struct std;
| ^^^^^^^^^^^
- = help: use `self::std` to refer to the unit struct unambiguously
+ = help: use `self::std` to refer to this unit struct unambiguously
error: aborting due to 2 previous errors
| ^^^ ambiguous name
|
= note: `std` could refer to a built-in extern crate
- = help: use `::std` to refer to the extern crate unambiguously
+ = help: use `::std` to refer to this extern crate unambiguously
note: `std` could also refer to the module defined here
--> $DIR/ambiguity-macros-nested.rs:23:13
|
...
LL | m!();
| ----- in this macro invocation
- = help: use `self::std` to refer to the module unambiguously
+ = help: use `self::std` to refer to this module unambiguously
error: aborting due to previous error
| ^^^ ambiguous name
|
= note: `std` could refer to a built-in extern crate
- = help: use `::std` to refer to the extern crate unambiguously
+ = help: use `::std` to refer to this extern crate unambiguously
note: `std` could also refer to the module defined here
--> $DIR/ambiguity-macros.rs:22:9
|
...
LL | m!();
| ----- in this macro invocation
- = help: use `self::std` to refer to the module unambiguously
+ = help: use `self::std` to refer to this module unambiguously
error: aborting due to previous error
| ^^^ ambiguous name
|
= note: `std` could refer to a built-in extern crate
- = help: use `::std` to refer to the extern crate unambiguously
+ = help: use `::std` to refer to this extern crate unambiguously
note: `std` could also refer to the module defined here
--> $DIR/ambiguity-nested.rs:21:5
|
LL | | pub struct io;
LL | | }
| |_____^
- = help: use `self::std` to refer to the module unambiguously
+ = help: use `self::std` to refer to this module unambiguously
error: aborting due to previous error
| ^^^ ambiguous name
|
= note: `std` could refer to a built-in extern crate
- = help: use `::std` to refer to the extern crate unambiguously
+ = help: use `::std` to refer to this extern crate unambiguously
note: `std` could also refer to the module defined here
--> $DIR/ambiguity.rs:18:1
|
LL | | pub struct io;
LL | | }
| |_^
- = help: use `self::std` to refer to the module unambiguously
+ = help: use `self::std` to refer to this module unambiguously
error: aborting due to previous error
LL | | pub fn bar() {}
LL | | }
| |_^
- = help: use `self::sub` to refer to the module unambiguously
+ = help: use `self::sub` to refer to this module unambiguously
error: aborting due to previous error
|
LL | enum Foo {}
| ^^^^^^^^^^^
- = help: use `self::Foo` to refer to the enum unambiguously
+ = help: use `self::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:28:9
|
LL | struct std;
| ^^^^^^^^^^^
- = help: use `self::std` to refer to the struct unambiguously
+ = help: use `self::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:28:9
|
LL | struct std;
| ^^^^^^^^^^^
- = help: use `self::std` to refer to the unit struct unambiguously
+ = help: use `self::std` to refer to this unit struct unambiguously
error: aborting due to 3 previous errors
--> $DIR/static-mut-not-pat.rs:23:9
|
LL | static mut a: isize = 3;
- | ------------------------ a static `a` is defined here
+ | ------------------------ the static `a` is defined here
...
LL | a => {} //~ ERROR match bindings cannot shadow statics
| ^ cannot be named the same as a static
--> $DIR/static-mut-not-pat.rs:46:9
|
LL | static mut STATIC_MUT_FOO: Foo = Foo { bar: Some(Direction::West), baz: NEW_FALSE };
- | ------------------------------------------------------------------------------------ a static `STATIC_MUT_FOO` is defined here
+ | ------------------------------------------------------------------------------------ the static `STATIC_MUT_FOO` is defined here
...
LL | STATIC_MUT_FOO => (),
| ^^^^^^^^^^^^^^ cannot be named the same as a static