Skip to content

Commit d8c34ed

Browse files
committed
---
yaml --- r: 130271 b: refs/heads/auto c: 69a9d23 h: refs/heads/master i: 130269: dce081c 130267: 09f9396 130263: 6a74106 130255: 9271549 130239: 2815b4b v: v3
1 parent ff6f109 commit d8c34ed

27 files changed

+66
-217
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 3ce5a026b076276a01ddec5b4b1ffbc171e8fce2
16+
refs/heads/auto: 69a9d23d58cc0efff107d25e9a4f9f7a4239b004
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/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/auto/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/auto/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/auto/src/librustc/middle/trans/cleanup.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ impl<'a> CleanupHelperMethods<'a> for FunctionContext<'a> {
640640
while !popped_scopes.is_empty() {
641641
let mut scope = popped_scopes.pop().unwrap();
642642

643-
if scope.cleanups.iter().any(|c| cleanup_is_suitable_for(&**c, label))
643+
if scope.cleanups.iter().any(|c| cleanup_is_suitable_for(*c, label))
644644
{
645645
let name = scope.block_name("clean");
646646
debug!("generating cleanups for {}", name);
@@ -649,7 +649,7 @@ impl<'a> CleanupHelperMethods<'a> for FunctionContext<'a> {
649649
None);
650650
let mut bcx_out = bcx_in;
651651
for cleanup in scope.cleanups.iter().rev() {
652-
if cleanup_is_suitable_for(&**cleanup, label) {
652+
if cleanup_is_suitable_for(*cleanup, label) {
653653
bcx_out = cleanup.trans(bcx_out);
654654
}
655655
}

branches/auto/src/librustc/middle/trans/consts.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ fn const_deref(cx: &CrateContext, v: ValueRef, t: ty::t, explicit: bool)
170170
}
171171
}
172172
None => {
173-
cx.sess().bug(format!("cannot dereference const of type {}",
173+
cx.sess().bug(format!("can't dereference const of type {}",
174174
ty_to_string(cx.tcx(), t)).as_slice())
175175
}
176176
}
@@ -225,12 +225,10 @@ pub fn const_expr(cx: &CrateContext, e: &ast::Expr, is_local: bool) -> (ValueRef
225225
ty::AutoDerefRef(ref adj) => {
226226
let mut ty = ety;
227227
// Save the last autoderef in case we can avoid it.
228-
if adj.autoderefs > 0 {
229-
for _ in range(0, adj.autoderefs-1) {
230-
let (dv, dt) = const_deref(cx, llconst, ty, false);
231-
llconst = dv;
232-
ty = dt;
233-
}
228+
for _ in range(0, adj.autoderefs-1) {
229+
let (dv, dt) = const_deref(cx, llconst, ty, false);
230+
llconst = dv;
231+
ty = dt;
234232
}
235233

236234
match adj.autoref {
@@ -265,8 +263,6 @@ pub fn const_expr(cx: &CrateContext, e: &ast::Expr, is_local: bool) -> (ValueRef
265263
// work properly.
266264
let (_, dt) = const_deref(cx, llconst, ty, false);
267265
ty = dt;
268-
} else {
269-
llconst = const_addr_of(cx, llconst, ast::MutImmutable)
270266
}
271267

272268
match ty::get(ty).sty {

branches/auto/src/librustc/middle/trans/datum.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,6 @@ 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-
456454
assert!(ty::lltype_is_sized(bcx.tcx(), self.ty),
457455
"Trying to convert unsized value to lval");
458456
self.match_kind(

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

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,17 +2061,11 @@ 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
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)
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))
20752069
}
20762070
}
20772071

@@ -2100,7 +2094,7 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
21002094
// just different types.
21012095
DatumBlock::new(bcx, Datum::new(datum.val,
21022096
ty::mk_open(bcx.tcx(), content_ty),
2103-
LvalueExpr))
2097+
datum.kind))
21042098
}
21052099
}
21062100

branches/auto/src/librustc/middle/typeck/infer/coercion.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ impl<'f> Coerce<'f> {
327327

328328
let sty_b = &ty::get(b).sty;
329329
match (sty_a, sty_b) {
330+
(&ty::ty_uniq(_), &ty::ty_rptr(..)) => Err(ty::terr_mismatch),
330331
(&ty::ty_rptr(_, ty::mt{ty: t_a, ..}), &ty::ty_rptr(_, mt_b)) => {
331332
self.unpack_actual_value(t_a, |sty_a| {
332333
match self.unsize_ty(sty_a, mt_b.ty) {
@@ -510,7 +511,7 @@ impl<'f> Coerce<'f> {
510511
let tcx = self.get_ref().infcx.tcx;
511512

512513
match *sty_a {
513-
ty::ty_rptr(_, ty::mt{ty, ..}) => match ty::get(ty).sty {
514+
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => match ty::get(ty).sty {
514515
ty::ty_trait(box ty::TyTrait {
515516
def_id,
516517
ref substs,

branches/auto/src/librustrt/unwind.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ use core::prelude::*;
6161

6262
use alloc::boxed::Box;
6363
use collections::string::String;
64-
use collections::str::StrAllocating;
6564
use collections::vec::Vec;
6665
use core::any::Any;
6766
use core::atomic;
@@ -526,8 +525,7 @@ pub fn begin_unwind_fmt(msg: &fmt::Arguments, file_line: &(&'static str, uint))
526525
let mut v = Vec::new();
527526
let _ = write!(&mut VecWriter { v: &mut v }, "{}", msg);
528527

529-
let msg = box String::from_utf8_lossy(v.as_slice()).into_string();
530-
begin_unwind_inner(msg, file_line)
528+
begin_unwind_inner(box String::from_utf8(v).unwrap(), file_line)
531529
}
532530

533531
/// This is the entry point of unwinding for fail!() and assert!().
@@ -572,7 +570,7 @@ fn begin_unwind_inner(msg: Box<Any + Send>, file_line: &(&'static str, uint)) ->
572570
n => {
573571
let f: Callback = unsafe { mem::transmute(n) };
574572
let (file, line) = *file_line;
575-
f(&*msg, file, line);
573+
f(msg, file, line);
576574
}
577575
}
578576
};

branches/auto/src/libstd/failure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub fn on_fail(obj: &Any + Send, file: &'static str, line: uint) {
8181
"task '{}' failed at '{}', {}:{}\n",
8282
n, msg, file, line);
8383
if backtrace::log_enabled() {
84-
let _ = backtrace::write(&mut *stderr);
84+
let _ = backtrace::write(stderr);
8585
}
8686
local_stderr.replace(Some(stderr));
8787
}

branches/auto/src/libstd/io/stdio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ fn with_task_stdout(f: |&mut Writer| -> IoResult<()>) {
203203
let mut my_stdout = local_stdout.replace(None).unwrap_or_else(|| {
204204
box stdout() as Box<Writer + Send>
205205
});
206-
let result = f(&mut *my_stdout);
206+
let result = f(my_stdout);
207207
local_stdout.replace(Some(my_stdout));
208208
result
209209
} else {

branches/auto/src/libsyntax/parse/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ impl<'a> Parser<'a> {
351351
mut rdr: Box<Reader+'a>)
352352
-> Parser<'a>
353353
{
354-
let tok0 = real_token(&mut *rdr);
354+
let tok0 = real_token(rdr);
355355
let span = tok0.sp;
356356
let placeholder = TokenAndSpan {
357357
tok: token::UNDERSCORE,
@@ -899,7 +899,7 @@ impl<'a> Parser<'a> {
899899
None
900900
};
901901
let next = if self.buffer_start == self.buffer_end {
902-
real_token(&mut *self.reader)
902+
real_token(self.reader)
903903
} else {
904904
// Avoid token copies with `replace`.
905905
let buffer_start = self.buffer_start as uint;
@@ -943,7 +943,7 @@ impl<'a> Parser<'a> {
943943
-> R {
944944
let dist = distance as int;
945945
while self.buffer_length() < dist {
946-
self.buffer[self.buffer_end as uint] = real_token(&mut *self.reader);
946+
self.buffer[self.buffer_end as uint] = real_token(self.reader);
947947
self.buffer_end = (self.buffer_end + 1) & 3;
948948
}
949949
f(&self.buffer[((self.buffer_start + dist - 1) & 3) as uint].tok)

0 commit comments

Comments
 (0)