Commit Graph

35561 Commits

Author SHA1 Message Date
Aaron Turon
a9e7669cdc Rebasing fixes. 2014-12-18 23:35:53 -08:00
Aaron Turon
f4c0c0ff42 Disable stack overflow test on android, which seems to be failing spuriously.
cc https://github.com/rust-lang/rust/issues/20004
2014-12-18 23:35:53 -08:00
Aaron Turon
0ce5faaa7b Delete rest of rustrt
... and address other rebasing fallout.
2014-12-18 23:35:52 -08:00
Alex Crichton
d08600b189 std: Move the panic flag to its own thread local
This flag is somewhat tied to the `unwind` module rather than the `thread_info`
module, so this commit moves it into that module as well as allowing the same OS
thread to call `unwind::try` multiple times. Previously once a thread panicked
its panic flag was never reset, even after exiting the panic handler.
2014-12-18 23:35:52 -08:00
Alex Crichton
5759cff48e std: Lower abstractions for thread_local/at_exit
The current implementations use `std::sync` primitives, but these primitives
currently end up relying on `thread_info` and a local `Thread` being available
(mainly for checking the panicking flag).

To get around this, this commit lowers the abstractions used by the windows
thread_local implementation as well as the at_exit_imp module. Both of these
modules now use a `sys::Mutex` and a `static mut` and manage the
allocation/locking manually.
2014-12-18 23:35:52 -08:00
Aaron Turon
a27fbac868 Revise std::thread API to join by default
This commit is part of a series that introduces a `std::thread` API to
replace `std::task`.

In the new API, `spawn` returns a `JoinGuard`, which by default will
join the spawned thread when dropped. It can also be used to join
explicitly at any time, returning the thread's result. Alternatively,
the spawned thread can be explicitly detached (so no join takes place).

As part of this change, Rust processes now terminate when the main
thread exits, even if other detached threads are still running, moving
Rust closer to standard threading models. This new behavior may break code
that was relying on the previously implicit join-all.

In addition to the above, the new thread API also offers some built-in
support for building blocking abstractions in user space; see the module
doc for details.

Closes #18000

[breaking-change]
2014-12-18 23:31:52 -08:00
Aaron Turon
13f302d0c5 Update doc comment for std::rt 2014-12-18 23:31:52 -08:00
Alex Crichton
4ffd9f49c3 Avoid .take().unwrap() with FnOnce closures 2014-12-18 23:31:52 -08:00
Alex Crichton
a7061d02e1 Tweak the startup routine to pass on linux
We need to be sure to init thread_info before we init args for example because
args is grabbing locks which may entail looking at the local thread eventually.
2014-12-18 23:31:52 -08:00
Alex Crichton
7a6c54c46e Fix compilation on linux 2014-12-18 23:31:52 -08:00
Alex Crichton
9644d60cc4 Fix the capture_stderr test
There's always a fun time having two sets of standard libraries when testing!
2014-12-18 23:31:52 -08:00
Aaron Turon
ced2239852 Disable capture_stderr test for now 2014-12-18 23:31:51 -08:00
Aaron Turon
43ae4b3301 Fallout from new thread API 2014-12-18 23:31:51 -08:00
Aaron Turon
14c1a103bc Revise rt::unwind 2014-12-18 23:31:51 -08:00
Aaron Turon
d8e4780b0b Remove rt::{mutex, exclusive} 2014-12-18 23:31:51 -08:00
Aaron Turon
7fd7ce682d Add blocking support module for channels 2014-12-18 23:31:51 -08:00
Aaron Turon
84cb6cd938 Remove rt::{local, local_data, thread_local_storage} 2014-12-18 23:31:51 -08:00
Aaron Turon
cac133c9a8 Introduce std::thread
Also removes:

* `std::task`
* `std::rt::task`
* `std::rt::thread`

Notes for the new API are in a follow-up commit.

