Skip to content

Commit 64db226

Browse files
committed
---
yaml --- r: 2023 b: refs/heads/master c: 6dcf621 h: refs/heads/master i: 2021: d4bbb4b 2019: 5ae190f 2015: 5453cae v: v3
1 parent 4091f30 commit 64db226

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 9b35051143e5a99ed8070fc42c88015236765f1d
2+
refs/heads/master: 6dcf6218b1e0e70e60afe8d1a9f336adad060362

trunk/src/comp/middle/trans.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -2934,7 +2934,19 @@ fn autoderef(@block_ctxt cx, ValueRef v, @ty.t t) -> result {
29342934
vec(C_int(0),
29352935
C_int(abi.box_rc_field_body)));
29362936
t1 = mt.ty;
2937-
v1 = load_scalar_or_boxed(cx, body, t1);
2937+
2938+
// Since we're changing levels of box indirection, we may have
2939+
// to cast this pointer, since statically-sized tag types have
2940+
// different types depending on whether they're behind a box
2941+
// or not.
2942+
if (!ty.type_has_dynamic_size(mt.ty)) {
2943+
auto llty = type_of(cx.fcx.ccx, mt.ty);
2944+
v1 = cx.build.PointerCast(body, T_ptr(llty));
2945+
} else {
2946+
v1 = body;
2947+
}
2948+
2949+
v1 = load_scalar_or_boxed(cx, v1, t1);
29382950
}
29392951
case (_) {
29402952
ret res(cx, v1);

0 commit comments

Comments
 (0)