Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 63fe792

Browse files
authoredJul 27, 2022
Revert "Prefer visibility map parents that are not doc(hidden) first"
1 parent da5b546 commit 63fe792

File tree

7 files changed

+5
-84
lines changed

7 files changed

+5
-84
lines changed
 

‎compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

+5-15
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,9 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
375375
use std::collections::vec_deque::VecDeque;
376376

377377
let mut visible_parent_map: DefIdMap<DefId> = Default::default();
378-
// This is a secondary visible_parent_map, storing the DefId of
379-
// parents that re-export the child as `_` or module parents
380-
// which are `#[doc(hidden)]`. Since we prefer paths that don't
381-
// do this, merge this map at the end, only if we're missing
382-
// keys from the former.
383-
// This is a rudimentary check that does not catch all cases,
384-
// just the easiest.
378+
// This is a secondary visible_parent_map, storing the DefId of parents that re-export
379+
// the child as `_`. Since we prefer parents that don't do this, merge this map at the
380+
// end, only if we're missing any keys from the former.
385381
let mut fallback_map: DefIdMap<DefId> = Default::default();
386382

387383
// Issue 46112: We want the map to prefer the shortest
@@ -416,11 +412,6 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
416412
return;
417413
}
418414

419-
if ty::util::is_doc_hidden(tcx, parent) {
420-
fallback_map.insert(def_id, parent);
421-
return;
422-
}
423-
424415
match visible_parent_map.entry(def_id) {
425416
Entry::Occupied(mut entry) => {
426417
// If `child` is defined in crate `cnum`, ensure
@@ -448,9 +439,8 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
448439
}
449440
}
450441

451-
// Fill in any missing entries with the less preferable path.
452-
// If this path re-exports the child as `_`, we still use this
453-
// path in a diagnostic that suggests importing `::*`.
442+
// Fill in any missing entries with the (less preferable) path ending in `::_`.
443+
// We still use this path in a diagnostic that suggests importing `::*`.
454444
for (child, parent) in fallback_map {
455445
visible_parent_map.entry(child).or_insert(parent);
456446
}

‎src/test/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/auxiliary/hidden-child.rs

-8
This file was deleted.

‎src/test/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/auxiliary/hidden-parent.rs

-8
This file was deleted.

‎src/test/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-child.rs

-10
This file was deleted.

‎src/test/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-child.stderr

-18
This file was deleted.

‎src/test/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-parent.rs

-7
This file was deleted.

‎src/test/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-parent.stderr

-18
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.