tcx: TyCtxt<'tcx>,
def_id: DefId,
) -> (ty::Visibility, Span, &'static str) {
- match def_id.as_local().map(|def_id| tcx.hir().as_local_hir_id(def_id)) {
+ match def_id.as_local().map(|def_id| tcx.hir().local_def_id_to_hir_id(def_id)) {
Some(hir_id) => {
let vis = match tcx.hir().get(hir_id) {
Node::Item(item) => &item.vis,
fn new_min(find: &FindMin<'_, '_, Self>, def_id: DefId) -> Self {
cmp::min(
if let Some(def_id) = def_id.as_local() {
- let hir_id = find.tcx.hir().as_local_hir_id(def_id);
+ let hir_id = find.tcx.hir().local_def_id_to_hir_id(def_id);
find.access_levels.map.get(&hir_id).cloned()
} else {
Self::MAX
if let Res::Def(def_kind, def_id) = export.res {
let vis = def_id_visibility(self.tcx, def_id).0;
if let Some(def_id) = def_id.as_local() {
- let hir_id = self.tcx.hir().as_local_hir_id(def_id);
+ let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
self.update_macro_reachable_def(hir_id, def_kind, vis, defining_mod);
}
}
// there will be no corresponding item.
.filter(|def_id| def_id.index != CRATE_DEF_INDEX || def_id.krate != LOCAL_CRATE)
.and_then(|def_id| {
- def_id.as_local().map(|def_id| self.tcx.hir().as_local_hir_id(def_id))
+ def_id.as_local().map(|def_id| self.tcx.hir().local_def_id_to_hir_id(def_id))
})
.map(|module_hir_id| self.tcx.hir().expect_item(module_hir_id))
{
if export.vis == ty::Visibility::Public {
if let Some(def_id) = export.res.opt_def_id() {
if let Some(def_id) = def_id.as_local() {
- let hir_id = self.tcx.hir().as_local_hir_id(def_id);
+ let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
self.update(hir_id, Some(AccessLevel::Exported));
}
}
}
fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool {
if let Some(def_id) = def_id.as_local() {
- let hir_id = self.ev.tcx.hir().as_local_hir_id(def_id);
+ let hir_id = self.ev.tcx.hir().local_def_id_to_hir_id(def_id);
if let ((ty::Visibility::Public, ..), _)
| (_, Some(AccessLevel::ReachableFromImplTrait)) =
(def_id_visibility(self.tcx(), def_id.to_def_id()), self.access_level)
if let Some(did) = did.as_local() {
// .. and it corresponds to a private type in the AST (this returns
// `None` for type parameters).
- match self.tcx.hir().find(self.tcx.hir().as_local_hir_id(did)) {
+ match self.tcx.hir().find(self.tcx.hir().local_def_id_to_hir_id(did)) {
Some(Node::Item(ref item)) => !item.vis.node.is_pub(),
Some(_) | None => false,
}
let did = tr.path.res.def_id();
if let Some(did) = did.as_local() {
- self.trait_is_public(self.tcx.hir().as_local_hir_id(did))
+ self.trait_is_public(self.tcx.hir().local_def_id_to_hir_id(did))
} else {
true // external traits must be public
}
}
let hir_id = match def_id.as_local() {
- Some(def_id) => self.tcx.hir().as_local_hir_id(def_id),
+ Some(def_id) => self.tcx.hir().local_def_id_to_hir_id(def_id),
None => return false,
};
let ret = self.required_visibility == ty::Visibility::Public
&& self.tcx.is_private_dep(item_id.krate);
- log::debug!("leaks_private_dep(item_id={:?})={}", item_id, ret);
+ tracing::debug!("leaks_private_dep(item_id={:?})={}", item_id, ret);
ret
}
}