about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2024-02-29 05:25:28 -0500
committerGitHub <noreply@github.com>2024-02-29 05:25:28 -0500
commit23351388d094e6f0280ca2bc9a63f98ce50ca2e7 (patch)
tree379d80710ff2319b5a5975fd3ac33c2fcc7dd9e6 /compiler/rustc_trait_selection/src
parent69716291c365cfa59f3ca3fcbd4c81fa837dfe80 (diff)
parent75e15f7cf4e55ed9572781930ee8babcaa256a47 (diff)
downloadrust-23351388d094e6f0280ca2bc9a63f98ce50ca2e7.tar.gz
rust-23351388d094e6f0280ca2bc9a63f98ce50ca2e7.zip
Rollup merge of #121745 - compiler-errors:refining-impl-trait-deeply-norm, r=lcnr
Deeply normalize obligations in `refining_impl_trait`

We somewhat awkwardly use semantic comparison when checking the `refining_impl_trait` lint. This relies on us being able to normalize bounds eagerly to avoid cases where an unnormalized alias is not considered equal to a normalized alias. Since `normalize` in the new solver is a noop, let's use `deeply_normalize` instead.

r? lcnr

cc ``@tmandry,`` this should fix your bug lol
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/engine.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/engine.rs b/compiler/rustc_trait_selection/src/traits/engine.rs
index 1aaadf6cf04..e789e9c2b6e 100644
--- a/compiler/rustc_trait_selection/src/traits/engine.rs
+++ b/compiler/rustc_trait_selection/src/traits/engine.rs
@@ -107,6 +107,15 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
         self.register_infer_ok_obligations(infer_ok)
     }
 
+    pub fn deeply_normalize<T: TypeFoldable<TyCtxt<'tcx>>>(
+        &self,
+        cause: &ObligationCause<'tcx>,
+        param_env: ty::ParamEnv<'tcx>,
+        value: T,
+    ) -> Result<T, Vec<FulfillmentError<'tcx>>> {
+        self.infcx.at(cause, param_env).deeply_normalize(value, &mut **self.engine.borrow_mut())
+    }
+
     /// Makes `expected <: actual`.
     pub fn eq_exp<T>(
         &self,