about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-30 09:35:22 +0000
committerbors <bors@rust-lang.org>2022-07-30 09:35:22 +0000
commit110777b60c0c02a9bb62c6ffc081dc276de81210 (patch)
tree4b11b80567388b669a66d93b157bc2781abd198b /compiler/rustc_trait_selection/src
parent760d8a2cb169974971cb54302c857bfed0070f6e (diff)
parent16f49800db7be11e7255036f05ca811c1bf98926 (diff)
downloadrust-110777b60c0c02a9bb62c6ffc081dc276de81210.tar.gz
rust-110777b60c0c02a9bb62c6ffc081dc276de81210.zip
Auto merge of #99796 - compiler-errors:issue-53475, r=oli-obk
use `check_region_obligations_and_report_errors` to avoid ICEs

If we don't call `process_registered_region_obligations` before `resolve_regions_and_report_errors` then we'll ICE if we have any region obligations, and `check_region_obligations_and_report_errors` just does both of these for us in a nice convenient function.

Fixes #53475

r? types
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/coherence.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs
index fa94aa19abd..f62ccb99df5 100644
--- a/compiler/rustc_trait_selection/src/traits/coherence.rs
+++ b/compiler/rustc_trait_selection/src/traits/coherence.rs
@@ -398,13 +398,7 @@ fn resolve_negative_obligation<'cx, 'tcx>(
     let outlives_env = OutlivesEnvironment::new(param_env);
     infcx.process_registered_region_obligations(outlives_env.region_bound_pairs(), param_env);
 
-    let errors = infcx.resolve_regions(&outlives_env);
-
-    if !errors.is_empty() {
-        return false;
-    }
-
-    true
+    infcx.resolve_regions(&outlives_env).is_empty()
 }
 
 pub fn trait_ref_is_knowable<'tcx>(