You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pin-init: enhance safety documentation for macro-generated code
Add comprehensive safety documentation to pin-init macros, particularly
for the #[pin_data] macro which generates unsafe accessor functions.
The enhanced documentation clarifies:
- Safety requirements for slot pointer validity and alignment
- Pinning invariants that must be upheld by implementers
- Memory safety contracts for macro-generated unsafe functions
- Proper usage patterns for the pin-init API
This addresses gaps in the safety documentation that made it difficult
for users to understand the safety contracts when implementing custom
initializers or working with the generated code.
Also updates test expectations to match the new macro-generated documentation.
Signed-off-by: Liam Davis <[email protected]>
Copy file name to clipboardExpand all lines: tests/ui/compile-fail/init/invalid_init.stderr
+1-3Lines changed: 1 addition & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,5 @@ error[E0277]: the trait bound `impl pin_init::PinInit<Bar>: Init<Bar>` is not sa
10
10
| |______the trait `Init<Bar>` is not implemented for `impl pin_init::PinInit<Bar>`
11
11
| required by a bound introduced by this call
12
12
|
13
-
= help: the following other types implement trait `Init<T, E>`:
14
-
ChainInit<I, F, T, E>
15
-
Result<T, E>
13
+
= help: the trait `Init<T, E>` is implemented for `ChainInit<I, F, T, E>`
16
14
= note: this error originates in the macro `$crate::__init_internal` which comes from the expansion of the macro `init` (in Nightly builds, run with -Z macro-backtrace for more info)
0 commit comments