Skip to content

Commit 3d42bab

Browse files
committed
---
yaml --- r: 194025 b: refs/heads/beta c: c48bb85 h: refs/heads/master i: 194023: 0102a9a v: v3
1 parent 22c5a44 commit 3d42bab

File tree

120 files changed

+556
-711
lines changed

Some content is hidden

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

120 files changed

+556
-711
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: d8baa010ab2257982437c06493e0cfe242dd3697
34+
refs/heads/beta: c48bb85702aaf8966b0d1c050a7152dce5ac6afa
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/src/compiletest/header.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,6 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
163163
fn ignore_target(config: &Config) -> String {
164164
format!("ignore-{}", util::get_os(&config.target))
165165
}
166-
fn ignore_architecture(config: &Config) -> String {
167-
format!("ignore-{}", util::get_arch(&config.target))
168-
}
169166
fn ignore_stage(config: &Config) -> String {
170167
format!("ignore-{}",
171168
config.stage_id.split('-').next().unwrap())
@@ -229,7 +226,6 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
229226
let val = iter_header(testfile, &mut |ln| {
230227
!parse_name_directive(ln, "ignore-test") &&
231228
!parse_name_directive(ln, &ignore_target(config)) &&
232-
!parse_name_directive(ln, &ignore_architecture(config)) &&
233229
!parse_name_directive(ln, &ignore_stage(config)) &&
234230
!(config.mode == common::Pretty && parse_name_directive(ln, "ignore-pretty")) &&
235231
!(config.target != config.host && parse_name_directive(ln, "ignore-cross-compile")) &&

branches/beta/src/compiletest/procsrv.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@
1010

1111
#![allow(deprecated)] // for old path, for dynamic_lib
1212

13-
use std::dynamic_lib::DynamicLibrary;
14-
use std::io::prelude::*;
15-
use std::old_path::Path;
1613
use std::process::{ExitStatus, Command, Child, Output, Stdio};
14+
use std::io::prelude::*;
15+
use std::dynamic_lib::DynamicLibrary;
1716

1817
fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) {
1918
// Need to be sure to put both the lib_path and the aux path in the dylib

branches/beta/src/compiletest/util.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,6 @@ const OS_TABLE: &'static [(&'static str, &'static str)] = &[
2525
("openbsd", "openbsd"),
2626
];
2727

28-
const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
29-
("i386", "x86"),
30-
("i686", "x86"),
31-
("amd64", "x86_64"),
32-
("x86_64", "x86_64"),
33-
("sparc", "sparc"),
34-
("powerpc", "powerpc"),
35-
("arm64", "aarch64"),
36-
("arm", "arm"),
37-
("aarch64", "aarch64"),
38-
("mips", "mips"),
39-
("xcore", "xcore"),
40-
("msp430", "msp430"),
41-
("hexagon", "hexagon"),
42-
("s390x", "systemz"),
43-
];
44-
4528
pub fn get_os(triple: &str) -> &'static str {
4629
for &(triple_os, os) in OS_TABLE {
4730
if triple.contains(triple_os) {
@@ -50,14 +33,6 @@ pub fn get_os(triple: &str) -> &'static str {
5033
}
5134
panic!("Cannot determine OS from triple");
5235
}
53-
pub fn get_arch(triple: &str) -> &'static str {
54-
for &(triple_arch, arch) in ARCH_TABLE {
55-
if triple.contains(triple_arch) {
56-
return arch
57-
}
58-
}
59-
panic!("Cannot determine Architecture from triple");
60-
}
6136

6237
pub fn make_new_path(path: &str) -> String {
6338
assert!(cfg!(windows));

branches/beta/src/libcollections/btree/map.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use core::default::Default;
2424
use core::fmt::Debug;
2525
use core::hash::{Hash, Hasher};
2626
use core::iter::{Map, FromIterator, IntoIterator};
27-
use core::ops::{Index};
27+
use core::ops::{Index, IndexMut};
2828
use core::{iter, fmt, mem, usize};
2929
use Bound::{self, Included, Excluded, Unbounded};
3030

@@ -925,6 +925,15 @@ impl<K: Ord, Q: ?Sized, V> Index<Q> for BTreeMap<K, V>
925925
}
926926
}
927927

