rust/src/test/run-fail
Alex Crichton 36f5d122b8 rollup merge of #20615: aturon/stab-2-thread
This commit takes a first pass at stabilizing `std::thread`:

* It removes the `detach` method in favor of two constructors -- `spawn`
  for detached threads, `scoped` for "scoped" (i.e., must-join)
  threads. This addresses some of the surprise/frustrating debug
  sessions with the previous API, in which `spawn` produced a guard that
  on destruction joined the thread (unless `detach` was called).

  The reason to have the division in part is that `Send` will soon not
  imply `'static`, which means that `scoped` thread creation can take a
  closure over *shared stack data* of the parent thread. On the other
  hand, this means that the parent must not pop the relevant stack
  frames while the child thread is running. The `JoinGuard` is used to
  prevent this from happening by joining on drop (if you have not
  already explicitly `join`ed.) The APIs around `scoped` are
  future-proofed for the `Send` changes by taking an additional lifetime
  parameter. With the current definition of `Send`, this is forced to be
  `'static`, but when `Send` changes these APIs will gain their full
  flexibility immediately.

  Threads that are `spawn`ed, on the other hand, are detached from the
  start and do not yield an RAII guard.

  The hope is that, by making `scoped` an explicit opt-in with a very
  suggestive name, it will be drastically less likely to be caught by a
  surprising deadlock due to an implicit join at the end of a scope.

* The module itself is marked stable.

* Existing methods other than `spawn` and `scoped` are marked stable.

The migration path is:

```rust
Thread::spawn(f).detached()
```

becomes

```rust
Thread::spawn(f)
```

while

```rust
let res = Thread::spawn(f);
res.join()
```

becomes

```rust
let res = Thread::scoped(f);
res.join()
```

[breaking-change]
2015-01-06 15:38:38 -08:00
..
args-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
assert-as-macro.rs syntax/rustc: implement isize/usize 2015-01-06 15:15:07 -05:00
assert-eq-macro-panic.rs core: split into fmt::Show and fmt::String 2015-01-06 14:49:42 -08:00
assert-macro-explicit.rs Update infrastructure for fail -> panic 2014-10-29 16:06:13 -04:00
assert-macro-fmt.rs Update infrastructure for fail -> panic 2014-10-29 16:06:13 -04:00
assert-macro-owned.rs Update infrastructure for fail -> panic 2014-10-29 16:06:13 -04:00
assert-macro-static.rs Update infrastructure for fail -> panic 2014-10-29 16:06:13 -04:00
binop-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
bounds-check-no-overflow.rs librustc: Remove the fallback to int for integers and f64 for 2014-06-29 11:47:58 -07:00
bug-811.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
bug-2470-bounds-check-overflow-2.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
bug-2470-bounds-check-overflow-3.rs Initial version of AArch64 support. 2015-01-03 15:16:10 +00:00
bug-2470-bounds-check-overflow.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
die-macro-expr.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
die-macro-pure.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
die-macro.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
divide-by-zero.rs librustc: Remove the fallback to int for integers and f64 for 2014-06-29 11:47:58 -07:00
doublepanic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
dst-raw-slice.rs Reviewer changes 2014-09-02 19:47:39 +12:00
explicit-panic-msg.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
explicit-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
expr-fn-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
expr-if-panic-fn.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
expr-if-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
expr-match-panic-fn.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
expr-match-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
extern-panic.rs Mostly rote conversion of proc() to move|| (and occasionally Thunk::new) 2014-12-14 04:21:56 -05:00
fmt-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
for-each-loop-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
glob-use-std.rs Remove use of globs feature gate from tests. 2015-01-05 20:00:10 +11:00
hashmap-capacity-overflow.rs refactor libcollections as part of collection reform 2014-11-02 18:58:11 -05:00
if-check-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
if-cond-bot.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
issue-948.rs rollup merge of #18398 : aturon/lint-conventions-2 2014-10-30 17:37:22 -07:00
issue-2061.rs test: Clean out the test suite a bit 2014-02-25 09:21:09 -08:00
issue-2444.rs Update infrastructure for fail -> panic 2014-10-29 16:06:13 -04:00
issue-2761.rs librustc: Remove fail_unless! 2013-03-29 16:39:08 -07:00
issue-3029.rs rollup merge of #18398 : aturon/lint-conventions-2 2014-10-30 17:37:22 -07:00
issue-6458-1.rs Implement numeric fallback 2015-01-01 17:12:15 -05:00
issue-12920.rs Update infrastructure for fail -> panic 2014-10-29 16:06:13 -04:00
issue-13202.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
issue-18576.rs librustc: Call return_type only for functions. 2014-11-04 22:44:02 -05:00
main-panic.rs Revise std::thread API to join by default 2014-12-18 23:31:52 -08:00
match-bot-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
match-disc-bot.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
match-wildcards.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
mod-zero.rs librustc: Remove the fallback to int for integers and f64 for 2014-06-29 11:47:58 -07:00
panic-arg.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
panic-macro-any-wrapped.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
panic-macro-any.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
panic-macro-explicit.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
panic-macro-fmt.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
panic-macro-owned.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
panic-macro-static.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
panic-main.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
panic-parens.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
panic-task-name-none.rs Fallout from stabilization 2015-01-06 14:57:52 -08:00
panic-task-name-owned.rs Fallout from stabilization 2015-01-06 14:57:52 -08:00
panic.rs syntax/rustc: implement isize/usize 2015-01-06 15:15:07 -05:00
result-get-panic.rs Utilize fewer reexports 2014-12-05 18:13:04 -05:00
rhs-type.rs rollup merge of #18398 : aturon/lint-conventions-2 2014-10-30 17:37:22 -07:00
rt-set-exit-status-panic.rs Replace #[phase] with #[plugin] / #[macro_use] / #[no_link] 2015-01-05 18:21:13 -08:00
rt-set-exit-status-panic2.rs Replace #[phase] with #[plugin] / #[macro_use] / #[no_link] 2015-01-05 18:21:13 -08:00
rt-set-exit-status.rs Replace #[phase] with #[plugin] / #[macro_use] / #[no_link] 2015-01-05 18:21:13 -08:00
run-unexported-tests.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
str-overrun.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
task-spawn-barefn.rs Fallout from stabilization 2015-01-06 14:57:52 -08:00
test-panic.rs Revise std::thread API to join by default 2014-12-18 23:31:52 -08:00
test-should-fail-bad-message.rs Revise std::thread API to join by default 2014-12-18 23:31:52 -08:00
test-tasks-invalid-value.rs compiletest: Test --pretty expanded 2014-05-13 17:24:08 -07:00
tls-exit-status.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
too-much-recursion-unwinding.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
unimplemented-macro-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
unique-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
unreachable-fmt-msg.rs Add optional messages to the unreachable macro. 2014-11-10 19:35:25 -08:00
unreachable-macro-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
unreachable-static-msg.rs Add optional messages to the unreachable macro. 2014-11-10 19:35:25 -08:00
unreachable.rs Add optional messages to the unreachable macro. 2014-11-10 19:35:25 -08:00
unwind-interleaved.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
unwind-rec.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
unwind-rec2.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
unwind-unique.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
vec-overrun.rs Rename fail! to panic! 2014-10-29 11:43:07 -04:00
while-body-panics.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00
while-panic.rs test: Rename files, fail -> panic. 2014-11-11 09:36:12 -08:00