Rollup merge of #100392 - nnethercote:simplify-visitors, r=cjgillot
Simplify visitors By removing some unused arguments. r? `@cjgillot`
This commit is contained in:
commit
8237efc52d
@ -168,8 +168,8 @@ fn visit_trait_ref(&mut self, t: &'ast TraitRef) {
|
||||
fn visit_param_bound(&mut self, bounds: &'ast GenericBound, _ctxt: BoundKind) {
|
||||
walk_param_bound(self, bounds)
|
||||
}
|
||||
fn visit_poly_trait_ref(&mut self, t: &'ast PolyTraitRef, m: &'ast TraitBoundModifier) {
|
||||
walk_poly_trait_ref(self, t, m)
|
||||
fn visit_poly_trait_ref(&mut self, t: &'ast PolyTraitRef) {
|
||||
walk_poly_trait_ref(self, t)
|
||||
}
|
||||
fn visit_variant_data(&mut self, s: &'ast VariantData) {
|
||||
walk_struct_def(self, s)
|
||||
@ -177,14 +177,8 @@ fn visit_variant_data(&mut self, s: &'ast VariantData) {
|
||||
fn visit_field_def(&mut self, s: &'ast FieldDef) {
|
||||
walk_field_def(self, s)
|
||||
}
|
||||
fn visit_enum_def(
|
||||
&mut self,
|
||||
enum_definition: &'ast EnumDef,
|
||||
generics: &'ast Generics,
|
||||
item_id: NodeId,
|
||||
_: Span,
|
||||
) {
|
||||
walk_enum_def(self, enum_definition, generics, item_id)
|
||||
fn visit_enum_def(&mut self, enum_definition: &'ast EnumDef) {
|
||||
walk_enum_def(self, enum_definition)
|
||||
}
|
||||
fn visit_variant(&mut self, v: &'ast Variant) {
|
||||
walk_variant(self, v)
|
||||
@ -287,11 +281,8 @@ pub fn walk_lifetime<'a, V: Visitor<'a>>(visitor: &mut V, lifetime: &'a Lifetime
|
||||
visitor.visit_ident(lifetime.ident);
|
||||
}
|
||||
|
||||
pub fn walk_poly_trait_ref<'a, V>(
|
||||
visitor: &mut V,
|
||||
trait_ref: &'a PolyTraitRef,
|
||||
_: &TraitBoundModifier,
|
||||
) where
|
||||
pub fn walk_poly_trait_ref<'a, V>(visitor: &mut V, trait_ref: &'a PolyTraitRef)
|
||||
where
|
||||
V: Visitor<'a>,
|
||||
{
|
||||
walk_list!(visitor, visit_generic_param, &trait_ref.bound_generic_params);
|
||||
@ -334,7 +325,7 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
|
||||
}
|
||||
ItemKind::Enum(ref enum_definition, ref generics) => {
|
||||
visitor.visit_generics(generics);
|
||||
visitor.visit_enum_def(enum_definition, generics, item.id, item.span)
|
||||
visitor.visit_enum_def(enum_definition)
|
||||
}
|
||||
ItemKind::Impl(box Impl {
|
||||
defaultness: _,
|
||||
@ -377,12 +368,7 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
|
||||
walk_list!(visitor, visit_attribute, &item.attrs);
|
||||
}
|
||||
|
||||
pub fn walk_enum_def<'a, V: Visitor<'a>>(
|
||||
visitor: &mut V,
|
||||
enum_definition: &'a EnumDef,
|
||||
_: &'a Generics,
|
||||
_: NodeId,
|
||||
) {
|
||||
pub fn walk_enum_def<'a, V: Visitor<'a>>(visitor: &mut V, enum_definition: &'a EnumDef) {
|
||||
walk_list!(visitor, visit_variant, &enum_definition.variants);
|
||||
}
|
||||
|
||||
@ -598,7 +584,7 @@ pub fn walk_foreign_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a ForeignI
|
||||
|
||||
pub fn walk_param_bound<'a, V: Visitor<'a>>(visitor: &mut V, bound: &'a GenericBound) {
|
||||
match *bound {
|
||||
GenericBound::Trait(ref typ, ref modifier) => visitor.visit_poly_trait_ref(typ, modifier),
|
||||
GenericBound::Trait(ref typ, ref _modifier) => visitor.visit_poly_trait_ref(typ),
|
||||
GenericBound::Outlives(ref lifetime) => {
|
||||
visitor.visit_lifetime(lifetime, LifetimeCtxt::Bound)
|
||||
}
|
||||
|
@ -295,14 +295,14 @@ fn visit_lifetime(&mut self, lifetime: &'hir Lifetime) {
|
||||
self.insert(lifetime.span, lifetime.hir_id, Node::Lifetime(lifetime));
|
||||
}
|
||||
|
||||
fn visit_variant(&mut self, v: &'hir Variant<'hir>, g: &'hir Generics<'hir>, item_id: HirId) {
|
||||
fn visit_variant(&mut self, v: &'hir Variant<'hir>) {
|
||||
self.insert(v.span, v.id, Node::Variant(v));
|
||||
self.with_parent(v.id, |this| {
|
||||
// Register the constructor of this variant.
|
||||
if let Some(ctor_hir_id) = v.data.ctor_hir_id() {
|
||||
this.insert(v.span, ctor_hir_id, Node::Ctor(&v.data));
|
||||
}
|
||||
intravisit::walk_variant(this, v, g, item_id);
|
||||
intravisit::walk_variant(this, v);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
use super::ResolverAstLoweringExt;
|
||||
use rustc_ast::visit::{self, BoundKind, LifetimeCtxt, Visitor};
|
||||
use rustc_ast::{
|
||||
FnRetTy, GenericBounds, Lifetime, NodeId, PathSegment, PolyTraitRef, TraitBoundModifier, Ty,
|
||||
TyKind,
|
||||
};
|
||||
use rustc_ast::{FnRetTy, GenericBounds, Lifetime, NodeId, PathSegment, PolyTraitRef, Ty, TyKind};
|
||||
use rustc_hir::def::LifetimeRes;
|
||||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::ResolverAstLowering;
|
||||
@ -71,10 +68,10 @@ fn visit_path_segment(&mut self, path_span: Span, path_segment: &'ast PathSegmen
|
||||
visit::walk_path_segment(self, path_span, path_segment);
|
||||
}
|
||||
|
||||
fn visit_poly_trait_ref(&mut self, t: &'ast PolyTraitRef, m: &'ast TraitBoundModifier) {
|
||||
fn visit_poly_trait_ref(&mut self, t: &'ast PolyTraitRef) {
|
||||
self.current_binders.push(t.trait_ref.ref_id);
|
||||
|
||||
visit::walk_poly_trait_ref(self, t, m);
|
||||
visit::walk_poly_trait_ref(self, t);
|
||||
|
||||
self.current_binders.pop();
|
||||
}
|
||||
|
@ -1536,25 +1536,17 @@ fn visit_param_bound(&mut self, bound: &'a GenericBound, ctxt: BoundKind) {
|
||||
visit::walk_param_bound(self, bound)
|
||||
}
|
||||
|
||||
fn visit_poly_trait_ref(&mut self, t: &'a PolyTraitRef, m: &'a TraitBoundModifier) {
|
||||
fn visit_poly_trait_ref(&mut self, t: &'a PolyTraitRef) {
|
||||
self.check_late_bound_lifetime_defs(&t.bound_generic_params);
|
||||
visit::walk_poly_trait_ref(self, t, m);
|
||||
visit::walk_poly_trait_ref(self, t);
|
||||
}
|
||||
|
||||
fn visit_variant_data(&mut self, s: &'a VariantData) {
|
||||
self.with_banned_assoc_ty_bound(|this| visit::walk_struct_def(this, s))
|
||||
}
|
||||
|
||||
fn visit_enum_def(
|
||||
&mut self,
|
||||
enum_definition: &'a EnumDef,
|
||||
generics: &'a Generics,
|
||||
item_id: NodeId,
|
||||
_: Span,
|
||||
) {
|
||||
self.with_banned_assoc_ty_bound(|this| {
|
||||
visit::walk_enum_def(this, enum_definition, generics, item_id)
|
||||
})
|
||||
fn visit_enum_def(&mut self, enum_definition: &'a EnumDef) {
|
||||
self.with_banned_assoc_ty_bound(|this| visit::walk_enum_def(this, enum_definition))
|
||||
}
|
||||
|
||||
fn visit_fn(&mut self, fk: FnKind<'a>, span: Span, id: NodeId) {
|
||||
|
@ -79,9 +79,9 @@ fn visit_param_bound(&mut self, bounds: &GenericBound, _ctxt: BoundKind) {
|
||||
self.count += 1;
|
||||
walk_param_bound(self, bounds)
|
||||
}
|
||||
fn visit_poly_trait_ref(&mut self, t: &PolyTraitRef, m: &TraitBoundModifier) {
|
||||
fn visit_poly_trait_ref(&mut self, t: &PolyTraitRef) {
|
||||
self.count += 1;
|
||||
walk_poly_trait_ref(self, t, m)
|
||||
walk_poly_trait_ref(self, t)
|
||||
}
|
||||
fn visit_variant_data(&mut self, s: &VariantData) {
|
||||
self.count += 1;
|
||||
@ -91,15 +91,9 @@ fn visit_field_def(&mut self, s: &FieldDef) {
|
||||
self.count += 1;
|
||||
walk_field_def(self, s)
|
||||
}
|
||||
fn visit_enum_def(
|
||||
&mut self,
|
||||
enum_definition: &EnumDef,
|
||||
generics: &Generics,
|
||||
item_id: NodeId,
|
||||
_: Span,
|
||||
) {
|
||||
fn visit_enum_def(&mut self, enum_definition: &EnumDef) {
|
||||
self.count += 1;
|
||||
walk_enum_def(self, enum_definition, generics, item_id)
|
||||
walk_enum_def(self, enum_definition)
|
||||
}
|
||||
fn visit_variant(&mut self, v: &Variant) {
|
||||
self.count += 1;
|
||||
|
@ -383,16 +383,12 @@ fn visit_ty(&mut self, ty: &'a ast::Ty) {
|
||||
}
|
||||
|
||||
// Place bound generic params on a stack, to extract them when a type is encountered.
|
||||
fn visit_poly_trait_ref(
|
||||
&mut self,
|
||||
trait_ref: &'a ast::PolyTraitRef,
|
||||
modifier: &'a ast::TraitBoundModifier,
|
||||
) {
|
||||
fn visit_poly_trait_ref(&mut self, trait_ref: &'a ast::PolyTraitRef) {
|
||||
let stack_len = self.bound_generic_params_stack.len();
|
||||
self.bound_generic_params_stack
|
||||
.extend(trait_ref.bound_generic_params.clone().into_iter());
|
||||
|
||||
visit::walk_poly_trait_ref(self, trait_ref, modifier);
|
||||
visit::walk_poly_trait_ref(self, trait_ref);
|
||||
|
||||
self.bound_generic_params_stack.truncate(stack_len);
|
||||
}
|
||||
|
@ -385,30 +385,17 @@ fn visit_param_bound(&mut self, bounds: &'v GenericBound<'v>) {
|
||||
fn visit_poly_trait_ref(&mut self, t: &'v PolyTraitRef<'v>, m: TraitBoundModifier) {
|
||||
walk_poly_trait_ref(self, t, m)
|
||||
}
|
||||
fn visit_variant_data(
|
||||
&mut self,
|
||||
s: &'v VariantData<'v>,
|
||||
_: Symbol,
|
||||
_: &'v Generics<'v>,
|
||||
_parent_id: HirId,
|
||||
_: Span,
|
||||
) {
|
||||
fn visit_variant_data(&mut self, s: &'v VariantData<'v>) {
|
||||
walk_struct_def(self, s)
|
||||
}
|
||||
fn visit_field_def(&mut self, s: &'v FieldDef<'v>) {
|
||||
walk_field_def(self, s)
|
||||
}
|
||||
fn visit_enum_def(
|
||||
&mut self,
|
||||
enum_definition: &'v EnumDef<'v>,
|
||||
generics: &'v Generics<'v>,
|
||||
item_id: HirId,
|
||||
_: Span,
|
||||
) {
|
||||
walk_enum_def(self, enum_definition, generics, item_id)
|
||||
fn visit_enum_def(&mut self, enum_definition: &'v EnumDef<'v>, item_id: HirId) {
|
||||
walk_enum_def(self, enum_definition, item_id)
|
||||
}
|
||||
fn visit_variant(&mut self, v: &'v Variant<'v>, g: &'v Generics<'v>, item_id: HirId) {
|
||||
walk_variant(self, v, g, item_id)
|
||||
fn visit_variant(&mut self, v: &'v Variant<'v>) {
|
||||
walk_variant(self, v)
|
||||
}
|
||||
fn visit_label(&mut self, label: &'v Label) {
|
||||
walk_label(self, label)
|
||||
@ -572,7 +559,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
|
||||
ItemKind::Enum(ref enum_definition, ref generics) => {
|
||||
visitor.visit_generics(generics);
|
||||
// `visit_enum_def()` takes care of visiting the `Item`'s `HirId`.
|
||||
visitor.visit_enum_def(enum_definition, generics, item.hir_id(), item.span)
|
||||
visitor.visit_enum_def(enum_definition, item.hir_id())
|
||||
}
|
||||
ItemKind::Impl(Impl {
|
||||
unsafety: _,
|
||||
@ -595,13 +582,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
|
||||
| ItemKind::Union(ref struct_definition, ref generics) => {
|
||||
visitor.visit_generics(generics);
|
||||
visitor.visit_id(item.hir_id());
|
||||
visitor.visit_variant_data(
|
||||
struct_definition,
|
||||
item.ident.name,
|
||||
generics,
|
||||
item.hir_id(),
|
||||
item.span,
|
||||
);
|
||||
visitor.visit_variant_data(struct_definition);
|
||||
}
|
||||
ItemKind::Trait(.., ref generics, bounds, trait_item_refs) => {
|
||||
visitor.visit_id(item.hir_id());
|
||||
@ -649,28 +630,16 @@ pub fn walk_use<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v Path<'v>, hir_id:
|
||||
pub fn walk_enum_def<'v, V: Visitor<'v>>(
|
||||
visitor: &mut V,
|
||||
enum_definition: &'v EnumDef<'v>,
|
||||
generics: &'v Generics<'v>,
|
||||
item_id: HirId,
|
||||
) {
|
||||
visitor.visit_id(item_id);
|
||||
walk_list!(visitor, visit_variant, enum_definition.variants, generics, item_id);
|
||||
walk_list!(visitor, visit_variant, enum_definition.variants);
|
||||
}
|
||||
|
||||
pub fn walk_variant<'v, V: Visitor<'v>>(
|
||||
visitor: &mut V,
|
||||
variant: &'v Variant<'v>,
|
||||
generics: &'v Generics<'v>,
|
||||
parent_item_id: HirId,
|
||||
) {
|
||||
pub fn walk_variant<'v, V: Visitor<'v>>(visitor: &mut V, variant: &'v Variant<'v>) {
|
||||
visitor.visit_ident(variant.ident);
|
||||
visitor.visit_id(variant.id);
|
||||
visitor.visit_variant_data(
|
||||
&variant.data,
|
||||
variant.ident.name,
|
||||
generics,
|
||||
parent_item_id,
|
||||
variant.span,
|
||||
);
|
||||
visitor.visit_variant_data(&variant.data);
|
||||
walk_list!(visitor, visit_anon_const, &variant.disr_expr);
|
||||
}
|
||||
|
||||
|
@ -233,9 +233,9 @@ fn visit_where_predicate(&mut self, p: &'a ast::WherePredicate) {
|
||||
ast_visit::walk_where_predicate(self, p);
|
||||
}
|
||||
|
||||
fn visit_poly_trait_ref(&mut self, t: &'a ast::PolyTraitRef, m: &'a ast::TraitBoundModifier) {
|
||||
run_early_pass!(self, check_poly_trait_ref, t, m);
|
||||
ast_visit::walk_poly_trait_ref(self, t, m);
|
||||
fn visit_poly_trait_ref(&mut self, t: &'a ast::PolyTraitRef) {
|
||||
run_early_pass!(self, check_poly_trait_ref, t);
|
||||
ast_visit::walk_poly_trait_ref(self, t);
|
||||
}
|
||||
|
||||
fn visit_assoc_item(&mut self, item: &'a ast::AssocItem, ctxt: ast_visit::AssocCtxt) {
|
||||
|
@ -24,7 +24,6 @@
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_session::lint::LintPass;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::any::Any;
|
||||
@ -194,14 +193,7 @@ fn visit_fn(
|
||||
self.context.cached_typeck_results.set(old_cached_typeck_results);
|
||||
}
|
||||
|
||||
fn visit_variant_data(
|
||||
&mut self,
|
||||
s: &'tcx hir::VariantData<'tcx>,
|
||||
_: Symbol,
|
||||
_: &'tcx hir::Generics<'tcx>,
|
||||
_: hir::HirId,
|
||||
_: Span,
|
||||
) {
|
||||
fn visit_variant_data(&mut self, s: &'tcx hir::VariantData<'tcx>) {
|
||||
lint_callback!(self, check_struct_def, s);
|
||||
hir_visit::walk_struct_def(self, s);
|
||||
}
|
||||
@ -213,15 +205,10 @@ fn visit_field_def(&mut self, s: &'tcx hir::FieldDef<'tcx>) {
|
||||
})
|
||||
}
|
||||
|
||||
fn visit_variant(
|
||||
&mut self,
|
||||
v: &'tcx hir::Variant<'tcx>,
|
||||
g: &'tcx hir::Generics<'tcx>,
|
||||
item_id: hir::HirId,
|
||||
) {
|
||||
fn visit_variant(&mut self, v: &'tcx hir::Variant<'tcx>) {
|
||||
self.with_lint_attrs(v.id, |cx| {
|
||||
lint_callback!(cx, check_variant, v);
|
||||
hir_visit::walk_variant(cx, v, g, item_id);
|
||||
hir_visit::walk_variant(cx, v);
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -772,14 +772,9 @@ fn visit_field_def(&mut self, s: &'tcx hir::FieldDef<'tcx>) {
|
||||
})
|
||||
}
|
||||
|
||||
fn visit_variant(
|
||||
&mut self,
|
||||
v: &'tcx hir::Variant<'tcx>,
|
||||
g: &'tcx hir::Generics<'tcx>,
|
||||
item_id: hir::HirId,
|
||||
) {
|
||||
fn visit_variant(&mut self, v: &'tcx hir::Variant<'tcx>) {
|
||||
self.with_lint_attrs(v.id, |builder| {
|
||||
intravisit::walk_variant(builder, v, g, item_id);
|
||||
intravisit::walk_variant(builder, v);
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -156,8 +156,7 @@ macro_rules! early_lint_methods {
|
||||
fn check_generic_arg(a: &ast::GenericArg);
|
||||
fn check_generic_param(a: &ast::GenericParam);
|
||||
fn check_generics(a: &ast::Generics);
|
||||
fn check_poly_trait_ref(a: &ast::PolyTraitRef,
|
||||
b: &ast::TraitBoundModifier);
|
||||
fn check_poly_trait_ref(a: &ast::PolyTraitRef);
|
||||
fn check_fn(a: rustc_ast::visit::FnKind<'_>, c: Span, d_: ast::NodeId);
|
||||
fn check_trait_item(a: &ast::AssocItem);
|
||||
fn check_impl_item(a: &ast::AssocItem);
|
||||
|
@ -29,7 +29,6 @@
|
||||
use rustc_middle::mir::{traversal, Body, ConstQualifs, MirPass, MirPhase, Promoted};
|
||||
use rustc_middle::ty::query::Providers;
|
||||
use rustc_middle::ty::{self, TyCtxt, TypeVisitable};
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
#[macro_use]
|
||||
mod pass_manager;
|
||||
@ -159,14 +158,7 @@ struct GatherCtors<'a, 'tcx> {
|
||||
set: &'a mut FxIndexSet<LocalDefId>,
|
||||
}
|
||||
impl<'tcx> Visitor<'tcx> for GatherCtors<'_, 'tcx> {
|
||||
fn visit_variant_data(
|
||||
&mut self,
|
||||
v: &'tcx hir::VariantData<'tcx>,
|
||||
_: Symbol,
|
||||
_: &'tcx hir::Generics<'tcx>,
|
||||
_: hir::HirId,
|
||||
_: Span,
|
||||
) {
|
||||
fn visit_variant_data(&mut self, v: &'tcx hir::VariantData<'tcx>) {
|
||||
if let hir::VariantData::Tuple(_, hir_id) = *v {
|
||||
self.set.insert(self.tcx.hir().local_def_id(hir_id));
|
||||
}
|
||||
|
@ -2066,14 +2066,9 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) {
|
||||
intravisit::walk_expr(self, expr)
|
||||
}
|
||||
|
||||
fn visit_variant(
|
||||
&mut self,
|
||||
variant: &'tcx hir::Variant<'tcx>,
|
||||
generics: &'tcx hir::Generics<'tcx>,
|
||||
item_id: HirId,
|
||||
) {
|
||||
fn visit_variant(&mut self, variant: &'tcx hir::Variant<'tcx>) {
|
||||
self.check_attributes(variant.id, variant.span, Target::Variant, None);
|
||||
intravisit::walk_variant(self, variant, generics, item_id)
|
||||
intravisit::walk_variant(self, variant)
|
||||
}
|
||||
|
||||
fn visit_param(&mut self, param: &'tcx hir::Param<'tcx>) {
|
||||
|
@ -368,14 +368,7 @@ fn visit_nested_body(&mut self, body: hir::BodyId) {
|
||||
self.maybe_typeck_results = old_maybe_typeck_results;
|
||||
}
|
||||
|
||||
fn visit_variant_data(
|
||||
&mut self,
|
||||
def: &'tcx hir::VariantData<'tcx>,
|
||||
_: Symbol,
|
||||
_: &hir::Generics<'_>,
|
||||
_: hir::HirId,
|
||||
_: rustc_span::Span,
|
||||
) {
|
||||
fn visit_variant_data(&mut self, def: &'tcx hir::VariantData<'tcx>) {
|
||||
let tcx = self.tcx;
|
||||
let has_repr_c = self.repr_has_repr_c;
|
||||
let has_repr_simd = self.repr_has_repr_simd;
|
||||
|
@ -276,14 +276,9 @@ fn visit_field_def(&mut self, s: &'v hir::FieldDef<'v>) {
|
||||
hir_visit::walk_field_def(self, s)
|
||||
}
|
||||
|
||||
fn visit_variant(
|
||||
&mut self,
|
||||
v: &'v hir::Variant<'v>,
|
||||
g: &'v hir::Generics<'v>,
|
||||
item_id: hir::HirId,
|
||||
) {
|
||||
fn visit_variant(&mut self, v: &'v hir::Variant<'v>) {
|
||||
self.record("Variant", Id::None, v);
|
||||
hir_visit::walk_variant(self, v, g, item_id)
|
||||
hir_visit::walk_variant(self, v)
|
||||
}
|
||||
|
||||
fn visit_lifetime(&mut self, lifetime: &'v hir::Lifetime) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
|
||||
use rustc_hir::hir_id::CRATE_HIR_ID;
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_hir::{FieldDef, Generics, HirId, Item, ItemKind, TraitRef, Ty, TyKind, Variant};
|
||||
use rustc_hir::{FieldDef, Item, ItemKind, TraitRef, Ty, TyKind, Variant};
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::middle::privacy::AccessLevels;
|
||||
use rustc_middle::middle::stability::{AllowUnstable, DeprecationEntry, Index};
|
||||
@ -442,7 +442,7 @@ fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem<'tcx>) {
|
||||
);
|
||||
}
|
||||
|
||||
fn visit_variant(&mut self, var: &'tcx Variant<'tcx>, g: &'tcx Generics<'tcx>, item_id: HirId) {
|
||||
fn visit_variant(&mut self, var: &'tcx Variant<'tcx>) {
|
||||
self.annotate(
|
||||
self.tcx.hir().local_def_id(var.id),
|
||||
var.span,
|
||||
@ -465,7 +465,7 @@ fn visit_variant(&mut self, var: &'tcx Variant<'tcx>, g: &'tcx Generics<'tcx>, i
|
||||
);
|
||||
}
|
||||
|
||||
intravisit::walk_variant(v, var, g, item_id)
|
||||
intravisit::walk_variant(v, var)
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -598,9 +598,9 @@ fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem<'tcx>) {
|
||||
intravisit::walk_impl_item(self, ii);
|
||||
}
|
||||
|
||||
fn visit_variant(&mut self, var: &'tcx Variant<'tcx>, g: &'tcx Generics<'tcx>, item_id: HirId) {
|
||||
fn visit_variant(&mut self, var: &'tcx Variant<'tcx>) {
|
||||
self.check_missing_stability(self.tcx.hir().local_def_id(var.id), var.span);
|
||||
intravisit::walk_variant(self, var, g, item_id);
|
||||
intravisit::walk_variant(self, var);
|
||||
}
|
||||
|
||||
fn visit_field_def(&mut self, s: &'tcx FieldDef<'tcx>) {
|
||||
|
@ -1625,15 +1625,10 @@ fn visit_ty(&mut self, t: &'tcx hir::Ty<'tcx>) {
|
||||
intravisit::walk_ty(self, t)
|
||||
}
|
||||
|
||||
fn visit_variant(
|
||||
&mut self,
|
||||
v: &'tcx hir::Variant<'tcx>,
|
||||
g: &'tcx hir::Generics<'tcx>,
|
||||
item_id: hir::HirId,
|
||||
) {
|
||||
fn visit_variant(&mut self, v: &'tcx hir::Variant<'tcx>) {
|
||||
if self.access_levels.is_reachable(self.tcx.hir().local_def_id(v.id)) {
|
||||
self.in_variant = true;
|
||||
intravisit::walk_variant(self, v, g, item_id);
|
||||
intravisit::walk_variant(self, v);
|
||||
self.in_variant = false;
|
||||
}
|
||||
}
|
||||
|
@ -723,7 +723,7 @@ fn visit_ty(&mut self, ty: &'ast Ty) {
|
||||
self.diagnostic_metadata.current_trait_object = prev;
|
||||
self.diagnostic_metadata.current_type_path = prev_ty;
|
||||
}
|
||||
fn visit_poly_trait_ref(&mut self, tref: &'ast PolyTraitRef, _: &'ast TraitBoundModifier) {
|
||||
fn visit_poly_trait_ref(&mut self, tref: &'ast PolyTraitRef) {
|
||||
let span = tref.span.shrink_to_lo().to(tref.trait_ref.path.span.shrink_to_lo());
|
||||
self.with_generic_param_rib(
|
||||
&tref.bound_generic_params,
|
||||
|
@ -1289,14 +1289,9 @@ fn visit_foreign_item(&mut self, item: &'hir hir::ForeignItem<'_>) {
|
||||
});
|
||||
}
|
||||
|
||||
fn visit_variant(
|
||||
&mut self,
|
||||
v: &'hir hir::Variant<'_>,
|
||||
g: &'hir hir::Generics<'_>,
|
||||
item_id: hir::HirId,
|
||||
) {
|
||||
fn visit_variant(&mut self, v: &'hir hir::Variant<'_>) {
|
||||
self.visit_testable(v.ident.to_string(), v.id, v.span, |this| {
|
||||
intravisit::walk_variant(this, v, g, item_id);
|
||||
intravisit::walk_variant(this, v);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_poly_trait_ref(&mut self, cx: &EarlyContext<'_>, poly: &ast::PolyTraitRef, _: &ast::TraitBoundModifier) {
|
||||
fn check_poly_trait_ref(&mut self, cx: &EarlyContext<'_>, poly: &ast::PolyTraitRef) {
|
||||
let segments = &poly.trait_ref.path.segments;
|
||||
|
||||
if_chain! {
|
||||
|
Loading…
Reference in New Issue
Block a user