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,19 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop)]
struct Struct {
f: bool,
}
#[pinned_drop]
impl PinnedDrop for Struct {
fn drop(mut self: Pin<&mut Self>) {
__drop_inner(__self);
}
}
fn main() {}

View File

@@ -0,0 +1,17 @@
error[E0061]: this function takes 0 arguments but 1 argument was supplied
--> tests/ui/pinned_drop/call-drop-inner.rs:15:9
|
15 | __drop_inner(__self);
| ^^^^^^^^^^^^ ------ unexpected argument of type `Pin<&mut Struct>`
|
note: function defined here
--> tests/ui/pinned_drop/call-drop-inner.rs:12:1
|
12 | #[pinned_drop]
| ^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `pinned_drop` (in Nightly builds, run with -Z macro-backtrace for more info)
help: remove the extra argument
|
15 - __drop_inner(__self);
15 + __drop_inner();
|

View File

@@ -0,0 +1,29 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
// In `Drop` impl, the implementor must specify the same requirement as type definition.
struct DropImpl<T> {
f: T,
}
impl<T: Unpin> Drop for DropImpl<T> {
//~^ ERROR E0367
fn drop(&mut self) {}
}
#[pin_project(PinnedDrop)] //~ ERROR E0277
struct PinnedDropImpl<T> {
#[pin]
f: T,
}
#[pinned_drop]
impl<T: Unpin> PinnedDrop for PinnedDropImpl<T> {
fn drop(self: Pin<&mut Self>) {}
}
fn main() {}

View File

