@@ -45,6 +45,9 @@ pub struct Mir<'tcx> {
4545 /// values in that it is possible to borrow them and mutate them
4646 /// through the resulting reference.
4747 pub temp_decls : Vec < TempDecl < ' tcx > > ,
48+
49+ /// A span representing this MIR, for error reporting
50+ pub span : Span ,
4851}
4952
5053/// where execution begins
@@ -145,7 +148,7 @@ pub enum BorrowKind {
145148
146149/// A "variable" is a binding declared by the user as part of the fn
147150/// decl, a let, etc.
148- #[ derive( Clone , RustcEncodable , RustcDecodable ) ]
151+ #[ derive( Clone , Debug , RustcEncodable , RustcDecodable ) ]
149152pub struct VarDecl < ' tcx > {
150153 pub mutability : Mutability ,
151154 pub name : Name ,
@@ -154,7 +157,7 @@ pub struct VarDecl<'tcx> {
154157
155158/// A "temp" is a temporary that we place on the stack. They are
156159/// anonymous, always mutable, and have only a type.
157- #[ derive( Clone , RustcEncodable , RustcDecodable ) ]
160+ #[ derive( Clone , Debug , RustcEncodable , RustcDecodable ) ]
158161pub struct TempDecl < ' tcx > {
159162 pub ty : Ty < ' tcx > ,
160163}
@@ -170,7 +173,7 @@ pub struct TempDecl<'tcx> {
170173///
171174/// there is only one argument, of type `(i32, u32)`, but two bindings
172175/// (`x` and `y`).
173- #[ derive( Clone , RustcEncodable , RustcDecodable ) ]
176+ #[ derive( Clone , Debug , RustcEncodable , RustcDecodable ) ]
174177pub struct ArgDecl < ' tcx > {
175178 pub ty : Ty < ' tcx > ,
176179}
@@ -499,7 +502,7 @@ pub struct Projection<'tcx, B, V> {
499502#[ derive( Clone , Debug , PartialEq , RustcEncodable , RustcDecodable ) ]
500503pub enum ProjectionElem < ' tcx , V > {
501504 Deref ,
502- Field ( Field ) ,
505+ Field ( Field , Ty < ' tcx > ) ,
503506 Index ( V ) ,
504507
505508 /// These indices are generated by slice patterns. Easiest to explain
@@ -550,8 +553,8 @@ impl Field {
550553}
551554
552555impl < ' tcx > Lvalue < ' tcx > {
553- pub fn field ( self , f : Field ) -> Lvalue < ' tcx > {
554- self . elem ( ProjectionElem :: Field ( f) )
556+ pub fn field ( self , f : Field , ty : Ty < ' tcx > ) -> Lvalue < ' tcx > {
557+ self . elem ( ProjectionElem :: Field ( f, ty ) )
555558 }
556559
557560 pub fn deref ( self ) -> Lvalue < ' tcx > {
@@ -591,8 +594,8 @@ impl<'tcx> Debug for Lvalue<'tcx> {
591594 write ! ( fmt, "({:?} as {})" , data. base, adt_def. variants[ index] . name) ,
592595 ProjectionElem :: Deref =>
593596 write ! ( fmt, "(*{:?})" , data. base) ,
594- ProjectionElem :: Field ( field) =>
595- write ! ( fmt, "{:?}.{:?}" , data. base, field. index( ) ) ,
597+ ProjectionElem :: Field ( field, ty ) =>
598+ write ! ( fmt, "( {:?}.{:?}: {:?}) " , data. base, field. index( ) , ty ) ,
596599 ProjectionElem :: Index ( ref index) =>
597600 write ! ( fmt, "{:?}[{:?}]" , data. base, index) ,
598601 ProjectionElem :: ConstantIndex { offset, min_length, from_end : false } =>
0 commit comments