Skip to content

Commit b252544

Browse files
committed
---
yaml --- r: 145172 b: refs/heads/try2 c: edf20cc h: refs/heads/master v: v3
1 parent 4ddb94c commit b252544

File tree

28 files changed

+354
-536
lines changed

28 files changed

+354
-536
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: d5e9033a0d380fefb5610c97ff1048c809251bba
8+
refs/heads/try2: edf20ccc1b28a17c5acd1442f6341eb21015a8ea
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/tutorial-tasks.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ concurrency at this writing:
4747

4848
* [`std::task`] - All code relating to tasks and task scheduling,
4949
* [`std::comm`] - The message passing interface,
50-
* [`extra::comm`] - Additional messaging types based on `std::comm`,
50+
* [`std::pipes`] - The underlying messaging infrastructure,
51+
* [`extra::comm`] - Additional messaging types based on `std::pipes`,
5152
* [`extra::sync`] - More exotic synchronization tools, including locks,
5253
* [`extra::arc`] - The Arc (atomically reference counted) type,
5354
for safely sharing immutable data,
5455
* [`extra::future`] - A type representing values that may be computed concurrently and retrieved at a later time.
5556

5657
[`std::task`]: std/task.html
5758
[`std::comm`]: std/comm.html
59+
[`std::pipes`]: std/pipes.html
5860
[`extra::comm`]: extra/comm.html
5961
[`extra::sync`]: extra/sync.html
6062
[`extra::arc`]: extra/arc.html
@@ -123,7 +125,7 @@ receiving messages. Pipes are low-level communication building-blocks and so
123125
come in a variety of forms, each one appropriate for a different use case. In
124126
what follows, we cover the most commonly used varieties.
125127

126-
The simplest way to create a pipe is to use the `comm::stream`
128+
The simplest way to create a pipe is to use the `pipes::stream`
127129
function to create a `(Port, Chan)` pair. In Rust parlance, a *channel*
128130
is a sending endpoint of a pipe, and a *port* is the receiving
129131
endpoint. Consider the following example of calculating two results

branches/try2/src/libextra/fileinput.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ mod test {
433433
}
434434

