Commit Graph

1261 Commits

Author SHA1 Message Date
bors
8ccab7eed5 Auto merge of #47900 - kennytm:rollup, r=kennytm
Rollup of 16 pull requests

- Successful merges: #47838, #47840, #47844, #47874, #47875, #47876, #47884, #47886, #47889, #47890, #47891, #47795, #47677, #47893, #47895, #47552
- Failed merges:
2018-01-31 20:51:02 +00:00
kennytm
86eb725953
Rollup merge of #47895 - varkor:non-utf-stdin, r=estebank
Fix ICE when reading non-UTF-8 input from stdin

Fixes #22387.
2018-02-01 02:32:10 +08:00
Alex Crichton
8ebe542480 rustc: Move location of codegen-backends dir
Right now this directory is located under:

  $sysroot/lib/rustlib/$target/lib/codegen-backends

but after seeing what we do in a few other places it seems that a more
appropriate location would be:

  $sysroot/lib/rustlib/$target/codegen-backends

so this commit moves it!
2018-01-31 10:16:26 -08:00
bors
560a2f4faf Auto merge of #45752 - estebank:highlight-primary, r=nikomatsakis
Highlight code on diagnostics when underlined

Highlight the label's span with the respective color:

<img width="692" alt="" src="https://user-images.githubusercontent.com/1606434/32411026-a1842482-c18d-11e7-9933-6510eefbad19.png">

Fix #42112.
2018-01-31 07:53:57 +00:00
varkor
c73925452c Fix ICE when reading non-UTF-8 input from stdin
Fixes #22387.
2018-01-31 00:59:20 +00:00
Esteban Küber
08287c1e26 Toggle span highlighting on -Zteach 2018-01-29 08:59:15 -08:00
Alex Crichton
c6daea7c9a rustc: Split Emscripten to a separate codegen backend
This commit introduces a separately compiled backend for Emscripten, avoiding
compiling the `JSBackend` target in the main LLVM codegen backend. This builds
on the foundation provided by #47671 to create a new codegen backend dedicated
solely to Emscripten, removing the `JSBackend` of the main codegen backend in
the process.

A new field was added to each target for this commit which specifies the backend
to use for translation, the default being `llvm` which is the main backend that
we use. The Emscripten targets specify an `emscripten` backend instead of the
main `llvm` one.

There's a whole bunch of consequences of this change, but I'll try to enumerate
them here:

* A *second* LLVM submodule was added in this commit. The main LLVM submodule
  will soon start to drift from the Emscripten submodule, but currently they're
  both at the same revision.
* Logic was added to rustbuild to *not* build the Emscripten backend by default.
  This is gated behind a `--enable-emscripten` flag to the configure script. By
  default users should neither check out the emscripten submodule nor compile
  it.
* The `init_repo.sh` script was updated to fetch the Emscripten submodule from
  GitHub the same way we do the main LLVM submodule (a tarball fetch).
* The Emscripten backend, turned off by default, is still turned on for a number
  of targets on CI. We'll only be shipping an Emscripten backend with Tier 1
  platforms, though. All cross-compiled platforms will not be receiving an
  Emscripten backend yet.

This commit means that when you download the `rustc` package in Rustup for Tier
1 platforms you'll be receiving two trans backends, one for Emscripten and one
that's the general LLVM backend. If you never compile for Emscripten you'll
never use the Emscripten backend, so we may update this one day to only download
the Emscripten backend when you add the Emscripten target. For now though it's
just an extra 10MB gzip'd.

Closes #46819
2018-01-28 18:32:45 -08:00
Alex Crichton
884715c654 rustc: Load the rustc_trans crate at runtime
Building on the work of # 45684 this commit updates the compiler to
unconditionally load the `rustc_trans` crate at runtime instead of linking to it
at compile time. The end goal of this work is to implement # 46819 where rustc
will have multiple backends available to it to load.

This commit starts off by removing the `extern crate rustc_trans` from the
driver. This involved moving some miscellaneous functionality into the
`TransCrate` trait and also required an implementation of how to locate and load
the trans backend. This ended up being a little tricky because the sysroot isn't
always the right location (for example `--sysroot` arguments) so some extra code
was added as well to probe a directory relative to the current dll (the
rustc_driver dll).

Rustbuild has been updated accordingly as well to have a separate compilation
invocation for the `rustc_trans` crate and assembly it accordingly into the
sysroot. Finally, the distribution logic for the `rustc` package was also
updated to slurp up the trans backends folder.

A number of assorted fallout changes were included here as well to ensure tests
pass and such, and they should all be commented inline.
2018-01-27 19:16:21 -08:00
John Kåre Alsaker
9a8d6b8bb5 Do not capture stderr in the compiler. Instead just panic silently for fatal errors 2018-01-26 04:52:30 +01:00
Guillaume Gomez
bbdc5b9637 Rollup merge of #47679 - etaoins:remove-redundant-backtrace-hint, r=estebank
Remove broken redundant backtrace hint

