diff options
Diffstat (limited to 'tests/ui/pin_project')
27 files changed, 341 insertions, 244 deletions
diff --git a/tests/ui/pin_project/add-attr-to-struct.stderr b/tests/ui/pin_project/add-attr-to-struct.stderr index b28559b..6fb88e8 100644 --- a/tests/ui/pin_project/add-attr-to-struct.stderr +++ b/tests/ui/pin_project/add-attr-to-struct.stderr @@ -1,5 +1,5 @@ error: duplicate #[pin] attribute - --> $DIR/add-attr-to-struct.rs:7:1 + --> tests/ui/pin_project/add-attr-to-struct.rs:7:1 | 7 | #[add_pin_attr(struct)] //~ ERROR duplicate #[pin] attribute | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: duplicate #[pin] attribute = note: this error originates in the attribute macro `add_pin_attr` (in Nightly builds, run with -Z macro-backtrace for more info) error: #[pin] attribute may only be used on fields of structs or variants - --> $DIR/add-attr-to-struct.rs:13:1 + --> tests/ui/pin_project/add-attr-to-struct.rs:13:1 | 13 | #[add_pin_attr(struct)] //~ ERROR #[pin] attribute may only be used on fields of structs or variants | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/pin_project/add-pinned-field.stderr b/tests/ui/pin_project/add-pinned-field.stderr index bdeafb8..d0832cc 100644 --- a/tests/ui/pin_project/add-pinned-field.stderr +++ b/tests/ui/pin_project/add-pinned-field.stderr @@ -1,48 +1,52 @@ error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/add-pinned-field.rs:21:5 + --> tests/ui/pin_project/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 `Unpin` is not implemented for `PhantomPinned` | = note: consider using `Box::pin` note: required because it appears within the type `__Foo<'_>` - --> $DIR/add-pinned-field.rs:8:8 + --> tests/ui/pin_project/add-pinned-field.rs:8:8 | 8 | struct Foo { | ^^^ note: required because of the requirements on the impl of `Unpin` for `Foo` - --> $DIR/add-pinned-field.rs:6:1 + --> tests/ui/pin_project/add-pinned-field.rs:6:1 | 6 | #[pin_project] | ^^^^^^^^^^^^^^ 7 | #[add_pinned_field] 8 | struct Foo { | ^^^ +note: required by a bound in `is_unpin` + --> tests/ui/pin_project/add-pinned-field.rs:4:16 + | +4 | fn is_unpin<T: Unpin>() {} + | ^^^^^ required by this bound in `is_unpin` = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/add-pinned-field.rs:22:5 + --> tests/ui/pin_project/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 `Unpin` is not implemented for `PhantomPinned` | = note: consider using `Box::pin` note: required because it appears within the type `__Bar<'_>` - --> $DIR/add-pinned-field.rs:15:8 + --> tests/ui/pin_project/add-pinned-field.rs:15:8 | 15 | struct Bar { | ^^^ note: required because of the requirements on the impl of `Unpin` for `Bar` - --> $DIR/add-pinned-field.rs:14:1 + --> tests/ui/pin_project/add-pinned-field.rs:14:1 | 14 | #[pin_project] | ^^^^^^^^^^^^^^ 15 | struct Bar { | ^^^ +note: required by a bound in `is_unpin` + --> tests/ui/pin_project/add-pinned-field.rs:4:16 + | +4 | fn is_unpin<T: Unpin>() {} + | ^^^^^ required by this bound in `is_unpin` = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pin_project/conflict-drop.stderr b/tests/ui/pin_project/conflict-drop.stderr index 25b0e00..4ae628d 100644 --- a/tests/ui/pin_project/conflict-drop.stderr +++ b/tests/ui/pin_project/conflict-drop.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `_::FooMustNotImplDrop` for type `Foo<_, _>` - --> $DIR/conflict-drop.rs:5:1 + --> tests/ui/pin_project/conflict-drop.rs:5:1 | 5 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ @@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `_::FooMustNotImplDrop` for t = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `Bar<_, _>` - --> $DIR/conflict-drop.rs:16:15 + --> tests/ui/pin_project/conflict-drop.rs:16:15 | 16 | #[pin_project(PinnedDrop)] //~ ERROR E0119 | ^^^^^^^^^^ conflicting implementation for `Bar<_, _>` diff --git a/tests/ui/pin_project/conflict-unpin.stderr b/tests/ui/pin_project/conflict-unpin.stderr index 5a16469..5e012c4 100644 --- a/tests/ui/pin_project/conflict-unpin.stderr +++ b/tests/ui/pin_project/conflict-unpin.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>` - --> $DIR/conflict-unpin.rs:5:1 + --> tests/ui/pin_project/conflict-unpin.rs:5:1 | 5 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Foo<_, _>` @@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>` - --> $DIR/conflict-unpin.rs:17:1 + --> tests/ui/pin_project/conflict-unpin.rs:17:1 | 17 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Bar<_, _>` @@ -21,7 +21,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>` - --> $DIR/conflict-unpin.rs:27:1 + --> tests/ui/pin_project/conflict-unpin.rs:27:1 | 27 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Baz<_, _>` diff --git a/tests/ui/pin_project/impl-unsafe-unpin.stderr b/tests/ui/pin_project/impl-unsafe-unpin.stderr index e97d31b..ba42303 100644 --- a/tests/ui/pin_project/impl-unsafe-unpin.stderr +++ b/tests/ui/pin_project/impl-unsafe-unpin.stderr @@ -1,5 +1,5 @@ -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Foo<_, _>` - --> $DIR/impl-unsafe-unpin.rs:3:1 +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Foo<_, _>` + --> tests/ui/pin_project/impl-unsafe-unpin.rs:3:1 | 3 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Foo<_, _>` @@ -9,8 +9,8 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo | = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Bar<_, _>` - --> $DIR/impl-unsafe-unpin.rs:12:1 +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Bar<_, _>` + --> tests/ui/pin_project/impl-unsafe-unpin.rs:12:1 | 12 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Bar<_, _>` @@ -20,8 +20,8 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo | = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Baz<_, _>` - --> $DIR/impl-unsafe-unpin.rs:21:1 +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Baz<_, _>` + --> tests/ui/pin_project/impl-unsafe-unpin.rs:21:1 | 21 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Baz<_, _>` diff --git a/tests/ui/pin_project/import_unnamed.stderr b/tests/ui/pin_project/import_unnamed.stderr index f54e4c4..260a35a 100644 --- a/tests/ui/pin_project/import_unnamed.stderr +++ b/tests/ui/pin_project/import_unnamed.stderr @@ -1,29 +1,29 @@ error[E0432]: unresolved import `crate::pub_::__DefaultProjection` - --> $DIR/import_unnamed.rs:16:9 + --> tests/ui/pin_project/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 + --> tests/ui/pin_project/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 + --> tests/ui/pin_project/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 + --> tests/ui/pin_project/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 + --> tests/ui/pin_project/import_unnamed.rs:24:9 | 24 | use crate::pub_::__ReplaceProjectionRef; //~ ERROR E0432 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__ReplaceProjectionRef` in `pub_` diff --git a/tests/ui/pin_project/invalid.stderr b/tests/ui/pin_project/invalid.stderr index 35552bf..c43d363 100644 --- a/tests/ui/pin_project/invalid.stderr +++ b/tests/ui/pin_project/invalid.stderr @@ -1,329 +1,329 @@ -error: unexpected token: () - --> $DIR/invalid.rs:6:14 +error: unexpected token: `()` + --> tests/ui/pin_project/invalid.rs:6:14 | 6 | #[pin()] //~ ERROR unexpected token | ^^ -error: unexpected token: (foo) - --> $DIR/invalid.rs:11:29 +error: unexpected token: `(foo)` + --> tests/ui/pin_project/invalid.rs:11:29 | 11 | struct TupleStruct(#[pin(foo)] ()); //~ ERROR unexpected token | ^^^^^ -error: unexpected token: (foo) - --> $DIR/invalid.rs:15:16 +error: unexpected token: `(foo)` + --> tests/ui/pin_project/invalid.rs:15:16 | 15 | V(#[pin(foo)] ()), //~ ERROR unexpected token | ^^^^^ -error: unexpected token: (foo) - --> $DIR/invalid.rs:21:18 +error: unexpected token: `(foo)` + --> tests/ui/pin_project/invalid.rs:21:18 | 21 | #[pin(foo)] //~ ERROR unexpected token | ^^^^^ error: duplicate #[pin] attribute - --> $DIR/invalid.rs:33:9 + --> tests/ui/pin_project/invalid.rs:33:9 | 33 | #[pin] //~ ERROR duplicate #[pin] attribute | ^^^^^^ error: duplicate #[pin] attribute - --> $DIR/invalid.rs:40:9 + --> tests/ui/pin_project/invalid.rs:40:9 | 40 | #[pin] | ^^^^^^ error: duplicate #[pin] attribute - --> $DIR/invalid.rs:49:13 + --> tests/ui/pin_project/invalid.rs:49:13 | 49 | #[pin] | ^^^^^^ error: duplicate #[pin] attribute - --> $DIR/invalid.rs:59:13 + --> tests/ui/pin_project/invalid.rs:59:13 | 59 | #[pin] //~ ERROR duplicate #[pin] attribute | ^^^^^^ error: #[pin] attribute may only be used on fields of structs or variants - --> $DIR/invalid.rs:69:5 + --> tests/ui/pin_project/invalid.rs:69:5 | 69 | #[pin] //~ ERROR may only be used on fields of structs or variants | ^^^^^^ error: #[pin] attribute may only be used on fields of structs or variants - --> $DIR/invalid.rs:77:9 + --> tests/ui/pin_project/invalid.rs:77:9 | 77 | #[pin] //~ ERROR may only be used on fields of structs or variants | ^^^^^^ error: #[pin] attribute may only be used on fields of structs or variants - --> $DIR/invalid.rs:82:5 + --> tests/ui/pin_project/invalid.rs:82:5 | 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 + --> tests/ui/pin_project/invalid.rs:91:19 | 91 | #[pin_project(Replace)] //~ ERROR `Replace` argument was removed, use `project_replace` argument instead | ^^^^^^^ error: expected identifier - --> $DIR/invalid.rs:94:31 + --> tests/ui/pin_project/invalid.rs:94:31 | 94 | #[pin_project(UnsafeUnpin,,)] //~ ERROR expected identifier | ^ error: unexpected argument: Foo - --> $DIR/invalid.rs:97:19 + --> tests/ui/pin_project/invalid.rs:97:19 | 97 | #[pin_project(Foo)] //~ ERROR unexpected argument | ^^^ error: expected identifier - --> $DIR/invalid.rs:100:19 + --> tests/ui/pin_project/invalid.rs:100:19 | 100 | #[pin_project(,UnsafeUnpin)] //~ ERROR expected identifier | ^ error: expected `,` - --> $DIR/invalid.rs:106:30 + --> tests/ui/pin_project/invalid.rs:106:30 | 106 | #[pin_project(PinnedDrop PinnedDrop)] //~ ERROR expected `,` | ^^^^^^^^^^ error: duplicate `PinnedDrop` argument - --> $DIR/invalid.rs:109:31 + --> tests/ui/pin_project/invalid.rs:109:31 | 109 | #[pin_project(PinnedDrop, PinnedDrop)] //~ ERROR duplicate `PinnedDrop` argument | ^^^^^^^^^^ error: duplicate `UnsafeUnpin` argument - --> $DIR/invalid.rs:112:32 + --> tests/ui/pin_project/invalid.rs:112:32 | 112 | #[pin_project(UnsafeUnpin, UnsafeUnpin)] //~ ERROR duplicate `UnsafeUnpin` argument | ^^^^^^^^^^^ error: duplicate `!Unpin` argument - --> $DIR/invalid.rs:115:27 + --> tests/ui/pin_project/invalid.rs:115:27 | 115 | #[pin_project(!Unpin, !Unpin)] //~ ERROR duplicate `!Unpin` argument | ^^^^^^ error: duplicate `UnsafeUnpin` argument - --> $DIR/invalid.rs:118:44 + --> tests/ui/pin_project/invalid.rs:118:44 | 118 | #[pin_project(PinnedDrop, UnsafeUnpin, UnsafeUnpin)] //~ ERROR duplicate `UnsafeUnpin` argument | ^^^^^^^^^^^ error: duplicate `PinnedDrop` argument - --> $DIR/invalid.rs:121:44 + --> tests/ui/pin_project/invalid.rs:121:44 | 121 | #[pin_project(PinnedDrop, UnsafeUnpin, PinnedDrop, UnsafeUnpin)] //~ ERROR duplicate `PinnedDrop` argument | ^^^^^^^^^^ error: duplicate `project` argument - --> $DIR/invalid.rs:124:32 + --> tests/ui/pin_project/invalid.rs:124:32 | 124 | #[pin_project(project = A, project = B)] //~ ERROR duplicate `project` argument | ^^^^^^^^^^^ error: duplicate `project` argument - --> $DIR/invalid.rs:127:49 + --> tests/ui/pin_project/invalid.rs:127:49 | 127 | #[pin_project(project = A, project_ref = A, project = B)] //~ ERROR duplicate `project` argument | ^^^^^^^^^^^ error: duplicate `project_ref` argument - --> $DIR/invalid.rs:130:36 + --> tests/ui/pin_project/invalid.rs:130:36 | 130 | #[pin_project(project_ref = A, project_ref = B)] //~ ERROR duplicate `project_ref` argument | ^^^^^^^^^^^^^^^ error: duplicate `project_replace` argument - --> $DIR/invalid.rs:133:40 + --> tests/ui/pin_project/invalid.rs:133:40 | 133 | #[pin_project(project_replace = A, project_replace = B)] //~ ERROR duplicate `project_replace` argument | ^^^^^^^^^^^^^^^^^^^ error: duplicate `project_replace` argument - --> $DIR/invalid.rs:136:36 + --> tests/ui/pin_project/invalid.rs:136:36 | 136 | #[pin_project(project_replace, project_replace = B)] //~ ERROR duplicate `project_replace` argument | ^^^^^^^^^^^^^^^^^^^ error: duplicate `project_replace` argument - --> $DIR/invalid.rs:139:40 + --> tests/ui/pin_project/invalid.rs:139:40 | 139 | #[pin_project(project_replace = A, project_replace)] //~ ERROR duplicate `project_replace` argument | ^^^^^^^^^^^^^^^ error: arguments `PinnedDrop` and `project_replace` are mutually exclusive - --> $DIR/invalid.rs:145:19 + --> tests/ui/pin_project/invalid.rs:145:19 | 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:148:49 + --> tests/ui/pin_project/invalid.rs:148:49 | 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:151:19 + --> tests/ui/pin_project/invalid.rs:151:19 | 151 | #[pin_project(UnsafeUnpin, !Unpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive | ^^^^^^^^^^^ error: arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive - --> $DIR/invalid.rs:154:39 + --> tests/ui/pin_project/invalid.rs:154:39 | 154 | #[pin_project(!Unpin, PinnedDrop, UnsafeUnpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive | ^^^^^^^^^^^ error: expected `!Unpin`, found `!` - --> $DIR/invalid.rs:157:19 + --> tests/ui/pin_project/invalid.rs:157:19 | 157 | #[pin_project(!)] //~ ERROR expected `!Unpin`, found `!` | ^ error: unexpected argument: Unpin - --> $DIR/invalid.rs:160:19 + --> tests/ui/pin_project/invalid.rs:160:19 | 160 | #[pin_project(Unpin)] //~ ERROR unexpected argument | ^^^^^ error: expected `project = <identifier>`, found `project` - --> $DIR/invalid.rs:163:19 + --> tests/ui/pin_project/invalid.rs:163:19 | 163 | #[pin_project(project)] //~ ERROR expected `project = <identifier>`, found `project` | ^^^^^^^ error: expected `project = <identifier>`, found `project =` - --> $DIR/invalid.rs:166:19 + --> tests/ui/pin_project/invalid.rs:166:19 | 166 | #[pin_project(project = )] //~ ERROR expected `project = <identifier>`, found `project =` | ^^^^^^^^^ error: expected identifier - --> $DIR/invalid.rs:169:29 + --> tests/ui/pin_project/invalid.rs:169:29 | 169 | #[pin_project(project = !)] //~ ERROR expected identifier | ^ error: expected `project_ref = <identifier>`, found `project_ref` - --> $DIR/invalid.rs:172:19 + --> tests/ui/pin_project/invalid.rs:172:19 | 172 | #[pin_project(project_ref)] //~ ERROR expected `project_ref = <identifier>`, found `project_ref` | ^^^^^^^^^^^ error: expected `project_ref = <identifier>`, found `project_ref =` - --> $DIR/invalid.rs:175:19 + --> tests/ui/pin_project/invalid.rs:175:19 | 175 | #[pin_project(project_ref = )] //~ ERROR expected `project_ref = <identifier>`, found `project_ref =` | ^^^^^^^^^^^^^ error: expected identifier - --> $DIR/invalid.rs:178:33 + --> tests/ui/pin_project/invalid.rs:178:33 | 178 | #[pin_project(project_ref = !)] //~ ERROR expected identifier | ^ error: expected `project_replace = <identifier>`, found `project_replace =` - --> $DIR/invalid.rs:184:19 + --> tests/ui/pin_project/invalid.rs:184:19 | 184 | #[pin_project(project_replace = )] //~ ERROR expected `project_replace = <identifier>`, found `project_replace =` | ^^^^^^^^^^^^^^^^^ error: expected identifier - --> $DIR/invalid.rs:187:37 + --> tests/ui/pin_project/invalid.rs:187:37 | 187 | #[pin_project(project_replace = !)] //~ ERROR expected identifier | ^ error: `project_replace` argument requires a value when used on enums - --> $DIR/invalid.rs:190:19 + --> tests/ui/pin_project/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 + --> tests/ui/pin_project/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 + --> tests/ui/pin_project/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 + --> tests/ui/pin_project/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:208:46 + --> tests/ui/pin_project/invalid.rs:208:46 | 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:211:50 + --> tests/ui/pin_project/invalid.rs:211:50 | 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:214:54 + --> tests/ui/pin_project/invalid.rs:214:54 | 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:222:5 + --> tests/ui/pin_project/invalid.rs:222:5 | 222 | #[pin_project] //~ ERROR duplicate #[pin_project] attribute | ^^^^^^^^^^^^^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> $DIR/invalid.rs:230:19 + --> tests/ui/pin_project/invalid.rs:230:19 | 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:233:23 + --> tests/ui/pin_project/invalid.rs:233:23 | 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:236:12 + --> tests/ui/pin_project/invalid.rs:236:12 | 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:239:20 + --> tests/ui/pin_project/invalid.rs:239:20 | 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:243:13 + --> tests/ui/pin_project/invalid.rs:243:13 | 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:248:9 + --> tests/ui/pin_project/invalid.rs:248:9 | 248 | / Unit, //~ ERROR may not be used on enums with zero fields 249 | | Tuple(), @@ -331,7 +331,7 @@ error: #[pin_project] attribute may not be used on enums with zero fields | |__________________^ error: #[pin_project] attribute may only be used on structs or enums - --> $DIR/invalid.rs:254:5 + --> tests/ui/pin_project/invalid.rs:254:5 | 254 | / union Union { 255 | | //~^ ERROR may only be used on structs or enums @@ -340,25 +340,25 @@ error: #[pin_project] attribute may only be used on structs or enums | |_____^ error: #[pin_project] attribute may only be used on structs or enums - --> $DIR/invalid.rs:260:5 + --> tests/ui/pin_project/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:268:12 + --> tests/ui/pin_project/invalid.rs:268:12 | 268 | #[repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/invalid.rs:272:12 + --> tests/ui/pin_project/invalid.rs:272:12 | 272 | #[repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/invalid.rs:276:12 + --> tests/ui/pin_project/invalid.rs:276:12 | 276 | #[repr(packed)] | ^^^^^^ diff --git a/tests/ui/pin_project/overlapping_unpin_struct.stderr b/tests/ui/pin_project/overlapping_unpin_struct.stderr index bb33944..1bd200d 100644 --- a/tests/ui/pin_project/overlapping_unpin_struct.stderr +++ b/tests/ui/pin_project/overlapping_unpin_struct.stderr @@ -1,23 +1,25 @@ error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/overlapping_unpin_struct.rs:18:5 + --> tests/ui/pin_project/overlapping_unpin_struct.rs:18:5 | -15 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... 18 | is_unpin::<S<PhantomPinned>>(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__S<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned` | = note: consider using `Box::pin` note: required because it appears within the type `_::__S<'_, PhantomPinned>` - --> $DIR/overlapping_unpin_struct.rs:6:8 + --> tests/ui/pin_project/overlapping_unpin_struct.rs:6:8 | 6 | struct S<T> { | ^ note: required because of the requirements on the impl of `Unpin` for `S<PhantomPinned>` - --> $DIR/overlapping_unpin_struct.rs:5:1 + --> tests/ui/pin_project/overlapping_unpin_struct.rs:5:1 | 5 | #[pin_project] | ^^^^^^^^^^^^^^ 6 | struct S<T> { | ^^^^ +note: required by a bound in `is_unpin` + --> tests/ui/pin_project/overlapping_unpin_struct.rs:15:16 + | +15 | fn is_unpin<T: Unpin>() {} + | ^^^^^ required by this bound in `is_unpin` = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pin_project/override-priv-mod.rs b/tests/ui/pin_project/override-priv-mod.rs new file mode 100644 index 0000000..890fd5b --- /dev/null +++ b/tests/ui/pin_project/override-priv-mod.rs @@ -0,0 +1,32 @@ +// https://discord.com/channels/273534239310479360/512792629516173323/870075511009857617 + +extern crate pin_project as pin_project_orig; +extern crate self as pin_project; + +pub use ::pin_project_orig::*; +mod __private { + pub use ::pin_project_orig::__private::*; + pub trait Drop {} +} + +use std::{marker::PhantomPinned, mem}; + +#[pin_project] //~ ERROR conflicting implementations of trait `_::FooMustNotImplDrop` +struct S { + #[pin] + f: (u8, PhantomPinned), +} + +impl Drop for S { + fn drop(&mut self) { + let prev = &self.f.0 as *const _ as usize; + let moved = mem::take(&mut self.f); // move pinned field + let moved = &moved.0 as *const _ as usize; + assert_eq!(prev, moved); // panic + } +} + +fn main() { + let mut x = Box::pin(S { f: (1, PhantomPinned) }); + let _f = x.as_mut().project().f; // first mutable access +} diff --git a/tests/ui/pin_project/override-priv-mod.stderr b/tests/ui/pin_project/override-priv-mod.stderr new file mode 100644 index 0000000..8a3fb9b --- /dev/null +++ b/tests/ui/pin_project/override-priv-mod.stderr @@ -0,0 +1,10 @@ +error[E0119]: conflicting implementations of trait `_::SMustNotImplDrop` for type `S` + --> tests/ui/pin_project/override-priv-mod.rs:14:1 + | +14 | #[pin_project] //~ ERROR conflicting implementations of trait `_::FooMustNotImplDrop` + | ^^^^^^^^^^^^^^ + | | + | first implementation here + | conflicting implementation for `S` + | + = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pin_project/packed-enum.stderr b/tests/ui/pin_project/packed-enum.stderr index 0951944..1872211 100644 --- a/tests/ui/pin_project/packed-enum.stderr +++ b/tests/ui/pin_project/packed-enum.stderr @@ -1,17 +1,17 @@ error: #[repr(packed)] attribute should be applied to a struct or union - --> $DIR/packed-enum.rs:13:8 + --> tests/ui/pin_project/packed-enum.rs:13:8 | 13 | #[repr(packed)] //~ ERROR E0517 | ^^^^^^ error: #[repr(packed)] attribute should be applied to a struct or union - --> $DIR/packed-enum.rs:18:8 + --> tests/ui/pin_project/packed-enum.rs:18:8 | 18 | #[repr(packed)] //~ ERROR E0517 | ^^^^^^ error[E0517]: attribute should be applied to a struct or union - --> $DIR/packed-enum.rs:7:8 + --> tests/ui/pin_project/packed-enum.rs:7:8 | 7 | #[repr(packed)] //~ ERROR E0517 | ^^^^^^ @@ -21,7 +21,7 @@ error[E0517]: attribute should be applied to a struct or union | |_- not a struct or union error[E0517]: attribute should be applied to a struct or union - --> $DIR/packed-enum.rs:13:8 + --> tests/ui/pin_project/packed-enum.rs:13:8 | 13 | #[repr(packed)] //~ ERROR E0517 | ^^^^^^ @@ -31,7 +31,7 @@ error[E0517]: attribute should be applied to a struct or union | |_- not a struct or union error[E0517]: attribute should be applied to a struct or union - --> $DIR/packed-enum.rs:18:8 + --> tests/ui/pin_project/packed-enum.rs:18:8 | 18 | #[repr(packed)] //~ ERROR E0517 | ^^^^^^ diff --git a/tests/ui/pin_project/packed-name-value.stderr b/tests/ui/pin_project/packed-name-value.stderr index 18137d4..d8b2194 100644 --- a/tests/ui/pin_project/packed-name-value.stderr +++ b/tests/ui/pin_project/packed-name-value.stderr @@ -1,23 +1,23 @@ error: #[repr(packed)] attribute should not be name-value pair - --> $DIR/packed-name-value.rs:16:8 + --> tests/ui/pin_project/packed-name-value.rs:16:8 | 16 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair | ^^^^^^^^^^^ error: #[repr(packed)] attribute should not be name-value pair - --> $DIR/packed-name-value.rs:21:8 + --> tests/ui/pin_project/packed-name-value.rs:21:8 | 21 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair | ^^^^^^^^^^^ error[E0693]: incorrect `repr(packed)` attribute format - --> $DIR/packed-name-value.rs:16:8 + --> tests/ui/pin_project/packed-name-value.rs:16:8 | 16 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair | ^^^^^^^^^^^ help: use parentheses instead: `packed()` error[E0693]: incorrect `repr(packed)` attribute format - --> $DIR/packed-name-value.rs:21:8 + --> tests/ui/pin_project/packed-name-value.rs:21:8 | 21 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair | ^^^^^^^^^^^ help: use parentheses instead: `packed()` diff --git a/tests/ui/pin_project/packed.stderr b/tests/ui/pin_project/packed.stderr index e5b9e55..25ea5f4 100644 --- a/tests/ui/pin_project/packed.stderr +++ b/tests/ui/pin_project/packed.stderr @@ -1,23 +1,23 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed.rs:4:8 + --> tests/ui/pin_project/packed.rs:4:8 | 4 | #[repr(packed, C)] //~ ERROR may not be used on #[repr(packed)] types | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed.rs:11:8 + --> tests/ui/pin_project/packed.rs:11:8 | 11 | #[repr(packed, C)] //~ ERROR may not be used on #[repr(packed)] types | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed.rs:19:8 + --> tests/ui/pin_project/packed.rs:19:8 | 19 | #[repr(packed(2))] //~ ERROR may not be used on #[repr(packed)] types | ^^^^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed.rs:26:8 + --> tests/ui/pin_project/packed.rs:26:8 | 26 | #[repr(packed(2))] //~ ERROR may not be used on #[repr(packed)] types | ^^^^^^^^^ diff --git a/tests/ui/pin_project/packed_sneaky-1.stderr b/tests/ui/pin_project/packed_sneaky-1.stderr index 67bcd1b..32fe407 100644 --- a/tests/ui/pin_project/packed_sneaky-1.stderr +++ b/tests/ui/pin_project/packed_sneaky-1.stderr @@ -1,17 +1,17 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-1.rs:7:15 + --> tests/ui/pin_project/packed_sneaky-1.rs:7:15 | 7 | #[hidden_repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-1.rs:14:15 + --> tests/ui/pin_project/packed_sneaky-1.rs:14:15 | 14 | #[hidden_repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-1.rs:23:15 + --> tests/ui/pin_project/packed_sneaky-1.rs:23:15 | 23 | #[hidden_repr(packed)] | ^^^^^^ diff --git a/tests/ui/pin_project/packed_sneaky-2.stderr b/tests/ui/pin_project/packed_sneaky-2.stderr index 04d072a..d643052 100644 --- a/tests/ui/pin_project/packed_sneaky-2.stderr +++ b/tests/ui/pin_project/packed_sneaky-2.stderr @@ -1,5 +1,5 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-2.rs:4:1 + --> tests/ui/pin_project/packed_sneaky-2.rs:4:1 | 4 | / hidden_repr_macro! { //~ ERROR may not be used on #[repr(packed)] types 5 | | #[pin_project] diff --git a/tests/ui/pin_project/packed_sneaky-3.stderr b/tests/ui/pin_project/packed_sneaky-3.stderr index 1a5a3ec..c97f18b 100644 --- a/tests/ui/pin_project/packed_sneaky-3.stderr +++ b/tests/ui/pin_project/packed_sneaky-3.stderr @@ -1,5 +1,5 @@ error: expected item after attributes - --> $DIR/packed_sneaky-3.rs:4:1 + --> tests/ui/pin_project/packed_sneaky-3.rs:4:1 | 4 | hidden_repr_macro! {} //~ ERROR expected item after attributes | ^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ error: expected item after attributes = note: this error originates in the macro `hidden_repr_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected item after attributes - --> $DIR/packed_sneaky-3.rs:13:9 + --> tests/ui/pin_project/packed_sneaky-3.rs:13:9 | 13 | #[repr(packed)] //~ ERROR expected item after attributes | ^^^^^^^^^^^^^^^ @@ -18,7 +18,7 @@ error: expected item after attributes = note: this error originates in the macro `hidden_repr_macro2` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected item after attributes - --> $DIR/packed_sneaky-3.rs:24:10 + --> tests/ui/pin_project/packed_sneaky-3.rs:24:10 | 24 | #[derive(HiddenRepr)] //~ ERROR expected item after attributes | ^^^^^^^^^^ @@ -26,7 +26,7 @@ error: expected item after attributes = note: this error originates in the derive macro `HiddenRepr` (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 + --> tests/ui/pin_project/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.stderr b/tests/ui/pin_project/private_in_public-enum.stderr index 6e3316c..c93b265 100644 --- a/tests/ui/pin_project/private_in_public-enum.stderr +++ b/tests/ui/pin_project/private_in_public-enum.stderr @@ -1,5 +1,5 @@ error[E0446]: private type `PrivateEnum` in public interface - --> $DIR/private_in_public-enum.rs:6:7 + --> tests/ui/pin_project/private_in_public-enum.rs:6:7 | 6 | V(PrivateEnum), //~ ERROR E0446 | ^^^^^^^^^^^ can't leak private type @@ -8,7 +8,7 @@ error[E0446]: private type `PrivateEnum` in public interface | ---------------- `PrivateEnum` declared as private error[E0446]: private type `foo::PrivateEnum` in public interface - --> $DIR/private_in_public-enum.rs:15:11 + --> tests/ui/pin_project/private_in_public-enum.rs:15:11 | 15 | V(PrivateEnum), //~ ERROR E0446 | ^^^^^^^^^^^ can't leak private type diff --git a/tests/ui/pin_project/project_replace_unsized.stderr b/tests/ui/pin_project/project_replace_unsized.stderr index d20d858..86cc148 100644 --- a/tests/ui/pin_project/project_replace_unsized.stderr +++ b/tests/ui/pin_project/project_replace_unsized.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized.rs:3:15 + --> tests/ui/pin_project/project_replace_unsized.rs:3:15 | 3 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -7,18 +7,23 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim | - this type parameter needs to be `std::marker::Sized` | note: required because it appears within the type `Struct<T>` - --> $DIR/project_replace_unsized.rs:4:8 + --> tests/ui/pin_project/project_replace_unsized.rs:4:8 | 4 | struct Struct<T: ?Sized> { | ^^^^^^ = help: unsized fn params are gated as an unstable feature +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +4 - struct Struct<T: ?Sized> { +4 + struct Struct<T> { + | help: function arguments must have a statically known size, borrowed types always have a known size | 3 | #[pin_project(&project_replace)] //~ ERROR E0277 - | ^ + | + error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized.rs:3:1 + --> tests/ui/pin_project/project_replace_unsized.rs:3:1 | 3 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -26,27 +31,45 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim | - this type parameter needs to be `std::marker::Sized` | note: required because it appears within the type `Struct<T>` - --> $DIR/project_replace_unsized.rs:4:8 + --> tests/ui/pin_project/project_replace_unsized.rs:4:8 | 4 | struct Struct<T: ?Sized> { | ^^^^^^ -note: required by `UnsafeOverwriteGuard` - --> $DIR/lib.rs:269:5 +note: required by a bound in `UnsafeOverwriteGuard::<T>::new` + --> src/lib.rs | -269 | pub struct UnsafeOverwriteGuard<T> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | impl<T> UnsafeOverwriteGuard<T> { + | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new` = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +4 - struct Struct<T: ?Sized> { +4 + struct Struct<T> { + | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized.rs:5:5 + --> tests/ui/pin_project/project_replace_unsized.rs:5:5 | +3 | #[pin_project(project_replace)] //~ ERROR E0277 + | ------------------------------- required by a bound introduced by this call 4 | struct Struct<T: ?Sized> { | - this type parameter needs to be `std::marker::Sized` 5 | f: T, | ^ doesn't have a size known at compile-time + | +note: required by a bound in `std::ptr::read` + --> $RUST/core/src/ptr/mod.rs + | + | pub const unsafe fn read<T>(src: *const T) -> T { + | ^ required by this bound in `std::ptr::read` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +4 - struct Struct<T: ?Sized> { +4 + struct Struct<T> { + | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized.rs:8:15 + --> tests/ui/pin_project/project_replace_unsized.rs:8:15 | 8 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -54,18 +77,23 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim | - this type parameter needs to be `std::marker::Sized` | note: required because it appears within the type `TupleStruct<T>` - --> $DIR/project_replace_unsized.rs:9:8 + --> tests/ui/pin_project/project_replace_unsized.rs:9:8 | 9 | struct TupleStruct<T: ?Sized>(T); | ^^^^^^^^^^^ = help: unsized fn params are gated as an unstable feature +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +9 - struct TupleStruct<T: ?Sized>(T); +9 + struct TupleStruct<T>(T); + | help: function arguments must have a statically known size, borrowed types always have a known size | 8 | #[pin_project(&project_replace)] //~ ERROR E0277 - | ^ + | + error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized.rs:8:1 + --> tests/ui/pin_project/project_replace_unsized.rs:8:1 | 8 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -73,24 +101,18 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim | - this type parameter needs to be `std::marker::Sized` | note: required because it appears within the type `TupleStruct<T>` - --> $DIR/project_replace_unsized.rs:9:8 + --> tests/ui/pin_project/project_replace_unsized.rs:9:8 | 9 | struct TupleStruct<T: ?Sized>(T); | ^^^^^^^^^^^ -note: required by `UnsafeOverwriteGuard` - --> $DIR/lib.rs:269:5 +note: required by a bound in `UnsafeOverwriteGuard::<T>::new` + --> src/lib.rs | -269 | pub struct UnsafeOverwriteGuard<T> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | impl<T> UnsafeOverwriteGuard<T> { + | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new` = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized.rs:9:8 - | -9 | struct TupleStruct<T: ?Sized>(T); - | ^^^^^^^^^^^ - this type parameter needs to be `std::marker::Sized` - | | - | doesn't have a size known at compile-time - | - = note: all function arguments must have a statically known size - = help: unsized fn params are gated as an unstable feature +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +9 - struct TupleStruct<T: ?Sized>(T); +9 + struct TupleStruct<T>(T); + | diff --git a/tests/ui/pin_project/project_replace_unsized_fn_params.stderr b/tests/ui/pin_project/project_replace_unsized_fn_params.stderr index 8ac4ad7..e398ca4 100644 --- a/tests/ui/pin_project/project_replace_unsized_fn_params.stderr +++ b/tests/ui/pin_project/project_replace_unsized_fn_params.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized_fn_params.rs:6:8 + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:6:8 | 6 | struct Struct<T: ?Sized> { | ^^^^^^^-^^^^^^^^^ @@ -8,14 +8,19 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim | doesn't have a size known at compile-time | note: required because it appears within the type `__StructProjectionOwned<T>` - --> $DIR/project_replace_unsized_fn_params.rs:6:8 + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:6:8 | 6 | struct Struct<T: ?Sized> { | ^^^^^^ = note: the return type of a function must have a statically known size +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +6 - struct Struct<T: ?Sized> { +6 + struct Struct<T> { + | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized_fn_params.rs:5:1 + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:5:1 | 5 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -23,27 +28,45 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim | - this type parameter needs to be `std::marker::Sized` | note: required because it appears within the type `Struct<T>` - --> $DIR/project_replace_unsized_fn_params.rs:6:8 + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:6:8 | 6 | struct Struct<T: ?Sized> { | ^^^^^^ -note: required by `UnsafeOverwriteGuard` - --> $DIR/lib.rs:269:5 +note: required by a bound in `UnsafeOverwriteGuard::<T>::new` + --> src/lib.rs | -269 | pub struct UnsafeOverwriteGuard<T> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | impl<T> UnsafeOverwriteGuard<T> { + | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new` = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +6 - struct Struct<T: ?Sized> { +6 + struct Struct<T> { + | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized_fn_params.rs:7:5 + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:7:5 | +5 | #[pin_project(project_replace)] //~ ERROR E0277 + | ------------------------------- required by a bound introduced by this call 6 | struct Struct<T: ?Sized> { | - this type parameter needs to be `std::marker::Sized` 7 | f: T, | ^ doesn't have a size known at compile-time + | +note: required by a bound in `std::ptr::read` + --> $RUST/core/src/ptr/mod.rs + | + | pub const unsafe fn read<T>(src: *const T) -> T { + | ^ required by this bound in `std::ptr::read` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +6 - struct Struct<T: ?Sized> { +6 + struct Struct<T> { + | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized_fn_params.rs:11:8 + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:11:8 | 11 | struct TupleStruct<T: ?Sized>(T); | ^^^^^^^^^^^^-^^^^^^^^^ @@ -52,14 +75,19 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim | doesn't have a size known at compile-time | note: required because it appears within the type `__TupleStructProjectionOwned<T>` - --> $DIR/project_replace_unsized_fn_params.rs:11:8 + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:11:8 | 11 | struct TupleStruct<T: ?Sized>(T); | ^^^^^^^^^^^ = note: the return type of a function must have a statically known size +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +11 - struct TupleStruct<T: ?Sized>(T); +11 + struct TupleStruct<T>(T); + | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized_fn_params.rs:10:1 + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:10:1 | 10 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -67,13 +95,18 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim | - this type parameter needs to be `std::marker::Sized` | note: required because it appears within the type `TupleStruct<T>` - --> $DIR/project_replace_unsized_fn_params.rs:11:8 + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:11:8 | 11 | struct TupleStruct<T: ?Sized>(T); | ^^^^^^^^^^^ -note: required by `UnsafeOverwriteGuard` - --> $DIR/lib.rs:269:5 +note: required by a bound in `UnsafeOverwriteGuard::<T>::new` + --> src/lib.rs | -269 | pub struct UnsafeOverwriteGuard<T> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | impl<T> UnsafeOverwriteGuard<T> { + | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new` = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +11 - struct TupleStruct<T: ?Sized>(T); +11 + struct TupleStruct<T>(T); + | diff --git a/tests/ui/pin_project/remove-attr-from-field.stderr b/tests/ui/pin_project/remove-attr-from-field.stderr index 486bc00..697cd63 100644 --- a/tests/ui/pin_project/remove-attr-from-field.stderr +++ b/tests/ui/pin_project/remove-attr-from-field.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/remove-attr-from-field.rs:28:38 + --> tests/ui/pin_project/remove-attr-from-field.rs:28:38 | 28 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 | ----------------------- ^^^ expected struct `Pin`, found `&mut PhantomPinned` @@ -10,7 +10,7 @@ error[E0308]: mismatched types found mutable reference `&mut PhantomPinned` error[E0308]: mismatched types - --> $DIR/remove-attr-from-field.rs:32:38 + --> tests/ui/pin_project/remove-attr-from-field.rs:32:38 | 32 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 | ----------------------- ^^^ expected struct `Pin`, found `&mut PhantomPinned` diff --git a/tests/ui/pin_project/remove-attr-from-struct.stderr b/tests/ui/pin_project/remove-attr-from-struct.stderr index 57cf21d..1a9cd42 100644 --- a/tests/ui/pin_project/remove-attr-from-struct.stderr +++ b/tests/ui/pin_project/remove-attr-from-struct.stderr @@ -1,5 +1,5 @@ error: #[pin_project] attribute has been removed - --> $DIR/remove-attr-from-struct.rs:22:1 + --> tests/ui/pin_project/remove-attr-from-struct.rs:22:1 | 22 | #[pin_project] //~ ERROR has been removed | ^^^^^^^^^^^^^^ @@ -7,85 +7,101 @@ error: #[pin_project] attribute has been removed = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find attribute `pin` in this scope - --> $DIR/remove-attr-from-struct.rs:18:7 + --> tests/ui/pin_project/remove-attr-from-struct.rs:18:7 | 18 | #[pin] //~ ERROR cannot find attribute `pin` in this scope | ^^^ error: cannot find attribute `pin` in this scope - --> $DIR/remove-attr-from-struct.rs:11:7 + --> tests/ui/pin_project/remove-attr-from-struct.rs:11:7 | 11 | #[pin] //~ ERROR cannot find attribute `pin` in this scope | ^^^ error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/remove-attr-from-struct.rs:35:5 + --> tests/ui/pin_project/remove-attr-from-struct.rs:35:5 | -6 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... 35 | is_unpin::<A>(); //~ ERROR E0277 | ^^^^^^^^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned` | = note: consider using `Box::pin` note: required because it appears within the type `A` - --> $DIR/remove-attr-from-struct.rs:10:8 + --> tests/ui/pin_project/remove-attr-from-struct.rs:10:8 | 10 | struct A { | ^ +note: required by a bound in `is_unpin` + --> tests/ui/pin_project/remove-attr-from-struct.rs:6:16 + | +6 | fn is_unpin<T: Unpin>() {} + | ^^^^^ required by this bound in `is_unpin` error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/remove-attr-from-struct.rs:36:5 + --> tests/ui/pin_project/remove-attr-from-struct.rs:36:5 | -6 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... 36 | is_unpin::<B>(); //~ ERROR E0277 | ^^^^^^^^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned` | = note: consider using `Box::pin` note: required because it appears within the type `B` - --> $DIR/remove-attr-from-struct.rs:17:8 + --> tests/ui/pin_project/remove-attr-from-struct.rs:17:8 | 17 | struct B { | ^ +note: required by a bound in `is_unpin` + --> tests/ui/pin_project/remove-attr-from-struct.rs:6:16 + | +6 | fn is_unpin<T: Unpin>() {} + | ^^^^^ required by this bound in `is_unpin` error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/remove-attr-from-struct.rs:40:13 + --> tests/ui/pin_project/remove-attr-from-struct.rs:40:22 | 40 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 - | ^^^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned` + | -------- ^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned` + | | + | required by a bound introduced by this call | = note: consider using `Box::pin` note: required because it appears within the type `A` - --> $DIR/remove-attr-from-struct.rs:10:8 + --> tests/ui/pin_project/remove-attr-from-struct.rs:10:8 | 10 | struct A { | ^ -note: required by `Pin::<P>::new` +note: required by a bound in `Pin::<P>::new` + --> $RUST/core/src/pin.rs + | + | impl<P: Deref<Target: Unpin>> Pin<P> { + | ^^^^^ required by this bound in `Pin::<P>::new` error[E0599]: no method named `project` found for struct `Pin<&mut A>` in the current scope - --> $DIR/remove-attr-from-struct.rs:40:30 + --> tests/ui/pin_project/remove-attr-from-struct.rs:40:30 | 40 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 | ^^^^^^^ method not found in `Pin<&mut A>` error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/remove-attr-from-struct.rs:43:13 + --> tests/ui/pin_project/remove-attr-from-struct.rs:43:22 | 43 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 - | ^^^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned` + | -------- ^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned` + | | + | required by a bound introduced by this call | = note: consider using `Box::pin` note: required because it appears within the type `B` - --> $DIR/remove-attr-from-struct.rs:17:8 + --> tests/ui/pin_project/remove-attr-from-struct.rs:17:8 | 17 | struct B { | ^ -note: required by `Pin::<P>::new` +note: required by a bound in `Pin::<P>::new` + --> $RUST/core/src/pin.rs + | + | impl<P: Deref<Target: Unpin>> Pin<P> { + | ^^^^^ required by this bound in `Pin::<P>::new` error[E0599]: no method named `project` found for struct `Pin<&mut B>` in the current scope - --> $DIR/remove-attr-from-struct.rs:43:30 + --> tests/ui/pin_project/remove-attr-from-struct.rs:43:30 | 43 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 | ^^^^^^^ 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 8f4f462..de8181c 100644 --- a/tests/ui/pin_project/safe_packed_borrows.rs +++ b/tests/ui/pin_project/safe_packed_borrows.rs @@ -19,10 +19,8 @@ struct PackedN { fn main() { let a = Packed { f: 1 }; - &a.f; let _ = &a.f; let b = PackedN { f: 1 }; - &b.f; let _ = &b.f; } diff --git a/tests/ui/pin_project/safe_packed_borrows.stderr b/tests/ui/pin_project/safe_packed_borrows.stderr index 4048eaa..f483b6d 100644 --- a/tests/ui/pin_project/safe_packed_borrows.stderr +++ b/tests/ui/pin_project/safe_packed_borrows.stderr @@ -1,11 +1,11 @@ error: lint `safe_packed_borrows` has been renamed to `unaligned_references` - --> $DIR/safe_packed_borrows.rs:2:9 + --> tests/ui/pin_project/safe_packed_borrows.rs:2:9 | 2 | #![deny(safe_packed_borrows)] //~ ERROR has been renamed to `unaligned_references` | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `unaligned_references` | note: the lint level is defined here - --> $DIR/safe_packed_borrows.rs:1:9 + --> tests/ui/pin_project/safe_packed_borrows.rs:1:9 | 1 | #![deny(renamed_and_removed_lints)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/pin_project/unaligned_references.rs b/tests/ui/pin_project/unaligned_references.rs index 23dd71d..eaf185d 100644 --- a/tests/ui/pin_project/unaligned_references.rs +++ b/tests/ui/pin_project/unaligned_references.rs @@ -14,10 +14,8 @@ struct PackedN { fn main() { let a = Packed { f: 1 }; - &a.f; //~ ERROR reference to packed field is unaligned let _ = &a.f; //~ ERROR reference to packed field is unaligned let b = PackedN { f: 1 }; - &b.f; //~ ERROR reference to packed field is unaligned let _ = &b.f; //~ ERROR reference to packed field is unaligned } diff --git a/tests/ui/pin_project/unaligned_references.stderr b/tests/ui/pin_project/unaligned_references.stderr index 17600de..8d5ddfc 100644 --- a/tests/ui/pin_project/unaligned_references.stderr +++ b/tests/ui/pin_project/unaligned_references.stderr @@ -1,44 +1,26 @@ error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:17:5 + --> tests/ui/pin_project/unaligned_references.rs:17:13 | -17 | &a.f; //~ ERROR reference to packed field is unaligned - | ^^^^ +17 | let _ = &a.f; //~ ERROR reference to packed field is unaligned + | ^^^^ | note: the lint level is defined here - --> $DIR/unaligned_references.rs:1:11 + --> tests/ui/pin_project/unaligned_references.rs:1:11 | 1 | #![forbid(unaligned_references)] | ^^^^^^^^^^^^^^^^^^^^ = 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) error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:18:13 - | -18 | let _ = &a.f; //~ ERROR reference to packed field is unaligned - | ^^^^ - | - = 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) - -error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:21:5 - | -21 | &b.f; //~ ERROR reference to packed field is unaligned - | ^^^^ - | - = 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) - -error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:22:13 + --> tests/ui/pin_project/unaligned_references.rs:20:13 | -22 | let _ = &b.f; //~ ERROR reference to packed field is unaligned +20 | let _ = &b.f; //~ ERROR reference to packed field is unaligned | ^^^^ | = 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) diff --git a/tests/ui/pin_project/unpin_sneaky.stderr b/tests/ui/pin_project/unpin_sneaky.stderr index ab5e794..ddf700d 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 `__S` in this scope - --> $DIR/unpin_sneaky.rs:9:16 + --> tests/ui/pin_project/unpin_sneaky.rs:9:16 | 9 | impl Unpin for __S {} //~ 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]` - --> $DIR/unpin_sneaky.rs:9:1 + --> tests/ui/pin_project/unpin_sneaky.rs:9:1 | 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.stderr b/tests/ui/pin_project/visibility.stderr index a1f0423..4d1b722 100644 --- a/tests/ui/pin_project/visibility.stderr +++ b/tests/ui/pin_project/visibility.stderr @@ -1,39 +1,39 @@ -error[E0365]: `DProj` is private, and cannot be re-exported - --> $DIR/visibility.rs:15:13 +error[E0365]: `DProj` is only public within the crate, and cannot be re-exported outside + --> tests/ui/pin_project/visibility.rs:15:13 | 15 | pub use crate::pub_::DProj; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^ re-export of private `DProj` + | ^^^^^^^^^^^^^^^^^^ re-export of crate public `DProj` | = note: consider declaring type or module `DProj` with `pub` -error[E0365]: `DProjRef` is private, and cannot be re-exported - --> $DIR/visibility.rs:17:13 +error[E0365]: `DProjRef` is only public within the crate, and cannot be re-exported outside + --> tests/ui/pin_project/visibility.rs:17:13 | 17 | pub use crate::pub_::DProjRef; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^ re-export of private `DProjRef` + | ^^^^^^^^^^^^^^^^^^^^^ re-export of crate public `DProjRef` | = note: consider declaring type or module `DProjRef` with `pub` -error[E0365]: `RProj` is private, and cannot be re-exported - --> $DIR/visibility.rs:19:13 +error[E0365]: `RProj` is only public within the crate, and cannot be re-exported outside + --> tests/ui/pin_project/visibility.rs:19:13 | 19 | pub use crate::pub_::RProj; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^ re-export of private `RProj` + | ^^^^^^^^^^^^^^^^^^ re-export of crate public `RProj` | = note: consider declaring type or module `RProj` with `pub` -error[E0365]: `RProjOwn` is private, and cannot be re-exported - --> $DIR/visibility.rs:21:13 +error[E0365]: `RProjOwn` is only public within the crate, and cannot be re-exported outside + --> tests/ui/pin_project/visibility.rs:21:13 | 21 | pub use crate::pub_::RProjOwn; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProjOwn` + | ^^^^^^^^^^^^^^^^^^^^^ re-export of crate public `RProjOwn` | = note: consider declaring type or module `RProjOwn` with `pub` -error[E0365]: `RProjRef` is private, and cannot be re-exported - --> $DIR/visibility.rs:23:13 +error[E0365]: `RProjRef` is only public within the crate, and cannot be re-exported outside + --> tests/ui/pin_project/visibility.rs:23:13 | 23 | pub use crate::pub_::RProjRef; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProjRef` + | ^^^^^^^^^^^^^^^^^^^^^ re-export of crate public `RProjRef` | = note: consider declaring type or module `RProjRef` with `pub` |