Commit Graph

62061 Commits

Author SHA1 Message Date
bors 8c72b7651f Auto merge of #39648 - Aatch:mir-inlining-2, r=eddyb
[MIR] Implement Inlining

Fairly basic implementation of inlining for MIR. Uses conservative
heuristics for inlining.

Doesn't handle a number of cases, but can be extended later. This is basically the same as the previous inlining PR, but without the span-related changes (as the bugs it was dealing with have since been fixed).

/cc @rust-lang/compiler
2017-03-11 08:25:44 +00:00
bors 1727b23317 Auto merge of #40432 - alexcrichton:rollup, r=alexcrichton
Rollup of 38 pull requests

- Successful merges: #39202, #39820, #39918, #39921, #40092, #40146, #40199, #40225, #40239, #40257, #40259, #40261, #40277, #40278, #40287, #40297, #40311, #40315, #40319, #40324, #40336, #40340, #40344, #40345, #40367, #40369, #40372, #40373, #40379, #40385, #40386, #40389, #40400, #40404, #40410, #40422, #40423, #40424
- Failed merges: #40220, #40329, #40426
2017-03-11 05:41:41 +00:00
Alex Crichton 3493d91a18 Test fixes and rebase conflicts 2017-03-10 20:05:06 -08:00
Alex Crichton d03b6b3ea0 Rollup merge of #40424 - alexcrichton:faster-travis-osx, r=brson
travis: Remove compiling OpenSSL through homebrew

I don't believe that we need this any more now that `cargo-vendor` isn't
installed to create a source tarball (that only happens on Linux)
2017-03-10 20:05:06 -08:00
Alex Crichton b32393c889 Rollup merge of #40423 - DirkyJerky:patch-2, r=BurntSushi
Clarify docs in `VecDeque::resize`
2017-03-10 20:05:06 -08:00
Alex Crichton f4b4e097a6 Rollup merge of #40410 - clarcharr:os_string_shrink_to_fit, r=alexcrichton
OsString::shrink_to_fit.

Considering how the other capacity-related methods are there, I found it odd that this one wasn't included.

Will create a tracking issue once I get an OK on this.
2017-03-10 20:05:06 -08:00
Alex Crichton dcf41821b8 Rollup merge of #40389 - F001:placementVecDeque, r=nagisa
Implement placement-in protocol for `VecDeque`

CC #30172

r? @nagisa
2017-03-10 20:05:04 -08:00
Alex Crichton d0da85d725 Rollup merge of #40386 - tbu-:pr_display_frombyteswithnulerror, r=alexcrichton
Distinguish the ways `CStr::from_bytes_with_nul` can fail
2017-03-10 20:05:02 -08:00
Alex Crichton 8f02dc290a Rollup merge of #40379 - clarcharr:box_docs, r=brson
Box docs: no allocation is done for ZSTs.

Updated to add a small bit saying that ZSTs don't actually allocate on `Box::new`.
2017-03-10 20:04:58 -08:00
bors 71c058b305 Auto merge of #40422 - alexcrichton:retry-linker-segfault, r=arielb1
rustc: Support auto-retry linking on a segfault

This is a last-ditch attempt to help our pain with dealing with #38878 on the
bots. A new environment variable is added to the compiler,
`RUSTC_RETRY_LINKER_ON_SEGFAULT`, which will instruct the compiler to
automatically retry the final linker invocation if it looks like the linker
segfaulted (up to 2 extra times).

Unfortunately there have been no successful attempts to debug #38878. The only
information seems to be that the linker (e.g. `ld` on OSX) is segfaulting
somewhere in some thread pool implementation. This appears to be spurious as
failed PRs will later merge.

The hope is that this helps the queue keep moving without clogging and delaying
PRs due to #38878.
2017-03-11 00:54:09 +00:00
Alex Crichton 2b1d1bbf2a Rollup merge of #40336 - alexcrichton:fast-dep-info, r=nrc
rustc: Exit quickly on only `--emit dep-info`

This commit alters the compiler to exit quickly if the only output being emitted
is `dep-info`, which doesn't need a lot of other information to generate.

Closes #40328
2017-03-10 16:18:28 -08:00
Alex Crichton c1c3b09f28 Rollup merge of #40324 - alexcrichton:sccache-errors, r=aturon
travis: Attempt to debug sccache failures

I can't find anything that'd cause unexpected EOF in the source, so let's try
taking a look at the error logs on failures.
2017-03-10 16:18:28 -08:00
Alex Crichton 755877dbfd Rollup merge of #40311 - nrc:save-proc-macro-attr, r=jseyfried
Expect macro defs in save-analysis and add expn info to spans for att…

…r proc macros

r? @jseyfried
2017-03-10 16:18:28 -08:00
Alex Crichton ac1bbf7cee Rollup merge of #40297 - alexcrichton:fix-submodules, r=brson
Don't put Cargo into the rustc workspace

This causes problems when first cloning and bootstrapping the repository
unfortunately, so let's ensure that Cargo sticks around in its own workspace.
Because Cargo is a submodule it's not available by default on the inital clone
of the rust-lang/rust repository. Normally it's the responsibility of the
rustbuild to take care of this, but unfortunately to build rustbuild itself we
need to resolve the workspace conflicts.

To deal with this we'll just have to ensure that all submodules are in their own
workspace, which sort of makes sense anyway as updates to dependencies as
bugfixes to Cargo should go to rust-lang/cargo instead of rust-lang/rust. In any
case this commit removes Cargo from the global workspace which should resolve
the issues that we've been seeing.

To actually perform this the `cargo` submodule has been moved to a new `vendor`
directory to ensure it's outside the scope of `src/Cargo.toml` as a workspace.

Closes https://github.com/rust-lang/rust/issues/40284
2017-03-10 16:18:28 -08:00
Alex Crichton c253eb23a6 Rollup merge of #40287 - estebank:label-overlap, r=nrc
Fix incorrect span label formatting

Fix #40157.
2017-03-10 16:18:28 -08:00
Alex Crichton dcc24b18ca Rollup merge of #40278 - GuillaumeGomez:css-cleanup, r=frewsxcv
Clean up rustdoc css

r? @rust-lang/docs
2017-03-10 16:18:28 -08:00
Alex Crichton 416889f499 Rollup merge of #40277 - rkruppe:llvm-parallel-link-jobs, r=alexcrichton
rustbuild: expose LLVM_PARALLEL_LINK_JOBS

This allows limiting the number of linker jobs to avoid swapping when linking LLVM with debug info.
2017-03-10 16:18:27 -08:00
Alex Crichton 0ce745bc30 Rollup merge of #40261 - infinity0:patch-1, r=alexcrichton
Support armhf abi on 64-bit ARM cpus

They report their `uname -m` as armv8l rather than aarch64.

Patch originally by Matthias Klose <doko@debian.org>
2017-03-10 16:18:27 -08:00
Alex Crichton 5c715dee38 Rollup merge of #40259 - TimNN:fix-emscripten-tests, r=alexcrichton
Fix emscripten test detection

Without this change `rustbuild` will attempt to run `.js.map` files (if they exist) resulting in lots of sadness.

r? @alexcrichton
2017-03-10 16:18:27 -08:00
Alex Crichton 5377eab1ec Rollup merge of #40239 - nagisa:death-to-plugins, r=nikomatsakis
Remove ability for plugins to register a MIR pass

In recent months there have been a few different people investigating how to make a plugin that
registers a MIR-pass – one that isn’t intended to be eventually merged into rustc proper.

The interface to register MIR passes was added primarily for miri (& later was
found to make prototyping of rustc-proper MIR passes a tiny bit faster). Since miri does not use
this interface anymore it seems like a good time to remove this "feature".

