about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-27 11:37:06 +0000
committerbors <bors@rust-lang.org>2022-08-27 11:37:06 +0000
commit3b3f3b72c5f6ebee82a0530ae40284926bb193b3 (patch)
tree3cc3a2e0432b755cfd283f58ba91fed07af21827 /compiler/rustc_trait_selection/src/traits
parent4065b89b1e7287047d7d6c65e7abd7b8ee70bcf0 (diff)
parentef7bda3b62b7d6821acb4603e2c72b7120b02059 (diff)
downloadrust-3b3f3b72c5f6ebee82a0530ae40284926bb193b3.tar.gz
rust-3b3f3b72c5f6ebee82a0530ae40284926bb193b3.zip
Auto merge of #100989 - lcnr:implied-bounds-uwu, r=spastorino
no unnormalized types for implied bounds outside borrowck

fixes #100910 - introduced in https://github.com/rust-lang/rust/pull/100676 - by only considering normalized types for wf.

r? types
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits')
-rw-r--r--compiler/rustc_trait_selection/src/traits/engine.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/engine.rs b/compiler/rustc_trait_selection/src/traits/engine.rs
index 136b9432145..72533a42d80 100644
--- a/compiler/rustc_trait_selection/src/traits/engine.rs
+++ b/compiler/rustc_trait_selection/src/traits/engine.rs
@@ -124,7 +124,18 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
         let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
         let cause = ObligationCause::misc(span, hir_id);
         for ty in assumed_wf_types {
-            implied_bounds.insert(ty);
+            // FIXME(@lcnr): rustc currently does not check wf for types
+            // pre-normalization, meaning that implied bounds are sometimes
+            // incorrect. See #100910 for more details.
+            //
+            // Not adding the unnormalized types here mostly fixes that, except
+            // that there are projections which are still ambiguous in the item definition
+            // but do normalize successfully when using the item, see #98543.
+            //
+            // Anyways, I will hopefully soon change implied bounds to make all of this
+            // sound and then uncomment this line again.
+
+            // implied_bounds.insert(ty);
             let normalized = self.normalize(cause.clone(), param_env, ty);
             implied_bounds.insert(normalized);
         }