From 4bbe970673e8b982e2c94d17cd860c2c89ca5211 Mon Sep 17 00:00:00 2001 From: lcnr Date: Tue, 1 Feb 2022 10:29:36 +0100 Subject: [PATCH] review + rebase --- compiler/rustc_lint/src/internal.rs | 7 ++++--- compiler/rustc_passes/src/check_attr.rs | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs index 594251d46b4..fa8cbeaaf51 100644 --- a/compiler/rustc_lint/src/internal.rs +++ b/compiler/rustc_lint/src/internal.rs @@ -5,7 +5,8 @@ use rustc_ast as ast; use rustc_errors::Applicability; use rustc_hir::def::Res; -use rustc_hir::*; +use rustc_hir::{Expr, ExprKind, GenericArg, Path, PathSegment, QPath}; +use rustc_hir::{HirId, Item, ItemKind, Node, Ty, TyKind}; use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::hygiene::{ExpnKind, MacroKind}; @@ -75,10 +76,10 @@ fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { } let (span, def_id, substs) = match expr.kind { - ExprKind::MethodCall(_, span, _, _) + ExprKind::MethodCall(segment, _, _) if let Some(def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) => { - (span, def_id, cx.typeck_results().node_substs(expr.hir_id)) + (segment.ident.span, def_id, cx.typeck_results().node_substs(expr.hir_id)) }, _ => { let &ty::FnDef(def_id, substs) = diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 50d2c64ae78..ca511f7b814 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -487,7 +487,7 @@ fn check_marker(&self, hir_id: HirId, attr: &Attribute, span: Span, target: Targ fn check_rustc_must_implement_one_of( &self, attr: &Attribute, - span: &Span, + span: Span, target: Target, ) -> bool { match target { @@ -496,7 +496,7 @@ fn check_rustc_must_implement_one_of( self.tcx .sess .struct_span_err(attr.span, "attribute can only be applied to a trait") - .span_label(*span, "not a trait") + .span_label(span, "not a trait") .emit(); false }