about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2023-09-29 16:17:22 +0000
committerEsteban Küber <esteban@kuber.com.ar>2023-10-13 19:18:46 +0000
commit20c622e4564bed8f6e4f9ef8b05c3a004d45e6f8 (patch)
treecb86f390159387b5887db9029f9ff277e2f2d166
parent781e86477cf71c7850d4d1f169c58d7e398654f7 (diff)
downloadrust-20c622e4564bed8f6e4f9ef8b05c3a004d45e6f8.tar.gz
rust-20c622e4564bed8f6e4f9ef8b05c3a004d45e6f8.zip
Tweak wording
-rw-r--r--compiler/rustc_hir_analysis/src/astconv/errors.rs3
-rw-r--r--tests/rustdoc-ui/issues/issue-96287.stderr2
-rw-r--r--tests/ui/traits/issue-59029-1.stderr4
-rw-r--r--tests/ui/type-alias-impl-trait/not_well_formed.stderr2
4 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_hir_analysis/src/astconv/errors.rs b/compiler/rustc_hir_analysis/src/astconv/errors.rs
index 0cac434f450..9e18767a7c3 100644
--- a/compiler/rustc_hir_analysis/src/astconv/errors.rs
+++ b/compiler/rustc_hir_analysis/src/astconv/errors.rs
@@ -191,10 +191,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
                 .collect::<Vec<_>>()[..]
             {
                 let trait_name = self.tcx().def_path_str(*best_trait);
+                let an = if suggested_name != assoc_name.name { "a similarly named" } else { "an" };
                 err.span_label(
                     assoc_name.span,
                     format!(
-                        "there is a similarly named associated type `{suggested_name}` in the \
+                        "there is {an} associated type `{suggested_name}` in the \
                          trait `{trait_name}`",
                     ),
                 );
diff --git a/tests/rustdoc-ui/issues/issue-96287.stderr b/tests/rustdoc-ui/issues/issue-96287.stderr
index ee5ab2ba45b..c4809a311fc 100644
--- a/tests/rustdoc-ui/issues/issue-96287.stderr
+++ b/tests/rustdoc-ui/issues/issue-96287.stderr
@@ -2,7 +2,7 @@ error[E0220]: associated type `Assoc` not found for `V`
   --> $DIR/issue-96287.rs:7:33
    |
 LL | pub type Foo<V> = impl Trait<V::Assoc>;
-   |                                 ^^^^^ there is a similarly named associated type `Assoc` in the trait `TraitWithAssoc`
+   |                                 ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc`
    |
 help: consider restricting type parameter `V`
    |
diff --git a/tests/ui/traits/issue-59029-1.stderr b/tests/ui/traits/issue-59029-1.stderr
index 51354bcc545..5c47eefcd6c 100644
--- a/tests/ui/traits/issue-59029-1.stderr
+++ b/tests/ui/traits/issue-59029-1.stderr
@@ -2,13 +2,13 @@ error[E0220]: associated type `Res` not found for `Self`
   --> $DIR/issue-59029-1.rs:5:52
    |
 LL | trait MkSvc<Target, Req> = Svc<Target> where Self::Res: Svc<Req>;
-   |                                                    ^^^ there is a similarly named associated type `Res` in the trait `Svc`
+   |                                                    ^^^ there is an associated type `Res` in the trait `Svc`
 
 error[E0220]: associated type `Res` not found for `Self`
   --> $DIR/issue-59029-1.rs:5:52
    |
 LL | trait MkSvc<Target, Req> = Svc<Target> where Self::Res: Svc<Req>;
-   |                                                    ^^^ there is a similarly named associated type `Res` in the trait `Svc`
+   |                                                    ^^^ there is an associated type `Res` in the trait `Svc`
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.stderr b/tests/ui/type-alias-impl-trait/not_well_formed.stderr
index e89cae2d104..b267e6a7544 100644
--- a/tests/ui/type-alias-impl-trait/not_well_formed.stderr
+++ b/tests/ui/type-alias-impl-trait/not_well_formed.stderr
@@ -2,7 +2,7 @@ error[E0220]: associated type `Assoc` not found for `V`
   --> $DIR/not_well_formed.rs:11:29
    |
 LL | type Foo<V> = impl Trait<V::Assoc>;
-   |                             ^^^^^ there is a similarly named associated type `Assoc` in the trait `TraitWithAssoc`
+   |                             ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc`
    |
 help: consider restricting type parameter `V`
    |