Skip to content

Commit 8295243

Browse files
committed
---
yaml --- r: 85728 b: refs/heads/dist-snap c: c678b22 h: refs/heads/master v: v3
1 parent ab81f06 commit 8295243

File tree

6 files changed

+38
-62
lines changed

6 files changed

+38
-62
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 0983ebe5310d4eb6d289f636f7ed0536c08bbc0e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 2fb5c49abbab97820f24b8574e574dde1f344249
9+
refs/heads/dist-snap: c678b22276137afff71baeef9ccd7ba23765705e
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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_.

branches/dist-snap/mk/tests.mk

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

7474
# Whether to ratchet or merely save benchmarks
7575
ifdef CFG_RATCHET_BENCH
76-
CRATE_TEST_EXTRA_ARGS=\
76+
CRATE_TEST_BENCH_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_EXTRA_ARGS=\
81+
CRATE_TEST_BENCH_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-
9486
define DEF_TARGET_COMMANDS
9587

9688
ifdef CFG_UNIXY_$(1)
@@ -409,7 +401,7 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
409401
@$$(call E, run: $$<)
410402
$$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) $$(TESTARGS) \
411403
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
412-
$$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \
404+
$$(call CRATE_TEST_BENCH_ARGS,$(1),$(2),$(3),$(4)) \
413405
&& touch $$@
414406
endef
415407

@@ -423,7 +415,7 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
423415
@$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=. \
424416
./$$(notdir $$<) \
425417
--logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \
426-
$$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)))' \
418+
$$(call CRATE_TEST_BENCH_ARGS,$(1),$(2),$(3),$(4)))' \
427419
> tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
428420
@cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
429421
@touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log

branches/dist-snap/src/compiletest/common.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ 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-
7671
// A command line to prefix program execution with,
7772
// for running under valgrind
7873
runtool: Option<~str>,

branches/dist-snap/src/compiletest/compiletest.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ 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"),
7978
optflag("h", "help", "show this message"),
8079
];
8180

@@ -149,7 +148,6 @@ pub fn parse_config(args: ~[~str]) -> config {
149148
~"") { true }
150149
else { false }
151150
} else { false },
152-
test_shard: test::opt_shard(getopts::opt_maybe_str(matches, "test-shard")),
153151
verbose: getopts::opt_present(matches, "verbose")
154152
}
155153
}
@@ -174,10 +172,6 @@ pub fn log_config(config: &config) {
174172
logv(c, fmt!("adb_path: %s", config.adb_path));
175173
logv(c, fmt!("adb_test_dir: %s", config.adb_test_dir));
176174
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-
}
181175
logv(c, fmt!("verbose: %b", config.verbose));
182176
logv(c, fmt!("\n"));
183177
}
@@ -240,7 +234,6 @@ pub fn test_opts(config: &config) -> test::TestOpts {
240234
ratchet_metrics: config.ratchet_metrics.clone(),
241235
ratchet_noise_percent: config.ratchet_noise_percent.clone(),
242236
save_metrics: config.save_metrics.clone(),
243-
test_shard: config.test_shard.clone()
244237
}
245238
}
246239

branches/dist-snap/src/libextra/test.rs

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ use std::task;
3838
use std::to_str::ToStr;
3939
use std::f64;
4040
use std::os;
41-
use std::uint;
4241

4342

4443
// The name of a test. By convention this follows the rules for rust
@@ -165,7 +164,6 @@ pub struct TestOpts {
165164
ratchet_metrics: Option<Path>,
166165
ratchet_noise_percent: Option<f64>,
167166
save_metrics: Option<Path>,
168-
test_shard: Option<(uint,uint)>,
169167
logfile: Option<Path>
170168
}
171169

@@ -186,9 +184,7 @@ fn optgroups() -> ~[getopts::groups::OptGroup] {
186184
"Tests within N% of the recorded metrics will be \
187185
considered as passing", "PERCENTAGE"),
188186
groups::optopt("", "logfile", "Write logs to the specified file instead \
189-
of stdout", "PATH"),
190-
groups::optopt("", "test-shard", "run shard A, of B shards, worth of the testsuite",
191-
"A.B")]
187+
of stdout", "PATH")]
192188
}
193189

194190
fn usage(binary: &str, helpstr: &str) -> ! {
@@ -259,9 +255,6 @@ pub fn parse_opts(args: &[~str]) -> OptRes {
259255
let save_metrics = getopts::opt_maybe_str(&matches, "save-metrics");
260256
let save_metrics = save_metrics.map_move(|s| Path(s));
261257

262-
let test_shard = getopts::opt_maybe_str(&matches, "test-shard");
263-
let test_shard = opt_shard(test_shard);
264-
265258
let test_opts = TestOpts {
266259
filter: filter,
267260
run_ignored: run_ignored,
@@ -270,29 +263,12 @@ pub fn parse_opts(args: &[~str]) -> OptRes {
270263
ratchet_metrics: ratchet_metrics,
271264
ratchet_noise_percent: ratchet_noise_percent,
272265
save_metrics: save_metrics,
273-
test_shard: test_shard,
274266
logfile: logfile
275267
};
276268

277269
either::Left(test_opts)
278270
}
279271

280-
pub fn opt_shard(maybestr: Option<~str>) -> Option<(uint,uint)> {
281-
match maybestr {
282-
None => None,
283-
Some(s) => {
284-
match s.split_iter('.').to_owned_vec() {
285-
[a, b] => match (uint::from_str(a), uint::from_str(b)) {
286-
(Some(a), Some(b)) => Some((a,b)),
287-
_ => None
288-
},
289-
_ => None
290-
}
291-
}
292-
}
293-
}
294-
295-
296272
#[deriving(Clone, Eq)]
297273
pub struct BenchSamples {
298274
ns_iter_summ: stats::Summary,
@@ -796,15 +772,7 @@ pub fn filter_tests(
796772
}
797773
sort::quick_sort(filtered, lteq);
798774

799-
// Shard the remaining tests, if sharding requested.
800-
match opts.test_shard {
801-
None => filtered,
802-
Some((a,b)) =>
803-
filtered.move_iter().enumerate()
804-
.filter(|&(i,_)| i % b == a)
805-
.map(|(_,t)| t)
806-
.to_owned_vec()
807-
}
775+
filtered
808776
}
809777

810778
struct TestFuture {
@@ -1266,7 +1234,6 @@ mod tests {
12661234
ratchet_noise_percent: None,
12671235
ratchet_metrics: None,
12681236
save_metrics: None,
1269-
test_shard: None
12701237
};
12711238

12721239
let tests = ~[
@@ -1305,7 +1272,6 @@ mod tests {
13051272
ratchet_noise_percent: None,
13061273
ratchet_metrics: None,
13071274
save_metrics: None,
1308-
test_shard: None
13091275
};
13101276
13111277
let names =

0 commit comments

Comments
 (0)