Bug 1910513 - Update pin-project-lite to 0.2.14 r=supply-chain-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D218156
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -4572,9 +4572,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project-lite"
|
name = "pin-project-lite"
|
||||||
version = "0.2.9"
|
version = "0.2.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
|
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-utils"
|
name = "pin-utils"
|
||||||
|
|||||||
@@ -3422,6 +3422,11 @@ who = "Mike Hommey <mh+mozilla@glandium.org>"
|
|||||||
criteria = "safe-to-run"
|
criteria = "safe-to-run"
|
||||||
delta = "1.0.12 -> 1.1.0"
|
delta = "1.0.12 -> 1.1.0"
|
||||||
|
|
||||||
|
[[audits.pin-project-lite]]
|
||||||
|
who = "Mike Hommey <mh+mozilla@glandium.org>"
|
||||||
|
criteria = "safe-to-deploy"
|
||||||
|
delta = "0.2.13 -> 0.2.14"
|
||||||
|
|
||||||
[[audits.pkcs11-bindings]]
|
[[audits.pkcs11-bindings]]
|
||||||
who = "Dana Keeler <dkeeler@mozilla.com>"
|
who = "Dana Keeler <dkeeler@mozilla.com>"
|
||||||
criteria = "safe-to-deploy"
|
criteria = "safe-to-deploy"
|
||||||
|
|||||||
@@ -1312,6 +1312,13 @@ version = "0.2.9"
|
|||||||
notes = "Reviewed on https://fxrev.dev/824504"
|
notes = "Reviewed on https://fxrev.dev/824504"
|
||||||
aggregated-from = "https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/third_party/rust_crates/supply-chain/audits.toml?format=TEXT"
|
aggregated-from = "https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/third_party/rust_crates/supply-chain/audits.toml?format=TEXT"
|
||||||
|
|
||||||
|
[[audits.google.audits.pin-project-lite]]
|
||||||
|
who = "David Koloski <dkoloski@google.com>"
|
||||||
|
criteria = "safe-to-deploy"
|
||||||
|
delta = "0.2.9 -> 0.2.13"
|
||||||
|
notes = "Audited at https://fxrev.dev/946396"
|
||||||
|
aggregated-from = "https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/third_party/rust_crates/supply-chain/audits.toml?format=TEXT"
|
||||||
|
|
||||||
[[audits.google.audits.proc-macro2]]
|
[[audits.google.audits.proc-macro2]]
|
||||||
who = "danakj@chromium.org"
|
who = "danakj@chromium.org"
|
||||||
criteria = "safe-to-deploy"
|
criteria = "safe-to-deploy"
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
29
third_party/rust/pin-project-lite/CHANGELOG.md
vendored
29
third_party/rust/pin-project-lite/CHANGELOG.md
vendored
@@ -10,9 +10,29 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.2.14] - 2024-03-29
|
||||||
|
|
||||||
|
- Document `PinnedDrop`. ([#83](https://github.com/taiki-e/pin-project-lite/pull/83), thanks @jbr)
|
||||||
|
|
||||||
|
## [0.2.13] - 2023-08-25
|
||||||
|
|
||||||
|
- Allow attributes in impl and method of `PinnedDrop` implementation.
|
||||||
|
|
||||||
|
## [0.2.12] - 2023-08-09
|
||||||
|
|
||||||
|
- Work around an issue where the projected types/methods appear in the documentation as if they were part of the public API if the visibility is not correctly parsed due to the rustc bug. See [#77](https://github.com/taiki-e/pin-project-lite/issues/77#issuecomment-1671540180) for details.
|
||||||
|
|
||||||
|
## [0.2.11] - 2023-08-06
|
||||||
|
|
||||||
|
- Add support for `#[project(!Unpin)]`. This is equivalent to pin-project's [!Unpin](https://docs.rs/pin-project/latest/pin_project/attr.pin_project.html#unpin) option. ([#76](https://github.com/taiki-e/pin-project-lite/pull/76), thanks @matheus-consoli)
|
||||||
|
|
||||||
|
## [0.2.10] - 2023-07-02
|
||||||
|
|
||||||
|
- Inline project methods. ([#74](https://github.com/taiki-e/pin-project-lite/pull/74), thanks @EFanZh)
|
||||||
|
|
||||||
## [0.2.9] - 2022-04-26
|
## [0.2.9] - 2022-04-26
|
||||||
|
|
||||||
- Improve compile time of `pin_project!` calls. (#71, thanks @nnethercote)
|
- Improve compile time of `pin_project!` calls. ([#71](https://github.com/taiki-e/pin-project-lite/pull/71), thanks @nnethercote)
|
||||||
|
|
||||||
## [0.2.8] - 2021-12-31
|
## [0.2.8] - 2021-12-31
|
||||||
|
|
||||||
@@ -196,7 +216,12 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
|
|||||||
|
|
||||||
Initial release
|
Initial release
|
||||||
|
|
||||||
[Unreleased]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.9...HEAD
|
[Unreleased]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.14...HEAD
|
||||||
|
[0.2.14]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.13...v0.2.14
|
||||||
|
[0.2.13]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.12...v0.2.13
|
||||||
|
[0.2.12]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.11...v0.2.12
|
||||||
|
[0.2.11]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.10...v0.2.11
|
||||||
|
[0.2.10]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.9...v0.2.10
|
||||||
[0.2.9]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.8...v0.2.9
|
[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.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.7]: https://github.com/taiki-e/pin-project-lite/compare/v0.2.6...v0.2.7
|
||||||
|
|||||||
98
third_party/rust/pin-project-lite/Cargo.toml
vendored
98
third_party/rust/pin-project-lite/Cargo.toml
vendored
@@ -13,33 +13,125 @@
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
rust-version = "1.37"
|
rust-version = "1.37"
|
||||||
name = "pin-project-lite"
|
name = "pin-project-lite"
|
||||||
version = "0.2.9"
|
version = "0.2.14"
|
||||||
exclude = [
|
exclude = [
|
||||||
"/.*",
|
"/.*",
|
||||||
"/tools",
|
"/tools",
|
||||||
|
"/DEVELOPMENT.md",
|
||||||
]
|
]
|
||||||
description = """
|
description = """
|
||||||
A lightweight version of pin-project written with declarative macros.
|
A lightweight version of pin-project written with declarative macros.
|
||||||
"""
|
"""
|
||||||
|
readme = "README.md"
|
||||||
keywords = [
|
keywords = [
|
||||||
"pin",
|
"pin",
|
||||||
"macros",
|
"macros",
|
||||||
]
|
]
|
||||||
categories = [
|
categories = [
|
||||||
"no-std",
|
"no-std",
|
||||||
|
"no-std::no-alloc",
|
||||||
"rust-patterns",
|
"rust-patterns",
|
||||||
]
|
]
|
||||||
license = "Apache-2.0 OR MIT"
|
license = "Apache-2.0 OR MIT"
|
||||||
repository = "https://github.com/taiki-e/pin-project-lite"
|
repository = "https://github.com/taiki-e/pin-project-lite"
|
||||||
|
|
||||||
|
[package.metadata.cargo_check_external_types]
|
||||||
|
allowed_external_types = []
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
targets = ["x86_64-unknown-linux-gnu"]
|
targets = ["x86_64-unknown-linux-gnu"]
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
doc-scrape-examples = false
|
||||||
|
|
||||||
[dev-dependencies.rustversion]
|
[dev-dependencies.rustversion]
|
||||||
version = "1"
|
version = "1"
|
||||||
|
|
||||||
[dev-dependencies.static_assertions]
|
[dev-dependencies.static_assertions]
|
||||||
version = "1"
|
version = "1"
|
||||||
|
|
||||||
[dev-dependencies.trybuild]
|
[lints.clippy]
|
||||||
version = "1.0.49"
|
all = "warn"
|
||||||
|
as_ptr_cast_mut = "warn"
|
||||||
|
default_union_representation = "warn"
|
||||||
|
inline_asm_x86_att_syntax = "warn"
|
||||||
|
pedantic = "warn"
|
||||||
|
trailing_empty_array = "warn"
|
||||||
|
transmute_undefined_repr = "warn"
|
||||||
|
undocumented_unsafe_blocks = "warn"
|
||||||
|
|
||||||
|
[lints.clippy.bool_assert_comparison]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.borrow_as_ptr]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.declare_interior_mutable_const]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.doc_markdown]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.float_cmp]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.manual_assert]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.manual_range_contains]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.missing_errors_doc]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.module_name_repetitions]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.similar_names]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.single_match]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.single_match_else]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.struct_excessive_bools]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.struct_field_names]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.too_many_arguments]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.too_many_lines]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.clippy.type_complexity]
|
||||||
|
level = "allow"
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[lints.rust]
|
||||||
|
improper_ctypes = "warn"
|
||||||
|
improper_ctypes_definitions = "warn"
|
||||||
|
non_ascii_idents = "warn"
|
||||||
|
rust_2018_idioms = "warn"
|
||||||
|
single_use_lifetimes = "warn"
|
||||||
|
unreachable_pub = "warn"
|
||||||
|
|||||||
15
third_party/rust/pin-project-lite/README.md
vendored
15
third_party/rust/pin-project-lite/README.md
vendored
@@ -1,11 +1,12 @@
|
|||||||
# pin-project-lite
|
# pin-project-lite
|
||||||
|
|
||||||
[](https://crates.io/crates/pin-project-lite)
|
[](https://crates.io/crates/pin-project-lite)
|
||||||
[](https://docs.rs/pin-project-lite)
|
[](https://docs.rs/pin-project-lite)
|
||||||
[](#license)
|
[](#license)
|
||||||
[](https://www.rust-lang.org)
|
[](https://www.rust-lang.org)
|
||||||
[](https://github.com/taiki-e/pin-project-lite/actions)
|
[](https://github.com/taiki-e/pin-project-lite/actions)
|
||||||
|
|
||||||
|
<!-- tidy:crate-doc:start -->
|
||||||
A lightweight version of [pin-project] written with declarative macros.
|
A lightweight version of [pin-project] written with declarative macros.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@@ -104,17 +105,21 @@ description of the compile error.
|
|||||||
|
|
||||||
### Different: No support for custom Unpin implementation
|
### Different: No support for custom Unpin implementation
|
||||||
|
|
||||||
pin-project supports this by [`UnsafeUnpin`][unsafe-unpin] and [`!Unpin`][not-unpin].
|
pin-project supports this by [`UnsafeUnpin`][unsafe-unpin]. (`!Unpin` is supported by both [pin-project][not-unpin] and [pin-project-lite][not-unpin-lite].)
|
||||||
|
|
||||||
### Different: No support for tuple structs and tuple variants
|
### Different: No support for tuple structs and tuple variants
|
||||||
|
|
||||||
pin-project supports this.
|
pin-project supports this.
|
||||||
|
|
||||||
[`pin_project!`]: https://docs.rs/pin-project-lite/0.2/pin_project_lite/macro.pin_project.html
|
|
||||||
[not-unpin]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#unpin
|
[not-unpin]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#unpin
|
||||||
|
[not-unpin-lite]: https://docs.rs/pin-project-lite/0.2/pin_project_lite/macro.pin_project.html#unpin
|
||||||
[pin-project]: https://github.com/taiki-e/pin-project
|
[pin-project]: https://github.com/taiki-e/pin-project
|
||||||
[unsafe-unpin]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#unsafeunpin
|
[unsafe-unpin]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#unsafeunpin
|
||||||
|
|
||||||
|
<!-- tidy:crate-doc:end -->
|
||||||
|
|
||||||
|
[`pin_project!`]: https://docs.rs/pin-project-lite/0.2/pin_project_lite/macro.pin_project.html
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or
|
Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or
|
||||||
|
|||||||
410
third_party/rust/pin-project-lite/src/lib.rs
vendored
410
third_party/rust/pin-project-lite/src/lib.rs
vendored
@@ -1,98 +1,118 @@
|
|||||||
//! A lightweight version of [pin-project] written with declarative macros.
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
//!
|
|
||||||
//! # Examples
|
/*!
|
||||||
//!
|
<!-- tidy:crate-doc:start -->
|
||||||
//! [`pin_project!`] macro creates a projection type covering all the fields of struct.
|
A lightweight version of [pin-project] written with declarative macros.
|
||||||
//!
|
|
||||||
//! ```rust
|
## Usage
|
||||||
//! use std::pin::Pin;
|
|
||||||
//!
|
Add this to your `Cargo.toml`:
|
||||||
//! use pin_project_lite::pin_project;
|
|
||||||
//!
|
```toml
|
||||||
//! pin_project! {
|
[dependencies]
|
||||||
//! struct Struct<T, U> {
|
pin-project-lite = "0.2"
|
||||||
//! #[pin]
|
```
|
||||||
//! pinned: T,
|
|
||||||
//! unpinned: U,
|
*Compiler support: requires rustc 1.37+*
|
||||||
//! }
|
|
||||||
//! }
|
## Examples
|
||||||
//!
|
|
||||||
//! impl<T, U> Struct<T, U> {
|
[`pin_project!`] macro creates a projection type covering all the fields of
|
||||||
//! fn method(self: Pin<&mut Self>) {
|
struct.
|
||||||
//! let this = self.project();
|
|
||||||
//! let _: Pin<&mut T> = this.pinned; // Pinned reference to the field
|
```rust
|
||||||
//! let _: &mut U = this.unpinned; // Normal reference to the field
|
use std::pin::Pin;
|
||||||
//! }
|
|
||||||
//! }
|
use pin_project_lite::pin_project;
|
||||||
//! ```
|
|
||||||
//!
|
pin_project! {
|
||||||
//! To use [`pin_project!`] on enums, you need to name the projection type
|
struct Struct<T, U> {
|
||||||
//! returned from the method.
|
#[pin]
|
||||||
//!
|
pinned: T,
|
||||||
//! ```rust
|
unpinned: U,
|
||||||
//! use std::pin::Pin;
|
}
|
||||||
//!
|
}
|
||||||
//! use pin_project_lite::pin_project;
|
|
||||||
//!
|
impl<T, U> Struct<T, U> {
|
||||||
//! pin_project! {
|
fn method(self: Pin<&mut Self>) {
|
||||||
//! #[project = EnumProj]
|
let this = self.project();
|
||||||
//! enum Enum<T, U> {
|
let _: Pin<&mut T> = this.pinned; // Pinned reference to the field
|
||||||
//! Variant { #[pin] pinned: T, unpinned: U },
|
let _: &mut U = this.unpinned; // Normal reference to the field
|
||||||
//! }
|
}
|
||||||
//! }
|
}
|
||||||
//!
|
```
|
||||||
//! impl<T, U> Enum<T, U> {
|
|
||||||
//! fn method(self: Pin<&mut Self>) {
|
To use [`pin_project!`] on enums, you need to name the projection type
|
||||||
//! match self.project() {
|
returned from the method.
|
||||||
//! EnumProj::Variant { pinned, unpinned } => {
|
|
||||||
//! let _: Pin<&mut T> = pinned;
|
```rust
|
||||||
//! let _: &mut U = unpinned;
|
use std::pin::Pin;
|
||||||
//! }
|
|
||||||
//! }
|
use pin_project_lite::pin_project;
|
||||||
//! }
|
|
||||||
//! }
|
pin_project! {
|
||||||
//! ```
|
#[project = EnumProj]
|
||||||
//!
|
enum Enum<T, U> {
|
||||||
//! # [pin-project] vs pin-project-lite
|
Variant { #[pin] pinned: T, unpinned: U },
|
||||||
//!
|
}
|
||||||
//! Here are some similarities and differences compared to [pin-project].
|
}
|
||||||
//!
|
|
||||||
//! ## Similar: Safety
|
impl<T, U> Enum<T, U> {
|
||||||
//!
|
fn method(self: Pin<&mut Self>) {
|
||||||
//! pin-project-lite guarantees safety in much the same way as [pin-project].
|
match self.project() {
|
||||||
//! Both are completely safe unless you write other unsafe code.
|
EnumProj::Variant { pinned, unpinned } => {
|
||||||
//!
|
let _: Pin<&mut T> = pinned;
|
||||||
//! ## Different: Minimal design
|
let _: &mut U = unpinned;
|
||||||
//!
|
}
|
||||||
//! This library does not tackle as expansive of a range of use cases as
|
}
|
||||||
//! [pin-project] does. If your use case is not already covered, please use
|
}
|
||||||
//! [pin-project].
|
}
|
||||||
//!
|
```
|
||||||
//! ## Different: No proc-macro related dependencies
|
|
||||||
//!
|
## [pin-project] vs pin-project-lite
|
||||||
//! This is the **only** reason to use this crate. However, **if you already
|
|
||||||
//! have proc-macro related dependencies in your crate's dependency graph, there
|
Here are some similarities and differences compared to [pin-project].
|
||||||
//! is no benefit from using this crate.** (Note: There is almost no difference
|
|
||||||
//! in the amount of code generated between [pin-project] and pin-project-lite.)
|
### Similar: Safety
|
||||||
//!
|
|
||||||
//! ## Different: No useful error messages
|
pin-project-lite guarantees safety in much the same way as [pin-project].
|
||||||
//!
|
Both are completely safe unless you write other unsafe code.
|
||||||
//! This macro does not handle any invalid input. So error messages are not to
|
|
||||||
//! be useful in most cases. If you do need useful error messages, then upon
|
### Different: Minimal design
|
||||||
//! error you can pass the same input to [pin-project] to receive a helpful
|
|
||||||
//! description of the compile error.
|
This library does not tackle as expansive of a range of use cases as
|
||||||
//!
|
[pin-project] does. If your use case is not already covered, please use
|
||||||
//! ## Different: No support for custom Unpin implementation
|
[pin-project].
|
||||||
//!
|
|
||||||
//! pin-project supports this by [`UnsafeUnpin`][unsafe-unpin] and [`!Unpin`][not-unpin].
|
### Different: No proc-macro related dependencies
|
||||||
//!
|
|
||||||
//! ## Different: No support for tuple structs and tuple variants
|
This is the **only** reason to use this crate. However, **if you already
|
||||||
//!
|
have proc-macro related dependencies in your crate's dependency graph, there
|
||||||
//! pin-project supports this.
|
is no benefit from using this crate.** (Note: There is almost no difference
|
||||||
//!
|
in the amount of code generated between [pin-project] and pin-project-lite.)
|
||||||
//! [not-unpin]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#unpin
|
|
||||||
//! [pin-project]: https://github.com/taiki-e/pin-project
|
### Different: No useful error messages
|
||||||
//! [unsafe-unpin]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#unsafeunpin
|
|
||||||
|
This macro does not handle any invalid input. So error messages are not to
|
||||||
|
be useful in most cases. If you do need useful error messages, then upon
|
||||||
|
error you can pass the same input to [pin-project] to receive a helpful
|
||||||
|
description of the compile error.
|
||||||
|
|
||||||
|
### Different: No support for custom Unpin implementation
|
||||||
|
|
||||||
|
pin-project supports this by [`UnsafeUnpin`][unsafe-unpin]. (`!Unpin` is supported by both [pin-project][not-unpin] and [pin-project-lite][not-unpin-lite].)
|
||||||
|
|
||||||
|
### Different: No support for tuple structs and tuple variants
|
||||||
|
|
||||||
|
pin-project supports this.
|
||||||
|
|
||||||
|
[not-unpin]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#unpin
|
||||||
|
[not-unpin-lite]: https://docs.rs/pin-project-lite/0.2/pin_project_lite/macro.pin_project.html#unpin
|
||||||
|
[pin-project]: https://github.com/taiki-e/pin-project
|
||||||
|
[unsafe-unpin]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html#unsafeunpin
|
||||||
|
|
||||||
|
<!-- tidy:crate-doc:end -->
|
||||||
|
*/
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![doc(test(
|
#![doc(test(
|
||||||
@@ -102,8 +122,19 @@
|
|||||||
allow(dead_code, unused_variables)
|
allow(dead_code, unused_variables)
|
||||||
)
|
)
|
||||||
))]
|
))]
|
||||||
#![warn(rust_2018_idioms, single_use_lifetimes, unreachable_pub)]
|
// #![warn(unsafe_op_in_unsafe_fn)] // requires Rust 1.52
|
||||||
#![warn(clippy::default_trait_access, clippy::wildcard_imports)]
|
#![warn(
|
||||||
|
// Lints that may help when writing public library.
|
||||||
|
missing_debug_implementations,
|
||||||
|
missing_docs,
|
||||||
|
clippy::alloc_instead_of_core,
|
||||||
|
clippy::exhaustive_enums,
|
||||||
|
clippy::exhaustive_structs,
|
||||||
|
clippy::impl_trait_in_params,
|
||||||
|
// clippy::missing_inline_in_public_items,
|
||||||
|
clippy::std_instead_of_alloc,
|
||||||
|
clippy::std_instead_of_core,
|
||||||
|
)]
|
||||||
|
|
||||||
/// A macro that creates a projection type covering all the fields of struct.
|
/// A macro that creates a projection type covering all the fields of struct.
|
||||||
///
|
///
|
||||||
@@ -114,7 +145,7 @@
|
|||||||
///
|
///
|
||||||
/// And the following methods are implemented on the original type:
|
/// And the following methods are implemented on the original type:
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use std::pin::Pin;
|
/// # use std::pin::Pin;
|
||||||
/// # type Projection<'a> = &'a ();
|
/// # type Projection<'a> = &'a ();
|
||||||
/// # type ProjectionRef<'a> = &'a ();
|
/// # type ProjectionRef<'a> = &'a ();
|
||||||
@@ -128,7 +159,7 @@
|
|||||||
/// you can name the projection type returned from the method. This allows you
|
/// you can name the projection type returned from the method. This allows you
|
||||||
/// to use pattern matching on the projected types.
|
/// to use pattern matching on the projected types.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use pin_project_lite::pin_project;
|
/// # use pin_project_lite::pin_project;
|
||||||
/// # use std::pin::Pin;
|
/// # use std::pin::Pin;
|
||||||
/// pin_project! {
|
/// pin_project! {
|
||||||
@@ -154,7 +185,7 @@
|
|||||||
/// method which allows the contents of `Pin<&mut Self>` to be replaced while simultaneously moving
|
/// method which allows the contents of `Pin<&mut Self>` to be replaced while simultaneously moving
|
||||||
/// out all unpinned fields in `Self`.
|
/// out all unpinned fields in `Self`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use std::pin::Pin;
|
/// # use std::pin::Pin;
|
||||||
/// # type MyProjReplace = ();
|
/// # type MyProjReplace = ();
|
||||||
/// # trait Dox {
|
/// # trait Dox {
|
||||||
@@ -184,7 +215,7 @@
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// use std::pin::Pin;
|
/// use std::pin::Pin;
|
||||||
///
|
///
|
||||||
/// use pin_project_lite::pin_project;
|
/// use pin_project_lite::pin_project;
|
||||||
@@ -209,7 +240,7 @@
|
|||||||
/// To use `pin_project!` on enums, you need to name the projection type
|
/// To use `pin_project!` on enums, you need to name the projection type
|
||||||
/// returned from the method.
|
/// returned from the method.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// use std::pin::Pin;
|
/// use std::pin::Pin;
|
||||||
///
|
///
|
||||||
/// use pin_project_lite::pin_project;
|
/// use pin_project_lite::pin_project;
|
||||||
@@ -241,7 +272,7 @@
|
|||||||
/// original [`Pin`] type, it needs to use [`.as_mut()`][`Pin::as_mut`] to avoid
|
/// original [`Pin`] type, it needs to use [`.as_mut()`][`Pin::as_mut`] to avoid
|
||||||
/// consuming the [`Pin`].
|
/// consuming the [`Pin`].
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// use std::pin::Pin;
|
/// use std::pin::Pin;
|
||||||
///
|
///
|
||||||
/// use pin_project_lite::pin_project;
|
/// use pin_project_lite::pin_project;
|
||||||
@@ -264,10 +295,24 @@
|
|||||||
///
|
///
|
||||||
/// # `!Unpin`
|
/// # `!Unpin`
|
||||||
///
|
///
|
||||||
/// If you want to ensure that [`Unpin`] is not implemented, use `#[pin]`
|
/// If you want to make sure `Unpin` is not implemented, use the `#[project(!Unpin)]`
|
||||||
/// attribute for a [`PhantomPinned`] field.
|
/// attribute.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
|
/// use pin_project_lite::pin_project;
|
||||||
|
///
|
||||||
|
/// pin_project! {
|
||||||
|
/// #[project(!Unpin)]
|
||||||
|
/// struct Struct<T> {
|
||||||
|
/// #[pin]
|
||||||
|
/// field: T,
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// This is equivalent to using `#[pin]` attribute for a [`PhantomPinned`] field.
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
/// use std::marker::PhantomPinned;
|
/// use std::marker::PhantomPinned;
|
||||||
///
|
///
|
||||||
/// use pin_project_lite::pin_project;
|
/// use pin_project_lite::pin_project;
|
||||||
@@ -275,13 +320,60 @@
|
|||||||
/// pin_project! {
|
/// pin_project! {
|
||||||
/// struct Struct<T> {
|
/// struct Struct<T> {
|
||||||
/// field: T,
|
/// field: T,
|
||||||
/// #[pin] // <------ This `#[pin]` is required to make `Struct` to `!Unpin`.
|
/// #[pin]
|
||||||
/// _pin: PhantomPinned,
|
/// _pin: PhantomPinned,
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Note that using [`PhantomPinned`] without `#[pin]` attribute has no effect.
|
/// Note that using [`PhantomPinned`] without `#[pin]` or `#[project(!Unpin)]`
|
||||||
|
/// attribute has no effect.
|
||||||
|
///
|
||||||
|
/// # Pinned Drop
|
||||||
|
///
|
||||||
|
/// In order to correctly implement pin projections, a type’s [`Drop`] impl must not move out of any
|
||||||
|
/// structurally pinned fields. Unfortunately, [`Drop::drop`] takes `&mut Self`, not `Pin<&mut
|
||||||
|
/// Self>`.
|
||||||
|
///
|
||||||
|
/// To implement [`Drop`] for type that has pin, add an `impl PinnedDrop` block at the end of the
|
||||||
|
/// [`pin_project`] macro block. PinnedDrop has the following interface:
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// # use std::pin::Pin;
|
||||||
|
/// trait PinnedDrop {
|
||||||
|
/// fn drop(this: Pin<&mut Self>);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// Note that the argument to `PinnedDrop::drop` cannot be named `self`.
|
||||||
|
///
|
||||||
|
/// `pin_project!` implements the actual [`Drop`] trait via PinnedDrop you implemented. To
|
||||||
|
/// explicitly drop a type that implements PinnedDrop, use the [drop] function just like dropping a
|
||||||
|
/// type that directly implements [`Drop`].
|
||||||
|
///
|
||||||
|
/// `PinnedDrop::drop` will never be called more than once, just like [`Drop::drop`].
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// use pin_project_lite::pin_project;
|
||||||
|
///
|
||||||
|
/// pin_project! {
|
||||||
|
/// pub struct Struct<'a> {
|
||||||
|
/// was_dropped: &'a mut bool,
|
||||||
|
/// #[pin]
|
||||||
|
/// field: u8,
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// impl PinnedDrop for Struct<'_> {
|
||||||
|
/// fn drop(this: Pin<&mut Self>) { // <----- NOTE: this is not `self`
|
||||||
|
/// **this.project().was_dropped = true;
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// let mut was_dropped = false;
|
||||||
|
/// drop(Struct { was_dropped: &mut was_dropped, field: 42 });
|
||||||
|
/// assert!(was_dropped);
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// [`PhantomPinned`]: core::marker::PhantomPinned
|
/// [`PhantomPinned`]: core::marker::PhantomPinned
|
||||||
/// [`Pin::as_mut`]: core::pin::Pin::as_mut
|
/// [`Pin::as_mut`]: core::pin::Pin::as_mut
|
||||||
@@ -291,7 +383,7 @@
|
|||||||
macro_rules! pin_project {
|
macro_rules! pin_project {
|
||||||
($($tt:tt)*) => {
|
($($tt:tt)*) => {
|
||||||
$crate::__pin_project_internal! {
|
$crate::__pin_project_internal! {
|
||||||
[][][][]
|
[][][][][]
|
||||||
$($tt)*
|
$($tt)*
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -313,6 +405,7 @@ macro_rules! __pin_project_expand {
|
|||||||
[$($proj_mut_ident:ident)?]
|
[$($proj_mut_ident:ident)?]
|
||||||
[$($proj_ref_ident:ident)?]
|
[$($proj_ref_ident:ident)?]
|
||||||
[$($proj_replace_ident:ident)?]
|
[$($proj_replace_ident:ident)?]
|
||||||
|
[$($proj_not_unpin_mark:ident)?]
|
||||||
[$proj_vis:vis]
|
[$proj_vis:vis]
|
||||||
[$(#[$attrs:meta])* $vis:vis $struct_ty_ident:ident $ident:ident]
|
[$(#[$attrs:meta])* $vis:vis $struct_ty_ident:ident $ident:ident]
|
||||||
[$($def_generics:tt)*]
|
[$($def_generics:tt)*]
|
||||||
@@ -320,7 +413,7 @@ macro_rules! __pin_project_expand {
|
|||||||
{
|
{
|
||||||
$($body_data:tt)*
|
$($body_data:tt)*
|
||||||
}
|
}
|
||||||
$(impl $($pinned_drop:tt)*)?
|
$($(#[$drop_impl_attrs:meta])* impl $($pinned_drop:tt)*)?
|
||||||
) => {
|
) => {
|
||||||
$crate::__pin_project_reconstruct! {
|
$crate::__pin_project_reconstruct! {
|
||||||
[$(#[$attrs])* $vis $struct_ty_ident $ident]
|
[$(#[$attrs])* $vis $struct_ty_ident $ident]
|
||||||
@@ -362,13 +455,14 @@ macro_rules! __pin_project_expand {
|
|||||||
$crate::__pin_project_constant! {
|
$crate::__pin_project_constant! {
|
||||||
[$(#[$attrs])* $vis $struct_ty_ident $ident]
|
[$(#[$attrs])* $vis $struct_ty_ident $ident]
|
||||||
[$($proj_mut_ident)?] [$($proj_ref_ident)?] [$($proj_replace_ident)?]
|
[$($proj_mut_ident)?] [$($proj_ref_ident)?] [$($proj_replace_ident)?]
|
||||||
|
[$($proj_not_unpin_mark)?]
|
||||||
[$proj_vis]
|
[$proj_vis]
|
||||||
[$($def_generics)*] [$($impl_generics)*]
|
[$($def_generics)*] [$($impl_generics)*]
|
||||||
[$($ty_generics)*] [$(where $($where_clause)*)?]
|
[$($ty_generics)*] [$(where $($where_clause)*)?]
|
||||||
{
|
{
|
||||||
$($body_data)*
|
$($body_data)*
|
||||||
}
|
}
|
||||||
$(impl $($pinned_drop)*)?
|
$($(#[$drop_impl_attrs])* impl $($pinned_drop)*)?
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -379,6 +473,7 @@ macro_rules! __pin_project_constant {
|
|||||||
(
|
(
|
||||||
[$(#[$attrs:meta])* $vis:vis struct $ident:ident]
|
[$(#[$attrs:meta])* $vis:vis struct $ident:ident]
|
||||||
[$($proj_mut_ident:ident)?] [$($proj_ref_ident:ident)?] [$($proj_replace_ident:ident)?]
|
[$($proj_mut_ident:ident)?] [$($proj_ref_ident:ident)?] [$($proj_replace_ident:ident)?]
|
||||||
|
[$($proj_not_unpin_mark:ident)?]
|
||||||
[$proj_vis:vis]
|
[$proj_vis:vis]
|
||||||
[$($def_generics:tt)*]
|
[$($def_generics:tt)*]
|
||||||
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
|
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
|
||||||
@@ -388,7 +483,7 @@ macro_rules! __pin_project_constant {
|
|||||||
$field_vis:vis $field:ident: $field_ty:ty
|
$field_vis:vis $field:ident: $field_ty:ty
|
||||||
),+ $(,)?
|
),+ $(,)?
|
||||||
}
|
}
|
||||||
$(impl $($pinned_drop:tt)*)?
|
$($(#[$drop_impl_attrs:meta])* impl $($pinned_drop:tt)*)?
|
||||||
) => {
|
) => {
|
||||||
#[allow(explicit_outlives_requirements)] // https://github.com/rust-lang/rust/issues/60993
|
#[allow(explicit_outlives_requirements)] // https://github.com/rust-lang/rust/issues/60993
|
||||||
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
|
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
|
||||||
@@ -466,6 +561,7 @@ macro_rules! __pin_project_constant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$crate::__pin_project_make_unpin_impl! {
|
$crate::__pin_project_make_unpin_impl! {
|
||||||
|
[$($proj_not_unpin_mark)?]
|
||||||
[$vis $ident]
|
[$vis $ident]
|
||||||
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
|
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
|
||||||
$(
|
$(
|
||||||
@@ -478,7 +574,7 @@ macro_rules! __pin_project_constant {
|
|||||||
$crate::__pin_project_make_drop_impl! {
|
$crate::__pin_project_make_drop_impl! {
|
||||||
[$ident]
|
[$ident]
|
||||||
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
|
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
|
||||||
$(impl $($pinned_drop)*)?
|
$($(#[$drop_impl_attrs])* impl $($pinned_drop)*)?
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that it's impossible to use pin projections on a #[repr(packed)] struct.
|
// Ensure that it's impossible to use pin projections on a #[repr(packed)] struct.
|
||||||
@@ -515,6 +611,7 @@ macro_rules! __pin_project_constant {
|
|||||||
(
|
(
|
||||||
[$(#[$attrs:meta])* $vis:vis enum $ident:ident]
|
[$(#[$attrs:meta])* $vis:vis enum $ident:ident]
|
||||||
[$($proj_mut_ident:ident)?] [$($proj_ref_ident:ident)?] [$($proj_replace_ident:ident)?]
|
[$($proj_mut_ident:ident)?] [$($proj_ref_ident:ident)?] [$($proj_replace_ident:ident)?]
|
||||||
|
[$($proj_not_unpin_mark:ident)?]
|
||||||
[$proj_vis:vis]
|
[$proj_vis:vis]
|
||||||
[$($def_generics:tt)*]
|
[$($def_generics:tt)*]
|
||||||
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
|
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
|
||||||
@@ -529,7 +626,7 @@ macro_rules! __pin_project_constant {
|
|||||||
})?
|
})?
|
||||||
),+ $(,)?
|
),+ $(,)?
|
||||||
}
|
}
|
||||||
$(impl $($pinned_drop:tt)*)?
|
$($(#[$drop_impl_attrs:meta])* impl $($pinned_drop:tt)*)?
|
||||||
) => {
|
) => {
|
||||||
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
|
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
|
||||||
// This lint warns of `clippy::*` generated by external macros.
|
// This lint warns of `clippy::*` generated by external macros.
|
||||||
@@ -591,6 +688,7 @@ macro_rules! __pin_project_constant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$crate::__pin_project_make_unpin_impl! {
|
$crate::__pin_project_make_unpin_impl! {
|
||||||
|
[$($proj_not_unpin_mark)?]
|
||||||
[$vis $ident]
|
[$vis $ident]
|
||||||
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
|
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
|
||||||
$(
|
$(
|
||||||
@@ -607,7 +705,7 @@ macro_rules! __pin_project_constant {
|
|||||||
$crate::__pin_project_make_drop_impl! {
|
$crate::__pin_project_make_drop_impl! {
|
||||||
[$ident]
|
[$ident]
|
||||||
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
|
[$($impl_generics)*] [$($ty_generics)*] [$(where $($where_clause)*)?]
|
||||||
$(impl $($pinned_drop)*)?
|
$($(#[$drop_impl_attrs])* impl $($pinned_drop)*)?
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't need to check for '#[repr(packed)]',
|
// We don't need to check for '#[repr(packed)]',
|
||||||
@@ -752,6 +850,7 @@ macro_rules! __pin_project_make_proj_ty_body {
|
|||||||
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
|
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
|
||||||
[$($body_data:tt)+]
|
[$($body_data:tt)+]
|
||||||
) => {
|
) => {
|
||||||
|
#[doc(hidden)] // Workaround for rustc bug: see https://github.com/taiki-e/pin-project-lite/issues/77#issuecomment-1671540180 for more.
|
||||||
#[allow(dead_code)] // This lint warns unused fields/variants.
|
#[allow(dead_code)] // This lint warns unused fields/variants.
|
||||||
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
|
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
|
||||||
// This lint warns of `clippy::*` generated by external macros.
|
// This lint warns of `clippy::*` generated by external macros.
|
||||||
@@ -845,6 +944,7 @@ macro_rules! __pin_project_make_proj_replace_ty_body {
|
|||||||
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
|
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
|
||||||
[$($body_data:tt)+]
|
[$($body_data:tt)+]
|
||||||
) => {
|
) => {
|
||||||
|
#[doc(hidden)] // Workaround for rustc bug: see https://github.com/taiki-e/pin-project-lite/issues/77#issuecomment-1671540180 for more.
|
||||||
#[allow(dead_code)] // This lint warns unused fields/variants.
|
#[allow(dead_code)] // This lint warns unused fields/variants.
|
||||||
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
|
#[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::mut_mut)] // This lint warns `&mut &mut <ty>`. (only needed for project)
|
||||||
@@ -923,6 +1023,8 @@ macro_rules! __pin_project_struct_make_proj_method {
|
|||||||
),+
|
),+
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
|
#[doc(hidden)] // Workaround for rustc bug: see https://github.com/taiki-e/pin-project-lite/issues/77#issuecomment-1671540180 for more.
|
||||||
|
#[inline]
|
||||||
$proj_vis fn $method_ident<'__pin>(
|
$proj_vis fn $method_ident<'__pin>(
|
||||||
self: $crate::__private::Pin<&'__pin $($mut)? Self>,
|
self: $crate::__private::Pin<&'__pin $($mut)? Self>,
|
||||||
) -> $proj_ty_ident <'__pin, $($ty_generics)*> {
|
) -> $proj_ty_ident <'__pin, $($ty_generics)*> {
|
||||||
@@ -956,6 +1058,8 @@ macro_rules! __pin_project_struct_make_proj_replace_method {
|
|||||||
),+
|
),+
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
|
#[doc(hidden)] // Workaround for rustc bug: see https://github.com/taiki-e/pin-project-lite/issues/77#issuecomment-1671540180 for more.
|
||||||
|
#[inline]
|
||||||
$proj_vis fn project_replace(
|
$proj_vis fn project_replace(
|
||||||
self: $crate::__private::Pin<&mut Self>,
|
self: $crate::__private::Pin<&mut Self>,
|
||||||
replacement: Self,
|
replacement: Self,
|
||||||
@@ -1003,6 +1107,8 @@ macro_rules! __pin_project_enum_make_proj_method {
|
|||||||
),+
|
),+
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
|
#[doc(hidden)] // Workaround for rustc bug: see https://github.com/taiki-e/pin-project-lite/issues/77#issuecomment-1671540180 for more.
|
||||||
|
#[inline]
|
||||||
$proj_vis fn $method_ident<'__pin>(
|
$proj_vis fn $method_ident<'__pin>(
|
||||||
self: $crate::__private::Pin<&'__pin $($mut)? Self>,
|
self: $crate::__private::Pin<&'__pin $($mut)? Self>,
|
||||||
) -> $proj_ty_ident <'__pin, $($ty_generics)*> {
|
) -> $proj_ty_ident <'__pin, $($ty_generics)*> {
|
||||||
@@ -1046,6 +1152,8 @@ macro_rules! __pin_project_enum_make_proj_replace_method {
|
|||||||
),+
|
),+
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
|
#[doc(hidden)] // Workaround for rustc bug: see https://github.com/taiki-e/pin-project-lite/issues/77#issuecomment-1671540180 for more.
|
||||||
|
#[inline]
|
||||||
$proj_vis fn project_replace(
|
$proj_vis fn project_replace(
|
||||||
self: $crate::__private::Pin<&mut Self>,
|
self: $crate::__private::Pin<&mut Self>,
|
||||||
replacement: Self,
|
replacement: Self,
|
||||||
@@ -1083,6 +1191,7 @@ macro_rules! __pin_project_enum_make_proj_replace_method {
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! __pin_project_make_unpin_impl {
|
macro_rules! __pin_project_make_unpin_impl {
|
||||||
(
|
(
|
||||||
|
[]
|
||||||
[$vis:vis $ident:ident]
|
[$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)*
|
$($field:tt)*
|
||||||
@@ -1090,7 +1199,7 @@ macro_rules! __pin_project_make_unpin_impl {
|
|||||||
// Automatically create the appropriate conditional `Unpin` implementation.
|
// Automatically create the appropriate conditional `Unpin` implementation.
|
||||||
//
|
//
|
||||||
// Basically this is equivalent to the following code:
|
// Basically this is equivalent to the following code:
|
||||||
// ```rust
|
// ```
|
||||||
// impl<T, U> Unpin for Struct<T, U> where T: Unpin {}
|
// impl<T, U> Unpin for Struct<T, U> where T: Unpin {}
|
||||||
// ```
|
// ```
|
||||||
//
|
//
|
||||||
@@ -1127,6 +1236,23 @@ macro_rules! __pin_project_make_unpin_impl {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
(
|
||||||
|
[$proj_not_unpin_mark:ident]
|
||||||
|
[$vis:vis $ident:ident]
|
||||||
|
[$($impl_generics:tt)*] [$($ty_generics:tt)*] [$(where $($where_clause:tt)*)?]
|
||||||
|
$($field:tt)*
|
||||||
|
) => {
|
||||||
|
#[doc(hidden)]
|
||||||
|
impl <'__pin, $($impl_generics)*> $crate::__private::Unpin for $ident <$($ty_generics)*>
|
||||||
|
where
|
||||||
|
(
|
||||||
|
::core::marker::PhantomData<&'__pin ()>,
|
||||||
|
::core::marker::PhantomPinned,
|
||||||
|
): $crate::__private::Unpin
|
||||||
|
$(, $($where_clause)*)?
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
@@ -1135,6 +1261,7 @@ macro_rules! __pin_project_make_drop_impl {
|
|||||||
(
|
(
|
||||||
[$_ident:ident]
|
[$_ident:ident]
|
||||||
[$($_impl_generics:tt)*] [$($_ty_generics:tt)*] [$(where $($_where_clause:tt)*)?]
|
[$($_impl_generics:tt)*] [$($_ty_generics:tt)*] [$(where $($_where_clause:tt)*)?]
|
||||||
|
$(#[$drop_impl_attrs:meta])*
|
||||||
impl $(<
|
impl $(<
|
||||||
$( $lifetime:lifetime $(: $lifetime_bound:lifetime)? ),* $(,)?
|
$( $lifetime:lifetime $(: $lifetime_bound:lifetime)? ),* $(,)?
|
||||||
$( $generics:ident
|
$( $generics:ident
|
||||||
@@ -1151,11 +1278,13 @@ macro_rules! __pin_project_make_drop_impl {
|
|||||||
),* $(,)?
|
),* $(,)?
|
||||||
)?
|
)?
|
||||||
{
|
{
|
||||||
|
$(#[$drop_fn_attrs:meta])*
|
||||||
fn drop($($arg:ident)+: Pin<&mut Self>) {
|
fn drop($($arg:ident)+: Pin<&mut Self>) {
|
||||||
$($tt:tt)*
|
$($tt:tt)*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
|
$(#[$drop_impl_attrs])*
|
||||||
impl $(<
|
impl $(<
|
||||||
$( $lifetime $(: $lifetime_bound)? ,)*
|
$( $lifetime $(: $lifetime_bound)? ,)*
|
||||||
$( $generics
|
$( $generics
|
||||||
@@ -1172,6 +1301,7 @@ macro_rules! __pin_project_make_drop_impl {
|
|||||||
),*
|
),*
|
||||||
)?
|
)?
|
||||||
{
|
{
|
||||||
|
$(#[$drop_fn_attrs])*
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
// Implementing `__DropInner::__drop_inner` is safe, but calling it is not safe.
|
// Implementing `__DropInner::__drop_inner` is safe, but calling it is not safe.
|
||||||
// This is because destructors can be called multiple times in safe code and
|
// This is because destructors can be called multiple times in safe code and
|
||||||
@@ -1325,6 +1455,7 @@ macro_rules! __pin_project_internal {
|
|||||||
[]
|
[]
|
||||||
[$($proj_ref_ident:ident)?]
|
[$($proj_ref_ident:ident)?]
|
||||||
[$($proj_replace_ident:ident)?]
|
[$($proj_replace_ident:ident)?]
|
||||||
|
[$( ! $proj_not_unpin_mark:ident)?]
|
||||||
[$($attrs:tt)*]
|
[$($attrs:tt)*]
|
||||||
|
|
||||||
#[project = $proj_mut_ident:ident]
|
#[project = $proj_mut_ident:ident]
|
||||||
@@ -1334,6 +1465,7 @@ macro_rules! __pin_project_internal {
|
|||||||
[$proj_mut_ident]
|
[$proj_mut_ident]
|
||||||
[$($proj_ref_ident)?]
|
[$($proj_ref_ident)?]
|
||||||
[$($proj_replace_ident)?]
|
[$($proj_replace_ident)?]
|
||||||
|
[$( ! $proj_not_unpin_mark)?]
|
||||||
[$($attrs)*]
|
[$($attrs)*]
|
||||||
$($tt)*
|
$($tt)*
|
||||||
}
|
}
|
||||||
@@ -1343,6 +1475,7 @@ macro_rules! __pin_project_internal {
|
|||||||
[$($proj_mut_ident:ident)?]
|
[$($proj_mut_ident:ident)?]
|
||||||
[]
|
[]
|
||||||
[$($proj_replace_ident:ident)?]
|
[$($proj_replace_ident:ident)?]
|
||||||
|
[$( ! $proj_not_unpin_mark:ident)?]
|
||||||
[$($attrs:tt)*]
|
[$($attrs:tt)*]
|
||||||
|
|
||||||
#[project_ref = $proj_ref_ident:ident]
|
#[project_ref = $proj_ref_ident:ident]
|
||||||
@@ -1352,6 +1485,7 @@ macro_rules! __pin_project_internal {
|
|||||||
[$($proj_mut_ident)?]
|
[$($proj_mut_ident)?]
|
||||||
[$proj_ref_ident]
|
[$proj_ref_ident]
|
||||||
[$($proj_replace_ident)?]
|
[$($proj_replace_ident)?]
|
||||||
|
[$( ! $proj_not_unpin_mark)?]
|
||||||
[$($attrs)*]
|
[$($attrs)*]
|
||||||
$($tt)*
|
$($tt)*
|
||||||
}
|
}
|
||||||
@@ -1361,6 +1495,7 @@ macro_rules! __pin_project_internal {
|
|||||||
[$($proj_mut_ident:ident)?]
|
[$($proj_mut_ident:ident)?]
|
||||||
[$($proj_ref_ident:ident)?]
|
[$($proj_ref_ident:ident)?]
|
||||||
[]
|
[]
|
||||||
|
[$( ! $proj_not_unpin_mark:ident)?]
|
||||||
[$($attrs:tt)*]
|
[$($attrs:tt)*]
|
||||||
|
|
||||||
#[project_replace = $proj_replace_ident:ident]
|
#[project_replace = $proj_replace_ident:ident]
|
||||||
@@ -1370,6 +1505,27 @@ macro_rules! __pin_project_internal {
|
|||||||
[$($proj_mut_ident)?]
|
[$($proj_mut_ident)?]
|
||||||
[$($proj_ref_ident)?]
|
[$($proj_ref_ident)?]
|
||||||
[$proj_replace_ident]
|
[$proj_replace_ident]
|
||||||
|
[$( ! $proj_not_unpin_mark)?]
|
||||||
|
[$($attrs)*]
|
||||||
|
$($tt)*
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// parsing !Unpin
|
||||||
|
(
|
||||||
|
[$($proj_mut_ident:ident)?]
|
||||||
|
[$($proj_ref_ident:ident)?]
|
||||||
|
[$($proj_replace_ident:ident)?]
|
||||||
|
[]
|
||||||
|
[$($attrs:tt)*]
|
||||||
|
|
||||||
|
#[project( ! $proj_not_unpin_mark:ident)]
|
||||||
|
$($tt:tt)*
|
||||||
|
) => {
|
||||||
|
$crate::__pin_project_internal! {
|
||||||
|
[$($proj_mut_ident)?]
|
||||||
|
[$($proj_ref_ident)?]
|
||||||
|
[$($proj_replace_ident)?]
|
||||||
|
[ ! $proj_not_unpin_mark]
|
||||||
[$($attrs)*]
|
[$($attrs)*]
|
||||||
$($tt)*
|
$($tt)*
|
||||||
}
|
}
|
||||||
@@ -1380,6 +1536,7 @@ macro_rules! __pin_project_internal {
|
|||||||
[$($proj_mut_ident:ident)?]
|
[$($proj_mut_ident:ident)?]
|
||||||
[$($proj_ref_ident:ident)?]
|
[$($proj_ref_ident:ident)?]
|
||||||
[$($proj_replace_ident:ident)?]
|
[$($proj_replace_ident:ident)?]
|
||||||
|
[$( ! $proj_not_unpin_mark:ident)?]
|
||||||
[$($attrs:tt)*]
|
[$($attrs:tt)*]
|
||||||
|
|
||||||
#[$($attr:tt)*]
|
#[$($attr:tt)*]
|
||||||
@@ -1389,6 +1546,7 @@ macro_rules! __pin_project_internal {
|
|||||||
[$($proj_mut_ident)?]
|
[$($proj_mut_ident)?]
|
||||||
[$($proj_ref_ident)?]
|
[$($proj_ref_ident)?]
|
||||||
[$($proj_replace_ident)?]
|
[$($proj_replace_ident)?]
|
||||||
|
[$( ! $proj_not_unpin_mark)?]
|
||||||
[$($attrs)* #[$($attr)*]]
|
[$($attrs)* #[$($attr)*]]
|
||||||
$($tt)*
|
$($tt)*
|
||||||
}
|
}
|
||||||
@@ -1399,6 +1557,7 @@ macro_rules! __pin_project_internal {
|
|||||||
[$($proj_mut_ident:ident)?]
|
[$($proj_mut_ident:ident)?]
|
||||||
[$($proj_ref_ident:ident)?]
|
[$($proj_ref_ident:ident)?]
|
||||||
[$($proj_replace_ident:ident)?]
|
[$($proj_replace_ident:ident)?]
|
||||||
|
[$( ! $proj_not_unpin_mark:ident)?]
|
||||||
[$($attrs:tt)*]
|
[$($attrs:tt)*]
|
||||||
pub $struct_ty_ident:ident $ident:ident
|
pub $struct_ty_ident:ident $ident:ident
|
||||||
$($tt:tt)*
|
$($tt:tt)*
|
||||||
@@ -1407,6 +1566,7 @@ macro_rules! __pin_project_internal {
|
|||||||
[$($proj_mut_ident)?]
|
[$($proj_mut_ident)?]
|
||||||
[$($proj_ref_ident)?]
|
[$($proj_ref_ident)?]
|
||||||
[$($proj_replace_ident)?]
|
[$($proj_replace_ident)?]
|
||||||
|
[$($proj_not_unpin_mark)?]
|
||||||
[$($attrs)*]
|
[$($attrs)*]
|
||||||
[pub $struct_ty_ident $ident pub(crate)]
|
[pub $struct_ty_ident $ident pub(crate)]
|
||||||
$($tt)*
|
$($tt)*
|
||||||
@@ -1416,6 +1576,7 @@ macro_rules! __pin_project_internal {
|
|||||||
[$($proj_mut_ident:ident)?]
|
[$($proj_mut_ident:ident)?]
|
||||||
[$($proj_ref_ident:ident)?]
|
[$($proj_ref_ident:ident)?]
|
||||||
[$($proj_replace_ident:ident)?]
|
[$($proj_replace_ident:ident)?]
|
||||||
|
[$( ! $proj_not_unpin_mark:ident)?]
|
||||||
[$($attrs:tt)*]
|
[$($attrs:tt)*]
|
||||||
$vis:vis $struct_ty_ident:ident $ident:ident
|
$vis:vis $struct_ty_ident:ident $ident:ident
|
||||||
$($tt:tt)*
|
$($tt:tt)*
|
||||||
@@ -1424,6 +1585,7 @@ macro_rules! __pin_project_internal {
|
|||||||
[$($proj_mut_ident)?]
|
[$($proj_mut_ident)?]
|
||||||
[$($proj_ref_ident)?]
|
[$($proj_ref_ident)?]
|
||||||
[$($proj_replace_ident)?]
|
[$($proj_replace_ident)?]
|
||||||
|
[$($proj_not_unpin_mark)?]
|
||||||
[$($attrs)*]
|
[$($attrs)*]
|
||||||
[$vis $struct_ty_ident $ident $vis]
|
[$vis $struct_ty_ident $ident $vis]
|
||||||
$($tt)*
|
$($tt)*
|
||||||
@@ -1438,8 +1600,9 @@ macro_rules! __pin_project_parse_generics {
|
|||||||
[$($proj_mut_ident:ident)?]
|
[$($proj_mut_ident:ident)?]
|
||||||
[$($proj_ref_ident:ident)?]
|
[$($proj_ref_ident:ident)?]
|
||||||
[$($proj_replace_ident:ident)?]
|
[$($proj_replace_ident:ident)?]
|
||||||
|
[$($proj_not_unpin_mark:ident)?]
|
||||||
[$($attrs:tt)*]
|
[$($attrs:tt)*]
|
||||||
[$vis:vis $struct_ty_ident:ident $ident:ident $proj_ty_vis:vis]
|
[$vis:vis $struct_ty_ident:ident $ident:ident $proj_vis:vis]
|
||||||
$(<
|
$(<
|
||||||
$( $lifetime:lifetime $(: $lifetime_bound:lifetime)? ),* $(,)?
|
$( $lifetime:lifetime $(: $lifetime_bound:lifetime)? ),* $(,)?
|
||||||
$( $generics:ident
|
$( $generics:ident
|
||||||
@@ -1459,13 +1622,14 @@ macro_rules! __pin_project_parse_generics {
|
|||||||
{
|
{
|
||||||
$($body_data:tt)*
|
$($body_data:tt)*
|
||||||
}
|
}
|
||||||
$(impl $($pinned_drop:tt)*)?
|
$($(#[$drop_impl_attrs:meta])* impl $($pinned_drop:tt)*)?
|
||||||
) => {
|
) => {
|
||||||
$crate::__pin_project_expand! {
|
$crate::__pin_project_expand! {
|
||||||
[$($proj_mut_ident)?]
|
[$($proj_mut_ident)?]
|
||||||
[$($proj_ref_ident)?]
|
[$($proj_ref_ident)?]
|
||||||
[$($proj_replace_ident)?]
|
[$($proj_replace_ident)?]
|
||||||
[$proj_ty_vis]
|
[$($proj_not_unpin_mark)?]
|
||||||
|
[$proj_vis]
|
||||||
[$($attrs)* $vis $struct_ty_ident $ident]
|
[$($attrs)* $vis $struct_ty_ident $ident]
|
||||||
[$(<
|
[$(<
|
||||||
$( $lifetime $(: $lifetime_bound)? ,)*
|
$( $lifetime $(: $lifetime_bound)? ,)*
|
||||||
@@ -1493,12 +1657,14 @@ macro_rules! __pin_project_parse_generics {
|
|||||||
{
|
{
|
||||||
$($body_data)*
|
$($body_data)*
|
||||||
}
|
}
|
||||||
$(impl $($pinned_drop)*)?
|
$($(#[$drop_impl_attrs])* impl $($pinned_drop)*)?
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not public API.
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
#[allow(missing_debug_implementations)]
|
||||||
pub mod __private {
|
pub mod __private {
|
||||||
use core::mem::ManuallyDrop;
|
use core::mem::ManuallyDrop;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
@@ -1528,6 +1694,8 @@ pub mod __private {
|
|||||||
|
|
||||||
impl<T: ?Sized> Drop for UnsafeDropInPlaceGuard<T> {
|
impl<T: ?Sized> Drop for UnsafeDropInPlaceGuard<T> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
|
// SAFETY: the caller of `UnsafeDropInPlaceGuard::new` must guarantee
|
||||||
|
// that `ptr` is valid for drop when this guard is destructed.
|
||||||
unsafe {
|
unsafe {
|
||||||
ptr::drop_in_place(self.0);
|
ptr::drop_in_place(self.0);
|
||||||
}
|
}
|
||||||
@@ -1551,6 +1719,8 @@ pub mod __private {
|
|||||||
|
|
||||||
impl<T> Drop for UnsafeOverwriteGuard<T> {
|
impl<T> Drop for UnsafeOverwriteGuard<T> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
|
// SAFETY: the caller of `UnsafeOverwriteGuard::new` must guarantee
|
||||||
|
// that `target` is valid for writes when this guard is destructed.
|
||||||
unsafe {
|
unsafe {
|
||||||
ptr::write(self.target, ptr::read(&*self.value));
|
ptr::write(self.target, ptr::read(&*self.value));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
# 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).
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
#![allow(dead_code, unused_macros)]
|
#![allow(dead_code, unused_macros)]
|
||||||
|
|
||||||
macro_rules! assert_unpin {
|
macro_rules! assert_unpin {
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
#![cfg(not(miri))]
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
#![warn(rust_2018_idioms, single_use_lifetimes)]
|
|
||||||
|
|
||||||
use std::env;
|
#![cfg(not(miri))]
|
||||||
|
#![cfg(not(careful))]
|
||||||
|
|
||||||
#[rustversion::attr(not(nightly), ignore)]
|
#[rustversion::attr(not(nightly), ignore)]
|
||||||
#[test]
|
#[test]
|
||||||
fn ui() {
|
fn ui() {
|
||||||
if env::var_os("CI").is_none() {
|
|
||||||
env::set_var("TRYBUILD", "overwrite");
|
|
||||||
}
|
|
||||||
|
|
||||||
let t = trybuild::TestCases::new();
|
let t = trybuild::TestCases::new();
|
||||||
t.compile_fail("tests/ui/**/*.rs");
|
t.compile_fail("tests/ui/**/*.rs");
|
||||||
|
t.pass("tests/run-pass/**/*.rs");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#![warn(rust_2018_idioms, single_use_lifetimes)]
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
// Refs: https://doc.rust-lang.org/reference/destructors.html
|
// Refs: https://doc.rust-lang.org/reference/destructors.html
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ enum Enum<T, U> {
|
|||||||
Struct { pinned: T, unpinned: U },
|
Struct { pinned: T, unpinned: U },
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -20,6 +21,7 @@ where
|
|||||||
},
|
},
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -37,16 +39,14 @@ where
|
|||||||
},
|
},
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::mut_mut)]
|
#[allow(clippy::mut_mut)]
|
||||||
#[allow(clippy::redundant_pub_crate)]
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
#[allow(clippy::type_repetition_in_bounds)]
|
#[allow(clippy::type_repetition_in_bounds)]
|
||||||
enum EnumProjReplace<T, U> {
|
enum EnumProjReplace<T, U> {
|
||||||
Struct {
|
Struct { pinned: ::pin_project_lite::__private::PhantomData<T>, unpinned: U },
|
||||||
pinned: ::pin_project_lite::__private::PhantomData<T>,
|
|
||||||
unpinned: U,
|
|
||||||
},
|
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
@@ -54,32 +54,46 @@ enum EnumProjReplace<T, U> {
|
|||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
impl<T, U> Enum<T, U> {
|
impl<T, U> Enum<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project<'__pin>(
|
fn project<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
) -> EnumProj<'__pin, T, U> {
|
) -> EnumProj<'__pin, T, U> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match self.get_unchecked_mut() {
|
match self.get_unchecked_mut() {
|
||||||
Self::Struct { pinned, unpinned } => EnumProj::Struct {
|
Self::Struct { pinned, unpinned } => {
|
||||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
EnumProj::Struct {
|
||||||
unpinned: unpinned,
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||||
},
|
pinned,
|
||||||
|
),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
Self::Unit => EnumProj::Unit,
|
Self::Unit => EnumProj::Unit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_ref<'__pin>(
|
fn project_ref<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
) -> EnumProjRef<'__pin, T, U> {
|
) -> EnumProjRef<'__pin, T, U> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match self.get_ref() {
|
match self.get_ref() {
|
||||||
Self::Struct { pinned, unpinned } => EnumProjRef::Struct {
|
Self::Struct { pinned, unpinned } => {
|
||||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
EnumProjRef::Struct {
|
||||||
unpinned: unpinned,
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||||
},
|
pinned,
|
||||||
|
),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
Self::Unit => EnumProjRef::Unit,
|
Self::Unit => EnumProjRef::Unit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_replace(
|
fn project_replace(
|
||||||
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
||||||
replacement: Self,
|
replacement: Self,
|
||||||
@@ -98,7 +112,9 @@ const _: () = {
|
|||||||
};
|
};
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned),
|
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||||
|
pinned,
|
||||||
|
),
|
||||||
(),
|
(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -115,10 +131,10 @@ const _: () = {
|
|||||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||||
Unit: (),
|
Unit: (),
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ struct Struct<T, U> {
|
|||||||
#[allow(clippy::redundant_pub_crate)]
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -23,6 +24,7 @@ const _: () = {
|
|||||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||||
unpinned: &'__pin mut (U),
|
unpinned: &'__pin mut (U),
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -38,6 +40,8 @@ const _: () = {
|
|||||||
unpinned: &'__pin (U),
|
unpinned: &'__pin (U),
|
||||||
}
|
}
|
||||||
impl<T, U> Struct<T, U> {
|
impl<T, U> Struct<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project<'__pin>(
|
fn project<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
) -> Projection<'__pin, T, U> {
|
) -> Projection<'__pin, T, U> {
|
||||||
@@ -49,6 +53,8 @@ const _: () = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_ref<'__pin>(
|
fn project_ref<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
) -> ProjectionRef<'__pin, T, U> {
|
) -> ProjectionRef<'__pin, T, U> {
|
||||||
@@ -67,10 +73,10 @@ const _: () = {
|
|||||||
pinned: T,
|
pinned: T,
|
||||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
enum Enum<T, U> {
|
enum Enum<T, U> {
|
||||||
Struct {
|
Struct { pinned1: T, pinned2: T, unpinned1: U, unpinned2: U },
|
||||||
pinned1: T,
|
|
||||||
pinned2: T,
|
|
||||||
unpinned1: U,
|
|
||||||
unpinned2: U,
|
|
||||||
},
|
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::mut_mut)]
|
#[allow(clippy::mut_mut)]
|
||||||
@@ -27,6 +23,8 @@ enum EnumProjReplace<T, U> {
|
|||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
impl<T, U> Enum<T, U> {
|
impl<T, U> Enum<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_replace(
|
fn project_replace(
|
||||||
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
||||||
replacement: Self,
|
replacement: Self,
|
||||||
@@ -38,22 +36,25 @@ const _: () = {
|
|||||||
replacement,
|
replacement,
|
||||||
);
|
);
|
||||||
match &mut *__self_ptr {
|
match &mut *__self_ptr {
|
||||||
Self::Struct {
|
Self::Struct { pinned1, pinned2, unpinned1, unpinned2 } => {
|
||||||
pinned1,
|
|
||||||
pinned2,
|
|
||||||
unpinned1,
|
|
||||||
unpinned2,
|
|
||||||
} => {
|
|
||||||
let result = EnumProjReplace::Struct {
|
let result = EnumProjReplace::Struct {
|
||||||
pinned1: ::pin_project_lite::__private::PhantomData,
|
pinned1: ::pin_project_lite::__private::PhantomData,
|
||||||
pinned2: ::pin_project_lite::__private::PhantomData,
|
pinned2: ::pin_project_lite::__private::PhantomData,
|
||||||
unpinned1: ::pin_project_lite::__private::ptr::read(unpinned1),
|
unpinned1: ::pin_project_lite::__private::ptr::read(
|
||||||
unpinned2: ::pin_project_lite::__private::ptr::read(unpinned2),
|
unpinned1,
|
||||||
|
),
|
||||||
|
unpinned2: ::pin_project_lite::__private::ptr::read(
|
||||||
|
unpinned2,
|
||||||
|
),
|
||||||
};
|
};
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned1),
|
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned2),
|
pinned1,
|
||||||
|
),
|
||||||
|
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||||
|
pinned2,
|
||||||
|
),
|
||||||
(),
|
(),
|
||||||
(),
|
(),
|
||||||
);
|
);
|
||||||
@@ -76,10 +77,10 @@ const _: () = {
|
|||||||
),
|
),
|
||||||
Unit: (),
|
Unit: (),
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ struct Struct<T, U> {
|
|||||||
unpinned1: U,
|
unpinned1: U,
|
||||||
unpinned2: U,
|
unpinned2: U,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::mut_mut)]
|
#[allow(clippy::mut_mut)]
|
||||||
@@ -22,6 +23,7 @@ struct StructProjReplace<T, U> {
|
|||||||
#[allow(clippy::redundant_pub_crate)]
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -38,6 +40,7 @@ const _: () = {
|
|||||||
unpinned1: &'__pin mut (U),
|
unpinned1: &'__pin mut (U),
|
||||||
unpinned2: &'__pin mut (U),
|
unpinned2: &'__pin mut (U),
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -55,16 +58,14 @@ const _: () = {
|
|||||||
unpinned2: &'__pin (U),
|
unpinned2: &'__pin (U),
|
||||||
}
|
}
|
||||||
impl<T, U> Struct<T, U> {
|
impl<T, U> Struct<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project<'__pin>(
|
fn project<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
) -> Projection<'__pin, T, U> {
|
) -> Projection<'__pin, T, U> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let Self {
|
let Self { pinned1, pinned2, unpinned1, unpinned2 } = self
|
||||||
pinned1,
|
.get_unchecked_mut();
|
||||||
pinned2,
|
|
||||||
unpinned1,
|
|
||||||
unpinned2,
|
|
||||||
} = self.get_unchecked_mut();
|
|
||||||
Projection {
|
Projection {
|
||||||
pinned1: ::pin_project_lite::__private::Pin::new_unchecked(pinned1),
|
pinned1: ::pin_project_lite::__private::Pin::new_unchecked(pinned1),
|
||||||
pinned2: ::pin_project_lite::__private::Pin::new_unchecked(pinned2),
|
pinned2: ::pin_project_lite::__private::Pin::new_unchecked(pinned2),
|
||||||
@@ -73,16 +74,13 @@ const _: () = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_ref<'__pin>(
|
fn project_ref<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
) -> ProjectionRef<'__pin, T, U> {
|
) -> ProjectionRef<'__pin, T, U> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let Self {
|
let Self { pinned1, pinned2, unpinned1, unpinned2 } = self.get_ref();
|
||||||
pinned1,
|
|
||||||
pinned2,
|
|
||||||
unpinned1,
|
|
||||||
unpinned2,
|
|
||||||
} = self.get_ref();
|
|
||||||
ProjectionRef {
|
ProjectionRef {
|
||||||
pinned1: ::pin_project_lite::__private::Pin::new_unchecked(pinned1),
|
pinned1: ::pin_project_lite::__private::Pin::new_unchecked(pinned1),
|
||||||
pinned2: ::pin_project_lite::__private::Pin::new_unchecked(pinned2),
|
pinned2: ::pin_project_lite::__private::Pin::new_unchecked(pinned2),
|
||||||
@@ -91,6 +89,8 @@ const _: () = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_replace(
|
fn project_replace(
|
||||||
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
||||||
replacement: Self,
|
replacement: Self,
|
||||||
@@ -101,12 +101,7 @@ const _: () = {
|
|||||||
__self_ptr,
|
__self_ptr,
|
||||||
replacement,
|
replacement,
|
||||||
);
|
);
|
||||||
let Self {
|
let Self { pinned1, pinned2, unpinned1, unpinned2 } = &mut *__self_ptr;
|
||||||
pinned1,
|
|
||||||
pinned2,
|
|
||||||
unpinned1,
|
|
||||||
unpinned2,
|
|
||||||
} = &mut *__self_ptr;
|
|
||||||
let result = StructProjReplace {
|
let result = StructProjReplace {
|
||||||
pinned1: ::pin_project_lite::__private::PhantomData,
|
pinned1: ::pin_project_lite::__private::PhantomData,
|
||||||
pinned2: ::pin_project_lite::__private::PhantomData,
|
pinned2: ::pin_project_lite::__private::PhantomData,
|
||||||
@@ -115,8 +110,12 @@ const _: () = {
|
|||||||
};
|
};
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned1),
|
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned2),
|
pinned1,
|
||||||
|
),
|
||||||
|
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||||
|
pinned2,
|
||||||
|
),
|
||||||
(),
|
(),
|
||||||
(),
|
(),
|
||||||
);
|
);
|
||||||
@@ -133,10 +132,10 @@ const _: () = {
|
|||||||
unpinned1: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
unpinned1: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||||
unpinned2: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
unpinned2: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ enum Enum<T, U> {
|
|||||||
Struct { pinned: T, unpinned: U },
|
Struct { pinned: T, unpinned: U },
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -20,6 +21,7 @@ where
|
|||||||
},
|
},
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -37,16 +39,14 @@ where
|
|||||||
},
|
},
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::mut_mut)]
|
#[allow(clippy::mut_mut)]
|
||||||
#[allow(clippy::redundant_pub_crate)]
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
#[allow(clippy::type_repetition_in_bounds)]
|
#[allow(clippy::type_repetition_in_bounds)]
|
||||||
enum EnumProjReplace<T, U> {
|
enum EnumProjReplace<T, U> {
|
||||||
Struct {
|
Struct { pinned: ::pin_project_lite::__private::PhantomData<T>, unpinned: U },
|
||||||
pinned: ::pin_project_lite::__private::PhantomData<T>,
|
|
||||||
unpinned: U,
|
|
||||||
},
|
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
@@ -54,32 +54,46 @@ enum EnumProjReplace<T, U> {
|
|||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
impl<T, U> Enum<T, U> {
|
impl<T, U> Enum<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project<'__pin>(
|
fn project<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
) -> EnumProj<'__pin, T, U> {
|
) -> EnumProj<'__pin, T, U> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match self.get_unchecked_mut() {
|
match self.get_unchecked_mut() {
|
||||||
Self::Struct { pinned, unpinned } => EnumProj::Struct {
|
Self::Struct { pinned, unpinned } => {
|
||||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
EnumProj::Struct {
|
||||||
unpinned: unpinned,
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||||
},
|
pinned,
|
||||||
|
),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
Self::Unit => EnumProj::Unit,
|
Self::Unit => EnumProj::Unit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_ref<'__pin>(
|
fn project_ref<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
) -> EnumProjRef<'__pin, T, U> {
|
) -> EnumProjRef<'__pin, T, U> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match self.get_ref() {
|
match self.get_ref() {
|
||||||
Self::Struct { pinned, unpinned } => EnumProjRef::Struct {
|
Self::Struct { pinned, unpinned } => {
|
||||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
EnumProjRef::Struct {
|
||||||
unpinned: unpinned,
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||||
},
|
pinned,
|
||||||
|
),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
Self::Unit => EnumProjRef::Unit,
|
Self::Unit => EnumProjRef::Unit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_replace(
|
fn project_replace(
|
||||||
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
||||||
replacement: Self,
|
replacement: Self,
|
||||||
@@ -98,7 +112,9 @@ const _: () = {
|
|||||||
};
|
};
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned),
|
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||||
|
pinned,
|
||||||
|
),
|
||||||
(),
|
(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -115,10 +131,10 @@ const _: () = {
|
|||||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||||
Unit: (),
|
Unit: (),
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ enum Enum<T, U> {
|
|||||||
Struct { pinned: T, unpinned: U },
|
Struct { pinned: T, unpinned: U },
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -25,15 +26,21 @@ where
|
|||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
impl<T, U> Enum<T, U> {
|
impl<T, U> Enum<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project<'__pin>(
|
fn project<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
) -> EnumProj<'__pin, T, U> {
|
) -> EnumProj<'__pin, T, U> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match self.get_unchecked_mut() {
|
match self.get_unchecked_mut() {
|
||||||
Self::Struct { pinned, unpinned } => EnumProj::Struct {
|
Self::Struct { pinned, unpinned } => {
|
||||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
EnumProj::Struct {
|
||||||
unpinned: unpinned,
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||||
},
|
pinned,
|
||||||
|
),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
Self::Unit => EnumProj::Unit,
|
Self::Unit => EnumProj::Unit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,10 +52,10 @@ const _: () = {
|
|||||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||||
Unit: (),
|
Unit: (),
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ const _: () = {
|
|||||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||||
Unit: (),
|
Unit: (),
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ enum Enum<T, U> {
|
|||||||
Struct { pinned: T, unpinned: U },
|
Struct { pinned: T, unpinned: U },
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -25,15 +26,21 @@ where
|
|||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
impl<T, U> Enum<T, U> {
|
impl<T, U> Enum<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_ref<'__pin>(
|
fn project_ref<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
) -> EnumProjRef<'__pin, T, U> {
|
) -> EnumProjRef<'__pin, T, U> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match self.get_ref() {
|
match self.get_ref() {
|
||||||
Self::Struct { pinned, unpinned } => EnumProjRef::Struct {
|
Self::Struct { pinned, unpinned } => {
|
||||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
EnumProjRef::Struct {
|
||||||
unpinned: unpinned,
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||||
},
|
pinned,
|
||||||
|
),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
Self::Unit => EnumProjRef::Unit,
|
Self::Unit => EnumProjRef::Unit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,10 +52,10 @@ const _: () = {
|
|||||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||||
Unit: (),
|
Unit: (),
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ struct Struct<T, U> {
|
|||||||
pinned: T,
|
pinned: T,
|
||||||
unpinned: U,
|
unpinned: U,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -17,6 +18,7 @@ where
|
|||||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||||
unpinned: &'__pin mut (U),
|
unpinned: &'__pin mut (U),
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -31,6 +33,7 @@ where
|
|||||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||||
unpinned: &'__pin (U),
|
unpinned: &'__pin (U),
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::mut_mut)]
|
#[allow(clippy::mut_mut)]
|
||||||
@@ -47,6 +50,8 @@ struct StructProjReplace<T, U> {
|
|||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
impl<T, U> Struct<T, U> {
|
impl<T, U> Struct<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project<'__pin>(
|
fn project<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
) -> StructProj<'__pin, T, U> {
|
) -> StructProj<'__pin, T, U> {
|
||||||
@@ -58,6 +63,8 @@ const _: () = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_ref<'__pin>(
|
fn project_ref<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
) -> StructProjRef<'__pin, T, U> {
|
) -> StructProjRef<'__pin, T, U> {
|
||||||
@@ -69,6 +76,8 @@ const _: () = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_replace(
|
fn project_replace(
|
||||||
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
||||||
replacement: Self,
|
replacement: Self,
|
||||||
@@ -86,7 +95,9 @@ const _: () = {
|
|||||||
};
|
};
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(pinned),
|
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||||
|
pinned,
|
||||||
|
),
|
||||||
(),
|
(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -100,10 +111,10 @@ const _: () = {
|
|||||||
pinned: T,
|
pinned: T,
|
||||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ struct Struct<T, U> {
|
|||||||
pinned: T,
|
pinned: T,
|
||||||
unpinned: U,
|
unpinned: U,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -23,6 +24,7 @@ where
|
|||||||
#[allow(clippy::redundant_pub_crate)]
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -38,6 +40,8 @@ const _: () = {
|
|||||||
unpinned: &'__pin (U),
|
unpinned: &'__pin (U),
|
||||||
}
|
}
|
||||||
impl<T, U> Struct<T, U> {
|
impl<T, U> Struct<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project<'__pin>(
|
fn project<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
) -> StructProj<'__pin, T, U> {
|
) -> StructProj<'__pin, T, U> {
|
||||||
@@ -49,6 +53,8 @@ const _: () = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_ref<'__pin>(
|
fn project_ref<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
) -> ProjectionRef<'__pin, T, U> {
|
) -> ProjectionRef<'__pin, T, U> {
|
||||||
@@ -67,10 +73,10 @@ const _: () = {
|
|||||||
pinned: T,
|
pinned: T,
|
||||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ struct Struct<T, U> {
|
|||||||
#[allow(clippy::redundant_pub_crate)]
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -23,6 +24,7 @@ const _: () = {
|
|||||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||||
unpinned: &'__pin mut (U),
|
unpinned: &'__pin mut (U),
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -38,6 +40,8 @@ const _: () = {
|
|||||||
unpinned: &'__pin (U),
|
unpinned: &'__pin (U),
|
||||||
}
|
}
|
||||||
impl<T, U> Struct<T, U> {
|
impl<T, U> Struct<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project<'__pin>(
|
fn project<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
) -> Projection<'__pin, T, U> {
|
) -> Projection<'__pin, T, U> {
|
||||||
@@ -49,6 +53,8 @@ const _: () = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_ref<'__pin>(
|
fn project_ref<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
) -> ProjectionRef<'__pin, T, U> {
|
) -> ProjectionRef<'__pin, T, U> {
|
||||||
@@ -67,10 +73,10 @@ const _: () = {
|
|||||||
pinned: T,
|
pinned: T,
|
||||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ struct Struct<T, U> {
|
|||||||
pinned: T,
|
pinned: T,
|
||||||
unpinned: U,
|
unpinned: U,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -23,6 +24,7 @@ where
|
|||||||
#[allow(clippy::redundant_pub_crate)]
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -38,6 +40,8 @@ const _: () = {
|
|||||||
unpinned: &'__pin mut (U),
|
unpinned: &'__pin mut (U),
|
||||||
}
|
}
|
||||||
impl<T, U> Struct<T, U> {
|
impl<T, U> Struct<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project<'__pin>(
|
fn project<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
) -> Projection<'__pin, T, U> {
|
) -> Projection<'__pin, T, U> {
|
||||||
@@ -49,6 +53,8 @@ const _: () = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_ref<'__pin>(
|
fn project_ref<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
) -> StructProjRef<'__pin, T, U> {
|
) -> StructProjRef<'__pin, T, U> {
|
||||||
@@ -67,10 +73,10 @@ const _: () = {
|
|||||||
pinned: T,
|
pinned: T,
|
||||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
99
third_party/rust/pin-project-lite/tests/expand/not_unpin/enum.expanded.rs
vendored
Normal file
99
third_party/rust/pin-project-lite/tests/expand/not_unpin/enum.expanded.rs
vendored
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
use pin_project_lite::pin_project;
|
||||||
|
enum Enum<T, U> {
|
||||||
|
Struct { pinned: T, unpinned: U },
|
||||||
|
Unit,
|
||||||
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
#[allow(single_use_lifetimes)]
|
||||||
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
|
#[allow(clippy::mut_mut)]
|
||||||
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
|
#[allow(clippy::ref_option_ref)]
|
||||||
|
#[allow(clippy::type_repetition_in_bounds)]
|
||||||
|
enum EnumProj<'__pin, T, U>
|
||||||
|
where
|
||||||
|
Enum<T, U>: '__pin,
|
||||||
|
{
|
||||||
|
Struct {
|
||||||
|
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||||
|
unpinned: &'__pin mut (U),
|
||||||
|
},
|
||||||
|
Unit,
|
||||||
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
#[allow(single_use_lifetimes)]
|
||||||
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
|
#[allow(clippy::mut_mut)]
|
||||||
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
|
#[allow(clippy::ref_option_ref)]
|
||||||
|
#[allow(clippy::type_repetition_in_bounds)]
|
||||||
|
enum EnumProjRef<'__pin, T, U>
|
||||||
|
where
|
||||||
|
Enum<T, U>: '__pin,
|
||||||
|
{
|
||||||
|
Struct {
|
||||||
|
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||||
|
unpinned: &'__pin (U),
|
||||||
|
},
|
||||||
|
Unit,
|
||||||
|
}
|
||||||
|
#[allow(single_use_lifetimes)]
|
||||||
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
|
#[allow(clippy::used_underscore_binding)]
|
||||||
|
const _: () = {
|
||||||
|
impl<T, U> Enum<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
|
fn project<'__pin>(
|
||||||
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
|
) -> EnumProj<'__pin, T, U> {
|
||||||
|
unsafe {
|
||||||
|
match self.get_unchecked_mut() {
|
||||||
|
Self::Struct { pinned, unpinned } => {
|
||||||
|
EnumProj::Struct {
|
||||||
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||||
|
pinned,
|
||||||
|
),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Self::Unit => EnumProj::Unit,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
|
fn project_ref<'__pin>(
|
||||||
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
|
) -> EnumProjRef<'__pin, T, U> {
|
||||||
|
unsafe {
|
||||||
|
match self.get_ref() {
|
||||||
|
Self::Struct { pinned, unpinned } => {
|
||||||
|
EnumProjRef::Struct {
|
||||||
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||||
|
pinned,
|
||||||
|
),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Self::Unit => EnumProjRef::Unit,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||||
|
where
|
||||||
|
(
|
||||||
|
::core::marker::PhantomData<&'__pin ()>,
|
||||||
|
::core::marker::PhantomPinned,
|
||||||
|
): ::pin_project_lite::__private::Unpin,
|
||||||
|
{}
|
||||||
|
trait MustNotImplDrop {}
|
||||||
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
impl<T, U> MustNotImplDrop for Enum<T, U> {}
|
||||||
|
};
|
||||||
|
fn main() {}
|
||||||
19
third_party/rust/pin-project-lite/tests/expand/not_unpin/enum.rs
vendored
Normal file
19
third_party/rust/pin-project-lite/tests/expand/not_unpin/enum.rs
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
|
pin_project! {
|
||||||
|
#[project(!Unpin)]
|
||||||
|
#[project = EnumProj]
|
||||||
|
#[project_ref = EnumProjRef]
|
||||||
|
enum Enum<T, U> {
|
||||||
|
Struct {
|
||||||
|
#[pin]
|
||||||
|
pinned: T,
|
||||||
|
unpinned: U,
|
||||||
|
},
|
||||||
|
Unit,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
88
third_party/rust/pin-project-lite/tests/expand/not_unpin/struct.expanded.rs
vendored
Normal file
88
third_party/rust/pin-project-lite/tests/expand/not_unpin/struct.expanded.rs
vendored
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
use pin_project_lite::pin_project;
|
||||||
|
struct Struct<T, U> {
|
||||||
|
pinned: T,
|
||||||
|
unpinned: U,
|
||||||
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
#[allow(single_use_lifetimes)]
|
||||||
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
|
#[allow(clippy::mut_mut)]
|
||||||
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
|
#[allow(clippy::ref_option_ref)]
|
||||||
|
#[allow(clippy::type_repetition_in_bounds)]
|
||||||
|
struct StructProj<'__pin, T, U>
|
||||||
|
where
|
||||||
|
Struct<T, U>: '__pin,
|
||||||
|
{
|
||||||
|
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||||
|
unpinned: &'__pin mut (U),
|
||||||
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
#[allow(single_use_lifetimes)]
|
||||||
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
|
#[allow(clippy::mut_mut)]
|
||||||
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
|
#[allow(clippy::ref_option_ref)]
|
||||||
|
#[allow(clippy::type_repetition_in_bounds)]
|
||||||
|
struct StructProjRef<'__pin, T, U>
|
||||||
|
where
|
||||||
|
Struct<T, U>: '__pin,
|
||||||
|
{
|
||||||
|
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||||
|
unpinned: &'__pin (U),
|
||||||
|
}
|
||||||
|
#[allow(explicit_outlives_requirements)]
|
||||||
|
#[allow(single_use_lifetimes)]
|
||||||
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
|
#[allow(clippy::used_underscore_binding)]
|
||||||
|
const _: () = {
|
||||||
|
impl<T, U> Struct<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
|
fn project<'__pin>(
|
||||||
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
|
) -> StructProj<'__pin, T, U> {
|
||||||
|
unsafe {
|
||||||
|
let Self { pinned, unpinned } = self.get_unchecked_mut();
|
||||||
|
StructProj {
|
||||||
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
|
fn project_ref<'__pin>(
|
||||||
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
|
) -> StructProjRef<'__pin, T, U> {
|
||||||
|
unsafe {
|
||||||
|
let Self { pinned, unpinned } = self.get_ref();
|
||||||
|
StructProjRef {
|
||||||
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||||
|
where
|
||||||
|
(
|
||||||
|
::core::marker::PhantomData<&'__pin ()>,
|
||||||
|
::core::marker::PhantomPinned,
|
||||||
|
): ::pin_project_lite::__private::Unpin,
|
||||||
|
{}
|
||||||
|
trait MustNotImplDrop {}
|
||||||
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
impl<T, U> MustNotImplDrop for Struct<T, U> {}
|
||||||
|
#[forbid(unaligned_references, safe_packed_borrows)]
|
||||||
|
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
|
||||||
|
let _ = &this.pinned;
|
||||||
|
let _ = &this.unpinned;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
fn main() {}
|
||||||
16
third_party/rust/pin-project-lite/tests/expand/not_unpin/struct.rs
vendored
Normal file
16
third_party/rust/pin-project-lite/tests/expand/not_unpin/struct.rs
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
|
pin_project! {
|
||||||
|
#[project = StructProj]
|
||||||
|
#[project(!Unpin)]
|
||||||
|
#[project_ref = StructProjRef]
|
||||||
|
struct Struct<T, U> {
|
||||||
|
#[pin]
|
||||||
|
pinned: T,
|
||||||
|
unpinned: U,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
use std::pin::Pin;
|
|
||||||
enum Enum<T, U> {
|
enum Enum<T, U> {
|
||||||
Struct { pinned: T, unpinned: U },
|
Struct { pinned: T, unpinned: U },
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -21,6 +21,7 @@ where
|
|||||||
},
|
},
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -43,28 +44,40 @@ where
|
|||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
impl<T, U> Enum<T, U> {
|
impl<T, U> Enum<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project<'__pin>(
|
fn project<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
) -> EnumProj<'__pin, T, U> {
|
) -> EnumProj<'__pin, T, U> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match self.get_unchecked_mut() {
|
match self.get_unchecked_mut() {
|
||||||
Self::Struct { pinned, unpinned } => EnumProj::Struct {
|
Self::Struct { pinned, unpinned } => {
|
||||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
EnumProj::Struct {
|
||||||
unpinned: unpinned,
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||||
},
|
pinned,
|
||||||
|
),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
Self::Unit => EnumProj::Unit,
|
Self::Unit => EnumProj::Unit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_ref<'__pin>(
|
fn project_ref<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
) -> EnumProjRef<'__pin, T, U> {
|
) -> EnumProjRef<'__pin, T, U> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match self.get_ref() {
|
match self.get_ref() {
|
||||||
Self::Struct { pinned, unpinned } => EnumProjRef::Struct {
|
Self::Struct { pinned, unpinned } => {
|
||||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
EnumProjRef::Struct {
|
||||||
unpinned: unpinned,
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||||
},
|
pinned,
|
||||||
|
),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
Self::Unit => EnumProjRef::Unit,
|
Self::Unit => EnumProjRef::Unit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,18 +89,21 @@ const _: () = {
|
|||||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||||
Unit: (),
|
Unit: (),
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
impl<T, U> ::pin_project_lite::__private::Drop for Enum<T, U> {
|
impl<T, U> ::pin_project_lite::__private::Drop for Enum<T, U> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
fn __drop_inner<T, U>(this: ::pin_project_lite::__private::Pin<&mut Enum<T, U>>) {
|
fn __drop_inner<T, U>(
|
||||||
|
this: ::pin_project_lite::__private::Pin<&mut Enum<T, U>>,
|
||||||
|
) {
|
||||||
fn __drop_inner() {}
|
fn __drop_inner() {}
|
||||||
let _ = this;
|
let _ = this;
|
||||||
}
|
}
|
||||||
let pinned_self: ::pin_project_lite::__private::Pin<&mut Self> =
|
let pinned_self: ::pin_project_lite::__private::Pin<&mut Self> = unsafe {
|
||||||
unsafe { ::pin_project_lite::__private::Pin::new_unchecked(self) };
|
::pin_project_lite::__private::Pin::new_unchecked(self)
|
||||||
|
};
|
||||||
__drop_inner(pinned_self);
|
__drop_inner(pinned_self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
use std::pin::Pin;
|
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
#[project = EnumProj]
|
#[project = EnumProj]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
use std::pin::Pin;
|
|
||||||
struct Struct<T, U> {
|
struct Struct<T, U> {
|
||||||
pinned: T,
|
pinned: T,
|
||||||
unpinned: U,
|
unpinned: U,
|
||||||
@@ -10,6 +9,7 @@ struct Struct<T, U> {
|
|||||||
#[allow(clippy::redundant_pub_crate)]
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -24,6 +24,7 @@ const _: () = {
|
|||||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||||
unpinned: &'__pin mut (U),
|
unpinned: &'__pin mut (U),
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -39,6 +40,8 @@ const _: () = {
|
|||||||
unpinned: &'__pin (U),
|
unpinned: &'__pin (U),
|
||||||
}
|
}
|
||||||
impl<T, U> Struct<T, U> {
|
impl<T, U> Struct<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project<'__pin>(
|
fn project<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
) -> Projection<'__pin, T, U> {
|
) -> Projection<'__pin, T, U> {
|
||||||
@@ -50,6 +53,8 @@ const _: () = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
fn project_ref<'__pin>(
|
fn project_ref<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
) -> ProjectionRef<'__pin, T, U> {
|
) -> ProjectionRef<'__pin, T, U> {
|
||||||
@@ -68,18 +73,21 @@ const _: () = {
|
|||||||
pinned: T,
|
pinned: T,
|
||||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
impl<T, U> ::pin_project_lite::__private::Drop for Struct<T, U> {
|
impl<T, U> ::pin_project_lite::__private::Drop for Struct<T, U> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
fn __drop_inner<T, U>(this: ::pin_project_lite::__private::Pin<&mut Struct<T, U>>) {
|
fn __drop_inner<T, U>(
|
||||||
|
this: ::pin_project_lite::__private::Pin<&mut Struct<T, U>>,
|
||||||
|
) {
|
||||||
fn __drop_inner() {}
|
fn __drop_inner() {}
|
||||||
let _ = this;
|
let _ = this;
|
||||||
}
|
}
|
||||||
let pinned_self: ::pin_project_lite::__private::Pin<&mut Self> =
|
let pinned_self: ::pin_project_lite::__private::Pin<&mut Self> = unsafe {
|
||||||
unsafe { ::pin_project_lite::__private::Pin::new_unchecked(self) };
|
::pin_project_lite::__private::Pin::new_unchecked(self)
|
||||||
|
};
|
||||||
__drop_inner(pinned_self);
|
__drop_inner(pinned_self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
use std::pin::Pin;
|
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
struct Struct<T, U> {
|
struct Struct<T, U> {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ pub enum Enum<T, U> {
|
|||||||
Struct { pinned: T, unpinned: U },
|
Struct { pinned: T, unpinned: U },
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -20,6 +21,7 @@ where
|
|||||||
},
|
},
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -42,28 +44,40 @@ where
|
|||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
impl<T, U> Enum<T, U> {
|
impl<T, U> Enum<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
pub(crate) fn project<'__pin>(
|
pub(crate) fn project<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
) -> EnumProj<'__pin, T, U> {
|
) -> EnumProj<'__pin, T, U> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match self.get_unchecked_mut() {
|
match self.get_unchecked_mut() {
|
||||||
Self::Struct { pinned, unpinned } => EnumProj::Struct {
|
Self::Struct { pinned, unpinned } => {
|
||||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
EnumProj::Struct {
|
||||||
unpinned: unpinned,
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||||
},
|
pinned,
|
||||||
|
),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
Self::Unit => EnumProj::Unit,
|
Self::Unit => EnumProj::Unit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
pub(crate) fn project_ref<'__pin>(
|
pub(crate) fn project_ref<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
) -> EnumProjRef<'__pin, T, U> {
|
) -> EnumProjRef<'__pin, T, U> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match self.get_ref() {
|
match self.get_ref() {
|
||||||
Self::Struct { pinned, unpinned } => EnumProjRef::Struct {
|
Self::Struct { pinned, unpinned } => {
|
||||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
EnumProjRef::Struct {
|
||||||
unpinned: unpinned,
|
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||||
},
|
pinned,
|
||||||
|
),
|
||||||
|
unpinned: unpinned,
|
||||||
|
}
|
||||||
|
}
|
||||||
Self::Unit => EnumProjRef::Unit,
|
Self::Unit => EnumProjRef::Unit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,10 +89,10 @@ const _: () = {
|
|||||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||||
Unit: (),
|
Unit: (),
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ pub struct Struct<T, U> {
|
|||||||
#[allow(clippy::redundant_pub_crate)]
|
#[allow(clippy::redundant_pub_crate)]
|
||||||
#[allow(clippy::used_underscore_binding)]
|
#[allow(clippy::used_underscore_binding)]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -23,6 +24,7 @@ const _: () = {
|
|||||||
pub pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
pub pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||||
pub unpinned: &'__pin mut (U),
|
pub unpinned: &'__pin mut (U),
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(single_use_lifetimes)]
|
#[allow(single_use_lifetimes)]
|
||||||
#[allow(clippy::unknown_clippy_lints)]
|
#[allow(clippy::unknown_clippy_lints)]
|
||||||
@@ -38,6 +40,8 @@ const _: () = {
|
|||||||
pub unpinned: &'__pin (U),
|
pub unpinned: &'__pin (U),
|
||||||
}
|
}
|
||||||
impl<T, U> Struct<T, U> {
|
impl<T, U> Struct<T, U> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
pub(crate) fn project<'__pin>(
|
pub(crate) fn project<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||||
) -> Projection<'__pin, T, U> {
|
) -> Projection<'__pin, T, U> {
|
||||||
@@ -49,6 +53,8 @@ const _: () = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[inline]
|
||||||
pub(crate) fn project_ref<'__pin>(
|
pub(crate) fn project_ref<'__pin>(
|
||||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||||
) -> ProjectionRef<'__pin, T, U> {
|
) -> ProjectionRef<'__pin, T, U> {
|
||||||
@@ -67,10 +73,10 @@ const _: () = {
|
|||||||
pinned: T,
|
pinned: T,
|
||||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||||
}
|
}
|
||||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U> where
|
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin
|
where
|
||||||
{
|
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||||
}
|
{}
|
||||||
trait MustNotImplDrop {}
|
trait MustNotImplDrop {}
|
||||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -1,43 +1,11 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
#![cfg(not(miri))]
|
#![cfg(not(miri))]
|
||||||
#![warn(rust_2018_idioms, single_use_lifetimes)]
|
#![cfg(not(careful))]
|
||||||
|
|
||||||
use std::{
|
|
||||||
env,
|
|
||||||
process::{Command, ExitStatus, Stdio},
|
|
||||||
};
|
|
||||||
|
|
||||||
const PATH: &str = "tests/expand/**/*.rs";
|
|
||||||
|
|
||||||
#[rustversion::attr(not(nightly), ignore)]
|
#[rustversion::attr(not(nightly), ignore)]
|
||||||
#[test]
|
#[test]
|
||||||
fn expandtest() {
|
fn expandtest() {
|
||||||
let is_ci = env::var_os("CI").is_some();
|
|
||||||
let cargo = &*env::var("CARGO").unwrap_or_else(|_| "cargo".into());
|
|
||||||
if !has_command(&[cargo, "expand"]) || !has_command(&[cargo, "fmt"]) {
|
|
||||||
if is_ci {
|
|
||||||
panic!("expandtest requires rustfmt and cargo-expand");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let args = &["--all-features"];
|
let args = &["--all-features"];
|
||||||
if is_ci {
|
macrotest::expand_args("tests/expand/**/*.rs", args);
|
||||||
macrotest::expand_without_refresh_args(PATH, args);
|
|
||||||
} else {
|
|
||||||
env::set_var("MACROTEST", "overwrite");
|
|
||||||
macrotest::expand_args(PATH, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn has_command(command: &[&str]) -> bool {
|
|
||||||
Command::new(command[0])
|
|
||||||
.args(&command[1..])
|
|
||||||
.arg("--version")
|
|
||||||
.stdin(Stdio::null())
|
|
||||||
.stdout(Stdio::null())
|
|
||||||
.stderr(Stdio::null())
|
|
||||||
.status()
|
|
||||||
.as_ref()
|
|
||||||
.map(ExitStatus::success)
|
|
||||||
.unwrap_or(false)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
// default pin_project! is completely safe.
|
// default pin_project! is completely safe.
|
||||||
|
|
||||||
::pin_project_lite::pin_project! {
|
::pin_project_lite::pin_project! {
|
||||||
|
/// Testing default struct.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct DefaultStruct<T, U> {
|
pub struct DefaultStruct<T, U> {
|
||||||
#[pin]
|
#[pin]
|
||||||
@@ -10,6 +13,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
::pin_project_lite::pin_project! {
|
::pin_project_lite::pin_project! {
|
||||||
|
/// Testing named struct.
|
||||||
#[project = DefaultStructProj]
|
#[project = DefaultStructProj]
|
||||||
#[project_ref = DefaultStructProjRef]
|
#[project_ref = DefaultStructProjRef]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -21,15 +25,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
::pin_project_lite::pin_project! {
|
::pin_project_lite::pin_project! {
|
||||||
|
/// Testing enum.
|
||||||
#[project = DefaultEnumProj]
|
#[project = DefaultEnumProj]
|
||||||
#[project_ref = DefaultEnumProjRef]
|
#[project_ref = DefaultEnumProjRef]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum DefaultEnum<T, U> {
|
pub enum DefaultEnum<T, U> {
|
||||||
|
/// Struct variant.
|
||||||
Struct {
|
Struct {
|
||||||
#[pin]
|
#[pin]
|
||||||
pinned: T,
|
pinned: T,
|
||||||
unpinned: U,
|
unpinned: U,
|
||||||
},
|
},
|
||||||
|
/// Unit variant.
|
||||||
Unit,
|
Unit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
263
third_party/rust/pin-project-lite/tests/lint.rs
vendored
263
third_party/rust/pin-project-lite/tests/lint.rs
vendored
@@ -1,263 +0,0 @@
|
|||||||
// 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, 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_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, 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,
|
|
||||||
missing_copy_implementations,
|
|
||||||
missing_debug_implementations,
|
|
||||||
missing_docs,
|
|
||||||
non_ascii_idents,
|
|
||||||
noop_method_call,
|
|
||||||
single_use_lifetimes,
|
|
||||||
trivial_casts,
|
|
||||||
trivial_numeric_casts,
|
|
||||||
unreachable_pub,
|
|
||||||
unused_import_braces,
|
|
||||||
unused_lifetimes,
|
|
||||||
unused_qualifications,
|
|
||||||
unused_results,
|
|
||||||
variant_size_differences
|
|
||||||
)]
|
|
||||||
#![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, clippy::single_char_lifetime_names)] // TODO
|
|
||||||
|
|
||||||
pub mod basic {
|
|
||||||
include!("include/basic.rs");
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod box_pointers {
|
|
||||||
use pin_project_lite::pin_project;
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct Struct {
|
|
||||||
#[pin]
|
|
||||||
pub p: Box<isize>,
|
|
||||||
pub u: Box<isize>,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[project = EnumProj]
|
|
||||||
#[project_ref = EnumProjRef]
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum Enum {
|
|
||||||
Struct {
|
|
||||||
#[pin]
|
|
||||||
p: Box<isize>,
|
|
||||||
u: Box<isize>,
|
|
||||||
},
|
|
||||||
Unit,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod explicit_outlives_requirements {
|
|
||||||
use pin_project_lite::pin_project;
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct Struct<'a, T, U>
|
|
||||||
where
|
|
||||||
T: ?Sized,
|
|
||||||
U: ?Sized,
|
|
||||||
{
|
|
||||||
#[pin]
|
|
||||||
pub pinned: &'a mut T,
|
|
||||||
pub unpinned: &'a mut U,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[project = EnumProj]
|
|
||||||
#[project_ref = EnumProjRef]
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum Enum<'a, T, U>
|
|
||||||
where
|
|
||||||
T: ?Sized,
|
|
||||||
U: ?Sized,
|
|
||||||
{
|
|
||||||
Struct {
|
|
||||||
#[pin]
|
|
||||||
pinned: &'a mut T,
|
|
||||||
unpinned: &'a mut U,
|
|
||||||
},
|
|
||||||
Unit,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod variant_size_differences {
|
|
||||||
use pin_project_lite::pin_project;
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[project = EnumProj]
|
|
||||||
#[project_ref = EnumProjRef]
|
|
||||||
#[allow(missing_debug_implementations, missing_copy_implementations)] // https://github.com/rust-lang/rust/pull/74060
|
|
||||||
#[allow(variant_size_differences)] // for the type itself
|
|
||||||
#[allow(clippy::large_enum_variant)] // for the type itself
|
|
||||||
pub enum Enum {
|
|
||||||
V1 { f: u8 },
|
|
||||||
V2 { f: [u8; 1024] },
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod clippy_mut_mut {
|
|
||||||
use pin_project_lite::pin_project;
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct Struct<'a, T, U> {
|
|
||||||
#[pin]
|
|
||||||
pub pinned: &'a mut T,
|
|
||||||
pub unpinned: &'a mut U,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[project = EnumProj]
|
|
||||||
#[project_ref = EnumProjRef]
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum Enum<'a, T, U> {
|
|
||||||
Struct {
|
|
||||||
#[pin]
|
|
||||||
pinned: &'a mut T,
|
|
||||||
unpinned: &'a mut U,
|
|
||||||
},
|
|
||||||
Unit,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(unreachable_pub)]
|
|
||||||
mod clippy_redundant_pub_crate {
|
|
||||||
use pin_project_lite::pin_project;
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct Struct<T, U> {
|
|
||||||
#[pin]
|
|
||||||
pub pinned: T,
|
|
||||||
pub unpinned: U,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[project = EnumProj]
|
|
||||||
#[project_ref = EnumProjRef]
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum Enum<T, U> {
|
|
||||||
Struct {
|
|
||||||
#[pin]
|
|
||||||
pinned: T,
|
|
||||||
unpinned: U,
|
|
||||||
},
|
|
||||||
Unit,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(clippy::use_self)]
|
|
||||||
pub mod clippy_type_repetition_in_bounds {
|
|
||||||
use pin_project_lite::pin_project;
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct Struct<T, U>
|
|
||||||
where
|
|
||||||
Struct<T, U>: Sized,
|
|
||||||
{
|
|
||||||
#[pin]
|
|
||||||
pub pinned: T,
|
|
||||||
pub unpinned: U,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[project = EnumProj]
|
|
||||||
#[project_ref = EnumProjRef]
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum Enum<T, U>
|
|
||||||
where
|
|
||||||
Enum<T, U>: Sized,
|
|
||||||
{
|
|
||||||
Struct {
|
|
||||||
#[pin]
|
|
||||||
pinned: T,
|
|
||||||
unpinned: U,
|
|
||||||
},
|
|
||||||
Unit,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod clippy_used_underscore_binding {
|
|
||||||
use pin_project_lite::pin_project;
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct Struct<T, U> {
|
|
||||||
#[pin]
|
|
||||||
pub _pinned: T,
|
|
||||||
pub _unpinned: U,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[project = EnumProj]
|
|
||||||
#[project_ref = EnumProjRef]
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum Enum<T, U> {
|
|
||||||
Struct {
|
|
||||||
#[pin]
|
|
||||||
_pinned: T,
|
|
||||||
_unpinned: U,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod clippy_ref_option_ref {
|
|
||||||
use pin_project_lite::pin_project;
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
pub struct Struct<'a> {
|
|
||||||
#[pin]
|
|
||||||
pub _pinned: Option<&'a ()>,
|
|
||||||
pub _unpinned: Option<&'a ()>,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pin_project! {
|
|
||||||
#[project = EnumProj]
|
|
||||||
#[project_ref = EnumProjRef]
|
|
||||||
pub enum Enum<'a> {
|
|
||||||
Struct {
|
|
||||||
#[pin]
|
|
||||||
_pinned: Option<&'a ()>,
|
|
||||||
_unpinned: Option<&'a ()>,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#![warn(rust_2018_idioms, single_use_lifetimes)]
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
@@ -46,6 +47,18 @@ pub mod default {
|
|||||||
assert_not_unpin!(Enum<PhantomPinned, ()>);
|
assert_not_unpin!(Enum<PhantomPinned, ()>);
|
||||||
assert_not_unpin!(Enum<PhantomPinned, PhantomPinned>);
|
assert_not_unpin!(Enum<PhantomPinned, PhantomPinned>);
|
||||||
|
|
||||||
|
pin_project! {
|
||||||
|
#[project(!Unpin)]
|
||||||
|
enum NotUnpinEnum<T, U> {
|
||||||
|
V1 {
|
||||||
|
#[pin] f1: Inner<T>,
|
||||||
|
f2: U,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_not_unpin!(NotUnpinEnum<(), ()>);
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
struct TrivialBounds {
|
struct TrivialBounds {
|
||||||
#[pin]
|
#[pin]
|
||||||
@@ -64,4 +77,25 @@ pub mod default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert_unpin!(PinRef<'_, PhantomPinned, PhantomPinned>);
|
assert_unpin!(PinRef<'_, PhantomPinned, PhantomPinned>);
|
||||||
|
|
||||||
|
pin_project! {
|
||||||
|
#[project(!Unpin)]
|
||||||
|
struct NotUnpin<U> {
|
||||||
|
#[pin]
|
||||||
|
u: U
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_not_unpin!(NotUnpin<()>);
|
||||||
|
|
||||||
|
pin_project! {
|
||||||
|
#[project(!Unpin)]
|
||||||
|
struct NotUnpinRef<'a, T, U> {
|
||||||
|
#[pin]
|
||||||
|
f1: &'a mut Inner<T>,
|
||||||
|
f2: U
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_not_unpin!(NotUnpinRef<'_, (), ()>);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms, single_use_lifetimes)]
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
#![allow(dead_code)]
|
|
||||||
|
#![allow(dead_code, unreachable_pub, clippy::no_effect_underscore_binding)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod auxiliary;
|
mod auxiliary;
|
||||||
@@ -616,6 +617,7 @@ fn attrs() {
|
|||||||
pin_project! {
|
pin_project! {
|
||||||
/// dox1
|
/// dox1
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
#[project(!Unpin)]
|
||||||
#[project = Enum2Proj]
|
#[project = Enum2Proj]
|
||||||
#[project_ref = Enum2ProjRef]
|
#[project_ref = Enum2ProjRef]
|
||||||
/// dox2
|
/// dox2
|
||||||
@@ -682,11 +684,13 @@ fn pinned_drop() {
|
|||||||
req: Request,
|
req: Request,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// dox1
|
||||||
impl<T, Request> PinnedDrop for Struct3<'_, T, Request>
|
impl<T, Request> PinnedDrop for Struct3<'_, T, Request>
|
||||||
where
|
where
|
||||||
T: Service<Request>,
|
T: Service<Request>,
|
||||||
T::Error: std::error::Error,
|
T::Error: std::error::Error,
|
||||||
{
|
{
|
||||||
|
/// dox2
|
||||||
fn drop(mut this: Pin<&mut Self>) {
|
fn drop(mut this: Pin<&mut Self>) {
|
||||||
**this.as_mut().project().was_dropped = true;
|
**this.as_mut().project().was_dropped = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! { //~ ERROR E0119
|
pin_project! { //~ ERROR E0119
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
error[E0119]: conflicting implementations of trait `_::MustNotImplDrop` for type `Foo<_, _>`
|
error[E0119]: conflicting implementations of trait `MustNotImplDrop` for type `Foo<_, _>`
|
||||||
--> tests/ui/pin_project/conflict-drop.rs:3:1
|
--> tests/ui/pin_project/conflict-drop.rs:5:1
|
||||||
|
|
|
|
||||||
3 | / pin_project! { //~ ERROR E0119
|
5 | / pin_project! { //~ ERROR E0119
|
||||||
4 | | struct Foo<T, U> {
|
6 | | struct Foo<T, U> {
|
||||||
5 | | #[pin]
|
7 | | #[pin]
|
||||||
6 | | future: T,
|
8 | | future: T,
|
||||||
7 | | field: U,
|
9 | | field: U,
|
||||||
8 | | }
|
10 | | }
|
||||||
9 | | }
|
11 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_first implementation here
|
| |_first implementation here
|
||||||
| conflicting implementation for `Foo<_, _>`
|
| conflicting implementation for `Foo<_, _>`
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::__pin_project_make_drop_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::__pin_project_make_drop_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
// The same implementation.
|
// The same implementation.
|
||||||
@@ -37,4 +39,28 @@ pin_project! { //~ ERROR E0119
|
|||||||
// conflicting implementations
|
// conflicting implementations
|
||||||
impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} // Conditional Unpin impl
|
impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} // Conditional Unpin impl
|
||||||
|
|
||||||
|
pin_project! { //~ ERROR E0119
|
||||||
|
#[project(!Unpin)]
|
||||||
|
struct Qux<T, U> {
|
||||||
|
#[pin]
|
||||||
|
future: T,
|
||||||
|
field: U,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// conflicting implementations
|
||||||
|
impl<T, U> Unpin for Qux<T, U> {} // Non-conditional Unpin impl
|
||||||
|
|
||||||
|
pin_project! { //~ ERROR E0119
|
||||||
|
#[project(!Unpin)]
|
||||||
|
struct Fred<T, U> {
|
||||||
|
#[pin]
|
||||||
|
future: T,
|
||||||
|
field: U,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// conflicting implementations
|
||||||
|
impl<T: Unpin, U: Unpin> Unpin for Fred<T, U> {} // Conditional Unpin impl
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|||||||
@@ -1,50 +1,84 @@
|
|||||||
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`
|
error[E0119]: conflicting implementations of trait `Unpin` for type `Foo<_, _>`
|
||||||
--> tests/ui/pin_project/conflict-unpin.rs:5:1
|
--> tests/ui/pin_project/conflict-unpin.rs:7:1
|
||||||
|
|
|
|
||||||
5 | / pin_project! { //~ ERROR E0119
|
7 | / pin_project! { //~ ERROR E0119
|
||||||
6 | | struct Foo<T, U> {
|
8 | | struct Foo<T, U> {
|
||||||
7 | | #[pin]
|
9 | | #[pin]
|
||||||
8 | | future: T,
|
10 | | future: T,
|
||||||
9 | | field: U,
|
11 | | field: U,
|
||||||
10 | | }
|
12 | | }
|
||||||
11 | | }
|
13 | | }
|
||||||
| |_^ conflicting implementation for `Foo<_, _>`
|
| |_^ conflicting implementation for `Foo<_, _>`
|
||||||
...
|
...
|
||||||
14 | impl<T, U> Unpin for Foo<T, U> where T: Unpin {} // Conditional Unpin impl
|
16 | impl<T, U> Unpin for Foo<T, U> where T: Unpin {} // Conditional Unpin impl
|
||||||
| --------------------------------------------- first implementation here
|
| --------------------------------------------- first implementation here
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`
|
error[E0119]: conflicting implementations of trait `Unpin` for type `Bar<_, _>`
|
||||||
--> tests/ui/pin_project/conflict-unpin.rs:18:1
|
--> tests/ui/pin_project/conflict-unpin.rs:20:1
|
||||||
|
|
|
|
||||||
18 | / pin_project! { //~ ERROR E0119
|
20 | / pin_project! { //~ ERROR E0119
|
||||||
19 | | struct Bar<T, U> {
|
21 | | struct Bar<T, U> {
|
||||||
20 | | #[pin]
|
22 | | #[pin]
|
||||||
21 | | future: T,
|
23 | | future: T,
|
||||||
22 | | field: U,
|
24 | | field: U,
|
||||||
23 | | }
|
25 | | }
|
||||||
24 | | }
|
26 | | }
|
||||||
| |_^ conflicting implementation for `Bar<_, _>`
|
| |_^ conflicting implementation for `Bar<_, _>`
|
||||||
...
|
...
|
||||||
27 | impl<T, U> Unpin for Bar<T, U> {} // Non-conditional Unpin impl
|
29 | impl<T, U> Unpin for Bar<T, U> {} // Non-conditional Unpin impl
|
||||||
| ------------------------------ first implementation here
|
| ------------------------------ first implementation here
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`
|
error[E0119]: conflicting implementations of trait `Unpin` for type `Baz<_, _>`
|
||||||
--> tests/ui/pin_project/conflict-unpin.rs:29:1
|
--> tests/ui/pin_project/conflict-unpin.rs:31:1
|
||||||
|
|
|
|
||||||
29 | / pin_project! { //~ ERROR E0119
|
31 | / pin_project! { //~ ERROR E0119
|
||||||
30 | | struct Baz<T, U> {
|
32 | | struct Baz<T, U> {
|
||||||
31 | | #[pin]
|
33 | | #[pin]
|
||||||
32 | | future: T,
|
34 | | future: T,
|
||||||
33 | | field: U,
|
35 | | field: U,
|
||||||
34 | | }
|
36 | | }
|
||||||
35 | | }
|
37 | | }
|
||||||
| |_^ conflicting implementation for `Baz<_, _>`
|
| |_^ conflicting implementation for `Baz<_, _>`
|
||||||
...
|
...
|
||||||
38 | impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} // Conditional Unpin impl
|
40 | impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} // Conditional Unpin impl
|
||||||
| -------------------------------------------- first implementation here
|
| -------------------------------------------- first implementation here
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error[E0119]: conflicting implementations of trait `Unpin` for type `Qux<_, _>`
|
||||||
|
--> tests/ui/pin_project/conflict-unpin.rs:42:1
|
||||||
|
|
|
||||||
|
42 | / pin_project! { //~ ERROR E0119
|
||||||
|
43 | | #[project(!Unpin)]
|
||||||
|
44 | | struct Qux<T, U> {
|
||||||
|
45 | | #[pin]
|
||||||
|
... |
|
||||||
|
48 | | }
|
||||||
|
49 | | }
|
||||||
|
| |_^ conflicting implementation for `Qux<_, _>`
|
||||||
|
...
|
||||||
|
52 | impl<T, U> Unpin for Qux<T, U> {} // Non-conditional Unpin impl
|
||||||
|
| ------------------------------ first implementation here
|
||||||
|
|
|
||||||
|
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error[E0119]: conflicting implementations of trait `Unpin` for type `Fred<_, _>`
|
||||||
|
--> tests/ui/pin_project/conflict-unpin.rs:54:1
|
||||||
|
|
|
||||||
|
54 | / pin_project! { //~ ERROR E0119
|
||||||
|
55 | | #[project(!Unpin)]
|
||||||
|
56 | | struct Fred<T, U> {
|
||||||
|
57 | | #[pin]
|
||||||
|
... |
|
||||||
|
60 | | }
|
||||||
|
61 | | }
|
||||||
|
| |_^ conflicting implementation for `Fred<_, _>`
|
||||||
|
...
|
||||||
|
64 | impl<T: Unpin, U: Unpin> Unpin for Fred<T, U> {} // Conditional Unpin impl
|
||||||
|
| --------------------------------------------- first implementation here
|
||||||
|
|
|
||||||
|
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -1,428 +1,530 @@
|
|||||||
error: no rules expected the token `:`
|
error: no rules expected the token `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:4:33
|
--> tests/ui/pin_project/invalid-bounds.rs:6:33
|
||||||
|
|
|
|
||||||
4 | struct Generics1<T: 'static : Sized> { //~ ERROR no rules expected the token `:`
|
6 | struct Generics1<T: 'static : Sized> { //~ ERROR no rules expected the token `:`
|
||||||
| ^ no rules expected this token in macro call
|
| ^ no rules expected this token in macro call
|
||||||
|
|
|
||||||
|
note: while trying to match `>`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| >)?
|
||||||
|
| ^
|
||||||
|
|
||||||
error: no rules expected the token `:`
|
error: no rules expected the token `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:10:33
|
--> tests/ui/pin_project/invalid-bounds.rs:12:33
|
||||||
|
|
|
|
||||||
10 | struct Generics2<T: 'static : ?Sized> { //~ ERROR no rules expected the token `:`
|
12 | struct Generics2<T: 'static : ?Sized> { //~ ERROR no rules expected the token `:`
|
||||||
| ^ no rules expected this token in macro call
|
| ^ no rules expected this token in macro call
|
||||||
|
|
|
||||||
|
note: while trying to match `>`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| >)?
|
||||||
|
| ^
|
||||||
|
|
||||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:15:1
|
--> tests/ui/pin_project/invalid-bounds.rs:17:1
|
||||||
|
|
|
|
||||||
15 | / pin_project! {
|
17 | / pin_project! {
|
||||||
16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
18 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
17 | | field: T,
|
19 | | field: T,
|
||||||
18 | | }
|
20 | | }
|
||||||
19 | | }
|
21 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| | expected one of `+`, `,`, `=`, or `>`
|
| | expected one of `+`, `,`, `=`, or `>`
|
||||||
| |_unexpected token
|
| |_unexpected token
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: you might have meant to end the type parameters here
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: $generics_bound>)?
|
||||||
|
| +
|
||||||
|
|
||||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:15:1
|
--> tests/ui/pin_project/invalid-bounds.rs:17:1
|
||||||
|
|
|
|
||||||
15 | / pin_project! {
|
17 | / pin_project! {
|
||||||
16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
18 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
17 | | field: T,
|
19 | | field: T,
|
||||||
18 | | }
|
20 | | }
|
||||||
19 | | }
|
21 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected one of `+`, `,`, `=`, or `>`
|
| |_expected one of `+`, `,`, `=`, or `>`
|
||||||
| unexpected token
|
| unexpected token
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
||||||
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: you might have meant to end the type parameters here
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: $generics_bound>)?
|
||||||
|
| +
|
||||||
|
|
||||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:15:1
|
--> tests/ui/pin_project/invalid-bounds.rs:17:1
|
||||||
|
|
|
|
||||||
15 | / pin_project! {
|
17 | / pin_project! {
|
||||||
16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
18 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
17 | | field: T,
|
19 | | field: T,
|
||||||
18 | | }
|
20 | | }
|
||||||
19 | | }
|
21 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| | expected one of `+`, `,`, `=`, or `>`
|
| | expected one of `+`, `,`, `=`, or `>`
|
||||||
| |_unexpected token
|
| |_unexpected token
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: you might have meant to end the type parameters here
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: $generics_bound>)?
|
||||||
|
| +
|
||||||
|
|
||||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:15:1
|
--> tests/ui/pin_project/invalid-bounds.rs:17:1
|
||||||
|
|
|
|
||||||
15 | / pin_project! {
|
17 | / pin_project! {
|
||||||
16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
18 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
17 | | field: T,
|
19 | | field: T,
|
||||||
18 | | }
|
20 | | }
|
||||||
19 | | }
|
21 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| | expected one of `+`, `,`, `=`, or `>`
|
| | expected one of `+`, `,`, `=`, or `>`
|
||||||
| |_unexpected token
|
| |_unexpected token
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: you might have meant to end the type parameters here
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: $generics_bound>)?
|
||||||
|
| +
|
||||||
|
|
||||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:21:1
|
--> tests/ui/pin_project/invalid-bounds.rs:23:1
|
||||||
|
|
|
|
||||||
21 | / pin_project! {
|
23 | / pin_project! {
|
||||||
22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
24 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
23 | | field: T,
|
25 | | field: T,
|
||||||
24 | | }
|
26 | | }
|
||||||
25 | | }
|
27 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| | expected one of `+`, `,`, `=`, or `>`
|
| | expected one of `+`, `,`, `=`, or `>`
|
||||||
| |_unexpected token
|
| |_unexpected token
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: you might have meant to end the type parameters here
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: ?$generics_unsized_bound>)?
|
||||||
|
| +
|
||||||
|
|
||||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:21:1
|
--> tests/ui/pin_project/invalid-bounds.rs:23:1
|
||||||
|
|
|
|
||||||
21 | / pin_project! {
|
23 | / pin_project! {
|
||||||
22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
24 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
23 | | field: T,
|
25 | | field: T,
|
||||||
24 | | }
|
26 | | }
|
||||||
25 | | }
|
27 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected one of `+`, `,`, `=`, or `>`
|
| |_expected one of `+`, `,`, `=`, or `>`
|
||||||
| unexpected token
|
| unexpected token
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
||||||
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: you might have meant to end the type parameters here
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: ?$generics_unsized_bound>)?
|
||||||
|
| +
|
||||||
|
|
||||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:21:1
|
--> tests/ui/pin_project/invalid-bounds.rs:23:1
|
||||||
|
|
|
|
||||||
21 | / pin_project! {
|
23 | / pin_project! {
|
||||||
22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
24 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
23 | | field: T,
|
25 | | field: T,
|
||||||
24 | | }
|
26 | | }
|
||||||
25 | | }
|
27 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| | expected one of `+`, `,`, `=`, or `>`
|
| | expected one of `+`, `,`, `=`, or `>`
|
||||||
| |_unexpected token
|
| |_unexpected token
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: you might have meant to end the type parameters here
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: ?$generics_unsized_bound>)?
|
||||||
|
| +
|
||||||
|
|
||||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:21:1
|
--> tests/ui/pin_project/invalid-bounds.rs:23:1
|
||||||
|
|
|
|
||||||
21 | / pin_project! {
|
23 | / pin_project! {
|
||||||
22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
24 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
23 | | field: T,
|
25 | | field: T,
|
||||||
24 | | }
|
26 | | }
|
||||||
25 | | }
|
27 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| | expected one of `+`, `,`, `=`, or `>`
|
| | expected one of `+`, `,`, `=`, or `>`
|
||||||
| |_unexpected token
|
| |_unexpected token
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: you might have meant to end the type parameters here
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: ?$generics_unsized_bound>)?
|
||||||
|
| +
|
||||||
|
|
||||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:27:1
|
--> tests/ui/pin_project/invalid-bounds.rs:29:1
|
||||||
|
|
|
|
||||||
27 | / pin_project! {
|
29 | / pin_project! {
|
||||||
28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
30 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
29 | | field: T,
|
31 | | field: T,
|
||||||
30 | | }
|
32 | | }
|
||||||
31 | | }
|
33 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| | expected one of `+`, `,`, `=`, or `>`
|
| | expected one of `+`, `,`, `=`, or `>`
|
||||||
| |_unexpected token
|
| |_unexpected token
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: you might have meant to end the type parameters here
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: $generics_bound>)?
|
||||||
|
| +
|
||||||
|
|
||||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:27:1
|
--> tests/ui/pin_project/invalid-bounds.rs:29:1
|
||||||
|
|
|
|
||||||
27 | / pin_project! {
|
29 | / pin_project! {
|
||||||
28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
30 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
29 | | field: T,
|
31 | | field: T,
|
||||||
30 | | }
|
32 | | }
|
||||||
31 | | }
|
33 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected one of `+`, `,`, `=`, or `>`
|
| |_expected one of `+`, `,`, `=`, or `>`
|
||||||
| unexpected token
|
| unexpected token
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
||||||
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: you might have meant to end the type parameters here
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: $generics_bound>)?
|
||||||
|
| +
|
||||||
|
|
||||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:27:1
|
--> tests/ui/pin_project/invalid-bounds.rs:29:1
|
||||||
|
|
|
|
||||||
27 | / pin_project! {
|
29 | / pin_project! {
|
||||||
28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
30 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
29 | | field: T,
|
31 | | field: T,
|
||||||
30 | | }
|
32 | | }
|
||||||
31 | | }
|
33 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| | expected one of `+`, `,`, `=`, or `>`
|
| | expected one of `+`, `,`, `=`, or `>`
|
||||||
| |_unexpected token
|
| |_unexpected token
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: you might have meant to end the type parameters here
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: $generics_bound>)?
|
||||||
|
| +
|
||||||
|
|
||||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:27:1
|
--> tests/ui/pin_project/invalid-bounds.rs:29:1
|
||||||
|
|
|
|
||||||
27 | / pin_project! {
|
29 | / pin_project! {
|
||||||
28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
30 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||||
29 | | field: T,
|
31 | | field: T,
|
||||||
30 | | }
|
32 | | }
|
||||||
31 | | }
|
33 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| | expected one of `+`, `,`, `=`, or `>`
|
| | expected one of `+`, `,`, `=`, or `>`
|
||||||
| |_unexpected token
|
| |_unexpected token
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: you might have meant to end the type parameters here
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: $generics_bound>)?
|
||||||
|
| +
|
||||||
|
|
||||||
error: no rules expected the token `Sized`
|
error: no rules expected the token `Sized`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:34:34
|
--> tests/ui/pin_project/invalid-bounds.rs:36:34
|
||||||
|
|
|
|
||||||
34 | struct Generics6<T: ?Sized : Sized> { //~ ERROR no rules expected the token `Sized`
|
36 | struct Generics6<T: ?Sized : Sized> { //~ ERROR no rules expected the token `Sized`
|
||||||
| ^^^^^ no rules expected this token in macro call
|
| ^^^^^ no rules expected this token in macro call
|
||||||
|
|
|
||||||
|
note: while trying to match meta-variable `$generics_lifetime_bound:lifetime`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: $generics_lifetime_bound:lifetime)?
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: no rules expected the token `:`
|
error: no rules expected the token `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:42:20
|
--> tests/ui/pin_project/invalid-bounds.rs:44:20
|
||||||
|
|
|
|
||||||
42 | T: 'static : Sized //~ ERROR no rules expected the token `:`
|
44 | T: 'static : Sized //~ ERROR no rules expected the token `:`
|
||||||
| ^ no rules expected this token in macro call
|
| ^ no rules expected this token in macro call
|
||||||
|
|
|
||||||
|
note: while trying to match `{`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| {
|
||||||
|
| ^
|
||||||
|
|
||||||
error: no rules expected the token `:`
|
error: no rules expected the token `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:51:20
|
--> tests/ui/pin_project/invalid-bounds.rs:53:20
|
||||||
|
|
|
|
||||||
51 | T: 'static : ?Sized //~ ERROR no rules expected the token `:`
|
53 | T: 'static : ?Sized //~ ERROR no rules expected the token `:`
|
||||||
| ^ no rules expected this token in macro call
|
| ^ no rules expected this token in macro call
|
||||||
|
|
|
||||||
|
note: while trying to match `{`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| {
|
||||||
|
| ^
|
||||||
|
|
||||||
error: expected `{` after struct name, found `:`
|
error: expected `{` after struct name, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:57:1
|
--> tests/ui/pin_project/invalid-bounds.rs:59:1
|
||||||
|
|
|
|
||||||
57 | / pin_project! {
|
59 | / pin_project! {
|
||||||
58 | | struct WhereClause3<T>
|
60 | | struct WhereClause3<T>
|
||||||
59 | | where
|
61 | | where
|
||||||
60 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
62 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||||
... |
|
... |
|
||||||
63 | | }
|
65 | | }
|
||||||
64 | | }
|
66 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected `{` after struct name
|
| |_expected `{` after struct name
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: expected one of `+`, `,`, or `{`, found `:`
|
error: expected one of `+`, `,`, or `{`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:57:1
|
--> tests/ui/pin_project/invalid-bounds.rs:59:1
|
||||||
|
|
|
|
||||||
57 | / pin_project! {
|
59 | / pin_project! {
|
||||||
58 | | struct WhereClause3<T>
|
60 | | struct WhereClause3<T>
|
||||||
59 | | where
|
61 | | where
|
||||||
60 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
62 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||||
... |
|
... |
|
||||||
63 | | }
|
65 | | }
|
||||||
64 | | }
|
66 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected one of `+`, `,`, or `{`
|
| |_expected one of `+`, `,`, or `{`
|
||||||
| unexpected token
|
| unexpected token
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
||||||
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: expected `{` after struct name, found `:`
|
error: expected `{` after struct name, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:57:1
|
--> tests/ui/pin_project/invalid-bounds.rs:59:1
|
||||||
|
|
|
|
||||||
57 | / pin_project! {
|
59 | / pin_project! {
|
||||||
58 | | struct WhereClause3<T>
|
60 | | struct WhereClause3<T>
|
||||||
59 | | where
|
61 | | where
|
||||||
60 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
62 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||||
... |
|
... |
|
||||||
63 | | }
|
65 | | }
|
||||||
64 | | }
|
66 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected `{` after struct name
|
| |_expected `{` after struct name
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: expected `{` after struct name, found `:`
|
error: expected `{` after struct name, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:57:1
|
--> tests/ui/pin_project/invalid-bounds.rs:59:1
|
||||||
|
|
|
|
||||||
57 | / pin_project! {
|
59 | / pin_project! {
|
||||||
58 | | struct WhereClause3<T>
|
60 | | struct WhereClause3<T>
|
||||||
59 | | where
|
61 | | where
|
||||||
60 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
62 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||||
... |
|
... |
|
||||||
63 | | }
|
65 | | }
|
||||||
64 | | }
|
66 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected `{` after struct name
|
| |_expected `{` after struct name
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: expected `{` after struct name, found `:`
|
error: expected `{` after struct name, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:66:1
|
--> tests/ui/pin_project/invalid-bounds.rs:68:1
|
||||||
|
|
|
|
||||||
66 | / pin_project! {
|
68 | / pin_project! {
|
||||||
67 | | struct WhereClause4<T>
|
69 | | struct WhereClause4<T>
|
||||||
68 | | where
|
70 | | where
|
||||||
69 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
71 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||||
... |
|
... |
|
||||||
72 | | }
|
74 | | }
|
||||||
73 | | }
|
75 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected `{` after struct name
|
| |_expected `{` after struct name
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: expected one of `+`, `,`, or `{`, found `:`
|
error: expected one of `+`, `,`, or `{`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:66:1
|
--> tests/ui/pin_project/invalid-bounds.rs:68:1
|
||||||
|
|
|
|
||||||
66 | / pin_project! {
|
68 | / pin_project! {
|
||||||
67 | | struct WhereClause4<T>
|
69 | | struct WhereClause4<T>
|
||||||
68 | | where
|
70 | | where
|
||||||
69 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
71 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||||
... |
|
... |
|
||||||
72 | | }
|
74 | | }
|
||||||
73 | | }
|
75 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected one of `+`, `,`, or `{`
|
| |_expected one of `+`, `,`, or `{`
|
||||||
| unexpected token
|
| unexpected token
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
||||||
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: expected `{` after struct name, found `:`
|
error: expected `{` after struct name, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:66:1
|
--> tests/ui/pin_project/invalid-bounds.rs:68:1
|
||||||
|
|
|
|
||||||
66 | / pin_project! {
|
68 | / pin_project! {
|
||||||
67 | | struct WhereClause4<T>
|
69 | | struct WhereClause4<T>
|
||||||
68 | | where
|
70 | | where
|
||||||
69 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
71 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||||
... |
|
... |
|
||||||
72 | | }
|
74 | | }
|
||||||
73 | | }
|
75 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected `{` after struct name
|
| |_expected `{` after struct name
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: expected `{` after struct name, found `:`
|
error: expected `{` after struct name, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:66:1
|
--> tests/ui/pin_project/invalid-bounds.rs:68:1
|
||||||
|
|
|
|
||||||
66 | / pin_project! {
|
68 | / pin_project! {
|
||||||
67 | | struct WhereClause4<T>
|
69 | | struct WhereClause4<T>
|
||||||
68 | | where
|
70 | | where
|
||||||
69 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
71 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||||
... |
|
... |
|
||||||
72 | | }
|
74 | | }
|
||||||
73 | | }
|
75 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected `{` after struct name
|
| |_expected `{` after struct name
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: expected `{` after struct name, found `:`
|
error: expected `{` after struct name, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:75:1
|
--> tests/ui/pin_project/invalid-bounds.rs:77:1
|
||||||
|
|
|
|
||||||
75 | / pin_project! {
|
77 | / pin_project! {
|
||||||
76 | | struct WhereClause5<T>
|
78 | | struct WhereClause5<T>
|
||||||
77 | | where
|
79 | | where
|
||||||
78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
|
80 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||||
... |
|
... |
|
||||||
81 | | }
|
83 | | }
|
||||||
82 | | }
|
84 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected `{` after struct name
|
| |_expected `{` after struct name
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: expected one of `+`, `,`, or `{`, found `:`
|
error: expected one of `+`, `,`, or `{`, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:75:1
|
--> tests/ui/pin_project/invalid-bounds.rs:77:1
|
||||||
|
|
|
|
||||||
75 | / pin_project! {
|
77 | / pin_project! {
|
||||||
76 | | struct WhereClause5<T>
|
78 | | struct WhereClause5<T>
|
||||||
77 | | where
|
79 | | where
|
||||||
78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
|
80 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||||
... |
|
... |
|
||||||
81 | | }
|
83 | | }
|
||||||
82 | | }
|
84 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected one of `+`, `,`, or `{`
|
| |_expected one of `+`, `,`, or `{`
|
||||||
| unexpected token
|
| unexpected token
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
||||||
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: expected `{` after struct name, found `:`
|
error: expected `{` after struct name, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:75:1
|
--> tests/ui/pin_project/invalid-bounds.rs:77:1
|
||||||
|
|
|
|
||||||
75 | / pin_project! {
|
77 | / pin_project! {
|
||||||
76 | | struct WhereClause5<T>
|
78 | | struct WhereClause5<T>
|
||||||
77 | | where
|
79 | | where
|
||||||
78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
|
80 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||||
... |
|
... |
|
||||||
81 | | }
|
83 | | }
|
||||||
82 | | }
|
84 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected `{` after struct name
|
| |_expected `{` after struct name
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: expected `{` after struct name, found `:`
|
error: expected `{` after struct name, found `:`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:75:1
|
--> tests/ui/pin_project/invalid-bounds.rs:77:1
|
||||||
|
|
|
|
||||||
75 | / pin_project! {
|
77 | / pin_project! {
|
||||||
76 | | struct WhereClause5<T>
|
78 | | struct WhereClause5<T>
|
||||||
77 | | where
|
79 | | where
|
||||||
78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
|
80 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||||
... |
|
... |
|
||||||
81 | | }
|
83 | | }
|
||||||
82 | | }
|
84 | | }
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_expected `{` after struct name
|
| |_expected `{` after struct name
|
||||||
| in this macro invocation
|
| 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)
|
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: no rules expected the token `Sized`
|
error: no rules expected the token `Sized`
|
||||||
--> tests/ui/pin_project/invalid-bounds.rs:87:21
|
--> tests/ui/pin_project/invalid-bounds.rs:89:21
|
||||||
|
|
|
|
||||||
87 | T: ?Sized : Sized //~ ERROR no rules expected the token `Sized`
|
89 | T: ?Sized : Sized //~ ERROR no rules expected the token `Sized`
|
||||||
| ^^^^^ no rules expected this token in macro call
|
| ^^^^^ no rules expected this token in macro call
|
||||||
|
|
|
||||||
|
note: while trying to match meta-variable `$where_clause_lifetime_bound:lifetime`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(: $where_clause_lifetime_bound:lifetime)?
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -1,59 +1,53 @@
|
|||||||
error: no rules expected the token `struct`
|
error: no rules expected the token `(`
|
||||||
--> tests/ui/pin_project/invalid.rs:3:1
|
--> tests/ui/pin_project/invalid.rs:7:14
|
||||||
|
|
|
|
||||||
3 | / pin_project! {
|
7 | #[pin()] //~ ERROR no rules expected the token `(`
|
||||||
4 | | struct A<T> {
|
| ^ no rules expected this token in macro call
|
||||||
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)
|
note: while trying to match `]`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(#[$pin:ident])?
|
||||||
|
| ^
|
||||||
|
|
||||||
error: no rules expected the token `struct`
|
error: no rules expected the token `(`
|
||||||
--> tests/ui/pin_project/invalid.rs:3:1
|
--> tests/ui/pin_project/invalid.rs:7:14
|
||||||
|
|
|
|
||||||
3 | / pin_project! {
|
7 | #[pin()] //~ ERROR no rules expected the token `(`
|
||||||
4 | | struct A<T> {
|
| ^ no rules expected this token in macro call
|
||||||
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)
|
note: while trying to match `]`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $(#[$pin:ident])?
|
||||||
|
| ^
|
||||||
|
|
||||||
error: no rules expected the token `struct`
|
error: no rules expected the token `#`
|
||||||
--> tests/ui/pin_project/invalid.rs:17:1
|
--> tests/ui/pin_project/invalid.rs:22:9
|
||||||
|
|
|
|
||||||
17 | / pin_project! {
|
22 | #[pin] //~ ERROR no rules expected the token `#`
|
||||||
18 | | struct C<T> {
|
| ^ no rules expected this token in macro call
|
||||||
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)
|
note: while trying to match meta-variable `$field_vis:vis`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $field_vis:vis $field:ident: $field_ty:ty
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: no rules expected the token `struct`
|
error: no rules expected the token `#`
|
||||||
--> tests/ui/pin_project/invalid.rs:17:1
|
--> tests/ui/pin_project/invalid.rs:22:9
|
||||||
|
|
|
|
||||||
17 | / pin_project! {
|
22 | #[pin] //~ ERROR no rules expected the token `#`
|
||||||
18 | | struct C<T> {
|
| ^ no rules expected this token in macro call
|
||||||
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)
|
note: while trying to match meta-variable `$field_vis:vis`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $field_vis:vis $field:ident: $field_ty:ty
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: cannot find attribute `pin` in this scope
|
error: cannot find attribute `pin` in this scope
|
||||||
--> tests/ui/pin_project/invalid.rs:11:7
|
--> tests/ui/pin_project/invalid.rs:13:7
|
||||||
|
|
|
|
||||||
11 | #[pin] //~ ERROR cannot find attribute `pin` in this scope
|
13 | #[pin] //~ ERROR cannot find attribute `pin` in this scope
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! { //~ ERROR E0263,E0496
|
pin_project! { //~ ERROR E0263,E0496
|
||||||
|
|||||||
@@ -1,75 +1,75 @@
|
|||||||
error[E0263]: lifetime name `'__pin` declared twice in the same scope
|
error[E0403]: the name `'__pin` is already used for a generic parameter in this item's generic parameters
|
||||||
--> tests/ui/pin_project/overlapping_lifetime_names.rs:4:20
|
--> tests/ui/pin_project/overlapping_lifetime_names.rs:6:20
|
||||||
|
|
|
|
||||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
5 | / pin_project! { //~ ERROR E0263,E0496
|
||||||
4 | | pub struct Foo<'__pin, T> {
|
6 | | pub struct Foo<'__pin, T> {
|
||||||
| | ^^^^^^ declared twice
|
| | ^^^^^^ already used
|
||||||
5 | | #[pin]
|
7 | | #[pin]
|
||||||
6 | | field: &'__pin mut T,
|
8 | | field: &'__pin mut T,
|
||||||
7 | | }
|
9 | | }
|
||||||
8 | | }
|
10 | | }
|
||||||
| |_- previous declaration here
|
| |_- first use of `'__pin`
|
||||||
|
|
||||||
error[E0263]: lifetime name `'__pin` declared twice in the same scope
|
error[E0403]: the name `'__pin` is already used for a generic parameter in this item's generic parameters
|
||||||
--> tests/ui/pin_project/overlapping_lifetime_names.rs:4:20
|
--> tests/ui/pin_project/overlapping_lifetime_names.rs:6:20
|
||||||
|
|
|
|
||||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
5 | / pin_project! { //~ ERROR E0263,E0496
|
||||||
4 | | pub struct Foo<'__pin, T> {
|
6 | | pub struct Foo<'__pin, T> {
|
||||||
| | ^^^^^^ declared twice
|
| | ^^^^^^ already used
|
||||||
5 | | #[pin]
|
7 | | #[pin]
|
||||||
6 | | field: &'__pin mut T,
|
8 | | field: &'__pin mut T,
|
||||||
7 | | }
|
9 | | }
|
||||||
8 | | }
|
10 | | }
|
||||||
| |_- previous declaration here
|
| |_- first use of `'__pin`
|
||||||
|
|
||||||
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
|
error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in scope
|
||||||
--> tests/ui/pin_project/overlapping_lifetime_names.rs:3:1
|
--> tests/ui/pin_project/overlapping_lifetime_names.rs:5:1
|
||||||
|
|
|
|
||||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
5 | / pin_project! { //~ ERROR E0263,E0496
|
||||||
4 | | pub struct Foo<'__pin, T> {
|
6 | | pub struct Foo<'__pin, T> {
|
||||||
| | ------ first declared here
|
| | ------ first declared here
|
||||||
5 | | #[pin]
|
7 | | #[pin]
|
||||||
6 | | field: &'__pin mut T,
|
8 | | field: &'__pin mut T,
|
||||||
7 | | }
|
9 | | }
|
||||||
8 | | }
|
10 | | }
|
||||||
| |_^ lifetime `'__pin` already in scope
|
| |_^ 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)
|
= note: this error originates in the macro `$crate::__pin_project_struct_make_proj_method` which comes from the expansion of the macro `pin_project` (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
|
error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in scope
|
||||||
--> tests/ui/pin_project/overlapping_lifetime_names.rs:3:1
|
--> tests/ui/pin_project/overlapping_lifetime_names.rs:5:1
|
||||||
|
|
|
|
||||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
5 | / pin_project! { //~ ERROR E0263,E0496
|
||||||
4 | | pub struct Foo<'__pin, T> {
|
6 | | pub struct Foo<'__pin, T> {
|
||||||
| | ------ first declared here
|
| | ------ first declared here
|
||||||
5 | | #[pin]
|
7 | | #[pin]
|
||||||
6 | | field: &'__pin mut T,
|
8 | | field: &'__pin mut T,
|
||||||
7 | | }
|
9 | | }
|
||||||
8 | | }
|
10 | | }
|
||||||
| |_^ lifetime `'__pin` already in scope
|
| |_^ 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)
|
= note: this error originates in the macro `$crate::__pin_project_struct_make_proj_method` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0263]: lifetime name `'__pin` declared twice in the same scope
|
error[E0403]: the name `'__pin` is already used for a generic parameter in this item's generic parameters
|
||||||
--> tests/ui/pin_project/overlapping_lifetime_names.rs:4:20
|
--> tests/ui/pin_project/overlapping_lifetime_names.rs:6:20
|
||||||
|
|
|
|
||||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
5 | / pin_project! { //~ ERROR E0263,E0496
|
||||||
4 | | pub struct Foo<'__pin, T> {
|
6 | | pub struct Foo<'__pin, T> {
|
||||||
| | ^^^^^^ declared twice
|
| | ^^^^^^ already used
|
||||||
5 | | #[pin]
|
7 | | #[pin]
|
||||||
6 | | field: &'__pin mut T,
|
8 | | field: &'__pin mut T,
|
||||||
7 | | }
|
9 | | }
|
||||||
8 | | }
|
10 | | }
|
||||||
| |_- previous declaration here
|
| |_- first use of `'__pin`
|
||||||
|
|
||||||
|
error[E0403]: the name `'__pin` is already used for a generic parameter in this item's generic parameters
|
||||||
|
--> tests/ui/pin_project/overlapping_lifetime_names.rs:6:20
|
||||||
|
|
|
||||||
|
5 | / pin_project! { //~ ERROR E0263,E0496
|
||||||
|
6 | | pub struct Foo<'__pin, T> {
|
||||||
|
| | ^^^^^^ already used
|
||||||
|
7 | | #[pin]
|
||||||
|
8 | | field: &'__pin mut T,
|
||||||
|
9 | | }
|
||||||
|
10 | | }
|
||||||
|
| |_- first use of `'__pin`
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use std::marker::PhantomPinned;
|
use std::marker::PhantomPinned;
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|||||||
@@ -1,33 +1,34 @@
|
|||||||
error[E0277]: `PhantomPinned` cannot be unpinned
|
error[E0277]: `PhantomPinned` cannot be unpinned
|
||||||
--> tests/ui/pin_project/overlapping_unpin_struct.rs:19:5
|
--> tests/ui/pin_project/overlapping_unpin_struct.rs:21:16
|
||||||
|
|
|
|
||||||
19 | is_unpin::<Foo<PhantomPinned>>(); //~ ERROR E0277
|
21 | is_unpin::<Foo<PhantomPinned>>(); //~ ERROR E0277
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__Origin<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned`
|
| ^^^^^^^^^^^^^^^^^^ within `_::__Origin<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned`, which is required by `Foo<PhantomPinned>: Unpin`
|
||||||
|
|
|
|
||||||
= note: consider using `Box::pin`
|
= note: consider using the `pin!` macro
|
||||||
|
consider using `Box::pin` if you need to access the pinned value outside of the current scope
|
||||||
note: required because it appears within the type `_::__Origin<'_, PhantomPinned>`
|
note: required because it appears within the type `_::__Origin<'_, PhantomPinned>`
|
||||||
--> tests/ui/pin_project/overlapping_unpin_struct.rs:5:1
|
--> tests/ui/pin_project/overlapping_unpin_struct.rs:7:1
|
||||||
|
|
|
|
||||||
5 | / pin_project! {
|
7 | / pin_project! {
|
||||||
6 | | struct Foo<T> {
|
8 | | struct Foo<T> {
|
||||||
7 | | #[pin]
|
9 | | #[pin]
|
||||||
8 | | inner: T,
|
10 | | inner: T,
|
||||||
9 | | }
|
11 | | }
|
||||||
10 | | }
|
12 | | }
|
||||||
| |_^
|
| |_^
|
||||||
note: required because of the requirements on the impl of `Unpin` for `Foo<PhantomPinned>`
|
note: required for `Foo<PhantomPinned>` to implement `Unpin`
|
||||||
--> tests/ui/pin_project/overlapping_unpin_struct.rs:5:1
|
--> tests/ui/pin_project/overlapping_unpin_struct.rs:7:1
|
||||||
|
|
|
|
||||||
5 | / pin_project! {
|
7 | / pin_project! {
|
||||||
6 | | struct Foo<T> {
|
8 | | struct Foo<T> {
|
||||||
7 | | #[pin]
|
9 | | #[pin]
|
||||||
8 | | inner: T,
|
10 | | inner: T,
|
||||||
9 | | }
|
11 | | }
|
||||||
10 | | }
|
12 | | }
|
||||||
| |_^
|
| |_^ unsatisfied trait bound introduced here
|
||||||
note: required by a bound in `is_unpin`
|
note: required by a bound in `is_unpin`
|
||||||
--> tests/ui/pin_project/overlapping_unpin_struct.rs:16:16
|
--> tests/ui/pin_project/overlapping_unpin_struct.rs:18:16
|
||||||
|
|
|
|
||||||
16 | fn is_unpin<T: Unpin>() {}
|
18 | fn is_unpin<T: Unpin>() {}
|
||||||
| ^^^^^ required by this bound in `is_unpin`
|
| ^^^^^ required by this bound in `is_unpin`
|
||||||
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#![allow(unaligned_references)]
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
error: reference to packed field is unaligned
|
error[E0793]: reference to packed field is unaligned
|
||||||
--> tests/ui/pin_project/packed.rs:5:1
|
--> tests/ui/pin_project/packed.rs:5:1
|
||||||
|
|
|
|
||||||
5 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
5 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||||
@@ -10,48 +10,92 @@ error: reference to packed field is unaligned
|
|||||||
11 | | }
|
11 | | }
|
||||||
| |_^
|
| |_^
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
|
||||||
--> tests/ui/pin_project/packed.rs:5:1
|
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
|
||||||
|
|
|
||||||
5 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
|
||||||
6 | | #[repr(packed, C)]
|
|
||||||
7 | | struct Packed {
|
|
||||||
8 | | #[pin]
|
|
||||||
9 | | field: u16,
|
|
||||||
10 | | }
|
|
||||||
11 | | }
|
|
||||||
| |_^
|
|
||||||
= 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)
|
= 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_constant` (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` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: reference to packed field is unaligned
|
error[E0793]: reference to packed field is unaligned
|
||||||
--> tests/ui/pin_project/packed.rs:13:1
|
--> tests/ui/pin_project/packed.rs:5:1
|
||||||
|
|
|
|
||||||
13 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
5 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||||
14 | | #[repr(packed(2))]
|
6 | | #[repr(packed, C)]
|
||||||
15 | | struct PackedN {
|
7 | | struct Packed {
|
||||||
16 | | #[pin]
|
8 | | #[pin]
|
||||||
17 | | field: u32,
|
9 | | field: u16,
|
||||||
18 | | }
|
10 | | }
|
||||||
19 | | }
|
11 | | }
|
||||||
| |_^
|
| |_^
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
|
||||||
--> tests/ui/pin_project/packed.rs:13:1
|
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
|
||||||
|
|
|
||||||
13 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
|
||||||
14 | | #[repr(packed(2))]
|
|
||||||
15 | | struct PackedN {
|
|
||||||
16 | | #[pin]
|
|
||||||
17 | | field: u32,
|
|
||||||
18 | | }
|
|
||||||
19 | | }
|
|
||||||
| |_^
|
|
||||||
= 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)
|
= 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_constant` (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` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error[E0793]: reference to packed field is unaligned
|
||||||
|
--> tests/ui/pin_project/packed.rs:5:1
|
||||||
|
|
|
||||||
|
5 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||||
|
6 | | #[repr(packed, C)]
|
||||||
|
7 | | struct Packed {
|
||||||
|
8 | | #[pin]
|
||||||
|
9 | | field: u16,
|
||||||
|
10 | | }
|
||||||
|
11 | | }
|
||||||
|
| |_^
|
||||||
|
|
|
||||||
|
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
|
||||||
|
= note: 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_constant` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error[E0793]: reference to packed field is unaligned
|
||||||
|
--> tests/ui/pin_project/packed.rs:13:1
|
||||||
|
|
|
||||||
|
13 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||||
|
14 | | #[repr(packed(2))]
|
||||||
|
15 | | struct PackedN {
|
||||||
|
16 | | #[pin]
|
||||||
|
17 | | field: u32,
|
||||||
|
18 | | }
|
||||||
|
19 | | }
|
||||||
|
| |_^
|
||||||
|
|
|
||||||
|
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
|
||||||
|
= note: 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_struct_make_proj_method` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error[E0793]: reference to packed field is unaligned
|
||||||
|
--> tests/ui/pin_project/packed.rs:13:1
|
||||||
|
|
|
||||||
|
13 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||||
|
14 | | #[repr(packed(2))]
|
||||||
|
15 | | struct PackedN {
|
||||||
|
16 | | #[pin]
|
||||||
|
17 | | field: u32,
|
||||||
|
18 | | }
|
||||||
|
19 | | }
|
||||||
|
| |_^
|
||||||
|
|
|
||||||
|
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
|
||||||
|
= note: 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_struct_make_proj_method` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error[E0793]: reference to packed field is unaligned
|
||||||
|
--> tests/ui/pin_project/packed.rs:13:1
|
||||||
|
|
|
||||||
|
13 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||||
|
14 | | #[repr(packed(2))]
|
||||||
|
15 | | struct PackedN {
|
||||||
|
16 | | #[pin]
|
||||||
|
17 | | field: u32,
|
||||||
|
18 | | }
|
||||||
|
19 | | }
|
||||||
|
| |_^
|
||||||
|
|
|
||||||
|
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
|
||||||
|
= note: 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_constant` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
error[E0412]: cannot find type `__Origin` in this scope
|
error[E0412]: cannot find type `__Origin` in this scope
|
||||||
--> tests/ui/pin_project/unpin_sneaky.rs:10:16
|
--> tests/ui/pin_project/unpin_sneaky.rs:12:16
|
||||||
|
|
|
|
||||||
10 | impl Unpin for __Origin {} //~ ERROR E0412,E0321
|
12 | impl Unpin for __Origin {} //~ ERROR E0412,E0321
|
||||||
| ^^^^^^^^ not found in this scope
|
| ^^^^^^^^ not found in this scope
|
||||||
|
|
||||||
error[E0321]: cross-crate traits with a default impl, like `Unpin`, can only be implemented for a struct/enum type, not `[type error]`
|
|
||||||
--> tests/ui/pin_project/unpin_sneaky.rs: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
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -1,79 +1,125 @@
|
|||||||
error: no rules expected the token `}`
|
error: no rules expected the token `}`
|
||||||
--> tests/ui/pin_project/unsupported.rs:3:1
|
--> tests/ui/pin_project/unsupported.rs:5:1
|
||||||
|
|
|
|
||||||
3 | / pin_project! {
|
5 | / pin_project! {
|
||||||
4 | | struct Struct1 {} //~ ERROR no rules expected the token `}`
|
6 | | struct Struct1 {} //~ ERROR no rules expected the token `}`
|
||||||
5 | | }
|
7 | | }
|
||||||
| |_^ no rules expected this token in macro call
|
| |_^ 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)
|
note: while trying to match meta-variable `$field_vis:vis`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $field_vis:vis $field:ident: $field_ty:ty
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
= note: this error originates in the macro `$crate::__pin_project_expand` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: no rules expected the token `}`
|
error: no rules expected the token `}`
|
||||||
--> tests/ui/pin_project/unsupported.rs:3:1
|
--> tests/ui/pin_project/unsupported.rs:5:1
|
||||||
|
|
|
|
||||||
3 | / pin_project! {
|
5 | / pin_project! {
|
||||||
4 | | struct Struct1 {} //~ ERROR no rules expected the token `}`
|
6 | | struct Struct1 {} //~ ERROR no rules expected the token `}`
|
||||||
5 | | }
|
7 | | }
|
||||||
| |_^ no rules expected this token in macro call
|
| |_^ 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)
|
note: while trying to match meta-variable `$field_vis:vis`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| $field_vis:vis $field:ident: $field_ty:ty
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
= note: this error originates in the macro `$crate::__pin_project_expand` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: no rules expected the token `(`
|
error: no rules expected the token `(`
|
||||||
--> tests/ui/pin_project/unsupported.rs:8:19
|
--> tests/ui/pin_project/unsupported.rs:10:19
|
||||||
|
|
|
|
||||||
8 | struct Struct2(); //~ ERROR no rules expected the token `(`
|
10 | struct Struct2(); //~ ERROR no rules expected the token `(`
|
||||||
| ^ no rules expected this token in macro call
|
| ^ no rules expected this token in macro call
|
||||||
|
|
|
||||||
|
note: while trying to match `{`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| {
|
||||||
|
| ^
|
||||||
|
|
||||||
error: no rules expected the token `;`
|
error: no rules expected the token `;`
|
||||||
--> tests/ui/pin_project/unsupported.rs:12:19
|
--> tests/ui/pin_project/unsupported.rs:14:19
|
||||||
|
|
|
|
||||||
12 | struct Struct3; //~ ERROR no rules expected the token `;`
|
14 | struct Struct3; //~ ERROR no rules expected the token `;`
|
||||||
| ^ no rules expected this token in macro call
|
| ^ no rules expected this token in macro call
|
||||||
|
|
|
||||||
|
note: while trying to match `{`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| {
|
||||||
|
| ^
|
||||||
|
|
||||||
error: no rules expected the token `enum`
|
error: no rules expected the token `(`
|
||||||
--> tests/ui/pin_project/unsupported.rs:15:1
|
--> tests/ui/pin_project/unsupported.rs:19:10
|
||||||
|
|
|
|
||||||
15 | / pin_project! {
|
19 | A(u8)
|
||||||
16 | | enum Enum { //~ ERROR no rules expected the token `enum`
|
| ^ no rules expected this token in macro call
|
||||||
17 | | A(u8)
|
|
||||||
18 | | }
|
|
||||||
19 | | }
|
|
||||||
| |_^ 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)
|
note: while trying to match `}`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| }
|
||||||
|
| ^
|
||||||
|
|
||||||
error: no rules expected the token `enum`
|
error: no rules expected the token `(`
|
||||||
--> tests/ui/pin_project/unsupported.rs:15:1
|
--> tests/ui/pin_project/unsupported.rs:19:10
|
||||||
|
|
|
|
||||||
15 | / pin_project! {
|
19 | A(u8)
|
||||||
16 | | enum Enum { //~ ERROR no rules expected the token `enum`
|
| ^ no rules expected this token in macro call
|
||||||
17 | | A(u8)
|
|
||||||
18 | | }
|
|
||||||
19 | | }
|
|
||||||
| |_^ 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)
|
note: while trying to match `}`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| }
|
||||||
|
| ^
|
||||||
|
|
||||||
error: no rules expected the token `union`
|
error: no rules expected the token `union`
|
||||||
--> tests/ui/pin_project/unsupported.rs:21:1
|
--> tests/ui/pin_project/unsupported.rs:23:1
|
||||||
|
|
|
|
||||||
21 | / pin_project! {
|
23 | / pin_project! {
|
||||||
22 | | union Union { //~ ERROR no rules expected the token `union`
|
24 | | union Union { //~ ERROR no rules expected the token `union`
|
||||||
23 | | x: u8,
|
25 | | x: u8,
|
||||||
24 | | }
|
26 | | }
|
||||||
25 | | }
|
27 | | }
|
||||||
| |_^ no rules expected this token in macro call
|
| |_^ 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)
|
::: src/lib.rs
|
||||||
|
|
|
||||||
|
| [$(#[$attrs:meta])* $vis:vis $struct_ty_ident:ident $ident:ident]
|
||||||
|
| ----------------------
|
||||||
|
|
|
||||||
|
note: while trying to match `struct`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| [$(#[$attrs:meta])* $vis:vis struct $ident:ident]
|
||||||
|
| ^^^^^^
|
||||||
|
= note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
|
||||||
|
= note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
|
||||||
|
= note: this error originates in the macro `$crate::__pin_project_expand` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: no rules expected the token `union`
|
error: no rules expected the token `union`
|
||||||
--> tests/ui/pin_project/unsupported.rs:21:1
|
--> tests/ui/pin_project/unsupported.rs:23:1
|
||||||
|
|
|
|
||||||
21 | / pin_project! {
|
23 | / pin_project! {
|
||||||
22 | | union Union { //~ ERROR no rules expected the token `union`
|
24 | | union Union { //~ ERROR no rules expected the token `union`
|
||||||
23 | | x: u8,
|
25 | | x: u8,
|
||||||
24 | | }
|
26 | | }
|
||||||
25 | | }
|
27 | | }
|
||||||
| |_^ no rules expected this token in macro call
|
| |_^ 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)
|
::: src/lib.rs
|
||||||
|
|
|
||||||
|
| [$(#[$attrs:meta])* $vis:vis $struct_ty_ident:ident $ident:ident]
|
||||||
|
| ----------------------
|
||||||
|
|
|
||||||
|
note: while trying to match `struct`
|
||||||
|
--> src/lib.rs
|
||||||
|
|
|
||||||
|
| [$(#[$attrs:meta])* $vis:vis struct $ident:ident]
|
||||||
|
| ^^^^^^
|
||||||
|
= note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
|
||||||
|
= note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
|
||||||
|
= note: this error originates in the macro `$crate::__pin_project_expand` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
error[E0061]: this function takes 0 arguments but 1 argument was supplied
|
error[E0061]: this function takes 0 arguments but 1 argument was supplied
|
||||||
--> tests/ui/pinned_drop/call-drop-inner.rs:10:13
|
--> tests/ui/pinned_drop/call-drop-inner.rs:12:13
|
||||||
|
|
|
|
||||||
10 | __drop_inner(this);
|
12 | __drop_inner(this);
|
||||||
| ^^^^^^^^^^^^ ---- argument unexpected
|
| ^^^^^^^^^^^^ ----
|
||||||
|
| |
|
||||||
|
| unexpected argument of type `Pin<&mut S>`
|
||||||
|
| help: remove the extra argument
|
||||||
|
|
|
|
||||||
note: function defined here
|
note: function defined here
|
||||||
--> tests/ui/pinned_drop/call-drop-inner.rs:3:1
|
--> tests/ui/pinned_drop/call-drop-inner.rs:5:1
|
||||||
|
|
|
|
||||||
3 | / pin_project! {
|
5 | / pin_project! {
|
||||||
4 | | pub struct S {
|
6 | | pub struct S {
|
||||||
5 | | #[pin]
|
7 | | #[pin]
|
||||||
6 | | field: u8,
|
8 | | field: u8,
|
||||||
... |
|
... |
|
||||||
12 | | }
|
14 | | }
|
||||||
13 | | }
|
15 | | }
|
||||||
| |_^
|
| |_^
|
||||||
= note: this error originates in the macro `$crate::__pin_project_make_drop_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::__pin_project_make_drop_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
help: remove the extra argument
|
|
||||||
|
|
|
||||||
10 | __drop_inner();
|
|
||||||
| ~~~~~~~~~~~~~~
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
// In `Drop` impl, the implementor must specify the same requirement as type definition.
|
// In `Drop` impl, the implementor must specify the same requirement as type definition.
|
||||||
|
|||||||
@@ -1,38 +1,36 @@
|
|||||||
error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not
|
error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not
|
||||||
--> tests/ui/pinned_drop/conditional-drop-impl.rs:9:9
|
--> tests/ui/pinned_drop/conditional-drop-impl.rs:11:9
|
||||||
|
|
|
|
||||||
9 | impl<T: Unpin> Drop for DropImpl<T> {
|
11 | impl<T: Unpin> Drop for DropImpl<T> {
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
note: the implementor must specify the same requirement
|
note: the implementor must specify the same requirement
|
||||||
--> tests/ui/pinned_drop/conditional-drop-impl.rs:5:1
|
--> tests/ui/pinned_drop/conditional-drop-impl.rs:7:1
|
||||||
|
|
|
|
||||||
5 | / struct DropImpl<T> {
|
7 | struct DropImpl<T> {
|
||||||
6 | | f: T,
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
7 | | }
|
|
||||||
| |_^
|
|
||||||
|
|
||||||
error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not
|
error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not
|
||||||
--> tests/ui/pinned_drop/conditional-drop-impl.rs:14:1
|
--> tests/ui/pinned_drop/conditional-drop-impl.rs:16:1
|
||||||
|
|
|
|
||||||
14 | / pin_project! {
|
16 | / pin_project! {
|
||||||
15 | | //~^ ERROR E0367
|
17 | | //~^ ERROR E0367
|
||||||
16 | | struct PinnedDropImpl<T> {
|
18 | | struct PinnedDropImpl<T> {
|
||||||
17 | | #[pin]
|
19 | | #[pin]
|
||||||
... |
|
... |
|
||||||
23 | | }
|
25 | | }
|
||||||
24 | | }
|
26 | | }
|
||||||
| |_^
|
| |_^
|
||||||
|
|
|
|
||||||
note: the implementor must specify the same requirement
|
note: the implementor must specify the same requirement
|
||||||
--> tests/ui/pinned_drop/conditional-drop-impl.rs:14:1
|
--> tests/ui/pinned_drop/conditional-drop-impl.rs:16:1
|
||||||
|
|
|
|
||||||
14 | / pin_project! {
|
16 | / pin_project! {
|
||||||
15 | | //~^ ERROR E0367
|
17 | | //~^ ERROR E0367
|
||||||
16 | | struct PinnedDropImpl<T> {
|
18 | | struct PinnedDropImpl<T> {
|
||||||
17 | | #[pin]
|
19 | | #[pin]
|
||||||
... |
|
... |
|
||||||
23 | | }
|
25 | | }
|
||||||
24 | | }
|
26 | | }
|
||||||
| |_^
|
| |_^
|
||||||
= note: this error originates in the macro `$crate::__pin_project_make_drop_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `$crate::__pin_project_make_drop_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|||||||
Reference in New Issue
Block a user