]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoAuto merge of #44920 - vi:rustdoc_implementors_src_link, r=GuillaumeGomez
bors [Tue, 3 Oct 2017 08:04:33 +0000 (08:04 +0000)]
Auto merge of #44920 - vi:rustdoc_implementors_src_link, r=GuillaumeGomez

 rustdoc: Render [src] links for trait implementors

Should close #43893.

<s>No tests [yet].</s>

r? @QuietMisdreavus

6 years agoAuto merge of #44966 - zackmdavis:no_mangle_no_snake, r=aturon
bors [Tue, 3 Oct 2017 02:26:27 +0000 (02:26 +0000)]
Auto merge of #44966 - zackmdavis:no_mangle_no_snake, r=aturon

make non_snake_case lint allow extern no-mangle functions

Resolves #31924.

r? @sfackler

6 years agoAuto merge of #44977 - steveklabnik:update-mdbook, r=alexcrichton
bors [Mon, 2 Oct 2017 22:39:51 +0000 (22:39 +0000)]
Auto merge of #44977 - steveklabnik:update-mdbook, r=alexcrichton

update mdbook

Fixes #44704

6 years agoAuto merge of #44885 - lu-zero:master, r=alexcrichton
bors [Mon, 2 Oct 2017 17:18:20 +0000 (17:18 +0000)]
Auto merge of #44885 - lu-zero:master, r=alexcrichton

More Altivec Intrinsics

Float-specific intrinsics

6 years agoupdate mdbook
steveklabnik [Mon, 2 Oct 2017 14:16:32 +0000 (10:16 -0400)]
update mdbook

Fixes #44704

6 years agorustdoc: Remove cruft from the test
Vitaly _Vi Shukela [Mon, 2 Oct 2017 13:54:35 +0000 (16:54 +0300)]
rustdoc: Remove cruft from the test

per @GuillaumeGomez's sample, but with one change.

6 years agoAuto merge of #44959 - arielb1:generic-errors, r=eddyb
bors [Mon, 2 Oct 2017 10:06:32 +0000 (10:06 +0000)]
Auto merge of #44959 - arielb1:generic-errors, r=eddyb

handle nested generics in Generics::type_param/region_param

Fixes #44952.

r? @eddyb

6 years agofix handling of `Self`
Ariel Ben-Yehuda [Mon, 2 Oct 2017 08:43:36 +0000 (10:43 +0200)]
fix handling of `Self`

6 years agoAuto merge of #44942 - zackmdavis:lint_suggestions, r=estebank
bors [Mon, 2 Oct 2017 07:03:26 +0000 (07:03 +0000)]
Auto merge of #44942 - zackmdavis:lint_suggestions, r=estebank

code suggestions for unused-mut, while-true, deprecated-attribute, and unused-parens lints

