diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-02-05 07:01:48 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-02-25 17:07:59 +0200 |
| commit | e96a171453973bad66ed9b5df3a7f6e37d9bce31 (patch) | |
| tree | a0b02603017a66c97e779890685a52e5b8ac43d3 /src/librustc/mir | |
| parent | 86e402904ae68e3a72e5c88d0a1722ab753f98d8 (diff) | |
| download | rust-e96a171453973bad66ed9b5df3a7f6e37d9bce31.tar.gz rust-e96a171453973bad66ed9b5df3a7f6e37d9bce31.zip | |
rustc: move the actual values of enum discriminants into a map.
Diffstat (limited to 'src/librustc/mir')
| -rw-r--r-- | src/librustc/mir/tcx.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index 5c8d031caf6..527f1152770 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -173,7 +173,9 @@ impl<'tcx> Rvalue<'tcx> { Rvalue::Discriminant(ref lval) => { let ty = lval.ty(mir, tcx).to_ty(tcx); if let ty::TyAdt(adt_def, _) = ty.sty { - Some(adt_def.discr_ty.to_ty(tcx)) + let repr_hints = tcx.lookup_repr_hints(adt_def.did); + let repr_type = tcx.enum_repr_type(repr_hints.get(0)); + Some(repr_type.to_ty(tcx)) } else { // Undefined behaviour, bug for now; may want to return something for // the `discriminant` intrinsic later. |
