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