about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2023-12-20 20:02:40 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2023-12-20 20:27:10 +0300
commit006e0ef18ddd1f4f9de4d528369ebe8b564eb18d (patch)
tree3ad31e9dc6a12b953139402fa98f585136ef4f5a /compiler/rustc_resolve/src
parent8fca8295cb89c4ebae6b5a8f8cfef1fc870dbeaa (diff)
downloadrust-006e0ef18ddd1f4f9de4d528369ebe8b564eb18d.tar.gz
rust-006e0ef18ddd1f4f9de4d528369ebe8b564eb18d.zip
resolve: Stop feeding visibilities for import list stems
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/build_reduced_graph.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs
index 7ff3c523685..98a9d0ba4c2 100644
--- a/compiler/rustc_resolve/src/build_reduced_graph.rs
+++ b/compiler/rustc_resolve/src/build_reduced_graph.rs
@@ -394,6 +394,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
         id: NodeId,
         parent_prefix: &[Segment],
         nested: bool,
+        list_stem: bool,
         // The whole `use` item
         item: &Item,
         vis: ty::Visibility,
@@ -404,7 +405,9 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
             parent_prefix, use_tree, nested
         );
 
-        if nested {
+        // Top level use tree reuses the item's id and list stems reuse their parent
+        // use tree's ids, so in both cases their visibilities are already filled.
+        if nested && !list_stem {
             self.r.feed_visibility(self.r.local_def_id(id), vis);
         }
 
@@ -592,7 +595,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
                 for &(ref tree, id) in items {
                     self.build_reduced_graph_for_use_tree(
                         // This particular use tree
-                        tree, id, &prefix, true, // The whole `use` item
+                        tree, id, &prefix, true, false, // The whole `use` item
                         item, vis, root_span,
                     );
                 }
@@ -613,6 +616,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
                         id,
                         &prefix,
                         true,
+                        true,
                         // The whole `use` item
                         item,
                         ty::Visibility::Restricted(
@@ -648,6 +652,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
                     item.id,
                     &[],
                     false,
+                    false,
                     // The whole `use` item
                     item,
                     vis,