Debian Codegraph @

debian/missing-sources/zerocopy/tests/ui-stable/invalid-impls/invalid-impls.rs

raw
1 // Copyright 2022 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 // Since some macros from `macros.rs` are unused.
10 #![allow(unused)]
11
12 extern crate zerocopy_derive;
13
14 include!("../../../src/util/macros.rs");
15
16 use zerocopy::*;
17 use zerocopy_derive::*;
18
19 fn main() {}
20
21 #[derive(FromBytes, IntoBytes, Unaligned)]
22 #[repr(transparent)]
23 struct Foo<T>(T);
24
25 const _: () = unsafe {
26 impl_or_verify!(T => TryFromBytes for Foo<T>);
27 impl_or_verify!(T => FromZeros for Foo<T>);
28 impl_or_verify!(T => FromBytes for Foo<T>);
29 impl_or_verify!(T => IntoBytes for Foo<T>);
30 impl_or_verify!(T => Unaligned for Foo<T>);
31 };