@@ -2061,11 +2061,17 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
2061
2061
if ty:: type_is_sized ( bcx. tcx ( ) , content_ty) {
2062
2062
deref_owned_pointer ( bcx, expr, datum, content_ty)
2063
2063
} else {
2064
- // A fat pointer and an opened DST value have the same represenation
2065
- // just different types.
2066
- DatumBlock :: new ( bcx, Datum :: new ( datum. val ,
2067
- ty:: mk_open ( bcx. tcx ( ) , content_ty) ,
2068
- datum. kind ) )
2064
+ // A fat pointer and an opened DST value have the same
2065
+ // represenation just different types. Since there is no
2066
+ // temporary for `*e` here (because it is unsized), we cannot
2067
+ // emulate the sized object code path for running drop glue and
2068
+ // free. Instead, we schedule cleanup for `e`, turning it into
2069
+ // an lvalue.
2070
+ let datum = unpack_datum ! (
2071
+ bcx, datum. to_lvalue_datum( bcx, "deref" , expr. id) ) ;
2072
+
2073
+ let datum = Datum :: new ( datum. val , ty:: mk_open ( bcx. tcx ( ) , content_ty) , LvalueExpr ) ;
2074
+ DatumBlock :: new ( bcx, datum)
2069
2075
}
2070
2076
}
2071
2077
@@ -2094,7 +2100,7 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
2094
2100
// just different types.
2095
2101
DatumBlock :: new ( bcx, Datum :: new ( datum. val ,
2096
2102
ty:: mk_open ( bcx. tcx ( ) , content_ty) ,
2097
- datum . kind ) )
2103
+ LvalueExpr ) )
2098
2104
}
2099
2105
}
2100
2106
0 commit comments