]> git.lizzy.rs Git - rust.git/commit
auto merge of #7557 : michaelwoerister/rust/enum_structs, r=pcwalton
authorbors <bors@rust-lang.org>
Sun, 7 Jul 2013 06:59:05 +0000 (23:59 -0700)
committerbors <bors@rust-lang.org>
Sun, 7 Jul 2013 06:59:05 +0000 (23:59 -0700)
commit88487d8274a51afa253d9f9612991621f1ec4fd0
tree4fe4653c07ec78158432ee4ab922a7e6561c7e47
parentb16825216e7b4196a88b103cd6921d8cdb0ba7be
parent866a5b1c78e52bd5c1c34df4a1a3c363ad6bfe7c
auto merge of #7557 : michaelwoerister/rust/enum_structs, r=pcwalton

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.
src/librustc/middle/ty.rs