aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid LeGare <legare@google.com>2022-03-03 17:23:26 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-03 17:23:26 +0000
commitc9920d7cdd482613fb6c77f8d4f6c08d0e4ace71 (patch)
tree7fcd35ff92b7d412fdee86b26ca803e64cf1df60
parentc9e9198c875859f1c39364f957c689523f783d88 (diff)
parent97174d06e99fa6c8332d88be9224d612439b3e20 (diff)
downloadpin-project-lite-android13-mainline-uwb-release.tar.gz
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/pin-project-lite/+/2004420 Change-Id: I767070e63c39788faf3fc15915bdbd836a92fdee
-rw-r--r--.cargo_vcs_info.json7
-rw-r--r--Android.bp2
-rw-r--r--CHANGELOG.md47
-rw-r--r--Cargo.toml16
-rw-r--r--Cargo.toml.orig19
-rw-r--r--METADATA10
-rw-r--r--src/lib.rs910
-rw-r--r--tests/README.md46
-rw-r--r--tests/compiletest.rs4
-rw-r--r--tests/expand/README.md17
-rw-r--r--tests/expand/default/enum.expanded.rs10
-rw-r--r--tests/expand/multifields/enum.expanded.rs12
-rw-r--r--tests/expand/multifields/struct.expanded.rs12
-rw-r--r--tests/expand/naming/enum-all.expanded.rs10
-rw-r--r--tests/expand/naming/struct-all.expanded.rs10
-rw-r--r--tests/lint.rs26
-rw-r--r--tests/test.rs27
-rw-r--r--tests/ui/pin_project/conflict-drop.stderr2
-rw-r--r--tests/ui/pin_project/conflict-unpin.stderr6
-rw-r--r--tests/ui/pin_project/invalid-bounds.stderr132
-rw-r--r--tests/ui/pin_project/invalid.stderr14
-rw-r--r--tests/ui/pin_project/overlapping_lifetime_names.stderr54
-rw-r--r--tests/ui/pin_project/overlapping_unpin_struct.stderr23
-rw-r--r--tests/ui/pin_project/packed.stderr10
-rw-r--r--tests/ui/pin_project/unpin_sneaky.stderr4
-rw-r--r--tests/ui/pin_project/unsupported.stderr26
-rw-r--r--tests/ui/pinned_drop/call-drop-inner.stderr4
-rw-r--r--tests/ui/pinned_drop/conditional-drop-impl.stderr8
28 files changed, 664 insertions, 804 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 2ad3c7d..5b410f1 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,6 @@
{
"git": {
- "sha1": "d21bbea70a60718cc2ff67dc0e6a4049126ff9e6"
- }
-}
+ "sha1": "f405b4b063ec2a2cdc9e456aa737882ee4915ddd"
+ },
+ "path_in_vcs": ""
+} \ No newline at end of file
diff --git a/Android.bp b/Android.bp
index 96f9cd6..8c1a4a9 100644
--- a/Android.bp
+++ b/Android.bp
@@ -44,7 +44,7 @@ rust_library {
host_supported: true,
crate_name: "pin_project_lite",
cargo_env_compat: true,
- cargo_pkg_version: "0.2.7",
+ cargo_pkg_version: "0.2.8",
srcs: ["src/lib.rs"],
edition: "2018",
apex_available: [
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aaa107b..8e4d653 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,13 +10,17 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [Unreleased]
+## [0.2.8] - 2021-12-31
+
+- Fix handling of trailing commas in `PinnedDrop` impl. ([#64](https://github.com/taiki-e/pin-project-lite/pull/64), thanks @Michael-J-Ward)
+
## [0.2.7] - 2021-06-26
- [Support custom Drop implementation.](https://github.com/taiki-e/pin-project-lite/pull/25) See [#25](https://github.com/taiki-e/pin-project-lite/pull/25) for details.
## [0.2.6] - 2021-03-04
-- [Support item attributes in any order.](https://github.com/taiki-e/pin-project-lite/pull/57)
+- Support item attributes in any order. ([#57](https://github.com/taiki-e/pin-project-lite/pull/57), thanks @SabrinaJewson)
## [0.2.5] - 2021-03-02
@@ -24,31 +28,31 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [0.2.4] - 2021-01-11
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
-- [Add `project_replace`.](https://github.com/taiki-e/pin-project-lite/pull/43)
+- Add `project_replace`. ([#43](https://github.com/taiki-e/pin-project-lite/pull/43), thanks @Marwes)
## [0.2.3] - 2021-01-09
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- [Suppress `clippy::unknown_clippy_lints` lint in generated code.](https://github.com/taiki-e/pin-project-lite/pull/47)
## [0.2.2] - 2021-01-09
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- [Suppress `clippy::ref_option_ref` lint in generated code.](https://github.com/taiki-e/pin-project-lite/pull/45)
## [0.2.1] - 2021-01-05
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- Exclude unneeded files from crates.io.
## [0.2.0] - 2020-11-13
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- [`pin_project!` macro now supports enums.](https://github.com/taiki-e/pin-project-lite/pull/28)
@@ -105,7 +109,7 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [0.1.11] - 2020-10-20
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- Suppress `clippy::redundant_pub_crate` lint in generated code.
@@ -113,19 +117,19 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [0.1.10] - 2020-10-01
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- Suppress `drop_bounds` lint, which will be added to rustc in the future. See [taiki-e/pin-project#272](https://github.com/taiki-e/pin-project/issues/272) for more details.
## [0.1.9] - 2020-09-29
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- [Fix trailing comma support in generics.](https://github.com/taiki-e/pin-project-lite/pull/32)
## [0.1.8] - 2020-09-26
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- [Fix compatibility of generated code with `forbid(future_incompatible)`.](https://github.com/taiki-e/pin-project-lite/pull/30)
@@ -134,7 +138,7 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [0.1.7] - 2020-06-04
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- [Support `?Sized` bounds in where clauses.](https://github.com/taiki-e/pin-project-lite/pull/22)
@@ -146,7 +150,7 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [0.1.6] - 2020-05-31
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- [Support lifetime bounds in where clauses.](https://github.com/taiki-e/pin-project-lite/pull/18)
@@ -154,41 +158,42 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [0.1.5] - 2020-05-07
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- [Support overwriting the name of `core` crate.](https://github.com/taiki-e/pin-project-lite/pull/14)
## [0.1.4] - 2020-01-20
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- [Support ?Sized bounds in generic parameters.](https://github.com/taiki-e/pin-project-lite/pull/9)
## [0.1.3] - 2020-01-20
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- [Support lifetime bounds in generic parameters.](https://github.com/taiki-e/pin-project-lite/pull/7)
## [0.1.2] - 2020-01-05
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
-- [Support recognizing default generic parameters.](https://github.com/taiki-e/pin-project-lite/pull/6)
+- Support recognizing default generic parameters. ([#6](https://github.com/taiki-e/pin-project-lite/pull/6), thanks @kennytm)
## [0.1.1] - 2019-11-15
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
- [`pin_project!` macro now determines the visibility of the projection type/method is based on the original type.](https://github.com/taiki-e/pin-project-lite/pull/5)
## [0.1.0] - 2019-10-22
-**Note: This release has been yanked.** See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
+**NOTE:** This release has been yanked. See [#55](https://github.com/taiki-e/pin-project-lite/pull/55) for details.
Initial release
-[Unreleased]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.7...HEAD
+[Unreleased]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.8...HEAD
+[0.2.8]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.7...v0.2.8
[0.2.7]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.6...v0.2.7
[0.2.6]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.5...v0.2.6
[0.2.5]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.4...v0.2.5
diff --git a/Cargo.toml b/Cargo.toml
index fab9dbc..563806a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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-lite"
-version = "0.2.7"
-authors = ["Taiki Endo <te316e89@gmail.com>"]
+version = "0.2.8"
exclude = ["/.*", "/tools"]
description = "A lightweight version of pin-project written with declarative macros.\n"
-documentation = "https://docs.rs/pin-project-lite"
keywords = ["pin", "macros"]
categories = ["no-std", "rust-patterns"]
license = "Apache-2.0 OR MIT"
@@ -34,4 +32,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 c22afad..e60195d 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,11 +1,10 @@
[package]
name = "pin-project-lite"
-version = "0.2.7"
-authors = ["Taiki Endo <te316e89@gmail.com>"]
+version = "0.2.8"
edition = "2018"
+rust-version = "1.37"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/taiki-e/pin-project-lite"
-documentation = "https://docs.rs/pin-project-lite"
keywords = ["pin", "macros"]
categories = ["no-std", "rust-patterns"]
exclude = ["/.*", "/tools"]
@@ -13,14 +12,18 @@ description = """
A lightweight version of pin-project written with declarative macros.
"""
+[package.metadata.docs.rs]
+targets = ["x86_64-unknown-linux-gnu"]
+
[workspace]
-members = ["tests/doc", "tests/no-core", "tests/no-std"]
+members = [
+ "tests/doc",
+ "tests/no-core",
+ "tests/no-std",
+]
[dev-dependencies]
macrotest = "1.0.8"
rustversion = "1"
static_assertions = "1"
-trybuild = "1"
-
-[package.metadata.docs.rs]
-targets = ["x86_64-unknown-linux-gnu"]
+trybuild = "1.0.49"
diff --git a/METADATA b/METADATA
index e34ef99..077ddb1 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/pin-project-lite/pin-project-lite-0.2.7.crate"
+ value: "https://static.crates.io/crates/pin-project-lite/pin-project-lite-0.2.8.crate"
}
- version: "0.2.7"
+ version: "0.2.8"
license_type: NOTICE
last_upgrade_date {
- year: 2021
- month: 8
- day: 9
+ year: 2022
+ month: 3
+ day: 1
}
}
diff --git a/src/lib.rs b/src/lib.rs
index db48b92..ddd49aa 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -38,7 +38,7 @@
//! #[project = EnumProj]
//! enum Enum<T, U> {
//! Variant { #[pin] pinned: T, unpinned: U },
-//! }
+//! }
//! }
//!
//! impl<T, U> Enum<T, U> {
@@ -102,7 +102,7 @@
allow(dead_code, unused_variables)
)
))]
-#![warn(future_incompatible, rust_2018_idioms, single_use_lifetimes, unreachable_pub)]
+#![warn(rust_2018_idioms, single_use_lifetimes, unreachable_pub)]
#![warn(clippy::default_trait_access, clippy::wildcard_imports)]
// ANDROID: Use std to allow building as a dylib.
@@ -112,8 +112,8 @@ extern crate std;
///
/// This macro creates a projection type according to the following rules:
///
-/// * For the field that uses `#[pin]` attribute, makes the pinned reference to the field.
-/// * For the other fields, makes the unpinned reference to the field.
+/// - For the field that uses `#[pin]` attribute, makes the pinned reference to the field.
+/// - For the other fields, makes the unpinned reference to the field.
///
/// And the following methods are implemented on the original type:
///
@@ -301,86 +301,115 @@ macro_rules! pin_project {
}
// limitations:
-// * no support for tuple structs and tuple variant (wontfix).
-// * no support for multiple trait/lifetime bounds.
-// * no support for `Self` in where clauses. (wontfix)
-// * no support for overlapping lifetime names. (wontfix)
-// * no interoperability with other field attributes.
-// * no useful error messages. (wontfix)
+// - no support for tuple structs and tuple variant (wontfix).
+// - no support for multiple trait/lifetime bounds.
+// - no support for `Self` in where clauses. (wontfix)
+// - no support for overlapping lifetime names. (wontfix)
+// - no interoperability with other field attributes.
+// - no useful error messages. (wontfix)
// etc...
// Not public API.
#[doc(hidden)]
#[macro_export]
macro_rules! __pin_project_internal {
+ // macro helpers
+ // ignores any projection without a projection identity
+ (@make_proj_ty;
+ [] // no identity given, so we ignore the projection
+ $($field:tt)*
+ ) => {};
+ // ignores make_proj_replace_ty without a projection identity
+ (@make_proj_replace_ty;
+ [] // no identity given, so we ignore the projection
+ $($field:tt)*
+ ) => {};
+ (@$struct_ty_ident:ident=>make_proj_method;
+ []
+ $($variant:tt)*
+ ) => {};
+ (@$struct_ty_ident:ident=>make_proj_replace_method;
+ []
+ $($field:tt)*
+ ) => {};
// =============================================================================================
// struct:main
- (@struct=>internal;
+ (@expand;
[$($proj_mut_ident:ident)?]
[$($proj_ref_ident:ident)?]
[$($proj_replace_ident:ident)?]
[$proj_vis:vis]
- [$(#[$attrs:meta])* $vis:vis struct $ident:ident]
+ [$(#[$attrs:meta])* $vis:vis $struct_ty_ident:ident $ident:ident]
[$($def_generics:tt)*]
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
{
- $(
- $(#[$pin:ident])?
- $field_vis:vis $field:ident: $field_ty:ty
- ),+
+ $($body_data:tt)*
}
$(impl $($pinned_drop:tt)*)?
) => {
- $(#[$attrs])*
- $vis struct $ident $($def_generics)*
- $(where
- $($where_clause)*)?
- {
- $(
- $field_vis $field: $field_ty
- ),+
+ $crate::__pin_project_internal! { @reconstruct;
+ [$(#[$attrs])* $vis $struct_ty_ident $ident]
+ [$($def_generics)*] [$($impl_generics)*]
+ [$($ty_generics)*] [$(where $($where_clause)*)?]
+ {
+ $($body_data)*
+ }
}
- $crate::__pin_project_internal! { @struct=>make_proj_ty=>named;
- [$proj_vis]
+ $crate::__pin_project_internal! { @make_proj_ty;
[$($proj_mut_ident)?]
+ [$proj_vis $struct_ty_ident $ident]
[make_proj_field_mut]
- [$ident]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
{
- $(
- $(#[$pin])?
- $field_vis $field: $field_ty
- ),+
+ $($body_data)*
}
}
- $crate::__pin_project_internal! { @struct=>make_proj_ty=>named;
- [$proj_vis]
+ $crate::__pin_project_internal! { @make_proj_ty;
[$($proj_ref_ident)?]
+ [$proj_vis $struct_ty_ident $ident]
[make_proj_field_ref]
- [$ident]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
{
- $(
- $(#[$pin])?
- $field_vis $field: $field_ty
- ),+
+ $($body_data)*
}
}
- $crate::__pin_project_internal! { @struct=>make_proj_replace_ty=>named;
- [$proj_vis]
+ $crate::__pin_project_internal! { @make_proj_replace_ty;
[$($proj_replace_ident)?]
+ [$proj_vis $struct_ty_ident]
[make_proj_field_replace]
- [$ident]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
- [$(impl $($pinned_drop)*)?]
{
- $(
- $(#[$pin])?
- $field_vis $field: $field_ty
- ),+
+ $($body_data)*
+ }
+ }
+
+ $crate::__pin_project_internal! { @constant;
+ [$(#[$attrs])* $vis $struct_ty_ident $ident]
+ [$($proj_mut_ident)?] [$($proj_ref_ident)?] [$($proj_replace_ident)?]
+ [$proj_vis]
+ [$($def_generics)*] [$($impl_generics)*]
+ [$($ty_generics)*] [$(where $($where_clause)*)?]
+ {
+ $($body_data)*
}
+ $(impl $($pinned_drop)*)?
+ }
+ };
+ (@constant;
+ [$(#[$attrs:meta])* $vis:vis struct $ident:ident]
+ [$($proj_mut_ident:ident)?] [$($proj_ref_ident:ident)?] [$($proj_replace_ident:ident)?]
+ [$proj_vis:vis]
+ [$($def_generics:tt)*]
+ [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
+ {
+ $(
+ $(#[$pin:ident])?
+ $field_vis:vis $field:ident: $field_ty:ty
+ ),+ $(,)?
}
+ $(impl $($pinned_drop:tt)*)?
+ ) => {
#[allow(explicit_outlives_requirements)] // https://github.com/rust-lang/rust/issues/60993
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
@@ -390,11 +419,10 @@ macro_rules! __pin_project_internal {
#[allow(clippy::redundant_pub_crate)] // This lint warns `pub(crate)` field in private struct.
#[allow(clippy::used_underscore_binding)]
const _: () = {
- $crate::__pin_project_internal! { @struct=>make_proj_ty=>unnamed;
- [$proj_vis]
- [$($proj_mut_ident)?][Projection]
+ $crate::__pin_project_internal! { @make_proj_ty;
+ [$($proj_mut_ident)? Projection]
+ [$proj_vis struct $ident]
[make_proj_field_mut]
- [$ident]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
{
$(
@@ -403,26 +431,11 @@ macro_rules! __pin_project_internal {
),+
}
}
- $crate::__pin_project_internal! { @struct=>make_proj_ty=>unnamed;
- [$proj_vis]
- [$($proj_ref_ident)?][ProjectionRef]
+ $crate::__pin_project_internal! { @make_proj_ty;
+ [$($proj_ref_ident)? ProjectionRef]
+ [$proj_vis struct $ident]
[make_proj_field_ref]
- [$ident]
- [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
- {
- $(
- $(#[$pin])?
- $field_vis $field: $field_ty
- ),+
- }
- }
- $crate::__pin_project_internal! { @struct=>make_proj_replace_ty=>unnamed;
- [$proj_vis]
- [$($proj_replace_ident)?][ProjectionReplace]
- [make_proj_field_replace]
- [$ident]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
- [$(impl $($pinned_drop)*)?]
{
$(
$(#[$pin])?
@@ -436,8 +449,8 @@ macro_rules! __pin_project_internal {
$($where_clause)*)?
{
$crate::__pin_project_internal! { @struct=>make_proj_method;
+ [$($proj_mut_ident)? Projection]
[$proj_vis]
- [$($proj_mut_ident)?][Projection]
[project get_unchecked_mut mut]
[$($ty_generics)*]
{
@@ -448,8 +461,8 @@ macro_rules! __pin_project_internal {
}
}
$crate::__pin_project_internal! { @struct=>make_proj_method;
+ [$($proj_ref_ident)? ProjectionRef]
[$proj_vis]
- [$($proj_ref_ident)?][ProjectionRef]
[project_ref get_ref]
[$($ty_generics)*]
{
@@ -460,8 +473,9 @@ macro_rules! __pin_project_internal {
}
}
$crate::__pin_project_internal! { @struct=>make_proj_replace_method;
+ [$($proj_replace_ident)?]
[$proj_vis]
- [$($proj_replace_ident)?][ProjectionReplace]
+ [ProjectionReplace]
[$($ty_generics)*]
{
$(
@@ -521,12 +535,10 @@ macro_rules! __pin_project_internal {
};
// =============================================================================================
// enum:main
- (@enum=>internal;
- [$($proj_mut_ident:ident)?]
- [$($proj_ref_ident:ident)?]
- [$($proj_replace_ident:ident)?]
- [$proj_vis:vis]
+ (@constant;
[$(#[$attrs:meta])* $vis:vis enum $ident:ident]
+ [$($proj_mut_ident:ident)?] [$($proj_ref_ident:ident)?] [$($proj_replace_ident:ident)?]
+ [$proj_vis:vis]
[$($def_generics:tt)*]
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
{
@@ -536,79 +548,12 @@ macro_rules! __pin_project_internal {
$(
$(#[$pin:ident])?
$field:ident: $field_ty:ty
- ),+
+ ),+ $(,)?
})?
- ),+
+ ),+ $(,)?
}
$(impl $($pinned_drop:tt)*)?
) => {
- $(#[$attrs])*
- $vis enum $ident $($def_generics)*
- $(where
- $($where_clause)*)?
- {
- $(
- $(#[$variant_attrs])*
- $variant $({
- $(
- $field: $field_ty
- ),+
- })?
- ),+
- }
-
- $crate::__pin_project_internal! { @enum=>make_proj_ty;
- [$proj_vis]
- [$($proj_mut_ident)?]
- [make_proj_field_mut]
- [$ident]
- [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
- {
- $(
- $variant $({
- $(
- $(#[$pin])?
- $field: $field_ty
- ),+
- })?
- ),+
- }
- }
- $crate::__pin_project_internal! { @enum=>make_proj_ty;
- [$proj_vis]
- [$($proj_ref_ident)?]
- [make_proj_field_ref]
- [$ident]
- [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
- {
- $(
- $variant $({
- $(
- $(#[$pin])?
- $field: $field_ty
- ),+
- })?
- ),+
- }
- }
- $crate::__pin_project_internal! { @enum=>make_proj_replace_ty;
- [$proj_vis]
- [$($proj_replace_ident)?]
- [make_proj_field_replace]
- [$ident]
- [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
- [$(impl $($pinned_drop)*)?]
- {
- $(
- $variant $({
- $(
- $(#[$pin])?
- $field: $field_ty
- ),+
- })?
- ),+
- }
- }
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
// This lint warns of `clippy::*` generated by external macros.
@@ -621,8 +566,8 @@ macro_rules! __pin_project_internal {
$($where_clause)*)?
{
$crate::__pin_project_internal! { @enum=>make_proj_method;
- [$proj_vis]
[$($proj_mut_ident)?]
+ [$proj_vis]
[project get_unchecked_mut mut]
[$($ty_generics)*]
{
@@ -637,8 +582,8 @@ macro_rules! __pin_project_internal {
}
}
$crate::__pin_project_internal! { @enum=>make_proj_method;
- [$proj_vis]
[$($proj_ref_ident)?]
+ [$proj_vis]
[project_ref get_ref]
[$($ty_generics)*]
{
@@ -653,8 +598,8 @@ macro_rules! __pin_project_internal {
}
}
$crate::__pin_project_internal! { @enum=>make_proj_replace_method;
- [$proj_vis]
[$($proj_replace_ident)?]
+ [$proj_vis]
[$($ty_generics)*]
{
$(
@@ -694,45 +639,66 @@ macro_rules! __pin_project_internal {
};
};
- // =============================================================================================
- // struct:make_proj_ty
- (@struct=>make_proj_ty=>unnamed;
- [$proj_vis:vis]
- [$_proj_ty_ident:ident][$proj_ty_ident:ident]
- [$make_proj_field:ident]
- [$ident:ident]
- [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
- $($field:tt)*
- ) => {};
- (@struct=>make_proj_ty=>unnamed;
- [$proj_vis:vis]
- [][$proj_ty_ident:ident]
- [$make_proj_field:ident]
- [$ident:ident]
- [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
- $($field:tt)*
+ (@reconstruct;
+ [$(#[$attrs:meta])* $vis:vis struct $ident:ident]
+ [$($def_generics:tt)*] [$($impl_generics:tt)*]
+ [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
+ {
+ $(
+ $(#[$pin:ident])?
+ $field_vis:vis $field:ident: $field_ty:ty
+ ),+ $(,)?
+ }
) => {
- $crate::__pin_project_internal! { @struct=>make_proj_ty=>named;
- [$proj_vis]
- [$proj_ty_ident]
- [$make_proj_field]
- [$ident]
- [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
- $($field)*
+ $(#[$attrs])*
+ $vis struct $ident $($def_generics)*
+ $(where
+ $($where_clause)*)?
+ {
+ $(
+ $field_vis $field: $field_ty
+ ),+
}
};
- (@struct=>make_proj_ty=>named;
- [$proj_vis:vis]
- [$proj_ty_ident:ident]
- [$make_proj_field:ident]
- [$ident:ident]
- [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
+
+ // reconstruct original enum type
+ (@reconstruct;
+ [$(#[$attrs:meta])* $vis:vis enum $ident:ident]
+ [$($def_generics:tt)*] [$($impl_generics:tt)*]
+ [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
{
$(
- $(#[$pin:ident])?
- $field_vis:vis $field:ident: $field_ty:ty
+ $(#[$variant_attrs:meta])*
+ $variant:ident $({
+ $(
+ $(#[$pin:ident])?
+ $field:ident: $field_ty:ty
+ ),+ $(,)?
+ })?
+ ),+ $(,)?
+ }
+ ) => {
+ $(#[$attrs])*
+ $vis enum $ident $($def_generics)*
+ $(where
+ $($where_clause)*)?
+ {
+ $(
+ $(#[$variant_attrs])*
+ $variant $({
+ $(
+ $field: $field_ty
+ ),+
+ })?
),+
}
+ };
+ // construct a projected type
+ (@make_proj_ty;
+ [$proj_ty_ident:ident]
+ [$proj_vis:vis $struct_ty_ident:ident $ident:ident]
+ [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
+ [$($body_data:tt)+]
) => {
#[allow(dead_code)] // This lint warns unused fields/variants.
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
@@ -743,185 +709,161 @@ macro_rules! __pin_project_internal {
#[allow(clippy::redundant_pub_crate)] // This lint warns `pub(crate)` field in private struct.
#[allow(clippy::ref_option_ref)] // This lint warns `&Option<&<ty>>`. (only needed for project_ref)
#[allow(clippy::type_repetition_in_bounds)] // https://github.com/rust-lang/rust-clippy/issues/4326
- $proj_vis struct $proj_ty_ident <'__pin, $($impl_generics)*>
+ $proj_vis $struct_ty_ident $proj_ty_ident <'__pin, $($impl_generics)*>
where
$ident <$($ty_generics)*>: '__pin
$(, $($where_clause)*)?
{
- $(
- $field_vis $field: $crate::__pin_project_internal!(@$make_proj_field;
- $(#[$pin])? $field_ty
- )
- ),+
+ $($body_data)+
}
};
- (@struct=>make_proj_ty=>named;
- [$proj_vis:vis]
- []
- [$make_proj_field:ident]
- [$ident:ident]
- [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
- $($field:tt)*
- ) => {};
-
- (@struct=>make_proj_replace_ty=>unnamed;
- [$proj_vis:vis]
- [$_proj_ty_ident:ident][$proj_ty_ident:ident]
- [$make_proj_field:ident]
- [$ident:ident]
- [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
- [$(impl $($pinned_drop:tt)*)?]
- $($field:tt)*
- ) => {};
- (@struct=>make_proj_replace_ty=>unnamed;
- [$proj_vis:vis]
- [][$proj_ty_ident:ident]
- [$make_proj_field:ident]
- [$ident:ident]
- [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
- [$(impl $($pinned_drop:tt)*)?]
- $($field:tt)*
- ) => {};
- (@struct=>make_proj_replace_ty=>named;
- [$proj_vis:vis]
+ // construct a project_replace type
+ (@make_proj_replace_ty;
[$proj_ty_ident:ident]
- [$make_proj_field:ident]
- [$ident:ident]
+ [$proj_vis:vis $struct_ty_ident:ident]
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
- []
- {
- $(
- $(#[$pin:ident])?
- $field_vis:vis $field:ident: $field_ty:ty
- ),+
- }
+ [$($body_data:tt)+]
) => {
#[allow(dead_code)] // This lint warns unused fields/variants.
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
#[allow(clippy::mut_mut)] // This lint warns `&mut &mut <ty>`. (only needed for project)
#[allow(clippy::redundant_pub_crate)] // This lint warns `pub(crate)` field in private struct.
#[allow(clippy::type_repetition_in_bounds)] // https://github.com/rust-lang/rust-clippy/issues/4326
- $proj_vis struct $proj_ty_ident <$($impl_generics)*>
+ $proj_vis $struct_ty_ident $proj_ty_ident <$($impl_generics)*>
where
$($($where_clause)*)?
{
+ $($body_data)+
+ }
+ };
+ // =============================================================================================
+ // struct:make_proj_ty
+ // if a proj_ty_ident was given, we do *not* create one with the default
+ (@make_proj_ty;
+ [$proj_ty_ident:ident $default_ident:ident]
+ [$proj_vis:vis struct $ident:ident]
+ $($field:tt)*
+ ) => {};
+ (@make_proj_ty;
+ [$proj_ty_ident:ident]
+ [$proj_vis:vis struct $ident:ident]
+ [$make_proj_field:ident]
+ [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
+ {
$(
- $field_vis $field: $crate::__pin_project_internal!(@$make_proj_field;
- $(#[$pin])? $field_ty
- )
- ),+
+ $(#[$pin:ident])?
+ $field_vis:vis $field:ident: $field_ty:ty
+ ),+ $(,)?
+ }
+ ) => {
+ $crate::__pin_project_internal!{@make_proj_ty;
+ [$proj_ty_ident]
+ [$proj_vis struct $ident]
+ [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)* )?]
+ [
+ $(
+ $field_vis $field: $crate::__pin_project_internal!(@$make_proj_field;
+ $(#[$pin])? $field_ty
+ )
+ ),+
+ ]
}
};
- (@struct=>make_proj_replace_ty=>named;
- [$proj_vis:vis]
- []
+ (@make_proj_replace_ty;
+ [$proj_ty_ident:ident]
+ [$proj_vis:vis struct]
[$make_proj_field:ident]
- [$ident:ident]
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
- [$(impl $($pinned_drop:tt)*)?]
- $($field:tt)*
- ) => {};
+ {
+ $(
+ $(#[$pin:ident])?
+ $field_vis:vis $field:ident: $field_ty:ty
+ ),+ $(,)?
+ }
+ ) => {
+ $crate::__pin_project_internal!{@make_proj_replace_ty;
+ [$proj_ty_ident]
+ [$proj_vis struct]
+ [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)* )?]
+ [
+ $(
+ $field_vis $field: $crate::__pin_project_internal!(@$make_proj_field;
+ $(#[$pin])? $field_ty
+ )
+ ),+
+ ]
+ }
+ };
// =============================================================================================
// enum:make_proj_ty
- (@enum=>make_proj_ty;
- [$proj_vis:vis]
+ (@make_proj_ty;
[$proj_ty_ident:ident]
+ [$proj_vis:vis enum $ident:ident]
[$make_proj_field:ident]
- [$ident:ident]
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
{
$(
+ $(#[$variant_attrs:meta])*
$variant:ident $({
$(
$(#[$pin:ident])?
$field:ident: $field_ty:ty
- ),+
+ ),+ $(,)?
})?
- ),+
+ ),+ $(,)?
}
) => {
- #[allow(dead_code)] // This lint warns unused fields/variants.
- #[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
- // This lint warns of `clippy::*` generated by external macros.
- // We allow this lint for compatibility with older compilers.
- #[allow(clippy::unknown_clippy_lints)]
- #[allow(clippy::mut_mut)] // This lint warns `&mut &mut <ty>`. (only needed for project)
- #[allow(clippy::redundant_pub_crate)] // This lint warns `pub(crate)` field in private struct.
- #[allow(clippy::ref_option_ref)] // This lint warns `&Option<&<ty>>`. (only needed for project_ref)
- #[allow(clippy::type_repetition_in_bounds)] // https://github.com/rust-lang/rust-clippy/issues/4326
- $proj_vis enum $proj_ty_ident <'__pin, $($impl_generics)*>
- where
- $ident <$($ty_generics)*>: '__pin
- $(, $($where_clause)*)?
- {
- $(
- $variant $({
- $(
- $field: $crate::__pin_project_internal!(@$make_proj_field;
- $(#[$pin])? $field_ty
- )
- ),+
- })?
- ),+
+ $crate::__pin_project_internal!{@make_proj_ty;
+ [$proj_ty_ident]
+ [$proj_vis enum $ident]
+ [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)* )?]
+ [
+ $(
+ $variant $({
+ $(
+ $field: $crate::__pin_project_internal!(@$make_proj_field;
+ $(#[$pin])? $field_ty
+ )
+ ),+
+ })?
+ ),+
+ ]
}
};
- (@enum=>make_proj_ty;
- [$proj_vis:vis]
- []
- [$make_proj_field:ident]
- [$ident:ident]
- [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
- $($variant:tt)*
- ) => {};
-
- (@enum=>make_proj_replace_ty;
- [$proj_vis:vis]
+ (@make_proj_replace_ty;
[$proj_ty_ident:ident]
+ [$proj_vis:vis enum]
[$make_proj_field:ident]
- [$ident:ident]
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
- []
{
$(
+ $(#[$variant_attrs:meta])*
$variant:ident $({
$(
$(#[$pin:ident])?
$field:ident: $field_ty:ty
- ),+
+ ),+ $(,)?
})?
- ),+
+ ),+ $(,)?
}
) => {
- #[allow(dead_code)] // This lint warns unused fields/variants.
- #[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
- #[allow(clippy::mut_mut)] // This lint warns `&mut &mut <ty>`. (only needed for project)
- #[allow(clippy::redundant_pub_crate)] // This lint warns `pub(crate)` field in private struct.
- #[allow(clippy::type_repetition_in_bounds)] // https://github.com/rust-lang/rust-clippy/issues/4326
- $proj_vis enum $proj_ty_ident <$($impl_generics)*>
- where
- $($($where_clause)*)?
- {
- $(
- $variant $({
- $(
- $field: $crate::__pin_project_internal!(@$make_proj_field;
- $(#[$pin])? $field_ty
- )
- ),+
- })?
- ),+
+ $crate::__pin_project_internal!{@make_proj_replace_ty;
+ [$proj_ty_ident]
+ [$proj_vis enum]
+ [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)* )?]
+ [
+ $(
+ $variant $({
+ $(
+ $field: $crate::__pin_project_internal!(@$make_proj_field;
+ $(#[$pin])? $field_ty
+ )
+ ),+
+ })?
+ ),+
+ ]
}
};
- (@enum=>make_proj_replace_ty;
- [$proj_vis:vis]
- []
- [$make_proj_field:ident]
- [$ident:ident]
- [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
- [$(impl $($pinned_drop:tt)*)?]
- $($variant:tt)*
- ) => {};
-
// =============================================================================================
(@make_proj_replace_block;
[$($proj_path: tt)+]
@@ -958,9 +900,25 @@ macro_rules! __pin_project_internal {
// =============================================================================================
// struct:make_proj_method
+ // this employs an ignored default strategy that ensures the identity used matches the one used in `struct=>make_proj_ty`
+ (@struct=>make_proj_method;
+ [$proj_ty_ident:ident $_ignored_default_arg:ident]
+ [$proj_vis:vis]
+ [$method_ident:ident $get_method:ident $($mut:ident)?]
+ [$($ty_generics:tt)*]
+ $($variant:tt)*
+ ) => {
+ $crate::__pin_project_internal! { @struct=>make_proj_method;
+ [$proj_ty_ident]
+ [$proj_vis]
+ [$method_ident $get_method $($mut)?]
+ [$($ty_generics)*]
+ $($variant)*
+ }
+ };
(@struct=>make_proj_method;
+ [$proj_ty_ident:ident]
[$proj_vis:vis]
- [$proj_ty_ident:ident][$_proj_ty_ident:ident]
[$method_ident:ident $get_method:ident $($mut:ident)?]
[$($ty_generics:tt)*]
{
@@ -985,25 +943,11 @@ macro_rules! __pin_project_internal {
}
}
};
- (@struct=>make_proj_method;
- [$proj_vis:vis]
- [][$proj_ty_ident:ident]
- [$method_ident:ident $get_method:ident $($mut:ident)?]
- [$($ty_generics:tt)*]
- $($variant:tt)*
- ) => {
- $crate::__pin_project_internal! { @struct=>make_proj_method;
- [$proj_vis]
- [$proj_ty_ident][$proj_ty_ident]
- [$method_ident $get_method $($mut)?]
- [$($ty_generics)*]
- $($variant)*
- }
- };
(@struct=>make_proj_replace_method;
+ [$proj_ty_ident:ident]
[$proj_vis:vis]
- [$proj_ty_ident:ident][$_proj_ty_ident:ident]
+ [$_proj_ty_ident:ident]
[$($ty_generics:tt)*]
{
$(
@@ -1021,10 +965,7 @@ macro_rules! __pin_project_internal {
// Destructors will run in reverse order, so next create a guard to overwrite
// `self` with the replacement value without calling destructors.
- let __guard = $crate::__private::UnsafeOverwriteGuard {
- target: __self_ptr,
- value: $crate::__private::ManuallyDrop::new(replacement),
- };
+ let __guard = $crate::__private::UnsafeOverwriteGuard::new(__self_ptr, replacement);
let Self { $($field),* } = &mut *__self_ptr;
@@ -1040,19 +981,11 @@ macro_rules! __pin_project_internal {
}
}
};
- (@struct=>make_proj_replace_method;
- [$proj_vis:vis]
- [][$proj_ty_ident:ident]
- [$($ty_generics:tt)*]
- $($variant:tt)*
- ) => {
- };
-
// =============================================================================================
// enum:make_proj_method
(@enum=>make_proj_method;
- [$proj_vis:vis]
[$proj_ty_ident:ident]
+ [$proj_vis:vis]
[$method_ident:ident $get_method:ident $($mut:ident)?]
[$($ty_generics:tt)*]
{
@@ -1089,17 +1022,9 @@ macro_rules! __pin_project_internal {
}
}
};
- (@enum=>make_proj_method;
- [$proj_vis:vis]
- []
- [$method_ident:ident $get_method:ident $($mut:ident)?]
- [$($ty_generics:tt)*]
- $($variant:tt)*
- ) => {};
-
(@enum=>make_proj_replace_method;
- [$proj_vis:vis]
[$proj_ty_ident:ident]
+ [$proj_vis:vis]
[$($ty_generics:tt)*]
{
$(
@@ -1121,10 +1046,7 @@ macro_rules! __pin_project_internal {
// Destructors will run in reverse order, so next create a guard to overwrite
// `self` with the replacement value without calling destructors.
- let __guard = $crate::__private::UnsafeOverwriteGuard {
- target: __self_ptr,
- value: $crate::__private::ManuallyDrop::new(replacement),
- };
+ let __guard = $crate::__private::UnsafeOverwriteGuard::new(__self_ptr, replacement);
match &mut *__self_ptr {
$(
@@ -1146,13 +1068,6 @@ macro_rules! __pin_project_internal {
}
}
};
- (@enum=>make_proj_replace_method;
- [$proj_vis:vis]
- []
- [$($ty_generics:tt)*]
- $($variant:tt)*
- ) => {};
-
// =============================================================================================
// make_unpin_impl
(@make_unpin_impl;
@@ -1219,7 +1134,7 @@ macro_rules! __pin_project_internal {
$(: $where_clause_bound:path)?
$(: ?$where_clause_unsized_bound:path)?
$(: $where_clause_lifetime_bound:lifetime)?
- ),*
+ ),* $(,)?
)?
{
fn drop($($arg:ident)+: Pin<&mut Self>) {
@@ -1359,7 +1274,7 @@ macro_rules! __pin_project_internal {
#[pin]
$field:ident
) => {
- $crate::__private::UnsafeDropInPlaceGuard($field)
+ $crate::__private::UnsafeDropInPlaceGuard::new($field)
};
(@make_unsafe_drop_in_place_guard;
$field:ident
@@ -1405,8 +1320,8 @@ macro_rules! __pin_project_internal {
};
// =============================================================================================
- // Parses input and determines visibility
-
+ // Parses attributes and determines visibility
+ // parsing proj_mut_ident
(
[]
[$($proj_ref_ident:ident)?]
@@ -1425,6 +1340,7 @@ macro_rules! __pin_project_internal {
}
};
+ // parsing proj_ref_ident
{
[$($proj_mut_ident:ident)?]
[]
@@ -1443,6 +1359,7 @@ macro_rules! __pin_project_internal {
}
};
+ // parsing proj_replace_ident
{
[$($proj_mut_ident:ident)?]
[$($proj_ref_ident:ident)?]
@@ -1461,6 +1378,8 @@ macro_rules! __pin_project_internal {
}
};
+ // this is actually part of a recursive step that picks off a single non-`pin_project_lite` attribute
+ // there could be more to parse
{
[$($proj_mut_ident:ident)?]
[$($proj_ref_ident:ident)?]
@@ -1479,229 +1398,50 @@ macro_rules! __pin_project_internal {
}
};
- // struct
- (
- [$($proj_mut_ident:ident)?]
- [$($proj_ref_ident:ident)?]
- [$($proj_replace_ident:ident)?]
- [$($attrs:tt)*]
-
- pub struct $ident:ident $(<
- $( $lifetime:lifetime $(: $lifetime_bound:lifetime)? ),* $(,)?
- $( $generics:ident
- $(: $generics_bound:path)?
- $(: ?$generics_unsized_bound:path)?
- $(: $generics_lifetime_bound:lifetime)?
- $(= $generics_default:ty)?
- ),* $(,)?
- >)?
- $(where
- $( $where_clause_ty:ty
- $(: $where_clause_bound:path)?
- $(: ?$where_clause_unsized_bound:path)?
- $(: $where_clause_lifetime_bound:lifetime)?
- ),* $(,)?
- )?
- {
- $(
- $(#[$pin:ident])?
- $field_vis:vis $field:ident: $field_ty:ty
- ),+ $(,)?
- }
- $(impl $($pinned_drop:tt)*)?
- ) => {
- $crate::__pin_project_internal! { @struct=>internal;
- [$($proj_mut_ident)?]
- [$($proj_ref_ident)?]
- [$($proj_replace_ident)?]
- [pub(crate)]
- [$($attrs)* pub struct $ident]
- [$(<
- $( $lifetime $(: $lifetime_bound)? ,)*
- $( $generics
- $(: $generics_bound)?
- $(: ?$generics_unsized_bound)?
- $(: $generics_lifetime_bound)?
- $(= $generics_default)?
- ),*
- >)?]
- [$(
- $( $lifetime $(: $lifetime_bound)? ,)*
- $( $generics
- $(: $generics_bound)?
- $(: ?$generics_unsized_bound)?
- $(: $generics_lifetime_bound)?
- ),*
- )?]
- [$( $( $lifetime ,)* $( $generics ),* )?]
- [$(where $( $where_clause_ty
- $(: $where_clause_bound)?
- $(: ?$where_clause_unsized_bound)?
- $(: $where_clause_lifetime_bound)?
- ),* )?]
- {
- $(
- $(#[$pin])?
- $field_vis $field: $field_ty
- ),+
- }
- $(impl $($pinned_drop)*)?
- }
- };
- (
+ // now determine visibility
+ // if public, downgrade
+ {
[$($proj_mut_ident:ident)?]
[$($proj_ref_ident:ident)?]
[$($proj_replace_ident:ident)?]
[$($attrs:tt)*]
-
- $vis:vis struct $ident:ident $(<
- $( $lifetime:lifetime $(: $lifetime_bound:lifetime)? ),* $(,)?
- $( $generics:ident
- $(: $generics_bound:path)?
- $(: ?$generics_unsized_bound:path)?
- $(: $generics_lifetime_bound:lifetime)?
- $(= $generics_default:ty)?
- ),* $(,)?
- >)?
- $(where
- $( $where_clause_ty:ty
- $(: $where_clause_bound:path)?
- $(: ?$where_clause_unsized_bound:path)?
- $(: $where_clause_lifetime_bound:lifetime)?
- ),* $(,)?
- )?
- {
- $(
- $(#[$pin:ident])?
- $field_vis:vis $field:ident: $field_ty:ty
- ),+ $(,)?
- }
- $(impl $($pinned_drop:tt)*)?
- ) => {
- $crate::__pin_project_internal! { @struct=>internal;
+ pub $struct_ty_ident:ident $ident:ident
+ $($tt:tt)*
+ } => {
+ $crate::__pin_project_internal! {
[$($proj_mut_ident)?]
[$($proj_ref_ident)?]
[$($proj_replace_ident)?]
- [$vis]
- [$($attrs)* $vis struct $ident]
- [$(<
- $( $lifetime $(: $lifetime_bound)? ,)*
- $( $generics
- $(: $generics_bound)?
- $(: ?$generics_unsized_bound)?
- $(: $generics_lifetime_bound)?
- $(= $generics_default)?
- ),*
- >)?]
- [$(
- $( $lifetime $(: $lifetime_bound)? ,)*
- $( $generics
- $(: $generics_bound)?
- $(: ?$generics_unsized_bound)?
- $(: $generics_lifetime_bound)?
- ),*
- )?]
- [$( $( $lifetime ,)* $( $generics ),* )?]
- [$(where $( $where_clause_ty
- $(: $where_clause_bound)?
- $(: ?$where_clause_unsized_bound)?
- $(: $where_clause_lifetime_bound)?
- ),* )?]
- {
- $(
- $(#[$pin])?
- $field_vis $field: $field_ty
- ),+
- }
- $(impl $($pinned_drop)*)?
+ [$($attrs)*]
+ [pub $struct_ty_ident $ident pub(crate)]
+ $($tt)*
}
};
- // enum
- (
+ {
[$($proj_mut_ident:ident)?]
[$($proj_ref_ident:ident)?]
[$($proj_replace_ident:ident)?]
[$($attrs:tt)*]
-
- pub enum $ident:ident $(<
- $( $lifetime:lifetime $(: $lifetime_bound:lifetime)? ),* $(,)?
- $( $generics:ident
- $(: $generics_bound:path)?
- $(: ?$generics_unsized_bound:path)?
- $(: $generics_lifetime_bound:lifetime)?
- $(= $generics_default:ty)?
- ),* $(,)?
- >)?
- $(where
- $( $where_clause_ty:ty
- $(: $where_clause_bound:path)?
- $(: ?$where_clause_unsized_bound:path)?
- $(: $where_clause_lifetime_bound:lifetime)?
- ),* $(,)?
- )?
- {
- $(
- $(#[$variant_attrs:meta])*
- $variant:ident $({
- $(
- $(#[$pin:ident])?
- $field:ident: $field_ty:ty
- ),+ $(,)?
- })?
- ),+ $(,)?
- }
- $(impl $($pinned_drop:tt)*)?
- ) => {
- $crate::__pin_project_internal! { @enum=>internal;
+ $vis:vis $struct_ty_ident:ident $ident:ident
+ $($tt:tt)*
+ } => {
+ $crate::__pin_project_internal! {
[$($proj_mut_ident)?]
[$($proj_ref_ident)?]
[$($proj_replace_ident)?]
- [pub(crate)]
- [$($attrs)* pub enum $ident]
- [$(<
- $( $lifetime $(: $lifetime_bound)? ,)*
- $( $generics
- $(: $generics_bound)?
- $(: ?$generics_unsized_bound)?
- $(: $generics_lifetime_bound)?
- $(= $generics_default)?
- ),*
- >)?]
- [$(
- $( $lifetime $(: $lifetime_bound)? ,)*
- $( $generics
- $(: $generics_bound)?
- $(: ?$generics_unsized_bound)?
- $(: $generics_lifetime_bound)?
- ),*
- )?]
- [$( $( $lifetime ,)* $( $generics ),* )?]
- [$(where $( $where_clause_ty
- $(: $where_clause_bound)?
- $(: ?$where_clause_unsized_bound)?
- $(: $where_clause_lifetime_bound)?
- ),* )?]
- {
- $(
- $(#[$variant_attrs])*
- $variant $({
- $(
- $(#[$pin])?
- $field: $field_ty
- ),+
- })?
- ),+
- }
- $(impl $($pinned_drop)*)?
+ [$($attrs)*]
+ [$vis $struct_ty_ident $ident $vis]
+ $($tt)*
}
};
+ // parse generics
(
[$($proj_mut_ident:ident)?]
[$($proj_ref_ident:ident)?]
[$($proj_replace_ident:ident)?]
[$($attrs:tt)*]
-
- $vis:vis enum $ident:ident $(<
+ [$vis:vis $struct_ty_ident:ident $ident:ident $proj_ty_vis:vis]
+ $(<
$( $lifetime:lifetime $(: $lifetime_bound:lifetime)? ),* $(,)?
$( $generics:ident
$(: $generics_bound:path)?
@@ -1718,24 +1458,16 @@ macro_rules! __pin_project_internal {
),* $(,)?
)?
{
- $(
- $(#[$variant_attrs:meta])*
- $variant:ident $({
- $(
- $(#[$pin:ident])?
- $field:ident: $field_ty:ty
- ),+ $(,)?
- })?
- ),+ $(,)?
+ $($body_data:tt)*
}
$(impl $($pinned_drop:tt)*)?
) => {
- $crate::__pin_project_internal! { @enum=>internal;
+ $crate::__pin_project_internal! { @expand;
[$($proj_mut_ident)?]
[$($proj_ref_ident)?]
[$($proj_replace_ident)?]
- [$vis]
- [$($attrs)* $vis enum $ident]
+ [$proj_ty_vis]
+ [$($attrs)* $vis $struct_ty_ident $ident]
[$(<
$( $lifetime $(: $lifetime_bound)? ,)*
$( $generics
@@ -1760,15 +1492,7 @@ macro_rules! __pin_project_internal {
$(: $where_clause_lifetime_bound)?
),* )?]
{
- $(
- $(#[$variant_attrs])*
- $variant $({
- $(
- $(#[$pin])?
- $field: $field_ty
- ),+
- })?
- ),+
+ $($body_data)*
}
$(impl $($pinned_drop)*)?
}
@@ -1778,10 +1502,10 @@ macro_rules! __pin_project_internal {
// Not public API.
#[doc(hidden)]
pub mod __private {
+ use core::mem::ManuallyDrop;
#[doc(hidden)]
pub use core::{
marker::{PhantomData, Unpin},
- mem::ManuallyDrop,
ops::Drop,
pin::Pin,
ptr,
@@ -1795,7 +1519,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) {
@@ -1809,8 +1540,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/tests/README.md b/tests/README.md
new file mode 100644
index 0000000..4721616
--- /dev/null
+++ b/tests/README.md
@@ -0,0 +1,46 @@
+# Tests
+
+Many of the tests in this repository are based on [pin-project's tests](https://github.com/taiki-e/pin-project/tree/HEAD/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 pin-project's [examples](https://github.com/taiki-e/pin-project/tree/HEAD/examples)
+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 8970215..70d2358 100644
--- a/tests/compiletest.rs
+++ b/tests/compiletest.rs
@@ -3,7 +3,7 @@
use std::env;
-#[rustversion::attr(before(2021-05-15), 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 1f7dcfb..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](https://github.com/taiki-e/pin-project/tree/HEAD/examples) 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 df005ad..eae0aac 100644
--- a/tests/expand/default/enum.expanded.rs
+++ b/tests/expand/default/enum.expanded.rs
@@ -86,10 +86,10 @@ const _: () = {
) -> EnumProjReplace<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
- let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard {
- target: __self_ptr,
- value: ::pin_project_lite::__private::ManuallyDrop::new(replacement),
- };
+ let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard::new(
+ __self_ptr,
+ replacement,
+ );
match &mut *__self_ptr {
Self::Struct { pinned, unpinned } => {
let result = EnumProjReplace::Struct {
@@ -98,7 +98,7 @@ const _: () = {
};
{
(
- ::pin_project_lite::__private::UnsafeDropInPlaceGuard(pinned),
+ ::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned),
(),
);
}
diff --git a/tests/expand/multifields/enum.expanded.rs b/tests/expand/multifields/enum.expanded.rs
index a0b17cb..fca0feb 100644
--- a/tests/expand/multifields/enum.expanded.rs
+++ b/tests/expand/multifields/enum.expanded.rs
@@ -33,10 +33,10 @@ const _: () = {
) -> EnumProjReplace<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
- let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard {
- target: __self_ptr,
- value: ::pin_project_lite::__private::ManuallyDrop::new(replacement),
- };
+ let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard::new(
+ __self_ptr,
+ replacement,
+ );
match &mut *__self_ptr {
Self::Struct {
pinned1,
@@ -52,8 +52,8 @@ const _: () = {
};
{
(
- ::pin_project_lite::__private::UnsafeDropInPlaceGuard(pinned1),
- ::pin_project_lite::__private::UnsafeDropInPlaceGuard(pinned2),
+ ::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned1),
+ ::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned2),
(),
(),
);
diff --git a/tests/expand/multifields/struct.expanded.rs b/tests/expand/multifields/struct.expanded.rs
index 638bf56..4320f68 100644
--- a/tests/expand/multifields/struct.expanded.rs
+++ b/tests/expand/multifields/struct.expanded.rs
@@ -97,10 +97,10 @@ const _: () = {
) -> StructProjReplace<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
- let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard {
- target: __self_ptr,
- value: ::pin_project_lite::__private::ManuallyDrop::new(replacement),
- };
+ let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard::new(
+ __self_ptr,
+ replacement,
+ );
let Self {
pinned1,
pinned2,
@@ -115,8 +115,8 @@ const _: () = {
};
{
(
- ::pin_project_lite::__private::UnsafeDropInPlaceGuard(pinned1),
- ::pin_project_lite::__private::UnsafeDropInPlaceGuard(pinned2),
+ ::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned1),
+ ::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned2),
(),
(),
);
diff --git a/tests/expand/naming/enum-all.expanded.rs b/tests/expand/naming/enum-all.expanded.rs
index df005ad..eae0aac 100644
--- a/tests/expand/naming/enum-all.expanded.rs
+++ b/tests/expand/naming/enum-all.expanded.rs
@@ -86,10 +86,10 @@ const _: () = {
) -> EnumProjReplace<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
- let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard {
- target: __self_ptr,
- value: ::pin_project_lite::__private::ManuallyDrop::new(replacement),
- };
+ let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard::new(
+ __self_ptr,
+ replacement,
+ );
match &mut *__self_ptr {
Self::Struct { pinned, unpinned } => {
let result = EnumProjReplace::Struct {
@@ -98,7 +98,7 @@ const _: () = {
};
{
(
- ::pin_project_lite::__private::UnsafeDropInPlaceGuard(pinned),
+ ::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned),
(),
);
}
diff --git a/tests/expand/naming/struct-all.expanded.rs b/tests/expand/naming/struct-all.expanded.rs
index 5d2f135..b91c24e 100644
--- a/tests/expand/naming/struct-all.expanded.rs
+++ b/tests/expand/naming/struct-all.expanded.rs
@@ -75,10 +75,10 @@ const _: () = {
) -> StructProjReplace<T, U> {
unsafe {
let __self_ptr: *mut Self = self.get_unchecked_mut();
- let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard {
- target: __self_ptr,
- value: ::pin_project_lite::__private::ManuallyDrop::new(replacement),
- };
+ let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard::new(
+ __self_ptr,
+ replacement,
+ );
let Self { pinned, unpinned } = &mut *__self_ptr;
let result = StructProjReplace {
pinned: ::pin_project_lite::__private::PhantomData,
@@ -86,7 +86,7 @@ const _: () = {
};
{
(
- ::pin_project_lite::__private::UnsafeDropInPlaceGuard(pinned),
+ ::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned),
(),
);
}
diff --git a/tests/lint.rs b/tests/lint.rs
index 2324cd5..792adce 100644
--- a/tests/lint.rs
+++ b/tests/lint.rs
@@ -1,15 +1,22 @@
// Check interoperability with rustc and clippy lints.
+#![forbid(unsafe_code)]
+// 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)]
-#![allow(unknown_lints)] // for old compilers
-#![forbid(unsafe_code)]
+#![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_migration,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
@@ -28,14 +35,7 @@
unused_results,
variant_size_differences
)]
-// rust_2018_compatibility, rust_2021_compatibility, absolute_paths_not_starting_with_crate, etc.: forbidden as a part of future_incompatible
-// elided_lifetimes_in_paths, explicit_outlives_requirements, unused_extern_crates: warned as a part of rust_2018_idioms
-// unsafe_block_in_unsafe_fn: unsafe_block_in_unsafe_fn: requires Rust 1.52. and, we don't generate unsafe fn.
-// 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: forbidden
-#![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
@@ -161,7 +161,6 @@ mod clippy_redundant_pub_crate {
}
}
- #[allow(dead_code)]
pin_project! {
#[project = EnumProj]
#[project_ref = EnumProjRef]
@@ -177,6 +176,7 @@ mod clippy_redundant_pub_crate {
}
}
+#[allow(clippy::use_self)]
pub mod clippy_type_repetition_in_bounds {
use pin_project_lite::pin_project;
diff --git a/tests/test.rs b/tests/test.rs
index 162fc20..ed9b75c 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -665,4 +665,31 @@ fn pinned_drop() {
}
}
}
+
+ trait Service<Request> {
+ type Error;
+ }
+
+ pin_project! {
+ struct Struct3<'a, T, Request>
+ where
+ T: Service<Request>,
+ T::Error: std::error::Error,
+ {
+ was_dropped: &'a mut bool,
+ #[pin]
+ field: T,
+ req: Request,
+ }
+
+ impl<T, Request> PinnedDrop for Struct3<'_, T, Request>
+ where
+ T: Service<Request>,
+ T::Error: std::error::Error,
+ {
+ fn drop(mut this: Pin<&mut Self>) {
+ **this.as_mut().project().was_dropped = true;
+ }
+ }
+ }
}
diff --git a/tests/ui/pin_project/conflict-drop.stderr b/tests/ui/pin_project/conflict-drop.stderr
index bbfc910..8531d08 100644
--- a/tests/ui/pin_project/conflict-drop.stderr
+++ b/tests/ui/pin_project/conflict-drop.stderr
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `_::MustNotImplDrop` for type `Foo<_, _>`
- --> $DIR/conflict-drop.rs:3:1
+ --> tests/ui/pin_project/conflict-drop.rs:3:1
|
3 | / pin_project! { //~ ERROR E0119
4 | | struct Foo<T, U> {
diff --git a/tests/ui/pin_project/conflict-unpin.stderr b/tests/ui/pin_project/conflict-unpin.stderr
index 18bdd92..0c3141c 100644
--- a/tests/ui/pin_project/conflict-unpin.stderr
+++ b/tests/ui/pin_project/conflict-unpin.stderr
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`
- --> $DIR/conflict-unpin.rs:5:1
+ --> tests/ui/pin_project/conflict-unpin.rs:5:1
|
5 | / pin_project! { //~ ERROR E0119
6 | | struct Foo<T, U> {
@@ -16,7 +16,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
= note: this error originates in the macro `$crate::__pin_project_internal` (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:18:1
+ --> tests/ui/pin_project/conflict-unpin.rs:18:1
|
18 | / pin_project! { //~ ERROR E0119
19 | | struct Bar<T, U> {
@@ -33,7 +33,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
= note: this error originates in the macro `$crate::__pin_project_internal` (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:29:1
+ --> tests/ui/pin_project/conflict-unpin.rs:29:1
|
29 | / pin_project! { //~ ERROR E0119
30 | | struct Baz<T, U> {
diff --git a/tests/ui/pin_project/invalid-bounds.stderr b/tests/ui/pin_project/invalid-bounds.stderr
index b276989..e179565 100644
--- a/tests/ui/pin_project/invalid-bounds.stderr
+++ b/tests/ui/pin_project/invalid-bounds.stderr
@@ -1,5 +1,5 @@
error: no rules expected the token `[`
- --> $DIR/invalid-bounds.rs:3:1
+ --> tests/ui/pin_project/invalid-bounds.rs:3:1
|
3 | / pin_project! {
4 | | struct Generics1<T: 'static : Sized> { //~ ERROR no rules expected the token `:`
@@ -8,10 +8,10 @@ error: no rules expected the token `[`
7 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: no rules expected the token `[`
- --> $DIR/invalid-bounds.rs:9:1
+ --> tests/ui/pin_project/invalid-bounds.rs:9:1
|
9 | / pin_project! {
10 | | struct Generics2<T: 'static : ?Sized> { //~ ERROR no rules expected the token `:`
@@ -20,10 +20,10 @@ error: no rules expected the token `[`
13 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `+`, `,`, `=`, or `>`, found `:`
- --> $DIR/invalid-bounds.rs:15:1
+ --> tests/ui/pin_project/invalid-bounds.rs:15:1
|
15 | / pin_project! {
16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
@@ -39,7 +39,22 @@ error: expected one of `+`, `,`, `=`, or `>`, found `:`
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `+`, `,`, `=`, or `>`, found `:`
- --> $DIR/invalid-bounds.rs:21:1
+ --> tests/ui/pin_project/invalid-bounds.rs:15:1
+ |
+15 | / pin_project! {
+16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
+17 | | field: T,
+18 | | }
+19 | | }
+ | | ^
+ | | |
+ | |_expected one of `+`, `,`, `=`, or `>`
+ | unexpected token
+ |
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: expected one of `+`, `,`, `=`, or `>`, found `:`
+ --> tests/ui/pin_project/invalid-bounds.rs:21:1
|
21 | / pin_project! {
22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
@@ -55,7 +70,22 @@ error: expected one of `+`, `,`, `=`, or `>`, found `:`
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `+`, `,`, `=`, or `>`, found `:`
- --> $DIR/invalid-bounds.rs:27:1
+ --> tests/ui/pin_project/invalid-bounds.rs:21:1
+ |
+21 | / pin_project! {
+22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
+23 | | field: T,
+24 | | }
+25 | | }
+ | | ^
+ | | |
+ | |_expected one of `+`, `,`, `=`, or `>`
+ | unexpected token
+ |
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: expected one of `+`, `,`, `=`, or `>`, found `:`
+ --> tests/ui/pin_project/invalid-bounds.rs:27:1
|
27 | / pin_project! {
28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
@@ -70,8 +100,23 @@ error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+error: expected one of `+`, `,`, `=`, or `>`, found `:`
+ --> tests/ui/pin_project/invalid-bounds.rs:27:1
+ |
+27 | / pin_project! {
+28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
+29 | | field: T,
+30 | | }
+31 | | }
+ | | ^
+ | | |
+ | |_expected one of `+`, `,`, `=`, or `>`
+ | unexpected token
+ |
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+
error: no rules expected the token `[`
- --> $DIR/invalid-bounds.rs:33:1
+ --> tests/ui/pin_project/invalid-bounds.rs:33:1
|
33 | / pin_project! {
34 | | struct Generics6<T: ?Sized : Sized> { //~ ERROR no rules expected the token `Sized`
@@ -80,10 +125,10 @@ error: no rules expected the token `[`
37 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: no rules expected the token `[`
- --> $DIR/invalid-bounds.rs:39:1
+ --> tests/ui/pin_project/invalid-bounds.rs:39:1
|
39 | / pin_project! {
40 | | struct WhereClause1<T>
@@ -94,10 +139,10 @@ error: no rules expected the token `[`
46 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: no rules expected the token `[`
- --> $DIR/invalid-bounds.rs:48:1
+ --> tests/ui/pin_project/invalid-bounds.rs:48:1
|
48 | / pin_project! {
49 | | struct WhereClause2<T>
@@ -108,10 +153,10 @@ error: no rules expected the token `[`
55 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected `where`, or `{` after struct name, found `:`
- --> $DIR/invalid-bounds.rs:57:1
+ --> tests/ui/pin_project/invalid-bounds.rs:57:1
|
57 | / pin_project! {
58 | | struct WhereClause3<T>
@@ -127,8 +172,25 @@ error: expected `where`, or `{` after struct name, found `:`
|
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+error: expected one of `+`, `,`, or `{`, found `:`
+ --> tests/ui/pin_project/invalid-bounds.rs:57:1
+ |
+57 | / pin_project! {
+58 | | struct WhereClause3<T>
+59 | | where
+60 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
+... |
+63 | | }
+64 | | }
+ | | ^
+ | | |
+ | |_expected one of `+`, `,`, or `{`
+ | unexpected token
+ |
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+
error: expected `where`, or `{` after struct name, found `:`
- --> $DIR/invalid-bounds.rs:66:1
+ --> tests/ui/pin_project/invalid-bounds.rs:66:1
|
66 | / pin_project! {
67 | | struct WhereClause4<T>
@@ -144,8 +206,25 @@ error: expected `where`, or `{` after struct name, found `:`
|
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+error: expected one of `+`, `,`, or `{`, found `:`
+ --> tests/ui/pin_project/invalid-bounds.rs:66:1
+ |
+66 | / pin_project! {
+67 | | struct WhereClause4<T>
+68 | | where
+69 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
+... |
+72 | | }
+73 | | }
+ | | ^
+ | | |
+ | |_expected one of `+`, `,`, or `{`
+ | unexpected token
+ |
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+
error: expected `where`, or `{` after struct name, found `:`
- --> $DIR/invalid-bounds.rs:75:1
+ --> tests/ui/pin_project/invalid-bounds.rs:75:1
|
75 | / pin_project! {
76 | | struct WhereClause5<T>
@@ -161,8 +240,25 @@ error: expected `where`, or `{` after struct name, found `:`
|
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+error: expected one of `+`, `,`, or `{`, found `:`
+ --> tests/ui/pin_project/invalid-bounds.rs:75:1
+ |
+75 | / pin_project! {
+76 | | struct WhereClause5<T>
+77 | | where
+78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
+... |
+81 | | }
+82 | | }
+ | | ^
+ | | |
+ | |_expected one of `+`, `,`, or `{`
+ | unexpected token
+ |
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+
error: no rules expected the token `[`
- --> $DIR/invalid-bounds.rs:84:1
+ --> tests/ui/pin_project/invalid-bounds.rs:84:1
|
84 | / pin_project! {
85 | | struct WhereClause6<T>
@@ -173,4 +269,4 @@ error: no rules expected the token `[`
91 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/pin_project/invalid.stderr b/tests/ui/pin_project/invalid.stderr
index 38df517..1e363d7 100644
--- a/tests/ui/pin_project/invalid.stderr
+++ b/tests/ui/pin_project/invalid.stderr
@@ -1,5 +1,5 @@
-error: no rules expected the token `[`
- --> $DIR/invalid.rs:3:1
+error: no rules expected the token `struct`
+ --> tests/ui/pin_project/invalid.rs:3:1
|
3 | / pin_project! {
4 | | struct A<T> {
@@ -9,10 +9,10 @@ error: no rules expected the token `[`
8 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: no rules expected the token `[`
- --> $DIR/invalid.rs:17:1
+error: no rules expected the token `struct`
+ --> tests/ui/pin_project/invalid.rs:17:1
|
17 | / pin_project! {
18 | | struct C<T> {
@@ -23,10 +23,10 @@ error: no rules expected the token `[`
23 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot find attribute `pin` in this scope
- --> $DIR/invalid.rs:11:7
+ --> tests/ui/pin_project/invalid.rs:11:7
|
11 | #[pin] //~ ERROR cannot find attribute `pin` in this scope
| ^^^
diff --git a/tests/ui/pin_project/overlapping_lifetime_names.stderr b/tests/ui/pin_project/overlapping_lifetime_names.stderr
index f87875d..dfd4235 100644
--- a/tests/ui/pin_project/overlapping_lifetime_names.stderr
+++ b/tests/ui/pin_project/overlapping_lifetime_names.stderr
@@ -1,5 +1,5 @@
error[E0263]: lifetime name `'__pin` declared twice in the same scope
- --> $DIR/overlapping_lifetime_names.rs:4:20
+ --> tests/ui/pin_project/overlapping_lifetime_names.rs:4:20
|
3 | / pin_project! { //~ ERROR E0263,E0496
4 | | pub struct Foo<'__pin, T> {
@@ -10,46 +10,8 @@ error[E0263]: lifetime name `'__pin` declared twice in the same scope
8 | | }
| |_- previous declaration here
-error[E0263]: lifetime name `'__pin` declared twice in the same scope
- --> $DIR/overlapping_lifetime_names.rs:4:20
- |
-3 | / pin_project! { //~ ERROR E0263,E0496
-4 | | pub struct Foo<'__pin, T> {
- | | ^^^^^^ declared twice
-5 | | #[pin]
-6 | | field: &'__pin mut T,
-7 | | }
-8 | | }
- | |_- previous declaration here
-
-error[E0263]: lifetime name `'__pin` declared twice in the same scope
- --> $DIR/overlapping_lifetime_names.rs:4:20
- |
-3 | / pin_project! { //~ ERROR E0263,E0496
-4 | | pub struct Foo<'__pin, T> {
- | | ^^^^^^ declared twice
-5 | | #[pin]
-6 | | field: &'__pin mut T,
-7 | | }
-8 | | }
- | |_- previous declaration here
-
-error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in scope
- --> $DIR/overlapping_lifetime_names.rs:3:1
- |
-3 | / pin_project! { //~ ERROR E0263,E0496
-4 | | pub struct Foo<'__pin, T> {
- | | ------ first declared here
-5 | | #[pin]
-6 | | field: &'__pin mut T,
-7 | | }
-8 | | }
- | |_^ lifetime `'__pin` already in scope
- |
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
-
error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in scope
- --> $DIR/overlapping_lifetime_names.rs:3:1
+ --> tests/ui/pin_project/overlapping_lifetime_names.rs:3:1
|
3 | / pin_project! { //~ ERROR E0263,E0496
4 | | pub struct Foo<'__pin, T> {
@@ -61,15 +23,3 @@ error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in
| |_^ lifetime `'__pin` already in scope
|
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error[E0263]: lifetime name `'__pin` declared twice in the same scope
- --> $DIR/overlapping_lifetime_names.rs:4:20
- |
-3 | / pin_project! { //~ ERROR E0263,E0496
-4 | | pub struct Foo<'__pin, T> {
- | | ^^^^^^ declared twice
-5 | | #[pin]
-6 | | field: &'__pin mut T,
-7 | | }
-8 | | }
- | |_- previous declaration here
diff --git a/tests/ui/pin_project/overlapping_unpin_struct.stderr b/tests/ui/pin_project/overlapping_unpin_struct.stderr
index 9486f9d..1049879 100644
--- a/tests/ui/pin_project/overlapping_unpin_struct.stderr
+++ b/tests/ui/pin_project/overlapping_unpin_struct.stderr
@@ -1,15 +1,12 @@
error[E0277]: `PhantomPinned` cannot be unpinned
- --> $DIR/overlapping_unpin_struct.rs:19:5
+ --> tests/ui/pin_project/overlapping_unpin_struct.rs:19:5
|
-16 | fn is_unpin<T: Unpin>() {}
- | ----- required by this bound in `is_unpin`
-...
19 | is_unpin::<Foo<PhantomPinned>>(); //~ ERROR E0277
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__Origin<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned`
|
= note: consider using `Box::pin`
note: required because it appears within the type `_::__Origin<'_, PhantomPinned>`
- --> $DIR/overlapping_unpin_struct.rs:5:1
+ --> tests/ui/pin_project/overlapping_unpin_struct.rs:5:1
|
5 | / pin_project! {
6 | | struct Foo<T> {
@@ -18,5 +15,19 @@ note: required because it appears within the type `_::__Origin<'_, PhantomPinned
9 | | }
10 | | }
| |_^
- = note: required because of the requirements on the impl of `Unpin` for `Foo<PhantomPinned>`
+note: required because of the requirements on the impl of `Unpin` for `Foo<PhantomPinned>`
+ --> tests/ui/pin_project/overlapping_unpin_struct.rs:5:1
+ |
+5 | / pin_project! {
+6 | | struct Foo<T> {
+7 | | #[pin]
+8 | | inner: T,
+9 | | }
+10 | | }
+ | |_^
+note: required by a bound in `is_unpin`
+ --> tests/ui/pin_project/overlapping_unpin_struct.rs:16:16
+ |
+16 | fn is_unpin<T: Unpin>() {}
+ | ^^^^^ required by this bound in `is_unpin`
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/pin_project/packed.stderr b/tests/ui/pin_project/packed.stderr
index 85f84c2..40a955e 100644
--- a/tests/ui/pin_project/packed.stderr
+++ b/tests/ui/pin_project/packed.stderr
@@ -1,5 +1,5 @@
error: reference to packed field is unaligned
- --> $DIR/packed.rs:5:1
+ --> tests/ui/pin_project/packed.rs:5:1
|
5 | / pin_project! { //~ ERROR reference to packed field is unaligned
6 | | #[repr(packed, C)]
@@ -11,7 +11,7 @@ error: reference to packed field is unaligned
| |_^
|
note: the lint level is defined here
- --> $DIR/packed.rs:5:1
+ --> tests/ui/pin_project/packed.rs:5:1
|
5 | / pin_project! { //~ ERROR reference to packed field is unaligned
6 | | #[repr(packed, C)]
@@ -24,10 +24,11 @@ note: the lint level is defined here
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: reference to packed field is unaligned
- --> $DIR/packed.rs:13:1
+ --> tests/ui/pin_project/packed.rs:13:1
|
13 | / pin_project! { //~ ERROR reference to packed field is unaligned
14 | | #[repr(packed(2))]
@@ -39,7 +40,7 @@ error: reference to packed field is unaligned
| |_^
|
note: the lint level is defined here
- --> $DIR/packed.rs:13:1
+ --> tests/ui/pin_project/packed.rs:13:1
|
13 | / pin_project! { //~ ERROR reference to packed field is unaligned
14 | | #[repr(packed(2))]
@@ -52,4 +53,5 @@ note: the lint level is defined here
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
= note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/pin_project/unpin_sneaky.stderr b/tests/ui/pin_project/unpin_sneaky.stderr
index 39a7745..4eb6eff 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 `__Origin` in this scope
- --> $DIR/unpin_sneaky.rs:10:16
+ --> tests/ui/pin_project/unpin_sneaky.rs:10:16
|
10 | impl Unpin for __Origin {} //~ ERROR E0412,E0321
| ^^^^^^^^ not found in this scope
error[E0321]: cross-crate traits with a default impl, like `Unpin`, can only be implemented for a struct/enum type, not `[type error]`
- --> $DIR/unpin_sneaky.rs:10:1
+ --> tests/ui/pin_project/unpin_sneaky.rs:10:1
|
10 | impl Unpin for __Origin {} //~ ERROR E0412,E0321
| ^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type
diff --git a/tests/ui/pin_project/unsupported.stderr b/tests/ui/pin_project/unsupported.stderr
index 892e57c..d95f455 100644
--- a/tests/ui/pin_project/unsupported.stderr
+++ b/tests/ui/pin_project/unsupported.stderr
@@ -1,35 +1,35 @@
-error: no rules expected the token `[`
- --> $DIR/unsupported.rs:3:1
+error: no rules expected the token `}`
+ --> tests/ui/pin_project/unsupported.rs:3:1
|
3 | / pin_project! {
4 | | struct Struct1 {} //~ ERROR no rules expected the token `}`
5 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: no rules expected the token `[`
- --> $DIR/unsupported.rs:7:1
+ --> tests/ui/pin_project/unsupported.rs:7:1
|
7 | / pin_project! {
8 | | struct Struct2(); //~ ERROR no rules expected the token `(`
9 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: no rules expected the token `[`
- --> $DIR/unsupported.rs:11:1
+ --> tests/ui/pin_project/unsupported.rs:11:1
|
11 | / pin_project! {
12 | | struct Struct3; //~ ERROR no rules expected the token `;`
13 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: no rules expected the token `[`
- --> $DIR/unsupported.rs:15:1
+error: no rules expected the token `enum`
+ --> tests/ui/pin_project/unsupported.rs:15:1
|
15 | / pin_project! {
16 | | enum Enum { //~ ERROR no rules expected the token `enum`
@@ -38,10 +38,10 @@ error: no rules expected the token `[`
19 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: no rules expected the token `[`
- --> $DIR/unsupported.rs:21:1
+error: no rules expected the token `union`
+ --> tests/ui/pin_project/unsupported.rs:21:1
|
21 | / pin_project! {
22 | | union Union { //~ ERROR no rules expected the token `union`
@@ -50,4 +50,4 @@ error: no rules expected the token `[`
25 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/pinned_drop/call-drop-inner.stderr b/tests/ui/pinned_drop/call-drop-inner.stderr
index 576e417..5bcb728 100644
--- a/tests/ui/pinned_drop/call-drop-inner.stderr
+++ b/tests/ui/pinned_drop/call-drop-inner.stderr
@@ -1,5 +1,5 @@
error[E0061]: this function takes 0 arguments but 1 argument was supplied
- --> $DIR/call-drop-inner.rs:10:13
+ --> tests/ui/pinned_drop/call-drop-inner.rs:10:13
|
10 | __drop_inner(this);
| ^^^^^^^^^^^^ ---- supplied 1 argument
@@ -7,7 +7,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
| expected 0 arguments
|
note: function defined here
- --> $DIR/call-drop-inner.rs:3:1
+ --> tests/ui/pinned_drop/call-drop-inner.rs:3:1
|
3 | / pin_project! {
4 | | pub struct S {
diff --git a/tests/ui/pinned_drop/conditional-drop-impl.stderr b/tests/ui/pinned_drop/conditional-drop-impl.stderr
index a67bc8d..f6c2075 100644
--- a/tests/ui/pinned_drop/conditional-drop-impl.stderr
+++ b/tests/ui/pinned_drop/conditional-drop-impl.stderr
@@ -1,11 +1,11 @@
error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not
- --> $DIR/conditional-drop-impl.rs:9:9
+ --> tests/ui/pinned_drop/conditional-drop-impl.rs:9:9
|
9 | impl<T: Unpin> Drop for DropImpl<T> {
| ^^^^^
|
note: the implementor must specify the same requirement
- --> $DIR/conditional-drop-impl.rs:5:1
+ --> tests/ui/pinned_drop/conditional-drop-impl.rs:5:1
|
5 | / struct DropImpl<T> {
6 | | f: T,
@@ -13,7 +13,7 @@ note: the implementor must specify the same requirement
| |_^
error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not
- --> $DIR/conditional-drop-impl.rs:14:1
+ --> tests/ui/pinned_drop/conditional-drop-impl.rs:14:1
|
14 | / pin_project! {
15 | | //~^ ERROR E0367
@@ -25,7 +25,7 @@ error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented f
| |_^
|
note: the implementor must specify the same requirement
- --> $DIR/conditional-drop-impl.rs:14:1
+ --> tests/ui/pinned_drop/conditional-drop-impl.rs:14:1
|
14 | / pin_project! {
15 | | //~^ ERROR E0367