Steve Klabnik [Tue, 10 Nov 2015 15:51:48 +0000 (10:51 -0500)]
Rollup merge of #29729 - brson:readme2, r=steveklabnik
r? @steveklabnik
This completely abdicates any responsibility to explain what Rust is, instead linking to the website.
My main motivation is that I am still not happy with it, and every time I try to fix it I just write a slightly longer sales pitch than what's on the website.
One thing this paragraph could do is direct people to more information about what is in the repo, or more technical information about the implementation.
Steve Klabnik [Tue, 10 Nov 2015 15:51:47 +0000 (10:51 -0500)]
Rollup merge of #29688 - stepancheg:vec-outdated, r=nikomatsakis
Since commit 46068c9da, call to `reserve()` on empty vec allocates
exactly requested capacity, so unroll of first iteration may help only
with branch prediction.
bors [Tue, 10 Nov 2015 11:34:13 +0000 (11:34 +0000)]
Auto merge of #29699 - tamird:valgrind-supp, r=alexcrichton
Quite a bit of cruft in the valgrind suppressions. I started from a clean slate and found a few unique failures; this commit also moves the tests "fixed" by these suppressions into run-pass-valgrind.
bors [Tue, 10 Nov 2015 06:56:30 +0000 (06:56 +0000)]
Auto merge of #29546 - alexcrichton:new-libc, r=brson
This commit replaces the in-tree liblibc with the [external clone](https://github.com/rust-lang-nursery/libc) which has no evolved beyond the in-tree version in light of its [recent redesign](https://github.com/rust-lang/rfcs/pull/1291).
The primary changes here are:
* `src/liblibc/lib.rs` was deleted
* `src/liblibc` is now a submodule pointing at the external repository
* `src/libstd/sys/unix/{c.rs,sync.rs}` were both deleted having all bindings folded into the external liblibc.
* Many ad-hoc `extern` blocks in the standard library were removed in favor of bindings now being in the external liblibc.
* Many functions/types were added to `src/libstd/sys/windows/c.rs`, and the scattered definitions throughout the standard library were consolidated here.
At the API level this commit is **not a breaking change**, although it is only very lightly tested on the *BSD variants and is probably going to break almost all of their builds! Follow-up commits to liblibc should in theory be all that's necessary to get the build working on the *BSDs again.
Alex Crichton [Tue, 3 Nov 2015 00:23:22 +0000 (16:23 -0800)]
std: Migrate to the new libc
* Delete `sys::unix::{c, sync}` as these are now all folded into libc itself
* Update all references to use `libc` as a result.
* Update all references to the new flat namespace.
* Moves all windows bindings into sys::c
bors [Sun, 8 Nov 2015 20:20:16 +0000 (20:20 +0000)]
Auto merge of #29686 - jrburke:docs-error-handling-search-case, r=BurntSushi
In src/doc/trpl/error-handling.md, in this section:
It mentions three steps, to "convert this to proper error handling", the last one being:
3. Handle the error in main.
However, it is not shown. This pull request adds a code example showing how `main`'s call to `search` should use case analysis. I am still very much new to learning Rust, so this may not be idiomatic. Happy to make changes with guidance.
Stepan Koltsov [Sun, 8 Nov 2015 14:17:02 +0000 (17:17 +0300)]
Fix outdated comment in Vec::from_iter
Since commit 46068c9da, call to `reserve()` on empty vec allocates
exactly requested capacity, so unroll of first iteration may help only
with branch prediction.
bors [Sun, 8 Nov 2015 02:34:24 +0000 (02:34 +0000)]
Auto merge of #29681 - vadimcn:fix-dist, r=alexcrichton
Resolves #29672. This happened because rust runtime startup objects, rsbegin.o and rsend.o, were not included in the target libraries package for -windows-gnu.
Vadim Chugunov [Sun, 8 Nov 2015 01:44:44 +0000 (17:44 -0800)]
Make sure rsbegin.o and rsend.o get packaged with target lib artifacts.
Also, unified libc startup objects finding logic with that of the `-musl` target, since conceptually they were doing the same thing.
bors [Sat, 7 Nov 2015 23:45:14 +0000 (23:45 +0000)]
Auto merge of #29674 - inrustwetrust:flag_alignment, r=alexcrichton
The `enable-nonzeroing-move-hints` flag name was too long and caused misalignment of the help text.
Now calculating the needed padding dynamically from the available flags instead.
bors [Sat, 7 Nov 2015 00:42:10 +0000 (00:42 +0000)]
Auto merge of #29551 - arcnmx:target-family, r=alexcrichton
Allow the changing of `target_family` through flexible configuration. The whole computing world isn't just a binary of *nix and Windows! Makes porting `libstd` and co to new platforms a lot less painful.
bors [Fri, 6 Nov 2015 22:57:37 +0000 (22:57 +0000)]
Auto merge of #29462 - alexcrichton:refactor-process-ret, r=aturon
* Store the native representation directly in the `ExitStatus` structure instead
of a "parsed version" (mostly for Unix).
* On Windows, be more robust against processes exiting with the status of 259.
Unfortunately this exit code corresponds to `STILL_ACTIVE`, causing libstd to
think the process was still alive, causing an infinite loop. Instead the loop
is removed altogether and `WaitForSingleObject` is used to wait for the
process to exit.
Alex Crichton [Thu, 29 Oct 2015 20:45:56 +0000 (13:45 -0700)]
std: Refactor process exit code handling slightly
* Store the native representation directly in the `ExitStatus` structure instead
of a "parsed version" (mostly for Unix).
* On Windows, be more robust against processes exiting with the status of 259.
Unfortunately this exit code corresponds to `STILL_ACTIVE`, causing libstd to
think the process was still alive, causing an infinite loop. Instead the loop
is removed altogether and `WaitForSingleObject` is used to wait for the
process to exit.
bors [Fri, 6 Nov 2015 13:13:08 +0000 (13:13 +0000)]
Auto merge of #29620 - petrochenkov:reachable2, r=alexcrichton
Handle them in `middle::reachable` instead (no optimizations so far, just drop all trait impl items into the reachable set, as before). Addresses the concerns from https://github.com/rust-lang/rust/pull/29291#discussion_r43672413
\+ In `middle::reachable` don't treat impls of `Drop` specially, they are subsumed by the general impl treatment.
\+ Add some tests checking reachability of trait methods written in UFCS form
\+ Minor refactoring in the second commit
bors [Fri, 6 Nov 2015 07:58:27 +0000 (07:58 +0000)]
Auto merge of #29600 - Ryman:rustdoc_better_testnames, r=alexcrichton
Old doctest names
```bash
test sync::atomic::load_0 ... ok
test sync::atomic::load_0 ... ok
test sync::atomic::load_0 ... ok
test sync::atomic::load_0 ... ok
```
New doctest names
```bash
test sync::atomic::AtomicBool::load_0 ... ok
test sync::atomic::AtomicIsize::load_0 ... ok
test sync::atomic::AtomicPtr<T>::load_0 ... ok
test sync::atomic::AtomicUsize::load_0 ... ok
```
bors [Fri, 6 Nov 2015 06:13:59 +0000 (06:13 +0000)]
Auto merge of #29588 - nikomatsakis:mir-switch, r=aatch
Introduce a `SwitchInt` and restructure pattern matching to collect integers and characters into one master switch. This is aimed at #29227, but is not a complete fix. Whereas before we generated an if-else-if chain and, at least on my machine, just failed to compile, we now spend ~9sec compiling `rustc_abuse`. AFAICT this is basically just due to a need for more micro-optimization of the matching process: perf shows a fair amount of time just spent iterating over the candidate list. Still, it seemed worth opening a PR with this step alone, since it's a big step forward.
bors [Fri, 6 Nov 2015 04:29:11 +0000 (04:29 +0000)]
Auto merge of #29491 - alexcrichton:avoid-stdio-tls, r=brson
Currently if a print happens while a thread is being torn down it may cause a
panic if the LOCAL_STDOUT TLS slot has been destroyed by that point. This adds a
guard to check and prints to the process stdout if that's the case (as we do for
if the slot is already borrowed).
bors [Fri, 6 Nov 2015 00:56:08 +0000 (00:56 +0000)]
Auto merge of #29305 - alexcrichton:bad-getenv, r=brson
As discovered in #29298, `env::set_var("", "")` will panic, but it turns out
that it *also* deadlocks on Unix systems. This happens because if a panic
happens while holding the environment lock, we then go try to read
RUST_BACKTRACE, grabbing the environment lock, causing a deadlock.
Specifically, the changes made here are:
* The environment lock is pushed into `std::sys` instead of `std::env`. This
also only puts it in the Unix implementation, not Windows where the functions
are already threadsafe.
* The `std::sys` implementation now returns `io::Result` so panics are
explicitly at the `std::env` level.
Steve Klabnik [Thu, 5 Nov 2015 21:28:49 +0000 (22:28 +0100)]
Rollup merge of #29611 - steveklabnik:gh25918, r=alexcrichton
Originally, this was my 30 minute introduction, and we eventually made
it the opener to the book. But as #25918 has shown, the example I use
here has some issues. The good news is that Rust makes heap allocation
syntatically expensive, but the bad news is that that means showing
equivalent programs from Rust and other languages is difficult. After
thinking about it, I'm not sure this section is pulling its weight, and
since it has problems, I'd rather just pull it than try to re-write it
right now. I think the book is fine without it.
Steve Klabnik [Thu, 5 Nov 2015 21:28:48 +0000 (22:28 +0100)]
Rollup merge of #29609 - ivan:rustdoc-ctrl-s, r=steveklabnik
Rustdoc pages with a search box inadvertently override `ctrl-s` in addition to the intended `s` and `S` keys. You can test this in at least Firefox and Chrome (tested: Windows): press `ctrl-s` on http://doc.rust-lang.org/std/. The search box is focused when instead the browser's save feature should be activated. This PR fixes `ctrl-s` and possibly other browser shortcuts.