Tweak wording

This commit is contained in:
Esteban Küber 2023-09-29 16:17:22 +00:00
parent 781e86477c
commit 20c622e456
4 changed files with 6 additions and 5 deletions

View File

@ -191,10 +191,11 @@ pub(crate) fn complain_about_assoc_type_not_found<I>(
.collect::<Vec<_>>()[..] .collect::<Vec<_>>()[..]
{ {
let trait_name = self.tcx().def_path_str(*best_trait); 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( err.span_label(
assoc_name.span, assoc_name.span,
format!( format!(
"there is a similarly named associated type `{suggested_name}` in the \ "there is {an} associated type `{suggested_name}` in the \
trait `{trait_name}`", trait `{trait_name}`",
), ),
); );

View File

@ -2,7 +2,7 @@ error[E0220]: associated type `Assoc` not found for `V`
--> $DIR/issue-96287.rs:7:33 --> $DIR/issue-96287.rs:7:33
| |
LL | pub type Foo<V> = impl Trait<V::Assoc>; 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` help: consider restricting type parameter `V`
| |

View File

@ -2,13 +2,13 @@ error[E0220]: associated type `Res` not found for `Self`
--> $DIR/issue-59029-1.rs:5:52 --> $DIR/issue-59029-1.rs:5:52
| |
LL | trait MkSvc<Target, Req> = Svc<Target> where Self::Res: Svc<Req>; 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` error[E0220]: associated type `Res` not found for `Self`
--> $DIR/issue-59029-1.rs:5:52 --> $DIR/issue-59029-1.rs:5:52
| |
LL | trait MkSvc<Target, Req> = Svc<Target> where Self::Res: Svc<Req>; 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` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@ -2,7 +2,7 @@ error[E0220]: associated type `Assoc` not found for `V`
--> $DIR/not_well_formed.rs:11:29 --> $DIR/not_well_formed.rs:11:29
| |
LL | type Foo<V> = impl Trait<V::Assoc>; 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` help: consider restricting type parameter `V`
| |