Skip to content

Commit a99faa2

Browse files
committed
---
yaml --- r: 148143 b: refs/heads/try2 c: dd11fe1 h: refs/heads/master i: 148141: 3cafd21 148139: a7b24fa 148135: 662e390 148127: d2f627c v: v3
1 parent 61a2a6c commit a99faa2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1729
-1578
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 01f42eed803e7e01bb27be17461d0cc8f0643a70
8+
refs/heads/try2: dd11fe17c7cf3661905c952d8233527abbff4c11
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/guide-testing.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ value. To run the tests in a crate, it must be compiled with the
4848
the resulting executable will run all the tests in the crate. A test
4949
is considered successful if its function returns; if the task running
5050
the test fails, through a call to `fail!`, a failed `check` or
51-
`assert`, or some other (`assert_eq`, `assert_approx_eq`, ...) means,
52-
then the test fails.
51+
`assert`, or some other (`assert_eq`, ...) means, then the test fails.
5352

5453
When compiling a crate with the '--test' flag '--cfg test' is also
5554
implied, so that tests can be conditionally compiled.

branches/try2/src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ syn keyword rustTrait Bool
7171
syn keyword rustTrait ToCStr
7272
syn keyword rustTrait Char
7373
syn keyword rustTrait Clone DeepClone
74-
syn keyword rustTrait Eq ApproxEq Ord TotalEq TotalOrd Ordering Equiv
74+
syn keyword rustTrait Eq Ord TotalEq TotalOrd Ordering Equiv
7575
syn keyword rustEnumVariant Less Equal Greater
7676
syn keyword rustTrait Container Mutable Map MutableMap Set MutableSet
7777
syn keyword rustTrait Default

