diff options
| author | Mark Simulacrum <mark.simulacrum@gmail.com> | 2018-06-03 18:18:02 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-03 18:18:02 -0600 |
| commit | df137907560e43b21bb598116ccd1adb073b2b4c (patch) | |
| tree | d1ae90a0c309d511ebed50234ffb1e32ea722035 | |
| parent | 29f48ccf396be031ee8a54e74a3a4e81866c8872 (diff) | |
| parent | 19e0b7da1c0ccabf93bcdc94c78c49b9359484c3 (diff) | |
| download | rust-df137907560e43b21bb598116ccd1adb073b2b4c.tar.gz rust-df137907560e43b21bb598116ccd1adb073b2b4c.zip | |
Rollup merge of #51288 - Mark-Simulacrum:delete-is-import, r=eddyb
Remove rustdoc-specific is_import field from HIR Fixes #47100. I believe that there is no need to check for the name being the same, as this part of rustdoc seems to be strictly interested in exploring "public modules." Re-exports from the same module cannot visit another module; and, re-exports cannot export items with a greater visibility than that item declares. Therefore, I think this code is either sufficient, or in fact does more than is necessary, depending on whether rustdoc cares about the re-export itself. r? @eddyb
| -rw-r--r-- | src/librustc/hir/def.rs | 3 | ||||
| -rw-r--r-- | src/librustc/ich/impls_hir.rs | 3 | ||||
| -rw-r--r-- | src/librustc_metadata/decoder.rs | 9 | ||||
| -rw-r--r-- | src/librustc_resolve/macros.rs | 1 | ||||
| -rw-r--r-- | src/librustc_resolve/resolve_imports.rs | 1 | ||||
| -rw-r--r-- | src/librustdoc/visit_lib.rs | 3 |
6 files changed, 6 insertions, 14 deletions
diff --git a/src/librustc/hir/def.rs b/src/librustc/hir/def.rs index ae1cf6046fb..0adbdbe9933 100644 --- a/src/librustc/hir/def.rs +++ b/src/librustc/hir/def.rs @@ -134,9 +134,6 @@ pub struct Export { /// The visibility of the export. /// We include non-`pub` exports for hygienic macros that get used from extern crates. pub vis: ty::Visibility, - /// True if from a `use` or and `extern crate`. - /// Used in rustdoc. - pub is_import: bool, } impl CtorKind { diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 397638fc55d..a781fc7240a 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -1115,8 +1115,7 @@ impl_stable_hash_for!(struct hir::def::Export { ident, def, vis, - span, - is_import + span }); impl<'a> HashStable<StableHashingContext<'a>> diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 69e873bb95d..fd00cde375b 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -665,7 +665,6 @@ impl<'a, 'tcx> CrateMetadata { def: def, vis: ty::Visibility::Public, span: DUMMY_SP, - is_import: false, }); } } @@ -705,7 +704,6 @@ impl<'a, 'tcx> CrateMetadata { ident: Ident::from_interned_str(self.item_name(child_index)), vis: self.get_visibility(child_index), 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()) { let ident = Ident::from_interned_str(name); let vis = self.get_visibility(child_index); - let is_import = false; - callback(def::Export { def, ident, vis, span, is_import }); + callback(def::Export { def, ident, vis, span }); // For non-re-export structs and variants add their constructors to children. // Re-export lists automatically contain constructors when necessary. match def { @@ -734,7 +731,7 @@ impl<'a, 'tcx> CrateMetadata { callback(def::Export { def: ctor_def, 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_def = Def::VariantCtor(def_id, ctor_kind); 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 }); } _ => {} } diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 0cc59e3129c..fe6909f7591 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -803,7 +803,6 @@ impl<'a> Resolver<'a> { def: def, vis: ty::Visibility::Public, span: item.span, - is_import: false, }); } else { self.unused_macros.insert(def_id); diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 34f84597adf..c44f330128a 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -1008,7 +1008,6 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { def: def, span: binding.span, vis: binding.vis, - is_import: true, }); } } diff --git a/src/librustdoc/visit_lib.rs b/src/librustdoc/visit_lib.rs index 15a8b58d0f6..4c773fc1dd7 100644 --- a/src/librustdoc/visit_lib.rs +++ b/src/librustdoc/visit_lib.rs @@ -68,7 +68,8 @@ impl<'a, 'tcx, 'rcx> LibEmbargoVisitor<'a, 'tcx, 'rcx> { } 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); } } |
