Skip to content

Commit 1299b8e

Browse files
committed
---
yaml --- r: 143855 b: refs/heads/try2 c: b9945f8 h: refs/heads/master i: 143853: 48301eb 143851: 7dcbe55 143847: eb37c5a 143839: 936cabf v: v3
1 parent a96b514 commit 1299b8e

File tree

296 files changed

+9578
-5700
lines changed

Some content is hidden

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

296 files changed

+9578
-5700
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: bf809768ee8ff3ea4ef434721ff82b09a4df261a
8+
refs/heads/try2: b9945f83c90ad1e28686de483be03cbfc34080be
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.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] = &[1, 2, 3];
1308+
let numbers: [int, ..3] = [1, 2, 3];
13091309
let score = match numbers {
13101310
[] => 0,
13111311
[a] => a * 10,
@@ -2195,7 +2195,7 @@ use std::float::consts::pi;
21952195
# impl Shape for CircleStruct { fn area(&self) -> float { pi * square(self.radius) } }
21962196
21972197
let concrete = @CircleStruct{center:Point{x:3f,y:4f},radius:5f};
2198-
let mycircle: @Circle = concrete as @Circle;
2198+
let mycircle: Circle = concrete as @Circle;
21992199
let nonsense = mycircle.radius() * mycircle.area();
22002200
~~~
22012201

@@ -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/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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,13 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
350350
fatal(~"process did not return an error status");
351351
}
352352

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

357357
fn to_lower( s : &str ) -> ~str {
358358
let i = s.iter();
359-
let c : ~[char] = i.map( |c| {
359+
let c : ~[char] = i.transform( |c| {
360360
if c.is_ascii() {
361361
c.to_ascii().to_lower().to_char()
362362
} else {
@@ -412,8 +412,8 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
412412
}
413413
}
414414

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

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

766766
// copy to target
@@ -938,7 +938,7 @@ fn disassemble_extract(config: &config, _props: &TestProps,
938938

939939
fn count_extracted_lines(p: &Path) -> uint {
940940
let x = io::read_whole_file_str(&p.with_filetype("ll")).unwrap();
941-
x.line_iter().len()
941+
x.line_iter().len_()
942942
}
943943

944944

branches/try2/src/etc/emacs/rust-mode.el

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@
2929

3030
table))
3131

32-
(defcustom rust-indent-offset default-tab-width
33-
"*Indent Rust code by this number of spaces.
34-
35-
The initializer is `DEFAULT-TAB-WIDTH'.")
36-
3732
(defun rust-paren-level () (nth 0 (syntax-ppss)))
3833
(defun rust-in-str-or-cmnt () (nth 8 (syntax-ppss)))
3934
(defun rust-rewind-past-str-cmnt () (goto-char (nth 8 (syntax-ppss))))
@@ -54,10 +49,10 @@ The initializer is `DEFAULT-TAB-WIDTH'.")
5449
(let ((level (rust-paren-level)))
5550
(cond
5651
;; A function return type is 1 level indented
57-
((looking-at "->") (* rust-indent-offset (+ level 1)))
52+
((looking-at "->") (* default-tab-width (+ level 1)))
5853

5954
;; A closing brace is 1 level unindended
60-
((looking-at "}") (* rust-indent-offset (- level 1)))
55+
((looking-at "}") (* default-tab-width (- level 1)))
6156

6257
;; If we're in any other token-tree / sexp, then:
6358
;; - [ or ( means line up with the opening token
@@ -75,18 +70,18 @@ The initializer is `DEFAULT-TAB-WIDTH'.")
7570
(goto-char pt)
7671
(back-to-indentation)
7772
(if (looking-at "\\<else\\>")
78-
(* rust-indent-offset (+ 1 level))
73+
(* default-tab-width (+ 1 level))
7974
(progn
8075
(goto-char pt)
8176
(beginning-of-line)
8277
(rust-rewind-irrelevant)
8378
(end-of-line)
8479
(if (looking-back "[{};,]")
85-
(* rust-indent-offset level)
80+
(* default-tab-width level)
8681
(back-to-indentation)
8782
(if (looking-at "#")
88-
(* rust-indent-offset level)
89-
(* rust-indent-offset (+ 1 level))))))))))
83+
(* default-tab-width level)
84+
(* default-tab-width (+ 1 level))))))))))
9085

9186
;; Otherwise we're in a column-zero definition
9287
(t 0))))))

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>

branches/try2/src/libextra/arc.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -596,14 +596,14 @@ mod tests {
596596
let (c,p) = (Cell::new(c), Cell::new(p));
597597
do task::spawn || {
598598
// wait until parent gets in
599-
p.take().recv();
599+
comm::recv_one(p.take());
600600
do arc2.access_cond |state, cond| {
601601
*state = true;
602602
cond.signal();
603603
}
604604
}
605605
do arc.access_cond |state, cond| {
606-
c.take().send(());
606+
comm::send_one(c.take(), ());
607607
assert!(!*state);
608608
while !*state {
609609
cond.wait();
@@ -847,16 +847,22 @@ mod tests {
847847
}
848848
assert_eq!(*state, 42);
849849
*state = 31337;
850+
// FIXME: #7372: hits type inference bug with iterators
850851
// send to other readers
851-
for &(ref rc, _) in reader_convos.iter() {
852-
rc.send(())
852+
for i in range(0u, reader_convos.len()) {
853+
match reader_convos[i] {
854+
(ref rc, _) => rc.send(()),
855+
}
853856
}
854857
}
855858
let read_mode = arc.downgrade(write_mode);
856859
do (&read_mode).read |state| {
860+
// FIXME: #7372: hits type inference bug with iterators
857861
// complete handshake with other readers
858-
for &(_, ref rp) in reader_convos.iter() {
859-
rp.recv()
862+
for i in range(0u, reader_convos.len()) {
863+
match reader_convos[i] {
864+
(_, ref rp) => rp.recv(),
865+
}
860866
}
861867
wc1.send(()); // tell writer to try again
862868
assert_eq!(*state, 31337);

0 commit comments

Comments
 (0)