about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2021-09-30 23:41:05 -0700
committerGitHub <noreply@github.com>2021-09-30 23:41:05 -0700
commit9593e61f64233c6c556762060dc5e1cdc636845e (patch)
tree4c6ef110c0e5beb87abcb3120a202de0df44818b /compiler/rustc_codegen_llvm/src
parent598d89bf142823b5d84e2eb0f0f9e418ee966a4b (diff)
parent750018e16eb34f8b37477689fbd231bb720c8aaa (diff)
downloadrust-9593e61f64233c6c556762060dc5e1cdc636845e.tar.gz
rust-9593e61f64233c6c556762060dc5e1cdc636845e.zip
Rollup merge of #88838 - FabianWolff:issue-88472, r=estebank
Do not suggest importing inaccessible items

Fixes #88472. For this example:
```rust
mod a {
    struct Foo;
}

mod b {
    type Bar = Foo;
}
```
rustc currently emits:
```
error[E0412]: cannot find type `Foo` in this scope
 --> test.rs:6:16
  |
6 |     type Bar = Foo;
  |                ^^^ not found in this scope
  |
help: consider importing this struct
  |
6 |     use a::Foo;
  |
```
this is incorrect, as applying this suggestion leads to
```
error[E0603]: struct `Foo` is private
 --> test.rs:6:12
  |
6 |     use a::Foo;
  |            ^^^ private struct
  |
note: the struct `Foo` is defined here
 --> test.rs:2:5
  |
2 |     struct Foo;
  |     ^^^^^^^^^^^
```
With my changes, I get:
```
error[E0412]: cannot find type `Foo` in this scope
 --> test.rs:6:16
  |
6 |     type Bar = Foo;
  |                ^^^ not found in this scope
  |
  = note: this struct exists but is inaccessible:
          a::Foo
```
As for the wildcard mentioned in #88472, I would argue that the warning is actually correct, since the import _is_ unused. I think the real issue is the wrong suggestion, which I have fixed here.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions