Skip to content

Globs in save-analysis do not contain exports in value #49910

Closed as not planned
Closed as not planned
@euclio

Description

@euclio

Uncovered by rust-dev-tools/rls-analysis#124.

For the following code:

pub use private::*;

mod private {
    pub struct Struct1;
    pub struct Struct2;
}
$ RUST_SAVE_ANALYSIS_CONFIG='{ "reachable_only": true, "full_docs": true, "pub_only": false, "distro_crate": false, "signatures": false, "borrow_data": false }' rustc -Zsave-analysis test.rs

The save analysis data for the glob use has an empty string for the value, when I would expect Struct1 and Struct2 would be in the string.

The theory is that the glob_map created by the librustc_resolve::Resolver only contains imports actually used inside the module, but the save analysis data wants to include exports as well. The glob_map is used to create the value field in the analysis here.

I'm happy to work and submit a PR for this, but I don't think that I understand enough about the resolve code to move forward, particularly around what causes an import to be considered "used". Could someone give me some help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-save-analysisArea: saving results of analyses such as inference and borrowck results to a file.C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions