Skip to content

Commit d6daff5

Browse files
committed
[comment fixes]
1 parent b95392d commit d6daff5

File tree

1 file changed

+11
-10
lines changed
  • compiler/rustc_hir_analysis/src/astconv

1 file changed

+11
-10
lines changed

compiler/rustc_hir_analysis/src/astconv/errors.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
238238
None,
239239
) && suggested_name != assoc_name.name
240240
{
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
242242
// was also not an exact match, so we also suggest changing it.
243243
err.span_suggestion_verbose(
244244
assoc_name.span,
@@ -253,16 +253,17 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
253253
}
254254
}
255255

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,
257257
// suggests using it.
258258
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+
};
266267

267268
err.sugg = Some(errors::AssocItemNotFoundSugg::Other {
268269
span: assoc_name.span,
@@ -318,7 +319,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
318319
};
319320

320321
// 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.
322323
let (span, expected_because_label, expected, got) = if let Some(binding) = binding
323324
&& let ConvertedBindingKind::Equality(term) = binding.kind
324325
{

0 commit comments

Comments
 (0)