Remove various rustboot workarounds
This commit is contained in:
parent
9b6ae59b22
commit
200dbe4c4f
@ -1656,13 +1656,9 @@ fn parse_block(&parser p) -> ast::block {
|
||||
|
||||
stmts += [stmt];
|
||||
|
||||
// FIXME: crazy differentiation between conditions
|
||||
// used in branches and binary expressions in rustboot
|
||||
// means we cannot use && here. I know, right?
|
||||
if (p.get_file_type() == SOURCE_FILE) {
|
||||
if (stmt_ends_with_semi(*stmt)) {
|
||||
expect(p, token::SEMI);
|
||||
}
|
||||
if (p.get_file_type() == SOURCE_FILE
|
||||
&& stmt_ends_with_semi(*stmt)) {
|
||||
expect(p, token::SEMI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5249,24 +5249,17 @@ fn trans_arg_expr(&@block_ctxt cx, &ty::arg arg, TypeRef lldestty0,
|
||||
val = llvm::LLVMGetUndef(lldestty0);
|
||||
} else if (ty::type_contains_params(cx.fcx.lcx.ccx.tcx, arg.ty)) {
|
||||
auto lldestty = lldestty0;
|
||||
if (arg.mode == ty::mo_val) {
|
||||
|
||||
// FIXME: we'd prefer to use &&, but rustboot doesn't like it
|
||||
if (ty::type_is_structural(cx.fcx.lcx.ccx.tcx, e_ty)) {
|
||||
lldestty = T_ptr(lldestty);
|
||||
}
|
||||
if (arg.mode == ty::mo_val
|
||||
&& ty::type_is_structural(cx.fcx.lcx.ccx.tcx, e_ty)) {
|
||||
lldestty = T_ptr(lldestty);
|
||||
}
|
||||
val = bcx.build.PointerCast(val, lldestty);
|
||||
}
|
||||
if (arg.mode == ty::mo_val) {
|
||||
|
||||
// FIXME: we'd prefer to use &&, but rustboot doesn't like it
|
||||
if (ty::type_is_structural(cx.fcx.lcx.ccx.tcx, e_ty)) {
|
||||
// Until here we've been treating structures by pointer;
|
||||
// we are now passing it as an arg, so need to load it.
|
||||
|
||||
val = bcx.build.Load(val);
|
||||
}
|
||||
if (arg.mode == ty::mo_val
|
||||
&& ty::type_is_structural(cx.fcx.lcx.ccx.tcx, e_ty)) {
|
||||
// Until here we've been treating structures by pointer;
|
||||
// we are now passing it as an arg, so need to load it.
|
||||
val = bcx.build.Load(val);
|
||||
}
|
||||
ret res(bcx, val);
|
||||
}
|
||||
|
@ -347,10 +347,8 @@ mod rt {
|
||||
// FIXME: This might be useful in str: but needs to be utf8 safe first
|
||||
fn str_init_elt(char c, uint n_elts) -> str {
|
||||
auto svec = vec::init_elt[u8](c as u8, n_elts);
|
||||
// FIXME: Using unsafe_from_bytes because rustboot
|
||||
// can't figure out the is_utf8 predicate on from_bytes?
|
||||
|
||||
ret str::unsafe_from_bytes(svec);
|
||||
ret str::from_bytes(svec);
|
||||
}
|
||||
tag pad_mode { pad_signed; pad_unsigned; pad_nozero; }
|
||||
fn pad(&conv cv, str s, pad_mode mode) -> str {
|
||||
|
@ -78,25 +78,11 @@ fn name_str(name nm) -> str {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// FIXME rustboot workaround
|
||||
fn name_eq(name a, name b) -> bool {
|
||||
ret alt (a) {
|
||||
case (long(?a)) {
|
||||
alt (b) {
|
||||
case (long(?b)) { str::eq(a, b) }
|
||||
case (_) { false }
|
||||
}
|
||||
}
|
||||
case (_) { if (a == b) { true } else { false } }
|
||||
};
|
||||
}
|
||||
|
||||
fn find_opt(vec[opt] opts, name nm) -> option::t[uint] {
|
||||
auto i = 0u;
|
||||
auto l = vec::len[opt](opts);
|
||||
while (i < l) {
|
||||
if (name_eq(opts.(i).name, nm)) { ret some[uint](i); }
|
||||
if (opts.(i).name == nm) { ret some[uint](i); }
|
||||
i += 1u;
|
||||
}
|
||||
ret none[uint];
|
||||
|
@ -158,11 +158,7 @@ fn mk_sha1() -> sha1 {
|
||||
st.msg_block_idx = 0u;
|
||||
}
|
||||
fn circular_shift(u32 bits, u32 word) -> u32 {
|
||||
// FIXME: This is a workaround for a rustboot
|
||||
// "unrecognized quads" codegen bug
|
||||
|
||||
auto bits_hack = bits;
|
||||
ret word << bits_hack | word >> 32u32 - bits;
|
||||
ret word << bits | word >> 32u32 - bits;
|
||||
}
|
||||
fn mk_result(&sha1state st) -> vec[u8] {
|
||||
if (!st.computed) { pad_msg(st); st.computed = true; }
|
||||
|
@ -302,12 +302,7 @@ fn shift_char(&mutable str s) -> char {
|
||||
}
|
||||
|
||||
fn unshift_char(&mutable str s, char ch) {
|
||||
// Workaround for rustboot order-of-evaluation issue -- if I put s
|
||||
// directly after the +, the string ends up containing (only) the
|
||||
// character, twice.
|
||||
|
||||
auto x = s;
|
||||
s = from_char(ch) + x;
|
||||
s = from_char(ch) + s;
|
||||
}
|
||||
|
||||
fn refcount(str s) -> uint {
|
||||
|
Loading…
x
Reference in New Issue
Block a user