Commit Graph

55319 Commits

Author SHA1 Message Date
bors
e804a3cf25 Auto merge of #35168 - scottcarr:deaggregation, r=nikomatsakis
[MIR] Deaggregate structs to enable further optimizations

Currently, we generate MIR like:

```
tmp0 = ...;
tmp1 = ...;
tmp3 = Foo { a: ..., b: ... };
```

This PR implements "deaggregation," i.e.:

```
tmp3.0 = ...
tmp3.1 = ...
```

Currently, the code only deaggregates structs, not enums.  My understanding is that we do not have MIR to set the discriminant of an enum.
2016-08-04 03:01:37 -07:00
bors
271d048523 Auto merge of #35015 - petrochenkov:forearg, r=nikomatsakis
Properly enforce the "patterns aren't allowed in foreign functions" rule

Cases like `arg @ PATTERN` or `mut arg` were missing.
Apply the same rule to function pointer types.

Closes https://github.com/rust-lang/rust/issues/35203
[breaking-change], no breakage in sane code is expected though
r? @nikomatsakis

This is somewhat related to https://github.com/rust-lang/rfcs/pull/1685 (cc @matklad).
The goal is to eventually support full pattern syntax where it makes sense (function body may present) and to support *only* the following forms - `TYPE`, `ident: TYPE`, `_: TYPE` - where patterns don't make sense (function body doesn't present), i.e. in foreign functions and function pointer types.
2016-08-03 22:56:33 -07:00
bors
40f3ee2a01 Auto merge of #34520 - Manishearth:fix-unsafecell-docs, r=steveklabnik
Clarify UnsafeCell docs; fix #34496

None
2016-08-03 18:59:47 -07:00
bors
0a3180baab Auto merge of #35261 - eddyb:llvm-autoupgrade, r=nikomatsakis
Support removed LLVM intrinsics by invoking its AutoUpgrade mechanism.

Turns out that LLVM sometimes renames platform intrinsics or replaces them with first-class instructions.
For example, signed minimum became `select (icmp SLT, a, b), a, b` where `a` and `b` are vectors.

