Skip to content

Added support for struct-like enum variants in middle::ty::enum_variants() #7557

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

Merged
merged 1 commit into from
Jul 7, 2013

Conversation

michaelwoerister
Copy link
Member

After getting an ICE trying to use the Repr enum from middle::trans::adt (see issue #7527), I tried to implement the missing case for struct-like enum variants in middle::ty::enum_variants(). It seems to work now (and passes make check) but there are still some uncertainties that bother me:

  • I'm not sure I did everything, right. Especially getting the variant constructor function from the variant node id is just copied from the tuple-variant case. Someone with more experience in the code base should be able to see rather quickly whether this OK so.
  • It is kind of strange that I could not reproduce the ICE with a smaller test case. The unimplemented code path never seems to be hit in most cases, even when using the exact same Repr enum, just with ty::t replaced by an opaque pointer. Also, within the adt module, Repr and matching on it is used multiple times, again without running into problems. Can anyone explain why this is the case? That would be much appreciated.

Apart from that, I hope this PR is useful.

@jdm
Copy link
Contributor

jdm commented Jul 2, 2013

r? @pcwalton

@jdm
Copy link
Contributor

jdm commented Jul 3, 2013

See whether this fixes the testcase from #6362?

bors added a commit that referenced this pull request Jul 7, 2013
After getting an ICE trying to use the `Repr` enum from middle::trans::adt (see issue #7527), I tried to implement the missing case for struct-like enum variants in `middle::ty::enum_variants()`. It seems to work now (and passes make check) but there are still some uncertainties that bother me:
+ I'm not sure I did everything, right. Especially getting the variant constructor function from the variant node id is just copied from the tuple-variant case. Someone with more experience in the code base should be able to see rather quickly whether this OK so.
+ It is kind of strange that I could not reproduce the ICE with a smaller test case. The unimplemented code path never seems to be hit in most cases, even when using the exact same `Repr` enum, just with `ty::t` replaced by an opaque pointer. Also, within the `adt` module, `Repr` and matching on it is used multiple times, again without running into problems. Can anyone explain why this is the case? That would be much appreciated. 

Apart from that, I hope this PR is useful.
@bors bors closed this Jul 7, 2013
@bors bors merged commit 866a5b1 into rust-lang:master Jul 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants