summaryrefslogtreecommitdiff
path: root/rust/pin-init/examples/selfref.rs
AgeCommit message (Collapse)Author
4 daysrust: pin-init: internal: pin_data: complete invariant borrow supportGary Guo
Non-covariant types can already be accessed inside projections. As projections are only generated for `Pin<&mut T>`, they're not accessible otherwise. Add `with_{field_name}` methods so fields can be accessed using closures with just `&T`. Acked-by: Benno Lossin <lossin@kernel.org> Link: https://patch.msgid.link/20261008-dev-selfref-v2-17-e280b3c8fba5@garyguo.net/ Signed-off-by: Gary Guo <gary@garyguo.net>
4 daysrust: pin-init: internal: pin_data: support mutable borrowsGary Guo
Allow fields to be mutably referenced by other fields in addition to shared references. In order for this to be sound, the fields that can be mutably borrowed are blocked from being accessed via field access syntax or projection to maintain the aliasing requirements. Acked-by: Benno Lossin <lossin@kernel.org> Link: https://patch.msgid.link/20261008-dev-selfref-v2-14-e280b3c8fba5@garyguo.net/ Signed-off-by: Gary Guo <gary@garyguo.net>
4 daysrust: pin-init: internal: pin_data: enable self-referential supportGary Guo
Enable self-referential support, and add example and test cases. Acked-by: Benno Lossin <lossin@kernel.org> Link: https://patch.msgid.link/20261008-dev-selfref-v2-11-e280b3c8fba5@garyguo.net/ Signed-off-by: Gary Guo <gary@garyguo.net>