Skip to content

Commit c20457b

Browse files
committed
cleaning up
1 parent 3009ccb commit c20457b

File tree

3 files changed

+63
-5
lines changed

3 files changed

+63
-5
lines changed
Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,64 @@
11
#### Note: this error code is no longer emitted by the compiler.
22

3-
Unresolved types are now reported under the unified error code E0425
4-
("cannot find ... in this scope").
3+
Erroneous code examples:
54

6-
See the explanation for E0425 for guidance on common causes and fixes.
5+
```compile_fail,E0412
6+
impl Something {} // error: type name `Something` is not in scope
7+
8+
// or:
9+
10+
trait Foo {
11+
fn bar(N); // error: type name `N` is not in scope
12+
}
13+
14+
// or:
15+
16+
fn foo(x: T) {} // type name `T` is not in scope
17+
```
18+
19+
To fix this error, please verify you didn't misspell the type name, you did
20+
declare it or imported it into the scope. Examples:
21+
22+
```
23+
struct Something;
24+
25+
impl Something {} // ok!
26+
27+
// or:
28+
29+
trait Foo {
30+
type N;
31+
32+
fn bar(_: Self::N); // ok!
33+
}
34+
35+
// or:
36+
37+
fn foo<T>(x: T) {} // ok!
38+
```
39+
40+
Another case that causes this error is when a type is imported into a parent
41+
module. To fix this, you can follow the suggestion and use File directly or
42+
`use super::File;` which will import the types from the parent namespace. An
43+
example that causes this error is below:
44+
45+
```compile_fail,E0412
46+
use std::fs::File;
47+
48+
mod foo {
49+
fn some_function(f: File) {}
50+
}
51+
```
52+
53+
```
54+
use std::fs::File;
55+
56+
mod foo {
57+
// either
58+
use super::File;
59+
// or
60+
// use std::fs::File;
61+
fn foo(f: File) {}
62+
}
63+
# fn main() {} // don't insert it for us; that'll break imports
64+
```

compiler/rustc_resolve/src/late.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4359,7 +4359,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
43594359

43604360
// There are two different error messages user might receive at
43614361
// this point:
4362-
// - E0425 cannot find `{}` in this scope
4362+
// - E0425 cannot find type `{}` in this scope
43634363
// - E0433 failed to resolve: use of undeclared type or module `{}`
43644364
//
43654365
// The first one is emitted for paths in type-position, and the

tests/ui/parallel-rustc/ty-variance-issue-124423.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,4 +283,4 @@ note: if you're trying to build a new `Box<_, _>` consider using one of the foll
283283
error: aborting due to 30 previous errors
284284

285285
Some errors have detailed explanations: E0121, E0224, E0261, E0425, E0599.
286-
For more information about an error, try `rustc --explain E0121`.
286+
For more information about an error, try `rustc --explain E0121`.

0 commit comments

Comments
 (0)