Skip to content

Commit 96b641a

Browse files
csmoespastorino
authored andcommitted
introduce new place definition
1 parent 01af120 commit 96b641a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/librustc/mir/mod.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use syntax::ast::{self, Name};
2727
use syntax::symbol::InternedString;
2828
use syntax_pos::{Span, DUMMY_SP};
2929
use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
30+
use ty::List;
3031
use ty::subst::{Subst, Substs};
3132
use ty::layout::VariantIdx;
3233
use ty::{
@@ -1887,6 +1888,7 @@ impl<'tcx> Debug for Statement<'tcx> {
18871888
///////////////////////////////////////////////////////////////////////////
18881889
// Places
18891890

1891+
/// TODO(csmoe): merge the old Place repr into NeoPlace
18901892
/// A path to a value; something that can be evaluated without
18911893
/// changing or disturbing program state.
18921894
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
@@ -1904,6 +1906,27 @@ pub enum Place<'tcx> {
19041906
Projection(Box<PlaceProjection<'tcx>>),
19051907
}
19061908

1909+
/// A new Place repr
1910+
#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
1911+
pub struct NeoPlace<'tcx> {
1912+
base: PlaceBase<'tcx>,
1913+
elems: &'tcx List<PlaceElem<'tcx>>,
1914+
}
1915+
1916+
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx List<PlaceElem<'tcx>> {}
1917+
1918+
#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
1919+
pub enum PlaceBase<'tcx> {
1920+
/// local variable
1921+
Local(Local),
1922+
1923+
/// static or static mut variable
1924+
Static(Box<Static<'tcx>>),
1925+
1926+
/// Constant code promoted to an injected static
1927+
Promoted(Box<(Promoted, Ty<'tcx>)>),
1928+
}
1929+
19071930
/// The def-id of a static, along with its normalized type (which is
19081931
/// stored to avoid requiring normalization when reading MIR).
19091932
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]

0 commit comments

Comments
 (0)