@@ -238,7 +238,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
238
238
None ,
239
239
) && suggested_name != assoc_name. name
240
240
{
241
- // We suggested constraining a type parameter, but the associated type on it
241
+ // We suggested constraining a type parameter, but the associated item on it
242
242
// was also not an exact match, so we also suggest changing it.
243
243
err. span_suggestion_verbose (
244
244
assoc_name. span ,
@@ -253,16 +253,17 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
253
253
}
254
254
}
255
255
256
- // If we still couldn't find any associated type , and only one associated type exists,
256
+ // If we still couldn't find any associated item , and only one associated item exists,
257
257
// suggests using it.
258
258
if let [ candidate_name] = all_candidate_names. as_slice ( ) {
259
- // this should still compile, except on `#![feature(associated_type_defaults)]`
260
- // where it could suggests `type A = Self::A`, thus recursing infinitely
261
- let applicability = if tcx. features ( ) . associated_type_defaults {
262
- Applicability :: Unspecified
263
- } else {
264
- Applicability :: MaybeIncorrect
265
- } ;
259
+ // This should still compile, except on `#![feature(associated_type_defaults)]`
260
+ // where it could suggests `type A = Self::A`, thus recursing infinitely.
261
+ let applicability =
262
+ if assoc_kind == ty:: AssocKind :: Type && tcx. features ( ) . associated_type_defaults {
263
+ Applicability :: Unspecified
264
+ } else {
265
+ Applicability :: MaybeIncorrect
266
+ } ;
266
267
267
268
err. sugg = Some ( errors:: AssocItemNotFoundSugg :: Other {
268
269
span : assoc_name. span ,
@@ -318,7 +319,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
318
319
} ;
319
320
320
321
// For equality bounds, we want to blame the term (RHS) instead of the item (LHS) since
321
- // one can argue that that's more “untuitive ” to the user.
322
+ // one can argue that that's more “intuitive ” to the user.
322
323
let ( span, expected_because_label, expected, got) = if let Some ( binding) = binding
323
324
&& let ConvertedBindingKind :: Equality ( term) = binding. kind
324
325
{
0 commit comments