Skip to content

Commit a7d2fb7

Browse files
committed
---
yaml --- r: 144349 b: refs/heads/try2 c: 424e8f0 h: refs/heads/master i: 144347: 2e2f03c v: v3
1 parent cd01ab4 commit a7d2fb7

File tree

142 files changed

+2903
-2165
lines changed

Some content is hidden

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

142 files changed

+2903
-2165
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: 3b9e2efd64c7683a4fd8dd9126cc0473dc2201af
8+
refs/heads/try2: 424e8f0fd55b94a45ebe112dc77312e3fab1ebfe
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: 53 additions & 11 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

@@ -1006,20 +1038,25 @@ code_. They are defined in the same way as any other Rust function,
10061038
except that they have the `extern` modifier.
10071039

10081040
~~~
1041+
// Declares an extern fn, the ABI defaults to "C"
10091042
extern fn new_vec() -> ~[int] { ~[] }
1043+
1044+
// Declares an extern fn with "stdcall" ABI
1045+
extern "stdcall" fn new_vec_stdcall() -> ~[int] { ~[] }
10101046
~~~
10111047

1012-
Extern functions may not be called from Rust code,
1013-
but Rust code may take their value as a raw `u8` pointer.
1048+
Unlike normal functions, extern fns have an `extern "ABI" fn()`.
1049+
This is the same type as the functions declared in an extern
1050+
block.
10141051

10151052
~~~
10161053
# extern fn new_vec() -> ~[int] { ~[] }
1017-
let fptr: *u8 = new_vec;
1054+
let fptr: extern "C" fn() -> ~[int] = new_vec;
10181055
~~~
10191056

1020-
The primary motivation for extern functions is
1021-
to create callbacks for foreign functions that expect to receive function
1022-
pointers.
1057+
Extern functions may be called from Rust code, but
1058+
caution must be taken with respect to the size of the stack
1059+
segment, just as when calling an extern function normally.
10231060

10241061
### Type definitions
10251062

@@ -1384,14 +1421,13 @@ between the Rust ABI and the foreign ABI.
13841421
A number of [attributes](#attributes) control the behavior of external
13851422
blocks.
13861423

1387-
By default external blocks assume
1388-
that the library they are calling uses the standard C "cdecl" ABI.
1389-
Other ABIs may be specified using the `abi` attribute as in
1424+
By default external blocks assume that the library they are calling
1425+
uses the standard C "cdecl" ABI. Other ABIs may be specified using
1426+
an `abi` string, as shown here:
13901427

13911428
~~~{.xfail-test}
13921429
// Interface to the Windows API
1393-
#[abi = "stdcall"]
1394-
extern { }
1430+
extern "stdcall" { }
13951431
~~~
13961432

13971433
The `link_name` attribute allows the name of the library to be specified.
@@ -1407,6 +1443,12 @@ This is particularly useful for creating external blocks for libc,
14071443
which tends to not follow standard library naming conventions
14081444
and is linked to all Rust programs anyway.
14091445

1446+
The type of a function
1447+
declared in an extern block
1448+
is `extern "abi" fn(A1, ..., An) -> R`,
1449+
where `A1...An` are the declared types of its arguments
1450+
and `R` is the decalred return type.
1451+
14101452
## Attributes
14111453

14121454
~~~~~~~~{.ebnf .gram}

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/doc/tutorial-ffi.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,8 @@ prefer using raw pointers (`*`) if that's needed because the compiler can't make
445445
about them.
446446

447447
Vectors and strings share the same basic memory layout, and utilities are available in the `vec` and
448-
`str` modules for working with C APIs. Strings are terminated with `\0` for interoperability with C,
449-
but it should not be assumed because a slice will not always be nul-terminated. Instead, the
450-
`str::as_c_str` function should be used.
448+
`str` modules for working with C APIs. However, strings are not terminated with `\0`. If you need a
449+
NUL-terminated string for interoperability with C, you should use the `c_str::to_c_str` function.
451450

452451
The standard library includes type aliases and function definitions for the C standard library in
453452
the `libc` module, and Rust links against `libc` and `libm` by default.

branches/try2/mk/llvm.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ifeq ($(CFG_LLVM_ROOT),)
2626

2727
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS)
2828
@$$(call E, make: llvm)
29-
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) $$(CFG_LLVM_BUILD_ENV)
29+
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1))
3030
$$(Q)touch $$(LLVM_CONFIG_$(1))
3131
endif
3232

branches/try2/mk/platform.mk

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ endef
2626
$(foreach t,$(CFG_TARGET_TRIPLES),$(eval $(call DEF_OSTYPE_VAR,$(t))))
2727
$(foreach t,$(CFG_TARGET_TRIPLES),$(info cfg: os for $(t) is $(OSTYPE_$(t))))
2828

