Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of using rustc_interface to generate the HIR for a file referencing dependent crates? #1720

Open
maackle opened this issue Jul 3, 2023 · 0 comments

Comments

@maackle
Copy link

maackle commented Jul 3, 2023

https://github.com/rust-lang/rustc-dev-guide/blob/master/examples/rustc-driver-example.rs is a great example to get me started using rustc_interface, but I am stuck on how to point this query towards a file that references another crate. I want to use rustc to analyze a multi-crate project and build up info across all crates in the project.

I have a repo based directly on rustc-driver-example, showing my problem. See this example which attempts to produce HIR for a file which references another crate. It fails with:

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: failed while formatting fluent string `metadata_cannot_find_crate`: 
message was missing
', compiler/rustc_errors/src/emitter.rs:1402:84

However I can generate a HIR for a file that does not depend on other crates.

What do I need to add to the config to make it aware of other crates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant