-
Notifications
You must be signed in to change notification settings - Fork 892
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
Add path override to rust-toolchain.toml #2678
Conversation
Signed-off-by: Daniel Silverstone <[email protected]>
…to local-toolchain
Maybe it should be configurable via a required option? Or maybe it should be the name of the directory that hosts the rust-toolchain file rather than the path of the toolchain itself? The toolchain file in my use case is likely to be an immediate child of a meaningfully named directory. |
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.
There's a few tweaks I'd like to see, but over-all I think this is excellent.
The ideas presented for the name of the toolchain are interesting. In some senses I like the idea of the basename of the toolchain path since that'd often be semi-useful; but so would calling it after the directory containing the I think that the It's possible that |
I think the toolchain name must be like linkable toolchains no? Not stable,
not 1.3.0, etc.
Rob
…On Tue, 23 Feb 2021, 20:35 Daniel Silverstone, ***@***.***> wrote:
The ideas presented for the name of the toolchain are interesting.
In some senses I like the idea of the basename of the toolchain path since
that'd often be semi-useful; but so would calling it after the directory
containing the rust-toolchain.toml
I think that the name has to be either the path to the toolchain or else
the path to the rust-toolchain.toml because ultimately it gets put into
RUSTUP_TOOLCHAIN in the environment which will then be used subsequently
by proxies. I think we possibly don't verify that in the test suite very
well, beyond setting it to verify the outer proxy uses it.
It's possible that cargo won't be bitten by this, but I can't guarantee
that rls or rust-analyzer won't be. At minimum I'd like an assertion that
you've done a reasonable amount of testing for this, or that you're
confident it's covered by something in the existing test suite.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2678 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADZ7XWLGBYMJ53FTZBTR53TAP7RXANCNFSM4YBVGXRA>
.
|
I think the current naming scheme (basename of the toolchain path) is indeed the right way to go. My reasoning here is that while the basename of the dir that holds
The tests did check the toolchain name indirectly through error messages, but I've added an explicit test for
I'm not sure I follow exactly what you're asking for here? What problem are you anticipating?
Hmm, why is that? |
What I'm imagining is that a program is run by a proxy ( |
Ohh, I see what you mean. Yeah, I think you're right then that the toolchain name needs to be the full path and needs to be settable through |
This is needed so that proxy commands (like `cargo` -> `rustc`) will continue to use the path toolchain.
Pushed a fix that should address that use-case. I also tested it with |
I have no idea what's going on with the Windows paths here: https://github.com/rust-lang/rustup/pull/2678/checks?check_run_id=1966265648#step:14:516 The failure appears to be that Windows just doesn't handle |
Only tangentially related, but I wonder if it'd make sense for |
Drive by comment, might be completely irrelevant.
|
Good instinct! Yes, looks like Line 560 in fc2f6b1
Which then produces a @kinnison Do you know why we canonicalize the path in that location? Is it necessary? Might fix up the other tests that are currently ignored due to UNC as well. |
That particular canonicalisation is for the override finding. It'd not be unreasonable to maintain the uncanonicalised copy there for the purpose of better joining later I guess. Interestingly that means that on Windows, all override paths are stored as UNC paths in the settings file. So long as you maintain a parallel |
I guess my question is more why we canonicalize the path in that location? If that didn't canonicalize, then I think everything would just work. Is there a reason why canonicalization is needed? From what I can tell, it's always been there since the commit in which we first got support for a toml file: Line 77 in d1ae0eb
Carrying around the uncanonicalized path too is possible, though it'd make the traversal to find the file hairier, and would make |
@kinnison Gentle bump on ^ |
By my understanding, and I'll admit I'd need to re-study this part of the codebase to remember, the canonicalisation is because on at least some platforms there may be things like symlinks involved in CWD et al, and the goal would be to ensure that stored overrides use the canonical path so that they're not confused by such things. We could possibly make the calling of the canonicalisation functions conditional on |
I feel like the real answer here is probably to canonicalize the paths only when they are exposed (like printed or written out into a file), and not in internal representations. |
We also will need to canonicalise for comparison but yes that could work. |
Pushed a commit that makes that change, so let's see how it goes! |
That seems to have worked — it helped that I only changed the canonicalization of the toolchain file path, which doesn't appear in that many places. |
@kinnison Gentle ping again (please do let me know if I shouldn't ping you explicitly — I figured your notification inbox may be quite busy with auto-notifications, so thought an explicit mention might add some signal). |
Pinging us is fine - we're stuck at the moment - not enough contributors to respond quickly, which puts people off becoming contributors :/. I will try to get to this soonish if Daniel doesn't. |
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.
I apologise for the delay, I was testing all this under Linux, WSL, and Windows.
It all seems to behave very well.
This PR implements path-based toolchain overrides from
rust-toolchain.toml
.Specifically, it allows
rust-toolchain.toml
to specify:Which will cause
rustc
to invokeephemeral/toolchain/bin/rustc
, andsimilarly for all other parts of the toolchain. Relative paths are resolved
relative to the
.toml
file (as opposed to the current working directory).Replaces #2471.
Fixes #2458.
Unresolved questions
component of the path, but there's also a decent argument that it should
instead be the whole path.