Skip to content

Commit

Permalink
Auto merge of #42283 - Mark-Simulacrum:issue-40341, r=pnkfelix
Browse files Browse the repository at this point in the history
Add note regarding parent module containing use statement.

Fixes #40341.
  • Loading branch information
bors committed May 30, 2017
2 parents 77d096a + c85a8fb commit e1fe1a8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,32 @@ trait Foo {
fn foo<T>(x: T) {} // ok!
```
Another case that causes this error is when a type is imported into a parent
module. To fix this, you can follow the suggestion and use File directly or
`use super::File;` which will import the types from the parent namespace. An
example that causes this error is below:
```compile_fail,E0412
use std::fs::File;
mod foo {
fn some_function(f: File) {}
}
```
```
use std::fs::File;
mod foo {
// either
use super::File;
// or
// use std::fs::File;
fn foo(f: File) {}
}
# fn main() {} // don't insert it for us; that'll break imports
```
"##,

E0415: r##"
Expand Down

0 comments on commit e1fe1a8

Please sign in to comment.