-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 rustc --print rustc-path
#100681
Add rustc --print rustc-path
#100681
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment was marked as outdated.
This comment was marked as outdated.
302cc78
to
e22e352
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
At least from the cargo side of things
this will need signoff probably from both the compiler and cargo team
I would also like sign off from rustup folks on this being a viable alternative to rust-lang/rustup#3035 (ie they like it enough not to continue down that path, making this obsolete)
@rustbot label +T-cargo +T-rustup |
@rustbot label +T-cargo (there isn't a T-rustup) |
This comment has been minimized.
This comment has been minimized.
aa7de7f
to
70e6359
Compare
We need to either feature-gate this or start stabilization FCP. |
Having it ungated for the time being helps for testing/measuring the rustup/cargo impact. I have a minor preference for just FCP to insta-stable, but that's FCP including the rustc, cargo, and rustup teams, that this approach is sufficient and desirable to resolve the overhead tracked in rust-lang/rustup#3035. (Assuming it is sufficient, I think this is a more desirable way of handling this than any of the other proposed approaches, as it's "just" caching the shim's work rather than adding more environment variables and complicated rules for how they interact and override each other.) |
@rustbot review I went ahead and feature gated this for the time being, so it can land a bit smoother. |
4704629
to
119691a
Compare
r=me after squashing commits. |
Could this be combined with the rustc invocation that gets the rustc version, so that a single invocation gets both the version and the path? That would save one. Invocation. |
@bors r- |
5cf4887
to
f5be8a4
Compare
nth try's the charm? @bors r=petrochenkov |
I actually tried this, but that patch resulted in rustc actually responding slower for some reason.
attempt to rescaleThe same calls to Solve[{
4m + 4c + x = 0.303947129, (* 4 rustup, 4 rustc, 1 compilation *)
4c + x = 0.185393026, (* 4 rustc, 1 compilation *)
m + 5c + x = 0.278397067} (* 1 rustup, 5 rustc, 1 compilation *)
, x] gave a solution with
which doesn't make any sense, except to indicate that more changed than just the calls cargo is making. I just though to control for Solve[{
4m + 4c + x = 0.291619893, (* 4 rustup, 4 rustc, 1 compilation *)
4c + x = 0.17306579, (* 4 rustc, 1 compilation *)
m + 5c + x = 0.266069831} (* 1 rustup, 5 rustc, 1 compilation *)
, x]
which in retrospect I guess makes sense, but makes the compilation take even more negative time >:( (All timings from my machine, from significantly less than ideal testing, assuming that calls not doing a new The result with |
…enkov Add `rustc --print rustc-path` Related: - rust-lang/cargo#10986 - rust-lang/rustup#3035 Goal: Like the original rust-lang/rustup#2958, the goal is to enable `cargo` to call `rustc` directly, rather than through the `rustup` shim. Solution: `cargo` asks `rustc` to tell it what executable to run. Sometime early in compilation, `cargo` will run `$(RUSTC_WRAPPER) $(RUSTC ?: rustc) --print rustc-path`[^1]. Further calls to `rustc` to do execution will use the resolved printed executable path rather than continuing to call the "input `rustc` path," which will allow it to bypass the `rustup` shim. The cargo side is rust-lang/cargo#10998. [^1]: This can potentially be combined with other `--print`s, as well! This is a tiny patch, so I've implemented it as insta-stable; this will need signoff probably from both the compiler and cargo teams. I'm working on the cargo side of the patch currently, but wanted to get this up ASAP. cc `@davidlattimore` `@bjorn3` `@rust-lang/cargo` `@rust-lang/compiler` (sorry for the big ping list 😅)
…enkov Add `rustc --print rustc-path` Related: - rust-lang/cargo#10986 - rust-lang/rustup#3035 Goal: Like the original rust-lang/rustup#2958, the goal is to enable `cargo` to call `rustc` directly, rather than through the `rustup` shim. Solution: `cargo` asks `rustc` to tell it what executable to run. Sometime early in compilation, `cargo` will run `$(RUSTC_WRAPPER) $(RUSTC ?: rustc) --print rustc-path`[^1]. Further calls to `rustc` to do execution will use the resolved printed executable path rather than continuing to call the "input `rustc` path," which will allow it to bypass the `rustup` shim. The cargo side is rust-lang/cargo#10998. [^1]: This can potentially be combined with other `--print`s, as well! This is a tiny patch, so I've implemented it as insta-stable; this will need signoff probably from both the compiler and cargo teams. I'm working on the cargo side of the patch currently, but wanted to get this up ASAP. cc ``@davidlattimore`` ``@bjorn3`` ``@rust-lang/cargo`` ``@rust-lang/compiler`` (sorry for the big ping list 😅)
…enkov Add `rustc --print rustc-path` Related: - rust-lang/cargo#10986 - rust-lang/rustup#3035 Goal: Like the original rust-lang/rustup#2958, the goal is to enable `cargo` to call `rustc` directly, rather than through the `rustup` shim. Solution: `cargo` asks `rustc` to tell it what executable to run. Sometime early in compilation, `cargo` will run `$(RUSTC_WRAPPER) $(RUSTC ?: rustc) --print rustc-path`[^1]. Further calls to `rustc` to do execution will use the resolved printed executable path rather than continuing to call the "input `rustc` path," which will allow it to bypass the `rustup` shim. The cargo side is rust-lang/cargo#10998. [^1]: This can potentially be combined with other `--print`s, as well! This is a tiny patch, so I've implemented it as insta-stable; this will need signoff probably from both the compiler and cargo teams. I'm working on the cargo side of the patch currently, but wanted to get this up ASAP. cc ```@davidlattimore``` ```@bjorn3``` ```@rust-lang/cargo``` ```@rust-lang/compiler``` (sorry for the big ping list 😅)
…enkov Add `rustc --print rustc-path` Related: - rust-lang/cargo#10986 - rust-lang/rustup#3035 Goal: Like the original rust-lang/rustup#2958, the goal is to enable `cargo` to call `rustc` directly, rather than through the `rustup` shim. Solution: `cargo` asks `rustc` to tell it what executable to run. Sometime early in compilation, `cargo` will run `$(RUSTC_WRAPPER) $(RUSTC ?: rustc) --print rustc-path`[^1]. Further calls to `rustc` to do execution will use the resolved printed executable path rather than continuing to call the "input `rustc` path," which will allow it to bypass the `rustup` shim. The cargo side is rust-lang/cargo#10998. [^1]: This can potentially be combined with other `--print`s, as well! This is a tiny patch, so I've implemented it as insta-stable; this will need signoff probably from both the compiler and cargo teams. I'm working on the cargo side of the patch currently, but wanted to get this up ASAP. cc ````@davidlattimore```` ````@bjorn3```` ````@rust-lang/cargo```` ````@rust-lang/compiler```` (sorry for the big ping list 😅)
@bors r- failed in a rollup |
|
||
ifdef IS_WINDOWS | ||
all: | ||
$(RUSTC) -Zunstable-options --print rustc-path | $(CGREP) bin\rustc |
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.
- Looks like
\
needs to be escaped here. - FWIW,
CGREP
supports regexes to match on both\
and/
together.
☔ The latest upstream changes (presumably #103857) made this pull request unmergeable. Please resolve the merge conflicts. |
Is this not pretty much the same as |
If |
I'm closing this rather than fix the merge conflict, as I don't have the bandwidth to push the cargo side of the change. There's not a consensus on the cargo side that the extra startup call to |
Related:
Goal:
Like the original rust-lang/rustup#2958, the goal is to enable
cargo
to callrustc
directly, rather than through therustup
shim.Solution:
cargo
asksrustc
to tell it what executable to run. Sometime early in compilation,cargo
will run$(RUSTC_WRAPPER) $(RUSTC ?: rustc) --print rustc-path
1. Further calls torustc
to do execution will use the resolved printed executable path rather than continuing to call the "inputrustc
path," which will allow it to bypass therustup
shim.The cargo side is rust-lang/cargo#10998.
This is a tiny patch, so I've implemented it as insta-stable; this will need signoff probably from both the compiler and cargo teams. I'm working on the cargo side of the patch currently, but wanted to get this up ASAP.
cc @davidlattimore @bjorn3 @rust-lang/cargo @rust-lang/compiler (sorry for the big ping list 😅)
Footnotes
This can potentially be combined with other
--print
s, as well! ↩