about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-08-02 01:31:48 +0000
committerMichael Goulet <michael@errs.io>2023-08-03 20:05:40 +0000
commitf848fd3ae3ffcd10628b95dbc1c1aad435e4c590 (patch)
tree31db5bf649a7b5d5bccce5bf963cb415e40511be /compiler/rustc_trait_selection/src/solve
parenteaf8af5de8ade694784ca621fa0886aca2e46eaa (diff)
downloadrust-f848fd3ae3ffcd10628b95dbc1c1aad435e4c590.tar.gz
rust-f848fd3ae3ffcd10628b95dbc1c1aad435e4c590.zip
Remove trivial region constraints
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve')
-rw-r--r--compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs
index 84ca555a5de..0a54b1c6433 100644
--- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs
+++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs
@@ -94,8 +94,13 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
         let var_values = self.var_values;
         let external_constraints = self.compute_external_query_constraints()?;
 
-        let (var_values, external_constraints) =
+        let (var_values, mut external_constraints) =
             (var_values, external_constraints).fold_with(&mut EagerResolver { infcx: self.infcx });
+        // Remove any trivial region constraints once we've resolved regions
+        external_constraints
+            .region_constraints
+            .outlives
+            .retain(|(outlives, _)| outlives.0.as_region().map_or(true, |re| re != outlives.1));
 
         let canonical = Canonicalizer::canonicalize(
             self.infcx,