-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] Fix UI tests with missing imports
Previously, some UI tests had missing imports which caused the corresponding `.stderr` files to be populated with unhelpful "cannot find ..." messages. This is another point in favor of #187 (switching to the `ui-test` crate), which presumably would have made it much less likely for this to slip under the radar.
- Loading branch information
Showing
14 changed files
with
263 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
error[E0405]: cannot find trait `FromBytes` in this scope | ||
--> tests/ui-msrv/transmute-mut-src-generic.rs:15:31 | ||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types | ||
--> tests/ui-msrv/transmute-mut-src-generic.rs:17:5 | ||
| | ||
15 | fn transmute_mut<T: AsBytes + FromBytes + NoCell>(t: &mut T) -> &mut u8 { | ||
| ^^^^^^^^^ not found in this scope | ||
17 | transmute_mut!(t) | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
help: consider importing this trait | ||
= note: source type: `T` (this type does not have a fixed size) | ||
= note: target type: `u8` (8 bits) | ||
= note: this error originates in the macro `$crate::assert_size_eq` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types | ||
--> tests/ui-msrv/transmute-mut-src-generic.rs:17:5 | ||
| | ||
11 | use zerocopy::FromBytes; | ||
17 | transmute_mut!(t) | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: source type: `AlignOf<T>` (size can vary because of T) | ||
= note: target type: `MaxAlignsOf<T, u8>` (size can vary because of T) | ||
= note: this error originates in the macro `$crate::assert_align_gt_eq` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
error[E0405]: cannot find trait `FromBytes` in this scope | ||
--> tests/ui-nightly/transmute-mut-src-generic.rs:15:31 | ||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types | ||
--> tests/ui-nightly/transmute-mut-src-generic.rs:17:5 | ||
| | ||
15 | fn transmute_mut<T: AsBytes + FromBytes + NoCell>(t: &mut T) -> &mut u8 { | ||
| ^^^^^^^^^ not found in this scope | ||
17 | transmute_mut!(t) | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
help: consider importing this trait | ||
= note: source type: `T` (this type does not have a fixed size) | ||
= note: target type: `u8` (8 bits) | ||
= note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types | ||
--> tests/ui-nightly/transmute-mut-src-generic.rs:17:5 | ||
| | ||
11 + use zerocopy::FromBytes; | ||
17 | transmute_mut!(t) | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: source type: `AlignOf<T>` (size can vary because of T) | ||
= note: target type: `MaxAlignsOf<T, u8>` (size can vary because of T) | ||
= note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
error[E0405]: cannot find trait `FromBytes` in this scope | ||
--> tests/ui-stable/transmute-mut-src-generic.rs:15:31 | ||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types | ||
--> tests/ui-stable/transmute-mut-src-generic.rs:17:5 | ||
| | ||
15 | fn transmute_mut<T: AsBytes + FromBytes + NoCell>(t: &mut T) -> &mut u8 { | ||
| ^^^^^^^^^ not found in this scope | ||
17 | transmute_mut!(t) | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
help: consider importing this trait | ||
= note: source type: `T` (this type does not have a fixed size) | ||
= note: target type: `u8` (8 bits) | ||
= note: this error originates in the macro `$crate::assert_size_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types | ||
--> tests/ui-stable/transmute-mut-src-generic.rs:17:5 | ||
| | ||
11 + use zerocopy::FromBytes; | ||
17 | transmute_mut!(t) | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: source type: `AlignOf<T>` (size can vary because of T) | ||
= note: target type: `MaxAlignsOf<T, u8>` (size can vary because of T) | ||
= note: this error originates in the macro `$crate::assert_align_gt_eq` which comes from the expansion of the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info) |
113 changes: 57 additions & 56 deletions
113
zerocopy-derive/tests/ui-msrv/derive_transparent.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,89 @@ | ||
<<<<<<< HEAD | ||
error[E0277]: the trait bound `NotZerocopy: FromZeroes` is not satisfied | ||
error[E0277]: the trait bound `NotZerocopy: TryFromBytes` is not satisfied | ||
--> tests/ui-msrv/derive_transparent.rs:37:1 | ||
| | ||
37 | assert_impl_all!(TransparentStruct<NotZerocopy>: FromZeros); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromZeroes` is not implemented for `NotZerocopy` | ||
37 | assert_impl_all!(TransparentStruct<NotZerocopy>: TryFromBytes); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotZerocopy` | ||
| | ||
note: required because of the requirements on the impl of `FromZeroes` for `TransparentStruct<NotZerocopy>` | ||
note: required because of the requirements on the impl of `TryFromBytes` for `TransparentStruct<NotZerocopy>` | ||
--> tests/ui-msrv/derive_transparent.rs:27:19 | ||
| | ||
27 | #[derive(AsBytes, FromZeros, FromBytes, Unaligned)] | ||
| ^^^^^^^^^ | ||
27 | #[derive(AsBytes, TryFromBytes, FromZeros, FromBytes, Unaligned)] | ||
| ^^^^^^^^^^^^ | ||
note: required by a bound in `_::{closure#0}::assert_impl_all` | ||
--> tests/ui-msrv/derive_transparent.rs:37:1 | ||
| | ||
37 | assert_impl_all!(TransparentStruct<NotZerocopy>: FromZeros); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` | ||
37 | assert_impl_all!(TransparentStruct<NotZerocopy>: TryFromBytes); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` | ||
= note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied | ||
error[E0277]: the trait bound `NotZerocopy: FromZeroes` is not satisfied | ||
--> tests/ui-msrv/derive_transparent.rs:38:1 | ||
======= | ||
error: cannot find derive macro `TryFromBytes` in this scope | ||
--> tests/ui-msrv/derive_transparent.rs:27:19 | ||
| | ||
27 | #[derive(AsBytes, TryFromBytes, FromZeroes, FromBytes, Unaligned)] | ||
| ^^^^^^^^^^^^ help: a derive macro with a similar name exists: `FromBytes` | ||
>>>>>>> [derive] Support `derive(TryFromBytes)` for structs | ||
| | ||
::: src/lib.rs | ||
38 | assert_impl_all!(TransparentStruct<NotZerocopy>: FromZeros); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromZeroes` is not implemented for `NotZerocopy` | ||
| | ||
<<<<<<< HEAD | ||
note: required because of the requirements on the impl of `FromBytes` for `TransparentStruct<NotZerocopy>` | ||
--> tests/ui-msrv/derive_transparent.rs:27:30 | ||
note: required because of the requirements on the impl of `FromZeroes` for `TransparentStruct<NotZerocopy>` | ||
--> tests/ui-msrv/derive_transparent.rs:27:33 | ||
| | ||
27 | #[derive(AsBytes, FromZeros, FromBytes, Unaligned)] | ||
| ^^^^^^^^^ | ||
27 | #[derive(AsBytes, TryFromBytes, FromZeros, FromBytes, Unaligned)] | ||
| ^^^^^^^^^ | ||
note: required by a bound in `_::{closure#0}::assert_impl_all` | ||
--> tests/ui-msrv/derive_transparent.rs:38:1 | ||
| | ||
38 | assert_impl_all!(TransparentStruct<NotZerocopy>: FromBytes); | ||
38 | assert_impl_all!(TransparentStruct<NotZerocopy>: FromZeros); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` | ||
= note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
======= | ||
| pub fn derive_from_bytes(ts: proc_macro::TokenStream) -> proc_macro::TokenStream { | ||
| -------------------------------------------------------------------------------- similarly named derive macro `FromBytes` defined here | ||
| | ||
= note: consider importing one of these items: | ||
zerocopy::TryFromBytes | ||
zerocopy_derive::TryFromBytes | ||
>>>>>>> [derive] Support `derive(TryFromBytes)` for structs | ||
|
||
error[E0405]: cannot find trait `TryFromBytes` in this scope | ||
--> tests/ui-msrv/derive_transparent.rs:37:50 | ||
error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied | ||
--> tests/ui-msrv/derive_transparent.rs:39:1 | ||
| | ||
37 | assert_impl_all!(TransparentStruct<NotZerocopy>: TryFromBytes); | ||
| ^^^^^^^^^^^^ | ||
39 | assert_impl_all!(TransparentStruct<NotZerocopy>: FromBytes); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` | ||
| | ||
<<<<<<< HEAD | ||
27 | #[derive(AsBytes, FromZeros, FromBytes, Unaligned)] | ||
| ^^^^^^^ | ||
note: required because of the requirements on the impl of `FromBytes` for `TransparentStruct<NotZerocopy>` | ||
--> tests/ui-msrv/derive_transparent.rs:27:44 | ||
| | ||
27 | #[derive(AsBytes, TryFromBytes, FromZeros, FromBytes, Unaligned)] | ||
| ^^^^^^^^^ | ||
note: required by a bound in `_::{closure#0}::assert_impl_all` | ||
--> tests/ui-msrv/derive_transparent.rs:39:1 | ||
======= | ||
::: $WORKSPACE/src/lib.rs | ||
>>>>>>> [derive] Support `derive(TryFromBytes)` for structs | ||
| | ||
| pub unsafe trait FromBytes: FromZeroes { | ||
| -------------------------------------- similarly named trait `FromBytes` defined here | ||
39 | assert_impl_all!(TransparentStruct<NotZerocopy>: FromBytes); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` | ||
= note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `NotZerocopy: AsBytes` is not satisfied | ||
--> tests/ui-msrv/derive_transparent.rs:40:1 | ||
| | ||
help: a trait with a similar name exists | ||
40 | assert_impl_all!(TransparentStruct<NotZerocopy>: AsBytes); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy` | ||
| | ||
<<<<<<< HEAD | ||
note: required because of the requirements on the impl of `Unaligned` for `TransparentStruct<NotZerocopy>` | ||
--> tests/ui-msrv/derive_transparent.rs:27:41 | ||
note: required because of the requirements on the impl of `AsBytes` for `TransparentStruct<NotZerocopy>` | ||
--> tests/ui-msrv/derive_transparent.rs:27:10 | ||
| | ||
27 | #[derive(AsBytes, FromZeros, FromBytes, Unaligned)] | ||
| ^^^^^^^^^ | ||
27 | #[derive(AsBytes, TryFromBytes, FromZeros, FromBytes, Unaligned)] | ||
| ^^^^^^^ | ||
note: required by a bound in `_::{closure#0}::assert_impl_all` | ||
--> tests/ui-msrv/derive_transparent.rs:40:1 | ||
======= | ||
37 | assert_impl_all!(TransparentStruct<NotZerocopy>: FromBytes); | ||
| ~~~~~~~~~ | ||
help: consider importing this trait | ||
| | ||
14 | use zerocopy::TryFromBytes; | ||
>>>>>>> [derive] Support `derive(TryFromBytes)` for structs | ||
40 | assert_impl_all!(TransparentStruct<NotZerocopy>: AsBytes); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` | ||
= note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `NotZerocopy: Unaligned` is not satisfied | ||
--> tests/ui-msrv/derive_transparent.rs:41:1 | ||
| | ||
41 | assert_impl_all!(TransparentStruct<NotZerocopy>: Unaligned); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unaligned` is not implemented for `NotZerocopy` | ||
| | ||
note: required because of the requirements on the impl of `Unaligned` for `TransparentStruct<NotZerocopy>` | ||
--> tests/ui-msrv/derive_transparent.rs:27:55 | ||
| | ||
27 | #[derive(AsBytes, TryFromBytes, FromZeros, FromBytes, Unaligned)] | ||
| ^^^^^^^^^ | ||
note: required by a bound in `_::{closure#0}::assert_impl_all` | ||
--> tests/ui-msrv/derive_transparent.rs:41:1 | ||
| | ||
41 | assert_impl_all!(TransparentStruct<NotZerocopy>: Unaligned); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::assert_impl_all` | ||
= note: this error originates in the macro `assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.