Rollup merge of #61670 - Xanewok:update-rls, r=oli-obk
Update RLS
This bumps the version to 1.37 and also doesn't build clippy by default (should reduce toolstate breakages, see https://github.com/rust-lang/rust/issues/59761#issuecomment-498616465 for more details)
bors [Sat, 8 Jun 2019 17:44:12 +0000 (17:44 +0000)]
Auto merge of #61655 - RalfJung:checktools, r=kennytm
checktools: unify grepping the TOOLSTATE file
The file was grepped twice but in a different way. This unifies the code to make sure it is consistent. Or were these deliberately not doing the same thing? That seems strange though.
bors [Sat, 8 Jun 2019 07:20:57 +0000 (07:20 +0000)]
Auto merge of #61635 - ecstatic-morse:const-signum, r=oli-obk
Make `i*::signum` a `const fn`.
Ticks a box in #53718.
This uses a well-known branchless implementation of `signum`: `(n > 0) as i32 - (n < 0) as i32`.
Here's a [playground](https://play.rust-lang.org/?version=nightly&mode=release&edition=2018&gist=747cf191c4974bf66c9d75e509ae6e6e) comparing the two techniques. On x86 in release mode, the branchless implementation is able to replace a `mov` and `cmov` with a `sar` and `add`, so this should be a bit faster as well.
~~This is marked as a draft since I think I'll need to add `#[rustc_const_unstable]` somewhere. Perhaps the reviewer can point me in the right direction.~~
bors [Sat, 8 Jun 2019 01:34:53 +0000 (01:34 +0000)]
Auto merge of #61649 - Centril:rollup-b4nx9k9, r=Centril
Rollup of 7 pull requests
Successful merges:
- #61223 (Document tuple's Ord behavior as sequential)
- #61615 (syntax: Treat error literals in more principled way)
- #61616 (parser: Remove `Deref` impl from `Parser`)
- #61621 (Clarify when we run steps with ONLY_HOSTS)
- #61627 (Add regression test for #61452.)
- #61641 (Revert "Make LocalAnalizer visitor iterate instead of recurse")
- #61647 (Use stable wrappers in f32/f64::signum)
Rollup merge of #61616 - petrochenkov:parsderef, r=oli-obk
parser: Remove `Deref` impl from `Parser`
Follow up to https://github.com/rust-lang/rust/pull/61541
You have to write `self.token.span` instead of `self.span` in the parser now, which is not nice, but not too bad either, I guess.
Not sure.
Probably still better than people using both and being confused about the definition point of `span`.
Rollup merge of #61615 - petrochenkov:errlit, r=matklad
syntax: Treat error literals in more principled way
Free them from their character literal origins.
I actually tried to remove `LitKind::Err` entirely (by converting it into `ExprKind::Err` immediately), and it caused no diagnostic regressions in the test suite.
However, I'd still want to use error literals as general purpose error tokens some day, so I kept them.
The downside of having `LitKind::Err` in addition to `ExprKind::Err` is that every time you want to do something with `ExprKind::Err` you need to make sure that `ExprKind::Lit(LitKind::Err)` is treated in the same way.
Fortunately, this usually happens automatically because both literals and errors are "leaf" expressions, however this PR does fix a couple of inconsistencies between them.
Addresses https://github.com/rust-lang/rust/pull/60679#discussion_r282640663 in a way
bors [Fri, 7 Jun 2019 18:26:15 +0000 (18:26 +0000)]
Auto merge of #61130 - jonhoo:mem-take, r=SimonSapin
Add std::mem::take as suggested in #61129
This PR implements #61129 by adding `std::mem::take`.
The added function is equivalent to:
```rust
std::mem::replace(dest, Default::default())
```
This particular pattern is fairly common, especially when implementing `Future::poll`, where you often need to yield an owned value in `Async::Ready`. This change allows you to write
```rust
return Async::Ready(std::mem::take(self.result));
```
instead of
```rust
return Async::Ready(std::mem::replace(self.result, Vec::new()));
```
EDIT: Changed name from `take` to `swap_default`.
EDIT: Changed name back to `take`.
bors [Fri, 7 Jun 2019 14:50:22 +0000 (14:50 +0000)]
Auto merge of #61622 - Centril:rollup-6ivvmul, r=Centril
Rollup of 7 pull requests
Successful merges:
- #61332 (Remove asterisk suggestion for move errors in borrowck)
- #61532 ([const-prop] Support Rvalue::{Ref,Len} and Deref)
- #61586 (ci: Disable LLVM/debug assertions for asmjs builder)
- #61599 (libcore/pin: Minor grammar corrections for module documentation)
- #61603 (Increases heap size available during testing for SGX)
- #61605 (Fix slice const generic length display)
- #61618 (make the backtrace field of EvalError private)
Rollup merge of #61603 - Goirad:increase-sgx-heapsize, r=alexcrichton
Increases heap size available during testing for SGX
PR [61540](https://github.com/rust-lang/rust/pull/61540) causes at least one test to fail when run for the SGX platform due to lack of memory. This PR increases the heapsize available during tests, which is a good thing regardless of the status of that PR.
Rollup merge of #61586 - alexcrichton:asmjs-no-assertions, r=pietroalbini
ci: Disable LLVM/debug assertions for asmjs builder
This shaves of 50 minutes of cycle time on Azure and will likely also
save a significant chunk of time on Travis. The assertions here aren't
really buying us much over other builders with assertions already
enabled, so let's disable them for this builder.
Rollup merge of #61332 - kennethbgoodin:borrowck-remove-asterisk-suggestion, r=matthewjasper
Remove asterisk suggestion for move errors in borrowck
As per the decision in #54985 completely removes the suggestion to add an asterisk when checking move errors. I believe I've preserved the correct behavior with the "consider borrowing here" branch of the original match arm, but I'm not positive on that.
This is my first PR to rustc so any feedback is greatly appreciated. Thanks.
bors [Fri, 7 Jun 2019 09:41:06 +0000 (09:41 +0000)]
Auto merge of #61209 - matthewjasper:const-tuple-constructors, r=oli-obk
Make tuple constructors real const fns
Mir construction special cases `Ctor(...)` to be lowered as `Ctor { 0: ... }`, which means this doesn't come up much in practice, but it seems inconsistent not to allow this.
bors [Fri, 7 Jun 2019 06:52:09 +0000 (06:52 +0000)]
Auto merge of #61541 - petrochenkov:tsp, r=oli-obk
syntax: Keep token span as a part of `Token`
In the world with proc macros and edition hygiene `Token` without a span is not self-contained.
In practice this means that tokens and spans are always stored and passed somewhere along with each other.
This PR combines them into a single struct by doing the next renaming/replacement:
Some later commits (https://github.com/rust-lang/rust/commit/fb6e2fe8fd6caed247857758c6c3549fe2b59527 and https://github.com/rust-lang/rust/commit/1cdee86940db892cd17239c26add5364335e895a) remove duplicate spans in `token::Ident` and `token::Lifetime`.
Those spans were supposed to be identical to token spans, but could easily go out of sync, as was noticed in https://github.com/rust-lang/rust/pull/60965#discussion_r285398523.
The `(Token, Span)` -> `Token` change is a soft pre-requisite for this de-duplication since it allows to avoid some larger churn (passing spans to most of functions classifying identifiers).
bors [Fri, 7 Jun 2019 01:42:15 +0000 (01:42 +0000)]
Auto merge of #61408 - varkor:fmin-fmax-llvm-intrinsics, r=alexcrichton
Use LLVM intrinsics for floating-point min/max
Resurrection of https://github.com/rust-lang/rust/pull/46926, now that the optimisation issues are fixed. I've confirmed locally that https://github.com/rust-lang/rust/pull/61384 solves the issues.
I'm not sure if we're allowed to move the `min`/`max` methods from libcore to libstd: I can't quite tell what the status is from https://github.com/rust-lang/rust/issues/50145. However, this is necessary to use the intrinsics.
Rollup merge of #61559 - spastorino:make-visitors-iterate, r=oli-obk
Make visitors iterate
r? @oli-obk
The second commit is not completely equivalent, unsure if the code is wrong or not. Tests pass though, otherwise we would need to iterate in the opposite direction as it happened in other parts of the code.
Rollup merge of #61554 - spastorino:change_visit_api, r=oli-obk
Change visit api
r? @oli-obk
In the [first commit](https://github.com/rust-lang/rust/commit/37386d366a816bc2e63749c7b6045108a6167135) of this PR, I'm changing `visit_place` to be the function that traverses the `Place` and have only that responsibility. Then there are two other functions `visit_place_base` and `visit_projection` which are the ones in charge of visiting the base and the projection. Visitor implementors can implement any of those.
In the [second commit](https://github.com/rust-lang/rust/commit/e786f631b815d171051279e0d6cfe055c75bec2e) we can already see some things that confuses me, which I think this division will make more clear. The old code, first checked if the place was a base, did something with it and then called `super_place` [here](https://github.com/rust-lang/rust/commit/e786f631b815d171051279e0d6cfe055c75bec2e#diff-d583e4efe1a72516e274158e53223633L678). `super_place` checks again if it's a base [here](https://github.com/rust-lang/rust/blob/master/src/librustc/mir/visit.rs#L679-L684) and in case is a local, visits the local and stuff like that. That's not very obvious on the code, and if I'm not wrong it's not needed. In this PR or we have [this](https://github.com/rust-lang/rust/commit/e786f631b815d171051279e0d6cfe055c75bec2e#diff-d583e4efe1a72516e274158e53223633R673) as I did or we can just do `- => self.super_place_base(...)` and that will be obvious that I'm letting the default implementation process the base.
Alex Crichton [Thu, 6 Jun 2019 14:57:37 +0000 (07:57 -0700)]
ci: Disable LLVM/debug assertions for asmjs builder
This shaves of 50 minutes of cycle time on Azure and will likely also
save a significant chunk of time on Travis. The assertions here aren't
really buying us much over other builders with assertions already
enabled, so let's disable them for this builder.
Rollup merge of #61557 - alexcrichton:build-less, r=pietroalbini
rustbuild: Include `rustfmt` in deduplicated dependencies
Currently `rustfmt` is excluded from the "don't build dependencies
twice" check but it's currently building dependencies twice! Namely big
dependencies like `rustc-ap-syntax` are built once for rustfmt and once
for the RLS. This commit includes `rustfmt` in these checks and then
fixes the resulting feature mismatches for winapi.
The proper name of the library is `annotate-snippet`, not `annotate-rs`,
this PR should get rid of any confusing `AnnotateRs` names.
1. Renames `annotate_rs_emitter.rs` to
`annotate_snippet_emitter_writer.rs` so that the difference between the
`Emitter` trait and the implementers is more clear.
2. Renames `AnnotateRsEmitterWriter` to `AnnotateSnippetEmitterWriter`
3. Renames `HumanReadableErrorType::AnnotateRs` to `HumanReadableErrorType::AnnotateSnippet`