Skip to content

Commit 2721c00

Browse files
committed
---
yaml --- r: 105915 b: refs/heads/auto c: 6cbba7c h: refs/heads/master i: 105913: 321b284 105911: 3c718a6 v: v3
1 parent 6447532 commit 2721c00

File tree

25 files changed

+190
-133
lines changed

25 files changed

+190
-133
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: 9ba6bb5a71adeb861f8bf21c2b1f2fde3132480d
16+
refs/heads/auto: 6cbba7c54e4e1e02d4ff3ffacf46d15d0f3a039c
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/compiletest/compiletest.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@ pub fn opt_str2(maybestr: Option<~str>) -> ~str {
191191
}
192192

193193
pub fn str_mode(s: ~str) -> mode {
194-
match s {
195-
~"compile-fail" => mode_compile_fail,
196-
~"run-fail" => mode_run_fail,
197-
~"run-pass" => mode_run_pass,
198-
~"pretty" => mode_pretty,
199-
~"debug-info" => mode_debug_info,
200-
~"codegen" => mode_codegen,
194+
match s.as_slice() {
195+
"compile-fail" => mode_compile_fail,
196+
"run-fail" => mode_run_fail,
197+
"run-pass" => mode_run_pass,
198+
"pretty" => mode_pretty,
199+
"debug-info" => mode_debug_info,
200+
"codegen" => mode_codegen,
201201
_ => fail!("invalid mode")
202202
}
203203
}

branches/auto/src/compiletest/runtest.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ use test::MetricMap;
3838

3939
pub fn run(config: config, testfile: ~str) {
4040

41-
match config.target {
41+
match config.target.as_slice() {
4242

43-
~"arm-linux-androideabi" => {
43+
"arm-linux-androideabi" => {
4444
if !config.adb_device_status {
4545
fail!("android device not available");
4646
}
@@ -277,8 +277,8 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
277277
let exe_file = make_exe_name(config, testfile);
278278
279279
let mut proc_args;
280-
match config.target {
281-
~"arm-linux-androideabi" => {
280+
match config.target.as_slice() {
281+
"arm-linux-androideabi" => {
282282

283283
cmds = cmds.replace("run","continue");
284284

@@ -682,9 +682,9 @@ fn exec_compiled_test(config: &config, props: &TestProps,
682682

683683
let env = props.exec_env.clone();
684684

685-
match config.target {
685+
match config.target.as_slice() {
686686

687-
~"arm-linux-androideabi" => {
687+
"arm-linux-androideabi" => {
688688
_arm_exec_compiled_test(config, props, testfile, env)
689689
}
690690

@@ -735,9 +735,9 @@ fn compose_and_run_compiler(
735735
&auxres);
736736
}
737737

738-
match config.target {
738+
match config.target.as_slice() {
739739

740-
~"arm-linux-androideabi" => {
740+
"arm-linux-androideabi" => {
741741
_arm_push_aux_shared_library(config, testfile);
742742
}
743743

branches/auto/src/librustc/driver/driver.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,6 @@ pub fn build_session_options(matches: &getopts::Matches)
880880
}
881881
};
882882
let gc = debugging_opts & session::GC != 0;
883-
884883
let debuginfo = if matches.opt_present("g") {
885884
if matches.opt_present("debuginfo") {
886885
early_error("-g and --debuginfo both provided");

branches/auto/src/librustdoc/clean.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl Item {
137137
pub fn doc_list<'a>(&'a self) -> Option<&'a [Attribute]> {
138138
for attr in self.attrs.iter() {
139139
match *attr {
140-
List(~"doc", ref list) => { return Some(list.as_slice()); }
140+
List(ref x, ref list) if "doc" == *x => { return Some(list.as_slice()); }
141141
_ => {}
142142
}
143143
}
@@ -149,7 +149,7 @@ impl Item {
149149
pub fn doc_value<'a>(&'a self) -> Option<&'a str> {
150150
for attr in self.attrs.iter() {
151151
match *attr {
152-
NameValue(~"doc", ref v) => { return Some(v.as_slice()); }
152+
NameValue(ref x, ref v) if "doc" == *x => { return Some(v.as_slice()); }
153153
_ => {}
154154
}
155155
}

branches/auto/src/librustdoc/html/format.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ impl fmt::Show for clean::Type {
357357
write!(f.buf, "{}{}fn{}{}",
358358
PuritySpace(decl.purity),
359359
match decl.abi {
360-
~"" | ~"\"Rust\"" => ~"",
360+
ref x if "" == *x => ~"",
361+
ref x if "\"Rust\"" == *x => ~"",
361362
ref s => " " + *s + " ",
362363
},
363364
decl.generics,

branches/auto/src/librustdoc/html/render.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,13 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> {
225225
Some(attrs) => {
226226
for attr in attrs.iter() {
227227
match *attr {
228-
clean::NameValue(~"html_favicon_url", ref s) => {
228+
clean::NameValue(ref x, ref s) if "html_favicon_url" == *x => {
229229
cx.layout.favicon = s.to_owned();
230230
}
231-
clean::NameValue(~"html_logo_url", ref s) => {
231+
clean::NameValue(ref x, ref s) if "html_logo_url" == *x => {
232232
cx.layout.logo = s.to_owned();
233233
}
234-
clean::Word(~"html_no_source") => {
234+
clean::Word(ref x) if "html_no_source" == *x => {
235235
cx.include_sources = false;
236236
}
237237
_ => {}
@@ -396,10 +396,10 @@ fn extern_location(e: &clean::ExternalCrate, dst: &Path) -> ExternalLocation {
396396
// external crate
397397
for attr in e.attrs.iter() {
398398
match *attr {
399-
clean::List(~"doc", ref list) => {
399+
clean::List(ref x, ref list) if "doc" == *x => {
400400
for attr in list.iter() {
401401
match *attr {
402-
clean::NameValue(~"html_root_url", ref s) => {
402+
clean::NameValue(ref x, ref s) if "html_root_url" == *x => {
403403
if s.ends_with("/") {
404404
return Remote(s.to_owned());
405405
}
@@ -666,7 +666,7 @@ impl DocFolder for Cache {
666666
// extract relevant documentation for this impl
667667
match attrs.move_iter().find(|a| {
668668
match *a {
669-
clean::NameValue(~"doc", _) => true,
669+
clean::NameValue(ref x, _) if "doc" == *x => true,
670670
_ => false
671671
}
672672
}) {

branches/auto/src/librustdoc/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,14 @@ pub fn main_args(args: &[~str]) -> int {
195195

196196
info!("going to format");
197197
let started = time::precise_time_ns();
198-
match matches.opt_str("w") {
199-
Some(~"html") | None => {
198+
match matches.opt_str("w").as_ref().map(|s| s.as_slice()) {
199+
Some("html") | None => {
200200
match html::render::run(krate, output.unwrap_or(Path::new("doc"))) {
201201
Ok(()) => {}
202202
Err(e) => fail!("failed to generate documentation: {}", e),
203203
}
204204
}
205-
Some(~"json") => {
205+
Some("json") => {
206206
match json_output(krate, res, output.unwrap_or(Path::new("doc.json"))) {
207207
Ok(()) => {}
208208
Err(e) => fail!("failed to write json: {}", e),
@@ -223,9 +223,9 @@ pub fn main_args(args: &[~str]) -> int {
223223
/// and files and then generates the necessary rustdoc output for formatting.
224224
fn acquire_input(input: &str,
225225
matches: &getopts::Matches) -> Result<Output, ~str> {
226-
match matches.opt_str("r") {
227-
Some(~"rust") => Ok(rust_input(input, matches)),
228-
Some(~"json") => json_input(input),
226+
match matches.opt_str("r").as_ref().map(|s| s.as_slice()) {
227+
Some("rust") => Ok(rust_input(input, matches)),
228+
Some("json") => json_input(input),
229229
Some(s) => Err("unknown input format: " + s),
230230
None => {
231231
if input.ends_with(".json") {
@@ -265,15 +265,15 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
265265
Some(nested) => {
266266
for inner in nested.iter() {
267267
match *inner {
268-
clean::Word(~"no_default_passes") => {
268+
clean::Word(ref x) if "no_default_passes" == *x => {
269269
default_passes = false;
270270
}
271-
clean::NameValue(~"passes", ref value) => {
271+
clean::NameValue(ref x, ref value) if "passes" == *x => {
272272
for pass in value.words() {
273273
passes.push(pass.to_owned());
274274
}
275275
}
276-
clean::NameValue(~"plugins", ref value) => {
276+
clean::NameValue(ref x, ref value) if "plugins" == *x => {
277277
for p in value.words() {
278278
plugins.push(p.to_owned());
279279
}

branches/auto/src/librustdoc/passes.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub fn strip_hidden(krate: clean::Crate) -> plugins::PluginResult {
3434
fn fold_item(&mut self, i: Item) -> Option<Item> {
3535
for attr in i.attrs.iter() {
3636
match attr {
37-
&clean::List(~"doc", ref l) => {
37+
&clean::List(ref x, ref l) if "doc" == *x => {
3838
for innerattr in l.iter() {
3939
match innerattr {
4040
&clean::Word(ref s) if "hidden" == *s => {
@@ -223,7 +223,7 @@ pub fn unindent_comments(krate: clean::Crate) -> plugins::PluginResult {
223223
let mut avec: ~[clean::Attribute] = ~[];
224224
for attr in i.attrs.iter() {
225225
match attr {
226-
&clean::NameValue(~"doc", ref s) => avec.push(
226+
&clean::NameValue(ref x, ref s) if "doc" == *x => avec.push(
227227
clean::NameValue(~"doc", unindent(*s))),
228228
x => avec.push(x.clone())
229229
}
@@ -245,15 +245,15 @@ pub fn collapse_docs(krate: clean::Crate) -> plugins::PluginResult {
245245
let mut i = i;
246246
for attr in i.attrs.iter() {
247247
match *attr {
248-
clean::NameValue(~"doc", ref s) => {
248+
clean::NameValue(ref x, ref s) if "doc" == *x => {
249249
docstr.push_str(s.clone());
250250
docstr.push_char('\n');
251251
},
252252
_ => ()
253253
}
254254
}
255255
let mut a: ~[clean::Attribute] = i.attrs.iter().filter(|&a| match a {
256-
&clean::NameValue(~"doc", _) => false,
256+
&clean::NameValue(ref x, _) if "doc" == *x => false,
257257
_ => true
258258
}).map(|x| x.clone()).collect();
259259
if "" != docstr {

branches/auto/src/librustuv/tty.rs

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

11-
use std::libc;
1211
use std::io::IoError;
12+
use std::libc;
13+
use std::ptr;
1314
use std::rt::rtio::RtioTTY;
1415

1516
use homing::{HomingIO, HomeHandle};
@@ -54,20 +55,24 @@ impl TtyWatcher {
5455
// If this file descriptor is indeed guessed to be a tty, then go ahead
5556
// with attempting to open it as a tty.
5657
let handle = UvHandle::alloc(None::<TtyWatcher>, uvll::UV_TTY);
58+
let mut watcher = TtyWatcher {
59+
tty: handle,
60+
stream: StreamWatcher::new(handle),
61+
home: io.make_handle(),
62+
fd: fd,
63+
};
5764
match unsafe {
5865
uvll::uv_tty_init(io.uv_loop(), handle, fd as libc::c_int,
5966
readable as libc::c_int)
6067
} {
61-
0 => {
62-
Ok(TtyWatcher {
63-
tty: handle,
64-
stream: StreamWatcher::new(handle),
65-
home: io.make_handle(),
66-
fd: fd,
67-
})
68-
}
68+
0 => Ok(watcher),
6969
n => {
70-
unsafe { uvll::free_handle(handle) }
70+
// On windows, libuv returns errors before initializing the
71+
// handle, so our only cleanup is to free the handle itself
72+
if cfg!(windows) {
73+
unsafe { uvll::free_handle(handle); }
74+
watcher.tty = ptr::null();
75+
}
7176
Err(UvError(n))
7277
}
7378
}
@@ -124,7 +129,9 @@ impl HomingIO for TtyWatcher {
124129

125130
impl Drop for TtyWatcher {
126131
fn drop(&mut self) {
127-
let _m = self.fire_homing_missile();
128-
self.close_async_();
132+
if !self.tty.is_null() {
133+
let _m = self.fire_homing_missile();
134+
self.close_async_();
135+
}
129136
}
130137
}

branches/auto/src/libserialize/serialize.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
Core encoding and decoding interfaces.
1515
*/
1616

17+
use std::path;
1718
use std::rc::Rc;
1819
use std::vec;
1920
use std::vec_ng::Vec;
@@ -625,6 +626,32 @@ impl<
625626
}
626627
}
627628

629+
impl<E: Encoder> Encodable<E> for path::posix::Path {
630+
fn encode(&self, e: &mut E) {
631+
self.as_vec().encode(e)
632+
}
633+
}
634+
635+
impl<D: Decoder> Decodable<D> for path::posix::Path {
636+
fn decode(d: &mut D) -> path::posix::Path {
637+
let bytes: ~[u8] = Decodable::decode(d);
638+
path::posix::Path::new(bytes)
639+
}
640+
}
641+
642+
impl<E: Encoder> Encodable<E> for path::windows::Path {
643+
fn encode(&self, e: &mut E) {
644+
self.as_vec().encode(e)
645+
}
646+
}
647+
648+
impl<D: Decoder> Decodable<D> for path::windows::Path {
649+
fn decode(d: &mut D) -> path::windows::Path {
650+
let bytes: ~[u8] = Decodable::decode(d);
651+
path::windows::Path::new(bytes)
652+
}
653+
}
654+
628655
// ___________________________________________________________________________
629656
// Helper routines
630657
//

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ pub enum FileAccess {
13221322
}
13231323

13241324
/// Different kinds of files which can be identified by a call to stat
1325-
#[deriving(Eq, Show)]
1325+
#[deriving(Eq, Show, Hash)]
13261326
pub enum FileType {
13271327
/// This is a normal file, corresponding to `S_IFREG`
13281328
TypeFile,
@@ -1360,6 +1360,7 @@ pub enum FileType {
13601360
/// println!("byte size: {}", info.size);
13611361
/// # }
13621362
/// ```
1363+
#[deriving(Hash)]
13631364
pub struct FileStat {
13641365
/// The path that this stat structure is describing
13651366
path: Path,
@@ -1401,6 +1402,7 @@ pub struct FileStat {
14011402
/// have different meanings or no meaning at all on some platforms.
14021403
#[unstable]
14031404
#[allow(missing_doc)]
1405+
#[deriving(Hash)]
14041406
pub struct UnstableFileStat {
14051407
device: u64,
14061408
inode: u64,

branches/auto/src/libstd/local_data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ mod tests {
398398
}
399399
});
400400
modify(my_key, |data| {
401-
match data {
402-
Some(~"first data") => Some(~"next data"),
401+
match data.as_ref().map(|s| s.as_slice()) {
402+
Some("first data") => Some(~"next data"),
403403
Some(ref val) => fail!("wrong value: {}", *val),
404404
None => fail!("missing value")
405405
}

branches/auto/src/libstd/path/posix.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ impl ToCStr for Path {
8888
}
8989
}
9090

91-
impl<H: Writer> ::hash::Hash<H> for Path {
91+
impl<S: Writer> ::hash::Hash<S> for Path {
9292
#[inline]
93-
fn hash(&self, hasher: &mut H) {
94-
self.repr.hash(hasher)
93+
fn hash(&self, state: &mut S) {
94+
self.repr.hash(state)
9595
}
9696
}
9797

branches/auto/src/libstd/path/windows.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ impl ToCStr for Path {
112112
}
113113
}
114114

115-
impl<H: Writer> ::hash::Hash<H> for Path {
115+
impl<S: Writer> ::hash::Hash<S> for Path {
116116
#[inline]
117-
fn hash(&self, hasher: &mut H) {
118-
self.repr.hash(hasher)
117+
fn hash(&self, state: &mut S) {
118+
self.repr.hash(state)
119119
}
120120
}
121121

0 commit comments

Comments
 (0)