Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve: Fix ICE in macro import error recovery #55490

Merged
merged 1 commit into from
Nov 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/librustc_resolve/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`"),
}

Expand Down
8 changes: 8 additions & 0 deletions src/test/ui/imports/issue-55457.rs
Original file line number Diff line number Diff line change
@@ -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() {}
31 changes: 31 additions & 0 deletions src/test/ui/imports/issue-55457.stderr
Original file line number Diff line number Diff line change
@@ -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`.