Skip to content

Commit 36d3555

Browse files
committed
---
yaml --- r: 80425 b: refs/heads/snap-stage3 c: 4c49a3d h: refs/heads/master i: 80423: 7c63e6d v: v3
1 parent 8931db1 commit 36d3555

File tree

23 files changed

+539
-89
lines changed

23 files changed

+539
-89
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 3e1803f3af1adc1b2e5595650f6920f40bbedc2e
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: bb4d4d7eb9e7a3abe3dc2fd26ad62408d83ed036
4+
refs/heads/snap-stage3: 4c49a3d8cd00489e62ab7398d05285361039ef13
55
refs/heads/try: 71bebebc37fbb229877da88dde13c2f35913bd77
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/doc/tutorial-tasks.md

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

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

5756
[`std::task`]: std/task.html
5857
[`std::comm`]: std/comm.html
59-
[`std::pipes`]: std/pipes.html
6058
[`extra::comm`]: extra/comm.html
6159
[`extra::sync`]: extra/sync.html
6260
[`extra::arc`]: extra/arc.html
@@ -125,7 +123,7 @@ receiving messages. Pipes are low-level communication building-blocks and so
125123
come in a variety of forms, each one appropriate for a different use case. In
126124
what follows, we cover the most commonly used varieties.
127125

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

branches/snap-stage3/mk/platform.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ else
4747
CFG_GCCISH_CFLAGS += -O2
4848
endif
4949

50+
# The soname thing is for supporting a statically linked jemalloc.
51+
# see https://blog.mozilla.org/jseward/2012/06/05/valgrind-now-supports-jemalloc-builds-directly/
5052
ifdef CFG_VALGRIND
5153
CFG_VALGRIND += --error-exitcode=100 \
54+
--soname-synonyms=somalloc=NONE \
5255
--quiet \
5356
--suppressions=$(CFG_SRC_DIR)src/etc/x86.supp \
5457
$(OS_SUPP)

branches/snap-stage3/src/libextra/fileinput.rs

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