29-
# FIXME: no-omit-frame-pointer is just so that task_start_wrapper
30-
# has a frame pointer and the stack walker can understand it. Turning off
31-
# frame pointers everywhere is overkill
32-
CFG_GCCISH_CFLAGS += -fno-omit-frame-pointer -DUSE_UTF8
29+
CFG_GCCISH_CFLAGS += -DUSE_UTF8
3330

3431
# On Darwin, we need to run dsymutil so the debugging information ends
3532
# up in the right place. On other platforms, it automatically gets
@@ -153,7 +150,6 @@ CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-linux-gnu := -Wl,-no-whole-archive
153150
CFG_DEF_SUFFIX_x86_64-unknown-linux-gnu := .linux.def
154151
CFG_INSTALL_NAME_x86_64-unknown-linux-gnu =
155152
CFG_LIBUV_LINK_FLAGS_x86_64-unknown-linux-gnu =
156-
CFG_LLVM_BUILD_ENV_x86_64-unknown-linux-gnu="CXXFLAGS=-fno-omit-frame-pointer"
157153
CFG_EXE_SUFFIX_x86_64-unknown-linux-gnu =
158154
CFG_WINDOWSY_x86_64-unknown-linux-gnu :=
159155
CFG_UNIXY_x86_64-unknown-linux-gnu := 1
@@ -179,7 +175,6 @@ CFG_GCCISH_POST_LIB_FLAGS_i686-unknown-linux-gnu := -Wl,-no-whole-archive
179175
CFG_DEF_SUFFIX_i686-unknown-linux-gnu := .linux.def
180176
CFG_INSTALL_NAME_i686-unknown-linux-gnu =
181177
CFG_LIBUV_LINK_FLAGS_i686-unknown-linux-gnu =
182-
CFG_LLVM_BUILD_ENV_i686-unknown-linux-gnu="CXXFLAGS=-fno-omit-frame-pointer"
183178
CFG_EXE_SUFFIX_i686-unknown-linux-gnu =
184179
CFG_WINDOWSY_i686-unknown-linux-gnu :=
185180
CFG_UNIXY_i686-unknown-linux-gnu := 1

branches/try2/mk/rt.mk

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ endif
6363
endif
6464

6565
RUNTIME_CXXS_$(1)_$(2) := \
66-
rt/sync/timer.cpp \
6766
rt/sync/lock_and_signal.cpp \
6867
rt/sync/rust_thread.cpp \
6968
rt/rust_builtin.cpp \
@@ -72,13 +71,9 @@ RUNTIME_CXXS_$(1)_$(2) := \
7271
rt/rust_upcall.cpp \
7372
rt/rust_uv.cpp \
7473
rt/rust_crate_map.cpp \
75-
rt/rust_gc_metadata.cpp \
76-
rt/rust_util.cpp \
7774
rt/rust_log.cpp \
78-
rt/rust_exchange_alloc.cpp \
7975
rt/isaac/randport.cpp \
8076
rt/miniz.cpp \
81-
rt/rust_abi.cpp \
8277
rt/memory_region.cpp \
8378
rt/boxed_region.cpp \
8479
rt/arch/$$(HOST_$(1))/context.cpp \

branches/try2/mk/tests.mk

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,24 @@ TEST_RATCHET_NOISE_PERCENT=10.0
7373

7474
# Whether to ratchet or merely save benchmarks
7575
ifdef CFG_RATCHET_BENCH
76-
CRATE_TEST_BENCH_ARGS=\
76+
CRATE_TEST_EXTRA_ARGS=\
7777
--test $(TEST_BENCH) \
7878
--ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
7979
--ratchet-noise-percent $(TEST_RATCHET_NOISE_PERCENT)
8080
else
81-
CRATE_TEST_BENCH_ARGS=\
81+
CRATE_TEST_EXTRA_ARGS=\
8282
--test $(TEST_BENCH) \
8383
--save-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4))
8484
endif
8585

86+
# If we're sharding the testsuite between parallel testers,
87+
# pass this argument along to the compiletest and crate test
88+
# invocations.
89+
ifdef TEST_SHARD
90+
CTEST_TESTARGS += --test-shard=$(TEST_SHARD)
91+
CRATE_TEST_EXTRA_ARGS += --test-shard=$(TEST_SHARD)
92+
endif
93+
8694
define DEF_TARGET_COMMANDS
8795

8896
ifdef CFG_UNIXY_$(1)
@@ -144,8 +152,9 @@ CFG_ADB_TEST_DIR=/data/tmp
144152