@@ -0,0 +1,34 @@
error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not
--> tests/ui/pinned_drop/conditional-drop-impl.rs:13:9
|
13 | impl<T: Unpin> Drop for DropImpl<T> {
| ^^^^^
|
note: the implementor must specify the same requirement
--> tests/ui/pinned_drop/conditional-drop-impl.rs:9:1
|
9 | struct DropImpl<T> {
| ^^^^^^^^^^^^^^^^^^
error[E0277]: `T` cannot be unpinned
--> tests/ui/pinned_drop/conditional-drop-impl.rs:18:15
|
18 | #[pin_project(PinnedDrop)] //~ ERROR E0277
| ^^^^^^^^^^ the trait `Unpin` is not implemented for `T`
|
= 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 `PinnedDropImpl<T>` to implement `PinnedDrop`
--> tests/ui/pinned_drop/conditional-drop-impl.rs:25:16
|
24 | #[pinned_drop]
| -------------- in this procedural macro expansion
25 | impl<T: Unpin> PinnedDrop for PinnedDropImpl<T> {
| ----- ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
= note: this error originates in the attribute macro `pinned_drop` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T` with trait `Unpin`
|
19 | struct PinnedDropImpl<T: std::marker::Unpin> {
| ++++++++++++++++++++

View File

@@ -0,0 +1,11 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use pin_project::pin_project;
#[pin_project(PinnedDrop)] //~ ERROR E0277
struct Struct {
#[pin]
f: u8,
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error[E0277]: the trait bound `Struct: PinnedDrop` is not satisfied
--> tests/ui/pinned_drop/forget-pinned-drop-impl.rs:5:15
|
5 | #[pin_project(PinnedDrop)] //~ ERROR E0277
| ^^^^^^^^^^ the trait `PinnedDrop` is not implemented for `Struct`

View File

@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// by-ref binding `ref (mut) self` and sub-patterns `@` are not allowed in receivers (rejected by rustc).
use std::pin::Pin;
struct S {}
impl S {
fn take_ref_self(ref self: Pin<&mut Self>) {} //~ ERROR expected identifier, found keyword `self`
fn take_ref_mut_self(ref mut self: Pin<&mut Self>) {} //~ ERROR expected identifier, found keyword `self`
fn self_subpat(self @ S {}: Self) {} //~ ERROR expected one of `)`, `,`, or `:`, found `@`
}
fn main() {}

View File

@@ -0,0 +1,25 @@
error: expected identifier, found keyword `self`
--> tests/ui/pinned_drop/invalid-self.rs:10:26
|
10 | fn take_ref_self(ref self: Pin<&mut Self>) {} //~ ERROR expected identifier, found keyword `self`
| ^^^^ expected identifier, found keyword
error: expected identifier, found keyword `self`
--> tests/ui/pinned_drop/invalid-self.rs:11:34
|
11 | fn take_ref_mut_self(ref mut self: Pin<&mut Self>) {} //~ ERROR expected identifier, found keyword `self`
| ^^^^ expected identifier, found keyword
error: expected parameter name, found `@`
--> tests/ui/pinned_drop/invalid-self.rs:13:25
|
13 | fn self_subpat(self @ S {}: Self) {} //~ ERROR expected one of `)`, `,`, or `:`, found `@`
| ^ expected parameter name
error: expected one of `)`, `,`, or `:`, found `@`
--> tests/ui/pinned_drop/invalid-self.rs:13:25
|
13 | fn self_subpat(self @ S {}: Self) {} //~ ERROR expected one of `)`, `,`, or `:`, found `@`
| -^ expected one of `)`, `,`, or `:`
| |
| help: missing `,`

View File

@@ -0,0 +1,233 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
mod argument {
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop)]
struct UnexpectedArg1(());
#[pinned_drop(foo)] //~ ERROR unexpected argument
impl PinnedDrop for UnexpectedArg1 {
fn drop(self: Pin<&mut Self>) {}
}
#[pin_project(PinnedDrop)]
struct UnexpectedArg2(());
#[pinned_drop()] // Ok
impl PinnedDrop for UnexpectedArg2 {
fn drop(self: Pin<&mut Self>) {}
}
}
mod attribute {
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop)]
struct Duplicate(());
#[pinned_drop]
#[pinned_drop] //~ ERROR duplicate #[pinned_drop] attribute
impl PinnedDrop for Duplicate {
fn drop(self: Pin<&mut Self>) {}
}
}
mod item {
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop)]
struct TraitImpl(());
#[pinned_drop]
impl Drop for TraitImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait
#[pin_project(PinnedDrop)]
struct InherentImpl(());
#[pinned_drop]
impl InherentImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait
#[pinned_drop]
fn func(_: Pin<&mut ()>) {} //~ ERROR expected `impl`
}
mod unsafety {
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop)]
struct Impl(());
#[pinned_drop]
unsafe impl PinnedDrop for Impl {
//~^ ERROR implementing the trait `PinnedDrop` is not unsafe
fn drop(self: Pin<&mut Self>) {}
}
#[pin_project(PinnedDrop)]
struct Method(());
#[pinned_drop]
impl PinnedDrop for Method {
unsafe fn drop(self: Pin<&mut Self>) {} //~ ERROR implementing the method `drop` is not unsafe
}
}
mod assoc_item {
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop)]
struct Empty(());
#[pinned_drop]
impl PinnedDrop for Empty {} //~ ERROR not all trait items implemented, missing: `drop`
#[pin_project(PinnedDrop)]
struct Const1(());
#[pinned_drop]
impl PinnedDrop for Const1 {
const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop`
fn drop(self: Pin<&mut Self>) {}
}
#[pin_project(PinnedDrop)]
struct Const2(());
#[pinned_drop]
impl PinnedDrop for Const2 {
fn drop(self: Pin<&mut Self>) {}
const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop`
}
#[pin_project(PinnedDrop)]
struct Type1(());
#[pinned_drop]
impl PinnedDrop for Type1 {
type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop`
fn drop(self: Pin<&mut Self>) {}
}
#[pin_project(PinnedDrop)]
struct Type2(());
#[pinned_drop]
impl PinnedDrop for Type2 {
fn drop(self: Pin<&mut Self>) {}
type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop`
}
#[pin_project(PinnedDrop)]
struct Duplicate(());
#[pinned_drop]
impl PinnedDrop for Duplicate {
fn drop(self: Pin<&mut Self>) {}
fn drop(self: Pin<&mut Self>) {} //~ ERROR duplicate definitions with name `drop`
}
}
mod method {
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop)]
struct RetUnit(());
#[pinned_drop]
impl PinnedDrop for RetUnit {
fn drop(self: Pin<&mut Self>) -> () {} // Ok
}
#[pin_project(PinnedDrop)]
struct RetTy(());
#[pinned_drop]
impl PinnedDrop for RetTy {
fn drop(self: Pin<&mut Self>) -> Self {} //~ ERROR method `drop` must return the unit type
}
#[pin_project(PinnedDrop)]
struct NoArg(());
#[pinned_drop]
impl PinnedDrop for NoArg {
fn drop() {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
}
#[pin_project(PinnedDrop)]
struct MultiArg(());
#[pinned_drop]
impl PinnedDrop for MultiArg {
fn drop(self: Pin<&mut Self>, _: ()) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
}
#[pin_project(PinnedDrop)]
struct InvalidArg1(());
#[pinned_drop]
impl PinnedDrop for InvalidArg1 {
fn drop(&mut self) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
}
#[pin_project(PinnedDrop)]
struct InvalidArg2(());
#[pinned_drop]
impl PinnedDrop for InvalidArg2 {
fn drop(_: Pin<&mut Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
}
#[pin_project(PinnedDrop)]
struct InvalidArg3(());
#[pinned_drop]
impl PinnedDrop for InvalidArg3 {
fn drop(self: Pin<&Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
}
#[pin_project(PinnedDrop)]
struct InvalidArg4(());
#[pinned_drop]
impl PinnedDrop for InvalidArg4 {
fn drop(self: Pin<&mut ()>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
}
#[pin_project(PinnedDrop)]
struct InvalidName(());
#[pinned_drop]
impl PinnedDrop for InvalidName {
fn pinned_drop(self: Pin<&mut Self>) {} //~ ERROR method `pinned_drop` is not a member of trait `PinnedDrop`
}
}
mod self_ty {
use pin_project::pinned_drop;
#[pinned_drop]
impl PinnedDrop for () {
//~^ ERROR implementing the trait `PinnedDrop` on this type is unsupported
fn drop(self: Pin<&mut Self>) {}
}
#[pinned_drop]
impl PinnedDrop for &mut A {
//~^ ERROR implementing the trait `PinnedDrop` on this type is unsupported
fn drop(self: Pin<&mut Self>) {}
}
#[pinned_drop]
impl PinnedDrop for [A] {
//~^ ERROR implementing the trait `PinnedDrop` on this type is unsupported
fn drop(self: Pin<&mut Self>) {}
}
}
fn main() {}

View File

@@ -0,0 +1,143 @@
error: unexpected argument: `foo`
--> tests/ui/pinned_drop/invalid.rs:11:19
|
11 | #[pinned_drop(foo)] //~ ERROR unexpected argument
| ^^^
error: duplicate #[pinned_drop] attribute
--> tests/ui/pinned_drop/invalid.rs:32:5
|
32 | #[pinned_drop] //~ ERROR duplicate #[pinned_drop] attribute
| ^^^^^^^^^^^^^^
error: #[pinned_drop] may only be used on implementation for the `PinnedDrop` trait
--> tests/ui/pinned_drop/invalid.rs:45:10
|
45 | impl Drop for TraitImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait
| ^^^^
error: #[pinned_drop] may only be used on implementation for the `PinnedDrop` trait
--> tests/ui/pinned_drop/invalid.rs:51:10
|
51 | impl InherentImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait
| ^^^^^^^^^^^^
error: expected `impl`
--> tests/ui/pinned_drop/invalid.rs:54:5
|
54 | fn func(_: Pin<&mut ()>) {} //~ ERROR expected `impl`
| ^^
error: implementing the trait `PinnedDrop` is not unsafe
--> tests/ui/pinned_drop/invalid.rs:64:5
|
64 | unsafe impl PinnedDrop for Impl {
| ^^^^^^
error: implementing the method `drop` is not unsafe
--> tests/ui/pinned_drop/invalid.rs:74:9
|
74 | unsafe fn drop(self: Pin<&mut Self>) {} //~ ERROR implementing the method `drop` is not unsafe
| ^^^^^^
error: not all trait items implemented, missing: `drop`
--> tests/ui/pinned_drop/invalid.rs:85:5
|
85 | impl PinnedDrop for Empty {} //~ ERROR not all trait items implemented, missing: `drop`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: const `A` is not a member of trait `PinnedDrop`
--> tests/ui/pinned_drop/invalid.rs:92:9
|
92 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop`
| ^^^^^^^^^^^^^^^^
error: const `A` is not a member of trait `PinnedDrop`
--> tests/ui/pinned_drop/invalid.rs:102:9
|
102 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop`
| ^^^^^^^^^^^^^^^^
error: type `A` is not a member of trait `PinnedDrop`
--> tests/ui/pinned_drop/invalid.rs:110:9
|
110 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop`
| ^^^^^^^^^^^^
error: type `A` is not a member of trait `PinnedDrop`
--> tests/ui/pinned_drop/invalid.rs:120:9
|
120 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop`
| ^^^^^^^^^^^^
error: duplicate definitions with name `drop`
--> tests/ui/pinned_drop/invalid.rs:129:9
|
129 | fn drop(self: Pin<&mut Self>) {} //~ ERROR duplicate definitions with name `drop`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: method `drop` must return the unit type
--> tests/ui/pinned_drop/invalid.rs:151:42
|
151 | fn drop(self: Pin<&mut Self>) -> Self {} //~ ERROR method `drop` must return the unit type
| ^^^^
error: method `drop` must take an argument `self: Pin<&mut Self>`
--> tests/ui/pinned_drop/invalid.rs:159:16
|
159 | fn drop() {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
| ^^
error: method `drop` must take an argument `self: Pin<&mut Self>`
--> tests/ui/pinned_drop/invalid.rs:167:17
|
167 | fn drop(self: Pin<&mut Self>, _: ()) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: method `drop` must take an argument `self: Pin<&mut Self>`
--> tests/ui/pinned_drop/invalid.rs:175:17
|
175 | fn drop(&mut self) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
| ^^^^^^^^^
error: method `drop` must take an argument `self: Pin<&mut Self>`
--> tests/ui/pinned_drop/invalid.rs:183:17
|
183 | fn drop(_: Pin<&mut Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
| ^^^^^^^^^^^^^^^^^
error: method `drop` must take an argument `self: Pin<&mut Self>`
--> tests/ui/pinned_drop/invalid.rs:191:17
|
191 | fn drop(self: Pin<&Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
| ^^^^^^^^^^^^^^^^
error: method `drop` must take an argument `self: Pin<&mut Self>`
--> tests/ui/pinned_drop/invalid.rs:199:17
|
199 | fn drop(self: Pin<&mut ()>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
| ^^^^^^^^^^^^^^^^^^
error: method `pinned_drop` is not a member of trait `PinnedDrop`
--> tests/ui/pinned_drop/invalid.rs:207:12
|
207 | fn pinned_drop(self: Pin<&mut Self>) {} //~ ERROR method `pinned_drop` is not a member of trait `PinnedDrop`
| ^^^^^^^^^^^
error: implementing the trait `PinnedDrop` on this type is unsupported
--> tests/ui/pinned_drop/invalid.rs:215:25
|
215 | impl PinnedDrop for () {
| ^^
error: implementing the trait `PinnedDrop` on this type is unsupported
--> tests/ui/pinned_drop/invalid.rs:221:25
|
221 | impl PinnedDrop for &mut A {
| ^^^^^^
error: implementing the trait `PinnedDrop` on this type is unsupported
--> tests/ui/pinned_drop/invalid.rs:227:25
|
227 | impl PinnedDrop for [A] {
| ^^^

View File

@@ -0,0 +1,19 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[pin_project]
struct S {
#[pin]
f: u8,
}
#[pinned_drop]
impl PinnedDrop for S {
//~^ ERROR E0119
fn drop(self: Pin<&mut Self>) {}
}
fn main() {}

View File

@@ -0,0 +1,8 @@
error[E0119]: conflicting implementations of trait `PinnedDrop` for type `S`
--> tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs:14:1
|
7 | #[pin_project]
| -------------- first implementation here
...
14 | impl PinnedDrop for S {
| ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`

View File

@@ -0,0 +1,60 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
pub mod self_in_macro_def {
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop)]
pub struct S {
f: (),
}
#[pinned_drop]
impl PinnedDrop for S {
fn drop(self: Pin<&mut Self>) {
macro_rules! t {
() => {{
let _ = self; //~ ERROR E0434
fn f(self: ()) {} //~ ERROR `self` parameter is only allowed in associated functions
}};
}
t!();
}
}
}
pub mod self_span {
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop)]
pub struct S {
f: (),
}
#[pinned_drop]
impl PinnedDrop for S {
fn drop(self: Pin<&mut Self>) {
let _: () = self; //~ ERROR E0308
let _: Self = Self; //~ ERROR E0423
}
}
#[pin_project(PinnedDrop)]
pub enum E {
V { f: () },
}
#[pinned_drop]
impl PinnedDrop for E {
fn drop(self: Pin<&mut Self>) {
let _: () = self; //~ ERROR E0308
let _: Self = Self::V; //~ ERROR E0533
}
}
}
fn main() {}

