Skip to content

What would it take for sysroot crates to be treated as "just" another dependency in rust-analyzer? #14903

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

Open
davidbarsky opened this issue May 26, 2023 · 3 comments
Labels
C-support Category: support questions

Comments

@davidbarsky
Copy link
Contributor

Hi! A colleague is making some changes of how the sysroot is configured and exposed in Buck2's rust_rules. They asked me a question I didn't have the answer to: if we were building std from source, could it be treated/exposed as just another dependency in a rust-project.json? I know that there's some special handling for sysroot crates inside of project-model/src/sysroot.rs and Lukas mentioned that dependencies of std require weird workarounds to avoid circular dependencies.

Is treating sysroot crates as "just" another dependency de-facto blocked on the stabilization of build-std?

(This isn't a feature request; it's more of a "how hard would it be to support this" and if y'all don't have an answer off-hand, I'll treat it as "build-std needs to be stabilized first".)

@davidbarsky davidbarsky added the C-support Category: support questions label May 26, 2023
@Veykril
Copy link
Member

Veykril commented May 26, 2023

You are free to disable the sysroot in a rust-project.json and manually assemble the dependency hierarchy of the relevant crates. r-a would handle them as normal dependencies then. This might break a few things that look specifically for "lang" crates, we tag those crates from the sysroot specially via CrateOrigin (which some things then look for in the crate graph), so this would need some support in rust-project.json for marking the sysroot crates as those I think.

@Veykril
Copy link
Member

Veykril commented May 26, 2023

That is, the only special handling that sysroot crates have is that we hardcode them (because the sysroot does not expose what crates make it up yet), tag them with the corresponding CrateOrigin and add them as dependencies to all non-sysroot crates.

@davidbarsky
Copy link
Contributor Author

That makes sense, thanks for explaining! I'm not sure if we'll go down this path, but if we do, I'll be sure to send you a PR to tag the crates with the appropriate CrateOrigin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-support Category: support questions
Projects
None yet
Development

No branches or pull requests

2 participants