diff options
| author | Saleem Jaffer <saleem@acko.com> | 2019-03-23 18:29:02 +0530 |
|---|---|---|
| committer | Saleem Jaffer <saleem@acko.com> | 2019-03-23 20:18:52 +0530 |
| commit | 752544b28411540d7beb6fe4d1e2f1d8c775e05b (patch) | |
| tree | cb9af976b10ef93971b1eff8f30f979057621c70 /src/librustc_codegen_ssa | |
| parent | cf2f1bb072c76ed45882e1a69ed7b8ec96bad0e9 (diff) | |
| download | rust-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.rs | 18 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/mir/place.rs | 8 |
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. |
