use crate::hir::{CodegenFnAttrs, CodegenFnAttrFlags};
use crate::hir::Node;
-use crate::hir::def::Def;
+use crate::hir::def::{Def, DefKind};
use crate::hir::def_id::{DefId, CrateNum};
use rustc_data_structures::sync::Lrc;
use crate::ty::{self, TyCtxt};
}
hir::ExprKind::MethodCall(..) => {
self.tables.type_dependent_def(expr.hir_id)
+ .map(|(kind, def_id)| Def::Def(kind, def_id))
}
_ => None
};
match def {
- Some(Def::Local(node_id)) | Some(Def::Upvar(node_id, ..)) => {
- let hir_id = self.tcx.hir().node_to_hir_id(node_id);
+ Some(Def::Local(hir_id)) | Some(Def::Upvar(hir_id, ..)) => {
self.reachable_symbols.insert(hir_id);
}
Some(def) => {
// If this path leads to a constant, then we need to
// recurse into the constant to continue finding
// items that are reachable.
- Def::Const(..) | Def::AssociatedConst(..) => {
+ Def::Def(DefKind::Const, _) | Def::Def(DefKind::AssociatedConst, _) => {
self.worklist.push(hir_id);
}
self.worklist.extend(impl_item_refs.iter().map(|ii_ref| ii_ref.id.hir_id));
let trait_def_id = match trait_ref.path.def {
- Def::Trait(def_id) => def_id,
+ Def::Def(DefKind::Trait, def_id) => def_id,
_ => unreachable!()
};