bors [Sat, 4 Feb 2017 10:04:06 +0000 (10:04 +0000)]
Auto merge of #39440 - F001:SpecializeCow, r=bluss
std: Add ToString trait specialization for Cow<'a, str> and String
There is a specialized version of ToString for str type in std. I think there are other types can also benefit from specialization. `Cow` and `String` are the most obvious one.
bors [Fri, 3 Feb 2017 22:55:28 +0000 (22:55 +0000)]
Auto merge of #39463 - alexcrichton:update-bootstrap, r=alexcrichton
Bump version, upgrade bootstrap
This commit updates the version number to 1.17.0 as we're not on that version of
the nightly compiler, and at the same time this updates src/stage0.txt to
bootstrap from freshly minted beta compiler and beta Cargo.
Alex Crichton [Wed, 1 Feb 2017 23:57:50 +0000 (15:57 -0800)]
Bump version, upgrade bootstrap
This commit updates the version number to 1.17.0 as we're not on that version of
the nightly compiler, and at the same time this updates src/stage0.txt to
bootstrap from freshly minted beta compiler and beta Cargo.
bors [Fri, 3 Feb 2017 20:09:36 +0000 (20:09 +0000)]
Auto merge of #39356 - krdln:format-with-capacity, r=aturon
Use `String::with_capacity` in `format!`
Add an `Arguments::estimated_capacity` to estimate the length of formatted text and use it in `std::fmt::format` as the initial capacity of the buffer.
The capacity is calculated based on the literal parts of format string, see the details in the implementation.
bors [Fri, 3 Feb 2017 05:58:09 +0000 (05:58 +0000)]
Auto merge of #39329 - petrochenkov:rb2, r=alexcrichton
rustbuild: Build jemalloc and libbacktrace only once (take 2)
This is a rebase of https://github.com/rust-lang/rust/pull/38583 without any additions, but with implemented @alexcrichton's suggestions.
~~This includes `exists(Makefile)` => `cfg(stage0)` suggestion... but it will break cross-compilation, no? Are `libstd/liballoc_jemalloc` cross-compiled for `target != host` built during `stage0`?~~
bors [Fri, 3 Feb 2017 03:23:35 +0000 (03:23 +0000)]
Auto merge of #39287 - wesleywiser:move_cell, r=aturon
Extend Cell to work with non-Copy types
I'm not sure that I did this right but all of the tests pass.
I also had to move the `new()` function so that `Cell`s with non-`Copy` `T`s could be created. That wasn't in the RFC but I assume it needed to be done?
Guillaume Gomez [Thu, 2 Feb 2017 21:22:28 +0000 (22:22 +0100)]
Rollup merge of #39416 - tspiteri:ffi-unsafe-icon, r=brson
rustdoc: mark FFI functions with unsafety icon
Currently, in the list of functions, unsafe functions are marked with a superscript ⚠, but unsafe FFI functions are not. This patch treats unsafe FFI functions like other unsafe functions in this regard.
Guillaume Gomez [Thu, 2 Feb 2017 21:22:26 +0000 (22:22 +0100)]
Rollup merge of #39383 - nagisa:mir-uninhabited-destinations, r=pnkfelix
Remove the workaround for gh32959
This workaround is no longer necessary as Rust, and by extension MIR, now support uninhabited type
properly. This removes the workaround for the gh32959 that was introduced in gh33267.
Guillaume Gomez [Thu, 2 Feb 2017 21:22:23 +0000 (22:22 +0100)]
Rollup merge of #39319 - nagisa:remove-rustsetpersonalityfn, r=pnkfelix
Remove unnecessary LLVMRustPersonalityFn binding
LLVM Core C bindings provide this function for all the versions back to what we support (3.7), and
helps to avoid this unnecessary builder->function transition every time. Also a negative diff.
Fixes #38462 (although it was pretty much fixed already)
Guillaume Gomez [Thu, 2 Feb 2017 21:22:19 +0000 (22:22 +0100)]
Rollup merge of #38823 - Freyskeyd:doc-missingInformationCfgTest, r=steveklabnik
Improve doc cfg(test) and tests directory
Hi,
I was facing a problem with my code organisation. I was using a tests directory and i defined some `#[cfg(test)]` in my `src/`. But i was not able to use it in my `tests` folder.
use testt::test;
fn tesst() {
assert!(test::t());
}
```
I was unable to compile using `cargo test`:
```bash
error[E0432]: unresolved import `testt::test`
--> tests/x.rs:3:5
|
3 | use testt::test;
| ^^^^^^^^^^^ no `test` in `testt`
```
If i remove the `tests` directory everything works fine. To use an utils module in your `tests` directory, you need to create a module in the directory (like `tests/utils.rs`). My `tests/x.rs` look like this now:
bors [Thu, 2 Feb 2017 07:39:07 +0000 (07:39 +0000)]
Auto merge of #39116 - mgattozzi:better-string-message, r=nrc
Add clearer error message using `&str + &str`
This is the first part of #39018. One of the common things for new users
coming from more dynamic languages like JavaScript, Python or Ruby is to
use `+` to concatenate strings. However, this doesn't work that way in
Rust unless the first type is a `String`. This commit adds a check for
this use case and outputs a new error as well as a suggestion to guide
the user towards the desired behavior. It also adds a new test case to
test the output of the error.
bors [Thu, 2 Feb 2017 05:10:40 +0000 (05:10 +0000)]
Auto merge of #38932 - petrochenkov:privctor, r=jseyfried
Privatize constructors of tuple structs with private fields
This PR implements the strictest version of such "privatization" - it just sets visibilities for struct constructors, this affects everything including imports.
```
visibility(struct_ctor) = min(visibility(struct), visibility(field_1), ..., visibility(field_N))
```
Needs crater run before proceeding.
bors [Tue, 31 Jan 2017 11:18:22 +0000 (11:18 +0000)]
Auto merge of #39379 - segevfiner:fix-backtraces-on-i686-pc-windows-gnu, r=alexcrichton
Fix backtraces on i686-pc-windows-gnu by disabling FPO
This might have performance implications. But do note that MSVC
disables FPO by default nowadays and it's use is limited in exception
heavy languages like C++.
bors [Tue, 31 Jan 2017 08:44:07 +0000 (08:44 +0000)]
Auto merge of #39354 - alexcrichton:less-output, r=steveklabnik
rustdoc: Suppress warnings/errors with --test
Threads spawned by the test framework have their output captured by default, so
for `rustdoc --test` threads this propagates that capturing to the spawned
thread that we now have.
bors [Tue, 31 Jan 2017 06:13:05 +0000 (06:13 +0000)]
Auto merge of #38847 - michaelwoerister:gate-on-incr-comp, r=alexcrichton
travis: Gate on some minimal support for incremental compilation.
This commit adds a travis job that
1. builds a stage2 compiler in incremental mode (but with empty incremental compilation cache), and
2. builds and runs the run-pass test suite also in incremental mode.
Building incrementally with an empty cache makes sure that the compiler doesn't crash in dependency tracking during bootstrapping. Executing the incrementally built test suite gives some measure of confidence that we generate valid code.
Note, however, that the above does not give strong guarantees about the validity of incremental compilation, it just provides a basis for being able to rely on from-scratch incr. comp. builds as reference values in further tests (which then do actual incremental compilation).
bors [Sun, 29 Jan 2017 21:28:28 +0000 (21:28 +0000)]
Auto merge of #39382 - cuviper:ibm-rewind, r=alexcrichton
travis: move IBM backwards in time
Using Ubuntu's cross-toolchains for powerpc* and s390x meant they were
depending on glibc symbols from Ubuntu 16.04. And if that host is ever
updated to a new release, the toolchains would raise the bar too.
This switches powerpc, powerpc64, and s390x to use crosstool-ng
toolchains, configured approximately like RHEL6 with kernel 2.6.32 and
glibc 2.12. This ABI level should also be compatible with Debian 7
(wheezy) and Ubuntu 12.04 (precise).
For powerpc64le, the challenge was that only glibc-2.19 officially added
support, but RHEL7 backported those changes to glibc-2.17. The backport
patches are complex and numerous, so instead of trying to push those
into crosstool-ng, this just uses glibc binaries directly from CentOS 7
and builds the toolchain manually.
This workaround is no longer necessary as Rust, and by extension MIR, now support uninhabited type
properly. This removes the workaround for the gh32959 that was introduced in gh33267.
Josh Stone [Sun, 29 Jan 2017 05:25:11 +0000 (21:25 -0800)]
travis: move IBM backwards in time
Using Ubuntu's cross-toolchains for powerpc* and s390x meant they were
depending on glibc symbols from Ubuntu 16.04. And if that host is ever
updated to a new release, the toolchains would raise the bar too.
This switches powerpc, powerpc64, and s390x to use crosstool-ng
toolchains, configured approximately like RHEL6 with kernel 2.6.32 and
glibc 2.12. This ABI level should also be compatible with Debian 7
(wheezy) and Ubuntu 12.04 (precise).
For powerpc64le, the challenge was that only glibc-2.19 officially added
support, but RHEL7 backported those changes to glibc-2.17. The backport
patches are complex and numerous, so instead of trying to push those
into crosstool-ng, this just uses glibc binaries directly from CentOS 7
and builds the toolchain manually.