aboutsummaryrefslogtreecommitdiff
path: root/tests/ui/pinned_drop
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/pinned_drop')
-rw-r--r--tests/ui/pinned_drop/call-drop-inner.rs3
-rw-r--r--tests/ui/pinned_drop/call-drop-inner.stderr8
-rw-r--r--tests/ui/pinned_drop/conditional-drop-impl.rs3
-rw-r--r--tests/ui/pinned_drop/conditional-drop-impl.stderr27
-rw-r--r--tests/ui/pinned_drop/invalid.rs6
-rw-r--r--tests/ui/pinned_drop/invalid.stderr100
-rw-r--r--tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs3
-rw-r--r--tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr8
-rw-r--r--tests/ui/pinned_drop/self.rs6
-rw-r--r--tests/ui/pinned_drop/self.stderr34
-rw-r--r--tests/ui/pinned_drop/unsafe-call.rs3
-rw-r--r--tests/ui/pinned_drop/unsafe-call.stderr4
12 files changed, 109 insertions, 96 deletions
diff --git a/tests/ui/pinned_drop/call-drop-inner.rs b/tests/ui/pinned_drop/call-drop-inner.rs
index 4171ed5..9f89942 100644
--- a/tests/ui/pinned_drop/call-drop-inner.rs
+++ b/tests/ui/pinned_drop/call-drop-inner.rs
@@ -1,6 +1,7 @@
-use pin_project::{pin_project, pinned_drop};
use std::pin::Pin;
+use pin_project::{pin_project, pinned_drop};
+
#[pin_project(PinnedDrop)]
struct Struct {
f: bool,
diff --git a/tests/ui/pinned_drop/call-drop-inner.stderr b/tests/ui/pinned_drop/call-drop-inner.stderr
index 53194b0..463e837 100644
--- a/tests/ui/pinned_drop/call-drop-inner.stderr
+++ b/tests/ui/pinned_drop/call-drop-inner.stderr
@@ -1,14 +1,14 @@
error[E0061]: this function takes 0 arguments but 1 argument was supplied
- --> $DIR/call-drop-inner.rs:12:9
+ --> $DIR/call-drop-inner.rs:13:9
|
-12 | __drop_inner(__self);
+13 | __drop_inner(__self);
| ^^^^^^^^^^^^ ------ supplied 1 argument
| |
| expected 0 arguments
|
note: function defined here
- --> $DIR/call-drop-inner.rs:9:1
+ --> $DIR/call-drop-inner.rs:10:1
|
-9 | #[pinned_drop]
+10 | #[pinned_drop]
| ^^^^^^^^^^^^^^
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/pinned_drop/conditional-drop-impl.rs b/tests/ui/pinned_drop/conditional-drop-impl.rs
index fecfd50..23d756d 100644
--- a/tests/ui/pinned_drop/conditional-drop-impl.rs
+++ b/tests/ui/pinned_drop/conditional-drop-impl.rs
@@ -1,6 +1,7 @@
-use pin_project::{pin_project, pinned_drop};
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> {
diff --git a/tests/ui/pinned_drop/conditional-drop-impl.stderr b/tests/ui/pinned_drop/conditional-drop-impl.stderr
index 6381a29..8ab2294 100644
--- a/tests/ui/pinned_drop/conditional-drop-impl.stderr
+++ b/tests/ui/pinned_drop/conditional-drop-impl.stderr
@@ -1,26 +1,31 @@
error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not
- --> $DIR/conditional-drop-impl.rs:10:9
+ --> $DIR/conditional-drop-impl.rs:11:9
|
-10 | impl<T: Unpin> Drop for DropImpl<T> {
+11 | impl<T: Unpin> Drop for DropImpl<T> {
| ^^^^^
|
note: the implementor must specify the same requirement
- --> $DIR/conditional-drop-impl.rs:6:1
+ --> $DIR/conditional-drop-impl.rs:7:1
|
-6 | / struct DropImpl<T> {
-7 | | f: T,
-8 | | }
+7 | / struct DropImpl<T> {
+8 | | f: T,
+9 | | }
| |_^
error[E0277]: `T` cannot be unpinned
- --> $DIR/conditional-drop-impl.rs:15:15
+ --> $DIR/conditional-drop-impl.rs:16:15
|
-15 | #[pin_project(PinnedDrop)] //~ ERROR E0277
+16 | #[pin_project(PinnedDrop)] //~ ERROR E0277
| ^^^^^^^^^^ the trait `Unpin` is not implemented for `T`
|
- = note: required because of the requirements on the impl of `PinnedDrop` for `PinnedDropImpl<T>`
+ = note: consider using `Box::pin`
+note: required because of the requirements on the impl of `PinnedDrop` for `PinnedDropImpl<T>`
+ --> $DIR/conditional-drop-impl.rs:23:16
+ |
+23 | impl<T: Unpin> PinnedDrop for PinnedDropImpl<T> {
+ | ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
= note: required by `pin_project::__private::PinnedDrop::drop`
help: consider restricting type parameter `T`
|
-16 | struct PinnedDropImpl<T: Unpin> {
- | ^^^^^^^
+17 | struct PinnedDropImpl<T: std::marker::Unpin> {
+ | ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/pinned_drop/invalid.rs b/tests/ui/pinned_drop/invalid.rs
index 7e36750..fdadf8a 100644
--- a/tests/ui/pinned_drop/invalid.rs
+++ b/tests/ui/pinned_drop/invalid.rs
@@ -1,7 +1,8 @@
mod argument {
- use pin_project::{pin_project, pinned_drop};
use std::pin::Pin;
+ use pin_project::{pin_project, pinned_drop};
+
#[pin_project(PinnedDrop)]
struct UnexpectedArg1(());
@@ -128,9 +129,10 @@ mod assoc_item {
}
mod method {
- use pin_project::{pin_project, pinned_drop};
use std::pin::Pin;
+ use pin_project::{pin_project, pinned_drop};
+
#[pin_project(PinnedDrop)]
struct RetUnit(());
diff --git a/tests/ui/pinned_drop/invalid.stderr b/tests/ui/pinned_drop/invalid.stderr
index 277a2fa..499b0d9 100644
--- a/tests/ui/pinned_drop/invalid.stderr
+++ b/tests/ui/pinned_drop/invalid.stderr
@@ -1,143 +1,143 @@
error: unexpected token: foo
- --> $DIR/invalid.rs:8:19
+ --> $DIR/invalid.rs:9:19
|
-8 | #[pinned_drop(foo)] //~ ERROR unexpected token
+9 | #[pinned_drop(foo)] //~ ERROR unexpected token
| ^^^
error: duplicate #[pinned_drop] attribute
- --> $DIR/invalid.rs:29:5
+ --> $DIR/invalid.rs:30:5
|
-29 | #[pinned_drop] //~ ERROR duplicate #[pinned_drop] attribute
+30 | #[pinned_drop] //~ ERROR duplicate #[pinned_drop] attribute
| ^^^^^^^^^^^^^^
error: #[pinned_drop] may only be used on implementation for the `PinnedDrop` trait
- --> $DIR/invalid.rs:42:10
+ --> $DIR/invalid.rs:43:10
|
-42 | impl Drop for TraitImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait
+43 | 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
- --> $DIR/invalid.rs:48:10
+ --> $DIR/invalid.rs:49:10
|
-48 | impl InherentImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait
+49 | impl InherentImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait
| ^^^^^^^^^^^^
error: expected `impl`
- --> $DIR/invalid.rs:51:5
+ --> $DIR/invalid.rs:52:5
|
-51 | fn func(_: Pin<&mut ()>) {} //~ ERROR expected `impl`
+52 | fn func(_: Pin<&mut ()>) {} //~ ERROR expected `impl`
| ^^
error: implementing the trait `PinnedDrop` is not unsafe
- --> $DIR/invalid.rs:61:5
+ --> $DIR/invalid.rs:62:5
|
-61 | unsafe impl PinnedDrop for Impl {
+62 | unsafe impl PinnedDrop for Impl {
| ^^^^^^
error: implementing the method `drop` is not unsafe
- --> $DIR/invalid.rs:71:9
+ --> $DIR/invalid.rs:72:9
|
-71 | unsafe fn drop(self: Pin<&mut Self>) {} //~ ERROR implementing the method `drop` is not unsafe
+72 | unsafe fn drop(self: Pin<&mut Self>) {} //~ ERROR implementing the method `drop` is not unsafe
| ^^^^^^
error: not all trait items implemented, missing: `drop`
- --> $DIR/invalid.rs:82:5
+ --> $DIR/invalid.rs:83:5
|
-82 | impl PinnedDrop for Empty {} //~ ERROR not all trait items implemented, missing: `drop`
+83 | impl PinnedDrop for Empty {} //~ ERROR not all trait items implemented, missing: `drop`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: const `A` is not a member of trait `PinnedDrop`
- --> $DIR/invalid.rs:89:9
+ --> $DIR/invalid.rs:90:9
|
-89 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop`
+90 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop`
| ^^^^^^^^^^^^^^^^
error: const `A` is not a member of trait `PinnedDrop`
- --> $DIR/invalid.rs:99:9
- |
-99 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop`
- | ^^^^^^^^^^^^^^^^
+ --> $DIR/invalid.rs:100:9
+ |
+100 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop`
+ | ^^^^^^^^^^^^^^^^
error: type `A` is not a member of trait `PinnedDrop`
- --> $DIR/invalid.rs:107:9
+ --> $DIR/invalid.rs:108:9
|
-107 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop`
+108 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop`
| ^^^^^^^^^^^^
error: type `A` is not a member of trait `PinnedDrop`
- --> $DIR/invalid.rs:117:9
+ --> $DIR/invalid.rs:118:9
|
-117 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop`
+118 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop`
| ^^^^^^^^^^^^
error: duplicate definitions with name `drop`
- --> $DIR/invalid.rs:126:9
+ --> $DIR/invalid.rs:127:9
|
-126 | fn drop(self: Pin<&mut Self>) {} //~ ERROR duplicate definitions with name `drop`
+127 | fn drop(self: Pin<&mut Self>) {} //~ ERROR duplicate definitions with name `drop`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: method `drop` must return the unit type
- --> $DIR/invalid.rs:147:42
+ --> $DIR/invalid.rs:149:42
|
-147 | fn drop(self: Pin<&mut Self>) -> Self {} //~ ERROR method `drop` must return the unit type
+149 | 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>`
- --> $DIR/invalid.rs:155:16
+ --> $DIR/invalid.rs:157:16
|
-155 | fn drop() {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
+157 | fn drop() {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
| ^^
error: method `drop` must take an argument `self: Pin<&mut Self>`
- --> $DIR/invalid.rs:163:17
+ --> $DIR/invalid.rs:165:17
|
-163 | fn drop(self: Pin<&mut Self>, _: ()) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
+165 | 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>`
- --> $DIR/invalid.rs:171:17
+ --> $DIR/invalid.rs:173:17
|
-171 | fn drop(&mut self) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
+173 | 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>`
- --> $DIR/invalid.rs:179:17
+ --> $DIR/invalid.rs:181:17
|
-179 | fn drop(_: Pin<&mut Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
+181 | 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>`
- --> $DIR/invalid.rs:187:17
+ --> $DIR/invalid.rs:189:17
|
-187 | fn drop(self: Pin<&Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
+189 | 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>`
- --> $DIR/invalid.rs:195:17
+ --> $DIR/invalid.rs:197:17
|
-195 | fn drop(self: Pin<&mut ()>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>`
+197 | 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
- --> $DIR/invalid.rs:203:12
+ --> $DIR/invalid.rs:205:12
|
-203 | fn pinned_drop(self: Pin<&mut Self>) {} //~ ERROR method `pinned_drop` is not a member of trait `PinnedDrop
+205 | 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
- --> $DIR/invalid.rs:211:25
+ --> $DIR/invalid.rs:213:25
|
-211 | impl PinnedDrop for () {
+213 | impl PinnedDrop for () {
| ^^
error: implementing the trait `PinnedDrop` on this type is unsupported
- --> $DIR/invalid.rs:217:25
+ --> $DIR/invalid.rs:219:25
|
-217 | impl PinnedDrop for &mut A {
+219 | impl PinnedDrop for &mut A {
| ^^^^^^
error: implementing the trait `PinnedDrop` on this type is unsupported
- --> $DIR/invalid.rs:223:25
+ --> $DIR/invalid.rs:225:25
|
-223 | impl PinnedDrop for [A] {
+225 | impl PinnedDrop for [A] {
| ^^^
diff --git a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs
index f9db79c..391f290 100644
--- a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs
+++ b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs
@@ -1,6 +1,7 @@
-use pin_project::{pin_project, pinned_drop};
use std::pin::Pin;
+use pin_project::{pin_project, pinned_drop};
+
#[pin_project]
struct S {
#[pin]
diff --git a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr
index 6f868bf..9f32149 100644
--- a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr
+++ b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr
@@ -1,8 +1,8 @@
-error[E0119]: conflicting implementations of trait `pin_project::__private::PinnedDrop` for type `S`:
- --> $DIR/pinned-drop-no-attr-arg.rs:11:1
+error[E0119]: conflicting implementations of trait `pin_project::__private::PinnedDrop` for type `S`
+ --> $DIR/pinned-drop-no-attr-arg.rs:12:1
|
-4 | #[pin_project]
+5 | #[pin_project]
| -------------- first implementation here
...
-11 | impl PinnedDrop for S {
+12 | impl PinnedDrop for S {
| ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`
diff --git a/tests/ui/pinned_drop/self.rs b/tests/ui/pinned_drop/self.rs
index 03825ca..ff63402 100644
--- a/tests/ui/pinned_drop/self.rs
+++ b/tests/ui/pinned_drop/self.rs
@@ -1,7 +1,8 @@
pub mod self_in_macro_def {
- use pin_project::{pin_project, pinned_drop};
use std::pin::Pin;
+ use pin_project::{pin_project, pinned_drop};
+
#[pin_project(PinnedDrop)]
pub struct S {
f: (),
@@ -23,9 +24,10 @@ pub mod self_in_macro_def {
}
pub mod self_span {
- use pin_project::{pin_project, pinned_drop};
use std::pin::Pin;
+ use pin_project::{pin_project, pinned_drop};
+
#[pin_project(PinnedDrop)]
pub struct S {
f: (),
diff --git a/tests/ui/pinned_drop/self.stderr b/tests/ui/pinned_drop/self.stderr
index edab117..4ccbc41 100644
--- a/tests/ui/pinned_drop/self.stderr
+++ b/tests/ui/pinned_drop/self.stderr
@@ -1,42 +1,42 @@
error: `self` parameter is only allowed in associated functions
- --> $DIR/self.rs:17:26
+ --> $DIR/self.rs:18:26
|
-17 | fn f(self: ()) {} //~ ERROR `self` parameter is only allowed in associated functions
+18 | fn f(self: ()) {} //~ ERROR `self` parameter is only allowed in associated functions
| ^^^^ not semantically valid as function parameter
...
-20 | t!();
+21 | t!();
| ----- in this macro invocation
|
= note: associated functions are those in `impl` or `trait` definitions
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0434]: can't capture dynamic environment in a fn item
- --> $DIR/self.rs:15:29
+ --> $DIR/self.rs:16:29
|
-15 | let _ = self; //~ ERROR E0434
+16 | let _ = self; //~ ERROR E0434
| ^^^^
...
-20 | t!();
+21 | t!();
| ----- in this macro invocation
|
= help: use the `|| { ... }` closure form instead
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0423]: expected value, found struct `S`
- --> $DIR/self.rs:38:27
+ --> $DIR/self.rs:40:27
|
-30 | / pub struct S {
-31 | | f: (),
-32 | | }
+32 | / pub struct S {
+33 | | f: (),
+34 | | }
| |_____- `S` defined here
...
-38 | let _: Self = Self; //~ ERROR E0423
+40 | let _: Self = Self; //~ ERROR E0423
| ^^^^ help: use struct literal syntax instead: `S { f: val }`
error[E0308]: mismatched types
- --> $DIR/self.rs:37:25
+ --> $DIR/self.rs:39:25
|
-37 | let _: () = self; //~ ERROR E0308
+39 | let _: () = self; //~ ERROR E0308
| -- ^^^^ expected `()`, found struct `Pin`
| |
| expected due to this
@@ -45,9 +45,9 @@ error[E0308]: mismatched types
found struct `Pin<&mut self_span::S>`
error[E0308]: mismatched types
- --> $DIR/self.rs:50:25
+ --> $DIR/self.rs:52:25
|
-50 | let _: () = self; //~ ERROR E0308
+52 | let _: () = self; //~ ERROR E0308
| -- ^^^^ expected `()`, found struct `Pin`
| |
| expected due to this
@@ -56,7 +56,7 @@ error[E0308]: mismatched types
found struct `Pin<&mut E>`
error[E0533]: expected unit struct, unit variant or constant, found struct variant `Self::V`
- --> $DIR/self.rs:51:27
+ --> $DIR/self.rs:53:27
|
-51 | let _: Self = Self::V; //~ ERROR E0533
+53 | let _: Self = Self::V; //~ ERROR E0533
| ^^^^^^^
diff --git a/tests/ui/pinned_drop/unsafe-call.rs b/tests/ui/pinned_drop/unsafe-call.rs
index 7faf0fa..3ee2b56 100644
--- a/tests/ui/pinned_drop/unsafe-call.rs
+++ b/tests/ui/pinned_drop/unsafe-call.rs
@@ -1,6 +1,7 @@
-use pin_project::{pin_project, pinned_drop};
use std::pin::Pin;
+use pin_project::{pin_project, pinned_drop};
+
#[pin_project(PinnedDrop)]
struct S {
#[pin]
diff --git a/tests/ui/pinned_drop/unsafe-call.stderr b/tests/ui/pinned_drop/unsafe-call.stderr
index cd5e572..6216200 100644
--- a/tests/ui/pinned_drop/unsafe-call.stderr
+++ b/tests/ui/pinned_drop/unsafe-call.stderr
@@ -1,7 +1,7 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/unsafe-call.rs:13:9
+ --> $DIR/unsafe-call.rs:14:9
|
-13 | self.project().f.get_unchecked_mut(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block [E0133]
+14 | 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