Skip to content

Commit

Permalink
Tweak wording
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Oct 13, 2023
1 parent 781e864 commit 20c622e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion compiler/rustc_hir_analysis/src/astconv/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}`",
),
);
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-ui/issues/issue-96287.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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`
|
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/traits/issue-59029-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/type-alias-impl-trait/not_well_formed.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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`
|
Expand Down

0 comments on commit 20c622e

Please sign in to comment.