Rollup merge of #44372 - bgermann:master, r=alexcrichton
Use memalign instead of posix_memalign for Solaris
As pointed out in https://github.com/rust-lang/libc/commit/deb61c8,
Solaris 10 does not support posix_memalign.
Use memalign for all Solaris versions instead.
With this change applied I am able to cross-build rustc for Solaris 10.
Rollup merge of #44332 - tirr-c:issue-44021, r=petrochenkov
Expect pipe symbol after closure parameter list
Fixes #44021.
---
Originally, the parser just called `bump` to discard following token after parsing closure parameter list, because it assumes `|` is following. However, the following code breaks the assumption:
Rollup merge of #44262 - alexcrichton:repr-128-gate, r=nikomatsakis
rustc: Separately feature gate repr(i128)
Brought up during the discussion of #35118, the support for this is still
somewhat buggy and so stabilization likely wants to be considered independently
of the type itself.
Auto merge of #44260 - alexcrichton:hardlink-no-copy, r=Mark-Simulacrum
rustbuild: Switch back to using hard links
The `copy` function historically in rustbuild used hard links to speed up the
copy operations that it does. This logic was backed out, however, in #39518 due
to a bug that only showed up on Windows, described in #39504. The cause
described in #39504 happened because Cargo, on a fresh build, would overwrite
the previous artifacts with new hard links that Cargo itself manages.
This behavior in Cargo was fixed in rust-lang/cargo#4390 where it no longer
should overwrite files on fresh builds, opportunistically leaving the filesystem
intact and not touching it.
Hopefully this can help speed up local builds by doing fewer copies all over the
place!
Alex Crichton [Sat, 2 Sep 2017 03:46:51 +0000 (20:46 -0700)]
rustbuild: Switch back to using hard links
The `copy` function historically in rustbuild used hard links to speed up the
copy operations that it does. This logic was backed out, however, in #39518 due
to a bug that only showed up on Windows, described in #39504. The cause
described in #39504 happened because Cargo, on a fresh build, would overwrite
the previous artifacts with new hard links that Cargo itself manages.
This behavior in Cargo was fixed in rust-lang/cargo#4390 where it no longer
should overwrite files on fresh builds, opportunistically leaving the filesystem
intact and not touching it.
Hopefully this can help speed up local builds by doing fewer copies all over the
place!
Auto merge of #44251 - kennytm:osx-backtrace, r=alexcrichton
Add libbacktrace support for Apple platforms (resubmitted)
Resubmitting #43422 rebased on the current master (cc @JohnColanduoni).
I have added an additional commit to fallback to `dladdr`-based `resolve_symbol` if `libbacktrace` returns `None`, otherwise the stack trace will be full of `<unknown>` when you forget to pass the `-g` flag (actually it seems — at least on macOS — the `dladdr` symbol is more accurate than the `libbacktrace` one).
Auto merge of #44438 - Xaeroxe:clamp, r=Mark-Simulacrum
Revert clamp
Revert clamp per https://github.com/rust-lang/rust/issues/44095#issuecomment-328218316 while we take time to assess the potential backwards compatibility damage done by it.
Auto merge of #44269 - nikomatsakis:issue-43613-limit-cache-obligations, r=arielb1
limit and clear cache obligations opportunistically
Keeping **all** the obligations for every projection is wasteful of
memory and compilation time. We only really care about those
subobligations that may inform the result of the projection (i.e., may
help to resolve any inference variables that appear within).
Therefore, we can clear the subobligations from the cache that don't
potentially affect the result of the projection. On every cache hit,
we also take the opportunity to check if the type variables have been
resolved *yet* and, if so, clear out the pending obligations.
Fixes #43613.
r? @arielb1
NB -- not sure how to test for this. Probably we should add the #43613 test case to perf.
Auto merge of #43742 - epdtry:pprust-expr-fix, r=petrochenkov
pprust: fix parenthesization of exprs
The pretty printer in `syntax::print::pprust` currently relies on the presence of `ExprKind::Paren` hints in order to correctly parenthesize expressions in its output. If `Paren` nodes are missing, it sometimes produces wrong output, such as printing `1 - (2 - 3)` as `1 - 2 - 3`. This PR fixes `pprust` to correctly print expressions regardless of the presence or absence of `Paren` nodes. This should make `pprust` easier to use with programmatically constructed ASTs.
A few notes:
* I added a function for assigning precedence values to exprs in `syntax::util::parser`, since there is already code there for assigning precedence values to binops. Let me know if I should move this somewhere more `pprust`-specific.
* I also moved the `contains_exterior_struct_lit` function from `rustc_lint::unused::UnusedParens` into `syntax::util::parser`, since it's needed for determining the correct parenthesization of `if`/`while` conditional expressions.
* I couldn't find a good way to compare two exprs for equivalence while ignoring semantically-irrelevant details like spans. So the test for the new behavior relies on a slight hack: it adds `Paren` nodes everywhere, so that the pretty-printed version exactly reflects the structure of the AST, and then compares the printed strings. This works, but let me know if there's a better way.
Auto merge of #44399 - alexcrichton:tmp-travis-downgrade, r=alexcrichton
travis: Downgrade to previous images temporarily
Travis is in the process of [rolling out an update][update] but looks like our
tests are breaking, let's temporarily roll back to get the queue moving again.
Alex Crichton [Thu, 7 Sep 2017 20:48:35 +0000 (13:48 -0700)]
travis: Downgrade to previous images temporarily
Travis is in the process of [rolling out an update][update] but looks like our
tests are breaking, let's temporarily roll back to get the queue moving again.
Alex Crichton [Thu, 7 Sep 2017 15:13:41 +0000 (08:13 -0700)]
rustc: Remove `CrateStore::crates` as a method
This commit moves the `crates` method to a query and then migrates all callers
to use a query instead of the now-renamed `crates_untracked` method where
possible.
Auto merge of #44249 - pnkfelix:debugflag-emit-end-regions, r=arielb1
Debugflag: -Z emit-end-regions
Skip EndRegion emission by default. Use `-Z emit-end-regions` to reenable it.
The main intent is to fix cases where `EndRegion` emission is believed to be causing excess peak memory pressure.
It may also be a welcome change to people inspecting the MIR output who find the EndRegions to be a distraction.
(In later follow-up PR's I will put in safe-guards against using the current mir-borrowck without enabling `EndRegion` emission. But I wanted this PR to be minimal, in part because we may wish to backport it to the beta channel if we find that it reduces peak memory usage significantly.)
Auto merge of #43931 - eddyb:const-local-key, r=alexcrichton
Make the LocalKey facade of thread_local! inlineable cross-crate.
Fixes (almost*) #25088 by changing the `LocalKey` `static` `thread_local!` generates to a `const`.
This can be done because a `LocalKey` value holds no actual TLS data, only function pointers to get at said data, and it could even be made `Copy` without any negative consequences.
The recent stabilization of rvalue promotion to `'static` allows doing this without changing the API.
r? @alexcrichton
*almost because we can't yet inline `__getit` because it breaks on MSVC, see https://github.com/rust-lang/rust/pull/43931#issuecomment-323534214
Auto merge of #44094 - alexcrichton:long-linkers, r=michaelwoerister
rustc: Attempt to handle super long linker invocations
This commit adds logic to the compiler to attempt to handle super long linker
invocations by falling back to the `@`-file syntax if the invoked command is too
large. Each OS has a limit on how many arguments and how large the arguments can
be when spawning a new process, and linkers tend to be one of those programs
that can hit the limit!
The logic implemented here is to unconditionally attempt to spawn a linker and
then if it fails to spawn with an error from the OS that indicates the command
line is too big we attempt a fallback. The fallback is roughly the same for all
linkers where an argument pointing to a file, prepended with `@`, is passed.
This file then contains all the various arguments that we want to pass to the
linker.
Mark Simulacrum [Thu, 7 Sep 2017 00:28:04 +0000 (18:28 -0600)]
Rollup merge of #44353 - cuviper:install-rustc, r=Mark-Simulacrum
Include rustc in the default `./x.py install`
The default install used to include rustc, rust-std, and rust-docs, but
the refactoring in commit 6b3413d825fa6 make rustc only default in
extended builds. This commit makes rustc installed by default again.
Mark Simulacrum [Thu, 7 Sep 2017 00:27:52 +0000 (18:27 -0600)]
Rollup merge of #44313 - RalfJung:book, r=nikomatsakis
rustbook: remove dead test functions
There is no "test" subcommand added to the `clap::App`, so this is all dead code.
Cc @steveklabnik -- your [commit](https://github.com/RalfJung/rust/commit/a076961fd0e3d8a68f8b047460b8f5191d203b08) introducing this stated the intention of having both commands, but it seems nobody has missed the `test` command since February.
Mark Simulacrum [Thu, 7 Sep 2017 00:27:51 +0000 (18:27 -0600)]
Rollup merge of #44303 - clarcharr:debugs, r=alexcrichton
impl Debug for SplitWhitespace.
This one got missed because `libstd_unicode` doesn't have a `deny(missing_debug_implementations)` like `libstd` and `libcore`. I think that perhaps this lint should check for items exported from other crates too.
Mark Simulacrum [Thu, 7 Sep 2017 00:27:47 +0000 (18:27 -0600)]
Rollup merge of #44218 - SimonSapin:commit-hash, r=alexcrichton
Add full git commit hash to release channel manifests
The full hash is necessary to build the download URL for "alternate" compiler builds. This is a first step for https://github.com/rust-lang-nursery/rustup.rs/issues/1099.
Use memalign instead of posix_memalign for Solaris
As pointed out in https://github.com/rust-lang/libc/commit/deb61c8,
Solaris 10 does not support posix_memalign.
Use memalign for all Solaris versions instead.
With this change applied I am able to cross-build rustc for Solaris 10.
Auto merge of #43975 - RalfJung:gcc, r=alexcrichton
use gcc::Build rather than deprecated gcc::Config
I did `cargo update -p gcc` to upgrade only this package. Is there further process that should be follwoed when updating a build dependency from crates.io?
Full demo available at https://tonberry.quietmisdreavus.net/foreign-test/foreign_test/trait.CheckIt.html
This PR splits the "Implementors" section on trait pages into two: First, for impls on types local to the crate, their impls are kept as-is, printing one line for the impl line, and any additional lines for associated types. However, for types external to the crate, they are now pulled up over the others and are printed (almost) like the summary impl on the type page itself. This gives any doc comments on these impls or methods to be exposed in the documentation.
There's just one small problem, though: [libstd docs apparently surface impls for libc and rand, possibly among others](https://tonberry.quietmisdreavus.net/foreign-std/std/marker/trait.Copy.html#foreign-impls). This adds this section to pages in the std docs where we might not want them to show up in the first place. I think this is a bug distinct from this PR, but it does make it drastically apparent.
~~My question, then, is this: Do we want this here? Taking it out involves fixing which impls are visible to rustdoc, possibly specifically when rendering the std facade. I'm convinced this is fine to land as-is, since it adds a feature specifically for non-std crates (i'm thinking of things like `num` or related crates that implement things on primitives or std types as part of their functionality).~~ (EDIT: I have an open PR to fix this: https://github.com/rust-lang/rust/pull/44026)
Alex Crichton [Sat, 26 Aug 2017 03:16:51 +0000 (20:16 -0700)]
rustc: Attempt to handle super long linker invocations
This commit adds logic to the compiler to attempt to handle super long linker
invocations by falling back to the `@`-file syntax if the invoked command is too
large. Each OS has a limit on how many arguments and how large the arguments can
be when spawning a new process, and linkers tend to be one of those programs
that can hit the limit!
The logic implemented here is to unconditionally attempt to spawn a linker and
then if it fails to spawn with an error from the OS that indicates the command
line is too big we attempt a fallback. The fallback is roughly the same for all
linkers where an argument pointing to a file, prepended with `@`, is passed.
This file then contains all the various arguments that we want to pass to the
linker.
Auto merge of #43426 - qnighy:intercrate-ambiguity-hints, r=nikomatsakis
Add hints when intercrate ambiguity causes overlap.
I'm going to tackle #23980.
# Examples
## Trait impl overlap caused by possible downstream impl
```rust
trait Foo<X> {}
trait Bar<X> {}
impl<X, T> Foo<X> for T where T: Bar<X> {}
impl<X> Foo<X> for i32 {}
fn main() {}
```
```
error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`:
--> test1.rs:4:1
|
3 | impl<X, T> Foo<X> for T where T: Bar<X> {}
| ------------------------------------------ first implementation here
4 | impl<X> Foo<X> for i32 {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
|
= note: downstream crates may implement Bar
error: aborting due to previous error
```
## Trait impl overlap caused by possible upstream update
```rust
trait Foo {}
impl<T> Foo for T where T: ::std::fmt::Octal {}
impl Foo for () {}
fn main() {}
```
```
error[E0119]: conflicting implementations of trait `Foo` for type `()`:
--> test2.rs:3:1
|
2 | impl<T> Foo for T where T: ::std::fmt::Octal {}
| ----------------------------------------------- first implementation here
3 | impl Foo for () {}
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
|
= note: upstream crates may add new impl for std::fmt::Octal in future versions
error: aborting due to previous error
```
## Inherent impl overlap caused by possible downstream impl
Josh Stone [Tue, 5 Sep 2017 21:19:22 +0000 (14:19 -0700)]
Include rustc in the default `./x.py install`
The default install used to include rustc, rust-std, and rust-docs, but
the refactoring in commit 6b3413d825fa6 make rustc only default in
extended builds. This commit makes rustc installed by default again.
Simon Sapin [Mon, 4 Sep 2017 15:31:29 +0000 (17:31 +0200)]
Make git commit info optional and per-package in channel manifests
At the moment it is always missing for Cargo and RLS.
Their respective build systems need to be modified to include
`git-commit-hash` files in their "dist" tarballs.
Mark Simulacrum [Sat, 2 Sep 2017 14:02:32 +0000 (08:02 -0600)]
Test rustdoc unit tests.
Doc tests are temporarily disabled until next release cycle, since
current beta Cargo errors on them. Upgrade should be smooth as the
relevant tests are already fixed in this commit.
Alex Crichton [Fri, 1 Sep 2017 16:24:02 +0000 (09:24 -0700)]
rustc: Store InternedString in `DefPathData`
Previously a `Symbol` was stored there, but this ended up causing hash
collisions in situations that otherwise shouldn't have a hash collision. Only
the symbol's string value was hashed, but it was possible for distinct symbols
to have the same string value, fooling various calcuations into thinking that
these paths *didn't* need disambiguating data when in fact they did!
By storing `InternedString` instead we're hopefully triggering all the exising
logic to disambiguate paths with same-name `Symbol` but actually distinct
locations.
Alex Crichton [Thu, 31 Aug 2017 22:08:34 +0000 (15:08 -0700)]
rustc: Move stability functionality into queries
This commit primarily removes the `stability` field from `TyCtxt` as well as its
internal mutable state, instead using a query to build the stability index as
well as primarily using queries for other related lookups.
Like previous commits the calculation of the stability index is wrapped in a
`with_ignore` node to avoid regressing the current tests, and otherwise this
commit also introduces #44232 but somewhat intentionally so.