summaryrefslogtreecommitdiff
path: root/tests/paths_and_modules.rs
blob: 8ca3aa2b150a0dd2ae19606fc5dab8df97edee25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#![allow(warnings)]

use zerocopy::{AsBytes, FromBytes, FromZeroes, Unaligned};

// Ensure that types that are use'd and types that are referenced by path work.

mod foo {
    use zerocopy::{AsBytes, FromBytes, FromZeroes, Unaligned};

    #[derive(FromZeroes, FromBytes, AsBytes, Unaligned)]
    #[repr(C)]
    pub struct Foo {
        foo: u8,
    }

    #[derive(FromZeroes, FromBytes, AsBytes, Unaligned)]
    #[repr(C)]
    pub struct Bar {
        bar: u8,
    }
}

use foo::Foo;

#[derive(FromZeroes, FromBytes, AsBytes, Unaligned)]
#[repr(C)]
struct Baz {
    foo: Foo,
    bar: foo::Bar,
}