Commit Graph

55273 Commits

Author SHA1 Message Date
Niko Matsakis
2797b2a5ca remove register_reads
The reads will occur naturally as the HIR/MIR is fetched from the
tracked tables, and this winds up adding reads to the hir of foreign
def-ids somehow.
2016-08-02 05:31:25 -04:00
Niko Matsakis
b4929d11ae watch out for krate numbers being reassigned
The biggest problem, actually, is krate numbers being removed entirely,
which can lead to array-index-out-of-bounds errors.

cc #35123 -- not a complete fix, since really we ought to "map" the old
crate numbers to the new ones, not just detect changes.
2016-08-02 05:31:25 -04:00
Niko Matsakis
c56eb4b7f5 remap Hir(InlinedDefId) to MetaData(OriginalDefId)
The way we do HIR inlining introduces reads of the "Hir" into the graph,
but this Hir in fact belongs to other crates, so when we try to load
later, we ICE because the Hir nodes in question don't belond to the
crate (and we haven't done inlining yet). This pass rewrites those HIR
nodes to the metadata from which the inlined HIR was loaded.
2016-08-02 05:31:25 -04:00
Niko Matsakis
9294f8ed0a hash foreign items too 2016-08-01 19:57:32 -04:00
bors
28ce3e8a55 Auto merge of #35163 - sanxiyn:rollup, r=sanxiyn
Rollup of 8 pull requests

- Successful merges: #34802, #35033, #35085, #35114, #35134, #35140, #35141, #35157
- Failed merges:
2016-08-01 08:57:32 -07:00
Seo Sanghyeon
5fb13cf13f Rollup merge of #35157 - sanxiyn:remove-workaround, r=eddyb
Remove CMake workaround

This isn't needed anymore as we aren't using CMake to build compiler-rt since #34873.
2016-08-02 00:12:41 +09:00
Seo Sanghyeon
dc63b3a04a Rollup merge of #35141 - eddyb:assert-mir-debug, r=nagisa
rustc_trans: apply the debug location for the MIR Assert panic call.

Helps `libcore` build with MIR trans and debuginfo; libcore has the body of `panic`, which resulted in:
```
inlinable function call in a function with debug info must have a !dbg location
  call void @_ZN4core9panicking5panic17h585bd70cda921012E({ %str_slice, %str_slice, i32 }* @panic_loc12745)
LLVM ERROR: Broken function found, compilation aborted!
```
2016-08-02 00:12:40 +09:00
Seo Sanghyeon
a790fbce23 Rollup merge of #35140 - the-kenny:tcp-stress-test-const-thread-count, r=alexcrichton
tcp-stress-test: Pull out thread count as a constant

This PR factors out the number of concurrent threads used in `tcp-stress-test.rs` to a constant at the top of the file.

We at @NixOS had to lower our thread count as the chrooted-builds don't allow that many threads.

This change will make it easier to lower/increase the count in the future (I actually forgot to change the second `1000` when I was working on this). Another benefit is the removal of magic numbers in the test suite.

This is related to https://github.com/rust-lang/rust/issues/35107
2016-08-02 00:12:40 +09:00
Seo Sanghyeon
2effa8982e Rollup merge of #35134 - frewsxcv:slice-chunks, r=GuillaumeGomez
Rewrite `slice::chunks` doc example to not require printing.

None
2016-08-02 00:12:40 +09:00
Seo Sanghyeon
518524de1a Rollup merge of #35114 - michaelwoerister:inline-meta-to-hir-map, r=eddyb
Move caching of inlined HIR into CrateStore

So far we've had separate HIR-inlining caches for each codegen unit and the caching for things inlined during constant evaluation had some holes. Consequently, things would be inlined multiple times if they were used from different codegen units, etc, leading to
- wasted memory,
- multiple `NodeId`s per `DefId` and,
- for things inlined during constant evaluation, no way to map a `NodeId` back to it's original `DefId`.

This PR moves all caching into the CrateStore, solving all of the above problems. It also fixes some bugs in the inlining code, like cyclic in the parent-chains in the HIR map and some `NodeId`'s being translated to more or less random values. There are assertions in place now that should prevent this kind of thing in the future.

This PR based on top of #35090, which contains some necessary fixes.
2016-08-02 00:12:39 +09:00
Seo Sanghyeon
05a2d39265 Rollup merge of #35085 - dns2utf8:git_clone_depth, r=alexcrichton
Reduce git clone --depth from 50 (default) to 1

This should speedup the builds a little.
2016-08-02 00:12:39 +09:00
Seo Sanghyeon
758333ab67 Rollup merge of #35033 - jakllsch:remaining_cpu_x86-64, r=alexcrichton
Use "x86-64" as the target CPU for NetBSD and Bitrig on amd64.

Using "generic" disables a number of features that are present on all
x86_64 cpus, the "x86-64" target cpu is the common denominator for that
arch.

Refs #20777
2016-08-02 00:12:39 +09:00
Seo Sanghyeon
054d4890cf Rollup merge of #34802 - petrochenkov:call, r=eddyb
Methods `Fn(Mut,Once)::call(mut,once)` are gated with two feature gates, remove one of them

Methods `Fn::call`, `FnMut::call_mut` and `FnOnce::call_once` are gated with usual library feature `fn_traits` and also hardcoded in the compiler and gated once more with feature `unboxed_closures`
This patch removes the `unboxed_closures`feature gate from these methods (`unboxed_closures` is still used for other things though), now they are gated only with `fn_traits`.

All unnecessary `#![feature(unboxed_closures)]`s are removed, many of them are old and were already unnecessary before the change this PR does.
2016-08-02 00:12:39 +09:00
bors
2c1612c62a Auto merge of #34743 - badboy:llvm-upgrade, r=eddyb
LLVM upgrade

As discussed in https://internals.rust-lang.org/t/need-help-with-emscripten-port/3154/46 I'm trying to update the used LLVM checkout in Rust.

I basically took @shepmaster's code and applied it on top (though I did the commits manually, the [original commits have better descriptions](https://github.com/rust-lang/rust/compare/master...avr-rust:avr-support).

With these changes I was able to build rustc. `make check` throws one last error on `run-pass/issue-28950.rs`. Output: https://gist.github.com/badboy/bcdd3bbde260860b6159aa49070a9052

I took the metadata changes as is and they seem to work, though it now uses the module in another step. I'm not sure if this is the best and correct way.

Things to do:

* [x] ~~Make `run-pass/issue-28950.rs` pass~~ unrelated
* [x] Find out how the `PositionIndependentExecutable` setting is now used
* [x] Is the `llvm::legacy` still the right way to do these things?

cc @brson @alexcrichton
2016-08-01 04:47:48 -07:00
Seo Sanghyeon
d7a04403ae Remove CMake workaround 2016-08-01 18:03:22 +09:00
bors
5ef1e7e0ef Auto merge of #34830 - michaelwoerister:internal-closures, r=nikomatsakis
trans: Avoid weak linkage for closures when linking with MinGW.

This PR proposes one possible solution to #34793, the problem that prevents https://github.com/servo/servo/pull/12393 from landing. It applies the same strategy, that we already use for monomorphizations, to closures, that is, instead of emitting symbols with `weak_odr` linkage in order to avoid symbol conflicts, we emit them with `internal` linkage, with the side effect that we have to copy code instead of just linking to it, if more than one codegen unit is involved.
With this PR, the compiler will only apply this strategy for targets where we would actually run into a problem when using `weak_odr` linkage, in other words nothing will change for platforms except for MinGW.

The solution implemented here has one restriction that could be lifted with some more effort, but it does not seem to be worth the trouble since it will go away once we use only MIR-trans: If someone compiles code

1. on MinGW,
2. with more than one codegen unit,
3. *not* using MIR-trans,
4. and runs into a closure inlined from another crate

then the compiler will abort and suggest to compile either with just one codegen unit or `-Zorbit`.

What's nice about this is that I lays a foundation for also doing the same for generics: using weak linkage where possible and thus enabling some more space optimizations that the linker can do.

~~This PR also contains a test case for compiling a program that contains more than 2^15 closures. It's a huge, generated file with almost 100K LOCs. I did not commit the script for generating the file but could do so. Alternatively, maybe someone wants to come up with a way of doing this with macros.~~
The test file is implemented via macros now (thanks @alexcrichton!)

Opinions?

Fixes #34793.

cc @rust-lang/compiler
2016-08-01 01:53:18 -07:00
Michael Woerister
eaea4ac8ac Add test case for large number of closures within one codegen unit 2016-08-01 04:34:01 -04:00
Michael Woerister
59cfe904dc trans: Avoid weak linkage for closures when linking with MinGW. 2016-08-01 04:33:39 -04:00
Jan-Erik Rediger
5d1d247523 Upgrade LLVM once more to get a bugfix
@tmiasko did some digging and discovered that
https://reviews.llvm.org/D22858 may be relevant.
2016-08-01 10:14:30 +02:00
Michael Woerister
d5a5149617 Move caching of HIR-inlining into CStore in order to avoid duplicating inlined HIR. 2016-08-01 04:09:12 -04:00
Moritz Ulrich
3ea293ddf2 tcp-stress-test.rs: Only spawn 200 threads. 2016-08-01 09:43:19 +02:00
bors
d648a16cd5 Auto merge of #35130 - sanxiyn:unused-type-parameter-error, r=nrc
Suppress unused type parameter error when type has error field

Fix #35075.
2016-07-31 23:01:06 -07:00
bors
535cea0eec Auto merge of #35151 - bcully:bcully/pr-35149, r=alexcrichton
Add libarena from local rust to stage0

This was needed at least when local rust was 1.9.0 on darwin.

Fixes #35149
2016-07-31 19:17:22 -07:00
Brendan Cully
e9d2c9654a Add libarena from local rust to stage0
This was needed at least when local rust was 1.9.0 on darwin.

Fixes #35149
2016-07-31 16:29:15 -07:00
bors
7333c4ac25 Auto merge of #35143 - arielb1:rfc447-regions, r=eddyb
typeck: use a TypeVisitor in ctp

Use a TypeVisitor in ctp instead of `ty::walk`

This fixes a few cases where a region could be projected out of a trait while not being constrained by the type parameters, violating rust-lang/rfcs#447 and breaking soundness. As such, this is a [breaking-change].

Fixes #35139

r? @eddyb
2016-07-31 14:41:58 -07:00
Ariel Ben-Yehuda
0a128f325e typeck: use a TypeVisitor in ctp
Fixes #35139
2016-07-31 23:01:02 +03:00
Eduard Burtescu
d1f341dd91 rustc_trans: apply the debug location for the MIR Assert panic call. 2016-07-31 22:17:29 +03:00
bors
2b87f031e7 Auto merge of #34986 - nikomatsakis:issue-34349, r=arielb1
Avoid writing a temporary closure kind

We used to write a temporary closure kind into the inference table, but
this could lead to obligations being incorrectled resolved before
inference had completed. This result could then be cached, leading to
further trouble. This patch avoids writing any closure kind until the
computation is complete.

Fixes #34349.

r? @arielb1 -- what do you think?
2016-07-31 11:45:19 -07:00
Moritz Ulrich
aaf8a6e108 tcp-stress-test: Factor out thread count as constant. 2016-07-31 20:28:39 +02:00
bors
379ac50809 Auto merge of #34251 - zackmdavis:forbidden_on_whose_authority, r=Manishearth
diagnostically note source of overruling outer forbid

When we emit E0453 (lint level attribute overruled by outer `forbid`
lint level), it could be helpful to note where the `forbid` level was
set, for the convenience of users who, e.g., believe that the correct
fix is to weaken the `forbid` to `deny`.

![forbidden_on_whose_authority](https://cloud.githubusercontent.com/assets/1076988/15995312/2d847376-30ce-11e6-865e-b68cfebc0291.png)
2016-07-31 08:50:46 -07:00
Vadim Petrochenkov
a80d329b68 Don't gate methods Fn(Mut,Once)::call(mut,once) with feature unboxed_closures
They are already gated with feature `fn_traits`
2016-07-31 17:48:20 +03:00
bors
5556554e25 Auto merge of #35129 - tmiasko:suggest-print-target-list, r=nagisa
Suggest use of `--print target-list` when target is not found.

If given target could not be found suggest using `--print target-list`.
Previously, error has been reported as:

$ rustc --target 86-unknown-linux-gnu
error: Error loading target specification: Could not find specification for target "86-unknown-linux-gnu"

After changes it looks as follows:

$ rustc --target 86-unknown-linux-gnu
error: Error loading target specification: Could not find specification for target "x86-unknown-linux-gnu". Use `--print target-list` for a list of supported targets
2016-07-31 05:54:19 -07:00
Tomasz Miąsko
443f1ca83c Suggest use of --print target-list when target is not found.
If given target could not be found suggest using `--print target-list`.
Previously, error has been reported as:

$ rustc --target x86-unknown-linux-gnu
error: Error loading target specification: Could not find specification for target "x86-unknown-linux-gnu"

After changes it looks as follows:

rustc --target x86-unknown-linux-gnu
error: Error loading target specification: Could not find specification for target "x86-unknown-linux-gnu"
help: Use `--print target-list` for a list of built-in targets
2016-07-31 12:20:06 +02:00
bors
724f811794 Auto merge of #35060 - japaric:arm-musl, r=alexcrichton
Add ARM MUSL targets

Rebase of #33189.

I tested this by producing a std for `arm-unknown-linux-musleabi` then I cross compiled Hello world to said target. Checked that the produced binary was statically linked and verified that the binary worked under QEMU.

This depends on rust-lang/libc#341. I'll have to update this PR after that libc PR is merged.

I'm also working on generating ARM musl cross toolchain via crosstool-ng. Once I verified those work, I'll send a PR to rust-buildbot.

r? @alexcrichton
cc @timonvo
2016-07-30 23:21:46 -07:00
Corey Farwell
2eea1f3097 Rewrite slice::chunks doc example to not require printing. 2016-07-30 23:21:48 -04:00
bors
c267ab4e3b Auto merge of #35004 - asomers:master, r=alexcrichton
Fix build of compiler-rt on FreeBSD

Broken since ee6011fc71 removed cmake from the
process.  There are likely other platforms still broken, but I didn't test on them.
2016-07-30 18:52:20 -07:00
bors
1225e122fd Auto merge of #34904 - petrochenkov:rustcall, r=nikomatsakis
Properly feature gate all unstable ABIs

Fixes https://github.com/rust-lang/rust/issues/34900
[breaking-change]
r? @pnkfelix

---
Function-visiting machinery for AST/HIR is surprisingly error-prone, it's *very* easy to miss some cases or visit something twice while writing a visitor. This is the true problem behind https://github.com/rust-lang/rust/issues/34900. I'll try to restructure these visitors a bit and send one more PR later.
2016-07-30 15:58:20 -07:00
Zack M. Davis
661b4f09fb diagnostically note source of overruling outer forbid
When we emit E0453 (lint level attribute overruled by outer `forbid`
lint level), it could be helpful to note where the `forbid` level was
set, for the convenience of users who, e.g., believe that the correct
fix is to weaken the `forbid` to `deny`.
2016-07-30 15:18:07 -07:00
Jorge Aparicio
eb6173806d return TargetResult 2016-07-30 15:44:59 -05:00
Jorge Aparicio
87fa075dba point the libc submodule back to rust-lang/libc 2016-07-30 15:39:13 -05:00
Jorge Aparicio
ea00993990 remove some anys that are no longer necessary 2016-07-30 15:39:13 -05:00
Jorge Aparicio
b38953709d rustc_back/target: remove musl_base
it's the same as linux_musl_base
2016-07-30 15:39:13 -05:00
Jorge Aparicio
f0ec906d18 arm-musl: statically link to libunwind 2016-07-30 15:39:13 -05:00
Jorge Aparicio
e50bcf3404 arm-musl: set max_atomic_width 2016-07-30 15:39:13 -05:00
Jorge Aparicio
9ffd0fe5a7 arm-musl targets now use cfg(env = "musl") 2016-07-30 15:39:13 -05:00
Timon Van Overveldt
f7247d1071 Add ARM MUSL targets.
The targets are:
- `arm-unknown-linux-musleabi`
- `arm-unknown-linux-musleabihf`
- `armv7-unknown-linux-musleabihf`

These mirror the existing `gnueabi` targets.

All of these targets produce fully static binaries, similar to the
x86 MUSL targets.

For now these targets can only be used with `--rustbuild` builds, as
https://github.com/rust-lang/compiler-rt/pull/22 only made the
necessary compiler-rt changes in the CMake configs, not the plain
GNU Make configs.

I've tested these targets GCC 5.3.0 compiled again musl-1.1.12
(downloaded from http://musl.codu.org/). An example `./configure`
invocation is:

```
./configure \
    --enable-rustbuild
    --target=arm-unknown-linux-musleabi \
    --musl-root="$MUSL_ROOT"
```

where `MUSL_ROOT` points to the `arm-linux-musleabi` prefix.
Usually that path will be of the form
`/foobar/arm-linux-musleabi/arm-linux-musleabi`.

Usually the cross-compile toolchain will live under
`/foobar/arm-linux-musleabi/bin`. That path should either by added
to your `PATH` variable, or you should add a section to your
`config.toml` as follows:

```
[target.arm-unknown-linux-musleabi]
cc = "/foobar/arm-linux-musleabi/bin/arm-linux-musleabi-gcc"
cxx = "/foobar/arm-linux-musleabi/bin/arm-linux-musleabi-g++"
```

As a prerequisite you'll also have to put a cross-compiled static
`libunwind.a` library in `$MUSL_ROOT/lib`. This is similar to [how
the x86_64 MUSL targets are built]
(https://doc.rust-lang.org/book/advanced-linking.html).
2016-07-30 15:39:13 -05:00
Timon Van Overveldt
57cad5722d Update gcc crate dependency to 0.3.27.
This is to pull in changes to support ARM MUSL targets.

This change also commits a couple of other cargo-generated changes
to other dependencies in the various Cargo.toml files.
2016-07-30 15:39:13 -05:00
bors
9dba50b059 Auto merge of #35069 - wesleywiser:too_many_symbols, r=alexcrichton
Only export #[no_mangle] extern symbols during LTO

Fixes #34985
2016-07-30 13:04:30 -07:00
bors
7f7969ef44 Auto merge of #35117 - aravind-pg:path, r=alexcrichton
On Windows, ensure PATH does not contain invalid character `"`

Fixes #34959.

r? @alexcrichton
2016-07-30 10:11:33 -07:00
Seo Sanghyeon
03652157f9 Suppress unused type parameter error when type has error field 2016-07-31 00:58:30 +09:00