]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lint/use_suggestion_json.stderr
Move parse-fail tests to UI
[rust.git] / src / test / ui / lint / use_suggestion_json.stderr
1 {
2   "message": "cannot find type `Iter` in this scope",
3   "code": {
4     "code": "E0412",
5     "explanation": "
6 The type name used is not in scope.
7
8 Erroneous code examples:
9
10 ```compile_fail,E0412
11 impl Something {} // error: type name `Something` is not in scope
12
13 // or:
14
15 trait Foo {
16     fn bar(N); // error: type name `N` is not in scope
17 }
18
19 // or:
20
21 fn foo(x: T) {} // type name `T` is not in scope
22 ```
23
24 To fix this error, please verify you didn't misspell the type name, you did
25 declare it or imported it into the scope. Examples:
26
27 ```
28 struct Something;
29
30 impl Something {} // ok!
31
32 // or:
33
34 trait Foo {
35     type N;
36
37     fn bar(_: Self::N); // ok!
38 }
39
40 // or:
41
42 fn foo<T>(x: T) {} // ok!
43 ```
44
45 Another case that causes this error is when a type is imported into a parent
46 module. To fix this, you can follow the suggestion and use File directly or
47 `use super::File;` which will import the types from the parent namespace. An
48 example that causes this error is below:
49
50 ```compile_fail,E0412
51 use std::fs::File;
52
53 mod foo {
54     fn some_function(f: File) {}
55 }
56 ```
57
58 ```
59 use std::fs::File;
60
61 mod foo {
62     // either
63     use super::File;
64     // or
65     // use std::fs::File;
66     fn foo(f: File) {}
67 }
68 # fn main() {} // don't insert it for us; that'll break imports
69 ```
70 "
71   },
72   "level": "error",
73   "spans": [
74     {
75       "file_name": "$DIR/use_suggestion_json.rs",
76       "byte_start": 907,
77       "byte_end": 911,
78       "line_start": 21,
79       "line_end": 21,
80       "column_start": 12,
81       "column_end": 16,
82       "is_primary": true,
83       "text": [
84         {
85           "text": "    let x: Iter;",
86           "highlight_start": 12,
87           "highlight_end": 16
88         }
89       ],
90       "label": "not found in this scope",
91       "suggested_replacement": null,
92       "suggestion_applicability": null,
93       "expansion": null
94     }
95   ],
96   "children": [
97     {
98       "message": "possible candidates are found in other modules, you can import them into scope",
99       "code": null,
100       "level": "help",
101       "spans": [
102         {
103           "file_name": "$DIR/use_suggestion_json.rs",
104           "byte_start": 884,
105           "byte_end": 884,
106           "line_start": 20,
107           "line_end": 20,
108           "column_start": 1,
109           "column_end": 1,
110           "is_primary": true,
111           "text": [
112             {
113               "text": "fn main() {",
114               "highlight_start": 1,
115               "highlight_end": 1
116             }
117           ],
118           "label": null,
119           "suggested_replacement": "use std::collections::binary_heap::Iter;
120
121 ",
122           "suggestion_applicability": "Unspecified",
123           "expansion": null
124         },
125         {
126           "file_name": "$DIR/use_suggestion_json.rs",
127           "byte_start": 884,
128           "byte_end": 884,
129           "line_start": 20,
130           "line_end": 20,
131           "column_start": 1,
132           "column_end": 1,
133           "is_primary": true,
134           "text": [
135             {
136               "text": "fn main() {",
137               "highlight_start": 1,
138               "highlight_end": 1
139             }
140           ],
141           "label": null,
142           "suggested_replacement": "use std::collections::btree_map::Iter;
143
144 ",
145           "suggestion_applicability": "Unspecified",
146           "expansion": null
147         },
148         {
149           "file_name": "$DIR/use_suggestion_json.rs",
150           "byte_start": 884,
151           "byte_end": 884,
152           "line_start": 20,
153           "line_end": 20,
154           "column_start": 1,
155           "column_end": 1,
156           "is_primary": true,
157           "text": [
158             {
159               "text": "fn main() {",
160               "highlight_start": 1,
161               "highlight_end": 1
162             }
163           ],
164           "label": null,
165           "suggested_replacement": "use std::collections::btree_set::Iter;
166
167 ",
168           "suggestion_applicability": "Unspecified",
169           "expansion": null
170         },
171         {
172           "file_name": "$DIR/use_suggestion_json.rs",
173           "byte_start": 884,
174           "byte_end": 884,
175           "line_start": 20,
176           "line_end": 20,
177           "column_start": 1,
178           "column_end": 1,
179           "is_primary": true,
180           "text": [
181             {
182               "text": "fn main() {",
183               "highlight_start": 1,
184               "highlight_end": 1
185             }
186           ],
187           "label": null,
188           "suggested_replacement": "use std::collections::hash_map::Iter;
189
190 ",
191           "suggestion_applicability": "Unspecified",
192           "expansion": null
193         },
194         {
195           "file_name": "$DIR/use_suggestion_json.rs",
196           "byte_start": 884,
197           "byte_end": 884,
198           "line_start": 20,
199           "line_end": 20,
200           "column_start": 1,
201           "column_end": 1,
202           "is_primary": true,
203           "text": [
204             {
205               "text": "fn main() {",
206               "highlight_start": 1,
207               "highlight_end": 1
208             }
209           ],
210           "label": null,
211           "suggested_replacement": "use std::collections::hash_set::Iter;
212
213 ",
214           "suggestion_applicability": "Unspecified",
215           "expansion": null
216         },
217         {
218           "file_name": "$DIR/use_suggestion_json.rs",
219           "byte_start": 884,
220           "byte_end": 884,
221           "line_start": 20,
222           "line_end": 20,
223           "column_start": 1,
224           "column_end": 1,
225           "is_primary": true,
226           "text": [
227             {
228               "text": "fn main() {",
229               "highlight_start": 1,
230               "highlight_end": 1
231             }
232           ],
233           "label": null,
234           "suggested_replacement": "use std::collections::linked_list::Iter;
235
236 ",
237           "suggestion_applicability": "Unspecified",
238           "expansion": null
239         },
240         {
241           "file_name": "$DIR/use_suggestion_json.rs",
242           "byte_start": 884,
243           "byte_end": 884,
244           "line_start": 20,
245           "line_end": 20,
246           "column_start": 1,
247           "column_end": 1,
248           "is_primary": true,
249           "text": [
250             {
251               "text": "fn main() {",
252               "highlight_start": 1,
253               "highlight_end": 1
254             }
255           ],
256           "label": null,
257           "suggested_replacement": "use std::collections::vec_deque::Iter;
258
259 ",
260           "suggestion_applicability": "Unspecified",
261           "expansion": null
262         },
263         {
264           "file_name": "$DIR/use_suggestion_json.rs",
265           "byte_start": 884,
266           "byte_end": 884,
267           "line_start": 20,
268           "line_end": 20,
269           "column_start": 1,
270           "column_end": 1,
271           "is_primary": true,
272           "text": [
273             {
274               "text": "fn main() {",
275               "highlight_start": 1,
276               "highlight_end": 1
277             }
278           ],
279           "label": null,
280           "suggested_replacement": "use std::option::Iter;
281
282 ",
283           "suggestion_applicability": "Unspecified",
284           "expansion": null
285         },
286         {
287           "file_name": "$DIR/use_suggestion_json.rs",
288           "byte_start": 884,
289           "byte_end": 884,
290           "line_start": 20,
291           "line_end": 20,
292           "column_start": 1,
293           "column_end": 1,
294           "is_primary": true,
295           "text": [
296             {
297               "text": "fn main() {",
298               "highlight_start": 1,
299               "highlight_end": 1
300             }
301           ],
302           "label": null,
303           "suggested_replacement": "use std::path::Iter;
304
305 ",
306           "suggestion_applicability": "Unspecified",
307           "expansion": null
308         },
309         {
310           "file_name": "$DIR/use_suggestion_json.rs",
311           "byte_start": 884,
312           "byte_end": 884,
313           "line_start": 20,
314           "line_end": 20,
315           "column_start": 1,
316           "column_end": 1,
317           "is_primary": true,
318           "text": [
319             {
320               "text": "fn main() {",
321               "highlight_start": 1,
322               "highlight_end": 1
323             }
324           ],
325           "label": null,
326           "suggested_replacement": "use std::result::Iter;
327
328 ",
329           "suggestion_applicability": "Unspecified",
330           "expansion": null
331         },
332         {
333           "file_name": "$DIR/use_suggestion_json.rs",
334           "byte_start": 884,
335           "byte_end": 884,
336           "line_start": 20,
337           "line_end": 20,
338           "column_start": 1,
339           "column_end": 1,
340           "is_primary": true,
341           "text": [
342             {
343               "text": "fn main() {",
344               "highlight_start": 1,
345               "highlight_end": 1
346             }
347           ],
348           "label": null,
349           "suggested_replacement": "use std::slice::Iter;
350
351 ",
352           "suggestion_applicability": "Unspecified",
353           "expansion": null
354         },
355         {
356           "file_name": "$DIR/use_suggestion_json.rs",
357           "byte_start": 884,
358           "byte_end": 884,
359           "line_start": 20,
360           "line_end": 20,
361           "column_start": 1,
362           "column_end": 1,
363           "is_primary": true,
364           "text": [
365             {
366               "text": "fn main() {",
367               "highlight_start": 1,
368               "highlight_end": 1
369             }
370           ],
371           "label": null,
372           "suggested_replacement": "use std::sync::mpsc::Iter;
373
374 ",
375           "suggestion_applicability": "Unspecified",
376           "expansion": null
377         }
378       ],
379       "children": [],
380       "rendered": null
381     }
382   ],
383   "rendered": "error[E0412]: cannot find type `Iter` in this scope
384   --> $DIR/use_suggestion_json.rs:21:12
385    |
386 LL |     let x: Iter;
387    |            ^^^^ not found in this scope
388 help: possible candidates are found in other modules, you can import them into scope
389    |
390 LL | use std::collections::binary_heap::Iter;
391    |
392 LL | use std::collections::btree_map::Iter;
393    |
394 LL | use std::collections::btree_set::Iter;
395    |
396 LL | use std::collections::hash_map::Iter;
397    |
398 and 8 other candidates
399
400 "
401 }
402 {
403   "message": "aborting due to previous error",
404   "code": null,
405   "level": "error",
406   "spans": [],
407   "children": [],
408   "rendered": "error: aborting due to previous error
409
410 "
411 }
412 {
413   "message": "For more information about this error, try `rustc --explain E0412`.",
414   "code": null,
415   "level": "",
416   "spans": [],
417   "children": [],
418   "rendered": "For more information about this error, try `rustc --explain E0412`.
419 "
420 }