Skip to content

Commit

Permalink
derive: generalize require_self_sized
Browse files Browse the repository at this point in the history
Generalize `require_self_sized` to require other `Trait`s.
  • Loading branch information
jswrenn committed Feb 15, 2024
1 parent b0edd98 commit 102feb2
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 67 deletions.
4 changes: 2 additions & 2 deletions tests/ui-msrv/transmute-mut-dst-not-intobytes.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `Dst: IntoBytes` is not satisfied
error[E0277]: the trait bound `Dst: AsBytes` is not satisfied
--> tests/ui-msrv/transmute-mut-dst-not-intobytes.rs:24:36
|
24 | const DST_NOT_AS_BYTES: &mut Dst = transmute_mut!(&mut Src);
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `Dst`
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `Dst`
|
note: required by `AssertDstIsIntoBytes`
--> tests/ui-msrv/transmute-mut-dst-not-intobytes.rs:24:36
Expand Down
8 changes: 4 additions & 4 deletions tests/ui-msrv/transmute-ptr-to-usize.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `*const usize: AsBytes` is not satisfied
error[E0277]: the trait bound `*const usize: IntoBytes` is not satisfied
--> tests/ui-msrv/transmute-ptr-to-usize.rs:20:30
|
20 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `*const usize`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `*const usize`
|
note: required by `AssertIsIntoBytes`
--> tests/ui-msrv/transmute-ptr-to-usize.rs:20:30
Expand All @@ -11,11 +11,11 @@ note: required by `AssertIsIntoBytes`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `transmute` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `*const usize: AsBytes` is not satisfied
error[E0277]: the trait bound `*const usize: IntoBytes` is not satisfied
--> tests/ui-msrv/transmute-ptr-to-usize.rs:20:30
|
20 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `*const usize`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `*const usize`
|
note: required by a bound in `AssertIsIntoBytes`
--> tests/ui-msrv/transmute-ptr-to-usize.rs:20:30
Expand Down
8 changes: 4 additions & 4 deletions tests/ui-msrv/transmute-src-not-intobytes.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `NotZerocopy<AU16>: AsBytes` is not satisfied
error[E0277]: the trait bound `NotZerocopy<AU16>: IntoBytes` is not satisfied
--> tests/ui-msrv/transmute-src-not-intobytes.rs:18:32
|
18 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy<AU16>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `NotZerocopy<AU16>`
|
note: required by `AssertIsIntoBytes`
--> tests/ui-msrv/transmute-src-not-intobytes.rs:18:32
Expand All @@ -11,11 +11,11 @@ note: required by `AssertIsIntoBytes`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 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
error[E0277]: the trait bound `NotZerocopy<AU16>: IntoBytes` is not satisfied
--> tests/ui-msrv/transmute-src-not-intobytes.rs:18:32
|
18 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy<AU16>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `NotZerocopy<AU16>`
|
note: required by a bound in `AssertIsIntoBytes`
--> tests/ui-msrv/transmute-src-not-intobytes.rs:18:32
Expand Down
Loading

0 comments on commit 102feb2

Please sign in to comment.