From c95dc516440636acb2e9f0b61e3a4595a90c4d2e Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Wed, 19 May 2021 16:12:52 -0700 Subject: Upgrade rust/crates/pin-project to 1.0.7 Test: make Change-Id: I9cb8c4f9c94d68c5775ee9a360f4e882a836e186 --- .cargo_vcs_info.json | 2 +- Android.bp | 6 +- CHANGELOG.md | 122 +++++---- Cargo.toml | 4 +- Cargo.toml.orig | 4 +- METADATA | 8 +- examples/not_unpin-expanded.rs | 2 +- examples/pinned_drop-expanded.rs | 3 +- examples/project_replace-expanded.rs | 2 +- examples/struct-default-expanded.rs | 8 +- examples/unsafe_unpin-expanded.rs | 2 +- src/lib.rs | 5 +- src/lib.rs.orig | 282 --------------------- tests/expand/default/struct.expanded.rs | 2 +- tests/expand/default/tuple_struct.expanded.rs | 2 +- tests/expand/multifields/struct.expanded.rs | 2 +- tests/expand/multifields/tuple_struct.expanded.rs | 2 +- tests/expand/naming/struct-all.expanded.rs | 2 +- tests/expand/naming/struct-mut.expanded.rs | 2 +- tests/expand/naming/struct-none.expanded.rs | 2 +- tests/expand/naming/struct-own.expanded.rs | 2 +- tests/expand/naming/struct-ref.expanded.rs | 2 +- tests/expand/naming/tuple_struct-all.expanded.rs | 2 +- tests/expand/naming/tuple_struct-mut.expanded.rs | 2 +- tests/expand/naming/tuple_struct-none.expanded.rs | 2 +- tests/expand/naming/tuple_struct-own.expanded.rs | 2 +- tests/expand/naming/tuple_struct-ref.expanded.rs | 2 +- tests/expand/not_unpin/struct.expanded.rs | 2 +- tests/expand/not_unpin/tuple_struct.expanded.rs | 2 +- tests/expand/pinned_drop/enum.expanded.rs | 3 +- tests/expand/pinned_drop/enum.rs | 3 +- tests/expand/pinned_drop/struct.expanded.rs | 5 +- tests/expand/pinned_drop/struct.rs | 3 +- tests/expand/pinned_drop/tuple_struct.expanded.rs | 5 +- tests/expand/pinned_drop/tuple_struct.rs | 3 +- tests/expand/project_replace/struct.expanded.rs | 2 +- .../project_replace/tuple_struct.expanded.rs | 2 +- tests/expand/pub/struct.expanded.rs | 2 +- tests/expand/pub/tuple_struct.expanded.rs | 2 +- tests/expand/unsafe_unpin/struct.expanded.rs | 2 +- tests/expand/unsafe_unpin/tuple_struct.expanded.rs | 2 +- tests/expandtest.rs | 8 +- tests/lint.rs | 2 +- tests/pinned_drop.rs | 20 ++ tests/repr_packed.rs | 5 +- tests/ui/cfg/cfg_attr-type-mismatch.rs | 3 +- tests/ui/cfg/cfg_attr-type-mismatch.stderr | 8 +- tests/ui/cfg/packed_sneaky-span-issue-1.rs | 3 +- tests/ui/cfg/packed_sneaky-span-issue-1.stderr | 14 +- tests/ui/cfg/packed_sneaky-span-issue-2.rs | 3 +- tests/ui/cfg/packed_sneaky-span-issue-2.stderr | 14 +- tests/ui/cfg/unsupported.stderr | 5 +- tests/ui/not_unpin/conflict-unpin.stderr | 6 +- tests/ui/not_unpin/impl-unsafe-unpin.stderr | 6 +- tests/ui/pin_project/add-attr-to-struct.rs | 3 +- tests/ui/pin_project/add-attr-to-struct.stderr | 8 +- tests/ui/pin_project/add-pinned-field.stderr | 14 +- tests/ui/pin_project/conflict-drop.rs | 3 +- tests/ui/pin_project/conflict-drop.stderr | 14 +- tests/ui/pin_project/conflict-unpin.stderr | 6 +- tests/ui/pin_project/impl-unsafe-unpin.stderr | 6 +- tests/ui/pin_project/overlapping_unpin_struct.rs | 3 +- .../ui/pin_project/overlapping_unpin_struct.stderr | 13 +- tests/ui/pin_project/packed-enum.rs | 4 + tests/ui/pin_project/packed-enum.stderr | 50 ++-- tests/ui/pin_project/packed-name-value.rs | 19 +- tests/ui/pin_project/packed-name-value.stderr | 22 +- tests/ui/pin_project/packed.rs | 14 +- tests/ui/pin_project/packed.stderr | 6 + tests/ui/pin_project/packed_sneaky-1.rs | 3 +- tests/ui/pin_project/packed_sneaky-1.stderr | 12 +- .../ui/pin_project/project_replace_unsized.stderr | 36 ++- .../project_replace_unsized_fn_params.stderr | 34 ++- tests/ui/pin_project/remove-attr-from-field.rs | 3 +- tests/ui/pin_project/remove-attr-from-field.stderr | 8 +- tests/ui/pin_project/remove-attr-from-struct.rs | 3 +- .../ui/pin_project/remove-attr-from-struct.stderr | 68 +++-- tests/ui/pin_project/safe_packed_borrows.rs | 23 +- tests/ui/pin_project/safe_packed_borrows.stderr | 33 +-- tests/ui/pin_project/unaligned_references.rs | 23 ++ tests/ui/pin_project/unaligned_references.stderr | 44 ++++ tests/ui/pinned_drop/call-drop-inner.rs | 3 +- tests/ui/pinned_drop/call-drop-inner.stderr | 8 +- tests/ui/pinned_drop/conditional-drop-impl.rs | 3 +- tests/ui/pinned_drop/conditional-drop-impl.stderr | 27 +- tests/ui/pinned_drop/invalid.rs | 6 +- tests/ui/pinned_drop/invalid.stderr | 100 ++++---- tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs | 3 +- .../ui/pinned_drop/pinned-drop-no-attr-arg.stderr | 8 +- tests/ui/pinned_drop/self.rs | 6 +- tests/ui/pinned_drop/self.stderr | 34 +-- tests/ui/pinned_drop/unsafe-call.rs | 3 +- tests/ui/pinned_drop/unsafe-call.stderr | 4 +- tests/ui/unsafe_unpin/conflict-unpin.stderr | 6 +- .../marker_trait_attr-feature-gate.rs | 3 +- .../marker_trait_attr-feature-gate.stderr | 8 +- tests/ui/unstable-features/marker_trait_attr.rs | 3 +- .../ui/unstable-features/marker_trait_attr.stderr | 8 +- .../overlapping_marker_traits-feature-gate.rs | 3 +- .../overlapping_marker_traits-feature-gate.stderr | 8 +- .../unstable-features/overlapping_marker_traits.rs | 7 +- .../overlapping_marker_traits.stderr | 8 +- .../ui/unstable-features/trivial_bounds-bug.stderr | 2 + .../trivial_bounds-feature-gate.stderr | 18 +- 104 files changed, 656 insertions(+), 711 deletions(-) delete mode 100644 src/lib.rs.orig create mode 100644 tests/ui/pin_project/unaligned_references.rs create mode 100644 tests/ui/pin_project/unaligned_references.stderr diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 6cfdedc..51b8b66 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,5 @@ { "git": { - "sha1": "a51d39fcdb31fe78cc61c0053ead2beb65a4156d" + "sha1": "c110ce7bc8ad8473c735f8a2f8b4ca0f8bd4b315" } } diff --git a/Android.bp b/Android.bp index 068bed6..ce669bd 100644 --- a/Android.bp +++ b/Android.bp @@ -51,8 +51,8 @@ rust_library { } // dependent_library ["feature_list"] -// pin-project-internal-1.0.6 +// pin-project-internal-1.0.7 // proc-macro2-1.0.26 "default,proc-macro" // quote-1.0.9 "default,proc-macro" -// syn-1.0.71 "clone-impls,default,derive,full,parsing,printing,proc-macro,quote,visit-mut" -// unicode-xid-0.2.1 "default" +// syn-1.0.72 "clone-impls,default,derive,full,parsing,printing,proc-macro,quote,visit-mut" +// unicode-xid-0.2.2 "default" diff --git a/CHANGELOG.md b/CHANGELOG.md index a9b56e1..75f1613 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com ## [Unreleased] +## [1.0.7] - 2021-04-16 + +- Fix compile error when using `self::` as prefix of path inside `#[pinned_drop]` impl. + ## [1.0.6] - 2021-03-25 - [Suppress `clippy::semicolon_if_nothing_returned` lint in generated code.](https://github.com/taiki-e/pin-project/pull/318) @@ -106,6 +110,12 @@ Changes since the 1.0.0-alpha.1 release: See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project/issues/264). +## [0.4.28] - 2021-03-28 + +- [Fix `unused_must_use` warning on unused borrows, which will be added to rustc in the future.](https://github.com/taiki-e/pin-project/pull/322) See [#322](https://github.com/taiki-e/pin-project/pull/322) for more details. + + (Note: 1.0 does not have this problem.) + ## [0.4.27] - 2020-10-11 - Update minimal version of `syn` to 1.0.44 @@ -177,7 +187,7 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project } ``` -- [Makes `project_replace` argument an alias for `Replace` argument so that it can be used without a value.](https://github.com/taiki-e/pin-project/pull/243) +- [Make `project_replace` argument an alias for `Replace` argument so that it can be used without a value.](https://github.com/taiki-e/pin-project/pull/243) ```rust #[pin_project(project_replace)] @@ -227,7 +237,7 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.16] - 2020-05-11 -- [Fixed an issue that users can call internal function generated by `#[pinned_drop]`.](https://github.com/taiki-e/pin-project/pull/223) +- [Fix an issue that users can call internal function generated by `#[pinned_drop]`.](https://github.com/taiki-e/pin-project/pull/223) ## [0.4.15] - 2020-05-10 @@ -235,7 +245,7 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.14] - 2020-05-09 -- [Added `!Unpin` option to `#[pin_project]` attribute for guarantee the type is `!Unpin`.](https://github.com/taiki-e/pin-project/pull/219) +- [Add `!Unpin` option to `#[pin_project]` attribute for guarantee the type is `!Unpin`.](https://github.com/taiki-e/pin-project/pull/219) ```rust #[pin_project(!Unpin)] @@ -257,7 +267,7 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project *[Note: This raises the minimum supported Rust version of this crate from Rust 1.33 to Rust 1.34.](https://github.com/taiki-e/pin-project/pull/219#pullrequestreview-408644187)* -- [Fixed an issue where duplicate `#[project]` attributes were ignored.](https://github.com/taiki-e/pin-project/pull/218) +- [Fix an issue where duplicate `#[project]` attributes were ignored.](https://github.com/taiki-e/pin-project/pull/218) - [Suppress `single_use_lifetimes` lint in generated code.](https://github.com/taiki-e/pin-project/pull/217) @@ -269,11 +279,11 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.13] - 2020-05-07 -- [Fixed a regression in 0.4.11.](https://github.com/taiki-e/pin-project/pull/207) +- [Fix a regression in 0.4.11.](https://github.com/taiki-e/pin-project/pull/207) Changes from [0.4.10](https://github.com/taiki-e/pin-project/releases/tag/v0.4.10) and [0.4.12](https://github.com/taiki-e/pin-project/releases/tag/v0.4.12): - - [Fixed an issue that `#[project]` on non-statement expression does not work without unstable features.](https://github.com/taiki-e/pin-project/pull/197) + - [Fix an issue that `#[project]` on non-statement expression does not work without unstable features.](https://github.com/taiki-e/pin-project/pull/197) - [Support overwriting the name of core crate.](https://github.com/taiki-e/pin-project/pull/199) @@ -291,7 +301,7 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project **Note: This release has been yanked.** See [#206](https://github.com/taiki-e/pin-project/issues/206) for details. -- [Fixed an issue that `#[project]` on non-statement expression does not work without unstable features.](https://github.com/taiki-e/pin-project/pull/197) +- [Fix an issue that `#[project]` on non-statement expression does not work without unstable features.](https://github.com/taiki-e/pin-project/pull/197) - [Support overwriting the name of core crate.](https://github.com/taiki-e/pin-project/pull/199) @@ -303,43 +313,43 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.10] - 2020-05-04 -- [Added `project_replace` method and `#[project_replace]` attribute.](https://github.com/taiki-e/pin-project/pull/194) +- [Add `project_replace` method and `#[project_replace]` attribute.](https://github.com/taiki-e/pin-project/pull/194) `project_replace` method is optional and can be enabled by passing the `Replace` argument to `#[pin_project]` attribute. See [the documentation](https://docs.rs/pin-project/0.4/pin_project/attr.pin_project.html#project_replace) for more details. - [Support `Self` and `self` in more syntax positions inside `#[pinned_drop]` impl.](https://github.com/taiki-e/pin-project/pull/190) -- [Hided all generated items except for projected types from calling code.](https://github.com/taiki-e/pin-project/pull/192) See [#192](https://github.com/taiki-e/pin-project/pull/192) for details. +- [Hide all generated items except for projected types from calling code.](https://github.com/taiki-e/pin-project/pull/192) See [#192](https://github.com/taiki-e/pin-project/pull/192) for details. ## [0.4.9] - 2020-04-14 -- [Fixed lifetime inference error when associated types are used in fields.](https://github.com/taiki-e/pin-project/pull/188) +- [Fix lifetime inference error when associated types are used in fields.](https://github.com/taiki-e/pin-project/pull/188) -- [Fixed compile error with tuple structs with `where` clauses.](https://github.com/taiki-e/pin-project/pull/186) +- [Fix compile error with tuple structs with `where` clauses.](https://github.com/taiki-e/pin-project/pull/186) - [`#[project]` attribute can now be used for `if let` expressions.](https://github.com/taiki-e/pin-project/pull/181) ## [0.4.8] - 2020-01-27 -- [Ensured that users cannot implement `PinnedDrop` without proper attribute argument.](https://github.com/taiki-e/pin-project/pull/180) +- [Ensure that users cannot implement `PinnedDrop` without proper attribute argument.](https://github.com/taiki-e/pin-project/pull/180) -- [Fixed use of `Self` in expression position inside `#[pinned_drop]` impl.](https://github.com/taiki-e/pin-project/pull/177) +- [Fix use of `Self` in expression position inside `#[pinned_drop]` impl.](https://github.com/taiki-e/pin-project/pull/177) ## [0.4.7] - 2020-01-20 -- [Fixed support for lifetime bounds.](https://github.com/taiki-e/pin-project/pull/176) +- [Fix support for lifetime bounds.](https://github.com/taiki-e/pin-project/pull/176) ## [0.4.6] - 2019-11-20 -- [Fixed compile error when there is `Self` in the where clause.](https://github.com/taiki-e/pin-project/pull/169) +- [Fix compile error when there is `Self` in the where clause.](https://github.com/taiki-e/pin-project/pull/169) ## [0.4.5] - 2019-10-21 -- [Fixed compile error with `dyn` types.](https://github.com/taiki-e/pin-project/pull/158) +- [Fix compile error with `dyn` types.](https://github.com/taiki-e/pin-project/pull/158) ## [0.4.4] - 2019-10-17 -- [Fixed an issue where `PinnedDrop` implementations can call unsafe code without an unsafe block.](https://github.com/taiki-e/pin-project/pull/149) +- [Fix an issue where `PinnedDrop` implementations can call unsafe code without an unsafe block.](https://github.com/taiki-e/pin-project/pull/149) ## [0.4.3] - 2019-10-15 @@ -349,7 +359,7 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project - [`#[pin_project]` can now interoperate with `#[cfg()]` on tuple structs and tuple variants.](https://github.com/taiki-e/pin-project/pull/135) -- [Fixed support for DSTs(Dynamically Sized Types) on `#[pin_project(UnsafeUnpin)]`](https://github.com/taiki-e/pin-project/pull/120) +- [Fix support for DSTs(Dynamically Sized Types) on `#[pin_project(UnsafeUnpin)]`](https://github.com/taiki-e/pin-project/pull/120) - Diagnostic improvements. @@ -357,13 +367,13 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project **Note: This release has been yanked.** See [#148](https://github.com/taiki-e/pin-project/pull/148) for details. -- [Fixed support for DSTs(Dynamically Sized Types).](https://github.com/taiki-e/pin-project/pull/113) +- [Fix support for DSTs(Dynamically Sized Types).](https://github.com/taiki-e/pin-project/pull/113) ## [0.4.1] - 2019-09-26 **Note: This release has been yanked.** See [#148](https://github.com/taiki-e/pin-project/pull/148) for details. -- [Fixed an issue that caused an error when using `#[pin_project]` on a type that has `#[pin]` + `!Unpin` field with no generics or lifetime.](https://github.com/taiki-e/pin-project/pull/111) +- [Fix an issue that caused an error when using `#[pin_project]` on a type that has `#[pin]` + `!Unpin` field with no generics or lifetime.](https://github.com/taiki-e/pin-project/pull/111) ## [0.4.0] - 2019-09-25 @@ -385,11 +395,11 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project - [`#[pin_project]` can now interoperate with `#[cfg()]`.](https://github.com/taiki-e/pin-project/pull/77) -- [Added `project_ref` method to `#[pin_project]` types.](https://github.com/taiki-e/pin-project/pull/93) +- [Add `project_ref` method to `#[pin_project]` types.](https://github.com/taiki-e/pin-project/pull/93) -- [Added `#[project_ref]` attribute.](https://github.com/taiki-e/pin-project/pull/93) +- [Add `#[project_ref]` attribute.](https://github.com/taiki-e/pin-project/pull/93) -- [Removed "project_attr" feature and always enable `#[project]` attribute.](https://github.com/taiki-e/pin-project/pull/94) +- [Remove "project_attr" feature and always enable `#[project]` attribute.](https://github.com/taiki-e/pin-project/pull/94) - [`#[project]` attribute can now be used for `impl` blocks.](https://github.com/taiki-e/pin-project/pull/46) @@ -399,25 +409,25 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project Changes since the 0.4.0-beta.1 release: -- [Fixed an issue that caused an error when using `#[pin_project(UnsafeUnpin)]` and not providing a manual `UnsafeUnpin` implementation on a type with no generics or lifetime.](https://github.com/taiki-e/pin-project/pull/107) +- [Fix an issue that caused an error when using `#[pin_project(UnsafeUnpin)]` and not providing a manual `UnsafeUnpin` implementation on a type with no generics or lifetime.](https://github.com/taiki-e/pin-project/pull/107) ## [0.4.0-beta.1] - 2019-09-21 -- [Changed the argument type of project method back to `self: Pin<&mut Self>`.](https://github.com/taiki-e/pin-project/pull/90) +- [Change the argument type of project method back to `self: Pin<&mut Self>`.](https://github.com/taiki-e/pin-project/pull/90) -- [Removed "project_attr" feature and always enable `#[project]` attribute.](https://github.com/taiki-e/pin-project/pull/94) +- [Remove "project_attr" feature and always enable `#[project]` attribute.](https://github.com/taiki-e/pin-project/pull/94) -- [Removed "renamed" feature.](https://github.com/taiki-e/pin-project/pull/100) +- [Remove "renamed" feature.](https://github.com/taiki-e/pin-project/pull/100) - [`#[project]` attribute can now be used for `use` statements.](https://github.com/taiki-e/pin-project/pull/85) -- [Added `project_ref` method and `#[project_ref]` attribute.](https://github.com/taiki-e/pin-project/pull/93) +- [Add `project_ref` method and `#[project_ref]` attribute.](https://github.com/taiki-e/pin-project/pull/93) - [`#[pin_project]` attribute now determines the visibility of the projection type/method is based on the original type.](https://github.com/taiki-e/pin-project/pull/96) ## [0.4.0-alpha.11] - 2019-09-11 -- [Changed #[pinned_drop] to trait implementation.](https://github.com/taiki-e/pin-project/pull/86) +- [Change #[pinned_drop] to trait implementation.](https://github.com/taiki-e/pin-project/pull/86) ```rust #[pinned_drop] @@ -428,7 +438,7 @@ Changes since the 0.4.0-beta.1 release: } ``` -- Added some examples and generated code. +- Add some examples and generated code. - Diagnostic improvements. @@ -440,7 +450,7 @@ Changes since the 0.4.0-beta.1 release: ## [0.4.0-alpha.9] - 2019-09-05 -- [Added 'project_into' method to `#[pin_project]` types](https://github.com/taiki-e/pin-project/pull/69). This can be useful when returning a pin projection from a method. +- [Add `project_into` method to `#[pin_project]` types](https://github.com/taiki-e/pin-project/pull/69). This can be useful when returning a pin projection from a method. ```rust fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T> { @@ -448,11 +458,11 @@ Changes since the 0.4.0-beta.1 release: } ``` -- [Prevented UnpinStruct from appearing in the document by default.](https://github.com/taiki-e/pin-project/pull/71) See [#71](https://github.com/taiki-e/pin-project/pull/71) for more details. +- [Prevent `UnpinStruct` from appearing in the document by default.](https://github.com/taiki-e/pin-project/pull/71) See [#71](https://github.com/taiki-e/pin-project/pull/71) for more details. ## [0.4.0-alpha.8] - 2019-09-03 -- [Improved document of generated code.](https://github.com/taiki-e/pin-project/pull/62). Also added an option to control the document of generated code. See [#62](https://github.com/taiki-e/pin-project/pull/62) for more details. +- [Improve document of generated code.](https://github.com/taiki-e/pin-project/pull/62). Also added an option to control the document of generated code. See [#62](https://github.com/taiki-e/pin-project/pull/62) for more details. - [Diagnostic improvements.](https://github.com/taiki-e/pin-project/pull/61) @@ -462,7 +472,7 @@ Changes since the 0.4.0-beta.1 release: ## [0.4.0-alpha.6] - 2019-09-01 -- [Allowed using `#[pin_project]` type with private field types](https://github.com/taiki-e/pin-project/pull/53) +- [Allow using `#[pin_project]` type with private field types](https://github.com/taiki-e/pin-project/pull/53) ## [0.4.0-alpha.5] - 2019-08-24 @@ -474,7 +484,7 @@ Changes since the 0.4.0-beta.1 release: ## [0.4.0-alpha.3] - 2019-08-23 -- [Changed `project` method generated by `#[pin_project]` attribute to take an `&mut Pin<&mut Self>` argument.](https://github.com/taiki-e/pin-project/pull/47) +- [Change `project` method generated by `#[pin_project]` attribute to take an `&mut Pin<&mut Self>` argument.](https://github.com/taiki-e/pin-project/pull/47) - [`#[project]` attribute can now be used for impl blocks.](https://github.com/taiki-e/pin-project/pull/46) @@ -482,7 +492,7 @@ Changes since the 0.4.0-beta.1 release: ## [0.4.0-alpha.2] - 2019-08-13 -- Updated `proc-macro2`, `syn`, and `quote` to 1.0. +- Update `proc-macro2`, `syn`, and `quote` to 1.0. ## [0.4.0-alpha.1] - 2019-08-11 @@ -496,13 +506,13 @@ Changes since the 0.4.0-beta.1 release: - `Unpin` impls must be specified with an impl of `UnsafeUnpin`, instead of implementing the normal `Unpin` trait. -- Made `#[project]` attribute disabled by default. +- Make `#[project]` attribute disabled by default. See also [tracking issue for 0.4 release](https://github.com/taiki-e/pin-project/issues/21). ## [0.3.5] - 2019-08-14 -- Updated `proc-macro2`, `syn`, and `quote` to 1.0. +- Update `proc-macro2`, `syn`, and `quote` to 1.0. ## [0.3.4] - 2019-07-21 @@ -516,63 +526,63 @@ See also [tracking issue for 0.4 release](https://github.com/taiki-e/pin-project ## [0.3.2] - 2019-03-30 -- Avoided suffixes on tuple index. +- Avoid suffixes on tuple index. ## [0.3.1] - 2019-03-02 - Documentation improvements. -- Updated minimum `syn` version to 0.15.22. +- Update minimum `syn` version to 0.15.22. ## [0.3.0] - 2019-02-20 -- Removed `unsafe_fields` attribute. +- Remove `unsafe_fields` attribute. -- Removed `unsafe_variants` attribute. +- Remove `unsafe_variants` attribute. ## [0.2.2] - 2019-02-20 -- Fixed a bug that generates incorrect code for the some structures with trait bounds on type generics. +- Fix a bug that generates incorrect code for the some structures with trait bounds on type generics. ## [0.2.1] - 2019-02-20 -- Fixed a bug that generates incorrect code for the structures with where clause and associated type fields. +- Fix a bug that generates incorrect code for the structures with where clause and associated type fields. ## [0.2.0] - 2019-02-11 -- Made `unsafe_fields` optional. +- Make `unsafe_fields` optional. - Documentation improvements. ## [0.1.8] - 2019-02-02 -- Added the feature to create projected enums to `unsafe_project`. +- Add the feature to create projected enums to `unsafe_project`. -- Added `project` attribute to support pattern matching. +- Add `project` attribute to support pattern matching. ## [0.1.7] - 2019-01-19 -- Fixed documentation. +- Fix documentation. ## [0.1.6] - 2019-01-19 - `unsafe_fields` can now opt-out. -- Added `unsafe_variants` attribute. This attribute is available if pin-project is built with the "unsafe_variants" feature. +- Add `unsafe_variants` attribute. This attribute is available if pin-project is built with the "unsafe_variants" feature. ## [0.1.5] - 2019-01-17 -- Added support for tuple struct to `unsafe_project`. +- Add support for tuple struct to `unsafe_project`. ## [0.1.4] - 2019-01-12 -- Added options for automatically implementing `Unpin` to both `unsafe_project` and `unsafe_fields`. +- Add options for automatically implementing `Unpin` to both `unsafe_project` and `unsafe_fields`. ## [0.1.3] - 2019-01-11 -- Fixed dependencies. +- Fix dependencies. -- Added `unsafe_fields` attribute. +- Add `unsafe_fields` attribute. ## [0.1.2] - 2019-01-09 @@ -580,7 +590,7 @@ See also [tracking issue for 0.4 release](https://github.com/taiki-e/pin-project ## [0.1.1] - 2019-01-08 -- Renamed from `unsafe_pin_project` to `unsafe_project`. +- Rename from `unsafe_pin_project` to `unsafe_project`. ## [0.1.0] - 2019-01-08 @@ -588,7 +598,8 @@ See also [tracking issue for 0.4 release](https://github.com/taiki-e/pin-project Initial release -[Unreleased]: https://github.com/taiki-e/pin-project/compare/v1.0.6...HEAD +[Unreleased]: https://github.com/taiki-e/pin-project/compare/v1.0.7...HEAD +[1.0.7]: https://github.com/taiki-e/pin-project/compare/v1.0.6...v1.0.7 [1.0.6]: https://github.com/taiki-e/pin-project/compare/v1.0.5...v1.0.6 [1.0.5]: https://github.com/taiki-e/pin-project/compare/v1.0.4...v1.0.5 [1.0.4]: https://github.com/taiki-e/pin-project/compare/v1.0.3...v1.0.4 @@ -597,6 +608,7 @@ Initial release [1.0.1]: https://github.com/taiki-e/pin-project/compare/v1.0.0...v1.0.1 [1.0.0]: https://github.com/taiki-e/pin-project/compare/v1.0.0-alpha.1...v1.0.0 [1.0.0-alpha.1]: https://github.com/taiki-e/pin-project/compare/v0.4.23...v1.0.0-alpha.1 +[0.4.28]: https://github.com/taiki-e/pin-project/compare/v0.4.27...v0.4.28 [0.4.27]: https://github.com/taiki-e/pin-project/compare/v0.4.26...v0.4.27 [0.4.26]: https://github.com/taiki-e/pin-project/compare/v0.4.25...v0.4.26 [0.4.25]: https://github.com/taiki-e/pin-project/compare/v0.4.24...v0.4.25 diff --git a/Cargo.toml b/Cargo.toml index 21ff1d7..5947cc5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ [package] edition = "2018" name = "pin-project" -version = "1.0.6" +version = "1.0.7" authors = ["Taiki Endo "] exclude = ["/.*", "/ci", "/tools"] description = "A crate for safe and ergonomic pin-projection.\n" @@ -25,7 +25,7 @@ repository = "https://github.com/taiki-e/pin-project" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies.pin-project-internal] -version = "=1.0.6" +version = "=1.0.7" default-features = false [dev-dependencies.macrotest] version = "1.0.8" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index ef46030..00291a7 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "pin-project" -version = "1.0.6" +version = "1.0.7" authors = ["Taiki Endo "] edition = "2018" license = "Apache-2.0 OR MIT" @@ -27,7 +27,7 @@ members = [ ] [dependencies] -pin-project-internal = { version = "=1.0.6", path = "pin-project-internal", default-features = false } +pin-project-internal = { version = "=1.0.7", path = "pin-project-internal", default-features = false } [dev-dependencies] pin-project-auxiliary-macro = { path = "tests/auxiliary/macro" } diff --git a/METADATA b/METADATA index 094731f..3a96d60 100644 --- a/METADATA +++ b/METADATA @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/pin-project/pin-project-1.0.6.crate" + value: "https://static.crates.io/crates/pin-project/pin-project-1.0.7.crate" } - version: "1.0.6" + version: "1.0.7" license_type: NOTICE last_upgrade_date { year: 2021 - month: 4 - day: 1 + month: 5 + day: 19 } } diff --git a/examples/not_unpin-expanded.rs b/examples/not_unpin-expanded.rs index aa5209d..5700c12 100644 --- a/examples/not_unpin-expanded.rs +++ b/examples/not_unpin-expanded.rs @@ -76,7 +76,7 @@ const _: () = { // // See ./struct-default-expanded.rs and https://github.com/taiki-e/pin-project/pull/34 // for details. - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/examples/pinned_drop-expanded.rs b/examples/pinned_drop-expanded.rs index 48eb7fc..019f151 100644 --- a/examples/pinned_drop-expanded.rs +++ b/examples/pinned_drop-expanded.rs @@ -82,7 +82,7 @@ const _: () = { // // See ./struct-default-expanded.rs and https://github.com/taiki-e/pin-project/pull/34 // for details. - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed<'a, T>(this: &Struct<'a, T>) { let _ = &this.was_dropped; let _ = &this.field; @@ -135,6 +135,7 @@ const _: () = { // Users can implement [`Drop`] safely using `#[pinned_drop]` and can drop a // type that implements `PinnedDrop` using the [`drop`] function safely. // **Do not call or implement this trait directly.** +#[doc(hidden)] impl ::pin_project::__private::PinnedDrop for Struct<'_, T> { // Since calling it twice on the same object would be UB, // this method is unsafe. diff --git a/examples/project_replace-expanded.rs b/examples/project_replace-expanded.rs index 4f43bda..ebb8e00 100644 --- a/examples/project_replace-expanded.rs +++ b/examples/project_replace-expanded.rs @@ -112,7 +112,7 @@ const _: () = { // // See ./struct-default-expanded.rs and https://github.com/taiki-e/pin-project/pull/34 // for details. - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/examples/struct-default-expanded.rs b/examples/struct-default-expanded.rs index 3d0e4ab..d661099 100644 --- a/examples/struct-default-expanded.rs +++ b/examples/struct-default-expanded.rs @@ -71,10 +71,8 @@ const _: () = { // Ensure that it's impossible to use pin projections on a #[repr(packed)] // struct. // - // Taking a reference to a packed field is unsafe, and applying - // #[forbid(safe_packed_borrows)] makes sure that doing this without - // an 'unsafe' block (which we deliberately do not generate) - // is a hard error. + // Taking a reference to a packed field is UB, and applying + // `#[forbid(unaligned_references)]` makes sure that doing this is a hard error. // // If the struct ends up having #[repr(packed)] applied somehow, // this will generate an (unfriendly) error message. Under all reasonable @@ -82,7 +80,7 @@ const _: () = { // a much nicer error above. // // See https://github.com/taiki-e/pin-project/pull/34 for more details. - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/examples/unsafe_unpin-expanded.rs b/examples/unsafe_unpin-expanded.rs index 2ea1f37..e9c7abc 100644 --- a/examples/unsafe_unpin-expanded.rs +++ b/examples/unsafe_unpin-expanded.rs @@ -75,7 +75,7 @@ const _: () = { // // See ./struct-default-expanded.rs and https://github.com/taiki-e/pin-project/pull/34 // for details. - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/src/lib.rs b/src/lib.rs index b7fd8cc..2940f19 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -74,9 +74,8 @@ allow(dead_code, unused_variables) ) ))] -#![warn(future_incompatible, rust_2018_idioms, single_use_lifetimes, unreachable_pub)] -#![warn(missing_docs)] -#![warn(clippy::all, clippy::default_trait_access)] +#![warn(future_incompatible, missing_docs, rust_2018_idioms, single_use_lifetimes, unreachable_pub)] +#![warn(clippy::default_trait_access)] #![allow(clippy::needless_doctest_main)] // ANDROID: Use std to allow building as a dylib. diff --git a/src/lib.rs.orig b/src/lib.rs.orig deleted file mode 100644 index 24cd303..0000000 --- a/src/lib.rs.orig +++ /dev/null @@ -1,282 +0,0 @@ -//! A crate for safe and ergonomic [pin-projection]. -//! -//! # Examples -//! -//! [`#[pin_project]`][`pin_project`] attribute creates projection types -//! covering all the fields of struct or enum. -//! -//! ```rust -//! use std::pin::Pin; -//! -//! use pin_project::pin_project; -//! -//! #[pin_project] -//! struct Struct { -//! #[pin] -//! pinned: T, -//! unpinned: U, -//! } -//! -//! impl Struct { -//! fn method(self: Pin<&mut Self>) { -//! let this = self.project(); -//! let _: Pin<&mut T> = this.pinned; // Pinned reference to the field -//! let _: &mut U = this.unpinned; // Normal reference to the field -//! } -//! } -//! ``` -//! -//! [*code like this will be generated*][struct-default-expanded] -//! -//! To use `#[pin_project]` on enums, you need to name the projection type -//! returned from the method. -//! -//! ```rust -//! use std::pin::Pin; -//! -//! use pin_project::pin_project; -//! -//! #[pin_project(project = EnumProj)] -//! enum Enum { -//! Pinned(#[pin] T), -//! Unpinned(U), -//! } -//! -//! impl Enum { -//! fn method(self: Pin<&mut Self>) { -//! match self.project() { -//! EnumProj::Pinned(x) => { -//! let _: Pin<&mut T> = x; -//! } -//! EnumProj::Unpinned(y) => { -//! let _: &mut U = y; -//! } -//! } -//! } -//! } -//! ``` -//! -//! [*code like this will be generated*][enum-default-expanded] -//! -//! See [`#[pin_project]`][`pin_project`] attribute for more details, and -//! see [examples] directory for more examples and generated code. -//! -//! [examples]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/README.md -//! [enum-default-expanded]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/enum-default-expanded.rs -//! [pin-projection]: core::pin#projections-and-structural-pinning -//! [struct-default-expanded]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/struct-default-expanded.rs - -#![no_std] -#![doc(test( - no_crate_inject, - attr( - deny(warnings, rust_2018_idioms, single_use_lifetimes), - allow(dead_code, unused_variables) - ) -))] -#![warn(future_incompatible, rust_2018_idioms, single_use_lifetimes, unreachable_pub)] -#![warn(missing_docs)] -#![warn(clippy::all, clippy::default_trait_access)] -#![allow(clippy::needless_doctest_main)] - -#[doc(inline)] -pub use pin_project_internal::pin_project; -#[doc(inline)] -pub use pin_project_internal::pinned_drop; - -/// A trait used for custom implementations of [`Unpin`]. -/// -/// This trait is used in conjunction with the `UnsafeUnpin` argument to -/// the [`#[pin_project]`][macro@pin_project] attribute. -/// -/// The Rust [`Unpin`] trait is safe to implement - by itself, -/// implementing it cannot lead to [undefined behavior][undefined-behavior]. -/// Undefined behavior can only occur when other unsafe code is used. -/// -/// It turns out that using pin projections, which requires unsafe code, -/// imposes additional requirements on an [`Unpin`] impl. Normally, all of this -/// unsafety is contained within this crate, ensuring that it's impossible for -/// you to violate any of the guarantees required by pin projection. -/// -/// However, things change if you want to provide a custom [`Unpin`] impl -/// for your `#[pin_project]` type. As stated in [the Rust -/// documentation][pin-projection], you must be sure to only implement [`Unpin`] -/// when all of your `#[pin]` fields (i.e. structurally pinned fields) are also -/// [`Unpin`]. -/// -/// To help highlight this unsafety, the `UnsafeUnpin` trait is provided. -/// Implementing this trait is logically equivalent to implementing [`Unpin`] - -/// this crate will generate an [`Unpin`] impl for your type that 'forwards' to -/// your `UnsafeUnpin` impl. However, this trait is `unsafe` - since your type -/// uses structural pinning (otherwise, you wouldn't be using this crate!), -/// you must be sure that your `UnsafeUnpin` impls follows all of -/// the requirements for an [`Unpin`] impl of a structurally-pinned type. -/// -/// Note that if you specify `#[pin_project(UnsafeUnpin)]`, but do *not* -/// provide an impl of `UnsafeUnpin`, your type will never implement [`Unpin`]. -/// This is effectively the same thing as adding a [`PhantomPinned`] to your -/// type. -/// -/// Since this trait is `unsafe`, impls of it will be detected by the -/// `unsafe_code` lint, and by tools like [`cargo geiger`][cargo-geiger]. -/// -/// # Examples -/// -/// An `UnsafeUnpin` impl which, in addition to requiring that structurally -/// pinned fields be [`Unpin`], imposes an additional requirement: -/// -/// ```rust -/// use pin_project::{pin_project, UnsafeUnpin}; -/// -/// #[pin_project(UnsafeUnpin)] -/// struct Struct { -/// #[pin] -/// field_1: K, -/// field_2: V, -/// } -/// -/// unsafe impl UnsafeUnpin for Struct where K: Unpin + Clone {} -/// ``` -/// -/// [`PhantomPinned`]: core::marker::PhantomPinned -/// [cargo-geiger]: https://github.com/rust-secure-code/cargo-geiger -/// [pin-projection]: core::pin#projections-and-structural-pinning -/// [undefined-behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html -pub unsafe trait UnsafeUnpin {} - -// Not public API. -#[doc(hidden)] -pub mod __private { - #[doc(hidden)] - pub use core::{ - marker::{PhantomData, PhantomPinned, Unpin}, - mem::ManuallyDrop, - ops::Drop, - pin::Pin, - ptr, - }; - - #[doc(hidden)] - pub use pin_project_internal::__PinProjectInternalDerive; - - use super::UnsafeUnpin; - - // An internal trait used for custom implementations of [`Drop`]. - // - // **Do not call or implement this trait directly.** - // - // # Why this trait is private and `#[pinned_drop]` attribute is needed? - // - // Implementing `PinnedDrop::drop` is safe, but calling it is not safe. - // This is because destructors can be called multiple times in safe code and - // [double dropping is unsound][rust-lang/rust#62360]. - // - // Ideally, it would be desirable to be able to forbid manual calls in - // the same way as [`Drop::drop`], but the library cannot do it. So, by using - // macros and replacing them with private traits, - // this crate prevent users from calling `PinnedDrop::drop` in safe code. - // - // This allows implementing [`Drop`] safely using `#[pinned_drop]`. - // Also by using the [`drop`] function just like dropping a type that directly - // implements [`Drop`], can drop safely a type that implements `PinnedDrop`. - // - // [rust-lang/rust#62360]: https://github.com/rust-lang/rust/pull/62360 - #[doc(hidden)] - pub trait PinnedDrop { - #[doc(hidden)] - unsafe fn drop(self: Pin<&mut Self>); - } - - // This is an internal helper struct used by `pin-project-internal`. - // This allows us to force an error if the user tries to provide - // a regular `Unpin` impl when they specify the `UnsafeUnpin` argument. - // This is why we need Wrapper: - // - // Supposed we have the following code: - // - // ```rust - // #[pin_project(UnsafeUnpin)] - // struct MyStruct { - // #[pin] field: T - // } - // - // impl Unpin for MyStruct where MyStruct: UnsafeUnpin {} // generated by pin-project-internal - // impl Unpin for MyStruct where T: Copy // written by the user - // ``` - // - // We want this code to be rejected - the user is completely bypassing - // `UnsafeUnpin`, and providing an unsound Unpin impl in safe code! - // - // Unfortunately, the Rust compiler will accept the above code. - // Because MyStruct is declared in the same crate as the user-provided impl, - // the compiler will notice that `MyStruct: UnsafeUnpin` never holds. - // - // The solution is to introduce the `Wrapper` struct, which is defined - // in the `pin-project` crate. - // - // We now have code that looks like this: - // - // ```rust - // impl Unpin for MyStruct where Wrapper>: UnsafeUnpin {} // generated by pin-project-internal - // impl Unpin for MyStruct where T: Copy // written by the user - // ``` - // - // We also have `unsafe impl UnsafeUnpin for Wrapper where T: UnsafeUnpin {}` - // in the `pin-project` crate. - // - // Now, our generated impl has a bound involving a type defined in another - // crate - Wrapper. This will cause rust to conservatively assume that - // `Wrapper>: UnsafeUnpin` holds, in the interest of preserving - // forwards compatibility (in case such an impl is added for Wrapper in - // a new version of the crate). - // - // This will cause rust to reject any other `Unpin` impls for MyStruct, - // since it will assume that our generated impl could potentially apply in - // any situation. - // - // This achieves the desired effect - when the user writes - // `#[pin_project(UnsafeUnpin)]`, the user must either provide no impl of - // `UnsafeUnpin` (which is equivalent to making the type never implement - // Unpin), or provide an impl of `UnsafeUnpin`. It is impossible for them to - // provide an impl of `Unpin` - #[doc(hidden)] - pub struct Wrapper<'a, T: ?Sized>(PhantomData<&'a ()>, T); - - unsafe impl UnsafeUnpin for Wrapper<'_, T> where T: UnsafeUnpin {} - - // This is an internal helper struct used by `pin-project-internal`. - // - // See https://github.com/taiki-e/pin-project/pull/53 for more details. - #[doc(hidden)] - pub struct AlwaysUnpin<'a, T>(PhantomData<&'a ()>, PhantomData); - - impl Unpin for AlwaysUnpin<'_, T> {} - - // This is an internal helper used to ensure a value is dropped. - #[doc(hidden)] - pub struct UnsafeDropInPlaceGuard(pub *mut T); - - impl Drop for UnsafeDropInPlaceGuard { - fn drop(&mut self) { - unsafe { - ptr::drop_in_place(self.0); - } - } - } - - // This is an internal helper used to ensure a value is overwritten without - // its destructor being called. - #[doc(hidden)] - pub struct UnsafeOverwriteGuard { - pub value: ManuallyDrop, - pub target: *mut T, - } - - impl Drop for UnsafeOverwriteGuard { - fn drop(&mut self) { - unsafe { - ptr::write(self.target, ptr::read(&*self.value)); - } - } - } -} diff --git a/tests/expand/default/struct.expanded.rs b/tests/expand/default/struct.expanded.rs index 2528ece..70f04ef 100644 --- a/tests/expand/default/struct.expanded.rs +++ b/tests/expand/default/struct.expanded.rs @@ -77,7 +77,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/tests/expand/default/tuple_struct.expanded.rs b/tests/expand/default/tuple_struct.expanded.rs index 3e8e306..1322d22 100644 --- a/tests/expand/default/tuple_struct.expanded.rs +++ b/tests/expand/default/tuple_struct.expanded.rs @@ -65,7 +65,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &TupleStruct) { let _ = &this.0; let _ = &this.1; diff --git a/tests/expand/multifields/struct.expanded.rs b/tests/expand/multifields/struct.expanded.rs index 17dab6a..1f7dfdd 100644 --- a/tests/expand/multifields/struct.expanded.rs +++ b/tests/expand/multifields/struct.expanded.rs @@ -142,7 +142,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned1; let _ = &this.pinned2; diff --git a/tests/expand/multifields/tuple_struct.expanded.rs b/tests/expand/multifields/tuple_struct.expanded.rs index 28e7fd8..aef8f8d 100644 --- a/tests/expand/multifields/tuple_struct.expanded.rs +++ b/tests/expand/multifields/tuple_struct.expanded.rs @@ -118,7 +118,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &TupleStruct) { let _ = &this.0; let _ = &this.1; diff --git a/tests/expand/naming/struct-all.expanded.rs b/tests/expand/naming/struct-all.expanded.rs index 6506928..88e024c 100644 --- a/tests/expand/naming/struct-all.expanded.rs +++ b/tests/expand/naming/struct-all.expanded.rs @@ -109,7 +109,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/tests/expand/naming/struct-mut.expanded.rs b/tests/expand/naming/struct-mut.expanded.rs index 53c5212..1365b23 100644 --- a/tests/expand/naming/struct-mut.expanded.rs +++ b/tests/expand/naming/struct-mut.expanded.rs @@ -75,7 +75,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/tests/expand/naming/struct-none.expanded.rs b/tests/expand/naming/struct-none.expanded.rs index 2528ece..70f04ef 100644 --- a/tests/expand/naming/struct-none.expanded.rs +++ b/tests/expand/naming/struct-none.expanded.rs @@ -77,7 +77,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/tests/expand/naming/struct-own.expanded.rs b/tests/expand/naming/struct-own.expanded.rs index 0c1fc76..899166f 100644 --- a/tests/expand/naming/struct-own.expanded.rs +++ b/tests/expand/naming/struct-own.expanded.rs @@ -111,7 +111,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/tests/expand/naming/struct-ref.expanded.rs b/tests/expand/naming/struct-ref.expanded.rs index 3f52ac5..f636f10 100644 --- a/tests/expand/naming/struct-ref.expanded.rs +++ b/tests/expand/naming/struct-ref.expanded.rs @@ -77,7 +77,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/tests/expand/naming/tuple_struct-all.expanded.rs b/tests/expand/naming/tuple_struct-all.expanded.rs index 325b9db..e4032be 100644 --- a/tests/expand/naming/tuple_struct-all.expanded.rs +++ b/tests/expand/naming/tuple_struct-all.expanded.rs @@ -88,7 +88,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &TupleStruct) { let _ = &this.0; let _ = &this.1; diff --git a/tests/expand/naming/tuple_struct-mut.expanded.rs b/tests/expand/naming/tuple_struct-mut.expanded.rs index 8cbb11f..076e4a0 100644 --- a/tests/expand/naming/tuple_struct-mut.expanded.rs +++ b/tests/expand/naming/tuple_struct-mut.expanded.rs @@ -60,7 +60,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &TupleStruct) { let _ = &this.0; let _ = &this.1; diff --git a/tests/expand/naming/tuple_struct-none.expanded.rs b/tests/expand/naming/tuple_struct-none.expanded.rs index 3e8e306..1322d22 100644 --- a/tests/expand/naming/tuple_struct-none.expanded.rs +++ b/tests/expand/naming/tuple_struct-none.expanded.rs @@ -65,7 +65,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &TupleStruct) { let _ = &this.0; let _ = &this.1; diff --git a/tests/expand/naming/tuple_struct-own.expanded.rs b/tests/expand/naming/tuple_struct-own.expanded.rs index 84bc14b..eda8267 100644 --- a/tests/expand/naming/tuple_struct-own.expanded.rs +++ b/tests/expand/naming/tuple_struct-own.expanded.rs @@ -96,7 +96,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &TupleStruct) { let _ = &this.0; let _ = &this.1; diff --git a/tests/expand/naming/tuple_struct-ref.expanded.rs b/tests/expand/naming/tuple_struct-ref.expanded.rs index 587d741..3c2618f 100644 --- a/tests/expand/naming/tuple_struct-ref.expanded.rs +++ b/tests/expand/naming/tuple_struct-ref.expanded.rs @@ -62,7 +62,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &TupleStruct) { let _ = &this.0; let _ = &this.1; diff --git a/tests/expand/not_unpin/struct.expanded.rs b/tests/expand/not_unpin/struct.expanded.rs index efa660f..680fb03 100644 --- a/tests/expand/not_unpin/struct.expanded.rs +++ b/tests/expand/not_unpin/struct.expanded.rs @@ -77,7 +77,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/tests/expand/not_unpin/tuple_struct.expanded.rs b/tests/expand/not_unpin/tuple_struct.expanded.rs index 89a257e..8bc6bbc 100644 --- a/tests/expand/not_unpin/tuple_struct.expanded.rs +++ b/tests/expand/not_unpin/tuple_struct.expanded.rs @@ -65,7 +65,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &TupleStruct) { let _ = &this.0; let _ = &this.1; diff --git a/tests/expand/pinned_drop/enum.expanded.rs b/tests/expand/pinned_drop/enum.expanded.rs index c8eb0e4..6e6ed54 100644 --- a/tests/expand/pinned_drop/enum.expanded.rs +++ b/tests/expand/pinned_drop/enum.expanded.rs @@ -1,5 +1,5 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; # [pin (__private (PinnedDrop , project = EnumProj , project_ref = EnumProjRef))] enum Enum { Struct { @@ -130,6 +130,7 @@ const _: () = { } } }; +#[doc(hidden)] impl ::pin_project::__private::PinnedDrop for Enum { unsafe fn drop(self: Pin<&mut Self>) { #[allow(clippy::needless_pass_by_value)] diff --git a/tests/expand/pinned_drop/enum.rs b/tests/expand/pinned_drop/enum.rs index f5b8aa4..c162ef6 100644 --- a/tests/expand/pinned_drop/enum.rs +++ b/tests/expand/pinned_drop/enum.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop, project = EnumProj, project_ref = EnumProjRef)] enum Enum { Struct { diff --git a/tests/expand/pinned_drop/struct.expanded.rs b/tests/expand/pinned_drop/struct.expanded.rs index 9d7f489..10ca8c1 100644 --- a/tests/expand/pinned_drop/struct.expanded.rs +++ b/tests/expand/pinned_drop/struct.expanded.rs @@ -1,5 +1,5 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; #[pin(__private(PinnedDrop))] struct Struct { #[pin] @@ -78,7 +78,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; @@ -112,6 +112,7 @@ const _: () = { } } }; +#[doc(hidden)] impl ::pin_project::__private::PinnedDrop for Struct { unsafe fn drop(self: Pin<&mut Self>) { #[allow(clippy::needless_pass_by_value)] diff --git a/tests/expand/pinned_drop/struct.rs b/tests/expand/pinned_drop/struct.rs index 948e6cc..691d3cb 100644 --- a/tests/expand/pinned_drop/struct.rs +++ b/tests/expand/pinned_drop/struct.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] struct Struct { #[pin] diff --git a/tests/expand/pinned_drop/tuple_struct.expanded.rs b/tests/expand/pinned_drop/tuple_struct.expanded.rs index b30ee66..506726c 100644 --- a/tests/expand/pinned_drop/tuple_struct.expanded.rs +++ b/tests/expand/pinned_drop/tuple_struct.expanded.rs @@ -1,5 +1,5 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; #[pin(__private(PinnedDrop))] struct TupleStruct(#[pin] T, U); #[allow(box_pointers)] @@ -66,7 +66,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &TupleStruct) { let _ = &this.0; let _ = &this.1; @@ -100,6 +100,7 @@ const _: () = { } } }; +#[doc(hidden)] impl ::pin_project::__private::PinnedDrop for TupleStruct { unsafe fn drop(self: Pin<&mut Self>) { #[allow(clippy::needless_pass_by_value)] diff --git a/tests/expand/pinned_drop/tuple_struct.rs b/tests/expand/pinned_drop/tuple_struct.rs index a536039..1f4917c 100644 --- a/tests/expand/pinned_drop/tuple_struct.rs +++ b/tests/expand/pinned_drop/tuple_struct.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] struct TupleStruct(#[pin] T, U); diff --git a/tests/expand/project_replace/struct.expanded.rs b/tests/expand/project_replace/struct.expanded.rs index 476c0ab..d3ed9e4 100644 --- a/tests/expand/project_replace/struct.expanded.rs +++ b/tests/expand/project_replace/struct.expanded.rs @@ -111,7 +111,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/tests/expand/project_replace/tuple_struct.expanded.rs b/tests/expand/project_replace/tuple_struct.expanded.rs index 0026a9f..91077f3 100644 --- a/tests/expand/project_replace/tuple_struct.expanded.rs +++ b/tests/expand/project_replace/tuple_struct.expanded.rs @@ -96,7 +96,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &TupleStruct) { let _ = &this.0; let _ = &this.1; diff --git a/tests/expand/pub/struct.expanded.rs b/tests/expand/pub/struct.expanded.rs index 246d9b6..7e6b975 100644 --- a/tests/expand/pub/struct.expanded.rs +++ b/tests/expand/pub/struct.expanded.rs @@ -77,7 +77,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/tests/expand/pub/tuple_struct.expanded.rs b/tests/expand/pub/tuple_struct.expanded.rs index 033fbaf..48355e3 100644 --- a/tests/expand/pub/tuple_struct.expanded.rs +++ b/tests/expand/pub/tuple_struct.expanded.rs @@ -65,7 +65,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &TupleStruct) { let _ = &this.0; let _ = &this.1; diff --git a/tests/expand/unsafe_unpin/struct.expanded.rs b/tests/expand/unsafe_unpin/struct.expanded.rs index 4066d49..76f4e52 100644 --- a/tests/expand/unsafe_unpin/struct.expanded.rs +++ b/tests/expand/unsafe_unpin/struct.expanded.rs @@ -77,7 +77,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &Struct) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs index 59a40da..a0a52a8 100644 --- a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs +++ b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs @@ -65,7 +65,7 @@ const _: () = { } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed(this: &TupleStruct) { let _ = &this.0; let _ = &this.1; diff --git a/tests/expandtest.rs b/tests/expandtest.rs index adf8dde..4e08040 100644 --- a/tests/expandtest.rs +++ b/tests/expandtest.rs @@ -6,6 +6,8 @@ use std::{ process::{Command, ExitStatus, Stdio}, }; +const PATH: &str = "tests/expand/**/*.rs"; + #[rustversion::attr(not(nightly), ignore)] #[test] fn expandtest() { @@ -18,12 +20,12 @@ fn expandtest() { return; } - let path = "tests/expand/*/*.rs"; + let args = &["--all-features"]; if is_ci { - macrotest::expand_without_refresh(path); + macrotest::expand_without_refresh_args(PATH, args); } else { env::set_var("MACROTEST", "overwrite"); - macrotest::expand(path); + macrotest::expand_args(PATH, args); } } diff --git a/tests/lint.rs b/tests/lint.rs index e7aee5a..4820816 100644 --- a/tests/lint.rs +++ b/tests/lint.rs @@ -17,10 +17,10 @@ missing_docs, non_ascii_idents, noop_method_call, + or_patterns_back_compat, single_use_lifetimes, trivial_casts, trivial_numeric_casts, - unaligned_references, unreachable_pub, unused_extern_crates, unused_import_braces, diff --git a/tests/pinned_drop.rs b/tests/pinned_drop.rs index 9e7287d..785cea3 100644 --- a/tests/pinned_drop.rs +++ b/tests/pinned_drop.rs @@ -262,3 +262,23 @@ fn inside_macro() { mac!(1); } + +pub mod self_path { + use super::*; + + #[pin_project(PinnedDrop)] + pub struct S(T); + + fn f() {} + + #[pinned_drop] + impl PinnedDrop for self::S { + fn drop(mut self: Pin<&mut Self>) { + self::f(); + let _: self::S<()> = self::S(()); + let _: self::S> = self::S(self.as_mut()); + let self::S(()) = self::S(()); + let self::S(&mut Self(_)) = self::S(&mut *self); + } + } +} diff --git a/tests/repr_packed.rs b/tests/repr_packed.rs index a0d8bdc..e87aabf 100644 --- a/tests/repr_packed.rs +++ b/tests/repr_packed.rs @@ -1,5 +1,8 @@ #![warn(rust_2018_idioms, single_use_lifetimes)] -#![forbid(safe_packed_borrows)] +// unaligned_references did not exist in older compilers and safe_packed_borrows was removed in the latest compilers. +// https://github.com/rust-lang/rust/pull/82525 +#![allow(unknown_lints, renamed_and_removed_lints)] +#![forbid(unaligned_references, safe_packed_borrows)] use std::cell::Cell; diff --git a/tests/ui/cfg/cfg_attr-type-mismatch.rs b/tests/ui/cfg/cfg_attr-type-mismatch.rs index b075af9..1b9664b 100644 --- a/tests/ui/cfg/cfg_attr-type-mismatch.rs +++ b/tests/ui/cfg/cfg_attr-type-mismatch.rs @@ -1,6 +1,7 @@ -use pin_project::pin_project; use std::pin::Pin; +use pin_project::pin_project; + #[cfg_attr(not(any()), pin_project)] struct Foo { #[cfg_attr(any(), pin)] diff --git a/tests/ui/cfg/cfg_attr-type-mismatch.stderr b/tests/ui/cfg/cfg_attr-type-mismatch.stderr index 89172a2..576a08c 100644 --- a/tests/ui/cfg/cfg_attr-type-mismatch.stderr +++ b/tests/ui/cfg/cfg_attr-type-mismatch.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types - --> $DIR/cfg_attr-type-mismatch.rs:19:27 + --> $DIR/cfg_attr-type-mismatch.rs:20:27 | -19 | let _: Pin<&mut u8> = x.f; //~ ERROR E0308 +20 | let _: Pin<&mut u8> = x.f; //~ ERROR E0308 | ------------ ^^^ expected struct `Pin`, found `&mut u8` | | | expected due to this @@ -10,9 +10,9 @@ error[E0308]: mismatched types found mutable reference `&mut u8` error[E0308]: mismatched types - --> $DIR/cfg_attr-type-mismatch.rs:23:22 + --> $DIR/cfg_attr-type-mismatch.rs:24:22 | -23 | let _: &mut u8 = x.f; //~ ERROR E0308 +24 | let _: &mut u8 = x.f; //~ ERROR E0308 | ------- ^^^ | | | | | expected `&mut u8`, found struct `Pin` diff --git a/tests/ui/cfg/packed_sneaky-span-issue-1.rs b/tests/ui/cfg/packed_sneaky-span-issue-1.rs index 42f57b5..7e19952 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-1.rs +++ b/tests/ui/cfg/packed_sneaky-span-issue-1.rs @@ -2,9 +2,8 @@ use auxiliary_macro::hidden_repr; use pin_project::pin_project; #[pin_project] -#[hidden_repr(packed)] +#[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types struct S { - //~^ ERROR may not be used on #[repr(packed)] types #[cfg(not(any()))] #[pin] f: u32, diff --git a/tests/ui/cfg/packed_sneaky-span-issue-1.stderr b/tests/ui/cfg/packed_sneaky-span-issue-1.stderr index abe3ecd..c98d3ee 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-1.stderr +++ b/tests/ui/cfg/packed_sneaky-span-issue-1.stderr @@ -1,11 +1,5 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-span-issue-1.rs:6:1 - | -6 | / struct S { -7 | | //~^ ERROR may not be used on #[repr(packed)] types -8 | | #[cfg(not(any()))] -9 | | #[pin] -... | -13 | | f: u8, -14 | | } - | |_^ + --> $DIR/packed_sneaky-span-issue-1.rs:5:15 + | +5 | #[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types + | ^^^^^^ diff --git a/tests/ui/cfg/packed_sneaky-span-issue-2.rs b/tests/ui/cfg/packed_sneaky-span-issue-2.rs index 948d72c..fcea76b 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-2.rs +++ b/tests/ui/cfg/packed_sneaky-span-issue-2.rs @@ -2,9 +2,8 @@ use auxiliary_macro::hidden_repr; use pin_project::pin_project; #[pin_project] -#[hidden_repr(packed)] +#[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types struct S { - //~^ ERROR may not be used on #[repr(packed)] types #[cfg(any())] #[pin] f: u32, diff --git a/tests/ui/cfg/packed_sneaky-span-issue-2.stderr b/tests/ui/cfg/packed_sneaky-span-issue-2.stderr index a957ceb..25b9cdc 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-2.stderr +++ b/tests/ui/cfg/packed_sneaky-span-issue-2.stderr @@ -1,11 +1,5 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-span-issue-2.rs:6:1 - | -6 | / struct S { -7 | | //~^ ERROR may not be used on #[repr(packed)] types -8 | | #[cfg(any())] -9 | | #[pin] -... | -13 | | f: u8, -14 | | } - | |_^ + --> $DIR/packed_sneaky-span-issue-2.rs:5:15 + | +5 | #[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types + | ^^^^^^ diff --git a/tests/ui/cfg/unsupported.stderr b/tests/ui/cfg/unsupported.stderr index b3bd1ae..7ad20d1 100644 --- a/tests/ui/cfg/unsupported.stderr +++ b/tests/ui/cfg/unsupported.stderr @@ -1,7 +1,8 @@ error: #[pin_project] attribute may not be used on structs with zero fields - --> $DIR/unsupported.rs:4:1 + --> $DIR/unsupported.rs:4:10 | -4 | / struct S { +4 | struct S { + | __________^ 5 | | //~^ ERROR may not be used on structs with zero fields 6 | | #[cfg(any())] 7 | | #[pin] diff --git a/tests/ui/not_unpin/conflict-unpin.stderr b/tests/ui/not_unpin/conflict-unpin.stderr index e90a574..7b43b0f 100644 --- a/tests/ui/not_unpin/conflict-unpin.stderr +++ b/tests/ui/not_unpin/conflict-unpin.stderr @@ -1,4 +1,4 @@ -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`: +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>` --> $DIR/conflict-unpin.rs:3:15 | 3 | #[pin_project(!Unpin)] //~ ERROR E0119 @@ -7,7 +7,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type 10 | impl Unpin for Foo where T: Unpin {} | --------------------------------------------- first implementation here -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`: +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>` --> $DIR/conflict-unpin.rs:12:15 | 12 | #[pin_project(!Unpin)] //~ ERROR E0119 @@ -16,7 +16,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type 19 | impl Unpin for Bar {} | ------------------------------ first implementation here -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`: +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>` --> $DIR/conflict-unpin.rs:21:15 | 21 | #[pin_project(!Unpin)] //~ ERROR E0119 diff --git a/tests/ui/not_unpin/impl-unsafe-unpin.stderr b/tests/ui/not_unpin/impl-unsafe-unpin.stderr index ba80d5e..43cd4f1 100644 --- a/tests/ui/not_unpin/impl-unsafe-unpin.stderr +++ b/tests/ui/not_unpin/impl-unsafe-unpin.stderr @@ -1,4 +1,4 @@ -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Foo<_, _>`: +error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Foo<_, _>` --> $DIR/impl-unsafe-unpin.rs:3:1 | 3 | #[pin_project(!Unpin)] //~ ERROR E0119 @@ -9,7 +9,7 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Bar<_, _>`: +error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Bar<_, _>` --> $DIR/impl-unsafe-unpin.rs:12:1 | 12 | #[pin_project(!Unpin)] //~ ERROR E0119 @@ -20,7 +20,7 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Baz<_, _>`: +error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Baz<_, _>` --> $DIR/impl-unsafe-unpin.rs:21:1 | 21 | #[pin_project(!Unpin)] //~ ERROR E0119 diff --git a/tests/ui/pin_project/add-attr-to-struct.rs b/tests/ui/pin_project/add-attr-to-struct.rs index 55f1561..045e796 100644 --- a/tests/ui/pin_project/add-attr-to-struct.rs +++ b/tests/ui/pin_project/add-attr-to-struct.rs @@ -1,6 +1,7 @@ +use std::marker::PhantomPinned; + use auxiliary_macro::add_pin_attr; use pin_project::pin_project; -use std::marker::PhantomPinned; #[pin_project] #[add_pin_attr(struct)] //~ ERROR duplicate #[pin] attribute diff --git a/tests/ui/pin_project/add-attr-to-struct.stderr b/tests/ui/pin_project/add-attr-to-struct.stderr index 27656d6..f3ee9e4 100644 --- a/tests/ui/pin_project/add-attr-to-struct.stderr +++ b/tests/ui/pin_project/add-attr-to-struct.stderr @@ -1,15 +1,15 @@ error: duplicate #[pin] attribute - --> $DIR/add-attr-to-struct.rs:6:1 + --> $DIR/add-attr-to-struct.rs:7:1 | -6 | #[add_pin_attr(struct)] //~ ERROR duplicate #[pin] attribute +7 | #[add_pin_attr(struct)] //~ ERROR duplicate #[pin] attribute | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in an attribute macro (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:12:1 + --> $DIR/add-attr-to-struct.rs:13:1 | -12 | #[add_pin_attr(struct)] //~ ERROR #[pin] attribute may only be used on fields of structs or variants +13 | #[add_pin_attr(struct)] //~ ERROR #[pin] attribute may only be used on fields of structs or variants | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pin_project/add-pinned-field.stderr b/tests/ui/pin_project/add-pinned-field.stderr index a140694..a391f3b 100644 --- a/tests/ui/pin_project/add-pinned-field.stderr +++ b/tests/ui/pin_project/add-pinned-field.stderr @@ -7,7 +7,12 @@ error[E0277]: `PhantomPinned` cannot be unpinned 21 | is_unpin::(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^ within `__Foo<'_>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `__Foo<'_>` + = note: consider using `Box::pin` +note: required because it appears within the type `__Foo<'_>` + --> $DIR/add-pinned-field.rs:8:8 + | +8 | struct Foo { + | ^^^ = note: required because of the requirements on the impl of `Unpin` for `Foo` error[E0277]: `PhantomPinned` cannot be unpinned @@ -19,5 +24,10 @@ error[E0277]: `PhantomPinned` cannot be unpinned 22 | is_unpin::(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^ within `__Bar<'_>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `__Bar<'_>` + = note: consider using `Box::pin` +note: required because it appears within the type `__Bar<'_>` + --> $DIR/add-pinned-field.rs:15:8 + | +15 | struct Bar { + | ^^^ = note: required because of the requirements on the impl of `Unpin` for `Bar` diff --git a/tests/ui/pin_project/conflict-drop.rs b/tests/ui/pin_project/conflict-drop.rs index 908f5c0..4fdb118 100644 --- a/tests/ui/pin_project/conflict-drop.rs +++ b/tests/ui/pin_project/conflict-drop.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project] //~ ERROR E0119 struct Foo { #[pin] diff --git a/tests/ui/pin_project/conflict-drop.stderr b/tests/ui/pin_project/conflict-drop.stderr index d5ca7b3..ae51456 100644 --- a/tests/ui/pin_project/conflict-drop.stderr +++ b/tests/ui/pin_project/conflict-drop.stderr @@ -1,7 +1,7 @@ -error[E0119]: conflicting implementations of trait `_::FooMustNotImplDrop` for type `Foo<_, _>`: - --> $DIR/conflict-drop.rs:4:1 +error[E0119]: conflicting implementations of trait `_::FooMustNotImplDrop` for type `Foo<_, _>` + --> $DIR/conflict-drop.rs:5:1 | -4 | #[pin_project] //~ ERROR E0119 +5 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ | | | first implementation here @@ -9,11 +9,11 @@ error[E0119]: conflicting implementations of trait `_::FooMustNotImplDrop` for t | = note: this error originates in a derive macro (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:15:15 +error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `Bar<_, _>` + --> $DIR/conflict-drop.rs:16:15 | -15 | #[pin_project(PinnedDrop)] //~ ERROR E0119 +16 | #[pin_project(PinnedDrop)] //~ ERROR E0119 | ^^^^^^^^^^ conflicting implementation for `Bar<_, _>` ... -27 | impl Drop for Bar { +28 | impl Drop for Bar { | ----------------------------- first implementation here diff --git a/tests/ui/pin_project/conflict-unpin.stderr b/tests/ui/pin_project/conflict-unpin.stderr index 0d6f439..0401140 100644 --- a/tests/ui/pin_project/conflict-unpin.stderr +++ b/tests/ui/pin_project/conflict-unpin.stderr @@ -1,4 +1,4 @@ -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`: +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>` --> $DIR/conflict-unpin.rs:5:1 | 5 | #[pin_project] //~ ERROR E0119 @@ -9,7 +9,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`: +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>` --> $DIR/conflict-unpin.rs:17:1 | 17 | #[pin_project] //~ ERROR E0119 @@ -20,7 +20,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`: +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>` --> $DIR/conflict-unpin.rs:27:1 | 27 | #[pin_project] //~ ERROR E0119 diff --git a/tests/ui/pin_project/impl-unsafe-unpin.stderr b/tests/ui/pin_project/impl-unsafe-unpin.stderr index 78545c2..078baee 100644 --- a/tests/ui/pin_project/impl-unsafe-unpin.stderr +++ b/tests/ui/pin_project/impl-unsafe-unpin.stderr @@ -1,4 +1,4 @@ -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Foo<_, _>`: +error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Foo<_, _>` --> $DIR/impl-unsafe-unpin.rs:3:1 | 3 | #[pin_project] //~ ERROR E0119 @@ -9,7 +9,7 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Bar<_, _>`: +error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Bar<_, _>` --> $DIR/impl-unsafe-unpin.rs:12:1 | 12 | #[pin_project] //~ ERROR E0119 @@ -20,7 +20,7 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Baz<_, _>`: +error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Baz<_, _>` --> $DIR/impl-unsafe-unpin.rs:21:1 | 21 | #[pin_project] //~ ERROR E0119 diff --git a/tests/ui/pin_project/overlapping_unpin_struct.rs b/tests/ui/pin_project/overlapping_unpin_struct.rs index 8db0855..abfd5d1 100644 --- a/tests/ui/pin_project/overlapping_unpin_struct.rs +++ b/tests/ui/pin_project/overlapping_unpin_struct.rs @@ -1,6 +1,7 @@ -use pin_project::pin_project; use std::marker::PhantomPinned; +use pin_project::pin_project; + #[pin_project] struct S { #[pin] diff --git a/tests/ui/pin_project/overlapping_unpin_struct.stderr b/tests/ui/pin_project/overlapping_unpin_struct.stderr index 296b063..f49c736 100644 --- a/tests/ui/pin_project/overlapping_unpin_struct.stderr +++ b/tests/ui/pin_project/overlapping_unpin_struct.stderr @@ -1,11 +1,16 @@ error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/overlapping_unpin_struct.rs:17:5 + --> $DIR/overlapping_unpin_struct.rs:18:5 | -14 | fn is_unpin() {} +15 | fn is_unpin() {} | ----- required by this bound in `is_unpin` ... -17 | is_unpin::>(); //~ ERROR E0277 +18 | is_unpin::>(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__S<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `_::__S<'_, PhantomPinned>` + = note: consider using `Box::pin` +note: required because it appears within the type `_::__S<'_, PhantomPinned>` + --> $DIR/overlapping_unpin_struct.rs:6:8 + | +6 | struct S { + | ^ = note: required because of the requirements on the impl of `Unpin` for `S` diff --git a/tests/ui/pin_project/packed-enum.rs b/tests/ui/pin_project/packed-enum.rs index 9d4a4c3..023c08d 100644 --- a/tests/ui/pin_project/packed-enum.rs +++ b/tests/ui/pin_project/packed-enum.rs @@ -1,5 +1,9 @@ use pin_project::pin_project; +// #[repr(packed)] cannot be apply on enums and will be rejected by rustc. +// However, we should not rely on the behavior of rustc that rejects this. +// https://github.com/taiki-e/pin-project/pull/324#discussion_r612388001 + #[repr(packed)] //~ ERROR E0517 enum E1 { V(()), diff --git a/tests/ui/pin_project/packed-enum.stderr b/tests/ui/pin_project/packed-enum.stderr index afc8b30..0951944 100644 --- a/tests/ui/pin_project/packed-enum.stderr +++ b/tests/ui/pin_project/packed-enum.stderr @@ -1,30 +1,42 @@ +error: #[repr(packed)] attribute should be applied to a struct or union + --> $DIR/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 + | +18 | #[repr(packed)] //~ ERROR E0517 + | ^^^^^^ + error[E0517]: attribute should be applied to a struct or union - --> $DIR/packed-enum.rs:3:8 - | -3 | #[repr(packed)] //~ ERROR E0517 - | ^^^^^^ -4 | / enum E1 { -5 | | V(()), -6 | | } - | |_- not a struct or union + --> $DIR/packed-enum.rs:7:8 + | +7 | #[repr(packed)] //~ ERROR E0517 + | ^^^^^^ +8 | / enum E1 { +9 | | V(()), +10 | | } + | |_- not a struct or union error[E0517]: attribute should be applied to a struct or union - --> $DIR/packed-enum.rs:9:8 + --> $DIR/packed-enum.rs:13:8 | -9 | #[repr(packed)] //~ ERROR E0517 +13 | #[repr(packed)] //~ ERROR E0517 | ^^^^^^ -10 | / enum E2 { -11 | | V(()), -12 | | } +14 | / enum E2 { +15 | | V(()), +16 | | } | |_- not a struct or union error[E0517]: attribute should be applied to a struct or union - --> $DIR/packed-enum.rs:14:8 + --> $DIR/packed-enum.rs:18:8 | -14 | #[repr(packed)] //~ ERROR E0517 +18 | #[repr(packed)] //~ ERROR E0517 | ^^^^^^ -15 | #[pin_project] -16 | / enum E3 { -17 | | V(()), -18 | | } +19 | #[pin_project] +20 | / enum E3 { +21 | | V(()), +22 | | } | |_- not a struct or union diff --git a/tests/ui/pin_project/packed-name-value.rs b/tests/ui/pin_project/packed-name-value.rs index ed819ca..dedc403 100644 --- a/tests/ui/pin_project/packed-name-value.rs +++ b/tests/ui/pin_project/packed-name-value.rs @@ -1,17 +1,24 @@ use pin_project::pin_project; -#[repr(packed = "")] //~ ERROR E0552 -struct S1 { - f: (), -} +// #[repr(packed = "")] is not valid format of #[repr(packed)] and will be +// rejected by rustc. +// However, we should not rely on the behavior of rustc that rejects this. +// https://github.com/taiki-e/pin-project/pull/324#discussion_r612388001 + +// https://github.com/taiki-e/pin-project/pull/324#discussion_r612388001 +// https://github.com/rust-lang/rust/issues/83921 +// #[repr(packed = "")] //~ ERROR E0552 +// struct S1 { +// f: (), +// } #[pin_project] -#[repr(packed = "")] //~ ERROR E0552 +#[repr(packed = "")] //~ ERROR attribute should not be name-value pair struct S2 { f: (), } -#[repr(packed = "")] //~ ERROR E0552 +#[repr(packed = "")] //~ ERROR attribute should not be name-value pair #[pin_project] struct S3 { f: (), diff --git a/tests/ui/pin_project/packed-name-value.stderr b/tests/ui/pin_project/packed-name-value.stderr index a3e2571..51b82dd 100644 --- a/tests/ui/pin_project/packed-name-value.stderr +++ b/tests/ui/pin_project/packed-name-value.stderr @@ -1,17 +1,11 @@ -error[E0552]: unrecognized representation hint - --> $DIR/packed-name-value.rs:3:8 - | -3 | #[repr(packed = "")] //~ ERROR E0552 - | ^^^^^^^^^^^ - -error[E0552]: unrecognized representation hint - --> $DIR/packed-name-value.rs:9:8 - | -9 | #[repr(packed = "")] //~ ERROR E0552 - | ^^^^^^^^^^^ +error: #[repr(packed)] attribute should not be name-value pair + --> $DIR/packed-name-value.rs:16:8 + | +16 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair + | ^^^^^^^^^^^ -error[E0552]: unrecognized representation hint - --> $DIR/packed-name-value.rs:14:8 +error: #[repr(packed)] attribute should not be name-value pair + --> $DIR/packed-name-value.rs:21:8 | -14 | #[repr(packed = "")] //~ ERROR E0552 +21 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair | ^^^^^^^^^^^ diff --git a/tests/ui/pin_project/packed.rs b/tests/ui/pin_project/packed.rs index f756605..dd3ebfd 100644 --- a/tests/ui/pin_project/packed.rs +++ b/tests/ui/pin_project/packed.rs @@ -2,7 +2,7 @@ use pin_project::pin_project; #[pin_project] #[repr(packed, C)] //~ ERROR may not be used on #[repr(packed)] types -struct A { +struct Packed1 { #[pin] f: u8, } @@ -10,14 +10,22 @@ struct A { // Test putting 'repr' before the 'pin_project' attribute #[repr(packed, C)] //~ ERROR may not be used on #[repr(packed)] types #[pin_project] -struct B { +struct Packed2 { #[pin] f: u8, } #[pin_project] #[repr(packed(2))] //~ ERROR may not be used on #[repr(packed)] types -struct C { +struct PackedN1 { + #[pin] + f: u32, +} + +// Test putting 'repr' before the 'pin_project' attribute +#[repr(packed(2))] //~ ERROR may not be used on #[repr(packed)] types +#[pin_project] +struct PackedN2 { #[pin] f: u32, } diff --git a/tests/ui/pin_project/packed.stderr b/tests/ui/pin_project/packed.stderr index 969faea..e5b9e55 100644 --- a/tests/ui/pin_project/packed.stderr +++ b/tests/ui/pin_project/packed.stderr @@ -15,3 +15,9 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types | 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 + | +26 | #[repr(packed(2))] //~ ERROR may not be used on #[repr(packed)] types + | ^^^^^^^^^ diff --git a/tests/ui/pin_project/packed_sneaky-1.rs b/tests/ui/pin_project/packed_sneaky-1.rs index 38f6fe0..72d3d3e 100644 --- a/tests/ui/pin_project/packed_sneaky-1.rs +++ b/tests/ui/pin_project/packed_sneaky-1.rs @@ -1,6 +1,7 @@ +use std::pin::Pin; + use auxiliary_macro::hidden_repr; use pin_project::{pin_project, pinned_drop, UnsafeUnpin}; -use std::pin::Pin; #[pin_project] //~ ERROR may not be used on #[repr(packed)] types #[hidden_repr(packed)] diff --git a/tests/ui/pin_project/packed_sneaky-1.stderr b/tests/ui/pin_project/packed_sneaky-1.stderr index 510200e..67bcd1b 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:6:15 + --> $DIR/packed_sneaky-1.rs:7:15 | -6 | #[hidden_repr(packed)] +7 | #[hidden_repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-1.rs:13:15 + --> $DIR/packed_sneaky-1.rs:14:15 | -13 | #[hidden_repr(packed)] +14 | #[hidden_repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-1.rs:22:15 + --> $DIR/packed_sneaky-1.rs:23:15 | -22 | #[hidden_repr(packed)] +23 | #[hidden_repr(packed)] | ^^^^^^ diff --git a/tests/ui/pin_project/project_replace_unsized.stderr b/tests/ui/pin_project/project_replace_unsized.stderr index 26e416a..75a2666 100644 --- a/tests/ui/pin_project/project_replace_unsized.stderr +++ b/tests/ui/pin_project/project_replace_unsized.stderr @@ -4,9 +4,13 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 3 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 4 | struct Struct { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` | - = note: required because it appears within the type `Struct` +note: required because it appears within the type `Struct` + --> $DIR/project_replace_unsized.rs:4:8 + | +4 | struct Struct { + | ^^^^^^ = help: unsized fn params are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size | @@ -19,9 +23,13 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 3 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 4 | struct Struct { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` + | +note: required because it appears within the type `Struct` + --> $DIR/project_replace_unsized.rs:4:8 | - = note: required because it appears within the type `Struct` +4 | struct Struct { + | ^^^^^^ = note: required by `UnsafeOverwriteGuard` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -29,7 +37,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/project_replace_unsized.rs:5:5 | 4 | struct Struct { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` 5 | f: T, | ^ doesn't have a size known at compile-time @@ -39,9 +47,13 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 8 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 9 | struct TupleStruct(T); - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` + | +note: required because it appears within the type `TupleStruct` + --> $DIR/project_replace_unsized.rs:9:8 | - = note: required because it appears within the type `TupleStruct` +9 | struct TupleStruct(T); + | ^^^^^^^^^^^ = help: unsized fn params are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size | @@ -54,9 +66,13 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 8 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 9 | struct TupleStruct(T); - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` | - = note: required because it appears within the type `TupleStruct` +note: required because it appears within the type `TupleStruct` + --> $DIR/project_replace_unsized.rs:9:8 + | +9 | struct TupleStruct(T); + | ^^^^^^^^^^^ = note: required by `UnsafeOverwriteGuard` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -64,7 +80,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/project_replace_unsized.rs:9:8 | 9 | struct TupleStruct(T); - | ^^^^^^^^^^^ - this type parameter needs to be `Sized` + | ^^^^^^^^^^^ - this type parameter needs to be `std::marker::Sized` | | | doesn't have a size known at compile-time | 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 f0f9573..f8cee98 100644 --- a/tests/ui/pin_project/project_replace_unsized_fn_params.stderr +++ b/tests/ui/pin_project/project_replace_unsized_fn_params.stderr @@ -4,10 +4,14 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 6 | struct Struct { | ^^^^^^^-^^^^^^^^^ | | | - | | this type parameter needs to be `Sized` + | | this type parameter needs to be `std::marker::Sized` | doesn't have a size known at compile-time | - = note: required because it appears within the type `__StructProjectionOwned` +note: required because it appears within the type `__StructProjectionOwned` + --> $DIR/project_replace_unsized_fn_params.rs:6:8 + | +6 | struct Struct { + | ^^^^^^ = note: the return type of a function must have a statically known size error[E0277]: the size for values of type `T` cannot be known at compilation time @@ -16,9 +20,13 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 5 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 6 | struct Struct { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` | - = note: required because it appears within the type `Struct` +note: required because it appears within the type `Struct` + --> $DIR/project_replace_unsized_fn_params.rs:6:8 + | +6 | struct Struct { + | ^^^^^^ = note: required by `UnsafeOverwriteGuard` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -26,7 +34,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/project_replace_unsized_fn_params.rs:7:5 | 6 | struct Struct { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` 7 | f: T, | ^ doesn't have a size known at compile-time @@ -36,10 +44,14 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 11 | struct TupleStruct(T); | ^^^^^^^^^^^^-^^^^^^^^^ | | | - | | this type parameter needs to be `Sized` + | | this type parameter needs to be `std::marker::Sized` | doesn't have a size known at compile-time | - = note: required because it appears within the type `__TupleStructProjectionOwned` +note: required because it appears within the type `__TupleStructProjectionOwned` + --> $DIR/project_replace_unsized_fn_params.rs:11:8 + | +11 | struct TupleStruct(T); + | ^^^^^^^^^^^ = note: the return type of a function must have a statically known size error[E0277]: the size for values of type `T` cannot be known at compilation time @@ -48,8 +60,12 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 10 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 11 | struct TupleStruct(T); - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` | - = note: required because it appears within the type `TupleStruct` +note: required because it appears within the type `TupleStruct` + --> $DIR/project_replace_unsized_fn_params.rs:11:8 + | +11 | struct TupleStruct(T); + | ^^^^^^^^^^^ = note: required by `UnsafeOverwriteGuard` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pin_project/remove-attr-from-field.rs b/tests/ui/pin_project/remove-attr-from-field.rs index bec8302..fd14da3 100644 --- a/tests/ui/pin_project/remove-attr-from-field.rs +++ b/tests/ui/pin_project/remove-attr-from-field.rs @@ -1,6 +1,7 @@ +use std::{marker::PhantomPinned, pin::Pin}; + use auxiliary_macro::remove_attr; use pin_project::pin_project; -use std::{marker::PhantomPinned, pin::Pin}; fn is_unpin() {} diff --git a/tests/ui/pin_project/remove-attr-from-field.stderr b/tests/ui/pin_project/remove-attr-from-field.stderr index 5d8caac..486bc00 100644 --- a/tests/ui/pin_project/remove-attr-from-field.stderr +++ b/tests/ui/pin_project/remove-attr-from-field.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types - --> $DIR/remove-attr-from-field.rs:27:38 + --> $DIR/remove-attr-from-field.rs:28:38 | -27 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 +28 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 | ----------------------- ^^^ expected struct `Pin`, found `&mut PhantomPinned` | | | expected due to this @@ -10,9 +10,9 @@ error[E0308]: mismatched types found mutable reference `&mut PhantomPinned` error[E0308]: mismatched types - --> $DIR/remove-attr-from-field.rs:31:38 + --> $DIR/remove-attr-from-field.rs:32:38 | -31 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 +32 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 | ----------------------- ^^^ expected struct `Pin`, found `&mut PhantomPinned` | | | expected due to this diff --git a/tests/ui/pin_project/remove-attr-from-struct.rs b/tests/ui/pin_project/remove-attr-from-struct.rs index 0086cf9..cbe5aba 100644 --- a/tests/ui/pin_project/remove-attr-from-struct.rs +++ b/tests/ui/pin_project/remove-attr-from-struct.rs @@ -1,6 +1,7 @@ +use std::{marker::PhantomPinned, pin::Pin}; + use auxiliary_macro::remove_attr; use pin_project::pin_project; -use std::{marker::PhantomPinned, pin::Pin}; fn is_unpin() {} diff --git a/tests/ui/pin_project/remove-attr-from-struct.stderr b/tests/ui/pin_project/remove-attr-from-struct.stderr index 4652b66..82fada5 100644 --- a/tests/ui/pin_project/remove-attr-from-struct.stderr +++ b/tests/ui/pin_project/remove-attr-from-struct.stderr @@ -1,71 +1,91 @@ error: #[pin_project] attribute has been removed - --> $DIR/remove-attr-from-struct.rs:21:1 + --> $DIR/remove-attr-from-struct.rs:22:1 | -21 | #[pin_project] //~ ERROR has been removed +22 | #[pin_project] //~ ERROR has been removed | ^^^^^^^^^^^^^^ | = note: this error originates in a derive macro (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:17:7 + --> $DIR/remove-attr-from-struct.rs:18:7 | -17 | #[pin] //~ ERROR cannot find attribute `pin` in this scope +18 | #[pin] //~ ERROR cannot find attribute `pin` in this scope | ^^^ error: cannot find attribute `pin` in this scope - --> $DIR/remove-attr-from-struct.rs:10:7 + --> $DIR/remove-attr-from-struct.rs:11:7 | -10 | #[pin] //~ ERROR cannot find attribute `pin` in this scope +11 | #[pin] //~ ERROR cannot find attribute `pin` in this scope | ^^^ error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/remove-attr-from-struct.rs:34:5 + --> $DIR/remove-attr-from-struct.rs:35:5 | -5 | fn is_unpin() {} +6 | fn is_unpin() {} | ----- required by this bound in `is_unpin` ... -34 | is_unpin::(); //~ ERROR E0277 +35 | is_unpin::(); //~ ERROR E0277 | ^^^^^^^^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `A` + = note: consider using `Box::pin` +note: required because it appears within the type `A` + --> $DIR/remove-attr-from-struct.rs:10:8 + | +10 | struct A { + | ^ error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/remove-attr-from-struct.rs:35:5 + --> $DIR/remove-attr-from-struct.rs:36:5 | -5 | fn is_unpin() {} +6 | fn is_unpin() {} | ----- required by this bound in `is_unpin` ... -35 | is_unpin::(); //~ ERROR E0277 +36 | is_unpin::(); //~ ERROR E0277 | ^^^^^^^^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `B` + = note: consider using `Box::pin` +note: required because it appears within the type `B` + --> $DIR/remove-attr-from-struct.rs:17:8 + | +17 | struct B { + | ^ error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/remove-attr-from-struct.rs:39:13 + --> $DIR/remove-attr-from-struct.rs:40:13 | -39 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 +40 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 | ^^^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `A` + = note: consider using `Box::pin` +note: required because it appears within the type `A` + --> $DIR/remove-attr-from-struct.rs:10:8 + | +10 | struct A { + | ^ = note: required by `Pin::

