File: items.rs

package info (click to toggle)
rust-macro-attr 0.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 236 kB
  • sloc: python: 353; makefile: 2
file content (79 lines) | stat: -rw-r--r-- 1,486 bytes parent folder | download
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
Copyright ⓒ 2016 macro-attr contributors.

Licensed under the MIT license (see LICENSE or <http://opensource.org
/licenses/MIT>) or the Apache License, Version 2.0 (see LICENSE of
<http://www.apache.org/licenses/LICENSE-2.0>), at your option. All
files in the project carrying such notice may not be copied, modified,
or distributed except according to those terms.
*/
#[macro_use] extern crate macro_attr;

macro_attr! {
    const DUMMY_CONST: () = ();
}

macro_attr! {
    enum DummyEnum { V }
}

macro_attr! {
    fn dummy_fn() {}
}

macro_attr! {
    impl DummyStruct {
        fn f(self) {}
    }
}

macro_attr! {
    mod dummy_mod {
        pub fn f() {}
    }
}

macro_attr! {
    static DUMMY_STATIC: () = ();
}

macro_attr! {
    struct DummyStruct;
}

macro_attr! {
    trait DummyTrait {}
}

macro_attr! {
    type DummyType = ();
}

macro_attr! {
    use self::dummy_fn as dummy_use;
}

#[cfg(never)]
mod super_dummy {
    macro_attr! {
        extern crate dummy_crate;
    }

    macro_attr! {
        extern "C" dummy_extern();
    }
}

#[test]
fn test_items() {
    let _: () = DUMMY_CONST;
    let _: DummyEnum = DummyEnum::V;
    let _: () = dummy_fn();
    let _: () = DummyStruct.f();
    let _: () = dummy_mod::f();
    let _: DummyStruct = DummyStruct;
    let _: Option<&DummyTrait> = None;
    let _: DummyType = ();
    let _: () = DUMMY_STATIC;
    let _: () = dummy_use();
}