Skip to content

Commit 70b146c

Browse files
committed
Add warning annotations to rustdoc-ui tests
1 parent 267fc6d commit 70b146c

6 files changed

+67
-46
lines changed
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
// ignore-tidy-cr
2-
3-
// build-pass (FIXME(62277): could be check-pass?)
2+
// build-pass
43

54
// This file checks the spans of intra-link warnings in a file with CRLF line endings. The
65
// .gitattributes file in this directory should enforce it.
76

87
/// [error]
98
pub struct A;
9+
//~^^ WARNING `[error]` cannot be resolved
1010

1111
///
1212
/// docs [error1]
13+
//~^ WARNING `[error1]` cannot be resolved
1314

1415
/// docs [error2]
1516
///
1617
pub struct B;
18+
//~^^^ WARNING `[error2]` cannot be resolved
1719

1820
/**
1921
* This is a multi-line comment.
2022
*
2123
* It also has an [error].
2224
*/
2325
pub struct C;
26+
//~^^^ WARNING `[error]` cannot be resolved

src/test/rustdoc-ui/intra-links-warning-crlf.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: `[error]` cannot be resolved, ignoring it...
2-
--> $DIR/intra-links-warning-crlf.rs:8:6
2+
--> $DIR/intra-links-warning-crlf.rs:7:6
33
|
44
LL | /// [error]
55
| ^^^^^ cannot be resolved, ignoring
@@ -16,15 +16,15 @@ LL | /// docs [error1]
1616
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
1717

1818
warning: `[error2]` cannot be resolved, ignoring it...
19-
--> $DIR/intra-links-warning-crlf.rs:14:11
19+
--> $DIR/intra-links-warning-crlf.rs:15:11
2020
|
2121
LL | /// docs [error2]
2222
| ^^^^^^ cannot be resolved, ignoring
2323
|
2424
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
2525

2626
warning: `[error]` cannot be resolved, ignoring it...
27-
--> $DIR/intra-links-warning-crlf.rs:21:20
27+
--> $DIR/intra-links-warning-crlf.rs:23:20
2828
|
2929
LL | * It also has an [error].
3030
| ^^^^^ cannot be resolved, ignoring
Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
1-
// build-pass (FIXME(62277): could be check-pass?)
1+
// build-pass
22

33
//! Test with [Foo::baz], [Bar::foo], ...
4+
//~^ WARNING `[Foo::baz]` cannot be resolved
5+
//~| WARNING `[Bar::foo]` cannot be resolved
46
//! , [Uniooon::X] and [Qux::Z].
7+
//~^ WARNING `[Uniooon::X]` cannot be resolved
8+
//~| WARNING `[Qux::Z]` cannot be resolved
59
//!
610
//! , [Uniooon::X] and [Qux::Z].
11+
//~^ WARNING `[Uniooon::X]` cannot be resolved
12+
//~| WARNING `[Qux::Z]` cannot be resolved
713

814
/// [Qux:Y]
15+
//~^ WARNING `[Qux:Y]` cannot be resolved
916
pub struct Foo {
1017
pub bar: usize,
1118
}
1219

1320
/// Foo
14-
/// bar [BarA] bar
21+
/// bar [BarA] bar //~ WARNING `[BarA]` cannot be resolved
1522
/// baz
1623
pub fn a() {}
1724

1825
/**
1926
* Foo
20-
* bar [BarB] bar
27+
* bar [BarB] bar //~ WARNING `[BarB]` cannot be resolved
2128
* baz
2229
*/
2330
pub fn b() {}
2431

2532
/** Foo
2633
27-
bar [BarC] bar
34+
bar [BarC] bar //~ WARNING `[BarC]` cannot be resolved
2835
baz
2936
3037
let bar_c_1 = 0;
@@ -35,43 +42,43 @@ baz
3542
*/
3643
pub fn c() {}
3744

38-
#[doc = "Foo\nbar [BarD] bar\nbaz"]
45+
#[doc = "Foo\nbar [BarD] bar\nbaz"] //~ WARNING `[BarD]` cannot be resolved
3946
pub fn d() {}
4047

4148
macro_rules! f {
4249
($f:expr) => {
43-
#[doc = $f]
50+
#[doc = $f] //~ WARNING `[BarF]` cannot be resolved
4451
pub fn f() {}
4552
}
4653
}
4754
f!("Foo\nbar [BarF] bar\nbaz");
4855

4956
/** # for example,
5057
*
51-
* time to introduce a link [error]*/
58+
* time to introduce a link [error]*/ //~ WARNING `[error]` cannot be resolved
5259
pub struct A;
5360

5461
/**
5562
* # for example,
5663
*
57-
* time to introduce a link [error]
64+
* time to introduce a link [error] //~ WARNING `[error]` cannot be resolved
5865
*/
5966
pub struct B;
6067

61-
#[doc = "single line [error]"]
68+
#[doc = "single line [error]"] //~ WARNING `[error]` cannot be resolved
6269
pub struct C;
6370