435435
#[test]
436+
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
436437
fn test_make_path_option_vec() {
437438
let strs = [~"some/path",
438439
~"some/other/path"];
@@ -447,6 +448,7 @@ mod test {
447448
}
448449
449450
#[test]
451+
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
450452
fn test_fileinput_read_byte() {
451453
let filenames = make_path_option_vec(vec::from_fn(
452454
3,
@@ -477,6 +479,7 @@ mod test {
477479
}
478480
479481
#[test]
482+
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
480483
fn test_fileinput_read() {
481484
let filenames = make_path_option_vec(vec::from_fn(
482485
3,
@@ -497,6 +500,7 @@ mod test {
497500
}
498501

499502
#[test]
503+
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
500504
fn test_input_vec() {
501505
let mut all_lines = ~[];
502506
let filenames = make_path_option_vec(vec::from_fn(
@@ -520,6 +524,7 @@ mod test {
520524
}
521525

522526
#[test]
527+
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
523528
fn test_input_vec_state() {
524529
let filenames = make_path_option_vec(vec::from_fn(
525530
3,
@@ -542,6 +547,7 @@ mod test {
542547
}
543548

544549
#[test]
550+
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
545551
fn test_empty_files() {
546552
let filenames = make_path_option_vec(vec::from_fn(
547553
3,
@@ -566,6 +572,7 @@ mod test {
566572
}
567573
568574
#[test]
575+
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
569576
fn test_no_trailing_newline() {
570577
let f1 =
571578
Some(Path("tmp/lib-fileinput-test-no-trailing-newline-1.tmp"));
@@ -591,6 +598,7 @@ mod test {
591598
592599
593600
#[test]
601+
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
594602
fn test_next_file() {
595603
let filenames = make_path_option_vec(vec::from_fn(
596604
3,
@@ -622,6 +630,7 @@ mod test {
622630
623631
#[test]
624632
#[should_fail]
633+
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
625634
fn test_input_vec_missing_file() {
626635
do input_vec(make_path_option_vec([~"this/file/doesnt/exist"], true)) |line| {
627636
println(line);

branches/try2/src/libextra/json.rs

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -135,21 +135,18 @@ impl serialize::Encoder for Encoder {
135135
_id: uint,
136136
cnt: uint,
137137
f: &fn(&mut Encoder)) {
138-
// enums are encoded as strings or objects
138+
// enums are encoded as strings or vectors:
139139
// Bunny => "Bunny"
140-
// Kangaroo(34,"William") => {"variant": "Kangaroo", "fields": [34,"William"]}
140+
// Kangaroo(34,"William") => ["Kangaroo",[34,"William"]]
141+
141142
if cnt == 0 {
142143
self.wr.write_str(escape_str(name));
143144
} else {
144-
self.wr.write_char('{');
145-
self.wr.write_str("\"variant\"");
146-
self.wr.write_char(':');
145+
self.wr.write_char('[');
147146
self.wr.write_str(escape_str(name));
148147
self.wr.write_char(',');
149-
self.wr.write_str("\"fields\"");
150-
self.wr.write_str(":[");
151148
f(self);
152-
self.wr.write_str("]}");
149+
self.wr.write_char(']');
153150
}
154151
}
155152

@@ -950,20 +947,14 @@ impl serialize::Decoder for Decoder {
950947
debug!("read_enum_variant(names=%?)", names);
951948
let name = match self.stack.pop() {
952949
String(s) => s,
953-
Object(o) => {
954-
let n = match o.find(&~"variant").expect("invalidly encoded json") {
955-
&String(ref s) => s.clone(),
956-
_ => fail!("invalidly encoded json"),
957-
};
958-
match o.find(&~"fields").expect("invalidly encoded json") {
959-
&List(ref l) => {
960-
for field in l.rev_iter() {
961-
self.stack.push(field.clone());
962-
}
963-
},
964-
_ => fail!("invalidly encoded json")
950+
List(list) => {
951+
for v in list.move_rev_iter() {
952+
self.stack.push(v);
953+
}
954+
match self.stack.pop() {
955+
String(s) => s,
956+
value => fail!("invalid variant name: %?", value),
965957
}
966-
n
967958
}
968959
ref json => fail!("invalid variant: %?", *json),
969960
};
@@ -1526,7 +1517,7 @@ mod tests {
15261517
let mut encoder = Encoder(wr);
15271518
animal.encode(&mut encoder);
15281519
},
1529-
~"{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}"
1520+
~"[\"Frog\",\"Henry\",349]"
15301521
);
15311522
assert_eq!(
15321523
do io::with_str_writer |wr| {
@@ -1930,14 +1921,14 @@ mod tests {
19301921
assert_eq!(value, Dog);
19311922

19321923
let mut decoder =
1933-
Decoder(from_str("{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}").unwrap());
1924+
Decoder(from_str("[\"Frog\",\"Henry\",349]").unwrap());
19341925
let value: Animal = Decodable::decode(&mut decoder);
19351926
assert_eq!(value, Frog(~"Henry", 349));
19361927
}
19371928
19381929
#[test]
19391930
fn test_decode_map() {
1940-
let s = ~"{\"a\": \"Dog\", \"b\": {\"variant\":\"Frog\",\"fields\":[\"Henry\", 349]}}";
1931+
let s = ~"{\"a\": \"Dog\", \"b\": [\"Frog\", \"Henry\", 349]}";
19411932
let mut decoder = Decoder(from_str(s).unwrap());
19421933
let mut map: TreeMap<~str, Animal> = Decodable::decode(&mut decoder);
19431934

branches/try2/src/libextra/workcache.rs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -496,23 +496,16 @@ fn test() {
496496
use std::io::WriterUtil;
497497
use std::{os, run};
498498

499-
// Create a path to a new file 'filename' in the directory in which
500-
// this test is running.
501-
fn make_path(filename: ~str) -> Path {
502-
let pth = os::self_exe_path().expect("workcache::test failed").pop().push(filename);
503-
if os::path_exists(&pth) {
504-
os::remove_file(&pth);
505-
}
506-
return pth;
507-
}
508-
509-
let pth = make_path(~"foo.c");
499+
let pth = Path("foo.c");
510500
{
511501
let r = io::file_writer(&pth, [io::Create]);
512502
r.unwrap().write_str("int main() { return 0; }");
513503
}
514504

515-
let db_path = make_path(~"db.json");
505+
let db_path = os::self_exe_path().expect("workcache::test failed").pop().push("db.json");
506+
if os::path_exists(&db_path) {
507+
os::remove_file(&db_path);
508+
}
516509

517510
let cx = Context::new(RWArc::new(Database::new(db_path)),
518511
RWArc::new(Logger::new()),
@@ -521,19 +514,17 @@ fn test() {
521514
let s = do cx.with_prep("test1") |prep| {
522515

523516
let subcx = cx.clone();
524-
let pth = pth.clone();
525517

526518
prep.declare_input("file", pth.to_str(), digest_file(&pth));
527519
do prep.exec |_exe| {
528-
let out = make_path(~"foo.o");
529-
run::process_status("gcc", [pth.to_str(), ~"-o", out.to_str()]);
520+
let out = Path("foo.o");
521+
run::process_status("gcc", [~"foo.c", ~"-o", out.to_str()]);
530522

531523
let _proof_of_concept = subcx.prep("subfn");
532524
// Could run sub-rules inside here.
533525

534526
out.to_str()
535527
}
536528
};
537-
538529
io::println(s);
539530
}

0 commit comments

Comments
 (0)