about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-12-21 05:36:26 +0000
committerMichael Goulet <michael@errs.io>2022-12-21 06:06:46 +0000
commit0c09e2bf5afb535aa7e84bbcd8cce509a0e015b1 (patch)
tree3b868097837632d629dc782aea41dcf886c62675 /compiler/rustc_trait_selection/src
parentc8ebff6aeea5bc9242269e5f072442db62be734b (diff)
downloadrust-0c09e2bf5afb535aa7e84bbcd8cce509a0e015b1.tar.gz
rust-0c09e2bf5afb535aa7e84bbcd8cce509a0e015b1.zip
Substitute things correctly
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
index 60f67491364..1edc9357e12 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -3182,7 +3182,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
             let mut type_diffs = vec![];
 
             if let ObligationCauseCode::ExprBindingObligation(def_id, _, _, idx) = parent_code.deref()
-                && let predicates = self.tcx.predicates_of(def_id).instantiate_identity(self.tcx)
+                && let Some(node_substs) = typeck_results.node_substs_opt(call_hir_id)
+                && let predicates = self.tcx.predicates_of(def_id).instantiate(self.tcx, node_substs)
                 && let Some(pred) = predicates.predicates.get(*idx)
             {
                 if let Some(trait_pred) = pred.to_opt_poly_trait_pred()