Commit graph

63259 commits

Author SHA1 Message Date
bors
185cc5f26d Auto merge of #44885 - lu-zero:master, r=alexcrichton
More Altivec Intrinsics

Float-specific intrinsics
2017-10-02 17:18:20 +00:00
steveklabnik
851b6d4762 update books for next release
Also fixes some stdlib links to the reference which have changed.
2017-10-02 12:07:28 -04:00
hinaria
a5296a5fb2 windows: make backtrace = false compile 2017-10-03 02:48:17 +11:00
James Munns
1e26094bdd Allow atomic operations up to 32 bits
The ARMv5te platform does not have instruction-level support for atomics, however the kernel provides [user space helpers](https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt) which can be used to perform atomic operations. When linked with `libc`, the atomic symbols needed by Rust will be provided, rather than CPU level intrinsics.

As this target is specifically `linux` and `gnueabi`, it is reasonable to assume the Linux Kernel and libc will be available for the target. There is a large performance penalty, as we are not using CPU level intrinsics, however this penalty is likely preferable to not having the target at all.

I have used this change in a custom target (along with `xargo`) to build `std`, as well as a number of higher level crates.
2017-10-02 16:53:43 +02:00
steveklabnik
1bbf41da6f update mdbook
Fixes #44704
2017-10-02 10:16:32 -04:00
Michael Woerister
dbab705f04 incr.comp.: Do some cleanup. 2017-10-02 16:09:23 +02:00
Michael Woerister
df06a7e532 incr.comp.: Remove legacy dep-graph runtime. 2017-10-02 16:09:19 +02:00
Vitaly _Vi Shukela
acef039de8
rustdoc: Remove cruft from the test
per @GuillaumeGomez's sample, but with one change.
2017-10-02 16:54:35 +03:00
Michael Woerister
171c020857 incr.comp.: Remove saving and loading of legacy dep-graph. 2017-10-02 15:47:11 +02:00
Michael Woerister
272c324b25 incr.comp.: Build DepGraphQuery from new dep-graph impl. 2017-10-02 15:45:46 +02:00
Michael Woerister
e6badfd449 incr.comp.: Use red/green tracking for CGU re-use. 2017-10-02 15:45:46 +02:00
Michael Woerister
c9a17ef174 incr.comp.: Add some logging to DepGraph::try_mark_green(). 2017-10-02 15:38:57 +02:00
Michael Woerister
e1994bd27b incr.comp.: Make some DepNodes non-anonymous. 2017-10-02 15:38:57 +02:00
Michael Woerister
f0bbf4e1f2 incr.comp.: Re-execute queries during red/green marking in order to find out their color. 2017-10-02 15:38:57 +02:00
Michael Woerister
6db27d9f90 incr.comp.: Add minimal version of try_mark_green procedure. 2017-10-02 15:36:47 +02:00
Michael Woerister
a948be81cd incr.comp.: Determine red/green state of every new node. 2017-10-02 15:36:47 +02:00
Alex Burka
fc5e8dc1b5 fix comment on DefaultImpl 2017-10-02 07:30:09 -04:00
bors
0f0f5db465 Auto merge of #44959 - arielb1:generic-errors, r=eddyb
handle nested generics in Generics::type_param/region_param

Fixes #44952.

r? @eddyb
2017-10-02 10:06:32 +00:00
Alex Burka
5517a1ce79 fix ItemKind::DefaultImpl doc comment
Upgrade comment to doc comment.
2017-10-02 05:59:56 -04:00
Ariel Ben-Yehuda
706e52e2cc fix handling of Self 2017-10-02 10:43:36 +02:00
bors
9ae6ed78ac 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
2017-10-02 07:03:26 +00:00
Zack M. Davis
8a14022c5d correct unused-parens lint suggestion to strip exact pair 2017-10-01 20:15:24 -07:00
QuietMisdreavus
23f5fbee45 document trait impls when the type appears in the trait's generics 2017-10-01 21:25:48 -05:00
bors
2146c613d1 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.
2017-10-02 02:17:14 +00:00
Zack M. Davis
b989101a55 make non_snake_case lint allow extern no-mangle functions
Resolves #31924.
2017-10-01 17:20:06 -07:00
bors
a4af9309d0 Auto merge of #44955 - laumann:small-typo-fix, r=steveklabnik
Fix typo: geneartor -> generator
2017-10-01 22:16:04 +00:00
Ariel Ben-Yehuda
ad9986605f fix handling of Self 2017-10-01 23:03:48 +02:00
bors
f1b5225e8b 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.
2017-10-01 19:57:01 +00:00
bors
cef4a3ebfa 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.
2017-10-01 17:32:34 +00:00
Joshua Lockerman
68341a91ee Improve performance of spsc_queue and stream.
This commit makes two main changes.
1. It switches the spsc_queue node caching strategy from keeping a shared
counter of the number of nodes in the cache to keeping a consumer only counter
of the number of node eligible to be cached.
2. It separate the consumer and producers fields of spsc_queue and stream into
a producer cache line and consumer cache line.
2017-10-01 12:15:35 -04:00
Sean Prashad
1ebc7bba79 Resolves #36284 - vec.rs documentation 2017-10-01 12:15:05 -04:00
Ariel Ben-Yehuda
622a78cd54 handle nested generics in Generics::type_param/region_param
Fixes #44952.
2017-10-01 17:15:15 +02:00
Douglas Campos
11e141eba3 stray comma 2017-10-01 11:14:47 -04:00
Thomas Jespersen
30b19c9e8b Fix typo: geneartor -> generator 2017-10-01 15:40:00 +02:00
bors
3651cddc44 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
2017-10-01 13:26:15 +00:00
Vitaly _Vi Shukela
67c9af590d
rustdoc: Style of [src] link for trait implementors
A change suggested by @GuillaumeGomez and @QuietMisdreavus.

