diff options
author | Chih-Hung Hsieh <chh@google.com> | 2020-10-26 16:54:29 -0700 |
---|---|---|
committer | Chih-Hung Hsieh <chh@google.com> | 2020-10-26 16:57:40 -0700 |
commit | 127364b149c24623fd15786790a98af3b5355389 (patch) | |
tree | 55ba197683b0a0093a2767fcb1f576490157f8a1 /tests/ui | |
parent | c112e35face1579eba180108bda3da10b61d9926 (diff) | |
download | pin-project-127364b149c24623fd15786790a98af3b5355389.tar.gz |
Upgrade rust/crates/pin-project to 1.0.1
* Add missing patches, needed by external_updater
Test: make
Test: tools/external_updater/updater.sh update --refresh --keep_date rust/crates/pin-project
Change-Id: I3738561830ce97903036460713eb3b74700b889e
Diffstat (limited to 'tests/ui')
97 files changed, 547 insertions, 1606 deletions
diff --git a/tests/ui/cfg/cfg_attr-resolve.rs b/tests/ui/cfg/cfg_attr-resolve.rs index e16f3e8..c7a246a 100644 --- a/tests/ui/cfg/cfg_attr-resolve.rs +++ b/tests/ui/cfg/cfg_attr-resolve.rs @@ -2,10 +2,10 @@ use std::pin::Pin; #[cfg_attr(any(), pin_project::pin_project)] struct Foo<T> { - inner: T, + f: T, } fn main() { - let mut x = Foo { inner: 0_u8 }; + let mut x = Foo { f: 0_u8 }; let _x = Pin::new(&mut x).project(); //~ ERROR E0599 } diff --git a/tests/ui/cfg/cfg_attr-resolve.stderr b/tests/ui/cfg/cfg_attr-resolve.stderr index 45af3ae..ee1fa03 100644 --- a/tests/ui/cfg/cfg_attr-resolve.stderr +++ b/tests/ui/cfg/cfg_attr-resolve.stderr @@ -1,5 +1,5 @@ -error[E0599]: no method named `project` found for struct `std::pin::Pin<&mut Foo<u8>>` in the current scope +error[E0599]: no method named `project` found for struct `Pin<&mut Foo<u8>>` in the current scope --> $DIR/cfg_attr-resolve.rs:10:31 | 10 | let _x = Pin::new(&mut x).project(); //~ ERROR E0599 - | ^^^^^^^ method not found in `std::pin::Pin<&mut Foo<u8>>` + | ^^^^^^^ method not found in `Pin<&mut Foo<u8>>` diff --git a/tests/ui/cfg/cfg_attr-type-mismatch.rs b/tests/ui/cfg/cfg_attr-type-mismatch.rs index 2807c87..b075af9 100644 --- a/tests/ui/cfg/cfg_attr-type-mismatch.rs +++ b/tests/ui/cfg/cfg_attr-type-mismatch.rs @@ -4,21 +4,21 @@ use std::pin::Pin; #[cfg_attr(not(any()), pin_project)] struct Foo<T> { #[cfg_attr(any(), pin)] - inner: T, + f: T, } #[cfg_attr(not(any()), pin_project)] struct Bar<T> { #[cfg_attr(not(any()), pin)] - inner: T, + f: T, } fn main() { - let mut x = Foo { inner: 0_u8 }; + let mut x = Foo { f: 0_u8 }; let x = Pin::new(&mut x).project(); - let _: Pin<&mut u8> = x.inner; //~ ERROR E0308 + let _: Pin<&mut u8> = x.f; //~ ERROR E0308 - let mut x = Bar { inner: 0_u8 }; + let mut x = Bar { f: 0_u8 }; let x = Pin::new(&mut x).project(); - let _: &mut u8 = x.inner; //~ ERROR E0308 + let _: &mut u8 = x.f; //~ ERROR E0308 } diff --git a/tests/ui/cfg/cfg_attr-type-mismatch.stderr b/tests/ui/cfg/cfg_attr-type-mismatch.stderr index 2868299..89172a2 100644 --- a/tests/ui/cfg/cfg_attr-type-mismatch.stderr +++ b/tests/ui/cfg/cfg_attr-type-mismatch.stderr @@ -1,23 +1,23 @@ error[E0308]: mismatched types --> $DIR/cfg_attr-type-mismatch.rs:19:27 | -19 | let _: Pin<&mut u8> = x.inner; //~ ERROR E0308 - | ------------ ^^^^^^^ expected struct `std::pin::Pin`, found `&mut u8` +19 | let _: Pin<&mut u8> = x.f; //~ ERROR E0308 + | ------------ ^^^ expected struct `Pin`, found `&mut u8` | | | expected due to this | - = note: expected struct `std::pin::Pin<&mut u8>` + = note: expected struct `Pin<&mut u8>` found mutable reference `&mut u8` error[E0308]: mismatched types --> $DIR/cfg_attr-type-mismatch.rs:23:22 | -23 | let _: &mut u8 = x.inner; //~ ERROR E0308 - | ------- ^^^^^^^ +23 | let _: &mut u8 = x.f; //~ ERROR E0308 + | ------- ^^^ | | | - | | expected `&mut u8`, found struct `std::pin::Pin` - | | help: consider mutably borrowing here: `&mut x.inner` + | | expected `&mut u8`, found struct `Pin` + | | help: consider mutably borrowing here: `&mut x.f` | expected due to this | = note: expected mutable reference `&mut u8` - found struct `std::pin::Pin<&mut u8>` + found struct `Pin<&mut u8>` diff --git a/tests/ui/cfg/cfg_attr-unpin.rs b/tests/ui/cfg/cfg_attr-unpin.rs deleted file mode 100644 index 7b88205..0000000 --- a/tests/ui/cfg/cfg_attr-unpin.rs +++ /dev/null @@ -1,21 +0,0 @@ -use pin_project::pin_project; -use std::marker::PhantomPinned; - -#[cfg_attr(any(), pin_project)] -struct Foo<T> { - inner: T, -} - -#[cfg_attr(not(any()), pin_project)] -struct Bar<T> { - #[cfg_attr(not(any()), pin)] - inner: T, -} - -fn is_unpin<T: Unpin>() {} - -fn main() { - is_unpin::<Foo<PhantomPinned>>(); // ERROR E0277 - is_unpin::<Bar<()>>(); // Ok - is_unpin::<Bar<PhantomPinned>>(); //~ ERROR E0277 -} diff --git a/tests/ui/cfg/cfg_attr-unpin.stderr b/tests/ui/cfg/cfg_attr-unpin.stderr deleted file mode 100644 index 45789ff..0000000 --- a/tests/ui/cfg/cfg_attr-unpin.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/cfg_attr-unpin.rs:18:5 - | -15 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -18 | is_unpin::<Foo<PhantomPinned>>(); // ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `Foo<std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because it appears within the type `Foo<std::marker::PhantomPinned>` - -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/cfg_attr-unpin.rs:20:5 - | -15 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -20 | is_unpin::<Bar<PhantomPinned>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__Bar<'_, std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because it appears within the type `_::__Bar<'_, std::marker::PhantomPinned>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Bar<std::marker::PhantomPinned>` diff --git a/tests/ui/cfg/packed_sneaky-span-issue-1.rs b/tests/ui/cfg/packed_sneaky-span-issue-1.rs index 3776dac..8455d07 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-1.rs +++ b/tests/ui/cfg/packed_sneaky-span-issue-1.rs @@ -1,4 +1,4 @@ -use auxiliary_macros::hidden_repr; +use auxiliary_macro::hidden_repr; use pin_project::pin_project; //~ ERROR may not be used on #[repr(packed)] types @@ -6,13 +6,13 @@ use pin_project::pin_project; // Refs: https://github.com/rust-lang/rust/issues/43081 #[pin_project] #[hidden_repr(packed)] -struct Foo { +struct S { #[cfg(not(any()))] #[pin] - field: u32, + f: u32, #[cfg(any())] #[pin] - field: u8, + f: u8, } fn main() {} diff --git a/tests/ui/cfg/packed_sneaky-span-issue-2.rs b/tests/ui/cfg/packed_sneaky-span-issue-2.rs index aa65d33..01706ee 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-2.rs +++ b/tests/ui/cfg/packed_sneaky-span-issue-2.rs @@ -1,4 +1,4 @@ -use auxiliary_macros::hidden_repr; +use auxiliary_macro::hidden_repr; use pin_project::pin_project; //~ ERROR may not be used on #[repr(packed)] types @@ -6,13 +6,13 @@ use pin_project::pin_project; // Refs: https://github.com/rust-lang/rust/issues/43081 #[pin_project] #[hidden_repr(packed)] -struct Foo { +struct S { #[cfg(any())] #[pin] - field: u32, + f: u32, #[cfg(not(any()))] #[pin] - field: u8, + f: u8, } fn main() {} diff --git a/tests/ui/cfg/packed_sneaky.rs b/tests/ui/cfg/packed_sneaky.rs index 3305ed3..0b01dc9 100644 --- a/tests/ui/cfg/packed_sneaky.rs +++ b/tests/ui/cfg/packed_sneaky.rs @@ -1,12 +1,12 @@ -use auxiliary_macros::hidden_repr_cfg_not_any; +use auxiliary_macro::hidden_repr_cfg_not_any; use pin_project::pin_project; // `#[hidden_repr_cfg_not_any(packed)]` generates `#[cfg_attr(not(any()), repr(packed))]`. #[pin_project] #[hidden_repr_cfg_not_any(packed)] //~ ERROR may not be used on #[repr(packed)] types -struct Foo { +struct S { #[pin] - field: u32, + f: u32, } fn main() {} diff --git a/tests/ui/cfg/packed_sneaky.stderr b/tests/ui/cfg/packed_sneaky.stderr index 5910cf4..b0d4d93 100644 --- a/tests/ui/cfg/packed_sneaky.stderr +++ b/tests/ui/cfg/packed_sneaky.stderr @@ -1,7 +1,5 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky.rs:6:1 + --> $DIR/packed_sneaky.rs:6:27 | 6 | #[hidden_repr_cfg_not_any(packed)] //~ ERROR may not be used on #[repr(packed)] types - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^ diff --git a/tests/ui/cfg/proper_unpin.rs b/tests/ui/cfg/proper_unpin.rs deleted file mode 100644 index b7bb04d..0000000 --- a/tests/ui/cfg/proper_unpin.rs +++ /dev/null @@ -1,28 +0,0 @@ -use pin_project::pin_project; -use std::marker::PhantomPinned; - -#[pin_project] -struct Foo<T> { - #[cfg(any())] - #[pin] - inner: T, - #[cfg(not(any()))] - inner: T, -} - -#[pin_project] -struct Bar<T> { - #[cfg(any())] - inner: T, - #[cfg(not(any()))] - #[pin] - inner: T, -} - -fn is_unpin<T: Unpin>() {} - -fn main() { - is_unpin::<Foo<PhantomPinned>>(); // Ok - is_unpin::<Bar<()>>(); // Ok - is_unpin::<Bar<PhantomPinned>>(); //~ ERROR E0277 -} diff --git a/tests/ui/cfg/proper_unpin.stderr b/tests/ui/cfg/proper_unpin.stderr deleted file mode 100644 index f1fff34..0000000 --- a/tests/ui/cfg/proper_unpin.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/proper_unpin.rs:27:5 - | -22 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -27 | is_unpin::<Bar<PhantomPinned>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__Bar<'_, std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because it appears within the type `_::__Bar<'_, std::marker::PhantomPinned>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Bar<std::marker::PhantomPinned>` diff --git a/tests/ui/cfg/unsupported.rs b/tests/ui/cfg/unsupported.rs index 5205307..c450f6f 100644 --- a/tests/ui/cfg/unsupported.rs +++ b/tests/ui/cfg/unsupported.rs @@ -4,7 +4,7 @@ use pin_project::pin_project; // span is lost. // Refs: https://github.com/rust-lang/rust/issues/43081 #[pin_project] -struct Struct { +struct S { #[cfg(any())] #[pin] f: u8, diff --git a/tests/ui/not_unpin/assert-not-unpin.rs b/tests/ui/not_unpin/assert-not-unpin.rs deleted file mode 100644 index b8f8238..0000000 --- a/tests/ui/not_unpin/assert-not-unpin.rs +++ /dev/null @@ -1,40 +0,0 @@ -use pin_project::pin_project; -use std::marker::PhantomPinned; - -struct Inner<T> { - val: T, -} - -#[pin_project(!Unpin)] -struct Foo<T, U> { - #[pin] - inner: Inner<T>, - other: U, -} - -#[pin_project(!Unpin)] -struct TrivialBounds { - #[pin] - field1: PhantomPinned, -} - -#[pin_project(!Unpin)] -struct Bar<'a, T, U> { - #[pin] - inner: &'a mut Inner<T>, - other: U, -} - -fn is_unpin<T: Unpin>() {} - -fn main() { - is_unpin::<Foo<(), ()>>(); //~ ERROR E0277 - is_unpin::<Foo<PhantomPinned, ()>>(); //~ ERROR E0277 - is_unpin::<Foo<(), PhantomPinned>>(); //~ ERROR E0277 - is_unpin::<Foo<PhantomPinned, PhantomPinned>>(); //~ ERROR E0277 - - is_unpin::<TrivialBounds>(); //~ ERROR E0277 - - is_unpin::<Bar<'_, (), ()>>(); //~ ERROR E0277 - is_unpin::<Bar<'_, PhantomPinned, PhantomPinned>>(); //~ ERROR E0277 -} diff --git a/tests/ui/not_unpin/assert-not-unpin.stderr b/tests/ui/not_unpin/assert-not-unpin.stderr deleted file mode 100644 index 5e323fc..0000000 --- a/tests/ui/not_unpin/assert-not-unpin.stderr +++ /dev/null @@ -1,83 +0,0 @@ -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/assert-not-unpin.rs:31:5 - | -28 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -31 | is_unpin::<Foo<(), ()>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^ within `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because it appears within the type `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Foo<(), ()>` - -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/assert-not-unpin.rs:32:5 - | -28 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -32 | is_unpin::<Foo<PhantomPinned, ()>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because it appears within the type `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Foo<std::marker::PhantomPinned, ()>` - -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/assert-not-unpin.rs:33:5 - | -28 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -33 | is_unpin::<Foo<(), PhantomPinned>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because it appears within the type `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Foo<(), std::marker::PhantomPinned>` - -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/assert-not-unpin.rs:34:5 - | -28 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -34 | is_unpin::<Foo<PhantomPinned, PhantomPinned>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because it appears within the type `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Foo<std::marker::PhantomPinned, std::marker::PhantomPinned>` - -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/assert-not-unpin.rs:36:5 - | -28 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -36 | is_unpin::<TrivialBounds>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ within `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because it appears within the type `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `TrivialBounds` - -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/assert-not-unpin.rs:38:5 - | -28 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -38 | is_unpin::<Bar<'_, (), ()>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because it appears within the type `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Bar<'_, (), ()>` - -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/assert-not-unpin.rs:39:5 - | -28 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -39 | is_unpin::<Bar<'_, PhantomPinned, PhantomPinned>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because it appears within the type `pin_project::__private::Wrapper<'_, std::marker::PhantomPinned>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Bar<'_, std::marker::PhantomPinned, std::marker::PhantomPinned>` diff --git a/tests/ui/not_unpin/conflict-unpin.rs b/tests/ui/not_unpin/conflict-unpin.rs index f259f6c..8985f37 100644 --- a/tests/ui/not_unpin/conflict-unpin.rs +++ b/tests/ui/not_unpin/conflict-unpin.rs @@ -3,8 +3,8 @@ use pin_project::pin_project; #[pin_project(!Unpin)] //~ ERROR E0119 struct Foo<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } impl<T, U> Unpin for Foo<T, U> where T: Unpin {} @@ -12,8 +12,8 @@ impl<T, U> Unpin for Foo<T, U> where T: Unpin {} #[pin_project(!Unpin)] //~ ERROR E0119 struct Bar<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } impl<T, U> Unpin for Bar<T, U> {} @@ -21,8 +21,8 @@ impl<T, U> Unpin for Bar<T, U> {} #[pin_project(!Unpin)] //~ ERROR E0119 struct Baz<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} diff --git a/tests/ui/not_unpin/impl-unsafe-unpin.rs b/tests/ui/not_unpin/impl-unsafe-unpin.rs index 625dc29..2c078c7 100644 --- a/tests/ui/not_unpin/impl-unsafe-unpin.rs +++ b/tests/ui/not_unpin/impl-unsafe-unpin.rs @@ -3,8 +3,8 @@ use pin_project::{pin_project, UnsafeUnpin}; #[pin_project(!Unpin)] //~ ERROR E0119 struct Foo<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } unsafe impl<T, U> UnsafeUnpin for Foo<T, U> where T: Unpin {} @@ -12,8 +12,8 @@ unsafe impl<T, U> UnsafeUnpin for Foo<T, U> where T: Unpin {} #[pin_project(!Unpin)] //~ ERROR E0119 struct Bar<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } unsafe impl<T, U> UnsafeUnpin for Bar<T, U> {} @@ -21,8 +21,8 @@ unsafe impl<T, U> UnsafeUnpin for Bar<T, U> {} #[pin_project(!Unpin)] //~ ERROR E0119 struct Baz<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } unsafe impl<T: Unpin, U: Unpin> UnsafeUnpin for Baz<T, U> {} diff --git a/tests/ui/pin_project/add-attr-to-struct.rs b/tests/ui/pin_project/add-attr-to-struct.rs index f5364fc..55f1561 100644 --- a/tests/ui/pin_project/add-attr-to-struct.rs +++ b/tests/ui/pin_project/add-attr-to-struct.rs @@ -1,4 +1,4 @@ -use auxiliary_macros::add_pin_attr; +use auxiliary_macro::add_pin_attr; use pin_project::pin_project; use std::marker::PhantomPinned; @@ -6,14 +6,14 @@ use std::marker::PhantomPinned; #[add_pin_attr(struct)] //~ ERROR duplicate #[pin] attribute struct Foo { #[pin] - field: PhantomPinned, + f: PhantomPinned, } #[add_pin_attr(struct)] //~ ERROR #[pin] attribute may only be used on fields of structs or variants #[pin_project] struct Bar { #[pin] - field: PhantomPinned, + f: PhantomPinned, } fn main() {} diff --git a/tests/ui/pin_project/add-pinned-field.rs b/tests/ui/pin_project/add-pinned-field.rs index 76394cf..c415f9c 100644 --- a/tests/ui/pin_project/add-pinned-field.rs +++ b/tests/ui/pin_project/add-pinned-field.rs @@ -1,4 +1,4 @@ -use auxiliary_macros::add_pinned_field; +use auxiliary_macro::add_pinned_field; use pin_project::pin_project; fn is_unpin<T: Unpin>() {} @@ -7,14 +7,14 @@ fn is_unpin<T: Unpin>() {} #[add_pinned_field] struct Foo { #[pin] - field: u32, + f: u32, } #[add_pinned_field] #[pin_project] struct Bar { #[pin] - field: u32, + f: u32, } fn main() { diff --git a/tests/ui/pin_project/add-pinned-field.stderr b/tests/ui/pin_project/add-pinned-field.stderr index d6a1dcd..a140694 100644 --- a/tests/ui/pin_project/add-pinned-field.stderr +++ b/tests/ui/pin_project/add-pinned-field.stderr @@ -1,23 +1,23 @@ -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned +error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/add-pinned-field.rs:21:5 | 4 | fn is_unpin<T: Unpin>() {} | ----- required by this bound in `is_unpin` ... 21 | is_unpin::<Foo>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^ within `_::__Foo<'_>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | ^^^^^^^^^^^^^^^ within `__Foo<'_>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `_::__Foo<'_>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Foo` + = note: required because it appears within the type `__Foo<'_>` + = note: required because of the requirements on the impl of `Unpin` for `Foo` -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned +error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/add-pinned-field.rs:22:5 | 4 | fn is_unpin<T: Unpin>() {} | ----- required by this bound in `is_unpin` ... 22 | is_unpin::<Bar>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^ within `_::__Bar<'_>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | ^^^^^^^^^^^^^^^ within `__Bar<'_>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `_::__Bar<'_>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Bar` + = note: required because it appears within the type `__Bar<'_>` + = note: required because of the requirements on the impl of `Unpin` for `Bar` diff --git a/tests/ui/pin_project/conflict-drop.rs b/tests/ui/pin_project/conflict-drop.rs index c965184..908f5c0 100644 --- a/tests/ui/pin_project/conflict-drop.rs +++ b/tests/ui/pin_project/conflict-drop.rs @@ -4,8 +4,8 @@ use std::pin::Pin; #[pin_project] //~ ERROR E0119 struct Foo<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } impl<T, U> Drop for Foo<T, U> { @@ -15,8 +15,8 @@ impl<T, U> Drop for Foo<T, U> { #[pin_project(PinnedDrop)] //~ ERROR E0119 struct Bar<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } #[pinned_drop] diff --git a/tests/ui/pin_project/conflict-unpin.rs b/tests/ui/pin_project/conflict-unpin.rs index 0c48d27..f58c45e 100644 --- a/tests/ui/pin_project/conflict-unpin.rs +++ b/tests/ui/pin_project/conflict-unpin.rs @@ -5,8 +5,8 @@ use pin_project::pin_project; #[pin_project] //~ ERROR E0119 struct Foo<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } // conflicting implementations @@ -17,8 +17,8 @@ impl<T, U> Unpin for Foo<T, U> where T: Unpin {} // Conditional Unpin impl #[pin_project] //~ ERROR E0119 struct Bar<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } // conflicting implementations @@ -27,8 +27,8 @@ impl<T, U> Unpin for Bar<T, U> {} // Non-conditional Unpin impl #[pin_project] //~ ERROR E0119 struct Baz<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } // conflicting implementations diff --git a/tests/ui/pin_project/impl-unsafe-unpin.rs b/tests/ui/pin_project/impl-unsafe-unpin.rs index 94af322..562c9b6 100644 --- a/tests/ui/pin_project/impl-unsafe-unpin.rs +++ b/tests/ui/pin_project/impl-unsafe-unpin.rs @@ -3,8 +3,8 @@ use pin_project::{pin_project, UnsafeUnpin}; #[pin_project] //~ ERROR E0119 struct Foo<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } unsafe impl<T, U> UnsafeUnpin for Foo<T, U> where T: Unpin {} @@ -12,8 +12,8 @@ unsafe impl<T, U> UnsafeUnpin for Foo<T, U> where T: Unpin {} #[pin_project] //~ ERROR E0119 struct Bar<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } unsafe impl<T, U> UnsafeUnpin for Bar<T, U> {} @@ -21,8 +21,8 @@ unsafe impl<T, U> UnsafeUnpin for Bar<T, U> {} #[pin_project] //~ ERROR E0119 struct Baz<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } unsafe impl<T: Unpin, U: Unpin> UnsafeUnpin for Baz<T, U> {} diff --git a/tests/ui/pin_project/import_unnamed.rs b/tests/ui/pin_project/import_unnamed.rs new file mode 100644 index 0000000..7926e61 --- /dev/null +++ b/tests/ui/pin_project/import_unnamed.rs @@ -0,0 +1,30 @@ +/// Only named projected types can be imported. +/// See visibility.rs for named projected types. + +mod pub_ { + use pin_project::pin_project; + + #[pin_project] + pub struct Default(()); + + #[pin_project(project_replace)] + pub struct Replace(()); +} +#[allow(unused_imports)] +pub mod use_ { + #[rustfmt::skip] + use crate::pub_::__DefaultProjection; //~ ERROR E0432 + #[rustfmt::skip] + use crate::pub_::__DefaultProjectionRef; //~ ERROR E0432 + #[rustfmt::skip] + use crate::pub_::__ReplaceProjection; //~ ERROR E0432 + #[rustfmt::skip] + use crate::pub_::__ReplaceProjectionOwned; //~ ERROR E0432 + #[rustfmt::skip] + use crate::pub_::__ReplaceProjectionRef; //~ ERROR E0432 + + // Confirm that the visibility of the original type is not changed. + pub use crate::pub_::{Default, Replace}; +} + +fn main() {} diff --git a/tests/ui/pin_project/import_unnamed.stderr b/tests/ui/pin_project/import_unnamed.stderr new file mode 100644 index 0000000..f54e4c4 --- /dev/null +++ b/tests/ui/pin_project/import_unnamed.stderr @@ -0,0 +1,29 @@ +error[E0432]: unresolved import `crate::pub_::__DefaultProjection` + --> $DIR/import_unnamed.rs:16:9 + | +16 | use crate::pub_::__DefaultProjection; //~ ERROR E0432 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__DefaultProjection` in `pub_` + +error[E0432]: unresolved import `crate::pub_::__DefaultProjectionRef` + --> $DIR/import_unnamed.rs:18:9 + | +18 | use crate::pub_::__DefaultProjectionRef; //~ ERROR E0432 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__DefaultProjectionRef` in `pub_` + +error[E0432]: unresolved import `crate::pub_::__ReplaceProjection` + --> $DIR/import_unnamed.rs:20:9 + | +20 | use crate::pub_::__ReplaceProjection; //~ ERROR E0432 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__ReplaceProjection` in `pub_` + +error[E0432]: unresolved import `crate::pub_::__ReplaceProjectionOwned` + --> $DIR/import_unnamed.rs:22:9 + | +22 | use crate::pub_::__ReplaceProjectionOwned; //~ ERROR E0432 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__ReplaceProjectionOwned` in `pub_` + +error[E0432]: unresolved import `crate::pub_::__ReplaceProjectionRef` + --> $DIR/import_unnamed.rs:24:9 + | +24 | use crate::pub_::__ReplaceProjectionRef; //~ ERROR E0432 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__ReplaceProjectionRef` in `pub_` diff --git a/tests/ui/pin_project/invalid.rs b/tests/ui/pin_project/invalid.rs index 9c51bec..d39a1fd 100644 --- a/tests/ui/pin_project/invalid.rs +++ b/tests/ui/pin_project/invalid.rs @@ -4,7 +4,7 @@ mod pin_argument { #[pin_project] struct Struct { #[pin()] //~ ERROR unexpected token - field: (), + f: (), } #[pin_project] @@ -19,7 +19,7 @@ mod pin_argument { enum EnumStruct { V { #[pin(foo)] //~ ERROR unexpected token - field: (), + f: (), }, } } @@ -31,7 +31,7 @@ mod pin_attribute { struct DuplicateStruct { #[pin] #[pin] //~ ERROR duplicate #[pin] attribute - field: (), + f: (), } #[pin_project] @@ -57,7 +57,7 @@ mod pin_attribute { V { #[pin] #[pin] //~ ERROR duplicate #[pin] attribute - field: (), + f: (), }, } } @@ -69,7 +69,7 @@ mod pin_item { #[pin] //~ ERROR may only be used on fields of structs or variants struct Struct { #[pin] - field: (), + f: (), } #[pin_project] @@ -88,6 +88,9 @@ mod pin_item { mod pin_project_argument { use pin_project::pin_project; + #[pin_project(Replace)] //~ ERROR `Replace` argument was removed, use `project_replace` argument instead + struct RemovedReplace(#[pin] ()); + #[pin_project(UnsafeUnpin,,)] //~ ERROR expected identifier struct Unexpected1(#[pin] ()); @@ -106,9 +109,6 @@ mod pin_project_argument { #[pin_project(PinnedDrop, PinnedDrop)] //~ ERROR duplicate `PinnedDrop` argument struct DuplicatePinnedDrop(#[pin] ()); - #[pin_project(Replace, Replace)] //~ ERROR duplicate `Replace` argument - struct DuplicateReplace(#[pin] ()); - #[pin_project(UnsafeUnpin, UnsafeUnpin)] //~ ERROR duplicate `UnsafeUnpin` argument struct DuplicateUnsafeUnpin(#[pin] ()); @@ -142,24 +142,12 @@ mod pin_project_argument { #[pin_project(project_replace = A)] // Ok struct ProjectReplaceWithoutReplace(#[pin] ()); - #[pin_project(PinnedDrop, Replace)] //~ ERROR arguments `PinnedDrop` and `Replace` are mutually exclusive - struct PinnedDropWithReplace1(#[pin] ()); - - #[pin_project(Replace, UnsafeUnpin, PinnedDrop)] //~ ERROR arguments `PinnedDrop` and `Replace` are mutually exclusive - struct PinnedDropWithReplace2(#[pin] ()); - #[pin_project(PinnedDrop, project_replace)] //~ ERROR arguments `PinnedDrop` and `project_replace` are mutually exclusive struct PinnedDropWithProjectReplace1(#[pin] ()); #[pin_project(project_replace, UnsafeUnpin, PinnedDrop)] //~ ERROR arguments `PinnedDrop` and `project_replace` are mutually exclusive struct PinnedDropWithProjectReplace2(#[pin] ()); - #[pin_project(project_replace, Replace)] // Ok - struct ProjectReplaceWithReplace1(#[pin] ()); - - #[pin_project(project_replace = B, Replace)] // Ok - struct ProjectReplaceWithReplace2(#[pin] ()); - #[pin_project(UnsafeUnpin, !Unpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive struct UnsafeUnpinWithNotUnpin1(#[pin] ()); @@ -198,11 +186,25 @@ mod pin_project_argument { #[pin_project(project_replace = !)] //~ ERROR expected identifier struct ProjectReplace3(#[pin] ()); + + #[pin_project(project_replace)] //~ ERROR `project_replace` argument requires a value when used on enums + enum ProjectReplaceEnum { + V(#[pin] ()), + } } mod pin_project_conflict_naming { use pin_project::pin_project; + #[pin_project(project = OrigAndProj)] //~ ERROR name `OrigAndProj` is the same as the original type name + struct OrigAndProj(#[pin] ()); + + #[pin_project(project_ref = OrigAndProjRef)] //~ ERROR name `OrigAndProjRef` is the same as the original type name + struct OrigAndProjRef(#[pin] ()); + + #[pin_project(project_replace = OrigAndProjOwn)] //~ ERROR name `OrigAndProjOwn` is the same as the original type name + struct OrigAndProjOwn(#[pin] ()); + #[pin_project(project = A, project_ref = A)] //~ ERROR name `A` is already specified by `project` argument struct ProjAndProjRef(#[pin] ()); @@ -253,6 +255,9 @@ mod pin_project_item { //~^ ERROR may only be used on structs or enums f: (), } + + #[pin_project] + impl Impl {} //~ ERROR may only be used on structs or enums } // #[repr(packed)] is always detected first, even on unsupported structs. diff --git a/tests/ui/pin_project/invalid.stderr b/tests/ui/pin_project/invalid.stderr index 3c6af57..35552bf 100644 --- a/tests/ui/pin_project/invalid.stderr +++ b/tests/ui/pin_project/invalid.stderr @@ -64,42 +64,42 @@ error: #[pin] attribute may only be used on fields of structs or variants 82 | #[pin] //~ ERROR may only be used on fields of structs or variants | ^^^^^^ +error: `Replace` argument was removed, use `project_replace` argument instead + --> $DIR/invalid.rs:91:19 + | +91 | #[pin_project(Replace)] //~ ERROR `Replace` argument was removed, use `project_replace` argument instead + | ^^^^^^^ + error: expected identifier - --> $DIR/invalid.rs:91:31 + --> $DIR/invalid.rs:94:31 | -91 | #[pin_project(UnsafeUnpin,,)] //~ ERROR expected identifier +94 | #[pin_project(UnsafeUnpin,,)] //~ ERROR expected identifier | ^ error: unexpected argument: Foo - --> $DIR/invalid.rs:94:19 + --> $DIR/invalid.rs:97:19 | -94 | #[pin_project(Foo)] //~ ERROR unexpected argument +97 | #[pin_project(Foo)] //~ ERROR unexpected argument | ^^^ error: expected identifier - --> $DIR/invalid.rs:97:19 - | -97 | #[pin_project(,UnsafeUnpin)] //~ ERROR expected identifier - | ^ + --> $DIR/invalid.rs:100:19 + | +100 | #[pin_project(,UnsafeUnpin)] //~ ERROR expected identifier + | ^ error: expected `,` - --> $DIR/invalid.rs:103:30 + --> $DIR/invalid.rs:106:30 | -103 | #[pin_project(PinnedDrop PinnedDrop)] //~ ERROR expected `,` +106 | #[pin_project(PinnedDrop PinnedDrop)] //~ ERROR expected `,` | ^^^^^^^^^^ error: duplicate `PinnedDrop` argument - --> $DIR/invalid.rs:106:31 + --> $DIR/invalid.rs:109:31 | -106 | #[pin_project(PinnedDrop, PinnedDrop)] //~ ERROR duplicate `PinnedDrop` argument +109 | #[pin_project(PinnedDrop, PinnedDrop)] //~ ERROR duplicate `PinnedDrop` argument | ^^^^^^^^^^ -error: duplicate `Replace` argument - --> $DIR/invalid.rs:109:28 - | -109 | #[pin_project(Replace, Replace)] //~ ERROR duplicate `Replace` argument - | ^^^^^^^ - error: duplicate `UnsafeUnpin` argument --> $DIR/invalid.rs:112:32 | @@ -160,187 +160,205 @@ error: duplicate `project_replace` argument 139 | #[pin_project(project_replace = A, project_replace)] //~ ERROR duplicate `project_replace` argument | ^^^^^^^^^^^^^^^ -error: arguments `PinnedDrop` and `Replace` are mutually exclusive - --> $DIR/invalid.rs:145:19 - | -145 | #[pin_project(PinnedDrop, Replace)] //~ ERROR arguments `PinnedDrop` and `Replace` are mutually exclusive - | ^^^^^^^^^^ - -error: arguments `PinnedDrop` and `Replace` are mutually exclusive - --> $DIR/invalid.rs:148:41 - | -148 | #[pin_project(Replace, UnsafeUnpin, PinnedDrop)] //~ ERROR arguments `PinnedDrop` and `Replace` are mutually exclusive - | ^^^^^^^^^^ - error: arguments `PinnedDrop` and `project_replace` are mutually exclusive - --> $DIR/invalid.rs:151:19 + --> $DIR/invalid.rs:145:19 | -151 | #[pin_project(PinnedDrop, project_replace)] //~ ERROR arguments `PinnedDrop` and `project_replace` are mutually exclusive +145 | #[pin_project(PinnedDrop, project_replace)] //~ ERROR arguments `PinnedDrop` and `project_replace` are mutually exclusive | ^^^^^^^^^^ error: arguments `PinnedDrop` and `project_replace` are mutually exclusive - --> $DIR/invalid.rs:154:49 + --> $DIR/invalid.rs:148:49 | -154 | #[pin_project(project_replace, UnsafeUnpin, PinnedDrop)] //~ ERROR arguments `PinnedDrop` and `project_replace` are mutually exclusive +148 | #[pin_project(project_replace, UnsafeUnpin, PinnedDrop)] //~ ERROR arguments `PinnedDrop` and `project_replace` are mutually exclusive | ^^^^^^^^^^ error: arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive - --> $DIR/invalid.rs:163:19 + --> $DIR/invalid.rs:151:19 | -163 | #[pin_project(UnsafeUnpin, !Unpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive +151 | #[pin_project(UnsafeUnpin, !Unpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive | ^^^^^^^^^^^ error: arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive - --> $DIR/invalid.rs:166:39 + --> $DIR/invalid.rs:154:39 | -166 | #[pin_project(!Unpin, PinnedDrop, UnsafeUnpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive +154 | #[pin_project(!Unpin, PinnedDrop, UnsafeUnpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive | ^^^^^^^^^^^ error: expected `!Unpin`, found `!` - --> $DIR/invalid.rs:169:19 + --> $DIR/invalid.rs:157:19 | -169 | #[pin_project(!)] //~ ERROR expected `!Unpin`, found `!` +157 | #[pin_project(!)] //~ ERROR expected `!Unpin`, found `!` | ^ error: unexpected argument: Unpin - --> $DIR/invalid.rs:172:19 + --> $DIR/invalid.rs:160:19 | -172 | #[pin_project(Unpin)] //~ ERROR unexpected argument +160 | #[pin_project(Unpin)] //~ ERROR unexpected argument | ^^^^^ error: expected `project = <identifier>`, found `project` - --> $DIR/invalid.rs:175:19 + --> $DIR/invalid.rs:163:19 | -175 | #[pin_project(project)] //~ ERROR expected `project = <identifier>`, found `project` +163 | #[pin_project(project)] //~ ERROR expected `project = <identifier>`, found `project` | ^^^^^^^ error: expected `project = <identifier>`, found `project =` - --> $DIR/invalid.rs:178:19 + --> $DIR/invalid.rs:166:19 | -178 | #[pin_project(project = )] //~ ERROR expected `project = <identifier>`, found `project =` +166 | #[pin_project(project = )] //~ ERROR expected `project = <identifier>`, found `project =` | ^^^^^^^^^ error: expected identifier - --> $DIR/invalid.rs:181:29 + --> $DIR/invalid.rs:169:29 | -181 | #[pin_project(project = !)] //~ ERROR expected identifier +169 | #[pin_project(project = !)] //~ ERROR expected identifier | ^ error: expected `project_ref = <identifier>`, found `project_ref` - --> $DIR/invalid.rs:184:19 + --> $DIR/invalid.rs:172:19 | -184 | #[pin_project(project_ref)] //~ ERROR expected `project_ref = <identifier>`, found `project_ref` +172 | #[pin_project(project_ref)] //~ ERROR expected `project_ref = <identifier>`, found `project_ref` | ^^^^^^^^^^^ error: expected `project_ref = <identifier>`, found `project_ref =` - --> $DIR/invalid.rs:187:19 + --> $DIR/invalid.rs:175:19 | -187 | #[pin_project(project_ref = )] //~ ERROR expected `project_ref = <identifier>`, found `project_ref =` +175 | #[pin_project(project_ref = )] //~ ERROR expected `project_ref = <identifier>`, found `project_ref =` | ^^^^^^^^^^^^^ error: expected identifier - --> $DIR/invalid.rs:190:33 + --> $DIR/invalid.rs:178:33 | -190 | #[pin_project(project_ref = !)] //~ ERROR expected identifier +178 | #[pin_project(project_ref = !)] //~ ERROR expected identifier | ^ error: expected `project_replace = <identifier>`, found `project_replace =` - --> $DIR/invalid.rs:196:19 + --> $DIR/invalid.rs:184:19 | -196 | #[pin_project(project_replace = )] //~ ERROR expected `project_replace = <identifier>`, found `project_replace =` +184 | #[pin_project(project_replace = )] //~ ERROR expected `project_replace = <identifier>`, found `project_replace =` | ^^^^^^^^^^^^^^^^^ error: expected identifier - --> $DIR/invalid.rs:199:37 + --> $DIR/invalid.rs:187:37 | -199 | #[pin_project(project_replace = !)] //~ ERROR expected identifier +187 | #[pin_project(project_replace = !)] //~ ERROR expected identifier | ^ +error: `project_replace` argument requires a value when used on enums + --> $DIR/invalid.rs:190:19 + | +190 | #[pin_project(project_replace)] //~ ERROR `project_replace` argument requires a value when used on enums + | ^^^^^^^^^^^^^^^ + +error: name `OrigAndProj` is the same as the original type name + --> $DIR/invalid.rs:199:29 + | +199 | #[pin_project(project = OrigAndProj)] //~ ERROR name `OrigAndProj` is the same as the original type name + | ^^^^^^^^^^^ + +error: name `OrigAndProjRef` is the same as the original type name + --> $DIR/invalid.rs:202:33 + | +202 | #[pin_project(project_ref = OrigAndProjRef)] //~ ERROR name `OrigAndProjRef` is the same as the original type name + | ^^^^^^^^^^^^^^ + +error: name `OrigAndProjOwn` is the same as the original type name + --> $DIR/invalid.rs:205:37 + | +205 | #[pin_project(project_replace = OrigAndProjOwn)] //~ ERROR name `OrigAndProjOwn` is the same as the original type name + | ^^^^^^^^^^^^^^ + error: name `A` is already specified by `project` argument - --> $DIR/invalid.rs:206:46 + --> $DIR/invalid.rs:208:46 | -206 | #[pin_project(project = A, project_ref = A)] //~ ERROR name `A` is already specified by `project` argument +208 | #[pin_project(project = A, project_ref = A)] //~ ERROR name `A` is already specified by `project` argument | ^ error: name `A` is already specified by `project` argument - --> $DIR/invalid.rs:209:50 + --> $DIR/invalid.rs:211:50 | -209 | #[pin_project(project = A, project_replace = A)] //~ ERROR name `A` is already specified by `project` argument +211 | #[pin_project(project = A, project_replace = A)] //~ ERROR name `A` is already specified by `project` argument | ^ error: name `A` is already specified by `project_ref` argument - --> $DIR/invalid.rs:212:54 + --> $DIR/invalid.rs:214:54 | -212 | #[pin_project(project_ref = A, project_replace = A)] //~ ERROR name `A` is already specified by `project_ref` argument +214 | #[pin_project(project_ref = A, project_replace = A)] //~ ERROR name `A` is already specified by `project_ref` argument | ^ error: duplicate #[pin_project] attribute - --> $DIR/invalid.rs:220:5 + --> $DIR/invalid.rs:222:5 | -220 | #[pin_project] //~ ERROR duplicate #[pin_project] attribute +222 | #[pin_project] //~ ERROR duplicate #[pin_project] attribute | ^^^^^^^^^^^^^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> $DIR/invalid.rs:228:19 + --> $DIR/invalid.rs:230:19 | -228 | struct Struct {} //~ ERROR may not be used on structs with zero fields +230 | struct Struct {} //~ ERROR may not be used on structs with zero fields | ^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> $DIR/invalid.rs:231:23 + --> $DIR/invalid.rs:233:23 | -231 | struct TupleStruct(); //~ ERROR may not be used on structs with zero fields +233 | struct TupleStruct(); //~ ERROR may not be used on structs with zero fields | ^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> $DIR/invalid.rs:234:12 + --> $DIR/invalid.rs:236:12 | -234 | struct UnitStruct; //~ ERROR may not be used on structs with zero fields +236 | struct UnitStruct; //~ ERROR may not be used on structs with zero fields | ^^^^^^^^^^ error: #[pin_project] attribute may not be used on enums without variants - --> $DIR/invalid.rs:237:20 + --> $DIR/invalid.rs:239:20 | -237 | enum EnumEmpty {} //~ ERROR may not be used on enums without variants +239 | enum EnumEmpty {} //~ ERROR may not be used on enums without variants | ^^ error: #[pin_project] attribute may not be used on enums with discriminants - --> $DIR/invalid.rs:241:13 + --> $DIR/invalid.rs:243:13 | -241 | V = 2, //~ ERROR may not be used on enums with discriminants +243 | V = 2, //~ ERROR may not be used on enums with discriminants | ^ error: #[pin_project] attribute may not be used on enums with zero fields - --> $DIR/invalid.rs:246:9 + --> $DIR/invalid.rs:248:9 | -246 | / Unit, //~ ERROR may not be used on enums with zero fields -247 | | Tuple(), -248 | | Struct {}, +248 | / Unit, //~ ERROR may not be used on enums with zero fields +249 | | Tuple(), +250 | | Struct {}, | |__________________^ error: #[pin_project] attribute may only be used on structs or enums - --> $DIR/invalid.rs:252:5 + --> $DIR/invalid.rs:254:5 | -252 | / union Union { -253 | | //~^ ERROR may only be used on structs or enums -254 | | f: (), -255 | | } +254 | / union Union { +255 | | //~^ ERROR may only be used on structs or enums +256 | | f: (), +257 | | } | |_____^ +error: #[pin_project] attribute may only be used on structs or enums + --> $DIR/invalid.rs:260:5 + | +260 | impl Impl {} //~ ERROR may only be used on structs or enums + | ^^^^^^^^^^^^ + error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/invalid.rs:263:12 + --> $DIR/invalid.rs:268:12 | -263 | #[repr(packed)] +268 | #[repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/invalid.rs:267:12 + --> $DIR/invalid.rs:272:12 | -267 | #[repr(packed)] +272 | #[repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/invalid.rs:271:12 + --> $DIR/invalid.rs:276:12 | -271 | #[repr(packed)] +276 | #[repr(packed)] | ^^^^^^ diff --git a/tests/ui/pin_project/overlapping_unpin_struct.rs b/tests/ui/pin_project/overlapping_unpin_struct.rs index 00fef3c..8db0855 100644 --- a/tests/ui/pin_project/overlapping_unpin_struct.rs +++ b/tests/ui/pin_project/overlapping_unpin_struct.rs @@ -2,17 +2,17 @@ use pin_project::pin_project; use std::marker::PhantomPinned; #[pin_project] -struct Foo<T> { +struct S<T> { #[pin] - inner: T, + f: T, } -struct __Foo {} +struct __S {} -impl Unpin for __Foo {} +impl Unpin for __S {} fn is_unpin<T: Unpin>() {} fn main() { - is_unpin::<Foo<PhantomPinned>>(); //~ ERROR E0277 + is_unpin::<S<PhantomPinned>>(); //~ ERROR E0277 } diff --git a/tests/ui/pin_project/overlapping_unpin_struct.stderr b/tests/ui/pin_project/overlapping_unpin_struct.stderr index 96a9f51..296b063 100644 --- a/tests/ui/pin_project/overlapping_unpin_struct.stderr +++ b/tests/ui/pin_project/overlapping_unpin_struct.stderr @@ -1,11 +1,11 @@ -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned +error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/overlapping_unpin_struct.rs:17:5 | 14 | fn is_unpin<T: Unpin>() {} | ----- required by this bound in `is_unpin` ... -17 | is_unpin::<Foo<PhantomPinned>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__Foo<'_, std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` +17 | is_unpin::<S<PhantomPinned>>(); //~ ERROR E0277 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__S<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `_::__Foo<'_, std::marker::PhantomPinned>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Foo<std::marker::PhantomPinned>` + = note: required because it appears within the type `_::__S<'_, PhantomPinned>` + = note: required because of the requirements on the impl of `Unpin` for `S<PhantomPinned>` diff --git a/tests/ui/pin_project/packed.rs b/tests/ui/pin_project/packed.rs index 86f3ecf..f756605 100644 --- a/tests/ui/pin_project/packed.rs +++ b/tests/ui/pin_project/packed.rs @@ -4,7 +4,7 @@ use pin_project::pin_project; #[repr(packed, C)] //~ ERROR may not be used on #[repr(packed)] types struct A { #[pin] - field: u8, + f: u8, } // Test putting 'repr' before the 'pin_project' attribute @@ -12,14 +12,14 @@ struct A { #[pin_project] struct B { #[pin] - field: u8, + f: u8, } #[pin_project] #[repr(packed(2))] //~ ERROR may not be used on #[repr(packed)] types struct C { #[pin] - field: u32, + f: u32, } fn main() {} diff --git a/tests/ui/pin_project/packed_sneaky-1.rs b/tests/ui/pin_project/packed_sneaky-1.rs index dcf5464..38f6fe0 100644 --- a/tests/ui/pin_project/packed_sneaky-1.rs +++ b/tests/ui/pin_project/packed_sneaky-1.rs @@ -1,4 +1,4 @@ -use auxiliary_macros::hidden_repr; +use auxiliary_macro::hidden_repr; use pin_project::{pin_project, pinned_drop, UnsafeUnpin}; use std::pin::Pin; @@ -6,14 +6,14 @@ use std::pin::Pin; #[hidden_repr(packed)] struct A { #[pin] - field: u32, + f: u32, } #[pin_project(UnsafeUnpin)] //~ ERROR may not be used on #[repr(packed)] types #[hidden_repr(packed)] struct C { #[pin] - field: u32, + f: u32, } unsafe impl UnsafeUnpin for C {} @@ -22,7 +22,7 @@ unsafe impl UnsafeUnpin for C {} #[hidden_repr(packed)] struct D { #[pin] - field: u32, + f: u32, } #[pinned_drop] diff --git a/tests/ui/pin_project/packed_sneaky-1.stderr b/tests/ui/pin_project/packed_sneaky-1.stderr index 06a4f62..510200e 100644 --- a/tests/ui/pin_project/packed_sneaky-1.stderr +++ b/tests/ui/pin_project/packed_sneaky-1.stderr @@ -1,23 +1,17 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-1.rs:6:1 + --> $DIR/packed_sneaky-1.rs:6:15 | 6 | #[hidden_repr(packed)] - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-1.rs:13:1 + --> $DIR/packed_sneaky-1.rs:13:15 | 13 | #[hidden_repr(packed)] - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-1.rs:22:1 + --> $DIR/packed_sneaky-1.rs:22:15 | 22 | #[hidden_repr(packed)] - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^^^^ diff --git a/tests/ui/pin_project/packed_sneaky-2.rs b/tests/ui/pin_project/packed_sneaky-2.rs index d162706..b098358 100644 --- a/tests/ui/pin_project/packed_sneaky-2.rs +++ b/tests/ui/pin_project/packed_sneaky-2.rs @@ -1,11 +1,11 @@ -use auxiliary_macros::hidden_repr_macro; +use auxiliary_macro::hidden_repr_macro; use pin_project::pin_project; hidden_repr_macro! { //~ ERROR may not be used on #[repr(packed)] types #[pin_project] struct B { #[pin] - field: u32, + f: u32, } } diff --git a/tests/ui/pin_project/packed_sneaky-2.stderr b/tests/ui/pin_project/packed_sneaky-2.stderr index d653a4d..51987a2 100644 --- a/tests/ui/pin_project/packed_sneaky-2.stderr +++ b/tests/ui/pin_project/packed_sneaky-2.stderr @@ -5,7 +5,7 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types 5 | | #[pin_project] 6 | | struct B { 7 | | #[pin] -8 | | field: u32, +8 | | f: u32, 9 | | } 10 | | } | |_^ diff --git a/tests/ui/pin_project/packed_sneaky-3.rs b/tests/ui/pin_project/packed_sneaky-3.rs new file mode 100644 index 0000000..d3f00f3 --- /dev/null +++ b/tests/ui/pin_project/packed_sneaky-3.rs @@ -0,0 +1,32 @@ +use auxiliary_macro::{hidden_repr_macro, HiddenRepr}; +use pin_project::pin_project; + +hidden_repr_macro! {} //~ ERROR expected item after attributes +#[pin_project] +struct S1 { + #[pin] + f: u32, +} + +macro_rules! hidden_repr_macro2 { + () => { + #[repr(packed)] //~ ERROR expected item after attributes + }; +} + +hidden_repr_macro2! {} +#[pin_project] +struct S2 { + #[pin] + f: u32, +} + +#[derive(HiddenRepr)] //~ ERROR expected item after attributes +struct S3 {} +#[pin_project] +struct S4 { + #[pin] + f: u32, +} + +fn main() {} diff --git a/tests/ui/pin_project/packed_sneaky-3.stderr b/tests/ui/pin_project/packed_sneaky-3.stderr new file mode 100644 index 0000000..b711d05 --- /dev/null +++ b/tests/ui/pin_project/packed_sneaky-3.stderr @@ -0,0 +1,30 @@ +error: expected item after attributes + --> $DIR/packed_sneaky-3.rs:4:1 + | +4 | hidden_repr_macro! {} //~ ERROR expected item after attributes + | ^^^^^^^^^^^^^^^^^^^^^ + +error: expected item after attributes + --> $DIR/packed_sneaky-3.rs:13:9 + | +13 | #[repr(packed)] //~ ERROR expected item after attributes + | ^^^^^^^^^^^^^^^ +... +17 | hidden_repr_macro2! {} + | ---------------------- in this macro invocation + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected item after attributes + --> $DIR/packed_sneaky-3.rs:24:10 + | +24 | #[derive(HiddenRepr)] //~ ERROR expected item after attributes + | ^^^^^^^^^^ + | + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: proc-macro derive produced unparseable tokens + --> $DIR/packed_sneaky-3.rs:24:10 + | +24 | #[derive(HiddenRepr)] //~ ERROR expected item after attributes + | ^^^^^^^^^^ diff --git a/tests/ui/pin_project/private_in_public-enum.rs b/tests/ui/pin_project/private_in_public-enum.rs index cbffa20..15a82a9 100644 --- a/tests/ui/pin_project/private_in_public-enum.rs +++ b/tests/ui/pin_project/private_in_public-enum.rs @@ -3,20 +3,20 @@ #![allow(private_in_public)] pub enum PublicEnum { - Variant(PrivateEnum), //~ ERROR E0446 + V(PrivateEnum), //~ ERROR E0446 } enum PrivateEnum { - Variant(u8), + V(u8), } mod foo { pub(crate) enum CrateEnum { - Variant(PrivateEnum), //~ ERROR E0446 + V(PrivateEnum), //~ ERROR E0446 } enum PrivateEnum { - Variant(u8), + V(u8), } } diff --git a/tests/ui/pin_project/private_in_public-enum.stderr b/tests/ui/pin_project/private_in_public-enum.stderr index 6f2988f..a14756b 100644 --- a/tests/ui/pin_project/private_in_public-enum.stderr +++ b/tests/ui/pin_project/private_in_public-enum.stderr @@ -1,17 +1,17 @@ error[E0446]: private type `PrivateEnum` in public interface - --> $DIR/private_in_public-enum.rs:6:13 + --> $DIR/private_in_public-enum.rs:6:7 | -6 | Variant(PrivateEnum), //~ ERROR E0446 - | ^^^^^^^^^^^ can't leak private type +6 | V(PrivateEnum), //~ ERROR E0446 + | ^^^^^^^^^^^ can't leak private type ... 9 | enum PrivateEnum { | - `PrivateEnum` declared as private error[E0446]: private type `foo::PrivateEnum` in public interface - --> $DIR/private_in_public-enum.rs:15:17 + --> $DIR/private_in_public-enum.rs:15:11 | -15 | Variant(PrivateEnum), //~ ERROR E0446 - | ^^^^^^^^^^^ can't leak private type +15 | V(PrivateEnum), //~ ERROR E0446 + | ^^^^^^^^^^^ can't leak private type ... 18 | enum PrivateEnum { | - `foo::PrivateEnum` declared as private diff --git a/tests/ui/pin_project/project_replace_unsized.rs b/tests/ui/pin_project/project_replace_unsized.rs index 706a0c1..20dde12 100644 --- a/tests/ui/pin_project/project_replace_unsized.rs +++ b/tests/ui/pin_project/project_replace_unsized.rs @@ -2,7 +2,7 @@ use pin_project::pin_project; #[pin_project(project_replace)] //~ ERROR E0277 struct Struct<T: ?Sized> { - x: T, + f: T, } #[pin_project(project_replace)] //~ ERROR E0277 diff --git a/tests/ui/pin_project/project_replace_unsized.stderr b/tests/ui/pin_project/project_replace_unsized.stderr index 0395c4e..b6ecb1b 100644 --- a/tests/ui/pin_project/project_replace_unsized.stderr +++ b/tests/ui/pin_project/project_replace_unsized.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 3 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 4 | struct Struct<T: ?Sized> { - | - this type parameter needs to be `std::marker::Sized` + | - this type parameter needs to be `Sized` | = note: required because it appears within the type `Struct<T>` = help: unsized locals are gated as an unstable feature @@ -17,8 +17,8 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/project_replace_unsized.rs:5:5 | 4 | struct Struct<T: ?Sized> { - | - this type parameter needs to be `std::marker::Sized` -5 | x: T, + | - this type parameter needs to be `Sized` +5 | f: T, | ^ doesn't have a size known at compile-time error[E0277]: the size for values of type `T` cannot be known at compilation time @@ -27,7 +27,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 3 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 4 | struct Struct<T: ?Sized> { - | - this type parameter needs to be `std::marker::Sized` + | - this type parameter needs to be `Sized` | = note: required because it appears within the type `__StructProjectionOwned<T>` = note: structs must have a statically known size to be initialized @@ -39,7 +39,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 8 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 9 | struct TupleStruct<T: ?Sized>(T); - | - this type parameter needs to be `std::marker::Sized` + | - this type parameter needs to be `Sized` | = note: required because it appears within the type `TupleStruct<T>` = help: unsized locals are gated as an unstable feature @@ -54,7 +54,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 8 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 9 | struct TupleStruct<T: ?Sized>(T); - | - this type parameter needs to be `std::marker::Sized` + | - this type parameter needs to be `Sized` | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -62,7 +62,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/project_replace_unsized.rs:9:8 | 9 | struct TupleStruct<T: ?Sized>(T); - | ^^^^^^^^^^^ - this type parameter needs to be `std::marker::Sized` + | ^^^^^^^^^^^ - this type parameter needs to be `Sized` | | | doesn't have a size known at compile-time | diff --git a/tests/ui/pin_project/project_replace_unsized_locals.rs b/tests/ui/pin_project/project_replace_unsized_locals.rs index 2546041..7e28e2c 100644 --- a/tests/ui/pin_project/project_replace_unsized_locals.rs +++ b/tests/ui/pin_project/project_replace_unsized_locals.rs @@ -4,7 +4,7 @@ use pin_project::pin_project; #[pin_project(project_replace)] //~ ERROR E0277 struct Struct<T: ?Sized> { - x: T, + f: T, } #[pin_project(project_replace)] //~ ERROR E0277 diff --git a/tests/ui/pin_project/project_replace_unsized_locals.stderr b/tests/ui/pin_project/project_replace_unsized_locals.stderr index 1266c4d..ad965e5 100644 --- a/tests/ui/pin_project/project_replace_unsized_locals.stderr +++ b/tests/ui/pin_project/project_replace_unsized_locals.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 6 | struct Struct<T: ?Sized> { | ^^^^^^^-^^^^^^^^^ | | | - | | this type parameter needs to be `std::marker::Sized` + | | this type parameter needs to be `Sized` | doesn't have a size known at compile-time | = note: required because it appears within the type `__StructProjectionOwned<T>` @@ -14,8 +14,8 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/project_replace_unsized_locals.rs:7:5 | 6 | struct Struct<T: ?Sized> { - | - this type parameter needs to be `std::marker::Sized` -7 | x: T, + | - this type parameter needs to be `Sized` +7 | f: T, | ^ doesn't have a size known at compile-time error[E0277]: the size for values of type `T` cannot be known at compilation time @@ -24,7 +24,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 5 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 6 | struct Struct<T: ?Sized> { - | - this type parameter needs to be `std::marker::Sized` + | - this type parameter needs to be `Sized` | = note: required because it appears within the type `__StructProjectionOwned<T>` = note: structs must have a statically known size to be initialized @@ -36,7 +36,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 11 | struct TupleStruct<T: ?Sized>(T); | ^^^^^^^^^^^^-^^^^^^^^^ | | | - | | this type parameter needs to be `std::marker::Sized` + | | this type parameter needs to be `Sized` | doesn't have a size known at compile-time | = note: required because it appears within the type `__TupleStructProjectionOwned<T>` @@ -48,6 +48,6 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 10 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 11 | struct TupleStruct<T: ?Sized>(T); - | - this type parameter needs to be `std::marker::Sized` + | - this type parameter needs to be `Sized` | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pin_project/proper_unpin.rs b/tests/ui/pin_project/proper_unpin.rs deleted file mode 100644 index e61789b..0000000 --- a/tests/ui/pin_project/proper_unpin.rs +++ /dev/null @@ -1,38 +0,0 @@ -use pin_project::pin_project; -use std::marker::PhantomPinned; - -struct Inner<T> { - val: T, -} - -#[pin_project] -struct Foo<T, U> { - #[pin] - inner: Inner<T>, - other: U, -} - -#[pin_project] -struct TrivialBounds { - #[pin] - field1: PhantomPinned, -} - -#[pin_project] -struct Bar<'a, T, U> { - #[pin] - inner: &'a mut Inner<T>, - other: U, -} - -fn is_unpin<T: Unpin>() {} - -fn main() { - is_unpin::<Foo<PhantomPinned, ()>>(); //~ ERROR E0277 - is_unpin::<Foo<(), PhantomPinned>>(); // Ok - is_unpin::<Foo<PhantomPinned, PhantomPinned>>(); //~ ERROR E0277 - - is_unpin::<TrivialBounds>(); //~ ERROR E0277 - - is_unpin::<Bar<'_, PhantomPinned, PhantomPinned>>(); // Ok -} diff --git a/tests/ui/pin_project/proper_unpin.stderr b/tests/ui/pin_project/proper_unpin.stderr deleted file mode 100644 index 7562597..0000000 --- a/tests/ui/pin_project/proper_unpin.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/proper_unpin.rs:31:5 - | -28 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -31 | is_unpin::<Foo<PhantomPinned, ()>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__Foo<'_, std::marker::PhantomPinned, ()>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because it appears within the type `Inner<std::marker::PhantomPinned>` - = note: required because it appears within the type `_::__Foo<'_, std::marker::PhantomPinned, ()>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Foo<std::marker::PhantomPinned, ()>` - -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/proper_unpin.rs:33:5 - | -28 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -33 | is_unpin::<Foo<PhantomPinned, PhantomPinned>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__Foo<'_, std::marker::PhantomPinned, std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because it appears within the type `Inner<std::marker::PhantomPinned>` - = note: required because it appears within the type `_::__Foo<'_, std::marker::PhantomPinned, std::marker::PhantomPinned>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Foo<std::marker::PhantomPinned, std::marker::PhantomPinned>` - -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/proper_unpin.rs:35:5 - | -28 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -35 | is_unpin::<TrivialBounds>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__TrivialBounds<'_>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because it appears within the type `_::__TrivialBounds<'_>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `TrivialBounds` diff --git a/tests/ui/pin_project/remove-attr-from-field.rs b/tests/ui/pin_project/remove-attr-from-field.rs index 1ecd56f..bec8302 100644 --- a/tests/ui/pin_project/remove-attr-from-field.rs +++ b/tests/ui/pin_project/remove-attr-from-field.rs @@ -1,4 +1,4 @@ -use auxiliary_macros::remove_attr; +use auxiliary_macro::remove_attr; use pin_project::pin_project; use std::{marker::PhantomPinned, pin::Pin}; @@ -8,25 +8,25 @@ fn is_unpin<T: Unpin>() {} #[remove_attr(field_all)] struct A { #[pin] - field: PhantomPinned, + f: PhantomPinned, } #[remove_attr(field_all)] #[pin_project] struct B { #[pin] - field: PhantomPinned, + f: PhantomPinned, } fn main() { is_unpin::<A>(); is_unpin::<B>(); - let mut x = A { field: PhantomPinned }; + let mut x = A { f: PhantomPinned }; let x = Pin::new(&mut x).project(); - let _: Pin<&mut PhantomPinned> = x.field; //~ ERROR E0308 + let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 - let mut x = B { field: PhantomPinned }; + let mut x = B { f: PhantomPinned }; let x = Pin::new(&mut x).project(); - let _: Pin<&mut PhantomPinned> = x.field; //~ ERROR E0308 + let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 } diff --git a/tests/ui/pin_project/remove-attr-from-field.stderr b/tests/ui/pin_project/remove-attr-from-field.stderr index 15195e7..5d8caac 100644 --- a/tests/ui/pin_project/remove-attr-from-field.stderr +++ b/tests/ui/pin_project/remove-attr-from-field.stderr @@ -1,21 +1,21 @@ error[E0308]: mismatched types --> $DIR/remove-attr-from-field.rs:27:38 | -27 | let _: Pin<&mut PhantomPinned> = x.field; //~ ERROR E0308 - | ----------------------- ^^^^^^^ expected struct `std::pin::Pin`, found `&mut std::marker::PhantomPinned` +27 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 + | ----------------------- ^^^ expected struct `Pin`, found `&mut PhantomPinned` | | | expected due to this | - = note: expected struct `std::pin::Pin<&mut std::marker::PhantomPinned>` - found mutable reference `&mut std::marker::PhantomPinned` + = note: expected struct `Pin<&mut PhantomPinned>` + found mutable reference `&mut PhantomPinned` error[E0308]: mismatched types --> $DIR/remove-attr-from-field.rs:31:38 | -31 | let _: Pin<&mut PhantomPinned> = x.field; //~ ERROR E0308 - | ----------------------- ^^^^^^^ expected struct `std::pin::Pin`, found `&mut std::marker::PhantomPinned` +31 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 + | ----------------------- ^^^ expected struct `Pin`, found `&mut PhantomPinned` | | | expected due to this | - = note: expected struct `std::pin::Pin<&mut std::marker::PhantomPinned>` - found mutable reference `&mut std::marker::PhantomPinned` + = note: expected struct `Pin<&mut PhantomPinned>` + found mutable reference `&mut PhantomPinned` diff --git a/tests/ui/pin_project/remove-attr-from-struct.rs b/tests/ui/pin_project/remove-attr-from-struct.rs index 0c7af63..0086cf9 100644 --- a/tests/ui/pin_project/remove-attr-from-struct.rs +++ b/tests/ui/pin_project/remove-attr-from-struct.rs @@ -1,4 +1,4 @@ -use auxiliary_macros::remove_attr; +use auxiliary_macro::remove_attr; use pin_project::pin_project; use std::{marker::PhantomPinned, pin::Pin}; @@ -8,26 +8,26 @@ fn is_unpin<T: Unpin>() {} #[remove_attr(struct_all)] struct A { #[pin] //~ ERROR cannot find attribute `pin` in this scope - field: PhantomPinned, + f: PhantomPinned, } #[remove_attr(struct_all)] #[pin_project] struct B { #[pin] //~ ERROR cannot find attribute `pin` in this scope - field: PhantomPinned, + f: PhantomPinned, } #[pin_project] //~ ERROR has been removed #[remove_attr(struct_pin)] struct C { - field: PhantomPinned, + f: PhantomPinned, } #[remove_attr(struct_pin)] #[pin_project] // Ok struct D { - field: PhantomPinned, + f: PhantomPinned, } fn main() { @@ -35,12 +35,12 @@ fn main() { is_unpin::<B>(); //~ ERROR E0277 is_unpin::<D>(); // Ok - let mut x = A { field: PhantomPinned }; + let mut x = A { f: PhantomPinned }; let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 - let mut x = B { field: PhantomPinned }; + let mut x = B { f: PhantomPinned }; let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 - let mut x = D { field: PhantomPinned }; + let mut x = D { f: PhantomPinned }; let _ = Pin::new(&mut x).project(); //~ Ok } diff --git a/tests/ui/pin_project/remove-attr-from-struct.stderr b/tests/ui/pin_project/remove-attr-from-struct.stderr index 112584e..97d9c23 100644 --- a/tests/ui/pin_project/remove-attr-from-struct.stderr +++ b/tests/ui/pin_project/remove-attr-from-struct.stderr @@ -18,54 +18,54 @@ error: cannot find attribute `pin` in this scope 17 | #[pin] //~ ERROR cannot find attribute `pin` in this scope | ^^^ -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned +error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/remove-attr-from-struct.rs:34:5 | 5 | fn is_unpin<T: Unpin>() {} | ----- required by this bound in `is_unpin` ... 34 | is_unpin::<A>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^ within `A`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | ^^^^^^^^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned` | = note: required because it appears within the type `A` -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned +error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/remove-attr-from-struct.rs:35:5 | 5 | fn is_unpin<T: Unpin>() {} | ----- required by this bound in `is_unpin` ... 35 | is_unpin::<B>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^ within `B`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | ^^^^^^^^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned` | = note: required because it appears within the type `B` -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned +error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/remove-attr-from-struct.rs:39:13 | 39 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 - | ^^^^^^^^ within `A`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | ^^^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned` | = note: required because it appears within the type `A` - = note: required by `std::pin::Pin::<P>::new` + = note: required by `Pin::<P>::new` -error[E0599]: no method named `project` found for struct `std::pin::Pin<&mut A>` in the current scope +error[E0599]: no method named `project` found for struct `Pin<&mut A>` in the current scope --> $DIR/remove-attr-from-struct.rs:39:30 | 39 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 - | ^^^^^^^ method not found in `std::pin::Pin<&mut A>` + | ^^^^^^^ method not found in `Pin<&mut A>` -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned +error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/remove-attr-from-struct.rs:42:13 | 42 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 - | ^^^^^^^^ within `B`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | ^^^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned` | = note: required because it appears within the type `B` - = note: required by `std::pin::Pin::<P>::new` + = note: required by `Pin::<P>::new` -error[E0599]: no method named `project` found for struct `std::pin::Pin<&mut B>` in the current scope +error[E0599]: no method named `project` found for struct `Pin<&mut B>` in the current scope --> $DIR/remove-attr-from-struct.rs:42:30 | 42 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 - | ^^^^^^^ method not found in `std::pin::Pin<&mut B>` + | ^^^^^^^ method not found in `Pin<&mut B>` diff --git a/tests/ui/pin_project/safe_packed_borrows.rs b/tests/ui/pin_project/safe_packed_borrows.rs index c1a7d55..db4ac2d 100644 --- a/tests/ui/pin_project/safe_packed_borrows.rs +++ b/tests/ui/pin_project/safe_packed_borrows.rs @@ -1,21 +1,21 @@ -#![deny(safe_packed_borrows)] +#![forbid(safe_packed_borrows)] // Refs: https://github.com/rust-lang/rust/issues/46043 #[repr(packed)] struct A { - field: u32, + f: u32, } #[repr(packed(2))] struct B { - field: u32, + f: u32, } fn main() { - let a = A { field: 1 }; - &a.field; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block + let a = A { f: 1 }; + &a.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block - let b = B { field: 1 }; - &b.field; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block + let b = B { f: 1 }; + &b.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block } diff --git a/tests/ui/pin_project/safe_packed_borrows.stderr b/tests/ui/pin_project/safe_packed_borrows.stderr index 7b4cc08..c1f734a 100644 --- a/tests/ui/pin_project/safe_packed_borrows.stderr +++ b/tests/ui/pin_project/safe_packed_borrows.stderr @@ -1,14 +1,14 @@ error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) --> $DIR/safe_packed_borrows.rs:17:5 | -17 | &a.field; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block - | ^^^^^^^^ +17 | &a.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block + | ^^^^ | note: the lint level is defined here - --> $DIR/safe_packed_borrows.rs:1:9 + --> $DIR/safe_packed_borrows.rs:1:11 | -1 | #![deny(safe_packed_borrows)] - | ^^^^^^^^^^^^^^^^^^^ +1 | #![forbid(safe_packed_borrows)] + | ^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043> = note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior @@ -16,8 +16,8 @@ note: the lint level is defined here error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) --> $DIR/safe_packed_borrows.rs:20:5 | -20 | &b.field; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block - | ^^^^^^^^ +20 | &b.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block + | ^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043> diff --git a/tests/ui/pin_project/unpin_sneaky.rs b/tests/ui/pin_project/unpin_sneaky.rs index 3ccb1a9..3f5f32b 100644 --- a/tests/ui/pin_project/unpin_sneaky.rs +++ b/tests/ui/pin_project/unpin_sneaky.rs @@ -1,11 +1,11 @@ use pin_project::pin_project; #[pin_project] -struct Foo { +struct S { #[pin] - inner: u8, + f: u8, } -impl Unpin for __Foo {} //~ ERROR E0412,E0321 +impl Unpin for __S {} //~ ERROR E0412,E0321 fn main() {} diff --git a/tests/ui/pin_project/unpin_sneaky.stderr b/tests/ui/pin_project/unpin_sneaky.stderr index 0637a66..ab5e794 100644 --- a/tests/ui/pin_project/unpin_sneaky.stderr +++ b/tests/ui/pin_project/unpin_sneaky.stderr @@ -1,11 +1,11 @@ -error[E0412]: cannot find type `__Foo` in this scope +error[E0412]: cannot find type `__S` in this scope --> $DIR/unpin_sneaky.rs:9:16 | -9 | impl Unpin for __Foo {} //~ ERROR E0412,E0321 - | ^^^^^ not found in this scope +9 | impl Unpin for __S {} //~ ERROR E0412,E0321 + | ^^^ not found in this scope -error[E0321]: cross-crate traits with a default impl, like `std::marker::Unpin`, can only be implemented for a struct/enum type, not `[type error]` +error[E0321]: cross-crate traits with a default impl, like `Unpin`, can only be implemented for a struct/enum type, not `[type error]` --> $DIR/unpin_sneaky.rs:9:1 | -9 | impl Unpin for __Foo {} //~ ERROR E0412,E0321 - | ^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type +9 | impl Unpin for __S {} //~ ERROR E0412,E0321 + | ^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type diff --git a/tests/ui/pin_project/visibility.rs b/tests/ui/pin_project/visibility.rs index 01c0831..fdff5a6 100644 --- a/tests/ui/pin_project/visibility.rs +++ b/tests/ui/pin_project/visibility.rs @@ -1,23 +1,26 @@ +/// Only named projected types can be imported. +/// See import_unnamed.rs for unnamed projected types. + mod pub_ { use pin_project::pin_project; - #[pin_project] + #[pin_project(project = DProj, project_ref = DProjRef)] pub struct Default(()); - #[pin_project(project_replace)] + #[pin_project(project = RProj, project_ref = RProjRef, project_replace = RProjOwn)] pub struct Replace(()); } pub mod pub_use { #[rustfmt::skip] - pub use crate::pub_::__DefaultProjection; //~ ERROR E0365 + pub use crate::pub_::DProj; //~ ERROR E0365 #[rustfmt::skip] - pub use crate::pub_::__DefaultProjectionRef; //~ ERROR E0365 + pub use crate::pub_::DProjRef; //~ ERROR E0365 #[rustfmt::skip] - pub use crate::pub_::__ReplaceProjection; //~ ERROR E0365 + pub use crate::pub_::RProj; //~ ERROR E0365 #[rustfmt::skip] - pub use crate::pub_::__ReplaceProjectionOwned; //~ ERROR E0365 + pub use crate::pub_::RProjOwn; //~ ERROR E0365 #[rustfmt::skip] - pub use crate::pub_::__ReplaceProjectionRef; //~ ERROR E0365 + pub use crate::pub_::RProjRef; //~ ERROR E0365 // Confirm that the visibility of the original type is not changed. pub use crate::pub_::{Default, Replace}; @@ -25,58 +28,22 @@ pub mod pub_use { pub mod pub_use2 { // Ok #[allow(unused_imports)] - pub(crate) use crate::pub_::{ - __DefaultProjection, __DefaultProjectionRef, __ReplaceProjection, __ReplaceProjectionOwned, - __ReplaceProjectionRef, - }; + pub(crate) use crate::pub_::{DProj, DProjRef, RProj, RProjOwn, RProjRef}; } mod pub_crate { use pin_project::pin_project; - #[pin_project] + #[pin_project(project = DProj, project_ref = DProjRef)] pub(crate) struct Default(()); - #[pin_project(project_replace)] + #[pin_project(project = RProj, project_ref = RProjRef, project_replace = RProjOwn)] pub(crate) struct Replace(()); } pub mod pub_crate_use { // Ok #[allow(unused_imports)] - pub(crate) use crate::pub_crate::{ - __DefaultProjection, __DefaultProjectionRef, __ReplaceProjection, __ReplaceProjectionOwned, - __ReplaceProjectionRef, - }; -} - -mod pub_renamed { - use pin_project::pin_project; - - #[pin_project(project = DProj, project_ref = DProjRef)] - pub struct Default(()); - - #[pin_project(project = RProj, project_ref = RProjRef, project_replace = RProjOwn)] - pub struct Replace(()); -} -pub mod pub_renamed_use { - #[rustfmt::skip] - pub use crate::pub_renamed::DProj; //~ ERROR E0365 - #[rustfmt::skip] - pub use crate::pub_renamed::DProjRef; //~ ERROR E0365 - #[rustfmt::skip] - pub use crate::pub_renamed::RProj; //~ ERROR E0365 - #[rustfmt::skip] - pub use crate::pub_renamed::RProjOwn; //~ ERROR E0365 - #[rustfmt::skip] - pub use crate::pub_renamed::RProjRef; //~ ERROR E0365 - - // Confirm that the visibility of the original type is not changed. - pub use crate::pub_renamed::{Default, Replace}; -} -pub mod pub_renamed_use2 { - // Ok - #[allow(unused_imports)] - pub(crate) use crate::pub_renamed::{DProj, DProjRef, RProj, RProjOwn, RProjRef}; + pub(crate) use crate::pub_crate::{DProj, DProjRef, RProj, RProjOwn, RProjRef}; } fn main() {} diff --git a/tests/ui/pin_project/visibility.stderr b/tests/ui/pin_project/visibility.stderr index cab0e2e..a1f0423 100644 --- a/tests/ui/pin_project/visibility.stderr +++ b/tests/ui/pin_project/visibility.stderr @@ -1,79 +1,39 @@ -error[E0365]: `__DefaultProjection` is private, and cannot be re-exported - --> $DIR/visibility.rs:12:13 - | -12 | pub use crate::pub_::__DefaultProjection; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `__DefaultProjection` - | - = note: consider declaring type or module `__DefaultProjection` with `pub` - -error[E0365]: `__DefaultProjectionRef` is private, and cannot be re-exported - --> $DIR/visibility.rs:14:13 - | -14 | pub use crate::pub_::__DefaultProjectionRef; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `__DefaultProjectionRef` - | - = note: consider declaring type or module `__DefaultProjectionRef` with `pub` - -error[E0365]: `__ReplaceProjection` is private, and cannot be re-exported - --> $DIR/visibility.rs:16:13 - | -16 | pub use crate::pub_::__ReplaceProjection; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `__ReplaceProjection` - | - = note: consider declaring type or module `__ReplaceProjection` with `pub` - -error[E0365]: `__ReplaceProjectionOwned` is private, and cannot be re-exported - --> $DIR/visibility.rs:18:13 - | -18 | pub use crate::pub_::__ReplaceProjectionOwned; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `__ReplaceProjectionOwned` - | - = note: consider declaring type or module `__ReplaceProjectionOwned` with `pub` - -error[E0365]: `__ReplaceProjectionRef` is private, and cannot be re-exported - --> $DIR/visibility.rs:20:13 - | -20 | pub use crate::pub_::__ReplaceProjectionRef; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `__ReplaceProjectionRef` - | - = note: consider declaring type or module `__ReplaceProjectionRef` with `pub` - error[E0365]: `DProj` is private, and cannot be re-exported - --> $DIR/visibility.rs:63:13 + --> $DIR/visibility.rs:15:13 | -63 | pub use crate::pub_renamed::DProj; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `DProj` +15 | pub use crate::pub_::DProj; //~ ERROR E0365 + | ^^^^^^^^^^^^^^^^^^ re-export of private `DProj` | = note: consider declaring type or module `DProj` with `pub` error[E0365]: `DProjRef` is private, and cannot be re-exported - --> $DIR/visibility.rs:65:13 + --> $DIR/visibility.rs:17:13 | -65 | pub use crate::pub_renamed::DProjRef; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `DProjRef` +17 | pub use crate::pub_::DProjRef; //~ ERROR E0365 + | ^^^^^^^^^^^^^^^^^^^^^ re-export of private `DProjRef` | = note: consider declaring type or module `DProjRef` with `pub` error[E0365]: `RProj` is private, and cannot be re-exported - --> $DIR/visibility.rs:67:13 + --> $DIR/visibility.rs:19:13 | -67 | pub use crate::pub_renamed::RProj; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProj` +19 | pub use crate::pub_::RProj; //~ ERROR E0365 + | ^^^^^^^^^^^^^^^^^^ re-export of private `RProj` | = note: consider declaring type or module `RProj` with `pub` error[E0365]: `RProjOwn` is private, and cannot be re-exported - --> $DIR/visibility.rs:69:13 + --> $DIR/visibility.rs:21:13 | -69 | pub use crate::pub_renamed::RProjOwn; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProjOwn` +21 | pub use crate::pub_::RProjOwn; //~ ERROR E0365 + | ^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProjOwn` | = note: consider declaring type or module `RProjOwn` with `pub` error[E0365]: `RProjRef` is private, and cannot be re-exported - --> $DIR/visibility.rs:71:13 + --> $DIR/visibility.rs:23:13 | -71 | pub use crate::pub_renamed::RProjRef; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProjRef` +23 | pub use crate::pub_::RProjRef; //~ ERROR E0365 + | ^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProjRef` | = note: consider declaring type or module `RProjRef` with `pub` diff --git a/tests/ui/pinned_drop/call-drop-inner.rs b/tests/ui/pinned_drop/call-drop-inner.rs index c953acb..4171ed5 100644 --- a/tests/ui/pinned_drop/call-drop-inner.rs +++ b/tests/ui/pinned_drop/call-drop-inner.rs @@ -3,7 +3,7 @@ use std::pin::Pin; #[pin_project(PinnedDrop)] struct Struct { - dropped: bool, + f: bool, } #[pinned_drop] diff --git a/tests/ui/pinned_drop/conditional-drop-impl.rs b/tests/ui/pinned_drop/conditional-drop-impl.rs index 42d18b7..fecfd50 100644 --- a/tests/ui/pinned_drop/conditional-drop-impl.rs +++ b/tests/ui/pinned_drop/conditional-drop-impl.rs @@ -4,7 +4,7 @@ use std::pin::Pin; // In `Drop` impl, the implementor must specify the same requirement as type definition. struct DropImpl<T> { - field: T, + f: T, } impl<T: Unpin> Drop for DropImpl<T> { @@ -15,7 +15,7 @@ impl<T: Unpin> Drop for DropImpl<T> { #[pin_project(PinnedDrop)] //~ ERROR E0277 struct PinnedDropImpl<T> { #[pin] - field: T, + f: T, } #[pinned_drop] diff --git a/tests/ui/pinned_drop/conditional-drop-impl.stderr b/tests/ui/pinned_drop/conditional-drop-impl.stderr index ad8fb69..6381a29 100644 --- a/tests/ui/pinned_drop/conditional-drop-impl.stderr +++ b/tests/ui/pinned_drop/conditional-drop-impl.stderr @@ -1,4 +1,4 @@ -error[E0367]: `Drop` impl requires `T: std::marker::Unpin` but the struct it is implemented for does not +error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not --> $DIR/conditional-drop-impl.rs:10:9 | 10 | impl<T: Unpin> Drop for DropImpl<T> { @@ -8,7 +8,7 @@ note: the implementor must specify the same requirement --> $DIR/conditional-drop-impl.rs:6:1 | 6 | / struct DropImpl<T> { -7 | | field: T, +7 | | f: T, 8 | | } | |_^ @@ -16,11 +16,11 @@ error[E0277]: `T` cannot be unpinned --> $DIR/conditional-drop-impl.rs:15:15 | 15 | #[pin_project(PinnedDrop)] //~ ERROR E0277 - | ^^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `T` + | ^^^^^^^^^^ the trait `Unpin` is not implemented for `T` | - = note: required because of the requirements on the impl of `pin_project::__private::PinnedDrop` for `PinnedDropImpl<T>` + = note: required because of the requirements on the impl of `PinnedDrop` for `PinnedDropImpl<T>` = note: required by `pin_project::__private::PinnedDrop::drop` help: consider restricting type parameter `T` | -16 | struct PinnedDropImpl<T: std::marker::Unpin> { - | ^^^^^^^^^^^^^^^^^^^^ +16 | struct PinnedDropImpl<T: Unpin> { + | ^^^^^^^ diff --git a/tests/ui/pinned_drop/forget-pinned-drop-impl.rs b/tests/ui/pinned_drop/forget-pinned-drop-impl.rs index 6c9f718..e31f46f 100644 --- a/tests/ui/pinned_drop/forget-pinned-drop-impl.rs +++ b/tests/ui/pinned_drop/forget-pinned-drop-impl.rs @@ -3,7 +3,7 @@ use pin_project::pin_project; #[pin_project(PinnedDrop)] //~ ERROR E0277 struct Struct { #[pin] - field: u8, + f: u8, } fn main() {} diff --git a/tests/ui/pinned_drop/forget-pinned-drop-impl.stderr b/tests/ui/pinned_drop/forget-pinned-drop-impl.stderr index 67bdbe1..9fd7cdb 100644 --- a/tests/ui/pinned_drop/forget-pinned-drop-impl.stderr +++ b/tests/ui/pinned_drop/forget-pinned-drop-impl.stderr @@ -1,7 +1,7 @@ -error[E0277]: the trait bound `Struct: pin_project::__private::PinnedDrop` is not satisfied +error[E0277]: the trait bound `Struct: PinnedDrop` is not satisfied --> $DIR/forget-pinned-drop-impl.rs:3:15 | 3 | #[pin_project(PinnedDrop)] //~ ERROR E0277 - | ^^^^^^^^^^ the trait `pin_project::__private::PinnedDrop` is not implemented for `Struct` + | ^^^^^^^^^^ the trait `PinnedDrop` is not implemented for `Struct` | = note: required by `pin_project::__private::PinnedDrop::drop` diff --git a/tests/ui/pinned_drop/invalid-self.rs b/tests/ui/pinned_drop/invalid-self.rs index 73d3b43..783167f 100644 --- a/tests/ui/pinned_drop/invalid-self.rs +++ b/tests/ui/pinned_drop/invalid-self.rs @@ -2,13 +2,13 @@ use std::pin::Pin; -struct Struct {} +struct S {} -impl Struct { +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 @ Struct {}: Self) {} //~ ERROR expected one of `)`, `,`, or `:`, found `@` + fn self_subpat(self @ S {}: Self) {} //~ ERROR expected one of `)`, `,`, or `:`, found `@` } fn main() {} diff --git a/tests/ui/pinned_drop/invalid-self.stderr b/tests/ui/pinned_drop/invalid-self.stderr index a43e91d..3248704 100644 --- a/tests/ui/pinned_drop/invalid-self.stderr +++ b/tests/ui/pinned_drop/invalid-self.stderr @@ -13,13 +13,13 @@ error: expected identifier, found keyword `self` error: expected parameter name, found `@` --> $DIR/invalid-self.rs:11:25 | -11 | fn self_subpat(self @ Struct {}: Self) {} //~ ERROR expected one of `)`, `,`, or `:`, found `@` +11 | fn self_subpat(self @ S {}: Self) {} //~ ERROR expected one of `)`, `,`, or `:`, found `@` | ^ expected parameter name error: expected one of `)`, `,`, or `:`, found `@` --> $DIR/invalid-self.rs:11:25 | -11 | fn self_subpat(self @ Struct {}: Self) {} //~ ERROR expected one of `)`, `,`, or `:`, found `@` +11 | fn self_subpat(self @ S {}: Self) {} //~ ERROR expected one of `)`, `,`, or `:`, found `@` | -^ expected one of `)`, `,`, or `:` | | | help: missing `,` diff --git a/tests/ui/pinned_drop/invalid.rs b/tests/ui/pinned_drop/invalid.rs index 7065ec9..7e36750 100644 --- a/tests/ui/pinned_drop/invalid.rs +++ b/tests/ui/pinned_drop/invalid.rs @@ -48,7 +48,7 @@ mod item { impl InherentImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait #[pinned_drop] - fn drop(_: Pin<&mut ()>) {} //~ ERROR expected `impl` + fn func(_: Pin<&mut ()>) {} //~ ERROR expected `impl` } mod unsafety { @@ -200,7 +200,7 @@ mod method { #[pinned_drop] impl PinnedDrop for InvalidName { - fn pinned_drop(&mut self) {} //~ ERROR method `pinned_drop` is not a member of trait `PinnedDrop + fn pinned_drop(self: Pin<&mut Self>) {} //~ ERROR method `pinned_drop` is not a member of trait `PinnedDrop } } diff --git a/tests/ui/pinned_drop/invalid.stderr b/tests/ui/pinned_drop/invalid.stderr index 65ef9ff..277a2fa 100644 --- a/tests/ui/pinned_drop/invalid.stderr +++ b/tests/ui/pinned_drop/invalid.stderr @@ -25,7 +25,7 @@ error: #[pinned_drop] may only be used on implementation for the `PinnedDrop` tr error: expected `impl` --> $DIR/invalid.rs:51:5 | -51 | fn drop(_: Pin<&mut ()>) {} //~ ERROR expected `impl` +51 | fn func(_: Pin<&mut ()>) {} //~ ERROR expected `impl` | ^^ error: implementing the trait `PinnedDrop` is not unsafe @@ -121,7 +121,7 @@ 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 | -203 | fn pinned_drop(&mut self) {} //~ ERROR method `pinned_drop` is not a member of trait `PinnedDrop +203 | 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 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 1241b5b..f9db79c 100644 --- a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs +++ b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs @@ -2,13 +2,14 @@ use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; #[pin_project] -struct Foo { +struct S { #[pin] - field: u8, + f: u8, } #[pinned_drop] -impl PinnedDrop for Foo { //~ ERROR E0119 +impl PinnedDrop for S { + //~^ ERROR E0119 fn drop(self: Pin<&mut Self>) {} } 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 7353dc4..6f868bf 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 `Foo`: +error[E0119]: conflicting implementations of trait `pin_project::__private::PinnedDrop` for type `S`: --> $DIR/pinned-drop-no-attr-arg.rs:11:1 | 4 | #[pin_project] | -------------- first implementation here ... -11 | impl PinnedDrop for Foo { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Foo` +11 | 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 9176066..03825ca 100644 --- a/tests/ui/pinned_drop/self.rs +++ b/tests/ui/pinned_drop/self.rs @@ -3,12 +3,12 @@ pub mod self_in_macro_def { use std::pin::Pin; #[pin_project(PinnedDrop)] - pub struct Struct { - x: (), + pub struct S { + f: (), } #[pinned_drop] - impl PinnedDrop for Struct { + impl PinnedDrop for S { fn drop(self: Pin<&mut Self>) { macro_rules! t { () => {{ @@ -28,7 +28,7 @@ pub mod self_span { #[pin_project(PinnedDrop)] pub struct S { - x: (), + f: (), } #[pinned_drop] @@ -41,7 +41,7 @@ pub mod self_span { #[pin_project(PinnedDrop)] pub enum E { - V { x: () }, + V { f: () }, } #[pinned_drop] diff --git a/tests/ui/pinned_drop/self.stderr b/tests/ui/pinned_drop/self.stderr index 4ac0e63..edab117 100644 --- a/tests/ui/pinned_drop/self.stderr +++ b/tests/ui/pinned_drop/self.stderr @@ -26,34 +26,34 @@ error[E0423]: expected value, found struct `S` --> $DIR/self.rs:38:27 | 30 | / pub struct S { -31 | | x: (), +31 | | f: (), 32 | | } | |_____- `S` defined here ... 38 | let _: Self = Self; //~ ERROR E0423 - | ^^^^ help: use struct literal syntax instead: `S { x: val }` + | ^^^^ help: use struct literal syntax instead: `S { f: val }` error[E0308]: mismatched types --> $DIR/self.rs:37:25 | 37 | let _: () = self; //~ ERROR E0308 - | -- ^^^^ expected `()`, found struct `std::pin::Pin` + | -- ^^^^ expected `()`, found struct `Pin` | | | expected due to this | = note: expected unit type `()` - found struct `std::pin::Pin<&mut self_span::S>` + found struct `Pin<&mut self_span::S>` error[E0308]: mismatched types --> $DIR/self.rs:50:25 | 50 | let _: () = self; //~ ERROR E0308 - | -- ^^^^ expected `()`, found struct `std::pin::Pin` + | -- ^^^^ expected `()`, found struct `Pin` | | | expected due to this | = note: expected unit type `()` - found struct `std::pin::Pin<&mut self_span::E>` + found struct `Pin<&mut E>` error[E0533]: expected unit struct, unit variant or constant, found struct variant `Self::V` --> $DIR/self.rs:51:27 diff --git a/tests/ui/pinned_drop/unsafe-call.rs b/tests/ui/pinned_drop/unsafe-call.rs index 2f400c1..7faf0fa 100644 --- a/tests/ui/pinned_drop/unsafe-call.rs +++ b/tests/ui/pinned_drop/unsafe-call.rs @@ -2,15 +2,15 @@ use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; #[pin_project(PinnedDrop)] -struct Struct { +struct S { #[pin] - field: u8, + f: u8, } #[pinned_drop] -impl PinnedDrop for Struct { +impl PinnedDrop for S { fn drop(self: Pin<&mut Self>) { - self.project().field.get_unchecked_mut(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block [E0133] + self.project().f.get_unchecked_mut(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block [E0133] } } diff --git a/tests/ui/pinned_drop/unsafe-call.stderr b/tests/ui/pinned_drop/unsafe-call.stderr index 4e8e00b..cd5e572 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 | -13 | self.project().field.get_unchecked_mut(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block [E0133] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function +13 | 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 diff --git a/tests/ui/project/ambiguous-let.rs b/tests/ui/project/ambiguous-let.rs deleted file mode 100644 index bbb3a2c..0000000 --- a/tests/ui/project/ambiguous-let.rs +++ /dev/null @@ -1,26 +0,0 @@ -#![allow(deprecated)] - -use pin_project::{pin_project, project}; - -#[pin_project] -enum Enum<A, B> { - A(#[pin] A), - B(B), -} - -struct Struct<T>(T); - -#[project] -fn foo() { - let mut foo: Enum<bool, bool> = Enum::A(true); - - #[project] - let Struct(x) = match Pin::new(&mut foo).project() { - //~^ ERROR Both initializer expression and pattern are replaceable, you need to split the initializer expression into separate let bindings to avoid ambiguity - Enum::A(_) => Struct(true), - Enum::B(_) => unreachable!(), - }; - assert!(x); -} - -fn main() {} diff --git a/tests/ui/project/ambiguous-let.stderr b/tests/ui/project/ambiguous-let.stderr deleted file mode 100644 index 2e66484..0000000 --- a/tests/ui/project/ambiguous-let.stderr +++ /dev/null @@ -1,5 +0,0 @@ -error: Both initializer expression and pattern are replaceable, you need to split the initializer expression into separate let bindings to avoid ambiguity - --> $DIR/ambiguous-let.rs:18:9 - | -18 | let Struct(x) = match Pin::new(&mut foo).project() { - | ^^^^^^^^^ diff --git a/tests/ui/project/deprecated.rs b/tests/ui/project/deprecated.rs deleted file mode 100644 index 78d593d..0000000 --- a/tests/ui/project/deprecated.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![deny(deprecated)] - -use pin_project::{project, project_ref, project_replace}; - -#[project] -#[project_ref] -#[project_replace] -fn main() {} diff --git a/tests/ui/project/deprecated.stderr b/tests/ui/project/deprecated.stderr deleted file mode 100644 index 015b8df..0000000 --- a/tests/ui/project/deprecated.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: use of deprecated item 'project': consider naming projected type by passing `project` argument to #[pin_project] attribute instead, see release note <https://github.com/taiki-e/pin-project/releases/tag/v0.4.21> for details - --> $DIR/deprecated.rs:5:3 - | -5 | #[project] - | ^^^^^^^ - | -note: the lint level is defined here - --> $DIR/deprecated.rs:1:9 - | -1 | #![deny(deprecated)] - | ^^^^^^^^^^ - -error: use of deprecated item 'project_ref': consider naming projected type by passing `project_ref` argument to #[pin_project] attribute instead, see release note <https://github.com/taiki-e/pin-project/releases/tag/v0.4.21> for details - --> $DIR/deprecated.rs:6:3 - | -6 | #[project_ref] - | ^^^^^^^^^^^ - -error: use of deprecated item 'project_replace': consider naming projected type by passing `project_replace` argument to #[pin_project] attribute instead, see release note <https://github.com/taiki-e/pin-project/releases/tag/v0.4.21> for details - --> $DIR/deprecated.rs:7:3 - | -7 | #[project_replace] - | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/project/invalid.rs b/tests/ui/project/invalid.rs deleted file mode 100644 index e72f84c..0000000 --- a/tests/ui/project/invalid.rs +++ /dev/null @@ -1,192 +0,0 @@ -#![allow(deprecated)] - -mod argument { - use pin_project::{pin_project, project}; - - #[pin_project] - struct A(#[pin] ()); - - #[project] - fn unexpected_local1() { - let mut x = A(()); - #[project()] //~ ERROR unexpected token - let A(_) = Pin::new(&mut x).project(); - } - - #[project] - fn unexpected_local1() { - let mut x = A(()); - #[project(foo)] //~ ERROR unexpected token - let A(_) = Pin::new(&mut x).project(); - } - - #[project] - fn unexpected_expr1() { - let mut x = A(()); - #[project()] //~ ERROR unexpected token - match Pin::new(&mut x).project() { - A(_) => {} - } - } - - #[project] - fn unexpected_expr1() { - let mut x = A(()); - #[project(foo)] //~ ERROR unexpected token - match Pin::new(&mut x).project() { - A(_) => {} - } - } - - #[project()] // Ok - fn unexpected_item1() {} - - #[project(foo)] //~ ERROR unexpected token - fn unexpected_item2() {} -} - -mod attribute { - use pin_project::{pin_project, project, project_ref, project_replace}; - - #[pin_project(project_replace)] - struct A(#[pin] ()); - - #[project] - fn duplicate_stmt_project() { - let mut x = A(()); - #[project] - #[project] //~ ERROR duplicate #[project] attribute - let A(_) = Pin::new(&mut x).project(); - } - - #[project_ref] - fn duplicate_stmt_project_ref() { - let mut x = A(()); - #[project_ref] - #[project_ref] //~ ERROR duplicate #[project_ref] attribute - let A(_) = Pin::new(&mut x).project(); - } - - #[project_replace] - fn duplicate_stmt_project_replace() { - let mut x = A(()); - #[project_replace] - #[project_replace] //~ ERROR duplicate #[project_replace] attribute - let A(_) = Pin::new(&mut x).project(); - } - - #[project] - fn combine_stmt_project1() { - let mut x = A(()); - #[project] - #[project_ref] //~ ERROR are mutually exclusive - let A(_) = Pin::new(&mut x).project(); - } - - #[project] - fn combine_stmt_project2() { - let mut x = A(()); - #[project] - #[project_replace] //~ ERROR are mutually exclusive - let A(_) = Pin::new(&mut x).project(); - } - - #[project] - fn combine_stmt_project3() { - let mut x = A(()); - #[project_ref] - #[project_replace] //~ ERROR are mutually exclusive - let A(_) = Pin::new(&mut x).project(); - } - - #[project_ref] - fn combine_stmt_project_ref1() { - let mut x = A(()); - #[project] - #[project_ref] //~ ERROR are mutually exclusive - let A(_) = Pin::new(&mut x).project(); - } - - #[project_ref] - fn combine_stmt_project_ref2() { - let mut x = A(()); - #[project] - #[project_replace] //~ ERROR are mutually exclusive - let A(_) = Pin::new(&mut x).project(); - } - - #[project_ref] - fn combine_stmt_project_ref3() { - let mut x = A(()); - #[project_ref] - #[project_replace] //~ ERROR are mutually exclusive - let A(_) = Pin::new(&mut x).project(); - } - - #[project_replace] - fn combine_stmt_project_replace1() { - let mut x = A(()); - #[project] - #[project_ref] //~ ERROR are mutually exclusive - let A(_) = Pin::new(&mut x).project(); - } - - #[project_replace] - fn combine_stmt_project_replace2() { - let mut x = A(()); - #[project] - #[project_replace] //~ ERROR are mutually exclusive - let A(_) = Pin::new(&mut x).project(); - } - - #[project_replace] - fn combine_stmt_project_replace3() { - let mut x = A(()); - #[project_ref] - #[project_replace] //~ ERROR are mutually exclusive - let A(_) = Pin::new(&mut x).project(); - } - - #[project] - #[project] //~ ERROR duplicate #[project] attribute - fn duplicate_fn_project() {} - - #[project_ref] - #[project_ref] //~ ERROR duplicate #[project_ref] attribute - fn duplicate_fn_project_ref() {} - - #[project_replace] - #[project_replace] //~ ERROR duplicate #[project_replace] attribute - fn duplicate_fn_project_replace() {} - - #[project] - #[project] //~ ERROR duplicate #[project] attribute - impl A {} - - #[project_ref] - #[project_ref] //~ ERROR duplicate #[project_ref] attribute - impl A {} - - #[project_replace] - #[project_replace] //~ ERROR duplicate #[project_replace] attribute - impl A {} - - #[allow(unused_imports)] - mod use_ { - use pin_project::{project, project_ref, project_replace}; - - #[project] - #[project] //~ ERROR duplicate #[project] attribute - use super::A; - - #[project_ref] - #[project_ref] //~ ERROR duplicate #[project_ref] attribute - use super::A; - - #[project_replace] - #[project_replace] //~ ERROR duplicate #[project_replace] attribute - use super::A; - } -} - -fn main() {} diff --git a/tests/ui/project/invalid.stderr b/tests/ui/project/invalid.stderr deleted file mode 100644 index e1dc388..0000000 --- a/tests/ui/project/invalid.stderr +++ /dev/null @@ -1,155 +0,0 @@ -error: unexpected token: () - --> $DIR/invalid.rs:12:18 - | -12 | #[project()] //~ ERROR unexpected token - | ^^ - -error: unexpected token: (foo) - --> $DIR/invalid.rs:19:18 - | -19 | #[project(foo)] //~ ERROR unexpected token - | ^^^^^ - -error: unexpected token: () - --> $DIR/invalid.rs:26:18 - | -26 | #[project()] //~ ERROR unexpected token - | ^^ - -error: unexpected token: (foo) - --> $DIR/invalid.rs:35:18 - | -35 | #[project(foo)] //~ ERROR unexpected token - | ^^^^^ - -error: unexpected token: foo - --> $DIR/invalid.rs:44:15 - | -44 | #[project(foo)] //~ ERROR unexpected token - | ^^^ - -error: duplicate #[project] attribute - --> $DIR/invalid.rs:58:9 - | -58 | #[project] //~ ERROR duplicate #[project] attribute - | ^^^^^^^^^^ - -error: duplicate #[project_ref] attribute - --> $DIR/invalid.rs:66:9 - | -66 | #[project_ref] //~ ERROR duplicate #[project_ref] attribute - | ^^^^^^^^^^^^^^ - -error: duplicate #[project_replace] attribute - --> $DIR/invalid.rs:74:9 - | -74 | #[project_replace] //~ ERROR duplicate #[project_replace] attribute - | ^^^^^^^^^^^^^^^^^^ - -error: attributes `project` and `project_ref` are mutually exclusive - --> $DIR/invalid.rs:82:9 - | -82 | #[project_ref] //~ ERROR are mutually exclusive - | ^^^^^^^^^^^^^^ - -error: attributes `project` and `project_replace` are mutually exclusive - --> $DIR/invalid.rs:90:9 - | -90 | #[project_replace] //~ ERROR are mutually exclusive - | ^^^^^^^^^^^^^^^^^^ - -error: attributes `project_ref` and `project_replace` are mutually exclusive - --> $DIR/invalid.rs:98:9 - | -98 | #[project_replace] //~ ERROR are mutually exclusive - | ^^^^^^^^^^^^^^^^^^ - -error: attributes `project` and `project_ref` are mutually exclusive - --> $DIR/invalid.rs:106:9 - | -106 | #[project_ref] //~ ERROR are mutually exclusive - | ^^^^^^^^^^^^^^ - -error: attributes `project` and `project_replace` are mutually exclusive - --> $DIR/invalid.rs:114:9 - | -114 | #[project_replace] //~ ERROR are mutually exclusive - | ^^^^^^^^^^^^^^^^^^ - -error: attributes `project_ref` and `project_replace` are mutually exclusive - --> $DIR/invalid.rs:122:9 - | -122 | #[project_replace] //~ ERROR are mutually exclusive - | ^^^^^^^^^^^^^^^^^^ - -error: attributes `project` and `project_ref` are mutually exclusive - --> $DIR/invalid.rs:130:9 - | -130 | #[project_ref] //~ ERROR are mutually exclusive - | ^^^^^^^^^^^^^^ - -error: attributes `project` and `project_replace` are mutually exclusive - --> $DIR/invalid.rs:138:9 - | -138 | #[project_replace] //~ ERROR are mutually exclusive - | ^^^^^^^^^^^^^^^^^^ - -error: attributes `project_ref` and `project_replace` are mutually exclusive - --> $DIR/invalid.rs:146:9 - | -146 | #[project_replace] //~ ERROR are mutually exclusive - | ^^^^^^^^^^^^^^^^^^ - -error: duplicate #[project] attribute - --> $DIR/invalid.rs:151:5 - | -151 | #[project] //~ ERROR duplicate #[project] attribute - | ^^^^^^^^^^ - -error: duplicate #[project_ref] attribute - --> $DIR/invalid.rs:155:5 - | -155 | #[project_ref] //~ ERROR duplicate #[project_ref] attribute - | ^^^^^^^^^^^^^^ - -error: duplicate #[project_replace] attribute - --> $DIR/invalid.rs:159:5 - | -159 | #[project_replace] //~ ERROR duplicate #[project_replace] attribute - | ^^^^^^^^^^^^^^^^^^ - -error: duplicate #[project] attribute - --> $DIR/invalid.rs:163:5 - | -163 | #[project] //~ ERROR duplicate #[project] attribute - | ^^^^^^^^^^ - -error: duplicate #[project_ref] attribute - --> $DIR/invalid.rs:167:5 - | -167 | #[project_ref] //~ ERROR duplicate #[project_ref] attribute - | ^^^^^^^^^^^^^^ - -error: duplicate #[project_replace] attribute - --> $DIR/invalid.rs:171:5 - | -171 | #[project_replace] //~ ERROR duplicate #[project_replace] attribute - | ^^^^^^^^^^^^^^^^^^ - -error: duplicate #[project] attribute - --> $DIR/invalid.rs:179:9 - | -179 | #[project] //~ ERROR duplicate #[project] attribute - | ^^^^^^^^^^ - -error: duplicate #[project_ref] attribute - --> $DIR/invalid.rs:183:9 - | -183 | #[project_ref] //~ ERROR duplicate #[project_ref] attribute - | ^^^^^^^^^^^^^^ - -error: duplicate #[project_replace] attribute - --> $DIR/invalid.rs:187:9 - | -187 | #[project_replace] //~ ERROR duplicate #[project_replace] attribute - | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/project/type-mismatch.rs b/tests/ui/project/type-mismatch.rs deleted file mode 100644 index 0e40c83..0000000 --- a/tests/ui/project/type-mismatch.rs +++ /dev/null @@ -1,72 +0,0 @@ -#![allow(deprecated)] -#![feature(proc_macro_hygiene, stmt_expr_attributes)] - -use pin_project::{pin_project, project}; -use std::pin::Pin; - -#[project] -fn type_mismatch() { - #[pin_project] - enum Enum<A, B, C, D> { - Variant1(#[pin] A, B), - Variant2 { - #[pin] - field1: C, - field2: D, - }, - None, - } - - let mut foo = Enum::Variant1(1, 2); - let mut foo = Pin::new(&mut foo).project(); - - #[project] - match &mut foo { - Enum::Variant1(x, y) => { - let x: &mut Pin<&mut i32> = x; - assert_eq!(**x, 1); - - let y: &mut &mut i32 = y; - assert_eq!(**y, 2); - } - Enum::Variant2 { field1, field2 } => { - let _x: &mut Pin<&mut i32> = field1; - let _y: &mut &mut i32 = field2; - } - None => {} //~ ERROR mismatched types - } -} - -fn type_mismatch_span_issue() { - #[pin_project] - enum Enum<A, B, C, D> { - Variant1(#[pin] A, B), - Variant2 { - #[pin] - field1: C, - field2: D, - }, - None, - } - - let mut foo = Enum::Variant1(1, 2); - let mut foo = Pin::new(&mut foo).project(); - - #[project] - match &mut foo { - Enum::Variant1(x, y) => { - let x: &mut Pin<&mut i32> = x; - assert_eq!(**x, 1); - - let y: &mut &mut i32 = y; - assert_eq!(**y, 2); - } - Enum::Variant2 { field1, field2 } => { - let _x: &mut Pin<&mut i32> = field1; - let _y: &mut &mut i32 = field2; - } - None => {} //~ ERROR mismatched types - } -} - -fn main() {} diff --git a/tests/ui/project/type-mismatch.stderr b/tests/ui/project/type-mismatch.stderr deleted file mode 100644 index 4199c17..0000000 --- a/tests/ui/project/type-mismatch.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:36:9 - | -24 | match &mut foo { - | -------- this expression has type `&mut type_mismatch::__EnumProjection<'_, {integer}, {integer}, _, _>` -... -36 | None => {} //~ ERROR mismatched types - | ^^^^ expected enum `type_mismatch::__EnumProjection`, found enum `std::option::Option` - | - = note: expected enum `type_mismatch::__EnumProjection<'_, {integer}, {integer}, _, _>` - found enum `std::option::Option<_>` - -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:68:9 - | -56 | match &mut foo { - | -------- this expression has type `&mut type_mismatch_span_issue::__EnumProjection<'_, {integer}, {integer}, _, _>` -... -68 | None => {} //~ ERROR mismatched types - | ^^^^ expected enum `type_mismatch_span_issue::__EnumProjection`, found enum `std::option::Option` - | - = note: expected enum `type_mismatch_span_issue::__EnumProjection<'_, {integer}, {integer}, _, _>` - found enum `std::option::Option<_>` diff --git a/tests/ui/project/use-public.rs b/tests/ui/project/use-public.rs deleted file mode 100644 index aa82a95..0000000 --- a/tests/ui/project/use-public.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![allow(deprecated)] - -use pin_project::pin_project; - -#[pin_project] -struct A { - field: u8, -} - -pub mod b { - use pin_project::project; - - #[project] - pub use crate::A; //~ ERROR E0365 -} - -fn main() {} diff --git a/tests/ui/project/use-public.stderr b/tests/ui/project/use-public.stderr deleted file mode 100644 index 6956656..0000000 --- a/tests/ui/project/use-public.stderr +++ /dev/null @@ -1,7 +0,0 @@ -error[E0365]: `__AProjection` is private, and cannot be re-exported - --> $DIR/use-public.rs:14:13 - | -14 | pub use crate::A; //~ ERROR E0365 - | ^^^^^^^^ re-export of private `__AProjection` - | - = note: consider declaring type or module `__AProjection` with `pub` diff --git a/tests/ui/project/use.rs b/tests/ui/project/use.rs deleted file mode 100644 index ba56382..0000000 --- a/tests/ui/project/use.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![allow(deprecated)] - -use pin_project::pin_project; - -#[pin_project] -struct A { - field: u8, -} - -mod b { - use pin_project::project; - - #[project] - use crate::A as B; //~ ERROR #[project] attribute may not be used on renamed imports - #[project] - use crate::*; //~ ERROR #[project] attribute may not be used on glob imports -} - -fn main() {} diff --git a/tests/ui/project/use.stderr b/tests/ui/project/use.stderr deleted file mode 100644 index daddb16..0000000 --- a/tests/ui/project/use.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: #[project] attribute may not be used on renamed imports - --> $DIR/use.rs:14:16 - | -14 | use crate::A as B; //~ ERROR #[project] attribute may not be used on renamed imports - | ^^^^^^ - -error: #[project] attribute may not be used on glob imports - --> $DIR/use.rs:16:16 - | -16 | use crate::*; //~ ERROR #[project] attribute may not be used on glob imports - | ^ diff --git a/tests/ui/unsafe_unpin/conflict-unpin.rs b/tests/ui/unsafe_unpin/conflict-unpin.rs index e0c8a7b..ac9d1f8 100644 --- a/tests/ui/unsafe_unpin/conflict-unpin.rs +++ b/tests/ui/unsafe_unpin/conflict-unpin.rs @@ -3,8 +3,8 @@ use pin_project::pin_project; #[pin_project(UnsafeUnpin)] //~ ERROR E0119 struct Foo<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } impl<T, U> Unpin for Foo<T, U> where T: Unpin {} @@ -12,8 +12,8 @@ impl<T, U> Unpin for Foo<T, U> where T: Unpin {} #[pin_project(UnsafeUnpin)] //~ ERROR E0119 struct Bar<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } impl<T, U> Unpin for Bar<T, U> {} @@ -21,8 +21,8 @@ impl<T, U> Unpin for Bar<T, U> {} #[pin_project(UnsafeUnpin)] //~ ERROR E0119 struct Baz<T, U> { #[pin] - future: T, - field: U, + f1: T, + f2: U, } impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} diff --git a/tests/ui/unsafe_unpin/not-implement-unsafe-unpin.rs b/tests/ui/unsafe_unpin/not-implement-unsafe-unpin.rs deleted file mode 100644 index 429d60f..0000000 --- a/tests/ui/unsafe_unpin/not-implement-unsafe-unpin.rs +++ /dev/null @@ -1,14 +0,0 @@ -use pin_project::pin_project; - -#[pin_project(UnsafeUnpin)] -struct Struct<T, U> { - #[pin] - inner: T, - other: U, -} - -fn is_unpin<T: Unpin>() {} - -fn main() { - is_unpin::<Struct<(), ()>>(); //~ ERROR E0277 -} diff --git a/tests/ui/unsafe_unpin/not-implement-unsafe-unpin.stderr b/tests/ui/unsafe_unpin/not-implement-unsafe-unpin.stderr deleted file mode 100644 index 0baefe3..0000000 --- a/tests/ui/unsafe_unpin/not-implement-unsafe-unpin.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0277]: the trait bound `Struct<(), ()>: pin_project::UnsafeUnpin` is not satisfied - --> $DIR/not-implement-unsafe-unpin.rs:13:16 - | -10 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -13 | is_unpin::<Struct<(), ()>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^ the trait `pin_project::UnsafeUnpin` is not implemented for `Struct<(), ()>` - | - = note: required because of the requirements on the impl of `pin_project::UnsafeUnpin` for `pin_project::__private::Wrapper<'_, Struct<(), ()>>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Struct<(), ()>` diff --git a/tests/ui/unsafe_unpin/proper_unpin.rs b/tests/ui/unsafe_unpin/proper_unpin.rs deleted file mode 100644 index 6573aec..0000000 --- a/tests/ui/unsafe_unpin/proper_unpin.rs +++ /dev/null @@ -1,41 +0,0 @@ -use pin_project::{pin_project, UnsafeUnpin}; -use std::marker::PhantomPinned; - -fn is_unpin<T: Unpin>() {} - -#[pin_project(UnsafeUnpin)] -struct Blah<T, U> { - field1: U, - #[pin] - field2: T, -} - -unsafe impl<T: Unpin, U> UnsafeUnpin for Blah<T, U> {} - -#[pin_project(UnsafeUnpin)] -struct TrivialBounds { - #[pin] - field1: PhantomPinned, -} - -#[pin_project(UnsafeUnpin)] -struct OverlappingLifetimeNames<'pin, T, U> { - #[pin] - field1: U, - #[pin] - field2: Option<T>, - field3: &'pin (), -} - -unsafe impl<T: Unpin, U: Unpin> UnsafeUnpin for OverlappingLifetimeNames<'_, T, U> {} - -fn main() { - is_unpin::<Blah<PhantomPinned, ()>>(); //~ ERROR E0277 - is_unpin::<Blah<(), PhantomPinned>>(); // Ok - is_unpin::<Blah<PhantomPinned, PhantomPinned>>(); //~ ERROR E0277 - - is_unpin::<TrivialBounds>(); //~ ERROR E0277 - - is_unpin::<OverlappingLifetimeNames<'_, PhantomPinned, ()>>(); //~ ERROR E0277 - is_unpin::<OverlappingLifetimeNames<'_, (), PhantomPinned>>(); //~ ERROR E0277 -} diff --git a/tests/ui/unsafe_unpin/proper_unpin.stderr b/tests/ui/unsafe_unpin/proper_unpin.stderr deleted file mode 100644 index 410dd0e..0000000 --- a/tests/ui/unsafe_unpin/proper_unpin.stderr +++ /dev/null @@ -1,63 +0,0 @@ -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/proper_unpin.rs:33:5 - | -4 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -33 | is_unpin::<Blah<PhantomPinned, ()>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because of the requirements on the impl of `pin_project::UnsafeUnpin` for `Blah<std::marker::PhantomPinned, ()>` - = note: required because of the requirements on the impl of `pin_project::UnsafeUnpin` for `pin_project::__private::Wrapper<'_, Blah<std::marker::PhantomPinned, ()>>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Blah<std::marker::PhantomPinned, ()>` - -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/proper_unpin.rs:35:5 - | -4 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -35 | is_unpin::<Blah<PhantomPinned, PhantomPinned>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because of the requirements on the impl of `pin_project::UnsafeUnpin` for `Blah<std::marker::PhantomPinned, std::marker::PhantomPinned>` - = note: required because of the requirements on the impl of `pin_project::UnsafeUnpin` for `pin_project::__private::Wrapper<'_, Blah<std::marker::PhantomPinned, std::marker::PhantomPinned>>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `Blah<std::marker::PhantomPinned, std::marker::PhantomPinned>` - -error[E0277]: the trait bound `TrivialBounds: pin_project::UnsafeUnpin` is not satisfied - --> $DIR/proper_unpin.rs:37:16 - | -4 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -37 | is_unpin::<TrivialBounds>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^ the trait `pin_project::UnsafeUnpin` is not implemented for `TrivialBounds` - | - = note: required because of the requirements on the impl of `pin_project::UnsafeUnpin` for `pin_project::__private::Wrapper<'_, TrivialBounds>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `TrivialBounds` - -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/proper_unpin.rs:39:5 - | -4 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -39 | is_unpin::<OverlappingLifetimeNames<'_, PhantomPinned, ()>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because of the requirements on the impl of `pin_project::UnsafeUnpin` for `OverlappingLifetimeNames<'_, std::marker::PhantomPinned, ()>` - = note: required because of the requirements on the impl of `pin_project::UnsafeUnpin` for `pin_project::__private::Wrapper<'_, OverlappingLifetimeNames<'_, std::marker::PhantomPinned, ()>>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `OverlappingLifetimeNames<'_, std::marker::PhantomPinned, ()>` - -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/proper_unpin.rs:40:5 - | -4 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -40 | is_unpin::<OverlappingLifetimeNames<'_, (), PhantomPinned>>(); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - = note: required because of the requirements on the impl of `pin_project::UnsafeUnpin` for `OverlappingLifetimeNames<'_, (), std::marker::PhantomPinned>` - = note: required because of the requirements on the impl of `pin_project::UnsafeUnpin` for `pin_project::__private::Wrapper<'_, OverlappingLifetimeNames<'_, (), std::marker::PhantomPinned>>` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `OverlappingLifetimeNames<'_, (), std::marker::PhantomPinned>` diff --git a/tests/ui/unstable-features/marker_trait_attr-feature-gate.rs b/tests/ui/unstable-features/marker_trait_attr-feature-gate.rs index fa4b01e..8860f4f 100644 --- a/tests/ui/unstable-features/marker_trait_attr-feature-gate.rs +++ b/tests/ui/unstable-features/marker_trait_attr-feature-gate.rs @@ -6,7 +6,7 @@ use std::marker::PhantomPinned; #[pin_project] //~ ERROR E0119 struct Struct<T> { #[pin] - x: T, + f: T, } // unsound Unpin impl diff --git a/tests/ui/unstable-features/marker_trait_attr.rs b/tests/ui/unstable-features/marker_trait_attr.rs index 0b8b30a..a6ca357 100644 --- a/tests/ui/unstable-features/marker_trait_attr.rs +++ b/tests/ui/unstable-features/marker_trait_attr.rs @@ -12,7 +12,7 @@ use std::marker::PhantomPinned; #[pin_project] //~ ERROR E0119 struct Struct<T> { #[pin] - x: T, + f: T, } // unsound Unpin impl diff --git a/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs b/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs index 0bd4a32..3af3cf0 100644 --- a/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs +++ b/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs @@ -6,7 +6,7 @@ use std::marker::PhantomPinned; #[pin_project] //~ ERROR E0119 struct Struct<T> { #[pin] - x: T, + f: T, } // unsound Unpin impl diff --git a/tests/ui/unstable-features/overlapping_marker_traits.rs b/tests/ui/unstable-features/overlapping_marker_traits.rs index 27d37a3..c897d1c 100644 --- a/tests/ui/unstable-features/overlapping_marker_traits.rs +++ b/tests/ui/unstable-features/overlapping_marker_traits.rs @@ -16,7 +16,7 @@ use std::marker::PhantomPinned; #[pin_project] struct Struct<T> { #[pin] - x: T, + f: T, } // unsound Unpin impl diff --git a/tests/ui/unstable-features/run-pass/stmt_expr_attributes.rs b/tests/ui/unstable-features/run-pass/stmt_expr_attributes.rs deleted file mode 100644 index 2b6377a..0000000 --- a/tests/ui/unstable-features/run-pass/stmt_expr_attributes.rs +++ /dev/null @@ -1,63 +0,0 @@ -// NB: If you change this test, change 'stmt_expr_attributes-feature-gate.rs' at the same time. - -#![allow(deprecated)] -// proc_macro_hygiene -// Tracking issue: https://github.com/rust-lang/rust/issues/54727 -#![feature(proc_macro_hygiene)] -// stmt_expr_attributes -// Tracking issue: https://github.com/rust-lang/rust/issues/15701 -#![feature(stmt_expr_attributes)] - -use pin_project::{pin_project, project}; -use std::pin::Pin; - -fn project_stmt_expr_nightly() { - #[pin_project] - enum Baz<A, B, C, D> { - Variant1(#[pin] A, B), - Variant2 { - #[pin] - field1: C, - field2: D, - }, - None, - } - - let mut baz = Baz::Variant1(1, 2); - - let mut baz = Pin::new(&mut baz).project(); - - #[project] - match &mut baz { - Baz::Variant1(x, y) => { - let x: &mut Pin<&mut i32> = x; - assert_eq!(**x, 1); - - let y: &mut &mut i32 = y; - assert_eq!(**y, 2); - } - Baz::Variant2 { field1, field2 } => { - let _x: &mut Pin<&mut i32> = field1; - let _y: &mut &mut i32 = field2; - } - Baz::None => {} - } - - let () = #[project] - match &mut baz { - Baz::Variant1(x, y) => { - let x: &mut Pin<&mut i32> = x; - assert_eq!(**x, 1); - - let y: &mut &mut i32 = y; - assert_eq!(**y, 2); - } - Baz::Variant2 { field1, field2 } => { - let _x: &mut Pin<&mut i32> = field1; - let _y: &mut &mut i32 = field2; - } - Baz::None => {} - }; -} - -fn main() {} diff --git a/tests/ui/unstable-features/stmt_expr_attributes-feature-gate.rs b/tests/ui/unstable-features/stmt_expr_attributes-feature-gate.rs deleted file mode 100644 index 5dbe523..0000000 --- a/tests/ui/unstable-features/stmt_expr_attributes-feature-gate.rs +++ /dev/null @@ -1,57 +0,0 @@ -// NB: If you change this test, change 'stmt_expr_attributes.rs' at the same time. - -#![allow(deprecated)] - -use pin_project::{pin_project, project}; -use std::pin::Pin; - -fn project_stmt_expr_nightly() { - #[pin_project] - enum Enum<A, B, C, D> { - Variant1(#[pin] A, B), - Variant2 { - #[pin] - field1: C, - field2: D, - }, - None, - } - - let mut baz = Enum::Variant1(1, 2); - - let mut baz = Pin::new(&mut baz).project(); - - #[project] //~ ERROR E0658 - match &mut baz { - Enum::Variant1(x, y) => { - let x: &mut Pin<&mut i32> = x; - assert_eq!(**x, 1); - - let y: &mut &mut i32 = y; - assert_eq!(**y, 2); - } - Enum::Variant2 { field1, field2 } => { - let _x: &mut Pin<&mut i32> = field1; - let _y: &mut &mut i32 = field2; - } - Enum::None => {} - } - - let () = #[project] //~ ERROR E0658 - match &mut baz { - Enum::Variant1(x, y) => { - let x: &mut Pin<&mut i32> = x; - assert_eq!(**x, 1); - - let y: &mut &mut i32 = y; - assert_eq!(**y, 2); - } - Enum::Variant2 { field1, field2 } => { - let _x: &mut Pin<&mut i32> = field1; - let _y: &mut &mut i32 = field2; - } - Enum::None => {} - }; -} - -fn main() {} diff --git a/tests/ui/unstable-features/stmt_expr_attributes-feature-gate.stderr b/tests/ui/unstable-features/stmt_expr_attributes-feature-gate.stderr deleted file mode 100644 index 3c0501a..0000000 --- a/tests/ui/unstable-features/stmt_expr_attributes-feature-gate.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0658]: attributes on expressions are experimental - --> $DIR/stmt_expr_attributes-feature-gate.rs:24:5 - | -24 | #[project] //~ ERROR E0658 - | ^^^^^^^^^^ - | - = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information - = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable - -error[E0658]: attributes on expressions are experimental - --> $DIR/stmt_expr_attributes-feature-gate.rs:40:14 - | -40 | let () = #[project] //~ ERROR E0658 - | ^^^^^^^^^^ - | - = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information - = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable - -error[E0658]: custom attributes cannot be applied to expressions - --> $DIR/stmt_expr_attributes-feature-gate.rs:24:5 - | -24 | #[project] //~ ERROR E0658 - | ^^^^^^^^^^ - | - = note: see issue #54727 <https://github.com/rust-lang/rust/issues/54727> for more information - = help: add `#![feature(proc_macro_hygiene)]` to the crate attributes to enable - -error[E0658]: custom attributes cannot be applied to expressions - --> $DIR/stmt_expr_attributes-feature-gate.rs:40:14 - | -40 | let () = #[project] //~ ERROR E0658 - | ^^^^^^^^^^ - | - = note: see issue #54727 <https://github.com/rust-lang/rust/issues/54727> for more information - = help: add `#![feature(proc_macro_hygiene)]` to the crate attributes to enable diff --git a/tests/ui/unstable-features/trivial_bounds-bug.stderr b/tests/ui/unstable-features/trivial_bounds-bug.stderr index 8370c45..fff09f9 100644 --- a/tests/ui/unstable-features/trivial_bounds-bug.stderr +++ b/tests/ui/unstable-features/trivial_bounds-bug.stderr @@ -1,5 +1,5 @@ -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned +error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/trivial_bounds-bug.rs:13:43 | 13 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 - | ^^^^^ the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | ^^^^^ the trait `Unpin` is not implemented for `PhantomPinned` diff --git a/tests/ui/unstable-features/trivial_bounds-feature-gate.rs b/tests/ui/unstable-features/trivial_bounds-feature-gate.rs index 0453a3f..ccdb182 100644 --- a/tests/ui/unstable-features/trivial_bounds-feature-gate.rs +++ b/tests/ui/unstable-features/trivial_bounds-feature-gate.rs @@ -21,8 +21,7 @@ mod phantom_pinned { struct C(PhantomPinned); - impl<'a> Unpin for C where WrapperWithLifetime<'a, PhantomPinned>: Unpin {} - // Ok + impl<'a> Unpin for C where WrapperWithLifetime<'a, PhantomPinned>: Unpin {} // Ok } mod inner { diff --git a/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr b/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr index 70450dc..dd151b0 100644 --- a/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr +++ b/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr @@ -1,45 +1,45 @@ -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned +error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/trivial_bounds-feature-gate.rs:8:5 | 8 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `PhantomPinned` | = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned +error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/trivial_bounds-feature-gate.rs:8:43 | 8 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 - | ^^^^^ the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | ^^^^^ the trait `Unpin` is not implemented for `PhantomPinned` -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned +error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/trivial_bounds-feature-gate.rs:16:5 | 16 | impl Unpin for B where Wrapper<PhantomPinned>: Unpin {} //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because of the requirements on the impl of `std::marker::Unpin` for `phantom_pinned::Wrapper<std::marker::PhantomPinned>` + = note: required because of the requirements on the impl of `Unpin` for `phantom_pinned::Wrapper<PhantomPinned>` = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/trivial_bounds-feature-gate.rs:35:5 +error[E0277]: `PhantomPinned` cannot be unpinned + --> $DIR/trivial_bounds-feature-gate.rs:34:5 | -35 | impl Unpin for A where Inner: Unpin {} //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `inner::Inner`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` +34 | impl Unpin for A where Inner: Unpin {} //~ ERROR E0277 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `Inner`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `inner::Inner` + = note: required because it appears within the type `Inner` = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable -error[E0277]: `std::marker::PhantomPinned` cannot be unpinned - --> $DIR/trivial_bounds-feature-gate.rs:43:5 +error[E0277]: `PhantomPinned` cannot be unpinned + --> $DIR/trivial_bounds-feature-gate.rs:42:5 | -43 | impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `inner::Inner`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` +42 | impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR E0277 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `Inner`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `inner::Inner` - = note: required because of the requirements on the impl of `std::marker::Unpin` for `inner::Wrapper<inner::Inner>` + = note: required because it appears within the type `Inner` + = note: required because of the requirements on the impl of `Unpin` for `inner::Wrapper<Inner>` = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable diff --git a/tests/ui/unstable-features/trivial_bounds.stderr b/tests/ui/unstable-features/trivial_bounds.stderr index 03d0161..6a3bb94 100644 --- a/tests/ui/unstable-features/trivial_bounds.stderr +++ b/tests/ui/unstable-features/trivial_bounds.stderr @@ -1,4 +1,4 @@ -error: Trait bound inner::Inner: std::marker::Unpin does not depend on any type or lifetime parameters +error: Trait bound Inner: Unpin does not depend on any type or lifetime parameters --> $DIR/trivial_bounds.rs:15:35 | 15 | impl Unpin for A where Inner: Unpin {} //~ ERROR std::marker::Unpin does not depend on any type or lifetime parameters @@ -10,7 +10,7 @@ note: the lint level is defined here 6 | #![deny(trivial_bounds)] | ^^^^^^^^^^^^^^ -error: Trait bound inner::Wrapper<inner::Inner>: std::marker::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 --> $DIR/trivial_bounds.rs:23:44 | 23 | impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR std::marker::Unpin does not depend on any type or lifetime parameters |