| 1 |
// SPDX-License-Identifier: Apache-2.0 OR MIT |
| 2 |
|
| 3 |
use pin_project_lite::pin_project; |
| 4 |
|
| 5 |
// The same implementation. |
| 6 |
|
| 7 |
pin_project! { //~ ERROR E0119 |
| 8 |
struct Foo<T, U> { |
| 9 |
#[pin] |
| 10 |
future: T, |
| 11 |
field: U, |
| 12 |
} |
| 13 |
} |
| 14 |
|
| 15 |
// conflicting implementations |
| 16 |
impl<T, U> Unpin for Foo<T, U> where T: Unpin {} // Conditional Unpin impl |
| 17 |
|
| 18 |
// The implementation that under different conditions. |
| 19 |
|
| 20 |
pin_project! { //~ ERROR E0119 |
| 21 |
struct Bar<T, U> { |
| 22 |
#[pin] |
| 23 |
future: T, |
| 24 |
field: U, |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
// conflicting implementations |
| 29 |
impl<T, U> Unpin for Bar<T, U> {} // Non-conditional Unpin impl |
| 30 |
|
| 31 |
pin_project! { //~ ERROR E0119 |
| 32 |
struct Baz<T, U> { |
| 33 |
#[pin] |
| 34 |
future: T, |
| 35 |
field: U, |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
// conflicting implementations |
| 40 |
impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} // Conditional Unpin impl |
| 41 |
|
| 42 |
pin_project! { //~ ERROR E0119 |
| 43 |
#[project(!Unpin)] |
| 44 |
struct Qux<T, U> { |
| 45 |
#[pin] |
| 46 |
future: T, |
| 47 |
field: U, |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
// conflicting implementations |
| 52 |
impl<T, U> Unpin for Qux<T, U> {} // Non-conditional Unpin impl |
| 53 |
|
| 54 |
pin_project! { //~ ERROR E0119 |
| 55 |
#[project(!Unpin)] |
| 56 |
struct Fred<T, U> { |
| 57 |
#[pin] |
| 58 |
future: T, |
| 59 |
field: U, |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
// conflicting implementations |
| 64 |
impl<T: Unpin, U: Unpin> Unpin for Fred<T, U> {} // Conditional Unpin impl |
| 65 |
|
| 66 |
fn main() {} |