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 // Make sure that macro hygiene will ensure that when we reference "zerocopy",
10 // that will work properly even if they've renamed the crate and have not
11 // imported its traits.
12 
13 #![allow(warnings)]
14 
15 extern crate zerocopy as _zerocopy;
16 
17 #[macro_use]
18 mod util;
19 
20 use std::{marker::PhantomData, option::IntoIter};
21 
22 use static_assertions::assert_impl_all;
23 
24 #[derive(
25     _zerocopy::KnownLayout, _zerocopy::FromZeroes, _zerocopy::FromBytes, _zerocopy::Unaligned,
26 )]
27 #[repr(C)]
28 struct TypeParams<'a, T, I: Iterator> {
29     a: T,
30     c: I::Item,
31     d: u8,
32     e: PhantomData<&'a [u8]>,
33     f: PhantomData<&'static str>,
34     g: PhantomData<String>,
35 }
36 
37 assert_impl_all!(
38     TypeParams<'static, (), IntoIter<()>>:
39         _zerocopy::KnownLayout,
40         _zerocopy::FromZeroes,
41         _zerocopy::FromBytes,
42         _zerocopy::Unaligned
43 );
44