Skip to content

Make C_u8 take a u8 instead of a usize value #27529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2015
Merged
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: 1 addition & 1 deletion src/librustc_trans/trans/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,7 @@ pub fn store_local<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
// Dummy-locals start out uninitialized, so set their
// drop-flag hints (if any) to "moved."
if let Some(hint) = kind.dropflag_hint(bcx) {
let moved_hint = adt::DTOR_MOVED_HINT as usize;
let moved_hint = adt::DTOR_MOVED_HINT;
debug!("store moved_hint={} for hint={:?}, uninitialized dummy",
moved_hint, hint);
Store(bcx, C_u8(bcx.fcx.ccx, moved_hint), hint.to_value().value());
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_trans/trans/adt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -983,15 +983,15 @@ pub fn trans_set_discr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, r: &Repr<'tcx>,
if dtor_active(dtor) {
let ptr = trans_field_ptr(bcx, r, val, discr,
cases[discr as usize].fields.len() - 2);
Store(bcx, C_u8(bcx.ccx(), DTOR_NEEDED as usize), ptr);
Store(bcx, C_u8(bcx.ccx(), DTOR_NEEDED), ptr);
}
Store(bcx, C_integral(ll_inttype(bcx.ccx(), ity), discr as u64, true),
GEPi(bcx, val, &[0, 0]));
}
Univariant(ref st, dtor) => {
assert_eq!(discr, 0);
if dtor_active(dtor) {
Store(bcx, C_u8(bcx.ccx(), DTOR_NEEDED as usize),
Store(bcx, C_u8(bcx.ccx(), DTOR_NEEDED),
GEPi(bcx, val, &[0, st.fields.len() - 1]));
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_trans/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ fn memfill<'a, 'tcx>(b: &Builder<'a, 'tcx>, llptr: ValueRef, ty: Ty<'tcx>, byte:

let llintrinsicfn = ccx.get_intrinsic(&intrinsic_key);
let llptr = b.pointercast(llptr, Type::i8(ccx).ptr_to());
let llzeroval = C_u8(ccx, byte as usize);
let llzeroval = C_u8(ccx, byte);
let size = machine::llsize_of(ccx, llty);
let align = C_i32(ccx, type_of::align_of(ccx, ty) as i32);
let volatile = C_bool(ccx, false);
Expand Down Expand Up @@ -1296,7 +1296,7 @@ pub fn init_function<'a, 'tcx>(fcx: &'a FunctionContext<'a, 'tcx>,
for &info in fragment_infos {

let make_datum = |id| {
let init_val = C_u8(fcx.ccx, adt::DTOR_NEEDED_HINT as usize);
let init_val = C_u8(fcx.ccx, adt::DTOR_NEEDED_HINT);
let llname = &format!("dropflag_hint_{}", id);
debug!("adding hint {}", llname);
let ptr = alloc_ty(entry_bcx, tcx.types.u8, llname);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/trans/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ impl AsU64 for u64 { fn as_u64(self) -> u64 { self as u64 }}
impl AsU64 for u32 { fn as_u64(self) -> u64 { self as u64 }}
impl AsU64 for usize { fn as_u64(self) -> u64 { self as u64 }}

pub fn C_u8(ccx: &CrateContext, i: usize) -> ValueRef {
pub fn C_u8(ccx: &CrateContext, i: u8) -> ValueRef {
C_integral(Type::i8(ccx), i as u64, false)
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/trans/datum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ impl KindOps for Lvalue {
// aware of drop-hint won't bother calling the
// drop-glue itself.
if let Some(hint_datum) = self.drop_flag_info.hint_datum(bcx) {
let moved_hint_byte = adt::DTOR_MOVED_HINT as usize;
let moved_hint_byte = adt::DTOR_MOVED_HINT;
let hint_llval = hint_datum.to_value().value();
Store(bcx, C_u8(bcx.fcx.ccx, moved_hint_byte), hint_llval);
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/trans/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ fn trans_rvalue_stmt_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
// its drop-hint (if any) says "initialized."
if let Some(hint_val) = opt_hint_val {
let hint_llval = hint_val.value();
let drop_needed = C_u8(bcx.fcx.ccx, adt::DTOR_NEEDED_HINT as usize);
let drop_needed = C_u8(bcx.fcx.ccx, adt::DTOR_NEEDED_HINT);
Store(bcx, drop_needed, hint_llval);
}
src_datum.store_to(bcx, dst_datum.val)
Expand Down