aboutsummaryrefslogtreecommitdiff
path: root/tests/ui/pin_project
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/pin_project')
-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
23 files changed, 256 insertions, 217 deletions
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)