diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-10 07:02:38 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-10 07:02:38 +0000 |
commit | afd1e3e7cf5474be91c34da65edfb1e4edd01677 (patch) | |
tree | 80c46c7f97eb0158db00b2c4710dd54073c36733 | |
parent | 97a2c271155cd6741cfdd59484a6a8ab0d04fb78 (diff) | |
parent | 1b1144c17aba196c4ca53e7596a708d993479b39 (diff) | |
download | pin-project-aml_per_331115020.tar.gz |
Snap for 8564071 from 1b1144c17aba196c4ca53e7596a708d993479b39 to mainline-permission-releaseaml_per_331913010aml_per_331812030aml_per_331710050aml_per_331611010aml_per_331512020aml_per_331411000aml_per_331313010aml_per_331115020aml_per_331019040aml_per_330912010aml_per_330811030android13-mainline-permission-release
Change-Id: I33638b544ee1b5d2fb9f4c876b64af86ac38fb38
137 files changed, 2111 insertions, 2135 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 6cfdedc..9e9e67a 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,6 @@ { "git": { - "sha1": "a51d39fcdb31fe78cc61c0053ead2beb65a4156d" - } -} + "sha1": "0273e6ecd64057f47c3b2ada6fb4e5c37357c185" + }, + "path_in_vcs": "" +}
\ No newline at end of file @@ -41,6 +41,8 @@ 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"], @@ -49,10 +51,3 @@ 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 a9b56e1..ebac043 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,29 @@ 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) @@ -32,10 +50,14 @@ 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: @@ -71,7 +93,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 @@ -106,37 +128,63 @@ 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 -- Update minimal version of `syn` to 1.0.44 +**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. ## [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. @@ -166,6 +214,8 @@ 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. @@ -177,7 +227,7 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project } ``` -- [Makes `project_replace` argument an alias for `Replace` argument so that it can be used without a value.](https://github.com/taiki-e/pin-project/pull/243) +- [Make `project_replace` argument an alias for `Replace` argument so that it can be used without a value.](https://github.com/taiki-e/pin-project/pull/243) ```rust #[pin_project(project_replace)] @@ -192,10 +242,14 @@ 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) @@ -206,6 +260,8 @@ 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: @@ -227,15 +283,21 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.16] - 2020-05-11 -- [Fixed an issue that users can call internal function generated by `#[pinned_drop]`.](https://github.com/taiki-e/pin-project/pull/223) +**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) ## [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 -- [Added `!Unpin` option to `#[pin_project]` attribute for guarantee the type is `!Unpin`.](https://github.com/taiki-e/pin-project/pull/219) +**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) ```rust #[pin_project(!Unpin)] @@ -255,9 +317,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)* -- [Fixed an issue where duplicate `#[project]` attributes were ignored.](https://github.com/taiki-e/pin-project/pull/218) +- [Fix an issue where duplicate `#[project]` attributes were ignored.](https://github.com/taiki-e/pin-project/pull/218) - [Suppress `single_use_lifetimes` lint in generated code.](https://github.com/taiki-e/pin-project/pull/217) @@ -269,11 +331,13 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.13] - 2020-05-07 -- [Fixed a regression in 0.4.11.](https://github.com/taiki-e/pin-project/pull/207) +**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) Changes from [0.4.10](https://github.com/taiki-e/pin-project/releases/tag/v0.4.10) and [0.4.12](https://github.com/taiki-e/pin-project/releases/tag/v0.4.12): - - [Fixed an issue that `#[project]` on non-statement expression does not work without unstable features.](https://github.com/taiki-e/pin-project/pull/197) + - [Fix an issue that `#[project]` on non-statement expression does not work without unstable features.](https://github.com/taiki-e/pin-project/pull/197) - [Support overwriting the name of core crate.](https://github.com/taiki-e/pin-project/pull/199) @@ -285,13 +349,15 @@ 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. -- [Fixed an issue that `#[project]` on non-statement expression does not work without unstable features.](https://github.com/taiki-e/pin-project/pull/197) +- [Fix an issue that `#[project]` on non-statement expression does not work without unstable features.](https://github.com/taiki-e/pin-project/pull/197) - [Support overwriting the name of core crate.](https://github.com/taiki-e/pin-project/pull/199) @@ -303,71 +369,85 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project ## [0.4.10] - 2020-05-04 -- [Added `project_replace` method and `#[project_replace]` attribute.](https://github.com/taiki-e/pin-project/pull/194) +**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) `project_replace` method is optional and can be enabled by passing the `Replace` argument to `#[pin_project]` attribute. See [the documentation](https://docs.rs/pin-project/0.4/pin_project/attr.pin_project.html#project_replace) for more details. - [Support `Self` and `self` in more syntax positions inside `#[pinned_drop]` impl.](https://github.com/taiki-e/pin-project/pull/190) -- [Hided all generated items except for projected types from calling code.](https://github.com/taiki-e/pin-project/pull/192) See [#192](https://github.com/taiki-e/pin-project/pull/192) for details. +- [Hide all generated items except for projected types from calling code.](https://github.com/taiki-e/pin-project/pull/192) See [#192](https://github.com/taiki-e/pin-project/pull/192) for details. ## [0.4.9] - 2020-04-14 -- [Fixed lifetime inference error when associated types are used in fields.](https://github.com/taiki-e/pin-project/pull/188) +**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 compile error with tuple structs with `where` clauses.](https://github.com/taiki-e/pin-project/pull/186) +- [Fix compile error with tuple structs with `where` clauses.](https://github.com/taiki-e/pin-project/pull/186) - [`#[project]` attribute can now be used for `if let` expressions.](https://github.com/taiki-e/pin-project/pull/181) ## [0.4.8] - 2020-01-27 -- [Ensured that users cannot implement `PinnedDrop` without proper attribute argument.](https://github.com/taiki-e/pin-project/pull/180) +**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). -- [Fixed use of `Self` in expression position inside `#[pinned_drop]` impl.](https://github.com/taiki-e/pin-project/pull/177) +- [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) ## [0.4.7] - 2020-01-20 -- [Fixed support for lifetime bounds.](https://github.com/taiki-e/pin-project/pull/176) +**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) ## [0.4.6] - 2019-11-20 -- [Fixed compile error when there is `Self` in the where clause.](https://github.com/taiki-e/pin-project/pull/169) +**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) ## [0.4.5] - 2019-10-21 -- [Fixed compile error with `dyn` types.](https://github.com/taiki-e/pin-project/pull/158) +**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) ## [0.4.4] - 2019-10-17 -- [Fixed an issue where `PinnedDrop` implementations can call unsafe code without an unsafe block.](https://github.com/taiki-e/pin-project/pull/149) +**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) ## [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) -- [Fixed support for DSTs(Dynamically Sized Types) on `#[pin_project(UnsafeUnpin)]`](https://github.com/taiki-e/pin-project/pull/120) +- [Fix support for DSTs(Dynamically Sized Types) on `#[pin_project(UnsafeUnpin)]`](https://github.com/taiki-e/pin-project/pull/120) - Diagnostic improvements. ## [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. -- [Fixed support for DSTs(Dynamically Sized Types).](https://github.com/taiki-e/pin-project/pull/113) +- [Fix support for DSTs(Dynamically Sized Types).](https://github.com/taiki-e/pin-project/pull/113) ## [0.4.1] - 2019-09-26 -**Note: This release has been yanked.** See [#148](https://github.com/taiki-e/pin-project/pull/148) for details. +**NOTE:** This release has been yanked. See [#148](https://github.com/taiki-e/pin-project/pull/148) for details. -- [Fixed an issue that caused an error when using `#[pin_project]` on a type that has `#[pin]` + `!Unpin` field with no generics or lifetime.](https://github.com/taiki-e/pin-project/pull/111) +- [Fix an issue that caused an error when using `#[pin_project]` on a type that has `#[pin]` + `!Unpin` field with no generics or lifetime.](https://github.com/taiki-e/pin-project/pull/111) ## [0.4.0] - 2019-09-25 -**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. @@ -385,11 +465,11 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project - [`#[pin_project]` can now interoperate with `#[cfg()]`.](https://github.com/taiki-e/pin-project/pull/77) -- [Added `project_ref` method to `#[pin_project]` types.](https://github.com/taiki-e/pin-project/pull/93) +- [Add `project_ref` method to `#[pin_project]` types.](https://github.com/taiki-e/pin-project/pull/93) -- [Added `#[project_ref]` attribute.](https://github.com/taiki-e/pin-project/pull/93) +- [Add `#[project_ref]` attribute.](https://github.com/taiki-e/pin-project/pull/93) -- [Removed "project_attr" feature and always enable `#[project]` attribute.](https://github.com/taiki-e/pin-project/pull/94) +- [Remove "project_attr" feature and always enable `#[project]` attribute.](https://github.com/taiki-e/pin-project/pull/94) - [`#[project]` attribute can now be used for `impl` blocks.](https://github.com/taiki-e/pin-project/pull/46) @@ -399,25 +479,25 @@ See also [tracking issue for 1.0 release](https://github.com/taiki-e/pin-project Changes since the 0.4.0-beta.1 release: -- [Fixed an issue that caused an error when using `#[pin_project(UnsafeUnpin)]` and not providing a manual `UnsafeUnpin` implementation on a type with no generics or lifetime.](https://github.com/taiki-e/pin-project/pull/107) +- [Fix an issue that caused an error when using `#[pin_project(UnsafeUnpin)]` and not providing a manual `UnsafeUnpin` implementation on a type with no generics or lifetime.](https://github.com/taiki-e/pin-project/pull/107) ## [0.4.0-beta.1] - 2019-09-21 -- [Changed the argument type of project method back to `self: Pin<&mut Self>`.](https://github.com/taiki-e/pin-project/pull/90) +- [Change the argument type of project method back to `self: Pin<&mut Self>`.](https://github.com/taiki-e/pin-project/pull/90) -- [Removed "project_attr" feature and always enable `#[project]` attribute.](https://github.com/taiki-e/pin-project/pull/94) +- [Remove "project_attr" feature and always enable `#[project]` attribute.](https://github.com/taiki-e/pin-project/pull/94) -- [Removed "renamed" feature.](https://github.com/taiki-e/pin-project/pull/100) +- [Remove "renamed" feature.](https://github.com/taiki-e/pin-project/pull/100) - [`#[project]` attribute can now be used for `use` statements.](https://github.com/taiki-e/pin-project/pull/85) -- [Added `project_ref` method and `#[project_ref]` attribute.](https://github.com/taiki-e/pin-project/pull/93) +- [Add `project_ref` method and `#[project_ref]` attribute.](https://github.com/taiki-e/pin-project/pull/93) - [`#[pin_project]` attribute now determines the visibility of the projection type/method is based on the original type.](https://github.com/taiki-e/pin-project/pull/96) ## [0.4.0-alpha.11] - 2019-09-11 -- [Changed #[pinned_drop] to trait implementation.](https://github.com/taiki-e/pin-project/pull/86) +- [Change #[pinned_drop] to trait implementation.](https://github.com/taiki-e/pin-project/pull/86) ```rust #[pinned_drop] @@ -428,7 +508,7 @@ Changes since the 0.4.0-beta.1 release: } ``` -- Added some examples and generated code. +- Add some examples and generated code. - Diagnostic improvements. @@ -440,7 +520,7 @@ Changes since the 0.4.0-beta.1 release: ## [0.4.0-alpha.9] - 2019-09-05 -- [Added 'project_into' method to `#[pin_project]` types](https://github.com/taiki-e/pin-project/pull/69). This can be useful when returning a pin projection from a method. +- [Add `project_into` method to `#[pin_project]` types](https://github.com/taiki-e/pin-project/pull/69). This can be useful when returning a pin projection from a method. ```rust fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T> { @@ -448,11 +528,11 @@ Changes since the 0.4.0-beta.1 release: } ``` -- [Prevented UnpinStruct from appearing in the document by default.](https://github.com/taiki-e/pin-project/pull/71) See [#71](https://github.com/taiki-e/pin-project/pull/71) for more details. +- [Prevent `UnpinStruct` from appearing in the document by default.](https://github.com/taiki-e/pin-project/pull/71) See [#71](https://github.com/taiki-e/pin-project/pull/71) for more details. ## [0.4.0-alpha.8] - 2019-09-03 -- [Improved document of generated code.](https://github.com/taiki-e/pin-project/pull/62). Also added an option to control the document of generated code. See [#62](https://github.com/taiki-e/pin-project/pull/62) for more details. +- [Improve document of generated code.](https://github.com/taiki-e/pin-project/pull/62). Also added an option to control the document of generated code. See [#62](https://github.com/taiki-e/pin-project/pull/62) for more details. - [Diagnostic improvements.](https://github.com/taiki-e/pin-project/pull/61) @@ -462,7 +542,7 @@ Changes since the 0.4.0-beta.1 release: ## [0.4.0-alpha.6] - 2019-09-01 -- [Allowed using `#[pin_project]` type with private field types](https://github.com/taiki-e/pin-project/pull/53) +- [Allow using `#[pin_project]` type with private field types](https://github.com/taiki-e/pin-project/pull/53) ## [0.4.0-alpha.5] - 2019-08-24 @@ -474,7 +554,7 @@ Changes since the 0.4.0-beta.1 release: ## [0.4.0-alpha.3] - 2019-08-23 -- [Changed `project` method generated by `#[pin_project]` attribute to take an `&mut Pin<&mut Self>` argument.](https://github.com/taiki-e/pin-project/pull/47) +- [Change `project` method generated by `#[pin_project]` attribute to take an `&mut Pin<&mut Self>` argument.](https://github.com/taiki-e/pin-project/pull/47) - [`#[project]` attribute can now be used for impl blocks.](https://github.com/taiki-e/pin-project/pull/46) @@ -482,7 +562,7 @@ Changes since the 0.4.0-beta.1 release: ## [0.4.0-alpha.2] - 2019-08-13 -- Updated `proc-macro2`, `syn`, and `quote` to 1.0. +- Update `proc-macro2`, `syn`, and `quote` to 1.0. ## [0.4.0-alpha.1] - 2019-08-11 @@ -496,13 +576,13 @@ Changes since the 0.4.0-beta.1 release: - `Unpin` impls must be specified with an impl of `UnsafeUnpin`, instead of implementing the normal `Unpin` trait. -- Made `#[project]` attribute disabled by default. +- Make `#[project]` attribute disabled by default. See also [tracking issue for 0.4 release](https://github.com/taiki-e/pin-project/issues/21). ## [0.3.5] - 2019-08-14 -- Updated `proc-macro2`, `syn`, and `quote` to 1.0. +- Update `proc-macro2`, `syn`, and `quote` to 1.0. ## [0.3.4] - 2019-07-21 @@ -510,69 +590,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 -- Avoided suffixes on tuple index. +- Avoid suffixes on tuple index. ## [0.3.1] - 2019-03-02 - Documentation improvements. -- Updated minimum `syn` version to 0.15.22. +- Update minimum `syn` version to 0.15.22. ## [0.3.0] - 2019-02-20 -- Removed `unsafe_fields` attribute. +- Remove `unsafe_fields` attribute. -- Removed `unsafe_variants` attribute. +- Remove `unsafe_variants` attribute. ## [0.2.2] - 2019-02-20 -- Fixed a bug that generates incorrect code for the some structures with trait bounds on type generics. +- Fix a bug that generates incorrect code for the some structures with trait bounds on type generics. ## [0.2.1] - 2019-02-20 -- Fixed a bug that generates incorrect code for the structures with where clause and associated type fields. +- Fix a bug that generates incorrect code for the structures with where clause and associated type fields. ## [0.2.0] - 2019-02-11 -- Made `unsafe_fields` optional. +- Make `unsafe_fields` optional. - Documentation improvements. ## [0.1.8] - 2019-02-02 -- Added the feature to create projected enums to `unsafe_project`. +- Add the feature to create projected enums to `unsafe_project`. -- Added `project` attribute to support pattern matching. +- Add `project` attribute to support pattern matching. ## [0.1.7] - 2019-01-19 -- Fixed documentation. +- Fix documentation. ## [0.1.6] - 2019-01-19 - `unsafe_fields` can now opt-out. -- Added `unsafe_variants` attribute. This attribute is available if pin-project is built with the "unsafe_variants" feature. +- Add `unsafe_variants` attribute. This attribute is available if pin-project is built with the "unsafe_variants" feature. ## [0.1.5] - 2019-01-17 -- Added support for tuple struct to `unsafe_project`. +- Add support for tuple struct to `unsafe_project`. ## [0.1.4] - 2019-01-12 -- Added options for automatically implementing `Unpin` to both `unsafe_project` and `unsafe_fields`. +- Add options for automatically implementing `Unpin` to both `unsafe_project` and `unsafe_fields`. ## [0.1.3] - 2019-01-11 -- Fixed dependencies. +- Fix dependencies. -- Added `unsafe_fields` attribute. +- Add `unsafe_fields` attribute. ## [0.1.2] - 2019-01-09 @@ -580,15 +660,19 @@ See also [tracking issue for 0.4 release](https://github.com/taiki-e/pin-project ## [0.1.1] - 2019-01-08 -- Renamed from `unsafe_pin_project` to `unsafe_project`. +- Rename from `unsafe_pin_project` to `unsafe_project`. ## [0.1.0] - 2019-01-08 -**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.6...HEAD +[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 [1.0.6]: https://github.com/taiki-e/pin-project/compare/v1.0.5...v1.0.6 [1.0.5]: https://github.com/taiki-e/pin-project/compare/v1.0.4...v1.0.5 [1.0.4]: https://github.com/taiki-e/pin-project/compare/v1.0.3...v1.0.4 @@ -597,6 +681,8 @@ 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,21 +3,19 @@ # 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 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) +# 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. [package] edition = "2018" +rust-version = "1.37" name = "pin-project" -version = "1.0.6" -authors = ["Taiki Endo <te316e89@gmail.com>"] +version = "1.0.10" 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" @@ -25,8 +23,7 @@ repository = "https://github.com/taiki-e/pin-project" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies.pin-project-internal] -version = "=1.0.6" -default-features = false +version = "=1.0.10" [dev-dependencies.macrotest] version = "1.0.8" @@ -37,4 +34,4 @@ version = "1" version = "1" [dev-dependencies.trybuild] -version = "1" +version = "1.0.49" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index ef46030..120858b 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,11 +1,10 @@ [package] name = "pin-project" -version = "1.0.6" -authors = ["Taiki Endo <te316e89@gmail.com>"] +version = "1.0.10" 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"] @@ -27,11 +26,11 @@ members = [ ] [dependencies] -pin-project-internal = { version = "=1.0.6", path = "pin-project-internal", default-features = false } +pin-project-internal = { version = "=1.0.10", path = "pin-project-internal" } [dev-dependencies] pin-project-auxiliary-macro = { path = "tests/auxiliary/macro" } macrotest = "1.0.8" rustversion = "1" static_assertions = "1" -trybuild = "1" +trybuild = "1.0.49" @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/pin-project/pin-project-1.0.6.crate" + value: "https://static.crates.io/crates/pin-project/pin-project-1.0.10.crate" } - version: "1.0.6" + version: "1.0.10" license_type: NOTICE last_upgrade_date { - year: 2021 - month: 4 + year: 2022 + month: 3 day: 1 } } diff --git a/TEST_MAPPING b/TEST_MAPPING deleted file mode 100644 index 7e10dd0..0000000 --- a/TEST_MAPPING +++ /dev/null @@ -1,8 +0,0 @@ -// 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 2153592..459ca39 100644 --- a/examples/enum-default-expanded.rs +++ b/examples/enum-default-expanded.rs @@ -15,7 +15,11 @@ // ``` #![allow(dead_code, unused_imports, unused_parens, unknown_lints, renamed_and_removed_lints)] -#![allow(clippy::needless_lifetimes, clippy::just_underscores_and_digits)] +#![allow( + clippy::needless_lifetimes, + clippy::just_underscores_and_digits, + clippy::used_underscore_binding +)] use pin_project::pin_project; diff --git a/examples/not_unpin-expanded.rs b/examples/not_unpin-expanded.rs index aa5209d..5700c12 100644 --- a/examples/not_unpin-expanded.rs +++ b/examples/not_unpin-expanded.rs @@ -76,7 +76,7 @@ const _: () = { // // See ./struct-default-expanded.rs and https://github.com/taiki-e/pin-project/pull/34 // for details. - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed<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 48eb7fc..82207b6 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)] +#![allow(clippy::needless_lifetimes, clippy::mut_mut)] 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(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed<'a, T>(this: &Struct<'a, T>) { let _ = &this.was_dropped; let _ = &this.field; @@ -135,6 +135,7 @@ const _: () = { // Users can implement [`Drop`] safely using `#[pinned_drop]` and can drop a // type that implements `PinnedDrop` using the [`drop`] function safely. // **Do not call or implement this trait directly.** +#[doc(hidden)] impl<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 4f43bda..445e570 100644 --- a/examples/project_replace-expanded.rs +++ b/examples/project_replace-expanded.rs @@ -79,10 +79,8 @@ 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 { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; + let __guard = + ::pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); let Self { pinned, unpinned } = &mut *__self_ptr; @@ -98,7 +96,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(pinned); + let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard::new(pinned); } // Finally, return the result @@ -112,7 +110,7 @@ const _: () = { // // See ./struct-default-expanded.rs and https://github.com/taiki-e/pin-project/pull/34 // for details. - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed<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 3d0e4ab..d661099 100644 --- a/examples/struct-default-expanded.rs +++ b/examples/struct-default-expanded.rs @@ -71,10 +71,8 @@ const _: () = { // Ensure that it's impossible to use pin projections on a #[repr(packed)] // struct. // - // Taking a reference to a packed field is unsafe, and applying - // #[forbid(safe_packed_borrows)] makes sure that doing this without - // an 'unsafe' block (which we deliberately do not generate) - // is a hard error. + // Taking a reference to a packed field is UB, and applying + // `#[forbid(unaligned_references)]` makes sure that doing this is a hard error. // // If the struct ends up having #[repr(packed)] applied somehow, // this will generate an (unfriendly) error message. Under all reasonable @@ -82,7 +80,7 @@ const _: () = { // a much nicer error above. // // See https://github.com/taiki-e/pin-project/pull/34 for more details. - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed<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 2ea1f37..e9c7abc 100644 --- a/examples/unsafe_unpin-expanded.rs +++ b/examples/unsafe_unpin-expanded.rs @@ -75,7 +75,7 @@ const _: () = { // // See ./struct-default-expanded.rs and https://github.com/taiki-e/pin-project/pull/34 // for details. - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned; let _ = &this.unpinned; @@ -74,9 +74,8 @@ allow(dead_code, unused_variables) ) ))] -#![warn(future_incompatible, rust_2018_idioms, single_use_lifetimes, unreachable_pub)] -#![warn(missing_docs)] -#![warn(clippy::all, clippy::default_trait_access)] +#![warn(missing_docs, rust_2018_idioms, single_use_lifetimes, unreachable_pub)] +#![warn(clippy::default_trait_access, clippy::wildcard_imports)] #![allow(clippy::needless_doctest_main)] // ANDROID: Use std to allow building as a dylib. @@ -92,6 +91,8 @@ 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. @@ -150,10 +151,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, @@ -257,7 +258,14 @@ pub mod __private { // This is an internal helper used to ensure a value is dropped. #[doc(hidden)] - pub struct UnsafeDropInPlaceGuard<T: ?Sized>(pub *mut T); + pub struct UnsafeDropInPlaceGuard<T: ?Sized>(*mut T); + + impl<T: ?Sized> UnsafeDropInPlaceGuard<T> { + #[doc(hidden)] + pub unsafe fn new(ptr: *mut T) -> Self { + Self(ptr) + } + } impl<T: ?Sized> Drop for UnsafeDropInPlaceGuard<T> { fn drop(&mut self) { @@ -271,8 +279,15 @@ pub mod __private { // its destructor being called. #[doc(hidden)] pub struct UnsafeOverwriteGuard<T> { - pub value: ManuallyDrop<T>, - pub target: *mut 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) } + } } impl<T> Drop for UnsafeOverwriteGuard<T> { diff --git a/src/lib.rs.orig b/src/lib.rs.orig deleted file mode 100644 index 24cd303..0000000 --- a/src/lib.rs.orig +++ /dev/null @@ -1,282 +0,0 @@ -//! A crate for safe and ergonomic [pin-projection]. -//! -//! # Examples -//! -//! [`#[pin_project]`][`pin_project`] attribute creates projection types -//! covering all the fields of struct or enum. -//! -//! ```rust -//! use std::pin::Pin; -//! -//! use pin_project::pin_project; -//! -//! #[pin_project] -//! struct Struct<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 new file mode 100644 index 0000000..b109e71 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,44 @@ +# 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 b06cb02..70d2358 100644 --- a/tests/compiletest.rs +++ b/tests/compiletest.rs @@ -3,7 +3,7 @@ use std::env; -#[rustversion::attr(before(2021-02-07), ignore)] // Note: This date is commit-date and the day before the toolchain date. +#[rustversion::attr(not(nightly), ignore)] #[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 deleted file mode 100644 index e3e708d..0000000 --- a/tests/expand/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# 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 e042f8c..a3b0338 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,21 +61,26 @@ 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, } @@ -83,16 +88,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, } @@ -101,32 +106,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 2528ece..3089a54 100644 --- a/tests/expand/default/struct.expanded.rs +++ b/tests/expand/default/struct.expanded.rs @@ -13,20 +13,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] - #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -34,17 +30,8 @@ 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, @@ -54,61 +41,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 3e8e306..cc9b75e 100644 --- a/tests/expand/default/tuple_struct.expanded.rs +++ b/tests/expand/default/tuple_struct.expanded.rs @@ -9,37 +9,24 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[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), @@ -48,55 +35,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 4c935d7..fd31201 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,6 +78,7 @@ 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)] @@ -104,12 +105,17 @@ 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() { @@ -119,14 +125,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, ), @@ -136,7 +142,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() { @@ -146,14 +152,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, ), @@ -162,15 +168,13 @@ 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 { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; + let __guard = + _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); match &mut *__self_ptr { Self::Struct { pinned1, @@ -179,27 +183,29 @@ 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(pinned2); - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned1); + let __guard = + _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned2); + let __guard = + _pin_project::__private::UnsafeDropInPlaceGuard::new(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(_1); - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_1); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); } __result } @@ -214,11 +220,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, @@ -226,22 +232,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 17dab6a..7ed1f3e 100644 --- a/tests/expand/multifields/struct.expanded.rs +++ b/tests/expand/multifields/struct.expanded.rs @@ -16,20 +16,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] - #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -39,17 +35,8 @@ 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, @@ -59,14 +46,6 @@ 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>, @@ -76,7 +55,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 { @@ -86,8 +65,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, } @@ -95,7 +74,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 { @@ -105,23 +84,21 @@ 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 { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; + let __guard = + _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __replacement); let Self { pinned1, pinned2, @@ -129,20 +106,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(pinned2); - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(pinned1); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned2); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned1); } __result } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { let _ = &this.pinned1; let _ = &this.pinned2; @@ -151,32 +128,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 28e7fd8..351c084 100644 --- a/tests/expand/multifields/tuple_struct.expanded.rs +++ b/tests/expand/multifields/tuple_struct.expanded.rs @@ -9,20 +9,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[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)>, @@ -31,17 +27,8 @@ 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)>, @@ -50,14 +37,6 @@ 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>, @@ -67,13 +46,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, ) @@ -81,44 +60,42 @@ 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 { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; + let __guard = + _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __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(_1); - let __guard = ::pin_project::__private::UnsafeDropInPlaceGuard(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_1); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); } __result } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, safe_packed_borrows)] fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { let _ = &this.0; let _ = &this.1; @@ -127,32 +104,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 561bb89..7259a13 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,6 +61,7 @@ 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)] @@ -80,19 +81,24 @@ 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, } @@ -100,49 +106,48 @@ 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 { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; + let __guard = + _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __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(pinned); + let __guard = + _pin_project::__private::UnsafeDropInPlaceGuard::new(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(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); } __result } @@ -157,32 +162,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 3489c6e..09271fd 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,19 +39,24 @@ 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, } @@ -60,32 +65,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 a33491e..54cd1f8 100644 --- a/tests/expand/naming/enum-none.expanded.rs +++ b/tests/expand/naming/enum-none.expanded.rs @@ -17,38 +17,43 @@ 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 6ca558b..19ec570 100644 --- a/tests/expand/naming/enum-own.expanded.rs +++ b/tests/expand/naming/enum-own.expanded.rs @@ -17,6 +17,7 @@ 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)] @@ -36,38 +37,42 @@ 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 { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; + let __guard = + _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __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(pinned); + let __guard = + _pin_project::__private::UnsafeDropInPlaceGuard::new(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(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); } __result } @@ -82,32 +87,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 0dcb829..4565d08 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,22 +39,27 @@ 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, } @@ -63,32 +68,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 6506928..4b46e34 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,6 +49,7 @@ 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>, @@ -62,85 +63,88 @@ 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 { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; + let __guard = + _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __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(pinned); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned); } __result } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, 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 53c5212..5803d6b 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,20 +31,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::ref_option_ref)] - #[allow(clippy::type_repetition_in_bounds)] struct __StructProjectionRef<'pin, T, U> where Struct<T, U>: 'pin, @@ -53,60 +49,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 2528ece..3089a54 100644 --- a/tests/expand/naming/struct-none.expanded.rs +++ b/tests/expand/naming/struct-none.expanded.rs @@ -13,20 +13,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] - #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -34,17 +30,8 @@ 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, @@ -54,61 +41,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 0c1fc76..d05c7d6 100644 --- a/tests/expand/naming/struct-own.expanded.rs +++ b/tests/expand/naming/struct-own.expanded.rs @@ -13,6 +13,7 @@ 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>, @@ -26,20 +27,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] - #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -47,17 +44,8 @@ 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, @@ -67,82 +55,80 @@ 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 { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; + let __guard = + _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __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(pinned); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned); } __result } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, 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 3f52ac5..c131ec4 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,20 +31,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] - #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -54,61 +50,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 325b9db..042a798 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,6 +37,7 @@ 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)] @@ -47,79 +48,82 @@ 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 { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; + let __guard = + _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __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(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); } __result } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, 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 8cbb11f..60218d6 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,20 +23,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[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), @@ -44,54 +40,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 3e8e306..cc9b75e 100644 --- a/tests/expand/naming/tuple_struct-none.expanded.rs +++ b/tests/expand/naming/tuple_struct-none.expanded.rs @@ -9,37 +9,24 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[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), @@ -48,55 +35,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 84bc14b..21e12de 100644 --- a/tests/expand/naming/tuple_struct-own.expanded.rs +++ b/tests/expand/naming/tuple_struct-own.expanded.rs @@ -9,6 +9,7 @@ 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)] @@ -19,37 +20,24 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[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), @@ -58,76 +46,74 @@ 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 { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; + let __guard = + _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __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(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); } __result } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, 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 587d741..ea11b6a 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,20 +23,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[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), @@ -45,55 +41,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 6305b78..5173b54 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,21 +61,26 @@ 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, } @@ -83,40 +88,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 efa660f..e9d8922 100644 --- a/tests/expand/not_unpin/struct.expanded.rs +++ b/tests/expand/not_unpin/struct.expanded.rs @@ -13,20 +13,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] - #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -34,17 +30,8 @@ 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, @@ -54,52 +41,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 89a257e..cefb61d 100644 --- a/tests/expand/not_unpin/tuple_struct.expanded.rs +++ b/tests/expand/not_unpin/tuple_struct.expanded.rs @@ -9,37 +9,24 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[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), @@ -48,46 +35,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 c8eb0e4..e1bc486 100644 --- a/tests/expand/pinned_drop/enum.expanded.rs +++ b/tests/expand/pinned_drop/enum.expanded.rs @@ -1,5 +1,5 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; # [pin (__private (PinnedDrop , project = EnumProj , project_ref = EnumProjRef))] enum Enum<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,21 +62,26 @@ 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, } @@ -84,16 +89,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, } @@ -102,34 +107,35 @@ 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 f5b8aa4..c162ef6 100644 --- a/tests/expand/pinned_drop/enum.rs +++ b/tests/expand/pinned_drop/enum.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop, project = EnumProj, project_ref = EnumProjRef)] enum Enum<T, U> { Struct { diff --git a/tests/expand/pinned_drop/struct.expanded.rs b/tests/expand/pinned_drop/struct.expanded.rs index 9d7f489..2227442 100644 --- a/tests/expand/pinned_drop/struct.expanded.rs +++ b/tests/expand/pinned_drop/struct.expanded.rs @@ -1,5 +1,5 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; #[pin(__private(PinnedDrop))] struct Struct<T, U> { #[pin] @@ -14,20 +14,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] - #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -35,17 +31,8 @@ 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,63 +42,64 @@ 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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 948e6cc..691d3cb 100644 --- a/tests/expand/pinned_drop/struct.rs +++ b/tests/expand/pinned_drop/struct.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] struct Struct<T, U> { #[pin] diff --git a/tests/expand/pinned_drop/tuple_struct.expanded.rs b/tests/expand/pinned_drop/tuple_struct.expanded.rs index b30ee66..8c7433e 100644 --- a/tests/expand/pinned_drop/tuple_struct.expanded.rs +++ b/tests/expand/pinned_drop/tuple_struct.expanded.rs @@ -1,5 +1,5 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; #[pin(__private(PinnedDrop))] struct TupleStruct<T, U>(#[pin] T, U); #[allow(box_pointers)] @@ -10,37 +10,24 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[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), @@ -49,57 +36,58 @@ 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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 a536039..1f4917c 100644 --- a/tests/expand/pinned_drop/tuple_struct.rs +++ b/tests/expand/pinned_drop/tuple_struct.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] struct TupleStruct<T, U>(#[pin] T, U); diff --git a/tests/expand/project_replace/enum.expanded.rs b/tests/expand/project_replace/enum.expanded.rs index 304e0a7..d2b2094 100644 --- a/tests/expand/project_replace/enum.expanded.rs +++ b/tests/expand/project_replace/enum.expanded.rs @@ -17,6 +17,7 @@ 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)] @@ -36,38 +37,42 @@ 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 { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; + let __guard = + _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __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(pinned); + let __guard = + _pin_project::__private::UnsafeDropInPlaceGuard::new(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(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); } __result } @@ -82,32 +87,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 476c0ab..aa5fd54 100644 --- a/tests/expand/project_replace/struct.expanded.rs +++ b/tests/expand/project_replace/struct.expanded.rs @@ -13,20 +13,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] - #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -34,17 +30,8 @@ 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, @@ -52,14 +39,6 @@ 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>, @@ -67,82 +46,80 @@ 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 { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; + let __guard = + _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __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(pinned); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(pinned); } __result } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, 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 0026a9f..529f0b2 100644 --- a/tests/expand/project_replace/tuple_struct.expanded.rs +++ b/tests/expand/project_replace/tuple_struct.expanded.rs @@ -9,125 +9,102 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[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 { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; + let __guard = + _pin_project::__private::UnsafeOverwriteGuard::new(__self_ptr, __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(_0); + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new(_0); } __result } } } - #[forbid(safe_packed_borrows)] + #[forbid(unaligned_references, 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 5026bad..530eca9 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,21 +61,26 @@ 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, } @@ -83,16 +88,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, } @@ -101,32 +106,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 246d9b6..71ae3a3 100644 --- a/tests/expand/pub/struct.expanded.rs +++ b/tests/expand/pub/struct.expanded.rs @@ -13,20 +13,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[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, @@ -34,17 +30,8 @@ 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, @@ -54,61 +41,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 033fbaf..02c3f24 100644 --- a/tests/expand/pub/tuple_struct.expanded.rs +++ b/tests/expand/pub/tuple_struct.expanded.rs @@ -9,37 +9,24 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[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), @@ -48,55 +35,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 df962d0..3d53a1e 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,21 +61,26 @@ 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, } @@ -83,33 +88,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 4066d49..a866ab3 100644 --- a/tests/expand/unsafe_unpin/struct.expanded.rs +++ b/tests/expand/unsafe_unpin/struct.expanded.rs @@ -13,20 +13,16 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[allow(dead_code)] #[allow(clippy::mut_mut)] - #[allow(clippy::type_repetition_in_bounds)] struct __StructProjection<'pin, T, U> where Struct<T, U>: 'pin, @@ -34,17 +30,8 @@ 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, @@ -54,45 +41,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 59a40da..1a41976 100644 --- a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs +++ b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs @@ -9,37 +9,24 @@ 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(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(unused_extern_crates)] + extern crate pin_project as _pin_project; #[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), @@ -48,39 +35,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(safe_packed_borrows)] + #[forbid(unaligned_references, 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 adf8dde..3f0d5c1 100644 --- a/tests/expandtest.rs +++ b/tests/expandtest.rs @@ -6,6 +6,8 @@ use std::{ process::{Command, ExitStatus, Stdio}, }; +const PATH: &str = "tests/expand/**/*.rs"; + #[rustversion::attr(not(nightly), ignore)] #[test] fn expandtest() { @@ -13,17 +15,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 path = "tests/expand/*/*.rs"; + let args = &["--all-features"]; if is_ci { - macrotest::expand_without_refresh(path); + macrotest::expand_without_refresh_args(PATH, args); } else { env::set_var("MACROTEST", "overwrite"); - macrotest::expand(path); + macrotest::expand_args(PATH, args); } } diff --git a/tests/lint.rs b/tests/lint.rs index e7aee5a..6a75461 100644 --- a/tests/lint.rs +++ b/tests/lint.rs @@ -1,14 +1,21 @@ +// 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)] -#![allow(unknown_lints)] // for old compilers +#![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 #![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, @@ -20,27 +27,17 @@ 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 )] -// 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)] +#![warn(clippy::all, clippy::pedantic, clippy::nursery, 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"); @@ -776,7 +773,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 { @@ -799,7 +796,7 @@ pub mod single_use_lifetimes { for<'pin, 'pin_, 'pin__> &'pin &'pin_ &'pin__ T: Unpin, { #[pin] - f: &'pin___ mut T, + _f: &'pin___ mut T, } }; } @@ -1081,6 +1078,45 @@ 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 c6aaf94..aa08056 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,6 +723,7 @@ fn parse_self() { type Assoc; } + #[allow(clippy::type_repetition_in_bounds)] #[pin_project(project_replace)] pub struct Generics<T: Trait<Assoc = Self>> where @@ -846,7 +847,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 9e7287d..99273c4 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>) { - let _ = mac!({ + 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 = (); + type Assoc2 = u8; const ASSOC2: usize = 2; fn assoc2() {} } @@ -262,3 +262,23 @@ 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 a0d8bdc..be7cab9 100644 --- a/tests/repr_packed.rs +++ b/tests/repr_packed.rs @@ -1,5 +1,8 @@ #![warn(rust_2018_idioms, single_use_lifetimes)] -#![forbid(safe_packed_borrows)] +// unaligned_references did not exist in older compilers and safe_packed_borrows was removed in the latest compilers. +// https://github.com/rust-lang/rust/pull/82525 +#![allow(unknown_lints, renamed_and_removed_lints)] +#![forbid(unaligned_references, safe_packed_borrows)] use std::cell::Cell; @@ -30,7 +33,7 @@ fn weird_repr_packed() { fn drop(&mut self) { FIELD_ADDR.with(|f| { f.set(&self.field as *const u8 as usize); - }) + }); } } @@ -45,5 +48,5 @@ fn weird_repr_packed() { let field_addr = &x.field as *const u8 as usize; field_addr }; - assert_eq!(field_addr, FIELD_ADDR.with(|f| f.get())); + assert_eq!(field_addr, FIELD_ADDR.with(Cell::get)); } diff --git a/tests/ui/cfg/cfg_attr-resolve.stderr b/tests/ui/cfg/cfg_attr-resolve.stderr index 12bcc67..0393c14 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 - --> $DIR/cfg_attr-resolve.rs:10:30 + --> tests/ui/cfg/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 b075af9..1b9664b 100644 --- a/tests/ui/cfg/cfg_attr-type-mismatch.rs +++ b/tests/ui/cfg/cfg_attr-type-mismatch.rs @@ -1,6 +1,7 @@ -use pin_project::pin_project; use std::pin::Pin; +use pin_project::pin_project; + #[cfg_attr(not(any()), pin_project)] struct Foo<T> { #[cfg_attr(any(), pin)] diff --git a/tests/ui/cfg/cfg_attr-type-mismatch.stderr b/tests/ui/cfg/cfg_attr-type-mismatch.stderr index 89172a2..366d9c7 100644 --- a/tests/ui/cfg/cfg_attr-type-mismatch.stderr +++ b/tests/ui/cfg/cfg_attr-type-mismatch.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types - --> $DIR/cfg_attr-type-mismatch.rs:19:27 + --> tests/ui/cfg/cfg_attr-type-mismatch.rs:20:27 | -19 | let _: Pin<&mut u8> = x.f; //~ ERROR E0308 +20 | let _: Pin<&mut u8> = x.f; //~ ERROR E0308 | ------------ ^^^ expected struct `Pin`, found `&mut u8` | | | expected due to this @@ -10,9 +10,9 @@ error[E0308]: mismatched types found mutable reference `&mut u8` error[E0308]: mismatched types - --> $DIR/cfg_attr-type-mismatch.rs:23:22 + --> tests/ui/cfg/cfg_attr-type-mismatch.rs:24:22 | -23 | let _: &mut u8 = x.f; //~ ERROR E0308 +24 | let _: &mut u8 = x.f; //~ ERROR E0308 | ------- ^^^ | | | | | expected `&mut u8`, found struct `Pin` diff --git a/tests/ui/cfg/packed_sneaky-span-issue-1.rs b/tests/ui/cfg/packed_sneaky-span-issue-1.rs index 42f57b5..7e19952 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-1.rs +++ b/tests/ui/cfg/packed_sneaky-span-issue-1.rs @@ -2,9 +2,8 @@ use auxiliary_macro::hidden_repr; use pin_project::pin_project; #[pin_project] -#[hidden_repr(packed)] +#[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types struct S { - //~^ ERROR may not be used on #[repr(packed)] types #[cfg(not(any()))] #[pin] f: u32, diff --git a/tests/ui/cfg/packed_sneaky-span-issue-1.stderr b/tests/ui/cfg/packed_sneaky-span-issue-1.stderr index abe3ecd..4f3acc3 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-1.stderr +++ b/tests/ui/cfg/packed_sneaky-span-issue-1.stderr @@ -1,11 +1,5 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-span-issue-1.rs:6:1 - | -6 | / struct S { -7 | | //~^ ERROR may not be used on #[repr(packed)] types -8 | | #[cfg(not(any()))] -9 | | #[pin] -... | -13 | | f: u8, -14 | | } - | |_^ + --> tests/ui/cfg/packed_sneaky-span-issue-1.rs:5:15 + | +5 | #[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types + | ^^^^^^ diff --git a/tests/ui/cfg/packed_sneaky-span-issue-2.rs b/tests/ui/cfg/packed_sneaky-span-issue-2.rs index 948d72c..fcea76b 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-2.rs +++ b/tests/ui/cfg/packed_sneaky-span-issue-2.rs @@ -2,9 +2,8 @@ use auxiliary_macro::hidden_repr; use pin_project::pin_project; #[pin_project] -#[hidden_repr(packed)] +#[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types struct S { - //~^ ERROR may not be used on #[repr(packed)] types #[cfg(any())] #[pin] f: u32, diff --git a/tests/ui/cfg/packed_sneaky-span-issue-2.stderr b/tests/ui/cfg/packed_sneaky-span-issue-2.stderr index a957ceb..cc2795a 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-2.stderr +++ b/tests/ui/cfg/packed_sneaky-span-issue-2.stderr @@ -1,11 +1,5 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-span-issue-2.rs:6:1 - | -6 | / struct S { -7 | | //~^ ERROR may not be used on #[repr(packed)] types -8 | | #[cfg(any())] -9 | | #[pin] -... | -13 | | f: u8, -14 | | } - | |_^ + --> tests/ui/cfg/packed_sneaky-span-issue-2.rs:5:15 + | +5 | #[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types + | ^^^^^^ diff --git a/tests/ui/cfg/packed_sneaky.stderr b/tests/ui/cfg/packed_sneaky.stderr index b0d4d93..a54c2ec 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 - --> $DIR/packed_sneaky.rs:6:27 + --> tests/ui/cfg/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 b3bd1ae..e1c871c 100644 --- a/tests/ui/cfg/unsupported.stderr +++ b/tests/ui/cfg/unsupported.stderr @@ -1,7 +1,8 @@ error: #[pin_project] attribute may not be used on structs with zero fields - --> $DIR/unsupported.rs:4:1 + --> tests/ui/cfg/unsupported.rs:4:10 | -4 | / struct S { +4 | struct S { + | __________^ 5 | | //~^ ERROR may not be used on structs with zero fields 6 | | #[cfg(any())] 7 | | #[pin] diff --git a/tests/ui/not_unpin/conflict-unpin.stderr b/tests/ui/not_unpin/conflict-unpin.stderr index e90a574..d644bf7 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<_, _>`: - --> $DIR/conflict-unpin.rs:3:15 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>` + --> tests/ui/not_unpin/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<_, _>`: - --> $DIR/conflict-unpin.rs:12:15 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>` + --> tests/ui/not_unpin/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<_, _>`: - --> $DIR/conflict-unpin.rs:21:15 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>` + --> tests/ui/not_unpin/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 ba80d5e..a944e95 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<_, _>`: - --> $DIR/impl-unsafe-unpin.rs:3:1 +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Foo<_, _>` + --> tests/ui/not_unpin/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` fo 10 | unsafe impl<T, U> UnsafeUnpin for Foo<T, U> where T: Unpin {} | ---------------------------------------------------------- first implementation here | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Bar<_, _>`: - --> $DIR/impl-unsafe-unpin.rs:12:1 +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Bar<_, _>` + --> tests/ui/not_unpin/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` fo 19 | unsafe impl<T, U> UnsafeUnpin for Bar<T, U> {} | ------------------------------------------- first implementation here | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Baz<_, _>`: - --> $DIR/impl-unsafe-unpin.rs:21:1 +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Baz<_, _>` + --> tests/ui/not_unpin/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` fo 28 | unsafe impl<T: Unpin, U: Unpin> UnsafeUnpin for Baz<T, U> {} | --------------------------------------------------------- first implementation here | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = 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/add-attr-to-struct.rs b/tests/ui/pin_project/add-attr-to-struct.rs index 55f1561..045e796 100644 --- a/tests/ui/pin_project/add-attr-to-struct.rs +++ b/tests/ui/pin_project/add-attr-to-struct.rs @@ -1,6 +1,7 @@ +use std::marker::PhantomPinned; + use auxiliary_macro::add_pin_attr; use pin_project::pin_project; -use std::marker::PhantomPinned; #[pin_project] #[add_pin_attr(struct)] //~ ERROR duplicate #[pin] attribute diff --git a/tests/ui/pin_project/add-attr-to-struct.stderr b/tests/ui/pin_project/add-attr-to-struct.stderr index 27656d6..6fb88e8 100644 --- a/tests/ui/pin_project/add-attr-to-struct.stderr +++ b/tests/ui/pin_project/add-attr-to-struct.stderr @@ -1,15 +1,15 @@ error: duplicate #[pin] attribute - --> $DIR/add-attr-to-struct.rs:6:1 + --> tests/ui/pin_project/add-attr-to-struct.rs:7:1 | -6 | #[add_pin_attr(struct)] //~ ERROR duplicate #[pin] attribute +7 | #[add_pin_attr(struct)] //~ ERROR duplicate #[pin] attribute | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the attribute macro `add_pin_attr` (in Nightly builds, run with -Z macro-backtrace for more info) error: #[pin] attribute may only be used on fields of structs or variants - --> $DIR/add-attr-to-struct.rs:12:1 + --> tests/ui/pin_project/add-attr-to-struct.rs:13:1 | -12 | #[add_pin_attr(struct)] //~ ERROR #[pin] attribute may only be used on fields of structs or variants +13 | #[add_pin_attr(struct)] //~ ERROR #[pin] attribute may only be used on fields of structs or variants | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the attribute macro `add_pin_attr` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pin_project/add-pinned-field.stderr b/tests/ui/pin_project/add-pinned-field.stderr index a140694..d0832cc 100644 --- a/tests/ui/pin_project/add-pinned-field.stderr +++ b/tests/ui/pin_project/add-pinned-field.stderr @@ -1,23 +1,52 @@ error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/add-pinned-field.rs:21:5 + --> tests/ui/pin_project/add-pinned-field.rs:21:5 | -4 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... 21 | is_unpin::<Foo>(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^ within `__Foo<'_>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `__Foo<'_>` - = note: required because of the requirements on the impl of `Unpin` for `Foo` + = 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) error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/add-pinned-field.rs:22:5 + --> tests/ui/pin_project/add-pinned-field.rs:22:5 | -4 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... 22 | is_unpin::<Bar>(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^ within `__Bar<'_>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `__Bar<'_>` - = note: required because of the requirements on the impl of `Unpin` for `Bar` + = 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) diff --git a/tests/ui/pin_project/conflict-drop.rs b/tests/ui/pin_project/conflict-drop.rs index 908f5c0..4fdb118 100644 --- a/tests/ui/pin_project/conflict-drop.rs +++ b/tests/ui/pin_project/conflict-drop.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project] //~ ERROR E0119 struct Foo<T, U> { #[pin] diff --git a/tests/ui/pin_project/conflict-drop.stderr b/tests/ui/pin_project/conflict-drop.stderr index d5ca7b3..4ae628d 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<_, _>`: - --> $DIR/conflict-drop.rs:4:1 +error[E0119]: conflicting implementations of trait `_::FooMustNotImplDrop` for type `Foo<_, _>` + --> tests/ui/pin_project/conflict-drop.rs:5:1 | -4 | #[pin_project] //~ ERROR E0119 +5 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ | | | first implementation here | conflicting implementation for `Foo<_, _>` | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `Bar<_, _>`: - --> $DIR/conflict-drop.rs:15:15 +error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `Bar<_, _>` + --> tests/ui/pin_project/conflict-drop.rs:16:15 | -15 | #[pin_project(PinnedDrop)] //~ ERROR E0119 +16 | #[pin_project(PinnedDrop)] //~ ERROR E0119 | ^^^^^^^^^^ conflicting implementation for `Bar<_, _>` ... -27 | impl<T, U> Drop for Bar<T, U> { +28 | 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 0d6f439..5e012c4 100644 --- a/tests/ui/pin_project/conflict-unpin.stderr +++ b/tests/ui/pin_project/conflict-unpin.stderr @@ -1,5 +1,5 @@ -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`: - --> $DIR/conflict-unpin.rs:5:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>` + --> tests/ui/pin_project/conflict-unpin.rs:5:1 | 5 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ 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 a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`: - --> $DIR/conflict-unpin.rs:17:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>` + --> tests/ui/pin_project/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 a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`: - --> $DIR/conflict-unpin.rs:27:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>` + --> tests/ui/pin_project/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 a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = 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/impl-unsafe-unpin.stderr b/tests/ui/pin_project/impl-unsafe-unpin.stderr index 78545c2..ba42303 100644 --- a/tests/ui/pin_project/impl-unsafe-unpin.stderr +++ b/tests/ui/pin_project/impl-unsafe-unpin.stderr @@ -1,5 +1,5 @@ -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Foo<_, _>`: - --> $DIR/impl-unsafe-unpin.rs:3:1 +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Foo<_, _>` + --> tests/ui/pin_project/impl-unsafe-unpin.rs:3:1 | 3 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Foo<_, _>` @@ -7,10 +7,10 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo 10 | unsafe impl<T, U> UnsafeUnpin for Foo<T, U> where T: Unpin {} | ---------------------------------------------------------- first implementation here | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Bar<_, _>`: - --> $DIR/impl-unsafe-unpin.rs:12:1 +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Bar<_, _>` + --> tests/ui/pin_project/impl-unsafe-unpin.rs:12:1 | 12 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Bar<_, _>` @@ -18,10 +18,10 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo 19 | unsafe impl<T, U> UnsafeUnpin for Bar<T, U> {} | ------------------------------------------- first implementation here | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` for type `Baz<_, _>`: - --> $DIR/impl-unsafe-unpin.rs:21:1 +error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Baz<_, _>` + --> tests/ui/pin_project/impl-unsafe-unpin.rs:21:1 | 21 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Baz<_, _>` @@ -29,4 +29,4 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo 28 | unsafe impl<T: Unpin, U: Unpin> UnsafeUnpin for Baz<T, U> {} | --------------------------------------------------------- first implementation here | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = 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/import_unnamed.stderr b/tests/ui/pin_project/import_unnamed.stderr index f54e4c4..260a35a 100644 --- a/tests/ui/pin_project/import_unnamed.stderr +++ b/tests/ui/pin_project/import_unnamed.stderr @@ -1,29 +1,29 @@ error[E0432]: unresolved import `crate::pub_::__DefaultProjection` - --> $DIR/import_unnamed.rs:16:9 + --> tests/ui/pin_project/import_unnamed.rs:16:9 | 16 | use crate::pub_::__DefaultProjection; //~ ERROR E0432 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__DefaultProjection` in `pub_` error[E0432]: unresolved import `crate::pub_::__DefaultProjectionRef` - --> $DIR/import_unnamed.rs:18:9 + --> tests/ui/pin_project/import_unnamed.rs:18:9 | 18 | use crate::pub_::__DefaultProjectionRef; //~ ERROR E0432 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__DefaultProjectionRef` in `pub_` error[E0432]: unresolved import `crate::pub_::__ReplaceProjection` - --> $DIR/import_unnamed.rs:20:9 + --> tests/ui/pin_project/import_unnamed.rs:20:9 | 20 | use crate::pub_::__ReplaceProjection; //~ ERROR E0432 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__ReplaceProjection` in `pub_` error[E0432]: unresolved import `crate::pub_::__ReplaceProjectionOwned` - --> $DIR/import_unnamed.rs:22:9 + --> tests/ui/pin_project/import_unnamed.rs:22:9 | 22 | use crate::pub_::__ReplaceProjectionOwned; //~ ERROR E0432 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__ReplaceProjectionOwned` in `pub_` error[E0432]: unresolved import `crate::pub_::__ReplaceProjectionRef` - --> $DIR/import_unnamed.rs:24:9 + --> tests/ui/pin_project/import_unnamed.rs:24:9 | 24 | use crate::pub_::__ReplaceProjectionRef; //~ ERROR E0432 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `__ReplaceProjectionRef` in `pub_` diff --git a/tests/ui/pin_project/invalid.stderr b/tests/ui/pin_project/invalid.stderr index 35552bf..c43d363 100644 --- a/tests/ui/pin_project/invalid.stderr +++ b/tests/ui/pin_project/invalid.stderr @@ -1,329 +1,329 @@ -error: unexpected token: () - --> $DIR/invalid.rs:6:14 +error: unexpected token: `()` + --> tests/ui/pin_project/invalid.rs:6:14 | 6 | #[pin()] //~ ERROR unexpected token | ^^ -error: unexpected token: (foo) - --> $DIR/invalid.rs:11:29 +error: unexpected token: `(foo)` + --> tests/ui/pin_project/invalid.rs:11:29 | 11 | struct TupleStruct(#[pin(foo)] ()); //~ ERROR unexpected token | ^^^^^ -error: unexpected token: (foo) - --> $DIR/invalid.rs:15:16 +error: unexpected token: `(foo)` + --> tests/ui/pin_project/invalid.rs:15:16 | 15 | V(#[pin(foo)] ()), //~ ERROR unexpected token | ^^^^^ -error: unexpected token: (foo) - --> $DIR/invalid.rs:21:18 +error: unexpected token: `(foo)` + --> tests/ui/pin_project/invalid.rs:21:18 | 21 | #[pin(foo)] //~ ERROR unexpected token | ^^^^^ error: duplicate #[pin] attribute - --> $DIR/invalid.rs:33:9 + --> tests/ui/pin_project/invalid.rs:33:9 | 33 | #[pin] //~ ERROR duplicate #[pin] attribute | ^^^^^^ error: duplicate #[pin] attribute - --> $DIR/invalid.rs:40:9 + --> tests/ui/pin_project/invalid.rs:40:9 | 40 | #[pin] | ^^^^^^ error: duplicate #[pin] attribute - --> $DIR/invalid.rs:49:13 + --> tests/ui/pin_project/invalid.rs:49:13 | 49 | #[pin] | ^^^^^^ error: duplicate #[pin] attribute - --> $DIR/invalid.rs:59:13 + --> tests/ui/pin_project/invalid.rs:59:13 | 59 | #[pin] //~ ERROR duplicate #[pin] attribute | ^^^^^^ error: #[pin] attribute may only be used on fields of structs or variants - --> $DIR/invalid.rs:69:5 + --> tests/ui/pin_project/invalid.rs:69:5 | 69 | #[pin] //~ ERROR may only be used on fields of structs or variants | ^^^^^^ error: #[pin] attribute may only be used on fields of structs or variants - --> $DIR/invalid.rs:77:9 + --> tests/ui/pin_project/invalid.rs:77:9 | 77 | #[pin] //~ ERROR may only be used on fields of structs or variants | ^^^^^^ error: #[pin] attribute may only be used on fields of structs or variants - --> $DIR/invalid.rs:82:5 + --> tests/ui/pin_project/invalid.rs:82:5 | 82 | #[pin] //~ ERROR may only be used on fields of structs or variants | ^^^^^^ error: `Replace` argument was removed, use `project_replace` argument instead - --> $DIR/invalid.rs:91:19 + --> tests/ui/pin_project/invalid.rs:91:19 | 91 | #[pin_project(Replace)] //~ ERROR `Replace` argument was removed, use `project_replace` argument instead | ^^^^^^^ error: expected identifier - --> $DIR/invalid.rs:94:31 + --> tests/ui/pin_project/invalid.rs:94:31 | 94 | #[pin_project(UnsafeUnpin,,)] //~ ERROR expected identifier | ^ error: unexpected argument: Foo - --> $DIR/invalid.rs:97:19 + --> tests/ui/pin_project/invalid.rs:97:19 | 97 | #[pin_project(Foo)] //~ ERROR unexpected argument | ^^^ error: expected identifier - --> $DIR/invalid.rs:100:19 + --> tests/ui/pin_project/invalid.rs:100:19 | 100 | #[pin_project(,UnsafeUnpin)] //~ ERROR expected identifier | ^ error: expected `,` - --> $DIR/invalid.rs:106:30 + --> tests/ui/pin_project/invalid.rs:106:30 | 106 | #[pin_project(PinnedDrop PinnedDrop)] //~ ERROR expected `,` | ^^^^^^^^^^ error: duplicate `PinnedDrop` argument - --> $DIR/invalid.rs:109:31 + --> tests/ui/pin_project/invalid.rs:109:31 | 109 | #[pin_project(PinnedDrop, PinnedDrop)] //~ ERROR duplicate `PinnedDrop` argument | ^^^^^^^^^^ error: duplicate `UnsafeUnpin` argument - --> $DIR/invalid.rs:112:32 + --> tests/ui/pin_project/invalid.rs:112:32 | 112 | #[pin_project(UnsafeUnpin, UnsafeUnpin)] //~ ERROR duplicate `UnsafeUnpin` argument | ^^^^^^^^^^^ error: duplicate `!Unpin` argument - --> $DIR/invalid.rs:115:27 + --> tests/ui/pin_project/invalid.rs:115:27 | 115 | #[pin_project(!Unpin, !Unpin)] //~ ERROR duplicate `!Unpin` argument | ^^^^^^ error: duplicate `UnsafeUnpin` argument - --> $DIR/invalid.rs:118:44 + --> tests/ui/pin_project/invalid.rs:118:44 | 118 | #[pin_project(PinnedDrop, UnsafeUnpin, UnsafeUnpin)] //~ ERROR duplicate `UnsafeUnpin` argument | ^^^^^^^^^^^ error: duplicate `PinnedDrop` argument - --> $DIR/invalid.rs:121:44 + --> tests/ui/pin_project/invalid.rs:121:44 | 121 | #[pin_project(PinnedDrop, UnsafeUnpin, PinnedDrop, UnsafeUnpin)] //~ ERROR duplicate `PinnedDrop` argument | ^^^^^^^^^^ error: duplicate `project` argument - --> $DIR/invalid.rs:124:32 + --> tests/ui/pin_project/invalid.rs:124:32 | 124 | #[pin_project(project = A, project = B)] //~ ERROR duplicate `project` argument | ^^^^^^^^^^^ error: duplicate `project` argument - --> $DIR/invalid.rs:127:49 + --> tests/ui/pin_project/invalid.rs:127:49 | 127 | #[pin_project(project = A, project_ref = A, project = B)] //~ ERROR duplicate `project` argument | ^^^^^^^^^^^ error: duplicate `project_ref` argument - --> $DIR/invalid.rs:130:36 + --> tests/ui/pin_project/invalid.rs:130:36 | 130 | #[pin_project(project_ref = A, project_ref = B)] //~ ERROR duplicate `project_ref` argument | ^^^^^^^^^^^^^^^ error: duplicate `project_replace` argument - --> $DIR/invalid.rs:133:40 + --> tests/ui/pin_project/invalid.rs:133:40 | 133 | #[pin_project(project_replace = A, project_replace = B)] //~ ERROR duplicate `project_replace` argument | ^^^^^^^^^^^^^^^^^^^ error: duplicate `project_replace` argument - --> $DIR/invalid.rs:136:36 + --> tests/ui/pin_project/invalid.rs:136:36 | 136 | #[pin_project(project_replace, project_replace = B)] //~ ERROR duplicate `project_replace` argument | ^^^^^^^^^^^^^^^^^^^ error: duplicate `project_replace` argument - --> $DIR/invalid.rs:139:40 + --> tests/ui/pin_project/invalid.rs:139:40 | 139 | #[pin_project(project_replace = A, project_replace)] //~ ERROR duplicate `project_replace` argument | ^^^^^^^^^^^^^^^ error: arguments `PinnedDrop` and `project_replace` are mutually exclusive - --> $DIR/invalid.rs:145:19 + --> tests/ui/pin_project/invalid.rs:145:19 | 145 | #[pin_project(PinnedDrop, project_replace)] //~ ERROR arguments `PinnedDrop` and `project_replace` are mutually exclusive | ^^^^^^^^^^ error: arguments `PinnedDrop` and `project_replace` are mutually exclusive - --> $DIR/invalid.rs:148:49 + --> tests/ui/pin_project/invalid.rs:148:49 | 148 | #[pin_project(project_replace, UnsafeUnpin, PinnedDrop)] //~ ERROR arguments `PinnedDrop` and `project_replace` are mutually exclusive | ^^^^^^^^^^ error: arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive - --> $DIR/invalid.rs:151:19 + --> tests/ui/pin_project/invalid.rs:151:19 | 151 | #[pin_project(UnsafeUnpin, !Unpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive | ^^^^^^^^^^^ error: arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive - --> $DIR/invalid.rs:154:39 + --> tests/ui/pin_project/invalid.rs:154:39 | 154 | #[pin_project(!Unpin, PinnedDrop, UnsafeUnpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive | ^^^^^^^^^^^ error: expected `!Unpin`, found `!` - --> $DIR/invalid.rs:157:19 + --> tests/ui/pin_project/invalid.rs:157:19 | 157 | #[pin_project(!)] //~ ERROR expected `!Unpin`, found `!` | ^ error: unexpected argument: Unpin - --> $DIR/invalid.rs:160:19 + --> tests/ui/pin_project/invalid.rs:160:19 | 160 | #[pin_project(Unpin)] //~ ERROR unexpected argument | ^^^^^ error: expected `project = <identifier>`, found `project` - --> $DIR/invalid.rs:163:19 + --> tests/ui/pin_project/invalid.rs:163:19 | 163 | #[pin_project(project)] //~ ERROR expected `project = <identifier>`, found `project` | ^^^^^^^ error: expected `project = <identifier>`, found `project =` - --> $DIR/invalid.rs:166:19 + --> tests/ui/pin_project/invalid.rs:166:19 | 166 | #[pin_project(project = )] //~ ERROR expected `project = <identifier>`, found `project =` | ^^^^^^^^^ error: expected identifier - --> $DIR/invalid.rs:169:29 + --> tests/ui/pin_project/invalid.rs:169:29 | 169 | #[pin_project(project = !)] //~ ERROR expected identifier | ^ error: expected `project_ref = <identifier>`, found `project_ref` - --> $DIR/invalid.rs:172:19 + --> tests/ui/pin_project/invalid.rs:172:19 | 172 | #[pin_project(project_ref)] //~ ERROR expected `project_ref = <identifier>`, found `project_ref` | ^^^^^^^^^^^ error: expected `project_ref = <identifier>`, found `project_ref =` - --> $DIR/invalid.rs:175:19 + --> tests/ui/pin_project/invalid.rs:175:19 | 175 | #[pin_project(project_ref = )] //~ ERROR expected `project_ref = <identifier>`, found `project_ref =` | ^^^^^^^^^^^^^ error: expected identifier - --> $DIR/invalid.rs:178:33 + --> tests/ui/pin_project/invalid.rs:178:33 | 178 | #[pin_project(project_ref = !)] //~ ERROR expected identifier | ^ error: expected `project_replace = <identifier>`, found `project_replace =` - --> $DIR/invalid.rs:184:19 + --> tests/ui/pin_project/invalid.rs:184:19 | 184 | #[pin_project(project_replace = )] //~ ERROR expected `project_replace = <identifier>`, found `project_replace =` | ^^^^^^^^^^^^^^^^^ error: expected identifier - --> $DIR/invalid.rs:187:37 + --> tests/ui/pin_project/invalid.rs:187:37 | 187 | #[pin_project(project_replace = !)] //~ ERROR expected identifier | ^ error: `project_replace` argument requires a value when used on enums - --> $DIR/invalid.rs:190:19 + --> tests/ui/pin_project/invalid.rs:190:19 | 190 | #[pin_project(project_replace)] //~ ERROR `project_replace` argument requires a value when used on enums | ^^^^^^^^^^^^^^^ error: name `OrigAndProj` is the same as the original type name - --> $DIR/invalid.rs:199:29 + --> tests/ui/pin_project/invalid.rs:199:29 | 199 | #[pin_project(project = OrigAndProj)] //~ ERROR name `OrigAndProj` is the same as the original type name | ^^^^^^^^^^^ error: name `OrigAndProjRef` is the same as the original type name - --> $DIR/invalid.rs:202:33 + --> tests/ui/pin_project/invalid.rs:202:33 | 202 | #[pin_project(project_ref = OrigAndProjRef)] //~ ERROR name `OrigAndProjRef` is the same as the original type name | ^^^^^^^^^^^^^^ error: name `OrigAndProjOwn` is the same as the original type name - --> $DIR/invalid.rs:205:37 + --> tests/ui/pin_project/invalid.rs:205:37 | 205 | #[pin_project(project_replace = OrigAndProjOwn)] //~ ERROR name `OrigAndProjOwn` is the same as the original type name | ^^^^^^^^^^^^^^ error: name `A` is already specified by `project` argument - --> $DIR/invalid.rs:208:46 + --> tests/ui/pin_project/invalid.rs:208:46 | 208 | #[pin_project(project = A, project_ref = A)] //~ ERROR name `A` is already specified by `project` argument | ^ error: name `A` is already specified by `project` argument - --> $DIR/invalid.rs:211:50 + --> tests/ui/pin_project/invalid.rs:211:50 | 211 | #[pin_project(project = A, project_replace = A)] //~ ERROR name `A` is already specified by `project` argument | ^ error: name `A` is already specified by `project_ref` argument - --> $DIR/invalid.rs:214:54 + --> tests/ui/pin_project/invalid.rs:214:54 | 214 | #[pin_project(project_ref = A, project_replace = A)] //~ ERROR name `A` is already specified by `project_ref` argument | ^ error: duplicate #[pin_project] attribute - --> $DIR/invalid.rs:222:5 + --> tests/ui/pin_project/invalid.rs:222:5 | 222 | #[pin_project] //~ ERROR duplicate #[pin_project] attribute | ^^^^^^^^^^^^^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> $DIR/invalid.rs:230:19 + --> tests/ui/pin_project/invalid.rs:230:19 | 230 | struct Struct {} //~ ERROR may not be used on structs with zero fields | ^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> $DIR/invalid.rs:233:23 + --> tests/ui/pin_project/invalid.rs:233:23 | 233 | struct TupleStruct(); //~ ERROR may not be used on structs with zero fields | ^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> $DIR/invalid.rs:236:12 + --> tests/ui/pin_project/invalid.rs:236:12 | 236 | struct UnitStruct; //~ ERROR may not be used on structs with zero fields | ^^^^^^^^^^ error: #[pin_project] attribute may not be used on enums without variants - --> $DIR/invalid.rs:239:20 + --> tests/ui/pin_project/invalid.rs:239:20 | 239 | enum EnumEmpty {} //~ ERROR may not be used on enums without variants | ^^ error: #[pin_project] attribute may not be used on enums with discriminants - --> $DIR/invalid.rs:243:13 + --> tests/ui/pin_project/invalid.rs:243:13 | 243 | V = 2, //~ ERROR may not be used on enums with discriminants | ^ error: #[pin_project] attribute may not be used on enums with zero fields - --> $DIR/invalid.rs:248:9 + --> tests/ui/pin_project/invalid.rs:248:9 | 248 | / Unit, //~ ERROR may not be used on enums with zero fields 249 | | Tuple(), @@ -331,7 +331,7 @@ error: #[pin_project] attribute may not be used on enums with zero fields | |__________________^ error: #[pin_project] attribute may only be used on structs or enums - --> $DIR/invalid.rs:254:5 + --> tests/ui/pin_project/invalid.rs:254:5 | 254 | / union Union { 255 | | //~^ ERROR may only be used on structs or enums @@ -340,25 +340,25 @@ error: #[pin_project] attribute may only be used on structs or enums | |_____^ error: #[pin_project] attribute may only be used on structs or enums - --> $DIR/invalid.rs:260:5 + --> tests/ui/pin_project/invalid.rs:260:5 | 260 | impl Impl {} //~ ERROR may only be used on structs or enums | ^^^^^^^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/invalid.rs:268:12 + --> tests/ui/pin_project/invalid.rs:268:12 | 268 | #[repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/invalid.rs:272:12 + --> tests/ui/pin_project/invalid.rs:272:12 | 272 | #[repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/invalid.rs:276:12 + --> tests/ui/pin_project/invalid.rs:276:12 | 276 | #[repr(packed)] | ^^^^^^ diff --git a/tests/ui/pin_project/overlapping_unpin_struct.rs b/tests/ui/pin_project/overlapping_unpin_struct.rs index 8db0855..abfd5d1 100644 --- a/tests/ui/pin_project/overlapping_unpin_struct.rs +++ b/tests/ui/pin_project/overlapping_unpin_struct.rs @@ -1,6 +1,7 @@ -use pin_project::pin_project; use std::marker::PhantomPinned; +use pin_project::pin_project; + #[pin_project] struct S<T> { #[pin] diff --git a/tests/ui/pin_project/overlapping_unpin_struct.stderr b/tests/ui/pin_project/overlapping_unpin_struct.stderr index 296b063..1bd200d 100644 --- a/tests/ui/pin_project/overlapping_unpin_struct.stderr +++ b/tests/ui/pin_project/overlapping_unpin_struct.stderr @@ -1,11 +1,25 @@ error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/overlapping_unpin_struct.rs:17:5 + --> tests/ui/pin_project/overlapping_unpin_struct.rs:18:5 | -14 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -17 | is_unpin::<S<PhantomPinned>>(); //~ ERROR E0277 +18 | is_unpin::<S<PhantomPinned>>(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__S<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `_::__S<'_, PhantomPinned>` - = note: required because of the requirements on the impl of `Unpin` for `S<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) diff --git a/tests/ui/pin_project/override-priv-mod.rs b/tests/ui/pin_project/override-priv-mod.rs new file mode 100644 index 0000000..890fd5b --- /dev/null +++ b/tests/ui/pin_project/override-priv-mod.rs @@ -0,0 +1,32 @@ +// https://discord.com/channels/273534239310479360/512792629516173323/870075511009857617 + +extern crate pin_project as pin_project_orig; +extern crate self as pin_project; + +pub use ::pin_project_orig::*; +mod __private { + pub use ::pin_project_orig::__private::*; + pub trait Drop {} +} + +use std::{marker::PhantomPinned, mem}; + +#[pin_project] //~ ERROR conflicting implementations of trait `_::FooMustNotImplDrop` +struct S { + #[pin] + f: (u8, PhantomPinned), +} + +impl Drop for S { + fn drop(&mut self) { + let prev = &self.f.0 as *const _ as usize; + let moved = mem::take(&mut self.f); // move pinned field + let moved = &moved.0 as *const _ as usize; + assert_eq!(prev, moved); // panic + } +} + +fn main() { + let mut x = Box::pin(S { f: (1, PhantomPinned) }); + let _f = x.as_mut().project().f; // first mutable access +} diff --git a/tests/ui/pin_project/override-priv-mod.stderr b/tests/ui/pin_project/override-priv-mod.stderr new file mode 100644 index 0000000..8a3fb9b --- /dev/null +++ b/tests/ui/pin_project/override-priv-mod.stderr @@ -0,0 +1,10 @@ +error[E0119]: conflicting implementations of trait `_::SMustNotImplDrop` for type `S` + --> tests/ui/pin_project/override-priv-mod.rs:14:1 + | +14 | #[pin_project] //~ ERROR conflicting implementations of trait `_::FooMustNotImplDrop` + | ^^^^^^^^^^^^^^ + | | + | first implementation here + | conflicting implementation for `S` + | + = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pin_project/packed-enum.rs b/tests/ui/pin_project/packed-enum.rs index 9d4a4c3..023c08d 100644 --- a/tests/ui/pin_project/packed-enum.rs +++ b/tests/ui/pin_project/packed-enum.rs @@ -1,5 +1,9 @@ use pin_project::pin_project; +// #[repr(packed)] cannot be apply on enums and will be rejected by rustc. +// However, we should not rely on the behavior of rustc that rejects this. +// https://github.com/taiki-e/pin-project/pull/324#discussion_r612388001 + #[repr(packed)] //~ ERROR E0517 enum E1 { V(()), diff --git a/tests/ui/pin_project/packed-enum.stderr b/tests/ui/pin_project/packed-enum.stderr index afc8b30..1872211 100644 --- a/tests/ui/pin_project/packed-enum.stderr +++ b/tests/ui/pin_project/packed-enum.stderr @@ -1,30 +1,42 @@ +error: #[repr(packed)] attribute should be applied to a struct or union + --> 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 - --> $DIR/packed-enum.rs:3:8 - | -3 | #[repr(packed)] //~ ERROR E0517 - | ^^^^^^ -4 | / enum E1 { -5 | | V(()), -6 | | } - | |_- not 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 error[E0517]: attribute should be applied to a struct or union - --> $DIR/packed-enum.rs:9:8 + --> tests/ui/pin_project/packed-enum.rs:13:8 | -9 | #[repr(packed)] //~ ERROR E0517 +13 | #[repr(packed)] //~ ERROR E0517 | ^^^^^^ -10 | / enum E2 { -11 | | V(()), -12 | | } +14 | / enum E2 { +15 | | V(()), +16 | | } | |_- not a struct or union error[E0517]: attribute should be applied to a struct or union - --> $DIR/packed-enum.rs:14:8 + --> tests/ui/pin_project/packed-enum.rs:18:8 | -14 | #[repr(packed)] //~ ERROR E0517 +18 | #[repr(packed)] //~ ERROR E0517 | ^^^^^^ -15 | #[pin_project] -16 | / enum E3 { -17 | | V(()), -18 | | } +19 | #[pin_project] +20 | / enum E3 { +21 | | V(()), +22 | | } | |_- not a struct or union diff --git a/tests/ui/pin_project/packed-name-value.rs b/tests/ui/pin_project/packed-name-value.rs index ed819ca..dedc403 100644 --- a/tests/ui/pin_project/packed-name-value.rs +++ b/tests/ui/pin_project/packed-name-value.rs @@ -1,17 +1,24 @@ use pin_project::pin_project; -#[repr(packed = "")] //~ ERROR E0552 -struct S1 { - f: (), -} +// #[repr(packed = "")] is not valid format of #[repr(packed)] and will be +// rejected by rustc. +// However, we should not rely on the behavior of rustc that rejects this. +// https://github.com/taiki-e/pin-project/pull/324#discussion_r612388001 + +// https://github.com/taiki-e/pin-project/pull/324#discussion_r612388001 +// https://github.com/rust-lang/rust/issues/83921 +// #[repr(packed = "")] //~ ERROR E0552 +// struct S1 { +// f: (), +// } #[pin_project] -#[repr(packed = "")] //~ ERROR E0552 +#[repr(packed = "")] //~ ERROR attribute should not be name-value pair struct S2 { f: (), } -#[repr(packed = "")] //~ ERROR E0552 +#[repr(packed = "")] //~ ERROR attribute should not be name-value pair #[pin_project] struct S3 { f: (), diff --git a/tests/ui/pin_project/packed-name-value.stderr b/tests/ui/pin_project/packed-name-value.stderr index a3e2571..d8b2194 100644 --- a/tests/ui/pin_project/packed-name-value.stderr +++ b/tests/ui/pin_project/packed-name-value.stderr @@ -1,17 +1,23 @@ -error[E0552]: unrecognized representation hint - --> $DIR/packed-name-value.rs:3:8 - | -3 | #[repr(packed = "")] //~ ERROR E0552 - | ^^^^^^^^^^^ - -error[E0552]: unrecognized representation hint - --> $DIR/packed-name-value.rs:9:8 - | -9 | #[repr(packed = "")] //~ ERROR E0552 - | ^^^^^^^^^^^ +error: #[repr(packed)] attribute should not be name-value pair + --> 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:14:8 +error: #[repr(packed)] attribute should not be name-value pair + --> tests/ui/pin_project/packed-name-value.rs:21:8 | -14 | #[repr(packed = "")] //~ ERROR E0552 +21 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair | ^^^^^^^^^^^ + +error[E0693]: incorrect `repr(packed)` attribute format + --> tests/ui/pin_project/packed-name-value.rs:16:8 + | +16 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair + | ^^^^^^^^^^^ help: use parentheses instead: `packed()` + +error[E0693]: incorrect `repr(packed)` attribute format + --> tests/ui/pin_project/packed-name-value.rs:21:8 + | +21 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair + | ^^^^^^^^^^^ help: use parentheses instead: `packed()` diff --git a/tests/ui/pin_project/packed.rs b/tests/ui/pin_project/packed.rs index f756605..dd3ebfd 100644 --- a/tests/ui/pin_project/packed.rs +++ b/tests/ui/pin_project/packed.rs @@ -2,7 +2,7 @@ use pin_project::pin_project; #[pin_project] #[repr(packed, C)] //~ ERROR may not be used on #[repr(packed)] types -struct A { +struct Packed1 { #[pin] f: u8, } @@ -10,14 +10,22 @@ struct A { // Test putting 'repr' before the 'pin_project' attribute #[repr(packed, C)] //~ ERROR may not be used on #[repr(packed)] types #[pin_project] -struct B { +struct Packed2 { #[pin] f: u8, } #[pin_project] #[repr(packed(2))] //~ ERROR may not be used on #[repr(packed)] types -struct C { +struct PackedN1 { + #[pin] + f: u32, +} + +// Test putting 'repr' before the 'pin_project' attribute +#[repr(packed(2))] //~ ERROR may not be used on #[repr(packed)] types +#[pin_project] +struct PackedN2 { #[pin] f: u32, } diff --git a/tests/ui/pin_project/packed.stderr b/tests/ui/pin_project/packed.stderr index 969faea..25ea5f4 100644 --- a/tests/ui/pin_project/packed.stderr +++ b/tests/ui/pin_project/packed.stderr @@ -1,17 +1,23 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed.rs:4:8 + --> tests/ui/pin_project/packed.rs:4:8 | 4 | #[repr(packed, C)] //~ ERROR may not be used on #[repr(packed)] types | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed.rs:11:8 + --> tests/ui/pin_project/packed.rs:11:8 | 11 | #[repr(packed, C)] //~ ERROR may not be used on #[repr(packed)] types | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed.rs:19:8 + --> tests/ui/pin_project/packed.rs:19:8 | 19 | #[repr(packed(2))] //~ ERROR may not be used on #[repr(packed)] types | ^^^^^^^^^ + +error: #[pin_project] attribute may not be used on #[repr(packed)] types + --> 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 38f6fe0..72d3d3e 100644 --- a/tests/ui/pin_project/packed_sneaky-1.rs +++ b/tests/ui/pin_project/packed_sneaky-1.rs @@ -1,6 +1,7 @@ +use std::pin::Pin; + use auxiliary_macro::hidden_repr; use pin_project::{pin_project, pinned_drop, UnsafeUnpin}; -use std::pin::Pin; #[pin_project] //~ ERROR may not be used on #[repr(packed)] types #[hidden_repr(packed)] diff --git a/tests/ui/pin_project/packed_sneaky-1.stderr b/tests/ui/pin_project/packed_sneaky-1.stderr index 510200e..32fe407 100644 --- a/tests/ui/pin_project/packed_sneaky-1.stderr +++ b/tests/ui/pin_project/packed_sneaky-1.stderr @@ -1,17 +1,17 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-1.rs:6:15 + --> tests/ui/pin_project/packed_sneaky-1.rs:7:15 | -6 | #[hidden_repr(packed)] +7 | #[hidden_repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-1.rs:13:15 + --> tests/ui/pin_project/packed_sneaky-1.rs:14:15 | -13 | #[hidden_repr(packed)] +14 | #[hidden_repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-1.rs:22:15 + --> tests/ui/pin_project/packed_sneaky-1.rs:23:15 | -22 | #[hidden_repr(packed)] +23 | #[hidden_repr(packed)] | ^^^^^^ diff --git a/tests/ui/pin_project/packed_sneaky-2.stderr b/tests/ui/pin_project/packed_sneaky-2.stderr index 51987a2..d643052 100644 --- a/tests/ui/pin_project/packed_sneaky-2.stderr +++ b/tests/ui/pin_project/packed_sneaky-2.stderr @@ -1,5 +1,5 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-2.rs:4:1 + --> tests/ui/pin_project/packed_sneaky-2.rs:4:1 | 4 | / hidden_repr_macro! { //~ ERROR may not be used on #[repr(packed)] types 5 | | #[pin_project] @@ -10,4 +10,4 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types 10 | | } | |_^ | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `hidden_repr_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 b953e9f..c97f18b 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 - --> $DIR/packed_sneaky-3.rs:4:1 + --> tests/ui/pin_project/packed_sneaky-3.rs:4:1 | 4 | hidden_repr_macro! {} //~ ERROR expected item after attributes | ^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `hidden_repr_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected item after attributes - --> $DIR/packed_sneaky-3.rs:13:9 + --> tests/ui/pin_project/packed_sneaky-3.rs:13:9 | 13 | #[repr(packed)] //~ ERROR expected item after attributes | ^^^^^^^^^^^^^^^ @@ -15,18 +15,18 @@ error: expected item after attributes 17 | hidden_repr_macro2! {} | ---------------------- in this macro invocation | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `hidden_repr_macro2` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected item after attributes - --> $DIR/packed_sneaky-3.rs:24:10 + --> tests/ui/pin_project/packed_sneaky-3.rs:24:10 | 24 | #[derive(HiddenRepr)] //~ ERROR expected item after attributes | ^^^^^^^^^^ | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `HiddenRepr` (in Nightly builds, run with -Z macro-backtrace for more info) error: proc-macro derive produced unparseable tokens - --> $DIR/packed_sneaky-3.rs:24:10 + --> tests/ui/pin_project/packed_sneaky-3.rs:24:10 | 24 | #[derive(HiddenRepr)] //~ ERROR expected item after attributes | ^^^^^^^^^^ diff --git a/tests/ui/pin_project/private_in_public-enum.stderr b/tests/ui/pin_project/private_in_public-enum.stderr index 6e3316c..c93b265 100644 --- a/tests/ui/pin_project/private_in_public-enum.stderr +++ b/tests/ui/pin_project/private_in_public-enum.stderr @@ -1,5 +1,5 @@ error[E0446]: private type `PrivateEnum` in public interface - --> $DIR/private_in_public-enum.rs:6:7 + --> tests/ui/pin_project/private_in_public-enum.rs:6:7 | 6 | V(PrivateEnum), //~ ERROR E0446 | ^^^^^^^^^^^ can't leak private type @@ -8,7 +8,7 @@ error[E0446]: private type `PrivateEnum` in public interface | ---------------- `PrivateEnum` declared as private error[E0446]: private type `foo::PrivateEnum` in public interface - --> $DIR/private_in_public-enum.rs:15:11 + --> tests/ui/pin_project/private_in_public-enum.rs:15:11 | 15 | V(PrivateEnum), //~ ERROR E0446 | ^^^^^^^^^^^ can't leak private type diff --git a/tests/ui/pin_project/project_replace_unsized.stderr b/tests/ui/pin_project/project_replace_unsized.stderr index 26e416a..86cc148 100644 --- a/tests/ui/pin_project/project_replace_unsized.stderr +++ b/tests/ui/pin_project/project_replace_unsized.stderr @@ -1,72 +1,118 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized.rs:3:15 + --> tests/ui/pin_project/project_replace_unsized.rs:3:15 | 3 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 4 | struct Struct<T: ?Sized> { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` | - = note: required because it appears within the type `Struct<T>` +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> { + | ^^^^^^ = help: unsized fn params are gated as an unstable feature +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +4 - struct Struct<T: ?Sized> { +4 + struct Struct<T> { + | help: function arguments must have a statically known size, borrowed types always have a known size | 3 | #[pin_project(&project_replace)] //~ ERROR E0277 - | ^ + | + error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized.rs:3:1 - | -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) + --> 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> { + | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized.rs:5:5 + --> tests/ui/pin_project/project_replace_unsized.rs:5:5 | +3 | #[pin_project(project_replace)] //~ ERROR E0277 + | ------------------------------- required by a bound introduced by this call 4 | struct Struct<T: ?Sized> { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` 5 | f: T, | ^ doesn't have a size known at compile-time + | +note: required by a bound in `std::ptr::read` + --> $RUST/core/src/ptr/mod.rs + | + | pub const unsafe fn read<T>(src: *const T) -> T { + | ^ required by this bound in `std::ptr::read` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +4 - struct Struct<T: ?Sized> { +4 + struct Struct<T> { + | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized.rs:8:15 + --> tests/ui/pin_project/project_replace_unsized.rs:8:15 | 8 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 9 | struct TupleStruct<T: ?Sized>(T); - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` | - = note: required because it appears within the type `TupleStruct<T>` +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); + | ^^^^^^^^^^^ = help: unsized fn params are gated as an unstable feature -help: function arguments must have a statically known size, borrowed types always have a known size +help: consider removing the `?Sized` bound to make the type parameter `Sized` | -8 | #[pin_project(&project_replace)] //~ ERROR E0277 - | ^ - -error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized.rs:8:1 +9 - struct TupleStruct<T: ?Sized>(T); +9 + struct TupleStruct<T>(T); | -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` +help: function arguments must have a statically known size, borrowed types always have a known size | - = 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) +8 | #[pin_project(&project_replace)] //~ ERROR E0277 + | + error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized.rs: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 + --> 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); + | diff --git a/tests/ui/pin_project/project_replace_unsized_fn_params.stderr b/tests/ui/pin_project/project_replace_unsized_fn_params.stderr index f0f9573..e398ca4 100644 --- a/tests/ui/pin_project/project_replace_unsized_fn_params.stderr +++ b/tests/ui/pin_project/project_replace_unsized_fn_params.stderr @@ -1,55 +1,112 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized_fn_params.rs:6:8 + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:6:8 | 6 | struct Struct<T: ?Sized> { | ^^^^^^^-^^^^^^^^^ | | | - | | this type parameter needs to be `Sized` + | | this type parameter needs to be `std::marker::Sized` | doesn't have a size known at compile-time | - = note: required because it appears within the type `__StructProjectionOwned<T>` - = note: the return type of a function must have a statically known size - -error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized_fn_params.rs:5:1 +note: required because it appears within the type `__StructProjectionOwned<T>` + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:6:8 | -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: the return type of a function must have a statically known size +help: consider removing the `?Sized` bound to make the type parameter `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) +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> { + | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized_fn_params.rs:7:5 + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:7:5 | +5 | #[pin_project(project_replace)] //~ ERROR E0277 + | ------------------------------- required by a bound introduced by this call 6 | struct Struct<T: ?Sized> { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` 7 | f: T, | ^ doesn't have a size known at compile-time + | +note: required by a bound in `std::ptr::read` + --> $RUST/core/src/ptr/mod.rs + | + | pub const unsafe fn read<T>(src: *const T) -> T { + | ^ required by this bound in `std::ptr::read` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +6 - struct Struct<T: ?Sized> { +6 + struct Struct<T> { + | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized_fn_params.rs:11:8 + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:11:8 | 11 | struct TupleStruct<T: ?Sized>(T); | ^^^^^^^^^^^^-^^^^^^^^^ | | | - | | this type parameter needs to be `Sized` + | | this type parameter needs to be `std::marker::Sized` | doesn't have a size known at compile-time | - = note: required because it appears within the type `__TupleStructProjectionOwned<T>` - = note: the return type of a function must have a statically known size - -error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/project_replace_unsized_fn_params.rs:10:1 +note: required because it appears within the type `__TupleStructProjectionOwned<T>` + --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:11:8 | -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: 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); | - = 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 + --> 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); + | diff --git a/tests/ui/pin_project/remove-attr-from-field.rs b/tests/ui/pin_project/remove-attr-from-field.rs index bec8302..fd14da3 100644 --- a/tests/ui/pin_project/remove-attr-from-field.rs +++ b/tests/ui/pin_project/remove-attr-from-field.rs @@ -1,6 +1,7 @@ +use std::{marker::PhantomPinned, pin::Pin}; + use auxiliary_macro::remove_attr; use pin_project::pin_project; -use std::{marker::PhantomPinned, pin::Pin}; fn is_unpin<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 5d8caac..697cd63 100644 --- a/tests/ui/pin_project/remove-attr-from-field.stderr +++ b/tests/ui/pin_project/remove-attr-from-field.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types - --> $DIR/remove-attr-from-field.rs:27:38 + --> tests/ui/pin_project/remove-attr-from-field.rs:28:38 | -27 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 +28 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 | ----------------------- ^^^ expected struct `Pin`, found `&mut PhantomPinned` | | | expected due to this @@ -10,9 +10,9 @@ error[E0308]: mismatched types found mutable reference `&mut PhantomPinned` error[E0308]: mismatched types - --> $DIR/remove-attr-from-field.rs:31:38 + --> tests/ui/pin_project/remove-attr-from-field.rs:32:38 | -31 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 +32 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308 | ----------------------- ^^^ expected struct `Pin`, found `&mut PhantomPinned` | | | expected due to this diff --git a/tests/ui/pin_project/remove-attr-from-struct.rs b/tests/ui/pin_project/remove-attr-from-struct.rs index 0086cf9..cbe5aba 100644 --- a/tests/ui/pin_project/remove-attr-from-struct.rs +++ b/tests/ui/pin_project/remove-attr-from-struct.rs @@ -1,6 +1,7 @@ +use std::{marker::PhantomPinned, pin::Pin}; + use auxiliary_macro::remove_attr; use pin_project::pin_project; -use std::{marker::PhantomPinned, pin::Pin}; fn is_unpin<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 4652b66..1a9cd42 100644 --- a/tests/ui/pin_project/remove-attr-from-struct.stderr +++ b/tests/ui/pin_project/remove-attr-from-struct.stderr @@ -1,71 +1,107 @@ error: #[pin_project] attribute has been removed - --> $DIR/remove-attr-from-struct.rs:21:1 + --> tests/ui/pin_project/remove-attr-from-struct.rs:22:1 | -21 | #[pin_project] //~ ERROR has been removed +22 | #[pin_project] //~ ERROR has been removed | ^^^^^^^^^^^^^^ | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find attribute `pin` in this scope - --> $DIR/remove-attr-from-struct.rs:17:7 + --> tests/ui/pin_project/remove-attr-from-struct.rs:18:7 | -17 | #[pin] //~ ERROR cannot find attribute `pin` in this scope +18 | #[pin] //~ ERROR cannot find attribute `pin` in this scope | ^^^ error: cannot find attribute `pin` in this scope - --> $DIR/remove-attr-from-struct.rs:10:7 + --> tests/ui/pin_project/remove-attr-from-struct.rs:11:7 | -10 | #[pin] //~ ERROR cannot find attribute `pin` in this scope +11 | #[pin] //~ ERROR cannot find attribute `pin` in this scope | ^^^ error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/remove-attr-from-struct.rs:34:5 + --> tests/ui/pin_project/remove-attr-from-struct.rs:35:5 | -5 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -34 | is_unpin::<A>(); //~ ERROR E0277 +35 | is_unpin::<A>(); //~ ERROR E0277 | ^^^^^^^^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `A` + = note: consider using `Box::pin` +note: required because it appears within the type `A` + --> tests/ui/pin_project/remove-attr-from-struct.rs:10:8 + | +10 | struct A { + | ^ +note: required by a bound in `is_unpin` + --> tests/ui/pin_project/remove-attr-from-struct.rs:6:16 + | +6 | fn is_unpin<T: Unpin>() {} + | ^^^^^ required by this bound in `is_unpin` error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/remove-attr-from-struct.rs:35:5 + --> tests/ui/pin_project/remove-attr-from-struct.rs:36:5 | -5 | fn is_unpin<T: Unpin>() {} - | ----- required by this bound in `is_unpin` -... -35 | is_unpin::<B>(); //~ ERROR E0277 +36 | is_unpin::<B>(); //~ ERROR E0277 | ^^^^^^^^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `B` - -error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/remove-attr-from-struct.rs:39:13 + = 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 | -39 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 - | ^^^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned` +17 | struct B { + | ^ +note: required by a bound in `is_unpin` + --> tests/ui/pin_project/remove-attr-from-struct.rs:6:16 | - = note: required because it appears within the type `A` - = note: required by `Pin::<P>::new` +6 | fn is_unpin<T: Unpin>() {} + | ^^^^^ required by this bound in `is_unpin` + +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` error[E0599]: no method named `project` found for struct `Pin<&mut A>` in the current scope - --> $DIR/remove-attr-from-struct.rs:39:30 + --> tests/ui/pin_project/remove-attr-from-struct.rs:40:30 | -39 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 +40 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 | ^^^^^^^ method not found in `Pin<&mut A>` error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/remove-attr-from-struct.rs:42:13 - | -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` + --> 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` error[E0599]: no method named `project` found for struct `Pin<&mut B>` in the current scope - --> $DIR/remove-attr-from-struct.rs:42:30 + --> tests/ui/pin_project/remove-attr-from-struct.rs:43:30 | -42 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 +43 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 | ^^^^^^^ method not found in `Pin<&mut B>` diff --git a/tests/ui/pin_project/safe_packed_borrows.rs b/tests/ui/pin_project/safe_packed_borrows.rs index db4ac2d..de8181c 100644 --- a/tests/ui/pin_project/safe_packed_borrows.rs +++ b/tests/ui/pin_project/safe_packed_borrows.rs @@ -1,21 +1,26 @@ -#![forbid(safe_packed_borrows)] +#![deny(renamed_and_removed_lints)] +#![deny(safe_packed_borrows)] //~ ERROR has been renamed to `unaligned_references` +#![allow(unaligned_references)] -// Refs: https://github.com/rust-lang/rust/issues/46043 +// This lint was removed in https://github.com/rust-lang/rust/pull/82525 (nightly-2021-03-28). +// Refs: +// - https://github.com/rust-lang/rust/pull/82525 +// - https://github.com/rust-lang/rust/issues/46043 #[repr(packed)] -struct A { +struct Packed { f: u32, } #[repr(packed(2))] -struct B { +struct PackedN { f: u32, } fn main() { - let a = A { f: 1 }; - &a.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block + let a = Packed { f: 1 }; + let _ = &a.f; - let b = B { f: 1 }; - &b.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block + let b = PackedN { f: 1 }; + let _ = &b.f; } diff --git a/tests/ui/pin_project/safe_packed_borrows.stderr b/tests/ui/pin_project/safe_packed_borrows.stderr index c1f734a..f483b6d 100644 --- a/tests/ui/pin_project/safe_packed_borrows.stderr +++ b/tests/ui/pin_project/safe_packed_borrows.stderr @@ -1,24 +1,11 @@ -error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) - --> $DIR/safe_packed_borrows.rs:17:5 - | -17 | &a.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block - | ^^^^ - | +error: lint `safe_packed_borrows` has been renamed to `unaligned_references` + --> tests/ui/pin_project/safe_packed_borrows.rs:2:9 + | +2 | #![deny(safe_packed_borrows)] //~ ERROR has been renamed to `unaligned_references` + | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `unaligned_references` + | note: the lint level is defined here - --> $DIR/safe_packed_borrows.rs:1: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 + --> tests/ui/pin_project/safe_packed_borrows.rs:1:9 + | +1 | #![deny(renamed_and_removed_lints)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/pin_project/unaligned_references.rs b/tests/ui/pin_project/unaligned_references.rs new file mode 100644 index 0000000..eaf185d --- /dev/null +++ b/tests/ui/pin_project/unaligned_references.rs @@ -0,0 +1,21 @@ +#![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 new file mode 100644 index 0000000..8d5ddfc --- /dev/null +++ b/tests/ui/pin_project/unaligned_references.stderr @@ -0,0 +1,26 @@ +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 ab5e794..ddf700d 100644 --- a/tests/ui/pin_project/unpin_sneaky.stderr +++ b/tests/ui/pin_project/unpin_sneaky.stderr @@ -1,11 +1,11 @@ error[E0412]: cannot find type `__S` in this scope - --> $DIR/unpin_sneaky.rs:9:16 + --> tests/ui/pin_project/unpin_sneaky.rs:9:16 | 9 | impl Unpin for __S {} //~ ERROR E0412,E0321 | ^^^ not found in this scope error[E0321]: cross-crate traits with a default impl, like `Unpin`, can only be implemented for a struct/enum type, not `[type error]` - --> $DIR/unpin_sneaky.rs:9:1 + --> tests/ui/pin_project/unpin_sneaky.rs:9:1 | 9 | impl Unpin for __S {} //~ ERROR E0412,E0321 | ^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type diff --git a/tests/ui/pin_project/visibility.stderr b/tests/ui/pin_project/visibility.stderr index a1f0423..4d1b722 100644 --- a/tests/ui/pin_project/visibility.stderr +++ b/tests/ui/pin_project/visibility.stderr @@ -1,39 +1,39 @@ -error[E0365]: `DProj` is private, and cannot be re-exported - --> $DIR/visibility.rs:15:13 +error[E0365]: `DProj` is only public within the crate, and cannot be re-exported outside + --> tests/ui/pin_project/visibility.rs:15:13 | 15 | pub use crate::pub_::DProj; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^ re-export of private `DProj` + | ^^^^^^^^^^^^^^^^^^ re-export of crate public `DProj` | = note: consider declaring type or module `DProj` with `pub` -error[E0365]: `DProjRef` is private, and cannot be re-exported - --> $DIR/visibility.rs:17:13 +error[E0365]: `DProjRef` is only public within the crate, and cannot be re-exported outside + --> tests/ui/pin_project/visibility.rs:17:13 | 17 | pub use crate::pub_::DProjRef; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^ re-export of private `DProjRef` + | ^^^^^^^^^^^^^^^^^^^^^ re-export of crate public `DProjRef` | = note: consider declaring type or module `DProjRef` with `pub` -error[E0365]: `RProj` is private, and cannot be re-exported - --> $DIR/visibility.rs:19:13 +error[E0365]: `RProj` is only public within the crate, and cannot be re-exported outside + --> tests/ui/pin_project/visibility.rs:19:13 | 19 | pub use crate::pub_::RProj; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^ re-export of private `RProj` + | ^^^^^^^^^^^^^^^^^^ re-export of crate public `RProj` | = note: consider declaring type or module `RProj` with `pub` -error[E0365]: `RProjOwn` is private, and cannot be re-exported - --> $DIR/visibility.rs:21:13 +error[E0365]: `RProjOwn` is only public within the crate, and cannot be re-exported outside + --> tests/ui/pin_project/visibility.rs:21:13 | 21 | pub use crate::pub_::RProjOwn; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProjOwn` + | ^^^^^^^^^^^^^^^^^^^^^ re-export of crate public `RProjOwn` | = note: consider declaring type or module `RProjOwn` with `pub` -error[E0365]: `RProjRef` is private, and cannot be re-exported - --> $DIR/visibility.rs:23:13 +error[E0365]: `RProjRef` is only public within the crate, and cannot be re-exported outside + --> tests/ui/pin_project/visibility.rs:23:13 | 23 | pub use crate::pub_::RProjRef; //~ ERROR E0365 - | ^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProjRef` + | ^^^^^^^^^^^^^^^^^^^^^ re-export of crate public `RProjRef` | = note: consider declaring type or module `RProjRef` with `pub` diff --git a/tests/ui/pinned_drop/call-drop-inner.rs b/tests/ui/pinned_drop/call-drop-inner.rs index 4171ed5..9f89942 100644 --- a/tests/ui/pinned_drop/call-drop-inner.rs +++ b/tests/ui/pinned_drop/call-drop-inner.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] struct Struct { f: bool, diff --git a/tests/ui/pinned_drop/call-drop-inner.stderr b/tests/ui/pinned_drop/call-drop-inner.stderr index 53194b0..b11bee5 100644 --- a/tests/ui/pinned_drop/call-drop-inner.stderr +++ b/tests/ui/pinned_drop/call-drop-inner.stderr @@ -1,14 +1,14 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied - --> $DIR/call-drop-inner.rs:12:9 + --> tests/ui/pinned_drop/call-drop-inner.rs:13:9 | -12 | __drop_inner(__self); +13 | __drop_inner(__self); | ^^^^^^^^^^^^ ------ supplied 1 argument | | | expected 0 arguments | note: function defined here - --> $DIR/call-drop-inner.rs:9:1 + --> tests/ui/pinned_drop/call-drop-inner.rs:10:1 | -9 | #[pinned_drop] +10 | #[pinned_drop] | ^^^^^^^^^^^^^^ - = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the attribute macro `pinned_drop` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pinned_drop/conditional-drop-impl.rs b/tests/ui/pinned_drop/conditional-drop-impl.rs index fecfd50..23d756d 100644 --- a/tests/ui/pinned_drop/conditional-drop-impl.rs +++ b/tests/ui/pinned_drop/conditional-drop-impl.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + // In `Drop` impl, the implementor must specify the same requirement as type definition. struct DropImpl<T> { diff --git a/tests/ui/pinned_drop/conditional-drop-impl.stderr b/tests/ui/pinned_drop/conditional-drop-impl.stderr index 6381a29..0c55bc2 100644 --- a/tests/ui/pinned_drop/conditional-drop-impl.stderr +++ b/tests/ui/pinned_drop/conditional-drop-impl.stderr @@ -1,26 +1,30 @@ error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not - --> $DIR/conditional-drop-impl.rs:10:9 + --> tests/ui/pinned_drop/conditional-drop-impl.rs:11:9 | -10 | impl<T: Unpin> Drop for DropImpl<T> { +11 | impl<T: Unpin> Drop for DropImpl<T> { | ^^^^^ | note: the implementor must specify the same requirement - --> $DIR/conditional-drop-impl.rs:6:1 + --> tests/ui/pinned_drop/conditional-drop-impl.rs:7:1 | -6 | / struct DropImpl<T> { -7 | | f: T, -8 | | } +7 | / struct DropImpl<T> { +8 | | f: T, +9 | | } | |_^ error[E0277]: `T` cannot be unpinned - --> $DIR/conditional-drop-impl.rs:15:15 + --> tests/ui/pinned_drop/conditional-drop-impl.rs:16:15 | -15 | #[pin_project(PinnedDrop)] //~ ERROR E0277 +16 | #[pin_project(PinnedDrop)] //~ ERROR E0277 | ^^^^^^^^^^ the trait `Unpin` is not implemented for `T` | - = note: required because of the requirements on the impl of `PinnedDrop` for `PinnedDropImpl<T>` - = note: required by `pin_project::__private::PinnedDrop::drop` + = 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> { + | ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ help: consider restricting type parameter `T` | -16 | struct PinnedDropImpl<T: Unpin> { - | ^^^^^^^ +17 | struct PinnedDropImpl<T: std::marker::Unpin> { + | ++++++++++++++++++++ diff --git a/tests/ui/pinned_drop/forget-pinned-drop-impl.stderr b/tests/ui/pinned_drop/forget-pinned-drop-impl.stderr index 9fd7cdb..ef8a7bf 100644 --- a/tests/ui/pinned_drop/forget-pinned-drop-impl.stderr +++ b/tests/ui/pinned_drop/forget-pinned-drop-impl.stderr @@ -1,7 +1,5 @@ error[E0277]: the trait bound `Struct: PinnedDrop` is not satisfied - --> $DIR/forget-pinned-drop-impl.rs:3:15 + --> tests/ui/pinned_drop/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 3248704..464be5e 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` - --> $DIR/invalid-self.rs:8:26 + --> tests/ui/pinned_drop/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` - --> $DIR/invalid-self.rs:9:34 + --> tests/ui/pinned_drop/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 `@` - --> $DIR/invalid-self.rs:11:25 + --> tests/ui/pinned_drop/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 `@` - --> $DIR/invalid-self.rs:11:25 + --> tests/ui/pinned_drop/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 7e36750..fdadf8a 100644 --- a/tests/ui/pinned_drop/invalid.rs +++ b/tests/ui/pinned_drop/invalid.rs @@ -1,7 +1,8 @@ mod argument { - use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; + use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] struct UnexpectedArg1(()); @@ -128,9 +129,10 @@ mod assoc_item { } mod method { - use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; + use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] struct RetUnit(()); diff --git a/tests/ui/pinned_drop/invalid.stderr b/tests/ui/pinned_drop/invalid.stderr index 277a2fa..d509964 100644 --- a/tests/ui/pinned_drop/invalid.stderr +++ b/tests/ui/pinned_drop/invalid.stderr @@ -1,143 +1,143 @@ -error: unexpected token: foo - --> $DIR/invalid.rs:8:19 +error: unexpected token: `foo` + --> tests/ui/pinned_drop/invalid.rs:9:19 | -8 | #[pinned_drop(foo)] //~ ERROR unexpected token +9 | #[pinned_drop(foo)] //~ ERROR unexpected token | ^^^ error: duplicate #[pinned_drop] attribute - --> $DIR/invalid.rs:29:5 + --> tests/ui/pinned_drop/invalid.rs:30:5 | -29 | #[pinned_drop] //~ ERROR duplicate #[pinned_drop] attribute +30 | #[pinned_drop] //~ ERROR duplicate #[pinned_drop] attribute | ^^^^^^^^^^^^^^ error: #[pinned_drop] may only be used on implementation for the `PinnedDrop` trait - --> $DIR/invalid.rs:42:10 + --> tests/ui/pinned_drop/invalid.rs:43:10 | -42 | impl Drop for TraitImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait +43 | impl Drop for TraitImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait | ^^^^ error: #[pinned_drop] may only be used on implementation for the `PinnedDrop` trait - --> $DIR/invalid.rs:48:10 + --> tests/ui/pinned_drop/invalid.rs:49:10 | -48 | impl InherentImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait +49 | impl InherentImpl {} //~ ERROR may only be used on implementation for the `PinnedDrop` trait | ^^^^^^^^^^^^ error: expected `impl` - --> $DIR/invalid.rs:51:5 + --> tests/ui/pinned_drop/invalid.rs:52:5 | -51 | fn func(_: Pin<&mut ()>) {} //~ ERROR expected `impl` +52 | fn func(_: Pin<&mut ()>) {} //~ ERROR expected `impl` | ^^ error: implementing the trait `PinnedDrop` is not unsafe - --> $DIR/invalid.rs:61:5 + --> tests/ui/pinned_drop/invalid.rs:62:5 | -61 | unsafe impl PinnedDrop for Impl { +62 | unsafe impl PinnedDrop for Impl { | ^^^^^^ error: implementing the method `drop` is not unsafe - --> $DIR/invalid.rs:71:9 + --> tests/ui/pinned_drop/invalid.rs:72:9 | -71 | unsafe fn drop(self: Pin<&mut Self>) {} //~ ERROR implementing the method `drop` is not unsafe +72 | unsafe fn drop(self: Pin<&mut Self>) {} //~ ERROR implementing the method `drop` is not unsafe | ^^^^^^ error: not all trait items implemented, missing: `drop` - --> $DIR/invalid.rs:82:5 + --> tests/ui/pinned_drop/invalid.rs:83:5 | -82 | impl PinnedDrop for Empty {} //~ ERROR not all trait items implemented, missing: `drop` +83 | impl PinnedDrop for Empty {} //~ ERROR not all trait items implemented, missing: `drop` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: const `A` is not a member of trait `PinnedDrop` - --> $DIR/invalid.rs:89:9 + --> tests/ui/pinned_drop/invalid.rs:90:9 | -89 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop` +90 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop` | ^^^^^^^^^^^^^^^^ error: const `A` is not a member of trait `PinnedDrop` - --> $DIR/invalid.rs:99:9 - | -99 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop` - | ^^^^^^^^^^^^^^^^ + --> tests/ui/pinned_drop/invalid.rs:100:9 + | +100 | const A: u8 = 0; //~ ERROR const `A` is not a member of trait `PinnedDrop` + | ^^^^^^^^^^^^^^^^ error: type `A` is not a member of trait `PinnedDrop` - --> $DIR/invalid.rs:107:9 + --> tests/ui/pinned_drop/invalid.rs:108:9 | -107 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop` +108 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop` | ^^^^^^^^^^^^ error: type `A` is not a member of trait `PinnedDrop` - --> $DIR/invalid.rs:117:9 + --> tests/ui/pinned_drop/invalid.rs:118:9 | -117 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop` +118 | type A = u8; //~ ERROR type `A` is not a member of trait `PinnedDrop` | ^^^^^^^^^^^^ error: duplicate definitions with name `drop` - --> $DIR/invalid.rs:126:9 + --> tests/ui/pinned_drop/invalid.rs:127:9 | -126 | fn drop(self: Pin<&mut Self>) {} //~ ERROR duplicate definitions with name `drop` +127 | fn drop(self: Pin<&mut Self>) {} //~ ERROR duplicate definitions with name `drop` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: method `drop` must return the unit type - --> $DIR/invalid.rs:147:42 + --> tests/ui/pinned_drop/invalid.rs:149:42 | -147 | fn drop(self: Pin<&mut Self>) -> Self {} //~ ERROR method `drop` must return the unit type +149 | fn drop(self: Pin<&mut Self>) -> Self {} //~ ERROR method `drop` must return the unit type | ^^^^ error: method `drop` must take an argument `self: Pin<&mut Self>` - --> $DIR/invalid.rs:155:16 + --> tests/ui/pinned_drop/invalid.rs:157:16 | -155 | fn drop() {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +157 | fn drop() {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` | ^^ error: method `drop` must take an argument `self: Pin<&mut Self>` - --> $DIR/invalid.rs:163:17 + --> tests/ui/pinned_drop/invalid.rs:165:17 | -163 | fn drop(self: Pin<&mut Self>, _: ()) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +165 | fn drop(self: Pin<&mut Self>, _: ()) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: method `drop` must take an argument `self: Pin<&mut Self>` - --> $DIR/invalid.rs:171:17 + --> tests/ui/pinned_drop/invalid.rs:173:17 | -171 | fn drop(&mut self) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +173 | fn drop(&mut self) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` | ^^^^^^^^^ error: method `drop` must take an argument `self: Pin<&mut Self>` - --> $DIR/invalid.rs:179:17 + --> tests/ui/pinned_drop/invalid.rs:181:17 | -179 | fn drop(_: Pin<&mut Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +181 | fn drop(_: Pin<&mut Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` | ^^^^^^^^^^^^^^^^^ error: method `drop` must take an argument `self: Pin<&mut Self>` - --> $DIR/invalid.rs:187:17 + --> tests/ui/pinned_drop/invalid.rs:189:17 | -187 | fn drop(self: Pin<&Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +189 | fn drop(self: Pin<&Self>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` | ^^^^^^^^^^^^^^^^ error: method `drop` must take an argument `self: Pin<&mut Self>` - --> $DIR/invalid.rs:195:17 + --> tests/ui/pinned_drop/invalid.rs:197:17 | -195 | fn drop(self: Pin<&mut ()>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` +197 | fn drop(self: Pin<&mut ()>) {} //~ ERROR method `drop` must take an argument `self: Pin<&mut Self>` | ^^^^^^^^^^^^^^^^^^ error: method `pinned_drop` is not a member of trait `PinnedDrop - --> $DIR/invalid.rs:203:12 + --> tests/ui/pinned_drop/invalid.rs:205:12 | -203 | fn pinned_drop(self: Pin<&mut Self>) {} //~ ERROR method `pinned_drop` is not a member of trait `PinnedDrop +205 | fn pinned_drop(self: Pin<&mut Self>) {} //~ ERROR method `pinned_drop` is not a member of trait `PinnedDrop | ^^^^^^^^^^^ error: implementing the trait `PinnedDrop` on this type is unsupported - --> $DIR/invalid.rs:211:25 + --> tests/ui/pinned_drop/invalid.rs:213:25 | -211 | impl PinnedDrop for () { +213 | impl PinnedDrop for () { | ^^ error: implementing the trait `PinnedDrop` on this type is unsupported - --> $DIR/invalid.rs:217:25 + --> tests/ui/pinned_drop/invalid.rs:219:25 | -217 | impl PinnedDrop for &mut A { +219 | impl PinnedDrop for &mut A { | ^^^^^^ error: implementing the trait `PinnedDrop` on this type is unsupported - --> $DIR/invalid.rs:223:25 + --> tests/ui/pinned_drop/invalid.rs:225:25 | -223 | impl PinnedDrop for [A] { +225 | impl PinnedDrop for [A] { | ^^^ diff --git a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs index f9db79c..391f290 100644 --- a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs +++ b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project] struct S { #[pin] diff --git a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr index 6f868bf..2542254 100644 --- a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr +++ b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr @@ -1,8 +1,8 @@ -error[E0119]: conflicting implementations of trait `pin_project::__private::PinnedDrop` for type `S`: - --> $DIR/pinned-drop-no-attr-arg.rs:11:1 +error[E0119]: conflicting implementations of trait `_::_pin_project::__private::PinnedDrop` for type `S` + --> tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs:12:1 | -4 | #[pin_project] +5 | #[pin_project] | -------------- first implementation here ... -11 | impl PinnedDrop for S { +12 | impl PinnedDrop for S { | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S` diff --git a/tests/ui/pinned_drop/self.rs b/tests/ui/pinned_drop/self.rs index 03825ca..ff63402 100644 --- a/tests/ui/pinned_drop/self.rs +++ b/tests/ui/pinned_drop/self.rs @@ -1,7 +1,8 @@ pub mod self_in_macro_def { - use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; + use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] pub struct S { f: (), @@ -23,9 +24,10 @@ pub mod self_in_macro_def { } pub mod self_span { - use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; + use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] pub struct S { f: (), diff --git a/tests/ui/pinned_drop/self.stderr b/tests/ui/pinned_drop/self.stderr index edab117..0f96dc9 100644 --- a/tests/ui/pinned_drop/self.stderr +++ b/tests/ui/pinned_drop/self.stderr @@ -1,42 +1,42 @@ error: `self` parameter is only allowed in associated functions - --> $DIR/self.rs:17:26 + --> tests/ui/pinned_drop/self.rs:18:26 | -17 | fn f(self: ()) {} //~ ERROR `self` parameter is only allowed in associated functions +18 | fn f(self: ()) {} //~ ERROR `self` parameter is only allowed in associated functions | ^^^^ not semantically valid as function parameter ... -20 | t!(); - | ----- in this macro invocation +21 | t!(); + | ---- in this macro invocation | = note: associated functions are those in `impl` or `trait` definitions - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/self.rs:15:29 + --> tests/ui/pinned_drop/self.rs:16:29 | -15 | let _ = self; //~ ERROR E0434 +16 | let _ = self; //~ ERROR E0434 | ^^^^ ... -20 | t!(); - | ----- in this macro invocation +21 | t!(); + | ---- in this macro invocation | = help: use the `|| { ... }` closure form instead - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `t` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0423]: expected value, found struct `S` - --> $DIR/self.rs:38:27 + --> tests/ui/pinned_drop/self.rs:40:27 | -30 | / pub struct S { -31 | | f: (), -32 | | } +32 | / pub struct S { +33 | | f: (), +34 | | } | |_____- `S` defined here ... -38 | let _: Self = Self; //~ ERROR E0423 +40 | let _: Self = Self; //~ ERROR E0423 | ^^^^ help: use struct literal syntax instead: `S { f: val }` error[E0308]: mismatched types - --> $DIR/self.rs:37:25 + --> tests/ui/pinned_drop/self.rs:39:25 | -37 | let _: () = self; //~ ERROR E0308 +39 | let _: () = self; //~ ERROR E0308 | -- ^^^^ expected `()`, found struct `Pin` | | | expected due to this @@ -45,9 +45,9 @@ error[E0308]: mismatched types found struct `Pin<&mut self_span::S>` error[E0308]: mismatched types - --> $DIR/self.rs:50:25 + --> tests/ui/pinned_drop/self.rs:52:25 | -50 | let _: () = self; //~ ERROR E0308 +52 | let _: () = self; //~ ERROR E0308 | -- ^^^^ expected `()`, found struct `Pin` | | | expected due to this @@ -56,7 +56,7 @@ error[E0308]: mismatched types found struct `Pin<&mut E>` error[E0533]: expected unit struct, unit variant or constant, found struct variant `Self::V` - --> $DIR/self.rs:51:27 + --> tests/ui/pinned_drop/self.rs:53:27 | -51 | let _: Self = Self::V; //~ ERROR E0533 +53 | let _: Self = Self::V; //~ ERROR E0533 | ^^^^^^^ diff --git a/tests/ui/pinned_drop/unsafe-call.rs b/tests/ui/pinned_drop/unsafe-call.rs index 7faf0fa..3ee2b56 100644 --- a/tests/ui/pinned_drop/unsafe-call.rs +++ b/tests/ui/pinned_drop/unsafe-call.rs @@ -1,6 +1,7 @@ -use pin_project::{pin_project, pinned_drop}; use std::pin::Pin; +use pin_project::{pin_project, pinned_drop}; + #[pin_project(PinnedDrop)] struct S { #[pin] diff --git a/tests/ui/pinned_drop/unsafe-call.stderr b/tests/ui/pinned_drop/unsafe-call.stderr index cd5e572..9f7dd44 100644 --- a/tests/ui/pinned_drop/unsafe-call.stderr +++ b/tests/ui/pinned_drop/unsafe-call.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-call.rs:13:9 + --> tests/ui/pinned_drop/unsafe-call.rs:14:9 | -13 | self.project().f.get_unchecked_mut(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block [E0133] +14 | self.project().f.get_unchecked_mut(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block [E0133] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/tests/ui/unsafe_unpin/conflict-unpin.stderr b/tests/ui/unsafe_unpin/conflict-unpin.stderr index 916c3f2..20d4e08 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<_, _>`: - --> $DIR/conflict-unpin.rs:3:15 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>` + --> tests/ui/unsafe_unpin/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<_, _>`: - --> $DIR/conflict-unpin.rs:12:15 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>` + --> tests/ui/unsafe_unpin/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<_, _>`: - --> $DIR/conflict-unpin.rs:21:15 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>` + --> tests/ui/unsafe_unpin/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 127cd1a..542250b 100644 --- a/tests/ui/unstable-features/marker_trait_attr-feature-gate.rs +++ b/tests/ui/unstable-features/marker_trait_attr-feature-gate.rs @@ -1,8 +1,9 @@ // Note: If you change this test, change 'marker_trait_attr.rs' at the same time. -use pin_project::pin_project; use std::marker::PhantomPinned; +use pin_project::pin_project; + #[pin_project] //~ ERROR E0119 struct Struct<T> { #[pin] diff --git a/tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr b/tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr index bab534b..3412f2e 100644 --- a/tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr +++ b/tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr @@ -1,10 +1,10 @@ -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`: - --> $DIR/marker_trait_attr-feature-gate.rs:6:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>` + --> tests/ui/unstable-features/marker_trait_attr-feature-gate.rs:7:1 | -6 | #[pin_project] //~ ERROR E0119 +7 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>` ... -13 | impl<T> Unpin for Struct<T> {} +14 | impl<T> Unpin for Struct<T> {} | --------------------------- first implementation here | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = 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/unstable-features/marker_trait_attr.rs b/tests/ui/unstable-features/marker_trait_attr.rs index d6eab21..9c8e664 100644 --- a/tests/ui/unstable-features/marker_trait_attr.rs +++ b/tests/ui/unstable-features/marker_trait_attr.rs @@ -6,9 +6,10 @@ // See https://github.com/taiki-e/pin-project/issues/105#issuecomment-535355974 -use pin_project::pin_project; use std::marker::PhantomPinned; +use pin_project::pin_project; + #[pin_project] //~ ERROR E0119 struct Struct<T> { #[pin] diff --git a/tests/ui/unstable-features/marker_trait_attr.stderr b/tests/ui/unstable-features/marker_trait_attr.stderr index 9b3ec57..2b68c80 100644 --- a/tests/ui/unstable-features/marker_trait_attr.stderr +++ b/tests/ui/unstable-features/marker_trait_attr.stderr @@ -1,10 +1,10 @@ -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`: - --> $DIR/marker_trait_attr.rs:12:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>` + --> tests/ui/unstable-features/marker_trait_attr.rs:13:1 | -12 | #[pin_project] //~ ERROR E0119 +13 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>` ... -19 | impl<T> Unpin for Struct<T> {} +20 | impl<T> Unpin for Struct<T> {} | --------------------------- first implementation here | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = 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/unstable-features/overlapping_marker_traits-feature-gate.rs b/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs index 9d1b8b8..012c870 100644 --- a/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs +++ b/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs @@ -1,8 +1,9 @@ // Note: If you change this test, change 'overlapping_marker_traits.rs' at the same time. -use pin_project::pin_project; use std::marker::PhantomPinned; +use pin_project::pin_project; + #[pin_project] //~ ERROR E0119 struct Struct<T> { #[pin] diff --git a/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.stderr b/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.stderr index 4a8e238..918d804 100644 --- a/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.stderr +++ b/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.stderr @@ -1,10 +1,10 @@ -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`: - --> $DIR/overlapping_marker_traits-feature-gate.rs:6:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>` + --> tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs:7:1 | -6 | #[pin_project] //~ ERROR E0119 +7 | #[pin_project] //~ ERROR E0119 | ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>` ... -13 | impl<T> Unpin for Struct<T> {} +14 | impl<T> Unpin for Struct<T> {} | --------------------------- first implementation here | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = 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/unstable-features/overlapping_marker_traits.rs b/tests/ui/unstable-features/overlapping_marker_traits.rs index 0e0cddd..8dc27c1 100644 --- a/tests/ui/unstable-features/overlapping_marker_traits.rs +++ b/tests/ui/unstable-features/overlapping_marker_traits.rs @@ -3,16 +3,17 @@ // This feature could break the guarantee for Unpin provided by pin-project, // but was removed in https://github.com/rust-lang/rust/pull/68544 (nightly-2020-02-06). // Refs: -// * https://github.com/rust-lang/rust/issues/29864#issuecomment-515780867. -// * https://github.com/taiki-e/pin-project/issues/105 +// - https://github.com/rust-lang/rust/issues/29864#issuecomment-515780867 +// - https://github.com/taiki-e/pin-project/issues/105 // overlapping_marker_traits // Tracking issue: https://github.com/rust-lang/rust/issues/29864 #![feature(overlapping_marker_traits)] -use pin_project::pin_project; use std::marker::PhantomPinned; +use pin_project::pin_project; + #[pin_project] struct Struct<T> { #[pin] diff --git a/tests/ui/unstable-features/overlapping_marker_traits.stderr b/tests/ui/unstable-features/overlapping_marker_traits.stderr index 91aaf6c..3e8411d 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 - --> $DIR/overlapping_marker_traits.rs:11:12 + --> tests/ui/unstable-features/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<_>`: - --> $DIR/overlapping_marker_traits.rs:16:1 +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>` + --> tests/ui/unstable-features/overlapping_marker_traits.rs:17:1 | -16 | #[pin_project] +17 | #[pin_project] | ^^^^^^^^^^^^^^ conflicting implementation for `Struct<_>` ... -23 | impl<T> Unpin for Struct<T> {} +24 | impl<T> Unpin for Struct<T> {} | --------------------------- first implementation here | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = 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/unstable-features/trivial_bounds-bug.rs b/tests/ui/unstable-features/trivial_bounds-bug.rs deleted file mode 100644 index 5e821c4..0000000 --- a/tests/ui/unstable-features/trivial_bounds-bug.rs +++ /dev/null @@ -1,33 +0,0 @@ -// 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 deleted file mode 100644 index fff09f9..0000000 --- a/tests/ui/unstable-features/trivial_bounds-bug.stderr +++ /dev/null @@ -1,5 +0,0 @@ -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 dd151b0..2e31658 100644 --- a/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr +++ b/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr @@ -1,45 +1,59 @@ error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/trivial_bounds-feature-gate.rs:8:5 + --> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:8:28 | 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 - --> $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 + --> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:16:28 | 16 | impl Unpin for B where Wrapper<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` +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 | - = note: required because of the requirements on the impl of `Unpin` for `phantom_pinned::Wrapper<PhantomPinned>` +12 | impl<T> Unpin for Wrapper<T> where T: Unpin {} + | ^^^^^ ^^^^^^^^^^ = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/trivial_bounds-feature-gate.rs:34:5 + --> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:34:28 | 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: required because it appears within the type `Inner` + = 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); + | ^^^^^ = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/trivial_bounds-feature-gate.rs:42:5 + --> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:42:28 | 42 | impl Unpin for B where Wrapper<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 of the requirements on the impl of `Unpin` for `inner::Wrapper<Inner>` + --> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:38:13 | - = note: required because it appears within the type `Inner` - = note: required because of the requirements on the impl of `Unpin` for `inner::Wrapper<Inner>` +38 | impl<T> Unpin for Wrapper<T> where T: Unpin {} + | ^^^^^ ^^^^^^^^^^ = 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 2323bab..41f885d 100644 --- a/tests/ui/unstable-features/trivial_bounds.rs +++ b/tests/ui/unstable-features/trivial_bounds.rs @@ -10,25 +10,29 @@ use std::marker::{PhantomData, PhantomPinned}; fn inner() { struct Inner(PhantomPinned); - struct A(Inner); + struct A(PhantomPinned); - impl Unpin for A where Inner: Unpin {} //~ ERROR std::marker::Unpin does not depend on any type or lifetime parameters + 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 struct Wrapper<T>(T); impl<T> Unpin for Wrapper<T> where T: Unpin {} - struct B(Inner); + struct C(Inner); - impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR std::marker::Unpin does not depend on any type or lifetime parameters + impl Unpin for C where Wrapper<Inner>: Unpin {} //~ ERROR 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 C(Inner); + struct D(Inner); - impl<'a> Unpin for C where WrapperWithLifetime<'a, Inner>: Unpin {} // Ok + impl<'a> Unpin for D 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 6a3bb94..23f45c7 100644 --- a/tests/ui/unstable-features/trivial_bounds.stderr +++ b/tests/ui/unstable-features/trivial_bounds.stderr @@ -1,17 +1,23 @@ -error: Trait bound Inner: Unpin does not depend on any type or lifetime parameters - --> $DIR/trivial_bounds.rs:15:35 +error: trait bound PhantomPinned: Unpin does not depend on any type or lifetime parameters + --> tests/ui/unstable-features/trivial_bounds.rs:15:43 | -15 | impl Unpin for A where Inner: Unpin {} //~ ERROR std::marker::Unpin does not depend on any type or lifetime parameters - | ^^^^^ +15 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters + | ^^^^^ | note: the lint level is defined here - --> $DIR/trivial_bounds.rs:6:9 + --> tests/ui/unstable-features/trivial_bounds.rs:6:9 | 6 | #![deny(trivial_bounds)] | ^^^^^^^^^^^^^^ -error: Trait bound Wrapper<Inner>: Unpin does not depend on any type or lifetime parameters - --> $DIR/trivial_bounds.rs:23:44 +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 | -23 | impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR std::marker::Unpin does not depend on any type or lifetime parameters +27 | impl Unpin for C where Wrapper<Inner>: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters | ^^^^^ |