Commit Graph

300570 Commits

Author SHA1 Message Date
Matthias Krüger
017fe2fb8f Rollup merge of #143252 - JonathanBrouwer:rewrite_empty_attribute, r=jdonszelmann
Rewrite empty attribute lint for new attribute parser

cc `@jdonszelmann`
2025-07-06 15:56:12 +02:00
bors
3c95364c4a Auto merge of #143515 - rust-lang:cargo_update, r=clubby789
Weekly `cargo update`

Automation to keep dependencies in `Cargo.lock` current.
r? dep-bumps

The following is the output from `cargo update`:

```txt

compiler & tools dependencies:
     Locking 6 packages to latest compatible versions
      Adding io-uring v0.7.8
    Updating jsonpath-rust v1.0.2 -> v1.0.3
    Updating libffi v4.1.0 -> v4.1.1
    Updating libffi-sys v3.3.1 -> v3.3.2
    Updating tokio v1.45.1 -> v1.46.1
    Updating wasm-component-ld v0.5.14 -> v0.5.15
note: pass `--verbose` to see 41 unchanged dependencies behind latest

library dependencies:
     Locking 0 packages to latest compatible versions
note: pass `--verbose` to see 4 unchanged dependencies behind latest

rustbook dependencies:
     Locking 1 package to latest compatible version
    Updating cc v1.2.27 -> v1.2.29
```
2025-07-06 13:53:52 +00:00
Makai
c42a9ac602 move stable_mir back to its own crate and move rustc_internal to thestable_mir crate
As part of this reorganization, some traits need to be moved from `rustc_smir::context::traits` to `stable_mir::unstable::internal_cx`. These traits are specifically designed for `InternalCx` to clarify the behavior of different functions that share the same name. This move is necessary to avoid orphan rule violations.
2025-07-06 12:25:42 +00:00
Chayim Refael Friedman
a9b8eec4b7 Include enum variants in world symbols
I opted to not include enum variant imports, only under the enum, and to not gate this behind a setting.
2025-07-06 14:52:10 +03:00
bors
c83e217d26 Auto merge of #143521 - matthiaskrgr:rollup-kpv1og3, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#143416 (mbe: Defer checks for `compile_error!` until reporting an unused macro rule)
 - rust-lang/rust#143470 (std: sys: net: uefi: tcp4: Implement read)
 - rust-lang/rust#143477 (use `is_multiple_of` and `div_ceil`)
 - rust-lang/rust#143484 (distinguish the duplicate item of rpitit)
 - rust-lang/rust#143493 (tidy: use --bless for tidy spellcheck instead of spellcheck:fix)
 - rust-lang/rust#143504 (compiletest: print slightly more information on fs::write failure)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-06 10:20:27 +00:00
Camille GILLOT
bab9c752e8 Do not unify borrowed locals in CopyProp. 2025-07-06 10:14:07 +00:00
dswij
8d688c6f60 Do not remove as if it changes the type (#15182)
While `expr as T` can be removed as a statement if `expr` has no
side-effect, the `as T` part alone cannot be removed if the type of
`expr` would be ambiguous without the cast.

changelog: [`unnecessary_operation`]: do not remove casts if they are
useful to type the expression

Fixes rust-lang/rust-clippy#15173
2025-07-06 09:58:44 +00:00
Lukas Wirth
1cf9a7bd7b Merge pull request #20184 from Veykril/push-ywpynxnltpok
chore: Remove dead field from `InferenceContext`
2025-07-06 09:08:36 +00:00
Lukas Wirth
836e0cbccf chore: Remove dead field from InferenceContext 2025-07-06 10:57:06 +02:00
Matthias Krüger
097efc07cc Rollup merge of #143504 - RalfJung:compiletest-err, r=jieyouxu
compiletest: print slightly more information on fs::write failure

See [#t-infra > compiletest: panic in dump_output_file: No such file or dire @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/compiletest.3A.20panic.20in.20dump_output_file.3A.20No.20such.20file.20or.20dire/near/527294714)
2025-07-06 10:03:24 +02:00
Matthias Krüger
e25654fb94 Rollup merge of #143493 - lolbinarycat:tidy-spellcheck-bless, r=Kobzol
tidy: use --bless for tidy spellcheck instead of spellcheck:fix

previous behavior was inconsistent with existing extra checks.

unsure if this needs a change tracker entry or a warning for people who try to use the old behavior.

unsure if we should call this `spellcheck:lint` for consistency.

making this consistent is a prerequisite for https://github.com/rust-lang/rust/pull/143398

cc `@nnethercote`

r? `@Kobzol`
2025-07-06 10:03:24 +02:00
Matthias Krüger
534c09a779 Rollup merge of #143484 - bvanjoi:issue-140796, r=compiler-errors
distinguish the duplicate item of rpitit

Fixes rust-lang/rust#140796

r? compiler

cc `@Zoxc`
2025-07-06 10:03:23 +02:00
Matthias Krüger
6fb00b1514 Rollup merge of #143477 - folkertdev:use-is-multiple-of, r=joshtriplett
use `is_multiple_of` and `div_ceil`

In tricky logic, these functions are much more informative than the manual implementations. They also catch subtle bugs:

- the manual `is_multiple_of` often does not handle division by zero
- manual `div_ceil` often does not consider overflow

The transformation is free for `is_multiple_of` if the divisor is compile-time known to be non-zero. For `div_ceil` there is a small cost to considering overflow. Here is some assembly https://godbolt.org/z/5zP8KaE1d.
2025-07-06 10:03:23 +02:00
Matthias Krüger
19f8ba4733 Rollup merge of #143470 - Ayush1325:uefi-tcp4-recv, r=joshtriplett
std: sys: net: uefi: tcp4: Implement read

- A blocking implementation of tcp4 read.
- Basically a copy of [write](https://github.com/rust-lang/rust/pull/141532)
2025-07-06 10:03:22 +02:00
Matthias Krüger
71b73e529a Rollup merge of #143416 - joshtriplett:mbe-simplifications, r=nnethercote
mbe: Defer checks for `compile_error!` until reporting an unused macro rule

The current MBE parser checks rules at initial parse time to see if their RHS has `compile_error!` in it, and returns a list of rule indexes and LHS spans that don't map to `compile_error!`, for use in unused macro rule checking.

Instead, have the unused macro rule reporting ask the macro for the rule to report, and let the macro check at that time. That avoids checking rules unless they're unused.

In the process, refactor the data structure used to store macro rules, to group the LHS and RHS (and LHS span) of each rule together, and refactor the unused rule tracking to only track rule indexes.

This builds atop a couple of minor MBE refactors. I would suggest reviewing commit-by-commit.

The overall result is a further simplification of the macro code.
2025-07-06 10:03:22 +02:00
Lukas Wirth
eca5905364 Merge pull request #20132 from A4-Tacks/asmut-borrow-minicore
Add AsMut, Borrow and BorrowMut to minicore and famous_defs
2025-07-06 08:01:54 +00:00
Lukas Wirth
37f2263438 Merge pull request #20126 from Wilfred/no_unwrap_in_discover_projects
fix: Avoid .unwrap() when running the discover command
2025-07-06 08:01:10 +00:00
Jonathan Brouwer
33f2cc7eda Fix line break after ":" in unpretty attribute print
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 09:51:47 +02:00
Jonathan Brouwer
8aad0e6ad9 Rewrite empty attribute lint
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 09:51:35 +02:00
Jonathan Brouwer
3fa0ec91d8 Rewrite empty attribute lint
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 09:51:35 +02:00
Samuel Tardieu
7c39d378e5 Propagate accept-comment-above-attributes to statements (#15213)
Turns out that things like `#[attr]return unsafe { func(); }` didn't
work because we weren't checking above attributes on statements, only on
blocks!

fixes https://github.com/rust-lang/rust-clippy/issues/13189

Useful for Rust-For-Linux

changelog:[`undocumented_unsafe_blocks`]: Make sure to propagate
`accept-comment-above-attributes` to **all** statements.
2025-07-06 07:28:40 +00:00
bors
e804cd4a5f Auto merge of #143354 - Shourya742:2025-07-03-bye-bye-as_mut-command, r=Kobzol
Port streaming commands in bootstrap to `BootstrapCommand` and remove `as_command_mut`

This PR adds streaming capabilities to BootstrapCommand and migrate existing command streaming scenario's used in bootstrap.

r? `@Kobzol`
2025-07-06 07:13:02 +00:00
Lukas Wirth
bc10a25284 Merge pull request #20179 from ChayimFriedman2/destructuring-assignment-never
fix: Fix diverging destructuring assignments
2025-07-06 07:01:40 +00:00
bohan
5bbab8967d distinguish the duplicate item of rpitit 2025-07-06 14:04:40 +08:00
bors
febb10d0a2 Auto merge of #143507 - matthiaskrgr:rollup-lpg7t12, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#143238 (Port `#[ignore]` to the new attribute parsing infrastructure)
 - rust-lang/rust#143441 (Stop using `Key` trait unnecessarily)
 - rust-lang/rust#143478 (Miri subtree update)
 - rust-lang/rust#143486 (remove armv5te-unknown-linux-gnueabi target maintainer)
 - rust-lang/rust#143489 (Complete rustc_ast::mut_visit for spans.)
 - rust-lang/rust#143494 (Remove yields_in_scope from the scope tree.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-06 04:09:12 +00:00
Josh Triplett
131cffb6ba Rename tests named with mbe to use macro instead
Most macro tests use `macro` in the name, making it easy to find and run
tests relevant to macros. However, a few use `mbe` instead. Rename those
to say `macro`.
2025-07-05 21:09:10 -07:00
Josh Triplett
e99f9c5ffc rustc_builtin_macros: Make sure registered attributes stay sorted
As with the list of builtin macros, use tidy to make sure the list of
builtin attributes stays sorted.
2025-07-05 20:21:51 -07:00
Chayim Refael Friedman
7fb07c9069 Merge pull request #20175 from dianne/match-check-box-cleanup
`hir_ty::match_check` cleanup: remove special handling for box patterns
2025-07-06 02:32:49 +00:00
bors
75d5834a6c Auto merge of #143126 - dianqk:update-llvm, r=nikic
Update LLVM submodule

Fixes rust-lang/rust#140686, fixes rust-lang/rust#141913, fixes rust-lang/rust#142752, fixes rust-lang/rust#143399.
2025-07-06 01:03:18 +00:00
Alejandra González
b28049d92b Not on vacation, again! (#15214)
As I said in my on-vacation PR (a little bit late) I'm getting
reincorporated into the review queue. Something that I'd like to do is
implement the reviewer capacity system into Clippy, but seems that it's
not supported yet. https://github.com/rust-lang/triagebot/issues/2007

r? @ghost
changelog:none
2025-07-06 00:35:46 +00:00
github-actions
31ea5f90c7 cargo update
compiler & tools dependencies:
     Locking 6 packages to latest compatible versions
      Adding io-uring v0.7.8
    Updating jsonpath-rust v1.0.2 -> v1.0.3
    Updating libffi v4.1.0 -> v4.1.1
    Updating libffi-sys v3.3.1 -> v3.3.2
    Updating tokio v1.45.1 -> v1.46.1
    Updating wasm-component-ld v0.5.14 -> v0.5.15
note: pass `--verbose` to see 41 unchanged dependencies behind latest

library dependencies:
     Locking 0 packages to latest compatible versions
note: pass `--verbose` to see 4 unchanged dependencies behind latest

rustbook dependencies:
     Locking 1 package to latest compatible version
    Updating cc v1.2.27 -> v1.2.29
2025-07-06 00:26:38 +00:00
blyxyas
b49064e9df Not on vacation, again! 2025-07-06 02:24:22 +02:00
blyxyas
e0e881f873 Propagate accept-comment-above-attributes to statements
Turns out that things like `#[attr]return unsafe { func(); }` didn't work
because we weren't checking above attributes on statements, only on blocks!
2025-07-06 02:23:50 +02:00
Chayim Refael Friedman
f74e9b0ebf Always bump in the parser in err_and_bump()
Even when at curly braces, otherwise the parser can get stuck.

This has happened in the past in #18625, but it was just worked around instead of handling the root of the problem. Now this happened again in #20171. IMO we can't let `err_and_bump()` not bump, that's too confusing and invites errors. We can (as I did) workaround the worse recovery instead.
2025-07-06 03:21:43 +03:00
dianne
68d860f8be remove DesugaringKind::CondTemporary 2025-07-05 17:14:06 -07:00
dianne
fc557bc5a5 clippy: conditions are no longer wrapped in DropTemps 2025-07-05 17:14:06 -07:00
dianne
75cea03e03 de-duplicate condition scoping logic 2025-07-05 17:14:06 -07:00
Josh Triplett
6d64306df1 Move macro tests in parser into macro directory
The `macro` directory contains most of the macro tests, but not all of
them; move the remainder into `macro`.
2025-07-05 16:52:59 -07:00
Josh Triplett
63cfb3af37 mbe: Defer checks for compile_error! until reporting an unused macro rule
The MBE parser checks rules at initial parse time to see if their RHS
has `compile_error!` in it, and returns a list of rule indexes and LHS
spans that don't map to `compile_error!`, for use in unused macro rule
checking.

Instead, have the unused macro rule reporting ask the macro for the rule
to report, and let the macro check at that time. That avoids checking
rules unless they're unused.

In the process, refactor the data structure used to store macro rules,
to group the LHS and RHS (and LHS span) of each rule together, and
refactor the unused rule tracking to only track rule indexes.

This ends up being a net simplification, and reduction in code size.
2025-07-05 16:23:13 -07:00
Josh Triplett
0d5ab3e46c mbe: Simplify a match to a let-else 2025-07-05 16:23:13 -07:00
Josh Triplett
a7382eae3f mbe: Add a helper to parse a single TokenTree
The parser repeatedly invokes the `parse` function, constructing a
one-entry vector, and assuming that the return value will be a one-entry
vector. Add a helper for that case. This will simplify adding additional
callers, and put all the logic in one place to allow potential future
simplification of the one-TT case.
2025-07-05 16:23:07 -07:00
Matthias Krüger
c3c4fd7c9c Rollup merge of #143494 - cjgillot:no-yield-in-scope, r=compiler-errors
Remove yields_in_scope from the scope tree.

I believe this has not been in use since we removed the HIR-based generator interior type computation.
2025-07-05 22:34:43 +02:00
Matthias Krüger
8a5d239949 Rollup merge of #143489 - cjgillot:mut-visit-span, r=petrochenkov
Complete rustc_ast::mut_visit for spans.

Extracted from https://github.com/rust-lang/rust/pull/127241

r? `@petrochenkov`
2025-07-05 22:34:42 +02:00
Matthias Krüger
5aa7be4473 Rollup merge of #143486 - husqvarnagroup:af/no-armv5te-target-maintainer, r=petrochenkov
remove armv5te-unknown-linux-gnueabi target maintainer

Sadly my former employer doesn't want to maintain this any more and I have no personal interest in maintaining it.
2025-07-05 22:34:42 +02:00
Matthias Krüger
7ad67e6b54 Rollup merge of #143478 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2025-07-05 22:34:41 +02:00
Matthias Krüger
0311159e02 Rollup merge of #143441 - compiler-errors:no-key, r=petrochenkov
Stop using `Key` trait unnecessarily

Few places where the `Key` trait was being used but not really for a useful reason. This fixes those usages.

Namely, `<Ty as Key>::default_span()` is `DUMMY_SP` anyways.
2025-07-05 22:34:41 +02:00
Matthias Krüger
9a921a32f6 Rollup merge of #143238 - JonathanBrouwer:ignore_parser, r=jdonszelmann
Port `#[ignore]` to the new attribute parsing infrastructure

Ports `ignore` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

This PR duplicates a change from https://github.com/rust-lang/rust/pull/143237
Draft until that one is merged
2025-07-05 22:34:40 +02:00
bors
5adb489a80 Auto merge of #142732 - compiler-errors:more-root, r=lcnr
Canonicalize input ty/ct infer/placeholder in the root universe

We shouldn't care what universe the inputs are, since we only ever do the leak check on the universes instantiated after entering the canonical binder.
2025-07-05 20:34:08 +00:00
binarycat
9f78173bb5 bootstrap: add change_tracker entry for removal of spellcheck:fix 2025-07-05 15:24:45 -05:00
Ralf Jung
9c9c5b041b compiletest: print slightly more information on fs::write failure 2025-07-05 22:21:23 +02:00