From b745a29fa51b59642f3883bc80ca1d502532757e Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 8 Nov 2022 16:03:48 +0000 Subject: [PATCH] Remove an unused span --- compiler/rustc_hir_typeck/src/autoderef.rs | 6 +----- compiler/rustc_hir_typeck/src/method/confirm.rs | 3 +-- compiler/rustc_trait_selection/src/autoderef.rs | 10 ---------- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/autoderef.rs b/compiler/rustc_hir_typeck/src/autoderef.rs index 748237a7593..41b52a4c4a9 100644 --- a/compiler/rustc_hir_typeck/src/autoderef.rs +++ b/compiler/rustc_hir_typeck/src/autoderef.rs @@ -44,11 +44,7 @@ pub fn adjust_steps_as_infer_ok( |InferOk { value: method, obligations: o }| { obligations.extend(o); if let ty::Ref(region, _, mutbl) = *method.sig.output().kind() { - Some(OverloadedDeref { - region, - mutbl, - span: autoderef.overloaded_span(), - }) + Some(OverloadedDeref { region, mutbl, span: autoderef.span() }) } else { None } diff --git a/compiler/rustc_hir_typeck/src/method/confirm.rs b/compiler/rustc_hir_typeck/src/method/confirm.rs index a0de38ef856..d996d6ec610 100644 --- a/compiler/rustc_hir_typeck/src/method/confirm.rs +++ b/compiler/rustc_hir_typeck/src/method/confirm.rs @@ -151,8 +151,7 @@ fn adjust_self_ty( ) -> Ty<'tcx> { // Commit the autoderefs by calling `autoderef` again, but this // time writing the results into the various typeck results. - let mut autoderef = - self.autoderef(self.span, unadjusted_self_ty).with_overloaded_span(self.call_expr.span); + let mut autoderef = self.autoderef(self.call_expr.span, unadjusted_self_ty); let Some((ty, n)) = autoderef.nth(pick.autoderefs) else { return self.tcx.ty_error_with_message( rustc_span::DUMMY_SP, diff --git a/compiler/rustc_trait_selection/src/autoderef.rs b/compiler/rustc_trait_selection/src/autoderef.rs index 1a478f02df2..46ee2f35976 100644 --- a/compiler/rustc_trait_selection/src/autoderef.rs +++ b/compiler/rustc_trait_selection/src/autoderef.rs @@ -27,7 +27,6 @@ pub struct Autoderef<'a, 'tcx> { // Meta infos: infcx: &'a InferCtxt<'tcx>, span: Span, - overloaded_span: Span, body_id: hir::HirId, param_env: ty::ParamEnv<'tcx>, @@ -103,7 +102,6 @@ pub fn new( Autoderef { infcx, span, - overloaded_span: span, body_id, param_env, state: AutoderefSnapshot { @@ -118,10 +116,6 @@ pub fn new( } } - pub fn with_overloaded_span(self, overloaded_span: Span) -> Self { - Self { overloaded_span, ..self } - } - fn overloaded_deref_ty(&mut self, ty: Ty<'tcx>) -> Option> { debug!("overloaded_deref_ty({:?})", ty); @@ -196,10 +190,6 @@ pub fn span(&self) -> Span { self.span } - pub fn overloaded_span(&self) -> Span { - self.overloaded_span - } - pub fn reached_recursion_limit(&self) -> bool { self.state.reached_recursion_limit }