]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoRollup merge of #44900 - Havvy:normalize-lang-attribute-spacing, r=sfackler
Mark Simulacrum [Fri, 29 Sep 2017 23:59:04 +0000 (17:59 -0600)]
Rollup merge of #44900 - Havvy:normalize-lang-attribute-spacing, r=sfackler

Normalize spaces in lang attributes.

So, like, I grepped for all `lang` attributes for *reasons* and I noticed that they all share the same spacing of `#[lang = "item_name"]` except these five instances. So I decided to fix that. So enjoy this PR of exactly ten spaces.

6 years agoRollup merge of #44889 - spastorino:remove_new, r=arielb1
Mark Simulacrum [Fri, 29 Sep 2017 23:59:03 +0000 (17:59 -0600)]
Rollup merge of #44889 - spastorino:remove_new, r=arielb1

Remove DepNodeIndex::new is already impl for Idx

6 years agoRollup merge of #44854 - lucasem:atomic-docs, r=steveklabnik
Mark Simulacrum [Fri, 29 Sep 2017 23:59:02 +0000 (17:59 -0600)]
Rollup merge of #44854 - lucasem:atomic-docs, r=steveklabnik

docs improvement sync::atomic::Atomic*

Addresses the `Atomic*` part of #29377.
r? @steveklabnik

6 years agoRollup merge of #44845 - SimonSapin:nll_mod_rs, r=nikomatsakis
Mark Simulacrum [Fri, 29 Sep 2017 23:59:01 +0000 (17:59 -0600)]
Rollup merge of #44845 - SimonSapin:nll_mod_rs, r=nikomatsakis

Move src/librustc_mir/transform/nll.rs to a subdirectory

CC https://github.com/rust-lang/rust/issues/43234

6 years agoRollup merge of #44840 - steveklabnik:fix-wording, r=BurntSushi
Mark Simulacrum [Fri, 29 Sep 2017 23:59:00 +0000 (17:59 -0600)]
Rollup merge of #44840 - steveklabnik:fix-wording, r=BurntSushi

Improve wording for StepBy

No other iterator makes the distinction between an iterator and an iterator adapter
in its summary line, so change it to be consistent with all other adapters.

6 years agoRollup merge of #44836 - GuillaumeGomez:fmt-missing-links, r=QuietMisdreavus
Mark Simulacrum [Fri, 29 Sep 2017 23:58:59 +0000 (17:58 -0600)]
Rollup merge of #44836 - GuillaumeGomez:fmt-missing-links, r=QuietMisdreavus

Add missing links in fmt module

r? @rust-lang/docs

6 years agoRollup merge of #44824 - dtolnay:22really21, r=alexcrichton
Mark Simulacrum [Fri, 29 Sep 2017 23:58:58 +0000 (17:58 -0600)]
Rollup merge of #44824 - dtolnay:22really21, r=alexcrichton

Backport libs stabilizations to 1.21 beta

Includes the following stabilizations:

- tcpstream_connect_timeout https://github.com/rust-lang/rust/pull/44563
- iterator_for_each https://github.com/rust-lang/rust/pull/44567
- ord_max_min https://github.com/rust-lang/rust/pull/44593
- compiler_fences https://github.com/rust-lang/rust/pull/44595
- needs_drop https://github.com/rust-lang/rust/pull/44639
- vec_splice https://github.com/rust-lang/rust/pull/44640

These have been backported in https://github.com/rust-lang/rust/pull/44823.

6 years agoRollup merge of #44797 - lucasem:master, r=frewsxcv
Mark Simulacrum [Fri, 29 Sep 2017 23:58:57 +0000 (17:58 -0600)]
Rollup merge of #44797 - lucasem:master, r=frewsxcv

docs improvement std::sync::{PoisonError, TryLockError}

Addresses the `PoisonError` and `TryLockError` parts of #29377.
Adds examples and links.

r? @steveklabnik

6 years agoRollup merge of #44794 - napen123:master, r=frewsxcv
Mark Simulacrum [Fri, 29 Sep 2017 23:58:56 +0000 (17:58 -0600)]
Rollup merge of #44794 - napen123:master, r=frewsxcv

Add doc example to HashMap::hasher

None

6 years agoRollup merge of #44708 - toidiu:ak-44493, r=nikomatsakis
Mark Simulacrum [Fri, 29 Sep 2017 23:58:55 +0000 (17:58 -0600)]
Rollup merge of #44708 - toidiu:ak-44493, r=nikomatsakis

Infer `T: 'x` outlives requirements on structs #44493

https://github.com/rust-lang/rust/issues/44493

6 years agoRollup merge of #44694 - tommyip:make_clean, r=Mark-Simulacrum
Mark Simulacrum [Fri, 29 Sep 2017 23:58:54 +0000 (17:58 -0600)]
Rollup merge of #44694 - tommyip:make_clean, r=Mark-Simulacrum

Add --all flag to ./x.py clean

This make `clean` removes the LLVM and download cache directory as well.

Fixes #44214.

r? @Mark-Simulacrum

6 years agoRollup merge of #44320 - jakllsch:jakllsch-caf2c3d2-c939-4c4d-8c68-1aecbd570fab,...
Mark Simulacrum [Fri, 29 Sep 2017 23:58:53 +0000 (17:58 -0600)]
Rollup merge of #44320 - jakllsch:jakllsch-caf2c3d2-c939-4c4d-8c68-1aecbd570fab, r=Mark-Simulacrum

Fix extended bootstrap issues with OpenSSL on NetBSD build hosts

6 years agoRollup merge of #44287 - Eh2406:master, r=aturon
Mark Simulacrum [Fri, 29 Sep 2017 23:58:52 +0000 (17:58 -0600)]
Rollup merge of #44287 - Eh2406:master, r=aturon

Allow T op= &T for built-in numeric types T v2

Manually rebase of @Migi https://github.com/rust-lang/rust/pull/41336

6 years agoRollup merge of #44124 - gaurikholkar:return_self, r=arielb1
Mark Simulacrum [Fri, 29 Sep 2017 23:58:51 +0000 (17:58 -0600)]
Rollup merge of #44124 - gaurikholkar:return_self, r=arielb1

