Skip to content

Commit daa69b6

Browse files
committed
---
yaml --- r: 80508 b: refs/heads/master c: bb4d4d7 h: refs/heads/master v: v3
1 parent 00c2ecd commit daa69b6

File tree

22 files changed

+102
-538
lines changed

22 files changed

+102
-538
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: e1507f3120a14399af1a4bb097240c9be865634d
2+
refs/heads/master: bb4d4d7eb9e7a3abe3dc2fd26ad62408d83ed036
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cbd1eefbd350797b783df119fed7956d7e1c74ad
55
refs/heads/try: 71bebebc37fbb229877da88dde13c2f35913bd77

trunk/man/rustpkg.1

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ This tool is a package manager for applications written in the Rust language,
1111
available at <\fBhttps://www.rust-lang.org\fR>. It provides commands to build,
1212
install and test Rust programs.
1313

14-
\fBrustpkg\fR is still a work in progress. See \fBdoc/rustpkg.md\fR in the Rust source distribution for future plans.
15-
1614
.SH COMMANDS
1715

1816
.TP
@@ -27,6 +25,10 @@ Remove all generated files from the \fIbuild\fR directory in the target's worksp
2725
Builds the specified target, and all its dependencies, and then installs the
2826
build products into the \fIlib\fR and \fIbin\fR directories of their respective
2927
workspaces.
28+
.TP
29+
\fBtest\fR
30+
Builds the module called \fItest.rs\fR in the specified workspace, and then runs
31+
the resulting executable in test mode.
3032

3133
.SS "BUILD COMMAND"
3234

@@ -56,9 +58,20 @@ of the first entry in RUST_PATH.
5658

5759
Examples:
5860

59-
$ rustpkg install github.com/mozilla/servo.git#1.2
61+
$ rustpkg install git://github.com/mozilla/servo.git#1.2
6062
$ rustpkg install rust-glfw
6163

64+
.SS "TEST COMMAND"
65+
66+
rustpkg test \fI[pkgname]\fR
67+
68+
The test command is a shortcut for the command line:
69+
70+
$ rustc --test <filename> -o <filestem>test~ && ./<filestem>test~
71+
72+
Note the suffix on the output filename (the word "test" followed by a tilde),
73+
which should ensure the file does not clash with a user-generated files.
74+
6275
.SH "ENVIRONMENT"
6376

6477
.TP
@@ -173,7 +186,7 @@ rust, rustc, rustdoc, rusti
173186
See <\fBhttps://github.com/mozilla/rust/issues\fR> for issues.
174187

175188
.SH "AUTHOR"
176-
See \fBAUTHORS.txt\fR in the Rust source distribution. Graydon Hoare
189+
See \fBAUTHORS.txt\fR in the rust source distribution. Graydon Hoare
177190
<\fI[email protected]\fR> is the project leader.
178191

179192
.SH "COPYRIGHT"

trunk/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);

trunk/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

trunk/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
}

trunk/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
}

trunk/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

trunk/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;

0 commit comments

Comments
 (0)