summary refs log tree commit diff
path: root/src/tools
AgeCommit message (Collapse)AuthorLines
2025-08-02Revert "`return_and_then`: only lint returning expressions (#14783)"Philipp Krones-165/+9
This reverts commit 459364b971c717462e99848ceba3eb545867ee33, reversing changes made to 62ba9969a4969574716e52dac1a28a11202c0ea2.
2025-08-02Revert "Extend `manual_is_variant_and lint` to check for boolean map ↵Philipp Krones-240/+15
comparisons (#14646)" This reverts commit 551870df96213c423c94a012c1981fc0cdc06fc2, reversing changes made to 3927a61a546b0f134b3790d66ef73f1960e8bc8b.
2025-08-02Consider deref'ed argument as non-temporary (#15172)Timo-16/+166
If there are more than one dereference (there is one corresponding matched with a borrow in any case), consider that the argument might point to a place expression, which is the safest choice. Also, use an appropriate number of dereferences in suggestions involving arguments using themselves multiple dereferences. Fixes rust-lang/rust-clippy#15166 changelog: [`swap_with_temporary`]: fix false positive leading to different semantics being suggested, and use the right number of dereferences in suggestion r? y21 <!-- TRIAGEBOT_START --> <!-- TRIAGEBOT_SUMMARY_START --> ### Summary Notes - [beta-nomination](https://github.com/rust-lang/rust-clippy/pull/15172#issuecomment-3016752569) by [samueltardieu](https://github.com/samueltardieu) *Managed by `@rustbot`—see [help](https://forge.rust-lang.org/triagebot/note.html) for details* <!-- TRIAGEBOT_SUMMARY_END --> <!-- TRIAGEBOT_END -->
2025-08-02Move `uninlined_format_args` to `pedantic` (#15287)dswij-1/+1
Fixes https://github.com/rust-lang/rust-clippy/issues/15151 See also https://rust-lang.zulipchat.com/#narrow/channel/257328-clippy/topic/uninlined_format_args.20is.20contentious/ changelog: Move [`uninlined_format_args`] to `pedantic`
2025-07-24Mitigate `#[align]` name resolution ambiguity regression with a renameJieyou Xu-3/+7
From `#[align]` -> `#[rustc_align]`. Attributes starting with `rustc` are always perma-unstable and feature-gated by `feature(rustc_attrs)`. See regression RUST-143834. For the underlying problem where even introducing new feature-gated unstable built-in attributes can break user code such as ```rs macro_rules! align { () => { /* .. */ }; } pub(crate) use align; // `use` here becomes ambiguous ``` refer to RUST-134963. Since the `#[align]` attribute is still feature-gated by `feature(fn_align)`, we can rename it as a mitigation. Note that `#[rustc_align]` will obviously mean that current unstable user code using `feature(fn_aling)` will need additionally `feature(rustc_attrs)`, but this is a short-term mitigation to buy time, and is expected to be changed to a better name with less collision potential. See <https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202025-07-17/near/529290371> where mitigation options were considered. (cherry picked from commit 69b71e44107b4905ec7ad84ccb3edf4f14b3df69)
2025-07-24Reword mismatched-lifetime-syntaxes text based on feedbackJake Goulding-6/+7
Key changes include: - Removal of the word "syntax" from the lint message. More accurately, it could have been something like "syntax group" or "syntax category", but avoiding it completely is easier. - The primary lint message now reflects exactly which mismatch is occurring, instead of trying to be general. A new `help` line is general across the mismatch kinds. - Suggestions have been reduced to be more minimal, no longer also changing non-idiomatic but unrelated aspects. - Suggestion text no longer mentions changes when those changes don't occur in that specific suggestion. (cherry picked from commit 553074431875701f66107049339dc1e67f0cdeba)
2025-07-11fix: Use `ROOT` hygiene for `args` inside new `format_args!` expansionShoyu Vanilla-27/+36
2025-07-11Backport new sized-hierarchy trait bounds in old waysShoyu Vanilla-24/+78
2025-07-11Adjust minicore for Sized Hierarchy changesLukas Wirth-52/+75
2025-07-11Minic rustc's new `format_args!` expansionShoyu Vanilla-41/+366
2025-07-11Implement region negation to minicore and add a flag `fmt_before_1_89_0`Shoyu Vanilla-8/+49
2025-06-24[beta] Update cargoEric Huss-0/+0
2025-06-23Auto merge of #142901 - matthiaskrgr:rollup-topt4p6, r=matthiaskrgrbors-6/+31
Rollup of 5 pull requests Successful merges: - rust-lang/rust#141597 (Document subdirectories of UI tests with README files) - rust-lang/rust#142823 (Port `#[no_mangle]` to new attribute parsing infrastructure) - rust-lang/rust#142828 (1.88.0 release notes) - rust-lang/rust#142854 (centralize `-Zmin-function-alignment` logic) - rust-lang/rust#142875 (Check rustdoc-json-types FORMAT_VERSION is correctly updated) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-23Rollup merge of #142875 - GuillaumeGomez:rustdoc-json-types-version-update, ↵Matthias Krüger-0/+25
r=Kobzol Check rustdoc-json-types FORMAT_VERSION is correctly updated Follow-up of https://github.com/rust-lang/rust/pull/142677. ``@nnethercote`` suggested that we should also ensure that the `FORMAT_VERSION` was only increased by 1 and we should check for it, this PR does it. cc ``@aDotInTheVoid`` r? ghost
2025-06-22Update cargoEric Huss-0/+0
2025-06-22Port `#[no_mangle]` to new attribute parsing infrastructureJonathan Brouwer-6/+6
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-22Rollup merge of #142877 - ↵Guillaume Gomez-0/+3
yotamofek:pr/rustdoc/comment-eslint-installation-req, r=GuillaumeGomez Document why tidy checks if `eslint` is installed via `npm` Discussion here: rust-lang/rust#142851
2025-06-22Document why tidy checks if `eslint` is installed via `npm`Yotam Ofek-0/+3
2025-06-22Check rustdoc-json-types FORMAT_VERSION correct changeGuillaume Gomez-0/+25
2025-06-22Port `#[must_use]` to new attribute parsing infrastructureJonathan Brouwer-20/+40
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-22Rollup merge of #142776 - dtolnay:hirattrstyle2, r=jdonszelmannJacob Pratt-3/+10
All HIR attributes are outer Fixes https://github.com/rust-lang/rust/issues/142649. Closes https://github.com/rust-lang/rust/pull/142759. All HIR attributes, including parsed and not yet parsed, will now be rendered as outer attributes by `rustc_hir_pretty`. The original style of the corresponding AST attribute(s) is not relevant for pretty printing, only for diagnostics. r? ````@jdonszelmann````
2025-06-22forward the bootstrap `runner` to `run-make`Folkert de Vries-1/+28
The runner was already forwarded to `compiletest`, this just passes it on to `run-make` and uses it in the `run` functions.
2025-06-21All HIR attributes are outerDavid Tolnay-3/+10
2025-06-21Rollup merge of #142804 - zachs18:rename-layouts-to-layoutdata-in-comments, ↵Matthias Krüger-1/+1
r=saethlin Rename `LayoutS` to `LayoutData` in comments `LayoutS` was renamed to `LayoutData`, but some comments in the compiler were not changed. This updates comments in the compiler (and one section of commented-out code in rust-analyzer) to refer to `LayoutData` instead of `LayoutS`. cc <https://github.com/rust-lang/rust/pull/132252>, `@workingjubilee`
2025-06-21Rollup merge of #142787 - samueltardieu:diag-items-for-clippy, ↵Matthias Krüger-24/+16
r=Manishearth,Urgau Add diagnostic items for Clippy Clippy still uses some paths to access items from the standard library. Adding the missing diagnostic items allows removing the last remaining paths. Closes rust-lang/rust-clippy#5393
2025-06-21Rollup merge of #142785 - epage:link, r=ehussMatthias Krüger-0/+1
fix(linkcheck): Build using the lockfile This is to unblock cargo from servo/html5ever#623 I ran `linkcheck.sh` locally and it now works
2025-06-21Rollup merge of #142502 - nnethercote:rustdoc-json-GenericArgs, r=aDotInTheVoidMatthias Krüger-7/+6
rustdoc_json: improve handling of generic args This PR fixes some inconsistencies and inefficiencies in how generic args are handled by rustdoc-json-types. r? `@aDotInTheVoid`
2025-06-21rustdoc_json: represent generic args consistently.Nicholas Nethercote-7/+6
They show up in three places: once as `Option<Box<GenericArgs>>`, once as `Box<GenericArgs>`, and once as `GenericArgs`. The first option is best. It is more compact because generic args are often missing. This commit changes the latter two to the former. Example output, before and after, for the `AssocItemConstraint` change: ``` {"name":"Offset","args":{"angle_bracketed":{"args":[],"constraints":[]}},"binding":{...}} {"name":"Offset","args":null,"binding":{...}} ``` Example output, before and after, for the `Type::QualifiedPath` change: ``` {"qualified_path":{"name":"Offset","args":{"angle_bracketed":{"args":[],"constraints":[]}}, ...}} {"qualified_path":{"name":"Offset","args":null, ...}} ``` This reduces JSON output size, but not by much (e.g. 0.5%), because `AssocItemConstraint` and `Type::QualifiedPath` are uncommon.
2025-06-20Rollup merge of #142677 - GuillaumeGomez:check-format-version-update, r=KobzolTrevor Gross-0/+103
Add CI check to ensure that rustdoc JSON `FORMAT_VERSION` is correctly updated Follow-up of https://github.com/rust-lang/rust/pull/142601. Tested it locally with: `BASE_COMMIT=1bb335244c311a07cee165c28c553c869e6f64a9 src/ci/docker/host-x86_64/mingw-check-1/validate-rustdoc-json-format-version-update.sh` (where `BASE_COMMIT` value was the commit before I made a wrong change with the `FORMAT_VERSION` update). This is a first version. I plan to send a follow-up to also ensure that `FORMAT_VERSION` is updated if any code change is done in `rustdoc-json-types`. For that I just need to check that a line not starting with `/` and not an empty line was updated. Fun times with `grep` ahead. :') cc `@aDotInTheVoid` r? `@nnethercote`
2025-06-20Rollup merge of #142384 - celinval:chores-rayon-mv, r=oli-obkTrevor Gross-1/+1
Bringing `rustc_rayon_core` in tree as `rustc_thread_pool` This PR moves [`rustc_rayon_core`](https://github.com/rust-lang/rustc-rayon/tree/5fadf44/rayon-core) from commit `5fadf44` as suggested in [this zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/Bringing.20.60rustc_rayon_core.60.20in.20tree). I tried to split the work into separate commits so it is easy to review. The first commit is a simple copy and paste from the fork, and subsequent changes were made to use the new crate and to ensure the new crate complies with different format and lint expectations. **Call-out:** I was also wondering if I need to make any further changes to accommodate licensing requirements. r? oli-obk
2025-06-20Auto merge of #142794 - tgross35:rollup-iae7okj, r=tgross35bors-41/+20
Rollup of 9 pull requests Successful merges: - rust-lang/rust#142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.) - rust-lang/rust#142491 (Rework #[cold] attribute parser) - rust-lang/rust#142494 (Fix missing docs in `rustc_attr_parsing`) - rust-lang/rust#142495 (Better template for `#[repr]` attributes) - rust-lang/rust#142497 (Fix random failure when JS code is executed when the whole file was not read yet) - rust-lang/rust#142575 (Ensure copy* intrinsics also perform the static self-init checks) - rust-lang/rust#142650 (Refactor Translator) - rust-lang/rust#142713 (mbe: Refactor transcription) - rust-lang/rust#142755 (rustdoc: Remove `FormatRenderer::cache`) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-20Rollup merge of #142767 - nnethercote:symbol-cleanups, r=petrochenkovJakub Beránek-2/+2
Some symbol and PathRoot cleanups I'm looking into unifying how we join and print paths. Here are some preliminary cleanups. r? ``@petrochenkov``
2025-06-20rust-analyzer: Rename LayoutS to LayoutData in commentsZachary S-1/+1
2025-06-20Rollup merge of #142650 - camsteffen:refactor-translator, r=petrochenkovTrevor Gross-41/+20
Refactor Translator My main motivation was to simplify the usage of `SilentEmitter` for users like rustfmt. A few refactoring opportunities arose along the way. * Replace `Translate` trait with `Translator` struct * Replace `Emitter: Translate` with `Emitter::translator` * Split `SilentEmitter` into `FatalOnlyEmitter` and `SilentEmitter`
2025-06-20clippy: replace path uses by diagnostic itemsSamuel Tardieu-24/+16
2025-06-20Improve error message for rustdoc_json_types tidy checkGuillaume Gomez-10/+20
Only emit git errors if we are in CI environment
2025-06-20fix(linkcheck): Build using the lockfileEd Page-0/+1
This is to unblock cargo from servo/html5ever#623
2025-06-20Pass `src_path` to rustdoc_json tidy checkGuillaume Gomez-11/+13
2025-06-20Generate base commit in rustdoc_json tidy checksGuillaume Gomez-4/+27
2025-06-20Add CI check to ensure that rustdoc JSON `FORMAT_VERSION` is correctly updatedGuillaume Gomez-0/+68
2025-06-20Auto merge of #142286 - Kobzol:clippy-jemalloc, r=flip1995,blyxyasbors-0/+36
Use jemalloc for Clippy The tool macros are annoying, we should IMO just get rid of them, create separate steps for each tool and (re)use some builders in them to share the build code. r? `@ghost`
2025-06-20Remove an unnecessary check in rustfmt.Nicholas Nethercote-1/+1
"{{root}}" is an internal-only name, and cannot appear in Rust code being formatted.
2025-06-20Avoid some unnecessary symbol interning.Nicholas Nethercote-1/+1
- `Ident::from_str_and_span` -> `Ident::new` when the string is pre-interned. - `Ident::from_str` -> `Ident::with_dummy_span` when the string is pre-interned. - `_d` and `_e` are unused.
2025-06-19Auto merge of #140748 - m-ou-se:super-format-args3, r=jdonszelmannbors-53/+47
Allow storing `format_args!()` in variable Fixes https://github.com/rust-lang/rust/issues/92698 Tracking issue for super let: https://github.com/rust-lang/rust/issues/139076 Tracking issue for format_args: https://github.com/rust-lang/rust/issues/99012 This change allows: ```rust let name = "world"; let f = format_args!("hello {name}!"); // New: Store format_args!() for later! println!("{f}"); ``` This will need an FCP. This implementation makes use of `super let`, which is unstable and might not exist in the future in its current form. However, it is entirely reasonable to assume future Rust will always have _a_ way of expressing temporary lifetimes like this, since the (stable) `pin!()` macro needs this too. (This was also the motivation for merging https://github.com/rust-lang/rust/pull/139114.) (This is a second version of https://github.com/rust-lang/rust/pull/139135)
2025-06-19Extract SilentEmitterCameron Steffen-14/+9
2025-06-19Rename SilentEmitter -> FatalOnlyEmitterCameron Steffen-2/+2
2025-06-19Extract Translator structCameron Steffen-29/+13
2025-06-19Auto merge of #139244 - jieyouxu:exp/auto-cross-run-make, r=Kobzolbors-14/+58
Enable automatic cross-compilation in run-make tests Supersedes rust-lang/rust#138066. Blocker for rust-lang/rust#141856. Based on rust-lang/rust#138066 plus `rustdoc()` cross-compile changes. ### Summary This PR automatically specifies `--target` to `rustc()` and `rustdoc()` to have `rustc`/`rustdoc` produce cross-compiled artifacts in run-make tests by default, unless: - `//@ ignore-cross-compile` is used, or - `bare_{rustc,rustdoc}` are used, or - Explicit `.target()` is specified, which overrides the default cross-compile target. Some tests are necessarily modified: - Tests that have `.target(target())` have that incantation removed (since this is now automatically the default). - Some tests have `//@ needs-target-std`, but are a necessary-but-insufficient condition, and are changed to `//@ ignore-cross-compile` instead as host-only tests. - A few tests received `//@ ignore-musl` that fail against `x86_64-unknown-linux-musl` because of inability to find `-lunwind`. AFAICT, they don't *need* to test cross-compiled artifacts. - Some tests are constrained to host-only for now, because the effort to make them pass on cross-compile does not seem worth the complexity, and it's not really *meaningfully* improving test coverage. try-job: dist-various-1
2025-06-18Rollup merge of #142524 - rust-lang:cargo_update, r=Mark-SimulacrumTrevor Gross-46/+40
Weekly `cargo update` Automation to keep dependencies in `Cargo.lock` current. The following is the output from `cargo update`: ```txt compiler & tools dependencies: Locking 31 packages to latest compatible versions Updating adler2 v2.0.0 -> v2.0.1 Updating cfg-if v1.0.0 -> v1.0.1 Updating clap v4.5.39 -> v4.5.40 Updating clap_builder v4.5.39 -> v4.5.40 Updating clap_derive v4.5.32 -> v4.5.40 Updating clap_lex v0.7.4 -> v0.7.5 Updating getopts v0.2.21 -> v0.2.23 Updating hermit-abi v0.5.1 -> v0.5.2 Updating jiff v0.2.14 -> v0.2.15 Updating jiff-static v0.2.14 -> v0.2.15 Updating libc v0.2.172 -> v0.2.173 Updating memchr v2.7.4 -> v2.7.5 Updating minifier v0.3.5 -> v0.3.6 Updating miniz_oxide v0.8.8 -> v0.8.9 Updating object v0.37.0 -> v0.37.1 Updating redox_syscall v0.5.12 -> v0.5.13 Updating rustc-demangle v0.1.24 -> v0.1.25 Updating syn v2.0.101 -> v2.0.103 Updating thread_local v1.1.8 -> v1.1.9 Updating unicode-width v0.2.0 -> v0.2.1 Updating wasi v0.11.0+wasi-snapshot-preview1 -> v0.11.1+wasi-snapshot-preview1 Updating wasm-encoder v0.233.0 -> v0.235.0 Removing wasmparser v0.232.0 Removing wasmparser v0.233.0 Adding wasmparser v0.234.0 Adding wasmparser v0.235.0 Updating wast v233.0.0 -> v235.0.0 Updating wat v1.233.0 -> v1.235.0 Updating windows v0.61.1 -> v0.61.3 Updating windows-link v0.1.1 -> v0.1.3 Adding windows-sys v0.60.2 Updating windows-targets v0.53.0 -> v0.53.2 Updating winnow v0.7.10 -> v0.7.11 note: pass `--verbose` to see 39 unchanged dependencies behind latest library dependencies: Locking 1 package to latest compatible version Updating libc v0.2.172 -> v0.2.173 note: pass `--verbose` to see 4 unchanged dependencies behind latest rustbook dependencies: Locking 19 packages to latest compatible versions Updating adler2 v2.0.0 -> v2.0.1 Updating cc v1.2.26 -> v1.2.27 Updating cfg-if v1.0.0 -> v1.0.1 Updating clap v4.5.39 -> v4.5.40 Updating clap_builder v4.5.39 -> v4.5.40 Updating clap_complete v4.5.52 -> v4.5.54 Updating clap_derive v4.5.32 -> v4.5.40 Updating clap_lex v0.7.4 -> v0.7.5 Updating getopts v0.2.21 -> v0.2.23 Updating jiff v0.2.14 -> v0.2.15 Updating jiff-static v0.2.14 -> v0.2.15 Updating libc v0.2.172 -> v0.2.173 Updating memchr v2.7.4 -> v2.7.5 Updating miniz_oxide v0.8.8 -> v0.8.9 Updating redox_syscall v0.5.12 -> v0.5.13 Updating syn v2.0.101 -> v2.0.103 Removing unicode-width v0.1.14 Removing unicode-width v0.2.0 Adding unicode-width v0.2.1 Updating windows-link v0.1.1 -> v0.1.3 Updating winnow v0.7.10 -> v0.7.11 ```
2025-06-18Rollup merge of #142507 - folkertdev:fn-align-align-attribute, r=jdonszelmannTrevor Gross-5/+5
use `#[align]` attribute for `fn_align` Tracking issue: https://github.com/rust-lang/rust/issues/82232 https://github.com/rust-lang/rfcs/pull/3806 decides to add the `#[align]` attribute for alignment of various items. Right now it's used for functions with `fn_align`, in the future it will get more uses (statics, struct fields, etc.) (the RFC finishes FCP today) r? `@ghost`