rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.19k stars 1.59k forks source link

Make "discover" the default for rust-analyzer.rustc.source? #15178

Open RalfJung opened 1 year ago

RalfJung commented 1 year ago

Currently, to get RA to work on a project that uses rustc-private crates, one has to do two things:

I wonder if the 2nd step could be made unnecessary, by making discover the default value for rust-analyzer.rustc.source? If I understand https://github.com/rust-lang/miri/pull/1736#issuecomment-792979551 correctly, that setting has no negative effects on crates without rustc_private, and for crates with rustc_private it is the value one usually needs.

Veykril commented 1 year ago

We eagerly fetch the metadata of the rustc workspace when the setting is set to discover (or a concrete path). So while we don't semantically load it (that is we don't build its crategraph), we do some other loading stuff (including loading the files into the VFS even though we don't need them)

RalfJung commented 1 year ago

Ah, so there still is some negative effect on other crates then. Bummer.

JohnScience commented 1 year ago

Is it possible to make a suggestion about enabling those when there's an unknown extern crate error?