435435
#[test]
436-
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
437436
fn test_make_path_option_vec() {
438437
let strs = [~"some/path",
439438
~"some/other/path"];
@@ -448,7 +447,6 @@ mod test {
448447
}
449448
450449
#[test]
451-
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
452450
fn test_fileinput_read_byte() {
453451
let filenames = make_path_option_vec(vec::from_fn(
454452
3,
@@ -479,7 +477,6 @@ mod test {
479477
}
480478
481479
#[test]
482-
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
483480
fn test_fileinput_read() {
484481
let filenames = make_path_option_vec(vec::from_fn(
485482
3,
@@ -500,7 +497,6 @@ mod test {
500497
}
501498

502499
#[test]
503-
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
504500
fn test_input_vec() {
505501
let mut all_lines = ~[];
506502
let filenames = make_path_option_vec(vec::from_fn(
@@ -524,7 +520,6 @@ mod test {
524520
}
525521

526522
#[test]
527-
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
528523
fn test_input_vec_state() {
529524
let filenames = make_path_option_vec(vec::from_fn(
530525
3,
@@ -547,7 +542,6 @@ mod test {
547542
}
548543

549544
#[test]
550-
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
551545
fn test_empty_files() {
552546
let filenames = make_path_option_vec(vec::from_fn(
553547
3,
@@ -572,7 +566,6 @@ mod test {
572566
}
573567
574568
#[test]
575-
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
576569
fn test_no_trailing_newline() {
577570
let f1 =
578571
Some(Path("tmp/lib-fileinput-test-no-trailing-newline-1.tmp"));
@@ -598,7 +591,6 @@ mod test {
598591
599592
600593
#[test]
601-
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
602594
fn test_next_file() {
603595
let filenames = make_path_option_vec(vec::from_fn(
604596
3,
@@ -630,7 +622,6 @@ mod test {
630622
631623
#[test]
632624
#[should_fail]
633-
#[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
634625
fn test_input_vec_missing_file() {
635626
do input_vec(make_path_option_vec([~"this/file/doesnt/exist"], true)) |line| {
636627
println(line);

branches/snap-stage3/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/snap-stage3/src/libextra/workcache.rs

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

499-
let pth = Path("foo.c");
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");
500510
{
501511
let r = io::file_writer(&pth, [io::Create]);
502512
r.unwrap().write_str("int main() { return 0; }");
503513
}
504514

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-
}
515+
let db_path = make_path(~"db.json");
509516

510517
let cx = Context::new(RWArc::new(Database::new(db_path)),
511518
RWArc::new(Logger::new()),
@@ -514,17 +521,19 @@ fn test() {
514521
let s = do cx.with_prep("test1") |prep| {
515522

516523
let subcx = cx.clone();
524+
let pth = pth.clone();
517525

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

523531
let _proof_of_concept = subcx.prep("subfn");
524532
// Could run sub-rules inside here.
525533

526534
out.to_str()
527535
}
528536
};
537+
529538
io::println(s);
530539
}

branches/snap-stage3/src/libstd/logging.rs

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

1819
/// Turns on logging to stdout globally
1920
pub fn console_on() {
@@ -56,12 +57,12 @@ fn newsched_log_str(msg: ~str) {
5657
match optional_task {
5758
Some(local) => {
5859
// Use the available logger
59-
(*local).logger.log(OwnedString(msg));
60+
(*local).logger.log(SendStrOwned(msg));
6061
}
6162
None => {
6263
// There is no logger anywhere, just write to stderr
6364
let mut logger = StdErrLogger;
64-
logger.log(OwnedString(msg));
65+
logger.log(SendStrOwned(msg));
6566
}
6667
}
6768
}

branches/snap-stage3/src/libstd/os.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,18 +1135,19 @@ 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::LPSTR;
1138+
use libc::types::os::arch::extra::LPWSTR;
11391139
use libc::types::os::arch::extra::LPVOID;
1140+
use libc::types::os::arch::extra::WCHAR;
11401141

11411142
#[cfg(target_arch = "x86")]
11421143
#[link_name = "kernel32"]
11431144
#[abi = "stdcall"]
11441145
extern "stdcall" {
1145-
fn FormatMessageA(flags: DWORD,
1146+
fn FormatMessageW(flags: DWORD,
11461147
lpSrc: LPVOID,
11471148
msgId: DWORD,
11481149
langId: DWORD,
1149-
buf: LPSTR,
1150+
buf: LPWSTR,
11501151
nsize: DWORD,
11511152
args: *c_void)
11521153
-> DWORD;
@@ -1155,11 +1156,11 @@ pub fn last_os_error() -> ~str {
11551156
#[cfg(target_arch = "x86_64")]
11561157
#[link_name = "kernel32"]
11571158
extern {
1158-
fn FormatMessageA(flags: DWORD,
1159+
fn FormatMessageW(flags: DWORD,
11591160
lpSrc: LPVOID,
11601161
msgId: DWORD,
11611162
langId: DWORD,
1162-
buf: LPSTR,
1163+
buf: LPWSTR,
11631164
nsize: DWORD,
11641165
args: *c_void)
11651166
-> DWORD;
@@ -1173,11 +1174,11 @@ pub fn last_os_error() -> ~str {
11731174
let langId = 0x0800 as DWORD;
11741175
let err = errno() as DWORD;
11751176

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

11781179
unsafe {
11791180
do buf.as_mut_buf |buf, len| {
1180-
let res = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
1181+
let res = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
11811182
FORMAT_MESSAGE_IGNORE_INSERTS,
11821183
ptr::mut_null(),
11831184
err,
@@ -1190,9 +1191,7 @@ pub fn last_os_error() -> ~str {
11901191
}
11911192
}
11921193

1193-
do buf.as_imm_buf |buf, _len| {
1194-
str::raw::from_c_str(buf)
1195-
}
1194+
str::from_utf16(buf)
11961195
}
11971196
}
11981197

branches/snap-stage3/src/libstd/prelude.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ 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};
6970
pub use str::{Str, StrVector, StrSlice, OwnedStr};
7071
pub use from_str::FromStr;
7172
pub use to_bytes::IterBytes;

branches/snap-stage3/src/libstd/rt/io/file.rs

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

170170
#[test]
171-
#[ignore(cfg(windows))] // FIXME #8810
172171
fn file_test_io_smoke_test() {
173172
file_test_smoke_test_impl();
174173
}
@@ -236,7 +235,6 @@ fn file_test_io_non_positional_read_impl() {
236235
}
237236

238237
#[test]
239-
#[ignore(cfg(windows))] // FIXME #8810
240238
fn file_test_io_non_positional_read() {
241239
file_test_io_non_positional_read_impl();
242240
}
@@ -268,8 +266,8 @@ fn file_test_io_seeking_impl() {
268266
assert!(tell_pos_post_read == message.len() as u64);
269267
}
270268
}
269+
271270
#[test]
272-
#[ignore(cfg(windows))] // FIXME #8810
273271
fn file_test_io_seek_and_tell_smoke_test() {
274272
file_test_io_seeking_impl();
275273
}
@@ -300,8 +298,8 @@ fn file_test_io_seek_and_write_impl() {
300298
assert!(read_str == final_msg.to_owned());
301299
}
302300
}
301+
303302
#[test]
304-
#[ignore(cfg(windows))] // FIXME #8810
305303
fn file_test_io_seek_and_write() {
306304
file_test_io_seek_and_write_impl();
307305
}
@@ -340,8 +338,8 @@ fn file_test_io_seek_shakedown_impl() {
340338
unlink(filename);
341339
}
342340
}
341+
343342
#[test]
344-
#[ignore(cfg(windows))] // FIXME #8810
345343
fn file_test_io_seek_shakedown() {
346344
file_test_io_seek_shakedown_impl();
347345
}

0 commit comments

Comments
 (0)