Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# UI tests for unstable features
These tests check how the guarantees and features provided by pin-project
interact with unstable language features.
The names of the files contained in this directory need to begin with the name
of the feature.

View File

@@ -0,0 +1,22 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Note: If you change this test, change 'marker_trait_attr.rs' at the same time.
use std::marker::PhantomPinned;
use pin_project::pin_project;
#[pin_project] //~ ERROR E0119
struct Struct<T> {
#[pin]
f: T,
}
// unsound Unpin impl
impl<T> Unpin for Struct<T> {}
fn is_unpin<T: Unpin>() {}
fn main() {
is_unpin::<Struct<PhantomPinned>>()
}

View File

@@ -0,0 +1,10 @@
error[E0119]: conflicting implementations of trait `Unpin` for type `Struct<_>`
--> tests/ui/unstable-features/marker_trait_attr-feature-gate.rs:9:1
|
9 | #[pin_project] //~ ERROR E0119
| ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>`
...
16 | impl<T> Unpin for Struct<T> {}
| --------------------------- first implementation here
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,28 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Note: If you change this test, change 'marker_trait_attr-feature-gate.rs' at the same time.
// marker_trait_attr
// Tracking issue: https://github.com/rust-lang/rust/issues/29864
#![feature(marker_trait_attr)]
// See https://github.com/taiki-e/pin-project/issues/105#issuecomment-535355974
use std::marker::PhantomPinned;
use pin_project::pin_project;
#[pin_project] //~ ERROR E0119
struct Struct<T> {
#[pin]
f: T,
}
// unsound Unpin impl
impl<T> Unpin for Struct<T> {}
fn is_unpin<T: Unpin>() {}
fn main() {
is_unpin::<Struct<PhantomPinned>>()
}

View File

@@ -0,0 +1,10 @@
error[E0119]: conflicting implementations of trait `Unpin` for type `Struct<_>`
--> tests/ui/unstable-features/marker_trait_attr.rs:15:1
|
15 | #[pin_project] //~ ERROR E0119
| ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>`
...
22 | impl<T> Unpin for Struct<T> {}
| --------------------------- first implementation here
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,23 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#![feature(negative_impls)]
// https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/design.20meeting.3A.20backlog.20bonanza/near/269471299
// https://github.com/taiki-e/pin-project/issues/340
#[pin_project::pin_project]
struct Foo<Pinned, Unpinned> {
#[pin]
pinned: Pinned,
unpinned: Unpinned,
}
struct MyPhantomPinned {}
impl !Unpin for MyPhantomPinned {}
impl Unpin for Foo<MyPhantomPinned, ()> {}
fn is_unpin<T: Unpin>() {}
fn main() {
is_unpin::<Foo<MyPhantomPinned, ()>>()
}

View File

@@ -0,0 +1,10 @@
error[E0119]: conflicting implementations of trait `Unpin` for type `Foo<MyPhantomPinned, ()>`
--> tests/ui/unstable-features/negative_impls.rs:8:1
|
8 | #[pin_project::pin_project]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Foo<MyPhantomPinned, ()>`
...
17 | impl Unpin for Foo<MyPhantomPinned, ()> {}
| --------------------------------------- first implementation here
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,22 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Note: If you change this test, change 'overlapping_marker_traits.rs' at the same time.
use std::marker::PhantomPinned;
use pin_project::pin_project;
#[pin_project] //~ ERROR E0119
struct Struct<T> {
#[pin]
f: T,
}
// unsound Unpin impl
impl<T> Unpin for Struct<T> {}
fn is_unpin<T: Unpin>() {}
fn main() {
is_unpin::<Struct<PhantomPinned>>()
}

View File

