Skip to content

Commit e7c5136

Browse files
committed
---
yaml --- r: 80870 b: refs/heads/try c: bb4d4d7 h: refs/heads/master v: v3
1 parent 24a86f1 commit e7c5136

File tree

22 files changed

+89
-536
lines changed

22 files changed

+89
-536
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cbd1eefbd350797b783df119fed7956d7e1c74ad
5-
refs/heads/try: bc89ade401e637fcb7d4d1d0b7f356ca359b0e7d
5+
refs/heads/try: bb4d4d7eb9e7a3abe3dc2fd26ad62408d83ed036
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/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/try/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/try/src/libextra/json.rs

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

@@ -947,14 +950,20 @@ impl serialize::Decoder for Decoder {
947950
debug!("read_enum_variant(names=%?)", names);
948951
let name = match self.stack.pop() {
949952
String(s) => s,
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),
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")
957965
}
966+
n
958967
}
959968
ref json => fail!("invalid variant: %?", *json),
960969
};
@@ -1517,7 +1526,7 @@ mod tests {
15171526
let mut encoder = Encoder(wr);
15181527
animal.encode(&mut encoder);
15191528
},
1520-
~"[\"Frog\",\"Henry\",349]"
1529+
~"{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}"
15211530
);
15221531
assert_eq!(
15231532
do io::with_str_writer |wr| {
@@ -1921,14 +1930,14 @@ mod tests {
19211930
assert_eq!(value, Dog);
19221931

19231932
let mut decoder =
1924-
Decoder(from_str("[\"Frog\",\"Henry\",349]").unwrap());
1933+
Decoder(from_str("{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}").unwrap());
19251934
let value: Animal = Decodable::decode(&mut decoder);
19261935
assert_eq!(value, Frog(~"Henry", 349));
19271936
}
19281937
19291938
#[test]
19301939
fn test_decode_map() {
1931-
let s = ~"{\"a\": \"Dog\", \"b\": [\"Frog\", \"Henry\", 349]}";
1940+
let s = ~"{\"a\": \"Dog\", \"b\": {\"variant\":\"Frog\",\"fields\":[\"Henry\", 349]}}";
19321941
let mut decoder = Decoder(from_str(s).unwrap());
19331942
let mut map: TreeMap<~str, Animal> = Decodable::decode(&mut decoder);
19341943

branches/try/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
}

branches/try/src/libstd/logging.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
use option::*;
1414
use os;
1515
use rt;
16-
use rt::logging::{Logger, StdErrLogger};
17-
use send_str::SendStrOwned;
16+
use rt::logging::{Logger, StdErrLogger, OwnedString};
1817

1918
/// Turns on logging to stdout globally
2019
pub fn console_on() {
@@ -57,12 +56,12 @@ fn newsched_log_str(msg: ~str) {
5756
match optional_task {
5857
Some(local) => {
5958
// Use the available logger
60-
(*local).logger.log(SendStrOwned(msg));
59+
(*local).logger.log(OwnedString(msg));
6160
}
6261
None => {
6362
// There is no logger anywhere, just write to stderr
6463
let mut logger = StdErrLogger;
65-
logger.log(SendStrOwned(msg));
64+
logger.log(OwnedString(msg));
6665
}
6766
}
6867
}

branches/try/src/libstd/os.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,19 +1135,18 @@ pub fn last_os_error() -> ~str {
11351135
#[fixed_stack_segment]; #[inline(never)];
11361136

11371137
use libc::types::os::arch::extra::DWORD;
1138-
use libc::types::os::arch::extra::LPWSTR;
1138+
use libc::types::os::arch::extra::LPSTR;
11391139
use libc::types::os::arch::extra::LPVOID;
1140-
use libc::types::os::arch::extra::WCHAR;
11411140

11421141
#[cfg(target_arch = "x86")]
11431142
#[link_name = "kernel32"]
11441143
#[abi = "stdcall"]
11451144
extern "stdcall" {
1146-
fn FormatMessageW(flags: DWORD,
1145+
fn FormatMessageA(flags: DWORD,
11471146
lpSrc: LPVOID,
11481147
msgId: DWORD,
11491148
langId: DWORD,
1150-
buf: LPWSTR,
1149+
buf: LPSTR,
11511150
nsize: DWORD,
11521151
args: *c_void)
11531152
-> DWORD;
@@ -1156,11 +1155,11 @@ pub fn last_os_error() -> ~str {
11561155
#[cfg(target_arch = "x86_64")]
11571156
#[link_name = "kernel32"]
11581157
extern {
1159-
fn FormatMessageW(flags: DWORD,
1158+
fn FormatMessageA(flags: DWORD,
11601159
lpSrc: LPVOID,
11611160
msgId: DWORD,
11621161
langId: DWORD,
1163-
buf: LPWSTR,
1162+
buf: LPSTR,
11641163
nsize: DWORD,
11651164
args: *c_void)
11661165
-> DWORD;
@@ -1174,11 +1173,11 @@ pub fn last_os_error() -> ~str {
11741173
let langId = 0x0800 as DWORD;
11751174
let err = errno() as DWORD;
11761175

1177-
let mut buf = [0 as WCHAR, ..TMPBUF_SZ];
1176+
let mut buf = [0 as c_char, ..TMPBUF_SZ];
11781177

11791178
unsafe {
11801179
do buf.as_mut_buf |buf, len| {
1181-
let res = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
1180+
let res = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
11821181
FORMAT_MESSAGE_IGNORE_INSERTS,
11831182
ptr::mut_null(),
11841183
err,
@@ -1191,7 +1190,9 @@ pub fn last_os_error() -> ~str {
11911190
}
11921191
}
11931192

1194-
str::from_utf16(buf)
1193+
do buf.as_imm_buf |buf, _len| {
1194+
str::raw::from_c_str(buf)
1195+
}
11951196
}
11961197
}
11971198

branches/try/src/libstd/prelude.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ pub use path::PosixPath;
6666
pub use path::WindowsPath;
6767
pub use ptr::RawPtr;
6868
pub use ascii::{Ascii, AsciiCast, OwnedAsciiCast, AsciiStr, ToBytesConsume};
69-
pub use send_str::{SendStr, SendStrOwned, SendStrStatic, IntoSendStr};
7069
pub use str::{Str, StrVector, StrSlice, OwnedStr};
7170
pub use from_str::FromStr;
7271
pub use to_bytes::IterBytes;

branches/try/src/libstd/rt/io/file.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ fn file_test_smoke_test_impl() {
168168
}
169169

170170
#[test]
171+
#[ignore(cfg(windows))] // FIXME #8810
171172
fn file_test_io_smoke_test() {
172173
file_test_smoke_test_impl();
173174
}
@@ -235,6 +236,7 @@ fn file_test_io_non_positional_read_impl() {
235236
}
236237

237238
#[test]
239+
#[ignore(cfg(windows))] // FIXME #8810
238240
fn file_test_io_non_positional_read() {
239241
file_test_io_non_positional_read_impl();
240242
}
@@ -266,8 +268,8 @@ fn file_test_io_seeking_impl() {
266268
assert!(tell_pos_post_read == message.len() as u64);
267269
}
268270
}
269-
270271
#[test]
272+
#[ignore(cfg(windows))] // FIXME #8810
271273
fn file_test_io_seek_and_tell_smoke_test() {
272274
file_test_io_seeking_impl();
273275
}
@@ -298,8 +300,8 @@ fn file_test_io_seek_and_write_impl() {
298300
assert!(read_str == final_msg.to_owned());
299301
}
300302
}
301-
302303
#[test]
304+
#[ignore(cfg(windows))] // FIXME #8810
303305
fn file_test_io_seek_and_write() {
304306
file_test_io_seek_and_write_impl();
305307
}
@@ -338,8 +340,8 @@ fn file_test_io_seek_shakedown_impl() {
338340
unlink(filename);
339341
}
340342
}
341-
342343
#[test]
344+
#[ignore(cfg(windows))] // FIXME #8810
343345
fn file_test_io_seek_shakedown() {
344346
file_test_io_seek_shakedown_impl();
345347
}

0 commit comments

Comments
 (0)