Skip to content

Commit 5a134ab

Browse files
Stop using def_kind() in solver
1 parent 9a3bfbc commit 5a134ab

File tree

1 file changed

+8
-16
lines changed
  • compiler/rustc_trait_selection/src/solve/normalizes_to

1 file changed

+8
-16
lines changed

compiler/rustc_trait_selection/src/solve/normalizes_to/mod.rs

+8-16
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,15 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
5454
&mut self,
5555
goal: Goal<'tcx, NormalizesTo<'tcx>>,
5656
) -> 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-
}
57+
match goal.predicate.alias.kind(self.tcx()) {
58+
ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst => {
59+
let candidates = self.assemble_and_evaluate_candidates(goal);
60+
self.merge_candidates(candidates)
6961
}
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)),
62+
ty::AliasTermKind::InherentTy => self.normalize_inherent_associated_type(goal),
63+
ty::AliasTermKind::OpaqueTy => self.normalize_opaque_type(goal),
64+
ty::AliasTermKind::WeakTy => self.normalize_weak_type(goal),
65+
ty::AliasTermKind::UnevaluatedConst => self.normalize_anon_const(goal),
7466
}
7567
}
7668

0 commit comments

Comments
 (0)