64-
#[doc = "single line with \"escaping\" [error]"]
71+
#[doc = "single line with \"escaping\" [error]"] //~ WARNING `[error]` cannot be resolved
6572
pub struct D;
6673

67-
/// Item docs.
74+
/// Item docs. //~ WARNING `[error]` cannot be resolved
6875
#[doc="Hello there!"]
6976
/// [error]
7077
pub struct E;
7178

7279
///
73-
/// docs [error1]
80+
/// docs [error1] //~ WARNING `[error1]` cannot be resolved
7481
75-
/// docs [error2]
82+
/// docs [error2] //~ WARNING `[error2]` cannot be resolved
7683
///
7784
pub struct F;

src/test/rustdoc-ui/intra-links-warning.stderr

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,63 +16,63 @@ LL | //! Test with [Foo::baz], [Bar::foo], ...
1616
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
1717

1818
warning: `[Uniooon::X]` cannot be resolved, ignoring it...
19-
--> $DIR/intra-links-warning.rs:4:13
19+
--> $DIR/intra-links-warning.rs:6:13
2020
|
2121
LL | //! , [Uniooon::X] and [Qux::Z].
2222
| ^^^^^^^^^^ cannot be resolved, ignoring
2323
|
2424
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
2525

2626
warning: `[Qux::Z]` cannot be resolved, ignoring it...
27-
--> $DIR/intra-links-warning.rs:4:30
27+
--> $DIR/intra-links-warning.rs:6:30
2828
|
2929
LL | //! , [Uniooon::X] and [Qux::Z].
3030
| ^^^^^^ cannot be resolved, ignoring
3131
|
3232
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
3333

3434
warning: `[Uniooon::X]` cannot be resolved, ignoring it...
35-
--> $DIR/intra-links-warning.rs:6:14
35+
--> $DIR/intra-links-warning.rs:10:14
3636
|
3737
LL | //! , [Uniooon::X] and [Qux::Z].
3838
| ^^^^^^^^^^ cannot be resolved, ignoring
3939
|
4040
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
4141

4242
warning: `[Qux::Z]` cannot be resolved, ignoring it...
43-
--> $DIR/intra-links-warning.rs:6:31
43+
--> $DIR/intra-links-warning.rs:10:31
4444
|
4545
LL | //! , [Uniooon::X] and [Qux::Z].
4646
| ^^^^^^ cannot be resolved, ignoring
4747
|
4848
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
4949

5050
warning: `[Qux:Y]` cannot be resolved, ignoring it...
51-
--> $DIR/intra-links-warning.rs:8:13
51+
--> $DIR/intra-links-warning.rs:14:13
5252
|
5353
LL | /// [Qux:Y]
5454
| ^^^^^ cannot be resolved, ignoring
5555
|
5656
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
5757

5858
warning: `[error]` cannot be resolved, ignoring it...
59-
--> $DIR/intra-links-warning.rs:51:30
59+
--> $DIR/intra-links-warning.rs:58:30
6060
|
6161
LL | * time to introduce a link [error]*/
6262
| ^^^^^ cannot be resolved, ignoring
6363
|
6464
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
6565

6666
warning: `[error]` cannot be resolved, ignoring it...
67-
--> $DIR/intra-links-warning.rs:57:30
67+
--> $DIR/intra-links-warning.rs:64:30
6868
|
6969
LL | * time to introduce a link [error]
7070
| ^^^^^ cannot be resolved, ignoring
7171
|
7272
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
7373

7474
warning: `[error]` cannot be resolved, ignoring it...
75-
--> $DIR/intra-links-warning.rs:61:1
75+
--> $DIR/intra-links-warning.rs:68:1
7676
|
7777
LL | #[doc = "single line [error]"]
7878
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -84,7 +84,7 @@ LL | #[doc = "single line [error]"]
8484
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
8585

8686
warning: `[error]` cannot be resolved, ignoring it...
87-
--> $DIR/intra-links-warning.rs:64:1
87+
--> $DIR/intra-links-warning.rs:71:1
8888
|
8989
LL | #[doc = "single line with \"escaping\" [error]"]
9090
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -96,7 +96,7 @@ LL | #[doc = "single line with \"escaping\" [error]"]
9696
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
9797

9898
warning: `[error]` cannot be resolved, ignoring it...
99-
--> $DIR/intra-links-warning.rs:67:1
99+
--> $DIR/intra-links-warning.rs:74:1
100100
|
101101
LL | / /// Item docs.
102102
LL | | #[doc="Hello there!"]
@@ -110,47 +110,47 @@ LL | | /// [error]
110110
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
111111

112112
warning: `[error1]` cannot be resolved, ignoring it...
113-
--> $DIR/intra-links-warning.rs:73:11
113+
--> $DIR/intra-links-warning.rs:80:11
114114
|
115115
LL | /// docs [error1]
116116
| ^^^^^^ cannot be resolved, ignoring
117117
|
118118
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
119119

