Skip to content

Tracking Issue for RFC 3467: UnsafePinned #125735

Description

@traviscross

This is a tracking issue for RFC 3467: UnsafePinned.

The feature gate for the issue is #![feature(unsafe_pinned)].

About tracking issues

Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Steps

Unresolved Questions

Related

Implementation history

TODO.

Activity

  1. added
    T-langRelevant to the language team
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    T-opsemRelevant to the opsem team
    B-experimentalBlocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stabilize).
    on May 29, 2024
  2. added
    B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.
    and removed
    B-experimentalBlocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stabilize).
    on Jun 18, 2024
  3. RalfJung commented on Aug 2, 2024

    @RalfJung
    Member

    Turns out the existing hack that attempts to make self-referential async lowering sound is incomplete, and we most likely need UnsafePinned to make it actually sound.

  4. RalfJung commented on Aug 20, 2024

    @RalfJung
    Member

    In the RFC we had the question whether UnsafePinned should also act like an UnsafeCell. I am now fairly sure that the answer is "yes, it must". The reason is this: due to Pin::deref being safe, it is at any moment possible to create a shared reference to a future that is halted at a suspension point. If there is no UnsafeCell, this acts like a read of the entire future data, and that read conflicts with mutable references that the future may hold to its own data. This is not a necessary property of aliasing with mutable reference, but it is a necessary consequence of the decision that Pin::deref should be safe.

    Cc @rust-lang/opsem

  5. added 4 commits that reference this issue on Sep 4, 2024
  6. 26 remaining items

  7. added a commit that references this issue on Aug 21, 2025
  8. added a commit that references this issue on Aug 26, 2025
  9. jdahlstrom commented on Oct 25, 2025

    @jdahlstrom

    Do we want to bikeshed the name further before stabilization?

    If get_mut_unchecked and get_mut_pinned are someday stabilized, yes, they should absolutely be renamed to get_unchecked_mut and get_pinned_mut for consistency.

  10. RalfJung commented on Jan 19, 2026

    @RalfJung
    Member

    Another case of UB caused by unintended uniqueness in futures: rust-lang/miri#4809.

    It's really high time that we fix the async lowering to use UnsafePinned to finally properly tackle this ancient I-unsound issue.

  11. added 2 commits that reference this issue on Feb 14, 2026
  12. added a commit that references this issue on Feb 15, 2026
  13. added a commit that references this issue on Mar 8, 2026
  14. added a commit that references this issue on Mar 9, 2026
  15. jacobsa commented on May 4, 2026

    @jacobsa

    Hi, question about what seems to be an omission in the documentation: should UnsafePinned make the same layout guarantees as UnsafeCell? I assume that's more or less intended, but it would be good to be explicit (and in any case I'd still be happy with an answer here).

    For the record: the reason I care is that I'm pretty sure I need this guarantee in order to be able to do in-place initialization of the T within an UnsafePinned<T>, using e.g. Crubit's ctor crate, at least in order for it to approach being ergonomic.

  16. RalfJung commented on May 4, 2026

    @RalfJung
    Member

    Yeah it would make sense to give it the same layout guarantees.

  17. nbdd0121 commented on Jul 21, 2026

    @nbdd0121
    Member

    The change that make UnsafePinned also wrap UnsafeCell changes the variance of UnsafePinned. In 1.87/1.88 UnsafePinned is covariant, while 1.89+ it becomes invariant. This makes it much more limiting than PhantomPinned as that doesn't change the variance.

    For code that just needs pinning for self-reference and not for mutation, this is very limiting.

  18. RalfJung commented on Jul 21, 2026

    @RalfJung
    Member

    Oh yeah I didn't think about variance at all.

    It would seem a bit odd if UnsafePinned becomes the way to have covariant interior mutability...

  19. nbdd0121 commented on Jul 21, 2026

    @nbdd0121
    Member

    Well, I suppose if we have CovariantUnsafeCell then UnsafePinned should move to use that instead.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-unsafe_pinned`#![feature(unsafe_pinned)]`T-langRelevant to the language teamT-opsemRelevant to the opsem team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions