]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoRollup merge of #49223 - GuillaumeGomez:propose-variant-for-E0599, r=cramertj
kennytm [Tue, 27 Mar 2018 08:47:46 +0000 (10:47 +0200)]
Rollup merge of #49223 - GuillaumeGomez:propose-variant-for-E0599, r=cramertj

Propose a variant if it is an enum for E0599

Fixes #49192.

6 years agoRollup merge of #48639 - varkor:sort_by_key-cached, r=bluss
kennytm [Tue, 27 Mar 2018 08:47:44 +0000 (10:47 +0200)]
Rollup merge of #48639 - varkor:sort_by_key-cached, r=bluss

Add slice::sort_by_cached_key as a memoised sort_by_key

At present, `slice::sort_by_key` calls its key function twice for each comparison that is made. When the key function is expensive (which can often be the case when `sort_by_key` is chosen over `sort_by`), this can lead to very suboptimal behaviour.

To address this, I've introduced a new slice method, `sort_by_cached_key`, which has identical semantic behaviour to `sort_by_key`, except that it guarantees the key function will only be called once per element.

Where there are `n` elements and the key function is `O(m)`:
- `slice::sort_by_cached_key` time complexity is `O(m n log m n)`, compared to `slice::sort_by_key`'s `O(m n + n log n)`.
- `slice::sort_by_cached_key` space complexity remains at `O(n + m)`. (Technically, it now reserves a slice of size `n`, whereas before it reserved a slice of size `n/2`.)

`slice::sort_unstable_by_key` has not been given an analogue, as it is important that unstable sorts are in-place, which is not a property that is guaranteed here. However, this also means that `slice::sort_unstable_by_key` is likely to be slower than `slice::sort_by_cached_key` when the key function does not have negligible complexity. We might want to explore this trade-off further in the future.

Benchmarks (for a vector of 100 `i32`s):
```
# Lexicographic: `|x| x.to_string()`
test bench_sort_by_key ... bench:      112,638 ns/iter (+/- 19,563)
test bench_sort_by_cached_key ... bench:       15,038 ns/iter (+/- 4,814)

# Identity: `|x| *x`
test bench_sort_by_key ... bench:        1,346 ns/iter (+/- 238)
test bench_sort_by_cached_key ... bench:        1,839 ns/iter (+/- 765)

# Power: `|x| x.pow(31)`
test bench_sort_by_key ... bench:        3,624 ns/iter (+/- 738)
test bench_sort_by_cached_key ... bench:        1,997 ns/iter (+/- 311)

# Abs: `|x| x.abs()`
test bench_sort_by_key ... bench:        1,546 ns/iter (+/- 174)
test bench_sort_by_cached_key ... bench:        1,668 ns/iter (+/- 790)
```
(So it seems functions that are single operations do perform slightly worse with this method, but for pretty much any more complex key, you're better off with this optimisation.)

I've definitely found myself using expensive keys in the past and wishing this optimisation was made (e.g. for https://github.com/rust-lang/rust/pull/47415). This feels like both desirable and expected behaviour, at the small cost of slightly more stack allocation and minute degradation in performance for extremely trivial keys.

Resolves #34447.

6 years agoAuto merge of #49249 - gnzlbg:simd_minmax, r=alexcrichton
bors [Tue, 27 Mar 2018 04:46:32 +0000 (04:46 +0000)]
Auto merge of #49249 - gnzlbg:simd_minmax, r=alexcrichton

implement minmax intrinsics

This adds the `simd_{fmin,fmax}` intrinsics, which do a vertical (lane-wise) `min`/`max` for floating point vectors that's equivalent to Rust's `min`/`max` for `f32`/`f64`.

It might make sense to make `{f32,f64}::{min,max}` use the `minnum` and `minmax` intrinsics as well.

---

~~HELP: I need some help with these. Either I should go to sleep or there must be something that I must be missing. AFAICT I am calling the `maxnum` builder correctly, yet rustc/LLVM seem to insert a call to `llvm.minnum` there instead...~~ EDIT: Rust's LLVM version is too old :/

6 years agoRemove mentions of unstable sort_by_cached key from stable documentation
varkor [Mon, 26 Mar 2018 21:24:03 +0000 (22:24 +0100)]
Remove mentions of unstable sort_by_cached key from stable documentation

6 years agoAuto merge of #49053 - alexcrichton:fail-if-build-cargo-twice, r=Mark-Simulacrum
bors [Mon, 26 Mar 2018 21:21:33 +0000 (21:21 +0000)]
Auto merge of #49053 - alexcrichton:fail-if-build-cargo-twice, r=Mark-Simulacrum

rustbuild: Fail the build if we build Cargo twice

This commit updates the `ToolBuild` step to stream Cargo's JSON messages, parse
them, and record all libraries built. If we build anything twice (aka Cargo)
it'll most likely happen due to dependencies being recompiled which is caught by
this check.

6 years agorustbuild: Fail the build if we build Cargo twice
Alex Crichton [Thu, 15 Mar 2018 17:58:02 +0000 (10:58 -0700)]
rustbuild: Fail the build if we build Cargo twice

This commit updates the `ToolBuild` step to stream Cargo's JSON messages, parse
them, and record all libraries built. If we build anything twice (aka Cargo)
it'll most likely happen due to dependencies being recompiled which is caught by
this check.

6 years agoAuto merge of #49101 - mark-i-m:stabilize_i128, r=nagisa
bors [Mon, 26 Mar 2018 18:41:38 +0000 (18:41 +0000)]
Auto merge of #49101 - mark-i-m:stabilize_i128, r=nagisa

Stabilize 128-bit integers :tada:

cc #35118

EDIT: This should be merged only after the following have been merged:
- [x] https://github.com/rust-lang-nursery/compiler-builtins/pull/236
- [x] https://github.com/rust-lang/book/pull/1230

6 years agoAuto merge of #49379 - TimNN:rollup, r=TimNN
bors [Mon, 26 Mar 2018 15:48:06 +0000 (15:48 +0000)]
Auto merge of #49379 - TimNN:rollup, r=TimNN

Rollup of 7 pull requests

- Successful merges: #48693, #48932, #49103, #49170, #49187, #49346, #49353
- Failed merges:

6 years agofix last two tidy
Mark Mansi [Sat, 24 Mar 2018 23:19:33 +0000 (18:19 -0500)]
fix last two tidy

6 years agodid i get it right now?
Mark Mansi [Wed, 21 Mar 2018 01:56:53 +0000 (20:56 -0500)]
did i get it right now?

6 years agoUpdate to master of libcompiler_builtins
Mark Mansi [Tue, 20 Mar 2018 15:14:06 +0000 (10:14 -0500)]
Update to master of libcompiler_builtins

6 years agoRemove library feature test
Mark Mansi [Sun, 18 Mar 2018 02:19:36 +0000 (21:19 -0500)]
Remove library feature test

6 years agoFix e0658 ui test
Mark Mansi [Sun, 18 Mar 2018 02:08:32 +0000 (21:08 -0500)]
Fix e0658 ui test

6 years agoupdate test
Mark Mansi [Sun, 18 Mar 2018 01:39:19 +0000 (20:39 -0500)]
update test

6 years agoFix a few more unstables that I missed
Mark Mansi [Sun, 18 Mar 2018 01:10:18 +0000 (20:10 -0500)]
Fix a few more unstables that I missed

6 years agoFix a few more
Mark Mansi [Sat, 17 Mar 2018 16:55:44 +0000 (11:55 -0500)]
Fix a few more

6 years agoFix missed i128 feature gates
Mark Mansi [Sat, 17 Mar 2018 16:46:31 +0000 (11:46 -0500)]
Fix missed i128 feature gates

6 years agoremove unneeded import
Mark Mansi [Sat, 17 Mar 2018 01:38:59 +0000 (20:38 -0500)]
remove unneeded import

6 years agoRename unstable book correctly
Mark Mansi [Sat, 17 Mar 2018 01:21:35 +0000 (20:21 -0500)]
Rename unstable book correctly

6 years agoRename unstable-book chapter
Mark Mansi [Sat, 17 Mar 2018 01:20:06 +0000 (20:20 -0500)]
Rename unstable-book chapter

6 years agoStabilize i128 feature too
Mark Mansi [Sat, 17 Mar 2018 01:15:56 +0000 (20:15 -0500)]
Stabilize i128 feature too

6 years agoUpdate nightly book
Mark Mansi [Sat, 17 Mar 2018 00:54:20 +0000 (19:54 -0500)]
Update nightly book

6 years agoStabilize i128_type
Mark Mansi [Sat, 17 Mar 2018 00:51:49 +0000 (19:51 -0500)]
Stabilize i128_type

6 years agoRollup merge of #49353 - chisophugis:patch-1, r=Mark-Simulacrum
Tim Neumann [Mon, 26 Mar 2018 13:15:01 +0000 (15:15 +0200)]
Rollup merge of #49353 - chisophugis:patch-1, r=Mark-Simulacrum

Fix confusing doc for `scan`

The comment "the value passed on to the next iteration" confused me since it sounded more like what Haskell's [scanl](http://hackage.haskell.org/package/base-4.11.0.0/docs/Prelude.html#v:scanl) does where the closure's return value serves as both the "yielded value" *and* the new value of the "state".

I tried changing the example to make it clear that the closure's return value is decoupled from the state argument.

6 years agoRollup merge of #49346 - Diggsey:hashmap-get-pair, r=Mark-Simulacrum
Tim Neumann [Mon, 26 Mar 2018 13:14:59 +0000 (15:14 +0200)]
Rollup merge of #49346 - Diggsey:hashmap-get-pair, r=Mark-Simulacrum

Implement get_key_value for HashMap, BTreeMap

Fixes #43143

Follow up from #46992

6 years agoRollup merge of #49187 - alexcrichton:no-cross-docs, r=kennytm
Tim Neumann [Mon, 26 Mar 2018 13:14:58 +0000 (15:14 +0200)]
Rollup merge of #49187 - alexcrichton:no-cross-docs, r=kennytm

rustbuild: Disable docs on cross-compiled builds

This commit disables building documentation on cross-compiled compilers, for
example ARM/MIPS/PowerPC/etc. Currently I believe we're not getting much use out
of these documentation artifacts and they often take 10-15 minutes total to
build as it requires building rustdoc/rustbook and then also generating all the
documentation, especially for the reference and the book itself.

In an effort to cut down on the amount of work that we're doing on dist CI
builders in light of recent timeouts this was some relatively low hanging fruit
to cut which in theory won't have much impact on the ecosystem in the hopes that
the documentation isn't used too heavily anyway.

While initial analysis in #48827 showed only shaving 5 minutes off local builds
the same 5 minute conclusion was drawn from #48826 which ended up having nearly
a half-hour impact on the bots. In that sense I'm hoping that we can land this
and test out what happens on CI to see how it affects timing.

Note that all tier 1 platforms, Windows, Mac, and Linux, will continue to
generate documentation.

6 years agoRollup merge of #49170 - steveklabnik:gh49127, r=nagisa
Tim Neumann [Mon, 26 Mar 2018 13:14:57 +0000 (15:14 +0200)]
Rollup merge of #49170 - steveklabnik:gh49127, r=nagisa

Clarify AcqRel's docs

This implied things that are not true.

Fixes #49127

6 years agoRollup merge of #49103 - glandium:uninitialized, r=cramertj
Tim Neumann [Mon, 26 Mar 2018 13:14:56 +0000 (15:14 +0200)]
Rollup merge of #49103 - glandium:uninitialized, r=cramertj

Use an uninitialized buffer in GenericRadix::fmt_int, like in Display::fmt for numeric types

The code using a slice of that buffer is only ever going to use
bytes that are subsequently initialized.

6 years agoRollup merge of #48932 - Phlosioneer:43601-document-opaque-size, r=KodrAus
Tim Neumann [Mon, 26 Mar 2018 13:14:54 +0000 (15:14 +0200)]
Rollup merge of #48932 - Phlosioneer:43601-document-opaque-size, r=KodrAus

Document when types have OS-dependent sizes

As per issue #43601, types that can change size depending on the
target operating system should say so in their documentation.

I used this template when adding doc comments:

```
The size of a(n) <name> struct may vary depending on the target
operating system, and may change between Rust releases.
```

For enums, I used "instance" instead of "struct".

I added documentation to these types:
```
- std::time::Instant (contains sys::time::Instant)
- std::time::SystemTime (contains sys::time::SystemTime)

- std::io::StdinRaw (contains sys::stdio::Stdin)
- std::io::StdoutRaw (contains sys::stdio::Stdout)
- std::io::Stderr (contains sys::stdio::Stderr)

- std::net::addr::SocketAddrV4 (contains sys::net::netc::sockaddr_in)
- std::net::addr::SocketAddrV6 (contains sys::net::netc::sockaddr_in6)
- std::net::addr::SocketAddr (contains std::net::addr::SocketAddrV4 and SocketAddrV6)
- std::net::ip::Ipv4Addr (contains sys::net::netc::in_addr)
- std::net::ip::Ipv6Addr (contains sys::net::netc::in6_addr)
- std::net::ip::IpAddr (contains std::net::ip::Ipv4Addr and Ipv6Addr)
```

I also found that these types varied in size; however, I don't think they need documentation, as it's already fairly obvious that they change based on different OS's:

```
- std::fs::DirBuilder (contains sys::fs::DirBuilder)
- std::fs::FileType (contains sys::fs::FileType)
- std::fs::Permissions (contains sys::fs::FilePermissions)
- std::fs::OpenOptions (contains sys::fs::OpenOptions)
- std::fs::DirEntry (contains sys::fs::DirEntry)
- std::fs::ReadDir (contains sys::fs::ReadDir)
- std::fs::Metadata (contains sys::fs::FileAttr)
- std::fs::File (contains sys::fs::File)

- std::process::Child (contains sys::process::Process)
- std::process::ChildStdin (contains sys::process::AnonPipe)
- std::process::ChildStdout (contains sys::process::AnonPipe)
- std::process::ChildStderr (contains sys::process::AnonPipe)
- std::process::Command (contains sys::process::Command)
- std::process::Stdio (contains sys::process::Stdio)
- std::process::ExitStatus (contains sys::process::ExitStatus)
- std::process::Output (contains std::process::ExitStatus)

- std::sys_common::condvar::Condvar (contains sys::condvar::Condvar)
- std::sys_common::mutex::Mutex (contains sys::mutex::Mutex)
- std::sys_common::net::LookupHost (contains sys::net::netc::addrinfo)
- std::sys_common::net::TcpStream (contains sys::net::Socket)
- std::sys_common::net::TcpListener (contains sys::net::Socket)
- std::sys_common::net::UdpSocket (contains sys::net::Socket)
- std::sys_common::remutex::ReentrantMutex (contains sys::mutex::ReentrantMutex)
- std::sys_common::rwlock::RWLock (contains sys::rwlock::RWLock)
- std::sys_common::thread_local::Key (contains sys::thread_local::Key)
```
Maybe we should just put a comment about the size of structs in the module-level docs for `fs`, `process`, and `sys_common`?

If anyone can think of other types that can change size, comment below. I'm also open to changing the wording.

closes #43601.

6 years agoRollup merge of #48693 - vorner:doc-name-resolution, r=petrochenkov
Tim Neumann [Mon, 26 Mar 2018 13:14:50 +0000 (15:14 +0200)]
Rollup merge of #48693 - vorner:doc-name-resolution, r=petrochenkov

Some comments and documentation for name resolution crate

Hello

I'm trying to get a grasp of how the name resolution crate works, as part of helping with https://github.com/rust-lang-nursery/rustc-guide/issues/16. Not that I'd be succeeding much, but as I was reading the code, I started to put some notes into it, to help me understand.

I guess I didn't get very far yet, but I'd like to share what I have, in case it might be useful for someone else. I hope these are correct (even if incomplete), but I'll be glad for a fast check in case I put something misleading there.

6 years agoAuto merge of #48346 - emilio:pgo, r=alexcrichton
bors [Mon, 26 Mar 2018 13:00:18 +0000 (13:00 +0000)]
Auto merge of #48346 - emilio:pgo, r=alexcrichton

Add basic PGO support.

This PR adds two mutually exclusive options for profile usage and generation using LLVM's instruction profile generation (the same as clang uses), `-C pgo-use` and `-C pgo-gen`.

See each commit for details.

6 years agoAuto merge of #49255 - cramertj:stable-impl-trait, r=nikomatsakis
bors [Mon, 26 Mar 2018 09:14:23 +0000 (09:14 +0000)]
Auto merge of #49255 - cramertj:stable-impl-trait, r=nikomatsakis

Stabilize impl Trait

Blocked on:

- [x] https://github.com/rust-lang/rust/pull/49041 and
- [ ] completion of FCP in https://github.com/rust-lang/rust/issues/34511#issuecomment-373207183 (3 days from now).

I have not yet done any docs work for this-- I probably won't get to it until this weekend (might be a project for the flight to the all-hands).

6 years agoStabilize conservative_impl_trait
Taylor Cramer [Thu, 22 Mar 2018 01:32:44 +0000 (18:32 -0700)]
Stabilize conservative_impl_trait

6 years agofix tests
gnzlbg [Mon, 26 Mar 2018 08:18:36 +0000 (10:18 +0200)]
fix tests

6 years agoset min-llvm-version 6.0, ignore-emscripten
gnzlbg [Thu, 22 Mar 2018 17:01:35 +0000 (18:01 +0100)]
set min-llvm-version 6.0, ignore-emscripten

6 years agoproperly handle the case when LLVM does not have min/maxnum
gnzlbg [Thu, 22 Mar 2018 15:28:11 +0000 (16:28 +0100)]
properly handle the case when LLVM does not have min/maxnum

6 years agorequire llvm 6
gnzlbg [Thu, 22 Mar 2018 13:48:58 +0000 (14:48 +0100)]
require llvm 6

6 years agoadd tests
gnzlbg [Thu, 22 Mar 2018 08:49:46 +0000 (09:49 +0100)]
add tests

6 years agoimplement minmax intrinsics
gnzlbg [Wed, 21 Mar 2018 20:49:22 +0000 (21:49 +0100)]
implement minmax intrinsics

6 years agorustbuild: Disable docs on cross-compiled builds
Alex Crichton [Mon, 19 Mar 2018 17:58:30 +0000 (10:58 -0700)]
rustbuild: Disable docs on cross-compiled builds

This commit disables building documentation on cross-compiled compilers, for
example ARM/MIPS/PowerPC/etc. Currently I believe we're not getting much use out
of these documentation artifacts and they often take 10-15 minutes total to
build as it requires building rustdoc/rustbook and then also generating all the
documentation, especially for the reference and the book itself.

In an effort to cut down on the amount of work that we're doing on dist CI
builders in light of recent timeouts this was some relatively low hanging fruit
to cut which in theory won't have much impact on the ecosystem in the hopes that
the documentation isn't used too heavily anyway.

While initial analysis in #48827 showed only shaving 5 minutes off local builds
the same 5 minute conclusion was drawn from #48826 which ended up having nearly
a half-hour impact on the bots. In that sense I'm hoping that we can land this
and test out what happens on CI to see how it affects timing.

Note that all tier 1 platforms, Windows, Mac, and Linux, will continue to
generate documentation.

6 years agoStabilize universal_impl_trait
Taylor Cramer [Thu, 22 Mar 2018 00:44:21 +0000 (17:44 -0700)]
Stabilize universal_impl_trait

6 years agoAuto merge of #49351 - pthariensflame:patch-1, r=oli-obk
bors [Mon, 26 Mar 2018 05:09:44 +0000 (05:09 +0000)]
Auto merge of #49351 - pthariensflame:patch-1, r=oli-obk

Minor message/label formatting consistency fix.

The unimplemented label for `Termination` was missing some backticks for consistency with the message.

6 years agoAuto merge of #49341 - alexcrichton:more-balance, r=kennytm
bors [Mon, 26 Mar 2018 02:39:28 +0000 (02:39 +0000)]
Auto merge of #49341 - alexcrichton:more-balance, r=kennytm

appveyor: Move run-pass-fulldeps to extra builders

We've made headway towards splitting the test suite across two appveyor builders
and this moves one more tests suite between builders. The last [failed
build][fail] had its longest running test suite and I've moved that to the
secondary builder.

cc #48844

[fail]: https://ci.appveyor.com/project/rust-lang/rust/build/1.0.6782

6 years agoAuto merge of #49297 - scottmcm:offset-from, r=dtolnay
bors [Mon, 26 Mar 2018 00:15:34 +0000 (00:15 +0000)]
Auto merge of #49297 - scottmcm:offset-from, r=dtolnay

Introduce unsafe offset_from on pointers

Adds intrinsics::exact_div to take advantage of the unsafe, which reduces the implementation from
```asm
    sub rcx, rdx
    mov rax, rcx
    sar rax, 63
    shr rax, 62
    lea rax, [rax + rcx]
    sar rax, 2
    ret
```
down to
```asm
    sub rcx, rdx
    sar rcx, 2
    mov rax, rcx
    ret
```
(for `*const i32`)

See discussion on the `offset_to` tracking issue https://github.com/rust-lang/rust/issues/41079

Some open questions
- Would you rather I split the intrinsic PR from the library PR?
- Do we even want the safe version of the API?  https://github.com/rust-lang/rust/issues/41079#issuecomment-374426786  I've added some text to its documentation that even if it's not UB, it's useless to use it between pointers into different objects.

and todos
- [x] ~~I need to make a codegen test~~ Done
- [x] ~~Can the subtraction use nsw/nuw?~~ No, it can't https://github.com/rust-lang/rust/pull/49297#discussion_r176697574
- [x] ~~Should there be `usize` variants of this, like there are now `add` and `sub` that you almost always want over `offset`?  For example, I imagine `sub_ptr` that returns `usize` and where it's UB if the distance is negative.~~ Can wait for later; C gives a signed result https://github.com/rust-lang/rust/issues/41079#issuecomment-375842235, so we might as well, and this existing to go with `offset` makes sense.

6 years agoImplement get_key_value for HashMap, BTreeMap
Diggory Blake [Mon, 25 Dec 2017 00:00:04 +0000 (00:00 +0000)]
Implement get_key_value for HashMap, BTreeMap

6 years agoAuto merge of #49212 - kyrias:strip-debug-no-debuginfo, r=michaelwoerister
bors [Sun, 25 Mar 2018 21:46:15 +0000 (21:46 +0000)]
Auto merge of #49212 - kyrias:strip-debug-no-debuginfo, r=michaelwoerister

Pass --strip-debug to GccLinker when building without debuginfo

C.f. #46034

---

This brings a hello-world built by passing rustc no command line options from 2.9M to 592K on Linux.

(This might need to special case MacOS or Windows, not sure if the linkers there support `--strip-debug`, and there is an annoying lack of dependable docs for the linkers there.)

6 years agopgo: Blindly try to fix Windows build.
Emilio Cobos Álvarez [Sun, 25 Mar 2018 21:17:47 +0000 (23:17 +0200)]
pgo: Blindly try to fix Windows build.

6 years agoupdate wording as per feedback
Steve Klabnik [Sun, 25 Mar 2018 12:19:27 +0000 (14:19 +0200)]
update wording as per feedback

6 years agoModify tests
Alexander Ronald Altman [Sun, 25 Mar 2018 06:29:57 +0000 (01:29 -0500)]
Modify tests

6 years agoMinor formatting consistency fix.
Alexander Ronald Altman [Sun, 25 Mar 2018 05:15:50 +0000 (00:15 -0500)]
Minor formatting consistency fix.

6 years agoFix confusing doc for `scan`
Sean Silva [Sun, 25 Mar 2018 05:31:17 +0000 (22:31 -0700)]
Fix confusing doc for `scan`

The comment "the value passed on to the next iteration" confused me since it sounded more like what Haskell's [scanl](http://hackage.haskell.org/package/base-4.11.0.0/docs/Prelude.html#v:scanl) does where the closure's return value serves as both the "yielded value" *and* the new value of the "state".

I tried changing the example to make it clear that the closure's return value is decoupled from the state argument.

6 years agoAuto merge of #49315 - TheDan64:smaller_unsafe_block, r=joshtriplett
bors [Sun, 25 Mar 2018 05:26:58 +0000 (05:26 +0000)]
Auto merge of #49315 - TheDan64:smaller_unsafe_block, r=joshtriplett

Reduce scope of unsafe block in sun_path_offset

I reduced the scope of the unsafe block to the `uninitialized` call which is the only actual unsafe bit.

6 years agoAdd backticks
Phlosioneer [Sun, 25 Mar 2018 03:41:34 +0000 (23:41 -0400)]
Add backticks

6 years agoFix doctest mutability copy-pasta
Scott McMurray [Sun, 25 Mar 2018 03:41:20 +0000 (20:41 -0700)]
Fix doctest mutability copy-pasta

6 years agoDocumentation and naming improvements
Scott McMurray [Sun, 25 Mar 2018 03:37:31 +0000 (20:37 -0700)]
Documentation and naming improvements

6 years agoAuto merge of #49284 - alexcrichton:use-our-own-cache, r=kennytm
bors [Sun, 25 Mar 2018 02:42:58 +0000 (02:42 +0000)]
Auto merge of #49284 - alexcrichton:use-our-own-cache, r=kennytm

ci: Don't use Travis caches for docker images

This commit moves away from caching on Travis to our own caching on S3 for
caching docker layers between builds. Unfortunately the Travis caches have over
time had a few critical pain points:

* Caches are only updated for successful builds, meaning that if a build times
  out or fails in a different location the sucessfully-created docker images
  isn't always cached. While this makes sense as a general rule of caches it
  hurts our use cases.

* Caches are per-branch and builder which means that we don't have a separate
  cache on each release channel. All our merges go through the `auto` branch
  which means that they're all sharing the same cache, even those for merging to
  master/beta. This means that PRs which switch between master/beta will keep
  rebuilting and having cache misses.

* Caches have historically been invaliated somewhat regularly a little more
  aggressively than we'd want (I think).

* We don't always need to update the contents of the cache if the Docker image
  didn't change at all, and saving off the docker layers can sometimes be quite
  expensive.

For all these reasons this commit drops the usage of Travis's built-in caching
support. Instead our own caching is used by storing blobs to S3. Normally this
would be a very risky endeavour but we're basically priming a cache for a cache
(docker) so if we get this wrong the failure mode is longer builds, not stale
caches. We'll notice that pretty quickly and hopefully fix it!

The logic here is inserted directly into the `src/ci/docker/run.sh` script to
download an image based on a shasum of the `Dockerfile` and other assorted files.
This blob, if found, is loaded into docker and we record what layers were
inserted. After docker finishes the build (hopefully quickly with lots of cache
hits) we then see the sha of the final image. If it's one of the layers we
loaded then there's no need to update the cache. Otherwise we upload our layers
to the global cache, possibly overwriting what we previously just downloaded.

This is hopefully a step towards mitigating #49278 although it doesn't
completely fix it as it means we'll still probably have to retry builds that
bust the cache.

6 years agoPolyfill LLVMBuildExactUDiv
Scott McMurray [Sun, 25 Mar 2018 02:15:12 +0000 (19:15 -0700)]
Polyfill LLVMBuildExactUDiv

It was added 32 days after LLVM 3.9 shipped.

6 years agopgo: Move the tests to run-make-fulldeps, and make the profile file be in the tmp...
Emilio Cobos Álvarez [Sun, 25 Mar 2018 01:29:15 +0000 (03:29 +0200)]
pgo: Move the tests to run-make-fulldeps, and make the profile file be in the tmp directory properly.

6 years agoMove linker code to the Linker trait instead.
Emilio Cobos Álvarez [Mon, 19 Mar 2018 21:29:58 +0000 (22:29 +0100)]
Move linker code to the Linker trait instead.

6 years agotry to fix the build on older LLVM versions.
Emilio Cobos Álvarez [Thu, 15 Mar 2018 15:56:45 +0000 (16:56 +0100)]
try to fix the build on older LLVM versions.

6 years agolibrustc_trans: Mark some profiler symbols as exported to avoid LTO removing them.
Emilio Cobos Álvarez [Tue, 13 Mar 2018 11:40:57 +0000 (12:40 +0100)]
librustc_trans: Mark some profiler symbols as exported to avoid LTO removing them.

6 years agolibrustc_trans: Turn PGO diagnostics into warnings.
Emilio Cobos Álvarez [Mon, 12 Mar 2018 20:18:01 +0000 (21:18 +0100)]
librustc_trans: Turn PGO diagnostics into warnings.

They should at least be that, they usually warn about control flow mismatches,
and or the profile being useless, which looks like at least a warning to me.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
6 years agolibrustc_trans: Gate the preinliner with another -Z flag.
Emilio Cobos Álvarez [Mon, 12 Mar 2018 20:15:16 +0000 (21:15 +0100)]
librustc_trans: Gate the preinliner with another -Z flag.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
6 years agolibrustc: Convert -C pgo-gen and -C pgo-use into -Z flags.
Emilio Cobos Álvarez [Mon, 12 Mar 2018 20:11:25 +0000 (21:11 +0100)]
librustc: Convert -C pgo-gen and -C pgo-use into -Z flags.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
6 years agolibrustc_trans: disable profiling pre-inlining.
Emilio Cobos Álvarez [Mon, 12 Mar 2018 19:45:35 +0000 (20:45 +0100)]
librustc_trans: disable profiling pre-inlining.

It destroys performance actually.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
6 years agolibrustc_llvm: Show PGO diagnostics properly.
Emilio Cobos Álvarez [Mon, 12 Mar 2018 17:11:59 +0000 (18:11 +0100)]
librustc_llvm: Show PGO diagnostics properly.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
6 years agoprofiler_builtins: Add missing ProfilingNameVar file to the profiler build.
Emilio Cobos Álvarez [Mon, 19 Feb 2018 02:20:51 +0000 (03:20 +0100)]
profiler_builtins: Add missing ProfilingNameVar file to the profiler build.

Otherwise opt builds with pgo-gen fail, d'oh.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
6 years agoTest that pgo-gen works properly.
Emilio Cobos Álvarez [Mon, 19 Feb 2018 01:49:48 +0000 (02:49 +0100)]
Test that pgo-gen works properly.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
6 years agorustc_trans: Fix PGO generation linking on Linux by adding the relevant linker commands.
Emilio Cobos Álvarez [Mon, 19 Feb 2018 01:04:49 +0000 (02:04 +0100)]
rustc_trans: Fix PGO generation linking on Linux by adding the relevant linker commands.

See the linked LLVM reviews for the clang counter-parts.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
6 years agorustc_trans: disable probestack when using pgo-gen.
Emilio Cobos Álvarez [Mon, 19 Feb 2018 00:57:55 +0000 (01:57 +0100)]
rustc_trans: disable probestack when using pgo-gen.

Executables crash in the probestack function otherwise... I haven't debugged
much further than that.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
6 years agorustc_llvm: rustc_trans: Thread the PGO config down to the pass manager builder.
Emilio Cobos Álvarez [Mon, 19 Feb 2018 00:57:12 +0000 (01:57 +0100)]
rustc_llvm: rustc_trans: Thread the PGO config down to the pass manager builder.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
6 years agorustc_metadata: Load the profiler runtime if we're generating PGO profile data.
Emilio Cobos Álvarez [Mon, 19 Feb 2018 00:55:50 +0000 (01:55 +0100)]
rustc_metadata: Load the profiler runtime if we're generating PGO profile data.

This contains all the actual profiling code.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
6 years agosession: Add two tracked, exclusive codegen options for PGO profile usage and generation.
Emilio Cobos Álvarez [Mon, 19 Feb 2018 00:46:39 +0000 (01:46 +0100)]
session: Add two tracked, exclusive codegen options for PGO profile usage and generation.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
6 years agoprofiler-builtins: define COMPILER_RT_HAS_UNAME on non-msvc platforms.
Emilio Cobos Álvarez [Mon, 19 Feb 2018 00:40:48 +0000 (01:40 +0100)]
profiler-builtins: define COMPILER_RT_HAS_UNAME on non-msvc platforms.

Otherwise lprofGetHostName, used by the PGO generator, won't be available.

This means that PGO and coverage profiling would be restricted to systems with
uname, but that seems acceptable.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
6 years agoAuto merge of #49141 - gnzlbg:simd_select, r=alexcrichton
bors [Sun, 25 Mar 2018 00:02:48 +0000 (00:02 +0000)]
Auto merge of #49141 - gnzlbg:simd_select, r=alexcrichton

adds simd_select intrinsic

The select SIMD intrinsic is used to select elements from two SIMD vectors using a mask:

```rust
let mask = b8x4::new(true, false, false, true);
let a = f32x4::new(1., 2., 3., 4.);
let b = f32x4::new(5., 6., 7., 8.);
assert_eq!(simd_select(mask, a, b), f32x4::new(1., 6., 7., 4.));
```

The number of lanes between the mask and the vectors must match, but the vector width of the mask does not need to match that of the vectors. The mask is required to be a vector of signed integers.

Note: this intrinsic will be exposed via `std::simd`'s vector masks - users are not expected to use it directly.

6 years agoAdd flag for telling the linker to strip debuginfo when building without it
Johannes Löthberg [Tue, 20 Mar 2018 15:23:31 +0000 (16:23 +0100)]
Add flag for telling the linker to strip debuginfo when building without it

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
6 years agoappveyor: Move run-pass-fulldeps to extra builders
Alex Crichton [Sat, 24 Mar 2018 20:44:28 +0000 (13:44 -0700)]
appveyor: Move run-pass-fulldeps to extra builders

We've made headway towards splitting the test suite across two appveyor builders
and this moves one more tests suite between builders. The last [failed
build][fail] had its longest running test suite and I've moved that to the
secondary builder.

cc #48844

[fail]: https://ci.appveyor.com/project/rust-lang/rust/build/1.0.6782

6 years agoAuto merge of #49337 - kennytm:rollup, r=kennytm
bors [Sat, 24 Mar 2018 18:58:12 +0000 (18:58 +0000)]
Auto merge of #49337 - kennytm:rollup, r=kennytm

Rollup of 21 pull requests

- Successful merges: #49046, #49076, #49089, #49120, #49121, #49122, #49162, #49193, #49194, #49203, #49229, #49235, #49254, #49268, #49273, #49274, #49290, #49312, #49314, #49318, #49299

6 years agoRollup merge of #49299 - SimonSapin:ubiquity, r=nikomatsakis
kennytm [Sat, 24 Mar 2018 17:30:12 +0000 (01:30 +0800)]
Rollup merge of #49299 - SimonSapin:ubiquity, r=nikomatsakis

Stabilize the copy_closures and clone_closures features

In addition to the `Fn*` family of traits, closures now implement `Copy` (and similarly `Clone`) if all of the captures do.

Tracking issue: https://github.com/rust-lang/rust/issues/44490

6 years agoRollup merge of #49318 - steveklabnik:update-books, r=kennytm
kennytm [Sat, 24 Mar 2018 17:26:48 +0000 (01:26 +0800)]
Rollup merge of #49318 - steveklabnik:update-books, r=kennytm

update books for next release

6 years agoRollup merge of #49314 - Mark-Simulacrum:remove-getopts, r=alexcrichton
kennytm [Sat, 24 Mar 2018 17:26:46 +0000 (01:26 +0800)]
Rollup merge of #49314 - Mark-Simulacrum:remove-getopts, r=alexcrichton

Remove getopts leftover from tree

This was attempted but left incomplete in PR #42664, where only the toml
file was removed.

cc @alexcrichton

6 years agoRollup merge of #49312 - GuillaumeGomez:fix-ie11-search, r=QuietMisdreavus
kennytm [Sat, 24 Mar 2018 17:26:45 +0000 (01:26 +0800)]
Rollup merge of #49312 - GuillaumeGomez:fix-ie11-search, r=QuietMisdreavus

Fix IE11 search

Fixes #49263.

r? @QuietMisdreavus

I got this code from: https://stackoverflow.com/a/30867255/7879548

6 years agoRollup merge of #49290 - cuviper:unextended-dist-rustfmt, r=nikomatsakis
kennytm [Sat, 24 Mar 2018 17:26:44 +0000 (01:26 +0800)]
Rollup merge of #49290 - cuviper:unextended-dist-rustfmt, r=nikomatsakis

Allow installing rustfmt without config.extended

This assertion was preventing `./x.py install rustfmt` if attempted
without an "extended" build configuration, but it actually builds and
installs just fine.

6 years agoRollup merge of #49274 - oli-obk:slow_miri, r=michaelwoerister,eddyb
kennytm [Sat, 24 Mar 2018 17:26:43 +0000 (01:26 +0800)]
Rollup merge of #49274 - oli-obk:slow_miri, r=michaelwoerister,eddyb

Remove slow HashSet during miri stack frame creation

fixes #49237

probably has a major impact on #48846

r? @michaelwoerister

cc @eddyb I know you kept telling me to use vectors instead of hash containers... Now I know why.

6 years agoRollup merge of #49273 - michaelwoerister:fix-extern-proc-macro-defkey, r=eddyb
kennytm [Sat, 24 Mar 2018 17:26:41 +0000 (01:26 +0800)]
Rollup merge of #49273 - michaelwoerister:fix-extern-proc-macro-defkey, r=eddyb

Fix DefKey lookup for proc-macro crates.

Add a special case for proc-macro crates for `def_key()` in the metadata decoder (like we already have for many other methods in there). In the long run, it would be preferable to get rid of the need for special casing proc-macro crates (see #49271).

Fixes https://github.com/rust-lang/rust/issues/48739 (though I wasn't able to come up with a regression test, unfortunately)

r? @eddyb

6 years agoRollup merge of #49268 - ordovicia:dotdot-pattern-diag, r=petrochenkov
kennytm [Sat, 24 Mar 2018 17:26:40 +0000 (01:26 +0800)]
Rollup merge of #49268 - ordovicia:dotdot-pattern-diag, r=petrochenkov

Better diagnostics for '..' pattern fragment not in the last position

Fixes #49257.

6 years agoRollup merge of #49254 - Tacklebox:atan2_doc, r=QuietMisdreavus
kennytm [Sat, 24 Mar 2018 17:26:39 +0000 (01:26 +0800)]
Rollup merge of #49254 - Tacklebox:atan2_doc, r=QuietMisdreavus

Fixed clockwise/counter-clockwise in atan2 documentation in f32 and f64 and included that it returns radians

None

6 years agoRollup merge of #49235 - topecongiro:run-rustfmt/libtest, r=nrc
kennytm [Sat, 24 Mar 2018 17:26:38 +0000 (01:26 +0800)]
Rollup merge of #49235 - topecongiro:run-rustfmt/libtest, r=nrc

Cargo fmt libtest

r? @nrc

Using `rustfmt 0.4.1- (87180d9 2018-03-16)` (`rustfmt --version` is a bit broken).

6 years agoRollup merge of #49229 - Centril:doc/format_args_display_debug, r=steveklabnik
kennytm [Sat, 24 Mar 2018 17:26:37 +0000 (01:26 +0800)]
Rollup merge of #49229 - Centril:doc/format_args_display_debug, r=steveklabnik

Document format_args! / Arguments<'a> behavior wrt. Display and Debug

This is a follow up PR to #49067 , this documents the behavior of `format_args!` (i.e: `Argument<'a>`) wrt. `Display` and `Debug`.

r? @steveklabnik

6 years agoRollup merge of #49203 - Eijebong:lets-cleanup-dependencies, r=Mark-Simulacrum
kennytm [Sat, 24 Mar 2018 17:26:36 +0000 (01:26 +0800)]
Rollup merge of #49203 - Eijebong:lets-cleanup-dependencies, r=Mark-Simulacrum

Bump racer and home

This removes 10 dependencies from the build :tada:

6 years agoRollup merge of #49194 - Zoxc:unsafe-generator, r=cramertj
kennytm [Sat, 24 Mar 2018 17:26:34 +0000 (01:26 +0800)]
Rollup merge of #49194 - Zoxc:unsafe-generator, r=cramertj

Make resuming generators unsafe instead of the creation of immovable generators

cc @withoutboats

Fixes #47787

6 years agoRollup merge of #49193 - davidtwco:issue-29893, r=alexcrichton
kennytm [Sat, 24 Mar 2018 17:26:33 +0000 (01:26 +0800)]
Rollup merge of #49193 - davidtwco:issue-29893, r=alexcrichton

Host compiler documentation

Fixes #29893. Rust Central Station PR: rust-lang/rust-central-station#40

r? @alexcrichton

6 years agoRollup merge of #49162 - tmandry:stabilize-termination-trait, r=nikomatsakis
kennytm [Sat, 24 Mar 2018 17:26:32 +0000 (01:26 +0800)]
Rollup merge of #49162 - tmandry:stabilize-termination-trait, r=nikomatsakis

Stabilize termination_trait, split out termination_trait_test

For #48453.

First time contribution, so I'd really appreciate any feedback on how this PR can be better.

Not sure exactly what kind of documentation update is needed. If there is no PR to update the reference, I can try doing that this week as I have time.

6 years agoRollup merge of #49122 - scottmcm:z-align-attr, r=cramertj
kennytm [Sat, 24 Mar 2018 17:26:30 +0000 (01:26 +0800)]
Rollup merge of #49122 - scottmcm:z-align-attr, r=cramertj

Add a -Z flag for LLVM align attributes on arguments

LLVM seems to still put the assume calls in when inlining, so this probably isn't in a place where it can be turned on by default, but it's interesting to experiment with.

For example, this makes `mem::swap::<u64x8>` be 8x `vmovaps ymm` instead of 16x `vmovups xmm`, on my cpu.

6 years agoRollup merge of #49121 - varkor:stabilise-from_utf8_error_as_bytes, r=bluss
kennytm [Sat, 24 Mar 2018 17:26:29 +0000 (01:26 +0800)]
Rollup merge of #49121 - varkor:stabilise-from_utf8_error_as_bytes, r=bluss

Stabilise FromUtf8Error::as_bytes

Closes #40895.

6 years agoRollup merge of #49120 - Zoxc:parallel-ci, r=alexcrichton
kennytm [Sat, 24 Mar 2018 17:26:28 +0000 (01:26 +0800)]
Rollup merge of #49120 - Zoxc:parallel-ci, r=alexcrichton

 Add a CI job for parallel rustc using x.py check

r? @alexcrichton

6 years agoRollup merge of #49089 - alexcrichton:fix-timings, r=Mark-Simulacrum
kennytm [Sat, 24 Mar 2018 17:26:27 +0000 (01:26 +0800)]
Rollup merge of #49089 - alexcrichton:fix-timings, r=Mark-Simulacrum

rustbuild: Tweak where timing information goes

This commit tweaks where timing and step information is printed out as part of
the build, ensuring that we do it as close to the location where work happens as
possible. In rustbuild various functions may perform long blocking work as
dependencies are assembled, so if we print out timing information early on we
may accidentally time more than just the step we were intending to time!

6 years agoRollup merge of #49076 - bobdavelisafrank:filetype-metadata-docfix, r=bluss
kennytm [Sat, 24 Mar 2018 17:26:25 +0000 (01:26 +0800)]
Rollup merge of #49076 - bobdavelisafrank:filetype-metadata-docfix, r=bluss

Fix Issue #48345, is_file, is_dir, and is_symlink note mutual exclusion

The methods on the structures `fs::FileType` and `fs::Metadata` of (respectively) `is_file`, `is_dir`, and `is_symlink` had some ambiguity in documentation, where it was not noted whether files will pass those tests exclusively or not. It is now written that the tests are mutually exclusive.

Fixes #48345.

6 years agoRollup merge of #49046 - Zoxc:error-summary, r=michaelwoerister
kennytm [Sat, 24 Mar 2018 17:26:24 +0000 (01:26 +0800)]
Rollup merge of #49046 - Zoxc:error-summary, r=michaelwoerister

Always print `aborting due to n previous error(s)`

r? @michaelwoerister

6 years agofixup! Some comments and documentation for name resolution crate
Michal 'vorner' Vaner [Sat, 24 Mar 2018 16:07:58 +0000 (17:07 +0100)]
fixup! Some comments and documentation for name resolution crate