Reformat using the new identifier sorting from rustfmt
This commit is contained in:
parent
1173204b36
commit
c682aa162b
1455 changed files with 7152 additions and 8384 deletions
|
@ -8,16 +8,16 @@ use std::cell::Cell;
|
|||
use std::collections::hash_map::Entry;
|
||||
|
||||
use rustc_ast::{
|
||||
ast, AttrKind, AttrStyle, Attribute, LitKind, MetaItemKind, MetaItemLit, NestedMetaItem,
|
||||
AttrKind, AttrStyle, Attribute, LitKind, MetaItemKind, MetaItemLit, NestedMetaItem, ast,
|
||||
};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::{Applicability, DiagCtxtHandle, IntoDiagArg, MultiSpan, StashKey};
|
||||
use rustc_feature::{AttributeDuplicates, AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
|
||||
use rustc_feature::{AttributeDuplicates, AttributeType, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute};
|
||||
use rustc_hir::def_id::LocalModDefId;
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_hir::{
|
||||
self as hir, self, FnSig, ForeignItem, HirId, Item, ItemKind, MethodKind, Safety, Target,
|
||||
TraitItem, CRATE_HIR_ID, CRATE_OWNER_ID,
|
||||
self as hir, self, CRATE_HIR_ID, CRATE_OWNER_ID, FnSig, ForeignItem, HirId, Item, ItemKind,
|
||||
MethodKind, Safety, Target, TraitItem,
|
||||
};
|
||||
use rustc_macros::LintDiagnostic;
|
||||
use rustc_middle::hir::nested_filter;
|
||||
|
@ -32,8 +32,8 @@ use rustc_session::lint::builtin::{
|
|||
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES, UNUSED_ATTRIBUTES,
|
||||
};
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::{BytePos, Span, DUMMY_SP};
|
||||
use rustc_span::symbol::{Symbol, kw, sym};
|
||||
use rustc_span::{BytePos, DUMMY_SP, Span};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
|
||||
use rustc_trait_selection::infer::{TyCtxtInferExt, ValuePairs};
|
||||
|
@ -344,12 +344,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
}
|
||||
|
||||
fn inline_attr_str_error_without_macro_def(&self, hir_id: HirId, attr: &Attribute, sym: &str) {
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
errors::IgnoredAttr { sym },
|
||||
);
|
||||
self.tcx
|
||||
.emit_node_span_lint(UNUSED_ATTRIBUTES, hir_id, attr.span, errors::IgnoredAttr { sym });
|
||||
}
|
||||
|
||||
/// Checks if `#[diagnostic::do_not_recommend]` is applied on a trait impl.
|
||||
|
@ -1396,12 +1392,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
_ => {
|
||||
// FIXME: #[cold] was previously allowed on non-functions and some crates used
|
||||
// this, so only emit a warning.
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
errors::Cold { span, on_crate: hir_id == CRATE_HIR_ID },
|
||||
);
|
||||
self.tcx.emit_node_span_lint(UNUSED_ATTRIBUTES, hir_id, attr.span, errors::Cold {
|
||||
span,
|
||||
on_crate: hir_id == CRATE_HIR_ID,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1416,12 +1410,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
return;
|
||||
}
|
||||
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
errors::Link { span: (target != Target::ForeignMod).then_some(span) },
|
||||
);
|
||||
self.tcx.emit_node_span_lint(UNUSED_ATTRIBUTES, hir_id, attr.span, errors::Link {
|
||||
span: (target != Target::ForeignMod).then_some(span),
|
||||
});
|
||||
}
|
||||
|
||||
/// Checks if `#[link_name]` is applied to an item other than a foreign function or static.
|
||||
|
@ -2210,12 +2201,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
return;
|
||||
};
|
||||
|
||||
self.tcx.emit_node_span_lint(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
attr.span,
|
||||
errors::Unused { attr_span: attr.span, note },
|
||||
);
|
||||
self.tcx.emit_node_span_lint(UNUSED_ATTRIBUTES, hir_id, attr.span, errors::Unused {
|
||||
attr_span: attr.span,
|
||||
note,
|
||||
});
|
||||
}
|
||||
|
||||
/// A best effort attempt to create an error for a mismatching proc macro signature.
|
||||
|
|
|
@ -14,7 +14,7 @@ use rustc_middle::query::Providers;
|
|||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::{sym, Span, Symbol};
|
||||
use rustc_span::{Span, Symbol, sym};
|
||||
use {rustc_attr as attr, rustc_hir as hir};
|
||||
|
||||
use crate::errors::SkippingConstChecks;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
use std::mem;
|
||||
|
||||
use hir::def_id::{LocalDefIdMap, LocalDefIdSet};
|
||||
use hir::ItemKind;
|
||||
use hir::def_id::{LocalDefIdMap, LocalDefIdSet};
|
||||
use rustc_data_structures::unord::UnordSet;
|
||||
use rustc_errors::MultiSpan;
|
||||
use rustc_hir as hir;
|
||||
|
@ -21,7 +21,7 @@ use rustc_middle::ty::{self, TyCtxt};
|
|||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_session::lint;
|
||||
use rustc_session::lint::builtin::DEAD_CODE;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{Symbol, sym};
|
||||
use rustc_target::abi::FieldIdx;
|
||||
|
||||
use crate::errors::{
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
//! * Compiler internal types like `Ty` and `TyCtxt`
|
||||
|
||||
use rustc_ast as ast;
|
||||
use rustc_hir::diagnostic_items::DiagnosticItems;
|
||||
use rustc_hir::OwnerId;
|
||||
use rustc_hir::diagnostic_items::DiagnosticItems;
|
||||
use rustc_middle::query::{LocalCrate, Providers};
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{Symbol, sym};
|
||||
|
||||
use crate::errors::DuplicateDiagnosticItemInCrate;
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@ use rustc_ast::attr;
|
|||
use rustc_ast::entry::EntryPointType;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID, LOCAL_CRATE};
|
||||
use rustc_hir::{ItemId, Node, CRATE_HIR_ID};
|
||||
use rustc_hir::def_id::{CRATE_DEF_ID, DefId, LOCAL_CRATE, LocalDefId};
|
||||
use rustc_hir::{CRATE_HIR_ID, ItemId, Node};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::config::{sigpipe, CrateType, EntryFnType, RemapPathScopeComponents};
|
||||
use rustc_session::RemapFileNameExt;
|
||||
use rustc_session::config::{CrateType, EntryFnType, RemapPathScopeComponents, sigpipe};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use rustc_errors::{
|
|||
use rustc_hir::{self as hir, ExprKind, Target};
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
use rustc_middle::ty::{MainDefinition, Ty};
|
||||
use rustc_span::{Span, Symbol, DUMMY_SP};
|
||||
use rustc_span::{DUMMY_SP, Span, Symbol};
|
||||
|
||||
use crate::check_attr::ProcMacroKind;
|
||||
use crate::fluent_generated as fluent;
|
||||
|
@ -1337,15 +1337,11 @@ pub(crate) struct DuplicateLangItem {
|
|||
impl<G: EmissionGuarantee> Diagnostic<'_, G> for DuplicateLangItem {
|
||||
#[track_caller]
|
||||
fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
|
||||
let mut diag = Diag::new(
|
||||
dcx,
|
||||
level,
|
||||
match self.duplicate {
|
||||
Duplicate::Plain => fluent::passes_duplicate_lang_item,
|
||||
Duplicate::Crate => fluent::passes_duplicate_lang_item_crate,
|
||||
Duplicate::CrateDepends => fluent::passes_duplicate_lang_item_crate_depends,
|
||||
},
|
||||
);
|
||||
let mut diag = Diag::new(dcx, level, match self.duplicate {
|
||||
Duplicate::Plain => fluent::passes_duplicate_lang_item,
|
||||
Duplicate::Crate => fluent::passes_duplicate_lang_item_crate,
|
||||
Duplicate::CrateDepends => fluent::passes_duplicate_lang_item_crate_depends,
|
||||
});
|
||||
diag.code(E0152);
|
||||
diag.arg("lang_item_name", self.lang_item_name);
|
||||
diag.arg("crate_name", self.crate_name);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::{intravisit, HirId, ItemLocalId};
|
||||
use rustc_hir::{HirId, ItemLocalId, intravisit};
|
||||
use rustc_index::bit_set::GrowableBitSet;
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
// completely accurate (some things might be counted twice, others missed).
|
||||
|
||||
use rustc_ast::visit::BoundKind;
|
||||
use rustc_ast::{self as ast, visit as ast_visit, AttrId, NodeId};
|
||||
use rustc_ast::{self as ast, AttrId, NodeId, visit as ast_visit};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::{intravisit as hir_visit, HirId};
|
||||
use rustc_hir::{HirId, intravisit as hir_visit};
|
||||
use rustc_middle::hir::map::Map;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_middle::util::common::to_readable_str;
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||
enum Id {
|
||||
|
@ -219,28 +219,25 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
|||
}
|
||||
|
||||
fn visit_item(&mut self, i: &'v hir::Item<'v>) {
|
||||
record_variants!(
|
||||
(self, i, i.kind, Id::Node(i.hir_id()), hir, Item, ItemKind),
|
||||
[
|
||||
ExternCrate,
|
||||
Use,
|
||||
Static,
|
||||
Const,
|
||||
Fn,
|
||||
Macro,
|
||||
Mod,
|
||||
ForeignMod,
|
||||
GlobalAsm,
|
||||
TyAlias,
|
||||
OpaqueTy,
|
||||
Enum,
|
||||
Struct,
|
||||
Union,
|
||||
Trait,
|
||||
TraitAlias,
|
||||
Impl
|
||||
]
|
||||
);
|
||||
record_variants!((self, i, i.kind, Id::Node(i.hir_id()), hir, Item, ItemKind), [
|
||||
ExternCrate,
|
||||
Use,
|
||||
Static,
|
||||
Const,
|
||||
Fn,
|
||||
Macro,
|
||||
Mod,
|
||||
ForeignMod,
|
||||
GlobalAsm,
|
||||
TyAlias,
|
||||
OpaqueTy,
|
||||
Enum,
|
||||
Struct,
|
||||
Union,
|
||||
Trait,
|
||||
TraitAlias,
|
||||
Impl
|
||||
]);
|
||||
hir_visit::walk_item(self, i)
|
||||
}
|
||||
|
||||
|
@ -273,10 +270,9 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
|||
}
|
||||
|
||||
fn visit_stmt(&mut self, s: &'v hir::Stmt<'v>) {
|
||||
record_variants!(
|
||||
(self, s, s.kind, Id::Node(s.hir_id), hir, Stmt, StmtKind),
|
||||
[Let, Item, Expr, Semi]
|
||||
);
|
||||
record_variants!((self, s, s.kind, Id::Node(s.hir_id), hir, Stmt, StmtKind), [
|
||||
Let, Item, Expr, Semi
|
||||
]);
|
||||
hir_visit::walk_stmt(self, s)
|
||||
}
|
||||
|
||||
|
@ -286,26 +282,23 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
|||
}
|
||||
|
||||
fn visit_pat(&mut self, p: &'v hir::Pat<'v>) {
|
||||
record_variants!(
|
||||
(self, p, p.kind, Id::Node(p.hir_id), hir, Pat, PatKind),
|
||||
[
|
||||
Wild,
|
||||
Binding,
|
||||
Struct,
|
||||
TupleStruct,
|
||||
Or,
|
||||
Never,
|
||||
Path,
|
||||
Tuple,
|
||||
Box,
|
||||
Deref,
|
||||
Ref,
|
||||
Lit,
|
||||
Range,
|
||||
Slice,
|
||||
Err
|
||||
]
|
||||
);
|
||||
record_variants!((self, p, p.kind, Id::Node(p.hir_id), hir, Pat, PatKind), [
|
||||
Wild,
|
||||
Binding,
|
||||
Struct,
|
||||
TupleStruct,
|
||||
Or,
|
||||
Never,
|
||||
Path,
|
||||
Tuple,
|
||||
Box,
|
||||
Deref,
|
||||
Ref,
|
||||
Lit,
|
||||
Range,
|
||||
Slice,
|
||||
Err
|
||||
]);
|
||||
hir_visit::walk_pat(self, p)
|
||||
}
|
||||
|
||||
|
@ -315,15 +308,11 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
|||
}
|
||||
|
||||
fn visit_expr(&mut self, e: &'v hir::Expr<'v>) {
|
||||
record_variants!(
|
||||
(self, e, e.kind, Id::Node(e.hir_id), hir, Expr, ExprKind),
|
||||
[
|
||||
ConstBlock, Array, Call, MethodCall, Tup, Binary, Unary, Lit, Cast, Type,
|
||||
DropTemps, Let, If, Loop, Match, Closure, Block, Assign, AssignOp, Field, Index,
|
||||
Path, AddrOf, Break, Continue, Ret, Become, InlineAsm, OffsetOf, Struct, Repeat,
|
||||
Yield, Err
|
||||
]
|
||||
);
|
||||
record_variants!((self, e, e.kind, Id::Node(e.hir_id), hir, Expr, ExprKind), [
|
||||
ConstBlock, Array, Call, MethodCall, Tup, Binary, Unary, Lit, Cast, Type, DropTemps,
|
||||
Let, If, Loop, Match, Closure, Block, Assign, AssignOp, Field, Index, Path, AddrOf,
|
||||
Break, Continue, Ret, Become, InlineAsm, OffsetOf, Struct, Repeat, Yield, Err
|
||||
]);
|
||||
hir_visit::walk_expr(self, e)
|
||||
}
|
||||
|
||||
|
@ -333,27 +322,24 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
|||
}
|
||||
|
||||
fn visit_ty(&mut self, t: &'v hir::Ty<'v>) {
|
||||
record_variants!(
|
||||
(self, t, t.kind, Id::Node(t.hir_id), hir, Ty, TyKind),
|
||||
[
|
||||
InferDelegation,
|
||||
Slice,
|
||||
Array,
|
||||
Ptr,
|
||||
Ref,
|
||||
BareFn,
|
||||
Never,
|
||||
Tup,
|
||||
AnonAdt,
|
||||
Path,
|
||||
OpaqueDef,
|
||||
TraitObject,
|
||||
Typeof,
|
||||
Infer,
|
||||
Pat,
|
||||
Err
|
||||
]
|
||||
);
|
||||
record_variants!((self, t, t.kind, Id::Node(t.hir_id), hir, Ty, TyKind), [
|
||||
InferDelegation,
|
||||
Slice,
|
||||
Array,
|
||||
Ptr,
|
||||
Ref,
|
||||
BareFn,
|
||||
Never,
|
||||
Tup,
|
||||
AnonAdt,
|
||||
Path,
|
||||
OpaqueDef,
|
||||
TraitObject,
|
||||
Typeof,
|
||||
Infer,
|
||||
Pat,
|
||||
Err
|
||||
]);
|
||||
hir_visit::walk_ty(self, t)
|
||||
}
|
||||
|
||||
|
@ -368,10 +354,11 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
|||
}
|
||||
|
||||
fn visit_where_predicate(&mut self, p: &'v hir::WherePredicate<'v>) {
|
||||
record_variants!(
|
||||
(self, p, p, Id::None, hir, WherePredicate, WherePredicate),
|
||||
[BoundPredicate, RegionPredicate, EqPredicate]
|
||||
);
|
||||
record_variants!((self, p, p, Id::None, hir, WherePredicate, WherePredicate), [
|
||||
BoundPredicate,
|
||||
RegionPredicate,
|
||||
EqPredicate
|
||||
]);
|
||||
hir_visit::walk_where_predicate(self, p)
|
||||
}
|
||||
|
||||
|
@ -425,10 +412,9 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
|||
}
|
||||
|
||||
fn visit_param_bound(&mut self, b: &'v hir::GenericBound<'v>) {
|
||||
record_variants!(
|
||||
(self, b, b, Id::None, hir, GenericBound, GenericBound),
|
||||
[Trait, Outlives, Use]
|
||||
);
|
||||
record_variants!((self, b, b, Id::None, hir, GenericBound, GenericBound), [
|
||||
Trait, Outlives, Use
|
||||
]);
|
||||
hir_visit::walk_param_bound(self, b)
|
||||
}
|
||||
|
||||
|
@ -443,10 +429,9 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
|||
}
|
||||
|
||||
fn visit_generic_arg(&mut self, ga: &'v hir::GenericArg<'v>) {
|
||||
record_variants!(
|
||||
(self, ga, ga, Id::Node(ga.hir_id()), hir, GenericArg, GenericArg),
|
||||
[Lifetime, Type, Const, Infer]
|
||||
);
|
||||
record_variants!((self, ga, ga, Id::Node(ga.hir_id()), hir, GenericArg, GenericArg), [
|
||||
Lifetime, Type, Const, Infer
|
||||
]);
|
||||
match ga {
|
||||
hir::GenericArg::Lifetime(lt) => self.visit_lifetime(lt),
|
||||
hir::GenericArg::Type(ty) => self.visit_ty(ty),
|
||||
|
@ -492,38 +477,34 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
|||
|
||||
impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
|
||||
fn visit_foreign_item(&mut self, i: &'v ast::ForeignItem) {
|
||||
record_variants!(
|
||||
(self, i, i.kind, Id::None, ast, ForeignItem, ForeignItemKind),
|
||||
[Static, Fn, TyAlias, MacCall]
|
||||
);
|
||||
record_variants!((self, i, i.kind, Id::None, ast, ForeignItem, ForeignItemKind), [
|
||||
Static, Fn, TyAlias, MacCall
|
||||
]);
|
||||
ast_visit::walk_item(self, i)
|
||||
}
|
||||
|
||||
fn visit_item(&mut self, i: &'v ast::Item) {
|
||||
record_variants!(
|
||||
(self, i, i.kind, Id::None, ast, Item, ItemKind),
|
||||
[
|
||||
ExternCrate,
|
||||
Use,
|
||||
Static,
|
||||
Const,
|
||||
Fn,
|
||||
Mod,
|
||||
ForeignMod,
|
||||
GlobalAsm,
|
||||
TyAlias,
|
||||
Enum,
|
||||
Struct,
|
||||
Union,
|
||||
Trait,
|
||||
TraitAlias,
|
||||
Impl,
|
||||
MacCall,
|
||||
MacroDef,
|
||||
Delegation,
|
||||
DelegationMac
|
||||
]
|
||||
);
|
||||
record_variants!((self, i, i.kind, Id::None, ast, Item, ItemKind), [
|
||||
ExternCrate,
|
||||
Use,
|
||||
Static,
|
||||
Const,
|
||||
Fn,
|
||||
Mod,
|
||||
ForeignMod,
|
||||
GlobalAsm,
|
||||
TyAlias,
|
||||
Enum,
|
||||
Struct,
|
||||
Union,
|
||||
Trait,
|
||||
TraitAlias,
|
||||
Impl,
|
||||
MacCall,
|
||||
MacroDef,
|
||||
Delegation,
|
||||
DelegationMac
|
||||
]);
|
||||
ast_visit::walk_item(self, i)
|
||||
}
|
||||
|
||||
|
@ -538,10 +519,9 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
|
|||
}
|
||||
|
||||
fn visit_stmt(&mut self, s: &'v ast::Stmt) {
|
||||
record_variants!(
|
||||
(self, s, s.kind, Id::None, ast, Stmt, StmtKind),
|
||||
[Let, Item, Expr, Semi, Empty, MacCall]
|
||||
);
|
||||
record_variants!((self, s, s.kind, Id::None, ast, Stmt, StmtKind), [
|
||||
Let, Item, Expr, Semi, Empty, MacCall
|
||||
]);
|
||||
ast_visit::walk_stmt(self, s)
|
||||
}
|
||||
|
||||
|
@ -556,29 +536,26 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
|
|||
}
|
||||
|
||||
fn visit_pat(&mut self, p: &'v ast::Pat) {
|
||||
record_variants!(
|
||||
(self, p, p.kind, Id::None, ast, Pat, PatKind),
|
||||
[
|
||||
Wild,
|
||||
Ident,
|
||||
Struct,
|
||||
TupleStruct,
|
||||
Or,
|
||||
Path,
|
||||
Tuple,
|
||||
Box,
|
||||
Deref,
|
||||
Ref,
|
||||
Lit,
|
||||
Range,
|
||||
Slice,
|
||||
Rest,
|
||||
Never,
|
||||
Paren,
|
||||
MacCall,
|
||||
Err
|
||||
]
|
||||
);
|
||||
record_variants!((self, p, p.kind, Id::None, ast, Pat, PatKind), [
|
||||
Wild,
|
||||
Ident,
|
||||
Struct,
|
||||
TupleStruct,
|
||||
Or,
|
||||
Path,
|
||||
Tuple,
|
||||
Box,
|
||||
Deref,
|
||||
Ref,
|
||||
Lit,
|
||||
Range,
|
||||
Slice,
|
||||
Rest,
|
||||
Never,
|
||||
Paren,
|
||||
MacCall,
|
||||
Err
|
||||
]);
|
||||
ast_visit::walk_pat(self, p)
|
||||
}
|
||||
|
||||
|
@ -598,32 +575,29 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
|
|||
}
|
||||
|
||||
fn visit_ty(&mut self, t: &'v ast::Ty) {
|
||||
record_variants!(
|
||||
(self, t, t.kind, Id::None, ast, Ty, TyKind),
|
||||
[
|
||||
Slice,
|
||||
Array,
|
||||
Ptr,
|
||||
Ref,
|
||||
BareFn,
|
||||
Never,
|
||||
Tup,
|
||||
AnonStruct,
|
||||
AnonUnion,
|
||||
Path,
|
||||
Pat,
|
||||
TraitObject,
|
||||
ImplTrait,
|
||||
Paren,
|
||||
Typeof,
|
||||
Infer,
|
||||
ImplicitSelf,
|
||||
MacCall,
|
||||
CVarArgs,
|
||||
Dummy,
|
||||
Err
|
||||
]
|
||||
);
|
||||
record_variants!((self, t, t.kind, Id::None, ast, Ty, TyKind), [
|
||||
Slice,
|
||||
Array,
|
||||
Ptr,
|
||||
Ref,
|
||||
BareFn,
|
||||
Never,
|
||||
Tup,
|
||||
AnonStruct,
|
||||
AnonUnion,
|
||||
Path,
|
||||
Pat,
|
||||
TraitObject,
|
||||
ImplTrait,
|
||||
Paren,
|
||||
Typeof,
|
||||
Infer,
|
||||
ImplicitSelf,
|
||||
MacCall,
|
||||
CVarArgs,
|
||||
Dummy,
|
||||
Err
|
||||
]);
|
||||
|
||||
ast_visit::walk_ty(self, t)
|
||||
}
|
||||
|
@ -634,10 +608,11 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
|
|||
}
|
||||
|
||||
fn visit_where_predicate(&mut self, p: &'v ast::WherePredicate) {
|
||||
record_variants!(
|
||||
(self, p, p, Id::None, ast, WherePredicate, WherePredicate),
|
||||
[BoundPredicate, RegionPredicate, EqPredicate]
|
||||
);
|
||||
record_variants!((self, p, p, Id::None, ast, WherePredicate, WherePredicate), [
|
||||
BoundPredicate,
|
||||
RegionPredicate,
|
||||
EqPredicate
|
||||
]);
|
||||
ast_visit::walk_where_predicate(self, p)
|
||||
}
|
||||
|
||||
|
@ -647,18 +622,21 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
|
|||
}
|
||||
|
||||
fn visit_assoc_item(&mut self, i: &'v ast::AssocItem, ctxt: ast_visit::AssocCtxt) {
|
||||
record_variants!(
|
||||
(self, i, i.kind, Id::None, ast, AssocItem, AssocItemKind),
|
||||
[Const, Fn, Type, MacCall, Delegation, DelegationMac]
|
||||
);
|
||||
record_variants!((self, i, i.kind, Id::None, ast, AssocItem, AssocItemKind), [
|
||||
Const,
|
||||
Fn,
|
||||
Type,
|
||||
MacCall,
|
||||
Delegation,
|
||||
DelegationMac
|
||||
]);
|
||||
ast_visit::walk_assoc_item(self, i, ctxt);
|
||||
}
|
||||
|
||||
fn visit_param_bound(&mut self, b: &'v ast::GenericBound, _ctxt: BoundKind) {
|
||||
record_variants!(
|
||||
(self, b, b, Id::None, ast, GenericBound, GenericBound),
|
||||
[Trait, Outlives, Use]
|
||||
);
|
||||
record_variants!((self, b, b, Id::None, ast, GenericBound, GenericBound), [
|
||||
Trait, Outlives, Use
|
||||
]);
|
||||
ast_visit::walk_param_bound(self, b)
|
||||
}
|
||||
|
||||
|
@ -691,18 +669,18 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
|
|||
// common, so we implement `visit_generic_args` and tolerate the double
|
||||
// counting in the former case.
|
||||
fn visit_generic_args(&mut self, g: &'v ast::GenericArgs) {
|
||||
record_variants!(
|
||||
(self, g, g, Id::None, ast, GenericArgs, GenericArgs),
|
||||
[AngleBracketed, Parenthesized, ParenthesizedElided]
|
||||
);
|
||||
record_variants!((self, g, g, Id::None, ast, GenericArgs, GenericArgs), [
|
||||
AngleBracketed,
|
||||
Parenthesized,
|
||||
ParenthesizedElided
|
||||
]);
|
||||
ast_visit::walk_generic_args(self, g)
|
||||
}
|
||||
|
||||
fn visit_attribute(&mut self, attr: &'v ast::Attribute) {
|
||||
record_variants!(
|
||||
(self, attr, attr.kind, Id::None, ast, Attribute, AttrKind),
|
||||
[Normal, DocComment]
|
||||
);
|
||||
record_variants!((self, attr, attr.kind, Id::None, ast, Attribute, AttrKind), [
|
||||
Normal, DocComment
|
||||
]);
|
||||
ast_visit::walk_attribute(self, attr)
|
||||
}
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@ use rustc_ast as ast;
|
|||
use rustc_ast::visit;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::lang_items::{extract, GenericRequirement};
|
||||
use rustc_hir::lang_items::{GenericRequirement, extract};
|
||||
use rustc_hir::{LangItem, LanguageItems, MethodKind, Target};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
|
||||
use rustc_session::cstore::ExternCrate;
|
||||
use rustc_span::symbol::kw::Empty;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::kw::Empty;
|
||||
|
||||
use crate::errors::{
|
||||
DuplicateLangItem, IncorrectTarget, LangItemOnIncorrectTarget, UnknownLangItem,
|
||||
|
|
|
@ -4,9 +4,9 @@ use rustc_hir::def_id::LocalDefId;
|
|||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::layout::{HasParamEnv, HasTyCtxt, LayoutError, LayoutOfHelpers};
|
||||
use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::{HasDataLayout, TargetDataLayout};
|
||||
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
|
||||
use rustc_trait_selection::infer::TyCtxtInferExt;
|
||||
|
|
|
@ -12,7 +12,7 @@ use rustc_middle::middle::lib_features::{FeatureStability, LibFeatures};
|
|||
use rustc_middle::query::{LocalCrate, Providers};
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{sym, Span};
|
||||
use rustc_span::{Span, sym};
|
||||
|
||||
use crate::errors::{FeaturePreviouslyDeclared, FeatureStableTwice};
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ use rustc_middle::query::Providers;
|
|||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::{self, RootVariableMinCaptureList, Ty, TyCtxt};
|
||||
use rustc_session::lint;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{Symbol, kw, sym};
|
||||
use rustc_span::{BytePos, Span};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::collections::BTreeMap;
|
||||
use std::fmt;
|
||||
|
||||
use Context::*;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{LocalDefId, LocalModDefId};
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
|
@ -11,7 +12,6 @@ use rustc_middle::span_bug;
|
|||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::hygiene::DesugaringKind;
|
||||
use rustc_span::{BytePos, Span};
|
||||
use Context::*;
|
||||
|
||||
use crate::errors::{
|
||||
BreakInsideClosure, BreakInsideCoroutine, BreakNonLoop, ContinueLabeledBlock, OutsideLoop,
|
||||
|
|
|
@ -10,8 +10,8 @@ use rustc_middle::hir::nested_filter::OnlyBodies;
|
|||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::lint::builtin::UNDEFINED_NAKED_FUNCTION_ABI;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use crate::errors::{
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
use hir::def_id::LocalDefIdSet;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::Node;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_hir::Node;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
|
||||
use rustc_middle::middle::privacy::{self, Level};
|
||||
|
|
|
@ -12,7 +12,7 @@ use rustc_data_structures::fx::FxIndexMap;
|
|||
use rustc_data_structures::unord::{ExtendUnord, UnordMap, UnordSet};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::{LocalDefId, LocalModDefId, CRATE_DEF_ID, LOCAL_CRATE};
|
||||
use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId, LocalModDefId};
|
||||
use rustc_hir::hir_id::CRATE_HIR_ID;
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_hir::{FieldDef, Item, ItemKind, TraitRef, Ty, TyKind, Variant};
|
||||
|
@ -24,8 +24,8 @@ use rustc_middle::query::Providers;
|
|||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::lint;
|
||||
use rustc_session::lint::builtin::{INEFFECTIVE_UNSTABLE_TRAIT_IMPL, USELESS_DEPRECATED};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Symbol, sym};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use tracing::{debug, info};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue