Commit Graph

62023 Commits

Author SHA1 Message Date
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
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
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
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
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
Alex Crichton
f44801c5ee 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 11:54:24 -08:00
Alex Crichton
6f431491d0 rustc: Prefer loading crates in the sysroot
This commit is a random stab in the dark to fix the spurious failures on #39518.
The leading theory of the spurious failures on Windows is that the compiler is
loading a path in the `deps` folder, passing it to `link.exe`, and then this is
racing with Cargo itself updating those paths.

This race, however, has a few unique properties:

* It's isolated to just libstd. Most crates are never passed to the linker and
  simultaneously being worked on by Cargo. Cargo's typical execution of the
  dependency graph never hits this problem.
* The crates are already all located in the sysroot in addition to the `deps`
  folder. This means that the compiler actually has two candidates of crates to
  load, and it's just arbitrarily rejecting one.

Together this means that we shouldn't need to fix this problem "in the large"
and we can instead just fix it in this isolated situation (hopefully). To solve
this the compiler's been updated to prefer crates from the sysroot to leave
Cargo's structure to itself.

We'll see if this actually allows the PR to land...
2017-03-09 07:00:13 -08:00
Alex Crichton
3be02fc410 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!
2017-03-09 07:00:13 -08:00
Jake Goulding
3e2390ff9c Restore creating the channel-rust-$channel-date.txt files 2017-03-09 08:52:11 -05:00
Jake Goulding
57c989caa1 Fix botched member variable rename 2017-03-09 08:52:11 -05:00
Tim Neumann
4eeede3e0f fix emscripten test detection 2017-03-09 11:43:53 +01:00
bors
3087a1f39e Auto merge of #40368 - arielb1:rollup, r=arielb1
Rollup of 20 pull requests

- Successful merges: #40154, #40222, #40226, #40237, #40254, #40258, #40265, #40268, #40279, #40283, #40292, #40293, #40296, #40316, #40321, #40325, #40326, #40327, #40333, #40335
- Failed merges:
2017-03-09 08:26:17 +00:00
bors
5c9208faf1 Auto merge of #40337 - alexcrichton:racy-dirs, r=brson
rustbuild: Assert directory creation succeeds

I've been seeing failures on the bots when building jemalloc and my assumption
is that it's because cwd isn't created. That may be possible if this
`create_dir_all` call change in this commit fails, in which case we ignore the
error.

This commit updates the location to call `create_dir_racy` which handles
concurrent invocations, as multiple build scripts may be trying to create the
`native` dir.
2017-03-09 06:06:34 +00:00
bors
758f37480b Auto merge of #40371 - arielb1:bean-counter, r=alexcrichton
add some disk usage accounting

Try to figure out why we are out of free space

r? @alexcrichton
2017-03-09 00:20:25 +00:00
Ariel Ben-Yehuda
8bbbfec96f add some disk usage accounting
Try to figure out why we are out of free space
2017-03-09 00:05:36 +02:00
Ariel Ben-Yehuda
f2886e8bda Rollup merge of #40335 - tbu-:pr_doc_str_to_somecase, r=steveklabnik
Document why `str.to_{lower,upper}case` return `String`

Fixes #39201.
2017-03-08 20:54:10 +02:00
Ariel Ben-Yehuda
aea8010098 Rollup merge of #40333 - tbu-:pr_doc_ptr_write, r=alexcrichton
Clarify handling of `src` in `ptr::write`

Fixes #39733.
2017-03-08 20:54:08 +02:00
Ariel Ben-Yehuda
e8eb05cddd Rollup merge of #40327 - GuillaumeGomez:macros-urls, r=frewsxcv
Add missing urls in some macros doc

r? @frewsxcv
2017-03-08 20:54:07 +02:00
Ariel Ben-Yehuda
5ad3f09216 Rollup merge of #40326 - crazymerlyn:fix-doc-link, r=alexcrichton
Update link to COMPILER_TESTS.md in CONTRIBUTING.md

