Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how Pin != StableDeref #9

Open
CAD97 opened this issue Aug 13, 2019 · 3 comments
Open

Document how Pin != StableDeref #9

CAD97 opened this issue Aug 13, 2019 · 3 comments

Comments

@CAD97
Copy link

CAD97 commented Aug 13, 2019

Discussion on urlo.

TL;DR: Pin<P> fails two guarantees of StableDeref, even when Target: !Unpin: it does not guarantee that <P as Deref>::deref and <P as DerefMut>::deref_mut go to the same place, and it does not even guarantee that two invocations of <P as Deref>::deref go to the same place.

@Manishearth
Copy link

Could we just impl StableDeref for Pin<P> where P: StableDeref?

@Manishearth
Copy link

cc @Storyyeller

@Ten0
Copy link

Ten0 commented Aug 4, 2020

I'm not sure how failing to satisfy these would break safety in crates like rental or owning_ref though. Any clue?
EDIT: Oh nevermind I found: if Deref points to somewhere that moves when the struct moves (e.g. &self.some_field), it breaks. Pin seems to not guarantee that is not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants