Skip to content

Commit

Permalink
Merge #176
Browse files Browse the repository at this point in the history
176: Fix support for lifetime bounds r=taiki-e a=taiki-e



Co-authored-by: Taiki Endo <[email protected]>
  • Loading branch information
bors[bot] and taiki-e committed Jan 20, 2020
2 parents 8a5ed63 + aeb68c1 commit 8c1b6bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pin-project-internal/src/pin_project/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,10 @@ impl Context {
.generics
.lifetimes()
.enumerate()
.map(|(i, l)| {
.map(|(i, LifetimeDef { lifetime, .. })| {
let field_ident = format_ident!("__lifetime{}", i);
quote! {
#field_ident: &#l ()
#field_ident: &#lifetime ()
}
})
.collect();
Expand Down
11 changes: 5 additions & 6 deletions tests/pin_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,11 @@ fn trait_bounds_on_type_generics() {

impl<T> Static for Struct7<T> {}

// TODO: support this
// #[pin_project]
// pub struct Struct8<'a, 'b: 'a> {
// field1: &'a u8,
// field2: &'b u8,
// }
#[pin_project]
pub struct Struct8<'a, 'b: 'a> {
field1: &'a u8,
field2: &'b u8,
}

#[pin_project]
pub struct TupleStruct<'a, T: ?Sized>(&'a mut T);
Expand Down

0 comments on commit 8c1b6bb

Please sign in to comment.