Commit Graph

55460 Commits

Author SHA1 Message Date
bors
34d14e7eed Auto merge of #34096 - eddyb:launch, r=nikomatsakis
Switch to MIR-based translation by default.

This patch makes `-Z orbit` default to "on", which means that by default, functions will be translated from Rust to LLVM IR through the upcoming MIR backend, instead of the antiquated AST backend.

This switch is made possible by the recently merged #33622, #33905 and smaller fixes.

If you experience any issues, please file a report for each of them. You can switch to the old backend to work around problems by either setting `RUSTFLAGS="-Zorbit=off"` or by annotating specific functions with `#[rustc_no_mir]` (which requires `#![feature(rustc_attrs)]` at the crate-level).

I would like this PR to get into nightly soon so that we can get early feedback in this release cycle and focus on correctness fixes and performance improvements, with the potential for removing the old backend implementation before beta branches off.

cc @rust-lang/compiler
2016-08-01 23:42:48 -07:00
m4b
884b969f2a Add -mrelax-relocations=no hacks to fix musl build 2016-08-01 23:42:15 -07:00
Eduard Burtescu
b583711ff9 Ignore the lang-items example in the book. 2016-08-02 09:02:19 +03:00
Eduard Burtescu
dbc3391a23 tests: mark the inline asm in run-pass/issue-14936 as volatile. 2016-08-02 09:01:48 +03:00
Eduard Burtescu
98a516274a rustc: parse -Z orbit=off. 2016-08-02 09:01:48 +03:00
Eduard Burtescu
b197a375c0 tests: don't use -Zorbit on run-pass/issue-28950, it stack overflows. 2016-08-02 09:01:48 +03:00
Eduard Burtescu
5d00b8aa06 rustc_trans: load C-like enums larger than usize from memory with -Zorbit. 2016-08-02 09:01:47 +03:00
Eduard Burtescu
90ba77a7a9 Make --enable-orbit the default in ./configure. 2016-08-02 09:01:47 +03:00
bors
19765f2ab1 Auto merge of #35054 - pwoolcoc:stringfromchars, r=brson
implement `From<Vec<char>>` and `From<&'a [char]>` for `String`

Though there are ways to convert a slice or vec of chars into a string,
it would be nice to be able to just do `String::from(&['a', 'b', 'c'])`,
so this PR implements `From<Vec<char>>` and `From<&'a [char]>` for
String.
2016-08-01 20:05:57 -07:00
Eduard Burtescu
a9e291c3c6 Turn -Z orbit on by default. 2016-08-02 03:29:13 +03:00
Corey Farwell
f2d8db15df Link to relevant method/struct for std::net::Shutdown docs. 2016-08-01 20:21:08 -04:00
bors
1ece9ca968 Auto merge of #35018 - cgswords:rope_tstream, r=nrc
Reimplement TokenStreams using ropes

Title says it all; a reimplementation of TokenStreams as ropes.

r? @nrc
2016-08-01 17:17:28 -07:00
Corey Farwell
57e3b9eb71 Indicate where the std::net::Incoming struct is created. 2016-08-01 20:16:56 -04:00
Scott A Carr
62cdbea8c9 deaggregate structs to enable further optimization 2016-08-01 15:57:10 -07:00
Jeffrey Seyfried
a18fc76049 Refactor directive.import(binding) -> resolver.import(binding, directive). 2016-08-01 19:10:07 +00:00
Jeffrey Seyfried
0db8ca6ca2 nit: rename module_ -> module 2016-08-01 19:10:05 +00:00
Jeffrey Seyfried
6372a6d7c2 Improve diagnostics for pattern bindings that illegally shadow items.
Improve unused import detection.
2016-08-01 19:09:58 +00:00
Jeffrey Seyfried
07c706b57c Clean up resolver.record_use(). 2016-08-01 19:06:47 +00:00
Jeffrey Seyfried
b107a4e4f6 Refactor module.try_define_child(..) -> resolver.try_define(module, ..). 2016-08-01 19:06:45 +00:00
Jeffrey Seyfried
096c3ed6c6 Refactor away resolution.try_define(). 2016-08-01 19:06:44 +00:00
Jeffrey Seyfried
5868e78b09 Refactor away resolution.report_conflicts(). 2016-08-01 19:06:43 +00:00
Jeffrey Seyfried
79e82b5c41 Implement Deref for ImportResolver to Resolver. 2016-08-01 19:06:41 +00:00
Jeffrey Seyfried
6656a30ca1 Fix fallout in ui/codemap_tests. 2016-08-01 18:42:16 +00:00
cgswords
dc259de2e3 Reimplemented tokenstreams as ropes and reduced the exposed TokenStream API. 2016-08-01 10:42:22 -07: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
Ryan Scheel (Havvy)
157f7c1b30 Add Derive not possible question to Copy
This adds a question and answer to the Q&A section of the Copy
docs. Specifically, it asks the question I asked while reading
the docs, and gives its answer.
2016-08-01 05:43:13 +00: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
Zack M. Davis
e960021d30 extended info for E0528, expected at least this-and-such many elements 2016-07-31 15:09:25 -07:00
Zack M. Davis
7093d1de84 add extended info for E0527, slice pattern element count expectations 2016-07-31 15:09:25 -07:00
Zack M. Davis
65e3ff4df4 add extended information for E0529, slice pattern expects array or slice 2016-07-31 15:09:25 -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
Jeffrey Seyfried
d6b10beb88 Make "type aliases cannot be used for traits" a note instead of a span_label. 2016-07-31 21:29:01 +00:00