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)
Failed merges:
r? @ghost
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`.
r? @oli-obk @estebank
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
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`.
make the backtrace field of EvalError private
This also makes sure people don't contruct these the wrong way (i.e., not through the `From` instance).
r? @oli-obk
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.
libcore/pin: Minor grammar corrections for module documentation
This is by no means exhaustive, but I noticed a few grammatical errors
when reading the documentation, and decided just to push these.
Some standard rules/guidelines I followed:
* Do not split infinitives, ie "not to move" instead of "to not move"
* Do not use "since" when you want to say "because" or "as" - the word
"since" has a temporal meaning
In addition:
* Fix a small typo: "Similarily" should be "Similarly"
* Delete double-spaces after full stop
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.
cc #61185
[const-prop] Support Rvalue::{Ref,Len} and Deref
Also fixes an ICE I found in testing.
r? @oli-obk
~~The final commit is just for a perf run. I'll remove it after that is completed.~~
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.
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.
r? @oli-obk
This is by no means exhaustive, but I noticed a few grammatical errors
when reading the documentation, and decided just to push these.
Some standard rules/guidelines I followed:
* Do not split infinitives, ie "not to move" instead of "to not move"
* Do not use "since" when you want to say "because" or "as" - the word
"since" has a temporal meaning
In addition:
* Fix a small typo: "Similarily" should be "Similarly"
* Delete double-spaces after full stop
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:
- `Token` -> `TokenKind`
- `TokenAndSpan` -> `Token`
- `(Token, Span)` -> `Token`
Some later commits (fb6e2fe8fd and 1cdee86940) 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).
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.
Change visit api
r? @oli-obk
In the [first commit](37386d366a) 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](e786f631b8) 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](e786f631b8 (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](e786f631b8 (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.