adding E0623 for return types - both parameters are anonymous

This is a fix for #44018
```
error[E0621]: explicit lifetime required in the type of `self`
  --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17:5
   |
16 |   fn foo<'a>(&self, x: &i32) -> &i32 {
   |                        ----     ----
   |                        |
   |                        this parameter and the return type are
                            declared with different lifetimes...
17 |     x
   |     ^ ...but data from `x` is returned here

error: aborting due to previous error
```
It also works for the below case where we have self as anonymous

```
error[E0623]: lifetime mismatch
  --> src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs:17:19
   |
16 |     fn foo<'a>(&self, x: &Foo) -> &Foo {
   |                          ----     ----
   |                          |
   |                          this parameter and the return type are
                            declared with different lifetimes...
17 |         if true { x } else { self }
   |                   ^ ...but data from `x` is returned here

error: aborting due to previous error
```
r? @nikomatsakis

Currently, I have enabled E0621 where return type and self are anonymous, hence WIP.

6 years agoAuto merge of #42526 - huntiep:try_opt, r=nikomatsakis
bors [Fri, 29 Sep 2017 20:09:35 +0000 (20:09 +0000)]
Auto merge of #42526 - huntiep:try_opt, r=nikomatsakis

Impl Try for Option

This is part of #31436.

6 years agoAuto merge of #44866 - mdevlamynck:impl-trait, r=eddyb
bors [Fri, 29 Sep 2017 15:54:44 +0000 (15:54 +0000)]
Auto merge of #44866 - mdevlamynck:impl-trait, r=eddyb

First step toward implementing impl Trait in argument position

First step implementing #44721.

Add a flag to hir and ty TypeParameterDef and raise an error when using
explicit type parameters when calling a function using impl Trait in
argument position.

I don't know if there is a procedure to add an error code so I just took an available code. Is that ok ?

r? @nikomatsakis

6 years agoAuto merge of #44856 - cuviper:more-fold, r=dtolnay
bors [Fri, 29 Sep 2017 12:56:24 +0000 (12:56 +0000)]
Auto merge of #44856 - cuviper:more-fold, r=dtolnay

Add more custom folding to `core::iter` adaptors

Many of the iterator adaptors will perform faster folds if they forward
to their inner iterator's folds, especially for inner types like `Chain`
which are optimized too.  The following types are newly specialized:

| Type        | `fold` | `rfold` |
| ----------- | ------ | ------- |
| `Enumerate` | ✓      | ✓       |
| `Filter`    | ✓      | ✓       |
| `FilterMap` | ✓      | ✓       |
| `FlatMap`   | exists | ✓       |
| `Fuse`      | ✓      | ✓       |
| `Inspect`   | ✓      | ✓       |
| `Peekable`  | ✓      | N/A¹    |
| `Skip`      | ✓      | N/A²    |
| `SkipWhile` | ✓      | N/A¹    |

¹ not a `DoubleEndedIterator`

² `Skip::next_back` doesn't pull skipped items at all, but this couldn't
be avoided if `Skip::rfold` were to call its inner iterator's `rfold`.

Benchmarks
----------

In the following results, plain `_sum` computes the sum of a million
integers -- note that `sum()` is implemented with `fold()`.  The
`_ref_sum` variants do the same on a `by_ref()` iterator, which is
limited to calling `next()` one by one, without specialized `fold`.

The `chain` variants perform the same tests on two iterators chained
together, to show a greater benefit of forwarding `fold` internally.

    test iter::bench_enumerate_chain_ref_sum  ... bench:   2,216,264 ns/iter (+/- 29,228)
    test iter::bench_enumerate_chain_sum      ... bench:     922,380 ns/iter (+/- 2,676)
    test iter::bench_enumerate_ref_sum        ... bench:     476,094 ns/iter (+/- 7,110)
    test iter::bench_enumerate_sum            ... bench:     476,438 ns/iter (+/- 3,334)

    test iter::bench_filter_chain_ref_sum     ... bench:   2,266,095 ns/iter (+/- 6,051)
    test iter::bench_filter_chain_sum         ... bench:     745,594 ns/iter (+/- 2,013)
    test iter::bench_filter_ref_sum           ... bench:     889,696 ns/iter (+/- 1,188)
    test iter::bench_filter_sum               ... bench:     667,325 ns/iter (+/- 1,894)

    test iter::bench_filter_map_chain_ref_sum ... bench:   2,259,195 ns/iter (+/- 353,440)
    test iter::bench_filter_map_chain_sum     ... bench:   1,223,280 ns/iter (+/- 1,972)
    test iter::bench_filter_map_ref_sum       ... bench:     611,607 ns/iter (+/- 2,507)
    test iter::bench_filter_map_sum           ... bench:     611,610 ns/iter (+/- 472)

    test iter::bench_fuse_chain_ref_sum       ... bench:   2,246,106 ns/iter (+/- 22,395)
    test iter::bench_fuse_chain_sum           ... bench:     634,887 ns/iter (+/- 1,341)
    test iter::bench_fuse_ref_sum             ... bench:     444,816 ns/iter (+/- 1,748)
    test iter::bench_fuse_sum                 ... bench:     316,954 ns/iter (+/- 2,616)

    test iter::bench_inspect_chain_ref_sum    ... bench:   2,245,431 ns/iter (+/- 21,371)
    test iter::bench_inspect_chain_sum        ... bench:     631,645 ns/iter (+/- 4,928)
    test iter::bench_inspect_ref_sum          ... bench:     317,437 ns/iter (+/- 702)
    test iter::bench_inspect_sum              ... bench:     315,942 ns/iter (+/- 4,320)

    test iter::bench_peekable_chain_ref_sum   ... bench:   2,243,585 ns/iter (+/- 12,186)
    test iter::bench_peekable_chain_sum       ... bench:     634,848 ns/iter (+/- 1,712)
    test iter::bench_peekable_ref_sum         ... bench:     444,808 ns/iter (+/- 480)
    test iter::bench_peekable_sum             ... bench:     317,133 ns/iter (+/- 3,309)

    test iter::bench_skip_chain_ref_sum       ... bench:   1,778,734 ns/iter (+/- 2,198)
    test iter::bench_skip_chain_sum           ... bench:     761,850 ns/iter (+/- 1,645)
    test iter::bench_skip_ref_sum             ... bench:     478,207 ns/iter (+/- 119,252)
    test iter::bench_skip_sum                 ... bench:     315,614 ns/iter (+/- 3,054)

    test iter::bench_skip_while_chain_ref_sum ... bench:   2,486,370 ns/iter (+/- 4,845)
    test iter::bench_skip_while_chain_sum     ... bench:     633,915 ns/iter (+/- 5,892)
    test iter::bench_skip_while_ref_sum       ... bench:     666,926 ns/iter (+/- 804)
    test iter::bench_skip_while_sum           ... bench:     444,405 ns/iter (+/- 571)

6 years agoAuto merge of #44853 - alexcrichton:debug-codegen-units, r=michaelwoerister
bors [Fri, 29 Sep 2017 10:10:15 +0000 (10:10 +0000)]
Auto merge of #44853 - alexcrichton:debug-codegen-units, r=michaelwoerister

rustc: Default 32 codegen units at O0

This commit changes the default of rustc to use 32 codegen units when compiling
in debug mode, typically an opt-level=0 compilation. Since their inception
codegen units have matured quite a bit, gaining features such as:

* Parallel translation and codegen enabling codegen units to get worked on even
  more quickly.
* Deterministic and reliable partitioning through the same infrastructure as
  incremental compilation.
* Global rate limiting through the `jobserver` crate to avoid overloading the
  system.

The largest benefit of codegen units has forever been faster compilation through
parallel processing of modules on the LLVM side of things, using all the cores
available on build machines that typically have many available. Some downsides
have been fixed through the features above, but the major downside remaining is
that using codegen units reduces opportunities for inlining and optimization.
This, however, doesn't matter much during debug builds!

In this commit the default number of codegen units for debug builds has been
raised from 1 to 32. This should enable most `cargo build` compiles that are
bottlenecked on translation and/or code generation to immediately see speedups
through parallelization on available cores.

Work is being done to *always* enable multiple codegen units (and therefore
parallel codegen) but it requires #44841 at least to be landed and stabilized,
but stay tuned if you're interested in that aspect!

6 years agoAuto merge of #44847 - estebank:unused-signature, r=nikomatsakis
bors [Fri, 29 Sep 2017 07:05:10 +0000 (07:05 +0000)]
Auto merge of #44847 - estebank:unused-signature, r=nikomatsakis

Point at signature on unused lint

```
warning: struct is never used: `Struct`
  --> $DIR/unused-warning-point-at-signature.rs:22:1
   |
22 | struct Struct {
   | ^^^^^^^^^^^^^
```

Fix #33961.

6 years agoAuto merge of #44811 - zilbuz:issue-44596/E0506, r=arielb1
bors [Fri, 29 Sep 2017 03:54:12 +0000 (03:54 +0000)]
Auto merge of #44811 - zilbuz:issue-44596/E0506, r=arielb1

MIR-borrowck: Adding notes to E0506

This PR adds notes to the MIR borrowck error E0506.

Part of #44596

6 years agoAuto merge of #44528 - tmnilsson:attr_proc_macro_cfg_process, r=jseyfried
bors [Thu, 28 Sep 2017 23:38:52 +0000 (23:38 +0000)]
Auto merge of #44528 - tmnilsson:attr_proc_macro_cfg_process, r=jseyfried

Apply attr proc macros before cfg processing

Fixes #39336.
r? @jseyfried

6 years agoAuto merge of #44278 - Binero:master, r=BurntSushi
bors [Thu, 28 Sep 2017 18:52:49 +0000 (18:52 +0000)]
Auto merge of #44278 - Binero:master, r=BurntSushi

Allow replacing HashMap entries

This is an obvious API hole. At the moment the only way to retrieve an entry from a `HashMap` is to get an entry to it, remove it, and then insert a new entry. This PR allows entries to be replaced.

6 years agoAuto merge of #44785 - alexcrichton:update-cargo, r=nikomatsakis
bors [Thu, 28 Sep 2017 16:19:58 +0000 (16:19 +0000)]
Auto merge of #44785 - alexcrichton:update-cargo, r=nikomatsakis

Update some minor dependencies

* run `cargo update`
* Update cargo submodule
* Update to the `cc` crate from `gcc`

6 years agoUpdate to the `cc` crate
Alex Crichton [Sat, 23 Sep 2017 04:34:27 +0000 (21:34 -0700)]
Update to the `cc` crate

This is the name the `gcc` crate has moved to

6 years agoAuto merge of #44806 - KiChjang:mir-err-notes-2, r=pnkfelix
bors [Thu, 28 Sep 2017 12:40:12 +0000 (12:40 +0000)]
Auto merge of #44806 - KiChjang:mir-err-notes-2, r=pnkfelix

Add span label to E0384 for MIR borrowck

Corresponds to `report_illegal_reassignment`.

Part of #44596.

6 years agoAuto merge of #44790 - clarcharr:zip_bytes, r=sfackler
bors [Thu, 28 Sep 2017 09:10:12 +0000 (09:10 +0000)]
Auto merge of #44790 - clarcharr:zip_bytes, r=sfackler

TrustedRandomAccess specialisation for Iterator::cloned when Item: Copy.

This should fix #44424. It also provides a potential fix for more iterators using `Iterator::cloned`.

6 years agoNormalize spaces in lang attributes.
Havvy [Thu, 28 Sep 2017 08:30:25 +0000 (01:30 -0700)]
Normalize spaces in lang attributes.

6 years agoAuto merge of #44779 - tjkirch:master, r=alexcrichton
bors [Thu, 28 Sep 2017 03:28:20 +0000 (03:28 +0000)]
Auto merge of #44779 - tjkirch:master, r=alexcrichton

Add aarch64-unknown-linux-musl target

This adds support for the aarch64-unknown-linux-musl target in the build and CI systems.

This addresses half of issue #42520.

The new file `aarch64_unknown_linux_musl.rs` is a copy of `aarch64_unknown_linux_gnu.rs` with "gnu" replaced by "musl", and the added logic in `build-arm-musl.sh` is similarly a near-copy of the arches around it, so overall the changes were straightforward.

