]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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 agoupdate books for next release
steveklabnik [Fri, 23 Mar 2018 22:29:52 +0000 (23:29 +0100)]
update books for next release

6 years agoAuto merge of #49251 - nikomatsakis:issue-15872-elision-impl-header, r=cramertj
bors [Sat, 24 Mar 2018 13:23:17 +0000 (13:23 +0000)]
Auto merge of #49251 - nikomatsakis:issue-15872-elision-impl-header, r=cramertj

support elision in impl headers

You can now do things like:

```
impl MyTrait<'_> for &u32 { ... }
```

Each `'_` or elided lifetime is a fresh parameter. `'_` and elision are still not permitted in associated type values. (Plausibly we could support that if there is a single input lifetime.) The original lifetime elision RFC was a bit unclear on this point: [as documented here, I think this is the correct interpretation, both because it fits existing impls and it's most analogous to the behavior in fns](https://github.com/rust-lang/rust/issues/15872#issuecomment-338700138).

We do not support elision with deprecated forms:

```
impl MyTrait for std::cell::Ref<u32> { } // ERROR
```

Builds on the in-band lifetime stuff.

r? @cramertj

Fixes #15872

6 years agoAdd a codegen test for exact_div intrinsic
Scott McMurray [Sat, 24 Mar 2018 06:47:22 +0000 (23:47 -0700)]
Add a codegen test for exact_div intrinsic

6 years agoAuto merge of #48552 - kennytm:lower-unstable-priority, r=nikomatsakis
bors [Sat, 24 Mar 2018 04:43:24 +0000 (04:43 +0000)]
Auto merge of #48552 - kennytm:lower-unstable-priority, r=nikomatsakis

Lower the priority of unstable methods when picking a candidate.

Previously, when searching for the impl of a method, we do not consider the stability of the impl. This leads to lots of insta-inference-regressions due to method ambiguity when a popular name is chosen. This has happened multiple times in Rust's history e.g.

* `f64::from_bits` #40470
* `Ord::{min, max}` #42496
* `Ord::clamp` #44095 (eventually got reverted due to these breakages)
* `Iterator::flatten` #48115 (recently added)

This PR changes the probing order so that unstable items are considered last. If a stable item is found, the unstable items will not be considered (but a future-incompatible warning will still be emitted), thus allowing stable code continue to function without using qualified names.

Once the unstable feature is stabilized, the ambiguity error will still be emitted, but the user can also use newly stable std methods, while the current situation is that downstream user is forced to update the code without any immediate benefit.

(I hope that we could bring back `Ord::clamp` if this PR is merged.)

6 years agoAuto merge of #48482 - davidtwco:issue-47184, r=nikomatsakis
bors [Sat, 24 Mar 2018 02:08:22 +0000 (02:08 +0000)]
Auto merge of #48482 - davidtwco:issue-47184, r=nikomatsakis

NLL should identify and respect the lifetime annotations that the user wrote

Part of #47184.

r? @nikomatsakis

6 years agoFix test for PR #49268
Hidehito Yabuuchi [Fri, 23 Mar 2018 23:10:51 +0000 (08:10 +0900)]
Fix test for PR #49268

6 years agoAuto merge of #49311 - SimonSapin:bootstrap-vs-rustflags-the-return, r=Mark-Simulacrum
bors [Fri, 23 Mar 2018 23:08:13 +0000 (23:08 +0000)]
Auto merge of #49311 - SimonSapin:bootstrap-vs-rustflags-the-return, r=Mark-Simulacrum

Use the same RUSTFLAGS for building and testing `bootstrap`

This avoids recompiling the whole dependency graph twice for every `./x.py test` run.

Fixes #49215

6 years agoTrack IsSuggestion in ProbeContext. Don't warn stability for suggestions.
kennytm [Fri, 23 Mar 2018 18:32:20 +0000 (02:32 +0800)]
Track IsSuggestion in ProbeContext. Don't warn stability for suggestions.

6 years agoFiled a proper tracking issue.
kennytm [Sat, 10 Mar 2018 17:58:57 +0000 (01:58 +0800)]
Filed a proper tracking issue.

6 years agoSpecialize future-incompatibility warning for UNSTABLE_NAME_COLLISION.
kennytm [Sat, 3 Mar 2018 11:27:49 +0000 (19:27 +0800)]
Specialize future-incompatibility warning for UNSTABLE_NAME_COLLISION.

6 years agoChanged `check_stability` to take an `Option<NodeId>` instead of `NodeId`.
kennytm [Sat, 3 Mar 2018 09:02:01 +0000 (17:02 +0800)]
Changed `check_stability` to take an `Option<NodeId>` instead of `NodeId`.

This clarifies the intent of whether to emit deprecated lint or not.

6 years agoWhen picking a candidate, consider the unstable ones last.
kennytm [Mon, 26 Feb 2018 13:34:06 +0000 (21:34 +0800)]
When picking a candidate, consider the unstable ones last.

If there is potential ambiguity after stabilizing those candidates, a
warning will be emitted.

6 years agoProvide a proper span when demanding for the return type of `box x`.
kennytm [Wed, 28 Feb 2018 21:16:44 +0000 (05:16 +0800)]
Provide a proper span when demanding for the return type of `box x`.

6 years agoFix error annotations in test
Hidehito Yabuuchi [Thu, 22 Mar 2018 16:15:27 +0000 (01:15 +0900)]
Fix error annotations in test

6 years agoBetter diagnostics for '..' pattern fragment not in the last position
Hidehito Yabuuchi [Thu, 22 Mar 2018 11:57:12 +0000 (20:57 +0900)]
Better diagnostics for '..' pattern fragment not in the last position

6 years agoRemove getopts leftover from tree
Mark Simulacrum [Fri, 23 Mar 2018 21:02:59 +0000 (15:02 -0600)]
Remove getopts leftover from tree

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

6 years agoReduce scope of unsafe block in sun_path_offset
Daniel Kolsoi [Fri, 23 Mar 2018 21:01:34 +0000 (17:01 -0400)]
Reduce scope of unsafe block in sun_path_offset

6 years agoFix IE11 search
Guillaume Gomez [Fri, 23 Mar 2018 20:27:15 +0000 (21:27 +0100)]
Fix IE11 search

6 years agoUse the same RUSTFLAGS for building and testing `bootstrap`
Simon Sapin [Fri, 23 Mar 2018 18:55:41 +0000 (19:55 +0100)]
Use the same RUSTFLAGS for building and testing `bootstrap`

Fixes #49215

6 years agoAuto merge of #49308 - alexcrichton:rollup, r=alexcrichton
bors [Fri, 23 Mar 2018 18:38:16 +0000 (18:38 +0000)]
Auto merge of #49308 - alexcrichton:rollup, r=alexcrichton

Rollup of 15 pull requests

- Successful merges: #48265, #48528, #48552, #48624, #48883, #48909, #49028, #49030, #49102, #49160, #49169, #49203, #49262, #49272, #49295
- Failed merges: #48942, #49035

6 years agoTest fixes
Alex Crichton [Fri, 23 Mar 2018 14:46:20 +0000 (07:46 -0700)]
Test fixes

6 years agoRename variables in rustc’s SelectionContext::copy_clone_conditions
Simon Sapin [Fri, 23 Mar 2018 18:02:14 +0000 (19:02 +0100)]
Rename variables in rustc’s SelectionContext::copy_clone_conditions

6 years agoImproved comments for UserAssertTy statement.
David Wood [Fri, 23 Mar 2018 17:48:03 +0000 (17:48 +0000)]
Improved comments for UserAssertTy statement.

6 years agoMerge branch '49001_epoch' of https://github.com/klnusbaum/rust into rollup
Alex Crichton [Fri, 23 Mar 2018 14:32:15 +0000 (07:32 -0700)]
Merge branch '49001_epoch' of https://github.com/klnusbaum/rust into rollup

6 years agoMerge branch 'master' of https://github.com/Lymia/rust into rollup
Alex Crichton [Fri, 23 Mar 2018 14:31:15 +0000 (07:31 -0700)]
Merge branch 'master' of https://github.com/Lymia/rust into rollup

6 years agoRollup merge of #49295 - csmoe:nll_test_48238, r=alexcrichton
Alex Crichton [Fri, 23 Mar 2018 14:27:28 +0000 (09:27 -0500)]
Rollup merge of #49295 - csmoe:nll_test_48238, r=alexcrichton

Add test for issue-48238

Fixes #48238
test case made from comments in #48238

6 years agoRollup merge of #49272 - semarie:cat-and-grep-gnu, r=alexcrichton
Alex Crichton [Fri, 23 Mar 2018 14:27:27 +0000 (09:27 -0500)]
Rollup merge of #49272 - semarie:cat-and-grep-gnu, r=alexcrichton

Use GNU version of fgrep/egrep tool if available

It is mostly for BSD system. Some tests (run-make/issue-35164 and
run-make/cat-and-grep-sanity-check) are failing with BSD
fgrep, whereas they pass with gnu version (gfgrep).

6 years agoRollup merge of #49262 - oli-obk:fixed_size_array_len, r=estebank
Alex Crichton [Fri, 23 Mar 2018 14:27:26 +0000 (09:27 -0500)]
Rollup merge of #49262 - oli-obk:fixed_size_array_len, r=estebank

Produce nice array lengths on a best effort basis

fixes #49208

r? @estebank

6 years agoRollup merge of #49169 - sanxiyn:doc-only, r=aturon
Alex Crichton [Fri, 23 Mar 2018 14:27:23 +0000 (09:27 -0500)]
Rollup merge of #49169 - sanxiyn:doc-only, r=aturon

Document only-X test header

This was added in #47487 without documentation.

6 years agoRollup merge of #49160 - estebank:issue-47457-missing-fields, r=oli-obk
Alex Crichton [Fri, 23 Mar 2018 14:27:22 +0000 (09:27 -0500)]
Rollup merge of #49160 - estebank:issue-47457-missing-fields, r=oli-obk

Reduce the diagnostic spam when multiple fields are missing in pattern

Fix #47457.

6 years agoRollup merge of #49102 - glandium:decimal, r=aturon
Alex Crichton [Fri, 23 Mar 2018 14:27:21 +0000 (09:27 -0500)]
Rollup merge of #49102 - glandium:decimal, r=aturon

Remove core::fmt::num::Decimal

Before ebf9e1aaf6, it was used for Display::fmt, but ebf9e1aaf6 replaced
that with a faster implementation, and nothing else uses it.

6 years agoRollup merge of #49030 - Zoxc:misc, r=michaelwoerister
Alex Crichton [Fri, 23 Mar 2018 14:27:19 +0000 (09:27 -0500)]
Rollup merge of #49030 - Zoxc:misc, r=michaelwoerister

Misc changes from my parallel rustc branch

r? @michaelwoerister

6 years agoRollup merge of #49028 - QuietMisdreavus:the-dark-forbidden-corners-of-rustdoc, r...
Alex Crichton [Fri, 23 Mar 2018 14:27:18 +0000 (09:27 -0500)]
Rollup merge of #49028 - QuietMisdreavus:the-dark-forbidden-corners-of-rustdoc, r=frewsxcv

add an "unstable features" chapter to the rustdoc book

There are several rustdoc features that currently are undocumented, but also don't fit with the rest of the Rustdoc Book since they're also unstable. Some of these have corresponding feature gates and chapters in the Unstable Book, but many don't, and i wanted a place to talk about them officially.

Goal: talk about everything rustdoc can do that needs nightly

- [x] Feature gates (extensions to the doc attribute that can be caught by the compiler)
  - [x] doc(cfg)
  - [x] doc(masked)
  - [x] doc(spotlight)
  - [x] doc(include)
- [x] Command-line flags (features that require a CLI flag to use, where the flag itself is a `-Z` command or otherwise requires `-Z unstable-options` before rustdoc will accept it)
  - [x] markdown-before-content/markdown-after-content
  - [x] playground-url
  - [x] display-warnings
  - [x] crate-version
  - [x] linker
  - [x] sort-modules-by-appearance
  - [x] themes/theme-checker
  - [x] resource-suffix
  - [x] `-Z force-unstable-if-unmarked`
- [x] Nightly-gated functionality (features that are gated by requiring a nightly build without needing a CLI flag or a feature gate to unlock)
  - [x] intra-links
  - [x] error numbers for `compile_fail` doctests

6 years agoRollup merge of #48909 - RalfJung:type_alias_bounds, r=petrochenkov
Alex Crichton [Fri, 23 Mar 2018 14:27:16 +0000 (09:27 -0500)]
Rollup merge of #48909 - RalfJung:type_alias_bounds, r=petrochenkov

Improve lint for type alias bounds

First of all, I learned just today that I was wrong assuming that the bounds in type aliases are entirely ignored: It turns out they are used to resolve associated types in type aliases. So:
```rust
type T1<U: Bound> = U::Assoc; // compiles
type T2<U> = U::Assoc; // fails
type T3<U> = <U as Bound>::Assoc; // "correct" way to write this, maybe?
```
I am sorry for creating this mess.

This PR changes the wording of the lint accordingly. Moreover, since just removing the bound is no longer always a possible fix, I tried to detect cases like `T1` above and show a helpful message to the user:
```
warning: bounds on generic parameters are not enforced in type aliases
  --> $DIR/type-alias-bounds.rs:57:12
   |
LL | type T1<U: Bound> = U::Assoc; //~ WARN not enforced in type aliases
   |            ^^^^^
   |
   = help: the bound will not be checked when the type alias is used, and should be removed
help: use absolute paths (i.e., <T as Trait>::Assoc) to refer to associated types in type aliases
  --> $DIR/type-alias-bounds.rs:57:21
   |
LL | type T1<U: Bound> = U::Assoc; //~ WARN not enforced in type aliases
   |                     ^^^^^^^^
```
I am not sure if I got this entirely right. Ideally, we could provide a suggestion involving the correct trait and type name -- however, while I have access to the HIR in the lint, I do not know how to get access to the resolved name information, like which trait `Assoc` belongs to above. The lint does not even run if that resolution fails, so I assume that information is available *somewhere*...

This is a follow-up for (parts of) https://github.com/rust-lang/rust/pull/48326. Also see https://github.com/rust-lang/rust/issues/21903.

This changes the name of a lint, but that lint was just merged to master yesterday and has never even been on beta.

6 years agoRollup merge of #48883 - alexcrichton:wasm-custom-sections, r=nikomatsakis
Alex Crichton [Fri, 23 Mar 2018 14:27:14 +0000 (09:27 -0500)]
Rollup merge of #48883 - alexcrichton:wasm-custom-sections, r=nikomatsakis

rustc: Add a `#[wasm_custom_section]` attribute

This commit is an implementation of adding custom sections to wasm artifacts in
rustc. The intention here is to expose the ability of the wasm binary format to
contain custom sections with arbitrary user-defined data. Currently neither our
version of LLVM nor LLD supports this so the implementation is currently custom
to rustc itself.

The implementation here is to attach a `#[wasm_custom_section = "foo"]`
attribute to any `const` which has a type like `[u8; N]`. Other types of
constants aren't supported yet but may be added one day! This should hopefully
be enough to get off the ground with *some* custom section support.

The current semantics are that any constant tagged with `#[wasm_custom_section]`
section will be *appended* to the corresponding section in the final output wasm
artifact (and this affects dependencies linked in as well, not just the final
crate). This means that whatever is interpreting the contents must be able to
interpret binary-concatenated sections (or each constant needs to be in its own
custom section).

To test this change the existing `run-make` test suite was moved to a
`run-make-fulldeps` folder and a new `run-make` test suite was added which
applies to all targets by default. This test suite currently only has one test
which only runs for the wasm target (using a node.js script to use `WebAssembly`
in JS to parse the wasm output).

6 years agoRollup merge of #48624 - bdrewery:freebsd-posix-spawn, r=alexcrichton
Alex Crichton [Fri, 23 Mar 2018 14:27:10 +0000 (09:27 -0500)]
Rollup merge of #48624 - bdrewery:freebsd-posix-spawn, r=alexcrichton

Command: Support posix_spawn() on FreeBSD/OSX/GNU Linux

6 years agoRollup merge of #48265 - SimonSapin:nonzero, r=KodrAus
Alex Crichton [Fri, 23 Mar 2018 14:27:06 +0000 (09:27 -0500)]
Rollup merge of #48265 - SimonSapin:nonzero, r=KodrAus

Add 12 num::NonZero* types for primitive integers, deprecate core::nonzero

RFC: https://github.com/rust-lang/rfcs/pull/2307
Tracking issue: ~~https://github.com/rust-lang/rust/issues/27730~~ https://github.com/rust-lang/rust/issues/49137
Fixes https://github.com/rust-lang/rust/issues/27730

6 years agoMention closures in docs for Clone and Copy
Simon Sapin [Fri, 23 Mar 2018 10:37:11 +0000 (11:37 +0100)]
Mention closures in docs for Clone and Copy

6 years agoFixed issues with incremental tests.
David Wood [Fri, 23 Mar 2018 14:04:08 +0000 (14:04 +0000)]
Fixed issues with incremental tests.

6 years agoSimplify local accessors
Oliver Schneider [Fri, 23 Mar 2018 11:44:33 +0000 (12:44 +0100)]
Simplify local accessors

6 years agoUpdated MIR with UserAssertTy in mir-opt tests.
David Wood [Fri, 23 Mar 2018 10:07:18 +0000 (10:07 +0000)]
Updated MIR with UserAssertTy in mir-opt tests.

6 years agoStabilize the copy_closures and clone_closures features
Simon Sapin [Fri, 23 Mar 2018 09:57:28 +0000 (10:57 +0100)]
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.

6 years agoadd test for issue-48238
csmoe [Fri, 23 Mar 2018 06:40:56 +0000 (14:40 +0800)]
add test for issue-48238

6 years agoDon't allocate a local array at all if there are no locals
Oliver Schneider [Fri, 23 Mar 2018 09:47:55 +0000 (10:47 +0100)]
Don't allocate a local array at all if there are no locals

6 years agoReplace uses of `Hash(Map|Set)` with `FxHash(Map|Set)` in miri
Oliver Schneider [Fri, 23 Mar 2018 09:32:27 +0000 (10:32 +0100)]
Replace uses of `Hash(Map|Set)` with `FxHash(Map|Set)` in miri

6 years agoIntroduce unsafe offset_from on pointers
Scott McMurray [Fri, 23 Mar 2018 08:30:23 +0000 (01:30 -0700)]
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`)

6 years agoVec<_> -> IndexVec<Local, _>
Oliver Schneider [Fri, 23 Mar 2018 07:31:13 +0000 (08:31 +0100)]
Vec<_> -> IndexVec<Local, _>

6 years agoAuto merge of #49285 - nrc:update, r=alexcrichton
bors [Fri, 23 Mar 2018 05:43:00 +0000 (05:43 +0000)]
Auto merge of #49285 - nrc:update, r=alexcrichton

Update RLS and Rustfmt

Fixes broken RLS tests/build

r? @alexcrichton

6 years agoci: Don't use Travis caches for docker images
Alex Crichton [Thu, 22 Mar 2018 20:39:52 +0000 (13:39 -0700)]
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 agoAllow installing rustfmt without config.extended
Josh Stone [Fri, 23 Mar 2018 01:31:32 +0000 (18:31 -0700)]
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 agoAdded flag to disable user type assertion.
David Wood [Thu, 22 Mar 2018 22:48:39 +0000 (22:48 +0000)]
Added flag to disable user type assertion.

6 years agoDebug logs for replace_bound_regions_with_nll_infer_vars
Niko Matsakis [Thu, 22 Mar 2018 18:50:42 +0000 (14:50 -0400)]
Debug logs for replace_bound_regions_with_nll_infer_vars

6 years agoUpdate RLS and Rustfmt
Nick Cameron [Thu, 22 Mar 2018 21:07:49 +0000 (10:07 +1300)]
Update RLS and Rustfmt

Fixes broken RLS tests/build

6 years agoTemporarily only adding UserAssertTy on binding patterns.
David Wood [Wed, 21 Mar 2018 19:47:08 +0000 (19:47 +0000)]
Temporarily only adding UserAssertTy on binding patterns.

6 years agoSwitched from canonicalize_query to canonicalize_response
David Wood [Tue, 20 Mar 2018 01:59:52 +0000 (01:59 +0000)]
Switched from canonicalize_query to canonicalize_response

6 years agoUserAssertTy can handle inference variables.
David Wood [Thu, 15 Mar 2018 18:49:10 +0000 (18:49 +0000)]
UserAssertTy can handle inference variables.

This commit modifies the UserAssertTy statement to take a canonicalized
type rather than a regular type so that we can handle the case where the
user provided type contains a inference variable.

6 years agoNo longer visiting user_assert_ty statements in constraint generation.
David Wood [Tue, 13 Mar 2018 14:52:23 +0000 (14:52 +0000)]
No longer visiting user_assert_ty statements in constraint generation.

6 years agoAdded comment in renumberer about UserAssertTy.
David Wood [Tue, 13 Mar 2018 14:16:53 +0000 (14:16 +0000)]
Added comment in renumberer about UserAssertTy.

6 years agoUpdated test with expected error message.
David Wood [Tue, 13 Mar 2018 14:16:14 +0000 (14:16 +0000)]
Updated test with expected error message.

6 years agoAdded override in renumberer for UserAssertTy.
David Wood [Sat, 10 Mar 2018 23:07:13 +0000 (23:07 +0000)]
Added override in renumberer for UserAssertTy.

6 years agoChanged location to at_self from at_successor.
David Wood [Fri, 2 Mar 2018 14:33:21 +0000 (14:33 +0000)]
Changed location to at_self from at_successor.

6 years agoAdded initial processing of UserAssertTy statements.
David Wood [Thu, 1 Mar 2018 14:31:14 +0000 (14:31 +0000)]
Added initial processing of UserAssertTy statements.

6 years agoKilling UserAssertTy in CleanupPostBorrowck pass.
David Wood [Fri, 23 Feb 2018 20:54:18 +0000 (20:54 +0000)]
Killing UserAssertTy in CleanupPostBorrowck pass.

6 years agoAdded UserAssertTy statement.
David Wood [Fri, 23 Feb 2018 20:52:05 +0000 (20:52 +0000)]
Added UserAssertTy statement.