Debian Codegraph @

.cargo/vendor/zerocopy/tests/ui-nightly/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;
13 extern crate zerocopy_derive;
14
15 include!("../../../src/util/macros.rs");
16
17 use zerocopy::*;
18 use zerocopy_derive::*;
19
20 fn main() {}
21
22 #[derive(FromBytes, IntoBytes, Unaligned)]
23 #[repr(transparent)]
24 struct Foo<T>(T);
25
26 const _: () = unsafe {
27 impl_or_verify!(T => TryFromBytes for Foo<T>);
28 impl_or_verify!(T => FromZeros for Foo<T>);
29 impl_or_verify!(T => FromBytes for Foo<T>);
30 impl_or_verify!(T => IntoBytes for Foo<T>);
31 impl_or_verify!(T => Unaligned for Foo<T>);
32 };