about summary refs log tree commit diff
path: root/tests/run-make/rustdoc-search-load-itemtype/foo.rs
blob: 93b372d10cbf96f228c711709c6d4c0888c0d2b9 (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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#![feature(extern_types, rustc_attrs, rustdoc_internals, trait_alias)]
#![allow(internal_features)]
#![no_std]

//@ has foo/keyword.while.html
//@ hasraw search.index/name/*.js while
//@ !hasraw search.index/name/*.js w_keyword
#[doc(keyword = "while")]
mod w_keyword {}

//@ has foo/primitive.u32.html
//@ hasraw search.index/name/*.js u32
//@ !hasraw search.index/name/*.js u_primitive
#[rustc_doc_primitive = "u32"]
mod u_primitive {}

//@ has foo/x_mod/index.html
//@ hasraw search.index/name/*.js x_mod
pub mod x_mod {}

//@ hasraw foo/index.html y_crate
//@ hasraw search.index/name/*.js y_crate
#[doc(no_inline)]
pub extern crate core as y_crate;

//@ hasraw foo/index.html z_import
//@ hasraw search.index/name/*.js z_import
#[doc(no_inline)]
pub use core::option as z_import;

//@ has foo/struct.AStruct.html
//@ hasraw search.index/name/*.js AStruct
pub struct AStruct {
    //@ hasraw foo/struct.AStruct.html a_structfield
    //@ hasraw search.index/name/*.js a_structfield
    pub a_structfield: i32,
}

//@ has foo/enum.AEnum.html
//@ hasraw search.index/name/*.js AEnum
pub enum AEnum {
    //@ hasraw foo/enum.AEnum.html AVariant
    //@ hasraw search.index/name/*.js AVariant
    AVariant,
}

//@ has foo/fn.a_fn.html
//@ hasraw search.index/name/*.js a_fn
pub fn a_fn() {}

//@ has foo/type.AType.html
//@ hasraw search.index/name/*.js AType
pub type AType = AStruct;

//@ has foo/static.a_static.html
//@ hasraw search.index/name/*.js a_static
pub static a_static: i32 = 1;

//@ has foo/trait.ATrait.html
//@ hasraw search.index/name/*.js ATrait
pub trait ATrait {
    //@ hasraw foo/trait.ATrait.html a_tymethod
    //@ hasraw search.index/name/*.js a_tymethod
    fn a_tymethod();
    //@ hasraw foo/trait.ATrait.html AAssocType
    //@ hasraw search.index/name/*.js AAssocType
    type AAssocType;
    //@ hasraw foo/trait.ATrait.html AAssocConst
    //@ hasraw search.index/name/*.js AAssocConst
    const AAssocConst: bool;
}

// skip ItemType::Impl, since impls are anonymous
// and have no search entry

impl AStruct {
    //@ hasraw foo/struct.AStruct.html a_method
    //@ hasraw search.index/name/*.js a_method
    pub fn a_method() {}
}

//@ has foo/macro.a_macro.html
//@ hasraw search.index/name/*.js a_macro
#[macro_export]
macro_rules! a_macro {
    () => {};
}

//@ has foo/constant.A_CONSTANT.html
//@ hasraw search.index/name/*.js A_CONSTANT
pub const A_CONSTANT: i32 = 1;

//@ has foo/union.AUnion.html
//@ hasraw search.index/name/*.js AUnion
pub union AUnion {
    //@ hasraw foo/union.AUnion.html a_unionfield
    //@ hasraw search.index/name/*.js a_unionfield
    pub a_unionfield: i32,
}

extern "C" {
    //@ has foo/foreigntype.AForeignType.html
    //@ hasraw search.index/name/*.js AForeignType
    pub type AForeignType;
}

// procattribute and procderive are defined in
// bar.rs, because they only work with proc_macro
// crate type.

//@ has foo/traitalias.ATraitAlias.html
//@ hasraw search.index/name/*.js ATraitAlias
pub trait ATraitAlias = ATrait;

//@ has foo/attribute.doc.html
//@ hasraw search.index/name/*.js doc
//@ !hasraw search.index/name/*.js aa_mod
#[doc(attribute = "doc")]
mod aa_mod {}