Skip to content

Provide structural pinning guarantees for slices, vecs, arrays #104108

Open
@yoshuawuyts

Description

@yoshuawuyts

Link to Zulip Discussion.

Right now Vec provides no guarantees wrt structural pinning, meaning if we have a Vec of futures and we pin project through it, it works fine today - but we're not guaranteed it will continue to work fine tomorrow. For example, futures::join_all! notes internally that:

Safety: std could make this unsound if it were to decide Pin's invariants aren't required to transmit through slices. Otherwise this has the same safety as a normal field pin projection.

Those are pretty shaky grounds to build on, and it'd be better if we could actually guarantee that this will continue to work fine in the future. Especially as the Async WG is looking to fold facilities akin to join_all! into the stdlib. I'm not sure what exactly we'd need to document in order to make these guarantees, hence this issue.


Tagging in: @rust-lang/wg-async, @rust-lang/wg-unsafe-code-guidelines, and also @RalfJung specifically since they've been working on the intersection of soundness and pinning recently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-arrayArea: `[T; N]`A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions