rust/src
Manish Goregaokar 9593e61f64
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.
2021-09-30 23:41:05 -07:00
..
bootstrap bootstrap: Update comment (again) in config.library.toml 2021-09-30 11:25:20 -05:00
build_helper Migrate to 2021 2021-09-20 22:21:42 -04:00
ci Fix Windows LLVM issue. 2021-09-29 15:27:44 -07:00
doc Update books 2021-09-29 14:37:40 -07:00
etc Migrate to 2021 2021-09-20 22:21:42 -04:00
librustdoc Rollup merge of #89366 - GuillaumeGomez:remove-lazy-static, r=jyn514 2021-09-29 19:33:43 -07:00
llvm-project@cba558df77 Update LLVM submodule 2021-09-20 23:07:04 +02:00
rustdoc-json-types Migrate to 2021 2021-09-20 22:21:42 -04:00
test Rollup merge of #88838 - FabianWolff:issue-88472, r=estebank 2021-09-30 23:41:05 -07:00
tools Rollup merge of #88782 - asquared31415:issue-79559, r=cjgillot 2021-09-30 18:05:20 -07:00
README.md
stage0.json Bump stage0 compiler to 1.56 2021-09-08 20:51:05 -04:00
version Bump version to 1.57 2021-09-03 21:54:48 -04:00

This directory contains the source code of the rust project, including:

  • The test suite
  • The bootstrapping build system
  • Various submodules for tools, like rustdoc, rls, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.