-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[derive] IntoBytes on unions requires --cfg
Makes progress on #1792
- Loading branch information
Showing
12 changed files
with
168 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
zerocopy-derive/tests/ui-msrv/union_into_bytes_cfg/union_into_bytes_cfg.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../ui-nightly/union_into_bytes_cfg/union_into_bytes_cfg.rs |
8 changes: 8 additions & 0 deletions
8
zerocopy-derive/tests/ui-msrv/union_into_bytes_cfg/union_into_bytes_cfg.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: requires --cfg zerocopy_derive_union_into_bytes; | ||
please let us know you use this feature: https://github.com/google/zerocopy/discussions/1802 | ||
--> tests/ui-msrv/union_into_bytes_cfg/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) |
26 changes: 26 additions & 0 deletions
26
zerocopy-derive/tests/ui-nightly/union_into_bytes_cfg/union_into_bytes_cfg.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// 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; | ||
|
||
use zerocopy::IntoBytes; | ||
|
||
#[derive(IntoBytes)] | ||
#[repr(C)] | ||
union Foo { | ||
a: u8, | ||
} | ||
|
||
fn main() {} |
8 changes: 8 additions & 0 deletions
8
zerocopy-derive/tests/ui-nightly/union_into_bytes_cfg/union_into_bytes_cfg.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: requires --cfg zerocopy_derive_union_into_bytes; | ||
please let us know you use this feature: https://github.com/google/zerocopy/discussions/1802 | ||
--> tests/ui-nightly/union_into_bytes_cfg/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) |
1 change: 1 addition & 0 deletions
1
zerocopy-derive/tests/ui-stable/union_into_bytes_cfg/union_into_bytes_cfg.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../ui-nightly/union_into_bytes_cfg/union_into_bytes_cfg.rs |
8 changes: 8 additions & 0 deletions
8
zerocopy-derive/tests/ui-stable/union_into_bytes_cfg/union_into_bytes_cfg.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: requires --cfg zerocopy_derive_union_into_bytes; | ||
please let us know you use this feature: https://github.com/google/zerocopy/discussions/1802 | ||
--> tests/ui-stable/union_into_bytes_cfg/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) |