about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-01-08 02:40:59 +0000
committerMichael Goulet <michael@errs.io>2023-01-08 18:50:08 +0000
commitca554efaf78962f9dc9599663b29626269c69c8c (patch)
tree3958b41c6b13ed4740a484744b29b24a9b05d358 /compiler/rustc_trait_selection/src
parentfa51fc01ca3d654d08d627b1d1482d1b77e5ed8b (diff)
downloadrust-ca554efaf78962f9dc9599663b29626269c69c8c.tar.gz
rust-ca554efaf78962f9dc9599663b29626269c69c8c.zip
Improve spans of non-WF implied bound types
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/engine.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/engine.rs b/compiler/rustc_trait_selection/src/traits/engine.rs
index bc6d9d4b922..72ed3aa499d 100644
--- a/compiler/rustc_trait_selection/src/traits/engine.rs
+++ b/compiler/rustc_trait_selection/src/traits/engine.rs
@@ -191,8 +191,8 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
         let assumed_wf_types = tcx.assumed_wf_types(def_id);
         let mut implied_bounds = FxIndexSet::default();
         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 {
+        for &(ty, ty_span) in assumed_wf_types {
+            let span = if ty_span.is_dummy() { span } else { ty_span };
             // FIXME(@lcnr): rustc currently does not check wf for types
             // pre-normalization, meaning that implied bounds are sometimes
             // incorrect. See #100910 for more details.
@@ -205,7 +205,7 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
             // sound and then uncomment this line again.
 
             // implied_bounds.insert(ty);
-            let normalized = self.normalize(&cause, param_env, ty);
+            let normalized = self.normalize(&ObligationCause::misc(span, hir_id), param_env, ty);
             implied_bounds.insert(normalized);
         }
         implied_bounds