Skip to content

DefaultMetadataLoader was changed to private, making it difficult to print out metadata #133510

Open
@Ramla-I

Description

@Ramla-I

Hi,

A recent commit bdacdfe made the DefaultMetadataLoader struct private to the crate.
This makes it impossible to print out the crate metadata using the given functions unless I define my own struct which implements the MetadataLoader trait. I'm currently just trying to understand the metadata file better, and am working with an older version of the Rust compiler so that I can access this type. I'm wondering why this type was made private.

Here is the code I'm using which works with an older version of the compiler:

fn main() {
    let path = std::env::args().nth(1).expect("no path given");
    let path = Path::new(&path);
    let triple = TargetTriple::from_triple("x86_64-apple-darwin");
    let target = Target::expect_builtin(&triple);
    let mut stdout = io::stdout();

    rustc_span::create_session_globals_then(Edition::Edition2018, || {
        let _ = locator::list_file_metadata(&target, path, &DefaultMetadataLoader, &mut stdout);
    });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler 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