Skip to content

Commit 9355653

Browse files
committed
resolve: Tweak some articles in ambiguity diagnostics
1 parent f62f8a5 commit 9355653

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
}
@@ -4722,11 +4722,11 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
47224722
`{ident}` to disambiguate", ident = ident))
47234723
}
47244724
if b.is_extern_crate() && self.session.rust_2018() {
4725-
help_msgs.push(format!("use `::{ident}` to refer to the {thing} unambiguously",
4725+
help_msgs.push(format!("use `::{ident}` to refer to this {thing} unambiguously",
47264726
ident = ident, thing = b.descr()))
47274727
}
47284728
if misc == AmbiguityErrorMisc::SuggestSelf {
4729-
help_msgs.push(format!("use `self::{ident}` to refer to the {thing} unambiguously",
4729+
help_msgs.push(format!("use `self::{ident}` to refer to this {thing} unambiguously",
47304730
ident = ident, thing = b.descr()))
47314731
}
47324732

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

0 commit comments

Comments
 (0)