Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/librustc/middle/trans/datum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ impl Datum<Expr> {
name: &str,
expr_id: ast::NodeId)
-> DatumBlock<'a, Lvalue> {
debug!("to_lvalue_datum self: {}", self.to_string(bcx.ccx()));

assert!(ty::lltype_is_sized(bcx.tcx(), self.ty),
"Trying to convert unsized value to lval");
self.match_kind(
Expand Down
18 changes: 12 additions & 6 deletions src/librustc/middle/trans/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2066,11 +2066,17 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
if ty::type_is_sized(bcx.tcx(), content_ty) {
deref_owned_pointer(bcx, expr, datum, content_ty)
} else {
// A fat pointer and an opened DST value have the same represenation
// just different types.
DatumBlock::new(bcx, Datum::new(datum.val,
ty::mk_open(bcx.tcx(), content_ty),
datum.kind))
// A fat pointer and an opened DST value have the same
// represenation just different types. Since there is no
// temporary for `*e` here (because it is unsized), we cannot
// emulate the sized object code path for running drop glue and
// free. Instead, we schedule cleanup for `e`, turning it into
// an lvalue.
let datum = unpack_datum!(
bcx, datum.to_lvalue_datum(bcx, "deref", expr.id));

let datum = Datum::new(datum.val, ty::mk_open(bcx.tcx(), content_ty), LvalueExpr);
DatumBlock::new(bcx, datum)
}
}

Expand Down Expand Up @@ -2099,7 +2105,7 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
// just different types.
DatumBlock::new(bcx, Datum::new(datum.val,
ty::mk_open(bcx.tcx(), content_ty),
datum.kind))
LvalueExpr))
}
}

Expand Down