Closes #18000
2014-12-18 23:31:35 -08:00
Aaron Turon
9b03b72d7f Remove rt::bookkeeping
This commit removes the runtime bookkeeping previously used to ensure
that all Rust tasks were joined before the runtime was shut down.

This functionality will be replaced by an RAII style `Thread` API, that
will also offer a detached mode.

Since this changes the semantics of shutdown, it is a:

[breaking-change]
2014-12-18 23:31:35 -08:00
Aaron Turon
c009bfdf94 Make at_exit initialize lazily 2014-12-18 23:31:34 -08:00
Aaron Turon
b66681cd31 Allow args to work without rt initialization 2014-12-18 23:31:34 -08:00
Aaron Turon
74d0769993 Refactor std::os to use sys::os 2014-12-18 23:31:34 -08:00
Aaron Turon
2b3477d373 libs: merge librustrt into libstd
This commit merges the `rustrt` crate into `std`, undoing part of the
facade. This merger continues the paring down of the runtime system.

Code relying on the public API of `rustrt` will break; some of this API
is now available through `std::rt`, but is likely to change and/or be
removed very soon.

[breaking-change]
2014-12-18 23:31:34 -08:00
Seo Sanghyeon
2800695fb0 Add privacy tests 2014-12-19 16:11:17 +09:00
bors
6bdce25e15 auto merge of #19899 : japaric/rust/unops-by-value, r=nikomatsakis
- The following operator traits now take their argument by value: `Neg`, `Not`. This breaks all existing implementations of these traits.

- The unary operation `OP a` now "desugars" to `OpTrait::op_method(a)` and consumes its argument.

[breaking-change]

---

r? @nikomatsakis This PR is very similar to the binops-by-value PR
cc @aturon
2014-12-19 06:12:01 +00:00
Alexis Beingessner
ce10c0114f clean up ptr docs 2014-12-18 22:30:06 -05:00
Clark Gaebel
d57f25907b [collections] Adds drain: a way to sneak out the elements while clearing.
It is useful to move all the elements out of some collections without
deallocating the underlying buffer. It came up in IRC, and this patch
implements it as `drain`. This has been discussed as part of RFC 509.

r? @Gankro
cc: @frankmcsherry
2014-12-18 22:16:51 -05:00
Alex Crichton
1b42e890bf std: Remove public bool,tuple,unit modules
This commit modifies rustdoc to not require these empty modules to be public in
the standard library. The modules still remain as a location to attach
documentation to, but the modules themselves are now private (don't have to
commit to an API). The documentation for the standard library now shows all of
the primitive types on the main index page.
2014-12-18 19:13:32 -08:00
bors
840de07208 auto merge of #19955 : Gankro/rust/kill-all-code, r=aturon
EnumSet lives on in libcollections so that librustc can still use it. This adds a direct dependency on libcollections to librustc and libserialize.

Should not be merged until https://github.com/rust-lang/rfcs/pull/509 is accepted.

All of these collections have already been moved to collect-rs where they will ideally be maintained and experimented with, or will be replaced by something better: https://github.com/Gankro/collect-rs/

[breaking-change]

