Rollup merge of #158552 - ferrocene:jyn/tidy-errors, r=clubby789,davidtwco make some tidy errors around python easier to understand someone i was helping hit a tidy python formatting error in CI, tried to run the exact `tidy` command that bootstrap printed as an error, got *another* error because rustc isn't installed globally, only locally, and then gave up in frustration because they couldn't tell what tidy even wanted them to fix. make some targeted improvements. i'm not sure why diffs were disabled by default before. it's been like that ever since python formatting was originally added in https://github.com/rust-lang/rust/pull/112482, with no explanation. i think showing the diff is a better default. before: ``` $ ./x t tidy --extra-checks=py:fmt checking python file formatting Would reformat: ferrocene/ci/scripts/calculate_parameters.py 1 file would be reformatted, 118 files already formatted rerun tidy with `--extra-checks=py:fmt --bless` to reformat Python code tidy [extra_checks:python_fmt]: checks with external tool 'ruff' failed tidy [extra_checks:python_fmt]: FAIL tidy: The following check failed: extra_checks:python_fmt Command `/home/ci/project/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy --root-path=/home/ci/project --cargo-path=/home/ci/project/build/x86_64-unknown-linux-gnu/stage0/bin/cargo --output-dir=/home/ci/project/build --concurrency=4 --npm-path=yarn --extra-checks=py:fmt` failed with exit code 1 Created at: src/bootstrap/src/core/build_steps/tool.rs:1630:23 Executed at: src/bootstrap/src/core/build_steps/test.rs:1533:29 Command has failed. Rerun with -v to see more details. Build completed unsuccessfully in 0:00:55 $ /home/ci/project/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy --root-path=/home/ci/project --cargo-path=/home/ci/project/build/x86_64-unknown-linux-gnu/stage0/bin/cargo --output-dir=/home/ci/project/build --concurrency=4 --npm-path=yarn --extra-checks=py:fmt --bless tidy [CI history]: no base commit found. Some checks will be skipped. thread 'deps (.)' (25771) panicked at src/tools/tidy/src/deps.rs:700:20: cmd.exec() failed with `cargo metadata` exited with an error: error: could not execute process `rustc -vV` (never executed) Caused by: No such file or directory (os error 2) note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread 'main' (25768) panicked at src/tools/tidy/src/main.rs:53:61: called `Result::unwrap()` on an `Err` value: Any { .. } ``` after: ``` checking python file formatting Would reformat: ferrocene/doc/specification/make.py 1 file would be reformatted, 118 files already formatted python formatting does not match! Printing diff: --- ferrocene/doc/specification/make.py +++ ferrocene/doc/specification/make.py @@ -64,6 +64,7 @@ return dest / builder + def build_linkchecker(root): repo = root / ".linkchecker" src = repo / "src" / "tools" / "linkchecker" 1 file would be reformatted, 118 files already formatted rerun with `--bless` to reformat Python code: `./x.py test tidy --extra-checks=py:fmt --bless` ``` ``` thread 'deps (.)' (249572429) panicked at src/tools/tidy/src/deps.rs:696:9: tidy must be run under bootstrap (./x test tidy), not as a standalone command note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ```
Website | Getting started | Learn | Documentation | Contributing
This is the main source code repository for Rust. It contains the compiler, standard library, and documentation.
Performance: Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrated with other languages.
Reliability: Our rich type system and ownership model ensure memory and thread safety, reducing bugs at compile-time.
Productivity: Comprehensive documentation, a compiler committed to providing great diagnostics, and advanced tooling including package manager and build tool (Cargo), auto-formatter (rustfmt), linter (Clippy) and editor support (rust-analyzer).
Read “Installation” from The Book.
If you really want to install from source (though this is not recommended), see INSTALL.md.
See https://www.rust-lang.org/community for a list of chat platforms and forums.
See CONTRIBUTING.md.
For a detailed explanation of the compiler's architecture and how to begin contributing, see the rustc-dev-guide.
Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.
See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.
The Rust Foundation owns and protects the Rust and Cargo trademarks and logos (the “Rust Trademarks”).
If you want to use these names or brands, please read the Rust language trademark policy.
Third-party logos may be subject to third-party copyrights and trademarks. See Licenses for details.