diff options
| author | kennytm <kennytm@gmail.com> | 2018-11-06 15:20:57 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-06 15:20:57 +0800 |
| commit | 1525b0ee826e38d8427b2fabb0b92f6f407d5cb7 (patch) | |
| tree | 6892859ba819a9f1b5e5f4aae69389f0d111befa | |
| parent | 24e66c28980442a48d9458f1a4f9b76cc722dc8a (diff) | |
| parent | dd68685e48db23b340ec31024c4c4aa2d6180a16 (diff) | |
| download | rust-1525b0ee826e38d8427b2fabb0b92f6f407d5cb7.tar.gz rust-1525b0ee826e38d8427b2fabb0b92f6f407d5cb7.zip | |
Rollup merge of #55490 - petrochenkov:resolveice, r=eddyb
resolve: Fix ICE in macro import error recovery Fixes https://github.com/rust-lang/rust/issues/55457
| -rw-r--r-- | src/librustc_resolve/macros.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/imports/issue-55457.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/imports/issue-55457.stderr | 31 |
3 files changed, 42 insertions, 0 deletions
diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index d5f344346c2..43a5fdb7a02 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -449,6 +449,9 @@ impl<'a, 'cl> Resolver<'a, 'cl> { return Err(Determinacy::Determined); } } + Def::Err => { + return Err(Determinacy::Determined); + } _ => panic!("expected `Def::Macro` or `Def::NonMacroAttr`"), } diff --git a/src/test/ui/imports/issue-55457.rs b/src/test/ui/imports/issue-55457.rs new file mode 100644 index 00000000000..9c6750fd48c --- /dev/null +++ b/src/test/ui/imports/issue-55457.rs @@ -0,0 +1,8 @@ +use NonExistent; //~ ERROR unresolved import `NonExistent` +use non_existent::non_existent; //~ ERROR unresolved import `non_existent` + +#[non_existent] //~ ERROR cannot determine resolution for the attribute macro `non_existent` +#[derive(NonExistent)] //~ ERROR cannot determine resolution for the derive macro `NonExistent` +struct S; + +fn main() {} diff --git a/src/test/ui/imports/issue-55457.stderr b/src/test/ui/imports/issue-55457.stderr new file mode 100644 index 00000000000..363dec06237 --- /dev/null +++ b/src/test/ui/imports/issue-55457.stderr @@ -0,0 +1,31 @@ +error[E0432]: unresolved import `NonExistent` + --> $DIR/issue-55457.rs:1:5 + | +LL | use NonExistent; //~ ERROR unresolved import `NonExistent` + | ^^^^^^^^^^^ no `NonExistent` in the root. Did you mean to use `non_existent`? + +error[E0432]: unresolved import `non_existent` + --> $DIR/issue-55457.rs:2:5 + | +LL | use non_existent::non_existent; //~ ERROR unresolved import `non_existent` + | ^^^^^^^^^^^^ Maybe a missing `extern crate non_existent;`? + +error: cannot determine resolution for the derive macro `NonExistent` + --> $DIR/issue-55457.rs:5:10 + | +LL | #[derive(NonExistent)] //~ ERROR cannot determine resolution for the derive macro `NonExistent` + | ^^^^^^^^^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error: cannot determine resolution for the attribute macro `non_existent` + --> $DIR/issue-55457.rs:4:3 + | +LL | #[non_existent] //~ ERROR cannot determine resolution for the attribute macro `non_existent` + | ^^^^^^^^^^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0432`. |
