Skip to content

Commit 200dbe4

Browse files
committed
Remove various rustboot workarounds
1 parent 9b6ae59 commit 200dbe4

File tree

6 files changed

+15
-51
lines changed

6 files changed

+15
-51
lines changed

src/comp/front/parser.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,13 +1656,9 @@ fn parse_block(&parser p) -> ast::block {
16561656

16571657
stmts += [stmt];
16581658

1659-
// FIXME: crazy differentiation between conditions
1660-
// used in branches and binary expressions in rustboot
1661-
// means we cannot use && here. I know, right?
1662-
if (p.get_file_type() == SOURCE_FILE) {
1663-
if (stmt_ends_with_semi(*stmt)) {
1664-
expect(p, token::SEMI);
1665-
}
1659+
if (p.get_file_type() == SOURCE_FILE
1660+
&& stmt_ends_with_semi(*stmt)) {
1661+
expect(p, token::SEMI);
16661662
}
16671663
}
16681664
}

src/comp/middle/trans.rs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5249,24 +5249,17 @@ fn trans_arg_expr(&@block_ctxt cx, &ty::arg arg, TypeRef lldestty0,
52495249
val = llvm::LLVMGetUndef(lldestty0);
52505250
} else if (ty::type_contains_params(cx.fcx.lcx.ccx.tcx, arg.ty)) {
52515251
auto lldestty = lldestty0;
5252-
if (arg.mode == ty::mo_val) {
5253-
5254-
// FIXME: we'd prefer to use &&, but rustboot doesn't like it
5255-
if (ty::type_is_structural(cx.fcx.lcx.ccx.tcx, e_ty)) {
5256-
lldestty = T_ptr(lldestty);
5257-
}
5252+
if (arg.mode == ty::mo_val
5253+
&& ty::type_is_structural(cx.fcx.lcx.ccx.tcx, e_ty)) {
5254+
lldestty = T_ptr(lldestty);
52585255
}
52595256
val = bcx.build.PointerCast(val, lldestty);
52605257
}
5261-
if (arg.mode == ty::mo_val) {
5262-
5263-
// FIXME: we'd prefer to use &&, but rustboot doesn't like it
5264-
if (ty::type_is_structural(cx.fcx.lcx.ccx.tcx, e_ty)) {
5265-
// Until here we've been treating structures by pointer;
5266-
// we are now passing it as an arg, so need to load it.
5267-
5268-
val = bcx.build.Load(val);
5269-
}
5258+
if (arg.mode == ty::mo_val
5259+
&& ty::type_is_structural(cx.fcx.lcx.ccx.tcx, e_ty)) {
5260+
// Until here we've been treating structures by pointer;
5261+
// we are now passing it as an arg, so need to load it.
5262+
val = bcx.build.Load(val);
52705263
}
52715264
ret res(bcx, val);
52725265
}

src/lib/extfmt.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,8 @@ mod rt {
347347
// FIXME: This might be useful in str: but needs to be utf8 safe first
348348
fn str_init_elt(char c, uint n_elts) -> str {
349349
auto svec = vec::init_elt[u8](c as u8, n_elts);
350-
// FIXME: Using unsafe_from_bytes because rustboot
351-
// can't figure out the is_utf8 predicate on from_bytes?
352350

353-
ret str::unsafe_from_bytes(svec);
351+
ret str::from_bytes(svec);
354352
}
355353
tag pad_mode { pad_signed; pad_unsigned; pad_nozero; }
356354
fn pad(&conv cv, str s, pad_mode mode) -> str {

src/lib/getopts.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,11 @@ fn name_str(name nm) -> str {
7878
};
7979
}
8080

81-
82-
// FIXME rustboot workaround
83-
fn name_eq(name a, name b) -> bool {
84-
ret alt (a) {
85-
case (long(?a)) {
86-
alt (b) {
87-
case (long(?b)) { str::eq(a, b) }
88-
case (_) { false }
89-
}
90-
}
91-
case (_) { if (a == b) { true } else { false } }
92-
};
93-
}
94-
9581
fn find_opt(vec[opt] opts, name nm) -> option::t[uint] {
9682
auto i = 0u;
9783
auto l = vec::len[opt](opts);
9884
while (i < l) {
99-
if (name_eq(opts.(i).name, nm)) { ret some[uint](i); }
85+
if (opts.(i).name == nm) { ret some[uint](i); }
10086
i += 1u;
10187
}
10288
ret none[uint];

src/lib/sha1.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,7 @@ fn mk_sha1() -> sha1 {
158158
st.msg_block_idx = 0u;
159159
}
160160
fn circular_shift(u32 bits, u32 word) -> u32 {
161-
// FIXME: This is a workaround for a rustboot
162-
// "unrecognized quads" codegen bug
163-
164-
auto bits_hack = bits;
165-
ret word << bits_hack | word >> 32u32 - bits;
161+
ret word << bits | word >> 32u32 - bits;
166162
}
167163
fn mk_result(&sha1state st) -> vec[u8] {
168164
if (!st.computed) { pad_msg(st); st.computed = true; }

src/lib/str.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,7 @@ fn shift_char(&mutable str s) -> char {
302302
}
303303

304304
fn unshift_char(&mutable str s, char ch) {
305-
// Workaround for rustboot order-of-evaluation issue -- if I put s
306-
// directly after the +, the string ends up containing (only) the
307-
// character, twice.
308-
309-
auto x = s;
310-
s = from_char(ch) + x;
305+
s = from_char(ch) + s;
311306
}
312307

313308
fn refcount(str s) -> uint {

0 commit comments

Comments
 (0)