forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweird-syntax.rs
140 lines (98 loc) · 4.23 KB
/
weird-syntax.rs
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
// 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 rejected //~ERROR link
/// in Markdown for not being URL-shaped enough.
///
/// [cln]: Clone() //~ERROR link
pub struct LinkToCloneWithParensInReference;
/// The [cln][] link here is going to be unresolved, because `struct@Clone` gets //~ERROR link
/// rejected in Markdown for not being URL-shaped enough.
///
/// [cln]: struct@Clone //~ERROR link
pub struct LinkToCloneWithWrongPrefix;
/// The [cln][] link here will produce a plain text suggestion //~ERROR link
///
/// [cln]: Clone\(\)
pub struct LinkToCloneWithEscapedParensInReference;
/// The [cln][] link here will produce a plain text suggestion //~ERROR link
///
/// [cln]: struct\@Clone
pub struct LinkToCloneWithEscapedAtsInReference;