Link to compiler test documentation was broken after the file was moved by #40086.
This updates the link to the new location of the file.
2017-03-08 20:54:06 +02:00
Ariel Ben-Yehuda
99aad021ce Rollup merge of #40325 - eddyb:pr38143, r=alexcrichton
Added remove_from to vec.rs (#38143)

Turns out that if you push to someone's PR branch and cause the PR to close, you lose delegation 😞.

@madseagames I'm really sorry about that 😭
2017-03-08 20:54:05 +02:00
Ariel Ben-Yehuda
4e347d634d Rollup merge of #40321 - joelgallant:joelgallant-readme, r=aturon
README formatting in configure/make section

Tiny change to render the `config.mk` correctly
2017-03-08 20:54:03 +02:00
Ariel Ben-Yehuda
75262cb1f3 Rollup merge of #40316 - oli-obk:patch-4, r=GuillaumeGomez
Fix a typo in the docs
2017-03-08 20:54:02 +02:00
Ariel Ben-Yehuda
37faa60d8e Rollup merge of #40296 - topecongiro:add-missing-tests, r=alexcrichton
Add tests for issues with the 'E-needtest' label.

This PR adds tests for the following issues:
2017-03-08 20:54:01 +02:00
Ariel Ben-Yehuda
d4eb25cf0e Rollup merge of #40293 - malbarbo:rustdoctest, r=alexcrichton
Remove extra space in test description (of a mod test)
2017-03-08 20:54:00 +02:00
Ariel Ben-Yehuda
949eafe34a Rollup merge of #40292 - mmatyas:readme_fix, r=alexcrichton
Fix text formatting in README

There was a missing backtick in the README.
2017-03-08 20:53:59 +02:00
Ariel Ben-Yehuda
5070403f2d Rollup merge of #40283 - oconnor663:args_docs, r=alexcrichton
clarify docs for Args and ArgsOs

The args() and args_os() docs include a line about how the first element
is usually the program name. Include that line in the struct docs too.
2017-03-08 20:53:58 +02:00
Ariel Ben-Yehuda
006c74432d Rollup merge of #40279 - gibfahn:test-unwind, r=est31
Add compile-fail tests for remaining items in whitelist and remove it

Add compile-fail tests for `cfg_target_thread_local` and `unwind_attributes`, and remove the whitelist.

Let me know if I should clean up the tests (or if I've done anything else wrong, this is my first contribution to rust).

cc/ @est31
2017-03-08 20:53:57 +02:00
Ariel Ben-Yehuda
4eb7a335c0 Rollup merge of #40268 - Mark-Simulacrum:normalization-followup, r=arielb1
Fix normalization error

Follows #40163. I don't know whether this is good, but seems logical.

[This block of code](ba07bd5d23/src/librustc_typeck/check/mod.rs (L2110-L2138)) doesn't contain a call to `normalize_associated_types_in`, while [this](https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/check/mod.rs#L2027-L2028) block does, and is nearly identical.

Ideally these two blocks should be unified into one, but since the change doesn't seem trivial and I'm unsure if this patch will be accepted it hasn't been done yet.

r? @arielb1
2017-03-08 20:53:56 +02:00
Ariel Ben-Yehuda
5694ac9e7b Rollup merge of #40265 - wesleywiser:rustdoc_style, r=GuillaumeGomez
Improve the style of the sidebar in rustdoc output

Makes the sidebar a light grey and highlights the currently viewed item in the sidebar more prominently.

All visual design credit goes to @johnwhelchel (#37856)

Sample screenshots:

![screen shot 2017-03-04 at 12 29 48 pm](https://cloud.githubusercontent.com/assets/831192/23580829/db6c26c2-00d6-11e7-8d89-822e25ba79f0.png)

![screen shot 2017-03-04 at 12 30 10 pm](https://cloud.githubusercontent.com/assets/831192/23580828/db69eeca-00d6-11e7-9f89-1e06fd3bf098.png)

![screen shot 2017-03-04 at 12 30 31 pm](https://cloud.githubusercontent.com/assets/831192/23580830/db6d00ce-00d6-11e7-89ca-cd03e148a121.png)
2017-03-08 20:53:55 +02:00
Ariel Ben-Yehuda
f38e332b79 Rollup merge of #40258 - est31:master, r=nikomatsakis
Fix description of closure coercion feature

Thanks to @whitequark for pointing this out.
2017-03-08 20:53:54 +02:00
Ariel Ben-Yehuda
1e536245e8 Rollup merge of #40254 - nagisa:compiler-builtin-no-panic, r=alexcrichton
Fix personality_fn within the compiler_builtins

compiler_builtins may not have any unwinding within it to link correctly. This is notoriously
finicky, and this small piece of change removes yet another case where personality function
happens to get introduced.

Side note: I do remember solving the exact same thing before. I wonder why it has reappered...

@cuviper, could you please try building beta with this patch applied? It should apply cleanly. If it works, I’ll nominate to land this into beta.

Fixes(?) https://github.com/rust-lang/rust/issues/40251
2017-03-08 20:53:53 +02:00
Ariel Ben-Yehuda
2c252ff1fb Rollup merge of #40237 - arthurprs:hm-adapt2, r=alexcrichton
Reduce size overhead of adaptative hashmap

Exposes a boolean flag in RawTable and use it instead of a bool field in HashMap.

Taking a bit from capacity or length would make overflow handling tricky.

Fixes: #40042
2017-03-08 20:53:52 +02:00
Ariel Ben-Yehuda
68a5a16740 Rollup merge of #40226 - jdhorwitz:master, r=frewsxcv
Issue #39688 - Help people find String::as_bytes() for UTF-8

Added in links for the inverse functions so people will know that as_bytes() is the inverse of from_utf8() and vice versa.
?r @steveklabnik
2017-03-08 20:53:51 +02:00
Ariel Ben-Yehuda
7c18194498 Rollup merge of #40222 - steveklabnik:extract-nomicon, r=alexcrichton
Extract nomicon to its own repo

part of https://github.com/rust-lang/rust/issues/39588

same as https://github.com/rust-lang/rust/pull/40213 but for the nomicon

r? @alexcrichton
2017-03-08 20:53:50 +02:00
Ariel Ben-Yehuda
df9a721a55 Rollup merge of #40154 - steveklabnik:link-unstable-book, r=frewsxcv
add unstable book to the bookshelf

r? @frewsxcv @GuillaumeGomez
2017-03-08 20:53:48 +02:00
bors
ee60afa094 Auto merge of #39860 - japaric:san, r=alexcrichton
cleanup: remove the *san Cargo features from std

these belong to a previous iteration of the sanitizer implementation

r? @alexcrichton
cc @whitequark
2017-03-08 13:00:13 +00:00
bors
f91c3f6755 Auto merge of #39713 - estebank:issue-39698, r=jonathandturner
Clean up "pattern doesn't bind x" messages

Group "missing variable bind" spans in `or` matches and clarify wording
for the two possible cases: when a variable from the first pattern is
not in any of the subsequent patterns, and when a variable in any of the
other patterns is not in the first one.

Before:

```rust
error[E0408]: variable `a` from pattern #1 is not bound in pattern #2
  --> file.rs:10:23
   |
10 |         T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
   |                       ^^^^^^^^^^^ pattern doesn't bind `a`

error[E0408]: variable `b` from pattern #2 is not bound in pattern #1
  --> file.rs:10:32
   |
10 |         T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
   |                                ^ pattern doesn't bind `b`

error[E0408]: variable `a` from pattern #1 is not bound in pattern #3
  --> file.rs:10:37
   |
10 |         T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
   |                                     ^^^^^^^^ pattern doesn't bind `a`

error[E0408]: variable `d` from pattern #1 is not bound in pattern #3
  --> file.rs:10:37
   |
10 |         T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
   |                                     ^^^^^^^^ pattern doesn't bind `d`

error[E0408]: variable `c` from pattern #3 is not bound in pattern #1
  --> file.rs:10:43
   |
10 |         T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
   |                                           ^ pattern doesn't bind `c`

error[E0408]: variable `d` from pattern #1 is not bound in pattern #4
  --> file.rs:10:48
   |
10 |         T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
   |                                                ^^^^^^^^ pattern doesn't bind `d`

error: aborting due to 6 previous errors
```

After:

```rust
error[E0408]: variable `d` is not bound in all patterns
  --> $DIR/issue-39698.rs:20:37
   |
20 |         T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
   |                  -          -       ^^^^^^^^   ^^^^^^^^ pattern doesn't bind `d`
   |                  |          |       |
   |                  |          |       pattern doesn't bind `d`
   |                  |          variable not in all patterns
   |                  variable not in all patterns

error[E0408]: variable `c` is not bound in all patterns
  --> $DIR/issue-39698.rs:20:48
   |
20 |         T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
   |         ^^^^^^^^^^^   ^^^^^^^^^^^         -    ^^^^^^^^ pattern doesn't bind `c`
   |         |             |                   |
   |         |             |                   variable not in all patterns
   |         |             pattern doesn't bind `c`
   |         pattern doesn't bind `c`

error[E0408]: variable `a` is not bound in all patterns
  --> $DIR/issue-39698.rs:20:37
   |
20 |         T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
   |               -       ^^^^^^^^^^^   ^^^^^^^^         - variable not in all patterns
   |               |       |             |
   |               |       |             pattern doesn't bind `a`
   |               |       pattern doesn't bind `a`
   |               variable not in all patterns

error[E0408]: variable `b` is not bound in all patterns
  --> $DIR/issue-39698.rs:20:37
   |
20 |         T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
   |         ^^^^^^^^^^^            -    ^^^^^^^^   ^^^^^^^^ pattern doesn't bind `b`
   |         |                      |    |
   |         |                      |    pattern doesn't bind `b`
   |         |                      variable not in all patterns
   |         pattern doesn't bind `b`

error: aborting due to 4 previous errors
```

Fixes #39698.
2017-03-08 09:30:13 +00:00
Alex Crichton
e412af2a88 rustbuild: Assert directory creation succeeds
I've been seeing failures on the bots when building jemalloc and my assumption
is that it's because cwd isn't created. That may be possible if this
`create_dir_all` call change in this commit fails, in which case we ignore the
error.

This commit updates the location to call `create_dir_racy` which handles
concurrent invocations, as multiple build scripts may be trying to create the
`native` dir.
2017-03-07 15:24:36 -08:00