bors [Sun, 29 Oct 2017 06:24:20 +0000 (06:24 +0000)]
Auto merge of #45295 - Technius:docs/process, r=steveklabnik
Improve std::process module docs
Addresses part of #29370
I've changed the first `cat` example to a "Hello World" example involving echo, and I've also added another example showing how to pipe output. I'm still working on the module-level description.
bors [Sat, 28 Oct 2017 23:40:31 +0000 (23:40 +0000)]
Auto merge of #45580 - kennytm:sdkmanager, r=alexcrichton
ci: Upgrade Android SDK/NDK and refactor to use sdkmanager/avdmanager.
* SDK tools is upgraded to 27.0.0.
* Stopped using the deprecated `android` tool, instead use the recommended `sdkmanager` and `avdmanager`.
* NDK is upgrade to r15c.
The r15 series [dropped support for android-9](https://github.com/android-ndk/ndk/wiki/Changelog-r15) (2.3 / Gingerbread), the minimal supported version is now android-14 (4.0 / Ice Cream Sandwich).
r? @alexcrichton
(WIP, haven't confirmed if the change really works yet)
kennytm [Fri, 27 Oct 2017 19:14:25 +0000 (03:14 +0800)]
ci: Upgrade Android SDK/NDK and refactor to use sdkmanager/avdmanager.
* SDK tools is upgraded to 27.0.0.
- Refactored to use `sdkmanager`/`avdmanager` instead of the deprecated
`android` tool.
* The Java version used by Android SDK is downgraded to OpenJDK-8, in order
to download the SDK through HTTPS.
* NDK is upgrade to r15c.
- Dropped support for android-9 (2.3 / Gingerbread), the minimal
supported version is now android-14 (4.0 / Ice Cream Sandwich).
- Changed the default Android compiler from GCC to clang.
- For details of change introduced by NDK r15, see
https://github.com/android-ndk/ndk/wiki/Changelog-r15.
bors [Sat, 28 Oct 2017 21:01:07 +0000 (21:01 +0000)]
Auto merge of #45540 - virgil-palanciuc:master, r=estebank
Avoid repetition on “use of unstable library feature 'rustc_private'”
This PR fixes the error by only emitting it when the span contains a real file (is not inside a macro) - and making sure it's emitted only once per span.
The first check was needed because spans-within-macros seem to differ a lot and "fixing" them to the real location is not trivial (and the method that does this is private to another module). It also feels like there always will be an error on import, with the real file name, so not sure there's a point to re-emit the same error at macro use.
bors [Sat, 28 Oct 2017 13:34:12 +0000 (13:34 +0000)]
Auto merge of #44295 - plietar:extern-types, r=arielb1
Implement RFC 1861: Extern types
A few notes :
- Type parameters are not supported. This was an unresolved question from the RFC. It is not clear how useful this feature is, and how variance should be treated. This can be added in a future PR.
- `size_of_val` / `align_of_val` can be called with extern types, and respectively return 0 and 1. This differs from the RFC, which specified that they should panic, but after discussion with @eddyb on IRC this seems like a better solution.
If/when a `DynSized` trait is added, this will be disallowed statically.
- Auto traits are not implemented by default, since the contents of extern types is unknown. This means extern types are `!Sync`, `!Send` and `!Freeze`. This seems like the correct behaviour to me.
Manual `unsafe impl Sync for Foo` is still possible.
- This PR allows extern type to be used as the tail of a struct, as described by the RFC :
```rust
extern {
type OpaqueTail;
}
However this is undesirable, as the alignment of `tail` is unknown (the current PR assumes an alignment of 1). Unfortunately we can't prevent it in the general case as the tail could be a type parameter :
```rust
#[repr(C)]
struct FfiStruct<T: ?Sized> {
data: u8,
more_data: u32,
tail: T,
}
```
Adding a `DynSized` trait would solve this as well, by requiring tail fields to be bound by it.
- Despite being unsized, pointers to extern types are thin and can be casted from/to integers. However it is not possible to write a `null<T>() -> *const T` function which works with extern types, as I've explained here : https://github.com/rust-lang/rust/issues/43467#issuecomment-321678621
- Trait objects cannot be built from extern types. I intend to support it eventually, although how this interacts with `DynSized`/`size_of_val` is still unclear.
kennytm [Sat, 28 Oct 2017 07:56:24 +0000 (15:56 +0800)]
Rollup merge of #45574 - nzig:on_unimplemented_example, r=steveklabnik
Fixed rustc_on_unimplemented example in Unstable Book
I saw [this](https://doc.rust-lang.org/beta/unstable-book/language-features/on-unimplemented.html) example and it seemed wrong. This fixes the example to emit an error message that makes more sense.
kennytm [Sat, 28 Oct 2017 07:56:22 +0000 (15:56 +0800)]
Rollup merge of #45535 - topecongiro:bootstrap-exit-code, r=kennytm
Return 0 as an exit status when no subcommand is given to bootstrap
Running `./x.py` emits usage and error messages when no subcommand is given:
```
Usage: x.py <subcommand> [options] [<paths>...]
Subcommands:
build Compile either the compiler or libraries
test Build and run some test suites
bench Build and run some benchmarks
doc Build documentation
clean Clean out build directories
dist Build distribution artifacts
install Install distribution artifacts
To learn more about a subcommand, run `./x.py <subcommand> -h`
failed to run: /home/topecongiro/rust/build/bootstrap/debug/bootstrap
```
IMHO the last line is unnecessary. This PR removes it by changing the return code of `bootstrap` to 0 when no sub command is given.
bors [Sat, 28 Oct 2017 07:08:52 +0000 (07:08 +0000)]
Auto merge of #45566 - cuviper:option-checking, r=alexcrichton
configure.py: fix --disable-option-checking and extra config paths
- indexing 'option-checking' out of `known_args` had a type error
- when option checking is disabled, don't error on duplicate args, just take the last
- add config.toml stubs for datadir, infodir, and localstatedir (which were already accepted, but broken)
---
This fixes a regression from 1.21 to beta, when the configure script was rewritten in python.
bors [Sat, 28 Oct 2017 03:02:17 +0000 (03:02 +0000)]
Auto merge of #45503 - thombles:tk/i44339-v5, r=petrochenkov
Improve diagnostics when list of tokens has incorrect separators
Make `parse_seq_to_before_tokens` more resilient to error conditions. Where possible it is better if it can consume up to the final bracket before returning. This change improves the diagnostics in a couple of situations:
```
struct S(pub () ()); // omitted separator
use std::{foo. bar}; // used a similar but wrong separator
```
bors [Fri, 27 Oct 2017 15:03:47 +0000 (15:03 +0000)]
Auto merge of #45570 - nrc:manifest-no-rls, r=alexcrichton
Don't fail to build a manifest if a tarball is missing
This is guesswork because I can't test build_manifest nor do I know what is actually causing the error to begin with. My hypothesis is that when we try to find the version from the RLS tarball and the tarball is not there, then we panic. I attempt to fix this by making the version string optional, then not adding the RLS package, rename, and extension component if the version is missing.
bors [Fri, 27 Oct 2017 02:19:16 +0000 (02:19 +0000)]
Auto merge of #45524 - alexcrichton:improve-park-unpark, r=dtolnay
std: Optimize thread park/unpark implementation
This is an adaptation of alexcrichton/futures-rs#597 for the standard library.
The goal here is to avoid locking a mutex on the "fast path" for thread
park/unpark where you're waking up a thread that isn't sleeping or otherwise
trying to park a thread that's already been notified. Mutex performance varies
quite a bit across platforms so this should provide a nice consistent speed
boost for the fast path of these functions.
Josh Stone [Thu, 26 Oct 2017 23:30:17 +0000 (16:30 -0700)]
config.toml: Add stubs for recognized-but-unused install paths
... specifically `datadir`, `infodir`, and `localstatedir`. These were
already accepted by `configure.py`, but it didn't have any place to put
the values.
bors [Thu, 26 Oct 2017 23:48:16 +0000 (23:48 +0000)]
Auto merge of #45523 - alexcrichton:improve-libbacktrace, r=sfackler
std: Disable usage of mmap allocator in libbacktrace
This is sort of a long overdue change from the investigation in #29293
and #37477. The released binaries of rustc don't have debug information and so
don't actively suffer this problem but this can hit local development of rustc
and also larger programs compiled against libstd generating backtraces.
The main purpose of the mmap allocator in libacktrace is to be usable from a
signal handler, but we don't do that, so the normal allocator using malloc/free
should work well for us.
Virgil Palanciuc [Thu, 26 Oct 2017 16:34:39 +0000 (09:34 -0700)]
relax restriction - allow errors to be emmitted within macro spans, as long as the same error message has not been used before (i.e. use the None as the span key, for errors that occur within macros)
bors [Thu, 26 Oct 2017 14:14:15 +0000 (14:14 +0000)]
Auto merge of #45380 - dotdash:arg_copies, r=arielb1
Avoid unnecessary copies of arguments that are simple bindings
Initially MIR differentiated between arguments and locals, which
introduced a need to add extra copies assigning the argument to a
local, even for simple bindings. This differentiation no longer exists,
but we're still creating those copies, bloating the MIR and LLVM IR we
emit.
Additionally, the current approach means that we create debug info for
both the incoming argument (marking it as an argument), and then
immediately shadow it a local that goes by the same name. This can be
confusing when using e.g. "info args" in gdb, or when e.g. a debugger
with a GUI displays the function arguments separately from the local
variables, especially when the binding is mutable, because the argument
doesn't change, while the local variable does.
Björn Steinbrink [Wed, 11 Oct 2017 18:49:36 +0000 (20:49 +0200)]
Avoid unnecessary copies of arguments that are simple bindings
Initially MIR differentiated between arguments and locals, which
introduced a need to add extra copies assigning the argument to a
local, even for simple bindings. This differentiation no longer exists,
but we're still creating those copies, bloating the MIR and LLVM IR we
emit.
Additionally, the current approach means that we create debug info for
both the incoming argument (marking it as an argument), and then
immediately shadow it a local that goes by the same name. This can be
confusing when using e.g. "info args" in gdb, or when e.g. a debugger
with a GUI displays the function arguments separately from the local
variables, especially when the binding is mutable, because the argument
doesn't change, while the local variable does.
bors [Thu, 26 Oct 2017 00:58:52 +0000 (00:58 +0000)]
Auto merge of #45096 - DSpeckhals:update-rls-data-for-save-analysis, r=alexcrichton
Update rls-data for save analysis
rls-data: 0.10 -> 0.11
This will allow for more fine-grained save analysis for enum variants (tuple and struct).
The first commit updates rls-data, and makes the changes to dump_visitor. The second commit updates the rls submodule, and removes "members" that were deleted from that update in src/Cargo.toml.
Note, that when building the project, rustfmt-nightly was updated in Cargo.lock. If these changes should be excluded, I can revert it.
kennytm [Wed, 25 Oct 2017 19:02:52 +0000 (03:02 +0800)]
Rollup merge of #45496 - kennytm:bootstrap-fix-extension-check, r=alexcrichton
rustbuild: Fix `no output generated` error for next bootstrap cargo.
Due to rust-lang/cargo#4570, a `*.dll.lib` file is uplifted when building dynamic libraries on Windows. The current bootstrap code does not understand files with multiple extensions, and will instead assume `xxxx.dll` is the file name. This caused a `no output generated` error because it tries to search for `xxxx.dll-hash.lib` inside the `deps/` folder, while it should check for `xxxx-hash.dll.lib` instead.
This PR is blocking #45285, see https://github.com/rust-lang/rust/pull/45285#issuecomment-338454149 and the rest of the comments for detail.
kennytm [Wed, 25 Oct 2017 19:02:51 +0000 (03:02 +0800)]
Rollup merge of #45483 - mbrubeck:hash, r=alexcrichton
Implement Hash for raw pointers to unsized types
This is useful for some niche cases, like a hash table of slices or trait objects where the key is the raw pointer. Example use case: https://docs.rs/by_address
kennytm [Wed, 25 Oct 2017 19:02:50 +0000 (03:02 +0800)]
Rollup merge of #45398 - integer32llc:reassignment, r=arielb1
Correct misspelling in error text: re-assignment => reassignment
[reassignment is the correct spelling](https://www.thefreedictionary.com/reassignment) rather than re-assignment; this error message looks silly in the book next to text trying to be grammatically correct :-/
Will this cause any stability/backcompat type issues?
Alex Crichton [Wed, 25 Oct 2017 15:35:51 +0000 (08:35 -0700)]
std: Optimize thread park/unpark implementation
This is an adaptation of alexcrichton/futures-rs#597 for the standard library.
The goal here is to avoid locking a mutex on the "fast path" for thread
park/unpark where you're waking up a thread that isn't sleeping or otherwise
trying to park a thread that's already been notified. Mutex performance varies
quite a bit across platforms so this should provide a nice consistent speed
boost for the fast path of these functions.
Alex Crichton [Wed, 25 Oct 2017 14:51:36 +0000 (07:51 -0700)]
std: Disable usage of mmap allocator in libbacktrace
This is sort of a long overdue change from the investigation in #29293
and #37477. The released binaries of rustc don't have debug information and so
don't actively suffer this problem but this can hit local development of rustc
and also larger programs compiled against libstd generating backtraces.
The main purpose of the mmap allocator in libacktrace is to be usable from a
signal handler, but we don't do that, so the normal allocator using malloc/free
should work well for us.
bors [Wed, 25 Oct 2017 12:38:10 +0000 (12:38 +0000)]
Auto merge of #45476 - Xanewok:fingerprint-disambiguator, r=michaelwoerister
Use 128 bit instead of Symbol for crate disambiguator
As discussed on gitter, this changes `crate_disambiguator` from Strings to what they are represented as, a 128 bit number.
There's also one bit I think also needs to change, but wasn't 100% sure how: [create_root_def](https://github.com/rust-lang/rust/blob/f338dba29705e144bad8b2a675284538dd514896/src/librustc/hir/map/definitions.rs#L468-L482). Should I change `DefKey::root_parent_stable_hash` to accept `Fingerprint` as crate_disambiguator to quickly combine the hash of `crate_name` with the new 128 bit hash instead of a string for a disambiguator?
r? @michaelwoerister
EDIT: Are those 3 tests `mir-opt` failing, because the hash is different, because we calculate it a little bit differently (storing directly instead of hashing the hex-string representation)? Should it be updated like in #45319?
bors [Tue, 24 Oct 2017 20:46:17 +0000 (20:46 +0000)]
Auto merge of #45446 - leodasvacas:remove-libcollections, r=alexcrichton
Remove deprecated `collections` crate.
The real `collections` was merged with `alloc`, this facade was introduced [in this PR](https://github.com/rust-lang/rust/pull/42720) to give `#[no_std]` users time to adapt. This was done at least two cycles ago, now we can consider removing it for good.