diff --git a/src/librustc_back/abi.rs b/src/librustc_back/abi.rs index f89d5d826f5b..2f6efbc85a26 100644 --- a/src/librustc_back/abi.rs +++ b/src/librustc_back/abi.rs @@ -8,11 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(non_upper_case_globals)] - -pub const box_field_refcnt: uint = 0u; -pub const box_field_drop_glue: uint = 1u; -pub const box_field_body: uint = 4u; +pub const BOX_FIELD_DROP_GLUE: uint = 1u; +pub const BOX_FIELD_BODY: uint = 4u; /// The first half of a fat pointer. /// - For a closure, this is the code address. diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index a6f35c296623..85085f46731e 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -344,7 +344,7 @@ pub fn at_box_body<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, let ccx = bcx.ccx(); let ty = Type::at_box(ccx, type_of(ccx, body_t)); let boxptr = PointerCast(bcx, boxptr, ty.ptr_to()); - GEPi(bcx, boxptr, &[0u, abi::box_field_body]) + GEPi(bcx, boxptr, &[0u, abi::BOX_FIELD_BODY]) } 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>) // Allocate space and store the destructor pointer: let Result {bcx, val: llbox} = malloc_raw_dyn(bcx, ptr_llty, t, size, llalign); - let dtor_ptr = GEPi(bcx, llbox, &[0u, abi::box_field_drop_glue]); + let dtor_ptr = GEPi(bcx, llbox, &[0u, abi::BOX_FIELD_DROP_GLUE]); let drop_glue_field_ty = type_of(ccx, ty::mk_nil_ptr(bcx.tcx())); let drop_glue = PointerCast(bcx, glue::get_drop_glue(ccx, ty::mk_uniq(bcx.tcx(), t)), drop_glue_field_ty); diff --git a/src/librustc_trans/trans/closure.rs b/src/librustc_trans/trans/closure.rs index c0c46ed57cc3..ca955975dfb3 100644 --- a/src/librustc_trans/trans/closure.rs +++ b/src/librustc_trans/trans/closure.rs @@ -208,7 +208,7 @@ pub fn store_environment<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, bv.to_string(ccx)).as_slice()); } - let bound_data = GEPi(bcx, llbox, &[0u, abi::box_field_body, i]); + let bound_data = GEPi(bcx, llbox, &[0u, abi::BOX_FIELD_BODY, i]); match bv.action { ast::CaptureByValue => { diff --git a/src/librustc_trans/trans/glue.rs b/src/librustc_trans/trans/glue.rs index f4799d7536df..4ed798378969 100644 --- a/src/librustc_trans/trans/glue.rs +++ b/src/librustc_trans/trans/glue.rs @@ -445,7 +445,7 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: Ty<'tcx>) let env_ptr_ty = Type::at_box(bcx.ccx(), Type::i8(bcx.ccx())).ptr_to(); let env = PointerCast(bcx, env, env_ptr_ty); with_cond(bcx, IsNotNull(bcx, env), |bcx| { - let dtor_ptr = GEPi(bcx, env, &[0u, abi::box_field_drop_glue]); + let dtor_ptr = GEPi(bcx, env, &[0u, abi::BOX_FIELD_DROP_GLUE]); let dtor = Load(bcx, dtor_ptr); Call(bcx, dtor, &[PointerCast(bcx, box_cell_v, Type::i8p(bcx.ccx()))], None); bcx