-
Notifications
You must be signed in to change notification settings - Fork 893
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
Make the toolchain overriding config hierarchical #3492
base: master
Are you sure you want to change the base?
Conversation
d8f5c14
to
fe12178
Compare
I think this approach to the code conflates two things - and this is why I said I don't think we want hierarchical config : we can can generate arbitrarily confusing outcomes for users when we merge data on a per-key basis.. What I was proposing is that:
And writing this has me realise that we also need to provide an escape hatch, for the case where someone has configured defaults that are incompatible with the channel they are overriding. One possible escape hatch is just to document that installation defaults are ignored if the toolchain is already installed (I believe this is the case). Thank you for writing tests. I think that these tests would be best as unit tests; the UI is not being changed, and we should be able to produce much more compact tests closer to the core. They are ok if you wish to stay with these external layer tests, but I have a very strong preference to see close-to-the-unit tests where possible! (I haven't read the code in detail, just did a quick skim in a couple of spare minutes I had available; apologies if I've misunderstood something) |
@rbtcollins Thanks for your clarification!
It is still the case that once the Lines 94 to 98 in 2c87185
After all, the original issue in #3483 is that
If I'm not mistaken, all 4 sources can specify a toolchain, but only
Would you mind clarifying on this one? In what way they might become incompatible?
I agree. I'll definitely look into that when I have time! |
f309243
to
a25b723
Compare
@rbtcollins replied:
|
It seems that both the missing components and the missing targets will be installed once an auto-install-invoking command is executed: rustup/tests/suite/cli_rustup.rs Lines 2050 to 2061 in f32f91e
rustup/tests/suite/cli_rustup.rs Lines 2063 to 2068 in f32f91e
So I guess the concern about incompatible config has been addressed. |
f32f91e
to
2e24b25
Compare
@rbtcollins is concerned about this change's possibility of making environment isolation in systems like bazel more difficult (cc bazelbuild/rules_rust#2285). Will #2793 become an option in terms of mitigating this issue? (Thanks for the hint, @djc!) |
I've converted this to draft for now - its not in 'ready to review' state. |
Fixes #3483.
Quoting https://rust-lang.github.io/rustup/overrides.html:
Please note that the "hierarchical config" we are talking about here is different from what
cargo
does right now:rustup
won't do file system-based config hierarchy, which means 3. and 4. will be merged if and only if they are from the same directory, otherwise only the one that comes first in terms of proximity from the current working directory will be merged.Concerns
rustup override
should interact withrust-toolchain.toml
.find_override_from_dir_walk
, we find the first directory that has either one of those, and return immediately. There is no merging even at the same level.To be consistent withcargo
we need to check what we have from both sides at each level (rustup override
first), anddir_walk
all the way up, merging all therustup override
+rust-toolchain.toml
overrides in the process. However, will this cause significant performance penalties?Provide an escape hatch, for the case where someone has configured defaults that are incompatible with the channel they are overriding.One possible escape hatch is just to document that installation defaults are ignored if the toolchain is already installed.