let hir_id = self.local_def_id_to_hir_id(module);
match self.get_entry(hir_id).node {
Node::Item(&Item { span, kind: ItemKind::Mod(ref m), .. }) => (m, span, hir_id),
- Node::Crate(item) => (&item.module, item.span, hir_id),
+ Node::Crate(item) => (&item, item.inner, hir_id),
node => panic!("not a module: {:?}", node),
}
}
ParentHirIterator { current_id, map: self }
}
- /// Checks if the node is an argument. An argument is a local variable whose
- /// immediate parent is an item or a closure.
- pub fn is_argument(&self, id: HirId) -> bool {
- match self.find(id) {
- Some(Node::Binding(_)) => (),
- _ => return false,
- }
- matches!(
- self.find(self.get_parent_node(id)),
- Some(
- Node::Item(_)
- | Node::TraitItem(_)
- | Node::ImplItem(_)
- | Node::Expr(Expr { kind: ExprKind::Closure(..), .. }),
- )
- )
- }
-
/// Checks if the node is left-hand side of an assignment.
pub fn is_lhs(&self, id: HirId) -> bool {
match self.find(self.get_parent_node(id)) {
}
}
- pub fn expect_variant_data(&self, id: HirId) -> &'hir VariantData<'hir> {
- match self.find(id) {
- Some(
- Node::Ctor(vd)
- | Node::Item(Item { kind: ItemKind::Struct(vd, _) | ItemKind::Union(vd, _), .. }),
- ) => vd,
- Some(Node::Variant(variant)) => &variant.data,
- _ => bug!("expected struct or variant, found {}", self.node_to_string(id)),
- }
- }
-
pub fn expect_variant(&self, id: HirId) -> &'hir Variant<'hir> {
match self.find(id) {
Some(Node::Variant(variant)) => variant,
Node::Visibility(v) => bug!("unexpected Visibility {:?}", v),
Node::Local(local) => local.span,
Node::MacroDef(macro_def) => macro_def.span,
- Node::Crate(item) => item.span,
+ Node::Crate(item) => item.inner,
};
Some(span)
}
intravisit::walk_crate(&mut collector, tcx.untracked_crate);
let crate_disambiguator = tcx.sess.local_crate_disambiguator();
- let cmdline_args = tcx.sess.opts.dep_tracking_hash();
+ let cmdline_args = tcx.sess.opts.dep_tracking_hash(true);
collector.finalize_and_compute_crate_hash(crate_disambiguator, &*tcx.cstore, cmdline_args)
};