-
Notifications
You must be signed in to change notification settings - Fork 446
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
Crate universe #1842
Crate universe #1842
Conversation
@gburgessiv FYI |
afad70f
to
51213ba
Compare
) | ||
|
||
for toolchain in mod.tags.toolchain: | ||
repo_name = "%s_rust_toolchains" % mod.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like you're making it so that the whole module graph can create and register its own toolchains, but isn't the set of available toolchains a global thing? I was under the impression that if all modules are allowed to register toolchains, toolchain resolution would pick the first valid one from this global set of toolchains and prevent the top-level module from controlling which version is used. That's why I originally made it so that only the top-level module can define toolchains, but maybe I'm misunderstanding how this works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I'm not particularly familiar with toolchains, so you could definitely be right. I was making the assumption that each module registered its own toolchains, and that, like use_repo, each module had its own visibility into the set of toolchains, and specifically used ones that they defined themselves?
Eg. I saw that your toolchain definition has the tag "edition". Since editions are specifically not backwards compatible, something designed for a 2018 edition might fail if compiled with a toolchain that specifies the 2021 edition.
@Wyverald Could you confirm how register_toolchain works? Is it global or per-module?
This is a rough proof of concept of making rules_rust load dependencies via bzlmod. Currently it can only compile and run rust crates, and cannot load crates from Cargo.toml. There is one new module, `examples/bzlmod/hello_world`, that depends on the root `rules_rust` module. This example can be built and run using: ``` cd examples/bzlmod/hello_world bazel run //:hello_world ``` A "hub" repository for toolchains is defined, and can be registered using: ``` register_toolchains("@rust_toolchains//:all") ```
When multiple modules each define different toolchain configurations, at the moment, an arbitrary one wins and defines all the toolchains. This change allows each different module to define as many different toolchains as they want, each with a different set of configuration. If the configuration is the same between modules, they will share their toolchains.
This is required for bootstrapping cargo_bazel.
Superceded by #1910 |
Add support for crate universe with bzlmod to rules_rust.
Please ignore all commits by @cameron-martin as they're being reviewed seperately in github.com//pull/1528.
I'll change this from a draft PR into a real PR once his PR is merged.