Testing:

```
$ sudo ./src/ci/docker/run.sh cross
...
Dist std stage2 (x86_64-unknown-linux-gnu -> aarch64-unknown-linux-musl)
Building stage2 test artifacts (x86_64-unknown-linux-gnu -> aarch64-unknown-linux-musl)
   Compiling getopts v0.2.14
   Compiling term v0.0.0 (file:///checkout/src/libterm)
   Compiling test v0.0.0 (file:///checkout/src/libtest)
    Finished release [optimized] target(s) in 16.91 secs
Copying stage2 test from stage2 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / aarch64-unknown-linux-musl)
...
Build completed successfully in 0:55:22
```

```
$ rustup toolchain link local obj/build/x86_64-unknown-linux-gnu/stage2
$ rustup default local
```

After setting the local toolchain as default, and adding this in ~/.cargo/config:

```
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
```

...then the toolchain was able to build a working ripgrep as a test:

```
$ readelf -a target/aarch64-unknown-linux-musl/debug/rg | grep -i interpreter
$ readelf -a target/aarch64-unknown-linux-musl/debug/rg | grep NEEDED
$ file target/aarch64-unknown-linux-musl/debug/rg
target/aarch64-unknown-linux-musl/debug/rg: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=be11036b0988fac5dccc9f6487eb780b05186582, not stripped
```

6 years agoUpdate some minor dependencies
Alex Crichton [Wed, 27 Sep 2017 22:37:02 +0000 (15:37 -0700)]
Update some minor dependencies

6 years agoUpdate the Cargo submodule
Alex Crichton [Wed, 27 Sep 2017 22:36:38 +0000 (15:36 -0700)]
Update the Cargo submodule

6 years agoUpdate the RLS again
Nick Cameron [Mon, 25 Sep 2017 04:13:29 +0000 (17:13 +1300)]
Update the RLS again

6 years agoAdd RLS and Rustfmt to the toolstate mechanism
Nick Cameron [Fri, 22 Sep 2017 02:41:22 +0000 (14:41 +1200)]
Add RLS and Rustfmt to the toolstate mechanism

6 years agoRename rls component to rls-preview on nightly
Nick Cameron [Fri, 22 Sep 2017 01:59:04 +0000 (13:59 +1200)]
Rename rls component to rls-preview on nightly

6 years agoUpdate RLS and Rustfmt
Nick Cameron [Fri, 22 Sep 2017 01:58:35 +0000 (13:58 +1200)]
Update RLS and Rustfmt

6 years agoAuto merge of #44782 - estebank:issue-36700, r=GuillaumeGomez
bors [Wed, 27 Sep 2017 22:00:11 +0000 (22:00 +0000)]
Auto merge of #44782 - estebank:issue-36700, r=GuillaumeGomez

Point at parameter type on E0301

On "the parameter type `T` may not live long enough" error, point to the
parameter type suggesting lifetime bindings:

```
error[E0310]: the parameter type `T` may not live long enough
  --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
   |
27 | struct Foo<T> {
   |            - help: consider adding an explicit lifetime bound `T: 'static`...
28 |     foo: &'static T
   |     ^^^^^^^^^^^^^^^
   |
note: ...so that the reference type `&'static T` does not outlive the data it points at
  --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
   |
28 |     foo: &'static T
   |     ^^^^^^^^^^^^^^^
