Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 9e0538b

Browse files
committed
Document elaborate_trait_refs_that_define_assoc_type
1 parent a175f36 commit 9e0538b

File tree

1 file changed

+5
-0
lines changed
  • compiler/rustc_infer/src/traits

1 file changed

+5
-0
lines changed

compiler/rustc_infer/src/traits/util.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ pub fn elaborate_trait_refs<'tcx>(
9090
elaborate_predicates(tcx, predicates)
9191
}
9292

93+
/// A specialized variant of `elaborate_trait_refs` that only elaborates trait references that may
94+
/// define the given associated type `assoc_name`. It uses the
95+
/// `super_predicates_that_define_assoc_type` query to avoid enumerating super-predicates that
96+
/// aren't related to `assoc_item`. This is used when resolving types like `Self::Item` or
97+
/// `T::Item` and helps to avoid cycle errors (see e.g. #35237).
9398
pub fn elaborate_trait_refs_that_define_assoc_type<'tcx>(
9499
tcx: TyCtxt<'tcx>,
95100
trait_refs: impl Iterator<Item = ty::PolyTraitRef<'tcx>>,

0 commit comments

Comments
 (0)