When the compiler driver panics it attempts to show a hint about using `RUST_BACKTRACE`. However, the logic is currently reversed to the hint is only shown if `RUST_BACKTRACE` is **already**   set:

```shell
> RUST_BACKTRACE=1 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

> RUST_BACKTRACE=0 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Run with `RUST_BACKTRACE=1` for a backtrace.
```

As the `panic` itself already has a working `RUST_BACKTRACE` hint just remove the broken duplicate hint entirely.
2018-01-25 15:52:13 +01:00
bors
4e3901d35f Auto merge of #47678 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests

- Successful merges: #47423, #47425, #47440, #47541, #47549, #47554, #47558, #47610, #47635, #47655, #47661, #47662, #47667, #47672
- Failed merges:
2018-01-23 16:13:18 +00:00
kennytm
6dcaa0af20
Rollup merge of #47661 - bjorn3:refactor_driver, r=michaelwoerister
Inline some rustc_driver function
2018-01-23 22:30:59 +08:00
Ryan Cumming
5de8e040d2 Remove broken redundant backtrace hint
When the compiler driver panics it attempts to show a hint about using
`RUST_BACKTRACE`. However, the logic is currently reversed to the hint
is only shown if `RUST_BACKTRACE` is *already* set:

```shell
> RUST_BACKTRACE=1 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

> RUST_BACKTRACE=0 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Run with `RUST_BACKTRACE=1` for a backtrace.
```

As the `panic` itself already has a working `RUST_BACKTRACE` hint just
remove the broken duplicate hint entirely.
2018-01-23 20:25:48 +11:00
kennytm
150f2baca8 Rollup merge of #47440 - mark-i-m:zunpretty, r=nikomatsakis
Change the --unpretty flag to -Z unpretty

First PR 😄 !

-Z unpretty no longer requires -Z unstable-options.

Also, I mildly changed the syntax of the flag to match the other -Z flags. All uses of the flag take the form `unpretty=something` where something can either `string` or `string=string` (see the help messages of the CLI).

Fix #47395

r? @nikomatsakis EDIT: apparently rust-highfive doesn't see edits...
2018-01-23 17:03:35 +08:00
bjorn3
c3fabceab1 Inline some rustc_driver function 2018-01-22 18:19:41 +01:00
QuietMisdreavus
611866f3cf cleanup 2018-01-22 15:24:27 +05:30
Manish Goregaokar
fe0c10019d Split out creation of the resolver arena in phase_2_configure_and_expand 2018-01-22 15:21:29 +05:30
Manish Goregaokar
d18b344afb Move resolve arenas/crate loader outside of the core of phase_2_configure_and_expand 2018-01-22 15:21:28 +05:30
bjorn3
cc4deb2767 Just forget the DynamicLibrary after getting a hot plugged backend 2018-01-19 20:27:52 +01:00
bjorn3
4ef16d7466 Fix hotplug backend and add test 2018-01-19 20:27:36 +01:00
bjorn3
ace502a107 Fix review comments 2018-01-19 20:27:35 +01:00
bjorn3
2d241f66fe Cleanup hot plug codegen backend code 2018-01-19 20:27:35 +01:00
bjorn3
9315ed45c5 Hot plug rustc_trans 2018-01-19 20:27:33 +01:00
bjorn3
bd2e808180 Fix rustc_driver test.rs 2018-01-19 20:27:12 +01:00
bjorn3
af0f17386f Fix rustc_driver test.rs 2018-01-19 20:27:12 +01:00
bjorn3
74c92c5562 Allow runtime switching between trans backends 2018-01-19 20:27:10 +01:00
Mark Mansi
ebfa6c709a Change the --unpretty flag to -Z unpretty
-Z unpretty no longer requires -Z unstable-options. Also, I mildly
changed the syntax of the flag to match the other -Z flags. All uses of
the flag take the form `unpretty=something` where something can either
`string` or `string=string` (see the help messages of the CLI).
2018-01-18 21:50:50 -06:00
Adam C. Foltzer
8c09d29d04 Add -Z dep-info-omit-d-target to control dep-info style
This avoids a breaking change to dep-info output, putting the
gcc/clang-compliant dep-info behavior behind a flag
2018-01-15 13:19:46 -08:00
Adam C. Foltzer
7e99764df3 remove dep-info files as targets in themselves 2018-01-15 13:18:49 -08:00
kennytm
2dc815c242
Rollup merge of #47417 - petrochenkov:noasm, r=estebank
Move "no asm" check into AST validation
2018-01-15 18:49:38 +08:00
bors
b762c2d9dd Auto merge of #47223 - alexcrichton:new-target-feature, r=eddyb
rustc: Tweak `#[target_feature]` syntax

This is an implementation of the `#[target_feature]` syntax-related changes of
[RFC 2045][rfc]. Notably two changes have been implemented:

* The new syntax is `#[target_feature(enable = "..")]` instead of
  `#[target_feature = "+.."]`. The `enable` key is necessary instead of the `+`
  to indicate that a feature is being enabled, and a sub-list is used for
  possible expansion in the future. Additionally within this syntax the feature
  names being enabled are now whitelisted against a known set of target feature
  names that we know about.