```

Fix #36700.

6 years agoAdd UI tests
Hunter Praska [Fri, 22 Sep 2017 15:24:06 +0000 (10:24 -0500)]
Add UI tests

6 years agoRename option::Missing to NoneError
Hunter Praska [Sun, 18 Jun 2017 18:07:09 +0000 (13:07 -0500)]
Rename option::Missing to NoneError

6 years agoAdd docs for Missing, correct Option's Try test
Hunter Praska [Thu, 8 Jun 2017 19:02:04 +0000 (14:02 -0500)]
Add docs for Missing, correct Option's Try test

6 years agoAdd tests for Option and Result Try impl
Hunter Praska [Thu, 8 Jun 2017 03:52:13 +0000 (22:52 -0500)]
Add tests for Option and Result Try impl

6 years agoImpl Try for Option
Hunter Praska [Thu, 8 Jun 2017 03:51:45 +0000 (22:51 -0500)]
Impl Try for Option

6 years agoApply attr proc macros before cfg processing
Tomas Nilsson [Tue, 12 Sep 2017 19:55:41 +0000 (21:55 +0200)]
Apply attr proc macros before cfg processing

Now items are not fully configured until right before expanding derives.

6 years agoRemove DepNodeIndex::new is already impl for Idx
Santiago Pastorino [Wed, 27 Sep 2017 18:11:22 +0000 (15:11 -0300)]
Remove DepNodeIndex::new is already impl for Idx

6 years agobootstrap: use tar -z on extract
Jonathan A. Kollasch [Thu, 31 Aug 2017 14:22:39 +0000 (09:22 -0500)]
bootstrap: use tar -z on extract

Some tar(1) programs—such as NetBSD's—do not automatically decompress.

6 years agobootstrap: use shasum(1) on NetBSD build hosts
Jonathan A. Kollasch [Thu, 31 Aug 2017 14:17:50 +0000 (09:17 -0500)]
bootstrap: use shasum(1) on NetBSD build hosts

NetBSD doesn't ship with sha256sum.  The openssl build will probably
try to use perl anyway, so using perl's shasum is reasonable.

6 years agoAuto merge of #44709 - Badel2:inclusive-range-dotdoteq, r=petrochenkov
bors [Wed, 27 Sep 2017 16:04:31 +0000 (16:04 +0000)]
Auto merge of #44709 - Badel2:inclusive-range-dotdoteq, r=petrochenkov

Initial support for `..=` syntax

#28237

This PR adds `..=` as a synonym for `...` in patterns and expressions.
Since `...` in expressions was never stable, we now issue a warning.

cc @durka
r? @aturon

6 years agoAuto merge of #44713 - zackmdavis:fn_main_in_a_comment_in_rustdoc_breaks_tests, r...
bors [Wed, 27 Sep 2017 10:56:23 +0000 (10:56 +0000)]
Auto merge of #44713 - zackmdavis:fn_main_in_a_comment_in_rustdoc_breaks_tests, r=QuietMisdreavus

don't let rustdoc get confused by text "fn main" in a line comment

~~~Resolves~~~ (edited) partially addresses #21299.

![rustdoc_fn_main](https://user-images.githubusercontent.com/1076988/30630993-9aeecc4a-9d97-11e7-8e56-2b973f23f683.png)

r? @QuietMisdreavus

6 years agoAuto merge of #44825 - dtolnay:cratelint, r=aturon
bors [Wed, 27 Sep 2017 08:20:11 +0000 (08:20 +0000)]
Auto merge of #44825 - dtolnay:cratelint, r=aturon

Allow unused extern crate again

This is a partial revert of #42588. There is a usability concern reported in #44294 that was not considered in the discussion of the PR, so I would like to back this out of 1.21. As is, I think users would have a worse and more confusing experience with this lint enabled by default. We can re-enabled once there are better diagnostics or the case in #44294 does not trigger the lint.

6 years agoAdd span label to E0384 for MIR borrowck
Keith Yeung [Sun, 24 Sep 2017 10:56:57 +0000 (03:56 -0700)]
Add span label to E0384 for MIR borrowck

6 years agoAuto merge of #44812 - Mark-Simulacrum:rustdoc-debug, r=alexcrichton
bors [Wed, 27 Sep 2017 04:57:34 +0000 (04:57 +0000)]
Auto merge of #44812 - Mark-Simulacrum:rustdoc-debug, r=alexcrichton

Allow rustdoc to get compiled with debuginfo

Fixes #44810

cc @QuietMisdreavus
r? @alexcrichton

6 years agoAuto merge of #44802 - sfackler:vecdeque-oob, r=Gankro
bors [Wed, 27 Sep 2017 01:23:24 +0000 (01:23 +0000)]
Auto merge of #44802 - sfackler:vecdeque-oob, r=Gankro

Fix capacity comparison in reserve

You can otherwise end up in a situation where you don't actually resize
but still call into handle_cap_increase which then corrupts head/tail.

Closes #44800

Not totally sure the right way to write a test for this - there are some debug asserts the old bad behavior will hit but we don't build the stdlib with debug assertions by default.

r? @Gankro

6 years agoAllow rustdoc to get compiled with debuginfo
Mark Simulacrum [Sun, 24 Sep 2017 14:50:27 +0000 (08:50 -0600)]
Allow rustdoc to get compiled with debuginfo

6 years agodon't let rustdoc get confused by text "fn main" in a line comment
Zack M. Davis [Wed, 20 Sep 2017 05:58:33 +0000 (22:58 -0700)]
don't let rustdoc get confused by text "fn main" in a line comment

This is in the matter of #21299.

6 years agoAuto merge of #44757 - jseyfried:fix_bad_derive_collection, r=nrc
bors [Tue, 26 Sep 2017 22:26:13 +0000 (22:26 +0000)]
Auto merge of #44757 - jseyfried:fix_bad_derive_collection, r=nrc

macros: fix bug in collecting trait and impl items with derives.

Fixes #43023.
r? @nrc

6 years agomir-borrowck: Edit compile-fail tests with E0506 error to also test on MIR borrowck
Basile Desloges [Tue, 26 Sep 2017 19:56:37 +0000 (21:56 +0200)]
mir-borrowck: Edit compile-fail tests with E0506 error to also test on MIR borrowck

6 years agobump rustfmt
Badel2 [Tue, 26 Sep 2017 18:35:27 +0000 (20:35 +0200)]
bump rustfmt

6 years agoUse a different error code to avoid conflicts
Matthias Devlamynck [Tue, 26 Sep 2017 18:51:22 +0000 (20:51 +0200)]
Use a different error code to avoid conflicts

6 years agoAuto merge of #44741 - qmx:trans_fulfill_obligation_should_not_crash, r=nikomatsakis
bors [Tue, 26 Sep 2017 18:29:57 +0000 (18:29 +0000)]
Auto merge of #44741 - qmx:trans_fulfill_obligation_should_not_crash, r=nikomatsakis

use param_env on the trait_cache key

We bailed from making trans_fulfill_obligation return `Option` or `Result`, just made it less prone to crashing outside trans

r? @nikomatsakis

6 years agomir-borrowck: Add span labels to `report_illegal_mutation_of_borrowed()`
Basile Desloges [Sun, 24 Sep 2017 13:37:41 +0000 (15:37 +0200)]
mir-borrowck: Add span labels to `report_illegal_mutation_of_borrowed()`

6 years agomir-borrowck: Add borrow data parameter to `report_illegal_mutation_of_borrowed()`
Basile Desloges [Sun, 24 Sep 2017 13:25:49 +0000 (15:25 +0200)]
mir-borrowck: Add borrow data parameter to `report_illegal_mutation_of_borrowed()`

6 years agofix test reference
Niko Matsakis [Tue, 26 Sep 2017 15:56:44 +0000 (11:56 -0400)]
fix test reference

6 years agominor fixes
gaurikholkar [Sun, 24 Sep 2017 14:16:29 +0000 (19:46 +0530)]
minor fixes

6 years agoremove error code description
gaurikholkar [Sat, 23 Sep 2017 21:54:49 +0000 (03:24 +0530)]
remove error code description

6 years agoremove random newlines from error messages, fix compile-fail test
Niko Matsakis [Tue, 12 Sep 2017 21:21:53 +0000 (17:21 -0400)]
remove random newlines from error messages, fix compile-fail test

That kind of formatting seems like the job of other code.

6 years agouse present tense consistently and update references
Niko Matsakis [Tue, 12 Sep 2017 14:53:00 +0000 (10:53 -0400)]
use present tense consistently and update references

6 years agotidy fix
gaurikholkar [Mon, 11 Sep 2017 18:46:54 +0000 (00:16 +0530)]
tidy fix

6 years agomodify message for return time having multiple lifetimes
gaurikholkar [Mon, 11 Sep 2017 14:57:26 +0000 (20:27 +0530)]
modify message for return time having multiple lifetimes

6 years agomerge fixes, addressing CR comments
gaurikholkar [Mon, 11 Sep 2017 14:29:57 +0000 (19:59 +0530)]
merge fixes, addressing CR comments

6 years agoimpl Trait in argument position desugaring:
Matthias Devlamynck [Tue, 26 Sep 2017 09:43:33 +0000 (11:43 +0200)]
impl Trait in argument position desugaring:

Add a flag to hir and ty TypeParameterDef and raise an error when using
explicit type parameters when calling a function using impl Trait in
argument position.

6 years agorustc: Default 32 codegen units at O0
Alex Crichton [Mon, 25 Sep 2017 19:26:25 +0000 (12:26 -0700)]
rustc: Default 32 codegen units at O0

This commit changes the default of rustc to use 32 codegen units when compiling
in debug mode, typically an opt-level=0 compilation. Since their inception
codegen units have matured quite a bit, gaining features such as:

* Parallel translation and codegen enabling codegen units to get worked on even
  more quickly.
* Deterministic and reliable partitioning through the same infrastructure as
  incremental compilation.
* Global rate limiting through the `jobserver` crate to avoid overloading the
  system.

The largest benefit of codegen units has forever been faster compilation through
parallel processing of modules on the LLVM side of things, using all the cores
available on build machines that typically have many available. Some downsides
have been fixed through the features above, but the major downside remaining is
that using codegen units reduces opportunities for inlining and optimization.
This, however, doesn't matter much during debug builds!

In this commit the default number of codegen units for debug builds has been
raised from 1 to 32. This should enable most `cargo build` compiles that are
bottlenecked on translation and/or code generation to immediately see speedups
through parallelization on available cores.

Work is being done to *always* enable multiple codegen units (and therefore
parallel codegen) but it requires #44841 at least to be landed and stabilized,
but stay tuned if you're interested in that aspect!

6 years agoAuto merge of #44736 - pnkfelix:mir-borrowck4, r=arielb1
bors [Tue, 26 Sep 2017 09:19:03 +0000 (09:19 +0000)]
Auto merge of #44736 - pnkfelix:mir-borrowck4, r=arielb1

Some fixes to mir-borrowck

Make the code more closely match the NLL RFC (updated description).

(The biggest visible fix the addition of the Shallow/Deep distinction, which means mir-borrowck stops falsely thinking that StorageDeads need deep access to their input L-value.)

6 years agoAuto merge of #44735 - tirr-c:issue-42143, r=arielb1
bors [Tue, 26 Sep 2017 05:02:03 +0000 (05:02 +0000)]
Auto merge of #44735 - tirr-c:issue-42143, r=arielb1

Friendlier error message for closure argument type mismatch

Rebased #42270.
Fixes #42143.

---

`test.rs`:

```rust
fn main() {
    foo(|_: i32, _: usize| ());
}

