forked from google/zerocopy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[derive] Disable prelude when testing; fix bugs (google#886)
This has the effect of ensuring that derive-emitted code will fail to compile if it spuriously relies on certain identifiers being in scope - namely, identifiers which are part of the prelude. Disabling the prelude surfaced a few bugs which are also fixed in this commit. Makes progress on google#11
- Loading branch information
1 parent
ae25fba
commit 38310a4
Showing
89 changed files
with
1,206 additions
and
1,159 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
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,12 +1,12 @@ | ||
error[E0277]: the trait bound `NotZerocopy<u32>: FromBytes` is not satisfied | ||
--> tests/ui-msrv/include_value_not_from_bytes.rs:13:42 | ||
error[E0277]: the trait bound `NotZerocopy<u32>: zerocopy::FromBytes` is not satisfied | ||
--> tests/ui-msrv/include_value_not_from_bytes.rs:15:42 | ||
| | ||
13 | const NOT_FROM_BYTES: NotZerocopy<u32> = include_value!("../../testdata/include_value/data"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy<u32>` | ||
15 | const NOT_FROM_BYTES: NotZerocopy<u32> = include_value!("../../testdata/include_value/data"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy<u32>` | ||
| | ||
note: required by `AssertIsFromBytes` | ||
--> tests/ui-msrv/include_value_not_from_bytes.rs:13:42 | ||
--> tests/ui-msrv/include_value_not_from_bytes.rs:15:42 | ||
| | ||
13 | const NOT_FROM_BYTES: NotZerocopy<u32> = include_value!("../../testdata/include_value/data"); | ||
15 | const NOT_FROM_BYTES: NotZerocopy<u32> = include_value!("../../testdata/include_value/data"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: this error originates in the macro `$crate::transmute` (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,12 +1,12 @@ | ||
error[E0277]: the trait bound `NotZerocopy: FromBytes` is not satisfied | ||
--> tests/ui-msrv/transmute-dst-not-frombytes.rs:18:41 | ||
error[E0277]: the trait bound `NotZerocopy: zerocopy::FromBytes` is not satisfied | ||
--> tests/ui-msrv/transmute-dst-not-frombytes.rs:19:41 | ||
| | ||
18 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `NotZerocopy` | ||
19 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^ the trait `zerocopy::FromBytes` is not implemented for `NotZerocopy` | ||
| | ||
note: required by `AssertIsFromBytes` | ||
--> tests/ui-msrv/transmute-dst-not-frombytes.rs:18:41 | ||
--> tests/ui-msrv/transmute-dst-not-frombytes.rs:19:41 | ||
| | ||
18 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); | ||
19 | const DST_NOT_FROM_BYTES: NotZerocopy = transmute!(AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
= note: this error originates in the macro `transmute` (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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
error[E0277]: the trait bound `Dst: FromBytes` is not satisfied | ||
--> tests/ui-msrv/transmute-ref-dst-not-frombytes.rs:22:34 | ||
error[E0277]: the trait bound `Dst: zerocopy::FromBytes` is not satisfied | ||
--> tests/ui-msrv/transmute-ref-dst-not-frombytes.rs:23:34 | ||
| | ||
22 | const DST_NOT_FROM_BYTES: &Dst = transmute_ref!(&AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromBytes` is not implemented for `Dst` | ||
23 | const DST_NOT_FROM_BYTES: &Dst = transmute_ref!(&AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy::FromBytes` is not implemented for `Dst` | ||
| | ||
note: required by `AssertDstIsFromBytes` | ||
--> tests/ui-msrv/transmute-ref-dst-not-frombytes.rs:22:34 | ||
--> tests/ui-msrv/transmute-ref-dst-not-frombytes.rs:23:34 | ||
| | ||
22 | const DST_NOT_FROM_BYTES: &Dst = transmute_ref!(&AU16(0)); | ||
23 | const DST_NOT_FROM_BYTES: &Dst = transmute_ref!(&AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: this error originates in the macro `transmute_ref` (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,12 +1,12 @@ | ||
error[E0277]: the trait bound `Dst: NoCell` is not satisfied | ||
--> tests/ui-msrv/transmute-ref-dst-not-nocell.rs:22:31 | ||
error[E0277]: the trait bound `Dst: zerocopy::NoCell` is not satisfied | ||
--> tests/ui-msrv/transmute-ref-dst-not-nocell.rs:23:31 | ||
| | ||
22 | const DST_NOT_NO_CELL: &Dst = transmute_ref!(&AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NoCell` is not implemented for `Dst` | ||
23 | const DST_NOT_NO_CELL: &Dst = transmute_ref!(&AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy::NoCell` is not implemented for `Dst` | ||
| | ||
note: required by `AssertDstIsNoCell` | ||
--> tests/ui-msrv/transmute-ref-dst-not-nocell.rs:22:31 | ||
--> tests/ui-msrv/transmute-ref-dst-not-nocell.rs:23:31 | ||
| | ||
22 | const DST_NOT_NO_CELL: &Dst = transmute_ref!(&AU16(0)); | ||
23 | const DST_NOT_NO_CELL: &Dst = transmute_ref!(&AU16(0)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: this error originates in the macro `transmute_ref` (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,25 +1,25 @@ | ||
error[E0277]: the trait bound `Src: IntoBytes` is not satisfied | ||
--> tests/ui-msrv/transmute-ref-src-not-intobytes.rs:22:33 | ||
error[E0277]: the trait bound `Src: AsBytes` is not satisfied | ||
--> tests/ui-msrv/transmute-ref-src-not-intobytes.rs:23:33 | ||
| | ||
22 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `Src` | ||
23 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `Src` | ||
| | ||
note: required by `AssertSrcIsIntoBytes` | ||
--> tests/ui-msrv/transmute-ref-src-not-intobytes.rs:22:33 | ||
--> tests/ui-msrv/transmute-ref-src-not-intobytes.rs:23:33 | ||
| | ||
22 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
23 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `Src: IntoBytes` is not satisfied | ||
--> tests/ui-msrv/transmute-ref-src-not-intobytes.rs:22:33 | ||
error[E0277]: the trait bound `Src: AsBytes` is not satisfied | ||
--> tests/ui-msrv/transmute-ref-src-not-intobytes.rs:23:33 | ||
| | ||
22 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `Src` | ||
23 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `Src` | ||
| | ||
note: required by a bound in `AssertSrcIsIntoBytes` | ||
--> tests/ui-msrv/transmute-ref-src-not-intobytes.rs:22:33 | ||
--> tests/ui-msrv/transmute-ref-src-not-intobytes.rs:23:33 | ||
| | ||
22 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
23 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsIntoBytes` | ||
= note: this error originates in the macro `transmute_ref` (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,25 +1,25 @@ | ||
error[E0277]: the trait bound `Src: NoCell` is not satisfied | ||
--> tests/ui-msrv/transmute-ref-src-not-nocell.rs:22:32 | ||
error[E0277]: the trait bound `Src: zerocopy::NoCell` is not satisfied | ||
--> tests/ui-msrv/transmute-ref-src-not-nocell.rs:23:32 | ||
| | ||
22 | const SRC_NOT_NO_CELL: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an implementor of trait `NoCell` | ||
23 | const SRC_NOT_NO_CELL: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an implementor of trait `zerocopy::NoCell` | ||
| | ||
note: required by `AssertSrcIsNoCell` | ||
--> tests/ui-msrv/transmute-ref-src-not-nocell.rs:22:32 | ||
--> tests/ui-msrv/transmute-ref-src-not-nocell.rs:23:32 | ||
| | ||
22 | const SRC_NOT_NO_CELL: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
23 | const SRC_NOT_NO_CELL: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: this error originates in the macro `transmute_ref` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `Src: NoCell` is not satisfied | ||
--> tests/ui-msrv/transmute-ref-src-not-nocell.rs:22:32 | ||
error[E0277]: the trait bound `Src: zerocopy::NoCell` is not satisfied | ||
--> tests/ui-msrv/transmute-ref-src-not-nocell.rs:23:32 | ||
| | ||
22 | const SRC_NOT_NO_CELL: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NoCell` is not implemented for `Src` | ||
23 | const SRC_NOT_NO_CELL: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy::NoCell` is not implemented for `Src` | ||
| | ||
note: required by a bound in `AssertSrcIsNoCell` | ||
--> tests/ui-msrv/transmute-ref-src-not-nocell.rs:22:32 | ||
--> tests/ui-msrv/transmute-ref-src-not-nocell.rs:23:32 | ||
| | ||
22 | const SRC_NOT_NO_CELL: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
23 | const SRC_NOT_NO_CELL: &AU16 = transmute_ref!(&Src(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsNoCell` | ||
= note: this error originates in the macro `transmute_ref` (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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
error[E0277]: the trait bound `NotZerocopy<AU16>: AsBytes` is not satisfied | ||
--> tests/ui-msrv/transmute-src-not-intobytes.rs:18:32 | ||
--> tests/ui-msrv/transmute-src-not-intobytes.rs:19:32 | ||
| | ||
18 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ||
19 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy<AU16>` | ||
| | ||
note: required by `AssertIsIntoBytes` | ||
--> tests/ui-msrv/transmute-src-not-intobytes.rs:18:32 | ||
--> tests/ui-msrv/transmute-src-not-intobytes.rs:19:32 | ||
| | ||
18 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ||
19 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `NotZerocopy<AU16>: AsBytes` is not satisfied | ||
--> tests/ui-msrv/transmute-src-not-intobytes.rs:18:32 | ||
--> tests/ui-msrv/transmute-src-not-intobytes.rs:19:32 | ||
| | ||
18 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ||
19 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy<AU16>` | ||
| | ||
note: required by a bound in `AssertIsIntoBytes` | ||
--> tests/ui-msrv/transmute-src-not-intobytes.rs:18:32 | ||
--> tests/ui-msrv/transmute-src-not-intobytes.rs:19:32 | ||
| | ||
18 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ||
19 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0))); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertIsIntoBytes` | ||
= note: this error originates in the macro `transmute` (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.