Skip to content

Rollup of 7 pull requests #140053

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 16 commits into from
Apr 20, 2025
Merged

Rollup of 7 pull requests #140053

merged 16 commits into from
Apr 20, 2025

Conversation

ChrisDenton
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

compiler-errors and others added 16 commits April 8, 2025 21:05
.gitattributes lists *.fixed, *.pp, and *.mir as file extensions which
should be treated as Rust source code. Do the same for VS Code and Zed.
This only does syntax highlighting, which is appropriate, as MIR isn't
really Rust code.

At the same time, consistently order `rust-analyzer.linkedProjects`
between editors. For some reason, Eglot didn't include
library/Cargo.toml.
…itchint, r=saethlin

Do not remove trivial `SwitchInt` in analysis MIR

This PR ensures that we don't prematurely remove trivial `SwitchInt` terminators which affects both the borrow-checking and runtime semantics (i.e. UB) of the code. Previously the `SimplifyCfg` optimization was removing `SwitchInt` terminators when they was "trivial", i.e. when all arms branched to the same basic block, even if that `SwitchInt` terminator had the side-effect of reading an operand which (for example) may not be initialized or may point to an invalid place in memory.

This behavior is unlike all other optimizations, which are only applied after "analysis" (i.e. borrow-checking) is finished, and which Miri disables to make sure the compiler doesn't silently remove UB.

Fixing this code "breaks" (i.e. unmasks) code that used to borrow-check but no longer does, like:

```rust
fn foo() {
    let x;
    let (0 | _) = x;
}
```

This match expression should perform a read because `_` does not shadow the `0` literal pattern, and the compiler should have to read the match scrutinee to compare it to 0. I've checked that this behavior does not actually manifest in practice via a crater run which came back clean: rust-lang#139042 (comment)

As a side-note, it may be tempting to suggest that this is actually a good thing or that we should preserve this behavior. If we wanted to make this work (i.e. trivially optimize out reads from matches that are redundant like `0 | _`), then we should be enabling this behavior *after* fixing this. However, I think it's kinda unprincipled, and for example other variations of the code don't even work today, e.g.:

```rust
fn foo() {
    let x;
    let (0.. | _) = x;
}
```
add next_index to Enumerate

Proposal: rust-lang/libs-team#435
Tracking Issue: rust-lang#130711

This basically just reopens rust-lang#130682 but squashed and with the new function and the feature gate renamed to `next_index.`

There are two questions I have already:
- Shouldn't we add test coverage for that? I'm happy to provide some, but I might need a pointer to where these test would be.
  - Maybe I could actually also add a doctest?
- For now, I just renamed the feature name in the unstable attribute to `next_index`, as well, so it matches the new name of the function. Is that okay? And can I just do that and use any string, or is there a sealed list of features defined somewhere where I also need to change the name?
…ns, r=Mark-Simulacrum

Setup editor file associations for non-rs extensions

.gitattributes lists `*.fixed`, `*.pp`, and `*.mir` as file extensions which should be treated as Rust source code. Do the same for VS Code and Zed. This only does syntax highlighting, which is appropriate, as MIR isn't really Rust code.

At the same time, consistently order `rust-analyzer.linkedProjects` between editors. For some reason, Eglot didn't include `library/Cargo.toml`.

I have tested this with VS Code and Zed. I have not implemented it for Emacs/Eglot or Helix.
…onur-ozkan

skip llvm-config in autodiff check builds, when its unavailable

As you suggested, this indeed fixes `./x.py check` builds when autodiff is enabled.

r? ```@onur-ozkan```

closes rust-lang#139936

Tracking:

- rust-lang#124509
…_renamed_item, r=nnethercote

Improve `clean_maybe_renamed_item` function code a bit

Follow-up of rust-lang#139846.

This is what I tried to say in there: the `name` variable can be unwrapped in most cases so better do it directly once and for all if possible and move the cases where it's not possible above.

r? `@nnethercote`
…ler-errors

Remove early exits from JumpThreading.

This removes early exits from rust-lang#131203 as I asked during review.

The correctness of the backtracking is `mutated_statement` clearing all relevant conditions. If `process_statement` fails to insert a new condition, for instance by const-eval failure, `mutated_statement`  still removes the obsolete conditions from the state.

r? `@compiler-errors`
…kport-poll, r=aDotInTheVoid

Add option for stable backport poll

When creating polls on Zulip about stable backport ("Do we approve the backport of `rust-lang#12345`"?), stable backports should have the option of "approving, but only is a dot release is planned" (this is a hint to t-release about how the team think important - or not - is backporting some patch).

Discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/stable-nominated.3A.20.23139328/near/510037866)[#t-rustdoc > stable-nominated: rust-lang#139328 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/stable-nominated.3A.20.23139328/near/510037866)

r? `@aDotInTheVoid`  (feel free to adjust the wording!)
@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Apr 19, 2025
@ChrisDenton
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Apr 19, 2025

📌 Commit 4c36aed has been approved by ChrisDenton

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 Apr 19, 2025
@bors
Copy link
Collaborator

bors commented Apr 19, 2025

⌛ Testing commit 4c36aed with merge 90fd16e...

@bors
Copy link
Collaborator

bors commented Apr 20, 2025

☀️ Test successful - checks-actions
Approved by: ChrisDenton
Pushing 90fd16e to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 20, 2025
@bors bors merged commit 90fd16e into rust-lang:master Apr 20, 2025
1 check passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 20, 2025
@ChrisDenton ChrisDenton deleted the rollup-tt00skl branch April 20, 2025 00:09
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#139042 Do not remove trivial SwitchInt in analysis MIR f079f2e924726bb2b6f0197092ba0e64545a3cb3 (link)
#139533 add next_index to Enumerate f81e51ce7af2e626aa9cef89b63eff5b7d829aae (link)
#139843 Setup editor file associations for non-rs extensions 0785ab919694789d4fd990cd4af26a0759d7eaac (link)
#140000 skip llvm-config in autodiff check builds, when its unavail… 0e1616db84c162c5636fcacfba57dd27715e68f0 (link)
#140008 Improve clean_maybe_renamed_item function code a bit 7c8e7e9e9060a4735556b9c88a203dd742217db3 (link)
#140024 Remove early exits from JumpThreading. a241312d8bcfe9d878c5bbb40679a8dff78fa595 (link)
#140039 Add option for stable backport poll 6018b790d8ff0cb8a2de39030608f4b1048939a9 (link)

previous master: 077cedc2af

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

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 077cedc (parent) -> 90fd16e (this PR)

Test differences

Show 12 test diffs

Stage 0

  • iter::adapters::enumerate::test_empty_iterator_enumerate_next_index: [missing] -> pass (J2)

Stage 1

  • [mir-opt] tests/mir-opt/read_from_trivial_switch.rs: [missing] -> pass (J1)
  • [ui] tests/ui/pattern/uninit-trivial.rs: [missing] -> pass (J1)
  • iter::adapters::enumerate::test_empty_iterator_enumerate_next_index: [missing] -> pass (J3)

Stage 2

  • [ui] tests/ui/pattern/uninit-trivial.rs: [missing] -> pass (J0)
  • [mir-opt] tests/mir-opt/read_from_trivial_switch.rs: [missing] -> pass (J4)

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

Job group index

Job duration changes

  1. dist-aarch64-linux: 5425.3s -> 7576.1s (39.6%)
  2. dist-apple-various: 6352.1s -> 8577.9s (35.0%)
  3. dist-aarch64-apple: 4530.4s -> 5146.5s (13.6%)
  4. x86_64-msvc-1: 8977.6s -> 8470.2s (-5.7%)
  5. dist-x86_64-apple: 9172.6s -> 9604.8s (4.7%)
  6. x86_64-msvc-ext2: 5969.9s -> 5690.3s (-4.7%)
  7. aarch64-apple: 3770.1s -> 3598.2s (-4.6%)
  8. dist-s390x-linux: 5358.5s -> 5151.1s (-3.9%)
  9. x86_64-msvc-2: 6662.3s -> 6907.8s (3.7%)
  10. dist-loongarch64-linux: 6434.6s -> 6223.0s (-3.3%)
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-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
##[endgroup]
Secret source: Actions
Prepare workflow directory
Prepare all required actions
Complete job name: skip if S-waiting-on-bors
##[group]Run # Fetch state and labels of PR
# Fetch state and labels of PR
# Or exit successfully if PR does not exist
JSON=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json labels,state || exit 0)
STATE=$(echo "$JSON" | jq -r '.state')
WAITING_ON_BORS=$(echo "$JSON" | jq '.labels[] | any(.name == "S-waiting-on-bors"; .)')

# Exit with error if open and S-waiting-on-bors
if [[ "$STATE" == "OPEN" && "$WAITING_ON_BORS" == "true" ]]; then
  exit 1
fi
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (90fd16e): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

Results (primary 1.3%, secondary 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)
1.4% [0.5%, 3.9%] 15
Regressions ❌
(secondary)
2.2% [2.2%, 2.2%] 1
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 1
Improvements ✅
(secondary)
-1.1% [-1.1%, -1.1%] 1
All ❌✅ (primary) 1.3% [-0.4%, 3.9%] 16

Cycles

Results (primary -0.5%, secondary 2.3%)

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
Regressions ❌
(secondary)
2.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
-0.5% [-0.7%, -0.4%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-0.7%, -0.4%] 4

Binary size

Results (primary 0.0%)

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.0% [0.0%, 0.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [0.0%, 0.0%] 1

Bootstrap: 771.827s -> 770.888s (-0.12%)
Artifact size: 365.08 MiB -> 365.04 MiB (-0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues & PRs about the rust-lang/rust repository itself 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-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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.