Skip to content

Commit ae43263

Browse files
committed
---
yaml --- r: 144319 b: refs/heads/try2 c: 4edf375 h: refs/heads/master i: 144317: 33a2194 144315: cf8d552 144311: 2088d21 144303: 48df8ab 144287: 4fbd311 144255: 8945699 v: v3
1 parent 55db05d commit ae43263

Some content is hidden

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

79 files changed

+1553
-338
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: a909144b1c5cc5ae5d32aaba63a4ee6bce5fc1e2
8+
refs/heads/try2: 4edf3758d178213882530c47b9ea1e2e6356d5a1
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,38 @@ In this example, the module `quux` re-exports all of the public names defined in
851851

852852
Also note that the paths contained in `use` items are relative to the crate root.
853853
So, in the previous example, the `use` refers to `quux::foo::*`, and not simply to `foo::*`.
854+
This also means that top-level module declarations should be at the crate root if direct usage
855+
of the declared modules within `use` items is desired. It is also possible to use `self` and `super`
856+
at the beginning of a `use` item to refer to the current and direct parent modules respectively.
857+
All rules regarding accessing declared modules in `use` declarations applies to both module declarations
858+
and `extern mod` declarations.
859+
860+
An example of what will and will not work for `use` items:
861+
~~~~
862+
# #[allow(unused_imports)];
863+
use foo::extra; // good: foo is at the root of the crate
864+
use foo::baz::foobaz; // good: foo is at the root of the crate
865+
866+
mod foo {
867+
extern mod extra;
868+
869+
use foo::extra::list; // good: foo is at crate root
870+
// use extra::*; // bad: extra is not at the crate root
871+
use self::baz::foobaz; // good: self refers to module 'foo'
872+
use foo::bar::foobar; // good: foo is at crate root
873+
874+
pub mod bar {
875+
pub fn foobar() { }
876+
}
877+
878+
pub mod baz {
879+
use super::bar::foobar; // good: super refers to module 'foo'
880+
pub fn foobaz() { }
881+
}
882+
}
883+
884+
fn main() {}
885+
~~~~
854886

855887
### Functions
856888

branches/try2/doc/tutorial-container.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,18 @@ assert_eq!(sum, 57);
160160
161161
## For loops
162162
163+
The function `range` (or `range_inclusive`) allows to simply iterate through a given range:
164+
165+
~~~
166+
for i in range(0, 5) {
167+
printf!("%d ", i) // prints "0 1 2 3 4"
168+
}
169+
170+
for i in std::iterator::range_inclusive(0, 5) { // needs explicit import
171+
printf!("%d ", i) // prints "0 1 2 3 4 5"
172+
}
173+
~~~
174+
163175
The `for` keyword can be used as sugar for iterating through any iterator:
164176
165177
~~~

branches/try2/mk/tests.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ tidy:
240240
@$(call E, check: formatting)
241241
$(Q)find $(S)src -name '*.r[sc]' \
242242
| grep '^$(S)src/test' -v \
243+
| grep '^$(S)src/libuv' -v \
244+
| grep '^$(S)src/llvm' -v \
243245
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
244246
$(Q)find $(S)src/etc -name '*.py' \
245247
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py

branches/try2/src/libextra/arc.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ mod tests {
612612
}
613613
}
614614
615-
#[test] #[should_fail] #[ignore(cfg(windows))]
615+
#[test] #[should_fail]
616616
fn test_arc_condvar_poison() {
617617
unsafe {
618618
let arc = ~MutexArc::new(1);
@@ -636,7 +636,7 @@ mod tests {
636636
}
637637
}
638638
}
639-
#[test] #[should_fail] #[ignore(cfg(windows))]
639+
#[test] #[should_fail]
640640
fn test_mutex_arc_poison() {
641641
unsafe {
642642
let arc = ~MutexArc::new(1);
@@ -651,7 +651,7 @@ mod tests {
651651
}
652652
}
653653
}
654-
#[test] #[should_fail] #[ignore(cfg(windows))]
654+
#[test] #[should_fail]
655655
pub fn test_mutex_arc_unwrap_poison() {
656656
let arc = MutexArc::new(1);
657657
let arc2 = ~(&arc).clone();
@@ -668,7 +668,7 @@ mod tests {
668668
let one = arc.unwrap();
669669
assert!(one == 1);
670670
}
671-
#[test] #[should_fail] #[ignore(cfg(windows))]
671+
#[test] #[should_fail]
672672
fn test_rw_arc_poison_wr() {
673673
let arc = ~RWArc::new(1);
674674
let arc2 = (*arc).clone();
@@ -681,7 +681,7 @@ mod tests {
681681
assert_eq!(*one, 1);
682682
}
683683
}
684-
#[test] #[should_fail] #[ignore(cfg(windows))]
684+
#[test] #[should_fail]
685685
fn test_rw_arc_poison_ww() {
686686
let arc = ~RWArc::new(1);
687687
let arc2 = (*arc).clone();
@@ -694,7 +694,7 @@ mod tests {
694694
assert_eq!(*one, 1);
695695
}
696696
}
697-
#[test] #[should_fail] #[ignore(cfg(windows))]
697+
#[test] #[should_fail]
698698
fn test_rw_arc_poison_dw() {
699699
let arc = ~RWArc::new(1);
700700
let arc2 = (*arc).clone();
@@ -709,7 +709,7 @@ mod tests {
709709
assert_eq!(*one, 1);
710710
}
711711
}
712-
#[test] #[ignore(cfg(windows))]
712+
#[test]
713713
fn test_rw_arc_no_poison_rr() {
714714
let arc = ~RWArc::new(1);
715715
let arc2 = (*arc).clone();
@@ -722,7 +722,7 @@ mod tests {
722722
assert_eq!(*one, 1);
723723
}
724724
}
725-
#[test] #[ignore(cfg(windows))]
725+
#[test]
726726
fn test_rw_arc_no_poison_rw() {
727727
let arc = ~RWArc::new(1);
728728
let arc2 = (*arc).clone();
@@ -735,7 +735,7 @@ mod tests {
735735
assert_eq!(*one, 1);
736736
}
737737
}
738-
#[test] #[ignore(cfg(windows))]
738+
#[test]
739739
fn test_rw_arc_no_poison_dr() {
740740
let arc = ~RWArc::new(1);
741741
let arc2 = (*arc).clone();

branches/try2/src/libextra/arena.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ fn test_arena_destructors() {
291291

292292
#[test]
293293
#[should_fail]
294-
#[ignore(cfg(windows))]
295294
fn test_arena_destructors_fail() {
296295
let arena = Arena::new();
297296
// Put some stuff in the arena.

branches/try2/src/libextra/c_vec.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ mod tests {
185185

186186
#[test]
187187
#[should_fail]
188-
#[ignore(cfg(windows))]
189188
fn test_overrun_get() {
190189
let cv = malloc(16u as size_t);
191190

@@ -194,7 +193,6 @@ mod tests {
194193

195194
#[test]
196195
#[should_fail]
197-
#[ignore(cfg(windows))]
198196
fn test_overrun_set() {
199197
let cv = malloc(16u as size_t);
200198

branches/try2/src/libextra/flatpipes.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -967,12 +967,10 @@ mod test {
967967
}
968968

969969
#[test]
970-
#[ignore(cfg(windows))]
971970
fn test_try_recv_none4_reader() {
972971
test_try_recv_none4(reader_port_loader);
973972
}
974973
#[test]
975-
#[ignore(cfg(windows))]
976974
fn test_try_recv_none4_pipe() {
977975
test_try_recv_none4(pipe_port_loader);
978976
}

branches/try2/src/libextra/future.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ mod test {
212212
213213
#[test]
214214
#[should_fail]
215-
#[ignore(cfg(target_os = "win32"))]
216215
fn test_futurefail() {
217216
let mut f = spawn(|| fail!());
218217
let _x: ~str = f.get();

branches/try2/src/libextra/priority_queue.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ mod tests {
338338

339339
#[test]
340340
#[should_fail]
341-
#[ignore(cfg(windows))]
342341
fn test_empty_pop() { let mut heap = PriorityQueue::new::<int>(); heap.pop(); }
343342

344343
#[test]
@@ -349,7 +348,6 @@ mod tests {
349348

350349
#[test]
351350
#[should_fail]
352-
#[ignore(cfg(windows))]
353351
fn test_empty_top() { let empty = PriorityQueue::new::<int>(); empty.top(); }
354352

355353
#[test]
@@ -360,7 +358,6 @@ mod tests {
360358

361359
#[test]
362360
#[should_fail]
363-
#[ignore(cfg(windows))]
364361
fn test_empty_replace() { let mut heap = PriorityQueue::new(); heap.replace(5); }
365362

366363
#[test]

branches/try2/src/libextra/sync.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ mod tests {
921921
assert!(!cond.signal());
922922
}
923923
}
924-
#[test] #[ignore(cfg(windows))]
924+
#[test]
925925
fn test_mutex_killed_simple() {
926926
// Mutex must get automatically unlocked if failed/killed within.
927927
let m = ~Mutex::new();
@@ -937,7 +937,7 @@ mod tests {
937937
do m.lock { }
938938
}
939939
#[ignore(reason = "linked failure")]
940-
#[test] #[ignore(cfg(windows))]
940+
#[test]
941941
fn test_mutex_killed_cond() {
942942
// Getting killed during cond wait must not corrupt the mutex while
943943
// unwinding (e.g. double unlock).
@@ -964,7 +964,7 @@ mod tests {
964964
}
965965
}
966966
#[ignore(reason = "linked failure")]
967-
#[test] #[ignore(cfg(windows))]
967+
#[test]
968968
fn test_mutex_killed_broadcast() {
969969
use std::unstable::finally::Finally;
970970

@@ -1024,7 +1024,7 @@ mod tests {
10241024
cond.wait();
10251025
}
10261026
}
1027-
#[test] #[ignore(cfg(windows))]
1027+
#[test]
10281028
fn test_mutex_different_conds() {
10291029
let result = do task::try {
10301030
let m = ~Mutex::new_with_condvars(2);
@@ -1045,7 +1045,7 @@ mod tests {
10451045
};
10461046
assert!(result.is_err());
10471047
}
1048-
#[test] #[ignore(cfg(windows))]
1048+
#[test]
10491049
fn test_mutex_no_condvars() {
10501050
let result = do task::try {
10511051
let m = ~Mutex::new_with_condvars(0);
@@ -1275,7 +1275,7 @@ mod tests {
12751275
test_rwlock_cond_broadcast_helper(12, false, true);
12761276
test_rwlock_cond_broadcast_helper(12, false, false);
12771277
}
1278-
#[cfg(test)] #[ignore(cfg(windows))]
1278+
#[cfg(test)]
12791279
fn rwlock_kill_helper(mode1: RWLockMode, mode2: RWLockMode) {
12801280
// Mutex must get automatically unlocked if failed/killed within.
12811281
let x = ~RWLock::new();
@@ -1290,23 +1290,23 @@ mod tests {
12901290
// child task must have finished by the time try returns
12911291
do lock_rwlock_in_mode(x, mode2) { }
12921292
}
1293-
#[test] #[ignore(cfg(windows))]
1293+
#[test]
12941294
fn test_rwlock_reader_killed_writer() {
12951295
rwlock_kill_helper(Read, Write);
12961296
}
1297-
#[test] #[ignore(cfg(windows))]
1297+
#[test]
12981298
fn test_rwlock_writer_killed_reader() {
12991299
rwlock_kill_helper(Write,Read );
13001300
}
1301-
#[test] #[ignore(cfg(windows))]
1301+
#[test]
13021302
fn test_rwlock_reader_killed_reader() {
13031303
rwlock_kill_helper(Read, Read );
13041304
}
1305-
#[test] #[ignore(cfg(windows))]
1305+
#[test]
13061306
fn test_rwlock_writer_killed_writer() {
13071307
rwlock_kill_helper(Write,Write);
13081308
}
1309-
#[test] #[ignore(cfg(windows))]
1309+
#[test]
13101310
fn test_rwlock_kill_downgrader() {
13111311
rwlock_kill_helper(Downgrade, Read);
13121312
rwlock_kill_helper(Read, Downgrade);
@@ -1321,7 +1321,7 @@ mod tests {
13211321
rwlock_kill_helper(Downgrade, DowngradeRead);
13221322
rwlock_kill_helper(Downgrade, DowngradeRead);
13231323
}
1324-
#[test] #[should_fail] #[ignore(cfg(windows))]
1324+
#[test] #[should_fail]
13251325
fn test_rwlock_downgrade_cant_swap() {
13261326
// Tests that you can't downgrade with a different rwlock's token.
13271327
let x = ~RWLock::new();

branches/try2/src/libextra/test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,6 @@ mod tests {
11631163
}
11641164

11651165
#[test]
1166-
#[ignore(cfg(windows))]
11671166
fn test_should_fail() {
11681167
fn f() { fail!(); }
11691168
let desc = TestDescAndFn {

branches/try2/src/librust/rust.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl ValidUsage {
4545

4646
enum Action {
4747
Call(extern "Rust" fn(args: &[~str]) -> ValidUsage),
48-
CallMain(&'static str, extern "Rust" fn()),
48+
CallMain(&'static str, extern "Rust" fn(&[~str])),
4949
}
5050

5151
enum UsageSource<'self> {
@@ -69,7 +69,7 @@ static NUM_OF_COMMANDS: uint = 7;
6969
static COMMANDS: [Command<'static>, .. NUM_OF_COMMANDS] = [
7070
Command{
7171
cmd: "build",
72-
action: CallMain("rustc", rustc::main),
72+
action: CallMain("rustc", rustc::main_args),
7373
usage_line: "compile rust source files",
7474
usage_full: UsgCall(rustc_help),
7575
},
@@ -95,19 +95,19 @@ static COMMANDS: [Command<'static>, .. NUM_OF_COMMANDS] = [
9595
},
9696
Command{
9797
cmd: "doc",
98-
action: CallMain("rustdoc", rustdoc::main),
98+
action: CallMain("rustdoc", rustdoc::main_args),
9999
usage_line: "generate documentation from doc comments",
100100
usage_full: UsgCall(rustdoc::config::usage),
101101
},
102102
Command{
103103
cmd: "pkg",
104-
action: CallMain("rustpkg", rustpkg::main),
104+
action: CallMain("rustpkg", rustpkg::main_args),
105105
usage_line: "download, build, install rust packages",
106106
usage_full: UsgCall(rustpkg::usage::general),
107107
},
108108
Command{
109109
cmd: "sketch",
110-
action: CallMain("rusti", rusti::main),
110+
action: CallMain("rusti", rusti::main_args),
111111
usage_line: "run a rust interpreter",
112112
usage_full: UsgStr("\nUsage:\trusti"),
113113
},
@@ -164,7 +164,7 @@ fn cmd_test(args: &[~str]) -> ValidUsage {
164164
[ref filename] => {
165165
let test_exec = Path(*filename).filestem().unwrap() + "test~";
166166
invoke("rustc", &[~"--test", filename.to_owned(),
167-
~"-o", test_exec.to_owned()], rustc::main);
167+
~"-o", test_exec.to_owned()], rustc::main_args);
168168
let exit_code = run::process_status(~"./" + test_exec, []);
169169
Valid(exit_code)
170170
}
@@ -177,19 +177,18 @@ fn cmd_run(args: &[~str]) -> ValidUsage {
177177
[ref filename, ..prog_args] => {
178178
let exec = Path(*filename).filestem().unwrap() + "~";
179179
invoke("rustc", &[filename.to_owned(), ~"-o", exec.to_owned()],
180-
rustc::main);
180+
rustc::main_args);
181181
let exit_code = run::process_status(~"./"+exec, prog_args);
182182
Valid(exit_code)
183183
}
184184
_ => Invalid
185185
}
186186
}
187187

188-
fn invoke(prog: &str, args: &[~str], f: &fn()) {
188+
fn invoke(prog: &str, args: &[~str], f: &fn(&[~str])) {
189189
let mut osargs = ~[prog.to_owned()];
190190
osargs.push_all_move(args.to_owned());
191-
os::set_args(osargs);
192-
f();
191+
f(osargs);
193192
}
194193

195194
fn do_command(command: &Command, args: &[~str]) -> ValidUsage {

0 commit comments

Comments
 (0)