• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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;
14 
15 #[path = "../include.rs"]
16 mod util;
17 
18 use self::util::util::AU16;
19 use zerocopy::IntoBytes;
20 
main()21 fn main() {}
22 
23 // `repr(C, packed(2))` is not equivalent to `repr(C, packed)`.
24 #[derive(IntoBytes)]
25 #[repr(C, packed(2))]
26 struct IntoBytes1<T> {
27     t0: T,
28     // Add a second field to avoid triggering the "repr(C) struct with one
29     // field" special case.
30     t1: T,
31 }
32 
is_into_bytes_1<T: IntoBytes>()33 fn is_into_bytes_1<T: IntoBytes>() {
34     if false {
35         is_into_bytes_1::<IntoBytes1<AU16>>();
36     }
37 }
38