initial revert

This commit is contained in:
Ellen
2022-01-12 03:19:52 +00:00
parent b0ec3e09a9
commit 71bbb603f4
127 changed files with 540 additions and 1050 deletions

View File

@@ -526,7 +526,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// contain the "'static" lifetime (any other lifetime
// would either be late-bound or local), so it is guaranteed
// to outlive any other lifetime
if pred.0.is_global(self.infcx.tcx) && !pred.0.has_late_bound_regions() {
if pred.0.is_global() && !pred.0.has_late_bound_regions() {
Ok(EvaluatedToOk)
} else {
Ok(EvaluatedToOkModuloRegions)
@@ -619,10 +619,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
}
ty::PredicateKind::ConstEvaluatable(uv) => {
ty::PredicateKind::ConstEvaluatable(def_id, substs) => {
match const_evaluatable::is_const_evaluatable(
self.infcx,
uv,
def_id,
substs,
obligation.param_env,
obligation.cause.span,
) {
@@ -644,7 +645,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
if let (ty::ConstKind::Unevaluated(a), ty::ConstKind::Unevaluated(b)) =
(c1.val, c2.val)
{
if self.infcx.try_unify_abstract_consts(a.shrink(), b.shrink()) {
if self.infcx.try_unify_abstract_consts(a, b) {
return Ok(EvaluatedToOk);
}
}
@@ -711,12 +712,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
mut obligation: TraitObligation<'tcx>,
) -> Result<EvaluationResult, OverflowError> {
if !self.intercrate
&& obligation.is_global(self.tcx())
&& obligation
.param_env
.caller_bounds()
.iter()
.all(|bound| bound.definitely_needs_subst(self.tcx()))
&& obligation.is_global()
&& obligation.param_env.caller_bounds().iter().all(|bound| bound.needs_subst())
{
// If a param env has no global bounds, global obligations do not
// depend on its particular value in order to work, so we can clear
@@ -1535,7 +1532,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// the param_env so that it can be given the lowest priority. See
// #50825 for the motivation for this.
let is_global = |cand: &ty::PolyTraitPredicate<'tcx>| {
cand.is_global(self.infcx.tcx) && !cand.has_late_bound_regions()
cand.is_global() && !cand.has_late_bound_regions()
};
// (*) Prefer `BuiltinCandidate { has_nested: false }`, `PointeeCandidate`,