about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/astconv/errors.rs
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2023-02-17 18:42:08 +0100
committerLeón Orell Valerian Liehr <me@fmease.dev>2023-02-19 18:35:34 +0100
commitcc65ebd0d29a79a2a1d3fd77e679c763837b33c4 (patch)
treefdfb71b3c2aeb3e2949c2ee6e4a18c5ba2513832 /compiler/rustc_hir_analysis/src/astconv/errors.rs
parentaa7edf70739528746d55915b96c63bd3ec43f3a7 (diff)
downloadrust-cc65ebd0d29a79a2a1d3fd77e679c763837b33c4.tar.gz
rust-cc65ebd0d29a79a2a1d3fd77e679c763837b33c4.zip
Make use of ObligationCtxt
Diffstat (limited to 'compiler/rustc_hir_analysis/src/astconv/errors.rs')
-rw-r--r--compiler/rustc_hir_analysis/src/astconv/errors.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_hir_analysis/src/astconv/errors.rs b/compiler/rustc_hir_analysis/src/astconv/errors.rs
index 191f4f0f910..0e9f5fb3dae 100644
--- a/compiler/rustc_hir_analysis/src/astconv/errors.rs
+++ b/compiler/rustc_hir_analysis/src/astconv/errors.rs
@@ -4,6 +4,7 @@ use rustc_data_structures::fx::FxHashMap;
 use rustc_errors::{pluralize, struct_span_err, Applicability, Diagnostic, ErrorGuaranteed};
 use rustc_hir as hir;
 use rustc_hir::def_id::DefId;
+use rustc_infer::traits::FulfillmentError;
 use rustc_middle::ty::{self, Ty};
 use rustc_session::parse::feature_err;
 use rustc_span::lev_distance::find_best_match_for_name;
@@ -226,8 +227,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
         &self,
         name: Ident,
         self_ty: Ty<'tcx>,
-        candidates: &[DefId],
-        unsatisfied_predicates: Vec<ty::Predicate<'tcx>>,
+        candidates: Vec<(DefId, (DefId, DefId))>,
+        fulfillment_errors: Vec<FulfillmentError<'tcx>>,
         span: Span,
     ) -> ErrorGuaranteed {
         let tcx = self.tcx();
@@ -245,16 +246,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
             }
         };
 
-        if unsatisfied_predicates.is_empty() {
+        if fulfillment_errors.is_empty() {
             // FIXME(fmease): Copied from `rustc_hir_typeck::method::probe`. Deduplicate.
 
             let limit = if candidates.len() == 5 { 5 } else { 4 };
             let type_candidates = candidates
                 .iter()
                 .take(limit)
-                .map(|candidate| {
-                    format!("- `{}`", tcx.at(span).type_of(candidate).subst_identity())
-                })
+                .map(|&(impl_, _)| format!("- `{}`", tcx.at(span).type_of(impl_).subst_identity()))
                 .collect::<Vec<_>>()
                 .join("\n");
             let additional_types = if candidates.len() > limit {
@@ -348,8 +347,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
 
         // FIXME(fmease): `rustc_hir_typeck::method::suggest` uses a `skip_list` to filter out some bounds.
         // I would do the same here if it didn't mean more code duplication.
-        let mut bounds: Vec<_> = unsatisfied_predicates
+        let mut bounds: Vec<_> = fulfillment_errors
             .into_iter()
+            .map(|error| error.root_obligation.predicate)
             .filter_map(format_pred)
             .map(|(p, _)| format!("`{}`", p))
             .collect();