diff options
Diffstat (limited to 'third_party/rust/pin-project-lite/tests/ui')
20 files changed, 561 insertions, 0 deletions
diff --git a/third_party/rust/pin-project-lite/tests/ui/conflict-drop.rs b/third_party/rust/pin-project-lite/tests/ui/conflict-drop.rs new file mode 100644 index 0000000000..870059d62f --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/conflict-drop.rs @@ -0,0 +1,15 @@ +use pin_project_lite::pin_project; + +pin_project! { //~ ERROR E0119 + struct Foo<T, U> { + #[pin] + future: T, + field: U, + } +} + +impl<T, U> Drop for Foo<T, U> { + fn drop(&mut self) {} +} + +fn main() {} diff --git a/third_party/rust/pin-project-lite/tests/ui/conflict-drop.stderr b/third_party/rust/pin-project-lite/tests/ui/conflict-drop.stderr new file mode 100644 index 0000000000..6679d3d244 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/conflict-drop.stderr @@ -0,0 +1,16 @@ +error[E0119]: conflicting implementations of trait `_::MustNotImplDrop` for type `Foo<_, _>`: + --> $DIR/conflict-drop.rs:3:1 + | +3 | / pin_project! { //~ ERROR E0119 +4 | | struct Foo<T, U> { +5 | | #[pin] +6 | | future: T, +7 | | field: U, +8 | | } +9 | | } + | | ^ + | | | + | |_first implementation here + | conflicting implementation for `Foo<_, _>` + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/third_party/rust/pin-project-lite/tests/ui/conflict-unpin.rs b/third_party/rust/pin-project-lite/tests/ui/conflict-unpin.rs new file mode 100644 index 0000000000..f702f064de --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/conflict-unpin.rs @@ -0,0 +1,40 @@ +use pin_project_lite::pin_project; + +// The same implementation. + +pin_project! { //~ ERROR E0119 + struct Foo<T, U> { + #[pin] + future: T, + field: U, + } +} + +// conflicting implementations +impl<T, U> Unpin for Foo<T, U> where T: Unpin {} // Conditional Unpin impl + +// The implementation that under different conditions. + +pin_project! { //~ ERROR E0119 + struct Bar<T, U> { + #[pin] + future: T, + field: U, + } +} + +// conflicting implementations +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, + } +} + +// conflicting implementations +impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} // Conditional Unpin impl + +fn main() {} diff --git a/third_party/rust/pin-project-lite/tests/ui/conflict-unpin.stderr b/third_party/rust/pin-project-lite/tests/ui/conflict-unpin.stderr new file mode 100644 index 0000000000..8065fde58b --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/conflict-unpin.stderr @@ -0,0 +1,50 @@ +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`: + --> $DIR/conflict-unpin.rs:5:1 + | +5 | / pin_project! { //~ ERROR E0119 +6 | | struct Foo<T, U> { +7 | | #[pin] +8 | | future: T, +9 | | field: U, +10 | | } +11 | | } + | |_^ conflicting implementation for `Foo<_, _>` +... +14 | impl<T, U> Unpin for Foo<T, U> where T: Unpin {} // Conditional Unpin impl + | --------------------------------------------- first implementation here + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`: + --> $DIR/conflict-unpin.rs:18:1 + | +18 | / pin_project! { //~ ERROR E0119 +19 | | struct Bar<T, U> { +20 | | #[pin] +21 | | future: T, +22 | | field: U, +23 | | } +24 | | } + | |_^ conflicting implementation for `Bar<_, _>` +... +27 | impl<T, U> Unpin for Bar<T, U> {} // Non-conditional Unpin impl + | ------------------------------ first implementation here + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`: + --> $DIR/conflict-unpin.rs:29:1 + | +29 | / pin_project! { //~ ERROR E0119 +30 | | struct Baz<T, U> { +31 | | #[pin] +32 | | future: T, +33 | | field: U, +34 | | } +35 | | } + | |_^ conflicting implementation for `Baz<_, _>` +... +38 | impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} // Conditional Unpin impl + | -------------------------------------------- first implementation here + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/third_party/rust/pin-project-lite/tests/ui/invalid-bounds.rs b/third_party/rust/pin-project-lite/tests/ui/invalid-bounds.rs new file mode 100644 index 0000000000..980bb952ea --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/invalid-bounds.rs @@ -0,0 +1,15 @@ +use pin_project_lite::pin_project; + +pin_project! { + struct A<T: 'static : ?Sized> { //~ ERROR no rules expected the token `:` + field: T, + } +} + +pin_project! { + struct B<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` + field: T, + } +} + +fn main() {} diff --git a/third_party/rust/pin-project-lite/tests/ui/invalid-bounds.stderr b/third_party/rust/pin-project-lite/tests/ui/invalid-bounds.stderr new file mode 100644 index 0000000000..ebd1da8179 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/invalid-bounds.stderr @@ -0,0 +1,21 @@ +error: no rules expected the token `:` + --> $DIR/invalid-bounds.rs:4:25 + | +4 | struct A<T: 'static : ?Sized> { //~ ERROR no rules expected the token `:` + | ^ no rules expected this token in macro call + +error: expected one of `+`, `,`, `=`, or `>`, found `:` + --> $DIR/invalid-bounds.rs:9:1 + | +9 | / pin_project! { +10 | | struct B<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` +11 | | field: T, +12 | | } +13 | | } + | | ^ + | | | + | | expected one of `+`, `,`, `=`, or `>` + | |_unexpected token + | in this macro invocation + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/third_party/rust/pin-project-lite/tests/ui/invalid.rs b/third_party/rust/pin-project-lite/tests/ui/invalid.rs new file mode 100644 index 0000000000..e0ea61d4f7 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/invalid.rs @@ -0,0 +1,25 @@ +use pin_project_lite::pin_project; + +pin_project! { + struct A<T> { + #[pin()] //~ ERROR no rules expected the token `(` + pinned: T, + } +} + +pin_project! { + #[pin] //~ ERROR cannot find attribute `pin` in this scope + struct B<T> { + pinned: T, + } +} + +pin_project! { + struct C<T> { + #[pin] + #[pin] //~ ERROR no rules expected the token `#` + pinned: T, + } +} + +fn main() {} diff --git a/third_party/rust/pin-project-lite/tests/ui/invalid.stderr b/third_party/rust/pin-project-lite/tests/ui/invalid.stderr new file mode 100644 index 0000000000..f780e2e69a --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/invalid.stderr @@ -0,0 +1,17 @@ +error: no rules expected the token `(` + --> $DIR/invalid.rs:5:14 + | +5 | #[pin()] //~ ERROR no rules expected the token `(` + | ^ no rules expected this token in macro call + +error: no rules expected the token `#` + --> $DIR/invalid.rs:20:9 + | +20 | #[pin] //~ ERROR no rules expected the token `#` + | ^ no rules expected this token in macro call + +error: cannot find attribute `pin` in this scope + --> $DIR/invalid.rs:11:7 + | +11 | #[pin] //~ ERROR cannot find attribute `pin` in this scope + | ^^^ diff --git a/third_party/rust/pin-project-lite/tests/ui/overlapping_lifetime_names.rs b/third_party/rust/pin-project-lite/tests/ui/overlapping_lifetime_names.rs new file mode 100644 index 0000000000..87a737e2fa --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/overlapping_lifetime_names.rs @@ -0,0 +1,10 @@ +use pin_project_lite::pin_project; + +pin_project! { //~ ERROR E0496 + pub struct Foo<'__pin, T> { //~ ERROR E0263 + #[pin] + field: &'__pin mut T, + } +} + +fn main() {} diff --git a/third_party/rust/pin-project-lite/tests/ui/overlapping_lifetime_names.stderr b/third_party/rust/pin-project-lite/tests/ui/overlapping_lifetime_names.stderr new file mode 100644 index 0000000000..db4f5a8bb0 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/overlapping_lifetime_names.stderr @@ -0,0 +1,83 @@ +error[E0263]: lifetime name `'__pin` declared twice in the same scope + --> $DIR/overlapping_lifetime_names.rs:4:20 + | +3 | / pin_project! { //~ ERROR E0496 +4 | | pub struct Foo<'__pin, T> { //~ ERROR E0263 + | | ^^^^^^ declared twice +5 | | #[pin] +6 | | field: &'__pin mut T, +7 | | } +8 | | } + | |_- previous declaration here + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error[E0263]: lifetime name `'__pin` declared twice in the same scope + --> $DIR/overlapping_lifetime_names.rs:4:20 + | +3 | / pin_project! { //~ ERROR E0496 +4 | | pub struct Foo<'__pin, T> { //~ ERROR E0263 + | | ^^^^^^ declared twice +5 | | #[pin] +6 | | field: &'__pin mut T, +7 | | } +8 | | } + | |_- previous declaration here + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in scope + --> $DIR/overlapping_lifetime_names.rs:3:1 + | +3 | / pin_project! { //~ ERROR E0496 +4 | | pub struct Foo<'__pin, T> { //~ ERROR E0263 + | | ------ first declared here +5 | | #[pin] +6 | | field: &'__pin mut T, +7 | | } +8 | | } + | |_^ lifetime '__pin already in scope + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in scope + --> $DIR/overlapping_lifetime_names.rs:3:1 + | +3 | / pin_project! { //~ ERROR E0496 +4 | | pub struct Foo<'__pin, T> { //~ ERROR E0263 + | | ------ first declared here +5 | | #[pin] +6 | | field: &'__pin mut T, +7 | | } +8 | | } + | |_^ lifetime '__pin already in scope + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error[E0263]: lifetime name `'__pin` declared twice in the same scope + --> $DIR/overlapping_lifetime_names.rs:4:20 + | +3 | / pin_project! { //~ ERROR E0496 +4 | | pub struct Foo<'__pin, T> { //~ ERROR E0263 + | | ^^^^^^ declared twice +5 | | #[pin] +6 | | field: &'__pin mut T, +7 | | } +8 | | } + | |_- previous declaration here + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error[E0263]: lifetime name `'__pin` declared twice in the same scope + --> $DIR/overlapping_lifetime_names.rs:4:20 + | +3 | / pin_project! { //~ ERROR E0496 +4 | | pub struct Foo<'__pin, T> { //~ ERROR E0263 + | | ^^^^^^ declared twice +5 | | #[pin] +6 | | field: &'__pin mut T, +7 | | } +8 | | } + | |_- previous declaration here + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/third_party/rust/pin-project-lite/tests/ui/overlapping_unpin_struct.rs b/third_party/rust/pin-project-lite/tests/ui/overlapping_unpin_struct.rs new file mode 100644 index 0000000000..1338524307 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/overlapping_unpin_struct.rs @@ -0,0 +1,19 @@ +use pin_project_lite::pin_project; +use std::marker::PhantomPinned; + +pin_project! { + struct Foo<T> { + #[pin] + inner: T, + } +} + +struct __Origin {} + +impl Unpin for __Origin {} + +fn is_unpin<T: Unpin>() {} + +fn main() { + is_unpin::<Foo<PhantomPinned>>(); //~ ERROR E0277 +} diff --git a/third_party/rust/pin-project-lite/tests/ui/overlapping_unpin_struct.stderr b/third_party/rust/pin-project-lite/tests/ui/overlapping_unpin_struct.stderr new file mode 100644 index 0000000000..73db6f932b --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/overlapping_unpin_struct.stderr @@ -0,0 +1,13 @@ +error[E0277]: the trait bound `std::marker::PhantomPinned: std::marker::Unpin` is not satisfied in `_::__Origin<'_, std::marker::PhantomPinned>` + --> $DIR/overlapping_unpin_struct.rs:18:5 + | +15 | fn is_unpin<T: Unpin>() {} + | -------- ----- required by this bound in `is_unpin` +... +18 | is_unpin::<Foo<PhantomPinned>>(); //~ ERROR E0277 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__Origin<'_, std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | + = help: the following implementations were found: + <std::marker::PhantomPinned as std::marker::Unpin> + = note: required because it appears within the type `_::__Origin<'_, std::marker::PhantomPinned>` + = note: required because of the requirements on the impl of `std::marker::Unpin` for `Foo<std::marker::PhantomPinned>` diff --git a/third_party/rust/pin-project-lite/tests/ui/packed.rs b/third_party/rust/pin-project-lite/tests/ui/packed.rs new file mode 100644 index 0000000000..0bccc1f216 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/packed.rs @@ -0,0 +1,19 @@ +use pin_project_lite::pin_project; + +pin_project! { //~ ERROR borrow of packed field is unsafe and requires unsafe function or block + #[repr(packed, C)] + struct A { + #[pin] + field: u16, + } +} + +pin_project! { //~ ERROR borrow of packed field is unsafe and requires unsafe function or block + #[repr(packed(2))] + struct C { + #[pin] + field: u32, + } +} + +fn main() {} diff --git a/third_party/rust/pin-project-lite/tests/ui/packed.stderr b/third_party/rust/pin-project-lite/tests/ui/packed.stderr new file mode 100644 index 0000000000..1853377dec --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/packed.stderr @@ -0,0 +1,55 @@ +error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) + --> $DIR/packed.rs:3:1 + | +3 | / pin_project! { //~ ERROR borrow of packed field is unsafe and requires unsafe function or block +4 | | #[repr(packed, C)] +5 | | struct A { +6 | | #[pin] +7 | | field: u16, +8 | | } +9 | | } + | |_^ + | +note: lint level defined here + --> $DIR/packed.rs:3:1 + | +3 | / pin_project! { //~ ERROR borrow of packed field is unsafe and requires unsafe function or block +4 | | #[repr(packed, C)] +5 | | struct A { +6 | | #[pin] +7 | | field: u16, +8 | | } +9 | | } + | |_^ + = 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 + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) + --> $DIR/packed.rs:11:1 + | +11 | / pin_project! { //~ ERROR borrow of packed field is unsafe and requires unsafe function or block +12 | | #[repr(packed(2))] +13 | | struct C { +14 | | #[pin] +15 | | field: u32, +16 | | } +17 | | } + | |_^ + | +note: lint level defined here + --> $DIR/packed.rs:11:1 + | +11 | / pin_project! { //~ ERROR borrow of packed field is unsafe and requires unsafe function or block +12 | | #[repr(packed(2))] +13 | | struct C { +14 | | #[pin] +15 | | field: u32, +16 | | } +17 | | } + | |_^ + = 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 + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/third_party/rust/pin-project-lite/tests/ui/proper_unpin.rs b/third_party/rust/pin-project-lite/tests/ui/proper_unpin.rs new file mode 100644 index 0000000000..3c85f2d77f --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/proper_unpin.rs @@ -0,0 +1,41 @@ +use pin_project_lite::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! { + pub 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/third_party/rust/pin-project-lite/tests/ui/proper_unpin.stderr b/third_party/rust/pin-project-lite/tests/ui/proper_unpin.stderr new file mode 100644 index 0000000000..52eb80223e --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/proper_unpin.stderr @@ -0,0 +1,43 @@ +error[E0277]: the trait bound `std::marker::PhantomPinned: std::marker::Unpin` is not satisfied in `_::__Origin<'_, std::marker::PhantomPinned, ()>` + --> $DIR/proper_unpin.rs:34:5 + | +31 | fn is_unpin<T: Unpin>() {} + | -------- ----- required by this bound in `is_unpin` +... +34 | is_unpin::<Foo<PhantomPinned, ()>>(); //~ ERROR E0277 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__Origin<'_, std::marker::PhantomPinned, ()>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | + = help: the following implementations were found: + <std::marker::PhantomPinned as std::marker::Unpin> + = note: required because it appears within the type `Inner<std::marker::PhantomPinned>` + = note: required because it appears within the type `_::__Origin<'_, std::marker::PhantomPinned, ()>` + = note: required because of the requirements on the impl of `std::marker::Unpin` for `Foo<std::marker::PhantomPinned, ()>` + +error[E0277]: the trait bound `std::marker::PhantomPinned: std::marker::Unpin` is not satisfied in `_::__Origin<'_, std::marker::PhantomPinned, std::marker::PhantomPinned>` + --> $DIR/proper_unpin.rs:36:5 + | +31 | fn is_unpin<T: Unpin>() {} + | -------- ----- required by this bound in `is_unpin` +... +36 | is_unpin::<Foo<PhantomPinned, PhantomPinned>>(); //~ ERROR E0277 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__Origin<'_, std::marker::PhantomPinned, std::marker::PhantomPinned>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | + = help: the following implementations were found: + <std::marker::PhantomPinned as std::marker::Unpin> + = note: required because it appears within the type `Inner<std::marker::PhantomPinned>` + = note: required because it appears within the type `_::__Origin<'_, 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]: the trait bound `std::marker::PhantomPinned: std::marker::Unpin` is not satisfied in `_::__Origin<'_>` + --> $DIR/proper_unpin.rs:38:5 + | +31 | fn is_unpin<T: Unpin>() {} + | -------- ----- required by this bound in `is_unpin` +... +38 | is_unpin::<TrivialBounds>(); //~ ERROR E0277 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__Origin<'_>`, the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` + | + = help: the following implementations were found: + <std::marker::PhantomPinned as std::marker::Unpin> + = note: required because it appears within the type `_::__Origin<'_>` + = note: required because of the requirements on the impl of `std::marker::Unpin` for `TrivialBounds` diff --git a/third_party/rust/pin-project-lite/tests/ui/unpin_sneaky.rs b/third_party/rust/pin-project-lite/tests/ui/unpin_sneaky.rs new file mode 100644 index 0000000000..984cc2a219 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/unpin_sneaky.rs @@ -0,0 +1,12 @@ +use pin_project_lite::pin_project; + +pin_project! { + struct Foo { + #[pin] + inner: u8, + } +} + +impl Unpin for __Origin {} //~ ERROR E0412,E0321 + +fn main() {} diff --git a/third_party/rust/pin-project-lite/tests/ui/unpin_sneaky.stderr b/third_party/rust/pin-project-lite/tests/ui/unpin_sneaky.stderr new file mode 100644 index 0000000000..77ad2dc315 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/unpin_sneaky.stderr @@ -0,0 +1,11 @@ +error[E0412]: cannot find type `__Origin` in this scope + --> $DIR/unpin_sneaky.rs:10:16 + | +10 | impl Unpin for __Origin {} //~ 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]` + --> $DIR/unpin_sneaky.rs:10:1 + | +10 | impl Unpin for __Origin {} //~ ERROR E0412,E0321 + | ^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type diff --git a/third_party/rust/pin-project-lite/tests/ui/unsupported.rs b/third_party/rust/pin-project-lite/tests/ui/unsupported.rs new file mode 100644 index 0000000000..2f80836275 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/unsupported.rs @@ -0,0 +1,27 @@ +use pin_project_lite::pin_project; + +pin_project! { + struct Struct1 {} //~ ERROR no rules expected the token `}` +} + +pin_project! { + struct Struct2(); //~ ERROR no rules expected the token `(` +} + +pin_project! { + struct Struct3; //~ ERROR no rules expected the token `;` +} + +pin_project! { + enum Enum { //~ ERROR no rules expected the token `enum` + A(u8) + } +} + +pin_project! { + union Union { //~ ERROR no rules expected the token `union` + x: u8, + } +} + +fn main() {} diff --git a/third_party/rust/pin-project-lite/tests/ui/unsupported.stderr b/third_party/rust/pin-project-lite/tests/ui/unsupported.stderr new file mode 100644 index 0000000000..4f7b1aed09 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/unsupported.stderr @@ -0,0 +1,29 @@ +error: no rules expected the token `}` + --> $DIR/unsupported.rs:4:21 + | +4 | struct Struct1 {} //~ ERROR no rules expected the token `}` + | ^ no rules expected this token in macro call + +error: no rules expected the token `(` + --> $DIR/unsupported.rs:8:19 + | +8 | struct Struct2(); //~ ERROR no rules expected the token `(` + | ^ no rules expected this token in macro call + +error: no rules expected the token `;` + --> $DIR/unsupported.rs:12:19 + | +12 | struct Struct3; //~ ERROR no rules expected the token `;` + | ^ no rules expected this token in macro call + +error: no rules expected the token `enum` + --> $DIR/unsupported.rs:16:5 + | +16 | enum Enum { //~ ERROR no rules expected the token `enum` + | ^^^^ no rules expected this token in macro call + +error: no rules expected the token `union` + --> $DIR/unsupported.rs:22:5 + | +22 | union Union { //~ ERROR no rules expected the token `union` + | ^^^^^ no rules expected this token in macro call |