Skip to content

Commit 7f7c122

Browse files
committed
---
yaml --- r: 105979 b: refs/heads/auto c: 1218f6d h: refs/heads/master i: 105977: 443f8a8 105975: e8788b8 v: v3
1 parent 680c555 commit 7f7c122

32 files changed

+514
-145
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: 3d6c28acd0bfd4a7533169ac523a623177b1cfe7
16+
refs/heads/auto: 1218f6db770f75b262b2feb84cffdc13e8461503
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/doc/guide-tasks.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,6 @@ fn pnorm(nums: &~[f64], p: uint) -> f64 {
351351
352352
fn main() {
353353
let numbers = vec::from_fn(1000000, |_| rand::random::<f64>());
354-
println!("Inf-norm = {}", *numbers.iter().max().unwrap());
355-
356354
let numbers_arc = Arc::new(numbers);
357355
358356
for num in range(1u, 10) {

branches/auto/src/libcollections/hashmap.rs

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,41 +1069,49 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
10691069
/// so we have some sort of upper bound on the number of probes to do.
10701070
///
10711071
/// 'hash', 'k', and 'v' are the elements to robin hood into the hashtable.
1072-
fn robin_hood(&mut self, index: table::FullIndex, dib_param: uint,
1073-
hash: table::SafeHash, k: K, v: V) {
1074-
let (old_hash, old_key, old_val) = {
1075-
let (old_hash_ref, old_key_ref, old_val_ref) = self.table.read_all_mut(&index);
1076-
1077-
let old_hash = replace(old_hash_ref, hash);
1078-
let old_key = replace(old_key_ref, k);
1079-
let old_val = replace(old_val_ref, v);
1080-
1081-
(old_hash, old_key, old_val)
1082-
};
1083-
1084-
let mut probe = self.probe_next(index.raw_index());
1085-
1086-
for dib in range(dib_param + 1, self.table.size()) {
1087-
let full_index = match self.table.peek(probe) {
1088-
table::Empty(idx) => {
1089-
// Finally. A hole!
1090-
self.table.put(idx, old_hash, old_key, old_val);
1091-
return;
1092-
},
1093-
table::Full(idx) => idx
1072+
fn robin_hood(&mut self, mut index: table::FullIndex, mut dib_param: uint,
1073+
mut hash: table::SafeHash, mut k: K, mut v: V) {
1074+
'outer: loop {
1075+
let (old_hash, old_key, old_val) = {
1076+
let (old_hash_ref, old_key_ref, old_val_ref) =
1077+
self.table.read_all_mut(&index);
1078+
1079+
let old_hash = replace(old_hash_ref, hash);
1080+
let old_key = replace(old_key_ref, k);
1081+
let old_val = replace(old_val_ref, v);
1082+
1083+
(old_hash, old_key, old_val)
10941084
};
10951085

1096-
let probe_dib = self.bucket_distance(&full_index);
1086+
let mut probe = self.probe_next(index.raw_index());
1087+
1088+
for dib in range(dib_param + 1, self.table.size()) {
1089+
let full_index = match self.table.peek(probe) {
1090+
table::Empty(idx) => {
1091+
// Finally. A hole!
1092+
self.table.put(idx, old_hash, old_key, old_val);
1093+
return;
1094+
},
1095+
table::Full(idx) => idx
1096+
};
1097+
1098+
let probe_dib = self.bucket_distance(&full_index);
1099+
1100+
// Robin hood! Steal the spot.
1101+
if probe_dib < dib {
1102+
index = full_index;
1103+
dib_param = probe_dib;
1104+
hash = old_hash;
1105+
k = old_key;
1106+
v = old_val;
1107+
continue 'outer;
1108+
}
10971109

1098-
if probe_dib < dib {
1099-
// Robin hood! Steal the spot. This had better be tail call.
1100-
return self.robin_hood(full_index, probe_dib, old_hash, old_key, old_val);
1110+
probe = self.probe_next(probe);
11011111
}
11021112

1103-
probe = self.probe_next(probe);
1113+
fail!("HashMap fatal error: 100% load factor?");
11041114
}
1105-
1106-
fail!("HashMap fatal error: 100% load factor?");
11071115
}
11081116

11091117
/// Manually insert a pre-hashed key-value pair, without first checking
@@ -1948,7 +1956,6 @@ mod test_map {
19481956

19491957
#[cfg(test)]
19501958
mod test_set {
1951-
use super::HashMap;
19521959
use super::HashSet;
19531960
use std::container::Container;
19541961
use std::vec::ImmutableEqVector;
@@ -2193,7 +2200,6 @@ mod test_set {
21932200
mod bench {
21942201
extern crate test;
21952202
use self::test::BenchHarness;
2196-
use std::iter;
21972203
use std::iter::{range_inclusive};
21982204

21992205
#[bench]

branches/auto/src/libgreen/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ fn initialize_call_frame(regs: &mut Registers, fptr: InitFn, arg: uint,
283283
unsafe { *sp = 0; }
284284

285285
regs[4] = arg as uint;
286+
regs[5] = procedure.code as uint;
287+
regs[6] = procedure.env as uint;
286288
regs[29] = sp as uint;
287289
regs[25] = fptr as uint;
288290
regs[31] = fptr as uint;

branches/auto/src/librustc/back/mips.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,39 +22,39 @@ pub fn get_target_strs(target_triple: ~str, target_os: abi::Os) -> target_strs::
2222

2323
data_layout: match target_os {
2424
abi::OsMacos => {
25-
~"e-p:32:32:32" +
25+
~"E-p:32:32:32" +
2626
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
2727
"-f32:32:32-f64:64:64" +
2828
"-v64:64:64-v128:64:128" +
2929
"-a0:0:64-n32"
3030
}
3131

3232
abi::OsWin32 => {
33-
~"e-p:32:32:32" +
33+
~"E-p:32:32:32" +
3434
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
3535
"-f32:32:32-f64:64:64" +
3636
"-v64:64:64-v128:64:128" +
3737
"-a0:0:64-n32"
3838
}
3939

4040
abi::OsLinux => {
41-
~"e-p:32:32:32" +
41+
~"E-p:32:32:32" +
4242
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
4343
"-f32:32:32-f64:64:64" +
4444
"-v64:64:64-v128:64:128" +
4545
"-a0:0:64-n32"
4646
}
4747

4848
abi::OsAndroid => {
49-
~"e-p:32:32:32" +
49+
~"E-p:32:32:32" +
5050
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
5151
"-f32:32:32-f64:64:64" +
5252
"-v64:64:64-v128:64:128" +
5353
"-a0:0:64-n32"
5454
}
5555

5656
abi::OsFreebsd => {
57-
~"e-p:32:32:32" +
57+
~"E-p:32:32:32" +
5858
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
5959
"-f32:32:32-f64:64:64" +
6060
"-v64:64:64-v128:64:128" +

branches/auto/src/librustc/lib.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ pub mod lib {
134134
pub mod llvmdeps;
135135
}
136136

137+
static BUG_REPORT_URL: &'static str =
138+
"http://static.rust-lang.org/doc/master/complement-bugreport.html";
139+
137140
pub fn version(argv0: &str) {
138141
let vers = match option_env!("CFG_VERSION") {
139142
Some(vers) => vers,
@@ -393,20 +396,31 @@ pub fn monitor(f: proc()) {
393396
// Task failed without emitting a fatal diagnostic
394397
if !value.is::<diagnostic::FatalError>() {
395398
let mut emitter = diagnostic::EmitterWriter::stderr();
396-
emitter.emit(
397-
None,
398-
diagnostic::ice_msg("unexpected failure"),
399-
diagnostic::Error);
399+
400+
// a .span_bug or .bug call has already printed what
401+
// it wants to print.
402+
if !value.is::<diagnostic::ExplicitBug>() {
403+
emitter.emit(
404+
None,
405+
"unexpected failure",
406+
diagnostic::Bug);
407+
}
400408

401409
let xs = [
402-
~"the compiler hit an unexpected failure path. \
403-
this is a bug",
410+
~"the compiler hit an unexpected failure path. this is a bug.",
411+
"we would appreciate a bug report: " + BUG_REPORT_URL,
412+
~"run with `RUST_LOG=std::rt::backtrace` for a backtrace",
404413
];
405414
for note in xs.iter() {
406415
emitter.emit(None, *note, diagnostic::Note)
407416
}
408417

409-
println!("{}", r.read_to_str());
418+
match r.read_to_str() {
419+
Ok(s) => println!("{}", s),
420+
Err(e) => emitter.emit(None,
421+
format!("failed to read internal stderr: {}", e),
422+
diagnostic::Error),
423+
}
410424
}
411425

412426
// Fail so the process returns a failure code, but don't pollute the

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,13 @@ pub fn return_type_is_void(ccx: &CrateContext, ty: ty::t) -> bool {
103103
ty::type_is_nil(ty) || ty::type_is_bot(ty) || ty::type_is_empty(ccx.tcx, ty)
104104
}
105105

106+
/// Generates a unique symbol based off the name given. This is used to create
107+
/// unique symbols for things like closures.
106108
pub fn gensym_name(name: &str) -> PathElem {
107-
PathName(token::gensym(name))
109+
let num = token::gensym(name);
110+
// use one colon which will get translated to a period by the mangler, and
111+
// we're guaranteed that `num` is globally unique for this crate.
112+
PathName(token::gensym(format!("{}:{}", name, num)))
108113
}
109114

110115
pub struct tydesc_info {

branches/auto/src/librustc/middle/typeck/astconv.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -640,13 +640,11 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:RegionScope>(
640640
tcx.sess.span_bug(ast_ty.span, "typeof is reserved but unimplemented");
641641
}
642642
ast::TyInfer => {
643-
// ty_infer should only appear as the type of arguments or return
644-
// values in a fn_expr, or as the type of local variables. Both of
645-
// these cases are handled specially and should not descend into this
646-
// routine.
647-
this.tcx().sess.span_bug(
648-
ast_ty.span,
649-
"found `ty_infer` in unexpected place");
643+
// TyInfer also appears as the type of arguments or return
644+
// values in a ExprFnBlock or ExprProc, or as the type of
645+
// local variables. Both of these cases are handled specially
646+
// and will not descend into this routine.
647+
this.ty_infer(ast_ty.span)
650648
}
651649
});
652650

branches/auto/src/librustc/middle/typeck/collect.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ impl AstConv for CrateCtxt {
132132
}
133133

134134
fn ty_infer(&self, span: Span) -> ty::t {
135-
self.tcx.sess.span_bug(span, "found `ty_infer` in unexpected place");
135+
self.tcx.sess.span_err(span, "the type placeholder `_` is not \
136+
allowed within types on item signatures.");
137+
ty::mk_err()
136138
}
137139
}
138140

branches/auto/src/libstd/cmp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ pub trait Equiv<T> {
184184
}
185185

186186
#[inline]
187-
pub fn min<T:Ord>(v1: T, v2: T) -> T {
187+
pub fn min<T: TotalOrd>(v1: T, v2: T) -> T {
188188
if v1 < v2 { v1 } else { v2 }
189189
}
190190

191191
#[inline]
192-
pub fn max<T:Ord>(v1: T, v2: T) -> T {
192+
pub fn max<T: TotalOrd>(v1: T, v2: T) -> T {
193193
if v1 > v2 { v1 } else { v2 }
194194
}
195195

branches/auto/src/libstd/iter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ use cmp;
6868
use num::{Zero, One, CheckedAdd, CheckedSub, Saturating, ToPrimitive, Int};
6969
use option::{Option, Some, None};
7070
use ops::{Add, Mul, Sub};
71-
use cmp::{Eq, Ord};
71+
use cmp::{Eq, Ord, TotalOrd};
7272
use clone::Clone;
7373
use uint;
7474
use mem;
@@ -626,7 +626,7 @@ pub trait Iterator<A> {
626626
/// assert_eq!(*xs.iter().max_by(|x| x.abs()).unwrap(), -10);
627627
/// ```
628628
#[inline]
629-
fn max_by<B: Ord>(&mut self, f: |&A| -> B) -> Option<A> {
629+
fn max_by<B: TotalOrd>(&mut self, f: |&A| -> B) -> Option<A> {
630630
self.fold(None, |max: Option<(A, B)>, x| {
631631
let x_val = f(&x);
632632
match max {
@@ -650,7 +650,7 @@ pub trait Iterator<A> {
650650
/// assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0);
651651
/// ```
652652
#[inline]
653-
fn min_by<B: Ord>(&mut self, f: |&A| -> B) -> Option<A> {
653+
fn min_by<B: TotalOrd>(&mut self, f: |&A| -> B) -> Option<A> {
654654
self.fold(None, |min: Option<(A, B)>, x| {
655655
let x_val = f(&x);
656656
match min {
@@ -917,7 +917,7 @@ pub trait OrdIterator<A> {
917917
fn min_max(&mut self) -> MinMaxResult<A>;
918918
}
919919

920-
impl<A: Ord, T: Iterator<A>> OrdIterator<A> for T {
920+
impl<A: TotalOrd, T: Iterator<A>> OrdIterator<A> for T {
921921
#[inline]
922922
fn max(&mut self) -> Option<A> {
923923
self.fold(None, |max, x| {

branches/auto/src/libstd/libc.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,7 +2137,7 @@ pub mod consts {
21372137
pub static MAP_SHARED : c_int = 0x0001;
21382138
pub static MAP_PRIVATE : c_int = 0x0002;
21392139
pub static MAP_FIXED : c_int = 0x0010;
2140-
pub static MAP_ANON : c_int = 0x0020;
2140+
pub static MAP_ANON : c_int = 0x0800;
21412141

21422142
pub static MAP_FAILED : *c_void = -1 as *c_void;
21432143

@@ -2433,20 +2433,19 @@ pub mod consts {
24332433
pub static O_DSYNC : c_int = 16;
24342434
pub static O_SYNC : c_int = 16400;
24352435

2436-
pub static PROT_GROWSDOWN : c_int = 0x010000000;
2437-
pub static PROT_GROWSUP : c_int = 0x020000000;
2436+
pub static PROT_GROWSDOWN : c_int = 0x01000000;
2437+
pub static PROT_GROWSUP : c_int = 0x02000000;
24382438

24392439
pub static MAP_TYPE : c_int = 0x000f;
2440-
pub static MAP_ANONONYMOUS : c_int = 0x0020;
2441-
pub static MAP_32BIT : c_int = 0x0040;
2442-
pub static MAP_GROWSDOWN : c_int = 0x0100;
2443-
pub static MAP_DENYWRITE : c_int = 0x0800;
2444-
pub static MAP_EXECUTABLE : c_int = 0x01000;
2445-
pub static MAP_LOCKED : c_int = 0x02000;
2446-
pub static MAP_NONRESERVE : c_int = 0x04000;
2447-
pub static MAP_POPULATE : c_int = 0x08000;
2448-
pub static MAP_NONBLOCK : c_int = 0x010000;
2449-
pub static MAP_STACK : c_int = 0x020000;
2440+
pub static MAP_ANONONYMOUS : c_int = 0x0800;
2441+
pub static MAP_GROWSDOWN : c_int = 0x01000;
2442+
pub static MAP_DENYWRITE : c_int = 0x02000;
2443+
pub static MAP_EXECUTABLE : c_int = 0x04000;
2444+
pub static MAP_LOCKED : c_int = 0x08000;
2445+
pub static MAP_NONRESERVE : c_int = 0x0400;
2446+
pub static MAP_POPULATE : c_int = 0x010000;
2447+
pub static MAP_NONBLOCK : c_int = 0x020000;
2448+
pub static MAP_STACK : c_int = 0x040000;
24502449
}
24512450
#[cfg(target_os = "linux")]
24522451
pub mod sysconf {

0 commit comments

Comments
 (0)