Debian Codegraph @

debian/missing-sources/zerocopy-derive/tests/ui-msrv/msrv_specific.rs

raw
1 // Copyright 2024 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 // This file contains tests which trigger errors on MSRV during a different
10 // compiler pass compared to the stable or nightly toolchains.
11
12 #[macro_use]
13 extern crate zerocopy_renamed;
14
15 #[path = "../include.rs"]
16 mod util;
17
18 use zerocopy_renamed::IntoBytes;
19
20 use self::util::util::AU16;
21
22 fn main() {}
23
24 // `repr(C, packed(2))` is not equivalent to `repr(C, packed)`.
25 #[derive(IntoBytes)]
26 #[zerocopy(crate = "zerocopy_renamed")]
27 #[repr(C, packed(2))]
28 struct IntoBytes1<T> {
29 t0: T,
30 // Add a second field to avoid triggering the "repr(C) struct with one
31 // field" special case.
32 t1: T,
33 }
34
35 fn is_into_bytes_1<T: IntoBytes>() {
36 if false {
37 is_into_bytes_1::<IntoBytes1<AU16>>();
38 }
39 }