Skip to content

Commit

Permalink
Merge #64
Browse files Browse the repository at this point in the history
64: Pinned drop bounds bug r=taiki-e a=Michael-J-Ward

The bug brought up in [this conversation](tower-rs/tower#594 (comment))

Simple fix, the parsing grammar wasn't handling trailing commas.

Co-authored-by: Michael J Ward <ward.michael.j@gmail.com>
  • Loading branch information
bors[bot] and Michael-J-Ward committed Jul 30, 2021
2 parents 47972f6 + 8757efb commit ff1efb2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ macro_rules! __pin_project_internal {
$(: $where_clause_bound:path)?
$(: ?$where_clause_unsized_bound:path)?
$(: $where_clause_lifetime_bound:lifetime)?
),*
),* $(,)?
)?
{
fn drop($($arg:ident)+: Pin<&mut Self>) {
Expand Down
27 changes: 27 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,4 +665,31 @@ fn pinned_drop() {
}
}
}

trait Service<Request> {
type Error;
}

pin_project! {
struct Struct3<'a, T, Request>
where
T: Service<Request>,
T::Error: std::error::Error,
{
was_dropped: &'a mut bool,
#[pin]
field: T,
req: Request,
}

impl<T, Request> PinnedDrop for Struct3<'_, T, Request>
where
T: Service<Request>,
T::Error: std::error::Error,
{
fn drop(mut this: Pin<&mut Self>) {
**this.as_mut().project().was_dropped = true;
}
}
}
}

0 comments on commit ff1efb2

Please sign in to comment.