Skip to content

Commit

Permalink
Disable re-exporting renamed traits in dev and CI (#961)
Browse files Browse the repository at this point in the history
See #960 for an explanation of why we do this.

Closes #960
  • Loading branch information
joshlf authored Feb 27, 2024
1 parent 5164edb commit afe0d40
Show file tree
Hide file tree
Showing 25 changed files with 137 additions and 131 deletions.
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1667,6 +1667,8 @@ pub unsafe trait FromZeros {
/// Deprecated: prefer [`FromZeros`] instead.
#[deprecated(since = "0.8.0", note = "`FromZeroes` was renamed to `FromZeros`")]
#[doc(hidden)]
// See #960 for why we do this.
#[cfg(not(__INTERNAL_USE_ONLY_DISABLE_DEPRECATED_TRAIT_ALIASES))]
pub use FromZeros as FromZeroes;

/// Analyzes whether a type is [`FromBytes`].
Expand Down Expand Up @@ -3042,6 +3044,8 @@ pub unsafe trait IntoBytes {
/// Deprecated: prefer [`IntoBytes`] instead.
#[deprecated(since = "0.8.0", note = "`AsBytes` was renamed to `IntoBytes`")]
#[doc(hidden)]
// See #960 for why we do this.
#[cfg(not(__INTERNAL_USE_ONLY_DISABLE_DEPRECATED_TRAIT_ALIASES))]
pub use IntoBytes as AsBytes;

/// Types with no alignment requirement.
Expand Down
12 changes: 6 additions & 6 deletions tests/ui-msrv/invalid-impls/invalid-impls.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ help: consider restricting type parameter `T`
26 | impl_or_verify!(T: zerocopy::TryFromBytes => TryFromBytes for Foo<T>);
| ++++++++++++++++++++++++

error[E0277]: the trait bound `T: FromZeroes` is not satisfied
error[E0277]: the trait bound `T: zerocopy::FromZeros` is not satisfied
--> tests/ui-msrv/invalid-impls/../../../src/macros.rs
|
| impl<$($tyvar $(: $(? $optbound +)* $($bound +)*)?),*> Subtrait for $ty {}
| ^^^^^^^^ the trait `FromZeroes` is not implemented for `T`
| ^^^^^^^^ the trait `zerocopy::FromZeros` is not implemented for `T`
|
::: tests/ui-msrv/invalid-impls/invalid-impls.rs:27:1
|
27 | impl_or_verify!(T => FromZeros for Foo<T>);
| ------------------------------------------- in this macro invocation
|
note: required because of the requirements on the impl of `FromZeroes` for `Foo<T>`
note: required because of the requirements on the impl of `zerocopy::FromZeros` for `Foo<T>`
--> tests/ui-msrv/invalid-impls/invalid-impls.rs:22:10
|
22 | #[derive(FromBytes, IntoBytes, Unaligned)]
Expand Down Expand Up @@ -94,18 +94,18 @@ help: consider restricting type parameter `T`
28 | impl_or_verify!(T: zerocopy::FromBytes => FromBytes for Foo<T>);
| +++++++++++++++++++++

error[E0277]: the trait bound `T: AsBytes` is not satisfied
error[E0277]: the trait bound `T: zerocopy::IntoBytes` is not satisfied
--> tests/ui-msrv/invalid-impls/../../../src/macros.rs
|
| impl<$($tyvar $(: $(? $optbound +)* $($bound +)*)?),*> Subtrait for $ty {}
| ^^^^^^^^ the trait `AsBytes` is not implemented for `T`
| ^^^^^^^^ the trait `zerocopy::IntoBytes` is not implemented for `T`
|
::: tests/ui-msrv/invalid-impls/invalid-impls.rs:29:1
|
29 | impl_or_verify!(T => IntoBytes for Foo<T>);
| ------------------------------------------- in this macro invocation
|
note: required because of the requirements on the impl of `AsBytes` for `Foo<T>`
note: required because of the requirements on the impl of `zerocopy::IntoBytes` for `Foo<T>`
--> tests/ui-msrv/invalid-impls/invalid-impls.rs:22:21
|
22 | #[derive(FromBytes, IntoBytes, Unaligned)]
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-ref-src-not-intobytes.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `Src: AsBytes` is not satisfied
error[E0277]: the trait bound `Src: zerocopy::IntoBytes` is not satisfied
--> tests/ui-msrv/transmute-ref-src-not-intobytes.rs:23:33
|
23 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `Src`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy::IntoBytes` is not implemented for `Src`
|
note: required by `AssertSrcIsIntoBytes`
--> tests/ui-msrv/transmute-ref-src-not-intobytes.rs:23:33
Expand All @@ -11,11 +11,11 @@ note: required by `AssertSrcIsIntoBytes`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 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: AsBytes` is not satisfied
error[E0277]: the trait bound `Src: zerocopy::IntoBytes` is not satisfied
--> tests/ui-msrv/transmute-ref-src-not-intobytes.rs:23:33
|
23 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `Src`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy::IntoBytes` is not implemented for `Src`
|
note: required by a bound in `AssertSrcIsIntoBytes`
--> tests/ui-msrv/transmute-ref-src-not-intobytes.rs:23:33
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>: zerocopy::IntoBytes` is not satisfied
--> tests/ui-msrv/transmute-src-not-intobytes.rs:19:32
|
19 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy<AU16>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy::IntoBytes` is not implemented for `NotZerocopy<AU16>`
|
note: required by `AssertIsIntoBytes`
--> tests/ui-msrv/transmute-src-not-intobytes.rs:19: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>: zerocopy::IntoBytes` is not satisfied
--> tests/ui-msrv/transmute-src-not-intobytes.rs:19:32
|
19 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy<AU16>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy::IntoBytes` is not implemented for `NotZerocopy<AU16>`
|
note: required by a bound in `AssertIsIntoBytes`
--> tests/ui-msrv/transmute-src-not-intobytes.rs:19:32
Expand Down
12 changes: 6 additions & 6 deletions tests/ui-nightly/invalid-impls/invalid-impls.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ help: consider restricting type parameter `T`
26 | impl_or_verify!(T: zerocopy::TryFromBytes => TryFromBytes for Foo<T>);
| ++++++++++++++++++++++++

error[E0277]: the trait bound `T: FromZeroes` is not satisfied
error[E0277]: the trait bound `T: zerocopy::FromZeros` is not satisfied
--> tests/ui-nightly/invalid-impls/invalid-impls.rs:27:36
|
27 | impl_or_verify!(T => FromZeros for Foo<T>);
| ^^^^^^ the trait `FromZeroes` is not implemented for `T`, which is required by `Foo<T>: FromZeroes`
| ^^^^^^ the trait `zerocopy::FromZeros` is not implemented for `T`, which is required by `Foo<T>: zerocopy::FromZeros`
|
note: required for `Foo<T>` to implement `FromZeroes`
note: required for `Foo<T>` to implement `zerocopy::FromZeros`
--> tests/ui-nightly/invalid-impls/invalid-impls.rs:22:10
|
22 | #[derive(FromBytes, IntoBytes, Unaligned)]
Expand Down Expand Up @@ -79,13 +79,13 @@ help: consider restricting type parameter `T`
28 | impl_or_verify!(T: zerocopy::FromBytes => FromBytes for Foo<T>);
| +++++++++++++++++++++

error[E0277]: the trait bound `T: AsBytes` is not satisfied
error[E0277]: the trait bound `T: zerocopy::IntoBytes` is not satisfied
--> tests/ui-nightly/invalid-impls/invalid-impls.rs:29:36
|
29 | impl_or_verify!(T => IntoBytes for Foo<T>);
| ^^^^^^ the trait `AsBytes` is not implemented for `T`, which is required by `Foo<T>: AsBytes`
| ^^^^^^ the trait `zerocopy::IntoBytes` is not implemented for `T`, which is required by `Foo<T>: zerocopy::IntoBytes`
|
note: required for `Foo<T>` to implement `AsBytes`
note: required for `Foo<T>` to implement `zerocopy::IntoBytes`
--> tests/ui-nightly/invalid-impls/invalid-impls.rs:22:21
|
22 | #[derive(FromBytes, IntoBytes, Unaligned)]
Expand Down
6 changes: 3 additions & 3 deletions tests/ui-nightly/transmute-mut-dst-not-intobytes.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error[E0277]: the trait bound `Dst: AsBytes` is not satisfied
error[E0277]: the trait bound `Dst: IntoBytes` is not satisfied
--> tests/ui-nightly/transmute-mut-dst-not-intobytes.rs:24:36
|
24 | const DST_NOT_AS_BYTES: &mut Dst = transmute_mut!(&mut Src);
| ^^^^^^^^^^^^^^^^^^^^^^^^
| |
| the trait `AsBytes` is not implemented for `Dst`
| the trait `IntoBytes` is not implemented for `Dst`
| required by a bound introduced by this call
|
= help: the following other types implement trait `AsBytes`:
= help: the following other types implement trait `IntoBytes`:
bool
char
isize
Expand Down
12 changes: 6 additions & 6 deletions tests/ui-nightly/transmute-mut-src-not-intobytes.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error[E0277]: the trait bound `Src: AsBytes` is not satisfied
error[E0277]: the trait bound `Src: IntoBytes` is not satisfied
--> tests/ui-nightly/transmute-mut-src-not-intobytes.rs:24:36
|
24 | const SRC_NOT_AS_BYTES: &mut Dst = transmute_mut!(&mut Src);
| ^^^^^^^^^^^^^^^^^^^^^^^^
| |
| the trait `AsBytes` is not implemented for `Src`
| the trait `IntoBytes` is not implemented for `Src`
| required by a bound introduced by this call
|
= help: the following other types implement trait `AsBytes`:
= help: the following other types implement trait `IntoBytes`:
bool
char
isize
Expand All @@ -24,13 +24,13 @@ note: required by a bound in `AssertSrcIsIntoBytes`
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `AssertSrcIsIntoBytes`
= note: this error originates in the macro `transmute_mut` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `Src: AsBytes` is not satisfied
error[E0277]: the trait bound `Src: IntoBytes` is not satisfied
--> tests/ui-nightly/transmute-mut-src-not-intobytes.rs:24:36
|
24 | const SRC_NOT_AS_BYTES: &mut Dst = transmute_mut!(&mut Src);
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `Src`
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoBytes` is not implemented for `Src`
|
= help: the following other types implement trait `AsBytes`:
= help: the following other types implement trait `IntoBytes`:
bool
char
isize
Expand Down
12 changes: 6 additions & 6 deletions tests/ui-nightly/transmute-ptr-to-usize.stderr
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
error[E0277]: the trait bound `*const usize: AsBytes` is not satisfied
error[E0277]: the trait bound `*const usize: IntoBytes` is not satisfied
--> tests/ui-nightly/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`
| required by a bound introduced by this call
|
= help: the trait `AsBytes` is implemented for `usize`
= help: the trait `IntoBytes` is implemented for `usize`
note: required by a bound in `AssertIsIntoBytes`
--> tests/ui-nightly/transmute-ptr-to-usize.rs:20:30
|
20 | const POINTER_VALUE: usize = transmute!(&0usize as *const usize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)

error[E0277]: the trait bound `*const usize: AsBytes` is not satisfied
error[E0277]: the trait bound `*const usize: IntoBytes` is not satisfied
--> tests/ui-nightly/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`
|
= help: the trait `AsBytes` is implemented for `usize`
= help: the trait `IntoBytes` is implemented for `usize`
note: required by a bound in `AssertIsIntoBytes`
--> tests/ui-nightly/transmute-ptr-to-usize.rs:20:30
|
Expand Down
12 changes: 6 additions & 6 deletions tests/ui-nightly/transmute-ref-src-not-intobytes.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error[E0277]: the trait bound `Src: AsBytes` is not satisfied
error[E0277]: the trait bound `Src: zerocopy::IntoBytes` is not satisfied
--> tests/ui-nightly/transmute-ref-src-not-intobytes.rs:23:33
|
23 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| the trait `AsBytes` is not implemented for `Src`
| the trait `zerocopy::IntoBytes` is not implemented for `Src`
| required by a bound introduced by this call
|
= help: the following other types implement trait `AsBytes`:
= help: the following other types implement trait `zerocopy::IntoBytes`:
bool
char
isize
Expand All @@ -24,13 +24,13 @@ note: required by a bound in `AssertSrcIsIntoBytes`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)

error[E0277]: the trait bound `Src: AsBytes` is not satisfied
error[E0277]: the trait bound `Src: zerocopy::IntoBytes` is not satisfied
--> tests/ui-nightly/transmute-ref-src-not-intobytes.rs:23:33
|
23 | const SRC_NOT_AS_BYTES: &AU16 = transmute_ref!(&Src(AU16(0)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `Src`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy::IntoBytes` is not implemented for `Src`
|
= help: the following other types implement trait `AsBytes`:
= help: the following other types implement trait `zerocopy::IntoBytes`:
bool
char
isize
Expand Down
12 changes: 6 additions & 6 deletions tests/ui-nightly/transmute-src-not-intobytes.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error[E0277]: the trait bound `NotZerocopy<AU16>: AsBytes` is not satisfied
error[E0277]: the trait bound `NotZerocopy<AU16>: zerocopy::IntoBytes` is not satisfied
--> tests/ui-nightly/transmute-src-not-intobytes.rs:19:32
|
19 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| the trait `AsBytes` is not implemented for `NotZerocopy<AU16>`
| the trait `zerocopy::IntoBytes` is not implemented for `NotZerocopy<AU16>`
| required by a bound introduced by this call
|
= help: the following other types implement trait `AsBytes`:
= help: the following other types implement trait `zerocopy::IntoBytes`:
bool
char
isize
Expand All @@ -24,13 +24,13 @@ note: required by a bound in `AssertIsIntoBytes`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)

error[E0277]: the trait bound `NotZerocopy<AU16>: AsBytes` is not satisfied
error[E0277]: the trait bound `NotZerocopy<AU16>: zerocopy::IntoBytes` is not satisfied
--> tests/ui-nightly/transmute-src-not-intobytes.rs:19:32
|
19 | const SRC_NOT_AS_BYTES: AU16 = transmute!(NotZerocopy(AU16(0)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsBytes` is not implemented for `NotZerocopy<AU16>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy::IntoBytes` is not implemented for `NotZerocopy<AU16>`
|
= help: the following other types implement trait `AsBytes`:
= help: the following other types implement trait `zerocopy::IntoBytes`:
bool
char
isize
Expand Down
12 changes: 6 additions & 6 deletions tests/ui-stable/invalid-impls/invalid-impls.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ help: consider restricting type parameter `T`
26 | impl_or_verify!(T: zerocopy::TryFromBytes => TryFromBytes for Foo<T>);
| ++++++++++++++++++++++++

error[E0277]: the trait bound `T: FromZeroes` is not satisfied
error[E0277]: the trait bound `T: zerocopy::FromZeros` is not satisfied
--> tests/ui-stable/invalid-impls/invalid-impls.rs:27:36
|
27 | impl_or_verify!(T => FromZeros for Foo<T>);
| ^^^^^^ the trait `FromZeroes` is not implemented for `T`
| ^^^^^^ the trait `zerocopy::FromZeros` is not implemented for `T`
|
note: required for `Foo<T>` to implement `FromZeroes`
note: required for `Foo<T>` to implement `zerocopy::FromZeros`
--> tests/ui-stable/invalid-impls/invalid-impls.rs:22:10
|
22 | #[derive(FromBytes, IntoBytes, Unaligned)]
Expand Down Expand Up @@ -79,13 +79,13 @@ help: consider restricting type parameter `T`
28 | impl_or_verify!(T: zerocopy::FromBytes => FromBytes for Foo<T>);
| +++++++++++++++++++++

error[E0277]: the trait bound `T: AsBytes` is not satisfied
error[E0277]: the trait bound `T: zerocopy::IntoBytes` is not satisfied
--> tests/ui-stable/invalid-impls/invalid-impls.rs:29:36
|
29 | impl_or_verify!(T => IntoBytes for Foo<T>);
| ^^^^^^ the trait `AsBytes` is not implemented for `T`
| ^^^^^^ the trait `zerocopy::IntoBytes` is not implemented for `T`
|
note: required for `Foo<T>` to implement `AsBytes`
note: required for `Foo<T>` to implement `zerocopy::IntoBytes`
--> tests/ui-stable/invalid-impls/invalid-impls.rs:22:21
|
22 | #[derive(FromBytes, IntoBytes, Unaligned)]
Expand Down
Loading

0 comments on commit afe0d40

Please sign in to comment.