@@ -92,14 +92,14 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
9292 fn references_error ( & self ) -> bool {
9393 self . has_type_flags ( TypeFlags :: HAS_ERROR )
9494 }
95- fn has_potential_param_types_or_consts ( & self ) -> bool {
95+ fn potentially_has_param_types_or_consts ( & self ) -> bool {
9696 self . has_type_flags (
9797 TypeFlags :: HAS_KNOWN_TY_PARAM
9898 | TypeFlags :: HAS_KNOWN_CT_PARAM
9999 | TypeFlags :: HAS_UNKNOWN_DEFAULT_CONST_SUBSTS ,
100100 )
101101 }
102- fn has_param_types_or_consts ( & self , tcx : TyCtxt < ' tcx > ) -> bool {
102+ fn definitely_has_param_types_or_consts ( & self , tcx : TyCtxt < ' tcx > ) -> bool {
103103 self . definitely_has_type_flags (
104104 tcx,
105105 TypeFlags :: HAS_KNOWN_TY_PARAM | TypeFlags :: HAS_KNOWN_CT_PARAM ,
@@ -129,7 +129,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
129129 TypeFlags :: KNOWN_NEEDS_SUBST | TypeFlags :: HAS_UNKNOWN_DEFAULT_CONST_SUBSTS ,
130130 )
131131 }
132- fn needs_subst ( & self , tcx : TyCtxt < ' tcx > ) -> bool {
132+ fn definitely_needs_subst ( & self , tcx : TyCtxt < ' tcx > ) -> bool {
133133 self . definitely_has_type_flags ( tcx, TypeFlags :: KNOWN_NEEDS_SUBST )
134134 }
135135 /// "Free" regions in this context means that it has any region
@@ -227,10 +227,13 @@ pub trait TypeVisitor<'tcx>: Sized {
227227 /// Supplies the `tcx` for an unevaluated anonymous constant in case its default substs
228228 /// are not yet supplied.
229229 ///
230- /// Visitors which do not look into these substs may return `None` here, in which case
231- /// `super_visit_with` completely skips the default substs. Incorrectly returning
232- /// `None` can very quickly lead to ICE or other critical bugs, so be careful and
233- /// try to return an actual `tcx` if at all possible.
230+ /// Returning `None` for this method is only recommended if the `TypeVisitor`
231+ /// does not care about default anon const substs, as it ignores generic parameters,
232+ /// and fetching the default substs would cause a query cycle.
233+ ///
234+ /// For visitors which return `None` we completely skip the default substs in `ty::Unevaluated::super_visit_with`.
235+ /// This means that incorrectly returning `None` can very quickly lead to ICE or other critical bugs, so be careful and
236+ /// try to return an actual `tcx` if possible.
234237 fn tcx_for_anon_const_substs ( & self ) -> Option < TyCtxt < ' tcx > > ;
235238
236239 fn visit_binder < T : TypeFoldable < ' tcx > > (
0 commit comments