Skip to content

Commit cbde498

Browse files
committed
---
yaml --- r: 77683 b: refs/heads/master c: c6eb3ec h: refs/heads/master i: 77681: 32a25ef 77679: 0c59b0e v: v3
1 parent f147395 commit cbde498

File tree

247 files changed

+5778
-4068
lines changed

Some content is hidden

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

247 files changed

+5778
-4068
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: c9213312951516abe66716ed11b7ea81ade572e6
2+
refs/heads/master: c6eb3ec30c945f22acac5dece7c22b0881af4be2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 60fba4d7d677ec098e6a43014132fe99f7547363
55
refs/heads/try: ebfe63cd1c0b5d23f7ea60c69b4fde2e30cfd42a

trunk/.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ src/rt/msvc/* -whitespace
88
src/rt/vg/* -whitespace
99
src/rt/linenoise/* -whitespace
1010
src/rt/jemalloc/**/* -whitespace
11+
src/rt/jemalloc/include/jemalloc/jemalloc.h.in text eol=lf
12+
src/rt/jemalloc/include/jemalloc/jemalloc_defs.h.in text eol=lf
13+
src/rt/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in text eol=lf

trunk/Makefile.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ ifdef CFG_DISABLE_OPTIMIZE
9696
$(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
9797
CFG_RUSTC_FLAGS +=
9898
else
99-
CFG_RUSTC_FLAGS += -O
99+
# The rtopt cfg turns off runtime sanity checks
100+
CFG_RUSTC_FLAGS += -O --cfg rtopt
100101
endif
101102

102103
ifdef CFG_ENABLE_DEBUG

trunk/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}

trunk/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
~~~

trunk/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.

trunk/doc/tutorial.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,7 @@ so you could not apply `head` to a type
18641864
that does not implement `Clone`.
18651865

18661866
While most traits can be defined and implemented by user code,
1867-
two traits are automatically derived and implemented
1867+
three traits are automatically derived and implemented
18681868
for all applicable types by the compiler,
18691869
and may not be overridden:
18701870

@@ -1877,6 +1877,12 @@ These are types that do not contain anything intrinsically mutable.
18771877
Intrinsically mutable values include `@mut`
18781878
and `Cell` in the standard library.
18791879

1880+
* `'static` - Non-borrowed types.
1881+
These are types that do not contain any data whose lifetime is bound to
1882+
a particular stack frame. These are types that do not contain any
1883+
borrowed pointers, or types where the only contained borrowed pointers
1884+
have the `'static` lifetime.
1885+
18801886
> ***Note:*** These two traits were referred to as 'kinds' in earlier
18811887
> iterations of the language, and often still are.
18821888
@@ -2135,6 +2141,30 @@ select the method to call at runtime.
21352141

21362142
This usage of traits is similar to Java interfaces.
21372143

2144+
By default, each of the three storage classes for traits enforce a
2145+
particular set of built-in kinds that their contents must fulfill in
2146+
order to be packaged up in a trait object of that storage class.
2147+
2148+
* The contents of owned traits (`~Trait`) must fulfill the `Send` bound.
2149+
* The contents of managed traits (`@Trait`) must fulfill the `'static` bound.
2150+
* The contents of borrowed traits (`&Trait`) are not constrained by any bound.
2151+
2152+
Consequently, the trait objects themselves automatically fulfill their
2153+
respective kind bounds. However, this default behavior can be overridden by
2154+
specifying a list of bounds on the trait type, for example, by writing `~Trait:`
2155+
(which indicates that the contents of the owned trait need not fulfill any
2156+
bounds), or by writing `~Trait:Send+Freeze`, which indicates that in addition
2157+
to fulfilling `Send`, contents must also fulfill `Freeze`, and as a consequence,
2158+
the trait itself fulfills `Freeze`.
2159+
2160+
* `~Trait:Send` is equivalent to `~Trait`.
2161+
* `@Trait:'static` is equivalent to `@Trait`.
2162+
* `&Trait:` is equivalent to `&Trait`.
2163+
2164+
Builtin kind bounds can also be specified on closure types in the same way (for
2165+
example, by writing `fn:Freeze()`), and the default behaviours are the same as
2166+
for traits of the same storage class.
2167+
21382168
## Trait inheritance
21392169

21402170
We can write a trait declaration that _inherits_ from other traits, called _supertraits_.

trunk/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

trunk/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

trunk/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 \

trunk/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; \

trunk/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>,

trunk/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)