Skip to content

Commit faba22a

Browse files
committed
---
yaml --- r: 130077 b: refs/heads/snap-stage3 c: e9bd650 h: refs/heads/master i: 130075: 4891e13 v: v3
1 parent 3960870 commit faba22a

File tree

11 files changed

+46
-119
lines changed

11 files changed

+46
-119
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 0bdac78da87605f6f7f6e7924872617226b19c85
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 2e385817926f6f914fbff482aab3a8b627e7feee
4+
refs/heads/snap-stage3: e9bd650cad7c519e3f39b8bbed5afeac94daff05
55
refs/heads/try: 28d5878c1f0465c11c8e7a3085008b0c592d48d0
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libnum/complex.rs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
//! Complex numbers.
1313
1414
use std::fmt;
15-
use std::num::{Zero, One, ToStrRadix};
15+
use std::num::{Zero,One,ToStrRadix};
1616

1717
// FIXME #1284: handle complex NaN & infinity etc. This
1818
// probably doesn't map to C's _Complex correctly.
1919

2020
/// A complex number in Cartesian form.
21-
#[deriving(PartialEq, Clone, Hash)]
21+
#[deriving(PartialEq,Clone)]
2222
pub struct Complex<T> {
2323
/// Real portion of the complex number
2424
pub re: T,
@@ -36,8 +36,10 @@ impl<T: Clone + Num> Complex<T> {
3636
Complex { re: re, im: im }
3737
}
3838

39-
/// Returns the square of the norm (since `T` doesn't necessarily
40-
/// have a sqrt function), i.e. `re^2 + im^2`.
39+
/**
40+
Returns the square of the norm (since `T` doesn't necessarily
41+
have a sqrt function), i.e. `re^2 + im^2`.
42+
*/
4143
#[inline]
4244
pub fn norm_sqr(&self) -> T {
4345
self.re * self.re + self.im * self.im
@@ -191,8 +193,7 @@ mod test {
191193
#![allow(non_uppercase_statics)]
192194

193195
use super::{Complex64, Complex};
194-
use std::num::{Zero, One, Float};
195-
use std::hash::hash;
196+
use std::num::{Zero,One,Float};
196197

197198
pub static _0_0i : Complex64 = Complex { re: 0.0, im: 0.0 };
198199
pub static _1_0i : Complex64 = Complex { re: 1.0, im: 0.0 };
@@ -366,14 +367,4 @@ mod test {
366367
test(-_neg1_1i, "1-1i".to_string());
367368
test(_05_05i, "0.5+0.5i".to_string());
368369
}
369-
370-
#[test]
371-
fn test_hash() {
372-
let a = Complex::new(0i32, 0i32);
373-
let b = Complex::new(1i32, 0i32);
374-
let c = Complex::new(0i32, 1i32);
375-
assert!(hash(&a) != hash(&b));
376-
assert!(hash(&b) != hash(&c));
377-
assert!(hash(&c) != hash(&a));
378-
}
379370
}

branches/snap-stage3/src/libnum/rational.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::num::{Zero, One, ToStrRadix, FromStrRadix};
2121
use bigint::{BigInt, BigUint, Sign, Plus, Minus};
2222

2323
/// Represents the ratio between 2 numbers.
24-
#[deriving(Clone, Hash)]
24+
#[deriving(Clone)]
2525
#[allow(missing_doc)]
2626
pub struct Ratio<T> {
2727
numer: T,
@@ -380,7 +380,6 @@ mod test {
380380
use super::{Ratio, Rational, BigRational};
381381
use std::num::{Zero, One, FromStrRadix, FromPrimitive, ToStrRadix};
382382
use std::from_str::FromStr;
383-
use std::hash::hash;
384383
use std::num;
385384

386385
pub static _0 : Rational = Ratio { numer: 0, denom: 1};
@@ -752,10 +751,4 @@ mod test {
752751
assert!(! _neg1_2.is_positive());
753752
assert!(! _1_2.is_negative());
754753
}
755-
756-
#[test]
757-
fn test_hash() {
758-
assert!(hash(&_0) != hash(&_1));
759-
assert!(hash(&_0) != hash(&_3_2));
760-
}
761754
}

branches/snap-stage3/src/librustc/front/test.rs

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@ struct TestCtxt<'a> {
5050
path: Vec<ast::Ident>,
5151
ext_cx: ExtCtxt<'a>,
5252
testfns: Vec<Test>,
53+
reexport_mod_ident: ast::Ident,
5354
reexport_test_harness_main: Option<InternedString>,
5455
is_test_crate: bool,
5556
config: ast::CrateConfig,
56-
57-
// top-level re-export submodule, filled out after folding is finished
58-
toplevel_reexport: Option<ast::Ident>,
5957
}
6058

6159
// Traverse the crate, collecting all the test functions, eliding any
@@ -85,9 +83,7 @@ pub fn modify_for_testing(sess: &Session,
8583
struct TestHarnessGenerator<'a> {
8684
cx: TestCtxt<'a>,
8785
tests: Vec<ast::Ident>,
88-
89-
// submodule name, gensym'd identifier for re-exports
90-
tested_submods: Vec<(ast::Ident, ast::Ident)>,
86+
tested_submods: Vec<ast::Ident>,
9187
}
9288

9389
impl<'a> fold::Folder for TestHarnessGenerator<'a> {
@@ -172,14 +168,10 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
172168
*i = nomain(*i);
173169
}
174170
if !tests.is_empty() || !tested_submods.is_empty() {
175-
let (it, sym) = mk_reexport_mod(&mut self.cx, tests, tested_submods);
176-
mod_folded.items.push(it);
177-
171+
mod_folded.items.push(mk_reexport_mod(&mut self.cx, tests,
172+
tested_submods));
178173
if !self.cx.path.is_empty() {
179-
self.tested_submods.push((self.cx.path[self.cx.path.len()-1], sym));
180-
} else {
181-
debug!("pushing nothing, sym: {}", sym);
182-
self.cx.toplevel_reexport = Some(sym);
174+
self.tested_submods.push(self.cx.path[self.cx.path.len()-1]);
183175
}
184176
}
185177

@@ -188,16 +180,16 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
188180
}
189181

190182
fn mk_reexport_mod(cx: &mut TestCtxt, tests: Vec<ast::Ident>,
191-
tested_submods: Vec<(ast::Ident, ast::Ident)>) -> (Gc<ast::Item>, ast::Ident) {
183+
tested_submods: Vec<ast::Ident>) -> Gc<ast::Item> {
192184
let mut view_items = Vec::new();
193185
let super_ = token::str_to_ident("super");
194186

195187
view_items.extend(tests.move_iter().map(|r| {
196188
cx.ext_cx.view_use_simple(DUMMY_SP, ast::Public,
197189
cx.ext_cx.path(DUMMY_SP, vec![super_, r]))
198190
}));
199-
view_items.extend(tested_submods.move_iter().map(|(r, sym)| {
200-
let path = cx.ext_cx.path(DUMMY_SP, vec![super_, r, sym]);
191+
view_items.extend(tested_submods.move_iter().map(|r| {
192+
let path = cx.ext_cx.path(DUMMY_SP, vec![super_, r, cx.reexport_mod_ident]);
201193
cx.ext_cx.view_use_simple_(DUMMY_SP, ast::Public, r, path)
202194
}));
203195

@@ -206,18 +198,14 @@ fn mk_reexport_mod(cx: &mut TestCtxt, tests: Vec<ast::Ident>,
206198
view_items: view_items,
207199
items: Vec::new(),
208200
};
209-
210-
let sym = token::gensym_ident("__test_reexports");
211-
let it = box(GC) ast::Item {
212-
ident: sym.clone(),
201+
box(GC) ast::Item {
202+
ident: cx.reexport_mod_ident.clone(),
213203
attrs: Vec::new(),
214204
id: ast::DUMMY_NODE_ID,
215205
node: ast::ItemMod(reexport_mod),
216206
vis: ast::Public,
217207
span: DUMMY_SP,
218-
};
219-
220-
(it, sym)
208+
}
221209
}
222210

223211
fn generate_test_harness(sess: &Session,
@@ -232,10 +220,10 @@ fn generate_test_harness(sess: &Session,
232220
}),
233221
path: Vec::new(),
234222
testfns: Vec::new(),
223+
reexport_mod_ident: token::gensym_ident("__test_reexports"),
235224
reexport_test_harness_main: reexport_test_harness_main,
236225
is_test_crate: is_test_crate(&krate),
237226
config: krate.config.clone(),
238-
toplevel_reexport: None,
239227
};
240228

241229
cx.ext_cx.bt_push(ExpnInfo {
@@ -542,14 +530,7 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> Gc<ast::Expr> {
542530
field("should_fail", fail_expr)]);
543531

544532

545-
let mut visible_path = match cx.toplevel_reexport {
546-
Some(id) => vec![id],
547-
None => {
548-
cx.sess.bug(
549-
"expected to find top-level re-export name, but found None"
550-
);
551-
}
552-
};
533+
let mut visible_path = vec![cx.reexport_mod_ident.clone()];
553534
visible_path.extend(path.move_iter());
554535

555536
let fn_expr = ecx.expr_path(ecx.path_global(span, visible_path));

branches/snap-stage3/src/librustc/middle/trans/datum.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,8 @@ impl Datum<Expr> {
451451
name: &str,
452452
expr_id: ast::NodeId)
453453
-> DatumBlock<'a, Lvalue> {
454+
debug!("to_lvalue_datum self: {}", self.to_string(bcx.ccx()));
455+
454456
assert!(ty::lltype_is_sized(bcx.tcx(), self.ty),
455457
"Trying to convert unsized value to lval");
456458
self.match_kind(

branches/snap-stage3/src/librustc/middle/trans/expr.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,11 +2061,17 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
20612061
if ty::type_is_sized(bcx.tcx(), content_ty) {
20622062
deref_owned_pointer(bcx, expr, datum, content_ty)
20632063
} else {
2064-
// A fat pointer and an opened DST value have the same represenation
2065-
// just different types.
2066-
DatumBlock::new(bcx, Datum::new(datum.val,
2067-
ty::mk_open(bcx.tcx(), content_ty),
2068-
datum.kind))
2064+
// A fat pointer and an opened DST value have the same
2065+
// represenation just different types. Since there is no
2066+
// temporary for `*e` here (because it is unsized), we cannot
2067+
// emulate the sized object code path for running drop glue and
2068+
// free. Instead, we schedule cleanup for `e`, turning it into
2069+
// an lvalue.
2070+
let datum = unpack_datum!(
2071+
bcx, datum.to_lvalue_datum(bcx, "deref", expr.id));
2072+
2073+
let datum = Datum::new(datum.val, ty::mk_open(bcx.tcx(), content_ty), LvalueExpr);
2074+
DatumBlock::new(bcx, datum)
20692075
}
20702076
}
20712077

@@ -2094,7 +2100,7 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
20942100
// just different types.
20952101
DatumBlock::new(bcx, Datum::new(datum.val,
20962102
ty::mk_open(bcx.tcx(), content_ty),
2097-
datum.kind))
2103+
LvalueExpr))
20982104
}
20992105
}
21002106

