Remove ForeignMod struct.
This commit is contained in:
parent
419a9186a4
commit
032f68d625
@ -316,7 +316,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
})
|
||||
}
|
||||
ItemKind::Mod(ref m) => hir::ItemKind::Mod(self.lower_mod(m)),
|
||||
ItemKind::ForeignMod(ref nm) => hir::ItemKind::ForeignMod(self.lower_foreign_mod(nm)),
|
||||
ItemKind::ForeignMod(ref fm) => hir::ItemKind::ForeignMod {
|
||||
abi: fm.abi.map_or(abi::Abi::C, |abi| self.lower_abi(abi)),
|
||||
items: self
|
||||
.arena
|
||||
.alloc_from_iter(fm.items.iter().map(|x| self.lower_foreign_item_ref(x))),
|
||||
},
|
||||
ItemKind::GlobalAsm(ref ga) => hir::ItemKind::GlobalAsm(self.lower_global_asm(ga)),
|
||||
ItemKind::TyAlias(_, ref gen, _, Some(ref ty)) => {
|
||||
// We lower
|
||||
@ -725,15 +730,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
}
|
||||
}
|
||||
|
||||
fn lower_foreign_mod(&mut self, fm: &ForeignMod) -> hir::ForeignMod<'hir> {
|
||||
hir::ForeignMod {
|
||||
abi: fm.abi.map_or(abi::Abi::C, |abi| self.lower_abi(abi)),
|
||||
items: self
|
||||
.arena
|
||||
.alloc_from_iter(fm.items.iter().map(|x| self.lower_foreign_item_ref(x))),
|
||||
}
|
||||
}
|
||||
|
||||
fn lower_global_asm(&mut self, ga: &GlobalAsm) -> &'hir hir::GlobalAsm {
|
||||
self.arena.alloc(hir::GlobalAsm { asm: ga.asm })
|
||||
}
|
||||
|
@ -2284,12 +2284,6 @@ pub struct Mod<'hir> {
|
||||
pub item_ids: &'hir [ItemId],
|
||||
}
|
||||
|
||||
#[derive(Debug, HashStable_Generic)]
|
||||
pub struct ForeignMod<'hir> {
|
||||
pub abi: Abi,
|
||||
pub items: &'hir [ForeignItemRef<'hir>],
|
||||
}
|
||||
|
||||
#[derive(Encodable, Debug, HashStable_Generic)]
|
||||
pub struct GlobalAsm {
|
||||
pub asm: Symbol,
|
||||
@ -2536,7 +2530,7 @@ pub enum ItemKind<'hir> {
|
||||
/// A module.
|
||||
Mod(Mod<'hir>),
|
||||
/// An external module, e.g. `extern { .. }`.
|
||||
ForeignMod(ForeignMod<'hir>),
|
||||
ForeignMod { abi: Abi, items: &'hir [ForeignItemRef<'hir>] },
|
||||
/// Module-level inline assembly (from `global_asm!`).
|
||||
GlobalAsm(&'hir GlobalAsm),
|
||||
/// A type alias, e.g., `type Foo = Bar<u8>`.
|
||||
|
@ -589,9 +589,9 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
|
||||
// `visit_mod()` takes care of visiting the `Item`'s `HirId`.
|
||||
visitor.visit_mod(module, item.span, item.hir_id)
|
||||
}
|
||||
ItemKind::ForeignMod(ref foreign_module) => {
|
||||
ItemKind::ForeignMod { abi: _, items } => {
|
||||
visitor.visit_id(item.hir_id);
|
||||
walk_list!(visitor, visit_foreign_item_ref, foreign_module.items);
|
||||
walk_list!(visitor, visit_foreign_item_ref, items);
|
||||
}
|
||||
ItemKind::GlobalAsm(_) => {
|
||||
visitor.visit_id(item.hir_id);
|
||||
|
@ -91,7 +91,7 @@ impl Target {
|
||||
ItemKind::Const(..) => Target::Const,
|
||||
ItemKind::Fn(..) => Target::Fn,
|
||||
ItemKind::Mod(..) => Target::Mod,
|
||||
ItemKind::ForeignMod(..) => Target::ForeignMod,
|
||||
ItemKind::ForeignMod { .. } => Target::ForeignMod,
|
||||
ItemKind::GlobalAsm(..) => Target::GlobalAsm,
|
||||
ItemKind::TyAlias(..) => Target::TyAlias,
|
||||
ItemKind::OpaqueTy(..) => Target::OpaqueTy,
|
||||
|
@ -352,13 +352,6 @@ impl<'a> State<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_foreign_mod(&mut self, nmod: &hir::ForeignMod<'_>, attrs: &[ast::Attribute]) {
|
||||
self.print_inner_attributes(attrs);
|
||||
for item in nmod.items {
|
||||
self.ann.nested(self, Nested::ForeignItem(item.id));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_opt_lifetime(&mut self, lifetime: &hir::Lifetime) {
|
||||
if !lifetime.is_elided() {
|
||||
self.print_lifetime(lifetime);
|
||||
@ -647,11 +640,14 @@ impl<'a> State<'a> {
|
||||
self.print_mod(_mod, &item.attrs);
|
||||
self.bclose(item.span);
|
||||
}
|
||||
hir::ItemKind::ForeignMod(ref nmod) => {
|
||||
hir::ItemKind::ForeignMod { abi, items } => {
|
||||
self.head("extern");
|
||||
self.word_nbsp(nmod.abi.to_string());
|
||||
self.word_nbsp(abi.to_string());
|
||||
self.bopen();
|
||||
self.print_foreign_mod(nmod, &item.attrs);
|
||||
self.print_inner_attributes(item.attrs);
|
||||
for item in items {
|
||||
self.ann.nested(self, Nested::ForeignItem(item.id));
|
||||
}
|
||||
self.bclose(item.span);
|
||||
}
|
||||
hir::ItemKind::GlobalAsm(ref ga) => {
|
||||
|
@ -280,7 +280,7 @@ impl DirtyCleanVisitor<'tcx> {
|
||||
HirItem::Mod(..) => ("ItemMod", LABELS_HIR_ONLY),
|
||||
|
||||
// // An external module
|
||||
HirItem::ForeignMod(..) => ("ItemForeignMod", LABELS_HIR_ONLY),
|
||||
HirItem::ForeignMod { .. } => ("ItemForeignMod", LABELS_HIR_ONLY),
|
||||
|
||||
// Module-level inline assembly (from global_asm!)
|
||||
HirItem::GlobalAsm(..) => ("ItemGlobalAsm", LABELS_HIR_ONLY),
|
||||
|
@ -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(..)
|
||||
|
@ -205,7 +205,7 @@ impl<'hir> Map<'hir> {
|
||||
ItemKind::TraitAlias(..) => DefKind::TraitAlias,
|
||||
ItemKind::ExternCrate(_) => DefKind::ExternCrate,
|
||||
ItemKind::Use(..) => DefKind::Use,
|
||||
ItemKind::ForeignMod(..) => DefKind::ForeignMod,
|
||||
ItemKind::ForeignMod { .. } => DefKind::ForeignMod,
|
||||
ItemKind::GlobalAsm(..) => DefKind::GlobalAsm,
|
||||
ItemKind::Impl { .. } => DefKind::Impl,
|
||||
},
|
||||
@ -729,10 +729,11 @@ impl<'hir> Map<'hir> {
|
||||
let parent = self.get_parent_item(hir_id);
|
||||
if let Some(entry) = self.find_entry(parent) {
|
||||
if let Entry {
|
||||
node: Node::Item(Item { kind: ItemKind::ForeignMod(ref nm), .. }), ..
|
||||
node: Node::Item(Item { kind: ItemKind::ForeignMod { abi, .. }, .. }),
|
||||
..
|
||||
} = entry
|
||||
{
|
||||
return nm.abi;
|
||||
return *abi;
|
||||
}
|
||||
}
|
||||
bug!("expected foreign mod or inlined parent, found {}", self.node_to_string(parent))
|
||||
@ -1045,7 +1046,7 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId) -> String {
|
||||
ItemKind::Const(..) => "const",
|
||||
ItemKind::Fn(..) => "fn",
|
||||
ItemKind::Mod(..) => "mod",
|
||||
ItemKind::ForeignMod(..) => "foreign mod",
|
||||
ItemKind::ForeignMod { .. } => "foreign mod",
|
||||
ItemKind::GlobalAsm(..) => "global asm",
|
||||
ItemKind::TyAlias(..) => "ty",
|
||||
ItemKind::OpaqueTy(..) => "opaque type",
|
||||
|
@ -993,7 +993,7 @@ impl ItemLikeVisitor<'v> for RootCollector<'_, 'v> {
|
||||
match item.kind {
|
||||
hir::ItemKind::ExternCrate(..)
|
||||
| hir::ItemKind::Use(..)
|
||||
| hir::ItemKind::ForeignMod(..)
|
||||
| hir::ItemKind::ForeignMod { .. }
|
||||
| hir::ItemKind::TyAlias(..)
|
||||
| hir::ItemKind::Trait(..)
|
||||
| hir::ItemKind::TraitAlias(..)
|
||||
|
@ -190,7 +190,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
|
||||
|
||||
intravisit::walk_item(self, &item);
|
||||
}
|
||||
hir::ItemKind::ForeignMod(..) => {}
|
||||
hir::ItemKind::ForeignMod { .. } => {}
|
||||
_ => {
|
||||
intravisit::walk_item(self, &item);
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ impl<'tcx> ReachableContext<'tcx> {
|
||||
| hir::ItemKind::TyAlias(..)
|
||||
| hir::ItemKind::Static(..)
|
||||
| hir::ItemKind::Mod(..)
|
||||
| hir::ItemKind::ForeignMod(..)
|
||||
| hir::ItemKind::ForeignMod { .. }
|
||||
| hir::ItemKind::Impl { .. }
|
||||
| hir::ItemKind::Trait(..)
|
||||
| hir::ItemKind::TraitAlias(..)
|
||||
|
@ -326,7 +326,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
|
||||
// they don't have their own stability. They still can be annotated as unstable
|
||||
// and propagate this unstability to children, but this annotation is completely
|
||||
// optional. They inherit stability from their parents when unannotated.
|
||||
hir::ItemKind::Impl { of_trait: None, .. } | hir::ItemKind::ForeignMod(..) => {
|
||||
hir::ItemKind::Impl { of_trait: None, .. } | hir::ItemKind::ForeignMod { .. } => {
|
||||
self.in_trait_impl = false;
|
||||
kind = AnnotationKind::Container;
|
||||
}
|
||||
@ -499,7 +499,7 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> {
|
||||
// optional. They inherit stability from their parents when unannotated.
|
||||
if !matches!(
|
||||
i.kind,
|
||||
hir::ItemKind::Impl { of_trait: None, .. } | hir::ItemKind::ForeignMod(..)
|
||||
hir::ItemKind::Impl { of_trait: None, .. } | hir::ItemKind::ForeignMod{..}
|
||||
) {
|
||||
self.check_missing_stability(i.hir_id, i.span);
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
||||
Option::<AccessLevel>::of_impl(item.hir_id, self.tcx, &self.access_levels)
|
||||
}
|
||||
// Foreign modules inherit level from parents.
|
||||
hir::ItemKind::ForeignMod(..) => self.prev_level,
|
||||
hir::ItemKind::ForeignMod { .. } => self.prev_level,
|
||||
// Other `pub` items inherit levels from parents.
|
||||
hir::ItemKind::Const(..)
|
||||
| hir::ItemKind::Enum(..)
|
||||
@ -654,8 +654,8 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
hir::ItemKind::ForeignMod(ref foreign_mod) => {
|
||||
for foreign_item in foreign_mod.items {
|
||||
hir::ItemKind::ForeignMod { items, .. } => {
|
||||
for foreign_item in items {
|
||||
if foreign_item.vis.node.is_pub() {
|
||||
self.update(foreign_item.id.hir_id, item_level);
|
||||
}
|
||||
@ -770,8 +770,8 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
// Visit everything, but foreign items have their own levels.
|
||||
hir::ItemKind::ForeignMod(ref foreign_mod) => {
|
||||
for foreign_item in foreign_mod.items {
|
||||
hir::ItemKind::ForeignMod { items, .. } => {
|
||||
for foreign_item in items {
|
||||
let foreign_item_level = self.get(foreign_item.id.hir_id);
|
||||
if foreign_item_level.is_some() {
|
||||
self.reach(foreign_item.id.hir_id, foreign_item_level)
|
||||
@ -1430,7 +1430,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
|
||||
// An `extern {}` doesn't introduce a new privacy
|
||||
// namespace (the contents have their own privacies).
|
||||
hir::ItemKind::ForeignMod(_) => {}
|
||||
hir::ItemKind::ForeignMod { .. } => {}
|
||||
|
||||
hir::ItemKind::Trait(.., ref bounds, _) => {
|
||||
if !self.trait_is_public(item.hir_id) {
|
||||
@ -1948,8 +1948,8 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx>
|
||||
}
|
||||
}
|
||||
// Subitems of foreign modules have their own publicity.
|
||||
hir::ItemKind::ForeignMod(ref foreign_mod) => {
|
||||
for foreign_item in foreign_mod.items {
|
||||
hir::ItemKind::ForeignMod { items, .. } => {
|
||||
for foreign_item in items {
|
||||
let vis = tcx.visibility(tcx.hir().local_def_id(foreign_item.id.hir_id));
|
||||
self.check(foreign_item.id.hir_id, vis).generics().predicates().ty();
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||
hir::ItemKind::ExternCrate(_)
|
||||
| hir::ItemKind::Use(..)
|
||||
| hir::ItemKind::Mod(..)
|
||||
| hir::ItemKind::ForeignMod(..)
|
||||
| hir::ItemKind::ForeignMod { .. }
|
||||
| hir::ItemKind::GlobalAsm(..) => {
|
||||
// These sorts of items have no lifetime parameters at all.
|
||||
intravisit::walk_item(self, item);
|
||||
|
@ -550,7 +550,7 @@ impl<'hir> Sig for hir::Item<'hir> {
|
||||
|
||||
// FIXME where clause
|
||||
}
|
||||
hir::ItemKind::ForeignMod(_) => Err("extern mod"),
|
||||
hir::ItemKind::ForeignMod { .. } => Err("extern mod"),
|
||||
hir::ItemKind::GlobalAsm(_) => Err("global asm"),
|
||||
hir::ItemKind::ExternCrate(_) => Err("extern crate"),
|
||||
hir::ItemKind::OpaqueTy(..) => Err("opaque type"),
|
||||
|
@ -746,21 +746,21 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item<'tcx>) {
|
||||
let generics = tcx.generics_of(def_id);
|
||||
check_type_params_are_used(tcx, &generics, pty_ty);
|
||||
}
|
||||
hir::ItemKind::ForeignMod(ref m) => {
|
||||
check_abi(tcx, it.span, m.abi);
|
||||
hir::ItemKind::ForeignMod { abi, items } => {
|
||||
check_abi(tcx, it.span, abi);
|
||||
|
||||
if m.abi == Abi::RustIntrinsic {
|
||||
for item in m.items {
|
||||
if abi == Abi::RustIntrinsic {
|
||||
for item in items {
|
||||
let item = tcx.hir().foreign_item(item.id);
|
||||
intrinsic::check_intrinsic_type(tcx, item);
|
||||
}
|
||||
} else if m.abi == Abi::PlatformIntrinsic {
|
||||
for item in m.items {
|
||||
} else if abi == Abi::PlatformIntrinsic {
|
||||
for item in items {
|
||||
let item = tcx.hir().foreign_item(item.id);
|
||||
intrinsic::check_platform_intrinsic_type(tcx, item);
|
||||
}
|
||||
} else {
|
||||
for item in m.items {
|
||||
for item in items {
|
||||
let def_id = tcx.hir().local_def_id(item.id.hir_id);
|
||||
let generics = tcx.generics_of(def_id);
|
||||
let own_counts = generics.own_counts();
|
||||
@ -796,7 +796,7 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item<'tcx>) {
|
||||
let item = tcx.hir().foreign_item(item.id);
|
||||
match item.kind {
|
||||
hir::ForeignItemKind::Fn(ref fn_decl, _, _) => {
|
||||
require_c_abi_if_c_variadic(tcx, fn_decl, m.abi, item.span);
|
||||
require_c_abi_if_c_variadic(tcx, fn_decl, abi, item.span);
|
||||
}
|
||||
hir::ForeignItemKind::Static(..) => {
|
||||
check_static_inhabited(tcx, def_id, item.span);
|
||||
|
@ -156,8 +156,8 @@ pub fn check_item_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
hir::ItemKind::Const(ref ty, ..) => {
|
||||
check_item_type(tcx, item.hir_id, ty.span, false);
|
||||
}
|
||||
hir::ItemKind::ForeignMod(ref module) => {
|
||||
for it in module.items.iter() {
|
||||
hir::ItemKind::ForeignMod { items, .. } => {
|
||||
for it in items.iter() {
|
||||
let it = tcx.hir().foreign_item(it.id);
|
||||
match it.kind {
|
||||
hir::ForeignItemKind::Fn(ref decl, ..) => {
|
||||
|
@ -646,8 +646,8 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::HirId) {
|
||||
| hir::ItemKind::Use(..)
|
||||
| hir::ItemKind::Mod(_)
|
||||
| hir::ItemKind::GlobalAsm(_) => {}
|
||||
hir::ItemKind::ForeignMod(ref foreign_mod) => {
|
||||
for item in foreign_mod.items {
|
||||
hir::ItemKind::ForeignMod { items, .. } => {
|
||||
for item in items {
|
||||
let item = tcx.hir().foreign_item(item.id);
|
||||
let def_id = tcx.hir().local_def_id(item.hir_id);
|
||||
tcx.ensure().generics_of(def_id);
|
||||
|
@ -259,7 +259,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||
ItemKind::Trait(..)
|
||||
| ItemKind::TraitAlias(..)
|
||||
| ItemKind::Mod(..)
|
||||
| ItemKind::ForeignMod(..)
|
||||
| ItemKind::ForeignMod { .. }
|
||||
| ItemKind::GlobalAsm(..)
|
||||
| ItemKind::ExternCrate(..)
|
||||
| ItemKind::Use(..) => {
|
||||
|
@ -240,8 +240,8 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
match item.kind {
|
||||
hir::ItemKind::ForeignMod(ref fm) => {
|
||||
for item in fm.items {
|
||||
hir::ItemKind::ForeignMod { items, .. } => {
|
||||
for item in items {
|
||||
let item = self.cx.tcx.hir().foreign_item(item.id);
|
||||
self.visit_foreign_item(item, None, om);
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
|
||||
hir::ItemKind::Union(..) => "a union",
|
||||
hir::ItemKind::OpaqueTy(..) => "an existential type",
|
||||
hir::ItemKind::ExternCrate(..)
|
||||
| hir::ItemKind::ForeignMod(..)
|
||||
| hir::ItemKind::ForeignMod { .. }
|
||||
| hir::ItemKind::GlobalAsm(..)
|
||||
| hir::ItemKind::Impl { .. }
|
||||
| hir::ItemKind::Use(..) => return,
|
||||
|
@ -125,7 +125,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
|
||||
| hir::ItemKind::Union(..)
|
||||
| hir::ItemKind::OpaqueTy(..)
|
||||
| hir::ItemKind::ExternCrate(..)
|
||||
| hir::ItemKind::ForeignMod(..)
|
||||
| hir::ItemKind::ForeignMod { .. }
|
||||
| hir::ItemKind::Impl { .. }
|
||||
| hir::ItemKind::Use(..) => {},
|
||||
};
|
||||
|
@ -395,7 +395,7 @@ fn print_item(cx: &LateContext<'_>, item: &hir::Item<'_>) {
|
||||
println!("function of type {:#?}", item_ty);
|
||||
},
|
||||
hir::ItemKind::Mod(..) => println!("module"),
|
||||
hir::ItemKind::ForeignMod(ref fm) => println!("foreign module with abi: {}", fm.abi),
|
||||
hir::ItemKind::ForeignMod { abi, .. } => println!("foreign module with abi: {}", abi),
|
||||
hir::ItemKind::GlobalAsm(ref asm) => println!("global asm: {:?}", asm),
|
||||
hir::ItemKind::TyAlias(..) => {
|
||||
println!("type alias for {:?}", cx.tcx.type_of(did));
|
||||
|
Loading…
x
Reference in New Issue
Block a user