From d0409ead2f44306fd54b12ed0ac83a4f5ee44910 Mon Sep 17 00:00:00 2001 From: marmeladema Date: Mon, 13 Apr 2020 17:57:39 +0100 Subject: [PATCH] Remove usage of `DUMMY_HIR_ID` in `FnCtxt::get_conversion_methods` --- src/librustc_typeck/check/demand.rs | 10 +++------- src/librustc_typeck/check/mod.rs | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 369bb183bcd7..781d25099fd3 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -217,14 +217,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { span: Span, expected: Ty<'tcx>, checked_ty: Ty<'tcx>, + hir_id: hir::HirId, ) -> Vec { - let mut methods = self.probe_for_return_type( - span, - probe::Mode::MethodCall, - expected, - checked_ty, - hir::DUMMY_HIR_ID, - ); + let mut methods = + self.probe_for_return_type(span, probe::Mode::MethodCall, expected, checked_ty, hir_id); methods.retain(|m| { self.has_no_input_arg(m) && self diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 4b5953b5e958..5857ccf58971 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -5000,7 +5000,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else if !self.check_for_cast(err, expr, found, expected) { let is_struct_pat_shorthand_field = self.is_hir_id_from_struct_pattern_shorthand_field(expr.hir_id, expr.span); - let methods = self.get_conversion_methods(expr.span, expected, found); + let methods = self.get_conversion_methods(expr.span, expected, found, expr.hir_id); if let Ok(expr_text) = self.sess().source_map().span_to_snippet(expr.span) { let mut suggestions = iter::repeat(&expr_text) .zip(methods.iter())