rename -Ztrait-solver to -Znext-solver

This commit is contained in:
lcnr
2023-12-14 13:00:23 +01:00
parent 1aa6aefdc9
commit 5d97ada1ec
8 changed files with 102 additions and 89 deletions

View File

@@ -25,7 +25,6 @@ use rustc_middle::ty::ToPredicate;
use rustc_middle::ty::TypeFoldable;
use rustc_middle::ty::Variance;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_session::config::TraitSolver;
pub trait TraitEngineExt<'tcx> {
fn new(infcx: &InferCtxt<'tcx>) -> Box<Self>;
@@ -33,18 +32,16 @@ pub trait TraitEngineExt<'tcx> {
impl<'tcx> TraitEngineExt<'tcx> for dyn TraitEngine<'tcx> {
fn new(infcx: &InferCtxt<'tcx>) -> Box<Self> {
match (infcx.tcx.sess.opts.unstable_opts.trait_solver, infcx.next_trait_solver()) {
(TraitSolver::Classic, false) | (TraitSolver::NextCoherence, false) => {
Box::new(FulfillmentContext::new(infcx))
}
(TraitSolver::Classic | TraitSolver::Next | TraitSolver::NextCoherence, true) => {
Box::new(NextFulfillmentCtxt::new(infcx))
}
(TraitSolver::Next, false) => bug!(
"incompatible combination of -Ztrait-solver flag ({:?}) and InferCtxt::next_trait_solver ({:?})",
infcx.tcx.sess.opts.unstable_opts.trait_solver,
infcx.next_trait_solver()
),
if infcx.next_trait_solver() {
Box::new(NextFulfillmentCtxt::new(infcx))
} else {
let new_solver_globally =
infcx.tcx.sess.opts.unstable_opts.next_solver.map_or(false, |c| c.globally);
assert!(
!new_solver_globally,
"using old solver even though new solver is enabled globally"
);
Box::new(FulfillmentContext::new(infcx))
}
}
}