145153
$(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
146154
$(shell adb remount 1>/dev/null) \
147-
$(shell adb shell mkdir $(CFG_ADB_TEST_DIR) 1>/dev/null) \
148-
$(shell adb shell rm -rf $(CFG_ADB_TEST_DIR)/* 1>/dev/null) \
155+
$(shell adb shell rm -r $(CFG_ADB_TEST_DIR) >/dev/null) \
156+
$(shell adb shell mkdir $(CFG_ADB_TEST_DIR)) \
157+
$(shell adb shell mkdir $(CFG_ADB_TEST_DIR)/tmp) \
149158
$(shell adb push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
150159
$(shell adb push $(CFG_ANDROID_CROSS_PATH)/arm-linux-androideabi/lib/armv7-a/libgnustl_shared.so \
151160
$(CFG_ADB_TEST_DIR) 1>/dev/null) \
@@ -239,6 +248,8 @@ tidy:
239248
@$(call E, check: formatting)
240249
$(Q)find $(S)src -name '*.r[sc]' \
241250
| grep '^$(S)src/test' -v \
251+
| grep '^$(S)src/libuv' -v \
252+
| grep '^$(S)src/llvm' -v \
242253
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
243254
$(Q)find $(S)src/etc -name '*.py' \
244255
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
@@ -398,7 +409,7 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
398409
@$$(call E, run: $$<)
399410
$$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) $$(TESTARGS) \
400411
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
401-
$$(call CRATE_TEST_BENCH_ARGS,$(1),$(2),$(3),$(4)) \
412+
$$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \
402413
&& touch $$@
403414
endef
404415

@@ -409,14 +420,16 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
409420
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
410421
@$$(call E, run: $$< via adb)
411422
@$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
412-
@$(CFG_ADB) shell LD_LIBRARY_PATH=$(CFG_ADB_TEST_DIR) \
413-
$(CFG_ADB_TEST_DIR)/`echo $$< | sed 's/.*\///'` \
414-
--logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log > \
415-
tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
423+
@$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=. \
424+
./$$(notdir $$<) \
425+
--logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \
426+
$$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)))' \
427+
> tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
416428
@cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
417429
@touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
418430
@$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
419431
@$(CFG_ADB) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
432+
@$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/$$(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) tmp/
420433
@if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
421434
then \
422435
rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \

branches/try2/src/compiletest/common.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ pub struct config {
6868
// Percent change in metrics to consider noise
6969
ratchet_noise_percent: Option<f64>,
7070

71+
// "Shard" of the testsuite to run: this has the form of
72+
// two numbers (a,b), and causes only those tests with
73+
// positional order equal to a mod b to run.
74+
test_shard: Option<(uint,uint)>,
75+
7176
// A command line to prefix program execution with,
7277
// for running under valgrind
7378
runtool: Option<~str>,

branches/try2/src/compiletest/compiletest.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ pub fn parse_config(args: ~[~str]) -> config {
7575
optopt("", "target", "the target to build for", "TARGET"),
7676
optopt("", "adb-path", "path to the android debugger", "PATH"),
7777
optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"),
78+
optopt("", "test-shard", "run shard A, of B shards, worth of the testsuite", "A.B"),
7879
optflag("h", "help", "show this message"),
7980
];
8081

@@ -148,6 +149,7 @@ pub fn parse_config(args: ~[~str]) -> config {
148149
~"") { true }
149150
else { false }
150151
} else { false },
152+
test_shard: test::opt_shard(getopts::opt_maybe_str(matches, "test-shard")),
151153
verbose: getopts::opt_present(matches, "verbose")
152154
}
153155
}
@@ -172,6 +174,10 @@ pub fn log_config(config: &config) {
172174
logv(c, fmt!("adb_path: %s", config.adb_path));
173175
logv(c, fmt!("adb_test_dir: %s", config.adb_test_dir));
174176
logv(c, fmt!("adb_device_status: %b", config.adb_device_status));
177+
match config.test_shard {
178+
None => logv(c, ~"test_shard: (all)"),
179+
Some((a,b)) => logv(c, fmt!("test_shard: %u.%u", a, b))
180+
}
175181
logv(c, fmt!("verbose: %b", config.verbose));
176182
logv(c, fmt!("\n"));
177183
}
@@ -234,6 +240,7 @@ pub fn test_opts(config: &config) -> test::TestOpts {
234240
ratchet_metrics: config.ratchet_metrics.clone(),
235241
ratchet_noise_percent: config.ratchet_noise_percent.clone(),
236242
save_metrics: config.save_metrics.clone(),
243+
test_shard: config.test_shard.clone()
237244
}
238245
}
239246

0 commit comments

Comments
 (0)