Skip to content

Commit ca6c907

Browse files
committed
---
yaml --- r: 42351 b: refs/heads/master c: 82d7396 h: refs/heads/master i: 42349: d06f1db 42347: 9f32cb4 42343: 1ea9dec 42335: 8173a8e v: v3
1 parent 98d4a8b commit ca6c907

File tree

5 files changed

+19
-75
lines changed

5 files changed

+19
-75
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 17a14fe0e9402cf0883f5957879646a9ef359769
2+
refs/heads/master: 82d73963334f01b818cda767b44cd0c8f3baf4cc
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650

trunk/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)

trunk/src/librustc/middle/trans/base.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -813,27 +813,6 @@ pub fn get_discrim_val(cx: @crate_ctxt, span: span, enum_did: ast::def_id,
813813
}
814814
}
815815

816-
pub fn lookup_discriminant(ccx: @crate_ctxt, vid: ast::def_id) -> ValueRef {
817-
unsafe {
818-
let _icx = ccx.insn_ctxt("lookup_discriminant");
819-
match ccx.discrims.find(&vid) {
820-
None => {
821-
// It's an external discriminant that we haven't seen yet.
822-
assert (vid.crate != ast::local_crate);
823-
let sym = csearch::get_symbol(ccx.sess.cstore, vid);
824-
let gvar = str::as_c_str(sym, |buf| {
825-
llvm::LLVMAddGlobal(ccx.llmod, ccx.int_type, buf)
826-
});
827-
lib::llvm::SetLinkage(gvar, lib::llvm::ExternalLinkage);
828-
llvm::LLVMSetGlobalConstant(gvar, True);
829-
ccx.discrims.insert(vid, gvar);
830-
return gvar;
831-
}
832-
Some(llval) => return llval,
833-
}
834-
}
835-
}
836-
837816
pub fn invoke(bcx: block, llfn: ValueRef, +llargs: ~[ValueRef]) -> block {
838817
let _icx = bcx.insn_ctxt("invoke_");
839818
if bcx.unreachable { return bcx; }

trunk/src/librustc/middle/trans/expr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -696,15 +696,15 @@ fn trans_def_dps_unadjusted(bcx: block, ref_expr: @ast::expr,
696696
return fn_data_to_datum(bcx, impl_did, fn_data, lldest);
697697
}
698698
ast::def_variant(tid, vid) => {
699-
if ty::enum_variant_with_id(ccx.tcx, tid, vid).args.len() > 0u {
699+
let variant_info = ty::enum_variant_with_id(ccx.tcx, tid, vid);
700+
if variant_info.args.len() > 0u {
700701
// N-ary variant.
701702
let fn_data = callee::trans_fn_ref(bcx, vid, ref_expr.id);
702703
return fn_data_to_datum(bcx, vid, fn_data, lldest);
703704
} else {
704705
// Nullary variant.
705706
let lldiscrimptr = GEPi(bcx, lldest, [0u, 0u]);
706-
let lldiscrim_gv = base::lookup_discriminant(ccx, vid);
707-
let lldiscrim = Load(bcx, lldiscrim_gv);
707+
let lldiscrim = C_int(bcx.ccx(), variant_info.disr_val);
708708
Store(bcx, lldiscrim, lldiscrimptr);
709709
return bcx;
710710
}

trunk/src/libstd/cmp.rs

Lines changed: 9 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,36 @@ use core::f32;
1515
use core::f64;
1616
use core::float;
1717

18-
pub const FUZZY_EPSILON: float = 1.0e-6;
18+
const fuzzy_epsilon: float = 1.0e-6;
1919

20-
pub trait FuzzyEq<Eps> {
20+
pub trait FuzzyEq {
2121
pure fn fuzzy_eq(&self, other: &Self) -> bool;
22-
pure fn fuzzy_eq_eps(&self, other: &Self, epsilon: &Eps) -> bool;
22+
pure fn fuzzy_eq_eps(&self, other: &Self, epsilon: &Self) -> bool;
2323
}
2424

25-
impl float: FuzzyEq<float> {
25+
impl float: FuzzyEq {
2626
pure fn fuzzy_eq(&self, other: &float) -> bool {
27-
self.fuzzy_eq_eps(other, &FUZZY_EPSILON)
27+
self.fuzzy_eq_eps(other, &fuzzy_epsilon)
2828
}
2929

3030
pure fn fuzzy_eq_eps(&self, other: &float, epsilon: &float) -> bool {
3131
float::abs(*self - *other) < *epsilon
3232
}
3333
}
3434

35-
impl f32: FuzzyEq<f32> {
35+
impl f32: FuzzyEq {
3636
pure fn fuzzy_eq(&self, other: &f32) -> bool {
37-
self.fuzzy_eq_eps(other, &(FUZZY_EPSILON as f32))
37+
self.fuzzy_eq_eps(other, &(fuzzy_epsilon as f32))
3838
}
3939

4040
pure fn fuzzy_eq_eps(&self, other: &f32, epsilon: &f32) -> bool {
4141
f32::abs(*self - *other) < *epsilon
4242
}
4343
}
4444

45-
impl f64: FuzzyEq<f64> {
45+
impl f64: FuzzyEq {
4646
pure fn fuzzy_eq(&self, other: &f64) -> bool {
47-
self.fuzzy_eq_eps(other, &(FUZZY_EPSILON as f64))
47+
self.fuzzy_eq_eps(other, &(fuzzy_epsilon as f64))
4848
}
4949

5050
pure fn fuzzy_eq_eps(&self, other: &f64, epsilon: &f64) -> bool {
@@ -64,40 +64,3 @@ fn test_fuzzy_eq_eps() {
6464
assert (&1.2f).fuzzy_eq_eps(&0.9, &0.5);
6565
assert !(&1.5f).fuzzy_eq_eps(&0.9, &0.5);
6666
}
67-
68-
#[test]
69-
mod test_complex{
70-
use cmp::*;
71-
72-
struct Complex { r: float, i: float }
73-
74-
impl Complex: FuzzyEq<float> {
75-
pure fn fuzzy_eq(&self, other: &Complex) -> bool {
76-
self.fuzzy_eq_eps(other, &FUZZY_EPSILON)
77-
}
78-
79-
pure fn fuzzy_eq_eps(&self, other: &Complex,
80-
epsilon: &float) -> bool {
81-
self.r.fuzzy_eq_eps(&other.r, epsilon) &&
82-
self.i.fuzzy_eq_eps(&other.i, epsilon)
83-
}
84-
}
85-
86-
#[test]
87-
fn test_fuzzy_equals() {
88-
let a = Complex {r: 0.9, i: 0.9};
89-
let b = Complex {r: 0.9, i: 0.9};
90-
91-
assert (a.fuzzy_eq(&b));
92-
}
93-
94-
#[test]
95-
fn test_fuzzy_eq_eps() {
96-
let other = Complex {r: 0.9, i: 0.9};
97-
98-
assert (&Complex {r: 0.9, i: 1.2}).fuzzy_eq_eps(&other, &0.5);
99-
assert (&Complex {r: 1.2, i: 0.9}).fuzzy_eq_eps(&other, &0.5);
100-
assert !(&Complex {r: 0.9, i: 1.5}).fuzzy_eq_eps(&other, &0.5);
101-
assert !(&Complex {r: 1.5, i: 0.9}).fuzzy_eq_eps(&other, &0.5);
102-
}
103-
}

0 commit comments

Comments
 (0)