Also slight reindenting of the appropriate CSS section.
2017-10-01 16:20:56 +03:00
bors
0defa208dc 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.
2017-10-01 09:14:53 +00:00
bors
1c09315f6d 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
2017-10-01 01:41:42 +00:00
Daniel Klauer
a4e83731e9 test: Update target specs test for new target-c-int-width field 2017-09-30 23:45:36 +02:00
bors
afe9320785 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?)
2017-09-30 20:46:57 +00:00
Zack M. Davis
e3b498971d code suggestions for unused-mut, while-true lints; UI test 2017-09-30 11:31:12 -07:00
Zack M. Davis
5c9f806d78 code suggestion for unused-parentheses lint
Resolves #42892.
2017-09-30 11:31:12 -07:00
Zack M. Davis
f2c5acd611 code suggestion for deprecated-attribute lint
Also, fix the deprecation message for the late no-debug feature.
2017-09-30 11:31:12 -07:00
QuietMisdreavus
5b59c4db67 let htmldocck.py check for directories 2017-09-30 13:28:09 -05:00
Douglas Campos
b24a672613 weird formatting 2017-09-30 11:08:08 -04:00
bors
c6884b12d9 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
2017-09-30 15:01:35 +00:00
petrochenkov
8037c28a4a Do not require semantic types for all syntactic types when there are type errors 2017-09-30 17:41:00 +03:00
Daniel Klauer
12a8bc6eb9 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.
2017-09-30 16:30:12 +02:00
Nikolai Vazquez
f1798d3c9a Cast inner type in OsStr::bytes
The innermost type is not [u8] on all platforms but is assumed to have
the same memory layout as [u8] since this conversion was done via
mem::transmute before.
2017-09-30 10:01:41 -04:00
Daniel Klauer
a204c193ca rustc: Specify c_int width for each target
(all i32 for now, as in liblibc)
2017-09-30 15:54:08 +02:00
Danilo Bargen
eb59952fbd Docs: Add trace_macros! to unstable book 2017-09-30 15:27:42 +02:00
Niv Kaminer
5eebab28dd remove "refinement on pat" FIXME 2017-09-30 13:46:57 +03:00
bors
c4cca3a72d 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:
2017-09-30 10:03:00 +00:00
Niv Kaminer
ff99111f48 address some FIXMEs whose associated issues were marked as closed
remove FIXME(#13101) since `assert_receiver_is_total_eq` stays.
remove FIXME(#19649) now that stability markers render.
remove FIXME(#13642) now the benchmarks were moved.
remove FIXME(#6220) now that floating points can be formatted.
remove FIXME(#18248) and write tests for `Rc<str>` and `Rc<[u8]>`
remove reference to irelevent issues in FIXME(#1697, #2178...)
update FIXME(#5516) to point to getopts issue 7
update FIXME(#7771) to point to RFC 628
update FIXME(#19839) to point to issue 26925
2017-09-30 11:33:47 +03:00
Alex Crichton
ded38dbfc2 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
2017-09-30 00:22:15 -07:00
bors
4491ea5a3f 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
2017-09-30 06:56:49 +00:00
Zack M. Davis
d663003e03 fix comment typo, CodeSuggestion path in doc comment
`CodeSuggestion` doesn't live in the `diagnostic` module.
2017-09-29 23:42:24 -07:00
Philip Craig
c27a82f193 Don't use remapped path when loading modules and include files 2017-09-30 16:32:45 +10:00
Douglas Campos
a29c770c68 make match exaustive 2017-09-29 22:34:51 -04:00
Douglas Campos
59e778e5e1 improve documentation for resolve() 2017-09-29 22:34:49 -04:00
Douglas Campos
08e1f0b9d7 fix formatting 2017-09-29 22:34:48 -04:00
Douglas Campos
29220663c1 style fixes as requested by @eddyb 2017-09-29 22:34:48 -04:00
Douglas Campos
081b29c1f6 stop using monomorphize::resolve() 2017-09-29 22:34:48 -04:00
Douglas Campos
8a5800e1d4 take ParamEnv into account when resolving 2017-09-29 22:34:47 -04:00
Douglas Campos
24fc50fffa make it not to be a method 2017-09-29 22:34:46 -04:00
Douglas Campos
5eb302fba8 always use resolve 2017-09-29 22:34:46 -04:00
Douglas Campos
3bd09dee45 re-enable mir inlining across trait methods
this fixes #44389
2017-09-29 22:34:46 -04:00
Douglas Campos
baa010561e copy resolve() over to librustc 2017-09-29 22:34:45 -04:00
Vitaly _Vi Shukela
d892e985b0
rustdoc: A test for local and foreign [src] trait impl links 2017-09-30 03:17:51 +03:00
Mark Simulacrum
d6451f0b33 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.
2017-09-29 17:59:05 -06:00
Mark Simulacrum
4489a7a0bb 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.
2017-09-29 17:59:04 -06:00
Mark Simulacrum
37c74e1979 Rollup merge of #44889 - spastorino:remove_new, r=arielb1
Remove DepNodeIndex::new is already impl for Idx
2017-09-29 17:59:03 -06:00
Mark Simulacrum
7756d39dca Rollup merge of #44854 - lucasem:atomic-docs, r=steveklabnik
docs improvement sync::atomic::Atomic*

Addresses the `Atomic*` part of #29377.
r? @steveklabnik
2017-09-29 17:59:02 -06:00
Mark Simulacrum
7c3d376086 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
2017-09-29 17:59:01 -06:00
Mark Simulacrum
3d7a390552 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.
2017-09-29 17:59:00 -06:00
Mark Simulacrum
327cd0d557 Rollup merge of #44836 - GuillaumeGomez:fmt-missing-links, r=QuietMisdreavus
Add missing links in fmt module

r? @rust-lang/docs
2017-09-29 17:58:59 -06:00
Mark Simulacrum
570f1ce36a 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.
2017-09-29 17:58:58 -06:00
Mark Simulacrum
b1437bc0f7 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
2017-09-29 17:58:57 -06:00
Mark Simulacrum
f2feb83b73 Rollup merge of #44794 - napen123:master, r=frewsxcv
Add doc example to HashMap::hasher

None
2017-09-29 17:58:56 -06:00
Mark Simulacrum
8083877987 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
2017-09-29 17:58:55 -06:00
Mark Simulacrum
6bc8ca06c1 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
2017-09-29 17:58:54 -06:00
Mark Simulacrum
20f892f549 Rollup merge of #44320 - jakllsch:jakllsch-caf2c3d2-c939-4c4d-8c68-1aecbd570fab, r=Mark-Simulacrum
Fix extended bootstrap issues with OpenSSL on NetBSD build hosts
2017-09-29 17:58:53 -06:00
Mark Simulacrum
f91c55e995 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
2017-09-29 17:58:52 -06:00
Mark Simulacrum
f407b2bf4a 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.
2017-09-29 17:58:51 -06:00
est31
4114d68f18 Update the libcompiler_builtins submodule 2017-09-30 01:45:21 +02:00
bors
b7041bfab3 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
2017-09-29 22:35:23 +00:00
Jimmy Cuadra
27d95d3645 Fix more TryFrom impls for integers. 2017-09-29 14:10:26 -07:00
Jimmy Cuadra
966cf339cb Simplify implementation of From<Infallible> for TryFromIntError. 2017-09-29 14:04:28 -07:00
bors
6f87d20a7c Auto merge of #42526 - huntiep:try_opt, r=nikomatsakis
Impl Try for Option

This is part of #31436.
2017-09-29 20:09:35 +00:00
bors
51cd06170e 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
2017-09-29 15:54:44 +00:00
Basile Desloges
d328d264aa mir-borrowck: Factorize error message for cannot_assign_static() between AST and MIR borrowck 2017-09-29 15:41:26 +02:00
Basile Desloges
5c8066b4a7 mir-borrowck: Move span_label calls for cannot_use_when_mutably_borrowed() inside borrowck_errors.rs 2017-09-29 15:41:26 +02:00
Basile Desloges
bcda695720 mir-borrowck: Move span_label calls for cannot_assign_to_borrowed() inside borrowck_errors.rs 2017-09-29 15:41:26 +02:00
bors
09ee9b723a 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)
2017-09-29 12:56:24 +00:00
Vitaly _Vi Shukela
9f02e1a938
rustdoc: Render [src] links for trait implementors (#43893) 2017-09-29 14:33:02 +03:00
Vitaly _Vi Shukela
87d7520d0f
rustdoc: Extract converter from Impementor to Item to a fn 2017-09-29 14:32:57 +03:00
bors
d514263ce3 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!
2017-09-29 10:10:15 +00:00
David Henningsson
6f8b69fcd1 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.
2017-09-29 11:02:36 +02:00
bors
0253d98382 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.
2017-09-29 07:05:10 +00:00
Jimmy Cuadra
1a29e82227 Remove conflicting TryFrom impls on 32-bit targets. 2017-09-28 23:46:19 -07:00
bors
a379780fb6 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
2017-09-29 03:54:12 +00:00
leavehouse
6482ee7cde Fix imports in TcpStream::local_addr docs example
Add a missing import and remove unused imports
2017-09-28 21:49:00 -05:00
leavehouse
7f9e653a29 Fix TcpStream::local_addr example code
The local address's port is not 8080 in this example, that's the remote peer address port. On my machine, the local address is different every time, so I've changed `assert_eq` to only test the IP address
2017-09-28 20:09:31 -05:00
bors
46ef6208f8 Auto merge of #44528 - tmnilsson:attr_proc_macro_cfg_process, r=jseyfried
Apply attr proc macros before cfg processing

Fixes #39336.
r? @jseyfried
2017-09-28 23:38:52 +00:00
Daniel Klauer
6c3f19002d test: Check native main() signature 2017-09-28 23:36:08 +02:00
Daniel Klauer
c2fe69b9bd 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.
2017-09-28 22:06:54 +02:00
Daniel Klauer
6c9a4ba8eb rustc: Add Type::c_int()
Add c_int for use in the compiler,
assuming i32 for all targets as in libc.
2017-09-28 22:06:54 +02:00
bors
3c96d40d32 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.
2017-09-28 18:52:49 +00:00
Havvy
0ece48e211 Remove link duplication. 2017-09-28 10:47:54 -07:00
bors
688a858391 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`
2017-09-28 16:19:58 +00:00
Corey Farwell
8ef5447815 Migrate to eprint/eprintln macros where appropriate. 2017-09-28 11:38:35 -04:00
Alexander von Gluck IV
3457a22d91 ci: Fix building disabled containers
* Change the context into the disabled directory. Now you can test
  containers which are disabled.
2017-09-28 10:27:15 -05:00
Nikolai Vazquez
cb2a656cdf Fix errors in Box<Path> conversions 2017-09-28 10:59:12 -04:00
Alex Crichton
7694ca419b Update to the cc crate
This is the name the `gcc` crate has moved to
2017-09-28 07:45:50 -07:00
Nikolai Vazquez
c7b4a96909 Remove unused 'mem' import in 'path' module 2017-09-28 10:30:41 -04:00
Nikolai Vazquez
48c20b6a50 Remove mem::transmute used in Path conversions 2017-09-28 10:29:58 -04:00
Nikolai Vazquez
627998e86f Remove unused 'mem' import in 'os_str' module 2017-09-28 08:43:06 -04:00
bors
d88736905e 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.
2017-09-28 12:40:12 +00:00
Nikolai Vazquez
33eaa94f90 Remove mem::transmute used in OsStr conversions 2017-09-28 08:07:49 -04:00
Nikolai Vazquez
755fd29b60 Fix mutability error in CString::from_raw 2017-09-28 07:56:35 -04:00
bors
f22b9da1c3 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`.
2017-09-28 09:10:12 +00:00
Havvy
20fc215323 Normalize spaces in lang attributes. 2017-09-28 01:30:25 -07:00
Havvy
72b3139c3f Backticks. 2017-09-27 23:31:29 -07:00
Havvy
0118398291 Docs for size_of::<#[repr(C)]> items.
Most of this info comes from camlorn's blog post on optimizing
struct layout and the Rustonomicon.
2017-09-27 23:01:48 -07:00
Nikolai Vazquez
6d14512fd9 Remove mem::transmute used in CStr conversions 2017-09-28 00:51:38 -04:00
bors
9cb90f4e23 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
```
2017-09-28 03:28:20 +00:00
Stephane Raux
61c0c9e5f2 Made fs::copy return the length of the main stream
On Windows with the NTFS filesystem, `fs::copy` would return the sum of the
lengths of all streams, which can be different from the length reported by
`metadata` and thus confusing for users unaware of this NTFS peculiarity.

This makes `fs::copy` return the same length `metadata` reports which is the
value it used to return before PR #26751. Note that alternate streams are still
copied; their length is just not included in the returned value.

This change relies on the assumption that the stream with index 1 is always the
main stream in the `CopyFileEx` callback. I could not find any official
document confirming this but empirical testing has shown this to be true,
regardless of whether the alternate stream is created before or after the main
stream.

Resolves #44532
2017-09-27 19:43:05 -07:00
Alex Crichton
041d3550f6 Update some minor dependencies 2017-09-27 15:40:57 -07:00
Alex Crichton
9b91b877ad Update the Cargo submodule 2017-09-27 15:40:57 -07:00
Nick Cameron
71a0be0792 Update the RLS again 2017-09-27 15:40:57 -07:00
Nick Cameron
bfcb290937 Add RLS and Rustfmt to the toolstate mechanism 2017-09-27 15:40:57 -07:00
Nick Cameron
c0ea270f70 Rename rls component to rls-preview on nightly 2017-09-27 15:40:57 -07:00
Nick Cameron
c5cad5a78d Update RLS and Rustfmt 2017-09-27 15:40:57 -07:00
bors
44d5090a6d 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.
2017-09-27 22:00:11 +00:00
Hunter Praska
e30d92bb2d Add UI tests 2017-09-27 17:57:18 -04:00
Hunter Praska
28996db803 Rename option::Missing to NoneError 2017-09-27 17:57:07 -04:00
Hunter Praska
8f63e8de46 Add docs for Missing, correct Option's Try test 2017-09-27 17:56:54 -04:00
Hunter Praska
f098d7be29 Add tests for Option and Result Try impl 2017-09-27 17:56:40 -04:00
Hunter Praska
2bd104fd4f Impl Try for Option 2017-09-27 17:56:15 -04:00
Pirh
7ab20c850e Explain difference between panic! and abort in abort docs
As per #29370
2017-09-27 22:47:21 +01:00
Pirh
6dfa45d2ed Remove extraneous brackets from abort documentation
As per #29370
2017-09-27 21:13:07 +01:00
Tomas Nilsson
0f97b6b73c Apply attr proc macros before cfg processing
Now items are not fully configured until right before expanding derives.
2017-09-27 22:08:45 +02:00
Santiago Pastorino
e0e14c9a5b Remove SerializedDepNodeIndex::new it is already impl for Idx 2017-09-27 16:41:35 -03:00
Santiago Pastorino
70c3a3da6d Remove DepNodeIndexNew::new and ::index, they are already impl for Idx 2017-09-27 16:32:27 -03:00
Nikolai Vazquez
36d663fcfc Remove mem::transmute used in Box<str> conversions 2017-09-27 14:56:20 -04:00
Santiago Pastorino
cde47cef0f Remove DepNodeIndex::new is already impl for Idx 2017-09-27 15:11:22 -03:00
Jonathan A. Kollasch
90aa66bfc2 bootstrap: use tar -z on extract
Some tar(1) programs—such as NetBSD's—do not automatically decompress.
2017-09-27 11:17:42 -05:00
Jonathan A. Kollasch
b53b853129 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.
2017-09-27 11:17:42 -05:00
bors
0e6f4cf51c 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
2017-09-27 16:04:31 +00:00
Luca Barbato
7bdf013a0e Add support for Vector Negative Multiply Subtract Float on PowerPC 2017-09-27 13:35:18 +00:00
Luca Barbato
e41381454b Add support for Vector Truncate on PowerPC 2017-09-27 13:33:32 +00:00
Luca Barbato
9dd3690017 Add support for Vector Round on PowerPC 2017-09-27 13:33:32 +00:00
Luca Barbato
3740d32446 Add support for Vector Ceiling on PowerPC 2017-09-27 13:33:32 +00:00
Luca Barbato
73dd6aecc4 Add support for Vector Reciprocal Square Root Estimate Float on PowerPC 2017-09-27 13:33:31 +00:00
Luca Barbato
8fb0bcb56f Add support for Vector Reciprocal Estimate Float on PowerPC 2017-09-27 13:33:31 +00:00
Luca Barbato
1206ae2b12 Add support for Vector Log2 Estimate Float on PowerPC 2017-09-27 13:33:31 +00:00
Luca Barbato
f52f1ab7e8 Add support for Vector Floor on PowerPC 2017-09-27 13:33:31 +00:00
Luca Barbato
03a2aea4e9 Add support for Vector 2 Raised to the Exponent Estimate Float on PowerPC 2017-09-27 13:33:27 +00:00
Luca Barbato
f6f828c670 Add support for Vector Multiply Add Float on PowerPC 2017-09-27 13:32:49 +00:00
bors
1fd3a42c62 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
2017-09-27 10:56:23 +00:00
bors
412ac93dce 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.
2017-09-27 08:20:11 +00:00
Keith Yeung
6d4989b821 Add span label to E0384 for MIR borrowck 2017-09-26 22:20:53 -07:00
bors
e53ab9104a Auto merge of #44812 - Mark-Simulacrum:rustdoc-debug, r=alexcrichton
Allow rustdoc to get compiled with debuginfo

Fixes #44810

cc @QuietMisdreavus
r? @alexcrichton
2017-09-27 04:57:34 +00:00
bors
f71b37bc28 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
2017-09-27 01:23:24 +00:00
Nikolai Vazquez
8f167b34b7 Merge remote-tracking branch 'upstream/master' into box-conversions 2017-09-26 21:18:36 -04:00
Nikolai Vazquez
edb2c2d291 Remove uses of mem::transmute in Box methods
Makes use of conversions via Unique.
2017-09-26 21:16:59 -04:00
Mark Simulacrum
33b5ec3d4d Allow rustdoc to get compiled with debuginfo 2017-09-26 17:12:19 -06:00
Zack M. Davis
9f68d62e0c don't let rustdoc get confused by text "fn main" in a line comment
This is in the matter of #21299.
2017-09-26 16:00:54 -07:00
bors
d4da744247 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
2017-09-26 22:26:13 +00:00
Basile Desloges
b683538ef2 mir-borrowck: Edit compile-fail tests with E0506 error to also test on MIR borrowck 2017-09-26 21:56:37 +02:00
Badel2
5102309b1f bump rustfmt 2017-09-26 20:57:13 +02:00
Matthias Devlamynck
838105f09b Use a different error code to avoid conflicts 2017-09-26 20:51:22 +02:00
bors
930d3b17dd 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
2017-09-26 18:29:57 +00:00
Basile Desloges
e28c73d71f mir-borrowck: Add span labels to report_illegal_mutation_of_borrowed() 2017-09-26 19:09:56 +02:00
Basile Desloges
34d36c0168 mir-borrowck: Add borrow data parameter to report_illegal_mutation_of_borrowed() 2017-09-26 19:09:56 +02:00
Niko Matsakis
73543d53cd fix test reference 2017-09-26 11:56:44 -04:00
gaurikholkar
5c59bbadb3 minor fixes 2017-09-26 11:55:53 -04:00
gaurikholkar
4bbb58d429 remove error code description 2017-09-26 11:55:53 -04:00
Niko Matsakis
9e4649ebf8 remove random newlines from error messages, fix compile-fail test
That kind of formatting seems like the job of other code.
2017-09-26 11:55:53 -04:00
Niko Matsakis
d7bb575b06 use present tense consistently and update references 2017-09-26 11:55:53 -04:00
gaurikholkar
bbf82be076 tidy fix 2017-09-26 11:55:52 -04:00
gaurikholkar
aa6f0c8050 modify message for return time having multiple lifetimes 2017-09-26 11:55:52 -04:00
gaurikholkar
e58f528bb0 merge fixes, addressing CR comments 2017-09-26 11:55:52 -04:00
Matthias Devlamynck
3730dfdaf5 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.
2017-09-26 17:48:23 +02:00
Alex Crichton
9e35b797b1 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!
2017-09-26 08:18:03 -07:00
Federico Mena Quintero
4143422981 os_str: Fix too-long lines 2017-09-26 08:59:34 -05:00
bors
1c4510adc8 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.)
2017-09-26 09:19:03 +00:00
kennytm
16c110f78b
Fix issue #44731.
Also excludes `impl Trait` from everybody_loops if it appears in the path.
2017-09-26 16:46:38 +08:00
bors
4b8bf391fd 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
2017-09-26 05:02:03 +00:00
Josh Stone
13724fafdc 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)
2017-09-25 20:53:08 -07:00
Federico Mena Quintero
91f6445b59 Overhaul the documentation for OsString / OsStr 2017-09-25 20:45:38 -05:00
Federico Mena Quintero
155b4b1c5f Module overview for std::os::windows:ffi 2017-09-25 20:45:38 -05:00
Jeffrey Seyfried
375332c6b9 Fix bug in collecting trait and impl items with derives. 2017-09-25 18:21:53 -07:00
Lucas Morales
f7fd04ae65
docs improvement sync::atomic::Atomic* 2017-09-25 19:39:52 -04:00
bors
82ae9682ca 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
2017-09-25 23:09:06 +00:00
bors
6c476ce462 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`.
2017-09-25 20:37:02 +00:00
Esteban Küber
9c3fa4d3ef Point at signature on unused lint 2017-09-25 13:25:54 -07:00
Federico Mena Quintero
3c5e18f322 Point from the error structs back to the method that created them, like in iterators 2017-09-25 13:51:48 -05:00
Federico Mena Quintero
2cb2a0606a Overhaul the ffi::CStr documentation. 2017-09-25 13:51:48 -05:00
Federico Mena Quintero
8da694a421 Overhaul the ffi::CString docs
Explain the struct's reason for being, and its most common usage
patterns.  Add a bunch of links.

Clarify the method docs a bit.

Part of https://github.com/rust-lang/rust/issues/29354
2017-09-25 13:51:48 -05:00
Federico Mena Quintero
5451b722b0 Expand the introduction to the ffi module.
We describe the representation of C strings, and the purpose of
OsString/OsStr.

Part of https://github.com/rust-lang/rust/issues/29354
2017-09-25 13:51:47 -05:00
Simon Sapin
20d4c0fab4 Move src/librustc_mir/transform/nll.rs to a subdirectory 2017-09-25 20:06:03 +02:00
bors
3df1f7b82d 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
2017-09-25 18:05:22 +00:00
steveklabnik
3db0094359 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.
2017-09-25 11:41:39 -04:00
Douglas Campos
9d52cb2f84 those changes break miri, PR will be issued later 2017-09-25 09:51:51 -04:00
Douglas Campos
043d873b32 fix tidy errors 2017-09-25 09:50:37 -04:00
Douglas Campos
119882eaa5 add comment per @nikomatsakis request 2017-09-25 09:50:37 -04:00
Douglas Campos
c900abf42d expose ParamEnv as a param 2017-09-25 09:50:37 -04:00
Douglas Campos
77d3ca1bad add ParamEnv to the trait_cache key 2017-09-25 09:50:37 -04:00
Guillaume Gomez
d5d41f2a3c Add missing links in fmt module 2017-09-25 15:41:16 +02:00
bors
91dbf52af3 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.
2017-09-25 12:52:02 +00:00
Felix S. Klock II
e319f4093c Remove now dead code. 2017-09-25 14:02:39 +02:00
Felix S. Klock II
d9d10c1628 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.
2017-09-25 14:02:34 +02:00
Felix S. Klock II
c4c32b24bd More fine-grained delineation for mir-borrowck errors. 2017-09-25 13:02:17 +02:00
Ariel Ben-Yehuda
7bb0923e46 fix Debug impls 2017-09-25 13:47:19 +03:00
bors
dcb4378e18 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
2017-09-25 09:01:53 +00:00
David Tolnay
247b58b4f4
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.
2017-09-24 23:57:45 -07:00
bjorn3
843cd5bacc Fix error 2017-09-25 08:17:37 +02:00
David Tolnay
874124b2c7
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
2017-09-24 22:27:39 -07:00
bors
cd93969ec4 Auto merge of #44612 - pylaligand:magenta-to-zircon, r=alexcrichton
The Magenta kernel is now called Zircon.
2017-09-25 05:05:14 +00:00
James Tucker
a3aef1aa95 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
2017-09-24 21:32:27 -07:00
bors
7a9cdc4c2a 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
2017-09-25 00:52:15 +00:00
James Tucker
d7a17fb3cf LP_CLONE_FDIO_ROOT is now LP_CLONE_FDIO_NAMESPACE 2017-09-24 14:31:50 -07:00
James Tucker
c481f85dc2 ensure that prebuilt toolchain binaries are +x 2017-09-24 13:55:55 -07:00
Petr Hosek
992e94ab3b Re-add CMake package
This appears to be needed by the Rust build.
2017-09-24 13:55:55 -07:00
Petr Hosek
1fdbfa9930 Use Zircon's Clang rather than building our own
This toolchain is already used to build Zircon itself and is the
official Clang toolchain used by all Fuchsia developers.
2017-09-24 13:55:55 -07:00
James Tucker
0ef87cc109 bump liblibc to 0.2.31 2017-09-24 13:53:11 -07:00
Petr Hosek
850c7cbbf1 Download clang-tools-extra as well 2017-09-24 13:53:10 -07:00
Petr Hosek
6c08208c31 Install unzip into Fuchsia Docker container 2017-09-24 13:53:10 -07:00
P.Y. Laligand
e98e674570 TODO --> FIXME 2017-09-24 13:53:10 -07:00
P.Y. Laligand
d0ff222d0f Update submodules. 2017-09-24 13:53:10 -07:00
Petr Hosek
ae0cf7fd5f Update Fuchsia toolchain build
compiler-rt is now being built as part of the toolchain itself.
2017-09-24 13:53:10 -07:00
P.Y. Laligand
20265ef3ac Updated Zircon version. 2017-09-24 13:53:10 -07:00
P.Y. Laligand
cc4e82fe7a Fixed casing issues. 2017-09-24 13:53:10 -07:00
P.Y. Laligand
de3bb916d8 Testing on Travis. 2017-09-24 13:53:10 -07:00
P.Y. Laligand
43cff131dd The Magenta kernel is now called Zircon. 2017-09-24 13:53:10 -07:00
bors
48c1c548e1 Auto merge of #44758 - arielb1:a-small-path, r=eddyb
put empty generic lists behind a pointer

This reduces the size of hir::Expr from 128 to 88 bytes (!) and shaves
200MB out of #36799.

This is a performance-sensitive PR so please don't roll it up.

r? @eddyb
2017-09-24 19:48:11 +00:00
Esteban Küber
ddee9fbc99 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
   |     ^^^^^^^^^^^^^^^
```
2017-09-24 11:50:09 -07:00
Thomas Jespersen
4963394f86 Change Levensthein-based method to a single suggestion
The convention for suggesting close matches is to provide at most one match (the
closest one). Change the suggestions for misspelt method names to obey that.
2017-09-24 20:00:02 +02:00
Steven Fackler
81bac74c2d Add a run-pass-valgrind test for vecdeque issue 2017-09-24 10:56:08 -07:00
Ethan Dagner
bc43e17392 Add doc example to HashMap::hasher 2017-09-24 10:29:37 -06:00
bors
1ed7d41d88 Auto merge of #44743 - arielb1:size-rollback, r=eddyb
typeck::check::coercion - roll back failed unsizing type vars

This wraps unsizing coercions within an additional level of
`commit_if_ok`, which rolls back type variables if the unsizing coercion
fails. This prevents a large amount of type-variables from accumulating
while type-checking a large function, e.g. shaving 2GB off one of the
4GB peaks in #36799.

This is a performance-sensitive PR so please don't roll it up.

r? @eddyb
cc @nikomatsakis
2017-09-24 15:41:13 +00:00
Ariel Ben-Yehuda
c10b23e2e0 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).
2017-09-24 17:21:37 +03:00
Ariel Ben-Yehuda
8214ab1662 move Scope behind an enum 2017-09-24 16:13:54 +03:00
Guillaume Gomez
a8a0ec2a28 Rollup merge of #44795 - KiChjang:mir-err-notes, r=arielb1
MIR borrowck: Add span labels for E0381 and E0505

Corresponds to `report_use_of_moved` and `report_move_out_when_borrowed`.

Part of #44596.
2017-09-24 14:01:52 +02:00
Guillaume Gomez
4e377081ca Rollup merge of #44789 - GuillaumeGomez:fix-rustdoc-display, r=QuietMisdreavus
Fix warning position in rustdoc code blocks

Before:

<img width="1440" alt="screen shot 2017-09-23 at 14 07 08" src="https://user-images.githubusercontent.com/3050060/30773382-b9649288-a06f-11e7-94ec-faa3c3ed999b.png">

After:

<img width="1440" alt="screen shot 2017-09-23 at 14 58 31" src="https://user-images.githubusercontent.com/3050060/30773384-bdfc9f3e-a06f-11e7-9030-9fb8a5308668.png">

r? @QuietMisdreavus
2017-09-24 14:01:51 +02:00
Guillaume Gomez
b1a1861d60 Rollup merge of #44625 - frewsxcv:frewsxcv-raii-stdin, r=QuietMisdreavus
Indicate how ChildStd{in,out,err} FDs are closed.

Fixes https://github.com/rust-lang/rust/issues/41452.
2017-09-24 14:01:50 +02:00
Guillaume Gomez
8a25ec019e Rollup merge of #44103 - zackmdavis:cmp_op_must_use, r=arielb1
add comparison operators to must-use lint (under `fn_must_use` feature)

Although RFC 1940 is about annotating functions with `#[must_use]`, a
key part of the motivation was linting unused equality operators.

(See
https://github.com/rust-lang/rfcs/pull/1812#issuecomment-265695898—it
seems to have not been clear to discussants at the time that marking the
comparison methods as `must_use` would not give us the lints on
comparison operators, at least in (what the present author understood
as) the most straightforward implementation, as landed in #43728
(3645b062).)

To rectify the situation, we here lint unused comparison operators as
part of the unused-must-use lint (feature gated by the `fn_must_use`
feature flag, which now arguably becomes a slight (tolerable in the
opinion of the present author) misnomer).

This is in the matter of #43302.

cc @crumblingstatue
2017-09-24 14:01:49 +02:00
Ariel Ben-Yehuda
b6bce56ac7 sort the list of inference errors by span
this should produce more error stability
2017-09-24 13:45:19 +03:00
Ariel Ben-Yehuda
516534ffdf fix test 2017-09-24 13:15:18 +03:00
Ariel Ben-Yehuda
b408144dbe remove test code accidentally checked in 2017-09-24 12:46:00 +03:00
Ariel Ben-Yehuda
9c4898eadd address review comments 2017-09-24 12:46:00 +03:00
Ariel Ben-Yehuda
c72a979979 move unsafety checking to MIR
No functional changes intended.
2017-09-24 12:46:00 +03:00
Ariel Ben-Yehuda
8c7500f9b6 add lint levels to VisibilityScope 2017-09-24 12:46:00 +03:00
Ariel Ben-Yehuda
9d6b9d62ba typeck::check::coercion - roll back failed unsizing type vars
This wraps unsizing coercions within an additional level of
`commit_if_ok`, which rolls back type variables if the unsizing coercion
fails. This prevents a large amount of type-variables from accumulating
while type-checking a large function, e.g. shaving 2GB off one of the
4GB peaks in #36799.
2017-09-24 12:40:29 +03:00
Ariel Ben-Yehuda
e921b32be3 put empty generic lists behind a pointer
This reduces the size of hir::Expr from 128 to 88 bytes (!) and shaves
200MB out of #36799.
2017-09-24 12:34:21 +03:00
bors
6f9078745e Auto merge of #44786 - thombles:tk/i41314, r=petrochenkov
Improve diagnostics when attempting to match tuple enum variant with struct pattern

Adds an extra note as below to explain that a tuple pattern was probably intended.

```
error[E0026]: variant `X::Y` does not have a field named `data`
  --> src/main.rs:18:16
   |
18 |         X::Y { data } => println!("The data is {}", data)
   |                ^^^^ variant `X::Y` does not have field `data`

error[E0027]: pattern does not mention field `0`
  --> src/main.rs:18:9
   |
18 |         X::Y { data } => println!("The data is {}", data)
   |         ^^^^^^^^^^^^^ missing field `0`
   |
   = note: trying to match a tuple variant with a struct variant pattern
```

Fixes #41314.
2017-09-24 09:02:19 +00:00
Keith Yeung
ed59a868dd Add span labels for E0505 for MIR borrowck 2017-09-23 23:44:51 -07:00
Steven Fackler
9733463d2b 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
2017-09-23 21:19:01 -07:00
bors
acb73dbe8b Auto merge of #44772 - michaelwoerister:new-graph, r=nikomatsakis
incr.comp.: Add new DepGraph implementation.

This commits does a few things:
1. It adds the new dep-graph implementation -- *in addition* to the old one. This way we can start testing the new implementation without switching all tests at once.
2. It persists the new dep-graph (which includes query result fingerprints) to the incr. comp. caching directory and also loads this data.
3. It removes support for loading fingerprints of metadata imported from other crates (except for when running autotests). This is not needed anymore with red/green. It could provide a performance advantage but that's yet to be determined. For now, as red/green is not fully implemented yet, the cross-crate incremental tests are disabled.

Note, this PR is based on top of soon-to-be-merged #44696 and only the last 4 commits are new:
```
- incr.comp.: Initial implemenation of append-only dep-graph. (c90147c)
- incr.comp.: Do some various cleanup. (8ce20c5)
- incr.comp.: Serialize and deserialize new DepGraph. (0e13c1a)
- incr.comp.: Remove support for loading metadata fingerprints. (270a134)
EDIT 2:
- incr.comp.: Make #[rustc_dirty/clean] test for fingerprint equality ... (d8f7ff9)
```
(EDIT: GH displays the commits in the wrong order for some reason)

Also note that this PR is expected to certainly result in performance regressions in the incr. comp. test cases, since we are adding quite a few things (a whole additional dep-graph, for example) without removing anything. End-to-end performance measurements will only make sense again after red/green is enabled and all the legacy tracking has been turned off.

EDIT 2: Pushed another commit that makes the `#[rustc_dirty]`/`#[rustc_clean]` based autotests compared query result fingerprints instead of testing `DepNode` existence.
2017-09-24 03:55:23 +00:00
Jimmy Cuadra
ba74a8665d Add back mistakenly removed numeric conversions. 2017-09-23 17:29:48 -07:00
Jimmy Cuadra
4d2a8c5278 Simplify implementation of Display and Error for convert::Infallible. 2017-09-23 17:27:02 -07:00
Lucas Morales
99c0c520af
docs improvement std::sync::{PoisonError, TryLockError} 2017-09-23 18:28:08 -04:00
bors
24831c7221 Auto merge of #44436 - MicroJoe:master, r=alexcrichton
Add Duration::from_micros

This fixes #44400 that explains why it could be useful for embedded designs timing.
2017-09-23 22:21:32 +00:00
Ben Cressey
f94bd36fd1 add aarch64-unknown-linux-musl target
Signed-off-by: Ben Cressey <bcressey@amazon.com>
Signed-off-by: Tom Kirchner <tjk@amazon.com>
2017-09-23 14:46:33 -07:00
Clar Charr
1c589b7a51 TrustedRandomAccess specialisation for Cloned.
This verifies that TrustedRandomAccess has no side effects when the
iterator item implements Copy. This also implements TrustedLen and
TrustedRandomAccess for str::Bytes.
2017-09-23 15:30:53 -04:00
bors
26015da014 Auto merge of #44765 - tamird:libc-shim, r=alexcrichton
Trim and document libc shim

(hopefully) easy part of #44515.

r? @alexcrichton
2017-09-23 19:16:11 +00:00
toidiu
15fa85c195 extract explicit_predicates_of 2017-09-23 14:55:40 -04:00
Michael Woerister
89aec1eb0b incr.comp.: Remove out-dated unit test and unnecessary assertion. 2017-09-23 19:49:05 +02:00
Michael Woerister
45a03f153f incr.comp.: Make #[rustc_dirty/clean] test for fingerprint equality instead of DepNode existence. 2017-09-23 19:47:46 +02:00
Michael Woerister
2a50d127dd incr.comp.: Remove support for loading metadata fingerprints. 2017-09-23 19:47:37 +02:00
Michael Woerister
5974ec745e incr.comp.: Serialize and deserialize new DepGraph 2017-09-23 19:47:28 +02:00
Michael Woerister
a7428da415 incr.comp.: Do some various cleanup. 2017-09-23 19:47:20 +02:00
Michael Woerister
fecd92a7fe incr.comp.: Initial implemenation of append-only dep-graph. 2017-09-23 19:47:12 +02:00
Zack M. Davis
6734d39b49 update fn_must_use UI test to exercise nonprimitive comparisons 2017-09-23 10:11:39 -07:00
bjorn3
3c32c6aa8d Fix some tests with no llvm build 2017-09-23 18:15:58 +02:00
bjorn3
56c46707ed Fix error 2017-09-23 18:07:53 +02:00
bjorn3
18005203e1 Remove now unused dependency on flate2 from rustc_driver 2017-09-23 15:27:54 +02:00
bjorn3
95fb1d008f Remove leftover 2017-09-23 15:26:34 +02:00
bjorn3
70e5baeb71 Fix tidy errors 2017-09-23 15:23:40 +02:00
bors
a83c3e7771 Auto merge of #43870 - GuillaumeGomez:deref-suggestion, r=nikomatsakis
Add deref suggestion

Fixes #34562.
2017-09-23 13:13:15 +00:00
bjorn3
793c02db7f Remove build_diagnostic_array hack 2017-09-23 15:10:00 +02:00
bjorn3
43bfd4cd54 Fix some nits 2017-09-23 15:00:49 +02:00
bjorn3
e130ccc54e Fix for upstream changes 2017-09-23 14:46:15 +02:00
Guillaume Gomez
e30abfbfe7 Fix warning position in rustdoc code blocks 2017-09-23 14:06:35 +02:00
Niko Matsakis
21d4ba2ea6 add some comments 2017-09-23 13:16:21 +02:00
bjorn3
d703552325 Merge rustc_trans_trait into rustc_trans_utils 2017-09-23 13:00:28 +02:00
bjorn3
9eeaba18bd Move NoLlvmMetadataLoader to rustc_trans_traits 2017-09-23 13:00:25 +02:00
bjorn3
44c184382f Add TransCrate trait 2017-09-23 12:59:46 +02:00
bjorn3
89af6d5c8b [WIP] Less hacky way of supporting dylibs 2017-09-23 12:58:19 +02:00
bjorn3
d935a8d6af Fix rustc_trans_utils::find_exported_symbols
Fix denied warnings
2017-09-23 12:57:42 +02:00
bors
7f8aef94cd Auto merge of #44747 - Zoxc:gen-switch-unreachable, r=eddyb
Make the fallback of generator resumption be unreachable instead of using return
2017-09-23 10:56:14 +00:00
bjorn3
2c03c57bf5 Dont do no-trans for llvm enabled builds 2017-09-23 12:55:34 +02:00
bjorn3
d44a256157 Allow building stage 2 compiler libraries 2017-09-23 12:55:32 +02:00
bjorn3
cba53f0be5 Allow writing metadata without llvm 2017-09-23 12:54:53 +02:00
Thomas Karpiniec
def660cad5 UI unit test for note when matching tuple enum with struct pattern 2017-09-23 20:49:28 +10:00
Keith Yeung
1797a942b7 Add span label to E0381 for MIR borrowck 2017-09-23 03:11:05 -07:00
bors
a6a7dac5cf Auto merge of #44633 - petrochenkov:priv2, r=nikomatsakis
Record semantic types for all syntactic types in bodies

... and use recorded types in type privacy checking (types are recorded after inference, so there are no `_`s left).
Also use `hir_ty_to_ty` for types in signatures in type privacy checking.

This could also be potentially useful for save-analysis and diagnostics.

Fixes https://github.com/rust-lang/rust/pull/42125#issuecomment-305987755
r? @eddyb
2017-09-23 07:30:03 +00:00
Thomas Karpiniec
8a66362430 Diagnostic note when matching tuple enum with struct pattern 2017-09-23 16:04:03 +10:00
bors
85a5d3ffa4 Auto merge of #44784 - frewsxcv:rollup, r=frewsxcv
Rollup of 14 pull requests

- Successful merges: #44554, #44648, #44658, #44712, #44717, #44726, #44745, #44746, #44749, #44759, #44770, #44773, #44776, #44778
- Failed merges:
2017-09-23 05:10:53 +00:00
Corey Farwell
2aa42ef233 Rollup merge of #44778 - lucasem:master, r=estebank
std::sync::RwLock docs improvement

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

Added examples, links to types, and a small comparison between RwLock and Mutex.
2017-09-23 00:29:23 -04:00
Corey Farwell
e168896fdd Rollup merge of #44773 - GuillaumeGomez:arc-docs, r=@QuietMisdreavus
Add missing links for Arc

r? @rust-lang/docs
2017-09-23 00:29:21 -04:00
Corey Farwell
21c0dfce97 Rollup merge of #44770 - dtolnay:borrowed, r=sfackler
Less confusing placeholder when RefCell is exclusively borrowed

Based on ExpHP's comment in [*RefCell.borrow_mut get strange result*](https://users.rust-lang.org/t/refcell-borrow-mut-get-strange-result/12994):

> it would perhaps be nicer if it didn't put something that could be misinterpreted as a valid string value

The previous Debug implementation would show:

    RefCell { value: "<borrowed>" }

The new one is:

    RefCell { value: <borrowed> }
2017-09-23 00:29:20 -04:00
Corey Farwell
8915683c54 Rollup merge of #44759 - durka:patch-43, r=steveklabnik
improve english in create_dir_all docs

Just minor nitpicking.
2017-09-23 00:29:19 -04:00
Corey Farwell
ec5342ba87 Rollup merge of #44749 - zilbuz:issue-44596/E0503, r=pnkfelix
MIR-borrowck: Adding notes to E0503

This PR adds notes to the MIR borrowck error E0503.

Part of #44596
2017-09-23 00:29:18 -04:00
Corey Farwell
e103ecd097 Rollup merge of #44746 - topecongiro:span-for-unary, r=petrochenkov
Include unary operator to span for ExprKind::Unary
2017-09-23 00:29:17 -04:00
Corey Farwell
a1637b7570 Rollup merge of #44745 - alexcrichton:no-delim-none, r=estebank
rustc: Don't use DelimToken::None if possible

This commit fixes a regression from #44601 where lowering attribute to HIR now
involves expanding interpolated tokens to their actual tokens. In that commit
all interpolated tokens were surrounded with a `DelimToken::None` group of
tokens, but this ended up causing regressions like #44730 where the various
attribute parsers in `syntax/attr.rs` weren't ready to cope with
`DelimToken::None`. Instead of fixing the parser in `attr.rs` this commit
instead opts to just avoid the `DelimToken::None` in the first place, ensuring
that the token stream should look the same as it did before where possible.

Closes #44730
2017-09-23 00:29:16 -04:00
Corey Farwell
0249406458 Rollup merge of #44726 - mattico:patch-3, r=eddyb
Fix librustc/README.md diagram
2017-09-23 00:29:15 -04:00
Corey Farwell
75b82680dc Rollup merge of #44717 - pnkfelix:debugflags-borrowckmir-implies-emitendregions, r=arielb1
Make `-Z borrowck-mir` imply that `EndRegion`'s should be emitted.

Before this change, the `-Z borrowck-mir` flag is useless if you do not also pass `-Z emit-end-regions`.

So, in the same spirit as f2892ad281, make `-Z borrowck-mir` also emit `EndRegion` statements. (This will hopefully avoid some initial speed bumps for new-comers helping out with NLL.)
2017-09-23 00:29:14 -04:00
Corey Farwell
075e16b261 Rollup merge of #44712 - oconnor663:copy_test, r=GuillaumeGomez
fix an incorrect assertion in the doc example for `std::io::copy`

I think this wasn't caught by CI because the `foo` wrapper function was only defined and not called. This seems to be the norm for doc examples that define a `foo` function. Is that on purpose?
2017-09-23 00:29:13 -04:00
Corey Farwell
bdbe6e2b35 Rollup merge of #44658 - leodasvacas:remove-str-eq-lang-item, r=arielb1
Remove str_eq lang item

It's not really a lang item. Also remove outdated note. The reference uses this as an example so it has to be updated.
2017-09-23 00:29:11 -04:00
Corey Farwell
04eb88c987 Rollup merge of #44648 - Havvy:doc-size_of, r=dtolnay
Expand size_of docs

This PR does 3 things.

1. Adds a description of what pointer size means to the primitive pages for usize and isize.
2. Says the general size of things is not stable from compiler to compiler.
3. Adds a table of sizes of things that we do guarantee. As this is the first table in the libstd docs, I've included a picture of how that looks.

![](https://i.imgur.com/YZ6IChH.png?1)
2017-09-23 00:29:10 -04:00
Corey Farwell
7d75781cc2 Rollup merge of #44554 - GuillaumeGomez:add-missing-pub, r=QuietMisdreavus
Add pub visibility for methods as well

Fixes #44527.

r? @QuietMisdreavus
2017-09-23 00:29:09 -04:00
bors
9ad67e9fc3 Auto merge of #44055 - zackmdavis:condensed_non-ADT_derive_error, r=jseyfried
only set non-ADT derive error once per attribute, not per trait

I found the expansion code very hard to follow, leaving me unsure as to whether this might somehow be done better, but this patch does give us the behavior requested in #43927 (up to exact choice of span; here, it's the entire attribute, not just the `derive` token).

(Note to GitHub robots: _resolves #43927_.)

r? @jseyfried
2017-09-23 02:55:52 +00:00
Lucas Morales
f283875a78
std::sync::RwLock docs improvement 2017-09-22 22:12:21 -04:00
Wonwoo Choi
1bfbfb20a1 Print fn signature when there is closure argument type mismatch
Fixes #42143.
E0281 is totally replaced by E0631. UI tests are updated accordingly.
2017-09-23 10:15:30 +09:00
Zack M. Davis
8917616e6a add comparison operators to must-use lint (under fn_must_use feature)
Although RFC 1940 is about annotating functions with `#[must_use]`, a
key part of the motivation was linting unused equality operators.

(See
https://github.com/rust-lang/rfcs/pull/1812#issuecomment-265695898—it
seems to have not been clear to discussants at the time that marking the
comparison methods as `must_use` would not give us the lints on
comparison operators, at least in (what the present author understood
as) the most straightforward implementation, as landed in #43728
(3645b062).)

To rectify the situation, we here lint unused comparison operators as
part of the unused-must-use lint (feature gated by the `fn_must_use`
feature flag, which now arguably becomes a slight (tolerable in the
opinion of the present author) misnomer).

This is in the matter of #43302.
2017-09-22 15:45:47 -07:00
bors
01b1d15900 Auto merge of #44720 - est31:master, r=alexcrichton
Use SHA512 for signatures

Fixes #44714 . Untested but I hope it works... r? @alexcrichton
2017-09-22 22:24:23 +00:00
Vadim Petrochenkov
419069d984 Use recorded types in rustc_privacy 2017-09-23 00:50:46 +03:00
Vadim Petrochenkov
505ff71ac1 Record semantic types for all syntactic types in bodies 2017-09-23 00:48:02 +03:00
Vadim Petrochenkov
5b9b50e712 Give HirId to hir::Ty 2017-09-23 00:48:02 +03:00
Vadim Petrochenkov
52251cd930 Compress "small" spans to 32 bits and intern "large" spans 2017-09-23 00:34:13 +03:00
Badel2
54c4a83084 dotdoteq_in_patterns feature gate 2017-09-22 22:05:46 +02:00
Badel2
7aabf57278 Add information about the syntax used in ranges
... or ..=
2017-09-22 22:05:18 +02:00
Badel2
4737c5a068 Substitute ... with the expanded form
RangeInclusive { start, end }, this way we supress the warnings about `...` in expressions being deprecated until `..=` is available in the compiler
2017-09-22 22:05:18 +02:00
Alex Burka
e64efc91f4 Add support for ..= syntax
Add ..= to the parser

Add ..= to libproc_macro

Add ..= to ICH

Highlight ..= in rustdoc

Update impl Debug for RangeInclusive to ..=

Replace `...` to `..=` in range docs

Make the dotdoteq warning point to the ...

Add warning for ... in expressions

Updated more tests to the ..= syntax

Updated even more tests to the ..= syntax

Updated the inclusive_range entry in unstable book
2017-09-22 22:05:18 +02:00
bors
14039a42ac Auto merge of #44696 - michaelwoerister:fingerprints-in-dep-graph-3, r=nikomatsakis
incr.comp.: Move task result fingerprinting into DepGraph.

This PR
- makes the DepGraph store all `Fingerprints` of task results,
- allows `DepNode` to be marked as input nodes,
- makes HIR node hashing use the regular fingerprinting infrastructure,
- removes the now unused `IncrementalHashesMap`, and
- makes sure that `traits_in_scope_map` fingerprints are stable.

r? @nikomatsakis
cc @alexcrichton
2017-09-22 17:24:29 +00:00
bors
3eb19bf9b1 Auto merge of #44691 - cramertj:underscore-lifetimes, r=nikomatsakis
Implement underscore lifetimes

Part of https://github.com/rust-lang/rust/issues/44524
2017-09-22 14:05:16 +00:00
Guillaume Gomez
b472b2829b Add missing links for Arc 2017-09-22 15:45:37 +02:00
bors
ee409a489e Auto merge of #44624 - tmerr:master, r=sfackler
Retain suid/sgid/sticky bits in Metadata.permissions

Most users would expect set_permissions(Metadata.permissions()) to be
non-destructive. While we can't guarantee this, we can at least pass
the needed info to chmod.

Also update the PermissionsExt documentation to disambiguate what it
contains, and to refer to the underlying value as `st_mode` rather than
its type `mode_t`.

Closes #44147
2017-09-22 10:30:20 +00:00
bors
0962b8fe4f Auto merge of #44754 - marcusbuffett:bootstrap-config-toml-fix, r=alexcrichton
Catch IOError in bootstrap.py when loading config.toml

When I pulled this repo and tried to build using the command in the readme, I got an error about a missing `config.toml`.

If config.toml doesn't exist, then an `IOError` will be raised the `with open(...)` line. Prior to e788fa7b6c, this was caught because the `except` clause didn't specify what exceptions it caught, so both `IOError` and `OSError` were caught.

First time contributing, so please let me know if I'm doing anything wrong.
2017-09-22 05:01:41 +00:00
David Tolnay
f9d92d219d
Less confusing placeholder when RefCell is exclusively borrowed
Based on ExpHP's comment in
https://users.rust-lang.org/t/refcell-borrow-mut-get-strange-result/12994

> it would perhaps be nicer if it didn't put something that could be
> misinterpreted as a valid string value

The previous Debug implementation would show:

    RefCell { value: "<borrowed>" }

The new one is:

    RefCell { value: <borrowed> }
2017-09-21 21:53:04 -07:00
Zack M. Davis
083f053294 suggest an outer attribute when #![derive(...)] (predictably) fails 2017-09-21 21:20:31 -07:00
Zack M. Davis
35176867f6 only set non-ADT derive error once per attribute, not per trait
A slight eccentricity of this change is that now non-ADT-derive errors prevent
derive-macro-not-found errors from surfacing (see changes to the
gating-of-derive compile-fail tests).

Resolves #43927.
2017-09-21 21:20:23 -07:00
Jimmy Cuadra
79f2439aa6 Impl fmt::Display for convert::Infallible. 2017-09-21 21:09:03 -07:00
Jimmy Cuadra
9562981b0b impl std::error::Error for convert::Infallible. 2017-09-21 20:21:54 -07:00
Tamir Duberstein
5c82a5434b
Trim and document libc shim 2017-09-21 22:25:02 -04:00
Corey Farwell
859ebef62f Add note about being blocked on input. 2017-09-21 21:11:11 -04:00
Corey Farwell
5ee7db6a0e Remove platform-specific terminology. 2017-09-21 21:01:51 -04:00
bors
17600c1ea7 Auto merge of #44682 - bluss:iter-rfold, r=dtolnay
Add iterator method .rfold(init, function); the reverse of fold

rfold is the reverse version of fold.

Fold allows iterators to implement a different (non-resumable) internal
iteration when it is more efficient than the external iteration implemented
through the next method. (Common examples are VecDeque and .chain()).

Introduce rfold() so that the same customization is available for reverse
iteration. This is achieved by both adding the method, and by having the
Rev\<I> adaptor connect Rev::rfold → I::fold and Rev::fold → I::rfold.

On the surface, rfold(..) is just .rev().fold(..), but the special case
implementations allow a data structure specific fold to be used through for
example .iter().rev(); we thus have gains even for users never calling exactly
rfold themselves.
2017-09-21 23:44:11 +00:00
Guillaume Gomez
c30435be5b Add deref suggestion 2017-09-21 23:30:00 +02:00
Alex Burka
cf2bad8d4b improve english in create_dir_all docs 2017-09-21 16:31:39 -04:00
bors
17f56c549c Auto merge of #44215 - oli-obk:import_sugg, r=nrc
don't suggest placing `use` statements into expanded code

r? @nrc

fixes #44210

```rust
#[derive(Debug)]
struct Foo;

type X = Path;
```

will try to place `use std::path::Path;` between `#[derive(Debug)]` and `struct Foo;`

I am not sure how to obtain a span before the first attribute, because derive attributes are removed during expansion.

It would be trivial to detect this case and place the `use` after the item, but that would be somewhat weird I think.
2017-09-21 20:12:22 +00:00
Eh2406
2adeba6207 update xsv to head 2017-09-21 15:53:33 -04:00
Eh2406
cfc711e062 fix version number 2017-09-21 15:46:17 -04:00
Marcus Buffett
5463aa06b8 Catch IOError
If config.toml doesn't exist, then an IOError will be raised
on the `with open(...)` line. Prior to e788fa7, this was
caught because the `except` clause didn't specify what
exceptions it caught, so both IOError and OSError were
caught
2017-09-21 12:15:10 -07:00
John Kåre Alsaker
f5affb5951 Make the fallback of generator resumption be unreachable instead of using return 2017-09-21 19:31:26 +02:00
Taylor Cramer
f5505d185c Add tests for underscore lifetimes in impl headers and struct definitions 2017-09-21 10:19:12 -07:00
Taylor Cramer
06926b6298 Add tests for multiple underscore and non-underscore lifetimes 2017-09-21 10:19:12 -07:00
Taylor Cramer
f64af7a32e Refactor lifetime name into an enum 2017-09-21 10:19:03 -07:00