// explored. For example, if it's a live Node::Item that is a
// function, then we should explore its block to check for codes that
// may need to be marked as live.
-fn should_explore<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
- hir_id: hir::HirId) -> bool {
+fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: hir::HirId) -> bool {
match tcx.hir().find_by_hir_id(hir_id) {
Some(Node::Item(..)) |
Some(Node::ImplItem(..)) |
struct MarkSymbolVisitor<'a, 'tcx: 'a> {
worklist: Vec<hir::HirId>,
- tcx: TyCtxt<'a, 'tcx, 'tcx>,
+ tcx: TyCtxt<'tcx, 'tcx>,
tables: &'a ty::TypeckTables<'tcx>,
live_symbols: FxHashSet<hir::HirId>,
repr_has_repr_c: bool,
}
_ if self.in_pat => {},
Res::PrimTy(..) | Res::SelfTy(..) | Res::SelfCtor(..) |
- Res::Local(..) | Res::Upvar(..) => {}
+ Res::Local(..) => {}
Res::Def(DefKind::Ctor(CtorOf::Variant, ..), ctor_def_id) => {
let variant_id = self.tcx.parent(ctor_def_id).unwrap();
let enum_id = self.tcx.parent(variant_id).unwrap();
}
}
-fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>,
- id: hir::HirId,
- attrs: &[ast::Attribute]) -> bool {
+fn has_allow_dead_code_or_lang_attr(
+ tcx: TyCtxt<'_, '_>,
+ id: hir::HirId,
+ attrs: &[ast::Attribute],
+) -> bool {
if attr::contains_name(attrs, sym::lang) {
return true;
}
struct LifeSeeder<'k, 'tcx: 'k> {
worklist: Vec<hir::HirId>,
krate: &'k hir::Crate,
- tcx: TyCtxt<'k, 'tcx, 'tcx>,
+ tcx: TyCtxt<'tcx, 'tcx>,
// see `MarkSymbolVisitor::struct_constructors`
struct_constructors: FxHashMap<hir::HirId, hir::HirId>,
}
}
}
-fn create_and_seed_worklist<'a, 'tcx>(
- tcx: TyCtxt<'a, 'tcx, 'tcx>,
+fn create_and_seed_worklist<'tcx>(
+ tcx: TyCtxt<'tcx, 'tcx>,
access_levels: &privacy::AccessLevels,
krate: &hir::Crate,
) -> (Vec<hir::HirId>, FxHashMap<hir::HirId, hir::HirId>) {
(life_seeder.worklist, life_seeder.struct_constructors)
}
-fn find_live<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
- access_levels: &privacy::AccessLevels,
- krate: &hir::Crate)
- -> FxHashSet<hir::HirId> {
+fn find_live<'tcx>(
+ tcx: TyCtxt<'tcx, 'tcx>,
+ access_levels: &privacy::AccessLevels,
+ krate: &hir::Crate,
+) -> FxHashSet<hir::HirId> {
let (worklist, struct_constructors) = create_and_seed_worklist(tcx, access_levels, krate);
let mut symbol_visitor = MarkSymbolVisitor {
worklist,
symbol_visitor.live_symbols
}
-struct DeadVisitor<'a, 'tcx: 'a> {
- tcx: TyCtxt<'a, 'tcx, 'tcx>,
+struct DeadVisitor<'tcx> {
+ tcx: TyCtxt<'tcx, 'tcx>,
live_symbols: FxHashSet<hir::HirId>,
}
-impl<'a, 'tcx> DeadVisitor<'a, 'tcx> {
+impl DeadVisitor<'tcx> {
fn should_warn_about_item(&mut self, item: &hir::Item) -> bool {
let should_warn = match item.node {
hir::ItemKind::Static(..)
}
}
-impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> {
+impl Visitor<'tcx> for DeadVisitor<'tcx> {
/// Walk nested items in place so that we don't report dead-code
/// on inner functions when the outer function is already getting
/// an error. We could do this also by checking the parents, but
}
}
-pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
+pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) {
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
let krate = tcx.hir().krate();
let live_symbols = find_live(tcx, access_levels, krate);