This is blocking the Servo rustup ([relevant failure](http://build.servo.org/builders/windows-dev/builds/226/steps/compile/logs/stdio)), as they're using a few such intrinsics.
The fix in this PR is to invoke LLVM's own `AutoUpgrade` mechanism to do the replacements.
2016-08-03 13:24:53 -07:00
Eduard Burtescu
63f0c4de67 Support removed LLVM intrinsics by invoking its AutoUpgrade mechanism. 2016-08-03 22:37:57 +03:00
Scott A Carr
06acf16cdb reduce rightward drift, add precondition comment 2016-08-03 11:10:38 -07:00
bors
a0b4e67648 Auto merge of #35174 - arielb1:llvm-type-audit, r=eddyb
Audit C++ types in rustllvm

cc @eddyb

Fixes #35131
2016-08-03 07:52:08 -07:00
Ariel Ben-Yehuda
3041a97b1a finish type-auditing rustllvm 2016-08-03 15:08:47 +03:00
Ariel Ben-Yehuda
24874170b4 split the FFI part of rustc_llvm to rustc_llvm::ffi 2016-08-03 15:08:47 +03:00
Ariel Ben-Yehuda
d091ef802f begin auditing the C++ types in RustWrapper 2016-08-03 15:08:47 +03:00
Ariel Ben-Yehuda
696691e3c4 audit LLVM C++ types in ArchiveWrapper and PassWrapper 2016-08-03 15:08:47 +03:00
Ariel Ben-Yehuda
81df89fc2d remove the ExecutionEngine binding
the code has no tests and will just bitrot by itself.

this is a [breaking-change]
2016-08-03 15:08:47 +03:00
bors
9cf189701e Auto merge of #35178 - m4b:fix-relx-musl, r=alexcrichton
Add -mrelax-relocations=no hacks to fix musl build

* this is just a start, dunno if it will work, but I'll just push it out to get feedback (my rust is still building 😢)
* I don't know much about rustbuild, so i just added that flag in there. it's a total hack, don't judge me
* I suspect the places in the musl .mk files are sufficient (but we may also need it present when building std), I'm not sure, needs more testing.
2016-08-03 02:23:29 -07:00
bors
ea07d52676 Auto merge of #35176 - japaric:no-atomics, r=alexcrichton
core: fix `cargo build` for targets with "max-atomic-width": 0

This crate was failing to compile due to dead_code/unused_imports
warnings. This commits disables these two lints for these targets.

---

r? @alexcrichton
cc @Amanieu is `cfg(target_has_atomic = "8")` the right `cfg` to use? I think that all targets that support some form of atomics will at a minimum support byte level atomics.

FWIW, the only thing that's left in `sync::atomic` for these targets is `Ordering` and the `fence` function.
2016-08-02 23:32:31 -07:00
bors
f495483f2d Auto merge of #35159 - michaelwoerister:incr-comp-implies-orbit, r=nikomatsakis
Automatically enable -Zorbit if -Zincremental is specified.

Fixes #34973

r? @nikomatsakis
2016-08-02 20:25:50 -07:00
bors
379bfd0bc1 Auto merge of #35197 - eddyb:mir-cross-crate, r=nikomatsakis
rustc_trans: don't lose the cross-crate DefId, MIR trans needs it.

We might have been missing out on some issues because MIR trans was never being used cross-crate.

cc @rust-lang/compiler
2016-08-02 16:13:55 -07:00
Vadim Petrochenkov
5c88efc0da Properly enforce the "patterns aren't allowed in foreign functions" check
Apply the same check to function pointer types
2016-08-03 01:29:53 +03:00
Eduard Burtescu
ee977e715f rustc_trans: don't lose the cross-crate DefId, MIR trans needs it. 2016-08-03 01:25:34 +03:00
Scott A Carr
d5908a3250 run mir opt test with mir-opt-level=3 so they fire 2016-08-02 14:47:53 -07:00
Vadim Petrochenkov
e5cc046659 Move the E0130 check to AST validation pass 2016-08-03 00:44:10 +03:00
Michael Woerister
44dbc4907d Automatically enable -Zorbit if -Zincremental is specified. 2016-08-02 17:02:01 -04:00
bors
a005b67859 Auto merge of #35187 - alexcrichton:only-orbit-off-stage1-and-two, r=eddyb
mk: Only pass -Zorbit=off in stage1/2

The stage0 compiler doesn't understand this option.
2016-08-02 13:10:27 -07:00
Alex Crichton
2fd8044cef mk: Only pass -Zorbit=off in stage1/2
The stage0 compiler doesn't understand this option.
2016-08-02 13:06:43 -07:00
Jorge Aparicio
5f80104431 core: fix cargo build for targets with "max-atomic-width": 0
This crate was failing to compile due to dead_code/unused_imports
warnings. This commits disables these two lints for these targets.
2016-08-02 14:34:40 -05:00
Scott A Carr
d918c990de add hashtag to emphasis its a gh issue 2016-08-02 12:30:57 -07:00
Scott A Carr
e8bfba7dc8 fix field type, add test 2016-08-02 11:24:55 -07:00
Scott A Carr
bda46c21fe reduce rightward drift, add fixme 2016-08-02 10:46:26 -07:00
m4b
5383cd7163 Fix style issues 2016-08-02 09:54:05 -07:00
bors
32e462ef99 Auto merge of #35145 - jseyfried:avoid_extra_resolve_error, r=arielb1
resolve: Avoid emitting an unhelpful cascading resolution error

Fixes #35142.
2016-08-02 06:12:23 -07:00
bors
97d5be9819 Auto merge of #35084 - tbu-:pr_lowercase_wtf8_debug, r=brson
Escape the unmatched surrogates with lower-case hexadecimal numbers

It's done the same way for the rest of the codepoint escapes.
2016-08-02 02:30:17 -07:00
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
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
Scott A Carr
62cdbea8c9 deaggregate structs to enable further optimization 2016-08-01 15:57:10 -07: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