Skip to content

Nested use trees are not reachable #46823

Closed
@euclio

Description

@euclio

This causes an issue where the imports are not dumped in the save analysis data if it is configured to contain only reachable defs.

Steps to reproduce:

lib.rs:

#![crate_type = "lib"]

pub use private::*;

mod private {
    pub struct Struct1;
    pub struct Struct2;
}

pub use private2::{Struct3, Struct4};

mod private2 {
    pub struct Struct3;
    pub struct Struct4;
}
$ RUST_SAVE_ANALYSIS_CONFIG='{ "reachable_only": true, "full_docs": true, "pub_only": false, "distro_crate": false, "signatures": false, "borrow_data": false }' rustc -Zsave-analysis lib.rs

Notice that pub use private::*; will appear in the save analysis data, but neither import of Struct3 or Struct4.

The relevant reachability testing is here.

It seems to me that the privacy_access_levels query needs to be updated to consider the nested use tree as reachable?

cc @pietroalbini

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions