diff options
137 files changed, 2135 insertions, 2111 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 9e9e67a..6cfdedc 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,6 +1,5 @@ { "git": { - "sha1": "0273e6ecd64057f47c3b2ada6fb4e5c37357c185" - }, - "path_in_vcs": "" -}
\ No newline at end of file + "sha1": "a51d39fcdb31fe78cc61c0053ead2beb65a4156d" + } +} @@ -41,8 +41,6 @@ rust_library { name: "libpin_project", host_supported: true, crate_name: "pin_project", - cargo_env_compat: true, - cargo_pkg_version: "1.0.10", srcs: ["src/lib.rs"], edition: "2018", proc_macros: ["libpin_project_internal"], @@ -51,3 +49,10 @@ rust_library { "com.android.virt", ], } + +// dependent_library ["feature_list"] +// pin-project-internal-1.0.6 +// 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" diff --git a/CHANGELOG.md b/CHANGELOG.md index ebac043..a9b56e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,29 +5,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org). <!-- -NOTE: In this file, do not use the hard wrap in the middle of a sentence for compatibility with GitHub comment style markdown rendering. +Note: In this file, do not use the hard wrap in the middle of a sentence for compatibility with GitHub comment style markdown rendering. --> ## [Unreleased] -## [1.0.10] - 2021-12-31 - -- Revert the increase of the minimal version of `syn` that was done in 1.0.9. - -## [1.0.9] - 2021-12-26 - -- [Prevent abuse of private module.](https://github.com/taiki-e/pin-project/pull/336) - -- Update minimal version of `syn` to 1.0.84. - -## [1.0.8] - 2021-07-21 - -- [Suppress `clippy::use_self` and `clippy::type_repetition_in_bounds` lints in generated code.](https://github.com/taiki-e/pin-project/pull/331) - -## [1.0.7] - 2021-04-16 - -- [Fix compile error when using `self::` as prefix of path inside `#[pinned_drop]` impl.](https://github.com/taiki-e/pin-project/pull/326) - ## [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) @@ -50,14 +32,10 @@ NOTE: In this file, do not use the hard wrap in the middle of a sentence for com ## [1.0.1] - 2020-10-15 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/commit/ddcd88079ba2d82857c365f2a3543ad146ade54c). - - [Fix warnings when `#[pin_project]` attribute used within `macro_rules!` macros.](https://github.com/taiki-e/pin-project/pull/298) ## [1.0.0] - 2020-10-13 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/commit/ddcd88079ba2d82857c365f2a3543ad146ade54c). - - [Remove deprecated `#[project]`, `#[project_ref]`, and `#[project_replace]` attributes.](https://github.com/taiki-e/pin-project/pull/265) Name the projected type by passing an argument with the same name as the method to the `#[pin_project]` attribute instead: @@ -93,7 +71,7 @@ Changes since the 1.0.0-alpha.1 release: - [Fix drop order of pinned fields in `project_replace`.](https://github.com/taiki-e/pin-project/pull/287) -- Update minimal version of `syn` to 1.0.44. +- Update minimal version of `syn` to 1.0.44 ## [1.0.0-alpha.1] - 2020-09-22 @@ -128,63 +106,37 @@ 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.29] - 2021-12-26 - -- [Fix compile error with `syn` 1.0.84 and later.](https://github.com/taiki-e/pin-project/pull/335) - -## [0.4.28] - 2021-03-28 - -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - -- [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 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - -- Update minimal version of `syn` to 1.0.44. +- Update minimal version of `syn` to 1.0.44 ## [0.4.26] - 2020-10-04 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - - [Fix drop order of pinned fields in `project_replace`.](https://github.com/taiki-e/pin-project/pull/287) ## [0.4.25] - 2020-10-01 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - - [Suppress `drop_bounds` lint, which will be added to rustc in the future.](https://github.com/taiki-e/pin-project/pull/273) See [#272](https://github.com/taiki-e/pin-project/issues/272) for more details. - (NOTE: 1.0.0-alpha.1 already contains this change.) + (Note: 1.0.0-alpha.1 already contains this change.) ## [0.4.24] - 2020-09-26 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - - [Fix compatibility of generated code with `forbid(future_incompatible)`.](https://github.com/taiki-e/pin-project/pull/282) - NOTE: This does not guarantee compatibility with `forbid(future_incompatible)` in the future. + Note: This does not guarantee compatibility with `forbid(future_incompatible)` in the future. If rustc adds a new lint, we may not be able to keep this. ## [0.4.23] - 2020-07-27 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - - [Fix compile error with `?Sized` type parameters.](https://github.com/taiki-e/pin-project/pull/263) ## [0.4.22] - 2020-06-14 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - - Documentation improvements. ## [0.4.21] - 2020-06-13 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - - [Deprecated `#[project]`, `#[project_ref]`, and `#[project_replace]` attributes due to some unfixable limitations.](https://github.com/taiki-e/pin-project/pull/244) Consider naming the projected type by passing an argument with the same name as the method to the `#[pin_project]` attribute instead. @@ -214,8 +166,6 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.20] - 2020-06-07 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - - [You can now use `project_replace` argument without Replace argument.](https://github.com/taiki-e/pin-project/pull/243) This used to require you to specify both. @@ -227,7 +177,7 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project } ``` -- [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) +- [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) ```rust #[pin_project(project_replace)] @@ -242,14 +192,10 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.19] - 2020-06-04 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - - [Suppress `unused_results` lint in generated code.](https://github.com/taiki-e/pin-project/pull/239) ## [0.4.18] - 2020-06-04 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - - [Support `Self` in more syntax positions inside `#[pinned_drop]` impl.](https://github.com/taiki-e/pin-project/pull/230) - [Suppress `clippy::type_repetition_in_bounds` and `clippy::used_underscore_binding` lints in generated code.](https://github.com/taiki-e/pin-project/pull/233) @@ -260,8 +206,6 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.17] - 2020-05-18 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - - [Support naming the projection types.](https://github.com/taiki-e/pin-project/pull/202) By passing an argument with the same name as the method to the attribute, you can name the projection type returned from the method: @@ -283,21 +227,15 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.16] - 2020-05-11 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - -- [Fix an issue that users can call internal function generated by `#[pinned_drop]`.](https://github.com/taiki-e/pin-project/pull/223) +- [Fixed 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 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - - [`#[project]` attribute can now handle all `project*` attributes in that scope with one wrapper attribute.](https://github.com/taiki-e/pin-project/pull/220) ## [0.4.14] - 2020-05-09 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - -- [Add `!Unpin` option to `#[pin_project]` attribute for guarantee the type is `!Unpin`.](https://github.com/taiki-e/pin-project/pull/219) +- [Added `!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)] @@ -317,9 +255,9 @@ 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)* + *[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)* -- [Fix an issue where duplicate `#[project]` attributes were ignored.](https://github.com/taiki-e/pin-project/pull/218) +- [Fixed 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) @@ -331,13 +269,11 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.13] - 2020-05-07 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - -- [Fix a regression in 0.4.11.](https://github.com/taiki-e/pin-project/pull/207) +- [Fixed 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): - - [Fix an issue that `#[project]` on non-statement expression does not work without unstable features.](https://github.com/taiki-e/pin-project/pull/197) + - [Fixed 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) @@ -349,15 +285,13 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.12] - 2020-05-07 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - - A release to avoid [a regression in 0.4.11](https://github.com/taiki-e/pin-project/issues/206). No code changes from [0.4.10](https://github.com/taiki-e/pin-project/releases/tag/v0.4.10). ## [0.4.11] - 2020-05-07 -**NOTE:** This release has been yanked. See [#206](https://github.com/taiki-e/pin-project/issues/206) for details. +**Note: This release has been yanked.** See [#206](https://github.com/taiki-e/pin-project/issues/206) for details. -- [Fix an issue that `#[project]` on non-statement expression does not work without unstable features.](https://github.com/taiki-e/pin-project/pull/197) +- [Fixed 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) @@ -369,85 +303,71 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.10] - 2020-05-04 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - -- [Add `project_replace` method and `#[project_replace]` attribute.](https://github.com/taiki-e/pin-project/pull/194) +- [Added `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) -- [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. +- [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. ## [0.4.9] - 2020-04-14 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - -- [Fix lifetime inference error when associated types are used in fields.](https://github.com/taiki-e/pin-project/pull/188) +- [Fixed lifetime inference error when associated types are used in fields.](https://github.com/taiki-e/pin-project/pull/188) -- [Fix compile error with tuple structs with `where` clauses.](https://github.com/taiki-e/pin-project/pull/186) +- [Fixed 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 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). +- [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) - -- [Fix use of `Self` in expression position inside `#[pinned_drop]` impl.](https://github.com/taiki-e/pin-project/pull/177) +- [Fixed 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 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - -- [Fix support for lifetime bounds.](https://github.com/taiki-e/pin-project/pull/176) +- [Fixed support for lifetime bounds.](https://github.com/taiki-e/pin-project/pull/176) ## [0.4.6] - 2019-11-20 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - -- [Fix compile error when there is `Self` in the where clause.](https://github.com/taiki-e/pin-project/pull/169) +- [Fixed 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 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - -- [Fix compile error with `dyn` types.](https://github.com/taiki-e/pin-project/pull/158) +- [Fixed compile error with `dyn` types.](https://github.com/taiki-e/pin-project/pull/158) ## [0.4.4] - 2019-10-17 -**NOTE:** This release has been yanked because it [failed to compile with syn 1.0.84 and later](https://github.com/taiki-e/pin-project/pull/335). - -- [Fix an issue where `PinnedDrop` implementations can call unsafe code without an unsafe block.](https://github.com/taiki-e/pin-project/pull/149) +- [Fixed 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 -**NOTE:** This release has been yanked. See [#148](https://github.com/taiki-e/pin-project/pull/148) for details. +**Note: This release has been yanked.** See [#148](https://github.com/taiki-e/pin-project/pull/148) for details. - [`#[pin_project]` can now interoperate with `#[cfg_attr()]`.](https://github.com/taiki-e/pin-project/pull/135) - [`#[pin_project]` can now interoperate with `#[cfg()]` on tuple structs and tuple variants.](https://github.com/taiki-e/pin-project/pull/135) -- [Fix support for DSTs(Dynamically Sized Types) on `#[pin_project(UnsafeUnpin)]`](https://github.com/taiki-e/pin-project/pull/120) +- [Fixed support for DSTs(Dynamically Sized Types) on `#[pin_project(UnsafeUnpin)]`](https://github.com/taiki-e/pin-project/pull/120) - Diagnostic improvements. ## [0.4.2] - 2019-09-29 -**NOTE:** This release has been yanked. See [#148](https://github.com/taiki-e/pin-project/pull/148) for details. +**Note: This release has been yanked.** See [#148](https://github.com/taiki-e/pin-project/pull/148) for details. -- [Fix support for DSTs(Dynamically Sized Types).](https://github.com/taiki-e/pin-project/pull/113) +- [Fixed 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. +**Note: This release has been yanked.** See [#148](https://github.com/taiki-e/pin-project/pull/148) for details. -- [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) +- [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) ## [0.4.0] - 2019-09-25 -**NOTE:** This release has been yanked. See [#148](https://github.com/taiki-e/pin-project/pull/148) for details. +**Note: This release has been yanked.** See [#148](https://github.com/taiki-e/pin-project/pull/148) for details. - [**Pin projection has become a safe operation.**](https://github.com/taiki-e/pin-project/pull/18) In the absence of other unsafe code that you write, it is impossible to cause undefined behavior. @@ -465,11 +385,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) -- [Add `project_ref` method to `#[pin_project]` types.](https://github.com/taiki-e/pin-project/pull/93) +- [Added `project_ref` method to `#[pin_project]` types.](https://github.com/taiki-e/pin-project/pull/93) -- [Add `#[project_ref]` attribute.](https://github.com/taiki-e/pin-project/pull/93) +- [Added `#[project_ref]` attribute.](https://github.com/taiki-e/pin-project/pull/93) -- [Remove "project_attr" feature and always enable `#[project]` attribute.](https://github.com/taiki-e/pin-project/pull/94) +- [Removed "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) @@ -479,25 +399,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: -- [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) +- [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) ## [0.4.0-beta.1] - 2019-09-21 -- [Change the argument type of project method back to `self: Pin<&mut Self>`.](https://github.com/taiki-e/pin-project/pull/90) +- [Changed the argument type of project method back to `self: Pin<&mut Self>`.](https://github.com/taiki-e/pin-project/pull/90) -- [Remove "project_attr" feature and always enable `#[project]` attribute.](https://github.com/taiki-e/pin-project/pull/94) +- [Removed "project_attr" feature and always enable `#[project]` attribute.](https://github.com/taiki-e/pin-project/pull/94) -- [Remove "renamed" feature.](https://github.com/taiki-e/pin-project/pull/100) +- [Removed "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) -- [Add `project_ref` method and `#[project_ref]` attribute.](https://github.com/taiki-e/pin-project/pull/93) +- [Added `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 -- [Change #[pinned_drop] to trait implementation.](https://github.com/taiki-e/pin-project/pull/86) +- [Changed #[pinned_drop] to trait implementation.](https://github.com/taiki-e/pin-project/pull/86) ```rust #[pinned_drop] @@ -508,7 +428,7 @@ Changes since the 0.4.0-beta.1 release: } ``` -- Add some examples and generated code. +- Added some examples and generated code. - Diagnostic improvements. @@ -520,7 +440,7 @@ Changes since the 0.4.0-beta.1 release: ## [0.4.0-alpha.9] - 2019-09-05 -- [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. +- [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. ```rust fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T> { @@ -528,11 +448,11 @@ Changes since the 0.4.0-beta.1 release: } ``` -- [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. +- [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. ## [0.4.0-alpha.8] - 2019-09-03 -- [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. +- [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. - [Diagnostic improvements.](https://github.com/taiki-e/pin-project/pull/61) @@ -542,7 +462,7 @@ Changes since the 0.4.0-beta.1 release: ## [0.4.0-alpha.6] - 2019-09-01 -- [Allow using `#[pin_project]` type with private field types](https://github.com/taiki-e/pin-project/pull/53) +- [Allowed 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 @@ -554,7 +474,7 @@ Changes since the 0.4.0-beta.1 release: ## [0.4.0-alpha.3] - 2019-08-23 -- [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) +- [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) - [`#[project]` attribute can now be used for impl blocks.](https://github.com/taiki-e/pin-project/pull/46) @@ -562,7 +482,7 @@ Changes since the 0.4.0-beta.1 release: ## [0.4.0-alpha.2] - 2019-08-13 -- Update `proc-macro2`, `syn`, and `quote` to 1.0. +- Updated `proc-macro2`, `syn`, and `quote` to 1.0. ## [0.4.0-alpha.1] - 2019-08-11 @@ -576,13 +496,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. -- Make `#[project]` attribute disabled by default. +- Made `#[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 -- Update `proc-macro2`, `syn`, and `quote` to 1.0. +- Updated `proc-macro2`, `syn`, and `quote` to 1.0. ## [0.3.4] - 2019-07-21 @@ -590,69 +510,69 @@ See also [tracking issue for 0.4 release](https://github.com/taiki-e/pin-project ## [0.3.3] - 2019-07-15 -**NOTE:** This release has been yanked. See [#16](https://github.com/taiki-e/pin-project/issues/16) for details. +**Note: This release has been yanked.** See [#16](https://github.com/taiki-e/pin-project/issues/16) for details. - Diagnostic improvements. ## [0.3.2] - 2019-03-30 -- Avoid suffixes on tuple index. +- Avoided suffixes on tuple index. ## [0.3.1] - 2019-03-02 - Documentation improvements. -- Update minimum `syn` version to 0.15.22. +- Updated minimum `syn` version to 0.15.22. ## [0.3.0] - 2019-02-20 -- Remove `unsafe_fields` attribute. +- Removed `unsafe_fields` attribute. -- Remove `unsafe_variants` attribute. +- Removed `unsafe_variants` attribute. ## [0.2.2] - 2019-02-20 -- Fix a bug that generates incorrect code for the some structures with trait bounds on type generics. +- Fixed a bug that generates incorrect code for the some structures with trait bounds on type generics. ## [0.2.1] - 2019-02-20 -- Fix a bug that generates incorrect code for the structures with where clause and associated type fields. +- Fixed a bug that generates incorrect code for the structures with where clause and associated type fields. ## [0.2.0] - 2019-02-11 -- Make `unsafe_fields` optional. +- Made `unsafe_fields` optional. - Documentation improvements. ## [0.1.8] - 2019-02-02 -- Add the feature to create projected enums to `unsafe_project`. +- Added the feature to create projected enums to `unsafe_project`. -- Add `project` attribute to support pattern matching. +- Added `project` attribute to support pattern matching. ## [0.1.7] - 2019-01-19 -- Fix documentation. +- Fixed documentation. ## [0.1.6] - 2019-01-19 - `unsafe_fields` can now opt-out. -- Add `unsafe_variants` attribute. This attribute is available if pin-project is built with the "unsafe_variants" feature. +- Added `unsafe_variants` attribute. This attribute is available if pin-project is built with the "unsafe_variants" feature. ## [0.1.5] - 2019-01-17 -- Add support for tuple struct to `unsafe_project`. +- Added support for tuple struct to `unsafe_project`. ## [0.1.4] - 2019-01-12 -- Add options for automatically implementing `Unpin` to both `unsafe_project` and `unsafe_fields`. +- Added options for automatically implementing `Unpin` to both `unsafe_project` and `unsafe_fields`. ## [0.1.3] - 2019-01-11 -- Fix dependencies. +- Fixed dependencies. -- Add `unsafe_fields` attribute. +- Added `unsafe_fields` attribute. ## [0.1.2] - 2019-01-09 @@ -660,19 +580,15 @@ See also [tracking issue for 0.4 release](https://github.com/taiki-e/pin-project ## [0.1.1] - 2019-01-08 -- Rename from `unsafe_pin_project` to `unsafe_project`. +- Renamed from `unsafe_pin_project` to `unsafe_project`. ## [0.1.0] - 2019-01-08 -**NOTE:** This release has been yanked. +**Note: This release has been yanked.** Initial release -[Unreleased]: https://github.com/taiki-e/pin-project/compare/v1.0.10...HEAD -[1.0.10]: https://github.com/taiki-e/pin-project/compare/v1.0.9...v1.0.10 -[1.0.9]: https://github.com/taiki-e/pin-project/compare/v1.0.8...v1.0.9 -[1.0.8]: https://github.com/taiki-e/pin-project/compare/v1.0.7...v1.0.8 -[1.0.7]: https://github.com/taiki-e/pin-project/compare/v1.0.6...v1.0.7 +[Unreleased]: https://github.com/taiki-e/pin-project/compare/v1.0.6...HEAD [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 @@ -681,8 +597,6 @@ 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.29]: https://github.com/taiki-e/pin-project/compare/v0.4.28...v0.4.29 -[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 @@ -3,19 +3,21 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies. +# to registry (e.g., crates.io) dependencies # -# If you are reading this file be aware that the original Cargo.toml -# will likely look very different (and much more reasonable). -# See Cargo.toml.orig for the original contents. +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) [package] edition = "2018" -rust-version = "1.37" name = "pin-project" -version = "1.0.10" +version = "1.0.6" +authors = ["Taiki Endo <te316e89@gmail.com>"] exclude = ["/.*", "/ci", "/tools"] description = "A crate for safe and ergonomic pin-projection.\n" +documentation = "https://docs.rs/pin-project" keywords = ["pin", "macros", "attribute"] categories = ["no-std", "rust-patterns"] license = "Apache-2.0 OR MIT" @@ -23,7 +25,8 @@ 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.10" +version = "=1.0.6" +default-features = false [dev-dependencies.macrotest] version = "1.0.8" @@ -34,4 +37,4 @@ version = "1" version = "1" [dev-dependencies.trybuild] -version = "1.0.49" +version = "1" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 120858b..ef46030 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,10 +1,11 @@ [package] name = "pin-project" -version = "1.0.10" +version = "1.0.6" +authors = ["Taiki Endo <te316e89@gmail.com>"] edition = "2018" -rust-version = "1.37" license = "Apache-2.0 OR MIT" repository = "https://github.com/taiki-e/pin-project" +documentation = "https://docs.rs/pin-project" keywords = ["pin", "macros", "attribute"] categories = ["no-std", "rust-patterns"] exclude = ["/.*", "/ci", "/tools"] @@ -26,11 +27,11 @@ members = [ ] [dependencies] -pin-project-internal = { version = "=1.0.10", path = "pin-project-internal" } +pin-project-internal = { version = "=1.0.6", path = "pin-project-internal", default-features = false } [dev-dependencies] pin-project-auxiliary-macro = { path = "tests/auxiliary/macro" } macrotest = "1.0.8" rustversion = "1" static_assertions = "1" -trybuild = "1.0.49" +trybuild = "1" @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/pin-project/pin-project-1.0.10.crate" + value: "https://static.crates.io/crates/pin-project/pin-project-1.0.6.crate" } - version: "1.0.10" + version: "1.0.6" license_type: NOTICE last_upgrade_date { - year: 2022 - month: 3 + year: 2021 + month: 4 day: 1 } } diff --git a/TEST_MAPPING b/TEST_MAPPING new file mode 100644 index 0000000..7e10dd0 --- /dev/null +++ b/TEST_MAPPING @@ -0,0 +1,8 @@ +// Generated by update_crate_tests.py for tests that depend on this crate. +{ + "presubmit": [ + { + "name": "futures-util_device_test_src_lib" + } + ] +} diff --git a/examples/enum-default-expanded.rs b/examples/enum-default-expanded.rs index 459ca39..2153592 100644 --- a/examples/enum-default-expanded.rs +++ b/examples/enum-default-expanded.rs @@ -15,11 +15,7 @@ // ``` #![allow(dead_code, unused_imports, unused_parens, unknown_lints, renamed_and_removed_lints)] -#![allow( - clippy::needless_lifetimes, - clippy::just_underscores_and_digits, - clippy::used_underscore_binding -)] +#![allow(clippy::needless_lifetimes, clippy::just_underscores_and_digits)] use pin_project::pin_project; diff --git a/examples/not_unpin-expanded.rs b/examples/not_unpin-expanded.rs index 5700c12..aa5209d 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(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/examples/pinned_drop-expanded.rs b/examples/pinned_drop-expanded.rs index 82207b6..48eb7fc 100644 --- a/examples/pinned_drop-expanded.rs +++ b/examples/pinned_drop-expanded.rs @@ -23,7 +23,7 @@ // ``` #![allow(dead_code, unused_imports, unused_parens, unknown_lints, renamed_and_removed_lints)] -#![allow(clippy::needless_lifetimes, clippy::mut_mut)] +#![allow(clippy::needless_lifetimes)] use std::pin::Pin; @@ -82,7 +82,7 @@ const _: () = { // // See ./struct-default-expanded.rs and https://github.com/taiki-e/pin-project/pull/34 // for details. - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<'a, T>(this: &Struct<'a, T>) { let _ = &this.was_dropped; let _ = &this.field; @@ -135,7 +135,6 @@ 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<T> ::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 445e570..4f43bda 100644 --- a/examples/project_replace-expanded.rs +++ b/examples/project_replace-expanded.rs @@ -79,8 +79,10 @@ const _: () = { // Destructors will run in reverse order, so next create a guard to overwrite // `self` with the replacement value without calling destructors. - let __guard = - ::pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; let Self { pinned, unpinned } = &mut *__self_ptr; @@ -96,7 +98,7 @@ const _: () = { // this must be in its own scope, or else `__result` will not be dropped // if any of the destructors panic. { - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard::new(pinned); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned); } // Finally, return the result @@ -110,7 +112,7 @@ const _: () = { // // See ./struct-default-expanded.rs and https://github.com/taiki-e/pin-project/pull/34 // for details. - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/examples/struct-default-expanded.rs b/examples/struct-default-expanded.rs index d661099..3d0e4ab 100644 --- a/examples/struct-default-expanded.rs +++ b/examples/struct-default-expanded.rs @@ -71,8 +71,10 @@ const _: () = { // Ensure that it's impossible to use pin projections on a #[repr(packed)] // struct. // - // Taking a reference to a packed field is UB, and applying - // `#[forbid(unaligned_references)]` makes sure that doing this is a hard error. + // 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. // // If the struct ends up having #[repr(packed)] applied somehow, // this will generate an (unfriendly) error message. Under all reasonable @@ -80,7 +82,7 @@ const _: () = { // a much nicer error above. // // See https://github.com/taiki-e/pin-project/pull/34 for more details. - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; diff --git a/examples/unsafe_unpin-expanded.rs b/examples/unsafe_unpin-expanded.rs index e9c7abc..2ea1f37 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(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; @@ -74,8 +74,9 @@ allow(dead_code, unused_variables) ) ))] -#![warn(missing_docs, rust_2018_idioms, single_use_lifetimes, unreachable_pub)] -#![warn(clippy::default_trait_access, clippy::wildcard_imports)] +#![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)] // ANDROID: Use std to allow building as a dylib. @@ -91,8 +92,6 @@ pub use pin_project_internal::pinned_drop; /// This trait is used in conjunction with the `UnsafeUnpin` argument to /// the [`#[pin_project]`][macro@pin_project] attribute. /// -/// # Safety -/// /// 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. @@ -151,10 +150,10 @@ pub unsafe trait UnsafeUnpin {} // Not public API. #[doc(hidden)] pub mod __private { - use core::mem::ManuallyDrop; #[doc(hidden)] pub use core::{ marker::{PhantomData, PhantomPinned, Unpin}, + mem::ManuallyDrop, ops::Drop, pin::Pin, ptr, @@ -258,14 +257,7 @@ pub mod __private { // This is an internal helper used to ensure a value is dropped. #[doc(hidden)] - pub struct UnsafeDropInPlaceGuard<T: ?Sized>(*mut T); - - impl<T: ?Sized> UnsafeDropInPlaceGuard<T> { - #[doc(hidden)] - pub unsafe fn new(ptr: *mut T) -> Self { - Self(ptr) - } - } + pub struct UnsafeDropInPlaceGuard<T: ?Sized>(pub *mut T); impl<T: ?Sized> Drop for UnsafeDropInPlaceGuard<T> { fn drop(&mut self) { @@ -279,15 +271,8 @@ pub mod __private { // its destructor being called. #[doc(hidden)] pub struct UnsafeOverwriteGuard<T> { - target: *mut T, - value: ManuallyDrop<T>, - } - - impl<T> UnsafeOverwriteGuard<T> { - #[doc(hidden)] - pub unsafe fn new(target: *mut T, value: T) -> Self { - Self { target, value: ManuallyDrop::new(value) } - } + pub value: ManuallyDrop<T>, + pub target: *mut T, } impl<T> Drop for UnsafeOverwriteGuard<T> { diff --git a/src/lib.rs.orig b/src/lib.rs.orig new file mode 100644 index 0000000..24cd303 --- /dev/null +++ b/src/lib.rs.orig @@ -0,0 +1,282 @@ +//! 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<T, U> { +//! #[pin] +//! pinned: T, +//! unpinned: U, +//! } +//! +//! impl<T, U> Struct<T, U> { +//! 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<T, U> { +//! Pinned(#[pin] T), +//! Unpinned(U), +//! } +//! +//! impl<T, U> Enum<T, U> { +//! 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<K, V> { +/// #[pin] +/// field_1: K, +/// field_2: V, +/// } +/// +/// unsafe impl<K, V> UnsafeUnpin for Struct<K, V> 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<T> { + // #[pin] field: T + // } + // + // impl<T> Unpin for MyStruct<T> where MyStruct<T>: UnsafeUnpin {} // generated by pin-project-internal + // impl<T> Unpin for MyStruct<T> 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<T>: 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<T> Unpin for MyStruct<T> where Wrapper<MyStruct<T>>: UnsafeUnpin {} // generated by pin-project-internal + // impl<T> Unpin for MyStruct<T> where T: Copy // written by the user + // ``` + // + // We also have `unsafe impl<T> UnsafeUnpin for Wrapper<T> 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<MyStruct<T>>: UnsafeUnpin` holds, in the interest of preserving + // forwards compatibility (in case such an impl is added for Wrapper<T> in + // a new version of the crate). + // + // This will cause rust to reject any other `Unpin` impls for MyStruct<T>, + // 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<T: ?Sized> 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<T>); + + impl<T> Unpin for AlwaysUnpin<'_, T> {} + + // This is an internal helper used to ensure a value is dropped. + #[doc(hidden)] + pub struct UnsafeDropInPlaceGuard<T: ?Sized>(pub *mut T); + + impl<T: ?Sized> Drop for UnsafeDropInPlaceGuard<T> { + 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<T> { + pub value: ManuallyDrop<T>, + pub target: *mut T, + } + + impl<T> Drop for UnsafeOverwriteGuard<T> { + fn drop(&mut self) { + unsafe { + ptr::write(self.target, ptr::read(&*self.value)); + } + } + } +} diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index b109e71..0000000 --- a/tests/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# Tests - -To run all tests, run the following command: - -```sh -cargo +nightly test --all -``` - -## UI tests (`ui`, `compiletest.rs`) - -This checks errors detected by the macro or the Rust compiler in the resulting -expanded code. - -To run this test, run the following command: - -```sh -cargo +nightly test --test compiletest -``` - -Locally, this test updates the files in the `ui` directory if there are -changes to the generated code. If there are any changes to the files in the -`ui` directory after running the test, please commit them. - -See also [`trybuild` documentation](https://docs.rs/trybuild). - -## Expansion tests (`expand`, `expandtest.rs`) - -Similar to ui tests, but instead of checking the compiler output, this checks -the code generated by macros. - -See [examples](../examples/README.md) for descriptions of what the generated -code does, and why it needs to be generated. - -To run this test, run the following command: - -```sh -cargo +nightly test --test expandtest -``` - -Locally, this test updates the files in the `expand` directory if there are -changes to the generated code. If there are any changes to the files in the -`expand` directory after running the test, please commit them. - -See also [`macrotest` documentation](https://docs.rs/macrotest). diff --git a/tests/compiletest.rs b/tests/compiletest.rs index 70d2358..b06cb02 100644 --- a/tests/compiletest.rs +++ b/tests/compiletest.rs @@ -3,7 +3,7 @@ use std::env; -#[rustversion::attr(not(nightly), ignore)] +#[rustversion::attr(before(2021-02-07), ignore)] // Note: This date is commit-date and the day before the toolchain date. #[test] fn ui() { if env::var_os("CI").is_none() { @@ -11,5 +11,5 @@ fn ui() { } let t = trybuild::TestCases::new(); - t.compile_fail("tests/ui/**/*.rs"); + t.compile_fail("tests/ui/*/*.rs"); } diff --git a/tests/expand/README.md b/tests/expand/README.md new file mode 100644 index 0000000..e3e708d --- /dev/null +++ b/tests/expand/README.md @@ -0,0 +1,17 @@ +# Expansion tests + +Similar to ui tests, but instead of checking the compiler output, this checks +the code generated by macros. + +See [examples](../../examples/README.md) for descriptions of what the generated +code does, and why it needs to be generated. + +To run this test, run the following command: + +```sh +cargo +nightly test --test expandtest +``` + +Locally, this test updates the files in the `expand` directory if there are +changes to the generated code. If there are any changes to the files in the +`expand` directory after running the test, please commit them. diff --git a/tests/expand/default/enum.expanded.rs b/tests/expand/default/enum.expanded.rs index a3b0338..e042f8c 100644 --- a/tests/expand/default/enum.expanded.rs +++ b/tests/expand/default/enum.expanded.rs @@ -17,9 +17,9 @@ enum Enum<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] enum EnumProj<'pin, T, U> where Enum<T, U>: 'pin, @@ -39,9 +39,9 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] +#[allow(clippy::type_repetition_in_bounds)] enum EnumProjRef<'pin, T, U> where Enum<T, U>: 'pin, @@ -61,26 +61,21 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> Enum<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => EnumProj::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProj::Unit, } @@ -88,16 +83,16 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => EnumProjRef::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProjRef::Unit, } @@ -106,32 +101,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> EnumMustNotImplDrop for T {} impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/default/struct.expanded.rs b/tests/expand/default/struct.expanded.rs index 3089a54..2528ece 100644 --- a/tests/expand/default/struct.expanded.rs +++ b/tests/expand/default/struct.expanded.rs @@ -13,16 +13,20 @@ struct Struct<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -30,8 +34,17 @@ const _: () = { pinned: ::pin_project::__private::Pin<&'pin mut (T)>, unpinned: &'pin mut (U), } + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, @@ -41,61 +54,61 @@ const _: () = { } impl<T, U> Struct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/default/tuple_struct.expanded.rs b/tests/expand/default/tuple_struct.expanded.rs index cc9b75e..3e8e306 100644 --- a/tests/expand/default/tuple_struct.expanded.rs +++ b/tests/expand/default/tuple_struct.expanded.rs @@ -9,24 +9,37 @@ struct TupleStruct<T, U>(#[pin] T, U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), ) where TupleStruct<T, U>: 'pin; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -35,55 +48,55 @@ const _: () = { TupleStruct<T, U>: 'pin; impl<T, U> TupleStruct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { let _ = &this.0; let _ = &this.1; } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/multifields/enum.expanded.rs b/tests/expand/multifields/enum.expanded.rs index fd31201..4c935d7 100644 --- a/tests/expand/multifields/enum.expanded.rs +++ b/tests/expand/multifields/enum.expanded.rs @@ -20,9 +20,9 @@ enum Enum<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] enum EnumProj<'pin, T, U> where Enum<T, U>: 'pin, @@ -49,9 +49,9 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] +#[allow(clippy::type_repetition_in_bounds)] enum EnumProjRef<'pin, T, U> where Enum<T, U>: 'pin, @@ -78,7 +78,6 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(variant_size_differences)] #[allow(clippy::large_enum_variant)] @@ -105,17 +104,12 @@ enum EnumProjOwn<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> Enum<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { @@ -125,14 +119,14 @@ const _: () = { unpinned1, unpinned2, } => EnumProj::Struct { - pinned1: _pin_project::__private::Pin::new_unchecked(pinned1), - pinned2: _pin_project::__private::Pin::new_unchecked(pinned2), + pinned1: ::pin_project::__private::Pin::new_unchecked(pinned1), + pinned2: ::pin_project::__private::Pin::new_unchecked(pinned2), unpinned1, unpinned2, }, Self::Tuple(_0, _1, _2, _3) => EnumProj::Tuple( - _pin_project::__private::Pin::new_unchecked(_0), - _pin_project::__private::Pin::new_unchecked(_1), + ::pin_project::__private::Pin::new_unchecked(_0), + ::pin_project::__private::Pin::new_unchecked(_1), _2, _3, ), @@ -142,7 +136,7 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { unsafe { match self.get_ref() { @@ -152,14 +146,14 @@ const _: () = { unpinned1, unpinned2, } => EnumProjRef::Struct { - pinned1: _pin_project::__private::Pin::new_unchecked(pinned1), - pinned2: _pin_project::__private::Pin::new_unchecked(pinned2), + pinned1: ::pin_project::__private::Pin::new_unchecked(pinned1), + pinned2: ::pin_project::__private::Pin::new_unchecked(pinned2), unpinned1, unpinned2, }, Self::Tuple(_0, _1, _2, _3) => EnumProjRef::Tuple( - _pin_project::__private::Pin::new_unchecked(_0), - _pin_project::__private::Pin::new_unchecked(_1), + ::pin_project::__private::Pin::new_unchecked(_0), + ::pin_project::__private::Pin::new_unchecked(_1), _2, _3, ), @@ -168,13 +162,15 @@ const _: () = { } } fn project_replace( - self: _pin_project::__private::Pin<&mut Self>, + self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> EnumProjOwn<T, U> { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = - _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; match &mut *__self_ptr { Self::Struct { pinned1, @@ -183,29 +179,27 @@ const _: () = { unpinned2, } => { let __result = EnumProjOwn::Struct { - pinned1: _pin_project::__private::PhantomData, - pinned2: _pin_project::__private::PhantomData, - unpinned1: _pin_project::__private::ptr::read(unpinned1), - unpinned2: _pin_project::__private::ptr::read(unpinned2), + pinned1: ::pin_project::__private::PhantomData, + pinned2: ::pin_project::__private::PhantomData, + unpinned1: ::pin_project::__private::ptr::read(unpinned1), + unpinned2: ::pin_project::__private::ptr::read(unpinned2), }; { - let __guard = - _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned2); - let __guard = - _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned1); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned2); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned1); } __result } Self::Tuple(_0, _1, _2, _3) => { let __result = EnumProjOwn::Tuple( - _pin_project::__private::PhantomData, - _pin_project::__private::PhantomData, - _pin_project::__private::ptr::read(_2), - _pin_project::__private::ptr::read(_3), + ::pin_project::__private::PhantomData, + ::pin_project::__private::PhantomData, + ::pin_project::__private::ptr::read(_2), + ::pin_project::__private::ptr::read(_3), ); { - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_1); - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_1); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } @@ -220,11 +214,11 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, @@ -232,22 +226,22 @@ const _: () = { __field2: T, __field3: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> EnumMustNotImplDrop for T {} impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/multifields/struct.expanded.rs b/tests/expand/multifields/struct.expanded.rs index 7ed1f3e..17dab6a 100644 --- a/tests/expand/multifields/struct.expanded.rs +++ b/tests/expand/multifields/struct.expanded.rs @@ -16,16 +16,20 @@ struct Struct<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -35,8 +39,17 @@ const _: () = { unpinned1: &'pin mut (U), unpinned2: &'pin mut (U), } + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, @@ -46,6 +59,14 @@ const _: () = { unpinned1: &'pin (U), unpinned2: &'pin (U), } + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] struct __StructProjectionOwned<T, U> { pinned1: ::pin_project::__private::PhantomData<T>, @@ -55,7 +76,7 @@ const _: () = { } impl<T, U> Struct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { @@ -65,8 +86,8 @@ const _: () = { unpinned2, } = self.get_unchecked_mut(); __StructProjection { - pinned1: _pin_project::__private::Pin::new_unchecked(pinned1), - pinned2: _pin_project::__private::Pin::new_unchecked(pinned2), + pinned1: ::pin_project::__private::Pin::new_unchecked(pinned1), + pinned2: ::pin_project::__private::Pin::new_unchecked(pinned2), unpinned1, unpinned2, } @@ -74,7 +95,7 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { @@ -84,21 +105,23 @@ const _: () = { unpinned2, } = self.get_ref(); __StructProjectionRef { - pinned1: _pin_project::__private::Pin::new_unchecked(pinned1), - pinned2: _pin_project::__private::Pin::new_unchecked(pinned2), + pinned1: ::pin_project::__private::Pin::new_unchecked(pinned1), + pinned2: ::pin_project::__private::Pin::new_unchecked(pinned2), unpinned1, unpinned2, } } } fn project_replace( - self: _pin_project::__private::Pin<&mut Self>, + self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> __StructProjectionOwned<T, U> { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = - _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; let Self { pinned1, pinned2, @@ -106,20 +129,20 @@ const _: () = { unpinned2, } = &mut *__self_ptr; let __result = __StructProjectionOwned { - pinned1: _pin_project::__private::PhantomData, - pinned2: _pin_project::__private::PhantomData, - unpinned1: _pin_project::__private::ptr::read(unpinned1), - unpinned2: _pin_project::__private::ptr::read(unpinned2), + pinned1: ::pin_project::__private::PhantomData, + pinned2: ::pin_project::__private::PhantomData, + unpinned1: ::pin_project::__private::ptr::read(unpinned1), + unpinned2: ::pin_project::__private::ptr::read(unpinned2), }; { - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned2); - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned1); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned2); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned1); } __result } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned1; let _ = &this.pinned2; @@ -128,32 +151,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/multifields/tuple_struct.expanded.rs b/tests/expand/multifields/tuple_struct.expanded.rs index 351c084..28e7fd8 100644 --- a/tests/expand/multifields/tuple_struct.expanded.rs +++ b/tests/expand/multifields/tuple_struct.expanded.rs @@ -9,16 +9,20 @@ struct TupleStruct<T, U>(#[pin] T, #[pin] T, U, U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, ::pin_project::__private::Pin<&'pin mut (T)>, @@ -27,8 +31,17 @@ const _: () = { ) where TupleStruct<T, U>: 'pin; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, ::pin_project::__private::Pin<&'pin (T)>, @@ -37,6 +50,14 @@ const _: () = { ) where TupleStruct<T, U>: 'pin; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] struct __TupleStructProjectionOwned<T, U>( ::pin_project::__private::PhantomData<T>, @@ -46,13 +67,13 @@ const _: () = { ); impl<T, U> TupleStruct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1, _2, _3) = self.get_unchecked_mut(); __TupleStructProjection( - _pin_project::__private::Pin::new_unchecked(_0), - _pin_project::__private::Pin::new_unchecked(_1), + ::pin_project::__private::Pin::new_unchecked(_0), + ::pin_project::__private::Pin::new_unchecked(_1), _2, _3, ) @@ -60,42 +81,44 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1, _2, _3) = self.get_ref(); __TupleStructProjectionRef( - _pin_project::__private::Pin::new_unchecked(_0), - _pin_project::__private::Pin::new_unchecked(_1), + ::pin_project::__private::Pin::new_unchecked(_0), + ::pin_project::__private::Pin::new_unchecked(_1), _2, _3, ) } } fn project_replace( - self: _pin_project::__private::Pin<&mut Self>, + self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> __TupleStructProjectionOwned<T, U> { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = - _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; let Self(_0, _1, _2, _3) = &mut *__self_ptr; let __result = __TupleStructProjectionOwned( - _pin_project::__private::PhantomData, - _pin_project::__private::PhantomData, - _pin_project::__private::ptr::read(_2), - _pin_project::__private::ptr::read(_3), + ::pin_project::__private::PhantomData, + ::pin_project::__private::PhantomData, + ::pin_project::__private::ptr::read(_2), + ::pin_project::__private::ptr::read(_3), ); { - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_1); - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_1); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { let _ = &this.0; let _ = &this.1; @@ -104,32 +127,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/enum-all.expanded.rs b/tests/expand/naming/enum-all.expanded.rs index 7259a13..561bb89 100644 --- a/tests/expand/naming/enum-all.expanded.rs +++ b/tests/expand/naming/enum-all.expanded.rs @@ -17,9 +17,9 @@ enum Enum<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] enum Proj<'pin, T, U> where Enum<T, U>: 'pin, @@ -39,9 +39,9 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] +#[allow(clippy::type_repetition_in_bounds)] enum ProjRef<'pin, T, U> where Enum<T, U>: 'pin, @@ -61,7 +61,6 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(variant_size_differences)] #[allow(clippy::large_enum_variant)] @@ -81,24 +80,19 @@ enum ProjOwn<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> Enum<T, U> { - fn project<'pin>(self: _pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { + fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => Proj::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - Proj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + Proj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => Proj::Unit, } @@ -106,48 +100,49 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => ProjRef::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - ProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + ProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => ProjRef::Unit, } } } fn project_replace( - self: _pin_project::__private::Pin<&mut Self>, + self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> ProjOwn<T, U> { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = - _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; match &mut *__self_ptr { Self::Struct { pinned, unpinned } => { let __result = ProjOwn::Struct { - pinned: _pin_project::__private::PhantomData, - unpinned: _pin_project::__private::ptr::read(unpinned), + pinned: ::pin_project::__private::PhantomData, + unpinned: ::pin_project::__private::ptr::read(unpinned), }; { - let __guard = - _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned); } __result } Self::Tuple(_0, _1) => { let __result = ProjOwn::Tuple( - _pin_project::__private::PhantomData, - _pin_project::__private::ptr::read(_1), + ::pin_project::__private::PhantomData, + ::pin_project::__private::ptr::read(_1), ); { - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } @@ -162,32 +157,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> EnumMustNotImplDrop for T {} impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/enum-mut.expanded.rs b/tests/expand/naming/enum-mut.expanded.rs index 09271fd..3489c6e 100644 --- a/tests/expand/naming/enum-mut.expanded.rs +++ b/tests/expand/naming/enum-mut.expanded.rs @@ -17,9 +17,9 @@ enum Enum<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] enum Proj<'pin, T, U> where Enum<T, U>: 'pin, @@ -39,24 +39,19 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> Enum<T, U> { - fn project<'pin>(self: _pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { + fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => Proj::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - Proj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + Proj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => Proj::Unit, } @@ -65,32 +60,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> EnumMustNotImplDrop for T {} impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/enum-none.expanded.rs b/tests/expand/naming/enum-none.expanded.rs index 54cd1f8..a33491e 100644 --- a/tests/expand/naming/enum-none.expanded.rs +++ b/tests/expand/naming/enum-none.expanded.rs @@ -17,43 +17,38 @@ enum Enum<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> Enum<T, U> {} #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> EnumMustNotImplDrop for T {} impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/enum-own.expanded.rs b/tests/expand/naming/enum-own.expanded.rs index 19ec570..6ca558b 100644 --- a/tests/expand/naming/enum-own.expanded.rs +++ b/tests/expand/naming/enum-own.expanded.rs @@ -17,7 +17,6 @@ enum Enum<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(variant_size_differences)] #[allow(clippy::large_enum_variant)] @@ -37,42 +36,38 @@ enum ProjOwn<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> Enum<T, U> { fn project_replace( - self: _pin_project::__private::Pin<&mut Self>, + self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> ProjOwn<T, U> { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = - _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; match &mut *__self_ptr { Self::Struct { pinned, unpinned } => { let __result = ProjOwn::Struct { - pinned: _pin_project::__private::PhantomData, - unpinned: _pin_project::__private::ptr::read(unpinned), + pinned: ::pin_project::__private::PhantomData, + unpinned: ::pin_project::__private::ptr::read(unpinned), }; { - let __guard = - _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned); } __result } Self::Tuple(_0, _1) => { let __result = ProjOwn::Tuple( - _pin_project::__private::PhantomData, - _pin_project::__private::ptr::read(_1), + ::pin_project::__private::PhantomData, + ::pin_project::__private::ptr::read(_1), ); { - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } @@ -87,32 +82,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> EnumMustNotImplDrop for T {} impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/enum-ref.expanded.rs b/tests/expand/naming/enum-ref.expanded.rs index 4565d08..0dcb829 100644 --- a/tests/expand/naming/enum-ref.expanded.rs +++ b/tests/expand/naming/enum-ref.expanded.rs @@ -17,9 +17,9 @@ enum Enum<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] +#[allow(clippy::type_repetition_in_bounds)] enum ProjRef<'pin, T, U> where Enum<T, U>: 'pin, @@ -39,27 +39,22 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> Enum<T, U> { #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => ProjRef::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - ProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + ProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => ProjRef::Unit, } @@ -68,32 +63,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> EnumMustNotImplDrop for T {} impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/struct-all.expanded.rs b/tests/expand/naming/struct-all.expanded.rs index 4b46e34..6506928 100644 --- a/tests/expand/naming/struct-all.expanded.rs +++ b/tests/expand/naming/struct-all.expanded.rs @@ -13,9 +13,9 @@ struct Struct<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] struct Proj<'pin, T, U> where Struct<T, U>: 'pin, @@ -31,9 +31,9 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] +#[allow(clippy::type_repetition_in_bounds)] struct ProjRef<'pin, T, U> where Struct<T, U>: 'pin, @@ -49,7 +49,6 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] struct ProjOwn<T, U> { pinned: ::pin_project::__private::PhantomData<T>, @@ -63,88 +62,85 @@ struct ProjOwn<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> Struct<T, U> { - fn project<'pin>(self: _pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { + fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); Proj { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); ProjRef { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } fn project_replace( - self: _pin_project::__private::Pin<&mut Self>, + self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> ProjOwn<T, U> { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = - _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; let Self { pinned, unpinned } = &mut *__self_ptr; let __result = ProjOwn { - pinned: _pin_project::__private::PhantomData, - unpinned: _pin_project::__private::ptr::read(unpinned), + pinned: ::pin_project::__private::PhantomData, + unpinned: ::pin_project::__private::ptr::read(unpinned), }; { - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned); } __result } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/struct-mut.expanded.rs b/tests/expand/naming/struct-mut.expanded.rs index 5803d6b..53c5212 100644 --- a/tests/expand/naming/struct-mut.expanded.rs +++ b/tests/expand/naming/struct-mut.expanded.rs @@ -13,9 +13,9 @@ struct Struct<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] struct Proj<'pin, T, U> where Struct<T, U>: 'pin, @@ -31,16 +31,20 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, @@ -49,60 +53,60 @@ const _: () = { unpinned: &'pin (U), } impl<T, U> Struct<T, U> { - fn project<'pin>(self: _pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { + fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); Proj { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/struct-none.expanded.rs b/tests/expand/naming/struct-none.expanded.rs index 3089a54..2528ece 100644 --- a/tests/expand/naming/struct-none.expanded.rs +++ b/tests/expand/naming/struct-none.expanded.rs @@ -13,16 +13,20 @@ struct Struct<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -30,8 +34,17 @@ const _: () = { pinned: ::pin_project::__private::Pin<&'pin mut (T)>, unpinned: &'pin mut (U), } + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, @@ -41,61 +54,61 @@ const _: () = { } impl<T, U> Struct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/struct-own.expanded.rs b/tests/expand/naming/struct-own.expanded.rs index d05c7d6..0c1fc76 100644 --- a/tests/expand/naming/struct-own.expanded.rs +++ b/tests/expand/naming/struct-own.expanded.rs @@ -13,7 +13,6 @@ struct Struct<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] struct ProjOwn<T, U> { pinned: ::pin_project::__private::PhantomData<T>, @@ -27,16 +26,20 @@ struct ProjOwn<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -44,8 +47,17 @@ const _: () = { pinned: ::pin_project::__private::Pin<&'pin mut (T)>, unpinned: &'pin mut (U), } + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, @@ -55,80 +67,82 @@ const _: () = { } impl<T, U> Struct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } fn project_replace( - self: _pin_project::__private::Pin<&mut Self>, + self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> ProjOwn<T, U> { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = - _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; let Self { pinned, unpinned } = &mut *__self_ptr; let __result = ProjOwn { - pinned: _pin_project::__private::PhantomData, - unpinned: _pin_project::__private::ptr::read(unpinned), + pinned: ::pin_project::__private::PhantomData, + unpinned: ::pin_project::__private::ptr::read(unpinned), }; { - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned); } __result } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/struct-ref.expanded.rs b/tests/expand/naming/struct-ref.expanded.rs index c131ec4..3f52ac5 100644 --- a/tests/expand/naming/struct-ref.expanded.rs +++ b/tests/expand/naming/struct-ref.expanded.rs @@ -13,9 +13,9 @@ struct Struct<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] +#[allow(clippy::type_repetition_in_bounds)] struct ProjRef<'pin, T, U> where Struct<T, U>: 'pin, @@ -31,16 +31,20 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -50,61 +54,61 @@ const _: () = { } impl<T, U> Struct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); ProjRef { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/tuple_struct-all.expanded.rs b/tests/expand/naming/tuple_struct-all.expanded.rs index 042a798..325b9db 100644 --- a/tests/expand/naming/tuple_struct-all.expanded.rs +++ b/tests/expand/naming/tuple_struct-all.expanded.rs @@ -9,9 +9,9 @@ struct TupleStruct<T, U>(#[pin] T, U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] struct Proj<'pin, T, U>(::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U)) where TupleStruct<T, U>: 'pin; @@ -23,9 +23,9 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] +#[allow(clippy::type_repetition_in_bounds)] struct ProjRef<'pin, T, U>(::pin_project::__private::Pin<&'pin (T)>, &'pin (U)) where TupleStruct<T, U>: 'pin; @@ -37,7 +37,6 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, U); #[allow(box_pointers)] @@ -48,82 +47,79 @@ struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> TupleStruct<T, U> { - fn project<'pin>(self: _pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { + fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - Proj(_pin_project::__private::Pin::new_unchecked(_0), _1) + Proj(::pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - ProjRef(_pin_project::__private::Pin::new_unchecked(_0), _1) + ProjRef(::pin_project::__private::Pin::new_unchecked(_0), _1) } } fn project_replace( - self: _pin_project::__private::Pin<&mut Self>, + self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> ProjOwn<T, U> { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = - _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; let Self(_0, _1) = &mut *__self_ptr; let __result = ProjOwn( - _pin_project::__private::PhantomData, - _pin_project::__private::ptr::read(_1), + ::pin_project::__private::PhantomData, + ::pin_project::__private::ptr::read(_1), ); { - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { let _ = &this.0; let _ = &this.1; } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/tuple_struct-mut.expanded.rs b/tests/expand/naming/tuple_struct-mut.expanded.rs index 60218d6..8cbb11f 100644 --- a/tests/expand/naming/tuple_struct-mut.expanded.rs +++ b/tests/expand/naming/tuple_struct-mut.expanded.rs @@ -9,9 +9,9 @@ struct TupleStruct<T, U>(#[pin] T, U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] struct Proj<'pin, T, U>(::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U)) where TupleStruct<T, U>: 'pin; @@ -23,16 +23,20 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -40,54 +44,54 @@ const _: () = { where TupleStruct<T, U>: 'pin; impl<T, U> TupleStruct<T, U> { - fn project<'pin>(self: _pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { + fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - Proj(_pin_project::__private::Pin::new_unchecked(_0), _1) + Proj(::pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { let _ = &this.0; let _ = &this.1; } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/tuple_struct-none.expanded.rs b/tests/expand/naming/tuple_struct-none.expanded.rs index cc9b75e..3e8e306 100644 --- a/tests/expand/naming/tuple_struct-none.expanded.rs +++ b/tests/expand/naming/tuple_struct-none.expanded.rs @@ -9,24 +9,37 @@ struct TupleStruct<T, U>(#[pin] T, U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), ) where TupleStruct<T, U>: 'pin; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -35,55 +48,55 @@ const _: () = { TupleStruct<T, U>: 'pin; impl<T, U> TupleStruct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { let _ = &this.0; let _ = &this.1; } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/tuple_struct-own.expanded.rs b/tests/expand/naming/tuple_struct-own.expanded.rs index 21e12de..84bc14b 100644 --- a/tests/expand/naming/tuple_struct-own.expanded.rs +++ b/tests/expand/naming/tuple_struct-own.expanded.rs @@ -9,7 +9,6 @@ struct TupleStruct<T, U>(#[pin] T, U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, U); #[allow(box_pointers)] @@ -20,24 +19,37 @@ struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), ) where TupleStruct<T, U>: 'pin; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -46,74 +58,76 @@ const _: () = { TupleStruct<T, U>: 'pin; impl<T, U> TupleStruct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) } } fn project_replace( - self: _pin_project::__private::Pin<&mut Self>, + self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> ProjOwn<T, U> { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = - _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; let Self(_0, _1) = &mut *__self_ptr; let __result = ProjOwn( - _pin_project::__private::PhantomData, - _pin_project::__private::ptr::read(_1), + ::pin_project::__private::PhantomData, + ::pin_project::__private::ptr::read(_1), ); { - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { let _ = &this.0; let _ = &this.1; } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/naming/tuple_struct-ref.expanded.rs b/tests/expand/naming/tuple_struct-ref.expanded.rs index ea11b6a..587d741 100644 --- a/tests/expand/naming/tuple_struct-ref.expanded.rs +++ b/tests/expand/naming/tuple_struct-ref.expanded.rs @@ -9,9 +9,9 @@ struct TupleStruct<T, U>(#[pin] T, U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] +#[allow(clippy::type_repetition_in_bounds)] struct ProjRef<'pin, T, U>(::pin_project::__private::Pin<&'pin (T)>, &'pin (U)) where TupleStruct<T, U>: 'pin; @@ -23,16 +23,20 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), @@ -41,55 +45,55 @@ const _: () = { TupleStruct<T, U>: 'pin; impl<T, U> TupleStruct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> ProjRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - ProjRef(_pin_project::__private::Pin::new_unchecked(_0), _1) + ProjRef(::pin_project::__private::Pin::new_unchecked(_0), _1) } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { let _ = &this.0; let _ = &this.1; } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/not_unpin/enum.expanded.rs b/tests/expand/not_unpin/enum.expanded.rs index 5173b54..6305b78 100644 --- a/tests/expand/not_unpin/enum.expanded.rs +++ b/tests/expand/not_unpin/enum.expanded.rs @@ -17,9 +17,9 @@ enum Enum<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] enum EnumProj<'pin, T, U> where Enum<T, U>: 'pin, @@ -39,9 +39,9 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] +#[allow(clippy::type_repetition_in_bounds)] enum EnumProjRef<'pin, T, U> where Enum<T, U>: 'pin, @@ -61,26 +61,21 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> Enum<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => EnumProj::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProj::Unit, } @@ -88,40 +83,40 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => EnumProjRef::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProjRef::Unit, } } } } - impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> where - _pin_project::__private::Wrapper<'pin, _pin_project::__private::PhantomPinned>: - _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where + ::pin_project::__private::Wrapper<'pin, ::pin_project::__private::PhantomPinned>: + ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> where - _pin_project::__private::Wrapper<'pin, _pin_project::__private::PhantomPinned>: - _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum<T, U> where + ::pin_project::__private::Wrapper<'pin, ::pin_project::__private::PhantomPinned>: + ::pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> EnumMustNotImplDrop for T {} impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/not_unpin/struct.expanded.rs b/tests/expand/not_unpin/struct.expanded.rs index e9d8922..efa660f 100644 --- a/tests/expand/not_unpin/struct.expanded.rs +++ b/tests/expand/not_unpin/struct.expanded.rs @@ -13,16 +13,20 @@ struct Struct<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -30,8 +34,17 @@ const _: () = { pinned: ::pin_project::__private::Pin<&'pin mut (T)>, unpinned: &'pin mut (U), } + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, @@ -41,52 +54,52 @@ const _: () = { } impl<T, U> Struct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; } - impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> where - _pin_project::__private::Wrapper<'pin, _pin_project::__private::PhantomPinned>: - _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + ::pin_project::__private::Wrapper<'pin, ::pin_project::__private::PhantomPinned>: + ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> where - _pin_project::__private::Wrapper<'pin, _pin_project::__private::PhantomPinned>: - _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct<T, U> where + ::pin_project::__private::Wrapper<'pin, ::pin_project::__private::PhantomPinned>: + ::pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/not_unpin/tuple_struct.expanded.rs b/tests/expand/not_unpin/tuple_struct.expanded.rs index cefb61d..89a257e 100644 --- a/tests/expand/not_unpin/tuple_struct.expanded.rs +++ b/tests/expand/not_unpin/tuple_struct.expanded.rs @@ -9,24 +9,37 @@ struct TupleStruct<T, U>(#[pin] T, U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), ) where TupleStruct<T, U>: 'pin; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -35,46 +48,46 @@ const _: () = { TupleStruct<T, U>: 'pin; impl<T, U> TupleStruct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { let _ = &this.0; let _ = &this.1; } - impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> where - _pin_project::__private::Wrapper<'pin, _pin_project::__private::PhantomPinned>: - _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct<T, U> where + ::pin_project::__private::Wrapper<'pin, ::pin_project::__private::PhantomPinned>: + ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> where - _pin_project::__private::Wrapper<'pin, _pin_project::__private::PhantomPinned>: - _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct<T, U> where + ::pin_project::__private::Wrapper<'pin, ::pin_project::__private::PhantomPinned>: + ::pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/pinned_drop/enum.expanded.rs b/tests/expand/pinned_drop/enum.expanded.rs index e1bc486..c8eb0e4 100644 --- a/tests/expand/pinned_drop/enum.expanded.rs +++ b/tests/expand/pinned_drop/enum.expanded.rs @@ -1,5 +1,5 @@ -use std::pin::Pin; use pin_project::{pin_project, pinned_drop}; +use std::pin::Pin; # [pin (__private (PinnedDrop , project = EnumProj , project_ref = EnumProjRef))] enum Enum<T, U> { Struct { @@ -18,9 +18,9 @@ enum Enum<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] enum EnumProj<'pin, T, U> where Enum<T, U>: 'pin, @@ -40,9 +40,9 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] +#[allow(clippy::type_repetition_in_bounds)] enum EnumProjRef<'pin, T, U> where Enum<T, U>: 'pin, @@ -62,26 +62,21 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> Enum<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => EnumProj::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProj::Unit, } @@ -89,16 +84,16 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => EnumProjRef::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProjRef::Unit, } @@ -107,35 +102,34 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } - impl<T, U> _pin_project::__private::Drop for Enum<T, U> { + impl<T, U> ::pin_project::__private::Drop for Enum<T, U> { fn drop(&mut self) { unsafe { - let __pinned_self = _pin_project::__private::Pin::new_unchecked(self); - _pin_project::__private::PinnedDrop::drop(__pinned_self); + let __pinned_self = ::pin_project::__private::Pin::new_unchecked(self); + ::pin_project::__private::PinnedDrop::drop(__pinned_self); } } } }; -#[doc(hidden)] impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> { 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 c162ef6..f5b8aa4 100644 --- a/tests/expand/pinned_drop/enum.rs +++ b/tests/expand/pinned_drop/enum.rs @@ -1,6 +1,5 @@ -use std::pin::Pin; - use pin_project::{pin_project, pinned_drop}; +use std::pin::Pin; #[pin_project(PinnedDrop, project = EnumProj, project_ref = EnumProjRef)] enum Enum<T, U> { diff --git a/tests/expand/pinned_drop/struct.expanded.rs b/tests/expand/pinned_drop/struct.expanded.rs index 2227442..9d7f489 100644 --- a/tests/expand/pinned_drop/struct.expanded.rs +++ b/tests/expand/pinned_drop/struct.expanded.rs @@ -1,5 +1,5 @@ -use std::pin::Pin; use pin_project::{pin_project, pinned_drop}; +use std::pin::Pin; #[pin(__private(PinnedDrop))] struct Struct<T, U> { #[pin] @@ -14,16 +14,20 @@ struct Struct<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -31,8 +35,17 @@ const _: () = { pinned: ::pin_project::__private::Pin<&'pin mut (T)>, unpinned: &'pin mut (U), } + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, @@ -42,64 +55,63 @@ const _: () = { } impl<T, U> Struct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } - impl<T, U> _pin_project::__private::Drop for Struct<T, U> { + impl<T, U> ::pin_project::__private::Drop for Struct<T, U> { fn drop(&mut self) { unsafe { - let __pinned_self = _pin_project::__private::Pin::new_unchecked(self); - _pin_project::__private::PinnedDrop::drop(__pinned_self); + let __pinned_self = ::pin_project::__private::Pin::new_unchecked(self); + ::pin_project::__private::PinnedDrop::drop(__pinned_self); } } } }; -#[doc(hidden)] impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { 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 691d3cb..948e6cc 100644 --- a/tests/expand/pinned_drop/struct.rs +++ b/tests/expand/pinned_drop/struct.rs @@ -1,6 +1,5 @@ -use std::pin::Pin; - use pin_project::{pin_project, pinned_drop}; +use std::pin::Pin; #[pin_project(PinnedDrop)] struct Struct<T, U> { diff --git a/tests/expand/pinned_drop/tuple_struct.expanded.rs b/tests/expand/pinned_drop/tuple_struct.expanded.rs index 8c7433e..b30ee66 100644 --- a/tests/expand/pinned_drop/tuple_struct.expanded.rs +++ b/tests/expand/pinned_drop/tuple_struct.expanded.rs @@ -1,5 +1,5 @@ -use std::pin::Pin; use pin_project::{pin_project, pinned_drop}; +use std::pin::Pin; #[pin(__private(PinnedDrop))] struct TupleStruct<T, U>(#[pin] T, U); #[allow(box_pointers)] @@ -10,24 +10,37 @@ struct TupleStruct<T, U>(#[pin] T, U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), ) where TupleStruct<T, U>: 'pin; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -36,58 +49,57 @@ const _: () = { TupleStruct<T, U>: 'pin; impl<T, U> TupleStruct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { let _ = &this.0; let _ = &this.1; } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } - impl<T, U> _pin_project::__private::Drop for TupleStruct<T, U> { + impl<T, U> ::pin_project::__private::Drop for TupleStruct<T, U> { fn drop(&mut self) { unsafe { - let __pinned_self = _pin_project::__private::Pin::new_unchecked(self); - _pin_project::__private::PinnedDrop::drop(__pinned_self); + let __pinned_self = ::pin_project::__private::Pin::new_unchecked(self); + ::pin_project::__private::PinnedDrop::drop(__pinned_self); } } } }; -#[doc(hidden)] impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> { 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 1f4917c..a536039 100644 --- a/tests/expand/pinned_drop/tuple_struct.rs +++ b/tests/expand/pinned_drop/tuple_struct.rs @@ -1,6 +1,5 @@ -use std::pin::Pin; - use pin_project::{pin_project, pinned_drop}; +use std::pin::Pin; #[pin_project(PinnedDrop)] struct TupleStruct<T, U>(#[pin] T, U); diff --git a/tests/expand/project_replace/enum.expanded.rs b/tests/expand/project_replace/enum.expanded.rs index d2b2094..304e0a7 100644 --- a/tests/expand/project_replace/enum.expanded.rs +++ b/tests/expand/project_replace/enum.expanded.rs @@ -17,7 +17,6 @@ enum Enum<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(variant_size_differences)] #[allow(clippy::large_enum_variant)] @@ -37,42 +36,38 @@ enum EnumProjOwn<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> Enum<T, U> { fn project_replace( - self: _pin_project::__private::Pin<&mut Self>, + self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> EnumProjOwn<T, U> { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = - _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; match &mut *__self_ptr { Self::Struct { pinned, unpinned } => { let __result = EnumProjOwn::Struct { - pinned: _pin_project::__private::PhantomData, - unpinned: _pin_project::__private::ptr::read(unpinned), + pinned: ::pin_project::__private::PhantomData, + unpinned: ::pin_project::__private::ptr::read(unpinned), }; { - let __guard = - _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned); } __result } Self::Tuple(_0, _1) => { let __result = EnumProjOwn::Tuple( - _pin_project::__private::PhantomData, - _pin_project::__private::ptr::read(_1), + ::pin_project::__private::PhantomData, + ::pin_project::__private::ptr::read(_1), ); { - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } @@ -87,32 +82,32 @@ const _: () = { } #[allow(missing_debug_implementations)] struct __Enum<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> EnumMustNotImplDrop for T {} impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/project_replace/struct.expanded.rs b/tests/expand/project_replace/struct.expanded.rs index aa5fd54..476c0ab 100644 --- a/tests/expand/project_replace/struct.expanded.rs +++ b/tests/expand/project_replace/struct.expanded.rs @@ -13,16 +13,20 @@ struct Struct<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -30,8 +34,17 @@ const _: () = { pinned: ::pin_project::__private::Pin<&'pin mut (T)>, unpinned: &'pin mut (U), } + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, @@ -39,6 +52,14 @@ const _: () = { pinned: ::pin_project::__private::Pin<&'pin (T)>, unpinned: &'pin (U), } + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] struct __StructProjectionOwned<T, U> { pinned: ::pin_project::__private::PhantomData<T>, @@ -46,80 +67,82 @@ const _: () = { } impl<T, U> Struct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } fn project_replace( - self: _pin_project::__private::Pin<&mut Self>, + self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> __StructProjectionOwned<T, U> { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = - _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; let Self { pinned, unpinned } = &mut *__self_ptr; let __result = __StructProjectionOwned { - pinned: _pin_project::__private::PhantomData, - unpinned: _pin_project::__private::ptr::read(unpinned), + pinned: ::pin_project::__private::PhantomData, + unpinned: ::pin_project::__private::ptr::read(unpinned), }; { - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned); } __result } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; } #[allow(missing_debug_implementations)] struct __Struct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/project_replace/tuple_struct.expanded.rs b/tests/expand/project_replace/tuple_struct.expanded.rs index 529f0b2..0026a9f 100644 --- a/tests/expand/project_replace/tuple_struct.expanded.rs +++ b/tests/expand/project_replace/tuple_struct.expanded.rs @@ -9,102 +9,125 @@ struct TupleStruct<T, U>(#[pin] T, U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), ) where TupleStruct<T, U>: 'pin; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), ) where TupleStruct<T, U>: 'pin; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] struct __TupleStructProjectionOwned<T, U>(::pin_project::__private::PhantomData<T>, U); impl<T, U> TupleStruct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) } } fn project_replace( - self: _pin_project::__private::Pin<&mut Self>, + self: ::pin_project::__private::Pin<&mut Self>, __replacement: Self, ) -> __TupleStructProjectionOwned<T, U> { unsafe { let __self_ptr: *mut Self = self.get_unchecked_mut(); - let __guard = - _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; let Self(_0, _1) = &mut *__self_ptr; let __result = __TupleStructProjectionOwned( - _pin_project::__private::PhantomData, - _pin_project::__private::ptr::read(_1), + ::pin_project::__private::PhantomData, + ::pin_project::__private::ptr::read(_1), ); { - let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); } __result } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { let _ = &this.0; let _ = &this.1; } #[allow(missing_debug_implementations)] struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/pub/enum.expanded.rs b/tests/expand/pub/enum.expanded.rs index 530eca9..5026bad 100644 --- a/tests/expand/pub/enum.expanded.rs +++ b/tests/expand/pub/enum.expanded.rs @@ -17,9 +17,9 @@ pub enum Enum<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] pub(crate) enum EnumProj<'pin, T, U> where Enum<T, U>: 'pin, @@ -39,9 +39,9 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] +#[allow(clippy::type_repetition_in_bounds)] pub(crate) enum EnumProjRef<'pin, T, U> where Enum<T, U>: 'pin, @@ -61,26 +61,21 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> Enum<T, U> { pub(crate) fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => EnumProj::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProj::Unit, } @@ -88,16 +83,16 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] pub(crate) fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => EnumProjRef::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProjRef::Unit, } @@ -106,32 +101,32 @@ const _: () = { } #[allow(missing_debug_implementations)] pub struct __Enum<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, __field1: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> where - __Enum<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum<T, U> where + __Enum<'pin, T, U>: ::pin_project::__private::Unpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> EnumMustNotImplDrop for T {} impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/pub/struct.expanded.rs b/tests/expand/pub/struct.expanded.rs index 71ae3a3..246d9b6 100644 --- a/tests/expand/pub/struct.expanded.rs +++ b/tests/expand/pub/struct.expanded.rs @@ -13,16 +13,20 @@ pub struct Struct<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] pub(crate) struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -30,8 +34,17 @@ const _: () = { pub pinned: ::pin_project::__private::Pin<&'pin mut (T)>, pub unpinned: &'pin mut (U), } + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] pub(crate) struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, @@ -41,61 +54,61 @@ const _: () = { } impl<T, U> Struct<T, U> { pub(crate) fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] pub(crate) fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; } #[allow(missing_debug_implementations)] pub struct __Struct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> where - __Struct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Struct<T, U> where + __Struct<'pin, T, U>: ::pin_project::__private::Unpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/pub/tuple_struct.expanded.rs b/tests/expand/pub/tuple_struct.expanded.rs index 02c3f24..033fbaf 100644 --- a/tests/expand/pub/tuple_struct.expanded.rs +++ b/tests/expand/pub/tuple_struct.expanded.rs @@ -9,24 +9,37 @@ pub struct TupleStruct<T, U>(#[pin] pub T, pub U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] pub(crate) struct __TupleStructProjection<'pin, T, U>( pub ::pin_project::__private::Pin<&'pin mut (T)>, pub &'pin mut (U), ) where TupleStruct<T, U>: 'pin; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] pub(crate) struct __TupleStructProjectionRef<'pin, T, U>( pub ::pin_project::__private::Pin<&'pin (T)>, pub &'pin (U), @@ -35,55 +48,55 @@ const _: () = { TupleStruct<T, U>: 'pin; impl<T, U> TupleStruct<T, U> { pub(crate) fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] pub(crate) fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { let _ = &this.0; let _ = &this.1; } #[allow(missing_debug_implementations)] pub struct __TupleStruct<'pin, T, U> { - __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< 'pin, ( - _pin_project::__private::PhantomData<T>, - _pin_project::__private::PhantomData<U>, + ::pin_project::__private::PhantomData<T>, + ::pin_project::__private::PhantomData<U>, ), >, __field0: T, } - impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } #[doc(hidden)] - unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> where - __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin + unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for TupleStruct<T, U> where + __TupleStruct<'pin, T, U>: ::pin_project::__private::Unpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; fn main() {} diff --git a/tests/expand/unsafe_unpin/enum.expanded.rs b/tests/expand/unsafe_unpin/enum.expanded.rs index 3d53a1e..df962d0 100644 --- a/tests/expand/unsafe_unpin/enum.expanded.rs +++ b/tests/expand/unsafe_unpin/enum.expanded.rs @@ -17,9 +17,9 @@ enum Enum<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::mut_mut)] +#[allow(clippy::type_repetition_in_bounds)] enum EnumProj<'pin, T, U> where Enum<T, U>: 'pin, @@ -39,9 +39,9 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] +#[allow(clippy::type_repetition_in_bounds)] enum EnumProjRef<'pin, T, U> where Enum<T, U>: 'pin, @@ -61,26 +61,21 @@ where #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; impl<T, U> Enum<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U> { unsafe { match self.get_unchecked_mut() { Self::Struct { pinned, unpinned } => EnumProj::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProj::Unit, } @@ -88,33 +83,33 @@ const _: () = { } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U> { unsafe { match self.get_ref() { Self::Struct { pinned, unpinned } => EnumProjRef::Struct { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, }, Self::Tuple(_0, _1) => { - EnumProjRef::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + EnumProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1) } Self::Unit => EnumProjRef::Unit, } } } } - impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> where - _pin_project::__private::Wrapper<'pin, Self>: _pin_project::UnsafeUnpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where + ::pin_project::__private::Wrapper<'pin, Self>: ::pin_project::UnsafeUnpin { } trait EnumMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> EnumMustNotImplDrop for T {} impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; unsafe impl<T: Unpin, U> UnsafeUnpin for Enum<T, U> {} diff --git a/tests/expand/unsafe_unpin/struct.expanded.rs b/tests/expand/unsafe_unpin/struct.expanded.rs index a866ab3..4066d49 100644 --- a/tests/expand/unsafe_unpin/struct.expanded.rs +++ b/tests/expand/unsafe_unpin/struct.expanded.rs @@ -13,16 +13,20 @@ struct Struct<T, U> { #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -30,8 +34,17 @@ const _: () = { pinned: ::pin_project::__private::Pin<&'pin mut (T)>, unpinned: &'pin mut (U), } + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, @@ -41,45 +54,45 @@ const _: () = { } impl<T, U> Struct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __StructProjection<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_unchecked_mut(); __StructProjection { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __StructProjectionRef<'pin, T, U> { unsafe { let Self { pinned, unpinned } = self.get_ref(); __StructProjectionRef { - pinned: _pin_project::__private::Pin::new_unchecked(pinned), + pinned: ::pin_project::__private::Pin::new_unchecked(pinned), unpinned, } } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; } - impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> where - _pin_project::__private::Wrapper<'pin, Self>: _pin_project::UnsafeUnpin + impl<'pin, T, U> ::pin_project::__private::Unpin for Struct<T, U> where + ::pin_project::__private::Wrapper<'pin, Self>: ::pin_project::UnsafeUnpin { } trait StructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> StructMustNotImplDrop for T {} impl<T, U> StructMustNotImplDrop for Struct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; unsafe impl<T: Unpin, U> UnsafeUnpin for Struct<T, U> {} diff --git a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs index 1a41976..59a40da 100644 --- a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs +++ b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs @@ -9,24 +9,37 @@ struct TupleStruct<T, U>(#[pin] T, U); #[allow(clippy::unknown_clippy_lints)] #[allow(clippy::pattern_type_mismatch)] #[allow(clippy::redundant_pub_crate)] -#[allow(clippy::type_repetition_in_bounds)] -#[allow(unused_qualifications)] #[allow(clippy::semicolon_if_nothing_returned)] -#[allow(clippy::use_self)] #[allow(clippy::used_underscore_binding)] const _: () = { - #[allow(unused_extern_crates)] - extern crate pin_project as _pin_project; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::mut_mut)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjection<'pin, T, U>( ::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U), ) where TupleStruct<T, U>: 'pin; + #[allow(box_pointers)] + #[allow(deprecated)] + #[allow(explicit_outlives_requirements)] + #[allow(single_use_lifetimes)] + #[allow(unreachable_pub)] + #[allow(clippy::unknown_clippy_lints)] + #[allow(clippy::pattern_type_mismatch)] + #[allow(clippy::redundant_pub_crate)] #[allow(dead_code)] #[allow(clippy::ref_option_ref)] + #[allow(clippy::type_repetition_in_bounds)] struct __TupleStructProjectionRef<'pin, T, U>( ::pin_project::__private::Pin<&'pin (T)>, &'pin (U), @@ -35,39 +48,39 @@ const _: () = { TupleStruct<T, U>: 'pin; impl<T, U> TupleStruct<T, U> { fn project<'pin>( - self: _pin_project::__private::Pin<&'pin mut Self>, + self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> __TupleStructProjection<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_unchecked_mut(); - __TupleStructProjection(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjection(::pin_project::__private::Pin::new_unchecked(_0), _1) } } #[allow(clippy::missing_const_for_fn)] fn project_ref<'pin>( - self: _pin_project::__private::Pin<&'pin Self>, + self: ::pin_project::__private::Pin<&'pin Self>, ) -> __TupleStructProjectionRef<'pin, T, U> { unsafe { let Self(_0, _1) = self.get_ref(); - __TupleStructProjectionRef(_pin_project::__private::Pin::new_unchecked(_0), _1) + __TupleStructProjectionRef(::pin_project::__private::Pin::new_unchecked(_0), _1) } } } - #[forbid(unaligned_references, safe_packed_borrows)] + #[forbid(safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { let _ = &this.0; let _ = &this.1; } - impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> where - _pin_project::__private::Wrapper<'pin, Self>: _pin_project::UnsafeUnpin + impl<'pin, T, U> ::pin_project::__private::Unpin for TupleStruct<T, U> where + ::pin_project::__private::Wrapper<'pin, Self>: ::pin_project::UnsafeUnpin { } trait TupleStructMustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] - impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T: ::pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} #[doc(hidden)] - impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { - unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + impl<T, U> ::pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} } }; unsafe impl<T: Unpin, U> UnsafeUnpin for Struct<T, U> {} diff --git a/tests/expandtest.rs b/tests/expandtest.rs index 3f0d5c1..adf8dde 100644 --- a/tests/expandtest.rs +++ b/tests/expandtest.rs @@ -6,8 +6,6 @@ use std::{ process::{Command, ExitStatus, Stdio}, }; -const PATH: &str = "tests/expand/**/*.rs"; - #[rustversion::attr(not(nightly), ignore)] #[test] fn expandtest() { @@ -15,17 +13,17 @@ fn expandtest() { let cargo = &*env::var("CARGO").unwrap_or_else(|_| "cargo".into()); if !has_command(&[cargo, "expand"]) || !has_command(&[cargo, "fmt"]) { if is_ci { - panic!("expandtest requires rustfmt and cargo-expand"); + panic!("expandtest requires rustfmt and cargo-expand") } return; } - let args = &["--all-features"]; + let path = "tests/expand/*/*.rs"; if is_ci { - macrotest::expand_without_refresh_args(PATH, args); + macrotest::expand_without_refresh(path); } else { env::set_var("MACROTEST", "overwrite"); - macrotest::expand_args(PATH, args); + macrotest::expand(path); } } diff --git a/tests/lint.rs b/tests/lint.rs index 6a75461..e7aee5a 100644 --- a/tests/lint.rs +++ b/tests/lint.rs @@ -1,21 +1,14 @@ -// Check interoperability with rustc and clippy lints. - -// for old compilers -#![allow(unknown_lints)] #![warn(nonstandard_style, rust_2018_idioms, unused)] // Note: This does not guarantee compatibility with forbidding these lints in the future. // If rustc adds a new lint, we may not be able to keep this. -#![forbid(future_incompatible, rust_2018_compatibility, rust_2021_compatibility)] -// lints forbidden as a part of future_incompatible, rust_2018_compatibility, and rust_2021_compatibility are not included in the list below. -// elided_lifetimes_in_paths, explicit_outlives_requirements, unused_extern_crates: as a part of rust_2018_idioms -// unsafe_block_in_unsafe_fn: requires Rust 1.52. and, we don't generate unsafe fn. -// non_exhaustive_omitted_patterns: unstable -// unstable_features: no way to generate #![feature(..)] by macros, expect for unstable inner attribute. and this lint is deprecated: https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unstable-features -// unused_crate_dependencies: unrelated -// unsafe_code: checked in forbid_unsafe module +#![forbid(future_incompatible, rust_2018_compatibility)] +#![allow(unknown_lints)] // for old compilers #![warn( box_pointers, deprecated_in_future, + disjoint_capture_drop_reorder, + elided_lifetimes_in_paths, + explicit_outlives_requirements, macro_use_extern_crate, meta_variable_misuse, missing_abi, @@ -27,17 +20,27 @@ single_use_lifetimes, trivial_casts, trivial_numeric_casts, + unaligned_references, unreachable_pub, + unused_extern_crates, unused_import_braces, unused_lifetimes, unused_qualifications, unused_results, variant_size_differences )] -#![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::restriction)] +// absolute_paths_not_starting_with_crate, anonymous_parameters, keyword_idents, pointer_structural_match, semicolon_in_expressions_from_macros: forbidden as a part of future_incompatible +// unsafe_block_in_unsafe_fn: unstable: https://github.com/rust-lang/rust/issues/71668 +// unsafe_code: checked in forbid_unsafe module +// unstable_features: deprecated: https://doc.rust-lang.org/beta/rustc/lints/listing/allowed-by-default.html#unstable-features +// unused_crate_dependencies: unrelated +#![warn(clippy::all, clippy::pedantic, clippy::nursery)] +#![warn(clippy::restriction)] #![allow(clippy::blanket_clippy_restriction_lints)] // this is a test, so enable all restriction lints intentionally. #![allow(clippy::exhaustive_structs, clippy::exhaustive_enums)] // TODO +// Check interoperability with rustc and clippy lints. + pub mod basic { include!("include/basic.rs"); @@ -773,7 +776,7 @@ pub mod single_use_lifetimes { for<'pin, 'pin_, 'pin__> &'pin &'pin_ &'pin__ T: Unpin, { #[pin] - _f: &'pin___ mut T, + f: &'pin___ mut T, } pub mod inside_macro { @@ -796,7 +799,7 @@ pub mod single_use_lifetimes { for<'pin, 'pin_, 'pin__> &'pin &'pin_ &'pin__ T: Unpin, { #[pin] - _f: &'pin___ mut T, + f: &'pin___ mut T, } }; } @@ -1078,45 +1081,6 @@ pub mod clippy_type_repetition_in_bounds { } } -pub mod clippy_use_self { - use pin_project::pin_project; - - pub trait Trait { - type Assoc; - } - - #[pin_project(project_replace)] - #[derive(Debug)] - pub struct Generics<T: Trait<Assoc = Self>> - where - Self: Trait<Assoc = Self>, - { - _f: T, - } - - pub mod inside_macro { - use pin_project::pin_project; - - use super::Trait; - - #[rustfmt::skip] - macro_rules! mac { - () => { - #[pin_project(project_replace)] - #[derive(Debug)] - pub struct Generics<T: Trait<Assoc = Self>> - where - Self: Trait<Assoc = Self>, - { - _f: T, - } - }; - } - - mac!(); - } -} - pub mod clippy_used_underscore_binding { use pin_project::pin_project; diff --git a/tests/pin_project.rs b/tests/pin_project.rs index aa08056..c6aaf94 100644 --- a/tests/pin_project.rs +++ b/tests/pin_project.rs @@ -94,7 +94,7 @@ fn projection() { EnumProj::Struct { f1, f2 } => { let _: Pin<&mut i32> = f1; let _: &mut i32 = f2; - unreachable!(); + unreachable!() } EnumProj::Unit => unreachable!(), } @@ -108,7 +108,7 @@ fn projection() { EnumProj::Tuple(x, y) => { let _: Pin<&mut i32> = x; let _: &mut i32 = y; - unreachable!(); + unreachable!() } EnumProj::Struct { f1, f2 } => { let _: Pin<&mut i32> = f1; @@ -723,7 +723,6 @@ fn parse_self() { type Assoc; } - #[allow(clippy::type_repetition_in_bounds)] #[pin_project(project_replace)] pub struct Generics<T: Trait<Assoc = Self>> where @@ -847,7 +846,7 @@ fn project_replace_panic() { fn drop(&mut self) { *self.0 = true; if self.1 { - panic!(); + panic!() } } } diff --git a/tests/pinned_drop.rs b/tests/pinned_drop.rs index 99273c4..9e7287d 100644 --- a/tests/pinned_drop.rs +++ b/tests/pinned_drop.rs @@ -70,10 +70,10 @@ fn self_ty() { // pat match *self { - Self { f: () } => {} + Self { f: _ } => {} } - if let Self { f: () } = *self {} - let Self { f: () } = *self; + if let Self { f: _ } = *self {} + let Self { f: _ } = *self; } } @@ -113,11 +113,11 @@ fn self_ty() { // pat match *self { - Self::Struct { f: () } => {} + Self::Struct { f: _ } => {} Self::Tuple(_) => {} Self::Unit => {} } - if let Self::Struct { f: () } = *self {} + if let Self::Struct { f: _ } = *self {} if let Self::Tuple(_) = *self {} if let Self::Unit = *self {} } @@ -138,7 +138,7 @@ fn self_inside_macro_containing_fn() { #[pinned_drop] impl PinnedDrop for S { fn drop(self: Pin<&mut Self>) { - mac!({ + let _ = mac!({ impl S { pub fn _f(self) -> Self { self @@ -213,7 +213,7 @@ fn self_ty_inside_macro_call() { } impl<T: Send> Trait for Struct<T> { - type Assoc2 = u8; + type Assoc2 = (); const ASSOC2: usize = 2; fn assoc2() {} } @@ -262,23 +262,3 @@ fn inside_macro() { mac!(1); } - -pub mod self_path { - use super::*; - - #[pin_project(PinnedDrop)] - pub struct S<T: Unpin>(T); - - fn f() {} - - #[pinned_drop] - impl<T: Unpin> PinnedDrop for self::S<T> { - fn drop(mut self: Pin<&mut Self>) { - self::f(); - let _: self::S<()> = self::S(()); - let _: self::S<Pin<&mut Self>> = 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 be7cab9..a0d8bdc 100644 --- a/tests/repr_packed.rs +++ b/tests/repr_packed.rs @@ -1,8 +1,5 @@ #![warn(rust_2018_idioms, single_use_lifetimes)] -// 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)] +#![forbid(safe_packed_borrows)] use std::cell::Cell; @@ -33,7 +30,7 @@ fn weird_repr_packed() { fn drop(&mut self) { FIELD_ADDR.with(|f| { f.set(&self.field as *const u8 as usize); - }); + }) } } @@ -48,5 +45,5 @@ fn weird_repr_packed() { let field_addr = &x.field as *const u8 as usize; field_addr }; - assert_eq!(field_addr, FIELD_ADDR.with(Cell::get)); + assert_eq!(field_addr, FIELD_ADDR.with(|f| f.get())); } diff --git a/tests/ui/cfg/cfg_attr-resolve.stderr b/tests/ui/cfg/cfg_attr-resolve.stderr index 0393c14..12bcc67 100644 --- a/tests/ui/cfg/cfg_attr-resolve.stderr +++ b/tests/ui/cfg/cfg_attr-resolve.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `project` found for struct `Pin<&mut Foo<u8>>` in the current scope - --> tests/ui/cfg/cfg_attr-resolve.rs:10:30 + --> $DIR/cfg_attr-resolve.rs:10:30 | 10 | let _ = Pin::new(&mut x).project(); //~ ERROR E0599 | ^^^^^^^ method not found in `Pin<&mut Foo<u8>>` diff --git a/tests/ui/cfg/cfg_attr-type-mismatch.rs b/tests/ui/cfg/cfg_attr-type-mismatch.rs index 1b9664b..b075af9 100644 --- a/tests/ui/cfg/cfg_attr-type-mismatch.rs +++ b/tests/ui/cfg/cfg_attr-type-mismatch.rs @@ -1,6 +1,5 @@ -use std::pin::Pin; - use pin_project::pin_project; +use std::pin::Pin; #[cfg_attr(not(any()), pin_project)] struct Foo<T> { diff --git a/tests/ui/cfg/cfg_attr-type-mismatch.stderr b/tests/ui/cfg/cfg_attr-type-mismatch.stderr index 366d9c7..89172a2 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 - --> tests/ui/cfg/cfg_attr-type-mismatch.rs:20:27 + --> $DIR/cfg_attr-type-mismatch.rs:19:27 | -20 | let _: Pin<&mut u8> = x.f; //~ ERROR E0308 +19 | 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 - --> tests/ui/cfg/cfg_attr-type-mismatch.rs:24:22 + --> $DIR/cfg_attr-type-mismatch.rs:23:22 | -24 | let _: &mut u8 = x.f; //~ ERROR E0308 +23 | 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 7e19952..42f57b5 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-1.rs +++ b/tests/ui/cfg/packed_sneaky-span-issue-1.rs @@ -2,8 +2,9 @@ use auxiliary_macro::hidden_repr; use pin_project::pin_project; #[pin_project] -#[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types +#[hidden_repr(packed)] 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 4f3acc3..abe3ecd 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-1.stderr +++ b/tests/ui/cfg/packed_sneaky-span-issue-1.stderr @@ -1,5 +1,11 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/cfg/packed_sneaky-span-issue-1.rs:5:15 - | -5 | #[hidden_repr(packed)] //~ ERROR 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 | | } + | |_^ diff --git a/tests/ui/cfg/packed_sneaky-span-issue-2.rs b/tests/ui/cfg/packed_sneaky-span-issue-2.rs index fcea76b..948d72c 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-2.rs +++ b/tests/ui/cfg/packed_sneaky-span-issue-2.rs @@ -2,8 +2,9 @@ use auxiliary_macro::hidden_repr; use pin_project::pin_project; #[pin_project] -#[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types +#[hidden_repr(packed)] 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 cc2795a..a957ceb 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-2.stderr +++ b/tests/ui/cfg/packed_sneaky-span-issue-2.stderr @@ -1,5 +1,11 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/cfg/packed_sneaky-span-issue-2.rs:5:15 - | -5 | #[hidden_repr(packed)] //~ ERROR 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 | | } + | |_^ diff --git a/tests/ui/cfg/packed_sneaky.stderr b/tests/ui/cfg/packed_sneaky.stderr index a54c2ec..b0d4d93 100644 --- a/tests/ui/cfg/packed_sneaky.stderr +++ b/tests/ui/cfg/packed_sneaky.stderr @@ -1,5 +1,5 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/cfg/packed_sneaky.rs:6:27 + --> $DIR/packed_sneaky.rs:6:27 | 6 | #[hidden_repr_cfg_not_any(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 e1c871c..b3bd1ae 100644 --- a/tests/ui/cfg/unsupported.stderr +++ b/tests/ui/cfg/unsupported.stderr @@ -1,8 +1,7 @@ error: #[pin_project] attribute may not be used on structs with zero fields - --> tests/ui/cfg/unsupported.rs:4:10 + --> $DIR/unsupported.rs:4:1 | -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 d644bf7..e90a574 100644 --- a/tests/ui/not_unpin/conflict-unpin.stderr +++ b/tests/ui/not_unpin/conflict-unpin.stderr @@ -1,5 +1,5 @@ -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>` - --> tests/ui/not_unpin/conflict-unpin.rs:3:15 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`: + --> $DIR/conflict-unpin.rs:3:15 | 3 | #[pin_project(!Unpin)] //~ ERROR E0119 | ^^^^^^ conflicting implementation for `Foo<_, _>` @@ -7,8 +7,8 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type 10 | impl<T, U> Unpin for Foo<T, U> where T: Unpin {} | --------------------------------------------- first implementation here -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>` - --> tests/ui/not_unpin/conflict-unpin.rs:12:15 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`: + --> $DIR/conflict-unpin.rs:12:15 | 12 | #[pin_project(!Unpin)] //~ ERROR E0119 | ^^^^^^ conflicting implementation for `Bar<_, _>` @@ -16,8 +16,8 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type 19 | impl<T, U> Unpin for Bar<T, U> {} | ------------------------------ first implementation here -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>` - --> tests/ui/not_unpin/conflict-unpin.rs:21:15 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`: + --> $DIR/conflict-unpin.rs:21:15 | 21 | #[pin_project(!Unpin)] //~ ERROR E0119 | ^^^^^^ conflicting implementation for `Baz<_, _>` diff --git a/tests/ui/not_unpin/impl-unsafe-unpin.stderr b/tests/ui/not_unpin/impl-unsafe-unpin.stderr index a944e95..ba80d5e 100644 --- a/tests/ui/not_unpin/impl-unsafe-unpin.stderr +++ b/tests/ui/not_unpin/impl-unsafe-unpin.stderr @@ -1,5 +1,5 @@ -error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Foo<_, _>` - --> tests/ui/not_unpin/impl-unsafe-unpin.rs:3:1 +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 | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Foo<_, _>` @@ -7,10 +7,10 @@ error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin 10 | unsafe impl<T, U> UnsafeUnpin for Foo<T, U> where T: Unpin {} | ---------------------------------------------------------- first implementation here | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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<_, _>` - --> tests/ui/not_unpin/impl-unsafe-unpin.rs:12:1 +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 | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Bar<_, _>` @@ -18,10 +18,10 @@ error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin 19 | unsafe impl<T, U> UnsafeUnpin for Bar<T, U> {} | ------------------------------------------- first implementation here | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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<_, _>` - --> tests/ui/not_unpin/impl-unsafe-unpin.rs:21:1 +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 | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Baz<_, _>` @@ -29,4 +29,4 @@ error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin 28 | unsafe impl<T: Unpin, U: Unpin> UnsafeUnpin for Baz<T, U> {} | --------------------------------------------------------- first implementation here | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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/add-attr-to-struct.rs b/tests/ui/pin_project/add-attr-to-struct.rs index 045e796..55f1561 100644 --- a/tests/ui/pin_project/add-attr-to-struct.rs +++ b/tests/ui/pin_project/add-attr-to-struct.rs @@ -1,7 +1,6 @@ -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 6fb88e8..27656d6 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 - --> tests/ui/pin_project/add-attr-to-struct.rs:7:1 + --> $DIR/add-attr-to-struct.rs:6:1 | -7 | #[add_pin_attr(struct)] //~ ERROR duplicate #[pin] attribute +6 | #[add_pin_attr(struct)] //~ ERROR duplicate #[pin] attribute | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in the attribute macro `add_pin_attr` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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 - --> tests/ui/pin_project/add-attr-to-struct.rs:13:1 + --> $DIR/add-attr-to-struct.rs:12:1 | -13 | #[add_pin_attr(struct)] //~ ERROR #[pin] attribute may only be used on fields of structs or variants +12 | #[add_pin_attr(struct)] //~ ERROR #[pin] attribute may only be used on fields of structs or variants | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in the attribute macro `add_pin_attr` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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 d0832cc..a140694 100644 --- a/tests/ui/pin_project/add-pinned-field.stderr +++ b/tests/ui/pin_project/add-pinned-field.stderr @@ -1,52 +1,23 @@ error[E0277]: `PhantomPinned` cannot be unpinned - --> tests/ui/pin_project/add-pinned-field.rs:21:5 + --> $DIR/add-pinned-field.rs:21:5 | +4 | fn is_unpin<T: Unpin>() {} + | ----- required by this bound in `is_unpin` +... 21 | is_unpin::<Foo>(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^ within `__Foo<'_>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: consider using `Box::pin` -note: required because it appears within the type `__Foo<'_>` - --> tests/ui/pin_project/add-pinned-field.rs:8:8 - | -8 | struct Foo { - | ^^^ -note: required because of the requirements on the impl of `Unpin` for `Foo` - --> tests/ui/pin_project/add-pinned-field.rs:6:1 - | -6 | #[pin_project] - | ^^^^^^^^^^^^^^ -7 | #[add_pinned_field] -8 | struct Foo { - | ^^^ -note: required by a bound in `is_unpin` - --> tests/ui/pin_project/add-pinned-field.rs:4:16 - | -4 | fn is_unpin<T: Unpin>() {} - | ^^^^^ required by this bound in `is_unpin` - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: required because it appears within the type `__Foo<'_>` + = note: required because of the requirements on the impl of `Unpin` for `Foo` error[E0277]: `PhantomPinned` cannot be unpinned - --> tests/ui/pin_project/add-pinned-field.rs:22:5 + --> $DIR/add-pinned-field.rs:22:5 | +4 | fn is_unpin<T: Unpin>() {} + | ----- required by this bound in `is_unpin` +... 22 | is_unpin::<Bar>(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^ within `__Bar<'_>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: consider using `Box::pin` -note: required because it appears within the type `__Bar<'_>` - --> tests/ui/pin_project/add-pinned-field.rs:15:8 - | -15 | struct Bar { - | ^^^ -note: required because of the requirements on the impl of `Unpin` for `Bar` - --> tests/ui/pin_project/add-pinned-field.rs:14:1 - | -14 | #[pin_project] - | ^^^^^^^^^^^^^^ -15 | struct Bar { - | ^^^ -note: required by a bound in `is_unpin` - --> tests/ui/pin_project/add-pinned-field.rs:4:16 - | -4 | fn is_unpin<T: Unpin>() {} - | ^^^^^ required by this bound in `is_unpin` - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: required because it appears within the type `__Bar<'_>` + = note: required because of the requirements on the impl of `Unpin` for `Bar` diff --git a/tests/ui/pin_project/conflict-drop.rs b/tests/ui/pin_project/conflict-drop.rs index 4fdb118..908f5c0 100644 --- a/tests/ui/pin_project/conflict-drop.rs +++ b/tests/ui/pin_project/conflict-drop.rs @@ -1,6 +1,5 @@ -use std::pin::Pin; - use pin_project::{pin_project, pinned_drop}; +use std::pin::Pin; #[pin_project] //~ ERROR E0119 struct Foo<T, U> { diff --git a/tests/ui/pin_project/conflict-drop.stderr b/tests/ui/pin_project/conflict-drop.stderr index 4ae628d..d5ca7b3 100644 --- a/tests/ui/pin_project/conflict-drop.stderr +++ b/tests/ui/pin_project/conflict-drop.stderr @@ -1,19 +1,19 @@ -error[E0119]: conflicting implementations of trait `_::FooMustNotImplDrop` for type `Foo<_, _>` - --> tests/ui/pin_project/conflict-drop.rs:5:1 +error[E0119]: conflicting implementations of trait `_::FooMustNotImplDrop` for type `Foo<_, _>`: + --> $DIR/conflict-drop.rs:4:1 | -5 | #[pin_project] //~ ERROR E0119 +4 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ | | | first implementation here | conflicting implementation for `Foo<_, _>` | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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<_, _>` - --> tests/ui/pin_project/conflict-drop.rs:16:15 +error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `Bar<_, _>`: + --> $DIR/conflict-drop.rs:15:15 | -16 | #[pin_project(PinnedDrop)] //~ ERROR E0119 +15 | #[pin_project(PinnedDrop)] //~ ERROR E0119 | ^^^^^^^^^^ conflicting implementation for `Bar<_, _>` ... -28 | impl<T, U> Drop for Bar<T, U> { +27 | impl<T, U> Drop for Bar<T, U> { | ----------------------------- first implementation here diff --git a/tests/ui/pin_project/conflict-unpin.stderr b/tests/ui/pin_project/conflict-unpin.stderr index 5e012c4..0d6f439 100644 --- a/tests/ui/pin_project/conflict-unpin.stderr +++ b/tests/ui/pin_project/conflict-unpin.stderr @@ -1,5 +1,5 @@ -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>` - --> tests/ui/pin_project/conflict-unpin.rs:5:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`: + --> $DIR/conflict-unpin.rs:5:1 | 5 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Foo<_, _>` @@ -7,10 +7,10 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type 13 | impl<T, U> Unpin for Foo<T, U> where T: Unpin {} // Conditional Unpin impl | --------------------------------------------- first implementation here | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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<_, _>` - --> tests/ui/pin_project/conflict-unpin.rs:17:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`: + --> $DIR/conflict-unpin.rs:17:1 | 17 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Bar<_, _>` @@ -18,10 +18,10 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type 25 | impl<T, U> Unpin for Bar<T, U> {} // Non-conditional Unpin impl | ------------------------------ first implementation here | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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<_, _>` - --> tests/ui/pin_project/conflict-unpin.rs:27:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`: + --> $DIR/conflict-unpin.rs:27:1 | 27 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Baz<_, _>` @@ -29,4 +29,4 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type 35 | impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} // Conditional Unpin impl | -------------------------------------------- first implementation here | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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/impl-unsafe-unpin.stderr b/tests/ui/pin_project/impl-unsafe-unpin.stderr index ba42303..78545c2 100644 --- a/tests/ui/pin_project/impl-unsafe-unpin.stderr +++ b/tests/ui/pin_project/impl-unsafe-unpin.stderr @@ -1,5 +1,5 @@ -error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Foo<_, _>` - --> tests/ui/pin_project/impl-unsafe-unpin.rs:3:1 +error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Foo<_, _>`: + --> $DIR/impl-unsafe-unpin.rs:3:1 | 3 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Foo<_, _>` @@ -7,10 +7,10 @@ error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin 10 | unsafe impl<T, U> UnsafeUnpin for Foo<T, U> where T: Unpin {} | ---------------------------------------------------------- first implementation here | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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<_, _>` - --> tests/ui/pin_project/impl-unsafe-unpin.rs:12:1 +error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Bar<_, _>`: + --> $DIR/impl-unsafe-unpin.rs:12:1 | 12 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Bar<_, _>` @@ -18,10 +18,10 @@ error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin 19 | unsafe impl<T, U> UnsafeUnpin for Bar<T, U> {} | ------------------------------------------- first implementation here | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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<_, _>` - --> tests/ui/pin_project/impl-unsafe-unpin.rs:21:1 +error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Baz<_, _>`: + --> $DIR/impl-unsafe-unpin.rs:21:1 | 21 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Baz<_, _>` @@ -29,4 +29,4 @@ error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin 28 | unsafe impl<T: Unpin, U: Unpin> UnsafeUnpin for Baz<T, U> {} | --------------------------------------------------------- first implementation here | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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/import_unnamed.stderr b/tests/ui/pin_project/import_unnamed.stderr index 260a35a..f54e4c4 100644 --- a/tests/ui/pin_project/import_unnamed.stderr +++ b/tests/ui/pin_project/import_unnamed.stderr @@ -1,29 +1,29 @@ error[E0432]: unresolved import `crate::pub_::__DefaultProjection` - --> tests/ui/pin_project/import_unnamed.rs:16:9 + --> $DIR/import_unnamed.rs:16:9 | 16 | use crate::pub_::__DefaultProjection; //~ ERROR E0432 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__DefaultProjection` in `pub_` error[E0432]: unresolved import `crate::pub_::__DefaultProjectionRef` - --> tests/ui/pin_project/import_unnamed.rs:18:9 + --> $DIR/import_unnamed.rs:18:9 | 18 | use crate::pub_::__DefaultProjectionRef; //~ ERROR E0432 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__DefaultProjectionRef` in `pub_` error[E0432]: unresolved import `crate::pub_::__ReplaceProjection` - --> tests/ui/pin_project/import_unnamed.rs:20:9 + --> $DIR/import_unnamed.rs:20:9 | 20 | use crate::pub_::__ReplaceProjection; //~ ERROR E0432 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__ReplaceProjection` in `pub_` error[E0432]: unresolved import `crate::pub_::__ReplaceProjectionOwned` - --> tests/ui/pin_project/import_unnamed.rs:22:9 + --> $DIR/import_unnamed.rs:22:9 | 22 | use crate::pub_::__ReplaceProjectionOwned; //~ ERROR E0432 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__ReplaceProjectionOwned` in `pub_` error[E0432]: unresolved import `crate::pub_::__ReplaceProjectionRef` - --> tests/ui/pin_project/import_unnamed.rs:24:9 + --> $DIR/import_unnamed.rs:24:9 | 24 | use crate::pub_::__ReplaceProjectionRef; //~ ERROR E0432 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__ReplaceProjectionRef` in `pub_` diff --git a/tests/ui/pin_project/invalid.stderr b/tests/ui/pin_project/invalid.stderr index c43d363..35552bf 100644 --- a/tests/ui/pin_project/invalid.stderr +++ b/tests/ui/pin_project/invalid.stderr @@ -1,329 +1,329 @@ -error: unexpected token: `()` - --> tests/ui/pin_project/invalid.rs:6:14 +error: unexpected token: () + --> $DIR/invalid.rs:6:14 | 6 | #[pin()] //~ ERROR unexpected token | ^^ -error: unexpected token: `(foo)` - --> tests/ui/pin_project/invalid.rs:11:29 +error: unexpected token: (foo) + --> $DIR/invalid.rs:11:29 | 11 | struct TupleStruct(#[pin(foo)] ()); //~ ERROR unexpected token | ^^^^^ -error: unexpected token: `(foo)` - --> tests/ui/pin_project/invalid.rs:15:16 +error: unexpected token: (foo) + --> $DIR/invalid.rs:15:16 | 15 | V(#[pin(foo)] ()), //~ ERROR unexpected token | ^^^^^ -error: unexpected token: `(foo)` - --> tests/ui/pin_project/invalid.rs:21:18 +error: unexpected token: (foo) + --> $DIR/invalid.rs:21:18 | 21 | #[pin(foo)] //~ ERROR unexpected token | ^^^^^ error: duplicate #[pin] attribute - --> tests/ui/pin_project/invalid.rs:33:9 + --> $DIR/invalid.rs:33:9 | 33 | #[pin] //~ ERROR duplicate #[pin] attribute | ^^^^^^ error: duplicate #[pin] attribute - --> tests/ui/pin_project/invalid.rs:40:9 + --> $DIR/invalid.rs:40:9 | 40 | #[pin] | ^^^^^^ error: duplicate #[pin] attribute - --> tests/ui/pin_project/invalid.rs:49:13 + --> $DIR/invalid.rs:49:13 | 49 | #[pin] | ^^^^^^ error: duplicate #[pin] attribute - --> tests/ui/pin_project/invalid.rs:59:13 + --> $DIR/invalid.rs:59:13 | 59 | #[pin] //~ ERROR duplicate #[pin] attribute | ^^^^^^ error: #[pin] attribute may only be used on fields of structs or variants - --> tests/ui/pin_project/invalid.rs:69:5 + --> $DIR/invalid.rs:69:5 | 69 | #[pin] //~ ERROR may only be used on fields of structs or variants | ^^^^^^ error: #[pin] attribute may only be used on fields of structs or variants - --> tests/ui/pin_project/invalid.rs:77:9 + --> $DIR/invalid.rs:77:9 | 77 | #[pin] //~ ERROR may only be used on fields of structs or variants | ^^^^^^ error: #[pin] attribute may only be used on fields of structs or variants - --> tests/ui/pin_project/invalid.rs:82:5 + --> $DIR/invalid.rs:82:5 | 82 | #[pin] //~ ERROR may only be used on fields of structs or variants | ^^^^^^ error: `Replace` argument was removed, use `project_replace` argument instead - --> tests/ui/pin_project/invalid.rs:91:19 + --> $DIR/invalid.rs:91:19 | 91 | #[pin_project(Replace)] //~ ERROR `Replace` argument was removed, use `project_replace` argument instead | ^^^^^^^ error: expected identifier - --> tests/ui/pin_project/invalid.rs:94:31 + --> $DIR/invalid.rs:94:31 | 94 | #[pin_project(UnsafeUnpin,,)] //~ ERROR expected identifier | ^ error: unexpected argument: Foo - --> tests/ui/pin_project/invalid.rs:97:19 + --> $DIR/invalid.rs:97:19 | 97 | #[pin_project(Foo)] //~ ERROR unexpected argument | ^^^ error: expected identifier - --> tests/ui/pin_project/invalid.rs:100:19 + --> $DIR/invalid.rs:100:19 | 100 | #[pin_project(,UnsafeUnpin)] //~ ERROR expected identifier | ^ error: expected `,` - --> tests/ui/pin_project/invalid.rs:106:30 + --> $DIR/invalid.rs:106:30 | 106 | #[pin_project(PinnedDrop PinnedDrop)] //~ ERROR expected `,` | ^^^^^^^^^^ error: duplicate `PinnedDrop` argument - --> tests/ui/pin_project/invalid.rs:109:31 + --> $DIR/invalid.rs:109:31 | 109 | #[pin_project(PinnedDrop, PinnedDrop)] //~ ERROR duplicate `PinnedDrop` argument | ^^^^^^^^^^ error: duplicate `UnsafeUnpin` argument - --> tests/ui/pin_project/invalid.rs:112:32 + --> $DIR/invalid.rs:112:32 | 112 | #[pin_project(UnsafeUnpin, UnsafeUnpin)] //~ ERROR duplicate `UnsafeUnpin` argument | ^^^^^^^^^^^ error: duplicate `!Unpin` argument - --> tests/ui/pin_project/invalid.rs:115:27 + --> $DIR/invalid.rs:115:27 | 115 | #[pin_project(!Unpin, !Unpin)] //~ ERROR duplicate `!Unpin` argument | ^^^^^^ error: duplicate `UnsafeUnpin` argument - --> tests/ui/pin_project/invalid.rs:118:44 + --> $DIR/invalid.rs:118:44 | 118 | #[pin_project(PinnedDrop, UnsafeUnpin, UnsafeUnpin)] //~ ERROR duplicate `UnsafeUnpin` argument | ^^^^^^^^^^^ error: duplicate `PinnedDrop` argument - --> tests/ui/pin_project/invalid.rs:121:44 + --> $DIR/invalid.rs:121:44 | 121 | #[pin_project(PinnedDrop, UnsafeUnpin, PinnedDrop, UnsafeUnpin)] //~ ERROR duplicate `PinnedDrop` argument | ^^^^^^^^^^ error: duplicate `project` argument - --> tests/ui/pin_project/invalid.rs:124:32 + --> $DIR/invalid.rs:124:32 | 124 | #[pin_project(project = A, project = B)] //~ ERROR duplicate `project` argument | ^^^^^^^^^^^ error: duplicate `project` argument - --> tests/ui/pin_project/invalid.rs:127:49 + --> $DIR/invalid.rs:127:49 | 127 | #[pin_project(project = A, project_ref = A, project = B)] //~ ERROR duplicate `project` argument | ^^^^^^^^^^^ error: duplicate `project_ref` argument - --> tests/ui/pin_project/invalid.rs:130:36 + --> $DIR/invalid.rs:130:36 | 130 | #[pin_project(project_ref = A, project_ref = B)] //~ ERROR duplicate `project_ref` argument | ^^^^^^^^^^^^^^^ error: duplicate `project_replace` argument - --> tests/ui/pin_project/invalid.rs:133:40 + --> $DIR/invalid.rs:133:40 | 133 | #[pin_project(project_replace = A, project_replace = B)] //~ ERROR duplicate `project_replace` argument | ^^^^^^^^^^^^^^^^^^^ error: duplicate `project_replace` argument - --> tests/ui/pin_project/invalid.rs:136:36 + --> $DIR/invalid.rs:136:36 | 136 | #[pin_project(project_replace, project_replace = B)] //~ ERROR duplicate `project_replace` argument | ^^^^^^^^^^^^^^^^^^^ error: duplicate `project_replace` argument - --> tests/ui/pin_project/invalid.rs:139:40 + --> $DIR/invalid.rs:139:40 | 139 | #[pin_project(project_replace = A, project_replace)] //~ ERROR duplicate `project_replace` argument | ^^^^^^^^^^^^^^^ error: arguments `PinnedDrop` and `project_replace` are mutually exclusive - --> tests/ui/pin_project/invalid.rs:145:19 + --> $DIR/invalid.rs:145:19 | 145 | #[pin_project(PinnedDrop, project_replace)] //~ ERROR arguments `PinnedDrop` and `project_replace` are mutually exclusive | ^^^^^^^^^^ error: arguments `PinnedDrop` and `project_replace` are mutually exclusive - --> tests/ui/pin_project/invalid.rs:148:49 + --> $DIR/invalid.rs:148:49 | 148 | #[pin_project(project_replace, UnsafeUnpin, PinnedDrop)] //~ ERROR arguments `PinnedDrop` and `project_replace` are mutually exclusive | ^^^^^^^^^^ error: arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive - --> tests/ui/pin_project/invalid.rs:151:19 + --> $DIR/invalid.rs:151:19 | 151 | #[pin_project(UnsafeUnpin, !Unpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive | ^^^^^^^^^^^ error: arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive - --> tests/ui/pin_project/invalid.rs:154:39 + --> $DIR/invalid.rs:154:39 | 154 | #[pin_project(!Unpin, PinnedDrop, UnsafeUnpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive | ^^^^^^^^^^^ error: expected `!Unpin`, found `!` - --> tests/ui/pin_project/invalid.rs:157:19 + --> $DIR/invalid.rs:157:19 | 157 | #[pin_project(!)] //~ ERROR expected `!Unpin`, found `!` | ^ error: unexpected argument: Unpin - --> tests/ui/pin_project/invalid.rs:160:19 + --> $DIR/invalid.rs:160:19 | 160 | #[pin_project(Unpin)] //~ ERROR unexpected argument | ^^^^^ error: expected `project = <identifier>`, found `project` - --> tests/ui/pin_project/invalid.rs:163:19 + --> $DIR/invalid.rs:163:19 | 163 | #[pin_project(project)] //~ ERROR expected `project = <identifier>`, found `project` | ^^^^^^^ error: expected `project = <identifier>`, found `project =` - --> tests/ui/pin_project/invalid.rs:166:19 + --> $DIR/invalid.rs:166:19 | 166 | #[pin_project(project = )] //~ ERROR expected `project = <identifier>`, found `project =` | ^^^^^^^^^ error: expected identifier - --> tests/ui/pin_project/invalid.rs:169:29 + --> $DIR/invalid.rs:169:29 | 169 | #[pin_project(project = !)] //~ ERROR expected identifier | ^ error: expected `project_ref = <identifier>`, found `project_ref` - --> tests/ui/pin_project/invalid.rs:172:19 + --> $DIR/invalid.rs:172:19 | 172 | #[pin_project(project_ref)] //~ ERROR expected `project_ref = <identifier>`, found `project_ref` | ^^^^^^^^^^^ error: expected `project_ref = <identifier>`, found `project_ref =` - --> tests/ui/pin_project/invalid.rs:175:19 + --> $DIR/invalid.rs:175:19 | 175 | #[pin_project(project_ref = )] //~ ERROR expected `project_ref = <identifier>`, found `project_ref =` | ^^^^^^^^^^^^^ error: expected identifier - --> tests/ui/pin_project/invalid.rs:178:33 + --> $DIR/invalid.rs:178:33 | 178 | #[pin_project(project_ref = !)] //~ ERROR expected identifier | ^ error: expected `project_replace = <identifier>`, found `project_replace =` - --> tests/ui/pin_project/invalid.rs:184:19 + --> $DIR/invalid.rs:184:19 | 184 | #[pin_project(project_replace = )] //~ ERROR expected `project_replace = <identifier>`, found `project_replace =` | ^^^^^^^^^^^^^^^^^ error: expected identifier - --> tests/ui/pin_project/invalid.rs:187:37 + --> $DIR/invalid.rs:187:37 | 187 | #[pin_project(project_replace = !)] //~ ERROR expected identifier | ^ error: `project_replace` argument requires a value when used on enums - --> tests/ui/pin_project/invalid.rs:190:19 + --> $DIR/invalid.rs:190:19 | 190 | #[pin_project(project_replace)] //~ ERROR `project_replace` argument requires a value when used on enums | ^^^^^^^^^^^^^^^ error: name `OrigAndProj` is the same as the original type name - --> tests/ui/pin_project/invalid.rs:199:29 + --> $DIR/invalid.rs:199:29 | 199 | #[pin_project(project = OrigAndProj)] //~ ERROR name `OrigAndProj` is the same as the original type name | ^^^^^^^^^^^ error: name `OrigAndProjRef` is the same as the original type name - --> tests/ui/pin_project/invalid.rs:202:33 + --> $DIR/invalid.rs:202:33 | 202 | #[pin_project(project_ref = OrigAndProjRef)] //~ ERROR name `OrigAndProjRef` is the same as the original type name | ^^^^^^^^^^^^^^ error: name `OrigAndProjOwn` is the same as the original type name - --> tests/ui/pin_project/invalid.rs:205:37 + --> $DIR/invalid.rs:205:37 | 205 | #[pin_project(project_replace = OrigAndProjOwn)] //~ ERROR name `OrigAndProjOwn` is the same as the original type name | ^^^^^^^^^^^^^^ error: name `A` is already specified by `project` argument - --> tests/ui/pin_project/invalid.rs:208:46 + --> $DIR/invalid.rs:208:46 | 208 | #[pin_project(project = A, project_ref = A)] //~ ERROR name `A` is already specified by `project` argument | ^ error: name `A` is already specified by `project` argument - --> tests/ui/pin_project/invalid.rs:211:50 + --> $DIR/invalid.rs:211:50 | 211 | #[pin_project(project = A, project_replace = A)] //~ ERROR name `A` is already specified by `project` argument | ^ error: name `A` is already specified by `project_ref` argument - --> tests/ui/pin_project/invalid.rs:214:54 + --> $DIR/invalid.rs:214:54 | 214 | #[pin_project(project_ref = A, project_replace = A)] //~ ERROR name `A` is already specified by `project_ref` argument | ^ error: duplicate #[pin_project] attribute - --> tests/ui/pin_project/invalid.rs:222:5 + --> $DIR/invalid.rs:222:5 | 222 | #[pin_project] //~ ERROR duplicate #[pin_project] attribute | ^^^^^^^^^^^^^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> tests/ui/pin_project/invalid.rs:230:19 + --> $DIR/invalid.rs:230:19 | 230 | struct Struct {} //~ ERROR may not be used on structs with zero fields | ^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> tests/ui/pin_project/invalid.rs:233:23 + --> $DIR/invalid.rs:233:23 | 233 | struct TupleStruct(); //~ ERROR may not be used on structs with zero fields | ^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> tests/ui/pin_project/invalid.rs:236:12 + --> $DIR/invalid.rs:236:12 | 236 | struct UnitStruct; //~ ERROR may not be used on structs with zero fields | ^^^^^^^^^^ error: #[pin_project] attribute may not be used on enums without variants - --> tests/ui/pin_project/invalid.rs:239:20 + --> $DIR/invalid.rs:239:20 | 239 | enum EnumEmpty {} //~ ERROR may not be used on enums without variants | ^^ error: #[pin_project] attribute may not be used on enums with discriminants - --> tests/ui/pin_project/invalid.rs:243:13 + --> $DIR/invalid.rs:243:13 | 243 | V = 2, //~ ERROR may not be used on enums with discriminants | ^ error: #[pin_project] attribute may not be used on enums with zero fields - --> tests/ui/pin_project/invalid.rs:248:9 + --> $DIR/invalid.rs:248:9 | 248 | / Unit, //~ ERROR may not be used on enums with zero fields 249 | | Tuple(), @@ -331,7 +331,7 @@ error: #[pin_project] attribute may not be used on enums with zero fields | |__________________^ error: #[pin_project] attribute may only be used on structs or enums - --> tests/ui/pin_project/invalid.rs:254:5 + --> $DIR/invalid.rs:254:5 | 254 | / union Union { 255 | | //~^ ERROR may only be used on structs or enums @@ -340,25 +340,25 @@ error: #[pin_project] attribute may only be used on structs or enums | |_____^ error: #[pin_project] attribute may only be used on structs or enums - --> tests/ui/pin_project/invalid.rs:260:5 + --> $DIR/invalid.rs:260:5 | 260 | impl Impl {} //~ ERROR may only be used on structs or enums | ^^^^^^^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/pin_project/invalid.rs:268:12 + --> $DIR/invalid.rs:268:12 | 268 | #[repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/pin_project/invalid.rs:272:12 + --> $DIR/invalid.rs:272:12 | 272 | #[repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/pin_project/invalid.rs:276:12 + --> $DIR/invalid.rs:276:12 | 276 | #[repr(packed)] | ^^^^^^ diff --git a/tests/ui/pin_project/overlapping_unpin_struct.rs b/tests/ui/pin_project/overlapping_unpin_struct.rs index abfd5d1..8db0855 100644 --- a/tests/ui/pin_project/overlapping_unpin_struct.rs +++ b/tests/ui/pin_project/overlapping_unpin_struct.rs @@ -1,6 +1,5 @@ -use std::marker::PhantomPinned; - use pin_project::pin_project; +use std::marker::PhantomPinned; #[pin_project] struct S<T> { diff --git a/tests/ui/pin_project/overlapping_unpin_struct.stderr b/tests/ui/pin_project/overlapping_unpin_struct.stderr index 1bd200d..296b063 100644 --- a/tests/ui/pin_project/overlapping_unpin_struct.stderr +++ b/tests/ui/pin_project/overlapping_unpin_struct.stderr @@ -1,25 +1,11 @@ error[E0277]: `PhantomPinned` cannot be unpinned - --> tests/ui/pin_project/overlapping_unpin_struct.rs:18:5 + --> $DIR/overlapping_unpin_struct.rs:17:5 | -18 | is_unpin::<S<PhantomPinned>>(); //~ ERROR E0277 +14 | fn is_unpin<T: Unpin>() {} + | ----- required by this bound in `is_unpin` +... +17 | is_unpin::<S<PhantomPinned>>(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__S<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: consider using `Box::pin` -note: required because it appears within the type `_::__S<'_, PhantomPinned>` - --> tests/ui/pin_project/overlapping_unpin_struct.rs:6:8 - | -6 | struct S<T> { - | ^ -note: required because of the requirements on the impl of `Unpin` for `S<PhantomPinned>` - --> tests/ui/pin_project/overlapping_unpin_struct.rs:5:1 - | -5 | #[pin_project] - | ^^^^^^^^^^^^^^ -6 | struct S<T> { - | ^^^^ -note: required by a bound in `is_unpin` - --> tests/ui/pin_project/overlapping_unpin_struct.rs:15:16 - | -15 | fn is_unpin<T: Unpin>() {} - | ^^^^^ required by this bound in `is_unpin` - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: required because it appears within the type `_::__S<'_, PhantomPinned>` + = note: required because of the requirements on the impl of `Unpin` for `S<PhantomPinned>` diff --git a/tests/ui/pin_project/override-priv-mod.rs b/tests/ui/pin_project/override-priv-mod.rs deleted file mode 100644 index 890fd5b..0000000 --- a/tests/ui/pin_project/override-priv-mod.rs +++ /dev/null @@ -1,32 +0,0 @@ -// https://discord.com/channels/273534239310479360/512792629516173323/870075511009857617 - -extern crate pin_project as pin_project_orig; -extern crate self as pin_project; - -pub use ::pin_project_orig::*; -mod __private { - pub use ::pin_project_orig::__private::*; - pub trait Drop {} -} - -use std::{marker::PhantomPinned, mem}; - -#[pin_project] //~ ERROR conflicting implementations of trait `_::FooMustNotImplDrop` -struct S { - #[pin] - f: (u8, PhantomPinned), -} - -impl Drop for S { - fn drop(&mut self) { - let prev = &self.f.0 as *const _ as usize; - let moved = mem::take(&mut self.f); // move pinned field - let moved = &moved.0 as *const _ as usize; - assert_eq!(prev, moved); // panic - } -} - -fn main() { - let mut x = Box::pin(S { f: (1, PhantomPinned) }); - let _f = x.as_mut().project().f; // first mutable access -} diff --git a/tests/ui/pin_project/override-priv-mod.stderr b/tests/ui/pin_project/override-priv-mod.stderr deleted file mode 100644 index 8a3fb9b..0000000 --- a/tests/ui/pin_project/override-priv-mod.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error[E0119]: conflicting implementations of trait `_::SMustNotImplDrop` for type `S` - --> tests/ui/pin_project/override-priv-mod.rs:14:1 - | -14 | #[pin_project] //~ ERROR conflicting implementations of trait `_::FooMustNotImplDrop` - | ^^^^^^^^^^^^^^ - | | - | first implementation here - | conflicting implementation for `S` - | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pin_project/packed-enum.rs b/tests/ui/pin_project/packed-enum.rs index 023c08d..9d4a4c3 100644 --- a/tests/ui/pin_project/packed-enum.rs +++ b/tests/ui/pin_project/packed-enum.rs @@ -1,9 +1,5 @@ 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 1872211..afc8b30 100644 --- a/tests/ui/pin_project/packed-enum.stderr +++ b/tests/ui/pin_project/packed-enum.stderr @@ -1,42 +1,30 @@ -error: #[repr(packed)] attribute should be applied to a struct or union - --> tests/ui/pin_project/packed-enum.rs:13:8 - | -13 | #[repr(packed)] //~ ERROR E0517 - | ^^^^^^ - -error: #[repr(packed)] attribute should be applied to a struct or union - --> tests/ui/pin_project/packed-enum.rs:18:8 - | -18 | #[repr(packed)] //~ ERROR E0517 - | ^^^^^^ - error[E0517]: attribute should be applied to a struct or union - --> tests/ui/pin_project/packed-enum.rs:7:8 - | -7 | #[repr(packed)] //~ ERROR E0517 - | ^^^^^^ -8 | / enum E1 { -9 | | V(()), -10 | | } - | |_- not 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 error[E0517]: attribute should be applied to a struct or union - --> tests/ui/pin_project/packed-enum.rs:13:8 + --> $DIR/packed-enum.rs:9:8 | -13 | #[repr(packed)] //~ ERROR E0517 +9 | #[repr(packed)] //~ ERROR E0517 | ^^^^^^ -14 | / enum E2 { -15 | | V(()), -16 | | } +10 | / enum E2 { +11 | | V(()), +12 | | } | |_- not a struct or union error[E0517]: attribute should be applied to a struct or union - --> tests/ui/pin_project/packed-enum.rs:18:8 + --> $DIR/packed-enum.rs:14:8 | -18 | #[repr(packed)] //~ ERROR E0517 +14 | #[repr(packed)] //~ ERROR E0517 | ^^^^^^ -19 | #[pin_project] -20 | / enum E3 { -21 | | V(()), -22 | | } +15 | #[pin_project] +16 | / enum E3 { +17 | | V(()), +18 | | } | |_- 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 dedc403..ed819ca 100644 --- a/tests/ui/pin_project/packed-name-value.rs +++ b/tests/ui/pin_project/packed-name-value.rs @@ -1,24 +1,17 @@ use pin_project::pin_project; -// #[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: (), -// } +#[repr(packed = "")] //~ ERROR E0552 +struct S1 { + f: (), +} #[pin_project] -#[repr(packed = "")] //~ ERROR attribute should not be name-value pair +#[repr(packed = "")] //~ ERROR E0552 struct S2 { f: (), } -#[repr(packed = "")] //~ ERROR attribute should not be name-value pair +#[repr(packed = "")] //~ ERROR E0552 #[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 d8b2194..a3e2571 100644 --- a/tests/ui/pin_project/packed-name-value.stderr +++ b/tests/ui/pin_project/packed-name-value.stderr @@ -1,23 +1,17 @@ -error: #[repr(packed)] attribute should not be name-value pair - --> tests/ui/pin_project/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:3:8 + | +3 | #[repr(packed = "")] //~ ERROR E0552 + | ^^^^^^^^^^^ -error: #[repr(packed)] attribute should not be name-value pair - --> tests/ui/pin_project/packed-name-value.rs:21:8 - | -21 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair - | ^^^^^^^^^^^ +error[E0552]: unrecognized representation hint + --> $DIR/packed-name-value.rs:9:8 + | +9 | #[repr(packed = "")] //~ ERROR E0552 + | ^^^^^^^^^^^ -error[E0693]: incorrect `repr(packed)` attribute format - --> tests/ui/pin_project/packed-name-value.rs:16:8 +error[E0552]: unrecognized representation hint + --> $DIR/packed-name-value.rs:14:8 | -16 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair - | ^^^^^^^^^^^ help: use parentheses instead: `packed()` - -error[E0693]: incorrect `repr(packed)` attribute format - --> tests/ui/pin_project/packed-name-value.rs:21:8 - | -21 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair - | ^^^^^^^^^^^ help: use parentheses instead: `packed()` +14 | #[repr(packed = "")] //~ ERROR E0552 + | ^^^^^^^^^^^ diff --git a/tests/ui/pin_project/packed.rs b/tests/ui/pin_project/packed.rs index dd3ebfd..f756605 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 Packed1 { +struct A { #[pin] f: u8, } @@ -10,22 +10,14 @@ struct Packed1 { // Test putting 'repr' before the 'pin_project' attribute #[repr(packed, C)] //~ ERROR may not be used on #[repr(packed)] types #[pin_project] -struct Packed2 { +struct B { #[pin] f: u8, } #[pin_project] #[repr(packed(2))] //~ ERROR may not be used on #[repr(packed)] types -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 { +struct C { #[pin] f: u32, } diff --git a/tests/ui/pin_project/packed.stderr b/tests/ui/pin_project/packed.stderr index 25ea5f4..969faea 100644 --- a/tests/ui/pin_project/packed.stderr +++ b/tests/ui/pin_project/packed.stderr @@ -1,23 +1,17 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/pin_project/packed.rs:4:8 + --> $DIR/packed.rs:4:8 | 4 | #[repr(packed, C)] //~ ERROR may not be used on #[repr(packed)] types | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/pin_project/packed.rs:11:8 + --> $DIR/packed.rs:11:8 | 11 | #[repr(packed, C)] //~ ERROR may not be used on #[repr(packed)] types | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/pin_project/packed.rs:19:8 + --> $DIR/packed.rs:19:8 | 19 | #[repr(packed(2))] //~ ERROR may not be used on #[repr(packed)] types | ^^^^^^^^^ - -error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/pin_project/packed.rs:26:8 - | -26 | #[repr(packed(2))] //~ ERROR may not be used on #[repr(packed)] types - | ^^^^^^^^^ diff --git a/tests/ui/pin_project/packed_sneaky-1.rs b/tests/ui/pin_project/packed_sneaky-1.rs index 72d3d3e..38f6fe0 100644 --- a/tests/ui/pin_project/packed_sneaky-1.rs +++ b/tests/ui/pin_project/packed_sneaky-1.rs @@ -1,7 +1,6 @@ -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 32fe407..510200e 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 - --> tests/ui/pin_project/packed_sneaky-1.rs:7:15 + --> $DIR/packed_sneaky-1.rs:6:15 | -7 | #[hidden_repr(packed)] +6 | #[hidden_repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/pin_project/packed_sneaky-1.rs:14:15 + --> $DIR/packed_sneaky-1.rs:13:15 | -14 | #[hidden_repr(packed)] +13 | #[hidden_repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/pin_project/packed_sneaky-1.rs:23:15 + --> $DIR/packed_sneaky-1.rs:22:15 | -23 | #[hidden_repr(packed)] +22 | #[hidden_repr(packed)] | ^^^^^^ diff --git a/tests/ui/pin_project/packed_sneaky-2.stderr b/tests/ui/pin_project/packed_sneaky-2.stderr index d643052..51987a2 100644 --- a/tests/ui/pin_project/packed_sneaky-2.stderr +++ b/tests/ui/pin_project/packed_sneaky-2.stderr @@ -1,5 +1,5 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> tests/ui/pin_project/packed_sneaky-2.rs:4:1 + --> $DIR/packed_sneaky-2.rs:4:1 | 4 | / hidden_repr_macro! { //~ ERROR may not be used on #[repr(packed)] types 5 | | #[pin_project] @@ -10,4 +10,4 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types 10 | | } | |_^ | - = note: this error originates in the macro `hidden_repr_macro` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pin_project/packed_sneaky-3.stderr b/tests/ui/pin_project/packed_sneaky-3.stderr index c97f18b..b953e9f 100644 --- a/tests/ui/pin_project/packed_sneaky-3.stderr +++ b/tests/ui/pin_project/packed_sneaky-3.stderr @@ -1,13 +1,13 @@ error: expected item after attributes - --> tests/ui/pin_project/packed_sneaky-3.rs:4:1 + --> $DIR/packed_sneaky-3.rs:4:1 | 4 | hidden_repr_macro! {} //~ ERROR expected item after attributes | ^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in the macro `hidden_repr_macro` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: expected item after attributes - --> tests/ui/pin_project/packed_sneaky-3.rs:13:9 + --> $DIR/packed_sneaky-3.rs:13:9 | 13 | #[repr(packed)] //~ ERROR expected item after attributes | ^^^^^^^^^^^^^^^ @@ -15,18 +15,18 @@ error: expected item after attributes 17 | hidden_repr_macro2! {} | ---------------------- in this macro invocation | - = note: this error originates in the macro `hidden_repr_macro2` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: expected item after attributes - --> tests/ui/pin_project/packed_sneaky-3.rs:24:10 + --> $DIR/packed_sneaky-3.rs:24:10 | 24 | #[derive(HiddenRepr)] //~ ERROR expected item after attributes | ^^^^^^^^^^ | - = note: this error originates in the derive macro `HiddenRepr` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: proc-macro derive produced unparseable tokens - --> tests/ui/pin_project/packed_sneaky-3.rs:24:10 + --> $DIR/packed_sneaky-3.rs:24:10 | 24 | #[derive(HiddenRepr)] //~ ERROR expected item after attributes | ^^^^^^^^^^ diff --git a/tests/ui/pin_project/private_in_public-enum.stderr b/tests/ui/pin_project/private_in_public-enum.stderr index c93b265..6e3316c 100644 --- a/tests/ui/pin_project/private_in_public-enum.stderr +++ b/tests/ui/pin_project/private_in_public-enum.stderr @@ -1,5 +1,5 @@ error[E0446]: private type `PrivateEnum` in public interface - --> tests/ui/pin_project/private_in_public-enum.rs:6:7 + --> $DIR/private_in_public-enum.rs:6:7 | 6 | V(PrivateEnum), //~ ERROR E0446 | ^^^^^^^^^^^ can't leak private type @@ -8,7 +8,7 @@ error[E0446]: private type `PrivateEnum` in public interface | ---------------- `PrivateEnum` declared as private error[E0446]: private type `foo::PrivateEnum` in public interface - --> tests/ui/pin_project/private_in_public-enum.rs:15:11 + --> $DIR/private_in_public-enum.rs:15:11 | 15 | V(PrivateEnum), //~ ERROR E0446 | ^^^^^^^^^^^ can't leak private type diff --git a/tests/ui/pin_project/project_replace_unsized.stderr b/tests/ui/pin_project/project_replace_unsized.stderr index 86cc148..26e416a 100644 --- a/tests/ui/pin_project/project_replace_unsized.stderr +++ b/tests/ui/pin_project/project_replace_unsized.stderr @@ -1,118 +1,72 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> tests/ui/pin_project/project_replace_unsized.rs:3:15 + --> $DIR/project_replace_unsized.rs:3:15 | 3 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 4 | struct Struct<T: ?Sized> { - | - this type parameter needs to be `std::marker::Sized` + | - this type parameter needs to be `Sized` | -note: required because it appears within the type `Struct<T>` - --> tests/ui/pin_project/project_replace_unsized.rs:4:8 - | -4 | struct Struct<T: ?Sized> { - | ^^^^^^ + = note: required because it appears within the type `Struct<T>` = help: unsized fn params are gated as an unstable feature -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -4 - struct Struct<T: ?Sized> { -4 + struct Struct<T> { - | help: function arguments must have a statically known size, borrowed types always have a known size | 3 | #[pin_project(&project_replace)] //~ ERROR E0277 - | + + | ^ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> tests/ui/pin_project/project_replace_unsized.rs:3:1 - | -3 | #[pin_project(project_replace)] //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time -4 | struct Struct<T: ?Sized> { - | - this type parameter needs to be `std::marker::Sized` - | -note: required because it appears within the type `Struct<T>` - --> tests/ui/pin_project/project_replace_unsized.rs:4:8 - | -4 | struct Struct<T: ?Sized> { - | ^^^^^^ -note: required by a bound in `UnsafeOverwriteGuard::<T>::new` - --> src/lib.rs - | - | impl<T> UnsafeOverwriteGuard<T> { - | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new` - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -4 - struct Struct<T: ?Sized> { -4 + struct Struct<T> { - | + --> $DIR/project_replace_unsized.rs:3:1 + | +3 | #[pin_project(project_replace)] //~ ERROR E0277 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time +4 | struct Struct<T: ?Sized> { + | - this type parameter needs to be `Sized` + | + = note: required because it appears within the type `Struct<T>` + = note: required by `UnsafeOverwriteGuard` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `T` cannot be known at compilation time - --> tests/ui/pin_project/project_replace_unsized.rs:5:5 + --> $DIR/project_replace_unsized.rs:5:5 | -3 | #[pin_project(project_replace)] //~ ERROR E0277 - | ------------------------------- required by a bound introduced by this call 4 | struct Struct<T: ?Sized> { - | - this type parameter needs to be `std::marker::Sized` + | - this type parameter needs to be `Sized` 5 | f: T, | ^ doesn't have a size known at compile-time - | -note: required by a bound in `std::ptr::read` - --> $RUST/core/src/ptr/mod.rs - | - | pub const unsafe fn read<T>(src: *const T) -> T { - | ^ required by this bound in `std::ptr::read` -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -4 - struct Struct<T: ?Sized> { -4 + struct Struct<T> { - | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> tests/ui/pin_project/project_replace_unsized.rs:8:15 + --> $DIR/project_replace_unsized.rs:8:15 | 8 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 9 | struct TupleStruct<T: ?Sized>(T); - | - this type parameter needs to be `std::marker::Sized` + | - this type parameter needs to be `Sized` | -note: required because it appears within the type `TupleStruct<T>` - --> tests/ui/pin_project/project_replace_unsized.rs:9:8 - | -9 | struct TupleStruct<T: ?Sized>(T); - | ^^^^^^^^^^^ + = note: required because it appears within the type `TupleStruct<T>` = help: unsized fn params are gated as an unstable feature -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -9 - struct TupleStruct<T: ?Sized>(T); -9 + struct TupleStruct<T>(T); - | help: function arguments must have a statically known size, borrowed types always have a known size | 8 | #[pin_project(&project_replace)] //~ ERROR E0277 - | + + | ^ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> tests/ui/pin_project/project_replace_unsized.rs:8:1 - | -8 | #[pin_project(project_replace)] //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time -9 | struct TupleStruct<T: ?Sized>(T); - | - this type parameter needs to be `std::marker::Sized` - | -note: required because it appears within the type `TupleStruct<T>` - --> tests/ui/pin_project/project_replace_unsized.rs:9:8 - | -9 | struct TupleStruct<T: ?Sized>(T); - | ^^^^^^^^^^^ -note: required by a bound in `UnsafeOverwriteGuard::<T>::new` - --> src/lib.rs - | - | impl<T> UnsafeOverwriteGuard<T> { - | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new` - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -9 - struct TupleStruct<T: ?Sized>(T); -9 + struct TupleStruct<T>(T); - | + --> $DIR/project_replace_unsized.rs:8:1 + | +8 | #[pin_project(project_replace)] //~ ERROR E0277 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time +9 | struct TupleStruct<T: ?Sized>(T); + | - this type parameter needs to be `Sized` + | + = note: required because it appears within the type `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) + +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/project_replace_unsized.rs:9:8 + | +9 | struct TupleStruct<T: ?Sized>(T); + | ^^^^^^^^^^^ - this type parameter needs to be `Sized` + | | + | doesn't have a size known at compile-time + | + = note: all function arguments must have a statically known size + = help: unsized fn params are gated as an unstable feature 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 e398ca4..f0f9573 100644 --- a/tests/ui/pin_project/project_replace_unsized_fn_params.stderr +++ b/tests/ui/pin_project/project_replace_unsized_fn_params.stderr @@ -1,112 +1,55 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:6:8 + --> $DIR/project_replace_unsized_fn_params.rs:6:8 | 6 | struct Struct<T: ?Sized> { | ^^^^^^^-^^^^^^^^^ | | | - | | this type parameter needs to be `std::marker::Sized` + | | this type parameter needs to be `Sized` | doesn't have a size known at compile-time | -note: required because it appears within the type `__StructProjectionOwned<T>` - --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:6:8 - | -6 | struct Struct<T: ?Sized> { - | ^^^^^^ + = note: required because it appears within the type `__StructProjectionOwned<T>` = note: the return type of a function must have a statically known size -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -6 - struct Struct<T: ?Sized> { -6 + struct Struct<T> { - | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:5:1 - | -5 | #[pin_project(project_replace)] //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time -6 | struct Struct<T: ?Sized> { - | - this type parameter needs to be `std::marker::Sized` - | -note: required because it appears within the type `Struct<T>` - --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:6:8 - | -6 | struct Struct<T: ?Sized> { - | ^^^^^^ -note: required by a bound in `UnsafeOverwriteGuard::<T>::new` - --> src/lib.rs - | - | impl<T> UnsafeOverwriteGuard<T> { - | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new` - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -6 - struct Struct<T: ?Sized> { -6 + struct Struct<T> { - | + --> $DIR/project_replace_unsized_fn_params.rs:5:1 + | +5 | #[pin_project(project_replace)] //~ ERROR E0277 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time +6 | struct Struct<T: ?Sized> { + | - this type parameter needs to be `Sized` + | + = note: required because it appears within the type `Struct<T>` + = note: required by `UnsafeOverwriteGuard` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `T` cannot be known at compilation time - --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:7:5 + --> $DIR/project_replace_unsized_fn_params.rs:7:5 | -5 | #[pin_project(project_replace)] //~ ERROR E0277 - | ------------------------------- required by a bound introduced by this call 6 | struct Struct<T: ?Sized> { - | - this type parameter needs to be `std::marker::Sized` + | - this type parameter needs to be `Sized` 7 | f: T, | ^ doesn't have a size known at compile-time - | -note: required by a bound in `std::ptr::read` - --> $RUST/core/src/ptr/mod.rs - | - | pub const unsafe fn read<T>(src: *const T) -> T { - | ^ required by this bound in `std::ptr::read` -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -6 - struct Struct<T: ?Sized> { -6 + struct Struct<T> { - | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:11:8 + --> $DIR/project_replace_unsized_fn_params.rs:11:8 | 11 | struct TupleStruct<T: ?Sized>(T); | ^^^^^^^^^^^^-^^^^^^^^^ | | | - | | this type parameter needs to be `std::marker::Sized` + | | this type parameter needs to be `Sized` | doesn't have a size known at compile-time | -note: required because it appears within the type `__TupleStructProjectionOwned<T>` - --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:11:8 - | -11 | struct TupleStruct<T: ?Sized>(T); - | ^^^^^^^^^^^ + = note: required because it appears within the type `__TupleStructProjectionOwned<T>` = note: the return type of a function must have a statically known size -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -11 - struct TupleStruct<T: ?Sized>(T); -11 + struct TupleStruct<T>(T); - | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:10:1 - | -10 | #[pin_project(project_replace)] //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time -11 | struct TupleStruct<T: ?Sized>(T); - | - this type parameter needs to be `std::marker::Sized` - | -note: required because it appears within the type `TupleStruct<T>` - --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:11:8 - | -11 | struct TupleStruct<T: ?Sized>(T); - | ^^^^^^^^^^^ -note: required by a bound in `UnsafeOverwriteGuard::<T>::new` - --> src/lib.rs - | - | impl<T> UnsafeOverwriteGuard<T> { - | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new` - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -11 - struct TupleStruct<T: ?Sized>(T); -11 + struct TupleStruct<T>(T); - | + --> $DIR/project_replace_unsized_fn_params.rs:10:1 + | +10 | #[pin_project(project_replace)] //~ ERROR E0277 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time +11 | struct TupleStruct<T: ?Sized>(T); + | - this type parameter needs to be `Sized` + | + = note: required because it appears within the type `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 fd14da3..bec8302 100644 --- a/tests/ui/pin_project/remove-attr-from-field.rs +++ b/tests/ui/pin_project/remove-attr-from-field.rs @@ -1,7 +1,6 @@ -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<T: Unpin>() {} diff --git a/tests/ui/pin_project/remove-attr-from-field.stderr b/tests/ui/pin_project/remove-attr-from-field.stderr index 697cd63..5d8caac 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 - --> tests/ui/pin_project/remove-attr-from-field.rs:28:38 + --> $DIR/remove-attr-from-field.rs:27:38 | -28 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 +27 | 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 - --> tests/ui/pin_project/remove-attr-from-field.rs:32:38 + --> $DIR/remove-attr-from-field.rs:31:38 | -32 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 +31 | 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 cbe5aba..0086cf9 100644 --- a/tests/ui/pin_project/remove-attr-from-struct.rs +++ b/tests/ui/pin_project/remove-attr-from-struct.rs @@ -1,7 +1,6 @@ -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<T: Unpin>() {} diff --git a/tests/ui/pin_project/remove-attr-from-struct.stderr b/tests/ui/pin_project/remove-attr-from-struct.stderr index 1a9cd42..4652b66 100644 --- a/tests/ui/pin_project/remove-attr-from-struct.stderr +++ b/tests/ui/pin_project/remove-attr-from-struct.stderr @@ -1,107 +1,71 @@ error: #[pin_project] attribute has been removed - --> tests/ui/pin_project/remove-attr-from-struct.rs:22:1 + --> $DIR/remove-attr-from-struct.rs:21:1 | -22 | #[pin_project] //~ ERROR has been removed +21 | #[pin_project] //~ ERROR has been removed | ^^^^^^^^^^^^^^ | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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 - --> tests/ui/pin_project/remove-attr-from-struct.rs:18:7 + --> $DIR/remove-attr-from-struct.rs:17:7 | -18 | #[pin] //~ ERROR cannot find attribute `pin` in this scope +17 | #[pin] //~ ERROR cannot find attribute `pin` in this scope | ^^^ error: cannot find attribute `pin` in this scope - --> tests/ui/pin_project/remove-attr-from-struct.rs:11:7 + --> $DIR/remove-attr-from-struct.rs:10:7 | -11 | #[pin] //~ ERROR cannot find attribute `pin` in this scope +10 | #[pin] //~ ERROR cannot find attribute `pin` in this scope | ^^^ error[E0277]: `PhantomPinned` cannot be unpinned - --> tests/ui/pin_project/remove-attr-from-struct.rs:35:5 + --> $DIR/remove-attr-from-struct.rs:34:5 | -35 | is_unpin::<A>(); //~ ERROR E0277 +5 | fn is_unpin<T: Unpin>() {} + | ----- required by this bound in `is_unpin` +... +34 | is_unpin::<A>(); //~ ERROR E0277 | ^^^^^^^^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: consider using `Box::pin` -note: required because it appears within the type `A` - --> tests/ui/pin_project/remove-attr-from-struct.rs:10:8 - | -10 | struct A { - | ^ -note: required by a bound in `is_unpin` - --> tests/ui/pin_project/remove-attr-from-struct.rs:6:16 - | -6 | fn is_unpin<T: Unpin>() {} - | ^^^^^ required by this bound in `is_unpin` + = note: required because it appears within the type `A` error[E0277]: `PhantomPinned` cannot be unpinned - --> tests/ui/pin_project/remove-attr-from-struct.rs:36:5 + --> $DIR/remove-attr-from-struct.rs:35:5 | -36 | is_unpin::<B>(); //~ ERROR E0277 +5 | fn is_unpin<T: Unpin>() {} + | ----- required by this bound in `is_unpin` +... +35 | is_unpin::<B>(); //~ ERROR E0277 | ^^^^^^^^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: consider using `Box::pin` -note: required because it appears within the type `B` - --> tests/ui/pin_project/remove-attr-from-struct.rs:17:8 - | -17 | struct B { - | ^ -note: required by a bound in `is_unpin` - --> tests/ui/pin_project/remove-attr-from-struct.rs:6:16 - | -6 | fn is_unpin<T: Unpin>() {} - | ^^^^^ required by this bound in `is_unpin` + = note: required because it appears within the type `B` error[E0277]: `PhantomPinned` cannot be unpinned - --> tests/ui/pin_project/remove-attr-from-struct.rs:40:22 - | -40 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 - | -------- ^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned` - | | - | required by a bound introduced by this call - | - = note: consider using `Box::pin` -note: required because it appears within the type `A` - --> tests/ui/pin_project/remove-attr-from-struct.rs:10:8 - | -10 | struct A { - | ^ -note: required by a bound in `Pin::<P>::new` - --> $RUST/core/src/pin.rs - | - | impl<P: Deref<Target: Unpin>> Pin<P> { - | ^^^^^ required by this bound in `Pin::<P>::new` + --> $DIR/remove-attr-from-struct.rs:39:13 + | +39 | 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: required by `Pin::<P>::new` error[E0599]: no method named `project` found for struct `Pin<&mut A>` in the current scope - --> tests/ui/pin_project/remove-attr-from-struct.rs:40:30 + --> $DIR/remove-attr-from-struct.rs:39:30 | -40 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 +39 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 | ^^^^^^^ method not found in `Pin<&mut A>` error[E0277]: `PhantomPinned` cannot be unpinned - --> tests/ui/pin_project/remove-attr-from-struct.rs:43:22 - | -43 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 - | -------- ^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned` - | | - | required by a bound introduced by this call - | - = note: consider using `Box::pin` -note: required because it appears within the type `B` - --> tests/ui/pin_project/remove-attr-from-struct.rs:17:8 - | -17 | struct B { - | ^ -note: required by a bound in `Pin::<P>::new` - --> $RUST/core/src/pin.rs - | - | impl<P: Deref<Target: Unpin>> Pin<P> { - | ^^^^^ required by this bound in `Pin::<P>::new` + --> $DIR/remove-attr-from-struct.rs:42:13 + | +42 | 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: required by `Pin::<P>::new` error[E0599]: no method named `project` found for struct `Pin<&mut B>` in the current scope - --> tests/ui/pin_project/remove-attr-from-struct.rs:43:30 + --> $DIR/remove-attr-from-struct.rs:42:30 | -43 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 +42 | 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 de8181c..db4ac2d 100644 --- a/tests/ui/pin_project/safe_packed_borrows.rs +++ b/tests/ui/pin_project/safe_packed_borrows.rs @@ -1,26 +1,21 @@ -#![deny(renamed_and_removed_lints)] -#![deny(safe_packed_borrows)] //~ ERROR has been renamed to `unaligned_references` -#![allow(unaligned_references)] +#![forbid(safe_packed_borrows)] -// 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 +// Refs: https://github.com/rust-lang/rust/issues/46043 #[repr(packed)] -struct Packed { +struct A { f: u32, } #[repr(packed(2))] -struct PackedN { +struct B { f: u32, } fn main() { - let a = Packed { f: 1 }; - let _ = &a.f; + let a = A { f: 1 }; + &a.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block - let b = PackedN { f: 1 }; - let _ = &b.f; + let b = B { f: 1 }; + &b.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block } diff --git a/tests/ui/pin_project/safe_packed_borrows.stderr b/tests/ui/pin_project/safe_packed_borrows.stderr index f483b6d..c1f734a 100644 --- a/tests/ui/pin_project/safe_packed_borrows.stderr +++ b/tests/ui/pin_project/safe_packed_borrows.stderr @@ -1,11 +1,24 @@ -error: lint `safe_packed_borrows` has been renamed to `unaligned_references` - --> tests/ui/pin_project/safe_packed_borrows.rs:2:9 - | -2 | #![deny(safe_packed_borrows)] //~ ERROR has been renamed to `unaligned_references` - | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `unaligned_references` - | +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 + | ^^^^ + | note: the lint level is defined here - --> tests/ui/pin_project/safe_packed_borrows.rs:1:9 - | -1 | #![deny(renamed_and_removed_lints)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + --> $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 <https://github.com/rust-lang/rust/issues/46043> + = note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior + +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 <https://github.com/rust-lang/rust/issues/46043> + = note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior diff --git a/tests/ui/pin_project/unaligned_references.rs b/tests/ui/pin_project/unaligned_references.rs deleted file mode 100644 index eaf185d..0000000 --- a/tests/ui/pin_project/unaligned_references.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![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 }; - let _ = &a.f; //~ ERROR reference to packed field is unaligned - - let b = PackedN { f: 1 }; - 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 deleted file mode 100644 index 8d5ddfc..0000000 --- a/tests/ui/pin_project/unaligned_references.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: reference to packed field is unaligned - --> tests/ui/pin_project/unaligned_references.rs:17:13 - | -17 | let _ = &a.f; //~ ERROR reference to packed field is unaligned - | ^^^^ - | -note: the lint level is defined here - --> tests/ui/pin_project/unaligned_references.rs:1:11 - | -1 | #![forbid(unaligned_references)] - | ^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) - -error: reference to packed field is unaligned - --> tests/ui/pin_project/unaligned_references.rs:20:13 - | -20 | let _ = &b.f; //~ ERROR reference to packed field is unaligned - | ^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) diff --git a/tests/ui/pin_project/unpin_sneaky.stderr b/tests/ui/pin_project/unpin_sneaky.stderr index ddf700d..ab5e794 100644 --- a/tests/ui/pin_project/unpin_sneaky.stderr +++ b/tests/ui/pin_project/unpin_sneaky.stderr @@ -1,11 +1,11 @@ error[E0412]: cannot find type `__S` in this scope - --> tests/ui/pin_project/unpin_sneaky.rs:9:16 + --> $DIR/unpin_sneaky.rs:9:16 | 9 | impl Unpin for __S {} //~ ERROR E0412,E0321 | ^^^ not found in this scope error[E0321]: cross-crate traits with a default impl, like `Unpin`, can only be implemented for a struct/enum type, not `[type error]` - --> tests/ui/pin_project/unpin_sneaky.rs:9:1 + --> $DIR/unpin_sneaky.rs:9:1 | 9 | impl Unpin for __S {} //~ ERROR E0412,E0321 | ^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type diff --git a/tests/ui/pin_project/visibility.stderr b/tests/ui/pin_project/visibility.stderr index 4d1b722..a1f0423 100644 --- a/tests/ui/pin_project/visibility.stderr +++ b/tests/ui/pin_project/visibility.stderr @@ -1,39 +1,39 @@ -error[E0365]: `DProj` is only public within the crate, and cannot be re-exported outside - --> tests/ui/pin_project/visibility.rs:15:13 +error[E0365]: `DProj` is private, and cannot be re-exported + --> $DIR/visibility.rs:15:13 | 15 | pub use crate::pub_::DProj; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^ re-export of crate public `DProj` + | ^^^^^^^^^^^^^^^^^^ re-export of private `DProj` | = note: consider declaring type or module `DProj` with `pub` -error[E0365]: `DProjRef` is only public within the crate, and cannot be re-exported outside - --> tests/ui/pin_project/visibility.rs:17:13 +error[E0365]: `DProjRef` is private, and cannot be re-exported + --> $DIR/visibility.rs:17:13 | 17 | pub use crate::pub_::DProjRef; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^ re-export of crate public `DProjRef` + | ^^^^^^^^^^^^^^^^^^^^^ re-export of private `DProjRef` | = note: consider declaring type or module `DProjRef` with `pub` -error[E0365]: `RProj` is only public within the crate, and cannot be re-exported outside - --> tests/ui/pin_project/visibility.rs:19:13 +error[E0365]: `RProj` is private, and cannot be re-exported + --> $DIR/visibility.rs:19:13 | 19 | pub use crate::pub_::RProj; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^ re-export of crate public `RProj` + | ^^^^^^^^^^^^^^^^^^ re-export of private `RProj` | = note: consider declaring type or module `RProj` with `pub` -error[E0365]: `RProjOwn` is only public within the crate, and cannot be re-exported outside - --> tests/ui/pin_project/visibility.rs:21:13 +error[E0365]: `RProjOwn` is private, and cannot be re-exported + --> $DIR/visibility.rs:21:13 | 21 | pub use crate::pub_::RProjOwn; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^ re-export of crate public `RProjOwn` + | ^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProjOwn` | = note: consider declaring type or module `RProjOwn` with `pub` -error[E0365]: `RProjRef` is only public within the crate, and cannot be re-exported outside - --> tests/ui/pin_project/visibility.rs:23:13 +error[E0365]: `RProjRef` is private, and cannot be re-exported + --> $DIR/visibility.rs:23:13 | 23 | pub use crate::pub_::RProjRef; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^ re-export of crate public `RProjRef` + | ^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProjRef` | = note: consider declaring type or module `RProjRef` with `pub` diff --git a/tests/ui/pinned_drop/call-drop-inner.rs b/tests/ui/pinned_drop/call-drop-inner.rs index 9f89942..4171ed5 100644 --- a/tests/ui/pinned_drop/call-drop-inner.rs +++ b/tests/ui/pinned_drop/call-drop-inner.rs @@ -1,6 +1,5 @@ -use std::pin::Pin; - use pin_project::{pin_project, pinned_drop}; +use std::pin::Pin; #[pin_project(PinnedDrop)] struct Struct { diff --git a/tests/ui/pinned_drop/call-drop-inner.stderr b/tests/ui/pinned_drop/call-drop-inner.stderr index b11bee5..53194b0 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 - --> tests/ui/pinned_drop/call-drop-inner.rs:13:9 + --> $DIR/call-drop-inner.rs:12:9 | -13 | __drop_inner(__self); +12 | __drop_inner(__self); | ^^^^^^^^^^^^ ------ supplied 1 argument | | | expected 0 arguments | note: function defined here - --> tests/ui/pinned_drop/call-drop-inner.rs:10:1 + --> $DIR/call-drop-inner.rs:9:1 | -10 | #[pinned_drop] +9 | #[pinned_drop] | ^^^^^^^^^^^^^^ - = note: this error originates in the attribute macro `pinned_drop` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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 23d756d..fecfd50 100644 --- a/tests/ui/pinned_drop/conditional-drop-impl.rs +++ b/tests/ui/pinned_drop/conditional-drop-impl.rs @@ -1,6 +1,5 @@ -use std::pin::Pin; - use pin_project::{pin_project, pinned_drop}; +use std::pin::Pin; // In `Drop` impl, the implementor must specify the same requirement as type definition. diff --git a/tests/ui/pinned_drop/conditional-drop-impl.stderr b/tests/ui/pinned_drop/conditional-drop-impl.stderr index 0c55bc2..6381a29 100644 --- a/tests/ui/pinned_drop/conditional-drop-impl.stderr +++ b/tests/ui/pinned_drop/conditional-drop-impl.stderr @@ -1,30 +1,26 @@ error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not - --> tests/ui/pinned_drop/conditional-drop-impl.rs:11:9 + --> $DIR/conditional-drop-impl.rs:10:9 | -11 | impl<T: Unpin> Drop for DropImpl<T> { +10 | impl<T: Unpin> Drop for DropImpl<T> { | ^^^^^ | note: the implementor must specify the same requirement - --> tests/ui/pinned_drop/conditional-drop-impl.rs:7:1 + --> $DIR/conditional-drop-impl.rs:6:1 | -7 | / struct DropImpl<T> { -8 | | f: T, -9 | | } +6 | / struct DropImpl<T> { +7 | | f: T, +8 | | } | |_^ error[E0277]: `T` cannot be unpinned - --> tests/ui/pinned_drop/conditional-drop-impl.rs:16:15 + --> $DIR/conditional-drop-impl.rs:15:15 | -16 | #[pin_project(PinnedDrop)] //~ ERROR E0277 +15 | #[pin_project(PinnedDrop)] //~ ERROR E0277 | ^^^^^^^^^^ the trait `Unpin` is not implemented for `T` | - = note: consider using `Box::pin` -note: required because of the requirements on the impl of `PinnedDrop` for `PinnedDropImpl<T>` - --> tests/ui/pinned_drop/conditional-drop-impl.rs:23:16 - | -23 | impl<T: Unpin> PinnedDrop for PinnedDropImpl<T> { - | ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ + = note: required because of the requirements on the impl of `PinnedDrop` for `PinnedDropImpl<T>` + = note: required by `pin_project::__private::PinnedDrop::drop` help: consider restricting type parameter `T` | -17 | struct PinnedDropImpl<T: std::marker::Unpin> { - | ++++++++++++++++++++ +16 | struct PinnedDropImpl<T: Unpin> { + | ^^^^^^^ diff --git a/tests/ui/pinned_drop/forget-pinned-drop-impl.stderr b/tests/ui/pinned_drop/forget-pinned-drop-impl.stderr index ef8a7bf..9fd7cdb 100644 --- a/tests/ui/pinned_drop/forget-pinned-drop-impl.stderr +++ b/tests/ui/pinned_drop/forget-pinned-drop-impl.stderr @@ -1,5 +1,7 @@ error[E0277]: the trait bound `Struct: PinnedDrop` is not satisfied - --> tests/ui/pinned_drop/forget-pinned-drop-impl.rs:3:15 + --> $DIR/forget-pinned-drop-impl.rs:3:15 | 3 | #[pin_project(PinnedDrop)] //~ ERROR E0277 | ^^^^^^^^^^ the trait `PinnedDrop` is not implemented for `Struct` + | + = note: required by `pin_project::__private::PinnedDrop::drop` diff --git a/tests/ui/pinned_drop/invalid-self.stderr b/tests/ui/pinned_drop/invalid-self.stderr index 464be5e..3248704 100644 --- a/tests/ui/pinned_drop/invalid-self.stderr +++ b/tests/ui/pinned_drop/invalid-self.stderr @@ -1,23 +1,23 @@ error: expected identifier, found keyword `self` - --> tests/ui/pinned_drop/invalid-self.rs:8:26 + --> $DIR/invalid-self.rs:8:26 | 8 | fn take_ref_self(ref self: Pin<&mut Self>) {} //~ ERROR expected identifier, found keyword `self` | ^^^^ expected identifier, found keyword error: expected identifier, found keyword `self` - --> tests/ui/pinned_drop/invalid-self.rs:9:34 + --> $DIR/invalid-self.rs:9:34 | 9 | fn take_ref_mut_self(ref mut self: Pin<&mut Self>) {} //~ ERROR expected identifier, found keyword `self` | ^^^^ expected identifier, found keyword error: expected parameter name, found `@` - --> tests/ui/pinned_drop/invalid-self.rs:11:25 + --> $DIR/invalid-self.rs:11:25 | 11 | fn self_subpat(self @ S {}: Self) {} //~ ERROR expected one of `)`, `,`, or `:`, found `@` | ^ expected parameter name error: expected one of `)`, `,`, or `:`, found `@` - --> tests/ui/pinned_drop/invalid-self.rs:11:25 + --> $DIR/invalid-self.rs:11:25 | 11 | fn self_subpat(self @ S {}: Self) {} //~ ERROR expected one of `)`, `,`, or `:`, found `@` | -^ expected one of `)`, `,`, or `:` diff --git a/tests/ui/pinned_drop/invalid.rs b/tests/ui/pinned_drop/invalid.rs index fdadf8a..7e36750 100644 --- a/tests/ui/pinned_drop/invalid.rs +++ b/tests/ui/pinned_drop/invalid.rs @@ -1,7 +1,6 @@ mod argument { - use std::pin::Pin; - use pin_project::{pin_project, pinned_drop}; + use std::pin::Pin; #[pin_project(PinnedDrop)] struct UnexpectedArg1(()); @@ -129,9 +128,8 @@ mod assoc_item { } mod method { - use std::pin::Pin; - use pin_project::{pin_project, pinned_drop}; + use std::pin::Pin; #[pin_project(PinnedDrop)] struct RetUnit(()); diff --git a/tests/ui/pinned_drop/invalid.stderr b/tests/ui/pinned_drop/invalid.stderr index d509964..277a2fa 100644 --- a/tests/ui/pinned_drop/invalid.stderr +++ b/tests/ui/pinned_drop/invalid.stderr @@ -1,143 +1,143 @@ -error: unexpected token: `foo` - --> tests/ui/pinned_drop/invalid.rs:9:19 +error: unexpected token: foo + --> $DIR/invalid.rs:8:19 | -9 | #[pinned_drop(foo)] //~ ERROR unexpected token +8 | #[pinned_drop(foo)] //~ ERROR unexpected token | ^^^ error: duplicate #[pinned_drop] attribute - --> tests/ui/pinned_drop/invalid.rs:30:5 + --> $DIR/invalid.rs:29:5 | -30 | #[pinned_drop] //~ ERROR duplicate #[pinned_drop] attribute +29 | #[pinned_drop] //~ ERROR duplicate #[pinned_drop] attribute | ^^^^^^^^^^^^^^ error: #[pinned_drop] may only be used on implementation for the `PinnedDrop` trait - --> tests/ui/pinned_drop/invalid.rs:43:10 + --> $DIR/invalid.rs:42:10 | -43 | impl Drop for TraitImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait +42 | 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 - --> tests/ui/pinned_drop/invalid.rs:49:10 + --> $DIR/invalid.rs:48:10 | -49 | impl InherentImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait +48 | impl InherentImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait | ^^^^^^^^^^^^ error: expected `impl` - --> tests/ui/pinned_drop/invalid.rs:52:5 + --> $DIR/invalid.rs:51:5 | -52 | fn func(_: Pin<&mut ()>) {} //~ ERROR expected `impl` +51 | fn func(_: Pin<&mut ()>) {} //~ ERROR expected `impl` | ^^ error: implementing the trait `PinnedDrop` is not unsafe - --> tests/ui/pinned_drop/invalid.rs:62:5 + --> $DIR/invalid.rs:61:5 | -62 | unsafe impl PinnedDrop for Impl { +61 | unsafe impl PinnedDrop for Impl { | ^^^^^^ error: implementing the method `drop` is not unsafe - --> tests/ui/pinned_drop/invalid.rs:72:9 + --> $DIR/invalid.rs:71:9 | -72 | unsafe fn drop(self: Pin<&mut Self>) {} //~ ERROR implementing the method `drop` is not unsafe +71 | unsafe fn drop(self: Pin<&mut Self>) {} //~ ERROR implementing the method `drop` is not unsafe | ^^^^^^ error: not all trait items implemented, missing: `drop` - --> tests/ui/pinned_drop/invalid.rs:83:5 + --> $DIR/invalid.rs:82:5 | -83 | impl PinnedDrop for Empty {} //~ ERROR not all trait items implemented, missing: `drop` +82 | impl PinnedDrop for Empty {} //~ ERROR not all trait items implemented, missing: `drop` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: const `A` is not a member of trait `PinnedDrop` - --> tests/ui/pinned_drop/invalid.rs:90:9 + --> $DIR/invalid.rs:89:9 | -90 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop` +89 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop` | ^^^^^^^^^^^^^^^^ error: const `A` is not a member of trait `PinnedDrop` - --> tests/ui/pinned_drop/invalid.rs:100:9 - | -100 | const A: u8 = 0; //~ 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` + | ^^^^^^^^^^^^^^^^ error: type `A` is not a member of trait `PinnedDrop` - --> tests/ui/pinned_drop/invalid.rs:108:9 + --> $DIR/invalid.rs:107:9 | -108 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop` +107 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop` | ^^^^^^^^^^^^ error: type `A` is not a member of trait `PinnedDrop` - --> tests/ui/pinned_drop/invalid.rs:118:9 + --> $DIR/invalid.rs:117:9 | -118 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop` +117 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop` | ^^^^^^^^^^^^ error: duplicate definitions with name `drop` - --> tests/ui/pinned_drop/invalid.rs:127:9 + --> $DIR/invalid.rs:126:9 | -127 | fn drop(self: Pin<&mut Self>) {} //~ ERROR duplicate definitions with name `drop` +126 | fn drop(self: Pin<&mut Self>) {} //~ ERROR duplicate definitions with name `drop` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: method `drop` must return the unit type - --> tests/ui/pinned_drop/invalid.rs:149:42 + --> $DIR/invalid.rs:147:42 | -149 | fn drop(self: Pin<&mut Self>) -> Self {} //~ ERROR method `drop` must return the unit type +147 | 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>` - --> tests/ui/pinned_drop/invalid.rs:157:16 + --> $DIR/invalid.rs:155:16 | -157 | fn drop() {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +155 | fn drop() {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` | ^^ error: method `drop` must take an argument `self: Pin<&mut Self>` - --> tests/ui/pinned_drop/invalid.rs:165:17 + --> $DIR/invalid.rs:163:17 | -165 | fn drop(self: Pin<&mut Self>, _: ()) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +163 | 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>` - --> tests/ui/pinned_drop/invalid.rs:173:17 + --> $DIR/invalid.rs:171:17 | -173 | fn drop(&mut self) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +171 | 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>` - --> tests/ui/pinned_drop/invalid.rs:181:17 + --> $DIR/invalid.rs:179:17 | -181 | fn drop(_: Pin<&mut Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +179 | 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>` - --> tests/ui/pinned_drop/invalid.rs:189:17 + --> $DIR/invalid.rs:187:17 | -189 | fn drop(self: Pin<&Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +187 | 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>` - --> tests/ui/pinned_drop/invalid.rs:197:17 + --> $DIR/invalid.rs:195:17 | -197 | fn drop(self: Pin<&mut ()>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +195 | 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 - --> tests/ui/pinned_drop/invalid.rs:205:12 + --> $DIR/invalid.rs:203:12 | -205 | fn pinned_drop(self: Pin<&mut Self>) {} //~ ERROR method `pinned_drop` is not a member of trait `PinnedDrop +203 | fn pinned_drop(self: Pin<&mut Self>) {} //~ ERROR method `pinned_drop` is not a member of trait `PinnedDrop | ^^^^^^^^^^^ error: implementing the trait `PinnedDrop` on this type is unsupported - --> tests/ui/pinned_drop/invalid.rs:213:25 + --> $DIR/invalid.rs:211:25 | -213 | impl PinnedDrop for () { +211 | impl PinnedDrop for () { | ^^ error: implementing the trait `PinnedDrop` on this type is unsupported - --> tests/ui/pinned_drop/invalid.rs:219:25 + --> $DIR/invalid.rs:217:25 | -219 | impl PinnedDrop for &mut A { +217 | impl PinnedDrop for &mut A { | ^^^^^^ error: implementing the trait `PinnedDrop` on this type is unsupported - --> tests/ui/pinned_drop/invalid.rs:225:25 + --> $DIR/invalid.rs:223:25 | -225 | impl PinnedDrop for [A] { +223 | 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 391f290..f9db79c 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,5 @@ -use std::pin::Pin; - use pin_project::{pin_project, pinned_drop}; +use std::pin::Pin; #[pin_project] struct S { 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 2542254..6f868bf 100644 --- a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr +++ b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr @@ -1,8 +1,8 @@ -error[E0119]: conflicting implementations of trait `_::_pin_project::__private::PinnedDrop` for type `S` - --> tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs:12:1 +error[E0119]: conflicting implementations of trait `pin_project::__private::PinnedDrop` for type `S`: + --> $DIR/pinned-drop-no-attr-arg.rs:11:1 | -5 | #[pin_project] +4 | #[pin_project] | -------------- first implementation here ... -12 | impl PinnedDrop for S { +11 | impl PinnedDrop for S { | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S` diff --git a/tests/ui/pinned_drop/self.rs b/tests/ui/pinned_drop/self.rs index ff63402..03825ca 100644 --- a/tests/ui/pinned_drop/self.rs +++ b/tests/ui/pinned_drop/self.rs @@ -1,7 +1,6 @@ pub mod self_in_macro_def { - use std::pin::Pin; - use pin_project::{pin_project, pinned_drop}; + use std::pin::Pin; #[pin_project(PinnedDrop)] pub struct S { @@ -24,9 +23,8 @@ pub mod self_in_macro_def { } pub mod self_span { - use std::pin::Pin; - use pin_project::{pin_project, pinned_drop}; + use std::pin::Pin; #[pin_project(PinnedDrop)] pub struct S { diff --git a/tests/ui/pinned_drop/self.stderr b/tests/ui/pinned_drop/self.stderr index 0f96dc9..edab117 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 - --> tests/ui/pinned_drop/self.rs:18:26 + --> $DIR/self.rs:17:26 | -18 | fn f(self: ()) {} //~ ERROR `self` parameter is only allowed in associated functions +17 | fn f(self: ()) {} //~ ERROR `self` parameter is only allowed in associated functions | ^^^^ not semantically valid as function parameter ... -21 | t!(); - | ---- in this macro invocation +20 | t!(); + | ----- in this macro invocation | = note: associated functions are those in `impl` or `trait` definitions - = note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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 - --> tests/ui/pinned_drop/self.rs:16:29 + --> $DIR/self.rs:15:29 | -16 | let _ = self; //~ ERROR E0434 +15 | let _ = self; //~ ERROR E0434 | ^^^^ ... -21 | t!(); - | ---- in this macro invocation +20 | t!(); + | ----- in this macro invocation | = help: use the `|| { ... }` closure form instead - = note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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` - --> tests/ui/pinned_drop/self.rs:40:27 + --> $DIR/self.rs:38:27 | -32 | / pub struct S { -33 | | f: (), -34 | | } +30 | / pub struct S { +31 | | f: (), +32 | | } | |_____- `S` defined here ... -40 | let _: Self = Self; //~ ERROR E0423 +38 | let _: Self = Self; //~ ERROR E0423 | ^^^^ help: use struct literal syntax instead: `S { f: val }` error[E0308]: mismatched types - --> tests/ui/pinned_drop/self.rs:39:25 + --> $DIR/self.rs:37:25 | -39 | let _: () = self; //~ ERROR E0308 +37 | 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 - --> tests/ui/pinned_drop/self.rs:52:25 + --> $DIR/self.rs:50:25 | -52 | let _: () = self; //~ ERROR E0308 +50 | 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` - --> tests/ui/pinned_drop/self.rs:53:27 + --> $DIR/self.rs:51:27 | -53 | let _: Self = Self::V; //~ ERROR E0533 +51 | 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 3ee2b56..7faf0fa 100644 --- a/tests/ui/pinned_drop/unsafe-call.rs +++ b/tests/ui/pinned_drop/unsafe-call.rs @@ -1,6 +1,5 @@ -use std::pin::Pin; - use pin_project::{pin_project, pinned_drop}; +use std::pin::Pin; #[pin_project(PinnedDrop)] struct S { diff --git a/tests/ui/pinned_drop/unsafe-call.stderr b/tests/ui/pinned_drop/unsafe-call.stderr index 9f7dd44..cd5e572 100644 --- a/tests/ui/pinned_drop/unsafe-call.stderr +++ b/tests/ui/pinned_drop/unsafe-call.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> tests/ui/pinned_drop/unsafe-call.rs:14:9 + --> $DIR/unsafe-call.rs:13:9 | -14 | self.project().f.get_unchecked_mut(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block [E0133] +13 | self.project().f.get_unchecked_mut(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block [E0133] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/tests/ui/unsafe_unpin/conflict-unpin.stderr b/tests/ui/unsafe_unpin/conflict-unpin.stderr index 20d4e08..916c3f2 100644 --- a/tests/ui/unsafe_unpin/conflict-unpin.stderr +++ b/tests/ui/unsafe_unpin/conflict-unpin.stderr @@ -1,5 +1,5 @@ -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>` - --> tests/ui/unsafe_unpin/conflict-unpin.rs:3:15 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`: + --> $DIR/conflict-unpin.rs:3:15 | 3 | #[pin_project(UnsafeUnpin)] //~ ERROR E0119 | ^^^^^^^^^^^ conflicting implementation for `Foo<_, _>` @@ -7,10 +7,10 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type 10 | impl<T, U> Unpin for Foo<T, U> where T: Unpin {} | --------------------------------------------- first implementation here | - = note: upstream crates may add a new impl of trait `_::_pin_project::UnsafeUnpin` for type `_::_pin_project::__private::Wrapper<'_, Foo<_, _>>` in future versions + = 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<_, _>` - --> tests/ui/unsafe_unpin/conflict-unpin.rs:12:15 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`: + --> $DIR/conflict-unpin.rs:12:15 | 12 | #[pin_project(UnsafeUnpin)] //~ ERROR E0119 | ^^^^^^^^^^^ conflicting implementation for `Bar<_, _>` @@ -18,10 +18,10 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type 19 | impl<T, U> Unpin for Bar<T, U> {} | ------------------------------ first implementation here | - = note: upstream crates may add a new impl of trait `_::_pin_project::UnsafeUnpin` for type `_::_pin_project::__private::Wrapper<'_, Bar<_, _>>` in future versions + = 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<_, _>` - --> tests/ui/unsafe_unpin/conflict-unpin.rs:21:15 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`: + --> $DIR/conflict-unpin.rs:21:15 | 21 | #[pin_project(UnsafeUnpin)] //~ ERROR E0119 | ^^^^^^^^^^^ conflicting implementation for `Baz<_, _>` @@ -29,4 +29,4 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type 28 | impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} | -------------------------------------------- first implementation here | - = note: upstream crates may add a new impl of trait `_::_pin_project::UnsafeUnpin` for type `_::_pin_project::__private::Wrapper<'_, Baz<_, _>>` in future versions + = note: upstream crates may add a new impl of trait `pin_project::UnsafeUnpin` for type `pin_project::__private::Wrapper<'_, Baz<_, _>>` in future versions 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 542250b..127cd1a 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,7 @@ // Note: If you change this test, change 'marker_trait_attr.rs' at the same time. -use std::marker::PhantomPinned; - use pin_project::pin_project; +use std::marker::PhantomPinned; #[pin_project] //~ ERROR E0119 struct Struct<T> { 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 3412f2e..bab534b 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<_>` - --> tests/ui/unstable-features/marker_trait_attr-feature-gate.rs:7:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`: + --> $DIR/marker_trait_attr-feature-gate.rs:6:1 | -7 | #[pin_project] //~ ERROR E0119 +6 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>` ... -14 | impl<T> Unpin for Struct<T> {} +13 | impl<T> Unpin for Struct<T> {} | --------------------------- first implementation here | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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 9c8e664..d6eab21 100644 --- a/tests/ui/unstable-features/marker_trait_attr.rs +++ b/tests/ui/unstable-features/marker_trait_attr.rs @@ -6,9 +6,8 @@ // See https://github.com/taiki-e/pin-project/issues/105#issuecomment-535355974 -use std::marker::PhantomPinned; - use pin_project::pin_project; +use std::marker::PhantomPinned; #[pin_project] //~ ERROR E0119 struct Struct<T> { diff --git a/tests/ui/unstable-features/marker_trait_attr.stderr b/tests/ui/unstable-features/marker_trait_attr.stderr index 2b68c80..9b3ec57 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<_>` - --> tests/ui/unstable-features/marker_trait_attr.rs:13:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`: + --> $DIR/marker_trait_attr.rs:12:1 | -13 | #[pin_project] //~ ERROR E0119 +12 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>` ... -20 | impl<T> Unpin for Struct<T> {} +19 | impl<T> Unpin for Struct<T> {} | --------------------------- first implementation here | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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 012c870..9d1b8b8 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,7 @@ // Note: If you change this test, change 'overlapping_marker_traits.rs' at the same time. -use std::marker::PhantomPinned; - use pin_project::pin_project; +use std::marker::PhantomPinned; #[pin_project] //~ ERROR E0119 struct Struct<T> { 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 918d804..4a8e238 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<_>` - --> tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs:7:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`: + --> $DIR/overlapping_marker_traits-feature-gate.rs:6:1 | -7 | #[pin_project] //~ ERROR E0119 +6 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>` ... -14 | impl<T> Unpin for Struct<T> {} +13 | impl<T> Unpin for Struct<T> {} | --------------------------- first implementation here | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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 8dc27c1..0e0cddd 100644 --- a/tests/ui/unstable-features/overlapping_marker_traits.rs +++ b/tests/ui/unstable-features/overlapping_marker_traits.rs @@ -3,16 +3,15 @@ // 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 std::marker::PhantomPinned; - use pin_project::pin_project; +use std::marker::PhantomPinned; #[pin_project] struct Struct<T> { diff --git a/tests/ui/unstable-features/overlapping_marker_traits.stderr b/tests/ui/unstable-features/overlapping_marker_traits.stderr index 3e8411d..91aaf6c 100644 --- a/tests/ui/unstable-features/overlapping_marker_traits.stderr +++ b/tests/ui/unstable-features/overlapping_marker_traits.stderr @@ -1,18 +1,18 @@ error[E0557]: feature has been removed - --> tests/ui/unstable-features/overlapping_marker_traits.rs:11:12 + --> $DIR/overlapping_marker_traits.rs:11:12 | 11 | #![feature(overlapping_marker_traits)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ 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<_>` - --> tests/ui/unstable-features/overlapping_marker_traits.rs:17:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`: + --> $DIR/overlapping_marker_traits.rs:16:1 | -17 | #[pin_project] +16 | #[pin_project] | ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>` ... -24 | impl<T> Unpin for Struct<T> {} +23 | impl<T> Unpin for Struct<T> {} | --------------------------- first implementation here | - = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) + = 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.rs b/tests/ui/unstable-features/trivial_bounds-bug.rs new file mode 100644 index 0000000..5e821c4 --- /dev/null +++ b/tests/ui/unstable-features/trivial_bounds-bug.rs @@ -0,0 +1,33 @@ +// Note: If you change this test, change 'trivial_bounds-feature-gate.rs' at the same time. + +// trivial_bounds +// Tracking issue: https://github.com/rust-lang/rust/issues/48214 +#![feature(trivial_bounds)] + +mod phantom_pinned { + use std::marker::{PhantomData, PhantomPinned}; + + struct A(PhantomPinned); + + // bug of trivial_bounds? + impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 + + struct Wrapper<T>(T); + + impl<T> Unpin for Wrapper<T> where T: Unpin {} + + struct B(PhantomPinned); + + impl Unpin for B where Wrapper<PhantomPinned>: Unpin {} // Ok + + struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T); + + impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {} + + struct C(PhantomPinned); + + // Ok + impl<'a> Unpin for C where WrapperWithLifetime<'a, PhantomPinned>: Unpin {} +} + +fn main() {} diff --git a/tests/ui/unstable-features/trivial_bounds-bug.stderr b/tests/ui/unstable-features/trivial_bounds-bug.stderr new file mode 100644 index 0000000..fff09f9 --- /dev/null +++ b/tests/ui/unstable-features/trivial_bounds-bug.stderr @@ -0,0 +1,5 @@ +error[E0277]: `PhantomPinned` cannot be unpinned + --> $DIR/trivial_bounds-bug.rs:13:43 + | +13 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 + | ^^^^^ the trait `Unpin` is not implemented for `PhantomPinned` diff --git a/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr b/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr index 2e31658..dd151b0 100644 --- a/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr +++ b/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr @@ -1,59 +1,45 @@ error[E0277]: `PhantomPinned` cannot be unpinned - --> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:8:28 + --> $DIR/trivial_bounds-feature-gate.rs:8:5 | 8 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `PhantomPinned` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 error[E0277]: `PhantomPinned` cannot be unpinned - --> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:16:28 + --> $DIR/trivial_bounds-feature-gate.rs:8:43 + | +8 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 + | ^^^^^ the trait `Unpin` is not implemented for `PhantomPinned` + +error[E0277]: `PhantomPinned` cannot be unpinned + --> $DIR/trivial_bounds-feature-gate.rs:16:5 | 16 | impl Unpin for B where Wrapper<PhantomPinned>: Unpin {} //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `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<PhantomPinned>` - --> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:12:13 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `PhantomPinned` | -12 | impl<T> Unpin for Wrapper<T> where T: Unpin {} - | ^^^^^ ^^^^^^^^^^ + = note: required because of the requirements on the impl of `Unpin` for `phantom_pinned::Wrapper<PhantomPinned>` = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: `PhantomPinned` cannot be unpinned - --> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:34:28 + --> $DIR/trivial_bounds-feature-gate.rs:34:5 | 34 | impl Unpin for A where Inner: Unpin {} //~ ERROR E0277 - | ^^^^^^^^^^^^ within `Inner`, the trait `Unpin` is not implemented for `PhantomPinned` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `Inner`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: consider using `Box::pin` -note: required because it appears within the type `Inner` - --> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:30:12 - | -30 | struct Inner(PhantomPinned); - | ^^^^^ + = note: required because it appears within the type `Inner` = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: `PhantomPinned` cannot be unpinned - --> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:42:28 + --> $DIR/trivial_bounds-feature-gate.rs:42:5 | 42 | impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^ within `Inner`, the trait `Unpin` is not implemented for `PhantomPinned` - | - = note: consider using `Box::pin` -note: required because it appears within the type `Inner` - --> tests/ui/unstable-features/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<Inner>` - --> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:38:13 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `Inner`, the trait `Unpin` is not implemented for `PhantomPinned` | -38 | impl<T> Unpin for Wrapper<T> where T: Unpin {} - | ^^^^^ ^^^^^^^^^^ + = note: required because it appears within the type `Inner` + = note: required because of the requirements on the impl of `Unpin` for `inner::Wrapper<Inner>` = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable diff --git a/tests/ui/unstable-features/trivial_bounds.rs b/tests/ui/unstable-features/trivial_bounds.rs index 41f885d..2323bab 100644 --- a/tests/ui/unstable-features/trivial_bounds.rs +++ b/tests/ui/unstable-features/trivial_bounds.rs @@ -10,29 +10,25 @@ use std::marker::{PhantomData, PhantomPinned}; fn inner() { struct Inner(PhantomPinned); - struct A(PhantomPinned); + struct A(Inner); - impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters - - struct B(Inner); - - impl Unpin for B where Inner: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters + impl Unpin for A where Inner: Unpin {} //~ ERROR std::marker::Unpin does not depend on any type or lifetime parameters struct Wrapper<T>(T); impl<T> Unpin for Wrapper<T> where T: Unpin {} - struct C(Inner); + struct B(Inner); - impl Unpin for C where Wrapper<Inner>: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters + impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR std::marker::Unpin does not depend on any type or lifetime parameters struct WrapperWithLifetime<'a, T>(PhantomData<&'a ()>, T); impl<T> Unpin for WrapperWithLifetime<'_, T> where T: Unpin {} - struct D(Inner); + struct C(Inner); - impl<'a> Unpin for D where WrapperWithLifetime<'a, Inner>: Unpin {} // Ok + impl<'a> Unpin for C where WrapperWithLifetime<'a, Inner>: Unpin {} // Ok } fn main() {} diff --git a/tests/ui/unstable-features/trivial_bounds.stderr b/tests/ui/unstable-features/trivial_bounds.stderr index 23f45c7..6a3bb94 100644 --- a/tests/ui/unstable-features/trivial_bounds.stderr +++ b/tests/ui/unstable-features/trivial_bounds.stderr @@ -1,23 +1,17 @@ -error: trait bound PhantomPinned: Unpin does not depend on any type or lifetime parameters - --> tests/ui/unstable-features/trivial_bounds.rs:15:43 +error: Trait bound Inner: Unpin does not depend on any type or lifetime parameters + --> $DIR/trivial_bounds.rs:15:35 | -15 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters - | ^^^^^ +15 | impl Unpin for A where Inner: Unpin {} //~ ERROR std::marker::Unpin does not depend on any type or lifetime parameters + | ^^^^^ | note: the lint level is defined here - --> tests/ui/unstable-features/trivial_bounds.rs:6:9 + --> $DIR/trivial_bounds.rs:6:9 | 6 | #![deny(trivial_bounds)] | ^^^^^^^^^^^^^^ -error: trait bound Inner: Unpin does not depend on any type or lifetime parameters - --> tests/ui/unstable-features/trivial_bounds.rs:19:35 - | -19 | impl Unpin for B where Inner: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters - | ^^^^^ - -error: trait bound Wrapper<Inner>: Unpin does not depend on any type or lifetime parameters - --> tests/ui/unstable-features/trivial_bounds.rs:27:44 +error: Trait bound Wrapper<Inner>: Unpin does not depend on any type or lifetime parameters + --> $DIR/trivial_bounds.rs:23:44 | -27 | impl Unpin for C where Wrapper<Inner>: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters +23 | impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR std::marker::Unpin does not depend on any type or lifetime parameters | ^^^^^ |