@@ -52,7 +52,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
52
52
bcx
53
53
}
54
54
55
- mir:: Rvalue :: Cast ( mir:: CastKind :: Unsize , ref operand , cast_ty) => {
55
+ mir:: Rvalue :: Cast ( mir:: CastKind :: Unsize , ref source , cast_ty) => {
56
56
if common:: type_is_fat_ptr ( bcx. tcx ( ) , cast_ty) {
57
57
// into-coerce of a thin pointer to a fat pointer - just
58
58
// use the operand path.
@@ -65,7 +65,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
65
65
// this to be eliminated by MIR translation, but
66
66
// `CoerceUnsized` can be passed by a where-clause,
67
67
// so the (generic) MIR may not be able to expand it.
68
- let operand = self . trans_operand ( & bcx, operand ) ;
68
+ let operand = self . trans_operand ( & bcx, source ) ;
69
69
bcx. with_block ( |bcx| {
70
70
match operand. val {
71
71
OperandValue :: FatPtr ( ..) => unreachable ! ( ) ,
@@ -90,6 +90,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
90
90
}
91
91
}
92
92
} ) ;
93
+ self . set_operand_dropped ( & bcx, source) ;
93
94
bcx
94
95
}
95
96
@@ -124,8 +125,8 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
124
125
adt:: trans_field_ptr ( bcx, & repr, val, disr, i)
125
126
} ) ;
126
127
self . store_operand ( & bcx, lldest_i, op) ;
127
- self . set_operand_dropped ( & bcx, operand) ;
128
128
}
129
+ self . set_operand_dropped ( & bcx, operand) ;
129
130
}
130
131
} ,
131
132
_ => {
@@ -163,8 +164,8 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
163
164
// not be structs but arrays.
164
165
let dest = bcx. gepi ( dest. llval , & [ 0 , i] ) ;
165
166
self . store_operand ( & bcx, dest, op) ;
166
- self . set_operand_dropped ( & bcx, operand) ;
167
167
}
168
+ self . set_operand_dropped ( & bcx, operand) ;
168
169
}
169
170
}
170
171
}
@@ -213,8 +214,8 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
213
214
assert ! ( rvalue_creates_operand( rvalue) , "cannot trans {:?} to operand" , rvalue) ;
214
215
215
216
match * rvalue {
216
- mir:: Rvalue :: Cast ( ref kind, ref operand , cast_ty) => {
217
- let operand = self . trans_operand ( & bcx, operand ) ;
217
+ mir:: Rvalue :: Cast ( ref kind, ref source , cast_ty) => {
218
+ let operand = self . trans_operand ( & bcx, source ) ;
218
219
debug ! ( "cast operand is {:?}" , operand) ;
219
220
let cast_ty = bcx. monomorphize ( & cast_ty) ;
220
221
@@ -247,6 +248,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
247
248
// example,
248
249
// &'a fmt::Debug+Send => &'a fmt::Debug,
249
250
// and is a no-op at the LLVM level
251
+ self . set_operand_dropped ( & bcx, source) ;
250
252
operand. val
251
253
}
252
254
OperandValue :: Immediate ( lldata) => {
@@ -255,6 +257,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
255
257
base:: unsize_thin_ptr ( bcx, lldata,
256
258
operand. ty , cast_ty)
257
259
} ) ;
260
+ self . set_operand_dropped ( & bcx, source) ;
258
261
OperandValue :: FatPtr ( lldata, llextra)
259
262
}
260
263
OperandValue :: Ref ( _) => {
0 commit comments