summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2016-05-14Auto merge of #33563 - Amanieu:oncestate, r=alexcrichtonbors-1/+1
Export OnceState from libstd This type is used in the signature of `call_once_force` but isn't exported from libstd. r? @alexcrichton
2016-05-14Rollup merge of #33554 - sfackler:no-current-exe, r=alexcrichtonManish Goregaokar-37/+12
Don't use env::current_exe with libbacktrace If the path we give to libbacktrace doesn't actually correspond to the current process, libbacktrace will segfault *at best*. cc #21889 r? @alexcrichton cc @semarie
2016-05-12Don't use env::current_exe with libbacktraceSteven Fackler-37/+12
If the path we give to libbacktrace doesn't actually correspond to the current process, libbacktrace will segfault *at best*. cc #21889
2016-05-12rustbuild: Add support for crate tests + doctestsAlex Crichton-1/+0
This commit adds support to rustbuild to run crate unit tests (those defined by `#[test]`) as well as documentation tests. All tests are powered by `cargo test` under the hood. Each step requires the `libtest` library is built for that corresponding stage. Ideally the `test` crate would be a dev-dependency, but for now it's just easier to ensure that we sequence everything in the right order. Currently no filtering is implemented, so there's not actually a method of testing *only* libstd or *only* libcore, but rather entire swaths of crates are tested all at once. A few points of note here are: * The `coretest` and `collectionstest` crates are just listed as `[[test]]` entires for `cargo test` to naturally pick up. This mean that `cargo test -p core` actually runs all the tests for libcore. * Libraries that aren't tested all mention `test = false` in their `Cargo.toml` * Crates aren't currently allowed to have dev-dependencies due to rust-lang/cargo#860, but we can likely alleviate this restriction once workspaces are implemented. cc #31590
2016-05-12Use the correct word in the explanationStefan Schindler-1/+1
2016-05-12Cleanup formatting and wording for `std::env::temp_dir` docs.Corey Farwell-10/+10
2016-05-11Fix typo in std::sync::Once documentationAmanieu d'Antras-1/+0
2016-05-11Export OnceState from libstdAmanieu d'Antras-1/+1
2016-05-10rustbuild: Tighten dependencies of build scriptsAlex Crichton-3/+13
Ensure that `rerun-if-changed` is printed for all build scripts to ensure that they've all got the right list of dependencies.
2016-05-09Auto merge of #32900 - alexcrichton:panic2abort, r=nikomatsakisbors-1500/+219
rustc: Implement custom panic runtimes This commit is an implementation of [RFC 1513] which allows applications to alter the behavior of panics at compile time. A new compiler flag, `-C panic`, is added and accepts the values `unwind` or `panic`, with the default being `unwind`. This model affects how code is generated for the local crate, skipping generation of landing pads with `-C panic=abort`. [RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md Panic implementations are then provided by crates tagged with `#![panic_runtime]` and lazily required by crates with `#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic runtime must match the final product, and if the panic strategy is not `abort` then the entire DAG must have the same panic strategy. With the `-C panic=abort` strategy, users can expect a stable method to disable generation of landing pads, improving optimization in niche scenarios, decreasing compile time, and decreasing output binary size. With the `-C panic=unwind` strategy users can expect the existing ability to isolate failure in Rust code from the outside world. Organizationally, this commit dismantles the `sys_common::unwind` module in favor of some bits moving part of it to `libpanic_unwind` and the rest into the `panicking` module in libstd. The custom panic runtime support is pretty similar to the custom allocator support with the only major difference being how the panic runtime is injected (takes the `-C panic` flag into account). Closes #32837
2016-05-09rustc: Use C++ personalities on MSVCAlex Crichton-0/+1
Currently the compiler has two relatively critical bugs in the implementation of MSVC unwinding: * #33112 - faults like segfaults and illegal instructions will run destructors in Rust, meaning we keep running code after a super-fatal exception has happened. * #33116 - When compiling with LTO plus `-Z no-landing-pads` (or `-C panic=abort` with the previous commit) LLVM won't remove all `invoke` instructions, meaning that some landing pads stick around and cleanups may be run due to the previous bug. These both stem from the flavor of "personality function" that Rust uses for unwinding on MSVC. On 32-bit this is `_except_handler3` and on 64-bit this is `__C_specific_handler`, but they both essentially are the "most generic" personality functions for catching exceptions and running cleanups. That is, thse two personalities will run cleanups for all exceptions unconditionally, so when we use them we run cleanups for **all SEH exceptions** (include things like segfaults). Note that this also explains why LLVM won't optimize away `invoke` instructions. These functions can legitimately still unwind (the `nounwind` attribute only seems to apply to "C++ exception-like unwining"). Also note that the standard library only *catches* Rust exceptions, not others like segfaults and illegal instructions. LLVM has support for another personality, `__CxxFrameHandler3`, which does not run cleanups for general exceptions, only C++ exceptions thrown by `_CxxThrowException`. This essentially ideally matches our use case, so this commit moves us over to using this well-known personality function as well as exception-throwing function. This doesn't *seem* to pull in any extra runtime dependencies just yet, but if it does we can perhaps try to work out how to implement more of it in Rust rather than relying on MSVCRT runtime bits. More details about how this is actually implemented can be found in the changes itself, but this... Closes #33112 Closes #33116
2016-05-09Add some warnings to std::env::current_exeSteve Klabnik-0/+15
/cc #21889
2016-05-09Rollup merge of #33474 - frewsxcv:unwrap-err, r=alexcrichtonManish Goregaokar-3/+3
Utilize `Result::unwrap_err` in more places. None
2016-05-09Rollup merge of #33224 - alexcrichton:create-exit-status, r=aturonManish Goregaokar-0/+42
std: Allow creating ExitStatus from raw values Sometimes a process may be waited on externally from the standard library, in which case it can be useful to create a raw `ExitStatus` structure to return. This commit extends the existing Unix `ExitStatusExt` extension trait and adds a new Windows-specific `ExitStatusExt` extension trait to do this. The methods are currently called `ExitStatus::from_raw`. cc #32713
2016-05-09Auto merge of #33224 - alexcrichton:create-exit-status, r=aturonbors-0/+42
std: Allow creating ExitStatus from raw values Sometimes a process may be waited on externally from the standard library, in which case it can be useful to create a raw `ExitStatus` structure to return. This commit extends the existing Unix `ExitStatusExt` extension trait and adds a new Windows-specific `ExitStatusExt` extension trait to do this. The methods are currently called `ExitStatus::from_raw`. cc #32713
2016-05-09rustc: Implement custom panic runtimesAlex Crichton-1500/+218
This commit is an implementation of [RFC 1513] which allows applications to alter the behavior of panics at compile time. A new compiler flag, `-C panic`, is added and accepts the values `unwind` or `panic`, with the default being `unwind`. This model affects how code is generated for the local crate, skipping generation of landing pads with `-C panic=abort`. [RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md Panic implementations are then provided by crates tagged with `#![panic_runtime]` and lazily required by crates with `#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic runtime must match the final product, and if the panic strategy is not `abort` then the entire DAG must have the same panic strategy. With the `-C panic=abort` strategy, users can expect a stable method to disable generation of landing pads, improving optimization in niche scenarios, decreasing compile time, and decreasing output binary size. With the `-C panic=unwind` strategy users can expect the existing ability to isolate failure in Rust code from the outside world. Organizationally, this commit dismantles the `sys_common::unwind` module in favor of some bits moving part of it to `libpanic_unwind` and the rest into the `panicking` module in libstd. The custom panic runtime support is pretty similar to the custom allocator support with the only major difference being how the panic runtime is injected (takes the `-C panic` flag into account).
2016-05-09Utilize `Result::unwrap_err` in more places.Corey Farwell-3/+3
2016-05-08Rollup merge of #33426 - sfackler:try-from, r=aturonManish Goregaokar-1/+9
Implement RFC 1542 cc #33417 r? @aturon
2016-05-08Auto merge of #33091 - sanxiyn:unused-trait-import-3, r=nrcbors-3/+0
Warn unused trait imports, rebased Rebase of #30021. Fix #25730.
2016-05-07Rollup merge of #33459 - frewsxcv:patch-29, r=guillaumegomezSteve Klabnik-2/+2
Indicate struct names are code-like in doc-comment.
2016-05-07Rollup merge of #33456 - CryZe:barrier-wait-docs, r=GuillaumeGomezSteve Klabnik-1/+1
Fix Typo in Barrier::wait documentation This should be `have` instead of `has`.
2016-05-07Rollup merge of #33442 - tshepang:trim, r=steveklabnikSteve Klabnik-3/+2
doc: trim some needless code
2016-05-07Rollup merge of #33439 - birkenfeld:ip-rfc-refs, r=steveklabnikSteve Klabnik-5/+5
doc: make RFC references consistent Always add a space and end sentence with a full stop.
2016-05-07Rollup merge of #33438 - birkenfeld:dup-words, r=steveklabnikSteve Klabnik-2/+2
Fix some some duplicate words.
2016-05-07Rollup merge of #33326 - birkenfeld:issue-33321, r=GuillaumeGomezSteve Klabnik-15/+14
std::thread docs: spawn() does not return a Thread anymore Also move the "Thread type" section down a bit, since it is not so important anymore. Fixes: #33321
2016-05-07Rollup merge of #33283 - GuillaumeGomez:process_doc, r=steveklabnikSteve Klabnik-4/+196
Add process types documentation Part of #29370. r? @steveklabnik
2016-05-07Implement RFC 1542Steven Fackler-1/+9
cc #33417
2016-05-06doc: binding not neededTshepang Lekhonkhobe-2/+1
2016-05-06doc: mut not neededTshepang Lekhonkhobe-1/+1
2016-05-06Indicate struct names are code-like in doc-comment.Corey Farwell-2/+2
2016-05-06Auto merge of #33086 - cardoe:non-blocking-rand-read, r=alexcrichtonbors-3/+20
rand: don't block before random pool is initialized If we attempt a read with getrandom() on Linux the syscall can block before the random pool is initialized unless the GRND_NONBLOCK flag is passed. This flag causes getrandom() to instead return EAGAIN while the pool is uninitialized. To avoid downstream users of crate or std functionality that have no ability to avoid this blocking behavior this change causes Rust to read bytes from /dev/urandom while getrandom() would block and once getrandom() is available to use that. Fixes #32953. Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2016-05-06Fix Typo in Barrier::wait documentationChristopher Serr-1/+1
This should be `have` instead of `has`.
2016-05-06Auto merge of #33072 - tbu-:pr_duration_new_overflow, r=alexcrichtonbors-1/+7
Panic on overflow in `Duration::new` constructor Panicking on overflow is also done for `+`, and it replaces the currently incorrect overflow behavior of wrapping around, which does not make sense for `Duration`s.
2016-05-05Auto merge of #32990 - tbu-:pr_more_defaults_cstr_path, r=alexcrichtonbors-0/+16
Add `Default` implementation for `&CStr`, `CString`, `Path`
2016-05-05doc: make RFC references consistentGeorg Brandl-5/+5
2016-05-05Fix some some duplicate words.Georg Brandl-2/+2
2016-05-05Add `Default` implementation for `&CStr` and `CString`Tobias Bucher-0/+16
2016-05-03Fix build on WindowsSeo Sanghyeon-1/+0
2016-05-03Remove unused trait imports flagged by lintSeo Sanghyeon-2/+0
2016-05-02libstd: correct the link to functions in io module documentationRyman-2/+2
Currently the link refers to it's own section of the documentation rather than the list of functions generated by rustdoc.
2016-05-02std::thread docs: spawn() returns not a Thread anymoreGeorg Brandl-15/+14
Also move the "Thread type" section down a bit, since it is not so important anymore. Fixes: #33321
2016-05-01Add process types documentationGuillaume Gomez-4/+196
2016-04-29Auto merge of #33148 - sfackler:entry-key, r=alexcrichtonbors-0/+9
Add Entry::key This method was present on both variants of Entry, but not the enum cc #32281 r? @alexcrichton
2016-04-28Auto merge of #33211 - alexcrichton:android-back-in-time, r=nagisabors-36/+138
std: Add compatibility with android-9 The Gecko folks currently use Android API level 9 for their builds, so they're requesting that we move back our minimum supported API level from 18 to 9. Turns out, ABI-wise at least, there's not that many changes we need to take care of. The `ftruncate64` API appeared in android-12 and the `log2` and `log2f` APIs appeared in android-18. We can have a simple shim for `ftruncate64` which falls back on `ftruncate` and the `log2` function can be approximated with just `ln(f) / ln(2)`. This should at least get the standard library building on API level 9, although the tests aren't quite happening there just yet. As we seem to be growing a number of Android compatibility shims, they're now centralized in a common `sys::android` module.
2016-04-28Rollup merge of #33152 - bwinterton:master, r=steveklabnikSteve Klabnik-2/+2
Make HashSet::Insert documentation more consistent I have made the HashSet::Insert documentation more consistent in the use of the term 'value' vs 'key'. Also clarified that if _this_ value is present true is returned, instead of the ambiguous 'a value present'. r? @steveklabnik
2016-04-28Fix a typo in error messages in std::fs testsSimon Wollwage-2/+2
2016-04-27std: Add compatibility with android-9Alex Crichton-36/+138
The Gecko folks currently use Android API level 9 for their builds, so they're requesting that we move back our minimum supported API level from 18 to 9. Turns out, ABI-wise at least, there's not that many changes we need to take care of. The `ftruncate64` API appeared in android-12 and the `log2` and `log2f` APIs appeared in android-18. We can have a simple shim for `ftruncate64` which falls back on `ftruncate` and the `log2` function can be approximated with just `ln(f) / ln(2)`. This should at least get the standard library building on API level 9, although the tests aren't quite happening there just yet. As we seem to be growing a number of Android compatibility shims, they're now centralized in a common `sys::android` module.
2016-04-26std: Allow creating ExitStatus from raw valuesAlex Crichton-0/+42
Sometimes a process may be waited on externally from the standard library, in which case it can be useful to create a raw `ExitStatus` structure to return. This commit extends the existing Unix `ExitStatusExt` extension trait and adds a new Windows-specific `ExitStatusExt` extension trait to do this. The methods are currently called `ExitStatus::from_raw`. cc #32713
2016-04-26Auto merge of #33142 - tshepang:split-long-line, r=guillaumegomezbors-2/+2
doc: that line was too long
2016-04-26Auto merge of #33203 - Ryman:patch-3, r=alexcrichtonbors-2/+2
libstd: fix typos in thread::LocalKey docs