resolve: Desugar empty import groups into synthetic dummy imports

so that they are correctly resolved on 2018 edition
This commit is contained in:
Vadim Petrochenkov 2018-10-27 23:38:09 +03:00
parent 1f257bd022
commit c57f0a7201
7 changed files with 51 additions and 98 deletions

View file

@ -10,6 +10,6 @@
// Prefix in imports with empty braces should be resolved and checked privacy, stability, etc.
use foo::{}; //~ ERROR cannot find module or enum `foo` in the crate root
use foo::{}; //~ ERROR unresolved import `foo`
fn main() {}

View file

@ -1,9 +1,9 @@
error[E0578]: cannot find module or enum `foo` in the crate root
error[E0432]: unresolved import `foo`
--> $DIR/issue-28388-1.rs:13:5
|
LL | use foo::{}; //~ ERROR cannot find module or enum `foo` in the crate root
| ^^^ not found in the crate root
LL | use foo::{}; //~ ERROR unresolved import `foo`
| ^^^^^^^ no `foo` in the root
error: aborting due to previous error
For more information about this error, try `rustc --explain E0578`.
For more information about this error, try `rustc --explain E0432`.

View file

@ -17,8 +17,8 @@ use {}; // OK
use ::{}; // OK
use m::{}; // OK
use E::{}; // OK
use S::{}; //~ ERROR expected module or enum, found struct `S`
use Tr::{}; //~ ERROR expected module or enum, found trait `Tr`
use Nonexistent::{}; //~ ERROR cannot find module or enum `Nonexistent` in the crate root
use S::{}; // FIXME, this and `use S::{self};` should be an error
use Tr::{}; // FIXME, this and `use Tr::{self};` should be an error
use Nonexistent::{}; //~ ERROR unresolved import `Nonexistent`
fn main () {}

View file

@ -1,24 +1,9 @@
error[E0577]: expected module or enum, found struct `S`
--> $DIR/resolve-bad-import-prefix.rs:20:5
|
LL | use S::{}; //~ ERROR expected module or enum, found struct `S`
| -^^^^
| |
| did you mean `E`?
error[E0577]: expected module or enum, found trait `Tr`
--> $DIR/resolve-bad-import-prefix.rs:21:5
|
LL | use Tr::{}; //~ ERROR expected module or enum, found trait `Tr`
| ^^^^^^ not a module or enum
error[E0578]: cannot find module or enum `Nonexistent` in the crate root
error[E0432]: unresolved import `Nonexistent`
--> $DIR/resolve-bad-import-prefix.rs:22:5
|
LL | use Nonexistent::{}; //~ ERROR cannot find module or enum `Nonexistent` in the crate root
| ^^^^^^^^^^^ not found in the crate root
LL | use Nonexistent::{}; //~ ERROR unresolved import `Nonexistent`
| ^^^^^^^^^^^^^^^ no `Nonexistent` in the root
error: aborting due to 3 previous errors
error: aborting due to previous error
Some errors occurred: E0577, E0578.
For more information about an error, try `rustc --explain E0577`.
For more information about this error, try `rustc --explain E0432`.