Skip to content

Rollup of 5 pull requests #119722

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

Merged
merged 45 commits into from
Jan 8, 2024
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8af1a6a
Make ImplTraitPosition display more descriptive
compiler-errors Jan 7, 2024
0f39574
Inline some helpers no longer needed due to RPITIT being stable
compiler-errors Jan 7, 2024
bfd63b2
Rewrite `Pin<P>` docs to clarify guarantees and uses
mcy Aug 30, 2021
8241ca6
mostly done
fu5ha Sep 25, 2023
ba3b934
Fix examples, finish polishing
fu5ha Sep 25, 2023
584f098
fix broken links
fu5ha Sep 25, 2023
ec8a01a
fix one more broken link
fu5ha Sep 25, 2023
46f9d77
update doubly linked list commentary and fix links
fu5ha Sep 25, 2023
db5b19e
improve intro and `Unpin`-related discussion
fu5ha Sep 26, 2023
6818d92
improve intro and discussion of pinning as library contract
fu5ha Sep 26, 2023
bebbe24
improve `Pin` struct docs and add examples
fu5ha Sep 26, 2023
82a6817
fix link in footnote
fu5ha Sep 27, 2023
e2e8746
reword unpin auto impl section
fu5ha Sep 27, 2023
7c9c712
improve structural Unpin + formatting
fu5ha Sep 27, 2023
252a83b
add section on manual owning ptr managed solution via @kpreid
fu5ha Sep 28, 2023
f2447a6
fix typos
fu5ha Sep 28, 2023
921d37d
fix imports
fu5ha Sep 28, 2023
6d5f43d
edit new section for typos and better wording
fu5ha Sep 28, 2023
de2e748
fix typos and edit prose
fu5ha Sep 28, 2023
6e88279
`Pin<P>` -> `Pin<Ptr>`
fu5ha Oct 3, 2023
469c78b
improve `Pin` and `Pin::new` docs
fu5ha Oct 3, 2023
e0210e6
justify motivation of `Unpin` better
fu5ha Oct 3, 2023
f0827b3
fix broken link
fu5ha Oct 3, 2023
d7a886a
update ui tests
fu5ha Oct 3, 2023
9997114
improve `Pin::new_unchecked` docs
fu5ha Oct 3, 2023
058fb50
trim section on managed-box model
fu5ha Oct 3, 2023
0050676
Rephrase unpin docs in terms of pinning-agnosticness
Manishearth Jan 7, 2024
936ceb2
lifetime -> lifespan where relevant. improve docs on as_ref()
Manishearth Jan 7, 2024
4c25246
Clean up guarantees wording
Manishearth Jan 7, 2024
68bdedd
Apply suggestions from code review
Manishearth Jan 7, 2024
6553d0d
punctuation in parens
Manishearth Jan 7, 2024
6a54ed7
valid
Manishearth Jan 7, 2024
a573c7c
footnote on dropping futures
Manishearth Jan 7, 2024
b1830f1
clean up structural pinning
Manishearth Jan 7, 2024
df6d449
Update library/core/src/pin.rs
Manishearth Jan 7, 2024
7fd841c
link
Manishearth Jan 7, 2024
3acc5a0
effects: support ~const in assoc fns in trait impls
fmease Jan 7, 2024
7e38b70
Split note, fix const/static impl trait error
compiler-errors Jan 7, 2024
68bb766
Unions are not PointerLike
compiler-errors Jan 7, 2024
5be2a85
Delete unused makefile in tests/ui
Noratrieb Jan 7, 2024
a9b6908
Rollup merge of #116129 - fu5ha:better-pin-docs-2, r=Amanieu
matthiaskrgr Jan 7, 2024
0207e24
Rollup merge of #119703 - compiler-errors:impl-trait-tweaks, r=fmease
matthiaskrgr Jan 7, 2024
39b3ef1
Rollup merge of #119705 - fmease:tilde-const-assoc-fns-trait-impls, r…
matthiaskrgr Jan 7, 2024
2676860
Rollup merge of #119708 - compiler-errors:pointer-like, r=Nilstrieb
matthiaskrgr Jan 7, 2024
bf20ade
Rollup merge of #119711 - Nilstrieb:makewtf, r=WaffleLapkin
matthiaskrgr Jan 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clean up structural pinning
  • Loading branch information
Manishearth committed Jan 7, 2024
commit b1830f130a0ccd06cd43ac5f2c09ed669e5b1d3b
18 changes: 10 additions & 8 deletions library/core/src/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,17 +728,19 @@
//! "propagates" to this field or not. Pinning that propagates is also called "structural",
//! because it follows the structure of the type.
//!
//! The choice of whether to pin depends on how the type is being used. If [`unsafe`] code
//! that consumes <code>[Pin]\<[&mut Struct][&mut]></code> also needs to take note of
//! the address of the field itself, it may be evidence that that field is structurally
//! pinned. Unfortunately, there are no hard-and-fast rules.
//! This choice depends on what guarantees you need from the field for your [`unsafe`] code to work.
//! If the field is itself address-sensitive, or participates in the parent struct's address
//! sensitivity, it will need to be structurally pinned.
//!
//! A useful test is if [`unsafe`] code that consumes <code>[Pin]\<[&mut Struct][&mut]></code>
//! also needs to take note of the address of the field itself, it may be evidence that that field
//! is structurally pinned. Unfortunately, there are no hard-and-fast rules.
//!
//! ### Choosing pinning *not to be* structural for `field`...
//!
//! While counter-intuitive, it's actually the easier choice: if you do not expose a
//! <code>[Pin]<[&mut] Field></code>, then no code must be written assuming that the field is
//! pinned and so nothing can go wrong. So, if you decide that some field does not
//! have structural pinning, all you have to ensure is that you never create pinning
//! While counter-intuitive, it's often the easier choice: if you do not expose a
//! <code>[Pin]<[&mut] Field></code>, you do not need to be careful about other code
//! moving out of that field, you just have to ensure is that you never create pinning
//! reference to that field. This does of course also mean that if you decide a field does not
//! have structural pinning, you must not write [`unsafe`] code that assumes (invalidly) that the
//! field *is* structurally pinned!
Expand Down