928+
#[stable(feature = "rust1", since = "1.0.0")]
929+
impl<K: Ord, Q: ?Sized, V> IndexMut<Q> for BTreeMap<K, V>
930+
where K: Borrow<Q>, Q: Ord
931+
{
932+
fn index_mut(&mut self, key: &Q) -> &mut V {
933+
self.get_mut(key).expect("no entry found for key")
934+
}
935+
}
936+
928937
/// Genericises over how to get the correct type of iterator from the correct type
929938
/// of Node ownership.
930939
trait Traverse<N> {

branches/beta/src/libcollections/fmt.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@
262262
//!
263263
//! ```
264264
//! # #![allow(unused_must_use)]
265-
//! use std::io::Write;
266265
//! let mut w = Vec::new();
267266
//! write!(&mut w, "Hello {}!", "world");
268267
//! ```
@@ -289,15 +288,15 @@
289288
//!
290289
//! ```
291290
//! use std::fmt;
292-
//! use std::io::{self, Write};
291+
//! use std::old_io;
293292
//!
294293
//! fmt::format(format_args!("this returns {}", "String"));
295294
//!
296-
//! let mut some_writer = io::stdout();
295+
//! let mut some_writer = old_io::stdout();
297296
//! write!(&mut some_writer, "{}", format_args!("print with a {}", "macro"));
298297
//!
299298
//! fn my_fmt_fn(args: fmt::Arguments) {
300-
//! write!(&mut io::stdout(), "{}", args);
299+
//! write!(&mut old_io::stdout(), "{}", args);
301300
//! }
302301
//! my_fmt_fn(format_args!("or a {} too", "function"));
303302
//! ```

branches/beta/src/libcore/macros.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ macro_rules! try {
176176
///
177177
/// ```
178178
/// # #![allow(unused_must_use)]
179-
/// use std::io::Write;
180179
///
181180
/// let mut w = Vec::new();
182181
/// write!(&mut w, "test");

branches/beta/src/libcore/prelude.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ pub use marker::{Copy, Send, Sized, Sync};
2929
pub use ops::{Drop, Fn, FnMut, FnOnce};
3030

3131
// Reexported functions
32+
#[allow(deprecated)]
33+
pub use iter::range;
3234
pub use mem::drop;
3335

3436
// Reexported types and traits

branches/beta/src/libcore/result.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
//! let bad_result: Result<int, int> = bad_result.or_else(|i| Ok(11));
7979
//!
8080
//! // Consume the result and return the contents with `unwrap`.
81-
//! let final_awesome_result = good_result.unwrap();
81+
//! let final_awesome_result = good_result.ok().unwrap();
8282
//! ```
8383
//!
8484
//! # Results must be used
@@ -110,8 +110,7 @@
110110
//! something like this:
111111
//!
112112
//! ```{.ignore}
113-
//! use std::old_io::*;
114-
//! use std::old_path::Path;
113+
//! use std::old_io::{File, Open, Write};
115114
//!
116115
//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
117116
//! // If `write_line` errors, then we'll never know, because the return
@@ -129,8 +128,7 @@
129128
//! a marginally useful message indicating why:
130129
//!
131130
//! ```{.no_run}
132-
//! use std::old_io::*;
133-
//! use std::old_path::Path;
131+
//! use std::old_io::{File, Open, Write};
134132
//!
135133
//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
136134
//! file.write_line("important message").ok().expect("failed to write message");
@@ -140,8 +138,7 @@
140138
//! You might also simply assert success:
141139
//!
142140
//! ```{.no_run}
143-
//! # use std::old_io::*;
144-
//! # use std::old_path::Path;
141+
//! # use std::old_io::{File, Open, Write};
145142
//!
146143
//! # let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
147144
//! assert!(file.write_line("important message").is_ok());
@@ -151,8 +148,7 @@
151148
//! Or propagate the error up the call stack with `try!`:
152149
//!
153150
//! ```
154-
//! # use std::old_io::*;
155-
//! # use std::old_path::Path;
151+
//! # use std::old_io::{File, Open, Write, IoError};
156152
//! fn write_message() -> Result<(), IoError> {
157153
//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
158154
//! try!(file.write_line("important message"));
@@ -171,8 +167,7 @@
171167
//! It replaces this:
172168
//!
173169
//! ```
174-
//! use std::old_io::*;
175-
//! use std::old_path::Path;
170+
//! use std::old_io::{File, Open, Write, IoError};
176171
//!
177172
//! struct Info {
178173
//! name: String,
@@ -196,8 +191,7 @@
196191
//! With this:
197192
//!
198193
//! ```
199-
//! use std::old_io::*;
200-
//! use std::old_path::Path;
194+
//! use std::old_io::{File, Open, Write, IoError};
201195
//!
202196
//! struct Info {
203197
//! name: String,
@@ -452,7 +446,7 @@ impl<T, E> Result<T, E> {
452446
/// ignoring I/O and parse errors:
453447
///
454448
/// ```
455-
/// use std::old_io::*;
449+
/// use std::old_io::IoResult;
456450
///
457451
/// let mut buffer: &[u8] = b"1\n2\n3\n4\n";
458452
/// let mut buffer = &mut buffer;
@@ -466,7 +460,7 @@ impl<T, E> Result<T, E> {
466460
/// line.trim_right().parse::<int>().unwrap_or(0)
467461
/// });
468462
/// // Add the value if there were no errors, otherwise add 0
469-
/// sum += val.unwrap_or(0);
463+
/// sum += val.ok().unwrap_or(0);
470464
/// }
471465
///
472466
/// assert!(sum == 10);

branches/beta/src/libcoretest/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn test_bool_from_str() {
3535
fn check_contains_all_substrings(s: &str) {
3636
assert!(s.contains(""));
3737
for i in 0..s.len() {
38-
for j in i+1..s.len() + 1 {
38+
for j in range(i+1, s.len() + 1) {
3939
assert!(s.contains(&s[i..j]));
4040
}
4141
}

branches/beta/src/liblog/lib.rs

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,10 @@ use std::io::{self, Stderr};
183183
use std::io::prelude::*;
184184
use std::mem;
185185
use std::env;
186+
use std::ptr;
186187
use std::rt;
187188
use std::slice;
188-
use std::sync::{Once, ONCE_INIT, StaticMutex, MUTEX_INIT};
189+
use std::sync::{Once, ONCE_INIT};
189190

190191
use directive::LOG_LEVEL_NAMES;
191192

@@ -201,8 +202,6 @@ pub const MAX_LOG_LEVEL: u32 = 255;
201202
/// The default logging level of a crate if no other is specified.
202203
const DEFAULT_LOG_LEVEL: u32 = 1;
203204

204-
static LOCK: StaticMutex = MUTEX_INIT;
205-
206205
/// An unsafe constant that is the maximum logging level of any module
207206
/// specified. This is the first line of defense to determining whether a
208207
/// logging statement should be run.
@@ -287,18 +286,9 @@ impl Drop for DefaultLogger {
287286
pub fn log(level: u32, loc: &'static LogLocation, args: fmt::Arguments) {
288287
// Test the literal string from args against the current filter, if there
289288
// is one.
290-
unsafe {
291-
let _g = LOCK.lock();
292-
match FILTER as uint {
293-
0 => {}
294-
1 => panic!("cannot log after main thread has exited"),
295-
n => {
296-
let filter = mem::transmute::<_, &String>(n);
297-
if !args.to_string().contains(&filter[..]) {
298-
return
299-
}
300-
}
301-
}
289+
match unsafe { FILTER.as_ref() } {
290+
Some(filter) if !args.to_string().contains(&filter[..]) => return,
291+
_ => {}
302292
}
303293

304294
// Completely remove the local logger from TLS in case anyone attempts to
@@ -380,15 +370,9 @@ pub fn mod_enabled(level: u32, module: &str) -> bool {
380370

381371
// This assertion should never get tripped unless we're in an at_exit
382372
// handler after logging has been torn down and a logging attempt was made.
373+
assert!(unsafe { !DIRECTIVES.is_null() });
383374

384-
let _g = LOCK.lock();
385-
unsafe {
386-
assert!(DIRECTIVES as uint != 0);
387-
assert!(DIRECTIVES as uint != 1,
388-
"cannot log after the main thread has exited");
389-
390-
enabled(level, module, (*DIRECTIVES).iter())
391-
}
375+
enabled(level, module, unsafe { (*DIRECTIVES).iter() })
392376
}
393377

394378
fn enabled(level: u32,
@@ -444,14 +428,14 @@ fn init() {
444428

445429
// Schedule the cleanup for the globals for when the runtime exits.
446430
rt::at_exit(move || {
447-
let _g = LOCK.lock();
448431
assert!(!DIRECTIVES.is_null());
449-
let _directives = Box::from_raw(DIRECTIVES);
450-
DIRECTIVES = 1 as *mut _;
432+
let _directives: Box<Vec<directive::LogDirective>> =
433+
Box::from_raw(DIRECTIVES);
434+
DIRECTIVES = ptr::null_mut();
451435

452436
if !FILTER.is_null() {
453-
let _filter = Box::from_raw(FILTER);
454-
FILTER = 1 as *mut _;
437+
let _filter: Box<String> = Box::from_raw(FILTER);
438+
FILTER = 0 as *mut _;
455439
}
456440
});
457441
}

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ use std::io::SeekFrom;
4343
use std::io::prelude::*;
4444
use std::num::FromPrimitive;
4545
use std::rc::Rc;
46-
use std::fmt::Debug;
4746

4847
use rbml::reader;
4948
use rbml::writer::Encoder;
@@ -314,11 +313,9 @@ trait def_id_encoder_helpers {
314313
fn emit_def_id(&mut self, did: ast::DefId);
315314
}
316315

317-
impl<S:serialize::Encoder> def_id_encoder_helpers for S
318-
where <S as serialize::serialize::Encoder>::Error: Debug
319-
{
316+
impl<S:serialize::Encoder> def_id_encoder_helpers for S {
320317
fn emit_def_id(&mut self, did: ast::DefId) {
321-
did.encode(self).unwrap()
318+
did.encode(self).ok().unwrap()
322319
}
323320
}
324321

@@ -328,18 +325,15 @@ trait def_id_decoder_helpers {
328325
cdata: &cstore::crate_metadata) -> ast::DefId;
329326
}
330327

331-
impl<D:serialize::Decoder> def_id_decoder_helpers for D
332-
where <D as serialize::serialize::Decoder>::Error: Debug
333-
{
328+
impl<D:serialize::Decoder> def_id_decoder_helpers for D {
334329
fn read_def_id(&mut self, dcx: &DecodeContext) -> ast::DefId {
335-
let did: ast::DefId = Decodable::decode(self).unwrap();
330+
let did: ast::DefId = Decodable::decode(self).ok().unwrap();
336331
did.tr(dcx)
337332
}
338333

339334
fn read_def_id_nodcx(&mut self,
340-
cdata: &cstore::crate_metadata)
341-
-> ast::DefId {
342-
let did: ast::DefId = Decodable::decode(self).unwrap();
335+
cdata: &cstore::crate_metadata) -> ast::DefId {
336+
let did: ast::DefId = Decodable::decode(self).ok().unwrap();
343337
decoder::translate_def_id(cdata, did)
344338
}
345339
}
@@ -1790,7 +1784,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
17901784
fn read_closure_kind<'b, 'c>(&mut self, _dcx: &DecodeContext<'b, 'c, 'tcx>)
17911785
-> ty::ClosureKind
17921786
{
1793-
Decodable::decode(self).unwrap()
1787+
Decodable::decode(self).ok().unwrap()
17941788
}
17951789

17961790
fn read_closure_ty<'b, 'c>(&mut self, dcx: &DecodeContext<'b, 'c, 'tcx>)

branches/beta/src/librustc/middle/cfg/graphviz.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ fn replace_newline_with_backslash_l(s: String) -> String {
5454
}
5555

5656
impl<'a, 'ast> dot::Labeller<'a, Node<'a>, Edge<'a>> for LabelledCFG<'a, 'ast> {
57-
fn graph_id(&'a self) -> dot::Id<'a> { dot::Id::new(&self.name[..]).unwrap() }
57+
fn graph_id(&'a self) -> dot::Id<'a> { dot::Id::new(&self.name[..]).ok().unwrap() }
5858

5959
fn node_id(&'a self, &(i,_): &Node<'a>) -> dot::Id<'a> {
60-
dot::Id::new(format!("N{}", i.node_id())).unwrap()
60+
dot::Id::new(format!("N{}", i.node_id())).ok().unwrap()
6161
}
6262

6363
fn node_label(&'a self, &(i, n): &Node<'a>) -> dot::LabelText<'a> {

0 commit comments

Comments
 (0)