fn foo<F>(_: F) where F: Fn(&str, usize) {}
```

Before:

```
error[E0281]: type mismatch: `[closure@test.rs:2:9: 2:30]` implements the trait `std::ops::Fn<(i32, usize)>`, but the trait `for<'r> std::ops::Fn<(&'r str, usize)>` is required
 --> test.rs:2:5
  |
2 |     foo(|_: i32, _: usize| ());
  |     ^^^ --------------------- implements `std::ops::Fn<(i32, usize)>`
  |     |
  |     expected &str, found i32
  |     requires `for<'r> std::ops::Fn<(&'r str, usize)>`
  |
  = note: required by `foo`
```

After (early):

```
error[E0631]: type mismatch in closure arguments
 --> test.rs:2:5
  |
2 |     foo(|_: i32, _: usize| ());
  |     ^^^ --------------------- takes arguments of type `i32` and `usize`
  |     |
  |     expected arguments of type `&str` and `usize`
  |
  = note: required by `foo`
```

After (current):

```
error[E0631]: type mismatch in closure arguments
 --> test.rs:2:5
  |
2 |     foo(|_: i32, _: usize| ());
  |     ^^^ --------------------- found signature of `fn(i32, usize) -> _`
  |     |
  |     expected signature of `for<'r> fn(&'r str, usize) -> _`
  |
  = note: required by `foo`
