@@ -3,7 +3,6 @@ use crate::traits::specialization_graph;
33use super :: assembly:: structural_traits:: AsyncCallableRelevantTypes ;
44use super :: assembly:: { self , structural_traits, Candidate } ;
55use super :: { EvalCtxt , GoalSource } ;
6- use rustc_hir:: def:: DefKind ;
76use rustc_hir:: def_id:: DefId ;
87use rustc_hir:: LangItem ;
98use rustc_infer:: traits:: query:: NoSolution ;
@@ -54,23 +53,15 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
5453 & mut self ,
5554 goal : Goal < ' tcx , NormalizesTo < ' tcx > > ,
5655 ) -> 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)
6960 }
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 ) ,
7465 }
7566 }
7667
0 commit comments