View File

@@ -0,0 +1,67 @@
error: `self` parameter is only allowed in associated functions
--> tests/ui/pinned_drop/self.rs:20:26
|
20 | fn f(self: ()) {} //~ ERROR `self` parameter is only allowed in associated functions
| ^^^^ not semantically valid as function parameter
...
23 | t!();
| ---- in this macro invocation
|
= note: associated functions are those in `impl` or `trait` definitions
= note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0434]: can't capture dynamic environment in a fn item
--> tests/ui/pinned_drop/self.rs:18:29
|
18 | let _ = self; //~ ERROR E0434
| ^^^^
...
23 | t!();
| ---- in this macro invocation
|
= help: use the `|| { ... }` closure form instead
= note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0423]: expected value, found struct `S`
--> tests/ui/pinned_drop/self.rs:42:27
|
34 | / pub struct S {
35 | | f: (),
36 | | }
| |_____- `S` defined here
...
42 | let _: Self = Self; //~ ERROR E0423
| ^^^^ help: use struct literal syntax instead: `S { f: val }`
error[E0308]: mismatched types
--> tests/ui/pinned_drop/self.rs:41:25
|
41 | let _: () = self; //~ ERROR E0308
| -- ^^^^ expected `()`, found `Pin<&mut S>`
| |
| expected due to this
|
= note: expected unit type `()`
found struct `Pin<&mut self_span::S>`
error[E0308]: mismatched types
--> tests/ui/pinned_drop/self.rs:54:25
|
54 | let _: () = self; //~ ERROR E0308
| -- ^^^^ expected `()`, found `Pin<&mut E>`
| |
| expected due to this
|
= note: expected unit type `()`
found struct `Pin<&mut E>`
error[E0533]: expected value, found struct variant `E::V`
--> tests/ui/pinned_drop/self.rs:55:27
|
55 | let _: Self = Self::V; //~ ERROR E0533
| ^^^^^^^ not a value
|
help: you might have meant to create a new value of the struct
|
55 | let _: Self = Self::V { f: /* value */ }; //~ ERROR E0533
| ++++++++++++++++++

View File

@@ -0,0 +1,20 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::pin::Pin;
use pin_project::{pin_project, pinned_drop};
#[pin_project(PinnedDrop)]
struct S {
#[pin]
f: u8,
}
#[pinned_drop]
impl PinnedDrop for S {
fn drop(self: Pin<&mut Self>) {
self.project().f.get_unchecked_mut(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block [E0133]
}
}
fn main() {}

View File

@@ -0,0 +1,10 @@
error[E0133]: call to unsafe function `Pin::<&'a mut T>::get_unchecked_mut` is unsafe and requires unsafe function or block
--> tests/ui/pinned_drop/unsafe-call.rs:16:9
|
13 | #[pinned_drop]
| -------------- items do not inherit unsafety from separate enclosing items
...
16 | self.project().f.get_unchecked_mut(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block [E0133]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior