Skip to content

Rollup of 11 pull requests #143338

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

Merged
merged 27 commits into from
Jul 3, 2025
Merged

Rollup of 11 pull requests #143338

merged 27 commits into from
Jul 3, 2025

Conversation

matthiaskrgr
Copy link
Member

@matthiaskrgr matthiaskrgr commented Jul 2, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: test-various

ranger-ross and others added 27 commits October 19, 2024 19:39
The `macro_rules!` parser was written to match the series of rules using
the macros-by-example (MBE) engine and a hand-written equivalent of the
left-hand side of a MBE macro. This was complex to read, difficult to
extend, and produced confusing error messages. Because it was using the
MBE engine, any parse failure would be reported as if some macro was
being applied to the `macro_rules!` invocation itself; for instance,
errors would talk about "macro invocation", "macro arguments", and
"macro call", when they were actually about the macro *definition*.

And in practice, the `macro_rules!` parser only used the MBE engine to
extract the left-hand side and right-hand side of each rule as a token
tree, and then parsed the rest using a separate parser.

Rewrite it to parse the series of rules using a simple loop, instead.
This makes it more extensible in the future, and improves error
messages. For instance, omitting a semicolon between rules will result
in "expected `;`" and "unexpected token", rather than the confusing "no
rules expected this token in macro call".

This work was greatly aided by pair programming with Vincenzo Palazzo
and Eric Holk.
Also applies to `Vec::into_raw_parts`.

The expectation is that you can round-trip these methods with
`from_raw`, but this is only true when using the global allocator. With
custom allocators you should instead be using
`into_raw_with_allocator` and `from_raw_in`.

The implementation of `Box::leak` is changed to use
`Box::into_raw_with_allocator` and explicitly leak the allocator (which
was already the existing behavior). This is because, for `leak` to be
safe, the allocator must not free its underlying backing store. The
`Allocator` trait only guarantees that allocated memory remains valid
until the allocator is dropped.
This allows the use of `-Z track-diagnostics` to see the origin of
Clippy lints emission, as is already the case for lints coming from
rustc.
…rkind, r=tgross35

Derive `Copy` and `Hash` for `IntErrorKind`

