about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-12-20 09:46:13 +0100
committerGitHub <noreply@github.com>2023-12-20 09:46:13 +0100
commitd6656af16a47d7bd8b76d3b39da265c3587d8a12 (patch)
treeaa1224c39ab8de952792c9e90f4c4f0f32fb8354
parent905879181375b0aeaf3ad1215519d85cc7ed1828 (diff)
parentdf5b604945276994ad662bd0fd34face0ad609eb (diff)
downloadrust-d6656af16a47d7bd8b76d3b39da265c3587d8a12.tar.gz
rust-d6656af16a47d7bd8b76d3b39da265c3587d8a12.zip
Rollup merge of #119107 - lcnr:uwuwu, r=compiler-errors
subtype_predicate: remove unnecessary probe

There is no reason to probe here. The failure either results in an actual type error, in which cases the probe is useless, or it is used inside of evaluate, in which case we're already inside of the `fn evaluation_probe`, so it is also not necessary.
-rw-r--r--compiler/rustc_infer/src/infer/mod.rs15
1 files changed, 3 insertions, 12 deletions
diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs
index 3de269da22d..e092bbbfdd6 100644
--- a/compiler/rustc_infer/src/infer/mod.rs
+++ b/compiler/rustc_infer/src/infer/mod.rs
@@ -713,10 +713,6 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
 }
 
 impl<'tcx, T> InferOk<'tcx, T> {
-    pub fn unit(self) -> InferOk<'tcx, ()> {
-        InferOk { value: (), obligations: self.obligations }
-    }
-
     /// Extracts `value`, registering any obligations into `fulfill_cx`.
     pub fn into_value_registering_obligations(
         self,
@@ -1025,15 +1021,10 @@ impl<'tcx> InferCtxt<'tcx> {
             _ => {}
         }
 
-        Ok(self.commit_if_ok(|_snapshot| {
-            let ty::SubtypePredicate { a_is_expected, a, b } =
-                self.instantiate_binder_with_placeholders(predicate);
-
-            let ok =
-                self.at(cause, param_env).sub_exp(DefineOpaqueTypes::No, a_is_expected, a, b)?;
+        let ty::SubtypePredicate { a_is_expected, a, b } =
+            self.instantiate_binder_with_placeholders(predicate);
 
-            Ok(ok.unit())
-        }))
+        Ok(self.at(cause, param_env).sub_exp(DefineOpaqueTypes::No, a_is_expected, a, b))
     }
 
     pub fn region_outlives_predicate(