Skip to content

Rollup of 5 pull requests#157628

Merged
rust-bors[bot] merged 11 commits into
rust-lang:mainfrom
jhpratt:rollup-ABYHLsI
Jun 9, 2026
Merged

Rollup of 5 pull requests#157628
rust-bors[bot] merged 11 commits into
rust-lang:mainfrom
jhpratt:rollup-ABYHLsI

Conversation

@jhpratt

@jhpratt jhpratt commented Jun 8, 2026

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

chenyukang and others added 11 commits May 8, 2026 15:10
A `#[repr(packed)]` type can store an over-aligned field below its
alignment. Drop glue for such a type moves the field to a properly
aligned location before dropping it, which would move a structurally
pinned field out from under a `Pin<&mut _>` that was handed out,
breaking Pin's invariant.

Reject the combination at the type definition so the unsound program
never compiles.
Tie emission to `is_pin_project()` alone and pass the `#[pin_v2]`
span as `Option<Span>`, so the error still fires if the span cannot
be found, mirroring `PinV2WithoutPinDrop`.
Changed the doc comment of the
`flush_if_completed_line` function to use explicit
'if and only if' instead of it's shorthand 'iff'.
…-field-suggestion, r=fmease

Fix deref field pattern suggestions and improve error messages

Fixes rust-lang#146995
Adopt to LLVM 23 CfiFunctionIndex change

llvm/llvm-project#201635 removed symbols()
…, r=mejrs

Reject `#[repr(packed)]` on `#[pin_v2]` types

Fixes rust-lang#157011

`#[repr(packed)]` can store an over-aligned field below its alignment, and the drop glue for a packed type moves that field to a properly aligned spot before dropping it. When the field is structurally pinned, that move pulls it out from under a `Pin<&mut _>` we already handed out, which breaks the pin invariant. The repro in the issue makes it pretty clear: it prints one address during pinned access and a different one on drop.

So the fix just rejects the combo at the type definition. If a type is both `#[pin_v2]` and `#[repr(packed)]`, it no longer compiles. The check sits in `check_packed` in `rustc_hir_analysis`, so it catches the concrete case and the generic one too (like `One<T>`, where we don't know `T`'s alignment yet), with no layout or monomorphization needed.

One thing I want to be upfront about: this is necessary but don't solve the problem entirely. Sure, it stops the spelling the issue used, but you can still trigger the same move-on-drop through an explicit `&pin mut` / `ref pin mut` projection with no `#[pin_v2]` anywhere. Leaving that broader case open is intentional, imo the narrow ban is the right call for now, and the leftover stays tracked on the pin ergonomics tracking issue rust-lang#130494.

This is the direction we landed on with `@workingjubilee` over on Zulip, lgtm from their side: https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.60pin_v2.60.20is.20unsound.20with.20.60packed.60/with/600522893

Tests live in `tests/ui/pin-ergonomics/pin_v2-packed.rs`: the three rejected shapes (packed struct, generic `packed(4)` struct, packed union), plus two controls that still compile fine, `#[pin_v2]` without packed and packed without `#[pin_v2]`.

*Disclosure: AI tooling was used on the code changes, and everything was strictly validated by me before sending to remote.*
…std, r=jhpratt

Fixed Doc Comment Typo in Linewritershim

The doc comment of the `flush_if_completed_line`
function spelt 'if' as 'iff'.
…, r=JonathanBrouwer

Move AttributeTemplate from rustc_feature to rustc_attr_parsing

Refactor as discussed on zulip.

r? @JonathanBrouwer
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Jun 8, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 8, 2026
@jhpratt

jhpratt commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

@bors r+ rollup=never p=5

@rust-bors

rust-bors Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

📌 Commit ac38925 has been approved by jhpratt

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Jun 8, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 9, 2026
@rust-bors

rust-bors Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: jhpratt
Duration: 3h 11m 10s
Pushing d8c2e97 to main...

@rust-bors rust-bors Bot merged commit d8c2e97 into rust-lang:main Jun 9, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 9, 2026
@rust-timer

Copy link
Copy Markdown
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#154543 Fix deref field pattern suggestions and improve error messa… 769d4534e6688a25998c65afd5a01a98cff55ebc (link)
#157476 Adopt to LLVM 23 CfiFunctionIndex change c756a9d4e7954a24b45327446846a0f09f92ac63 (link)
#157542 Reject #[repr(packed)] on #[pin_v2] types 4a56cbbd117a9aef6b3b6e6d548b1ad41d9d2039 (link)
#157603 Fixed Doc Comment Typo in Linewritershim 2408a07d2ad30a591d87751983e1b7cc3657c203 (link)
#157624 Move AttributeTemplate from rustc_feature to rustc_attr_par… f8780d2a47dd39807ee35a0ce40aeffe89b30489 (link)

previous master: 83b3bfc40a

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

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor
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 83b3bfc (parent) -> d8c2e97 (this PR)

Test differences

Show 7 test diffs

Stage 1

  • [ui] tests/ui/borrowck/deref-field-pattern-ref-suggestion-issue-146995.rs: [missing] -> pass (J1)
  • [ui] tests/ui/borrowck/deref-index-pattern-ref-suggestion.rs: [missing] -> pass (J1)
  • [ui] tests/ui/pin-ergonomics/pin_v2-packed.rs: [missing] -> pass (J1)

Stage 2

  • [ui] tests/ui/borrowck/deref-field-pattern-ref-suggestion-issue-146995.rs: [missing] -> pass (J0)
  • [ui] tests/ui/borrowck/deref-index-pattern-ref-suggestion.rs: [missing] -> pass (J0)
  • [ui] tests/ui/pin-ergonomics/pin_v2-packed.rs: [missing] -> pass (J0)

Additionally, 1 doctest diff 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 d8c2e977191ed9f1c6dd0184df3e5b7e3596b860 --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. i686-gnu-2: 1h 3m -> 1h 41m (+60.4%)
  2. aarch64-apple: 3h 54m -> 2h 15m (-42.3%)
  3. x86_64-gnu-miri: 1h 14m -> 1h 41m (+37.5%)
  4. x86_64-msvc-1: 2h 2m -> 2h 38m (+28.9%)
  5. dist-aarch64-linux: 2h 31m -> 1h 51m (-26.6%)
  6. i686-gnu-nopt-1: 1h 50m -> 2h 19m (+25.8%)
  7. i686-msvc-2: 2h 16m -> 1h 42m (-25.0%)
  8. dist-aarch64-apple: 2h 15m -> 1h 42m (-24.0%)
  9. dist-x86_64-mingw: 2h 33m -> 2h (-21.3%)
  10. dist-i586-gnu-i586-i686-musl: 1h 16m -> 1h 31m (+19.2%)
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-bors rust-bors Bot mentioned this pull request Jun 9, 2026
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (d8c2e97): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

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
Regressions ❌
(secondary)
0.2% [0.2%, 0.3%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

Results (secondary -3.2%)

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

Binary size

Results (primary 0.0%, secondary 0.0%)

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

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

Bootstrap: 516.634s -> 520.354s (0.72%)
Artifact size: 400.78 MiB -> 401.29 MiB (0.13%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup 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.

8 participants