aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-11-16 00:13:39 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-11-16 00:13:39 +0000
commit25dc0f43f86e35f4a672a979872adab09a4073b5 (patch)
tree570f6d6a8e622c88b6332edf44fa702561b2af53
parent8014df694c6c591694dd9e0706ce7c100f654f21 (diff)
parent4052a3c23a002a7fa935ed3df487fe97d954b0f6 (diff)
downloadpin-project-android14-qpr2-s2-release.tar.gz
Change-Id: I2a7d516bd8bbb4e341e51a189840e6f959c2b85d
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp4
-rw-r--r--CHANGELOG.md22
-rw-r--r--Cargo.lock.saved222
-rw-r--r--Cargo.toml16
-rw-r--r--Cargo.toml.orig22
-rw-r--r--METADATA12
-rw-r--r--README.md26
-rw-r--r--src/lib.rs164
-rw-r--r--tests/README.md44
-rw-r--r--tests/compiletest.rs1
-rw-r--r--tests/drop_order.rs2
-rw-r--r--tests/expand/.rustfmt.toml1
-rw-r--r--tests/expand/default/enum.expanded.rs2
-rw-r--r--tests/expand/default/struct.expanded.rs2
-rw-r--r--tests/expand/default/tuple_struct.expanded.rs2
-rw-r--r--tests/expand/multifields/enum.expanded.rs3
-rw-r--r--tests/expand/multifields/struct.expanded.rs3
-rw-r--r--tests/expand/multifields/tuple_struct.expanded.rs3
-rw-r--r--tests/expand/naming/enum-all.expanded.rs3
-rw-r--r--tests/expand/naming/enum-mut.expanded.rs1
-rw-r--r--tests/expand/naming/enum-own.expanded.rs1
-rw-r--r--tests/expand/naming/enum-ref.expanded.rs1
-rw-r--r--tests/expand/naming/struct-all.expanded.rs3
-rw-r--r--tests/expand/naming/struct-mut.expanded.rs2
-rw-r--r--tests/expand/naming/struct-none.expanded.rs2
-rw-r--r--tests/expand/naming/struct-own.expanded.rs3
-rw-r--r--tests/expand/naming/struct-ref.expanded.rs2
-rw-r--r--tests/expand/naming/tuple_struct-all.expanded.rs3
-rw-r--r--tests/expand/naming/tuple_struct-mut.expanded.rs2
-rw-r--r--tests/expand/naming/tuple_struct-none.expanded.rs2
-rw-r--r--tests/expand/naming/tuple_struct-own.expanded.rs3
-rw-r--r--tests/expand/naming/tuple_struct-ref.expanded.rs2
-rw-r--r--tests/expand/not_unpin/enum.expanded.rs3
-rw-r--r--tests/expand/not_unpin/struct.expanded.rs3
-rw-r--r--tests/expand/not_unpin/tuple_struct.expanded.rs3
-rw-r--r--tests/expand/pinned_drop/enum.expanded.rs2
-rw-r--r--tests/expand/pinned_drop/struct.expanded.rs2
-rw-r--r--tests/expand/pinned_drop/tuple_struct.expanded.rs2
-rw-r--r--tests/expand/project_replace/enum.expanded.rs1
-rw-r--r--tests/expand/project_replace/struct.expanded.rs3
-rw-r--r--tests/expand/project_replace/tuple_struct.expanded.rs3
-rw-r--r--tests/expand/pub/enum.expanded.rs2
-rw-r--r--tests/expand/pub/struct.expanded.rs2
-rw-r--r--tests/expand/pub/tuple_struct.expanded.rs2
-rw-r--r--tests/expand/unsafe_unpin/enum.expanded.rs2
-rw-r--r--tests/expand/unsafe_unpin/struct.expanded.rs2
-rw-r--r--tests/expand/unsafe_unpin/tuple_struct.expanded.rs2
-rw-r--r--tests/expandtest.rs1
-rw-r--r--tests/lint.rs17
-rw-r--r--tests/pin_project.rs1
-rw-r--r--tests/pinned_drop.rs1
-rw-r--r--tests/ui/.rustfmt.toml1
-rw-r--r--tests/ui/cfg/cfg_attr-type-mismatch.stderr12
-rw-r--r--tests/ui/not_unpin/conflict-unpin.stderr6
-rw-r--r--tests/ui/not_unpin/impl-unsafe-unpin.stderr6
-rw-r--r--tests/ui/pin_project/add-attr-to-struct.rs2
-rw-r--r--tests/ui/pin_project/add-attr-to-struct.stderr4
-rw-r--r--tests/ui/pin_project/add-pinned-field.stderr22
-rw-r--r--tests/ui/pin_project/conflict-drop.stderr4
-rw-r--r--tests/ui/pin_project/conflict-unpin.stderr6
-rw-r--r--tests/ui/pin_project/impl-unsafe-unpin.stderr6
-rw-r--r--tests/ui/pin_project/invalid.rs8
-rw-r--r--tests/ui/pin_project/invalid.stderr24
-rw-r--r--tests/ui/pin_project/overlapping_unpin_struct.stderr13
-rw-r--r--tests/ui/pin_project/override-priv-mod.rs2
-rw-r--r--tests/ui/pin_project/override-priv-mod.stderr6
-rw-r--r--tests/ui/pin_project/packed_sneaky-3.stderr2
-rw-r--r--tests/ui/pin_project/packed_sneaky-4.rs2
-rw-r--r--tests/ui/pin_project/packed_sneaky-4.stderr26
-rw-r--r--tests/ui/pin_project/private_in_public-enum.rs2
-rw-r--r--tests/ui/pin_project/project_replace_unsized.stderr100
-rw-r--r--tests/ui/pin_project/project_replace_unsized_fn_params.stderr100
-rw-r--r--tests/ui/pin_project/remove-attr-from-field.stderr4
-rw-r--r--tests/ui/pin_project/remove-attr-from-struct.stderr86
-rw-r--r--tests/ui/pin_project/safe_packed_borrows.rs1
-rw-r--r--tests/ui/pin_project/safe_packed_borrows.stderr24
-rw-r--r--tests/ui/pin_project/unaligned_references.rs2
-rw-r--r--tests/ui/pin_project/unaligned_references.stderr27
-rw-r--r--tests/ui/pinned_drop/call-drop-inner.stderr9
-rw-r--r--tests/ui/pinned_drop/conditional-drop-impl.stderr9
-rw-r--r--tests/ui/pinned_drop/invalid.rs2
-rw-r--r--tests/ui/pinned_drop/invalid.stderr4
-rw-r--r--tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr2
-rw-r--r--tests/ui/pinned_drop/self.stderr8
-rw-r--r--tests/ui/pinned_drop/unsafe-call.stderr3
-rw-r--r--tests/ui/unsafe_unpin/conflict-unpin.stderr6
-rw-r--r--tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr2
-rw-r--r--tests/ui/unstable-features/marker_trait_attr.stderr2
-rw-r--r--tests/ui/unstable-features/negative_impls.stderr10
-rw-r--r--tests/ui/unstable-features/overlapping_marker_traits-feature-gate.stderr2
-rw-r--r--tests/ui/unstable-features/overlapping_marker_traits.stderr2
-rw-r--r--tests/ui/unstable-features/trivial_bounds-feature-gate.stderr20
-rw-r--r--tests/ui/unstable-features/trivial_bounds.rs1
-rw-r--r--tests/ui/unstable-features/trivial_bounds.stderr12
-rw-r--r--tests/unsafe_unpin.rs4
96 files changed, 585 insertions, 648 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 401be20..014e8f9 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,6 @@
{
"git": {
- "sha1": "d1c11dc50f88330cfb05ac55aaa06c28877eb1d6"
+ "sha1": "55829b9ac3a24d25a2b188544943ce880cbfbe4e"
},
"path_in_vcs": ""
} \ No newline at end of file
diff --git a/Android.bp b/Android.bp
index d0b5cc0..6ee4954 100644
--- a/Android.bp
+++ b/Android.bp
@@ -42,9 +42,9 @@ rust_library {
host_supported: true,
crate_name: "pin_project",
cargo_env_compat: true,
- cargo_pkg_version: "1.0.12",
+ cargo_pkg_version: "1.1.3",
srcs: ["src/lib.rs"],
- edition: "2018",
+ edition: "2021",
proc_macros: ["libpin_project_internal"],
apex_available: [
"//apex_available:platform",
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 76e245f..ed5637e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,22 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [Unreleased]
+## [1.1.3] - 2023-08-06
+
+- Hide documentation of the `Unpin` implementation for `!Unpin` option to work around [rustdoc issue](https://github.com/rust-lang/rust/issues/80481). ([#355](https://github.com/taiki-e/pin-project/pull/355), thanks @matheus-consoli)
+
+## [1.1.2] - 2023-07-02
+
+- Inline project methods.
+
+## [1.1.1] - 2023-06-29
+
+- Fix build error from dependency when built with `-Z minimal-versions`.
+
+## [1.1.0] - 2023-05-13
+
+- Update `syn` dependency to 2. This increase the minimum supported Rust version from Rust 1.37 to Rust 1.56. ([#352](https://github.com/taiki-e/pin-project/pull/352), [#354](https://github.com/taiki-e/pin-project/pull/354), thanks @maurer and @daxpedda)
+
## [1.0.12] - 2022-08-15
- Suppress `unused_tuple_struct_fields` lint in generated code.
@@ -680,7 +696,11 @@ See also [tracking issue for 0.4 release](https://github.com/taiki-e/pin-project
Initial release
-[Unreleased]: https://github.com/taiki-e/pin-project/compare/v1.0.12...HEAD
+[Unreleased]: https://github.com/taiki-e/pin-project/compare/v1.1.3...HEAD
+[1.1.3]: https://github.com/taiki-e/pin-project/compare/v1.1.2...v1.1.3
+[1.1.2]: https://github.com/taiki-e/pin-project/compare/v1.1.1...v1.1.2
+[1.1.1]: https://github.com/taiki-e/pin-project/compare/v1.1.0...v1.1.1
+[1.1.0]: https://github.com/taiki-e/pin-project/compare/v1.0.12...v1.1.0
[1.0.12]: https://github.com/taiki-e/pin-project/compare/v1.0.11...v1.0.12
[1.0.11]: https://github.com/taiki-e/pin-project/compare/v1.0.10...v1.0.11
[1.0.10]: https://github.com/taiki-e/pin-project/compare/v1.0.9...v1.0.10
diff --git a/Cargo.lock.saved b/Cargo.lock.saved
deleted file mode 100644
index 502ac21..0000000
--- a/Cargo.lock.saved
+++ /dev/null
@@ -1,222 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 3
-
-[[package]]
-name = "diff"
-version = "0.1.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
-
-[[package]]
-name = "glob"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
-
-[[package]]
-name = "itoa"
-version = "1.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
-
-[[package]]
-name = "macrotest"
-version = "1.0.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7489ae0986ce45414b7b3122c2e316661343ecf396b206e3e15f07c846616f10"
-dependencies = [
- "diff",
- "glob",
- "prettyplease",
- "serde",
- "serde_json",
- "syn",
- "toml",
-]
-
-[[package]]
-name = "once_cell"
-version = "1.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
-
-[[package]]
-name = "pin-project"
-version = "1.0.12"
-dependencies = [
- "macrotest",
- "pin-project-internal",
- "rustversion",
- "static_assertions",
- "trybuild",
-]
-
-[[package]]
-name = "pin-project-internal"
-version = "1.0.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "prettyplease"
-version = "0.1.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "697ae720ee02011f439e0701db107ffe2916d83f718342d65d7f8bf7b8a5fee9"
-dependencies = [
- "proc-macro2",
- "syn",
-]
-
-[[package]]
-name = "proc-macro2"
-version = "1.0.43"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab"
-dependencies = [
- "unicode-ident",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
-name = "rustversion"
-version = "1.0.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8"
-
-[[package]]
-name = "ryu"
-version = "1.0.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
-
-[[package]]
-name = "serde"
-version = "1.0.143"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553"
-dependencies = [
- "serde_derive",
-]
-
-[[package]]
-name = "serde_derive"
-version = "1.0.143"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "serde_json"
-version = "1.0.83"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7"
-dependencies = [
- "itoa",
- "ryu",
- "serde",
-]
-
-[[package]]
-name = "static_assertions"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
-
-[[package]]
-name = "syn"
-version = "1.0.99"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-ident",
-]
-
-[[package]]
-name = "termcolor"
-version = "1.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
-dependencies = [
- "winapi-util",
-]
-
-[[package]]
-name = "toml"
-version = "0.5.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
-dependencies = [
- "serde",
-]
-
-[[package]]
-name = "trybuild"
-version = "1.0.64"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7f408301c7480f9e6294eb779cfc907f54bd901a9660ef24d7f233ed5376485"
-dependencies = [
- "glob",
- "once_cell",
- "serde",
- "serde_derive",
- "serde_json",
- "termcolor",
- "toml",
-]
-
-[[package]]
-name = "unicode-ident"
-version = "1.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf"
-
-[[package]]
-name = "winapi"
-version = "0.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
-dependencies = [
- "winapi-i686-pc-windows-gnu",
- "winapi-x86_64-pc-windows-gnu",
-]
-
-[[package]]
-name = "winapi-i686-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-
-[[package]]
-name = "winapi-util"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
-dependencies = [
- "winapi",
-]
-
-[[package]]
-name = "winapi-x86_64-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/Cargo.toml b/Cargo.toml
index 9ad85ba..5a34ad6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,14 +10,14 @@
# See Cargo.toml.orig for the original contents.
[package]
-edition = "2018"
-rust-version = "1.37"
+edition = "2021"
+rust-version = "1.56"
name = "pin-project"
-version = "1.0.12"
+version = "1.1.3"
exclude = [
"/.*",
- "/ci",
"/tools",
+ "/DEVELOPMENT.md",
]
description = """
A crate for safe and ergonomic pin-projection.
@@ -30,6 +30,7 @@ keywords = [
]
categories = [
"no-std",
+ "no-std::no-alloc",
"rust-patterns",
]
license = "Apache-2.0 OR MIT"
@@ -38,8 +39,11 @@ repository = "https://github.com/taiki-e/pin-project"
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
+[lib]
+doc-scrape-examples = false
+
[dependencies.pin-project-internal]
-version = "=1.0.12"
+version = "=1.1.3"
[dev-dependencies.macrotest]
version = "1.0.9"
@@ -51,4 +55,4 @@ version = "1"
version = "1"
[dev-dependencies.trybuild]
-version = "1.0.49"
+version = "1.0.67"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 6ddfa42..81eea2c 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,13 +1,13 @@
[package]
name = "pin-project"
-version = "1.0.12"
-edition = "2018"
-rust-version = "1.37"
+version = "1.1.3"
+edition = "2021"
+rust-version = "1.56"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/taiki-e/pin-project"
keywords = ["pin", "macros", "attribute"]
-categories = ["no-std", "rust-patterns"]
-exclude = ["/.*", "/ci", "/tools"]
+categories = ["no-std", "no-std::no-alloc", "rust-patterns"]
+exclude = ["/.*", "/tools", "/DEVELOPMENT.md"]
description = """
A crate for safe and ergonomic pin-projection.
"""
@@ -16,24 +16,24 @@ A crate for safe and ergonomic pin-projection.
targets = ["x86_64-unknown-linux-gnu"]
[workspace]
+resolver = "2"
members = [
"pin-project-internal",
"tests/auxiliary/macro",
- "tests/doc",
"tests/no-core",
"tests/no-std",
"tests/rust-2015",
]
+[lib]
+doc-scrape-examples = false
+
[dependencies]
-pin-project-internal = { version = "=1.0.12", path = "pin-project-internal" }
+pin-project-internal = { version = "=1.1.3", path = "pin-project-internal" }
[dev-dependencies]
pin-project-auxiliary-macro = { path = "tests/auxiliary/macro" }
macrotest = "1.0.9"
rustversion = "1"
static_assertions = "1"
-trybuild = "1.0.49"
-
-[patch.crates-io]
-prettyplease = { git = "https://github.com/taiki-e/prettyplease.git", branch = "dev" } # lower MSRV
+trybuild = "1.0.67"
diff --git a/METADATA b/METADATA
index 5db590f..95dfea0 100644
--- a/METADATA
+++ b/METADATA
@@ -1,6 +1,6 @@
# This project was upgraded with external_updater.
# Usage: tools/external_updater/updater.sh update rust/crates/pin-project
-# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
+# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md
name: "pin-project"
description: "A crate for safe and ergonomic pin-projection."
@@ -11,13 +11,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/pin-project/pin-project-1.0.12.crate"
+ value: "https://static.crates.io/crates/pin-project/pin-project-1.1.3.crate"
}
- version: "1.0.12"
+ version: "1.1.3"
license_type: NOTICE
last_upgrade_date {
- year: 2022
- month: 12
- day: 13
+ year: 2023
+ month: 11
+ day: 14
}
}
diff --git a/README.md b/README.md
index 0a30654..8a98e04 100644
--- a/README.md
+++ b/README.md
@@ -3,9 +3,10 @@
[![crates.io](https://img.shields.io/crates/v/pin-project?style=flat-square&logo=rust)](https://crates.io/crates/pin-project)
[![docs.rs](https://img.shields.io/badge/docs.rs-pin--project-blue?style=flat-square&logo=docs.rs)](https://docs.rs/pin-project)
[![license](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue?style=flat-square)](#license)
-[![rustc](https://img.shields.io/badge/rustc-1.37+-blue?style=flat-square&logo=rust)](https://www.rust-lang.org)
-[![build status](https://img.shields.io/github/workflow/status/taiki-e/pin-project/CI/main?style=flat-square&logo=github)](https://github.com/taiki-e/pin-project/actions)
+[![rustc](https://img.shields.io/badge/rustc-1.56+-blue?style=flat-square&logo=rust)](https://www.rust-lang.org)
+[![build status](https://img.shields.io/github/actions/workflow/status/taiki-e/pin-project/ci.yml?branch=main&style=flat-square&logo=github)](https://github.com/taiki-e/pin-project/actions)
+<!-- tidy:crate-doc:start -->
A crate for safe and ergonomic [pin-projection].
## Usage
@@ -17,7 +18,7 @@ Add this to your `Cargo.toml`:
pin-project = "1"
```
-*Compiler support: requires rustc 1.37+*
+*Compiler support: requires rustc 1.56+*
## Examples
@@ -25,9 +26,10 @@ pin-project = "1"
covering all the fields of struct or enum.
```rust
-use pin_project::pin_project;
use std::pin::Pin;
+use pin_project::pin_project;
+
#[pin_project]
struct Struct<T, U> {
#[pin]
@@ -50,9 +52,10 @@ To use `#[pin_project]` on enums, you need to name the projection type
returned from the method.
```rust
-use pin_project::pin_project;
use std::pin::Pin;
+use pin_project::pin_project;
+
#[pin_project(project = EnumProj)]
enum Enum<T, U> {
Pinned(#[pin] T),
@@ -75,19 +78,22 @@ impl<T, U> Enum<T, U> {
[*code like this will be generated*][enum-default-expanded]
-See [documentation](https://docs.rs/pin-project) for more details, and
+See [`#[pin_project]`][`pin_project`] attribute for more details, and
see [examples] directory for more examples and generated code.
## Related Projects
- [pin-project-lite]: A lightweight version of pin-project written with declarative macros.
-[`pin_project`]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html
-[enum-default-expanded]: examples/enum-default-expanded.rs
-[examples]: examples/README.md
+[enum-default-expanded]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/enum-default-expanded.rs
+[examples]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/README.md
[pin-project-lite]: https://github.com/taiki-e/pin-project-lite
[pin-projection]: https://doc.rust-lang.org/std/pin/index.html#projections-and-structural-pinning
-[struct-default-expanded]: examples/struct-default-expanded.rs
+[struct-default-expanded]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/struct-default-expanded.rs
+
+<!-- tidy:crate-doc:end -->
+
+[`pin_project`]: https://docs.rs/pin-project/1/pin_project/attr.pin_project.html
## License
diff --git a/src/lib.rs b/src/lib.rs
index ca47cea..41080ab 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,70 +1,91 @@
-//! A crate for safe and ergonomic [pin-projection].
-//!
-//! # Examples
-//!
-//! [`#[pin_project]`][`pin_project`] attribute creates projection types
-//! covering all the fields of struct or enum.
-//!
-//! ```rust
-//! use std::pin::Pin;
-//!
-//! use pin_project::pin_project;
-//!
-//! #[pin_project]
-//! struct Struct<T, U> {
-//! #[pin]
-//! pinned: T,
-//! unpinned: U,
-//! }
-//!
-//! impl<T, U> Struct<T, U> {
-//! fn method(self: Pin<&mut Self>) {
-//! let this = self.project();
-//! let _: Pin<&mut T> = this.pinned; // Pinned reference to the field
-//! let _: &mut U = this.unpinned; // Normal reference to the field
-//! }
-//! }
-//! ```
-//!
-//! [*code like this will be generated*][struct-default-expanded]
-//!
-//! To use `#[pin_project]` on enums, you need to name the projection type
-//! returned from the method.
-//!
-//! ```rust
-//! use std::pin::Pin;
-//!
-//! use pin_project::pin_project;
-//!
-//! #[pin_project(project = EnumProj)]
-//! enum Enum<T, U> {
-//! Pinned(#[pin] T),
-//! Unpinned(U),
-//! }
-//!
-//! impl<T, U> Enum<T, U> {
-//! fn method(self: Pin<&mut Self>) {
-//! match self.project() {
-//! EnumProj::Pinned(x) => {
-//! let _: Pin<&mut T> = x;
-//! }
-//! EnumProj::Unpinned(y) => {
-//! let _: &mut U = y;
-//! }
-//! }
-//! }
-//! }
-//! ```
-//!
-//! [*code like this will be generated*][enum-default-expanded]
-//!
-//! See [`#[pin_project]`][`pin_project`] attribute for more details, and
-//! see [examples] directory for more examples and generated code.
-//!
-//! [examples]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/README.md
-//! [enum-default-expanded]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/enum-default-expanded.rs
-//! [pin-projection]: core::pin#projections-and-structural-pinning
-//! [struct-default-expanded]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/struct-default-expanded.rs
+/*!
+<!-- tidy:crate-doc:start -->
+A crate for safe and ergonomic [pin-projection].
+
+## Usage
+
+Add this to your `Cargo.toml`:
+
+```toml
+[dependencies]
+pin-project = "1"
+```
+
+*Compiler support: requires rustc 1.56+*
+
+## Examples
+
+[`#[pin_project]`][`pin_project`] attribute creates projection types
+covering all the fields of struct or enum.
+
+```rust
+use std::pin::Pin;
+
+use pin_project::pin_project;
+
+#[pin_project]
+struct Struct<T, U> {
+ #[pin]
+ pinned: T,
+ unpinned: U,
+}
+
+impl<T, U> Struct<T, U> {
+ fn method(self: Pin<&mut Self>) {
+ let this = self.project();
+ let _: Pin<&mut T> = this.pinned; // Pinned reference to the field
+ let _: &mut U = this.unpinned; // Normal reference to the field
+ }
+}
+```
+
+[*code like this will be generated*][struct-default-expanded]
+
+To use `#[pin_project]` on enums, you need to name the projection type
+returned from the method.
+
+```rust
+use std::pin::Pin;
+
+use pin_project::pin_project;
+
+#[pin_project(project = EnumProj)]
+enum Enum<T, U> {
+ Pinned(#[pin] T),
+ Unpinned(U),
+}
+
+impl<T, U> Enum<T, U> {
+ fn method(self: Pin<&mut Self>) {
+ match self.project() {
+ EnumProj::Pinned(x) => {
+ let _: Pin<&mut T> = x;
+ }
+ EnumProj::Unpinned(y) => {
+ let _: &mut U = y;
+ }
+ }
+ }
+}
+```
+
+[*code like this will be generated*][enum-default-expanded]
+
+See [`#[pin_project]`][`pin_project`] attribute for more details, and
+see [examples] directory for more examples and generated code.
+
+## Related Projects
+
+- [pin-project-lite]: A lightweight version of pin-project written with declarative macros.
+
+[enum-default-expanded]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/enum-default-expanded.rs
+[examples]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/README.md
+[pin-project-lite]: https://github.com/taiki-e/pin-project-lite
+[pin-projection]: https://doc.rust-lang.org/std/pin/index.html#projections-and-structural-pinning
+[struct-default-expanded]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/struct-default-expanded.rs
+
+<!-- tidy:crate-doc:end -->
+*/
#![no_std]
#![doc(test(
@@ -74,7 +95,13 @@
allow(dead_code, unused_variables)
)
))]
-#![warn(missing_docs, rust_2018_idioms, single_use_lifetimes, unreachable_pub)]
+#![warn(
+ missing_docs,
+ rust_2018_idioms,
+ single_use_lifetimes,
+ unreachable_pub,
+ unsafe_op_in_unsafe_fn
+)]
#![warn(
clippy::pedantic,
// lints for public library
@@ -84,6 +111,7 @@
clippy::std_instead_of_alloc,
clippy::std_instead_of_core,
// lints that help writing unsafe code
+ clippy::as_ptr_cast_mut,
clippy::default_union_representation,
clippy::trailing_empty_array,
clippy::transmute_undefined_repr,
diff --git a/tests/README.md b/tests/README.md
deleted file mode 100644
index b109e71..0000000
--- a/tests/README.md
+++ /dev/null
@@ -1,44 +0,0 @@
-# Tests
-
-To run all tests, run the following command:
-
-```sh
-cargo +nightly test --all
-```
-
-## UI tests (`ui`, `compiletest.rs`)
-
-This checks errors detected by the macro or the Rust compiler in the resulting
-expanded code.
-
-To run this test, run the following command:
-
-```sh
-cargo +nightly test --test compiletest
-```
-
-Locally, this test updates the files in the `ui` directory if there are
-changes to the generated code. If there are any changes to the files in the
-`ui` directory after running the test, please commit them.
-
-See also [`trybuild` documentation](https://docs.rs/trybuild).
-
-## Expansion tests (`expand`, `expandtest.rs`)
-
-Similar to ui tests, but instead of checking the compiler output, this checks
-the code generated by macros.
-
-See [examples](../examples/README.md) for descriptions of what the generated
-code does, and why it needs to be generated.
-
-To run this test, run the following command:
-
-```sh
-cargo +nightly test --test expandtest
-```
-
-Locally, this test updates the files in the `expand` directory if there are
-changes to the generated code. If there are any changes to the files in the
-`expand` directory after running the test, please commit them.
-
-See also [`macrotest` documentation](https://docs.rs/macrotest).
diff --git a/tests/compiletest.rs b/tests/compiletest.rs
index b06e1e8..cb30f60 100644
--- a/tests/compiletest.rs
+++ b/tests/compiletest.rs
@@ -1,4 +1,5 @@
#![cfg(not(miri))]
+#![cfg(not(careful))]
#![warn(rust_2018_idioms, single_use_lifetimes)]
use std::env;
diff --git a/tests/drop_order.rs b/tests/drop_order.rs
index 8ced56e..f1e01fd 100644
--- a/tests/drop_order.rs
+++ b/tests/drop_order.rs
@@ -39,14 +39,12 @@ struct TupleUnpinned<'a>(D<'a>, D<'a>);
#[pin_project(project_replace = EnumProj)]
enum Enum<'a> {
- #[allow(dead_code)] // false positive that fixed in Rust 1.38
StructPinned {
#[pin]
f1: D<'a>,
#[pin]
f2: D<'a>,
},
- #[allow(dead_code)] // false positive that fixed in Rust 1.38
StructUnpinned {
f1: D<'a>,
f2: D<'a>,
diff --git a/tests/expand/.rustfmt.toml b/tests/expand/.rustfmt.toml
new file mode 100644
index 0000000..c7ad93b
--- /dev/null
+++ b/tests/expand/.rustfmt.toml
@@ -0,0 +1 @@
+disable_all_formatting = true
diff --git a/tests/expand/default/enum.expanded.rs b/tests/expand/default/enum.expanded.rs
index 490bf2e..599a5f9 100644
--- a/tests/expand/default/enum.expanded.rs
+++ b/tests/expand/default/enum.expanded.rs
@@ -67,6 +67,7 @@ const _: () = {
extern crate pin_project as _pin_project;
impl<T, U> Enum<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> EnumProj<'pin, T, U> {
@@ -90,6 +91,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> EnumProjRef<'pin, T, U> {
diff --git a/tests/expand/default/struct.expanded.rs b/tests/expand/default/struct.expanded.rs
index 0005d86..db3c948 100644
--- a/tests/expand/default/struct.expanded.rs
+++ b/tests/expand/default/struct.expanded.rs
@@ -42,6 +42,7 @@ const _: () = {
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __StructProjection<'pin, T, U> {
@@ -55,6 +56,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __StructProjectionRef<'pin, T, U> {
diff --git a/tests/expand/default/tuple_struct.expanded.rs b/tests/expand/default/tuple_struct.expanded.rs
index 1c5e3b0..6b962d6 100644
--- a/tests/expand/default/tuple_struct.expanded.rs
+++ b/tests/expand/default/tuple_struct.expanded.rs
@@ -36,6 +36,7 @@ const _: () = {
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
@@ -49,6 +50,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __TupleStructProjectionRef<'pin, T, U> {
diff --git a/tests/expand/multifields/enum.expanded.rs b/tests/expand/multifields/enum.expanded.rs
index 8223de3..003f1c7 100644
--- a/tests/expand/multifields/enum.expanded.rs
+++ b/tests/expand/multifields/enum.expanded.rs
@@ -118,6 +118,7 @@ const _: () = {
extern crate pin_project as _pin_project;
impl<T, U> Enum<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> EnumProj<'pin, T, U> {
@@ -149,6 +150,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> EnumProjRef<'pin, T, U> {
@@ -179,6 +181,7 @@ const _: () = {
}
}
#[allow(dead_code)]
+ #[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
diff --git a/tests/expand/multifields/struct.expanded.rs b/tests/expand/multifields/struct.expanded.rs
index df8dc92..c3e7a02 100644
--- a/tests/expand/multifields/struct.expanded.rs
+++ b/tests/expand/multifields/struct.expanded.rs
@@ -56,6 +56,7 @@ const _: () = {
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __StructProjection<'pin, T, U> {
@@ -72,6 +73,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __StructProjectionRef<'pin, T, U> {
@@ -86,6 +88,7 @@ const _: () = {
}
}
#[allow(dead_code)]
+ #[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
diff --git a/tests/expand/multifields/tuple_struct.expanded.rs b/tests/expand/multifields/tuple_struct.expanded.rs
index 0c85f9a..3931e09 100644
--- a/tests/expand/multifields/tuple_struct.expanded.rs
+++ b/tests/expand/multifields/tuple_struct.expanded.rs
@@ -47,6 +47,7 @@ const _: () = {
);
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
@@ -62,6 +63,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __TupleStructProjectionRef<'pin, T, U> {
@@ -76,6 +78,7 @@ const _: () = {
}
}
#[allow(dead_code)]
+ #[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
diff --git a/tests/expand/naming/enum-all.expanded.rs b/tests/expand/naming/enum-all.expanded.rs
index 8dbe768..8f7c8af 100644
--- a/tests/expand/naming/enum-all.expanded.rs
+++ b/tests/expand/naming/enum-all.expanded.rs
@@ -85,6 +85,7 @@ const _: () = {
extern crate pin_project as _pin_project;
impl<T, U> Enum<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> Proj<'pin, T, U> {
@@ -105,6 +106,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> ProjRef<'pin, T, U> {
@@ -127,6 +129,7 @@ const _: () = {
}
}
#[allow(dead_code)]
+ #[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
diff --git a/tests/expand/naming/enum-mut.expanded.rs b/tests/expand/naming/enum-mut.expanded.rs
index c6916ec..d489e82 100644
--- a/tests/expand/naming/enum-mut.expanded.rs
+++ b/tests/expand/naming/enum-mut.expanded.rs
@@ -47,6 +47,7 @@ const _: () = {
extern crate pin_project as _pin_project;
impl<T, U> Enum<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> Proj<'pin, T, U> {
diff --git a/tests/expand/naming/enum-own.expanded.rs b/tests/expand/naming/enum-own.expanded.rs
index ddeb00c..5fc0430 100644
--- a/tests/expand/naming/enum-own.expanded.rs
+++ b/tests/expand/naming/enum-own.expanded.rs
@@ -42,6 +42,7 @@ const _: () = {
extern crate pin_project as _pin_project;
impl<T, U> Enum<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
diff --git a/tests/expand/naming/enum-ref.expanded.rs b/tests/expand/naming/enum-ref.expanded.rs
index 1a49584..7a141c9 100644
--- a/tests/expand/naming/enum-ref.expanded.rs
+++ b/tests/expand/naming/enum-ref.expanded.rs
@@ -45,6 +45,7 @@ const _: () = {
impl<T, U> Enum<T, U> {
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> ProjRef<'pin, T, U> {
diff --git a/tests/expand/naming/struct-all.expanded.rs b/tests/expand/naming/struct-all.expanded.rs
index e598a4f..36c1230 100644
--- a/tests/expand/naming/struct-all.expanded.rs
+++ b/tests/expand/naming/struct-all.expanded.rs
@@ -77,6 +77,7 @@ const _: () = {
extern crate pin_project as _pin_project;
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> Proj<'pin, T, U> {
@@ -90,6 +91,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> ProjRef<'pin, T, U> {
@@ -102,6 +104,7 @@ const _: () = {
}
}
#[allow(dead_code)]
+ #[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
diff --git a/tests/expand/naming/struct-mut.expanded.rs b/tests/expand/naming/struct-mut.expanded.rs
index 88782ee..7164072 100644
--- a/tests/expand/naming/struct-mut.expanded.rs
+++ b/tests/expand/naming/struct-mut.expanded.rs
@@ -52,6 +52,7 @@ const _: () = {
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> Proj<'pin, T, U> {
@@ -65,6 +66,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __StructProjectionRef<'pin, T, U> {
diff --git a/tests/expand/naming/struct-none.expanded.rs b/tests/expand/naming/struct-none.expanded.rs
index 0005d86..db3c948 100644
--- a/tests/expand/naming/struct-none.expanded.rs
+++ b/tests/expand/naming/struct-none.expanded.rs
@@ -42,6 +42,7 @@ const _: () = {
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __StructProjection<'pin, T, U> {
@@ -55,6 +56,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __StructProjectionRef<'pin, T, U> {
diff --git a/tests/expand/naming/struct-own.expanded.rs b/tests/expand/naming/struct-own.expanded.rs
index cc24862..b2f6079 100644
--- a/tests/expand/naming/struct-own.expanded.rs
+++ b/tests/expand/naming/struct-own.expanded.rs
@@ -57,6 +57,7 @@ const _: () = {
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __StructProjection<'pin, T, U> {
@@ -70,6 +71,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __StructProjectionRef<'pin, T, U> {
@@ -82,6 +84,7 @@ const _: () = {
}
}
#[allow(dead_code)]
+ #[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
diff --git a/tests/expand/naming/struct-ref.expanded.rs b/tests/expand/naming/struct-ref.expanded.rs
index e392f6f..dea8383 100644
--- a/tests/expand/naming/struct-ref.expanded.rs
+++ b/tests/expand/naming/struct-ref.expanded.rs
@@ -52,6 +52,7 @@ const _: () = {
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __StructProjection<'pin, T, U> {
@@ -65,6 +66,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> ProjRef<'pin, T, U> {
diff --git a/tests/expand/naming/tuple_struct-all.expanded.rs b/tests/expand/naming/tuple_struct-all.expanded.rs
index 8c148ed..441da9c 100644
--- a/tests/expand/naming/tuple_struct-all.expanded.rs
+++ b/tests/expand/naming/tuple_struct-all.expanded.rs
@@ -68,6 +68,7 @@ const _: () = {
extern crate pin_project as _pin_project;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> Proj<'pin, T, U> {
@@ -78,6 +79,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> ProjRef<'pin, T, U> {
@@ -87,6 +89,7 @@ const _: () = {
}
}
#[allow(dead_code)]
+ #[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
diff --git a/tests/expand/naming/tuple_struct-mut.expanded.rs b/tests/expand/naming/tuple_struct-mut.expanded.rs
index 79c7901..615019b 100644
--- a/tests/expand/naming/tuple_struct-mut.expanded.rs
+++ b/tests/expand/naming/tuple_struct-mut.expanded.rs
@@ -46,6 +46,7 @@ const _: () = {
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> Proj<'pin, T, U> {
@@ -56,6 +57,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __TupleStructProjectionRef<'pin, T, U> {
diff --git a/tests/expand/naming/tuple_struct-none.expanded.rs b/tests/expand/naming/tuple_struct-none.expanded.rs
index 1c5e3b0..6b962d6 100644
--- a/tests/expand/naming/tuple_struct-none.expanded.rs
+++ b/tests/expand/naming/tuple_struct-none.expanded.rs
@@ -36,6 +36,7 @@ const _: () = {
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
@@ -49,6 +50,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __TupleStructProjectionRef<'pin, T, U> {
diff --git a/tests/expand/naming/tuple_struct-own.expanded.rs b/tests/expand/naming/tuple_struct-own.expanded.rs
index 37e4c34..c85f05d 100644
--- a/tests/expand/naming/tuple_struct-own.expanded.rs
+++ b/tests/expand/naming/tuple_struct-own.expanded.rs
@@ -48,6 +48,7 @@ const _: () = {
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
@@ -61,6 +62,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __TupleStructProjectionRef<'pin, T, U> {
@@ -73,6 +75,7 @@ const _: () = {
}
}
#[allow(dead_code)]
+ #[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
diff --git a/tests/expand/naming/tuple_struct-ref.expanded.rs b/tests/expand/naming/tuple_struct-ref.expanded.rs
index 8c86868..88c5550 100644
--- a/tests/expand/naming/tuple_struct-ref.expanded.rs
+++ b/tests/expand/naming/tuple_struct-ref.expanded.rs
@@ -46,6 +46,7 @@ const _: () = {
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
@@ -59,6 +60,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> ProjRef<'pin, T, U> {
diff --git a/tests/expand/not_unpin/enum.expanded.rs b/tests/expand/not_unpin/enum.expanded.rs
index 98e7bbe..e60896c 100644
--- a/tests/expand/not_unpin/enum.expanded.rs
+++ b/tests/expand/not_unpin/enum.expanded.rs
@@ -67,6 +67,7 @@ const _: () = {
extern crate pin_project as _pin_project;
impl<T, U> Enum<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> EnumProj<'pin, T, U> {
@@ -90,6 +91,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> EnumProjRef<'pin, T, U> {
@@ -112,6 +114,7 @@ const _: () = {
}
}
}
+ #[doc(hidden)]
impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U>
where
_pin_project::__private::Wrapper<
diff --git a/tests/expand/not_unpin/struct.expanded.rs b/tests/expand/not_unpin/struct.expanded.rs
index 420f21a..8d8bb1f 100644
--- a/tests/expand/not_unpin/struct.expanded.rs
+++ b/tests/expand/not_unpin/struct.expanded.rs
@@ -42,6 +42,7 @@ const _: () = {
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __StructProjection<'pin, T, U> {
@@ -55,6 +56,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __StructProjectionRef<'pin, T, U> {
@@ -72,6 +74,7 @@ const _: () = {
let _ = &this.pinned;
let _ = &this.unpinned;
}
+ #[doc(hidden)]
impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U>
where
_pin_project::__private::Wrapper<
diff --git a/tests/expand/not_unpin/tuple_struct.expanded.rs b/tests/expand/not_unpin/tuple_struct.expanded.rs
index 99621f4..0b4b5d9 100644
--- a/tests/expand/not_unpin/tuple_struct.expanded.rs
+++ b/tests/expand/not_unpin/tuple_struct.expanded.rs
@@ -36,6 +36,7 @@ const _: () = {
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
@@ -49,6 +50,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __TupleStructProjectionRef<'pin, T, U> {
@@ -66,6 +68,7 @@ const _: () = {
let _ = &this.0;
let _ = &this.1;
}
+ #[doc(hidden)]
impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U>
where
_pin_project::__private::Wrapper<
diff --git a/tests/expand/pinned_drop/enum.expanded.rs b/tests/expand/pinned_drop/enum.expanded.rs
index 1a8e746..b1ed73c 100644
--- a/tests/expand/pinned_drop/enum.expanded.rs
+++ b/tests/expand/pinned_drop/enum.expanded.rs
@@ -68,6 +68,7 @@ const _: () = {
extern crate pin_project as _pin_project;
impl<T, U> Enum<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> EnumProj<'pin, T, U> {
@@ -91,6 +92,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> EnumProjRef<'pin, T, U> {
diff --git a/tests/expand/pinned_drop/struct.expanded.rs b/tests/expand/pinned_drop/struct.expanded.rs
index d21440d..27ee41b 100644
--- a/tests/expand/pinned_drop/struct.expanded.rs
+++ b/tests/expand/pinned_drop/struct.expanded.rs
@@ -43,6 +43,7 @@ const _: () = {
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __StructProjection<'pin, T, U> {
@@ -56,6 +57,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __StructProjectionRef<'pin, T, U> {
diff --git a/tests/expand/pinned_drop/tuple_struct.expanded.rs b/tests/expand/pinned_drop/tuple_struct.expanded.rs
index 9a614ae..83cd3b1 100644
--- a/tests/expand/pinned_drop/tuple_struct.expanded.rs
+++ b/tests/expand/pinned_drop/tuple_struct.expanded.rs
@@ -37,6 +37,7 @@ const _: () = {
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
@@ -50,6 +51,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __TupleStructProjectionRef<'pin, T, U> {
diff --git a/tests/expand/project_replace/enum.expanded.rs b/tests/expand/project_replace/enum.expanded.rs
index 178cb99..230f6a9 100644
--- a/tests/expand/project_replace/enum.expanded.rs
+++ b/tests/expand/project_replace/enum.expanded.rs
@@ -42,6 +42,7 @@ const _: () = {
extern crate pin_project as _pin_project;
impl<T, U> Enum<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
diff --git a/tests/expand/project_replace/struct.expanded.rs b/tests/expand/project_replace/struct.expanded.rs
index 45839a2..126640a 100644
--- a/tests/expand/project_replace/struct.expanded.rs
+++ b/tests/expand/project_replace/struct.expanded.rs
@@ -47,6 +47,7 @@ const _: () = {
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __StructProjection<'pin, T, U> {
@@ -60,6 +61,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __StructProjectionRef<'pin, T, U> {
@@ -72,6 +74,7 @@ const _: () = {
}
}
#[allow(dead_code)]
+ #[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
diff --git a/tests/expand/project_replace/tuple_struct.expanded.rs b/tests/expand/project_replace/tuple_struct.expanded.rs
index cdee3d1..fced02c 100644
--- a/tests/expand/project_replace/tuple_struct.expanded.rs
+++ b/tests/expand/project_replace/tuple_struct.expanded.rs
@@ -41,6 +41,7 @@ const _: () = {
);
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
@@ -54,6 +55,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __TupleStructProjectionRef<'pin, T, U> {
@@ -66,6 +68,7 @@ const _: () = {
}
}
#[allow(dead_code)]
+ #[inline]
fn project_replace(
self: _pin_project::__private::Pin<&mut Self>,
__replacement: Self,
diff --git a/tests/expand/pub/enum.expanded.rs b/tests/expand/pub/enum.expanded.rs
index 90be268..8c9eaec 100644
--- a/tests/expand/pub/enum.expanded.rs
+++ b/tests/expand/pub/enum.expanded.rs
@@ -67,6 +67,7 @@ const _: () = {
extern crate pin_project as _pin_project;
impl<T, U> Enum<T, U> {
#[allow(dead_code)]
+ #[inline]
pub(crate) fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> EnumProj<'pin, T, U> {
@@ -90,6 +91,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
pub(crate) fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> EnumProjRef<'pin, T, U> {
diff --git a/tests/expand/pub/struct.expanded.rs b/tests/expand/pub/struct.expanded.rs
index ca31f3d..cfa93b6 100644
--- a/tests/expand/pub/struct.expanded.rs
+++ b/tests/expand/pub/struct.expanded.rs
@@ -42,6 +42,7 @@ const _: () = {
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
+ #[inline]
pub(crate) fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __StructProjection<'pin, T, U> {
@@ -55,6 +56,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
pub(crate) fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __StructProjectionRef<'pin, T, U> {
diff --git a/tests/expand/pub/tuple_struct.expanded.rs b/tests/expand/pub/tuple_struct.expanded.rs
index 5c7efbf..cf495a2 100644
--- a/tests/expand/pub/tuple_struct.expanded.rs
+++ b/tests/expand/pub/tuple_struct.expanded.rs
@@ -36,6 +36,7 @@ const _: () = {
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
+ #[inline]
pub(crate) fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
@@ -49,6 +50,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
pub(crate) fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __TupleStructProjectionRef<'pin, T, U> {
diff --git a/tests/expand/unsafe_unpin/enum.expanded.rs b/tests/expand/unsafe_unpin/enum.expanded.rs
index 1f88ccc..2df2635 100644
--- a/tests/expand/unsafe_unpin/enum.expanded.rs
+++ b/tests/expand/unsafe_unpin/enum.expanded.rs
@@ -67,6 +67,7 @@ const _: () = {
extern crate pin_project as _pin_project;
impl<T, U> Enum<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> EnumProj<'pin, T, U> {
@@ -90,6 +91,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> EnumProjRef<'pin, T, U> {
diff --git a/tests/expand/unsafe_unpin/struct.expanded.rs b/tests/expand/unsafe_unpin/struct.expanded.rs
index 5fa7271..838d0d3 100644
--- a/tests/expand/unsafe_unpin/struct.expanded.rs
+++ b/tests/expand/unsafe_unpin/struct.expanded.rs
@@ -42,6 +42,7 @@ const _: () = {
}
impl<T, U> Struct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __StructProjection<'pin, T, U> {
@@ -55,6 +56,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __StructProjectionRef<'pin, T, U> {
diff --git a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs
index de4e926..af8ac00 100644
--- a/tests/expand/unsafe_unpin/tuple_struct.expanded.rs
+++ b/tests/expand/unsafe_unpin/tuple_struct.expanded.rs
@@ -36,6 +36,7 @@ const _: () = {
TupleStruct<T, U>: 'pin;
impl<T, U> TupleStruct<T, U> {
#[allow(dead_code)]
+ #[inline]
fn project<'pin>(
self: _pin_project::__private::Pin<&'pin mut Self>,
) -> __TupleStructProjection<'pin, T, U> {
@@ -49,6 +50,7 @@ const _: () = {
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
+ #[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
) -> __TupleStructProjectionRef<'pin, T, U> {
diff --git a/tests/expandtest.rs b/tests/expandtest.rs
index 4feec1a..04a0666 100644
--- a/tests/expandtest.rs
+++ b/tests/expandtest.rs
@@ -1,4 +1,5 @@
#![cfg(not(miri))]
+#![cfg(not(careful))]
#![warn(rust_2018_idioms, single_use_lifetimes)]
use std::{
diff --git a/tests/lint.rs b/tests/lint.rs
index 35f05d5..d12cdd7 100644
--- a/tests/lint.rs
+++ b/tests/lint.rs
@@ -9,7 +9,7 @@
// 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
+// non_exhaustive_omitted_patterns, multiple_supertrait_upcastable: 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
@@ -17,6 +17,8 @@
box_pointers,
deprecated_in_future,
fuzzy_provenance_casts,
+ invalid_reference_casting,
+ let_underscore_drop,
lossy_provenance_casts,
macro_use_extern_crate,
meta_variable_misuse,
@@ -26,9 +28,12 @@
missing_docs,
non_ascii_idents,
noop_method_call,
+ private_bounds,
+ private_interfaces,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
+ // unnameable_types, // TODO
unreachable_pub,
unused_import_braces,
unused_lifetimes,
@@ -39,7 +44,15 @@
)]
#![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
+#![allow(
+ clippy::absolute_paths,
+ clippy::exhaustive_enums,
+ clippy::exhaustive_structs,
+ clippy::min_ident_chars,
+ clippy::pub_with_shorthand,
+ clippy::single_call_fn,
+ clippy::single_char_lifetime_names
+)] // TODO
pub mod basic {
include!("include/basic.rs");
diff --git a/tests/pin_project.rs b/tests/pin_project.rs
index aa08056..cbc67ce 100644
--- a/tests/pin_project.rs
+++ b/tests/pin_project.rs
@@ -711,6 +711,7 @@ fn dyn_type() {
struct TupleStruct4(#[pin] dyn core::fmt::Debug + Send);
}
+#[allow(clippy::trailing_empty_array)] // TODO: how do we handle this? Should propagate #[repr(...)] to ProjectionOwned?
#[test]
fn parse_self() {
macro_rules! mac {
diff --git a/tests/pinned_drop.rs b/tests/pinned_drop.rs
index 99273c4..c907cc2 100644
--- a/tests/pinned_drop.rs
+++ b/tests/pinned_drop.rs
@@ -150,7 +150,6 @@ fn self_inside_macro_containing_fn() {
}
// See also `ui/pinned_drop/self.rs`.
-#[rustversion::since(1.40)] // https://github.com/rust-lang/rust/pull/64690
#[test]
fn self_inside_macro_def() {
#[pin_project(PinnedDrop)]
diff --git a/tests/ui/.rustfmt.toml b/tests/ui/.rustfmt.toml
new file mode 100644
index 0000000..c7ad93b
--- /dev/null
+++ b/tests/ui/.rustfmt.toml
@@ -0,0 +1 @@
+disable_all_formatting = true
diff --git a/tests/ui/cfg/cfg_attr-type-mismatch.stderr b/tests/ui/cfg/cfg_attr-type-mismatch.stderr
index 366d9c7..081504c 100644
--- a/tests/ui/cfg/cfg_attr-type-mismatch.stderr
+++ b/tests/ui/cfg/cfg_attr-type-mismatch.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> tests/ui/cfg/cfg_attr-type-mismatch.rs:20:27
|
20 | let _: Pin<&mut u8> = x.f; //~ ERROR E0308
- | ------------ ^^^ expected struct `Pin`, found `&mut u8`
+ | ------------ ^^^ expected `Pin<&mut u8>`, found `&mut u8`
| |
| expected due to this
|
@@ -13,11 +13,13 @@ error[E0308]: mismatched types
--> tests/ui/cfg/cfg_attr-type-mismatch.rs:24:22
|
24 | let _: &mut u8 = x.f; //~ ERROR E0308
- | ------- ^^^
- | | |
- | | expected `&mut u8`, found struct `Pin`
- | | help: consider mutably borrowing here: `&mut x.f`
+ | ------- ^^^ expected `&mut u8`, found `Pin<&mut u8>`
+ | |
| expected due to this
|
= note: expected mutable reference `&mut u8`
found struct `Pin<&mut u8>`
+help: consider mutably borrowing here
+ |
+24 | let _: &mut u8 = &mut x.f; //~ ERROR E0308
+ | ++++
diff --git a/tests/ui/not_unpin/conflict-unpin.stderr b/tests/ui/not_unpin/conflict-unpin.stderr
index d79fbfb..4bd72bb 100644
--- a/tests/ui/not_unpin/conflict-unpin.stderr
+++ b/tests/ui/not_unpin/conflict-unpin.stderr
@@ -1,4 +1,4 @@
-error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`
+error[E0119]: conflicting implementations of trait `Unpin` for type `Foo<_, _>`
--> tests/ui/not_unpin/conflict-unpin.rs:3:15
|
3 | #[pin_project(!Unpin)] //~ ERROR E0119
@@ -7,7 +7,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
10 | impl<T, U> Unpin for Foo<T, U> where T: Unpin {}
| ------------------------------ first implementation here
-error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`
+error[E0119]: conflicting implementations of trait `Unpin` for type `Bar<_, _>`
--> tests/ui/not_unpin/conflict-unpin.rs:12:15
|
12 | #[pin_project(!Unpin)] //~ ERROR E0119
@@ -16,7 +16,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
19 | impl<T, U> Unpin for Bar<T, U> {}
| ------------------------------ first implementation here
-error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`
+error[E0119]: conflicting implementations of trait `Unpin` for type `Baz<_, _>`
--> tests/ui/not_unpin/conflict-unpin.rs:21:15
|
21 | #[pin_project(!Unpin)] //~ ERROR E0119
diff --git a/tests/ui/not_unpin/impl-unsafe-unpin.stderr b/tests/ui/not_unpin/impl-unsafe-unpin.stderr
index 93f225e..f116eac 100644
--- a/tests/ui/not_unpin/impl-unsafe-unpin.stderr
+++ b/tests/ui/not_unpin/impl-unsafe-unpin.stderr
@@ -1,4 +1,4 @@
-error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Foo<_, _>`
+error[E0119]: conflicting implementations of trait `UnsafeUnpin` for type `Foo<_, _>`
--> tests/ui/not_unpin/impl-unsafe-unpin.rs:3:1
|
3 | #[pin_project(!Unpin)] //~ ERROR E0119
@@ -9,7 +9,7 @@ error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Bar<_, _>`
+error[E0119]: conflicting implementations of trait `UnsafeUnpin` for type `Bar<_, _>`
--> tests/ui/not_unpin/impl-unsafe-unpin.rs:12:1
|
12 | #[pin_project(!Unpin)] //~ ERROR E0119
@@ -20,7 +20,7 @@ error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Baz<_, _>`
+error[E0119]: conflicting implementations of trait `UnsafeUnpin` for type `Baz<_, _>`
--> tests/ui/not_unpin/impl-unsafe-unpin.rs:21:1
|
21 | #[pin_project(!Unpin)] //~ ERROR E0119
diff --git a/tests/ui/pin_project/add-attr-to-struct.rs b/tests/ui/pin_project/add-attr-to-struct.rs
index 045e796..32253d7 100644
--- a/tests/ui/pin_project/add-attr-to-struct.rs
+++ b/tests/ui/pin_project/add-attr-to-struct.rs
@@ -4,7 +4,7 @@ use auxiliary_macro::add_pin_attr;
use pin_project::pin_project;
#[pin_project]
-#[add_pin_attr(struct)] //~ ERROR duplicate #[pin] attribute
+#[add_pin_attr(struct)] //~ ERROR expected attribute arguments in parentheses
struct Foo {
#[pin]
f: PhantomPinned,
diff --git a/tests/ui/pin_project/add-attr-to-struct.stderr b/tests/ui/pin_project/add-attr-to-struct.stderr
index 6fb88e8..bb76c62 100644
--- a/tests/ui/pin_project/add-attr-to-struct.stderr
+++ b/tests/ui/pin_project/add-attr-to-struct.stderr
@@ -1,7 +1,7 @@
-error: duplicate #[pin] attribute
+error: expected attribute arguments in parentheses: `pin(...)`
--> tests/ui/pin_project/add-attr-to-struct.rs:7:1
|
-7 | #[add_pin_attr(struct)] //~ ERROR duplicate #[pin] attribute
+7 | #[add_pin_attr(struct)] //~ ERROR expected attribute arguments in parentheses
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `add_pin_attr` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/pin_project/add-pinned-field.stderr b/tests/ui/pin_project/add-pinned-field.stderr
index d0832cc..a38329d 100644
--- a/tests/ui/pin_project/add-pinned-field.stderr
+++ b/tests/ui/pin_project/add-pinned-field.stderr
@@ -1,20 +1,21 @@
error[E0277]: `PhantomPinned` cannot be unpinned
- --> tests/ui/pin_project/add-pinned-field.rs:21:5
+ --> tests/ui/pin_project/add-pinned-field.rs:21:16
|
21 | is_unpin::<Foo>(); //~ ERROR E0277
- | ^^^^^^^^^^^^^^^ within `__Foo<'_>`, the trait `Unpin` is not implemented for `PhantomPinned`
+ | ^^^ within `__Foo<'_>`, the trait `Unpin` is not implemented for `PhantomPinned`
|
- = 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 `__Foo<'_>`
--> tests/ui/pin_project/add-pinned-field.rs:8:8
|
8 | struct Foo {
| ^^^
-note: required because of the requirements on the impl of `Unpin` for `Foo`
+note: required for `Foo` to implement `Unpin`
--> tests/ui/pin_project/add-pinned-field.rs:6:1
|
6 | #[pin_project]
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
7 | #[add_pinned_field]
8 | struct Foo {
| ^^^
@@ -26,22 +27,23 @@ note: required by a bound in `is_unpin`
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `PhantomPinned` cannot be unpinned
- --> tests/ui/pin_project/add-pinned-field.rs:22:5
+ --> tests/ui/pin_project/add-pinned-field.rs:22:16
|
22 | is_unpin::<Bar>(); //~ ERROR E0277
- | ^^^^^^^^^^^^^^^ within `__Bar<'_>`, the trait `Unpin` is not implemented for `PhantomPinned`
+ | ^^^ within `__Bar<'_>`, the trait `Unpin` is not implemented for `PhantomPinned`
|
- = 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 `__Bar<'_>`
--> tests/ui/pin_project/add-pinned-field.rs:15:8
|
15 | struct Bar {
| ^^^
-note: required because of the requirements on the impl of `Unpin` for `Bar`
+note: required for `Bar` to implement `Unpin`
--> tests/ui/pin_project/add-pinned-field.rs:14:1
|
14 | #[pin_project]
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
15 | struct Bar {
| ^^^
note: required by a bound in `is_unpin`
diff --git a/tests/ui/pin_project/conflict-drop.stderr b/tests/ui/pin_project/conflict-drop.stderr
index 4ae628d..79d4ca7 100644
--- a/tests/ui/pin_project/conflict-drop.stderr
+++ b/tests/ui/pin_project/conflict-drop.stderr
@@ -1,4 +1,4 @@
-error[E0119]: conflicting implementations of trait `_::FooMustNotImplDrop` for type `Foo<_, _>`
+error[E0119]: conflicting implementations of trait `FooMustNotImplDrop` for type `Foo<_, _>`
--> tests/ui/pin_project/conflict-drop.rs:5:1
|
5 | #[pin_project] //~ ERROR E0119
@@ -9,7 +9,7 @@ error[E0119]: conflicting implementations of trait `_::FooMustNotImplDrop` for t
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `Bar<_, _>`
+error[E0119]: conflicting implementations of trait `Drop` for type `Bar<_, _>`
--> tests/ui/pin_project/conflict-drop.rs:16:15
|
16 | #[pin_project(PinnedDrop)] //~ ERROR E0119
diff --git a/tests/ui/pin_project/conflict-unpin.stderr b/tests/ui/pin_project/conflict-unpin.stderr
index 7df5db2..0f26b68 100644
--- a/tests/ui/pin_project/conflict-unpin.stderr
+++ b/tests/ui/pin_project/conflict-unpin.stderr
@@ -1,4 +1,4 @@
-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
|
5 | #[pin_project] //~ ERROR E0119
@@ -9,7 +9,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`
+error[E0119]: conflicting implementations of trait `Unpin` for type `Bar<_, _>`
--> tests/ui/pin_project/conflict-unpin.rs:17:1
|
17 | #[pin_project] //~ ERROR E0119
@@ -20,7 +20,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`
+error[E0119]: conflicting implementations of trait `Unpin` for type `Baz<_, _>`
--> tests/ui/pin_project/conflict-unpin.rs:27:1
|
27 | #[pin_project] //~ ERROR E0119
diff --git a/tests/ui/pin_project/impl-unsafe-unpin.stderr b/tests/ui/pin_project/impl-unsafe-unpin.stderr
index 9554b9b..7e66b9e 100644
--- a/tests/ui/pin_project/impl-unsafe-unpin.stderr
+++ b/tests/ui/pin_project/impl-unsafe-unpin.stderr
@@ -1,4 +1,4 @@
-error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Foo<_, _>`
+error[E0119]: conflicting implementations of trait `UnsafeUnpin` for type `Foo<_, _>`
--> tests/ui/pin_project/impl-unsafe-unpin.rs:3:1
|
3 | #[pin_project] //~ ERROR E0119
@@ -9,7 +9,7 @@ error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Bar<_, _>`
+error[E0119]: conflicting implementations of trait `UnsafeUnpin` for type `Bar<_, _>`
--> tests/ui/pin_project/impl-unsafe-unpin.rs:12:1
|
12 | #[pin_project] //~ ERROR E0119
@@ -20,7 +20,7 @@ error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin
|
= note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0119]: conflicting implementations of trait `_::_pin_project::UnsafeUnpin` for type `Baz<_, _>`
+error[E0119]: conflicting implementations of trait `UnsafeUnpin` for type `Baz<_, _>`
--> tests/ui/pin_project/impl-unsafe-unpin.rs:21:1
|
21 | #[pin_project] //~ ERROR E0119
diff --git a/tests/ui/pin_project/invalid.rs b/tests/ui/pin_project/invalid.rs
index d39a1fd..a850c57 100644
--- a/tests/ui/pin_project/invalid.rs
+++ b/tests/ui/pin_project/invalid.rs
@@ -3,22 +3,22 @@ mod pin_argument {
#[pin_project]
struct Struct {
- #[pin()] //~ ERROR unexpected token
+ #[pin()] //~ ERROR unexpected token in attribute
f: (),
}
#[pin_project]
- struct TupleStruct(#[pin(foo)] ()); //~ ERROR unexpected token
+ struct TupleStruct(#[pin(foo)] ()); //~ ERROR unexpected token in attribute
#[pin_project]
enum EnumTuple {
- V(#[pin(foo)] ()), //~ ERROR unexpected token
+ V(#[pin(foo)] ()), //~ ERROR unexpected token in attribute
}
#[pin_project]
enum EnumStruct {
V {
- #[pin(foo)] //~ ERROR unexpected token
+ #[pin(foo)] //~ ERROR unexpected token in attribute
f: (),
},
}
diff --git a/tests/ui/pin_project/invalid.stderr b/tests/ui/pin_project/invalid.stderr
index c43d363..ec5205f 100644
--- a/tests/ui/pin_project/invalid.stderr
+++ b/tests/ui/pin_project/invalid.stderr
@@ -1,26 +1,26 @@
-error: unexpected token: `()`
+error: unexpected token in attribute
--> tests/ui/pin_project/invalid.rs:6:14
|
-6 | #[pin()] //~ ERROR unexpected token
- | ^^
+6 | #[pin()] //~ ERROR unexpected token in attribute
+ | ^
-error: unexpected token: `(foo)`
+error: unexpected token in attribute
--> tests/ui/pin_project/invalid.rs:11:29
|
-11 | struct TupleStruct(#[pin(foo)] ()); //~ ERROR unexpected token
- | ^^^^^
+11 | struct TupleStruct(#[pin(foo)] ()); //~ ERROR unexpected token in attribute
+ | ^
-error: unexpected token: `(foo)`
+error: unexpected token in attribute
--> tests/ui/pin_project/invalid.rs:15:16
|
-15 | V(#[pin(foo)] ()), //~ ERROR unexpected token
- | ^^^^^
+15 | V(#[pin(foo)] ()), //~ ERROR unexpected token in attribute
+ | ^
-error: unexpected token: `(foo)`
+error: unexpected token in attribute
--> tests/ui/pin_project/invalid.rs:21:18
|
-21 | #[pin(foo)] //~ ERROR unexpected token
- | ^^^^^
+21 | #[pin(foo)] //~ ERROR unexpected token in attribute
+ | ^
error: duplicate #[pin] attribute
--> tests/ui/pin_project/invalid.rs:33:9
diff --git a/tests/ui/pin_project/overlapping_unpin_struct.stderr b/tests/ui/pin_project/overlapping_unpin_struct.stderr
index 1bd200d..b9efd72 100644
--- a/tests/ui/pin_project/overlapping_unpin_struct.stderr
+++ b/tests/ui/pin_project/overlapping_unpin_struct.stderr
@@ -1,20 +1,21 @@
error[E0277]: `PhantomPinned` cannot be unpinned
- --> tests/ui/pin_project/overlapping_unpin_struct.rs:18:5
+ --> tests/ui/pin_project/overlapping_unpin_struct.rs:18:16
|
18 | is_unpin::<S<PhantomPinned>>(); //~ ERROR E0277
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__S<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned`
+ | ^^^^^^^^^^^^^^^^ within `_::__S<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned`
|
- = note: consider using `Box::pin`
-note: required because it appears within the type `_::__S<'_, PhantomPinned>`
+ = 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 `__S<'_, PhantomPinned>`
--> tests/ui/pin_project/overlapping_unpin_struct.rs:6:8
|
6 | struct S<T> {
| ^
-note: required because of the requirements on the impl of `Unpin` for `S<PhantomPinned>`
+note: required for `S<PhantomPinned>` to implement `Unpin`
--> tests/ui/pin_project/overlapping_unpin_struct.rs:5:1
|
5 | #[pin_project]
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
6 | struct S<T> {
| ^^^^
note: required by a bound in `is_unpin`
diff --git a/tests/ui/pin_project/override-priv-mod.rs b/tests/ui/pin_project/override-priv-mod.rs
index 890fd5b..68285d3 100644
--- a/tests/ui/pin_project/override-priv-mod.rs
+++ b/tests/ui/pin_project/override-priv-mod.rs
@@ -1,5 +1,7 @@
// https://discord.com/channels/273534239310479360/512792629516173323/870075511009857617
+#![allow(hidden_glob_reexports)]
+
extern crate pin_project as pin_project_orig;
extern crate self as pin_project;
diff --git a/tests/ui/pin_project/override-priv-mod.stderr b/tests/ui/pin_project/override-priv-mod.stderr
index 8a3fb9b..2e76c0a 100644
--- a/tests/ui/pin_project/override-priv-mod.stderr
+++ b/tests/ui/pin_project/override-priv-mod.stderr
@@ -1,7 +1,7 @@
-error[E0119]: conflicting implementations of trait `_::SMustNotImplDrop` for type `S`
- --> tests/ui/pin_project/override-priv-mod.rs:14:1
+error[E0119]: conflicting implementations of trait `SMustNotImplDrop` for type `S`
+ --> tests/ui/pin_project/override-priv-mod.rs:16:1
|
-14 | #[pin_project] //~ ERROR conflicting implementations of trait `_::FooMustNotImplDrop`
+16 | #[pin_project] //~ ERROR conflicting implementations of trait `_::FooMustNotImplDrop`
| ^^^^^^^^^^^^^^
| |
| first implementation here
diff --git a/tests/ui/pin_project/packed_sneaky-3.stderr b/tests/ui/pin_project/packed_sneaky-3.stderr
index c97f18b..c181bb3 100644
--- a/tests/ui/pin_project/packed_sneaky-3.stderr
+++ b/tests/ui/pin_project/packed_sneaky-3.stderr
@@ -25,7 +25,7 @@ error: expected item after attributes
|
= note: this error originates in the derive macro `HiddenRepr` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: proc-macro derive produced unparseable tokens
+error: proc-macro derive produced unparsable tokens
--> tests/ui/pin_project/packed_sneaky-3.rs:24:10
|
24 | #[derive(HiddenRepr)] //~ ERROR expected item after attributes
diff --git a/tests/ui/pin_project/packed_sneaky-4.rs b/tests/ui/pin_project/packed_sneaky-4.rs
index fb954ba..4f40907 100644
--- a/tests/ui/pin_project/packed_sneaky-4.rs
+++ b/tests/ui/pin_project/packed_sneaky-4.rs
@@ -1,7 +1,5 @@
// https://github.com/taiki-e/pin-project/issues/342
-#![allow(unaligned_references)]
-
use auxiliary_macro::hidden_repr2;
use pin_project::pin_project;
diff --git a/tests/ui/pin_project/packed_sneaky-4.stderr b/tests/ui/pin_project/packed_sneaky-4.stderr
index 8072ce2..2c24367 100644
--- a/tests/ui/pin_project/packed_sneaky-4.stderr
+++ b/tests/ui/pin_project/packed_sneaky-4.stderr
@@ -1,16 +1,20 @@
-error: reference to packed field is unaligned
- --> tests/ui/pin_project/packed_sneaky-4.rs:8:1
+error[E0793]: reference to packed field is unaligned
+ --> tests/ui/pin_project/packed_sneaky-4.rs:10:5
+ |
+10 | f: u32,
+ | ^
+ |
+ = 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)
+
+error[E0793]: reference to packed field is unaligned
+ --> tests/ui/pin_project/packed_sneaky-4.rs:6:1
|
-8 | #[pin_project] //~ ERROR reference to packed field is unaligned
+6 | #[pin_project] //~ ERROR reference to packed field is unaligned
| ^^^^^^^^^^^^^^
|
-note: the lint level is defined here
- --> tests/ui/pin_project/packed_sneaky-4.rs:8:1
- |
-8 | #[pin_project] //~ ERROR reference to packed field is unaligned
- | ^^^^^^^^^^^^^^
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
- = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = 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 derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/pin_project/private_in_public-enum.rs b/tests/ui/pin_project/private_in_public-enum.rs
index 15a82a9..d55baeb 100644
--- a/tests/ui/pin_project/private_in_public-enum.rs
+++ b/tests/ui/pin_project/private_in_public-enum.rs
@@ -1,6 +1,6 @@
// Even if allows private_in_public, these are errors.
-#![allow(private_in_public)]
+#![allow(private_in_public, dead_code)]
pub enum PublicEnum {
V(PrivateEnum), //~ ERROR E0446
diff --git a/tests/ui/pin_project/project_replace_unsized.stderr b/tests/ui/pin_project/project_replace_unsized.stderr
index 042b499..7982dcc 100644
--- a/tests/ui/pin_project/project_replace_unsized.stderr
+++ b/tests/ui/pin_project/project_replace_unsized.stderr
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
3 | #[pin_project(project_replace)] //~ ERROR E0277
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
4 | struct Struct<T: ?Sized> {
- | - this type parameter needs to be `std::marker::Sized`
+ | - this type parameter needs to be `Sized`
|
note: required because it appears within the type `Struct<T>`
--> tests/ui/pin_project/project_replace_unsized.rs:4:8
@@ -23,24 +23,27 @@ help: function arguments must have a statically known size, borrowed types alway
| +
error[E0277]: the size for values of type `T` cannot be known at compilation time
- --> tests/ui/pin_project/project_replace_unsized.rs:3:1
- |
-3 | #[pin_project(project_replace)] //~ ERROR E0277
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
-4 | struct Struct<T: ?Sized> {
- | - this type parameter needs to be `std::marker::Sized`
- |
+ --> tests/ui/pin_project/project_replace_unsized.rs:3:1
+ |
+3 | #[pin_project(project_replace)] //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+4 | struct Struct<T: ?Sized> {
+ | - this type parameter needs to be `Sized`
+ |
note: required because it appears within the type `Struct<T>`
- --> tests/ui/pin_project/project_replace_unsized.rs:4:8
- |
-4 | struct Struct<T: ?Sized> {
- | ^^^^^^
+ --> tests/ui/pin_project/project_replace_unsized.rs:4:8
+ |
+4 | struct Struct<T: ?Sized> {
+ | ^^^^^^
note: required by a bound in `UnsafeOverwriteGuard::<T>::new`
- --> src/lib.rs
- |
- | impl<T> UnsafeOverwriteGuard<T> {
- | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new`
- = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
+ --> src/lib.rs
+ |
+ | impl<T> UnsafeOverwriteGuard<T> {
+ | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new`
+ | #[doc(hidden)]
+ | pub unsafe fn new(target: *mut T, value: T) -> Self {
+ | --- required by a bound in this associated function
+ = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
4 - struct Struct<T: ?Sized> {
@@ -48,20 +51,20 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
- --> tests/ui/pin_project/project_replace_unsized.rs:5:5
- |
-3 | #[pin_project(project_replace)] //~ ERROR E0277
- | ------------------------------- required by a bound introduced by this call
-4 | struct Struct<T: ?Sized> {
- | - this type parameter needs to be `std::marker::Sized`
-5 | f: T,
- | ^ doesn't have a size known at compile-time
- |
+ --> tests/ui/pin_project/project_replace_unsized.rs:5:5
+ |
+3 | #[pin_project(project_replace)] //~ ERROR E0277
+ | ------------------------------- required by a bound introduced by this call
+4 | struct Struct<T: ?Sized> {
+ | - this type parameter needs to be `Sized`
+5 | f: T,
+ | ^ doesn't have a size known at compile-time
+ |
note: required by a bound in `std::ptr::read`
- --> $RUST/core/src/ptr/mod.rs
- |
- | pub const unsafe fn read<T>(src: *const T) -> T {
- | ^ required by this bound in `std::ptr::read`
+ --> $RUST/core/src/ptr/mod.rs
+ |
+ | pub const unsafe fn read<T>(src: *const T) -> T {
+ | ^ required by this bound in `read`
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
4 - struct Struct<T: ?Sized> {
@@ -74,7 +77,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
8 | #[pin_project(project_replace)] //~ ERROR E0277
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
9 | struct TupleStruct<T: ?Sized>(T);
- | - this type parameter needs to be `std::marker::Sized`
+ | - this type parameter needs to be `Sized`
|
note: required because it appears within the type `TupleStruct<T>`
--> tests/ui/pin_project/project_replace_unsized.rs:9:8
@@ -93,24 +96,27 @@ help: function arguments must have a statically known size, borrowed types alway
| +
error[E0277]: the size for values of type `T` cannot be known at compilation time
- --> tests/ui/pin_project/project_replace_unsized.rs:8:1
- |
-8 | #[pin_project(project_replace)] //~ ERROR E0277
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
-9 | struct TupleStruct<T: ?Sized>(T);
- | - this type parameter needs to be `std::marker::Sized`
- |
+ --> tests/ui/pin_project/project_replace_unsized.rs:8:1
+ |
+8 | #[pin_project(project_replace)] //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+9 | struct TupleStruct<T: ?Sized>(T);
+ | - this type parameter needs to be `Sized`
+ |
note: required because it appears within the type `TupleStruct<T>`
- --> tests/ui/pin_project/project_replace_unsized.rs:9:8
- |
-9 | struct TupleStruct<T: ?Sized>(T);
- | ^^^^^^^^^^^
+ --> tests/ui/pin_project/project_replace_unsized.rs:9:8
+ |
+9 | struct TupleStruct<T: ?Sized>(T);
+ | ^^^^^^^^^^^
note: required by a bound in `UnsafeOverwriteGuard::<T>::new`
- --> src/lib.rs
- |
- | impl<T> UnsafeOverwriteGuard<T> {
- | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new`
- = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
+ --> src/lib.rs
+ |
+ | impl<T> UnsafeOverwriteGuard<T> {
+ | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new`
+ | #[doc(hidden)]
+ | pub unsafe fn new(target: *mut T, value: T) -> Self {
+ | --- required by a bound in this associated function
+ = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
9 - struct TupleStruct<T: ?Sized>(T);
diff --git a/tests/ui/pin_project/project_replace_unsized_fn_params.stderr b/tests/ui/pin_project/project_replace_unsized_fn_params.stderr
index 10fad08..e8e9c8c 100644
--- a/tests/ui/pin_project/project_replace_unsized_fn_params.stderr
+++ b/tests/ui/pin_project/project_replace_unsized_fn_params.stderr
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
6 | struct Struct<T: ?Sized> {
| ^^^^^^^-^^^^^^^^^
| | |
- | | this type parameter needs to be `std::marker::Sized`
+ | | this type parameter needs to be `Sized`
| doesn't have a size known at compile-time
|
note: required because it appears within the type `__StructProjectionOwned<T>`
@@ -20,24 +20,27 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
- --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:5:1
- |
-5 | #[pin_project(project_replace)] //~ ERROR E0277
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
-6 | struct Struct<T: ?Sized> {
- | - this type parameter needs to be `std::marker::Sized`
- |
+ --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:5:1
+ |
+5 | #[pin_project(project_replace)] //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+6 | struct Struct<T: ?Sized> {
+ | - this type parameter needs to be `Sized`
+ |
note: required because it appears within the type `Struct<T>`
- --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:6:8
- |
-6 | struct Struct<T: ?Sized> {
- | ^^^^^^
+ --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:6:8
+ |
+6 | struct Struct<T: ?Sized> {
+ | ^^^^^^
note: required by a bound in `UnsafeOverwriteGuard::<T>::new`
- --> src/lib.rs
- |
- | impl<T> UnsafeOverwriteGuard<T> {
- | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new`
- = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
+ --> src/lib.rs
+ |
+ | impl<T> UnsafeOverwriteGuard<T> {
+ | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new`
+ | #[doc(hidden)]
+ | pub unsafe fn new(target: *mut T, value: T) -> Self {
+ | --- required by a bound in this associated function
+ = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
6 - struct Struct<T: ?Sized> {
@@ -45,20 +48,20 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
- --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:7:5
- |
-5 | #[pin_project(project_replace)] //~ ERROR E0277
- | ------------------------------- required by a bound introduced by this call
-6 | struct Struct<T: ?Sized> {
- | - this type parameter needs to be `std::marker::Sized`
-7 | f: T,
- | ^ doesn't have a size known at compile-time
- |
+ --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:7:5
+ |
+5 | #[pin_project(project_replace)] //~ ERROR E0277
+ | ------------------------------- required by a bound introduced by this call
+6 | struct Struct<T: ?Sized> {
+ | - this type parameter needs to be `Sized`
+7 | f: T,
+ | ^ doesn't have a size known at compile-time
+ |
note: required by a bound in `std::ptr::read`
- --> $RUST/core/src/ptr/mod.rs
- |
- | pub const unsafe fn read<T>(src: *const T) -> T {
- | ^ required by this bound in `std::ptr::read`
+ --> $RUST/core/src/ptr/mod.rs
+ |
+ | pub const unsafe fn read<T>(src: *const T) -> T {
+ | ^ required by this bound in `read`
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
6 - struct Struct<T: ?Sized> {
@@ -71,7 +74,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
11 | struct TupleStruct<T: ?Sized>(T);
| ^^^^^^^^^^^^-^^^^^^^^^
| | |
- | | this type parameter needs to be `std::marker::Sized`
+ | | this type parameter needs to be `Sized`
| doesn't have a size known at compile-time
|
note: required because it appears within the type `__TupleStructProjectionOwned<T>`
@@ -87,24 +90,27 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
- --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:10:1
- |
-10 | #[pin_project(project_replace)] //~ ERROR E0277
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
-11 | struct TupleStruct<T: ?Sized>(T);
- | - this type parameter needs to be `std::marker::Sized`
- |
+ --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:10:1
+ |
+10 | #[pin_project(project_replace)] //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+11 | struct TupleStruct<T: ?Sized>(T);
+ | - this type parameter needs to be `Sized`
+ |
note: required because it appears within the type `TupleStruct<T>`
- --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:11:8
- |
-11 | struct TupleStruct<T: ?Sized>(T);
- | ^^^^^^^^^^^
+ --> tests/ui/pin_project/project_replace_unsized_fn_params.rs:11:8
+ |
+11 | struct TupleStruct<T: ?Sized>(T);
+ | ^^^^^^^^^^^
note: required by a bound in `UnsafeOverwriteGuard::<T>::new`
- --> src/lib.rs
- |
- | impl<T> UnsafeOverwriteGuard<T> {
- | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new`
- = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
+ --> src/lib.rs
+ |
+ | impl<T> UnsafeOverwriteGuard<T> {
+ | ^ required by this bound in `UnsafeOverwriteGuard::<T>::new`
+ | #[doc(hidden)]
+ | pub unsafe fn new(target: *mut T, value: T) -> Self {
+ | --- required by a bound in this associated function
+ = note: this error originates in the derive macro `::pin_project::__private::__PinProjectInternalDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
11 - struct TupleStruct<T: ?Sized>(T);
diff --git a/tests/ui/pin_project/remove-attr-from-field.stderr b/tests/ui/pin_project/remove-attr-from-field.stderr
index 697cd63..f693261 100644
--- a/tests/ui/pin_project/remove-attr-from-field.stderr
+++ b/tests/ui/pin_project/remove-attr-from-field.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> tests/ui/pin_project/remove-attr-from-field.rs:28:38
|
28 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308
- | ----------------------- ^^^ expected struct `Pin`, found `&mut PhantomPinned`
+ | ----------------------- ^^^ expected `Pin<&mut PhantomPinned>`, found `&mut PhantomPinned`
| |
| expected due to this
|
@@ -13,7 +13,7 @@ error[E0308]: mismatched types
--> tests/ui/pin_project/remove-attr-from-field.rs:32:38
|
32 | let _: Pin<&mut PhantomPinned> = x.f; //~ ERROR E0308
- | ----------------------- ^^^ expected struct `Pin`, found `&mut PhantomPinned`
+ | ----------------------- ^^^ expected `Pin<&mut PhantomPinned>`, found `&mut PhantomPinned`
| |
| expected due to this
|
diff --git a/tests/ui/pin_project/remove-attr-from-struct.stderr b/tests/ui/pin_project/remove-attr-from-struct.stderr
index 1a9cd42..0b440dd 100644
--- a/tests/ui/pin_project/remove-attr-from-struct.stderr
+++ b/tests/ui/pin_project/remove-attr-from-struct.stderr
@@ -19,12 +19,13 @@ error: cannot find attribute `pin` in this scope
| ^^^
error[E0277]: `PhantomPinned` cannot be unpinned
- --> tests/ui/pin_project/remove-attr-from-struct.rs:35:5
+ --> tests/ui/pin_project/remove-attr-from-struct.rs:35:16
|
35 | is_unpin::<A>(); //~ ERROR E0277
- | ^^^^^^^^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned`
+ | ^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned`
|
- = 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 `A`
--> tests/ui/pin_project/remove-attr-from-struct.rs:10:8
|
@@ -37,12 +38,13 @@ note: required by a bound in `is_unpin`
| ^^^^^ required by this bound in `is_unpin`
error[E0277]: `PhantomPinned` cannot be unpinned
- --> tests/ui/pin_project/remove-attr-from-struct.rs:36:5
+ --> tests/ui/pin_project/remove-attr-from-struct.rs:36:16
|
36 | is_unpin::<B>(); //~ ERROR E0277
- | ^^^^^^^^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned`
+ | ^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned`
|
- = 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 `B`
--> tests/ui/pin_project/remove-attr-from-struct.rs:17:8
|
@@ -55,24 +57,28 @@ note: required by a bound in `is_unpin`
| ^^^^^ required by this bound in `is_unpin`
error[E0277]: `PhantomPinned` cannot be unpinned
- --> tests/ui/pin_project/remove-attr-from-struct.rs:40:22
- |
-40 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599
- | -------- ^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned`
- | |
- | required by a bound introduced by this call
- |
- = note: consider using `Box::pin`
+ --> tests/ui/pin_project/remove-attr-from-struct.rs:40:22
+ |
+40 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599
+ | -------- ^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned`
+ | |
+ | required by a bound introduced by this call
+ |
+ = note: consider using 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 `A`
- --> tests/ui/pin_project/remove-attr-from-struct.rs:10:8
- |
-10 | struct A {
- | ^
+ --> tests/ui/pin_project/remove-attr-from-struct.rs:10:8
+ |
+10 | struct A {
+ | ^
note: required by a bound in `Pin::<P>::new`
- --> $RUST/core/src/pin.rs
- |
- | impl<P: Deref<Target: Unpin>> Pin<P> {
- | ^^^^^ required by this bound in `Pin::<P>::new`
+ --> $RUST/core/src/pin.rs
+ |
+ | impl<P: Deref<Target: Unpin>> Pin<P> {
+ | ^^^^^ required by this bound in `Pin::<P>::new`
+...
+ | pub const fn new(pointer: P) -> Pin<P> {
+ | --- required by a bound in this associated function
error[E0599]: no method named `project` found for struct `Pin<&mut A>` in the current scope
--> tests/ui/pin_project/remove-attr-from-struct.rs:40:30
@@ -81,24 +87,28 @@ error[E0599]: no method named `project` found for struct `Pin<&mut A>` in the cu
| ^^^^^^^ method not found in `Pin<&mut A>`
error[E0277]: `PhantomPinned` cannot be unpinned
- --> tests/ui/pin_project/remove-attr-from-struct.rs:43:22
- |
-43 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599
- | -------- ^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned`
- | |
- | required by a bound introduced by this call
- |
- = note: consider using `Box::pin`
+ --> tests/ui/pin_project/remove-attr-from-struct.rs:43:22
+ |
+43 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599
+ | -------- ^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned`
+ | |
+ | required by a bound introduced by this call
+ |
+ = note: consider using 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 `B`
- --> tests/ui/pin_project/remove-attr-from-struct.rs:17:8
- |
-17 | struct B {
- | ^
+ --> tests/ui/pin_project/remove-attr-from-struct.rs:17:8
+ |
+17 | struct B {
+ | ^
note: required by a bound in `Pin::<P>::new`
- --> $RUST/core/src/pin.rs
- |
- | impl<P: Deref<Target: Unpin>> Pin<P> {
- | ^^^^^ required by this bound in `Pin::<P>::new`
+ --> $RUST/core/src/pin.rs
+ |
+ | impl<P: Deref<Target: Unpin>> Pin<P> {
+ | ^^^^^ required by this bound in `Pin::<P>::new`
+...
+ | pub const fn new(pointer: P) -> Pin<P> {
+ | --- required by a bound in this associated function
error[E0599]: no method named `project` found for struct `Pin<&mut B>` in the current scope
--> tests/ui/pin_project/remove-attr-from-struct.rs:43:30
diff --git a/tests/ui/pin_project/safe_packed_borrows.rs b/tests/ui/pin_project/safe_packed_borrows.rs
index de8181c..8ef144c 100644
--- a/tests/ui/pin_project/safe_packed_borrows.rs
+++ b/tests/ui/pin_project/safe_packed_borrows.rs
@@ -1,6 +1,5 @@
#![deny(renamed_and_removed_lints)]
#![deny(safe_packed_borrows)] //~ ERROR has been renamed to `unaligned_references`
-#![allow(unaligned_references)]
// This lint was removed in https://github.com/rust-lang/rust/pull/82525 (nightly-2021-03-28).
// Refs:
diff --git a/tests/ui/pin_project/safe_packed_borrows.stderr b/tests/ui/pin_project/safe_packed_borrows.stderr
index f483b6d..26e6f8d 100644
--- a/tests/ui/pin_project/safe_packed_borrows.stderr
+++ b/tests/ui/pin_project/safe_packed_borrows.stderr
@@ -1,11 +1,31 @@
-error: lint `safe_packed_borrows` has been renamed to `unaligned_references`
+error: lint `safe_packed_borrows` has been removed: converted into hard error, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> for more information
--> tests/ui/pin_project/safe_packed_borrows.rs:2:9
|
2 | #![deny(safe_packed_borrows)] //~ ERROR has been renamed to `unaligned_references`
- | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `unaligned_references`
+ | ^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> tests/ui/pin_project/safe_packed_borrows.rs:1:9
|
1 | #![deny(renamed_and_removed_lints)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0793]: reference to packed field is unaligned
+ --> tests/ui/pin_project/safe_packed_borrows.rs:21:13
+ |
+21 | let _ = &a.f;
+ | ^^^^
+ |
+ = 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)
+
+error[E0793]: reference to packed field is unaligned
+ --> tests/ui/pin_project/safe_packed_borrows.rs:24:13
+ |
+24 | let _ = &b.f;
+ | ^^^^
+ |
+ = 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)
diff --git a/tests/ui/pin_project/unaligned_references.rs b/tests/ui/pin_project/unaligned_references.rs
index eaf185d..5c7dc43 100644
--- a/tests/ui/pin_project/unaligned_references.rs
+++ b/tests/ui/pin_project/unaligned_references.rs
@@ -1,5 +1,3 @@
-#![forbid(unaligned_references)]
-
// Refs: https://github.com/rust-lang/rust/issues/82523
#[repr(packed)]
diff --git a/tests/ui/pin_project/unaligned_references.stderr b/tests/ui/pin_project/unaligned_references.stderr
index 8d5ddfc..617f164 100644
--- a/tests/ui/pin_project/unaligned_references.stderr
+++ b/tests/ui/pin_project/unaligned_references.stderr
@@ -1,26 +1,19 @@
-error: reference to packed field is unaligned
- --> tests/ui/pin_project/unaligned_references.rs:17:13
+error[E0793]: reference to packed field is unaligned
+ --> tests/ui/pin_project/unaligned_references.rs:15:13
|
-17 | let _ = &a.f; //~ ERROR reference to packed field is unaligned
+15 | let _ = &a.f; //~ ERROR reference to packed field is unaligned
| ^^^^
|
-note: the lint level is defined here
- --> tests/ui/pin_project/unaligned_references.rs:1:11
- |
-1 | #![forbid(unaligned_references)]
- | ^^^^^^^^^^^^^^^^^^^^
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
- = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = 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)
-error: reference to packed field is unaligned
- --> tests/ui/pin_project/unaligned_references.rs:20:13
+error[E0793]: reference to packed field is unaligned
+ --> tests/ui/pin_project/unaligned_references.rs:18:13
|
-20 | let _ = &b.f; //~ ERROR reference to packed field is unaligned
+18 | let _ = &b.f; //~ ERROR reference to packed field is unaligned
| ^^^^
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
- = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = 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)
diff --git a/tests/ui/pinned_drop/call-drop-inner.stderr b/tests/ui/pinned_drop/call-drop-inner.stderr
index e3ceebd..277d50f 100644
--- a/tests/ui/pinned_drop/call-drop-inner.stderr
+++ b/tests/ui/pinned_drop/call-drop-inner.stderr
@@ -2,7 +2,10 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
--> tests/ui/pinned_drop/call-drop-inner.rs:13:9
|
13 | __drop_inner(__self);
- | ^^^^^^^^^^^^ ------ argument of type `Pin<&mut Struct>` unexpected
+ | ^^^^^^^^^^^^ ------
+ | |
+ | unexpected argument of type `Pin<&mut Struct>`
+ | help: remove the extra argument
|
note: function defined here
--> tests/ui/pinned_drop/call-drop-inner.rs:10:1
@@ -10,7 +13,3 @@ note: function defined here
10 | #[pinned_drop]
| ^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `pinned_drop` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: remove the extra argument
- |
-13 | __drop_inner();
- | ~~~~~~~~~~~~~~
diff --git a/tests/ui/pinned_drop/conditional-drop-impl.stderr b/tests/ui/pinned_drop/conditional-drop-impl.stderr
index 0587765..837b1db 100644
--- a/tests/ui/pinned_drop/conditional-drop-impl.stderr
+++ b/tests/ui/pinned_drop/conditional-drop-impl.stderr
@@ -16,12 +16,15 @@ error[E0277]: `T` cannot be unpinned
16 | #[pin_project(PinnedDrop)] //~ ERROR E0277
| ^^^^^^^^^^ the trait `Unpin` is not implemented for `T`
|
- = note: consider using `Box::pin`
-note: required because of the requirements on the impl of `PinnedDrop` for `PinnedDropImpl<T>`
+ = 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 for `PinnedDropImpl<T>` to implement `PinnedDrop`
--> tests/ui/pinned_drop/conditional-drop-impl.rs:23:16
|
23 | impl<T: Unpin> PinnedDrop for PinnedDropImpl<T> {
- | ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
+ | ----- ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
+ | |
+ | unsatisfied trait bound introduced here
help: consider restricting type parameter `T`
|
17 | struct PinnedDropImpl<T: std::marker::Unpin> {
diff --git a/tests/ui/pinned_drop/invalid.rs b/tests/ui/pinned_drop/invalid.rs
index fdadf8a..b2c2526 100644
--- a/tests/ui/pinned_drop/invalid.rs
+++ b/tests/ui/pinned_drop/invalid.rs
@@ -6,7 +6,7 @@ mod argument {
#[pin_project(PinnedDrop)]
struct UnexpectedArg1(());
- #[pinned_drop(foo)] //~ ERROR unexpected token
+ #[pinned_drop(foo)] //~ ERROR unexpected argument
impl PinnedDrop for UnexpectedArg1 {
fn drop(self: Pin<&mut Self>) {}
}
diff --git a/tests/ui/pinned_drop/invalid.stderr b/tests/ui/pinned_drop/invalid.stderr
index d509964..264def0 100644
--- a/tests/ui/pinned_drop/invalid.stderr
+++ b/tests/ui/pinned_drop/invalid.stderr
@@ -1,7 +1,7 @@
-error: unexpected token: `foo`
+error: unexpected argument: `foo`
--> tests/ui/pinned_drop/invalid.rs:9:19
|
-9 | #[pinned_drop(foo)] //~ ERROR unexpected token
+9 | #[pinned_drop(foo)] //~ ERROR unexpected argument
| ^^^
error: duplicate #[pinned_drop] attribute
diff --git a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr
index 2542254..a07ba99 100644
--- a/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr
+++ b/tests/ui/pinned_drop/pinned-drop-no-attr-arg.stderr
@@ -1,4 +1,4 @@
-error[E0119]: conflicting implementations of trait `_::_pin_project::__private::PinnedDrop` for type `S`
+error[E0119]: conflicting implementations of trait `PinnedDrop` for type `S`
--> tests/ui/pinned_drop/pinned-drop-no-attr-arg.rs:12:1
|
5 | #[pin_project]
diff --git a/tests/ui/pinned_drop/self.stderr b/tests/ui/pinned_drop/self.stderr
index a19d5a0..ad506a5 100644
--- a/tests/ui/pinned_drop/self.stderr
+++ b/tests/ui/pinned_drop/self.stderr
@@ -37,7 +37,7 @@ error[E0308]: mismatched types
--> tests/ui/pinned_drop/self.rs:39:25
|
39 | let _: () = self; //~ ERROR E0308
- | -- ^^^^ expected `()`, found struct `Pin`
+ | -- ^^^^ expected `()`, found `Pin<&mut S>`
| |
| expected due to this
|
@@ -48,15 +48,15 @@ error[E0308]: mismatched types
--> tests/ui/pinned_drop/self.rs:52:25
|
52 | let _: () = self; //~ ERROR E0308
- | -- ^^^^ expected `()`, found struct `Pin`
+ | -- ^^^^ expected `()`, found `Pin<&mut E>`
| |
| expected due to this
|
= note: expected unit type `()`
found struct `Pin<&mut E>`
-error[E0533]: expected unit struct, unit variant or constant, found struct variant `E::V`
+error[E0533]: expected value, found struct variant `E::V`
--> tests/ui/pinned_drop/self.rs:53:27
|
53 | let _: Self = Self::V; //~ ERROR E0533
- | ^^^^^^^
+ | ^^^^^^^ not a value
diff --git a/tests/ui/pinned_drop/unsafe-call.stderr b/tests/ui/pinned_drop/unsafe-call.stderr
index 9f7dd44..911a58e 100644
--- a/tests/ui/pinned_drop/unsafe-call.stderr
+++ b/tests/ui/pinned_drop/unsafe-call.stderr
@@ -1,6 +1,9 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> tests/ui/pinned_drop/unsafe-call.rs:14:9
|
+11 | #[pinned_drop]
+ | -------------- items do not inherit unsafety from separate enclosing items
+...
14 | self.project().f.get_unchecked_mut(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block [E0133]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
diff --git a/tests/ui/unsafe_unpin/conflict-unpin.stderr b/tests/ui/unsafe_unpin/conflict-unpin.stderr
index 0e89b03..cdf0d50 100644
--- a/tests/ui/unsafe_unpin/conflict-unpin.stderr
+++ b/tests/ui/unsafe_unpin/conflict-unpin.stderr
@@ -1,4 +1,4 @@
-error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_, _>`
+error[E0119]: conflicting implementations of trait `Unpin` for type `Foo<_, _>`
--> tests/ui/unsafe_unpin/conflict-unpin.rs:3:15
|
3 | #[pin_project(UnsafeUnpin)] //~ ERROR E0119
@@ -9,7 +9,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
|
= note: upstream crates may add a new impl of trait `_::_pin_project::UnsafeUnpin` for type `_::_pin_project::__private::Wrapper<'_, Foo<_, _>>` in future versions
-error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`
+error[E0119]: conflicting implementations of trait `Unpin` for type `Bar<_, _>`
--> tests/ui/unsafe_unpin/conflict-unpin.rs:12:15
|
12 | #[pin_project(UnsafeUnpin)] //~ ERROR E0119
@@ -20,7 +20,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type
|
= note: upstream crates may add a new impl of trait `_::_pin_project::UnsafeUnpin` for type `_::_pin_project::__private::Wrapper<'_, Bar<_, _>>` in future versions
-error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`
+error[E0119]: conflicting implementations of trait `Unpin` for type `Baz<_, _>`
--> tests/ui/unsafe_unpin/conflict-unpin.rs:21:15
|
21 | #[pin_project(UnsafeUnpin)] //~ ERROR E0119
diff --git a/tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr b/tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr
index 3412f2e..fcb9185 100644
--- a/tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr
+++ b/tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr
@@ -1,4 +1,4 @@
-error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`
+error[E0119]: conflicting implementations of trait `Unpin` for type `Struct<_>`
--> tests/ui/unstable-features/marker_trait_attr-feature-gate.rs:7:1
|
7 | #[pin_project] //~ ERROR E0119
diff --git a/tests/ui/unstable-features/marker_trait_attr.stderr b/tests/ui/unstable-features/marker_trait_attr.stderr
index 2b68c80..85949d5 100644
--- a/tests/ui/unstable-features/marker_trait_attr.stderr
+++ b/tests/ui/unstable-features/marker_trait_attr.stderr
@@ -1,4 +1,4 @@
-error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`
+error[E0119]: conflicting implementations of trait `Unpin` for type `Struct<_>`
--> tests/ui/unstable-features/marker_trait_attr.rs:13:1
|
13 | #[pin_project] //~ ERROR E0119
diff --git a/tests/ui/unstable-features/negative_impls.stderr b/tests/ui/unstable-features/negative_impls.stderr
index 0d99e2b..145716d 100644
--- a/tests/ui/unstable-features/negative_impls.stderr
+++ b/tests/ui/unstable-features/negative_impls.stderr
@@ -4,11 +4,6 @@ error: cross-crate traits with a default impl, like `Unpin`, should not be speci
17 | impl Unpin for Foo<MyPhantomPinned, ()> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
-note: the lint level is defined here
- --> tests/ui/unstable-features/negative_impls.rs:2:9
- |
-2 | #![deny(suspicious_auto_trait_impls)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this will change its meaning in a future release!
= note: for more information, see issue #93367 <https://github.com/rust-lang/rust/issues/93367>
= note: `MyPhantomPinned` is not a generic parameter
@@ -17,3 +12,8 @@ note: try using the same sequence of generic parameters as the struct definition
|
8 | struct Foo<Pinned, Unpinned> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: the lint level is defined here
+ --> tests/ui/unstable-features/negative_impls.rs:2:9
+ |
+2 | #![deny(suspicious_auto_trait_impls)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.stderr b/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.stderr
index 918d804..0783be0 100644
--- a/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.stderr
+++ b/tests/ui/unstable-features/overlapping_marker_traits-feature-gate.stderr
@@ -1,4 +1,4 @@
-error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`
+error[E0119]: conflicting implementations of trait `Unpin` for type `Struct<_>`
--> tests/ui/unstable-features/overlapping_marker_traits-feature-gate.rs:7:1
|
7 | #[pin_project] //~ ERROR E0119
diff --git a/tests/ui/unstable-features/overlapping_marker_traits.stderr b/tests/ui/unstable-features/overlapping_marker_traits.stderr
index 3e8411d..1c8e7e7 100644
--- a/tests/ui/unstable-features/overlapping_marker_traits.stderr
+++ b/tests/ui/unstable-features/overlapping_marker_traits.stderr
@@ -6,7 +6,7 @@ error[E0557]: feature has been removed
|
= note: removed in favor of `#![feature(marker_trait_attr)]`
-error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Struct<_>`
+error[E0119]: conflicting implementations of trait `Unpin` for type `Struct<_>`
--> tests/ui/unstable-features/overlapping_marker_traits.rs:17:1
|
17 | #[pin_project]
diff --git a/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr b/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr
index 2e31658..ccf1ae8 100644
--- a/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr
+++ b/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr
@@ -4,7 +4,8 @@ error[E0277]: `PhantomPinned` cannot be unpinned
8 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277
| ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `PhantomPinned`
|
- = 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
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@@ -14,12 +15,13 @@ error[E0277]: `PhantomPinned` cannot be unpinned
16 | impl Unpin for B where Wrapper<PhantomPinned>: Unpin {} //~ ERROR E0277
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `PhantomPinned`
|
- = note: consider using `Box::pin`
-note: required because of the requirements on the impl of `Unpin` for `phantom_pinned::Wrapper<PhantomPinned>`
+ = 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 for `phantom_pinned::Wrapper<PhantomPinned>` to implement `Unpin`
--> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:12:13
|
12 | impl<T> Unpin for Wrapper<T> where T: Unpin {}
- | ^^^^^ ^^^^^^^^^^
+ | ^^^^^ ^^^^^^^^^^ ----- unsatisfied trait bound introduced here
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@@ -29,7 +31,8 @@ error[E0277]: `PhantomPinned` cannot be unpinned
34 | impl Unpin for A where Inner: Unpin {} //~ ERROR E0277
| ^^^^^^^^^^^^ within `Inner`, the trait `Unpin` is not implemented for `PhantomPinned`
|
- = 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 `Inner`
--> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:30:12
|
@@ -44,16 +47,17 @@ error[E0277]: `PhantomPinned` cannot be unpinned
42 | impl Unpin for B where Wrapper<Inner>: Unpin {} //~ ERROR E0277
| ^^^^^^^^^^^^^^^^^^^^^ within `Inner`, the trait `Unpin` is not implemented for `PhantomPinned`
|
- = note: consider using `Box::pin`
+ = note: 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 `Inner`
--> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:30:12
|
30 | struct Inner(PhantomPinned);
| ^^^^^
-note: required because of the requirements on the impl of `Unpin` for `inner::Wrapper<Inner>`
+note: required for `inner::Wrapper<Inner>` to implement `Unpin`
--> tests/ui/unstable-features/trivial_bounds-feature-gate.rs:38:13
|
38 | impl<T> Unpin for Wrapper<T> where T: Unpin {}
- | ^^^^^ ^^^^^^^^^^
+ | ^^^^^ ^^^^^^^^^^ ----- unsatisfied trait bound introduced here
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
diff --git a/tests/ui/unstable-features/trivial_bounds.rs b/tests/ui/unstable-features/trivial_bounds.rs
index 41f885d..d98ef60 100644
--- a/tests/ui/unstable-features/trivial_bounds.rs
+++ b/tests/ui/unstable-features/trivial_bounds.rs
@@ -4,6 +4,7 @@
// Tracking issue: https://github.com/rust-lang/rust/issues/48214
#![feature(trivial_bounds)]
#![deny(trivial_bounds)]
+#![allow(dead_code)]
use std::marker::{PhantomData, PhantomPinned};
diff --git a/tests/ui/unstable-features/trivial_bounds.stderr b/tests/ui/unstable-features/trivial_bounds.stderr
index 23f45c7..ab07a10 100644
--- a/tests/ui/unstable-features/trivial_bounds.stderr
+++ b/tests/ui/unstable-features/trivial_bounds.stderr
@@ -1,7 +1,7 @@
error: trait bound PhantomPinned: Unpin does not depend on any type or lifetime parameters
- --> tests/ui/unstable-features/trivial_bounds.rs:15:43
+ --> tests/ui/unstable-features/trivial_bounds.rs:16:43
|
-15 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters
+16 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters
| ^^^^^
|
note: the lint level is defined here
@@ -11,13 +11,13 @@ note: the lint level is defined here
| ^^^^^^^^^^^^^^
error: trait bound Inner: Unpin does not depend on any type or lifetime parameters
- --> tests/ui/unstable-features/trivial_bounds.rs:19:35
+ --> tests/ui/unstable-features/trivial_bounds.rs:20:35
|
-19 | impl Unpin for B where Inner: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters
+20 | impl Unpin for B where Inner: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters
| ^^^^^
error: trait bound Wrapper<Inner>: Unpin does not depend on any type or lifetime parameters
- --> tests/ui/unstable-features/trivial_bounds.rs:27:44
+ --> tests/ui/unstable-features/trivial_bounds.rs:28:44
|
-27 | impl Unpin for C where Wrapper<Inner>: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters
+28 | impl Unpin for C where Wrapper<Inner>: Unpin {} //~ ERROR Unpin does not depend on any type or lifetime parameters
| ^^^^^
diff --git a/tests/unsafe_unpin.rs b/tests/unsafe_unpin.rs
index 8b6411c..72f40f9 100644
--- a/tests/unsafe_unpin.rs
+++ b/tests/unsafe_unpin.rs
@@ -41,10 +41,10 @@ assert_not_unpin!(OverlappingLifetimeNames<'_, PhantomPinned, PhantomPinned>);
#[test]
fn trivial_bounds() {
#[pin_project(UnsafeUnpin)]
- pub struct NotImplementUnsafUnpin {
+ pub struct NotImplementUnsafeUnpin {
#[pin]
f: PhantomPinned,
}
- assert_not_unpin!(NotImplementUnsafUnpin);
+ assert_not_unpin!(NotImplementUnsafeUnpin);
}