Skip to content

Commit a3650b5

Browse files
author
Olivier Saut
committed
---
yaml --- r: 59053 b: refs/heads/incoming c: 017e7e8 h: refs/heads/master i: 59051: fa1c07a v: v3
1 parent 23ffa91 commit a3650b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1338
-752
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 3db74ddd2e0ec7ea02ac1b82745439587f514cc4
9+
refs/heads/incoming: 017e7e8be1906841451284de53c536e475046dc9
1010
refs/heads/dist-snap: 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/doc/tutorial.md

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ we have a file `hello.rs` containing this program:
129129

130130
~~~~
131131
fn main() {
132-
io::println("hello?");
132+
println("hello?");
133133
}
134134
~~~~
135135

@@ -139,12 +139,12 @@ Windows) which, upon running, will likely do exactly what you expect.
139139

140140
The Rust compiler tries to provide useful information when it encounters an
141141
error. If you introduce an error into the program (for example, by changing
142-
`io::println` to some nonexistent function), and then compile it, you'll see
142+
`println` to some nonexistent function), and then compile it, you'll see
143143
an error message like this:
144144

145145
~~~~ {.notrust}
146-
hello.rs:2:4: 2:16 error: unresolved name: io::print_with_unicorns
147-
hello.rs:2 io::print_with_unicorns("hello?");
146+
hello.rs:2:4: 2:16 error: unresolved name: print_with_unicorns
147+
hello.rs:2 print_with_unicorns("hello?");
148148
^~~~~~~~~~~~~~~~~~~~~~~
149149
~~~~
150150

@@ -227,7 +227,7 @@ let hi = "hi";
227227
let mut count = 0;
228228
229229
while count < 10 {
230-
io::println(fmt!("count: %?", count));
230+
println(fmt!("count: %?", count));
231231
count += 1;
232232
}
233233
~~~~
@@ -400,10 +400,10 @@ don't match the types of the arguments.
400400
~~~~
401401
# let mystery_object = ();
402402
403-
io::println(fmt!("%s is %d", "the answer", 43));
403+
println(fmt!("%s is %d", "the answer", 43));
404404
405405
// %? will conveniently print any type
406-
io::println(fmt!("what is this thing: %?", mystery_object));
406+
println(fmt!("what is this thing: %?", mystery_object));
407407
~~~~
408408

409409
[pf]: http://en.cppreference.com/w/cpp/io/c/fprintf
@@ -422,11 +422,11 @@ compulsory, an `if` can have an optional `else` clause, and multiple
422422

423423
~~~~
424424
if false {
425-
io::println("that's odd");
425+
println("that's odd");
426426
} else if true {
427-
io::println("right");
427+
println("right");
428428
} else {
429-
io::println("neither true nor false");
429+
println("neither true nor false");
430430
}
431431
~~~~
432432

@@ -454,10 +454,10 @@ executes its corresponding arm.
454454
~~~~
455455
# let my_number = 1;
456456
match my_number {
457-
0 => io::println("zero"),
458-
1 | 2 => io::println("one or two"),
459-
3..10 => io::println("three to ten"),
460-
_ => io::println("something else")
457+
0 => println("zero"),
458+
1 | 2 => println("one or two"),
459+
3..10 => println("three to ten"),
460+
_ => println("something else")
461461
}
462462
~~~~
463463

@@ -483,8 +483,8 @@ commas are optional.
483483
~~~
484484
# let my_number = 1;
485485
match my_number {
486-
0 => { io::println("zero") }
487-
_ => { io::println("something else") }
486+
0 => { println("zero") }
487+
_ => { println("something else") }
488488
}
489489
~~~
490490

@@ -560,7 +560,7 @@ let mut x = 5;
560560
loop {
561561
x += x - 3;
562562
if x % 5 == 0 { break; }
563-
io::println(int::to_str(x));
563+
println(int::to_str(x));
564564
}
565565
~~~~
566566

@@ -614,8 +614,8 @@ origin.y += 1.0; // ERROR: assigning to immutable field
614614
# struct Point { x: float, y: float }
615615
# let mypoint = Point { x: 0.0, y: 0.0 };
616616
match mypoint {
617-
Point { x: 0.0, y: yy } => { io::println(yy.to_str()); }
618-
Point { x: xx, y: yy } => { io::println(xx.to_str() + " " + yy.to_str()); }
617+
Point { x: 0.0, y: yy } => { println(yy.to_str()); }
618+
Point { x: xx, y: yy } => { println(xx.to_str() + " " + yy.to_str()); }
619619
}
620620
~~~~
621621

