Skip to content

Fix ICE: tuple_fields called on non-tuple: async fn with unknown macro #26

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

roxelo
Copy link
Member

@roxelo roxelo commented Oct 22, 2020

Potential fix for ICE bug.

For the following test:

async fn ice() -> Box<dyn std::error::Error> {
    macro!()
}

The new stderr output after the fix is:

error[E0670]: `async fn` is not permitted in the 2015 edition
 --> mytests/failing.rs:1:1
  |
1 | async fn ice() -> Box<dyn std::error::Error> {
  | ^^^^^ to use `async fn`, switch to Rust 2018
  |
  = help: set `edition = "2018"` in `Cargo.toml`
  = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error: expected identifier, found `!`
 --> mytests/failing.rs:2:10
  |
2 |     macro!()
  |          ^ expected identifier

error[E0601]: `main` function not found in crate `failing`
 --> mytests/failing.rs:1:1
  |
1 | / async fn ice() -> Box<dyn std::error::Error> {
2 | |     macro!()
3 | | }
  | |_^ consider adding a `main` function to `mytests/failing.rs`

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0601, E0670.
For more information about an error, try `rustc --explain E0601`.

This change is Reviewable

@roxelo roxelo marked this pull request as ready for review October 22, 2020 04:18
for upvar_ty in substs.as_generator().upvar_tys() {
upvar_ty.visit_with(self);
}
if let ty::Tuple(_) = ty.kind() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to write the code more robustly, I think, so that it permits Error or Tuple but not other cases. I suspect the right fix is going to be to modify upvar_tys -- wouldn't we expect ICEs from other callers?

@roxelo
Copy link
Member Author

roxelo commented Oct 27, 2020

Fix moved here: rust-lang#78432

@roxelo roxelo closed this Oct 27, 2020
@arora-aman arora-aman deleted the fix-ice-tuple-fields branch October 30, 2020 05:37
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants