aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:06:28 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:06:28 +0000
commitcf41c82110cc306c44a2cab4b47d9fb4216cf6b2 (patch)
treea937f0f36b29821a73437fa2b6db93e3af6f5d1c
parent7e6d9755ea75bc861c513d1a2459d6b61d9925e1 (diff)
parentdbdc183d13be3c2b87aafbf55f2153dbb83ba46d (diff)
downloadpin-project-lite-android14-mainline-os-statsd-release.tar.gz
Change-Id: I7a3bf6095c098a835adc487c315757a782e55a9b
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp5
-rw-r--r--CHANGELOG.md41
-rw-r--r--Cargo.toml24
-rw-r--r--Cargo.toml.orig4
-rw-r--r--METADATA12
-rw-r--r--README.md6
-rw-r--r--TEST_MAPPING37
-rw-r--r--cargo2android.json2
-rw-r--r--src/lib.rs535
-rw-r--r--tests/lint.rs8
-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.stderr314
-rw-r--r--tests/ui/pin_project/invalid.stderr31
-rw-r--r--tests/ui/pin_project/overlapping_lifetime_names.stderr52
-rw-r--r--tests/ui/pin_project/overlapping_unpin_struct.stderr2
-rw-r--r--tests/ui/pin_project/packed.stderr4
-rw-r--r--tests/ui/pin_project/unsupported.stderr56
-rw-r--r--tests/ui/pinned_drop/call-drop-inner.stderr10
-rw-r--r--tests/ui/pinned_drop/conditional-drop-impl.stderr2
21 files changed, 720 insertions, 435 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 5b410f1..b377c22 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,6 @@
{
"git": {
- "sha1": "f405b4b063ec2a2cdc9e456aa737882ee4915ddd"
+ "sha1": "1ccf058c2ba13fd7eee2154951ac64a84590d886"
},
"path_in_vcs": ""
} \ No newline at end of file
diff --git a/Android.bp b/Android.bp
index 8c1a4a9..9f11a3d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -44,16 +44,17 @@ rust_library {
host_supported: true,
crate_name: "pin_project_lite",
cargo_env_compat: true,
- cargo_pkg_version: "0.2.8",
+ cargo_pkg_version: "0.2.9",
srcs: ["src/lib.rs"],
edition: "2018",
apex_available: [
"//apex_available:platform",
- "com.android.bluetooth",
+ "com.android.btservices",
"com.android.resolv",
"com.android.uwb",
"com.android.virt",
],
+ product_available: true,
vendor_available: true,
min_sdk_version: "29",
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8e4d653..127e467 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,10 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [Unreleased]
+## [0.2.9] - 2022-04-26
+
+- Improve compile time of `pin_project!` calls. (#71, thanks @nnethercote)
+
## [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)
@@ -28,31 +32,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`. ([#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)
@@ -109,7 +113,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.
@@ -117,19 +121,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)
@@ -138,7 +142,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)
@@ -150,7 +154,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)
@@ -158,41 +162,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. ([#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.8...HEAD
+[Unreleased]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.9...HEAD
+[0.2.9]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.8...v0.2.9
[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
diff --git a/Cargo.toml b/Cargo.toml
index 563806a..8a9436d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,17 +13,27 @@
edition = "2018"
rust-version = "1.37"
name = "pin-project-lite"
-version = "0.2.8"
-exclude = ["/.*", "/tools"]
-description = "A lightweight version of pin-project written with declarative macros.\n"
-keywords = ["pin", "macros"]
-categories = ["no-std", "rust-patterns"]
+version = "0.2.9"
+exclude = [
+ "/.*",
+ "/tools",
+]
+description = """
+A lightweight version of pin-project written with declarative macros.
+"""
+keywords = [
+ "pin",
+ "macros",
+]
+categories = [
+ "no-std",
+ "rust-patterns",
+]
license = "Apache-2.0 OR MIT"
repository = "https://github.com/taiki-e/pin-project-lite"
+
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
-[dev-dependencies.macrotest]
-version = "1.0.8"
[dev-dependencies.rustversion]
version = "1"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index e60195d..3528633 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "pin-project-lite"
-version = "0.2.8"
+version = "0.2.9"
edition = "2018"
rust-version = "1.37"
license = "Apache-2.0 OR MIT"
@@ -23,7 +23,7 @@ members = [
]
[dev-dependencies]
-macrotest = "1.0.8"
+macrotest = { git = "https://github.com/taiki-e/macrotest.git", rev = "779cfa5" } # https://github.com/eupn/macrotest/pull/69
rustversion = "1"
static_assertions = "1"
trybuild = "1.0.49"
diff --git a/METADATA b/METADATA
index 077ddb1..880866f 100644
--- a/METADATA
+++ b/METADATA
@@ -1,3 +1,7 @@
+# This project was upgraded with external_updater.
+# Usage: tools/external_updater/updater.sh update rust/crates/pin-project-lite
+# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
+
name: "pin-project-lite"
description: "A lightweight version of pin-project written with declarative macros."
third_party {
@@ -7,13 +11,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/pin-project-lite/pin-project-lite-0.2.8.crate"
+ value: "https://static.crates.io/crates/pin-project-lite/pin-project-lite-0.2.9.crate"
}
- version: "0.2.8"
+ version: "0.2.9"
license_type: NOTICE
last_upgrade_date {
year: 2022
- month: 3
- day: 1
+ month: 12
+ day: 13
}
}
diff --git a/README.md b/README.md
index e185993..78adb7e 100644
--- a/README.md
+++ b/README.md
@@ -25,9 +25,10 @@ pin-project-lite = "0.2"
struct.
```rust
-use pin_project_lite::pin_project;
use std::pin::Pin;
+use pin_project_lite::pin_project;
+
pin_project! {
struct Struct<T, U> {
#[pin]
@@ -49,9 +50,10 @@ To use [`pin_project!`] on enums, you need to name the projection type
returned from the method.
```rust
-use pin_project_lite::pin_project;
use std::pin::Pin;
+use pin_project_lite::pin_project;
+
pin_project! {
#[project = EnumProj]
enum Enum<T, U> {
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 5688278..9ef8931 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -5,47 +5,46 @@
"path": "external/rust/crates/anyhow"
},
{
- "path": "external/rust/crates/futures-util"
+ "path": "external/rust/crates/async-stream"
},
{
- "path": "external/rust/crates/tokio"
+ "path": "external/rust/crates/futures-channel"
},
{
- "path": "external/rust/crates/tokio-test"
- }
- ],
- "presubmit": [
+ "path": "external/rust/crates/futures-executor"
+ },
+ {
+ "path": "external/rust/crates/futures-test"
+ },
{
- "name": "ZipFuseTest"
+ "path": "external/rust/crates/futures-util"
},
{
- "name": "authfs_device_test_src_lib"
+ "path": "external/rust/crates/tokio"
},
{
- "name": "doh_unit_test"
+ "path": "external/rust/crates/tokio-test"
},
{
- "name": "rustBinderTest"
+ "path": "external/uwb/src"
},
{
- "name": "virtualizationservice_device_test"
- }
- ],
- "presubmit-rust": [
+ "path": "packages/modules/DnsResolver"
+ },
{
- "name": "ZipFuseTest"
+ "path": "packages/modules/Virtualization/authfs"
},
{
- "name": "authfs_device_test_src_lib"
+ "path": "packages/modules/Virtualization/virtualizationmanager"
},
{
- "name": "doh_unit_test"
+ "path": "packages/modules/Virtualization/zipfuse"
},
{
- "name": "rustBinderTest"
+ "path": "system/security/keystore2"
},
{
- "name": "virtualizationservice_device_test"
+ "path": "system/security/keystore2/legacykeystore"
}
]
}
diff --git a/cargo2android.json b/cargo2android.json
index e136311..055645b 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -1,7 +1,7 @@
{
"apex-available": [
"//apex_available:platform",
- "com.android.bluetooth",
+ "com.android.btservices",
"com.android.resolv",
"com.android.uwb",
"com.android.virt"
diff --git a/src/lib.rs b/src/lib.rs
index ddd49aa..d71afe8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -309,32 +309,10 @@ macro_rules! pin_project {
// - 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
- (@expand;
+macro_rules! __pin_project_expand {
+ (
[$($proj_mut_ident:ident)?]
[$($proj_ref_ident:ident)?]
[$($proj_replace_ident:ident)?]
@@ -347,7 +325,7 @@ macro_rules! __pin_project_internal {
}
$(impl $($pinned_drop:tt)*)?
) => {
- $crate::__pin_project_internal! { @reconstruct;
+ $crate::__pin_project_reconstruct! {
[$(#[$attrs])* $vis $struct_ty_ident $ident]
[$($def_generics)*] [$($impl_generics)*]
[$($ty_generics)*] [$(where $($where_clause)*)?]
@@ -356,35 +334,35 @@ macro_rules! __pin_project_internal {
}
}
- $crate::__pin_project_internal! { @make_proj_ty;
+ $crate::__pin_project_make_proj_ty! {
[$($proj_mut_ident)?]
[$proj_vis $struct_ty_ident $ident]
- [make_proj_field_mut]
+ [__pin_project_make_proj_field_mut]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
{
$($body_data)*
}
}
- $crate::__pin_project_internal! { @make_proj_ty;
+ $crate::__pin_project_make_proj_ty! {
[$($proj_ref_ident)?]
[$proj_vis $struct_ty_ident $ident]
- [make_proj_field_ref]
+ [__pin_project_make_proj_field_ref]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
{
$($body_data)*
}
}
- $crate::__pin_project_internal! { @make_proj_replace_ty;
+ $crate::__pin_project_make_proj_replace_ty! {
[$($proj_replace_ident)?]
[$proj_vis $struct_ty_ident]
- [make_proj_field_replace]
+ [__pin_project_make_proj_field_replace]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
{
$($body_data)*
}
}
- $crate::__pin_project_internal! { @constant;
+ $crate::__pin_project_constant! {
[$(#[$attrs])* $vis $struct_ty_ident $ident]
[$($proj_mut_ident)?] [$($proj_ref_ident)?] [$($proj_replace_ident)?]
[$proj_vis]
@@ -396,7 +374,12 @@ macro_rules! __pin_project_internal {
$(impl $($pinned_drop)*)?
}
};
- (@constant;
+}
+
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_constant {
+ (
[$(#[$attrs:meta])* $vis:vis struct $ident:ident]
[$($proj_mut_ident:ident)?] [$($proj_ref_ident:ident)?] [$($proj_replace_ident:ident)?]
[$proj_vis:vis]
@@ -410,7 +393,6 @@ macro_rules! __pin_project_internal {
}
$(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
// This lint warns of `clippy::*` generated by external macros.
@@ -419,10 +401,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! { @make_proj_ty;
+ $crate::__pin_project_make_proj_ty! {
[$($proj_mut_ident)? Projection]
[$proj_vis struct $ident]
- [make_proj_field_mut]
+ [__pin_project_make_proj_field_mut]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
{
$(
@@ -431,10 +413,10 @@ macro_rules! __pin_project_internal {
),+
}
}
- $crate::__pin_project_internal! { @make_proj_ty;
+ $crate::__pin_project_make_proj_ty! {
[$($proj_ref_ident)? ProjectionRef]
[$proj_vis struct $ident]
- [make_proj_field_ref]
+ [__pin_project_make_proj_field_ref]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
{
$(
@@ -448,7 +430,7 @@ macro_rules! __pin_project_internal {
$(where
$($where_clause)*)?
{
- $crate::__pin_project_internal! { @struct=>make_proj_method;
+ $crate::__pin_project_struct_make_proj_method! {
[$($proj_mut_ident)? Projection]
[$proj_vis]
[project get_unchecked_mut mut]
@@ -460,7 +442,7 @@ macro_rules! __pin_project_internal {
),+
}
}
- $crate::__pin_project_internal! { @struct=>make_proj_method;
+ $crate::__pin_project_struct_make_proj_method! {
[$($proj_ref_ident)? ProjectionRef]
[$proj_vis]
[project_ref get_ref]
@@ -472,7 +454,7 @@ macro_rules! __pin_project_internal {
),+
}
}
- $crate::__pin_project_internal! { @struct=>make_proj_replace_method;
+ $crate::__pin_project_struct_make_proj_replace_method! {
[$($proj_replace_ident)?]
[$proj_vis]
[ProjectionReplace]
@@ -486,17 +468,17 @@ macro_rules! __pin_project_internal {
}
}
- $crate::__pin_project_internal! { @make_unpin_impl;
+ $crate::__pin_project_make_unpin_impl! {
[$vis $ident]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
$(
- $field: $crate::__pin_project_internal!(@make_unpin_bound;
+ $field: $crate::__pin_project_make_unpin_bound!(
$(#[$pin])? $field_ty
)
),+
}
- $crate::__pin_project_internal! { @make_drop_impl;
+ $crate::__pin_project_make_drop_impl! {
[$ident]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
$(impl $($pinned_drop)*)?
@@ -533,9 +515,7 @@ macro_rules! __pin_project_internal {
}
};
};
- // =============================================================================================
- // enum:main
- (@constant;
+ (
[$(#[$attrs:meta])* $vis:vis enum $ident:ident]
[$($proj_mut_ident:ident)?] [$($proj_ref_ident:ident)?] [$($proj_replace_ident:ident)?]
[$proj_vis:vis]
@@ -554,7 +534,6 @@ macro_rules! __pin_project_internal {
}
$(impl $($pinned_drop:tt)*)?
) => {
-
#[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.
@@ -565,7 +544,7 @@ macro_rules! __pin_project_internal {
$(where
$($where_clause)*)?
{
- $crate::__pin_project_internal! { @enum=>make_proj_method;
+ $crate::__pin_project_enum_make_proj_method! {
[$($proj_mut_ident)?]
[$proj_vis]
[project get_unchecked_mut mut]
@@ -581,7 +560,7 @@ macro_rules! __pin_project_internal {
),+
}
}
- $crate::__pin_project_internal! { @enum=>make_proj_method;
+ $crate::__pin_project_enum_make_proj_method! {
[$($proj_ref_ident)?]
[$proj_vis]
[project_ref get_ref]
@@ -597,7 +576,7 @@ macro_rules! __pin_project_internal {
),+
}
}
- $crate::__pin_project_internal! { @enum=>make_proj_replace_method;
+ $crate::__pin_project_enum_make_proj_replace_method! {
[$($proj_replace_ident)?]
[$proj_vis]
[$($ty_generics)*]
@@ -614,13 +593,13 @@ macro_rules! __pin_project_internal {
}
}
- $crate::__pin_project_internal! { @make_unpin_impl;
+ $crate::__pin_project_make_unpin_impl! {
[$vis $ident]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
$(
$variant: ($(
$(
- $crate::__pin_project_internal!(@make_unpin_bound;
+ $crate::__pin_project_make_unpin_bound!(
$(#[$pin])? $field_ty
)
),+
@@ -628,7 +607,7 @@ macro_rules! __pin_project_internal {
),+
}
- $crate::__pin_project_internal! { @make_drop_impl;
+ $crate::__pin_project_make_drop_impl! {
[$ident]
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
$(impl $($pinned_drop)*)?
@@ -638,8 +617,12 @@ macro_rules! __pin_project_internal {
// since it does not apply to enums.
};
};
+}
- (@reconstruct;
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_reconstruct {
+ (
[$(#[$attrs:meta])* $vis:vis struct $ident:ident]
[$($def_generics:tt)*] [$($impl_generics:tt)*]
[$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
@@ -660,9 +643,7 @@ macro_rules! __pin_project_internal {
),+
}
};
-
- // 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)*)?]
@@ -693,62 +674,22 @@ macro_rules! __pin_project_internal {
),+
}
};
- // 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
- // 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 $struct_ty_ident $proj_ty_ident <'__pin, $($impl_generics)*>
- where
- $ident <$($ty_generics)*>: '__pin
- $(, $($where_clause)*)?
- {
- $($body_data)+
- }
- };
- // construct a project_replace type
- (@make_proj_replace_ty;
- [$proj_ty_ident:ident]
- [$proj_vis:vis $struct_ty_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
- #[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_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;
+}
+
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_proj_ty {
+ ([] $($field:tt)*) => {};
+ (
[$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)* )?]
+ [$__pin_project_make_proj_field:ident]
+ [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
{
$(
$(#[$pin:ident])?
@@ -756,51 +697,24 @@ macro_rules! __pin_project_internal {
),+ $(,)?
}
) => {
- $crate::__pin_project_internal!{@make_proj_ty;
+ $crate::__pin_project_make_proj_ty_body! {
[$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
- )
- ),+
- ]
- }
- };
- (@make_proj_replace_ty;
- [$proj_ty_ident:ident]
- [$proj_vis:vis struct]
- [$make_proj_field:ident]
- [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause: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)* )?]
+ [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
[
$(
- $field_vis $field: $crate::__pin_project_internal!(@$make_proj_field;
+ $field_vis $field: $crate::$__pin_project_make_proj_field!(
$(#[$pin])? $field_ty
)
),+
]
}
};
- // =============================================================================================
- // enum:make_proj_ty
- (@make_proj_ty;
+ (
[$proj_ty_ident:ident]
[$proj_vis:vis enum $ident:ident]
- [$make_proj_field:ident]
- [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
+ [$__pin_project_make_proj_field:ident]
+ [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
{
$(
$(#[$variant_attrs:meta])*
@@ -813,15 +727,15 @@ macro_rules! __pin_project_internal {
),+ $(,)?
}
) => {
- $crate::__pin_project_internal!{@make_proj_ty;
+ $crate::__pin_project_make_proj_ty_body! {
[$proj_ty_ident]
[$proj_vis enum $ident]
- [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)* )?]
+ [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
[
$(
$variant $({
$(
- $field: $crate::__pin_project_internal!(@$make_proj_field;
+ $field: $crate::$__pin_project_make_proj_field!(
$(#[$pin])? $field_ty
)
),+
@@ -830,11 +744,70 @@ macro_rules! __pin_project_internal {
]
}
};
- (@make_proj_replace_ty;
+}
+
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_proj_ty_body {
+ (
+ [$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
+ // 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 $struct_ty_ident $proj_ty_ident <'__pin, $($impl_generics)*>
+ where
+ $ident <$($ty_generics)*>: '__pin
+ $(, $($where_clause)*)?
+ {
+ $($body_data)+
+ }
+ };
+}
+
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_proj_replace_ty {
+ ([] $($field:tt)*) => {};
+ (
+ [$proj_ty_ident:ident]
+ [$proj_vis:vis struct]
+ [$__pin_project_make_proj_field:ident]
+ [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
+ {
+ $(
+ $(#[$pin:ident])?
+ $field_vis:vis $field:ident: $field_ty:ty
+ ),+ $(,)?
+ }
+ ) => {
+ $crate::__pin_project_make_proj_replace_ty_body! {
+ [$proj_ty_ident]
+ [$proj_vis struct]
+ [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
+ [
+ $(
+ $field_vis $field: $crate::$__pin_project_make_proj_field!(
+ $(#[$pin])? $field_ty
+ )
+ ),+
+ ]
+ }
+ };
+ (
[$proj_ty_ident:ident]
[$proj_vis:vis enum]
- [$make_proj_field:ident]
- [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
+ [$__pin_project_make_proj_field:ident]
+ [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
{
$(
$(#[$variant_attrs:meta])*
@@ -847,15 +820,15 @@ macro_rules! __pin_project_internal {
),+ $(,)?
}
) => {
- $crate::__pin_project_internal!{@make_proj_replace_ty;
+ $crate::__pin_project_make_proj_replace_ty_body! {
[$proj_ty_ident]
[$proj_vis enum]
- [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)* )?]
+ [$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
[
$(
$variant $({
$(
- $field: $crate::__pin_project_internal!(@$make_proj_field;
+ $field: $crate::$__pin_project_make_proj_field!(
$(#[$pin])? $field_ty
)
),+
@@ -864,9 +837,36 @@ macro_rules! __pin_project_internal {
]
}
};
- // =============================================================================================
- (@make_proj_replace_block;
- [$($proj_path: tt)+]
+}
+
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_proj_replace_ty_body {
+ (
+ [$proj_ty_ident:ident]
+ [$proj_vis:vis $struct_ty_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
+ #[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_ty_ident $proj_ty_ident <$($impl_generics)*>
+ where
+ $($($where_clause)*)?
+ {
+ $($body_data)+
+ }
+ };
+}
+
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_proj_replace_block {
+ (
+ [$($proj_path:tt)+]
{
$(
$(#[$pin:ident])?
@@ -876,7 +876,7 @@ macro_rules! __pin_project_internal {
) => {
let result = $($proj_path)* {
$(
- $field: $crate::__pin_project_internal!(@make_replace_field_proj;
+ $field: $crate::__pin_project_make_replace_field_proj!(
$(#[$pin])? $field
)
),+
@@ -884,7 +884,7 @@ macro_rules! __pin_project_internal {
{
( $(
- $crate::__pin_project_internal!(@make_unsafe_drop_in_place_guard;
+ $crate::__pin_project_make_unsafe_drop_in_place_guard!(
$(#[$pin])? $field
),
)* );
@@ -892,23 +892,21 @@ macro_rules! __pin_project_internal {
result
};
- (@make_proj_replace_block;
- [$($proj_path: tt)+]
- ) => {
- $($proj_path)*
- };
+ ([$($proj_path:tt)+]) => { $($proj_path)* };
+}
- // =============================================================================================
- // 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;
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_struct_make_proj_method {
+ ([] $($variant:tt)*) => {};
+ (
[$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;
+ $crate::__pin_project_struct_make_proj_method! {
[$proj_ty_ident]
[$proj_vis]
[$method_ident $get_method $($mut)?]
@@ -916,7 +914,7 @@ macro_rules! __pin_project_internal {
$($variant)*
}
};
- (@struct=>make_proj_method;
+ (
[$proj_ty_ident:ident]
[$proj_vis:vis]
[$method_ident:ident $get_method:ident $($mut:ident)?]
@@ -935,7 +933,7 @@ macro_rules! __pin_project_internal {
let Self { $($field),* } = self.$get_method();
$proj_ty_ident {
$(
- $field: $crate::__pin_project_internal!(@make_unsafe_field_proj;
+ $field: $crate::__pin_project_make_unsafe_field_proj!(
$(#[$pin])? $field
)
),+
@@ -943,8 +941,13 @@ macro_rules! __pin_project_internal {
}
}
};
+}
- (@struct=>make_proj_replace_method;
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_struct_make_proj_replace_method {
+ ([] $($field:tt)*) => {};
+ (
[$proj_ty_ident:ident]
[$proj_vis:vis]
[$_proj_ty_ident:ident]
@@ -969,7 +972,7 @@ macro_rules! __pin_project_internal {
let Self { $($field),* } = &mut *__self_ptr;
- $crate::__pin_project_internal!{@make_proj_replace_block;
+ $crate::__pin_project_make_proj_replace_block! {
[$proj_ty_ident]
{
$(
@@ -981,9 +984,13 @@ macro_rules! __pin_project_internal {
}
}
};
- // =============================================================================================
- // enum:make_proj_method
- (@enum=>make_proj_method;
+}
+
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_enum_make_proj_method {
+ ([] $($variant:tt)*) => {};
+ (
[$proj_ty_ident:ident]
[$proj_vis:vis]
[$method_ident:ident $get_method:ident $($mut:ident)?]
@@ -1010,8 +1017,7 @@ macro_rules! __pin_project_internal {
})? => {
$proj_ty_ident::$variant $({
$(
- $field: $crate::__pin_project_internal!(
- @make_unsafe_field_proj;
+ $field: $crate::__pin_project_make_unsafe_field_proj!(
$(#[$pin])? $field
)
),+
@@ -1022,7 +1028,13 @@ macro_rules! __pin_project_internal {
}
}
};
- (@enum=>make_proj_replace_method;
+}
+
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_enum_make_proj_replace_method {
+ ([] $($field:tt)*) => {};
+ (
[$proj_ty_ident:ident]
[$proj_vis:vis]
[$($ty_generics:tt)*]
@@ -1053,7 +1065,7 @@ macro_rules! __pin_project_internal {
Self::$variant $({
$($field),+
})? => {
- $crate::__pin_project_internal!{@make_proj_replace_block;
+ $crate::__pin_project_make_proj_replace_block! {
[$proj_ty_ident :: $variant]
$({
$(
@@ -1068,11 +1080,14 @@ macro_rules! __pin_project_internal {
}
}
};
- // =============================================================================================
- // make_unpin_impl
- (@make_unpin_impl;
+}
+
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_unpin_impl {
+ (
[$vis:vis $ident:ident]
- [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
+ [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
$($field:tt)*
) => {
// Automatically create the appropriate conditional `Unpin` implementation.
@@ -1115,12 +1130,14 @@ macro_rules! __pin_project_internal {
{
}
};
+}
- // =============================================================================================
- // make_drop_impl
- (@make_drop_impl;
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_drop_impl {
+ (
[$_ident:ident]
- [$($_impl_generics:tt)*] [$($_ty_generics:tt)*] [$(where $($_where_clause:tt)* )?]
+ [$($_impl_generics:tt)*] [$($_ty_generics:tt)*] [$(where $($_where_clause:tt)*)?]
impl $(<
$( $lifetime:lifetime $(: $lifetime_bound:lifetime)? ),* $(,)?
$( $generics:ident
@@ -1202,9 +1219,9 @@ macro_rules! __pin_project_internal {
}
}
};
- (@make_drop_impl;
+ (
[$ident:ident]
- [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)* )?]
+ [$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
) => {
// Ensure that struct does not implement `Drop`.
//
@@ -1224,103 +1241,88 @@ macro_rules! __pin_project_internal {
{
}
};
+}
- // =============================================================================================
- // make_unpin_bound
- (@make_unpin_bound;
- #[pin]
- $field_ty:ty
- ) => {
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_unpin_bound {
+ (#[pin] $field_ty:ty) => {
$field_ty
};
- (@make_unpin_bound;
- $field_ty:ty
- ) => {
+ ($field_ty:ty) => {
$crate::__private::AlwaysUnpin<$field_ty>
};
+}
- // =============================================================================================
- // make_unsafe_field_proj
- (@make_unsafe_field_proj;
- #[pin]
- $field:ident
- ) => {
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_unsafe_field_proj {
+ (#[pin] $field:ident) => {
$crate::__private::Pin::new_unchecked($field)
};
- (@make_unsafe_field_proj;
- $field:ident
- ) => {
+ ($field:ident) => {
$field
};
+}
- // =============================================================================================
- // make_replace_field_proj
- (@make_replace_field_proj;
- #[pin]
- $field:ident
- ) => {
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_replace_field_proj {
+ (#[pin] $field:ident) => {
$crate::__private::PhantomData
};
- (@make_replace_field_proj;
- $field:ident
- ) => {
+ ($field:ident) => {
$crate::__private::ptr::read($field)
};
+}
-
- // =============================================================================================
- // make_unsafe_drop_in_place_guard
- (@make_unsafe_drop_in_place_guard;
- #[pin]
- $field:ident
- ) => {
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_unsafe_drop_in_place_guard {
+ (#[pin] $field:ident) => {
$crate::__private::UnsafeDropInPlaceGuard::new($field)
};
- (@make_unsafe_drop_in_place_guard;
- $field:ident
- ) => {
+ ($field:ident) => {
()
};
+}
- // =============================================================================================
- // make_proj_field
- (@make_proj_field_mut;
- #[pin]
- $field_ty:ty
- ) => {
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_proj_field_mut {
+ (#[pin] $field_ty:ty) => {
$crate::__private::Pin<&'__pin mut ($field_ty)>
};
- (@make_proj_field_mut;
- $field_ty:ty
- ) => {
+ ($field_ty:ty) => {
&'__pin mut ($field_ty)
};
- (@make_proj_field_ref;
- #[pin]
- $field_ty:ty
- ) => {
+}
+
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_proj_field_ref {
+ (#[pin] $field_ty:ty) => {
$crate::__private::Pin<&'__pin ($field_ty)>
};
- (@make_proj_field_ref;
- $field_ty:ty
- ) => {
+ ($field_ty:ty) => {
&'__pin ($field_ty)
};
+}
- (@make_proj_field_replace;
- #[pin]
- $field_ty:ty
- ) => {
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_make_proj_field_replace {
+ (#[pin] $field_ty:ty) => {
$crate::__private::PhantomData<$field_ty>
};
- (@make_proj_field_replace;
- $field_ty:ty
- ) => {
+ ($field_ty:ty) => {
$field_ty
};
+}
- // =============================================================================================
- // Parses attributes and determines visibility
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_internal {
// parsing proj_mut_ident
(
[]
@@ -1339,9 +1341,8 @@ macro_rules! __pin_project_internal {
$($tt)*
}
};
-
// parsing proj_ref_ident
- {
+ (
[$($proj_mut_ident:ident)?]
[]
[$($proj_replace_ident:ident)?]
@@ -1349,7 +1350,7 @@ macro_rules! __pin_project_internal {
#[project_ref = $proj_ref_ident:ident]
$($tt:tt)*
- } => {
+ ) => {
$crate::__pin_project_internal! {
[$($proj_mut_ident)?]
[$proj_ref_ident]
@@ -1358,9 +1359,8 @@ macro_rules! __pin_project_internal {
$($tt)*
}
};
-
// parsing proj_replace_ident
- {
+ (
[$($proj_mut_ident:ident)?]
[$($proj_ref_ident:ident)?]
[]
@@ -1368,7 +1368,7 @@ macro_rules! __pin_project_internal {
#[project_replace = $proj_replace_ident:ident]
$($tt:tt)*
- } => {
+ ) => {
$crate::__pin_project_internal! {
[$($proj_mut_ident)?]
[$($proj_ref_ident)?]
@@ -1377,10 +1377,9 @@ macro_rules! __pin_project_internal {
$($tt)*
}
};
-
// 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)?]
[$($proj_replace_ident:ident)?]
@@ -1388,7 +1387,7 @@ macro_rules! __pin_project_internal {
#[$($attr:tt)*]
$($tt:tt)*
- } => {
+ ) => {
$crate::__pin_project_internal! {
[$($proj_mut_ident)?]
[$($proj_ref_ident)?]
@@ -1397,18 +1396,17 @@ macro_rules! __pin_project_internal {
$($tt)*
}
};
-
// now determine visibility
// if public, downgrade
- {
+ (
[$($proj_mut_ident:ident)?]
[$($proj_ref_ident:ident)?]
[$($proj_replace_ident:ident)?]
[$($attrs:tt)*]
pub $struct_ty_ident:ident $ident:ident
$($tt:tt)*
- } => {
- $crate::__pin_project_internal! {
+ ) => {
+ $crate::__pin_project_parse_generics! {
[$($proj_mut_ident)?]
[$($proj_ref_ident)?]
[$($proj_replace_ident)?]
@@ -1417,15 +1415,15 @@ macro_rules! __pin_project_internal {
$($tt)*
}
};
- {
+ (
[$($proj_mut_ident:ident)?]
[$($proj_ref_ident:ident)?]
[$($proj_replace_ident:ident)?]
[$($attrs:tt)*]
$vis:vis $struct_ty_ident:ident $ident:ident
$($tt:tt)*
- } => {
- $crate::__pin_project_internal! {
+ ) => {
+ $crate::__pin_project_parse_generics! {
[$($proj_mut_ident)?]
[$($proj_ref_ident)?]
[$($proj_replace_ident)?]
@@ -1434,7 +1432,11 @@ macro_rules! __pin_project_internal {
$($tt)*
}
};
- // parse generics
+}
+
+#[doc(hidden)]
+#[macro_export]
+macro_rules! __pin_project_parse_generics {
(
[$($proj_mut_ident:ident)?]
[$($proj_ref_ident:ident)?]
@@ -1462,7 +1464,7 @@ macro_rules! __pin_project_internal {
}
$(impl $($pinned_drop:tt)*)?
) => {
- $crate::__pin_project_internal! { @expand;
+ $crate::__pin_project_expand! {
[$($proj_mut_ident)?]
[$($proj_ref_ident)?]
[$($proj_replace_ident)?]
@@ -1499,7 +1501,6 @@ macro_rules! __pin_project_internal {
};
}
-// Not public API.
#[doc(hidden)]
pub mod __private {
use core::mem::ManuallyDrop;
diff --git a/tests/lint.rs b/tests/lint.rs
index 792adce..852f940 100644
--- a/tests/lint.rs
+++ b/tests/lint.rs
@@ -9,14 +9,16 @@
#![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.
+// unsafe_op_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
+// unused_crate_dependencies, must_not_suspend: unrelated
// unsafe_code: checked in forbid_unsafe module
#![warn(
box_pointers,
deprecated_in_future,
+ fuzzy_provenance_casts,
+ lossy_provenance_casts,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
@@ -37,7 +39,7 @@
)]
#![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
+#![allow(clippy::exhaustive_structs, clippy::exhaustive_enums, clippy::single_char_lifetime_names)] // TODO
pub mod basic {
include!("include/basic.rs");
diff --git a/tests/ui/pin_project/conflict-drop.stderr b/tests/ui/pin_project/conflict-drop.stderr
index 8531d08..66872bd 100644
--- a/tests/ui/pin_project/conflict-drop.stderr
+++ b/tests/ui/pin_project/conflict-drop.stderr
@@ -13,4 +13,4 @@ error[E0119]: conflicting implementations of trait `_::MustNotImplDrop` for type
| |_first implementation here
| conflicting implementation for `Foo<_, _>`
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_make_drop_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/pin_project/conflict-unpin.stderr b/tests/ui/pin_project/conflict-unpin.stderr
index 0c3141c..bd30faf 100644
--- a/tests/ui/pin_project/conflict-unpin.stderr
+++ b/tests/ui/pin_project/conflict-unpin.stderr
@@ -13,7 +13,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
14 | impl<T, U> Unpin for Foo<T, U> where T: Unpin {} // Conditional Unpin impl
| --------------------------------------------- first implementation here
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`
--> tests/ui/pin_project/conflict-unpin.rs:18:1
@@ -30,7 +30,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
27 | impl<T, U> Unpin for Bar<T, U> {} // Non-conditional Unpin impl
| ------------------------------ first implementation here
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`
--> tests/ui/pin_project/conflict-unpin.rs:29:1
@@ -47,4 +47,4 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
38 | impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} // Conditional Unpin impl
| -------------------------------------------- first implementation here
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/pin_project/invalid-bounds.stderr b/tests/ui/pin_project/invalid-bounds.stderr
index e179565..40e79bf 100644
--- a/tests/ui/pin_project/invalid-bounds.stderr
+++ b/tests/ui/pin_project/invalid-bounds.stderr
@@ -1,26 +1,14 @@
-error: no rules expected the token `[`
- --> tests/ui/pin_project/invalid-bounds.rs:3:1
+error: no rules expected the token `:`
+ --> tests/ui/pin_project/invalid-bounds.rs:4:33
|
-3 | / pin_project! {
-4 | | struct Generics1<T: 'static : Sized> { //~ ERROR no rules expected the token `:`
-5 | | field: T,
-6 | | }
-7 | | }
- | |_^ no rules expected this token in macro call
- |
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+4 | struct Generics1<T: 'static : Sized> { //~ ERROR no rules expected the token `:`
+ | ^ no rules expected this token in macro call
-error: no rules expected the token `[`
- --> tests/ui/pin_project/invalid-bounds.rs:9:1
- |
-9 | / pin_project! {
-10 | | struct Generics2<T: 'static : ?Sized> { //~ ERROR no rules expected the token `:`
-11 | | field: T,
-12 | | }
-13 | | }
- | |_^ no rules expected this token in macro call
+error: no rules expected the token `:`
+ --> tests/ui/pin_project/invalid-bounds.rs:10:33
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+10 | struct Generics2<T: 'static : ?Sized> { //~ ERROR no rules expected the token `:`
+ | ^ no rules expected this token in macro call
error: expected one of `+`, `,`, `=`, or `>`, found `:`
--> tests/ui/pin_project/invalid-bounds.rs:15:1
@@ -36,7 +24,7 @@ error: expected one of `+`, `,`, `=`, or `>`, found `:`
| |_unexpected token
| in this macro invocation
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected one of `+`, `,`, `=`, or `>`, found `:`
--> tests/ui/pin_project/invalid-bounds.rs:15:1
@@ -51,7 +39,39 @@ error: expected one of `+`, `,`, `=`, or `>`, found `:`
| |_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)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: expected one of `+`, `,`, `=`, or `>`, found `:`
+ --> 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
+ | in this macro invocation
+ |
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: expected one of `+`, `,`, `=`, or `>`, found `:`
+ --> 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
+ | in this macro invocation
+ |
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (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
@@ -67,7 +87,7 @@ error: expected one of `+`, `,`, `=`, or `>`, found `:`
| |_unexpected token
| in this macro invocation
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (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
@@ -82,7 +102,39 @@ error: expected one of `+`, `,`, `=`, or `>`, found `:`
| |_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)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (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 `:`
+23 | | field: T,
+24 | | }
+25 | | }
+ | | ^
+ | | |
+ | | expected one of `+`, `,`, `=`, or `>`
+ | |_unexpected token
+ | in this macro invocation
+ |
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (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 `:`
+23 | | field: T,
+24 | | }
+25 | | }
+ | | ^
+ | | |
+ | | expected one of `+`, `,`, `=`, or `>`
+ | |_unexpected token
+ | in this macro invocation
+ |
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (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
@@ -98,7 +150,7 @@ error: expected one of `+`, `,`, `=`, or `>`, found `:`
| |_unexpected token
| in this macro invocation
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (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
@@ -113,49 +165,59 @@ error: expected one of `+`, `,`, `=`, or `>`, found `:`
| |_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)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: no rules expected the token `[`
- --> tests/ui/pin_project/invalid-bounds.rs:33:1
+error: expected one of `+`, `,`, `=`, or `>`, found `:`
+ --> tests/ui/pin_project/invalid-bounds.rs:27:1
|
-33 | / pin_project! {
-34 | | struct Generics6<T: ?Sized : Sized> { //~ ERROR no rules expected the token `Sized`
-35 | | field: T,
-36 | | }
-37 | | }
- | |_^ no rules expected this token in macro call
+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
+ | in this macro invocation
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: no rules expected the token `[`
- --> tests/ui/pin_project/invalid-bounds.rs:39:1
+error: expected one of `+`, `,`, `=`, or `>`, found `:`
+ --> tests/ui/pin_project/invalid-bounds.rs:27:1
|
-39 | / pin_project! {
-40 | | struct WhereClause1<T>
-41 | | where
-42 | | T: 'static : Sized //~ ERROR no rules expected the token `:`
-... |
-45 | | }
-46 | | }
- | |_^ no rules expected this token in macro call
+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
+ | in this macro invocation
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: no rules expected the token `[`
- --> tests/ui/pin_project/invalid-bounds.rs:48:1
+error: no rules expected the token `Sized`
+ --> tests/ui/pin_project/invalid-bounds.rs:34:34
|
-48 | / pin_project! {
-49 | | struct WhereClause2<T>
-50 | | where
-51 | | T: 'static : ?Sized //~ ERROR no rules expected the token `:`
-... |
-54 | | }
-55 | | }
- | |_^ no rules expected this token in macro call
+34 | struct Generics6<T: ?Sized : Sized> { //~ ERROR no rules expected the token `Sized`
+ | ^^^^^ no rules expected this token in macro call
+
+error: no rules expected the token `:`
+ --> tests/ui/pin_project/invalid-bounds.rs:42:20
+ |
+42 | T: 'static : Sized //~ ERROR no rules expected the token `:`
+ | ^ no rules expected this token in macro call
+
+error: no rules expected the token `:`
+ --> tests/ui/pin_project/invalid-bounds.rs:51:20
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+51 | T: 'static : ?Sized //~ ERROR no rules expected the token `:`
+ | ^ no rules expected this token in macro call
-error: expected `where`, or `{` after struct name, found `:`
+error: expected `{` after struct name, found `:`
--> tests/ui/pin_project/invalid-bounds.rs:57:1
|
57 | / pin_project! {
@@ -167,10 +229,10 @@ error: expected `where`, or `{` after struct name, found `:`
64 | | }
| | ^
| | |
- | |_expected `where`, or `{` after struct name
+ | |_expected `{` after struct name
| in this macro invocation
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (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
@@ -187,9 +249,43 @@ error: expected one of `+`, `,`, or `{`, found `:`
| |_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)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: expected `{` after struct name, 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 `{` after struct name
+ | in this macro invocation
+ |
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: expected `where`, or `{` after struct name, found `:`
+error: expected `{` after struct name, 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 `{` after struct name
+ | in this macro invocation
+ |
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: expected `{` after struct name, found `:`
--> tests/ui/pin_project/invalid-bounds.rs:66:1
|
66 | / pin_project! {
@@ -201,10 +297,10 @@ error: expected `where`, or `{` after struct name, found `:`
73 | | }
| | ^
| | |
- | |_expected `where`, or `{` after struct name
+ | |_expected `{` after struct name
| in this macro invocation
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (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
@@ -221,9 +317,43 @@ error: expected one of `+`, `,`, or `{`, found `:`
| |_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)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: expected `{` after struct name, 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 `{` after struct name
+ | in this macro invocation
+ |
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: expected `{` after struct name, 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 `{` after struct name
+ | in this macro invocation
+ |
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: expected `where`, or `{` after struct name, found `:`
+error: expected `{` after struct name, found `:`
--> tests/ui/pin_project/invalid-bounds.rs:75:1
|
75 | / pin_project! {
@@ -235,10 +365,10 @@ error: expected `where`, or `{` after struct name, found `:`
82 | | }
| | ^
| | |
- | |_expected `where`, or `{` after struct name
+ | |_expected `{` after struct name
| in this macro invocation
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (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
@@ -255,18 +385,44 @@ error: expected one of `+`, `,`, or `{`, found `:`
| |_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)
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: no rules expected the token `[`
- --> tests/ui/pin_project/invalid-bounds.rs:84:1
+error: expected `{` after struct name, found `:`
+ --> tests/ui/pin_project/invalid-bounds.rs:75:1
|
-84 | / pin_project! {
-85 | | struct WhereClause6<T>
-86 | | where
-87 | | T: ?Sized : Sized //~ ERROR no rules expected the token `Sized`
+75 | / pin_project! {
+76 | | struct WhereClause5<T>
+77 | | where
+78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
... |
-90 | | }
-91 | | }
- | |_^ no rules expected this token in macro call
+81 | | }
+82 | | }
+ | | ^
+ | | |
+ | |_expected `{` after struct name
+ | in this macro invocation
+ |
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: expected `{` after struct name, 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 `{` after struct name
+ | in this macro invocation
+ |
+ = note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: no rules expected the token `Sized`
+ --> tests/ui/pin_project/invalid-bounds.rs:87:21
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+87 | T: ?Sized : Sized //~ ERROR no rules expected the token `Sized`
+ | ^^^^^ no rules expected this token in macro call
diff --git a/tests/ui/pin_project/invalid.stderr b/tests/ui/pin_project/invalid.stderr
index 1e363d7..623a886 100644
--- a/tests/ui/pin_project/invalid.stderr
+++ b/tests/ui/pin_project/invalid.stderr
@@ -9,7 +9,34 @@ error: no rules expected the token `struct`
8 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: no rules expected the token `struct`
+ --> tests/ui/pin_project/invalid.rs:3:1
+ |
+3 | / pin_project! {
+4 | | struct A<T> {
+5 | | #[pin()] //~ ERROR no rules expected the token `(`
+6 | | pinned: T,
+7 | | }
+8 | | }
+ | |_^ no rules expected this token in macro call
+ |
+ = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: no rules expected the token `struct`
+ --> tests/ui/pin_project/invalid.rs:17:1
+ |
+17 | / pin_project! {
+18 | | struct C<T> {
+19 | | #[pin]
+20 | | #[pin] //~ ERROR no rules expected the token `#`
+21 | | pinned: T,
+22 | | }
+23 | | }
+ | |_^ no rules expected this token in macro call
+ |
+ = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info)
error: no rules expected the token `struct`
--> tests/ui/pin_project/invalid.rs:17:1
@@ -23,7 +50,7 @@ error: no rules expected the token `struct`
23 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot find attribute `pin` in this scope
--> tests/ui/pin_project/invalid.rs:11:7
diff --git a/tests/ui/pin_project/overlapping_lifetime_names.stderr b/tests/ui/pin_project/overlapping_lifetime_names.stderr
index dfd4235..35074d0 100644
--- a/tests/ui/pin_project/overlapping_lifetime_names.stderr
+++ b/tests/ui/pin_project/overlapping_lifetime_names.stderr
@@ -10,6 +10,30 @@ 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
+ --> tests/ui/pin_project/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
+ --> tests/ui/pin_project/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
--> tests/ui/pin_project/overlapping_lifetime_names.rs:3:1
|
@@ -22,4 +46,30 @@ error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in
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)
+ = note: this error originates in the macro `$crate::__pin_project_struct_make_proj_method` (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
+ --> tests/ui/pin_project/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_struct_make_proj_method` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0263]: lifetime name `'__pin` declared twice in the same scope
+ --> tests/ui/pin_project/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 1049879..303e7cb 100644
--- a/tests/ui/pin_project/overlapping_unpin_struct.stderr
+++ b/tests/ui/pin_project/overlapping_unpin_struct.stderr
@@ -30,4 +30,4 @@ note: required by a bound in `is_unpin`
|
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)
+ = note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` (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 40a955e..81fb4f1 100644
--- a/tests/ui/pin_project/packed.stderr
+++ b/tests/ui/pin_project/packed.stderr
@@ -25,7 +25,7 @@ note: the lint level is defined here
= 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)
+ = note: this error originates in the macro `$crate::__pin_project_constant` (in Nightly builds, run with -Z macro-backtrace for more info)
error: reference to packed field is unaligned
--> tests/ui/pin_project/packed.rs:13:1
@@ -54,4 +54,4 @@ note: the lint level is defined here
= 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)
+ = note: this error originates in the macro `$crate::__pin_project_constant` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/pin_project/unsupported.stderr b/tests/ui/pin_project/unsupported.stderr
index d95f455..a7d215a 100644
--- a/tests/ui/pin_project/unsupported.stderr
+++ b/tests/ui/pin_project/unsupported.stderr
@@ -6,27 +6,41 @@ error: no rules expected the token `}`
5 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: no rules expected the token `[`
- --> tests/ui/pin_project/unsupported.rs:7:1
+error: no rules expected the token `}`
+ --> tests/ui/pin_project/unsupported.rs:3:1
|
-7 | / pin_project! {
-8 | | struct Struct2(); //~ ERROR no rules expected the token `(`
-9 | | }
+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 `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: no rules expected the token `(`
+ --> tests/ui/pin_project/unsupported.rs:8:19
+ |
+8 | struct Struct2(); //~ ERROR no rules expected the token `(`
+ | ^ no rules expected this token in macro call
-error: no rules expected the token `[`
- --> tests/ui/pin_project/unsupported.rs:11:1
+error: no rules expected the token `;`
+ --> tests/ui/pin_project/unsupported.rs:12:19
|
-11 | / pin_project! {
-12 | | struct Struct3; //~ ERROR no rules expected the token `;`
-13 | | }
+12 | struct Struct3; //~ ERROR no rules expected the token `;`
+ | ^ no rules expected this token in macro call
+
+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`
+17 | | A(u8)
+18 | | }
+19 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info)
error: no rules expected the token `enum`
--> tests/ui/pin_project/unsupported.rs:15:1
@@ -38,7 +52,19 @@ error: no rules expected the token `enum`
19 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+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`
+23 | | x: u8,
+24 | | }
+25 | | }
+ | |_^ no rules expected this token in macro call
+ |
+ = note: this error originates in the macro `$crate::__pin_project_expand` (in Nightly builds, run with -Z macro-backtrace for more info)
error: no rules expected the token `union`
--> tests/ui/pin_project/unsupported.rs:21:1
@@ -50,4 +76,4 @@ error: no rules expected the token `union`
25 | | }
| |_^ no rules expected this token in macro call
|
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_expand` (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 5bcb728..597f67c 100644
--- a/tests/ui/pinned_drop/call-drop-inner.stderr
+++ b/tests/ui/pinned_drop/call-drop-inner.stderr
@@ -2,9 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
--> tests/ui/pinned_drop/call-drop-inner.rs:10:13
|
10 | __drop_inner(this);
- | ^^^^^^^^^^^^ ---- supplied 1 argument
- | |
- | expected 0 arguments
+ | ^^^^^^^^^^^^ ---- argument unexpected
|
note: function defined here
--> tests/ui/pinned_drop/call-drop-inner.rs:3:1
@@ -17,4 +15,8 @@ note: function defined here
12 | | }
13 | | }
| |_^
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_make_drop_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: remove the extra argument
+ |
+10 | __drop_inner();
+ | ~~~~~~~~~~~~~~
diff --git a/tests/ui/pinned_drop/conditional-drop-impl.stderr b/tests/ui/pinned_drop/conditional-drop-impl.stderr
index f6c2075..d70009c 100644
--- a/tests/ui/pinned_drop/conditional-drop-impl.stderr
+++ b/tests/ui/pinned_drop/conditional-drop-impl.stderr
@@ -35,4 +35,4 @@ note: the implementor must specify the same requirement
23 | | }
24 | | }
| |_^
- = note: this error originates in the macro `$crate::__pin_project_internal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::__pin_project_make_drop_impl` (in Nightly builds, run with -Z macro-backtrace for more info)