branches/snap-stage3/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// older versions of GDB too. A more extensive test can be found in
1313
// gdb-pretty-struct-and-enums.rs
1414

15-
// ignore-test FIXME(#16919)
1615
// ignore-tidy-linelength
1716
// ignore-lldb
1817
// ignore-android: FIXME(#10381)

branches/snap-stage3/src/test/debuginfo/gdb-pretty-struct-and-enums.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-test FIXME(#16919)
1211
// ignore-tidy-linelength
1312
// ignore-lldb
1413
// ignore-android: FIXME(#10381)

branches/snap-stage3/src/test/run-pass/issue-16597-empty.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

branches/snap-stage3/src/test/run-pass/issue-16597.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

branches/snap-stage3/src/test/run-pass/tcp-accept-stress.rs

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-macos osx really doesn't like cycling through large numbers of
12-
// sockets as calls to connect() will start returning EADDRNOTAVAIL
13-
// quite quickly and it takes a few seconds for the sockets to get
14-
// recycled.
15-
1611
#![feature(phase)]
1712

1813
#[phase(plugin)]
@@ -25,7 +20,7 @@ use std::task::TaskBuilder;
2520
use native::NativeTaskBuilder;
2621

2722
static N: uint = 8;
28-
static M: uint = 20;
23+
static M: uint = 100;
2924

3025
green_start!(main)
3126

@@ -45,12 +40,11 @@ fn test() {
4540
let mut a = l.listen().unwrap();
4641
let cnt = Arc::new(atomic::AtomicUint::new(0));
4742

48-
let (srv_tx, srv_rx) = channel();
49-
let (cli_tx, cli_rx) = channel();
43+
let (tx, rx) = channel();
5044
for _ in range(0, N) {
5145
let a = a.clone();
5246
let cnt = cnt.clone();
53-
let srv_tx = srv_tx.clone();
47+
let tx = tx.clone();
5448
spawn(proc() {
5549
let mut a = a;
5650
loop {
@@ -64,36 +58,33 @@ fn test() {
6458
Err(e) => fail!("{}", e),
6559
}
6660
}
67-
srv_tx.send(());
61+
tx.send(());
6862
});
6963
}
7064

7165
for _ in range(0, N) {
72-
let cli_tx = cli_tx.clone();
66+
let tx = tx.clone();
7367
spawn(proc() {
7468
for _ in range(0, M) {
7569
let _s = TcpStream::connect(addr.ip.to_string().as_slice(),
7670
addr.port).unwrap();
7771
}
78-
cli_tx.send(());
72+
tx.send(());
7973
});
8074
}
81-
drop((cli_tx, srv_tx));
75+
drop(tx);
8276

8377
// wait for senders
84-
if cli_rx.iter().take(N).count() != N {
85-
a.close_accept().unwrap();
86-
fail!("clients failed");
87-
}
78+
assert_eq!(rx.iter().take(N).count(), N);
8879

8980
// wait for one acceptor to die
90-
let _ = srv_rx.recv();
81+
let _ = rx.recv();
9182

9283
// Notify other receivers should die
9384
a.close_accept().unwrap();
9485

9586
// wait for receivers
96-
assert_eq!(srv_rx.iter().take(N - 1).count(), N - 1);
87+
assert_eq!(rx.iter().take(N - 1).count(), N - 1);
9788

9889
// Everything should have been accepted.
9990
assert_eq!(cnt.load(atomic::SeqCst), N * M);

0 commit comments

Comments
 (0)