Use Arena inside hir::Item.

This commit is contained in:
Camille GILLOT 2019-11-28 19:28:50 +01:00
parent 4dc79f1f7d
commit 084e6722f9
60 changed files with 208 additions and 198 deletions

View File

@ -125,7 +125,12 @@ macro_rules! arena_types {
// HIR nodes arenas
[few] hir_forest: rustc::hir::map::Forest<$tcx>,
[] attribute: syntax::ast::Attribute,
[] global_asm: rustc::hir::GlobalAsm,
[] impl_item_ref: rustc::hir::ImplItemRef,
[] macro_def: rustc::hir::MacroDef,
[] path: rustc::hir::Path,
[] trait_item_ref: rustc::hir::TraitItemRef,
[] ty: rustc::hir::Ty,
], $tcx);
)
}

View File

@ -86,7 +86,7 @@ impl Display for Target {
}
impl Target {
pub(crate) fn from_item(item: &Item) -> Target {
pub(crate) fn from_item(item: &Item<'_>) -> Target {
match item.kind {
ItemKind::ExternCrate(..) => Target::ExternCrate,
ItemKind::Use(..) => Target::Use,
@ -161,7 +161,7 @@ impl CheckAttrVisitor<'tcx> {
attrs: &HirVec<Attribute>,
span: &Span,
target: Target,
item: Option<&Item>,
item: Option<&Item<'_>>,
) {
let mut is_valid = true;
for attr in attrs {
@ -335,7 +335,7 @@ impl CheckAttrVisitor<'tcx> {
attrs: &HirVec<Attribute>,
span: &Span,
target: Target,
item: Option<&Item>,
item: Option<&Item<'_>>,
) {
// Extract the names of all repr hints, e.g., [foo, bar, align] for:
// ```
@ -492,7 +492,7 @@ impl Visitor<'tcx> for CheckAttrVisitor<'tcx> {
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
}
fn visit_item(&mut self, item: &'tcx Item) {
fn visit_item(&mut self, item: &'tcx Item<'tcx>) {
let target = Target::from_item(item);
self.check_attributes(item.hir_id, &item.attrs, &item.span, target, Some(item));
intravisit::walk_item(self, item)
@ -527,7 +527,7 @@ impl Visitor<'tcx> for CheckAttrVisitor<'tcx> {
}
}
fn is_c_like_enum(item: &Item) -> bool {
fn is_c_like_enum(item: &Item<'_>) -> bool {
if let ItemKind::Enum(ref def, _) = item.kind {
for variant in &def.variants {
match variant.data {

View File

@ -218,7 +218,7 @@ pub trait Visitor<'v>: Sized {
/// Visits the top-level item and (optionally) nested items / impl items. See
/// `visit_nested_item` for details.
fn visit_item(&mut self, i: &'v Item) {
fn visit_item(&mut self, i: &'v Item<'v>) {
walk_item(self, i)
}
@ -462,7 +462,7 @@ pub fn walk_param<'v, V: Visitor<'v>>(visitor: &mut V, param: &'v Param) {
walk_list!(visitor, visit_attribute, &param.attrs);
}
pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
visitor.visit_vis(&item.vis);
visitor.visit_ident(item.ident);
match item.kind {
@ -527,7 +527,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
ref generics,
ref opt_trait_reference,
ref typ,
ref impl_item_refs
impl_item_refs
) => {
visitor.visit_id(item.hir_id);
visitor.visit_generics(generics);
@ -542,7 +542,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
visitor.visit_variant_data(struct_definition, item.ident.name, generics, item.hir_id,
item.span);
}
ItemKind::Trait(.., ref generics, ref bounds, ref trait_item_refs) => {
ItemKind::Trait(.., ref generics, ref bounds, trait_item_refs) => {
visitor.visit_id(item.hir_id);
visitor.visit_generics(generics);
walk_list!(visitor, visit_param_bound, bounds);

View File

@ -45,7 +45,7 @@ use super::intravisit::Visitor;
/// existing `fn visit_nested` methods to see where changes are
/// needed.
pub trait ItemLikeVisitor<'hir> {
fn visit_item(&mut self, item: &'hir Item);
fn visit_item(&mut self, item: &'hir Item<'hir>);
fn visit_trait_item(&mut self, trait_item: &'hir TraitItem);
fn visit_impl_item(&mut self, impl_item: &'hir ImplItem);
}
@ -65,7 +65,7 @@ impl<'v, 'hir, V> DeepVisitor<'v, V>
impl<'v, 'hir, V> ItemLikeVisitor<'hir> for DeepVisitor<'v, V>
where V: Visitor<'hir>
{
fn visit_item(&mut self, item: &'hir Item) {
fn visit_item(&mut self, item: &'hir Item<'hir>) {
self.visitor.visit_item(item);
}
@ -80,7 +80,7 @@ impl<'v, 'hir, V> ItemLikeVisitor<'hir> for DeepVisitor<'v, V>
/// A parallel variant of `ItemLikeVisitor`.
pub trait ParItemLikeVisitor<'hir> {
fn visit_item(&self, item: &'hir Item);
fn visit_item(&self, item: &'hir Item<'hir>);
fn visit_trait_item(&self, trait_item: &'hir TraitItem);
fn visit_impl_item(&self, impl_item: &'hir ImplItem);
}
@ -95,7 +95,7 @@ pub struct ParDeepVisitor<V>(pub V);
impl<'hir, V> ParItemLikeVisitor<'hir> for ParDeepVisitor<V>
where V: IntoVisitor<'hir>
{
fn visit_item(&self, item: &'hir Item) {
fn visit_item(&self, item: &'hir Item<'hir>) {
self.0.into_visitor().visit_item(item);
}

View File

@ -95,7 +95,7 @@ pub struct LoweringContext<'a, 'hir: 'a> {
arena: &'hir Arena<'hir>,
/// The items being lowered are collected here.
items: BTreeMap<hir::HirId, hir::Item>,
items: BTreeMap<hir::HirId, hir::Item<'hir>>,
trait_items: BTreeMap<hir::TraitItemId, hir::TraitItem>,
impl_items: BTreeMap<hir::ImplItemId, hir::ImplItem>,
@ -566,7 +566,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
}
}
fn insert_item(&mut self, item: hir::Item) {
fn insert_item(&mut self, item: hir::Item<'hir>) {
let id = item.hir_id;
// FIXME: Use `debug_asset-rt`.
assert_eq!(id.local_id, hir::ItemLocalId::from_u32(0));
@ -873,7 +873,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
// for them.
fn with_in_scope_lifetime_defs<T, F>(&mut self, params: &[GenericParam], f: F) -> T
where
F: FnOnce(&mut LoweringContext<'_, '_>) -> T,
F: FnOnce(&mut LoweringContext<'_, 'hir>) -> T,
{
let old_len = self.in_scope_lifetimes.len();
let lt_def_names = params.iter().filter_map(|param| match param.kind {

View File

@ -107,7 +107,7 @@ impl<'a, 'lowering, 'hir> Visitor<'a> for ItemLowerer<'a, 'lowering, 'hir> {
}
}
impl LoweringContext<'_, '_> {
impl LoweringContext<'_, 'hir> {
// Same as the method above, but accepts `hir::GenericParam`s
// instead of `ast::GenericParam`s.
// This should only be used with generics that have already had their
@ -225,7 +225,7 @@ impl LoweringContext<'_, '_> {
}
}
pub fn lower_item(&mut self, i: &Item) -> Option<hir::Item> {
pub fn lower_item(&mut self, i: &Item) -> Option<hir::Item<'hir>> {
let mut ident = i.ident;
let mut vis = self.lower_visibility(&i.vis, None);
let attrs = self.lower_attrs(&i.attrs);
@ -269,7 +269,7 @@ impl LoweringContext<'_, '_> {
attrs: &hir::HirVec<Attribute>,
vis: &mut hir::Visibility,
i: &ItemKind,
) -> hir::ItemKind {
) -> hir::ItemKind<'hir> {
match *i {
ItemKind::ExternCrate(orig_name) => hir::ItemKind::ExternCrate(orig_name),
ItemKind::Use(ref use_tree) => {
@ -282,29 +282,31 @@ impl LoweringContext<'_, '_> {
self.lower_use_tree(use_tree, &prefix, id, vis, ident, attrs)
}
ItemKind::Static(ref t, m, ref e) => {
let ty = self.lower_ty(
t,
if self.sess.features_untracked().impl_trait_in_bindings {
ImplTraitContext::OpaqueTy(None)
} else {
ImplTraitContext::Disallowed(ImplTraitPosition::Binding)
}
);
hir::ItemKind::Static(
self.lower_ty(
t,
if self.sess.features_untracked().impl_trait_in_bindings {
ImplTraitContext::OpaqueTy(None)
} else {
ImplTraitContext::Disallowed(ImplTraitPosition::Binding)
}
),
self.arena.alloc(ty.into_inner()),
m,
self.lower_const_body(span, Some(e)),
)
}
ItemKind::Const(ref t, ref e) => {
let ty = self.lower_ty(
t,
if self.sess.features_untracked().impl_trait_in_bindings {
ImplTraitContext::OpaqueTy(None)
} else {
ImplTraitContext::Disallowed(ImplTraitPosition::Binding)
}
);
hir::ItemKind::Const(
self.lower_ty(
t,
if self.sess.features_untracked().impl_trait_in_bindings {
ImplTraitContext::OpaqueTy(None)
} else {
ImplTraitContext::Disallowed(ImplTraitPosition::Binding)
}
),
self.arena.alloc(ty.into_inner()),
self.lower_const_body(span, Some(e))
)
}
@ -346,7 +348,7 @@ impl LoweringContext<'_, '_> {
None => {
let ty = self.lower_ty(ty, ImplTraitContext::disallowed());
let generics = self.lower_generics(generics, ImplTraitContext::disallowed());
hir::ItemKind::TyAlias(ty, generics)
hir::ItemKind::TyAlias(self.arena.alloc(ty.into_inner()), generics)
},
Some(bounds) => {
let ty = hir::OpaqueTy {
@ -434,10 +436,11 @@ impl LoweringContext<'_, '_> {
let new_impl_items = self.with_in_scope_lifetime_defs(
&ast_generics.params,
|this| {
impl_items
.iter()
.map(|item| this.lower_impl_item_ref(item))
.collect()
this.arena.alloc_from_iter(
impl_items
.iter()
.map(|item| this.lower_impl_item_ref(item))
)
},
);
@ -447,16 +450,16 @@ impl LoweringContext<'_, '_> {
self.lower_defaultness(defaultness, true /* [1] */),
generics,
trait_ref,
lowered_ty,
self.arena.alloc(lowered_ty.into_inner()),
new_impl_items,
)
}
ItemKind::Trait(is_auto, unsafety, ref generics, ref bounds, ref items) => {
let bounds = self.lower_param_bounds(bounds, ImplTraitContext::disallowed());
let items = items
let items = self.arena.alloc_from_iter(items
.iter()
.map(|item| self.lower_trait_item_ref(item))
.collect();
);
hir::ItemKind::Trait(
is_auto,
unsafety,
@ -485,7 +488,7 @@ impl LoweringContext<'_, '_> {
vis: &mut hir::Visibility,
ident: &mut Ident,
attrs: &hir::HirVec<Attribute>,
) -> hir::ItemKind {
) -> hir::ItemKind<'hir> {
debug!("lower_use_tree(tree={:?})", tree);
debug!("lower_use_tree: vis = {:?}", vis);
@ -540,7 +543,7 @@ impl LoweringContext<'_, '_> {
let res = this.lower_res(res);
let path =
this.lower_path_extra(res, &path, ParamMode::Explicit, None);
let kind = hir::ItemKind::Use(P(path), hir::UseKind::Single);
let kind = hir::ItemKind::Use(this.arena.alloc(path), hir::UseKind::Single);
let vis = this.rebuild_vis(&vis);
this.insert_item(
@ -556,11 +559,11 @@ impl LoweringContext<'_, '_> {
});
}
let path = P(self.lower_path_extra(ret_res, &path, ParamMode::Explicit, None));
let path = self.arena.alloc(self.lower_path_extra(ret_res, &path, ParamMode::Explicit, None));
hir::ItemKind::Use(path, hir::UseKind::Single)
}
UseTreeKind::Glob => {
let path = P(self.lower_path(
let path = self.arena.alloc(self.lower_path(
id,
&Path {
segments,
@ -663,7 +666,7 @@ impl LoweringContext<'_, '_> {
let res = self.expect_full_res_from_use(id).next().unwrap_or(Res::Err);
let res = self.lower_res(res);
let path = P(self.lower_path_extra(res, &prefix, ParamMode::Explicit, None));
let path = self.arena.alloc(self.lower_path_extra(res, &prefix, ParamMode::Explicit, None));
hir::ItemKind::Use(path, hir::UseKind::ListStem)
}
}
@ -748,8 +751,8 @@ impl LoweringContext<'_, '_> {
}
}
fn lower_global_asm(&mut self, ga: &GlobalAsm) -> P<hir::GlobalAsm> {
P(hir::GlobalAsm { asm: ga.asm })
fn lower_global_asm(&mut self, ga: &GlobalAsm) -> &'hir hir::GlobalAsm {
self.arena.alloc(hir::GlobalAsm { asm: ga.asm })
}
fn lower_variant(&mut self, v: &Variant) -> hir::Variant {

View File

@ -35,7 +35,7 @@ pub struct FnLikeNode<'a> { node: Node<'a> }
/// corresponds to some FnLikeNode.
trait MaybeFnLike { fn is_fn_like(&self) -> bool; }
impl MaybeFnLike for ast::Item {
impl MaybeFnLike for ast::Item<'_> {
fn is_fn_like(&self) -> bool {
match self.kind {
ast::ItemKind::Fn(..) => true,

View File

@ -367,7 +367,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
});
}
fn visit_item(&mut self, i: &'hir Item) {
fn visit_item(&mut self, i: &'hir Item<'hir>) {
debug!("visit_item: {:?}", i);
debug_assert_eq!(i.hir_id.owner,
self.definitions.opt_def_index(self.hir_to_node_id[&i.hir_id]).unwrap());

View File

@ -53,7 +53,7 @@ impl<'a, 'hir> OuterVisitor<'a, 'hir> {
}
impl<'a, 'hir> ItemLikeVisitor<'hir> for OuterVisitor<'a, 'hir> {
fn visit_item(&mut self, i: &'hir hir::Item) {
fn visit_item(&mut self, i: &'hir hir::Item<'hir>) {
let mut inner_visitor = self.new_inner_visitor(self.hir_map);
inner_visitor.check(i.hir_id, |this| intravisit::walk_item(this, i));
}

View File

@ -959,7 +959,7 @@ impl<'hir> Map<'hir> {
bug!("expected foreign mod or inlined parent, found {}", self.node_to_string(parent))
}
pub fn expect_item(&self, id: HirId) -> &'hir Item {
pub fn expect_item(&self, id: HirId) -> &'hir Item<'hir> {
match self.find(id) { // read recorded by `find`
Some(Node::Item(item)) => item,
_ => bug!("expected item, found {}", self.node_to_string(id))
@ -1213,7 +1213,7 @@ impl<'a> NodesMatchingSuffix<'a> {
id = parent;
}
fn item_is_mod(item: &Item) -> bool {
fn item_is_mod(item: &Item<'_>) -> bool {
match item.kind {
ItemKind::Mod(_) => true,
_ => false,
@ -1248,7 +1248,7 @@ trait Named {
impl<T:Named> Named for Spanned<T> { fn name(&self) -> Name { self.node.name() } }
impl Named for Item { fn name(&self) -> Name { self.ident.name } }
impl Named for Item<'_> { fn name(&self) -> Name { self.ident.name } }
impl Named for ForeignItem { fn name(&self) -> Name { self.ident.name } }
impl Named for Variant { fn name(&self) -> Name { self.ident.name } }
impl Named for StructField { fn name(&self) -> Name { self.ident.name } }

View File

@ -756,7 +756,7 @@ pub struct Crate<'hir> {
// does, because it can affect the order in which errors are
// detected, which in turn can make compile-fail tests yield
// slightly different results.
pub items: BTreeMap<HirId, Item>,
pub items: BTreeMap<HirId, Item<'hir>>,
pub trait_items: BTreeMap<TraitItemId, TraitItem>,
pub impl_items: BTreeMap<ImplItemId, ImplItem>,
@ -774,8 +774,8 @@ pub struct Crate<'hir> {
pub modules: BTreeMap<HirId, ModuleItems>,
}
impl Crate<'_> {
pub fn item(&self, id: HirId) -> &Item {
impl Crate<'hir> {
pub fn item(&self, id: HirId) -> &Item<'hir> {
&self.items[&id]
}
@ -787,6 +787,12 @@ impl Crate<'_> {
&self.impl_items[&id]
}
pub fn body(&self, id: BodyId) -> &Body {
&self.bodies[&id]
}
}
impl Crate<'_> {
/// Visits all items in the crate in some deterministic (but
/// unspecified) order. If you just need to process every item,
/// but don't care about nesting, this method is the best choice.
@ -829,10 +835,6 @@ impl Crate<'_> {
});
});
}
pub fn body(&self, id: BodyId) -> &Body {
&self.bodies[&id]
}
}
/// A macro definition, in this crate or imported from another.
@ -2440,11 +2442,11 @@ pub struct ItemId {
///
/// The name might be a dummy name in case of anonymous items
#[derive(RustcEncodable, RustcDecodable, Debug)]
pub struct Item {
pub struct Item<'hir> {
pub ident: Ident,
pub hir_id: HirId,
pub attrs: HirVec<Attribute>,
pub kind: ItemKind,
pub kind: ItemKind<'hir>,
pub vis: Visibility,
pub span: Span,
}
@ -2467,7 +2469,7 @@ impl FnHeader {
}
#[derive(RustcEncodable, RustcDecodable, Debug, HashStable)]
pub enum ItemKind {
pub enum ItemKind<'hir> {
/// An `extern crate` item, with optional *original* crate name if the crate was renamed.
///
/// E.g., `extern crate foo` or `extern crate foo_bar as foo`.
@ -2478,12 +2480,12 @@ pub enum ItemKind {
/// or just
///
/// `use foo::bar::baz;` (with `as baz` implicitly on the right).
Use(P<Path>, UseKind),
Use(&'hir Path, UseKind),
/// A `static` item.
Static(P<Ty>, Mutability, BodyId),
Static(&'hir Ty, Mutability, BodyId),
/// A `const` item.
Const(P<Ty>, BodyId),
Const(&'hir Ty, BodyId),
/// A function declaration.
Fn(FnSig, Generics, BodyId),
/// A module.
@ -2491,9 +2493,9 @@ pub enum ItemKind {
/// An external module, e.g. `extern { .. }`.
ForeignMod(ForeignMod),
/// Module-level inline assembly (from `global_asm!`).
GlobalAsm(P<GlobalAsm>),
GlobalAsm(&'hir GlobalAsm),
/// A type alias, e.g., `type Foo = Bar<u8>`.
TyAlias(P<Ty>, Generics),
TyAlias(&'hir Ty, Generics),
/// An opaque `impl Trait` type alias, e.g., `type Foo = impl Bar;`.
OpaqueTy(OpaqueTy),
/// An enum definition, e.g., `enum Foo<A, B> {C<A>, D<B>}`.
@ -2503,7 +2505,7 @@ pub enum ItemKind {
/// A union definition, e.g., `union Foo<A, B> {x: A, y: B}`.
Union(VariantData, Generics),
/// A trait definition.
Trait(IsAuto, Unsafety, Generics, GenericBounds, HirVec<TraitItemRef>),
Trait(IsAuto, Unsafety, Generics, GenericBounds, &'hir [TraitItemRef]),
/// A trait alias.
TraitAlias(Generics, GenericBounds),
@ -2513,11 +2515,11 @@ pub enum ItemKind {
Defaultness,
Generics,
Option<TraitRef>, // (optional) trait this impl implements
P<Ty>, // self
HirVec<ImplItemRef>),
&'hir Ty, // self
&'hir [ImplItemRef]),
}
impl ItemKind {
impl ItemKind<'_> {
pub fn descriptive_variant(&self) -> &str {
match *self {
ItemKind::ExternCrate(..) => "extern crate",
@ -2785,7 +2787,7 @@ impl CodegenFnAttrs {
#[derive(Copy, Clone, Debug)]
pub enum Node<'hir> {
Param(&'hir Param),
Item(&'hir Item),
Item(&'hir Item<'hir>),
ForeignItem(&'hir ForeignItem),
TraitItem(&'hir TraitItem),
ImplItem(&'hir ImplItem),

View File

@ -21,7 +21,7 @@ use std::vec;
pub enum AnnNode<'a> {
Name(&'a ast::Name),
Block(&'a hir::Block),
Item(&'a hir::Item),
Item(&'a hir::Item<'a>),
SubItem(hir::HirId),
Expr(&'a hir::Expr),
Pat(&'a hir::Pat),
@ -43,7 +43,7 @@ pub trait PpAnn {
}
fn post(&self, _state: &mut State<'_>, _node: AnnNode<'_>) {
}
fn try_fetch_item(&self, _: hir::HirId) -> Option<&hir::Item> {
fn try_fetch_item(&self, _: hir::HirId) -> Option<&hir::Item<'_>> {
None
}
}
@ -53,7 +53,7 @@ impl PpAnn for NoAnn {}
pub const NO_ANN: &dyn PpAnn = &NoAnn;
impl PpAnn for hir::Crate<'a> {
fn try_fetch_item(&self, item: hir::HirId) -> Option<&hir::Item> {
fn try_fetch_item(&self, item: hir::HirId) -> Option<&hir::Item<'_>> {
Some(self.item(item))
}
fn nested(&self, state: &mut State<'_>, nested: Nested) {
@ -445,7 +445,7 @@ impl<'a> State<'a> {
fn print_item_type(
&mut self,
item: &hir::Item,
item: &hir::Item<'_>,
generics: &hir::Generics,
inner: impl Fn(&mut Self),
) {
@ -462,7 +462,7 @@ impl<'a> State<'a> {
}
/// Pretty-print an item
pub fn print_item(&mut self, item: &hir::Item) {
pub fn print_item(&mut self, item: &hir::Item<'_>) {
self.hardbreak_if_not_bol();
self.maybe_print_comment(item.span.lo());
self.print_outer_attributes(&item.attrs);
@ -601,7 +601,7 @@ impl<'a> State<'a> {
ref generics,
ref opt_trait,
ref ty,
ref impl_items) => {
impl_items) => {
self.head("");
self.print_visibility(&item.vis);
self.print_defaultness(defaultness);
@ -634,7 +634,7 @@ impl<'a> State<'a> {
}
self.bclose(item.span);
}
hir::ItemKind::Trait(is_auto, unsafety, ref generics, ref bounds, ref trait_items) => {
hir::ItemKind::Trait(is_auto, unsafety, ref generics, ref bounds, trait_items) => {
self.head("");
self.print_visibility(&item.vis);
self.print_is_auto(is_auto);

View File

@ -245,7 +245,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::Mod {
}
}
impl<'a> HashStable<StableHashingContext<'a>> for hir::Item {
impl<'a> HashStable<StableHashingContext<'a>> for hir::Item<'_> {
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
let hir::Item {
ident,

View File

@ -252,7 +252,7 @@ impl<'tcx> TyCtxt<'tcx> {
}
}
fn item_scope_tag(item: &hir::Item) -> &'static str {
fn item_scope_tag(item: &hir::Item<'_>) -> &'static str {
match item.kind {
hir::ItemKind::Impl(..) => "impl",
hir::ItemKind::Struct(..) => "struct",

View File

@ -930,7 +930,7 @@ for LateContextAndPass<'a, 'tcx, T> {
lint_callback!(self, check_body_post, body);
}
fn visit_item(&mut self, it: &'tcx hir::Item) {
fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) {
let generics = self.context.generics.take();
self.context.generics = it.kind.generics();
self.with_lint_attrs(it.hir_id, &it.attrs, |cx| {

View File

@ -96,8 +96,8 @@ macro_rules! late_lint_methods {
fn check_mod_post(a: &$hir hir::Mod, b: Span, c: hir::HirId);
fn check_foreign_item(a: &$hir hir::ForeignItem);
fn check_foreign_item_post(a: &$hir hir::ForeignItem);
fn check_item(a: &$hir hir::Item);
fn check_item_post(a: &$hir hir::Item);
fn check_item(a: &$hir hir::Item<$hir>);
fn check_item_post(a: &$hir hir::Item<$hir>);
fn check_local(a: &$hir hir::Local);
fn check_block(a: &$hir hir::Block);
fn check_block_post(a: &$hir hir::Block);
@ -604,7 +604,7 @@ impl intravisit::Visitor<'tcx> for LintLevelMapBuilder<'_, 'tcx> {
});
}
fn visit_item(&mut self, it: &'tcx hir::Item) {
fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) {
self.with_lint_attrs(it.hir_id, &it.attrs, |builder| {
intravisit::walk_item(builder, it);
});

View File

@ -25,7 +25,7 @@ struct DiagnosticItemCollector<'tcx> {
}
impl<'v, 'tcx> ItemLikeVisitor<'v> for DiagnosticItemCollector<'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
self.observe_item(&item.attrs, item.hir_id);
}

View File

@ -113,7 +113,7 @@ struct LanguageItemCollector<'tcx> {
}
impl ItemLikeVisitor<'v> for LanguageItemCollector<'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
if let Some((value, span)) = extract(&item.attrs) {
let actual_target = Target::from_item(item);
match self.item_refs.get(&*value.as_str()).cloned() {

View File

@ -27,7 +27,7 @@ use crate::hir::intravisit;
// Returns true if the given item must be inlined because it may be
// monomorphized or it was marked with `#[inline]`. This will only return
// true for functions.
fn item_might_be_inlined(tcx: TyCtxt<'tcx>, item: &hir::Item, attrs: CodegenFnAttrs) -> bool {
fn item_might_be_inlined(tcx: TyCtxt<'tcx>, item: &hir::Item<'_>, attrs: CodegenFnAttrs) -> bool {
if attrs.requests_inline() {
return true
}
@ -349,7 +349,7 @@ struct CollectPrivateImplItemsVisitor<'a, 'tcx> {
}
impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, 'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
// Anything which has custom linkage gets thrown on the worklist no
// matter where it is in the crate, along with "special std symbols"
// which are currently akin to allocator symbols.

View File

@ -421,7 +421,7 @@ fn krate(tcx: TyCtxt<'_>) -> NamedRegionMap {
/// In traits, there is an implicit `Self` type parameter which comes before the generics.
/// We have to account for this when computing the index of the other generic parameters.
/// This function returns whether there is such an implicit parameter defined on the given item.
fn sub_items_have_self_param(node: &hir::ItemKind) -> bool {
fn sub_items_have_self_param(node: &hir::ItemKind<'_>) -> bool {
match *node {
hir::ItemKind::Trait(..) |
hir::ItemKind::TraitAlias(..) => true,
@ -454,7 +454,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
replace(&mut self.labels_in_fn, saved);
}
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
match item.kind {
hir::ItemKind::Fn(ref sig, ref generics, _) => {
self.visit_early_late(None, &sig.decl, generics, |this| {

View File

@ -254,7 +254,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
NestedVisitorMap::All(&self.tcx.hir())
}
fn visit_item(&mut self, i: &'tcx Item) {
fn visit_item(&mut self, i: &'tcx Item<'tcx>) {
let orig_in_trait_impl = self.in_trait_impl;
let mut kind = AnnotationKind::Required;
match i.kind {
@ -354,7 +354,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
}
fn visit_item(&mut self, i: &'tcx Item) {
fn visit_item(&mut self, i: &'tcx Item<'tcx>) {
match i.kind {
// Inherent impls and foreign modules serve only as containers for other items,
// they don't have their own stability. They still can be annotated as unstable
@ -816,7 +816,7 @@ impl Visitor<'tcx> for Checker<'tcx> {
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
}
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
match item.kind {
hir::ItemKind::ExternCrate(_) => {
// compiler-generated `extern crate` items have a dummy span.
@ -834,7 +834,7 @@ impl Visitor<'tcx> for Checker<'tcx> {
// For implementations of traits, check the stability of each item
// individually as it's possible to have a stable trait with unstable
// items.
hir::ItemKind::Impl(.., Some(ref t), _, ref impl_item_refs) => {
hir::ItemKind::Impl(.., Some(ref t), _, impl_item_refs) => {
if let Res::Def(DefKind::Trait, trait_did) = t.path.res {
for impl_item_ref in impl_item_refs {
let impl_item = self.tcx.hir().impl_item(impl_item_ref.id);

View File

@ -50,7 +50,7 @@ pub fn trait_obligations<'a, 'tcx>(
body_id: hir::HirId,
trait_ref: &ty::TraitRef<'tcx>,
span: Span,
item: Option<&'tcx hir::Item>,
item: Option<&'tcx hir::Item<'tcx>>,
) -> Vec<traits::PredicateObligation<'tcx>> {
let mut wf = WfPredicates { infcx, param_env, body_id, span, out: vec![], item };
wf.compute_trait_ref(trait_ref, Elaborate::All);
@ -111,7 +111,7 @@ struct WfPredicates<'a, 'tcx> {
body_id: hir::HirId,
span: Span,
out: Vec<traits::PredicateObligation<'tcx>>,
item: Option<&'tcx hir::Item>,
item: Option<&'tcx hir::Item<'tcx>>,
}
/// Controls whether we "elaborate" supertraits and so forth on the WF

View File

@ -57,7 +57,7 @@ impl SymbolNamesTest<'tcx> {
}
impl hir::itemlikevisit::ItemLikeVisitor<'tcx> for SymbolNamesTest<'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
self.process_attrs(item.hir_id);
}

View File

@ -162,7 +162,7 @@ impl Visitor<'tcx> for IfThisChanged<'tcx> {
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
}
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
self.process_attrs(item.hir_id, &item.attrs);
intravisit::walk_item(self, item);
}

View File

@ -532,7 +532,7 @@ impl DirtyCleanVisitor<'tcx> {
}
impl ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
self.check_item(item.hir_id, item.span);
}

View File

@ -24,7 +24,7 @@ struct Finder {
}
impl<'v> ItemLikeVisitor<'v> for Finder {
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
if attr::contains_name(&item.attrs, sym::rustc_proc_macro_decls) {
self.decls = Some(item.hir_id);
}

View File

@ -117,7 +117,7 @@ impl BoxPointers {
}
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxPointers {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item<'_>) {
match it.kind {
hir::ItemKind::Fn(..) |
hir::ItemKind::TyAlias(..) |
@ -391,14 +391,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
}
}
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item<'_>) {
let desc = match it.kind {
hir::ItemKind::Fn(..) => "a function",
hir::ItemKind::Mod(..) => "a module",
hir::ItemKind::Enum(..) => "an enum",
hir::ItemKind::Struct(..) => "a struct",
hir::ItemKind::Union(..) => "a union",
hir::ItemKind::Trait(.., ref trait_item_refs) => {
hir::ItemKind::Trait(.., trait_item_refs) => {
// Issue #11592: traits are always considered exported, even when private.
if let hir::VisibilityKind::Inherited = it.vis.node {
self.private_traits.insert(it.hir_id);
@ -410,7 +410,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
"a trait"
}
hir::ItemKind::TyAlias(..) => "a type alias",
hir::ItemKind::Impl(.., Some(ref trait_ref), _, ref impl_item_refs) => {
hir::ItemKind::Impl(.., Some(ref trait_ref), _, impl_item_refs) => {
// If the trait is private, add the impl items to `private_traits` so they don't get
// reported for missing docs.
let real_trait = trait_ref.path.res.def_id();
@ -501,7 +501,7 @@ declare_lint! {
declare_lint_pass!(MissingCopyImplementations => [MISSING_COPY_IMPLEMENTATIONS]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingCopyImplementations {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item<'_>) {
if !cx.access_levels.is_reachable(item.hir_id) {
return;
}
@ -559,7 +559,7 @@ pub struct MissingDebugImplementations {
impl_lint_pass!(MissingDebugImplementations => [MISSING_DEBUG_IMPLEMENTATIONS]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item<'_>) {
if !cx.access_levels.is_reachable(item.hir_id) {
return;
}
@ -815,7 +815,7 @@ declare_lint! {
declare_lint_pass!(InvalidNoMangleItems => [NO_MANGLE_CONST_ITEMS, NO_MANGLE_GENERIC_ITEMS]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item<'_>) {
match it.kind {
hir::ItemKind::Fn(.., ref generics, _) => {
if let Some(no_mangle_attr) = attr::find_by_name(&it.attrs, sym::no_mangle) {
@ -992,7 +992,7 @@ impl UnreachablePub {
}
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnreachablePub {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item<'_>) {
self.perform_lint(cx, "item", item.hir_id, &item.vis, item.span, true);
}
@ -1074,7 +1074,7 @@ impl TypeAliasBounds {
}
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeAliasBounds {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item<'_>) {
let (ty, type_alias_generics) = match item.kind {
hir::ItemKind::TyAlias(ref ty, ref generics) => (&*ty, generics),
_ => return,
@ -1150,7 +1150,7 @@ fn check_const(cx: &LateContext<'_, '_>, body_id: hir::BodyId) {
}
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedBrokenConst {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item<'_>) {
match it.kind {
hir::ItemKind::Const(_, body_id) => {
check_const(cx, body_id);
@ -1179,7 +1179,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TrivialConstraints {
fn check_item(
&mut self,
cx: &LateContext<'a, 'tcx>,
item: &'tcx hir::Item,
item: &'tcx hir::Item<'tcx>,
) {
use rustc::ty::fold::TypeFoldable;
use rustc::ty::Predicate::*;
@ -1338,7 +1338,7 @@ impl UnnameableTestItems {
}
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnnameableTestItems {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item<'_>) {
if self.items_nameable {
if let hir::ItemKind::Mod(..) = it.kind {}
else {
@ -1357,7 +1357,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnnameableTestItems {
}
}
fn check_item_post(&mut self, _cx: &LateContext<'_, '_>, it: &hir::Item) {
fn check_item_post(&mut self, _cx: &LateContext<'_, '_>, it: &hir::Item<'_>) {
if !self.items_nameable && self.boundary == it.hir_id {
self.items_nameable = true;
}
@ -1616,7 +1616,7 @@ impl ExplicitOutlivesRequirements {
}
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'_>) {
use rustc::middle::resolve_lifetime::Region;
let infer_static = cx.tcx.features().infer_static_outlives_requirements;

View File

@ -325,7 +325,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
}
}
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item<'_>) {
if let hir::ItemKind::Mod(_) = it.kind {
self.check_snake_case(cx, "module", &it.ident);
}
@ -386,7 +386,7 @@ impl NonUpperCaseGlobals {
}
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item<'_>) {
match it.kind {
hir::ItemKind::Static(..) if !attr::contains_name(&it.attrs, sym::no_mangle) => {
NonUpperCaseGlobals::check_upper_case(cx, "static variable", &it.ident);

View File

@ -1031,7 +1031,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImproperCTypes {
declare_lint_pass!(VariantSizeDifferences => [VARIANT_SIZE_DIFFERENCES]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for VariantSizeDifferences {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item<'_>) {
if let hir::ItemKind::Enum(ref enum_definition, _) = it.kind {
let item_def_id = cx.tcx.hir().local_def_id(it.hir_id);
let t = cx.tcx.type_of(item_def_id);

View File

@ -18,7 +18,7 @@ struct Collector<'tcx> {
}
impl ItemLikeVisitor<'tcx> for Collector<'tcx> {
fn visit_item(&mut self, it: &'tcx hir::Item) {
fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) {
let fm = match it.kind {
hir::ItemKind::ForeignMod(ref fm) => fm,
_ => return,

View File

@ -26,7 +26,7 @@ struct Collector {
}
impl<'tcx> ItemLikeVisitor<'tcx> for Collector {
fn visit_item(&mut self, it: &'tcx hir::Item) {
fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) {
let fm = match it.kind {
hir::ItemKind::ForeignMod(ref fm) => fm,
_ => return,

View File

@ -36,7 +36,7 @@ struct Collector<'tcx> {
}
impl ItemLikeVisitor<'tcx> for Collector<'tcx> {
fn visit_item(&mut self, it: &'tcx hir::Item) {
fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) {
let fm = match it.kind {
hir::ItemKind::ForeignMod(ref fm) => fm,
_ => return,

View File

@ -1048,7 +1048,7 @@ impl EncodeContext<'tcx> {
self.lazy(rendered_const)
}
fn encode_info_for_item(&mut self, def_id: DefId, item: &'tcx hir::Item) {
fn encode_info_for_item(&mut self, def_id: DefId, item: &'tcx hir::Item<'tcx>) {
let tcx = self.tcx;
debug!("EncodeContext::encode_info_for_item({:?})", def_id);
@ -1580,7 +1580,7 @@ impl Visitor<'tcx> for EncodeContext<'tcx> {
let def_id = self.tcx.hir().local_def_id(c.hir_id);
self.encode_info_for_anon_const(def_id);
}
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
intravisit::walk_item(self, item);
let def_id = self.tcx.hir().local_def_id(item.hir_id);
match item.kind {
@ -1649,7 +1649,7 @@ impl EncodeContext<'tcx> {
/// encode some sub-items. Usually we want some info from the item
/// so it's easier to do that here then to wait until we would encounter
/// normally in the visitor walk.
fn encode_addl_info_for_item(&mut self, item: &hir::Item) {
fn encode_addl_info_for_item(&mut self, item: &hir::Item<'_>) {
let def_id = self.tcx.hir().local_def_id(item.hir_id);
match item.kind {
hir::ItemKind::Static(..) |
@ -1713,7 +1713,7 @@ struct ImplVisitor<'tcx> {
}
impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
if let hir::ItemKind::Impl(..) = item.kind {
let impl_id = self.tcx.hir().local_def_id(item.hir_id);
if let Some(trait_ref) = self.tcx.impl_trait_ref(impl_id) {

View File

@ -55,6 +55,9 @@ pub fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> BodyAndCache<'_> {
}
Node::Item(hir::Item { kind: hir::ItemKind::Static(ty, _, body_id), .. })
| Node::Item(hir::Item { kind: hir::ItemKind::Const(ty, body_id), .. })
=> {
(*body_id, ty.span)
}
| Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(ty, body_id), .. })
| Node::TraitItem(
hir::TraitItem { kind: hir::TraitItemKind::Const(ty, Some(body_id)), .. }

View File

@ -987,7 +987,7 @@ struct RootCollector<'a, 'tcx> {
}
impl ItemLikeVisitor<'v> for RootCollector<'_, 'v> {
fn visit_item(&mut self, item: &'v hir::Item) {
fn visit_item(&mut self, item: &'v hir::Item<'v>) {
match item.kind {
hir::ItemKind::ExternCrate(..) |
hir::ItemKind::Use(..) |
@ -1145,7 +1145,7 @@ fn item_requires_monomorphization(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
fn create_mono_items_for_default_impls<'tcx>(
tcx: TyCtxt<'tcx>,
item: &'tcx hir::Item,
item: &'tcx hir::Item<'tcx>,
output: &mut Vec<MonoItem<'tcx>>,
) {
match item.kind {

View File

@ -362,7 +362,7 @@ struct LifeSeeder<'k, 'tcx> {
}
impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
let allow_dead_code = has_allow_dead_code_or_lang_attr(self.tcx,
item.hir_id,
&item.attrs);
@ -381,7 +381,7 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> {
}
}
}
hir::ItemKind::Trait(.., ref trait_item_refs) => {
hir::ItemKind::Trait(.., trait_item_refs) => {
for trait_item_ref in trait_item_refs {
let trait_item = self.krate.trait_item(trait_item_ref.id);
match trait_item.kind {
@ -397,7 +397,7 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> {
}
}
}
hir::ItemKind::Impl(.., ref opt_trait, _, ref impl_item_refs) => {
hir::ItemKind::Impl(.., ref opt_trait, _, impl_item_refs) => {
for impl_item_ref in impl_item_refs {
let impl_item = self.krate.impl_item(impl_item_ref.id);
if opt_trait.is_some() ||
@ -481,7 +481,7 @@ struct DeadVisitor<'tcx> {
}
impl DeadVisitor<'tcx> {
fn should_warn_about_item(&mut self, item: &hir::Item) -> bool {
fn should_warn_about_item(&mut self, item: &hir::Item<'_>) -> bool {
let should_warn = match item.kind {
hir::ItemKind::Static(..)
| hir::ItemKind::Const(..)
@ -567,7 +567,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
NestedVisitorMap::All(&self.tcx.hir())
}
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
if self.should_warn_about_item(item) {
// For most items, we want to highlight its identifier
let span = match item.kind {

View File

@ -33,7 +33,7 @@ struct EntryContext<'a, 'tcx> {
}
impl<'a, 'tcx> ItemLikeVisitor<'tcx> for EntryContext<'a, 'tcx> {
fn visit_item(&mut self, item: &'tcx Item) {
fn visit_item(&mut self, item: &'tcx Item<'tcx>) {
let def_id = self.map.local_def_id(item.hir_id);
let def_key = self.map.def_key(def_id);
let at_root = def_key.parent == Some(CRATE_DEF_INDEX);
@ -81,7 +81,7 @@ fn entry_fn(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option<(DefId, EntryFnType)> {
// Beware, this is duplicated in `libsyntax/entry.rs`, so make sure to keep
// them in sync.
fn entry_point_type(item: &Item, at_root: bool) -> EntryPointType {
fn entry_point_type(item: &Item<'_>, at_root: bool) -> EntryPointType {
match item.kind {
ItemKind::Fn(..) => {
if attr::contains_name(&item.attrs, sym::start) {
@ -104,7 +104,7 @@ fn entry_point_type(item: &Item, at_root: bool) -> EntryPointType {
}
fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
fn find_item(item: &Item<'_>, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
match entry_point_type(item, at_root) {
EntryPointType::MainNamed => {
if ctxt.main_fn.is_none() {

View File

@ -123,7 +123,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
self.visit_body(nested_body)
}
fn visit_item(&mut self, i: &'v hir::Item) {
fn visit_item(&mut self, i: &'v hir::Item<'v>) {
self.record("Item", Id::Node(i.hir_id), i);
hir_visit::walk_item(self, i)
}

View File

@ -28,7 +28,7 @@ struct VarianceTest<'tcx> {
}
impl ItemLikeVisitor<'tcx> for VarianceTest<'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
let item_def_id = self.tcx.hir().local_def_id(item.hir_id);
if let ItemKind::TyAlias(..) = item.kind {
@ -45,7 +45,7 @@ impl ItemLikeVisitor<'tcx> for VarianceTest<'tcx> {
}
impl VarianceTest<'tcx> {
fn dump_layout_of(&self, item_def_id: DefId, item: &hir::Item, attr: &Attribute) {
fn dump_layout_of(&self, item_def_id: DefId, item: &hir::Item<'tcx>, attr: &Attribute) {
let tcx = self.tcx;
let param_env = self.tcx.param_env(item_def_id);
let ty = self.tcx.type_of(item_def_id);

View File

@ -14,7 +14,7 @@ struct RegistrarFinder {
}
impl<'v> ItemLikeVisitor<'v> for RegistrarFinder {
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
if let hir::ItemKind::Fn(..) = item.kind {
if attr::contains_name(&item.attrs, sym::plugin_registrar) {
self.registrars.push((item.hir_id, item.span));

View File

@ -652,7 +652,7 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
NestedVisitorMap::All(&self.tcx.hir())
}
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
let inherited_item_level = match item.kind {
hir::ItemKind::Impl(..) =>
Option::<AccessLevel>::of_impl(item.hir_id, self.tcx, &self.access_levels),
@ -685,14 +685,14 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
}
}
}
hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => {
hir::ItemKind::Impl(.., ref trait_ref, _, impl_item_refs) => {
for impl_item_ref in impl_item_refs {
if trait_ref.is_some() || impl_item_ref.vis.node.is_pub() {
self.update(impl_item_ref.id.hir_id, item_level);
}
}
}
hir::ItemKind::Trait(.., ref trait_item_refs) => {
hir::ItemKind::Trait(.., trait_item_refs) => {
for trait_item_ref in trait_item_refs {
self.update(trait_item_ref.id.hir_id, item_level);
}
@ -756,7 +756,7 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
self.reach(item.hir_id, item_level).generics().predicates().ty();
}
}
hir::ItemKind::Trait(.., ref trait_item_refs) => {
hir::ItemKind::Trait(.., trait_item_refs) => {
if item_level.is_some() {
self.reach(item.hir_id, item_level).generics().predicates();
@ -779,7 +779,7 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
}
}
// Visit everything except for private impl items.
hir::ItemKind::Impl(.., ref impl_item_refs) => {
hir::ItemKind::Impl(.., impl_item_refs) => {
if item_level.is_some() {
self.reach(item.hir_id, item_level).generics().predicates().ty().trait_ref();
@ -1004,7 +1004,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> {
self.tables = orig_tables;
}
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
let orig_current_item = mem::replace(&mut self.current_item, item.hir_id);
let orig_tables =
mem::replace(&mut self.tables, item_tables(self.tcx, item.hir_id, self.empty_tables));
@ -1283,7 +1283,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
}
// Check types in item interfaces.
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
let orig_current_item = mem::replace(&mut self.current_item,
self.tcx.hir().local_def_id(item.hir_id));
let orig_in_body = mem::replace(&mut self.in_body, false);
@ -1416,7 +1416,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
NestedVisitorMap::All(&self.tcx.hir())
}
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
match item.kind {
// Contents of a private mod can be re-exported, so we need
// to check internals.
@ -1441,7 +1441,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
// (i.e., we could just return here to not check them at
// all, or some worse estimation of whether an impl is
// publicly visible).
hir::ItemKind::Impl(.., ref g, ref trait_ref, ref self_, ref impl_item_refs) => {
hir::ItemKind::Impl(.., ref g, ref trait_ref, ref self_, impl_item_refs) => {
// `impl [... for] Private` is never visible.
let self_contains_private;
// `impl [... for] Public<...>`, but not `impl [... for]
@ -1849,7 +1849,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx>
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
}
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
let tcx = self.tcx;
let item_visibility = ty::Visibility::from_hir(&item.vis, item.hir_id, tcx);
@ -1872,7 +1872,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx>
// it's not a part of interface, so we skip it.
self.check(item.hir_id, item_visibility).generics().predicates();
}
hir::ItemKind::Trait(.., ref trait_item_refs) => {
hir::ItemKind::Trait(.., trait_item_refs) => {
self.check(item.hir_id, item_visibility).generics().predicates();
for trait_item_ref in trait_item_refs {
@ -1917,7 +1917,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx>
// Subitems of inherent impls have their own publicity.
// A trait impl is public when both its type and its trait are public
// Subitems of trait impls have inherited publicity.
hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => {
hir::ItemKind::Impl(.., ref trait_ref, _, impl_item_refs) => {
let impl_vis = ty::Visibility::of_impl(item.hir_id, tcx, &Default::default());
self.check(item.hir_id, impl_vis).generics().predicates();
for impl_item_ref in impl_item_refs {

View File

@ -614,9 +614,9 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
Node::TraitRef(tr) => tr.path.res,
Node::Item(&hir::Item {
kind: hir::ItemKind::Use(ref path, _),
kind: hir::ItemKind::Use(path, _),
..
}) |
}) => path.res,
Node::Visibility(&Spanned {
node: hir::VisibilityKind::Restricted { ref path, .. }, .. }) => path.res,

View File

@ -669,7 +669,7 @@ impl Visitor<'tcx> for ClauseDumper<'tcx> {
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
}
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
self.process_attrs(item.hir_id, &item.attrs);
intravisit::walk_item(self, item);
}

View File

@ -1002,7 +1002,7 @@ fn compute_all_traits(tcx: TyCtxt<'_>) -> Vec<DefId> {
}
impl<'v, 'a, 'tcx> itemlikevisit::ItemLikeVisitor<'v> for Visitor<'a, 'tcx> {
fn visit_item(&mut self, i: &'v hir::Item) {
fn visit_item(&mut self, i: &'v hir::Item<'v>) {
match i.kind {
hir::ItemKind::Trait(..) |
hir::ItemKind::TraitAlias(..) => {

View File

@ -751,7 +751,7 @@ struct CheckItemTypesVisitor<'tcx> {
}
impl ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'tcx> {
fn visit_item(&mut self, i: &'tcx hir::Item) {
fn visit_item(&mut self, i: &'tcx hir::Item<'tcx>) {
check_item_type(self.tcx, i);
}
fn visit_trait_item(&mut self, _: &'tcx hir::TraitItem) { }
@ -1696,7 +1696,7 @@ fn fn_maybe_err(tcx: TyCtxt<'_>, sp: Span, abi: Abi) {
}
}
pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item) {
pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item<'tcx>) {
debug!(
"check_item_type(it.hir_id={}, it.name={})",
it.hir_id,
@ -1857,7 +1857,7 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_>, id: DefId, span: Span)
}
}
fn check_on_unimplemented(tcx: TyCtxt<'_>, trait_def_id: DefId, item: &hir::Item) {
fn check_on_unimplemented(tcx: TyCtxt<'_>, trait_def_id: DefId, item: &hir::Item<'_>) {
let item_def_id = tcx.hir().local_def_id(item.hir_id);
// an error would be reported if this fails.
let _ = traits::OnUnimplementedDirective::of_item(tcx, trait_def_id, item_def_id);

View File

@ -235,7 +235,7 @@ fn check_associated_item(
})
}
fn for_item<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item) -> CheckWfFcxBuilder<'tcx> {
fn for_item<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item<'_>) -> CheckWfFcxBuilder<'tcx> {
for_id(tcx, item.hir_id, item.span)
}
@ -252,7 +252,7 @@ fn for_id(tcx: TyCtxt<'_>, id: hir::HirId, span: Span) -> CheckWfFcxBuilder<'_>
/// In a type definition, we check that to ensure that the types of the fields are well-formed.
fn check_type_defn<'tcx, F>(
tcx: TyCtxt<'tcx>,
item: &hir::Item,
item: &hir::Item<'tcx>,
all_sized: bool,
mut lookup_fields: F,
) where
@ -325,7 +325,7 @@ fn check_type_defn<'tcx, F>(
});
}
fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item) {
fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item<'_>) {
debug!("check_trait: {:?}", item.hir_id);
let trait_def_id = tcx.hir().local_def_id(item.hir_id);
@ -348,7 +348,7 @@ fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item) {
});
}
fn check_item_fn(tcx: TyCtxt<'_>, item: &hir::Item) {
fn check_item_fn(tcx: TyCtxt<'_>, item: &hir::Item<'_>) {
for_item(tcx, item).with_fcx(|fcx, tcx| {
let def_id = fcx.tcx.hir().local_def_id(item.hir_id);
let sig = fcx.tcx.fn_sig(def_id);
@ -396,7 +396,7 @@ fn check_item_type(
fn check_impl<'tcx>(
tcx: TyCtxt<'tcx>,
item: &'tcx hir::Item,
item: &'tcx hir::Item<'tcx>,
ast_self_ty: &hir::Ty,
ast_trait_ref: &Option<hir::TraitRef>,
) {
@ -977,7 +977,7 @@ fn receiver_is_implemented(
fn check_variances_for_type_defn<'tcx>(
tcx: TyCtxt<'tcx>,
item: &hir::Item,
item: &hir::Item<'tcx>,
hir_generics: &hir::Generics,
) {
let item_def_id = tcx.hir().local_def_id(item.hir_id);
@ -1081,7 +1081,7 @@ impl CheckTypeWellFormedVisitor<'tcx> {
}
impl ParItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'tcx> {
fn visit_item(&self, i: &'tcx hir::Item) {
fn visit_item(&self, i: &'tcx hir::Item<'tcx>) {
debug!("visit_item: {:?}", i);
let def_id = self.tcx.hir().local_def_id(i.hir_id);
self.tcx.ensure().check_item_well_formed(def_id);

View File

@ -29,7 +29,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
}
impl ItemLikeVisitor<'v> for CheckVisitor<'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
if item.vis.node.is_pub() || item.span.is_dummy() {
return;
}
@ -217,7 +217,7 @@ struct ExternCrateToLint {
}
impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CollectExternCrateVisitor<'a, 'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
if let hir::ItemKind::ExternCrate(orig_name) = item.kind {
let extern_crate_def_id = self.tcx.hir().local_def_id(item.hir_id);
self.crates_to_lint.push(

View File

@ -50,7 +50,7 @@ struct InherentCollect<'tcx> {
}
impl ItemLikeVisitor<'v> for InherentCollect<'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
let ty = match item.kind {
hir::ItemKind::Impl(.., None, ref ty, _) => ty,
_ => return
@ -262,7 +262,7 @@ impl ItemLikeVisitor<'v> for InherentCollect<'tcx> {
}
impl InherentCollect<'tcx> {
fn check_def_id(&mut self, item: &hir::Item, def_id: DefId) {
fn check_def_id(&mut self, item: &hir::Item<'_>, def_id: DefId) {
if def_id.is_local() {
// Add the implementation to the mapping from implementation to base
// type def ID, if there is a base type for this implementation and

View File

@ -85,7 +85,7 @@ impl InherentOverlapChecker<'tcx> {
}
impl ItemLikeVisitor<'v> for InherentOverlapChecker<'tcx> {
fn visit_item(&mut self, item: &'v hir::Item) {
fn visit_item(&mut self, item: &'v hir::Item<'v>) {
match item.kind {
hir::ItemKind::Enum(..) |
hir::ItemKind::Struct(..) |

View File

@ -23,7 +23,7 @@ impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> {
/// apply to a specific impl, so just return after reporting one
/// to prevent inundating the user with a bunch of similar error
/// reports.
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
let def_id = self.tcx.hir().local_def_id(item.hir_id);
// "Trait" impl
if let hir::ItemKind::Impl(.., generics, Some(tr), impl_ty, _) = &item.kind {

View File

@ -18,7 +18,7 @@ struct UnsafetyChecker<'tcx> {
impl UnsafetyChecker<'tcx> {
fn check_unsafety_coherence(&mut self,
item: &'v hir::Item,
item: &'v hir::Item<'v>,
impl_generics: Option<&hir::Generics>,
unsafety: hir::Unsafety,
polarity: hir::ImplPolarity)
@ -72,7 +72,7 @@ impl UnsafetyChecker<'tcx> {
}
impl ItemLikeVisitor<'v> for UnsafetyChecker<'tcx> {
fn visit_item(&mut self, item: &'v hir::Item) {
fn visit_item(&mut self, item: &'v hir::Item<'v>) {
if let hir::ItemKind::Impl(unsafety, polarity, _, ref generics, ..) = item.kind {
self.check_unsafety_coherence(item, Some(generics), unsafety, polarity);
}

View File

@ -111,7 +111,7 @@ impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
}
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
convert_item(self.tcx, item.hir_id);
intravisit::walk_item(self, item);
}
@ -1693,7 +1693,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> {
intravisit::NestedVisitorMap::All(&self.tcx.hir())
}
fn visit_item(&mut self, it: &'tcx Item) {
fn visit_item(&mut self, it: &'tcx Item<'tcx>) {
debug!("find_existential_constraints: visiting {:?}", it);
let def_id = self.tcx.hir().local_def_id(it.hir_id);
// The opaque type itself or its children are not within its reveal scope.
@ -2052,8 +2052,6 @@ fn explicit_predicates_of(
const NO_GENERICS: &hir::Generics = &hir::Generics::empty();
let empty_trait_items = HirVec::new();
let mut predicates = UniquePredicates::new();
let ast_generics = match node {
@ -2098,12 +2096,12 @@ fn explicit_predicates_of(
| ItemKind::Struct(_, ref generics)
| ItemKind::Union(_, ref generics) => generics,
ItemKind::Trait(_, _, ref generics, .., ref items) => {
ItemKind::Trait(_, _, ref generics, .., items) => {
is_trait = Some((ty::TraitRef::identity(tcx, def_id), items));
generics
}
ItemKind::TraitAlias(ref generics, _) => {
is_trait = Some((ty::TraitRef::identity(tcx, def_id), &empty_trait_items));
is_trait = Some((ty::TraitRef::identity(tcx, def_id), &[]));
generics
}
ItemKind::OpaqueTy(OpaqueTy {

View File

@ -79,7 +79,7 @@ struct ImplWfCheck<'tcx> {
}
impl ItemLikeVisitor<'tcx> for ImplWfCheck<'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
if let hir::ItemKind::Impl(.., ref impl_item_refs) = item.kind {
let impl_def_id = self.tcx.hir().local_def_id(item.hir_id);
enforce_impl_params_are_constrained(self.tcx,

View File

@ -51,7 +51,7 @@ pub struct InferVisitor<'cx, 'tcx> {
}
impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
let item_did = self.tcx.hir().local_def_id(item.hir_id);
debug!("InferVisitor::visit_item(item={:?})", item_did);

View File

@ -16,7 +16,7 @@ struct OutlivesTest<'tcx> {
}
impl ItemLikeVisitor<'tcx> for OutlivesTest<'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
let item_def_id = self.tcx.hir().local_def_id(item.hir_id);
// For unit testing: check for a special "rustc_outlives"

View File

@ -67,7 +67,7 @@ pub fn add_constraints_from_crate<'a, 'tcx>(terms_cx: TermsContext<'a, 'tcx>)
}
impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ConstraintContext<'a, 'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
match item.kind {
hir::ItemKind::Struct(ref struct_def, _) |
hir::ItemKind::Union(ref struct_def, _) => {

View File

@ -127,7 +127,7 @@ impl<'a, 'tcx> TermsContext<'a, 'tcx> {
}
impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for TermsContext<'a, 'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
fn visit_item(&mut self, item: &hir::Item<'_>) {
debug!("add_inferreds for item {}",
self.tcx.hir().node_to_string(item.hir_id));

View File

@ -14,7 +14,7 @@ struct VarianceTest<'tcx> {
}
impl ItemLikeVisitor<'tcx> for VarianceTest<'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item) {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
let item_def_id = self.tcx.hir().local_def_id(item.hir_id);
// For unit testing: check for a special "rustc_variance"

View File

@ -9,7 +9,6 @@ use syntax_pos::{self, Span};
use rustc::hir;
use rustc::hir::def_id::CrateNum;
use rustc::hir::ptr::P;
pub struct Module<'hir> {
pub name: Option<Name>,
@ -136,7 +135,7 @@ pub struct Function<'hir> {
}
pub struct Typedef<'hir> {
pub ty: &'hir P<hir::Ty>,
pub ty: &'hir hir::Ty,
pub gen: &'hir hir::Generics,
pub name: Name,
pub id: hir::HirId,
@ -156,7 +155,7 @@ pub struct OpaqueTy<'hir> {
#[derive(Debug)]
pub struct Static<'hir> {
pub type_: &'hir P<hir::Ty>,
pub type_: &'hir hir::Ty,
pub mutability: hir::Mutability,
pub expr: hir::BodyId,
pub name: Name,
@ -167,7 +166,7 @@ pub struct Static<'hir> {
}
pub struct Constant<'hir> {
pub type_: &'hir P<hir::Ty>,
pub type_: &'hir hir::Ty,
pub expr: hir::BodyId,
pub name: Name,
pub attrs: &'hir [ast::Attribute],
@ -206,7 +205,7 @@ pub struct Impl<'hir> {
pub defaultness: hir::Defaultness,
pub generics: &'hir hir::Generics,
pub trait_: &'hir Option<hir::TraitRef>,
pub for_: &'hir P<hir::Ty>,
pub for_: &'hir hir::Ty,
pub items: Vec<&'hir hir::ImplItem>,
pub attrs: &'hir [ast::Attribute],
pub whence: Span,

View File

@ -440,7 +440,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
om.unions.push(self.visit_union_data(item, ident.name, sd, gen)),
hir::ItemKind::Fn(ref sig, ref gen, body) =>
self.visit_fn(om, item, ident.name, &sig.decl, sig.header, gen, body),
hir::ItemKind::TyAlias(ref ty, ref gen) => {
hir::ItemKind::TyAlias(ty, ref gen) => {
let t = Typedef {
ty,
gen,
@ -463,7 +463,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
};
om.opaque_tys.push(t);
},
hir::ItemKind::Static(ref type_, mutability, expr) => {
hir::ItemKind::Static(type_, mutability, expr) => {
let s = Static {
type_,
mutability,
@ -476,7 +476,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
};
om.statics.push(s);
},
hir::ItemKind::Const(ref type_, expr) => {
hir::ItemKind::Const(type_, expr) => {
let s = Constant {
type_,
expr,
@ -524,7 +524,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
defaultness,
ref generics,
ref trait_,
ref for_,
for_,
ref item_ids) => {
// Don't duplicate impls when inlining or if it's implementing a trait, we'll pick
// them up regardless of where they're located.