@@ -121,31 +121,31 @@ impl<'tcx> TypeFoldable<'tcx> for LvalueTy<'tcx> {
121121}
122122
123123impl < ' tcx > Lvalue < ' tcx > {
124- pub fn ty < ' a , ' gcx > ( & self , mir : & Mir < ' tcx > , tcx : TyCtxt < ' a , ' gcx , ' tcx > ) -> LvalueTy < ' tcx > {
124+ pub fn ty < ' a , ' gcx > ( & self , local_decls : & LocalDecls < ' tcx > , tcx : TyCtxt < ' a , ' gcx , ' tcx > ) -> LvalueTy < ' tcx > {
125125 match * self {
126126 Lvalue :: Local ( index) =>
127- LvalueTy :: Ty { ty : mir . local_decls [ index] . ty } ,
127+ LvalueTy :: Ty { ty : local_decls[ index] . ty } ,
128128 Lvalue :: Static ( ref data) =>
129129 LvalueTy :: Ty { ty : data. ty } ,
130130 Lvalue :: Projection ( ref proj) =>
131- proj. base . ty ( mir , tcx) . projection_ty ( tcx, & proj. elem ) ,
131+ proj. base . ty ( local_decls , tcx) . projection_ty ( tcx, & proj. elem ) ,
132132 }
133133 }
134134}
135135
136136impl < ' tcx > Rvalue < ' tcx > {
137- pub fn ty < ' a , ' gcx > ( & self , mir : & Mir < ' tcx > , tcx : TyCtxt < ' a , ' gcx , ' tcx > ) -> Ty < ' tcx >
137+ pub fn ty < ' a , ' gcx > ( & self , local_decls : & LocalDecls < ' tcx > , tcx : TyCtxt < ' a , ' gcx , ' tcx > ) -> Ty < ' tcx >
138138 {
139139 match * self {
140- Rvalue :: Use ( ref operand) => operand. ty ( mir , tcx) ,
140+ Rvalue :: Use ( ref operand) => operand. ty ( local_decls , tcx) ,
141141 Rvalue :: Repeat ( ref operand, ref count) => {
142- let op_ty = operand. ty ( mir , tcx) ;
142+ let op_ty = operand. ty ( local_decls , tcx) ;
143143 let count = count. as_u64 ( tcx. sess . target . uint_type ) ;
144144 assert_eq ! ( count as usize as u64 , count) ;
145145 tcx. mk_array ( op_ty, count as usize )
146146 }
147147 Rvalue :: Ref ( reg, bk, ref lv) => {
148- let lv_ty = lv. ty ( mir , tcx) . to_ty ( tcx) ;
148+ let lv_ty = lv. ty ( local_decls , tcx) . to_ty ( tcx) ;
149149 tcx. mk_ref ( reg,
150150 ty:: TypeAndMut {
151151 ty : lv_ty,
@@ -156,22 +156,22 @@ impl<'tcx> Rvalue<'tcx> {
156156 Rvalue :: Len ( ..) => tcx. types . usize ,
157157 Rvalue :: Cast ( .., ty) => ty,
158158 Rvalue :: BinaryOp ( op, ref lhs, ref rhs) => {
159- let lhs_ty = lhs. ty ( mir , tcx) ;
160- let rhs_ty = rhs. ty ( mir , tcx) ;
159+ let lhs_ty = lhs. ty ( local_decls , tcx) ;
160+ let rhs_ty = rhs. ty ( local_decls , tcx) ;
161161 op. ty ( tcx, lhs_ty, rhs_ty)
162162 }
163163 Rvalue :: CheckedBinaryOp ( op, ref lhs, ref rhs) => {
164- let lhs_ty = lhs. ty ( mir , tcx) ;
165- let rhs_ty = rhs. ty ( mir , tcx) ;
164+ let lhs_ty = lhs. ty ( local_decls , tcx) ;
165+ let rhs_ty = rhs. ty ( local_decls , tcx) ;
166166 let ty = op. ty ( tcx, lhs_ty, rhs_ty) ;
167167 tcx. intern_tup ( & [ ty, tcx. types . bool ] , false )
168168 }
169169 Rvalue :: UnaryOp ( UnOp :: Not , ref operand) |
170170 Rvalue :: UnaryOp ( UnOp :: Neg , ref operand) => {
171- operand. ty ( mir , tcx)
171+ operand. ty ( local_decls , tcx)
172172 }
173173 Rvalue :: Discriminant ( ref lval) => {
174- let ty = lval. ty ( mir , tcx) . to_ty ( tcx) ;
174+ let ty = lval. ty ( local_decls , tcx) . to_ty ( tcx) ;
175175 if let ty:: TyAdt ( adt_def, _) = ty. sty {
176176 adt_def. repr . discr_type ( ) . to_ty ( tcx)
177177 } else {
@@ -189,7 +189,7 @@ impl<'tcx> Rvalue<'tcx> {
189189 }
190190 AggregateKind :: Tuple => {
191191 tcx. mk_tup (
192- ops. iter ( ) . map ( |op| op. ty ( mir , tcx) ) ,
192+ ops. iter ( ) . map ( |op| op. ty ( local_decls , tcx) ) ,
193193 false
194194 )
195195 }
@@ -206,9 +206,9 @@ impl<'tcx> Rvalue<'tcx> {
206206}
207207
208208impl < ' tcx > Operand < ' tcx > {
209- pub fn ty < ' a , ' gcx > ( & self , mir : & Mir < ' tcx > , tcx : TyCtxt < ' a , ' gcx , ' tcx > ) -> Ty < ' tcx > {
209+ pub fn ty < ' a , ' gcx > ( & self , local_decls : & LocalDecls < ' tcx > , tcx : TyCtxt < ' a , ' gcx , ' tcx > ) -> Ty < ' tcx > {
210210 match self {
211- & Operand :: Consume ( ref l) => l. ty ( mir , tcx) . to_ty ( tcx) ,
211+ & Operand :: Consume ( ref l) => l. ty ( local_decls , tcx) . to_ty ( tcx) ,
212212 & Operand :: Constant ( ref c) => c. ty ,
213213 }
214214 }
0 commit comments