]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #35348 - scottcarr:discriminant2, r=nikomatsakis
authorbors <bors@rust-lang.org>
Sat, 13 Aug 2016 08:20:46 +0000 (01:20 -0700)
committerGitHub <noreply@github.com>
Sat, 13 Aug 2016 08:20:46 +0000 (01:20 -0700)
[MIR] Add explicit SetDiscriminant StatementKind for deaggregating enums

cc #35186

To deaggregate enums, we need to be able to explicitly set the discriminant.  This PR implements a new StatementKind that does that.

I think some of the places that have `panics!` now could maybe do something smarter.

1  2 
src/librustc_mir/transform/type_check.rs

index 52f41741b08d69c6975ca1049ddafb3e91ecae6a,026d197cb7f35bec5b26469b852688b6599ce1d0..934357c9e1da2f4deb3d6019e30ae50bcdb3b972
@@@ -12,9 -12,9 +12,9 @@@
  #![allow(unreachable_code)]
  
  use rustc::infer::{self, InferCtxt, InferOk};
 -use rustc::traits::{self, ProjectionMode};
 +use rustc::traits::{self, Reveal};
  use rustc::ty::fold::TypeFoldable;
- use rustc::ty::{self, Ty, TyCtxt};
+ use rustc::ty::{self, Ty, TyCtxt, TypeVariants};
  use rustc::mir::repr::*;
  use rustc::mir::tcx::LvalueTy;
  use rustc::mir::transform::{MirPass, MirSource, Pass};