branches/try2/src/libextra/ebml.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,6 @@ mod tests {
935935
use serialize::Encodable;
936936
use serialize;
937937

938-
use std::io::Decorator;
939938
use std::io::mem::MemWriter;
940939
use std::option::{None, Option, Some};
941940

@@ -948,7 +947,7 @@ mod tests {
948947
let mut ebml_w = writer::Encoder(&mut wr);
949948
v.encode(&mut ebml_w);
950949
}
951-
let ebml_doc = reader::Doc(*wr.inner_ref());
950+
let ebml_doc = reader::Doc(wr.get_ref());
952951
let mut deser = reader::Decoder(ebml_doc);
953952
let v1 = serialize::Decodable::decode(&mut deser);
954953
debug!("v1 == {:?}", v1);

branches/try2/src/libextra/json.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use std::cast::transmute;
2121
use std::f64;
2222
use std::hashmap::HashMap;
2323
use std::io;
24-
use std::io::Decorator;
2524
use std::io::mem::MemWriter;
2625
use std::num;
2726
use std::str;
@@ -464,7 +463,7 @@ impl Json{
464463
pub fn to_pretty_str(&self) -> ~str {
465464
let mut s = MemWriter::new();
466465
self.to_pretty_writer(&mut s as &mut io::Writer);
467-
str::from_utf8_owned(s.inner())
466+
str::from_utf8_owned(s.unwrap())
468467
}
469468
}
470469

@@ -1321,7 +1320,7 @@ impl to_str::ToStr for Json {
13211320
fn to_str(&self) -> ~str {
13221321
let mut s = MemWriter::new();
13231322
self.to_writer(&mut s as &mut io::Writer);
1324-
str::from_utf8_owned(s.inner())
1323+
str::from_utf8_owned(s.unwrap())
13251324
}
13261325
}
13271326

@@ -1508,12 +1507,11 @@ mod tests {
15081507
15091508
fn with_str_writer(f: |&mut io::Writer|) -> ~str {
15101509
use std::io::mem::MemWriter;
1511-
use std::io::Decorator;
15121510
use std::str;
15131511
15141512
let mut m = MemWriter::new();
15151513
f(&mut m as &mut io::Writer);
1516-
str::from_utf8_owned(m.inner())
1514+
str::from_utf8_owned(m.unwrap())
15171515
}
15181516
15191517
#[test]

branches/try2/src/libextra/num/complex.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
//! Complex numbers.
1313
14-
1514
use std::num::{Zero,One,ToStrRadix};
1615

1716
// FIXME #1284: handle complex NaN & infinity etc. This
@@ -78,15 +77,15 @@ impl<T: Clone + Num> Cmplx<T> {
7877
}
7978
}
8079

81-
impl<T: Clone + Algebraic + Num> Cmplx<T> {
80+
impl<T: Clone + Real> Cmplx<T> {
8281
/// Calculate |self|
8382
#[inline]
8483
pub fn norm(&self) -> T {
8584
self.re.hypot(&self.im)
8685
}
8786
}
8887

89-
impl<T: Clone + Trigonometric + Algebraic + Num> Cmplx<T> {
88+
impl<T: Clone + Real> Cmplx<T> {
9089
/// Calculate the principal Arg of self.
9190
#[inline]
9291
pub fn arg(&self) -> T {
@@ -268,7 +267,7 @@ mod test {
268267
#[test]
269268
fn test_arg() {
270269
fn test(c: Complex64, arg: f64) {
271-
assert!(c.arg().approx_eq(&arg))
270+
assert!((c.arg() - arg).abs() < 1.0e-6)
272271
}
273272
test(_1_0i, 0.0);
274273
test(_1_1i, 0.25 * Real::pi());

branches/try2/src/libextra/num/rational.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ impl<T: Clone + Integer + Ord>
105105
ret.reduce();
106106
ret
107107
}
108+
109+
/// Return the reciprocal
110+
#[inline]
111+
pub fn recip(&self) -> Ratio<T> {
112+
Ratio::new_raw(self.denom.clone(), self.numer.clone())
113+
}
108114
}
109115

110116
impl Ratio<BigInt> {
@@ -288,13 +294,6 @@ impl<T: Clone + Integer + Ord>
288294
}
289295
}
290296

291-
impl<T: Clone + Integer + Ord> Fractional for Ratio<T> {
292-
#[inline]
293-
fn recip(&self) -> Ratio<T> {
294-
Ratio::new_raw(self.denom.clone(), self.numer.clone())
295-
}
296-
}
297-
298297
/* String conversions */
299298
impl<T: ToStr> ToStr for Ratio<T> {
300299
/// Renders as `numer/denom`.

branches/try2/src/libextra/stats.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,14 @@ mod tests {
439439
use std::io;
440440
use std::str;
441441

442+
macro_rules! assert_approx_eq(
443+
($a:expr, $b:expr) => ({
444+
let (a, b) = (&$a, &$b);
445+
assert!((*a - *b).abs() < 1.0e-6,
446+
"{} is not approximately equal to {}", *a, *b);
447+
})
448+
)
449+
442450
fn check(samples: &[f64], summ: &Summary) {
443451

444452
let summ2 = Summary::new(samples);
@@ -991,10 +999,9 @@ mod tests {
991999
fn test_boxplot_nonpositive() {
9921000
fn t(s: &Summary, expected: ~str) {
9931001
use std::io::mem::MemWriter;
994-
use std::io::Decorator;
9951002
let mut m = MemWriter::new();
9961003
write_boxplot(&mut m as &mut io::Writer, s, 30);
997-
let out = str::from_utf8_owned(m.inner());
1004+
let out = str::from_utf8_owned(m.unwrap());
9981005
assert_eq!(out, expected);
9991006
}
10001007

branches/try2/src/libextra/term.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#[allow(missing_doc)];
1414

1515

16-
use std::io::{Decorator, Writer};
17-
1816
use std::os;
1917
use terminfo::*;
2018
use terminfo::searcher::open;
@@ -234,20 +232,12 @@ impl<T: Writer> Terminal<T> {
234232
color-8
235233
} else { color }
236234
}
237-
}
238235

239-
impl<T: Writer> Decorator<T> for Terminal<T> {
240-
fn inner(self) -> T {
241-
self.out
242-
}
236+
pub fn unwrap(self) -> T { self.out }
243237

244-
fn inner_ref<'a>(&'a self) -> &'a T {
245-
&self.out
246-
}
238+
pub fn get_ref<'a>(&'a self) -> &'a T { &self.out }
247239

248-
fn inner_mut_ref<'a>(&'a mut self) -> &'a mut T {
249-
&mut self.out
250-
}
240+
pub fn get_mut<'a>(&'a mut self) -> &'a mut T { &mut self.out }
251241
}
252242

253243
impl<T: Writer> Writer for Terminal<T> {

branches/try2/src/libextra/test.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,6 @@ pub fn run_tests_console(opts: &TestOpts,
673673

674674
#[test]
675675
fn should_sort_failures_before_printing_them() {
676-
use std::io::Decorator;
677676
use std::io::mem::MemWriter;
678677
use std::str;
679678

@@ -705,7 +704,7 @@ fn should_sort_failures_before_printing_them() {
705704

706705
st.write_failures();
707706
let s = match st.out {
708-
Raw(ref m) => str::from_utf8(*m.inner_ref()),
707+
Raw(ref m) => str::from_utf8(m.get_ref()),
709708
Pretty(_) => unreachable!()
710709
};
711710

branches/try2/src/libextra/uuid.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,6 @@ mod test {
522522
use std::str;
523523
use std::rand;
524524
use std::num::Zero;
525-
use std::io::Decorator;
526525
use std::io::mem::MemWriter;
527526

528527
#[test]
@@ -798,7 +797,7 @@ mod test {
798797
let u = Uuid::new_v4();
799798
let mut wr = MemWriter::new();
800799
u.encode(&mut ebml::writer::Encoder(&mut wr));
801-
let doc = ebml::reader::Doc(wr.inner_ref().as_slice());
800+
let doc = ebml::reader::Doc(wr.get_ref());
802801
let u2 = Decodable::decode(&mut ebml::reader::Decoder(doc));
803802
assert_eq!(u, u2);
804803
}

branches/try2/src/libextra/workcache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use arc::{Arc,RWArc};
1717
use treemap::TreeMap;
1818
use std::str;
1919
use std::io;
20-
use std::io::{File, Decorator};
20+
use std::io::File;
2121
use std::io::mem::MemWriter;
2222

2323
/**
@@ -261,7 +261,7 @@ fn json_encode<'a, T:Encodable<json::Encoder<'a>>>(t: &T) -> ~str {
261261
let mut writer = MemWriter::new();
262262
let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer);
263263
t.encode(&mut encoder);
264-
str::from_utf8_owned(writer.inner())
264+
str::from_utf8_owned(writer.unwrap())
265265
}
266266

267267
// FIXME(#5121)

branches/try2/src/librustc/metadata/encoder.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use std::cast;
2525
use std::cell::{Cell, RefCell};
2626
use std::hashmap::{HashMap, HashSet};
2727
use std::io::mem::MemWriter;
28-
use std::io::{Writer, Seek, Decorator};
2928
use std::str;
3029
use std::vec;
3130

@@ -1807,7 +1806,7 @@ pub static metadata_encoding_version : &'static [u8] =
18071806
pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
18081807
let mut wr = MemWriter::new();
18091808
encode_metadata_inner(&mut wr, parms, crate);
1810-
wr.inner()
1809+
wr.unwrap()
18111810
}
18121811

18131812
fn encode_metadata_inner(wr: &mut MemWriter, parms: EncodeParams, crate: &Crate) {
@@ -1900,7 +1899,7 @@ fn encode_metadata_inner(wr: &mut MemWriter, parms: EncodeParams, crate: &Crate)
19001899
ecx.stats.total_bytes.set(ebml_w.writer.tell());
19011900

19021901
if (tcx.sess.meta_stats()) {
1903-
for e in ebml_w.writer.inner_ref().iter() {
1902+
for e in ebml_w.writer.get_ref().iter() {
19041903
if *e == 0 {
19051904
ecx.stats.zero_bytes.set(ecx.stats.zero_bytes.get() + 1);
19061905
}
@@ -1930,5 +1929,5 @@ pub fn encoded_ty(tcx: ty::ctxt, t: ty::t) -> ~str {
19301929
abbrevs: tyencode::ac_no_abbrevs};
19311930
let mut wr = MemWriter::new();
19321931
tyencode::enc_ty(&mut wr, cx, t);
1933-
str::from_utf8_owned(wr.inner_ref().to_owned())
1932+
str::from_utf8_owned(wr.get_ref().to_owned())
19341933
}

branches/try2/src/librustc/metadata/tyencode.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use std::cell::RefCell;
1414
use std::hashmap::HashMap;
1515
use std::io;
16-
use std::io::{Decorator, Writer, Seek};
1716
use std::io::mem::MemWriter;
1817
use std::str;
1918
use std::fmt;
@@ -73,7 +72,7 @@ pub fn enc_ty(w: &mut MemWriter, cx: @ctxt, t: ty::t) {
7372
None => {
7473
let wr = &mut MemWriter::new();
7574
enc_sty(wr, cx, &ty::get(t).sty);
76-
let s = str::from_utf8(*wr.inner_ref()).to_managed();
75+
let s = str::from_utf8(wr.get_ref()).to_managed();
7776
let mut short_names_cache = cx.tcx
7877
.short_names_cache
7978
.borrow_mut();

branches/try2/src/librustc/middle/astencode.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,6 @@ fn mk_ctxt() -> @fake_ext_ctxt {
14651465

14661466
#[cfg(test)]
14671467
fn roundtrip(in_item: Option<@ast::item>) {
1468-
use std::io::Decorator;
14691468
use std::io::mem::MemWriter;
14701469

14711470
let in_item = in_item.unwrap();
@@ -1474,7 +1473,7 @@ fn roundtrip(in_item: Option<@ast::item>) {
14741473
let mut ebml_w = writer::Encoder(&mut wr);
14751474
encode_item_ast(&mut ebml_w, in_item);
14761475
}
1477-
let ebml_doc = reader::Doc(wr.inner_ref().as_slice());
1476+
let ebml_doc = reader::Doc(wr.get_ref());
14781477
let out_item = decode_item_ast(ebml_doc);
14791478

14801479
assert_eq!(in_item, out_item);

0 commit comments

Comments
 (0)