about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa
diff options
context:
space:
mode:
authorSaleem Jaffer <saleem@acko.com>2019-03-23 18:29:02 +0530
committerSaleem Jaffer <saleem@acko.com>2019-03-23 20:18:52 +0530
commit752544b28411540d7beb6fe4d1e2f1d8c775e05b (patch)
treecb9af976b10ef93971b1eff8f30f979057621c70 /src/librustc_codegen_ssa
parentcf2f1bb072c76ed45882e1a69ed7b8ec96bad0e9 (diff)
downloadrust-752544b28411540d7beb6fe4d1e2f1d8c775e05b.tar.gz
rust-752544b28411540d7beb6fe4d1e2f1d8c775e05b.zip
adding mir::StaticKind enum for static and promoted
Diffstat (limited to 'src/librustc_codegen_ssa')
-rw-r--r--src/librustc_codegen_ssa/mir/block.rs18
-rw-r--r--src/librustc_codegen_ssa/mir/place.rs8
2 files changed, 17 insertions, 9 deletions
diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs
index 066b38be3db..4774f8fe5a3 100644
--- a/src/librustc_codegen_ssa/mir/block.rs
+++ b/src/librustc_codegen_ssa/mir/block.rs
@@ -1,7 +1,7 @@
 use rustc::middle::lang_items;
 use rustc::ty::{self, Ty, TypeFoldable};
 use rustc::ty::layout::{self, LayoutOf, HasTyCtxt};
-use rustc::mir::{self, Place, PlaceBase};
+use rustc::mir::{self, Place, PlaceBase, Static, StaticKind};
 use rustc::mir::interpret::EvalErrorKind;
 use rustc_target::abi::call::{ArgType, FnType, PassMode, IgnoreMode};
 use rustc_target::spec::abi::Abi;
@@ -621,14 +621,18 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                         // but specified directly in the code. This means it gets promoted
                         // and we can then extract the value by evaluating the promoted.
                         mir::Operand::Copy(
-                            Place::Base(PlaceBase::Static(
-                                box mir::Static {promoted: Some(promoted), ty, ..}
-                            ))
+                            Place::Base(
+                                PlaceBase::Static(
+                                    box Static { kind: StaticKind::Promoted(promoted), ty }
+                                )
+                            )
                         ) |
                         mir::Operand::Move(
-                            Place::Base(PlaceBase::Static(
-                                box mir::Static {promoted: Some(promoted), ty, ..}
-                            ))
+                            Place::Base(
+                                PlaceBase::Static(
+                                    box Static { kind: StaticKind::Promoted(promoted), ty }
+                                )
+                            )
                         ) => {
                             let param_env = ty::ParamEnv::reveal_all();
                             let cid = mir::interpret::GlobalId {
diff --git a/src/librustc_codegen_ssa/mir/place.rs b/src/librustc_codegen_ssa/mir/place.rs
index 1608429b070..7cafa0088a0 100644
--- a/src/librustc_codegen_ssa/mir/place.rs
+++ b/src/librustc_codegen_ssa/mir/place.rs
@@ -409,7 +409,9 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
         let result = match *place {
             mir::Place::Base(mir::PlaceBase::Local(_)) => bug!(), // handled above
             mir::Place::Base(
-                mir::PlaceBase::Static(box mir::Static { def_id: _, ty, promoted: Some(promoted) })
+                mir::PlaceBase::Static(
+                    box mir::Static { ty, kind: mir::StaticKind::Promoted(promoted) }
+                )
             ) => {
                 let param_env = ty::ParamEnv::reveal_all();
                 let cid = mir::interpret::GlobalId {
@@ -438,7 +440,9 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                 }
             }
             mir::Place::Base(
-                mir::PlaceBase::Static(box mir::Static { def_id, ty, promoted: None })
+                mir::PlaceBase::Static(
+                    box mir::Static { ty, kind: mir::StaticKind::Static(def_id) }
+                )
             ) => {
                 // NB: The layout of a static may be unsized as is the case when working
                 // with a static that is an extern_type.