Skip to content

Commit 936cabf

Browse files
committed
---
yaml --- r: 143839 b: refs/heads/try2 c: 828bfb2 h: refs/heads/master i: 143837: 2b98411 143835: ca40576 143831: 9de0edb 143823: c0058f8 143807: 8f39b1c v: v3
1 parent aa5c7cd commit 936cabf

File tree

339 files changed

+10148
-7979
lines changed

Some content is hidden

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

339 files changed

+10148
-7979
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: 09f4c9af13e8dcd9d0bee69db61291f0ad85f266
8+
refs/heads/try2: 828bfb2c61aaac93325b00737362769d045b6438
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: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ There are several kinds of view item:
744744
##### Extern mod declarations
745745

746746
~~~~~~~~ {.ebnf .gram}
747-
extern_mod_decl : "extern" "mod" ident [ '(' link_attrs ')' ] ? [ '=' string_lit ] ? ;
747+
extern_mod_decl : "extern" "mod" ident [ '(' link_attrs ')' ] ? ;
748748
link_attrs : link_attr [ ',' link_attrs ] + ;
749749
link_attr : ident '=' literal ;
750750
~~~~~~~~
@@ -755,34 +755,20 @@ as the `ident` provided in the `extern_mod_decl`.
755755

756756
The external crate is resolved to a specific `soname` at compile time,
757757
and a runtime linkage requirement to that `soname` is passed to the linker for
758-
loading at runtime.
759-
The `soname` is resolved at compile time by scanning the compiler's library path
760-
and matching the `link_attrs` provided in the `use_decl` against any `#link` attributes that
761-
were declared on the external crate when it was compiled.
762-
If no `link_attrs` are provided,
763-
a default `name` attribute is assumed,
764-
equal to the `ident` given in the `use_decl`.
765-
766-
Optionally, an identifier in an `extern mod` declaration may be followed by an equals sign,
767-
then a string literal denoting a relative path on the filesystem.
768-
This path should exist in one of the directories in the Rust path,
769-
which by default contains the `.rust` subdirectory of the current directory and each of its parents,
770-
as well as any directories in the colon-separated (or semicolon-separated on Windows)
771-
list of paths that is the `RUST_PATH` environment variable.
772-
The meaning of `extern mod a = "b/c/d";`, supposing that `/a` is in the RUST_PATH,
773-
is that the name `a` should be taken as a reference to the crate whose absolute location is
774-
`/a/b/c/d`.
775-
776-
Four examples of `extern mod` declarations:
758+
loading at runtime. The `soname` is resolved at compile time by scanning the
759+
compiler's library path and matching the `link_attrs` provided in the
760+
`use_decl` against any `#link` attributes that were declared on the external
761+
crate when it was compiled. If no `link_attrs` are provided, a default `name`
762+
attribute is assumed, equal to the `ident` given in the `use_decl`.
763+
764+
Three examples of `extern mod` declarations:
777765

778766
~~~~~~~~{.xfail-test}
779767
extern mod pcre (uuid = "54aba0f8-a7b1-4beb-92f1-4cf625264841");
780768
781769
extern mod extra; // equivalent to: extern mod extra ( name = "extra" );
782770
783771
extern mod rustextra (name = "extra"); // linking to 'extra' under another name
784-
785-
extern mod complicated_mod = "some-file/in/the-rust/path";
786772
~~~~~~~~
787773

788774
##### Use declarations

branches/try2/doc/tutorial-ffi.md

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -228,48 +228,6 @@ unsafe fn kaboom(ptr: *int) -> int { *ptr }
228228

229229
This function can only be called from an `unsafe` block or another `unsafe` function.
230230

231-
# Accessing foreign globals
232-
233-
Foreign APIs often export a global variable which could do something like track
234-
global state. In order to access these variables, you declare them in `extern`
235-
blocks with the `static` keyword:
236-
237-
~~~{.xfail-test}
238-
use std::libc;
239-
240-
#[link_args = "-lreadline"]
241-
extern {
242-
static rl_readline_version: libc::c_int;
243-
}
244-
245-
fn main() {
246-
println(fmt!("You have readline version %d installed.",
247-
rl_readline_version as int));
248-
}
249-
~~~
250-
251-
Alternatively, you may need to alter global state provided by a foreign
252-
interface. To do this, statics can be declared with `mut` so rust can mutate
253-
them.
254-
255-
~~~{.xfail-test}
256-
use std::libc;
257-
use std::ptr;
258-
259-
#[link_args = "-lreadline"]
260-
extern {
261-
static mut rl_prompt: *libc::c_char;
262-
}
263-
264-
fn main() {
265-
do "[my-awesome-shell] $".as_c_str |buf| {
266-
unsafe { rl_prompt = buf; }
267-
// get a line, process it
268-
unsafe { rl_prompt = ptr::null(); }
269-
}
270-
}
271-
~~~
272-
273231
# Foreign calling conventions
274232

