Kevin Per [Thu, 11 Jul 2019 17:40:09 +0000 (19:40 +0200)]
Fixing broken tests #62401
The grouping led to a lot of `mv`. Therefore, some relative paths were
wrong. In this commit the dependent files were also moved so that the paths
work again.
bors [Thu, 15 Aug 2019 04:24:29 +0000 (04:24 +0000)]
Auto merge of #62429 - cuviper:iter-closures, r=cramertj
Reduce the genericity of closures in the iterator traits
By default, closures inherit the generic parameters of their scope,
including `Self`. However, in most cases, the closures used to implement
iterators don't need to be generic on the iterator type, only its `Item`
type. We can reduce this genericity by redirecting such closures through
local functions.
This does make the closures more cumbersome to write, but it will
hopefully reduce duplication in their monomorphizations, as well as
their related type lengths.
bors [Thu, 15 Aug 2019 00:32:05 +0000 (00:32 +0000)]
Auto merge of #63575 - Centril:rollup-anlv9g5, r=Centril
Rollup of 11 pull requests
Successful merges:
- #62984 (Add lint for excess trailing semicolons)
- #63075 (Miri: Check that a ptr is aligned and inbounds already when evaluating `*`)
- #63490 (libsyntax: cleanup and refactor `pat.rs`)
- #63507 (When needing type annotations in local bindings, account for impl Trait and closures)
- #63509 (Point at the right enclosing scope when using `await` in non-async fn)
- #63528 (syntax: Remove `DummyResult::expr_only`)
- #63537 (expand: Unimplement `MutVisitor` on `MacroExpander`)
- #63542 (Add NodeId for Arm, Field and FieldPat)
- #63543 (Merge Variant and Variant_)
- #63560 (move test that shouldn't be in test/run-pass/)
- #63570 (Adjust tracking issues for `MaybeUninit<T>` gates)
Rollup merge of #63537 - petrochenkov:novisit, r=alexcrichton
expand: Unimplement `MutVisitor` on `MacroExpander`
Each call to `fully_expand_fragment` is something unique, interesting, and requiring attention.
It represents a "root" of expansion and its use means that something unusual is happening, like eager expansion or expansion performed outside of the primary expansion pass.
So, it shouldn't hide under a generic visitor call.
Also, from all the implemented visitor methods only two were actually used.
cc https://github.com/rust-lang/rust/pull/63468#discussion_r313504119
Rollup merge of #63528 - petrochenkov:anyany, r=estebank
syntax: Remove `DummyResult::expr_only`
The effect is that if a built-in macro both returns an erroneous AST fragment and is used in unexpected position, then the incorrect position error won't be reported.
This combination of two errors should be rare and isn't worth an extra field that makes people ask questions in comments.
(There wasn't even a test making sure it worked.)
Rollup merge of #62984 - nathanwhit:extra_semi_lint, r=varkor
Add lint for excess trailing semicolons
Closes #60876.
A caveat (not necessarily a negative, but something to consider) with this implementation is that excess semicolons after return/continue/break now also cause an 'unreachable statement' warning.
For the following example:
```
fn main() {
extra_semis();
}
fn extra_semis() -> i32 {
let mut sum = 0;;;
for i in 0..10 {
if i == 5 {
continue;;
} else if i == 9 {
break;;
} else {
sum += i;;
}
}
return sum;;
}
```
The output is:
```
warning: unnecessary trailing semicolons
--> src/main.rs:5:21
|
5 | let mut sum = 0;;;
| ^^ help: remove these semicolons
|
= note: `#[warn(redundant_semicolon)]` on by default
Rollup merge of #63529 - andersk:release-notes-kleene, r=Centril
RELEASES.md: ? is one of three Kleene operators
The slash and quotes in ?/“Kleene” appeared to define “Kleene” as the name for the `?` operator, which is not the case. Rust has three Kleene operators `*`, `+`, `?`.
([Pointed out](https://www.reddit.com/r/rust/comments/cprt0z/rust_1370_prerelease_testing/ewr90y3/) by /u/Sharlinator on Reddit.)
Rollup merge of #63511 - pietroalbini:pa-ci-date, r=Mark-Simulacrum
ci: add a check for clock drift
Recently we encountered multiple spurious failures where the crates.io
certificate was reported as expired, even though it's currently due to
expire in a few months. This adds some code to our CI to check for clock
drifts, to possibly find the cause or rule out a bad VM clock.
cc https://github.com/rust-lang/rust/issues/63510
r? @Mark-Simulacrum
Rollup merge of #63499 - nikomatsakis:issuee-63388-async-fn-elision-self-mut-self, r=cramertj
handle elision in async fn correctly
We now always make fresh lifetimne parameters for all elided
lifetimes, whether they are in the inputs or outputs. But then
we generate `'_` in the case of elided lifetimes from the outputs.
Rollup merge of #63488 - RalfJung:diagnostic-docs, r=zackmdavis
improve DiagnosticBuilder docs
Cc @estebank @oli-obk
Is there any way to do something like `span_note` but with a label attached to the span? I thought `.span_note().span_label()` would do it, but no, that does not work.
Rollup merge of #63485 - pietroalbini:new-mirror-bucket, r=alexcrichton
ci: move mirrors to their standalone bucket
Currently mirrors are stored in the rust-lang-ci2 S3 bucket along with
CI toolchains. This is problematic for multiple reasons:
- CI IAM credentials are allowed to both edit and delete those files.
A malicious user gaining access to those credentials would be able to
change our mirrored dependencies, possibly compromising the compiler.
- Contents of the rust-lang-ci2 bucket are disposable except for the
mirrors' content. When we implement backups for S3 buckets we'd have
to replicate just that part of the bucket, complicating the backup
logic and increasing the chance of mistakes. A standalone bucket will
be way easier to backup.
This commit switches our CI to use the new rust-lang-ci-mirrors bucket.
Rollup merge of #63383 - Centril:async-lifetime-elision-tests, r=nikomatsakis
`async fn` lifetime elision tests
Add `async fn` version of the tests in https://github.com/rust-lang/rust/pull/61207 per the first checkbox in https://github.com/rust-lang/rust/issues/62121#issuecomment-506884048.
Works towards resolving blockers in https://github.com/rust-lang/rust/pull/63209.
Rollup merge of #62849 - davidtwco:prohibit-inheriting-lifetimes, r=nikomatsakis
typeck: Prohibit RPIT types that inherit lifetimes
Part of #61949.
This PR prohibits return position `impl Trait` types that "inherit
lifetimes" from the parent scope. The intent is to forbid cases that are
challenging until they can be addressed properly.
expand: Unimplement `MutVisitor` on `MacroExpander`
Each call to `fully_expand_fragment` is something unique, interesting, and requiring attention.
It represents a "root" of expansion and its use means that something unusual is happening, like eager expansion or expansion performed outside of the primary expansion pass.
So, it shouldn't be hide under a generic visitor call.
Also, from all the implemented visitor methods only two were actually used.
Anders Kaseorg [Tue, 13 Aug 2019 18:00:32 +0000 (11:00 -0700)]
RELEASES.md: ? is one of three Kleene operators
The slash and quotes in ?/“Kleene” appeared to define “Kleene” as the
name for the ? operator, which is not the case. Rust has three Kleene
operators *, +, ?.
Pietro Albini [Tue, 13 Aug 2019 07:36:48 +0000 (09:36 +0200)]
ci: add a check for clock drift
Recently we encountered multiple spurious failures where the crates.io
certificate was reported as expired, even though it's currently due to
expire in a few months. This adds some code to our CI to check for clock
drifts, to possibly find the cause or rule out a bad VM clock.
Esteban Küber [Tue, 13 Aug 2019 03:22:58 +0000 (20:22 -0700)]
Suggest `Box::new` when appropriate
When encountering a boxed value as expected and a stack allocated value
that could be boxed to fulfill the expectation, like in the following
snippet, suggest `Box::new` wrapping.
Josh Stone [Sat, 6 Jul 2019 01:06:06 +0000 (18:06 -0700)]
Reduce the genericity of closures in the iterator traits
By default, closures inherit the generic parameters of their scope,
including `Self`. However, in most cases, the closures used to implement
iterators don't need to be generic on the iterator type, only its `Item`
type. We can reduce this genericity by redirecting such closures through
local functions.
This does make the closures more cumbersome to write, but it will
hopefully reduce duplication in their monomorphizations, as well as
their related type lengths.
Niko Matsakis [Mon, 12 Aug 2019 21:15:33 +0000 (17:15 -0400)]
revamp how we handle elision in async fn
We now always make fresh lifetimne parameters for all elided
lifetimes, whether they are in the inputs or outputs. But then
we generate `'_` in the case of elided lifetimes from the outputs.
David Wood [Sun, 21 Jul 2019 13:37:13 +0000 (14:37 +0100)]
typeck: Prohibit RPIT types that inherit lifetimes
This commit prohibits return position `impl Trait` types that "inherit
lifetimes" from the parent scope. The intent is to forbid cases that are
challenging until they can be addressed properly.