feat: add display UI with splash screen, dashboard, and RSSI sparkline
Implement full SSD1306 OLED display support: - Splash screen on boot (1.5s) with project name, version, board - Dashboard showing radio state, config, counters, RSSI/SNR - RSSI history sparkline (64-sample ring buffer, 2px-wide bars) - DisplayOn/DisplayOff host commands routed via dedicated channel - Pure render functions against generic DrawTarget (no hardware coupling) - Display on/off control bypasses radio task entirely Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
17624 files changed
+4564928
-38
No files matched your search
@@ -0,0 +1,14 @@
|
||||
error: use of deprecated struct `OldHeader`: Do not use
|
||||
--> $DIR/absence_of_deprecated_warning.rs:32:12
|
||||
|
|
||||
32 | impl T for OldHeader {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/absence_of_deprecated_warning.rs:14:9
|
||||
|
|
||||
14 | #![deny(deprecated)]
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
error: use of deprecated struct `OldHeader`: Do not use
|
||||
--> $DIR/absence_of_deprecated_warning.rs:32:12
|
||||
|
|
||||
32 | impl T for OldHeader {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/absence_of_deprecated_warning.rs:14:9
|
||||
|
|
||||
14 | #![deny(deprecated)]
|
||||
| ^^^^^^^^^^
|
||||
|
||||
warning: struct `OldHeader` is never constructed
|
||||
--> $DIR/absence_of_deprecated_warning.rs:24:8
|
||||
|
|
||||
24 | struct OldHeader {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
|
||||
|
||||
warning: trait `T` is never used
|
||||
--> $DIR/absence_of_deprecated_warning.rs:29:7
|
||||
|
|
||||
29 | trait T {}
|
||||
| ^
|
||||
|
||||
error: aborting due to 1 previous error; 2 warnings emitted
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright 2024 The Fuchsia Authors
|
||||
//
|
||||
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
||||
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
||||
// This file may not be copied, modified, or distributed except according to
|
||||
// those terms.
|
||||
|
||||
//! See: https://github.com/google/zerocopy/issues/553
|
||||
//! zerocopy must still allow derives of deprecated types.
|
||||
//! This test has a hand-written impl of a deprecated type, and should result in a compilation
|
||||
//! error. If zerocopy does not tack an allow(deprecated) annotation onto its impls, then this
|
||||
//! test will fail because more than one compile error will be generated.
|
||||
#![deny(deprecated)]
|
||||
|
||||
extern crate zerocopy_renamed;
|
||||
|
||||
use zerocopy_renamed::IntoBytes;
|
||||
|
||||
#[deprecated = "Do not use"]
|
||||
#[derive(IntoBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct OldHeader {
|
||||
field_a: usize,
|
||||
collection: [u8; 8],
|
||||
}
|
||||
|
||||
trait T {}
|
||||
|
||||
// Intentionally trigger a deprecation error
|
||||
impl T for OldHeader {}
|
||||
//~[msrv, stable, nightly]^ ERROR: use of deprecated struct `OldHeader`: Do not use
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,28 @@
|
||||
error: use of deprecated struct `OldHeader`: Do not use
|
||||
--> $DIR/absence_of_deprecated_warning.rs:32:12
|
||||
|
|
||||
32 | impl T for OldHeader {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/absence_of_deprecated_warning.rs:14:9
|
||||
|
|
||||
14 | #![deny(deprecated)]
|
||||
| ^^^^^^^^^^
|
||||
|
||||
warning: struct `OldHeader` is never constructed
|
||||
--> $DIR/absence_of_deprecated_warning.rs:24:8
|
||||
|
|
||||
24 | struct OldHeader {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
|
||||
|
||||
warning: trait `T` is never used
|
||||
--> $DIR/absence_of_deprecated_warning.rs:29:7
|
||||
|
|
||||
29 | trait T {}
|
||||
| ^
|
||||
|
||||
error: aborting due to 1 previous error; 2 warnings emitted
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
error: `on_error` is experimental; pass '--cfg zerocopy_unstable_derive_on_error' to enable
|
||||
--> $DIR/on_error.rs:13:10
|
||||
|
|
||||
13 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `bool: FromBytes` is not satisfied
|
||||
--> $DIR/on_error.rs:13:10
|
||||
|
|
||||
13 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,35 @@
|
||||
error: `on_error` is experimental; pass '--cfg zerocopy_unstable_derive_on_error' to enable
|
||||
--> $DIR/on_error.rs:13:10
|
||||
|
|
||||
13 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `bool: FromBytes` is not satisfied
|
||||
--> $DIR/on_error.rs:13:10
|
||||
|
|
||||
13 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool`
|
||||
|
|
||||
= note: Consider adding `#[derive(FromBytes)]` to `bool`
|
||||
= help: the following other types implement trait `FromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 79 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2026 The Fuchsia Authors
|
||||
//
|
||||
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
||||
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
||||
// This file may not be copied, modified, or distributed except according to
|
||||
// those terms.
|
||||
|
||||
extern crate zerocopy_renamed;
|
||||
|
||||
use zerocopy_renamed::FromBytes;
|
||||
|
||||
#[derive(FromBytes)]
|
||||
//~^ ERROR: `on_error` is experimental; pass '--cfg zerocopy_unstable_derive_on_error' to enable
|
||||
//~| ERROR: the trait bound `bool: FromBytes` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[zerocopy(on_error = "skip")]
|
||||
#[repr(C)]
|
||||
struct Foo(bool);
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,31 @@
|
||||
error: `on_error` is experimental; pass '--cfg zerocopy_unstable_derive_on_error' to enable
|
||||
--> $DIR/on_error.rs:13:10
|
||||
|
|
||||
13 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `bool: FromBytes` is not satisfied
|
||||
--> $DIR/on_error.rs:13:10
|
||||
|
|
||||
13 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool`
|
||||
|
|
||||
= note: Consider adding `#[derive(FromBytes)]` to `bool`
|
||||
= help: the following other types implement trait `FromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 79 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,11 @@
|
||||
error: requires --cfg zerocopy_derive_union_into_bytes;
|
||||
please let us know you use this feature: https://github.com/google/zerocopy/discussions/1802
|
||||
--> $DIR/union_into_bytes_cfg.rs:20:10
|
||||
|
|
||||
20 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
error: requires --cfg zerocopy_derive_union_into_bytes;
|
||||
please let us know you use this feature: https://github.com/google/zerocopy/discussions/1802
|
||||
--> $DIR/union_into_bytes_cfg.rs:20:10
|
||||
|
|
||||
20 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// Copyright 2024 The Fuchsia Authors
|
||||
//
|
||||
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
||||
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
||||
// This file may not be copied, modified, or distributed except according to
|
||||
// those terms.
|
||||
|
||||
//! See: https://github.com/google/zerocopy/issues/553
|
||||
//! zerocopy must still allow derives of deprecated types.
|
||||
//! This test has a hand-written impl of a deprecated type, and should result in a compilation
|
||||
//! error. If zerocopy does not tack an allow(deprecated) annotation onto its impls, then this
|
||||
//! test will fail because more than one compile error will be generated.
|
||||
#![deny(deprecated)]
|
||||
|
||||
extern crate zerocopy_renamed;
|
||||
|
||||
use zerocopy_renamed::IntoBytes;
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~^ ERROR: requires --cfg zerocopy_derive_union_into_bytes
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
union Foo {
|
||||
a: u8,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,11 @@
|
||||
error: requires --cfg zerocopy_derive_union_into_bytes;
|
||||
please let us know you use this feature: https://github.com/google/zerocopy/discussions/1802
|
||||
--> $DIR/union_into_bytes_cfg.rs:20:10
|
||||
|
|
||||
20 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:35:1
|
||||
|
|
||||
35 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: TryFromBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy`
|
||||
|
|
||||
note: required because of the requirements on the impl of `zerocopy_renamed::TryFromBytes` for `TransparentStruct<NotZerocopy>`
|
||||
--> $DIR/derive_transparent.rs:24:21
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/derive_transparent.rs:35:1
|
||||
|
|
||||
35 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: TryFromBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
= note: this error originates in the macro `::static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:38:1
|
||||
|
|
||||
38 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromZeros);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromZeros` is not implemented for `NotZerocopy`
|
||||
|
|
||||
note: required because of the requirements on the impl of `FromZeros` for `TransparentStruct<NotZerocopy>`
|
||||
--> $DIR/derive_transparent.rs:24:21
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/derive_transparent.rs:38:1
|
||||
|
|
||||
38 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromZeros);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
= note: this error originates in the macro `::static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:41:1
|
||||
|
|
||||
41 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::FromBytes` is not implemented for `NotZerocopy`
|
||||
|
|
||||
note: required because of the requirements on the impl of `zerocopy_renamed::FromBytes` for `TransparentStruct<NotZerocopy>`
|
||||
--> $DIR/derive_transparent.rs:24:21
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/derive_transparent.rs:41:1
|
||||
|
|
||||
41 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
= note: this error originates in the macro `::static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::IntoBytes` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:44:1
|
||||
|
|
||||
44 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: IntoBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::IntoBytes` is not implemented for `NotZerocopy`
|
||||
|
|
||||
note: required because of the requirements on the impl of `zerocopy_renamed::IntoBytes` for `TransparentStruct<NotZerocopy>`
|
||||
--> $DIR/derive_transparent.rs:24:10
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/derive_transparent.rs:44:1
|
||||
|
|
||||
44 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: IntoBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
= note: this error originates in the macro `::static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:47:1
|
||||
|
|
||||
47 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: Unaligned);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `NotZerocopy`
|
||||
|
|
||||
note: required because of the requirements on the impl of `zerocopy_renamed::Unaligned` for `TransparentStruct<NotZerocopy>`
|
||||
--> $DIR/derive_transparent.rs:24:32
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/derive_transparent.rs:47:1
|
||||
|
|
||||
47 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: Unaligned);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
= note: this error originates in the macro `::static_assertions::assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,198 @@
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:35:23
|
||||
|
|
||||
35 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: TryFromBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::TryFromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 154 others
|
||||
note: required for `TransparentStruct<NotZerocopy>` to implement `zerocopy_renamed::TryFromBytes`
|
||||
--> $DIR/derive_transparent.rs:24:21
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/../include.rs:74:17
|
||||
|
|
||||
74 | ::static_assertions::assert_impl_all!($type: $($trait),+);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
|
||||
|
|
||||
::: $DIR/derive_transparent.rs:35:1
|
||||
|
|
||||
35 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: TryFromBytes);
|
||||
| ------------------------------------------------------------------- in this macro invocation
|
||||
= note: this error originates in the derive macro `FromBytes` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:38:23
|
||||
|
|
||||
38 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromZeros);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `FromZeros` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `FromZeros`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 142 others
|
||||
note: required for `TransparentStruct<NotZerocopy>` to implement `FromZeros`
|
||||
--> $DIR/derive_transparent.rs:24:21
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/../include.rs:74:17
|
||||
|
|
||||
74 | ::static_assertions::assert_impl_all!($type: $($trait),+);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
|
||||
|
|
||||
::: $DIR/derive_transparent.rs:38:1
|
||||
|
|
||||
38 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromZeros);
|
||||
| ---------------------------------------------------------------- in this macro invocation
|
||||
= note: this error originates in the derive macro `FromBytes` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:41:23
|
||||
|
|
||||
41 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::FromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::FromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 80 others
|
||||
note: required for `TransparentStruct<NotZerocopy>` to implement `zerocopy_renamed::FromBytes`
|
||||
--> $DIR/derive_transparent.rs:24:21
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/../include.rs:74:17
|
||||
|
|
||||
74 | ::static_assertions::assert_impl_all!($type: $($trait),+);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
|
||||
|
|
||||
::: $DIR/derive_transparent.rs:41:1
|
||||
|
|
||||
41 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromBytes);
|
||||
| ---------------------------------------------------------------- in this macro invocation
|
||||
= note: this error originates in the derive macro `FromBytes` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::IntoBytes` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:44:23
|
||||
|
|
||||
44 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: IntoBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::IntoBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(IntoBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::IntoBytes`:
|
||||
()
|
||||
AU16
|
||||
AtomicBool
|
||||
AtomicI16
|
||||
AtomicI32
|
||||
AtomicI64
|
||||
AtomicI8
|
||||
AtomicIsize
|
||||
and 69 others
|
||||
note: required for `TransparentStruct<NotZerocopy>` to implement `zerocopy_renamed::IntoBytes`
|
||||
--> $DIR/derive_transparent.rs:24:10
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/../include.rs:74:17
|
||||
|
|
||||
74 | ::static_assertions::assert_impl_all!($type: $($trait),+);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
|
||||
|
|
||||
::: $DIR/derive_transparent.rs:44:1
|
||||
|
|
||||
44 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: IntoBytes);
|
||||
| ---------------------------------------------------------------- in this macro invocation
|
||||
= note: this error originates in the derive macro `IntoBytes` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:47:23
|
||||
|
|
||||
47 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: Unaligned);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 27 others
|
||||
note: required for `TransparentStruct<NotZerocopy>` to implement `zerocopy_renamed::Unaligned`
|
||||
--> $DIR/derive_transparent.rs:24:32
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/../include.rs:74:17
|
||||
|
|
||||
74 | ::static_assertions::assert_impl_all!($type: $($trait),+);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
|
||||
|
|
||||
::: $DIR/derive_transparent.rs:47:1
|
||||
|
|
||||
47 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: Unaligned);
|
||||
| ---------------------------------------------------------------- in this macro invocation
|
||||
= note: this error originates in the derive macro `Unaligned` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,48 @@
|
||||
// Copyright 2019 The Fuchsia Authors
|
||||
//
|
||||
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
||||
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
||||
// This file may not be copied, modified, or distributed except according to
|
||||
// those terms.
|
||||
|
||||
extern crate zerocopy_renamed;
|
||||
|
||||
#[path = "../include.rs"]
|
||||
mod util;
|
||||
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use zerocopy_renamed::{FromBytes, FromZeros, IntoBytes, TryFromBytes, Unaligned};
|
||||
|
||||
use self::util::util::NotZerocopy;
|
||||
|
||||
fn main() {}
|
||||
|
||||
// Test generic transparent structs
|
||||
|
||||
#[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(transparent)]
|
||||
struct TransparentStruct<T> {
|
||||
inner: T,
|
||||
_phantom: PhantomData<()>,
|
||||
}
|
||||
|
||||
// It should be legal to derive these traits on a transparent struct, but it
|
||||
// must also ensure the traits are only implemented when the inner type
|
||||
// implements them.
|
||||
util_assert_impl_all!(TransparentStruct<NotZerocopy>: TryFromBytes);
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
|
||||
util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromZeros);
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `NotZerocopy: FromZeros` is not satisfied
|
||||
|
||||
util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromBytes);
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied
|
||||
|
||||
util_assert_impl_all!(TransparentStruct<NotZerocopy>: IntoBytes);
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::IntoBytes` is not satisfied
|
||||
|
||||
util_assert_impl_all!(TransparentStruct<NotZerocopy>: Unaligned);
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::Unaligned` is not satisfied
|
||||
@@ -0,0 +1,173 @@
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:35:23
|
||||
|
|
||||
35 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: TryFromBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::TryFromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 154 others
|
||||
note: required for `TransparentStruct<NotZerocopy>` to implement `zerocopy_renamed::TryFromBytes`
|
||||
--> $DIR/derive_transparent.rs:24:21
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/derive_transparent.rs:35:1
|
||||
|
|
||||
35 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: TryFromBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
|
||||
= note: this error originates in the derive macro `FromBytes` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:38:23
|
||||
|
|
||||
38 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromZeros);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `FromZeros` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `FromZeros`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 142 others
|
||||
note: required for `TransparentStruct<NotZerocopy>` to implement `FromZeros`
|
||||
--> $DIR/derive_transparent.rs:24:21
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/derive_transparent.rs:38:1
|
||||
|
|
||||
38 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromZeros);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
|
||||
= note: this error originates in the derive macro `FromBytes` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:41:23
|
||||
|
|
||||
41 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::FromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::FromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 80 others
|
||||
note: required for `TransparentStruct<NotZerocopy>` to implement `zerocopy_renamed::FromBytes`
|
||||
--> $DIR/derive_transparent.rs:24:21
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/derive_transparent.rs:41:1
|
||||
|
|
||||
41 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: FromBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
|
||||
= note: this error originates in the derive macro `FromBytes` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::IntoBytes` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:44:23
|
||||
|
|
||||
44 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: IntoBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::IntoBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(IntoBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::IntoBytes`:
|
||||
()
|
||||
AU16
|
||||
AtomicBool
|
||||
AtomicI16
|
||||
AtomicI32
|
||||
AtomicI64
|
||||
AtomicI8
|
||||
AtomicIsize
|
||||
and 69 others
|
||||
note: required for `TransparentStruct<NotZerocopy>` to implement `zerocopy_renamed::IntoBytes`
|
||||
--> $DIR/derive_transparent.rs:24:10
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/derive_transparent.rs:44:1
|
||||
|
|
||||
44 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: IntoBytes);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
|
||||
= note: this error originates in the derive macro `IntoBytes` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/derive_transparent.rs:47:23
|
||||
|
|
||||
47 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: Unaligned);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 27 others
|
||||
note: required for `TransparentStruct<NotZerocopy>` to implement `zerocopy_renamed::Unaligned`
|
||||
--> $DIR/derive_transparent.rs:24:32
|
||||
|
|
||||
24 | #[derive(IntoBytes, FromBytes, Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `_::{closure#0}::_::{closure#0}::assert_impl_all`
|
||||
--> $DIR/derive_transparent.rs:47:1
|
||||
|
|
||||
47 | util_assert_impl_all!(TransparentStruct<NotZerocopy>: Unaligned);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `assert_impl_all`
|
||||
= note: this error originates in the derive macro `Unaligned` which comes from the expansion of the macro `util_assert_impl_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
+419
@@ -0,0 +1,419 @@
|
||||
error: unrecognized representation hint
|
||||
--> $DIR/enum.rs:20:8
|
||||
|
|
||||
20 | #[repr("foo")]
|
||||
| ^^^^^
|
||||
|
||||
error: unrecognized representation hint
|
||||
--> $DIR/enum.rs:29:8
|
||||
|
|
||||
29 | #[repr(foo)]
|
||||
| ^^^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:36:10
|
||||
|
|
||||
36 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/enum.rs:46:12
|
||||
|
|
||||
46 | #[repr(u8, u16)]
|
||||
| ^^^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:53:10
|
||||
|
|
||||
53 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:88:1
|
||||
|
|
||||
88 | #[zerocopy(crate = "zerocopy_renamed")]
|
||||
| ^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:95:1
|
||||
|
|
||||
95 | #[zerocopy(crate = "zerocopy_renamed")]
|
||||
| ^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:117:1
|
||||
|
|
||||
117 | #[zerocopy(crate = "zerocopy_renamed")]
|
||||
| ^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:124:1
|
||||
|
|
||||
124 | #[zerocopy(crate = "zerocopy_renamed")]
|
||||
| ^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:132:1
|
||||
|
|
||||
132 | #[zerocopy(crate = "zerocopy_renamed")]
|
||||
| ^
|
||||
|
||||
error: FromZeros only supported on enums with a variant that has a discriminant of `0`
|
||||
--> $DIR/enum.rs:140:1
|
||||
|
|
||||
140 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
141 | |
|
||||
142 | | #[repr(u8)]
|
||||
143 | | enum FromZeros4 {
|
||||
144 | | A = 1,
|
||||
145 | | B = 2,
|
||||
146 | | }
|
||||
| |_^
|
||||
|
||||
error: FromZeros only supported on enums with a variant that has a discriminant of `0`
|
||||
help: This enum has discriminants which are not literal integers. One of those may define or imply which variant has a discriminant of zero. Use a literal integer to define or imply the variant with a discriminant of zero.
|
||||
--> $DIR/enum.rs:151:1
|
||||
|
|
||||
151 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
152 | |
|
||||
153 | | #[repr(i8)]
|
||||
154 | | enum FromZeros5 {
|
||||
155 | | A = NEGATIVE_ONE,
|
||||
156 | | B,
|
||||
157 | | }
|
||||
| |_^
|
||||
|
||||
error: FromZeros only supported on enums with a variant that has a discriminant of `0`
|
||||
--> $DIR/enum.rs:171:1
|
||||
|
|
||||
171 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
172 | |
|
||||
173 | | #[repr(u8)]
|
||||
174 | | enum FromZeros7 {
|
||||
... |
|
||||
177 | | B(NotFromZeros),
|
||||
178 | | }
|
||||
| |_^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:184:10
|
||||
|
|
||||
184 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:193:8
|
||||
|
|
||||
193 | #[repr(C)]
|
||||
| ^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:201:8
|
||||
|
|
||||
201 | #[repr(usize)]
|
||||
| ^^^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:209:8
|
||||
|
|
||||
209 | #[repr(isize)]
|
||||
| ^^^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:217:8
|
||||
|
|
||||
217 | #[repr(u32)]
|
||||
| ^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:225:8
|
||||
|
|
||||
225 | #[repr(i32)]
|
||||
| ^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:233:8
|
||||
|
|
||||
233 | #[repr(u64)]
|
||||
| ^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:241:8
|
||||
|
|
||||
241 | #[repr(i64)]
|
||||
| ^^^
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:515:10
|
||||
|
|
||||
515 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:523:10
|
||||
|
|
||||
523 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:531:10
|
||||
|
|
||||
531 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:539:10
|
||||
|
|
||||
539 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:547:10
|
||||
|
|
||||
547 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:555:10
|
||||
|
|
||||
555 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:563:10
|
||||
|
|
||||
563 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:571:10
|
||||
|
|
||||
571 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:579:10
|
||||
|
|
||||
579 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
--> $DIR/enum.rs:589:12
|
||||
|
|
||||
589 | #[repr(u8, align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
--> $DIR/enum.rs:597:12
|
||||
|
|
||||
597 | #[repr(i8, align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/enum.rs:605:18
|
||||
|
|
||||
605 | #[repr(align(1), align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/enum.rs:613:18
|
||||
|
|
||||
613 | #[repr(align(2), align(4))]
|
||||
| ^^^^^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:657:10
|
||||
|
|
||||
657 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:665:10
|
||||
|
|
||||
665 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/enum.rs:677:7
|
||||
|
|
||||
677 | A(T),
|
||||
| ^ cannot perform const operation using `T`
|
||||
|
|
||||
= note: type parameters may not be used in const expressions
|
||||
|
||||
error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants
|
||||
--> $DIR/enum.rs:175:9
|
||||
|
|
||||
175 | A = 1,
|
||||
| ^ disallowed custom discriminant
|
||||
176 |
|
||||
177 | B(NotFromZeros),
|
||||
| --------------- tuple variant defined here
|
||||
|
|
||||
= note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
|
||||
|
||||
error[E0565]: meta item in `repr` must be an identifier
|
||||
--> $DIR/enum.rs:20:8
|
||||
|
|
||||
20 | #[repr("foo")]
|
||||
| ^^^^^
|
||||
|
||||
error[E0552]: unrecognized representation hint
|
||||
--> $DIR/enum.rs:29:8
|
||||
|
|
||||
29 | #[repr(foo)]
|
||||
| ^^^
|
||||
|
||||
error[E0566]: conflicting representation hints
|
||||
--> $DIR/enum.rs:46:8
|
||||
|
|
||||
46 | #[repr(u8, u16)]
|
||||
| ^^ ^^^
|
||||
|
|
||||
= note: `#[deny(conflicting_repr_hints)]` on by default
|
||||
= 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 #68585 <https://github.com/rust-lang/rust/issues/68585>
|
||||
|
||||
error[E0277]: the trait bound `UnsafeCell<()>: Immutable` is not satisfied
|
||||
--> $DIR/enum.rs:64:10
|
||||
|
|
||||
64 | #[derive(Immutable)]
|
||||
| ^^^^^^^^^ the trait `Immutable` is not implemented for `UnsafeCell<()>`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `UnsafeCell<u8>: Immutable` is not satisfied
|
||||
--> $DIR/enum.rs:75:10
|
||||
|
|
||||
75 | #[derive(Immutable)]
|
||||
| ^^^^^^^^^ the trait `Immutable` is not implemented for `UnsafeCell<u8>`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotTryFromBytes: TryFromBytes` is not satisfied
|
||||
--> $DIR/enum.rs:104:10
|
||||
|
|
||||
104 | #[derive(TryFromBytes)]
|
||||
| ^^^^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotTryFromBytes`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotFromZeros: TryFromBytes` is not satisfied
|
||||
--> $DIR/enum.rs:161:10
|
||||
|
|
||||
161 | #[derive(FromZeros)]
|
||||
| ^^^^^^^^^ the trait `TryFromBytes` is not implemented for `NotFromZeros`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotFromZeros: FromZeros` is not satisfied
|
||||
--> $DIR/enum.rs:161:10
|
||||
|
|
||||
161 | #[derive(FromZeros)]
|
||||
| ^^^^^^^^^ the trait `FromZeros` is not implemented for `NotFromZeros`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `bool: FromBytes` is not satisfied
|
||||
--> $DIR/enum.rs:247:10
|
||||
|
|
||||
247 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `(): PaddingFree<IntoBytes1, 1_usize>` is not satisfied
|
||||
--> $DIR/enum.rs:623:10
|
||||
|
|
||||
623 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ the trait `PaddingFree<IntoBytes1, 1_usize>` is not implemented for `()`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<() as PaddingFree<T, 0_usize>>
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `(): PaddingFree<IntoBytes2, 3_usize>` is not satisfied
|
||||
--> $DIR/enum.rs:638:10
|
||||
|
|
||||
638 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ the trait `PaddingFree<IntoBytes2, 3_usize>` is not implemented for `()`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<() as PaddingFree<T, 0_usize>>
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `(): PaddingFree<IntoBytes3, 2_usize>` is not satisfied
|
||||
--> $DIR/enum.rs:647:10
|
||||
|
|
||||
647 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ the trait `PaddingFree<IntoBytes3, 2_usize>` is not implemented for `()`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<() as PaddingFree<T, 0_usize>>
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: generic `Self` types are currently not permitted in anonymous constants
|
||||
--> $DIR/enum.rs:672:10
|
||||
|
|
||||
672 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: not a concrete type
|
||||
--> $DIR/enum.rs:672:10
|
||||
|
|
||||
672 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `(): PaddingFree<IntoBytes7, 1_usize>` is not satisfied
|
||||
--> $DIR/enum.rs:681:10
|
||||
|
|
||||
681 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ the trait `PaddingFree<IntoBytes7, 1_usize>` is not implemented for `()`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<() as PaddingFree<T, 0_usize>>
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 52 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0552, E0565, E0566, E0658.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
+601
@@ -0,0 +1,601 @@
|
||||
error: unrecognized representation hint
|
||||
--> $DIR/enum.rs:20:8
|
||||
|
|
||||
20 | #[repr("foo")]
|
||||
| ^^^^^
|
||||
|
||||
error: unrecognized representation hint
|
||||
--> $DIR/enum.rs:29:8
|
||||
|
|
||||
29 | #[repr(foo)]
|
||||
| ^^^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:36:10
|
||||
|
|
||||
36 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/enum.rs:46:8
|
||||
|
|
||||
46 | #[repr(u8, u16)]
|
||||
| ^^^^^^^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:53:10
|
||||
|
|
||||
53 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:88:1
|
||||
|
|
||||
88 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
89 | |
|
||||
90 | | enum TryFromBytes1 {
|
||||
91 | | A,
|
||||
92 | | }
|
||||
| |_^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:95:1
|
||||
|
|
||||
95 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
96 | |
|
||||
97 | | enum TryFromBytes2 {
|
||||
98 | | A,
|
||||
99 | | B(u8),
|
||||
100 | | }
|
||||
| |_^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:117:1
|
||||
|
|
||||
117 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
118 | |
|
||||
119 | | enum FromZeros1 {
|
||||
120 | | A(u8),
|
||||
121 | | }
|
||||
| |_^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:124:1
|
||||
|
|
||||
124 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
125 | |
|
||||
126 | | enum FromZeros2 {
|
||||
127 | | A,
|
||||
128 | | B(u8),
|
||||
129 | | }
|
||||
| |_^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:132:1
|
||||
|
|
||||
132 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
133 | |
|
||||
134 | | enum FromZeros3 {
|
||||
135 | | A = 1,
|
||||
136 | | B,
|
||||
137 | | }
|
||||
| |_^
|
||||
|
||||
error: FromZeros only supported on enums with a variant that has a discriminant of `0`
|
||||
--> $DIR/enum.rs:140:1
|
||||
|
|
||||
140 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
141 | |
|
||||
142 | | #[repr(u8)]
|
||||
143 | | enum FromZeros4 {
|
||||
144 | | A = 1,
|
||||
145 | | B = 2,
|
||||
146 | | }
|
||||
| |_^
|
||||
|
||||
error: FromZeros only supported on enums with a variant that has a discriminant of `0`
|
||||
help: This enum has discriminants which are not literal integers. One of those may define or imply which variant has a discriminant of zero. Use a literal integer to define or imply the variant with a discriminant of zero.
|
||||
--> $DIR/enum.rs:151:1
|
||||
|
|
||||
151 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
152 | |
|
||||
153 | | #[repr(i8)]
|
||||
154 | | enum FromZeros5 {
|
||||
155 | | A = NEGATIVE_ONE,
|
||||
156 | | B,
|
||||
157 | | }
|
||||
| |_^
|
||||
|
||||
error: FromZeros only supported on enums with a variant that has a discriminant of `0`
|
||||
--> $DIR/enum.rs:171:1
|
||||
|
|
||||
171 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
172 | |
|
||||
173 | | #[repr(u8)]
|
||||
174 | | enum FromZeros7 {
|
||||
... |
|
||||
177 | | B(NotFromZeros),
|
||||
178 | | }
|
||||
| |_^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:184:10
|
||||
|
|
||||
184 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:193:8
|
||||
|
|
||||
193 | #[repr(C)]
|
||||
| ^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:201:8
|
||||
|
|
||||
201 | #[repr(usize)]
|
||||
| ^^^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:209:8
|
||||
|
|
||||
209 | #[repr(isize)]
|
||||
| ^^^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:217:8
|
||||
|
|
||||
217 | #[repr(u32)]
|
||||
| ^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:225:8
|
||||
|
|
||||
225 | #[repr(i32)]
|
||||
| ^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:233:8
|
||||
|
|
||||
233 | #[repr(u64)]
|
||||
| ^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:241:8
|
||||
|
|
||||
241 | #[repr(i64)]
|
||||
| ^^^
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:515:10
|
||||
|
|
||||
515 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:523:10
|
||||
|
|
||||
523 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:531:10
|
||||
|
|
||||
531 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:539:10
|
||||
|
|
||||
539 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:547:10
|
||||
|
|
||||
547 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:555:10
|
||||
|
|
||||
555 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:563:10
|
||||
|
|
||||
563 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:571:10
|
||||
|
|
||||
571 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:579:10
|
||||
|
|
||||
579 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
--> $DIR/enum.rs:589:12
|
||||
|
|
||||
589 | #[repr(u8, align(2))]
|
||||
| ^^^^^^^^
|
||||
|
||||
error: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
--> $DIR/enum.rs:597:12
|
||||
|
|
||||
597 | #[repr(i8, align(2))]
|
||||
| ^^^^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/enum.rs:605:8
|
||||
|
|
||||
605 | #[repr(align(1), align(2))]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/enum.rs:613:8
|
||||
|
|
||||
613 | #[repr(align(2), align(4))]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:657:10
|
||||
|
|
||||
657 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:665:10
|
||||
|
|
||||
665 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/enum.rs:677:7
|
||||
|
|
||||
677 | A(T),
|
||||
| ^ cannot perform const operation using `T`
|
||||
|
|
||||
= note: type parameters may not be used in const expressions
|
||||
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0565]: meta item in `repr` must be an identifier
|
||||
--> $DIR/enum.rs:20:1
|
||||
|
|
||||
20 | #[repr("foo")]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error[E0552]: unrecognized representation hint
|
||||
--> $DIR/enum.rs:29:8
|
||||
|
|
||||
29 | #[repr(foo)]
|
||||
| ^^^
|
||||
|
|
||||
= help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
|
||||
|
||||
error[E0566]: conflicting representation hints
|
||||
--> $DIR/enum.rs:46:8
|
||||
|
|
||||
46 | #[repr(u8, u16)]
|
||||
| ^^ ^^^
|
||||
|
|
||||
= 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 #68585 <https://github.com/rust-lang/rust/issues/68585>
|
||||
= note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
|
||||
|
||||
error[E0277]: the trait bound `UnsafeCell<()>: Immutable` is not satisfied
|
||||
--> $DIR/enum.rs:64:10
|
||||
|
|
||||
64 | #[derive(Immutable)]
|
||||
| ^^^^^^^^^ the trait `Immutable` is not implemented for `UnsafeCell<()>`
|
||||
|
|
||||
= note: Consider adding `#[derive(Immutable)]` to `UnsafeCell<()>`
|
||||
= help: the following other types implement trait `Immutable`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
and 137 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `UnsafeCell<u8>: Immutable` is not satisfied
|
||||
--> $DIR/enum.rs:75:10
|
||||
|
|
||||
75 | #[derive(Immutable)]
|
||||
| ^^^^^^^^^ the trait `Immutable` is not implemented for `UnsafeCell<u8>`
|
||||
|
|
||||
= note: Consider adding `#[derive(Immutable)]` to `UnsafeCell<u8>`
|
||||
= help: the following other types implement trait `Immutable`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
and 137 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NotTryFromBytes: TryFromBytes` is not satisfied
|
||||
--> $DIR/enum.rs:104:10
|
||||
|
|
||||
104 | #[derive(TryFromBytes)]
|
||||
| ^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `TryFromBytes` is not implemented for `NotTryFromBytes`
|
||||
--> $DIR/enum.rs:102:1
|
||||
|
|
||||
102 | struct NotTryFromBytes;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(TryFromBytes)]` to `NotTryFromBytes`
|
||||
= help: the following other types implement trait `TryFromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 157 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NotFromZeros: TryFromBytes` is not satisfied
|
||||
--> $DIR/enum.rs:161:10
|
||||
|
|
||||
161 | #[derive(FromZeros)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `TryFromBytes` is not implemented for `NotFromZeros`
|
||||
--> $DIR/enum.rs:159:1
|
||||
|
|
||||
159 | struct NotFromZeros;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(TryFromBytes)]` to `NotFromZeros`
|
||||
= help: the following other types implement trait `TryFromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 157 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NotFromZeros: FromZeros` is not satisfied
|
||||
--> $DIR/enum.rs:161:10
|
||||
|
|
||||
161 | #[derive(FromZeros)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `FromZeros` is not implemented for `NotFromZeros`
|
||||
--> $DIR/enum.rs:159:1
|
||||
|
|
||||
159 | struct NotFromZeros;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromZeros)]` to `NotFromZeros`
|
||||
= help: the following other types implement trait `FromZeros`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 142 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `bool: FromBytes` is not satisfied
|
||||
--> $DIR/enum.rs:247:10
|
||||
|
|
||||
247 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool`
|
||||
|
|
||||
= note: Consider adding `#[derive(FromBytes)]` to `bool`
|
||||
= help: the following other types implement trait `FromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 79 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: `IntoBytes1` has 1 total byte(s) of padding
|
||||
--> $DIR/enum.rs:623:10
|
||||
|
|
||||
623 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes1, 1>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes1, 0>` is implemented for it
|
||||
--> src/util/macro_util.rs:62:0
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: `IntoBytes2` has 3 total byte(s) of padding
|
||||
--> $DIR/enum.rs:638:10
|
||||
|
|
||||
638 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes2, 3>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes2, 0>` is implemented for it
|
||||
--> src/util/macro_util.rs:62:0
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: `IntoBytes3` has 2 total byte(s) of padding
|
||||
--> $DIR/enum.rs:647:10
|
||||
|
|
||||
647 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes3, 2>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes3, 0>` is implemented for it
|
||||
--> src/util/macro_util.rs:62:0
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error: generic `Self` types are currently not permitted in anonymous constants
|
||||
--> $DIR/enum.rs:672:10
|
||||
|
|
||||
672 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: not a concrete type
|
||||
--> $DIR/enum.rs:672:10
|
||||
|
|
||||
672 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `IntoBytes7` has 1 total byte(s) of padding
|
||||
--> $DIR/enum.rs:681:10
|
||||
|
|
||||
681 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes7, 1>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes7, 0>` is implemented for it
|
||||
--> src/util/macro_util.rs:62:0
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `bool: FromBytes` is not satisfied
|
||||
--> $DIR/enum.rs:247:10
|
||||
|
|
||||
247 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool`
|
||||
|
|
||||
= note: Consider adding `#[derive(FromBytes)]` to `bool`
|
||||
= help: the following other types implement trait `FromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 79 others
|
||||
note: required for `FooU8` to implement `FromBytes`
|
||||
--> $DIR/enum.rs:247:10
|
||||
|
|
||||
247 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `assert_is_from_bytes`
|
||||
--> $DIR/enum.rs:247:10
|
||||
|
|
||||
247 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ required by this bound in `assert_is_from_bytes`
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 52 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0552, E0565, E0566.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
+688
@@ -0,0 +1,688 @@
|
||||
// Copyright 2019 The Fuchsia Authors
|
||||
//
|
||||
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
||||
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
||||
// This file may not be copied, modified, or distributed except according to
|
||||
// those terms.
|
||||
|
||||
#[macro_use]
|
||||
extern crate zerocopy_renamed;
|
||||
|
||||
fn main() {}
|
||||
|
||||
//
|
||||
// Generic errors
|
||||
//
|
||||
|
||||
#[derive(FromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr("foo")]
|
||||
//~[msrv, stable, nightly]^ ERROR: unrecognized representation hint
|
||||
//~[msrv, stable, nightly]^^ ERROR: meta item in `repr` must be an identifier
|
||||
enum Generic1 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(FromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(foo)]
|
||||
//~[msrv, stable, nightly]^ ERROR: unrecognized representation hint
|
||||
//~[msrv, stable, nightly]^^ ERROR: unrecognized representation hint
|
||||
enum Generic2 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(FromBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(transparent)]
|
||||
enum Generic3 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(FromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u8, u16)]
|
||||
//~[msrv, stable, nightly]^ ERROR: this conflicts with another representation hint
|
||||
//~[msrv, stable, nightly]^^ ERROR: conflicting representation hints
|
||||
enum Generic4 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(FromBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
enum Generic5 {
|
||||
A,
|
||||
}
|
||||
|
||||
//
|
||||
// Immutable errors
|
||||
//
|
||||
|
||||
#[derive(Immutable)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `UnsafeCell<()>: Immutable` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
enum Immutable1 {
|
||||
A(core::cell::UnsafeCell<()>),
|
||||
}
|
||||
|
||||
#[derive(Immutable)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
enum Never {}
|
||||
|
||||
#[derive(Immutable)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `UnsafeCell<u8>: Immutable` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
enum Immutable2 {
|
||||
Uninhabited(Never, core::cell::UnsafeCell<u8>),
|
||||
Inhabited(u8),
|
||||
}
|
||||
|
||||
//
|
||||
// TryFromBytes errors
|
||||
//
|
||||
|
||||
#[derive(TryFromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
enum TryFromBytes1 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(TryFromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
enum TryFromBytes2 {
|
||||
A,
|
||||
B(u8),
|
||||
}
|
||||
|
||||
struct NotTryFromBytes;
|
||||
|
||||
#[derive(TryFromBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `NotTryFromBytes: TryFromBytes` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u8)]
|
||||
enum TryFromBytes3 {
|
||||
A(NotTryFromBytes),
|
||||
}
|
||||
|
||||
//
|
||||
// FromZeros errors
|
||||
//
|
||||
|
||||
#[derive(FromZeros)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
enum FromZeros1 {
|
||||
A(u8),
|
||||
}
|
||||
|
||||
#[derive(FromZeros)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
enum FromZeros2 {
|
||||
A,
|
||||
B(u8),
|
||||
}
|
||||
|
||||
#[derive(FromZeros)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
enum FromZeros3 {
|
||||
A = 1,
|
||||
B,
|
||||
}
|
||||
|
||||
#[derive(FromZeros)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
//~[msrv, stable, nightly]^ ERROR: FromZeros only supported on enums with a variant that has a discriminant of `0`
|
||||
#[repr(u8)]
|
||||
enum FromZeros4 {
|
||||
A = 1,
|
||||
B = 2,
|
||||
}
|
||||
|
||||
const NEGATIVE_ONE: i8 = -1;
|
||||
|
||||
#[derive(FromZeros)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
//~[msrv, stable, nightly]^ ERROR: FromZeros only supported on enums with a variant that has a discriminant of `0`
|
||||
#[repr(i8)]
|
||||
enum FromZeros5 {
|
||||
A = NEGATIVE_ONE,
|
||||
B,
|
||||
}
|
||||
|
||||
struct NotFromZeros;
|
||||
|
||||
#[derive(FromZeros)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `NotFromZeros: TryFromBytes` is not satisfied
|
||||
//~[msrv, stable, nightly]^^ ERROR: the trait bound `NotFromZeros: FromZeros` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u8)]
|
||||
enum FromZeros6 {
|
||||
A(NotFromZeros),
|
||||
}
|
||||
|
||||
#[derive(FromZeros)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
//~[msrv, stable, nightly]^ ERROR: FromZeros only supported on enums with a variant that has a discriminant of `0`
|
||||
#[repr(u8)]
|
||||
enum FromZeros7 {
|
||||
A = 1,
|
||||
//~[msrv]^ ERROR: custom discriminant values are not allowed in enums with tuple or struct variants
|
||||
B(NotFromZeros),
|
||||
}
|
||||
|
||||
//
|
||||
// FromBytes errors
|
||||
//
|
||||
|
||||
#[derive(FromBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
enum FromBytes1 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(FromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
//~[msrv, stable, nightly]^ ERROR: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
enum FromBytes2 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(FromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(usize)]
|
||||
//~[msrv, stable, nightly]^ ERROR: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
enum FromBytes3 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(FromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(isize)]
|
||||
//~[msrv, stable, nightly]^ ERROR: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
enum FromBytes4 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(FromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u32)]
|
||||
//~[msrv, stable, nightly]^ ERROR: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
enum FromBytes5 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(FromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(i32)]
|
||||
//~[msrv, stable, nightly]^ ERROR: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
enum FromBytes6 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(FromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u64)]
|
||||
//~[msrv, stable, nightly]^ ERROR: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
enum FromBytes7 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(FromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(i64)]
|
||||
//~[msrv, stable, nightly]^ ERROR: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
enum FromBytes8 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(FromBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `bool: FromBytes` is not satisfied
|
||||
//~[stable, nightly]^^ ERROR: the trait bound `bool: FromBytes` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u8)]
|
||||
enum FooU8 {
|
||||
Variant0,
|
||||
Variant1,
|
||||
Variant2,
|
||||
Variant3,
|
||||
Variant4,
|
||||
Variant5,
|
||||
Variant6,
|
||||
Variant7,
|
||||
Variant8,
|
||||
Variant9,
|
||||
Variant10,
|
||||
Variant11,
|
||||
Variant12,
|
||||
Variant13,
|
||||
Variant14,
|
||||
Variant15,
|
||||
Variant16,
|
||||
Variant17,
|
||||
Variant18,
|
||||
Variant19,
|
||||
Variant20,
|
||||
Variant21,
|
||||
Variant22,
|
||||
Variant23,
|
||||
Variant24,
|
||||
Variant25,
|
||||
Variant26,
|
||||
Variant27,
|
||||
Variant28,
|
||||
Variant29,
|
||||
Variant30,
|
||||
Variant31,
|
||||
Variant32,
|
||||
Variant33,
|
||||
Variant34,
|
||||
Variant35,
|
||||
Variant36,
|
||||
Variant37,
|
||||
Variant38,
|
||||
Variant39,
|
||||
Variant40,
|
||||
Variant41,
|
||||
Variant42,
|
||||
Variant43,
|
||||
Variant44,
|
||||
Variant45,
|
||||
Variant46,
|
||||
Variant47,
|
||||
Variant48,
|
||||
Variant49,
|
||||
Variant50,
|
||||
Variant51,
|
||||
Variant52,
|
||||
Variant53,
|
||||
Variant54,
|
||||
Variant55,
|
||||
Variant56,
|
||||
Variant57,
|
||||
Variant58,
|
||||
Variant59,
|
||||
Variant60,
|
||||
Variant61,
|
||||
Variant62,
|
||||
Variant63,
|
||||
Variant64,
|
||||
Variant65,
|
||||
Variant66,
|
||||
Variant67,
|
||||
Variant68,
|
||||
Variant69,
|
||||
Variant70,
|
||||
Variant71,
|
||||
Variant72,
|
||||
Variant73,
|
||||
Variant74,
|
||||
Variant75,
|
||||
Variant76,
|
||||
Variant77,
|
||||
Variant78,
|
||||
Variant79,
|
||||
Variant80,
|
||||
Variant81,
|
||||
Variant82,
|
||||
Variant83,
|
||||
Variant84,
|
||||
Variant85,
|
||||
Variant86,
|
||||
Variant87,
|
||||
Variant88,
|
||||
Variant89,
|
||||
Variant90,
|
||||
Variant91,
|
||||
Variant92,
|
||||
Variant93,
|
||||
Variant94,
|
||||
Variant95,
|
||||
Variant96,
|
||||
Variant97,
|
||||
Variant98,
|
||||
Variant99,
|
||||
Variant100,
|
||||
Variant101,
|
||||
Variant102,
|
||||
Variant103,
|
||||
Variant104,
|
||||
Variant105,
|
||||
Variant106,
|
||||
Variant107,
|
||||
Variant108,
|
||||
Variant109,
|
||||
Variant110,
|
||||
Variant111,
|
||||
Variant112,
|
||||
Variant113,
|
||||
Variant114,
|
||||
Variant115,
|
||||
Variant116,
|
||||
Variant117,
|
||||
Variant118,
|
||||
Variant119,
|
||||
Variant120,
|
||||
Variant121,
|
||||
Variant122,
|
||||
Variant123,
|
||||
Variant124,
|
||||
Variant125,
|
||||
Variant126,
|
||||
Variant127,
|
||||
Variant128,
|
||||
Variant129,
|
||||
Variant130,
|
||||
Variant131,
|
||||
Variant132,
|
||||
Variant133,
|
||||
Variant134,
|
||||
Variant135,
|
||||
Variant136,
|
||||
Variant137,
|
||||
Variant138,
|
||||
Variant139,
|
||||
Variant140,
|
||||
Variant141,
|
||||
Variant142,
|
||||
Variant143,
|
||||
Variant144,
|
||||
Variant145,
|
||||
Variant146,
|
||||
Variant147,
|
||||
Variant148,
|
||||
Variant149,
|
||||
Variant150,
|
||||
Variant151,
|
||||
Variant152,
|
||||
Variant153,
|
||||
Variant154,
|
||||
Variant155,
|
||||
Variant156,
|
||||
Variant157,
|
||||
Variant158,
|
||||
Variant159,
|
||||
Variant160,
|
||||
Variant161,
|
||||
Variant162,
|
||||
Variant163,
|
||||
Variant164,
|
||||
Variant165,
|
||||
Variant166,
|
||||
Variant167,
|
||||
Variant168,
|
||||
Variant169,
|
||||
Variant170,
|
||||
Variant171,
|
||||
Variant172,
|
||||
Variant173,
|
||||
Variant174,
|
||||
Variant175,
|
||||
Variant176,
|
||||
Variant177,
|
||||
Variant178,
|
||||
Variant179,
|
||||
Variant180,
|
||||
Variant181,
|
||||
Variant182,
|
||||
Variant183,
|
||||
Variant184,
|
||||
Variant185,
|
||||
Variant186,
|
||||
Variant187,
|
||||
Variant188,
|
||||
Variant189,
|
||||
Variant190,
|
||||
Variant191,
|
||||
Variant192,
|
||||
Variant193,
|
||||
Variant194,
|
||||
Variant195,
|
||||
Variant196,
|
||||
Variant197,
|
||||
Variant198,
|
||||
Variant199,
|
||||
Variant200,
|
||||
Variant201,
|
||||
Variant202,
|
||||
Variant203,
|
||||
Variant204,
|
||||
Variant205,
|
||||
Variant206,
|
||||
Variant207,
|
||||
Variant208,
|
||||
Variant209,
|
||||
Variant210,
|
||||
Variant211,
|
||||
Variant212,
|
||||
Variant213,
|
||||
Variant214,
|
||||
Variant215,
|
||||
Variant216,
|
||||
Variant217,
|
||||
Variant218,
|
||||
Variant219,
|
||||
Variant220,
|
||||
Variant221,
|
||||
Variant222,
|
||||
Variant223,
|
||||
Variant224,
|
||||
Variant225,
|
||||
Variant226,
|
||||
Variant227,
|
||||
Variant228,
|
||||
Variant229,
|
||||
Variant230,
|
||||
Variant231,
|
||||
Variant232,
|
||||
Variant233,
|
||||
Variant234,
|
||||
Variant235,
|
||||
Variant236,
|
||||
Variant237,
|
||||
Variant238,
|
||||
Variant239,
|
||||
Variant240,
|
||||
Variant241,
|
||||
Variant242,
|
||||
Variant243,
|
||||
Variant244,
|
||||
Variant245,
|
||||
Variant246,
|
||||
Variant247,
|
||||
Variant248,
|
||||
Variant249,
|
||||
Variant250,
|
||||
Variant251,
|
||||
Variant252,
|
||||
Variant253,
|
||||
Variant254,
|
||||
Variant255(bool),
|
||||
}
|
||||
|
||||
//
|
||||
// Unaligned errors
|
||||
//
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
enum Unaligned1 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u16)]
|
||||
enum Unaligned2 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(i16)]
|
||||
enum Unaligned3 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u32)]
|
||||
enum Unaligned4 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(i32)]
|
||||
enum Unaligned5 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u64)]
|
||||
enum Unaligned6 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(i64)]
|
||||
enum Unaligned7 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(usize)]
|
||||
enum Unaligned8 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(isize)]
|
||||
enum Unaligned9 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u8, align(2))]
|
||||
//~[msrv, stable, nightly]^ ERROR: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
enum Unaligned10 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(i8, align(2))]
|
||||
//~[msrv, stable, nightly]^ ERROR: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
enum Unaligned11 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(align(1), align(2))]
|
||||
//~[msrv, stable, nightly]^ ERROR: this conflicts with another representation hint
|
||||
enum Unaligned12 {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(align(2), align(4))]
|
||||
//~[msrv, stable, nightly]^ ERROR: this conflicts with another representation hint
|
||||
enum Unaligned13 {
|
||||
A,
|
||||
}
|
||||
|
||||
//
|
||||
// IntoBytes errors
|
||||
//
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv]^ ERROR: the trait bound `(): PaddingFree<IntoBytes1, 1_usize>` is not satisfied
|
||||
//~[stable, nightly]^^ ERROR: `IntoBytes1` has 1 total byte(s) of padding
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u8)]
|
||||
enum IntoBytes1 {
|
||||
A,
|
||||
B(u8),
|
||||
}
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C, align(4))]
|
||||
struct Align4IntoBytes(u32);
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv]^ ERROR: the trait bound `(): PaddingFree<IntoBytes2, 3_usize>` is not satisfied
|
||||
//~[stable, nightly]^^ ERROR: `IntoBytes2` has 3 total byte(s) of padding
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u8)]
|
||||
enum IntoBytes2 {
|
||||
A(Align4IntoBytes),
|
||||
}
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv]^ ERROR: the trait bound `(): PaddingFree<IntoBytes3, 2_usize>` is not satisfied
|
||||
//~[stable, nightly]^^ ERROR: `IntoBytes3` has 2 total byte(s) of padding
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u32)]
|
||||
enum IntoBytes3 {
|
||||
A(u32),
|
||||
B(u16),
|
||||
}
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
enum IntoBytes4 {
|
||||
A(u32),
|
||||
B(u16),
|
||||
}
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
enum IntoBytes5 {
|
||||
A(u32),
|
||||
}
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: generic `Self` types are currently not permitted in anonymous constants
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u8)]
|
||||
enum IntoBytes6<T> {
|
||||
A(T),
|
||||
//~[msrv, stable, nightly]^ ERROR: generic parameters may not be used in const operations
|
||||
}
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv]^ ERROR: the trait bound `(): PaddingFree<IntoBytes7, 1_usize>` is not satisfied
|
||||
//~[stable, nightly]^^ ERROR: `IntoBytes7` has 1 total byte(s) of padding
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(u8, align(2))]
|
||||
enum IntoBytes7 {
|
||||
A,
|
||||
}
|
||||
+549
@@ -0,0 +1,549 @@
|
||||
error: unrecognized representation hint
|
||||
--> $DIR/enum.rs:20:8
|
||||
|
|
||||
20 | #[repr("foo")]
|
||||
| ^^^^^
|
||||
|
||||
error: unrecognized representation hint
|
||||
--> $DIR/enum.rs:29:8
|
||||
|
|
||||
29 | #[repr(foo)]
|
||||
| ^^^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:36:10
|
||||
|
|
||||
36 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/enum.rs:46:12
|
||||
|
|
||||
46 | #[repr(u8, u16)]
|
||||
| ^^^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:53:10
|
||||
|
|
||||
53 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:88:1
|
||||
|
|
||||
88 | #[zerocopy(crate = "zerocopy_renamed")]
|
||||
| ^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:95:1
|
||||
|
|
||||
95 | #[zerocopy(crate = "zerocopy_renamed")]
|
||||
| ^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:117:1
|
||||
|
|
||||
117 | #[zerocopy(crate = "zerocopy_renamed")]
|
||||
| ^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:124:1
|
||||
|
|
||||
124 | #[zerocopy(crate = "zerocopy_renamed")]
|
||||
| ^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:132:1
|
||||
|
|
||||
132 | #[zerocopy(crate = "zerocopy_renamed")]
|
||||
| ^
|
||||
|
||||
error: FromZeros only supported on enums with a variant that has a discriminant of `0`
|
||||
--> $DIR/enum.rs:140:1
|
||||
|
|
||||
140 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
141 | |
|
||||
142 | | #[repr(u8)]
|
||||
143 | | enum FromZeros4 {
|
||||
144 | | A = 1,
|
||||
145 | | B = 2,
|
||||
146 | | }
|
||||
| |_^
|
||||
|
||||
error: FromZeros only supported on enums with a variant that has a discriminant of `0`
|
||||
help: This enum has discriminants which are not literal integers. One of those may define or imply which variant has a discriminant of zero. Use a literal integer to define or imply the variant with a discriminant of zero.
|
||||
--> $DIR/enum.rs:151:1
|
||||
|
|
||||
151 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
152 | |
|
||||
153 | | #[repr(i8)]
|
||||
154 | | enum FromZeros5 {
|
||||
155 | | A = NEGATIVE_ONE,
|
||||
156 | | B,
|
||||
157 | | }
|
||||
| |_^
|
||||
|
||||
error: FromZeros only supported on enums with a variant that has a discriminant of `0`
|
||||
--> $DIR/enum.rs:171:1
|
||||
|
|
||||
171 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
172 | |
|
||||
173 | | #[repr(u8)]
|
||||
174 | | enum FromZeros7 {
|
||||
... |
|
||||
177 | | B(NotFromZeros),
|
||||
178 | | }
|
||||
| |_^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:184:10
|
||||
|
|
||||
184 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:193:8
|
||||
|
|
||||
193 | #[repr(C)]
|
||||
| ^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:201:8
|
||||
|
|
||||
201 | #[repr(usize)]
|
||||
| ^^^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:209:8
|
||||
|
|
||||
209 | #[repr(isize)]
|
||||
| ^^^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:217:8
|
||||
|
|
||||
217 | #[repr(u32)]
|
||||
| ^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:225:8
|
||||
|
|
||||
225 | #[repr(i32)]
|
||||
| ^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:233:8
|
||||
|
|
||||
233 | #[repr(u64)]
|
||||
| ^^^
|
||||
|
||||
error: `FromBytes` only supported on enums with `#[repr(...)]` attributes `u8`, `i8`, `u16`, or `i16`
|
||||
--> $DIR/enum.rs:241:8
|
||||
|
|
||||
241 | #[repr(i64)]
|
||||
| ^^^
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:515:10
|
||||
|
|
||||
515 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:523:10
|
||||
|
|
||||
523 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:531:10
|
||||
|
|
||||
531 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:539:10
|
||||
|
|
||||
539 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:547:10
|
||||
|
|
||||
547 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:555:10
|
||||
|
|
||||
555 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:563:10
|
||||
|
|
||||
563 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:571:10
|
||||
|
|
||||
571 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(u8)] or #[repr(i8)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/enum.rs:579:10
|
||||
|
|
||||
579 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
--> $DIR/enum.rs:589:12
|
||||
|
|
||||
589 | #[repr(u8, align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
--> $DIR/enum.rs:597:12
|
||||
|
|
||||
597 | #[repr(i8, align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/enum.rs:605:18
|
||||
|
|
||||
605 | #[repr(align(1), align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/enum.rs:613:18
|
||||
|
|
||||
613 | #[repr(align(2), align(4))]
|
||||
| ^^^^^
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:657:10
|
||||
|
|
||||
657 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(C)] or #[repr(Int)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/enum.rs:665:10
|
||||
|
|
||||
665 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/enum.rs:677:7
|
||||
|
|
||||
677 | A(T),
|
||||
| ^ cannot perform const operation using `T`
|
||||
|
|
||||
= note: type parameters may not be used in const expressions
|
||||
|
||||
error[E0565]: meta item in `repr` must be an identifier
|
||||
--> $DIR/enum.rs:20:1
|
||||
|
|
||||
20 | #[repr("foo")]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error[E0552]: unrecognized representation hint
|
||||
--> $DIR/enum.rs:29:8
|
||||
|
|
||||
29 | #[repr(foo)]
|
||||
| ^^^
|
||||
|
|
||||
= help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
|
||||
|
||||
error[E0566]: conflicting representation hints
|
||||
--> $DIR/enum.rs:46:8
|
||||
|
|
||||
46 | #[repr(u8, u16)]
|
||||
| ^^ ^^^
|
||||
|
|
||||
= 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 #68585 <https://github.com/rust-lang/rust/issues/68585>
|
||||
= note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default
|
||||
|
||||
error[E0277]: the trait bound `UnsafeCell<()>: Immutable` is not satisfied
|
||||
--> $DIR/enum.rs:64:10
|
||||
|
|
||||
64 | #[derive(Immutable)]
|
||||
| ^^^^^^^^^ the trait `Immutable` is not implemented for `UnsafeCell<()>`
|
||||
|
|
||||
= note: Consider adding `#[derive(Immutable)]` to `UnsafeCell<()>`
|
||||
= help: the following other types implement trait `Immutable`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
and 137 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `UnsafeCell<u8>: Immutable` is not satisfied
|
||||
--> $DIR/enum.rs:75:10
|
||||
|
|
||||
75 | #[derive(Immutable)]
|
||||
| ^^^^^^^^^ the trait `Immutable` is not implemented for `UnsafeCell<u8>`
|
||||
|
|
||||
= note: Consider adding `#[derive(Immutable)]` to `UnsafeCell<u8>`
|
||||
= help: the following other types implement trait `Immutable`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
and 137 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotTryFromBytes: TryFromBytes` is not satisfied
|
||||
--> $DIR/enum.rs:104:10
|
||||
|
|
||||
104 | #[derive(TryFromBytes)]
|
||||
| ^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `TryFromBytes` is not implemented for `NotTryFromBytes`
|
||||
--> $DIR/enum.rs:102:1
|
||||
|
|
||||
102 | struct NotTryFromBytes;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(TryFromBytes)]` to `NotTryFromBytes`
|
||||
= help: the following other types implement trait `TryFromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 157 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotFromZeros: TryFromBytes` is not satisfied
|
||||
--> $DIR/enum.rs:161:10
|
||||
|
|
||||
161 | #[derive(FromZeros)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `TryFromBytes` is not implemented for `NotFromZeros`
|
||||
--> $DIR/enum.rs:159:1
|
||||
|
|
||||
159 | struct NotFromZeros;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(TryFromBytes)]` to `NotFromZeros`
|
||||
= help: the following other types implement trait `TryFromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 157 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotFromZeros: FromZeros` is not satisfied
|
||||
--> $DIR/enum.rs:161:10
|
||||
|
|
||||
161 | #[derive(FromZeros)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `FromZeros` is not implemented for `NotFromZeros`
|
||||
--> $DIR/enum.rs:159:1
|
||||
|
|
||||
159 | struct NotFromZeros;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromZeros)]` to `NotFromZeros`
|
||||
= help: the following other types implement trait `FromZeros`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 142 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `bool: FromBytes` is not satisfied
|
||||
--> $DIR/enum.rs:247:10
|
||||
|
|
||||
247 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool`
|
||||
|
|
||||
= note: Consider adding `#[derive(FromBytes)]` to `bool`
|
||||
= help: the following other types implement trait `FromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 79 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `IntoBytes1` has 1 total byte(s) of padding
|
||||
--> $DIR/enum.rs:623:10
|
||||
|
|
||||
623 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes1, 1>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes1, 0>` is implemented for it
|
||||
--> $WORKSPACE/src/util/macro_util.rs:62:1
|
||||
|
|
||||
62 | impl<T: ?Sized> PaddingFree<T, 0> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `IntoBytes2` has 3 total byte(s) of padding
|
||||
--> $DIR/enum.rs:638:10
|
||||
|
|
||||
638 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes2, 3>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes2, 0>` is implemented for it
|
||||
--> $WORKSPACE/src/util/macro_util.rs:62:1
|
||||
|
|
||||
62 | impl<T: ?Sized> PaddingFree<T, 0> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `IntoBytes3` has 2 total byte(s) of padding
|
||||
--> $DIR/enum.rs:647:10
|
||||
|
|
||||
647 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes3, 2>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes3, 0>` is implemented for it
|
||||
--> $WORKSPACE/src/util/macro_util.rs:62:1
|
||||
|
|
||||
62 | impl<T: ?Sized> PaddingFree<T, 0> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: generic `Self` types are currently not permitted in anonymous constants
|
||||
--> $DIR/enum.rs:672:10
|
||||
|
|
||||
672 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: not a concrete type
|
||||
--> $DIR/enum.rs:672:10
|
||||
|
|
||||
672 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `IntoBytes7` has 1 total byte(s) of padding
|
||||
--> $DIR/enum.rs:681:10
|
||||
|
|
||||
681 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes7, 1>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes7, 0>` is implemented for it
|
||||
--> $WORKSPACE/src/util/macro_util.rs:62:1
|
||||
|
|
||||
62 | impl<T: ?Sized> PaddingFree<T, 0> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `bool: FromBytes` is not satisfied
|
||||
--> $DIR/enum.rs:247:10
|
||||
|
|
||||
247 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ the trait `FromBytes` is not implemented for `bool`
|
||||
|
|
||||
= note: Consider adding `#[derive(FromBytes)]` to `bool`
|
||||
= help: the following other types implement trait `FromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 79 others
|
||||
note: required for `FooU8` to implement `FromBytes`
|
||||
--> $DIR/enum.rs:247:10
|
||||
|
|
||||
247 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `assert_is_from_bytes`
|
||||
--> $DIR/enum.rs:247:10
|
||||
|
|
||||
247 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ required by this bound in `assert_is_from_bytes`
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 52 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0552, E0565, E0566.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,14 @@
|
||||
error: FromBytes only supported on repr(u8) enum with 256 variants
|
||||
--> $DIR/enum_from_bytes_u8_too_few.rs:15:1
|
||||
|
|
||||
15 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
16 | |
|
||||
17 | | #[repr(u8)]
|
||||
18 | | enum Foo {
|
||||
... |
|
||||
273 | | Variant254,
|
||||
274 | | }
|
||||
| |_^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
error: FromBytes only supported on repr(u8) enum with 256 variants
|
||||
--> $DIR/enum_from_bytes_u8_too_few.rs:15:1
|
||||
|
|
||||
15 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
16 | |
|
||||
17 | | #[repr(u8)]
|
||||
18 | | enum Foo {
|
||||
... |
|
||||
273 | | Variant254,
|
||||
274 | | }
|
||||
| |_^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
// Copyright 2019 The Fuchsia Authors
|
||||
//
|
||||
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
||||
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
||||
// This file may not be copied, modified, or distributed except according to
|
||||
// those terms.
|
||||
|
||||
#[macro_use]
|
||||
extern crate zerocopy_renamed;
|
||||
|
||||
fn main() {}
|
||||
|
||||
#[derive(FromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
//~[msrv, stable, nightly]^ ERROR: FromBytes only supported on repr(u8) enum with 256 variants
|
||||
#[repr(u8)]
|
||||
enum Foo {
|
||||
Variant0,
|
||||
Variant1,
|
||||
Variant2,
|
||||
Variant3,
|
||||
Variant4,
|
||||
Variant5,
|
||||
Variant6,
|
||||
Variant7,
|
||||
Variant8,
|
||||
Variant9,
|
||||
Variant10,
|
||||
Variant11,
|
||||
Variant12,
|
||||
Variant13,
|
||||
Variant14,
|
||||
Variant15,
|
||||
Variant16,
|
||||
Variant17,
|
||||
Variant18,
|
||||
Variant19,
|
||||
Variant20,
|
||||
Variant21,
|
||||
Variant22,
|
||||
Variant23,
|
||||
Variant24,
|
||||
Variant25,
|
||||
Variant26,
|
||||
Variant27,
|
||||
Variant28,
|
||||
Variant29,
|
||||
Variant30,
|
||||
Variant31,
|
||||
Variant32,
|
||||
Variant33,
|
||||
Variant34,
|
||||
Variant35,
|
||||
Variant36,
|
||||
Variant37,
|
||||
Variant38,
|
||||
Variant39,
|
||||
Variant40,
|
||||
Variant41,
|
||||
Variant42,
|
||||
Variant43,
|
||||
Variant44,
|
||||
Variant45,
|
||||
Variant46,
|
||||
Variant47,
|
||||
Variant48,
|
||||
Variant49,
|
||||
Variant50,
|
||||
Variant51,
|
||||
Variant52,
|
||||
Variant53,
|
||||
Variant54,
|
||||
Variant55,
|
||||
Variant56,
|
||||
Variant57,
|
||||
Variant58,
|
||||
Variant59,
|
||||
Variant60,
|
||||
Variant61,
|
||||
Variant62,
|
||||
Variant63,
|
||||
Variant64,
|
||||
Variant65,
|
||||
Variant66,
|
||||
Variant67,
|
||||
Variant68,
|
||||
Variant69,
|
||||
Variant70,
|
||||
Variant71,
|
||||
Variant72,
|
||||
Variant73,
|
||||
Variant74,
|
||||
Variant75,
|
||||
Variant76,
|
||||
Variant77,
|
||||
Variant78,
|
||||
Variant79,
|
||||
Variant80,
|
||||
Variant81,
|
||||
Variant82,
|
||||
Variant83,
|
||||
Variant84,
|
||||
Variant85,
|
||||
Variant86,
|
||||
Variant87,
|
||||
Variant88,
|
||||
Variant89,
|
||||
Variant90,
|
||||
Variant91,
|
||||
Variant92,
|
||||
Variant93,
|
||||
Variant94,
|
||||
Variant95,
|
||||
Variant96,
|
||||
Variant97,
|
||||
Variant98,
|
||||
Variant99,
|
||||
Variant100,
|
||||
Variant101,
|
||||
Variant102,
|
||||
Variant103,
|
||||
Variant104,
|
||||
Variant105,
|
||||
Variant106,
|
||||
Variant107,
|
||||
Variant108,
|
||||
Variant109,
|
||||
Variant110,
|
||||
Variant111,
|
||||
Variant112,
|
||||
Variant113,
|
||||
Variant114,
|
||||
Variant115,
|
||||
Variant116,
|
||||
Variant117,
|
||||
Variant118,
|
||||
Variant119,
|
||||
Variant120,
|
||||
Variant121,
|
||||
Variant122,
|
||||
Variant123,
|
||||
Variant124,
|
||||
Variant125,
|
||||
Variant126,
|
||||
Variant127,
|
||||
Variant128,
|
||||
Variant129,
|
||||
Variant130,
|
||||
Variant131,
|
||||
Variant132,
|
||||
Variant133,
|
||||
Variant134,
|
||||
Variant135,
|
||||
Variant136,
|
||||
Variant137,
|
||||
Variant138,
|
||||
Variant139,
|
||||
Variant140,
|
||||
Variant141,
|
||||
Variant142,
|
||||
Variant143,
|
||||
Variant144,
|
||||
Variant145,
|
||||
Variant146,
|
||||
Variant147,
|
||||
Variant148,
|
||||
Variant149,
|
||||
Variant150,
|
||||
Variant151,
|
||||
Variant152,
|
||||
Variant153,
|
||||
Variant154,
|
||||
Variant155,
|
||||
Variant156,
|
||||
Variant157,
|
||||
Variant158,
|
||||
Variant159,
|
||||
Variant160,
|
||||
Variant161,
|
||||
Variant162,
|
||||
Variant163,
|
||||
Variant164,
|
||||
Variant165,
|
||||
Variant166,
|
||||
Variant167,
|
||||
Variant168,
|
||||
Variant169,
|
||||
Variant170,
|
||||
Variant171,
|
||||
Variant172,
|
||||
Variant173,
|
||||
Variant174,
|
||||
Variant175,
|
||||
Variant176,
|
||||
Variant177,
|
||||
Variant178,
|
||||
Variant179,
|
||||
Variant180,
|
||||
Variant181,
|
||||
Variant182,
|
||||
Variant183,
|
||||
Variant184,
|
||||
Variant185,
|
||||
Variant186,
|
||||
Variant187,
|
||||
Variant188,
|
||||
Variant189,
|
||||
Variant190,
|
||||
Variant191,
|
||||
Variant192,
|
||||
Variant193,
|
||||
Variant194,
|
||||
Variant195,
|
||||
Variant196,
|
||||
Variant197,
|
||||
Variant198,
|
||||
Variant199,
|
||||
Variant200,
|
||||
Variant201,
|
||||
Variant202,
|
||||
Variant203,
|
||||
Variant204,
|
||||
Variant205,
|
||||
Variant206,
|
||||
Variant207,
|
||||
Variant208,
|
||||
Variant209,
|
||||
Variant210,
|
||||
Variant211,
|
||||
Variant212,
|
||||
Variant213,
|
||||
Variant214,
|
||||
Variant215,
|
||||
Variant216,
|
||||
Variant217,
|
||||
Variant218,
|
||||
Variant219,
|
||||
Variant220,
|
||||
Variant221,
|
||||
Variant222,
|
||||
Variant223,
|
||||
Variant224,
|
||||
Variant225,
|
||||
Variant226,
|
||||
Variant227,
|
||||
Variant228,
|
||||
Variant229,
|
||||
Variant230,
|
||||
Variant231,
|
||||
Variant232,
|
||||
Variant233,
|
||||
Variant234,
|
||||
Variant235,
|
||||
Variant236,
|
||||
Variant237,
|
||||
Variant238,
|
||||
Variant239,
|
||||
Variant240,
|
||||
Variant241,
|
||||
Variant242,
|
||||
Variant243,
|
||||
Variant244,
|
||||
Variant245,
|
||||
Variant246,
|
||||
Variant247,
|
||||
Variant248,
|
||||
Variant249,
|
||||
Variant250,
|
||||
Variant251,
|
||||
Variant252,
|
||||
Variant253,
|
||||
Variant254,
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
error: FromBytes only supported on repr(u8) enum with 256 variants
|
||||
--> $DIR/enum_from_bytes_u8_too_few.rs:15:1
|
||||
|
|
||||
15 | / #[zerocopy(crate = "zerocopy_renamed")]
|
||||
16 | |
|
||||
17 | | #[repr(u8)]
|
||||
18 | | enum Foo {
|
||||
... |
|
||||
273 | | Variant254,
|
||||
274 | | }
|
||||
| |_^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
warning: unused import: `zerocopy_renamed::KnownLayout`
|
||||
--> $DIR/late_compile_pass.rs:15:5
|
||||
|
|
||||
15 | use zerocopy_renamed::KnownLayout;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(unused_imports)]` on by default
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:29:10
|
||||
|
|
||||
29 | #[derive(TryFromBytes)]
|
||||
| ^^^^^^^^^^^^ the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:41:10
|
||||
|
|
||||
41 | #[derive(FromZeros)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:41:10
|
||||
|
|
||||
41 | #[derive(FromZeros)]
|
||||
| ^^^^^^^^^ the trait `FromZeros` is not implemented for `NotZerocopy`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ the trait `FromZeros` is not implemented for `NotZerocopy`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::FromBytes` is not implemented for `NotZerocopy`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::IntoBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:70:10
|
||||
|
|
||||
70 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::IntoBytes` is not implemented for `NotZerocopy`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:83:10
|
||||
|
|
||||
83 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:93:10
|
||||
|
|
||||
93 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:102:10
|
||||
|
|
||||
102 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 10 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,335 @@
|
||||
warning: unused import: `zerocopy_renamed::KnownLayout`
|
||||
--> $DIR/late_compile_pass.rs:15:5
|
||||
|
|
||||
15 | use zerocopy_renamed::KnownLayout;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:29:10
|
||||
|
|
||||
29 | #[derive(TryFromBytes)]
|
||||
| ^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::TryFromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 156 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:41:10
|
||||
|
|
||||
41 | #[derive(FromZeros)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::TryFromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 156 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:41:10
|
||||
|
|
||||
41 | #[derive(FromZeros)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `FromZeros` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `FromZeros`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 143 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::TryFromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 156 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `FromZeros` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `FromZeros`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 143 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::FromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::FromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 80 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::IntoBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:70:10
|
||||
|
|
||||
70 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::IntoBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(IntoBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::IntoBytes`:
|
||||
()
|
||||
AU16
|
||||
AtomicBool
|
||||
AtomicI16
|
||||
AtomicI32
|
||||
AtomicI64
|
||||
AtomicI8
|
||||
AtomicIsize
|
||||
and 69 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:83:10
|
||||
|
|
||||
83 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `AU16`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 29 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:93:10
|
||||
|
|
||||
93 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `AU16`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 29 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:102:10
|
||||
|
|
||||
102 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `AU16`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 29 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::FromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::FromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 80 others
|
||||
note: required for `FromBytes1` to implement `zerocopy_renamed::FromBytes`
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `_::_::<impl zerocopy_renamed::TryFromBytes for FromBytes1>::is_bit_valid::assert_is_from_bytes`
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ required by this bound in `assert_is_from_bytes`
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 11 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,108 @@
|
||||
// Copyright 2019 The Fuchsia Authors
|
||||
//
|
||||
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
||||
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
||||
// This file may not be copied, modified, or distributed except according to
|
||||
// those terms.
|
||||
|
||||
#[macro_use]
|
||||
extern crate zerocopy_renamed;
|
||||
|
||||
#[path = "../include.rs"]
|
||||
mod util;
|
||||
|
||||
use zerocopy_renamed::KnownLayout;
|
||||
|
||||
use self::util::util::{NotZerocopy, AU16};
|
||||
|
||||
fn main() {}
|
||||
|
||||
// These tests cause errors which are generated by a later compilation pass than
|
||||
// the other errors we generate, and so if they're compiled in the same file,
|
||||
// the compiler will never get to that pass, and so we won't get the errors.
|
||||
|
||||
//
|
||||
// TryFromBytes errors
|
||||
//
|
||||
|
||||
#[derive(TryFromBytes)]
|
||||
//~[msrv]^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
//~[stable, nightly]^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
struct TryFromBytes1 {
|
||||
value: NotZerocopy,
|
||||
}
|
||||
|
||||
//
|
||||
// FromZeros errors
|
||||
//
|
||||
|
||||
#[derive(FromZeros)]
|
||||
//~[msrv]^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
//~[msrv, stable, nightly]^^ ERROR: the trait bound `NotZerocopy: FromZeros` is not satisfied
|
||||
//~[stable, nightly]^^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
struct FromZeros1 {
|
||||
value: NotZerocopy,
|
||||
}
|
||||
|
||||
//
|
||||
// FromBytes errors
|
||||
//
|
||||
|
||||
#[derive(FromBytes)]
|
||||
//~[msrv]^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
//~[msrv, stable, nightly]^^ ERROR: the trait bound `NotZerocopy: FromZeros` is not satisfied
|
||||
//~[msrv]^^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied
|
||||
//~[stable, nightly]^^^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
//~[stable, nightly]^^^^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied
|
||||
//~[stable, nightly]^^^^^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
struct FromBytes1 {
|
||||
value: NotZerocopy,
|
||||
}
|
||||
|
||||
//
|
||||
// IntoBytes errors
|
||||
//
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv]^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::IntoBytes` is not satisfied
|
||||
//~[stable, nightly]^^ ERROR: the trait bound `NotZerocopy: zerocopy_renamed::IntoBytes` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct IntoBytes1 {
|
||||
value: NotZerocopy,
|
||||
}
|
||||
|
||||
//
|
||||
// Unaligned errors
|
||||
//
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct Unaligned1 {
|
||||
aligned: AU16,
|
||||
}
|
||||
|
||||
// This specifically tests a bug we had in an old version of the code in which
|
||||
// the trait bound would only be enforced for the first field's type.
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct Unaligned2 {
|
||||
unaligned: u8,
|
||||
aligned: AU16,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(transparent)]
|
||||
struct Unaligned3 {
|
||||
aligned: AU16,
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
warning: unused import: `zerocopy_renamed::KnownLayout`
|
||||
--> $DIR/late_compile_pass.rs:15:5
|
||||
|
|
||||
15 | use zerocopy_renamed::KnownLayout;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:29:10
|
||||
|
|
||||
29 | #[derive(TryFromBytes)]
|
||||
| ^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::TryFromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 156 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:41:10
|
||||
|
|
||||
41 | #[derive(FromZeros)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::TryFromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 156 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:41:10
|
||||
|
|
||||
41 | #[derive(FromZeros)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `FromZeros` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `FromZeros`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 143 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::TryFromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::TryFromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(TryFromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::TryFromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 156 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: FromZeros` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `FromZeros` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromZeros)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `FromZeros`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 143 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::FromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::FromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 80 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::IntoBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:70:10
|
||||
|
|
||||
70 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::IntoBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(IntoBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::IntoBytes`:
|
||||
()
|
||||
AU16
|
||||
AtomicBool
|
||||
AtomicI16
|
||||
AtomicI32
|
||||
AtomicI64
|
||||
AtomicI8
|
||||
AtomicIsize
|
||||
and 69 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:83:10
|
||||
|
|
||||
83 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `AU16`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 29 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:93:10
|
||||
|
|
||||
93 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `AU16`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 29 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:102:10
|
||||
|
|
||||
102 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `AU16`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 29 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotZerocopy: zerocopy_renamed::FromBytes` is not satisfied
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::FromBytes` is not implemented for `NotZerocopy`
|
||||
--> $DIR/../include.rs:48:5
|
||||
|
|
||||
48 | pub struct NotZerocopy<T = ()>(pub T);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(FromBytes)]` to `NotZerocopy`
|
||||
= help: the following other types implement trait `zerocopy_renamed::FromBytes`:
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
(A, B, C, D, E, F, G)
|
||||
(A, B, C, D, E, F, G, H)
|
||||
and 80 others
|
||||
note: required for `FromBytes1` to implement `zerocopy_renamed::FromBytes`
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `_::_::<impl zerocopy_renamed::TryFromBytes for FromBytes1>::is_bit_valid::assert_is_from_bytes`
|
||||
--> $DIR/late_compile_pass.rs:54:10
|
||||
|
|
||||
54 | #[derive(FromBytes)]
|
||||
| ^^^^^^^^^ required by this bound in `assert_is_from_bytes`
|
||||
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 11 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,101 @@
|
||||
error[E0277]: the trait bound `T: KnownLayout` is not satisfied
|
||||
--> $DIR/mid_compile_pass.rs:67:26
|
||||
|
|
||||
67 | fn test_kl13<T>(t: T) -> impl KnownLayout {
|
||||
| ^^^^^^^^^^^^^^^^ the trait `KnownLayout` is not implemented for `T`
|
||||
|
|
||||
note: required because of the requirements on the impl of `KnownLayout` for `KL13<T>`
|
||||
--> $DIR/mid_compile_pass.rs:62:10
|
||||
|
|
||||
62 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T`
|
||||
|
|
||||
67 | fn test_kl13<T: zerocopy_renamed::KnownLayout>(t: T) -> impl KnownLayout {
|
||||
| +++++++++++++++++++++++++++++++
|
||||
|
||||
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
||||
--> $DIR/mid_compile_pass.rs:32:15
|
||||
|
|
||||
31 | fn test_kl04<T: ?Sized>(kl: &KL04<T>) {
|
||||
| - this type parameter needs to be `std::marker::Sized`
|
||||
32 | assert_kl(kl);
|
||||
| ^^ doesn't have a size known at compile-time
|
||||
|
|
||||
note: required because it appears within the type `KL04<T>`
|
||||
--> $DIR/mid_compile_pass.rs:29:8
|
||||
|
|
||||
29 | struct KL04<T: ?Sized>(u8, T);
|
||||
| ^^^^
|
||||
note: required because of the requirements on the impl of `KnownLayout` for `KL04<T>`
|
||||
--> $DIR/mid_compile_pass.rs:27:10
|
||||
|
|
||||
27 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^
|
||||
note: required by a bound in `assert_kl`
|
||||
--> $DIR/mid_compile_pass.rs:23:26
|
||||
|
|
||||
23 | fn assert_kl<T: ?Sized + KnownLayout>(_: &T) {}
|
||||
| ^^^^^^^^^^^ required by this bound in `assert_kl`
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
||||
|
|
||||
31 - fn test_kl04<T: ?Sized>(kl: &KL04<T>) {
|
||||
31 + fn test_kl04<T>(kl: &KL04<T>) {
|
||||
|
|
||||
|
||||
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
||||
--> $DIR/mid_compile_pass.rs:43:15
|
||||
|
|
||||
42 | fn test_kl06<T: ?Sized + KnownLayout>(kl: &KL06<T>) {
|
||||
| - this type parameter needs to be `std::marker::Sized`
|
||||
43 | assert_kl(kl);
|
||||
| ^^ doesn't have a size known at compile-time
|
||||
|
|
||||
note: required because it appears within the type `KL06<T>`
|
||||
--> $DIR/mid_compile_pass.rs:40:8
|
||||
|
|
||||
40 | struct KL06<T: ?Sized + KnownLayout>(u8, T);
|
||||
| ^^^^
|
||||
note: required because of the requirements on the impl of `KnownLayout` for `KL06<T>`
|
||||
--> $DIR/mid_compile_pass.rs:38:10
|
||||
|
|
||||
38 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^
|
||||
note: required by a bound in `assert_kl`
|
||||
--> $DIR/mid_compile_pass.rs:23:26
|
||||
|
|
||||
23 | fn assert_kl<T: ?Sized + KnownLayout>(_: &T) {}
|
||||
| ^^^^^^^^^^^ required by this bound in `assert_kl`
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
||||
|
|
||||
42 - fn test_kl06<T: ?Sized + KnownLayout>(kl: &KL06<T>) {
|
||||
42 + fn test_kl06<T: KnownLayout>(kl: &KL06<T>) {
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `T: KnownLayout` is not satisfied
|
||||
--> $DIR/mid_compile_pass.rs:55:15
|
||||
|
|
||||
55 | assert_kl(kl)
|
||||
| ^^
|
||||
| |
|
||||
| expected an implementor of trait `KnownLayout`
|
||||
| help: consider borrowing here: `&kl`
|
||||
|
|
||||
note: required because of the requirements on the impl of `KnownLayout` for `KL12<T>`
|
||||
--> $DIR/mid_compile_pass.rs:49:10
|
||||
|
|
||||
49 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^
|
||||
note: required by a bound in `assert_kl`
|
||||
--> $DIR/mid_compile_pass.rs:23:26
|
||||
|
|
||||
23 | fn assert_kl<T: ?Sized + KnownLayout>(_: &T) {}
|
||||
| ^^^^^^^^^^^ required by this bound in `assert_kl`
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,114 @@
|
||||
error[E0277]: the trait bound `T: KnownLayout` is not satisfied
|
||||
--> $DIR/mid_compile_pass.rs:67:26
|
||||
|
|
||||
67 | fn test_kl13<T>(t: T) -> impl KnownLayout {
|
||||
| ^^^^^^^^^^^^^^^^ the trait `KnownLayout` is not implemented for `T`
|
||||
68 |
|
||||
69 | KL13(0u8, t)
|
||||
| ------------ return type was inferred to be `KL13<T>` here
|
||||
|
|
||||
= note: Consider adding `#[derive(KnownLayout)]` to `T`
|
||||
note: required for `KL13<T>` to implement `KnownLayout`
|
||||
--> $DIR/mid_compile_pass.rs:62:10
|
||||
|
|
||||
62 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T` with trait `KnownLayout`
|
||||
|
|
||||
67 | fn test_kl13<T: zerocopy_renamed::KnownLayout>(t: T) -> impl KnownLayout {
|
||||
| +++++++++++++++++++++++++++++++
|
||||
|
||||
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
||||
--> $DIR/mid_compile_pass.rs:32:15
|
||||
|
|
||||
31 | fn test_kl04<T: ?Sized>(kl: &KL04<T>) {
|
||||
| - this type parameter needs to be `Sized`
|
||||
32 | assert_kl(kl);
|
||||
| --------- ^^ doesn't have a size known at compile-time
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required because it appears within the type `KL04<T>`
|
||||
--> $DIR/mid_compile_pass.rs:29:8
|
||||
|
|
||||
29 | struct KL04<T: ?Sized>(u8, T);
|
||||
| ^^^^
|
||||
note: required for `KL04<T>` to implement `KnownLayout`
|
||||
--> $DIR/mid_compile_pass.rs:27:10
|
||||
|
|
||||
27 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `assert_kl`
|
||||
--> $DIR/mid_compile_pass.rs:23:26
|
||||
|
|
||||
23 | fn assert_kl<T: ?Sized + KnownLayout>(_: &T) {}
|
||||
| ^^^^^^^^^^^ required by this bound in `assert_kl`
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
||||
|
|
||||
31 - fn test_kl04<T: ?Sized>(kl: &KL04<T>) {
|
||||
31 + fn test_kl04<T>(kl: &KL04<T>) {
|
||||
|
|
||||
|
||||
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
||||
--> $DIR/mid_compile_pass.rs:43:15
|
||||
|
|
||||
42 | fn test_kl06<T: ?Sized + KnownLayout>(kl: &KL06<T>) {
|
||||
| - this type parameter needs to be `Sized`
|
||||
43 | assert_kl(kl);
|
||||
| --------- ^^ doesn't have a size known at compile-time
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required because it appears within the type `KL06<T>`
|
||||
--> $DIR/mid_compile_pass.rs:40:8
|
||||
|
|
||||
40 | struct KL06<T: ?Sized + KnownLayout>(u8, T);
|
||||
| ^^^^
|
||||
note: required for `KL06<T>` to implement `KnownLayout`
|
||||
--> $DIR/mid_compile_pass.rs:38:10
|
||||
|
|
||||
38 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `assert_kl`
|
||||
--> $DIR/mid_compile_pass.rs:23:26
|
||||
|
|
||||
23 | fn assert_kl<T: ?Sized + KnownLayout>(_: &T) {}
|
||||
| ^^^^^^^^^^^ required by this bound in `assert_kl`
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
||||
|
|
||||
42 - fn test_kl06<T: ?Sized + KnownLayout>(kl: &KL06<T>) {
|
||||
42 + fn test_kl06<T: KnownLayout>(kl: &KL06<T>) {
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `KL12<T>: KnownLayout` is not satisfied
|
||||
--> $DIR/mid_compile_pass.rs:55:15
|
||||
|
|
||||
55 | assert_kl(kl)
|
||||
| --------- ^^ the trait `KnownLayout` is not implemented for `KL12<T>`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required for `KL12<T>` to implement `KnownLayout`
|
||||
--> $DIR/mid_compile_pass.rs:49:10
|
||||
|
|
||||
49 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `assert_kl`
|
||||
--> $DIR/mid_compile_pass.rs:23:26
|
||||
|
|
||||
23 | fn assert_kl<T: ?Sized + KnownLayout>(_: &T) {}
|
||||
| ^^^^^^^^^^^ required by this bound in `assert_kl`
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider borrowing here
|
||||
|
|
||||
55 | assert_kl(&kl)
|
||||
| +
|
||||
55 | assert_kl(&mut kl)
|
||||
| ++++
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,70 @@
|
||||
// Copyright 2023 The Fuchsia Authors
|
||||
//
|
||||
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
||||
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
||||
// This file may not be copied, modified, or distributed except according to
|
||||
// those terms.
|
||||
|
||||
extern crate zerocopy_renamed;
|
||||
|
||||
use zerocopy_renamed::KnownLayout;
|
||||
|
||||
fn main() {}
|
||||
|
||||
// These tests cause errors which are generated by a later compilation pass than
|
||||
// the other errors we generate, and so if they're compiled in the same file,
|
||||
// the compiler will never get to that pass, and so we won't get the errors.
|
||||
|
||||
//
|
||||
// KnownLayout errors
|
||||
//
|
||||
|
||||
fn assert_kl<T: ?Sized + KnownLayout>(_: &T) {}
|
||||
|
||||
// -| `repr(C)`? | generic? | `KnownLayout`? | `Sized`? | Type Name |
|
||||
// -| N | Y | N | N | KL04 |
|
||||
#[derive(KnownLayout)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
struct KL04<T: ?Sized>(u8, T);
|
||||
|
||||
fn test_kl04<T: ?Sized>(kl: &KL04<T>) {
|
||||
assert_kl(kl);
|
||||
//~[msrv, stable, nightly]^ ERROR: the size for values of type `T` cannot be known at compilation time
|
||||
}
|
||||
|
||||
// -| `repr(C)`? | generic? | `KnownLayout`? | `Sized`? | Type Name |
|
||||
// -| N | Y | Y | N | KL06 |
|
||||
#[derive(KnownLayout)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
struct KL06<T: ?Sized + KnownLayout>(u8, T);
|
||||
|
||||
fn test_kl06<T: ?Sized + KnownLayout>(kl: &KL06<T>) {
|
||||
assert_kl(kl);
|
||||
//~[msrv, stable, nightly]^ ERROR: the size for values of type `T` cannot be known at compilation time
|
||||
}
|
||||
|
||||
// -| `repr(C)`? | generic? | `KnownLayout`? | `Sized`? | Type Name |
|
||||
// -| Y | Y | N | N | KL12 |
|
||||
#[derive(KnownLayout)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct KL12<T: ?Sized>(u8, T);
|
||||
|
||||
fn test_kl12<T: ?Sized>(kl: &KL12<T>) {
|
||||
assert_kl(kl)
|
||||
//~[msrv]^ ERROR: the trait bound `T: KnownLayout` is not satisfied
|
||||
//~[stable, nightly]^^ ERROR: the trait bound `KL12<T>: KnownLayout` is not satisfied
|
||||
}
|
||||
|
||||
// -| `repr(C)`? | generic? | `KnownLayout`? | `Sized`? | Type Name |
|
||||
// -| Y | Y | N | Y | KL13 |
|
||||
#[derive(KnownLayout)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct KL13<T>(u8, T);
|
||||
|
||||
fn test_kl13<T>(t: T) -> impl KnownLayout {
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `T: KnownLayout` is not satisfied
|
||||
KL13(0u8, t)
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
error[E0277]: the trait bound `T: KnownLayout` is not satisfied
|
||||
--> $DIR/mid_compile_pass.rs:67:26
|
||||
|
|
||||
67 | fn test_kl13<T>(t: T) -> impl KnownLayout {
|
||||
| ^^^^^^^^^^^^^^^^ the trait `KnownLayout` is not implemented for `T`
|
||||
68 |
|
||||
69 | KL13(0u8, t)
|
||||
| ------------ return type was inferred to be `KL13<T>` here
|
||||
|
|
||||
= note: Consider adding `#[derive(KnownLayout)]` to `T`
|
||||
note: required for `KL13<T>` to implement `KnownLayout`
|
||||
--> $DIR/mid_compile_pass.rs:62:10
|
||||
|
|
||||
62 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T` with trait `KnownLayout`
|
||||
|
|
||||
67 | fn test_kl13<T: zerocopy_renamed::KnownLayout>(t: T) -> impl KnownLayout {
|
||||
| +++++++++++++++++++++++++++++++
|
||||
|
||||
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
||||
--> $DIR/mid_compile_pass.rs:32:15
|
||||
|
|
||||
31 | fn test_kl04<T: ?Sized>(kl: &KL04<T>) {
|
||||
| - this type parameter needs to be `Sized`
|
||||
32 | assert_kl(kl);
|
||||
| --------- ^^ doesn't have a size known at compile-time
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required because it appears within the type `KL04<T>`
|
||||
--> $DIR/mid_compile_pass.rs:29:8
|
||||
|
|
||||
29 | struct KL04<T: ?Sized>(u8, T);
|
||||
| ^^^^
|
||||
note: required for `KL04<T>` to implement `KnownLayout`
|
||||
--> $DIR/mid_compile_pass.rs:27:10
|
||||
|
|
||||
27 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `assert_kl`
|
||||
--> $DIR/mid_compile_pass.rs:23:26
|
||||
|
|
||||
23 | fn assert_kl<T: ?Sized + KnownLayout>(_: &T) {}
|
||||
| ^^^^^^^^^^^ required by this bound in `assert_kl`
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
||||
|
|
||||
31 - fn test_kl04<T: ?Sized>(kl: &KL04<T>) {
|
||||
31 + fn test_kl04<T>(kl: &KL04<T>) {
|
||||
|
|
||||
|
||||
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
||||
--> $DIR/mid_compile_pass.rs:43:15
|
||||
|
|
||||
42 | fn test_kl06<T: ?Sized + KnownLayout>(kl: &KL06<T>) {
|
||||
| - this type parameter needs to be `Sized`
|
||||
43 | assert_kl(kl);
|
||||
| --------- ^^ doesn't have a size known at compile-time
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required because it appears within the type `KL06<T>`
|
||||
--> $DIR/mid_compile_pass.rs:40:8
|
||||
|
|
||||
40 | struct KL06<T: ?Sized + KnownLayout>(u8, T);
|
||||
| ^^^^
|
||||
note: required for `KL06<T>` to implement `KnownLayout`
|
||||
--> $DIR/mid_compile_pass.rs:38:10
|
||||
|
|
||||
38 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `assert_kl`
|
||||
--> $DIR/mid_compile_pass.rs:23:26
|
||||
|
|
||||
23 | fn assert_kl<T: ?Sized + KnownLayout>(_: &T) {}
|
||||
| ^^^^^^^^^^^ required by this bound in `assert_kl`
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
||||
|
|
||||
42 - fn test_kl06<T: ?Sized + KnownLayout>(kl: &KL06<T>) {
|
||||
42 + fn test_kl06<T: KnownLayout>(kl: &KL06<T>) {
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `KL12<T>: KnownLayout` is not satisfied
|
||||
--> $DIR/mid_compile_pass.rs:55:15
|
||||
|
|
||||
55 | assert_kl(kl)
|
||||
| --------- ^^ the trait `KnownLayout` is not implemented for `KL12<T>`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required for `KL12<T>` to implement `KnownLayout`
|
||||
--> $DIR/mid_compile_pass.rs:49:10
|
||||
|
|
||||
49 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `assert_kl`
|
||||
--> $DIR/mid_compile_pass.rs:23:26
|
||||
|
|
||||
23 | fn assert_kl<T: ?Sized + KnownLayout>(_: &T) {}
|
||||
| ^^^^^^^^^^^ required by this bound in `assert_kl`
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider borrowing here
|
||||
|
|
||||
55 | assert_kl(&kl)
|
||||
| +
|
||||
55 | assert_kl(&mut kl)
|
||||
| ++++
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,29 @@
|
||||
warning: unused `#[macro_use]` import
|
||||
--> $DIR/msrv_specific.rs:12:1
|
||||
|
|
||||
12 | #[macro_use]
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(unused_imports)]` on by default
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/msrv_specific.rs:37:9
|
||||
|
|
||||
37 | is_into_bytes_1::<IntoBytes1<AU16>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
|
|
||||
note: required because of the requirements on the impl of `zerocopy_renamed::IntoBytes` for `IntoBytes1<AU16>`
|
||||
--> $DIR/msrv_specific.rs:25:10
|
||||
|
|
||||
25 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
note: required by a bound in `is_into_bytes_1`
|
||||
--> $DIR/msrv_specific.rs:35:23
|
||||
|
|
||||
35 | fn is_into_bytes_1<T: IntoBytes>() {
|
||||
| ^^^^^^^^^ required by this bound in `is_into_bytes_1`
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,45 @@
|
||||
warning: unused `#[macro_use]` import
|
||||
--> $DIR/msrv_specific.rs:12:1
|
||||
|
|
||||
12 | #[macro_use]
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/msrv_specific.rs:37:27
|
||||
|
|
||||
37 | is_into_bytes_1::<IntoBytes1<AU16>>();
|
||||
| ^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `AU16`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 26 others
|
||||
note: required for `IntoBytes1<AU16>` to implement `zerocopy_renamed::IntoBytes`
|
||||
--> $DIR/msrv_specific.rs:25:10
|
||||
|
|
||||
25 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `is_into_bytes_1`
|
||||
--> $DIR/msrv_specific.rs:35:23
|
||||
|
|
||||
35 | fn is_into_bytes_1<T: IntoBytes>() {
|
||||
| ^^^^^^^^^ required by this bound in `is_into_bytes_1`
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 1 previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,40 @@
|
||||
// Copyright 2024 The Fuchsia Authors
|
||||
//
|
||||
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
||||
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
||||
// This file may not be copied, modified, or distributed except according to
|
||||
// those terms.
|
||||
|
||||
// This file contains tests which trigger errors on MSRV during a different
|
||||
// compiler pass compared to the stable or nightly toolchains.
|
||||
|
||||
#[macro_use]
|
||||
extern crate zerocopy_renamed;
|
||||
|
||||
#[path = "../include.rs"]
|
||||
mod util;
|
||||
|
||||
use zerocopy_renamed::IntoBytes;
|
||||
|
||||
use self::util::util::AU16;
|
||||
|
||||
fn main() {}
|
||||
|
||||
// `repr(C, packed(2))` is not equivalent to `repr(C, packed)`.
|
||||
#[derive(IntoBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C, packed(2))]
|
||||
struct IntoBytes1<T> {
|
||||
t0: T,
|
||||
// Add a second field to avoid triggering the "repr(C) struct with one
|
||||
// field" special case.
|
||||
t1: T,
|
||||
}
|
||||
|
||||
fn is_into_bytes_1<T: IntoBytes>() {
|
||||
if false {
|
||||
is_into_bytes_1::<IntoBytes1<AU16>>();
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
warning: unused `#[macro_use]` import
|
||||
--> $DIR/msrv_specific.rs:12:1
|
||||
|
|
||||
12 | #[macro_use]
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/msrv_specific.rs:37:27
|
||||
|
|
||||
37 | is_into_bytes_1::<IntoBytes1<AU16>>();
|
||||
| ^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `AU16`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 26 others
|
||||
note: required for `IntoBytes1<AU16>` to implement `zerocopy_renamed::IntoBytes`
|
||||
--> $DIR/msrv_specific.rs:25:10
|
||||
|
|
||||
25 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `is_into_bytes_1`
|
||||
--> $DIR/msrv_specific.rs:35:23
|
||||
|
|
||||
35 | fn is_into_bytes_1<T: IntoBytes>() {
|
||||
| ^^^^^^^^^ required by this bound in `is_into_bytes_1`
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 1 previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:105:9
|
||||
|
|
||||
105 | _,
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:112:9
|
||||
|
|
||||
112 | _,
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:121:9
|
||||
|
|
||||
121 | _,
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:128:9
|
||||
|
|
||||
128 | _,
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:135:52
|
||||
|
|
||||
135 | let _: <Union as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(a) }>>::Type =
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:138:52
|
||||
|
|
||||
138 | let _: <Union as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(b) }>>::Type =
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:145:51
|
||||
|
|
||||
145 | let _: <Enum as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(0) }>>::Type =
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:148:51
|
||||
|
|
||||
148 | let _: <Enum as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(1) }>>::Type =
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:152:51
|
||||
|
|
||||
152 | let _: <Enum as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(a) }>>::Type =
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:31:13
|
||||
|
|
||||
31 | _,
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:37:13
|
||||
|
|
||||
37 | _,
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:50:13
|
||||
|
|
||||
50 | _,
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:56:13
|
||||
|
|
||||
56 | _,
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:70:56
|
||||
|
|
||||
70 | let _: <Union as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(a) }>>::Type = 0u8;
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:72:56
|
||||
|
|
||||
72 | let _: <Union as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(b) }>>::Type = 0u16;
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:85:55
|
||||
|
|
||||
85 | let _: <Enum as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(0) }>>::Type = 0u8;
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:87:55
|
||||
|
|
||||
87 | let _: <Enum as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(1) }>>::Type = 0u16;
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/privacy.rs:90:55
|
||||
|
|
||||
90 | let _: <Enum as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(a) }>>::Type = 0u8;
|
||||
| ^
|
||||
|
|
||||
= help: const arguments cannot yet be inferred with `_`
|
||||
|
||||
error: aborting due to 18 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0747`.
|
||||
@@ -0,0 +1,32 @@
|
||||
warning: variants `A` and `B` are never constructed
|
||||
--> $DIR/privacy.rs:80:9
|
||||
|
|
||||
79 | pub enum Enum {
|
||||
| ---- variants in this enum
|
||||
80 | A(u8, u16),
|
||||
| ^
|
||||
81 | B { a: u8, b: u16 },
|
||||
| ^
|
||||
|
|
||||
= note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
|
||||
|
||||
error: type `private::_::_::_::ẕb` is private
|
||||
--> $DIR/privacy.rs:110:9
|
||||
|
|
||||
110 | _,
|
||||
| ^ private type
|
||||
|
||||
error: type `private::_::_::_::ẕ1` is private
|
||||
--> $DIR/privacy.rs:126:9
|
||||
|
|
||||
126 | _,
|
||||
| ^ private type
|
||||
|
||||
error: type `private::_::_::_::ẕb` is private
|
||||
--> $DIR/privacy.rs:138:49
|
||||
|
|
||||
138 | let _: <Union as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(b) }>>::Type =
|
||||
| ^ private type
|
||||
|
||||
error: aborting due to 3 previous errors; 1 warning emitted
|
||||
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
// Copyright 2025 The Fuchsia Authors
|
||||
//
|
||||
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
||||
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
||||
// This file may not be copied, modified, or distributed except according to
|
||||
// those terms.
|
||||
|
||||
#![allow(unused_braces)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate zerocopy_renamed;
|
||||
|
||||
fn main() {}
|
||||
|
||||
// These tests cause errors which are generated by a later compilation pass than
|
||||
// the other errors we generate, and so if they're compiled in the same file,
|
||||
// the compiler will never get to that pass, and so we won't get the errors.
|
||||
|
||||
mod private {
|
||||
#[derive(TryFromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
pub struct StructWithNamedFields {
|
||||
pub a: u8,
|
||||
pub(self) b: u16,
|
||||
}
|
||||
|
||||
const _: () = {
|
||||
let _: <StructWithNamedFields as zerocopy_renamed::HasField<
|
||||
_,
|
||||
_,
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
{ zerocopy_renamed::ident_id!(a) },
|
||||
>>::Type = 0u8;
|
||||
let _: <StructWithNamedFields as zerocopy_renamed::HasField<
|
||||
_,
|
||||
_,
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
{ zerocopy_renamed::ident_id!(b) },
|
||||
>>::Type = 0u16;
|
||||
};
|
||||
|
||||
#[derive(TryFromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
pub struct StructWithAnonFields(pub u8, pub(self) u16);
|
||||
|
||||
const _: () = {
|
||||
let _: <StructWithAnonFields as zerocopy_renamed::HasField<
|
||||
_,
|
||||
_,
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
{ zerocopy_renamed::ident_id!(0) },
|
||||
>>::Type = 0u8;
|
||||
let _: <StructWithAnonFields as zerocopy_renamed::HasField<
|
||||
_,
|
||||
_,
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
{ zerocopy_renamed::ident_id!(1) },
|
||||
>>::Type = 0u16;
|
||||
};
|
||||
|
||||
#[derive(TryFromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
pub struct Union {
|
||||
pub a: u8,
|
||||
pub(self) b: u16,
|
||||
}
|
||||
|
||||
const _: () = {
|
||||
let _: <Union as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(a) }>>::Type = 0u8;
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
let _: <Union as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(b) }>>::Type = 0u16;
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
};
|
||||
|
||||
#[derive(TryFromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
pub enum Enum {
|
||||
A(u8, u16),
|
||||
B { a: u8, b: u16 },
|
||||
}
|
||||
|
||||
const _: () = {
|
||||
let _: <Enum as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(0) }>>::Type = 0u8;
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
let _: <Enum as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(1) }>>::Type = 0u16;
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
|
||||
let _: <Enum as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(a) }>>::Type = 0u8;
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
let _: <Enum as zerocopy_renamed::HasField<
|
||||
_,
|
||||
{ zerocopy_renamed::ident_id!(B) },
|
||||
{ zerocopy_renamed::ident_id!(b) },
|
||||
>>::Type = 0u16;
|
||||
};
|
||||
}
|
||||
|
||||
use private::*;
|
||||
|
||||
const _: () = {
|
||||
let _: <StructWithNamedFields as zerocopy_renamed::HasField<
|
||||
_,
|
||||
_,
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
{ zerocopy_renamed::ident_id!(a) },
|
||||
>>::Type = 0u8;
|
||||
let _: <StructWithNamedFields as zerocopy_renamed::HasField<
|
||||
_,
|
||||
//~[stable, nightly]^ ERROR: type `private::_::_::_::ẕb` is private
|
||||
_,
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
{ zerocopy_renamed::ident_id!(b) },
|
||||
>>::Type = 0u16;
|
||||
};
|
||||
|
||||
const _: () = {
|
||||
let _: <StructWithAnonFields as zerocopy_renamed::HasField<
|
||||
_,
|
||||
_,
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
{ zerocopy_renamed::ident_id!(0) },
|
||||
>>::Type = 0u8;
|
||||
let _: <StructWithAnonFields as zerocopy_renamed::HasField<
|
||||
_,
|
||||
//~[stable, nightly]^ ERROR: type `private::_::_::_::ẕ1` is private
|
||||
_,
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
{ zerocopy_renamed::ident_id!(1) },
|
||||
>>::Type = 0u16;
|
||||
};
|
||||
|
||||
const _: () = {
|
||||
let _: <Union as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(a) }>>::Type =
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
0u8;
|
||||
let _: <Union as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(b) }>>::Type =
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
//~[stable, nightly]^^ ERROR: type `private::_::_::_::ẕb` is private
|
||||
0u16;
|
||||
};
|
||||
|
||||
const _: () = {
|
||||
let _: <Enum as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(0) }>>::Type =
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
0u8;
|
||||
let _: <Enum as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(1) }>>::Type =
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
0u16;
|
||||
|
||||
let _: <Enum as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(a) }>>::Type =
|
||||
//~[msrv]^ ERROR: type provided when a constant was expected
|
||||
0u8;
|
||||
let _: <Enum as zerocopy_renamed::HasField<
|
||||
_,
|
||||
{ zerocopy_renamed::ident_id!(B) },
|
||||
{ zerocopy_renamed::ident_id!(b) },
|
||||
>>::Type = 0u16;
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
warning: variants `A` and `B` are never constructed
|
||||
--> $DIR/privacy.rs:80:9
|
||||
|
|
||||
79 | pub enum Enum {
|
||||
| ---- variants in this enum
|
||||
80 | A(u8, u16),
|
||||
| ^
|
||||
81 | B { a: u8, b: u16 },
|
||||
| ^
|
||||
|
|
||||
= note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
|
||||
|
||||
error: type `private::_::_::_::ẕb` is private
|
||||
--> $DIR/privacy.rs:110:9
|
||||
|
|
||||
110 | _,
|
||||
| ^ private type
|
||||
|
||||
error: type `private::_::_::_::ẕ1` is private
|
||||
--> $DIR/privacy.rs:126:9
|
||||
|
|
||||
126 | _,
|
||||
| ^ private type
|
||||
|
||||
error: type `private::_::_::_::ẕb` is private
|
||||
--> $DIR/privacy.rs:138:49
|
||||
|
|
||||
138 | let _: <Union as zerocopy_renamed::HasField<_, _, { zerocopy_renamed::ident_id!(b) }>>::Type =
|
||||
| ^ private type
|
||||
|
||||
error: aborting due to 3 previous errors; 1 warning emitted
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/struct.rs:210:11
|
||||
|
|
||||
210 | #[repr(C, C)] /$RUSTUP_TOOLCHAIN/lib/rustlib/src/rust/library/core/src/mem/mod.rs:303:22
|
||||
|
|
||||
303 | pub const fn size_of<T>() -> usize {
|
||||
| ^ required by this bound in `std::mem::size_of`
|
||||
|
||||
error[E0277]: the trait bound `(): DynamicPaddingFree<IntoBytes5, true>` is not satisfied
|
||||
--> $DIR/struct.rs:172:10
|
||||
|
|
||||
172 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ the trait `DynamicPaddingFree<IntoBytes5, true>` is not implemented for `()`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<() as DynamicPaddingFree<T, false>>
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `(): DynamicPaddingFree<IntoBytes6, true>` is not satisfied
|
||||
--> $DIR/struct.rs:184:10
|
||||
|
|
||||
184 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ the trait `DynamicPaddingFree<IntoBytes6, true>` is not implemented for `()`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<() as DynamicPaddingFree<T, false>>
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `(): DynamicPaddingFree<IntoBytes7, true>` is not satisfied
|
||||
--> $DIR/struct.rs:197:10
|
||||
|
|
||||
197 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ the trait `DynamicPaddingFree<IntoBytes7, true>` is not implemented for `()`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<() as DynamicPaddingFree<T, false>>
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `(): DynamicPaddingFree<IntoBytes13, true>` is not satisfied
|
||||
--> $DIR/struct.rs:260:10
|
||||
|
|
||||
260 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ the trait `DynamicPaddingFree<IntoBytes13, true>` is not implemented for `()`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<() as DynamicPaddingFree<T, false>>
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `SplitAtNotKnownLayout: zerocopy_renamed::KnownLayout` is not satisfied
|
||||
--> $DIR/struct.rs:328:10
|
||||
|
|
||||
328 | #[derive(SplitAt)]
|
||||
| ^^^^^^^ the trait `zerocopy_renamed::KnownLayout` is not implemented for `SplitAtNotKnownLayout`
|
||||
|
|
||||
note: required by a bound in `SplitAt`
|
||||
--> $WORKSPACE/src/split_at.rs:61:27
|
||||
|
|
||||
61 | pub unsafe trait SplitAt: KnownLayout<PointerMetadata = usize> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `SplitAt`
|
||||
= note: this error originates in the derive macro `SplitAt` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `u8: SplitAt` is not satisfied
|
||||
--> $DIR/struct.rs:334:10
|
||||
|
|
||||
334 | #[derive(SplitAt, KnownLayout)]
|
||||
| ^^^^^^^ the trait `SplitAt` is not implemented for `u8`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `SplitAt` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0271]: type mismatch resolving `<u8 as zerocopy_renamed::KnownLayout>::PointerMetadata == usize`
|
||||
--> $DIR/struct.rs:334:10
|
||||
|
|
||||
334 | #[derive(SplitAt, KnownLayout)]
|
||||
| ^^^^^^^ expected `()`, found `usize`
|
||||
|
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `SplitAt` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 31 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0271, E0277, E0692.
|
||||
For more information about an error, try `rustc --explain E0271`.
|
||||
@@ -0,0 +1,554 @@
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/struct.rs:210:8
|
||||
|
|
||||
210 | #[repr(C, C)] // zerocopy-derive conservatively treats these as conflicting reprs
|
||||
| ^^^^
|
||||
|
||||
error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/struct.rs:216:10
|
||||
|
|
||||
216 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/struct.rs:223:10
|
||||
|
|
||||
223 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/struct.rs:250:10
|
||||
|
|
||||
250 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
--> $DIR/struct.rs:273:11
|
||||
|
|
||||
273 | #[repr(C, align(2))]
|
||||
| ^^^^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/struct.rs:279:8
|
||||
|
|
||||
279 | #[repr(transparent, align(2))]
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/struct.rs:288:8
|
||||
|
|
||||
288 | #[repr(packed, align(2))]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/struct.rs:295:8
|
||||
|
|
||||
295 | #[repr(align(1), align(2))]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/struct.rs:301:8
|
||||
|
|
||||
301 | #[repr(align(2), align(4))]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/struct.rs:305:10
|
||||
|
|
||||
305 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/struct.rs:310:10
|
||||
|
|
||||
310 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/struct.rs:320:19
|
||||
|
|
||||
320 | #[repr(packed(2), C)]
|
||||
| ___________________^
|
||||
321 | |
|
||||
322 | | #[derive(Unaligned)]
|
||||
323 | | #[zerocopy(crate = "zerocopy_renamed")]
|
||||
324 | | #[repr(C, packed(2))]
|
||||
| |________^
|
||||
|
||||
error[E0692]: transparent struct cannot have other repr hints
|
||||
--> $DIR/struct.rs:279:8
|
||||
|
|
||||
279 | #[repr(transparent, align(2))]
|
||||
| ^^^^^^^^^^^ ^^^^^^^^
|
||||
|
||||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||
--> $DIR/struct.rs:31:10
|
||||
|
|
||||
31 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `KL00`, the trait `Sized` is not implemented for `[u8]`
|
||||
note: required because it appears within the type `KL00`
|
||||
--> $DIR/struct.rs:34:8
|
||||
|
|
||||
34 | struct KL00(u8, NotKnownLayoutDst);
|
||||
| ^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||
--> $DIR/struct.rs:38:10
|
||||
|
|
||||
38 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `KL02`, the trait `Sized` is not implemented for `[u8]`
|
||||
note: required because it appears within the type `KL02`
|
||||
--> $DIR/struct.rs:41:8
|
||||
|
|
||||
41 | struct KL02(u8, [u8]);
|
||||
| ^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NotKnownLayoutDst: zerocopy_renamed::KnownLayout` is not satisfied
|
||||
--> $DIR/struct.rs:45:10
|
||||
|
|
||||
45 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::KnownLayout` is not implemented for `NotKnownLayoutDst`
|
||||
--> $DIR/struct.rs:27:1
|
||||
|
|
||||
27 | struct NotKnownLayoutDst([u8]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(KnownLayout)]` to `NotKnownLayoutDst`
|
||||
= help: the following other types implement trait `zerocopy_renamed::KnownLayout`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
*const T
|
||||
*mut T
|
||||
AU16
|
||||
AtomicBool
|
||||
AtomicI16
|
||||
and 73 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `NotKnownLayout: zerocopy_renamed::KnownLayout` is not satisfied
|
||||
--> $DIR/struct.rs:53:10
|
||||
|
|
||||
53 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::KnownLayout` is not implemented for `NotKnownLayout`
|
||||
--> $DIR/struct.rs:25:1
|
||||
|
|
||||
25 | struct NotKnownLayout;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(KnownLayout)]` to `NotKnownLayout`
|
||||
= help: the following other types implement trait `zerocopy_renamed::KnownLayout`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
*const T
|
||||
*mut T
|
||||
AU16
|
||||
AtomicBool
|
||||
AtomicI16
|
||||
and 73 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `UnsafeCell<()>: zerocopy_renamed::Immutable` is not satisfied
|
||||
--> $DIR/struct.rs:63:10
|
||||
|
|
||||
63 | #[derive(Immutable)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::Immutable` is not implemented for `UnsafeCell<()>`
|
||||
|
|
||||
= note: Consider adding `#[derive(Immutable)]` to `UnsafeCell<()>`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Immutable`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
and 130 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `UnsafeCell<u8>: zerocopy_renamed::Immutable` is not satisfied
|
||||
--> $DIR/struct.rs:70:10
|
||||
|
|
||||
70 | #[derive(Immutable)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::Immutable` is not implemented for `UnsafeCell<u8>`
|
||||
|
|
||||
= note: Consider adding `#[derive(Immutable)]` to `UnsafeCell<u8>`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Immutable`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
and 130 others
|
||||
= note: required for `[UnsafeCell<u8>; 0]` to implement `zerocopy_renamed::Immutable`
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
--> $DIR/struct.rs:84:1
|
||||
|
|
||||
84 | struct TryFromBytesPacked {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: `AU16` has a `#[repr(align)]` attribute
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
--> $DIR/struct.rs:92:1
|
||||
|
|
||||
92 | struct TryFromBytesPackedN {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: `AU16` has a `#[repr(align)]` attribute
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
--> $DIR/struct.rs:100:1
|
||||
|
|
||||
100 | struct TryFromBytesCPacked {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: `AU16` has a `#[repr(align)]` attribute
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
--> $DIR/struct.rs:108:1
|
||||
|
|
||||
108 | struct TryFromBytesCPackedN {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: `AU16` has a `#[repr(align)]` attribute
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/struct.rs:120:10
|
||||
|
|
||||
120 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `AU16`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 26 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: `IntoBytes2` has 1 total byte(s) of padding
|
||||
--> $DIR/struct.rs:129:10
|
||||
|
|
||||
129 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes2, 1>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes2, 0>` is implemented for it
|
||||
--> src/util/macro_util.rs:62:0
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: `IntoBytes3` has 1 total byte(s) of padding
|
||||
--> $DIR/struct.rs:139:10
|
||||
|
|
||||
139 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes3, 1>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes3, 0>` is implemented for it
|
||||
--> src/util/macro_util.rs:62:0
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||
--> $DIR/struct.rs:158:10
|
||||
|
|
||||
158 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `IntoBytes4`, the trait `Sized` is not implemented for `[u8]`
|
||||
note: required because it appears within the type `IntoBytes4`
|
||||
--> $DIR/struct.rs:163:8
|
||||
|
|
||||
163 | struct IntoBytes4 {
|
||||
| ^^^^^^^^^^
|
||||
= note: required for `IntoBytes4` to implement `zerocopy_renamed::util::macro_util::__size_of::Sized`
|
||||
note: required by a bound in `zerocopy_renamed::util::macro_util::__size_of::size_of`
|
||||
--> src/util/macro_util.rs:306:4
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `[u8]` is unsized
|
||||
--> $DIR/struct.rs:165:8
|
||||
|
|
||||
165 | b: SliceU8,
|
||||
| ^^^^^^^ `IntoBytes` needs all field types to be `Sized` in order to determine whether there is padding
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `[u8]`
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
= note: `IntoBytes` does not require the fields of `#[repr(packed)]` types to be `Sized`
|
||||
= note: required for `[u8]` to implement `zerocopy_renamed::util::macro_util::__size_of::Sized`
|
||||
note: required by a bound in `zerocopy_renamed::util::macro_util::__size_of::size_of`
|
||||
--> src/util/macro_util.rs:306:4
|
||||
|
||||
error[E0277]: `IntoBytes5` has one or more padding bytes
|
||||
--> $DIR/struct.rs:172:10
|
||||
|
|
||||
172 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `DynamicPaddingFree<IntoBytes5, true>` is not implemented for `()`
|
||||
but trait `DynamicPaddingFree<IntoBytes5, false>` is implemented for it
|
||||
--> src/util/macro_util.rs:80:0
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: `IntoBytes6` has one or more padding bytes
|
||||
--> $DIR/struct.rs:184:10
|
||||
|
|
||||
184 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `DynamicPaddingFree<IntoBytes6, true>` is not implemented for `()`
|
||||
but trait `DynamicPaddingFree<IntoBytes6, false>` is implemented for it
|
||||
--> src/util/macro_util.rs:80:0
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: `IntoBytes7` has one or more padding bytes
|
||||
--> $DIR/struct.rs:197:10
|
||||
|
|
||||
197 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `DynamicPaddingFree<IntoBytes7, true>` is not implemented for `()`
|
||||
but trait `DynamicPaddingFree<IntoBytes7, false>` is implemented for it
|
||||
--> src/util/macro_util.rs:80:0
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: `IntoBytes13` has one or more padding bytes
|
||||
--> $DIR/struct.rs:260:10
|
||||
|
|
||||
260 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `DynamicPaddingFree<IntoBytes13, true>` is not implemented for `()`
|
||||
but trait `DynamicPaddingFree<IntoBytes13, false>` is implemented for it
|
||||
--> src/util/macro_util.rs:80:0
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0587]: type has conflicting packed and align representation hints
|
||||
--> $DIR/struct.rs:290:1
|
||||
|
|
||||
290 | struct Unaligned3;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `SplitAtNotKnownLayout: zerocopy_renamed::KnownLayout` is not satisfied
|
||||
--> $DIR/struct.rs:328:10
|
||||
|
|
||||
328 | #[derive(SplitAt)]
|
||||
| ^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::KnownLayout` is not implemented for `SplitAtNotKnownLayout`
|
||||
--> $DIR/struct.rs:332:1
|
||||
|
|
||||
332 | struct SplitAtNotKnownLayout([u8]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(KnownLayout)]` to `SplitAtNotKnownLayout`
|
||||
= help: the following other types implement trait `zerocopy_renamed::KnownLayout`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
*const T
|
||||
*mut T
|
||||
AU16
|
||||
AtomicBool
|
||||
AtomicI16
|
||||
and 73 others
|
||||
note: required by a bound in `SplitAt`
|
||||
--> src/split_at.rs:61:0
|
||||
= note: this error originates in the derive macro `SplitAt` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `u8: SplitAt` is not satisfied
|
||||
--> $DIR/struct.rs:334:10
|
||||
|
|
||||
334 | #[derive(SplitAt, KnownLayout)]
|
||||
| ^^^^^^^ the trait `SplitAt` is not implemented for `u8`
|
||||
|
|
||||
= note: Consider adding `#[derive(SplitAt)]` to `u8`
|
||||
help: the following other types implement trait `SplitAt`
|
||||
--> $DIR/struct.rs:328:10
|
||||
|
|
||||
328 | #[derive(SplitAt)]
|
||||
| ^^^^^^^ `SplitAtNotKnownLayout`
|
||||
...
|
||||
334 | #[derive(SplitAt, KnownLayout)]
|
||||
| ^^^^^^^ `SplitAtSized`
|
||||
--> src/split_at.rs:251:0
|
||||
|
|
||||
= note: `[T]`
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `SplitAt` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/struct.rs:244:28
|
||||
|
|
||||
244 | is_into_bytes_11::<IntoBytes11<AU16>>();
|
||||
| ^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `AU16`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 26 others
|
||||
note: required for `IntoBytes11<AU16>` to implement `zerocopy_renamed::IntoBytes`
|
||||
--> $DIR/struct.rs:232:10
|
||||
|
|
||||
232 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `is_into_bytes_11`
|
||||
--> $DIR/struct.rs:242:24
|
||||
|
|
||||
242 | fn is_into_bytes_11<T: IntoBytes>() {
|
||||
| ^^^^^^^^^ required by this bound in `is_into_bytes_11`
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 36 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0587, E0588, E0692.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
+339
@@ -0,0 +1,339 @@
|
||||
// Copyright 2019 The Fuchsia Authors
|
||||
//
|
||||
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
||||
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
||||
// This file may not be copied, modified, or distributed except according to
|
||||
// those terms.
|
||||
|
||||
#[macro_use]
|
||||
extern crate zerocopy_renamed;
|
||||
|
||||
#[path = "../include.rs"]
|
||||
mod util;
|
||||
|
||||
use zerocopy_renamed::{IntoBytes, KnownLayout};
|
||||
|
||||
use self::util::util::AU16;
|
||||
|
||||
fn main() {}
|
||||
|
||||
//
|
||||
// KnownLayout errors
|
||||
//
|
||||
|
||||
struct NotKnownLayout;
|
||||
|
||||
struct NotKnownLayoutDst([u8]);
|
||||
|
||||
// -| `repr(C)`? | generic? | `KnownLayout`? | `Sized`? | Type Name |
|
||||
// -| N | N | N | N | KL00 |
|
||||
#[derive(KnownLayout)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the size for values of type `[u8]` cannot be known at compilation time
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
struct KL00(u8, NotKnownLayoutDst);
|
||||
|
||||
// -| `repr(C)`? | generic? | `KnownLayout`? | `Sized`? | Type Name |
|
||||
// -| N | N | Y | N | KL02 |
|
||||
#[derive(KnownLayout)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the size for values of type `[u8]` cannot be known at compilation time
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
struct KL02(u8, [u8]);
|
||||
|
||||
// -| `repr(C)`? | generic? | `KnownLayout`? | `Sized`? | Type Name |
|
||||
// -| Y | N | N | N | KL08 |
|
||||
#[derive(KnownLayout)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `NotKnownLayoutDst: zerocopy_renamed::KnownLayout` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct KL08(u8, NotKnownLayoutDst);
|
||||
|
||||
// -| `repr(C)`? | generic? | `KnownLayout`? | `Sized`? | Type Name |
|
||||
// -| Y | N | N | Y | KL09 |
|
||||
#[derive(KnownLayout)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `NotKnownLayout: zerocopy_renamed::KnownLayout` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct KL09(NotKnownLayout, NotKnownLayout);
|
||||
|
||||
//
|
||||
// Immutable errors
|
||||
//
|
||||
|
||||
#[derive(Immutable)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `UnsafeCell<()>: zerocopy_renamed::Immutable` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
struct Immutable1 {
|
||||
a: core::cell::UnsafeCell<()>,
|
||||
}
|
||||
|
||||
#[derive(Immutable)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `UnsafeCell<u8>: zerocopy_renamed::Immutable` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
struct Immutable2 {
|
||||
a: [core::cell::UnsafeCell<u8>; 0],
|
||||
}
|
||||
|
||||
//
|
||||
// TryFromBytes errors
|
||||
//
|
||||
|
||||
#[derive(TryFromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(packed)]
|
||||
struct TryFromBytesPacked {
|
||||
//~[stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
foo: AU16,
|
||||
}
|
||||
|
||||
#[derive(TryFromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(packed(1))]
|
||||
struct TryFromBytesPackedN {
|
||||
//~[stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
foo: AU16,
|
||||
}
|
||||
|
||||
#[derive(TryFromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C, packed)]
|
||||
struct TryFromBytesCPacked {
|
||||
//~[stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
foo: AU16,
|
||||
}
|
||||
|
||||
#[derive(TryFromBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C, packed(1))]
|
||||
struct TryFromBytesCPackedN {
|
||||
//~[stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
foo: AU16,
|
||||
}
|
||||
|
||||
//
|
||||
// IntoBytes errors
|
||||
//
|
||||
|
||||
// Since `IntoBytes1` has at least one generic parameter, an `IntoBytes` impl is
|
||||
// emitted in which each field type is given an `Unaligned` bound. Since `foo`'s
|
||||
// type doesn't implement `Unaligned`, this should fail.
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct IntoBytes1<T> {
|
||||
foo: AU16,
|
||||
bar: T,
|
||||
}
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[stable, nightly]^ ERROR: `IntoBytes2` has 1 total byte(s) of padding
|
||||
//~[msrv]^^ ERROR: the trait bound `(): PaddingFree<IntoBytes2, 1_usize>` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct IntoBytes2 {
|
||||
foo: u8,
|
||||
bar: AU16,
|
||||
}
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[stable, nightly]^ ERROR: `IntoBytes3` has 1 total byte(s) of padding
|
||||
//~[msrv]^^ ERROR: the trait bound `(): PaddingFree<IntoBytes3, 1_usize>` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C, packed(2))]
|
||||
struct IntoBytes3 {
|
||||
foo: u8,
|
||||
// We'd prefer to use AU64 here, but you can't use aligned types in
|
||||
// packed structs.
|
||||
bar: u64,
|
||||
}
|
||||
|
||||
type SliceU8 = [u8];
|
||||
|
||||
// Padding between `u8` and `SliceU8`. `SliceU8` doesn't syntactically look like
|
||||
// a slice, so this case is handled by our `Sized` support.
|
||||
//
|
||||
// NOTE(#1708): This exists to ensure that our error messages are good when a
|
||||
// field is unsized.
|
||||
#[derive(IntoBytes)]
|
||||
//~[stable, nightly]^ ERROR: the size for values of type `[u8]` cannot be known at compilation time
|
||||
//~[msrv]^^ ERROR: the size for values of type `[u8]` cannot be known at compilation time
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct IntoBytes4 {
|
||||
a: u8,
|
||||
b: SliceU8,
|
||||
//~[stable, nightly]^ ERROR: `[u8]` is unsized
|
||||
//~[msrv]^^ ERROR: the size for values of type `[u8]` cannot be known at compilation time
|
||||
}
|
||||
|
||||
// Padding between `u8` and `[u16]`. `[u16]` is syntactically identifiable as a
|
||||
// slice, so this case is handled by our `repr(C)` slice DST support.
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv]^ ERROR: the trait bound `(): DynamicPaddingFree<IntoBytes5, true>` is not satisfied
|
||||
//~[stable, nightly]^^ ERROR: `IntoBytes5` has one or more padding bytes
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct IntoBytes5 {
|
||||
a: u8,
|
||||
b: [u16],
|
||||
}
|
||||
|
||||
// Trailing padding after `[u8]`. `[u8]` is syntactically identifiable as a
|
||||
// slice, so this case is handled by our `repr(C)` slice DST support.
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv]^ ERROR: the trait bound `(): DynamicPaddingFree<IntoBytes6, true>` is not satisfied
|
||||
//~[stable, nightly]^^ ERROR: `IntoBytes6` has one or more padding bytes
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct IntoBytes6 {
|
||||
a: u16,
|
||||
b: [u8],
|
||||
}
|
||||
|
||||
// Padding between `u8` and `u16` and also trailing padding after `[u8]`. `[u8]`
|
||||
// is syntactically identifiable as a slice, so this case is handled by our
|
||||
// `repr(C)` slice DST support.
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv]^ ERROR: the trait bound `(): DynamicPaddingFree<IntoBytes7, true>` is not satisfied
|
||||
//~[stable, nightly]^^ ERROR: `IntoBytes7` has one or more padding bytes
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct IntoBytes7 {
|
||||
a: u8,
|
||||
b: u16,
|
||||
c: [u8],
|
||||
}
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C, C)] // zerocopy-derive conservatively treats these as conflicting reprs
|
||||
//~[msrv, stable, nightly]^ ERROR: this conflicts with another representation hint
|
||||
struct IntoBytes8 {
|
||||
a: u8,
|
||||
}
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
struct IntoBytes9<T> {
|
||||
t: T,
|
||||
}
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(packed(2))]
|
||||
struct IntoBytes10<T> {
|
||||
t: T,
|
||||
}
|
||||
|
||||
// `repr(C, packed(2))` is not equivalent to `repr(C, packed)`.
|
||||
#[derive(IntoBytes)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C, packed(2))]
|
||||
struct IntoBytes11<T> {
|
||||
t0: T,
|
||||
// Add a second field to avoid triggering the "repr(C) struct with one
|
||||
// field" special case.
|
||||
t1: T,
|
||||
}
|
||||
|
||||
fn is_into_bytes_11<T: IntoBytes>() {
|
||||
if false {
|
||||
is_into_bytes_11::<IntoBytes11<AU16>>();
|
||||
//~[stable, nightly]^ ERROR: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
}
|
||||
}
|
||||
|
||||
// `repr(C, align(2))` is not sufficient to guarantee the layout of this type.
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C, align(2))]
|
||||
struct IntoBytes12<T> {
|
||||
t: T,
|
||||
}
|
||||
|
||||
// NOTE(#3063): This exists to ensure that our analysis for structs with
|
||||
// syntactic DSTs accounts for `align(N)`.
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv]^ ERROR: the trait bound `(): DynamicPaddingFree<IntoBytes13, true>` is not satisfied
|
||||
//~[stable, nightly]^^ ERROR: `IntoBytes13` has one or more padding bytes
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C, align(2))]
|
||||
struct IntoBytes13([u8]);
|
||||
|
||||
//
|
||||
// Unaligned errors
|
||||
//
|
||||
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C, align(2))]
|
||||
//~[msrv, stable, nightly]^ ERROR: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
struct Unaligned1;
|
||||
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(transparent, align(2))]
|
||||
//~[msrv, stable, nightly]^ ERROR: this conflicts with another representation hint
|
||||
//~[msrv, stable, nightly]^^ ERROR: transparent struct cannot have other repr hints
|
||||
struct Unaligned2 {
|
||||
foo: u8,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(packed, align(2))]
|
||||
//~[msrv, stable, nightly]^ ERROR: this conflicts with another representation hint
|
||||
struct Unaligned3;
|
||||
//~[stable, nightly]^ ERROR: type has conflicting packed and align representation hints
|
||||
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(align(1), align(2))]
|
||||
//~[msrv, stable, nightly]^ ERROR: this conflicts with another representation hint
|
||||
struct Unaligned4;
|
||||
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(align(2), align(4))]
|
||||
//~[msrv, stable, nightly]^ ERROR: this conflicts with another representation hint
|
||||
struct Unaligned5;
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
struct Unaligned6;
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(packed(2))]
|
||||
struct Unaligned7;
|
||||
|
||||
// Test the error message emitted when conflicting reprs appear on different
|
||||
// lines. On the nightly compiler, this emits a "joint span" that spans both
|
||||
// problematic repr token trees and everything in between.
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(packed(2), C)]
|
||||
//~[nightly]^ ERROR: this conflicts with another representation hint
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C, packed(2))]
|
||||
//~[msrv, stable]^ ERROR: this conflicts with another representation hint
|
||||
struct WeirdReprSpan;
|
||||
|
||||
#[derive(SplitAt)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `SplitAtNotKnownLayout: zerocopy_renamed::KnownLayout` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct SplitAtNotKnownLayout([u8]);
|
||||
|
||||
#[derive(SplitAt, KnownLayout)]
|
||||
//~[msrv]^ ERROR: type mismatch resolving `<u8 as zerocopy_renamed::KnownLayout>::PointerMetadata == usize`
|
||||
//~[msrv, stable, nightly]^^ ERROR: the trait bound `u8: SplitAt` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
struct SplitAtSized(u8);
|
||||
@@ -0,0 +1,522 @@
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/struct.rs:210:11
|
||||
|
|
||||
210 | #[repr(C, C)] // zerocopy-derive conservatively treats these as conflicting reprs
|
||||
| ^
|
||||
|
||||
error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/struct.rs:216:10
|
||||
|
|
||||
216 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/struct.rs:223:10
|
||||
|
|
||||
223 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have a non-align #[repr(...)] attribute in order to guarantee this type's memory layout
|
||||
--> $DIR/struct.rs:250:10
|
||||
|
|
||||
250 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
--> $DIR/struct.rs:273:11
|
||||
|
|
||||
273 | #[repr(C, align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/struct.rs:279:8
|
||||
|
|
||||
279 | #[repr(transparent, align(2))]
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/struct.rs:288:16
|
||||
|
|
||||
288 | #[repr(packed, align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/struct.rs:295:18
|
||||
|
|
||||
295 | #[repr(align(1), align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/struct.rs:301:18
|
||||
|
|
||||
301 | #[repr(align(2), align(4))]
|
||||
| ^^^^^
|
||||
|
||||
error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/struct.rs:305:10
|
||||
|
|
||||
305 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/struct.rs:310:10
|
||||
|
|
||||
310 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/struct.rs:324:8
|
||||
|
|
||||
324 | #[repr(C, packed(2))]
|
||||
| ^
|
||||
|
||||
error[E0692]: transparent struct cannot have other repr hints
|
||||
--> $DIR/struct.rs:279:8
|
||||
|
|
||||
279 | #[repr(transparent, align(2))]
|
||||
| ^^^^^^^^^^^ ^^^^^^^^
|
||||
|
||||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||
--> $DIR/struct.rs:31:10
|
||||
|
|
||||
31 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `KL00`, the trait `Sized` is not implemented for `[u8]`
|
||||
note: required because it appears within the type `KL00`
|
||||
--> $DIR/struct.rs:34:8
|
||||
|
|
||||
34 | struct KL00(u8, NotKnownLayoutDst);
|
||||
| ^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||
--> $DIR/struct.rs:38:10
|
||||
|
|
||||
38 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `KL02`, the trait `Sized` is not implemented for `[u8]`
|
||||
note: required because it appears within the type `KL02`
|
||||
--> $DIR/struct.rs:41:8
|
||||
|
|
||||
41 | struct KL02(u8, [u8]);
|
||||
| ^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotKnownLayoutDst: zerocopy_renamed::KnownLayout` is not satisfied
|
||||
--> $DIR/struct.rs:45:10
|
||||
|
|
||||
45 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::KnownLayout` is not implemented for `NotKnownLayoutDst`
|
||||
--> $DIR/struct.rs:27:1
|
||||
|
|
||||
27 | struct NotKnownLayoutDst([u8]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(KnownLayout)]` to `NotKnownLayoutDst`
|
||||
= help: the following other types implement trait `zerocopy_renamed::KnownLayout`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
*const T
|
||||
*mut T
|
||||
AU16
|
||||
AtomicBool
|
||||
AtomicI16
|
||||
and 73 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `NotKnownLayout: zerocopy_renamed::KnownLayout` is not satisfied
|
||||
--> $DIR/struct.rs:53:10
|
||||
|
|
||||
53 | #[derive(KnownLayout)]
|
||||
| ^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::KnownLayout` is not implemented for `NotKnownLayout`
|
||||
--> $DIR/struct.rs:25:1
|
||||
|
|
||||
25 | struct NotKnownLayout;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(KnownLayout)]` to `NotKnownLayout`
|
||||
= help: the following other types implement trait `zerocopy_renamed::KnownLayout`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
*const T
|
||||
*mut T
|
||||
AU16
|
||||
AtomicBool
|
||||
AtomicI16
|
||||
and 73 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `UnsafeCell<()>: zerocopy_renamed::Immutable` is not satisfied
|
||||
--> $DIR/struct.rs:63:10
|
||||
|
|
||||
63 | #[derive(Immutable)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::Immutable` is not implemented for `UnsafeCell<()>`
|
||||
|
|
||||
= note: Consider adding `#[derive(Immutable)]` to `UnsafeCell<()>`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Immutable`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
and 130 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `UnsafeCell<u8>: zerocopy_renamed::Immutable` is not satisfied
|
||||
--> $DIR/struct.rs:70:10
|
||||
|
|
||||
70 | #[derive(Immutable)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::Immutable` is not implemented for `UnsafeCell<u8>`
|
||||
|
|
||||
= note: Consider adding `#[derive(Immutable)]` to `UnsafeCell<u8>`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Immutable`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
and 130 others
|
||||
= note: required for `[UnsafeCell<u8>; 0]` to implement `zerocopy_renamed::Immutable`
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
--> $DIR/struct.rs:84:1
|
||||
|
|
||||
84 | struct TryFromBytesPacked {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: `AU16` has a `#[repr(align)]` attribute
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
--> $DIR/struct.rs:92:1
|
||||
|
|
||||
92 | struct TryFromBytesPackedN {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: `AU16` has a `#[repr(align)]` attribute
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
--> $DIR/struct.rs:100:1
|
||||
|
|
||||
100 | struct TryFromBytesCPacked {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: `AU16` has a `#[repr(align)]` attribute
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
--> $DIR/struct.rs:108:1
|
||||
|
|
||||
108 | struct TryFromBytesCPackedN {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: `AU16` has a `#[repr(align)]` attribute
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/struct.rs:120:10
|
||||
|
|
||||
120 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `AU16`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 26 others
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `IntoBytes2` has 1 total byte(s) of padding
|
||||
--> $DIR/struct.rs:129:10
|
||||
|
|
||||
129 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes2, 1>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes2, 0>` is implemented for it
|
||||
--> $WORKSPACE/src/util/macro_util.rs:62:1
|
||||
|
|
||||
62 | impl<T: ?Sized> PaddingFree<T, 0> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `IntoBytes3` has 1 total byte(s) of padding
|
||||
--> $DIR/struct.rs:139:10
|
||||
|
|
||||
139 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes3, 1>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes3, 0>` is implemented for it
|
||||
--> $WORKSPACE/src/util/macro_util.rs:62:1
|
||||
|
|
||||
62 | impl<T: ?Sized> PaddingFree<T, 0> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||
--> $DIR/struct.rs:158:10
|
||||
|
|
||||
158 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `IntoBytes4`, the trait `Sized` is not implemented for `[u8]`
|
||||
note: required because it appears within the type `IntoBytes4`
|
||||
--> $DIR/struct.rs:163:8
|
||||
|
|
||||
163 | struct IntoBytes4 {
|
||||
| ^^^^^^^^^^
|
||||
= note: required for `IntoBytes4` to implement `macro_util::__size_of::Sized`
|
||||
note: required by a bound in `macro_util::__size_of::size_of`
|
||||
--> $WORKSPACE/src/util/macro_util.rs:306:29
|
||||
|
|
||||
306 | pub const fn size_of<T: Sized + ?core::marker::Sized>() -> usize {
|
||||
| ^^^^^ required by this bound in `size_of`
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `[u8]` is unsized
|
||||
--> $DIR/struct.rs:165:8
|
||||
|
|
||||
165 | b: SliceU8,
|
||||
| ^^^^^^^ `IntoBytes` needs all field types to be `Sized` in order to determine whether there is padding
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `[u8]`
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
= note: `IntoBytes` does not require the fields of `#[repr(packed)]` types to be `Sized`
|
||||
= note: required for `[u8]` to implement `macro_util::__size_of::Sized`
|
||||
note: required by a bound in `macro_util::__size_of::size_of`
|
||||
--> $WORKSPACE/src/util/macro_util.rs:306:29
|
||||
|
|
||||
306 | pub const fn size_of<T: Sized + ?core::marker::Sized>() -> usize {
|
||||
| ^^^^^ required by this bound in `size_of`
|
||||
|
||||
error[E0277]: `IntoBytes5` has one or more padding bytes
|
||||
--> $DIR/struct.rs:172:10
|
||||
|
|
||||
172 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `DynamicPaddingFree<IntoBytes5, true>` is not implemented for `()`
|
||||
but trait `DynamicPaddingFree<IntoBytes5, false>` is implemented for it
|
||||
--> $WORKSPACE/src/util/macro_util.rs:80:1
|
||||
|
|
||||
80 | impl<T: ?Sized> DynamicPaddingFree<T, false> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `IntoBytes6` has one or more padding bytes
|
||||
--> $DIR/struct.rs:184:10
|
||||
|
|
||||
184 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `DynamicPaddingFree<IntoBytes6, true>` is not implemented for `()`
|
||||
but trait `DynamicPaddingFree<IntoBytes6, false>` is implemented for it
|
||||
--> $WORKSPACE/src/util/macro_util.rs:80:1
|
||||
|
|
||||
80 | impl<T: ?Sized> DynamicPaddingFree<T, false> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `IntoBytes7` has one or more padding bytes
|
||||
--> $DIR/struct.rs:197:10
|
||||
|
|
||||
197 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `DynamicPaddingFree<IntoBytes7, true>` is not implemented for `()`
|
||||
but trait `DynamicPaddingFree<IntoBytes7, false>` is implemented for it
|
||||
--> $WORKSPACE/src/util/macro_util.rs:80:1
|
||||
|
|
||||
80 | impl<T: ?Sized> DynamicPaddingFree<T, false> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `IntoBytes13` has one or more padding bytes
|
||||
--> $DIR/struct.rs:260:10
|
||||
|
|
||||
260 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `DynamicPaddingFree<IntoBytes13, true>` is not implemented for `()`
|
||||
but trait `DynamicPaddingFree<IntoBytes13, false>` is implemented for it
|
||||
--> $WORKSPACE/src/util/macro_util.rs:80:1
|
||||
|
|
||||
80 | impl<T: ?Sized> DynamicPaddingFree<T, false> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0587]: type has conflicting packed and align representation hints
|
||||
--> $DIR/struct.rs:290:1
|
||||
|
|
||||
290 | struct Unaligned3;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `SplitAtNotKnownLayout: zerocopy_renamed::KnownLayout` is not satisfied
|
||||
--> $DIR/struct.rs:328:10
|
||||
|
|
||||
328 | #[derive(SplitAt)]
|
||||
| ^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::KnownLayout` is not implemented for `SplitAtNotKnownLayout`
|
||||
--> $DIR/struct.rs:332:1
|
||||
|
|
||||
332 | struct SplitAtNotKnownLayout([u8]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(KnownLayout)]` to `SplitAtNotKnownLayout`
|
||||
= help: the following other types implement trait `zerocopy_renamed::KnownLayout`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
*const T
|
||||
*mut T
|
||||
AU16
|
||||
AtomicBool
|
||||
AtomicI16
|
||||
and 73 others
|
||||
note: required by a bound in `SplitAt`
|
||||
--> $WORKSPACE/src/split_at.rs:61:27
|
||||
|
|
||||
61 | pub unsafe trait SplitAt: KnownLayout<PointerMetadata = usize> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `SplitAt`
|
||||
= note: this error originates in the derive macro `SplitAt` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `u8: SplitAt` is not satisfied
|
||||
--> $DIR/struct.rs:334:10
|
||||
|
|
||||
334 | #[derive(SplitAt, KnownLayout)]
|
||||
| ^^^^^^^ the trait `SplitAt` is not implemented for `u8`
|
||||
|
|
||||
= note: Consider adding `#[derive(SplitAt)]` to `u8`
|
||||
help: the following other types implement trait `SplitAt`
|
||||
--> $DIR/struct.rs:328:10
|
||||
|
|
||||
328 | #[derive(SplitAt)]
|
||||
| ^^^^^^^ `SplitAtNotKnownLayout`
|
||||
...
|
||||
334 | #[derive(SplitAt, KnownLayout)]
|
||||
| ^^^^^^^ `SplitAtSized`
|
||||
|
|
||||
::: $WORKSPACE/src/split_at.rs:251:1
|
||||
|
|
||||
251 | unsafe impl<T> SplitAt for [T] {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[T]`
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `SplitAt` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `AU16: zerocopy_renamed::Unaligned` is not satisfied
|
||||
--> $DIR/struct.rs:244:28
|
||||
|
|
||||
244 | is_into_bytes_11::<IntoBytes11<AU16>>();
|
||||
| ^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
|
|
||||
help: the trait `zerocopy_renamed::Unaligned` is not implemented for `AU16`
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: Consider adding `#[derive(Unaligned)]` to `AU16`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Unaligned`:
|
||||
()
|
||||
AtomicBool
|
||||
AtomicI8
|
||||
AtomicU8
|
||||
Cell<T>
|
||||
F32<O>
|
||||
F64<O>
|
||||
I128<O>
|
||||
and 26 others
|
||||
note: required for `IntoBytes11<AU16>` to implement `zerocopy_renamed::IntoBytes`
|
||||
--> $DIR/struct.rs:232:10
|
||||
|
|
||||
232 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required by a bound in `is_into_bytes_11`
|
||||
--> $DIR/struct.rs:242:24
|
||||
|
|
||||
242 | fn is_into_bytes_11<T: IntoBytes>() {
|
||||
| ^^^^^^^^^ required by this bound in `is_into_bytes_11`
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 36 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0587, E0588, E0692.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,88 @@
|
||||
error: unsupported on types with type parameters
|
||||
--> $DIR/union.rs:36:10
|
||||
|
|
||||
36 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)]
|
||||
--> $DIR/union.rs:55:10
|
||||
|
|
||||
55 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)]
|
||||
--> $DIR/union.rs:63:10
|
||||
|
|
||||
63 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
--> $DIR/union.rs:77:11
|
||||
|
|
||||
77 | #[repr(C, align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/union.rs:95:16
|
||||
|
|
||||
95 | #[repr(packed, align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/union.rs:104:18
|
||||
|
|
||||
104 | #[repr(align(1), align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/union.rs:112:18
|
||||
|
|
||||
112 | #[repr(align(2), align(4))]
|
||||
| ^^^^^
|
||||
|
||||
error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/union.rs:118:10
|
||||
|
|
||||
118 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/union.rs:126:10
|
||||
|
|
||||
126 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `UnsafeCell<()>: zerocopy_renamed::Immutable` is not satisfied
|
||||
--> $DIR/union.rs:25:10
|
||||
|
|
||||
25 | #[derive(Immutable)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::Immutable` is not implemented for `UnsafeCell<()>`
|
||||
|
|
||||
= note: required because of the requirements on the impl of `zerocopy_renamed::Immutable` for `ManuallyDrop<UnsafeCell<()>>`
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `(): PaddingFree<IntoBytes2, 1_usize>` is not satisfied
|
||||
--> $DIR/union.rs:44:10
|
||||
|
|
||||
44 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ the trait `PaddingFree<IntoBytes2, 1_usize>` is not implemented for `()`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<() as PaddingFree<T, 0_usize>>
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -0,0 +1,130 @@
|
||||
error: unsupported on types with type parameters
|
||||
--> $DIR/union.rs:36:10
|
||||
|
|
||||
36 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)]
|
||||
--> $DIR/union.rs:55:10
|
||||
|
|
||||
55 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)]
|
||||
--> $DIR/union.rs:63:10
|
||||
|
|
||||
63 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
--> $DIR/union.rs:77:11
|
||||
|
|
||||
77 | #[repr(C, align(2))]
|
||||
| ^^^^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/union.rs:95:8
|
||||
|
|
||||
95 | #[repr(packed, align(2))]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/union.rs:104:8
|
||||
|
|
||||
104 | #[repr(align(1), align(2))]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/union.rs:112:8
|
||||
|
|
||||
112 | #[repr(align(2), align(4))]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/union.rs:118:10
|
||||
|
|
||||
118 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/union.rs:126:10
|
||||
|
|
||||
126 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `UnsafeCell<()>: zerocopy_renamed::Immutable` is not satisfied
|
||||
--> $DIR/union.rs:25:10
|
||||
|
|
||||
25 | #[derive(Immutable)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::Immutable` is not implemented for `UnsafeCell<()>`
|
||||
|
|
||||
= note: Consider adding `#[derive(Immutable)]` to `UnsafeCell<()>`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Immutable`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
and 129 others
|
||||
= note: required for `ManuallyDrop<UnsafeCell<()>>` to implement `zerocopy_renamed::Immutable`
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0277]: `IntoBytes2` has 1 total byte(s) of padding
|
||||
--> $DIR/union.rs:44:10
|
||||
|
|
||||
44 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes2, 1>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes2, 0>` is implemented for it
|
||||
--> src/util/macro_util.rs:62:0
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
9 + #![feature(trivial_bounds)]
|
||||
|
|
||||
|
||||
error[E0587]: type has conflicting packed and align representation hints
|
||||
--> $DIR/union.rs:97:1
|
||||
|
|
||||
97 | union Unaligned3 {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
--> $DIR/union.rs:130:1
|
||||
|
|
||||
130 | union Unaligned7 {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: `AU16` has a `#[repr(align)]` attribute
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 13 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0587, E0588.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
// Copyright 2019 The Fuchsia Authors
|
||||
//
|
||||
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
|
||||
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
|
||||
// This file may not be copied, modified, or distributed except according to
|
||||
// those terms.
|
||||
|
||||
#[macro_use]
|
||||
extern crate zerocopy_renamed;
|
||||
|
||||
#[path = "../include.rs"]
|
||||
mod util;
|
||||
|
||||
use std::mem::ManuallyDrop;
|
||||
|
||||
use self::util::util::AU16;
|
||||
|
||||
fn main() {}
|
||||
|
||||
//
|
||||
// Immutable errors
|
||||
//
|
||||
|
||||
#[derive(Immutable)]
|
||||
//~[msrv, stable, nightly]^ ERROR: the trait bound `UnsafeCell<()>: zerocopy_renamed::Immutable` is not satisfied
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
union Immutable1 {
|
||||
a: ManuallyDrop<core::cell::UnsafeCell<()>>,
|
||||
}
|
||||
|
||||
//
|
||||
// IntoBytes errors
|
||||
//
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: unsupported on types with type parameters
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
union IntoBytes1<T> {
|
||||
foo: ManuallyDrop<T>,
|
||||
}
|
||||
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv]^ ERROR: the trait bound `(): PaddingFree<IntoBytes2, 1_usize>` is not satisfied
|
||||
//~[stable, nightly]^^ ERROR: `IntoBytes2` has 1 total byte(s) of padding
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C)]
|
||||
union IntoBytes2 {
|
||||
foo: u8,
|
||||
bar: [u8; 2],
|
||||
}
|
||||
|
||||
// Need a `repr` attribute
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
union IntoBytes3 {
|
||||
foo: u8,
|
||||
}
|
||||
|
||||
// `repr(packed(2))` isn't equivalent to `repr(packed)`
|
||||
#[derive(IntoBytes)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(packed(2))]
|
||||
union IntoBytes4 {
|
||||
foo: u8,
|
||||
}
|
||||
|
||||
//
|
||||
// Unaligned errors
|
||||
//
|
||||
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(C, align(2))]
|
||||
//~[msrv, stable, nightly]^ ERROR: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
union Unaligned1 {
|
||||
foo: i16,
|
||||
bar: AU16,
|
||||
}
|
||||
|
||||
// Transparent unions are unstable; see issue #60405
|
||||
// <https://github.com/rust-lang/rust/issues/60405> for more information.
|
||||
|
||||
// #[derive(Unaligned)]
|
||||
// #[repr(transparent, align(2))]
|
||||
// union Unaligned2 {
|
||||
// foo: u8,
|
||||
// }
|
||||
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(packed, align(2))]
|
||||
//~[msrv, stable, nightly]^ ERROR: this conflicts with another representation hint
|
||||
union Unaligned3 {
|
||||
//~[stable, nightly]^ ERROR: type has conflicting packed and align representation hints
|
||||
foo: u8,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(align(1), align(2))]
|
||||
//~[msrv, stable, nightly]^ ERROR: this conflicts with another representation hint
|
||||
struct Unaligned4 {
|
||||
foo: u8,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(align(2), align(4))]
|
||||
//~[msrv, stable, nightly]^ ERROR: this conflicts with another representation hint
|
||||
struct Unaligned5 {
|
||||
foo: u8,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
union Unaligned6 {
|
||||
foo: i16,
|
||||
bar: AU16,
|
||||
}
|
||||
|
||||
#[derive(Unaligned)]
|
||||
//~[msrv, stable, nightly]^ ERROR: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
#[zerocopy(crate = "zerocopy_renamed")]
|
||||
#[repr(packed(2))]
|
||||
union Unaligned7 {
|
||||
//~[stable, nightly]^ ERROR: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
foo: i16,
|
||||
bar: AU16,
|
||||
}
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
error: unsupported on types with type parameters
|
||||
--> $DIR/union.rs:36:10
|
||||
|
|
||||
36 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)]
|
||||
--> $DIR/union.rs:55:10
|
||||
|
|
||||
55 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must be #[repr(C)], #[repr(packed)], or #[repr(transparent)]
|
||||
--> $DIR/union.rs:63:10
|
||||
|
|
||||
63 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: cannot derive `Unaligned` on type with alignment greater than 1
|
||||
--> $DIR/union.rs:77:11
|
||||
|
|
||||
77 | #[repr(C, align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/union.rs:95:16
|
||||
|
|
||||
95 | #[repr(packed, align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/union.rs:104:18
|
||||
|
|
||||
104 | #[repr(align(1), align(2))]
|
||||
| ^^^^^
|
||||
|
||||
error: this conflicts with another representation hint
|
||||
--> $DIR/union.rs:112:18
|
||||
|
|
||||
112 | #[repr(align(2), align(4))]
|
||||
| ^^^^^
|
||||
|
||||
error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/union.rs:118:10
|
||||
|
|
||||
118 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: must have #[repr(C)], #[repr(transparent)], or #[repr(packed)] attribute in order to guarantee this type's alignment
|
||||
--> $DIR/union.rs:126:10
|
||||
|
|
||||
126 | #[derive(Unaligned)]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `UnsafeCell<()>: zerocopy_renamed::Immutable` is not satisfied
|
||||
--> $DIR/union.rs:25:10
|
||||
|
|
||||
25 | #[derive(Immutable)]
|
||||
| ^^^^^^^^^ the trait `zerocopy_renamed::Immutable` is not implemented for `UnsafeCell<()>`
|
||||
|
|
||||
= note: Consider adding `#[derive(Immutable)]` to `UnsafeCell<()>`
|
||||
= help: the following other types implement trait `zerocopy_renamed::Immutable`:
|
||||
&T
|
||||
&mut T
|
||||
()
|
||||
(A, B)
|
||||
(A, B, C)
|
||||
(A, B, C, D)
|
||||
(A, B, C, D, E)
|
||||
(A, B, C, D, E, F)
|
||||
and 129 others
|
||||
= note: required for `ManuallyDrop<UnsafeCell<()>>` to implement `zerocopy_renamed::Immutable`
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `Immutable` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `IntoBytes2` has 1 total byte(s) of padding
|
||||
--> $DIR/union.rs:44:10
|
||||
|
|
||||
44 | #[derive(IntoBytes)]
|
||||
| ^^^^^^^^^ types with padding cannot implement `IntoBytes`
|
||||
|
|
||||
= note: consider using `zerocopy::Unalign` to lower the alignment of individual fields
|
||||
= note: consider adding explicit fields where padding would be
|
||||
= note: consider using `#[repr(packed)]` to remove padding
|
||||
help: the trait `PaddingFree<IntoBytes2, 1>` is not implemented for `()`
|
||||
but trait `PaddingFree<IntoBytes2, 0>` is implemented for it
|
||||
--> $WORKSPACE/src/util/macro_util.rs:62:1
|
||||
|
|
||||
62 | impl<T: ?Sized> PaddingFree<T, 0> for () {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: see issue #48214
|
||||
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0587]: type has conflicting packed and align representation hints
|
||||
--> $DIR/union.rs:97:1
|
||||
|
|
||||
97 | union Unaligned3 {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
|
||||
--> $DIR/union.rs:130:1
|
||||
|
|
||||
130 | union Unaligned7 {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: `AU16` has a `#[repr(align)]` attribute
|
||||
--> $DIR/../include.rs:64:5
|
||||
|
|
||||
64 | pub struct AU16(pub u16);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 13 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0587, E0588.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
Reference in new issue
Block a user