@@ -0,0 +1,10 @@
error[E0119]: conflicting implementations of trait `Unpin` for type `Struct<_>`
--> tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs:9:1
|
9 | #[pin_project] //~ ERROR E0119
| ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>`
...
16 | impl<T> Unpin for Struct<T> {}
| --------------------------- first implementation here
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,32 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Note: If you change this test, change 'overlapping_marker_traits-feature-gate.rs' at the same time.
// This feature could break the guarantee for Unpin provided by pin-project,
// but was removed in https://github.com/rust-lang/rust/pull/68544 (nightly-2020-02-06).
// Refs:
// - https://github.com/rust-lang/rust/issues/29864#issuecomment-515780867
// - https://github.com/taiki-e/pin-project/issues/105
// overlapping_marker_traits
// Tracking issue: https://github.com/rust-lang/rust/issues/29864
#![feature(overlapping_marker_traits)]
use std::marker::PhantomPinned;
use pin_project::pin_project;
#[pin_project]
struct Struct<T> {
#[pin]
f: T,
}
// unsound Unpin impl
impl<T> Unpin for Struct<T> {}
fn is_unpin<T: Unpin>() {}
fn main() {
is_unpin::<Struct<PhantomPinned>>()
}

View File

@@ -0,0 +1,18 @@
error[E0557]: feature has been removed
--> tests/ui/unstable-features/overlapping_marker_traits.rs:13:12
|
13 | #![feature(overlapping_marker_traits)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ feature has been removed
|
= note: removed in favor of `#![feature(marker_trait_attr)]`
error[E0119]: conflicting implementations of trait `Unpin` for type `Struct<_>`
--> tests/ui/unstable-features/overlapping_marker_traits.rs:19:1
|
19 | #[pin_project]
| ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>`
...
26 | impl<T> Unpin for Struct<T> {}
| --------------------------- first implementation here
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,55 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Note: If you change this test, change 'trivial_bounds.rs' at the same time.
mod phantom_pinned {
use std::marker::{PhantomData, PhantomPinned};
struct A(PhantomPinned);
impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277
struct Wrapper<T>(T);
impl<T> Unpin for Wrapper<T> where T: Unpin {}
struct B(PhantomPinned);
impl Unpin for B where Wrapper<PhantomPinned>: Unpin {} //~ ERROR E0277
struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T);
impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {}
struct C(PhantomPinned);
impl<'a> Unpin for C where WrapperWithLifetime<'a, PhantomPinned>: Unpin {} // Ok
}
mod inner {
use std::marker::{PhantomData, PhantomPinned};
struct Inner(PhantomPinned);
struct A(Inner);
impl Unpin for A where Inner: Unpin {} //~ ERROR E0277
struct Wrapper<T>(T);
impl<T> Unpin for Wrapper<T> where T: Unpin {}
struct B(Inner);
impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR E0277
struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T);
impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {}
struct C(Inner);
impl<'a> Unpin for C where WrapperWithLifetime<'a, Inner>: Unpin {} // Ok
}
fn main() {}

View File

@@ -0,0 +1,75 @@
error[E0277]: `PhantomPinned` cannot be unpinned
--> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:10:28
|
10 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277
| ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `PhantomPinned`
|
= note: consider using the `pin!` macro
consider using `Box::pin` if you need to access the pinned value outside of the current scope
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
5 + #![feature(trivial_bounds)]
|
error[E0277]: `PhantomPinned` cannot be unpinned
--> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:18:28
|
18 | impl Unpin for B where Wrapper<PhantomPinned>: Unpin {} //~ ERROR E0277
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `PhantomPinned`
|
= note: consider using the `pin!` macro
consider using `Box::pin` if you need to access the pinned value outside of the current scope
note: required for `phantom_pinned::Wrapper<PhantomPinned>` to implement `Unpin`
--> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:14:13
|
14 | impl<T> Unpin for Wrapper<T> where T: Unpin {}
| ^^^^^ ^^^^^^^^^^ ----- unsatisfied trait bound introduced here
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
5 + #![feature(trivial_bounds)]
|
error[E0277]: `PhantomPinned` cannot be unpinned
--> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:36:28
|
36 | impl Unpin for A where Inner: Unpin {} //~ ERROR E0277
| ^^^^^^^^^^^^ within `Inner`, the trait `Unpin` is not implemented for `PhantomPinned`
|
= note: consider using the `pin!` macro
consider using `Box::pin` if you need to access the pinned value outside of the current scope
note: required because it appears within the type `Inner`
--> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:32:12
|
32 | struct Inner(PhantomPinned);
| ^^^^^
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
5 + #![feature(trivial_bounds)]
|
error[E0277]: `PhantomPinned` cannot be unpinned
--> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:44:28
|
44 | impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR E0277
| ^^^^^^^^^^^^^^^^^^^^^ within `Inner`, the trait `Unpin` is not implemented for `PhantomPinned`
|
= note: consider using the `pin!` macro
consider using `Box::pin` if you need to access the pinned value outside of the current scope
note: required because it appears within the type `Inner`
--> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:32:12
|
32 | struct Inner(PhantomPinned);
| ^^^^^
note: required for `inner::Wrapper<Inner>` to implement `Unpin`
--> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:40:13
|
40 | impl<T> Unpin for Wrapper<T> where T: Unpin {}
| ^^^^^ ^^^^^^^^^^ ----- unsatisfied trait bound introduced here
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
5 + #![feature(trivial_bounds)]
|

View File

@@ -0,0 +1,41 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Note: If you change this test, change 'trivial_bounds-feature-gate.rs' at the same time.
// trivial_bounds
// Tracking issue: https://github.com/rust-lang/rust/issues/48214
#![feature(trivial_bounds)]
#![deny(trivial_bounds)]
#![allow(dead_code)]
use std::marker::{PhantomData, PhantomPinned};
fn inner() {
struct Inner(PhantomPinned);
struct A(PhantomPinned);
impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters
struct B(Inner);
impl Unpin for B where Inner: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters
struct Wrapper<T>(T);
impl<T> Unpin for Wrapper<T> where T: Unpin {}
struct C(Inner);
impl Unpin for C where Wrapper<Inner>: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters
struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T);
impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {}
struct D(Inner);
impl<'a> Unpin for D where WrapperWithLifetime<'a, Inner>: Unpin {} // Ok
}
fn main() {}

View File

@@ -0,0 +1,23 @@
error: trait bound PhantomPinned: Unpin does not depend on any type or lifetime parameters
--> tests/ui/unstable-features/trivial_bounds.rs:18:43
|
18 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters
| ^^^^^
|
note: the lint level is defined here
--> tests/ui/unstable-features/trivial_bounds.rs:8:9
|
8 | #![deny(trivial_bounds)]
| ^^^^^^^^^^^^^^
error: trait bound Inner: Unpin does not depend on any type or lifetime parameters
--> tests/ui/unstable-features/trivial_bounds.rs:22:35
|
22 | impl Unpin for B where Inner: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters
| ^^^^^
error: trait bound Wrapper<Inner>: Unpin does not depend on any type or lifetime parameters
--> tests/ui/unstable-features/trivial_bounds.rs:30:44
|
30 | impl Unpin for C where Wrapper<Inner>: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters
| ^^^^^