Skip to content

Commit cfd7629

Browse files
committed
resolve: Tweak some articles in ambiguity diagnostics
1 parent cfe8155 commit cfd7629

33 files changed

+68
-68
lines changed

src/librustc_resolve/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,13 +406,13 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
406406
err
407407
}
408408
ResolutionError::BindingShadowsSomethingUnacceptable(what_binding, name, binding) => {
409-
let (shadows_what, article) = (binding.descr(), binding.article());
409+
let shadows_what = binding.descr();
410410
let mut err = struct_span_err!(resolver.session, span, E0530, "{}s cannot shadow {}s",
411411
what_binding, shadows_what);
412412
err.span_label(span, format!("cannot be named the same as {} {}",
413-
article, shadows_what));
413+
binding.article(), shadows_what));
414414
let participle = if binding.is_import() { "imported" } else { "defined" };
415-
let msg = format!("{} {} `{}` is {} here", article, shadows_what, name, participle);
415+
let msg = format!("the {} `{}` is {} here", shadows_what, name, participle);
416416
err.span_label(binding.span, msg);
417417
err
418418
}
@@ -4788,11 +4788,11 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
47884788
`{ident}` to disambiguate", ident = ident))
47894789
}
47904790
if b.is_extern_crate() && self.session.rust_2018() {
4791-
help_msgs.push(format!("use `::{ident}` to refer to the {thing} unambiguously",
4791+
help_msgs.push(format!("use `::{ident}` to refer to this {thing} unambiguously",
47924792
ident = ident, thing = b.descr()))
47934793
}
47944794
if misc == AmbiguityErrorMisc::SuggestSelf {
4795-
help_msgs.push(format!("use `self::{ident}` to refer to the {thing} unambiguously",
4795+
help_msgs.push(format!("use `self::{ident}` to refer to this {thing} unambiguously",
47964796
ident = ident, thing = b.descr()))
47974797
}
47984798

src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ note: `helper` could also refer to the attribute macro imported here
1414
|
1515
LL | use plugin::helper;
1616
| ^^^^^^^^^^^^^^
17-
= help: use `self::helper` to refer to the attribute macro unambiguously
17+
= help: use `self::helper` to refer to this attribute macro unambiguously
1818

1919
error: aborting due to previous error
2020

src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ note: `repr` could also refer to the attribute macro imported here
1616
|
1717
LL | use builtin_attrs::*;
1818
| ^^^^^^^^^^^^^^^^
19-
= help: use `self::repr` to refer to the attribute macro unambiguously
19+
= help: use `self::repr` to refer to this attribute macro unambiguously
2020

2121
error[E0659]: `repr` is ambiguous (built-in attribute vs any other name)
2222
--> $DIR/ambiguous-builtin-attrs.rs:11:19
@@ -30,7 +30,7 @@ note: `repr` could also refer to the attribute macro imported here
3030
|
3131
LL | use builtin_attrs::*;
3232
| ^^^^^^^^^^^^^^^^
33-
= help: use `self::repr` to refer to the attribute macro unambiguously
33+
= help: use `self::repr` to refer to this attribute macro unambiguously
3434

3535
error[E0659]: `repr` is ambiguous (built-in attribute vs any other name)
3636
--> $DIR/ambiguous-builtin-attrs.rs:20:34
@@ -44,7 +44,7 @@ note: `repr` could also refer to the attribute macro imported here
4444
|
4545
LL | use builtin_attrs::*;
4646
| ^^^^^^^^^^^^^^^^
47-
= help: use `self::repr` to refer to the attribute macro unambiguously
47+
= help: use `self::repr` to refer to this attribute macro unambiguously
4848

4949
error[E0659]: `repr` is ambiguous (built-in attribute vs any other name)
5050
--> $DIR/ambiguous-builtin-attrs.rs:22:11
@@ -58,7 +58,7 @@ note: `repr` could also refer to the attribute macro imported here
5858
|
5959
LL | use builtin_attrs::*;
6060
| ^^^^^^^^^^^^^^^^
61-
= help: use `self::repr` to refer to the attribute macro unambiguously
61+
= help: use `self::repr` to refer to this attribute macro unambiguously
6262

6363
error[E0659]: `feature` is ambiguous (built-in attribute vs any other name)
6464
--> $DIR/ambiguous-builtin-attrs.rs:3:4
@@ -72,7 +72,7 @@ note: `feature` could also refer to the attribute macro imported here
7272
|
7373
LL | use builtin_attrs::*;
7474
| ^^^^^^^^^^^^^^^^
75-
= help: use `self::feature` to refer to the attribute macro unambiguously
75+
= help: use `self::feature` to refer to this attribute macro unambiguously
7676

7777
error: aborting due to 6 previous errors
7878

src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ note: `my_attr` could also refer to the attribute macro imported here
1414
|
1515
LL | use derive_helper_shadowing::*;
1616
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
17-
= help: use `self::my_attr` to refer to the attribute macro unambiguously
17+
= help: use `self::my_attr` to refer to this attribute macro unambiguously
1818

1919
error: aborting due to previous error
2020

src/test/ui/empty/empty-struct-tuple-pat.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0530]: match bindings cannot shadow tuple structs
22
--> $DIR/empty-struct-tuple-pat.rs:32:9
33
|
44
LL | struct Empty2();
5-
| ---------------- a tuple struct `Empty2` is defined here
5+
| ---------------- the tuple struct `Empty2` is defined here
66
...
77
LL | Empty2 => () //~ ERROR match bindings cannot shadow tuple structs
88
| ^^^^^^ cannot be named the same as a tuple struct
@@ -11,7 +11,7 @@ error[E0530]: match bindings cannot shadow tuple structs
1111
--> $DIR/empty-struct-tuple-pat.rs:35:9
1212
|
1313
LL | use empty_struct::*;
14-
| --------------- a tuple struct `XEmpty6` is imported here
14+
| --------------- the tuple struct `XEmpty6` is imported here
1515
...
1616
LL | XEmpty6 => () //~ ERROR match bindings cannot shadow tuple structs
1717
| ^^^^^^^ cannot be named the same as a tuple struct

src/test/ui/enum/enum-in-scope.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0530]: let bindings cannot shadow tuple structs
22
--> $DIR/enum-in-scope.rs:14:9
33
|
44
LL | struct hello(isize);
5-
| -------------------- a tuple struct `hello` is defined here
5+
| -------------------- the tuple struct `hello` is defined here
66
...
77
LL | let hello = 0; //~ERROR let bindings cannot shadow tuple structs
88
| ^^^^^ cannot be named the same as a tuple struct

src/test/ui/error-codes/E0530.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0530]: match bindings cannot shadow statics
22
--> $DIR/E0530.rs:16:9
33
|
44
LL | static TEST: i32 = 0;
5-
| --------------------- a static `TEST` is defined here
5+
| --------------------- the static `TEST` is defined here
66
...
77
LL | TEST => {} //~ ERROR E0530
88
| ^^^^ cannot be named the same as a static

src/test/ui/imports/glob-shadowing.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ note: `env` could also refer to the macro imported here
1111
LL | use m::*;
1212
| ^^^^
1313
= help: consider adding an explicit import of `env` to disambiguate
14-
= help: or use `self::env` to refer to the macro unambiguously
14+
= help: or use `self::env` to refer to this macro unambiguously
1515

1616
error[E0659]: `env` is ambiguous (glob import vs any other name from outer scope during import/macro resolution)
1717
--> $DIR/glob-shadowing.rs:29:21
@@ -44,7 +44,7 @@ note: `fenv` could also refer to the macro defined here
4444
|
4545
LL | pub macro fenv($e: expr) { $e }
4646
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47-
= help: use `self::fenv` to refer to the macro unambiguously
47+
= help: use `self::fenv` to refer to this macro unambiguously
4848

4949
error: aborting due to 3 previous errors
5050

src/test/ui/imports/issue-53269.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ note: `mac` could also refer to the unresolved item imported here
2020
|
2121
LL | use nonexistent_module::mac; //~ ERROR unresolved import `nonexistent_module`
2222
| ^^^^^^^^^^^^^^^^^^^^^^^
23-
= help: use `self::mac` to refer to the unresolved item unambiguously
23+
= help: use `self::mac` to refer to this unresolved item unambiguously
2424

2525
error: aborting due to 2 previous errors
2626

src/test/ui/imports/local-modularized-tricky-fail-1.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ LL | | }
3838
...
3939
LL | define_include!();
4040
| ------------------ in this macro invocation
41-
= help: use `self::include` to refer to the macro unambiguously
41+
= help: use `self::include` to refer to this macro unambiguously
4242

4343
error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
4444
--> $DIR/local-modularized-tricky-fail-1.rs:45:5
@@ -57,7 +57,7 @@ LL | | }
5757
...
5858
LL | define_panic!();
5959
| ---------------- in this macro invocation
60-
= help: use `self::panic` to refer to the macro unambiguously
60+
= help: use `self::panic` to refer to this macro unambiguously
6161

6262
error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
6363
--> <::std::macros::panic macros>:1:13
@@ -76,7 +76,7 @@ LL | | }
7676
...
7777
LL | define_panic!();
7878
| ---------------- in this macro invocation
79-
= help: use `self::panic` to refer to the macro unambiguously
79+
= help: use `self::panic` to refer to this macro unambiguously
8080

8181
error: aborting due to 4 previous errors
8282

src/test/ui/imports/macro-paths.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ LL | / pub mod baz {
3434
LL | | pub use two_macros::m;
3535
LL | | }
3636
| |_^
37-
= help: use `self::baz` to refer to the module unambiguously
37+
= help: use `self::baz` to refer to this module unambiguously
3838

3939
error: aborting due to 2 previous errors
4040

src/test/ui/imports/macros.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ note: `m` could also refer to the macro imported here
3232
|
3333
LL | use two_macros::m;
3434
| ^^^^^^^^^^^^^
35-
= help: use `self::m` to refer to the macro unambiguously
35+
= help: use `self::m` to refer to this macro unambiguously
3636

