File tree Expand file tree Collapse file tree 2 files changed +14
-26
lines changed
Expand file tree Collapse file tree 2 files changed +14
-26
lines changed Original file line number Diff line number Diff line change @@ -558,24 +558,6 @@ macro_rules! define_callbacks {
558558 ) *
559559 }
560560 }
561-
562- pub fn def_kind( & self , tcx: TyCtxt <' tcx>) -> Option <DefKind > {
563- // This is used to reduce code generation as it
564- // can be reused for queries with the same key type.
565- fn inner<' tcx>( key: & impl crate :: query:: QueryKey , tcx: TyCtxt <' tcx>) -> Option <DefKind > {
566- key. key_as_def_id( ) . and_then( |def_id| def_id. as_local( ) ) . map( |def_id| tcx. def_kind( def_id) )
567- }
568-
569- if let TaggedQueryKey :: def_kind( ..) = self {
570- // Try to avoid infinite recursion.
571- return None
572- }
573- match self {
574- $(
575- TaggedQueryKey :: $name( key) => inner( key, tcx) ,
576- ) *
577- }
578- }
579561 }
580562
581563 /// Holds a `QueryVTable` for each query.
Original file line number Diff line number Diff line change @@ -483,15 +483,21 @@ pub(crate) fn report_cycle<'tcx>(
483483 } ) ;
484484 }
485485
486- let alias = if stack
487- . iter ( )
488- . all ( |entry| matches ! ( entry. node. tagged_key. def_kind( tcx) , Some ( DefKind :: TyAlias ) ) )
489- {
486+ let is_all_def_kind = |def_kind| {
487+ stack. iter ( ) . all ( |entry| match entry. node . tagged_key {
488+ TaggedQueryKey :: type_of( def_id)
489+ | TaggedQueryKey :: explicit_implied_predicates_of( def_id)
490+ if tcx. def_kind ( def_id) == def_kind =>
491+ {
492+ true
493+ }
494+ _ => false ,
495+ } )
496+ } ;
497+
498+ let alias = if is_all_def_kind ( DefKind :: TyAlias ) {
490499 Some ( crate :: error:: Alias :: Ty )
491- } else if stack
492- . iter ( )
493- . all ( |entry| entry. node . tagged_key . def_kind ( tcx) == Some ( DefKind :: TraitAlias ) )
494- {
500+ } else if is_all_def_kind ( DefKind :: TraitAlias ) {
495501 Some ( crate :: error:: Alias :: Trait )
496502 } else {
497503 None
You can’t perform that action at this time.
0 commit comments