This PR derives `Copy` and `Hash` for `IntErrorKind` to make it easier to work with. (see rust-lang#131826)

I think an argument could be made to also derive `PartialOrd` + `Ord` as well given that other error kinds in the std like [`io::ErrorKind`](https://doc.rust-lang.org/src/std/io/error.rs.html#212-428) do this. Granted these seem much less useful for errors.

Fixes rust-lang#131826
Remove some unsized tuple impls now that we don't support unsizing tuples anymore

Since rust-lang#137728 there is no sound way to create unsized tuples anymore. While we can't remove them from the language (tried here: rust-lang#138093) due to people using `PhantomData<(T, U)>` where `U: ?Sized` (they'd have to use `(PhantomData<T>, PhantomData<U>)` now), we can remove the impls from libcore I believe.

r? libs I guess?
Change `{Box,Arc,Rc,Weak}::into_raw` to only work with `A = Global`

Also applies to `Vec::into_raw_parts`.

The expectation is that you can round-trip these methods with `from_raw`, but this is only true when using the global allocator. With custom allocators you should instead be using `into_raw_with_allocator` and `from_raw_in`.

The implementation of `Box::leak` is changed to use `Box::into_raw_with_allocator` and explicitly leak the allocator (which was already the existing behavior). This is because, for `leak` to be safe, the allocator must not free its underlying backing store. The `Allocator` trait only guarantees that allocated memory remains valid until the allocator is dropped.
bootstrap: validate `rust.codegen-backends` & `target.<triple>.codegen-backends`

As per rust-lang#142184 (comment).

Closes rust-lang#142184.
…-dead

Detect more cases of unused_parens around types

With this change, more unused parentheses around bounds and types nested within bounds are detected.
…=oli-obk

Attribute rework: a parser for single attributes without arguments

Part of rust-lang#131229

r? `@jdonszelmann`

I think code (with comments) speaks for itself.

The only subtlety: now `#[cold]`, `#[no_mangle]`, & `#[track_caller]` do not get thrown away when malformed (i.e. have arguments). This doesn't matter too much (I think), because an error gets emitted either way, so the compilation will not finish.
…petrochenkov

Rewrite `macro_rules!` parser to not use the MBE engine itself

The `macro_rules!` parser was written to match the series of rules using the macros-by-example (MBE) engine and a hand-written equivalent of the left-hand side of a MBE macro. This was complex to read, difficult to extend, and produced confusing error messages. Because it was using the MBE engine, any parse failure would be reported as if some macro was being applied to the `macro_rules!` invocation itself; for instance, errors would talk about "macro invocation", "macro arguments", and "macro call", when they were actually about the macro *definition*.

And in practice, the `macro_rules!` parser only used the MBE engine to extract the left-hand side and right-hand side of each rule as a token tree, and then parsed the rest using a separate parser.

Rewrite it to parse the series of rules using a simple loop, instead. This makes it more extensible in the future, and improves error messages. For instance, omitting a semicolon between rules will result in "expected `;`" and "unexpected token", rather than the confusing "no rules expected this token in macro call".

This work was greatly aided by pair programming with Vincenzo Palazzo (`@vincenzopalazzo)` and Eric Holk (`@eholk).`

For review, I recommend reading the two commits separately.
…r=oli-obk

Assemble const bounds via normal item bounds in old solver too

Fixes the first example in https://rust-lang.zulipchat.com/#narrow/channel/144729-t-types/topic/elaboration.20of.20const.20bounds.3F/with/526378135

The code duplication here is not that nice, but it's at least very localized.

cc `@davidtwco`

r? oli-obk
…li-obk

Feed `explicit_predicates_of` instead of `predicates_of`

Tiny nitpick, just avoiding needing to mark the `predicates_of` query as feedable since it's derived from `explicit_predicates_of`.
…rn, r=Nadrieril

loop match: handle opaque patterns

tracking issue rust-lang#132306
fixes rust-lang#143203

I believe the `Opaque` comes up because the range pattern is invalid? Because we do handle float patterns already so those should be fine.

r? `@Nadrieril`
…mission, r=petrochenkov

Add `track_caller` attributes to trace origin of Clippy lints

This allows the use of `-Z track-diagnostics` to see the origin of Clippy lints emission, as is already the case for lints coming from rustc.
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) PG-exploit-mitigations Project group: Exploit mitigations labels Jul 2, 2025
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jul 2, 2025
@matthiaskrgr
Copy link
Member Author

@bors try

@bors
Copy link
Collaborator

bors commented Jul 2, 2025

⌛ Trying commit bc8bcc7 with merge 3207ab5...

bors added a commit that referenced this pull request Jul 2, 2025
Rollup of 11 pull requests

Successful merges:

 - #131923 (Derive `Copy` and `Hash` for `IntErrorKind`)
 - #138340 (Remove some unsized tuple impls now that we don't support unsizing tuples anymore)
 - #141219 (Change `{Box,Arc,Rc,Weak}::into_raw` to only work with `A = Global`)
 - #142212 (bootstrap: validate `rust.codegen-backends` & `target.<triple>.codegen-backends`)
 - #142237 (Detect more cases of unused_parens around types)
 - #142964 (Attribute rework: a parser for single attributes without arguments)
 - #143070 (Rewrite `macro_rules!` parser to not use the MBE engine itself)
 - #143235 (Assemble const bounds via normal item bounds in old solver too)
 - #143261 (Feed `explicit_predicates_of` instead of `predicates_of`)
 - #143276 (loop match: handle opaque patterns)
 - #143306 (Add `track_caller` attributes to trace origin of Clippy lints)

r? `@ghost`
`@rustbot` modify labels: rollup

try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: test-various
@bors
Copy link
Collaborator

bors commented Jul 2, 2025

☀️ Try build successful - checks-actions
Build commit: 3207ab5 (3207ab5c51b7f868ad8e806d0277855bdb567a17)

@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Jul 2, 2025

📌 Commit bc8bcc7 has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 2, 2025
@bors
Copy link
Collaborator

bors commented Jul 2, 2025

⌛ Testing commit bc8bcc7 with merge 25face9...

@bors
Copy link
Collaborator

bors commented Jul 3, 2025

☀️ Test successful - checks-actions
Approved by: matthiaskrgr
Pushing 25face9 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 3, 2025
@bors bors merged commit 25face9 into rust-lang:master Jul 3, 2025
11 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 3, 2025
Copy link
Contributor

github-actions bot commented Jul 3, 2025

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 6677875 (parent) -> 25face9 (this PR)

Test differences

Show 234 test diffs

Stage 1

  • [ui] tests/ui/lint/unused/unused-parens-trait-obj.rs#edition2015: [missing] -> pass (J0)
  • [ui] tests/ui/lint/unused/unused-parens-trait-obj.rs#edition2018: [missing] -> pass (J0)
  • [ui] tests/ui/traits/const-traits/const-via-item-bound.rs#current: [missing] -> pass (J0)
  • [ui] tests/ui/traits/const-traits/const-via-item-bound.rs#next: [missing] -> pass (J0)

Stage 2

  • [ui] tests/ui/lint/unused/unused-parens-trait-obj.rs#edition2015: [missing] -> pass (J1)
  • [ui] tests/ui/lint/unused/unused-parens-trait-obj.rs#edition2018: [missing] -> pass (J1)
  • [ui] tests/ui/traits/const-traits/const-via-item-bound.rs#current: [missing] -> pass (J1)
  • [ui] tests/ui/traits/const-traits/const-via-item-bound.rs#next: [missing] -> pass (J1)

Additionally, 226 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 25face9808491588e59b6d7844f2185b09eef479 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-aarch64-linux: 5738.3s -> 8071.2s (40.7%)
  2. dist-x86_64-apple: 7344.9s -> 9001.7s (22.6%)
  3. x86_64-apple-2: 5945.1s -> 4847.4s (-18.5%)
  4. dist-ohos-armv7: 3920.8s -> 4417.2s (12.7%)
  5. x86_64-apple-1: 7825.7s -> 8588.9s (9.8%)
  6. x86_64-msvc-2: 7023.4s -> 6492.9s (-7.6%)
  7. mingw-check-1: 1709.4s -> 1837.6s (7.5%)
  8. dist-aarch64-apple: 5298.0s -> 5675.9s (7.1%)
  9. dist-x86_64-solaris: 5028.4s -> 5339.8s (6.2%)
  10. x86_64-gnu-llvm-19-2: 5845.3s -> 6193.7s (6.0%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#131923 Derive Copy and Hash for IntErrorKind 24ed62c3fd4bdd88c8d10248414120a4c58e1604 (link)
#138340 Remove some unsized tuple impls now that we don't support u… da7202c9bcf2cd312471d05a2678d7a58699ffa7 (link)
#141219 Change {Box,Arc,Rc,Weak}::into_raw to only work with `A =… 02c19c770027b8809094a6c859a27b7673078971 (link)
#142212 bootstrap: validate rust.codegen-backends & `target.<trip… 713535262283feaeb493c62deca7cfb722672a4d (link)
#142237 Detect more cases of unused_parens around types 2d1c3a6c4a3c9f62d26cdaa5ec39656d6ace8220 (link)
#142964 Attribute rework: a parser for single attributes without ar… 69638000a91c04caa6f59fc57f7721eabe30286c (link)
#143070 Rewrite macro_rules! parser to not use the MBE engine its… 98e00f5fca2c53d8de5c3c98386fd5960b16770c (link)
#143235 Assemble const bounds via normal item bounds in old solver … 144a0cad76ba4257cd2105b4f4ad5b971ddf6665 (link)
#143261 Feed explicit_predicates_of instead of predicates_of 1f6f95c081c9897cf6b0aebcb9cd89512817ca8c (link)
#143276 loop match: handle opaque patterns 3a8aad6d04500977f9c4e207bf85e65f2129746b (link)
#143306 Add track_caller attributes to trace origin of Clippy lin… fc4890b56ea00bc97b7b2db2bc0f80cabf4584e1 (link)

previous master: 6677875279

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (25face9): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.4% [0.3%, 0.4%] 2
Regressions ❌
(secondary)
0.2% [0.2%, 0.4%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 1
All ❌✅ (primary) 0.4% [0.3%, 0.4%] 2

Max RSS (memory usage)

Results (primary 0.1%, secondary 1.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.0% [2.3%, 4.1%] 4
Regressions ❌
(secondary)
2.9% [0.5%, 4.9%] 3
Improvements ✅
(primary)
-5.8% [-6.3%, -5.4%] 2
Improvements ✅
(secondary)
-1.5% [-1.5%, -1.5%] 1
All ❌✅ (primary) 0.1% [-6.3%, 4.1%] 6

Cycles

Results (primary -1.6%, secondary 0.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.4% [0.9%, 3.6%] 5
Improvements ✅
(primary)
-1.6% [-1.6%, -1.6%] 1
Improvements ✅
(secondary)
-1.0% [-1.4%, -0.5%] 5
All ❌✅ (primary) -1.6% [-1.6%, -1.6%] 1

Binary size

Results (primary 0.1%, secondary -0.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.8%] 12
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 2
Improvements ✅
(primary)
-0.1% [-0.2%, -0.0%] 5
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.4%] 4
All ❌✅ (primary) 0.1% [-0.2%, 0.8%] 17

Bootstrap: 461.735s -> 459.625s (-0.46%)
Artifact size: 372.23 MiB -> 372.14 MiB (-0.02%)

@rustbot rustbot added the perf-regression Performance regression. label Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. PG-exploit-mitigations Project group: Exploit mitigations rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.