120120
warning: `[error2]` cannot be resolved, ignoring it...
121-
--> $DIR/intra-links-warning.rs:75:11
121+
--> $DIR/intra-links-warning.rs:82:11
122122
|
123123
LL | /// docs [error2]
124124
| ^^^^^^ cannot be resolved, ignoring
125125
|
126126
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
127127

128128
warning: `[BarA]` cannot be resolved, ignoring it...
129-
--> $DIR/intra-links-warning.rs:14:10
129+
--> $DIR/intra-links-warning.rs:21:10
130130
|
131131
LL | /// bar [BarA] bar
132132
| ^^^^ cannot be resolved, ignoring
133133
|
134134
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
135135

136136
warning: `[BarB]` cannot be resolved, ignoring it...
137-
--> $DIR/intra-links-warning.rs:20:9
137+
--> $DIR/intra-links-warning.rs:27:9
138138
|
139139
LL | * bar [BarB] bar
140140
| ^^^^ cannot be resolved, ignoring
141141
|
142142
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
143143

144144
warning: `[BarC]` cannot be resolved, ignoring it...
145-
--> $DIR/intra-links-warning.rs:27:6
145+
--> $DIR/intra-links-warning.rs:34:6
146146
|
147147
LL | bar [BarC] bar
148148
| ^^^^ cannot be resolved, ignoring
149149
|
150150
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
151151

152152
warning: `[BarD]` cannot be resolved, ignoring it...
153-
--> $DIR/intra-links-warning.rs:38:1
153+
--> $DIR/intra-links-warning.rs:45:1
154154
|
155155
LL | #[doc = "Foo\nbar [BarD] bar\nbaz"]
156156
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -162,7 +162,7 @@ LL | #[doc = "Foo\nbar [BarD] bar\nbaz"]
162162
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
163163

164164
warning: `[BarF]` cannot be resolved, ignoring it...
165-
--> $DIR/intra-links-warning.rs:43:9
165+
--> $DIR/intra-links-warning.rs:50:9
166166
|
167167
LL | #[doc = $f]
168168
| ^^^^^^^^^^^

src/test/rustdoc-ui/invalid-syntax.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
// build-pass (FIXME(62277): could be check-pass?)
1+
// build-pass
22

33
/// ```
44
/// \__________pkt->size___________/ \_result->size_/ \__pkt->size__/
55
/// ```
66
pub fn foo() {}
7+
//~^^^^ WARNING could not parse code block as Rust code
78

89
/// ```
910
/// |
1011
/// LL | use foobar::Baz;
1112
/// | ^^^^^^ did you mean `baz::foobar`?
1213
/// ```
1314
pub fn bar() {}
15+
//~^^^^^^ WARNING could not parse code block as Rust code
1416

1517
/// ```
1618
/// valid
@@ -24,6 +26,7 @@ pub fn bar() {}
2426
/// "invalid
2527
/// ```
2628
pub fn valid_and_invalid() {}
29+
//~^^^^^^^^ WARNING could not parse code block as Rust code
2730

2831
/// This is a normal doc comment, but...
2932
///
@@ -35,6 +38,7 @@ pub fn valid_and_invalid() {}
3538
///
3639
/// Good thing we tested it!
3740
pub fn baz() {}
41+
//~^^^^^^ WARNING could not parse code block as Rust code
3842

3943
/// Indented block start
4044
///
@@ -43,6 +47,7 @@ pub fn baz() {}
4347
///
4448
/// Indented block end
4549
pub fn quux() {}
50+
//~^^^^^ could not parse code block as Rust code
4651

4752
/// Unclosed fence
4853
///
@@ -54,26 +59,31 @@ pub fn xyzzy() {}
5459
///
5560
/// ```
5661
pub fn blah() {}
62+
//~^^ WARNING could not parse code block as Rust code
5763

5864
/// ```edition2018
5965
/// \_
6066
/// ```
6167
pub fn blargh() {}
68+
//~^^^^ WARNING could not parse code block as Rust code
6269

6370
#[doc = "```"]
6471
/// \_
6572
#[doc = "```"]
6673
pub fn crazy_attrs() {}
74+
//~^^^^ WARNING doc comment contains an invalid Rust code block
6775

6876
/// ```rust
6977
/// ```
7078
pub fn empty_rust() {}
79+
//~^^^ WARNING Rust code block is empty
7180

7281
/// ```
7382
///
7483
///
7584
/// ```
7685
pub fn empty_rust_with_whitespace() {}
86+
//~^^^^^ WARNING Rust code block is empty
7787

7888
/// ```
7989
/// let x = 1;
@@ -82,3 +92,4 @@ pub fn empty_rust_with_whitespace() {}
8292
/// \____/
8393
///
8494
pub fn indent_after_fenced() {}
95+
//~^^^ WARNING could not parse code block as Rust code

0 commit comments

Comments
 (0)