r? @aturon @alexcrichton
2014-12-19 02:52:01 +00:00
th0114nd
edb39b8b33 Boolean literals are not Number literals
The current indentation level would indicate that Boolean literals are on the same level as Integer and Float literals under Number literals, unindenting moves it to the same scope as Character and string literals, Byte and byte string literals, and Number literals under Literals.
2014-12-18 17:55:34 -05:00
Alexis Beingessner
67d3823fc3 enumset fallout 2014-12-18 16:20:32 -05:00
Alexis Beingessner
0bd4dc68e6 s/Tree/BTree 2014-12-18 16:20:32 -05:00
Alexis Beingessner
6c00f9c5ff remove TreeMap, TreeSet, TrieMap, TrieSet, LruCache. deprecate EnumSet's std re-export 2014-12-18 16:20:31 -05:00
bors
99d6956c3b auto merge of #19896 : ktossell/rust/allow-nodoc-install, r=alexcrichton
If you configure with `--disable-docs`, the `doc` directory does not get generated, so the
`cp -r doc dist/` step fails when you `make dist{,-tar-bins,-doc}` or `make install`.
2014-12-18 20:32:07 +00:00
Jorge Aparicio
9b5de39c25 Address Niko's comments 2014-12-18 15:02:29 -05:00
Jorge Aparicio
d15d1529e0 Test unop move semantics 2014-12-18 15:02:29 -05:00
Jorge Aparicio
5d49999ad3 Fix run pass tests 2014-12-18 15:02:29 -05:00
Jorge Aparicio
5f347d7708 libstd: convert Duration unops to by value 2014-12-18 15:02:29 -05:00
Jorge Aparicio
340f042e03 libstd: convert BitFlags unops to by value 2014-12-18 15:02:28 -05:00
Jorge Aparicio
5359879fb6 libcore: convert unop traits to by value 2014-12-18 15:02:27 -05:00
Jorge Aparicio
5caebb23cd Tell regionck that user unops are by value 2014-12-18 14:56:00 -05:00
Jorge Aparicio
b98c3bd4d2 Tell expr_use_visitor that user unops are by value 2014-12-18 14:56:00 -05:00
Jorge Aparicio
9a962a7bdc Tell trans that user unops are by value 2014-12-18 14:56:00 -05:00
Jorge Aparicio
c5b6d9412d Tell typeck that user unops are by value 2014-12-18 14:56:00 -05:00
Jorge Aparicio
7efaf3fa34 syntax/ast_util: add is_by_value_unop() 2014-12-18 14:56:00 -05:00
th0114nd
15d54549d7 Put quotes around "as", because it's a keyword. 2014-12-18 14:47:43 -05:00
bors
f9a48492a8 auto merge of #19984 : japaric/rust/macro-expressions, r=alexcrichton
followed by a semicolon.

This allows code like `vec![1i, 2, 3].len();` to work.

This breaks code that uses macros as statements without putting
semicolons after them, such as:

    fn main() {
        ...
        assert!(a == b)
        assert!(c == d)
        println(...);
    }

It also breaks code that uses macros as items without semicolons:

    local_data_key!(foo)

    fn main() {
        println("hello world")
    }

Add semicolons to fix this code. Those two examples can be fixed as
follows:

    fn main() {
        ...
        assert!(a == b);
        assert!(c == d);
        println(...);
    }

    local_data_key!(foo);

    fn main() {
        println("hello world")
    }

RFC #378.

Closes #18635.

[breaking-change]

---

Rebased version of #18958
r? @alexcrichton 
cc @pcwalton
2014-12-18 17:32:07 +00:00
Patrick Walton
ddb2466f6a librustc: Always parse macro!()/macro![] as expressions if not
followed by a semicolon.

This allows code like `vec![1i, 2, 3].len();` to work.

This breaks code that uses macros as statements without putting
semicolons after them, such as:

    fn main() {
        ...
        assert!(a == b)
        assert!(c == d)
        println(...);
    }

It also breaks code that uses macros as items without semicolons:

    local_data_key!(foo)

    fn main() {
        println("hello world")
    }

Add semicolons to fix this code. Those two examples can be fixed as
follows:

    fn main() {
        ...
        assert!(a == b);
        assert!(c == d);
        println(...);
    }

    local_data_key!(foo);

    fn main() {
        println("hello world")
    }

RFC #378.

Closes #18635.

[breaking-change]
2014-12-18 12:09:07 -05:00
Andrew Paseltiner
01aa4ca7d8 Clean up collections::binary_heap 2014-12-18 10:58:56 -05:00
Philip Munksgaard
3d6babee9d Use -perm /a+x instead of -perm +a+x in calls to find
The use of `+a+x` is deprecated.

Fixes #19981.
2014-12-18 16:22:10 +01:00