Skip to content

Commit

Permalink
Update docs to reflect new drop impl handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 committed Aug 23, 2019
1 parent a9e21d5 commit deea6e8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pin-project-internal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,19 @@ use syn::parse::Nothing;
///
/// 2. The destructor of the struct must not move structural fields out of its argument.
///
/// To enforce this, this attribute will automatically generate a `Drop` impl.
/// To enforce this, this attribute will generate code like this:
///
/// ```rust
/// struct MyStruct {}
/// trait MyStructMustNotImplDrop {}
/// impl<T: Drop> MyStructMustNotImplDrop for T {}
/// impl MyStructMustNotImplDrop for MyStruct {}
/// ```
///
/// If you attempt to provide an Drop impl, the blanket impl will
/// then apply to your type, causing a compile-time error due to
/// the conflict with the second impl.
///
/// If you wish to provide a custom `Drop` impl, you can annotate a function
/// with `#[pinned_drop]`. This function takes a pinned version of your struct -
/// that is, `Pin<&mut MyStruct>` where `MyStruct` is the type of your struct.
Expand Down

0 comments on commit deea6e8

Please sign in to comment.