3737
error: aborting due to 2 previous errors
3838

src/test/ui/imports/shadow_builtin_macros.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ note: `panic` could also refer to the macro imported here
1111
LL | use foo::*;
1212
| ^^^^^^
1313
= help: consider adding an explicit import of `panic` to disambiguate
14-
= help: or use `self::panic` to refer to the macro unambiguously
14+
= help: or use `self::panic` to refer to this macro unambiguously
1515

1616
error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
1717
--> $DIR/shadow_builtin_macros.rs:30:14
@@ -25,7 +25,7 @@ note: `panic` could also refer to the macro imported here
2525
|
2626
LL | ::two_macros::m!(use foo::panic;);
2727
| ^^^^^^^^^^
28-
= help: use `self::panic` to refer to the macro unambiguously
28+
= help: use `self::panic` to refer to this macro unambiguously
2929

3030
error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
3131
--> $DIR/shadow_builtin_macros.rs:43:5
@@ -55,7 +55,7 @@ note: `n` could refer to the macro imported here
5555
LL | use bar::*;
5656
| ^^^^^^
5757
= help: consider adding an explicit import of `n` to disambiguate
58-
= help: or use `self::n` to refer to the macro unambiguously
58+
= help: or use `self::n` to refer to this macro unambiguously
5959
note: `n` could also refer to the macro imported here
6060
--> $DIR/shadow_builtin_macros.rs:46:13
6161
|

src/test/ui/issues/issue-16149.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0530]: match bindings cannot shadow statics
22
--> $DIR/issue-16149.rs:17:9
33
|
44
LL | static externalValue: isize;
5-
| ---------------------------- a static `externalValue` is defined here
5+
| ---------------------------- the static `externalValue` is defined here
66
...
77
LL | externalValue => true,
88
| ^^^^^^^^^^^^^ cannot be named the same as a static

src/test/ui/issues/issue-17718-patterns.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0530]: match bindings cannot shadow statics
22
--> $DIR/issue-17718-patterns.rs:17:9
33
|
44
LL | static A1: usize = 1;
5-
| --------------------- a static `A1` is defined here
5+
| --------------------- the static `A1` is defined here
66
...
77
LL | A1 => {} //~ ERROR: match bindings cannot shadow statics
88
| ^^ cannot be named the same as a static
@@ -11,7 +11,7 @@ error[E0530]: match bindings cannot shadow statics
1111
--> $DIR/issue-17718-patterns.rs:18:9
1212
|
1313
LL | static mut A2: usize = 1;
14-
| ------------------------- a static `A2` is defined here
14+
| ------------------------- the static `A2` is defined here
1515
...
1616
LL | A2 => {} //~ ERROR: match bindings cannot shadow statics
1717
| ^^ cannot be named the same as a static

src/test/ui/issues/issue-23716.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0530]: function parameters cannot shadow statics
22
--> $DIR/issue-23716.rs:13:8
33
|
44
LL | static foo: i32 = 0;
5-
| -------------------- a static `foo` is defined here
5+
| -------------------- the static `foo` is defined here
66
LL |
77
LL | fn bar(foo: i32) {}
88
| ^^^ cannot be named the same as a static
@@ -11,7 +11,7 @@ error[E0530]: function parameters cannot shadow statics
1111
--> $DIR/issue-23716.rs:23:13
1212
|
1313
LL | use self::submod::answer;
14-
| -------------------- a static `answer` is imported here
14+
| -------------------- the static `answer` is imported here
1515
LL |
1616
LL | fn question(answer: i32) {}
1717
| ^^^^^^ cannot be named the same as a static

src/test/ui/issues/issue-27033.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ error[E0530]: match bindings cannot shadow constants
88
--> $DIR/issue-27033.rs:17:9
99
|
1010
LL | const C: u8 = 1;
11-
| ---------------- a constant `C` is defined here
11+
| ---------------- the constant `C` is defined here
1212
LL | match 1 {
1313
LL | C @ 2 => { //~ ERROR match bindings cannot shadow constant
1414
| ^ cannot be named the same as a constant

src/test/ui/issues/issue-34047.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0530]: match bindings cannot shadow constants
22
--> $DIR/issue-34047.rs:15:13
33
|
44
LL | const C: u8 = 0;
5-
| ---------------- a constant `C` is defined here
5+
| ---------------- the constant `C` is defined here
66
...
77
LL | mut C => {} //~ ERROR match bindings cannot shadow constants
88
| ^ cannot be named the same as a constant

src/test/ui/macros/macro-path-prelude-shadowing.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ note: `std` could also refer to the module imported here
1111
LL | use m2::*; // glob-import user-defined `std`
1212
| ^^^^^
1313
= help: consider adding an explicit import of `std` to disambiguate
14-
= help: or use `self::std` to refer to the module unambiguously
14+
= help: or use `self::std` to refer to this module unambiguously
1515

1616
error: aborting due to previous error
1717

src/test/ui/pattern/pat-shadow-in-nested-binding.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0530]: let bindings cannot shadow tuple structs
22
--> $DIR/pat-shadow-in-nested-binding.rs:14:10
33
|
44
LL | struct foo(usize);
5-
| ------------------ a tuple struct `foo` is defined here
5+
| ------------------ the tuple struct `foo` is defined here
66
...
77
LL | let (foo, _) = (2, 3); //~ ERROR let bindings cannot shadow tuple structs
88
| ^^^ cannot be named the same as a tuple struct

