about summary refs log tree commit diff
path: root/tests/rustdoc-ui/intra-doc/weird-syntax.rs
blob: d2a922b2b62476312ea673c423c3df3f830908bf (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// Many examples are from
// https://github.com/rust-lang/rust/issues/110111#issuecomment-1517800781
#![deny(rustdoc::broken_intra_doc_links)]

//! This test case is closely linked to [raphlinus/pulldown-cmark#441], getting offsets of
//! link components. In particular, pulldown-cmark doesn't provide the offsets of the contents
//! of a link.
//!
//! To work around this, rustdoc parses parts of a link definition itself. This is basically a
//! test suite for that link syntax parser.
//!
//! [raphlinus/pulldown-cmark#441]: https://github.com/raphlinus/pulldown-cmark/issues/441

use std::clone::Clone;

// Basic version //

/// [`struct@Clone`] //~ERROR link
pub struct LinkToCloneWithBackquotes;

/// [```struct@Clone```] //~ERROR link
pub struct LinkToCloneWithMultipleBackquotes;

/// [  `  struct@Clone  `  ] //~ERROR link
pub struct LinkToCloneWithSpacesAndBackquotes;

/// [  `Clone ()`  ] //~ERROR link
pub struct LinkToCloneWithSpacesBackquotesAndParens;

/// [`Clone ()`  ] //~ERROR link
pub struct LinkToCloneWithSpacesEndBackquotesAndParens;

/// [  `Clone ()`] //~ERROR link
pub struct LinkToCloneWithSpacesStartBackquotesAndParens;

/// [```Clone ()```] //~ERROR link
pub struct LinkToCloneWithMultipleBackquotesAndParens;

/// [```Clone \(\)```] // not URL-shaped enough
pub struct LinkToCloneWithMultipleBackquotesAndEscapedParens;

/// [  ```  Clone ()  ```  ] //~ERROR link
pub struct LinkToCloneWithSpacesMultipleBackquotesAndParens;

/// [ x \] ] // not URL-shaped enough
pub struct LinkWithEscapedCloseBrace;

/// [ x \[ ] // not URL-shaped enough
pub struct LinkWithEscapedOpenBrace;

/// [ x \( ] // not URL-shaped enough
pub struct LinkWithEscapedCloseParen;

/// [ x \) ] // not URL-shaped enough
pub struct LinkWithEscapedOpenParen;

/// [ Clone \(\) ] // not URL-shaped enough
pub struct LinkWithEscapedParens;

// [][] version //

/// [x][ struct@Clone] //~ERROR link
pub struct XLinkToCloneWithStartSpace;

/// [x][struct@Clone ] //~ERROR link
pub struct XLinkToCloneWithEndSpace;

/// [x][Clone\(\)] not URL-shaped enough
pub struct XLinkToCloneWithEscapedParens;

/// [x][`Clone`] not URL-shaped enough
pub struct XLinkToCloneWithBackquotes;

/// [x][Clone()] //~ERROR link
pub struct XLinkToCloneWithUnescapedParens;

/// [x][Clone  ()] //~ERROR link
pub struct XLinkToCloneWithUnescapedParensAndDoubleSpace;

/// [x][Clone  [] //~ERROR unresolved link to `x`
pub struct XLinkToCloneWithUnmatchedOpenParenAndDoubleSpace;

/// [x][Clone  \[] // not URL-shaped enough
pub struct XLinkToCloneWithUnmatchedEscapedOpenParenAndDoubleSpace;

/// [x][Clone  \]] // not URL-shaped enough
pub struct XLinkToCloneWithUnmatchedEscapedCloseParenAndDoubleSpace;

// []() version //

/// [w]( struct@Clone) //~ERROR link
pub struct WLinkToCloneWithStartSpace;

/// [w](struct@Clone ) //~ERROR link
pub struct WLinkToCloneWithEndSpace;

/// [w](Clone\(\)) //~ERROR link
pub struct WLinkToCloneWithEscapedParens;

/// [w](`Clone`) not URL-shaped enough
pub struct WLinkToCloneWithBackquotes;

/// [w](Clone()) //~ERROR link
pub struct WLinkToCloneWithUnescapedParens;

/// [w](Clone  ()) not URL-shaped enough
pub struct WLinkToCloneWithUnescapedParensAndDoubleSpace;

/// [w](Clone  () //~ERROR unresolved link to `w`
pub struct WLinkToCloneWithUnmatchedOpenParenAndDoubleSpace;

/// [w](Clone  \() //~ERROR unresolved link to `w`
pub struct WLinkToCloneWithUnmatchedEscapedOpenParenAndDoubleSpace;

/// [w](Clone  \)) //~ERROR unresolved link to `w`
pub struct WLinkToCloneWithUnmatchedEscapedCloseParenAndDoubleSpace;

// References

/// The [cln][] link here is going to be unresolved, because `Clone()` gets
//~^ ERROR link
/// rejected in Markdown for not being URL-shaped enough.
/// [cln]: Clone()
//~^ ERROR link
pub struct LinkToCloneWithParensInReference;

/// The [cln][] link here is going to produce a good inline suggestion
///
/// [cln]: struct@Clone
//~^ ERROR link
pub struct LinkToCloneWithWrongPrefix;

/// The [cln][] link here will produce a good inline suggestion
///
/// [cln]: Clone\(\)
//~^ ERROR link
pub struct LinkToCloneWithEscapedParensInReference;

/// The [cln][] link here will produce a good inline suggestion
///
/// [cln]: struct\@Clone
//~^ ERROR link
pub struct LinkToCloneWithEscapedAtsInReference;


/// This link reference definition isn't used, but since it is still parsed,
/// it should still produce a warning.
///
/// [cln]: struct\@Clone
//~^ ERROR link
pub struct UnusedLinkToCloneReferenceDefinition;

/// <https://github.com/rust-lang/rust/issues/133150>
///
/// - [`SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER`]: the
//~^ ERROR link
///   `(__unsafe_unretained)` NSWindow associated with the window, if you want
///   to wrap an existing window.
/// - [`SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER`]: the `(__unsafe_unretained)`
///   NSView associated with the window, defaults to `[window contentView]`
pub fn a() {}
#[allow(nonstandard_style)]
pub struct SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER;
#[allow(nonstandard_style)]
pub struct SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER;