Skip to content

Commit df556a3

Browse files
committed
rustdoc: add error messages to the test
1 parent 4d571a9 commit df556a3

File tree

2 files changed

+74
-60
lines changed

2 files changed

+74
-60
lines changed

tests/rustdoc-ui/issue-105742.rs

+34-21
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,49 @@
22
use std::ops::Index;
33

44
pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
5-
//~^ERROR
6-
//~|ERROR
7-
//~|ERROR
5+
//~^ expected 1 lifetime argument
6+
//~| expected 1 generic argument
7+
//~| the trait `SVec` cannot be made into an object
8+
//~| `SVec` cannot be made into an object
9+
//~| missing generics for associated type `SVec::Item`
10+
//~| missing generics for associated type `SVec::Item`
811
let _ = s;
912
}
1013

1114
pub trait SVec: Index<
1215
<Self as SVec>::Item,
13-
//~^ERROR
14-
//~|ERROR
15-
//~|ERROR
16-
//~|ERROR
16+
//~^ expected 1 lifetime argument
17+
//~| expected 1 generic argument
18+
//~| missing generics for associated type `SVec::Item`
19+
//~| missing generics for associated type `SVec::Item`
20+
//~| missing generics for associated type `SVec::Item`
21+
//~| missing generics for associated type `SVec::Item`
1722
Output = <Index<<Self as SVec>::Item,
18-
//~^ERROR
19-
//~|ERROR
20-
//~|ERROR
21-
//~|ERROR
23+
//~^ expected 1 lifetime argument
24+
//~| expected 1 generic argument
25+
//~| missing generics for associated type `SVec::Item`
26+
//~| missing generics for associated type `SVec::Item`
27+
//~| missing generics for associated type `SVec::Item`
28+
//~| missing generics for associated type `SVec::Item`
2229
Output = <Self as SVec>::Item> as SVec>::Item,
23-
//~^ERROR
24-
//~|ERROR
25-
//~|ERROR
26-
//~|ERROR
27-
//~|ERROR
28-
//~|ERROR
29-
//~|ERROR
30-
//~|ERROR
30+
//~^ expected 1 lifetime argument
31+
//~| expected 1 generic argument
32+
//~| expected 1 lifetime argument
33+
//~| missing generics for associated type `SVec::Item`
34+
//~| missing generics for associated type `SVec::Item`
35+
//~| missing generics for associated type `SVec::Item`
36+
//~| missing generics for associated type `SVec::Item`
37+
//~| expected 1 generic argument
38+
//~| missing generics for associated type `SVec::Item`
39+
//~| missing generics for associated type `SVec::Item`
40+
//~| missing generics for associated type `SVec::Item`
41+
//~| missing generics for associated type `SVec::Item`
3142
> {
3243
type Item<'a, T>;
3344

3445
fn len(&self) -> <Self as SVec>::Item;
35-
//~^ERROR
36-
//~|ERROR
46+
//~^ expected 1 lifetime argument
47+
//~| missing generics for associated type `SVec::Item`
48+
//~| expected 1 generic argument
49+
//~| missing generics for associated type `SVec::Item`
3750
}

tests/rustdoc-ui/issue-105742.stderr

+40-39
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0107]: missing generics for associated type `SVec::Item`
2-
--> $DIR/issue-105742.rs:12:21
2+
--> $DIR/issue-105742.rs:15:21
33
|
44
LL | <Self as SVec>::Item,
55
| ^^^^ expected 1 lifetime argument
66
|
77
note: associated type defined here, with 1 lifetime parameter: `'a`
8-
--> $DIR/issue-105742.rs:32:10
8+
--> $DIR/issue-105742.rs:43:10
99
|
1010
LL | type Item<'a, T>;
1111
| ^^^^ --
@@ -15,13 +15,13 @@ LL | <Self as SVec>::Item<'a>,
1515
| ++++
1616

1717
error[E0107]: missing generics for associated type `SVec::Item`
18-
--> $DIR/issue-105742.rs:12:21
18+
--> $DIR/issue-105742.rs:15:21
1919
|
2020
LL | <Self as SVec>::Item,
2121
| ^^^^ expected 1 generic argument
2222
|
2323
note: associated type defined here, with 1 generic parameter: `T`
24-
--> $DIR/issue-105742.rs:32:10
24+
--> $DIR/issue-105742.rs:43:10
2525
|
2626
LL | type Item<'a, T>;
2727
| ^^^^ -
@@ -31,13 +31,13 @@ LL | <Self as SVec>::Item<T>,
3131
| +++
3232

3333
error[E0107]: missing generics for associated type `SVec::Item`
34-
--> $DIR/issue-105742.rs:17:37
34+
--> $DIR/issue-105742.rs:22:37
3535
|
3636
LL | Output = <Index<<Self as SVec>::Item,
3737
| ^^^^ expected 1 lifetime argument
3838
|
3939
note: associated type defined here, with 1 lifetime parameter: `'a`
40-
--> $DIR/issue-105742.rs:32:10
40+
--> $DIR/issue-105742.rs:43:10
4141
|
4242
LL | type Item<'a, T>;
4343
| ^^^^ --
@@ -47,13 +47,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>,
4747
| ++++
4848

4949
error[E0107]: missing generics for associated type `SVec::Item`
50-
--> $DIR/issue-105742.rs:17:37
50+
--> $DIR/issue-105742.rs:22:37
5151
|
5252
LL | Output = <Index<<Self as SVec>::Item,
5353
| ^^^^ expected 1 generic argument
5454
|
5555
note: associated type defined here, with 1 generic parameter: `T`
56-
--> $DIR/issue-105742.rs:32:10
56+
--> $DIR/issue-105742.rs:43:10
5757
|
5858
LL | type Item<'a, T>;
5959
| ^^^^ -
@@ -63,13 +63,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>,
6363
| +++
6464

6565
error[E0107]: missing generics for associated type `SVec::Item`
66-
--> $DIR/issue-105742.rs:22:30
66+
--> $DIR/issue-105742.rs:29:30
6767
|
6868
LL | Output = <Self as SVec>::Item> as SVec>::Item,
6969
| ^^^^ expected 1 lifetime argument
7070
|
7171
note: associated type defined here, with 1 lifetime parameter: `'a`
72-
--> $DIR/issue-105742.rs:32:10
72+
--> $DIR/issue-105742.rs:43:10
7373
|
7474
LL | type Item<'a, T>;
7575
| ^^^^ --
@@ -79,13 +79,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
7979
| ++++
8080

8181
error[E0107]: missing generics for associated type `SVec::Item`
82-
--> $DIR/issue-105742.rs:22:30
82+
--> $DIR/issue-105742.rs:29:30
8383
|
8484
LL | Output = <Self as SVec>::Item> as SVec>::Item,
8585
| ^^^^ expected 1 generic argument
8686
|
8787
note: associated type defined here, with 1 generic parameter: `T`
88-
--> $DIR/issue-105742.rs:32:10
88+
--> $DIR/issue-105742.rs:43:10
8989
|
9090
LL | type Item<'a, T>;
9191
| ^^^^ -
@@ -95,13 +95,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
9595
| +++
9696

9797
error[E0107]: missing generics for associated type `SVec::Item`
98-
--> $DIR/issue-105742.rs:22:46
98+
--> $DIR/issue-105742.rs:29:46
9999
|
100100
LL | Output = <Self as SVec>::Item> as SVec>::Item,
101101
| ^^^^ expected 1 lifetime argument
102102
|
103103
note: associated type defined here, with 1 lifetime parameter: `'a`
104-
--> $DIR/issue-105742.rs:32:10
104+
--> $DIR/issue-105742.rs:43:10
105105
|
106106
LL | type Item<'a, T>;
107107
| ^^^^ --
@@ -111,13 +111,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
111111
| ++++
112112

