Remove is_import field
This commit is contained in:
parent
3575be60ea
commit
19e0b7da1c
6 changed files with 6 additions and 14 deletions
|
@ -134,9 +134,6 @@ pub struct Export {
|
||||||
/// The visibility of the export.
|
/// The visibility of the export.
|
||||||
/// We include non-`pub` exports for hygienic macros that get used from extern crates.
|
/// We include non-`pub` exports for hygienic macros that get used from extern crates.
|
||||||
pub vis: ty::Visibility,
|
pub vis: ty::Visibility,
|
||||||
/// True if from a `use` or and `extern crate`.
|
|
||||||
/// Used in rustdoc.
|
|
||||||
pub is_import: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CtorKind {
|
impl CtorKind {
|
||||||
|
|
|
@ -1115,8 +1115,7 @@ impl_stable_hash_for!(struct hir::def::Export {
|
||||||
ident,
|
ident,
|
||||||
def,
|
def,
|
||||||
vis,
|
vis,
|
||||||
span,
|
span
|
||||||
is_import
|
|
||||||
});
|
});
|
||||||
|
|
||||||
impl<'a> HashStable<StableHashingContext<'a>>
|
impl<'a> HashStable<StableHashingContext<'a>>
|
||||||
|
|
|
@ -665,7 +665,6 @@ impl<'a, 'tcx> CrateMetadata {
|
||||||
def: def,
|
def: def,
|
||||||
vis: ty::Visibility::Public,
|
vis: ty::Visibility::Public,
|
||||||
span: DUMMY_SP,
|
span: DUMMY_SP,
|
||||||
is_import: false,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -705,7 +704,6 @@ impl<'a, 'tcx> CrateMetadata {
|
||||||
ident: Ident::from_interned_str(self.item_name(child_index)),
|
ident: Ident::from_interned_str(self.item_name(child_index)),
|
||||||
vis: self.get_visibility(child_index),
|
vis: self.get_visibility(child_index),
|
||||||
span: self.entry(child_index).span.decode((self, sess)),
|
span: self.entry(child_index).span.decode((self, sess)),
|
||||||
is_import: false,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -722,8 +720,7 @@ impl<'a, 'tcx> CrateMetadata {
|
||||||
(self.get_def(child_index), def_key.disambiguated_data.data.get_opt_name()) {
|
(self.get_def(child_index), def_key.disambiguated_data.data.get_opt_name()) {
|
||||||
let ident = Ident::from_interned_str(name);
|
let ident = Ident::from_interned_str(name);
|
||||||
let vis = self.get_visibility(child_index);
|
let vis = self.get_visibility(child_index);
|
||||||
let is_import = false;
|
callback(def::Export { def, ident, vis, span });
|
||||||
callback(def::Export { def, ident, vis, span, is_import });
|
|
||||||
// For non-re-export structs and variants add their constructors to children.
|
// For non-re-export structs and variants add their constructors to children.
|
||||||
// Re-export lists automatically contain constructors when necessary.
|
// Re-export lists automatically contain constructors when necessary.
|
||||||
match def {
|
match def {
|
||||||
|
@ -734,7 +731,7 @@ impl<'a, 'tcx> CrateMetadata {
|
||||||
callback(def::Export {
|
callback(def::Export {
|
||||||
def: ctor_def,
|
def: ctor_def,
|
||||||
vis: self.get_visibility(ctor_def_id.index),
|
vis: self.get_visibility(ctor_def_id.index),
|
||||||
ident, span, is_import,
|
ident, span,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -744,7 +741,7 @@ impl<'a, 'tcx> CrateMetadata {
|
||||||
let ctor_kind = self.get_ctor_kind(child_index);
|
let ctor_kind = self.get_ctor_kind(child_index);
|
||||||
let ctor_def = Def::VariantCtor(def_id, ctor_kind);
|
let ctor_def = Def::VariantCtor(def_id, ctor_kind);
|
||||||
let vis = self.get_visibility(child_index);
|
let vis = self.get_visibility(child_index);
|
||||||
callback(def::Export { def: ctor_def, ident, vis, span, is_import });
|
callback(def::Export { def: ctor_def, ident, vis, span });
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -803,7 +803,6 @@ impl<'a> Resolver<'a> {
|
||||||
def: def,
|
def: def,
|
||||||
vis: ty::Visibility::Public,
|
vis: ty::Visibility::Public,
|
||||||
span: item.span,
|
span: item.span,
|
||||||
is_import: false,
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
self.unused_macros.insert(def_id);
|
self.unused_macros.insert(def_id);
|
||||||
|
|
|
@ -1008,7 +1008,6 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
|
||||||
def: def,
|
def: def,
|
||||||
span: binding.span,
|
span: binding.span,
|
||||||
vis: binding.vis,
|
vis: binding.vis,
|
||||||
is_import: true,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,8 @@ impl<'a, 'tcx, 'rcx> LibEmbargoVisitor<'a, 'tcx, 'rcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
for item in self.cx.tcx.item_children(def_id).iter() {
|
for item in self.cx.tcx.item_children(def_id).iter() {
|
||||||
if !item.is_import || item.vis == Visibility::Public {
|
if self.cx.tcx.def_key(item.def.def_id()).parent.map_or(false, |d| d == def_id.index) ||
|
||||||
|
item.vis == Visibility::Public {
|
||||||
self.visit_item(item.def);
|
self.visit_item(item.def);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue