Skip to content

Commit db605bc

Browse files
committed
---
yaml --- r: 43004 b: refs/heads/try c: 79dc10d h: refs/heads/master v: v3
1 parent 25c3f10 commit db605bc

File tree

15 files changed

+131
-163
lines changed

15 files changed

+131
-163
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: dab2f2fac0d5147b088489abfbcf43714ed36156
5+
refs/heads/try: 79dc10dba91d242b2bbdc65e20dd0fe5fe7f3f40
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/mk/docs.mk

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ doc/rust.html: rust.md doc/version_info.html doc/rust.css doc/manual.css
4545
--from=markdown --to=html \
4646
--css=rust.css \
4747
--css=manual.css \
48-
--include-before-body=doc/version_info.html \
48+
--include-before-body=doc/version_info.html \
4949
--output=$@
5050
endif
5151

@@ -66,6 +66,7 @@ doc/rust.tex: rust.md doc/version.md
6666
"$(CFG_PANDOC)" \
6767
--standalone --toc \
6868
--number-sections \
69+
--include-before-body=doc/version.md \
6970
--from=markdown --to=latex \
7071
--output=$@
7172

@@ -199,16 +200,17 @@ ifdef CFG_DISABLE_DOCS
199200
endif
200201

201202

202-
doc/version.md: $(MKFILE_DEPS) rust.md
203+
doc/version.md: $(MKFILE_DEPS) $(wildcard $(S)doc/*.*)
203204
@$(call E, version-stamp: $@)
204205
$(Q)echo "$(CFG_VERSION)" >$@
205206

206-
doc/version_info.html: version_info.html.template
207+
doc/version_info.html: version_info.html.template $(MKFILE_DEPS) \
208+
$(wildcard $(S)doc/*.*)
207209
@$(call E, version-info: $@)
208210
sed -e "s/VERSION/$(CFG_RELEASE)/; s/SHORT_HASH/$(shell echo \
209211
$(CFG_VER_HASH) | head -c 8)/;\
210212
s/STAMP/$(CFG_VER_HASH)/;" $< >$@
211213

212-
GENERATED += doc/version.md
214+
GENERATED += doc/version.md doc/version_info.html
213215

214216
docs: $(DOCS)

branches/try/src/libcore/hashmap.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ pub mod linear {
4949
buckets: ~[Option<Bucket<K, V>>],
5050
}
5151

52-
// We could rewrite FoundEntry to have type Option<&Bucket<K, V>>
53-
// which would be nifty
52+
// FIXME(#3148) -- we could rewrite FoundEntry
53+
// to have type Option<&Bucket<K, V>> which would be nifty
54+
// However, that won't work until #3148 is fixed
5455
enum SearchResult {
5556
FoundEntry(uint), FoundHole(uint), TableFull
5657
}
@@ -295,6 +296,8 @@ pub mod linear {
295296
FoundEntry(idx) => {
296297
match self.buckets[idx] {
297298
Some(ref bkt) => {
299+
// FIXME(#3148)---should be inferred
300+
let bkt: &self/Bucket<K, V> = bkt;
298301
Some(&bkt.value)
299302
}
300303
None => {

branches/try/src/librustc/middle/trans/_match.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,8 +1028,6 @@ pub fn pick_col(m: &[@Match]) -> uint {
10281028
pub enum branch_kind { no_branch, single, switch, compare, compare_vec_len, }
10291029
10301030
// Compiles a comparison between two things.
1031-
//
1032-
// NB: This must produce an i1, not a Rust bool (i8).
10331031
pub fn compare_values(cx: block,
10341032
lhs: ValueRef,
10351033
rhs: ValueRef,
@@ -1055,11 +1053,7 @@ pub fn compare_values(cx: block,
10551053
scratch_rhs],
10561054
expr::SaveIn(
10571055
scratch_result.val));
1058-
let result = scratch_result.to_result(bcx);
1059-
Result {
1060-
bcx: result.bcx,
1061-
val: bool_to_i1(result.bcx, result.val)
1062-
}
1056+
return scratch_result.to_result(bcx);
10631057
}
10641058
ty::ty_estr(_) => {
10651059
let scratch_result = scratch_datum(cx, ty::mk_bool(cx.tcx()),
@@ -1069,11 +1063,7 @@ pub fn compare_values(cx: block,
10691063
~[lhs, rhs],
10701064
expr::SaveIn(
10711065
scratch_result.val));
1072-
let result = scratch_result.to_result(bcx);
1073-
Result {
1074-
bcx: result.bcx,
1075-
val: bool_to_i1(result.bcx, result.val)
1076-
}
1066+
return scratch_result.to_result(bcx);
10771067
}
10781068
_ => {
10791069
cx.tcx().sess.bug(~"only scalars and strings supported in \
@@ -1186,7 +1176,6 @@ pub fn compile_guard(bcx: block,
11861176
expr::trans_to_datum(bcx, guard_expr).to_result()
11871177
}
11881178
});
1189-
let val = bool_to_i1(bcx, val);
11901179
11911180
// Revoke the temp cleanups now that the guard successfully executed.
11921181
for temp_cleanups.each |llval| {

branches/try/src/librustc/middle/trans/base.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -494,13 +494,8 @@ pub fn maybe_name_value(cx: @crate_ctxt, v: ValueRef, s: ~str) {
494494
// Used only for creating scalar comparison glue.
495495
pub enum scalar_type { nil_type, signed_int, unsigned_int, floating_point, }
496496

497-
// NB: This produces an i1, not a Rust bool (i8).
498-
pub fn compare_scalar_types(cx: block,
499-
lhs: ValueRef,
500-
rhs: ValueRef,
501-
t: ty::t,
502-
op: ast::binop)
503-
-> Result {
497+
pub fn compare_scalar_types(cx: block, lhs: ValueRef, rhs: ValueRef,
498+
t: ty::t, op: ast::binop) -> Result {
504499
let f = |a| compare_scalar_values(cx, lhs, rhs, a, op);
505500

506501
match ty::get(t).sty {
@@ -526,12 +521,8 @@ pub fn compare_scalar_types(cx: block,
526521

527522

528523
// A helper function to do the actual comparison of scalar values.
529-
pub fn compare_scalar_values(cx: block,
530-
lhs: ValueRef,
531-
rhs: ValueRef,
532-
nt: scalar_type,
533-
op: ast::binop)
534-
-> ValueRef {
524+
pub fn compare_scalar_values(cx: block, lhs: ValueRef, rhs: ValueRef,
525+
nt: scalar_type, op: ast::binop) -> ValueRef {
535526
let _icx = cx.insn_ctxt("compare_scalar_values");
536527
fn die(cx: block) -> ! {
537528
cx.tcx().sess.bug(~"compare_scalar_values: must be a\
@@ -542,8 +533,8 @@ pub fn compare_scalar_values(cx: block,
542533
// We don't need to do actual comparisons for nil.
543534
// () == () holds but () < () does not.
544535
match op {
545-
ast::eq | ast::le | ast::ge => return C_i1(true),
546-
ast::ne | ast::lt | ast::gt => return C_i1(false),
536+
ast::eq | ast::le | ast::ge => return C_bool(true),
537+
ast::ne | ast::lt | ast::gt => return C_bool(false),
547538
// refinements would be nice
548539
_ => die(cx)
549540
}
@@ -1451,7 +1442,7 @@ pub fn call_memcpy(cx: block, dst: ValueRef, src: ValueRef,
14511442
let dst_ptr = PointerCast(cx, dst, T_ptr(T_i8()));
14521443
let size = IntCast(cx, n_bytes, ccx.int_type);
14531444
let align = C_i32(1i32);
1454-
let volatile = C_i1(false);
1445+
let volatile = C_bool(false);
14551446
Call(cx, memcpy, ~[dst_ptr, src_ptr, size, align, volatile]);
14561447
}
14571448

@@ -1498,7 +1489,7 @@ pub fn memzero(cx: block, llptr: ValueRef, llty: TypeRef) {
14981489
let llzeroval = C_u8(0);
14991490
let size = IntCast(cx, machine::llsize_of(ccx, llty), ccx.int_type);
15001491
let align = C_i32(1i32);
1501-
let volatile = C_i1(false);
1492+
let volatile = C_bool(false);
15021493
Call(cx, llintrinsicfn, ~[llptr, llzeroval, size, align, volatile]);
15031494
}
15041495

branches/try/src/librustc/middle/trans/callee.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,7 @@ pub fn trans_call_inner(
438438
let flag = alloca(bcx, T_bool());
439439
Store(bcx, C_bool(false), flag);
440440
Some(flag)
441-
} else {
442-
None
443-
};
441+
} else { None };
444442

445443
let (llfn, llenv) = unsafe {
446444
match callee.data {
@@ -508,8 +506,7 @@ pub fn trans_call_inner(
508506
if ty::type_is_bot(ret_ty) {
509507
Unreachable(bcx);
510508
} else if ret_in_loop {
511-
let ret_flag_result = bool_to_i1(bcx, Load(bcx, ret_flag.get()));
512-
bcx = do with_cond(bcx, ret_flag_result) |bcx| {
509+
bcx = do with_cond(bcx, Load(bcx, ret_flag.get())) |bcx| {
513510
do option::iter(&copy bcx.fcx.loop_ret) |lret| {
514511
Store(bcx, C_bool(true), lret.flagptr);
515512
Store(bcx, C_bool(false), bcx.fcx.llretptr);

branches/try/src/librustc/middle/trans/common.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ pub fn T_f32() -> TypeRef { unsafe { return llvm::LLVMFloatType(); } }
759759

760760
pub fn T_f64() -> TypeRef { unsafe { return llvm::LLVMDoubleType(); } }
761761

762-
pub fn T_bool() -> TypeRef { return T_i8(); }
762+
pub fn T_bool() -> TypeRef { return T_i1(); }
763763

764764
pub fn T_int(targ_cfg: @session::config) -> TypeRef {
765765
return match targ_cfg.arch {
@@ -1109,10 +1109,6 @@ pub fn C_bool(b: bool) -> ValueRef {
11091109
C_integral(T_bool(), if b { 1u64 } else { 0u64 }, False)
11101110
}
11111111

1112-
pub fn C_i1(b: bool) -> ValueRef {
1113-
return C_integral(T_i1(), if b { 1 } else { 0 }, False);
1114-
}
1115-
11161112
pub fn C_i32(i: i32) -> ValueRef {
11171113
return C_integral(T_i32(), i as u64, True);
11181114
}
@@ -1439,11 +1435,6 @@ pub fn struct_dtor() -> [uint * 2] {
14391435
[0, 1]
14401436
}
14411437

1442-
// Casts a Rust bool value to an i1.
1443-
pub fn bool_to_i1(bcx: block, llval: ValueRef) -> ValueRef {
1444-
build::ICmp(bcx, lib::llvm::IntNE, llval, C_bool(false))
1445-
}
1446-
14471438
//
14481439
// Local Variables:
14491440
// mode: rust

branches/try/src/librustc/middle/trans/controlflow.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ pub fn trans_if(bcx: block,
6262

6363
let then_bcx_in = scope_block(bcx, thn.info(), ~"then");
6464
let else_bcx_in = scope_block(bcx, els.info(), ~"else");
65-
66-
let cond_val = bool_to_i1(bcx, cond_val);
6765
CondBr(bcx, cond_val, then_bcx_in.llbb, else_bcx_in.llbb);
6866

6967
debug!("then_bcx_in=%s, else_bcx_in=%s",
@@ -141,7 +139,6 @@ pub fn trans_while(bcx: block, cond: @ast::expr, body: ast::blk) -> block {
141139
// compile the condition
142140
let Result {bcx: cond_bcx_out, val: cond_val} =
143141
expr::trans_to_datum(cond_bcx_in, cond).to_result();
144-
let cond_val = bool_to_i1(cond_bcx_out, cond_val);
145142
let cond_bcx_out =
146143
trans_block_cleanups(cond_bcx_out, block_cleanups(cond_bcx_in));
147144
CondBr(cond_bcx_out, cond_val, body_bcx_in.llbb, next_bcx.llbb);
@@ -327,7 +324,6 @@ pub fn trans_check_expr(bcx: block,
327324
expr::trans_to_datum(bcx, pred_expr).to_result()
328325
}
329326
};
330-
let val = bool_to_i1(bcx, val);
331327
do with_cond(bcx, Not(bcx, val)) |bcx| {
332328
trans_fail(bcx, Some(pred_expr.span), /*bad*/copy expr_str)
333329
}

branches/try/src/librustc/middle/trans/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn lli64(val: int) -> ValueRef {
7777
C_i64(val as i64)
7878
}
7979
fn lli1(bval: bool) -> ValueRef {
80-
C_i1(bval)
80+
C_bool(bval)
8181
}
8282
fn llmdnode(elems: ~[ValueRef]) -> ValueRef {
8383
unsafe {

branches/try/src/librustc/middle/trans/expr.rs

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,7 @@ fn trans_unary_datum(bcx: block,
12361236
un_expr: @ast::expr,
12371237
op: ast::unop,
12381238
sub_expr: @ast::expr) -> DatumBlock {
1239+
12391240
let _icx = bcx.insn_ctxt("trans_unary_datum");
12401241

12411242
// if deref, would be LvalueExpr
@@ -1250,21 +1251,7 @@ fn trans_unary_datum(bcx: block,
12501251
return match op {
12511252
ast::not => {
12521253
let Result {bcx, val} = trans_to_datum(bcx, sub_expr).to_result();
1253-
1254-
// If this is a boolean type, we must not use the LLVM Not
1255-
// instruction, as that is a *bitwise* not and we want *logical*
1256-
// not on our 8-bit boolean values.
1257-
let llresult = match ty::get(un_ty).sty {
1258-
ty::ty_bool => {
1259-
let llcond = ICmp(bcx,
1260-
lib::llvm::IntEQ,
1261-
val,
1262-
C_bool(false));
1263-
Select(bcx, llcond, C_bool(true), C_bool(false))
1264-
}
1265-
_ => Not(bcx, val)
1266-
};
1267-
immediate_rvalue_bcx(bcx, llresult, un_ty)
1254+
immediate_rvalue_bcx(bcx, Not(bcx, val), un_ty)
12681255
}
12691256
ast::neg => {
12701257
let Result {bcx, val} = trans_to_datum(bcx, sub_expr).to_result();
@@ -1321,8 +1308,8 @@ fn trans_eager_binop(bcx: block,
13211308
binop_ty: ty::t,
13221309
op: ast::binop,
13231310
lhs_datum: &Datum,
1324-
rhs_datum: &Datum)
1325-
-> DatumBlock {
1311+
rhs_datum: &Datum) -> DatumBlock
1312+
{
13261313
let mut bcx = bcx;
13271314
let _icx = bcx.insn_ctxt("trans_eager_binop");
13281315

@@ -1401,7 +1388,7 @@ fn trans_eager_binop(bcx: block,
14011388
}
14021389
let cmpr = base::compare_scalar_types(bcx, lhs, rhs, rhs_t, op);
14031390
bcx = cmpr.bcx;
1404-
ZExt(bcx, cmpr.val, T_i8())
1391+
cmpr.val
14051392
}
14061393
}
14071394
_ => {
@@ -1419,7 +1406,8 @@ fn trans_lazy_binop(bcx: block,
14191406
binop_expr: @ast::expr,
14201407
op: lazy_binop_ty,
14211408
a: @ast::expr,
1422-
b: @ast::expr) -> DatumBlock {
1409+
b: @ast::expr) -> DatumBlock
1410+
{
14231411
let _icx = bcx.insn_ctxt("trans_lazy_binop");
14241412
let binop_ty = expr_ty(bcx, binop_expr);
14251413
let mut bcx = bcx;
@@ -1437,12 +1425,10 @@ fn trans_lazy_binop(bcx: block,
14371425
let join = base::sub_block(bcx, ~"join");
14381426
let before_rhs = base::sub_block(bcx, ~"rhs");
14391427

1440-
let lhs_i1 = bool_to_i1(past_lhs, lhs);
14411428
match op {
1442-
lazy_and => CondBr(past_lhs, lhs_i1, before_rhs.llbb, join.llbb),
1443-
lazy_or => CondBr(past_lhs, lhs_i1, join.llbb, before_rhs.llbb)
1429+
lazy_and => CondBr(past_lhs, lhs, before_rhs.llbb, join.llbb),
1430+
lazy_or => CondBr(past_lhs, lhs, join.llbb, before_rhs.llbb)
14441431
}
1445-
14461432
let Result {bcx: past_rhs, val: rhs} = {
14471433
do base::with_scope_result(before_rhs, b.info(), ~"rhs") |bcx| {
14481434
trans_to_datum(bcx, b).to_result()

0 commit comments

Comments
 (0)