For prototyping purposes a similar interface can be added by developers themselves in their custom
rustc build.

cc @nikomatsakis
2017-03-10 16:18:27 -08:00
Alex Crichton 37265d8b78 Rollup merge of #40225 - shepmaster:restore-build-date-file, r=alexcrichton
Restore creating the channel-rust-$channel-date.txt files

I have **not** run this (because I don't know how to 😇), but it *does* compile.

r? @alexcrichton
2017-03-10 16:18:27 -08:00
Alex Crichton da994cdee5 Rollup merge of #40092 - sinkuu:fix_suggestion_index, r=pnkfelix
Fix suggestion span error with a line containing multibyte characters

This PR fixes broken suggestions caused by multibyte characters.

e.g. for this code, rustc provides a broken suggestion ([playground](https://is.gd/DWGLu7)):

```rust
fn main() {
    let tup = (1,);
    println!("☃{}", tup[0]);
}
```

```
error: cannot index a value of type `({integer},)`
 --> <anon>:3:21
  |
3 |     println!("☃{}", tup[0]);
  |                     ^^^^^^
  |
help: to access tuple elements, use tuple indexing syntax as shown
  |     println!("☃{}"tup.00]);

error: aborting due to previous error
```

`CodeSuggestion::splice_lines` is misusing `Loc.col` (`CharPos`) as a byte offset when slicing source.
2017-03-10 16:18:25 -08:00
Alex Crichton b92073dd52 Rollup merge of #39918 - petrhosek:fuchsia-ci, r=alexcrichton
travis: Fuchsia builder

This change introduces a Dockerfile and script which builds a complete
Fuchsia toolchain which can be used to build Rust distribution for
Fuchsia. We only support cross-compiling at the moment, hence only
setting the target.
2017-03-10 16:51:14 -06:00
Alex Crichton 3b7a534d85 Rollup merge of #39820 - jonasbb:export-attributes, r=nrc
Export attributes in save-analysis data

Since this is my first pull-request to rust, I would like to get some feedback about obvious errors in this implementation.

I would like to change the save-analysis data to include arbitrary attribute data.
A use-case I have in mind for this is identifying functions with `#[test]` annotations such that tools like rls can offer a test-runner feature. I described my idea here [rls#173](https://github.com/rust-lang-nursery/rls/issues/173).

My changes contain:

1. track a vector of attributes in the various `*Data` types in `data.rs` and `external_data.rs`
2. implement lowering for `Attribute` and `MetaItem`
3. adjust `JsonDumper` to print the attributes

In the lowering of `Attribute` I remove the distinction between `MetaItem` and `NestedMetaItem`. I did this because this distinction is somewhat confusing. For example, `NestedMetaItemKind::Literal` has two identical spans, because both `NestedMetaItem` and `Lit` are defined as `Spanned<_>`.
My model is strictly more general, as it allows an `LitKind` instead of a `Symbol` for `MetaItem` and `Symbol`s are converted into a cooked string. As a consumer of the save-analysis data this shouldn't affect you much.

Example json output of `#[test]` annotation:
```
"attributes": [
  {
    "value": {
      "name": {
        "variant": "Str",
        "fields": [
          "test",
          "Cooked"
        ]
      },
      "kind": "Literal",
      "span": {
        "file_name": "test.rs",
        "byte_start": 2,
        "byte_end": 6,
        "line_start": 1,
        "line_end": 1,
        "column_start": 3,
        "column_end": 7
      }
    },
    "span": {
      "file_name": "test.rs",
      "byte_start": 0,
      "byte_end": 7,
      "line_start": 1,
      "line_end": 1,
      "column_start": 1,
      "column_end": 8
    }
  }
]
```
2017-03-10 16:51:13 -06:00
Alex Crichton d335c0a09b Rollup merge of #39202 - estebank:nested-unsafe, r=jonathandturner
Point to enclosing block/fn on nested unsafe

When declaring nested unsafe blocks (`unsafe {unsafe {}}`) that trigger
the "unnecessary `unsafe` block" error, point out the enclosing `unsafe
block` or `unsafe fn` that makes it unnecessary.

<img width="621" alt="" src="https://cloud.githubusercontent.com/assets/1606434/22139922/26ad468a-de9e-11e6-8884-2945be882ea8.png">

Fixes #39144.
2017-03-10 16:51:12 -06:00
Alex Crichton c65996ea3b Don't put Cargo into the rustc workspace
This causes problems when first cloning and bootstrapping the repository
unfortunately, so let's ensure that Cargo sticks around in its own workspace.
Because Cargo is a submodule it's not available by default on the inital clone
of the rust-lang/rust repository. Normally it's the responsibility of the
rustbuild to take care of this, but unfortunately to build rustbuild itself we
need to resolve the workspace conflicts.

To deal with this we'll just have to ensure that all submodules are in their own
workspace, which sort of makes sense anyway as updates to dependencies as
bugfixes to Cargo should go to rust-lang/cargo instead of rust-lang/rust. In any
case this commit removes Cargo from the global workspace which should resolve
the issues that we've been seeing.

To actually perform this the `cargo` submodule has been moved to the top
directory to ensure it's outside the scope of `src/Cargo.toml` as a workspace.
2017-03-10 14:49:19 -08:00
Alex Crichton dcfc7ee853 travis: Remove compiling OpenSSL through homebrew
I don't believe that we need this any more now that `cargo-vendor` isn't
installed to create a source tarball (that only happens on Linux)
2017-03-10 10:25:16 -08:00
Geoff Yoerger 384ee48a1a Clarify docs in `VecDeque::resize` 2017-03-10 12:11:13 -06:00
Clar Charr 83814fd8ab OsString::shrink_to_fit. 2017-03-10 12:15:30 -05:00
Alex Crichton 993eae1816 rustc: Support auto-retry linking on a segfault
This is a last-ditch attempt to help our pain with dealing with #38878 on the
bots. A new environment variable is added to the compiler,
`RUSTC_RETRY_LINKER_ON_SEGFAULT`, which will instruct the compiler to
automatically retry the final linker invocation if it looks like the linker
segfaulted (up to 2 extra times).

Unfortunately there have been no successful attempts to debug #38878. The only
information seems to be that the linker (e.g. `ld` on OSX) is segfaulting
somewhere in some thread pool implementation. This appears to be spurious as
failed PRs will later merge.

The hope is that this helps the queue keep moving without clogging and delaying
PRs due to #38878.
2017-03-10 09:13:53 -08:00
Petr Hosek 9a8461104e travis: Fuchsia builder
This change introduces a Dockerfile and script which builds a complete
Fuchsia toolchain which can be used to build Rust distribution for
Fuchsia. We only support cross-compiling at the moment, hence only
setting the target.
2017-03-10 08:28:40 -08:00
Alex Crichton 5c8aa74d26 rustc: Exit quickly on only `--emit dep-info`
This commit alters the compiler to exit quickly if the only output being emitted
is `dep-info`, which doesn't need a lot of other information to generate.

Closes #40328
2017-03-10 08:18:24 -08:00
Nick Cameron 5afe784daa Expect macro defs in save-analysis and add expn info to spans for attr proc macros 2017-03-10 08:16:21 -08:00
Esteban Küber 7b0dd7bdb8 Fix incorrect span label formatting 2017-03-10 08:14:31 -08:00
Ximin Luo 0a55c8e659 Support armhf abi on 64-bit ARM cpus
They report their `uname -m` as armv8l rather than aarch64.

Patch originally by Matthias Klose <doko@debian.org>
2017-03-10 08:13:21 -08:00
Simonas Kazlauskas 4ca9c97ace Remove ability for plugins to register a MIR pass
In recent months there have been a few different people investigating how to make a plugin that
registers a MIR-pass – one that isn’t intended to be eventually merged into rustc proper.

The interface to register MIR passes was added primarily for miri (& later was
found to make prototyping of rustc-proper MIR passes a tiny bit faster). Since miri does not use
this interface anymore it seems like a good time to remove this "feature".

For prototyping purposes a similar interface can be added by developers themselves in their custom
rustc build.
2017-03-10 08:09:29 -08:00
Jonas Bushart db35604792 Move remove_docs_from_attrs into lowering step 2017-03-10 08:02:24 -08:00
Jonas Bushart 203d22762d Store attributes as strings
Remove the AST structure
2017-03-10 08:02:24 -08:00
Jonas Bushart a07c9a20b7 Export attributes in save-analysis data
Some annotations like the "test" annotations might be of interest for
other projects, especially rls. Export all attributes in a new
attributes item.
2017-03-10 08:02:24 -08:00
Esteban Küber ac2bc7c570 Point to enclosing block/fn on nested unsafe
When declaring nested unsafe blocks (`unsafe {unsafe {}}`) that trigger
the "unnecessary `unsafe` block" error, point out the enclosing `unsafe
block` or `unsafe fn` that makes it unnecessary.
2017-03-10 07:53:08 -08:00
Alex Crichton a8cacd3d21 travis: Attempt to debug sccache failures
I can't find anything that'd cause unexpected EOF in the source, so let's try
taking a look at the error logs on failures.
2017-03-10 07:51:14 -08:00
bors f573db4f80 Auto merge of #39518 - alexcrichton:update-cargo, r=arielb1
rustbuild: Use copies instead of hard links

The original motivation for hard links was to speed up the various stages of
rustbuild, but in the end this is causing problems on Windows (#39504).

This commit tweaks the build system to use copies instead of hard links
unconditionally to ensure that the files accessed by Windows are always
disjoint.

Locally this added .3s to a noop build, so it shouldn't be too much of a
regression hopefully!

Closes #39504
2017-03-10 13:22:12 +00:00
bors 5aaa60611c Auto merge of #39835 - brson:relnotes, r=brson
Release notes for 1.16

[Rendered](https://github.com/brson/rust/blob/relnotes/RELEASES.md)
2017-03-10 07:49:06 +00:00
James Miller 3eb26d1f2b Only run inlining if mir opts are enabled 2017-03-10 03:54:38 +02:00
James Miller f55e92b2a7 Add dep-graph tasks where needed 2017-03-10 03:54:38 +02:00
James Miller 71d0d921c2 Initial implementation of inlining for MIR
Fairly basic implementation of inlining for MIR. Uses conservative
heuristics for inlining.
2017-03-10 03:54:26 +02:00
James Miller 540b52e145 Fix recursion depth counting in `layout` 2017-03-10 02:55:39 +02:00
James Miller d708a4072a Add extra methods to IndexVec and implement TypeFoldable for it
Adds `get`/`get_mut` accessors and `drain`/`drain_enumerated` iterators
to IndexVec.

Implements TypeFoldable for IndexVec.
2017-03-10 02:55:39 +02:00
Brian Anderson 23c09eaa77 Release notes for 1.16 2017-03-09 21:35:44 +00:00
bors ec87925325 Auto merge of #40382 - alexcrichton:split-tested-targets, r=brson
travis: Split the linux-tested-targets builder

Travis only gives us 30GB disk space and we don't currently have an option to
increase that. Each musl target generates "hello world" binaries of about 3.5MB
in size, and we're testing two targets in the same image. We have around 3k
run-pass tests and 2 musl targets which works out to around 20GB. That's
dangerously close to the limit and is causing PRs to bounce.

This PR splits up the builder in two, one for x86_64 musl and the other for
i686. Hopefully that'll keep us under the disk limit.

Closes #40359
2017-03-09 20:46:14 +00:00