about summary refs log tree commit diff
path: root/src/tools/tidy
AgeCommit message (Collapse)AuthorLines
2023-04-02Move some UI tests into subdirectoriesjyn-1/+1
to avoid going over the existing limit now that the ui-fulldeps tests have been moved to ui.
2023-03-27Remove useless Clone boundsMaybe Waffle-2/+2
2023-03-27Don't skip all directories when tidy-checkingMaybe Waffle-55/+75
2023-03-21Ignore the vendor directory for tidy tests.James Farrell-0/+1
When running `x.py test` on a downloaded source distribution (e.g. https://static.rust-lang.org/dist/rustc-<version>-src.tar.gz), the crates in the vendor directory contain a number of executable files that cause the tidy test to fail with the following message: tidy error: binary checked into source: <path> I see 26 such errors with the 1.68.0 source distribution. A few of these are .rs source files with incorrect executable permission, but most are scripts that are correctly marked executable.
2023-03-20migrate compiler, bootstrap, and compiletest to windows-rsAndy Russell-0/+1
2023-03-20Rollup merge of #109323 - joboet:ignore_ds_store_tidy, r=ozkanonurMatthias Krüger-19/+22
Ignore files in .gitignore in mir opt check This caused `./x test tidy` to fail for me when Finder (macOS) added `.DS_Store` files. They are ignored by git, so tidy should ignore them, too.
2023-03-19tidy: ignore files in .gitignore in mir opt checkjoboet-19/+22
2023-03-19Rollup merge of #108798 - devsnek:panic-pal-exception, r=workingjubileeDylan DPC-1/+0
move default backtrace setting to sys another PAL exception. moves the default backtrace setting to sys.
2023-03-18address review commentsJoshua Nelson-0/+5
2023-03-18Use a single WalkBuilder for multiple pathsJoshua Nelson-42/+43
2023-03-18Make `ui_tests` non-quadraticJoshua Nelson-34/+30
Previously, it would walk each directory twice: once in the main `Walk` iterator, and once to count the number of entries in the directory. Now it only walks each directory once.
2023-03-18Speed up file walking in tidyJoshua Nelson-83/+80
- Skip files in `skip` wherever possible to avoid reading their contents - Don't look for `tidy-alphabetic-start` in tests. It's never currently used and slows the check down a lot. - Add new `filter_not_rust` helper function
2023-03-18Use named threads in tidyJoshua Nelson-4/+16
This makes it easier to profile.
2023-03-17move default backtrace setting to sysGus Caplan-1/+0
2023-03-11Use trimmed instead of line for performanceest31-4/+4
2023-03-11Extend the tidy lint to ftl filesest31-1/+6
2023-03-11tidy: enforce comment blocks to have even number of backticksest31-9/+47
Some comments may be formed like: // This function takes a tuple `(Vec<String>, // Box<[u8]>)` and transforms it into `Vec<u8>`. where the "back-ticked" section wraps around. Therefore, we can't make a single-line based lint. We also cannot make the lint paragraph based, as it would otherwise complain about inline code blocks: /// ``` /// use super::Foo; /// /// fn main() { Foo::new(); } /// ``` For the future, one could introduce some checks to treat code blocks specially, but such code would make the check even more complicated.
2023-03-11tidy: allow direct format args capture in macroest31-4/+4
2023-03-10Moved thread_local implementation to sys::commonAyush Singh-2/+0
This allows removing all the platform-dependent code from `library/std/src/thread/local.rs` and `library/std/src/thread/mod.rs` Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2023-03-09Rollup merge of #108917 - Ayush1325:tidy-improve, r=workingjubileeMatthias Krüger-0/+3
Consider target_family as pal Currently, tidy does not consider code in target_family as platform-specific. This is erroneous and should be fixed. r? `@workingjubilee`
2023-03-09Consider target_family as palAyush Singh-0/+3
Currently tidy does not consider code in target_family as platform-specific. I think this is erroneous and should be fixed. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2023-03-07Update cargoWeihang Lo-1/+4
23 commits in 9880b408a3af50c08fab3dbf4aa2a972df71e951..c1334b059c6dcceab3c10c81413f79bb832c8d9d 2023-02-28 19:39:39 +0000 to 2023-03-07 19:21:50 +0000 - Add `CARGO_PKG_README` (rust-lang/cargo#11645) - path dependency: fix cargo-util version (rust-lang/cargo#11807) - Adding display of which target failed to compile (rust-lang/cargo#11636) - Fix `CARGO_CFG_` vars for configs defined both with and without value (rust-lang/cargo#11790) - Breaking endless loop on cyclic features in added dependency in cargo-add (rust-lang/cargo#11805) - Enhance the doc of timing report with graphs (rust-lang/cargo#11798) - Make `sparse` the default protocol for crates.io (rust-lang/cargo#11791) - Use sha2 to calculate SHA256 (rust-lang/cargo#11795) - gitoxide progress bar fixes (rust-lang/cargo#11800) - Check publish_to_alt_registry publish content (rust-lang/cargo#11799) - chore: fix missing files in autolabel trigger_files (rust-lang/cargo#11797) - chore: Update base64 (rust-lang/cargo#11796) - Fix some doc typos (rust-lang/cargo#11794) - chore(ci): Enforce cargo-deny in CI (rust-lang/cargo#11761) - Some cleanup for unstable docs (rust-lang/cargo#11793) - gitoxide integration: fetch (rust-lang/cargo#11448) - patch can conflict on not activated packages (rust-lang/cargo#11770) - fix(toml): Provide a way to show unused manifest keys for dependencies (rust-lang/cargo#11630) - Improve error for missing crate in --offline mode for sparse index (rust-lang/cargo#11783) - feat(resolver): `-Zdirect-minimal-versions` (rust-lang/cargo#11688) - feat: Use test name for dir when running tests (rust-lang/cargo#11738) - Jobserver cleanup (rust-lang/cargo#11764) - Fix help string for "--charset" option of "cargo tree" (rust-lang/cargo#11785) Note that some 3rd-party licensing allowed list changed due to the introducion of `gix` dependency
2023-03-05Rollup merge of #108776 - jyn514:quiet-tidy, r=ozkanonurMatthias Krüger-4/+4
Make `x test tidy` less noisy Before: ``` Building tool tidy (stage0) Finished release [optimized + debuginfo] target(s) in 0.29s fmt check skip untracked path chrome_profiler.json during rustfmt invocations skip untracked path query_impl-default,args.mm_profdata during rustfmt invocations skip untracked path query_impl-llvm.txt during rustfmt invocations skip untracked path query_impl-mono_items.txt during rustfmt invocations skip untracked path query_impl-summarize.txt during rustfmt invocations skip untracked path rustc.svg during rustfmt invocations skip untracked path rustc_middle.mono_items.json during rustfmt invocations skip untracked path rustc_middle.mono_items.md during rustfmt invocations skip untracked path rustc_query_impl.mono_items-thread_local_attr.json during rustfmt invocations skip untracked path rustc_query_impl.mono_items-thread_local_macro.json during rustfmt invocations skip untracked path rustc_query_impl.mono_items.md during rustfmt invocations tidy check Found 505 error codes Highest error code: `E0793` * 397 features Ensuring the YAML anchors in the GitHub Actions config were expanded Building tool expand-yaml-anchors (stage0) Finished release [optimized + debuginfo] target(s) in 0.14s Build completed successfully in 0:00:54 ``` After: ``` Building tool tidy (stage0) Finished release [optimized + debuginfo] target(s) in 2.24s fmt check tidy check Ensuring the YAML anchors in the GitHub Actions config were expanded Building tool expand-yaml-anchors (stage0) Finished release [optimized + debuginfo] target(s) in 0.14s Build completed successfully in 0:00:04 ```
2023-03-05Make `x test tidy` less noisyJoshua Nelson-4/+4
Before: ``` Building tool tidy (stage0) Finished release [optimized + debuginfo] target(s) in 0.29s fmt check skip untracked path chrome_profiler.json during rustfmt invocations skip untracked path query_impl-default,args.mm_profdata during rustfmt invocations skip untracked path query_impl-llvm.txt during rustfmt invocations skip untracked path query_impl-mono_items.txt during rustfmt invocations skip untracked path query_impl-summarize.txt during rustfmt invocations skip untracked path rustc.svg during rustfmt invocations skip untracked path rustc_middle.mono_items.json during rustfmt invocations skip untracked path rustc_middle.mono_items.md during rustfmt invocations skip untracked path rustc_query_impl.mono_items-thread_local_attr.json during rustfmt invocations skip untracked path rustc_query_impl.mono_items-thread_local_macro.json during rustfmt invocations skip untracked path rustc_query_impl.mono_items.md during rustfmt invocations tidy check Found 505 error codes Highest error code: `E0793` * 397 features Ensuring the YAML anchors in the GitHub Actions config were expanded Building tool expand-yaml-anchors (stage0) Finished release [optimized + debuginfo] target(s) in 0.14s Build completed successfully in 0:00:54 ``` After: ``` Building tool tidy (stage0) Finished release [optimized + debuginfo] target(s) in 2.24s fmt check tidy check Ensuring the YAML anchors in the GitHub Actions config were expanded Building tool expand-yaml-anchors (stage0) Finished release [optimized + debuginfo] target(s) in 0.14s Build completed successfully in 0:00:04 ```
2023-03-05Don't walk the `tests/` directories in checks that always skip itJoshua Nelson-25/+15
`WalkBuilder` handles top-level paths differently than `fn walk` used to: it doesn't run the `skip` function to determine if it should be skipped, instead assuming the top-level function is always included. This is a reasonable assumption; adapt our code so it doesn't make pointless calls to `walk`.
2023-03-05Reuse allocations between filesJoshua Nelson-3/+6
2023-03-05Ignore things in .gitignore in tidyJoshua Nelson-83/+73
- Switch from `walkdir` to `ignore`. This required various changes to make `skip` thread-safe. - Ignore `build` anywhere in the source tree, not just at the top-level. We support this in bootstrap, we should support it in tidy too. As a nice side benefit, this also makes tidy a bit faster. Before: ``` ; hyperfine -i '"/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"' Benchmark 1: "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32" Time (mean ± σ): 1.080 s ± 0.008 s [User: 2.616 s, System: 3.243 s] Range (min … max): 1.069 s … 1.099 s 10 runs ``` After: ``` ; hyperfine '"/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"' Benchmark 1: "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32" Time (mean ± σ): 705.0 ms ± 1.4 ms [User: 3179.1 ms, System: 1517.5 ms] Range (min … max): 702.3 ms … 706.9 ms 10 runs ```
2023-02-26refactor: statically guarantee that current error codes are documentedEzra Shaw-21/+3
2023-02-25docs/test: add UI test and docs for `E0476`Ezra Shaw-1/+1
2023-02-21Use a lock-free datastructure for `source_span`Oli Scherer-0/+1
2023-02-17Rollup merge of #108009 - c410-f3r:moar-tests, r=petrochenkovMatthias Krüger-1/+1
Move some tests r? `@petrochenkov`
2023-02-16Move testsCaio-1/+1
2023-02-16Remove save-analysis.Nicholas Nethercote-2/+0
Most tests involving save-analysis were removed, but I kept a few where the `-Zsave-analysis` was an add-on to the main thing being tested, rather than the main thing being tested. For `x.py install`, the `rust-analysis` target has been removed. For `x.py dist`, the `rust-analysis` target has been kept in a degenerate form: it just produces a single file `reduced.json` indicating that save-analysis has been removed. This is necessary for rustup to keep working. Closes #43606.
2023-02-10Resolve documentation links in rustc and store the results in metadataVadim Petrochenkov-0/+2
This commit implements MCP https://github.com/rust-lang/compiler-team/issues/584 It also removes code that is no longer used, and that includes code cloning resolver, so issue #83761 is fixed.
2023-02-09UI tests for -Z instrument-xrayOleksii Lozovskyi-1/+1
I'm tired of testing it manually, just codify my expectations in tests. They're pretty low-maintenance.
2023-02-07Auto merge of #107767 - matthiaskrgr:rollup-9m1qfso, r=matthiaskrgrbors-1/+1
Rollup of 8 pull requests Successful merges: - #100599 (Add compiler error E0523 long description and test) - #107471 (rustdoc: do not include empty default-settings tag in HTML) - #107555 (Modify existing bounds if they exist) - #107662 (Turn projections into copies in CopyProp.) - #107695 (Add test for Future inflating arg size to 3x ) - #107700 (Run the tools builder on all PRs) - #107706 (Mark 'atomic_mut_ptr' methods const) - #107709 (Fix problem noticed in PR106859 with char -> u8 suggestion) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-06Add `run-rustfix` to tests/ui/issues/issue-92741.rsCastilloDel-1/+1
2023-02-06Add extended error message for E0523Matthew Kelly-1/+1
Adds the extended error documentation for E0523 to indicate that the error is no longer produced by the compiler. Update the E0464 documentation to include example code that produces the error. Remove the error message E0523 from the compiler and replace it with an internal compiler error.
2023-02-05Add UI test for issue #92741CastilloDel-1/+1
2023-01-24Update tidy for cranelift-egraph removal and new windows-sys targetsbjorn3-2/+2
2023-01-23Rollup merge of #107148 - Ezrashaw:uncode-e0789, ↵Yuki Okushi-1/+1
r=compiler-errors,GuillaumeGomez remove error code from `E0789`, add UI test/docs `E0789` shouldn't have an error code, it's explicitly internal-only and is tiny in scope. (I wonder if we can tighten the standard for this in the RFC?) I also added a UI test and error docs (done like `E0208`, they are "no longer emitted"). r? `@GuillaumeGomez` (shouldn't need a compiler review, it's pretty minor)
2023-01-23add UI test + docs for `E0789`Ezra Shaw-1/+1
2023-01-20Rollup merge of #107124 - DebugSteven:check-macro-expansion, r=albertlarsan68Michael Goulet-1/+1
fix check macro expansion If the only argument to `check!` is the module name I get this error: ``` error: expected expression, found `,` --> src/tools/tidy/src/main.rs:63:42 | 57 | / macro_rules! check { 58 | | ($p:ident $(, $args:expr)* ) => { 59 | | drain_handles(&mut handles); 60 | | ... | 63 | | $p::check($($args),* , &mut flag); | | ^ expected expression ... | 69 | | } 70 | | } | |_________- in this expansion of `check!` ... 117 | check!(hey); | ----------- in this macro invocation ``` This change makes it so commas are added only when there are `args`. r? ```@albertlarsan68```
2023-01-20Rollup merge of #107048 - DebugSteven:newer-x-check-cargo, r=albertlarsan68Michael Goulet-0/+72
check for x version updates This PR adds a check to tidy to assert that the installed version of `x` is equal to the version in `src/tools/x/Cargo.toml`. It checks the installed version of `x` by parsing the output of `cargo install --list` (as an option proposed in this [issue](https://github.com/rust-lang/rust/issues/106469)). It does not warn if `x` has not yet been installed, on the assumption that the user isn't interested in using it.
2023-01-20remove leading comma when there are no args in check macro expansionDebugSteven-1/+1
2023-01-20run cargo install to check for x installation and versionDebugSteven-0/+72
2023-01-19Rollup merge of #106931 - Ezrashaw:docs-e0208, r=compiler-errorsGuillaume Gomez-2/+1
document + UI test `E0208` and make its output more user-friendly Cleans up `E0208`'s output a lot. It could actually be useful for someone learning about variance now. I also added a UI test for it in `tests/ui/error-codes/` and wrote some docs for it. r? `@GuillaumeGomez` another error code, can't be bothered to find the issue :P. Obviously there's some compiler stuff, so you'll have to hand it off. Part of https://github.com/rust-lang/rust/issues/61137.
2023-01-18remove error code from `#[rustc_variance]` and document its remainsEzra Shaw-2/+1
2023-01-17Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726Matthias Krüger-0/+20
Remove double spaces after dots in comments Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17Skip tidy style checks for `rustc_apfloat`Maybe Waffle-0/+4