```

~~Compiler output has been changed, and a few tests are failing. Help me writing/fixing tests!~~

r? @nikomatsakis

6 years agoAdd more custom folding to `core::iter` adaptors
Josh Stone [Tue, 26 Sep 2017 03:53:08 +0000 (20:53 -0700)]
Add more custom folding to `core::iter` adaptors

Many of the iterator adaptors will perform faster folds if they forward
to their inner iterator's folds, especially for inner types like `Chain`
which are optimized too.  The following types are newly specialized:

| Type        | `fold` | `rfold` |
| ----------- | ------ | ------- |
| `Enumerate` | ✓      | ✓       |
| `Filter`    | ✓      | ✓       |
| `FilterMap` | ✓      | ✓       |
| `FlatMap`   | exists | ✓       |
| `Fuse`      | ✓      | ✓       |
| `Inspect`   | ✓      | ✓       |
| `Peekable`  | ✓      | N/A¹    |
| `Skip`      | ✓      | N/A²    |
| `SkipWhile` | ✓      | N/A¹    |

¹ not a `DoubleEndedIterator`

² `Skip::next_back` doesn't pull skipped items at all, but this couldn't
be avoided if `Skip::rfold` were to call its inner iterator's `rfold`.

Benchmarks
----------

In the following results, plain `_sum` computes the sum of a million
integers -- note that `sum()` is implemented with `fold()`.  The
`_ref_sum` variants do the same on a `by_ref()` iterator, which is
limited to calling `next()` one by one, without specialized `fold`.

The `chain` variants perform the same tests on two iterators chained
together, to show a greater benefit of forwarding `fold` internally.

    test iter::bench_enumerate_chain_ref_sum  ... bench:   2,216,264 ns/iter (+/- 29,228)
    test iter::bench_enumerate_chain_sum      ... bench:     922,380 ns/iter (+/- 2,676)
    test iter::bench_enumerate_ref_sum        ... bench:     476,094 ns/iter (+/- 7,110)
    test iter::bench_enumerate_sum            ... bench:     476,438 ns/iter (+/- 3,334)

    test iter::bench_filter_chain_ref_sum     ... bench:   2,266,095 ns/iter (+/- 6,051)
    test iter::bench_filter_chain_sum         ... bench:     745,594 ns/iter (+/- 2,013)
    test iter::bench_filter_ref_sum           ... bench:     889,696 ns/iter (+/- 1,188)
    test iter::bench_filter_sum               ... bench:     667,325 ns/iter (+/- 1,894)

    test iter::bench_filter_map_chain_ref_sum ... bench:   2,259,195 ns/iter (+/- 353,440)
    test iter::bench_filter_map_chain_sum     ... bench:   1,223,280 ns/iter (+/- 1,972)
    test iter::bench_filter_map_ref_sum       ... bench:     611,607 ns/iter (+/- 2,507)
    test iter::bench_filter_map_sum           ... bench:     611,610 ns/iter (+/- 472)

    test iter::bench_fuse_chain_ref_sum       ... bench:   2,246,106 ns/iter (+/- 22,395)
    test iter::bench_fuse_chain_sum           ... bench:     634,887 ns/iter (+/- 1,341)
    test iter::bench_fuse_ref_sum             ... bench:     444,816 ns/iter (+/- 1,748)
    test iter::bench_fuse_sum                 ... bench:     316,954 ns/iter (+/- 2,616)

    test iter::bench_inspect_chain_ref_sum    ... bench:   2,245,431 ns/iter (+/- 21,371)
    test iter::bench_inspect_chain_sum        ... bench:     631,645 ns/iter (+/- 4,928)
    test iter::bench_inspect_ref_sum          ... bench:     317,437 ns/iter (+/- 702)
    test iter::bench_inspect_sum              ... bench:     315,942 ns/iter (+/- 4,320)

    test iter::bench_peekable_chain_ref_sum   ... bench:   2,243,585 ns/iter (+/- 12,186)
    test iter::bench_peekable_chain_sum       ... bench:     634,848 ns/iter (+/- 1,712)
    test iter::bench_peekable_ref_sum         ... bench:     444,808 ns/iter (+/- 480)
    test iter::bench_peekable_sum             ... bench:     317,133 ns/iter (+/- 3,309)

    test iter::bench_skip_chain_ref_sum       ... bench:   1,778,734 ns/iter (+/- 2,198)
    test iter::bench_skip_chain_sum           ... bench:     761,850 ns/iter (+/- 1,645)
    test iter::bench_skip_ref_sum             ... bench:     478,207 ns/iter (+/- 119,252)
    test iter::bench_skip_sum                 ... bench:     315,614 ns/iter (+/- 3,054)

    test iter::bench_skip_while_chain_ref_sum ... bench:   2,486,370 ns/iter (+/- 4,845)
    test iter::bench_skip_while_chain_sum     ... bench:     633,915 ns/iter (+/- 5,892)
    test iter::bench_skip_while_ref_sum       ... bench:     666,926 ns/iter (+/- 804)
    test iter::bench_skip_while_sum           ... bench:     444,405 ns/iter (+/- 571)

6 years agoFix bug in collecting trait and impl items with derives.
Jeffrey Seyfried [Thu, 21 Sep 2017 07:20:56 +0000 (00:20 -0700)]
Fix bug in collecting trait and impl items with derives.

6 years agodocs improvement sync::atomic::Atomic*
Lucas Morales [Mon, 25 Sep 2017 23:39:52 +0000 (19:39 -0400)]
docs improvement sync::atomic::Atomic*

6 years agoAuto merge of #44297 - laumann:suggest-misspelt-methods, r=arielb1
bors [Mon, 25 Sep 2017 23:09:06 +0000 (23:09 +0000)]
Auto merge of #44297 - laumann:suggest-misspelt-methods, r=arielb1

Add suggestions for misspelled method names

Use the syntax::util::lev_distance module to provide suggestions when a
named method cannot be found.

Part of #30197

6 years agoAuto merge of #44279 - smaeul:crt_static-deps, r=alexcrichton
bors [Mon, 25 Sep 2017 20:37:02 +0000 (20:37 +0000)]
Auto merge of #44279 - smaeul:crt_static-deps, r=alexcrichton

Require rlibs for dependent crates when linking static executables

This handles the case for `CrateTypeExecutable` and `+crt_static`. I reworked the match block to avoid duplicating the `attempt_static` and error checking code again (this case would have been a copy of the `CrateTypeCdylib`/`CrateTypeStaticlib` case).

On `linux-musl` targets where `std` was built with `crt_static = false` in `config.toml`, this change brings the test suite from entirely failing to mostly passing.

This change should not affect behavior for other crate types, or for targets which do not respect `+crt_static`.

6 years agoPoint at signature on unused lint
Esteban Küber [Mon, 25 Sep 2017 19:01:55 +0000 (12:01 -0700)]
Point at signature on unused lint

6 years agoMove src/librustc_mir/transform/nll.rs to a subdirectory
Simon Sapin [Mon, 25 Sep 2017 18:06:03 +0000 (20:06 +0200)]
Move src/librustc_mir/transform/nll.rs to a subdirectory

6 years agoAuto merge of #44085 - bjorn3:no_llvm_write_metadata, r=arielb1
bors [Mon, 25 Sep 2017 18:05:22 +0000 (18:05 +0000)]
Auto merge of #44085 - bjorn3:no_llvm_write_metadata, r=arielb1

Allow writing metadata without llvm

# Todo:

* [x] Rebase
* [x] Fix eventual errors
* [x] <strike>Find some crate to write elf files</strike> (will do it later)

Cc #43842

6 years agoImprove wording for StepBy
steveklabnik [Mon, 25 Sep 2017 15:41:39 +0000 (11:41 -0400)]
Improve wording for StepBy

No other iterator makes the distinction between an iterator and an iterator adapter
in its summary line, so change it to be consistent with all other adapters.

6 years agothose changes break miri, PR will be issued later
Douglas Campos [Mon, 25 Sep 2017 13:49:32 +0000 (09:49 -0400)]
those changes break miri, PR will be issued later

6 years agofix tidy errors
Douglas Campos [Thu, 21 Sep 2017 15:53:37 +0000 (11:53 -0400)]
fix tidy errors

6 years agoadd comment per @nikomatsakis request
Douglas Campos [Thu, 21 Sep 2017 15:19:52 +0000 (11:19 -0400)]
add comment per @nikomatsakis request

6 years agoexpose ParamEnv as a param
Douglas Campos [Thu, 21 Sep 2017 02:51:35 +0000 (22:51 -0400)]
expose ParamEnv as a param

6 years agoadd ParamEnv to the trait_cache key
Douglas Campos [Wed, 20 Sep 2017 02:39:00 +0000 (22:39 -0400)]
add ParamEnv to the trait_cache key

6 years agoAdd missing links in fmt module
Guillaume Gomez [Mon, 25 Sep 2017 13:41:16 +0000 (15:41 +0200)]
Add missing links in fmt module

6 years agoAuto merge of #44809 - arielb1:small-scope, r=eddyb
bors [Mon, 25 Sep 2017 12:52:02 +0000 (12:52 +0000)]
Auto merge of #44809 - arielb1:small-scope, r=eddyb

encode region::Scope using fewer bytes

Now that region::Scope is no longer interned, its size is more important. This PR encodes region::Scope in 8 bytes instead of 12, which should speed up region inference somewhat (perf testing needed) and should improve the margins on #36799 by 64MB (that's not a lot, I did this PR mostly to speed up region inference).

This is a perf-sensitive PR. Please don't roll me up.

r? @eddyb

This is based on  #44743 so I could get more accurate measurements on #36799.

6 years agoRemove now dead code.
Felix S. Klock II [Fri, 22 Sep 2017 13:37:43 +0000 (15:37 +0200)]
Remove now dead code.

6 years agoMake mir-borrowck more closely match (draft) NLL RFC.
Felix S. Klock II [Mon, 21 Aug 2017 10:48:33 +0000 (12:48 +0200)]
Make mir-borrowck more closely match (draft) NLL RFC.

In particular:

 * introduce the shallow/deep distinction for read/write accesses

 * use the notions of prefixes, shallow prefixes, and supporting prefixes
   rather than trying to recreate the restricted sets from ast-borrowck.

 * Add shallow reads of Discriminant and ArrayLength, and treat them
   as artificial fields when doing prefix traversals.

6 years agoMore fine-grained delineation for mir-borrowck errors.
Felix S. Klock II [Tue, 22 Aug 2017 09:23:17 +0000 (11:23 +0200)]
More fine-grained delineation for mir-borrowck errors.

6 years agofix Debug impls
Ariel Ben-Yehuda [Mon, 25 Sep 2017 10:47:19 +0000 (13:47 +0300)]
fix Debug impls

6 years agoAuto merge of #44646 - petrochenkov:scompress, r=michaelwoerister
bors [Mon, 25 Sep 2017 09:01:53 +0000 (09:01 +0000)]
Auto merge of #44646 - petrochenkov:scompress, r=michaelwoerister

Compress most of spans to 32 bits

As described in https://internals.rust-lang.org/t/rfc-compiler-refactoring-spans/1357/28

Closes https://github.com/rust-lang/rust/issues/15594
r? @michaelwoerister

6 years agoAllow unused extern crate again
David Tolnay [Mon, 25 Sep 2017 06:57:42 +0000 (23:57 -0700)]
Allow unused extern crate again

This is a partial revert of #42588. There is a usability concern
reported in #44294 that was not considered in the discussion of the PR,
so I would like to back this out of 1.21. As is, I think users would
have a worse and more confusing experience with this lint enabled by
default. We can re-enabled once there are better diagnostics or the case
in #44294 does not trigger the lint.

6 years agoFix error
bjorn3 [Mon, 25 Sep 2017 06:17:37 +0000 (08:17 +0200)]
Fix error

6 years agoBackport libs stabilizations to 1.21 beta
David Tolnay [Mon, 25 Sep 2017 05:23:26 +0000 (22:23 -0700)]
Backport libs stabilizations to 1.21 beta

This includes the following stabilizations:

- tcpstream_connect_timeout https://github.com/rust-lang/rust/pull/44563
- iterator_for_each https://github.com/rust-lang/rust/pull/44567
- ord_max_min https://github.com/rust-lang/rust/pull/44593
- compiler_fences https://github.com/rust-lang/rust/pull/44595
- needs_drop https://github.com/rust-lang/rust/pull/44639
- vec_splice https://github.com/rust-lang/rust/pull/44640

6 years agoAuto merge of #44612 - pylaligand:magenta-to-zircon, r=alexcrichton
bors [Mon, 25 Sep 2017 05:05:14 +0000 (05:05 +0000)]
Auto merge of #44612 - pylaligand:magenta-to-zircon, r=alexcrichton

The Magenta kernel is now called Zircon.

6 years agoFix fuchsia toolchain prebuild setup
James Tucker [Mon, 25 Sep 2017 04:32:27 +0000 (21:32 -0700)]
Fix fuchsia toolchain prebuild setup

 * Adjust bootstrap to provide useful output on failure
 * Add missing package dependencies in the build environment
 * Fix permission bits on prebuilt toolchain files

6 years agoAuto merge of #44700 - arielb1:mir-effectck, r=nikomatsakis
bors [Mon, 25 Sep 2017 00:52:15 +0000 (00:52 +0000)]
Auto merge of #44700 - arielb1:mir-effectck, r=nikomatsakis

Move effect-checking to MIR

This allows emitting lints from MIR and moves the effect-checking pass to work on it.

I'll make `repr(packed)` misuse unsafe in a separate PR.

r? @eddyb

6 years agoLP_CLONE_FDIO_ROOT is now LP_CLONE_FDIO_NAMESPACE
James Tucker [Sun, 24 Sep 2017 21:31:50 +0000 (14:31 -0700)]
LP_CLONE_FDIO_ROOT is now LP_CLONE_FDIO_NAMESPACE

6 years agoensure that prebuilt toolchain binaries are +x
James Tucker [Fri, 22 Sep 2017 18:20:48 +0000 (11:20 -0700)]
ensure that prebuilt toolchain binaries are +x