![lint_suggestions](https://user-images.githubusercontent.com/1076988/31044068-b2074de8-a57c-11e7-9319-6668508b6d1f.png)

r? @estebank

6 years agocorrect unused-parens lint suggestion to strip exact pair
Zack M. Davis [Sat, 30 Sep 2017 07:53:26 +0000 (00:53 -0700)]
correct unused-parens lint suggestion to strip exact pair

6 years agoAuto merge of #44960 - SeanPrashad:master, r=steveklabnik
bors [Mon, 2 Oct 2017 02:17:14 +0000 (02:17 +0000)]
Auto merge of #44960 - SeanPrashad:master, r=steveklabnik

Resolves #36284 - vec.rs documentation

Removed comments associated with `[into_vec]` being equivalent to `[shrink_to_fit]` as requested.

6 years agomake non_snake_case lint allow extern no-mangle functions
Zack M. Davis [Sun, 1 Oct 2017 23:44:33 +0000 (16:44 -0700)]
make non_snake_case lint allow extern no-mangle functions

Resolves #31924.

6 years agoAuto merge of #44955 - laumann:small-typo-fix, r=steveklabnik
bors [Sun, 1 Oct 2017 22:16:04 +0000 (22:16 +0000)]
Auto merge of #44955 - laumann:small-typo-fix, r=steveklabnik

Fix typo: geneartor -> generator

6 years agofix handling of Self
Ariel Ben-Yehuda [Sun, 1 Oct 2017 21:03:48 +0000 (23:03 +0200)]
fix handling of Self

6 years agoAuto merge of #44919 - diwic:79-pretty-mir, r=arielb1
bors [Sun, 1 Oct 2017 19:57:01 +0000 (19:57 +0000)]
Auto merge of #44919 - diwic:79-pretty-mir, r=arielb1

Mir pretty print: Add cleanup comment

I found it useful to add a comment indicating whether or not a
BasicBlock is a cleanup block or not. Hopefully you'll find it
useful too.

6 years agoAuto merge of #44897 - Havvy:doc-size_of, r=steveklabnik
bors [Sun, 1 Oct 2017 17:32:34 +0000 (17:32 +0000)]
Auto merge of #44897 - Havvy:doc-size_of, r=steveklabnik

Docs for size_of::<#[repr(C)]> items.

Most of this info comes from camlorn's blog post on optimizing struct layout and the Rustonomicon.

I don't really like my wording in the first paragraph.

I also cannot find a definition of what `#[repr(C)]` does for enums that have variants with fields. They're allowed, unlike `#[repr(C)] enum`s with no variants.

6 years agoResolves #36284 - vec.rs documentation
Sean Prashad [Sun, 1 Oct 2017 16:15:05 +0000 (12:15 -0400)]
Resolves #36284 - vec.rs documentation

6 years agohandle nested generics in Generics::type_param/region_param
Ariel Ben-Yehuda [Sun, 1 Oct 2017 15:15:15 +0000 (17:15 +0200)]
handle nested generics in Generics::type_param/region_param

Fixes #44952.

6 years agoFix typo: geneartor -> generator
Thomas Jespersen [Sun, 1 Oct 2017 13:40:00 +0000 (15:40 +0200)]
Fix typo: geneartor -> generator

6 years agoAuto merge of #44945 - petrochenkov:fixtyrec, r=arielb1
bors [Sun, 1 Oct 2017 13:26:15 +0000 (13:26 +0000)]
Auto merge of #44945 - petrochenkov:fixtyrec, r=arielb1

Do not require semantic types for all syntactic types when there are errors

Fixes https://github.com/rust-lang/rust/issues/44814
Fixes https://github.com/rust-lang/rust/issues/44858
Fixes https://github.com/rust-lang/rust/issues/44946
r? @nikomatsakis

6 years agorustdoc: Style of [src] link for trait implementors
Vitaly _Vi Shukela [Sun, 1 Oct 2017 12:54:50 +0000 (15:54 +0300)]
rustdoc: Style of [src] link for trait implementors

A change suggested by @GuillaumeGomez and @QuietMisdreavus.

Also slight reindenting of the appropriate CSS section.

6 years agoAuto merge of #44906 - dkl:main-signature, r=nagisa
bors [Sun, 1 Oct 2017 09:14:53 +0000 (09:14 +0000)]
Auto merge of #44906 - dkl:main-signature, r=nagisa

Fix native main() signature on 64bit

Hello,

in LLVM-IR produced by rustc on x86_64-linux-gnu, the native main() function had incorrect types for the function result and argc parameter: i64, while it should be i32 (really c_int). See also #20064, #29633.

So I've attempted a fix here. I tested it by checking the LLVM IR produced with --target x86_64-unknown-linux-gnu and i686-unknown-linux-gnu. Also I tried running the tests (`./x.py test`), however I'm getting two failures with and without the patch, which I'm guessing is unrelated.

6 years agoAuto merge of #44921 - est31:master, r=alexcrichton
bors [Sun, 1 Oct 2017 01:41:42 +0000 (01:41 +0000)]
Auto merge of #44921 - est31:master, r=alexcrichton

Update the libcompiler_builtins submodule

Pulls in the latest changes from libcompiler_builtins.

It should work, but it would be best if this wouldn't get put into a rollup so that bisecting is possible if there is a regression.

r? @alexcrichton

6 years agotest: Update target specs test for new target-c-int-width field
Daniel Klauer [Sat, 30 Sep 2017 21:45:36 +0000 (23:45 +0200)]
test: Update target specs test for new target-c-int-width field

6 years agoAuto merge of #44944 - dbrgn:trace-macros-docs, r=QuietMisdreavus
bors [Sat, 30 Sep 2017 20:46:57 +0000 (20:46 +0000)]
Auto merge of #44944 - dbrgn:trace-macros-docs, r=QuietMisdreavus

Docs: Add trace_macros! to unstable book

As TIL'd at Rustfest :)

Note: This is unfortunately untested, since I'm on my laptop battery, and compiling LLVM would probably eat at least 50% of it on my dual core CPU. (Is there a way to build docs without compiling LLVM?)

6 years agocode suggestions for unused-mut, while-true lints; UI test
Zack M. Davis [Sat, 30 Sep 2017 06:52:51 +0000 (23:52 -0700)]
code suggestions for unused-mut, while-true lints; UI test

6 years agocode suggestion for unused-parentheses lint
Zack M. Davis [Sat, 30 Sep 2017 06:50:34 +0000 (23:50 -0700)]
code suggestion for unused-parentheses lint

Resolves #42892.

6 years agocode suggestion for deprecated-attribute lint
Zack M. Davis [Sat, 30 Sep 2017 06:44:41 +0000 (23:44 -0700)]
code suggestion for deprecated-attribute lint

Also, fix the deprecation message for the late no-debug feature.

6 years agoAuto merge of #44783 - alexcrichton:lto-codegen-units, r=michaelwoerister
bors [Sat, 30 Sep 2017 15:01:35 +0000 (15:01 +0000)]
Auto merge of #44783 - alexcrichton:lto-codegen-units, r=michaelwoerister

rustc: Enable LTO and multiple codegen units

This commit is a refactoring of the LTO backend in Rust to support compilations
with multiple codegen units. The immediate result of this PR is to remove the
artificial error emitted by rustc about `-C lto -C codegen-units-8`, but longer
term this is intended to lay the groundwork for LTO with incremental compilation
and ultimately be the underpinning of ThinLTO support.

The problem here that needed solving is that when rustc is producing multiple
codegen units in one compilation LTO needs to merge them all together.
Previously only upstream dependencies were merged and it was inherently relied
on that there was only one local codegen unit. Supporting this involved
refactoring the optimization backend architecture for rustc, namely splitting
the `optimize_and_codegen` function into `optimize` and `codegen`. After an LLVM
module has been optimized it may be blocked and queued up for LTO, and only
after LTO are modules code generated.

Non-LTO compilations should look the same as they do today backend-wise, we'll
spin up a thread for each codegen unit and optimize/codegen in that thread. LTO
compilations will, however, send the LLVM module back to the coordinator thread
once optimizations have finished. When all LLVM modules have finished optimizing
the coordinator will invoke the LTO backend, producing a further list of LLVM
modules. Currently this is always a list of one LLVM module. The coordinator
then spawns further work to run LTO and code generation passes over each module.

In the course of this refactoring a number of other pieces were refactored:

* Management of the bytecode encoding in rlibs was centralized into one module
  instead of being scattered across LTO and linking.
* Some internal refactorings on the link stage of the compiler was done to work
  directly from `CompiledModule` structures instead of lists of paths.
* The trans time-graph output was tweaked a little to include a name on each
  bar and inflate the size of the bars a little

6 years agoDo not require semantic types for all syntactic types when there are type errors
petrochenkov [Sat, 30 Sep 2017 13:42:22 +0000 (16:42 +0300)]
Do not require semantic types for all syntactic types when there are type errors

6 years agorustc: Use 16bit c_int for msp430
Daniel Klauer [Sat, 30 Sep 2017 11:48:12 +0000 (13:48 +0200)]
rustc: Use 16bit c_int for msp430

Fix regression from c2fe69b9, where main() signature was changed from
using 16bit isize to 32bit c_int for argc parameter/result.

6 years agorustc: Specify c_int width for each target
Daniel Klauer [Sat, 30 Sep 2017 11:47:49 +0000 (13:47 +0200)]
rustc: Specify c_int width for each target

(all i32 for now, as in liblibc)

6 years agoDocs: Add trace_macros! to unstable book
Danilo Bargen [Sat, 30 Sep 2017 09:50:32 +0000 (11:50 +0200)]
Docs: Add trace_macros! to unstable book

6 years agoAuto merge of #44936 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
bors [Sat, 30 Sep 2017 10:03:00 +0000 (10:03 +0000)]
Auto merge of #44936 - Mark-Simulacrum:rollup, r=Mark-Simulacrum

Rollup of 15 pull requests

- Successful merges: #44124, #44287, #44320, #44694, #44708, #44794, #44797, #44824, #44836, #44840, #44845, #44854, #44889, #44900, #44903
- Failed merges:

6 years agorustc: Enable LTO and multiple codegen units
Alex Crichton [Sun, 23 Jul 2017 15:14:38 +0000 (08:14 -0700)]
rustc: Enable LTO and multiple codegen units

This commit is a refactoring of the LTO backend in Rust to support compilations
with multiple codegen units. The immediate result of this PR is to remove the
artificial error emitted by rustc about `-C lto -C codegen-units-8`, but longer
term this is intended to lay the groundwork for LTO with incremental compilation
and ultimately be the underpinning of ThinLTO support.

The problem here that needed solving is that when rustc is producing multiple
codegen units in one compilation LTO needs to merge them all together.
Previously only upstream dependencies were merged and it was inherently relied
on that there was only one local codegen unit. Supporting this involved
refactoring the optimization backend architecture for rustc, namely splitting
the `optimize_and_codegen` function into `optimize` and `codegen`. After an LLVM
module has been optimized it may be blocked and queued up for LTO, and only
after LTO are modules code generated.

Non-LTO compilations should look the same as they do today backend-wise, we'll
spin up a thread for each codegen unit and optimize/codegen in that thread. LTO
compilations will, however, send the LLVM module back to the coordinator thread
once optimizations have finished. When all LLVM modules have finished optimizing
the coordinator will invoke the LTO backend, producing a further list of LLVM
modules. Currently this is always a list of one LLVM module. The coordinator
then spawns further work to run LTO and code generation passes over each module.

In the course of this refactoring a number of other pieces were refactored:

* Management of the bytecode encoding in rlibs was centralized into one module
  instead of being scattered across LTO and linking.
* Some internal refactorings on the link stage of the compiler was done to work
  directly from `CompiledModule` structures instead of lists of paths.
* The trans time-graph output was tweaked a little to include a name on each
  bar and inflate the size of the bars a little

6 years agoAuto merge of #44893 - spastorino:remove_new_and_index, r=nikomatsakis
bors [Sat, 30 Sep 2017 06:56:49 +0000 (06:56 +0000)]
Auto merge of #44893 - spastorino:remove_new_and_index, r=nikomatsakis

Remove new and index methods already implement for Idx

These are the rest of the repeated implementations for new and index methods. Follow up of https://github.com/rust-lang/rust/pull/44889

6 years agofix comment typo, `CodeSuggestion` path in doc comment
Zack M. Davis [Sat, 30 Sep 2017 06:38:33 +0000 (23:38 -0700)]
fix comment typo, `CodeSuggestion` path in doc comment

`CodeSuggestion` doesn't live in the `diagnostic` module.

6 years agorustdoc: A test for local and foreign [src] trait impl links
Vitaly _Vi Shukela [Sat, 30 Sep 2017 00:17:51 +0000 (03:17 +0300)]
rustdoc: A test for local and foreign [src] trait impl links

6 years agoRollup merge of #44903 - kallisti5:ci-build-disabled, r=aidanhs
Mark Simulacrum [Fri, 29 Sep 2017 23:59:05 +0000 (17:59 -0600)]
Rollup merge of #44903 - kallisti5:ci-build-disabled, r=aidanhs

ci: Fix building disabled containers

* Change the context into the disabled directory. Now you can test
  containers which are disabled.

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 agoUpdate the libcompiler_builtins submodule
est31 [Thu, 28 Sep 2017 19:18:50 +0000 (21:18 +0200)]
Update the libcompiler_builtins submodule

6 years agoAuto merge of #44174 - jimmycuadra:try-from-infallible, r=sfackler
bors [Fri, 29 Sep 2017 22:35:23 +0000 (22:35 +0000)]
Auto merge of #44174 - jimmycuadra:try-from-infallible, r=sfackler

Add blanket TryFrom impl when From is implemented.

Adds `impl<T, U> TryFrom<T> for U where U: From<T>`.

Removes `impl<'a, T> TryFrom<&'a str> for T where T: FromStr` (originally added in #40281) due to overlapping impls caused by the new blanket impl. This removal is to be discussed further on the tracking issue for TryFrom.

Refs #33417.

/cc @sfackler, @scottmcm (thank you for the help!), and @aturon

6 years agoFix more TryFrom impls for integers.
Jimmy Cuadra [Fri, 29 Sep 2017 21:10:26 +0000 (14:10 -0700)]
Fix more TryFrom impls for integers.

6 years agoSimplify implementation of From<Infallible> for TryFromIntError.
Jimmy Cuadra [Fri, 29 Sep 2017 21:04:28 +0000 (14:04 -0700)]
Simplify implementation of From<Infallible> for TryFromIntError.

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 agorustdoc: Render [src] links for trait implementors (#43893)
Vitaly _Vi Shukela [Fri, 29 Sep 2017 11:29:09 +0000 (14:29 +0300)]
rustdoc: Render [src] links for trait implementors (#43893)

6 years agorustdoc: Extract converter from Impementor to Item to a fn
Vitaly _Vi Shukela [Fri, 29 Sep 2017 11:28:25 +0000 (14:28 +0300)]
rustdoc: Extract converter from Impementor to Item to a fn

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 agoMir pretty print: Add cleanup comment
David Henningsson [Fri, 29 Sep 2017 09:00:08 +0000 (11:00 +0200)]
Mir pretty print: Add cleanup comment

I found it useful to add a comment indicating whether or not a
BasicBlock is a cleanup block or not. Hopefully you'll find it
useful too.

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 agoRemove conflicting TryFrom impls on 32-bit targets.
Jimmy Cuadra [Fri, 29 Sep 2017 06:46:19 +0000 (23:46 -0700)]
Remove conflicting TryFrom impls on 32-bit targets.

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 agotest: Check native main() signature
Daniel Klauer [Thu, 28 Sep 2017 21:36:08 +0000 (23:36 +0200)]
test: Check native main() signature

6 years agorustc: Fix main() entry point signature on 64bit
Daniel Klauer [Thu, 21 Sep 2017 22:36:10 +0000 (00:36 +0200)]
rustc: Fix main() entry point signature on 64bit

To match the C signature, main() should be generated with C int type
for the argc parameter and result, i.e. i32 instead of i64 on 64bit.

That way it no longer relies on the upper 32 bits being zero, which I'm
not sure is guaranteed by ABIs or startup code.

6 years agorustc: Add Type::c_int()
Daniel Klauer [Thu, 21 Sep 2017 21:43:05 +0000 (23:43 +0200)]
rustc: Add Type::c_int()

Add c_int for use in the compiler,
assuming i32 for all targets as in libc.

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 agoRemove link duplication.
Havvy [Thu, 28 Sep 2017 17:47:54 +0000 (10:47 -0700)]
Remove link duplication.

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 agoci: Fix building disabled containers
Alexander von Gluck IV [Tue, 5 Sep 2017 18:08:02 +0000 (13:08 -0500)]
ci: Fix building disabled containers

* Change the context into the disabled directory. Now you can test
  containers which are disabled.

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 agoBackticks.
Havvy [Thu, 28 Sep 2017 06:31:29 +0000 (23:31 -0700)]
Backticks.

6 years agoDocs for size_of::<#[repr(C)]> items.
Havvy [Wed, 27 Sep 2017 00:41:21 +0000 (17:41 -0700)]
Docs for size_of::<#[repr(C)]> items.

Most of this info comes from camlorn's blog post on optimizing
struct layout and the Rustonomicon.

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 SerializedDepNodeIndex::new it is already impl for Idx
Santiago Pastorino [Wed, 27 Sep 2017 19:41:35 +0000 (16:41 -0300)]
Remove SerializedDepNodeIndex::new it is already impl for Idx

6 years agoRemove DepNodeIndexNew::new and ::index, they are already impl for Idx
Santiago Pastorino [Wed, 27 Sep 2017 19:31:31 +0000 (16:31 -0300)]
Remove DepNodeIndexNew::new and ::index, they are already impl for Idx

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.