-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
warn newer available version of the x tool #104552
Conversation
r? @jyn514 (rustbot has picked a reviewer for you, use r? to override) |
I like the idea of having a way to check for a outdated I'm not sure whether |
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.
I'm not sure whether tidy is the right place for that. Maybe it should live in bootstrap instead? jyn will have better ideas on that hopefully.. :)
I think I agree bootstrap is a better place; that way you get warned every time instead of just when you run tidy.
That said if x
is working for you there's probably not a hard need to upgrade? so maybe being less spammy is a good thing? don't have super strong opinions here.
Hmm, I'll admit I installed x once and it works for me so I've somewhat intentionally avoided the hassle of (potentially breaking) upgrades, or at least I'm lazy enough not to bother. So personally speaking I'd rather not be nagged about this. On the other hand if it did fail for some reason then having a "hey, you're using an old version" would be useful. |
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.
This looks better, thanks :) I think once you fix my other comments we can merge it.
☔ The latest upstream changes (presumably #105058) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #106324) made this pull request unmergeable. Please resolve the merge conflicts. |
15a008d
to
5fda893
Compare
Some changes occurred in src/tools/cargo cc @ehuss |
Co-authored-by: Joshua Nelson <github@jyn.dev>
Co-authored-by: Joshua Nelson <github@jyn.dev>
5fda893
to
f50ad6c
Compare
@ehuss You can disregard this. I made a mistake in rebasing. There are no changes to src/tools/cargo. |
Co-authored-by: Joshua Nelson <github@jyn.dev>
src/tools/tidy/src/x_version.rs
Outdated
|
||
// Parse latest version out of `x` Cargo.toml | ||
fn get_x_wrapper_version() -> Option<Version> { | ||
let cmd = Command::new("cargo") |
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.
Do we know this will be run from the root of the rust-lang/rust checkout?
I tested this by being in some random directory (inside the project) & it did use the root, but can we count on that or should the directory be set?
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.
You can test by running ../../../x.py test tidy
from src/tools/x
, which isn't in the workspace. If that works, and rust/x.py test tidy
works (from outside the source directory), this is fine :)
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.
err sorry - actually can you use cargo_metadata
, like in
rust/src/tools/tidy/src/deps.rs
Lines 347 to 354 in e9ca663
/// `root` is path to the directory with the root `Cargo.toml` (for the workspace). `cargo` is path | |
/// to the cargo executable. | |
pub fn check(root: &Path, cargo: &Path, bad: &mut bool) { | |
let mut cmd = cargo_metadata::MetadataCommand::new(); | |
cmd.cargo_path(cargo) | |
.manifest_path(root.join("Cargo.toml")) | |
.features(cargo_metadata::CargoOpt::AllFeatures); | |
let metadata = t!(cmd.exec()); |
root
as an argument which avoids this question altogether.
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.
Running both of the above commands didn't end up working for me, even with the new change to use cargo_metadata
.
I end up getting tidy errors for autogenerated files in the build directory... This seems like a separate issue though.
Building rustbuild
Finished dev [unoptimized] target(s) in 0.08s
Building stage0 tool tidy (aarch64-apple-darwin)
Compiling tidy v0.1.0 (/Users/jhaigh/developer/Rust/rust/src/tools/tidy)
Finished release [optimized] target(s) in 2.62s
tidy check
* 633 error codes
* highest error code: E0791
tidy error: /Users/jhaigh/developer/Rust/rust/src/tools/x/build/bootstrap/debug/build/typenum-
949154f977098d36/out/consts.rs: leading newline
tidy error: /Users/jhaigh/developer/Rust/rust/src/tools/x/build/bootstrap/debug/build/typenum-
949154f977098d36/out/consts.rs: missing trailing newline
tidy error: /Users/jhaigh/developer/Rust/rust/src/tools/x/build/bootstrap/debug/build/typenum-
949154f977098d36/out/tests.rs: leading newline
tidy error: /Users/jhaigh/developer/Rust/rust/src/tools/x/build/bootstrap/debug/build/typenum-
949154f977098d36/out/tests.rs: missing trailing newline
tidy error: /Users/jhaigh/developer/Rust/rust/src/tools/x/build/bootstrap/debug/build/typenum-
949154f977098d36/out/tests.rs: too many lines (17255) (add `// ignore-tidy-filelength` to the
file to suppress this error)
tidy error: /Users/jhaigh/developer/Rust/rust/src/tools/x/build/bootstrap/debug/build/typenum-
949154f977098d36/out/op.rs: leading newline
tidy error: /Users/jhaigh/developer/Rust/rust/src/tools/x/build/bootstrap/debug/build/typenum-
949154f977098d36/out/op.rs: missing trailing newline
tidy error: /Users/jhaigh/developer/Rust/rust/src/tools/x/build/aarch64-apple-darwin/stage0/sh
are/doc/cargo/README.md: too many trailing newlines (2)
tidy error: /Users/jhaigh/developer/Rust/rust/src/tools/x/build/aarch64-apple-darwin/stage0/sh
are/doc/rustfmt/README.md:108: trailing whitespace
* 392 features
some tidy checks failed
Build completed unsuccessfully in 0:00:05
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.
ah yeah that's from when I asked you to test ../../../x test tidy
, sorry about that 😅 rm -rf src/tools/x/build
will make the errors go away (although I've been wanting to get tidy to ignore untracked files for a while; but that's a separate PR.)
@bors r+ rollup Thanks! |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#104552 (warn newer available version of the x tool) - rust-lang#105681 (some fixes/improvements to mir::visit module) - rust-lang#106005 (Test the borrowck behavior of if-let guards) - rust-lang#106356 (clean: Remove `ctor_kind` from `VariantStruct`.) - rust-lang#106365 (Grammar : Missing "is" in format specifier diagnostic) - rust-lang#106388 (rustdoc: remove legacy box-sizing CSS) - rust-lang#106392 (`has_overflow` only if value is *not* within limit) - rust-lang#106402 (Fix dupe word typos) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…er-x, r=jyn514 Revert "warn newer available version of the x tool" Reverts rust-lang#104552 Running the x executable directly created an [issue](rust-lang#106469) here. There are other options for warning a user that a newer version of x exists in the issue's discussion as well. r? `@jyn514`
…er-x, r=jyn514 Revert "warn newer available version of the x tool" Reverts rust-lang#104552 Running the x executable directly created an [issue](rust-lang#106469) here. There are other options for warning a user that a newer version of x exists in the issue's discussion as well. r? ``@jyn514``
This PR adds a check to
tidy
to assert that the installed version ofx
is equal to the version insrc/tools/x/Cargo.toml
. It adds a--wrapper-version
argument tox
to determine the version at runtime, .It does not warn if
x
has not yet been installed, on the assumption that the user isn't interested in using it.