Rollup of 5 pull requests#157628
Conversation
llvm/llvm-project#201635 removed symbols()
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
|
@bors r+ rollup=never p=5 |
This comment has been minimized.
This comment has been minimized.
|
📌 Perf builds for each rolled up PR:
previous master: 83b3bfc40a In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
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 differencesShow 7 test diffsStage 1
Stage 2
Additionally, 1 doctest diff were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard d8c2e977191ed9f1c6dd0184df3e5b7e3596b860 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (d8c2e97): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)This perf run didn't have relevant results for this metric. CyclesResults (secondary -3.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.0%, secondary 0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 516.634s -> 520.354s (0.72%) |
Successful merges:
#[repr(packed)]on#[pin_v2]types #157542 (Reject#[repr(packed)]on#[pin_v2]types)r? @ghost
Create a similar rollup