Skip to content

Rollup of 4 pull requests #140702

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 15 commits into from
May 6, 2025
Merged

Rollup of 4 pull requests #140702

merged 15 commits into from
May 6, 2025

Conversation

GuillaumeGomez
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

GuillaumeGomez and others added 15 commits April 23, 2025 20:51
The new logic for determining whether to peel references will depend on
whether smart pointers need to be peeled before matching.
And also:

- Document test intent.
- Move under `link-native-libs/` instead.
…ustdoc

Unify sidebar buttons to use the same image

Part of rust-lang#139832.

The source sidebar looks like this with the new image:

![image](https://github.com/user-attachments/assets/df4fee52-fb71-4794-91b7-3afc6d2aab70)

You can test it [here](https://rustdoc.crud.net/imperio/sidebar-images/src/foo/foo.rs.html).

r? `@notriddle`
`deref_patterns`: let string and byte string literal patterns peel references and smart pointers before matching

This follows up on rust-lang#140028. Together, they allow using string and byte string literal patterns to match on smart pointers when `deref_patterns` is enabled. In particular, string literals can now match on `String`, subsuming the functionality of the `string_deref_patterns` feature.

More generally, this works by letting literals peel references (and smart pointers) before matching, similar to most other patterns, providing an answer to rust-lang#44849. Though it's only partially implemented at this point: this doesn't yet let named const patterns peel before matching. The peeling logic is general enough to support named consts, but the typing rules for named const patterns would need adjustments to feel consistent (e.g. arrays would need rules to be usable as slices, and `const STR: &'static str` wouldn't be able to match on a `String` unless a rule was added to let it be used where a `str` is expected, similar to what rust-lang#140028 did for literals).

This also allows string and byte string patterns to match on mutable references, following up on rust-lang#140028 (comment). Rather than forward the mutability of the scrutinee to literal patterns, I've opted to peel `&mut`s from the scrutinee. From a design point of view, this makes the behavior consistent with what would be expected from deref coercions using the methodology in the next paragraph. From a diagnostics point of view, this avoids labeling string and byte string patterns as "mutable references", which I think could be confusing. See [`byte-string-type-errors.rs`](https://github.com/rust-lang/rust/compare/master...dianne:rust:lit-deref-pats-p2?expand=1#diff-4a0dd9b164b67c706751f3c0b5762ddab08bcef05a91972beb0190c6c1cd3706) for how the diagnostics look.

At a high level, the peeling logic implemented here tries to mimic how deref coercions work for expressions: we peel references (and smart pointers) from the scrutinee until the pattern can match against it, and no more. This is primarily tested by [`const-pats-do-not-mislead-inference.rs`](https://github.com/rust-lang/rust/compare/master...dianne:rust:lit-deref-pats-p2?expand=1#diff-19afc05b8aae9a30fe4a3a8c0bc2ab2c56b58755a45cdf5c12be0d5e83c4739d). To illustrate the connection, I wasn't sure if this made sense to include in the test file, but I've translated those tests to make sure they give the same inference results as deref coercions: [(playground)](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=1869744cb9cdfed71a686990aadf9fe1). In each case, a reference to the scrutinee is coerced to have the type of the pattern (under a reference).

Tracking issue for deref patterns: rust-lang#87121

r? `@oli-obk`
cc `@Nadrieril`
Don't ignore compiler stderr in `lib-defaults.rs`

Closes rust-lang#54222.

- Don't ignore compiler stderr.
- Document test intent.
- Move under `tests/ui/link-native-libs/` instead.

This was previously discussed on https://web.archive.org/web/20181028094402/https://botbot.me/mozilla/rust-tools/2017-02-21/?page=1.

try-job: armhf-gnu
try-job: test-various
try-job: x86_64-msvc-1
try-job: i686-msvc-1
try-job: x86_64-mingw-1
try-job: aarch64-apple
try-job: x86_64-apple-1
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. rollup A PR which is a rollup labels May 6, 2025
@GuillaumeGomez
Copy link
Member Author

@bors r+ p=4 rollup=never

@bors
Copy link
Collaborator

bors commented May 6, 2025

📌 Commit 9d05497 has been approved by GuillaumeGomez

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 May 6, 2025
@bors
Copy link
Collaborator

bors commented May 6, 2025

⌛ Testing commit 9d05497 with merge 1a95cc6...

@bors
Copy link
Collaborator

bors commented May 6, 2025

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez
Pushing 1a95cc6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 6, 2025
@bors bors merged commit 1a95cc6 into rust-lang:master May 6, 2025
7 checks passed
@rustbot rustbot added this to the 1.88.0 milestone May 6, 2025
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#140135 Unify sidebar buttons to use the same image 32af0b804cd6cd5050d18f1940cd31299a8f668c (link)
#140632 add a test for issue #81317 451cc1b8009fe2102ff480af60cb72376786fe8d (link)
#140658 deref_patterns: let string and byte string literal patter… 396b2aa4d71355257888dc4de2474acc9bdff7e5 (link)
#140681 Don't ignore compiler stderr in lib-defaults.rs cf8513325f0303ce25d8875a52694f2f8ea3f309 (link)

previous master: f5d3fe273b

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

Copy link

github-actions bot commented May 6, 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 f5d3fe2 (parent) -> 1a95cc6 (this PR)

Test differences

Show 14 test diffs

Stage 1

  • [ui] tests/ui/abi/lib-defaults.rs: pass -> [missing] (J1)
  • [ui] tests/ui/link-native-libs/lib-defaults.rs: [missing] -> pass (J1)
  • [ui] tests/ui/pattern/deref-patterns/const-pats-do-not-mislead-inference.rs#deref_patterns: [missing] -> pass (J1)
  • [ui] tests/ui/pattern/deref-patterns/const-pats-do-not-mislead-inference.rs#stable: [missing] -> pass (J1)
  • [ui] tests/ui/type-inference/regression-issue-81317.rs: [missing] -> pass (J1)

Stage 2

  • [ui] tests/ui/abi/lib-defaults.rs: pass -> [missing] (J0)
  • [ui] tests/ui/link-native-libs/lib-defaults.rs: [missing] -> pass (J0)
  • [ui] tests/ui/pattern/deref-patterns/const-pats-do-not-mislead-inference.rs#deref_patterns: [missing] -> pass (J0)
  • [ui] tests/ui/pattern/deref-patterns/const-pats-do-not-mislead-inference.rs#stable: [missing] -> pass (J0)
  • [ui] tests/ui/type-inference/regression-issue-81317.rs: [missing] -> pass (J0)

Additionally, 4 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 1a95cc6f9d950992ba27746e45caf40118581cb1 --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. x86_64-apple-2: 4994.3s -> 7022.4s (40.6%)
  2. aarch64-apple: 3643.9s -> 4862.6s (33.4%)
  3. dist-apple-various: 6786.8s -> 7609.4s (12.1%)
  4. dist-x86_64-freebsd: 5478.5s -> 4822.9s (-12.0%)
  5. dist-i686-msvc: 7144.9s -> 7888.6s (10.4%)
  6. x86_64-apple-1: 9156.9s -> 8532.7s (-6.8%)
  7. dist-android: 2558.0s -> 2723.9s (6.5%)
  8. dist-aarch64-apple: 5665.6s -> 5964.7s (5.3%)
  9. dist-x86_64-apple: 8887.1s -> 9352.0s (5.2%)
  10. x86_64-msvc-2: 6917.2s -> 7253.8s (4.9%)
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

Finished benchmarking commit (1a95cc6): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.0% [-1.0%, -1.0%] 1
Improvements ✅
(secondary)
-0.5% [-0.5%, -0.5%] 1
All ❌✅ (primary) -1.0% [-1.0%, -1.0%] 1

Max RSS (memory usage)

Results (primary -0.4%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.9% [0.6%, 1.5%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.9% [-2.3%, -0.4%] 12
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.4% [-2.3%, 1.5%] 16

Cycles

Results (primary 0.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.6% [0.4%, 1.0%] 16
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [-0.4%, 1.0%] 18

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 770.498s -> 769.964s (-0.07%)
Artifact size: 365.48 MiB -> 365.50 MiB (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. 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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants