Skip to content

Commit f5212e3

Browse files
committed
auto merge of #18856 : ruud-v-a/rust/fatptrs, r=cmr
This merges the `trt_field_*`, `fn_field_*` and `slice_elt_*` constants into two `fat_ptr_*` constants. This resolves the first part of #18590.
2 parents 641e2a1 + c724131 commit f5212e3

File tree

11 files changed

+56
-62
lines changed

11 files changed

+56
-62
lines changed

src/librustc_back/abi.rs

+12-18
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,17 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![allow(non_upper_case_globals)]
11+
pub const BOX_FIELD_DROP_GLUE: uint = 1u;
12+
pub const BOX_FIELD_BODY: uint = 4u;
1213

13-
pub const box_field_refcnt: uint = 0u;
14-
pub const box_field_drop_glue: uint = 1u;
15-
pub const box_field_body: uint = 4u;
14+
/// The first half of a fat pointer.
15+
/// - For a closure, this is the code address.
16+
/// - For an object or trait instance, this is the address of the box.
17+
/// - For a slice, this is the base address.
18+
pub const FAT_PTR_ADDR: uint = 0;
1619

17-
// FIXME(18590) although we have three different layouts here, the compiler relies on
18-
// them being the same. We should replace them with one set of constants.
19-
20-
// The two halves of a closure: code and environment.
21-
pub const fn_field_code: uint = 0u;
22-
pub const fn_field_box: uint = 1u;
23-
24-
// The two fields of a trait object/trait instance: vtable and box.
25-
// The vtable contains the type descriptor as first element.
26-
pub const trt_field_box: uint = 0u;
27-
pub const trt_field_vtable: uint = 1u;
28-
29-
pub const slice_elt_base: uint = 0u;
30-
pub const slice_elt_len: uint = 1u;
20+
/// The second half of a fat pointer.
21+
/// - For a closure, this is the address of the environment.
22+
/// - For an object or trait instance, this is the address of the vtable.
23+
/// - For a slice, this is the length.
24+
pub const FAT_PTR_EXTRA: uint = 1u;

src/librustc_trans/trans/_match.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,8 @@ fn bind_subslice_pat(bcx: Block,
649649
ty::mt {ty: vt.unit_ty, mutbl: ast::MutImmutable});
650650
let scratch = rvalue_scratch_datum(bcx, slice_ty, "");
651651
Store(bcx, slice_begin,
652-
GEPi(bcx, scratch.val, &[0u, abi::slice_elt_base]));
653-
Store(bcx, slice_len, GEPi(bcx, scratch.val, &[0u, abi::slice_elt_len]));
652+
GEPi(bcx, scratch.val, &[0u, abi::FAT_PTR_ADDR]));
653+
Store(bcx, slice_len, GEPi(bcx, scratch.val, &[0u, abi::FAT_PTR_EXTRA]));
654654
scratch.val
655655
}
656656

src/librustc_trans/trans/adt.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ use std::num::Int;
5252
use std::rc::Rc;
5353

5454
use llvm::{ValueRef, True, IntEQ, IntNE};
55-
use back::abi::slice_elt_base;
55+
use back::abi;
5656
use middle::subst;
5757
use middle::subst::Subst;
5858
use trans::_match;
@@ -684,7 +684,7 @@ fn struct_wrapped_nullable_bitdiscr(bcx: Block, nndiscr: Disr, ptrfield: Pointer
684684
scrutinee: ValueRef) -> ValueRef {
685685
let llptrptr = match ptrfield {
686686
ThinPointer(field) => GEPi(bcx, scrutinee, &[0, field]),
687-
FatPointer(field) => GEPi(bcx, scrutinee, &[0, field, slice_elt_base])
687+
FatPointer(field) => GEPi(bcx, scrutinee, &[0, field, abi::FAT_PTR_ADDR])
688688
};
689689
let llptr = Load(bcx, llptrptr);
690690
let cmp = if nndiscr == 0 { IntEQ } else { IntNE };
@@ -782,7 +782,7 @@ pub fn trans_set_discr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, r: &Repr<'tcx>,
782782
(GEPi(bcx, val, &[0, field]),
783783
type_of::type_of(bcx.ccx(), nonnull.fields[field])),
784784
FatPointer(field) => {
785-
let v = GEPi(bcx, val, &[0, field, slice_elt_base]);
785+
let v = GEPi(bcx, val, &[0, field, abi::FAT_PTR_ADDR]);
786786
(v, val_ty(v).element_type())
787787
}
788788
};
@@ -1118,7 +1118,7 @@ pub fn const_get_discrim(ccx: &CrateContext, r: &Repr, val: ValueRef)
11181118
StructWrappedNullablePointer { nndiscr, ptrfield, .. } => {
11191119
let (idx, sub_idx) = match ptrfield {
11201120
ThinPointer(field) => (field, None),
1121-
FatPointer(field) => (field, Some(slice_elt_base))
1121+
FatPointer(field) => (field, Some(abi::FAT_PTR_ADDR))
11221122
};
11231123
if is_null(const_struct_field(ccx, val, idx, sub_idx)) {
11241124
/* subtraction as uint is ok because nndiscr is either 0 or 1 */

src/librustc_trans/trans/base.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ pub fn at_box_body<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
344344
let ccx = bcx.ccx();
345345
let ty = Type::at_box(ccx, type_of(ccx, body_t));
346346
let boxptr = PointerCast(bcx, boxptr, ty.ptr_to());
347-
GEPi(bcx, boxptr, &[0u, abi::box_field_body])
347+
GEPi(bcx, boxptr, &[0u, abi::BOX_FIELD_BODY])
348348
}
349349

350350
fn require_alloc_fn<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
@@ -394,7 +394,7 @@ pub fn malloc_raw_dyn_proc<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, t: Ty<'tcx>)
394394

395395
// Allocate space and store the destructor pointer:
396396
let Result {bcx, val: llbox} = malloc_raw_dyn(bcx, ptr_llty, t, size, llalign);
397-
let dtor_ptr = GEPi(bcx, llbox, &[0u, abi::box_field_drop_glue]);
397+
let dtor_ptr = GEPi(bcx, llbox, &[0u, abi::BOX_FIELD_DROP_GLUE]);
398398
let drop_glue_field_ty = type_of(ccx, ty::mk_nil_ptr(bcx.tcx()));
399399
let drop_glue = PointerCast(bcx, glue::get_drop_glue(ccx, ty::mk_uniq(bcx.tcx(), t)),
400400
drop_glue_field_ty);
@@ -705,8 +705,8 @@ pub fn iter_structural_ty<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
705705
let (data_ptr, info) = if ty::type_is_sized(cx.tcx(), t) {
706706
(av, None)
707707
} else {
708-
let data = GEPi(cx, av, &[0, abi::slice_elt_base]);
709-
let info = GEPi(cx, av, &[0, abi::slice_elt_len]);
708+
let data = GEPi(cx, av, &[0, abi::FAT_PTR_ADDR]);
709+
let info = GEPi(cx, av, &[0, abi::FAT_PTR_EXTRA]);
710710
(Load(cx, data), Some(Load(cx, info)))
711711
};
712712

@@ -724,8 +724,8 @@ pub fn iter_structural_ty<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
724724
} else {
725725
let boxed_ty = ty::mk_open(cx.tcx(), field_ty);
726726
let scratch = datum::rvalue_scratch_datum(cx, boxed_ty, "__fat_ptr_iter");
727-
Store(cx, llfld_a, GEPi(cx, scratch.val, &[0, abi::slice_elt_base]));
728-
Store(cx, info.unwrap(), GEPi(cx, scratch.val, &[0, abi::slice_elt_len]));
727+
Store(cx, llfld_a, GEPi(cx, scratch.val, &[0, abi::FAT_PTR_ADDR]));
728+
Store(cx, info.unwrap(), GEPi(cx, scratch.val, &[0, abi::FAT_PTR_EXTRA]));
729729
scratch.val
730730
};
731731
cx = f(cx, val, field_ty);

src/librustc_trans/trans/callee.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -724,9 +724,9 @@ pub fn trans_call_inner<'a, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
724724
// Closures are represented as (llfn, llclosure) pair:
725725
// load the requisite values out.
726726
let pair = d.to_llref();
727-
let llfn = GEPi(bcx, pair, &[0u, abi::fn_field_code]);
727+
let llfn = GEPi(bcx, pair, &[0u, abi::FAT_PTR_ADDR]);
728728
let llfn = Load(bcx, llfn);
729-
let llenv = GEPi(bcx, pair, &[0u, abi::fn_field_box]);
729+
let llenv = GEPi(bcx, pair, &[0u, abi::FAT_PTR_EXTRA]);
730730
let llenv = Load(bcx, llenv);
731731
(llfn, Some(llenv), None)
732732
}

src/librustc_trans/trans/closure.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub fn store_environment<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
208208
bv.to_string(ccx)).as_slice());
209209
}
210210

211-
let bound_data = GEPi(bcx, llbox, &[0u, abi::box_field_body, i]);
211+
let bound_data = GEPi(bcx, llbox, &[0u, abi::BOX_FIELD_BODY, i]);
212212

213213
match bv.action {
214214
ast::CaptureByValue => {
@@ -339,9 +339,9 @@ fn load_unboxed_closure_environment<'blk, 'tcx>(
339339
}
340340

341341
fn fill_fn_pair(bcx: Block, pair: ValueRef, llfn: ValueRef, llenvptr: ValueRef) {
342-
Store(bcx, llfn, GEPi(bcx, pair, &[0u, abi::fn_field_code]));
342+
Store(bcx, llfn, GEPi(bcx, pair, &[0u, abi::FAT_PTR_ADDR]));
343343
let llenvptr = PointerCast(bcx, llenvptr, Type::i8p(bcx.ccx()));
344-
Store(bcx, llenvptr, GEPi(bcx, pair, &[0u, abi::fn_field_box]));
344+
Store(bcx, llenvptr, GEPi(bcx, pair, &[0u, abi::FAT_PTR_EXTRA]));
345345
}
346346

347347
#[deriving(PartialEq)]

src/librustc_trans/trans/consts.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, e: &ast::Expr)
264264
ty::ty_vec(unit_ty, Some(len)) => {
265265
let llunitty = type_of::type_of(cx, unit_ty);
266266
let llptr = const_ptrcast(cx, llconst, llunitty);
267-
assert_eq!(abi::slice_elt_base, 0);
268-
assert_eq!(abi::slice_elt_len, 1);
267+
assert_eq!(abi::FAT_PTR_ADDR, 0);
268+
assert_eq!(abi::FAT_PTR_EXTRA, 1);
269269
llconst = C_struct(cx, &[
270270
llptr,
271271
C_uint(cx, len)

src/librustc_trans/trans/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ pub fn trans<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
171171
}
172172

173173
pub fn get_len(bcx: Block, fat_ptr: ValueRef) -> ValueRef {
174-
GEPi(bcx, fat_ptr, &[0u, abi::slice_elt_len])
174+
GEPi(bcx, fat_ptr, &[0u, abi::FAT_PTR_EXTRA])
175175
}
176176

177177
pub fn get_dataptr(bcx: Block, fat_ptr: ValueRef) -> ValueRef {
178-
GEPi(bcx, fat_ptr, &[0u, abi::slice_elt_base])
178+
GEPi(bcx, fat_ptr, &[0u, abi::FAT_PTR_ADDR])
179179
}
180180

181181
fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,

src/librustc_trans/trans/glue.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ fn trans_struct_drop_flag<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
196196
let struct_data = if ty::type_is_sized(bcx.tcx(), t) {
197197
v0
198198
} else {
199-
let llval = GEPi(bcx, v0, &[0, abi::slice_elt_base]);
199+
let llval = GEPi(bcx, v0, &[0, abi::FAT_PTR_ADDR]);
200200
Load(bcx, llval)
201201
};
202202
let drop_flag = unpack_datum!(bcx, adt::trans_drop_flag_ptr(bcx, &*repr, struct_data));
@@ -237,8 +237,8 @@ fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
237237
let (struct_data, info) = if ty::type_is_sized(bcx.tcx(), t) {
238238
(v0, None)
239239
} else {
240-
let data = GEPi(bcx, v0, &[0, abi::slice_elt_base]);
241-
let info = GEPi(bcx, v0, &[0, abi::slice_elt_len]);
240+
let data = GEPi(bcx, v0, &[0, abi::FAT_PTR_ADDR]);
241+
let info = GEPi(bcx, v0, &[0, abi::FAT_PTR_EXTRA]);
242242
(Load(bcx, data), Some(Load(bcx, info)))
243243
};
244244

@@ -255,14 +255,14 @@ fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
255255
// The dtor expects a fat pointer, so make one, even if we have to fake it.
256256
let boxed_ty = ty::mk_open(bcx.tcx(), t);
257257
let scratch = datum::rvalue_scratch_datum(bcx, boxed_ty, "__fat_ptr_drop_self");
258-
Store(bcx, value, GEPi(bcx, scratch.val, &[0, abi::slice_elt_base]));
258+
Store(bcx, value, GEPi(bcx, scratch.val, &[0, abi::FAT_PTR_ADDR]));
259259
Store(bcx,
260260
// If we just had a thin pointer, make a fat pointer by sticking
261261
// null where we put the unsizing info. This works because t
262262
// is a sized type, so we will only unpack the fat pointer, never
263263
// use the fake info.
264264
info.unwrap_or(C_null(Type::i8p(bcx.ccx()))),
265-
GEPi(bcx, scratch.val, &[0, abi::slice_elt_len]));
265+
GEPi(bcx, scratch.val, &[0, abi::FAT_PTR_EXTRA]));
266266
PointerCast(variant_cx, scratch.val, params[0])
267267
} else {
268268
PointerCast(variant_cx, value, params[0])
@@ -280,8 +280,8 @@ fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
280280
} else {
281281
let boxed_ty = ty::mk_open(bcx.tcx(), *ty);
282282
let scratch = datum::rvalue_scratch_datum(bcx, boxed_ty, "__fat_ptr_drop_field");
283-
Store(bcx, llfld_a, GEPi(bcx, scratch.val, &[0, abi::slice_elt_base]));
284-
Store(bcx, info.unwrap(), GEPi(bcx, scratch.val, &[0, abi::slice_elt_len]));
283+
Store(bcx, llfld_a, GEPi(bcx, scratch.val, &[0, abi::FAT_PTR_ADDR]));
284+
Store(bcx, info.unwrap(), GEPi(bcx, scratch.val, &[0, abi::FAT_PTR_EXTRA]));
285285
scratch.val
286286
};
287287
variant_cx.fcx.schedule_drop_mem(cleanup::CustomScope(field_scope),
@@ -369,11 +369,11 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: Ty<'tcx>)
369369
tvec::make_drop_glue_unboxed(bcx, v0, unit_ty, true)
370370
}
371371
ty::ty_trait(..) => {
372-
let lluniquevalue = GEPi(bcx, v0, &[0, abi::trt_field_box]);
372+
let lluniquevalue = GEPi(bcx, v0, &[0, abi::FAT_PTR_ADDR]);
373373
// Only drop the value when it is non-null
374374
let concrete_ptr = Load(bcx, lluniquevalue);
375375
with_cond(bcx, IsNotNull(bcx, concrete_ptr), |bcx| {
376-
let dtor_ptr = Load(bcx, GEPi(bcx, v0, &[0, abi::trt_field_vtable]));
376+
let dtor_ptr = Load(bcx, GEPi(bcx, v0, &[0, abi::FAT_PTR_EXTRA]));
377377
let dtor = Load(bcx, dtor_ptr);
378378
Call(bcx,
379379
dtor,
@@ -383,12 +383,12 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: Ty<'tcx>)
383383
})
384384
}
385385
ty::ty_struct(..) if !ty::type_is_sized(bcx.tcx(), content_ty) => {
386-
let llval = GEPi(bcx, v0, &[0, abi::slice_elt_base]);
386+
let llval = GEPi(bcx, v0, &[0, abi::FAT_PTR_ADDR]);
387387
let llbox = Load(bcx, llval);
388388
let not_null = IsNotNull(bcx, llbox);
389389
with_cond(bcx, not_null, |bcx| {
390390
let bcx = drop_ty(bcx, v0, content_ty, None);
391-
let info = GEPi(bcx, v0, &[0, abi::slice_elt_len]);
391+
let info = GEPi(bcx, v0, &[0, abi::FAT_PTR_EXTRA]);
392392
let info = Load(bcx, info);
393393
let (llsize, llalign) = size_and_align_of_dst(bcx, content_ty, info);
394394
trans_exchange_free_dyn(bcx, llbox, llsize, llalign)
@@ -440,12 +440,12 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: Ty<'tcx>)
440440
t,
441441
|bb, vv, tt| drop_ty(bb, vv, tt, None)),
442442
ty::ty_closure(ref f) if f.store == ty::UniqTraitStore => {
443-
let box_cell_v = GEPi(bcx, v0, &[0u, abi::fn_field_box]);
443+
let box_cell_v = GEPi(bcx, v0, &[0u, abi::FAT_PTR_EXTRA]);
444444
let env = Load(bcx, box_cell_v);
445445
let env_ptr_ty = Type::at_box(bcx.ccx(), Type::i8(bcx.ccx())).ptr_to();
446446
let env = PointerCast(bcx, env, env_ptr_ty);
447447
with_cond(bcx, IsNotNull(bcx, env), |bcx| {
448-
let dtor_ptr = GEPi(bcx, env, &[0u, abi::box_field_drop_glue]);
448+
let dtor_ptr = GEPi(bcx, env, &[0u, abi::BOX_FIELD_DROP_GLUE]);
449449
let dtor = Load(bcx, dtor_ptr);
450450
Call(bcx, dtor, &[PointerCast(bcx, box_cell_v, Type::i8p(bcx.ccx()))], None);
451451
bcx
@@ -456,8 +456,8 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: Ty<'tcx>)
456456
// above), because this happens for a trait field in an unsized
457457
// struct. If anything is null, it is the whole struct and we won't
458458
// get here.
459-
let lluniquevalue = GEPi(bcx, v0, &[0, abi::trt_field_box]);
460-
let dtor_ptr = Load(bcx, GEPi(bcx, v0, &[0, abi::trt_field_vtable]));
459+
let lluniquevalue = GEPi(bcx, v0, &[0, abi::FAT_PTR_ADDR]);
460+
let dtor_ptr = Load(bcx, GEPi(bcx, v0, &[0, abi::FAT_PTR_EXTRA]));
461461
let dtor = Load(bcx, dtor_ptr);
462462
Call(bcx,
463463
dtor,

src/librustc_trans/trans/meth.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ pub fn trans_trait_callee_from_llval<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
481481

482482
// Load the data pointer from the object.
483483
debug!("(translating trait callee) loading second index from pair");
484-
let llboxptr = GEPi(bcx, llpair, &[0u, abi::trt_field_box]);
484+
let llboxptr = GEPi(bcx, llpair, &[0u, abi::FAT_PTR_ADDR]);
485485
let llbox = Load(bcx, llboxptr);
486486
let llself = PointerCast(bcx, llbox, Type::i8p(ccx));
487487

@@ -503,7 +503,7 @@ pub fn trans_trait_callee_from_llval<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
503503
let llvtable = Load(bcx,
504504
PointerCast(bcx,
505505
GEPi(bcx, llpair,
506-
&[0u, abi::trt_field_vtable]),
506+
&[0u, abi::FAT_PTR_EXTRA]),
507507
Type::vtable(ccx).ptr_to().ptr_to()));
508508
let mptr = Load(bcx, GEPi(bcx, llvtable, &[0u, n_method + VTABLE_OFFSET]));
509509
let mptr = PointerCast(bcx, mptr, llcallee_ty.ptr_to());
@@ -761,13 +761,13 @@ pub fn trans_trait_cast<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
761761
let llbox_ty = type_of(bcx.ccx(), datum_ty);
762762

763763
// Store the pointer into the first half of pair.
764-
let llboxdest = GEPi(bcx, lldest, &[0u, abi::trt_field_box]);
764+
let llboxdest = GEPi(bcx, lldest, &[0u, abi::FAT_PTR_ADDR]);
765765
let llboxdest = PointerCast(bcx, llboxdest, llbox_ty.ptr_to());
766766
bcx = datum.store_to(bcx, llboxdest);
767767

768768
// Store the vtable into the second half of pair.
769769
let vtable = get_vtable(bcx, datum_ty, trait_ref);
770-
let llvtabledest = GEPi(bcx, lldest, &[0u, abi::trt_field_vtable]);
770+
let llvtabledest = GEPi(bcx, lldest, &[0u, abi::FAT_PTR_EXTRA]);
771771
let llvtabledest = PointerCast(bcx, llvtabledest, val_ty(vtable).ptr_to());
772772
Store(bcx, vtable, llvtabledest);
773773

src/librustc_trans/trans/tvec.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ pub fn trans_lit_str<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
231231
let llbytes = C_uint(bcx.ccx(), bytes);
232232
let llcstr = C_cstr(bcx.ccx(), str_lit, false);
233233
let llcstr = llvm::LLVMConstPointerCast(llcstr, Type::i8p(bcx.ccx()).to_ref());
234-
Store(bcx, llcstr, GEPi(bcx, lldest, &[0u, abi::slice_elt_base]));
235-
Store(bcx, llbytes, GEPi(bcx, lldest, &[0u, abi::slice_elt_len]));
234+
Store(bcx, llcstr, GEPi(bcx, lldest, &[0u, abi::FAT_PTR_ADDR]));
235+
Store(bcx, llbytes, GEPi(bcx, lldest, &[0u, abi::FAT_PTR_EXTRA]));
236236
bcx
237237
}
238238
}
@@ -401,8 +401,8 @@ pub fn get_fixed_base_and_len(bcx: Block,
401401
fn get_slice_base_and_len(bcx: Block,
402402
llval: ValueRef)
403403
-> (ValueRef, ValueRef) {
404-
let base = Load(bcx, GEPi(bcx, llval, &[0u, abi::slice_elt_base]));
405-
let len = Load(bcx, GEPi(bcx, llval, &[0u, abi::slice_elt_len]));
404+
let base = Load(bcx, GEPi(bcx, llval, &[0u, abi::FAT_PTR_ADDR]));
405+
let len = Load(bcx, GEPi(bcx, llval, &[0u, abi::FAT_PTR_EXTRA]));
406406
(base, len)
407407
}
408408

0 commit comments

Comments
 (0)