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