src/test/ui/pattern/pattern-binding-disambiguation.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0530]: match bindings cannot shadow tuple structs
22
--> $DIR/pattern-binding-disambiguation.rs:34:9
33
|
44
LL | struct TupleStruct();
5-
| --------------------- a tuple struct `TupleStruct` is defined here
5+
| --------------------- the tuple struct `TupleStruct` is defined here
66
...
77
LL | TupleStruct => {} //~ ERROR match bindings cannot shadow tuple structs
88
| ^^^^^^^^^^^ cannot be named the same as a tuple struct
@@ -11,7 +11,7 @@ error[E0530]: match bindings cannot shadow tuple variants
1111
--> $DIR/pattern-binding-disambiguation.rs:43:9
1212
|
1313
LL | use E::*;
14-
| ---- a tuple variant `TupleVariant` is imported here
14+
| ---- the tuple variant `TupleVariant` is imported here
1515
...
1616
LL | TupleVariant => {} //~ ERROR match bindings cannot shadow tuple variants
1717
| ^^^^^^^^^^^^ cannot be named the same as a tuple variant
@@ -20,7 +20,7 @@ error[E0530]: match bindings cannot shadow struct variants
2020
--> $DIR/pattern-binding-disambiguation.rs:46:9
2121
|
2222
LL | use E::*;
23-
| ---- a struct variant `BracedVariant` is imported here
23+
| ---- the struct variant `BracedVariant` is imported here
2424
...
2525
LL | BracedVariant => {} //~ ERROR match bindings cannot shadow struct variants
2626
| ^^^^^^^^^^^^^ cannot be named the same as a struct variant
@@ -29,7 +29,7 @@ error[E0530]: match bindings cannot shadow statics
2929
--> $DIR/pattern-binding-disambiguation.rs:52:9
3030
|
3131
LL | static STATIC: () = ();
32-
| ----------------------- a static `STATIC` is defined here
32+
| ----------------------- the static `STATIC` is defined here
3333
...
3434
LL | STATIC => {} //~ ERROR match bindings cannot shadow statics
3535
| ^^^^^^ cannot be named the same as a static
@@ -38,7 +38,7 @@ error[E0530]: let bindings cannot shadow tuple structs
3838
--> $DIR/pattern-binding-disambiguation.rs:59:9
3939
|
4040
LL | struct TupleStruct();
41-
| --------------------- a tuple struct `TupleStruct` is defined here
41+
| --------------------- the tuple struct `TupleStruct` is defined here
4242
...
4343
LL | let TupleStruct = doesnt_matter; //~ ERROR let bindings cannot shadow tuple structs
4444
| ^^^^^^^^^^^ cannot be named the same as a tuple struct
@@ -47,7 +47,7 @@ error[E0530]: let bindings cannot shadow tuple variants
4747
--> $DIR/pattern-binding-disambiguation.rs:62:9
4848
|
4949
LL | use E::*;
50-
| ---- a tuple variant `TupleVariant` is imported here
50+
| ---- the tuple variant `TupleVariant` is imported here
5151
...
5252
LL | let TupleVariant = doesnt_matter; //~ ERROR let bindings cannot shadow tuple variants
5353
| ^^^^^^^^^^^^ cannot be named the same as a tuple variant
@@ -56,7 +56,7 @@ error[E0530]: let bindings cannot shadow struct variants
5656
--> $DIR/pattern-binding-disambiguation.rs:63:9
5757
|
5858
LL | use E::*;
59-
| ---- a struct variant `BracedVariant` is imported here
59+
| ---- the struct variant `BracedVariant` is imported here
6060
...
6161
LL | let BracedVariant = doesnt_matter; //~ ERROR let bindings cannot shadow struct variants
6262
| ^^^^^^^^^^^^^ cannot be named the same as a struct variant
@@ -65,7 +65,7 @@ error[E0530]: let bindings cannot shadow statics
6565
--> $DIR/pattern-binding-disambiguation.rs:65:9
6666
|
6767
LL | static STATIC: () = ();
68-
| ----------------------- a static `STATIC` is defined here
68+
| ----------------------- the static `STATIC` is defined here
6969
...
7070
LL | let STATIC = doesnt_matter; //~ ERROR let bindings cannot shadow statics
7171
| ^^^^^^ cannot be named the same as a static

src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-macros-nested.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | pub use std::io;
55
| ^^^ ambiguous name
66
|
77
= note: `std` could refer to a built-in extern crate
8-
= help: use `::std` to refer to the extern crate unambiguously
8+
= help: use `::std` to refer to this extern crate unambiguously
99
note: `std` could also refer to the module defined here
1010
--> $DIR/ambiguity-macros-nested.rs:21:13
1111
|
@@ -16,7 +16,7 @@ LL | | }
1616
...
1717
LL | m!();
1818
| ----- in this macro invocation
19-
= help: use `self::std` to refer to the module unambiguously
19+
= help: use `self::std` to refer to this module unambiguously
2020

2121
error: aborting due to previous error
2222

0 commit comments

Comments
 (0)