added
T-libs
labels
Jun 18, 2026Closed
Previously, the soundness argument for the `pin!()` macro relied on very complicated conditions on what coercions are possible. As a result, it was not obvious whether the macro was sound or not, and the macro was potentially fragile to changes in how coercions work. Therefore, we change the `pin!()` macro so that it relies on less subtle properties of coercions. In particular: * The soundness argument now only relies on enumerating the possible types that a coercion could produce, as opposed to relying on details about how coercion expectations are propagated. * The soundness argument now only requires reasoning about possible coercions between a single pair of types defined in the standard library, as opposed to reasoning about two pairs of types, with some involved types being defined by the user. Fixes <rust-lang#153438>
rust-bors
Bot
added
S-waiting-on-bors
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Jul 20, 2026Merged
rust-bors Bot pushed a commit that referenced this pull request
Jul 20, 2026…uwer Rollup of 18 pull requests Successful merges: - #159600 (`rust-analyzer` subtree update) - #158046 (proc_macro: preserve file module spans for inner attrs) - #159000 (Small cleanups to the incr comp session code) - #159189 (Account for type alias projections in E0308 "expected/found" shortening logic) - #159449 (Enable single Location to issue multiple borrows) - #159544 (Suggest valid command-line crate names) - #159587 (Improve `AttrItem::span`) - #159594 (feat(rustc_hir_typeck): suggest `impl Fn` return for capturing closures) - #159597 (std: use `arc4random_buf` from libc) - #159599 (Resolver: Record at least 1 ambiguous trait if main decl is not a trait.) - #158061 (Make `pin!()` more foolproof.) - #159460 (Do not mark unnormalized const aliases as rigid when normalizing param env) - #159529 (Add regression test for nested replacement ranges in `collect_tokens`) - #159571 (Remove unused bundled library lookup for the local crate) - #159585 (Minor `TokenStream` improvements) - #159586 (Separate `InterpCx` usage by `ConstAnalysis` phases) - #159602 (Remove `ItemLike`) - #159603 (Clarify `push_stream`/`push_tree`) Failed merges: - #159590 (Remove some dead code)
rust-timer added a commit that referenced this pull request
Jul 20, 2026Rollup merge of #158061 - theemathas:pin-foolproof, r=lcnr Make `pin!()` more foolproof. Previously, the soundness argument for the `pin!()` macro relied on very complicated conditions on what coercions are possible. As a result, it was not obvious whether the macro was sound or not, and the macro was potentially fragile to changes in how coercions work. Therefore, we change the `pin!()` macro so that it relies on less subtle properties of coercions. In particular: * The soundness argument now only relies on enumerating the possible types that a coercion could produce, as opposed to relying on details about how coercion expectations are propagated. * The soundness argument now only requires reasoning about possible coercions between a single pair of types defined in the standard library, as opposed to reasoning about two pairs of types, with some involved types being defined by the user. Fixes <#153438>. This PR supersedes the proposed FCP on that issue. cc @dianne r? types
Open