113113
error[E0107]: missing generics for associated type `SVec::Item`
114-
--> $DIR/issue-105742.rs:22:46
114+
--> $DIR/issue-105742.rs:29:46
115115
|
116116
LL | Output = <Self as SVec>::Item> as SVec>::Item,
117117
| ^^^^ expected 1 generic argument
118118
|
119119
note: associated type defined here, with 1 generic parameter: `T`
120-
--> $DIR/issue-105742.rs:32:10
120+
--> $DIR/issue-105742.rs:43:10
121121
|
122122
LL | type Item<'a, T>;
123123
| ^^^^ -
@@ -133,7 +133,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
133133
| ^^^^ expected 1 lifetime argument
134134
|
135135
note: associated type defined here, with 1 lifetime parameter: `'a`
136-
--> $DIR/issue-105742.rs:32:10
136+
--> $DIR/issue-105742.rs:43:10
137137
|
138138
LL | type Item<'a, T>;
139139
| ^^^^ --
@@ -149,7 +149,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
149149
| ^^^^ expected 1 generic argument
150150
|
151151
note: associated type defined here, with 1 generic parameter: `T`
152-
--> $DIR/issue-105742.rs:32:10
152+
--> $DIR/issue-105742.rs:43:10
153153
|
154154
LL | type Item<'a, T>;
155155
| ^^^^ -
@@ -159,13 +159,13 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item<T> = T, Output = T>) {
159159
| +++
160160

161161
error[E0107]: missing generics for associated type `SVec::Item`
162-
--> $DIR/issue-105742.rs:12:21
162+
--> $DIR/issue-105742.rs:15:21
163163
|
164164
LL | <Self as SVec>::Item,
165165
| ^^^^ expected 1 lifetime argument
166166
|
167167
note: associated type defined here, with 1 lifetime parameter: `'a`
168-
--> $DIR/issue-105742.rs:32:10
168+
--> $DIR/issue-105742.rs:43:10
169169
|
170170
LL | type Item<'a, T>;
171171
| ^^^^ --
@@ -175,13 +175,13 @@ LL | <Self as SVec>::Item<'a>,
175175
| ++++
176176

177177
error[E0107]: missing generics for associated type `SVec::Item`
178-
--> $DIR/issue-105742.rs:12:21
178+
--> $DIR/issue-105742.rs:15:21
179179
|
180180
LL | <Self as SVec>::Item,
181181
| ^^^^ expected 1 generic argument
182182
|
183183
note: associated type defined here, with 1 generic parameter: `T`
184-
--> $DIR/issue-105742.rs:32:10
184+
--> $DIR/issue-105742.rs:43:10
185185
|
186186
LL | type Item<'a, T>;
187187
| ^^^^ -
@@ -191,13 +191,13 @@ LL | <Self as SVec>::Item<T>,
191191
| +++
192192

193193
error[E0107]: missing generics for associated type `SVec::Item`
194-
--> $DIR/issue-105742.rs:17:37
194+
--> $DIR/issue-105742.rs:22:37
195195
|
196196
LL | Output = <Index<<Self as SVec>::Item,
197197
| ^^^^ expected 1 lifetime argument
198198
|
199199
note: associated type defined here, with 1 lifetime parameter: `'a`
200-
--> $DIR/issue-105742.rs:32:10
200+
--> $DIR/issue-105742.rs:43:10
201201
|
202202
LL | type Item<'a, T>;
203203
| ^^^^ --
@@ -207,13 +207,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>,
207207
| ++++
208208

209209
error[E0107]: missing generics for associated type `SVec::Item`
210-
--> $DIR/issue-105742.rs:17:37
210+
--> $DIR/issue-105742.rs:22:37
211211
|
212212
LL | Output = <Index<<Self as SVec>::Item,
213213
| ^^^^ expected 1 generic argument
214214
|
215215
note: associated type defined here, with 1 generic parameter: `T`
216-
--> $DIR/issue-105742.rs:32:10
216+
--> $DIR/issue-105742.rs:43:10
217217
|
218218
LL | type Item<'a, T>;
219219
| ^^^^ -
@@ -223,13 +223,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>,
223223
| +++
224224

225225
error[E0107]: missing generics for associated type `SVec::Item`
226-
--> $DIR/issue-105742.rs:22:30
226+
--> $DIR/issue-105742.rs:29:30
227227
|
228228
LL | Output = <Self as SVec>::Item> as SVec>::Item,
229229
| ^^^^ expected 1 lifetime argument
230230
|
231231
note: associated type defined here, with 1 lifetime parameter: `'a`
232-
--> $DIR/issue-105742.rs:32:10
232+
--> $DIR/issue-105742.rs:43:10
233233
|
234234
LL | type Item<'a, T>;
235235
| ^^^^ --
@@ -239,13 +239,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
239239
| ++++
240240

241241
error[E0107]: missing generics for associated type `SVec::Item`
242-
--> $DIR/issue-105742.rs:22:30
242+
--> $DIR/issue-105742.rs:29:30
243243
|
244244
LL | Output = <Self as SVec>::Item> as SVec>::Item,
245245
| ^^^^ expected 1 generic argument
246246
|
247247
note: associated type defined here, with 1 generic parameter: `T`
248-
--> $DIR/issue-105742.rs:32:10
248+
--> $DIR/issue-105742.rs:43:10
249249
|
250250
LL | type Item<'a, T>;
251251
| ^^^^ -
@@ -255,13 +255,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
255255
| +++
256256

257257
error[E0107]: missing generics for associated type `SVec::Item`
258-
--> $DIR/issue-105742.rs:22:46
258+
--> $DIR/issue-105742.rs:29:46
259259
|
260260
LL | Output = <Self as SVec>::Item> as SVec>::Item,
261261
| ^^^^ expected 1 lifetime argument
262262
|
263263
note: associated type defined here, with 1 lifetime parameter: `'a`
264-
--> $DIR/issue-105742.rs:32:10
264+
--> $DIR/issue-105742.rs:43:10
265265
|
266266
LL | type Item<'a, T>;
267267
| ^^^^ --
@@ -271,13 +271,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
271271
| ++++
272272

273273
error[E0107]: missing generics for associated type `SVec::Item`
274-
--> $DIR/issue-105742.rs:22:46
274+
--> $DIR/issue-105742.rs:29:46
275275
|
276276
LL | Output = <Self as SVec>::Item> as SVec>::Item,
277277
| ^^^^ expected 1 generic argument
278278
|
279279
note: associated type defined here, with 1 generic parameter: `T`
280-
--> $DIR/issue-105742.rs:32:10
280+
--> $DIR/issue-105742.rs:43:10
281281
|
282282
LL | type Item<'a, T>;
283283
| ^^^^ -
@@ -293,7 +293,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
293293
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SVec` cannot be made into an object
294294
|
295295
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
296-
--> $DIR/issue-105742.rs:11:17
296+
--> $DIR/issue-105742.rs:14:17
297297
|
298298
LL | pub trait SVec: Index<
299299
| ____________----__^
@@ -307,6 +307,7 @@ LL | |/ Output = <Index<<Self as SVec>::Item,
307307
LL | ||
308308
LL | ||
309309
LL | ||
310+
... ||
310311
LL | ||
311312
LL | || Output = <Self as SVec>::Item> as SVec>::Item,
312313
| ||_________________________________________________^ ...because it uses `Self` as a type parameter
@@ -316,13 +317,13 @@ LL | | > {
316317
| |__^ ...because it uses `Self` as a type parameter
317318

318319
error[E0107]: missing generics for associated type `SVec::Item`
319-
--> $DIR/issue-105742.rs:34:38
320+
--> $DIR/issue-105742.rs:45:38
320321
|
321322
LL | fn len(&self) -> <Self as SVec>::Item;
322323
| ^^^^ expected 1 lifetime argument
323324
|
324325
note: associated type defined here, with 1 lifetime parameter: `'a`
325-
--> $DIR/issue-105742.rs:32:10
326+
--> $DIR/issue-105742.rs:43:10
326327
|
327328
LL | type Item<'a, T>;
328329
| ^^^^ --
@@ -332,13 +333,13 @@ LL | fn len(&self) -> <Self as SVec>::Item<'_>;
332333
| ++++
333334

334335
error[E0107]: missing generics for associated type `SVec::Item`
335-
--> $DIR/issue-105742.rs:34:38
336+
--> $DIR/issue-105742.rs:45:38
336337
|
337338
LL | fn len(&self) -> <Self as SVec>::Item;
338339
| ^^^^ expected 1 generic argument
339340
|
340341
note: associated type defined here, with 1 generic parameter: `T`
341-
--> $DIR/issue-105742.rs:32:10
342+
--> $DIR/issue-105742.rs:43:10
342343
|
343344
LL | type Item<'a, T>;
344345
| ^^^^ -

0 commit comments

Comments
 (0)