Commit Graph

68693 Commits

Author SHA1 Message Date
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
Garrett Berg
daf3ed5651 Add links to headers in README and CONTRIBUTING and dependencies to CONTRIBUTING 2017-09-29 17:44:55 -06: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