Skip to content

Commit 43ccacf

Browse files
committed
region_outlives_predicate no snapshot
1 parent 608625d commit 43ccacf

File tree

6 files changed

+15
-42
lines changed

6 files changed

+15
-42
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ E0790: include_str!("./error_codes/E0790.md"),
559559
// E0273, // on_unimplemented #1
560560
// E0274, // on_unimplemented #2
561561
// E0278, // requirement is not satisfied
562-
E0279, // requirement is not satisfied
562+
// E0279,
563563
E0280, // requirement is not satisfied
564564
// E0285, // overflow evaluation builtin bounds
565565
// E0296, // replaced with a generic attribute input check

compiler/rustc_infer/src/infer/mod.rs

+5-10
Original file line numberDiff line numberDiff line change
@@ -1061,16 +1061,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
10611061
&self,
10621062
cause: &traits::ObligationCause<'tcx>,
10631063
predicate: ty::PolyRegionOutlivesPredicate<'tcx>,
1064-
) -> UnitResult<'tcx> {
1065-
self.commit_if_ok(|_snapshot| {
1066-
let ty::OutlivesPredicate(r_a, r_b) =
1067-
self.replace_bound_vars_with_placeholders(predicate);
1068-
let origin = SubregionOrigin::from_obligation_cause(cause, || {
1069-
RelateRegionParamBound(cause.span)
1070-
});
1071-
self.sub_regions(origin, r_b, r_a); // `b : a` ==> `a <= b`
1072-
Ok(())
1073-
})
1064+
) {
1065+
let ty::OutlivesPredicate(r_a, r_b) = self.replace_bound_vars_with_placeholders(predicate);
1066+
let origin =
1067+
SubregionOrigin::from_obligation_cause(cause, || RelateRegionParamBound(cause.span));
1068+
self.sub_regions(origin, r_b, r_a); // `b : a` ==> `a <= b`
10741069
}
10751070

10761071
/// Number of type variables created so far.

compiler/rustc_trait_selection/src/traits/auto_trait.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -793,9 +793,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
793793
}
794794
ty::PredicateKind::RegionOutlives(binder) => {
795795
let binder = bound_predicate.rebind(binder);
796-
if select.infcx().region_outlives_predicate(&dummy_cause, binder).is_err() {
797-
return false;
798-
}
796+
select.infcx().region_outlives_predicate(&dummy_cause, binder)
799797
}
800798
ty::PredicateKind::TypeOutlives(binder) => {
801799
let binder = bound_predicate.rebind(binder);

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

+3-18
Original file line numberDiff line numberDiff line change
@@ -789,24 +789,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
789789
span_bug!(span, "coerce requirement gave wrong error: `{:?}`", predicate)
790790
}
791791

792-
ty::PredicateKind::RegionOutlives(predicate) => {
793-
let predicate = bound_predicate.rebind(predicate);
794-
let predicate = self.resolve_vars_if_possible(predicate);
795-
let err = self
796-
.region_outlives_predicate(&obligation.cause, predicate)
797-
.err()
798-
.unwrap();
799-
struct_span_err!(
800-
self.tcx.sess,
801-
span,
802-
E0279,
803-
"the requirement `{}` is not satisfied (`{}`)",
804-
predicate,
805-
err,
806-
)
807-
}
808-
809-
ty::PredicateKind::Projection(..) | ty::PredicateKind::TypeOutlives(..) => {
792+
ty::PredicateKind::RegionOutlives(..)
793+
| ty::PredicateKind::Projection(..)
794+
| ty::PredicateKind::TypeOutlives(..) => {
810795
let predicate = self.resolve_vars_if_possible(obligation.predicate);
811796
struct_span_err!(
812797
self.tcx.sess,

compiler/rustc_trait_selection/src/traits/fulfill.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,10 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
359359

360360
ty::PredicateKind::RegionOutlives(data) => {
361361
if infcx.considering_regions || data.has_placeholders() {
362-
match infcx
363-
.region_outlives_predicate(&obligation.cause, Binder::dummy(data))
364-
{
365-
Ok(()) => ProcessResult::Changed(vec![]),
366-
Err(_) => ProcessResult::Error(CodeSelectionError(Unimplemented)),
367-
}
368-
} else {
369-
ProcessResult::Changed(vec![])
362+
infcx.region_outlives_predicate(&obligation.cause, Binder::dummy(data));
370363
}
364+
365+
ProcessResult::Changed(vec![])
371366
}
372367

373368
ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(t_a, r_b)) => {

src/tools/tidy/src/error_codes_check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use regex::Regex;
1010

1111
// A few of those error codes can't be tested but all the others can and *should* be tested!
1212
const EXEMPTED_FROM_TEST: &[&str] = &[
13-
"E0279", "E0313", "E0377", "E0461", "E0462", "E0465", "E0476", "E0490", "E0514", "E0519",
14-
"E0523", "E0554", "E0640", "E0717", "E0729", "E0789",
13+
"E0313", "E0377", "E0461", "E0462", "E0465", "E0476", "E0490", "E0514", "E0519", "E0523",
14+
"E0554", "E0640", "E0717", "E0729", "E0789",
1515
];
1616

1717
// Some error codes don't have any tests apparently...

0 commit comments

Comments
 (0)