Stop using def_kind() in solver
This commit is contained in:
parent
6ee22e184f
commit
2ed1bdb479
@ -3,7 +3,6 @@
|
|||||||
use super::assembly::structural_traits::AsyncCallableRelevantTypes;
|
use super::assembly::structural_traits::AsyncCallableRelevantTypes;
|
||||||
use super::assembly::{self, structural_traits, Candidate};
|
use super::assembly::{self, structural_traits, Candidate};
|
||||||
use super::{EvalCtxt, GoalSource};
|
use super::{EvalCtxt, GoalSource};
|
||||||
use rustc_hir::def::DefKind;
|
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_hir::LangItem;
|
use rustc_hir::LangItem;
|
||||||
use rustc_infer::traits::query::NoSolution;
|
use rustc_infer::traits::query::NoSolution;
|
||||||
@ -54,23 +53,15 @@ fn normalize_at_least_one_step(
|
|||||||
&mut self,
|
&mut self,
|
||||||
goal: Goal<'tcx, NormalizesTo<'tcx>>,
|
goal: Goal<'tcx, NormalizesTo<'tcx>>,
|
||||||
) -> QueryResult<'tcx> {
|
) -> QueryResult<'tcx> {
|
||||||
let def_id = goal.predicate.def_id();
|
match goal.predicate.alias.kind(self.tcx()) {
|
||||||
match self.tcx().def_kind(def_id) {
|
ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst => {
|
||||||
DefKind::AssocTy | DefKind::AssocConst => {
|
let candidates = self.assemble_and_evaluate_candidates(goal);
|
||||||
match self.tcx().associated_item(def_id).container {
|
self.merge_candidates(candidates)
|
||||||
ty::AssocItemContainer::TraitContainer => {
|
|
||||||
let candidates = self.assemble_and_evaluate_candidates(goal);
|
|
||||||
self.merge_candidates(candidates)
|
|
||||||
}
|
|
||||||
ty::AssocItemContainer::ImplContainer => {
|
|
||||||
self.normalize_inherent_associated_type(goal)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DefKind::AnonConst => self.normalize_anon_const(goal),
|
ty::AliasTermKind::InherentTy => self.normalize_inherent_associated_type(goal),
|
||||||
DefKind::TyAlias => self.normalize_weak_type(goal),
|
ty::AliasTermKind::OpaqueTy => self.normalize_opaque_type(goal),
|
||||||
DefKind::OpaqueTy => self.normalize_opaque_type(goal),
|
ty::AliasTermKind::WeakTy => self.normalize_weak_type(goal),
|
||||||
kind => bug!("unknown DefKind {} in normalizes-to goal: {goal:#?}", kind.descr(def_id)),
|
ty::AliasTermKind::UnevaluatedConst => self.normalize_anon_const(goal),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user