diff --git a/tests/ui/cfg/packed_sneaky-span-issue-1.rs b/tests/ui/cfg/packed_sneaky-span-issue-1.rs index 42f57b55..7e19952b 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-1.rs +++ b/tests/ui/cfg/packed_sneaky-span-issue-1.rs @@ -2,9 +2,8 @@ use auxiliary_macro::hidden_repr; use pin_project::pin_project; #[pin_project] -#[hidden_repr(packed)] +#[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types struct S { - //~^ ERROR may not be used on #[repr(packed)] types #[cfg(not(any()))] #[pin] f: u32, diff --git a/tests/ui/cfg/packed_sneaky-span-issue-1.stderr b/tests/ui/cfg/packed_sneaky-span-issue-1.stderr index abe3ecde..c98d3ee7 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-1.stderr +++ b/tests/ui/cfg/packed_sneaky-span-issue-1.stderr @@ -1,11 +1,5 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-span-issue-1.rs:6:1 - | -6 | / struct S { -7 | | //~^ ERROR may not be used on #[repr(packed)] types -8 | | #[cfg(not(any()))] -9 | | #[pin] -... | -13 | | f: u8, -14 | | } - | |_^ + --> $DIR/packed_sneaky-span-issue-1.rs:5:15 + | +5 | #[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types + | ^^^^^^ diff --git a/tests/ui/cfg/packed_sneaky-span-issue-2.rs b/tests/ui/cfg/packed_sneaky-span-issue-2.rs index 948d72c9..fcea76ba 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-2.rs +++ b/tests/ui/cfg/packed_sneaky-span-issue-2.rs @@ -2,9 +2,8 @@ use auxiliary_macro::hidden_repr; use pin_project::pin_project; #[pin_project] -#[hidden_repr(packed)] +#[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types struct S { - //~^ ERROR may not be used on #[repr(packed)] types #[cfg(any())] #[pin] f: u32, diff --git a/tests/ui/cfg/packed_sneaky-span-issue-2.stderr b/tests/ui/cfg/packed_sneaky-span-issue-2.stderr index a957cebf..25b9cdc9 100644 --- a/tests/ui/cfg/packed_sneaky-span-issue-2.stderr +++ b/tests/ui/cfg/packed_sneaky-span-issue-2.stderr @@ -1,11 +1,5 @@ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/packed_sneaky-span-issue-2.rs:6:1 - | -6 | / struct S { -7 | | //~^ ERROR may not be used on #[repr(packed)] types -8 | | #[cfg(any())] -9 | | #[pin] -... | -13 | | f: u8, -14 | | } - | |_^ + --> $DIR/packed_sneaky-span-issue-2.rs:5:15 + | +5 | #[hidden_repr(packed)] //~ ERROR may not be used on #[repr(packed)] types + | ^^^^^^ diff --git a/tests/ui/cfg/unsupported.stderr b/tests/ui/cfg/unsupported.stderr index b3bd1aef..7ad20d18 100644 --- a/tests/ui/cfg/unsupported.stderr +++ b/tests/ui/cfg/unsupported.stderr @@ -1,7 +1,8 @@ error: #[pin_project] attribute may not be used on structs with zero fields - --> $DIR/unsupported.rs:4:1 + --> $DIR/unsupported.rs:4:10 | -4 | / struct S { +4 | struct S { + | __________^ 5 | | //~^ ERROR may not be used on structs with zero fields 6 | | #[cfg(any())] 7 | | #[pin] diff --git a/tests/ui/not_unpin/conflict-unpin.stderr b/tests/ui/not_unpin/conflict-unpin.stderr index e90a574b..7b43b0ff 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 `std::marker::Unpin` for type `Foo<_, _>` --> $DIR/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 Unpin for Foo where T: Unpin {} | --------------------------------------------- first implementation here -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>`: +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Bar<_, _>` --> $DIR/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 Unpin for Bar {} | ------------------------------ first implementation here -error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>`: +error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Baz<_, _>` --> $DIR/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 ba80d5eb..43cd4f12 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 `pin_project::UnsafeUnpin` for type `Foo<_, _>` --> $DIR/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` fo | = note: this error originates in a derive macro (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 `pin_project::UnsafeUnpin` for type `Bar<_, _>` --> $DIR/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` fo | = note: this error originates in a derive macro (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 `pin_project::UnsafeUnpin` for type `Baz<_, _>` --> $DIR/impl-unsafe-unpin.rs:21:1 | 21 | #[pin_project(!Unpin)] //~ ERROR E0119 diff --git a/tests/ui/pin_project/add-pinned-field.stderr b/tests/ui/pin_project/add-pinned-field.stderr index a140694a..a391f3b3 100644 --- a/tests/ui/pin_project/add-pinned-field.stderr +++ b/tests/ui/pin_project/add-pinned-field.stderr @@ -7,7 +7,12 @@ error[E0277]: `PhantomPinned` cannot be unpinned 21 | is_unpin::(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^ within `__Foo<'_>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `__Foo<'_>` + = note: consider using `Box::pin` +note: required because it appears within the type `__Foo<'_>` + --> $DIR/add-pinned-field.rs:8:8 + | +8 | struct Foo { + | ^^^ = note: required because of the requirements on the impl of `Unpin` for `Foo` error[E0277]: `PhantomPinned` cannot be unpinned @@ -19,5 +24,10 @@ error[E0277]: `PhantomPinned` cannot be unpinned 22 | is_unpin::(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^ within `__Bar<'_>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `__Bar<'_>` + = note: consider using `Box::pin` +note: required because it appears within the type `__Bar<'_>` + --> $DIR/add-pinned-field.rs:15:8 + | +15 | struct Bar { + | ^^^ = note: required because of the requirements on the impl of `Unpin` for `Bar` diff --git a/tests/ui/pin_project/conflict-drop.stderr b/tests/ui/pin_project/conflict-drop.stderr index 4979c575..ae51456d 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<_, _>` --> $DIR/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 a derive macro (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 `std::ops::Drop` for type `Bar<_, _>` --> $DIR/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 0d6f439b..04011404 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 `std::marker::Unpin` for type `Foo<_, _>` --> $DIR/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 a derive macro (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 `std::marker::Unpin` for type `Bar<_, _>` --> $DIR/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 a derive macro (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 `std::marker::Unpin` for type `Baz<_, _>` --> $DIR/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 78545c2c..078baee4 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 `pin_project::UnsafeUnpin` for type `Foo<_, _>` --> $DIR/impl-unsafe-unpin.rs:3:1 | 3 | #[pin_project] //~ ERROR E0119 @@ -9,7 +9,7 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo | = note: this error originates in a derive macro (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 `pin_project::UnsafeUnpin` for type `Bar<_, _>` --> $DIR/impl-unsafe-unpin.rs:12:1 | 12 | #[pin_project] //~ ERROR E0119 @@ -20,7 +20,7 @@ error[E0119]: conflicting implementations of trait `pin_project::UnsafeUnpin` fo | = note: this error originates in a derive macro (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 `pin_project::UnsafeUnpin` for type `Baz<_, _>` --> $DIR/impl-unsafe-unpin.rs:21:1 | 21 | #[pin_project] //~ ERROR E0119 diff --git a/tests/ui/pin_project/overlapping_unpin_struct.stderr b/tests/ui/pin_project/overlapping_unpin_struct.stderr index b4a207a3..f49c7363 100644 --- a/tests/ui/pin_project/overlapping_unpin_struct.stderr +++ b/tests/ui/pin_project/overlapping_unpin_struct.stderr @@ -7,5 +7,10 @@ error[E0277]: `PhantomPinned` cannot be unpinned 18 | is_unpin::>(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `_::__S<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `_::__S<'_, PhantomPinned>` + = note: consider using `Box::pin` +note: required because it appears within the type `_::__S<'_, PhantomPinned>` + --> $DIR/overlapping_unpin_struct.rs:6:8 + | +6 | struct S { + | ^ = note: required because of the requirements on the impl of `Unpin` for `S` diff --git a/tests/ui/pin_project/packed-name-value.stderr b/tests/ui/pin_project/packed-name-value.stderr index a3e25711..4e22cc45 100644 --- a/tests/ui/pin_project/packed-name-value.stderr +++ b/tests/ui/pin_project/packed-name-value.stderr @@ -1,17 +1,52 @@ -error[E0552]: unrecognized representation hint +error: internal compiler error: unrecognized representation hint --> $DIR/packed-name-value.rs:3:8 | 3 | #[repr(packed = "")] //~ ERROR E0552 | ^^^^^^^^^^^ + | + = note: delayed at compiler/rustc_attr/src/builtin.rs:940:32 -error[E0552]: unrecognized representation hint +error: internal compiler error: unrecognized representation hint --> $DIR/packed-name-value.rs:9:8 | 9 | #[repr(packed = "")] //~ ERROR E0552 | ^^^^^^^^^^^ + | + = note: delayed at compiler/rustc_attr/src/builtin.rs:940:32 -error[E0552]: unrecognized representation hint +error: internal compiler error: unrecognized representation hint --> $DIR/packed-name-value.rs:14:8 | 14 | #[repr(packed = "")] //~ ERROR E0552 | ^^^^^^^^^^^ + | + = note: delayed at compiler/rustc_attr/src/builtin.rs:940:32 + +thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1018:13 +stack backtrace: + 0: _rust_begin_unwind + 1: std::panicking::begin_panic_fmt + 2: rustc_errors::HandlerInner::flush_delayed + 3: ::drop + 4: core::ptr::drop_in_place + 5: as core::ops::drop::Drop>::drop + 6: core::ptr::drop_in_place + 7: rustc_span::with_source_map + 8: rustc_interface::interface::create_compiler_and_run + 9: scoped_tls::ScopedKey::set +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. + +error: internal compiler error: unexpected panic + +note: the compiler unexpectedly panicked. this is a bug. + +note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md + +note: rustc 1.53.0-nightly (d0695c908 2021-04-12) running on x86_64-apple-darwin + +note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 --crate-type bin + +note: some of the compiler flags provided by cargo are hidden + +query stack during panic: +end of query stack diff --git a/tests/ui/pin_project/project_replace_unsized.stderr b/tests/ui/pin_project/project_replace_unsized.stderr index 26e416ac..75a26661 100644 --- a/tests/ui/pin_project/project_replace_unsized.stderr +++ b/tests/ui/pin_project/project_replace_unsized.stderr @@ -4,9 +4,13 @@ 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 { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` | - = note: required because it appears within the type `Struct` +note: required because it appears within the type `Struct` + --> $DIR/project_replace_unsized.rs:4:8 + | +4 | struct Struct { + | ^^^^^^ = help: unsized fn params are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size | @@ -19,9 +23,13 @@ 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 { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` + | +note: required because it appears within the type `Struct` + --> $DIR/project_replace_unsized.rs:4:8 | - = note: required because it appears within the type `Struct` +4 | struct Struct { + | ^^^^^^ = note: required by `UnsafeOverwriteGuard` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -29,7 +37,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/project_replace_unsized.rs:5:5 | 4 | struct Struct { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` 5 | f: T, | ^ doesn't have a size known at compile-time @@ -39,9 +47,13 @@ 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); - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` + | +note: required because it appears within the type `TupleStruct` + --> $DIR/project_replace_unsized.rs:9:8 | - = note: required because it appears within the type `TupleStruct` +9 | struct TupleStruct(T); + | ^^^^^^^^^^^ = help: unsized fn params are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size | @@ -54,9 +66,13 @@ 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); - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` | - = note: required because it appears within the type `TupleStruct` +note: required because it appears within the type `TupleStruct` + --> $DIR/project_replace_unsized.rs:9:8 + | +9 | struct TupleStruct(T); + | ^^^^^^^^^^^ = note: required by `UnsafeOverwriteGuard` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -64,7 +80,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/project_replace_unsized.rs:9:8 | 9 | struct TupleStruct(T); - | ^^^^^^^^^^^ - this type parameter needs to be `Sized` + | ^^^^^^^^^^^ - this type parameter needs to be `std::marker::Sized` | | | doesn't have a size known at compile-time | 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 f0f95731..f8cee983 100644 --- a/tests/ui/pin_project/project_replace_unsized_fn_params.stderr +++ b/tests/ui/pin_project/project_replace_unsized_fn_params.stderr @@ -4,10 +4,14 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 6 | struct Struct { | ^^^^^^^-^^^^^^^^^ | | | - | | this type parameter needs to be `Sized` + | | this type parameter needs to be `std::marker::Sized` | doesn't have a size known at compile-time | - = note: required because it appears within the type `__StructProjectionOwned` +note: required because it appears within the type `__StructProjectionOwned` + --> $DIR/project_replace_unsized_fn_params.rs:6:8 + | +6 | struct Struct { + | ^^^^^^ = note: the return type of a function must have a statically known size error[E0277]: the size for values of type `T` cannot be known at compilation time @@ -16,9 +20,13 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 5 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 6 | struct Struct { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` | - = note: required because it appears within the type `Struct` +note: required because it appears within the type `Struct` + --> $DIR/project_replace_unsized_fn_params.rs:6:8 + | +6 | struct Struct { + | ^^^^^^ = note: required by `UnsafeOverwriteGuard` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -26,7 +34,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/project_replace_unsized_fn_params.rs:7:5 | 6 | struct Struct { - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` 7 | f: T, | ^ doesn't have a size known at compile-time @@ -36,10 +44,14 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 11 | struct TupleStruct(T); | ^^^^^^^^^^^^-^^^^^^^^^ | | | - | | this type parameter needs to be `Sized` + | | this type parameter needs to be `std::marker::Sized` | doesn't have a size known at compile-time | - = note: required because it appears within the type `__TupleStructProjectionOwned` +note: required because it appears within the type `__TupleStructProjectionOwned` + --> $DIR/project_replace_unsized_fn_params.rs:11:8 + | +11 | struct TupleStruct(T); + | ^^^^^^^^^^^ = note: the return type of a function must have a statically known size error[E0277]: the size for values of type `T` cannot be known at compilation time @@ -48,8 +60,12 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim 10 | #[pin_project(project_replace)] //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time 11 | struct TupleStruct(T); - | - this type parameter needs to be `Sized` + | - this type parameter needs to be `std::marker::Sized` | - = note: required because it appears within the type `TupleStruct` +note: required because it appears within the type `TupleStruct` + --> $DIR/project_replace_unsized_fn_params.rs:11:8 + | +11 | struct TupleStruct(T); + | ^^^^^^^^^^^ = note: required by `UnsafeOverwriteGuard` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pin_project/remove-attr-from-struct.stderr b/tests/ui/pin_project/remove-attr-from-struct.stderr index 2b387ec2..82fada57 100644 --- a/tests/ui/pin_project/remove-attr-from-struct.stderr +++ b/tests/ui/pin_project/remove-attr-from-struct.stderr @@ -27,7 +27,12 @@ error[E0277]: `PhantomPinned` cannot be unpinned 35 | is_unpin::(); //~ ERROR E0277 | ^^^^^^^^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `A` + = note: consider using `Box::pin` +note: required because it appears within the type `A` + --> $DIR/remove-attr-from-struct.rs:10:8 + | +10 | struct A { + | ^ error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/remove-attr-from-struct.rs:36:5 @@ -38,7 +43,12 @@ error[E0277]: `PhantomPinned` cannot be unpinned 36 | is_unpin::(); //~ ERROR E0277 | ^^^^^^^^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `B` + = note: consider using `Box::pin` +note: required because it appears within the type `B` + --> $DIR/remove-attr-from-struct.rs:17:8 + | +17 | struct B { + | ^ error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/remove-attr-from-struct.rs:40:13 @@ -46,7 +56,12 @@ error[E0277]: `PhantomPinned` cannot be unpinned 40 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 | ^^^^^^^^ within `A`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `A` + = note: consider using `Box::pin` +note: required because it appears within the type `A` + --> $DIR/remove-attr-from-struct.rs:10:8 + | +10 | struct A { + | ^ = note: required by `Pin::

