1
Fork 0

Make things work by using the new solver

This commit is contained in:
Michael Goulet 2023-06-21 03:44:19 +00:00
parent 7f3c2c7e2c
commit 8597bf1df7
9 changed files with 22 additions and 18 deletions

View file

@ -37,6 +37,8 @@ pub(super) trait GoalKind<'tcx>:
fn trait_ref(self, tcx: TyCtxt<'tcx>) -> ty::TraitRef<'tcx>;
fn polarity(self) -> ty::ImplPolarity;
fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self;
fn trait_def_id(self, tcx: TyCtxt<'tcx>) -> DefId;

View file

@ -101,6 +101,10 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
self.projection_ty.trait_ref(tcx)
}
fn polarity(self) -> ty::ImplPolarity {
ty::ImplPolarity::Positive
}
fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
self.with_self_ty(tcx, self_ty)
}

View file

@ -22,6 +22,10 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
self.trait_ref
}
fn polarity(self) -> ty::ImplPolarity {
self.polarity
}
fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
self.with_self_ty(tcx, self_ty)
}

View file

@ -398,8 +398,8 @@ fn impl_intersection_has_negative_obligation(
) -> bool {
debug!("negative_impl(impl1_def_id={:?}, impl2_def_id={:?})", impl1_def_id, impl2_def_id);
let ref infcx = tcx.infer_ctxt().intercrate(true).build();
let universe = infcx.create_next_universe();
let ref infcx = tcx.infer_ctxt().intercrate(true).with_next_trait_solver(true).build();
let universe = infcx.universe();
let impl1_header = fresh_impl_header(infcx, impl1_def_id);
let param_env =

View file

@ -37,7 +37,7 @@ impl<'tcx> TraitEngineExt<'tcx> for dyn TraitEngine<'tcx> {
(TraitSolver::Classic, false) | (TraitSolver::NextCoherence, false) => {
Box::new(FulfillmentContext::new(infcx))
}
(TraitSolver::Next | TraitSolver::NextCoherence, true) => {
(TraitSolver::Classic | TraitSolver::Next | TraitSolver::NextCoherence, true) => {
Box::new(NextFulfillmentCtxt::new(infcx))
}
_ => bug!(