@@ -630,7 +630,7 @@ reuses the field name as the binding name.
630630
# struct Point { x: float, y: float }
631631
# let mypoint = Point { x: 0.0, y: 0.0 };
632632
match mypoint {
633-
Point { x, _ } => { io::println(x.to_str()) }
633+
Point { x, _ } => { println(x.to_str()) }
634634
}
635635
~~~
636636

@@ -1231,7 +1231,7 @@ something silly like
12311231
~~~
12321232
# struct Point { x: float, y: float }
12331233
let point = &@~Point { x: 10f, y: 20f };
1234-
io::println(fmt!("%f", point.x));
1234+
println(fmt!("%f", point.x));
12351235
~~~
12361236
12371237
The indexing operator (`[]`) also auto-dereferences.
@@ -1373,7 +1373,6 @@ and [`core::str`]. Here are some examples.
13731373
[`core::str`]: core/str.html
13741374

13751375
~~~
1376-
# use core::io::println;
13771376
# enum Crayon {
13781377
# Almond, AntiqueBrass, Apricot,
13791378
# Aquamarine, Asparagus, AtomicTangerine,
@@ -1428,7 +1427,6 @@ Rust also supports _closures_, functions that can access variables in
14281427
the enclosing scope.
14291428

14301429
~~~~
1431-
# use println = core::io::println;
14321430
fn call_closure_with_ten(b: &fn(int)) { b(10); }
14331431
14341432
let captured_var = 20;
@@ -1490,7 +1488,7 @@ fn mk_appender(suffix: ~str) -> @fn(~str) -> ~str {
14901488
14911489
fn main() {
14921490
let shout = mk_appender(~"!");
1493-
io::println(shout(~"hey ho, let's go"));
1491+
println(shout(~"hey ho, let's go"));
14941492
}
14951493
~~~~
14961494

@@ -1632,7 +1630,6 @@ And using this function to iterate over a vector:
16321630

16331631
~~~~
16341632
# use each = core::vec::each;
1635-
# use println = core::io::println;
16361633
each([2, 4, 8, 5, 16], |n| {
16371634
if *n % 2 != 0 {
16381635
println("found odd number!");
@@ -1649,7 +1646,6 @@ to the next iteration, write `loop`.
16491646

16501647
~~~~
16511648
# use each = core::vec::each;
1652-
# use println = core::io::println;
16531649
for each([2, 4, 8, 5, 16]) |n| {
16541650
if *n % 2 != 0 {
16551651
println("found odd number!");
@@ -1982,7 +1978,7 @@ struct TimeBomb {
19821978
impl Drop for TimeBomb {
19831979
fn finalize(&self) {
19841980
for old_iter::repeat(self.explosivity) {
1985-
io::println("blam!");
1981+
println("blam!");
19861982
}
19871983
}
19881984
}
@@ -2014,11 +2010,11 @@ and `~str`.
20142010
~~~~
20152011
# trait Printable { fn print(&self); }
20162012
impl Printable for int {
2017-
fn print(&self) { io::println(fmt!("%d", *self)) }
2013+
fn print(&self) { println(fmt!("%d", *self)) }
20182014
}
20192015
20202016
impl Printable for ~str {
2021-
fn print(&self) { io::println(*self) }
2017+
fn print(&self) { println(*self) }
20222018
}
20232019
20242020
# 1.print();
@@ -2307,7 +2303,7 @@ mod farm {
23072303
}
23082304
23092305
fn main() {
2310-
io::println(farm::chicken());
2306+
println(farm::chicken());
23112307
}
23122308
~~~~
23132309

@@ -2507,7 +2503,7 @@ pub fn explore() -> &str { "world" }
25072503
~~~~ {.xfail-test}
25082504
// main.rs
25092505
extern mod world;
2510-
fn main() { io::println(~"hello " + world::explore()); }
2506+
fn main() { println(~"hello " + world::explore()); }
25112507
~~~~
25122508

25132509
Now compile and run like this (adjust to your platform if necessary):

branches/incoming/mk/platform.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,12 @@ AR_mips-unknown-linux-gnu=mips-linux-gnu-ar
247247
CFG_LIB_NAME_mips-unknown-linux-gnu=lib$(1).so
248248
CFG_LIB_GLOB_mips-unknown-linux-gnu=lib$(1)-*.so
249249
CFG_LIB_DSYM_GLOB_mips-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
250-
CFG_GCCISH_CFLAGS_mips-unknown-linux-gnu := -Wall -g -fPIC -mips32r2 -msoft-float -mabi=32
250+
CFG_GCCISH_CFLAGS_mips-unknown-linux-gnu := -Wall -g -fPIC -mips32r2 -msoft-float -mabi=32 -mno-compact-eh
251251
CFG_GCCISH_CXXFLAGS_mips-unknown-linux-gnu := -fno-rtti
252252
CFG_GCCISH_LINK_FLAGS_mips-unknown-linux-gnu := -shared -fPIC -g -mips32r2 -msoft-float -mabi=32
253253
CFG_GCCISH_DEF_FLAG_mips-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
254254
CFG_GCCISH_PRE_LIB_FLAGS_mips-unknown-linux-gnu := -Wl,-whole-archive
255-
CFG_GCCISH_POST_LIB_FLAGS_mips-unknown-linux-gnu := -Wl,-no-whole-archive -Wl,-znoexecstack
255+
CFG_GCCISH_POST_LIB_FLAGS_mips-unknown-linux-gnu := -Wl,-no-whole-archive
256256
CFG_DEF_SUFFIX_mips-unknown-linux-gnu := .linux.def
257257
CFG_INSTALL_NAME_mips-unknown-linux-gnu =
258258
CFG_LIBUV_LINK_FLAGS_mips-unknown-linux-gnu =

branches/incoming/src/libcore/condition.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
use prelude::*;
1414
use task;
15-
use task::local_data::{local_data_pop, local_data_set};
15+
use local_data::{local_data_pop, local_data_set};
1616

1717
// helper for transmutation, shown below.
1818
type RustClosure = (int, int);
@@ -24,14 +24,14 @@ pub struct Handler<T, U> {
2424

2525
pub struct Condition<'self, T, U> {
2626
name: &'static str,
27-
key: task::local_data::LocalDataKey<'self, Handler<T, U>>
27+
key: local_data::LocalDataKey<'self, Handler<T, U>>
2828
}
2929

3030
pub impl<'self, T, U> Condition<'self, T, U> {
3131
fn trap(&'self self, h: &'self fn(T) -> U) -> Trap<'self, T, U> {
3232
unsafe {
3333
let p : *RustClosure = ::cast::transmute(&h);
34-
let prev = task::local_data::local_data_get(self.key);
34+
let prev = local_data::local_data_get(self.key);
3535
let h = @Handler { handle: *p, prev: prev };
3636
Trap { cond: self, handler: h }
3737
}

branches/incoming/src/libcore/core.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ pub mod trie;
215215
pub mod task;
216216
pub mod comm;
217217
pub mod pipes;
218+
pub mod local_data;
218219

219220

220221
/* Runtime and platform support */

branches/incoming/src/libcore/libc.rs

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,17 @@ pub mod types {
268268
pub type ssize_t = i32;
269269
}
270270
pub mod posix01 {
271-
use libc::types::os::arch::c95::{c_short, c_long, time_t};
271+
use libc::types::os::arch::c95::{c_short, c_long, c_ulong, time_t};
272272
use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t};
273273
use libc::types::os::arch::posix88::{mode_t, off_t};
274274
use libc::types::os::arch::posix88::{uid_t};
275275

276276
pub type nlink_t = u32;
277277
pub type blksize_t = i32;
278278
pub type blkcnt_t = i32;
279+
280+
#[cfg(target_arch = "x86")]
281+
#[cfg(target_arch = "arm")]
279282
pub struct stat {
280283
st_dev: dev_t,
281284
__pad1: c_short,
@@ -298,6 +301,30 @@ pub mod types {
298301
__unused4: c_long,
299302
__unused5: c_long,
300303
}
304+
305+
#[cfg(target_arch = "mips")]
306+
pub struct stat {
307+
st_dev: c_ulong,
308+
st_pad1: [c_long, ..3],
309+
st_ino: ino_t,
310+
st_mode: mode_t,
311+
st_nlink: nlink_t,
312+
st_uid: uid_t,
313+
st_gid: gid_t,
314+
st_rdev: c_ulong,
315+
st_pad2: [c_long, ..2],
316+
st_size: off_t,
317+
st_pad3: c_long,
318+
st_atime: time_t,
319+
st_atime_nsec: c_long,
320+
st_mtime: time_t,
321+
st_mtime_nsec: c_long,
322+
st_ctime: time_t,
323+
st_ctime_nsec: c_long,
324+
st_blksize: blksize_t,
325+
st_blocks: blkcnt_t,
326+
st_pad5: [c_long, ..14],
327+
}
301328
}
302329
pub mod posix08 {}
303330
pub mod bsd44 {}
@@ -963,6 +990,9 @@ pub mod consts {
963990
}
964991
pub mod c99 {
965992
}
993+
#[cfg(target_arch = "x86")]
994+
#[cfg(target_arch = "x86_64")]
995+
#[cfg(target_arch = "arm")]
966996
pub mod posix88 {
967997
pub static O_RDONLY : int = 0;
968998
pub static O_WRONLY : int = 1;
@@ -1007,6 +1037,51 @@ pub mod consts {
10071037
pub static SIGALRM : int = 14;
10081038
pub static SIGTERM : int = 15;
10091039
}
1040+
#[cfg(target_arch = "mips")]
1041+
pub mod posix88 {
1042+
pub static O_RDONLY : int = 0;
1043+
pub static O_WRONLY : int = 1;
1044+
pub static O_RDWR : int = 2;
1045+
pub static O_APPEND : int = 8;
1046+
pub static O_CREAT : int = 256;
1047+
pub static O_EXCL : int = 1024;
1048+
pub static O_TRUNC : int = 512;
1049+
pub static S_IFIFO : int = 4096;
1050+
pub static S_IFCHR : int = 8192;
1051+
pub static S_IFBLK : int = 24576;
1052+
pub static S_IFDIR : int = 16384;
1053+
pub static S_IFREG : int = 32768;
1054+
pub static S_IFMT : int = 61440;
1055+
pub static S_IEXEC : int = 64;
1056+
pub static S_IWRITE : int = 128;
1057+
pub static S_IREAD : int = 256;
1058+
pub static S_IRWXU : int = 448;
1059+
pub static S_IXUSR : int = 64;
1060+
pub static S_IWUSR : int = 128;
1061+
pub static S_IRUSR : int = 256;
1062+
pub static F_OK : int = 0;
1063+
pub static R_OK : int = 4;
1064+
pub static W_OK : int = 2;
1065+
pub static X_OK : int = 1;
1066+
pub static STDIN_FILENO : int = 0;
1067+
pub static STDOUT_FILENO : int = 1;
1068+
pub static STDERR_FILENO : int = 2;
1069+
pub static F_LOCK : int = 1;
1070+
pub static F_TEST : int = 3;
1071+
pub static F_TLOCK : int = 2;
1072+
pub static F_ULOCK : int = 0;
1073+
pub static SIGHUP : int = 1;
1074+
pub static SIGINT : int = 2;
1075+
pub static SIGQUIT : int = 3;
1076+
pub static SIGILL : int = 4;
1077+
pub static SIGABRT : int = 6;
1078+
pub static SIGFPE : int = 8;
1079+
pub static SIGKILL : int = 9;
1080+
pub static SIGSEGV : int = 11;
1081+
pub static SIGPIPE : int = 13;
1082+
pub static SIGALRM : int = 14;
1083+
pub static SIGTERM : int = 15;
1084+
}
10101085
pub mod posix01 {
10111086
pub static SIGTRAP : int = 5;
10121087

@@ -1026,11 +1101,20 @@ pub mod consts {
10261101
}
10271102
pub mod bsd44 {
10281103
}
1104+
#[cfg(target_arch = "x86")]
1105+
#[cfg(target_arch = "x86_64")]
1106+
#[cfg(target_arch = "arm")]
10291107
pub mod extra {
10301108
pub static O_RSYNC : int = 1052672;
10311109
pub static O_DSYNC : int = 4096;
10321110
pub static O_SYNC : int = 1052672;
10331111
}
1112+
#[cfg(target_arch = "mips")]
1113+
pub mod extra {
1114+
pub static O_RSYNC : int = 16400;
1115+
pub static O_DSYNC : int = 16;
1116+
pub static O_SYNC : int = 16400;
1117+
}
10341118
}
10351119

10361120
#[cfg(target_os = "freebsd")]

0 commit comments

Comments
 (0)