summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-ui/intra-doc/errors.rs
blob: f37f49c24ccc5c70619ef06eaf41fbe355520a0e (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
120
121
#![deny(rustdoc::broken_intra_doc_links)]
//~^ NOTE lint level is defined

// FIXME: this should say that it was skipped (maybe an allowed by default lint?)
/// [invalid intra-doc syntax!!]

/// [path::to::nonexistent::module]
//~^ ERROR unresolved link
//~| NOTE no item named `path` in scope

/// [path::to::nonexistent::macro!]
//~^ ERROR unresolved link
//~| NOTE no item named `path` in scope

/// [type@path::to::nonexistent::type]
//~^ ERROR unresolved link
//~| NOTE no item named `path` in scope

/// [std::io::not::here]
//~^ ERROR unresolved link
//~| NOTE no item named `not` in module `io`

/// [type@std::io::not::here]
//~^ ERROR unresolved link
//~| NOTE no item named `not` in module `io`

/// [std::io::Error::x]
//~^ ERROR unresolved link
//~| NOTE the struct `Error` has no field

/// [std::io::ErrorKind::x]
//~^ ERROR unresolved link
//~| NOTE the enum `ErrorKind` has no variant

/// [f::A]
//~^ ERROR unresolved link
//~| NOTE `f` is a function, not a module

/// [f::A!]
//~^ ERROR unresolved link
//~| NOTE `f` is a function, not a module

/// [S::A]
//~^ ERROR unresolved link
//~| NOTE struct `S` has no field or associated item

/// [S::fmt]
//~^ ERROR unresolved link
//~| NOTE struct `S` has no field or associated item

/// [E::D]
//~^ ERROR unresolved link
//~| NOTE enum `E` has no variant or associated item

/// [u8::not_found]
//~^ ERROR unresolved link
//~| NOTE the primitive type `u8` has no associated item named `not_found`

/// [std::primitive::u8::not_found]
//~^ ERROR unresolved link
//~| NOTE the primitive type `u8` has no associated item named `not_found`

/// [type@Vec::into_iter]
//~^ ERROR unresolved link
//~| HELP to link to the associated function, add parentheses
//~| NOTE this link resolves to the associated function `into_iter`

/// [S!]
//~^ ERROR unresolved link
//~| HELP to link to the struct, prefix with `struct@`
//~| NOTE this link resolves to the struct `S`
pub fn f() {}
#[derive(Debug)]
pub struct S;

pub enum E { A, B, C }

/// [type@S::h]
//~^ ERROR unresolved link
//~| HELP to link to the associated function
//~| NOTE not in the type namespace
impl S {
    pub fn h() {}
}

/// [type@T::g]
//~^ ERROR unresolved link
//~| HELP to link to the associated function
//~| NOTE not in the type namespace

/// [T::h!]
//~^ ERROR unresolved link
//~| NOTE `T` has no macro named `h`
pub trait T {
    fn g() {}
}

/// [m()]
//~^ ERROR unresolved link
//~| HELP to link to the macro
//~| NOTE not in the value namespace
#[macro_export]
macro_rules! m {
    () => {};
}

///[`TestEnum::Variant1::field_name`]
//~^ ERROR unresolved link
//~| NOTE variant `Variant1` has no such field
pub enum TestEnum {
    Variant1 {},
    Variant2 { field_name: u64 },
}

///[`TestEnumNoFields::Variant1::field_name`]
//~^ ERROR unresolved link
//~| NOTE `Variant1` is a variant, not a module or type, and cannot have associated items
pub enum TestEnumNoFields {
    Variant1 (),
    Variant2 {},
}