We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3169277 commit 0a117eaCopy full SHA for 0a117ea
[refs]
@@ -14,4 +14,4 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
14
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
15
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
16
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17
-refs/heads/auto: 59daf76a8db88ec2ea4640f0fbf598402d1a10cb
+refs/heads/auto: 075affa50d04c585a53d0c8e7b66bae372a72648
branches/auto/src/librustc/middle/trans/consts.rs
@@ -240,16 +240,12 @@ fn const_expr_unchecked(cx: @CrateContext, e: @ast::expr) -> ValueRef {
240
}
241
ast::expr_field(base, field, _) => {
242
let bt = ty::expr_ty(cx.tcx, base);
243
+ let brepr = adt::represent_type(cx, bt);
244
let bv = const_expr(cx, base);
245
let (bt, bv) = const_autoderef(cx, bt, bv);
- do expr::with_field_tys(cx.tcx, bt, None) |_, field_tys| {
246
+ do expr::with_field_tys(cx.tcx, bt, None) |discr, field_tys| {
247
let ix = ty::field_idx_strict(cx.tcx, field, field_tys);
-
248
- // Note: ideally, we'd use `struct_field()` here instead
249
- // of hardcoding [0, ix], but we can't because it yields
250
- // the wrong type and also inserts an extra 0 that is
251
- // not needed in the constant variety:
252
- const_get_elt(cx, bv, [0, ix as c_uint])
+ adt::const_get_element(cx, &brepr, bv, discr, ix)
253
254
255
0 commit comments