Debian Codegraph @

.cargo/vendor/zerocopy-derive/tests/hygiene.rs

raw
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 // See comment in `include.rs` for why we disable the prelude.
14 #![no_implicit_prelude]
15 #![allow(warnings)]
16
17 include!("include.rs");
18
19 extern crate zerocopy as _zerocopy;
20
21 #[derive(_zerocopy::KnownLayout, _zerocopy::FromBytes, _zerocopy::Unaligned)]
22 #[repr(C)]
23 struct TypeParams<'a, T, I: imp::Iterator> {
24 a: T,
25 c: I::Item,
26 d: u8,
27 e: imp::PhantomData<&'a [::core::primitive::u8]>,
28 f: imp::PhantomData<&'static ::core::primitive::str>,
29 g: imp::PhantomData<imp::String>,
30 }
31
32 util_assert_impl_all!(
33 TypeParams<'static, (), imp::IntoIter<()>>:
34 _zerocopy::KnownLayout,
35 _zerocopy::FromZeros,
36 _zerocopy::FromBytes,
37 _zerocopy::Unaligned
38 );