-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error recovery for
use foo::self
- Loading branch information
Showing
8 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
mod foo { | ||
pub mod bar { | ||
pub fn drop() {} | ||
} | ||
} | ||
|
||
use foo::bar::self; | ||
//~^ ERROR `self` imports are only allowed within a { } list | ||
|
||
fn main() { | ||
// Because of error recovery this shouldn't error | ||
bar::drop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error[E0429]: `self` imports are only allowed within a { } list | ||
--> $DIR/use-mod-5.rs:7:13 | ||
| | ||
LL | use foo::bar::self; | ||
| ^^^^^^ | ||
| | ||
help: Remove `::self`.. | ||
| | ||
LL | use foo::bar; | ||
| -- | ||
help: ..or add braces around `self` | ||
| | ||
LL | use foo::bar::{self}; | ||
| ^ ^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0429`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
mod foo { | ||
pub mod bar { | ||
pub fn drop() {} | ||
} | ||
} | ||
|
||
use foo::bar::self as abc; | ||
//~^ ERROR `self` imports are only allowed within a { } list | ||
|
||
fn main() { | ||
// Because of error recovery this shouldn't error | ||
abc::drop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error[E0429]: `self` imports are only allowed within a { } list | ||
--> $DIR/use-mod-6.rs:7:13 | ||
| | ||
LL | use foo::bar::self as abc; | ||
| ^^^^^^ | ||
| | ||
help: Remove `::self`.. | ||
| | ||
LL | use foo::bar as abc; | ||
| -- | ||
help: ..or add braces around `self` | ||
| | ||
LL | use foo::bar::{self as abc}; | ||
| ^ ^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0429`. |