Remove ForeignMod struct.
This commit is contained in:
parent
419a9186a4
commit
032f68d625
26 changed files with 69 additions and 85 deletions
|
@ -16,16 +16,13 @@ struct Collector<'tcx> {
|
|||
|
||||
impl ItemLikeVisitor<'tcx> for Collector<'tcx> {
|
||||
fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) {
|
||||
let fm = match it.kind {
|
||||
hir::ItemKind::ForeignMod(ref fm) => fm,
|
||||
let items = match it.kind {
|
||||
hir::ItemKind::ForeignMod { items, .. } => items,
|
||||
_ => return,
|
||||
};
|
||||
|
||||
let foreign_items = fm
|
||||
.items
|
||||
.iter()
|
||||
.map(|it| self.tcx.hir().local_def_id(it.id.hir_id).to_def_id())
|
||||
.collect();
|
||||
let foreign_items =
|
||||
items.iter().map(|it| self.tcx.hir().local_def_id(it.id.hir_id).to_def_id()).collect();
|
||||
self.modules.push(ForeignModule {
|
||||
foreign_items,
|
||||
def_id: self.tcx.hir().local_def_id(it.hir_id).to_def_id(),
|
||||
|
|
|
@ -26,11 +26,11 @@ struct Collector<'tcx> {
|
|||
|
||||
impl<'tcx> ItemLikeVisitor<'tcx> for Collector<'tcx> {
|
||||
fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) {
|
||||
let fm = match it.kind {
|
||||
hir::ItemKind::ForeignMod(ref fm) => fm,
|
||||
let abi = match it.kind {
|
||||
hir::ItemKind::ForeignMod { abi, .. } => abi,
|
||||
_ => return,
|
||||
};
|
||||
if fm.abi == Abi::Rust || fm.abi == Abi::RustIntrinsic || fm.abi == Abi::PlatformIntrinsic {
|
||||
if abi == Abi::Rust || abi == Abi::RustIntrinsic || abi == Abi::PlatformIntrinsic {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,12 +33,12 @@ struct Collector<'tcx> {
|
|||
|
||||
impl ItemLikeVisitor<'tcx> for Collector<'tcx> {
|
||||
fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) {
|
||||
let fm = match it.kind {
|
||||
hir::ItemKind::ForeignMod(ref fm) => fm,
|
||||
let abi = match it.kind {
|
||||
hir::ItemKind::ForeignMod { abi, .. } => abi,
|
||||
_ => return,
|
||||
};
|
||||
|
||||
if fm.abi == Abi::Rust || fm.abi == Abi::RustIntrinsic || fm.abi == Abi::PlatformIntrinsic {
|
||||
if abi == Abi::Rust || abi == Abi::RustIntrinsic || abi == Abi::PlatformIntrinsic {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1225,7 +1225,7 @@ impl EncodeContext<'a, 'tcx> {
|
|||
hir::ItemKind::Mod(ref m) => {
|
||||
return self.encode_info_for_mod(item.hir_id, m, &item.attrs);
|
||||
}
|
||||
hir::ItemKind::ForeignMod(_) => EntryKind::ForeignMod,
|
||||
hir::ItemKind::ForeignMod{..} => EntryKind::ForeignMod,
|
||||
hir::ItemKind::GlobalAsm(..) => EntryKind::GlobalAsm,
|
||||
hir::ItemKind::TyAlias(..) => EntryKind::Type,
|
||||
hir::ItemKind::OpaqueTy(..) => {
|
||||
|
@ -1320,8 +1320,8 @@ impl EncodeContext<'a, 'tcx> {
|
|||
record!(self.tables.expn_that_defined[def_id] <- self.tcx.expansion_that_defined(def_id));
|
||||
// FIXME(eddyb) there should be a nicer way to do this.
|
||||
match item.kind {
|
||||
hir::ItemKind::ForeignMod(ref fm) => record!(self.tables.children[def_id] <-
|
||||
fm.items
|
||||
hir::ItemKind::ForeignMod { items, .. } => record!(self.tables.children[def_id] <-
|
||||
items
|
||||
.iter()
|
||||
.map(|foreign_item| tcx.hir().local_def_id(
|
||||
foreign_item.id.hir_id).local_def_index)
|
||||
|
@ -1836,7 +1836,7 @@ impl EncodeContext<'a, 'tcx> {
|
|||
| hir::ItemKind::Const(..)
|
||||
| hir::ItemKind::Fn(..)
|
||||
| hir::ItemKind::Mod(..)
|
||||
| hir::ItemKind::ForeignMod(..)
|
||||
| hir::ItemKind::ForeignMod { .. }
|
||||
| hir::ItemKind::GlobalAsm(..)
|
||||
| hir::ItemKind::ExternCrate(..)
|
||||
| hir::ItemKind::Use(..)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue