Debian Codegraph @

.cargo/vendor/zerocopy-derive/tests/priv_in_pub.rs

raw
1 // Copyright 2019 The Fuchsia Authors
2 //
3 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
4 // <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
5 // license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
6 // This file may not be copied, modified, or distributed except according to
7 // those terms.
8
9 // See comment in `include.rs` for why we disable the prelude.
10 #![no_implicit_prelude]
11 #![allow(warnings)]
12
13 include!("include.rs");
14
15 // FIXME(#847): Make this test succeed on earlier Rust versions.
16 #[::rustversion::stable(1.59)]
17 mod test {
18 use super::*;
19
20 // These derives do not result in E0446 as of Rust 1.59.0, because of
21 // https://github.com/rust-lang/rust/pull/90586.
22 //
23 // This change eliminates one of the major downsides of emitting `where`
24 // bounds for field types (i.e., the emission of E0446 for private field
25 // types).
26
27 #[derive(imp::KnownLayout, imp::IntoBytes, imp::FromZeros, imp::FromBytes, imp::Unaligned)]
28 #[repr(C)]
29 pub struct Public(Private);
30
31 #[derive(imp::KnownLayout, imp::IntoBytes, imp::FromZeros, imp::FromBytes, imp::Unaligned)]
32 #[repr(C)]
33 struct Private(());
34 }