|
2 | 2 | "message": "cannot find type `Iter` in this scope",
|
3 | 3 | "code": {
|
4 | 4 | "code": "E0412",
|
5 |
| - "explanation": "/nThe type name used is not in scope./n/nErroneous code examples:/n/n```compile_fail,E0412/nimpl Something {} // error: type name `Something` is not in scope/n/n// or:/n/ntrait Foo {/n fn bar(N); // error: type name `N` is not in scope/n}/n/n// or:/n/nfn foo(x: T) {} // type name `T` is not in scope/n```/n/nTo fix this error, please verify you didn't misspell the type name, you did/ndeclare it or imported it into the scope. Examples:/n/n```/nstruct Something;/n/nimpl Something {} // ok!/n/n// or:/n/ntrait Foo {/n type N;/n/n fn bar(_: Self::N); // ok!/n}/n/n// or:/n/nfn foo<T>(x: T) {} // ok!/n```/n/nAnother case that causes this error is when a type is imported into a parent/nmodule. To fix this, you can follow the suggestion and use File directly or/n`use super::File;` which will import the types from the parent namespace. An/nexample that causes this error is below:/n/n```compile_fail,E0412/nuse std::fs::File;/n/nmod foo {/n fn some_function(f: File) {}/n}/n```/n/n```/nuse std::fs::File;/n/nmod foo {/n // either/n use super::File;/n // or/n // use std::fs::File;/n fn foo(f: File) {}/n}/n# fn main() {} // don't insert it for us; that'll break imports/n```/n" |
| 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 | +" |
6 | 71 | },
|
7 | 72 | "level": "error",
|
8 | 73 | "spans": [
|
|
50 | 115 | }
|
51 | 116 | ],
|
52 | 117 | "label": null,
|
53 |
| - "suggested_replacement": "use std::collections::binary_heap::Iter;/n/n", |
| 118 | + "suggested_replacement": "use std::collections::binary_heap::Iter; |
| 119 | + |
| 120 | +", |
54 | 121 | "expansion": null
|
55 | 122 | },
|
56 | 123 | {
|
|
70 | 137 | }
|
71 | 138 | ],
|
72 | 139 | "label": null,
|
73 |
| - "suggested_replacement": "use std::collections::btree_map::Iter;/n/n", |
| 140 | + "suggested_replacement": "use std::collections::btree_map::Iter; |
| 141 | + |
| 142 | +", |
74 | 143 | "expansion": null
|
75 | 144 | },
|
76 | 145 | {
|
|
90 | 159 | }
|
91 | 160 | ],
|
92 | 161 | "label": null,
|
93 |
| - "suggested_replacement": "use std::collections::btree_set::Iter;/n/n", |
| 162 | + "suggested_replacement": "use std::collections::btree_set::Iter; |
| 163 | + |
| 164 | +", |
94 | 165 | "expansion": null
|
95 | 166 | },
|
96 | 167 | {
|
|
110 | 181 | }
|
111 | 182 | ],
|
112 | 183 | "label": null,
|
113 |
| - "suggested_replacement": "use std::collections::hash_map::Iter;/n/n", |
| 184 | + "suggested_replacement": "use std::collections::hash_map::Iter; |
| 185 | + |
| 186 | +", |
114 | 187 | "expansion": null
|
115 | 188 | },
|
116 | 189 | {
|
|
130 | 203 | }
|
131 | 204 | ],
|
132 | 205 | "label": null,
|
133 |
| - "suggested_replacement": "use std::collections::hash_set::Iter;/n/n", |
| 206 | + "suggested_replacement": "use std::collections::hash_set::Iter; |
| 207 | + |
| 208 | +", |
134 | 209 | "expansion": null
|
135 | 210 | },
|
136 | 211 | {
|
|
150 | 225 | }
|
151 | 226 | ],
|
152 | 227 | "label": null,
|
153 |
| - "suggested_replacement": "use std::collections::linked_list::Iter;/n/n", |
| 228 | + "suggested_replacement": "use std::collections::linked_list::Iter; |
| 229 | + |
| 230 | +", |
154 | 231 | "expansion": null
|
155 | 232 | },
|
156 | 233 | {
|
|
170 | 247 | }
|
171 | 248 | ],
|
172 | 249 | "label": null,
|
173 |
| - "suggested_replacement": "use std::collections::vec_deque::Iter;/n/n", |
| 250 | + "suggested_replacement": "use std::collections::vec_deque::Iter; |
| 251 | + |
| 252 | +", |
174 | 253 | "expansion": null
|
175 | 254 | },
|
176 | 255 | {
|
|
190 | 269 | }
|
191 | 270 | ],
|
192 | 271 | "label": null,
|
193 |
| - "suggested_replacement": "use std::option::Iter;/n/n", |
| 272 | + "suggested_replacement": "use std::option::Iter; |
| 273 | + |
| 274 | +", |
194 | 275 | "expansion": null
|
195 | 276 | },
|
196 | 277 | {
|
|
210 | 291 | }
|
211 | 292 | ],
|
212 | 293 | "label": null,
|
213 |
| - "suggested_replacement": "use std::path::Iter;/n/n", |
| 294 | + "suggested_replacement": "use std::path::Iter; |
| 295 | + |
| 296 | +", |
214 | 297 | "expansion": null
|
215 | 298 | },
|
216 | 299 | {
|
|
230 | 313 | }
|
231 | 314 | ],
|
232 | 315 | "label": null,
|
233 |
| - "suggested_replacement": "use std::result::Iter;/n/n", |
| 316 | + "suggested_replacement": "use std::result::Iter; |
| 317 | + |
| 318 | +", |
234 | 319 | "expansion": null
|
235 | 320 | },
|
236 | 321 | {
|
|
250 | 335 | }
|
251 | 336 | ],
|
252 | 337 | "label": null,
|
253 |
| - "suggested_replacement": "use std::slice::Iter;/n/n", |
| 338 | + "suggested_replacement": "use std::slice::Iter; |
| 339 | + |
| 340 | +", |
254 | 341 | "expansion": null
|
255 | 342 | },
|
256 | 343 | {
|
|
270 | 357 | }
|
271 | 358 | ],
|
272 | 359 | "label": null,
|
273 |
| - "suggested_replacement": "use std::sync::mpsc::Iter;/n/n", |
| 360 | + "suggested_replacement": "use std::sync::mpsc::Iter; |
| 361 | + |
| 362 | +", |
274 | 363 | "expansion": null
|
275 | 364 | }
|
276 | 365 | ],
|
277 | 366 | "children": [],
|
278 | 367 | "rendered": null
|
279 | 368 | }
|
280 | 369 | ],
|
281 |
| - "rendered": null |
| 370 | + "rendered": "error[E0412]: cannot find type `Iter` in this scope |
| 371 | + --> $DIR/use_suggestion_json.rs:20:12 |
| 372 | + | |
| 373 | +20 | let x: Iter; |
| 374 | + | ^^^^ not found in this scope |
| 375 | +help: possible candidates are found in other modules, you can import them into scope |
| 376 | + | |
| 377 | +19 | use std::collections::binary_heap::Iter; |
| 378 | + | |
| 379 | +19 | use std::collections::btree_map::Iter; |
| 380 | + | |
| 381 | +19 | use std::collections::btree_set::Iter; |
| 382 | + | |
| 383 | +19 | use std::collections::hash_map::Iter; |
| 384 | + | |
| 385 | +and 8 other candidates |
| 386 | + |
| 387 | +" |
282 | 388 | }
|
283 | 389 | {
|
284 | 390 | "message": "aborting due to previous error",
|
285 | 391 | "code": null,
|
286 | 392 | "level": "error",
|
287 | 393 | "spans": [],
|
288 | 394 | "children": [],
|
289 |
| - "rendered": null |
| 395 | + "rendered": "error: aborting due to previous error |
| 396 | + |
| 397 | +" |
290 | 398 | }
|
0 commit comments