@@ -646,6 +646,9 @@ rustc_queries! {
646646 }
647647
648648 /// Returns the predicates written explicitly by the user.
649+ ///
650+ /// You should probably use `predicates_of` unless you're looking for
651+ /// predicates with explicit spans for diagnostics purposes.
649652 query explicit_predicates_of( key: DefId ) -> ty:: GenericPredicates <' tcx> {
650653 desc { |tcx| "computing explicit predicates of `{}`" , tcx. def_path_str( key) }
651654 cache_on_disk_if { key. is_local( ) }
@@ -662,29 +665,32 @@ rustc_queries! {
662665 feedable
663666 }
664667
665- /// Maps from the `DefId` of a trait to the list of
666- /// super-predicates. This is a subset of the full list of
667- /// predicates. We store these in a separate map because we must
668- /// evaluate them even during type conversion, often before the
669- /// full predicates are available (note that supertraits have
670- /// additional acyclicity requirements).
671- query super_predicates_of( key: DefId ) -> ty:: GenericPredicates <' tcx> {
668+ /// Maps from the `DefId` of a trait to the list of super-predicates of the trait,
669+ /// *before* elaboration (so it doesn't contain transitive super-predicates). This
670+ /// is a subset of the full list of predicates. We store these in a separate map
671+ /// because we must evaluate them even during type conversion, often before the full
672+ /// predicates are available (note that super-predicates must not be cyclic).
673+ query explicit_super_predicates_of( key: DefId ) -> ty:: GenericPredicates <' tcx> {
672674 desc { |tcx| "computing the super predicates of `{}`" , tcx. def_path_str( key) }
673675 cache_on_disk_if { key. is_local( ) }
674676 separate_provide_extern
675677 }
676678
677- query implied_predicates_of( key: DefId ) -> ty:: GenericPredicates <' tcx> {
679+ /// The predicates of the trait that are implied during elaboration. This is a
680+ /// superset of the super-predicates of the trait, but a subset of the predicates
681+ /// of the trait. For regular traits, this includes all super-predicates and their
682+ /// associated type bounds. For trait aliases, currently, this includes all of the
683+ /// predicates of the trait alias.
684+ query explicit_implied_predicates_of( key: DefId ) -> ty:: GenericPredicates <' tcx> {
678685 desc { |tcx| "computing the implied predicates of `{}`" , tcx. def_path_str( key) }
679686 cache_on_disk_if { key. is_local( ) }
680687 separate_provide_extern
681688 }
682689
683- /// The `Option<Ident>` is the name of an associated type. If it is `None`, then this query
684- /// returns the full set of predicates. If `Some<Ident>`, then the query returns only the
685- /// subset of super-predicates that reference traits that define the given associated type.
686- /// This is used to avoid cycles in resolving types like `T::Item`.
687- query super_predicates_that_define_assoc_item( key: ( DefId , rustc_span:: symbol:: Ident ) ) -> ty:: GenericPredicates <' tcx> {
690+ /// The Ident is the name of an associated type.The query returns only the subset
691+ /// of supertraits that define the given associated type. This is used to avoid
692+ /// cycles in resolving type-dependent associated item paths like `T::Item`.
693+ query explicit_supertraits_containing_assoc_item( key: ( DefId , rustc_span:: symbol:: Ident ) ) -> ty:: GenericPredicates <' tcx> {
688694 desc { |tcx| "computing the super traits of `{}` with associated type name `{}`" ,
689695 tcx. def_path_str( key. 0 ) ,
690696 key. 1
0 commit comments