Address comments from review
This commit is contained in:
parent
bfce24aa67
commit
fe7531579d
@ -209,9 +209,8 @@ impl CodegenCx<'ll, 'tcx> {
|
||||
|
||||
debug!("get_static: sym={} instance={:?}", sym, instance);
|
||||
|
||||
let g = if let Some(id) =
|
||||
def_id.as_local().map(|def_id| self.tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
let g = if let Some(def_id) = def_id.as_local() {
|
||||
let id = self.tcx.hir().as_local_hir_id(def_id);
|
||||
let llty = self.layout_of(ty).llvm_type(self);
|
||||
let (g, attrs) = match self.tcx.hir().get(id) {
|
||||
Node::Item(&hir::Item { attrs, span, kind: hir::ItemKind::Static(..), .. }) => {
|
||||
|
@ -29,9 +29,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
) -> Option<(&hir::Ty<'_>, &hir::FnDecl<'_>)> {
|
||||
if let Some(anon_reg) = self.tcx().is_suitable_region(region) {
|
||||
let def_id = anon_reg.def_id;
|
||||
if let Some(hir_id) =
|
||||
def_id.as_local().map(|def_id| self.tcx().hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
let hir_id = self.tcx().hir().as_local_hir_id(def_id);
|
||||
let fndecl = match self.tcx().hir().get(hir_id) {
|
||||
Node::Item(&hir::Item { kind: hir::ItemKind::Fn(ref m, ..), .. })
|
||||
| Node::TraitItem(&hir::TraitItem {
|
||||
|
@ -46,9 +46,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
) = (&sub_origin, sup_region)
|
||||
{
|
||||
let hir = &self.tcx().hir();
|
||||
if let Some(hir_id) =
|
||||
free_region.scope.as_local().map(|def_id| hir.as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = free_region.scope.as_local() {
|
||||
let hir_id = hir.as_local_hir_id(def_id);
|
||||
if let Node::Expr(Expr { kind: Closure(_, _, _, closure_span, None), .. }) =
|
||||
hir.get(hir_id)
|
||||
{
|
||||
|
@ -436,9 +436,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
||||
// 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();
|
||||
if let Some(hir_id) =
|
||||
real_trait.as_local().map(|def_id| cx.tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = real_trait.as_local() {
|
||||
let hir_id = cx.tcx.hir().as_local_hir_id(def_id);
|
||||
if let Some(Node::Item(item)) = cx.tcx.hir().find(hir_id) {
|
||||
if let hir::VisibilityKind::Inherited = item.vis.node {
|
||||
for impl_item_ref in items {
|
||||
@ -611,10 +610,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations {
|
||||
let mut impls = HirIdSet::default();
|
||||
cx.tcx.for_each_impl(debug, |d| {
|
||||
if let Some(ty_def) = cx.tcx.type_of(d).ty_adt_def() {
|
||||
if let Some(hir_id) =
|
||||
ty_def.did.as_local().map(|def_id| cx.tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
impls.insert(hir_id);
|
||||
if let Some(def_id) = ty_def.did.as_local() {
|
||||
impls.insert(cx.tcx.hir().as_local_hir_id(def_id));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -482,7 +482,7 @@ impl<'hir> Map<'hir> {
|
||||
}
|
||||
|
||||
pub fn get_if_local(&self, id: DefId) -> Option<Node<'hir>> {
|
||||
if let Some(id) = id.as_local() { Some(self.get(self.as_local_hir_id(id))) } else { None }
|
||||
id.as_local().map(|id| self.get(self.as_local_hir_id(id)))
|
||||
}
|
||||
|
||||
pub fn get_generics(&self, id: DefId) -> Option<&'hir Generics<'hir>> {
|
||||
@ -883,7 +883,7 @@ impl<'hir> Map<'hir> {
|
||||
}
|
||||
|
||||
pub fn span_if_local(&self, id: DefId) -> Option<Span> {
|
||||
if let Some(id) = id.as_local() { Some(self.span(self.as_local_hir_id(id))) } else { None }
|
||||
id.as_local().map(|id| self.span(self.as_local_hir_id(id)))
|
||||
}
|
||||
|
||||
pub fn res_span(&self, res: Res) -> Option<Span> {
|
||||
@ -1082,11 +1082,6 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId) -> String {
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut Providers<'_>) {
|
||||
providers.def_kind = |tcx, def_id| {
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
tcx.hir().def_kind(tcx.hir().as_local_hir_id(def_id))
|
||||
} else {
|
||||
bug!("calling local def_kind query provider for upstream DefId: {:?}", def_id);
|
||||
}
|
||||
};
|
||||
providers.def_kind =
|
||||
|tcx, def_id| tcx.hir().def_kind(tcx.hir().as_local_hir_id(def_id.expect_local()));
|
||||
}
|
||||
|
@ -2338,14 +2338,13 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
||||
}
|
||||
|
||||
AggregateKind::Closure(def_id, substs) => ty::tls::with(|tcx| {
|
||||
if let Some(hir_id) =
|
||||
def_id.as_local().map(|def_id| tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id);
|
||||
let name = if tcx.sess.opts.debugging_opts.span_free_formats {
|
||||
let substs = tcx.lift(&substs).unwrap();
|
||||
format!(
|
||||
"[closure@{}]",
|
||||
tcx.def_path_str_with_substs(def_id, substs),
|
||||
tcx.def_path_str_with_substs(def_id.to_def_id(), substs),
|
||||
)
|
||||
} else {
|
||||
format!("[closure@{:?}]", tcx.hir().span(hir_id))
|
||||
@ -2366,9 +2365,8 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
||||
}),
|
||||
|
||||
AggregateKind::Generator(def_id, _, _) => ty::tls::with(|tcx| {
|
||||
if let Some(hir_id) =
|
||||
def_id.as_local().map(|def_id| tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id);
|
||||
let name = format!("[generator@{:?}]", tcx.hir().span(hir_id));
|
||||
let mut struct_fmt = fmt.debug_struct(&name);
|
||||
|
||||
|
@ -608,9 +608,8 @@ pub trait PrettyPrinter<'tcx>:
|
||||
}
|
||||
|
||||
// FIXME(eddyb) should use `def_span`.
|
||||
if let Some(hir_id) =
|
||||
did.as_local().map(|did| self.tcx().hir().as_local_hir_id(did))
|
||||
{
|
||||
if let Some(did) = did.as_local() {
|
||||
let hir_id = self.tcx().hir().as_local_hir_id(did);
|
||||
p!(write("@{:?}", self.tcx().hir().span(hir_id)));
|
||||
|
||||
if substs.as_generator().is_valid() {
|
||||
@ -654,11 +653,10 @@ pub trait PrettyPrinter<'tcx>:
|
||||
p!(write("[closure"));
|
||||
|
||||
// FIXME(eddyb) should use `def_span`.
|
||||
if let Some(hir_id) =
|
||||
did.as_local().map(|did| self.tcx().hir().as_local_hir_id(did))
|
||||
{
|
||||
if let Some(did) = did.as_local() {
|
||||
let hir_id = self.tcx().hir().as_local_hir_id(did);
|
||||
if self.tcx().sess.opts.debugging_opts.span_free_formats {
|
||||
p!(write("@"), print_def_path(did, substs));
|
||||
p!(write("@"), print_def_path(did.to_def_id(), substs));
|
||||
} else {
|
||||
p!(write("@{:?}", self.tcx().hir().span(hir_id)));
|
||||
}
|
||||
|
@ -864,11 +864,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
format!("`{}` would have to be valid for `{}`...", name, region_name),
|
||||
);
|
||||
|
||||
if let Some(fn_hir_id) = self
|
||||
.mir_def_id
|
||||
.as_local()
|
||||
.map(|def_id| self.infcx.tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = self.mir_def_id.as_local() {
|
||||
let fn_hir_id = self.infcx.tcx.hir().as_local_hir_id(def_id);
|
||||
err.span_label(
|
||||
drop_span,
|
||||
format!(
|
||||
|
@ -430,7 +430,8 @@ fn check_recursion_limit<'tcx>(
|
||||
// infinite expansion.
|
||||
if adjusted_recursion_depth > *tcx.sess.recursion_limit.get() {
|
||||
let error = format!("reached the recursion limit while instantiating `{}`", instance);
|
||||
if let Some(hir_id) = def_id.as_local().map(|def_id| tcx.hir().as_local_hir_id(def_id)) {
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id);
|
||||
tcx.sess.span_fatal(tcx.hir().span(hir_id), &error);
|
||||
} else {
|
||||
tcx.sess.fatal(&error);
|
||||
|
@ -537,9 +537,8 @@ impl DeadVisitor<'tcx> {
|
||||
let inherent_impls = self.tcx.inherent_impls(def_id);
|
||||
for &impl_did in inherent_impls.iter() {
|
||||
for &item_did in &self.tcx.associated_item_def_ids(impl_did)[..] {
|
||||
if let Some(item_hir_id) =
|
||||
item_did.as_local().map(|did| self.tcx.hir().as_local_hir_id(did))
|
||||
{
|
||||
if let Some(did) = item_did.as_local() {
|
||||
let item_hir_id = self.tcx.hir().as_local_hir_id(did);
|
||||
if self.live_symbols.contains(&item_hir_id) {
|
||||
return true;
|
||||
}
|
||||
|
@ -445,9 +445,8 @@ impl VisibilityLike for Option<AccessLevel> {
|
||||
const SHALLOW: bool = true;
|
||||
fn new_min(find: &FindMin<'_, '_, Self>, def_id: DefId) -> Self {
|
||||
cmp::min(
|
||||
if let Some(hir_id) =
|
||||
def_id.as_local().map(|def_id| find.tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
let hir_id = find.tcx.hir().as_local_hir_id(def_id);
|
||||
find.access_levels.map.get(&hir_id).cloned()
|
||||
} else {
|
||||
Self::MAX
|
||||
@ -549,9 +548,8 @@ impl EmbargoVisitor<'tcx> {
|
||||
if export.vis.is_accessible_from(defining_mod, self.tcx) {
|
||||
if let Res::Def(def_kind, def_id) = export.res {
|
||||
let vis = def_id_visibility(self.tcx, def_id).0;
|
||||
if let Some(hir_id) =
|
||||
def_id.as_local().map(|def_id| self.tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
let hir_id = self.tcx.hir().as_local_hir_id(def_id);
|
||||
self.update_macro_reachable_def(hir_id, def_kind, vis, defining_mod);
|
||||
}
|
||||
}
|
||||
@ -914,10 +912,8 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
||||
for export in exports.iter() {
|
||||
if export.vis == ty::Visibility::Public {
|
||||
if let Some(def_id) = export.res.opt_def_id() {
|
||||
if let Some(hir_id) = def_id
|
||||
.as_local()
|
||||
.map(|def_id| self.tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
let hir_id = self.tcx.hir().as_local_hir_id(def_id);
|
||||
self.update(hir_id, Some(AccessLevel::Exported));
|
||||
}
|
||||
}
|
||||
|
@ -596,10 +596,8 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||
// In the future, this should be fixed and this error should be removed.
|
||||
let def = self.map.defs.get(&lifetime.hir_id).cloned();
|
||||
if let Some(Region::LateBound(_, def_id, _)) = def {
|
||||
if let Some(hir_id) = def_id
|
||||
.as_local()
|
||||
.map(|def_id| self.tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
let hir_id = self.tcx.hir().as_local_hir_id(def_id);
|
||||
// Ensure that the parent of the def is an item, not HRTB
|
||||
let parent_id = self.tcx.hir().get_parent_node(hir_id);
|
||||
let parent_impl_id = hir::ImplItemId { hir_id: parent_id };
|
||||
@ -1559,10 +1557,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||
}
|
||||
|
||||
if let Some(parent_def_id) = self.tcx.parent(def_id) {
|
||||
if let Some(parent_hir_id) = parent_def_id
|
||||
.as_local()
|
||||
.map(|def_id| self.tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = parent_def_id.as_local() {
|
||||
let parent_hir_id = self.tcx.hir().as_local_hir_id(def_id);
|
||||
// lifetimes in `derive` expansions don't count (Issue #53738)
|
||||
if self
|
||||
.tcx
|
||||
@ -1959,9 +1955,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||
};
|
||||
|
||||
let map = &self.map;
|
||||
let unsubst = if let Some(id) =
|
||||
def_id.as_local().map(|def_id| self.tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
let unsubst = if let Some(def_id) = def_id.as_local() {
|
||||
let id = self.tcx.hir().as_local_hir_id(def_id);
|
||||
&map.object_lifetime_defaults[&id]
|
||||
} else {
|
||||
let tcx = self.tcx;
|
||||
|
@ -1036,9 +1036,8 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
|
||||
// let x = || foo(); // returns the Opaque assoc with `foo`
|
||||
// }
|
||||
// ```
|
||||
if let Some(opaque_hir_id) =
|
||||
def_id.as_local().map(|def_id| tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
let opaque_hir_id = tcx.hir().as_local_hir_id(def_id);
|
||||
let parent_def_id = self.parent_def_id;
|
||||
let def_scope_default = || {
|
||||
let opaque_parent_hir_id = tcx.hir().get_parent_item(opaque_hir_id);
|
||||
@ -1085,7 +1084,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
|
||||
),
|
||||
};
|
||||
if in_definition_scope {
|
||||
return self.fold_opaque_ty(ty, def_id, substs, origin);
|
||||
return self.fold_opaque_ty(ty, def_id.to_def_id(), substs, origin);
|
||||
}
|
||||
|
||||
debug!(
|
||||
|
@ -409,9 +409,8 @@ fn extract_spans_for_error_reporting<'a, 'tcx>(
|
||||
|
||||
match *terr {
|
||||
TypeError::Mutability => {
|
||||
if let Some(trait_m_hir_id) =
|
||||
trait_m.def_id.as_local().map(|def_id| tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = trait_m.def_id.as_local() {
|
||||
let trait_m_hir_id = tcx.hir().as_local_hir_id(def_id);
|
||||
let trait_m_iter = match tcx.hir().expect_trait_item(trait_m_hir_id).kind {
|
||||
TraitItemKind::Fn(ref trait_m_sig, _) => trait_m_sig.decl.inputs.iter(),
|
||||
_ => bug!("{:?} is not a TraitItemKind::Fn", trait_m),
|
||||
@ -438,9 +437,8 @@ fn extract_spans_for_error_reporting<'a, 'tcx>(
|
||||
}
|
||||
}
|
||||
TypeError::Sorts(ExpectedFound { .. }) => {
|
||||
if let Some(trait_m_hir_id) =
|
||||
trait_m.def_id.as_local().map(|def_id| tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = trait_m.def_id.as_local() {
|
||||
let trait_m_hir_id = tcx.hir().as_local_hir_id(def_id);
|
||||
let (trait_m_output, trait_m_iter) =
|
||||
match tcx.hir().expect_trait_item(trait_m_hir_id).kind {
|
||||
TraitItemKind::Fn(ref trait_m_sig, _) => {
|
||||
@ -591,9 +589,8 @@ fn compare_number_of_generics<'tcx>(
|
||||
if impl_count != trait_count {
|
||||
err_occurred = true;
|
||||
|
||||
let (trait_spans, impl_trait_spans) = if let Some(trait_hir_id) =
|
||||
trait_.def_id.as_local().map(|def_id| tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
let (trait_spans, impl_trait_spans) = if let Some(def_id) = trait_.def_id.as_local() {
|
||||
let trait_hir_id = tcx.hir().as_local_hir_id(def_id);
|
||||
let trait_item = tcx.hir().expect_trait_item(trait_hir_id);
|
||||
if trait_item.generics.params.is_empty() {
|
||||
(Some(vec![trait_item.generics.span]), vec![])
|
||||
|
@ -1052,9 +1052,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let generics = self.tcx.generics_of(table_owner.to_def_id());
|
||||
let type_param = generics.type_param(param, self.tcx);
|
||||
let hir = &self.tcx.hir();
|
||||
if let Some(id) =
|
||||
type_param.def_id.as_local().map(|def_id| hir.as_local_hir_id(def_id))
|
||||
{
|
||||
if let Some(def_id) = type_param.def_id.as_local() {
|
||||
let id = hir.as_local_hir_id(def_id);
|
||||
// Get the `hir::Param` to verify whether it already has any bounds.
|
||||
// We do this to avoid suggesting code that ends up as `T: FooBar`,
|
||||
// instead we suggest `T: Foo + Bar` in that case.
|
||||
|
@ -377,9 +377,8 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
|
||||
return;
|
||||
}
|
||||
|
||||
let (local, remote) = if let Some(id) =
|
||||
def_id.as_local().map(|def_id| self.tcx().hir().as_local_hir_id(def_id))
|
||||
{
|
||||
let (local, remote) = if let Some(def_id) = def_id.as_local() {
|
||||
let id = self.tcx().hir().as_local_hir_id(def_id);
|
||||
(Some(self.terms_cx.inferred_starts[&id]), None)
|
||||
} else {
|
||||
(None, Some(self.tcx().variances_of(def_id)))
|
||||
|
@ -340,7 +340,8 @@ pub fn build_impl(
|
||||
}
|
||||
}
|
||||
|
||||
let for_ = if let Some(hir_id) = did.as_local().map(|did| tcx.hir().as_local_hir_id(did)) {
|
||||
let for_ = if let Some(did) = did.as_local() {
|
||||
let hir_id = tcx.hir().as_local_hir_id(did);
|
||||
match tcx.hir().expect_item(hir_id).kind {
|
||||
hir::ItemKind::Impl { self_ty, .. } => self_ty.clean(cx),
|
||||
_ => panic!("did given to build_impl was not an impl"),
|
||||
@ -360,9 +361,8 @@ pub fn build_impl(
|
||||
}
|
||||
|
||||
let predicates = tcx.explicit_predicates_of(did);
|
||||
let (trait_items, generics) = if let Some(hir_id) =
|
||||
did.as_local().map(|did| tcx.hir().as_local_hir_id(did))
|
||||
{
|
||||
let (trait_items, generics) = if let Some(did) = did.as_local() {
|
||||
let hir_id = tcx.hir().as_local_hir_id(did);
|
||||
match tcx.hir().expect_item(hir_id).kind {
|
||||
hir::ItemKind::Impl { ref generics, ref items, .. } => (
|
||||
items.iter().map(|item| tcx.hir().impl_item(item.id).clean(cx)).collect::<Vec<_>>(),
|
||||
@ -488,7 +488,8 @@ fn build_module(cx: &DocContext<'_>, did: DefId, visited: &mut FxHashSet<DefId>)
|
||||
}
|
||||
|
||||
pub fn print_inlined_const(cx: &DocContext<'_>, did: DefId) -> String {
|
||||
if let Some(hir_id) = did.as_local().map(|did| cx.tcx.hir().as_local_hir_id(did)) {
|
||||
if let Some(did) = did.as_local() {
|
||||
let hir_id = cx.tcx.hir().as_local_hir_id(did);
|
||||
rustc_hir_pretty::id_to_string(&cx.tcx.hir(), hir_id)
|
||||
} else {
|
||||
cx.tcx.rendered_const(did)
|
||||
|
@ -1379,10 +1379,9 @@ impl Clean<Type> for hir::Ty<'_> {
|
||||
let mut alias = None;
|
||||
if let Res::Def(DefKind::TyAlias, def_id) = path.res {
|
||||
// Substitute private type aliases
|
||||
if let Some(hir_id) =
|
||||
def_id.as_local().map(|def_id| cx.tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
if !cx.renderinfo.borrow().access_levels.is_exported(def_id) {
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
let hir_id = cx.tcx.hir().as_local_hir_id(def_id);
|
||||
if !cx.renderinfo.borrow().access_levels.is_exported(def_id.to_def_id()) {
|
||||
alias = Some(&cx.tcx.hir().expect_item(hir_id).kind);
|
||||
}
|
||||
}
|
||||
|
@ -473,9 +473,8 @@ pub fn name_from_pat(p: &hir::Pat) -> String {
|
||||
pub fn print_const(cx: &DocContext<'_>, n: &'tcx ty::Const<'_>) -> String {
|
||||
match n.val {
|
||||
ty::ConstKind::Unevaluated(def_id, _, promoted) => {
|
||||
let mut s = if let Some(hir_id) =
|
||||
def_id.as_local().map(|def_id| cx.tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
let mut s = if let Some(def_id) = def_id.as_local() {
|
||||
let hir_id = cx.tcx.hir().as_local_hir_id(def_id);
|
||||
print_const_expr(cx, cx.tcx.hir().body_owned_by(hir_id))
|
||||
} else {
|
||||
inline::print_inlined_const(cx, def_id)
|
||||
|
@ -335,10 +335,8 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
|
||||
impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
|
||||
fn fold_item(&mut self, mut item: Item) -> Option<Item> {
|
||||
let item_hir_id = if item.is_mod() {
|
||||
if let Some(id) =
|
||||
item.def_id.as_local().map(|def_id| self.cx.tcx.hir().as_local_hir_id(def_id))
|
||||
{
|
||||
Some(id)
|
||||
if let Some(def_id) = item.def_id.as_local() {
|
||||
Some(self.cx.tcx.hir().as_local_hir_id(def_id))
|
||||
} else {
|
||||
debug!("attempting to fold on a non-local item: {:?}", item);
|
||||
return self.fold_item_recur(item);
|
||||
|
Loading…
x
Reference in New Issue
Block a user