275233
Most foreign code exposes a C ABI, and Rust uses the platform's C calling convention by default when

branches/try2/doc/tutorial-tasks.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ there is no way to "catch" the exception.
424424
All tasks are, by default, _linked_ to each other. That means that the fates
425425
of all tasks are intertwined: if one fails, so do all the others.
426426

427-
~~~{.xfail-test .linked-failure}
427+
~~~
428428
# use std::task::spawn;
429429
# use std::task;
430430
# fn do_some_work() { loop { task::yield() } }
@@ -447,7 +447,7 @@ pattern-match on a result to check whether it's an `Ok` result with an `int`
447447
field (representing a successful result) or an `Err` result (representing
448448
termination with an error).
449449

450-
~~~{.xfail-test .linked-failure}
450+
~~~
451451
# use std::task;
452452
# fn some_condition() -> bool { false }
453453
# fn calculate_result() -> int { 0 }
@@ -490,10 +490,9 @@ proceed). Hence, you will need different _linked failure modes_.
490490
By default, task failure is _bidirectionally linked_, which means that if
491491
either task fails, it kills the other one.
492492

493-
~~~{.xfail-test .linked-failure}
493+
~~~
494494
# use std::task;
495-
# use std::comm::oneshot;
496-
# fn sleep_forever() { loop { let (p, c) = oneshot::<()>(); p.recv(); } }
495+
# fn sleep_forever() { loop { task::yield() } }
497496
# do task::try {
498497
do spawn {
499498
do spawn {
@@ -512,12 +511,11 @@ function `task::try`, which we saw previously, uses `spawn_supervised`
512511
internally, with additional logic to wait for the child task to finish
513512
before returning. Hence:
514513

515-
~~~{.xfail-test .linked-failure}
514+
~~~
516515
# use std::comm::{stream, Chan, Port};
517-
# use std::comm::oneshot;
518516
# use std::task::{spawn, try};
519517
# use std::task;
520-
# fn sleep_forever() { loop { let (p, c) = oneshot::<()>(); p.recv(); } }
518+
# fn sleep_forever() { loop { task::yield() } }
521519
# do task::try {
522520
let (receiver, sender): (Port<int>, Chan<int>) = stream();
523521
do spawn { // Bidirectionally linked
@@ -543,11 +541,10 @@ also fail.
543541
Supervised task failure propagates across multiple generations even if
544542
an intermediate generation has already exited:
545543

546-
~~~{.xfail-test .linked-failure}
544+
~~~
547545
# use std::task;
548-
# use std::comm::oneshot;
549-
# fn sleep_forever() { loop { let (p, c) = oneshot::<()>(); p.recv(); } }
550-
# fn wait_for_a_while() { for _ in range(0, 1000u) { task::yield() } }
546+
# fn sleep_forever() { loop { task::yield() } }
547+
# fn wait_for_a_while() { do 1000.times { task::yield() } }
551548
# do task::try::<int> {
552549
do task::spawn_supervised {
553550
do task::spawn_supervised {
@@ -563,10 +560,10 @@ fail!(); // Will kill grandchild even if child has already exited
563560
Finally, tasks can be configured to not propagate failure to each
564561
other at all, using `task::spawn_unlinked` for _isolated failure_.
565562

566-
~~~{.xfail-test .linked-failure}
563+
~~~
567564
# use std::task;
568565
# fn random() -> uint { 100 }
569-
# fn sleep_for(i: uint) { for _ in range(0, i) { task::yield() } }
566+
# fn sleep_for(i: uint) { do i.times { task::yield() } }
570567
# do task::try::<()> {
571568
let (time1, time2) = (random(), random());
572569
do task::spawn_unlinked {
@@ -591,7 +588,7 @@ that repeatedly receives a `uint` message, converts it to a string, and sends
591588
the string in response. The child terminates when it receives `0`.
592589
Here is the function that implements the child task:
593590

594-
~~~{.xfail-test .linked-failure}
591+
~~~~
595592
# use extra::comm::DuplexStream;
596593
# use std::uint;
597594
fn stringifier(channel: &DuplexStream<~str, uint>) {
@@ -614,7 +611,7 @@ response itself is simply the stringified version of the received value,
614611

615612
Here is the code for the parent task:
616613

617-
~~~{.xfail-test .linked-failure}
614+
~~~~
618615
# use std::task::spawn;
619616
# use std::uint;
620617
# use extra::comm::DuplexStream;

branches/try2/doc/tutorial.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ match crayons[0] {
13051305
A vector can be destructured using pattern matching:
13061306
13071307
~~~~
1308-
let numbers: [int, ..3] = [1, 2, 3];
1308+
let numbers: &[int] = &[1, 2, 3];
13091309
let score = match numbers {
13101310
[] => 0,
13111311
[a] => a * 10,
@@ -1894,7 +1894,7 @@ struct TimeBomb {
18941894
18951895
impl Drop for TimeBomb {
18961896
fn drop(&self) {
1897-
for _ in range(0, self.explosivity) {
1897+
do self.explosivity.times {
18981898
println("blam!");
18991899
}
19001900
}
@@ -2288,8 +2288,8 @@ pub mod farm {
22882288
}
22892289
22902290
impl Farm {
2291-
fn feed_chickens(&self) { ... }
2292-
fn feed_cows(&self) { ... }
2291+
priv fn feed_chickens(&self) { ... }
2292+
priv fn feed_cows(&self) { ... }
22932293
pub fn add_chicken(&self, c: Chicken) { ... }
22942294
}
22952295

branches/try2/mk/install.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ endef
199199
$(foreach target,$(CFG_TARGET_TRIPLES), \
200200
$(if $(findstring $(target),"arm-linux-androideabi"), \
201201
$(if $(findstring adb,$(CFG_ADB)), \
202-
$(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
202+
$(if $(findstring device,$(shell adb devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
203203
$(info install: install-runtime-target for $(target) enabled \
204204
$(info install: android device attached) \
205205
$(eval $(call DEF_ADB_DEVICE_STATUS, true))), \

branches/try2/mk/rt.mk

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,30 @@ RUNTIME_CXXS_$(1)_$(2) := \
6666
rt/sync/timer.cpp \
6767
rt/sync/lock_and_signal.cpp \
6868
rt/sync/rust_thread.cpp \
69+
rt/rust.cpp \
6970
rt/rust_builtin.cpp \
7071
rt/rust_run_program.cpp \
7172
rt/rust_env.cpp \
7273
rt/rust_rng.cpp \
74+
rt/rust_sched_loop.cpp \
75+
rt/rust_sched_launcher.cpp \
76+
rt/rust_sched_driver.cpp \
77+
rt/rust_scheduler.cpp \
78+
rt/rust_sched_reaper.cpp \
79+
rt/rust_task.cpp \
7380
rt/rust_stack.cpp \
7481
rt/rust_upcall.cpp \
7582
rt/rust_uv.cpp \
7683
rt/rust_crate_map.cpp \
84+
rt/rust_log.cpp \
7785
rt/rust_gc_metadata.cpp \
7886
rt/rust_util.cpp \
79-
rt/rust_log.cpp \
8087
rt/rust_exchange_alloc.cpp \
8188
rt/isaac/randport.cpp \
8289
rt/miniz.cpp \
90+
rt/rust_kernel.cpp \
8391
rt/rust_abi.cpp \
92+
rt/rust_debug.cpp \
8493
rt/memory_region.cpp \
8594
rt/boxed_region.cpp \
8695
rt/arch/$$(HOST_$(1))/context.cpp \

branches/try2/mk/tests.mk

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ endef
123123
$(foreach target,$(CFG_TARGET_TRIPLES), \
124124
$(if $(findstring $(target),"arm-linux-androideabi"), \
125125
$(if $(findstring adb,$(CFG_ADB)), \
126-
$(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
126+
$(if $(findstring device,$(shell adb devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
127127
$(info check: $(target) test enabled \
128128
$(info check: android device attached) \
129129
$(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
@@ -348,9 +348,7 @@ $(3)/stage$(1)/test/rustpkgtest-$(2)$$(X_$(2)): \
348348
$$(RUSTPKG_LIB) $$(RUSTPKG_INPUTS) \
349349
$$(SREQ$(1)_T_$(2)_H_$(3)) \
350350
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX_$(2)) \
351-
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2)) \
352-
$$(TBIN$(1)_T_$(2)_H_$(3))/rustpkg$$(X_$(2)) \
353-
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(2))
351+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
354352
@$$(call E, compile_and_link: $$@)
355353
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
356354

branches/try2/src/compiletest/compiletest.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ pub fn parse_config(args: ~[~str]) -> config {
109109
compile_lib_path: getopts::opt_str(matches, "compile-lib-path"),
110110
run_lib_path: getopts::opt_str(matches, "run-lib-path"),
111111
rustc_path: opt_path(matches, "rustc-path"),
112-
clang_path: getopts::opt_maybe_str(matches, "clang-path").map_move(|s| Path(s)),
113-
llvm_bin_path: getopts::opt_maybe_str(matches, "llvm-bin-path").map_move(|s| Path(s)),
112+
clang_path: getopts::opt_maybe_str(matches, "clang-path").map(|s| Path(*s)),
113+
llvm_bin_path: getopts::opt_maybe_str(matches, "llvm-bin-path").map(|s| Path(*s)),
114114
src_base: opt_path(matches, "src-base"),
115115
build_base: opt_path(matches, "build-base"),
116116
aux_base: opt_path(matches, "aux-base"),
@@ -123,14 +123,14 @@ pub fn parse_config(args: ~[~str]) -> config {
123123
} else {
124124
None
125125
},
126-
logfile: getopts::opt_maybe_str(matches, "logfile").map_move(|s| Path(s)),
127-
save_metrics: getopts::opt_maybe_str(matches, "save-metrics").map_move(|s| Path(s)),
126+
logfile: getopts::opt_maybe_str(matches, "logfile").map(|s| Path(*s)),
127+
save_metrics: getopts::opt_maybe_str(matches, "save-metrics").map(|s| Path(*s)),
128128
ratchet_metrics:
129-
getopts::opt_maybe_str(matches, "ratchet-metrics").map_move(|s| Path(s)),
129+
getopts::opt_maybe_str(matches, "ratchet-metrics").map(|s| Path(*s)),
130130
ratchet_noise_percent:
131131
getopts::opt_maybe_str(matches,
132-
"ratchet-noise-percent").map_move(|s|
133-
f64::from_str(s).unwrap()),
132+
"ratchet-noise-percent").map(|s|
133+
f64::from_str(*s).unwrap()),
134134
runtool: getopts::opt_maybe_str(matches, "runtool"),
135135
rustcflags: getopts::opt_maybe_str(matches, "rustcflags"),
136136
jit: getopts::opt_present(matches, "jit"),

branches/try2/src/compiletest/header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ fn parse_check_line(line: &str) -> Option<~str> {
142142
fn parse_exec_env(line: &str) -> Option<(~str, ~str)> {
143143
do parse_name_value_directive(line, ~"exec-env").map |nv| {
144144
// nv is either FOO or FOO=BAR
145-
let mut strs: ~[~str] = nv.splitn_iter('=', 1).map(|s| s.to_owned()).collect();
145+
let mut strs: ~[~str] = nv.splitn_iter('=', 1).transform(|s| s.to_owned()).collect();
146146

147147
match strs.len() {
148148
1u => (strs.pop(), ~""),

branches/try2/src/compiletest/runtest.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
162162
round += 1;
163163
}
164164

165-
let mut expected = match props.pp_exact {
166-
Some(ref file) => {
165+
let mut expected =
166+
match props.pp_exact {
167+
Some(ref file) => {
167168
let filepath = testfile.dir_path().push_rel(file);
168169
io::read_whole_file_str(&filepath).unwrap()
169170
}
@@ -350,13 +351,13 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
350351
fatal(~"process did not return an error status");
351352
}
352353

353-
let prefixes = expected_errors.iter().map(|ee| {
354+
let prefixes = expected_errors.iter().transform(|ee| {
354355
fmt!("%s:%u:", testfile.to_str(), ee.line)
355356
}).collect::<~[~str]>();
356357

357358
fn to_lower( s : &str ) -> ~str {
358359
let i = s.iter();
359-
let c : ~[char] = i.map( |c| {
360+
let c : ~[char] = i.transform( |c| {
360361
if c.is_ascii() {
361362
c.to_ascii().to_lower().to_char()
362363
} else {
@@ -412,8 +413,8 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
412413
}
413414
}
414415

415-
for (i, &flag) in found_flags.iter().enumerate() {
416-
if !flag {
416+
for i in range(0u, found_flags.len()) {
417+
if !found_flags[i] {
417418
let ee = &expected_errors[i];
418419
fatal_ProcRes(fmt!("expected %s on line %u not found: %s",
419420
ee.kind, ee.line, ee.msg), ProcRes);
@@ -760,7 +761,7 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps,
760761
let cmdline = make_cmdline("", args.prog, args.args);
761762

762763
// get bare program string
763-
let mut tvec: ~[~str] = args.prog.split_iter('/').map(|ts| ts.to_owned()).collect();
764+
let mut tvec: ~[~str] = args.prog.split_iter('/').transform(|ts| ts.to_owned()).collect();
764765
let prog_short = tvec.pop();
765766

766767
// copy to target
@@ -938,7 +939,7 @@ fn disassemble_extract(config: &config, _props: &TestProps,
938939

939940
fn count_extracted_lines(p: &Path) -> uint {
940941
let x = io::read_whole_file_str(&p.with_filetype("ll")).unwrap();
941-
x.line_iter().len()
942+
x.line_iter().len_()
942943
}
943944

944945

branches/try2/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
<keyword>for</keyword>
5151
<keyword>if</keyword>
5252
<keyword>impl</keyword>
53-
<keyword>in</keyword>
5453
<keyword>let</keyword>
5554
<keyword>log</keyword>
5655
<keyword>loop</keyword>

0 commit comments

Comments
 (0)