::new` error[E0599]: no method named `project` found for struct `Pin<&mut A>` in the current scope - --> $DIR/remove-attr-from-struct.rs:39:30 + --> $DIR/remove-attr-from-struct.rs:40:30 | -39 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 +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:42:13 + --> $DIR/remove-attr-from-struct.rs:43:13 | -42 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 +43 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 | ^^^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `B` + = note: consider using `Box::pin` +note: required because it appears within the type `B` + --> $DIR/remove-attr-from-struct.rs:17:8 + | +17 | struct B { + | ^ = note: required by `Pin::

::new` error[E0599]: no method named `project` found for struct `Pin<&mut B>` in the current scope - --> $DIR/remove-attr-from-struct.rs:42:30 + --> $DIR/remove-attr-from-struct.rs:43:30 | -42 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 +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 db4ac2d..8f4f462 100644 --- a/tests/ui/pin_project/safe_packed_borrows.rs +++ b/tests/ui/pin_project/safe_packed_borrows.rs @@ -1,21 +1,28 @@ -#![forbid(safe_packed_borrows)] +#![deny(renamed_and_removed_lints)] +#![deny(safe_packed_borrows)] //~ ERROR has been renamed to `unaligned_references` +#![allow(unaligned_references)] -// Refs: https://github.com/rust-lang/rust/issues/46043 +// This lint was removed in https://github.com/rust-lang/rust/pull/82525 (nightly-2021-03-28). +// Refs: +// - https://github.com/rust-lang/rust/pull/82525 +// - https://github.com/rust-lang/rust/issues/46043 #[repr(packed)] -struct A { +struct Packed { f: u32, } #[repr(packed(2))] -struct B { +struct PackedN { f: u32, } fn main() { - let a = A { f: 1 }; - &a.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block + let a = Packed { f: 1 }; + &a.f; + let _ = &a.f; - let b = B { f: 1 }; - &b.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block + 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 c1f734a..4048eaa 100644 --- a/tests/ui/pin_project/safe_packed_borrows.stderr +++ b/tests/ui/pin_project/safe_packed_borrows.stderr @@ -1,24 +1,11 @@ -error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) - --> $DIR/safe_packed_borrows.rs:17:5 - | -17 | &a.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block - | ^^^^ - | +error: lint `safe_packed_borrows` has been renamed to `unaligned_references` + --> $DIR/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:11 - | -1 | #![forbid(safe_packed_borrows)] - | ^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #46043 - = note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior - -error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) - --> $DIR/safe_packed_borrows.rs:20:5 - | -20 | &b.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block - | ^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #46043 - = note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior + --> $DIR/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 new file mode 100644 index 0000000..23dd71d --- /dev/null +++ b/tests/ui/pin_project/unaligned_references.rs @@ -0,0 +1,23 @@ +#![forbid(unaligned_references)] + +// Refs: https://github.com/rust-lang/rust/issues/82523 + +#[repr(packed)] +struct Packed { + f: u32, +} + +#[repr(packed(2))] +struct PackedN { + f: u32, +} + +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 new file mode 100644 index 0000000..17600de --- /dev/null +++ b/tests/ui/pin_project/unaligned_references.stderr @@ -0,0 +1,44 @@ +error: reference to packed field is unaligned + --> $DIR/unaligned_references.rs:17:5 + | +17 | &a.f; //~ ERROR reference to packed field is unaligned + | ^^^^ + | +note: the lint level is defined here + --> $DIR/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 + = 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: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 + = 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 + = 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 + | +22 | 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 + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) diff --git a/tests/ui/pinned_drop/call-drop-inner.rs b/tests/ui/pinned_drop/call-drop-inner.rs index 4171ed5..9f89942 100644 --- a/tests/ui/pinned_drop/call-drop-inner.rs +++ b/tests/ui/pinned_drop/call-drop-inner.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] struct Struct { f: bool, diff --git a/tests/ui/pinned_drop/call-drop-inner.stderr b/tests/ui/pinned_drop/call-drop-inner.stderr index 53194b0..463e837 100644 --- a/tests/ui/pinned_drop/call-drop-inner.stderr +++ b/tests/ui/pinned_drop/call-drop-inner.stderr @@ -1,14 +1,14 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied - --> $DIR/call-drop-inner.rs:12:9 + --> $DIR/call-drop-inner.rs:13:9 | -12 | __drop_inner(__self); +13 | __drop_inner(__self); | ^^^^^^^^^^^^ ------ supplied 1 argument | | | expected 0 arguments | note: function defined here - --> $DIR/call-drop-inner.rs:9:1 + --> $DIR/call-drop-inner.rs:10:1 | -9 | #[pinned_drop] +10 | #[pinned_drop] | ^^^^^^^^^^^^^^ = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pinned_drop/conditional-drop-impl.rs b/tests/ui/pinned_drop/conditional-drop-impl.rs index fecfd50..23d756d 100644 --- a/tests/ui/pinned_drop/conditional-drop-impl.rs +++ b/tests/ui/pinned_drop/conditional-drop-impl.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + // In `Drop` impl, the implementor must specify the same requirement as type definition. struct DropImpl { diff --git a/tests/ui/pinned_drop/conditional-drop-impl.stderr b/tests/ui/pinned_drop/conditional-drop-impl.stderr index 6381a29..8ab2294 100644 --- a/tests/ui/pinned_drop/conditional-drop-impl.stderr +++ b/tests/ui/pinned_drop/conditional-drop-impl.stderr @@ -1,26 +1,31 @@ error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not - --> $DIR/conditional-drop-impl.rs:10:9 + --> $DIR/conditional-drop-impl.rs:11:9 | -10 | impl Drop for DropImpl { +11 | impl Drop for DropImpl { | ^^^^^ | note: the implementor must specify the same requirement - --> $DIR/conditional-drop-impl.rs:6:1 + --> $DIR/conditional-drop-impl.rs:7:1 | -6 | / struct DropImpl { -7 | | f: T, -8 | | } +7 | / struct DropImpl { +8 | | f: T, +9 | | } | |_^ error[E0277]: `T` cannot be unpinned - --> $DIR/conditional-drop-impl.rs:15:15 + --> $DIR/conditional-drop-impl.rs:16:15 | -15 | #[pin_project(PinnedDrop)] //~ ERROR E0277 +16 | #[pin_project(PinnedDrop)] //~ ERROR E0277 | ^^^^^^^^^^ the trait `Unpin` is not implemented for `T` | - = note: required because of the requirements on the impl of `PinnedDrop` for `PinnedDropImpl` + = note: consider using `Box::pin` +note: required because of the requirements on the impl of `PinnedDrop` for `PinnedDropImpl` + --> $DIR/conditional-drop-impl.rs:23:16 + | +23 | impl PinnedDrop for PinnedDropImpl { + | ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ = note: required by `pin_project::__private::PinnedDrop::drop` help: consider restricting type parameter `T` | -16 | struct PinnedDropImpl { - | ^^^^^^^ +17 | struct PinnedDropImpl { + | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/pinned_drop/invalid.rs b/tests/ui/pinned_drop/invalid.rs index 7e36750..fdadf8a 100644 --- a/tests/ui/pinned_drop/invalid.rs +++ b/tests/ui/pinned_drop/invalid.rs @@ -1,7 +1,8 @@ mod argument { - use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; + use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] struct UnexpectedArg1(()); @@ -128,9 +129,10 @@ mod assoc_item { } mod method { - use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; + use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] struct RetUnit(()); diff --git a/tests/ui/pinned_drop/invalid.stderr b/tests/ui/pinned_drop/invalid.stderr index 277a2fa..499b0d9 100644 --- a/tests/ui/pinned_drop/invalid.stderr +++ b/tests/ui/pinned_drop/invalid.stderr @@ -1,143 +1,143 @@ error: unexpected token: foo - --> $DIR/invalid.rs:8:19 + --> $DIR/invalid.rs:9:19 | -8 | #[pinned_drop(foo)] //~ ERROR unexpected token +9 | #[pinned_drop(foo)] //~ ERROR unexpected token | ^^^ error: duplicate #[pinned_drop] attribute - --> $DIR/invalid.rs:29:5 + --> $DIR/invalid.rs:30:5 | -29 | #[pinned_drop] //~ ERROR duplicate #[pinned_drop] attribute +30 | #[pinned_drop] //~ ERROR duplicate #[pinned_drop] attribute | ^^^^^^^^^^^^^^ error: #[pinned_drop] may only be used on implementation for the `PinnedDrop` trait - --> $DIR/invalid.rs:42:10 + --> $DIR/invalid.rs:43:10 | -42 | impl Drop for TraitImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait +43 | impl Drop for TraitImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait | ^^^^ error: #[pinned_drop] may only be used on implementation for the `PinnedDrop` trait - --> $DIR/invalid.rs:48:10 + --> $DIR/invalid.rs:49:10 | -48 | impl InherentImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait +49 | impl InherentImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait | ^^^^^^^^^^^^ error: expected `impl` - --> $DIR/invalid.rs:51:5 + --> $DIR/invalid.rs:52:5 | -51 | fn func(_: Pin<&mut ()>) {} //~ ERROR expected `impl` +52 | fn func(_: Pin<&mut ()>) {} //~ ERROR expected `impl` | ^^ error: implementing the trait `PinnedDrop` is not unsafe - --> $DIR/invalid.rs:61:5 + --> $DIR/invalid.rs:62:5 | -61 | unsafe impl PinnedDrop for Impl { +62 | unsafe impl PinnedDrop for Impl { | ^^^^^^ error: implementing the method `drop` is not unsafe - --> $DIR/invalid.rs:71:9 + --> $DIR/invalid.rs:72:9 | -71 | unsafe fn drop(self: Pin<&mut Self>) {} //~ ERROR implementing the method `drop` is not unsafe +72 | unsafe fn drop(self: Pin<&mut Self>) {} //~ ERROR implementing the method `drop` is not unsafe | ^^^^^^ error: not all trait items implemented, missing: `drop` - --> $DIR/invalid.rs:82:5 + --> $DIR/invalid.rs:83:5 | -82 | impl PinnedDrop for Empty {} //~ ERROR not all trait items implemented, missing: `drop` +83 | impl PinnedDrop for Empty {} //~ ERROR not all trait items implemented, missing: `drop` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: const `A` is not a member of trait `PinnedDrop` - --> $DIR/invalid.rs:89:9 + --> $DIR/invalid.rs:90:9 | -89 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop` +90 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop` | ^^^^^^^^^^^^^^^^ error: const `A` is not a member of trait `PinnedDrop` - --> $DIR/invalid.rs:99:9 - | -99 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop` - | ^^^^^^^^^^^^^^^^ + --> $DIR/invalid.rs:100:9 + | +100 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop` + | ^^^^^^^^^^^^^^^^ error: type `A` is not a member of trait `PinnedDrop` - --> $DIR/invalid.rs:107:9 + --> $DIR/invalid.rs:108:9 | -107 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop` +108 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop` | ^^^^^^^^^^^^ error: type `A` is not a member of trait `PinnedDrop` - --> $DIR/invalid.rs:117:9 + --> $DIR/invalid.rs:118:9 | -117 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop` +118 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop` | ^^^^^^^^^^^^ error: duplicate definitions with name `drop` - --> $DIR/invalid.rs:126:9 + --> $DIR/invalid.rs:127:9 | -126 | fn drop(self: Pin<&mut Self>) {} //~ ERROR duplicate definitions with name `drop` +127 | fn drop(self: Pin<&mut Self>) {} //~ ERROR duplicate definitions with name `drop` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: method `drop` must return the unit type - --> $DIR/invalid.rs:147:42 + --> $DIR/invalid.rs:149:42 | -147 | fn drop(self: Pin<&mut Self>) -> Self {} //~ ERROR method `drop` must return the unit type +149 | fn drop(self: Pin<&mut Self>) -> Self {} //~ ERROR method `drop` must return the unit type | ^^^^ error: method `drop` must take an argument `self: Pin<&mut Self>` - --> $DIR/invalid.rs:155:16 + --> $DIR/invalid.rs:157:16 | -155 | fn drop() {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +157 | fn drop() {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` | ^^ error: method `drop` must take an argument `self: Pin<&mut Self>` - --> $DIR/invalid.rs:163:17 + --> $DIR/invalid.rs:165:17 | -163 | fn drop(self: Pin<&mut Self>, _: ()) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +165 | fn drop(self: Pin<&mut Self>, _: ()) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: method `drop` must take an argument `self: Pin<&mut Self>` - --> $DIR/invalid.rs:171:17 + --> $DIR/invalid.rs:173:17 | -171 | fn drop(&mut self) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +173 | fn drop(&mut self) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` | ^^^^^^^^^ error: method `drop` must take an argument `self: Pin<&mut Self>` - --> $DIR/invalid.rs:179:17 + --> $DIR/invalid.rs:181:17 | -179 | fn drop(_: Pin<&mut Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +181 | fn drop(_: Pin<&mut Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` | ^^^^^^^^^^^^^^^^^ error: method `drop` must take an argument `self: Pin<&mut Self>` - --> $DIR/invalid.rs:187:17 + --> $DIR/invalid.rs:189:17 | -187 | fn drop(self: Pin<&Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +189 | fn drop(self: Pin<&Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` | ^^^^^^^^^^^^^^^^ error: method `drop` must take an argument `self: Pin<&mut Self>` - --> $DIR/invalid.rs:195:17 + --> $DIR/invalid.rs:197:17 | -195 | fn drop(self: Pin<&mut ()>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +197 | fn drop(self: Pin<&mut ()>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` | ^^^^^^^^^^^^^^^^^^ error: method `pinned_drop` is not a member of trait `PinnedDrop - --> $DIR/invalid.rs:203:12 + --> $DIR/invalid.rs:205:12 | -203 | fn pinned_drop(self: Pin<&mut Self>) {} //~ ERROR method `pinned_drop` is not a member of trait `PinnedDrop +205 | fn pinned_drop(self: Pin<&mut Self>) {} //~ ERROR method `pinned_drop` is not a member of trait `PinnedDrop | ^^^^^^^^^^^ error: implementing the trait `PinnedDrop` on this type is unsupported - --> $DIR/invalid.rs:211:25 + --> $DIR/invalid.rs:213:25 | -211 | impl PinnedDrop for () { +213 | impl PinnedDrop for () { | ^^ error: implementing the trait `PinnedDrop` on this type is unsupported - --> $DIR/invalid.rs:217:25 + --> $DIR/invalid.rs:219:25 | -217 | impl PinnedDrop for &mut A { +219 | impl PinnedDrop for &mut A { | ^^^^^^ error: implementing the trait `PinnedDrop` on this type is unsupported - --> $DIR/invalid.rs:223:25 + --> $DIR/invalid.rs:225:25 | -223 | impl PinnedDrop for [A] { +225 | impl PinnedDrop for [A] { | ^^^ diff --git a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs index f9db79c..391f290 100644 --- a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs +++ b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project] struct S { #[pin] diff --git a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr index 6f868bf..9f32149 100644 --- a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr +++ b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr @@ -1,8 +1,8 @@ -error[E0119]: conflicting implementations of trait `pin_project::__private::PinnedDrop` for type `S`: - --> $DIR/pinned-drop-no-attr-arg.rs:11:1 +error[E0119]: conflicting implementations of trait `pin_project::__private::PinnedDrop` for type `S` + --> $DIR/pinned-drop-no-attr-arg.rs:12:1 | -4 | #[pin_project] +5 | #[pin_project] | -------------- first implementation here ... -11 | impl PinnedDrop for S { +12 | impl PinnedDrop for S { | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S` diff --git a/tests/ui/pinned_drop/self.rs b/tests/ui/pinned_drop/self.rs index 03825ca..ff63402 100644 --- a/tests/ui/pinned_drop/self.rs +++ b/tests/ui/pinned_drop/self.rs @@ -1,7 +1,8 @@ pub mod self_in_macro_def { - use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; + use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] pub struct S { f: (), @@ -23,9 +24,10 @@ pub mod self_in_macro_def { } pub mod self_span { - use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; + use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] pub struct S { f: (), diff --git a/tests/ui/pinned_drop/self.stderr b/tests/ui/pinned_drop/self.stderr index edab117..4ccbc41 100644 --- a/tests/ui/pinned_drop/self.stderr +++ b/tests/ui/pinned_drop/self.stderr @@ -1,42 +1,42 @@ error: `self` parameter is only allowed in associated functions - --> $DIR/self.rs:17:26 + --> $DIR/self.rs:18:26 | -17 | fn f(self: ()) {} //~ ERROR `self` parameter is only allowed in associated functions +18 | fn f(self: ()) {} //~ ERROR `self` parameter is only allowed in associated functions | ^^^^ not semantically valid as function parameter ... -20 | t!(); +21 | t!(); | ----- in this macro invocation | = note: associated functions are those in `impl` or `trait` definitions = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/self.rs:15:29 + --> $DIR/self.rs:16:29 | -15 | let _ = self; //~ ERROR E0434 +16 | let _ = self; //~ ERROR E0434 | ^^^^ ... -20 | t!(); +21 | t!(); | ----- in this macro invocation | = help: use the `|| { ... }` closure form instead = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0423]: expected value, found struct `S` - --> $DIR/self.rs:38:27 + --> $DIR/self.rs:40:27 | -30 | / pub struct S { -31 | | f: (), -32 | | } +32 | / pub struct S { +33 | | f: (), +34 | | } | |_____- `S` defined here ... -38 | let _: Self = Self; //~ ERROR E0423 +40 | let _: Self = Self; //~ ERROR E0423 | ^^^^ help: use struct literal syntax instead: `S { f: val }` error[E0308]: mismatched types - --> $DIR/self.rs:37:25 + --> $DIR/self.rs:39:25 | -37 | let _: () = self; //~ ERROR E0308 +39 | let _: () = self; //~ ERROR E0308 | -- ^^^^ expected `()`, found struct `Pin` | | | expected due to this @@ -45,9 +45,9 @@ error[E0308]: mismatched types found struct `Pin<&mut self_span::S>` error[E0308]: mismatched types - --> $DIR/self.rs:50:25 + --> $DIR/self.rs:52:25 | -50 | let _: () = self; //~ ERROR E0308 +52 | let _: () = self; //~ ERROR E0308 | -- ^^^^ expected `()`, found struct `Pin` | | | expected due to this @@ -56,7 +56,7 @@ error[E0308]: mismatched types found struct `Pin<&mut E>` error[E0533]: expected unit struct, unit variant or constant, found struct variant `Self::V` - --> $DIR/self.rs:51:27 + --> $DIR/self.rs:53:27 | -51 | let _: Self = Self::V; //~ ERROR E0533 +53 | let _: Self = Self::V; //~ ERROR E0533 | ^^^^^^^ diff --git a/tests/ui/pinned_drop/unsafe-call.rs b/tests/ui/pinned_drop/unsafe-call.rs index 7faf0fa..3ee2b56 100644 --- a/tests/ui/pinned_drop/unsafe-call.rs +++ b/tests/ui/pinned_drop/unsafe-call.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] struct S { #[pin] diff --git a/tests/ui/pinned_drop/unsafe-call.stderr b/tests/ui/pinned_drop/unsafe-call.stderr index cd5e572..6216200 100644 --- a/tests/ui/pinned_drop/unsafe-call.stderr +++ b/tests/ui/pinned_drop/unsafe-call.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-call.rs:13:9 + --> $DIR/unsafe-call.rs:14:9 | -13 | self.project().f.get_unchecked_mut(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block [E0133] +14 | self.project().f.get_unchecked_mut(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block [E0133] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/tests/ui/unsafe_unpin/conflict-unpin.stderr b/tests/ui/unsafe_unpin/conflict-unpin.stderr index 916c3f2..078ac71 100644 --- a/tests/ui/unsafe_unpin/conflict-unpin.stderr +++ b/tests/ui/unsafe_unpin/conflict-unpin.stderr @@ -1,4 +1,4 @@ -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`: +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>` --> $DIR/conflict-unpin.rs:3:15 | 3 | #[pin_project(UnsafeUnpin)] //~ ERROR E0119 @@ -9,7 +9,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type | = note: upstream crates may add a new impl of trait `pin_project::UnsafeUnpin` for type `pin_project::__private::Wrapper<'_, Foo<_, _>>` in future versions -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`: +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>` --> $DIR/conflict-unpin.rs:12:15 | 12 | #[pin_project(UnsafeUnpin)] //~ ERROR E0119 @@ -20,7 +20,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type | = note: upstream crates may add a new impl of trait `pin_project::UnsafeUnpin` for type `pin_project::__private::Wrapper<'_, Bar<_, _>>` in future versions -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`: +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>` --> $DIR/conflict-unpin.rs:21:15 | 21 | #[pin_project(UnsafeUnpin)] //~ ERROR E0119 diff --git a/tests/ui/unstable-features/marker_trait_attr-feature-gate.rs b/tests/ui/unstable-features/marker_trait_attr-feature-gate.rs index 127cd1a..542250b 100644 --- a/tests/ui/unstable-features/marker_trait_attr-feature-gate.rs +++ b/tests/ui/unstable-features/marker_trait_attr-feature-gate.rs @@ -1,8 +1,9 @@ // Note: If you change this test, change 'marker_trait_attr.rs' at the same time. -use pin_project::pin_project; use std::marker::PhantomPinned; +use pin_project::pin_project; + #[pin_project] //~ ERROR E0119 struct Struct { #[pin] diff --git a/tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr b/tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr index bab534b..44322ec 100644 --- a/tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr +++ b/tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr @@ -1,10 +1,10 @@ -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`: - --> $DIR/marker_trait_attr-feature-gate.rs:6:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>` + --> $DIR/marker_trait_attr-feature-gate.rs:7:1 | -6 | #[pin_project] //~ ERROR E0119 +7 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>` ... -13 | impl Unpin for Struct {} +14 | impl Unpin for Struct {} | --------------------------- first implementation here | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/unstable-features/marker_trait_attr.rs b/tests/ui/unstable-features/marker_trait_attr.rs index d6eab21..9c8e664 100644 --- a/tests/ui/unstable-features/marker_trait_attr.rs +++ b/tests/ui/unstable-features/marker_trait_attr.rs @@ -6,9 +6,10 @@ // See https://github.com/taiki-e/pin-project/issues/105#issuecomment-535355974 -use pin_project::pin_project; use std::marker::PhantomPinned; +use pin_project::pin_project; + #[pin_project] //~ ERROR E0119 struct Struct { #[pin] diff --git a/tests/ui/unstable-features/marker_trait_attr.stderr b/tests/ui/unstable-features/marker_trait_attr.stderr index 9b3ec57..8893fb2 100644 --- a/tests/ui/unstable-features/marker_trait_attr.stderr +++ b/tests/ui/unstable-features/marker_trait_attr.stderr @@ -1,10 +1,10 @@ -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`: - --> $DIR/marker_trait_attr.rs:12:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>` + --> $DIR/marker_trait_attr.rs:13:1 | -12 | #[pin_project] //~ ERROR E0119 +13 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>` ... -19 | impl Unpin for Struct {} +20 | impl Unpin for Struct {} | --------------------------- first implementation here | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs b/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs index 9d1b8b8..012c870 100644 --- a/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs +++ b/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs @@ -1,8 +1,9 @@ // Note: If you change this test, change 'overlapping_marker_traits.rs' at the same time. -use pin_project::pin_project; use std::marker::PhantomPinned; +use pin_project::pin_project; + #[pin_project] //~ ERROR E0119 struct Struct { #[pin] diff --git a/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.stderr b/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.stderr index 4a8e238..64a0596 100644 --- a/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.stderr +++ b/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.stderr @@ -1,10 +1,10 @@ -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`: - --> $DIR/overlapping_marker_traits-feature-gate.rs:6:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>` + --> $DIR/overlapping_marker_traits-feature-gate.rs:7:1 | -6 | #[pin_project] //~ ERROR E0119 +7 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>` ... -13 | impl Unpin for Struct {} +14 | impl Unpin for Struct {} | --------------------------- first implementation here | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/unstable-features/overlapping_marker_traits.rs b/tests/ui/unstable-features/overlapping_marker_traits.rs index 0e0cddd..8dc27c1 100644 --- a/tests/ui/unstable-features/overlapping_marker_traits.rs +++ b/tests/ui/unstable-features/overlapping_marker_traits.rs @@ -3,16 +3,17 @@ // This feature could break the guarantee for Unpin provided by pin-project, // but was removed in https://github.com/rust-lang/rust/pull/68544 (nightly-2020-02-06). // Refs: -// * https://github.com/rust-lang/rust/issues/29864#issuecomment-515780867. -// * https://github.com/taiki-e/pin-project/issues/105 +// - https://github.com/rust-lang/rust/issues/29864#issuecomment-515780867 +// - https://github.com/taiki-e/pin-project/issues/105 // overlapping_marker_traits // Tracking issue: https://github.com/rust-lang/rust/issues/29864 #![feature(overlapping_marker_traits)] -use pin_project::pin_project; use std::marker::PhantomPinned; +use pin_project::pin_project; + #[pin_project] struct Struct { #[pin] diff --git a/tests/ui/unstable-features/overlapping_marker_traits.stderr b/tests/ui/unstable-features/overlapping_marker_traits.stderr index 91aaf6c..ffa50c7 100644 --- a/tests/ui/unstable-features/overlapping_marker_traits.stderr +++ b/tests/ui/unstable-features/overlapping_marker_traits.stderr @@ -6,13 +6,13 @@ error[E0557]: feature has been removed | = note: removed in favor of `#![feature(marker_trait_attr)]` -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`: - --> $DIR/overlapping_marker_traits.rs:16:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>` + --> $DIR/overlapping_marker_traits.rs:17:1 | -16 | #[pin_project] +17 | #[pin_project] | ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>` ... -23 | impl Unpin for Struct {} +24 | impl Unpin for Struct {} | --------------------------- first implementation here | = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/unstable-features/trivial_bounds-bug.stderr b/tests/ui/unstable-features/trivial_bounds-bug.stderr index fff09f9..f2407d0 100644 --- a/tests/ui/unstable-features/trivial_bounds-bug.stderr +++ b/tests/ui/unstable-features/trivial_bounds-bug.stderr @@ -3,3 +3,5 @@ error[E0277]: `PhantomPinned` cannot be unpinned | 13 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 | ^^^^^ the trait `Unpin` is not implemented for `PhantomPinned` + | + = note: consider using `Box::pin` diff --git a/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr b/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr index dd151b0..fa81083 100644 --- a/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr +++ b/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr @@ -4,6 +4,7 @@ error[E0277]: `PhantomPinned` cannot be unpinned 8 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `PhantomPinned` | + = note: consider using `Box::pin` = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -12,6 +13,8 @@ error[E0277]: `PhantomPinned` cannot be unpinned | 8 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 | ^^^^^ the trait `Unpin` is not implemented for `PhantomPinned` + | + = note: consider using `Box::pin` error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/trivial_bounds-feature-gate.rs:16:5 @@ -19,6 +22,7 @@ error[E0277]: `PhantomPinned` cannot be unpinned 16 | impl Unpin for B where Wrapper: Unpin {} //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `PhantomPinned` | + = note: consider using `Box::pin` = note: required because of the requirements on the impl of `Unpin` for `phantom_pinned::Wrapper` = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -29,7 +33,12 @@ error[E0277]: `PhantomPinned` cannot be unpinned 34 | impl Unpin for A where Inner: Unpin {} //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `Inner`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `Inner` + = note: consider using `Box::pin` +note: required because it appears within the type `Inner` + --> $DIR/trivial_bounds-feature-gate.rs:30:12 + | +30 | struct Inner(PhantomPinned); + | ^^^^^ = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -39,7 +48,12 @@ error[E0277]: `PhantomPinned` cannot be unpinned 42 | impl Unpin for B where Wrapper: Unpin {} //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `Inner`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `Inner` + = note: consider using `Box::pin` +note: required because it appears within the type `Inner` + --> $DIR/trivial_bounds-feature-gate.rs:30:12 + | +30 | struct Inner(PhantomPinned); + | ^^^^^ = note: required because of the requirements on the impl of `Unpin` for `inner::Wrapper` = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable -- cgit v1.2.3