review + rebase
This commit is contained in:
parent
6970547d40
commit
4bbe970673
2 changed files with 6 additions and 5 deletions
|
@ -5,7 +5,8 @@ use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext}
|
||||||
use rustc_ast as ast;
|
use rustc_ast as ast;
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use rustc_hir::def::Res;
|
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_middle::ty;
|
||||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||||
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
||||||
|
@ -75,10 +76,10 @@ impl LateLintPass<'_> for QueryStability {
|
||||||
}
|
}
|
||||||
|
|
||||||
let (span, def_id, substs) = match expr.kind {
|
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) =>
|
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) =
|
let &ty::FnDef(def_id, substs) =
|
||||||
|
|
|
@ -487,7 +487,7 @@ impl CheckAttrVisitor<'_> {
|
||||||
fn check_rustc_must_implement_one_of(
|
fn check_rustc_must_implement_one_of(
|
||||||
&self,
|
&self,
|
||||||
attr: &Attribute,
|
attr: &Attribute,
|
||||||
span: &Span,
|
span: Span,
|
||||||
target: Target,
|
target: Target,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
match target {
|
match target {
|
||||||
|
@ -496,7 +496,7 @@ impl CheckAttrVisitor<'_> {
|
||||||
self.tcx
|
self.tcx
|
||||||
.sess
|
.sess
|
||||||
.struct_span_err(attr.span, "attribute can only be applied to a trait")
|
.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();
|
.emit();
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue