summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-ui/intra-doc/errors.rs
blob: b29f7c29b5d86021aa9bc163a814dc7a82fdf0e3 (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
#![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 builtin type `u8` has no associated item named `not_found`

/// [std::primitive::u8::not_found]
//~^ ERROR unresolved link
//~| NOTE the builtin 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 {
    () => {};
}