@@ -45,6 +45,9 @@ pub struct Mir<'tcx> {
45
45
/// values in that it is possible to borrow them and mutate them
46
46
/// through the resulting reference.
47
47
pub temp_decls : Vec < TempDecl < ' tcx > > ,
48
+
49
+ /// A span representing this MIR, for error reporting
50
+ pub span : Span ,
48
51
}
49
52
50
53
/// where execution begins
@@ -145,7 +148,7 @@ pub enum BorrowKind {
145
148
146
149
/// A "variable" is a binding declared by the user as part of the fn
147
150
/// decl, a let, etc.
148
- #[ derive( Clone , RustcEncodable , RustcDecodable ) ]
151
+ #[ derive( Clone , Debug , RustcEncodable , RustcDecodable ) ]
149
152
pub struct VarDecl < ' tcx > {
150
153
pub mutability : Mutability ,
151
154
pub name : Name ,
@@ -154,7 +157,7 @@ pub struct VarDecl<'tcx> {
154
157
155
158
/// A "temp" is a temporary that we place on the stack. They are
156
159
/// anonymous, always mutable, and have only a type.
157
- #[ derive( Clone , RustcEncodable , RustcDecodable ) ]
160
+ #[ derive( Clone , Debug , RustcEncodable , RustcDecodable ) ]
158
161
pub struct TempDecl < ' tcx > {
159
162
pub ty : Ty < ' tcx > ,
160
163
}
@@ -170,7 +173,7 @@ pub struct TempDecl<'tcx> {
170
173
///
171
174
/// there is only one argument, of type `(i32, u32)`, but two bindings
172
175
/// (`x` and `y`).
173
- #[ derive( Clone , RustcEncodable , RustcDecodable ) ]
176
+ #[ derive( Clone , Debug , RustcEncodable , RustcDecodable ) ]
174
177
pub struct ArgDecl < ' tcx > {
175
178
pub ty : Ty < ' tcx > ,
176
179
}
@@ -499,7 +502,7 @@ pub struct Projection<'tcx, B, V> {
499
502
#[ derive( Clone , Debug , PartialEq , RustcEncodable , RustcDecodable ) ]
500
503
pub enum ProjectionElem < ' tcx , V > {
501
504
Deref ,
502
- Field ( Field ) ,
505
+ Field ( Field , Ty < ' tcx > ) ,
503
506
Index ( V ) ,
504
507
505
508
/// These indices are generated by slice patterns. Easiest to explain
@@ -550,8 +553,8 @@ impl Field {
550
553
}
551
554
552
555
impl < ' 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 ) )
555
558
}
556
559
557
560
pub fn deref ( self ) -> Lvalue < ' tcx > {
@@ -591,8 +594,8 @@ impl<'tcx> Debug for Lvalue<'tcx> {
591
594
write ! ( fmt, "({:?} as {})" , data. base, adt_def. variants[ index] . name) ,
592
595
ProjectionElem :: Deref =>
593
596
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 ) ,
596
599
ProjectionElem :: Index ( ref index) =>
597
600
write ! ( fmt, "{:?}[{:?}]" , data. base, index) ,
598
601
ProjectionElem :: ConstantIndex { offset, min_length, from_end : false } =>
0 commit comments