Add the core logic in old and new solvers

This commit is contained in:
tiif
2025-07-14 13:35:06 +00:00
parent 2586185831
commit 1e5c7b2877
7 changed files with 96 additions and 2 deletions

View File

@@ -28,7 +28,7 @@ use rustc_middle::ty::error::TypeErrorToStringExt;
use rustc_middle::ty::print::{PrintTraitRefExt as _, with_no_trimmed_paths};
use rustc_middle::ty::{
self, DeepRejectCtxt, GenericArgsRef, PolyProjectionPredicate, SizedTraitKind, Ty, TyCtxt,
TypeFoldable, TypeVisitableExt, TypingMode, Upcast, elaborate,
TypeFoldable, TypeVisitableExt, TypingMode, Upcast, elaborate, may_use_unstable_feature,
};
use rustc_span::{Symbol, sym};
use tracing::{debug, instrument, trace};
@@ -832,6 +832,14 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
}
ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(symbol)) => {
if may_use_unstable_feature(self.infcx, obligation.param_env, symbol) {
Ok(EvaluatedToOk)
} else {
Ok(EvaluatedToAmbig)
}
}
ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(uv)) => {
match const_evaluatable::is_const_evaluatable(
self.infcx,