@@ -3,7 +3,6 @@ use crate::traits::specialization_graph;
3
3
use super :: assembly:: structural_traits:: AsyncCallableRelevantTypes ;
4
4
use super :: assembly:: { self , structural_traits, Candidate } ;
5
5
use super :: { EvalCtxt , GoalSource } ;
6
- use rustc_hir:: def:: DefKind ;
7
6
use rustc_hir:: def_id:: DefId ;
8
7
use rustc_hir:: LangItem ;
9
8
use rustc_infer:: traits:: query:: NoSolution ;
@@ -54,23 +53,15 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
54
53
& mut self ,
55
54
goal : Goal < ' tcx , NormalizesTo < ' tcx > > ,
56
55
) -> QueryResult < ' tcx > {
57
- let def_id = goal. predicate . def_id ( ) ;
58
- match self . tcx ( ) . def_kind ( def_id) {
59
- DefKind :: AssocTy | DefKind :: AssocConst => {
60
- match self . tcx ( ) . associated_item ( def_id) . container {
61
- ty:: AssocItemContainer :: TraitContainer => {
62
- let candidates = self . assemble_and_evaluate_candidates ( goal) ;
63
- self . merge_candidates ( candidates)
64
- }
65
- ty:: AssocItemContainer :: ImplContainer => {
66
- self . normalize_inherent_associated_type ( goal)
67
- }
68
- }
56
+ match goal. predicate . alias . kind ( self . tcx ( ) ) {
57
+ ty:: AliasTermKind :: ProjectionTy | ty:: AliasTermKind :: ProjectionConst => {
58
+ let candidates = self . assemble_and_evaluate_candidates ( goal) ;
59
+ self . merge_candidates ( candidates)
69
60
}
70
- DefKind :: AnonConst => self . normalize_anon_const ( goal) ,
71
- DefKind :: TyAlias => self . normalize_weak_type ( goal) ,
72
- DefKind :: OpaqueTy => self . normalize_opaque_type ( goal) ,
73
- kind => bug ! ( "unknown DefKind {} in normalizes-to goal: {goal:#?}" , kind . descr ( def_id ) ) ,
61
+ ty :: AliasTermKind :: InherentTy => self . normalize_inherent_associated_type ( goal) ,
62
+ ty :: AliasTermKind :: OpaqueTy => self . normalize_opaque_type ( goal) ,
63
+ ty :: AliasTermKind :: WeakTy => self . normalize_weak_type ( goal) ,
64
+ ty :: AliasTermKind :: UnevaluatedConst => self . normalize_anon_const ( goal ) ,
74
65
}
75
66
}
76
67
0 commit comments