aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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
87 files changed, 422 insertions, 321 deletions
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);
}