Skip to content

Tracking issue for pin ergonomics #130494

Open
1 of 1 issue completed
Open
Tracking Issue
1 of 1 issue completed
@traviscross

Description

@traviscross

This is a tracking issue for work on pin ergonomics.

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

Design sketch

The basic pin projection rules that we're working toward are:

  • If T: Unpin, &pin mut T and &mut T coerce to each other.
  • If T: Drop + !Unpin, require the Drop impl for T to use fn drop(&pin mut self).
  • Projection of &pin mut T to &pin mut T.U is allowed if either T: !Unpin or U: Unpin.

(The rules apply likewise for &pin const T.)

These rules are factored differently (using coercions (see here) and the fact that we haven't stabilized negative impls yet), but have the same effect as the rules in Niko's otherwise similar MinPin proposal.

Beyond pin projection, the basic overall idea of pin ergonomics is that &pin mut T (and &pin const T) should be integrated in the same sense as &mut T, in that reborrowing works, autoref works, corresponding binding modes exist, and that the borrow checker will track and ensure that once a &pin mut T is taken (even if no longer live) that we can't later get a &mut T or move T.

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

TODO.

Related

TODO.

cc @eholk @rust-lang/lang

Sub-issues

Metadata

Metadata

Labels

B-experimentalBlocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stabilize).C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-pin_ergonomics`#![feature(pin_ergonomics)]`T-langRelevant to the language team

Projects

Status

Exploration

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions