diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2020-11-24 16:59:57 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2020-11-27 11:23:51 -0300 |
| commit | 9e0538bd07292d6b2d4d215d0cb91d5c9d05aee4 (patch) | |
| tree | b658f16cbf8adca3a794a597fe8b3df332960d8a | |
| parent | a175f36c954abf69aaf4021a321ea13c8573cb40 (diff) | |
| download | rust-9e0538bd07292d6b2d4d215d0cb91d5c9d05aee4.tar.gz rust-9e0538bd07292d6b2d4d215d0cb91d5c9d05aee4.zip | |
Document elaborate_trait_refs_that_define_assoc_type
| -rw-r--r-- | compiler/rustc_infer/src/traits/util.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_infer/src/traits/util.rs b/compiler/rustc_infer/src/traits/util.rs index 26f6fcd5dab..b7d6e8f0bf6 100644 --- a/compiler/rustc_infer/src/traits/util.rs +++ b/compiler/rustc_infer/src/traits/util.rs @@ -90,6 +90,11 @@ pub fn elaborate_trait_refs<'tcx>( elaborate_predicates(tcx, predicates) } +/// A specialized variant of `elaborate_trait_refs` that only elaborates trait references that may +/// define the given associated type `assoc_name`. It uses the +/// `super_predicates_that_define_assoc_type` query to avoid enumerating super-predicates that +/// aren't related to `assoc_item`. This is used when resolving types like `Self::Item` or +/// `T::Item` and helps to avoid cycle errors (see e.g. #35237). pub fn elaborate_trait_refs_that_define_assoc_type<'tcx>( tcx: TyCtxt<'tcx>, trait_refs: impl Iterator<Item = ty::PolyTraitRef<'tcx>>, |