* The `#[target_feature]` attribute can only be applied to unsafe functions. It
  was decided in the RFC that invoking an instruction possibly not defined for
  the current processor is undefined behavior, so to enable this feature for now
  it requires an `unsafe` intervention.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/2045-target-feature.md
2018-01-14 03:27:35 +00:00
Alex Crichton
0ecaa67e90 rustc: Refactor attribute checking to operate on HIR
This'll enable running queries that could be cached and overall be more amenable
to the query infastructure.
2018-01-13 16:07:13 -08:00
Vadim Petrochenkov
318cf22bd1 Move "no asm" check into AST validation 2018-01-13 23:35:11 +03:00
leonardo.yvens
f93183adb4 Remove impl Foo for .. in favor of auto trait Foo
No longer parse it.
Remove AutoTrait variant from AST and HIR.
Remove backwards compatibility lint.
Remove coherence checks, they make no sense for the new syntax.
Remove from rustdoc.
2018-01-13 18:48:00 +03:00
kennytm
30dbbb528d Rollup merge of #47331 - michaelwoerister:measure-depgraph-loading, r=alexcrichton
Add -Ztime-passes line for dep-graph loading.

We measure how much time the background thread spends on loading the dep-graph but not how long the main thread is blocked while the background thread is still working. Let's change that!
2018-01-13 02:26:37 +08:00
Michael Woerister
fe21c4c522 Add -Ztime-passes line for dep-graph loading. 2018-01-10 18:23:50 +01:00
John Kåre Alsaker
9508922499 Replace uses of DepGraph.in_ignore with DepGraph.with_ignore 2018-01-09 18:35:50 +01:00
kennytm
1cbbbc0944 Rollup merge of #47233 - dotdash:cleanup_llvm, r=alexcrichton
Remove unused LLVM related code

Ticks a few more boxes on #46437
2018-01-09 01:58:46 +08:00
Malo Jaffré
3f073c409a Try to fix a perf regression by updating log
Upgrade `log` to `0.4` in multiple crates.
2018-01-07 16:54:05 +01:00
Björn Steinbrink
92189bc521 Remove redundant -Zdebug-llvm option
The same effect can be achieved using -Cllvm-args=-debug

Refs #46437 as it removes LLVMRustSetDebug()
2018-01-07 04:39:58 +01:00
Alex Crichton
8c9bf663d4 rustc: Don't use relative paths for extended errors
These no longer work now that Cargo changes the cwd of rustc while it's running.
Instead use an absolute path that's set by rustbuild.
2018-01-04 07:21:22 -08:00
Seiichi Uchida
d882691046 Prefer to use attr::contains_name() and attr::find_by_name() 2017-12-28 12:32:24 +09:00
bors
2c037d5589 Auto merge of #46779 - Zoxc:par-merge-without-sync, r=arielb1
Work towards thread safety in rustc

This PR is split out from https://github.com/rust-lang/rust/pull/45912. It contains changes which do not require the `sync` module.
2017-12-22 12:34:45 +00:00
bors
c2ecab1121 Auto merge of #46732 - estebank:silence-recovered-blocks, r=petrochenkov
Do not emit type errors on recovered blocks

When a parse error occurs on a block, the parser will recover and create
a block with the statements collected until that point. Now a flag
stating that a recovery has been performed in this block is propagated
so that the type checker knows that the type of the block (which will be
identified as `()`) shouldn't be checked against the expectation to
reduce the amount of irrelevant diagnostic errors shown to the user.

Fix #44579.
2017-12-22 07:22:33 +00:00
Esteban Küber
aaf3e318fc Do not emit type errors on recovered blocks
When a parse error occurs on a block, the parser will recover and create
a block with the statements collected until that point. Now a flag
stating that a recovery has been performed in this block is propagated
so that the type checker knows that the type of the block (which will be
identified as `()`) shouldn't be checked against the expectation to
reduce the amount of irrelevant diagnostic errors shown to the user.
2017-12-21 14:57:42 -08:00
kennytm
0ee069c70a Rollup merge of #46814 - varkor:contrib-7, r=alexcrichton
Prevent rustc overwriting input files

If rustc is invoked on a file that would be overwritten by the
compilation, the compilation now fails, to avoid accidental loss. This
resolves #13019. Kudos to @estebank, whose patch I finished off.
2017-12-22 02:50:49 +08:00
John Kåre Alsaker
30733b3e68 Remove useless Rc 2017-12-21 19:21:40 +01:00
John Kåre Alsaker
d81cd38e30 Combine GlobalArenas and DroplessArena into AllArenas 2017-12-21 19:21:39 +01:00
varkor
b59fbfdbe1 Move source-output conflict checking into compile_input 2017-12-19 01:54:00 +00:00
varkor
c76cdce3d9 Prevent rustc overwriting input files
If rustc is invoked on a file that would be overwritten by the
compilation, the compilation now fails, to avoid accidental loss. This
resolves #13019.
2017-12-18 15:35:45 +00:00