Skip to content

Commit

Permalink
fix for ?Sized type parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
alecmocatta committed Jul 27, 2020
1 parent 78dcd19 commit af00004
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pin-project-internal/src/pin_project/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ impl<'a> Context<'a> {
// this 'public' type by creating this type in the inside of `const`.
#vis struct #struct_ident #proj_generics #where_clause {
__pin_project_use_generics: ::pin_project::__private::AlwaysUnpin<
#lifetime, (#(#type_params),*)
#lifetime, (#(::pin_project::__private::PhantomData<#type_params>),*)
>,

#(#fields,)*
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ pub mod __private {
#[doc(hidden)]
pub struct AlwaysUnpin<'a, T: ?Sized>(PhantomData<&'a ()>, PhantomData<T>);

impl<T: ?Sized> Unpin for AlwaysUnpin<'_, T> {}
impl<T> Unpin for AlwaysUnpin<'_, T> {}

// This is an internal helper used to ensure a value is dropped.
#[doc(hidden)]
Expand Down
13 changes: 13 additions & 0 deletions tests/sized.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#![warn(rust_2018_idioms, single_use_lifetimes)]
#![allow(dead_code)]

use pin_project::pin_project;

#[pin_project]
struct Foo<'a, I: ?Sized, Item>
where
I: Iterator,
{
iter: &'a mut I,
item: Option<Item>,
}

0 comments on commit af00004

Please sign in to comment.