Skip to content

Commit 7bf908a

Browse files
Remove is_import field
1 parent aa094a4 commit 7bf908a

File tree

6 files changed

+6
-14
lines changed

6 files changed

+6
-14
lines changed

src/librustc/hir/def.rs

-3
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ pub struct Export {
134134
/// The visibility of the export.
135135
/// We include non-`pub` exports for hygienic macros that get used from extern crates.
136136
pub vis: ty::Visibility,
137-
/// True if from a `use` or and `extern crate`.
138-
/// Used in rustdoc.
139-
pub is_import: bool,
140137
}
141138

142139
impl CtorKind {

src/librustc/ich/impls_hir.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1108,8 +1108,7 @@ impl_stable_hash_for!(struct hir::def::Export {
11081108
ident,
11091109
def,
11101110
vis,
1111-
span,
1112-
is_import
1111+
span
11131112
});
11141113

11151114
impl<'a> HashStable<StableHashingContext<'a>>

src/librustc_metadata/decoder.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,6 @@ impl<'a, 'tcx> CrateMetadata {
665665
def: def,
666666
vis: ty::Visibility::Public,
667667
span: DUMMY_SP,
668-
is_import: false,
669668
});
670669
}
671670
}
@@ -705,7 +704,6 @@ impl<'a, 'tcx> CrateMetadata {
705704
ident: Ident::from_interned_str(self.item_name(child_index)),
706705
vis: self.get_visibility(child_index),
707706
span: self.entry(child_index).span.decode((self, sess)),
708-
is_import: false,
709707
});
710708
}
711709
}
@@ -722,8 +720,7 @@ impl<'a, 'tcx> CrateMetadata {
722720
(self.get_def(child_index), def_key.disambiguated_data.data.get_opt_name()) {
723721
let ident = Ident::from_interned_str(name);
724722
let vis = self.get_visibility(child_index);
725-
let is_import = false;
726-
callback(def::Export { def, ident, vis, span, is_import });
723+
callback(def::Export { def, ident, vis, span });
727724
// For non-re-export structs and variants add their constructors to children.
728725
// Re-export lists automatically contain constructors when necessary.
729726
match def {
@@ -734,7 +731,7 @@ impl<'a, 'tcx> CrateMetadata {
734731
callback(def::Export {
735732
def: ctor_def,
736733
vis: self.get_visibility(ctor_def_id.index),
737-
ident, span, is_import,
734+
ident, span,
738735
});
739736
}
740737
}
@@ -744,7 +741,7 @@ impl<'a, 'tcx> CrateMetadata {
744741
let ctor_kind = self.get_ctor_kind(child_index);
745742
let ctor_def = Def::VariantCtor(def_id, ctor_kind);
746743
let vis = self.get_visibility(child_index);
747-
callback(def::Export { def: ctor_def, ident, vis, span, is_import });
744+
callback(def::Export { def: ctor_def, ident, vis, span });
748745
}
749746
_ => {}
750747
}

src/librustc_resolve/macros.rs

-1
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,6 @@ impl<'a> Resolver<'a> {
803803
def: def,
804804
vis: ty::Visibility::Public,
805805
span: item.span,
806-
is_import: false,
807806
});
808807
} else {
809808
self.unused_macros.insert(def_id);

src/librustc_resolve/resolve_imports.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,6 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
10081008
def: def,
10091009
span: binding.span,
10101010
vis: binding.vis,
1011-
is_import: true,
10121011
});
10131012
}
10141013
}

src/librustdoc/visit_lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ impl<'a, 'tcx, 'rcx> LibEmbargoVisitor<'a, 'tcx, 'rcx> {
6868
}
6969

7070
for item in self.cx.tcx.item_children(def_id).iter() {
71-
if !item.is_import || item.vis == Visibility::Public {
71+
if self.cx.tcx.def_key(item.def.def_id()).parent.map_or(false, |d| d != def_id.index) ||
72+
item.vis == Visibility::Public {
7273
self.visit_item(item.def);
7374
}
7475
}

0 commit comments

Comments
 (0)