Add error recovery for use foo::self
This commit is contained in:
parent
84a44218ad
commit
d190e10f74
8 changed files with 89 additions and 4 deletions
|
|
@ -9,7 +9,7 @@ use foo::{self};
|
|||
use foo as self;
|
||||
//~^ ERROR expected identifier
|
||||
|
||||
use foo::self;
|
||||
use foo::self; //~ ERROR is defined multiple times
|
||||
//~^ ERROR `self` imports are only allowed within a { } list
|
||||
|
||||
use foo::A;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,21 @@ help: you can use `as` to change the binding name of the import
|
|||
LL | use foo::{self as other_foo};
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0255]: the name `foo` is defined multiple times
|
||||
--> $DIR/import-self.rs:12:5
|
||||
|
|
||||
LL | mod foo {
|
||||
| ------- previous definition of the module `foo` here
|
||||
...
|
||||
LL | use foo::self;
|
||||
| ^^^^^^^^^ `foo` reimported here
|
||||
|
|
||||
= note: `foo` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use foo as other_foo;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0252]: the name `A` is defined multiple times
|
||||
--> $DIR/import-self.rs:16:11
|
||||
|
|
||||
|
|
@ -48,7 +63,7 @@ help: you can use `as` to change the binding name of the import
|
|||
LL | use foo::{self as OtherA};
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0252, E0255, E0429.
|
||||
For more information about an error, try `rustc --explain E0252`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue