diff options
Diffstat (limited to 'third_party/rust/pin-project-lite/tests/ui')
22 files changed, 1174 insertions, 0 deletions
diff --git a/third_party/rust/pin-project-lite/tests/ui/pin_project/conflict-drop.rs b/third_party/rust/pin-project-lite/tests/ui/pin_project/conflict-drop.rs new file mode 100644 index 0000000000..870059d62f --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/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/pin_project/conflict-drop.stderr b/third_party/rust/pin-project-lite/tests/ui/pin_project/conflict-drop.stderr new file mode 100644 index 0000000000..66872bd4bd --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/conflict-drop.stderr @@ -0,0 +1,16 @@ +error[E0119]: conflicting implementations of trait `_::MustNotImplDrop` for type `Foo<_, _>` + --> tests/ui/pin_project/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 the macro `$crate::__pin_project_make_drop_impl` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/third_party/rust/pin-project-lite/tests/ui/pin_project/conflict-unpin.rs b/third_party/rust/pin-project-lite/tests/ui/pin_project/conflict-unpin.rs new file mode 100644 index 0000000000..f702f064de --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/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/pin_project/conflict-unpin.stderr b/third_party/rust/pin-project-lite/tests/ui/pin_project/conflict-unpin.stderr new file mode 100644 index 0000000000..bd30fafdd3 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/conflict-unpin.stderr @@ -0,0 +1,50 @@ +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>` + --> tests/ui/pin_project/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 the macro `$crate::__pin_project_make_unpin_impl` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>` + --> tests/ui/pin_project/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 the macro `$crate::__pin_project_make_unpin_impl` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>` + --> tests/ui/pin_project/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 the macro `$crate::__pin_project_make_unpin_impl` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/third_party/rust/pin-project-lite/tests/ui/pin_project/invalid-bounds.rs b/third_party/rust/pin-project-lite/tests/ui/pin_project/invalid-bounds.rs new file mode 100644 index 0000000000..64b397a37e --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/invalid-bounds.rs @@ -0,0 +1,93 @@ +use pin_project_lite::pin_project; + +pin_project! { + struct Generics1<T: 'static : Sized> { //~ ERROR no rules expected the token `:` + field: T, + } +} + +pin_project! { + struct Generics2<T: 'static : ?Sized> { //~ ERROR no rules expected the token `:` + field: T, + } +} + +pin_project! { + struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` + field: T, + } +} + +pin_project! { + struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` + field: T, + } +} + +pin_project! { + struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` + field: T, + } +} + +pin_project! { + struct Generics6<T: ?Sized : Sized> { //~ ERROR no rules expected the token `Sized` + field: T, + } +} + +pin_project! { + struct WhereClause1<T> + where + T: 'static : Sized //~ ERROR no rules expected the token `:` + { + field: T, + } +} + +pin_project! { + struct WhereClause2<T> + where + T: 'static : ?Sized //~ ERROR no rules expected the token `:` + { + field: T, + } +} + +pin_project! { + struct WhereClause3<T> + where + T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:` + { + field: T, + } +} + +pin_project! { + struct WhereClause4<T> + where + T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:` + { + field: T, + } +} + +pin_project! { + struct WhereClause5<T> + where + T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:` + { + field: T, + } +} + +pin_project! { + struct WhereClause6<T> + where + T: ?Sized : Sized //~ ERROR no rules expected the token `Sized` + { + field: T, + } +} + +fn main() {} diff --git a/third_party/rust/pin-project-lite/tests/ui/pin_project/invalid-bounds.stderr b/third_party/rust/pin-project-lite/tests/ui/pin_project/invalid-bounds.stderr new file mode 100644 index 0000000000..40e79bf928 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/invalid-bounds.stderr @@ -0,0 +1,428 @@ +error: no rules expected the token `:` + --> tests/ui/pin_project/invalid-bounds.rs:4:33 + | +4 | struct Generics1<T: 'static : Sized> { //~ ERROR no rules expected the token `:` + | ^ no rules expected this token in macro call + +error: no rules expected the token `:` + --> tests/ui/pin_project/invalid-bounds.rs:10:33 + | +10 | struct Generics2<T: 'static : ?Sized> { //~ ERROR no rules expected the token `:` + | ^ no rules expected this token in macro call + +error: expected one of `+`, `,`, `=`, or `>`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:15:1 + | +15 | / pin_project! { +16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` +17 | | field: T, +18 | | } +19 | | } + | | ^ + | | | + | | expected one of `+`, `,`, `=`, or `>` + | |_unexpected token + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, `=`, or `>`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:15:1 + | +15 | / pin_project! { +16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` +17 | | field: T, +18 | | } +19 | | } + | | ^ + | | | + | |_expected one of `+`, `,`, `=`, or `>` + | unexpected token + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, `=`, or `>`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:15:1 + | +15 | / pin_project! { +16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` +17 | | field: T, +18 | | } +19 | | } + | | ^ + | | | + | | expected one of `+`, `,`, `=`, or `>` + | |_unexpected token + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, `=`, or `>`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:15:1 + | +15 | / pin_project! { +16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` +17 | | field: T, +18 | | } +19 | | } + | | ^ + | | | + | | expected one of `+`, `,`, `=`, or `>` + | |_unexpected token + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, `=`, or `>`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:21:1 + | +21 | / pin_project! { +22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` +23 | | field: T, +24 | | } +25 | | } + | | ^ + | | | + | | expected one of `+`, `,`, `=`, or `>` + | |_unexpected token + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, `=`, or `>`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:21:1 + | +21 | / pin_project! { +22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` +23 | | field: T, +24 | | } +25 | | } + | | ^ + | | | + | |_expected one of `+`, `,`, `=`, or `>` + | unexpected token + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, `=`, or `>`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:21:1 + | +21 | / pin_project! { +22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` +23 | | field: T, +24 | | } +25 | | } + | | ^ + | | | + | | expected one of `+`, `,`, `=`, or `>` + | |_unexpected token + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, `=`, or `>`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:21:1 + | +21 | / pin_project! { +22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` +23 | | field: T, +24 | | } +25 | | } + | | ^ + | | | + | | expected one of `+`, `,`, `=`, or `>` + | |_unexpected token + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, `=`, or `>`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:27:1 + | +27 | / pin_project! { +28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` +29 | | field: T, +30 | | } +31 | | } + | | ^ + | | | + | | expected one of `+`, `,`, `=`, or `>` + | |_unexpected token + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, `=`, or `>`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:27:1 + | +27 | / pin_project! { +28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` +29 | | field: T, +30 | | } +31 | | } + | | ^ + | | | + | |_expected one of `+`, `,`, `=`, or `>` + | unexpected token + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, `=`, or `>`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:27:1 + | +27 | / pin_project! { +28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` +29 | | field: T, +30 | | } +31 | | } + | | ^ + | | | + | | expected one of `+`, `,`, `=`, or `>` + | |_unexpected token + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, `=`, or `>`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:27:1 + | +27 | / pin_project! { +28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:` +29 | | field: T, +30 | | } +31 | | } + | | ^ + | | | + | | expected one of `+`, `,`, `=`, or `>` + | |_unexpected token + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: no rules expected the token `Sized` + --> tests/ui/pin_project/invalid-bounds.rs:34:34 + | +34 | struct Generics6<T: ?Sized : Sized> { //~ ERROR no rules expected the token `Sized` + | ^^^^^ no rules expected this token in macro call + +error: no rules expected the token `:` + --> tests/ui/pin_project/invalid-bounds.rs:42:20 + | +42 | T: 'static : Sized //~ ERROR no rules expected the token `:` + | ^ no rules expected this token in macro call + +error: no rules expected the token `:` + --> tests/ui/pin_project/invalid-bounds.rs:51:20 + | +51 | T: 'static : ?Sized //~ ERROR no rules expected the token `:` + | ^ no rules expected this token in macro call + +error: expected `{` after struct name, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:57:1 + | +57 | / pin_project! { +58 | | struct WhereClause3<T> +59 | | where +60 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:` +... | +63 | | } +64 | | } + | | ^ + | | | + | |_expected `{` after struct name + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, or `{`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:57:1 + | +57 | / pin_project! { +58 | | struct WhereClause3<T> +59 | | where +60 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:` +... | +63 | | } +64 | | } + | | ^ + | | | + | |_expected one of `+`, `,`, or `{` + | unexpected token + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected `{` after struct name, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:57:1 + | +57 | / pin_project! { +58 | | struct WhereClause3<T> +59 | | where +60 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:` +... | +63 | | } +64 | | } + | | ^ + | | | + | |_expected `{` after struct name + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected `{` after struct name, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:57:1 + | +57 | / pin_project! { +58 | | struct WhereClause3<T> +59 | | where +60 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:` +... | +63 | | } +64 | | } + | | ^ + | | | + | |_expected `{` after struct name + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected `{` after struct name, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:66:1 + | +66 | / pin_project! { +67 | | struct WhereClause4<T> +68 | | where +69 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:` +... | +72 | | } +73 | | } + | | ^ + | | | + | |_expected `{` after struct name + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, or `{`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:66:1 + | +66 | / pin_project! { +67 | | struct WhereClause4<T> +68 | | where +69 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:` +... | +72 | | } +73 | | } + | | ^ + | | | + | |_expected one of `+`, `,`, or `{` + | unexpected token + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected `{` after struct name, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:66:1 + | +66 | / pin_project! { +67 | | struct WhereClause4<T> +68 | | where +69 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:` +... | +72 | | } +73 | | } + | | ^ + | | | + | |_expected `{` after struct name + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected `{` after struct name, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:66:1 + | +66 | / pin_project! { +67 | | struct WhereClause4<T> +68 | | where +69 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:` +... | +72 | | } +73 | | } + | | ^ + | | | + | |_expected `{` after struct name + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected `{` after struct name, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:75:1 + | +75 | / pin_project! { +76 | | struct WhereClause5<T> +77 | | where +78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:` +... | +81 | | } +82 | | } + | | ^ + | | | + | |_expected `{` after struct name + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected one of `+`, `,`, or `{`, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:75:1 + | +75 | / pin_project! { +76 | | struct WhereClause5<T> +77 | | where +78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:` +... | +81 | | } +82 | | } + | | ^ + | | | + | |_expected one of `+`, `,`, or `{` + | unexpected token + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected `{` after struct name, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:75:1 + | +75 | / pin_project! { +76 | | struct WhereClause5<T> +77 | | where +78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:` +... | +81 | | } +82 | | } + | | ^ + | | | + | |_expected `{` after struct name + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected `{` after struct name, found `:` + --> tests/ui/pin_project/invalid-bounds.rs:75:1 + | +75 | / pin_project! { +76 | | struct WhereClause5<T> +77 | | where +78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:` +... | +81 | | } +82 | | } + | | ^ + | | | + | |_expected `{` after struct name + | in this macro invocation + | + = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: no rules expected the token `Sized` + --> tests/ui/pin_project/invalid-bounds.rs:87:21 + | +87 | T: ?Sized : Sized //~ ERROR no rules expected the token `Sized` + | ^^^^^ no rules expected this token in macro call diff --git a/third_party/rust/pin-project-lite/tests/ui/pin_project/invalid.rs b/third_party/rust/pin-project-lite/tests/ui/pin_project/invalid.rs new file mode 100644 index 0000000000..e0ea61d4f7 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/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/pin_project/invalid.stderr b/third_party/rust/pin-project-lite/tests/ui/pin_project/invalid.stderr new file mode 100644 index 0000000000..623a886722 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/invalid.stderr @@ -0,0 +1,59 @@ +error: no rules expected the token `struct` + --> tests/ui/pin_project/invalid.rs:3:1 + | +3 | / pin_project! { +4 | | struct A<T> { +5 | | #[pin()] //~ ERROR no rules expected the token `(` +6 | | pinned: T, +7 | | } +8 | | } + | |_^ no rules expected this token in macro call + | + = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: no rules expected the token `struct` + --> tests/ui/pin_project/invalid.rs:3:1 + | +3 | / pin_project! { +4 | | struct A<T> { +5 | | #[pin()] //~ ERROR no rules expected the token `(` +6 | | pinned: T, +7 | | } +8 | | } + | |_^ no rules expected this token in macro call + | + = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: no rules expected the token `struct` + --> tests/ui/pin_project/invalid.rs:17:1 + | +17 | / pin_project! { +18 | | struct C<T> { +19 | | #[pin] +20 | | #[pin] //~ ERROR no rules expected the token `#` +21 | | pinned: T, +22 | | } +23 | | } + | |_^ no rules expected this token in macro call + | + = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: no rules expected the token `struct` + --> tests/ui/pin_project/invalid.rs:17:1 + | +17 | / pin_project! { +18 | | struct C<T> { +19 | | #[pin] +20 | | #[pin] //~ ERROR no rules expected the token `#` +21 | | pinned: T, +22 | | } +23 | | } + | |_^ no rules expected this token in macro call + | + = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: cannot find attribute `pin` in this scope + --> tests/ui/pin_project/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/pin_project/overlapping_lifetime_names.rs b/third_party/rust/pin-project-lite/tests/ui/pin_project/overlapping_lifetime_names.rs new file mode 100644 index 0000000000..117c18d74c --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/overlapping_lifetime_names.rs @@ -0,0 +1,10 @@ +use pin_project_lite::pin_project; + +pin_project! { //~ ERROR E0263,E0496 + pub struct Foo<'__pin, T> { + #[pin] + field: &'__pin mut T, + } +} + +fn main() {} diff --git a/third_party/rust/pin-project-lite/tests/ui/pin_project/overlapping_lifetime_names.stderr b/third_party/rust/pin-project-lite/tests/ui/pin_project/overlapping_lifetime_names.stderr new file mode 100644 index 0000000000..35074d0753 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/overlapping_lifetime_names.stderr @@ -0,0 +1,75 @@ +error[E0263]: lifetime name `'__pin` declared twice in the same scope + --> tests/ui/pin_project/overlapping_lifetime_names.rs:4:20 + | +3 | / pin_project! { //~ ERROR E0263,E0496 +4 | | pub struct Foo<'__pin, T> { + | | ^^^^^^ declared twice +5 | | #[pin] +6 | | field: &'__pin mut T, +7 | | } +8 | | } + | |_- previous declaration here + +error[E0263]: lifetime name `'__pin` declared twice in the same scope + --> tests/ui/pin_project/overlapping_lifetime_names.rs:4:20 + | +3 | / pin_project! { //~ ERROR E0263,E0496 +4 | | pub struct Foo<'__pin, T> { + | | ^^^^^^ declared twice +5 | | #[pin] +6 | | field: &'__pin mut T, +7 | | } +8 | | } + | |_- previous declaration here + +error[E0263]: lifetime name `'__pin` declared twice in the same scope + --> tests/ui/pin_project/overlapping_lifetime_names.rs:4:20 + | +3 | / pin_project! { //~ ERROR E0263,E0496 +4 | | pub struct Foo<'__pin, T> { + | | ^^^^^^ declared twice +5 | | #[pin] +6 | | field: &'__pin mut T, +7 | | } +8 | | } + | |_- previous declaration here + +error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in scope + --> tests/ui/pin_project/overlapping_lifetime_names.rs:3:1 + | +3 | / pin_project! { //~ ERROR E0263,E0496 +4 | | pub struct Foo<'__pin, T> { + | | ------ first declared here +5 | | #[pin] +6 | | field: &'__pin mut T, +7 | | } +8 | | } + | |_^ lifetime `'__pin` already in scope + | + = note: this error originates in the macro `$crate::__pin_project_struct_make_proj_method` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in scope + --> tests/ui/pin_project/overlapping_lifetime_names.rs:3:1 + | +3 | / pin_project! { //~ ERROR E0263,E0496 +4 | | pub struct Foo<'__pin, T> { + | | ------ first declared here +5 | | #[pin] +6 | | field: &'__pin mut T, +7 | | } +8 | | } + | |_^ lifetime `'__pin` already in scope + | + = note: this error originates in the macro `$crate::__pin_project_struct_make_proj_method` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0263]: lifetime name `'__pin` declared twice in the same scope + --> tests/ui/pin_project/overlapping_lifetime_names.rs:4:20 + | +3 | / pin_project! { //~ ERROR E0263,E0496 +4 | | pub struct Foo<'__pin, T> { + | | ^^^^^^ declared twice +5 | | #[pin] +6 | | field: &'__pin mut T, +7 | | } +8 | | } + | |_- previous declaration here diff --git a/third_party/rust/pin-project-lite/tests/ui/pin_project/overlapping_unpin_struct.rs b/third_party/rust/pin-project-lite/tests/ui/pin_project/overlapping_unpin_struct.rs new file mode 100644 index 0000000000..25131d17d1 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/overlapping_unpin_struct.rs @@ -0,0 +1,20 @@ +use std::marker::PhantomPinned; + +use pin_project_lite::pin_project; + +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/pin_project/overlapping_unpin_struct.stderr b/third_party/rust/pin-project-lite/tests/ui/pin_project/overlapping_unpin_struct.stderr new file mode 100644 index 0000000000..303e7cbb58 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/overlapping_unpin_struct.stderr @@ -0,0 +1,33 @@ +error[E0277]: `PhantomPinned` cannot be unpinned + --> tests/ui/pin_project/overlapping_unpin_struct.rs:19:5 + | +19 | is_unpin::<Foo<PhantomPinned>>(); //~ ERROR E0277 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__Origin<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned` + | + = note: consider using `Box::pin` +note: required because it appears within the type `_::__Origin<'_, PhantomPinned>` + --> tests/ui/pin_project/overlapping_unpin_struct.rs:5:1 + | +5 | / pin_project! { +6 | | struct Foo<T> { +7 | | #[pin] +8 | | inner: T, +9 | | } +10 | | } + | |_^ +note: required because of the requirements on the impl of `Unpin` for `Foo<PhantomPinned>` + --> tests/ui/pin_project/overlapping_unpin_struct.rs:5:1 + | +5 | / pin_project! { +6 | | struct Foo<T> { +7 | | #[pin] +8 | | inner: T, +9 | | } +10 | | } + | |_^ +note: required by a bound in `is_unpin` + --> tests/ui/pin_project/overlapping_unpin_struct.rs:16:16 + | +16 | fn is_unpin<T: Unpin>() {} + | ^^^^^ required by this bound in `is_unpin` + = note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/third_party/rust/pin-project-lite/tests/ui/pin_project/packed.rs b/third_party/rust/pin-project-lite/tests/ui/pin_project/packed.rs new file mode 100644 index 0000000000..50afb118c8 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/packed.rs @@ -0,0 +1,21 @@ +#![allow(unaligned_references)] + +use pin_project_lite::pin_project; + +pin_project! { //~ ERROR reference to packed field is unaligned + #[repr(packed, C)] + struct Packed { + #[pin] + field: u16, + } +} + +pin_project! { //~ ERROR reference to packed field is unaligned + #[repr(packed(2))] + struct PackedN { + #[pin] + field: u32, + } +} + +fn main() {} diff --git a/third_party/rust/pin-project-lite/tests/ui/pin_project/packed.stderr b/third_party/rust/pin-project-lite/tests/ui/pin_project/packed.stderr new file mode 100644 index 0000000000..81fb4f1fcc --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/packed.stderr @@ -0,0 +1,57 @@ +error: reference to packed field is unaligned + --> tests/ui/pin_project/packed.rs:5:1 + | +5 | / pin_project! { //~ ERROR reference to packed field is unaligned +6 | | #[repr(packed, C)] +7 | | struct Packed { +8 | | #[pin] +9 | | field: u16, +10 | | } +11 | | } + | |_^ + | +note: the lint level is defined here + --> tests/ui/pin_project/packed.rs:5:1 + | +5 | / pin_project! { //~ ERROR reference to packed field is unaligned +6 | | #[repr(packed, C)] +7 | | struct Packed { +8 | | #[pin] +9 | | field: u16, +10 | | } +11 | | } + | |_^ + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) + = note: this error originates in the macro `$crate::__pin_project_constant` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: reference to packed field is unaligned + --> tests/ui/pin_project/packed.rs:13:1 + | +13 | / pin_project! { //~ ERROR reference to packed field is unaligned +14 | | #[repr(packed(2))] +15 | | struct PackedN { +16 | | #[pin] +17 | | field: u32, +18 | | } +19 | | } + | |_^ + | +note: the lint level is defined here + --> tests/ui/pin_project/packed.rs:13:1 + | +13 | / pin_project! { //~ ERROR reference to packed field is unaligned +14 | | #[repr(packed(2))] +15 | | struct PackedN { +16 | | #[pin] +17 | | field: u32, +18 | | } +19 | | } + | |_^ + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) + = note: this error originates in the macro `$crate::__pin_project_constant` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/third_party/rust/pin-project-lite/tests/ui/pin_project/unpin_sneaky.rs b/third_party/rust/pin-project-lite/tests/ui/pin_project/unpin_sneaky.rs new file mode 100644 index 0000000000..984cc2a219 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/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/pin_project/unpin_sneaky.stderr b/third_party/rust/pin-project-lite/tests/ui/pin_project/unpin_sneaky.stderr new file mode 100644 index 0000000000..4eb6eff96f --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/unpin_sneaky.stderr @@ -0,0 +1,11 @@ +error[E0412]: cannot find type `__Origin` in this scope + --> tests/ui/pin_project/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 `Unpin`, can only be implemented for a struct/enum type, not `[type error]` + --> tests/ui/pin_project/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/pin_project/unsupported.rs b/third_party/rust/pin-project-lite/tests/ui/pin_project/unsupported.rs new file mode 100644 index 0000000000..2f80836275 --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/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/pin_project/unsupported.stderr b/third_party/rust/pin-project-lite/tests/ui/pin_project/unsupported.stderr new file mode 100644 index 0000000000..a7d215a43e --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pin_project/unsupported.stderr @@ -0,0 +1,79 @@ +error: no rules expected the token `}` + --> tests/ui/pin_project/unsupported.rs:3:1 + | +3 | / pin_project! { +4 | | struct Struct1 {} //~ ERROR no rules expected the token `}` +5 | | } + | |_^ no rules expected this token in macro call + | + = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: no rules expected the token `}` + --> tests/ui/pin_project/unsupported.rs:3:1 + | +3 | / pin_project! { +4 | | struct Struct1 {} //~ ERROR no rules expected the token `}` +5 | | } + | |_^ no rules expected this token in macro call + | + = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: no rules expected the token `(` + --> tests/ui/pin_project/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 `;` + --> tests/ui/pin_project/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` + --> tests/ui/pin_project/unsupported.rs:15:1 + | +15 | / pin_project! { +16 | | enum Enum { //~ ERROR no rules expected the token `enum` +17 | | A(u8) +18 | | } +19 | | } + | |_^ no rules expected this token in macro call + | + = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: no rules expected the token `enum` + --> tests/ui/pin_project/unsupported.rs:15:1 + | +15 | / pin_project! { +16 | | enum Enum { //~ ERROR no rules expected the token `enum` +17 | | A(u8) +18 | | } +19 | | } + | |_^ no rules expected this token in macro call + | + = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: no rules expected the token `union` + --> tests/ui/pin_project/unsupported.rs:21:1 + | +21 | / pin_project! { +22 | | union Union { //~ ERROR no rules expected the token `union` +23 | | x: u8, +24 | | } +25 | | } + | |_^ no rules expected this token in macro call + | + = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: no rules expected the token `union` + --> tests/ui/pin_project/unsupported.rs:21:1 + | +21 | / pin_project! { +22 | | union Union { //~ ERROR no rules expected the token `union` +23 | | x: u8, +24 | | } +25 | | } + | |_^ no rules expected this token in macro call + | + = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/third_party/rust/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.rs b/third_party/rust/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.rs new file mode 100644 index 0000000000..609b3bebad --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.rs @@ -0,0 +1,17 @@ +use pin_project_lite::pin_project; + +pin_project! { + pub struct S { + #[pin] + field: u8, + } + impl PinnedDrop for S { + fn drop(this: Pin<&mut Self>) { + __drop_inner(this); + } + } +} + +fn main() { + let _x = S { field: 0 }; +} diff --git a/third_party/rust/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.stderr b/third_party/rust/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.stderr new file mode 100644 index 0000000000..597f67c84f --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.stderr @@ -0,0 +1,22 @@ +error[E0061]: this function takes 0 arguments but 1 argument was supplied + --> tests/ui/pinned_drop/call-drop-inner.rs:10:13 + | +10 | __drop_inner(this); + | ^^^^^^^^^^^^ ---- argument unexpected + | +note: function defined here + --> tests/ui/pinned_drop/call-drop-inner.rs:3:1 + | +3 | / pin_project! { +4 | | pub struct S { +5 | | #[pin] +6 | | field: u8, +... | +12 | | } +13 | | } + | |_^ + = note: this error originates in the macro `$crate::__pin_project_make_drop_impl` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove the extra argument + | +10 | __drop_inner(); + | ~~~~~~~~~~~~~~ diff --git a/third_party/rust/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.rs b/third_party/rust/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.rs new file mode 100644 index 0000000000..68b01b265e --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.rs @@ -0,0 +1,26 @@ +use pin_project_lite::pin_project; + +// In `Drop` impl, the implementor must specify the same requirement as type definition. + +struct DropImpl<T> { + f: T, +} + +impl<T: Unpin> Drop for DropImpl<T> { + //~^ ERROR E0367 + fn drop(&mut self) {} +} + +pin_project! { + //~^ ERROR E0367 + struct PinnedDropImpl<T> { + #[pin] + f: T, + } + + impl<T: Unpin> PinnedDrop for PinnedDropImpl<T> { + fn drop(_this: Pin<&mut Self>) {} + } +} + +fn main() {} diff --git a/third_party/rust/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.stderr b/third_party/rust/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.stderr new file mode 100644 index 0000000000..d70009c97a --- /dev/null +++ b/third_party/rust/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.stderr @@ -0,0 +1,38 @@ +error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not + --> tests/ui/pinned_drop/conditional-drop-impl.rs:9:9 + | +9 | impl<T: Unpin> Drop for DropImpl<T> { + | ^^^^^ + | +note: the implementor must specify the same requirement + --> tests/ui/pinned_drop/conditional-drop-impl.rs:5:1 + | +5 | / struct DropImpl<T> { +6 | | f: T, +7 | | } + | |_^ + +error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not + --> tests/ui/pinned_drop/conditional-drop-impl.rs:14:1 + | +14 | / pin_project! { +15 | | //~^ ERROR E0367 +16 | | struct PinnedDropImpl<T> { +17 | | #[pin] +... | +23 | | } +24 | | } + | |_^ + | +note: the implementor must specify the same requirement + --> tests/ui/pinned_drop/conditional-drop-impl.rs:14:1 + | +14 | / pin_project! { +15 | | //~^ ERROR E0367 +16 | | struct PinnedDropImpl<T> { +17 | | #[pin] +... | +23 | | } +24 | | } + | |_^ + = note: this error originates in the macro `$crate::__pin_project_make_drop_impl` (in Nightly builds, run with -Z macro-backtrace for more info) |