::new` error[E0599]: no method named `project` found for struct `Pin<&mut A>` in the current scope @@ -61,7 +76,12 @@ error[E0277]: `PhantomPinned` cannot be unpinned 43 | let _ = Pin::new(&mut x).project(); //~ ERROR E0277,E0599 | ^^^^^^^^ within `B`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `B` + = note: consider using `Box::pin` +note: required because it appears within the type `B` + --> $DIR/remove-attr-from-struct.rs:17:8 + | +17 | struct B { + | ^ = note: required by `Pin::

::new` error[E0599]: no method named `project` found for struct `Pin<&mut B>` in the current scope diff --git a/tests/ui/pin_project/safe_packed_borrows.rs b/tests/ui/pin_project/safe_packed_borrows.rs index f4d1aef3..8f4f4623 100644 --- a/tests/ui/pin_project/safe_packed_borrows.rs +++ b/tests/ui/pin_project/safe_packed_borrows.rs @@ -1,4 +1,5 @@ -#![forbid(safe_packed_borrows)] +#![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). @@ -18,8 +19,10 @@ struct PackedN { fn main() { let a = Packed { f: 1 }; - &a.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block + &a.f; + let _ = &a.f; let b = PackedN { f: 1 }; - &b.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block + &b.f; + let _ = &b.f; } diff --git a/tests/ui/pin_project/safe_packed_borrows.stderr b/tests/ui/pin_project/safe_packed_borrows.stderr index 9b77a4e0..4048eaaa 100644 --- a/tests/ui/pin_project/safe_packed_borrows.stderr +++ b/tests/ui/pin_project/safe_packed_borrows.stderr @@ -1,24 +1,11 @@ -error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) - --> $DIR/safe_packed_borrows.rs:21:5 - | -21 | &a.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block - | ^^^^ - | +error: lint `safe_packed_borrows` has been renamed to `unaligned_references` + --> $DIR/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 - --> $DIR/safe_packed_borrows.rs:1:11 - | -1 | #![forbid(safe_packed_borrows)] - | ^^^^^^^^^^^^^^^^^^^ - = 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 #46043 - = note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior - -error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) - --> $DIR/safe_packed_borrows.rs:24:5 - | -24 | &b.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block - | ^^^^ - | - = 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 #46043 - = note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior + --> $DIR/safe_packed_borrows.rs:1:9 + | +1 | #![deny(renamed_and_removed_lints)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/pin_project/unaligned_references.rs b/tests/ui/pin_project/unaligned_references.rs index d97b4b8e..23dd71d8 100644 --- a/tests/ui/pin_project/unaligned_references.rs +++ b/tests/ui/pin_project/unaligned_references.rs @@ -1,5 +1,4 @@ #![forbid(unaligned_references)] -#![allow(safe_packed_borrows)] // Refs: https://github.com/rust-lang/rust/issues/82523 @@ -16,7 +15,9 @@ struct PackedN { fn main() { let a = Packed { f: 1 }; &a.f; //~ ERROR reference to packed field is unaligned + let _ = &a.f; //~ ERROR reference to packed field is unaligned let b = PackedN { f: 1 }; &b.f; //~ ERROR reference to packed field is unaligned + let _ = &b.f; //~ ERROR reference to packed field is unaligned } diff --git a/tests/ui/pin_project/unaligned_references.stderr b/tests/ui/pin_project/unaligned_references.stderr index cc9d9c8a..17600de3 100644 --- a/tests/ui/pin_project/unaligned_references.stderr +++ b/tests/ui/pin_project/unaligned_references.stderr @@ -1,7 +1,7 @@ error: reference to packed field is unaligned - --> $DIR/unaligned_references.rs:18:5 + --> $DIR/unaligned_references.rs:17:5 | -18 | &a.f; //~ ERROR reference to packed field is unaligned +17 | &a.f; //~ ERROR reference to packed field is unaligned | ^^^^ | note: the lint level is defined here @@ -9,6 +9,18 @@ note: the lint level is defined here | 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 + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + +error: reference to packed field is unaligned + --> $DIR/unaligned_references.rs:18:13 + | +18 | let _ = &a.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 = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) error: reference to packed field is unaligned @@ -17,4 +29,16 @@ error: reference to packed field is unaligned 21 | &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 + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + +error: reference to packed field is unaligned + --> $DIR/unaligned_references.rs:22:13 + | +22 | 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 = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) diff --git a/tests/ui/pinned_drop/conditional-drop-impl.stderr b/tests/ui/pinned_drop/conditional-drop-impl.stderr index 31203f03..8ab22945 100644 --- a/tests/ui/pinned_drop/conditional-drop-impl.stderr +++ b/tests/ui/pinned_drop/conditional-drop-impl.stderr @@ -18,9 +18,14 @@ error[E0277]: `T` cannot be unpinned 16 | #[pin_project(PinnedDrop)] //~ ERROR E0277 | ^^^^^^^^^^ the trait `Unpin` is not implemented for `T` | - = note: required because of the requirements on the impl of `PinnedDrop` for `PinnedDropImpl` + = note: consider using `Box::pin` +note: required because of the requirements on the impl of `PinnedDrop` for `PinnedDropImpl` + --> $DIR/conditional-drop-impl.rs:23:16 + | +23 | impl PinnedDrop for PinnedDropImpl { + | ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ = note: required by `pin_project::__private::PinnedDrop::drop` help: consider restricting type parameter `T` | -17 | struct PinnedDropImpl { - | ^^^^^^^ +17 | struct PinnedDropImpl { + | ^^^^^^^^^^^^^^^^^^^^ 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 304ed983..9f32149a 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 `pin_project::__private::PinnedDrop` for type `S` --> $DIR/pinned-drop-no-attr-arg.rs:12:1 | 5 | #[pin_project] diff --git a/tests/ui/unsafe_unpin/conflict-unpin.stderr b/tests/ui/unsafe_unpin/conflict-unpin.stderr index 916c3f22..078ac71a 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 `std::marker::Unpin` for type `Foo<_, _>` --> $DIR/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 `std::marker::Unpin` for type `Bar<_, _>` --> $DIR/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 `std::marker::Unpin` for type `Baz<_, _>` --> $DIR/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 44ee694b..44322ec3 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 `std::marker::Unpin` for type `Struct<_>` --> $DIR/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 8b053490..8893fb2b 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 `std::marker::Unpin` for type `Struct<_>` --> $DIR/marker_trait_attr.rs:13:1 | 13 | #[pin_project] //~ ERROR E0119 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 cc7d0878..64a05968 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 `std::marker::Unpin` for type `Struct<_>` --> $DIR/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 f877f4dd..ffa50c77 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 `std::marker::Unpin` for type `Struct<_>` --> $DIR/overlapping_marker_traits.rs:17:1 | 17 | #[pin_project] diff --git a/tests/ui/unstable-features/trivial_bounds-bug.stderr b/tests/ui/unstable-features/trivial_bounds-bug.stderr index fff09f93..f2407d05 100644 --- a/tests/ui/unstable-features/trivial_bounds-bug.stderr +++ b/tests/ui/unstable-features/trivial_bounds-bug.stderr @@ -3,3 +3,5 @@ error[E0277]: `PhantomPinned` cannot be unpinned | 13 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 | ^^^^^ the trait `Unpin` is not implemented for `PhantomPinned` + | + = note: consider using `Box::pin` diff --git a/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr b/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr index dd151b05..fa810832 100644 --- a/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr +++ b/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr @@ -4,6 +4,7 @@ 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` = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -12,6 +13,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` error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/trivial_bounds-feature-gate.rs:16:5 @@ -19,6 +22,7 @@ error[E0277]: `PhantomPinned` cannot be unpinned 16 | impl Unpin for B where Wrapper: 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` = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -29,7 +33,12 @@ 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: required because it appears within the type `Inner` + = note: consider using `Box::pin` +note: required because it appears within the type `Inner` + --> $DIR/trivial_bounds-feature-gate.rs:30:12 + | +30 | struct Inner(PhantomPinned); + | ^^^^^ = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -39,7 +48,12 @@ error[E0277]: `PhantomPinned` cannot be unpinned 42 | impl Unpin for B where Wrapper: Unpin {} //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `Inner`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: required because it appears within the type `Inner` + = note: consider using `Box::pin` +note: required because it appears within the type `Inner` + --> $DIR/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` = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable