]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agomiddle::dead -> rustc_passes
Mark Rousskov [Fri, 4 Oct 2019 14:33:11 +0000 (10:33 -0400)]
middle::dead -> rustc_passes

4 years agomove middle::liveness to rustc_passes
Mark Rousskov [Fri, 4 Oct 2019 14:31:28 +0000 (10:31 -0400)]
move middle::liveness to rustc_passes

4 years agoAuto merge of #65087 - Centril:rollup-skxq0zr, r=Centril
bors [Fri, 4 Oct 2019 07:27:59 +0000 (07:27 +0000)]
Auto merge of #65087 - Centril:rollup-skxq0zr, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #64749 (Fix most remaining Polonius test differences)
 - #64817 (Replace ClosureSubsts with SubstsRef)
 - #64874 (Simplify ExprUseVisitor)
 - #65026 (metadata: Some crate loading cleanup)
 - #65073 (Remove `borrowck_graphviz_postflow` from test)

Failed merges:

r? @ghost

4 years agoRollup merge of #65073 - ecstatic-morse:issue-65071, r=petrochenkov
Mazdak Farrokhzad [Fri, 4 Oct 2019 05:24:39 +0000 (07:24 +0200)]
Rollup merge of #65073 - ecstatic-morse:issue-65071, r=petrochenkov

Remove `borrowck_graphviz_postflow` from test

Resolves #65071.

r? @petrochenkov

4 years agoRollup merge of #65026 - petrochenkov:ice1, r=eddyb
Mazdak Farrokhzad [Fri, 4 Oct 2019 05:24:37 +0000 (07:24 +0200)]
Rollup merge of #65026 - petrochenkov:ice1, r=eddyb

metadata: Some crate loading cleanup

So, my goal was to fix caching of loaded crates which is broken and causes ICEs like #56935 or #64450.
While investigating I found that the code is pretty messy and likes to confuse various things that look similar but are actually different.
This PR does some initial cleanup in that area, I hope to get to the caching itself a bit later.

4 years agoRollup merge of #64874 - matthewjasper:simplify-euv, r=eddyb
Mazdak Farrokhzad [Fri, 4 Oct 2019 05:24:36 +0000 (07:24 +0200)]
Rollup merge of #64874 - matthewjasper:simplify-euv, r=eddyb

Simplify ExprUseVisitor

* Remove HIR const qualification
* Remove parts of ExprUseVisitor that aren't being used

r? @eddyb

4 years agoRollup merge of #64817 - csmoe:closure, r=nikomatsakis
Mazdak Farrokhzad [Fri, 4 Oct 2019 05:24:34 +0000 (07:24 +0200)]
Rollup merge of #64817 - csmoe:closure, r=nikomatsakis

Replace ClosureSubsts with SubstsRef

Addresses https://github.com/rust-lang/rust/issues/42340 part 3
https://github.com/rust-lang/rust/pull/59312 might benefit from this clean up.
r? @nikomatsakis

4 years agoRollup merge of #64749 - matthewjasper:liveness-opt, r=nikomatsakis
Mazdak Farrokhzad [Fri, 4 Oct 2019 05:24:33 +0000 (07:24 +0200)]
Rollup merge of #64749 - matthewjasper:liveness-opt, r=nikomatsakis

Fix most remaining Polonius test differences

This fixes most of the Polonius test differences and also avoids overflow in issue-38591.rs.

r? @nikomatsakis

4 years agoAuto merge of #65076 - tmandry:rollup-ka7nzb6, r=tmandry
bors [Thu, 3 Oct 2019 23:29:48 +0000 (23:29 +0000)]
Auto merge of #65076 - tmandry:rollup-ka7nzb6, r=tmandry

Rollup of 11 pull requests

Successful merges:

 - #61879 (Stabilize todo macro)
 - #64675 (Deprecate `#![plugin]` & `#[plugin_registrar]`)
 - #64690 (proc_macro API: Expose `macro_rules` hygiene)
 - #64706 (add regression test for #60218)
 - #64741 (Prevent rustdoc feature doctests)
 - #64842 (Disallow Self in type param defaults of ADTs)
 - #65004 (Replace mentions of IRC with Discord)
 - #65018 (Set RUST_BACKTRACE=0 in tests that include a backtrace in stderr)
 - #65055 (Add long error explanation for E0556)
 - #65056 (Make visit projection iterative)
 - #65057 (typo: fix typo in E0392)

Failed merges:

r? @ghost

4 years agoRollup merge of #65057 - mathstuf:fix-warning-typo, r=Centril
Tyler Mandry [Thu, 3 Oct 2019 23:25:51 +0000 (16:25 -0700)]
Rollup merge of #65057 - mathstuf:fix-warning-typo, r=Centril

typo: fix typo in E0392

See #64931.

---
Cc: @Centril @estebank
4 years agoRollup merge of #65056 - spastorino:place-mut-visitor-adjusts, r=oli-obk
Tyler Mandry [Thu, 3 Oct 2019 23:25:49 +0000 (16:25 -0700)]
Rollup merge of #65056 - spastorino:place-mut-visitor-adjusts, r=oli-obk

Make visit projection iterative

r? @oli-obk

/cc @nikomatsakis

4 years agoRollup merge of #65055 - GuillaumeGomez:long-err-explanation-E0556, r=petrochenkov
Tyler Mandry [Thu, 3 Oct 2019 23:25:47 +0000 (16:25 -0700)]
Rollup merge of #65055 - GuillaumeGomez:long-err-explanation-E0556, r=petrochenkov

Add long error explanation for E0556

Part of #61137

4 years agoRollup merge of #65018 - Aaron1011:fix/backtrace-stderr, r=nikomatsakis
Tyler Mandry [Thu, 3 Oct 2019 23:25:46 +0000 (16:25 -0700)]
Rollup merge of #65018 - Aaron1011:fix/backtrace-stderr, r=nikomatsakis

Set RUST_BACKTRACE=0 in tests that include a backtrace in stderr

This removes the implicit dependency on the environment variables set
when running `./x.py test`

4 years agoRollup merge of #65004 - BO41:mentions, r=alexcrichton
Tyler Mandry [Thu, 3 Oct 2019 23:25:44 +0000 (16:25 -0700)]
Rollup merge of #65004 - BO41:mentions, r=alexcrichton

Replace mentions of IRC with Discord

Revival of #61531

closes #61524

what was the outcome of this? https://github.com/rust-lang/rust/pull/61531#issuecomment-500452638

should this be changed in this PR as well? https://github.com/rust-lang/rust/pull/61531#issuecomment-501473787

4 years agoRollup merge of #64842 - pnkfelix:fix-issue-61631-self-in-type-param-default, r=alexreg
Tyler Mandry [Thu, 3 Oct 2019 23:25:43 +0000 (16:25 -0700)]
Rollup merge of #64842 - pnkfelix:fix-issue-61631-self-in-type-param-default, r=alexreg

Disallow Self in type param defaults of ADTs

Fix #61631

(also includes a drive-by fix to a typo in some related diagnostic output.)

4 years agoRollup merge of #64741 - GuillaumeGomez:prevent-rustdoc-feature-doctests, r=QuietMisd...
Tyler Mandry [Thu, 3 Oct 2019 23:25:41 +0000 (16:25 -0700)]
Rollup merge of #64741 - GuillaumeGomez:prevent-rustdoc-feature-doctests, r=QuietMisdreavus

Prevent rustdoc feature doctests

Part of https://github.com/rust-lang/rust/pull/61351

cc @ollie27

4 years agoRollup merge of #64706 - nikomatsakis:issue-60218-test-case, r=centril
Tyler Mandry [Thu, 3 Oct 2019 23:25:40 +0000 (16:25 -0700)]
Rollup merge of #64706 - nikomatsakis:issue-60218-test-case, r=centril

add regression test for #60218

Fixes #60218

4 years agoRollup merge of #64690 - petrochenkov:mixed, r=dtolnay
Tyler Mandry [Thu, 3 Oct 2019 23:25:39 +0000 (16:25 -0700)]
Rollup merge of #64690 - petrochenkov:mixed, r=dtolnay

proc_macro API: Expose `macro_rules` hygiene

Proc macros do not have direct access to our oldest and most stable hygiene kind - `macro_rules` hygiene.

To emulate it macro authors have to go through two steps - first generate a temporary `macro_rules` item (using a derive, at least until https://github.com/rust-lang/rust/pull/64035 is merged), then generate a macro call to that item. Popular crates like [proc_macro_hack](https://crates.io/crates/proc-macro-hack) use this trick to generate hygienic identifiers from proc macros.

I'd say that these workarounds with nested macro definitions have more chances to hit some corner cases in our hygiene system, in which we don't have full confidence.
So, let's provide a direct access to `macro_rules` hygiene instead.

This PR does that by adding a new method `Span::mixed_site` (bikeshedding is welcome) in addition to existing `Span::call_site` (stable) and `Span::def_site` (unstable).
Identifiers with this span resolve at def-site in for local variables, labels and `$crate`, and resolve at call-site for everything else, i.e. exactly like identifiers produced by `macro_rules`.

This API addition opens the way to stabilizing proc macros in expression positions (https://github.com/rust-lang/rust/issues/54727), for which use of call-site hygiene or workarounds with temporary items would be quite unfortunate.
(`macro_rules` expanded in expression position, on the other hand, are stable since 1.0 and widely used.)

r? @dtolnay @alexcrichton

4 years agoRollup merge of #64675 - Centril:deprecate-plugin, r=oli-obk
Tyler Mandry [Thu, 3 Oct 2019 23:25:37 +0000 (16:25 -0700)]
Rollup merge of #64675 - Centril:deprecate-plugin, r=oli-obk

Deprecate `#![plugin]` & `#[plugin_registrar]`

This PR deprecates `#![plugin]` and `#[plugin_registrar]`.

~A removal deadline is set: 1.44.0. This will be in 9 months from now and should give everyone who is still relying on the feature ample time to rid themselves of this dependency.~

cc https://github.com/rust-lang/rust/issues/29597

r? @Mark-Simulacrum

4 years agoRollup merge of #61879 - stjepang:stabilize-todo, r=withoutboats
Tyler Mandry [Thu, 3 Oct 2019 23:25:35 +0000 (16:25 -0700)]
Rollup merge of #61879 - stjepang:stabilize-todo, r=withoutboats

Stabilize todo macro

The `todo!` macro is just another name for `unimplemented!`.

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

This PR needs a FCP to merge.

r? @withoutboats

4 years agoBless test
Dylan MacKenzie [Thu, 3 Oct 2019 22:51:11 +0000 (15:51 -0700)]
Bless test

4 years agometadata: Remove unused `Option` from `fn dlsym_proc_macros`
Vadim Petrochenkov [Wed, 2 Oct 2019 19:31:11 +0000 (22:31 +0300)]
metadata: Remove unused `Option` from `fn dlsym_proc_macros`

4 years agometadata: Remove `CrateMetadata::name`
Vadim Petrochenkov [Wed, 2 Oct 2019 00:15:38 +0000 (03:15 +0300)]
metadata: Remove `CrateMetadata::name`

It duplicates `CrateRoot::name`

4 years agometadata: Remove `CrateMetadata::host_lib`
Vadim Petrochenkov [Tue, 1 Oct 2019 23:47:36 +0000 (02:47 +0300)]
metadata: Remove `CrateMetadata::host_lib`

It was only used for retreiving edition, which was a bug.
In case of dual proc macros the edition should be taken from the target crate version, like any other metadata.

4 years agometadata: Simplify interface of `resolve_crate`
Vadim Petrochenkov [Sun, 29 Sep 2019 18:14:29 +0000 (21:14 +0300)]
metadata: Simplify interface of `resolve_crate`

4 years agometadata: Remove `locator::Context::ident`
Vadim Petrochenkov [Sun, 29 Sep 2019 17:16:23 +0000 (20:16 +0300)]
metadata: Remove `locator::Context::ident`

It's a crate name after renaming, so it's entirely irrelevant to crate loading

4 years agometadata: Do not pass crate name after renaming to `register_crate`
Vadim Petrochenkov [Sun, 29 Sep 2019 16:34:51 +0000 (19:34 +0300)]
metadata: Do not pass crate name after renaming to `register_crate`

It's entirely irrelevant to crate loading

4 years agometadata: Remove `CrateMetadata::imported_name`
Vadim Petrochenkov [Sun, 29 Sep 2019 15:51:09 +0000 (18:51 +0300)]
metadata: Remove `CrateMetadata::imported_name`

It's entirely irrelevant to crate loading

4 years agoRemove `borrowck_graphviz_postflow` from test
Dylan MacKenzie [Wed, 2 Oct 2019 22:35:59 +0000 (15:35 -0700)]
Remove `borrowck_graphviz_postflow` from test

4 years agoRegression tests.
Felix S. Klock II [Fri, 27 Sep 2019 13:21:16 +0000 (15:21 +0200)]
Regression tests.

Update: incorporate review feedback.

4 years agoAuto merge of #64938 - estebank:ice-ice-baby, r=matthewjasper
bors [Thu, 3 Oct 2019 16:14:32 +0000 (16:14 +0000)]
Auto merge of #64938 - estebank:ice-ice-baby, r=matthewjasper

Avoid ICE on ReFree region on where clause

Fix #64855.

4 years agoMake visit_projection iterative
Santiago Pastorino [Wed, 2 Oct 2019 22:11:08 +0000 (19:11 -0300)]
Make visit_projection iterative

4 years agotypo: fix typo in E0392
Ben Boeckel [Thu, 3 Oct 2019 13:21:15 +0000 (09:21 -0400)]
typo: fix typo in E0392

See #64931.

4 years agoAuto merge of #64999 - nikomatsakis:issue-60424-async-return-inference, r=cramertj
bors [Thu, 3 Oct 2019 12:19:21 +0000 (12:19 +0000)]
Auto merge of #64999 - nikomatsakis:issue-60424-async-return-inference, r=cramertj

extract expected return type for async fn generators

Fixes #60424

cc @Centril, I know you've been eager to see this fixed.

r? @cramertj

4 years agoupdate ui tests
Guillaume Gomez [Thu, 3 Oct 2019 12:11:39 +0000 (14:11 +0200)]
update ui tests

4 years agoAdd long error explanation for E0556
Guillaume Gomez [Thu, 3 Oct 2019 12:11:31 +0000 (14:11 +0200)]
Add long error explanation for E0556

4 years agoAllocate a new diagnostic for defaulted type parameters cannot use `Self`
Felix S. Klock II [Fri, 27 Sep 2019 13:21:02 +0000 (15:21 +0200)]
Allocate a new diagnostic for defaulted type parameters cannot use `Self`

(Without this commit, you still get an error (a very similar one, at
that), but it complains about use of forward declaration, which is
confusing since people do not necessarily think of `Self` as being
declared at all.)

Update: incorporate review feedback.

4 years agoThe crux of the bug fix.
Felix S. Klock II [Fri, 27 Sep 2019 12:45:19 +0000 (14:45 +0200)]
The crux of the bug fix.

Update: review feedback
Update: placate tidy

4 years agogenerate ClosureSubsts from SubstsRef
csmoe [Thu, 26 Sep 2019 17:30:44 +0000 (17:30 +0000)]
generate ClosureSubsts from SubstsRef

4 years agoadd regression test for #60218
Niko Matsakis [Fri, 20 Sep 2019 20:54:27 +0000 (16:54 -0400)]
add regression test for #60218

4 years agoproc_macro: Add `Span::mixed_site` exposing `macro_rules` hygiene
Vadim Petrochenkov [Sun, 22 Sep 2019 15:38:02 +0000 (18:38 +0300)]
proc_macro: Add `Span::mixed_site` exposing `macro_rules` hygiene

4 years ago./x.py test --bless --compare-mode=nll
Niko Matsakis [Thu, 3 Oct 2019 08:20:51 +0000 (04:20 -0400)]
./x.py test --bless --compare-mode=nll

4 years ago--bless ui-fulldeps tests
Mazdak Farrokhzad [Thu, 3 Oct 2019 07:33:28 +0000 (09:33 +0200)]
--bless ui-fulldeps tests

4 years agoAuto merge of #65045 - Centril:rollup-djvi539, r=Centril
bors [Thu, 3 Oct 2019 06:05:08 +0000 (06:05 +0000)]
Auto merge of #65045 - Centril:rollup-djvi539, r=Centril

Rollup of 2 pull requests

Successful merges:

 - #64941 (Inline `{min,max}_value` even in debug builds)
 - #65002 (Update llvm-project submodule)

Failed merges:

r? @ghost

4 years agoRollup merge of #65002 - alexcrichton:update-lvlm, r=nikic
Mazdak Farrokhzad [Thu, 3 Oct 2019 06:04:34 +0000 (08:04 +0200)]
Rollup merge of #65002 - alexcrichton:update-lvlm, r=nikic

Update llvm-project submodule

Bring in rust-lang/llvm-project#24 which brings in some wasm
improvements related to the bulk-memory proposal

4 years agoRollup merge of #64941 - lzutao:inline-max_min_value, r=nnethercote
Mazdak Farrokhzad [Thu, 3 Oct 2019 06:04:33 +0000 (08:04 +0200)]
Rollup merge of #64941 - lzutao:inline-max_min_value, r=nnethercote

Inline `{min,max}_value` even in debug builds

I think it is worth to inline `{min,max}_value` even in debug builds.
link: https://godbolt.org/z/-COkVS
4 years agoplugin_registrary: use normal deprecation instead of hard coded warning.
Mazdak Farrokhzad [Thu, 3 Oct 2019 04:46:17 +0000 (06:46 +0200)]
plugin_registrary: use normal deprecation instead of hard coded warning.

4 years agoDeprecate `#![plugin]` and `#[plugin_registrar]`.
Mazdak Farrokhzad [Sat, 21 Sep 2019 23:32:51 +0000 (01:32 +0200)]
Deprecate `#![plugin]` and `#[plugin_registrar]`.

4 years agoAdd visit_projection_elem method to visitors
Santiago Pastorino [Wed, 2 Oct 2019 21:03:23 +0000 (18:03 -0300)]
Add visit_projection_elem method to visitors

4 years agoAuto merge of #65038 - Centril:rollup-m83dpfh, r=Centril
bors [Thu, 3 Oct 2019 02:08:53 +0000 (02:08 +0000)]
Auto merge of #65038 - Centril:rollup-m83dpfh, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #63678 (Improve HRTB error span when -Zno-leak-check is used)
 - #64931 (Reword E0392 slightly)
 - #64959 (syntax: improve parameter without type suggestions)
 - #64975 (Implement Clone::clone_from for LinkedList)
 - #64993 (BacktraceStatus: add Eq impl)
 - #64998 (Filter out RLS output directories on tidy runs)
 - #65010 (Compare `primary` with maximum of `children`s' line num instead of dropping it)

Failed merges:

r? @ghost

4 years agoRollup merge of #65010 - AnthonyMikh:fix_65001, r=estebank
Mazdak Farrokhzad [Thu, 3 Oct 2019 02:08:19 +0000 (04:08 +0200)]
Rollup merge of #65010 - AnthonyMikh:fix_65001, r=estebank

Compare `primary` with maximum of `children`s' line num instead of dropping it

Fix #65001.

4 years agoRollup merge of #64998 - spastorino:filter-rls-on-tidy, r=petrochenkov
Mazdak Farrokhzad [Thu, 3 Oct 2019 02:08:18 +0000 (04:08 +0200)]
Rollup merge of #64998 - spastorino:filter-rls-on-tidy, r=petrochenkov

Filter out RLS output directories on tidy runs

Closes #64957

r? @petrochenkov

4 years agoRollup merge of #64993 - mathstuf:backtrace-status-eq, r=withoutboats
Mazdak Farrokhzad [Thu, 3 Oct 2019 02:08:17 +0000 (04:08 +0200)]
Rollup merge of #64993 - mathstuf:backtrace-status-eq, r=withoutboats

BacktraceStatus: add Eq impl

See discussion on #53487.

---
Is adding `Copy` too ambitious? It's a "status", so I don't forsee any non-POD data that might go in there, but it would restrict future variants more than `Eq` does.

Cc: @withoutboats @abonander
4 years agoRollup merge of #64975 - crgl:clone-from-linked-list, r=bluss
Mazdak Farrokhzad [Thu, 3 Oct 2019 02:08:15 +0000 (04:08 +0200)]
Rollup merge of #64975 - crgl:clone-from-linked-list, r=bluss

Implement Clone::clone_from for LinkedList

See #28481. This represents a substantial speedup when the list sizes are comparable, and shouldn't ever be significantly worse. Technically split_off is doing an unnecessary search, but the code is hopefully cleaner as a result. I'm happy to rework anything that needs to be changed as well!

4 years agoRollup merge of #64959 - davidtwco:issue-64252-self-type-help, r=Centril,estebank
Mazdak Farrokhzad [Thu, 3 Oct 2019 02:08:14 +0000 (04:08 +0200)]
Rollup merge of #64959 - davidtwco:issue-64252-self-type-help, r=Centril,estebank

syntax: improve parameter without type suggestions

Fixes #64252.

This PR improves the suggestions provided when function parameters
do not have types:

- A new suggestion is added for arbitrary self types, which suggests
adding `self: ` before the type.

- Existing suggestions are now provided when a `<` is found where a `:`
was expected (previously only `,` and `)` or trait items), this gives
suggestions in the case where the unnamed parameter type is generic
in a free function.

- The suggestion that a type name be provided (e.g. `fn foo(HashMap<u32>)`
-> `fn foo(HashMap: TypeName<u32>)`) will no longer occur when a `<` was
found instead of `:`.

- The ident will not be used for recovery when a `<` was found instead
of `:`.

r? @Centril
cc @estebank @yoshuawuyts

4 years agoRollup merge of #64931 - estebank:missing-param-ref, r=matthewjasper,Centril
Mazdak Farrokhzad [Thu, 3 Oct 2019 02:08:12 +0000 (04:08 +0200)]
Rollup merge of #64931 - estebank:missing-param-ref, r=matthewjasper,Centril

Reword E0392 slightly

Make it clearer that a type or lifetime argument not being used can be
fixed by referencing it in a struct's fields, not just using `PhathomData`.

CC #53589.

4 years agoRollup merge of #63678 - Aaron1011:fix/hrtb-leak, r=nikomatsakis
Mazdak Farrokhzad [Thu, 3 Oct 2019 02:08:11 +0000 (04:08 +0200)]
Rollup merge of #63678 - Aaron1011:fix/hrtb-leak, r=nikomatsakis

Improve HRTB error span when -Zno-leak-check is used

As described in #57374, NLL currently produces unhelpful higher-ranked
trait bound (HRTB) errors when '-Zno-leak-check' is enabled.

This PR tackles one half of this issue - making the error message point
at the proper span. The error message itself is still the very generic
"higher-ranked subtype error", but this can be improved in a follow-up
PR.

The root cause of the bad spans lies in how NLL attempts to compute the
'blamed' region, for which it will retrieve a span for.
Consider the following code, which (correctly) does not compile:

```rust
let my_val: u8 = 25;
let a: &u8 = &my_val;
let b = a;
let c = b;
let d: &'static u8 = c;
```

This will cause NLL to generate the following subtype constraints:

d :< c
c :< b
b <: a

Since normal Rust lifetimes are covariant, this results in the following
region constraints (I'm using 'd to denote the lifetime of 'd',
'c to denote the lifetime of 'c, etc.):

'c: 'd
'b: 'c
'a: 'b

From this, we can derive that 'a: 'd holds, which implies that 'a: 'static
must hold. However, this is not the case, since 'a refers to 'my_val',
which does not outlive the current function.

When NLL attempts to infer regions for this code, it will see that the
region 'a has grown 'too large' - it will be inferred to outlive
'static, despite the fact that is not declared as outliving 'static
We can find the region responsible, 'd, by starting at the *end* of
the 'constraint chain' we generated above. This works because for normal
(non-higher-ranked) lifetimes, we generally build up a 'chain' of
lifetime constraints *away* from the original variable/lifetime.
That is, our original lifetime 'a is required to outlive progressively
more regions. If it ends up living for too long, we can look at the
'end' of this chain to determine the 'most recent' usage that caused
the lifetime to grow too large.

However, this logic does not work correctly when higher-ranked trait
bounds (HRTBs) come into play. This is because HRTBs have
*contravariance* with respect to their bound regions. For example,
this code snippet compiles:

```rust
let a: for<'a> fn(&'a ()) = |_| {};
let b: fn(&'static ()) = a;
```

Here, we require that 'a' is a subtype of 'b'. Because of
contravariance, we end up with the region constraint 'static: 'a,
*not* 'a: 'static

This means that our 'constraint chains' grow in the opposite direction
of 'normal lifetime' constraint chains. As we introduce subtypes, our
lifetime ends up being outlived by other lifetimes, rather than
outliving other lifetimes. Therefore, starting at the end of the
'constraint chain' will cause us to 'blame' a lifetime close to the original
definition of a variable, instead of close to where the bad lifetime
constraint is introduced.

This PR improves how we select the region to blame for 'too large'
universal lifetimes, when bound lifetimes are involved. If the region
we're checking is a 'placeholder' region (e.g. the region 'a' in
for<'a>, or the implicit region in fn(&())), we start traversing the
constraint chain from the beginning, rather than the end.

There are two (maybe more) different ways we generate region constraints for NLL:
requirements generated from trait queries, and requirements generated
from MIR subtype constraints. While the former always use explicit
placeholder regions, the latter is more tricky. In order to implement
contravariance for HRTBs, TypeRelating replaces placeholder regions with
existential regions. This requires us to keep track of whether or not an
existential region was originally a placeholder region. When we look for
a region to blame, we check if our starting region is either a
placeholder region or is an existential region created from a
placeholder region. If so, we start iterating from the beginning of the
constraint chain, rather than the end.

4 years agoreview comments
Esteban Küber [Wed, 2 Oct 2019 22:53:36 +0000 (15:53 -0700)]
review comments

4 years agofix example (le sigh)
Niko Matsakis [Wed, 2 Oct 2019 22:45:44 +0000 (18:45 -0400)]
fix example (le sigh)

4 years agoadd unsize slice-str coercion
Niko Matsakis [Wed, 2 Oct 2019 22:13:40 +0000 (18:13 -0400)]
add unsize slice-str coercion

4 years agoreview comment
Esteban Küber [Wed, 2 Oct 2019 19:26:49 +0000 (12:26 -0700)]
review comment

4 years agoMake lifetimes in constants live at the point of use
Matthew Jasper [Tue, 24 Sep 2019 20:55:49 +0000 (21:55 +0100)]
Make lifetimes in constants live at the point of use

4 years agoCalculate liveness for the same locals with and without -Zpolonius
Matthew Jasper [Sat, 21 Sep 2019 15:32:24 +0000 (16:32 +0100)]
Calculate liveness for the same locals with and without -Zpolonius

This fixes some test differences and also avoids overflow in
issue-38591.rs.

4 years agoSet RUST_BACKTRACE=0 in tests that include a backtrace in stderr
Aaron Hill [Wed, 2 Oct 2019 19:23:22 +0000 (15:23 -0400)]
Set RUST_BACKTRACE=0 in tests that include a backtrace in stderr

This removes the implicit dependency on the environment variables set
when running `./x.py test`

4 years agoAdd test for LinkedList clone_from
Charles Gleason [Wed, 2 Oct 2019 19:18:31 +0000 (15:18 -0400)]
Add test for LinkedList clone_from

4 years agoavoid using `skip_binder` and instead look for bound vars properly
Niko Matsakis [Wed, 2 Oct 2019 19:07:38 +0000 (15:07 -0400)]
avoid using `skip_binder` and instead look for bound vars properly

4 years agoAvoid ICE on ReFree region from malformed code
Esteban Küber [Tue, 1 Oct 2019 01:34:48 +0000 (18:34 -0700)]
Avoid ICE on ReFree region from malformed code

4 years agos/`async` fn/`async fn`/
Niko Matsakis [Wed, 2 Oct 2019 18:39:44 +0000 (14:39 -0400)]
s/`async` fn/`async fn`/

4 years agodocument `shallow_resolve`
Niko Matsakis [Wed, 2 Oct 2019 18:35:01 +0000 (14:35 -0400)]
document `shallow_resolve`

4 years agodocument `ret_coercion` and `ret_coercion_span`
Niko Matsakis [Wed, 2 Oct 2019 18:32:19 +0000 (14:32 -0400)]
document `ret_coercion` and `ret_coercion_span`

4 years agoAuto merge of #65009 - Centril:rollup-06g05xj, r=Centril
bors [Wed, 2 Oct 2019 18:28:11 +0000 (18:28 +0000)]
Auto merge of #65009 - Centril:rollup-06g05xj, r=Centril

Rollup of 13 pull requests

Successful merges:

 - #64581 (Fix unreachable_code warnings for try{} block ok-wrapped expressions)
 - #64850 (Remove inlines from DepNode code)
 - #64914 (regression test for 64453 borrow check error.)
 - #64922 (Use PlaceBuilder to avoid a lot of slice -> vec -> slice convertions)
 - #64948 (Improve sidebar styling to make its integration easier)
 - #64961 (Make comment about dummy type a bit more clear)
 - #64967 (Don't mark borrows of zero-sized arrays as indirectly mutable)
 - #64973 (Fix typo while setting `compile-flags` in test)
 - #64980 (Enable support for `IndirectlyMutableLocals` in `rustc_peek` )
 - #64989 (Fix ICE #64964)
 - #64991 ([const-prop] Correctly handle locals that can't be propagated)
 - #64995 (Remove rustdoc warning)
 - #64997 (rustc book: nitpick SLP vectorization)

Failed merges:

r? @ghost

4 years agoimprove comments on `GeneratorKind` and `AsyncGeneratorKind`
Niko Matsakis [Wed, 2 Oct 2019 18:24:43 +0000 (14:24 -0400)]
improve comments on `GeneratorKind` and `AsyncGeneratorKind`

4 years agocorrect coercion comments
Niko Matsakis [Wed, 2 Oct 2019 18:23:36 +0000 (14:23 -0400)]
correct coercion comments

4 years agoWIP fix tests
Niko Matsakis [Wed, 2 Oct 2019 18:17:38 +0000 (14:17 -0400)]
WIP fix tests

4 years agoCompare primary with value instead of dropping it
AnthonyMikh [Wed, 2 Oct 2019 16:48:21 +0000 (19:48 +0300)]
Compare primary with value instead of dropping it

4 years agoRollup merge of #64997 - rust-lang:nitpick-slp, r=jonas-schievink
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:46 +0000 (18:24 +0200)]
Rollup merge of #64997 - rust-lang:nitpick-slp, r=jonas-schievink

rustc book: nitpick SLP vectorization

SLP vectorization (in general and as implemented in LLVM) is not limited to loops.

4 years agoRollup merge of #64995 - GuillaumeGomez:libtest-rustdoc-warning, r=Mark-Simulacrum
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:45 +0000 (18:24 +0200)]
Rollup merge of #64995 - GuillaumeGomez:libtest-rustdoc-warning, r=Mark-Simulacrum

Remove rustdoc warning

Removes this warning:

```bash
    Finished release [optimized] target(s) in 2.62s
 Documenting core v0.0.0 (/home/imperio/rust/rust/src/libcore)
    Finished release [optimized] target(s) in 15.23s
 Documenting std v0.0.0 (/home/imperio/rust/rust/src/libstd)
    Finished release [optimized] target(s) in 17.30s
 Documenting proc_macro v0.0.0 (/home/imperio/rust/rust/src/libproc_macro)
    Finished release [optimized] target(s) in 2.36s
 Documenting test v0.0.0 (/home/imperio/rust/rust/src/libtest)
warning: `[0]` cannot be resolved, ignoring it...
    --> src/libtest/lib.rs:1112:41
     |
1112 |     /// supplied channel. Requires argv[0] to exist and point to the binary
     |                                         ^ cannot be resolved, ignoring
     |
     = note: `#[warn(intra_doc_link_resolution_failure)]` on by default
     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

    Finished release [optimized] target(s) in 1.64s
Build completed successfully in 0:02:07
```

4 years agoRollup merge of #64991 - wesleywiser:fix_too_eager_const_prop, r=oli-obk
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:43 +0000 (18:24 +0200)]
Rollup merge of #64991 - wesleywiser:fix_too_eager_const_prop, r=oli-obk

[const-prop] Correctly handle locals that can't be propagated

`const_prop()` now handles writing the Rvalue into the Place in the
stack frame for us. So if we're not supposed to propagate that value,
we need to clear it.

r? @oli-obk

Fixes #64970

4 years agoRollup merge of #64989 - sinkuu:fix_ice_64964, r=davidtwco
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:42 +0000 (18:24 +0200)]
Rollup merge of #64989 - sinkuu:fix_ice_64964, r=davidtwco

Fix ICE #64964

Fixes #64964, which is an ICE with `await`ing in a method + incr-comp.

4 years agoRollup merge of #64980 - ecstatic-morse:better-rustc-peek, r=oli-obk
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:41 +0000 (18:24 +0200)]
Rollup merge of #64980 - ecstatic-morse:better-rustc-peek, r=oli-obk

Enable support for `IndirectlyMutableLocals` in `rustc_peek`

This PR allows `rustc_peek` tests to be written for the `IndirectlyMutableLocals` analysis implemented in #64470. See any of the tests in [`test/ui/mir-dataflow`](https://github.com/rust-lang/rust/blob/master/src/test/ui/mir-dataflow/inits-1.rs) for an example.

Included in this PR is a major rewrite of the `rustc_peek` module. This was motivated by the differences between the `IndirectlyMutableLocals` analysis and the initialized places ones.

To properly test `IndirectlyMutableLocals`, we must pass locals by-value to `rustc_peek`, since any local that is not `Freeze` will be marked as indirectly mutable as soon as a reference to it is taken. Unfortunately, `UnsafeCell` is not `Copy`, so we can only do one `rustc_peek` on each value with interior mutability inside a test. I'm not sure how to deal with this restriction; perhaps I need to special case borrows preceding a call to `rustc_peek` in the analysis itself?

`rustc_peek` also assumed that the analysis was done on move paths and that its transfer function only needed to be applied at assignment statements. This PR removes both of those restrictions by adding a trait, `RustcPeekAt`, that controls how the peeked at `Place` maps to the current dataflow state and using a dataflow cursor to retrieve the state itself.

Finally, this PR adds a test which demonstrates some unsoundness in the `IndirectlyMutableLocals` analysis by converting a reference to a `Freeze` field to a reference to a `!Freeze` field by offsetting a pointer (or in this case transmuting a pointer to a ZST field with the same address as a `!Freeze` field). This does not represent a hole in the language proper, since this analysis is only used to validate `const` bodies, in which the unsound code will only compile with `-Zunleash-the-miri-inside-of-you`. Nevertheless, this should get fixed.

r? @oli-obk

4 years agoRollup merge of #64973 - ecstatic-morse:fix-debuginfo-test, r=alexcrichton
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:39 +0000 (18:24 +0200)]
Rollup merge of #64973 - ecstatic-morse:fix-debuginfo-test, r=alexcrichton

Fix typo while setting `compile-flags` in test

This test is meant to check for an ICE when generating debug info, but didn't actually pass `-g` due to the typo.

I also removed the `FIXME`, since this needs to actually be built (not just checked) to trigger the ICE.

4 years agoRollup merge of #64967 - ecstatic-morse:issue-64945, r=oli-obk
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:38 +0000 (18:24 +0200)]
Rollup merge of #64967 - ecstatic-morse:issue-64945, r=oli-obk

Don't mark borrows of zero-sized arrays as indirectly mutable

Resolves #64945

r? @oli-obk

4 years agoRollup merge of #64961 - rust-lang:spastorino-patch-1, r=oli-obk
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:36 +0000 (18:24 +0200)]
Rollup merge of #64961 - rust-lang:spastorino-patch-1, r=oli-obk

Make comment about dummy type a bit more clear

4 years agoRollup merge of #64948 - GuillaumeGomez:improve-sidebar-styling, r=Mark-Simulacrum
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:35 +0000 (18:24 +0200)]
Rollup merge of #64948 - GuillaumeGomez:improve-sidebar-styling, r=Mark-Simulacrum

Improve sidebar styling to make its integration easier

Part of https://github.com/rust-lang/docs.rs/issues/417

Setting the height was an error: forcing the element bottom to be at the bottom allows to change to top of the sidebar.

r? @Mark-Simulacrum

4 years agoRollup merge of #64922 - spastorino:make-place-builder, r=nikomatsakis
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:33 +0000 (18:24 +0200)]
Rollup merge of #64922 - spastorino:make-place-builder, r=nikomatsakis

Use PlaceBuilder to avoid a lot of slice -> vec -> slice convertions

r? @oli-obk

4 years agoRollup merge of #64914 - pnkfelix:issue-64453-regression-test, r=nikomatsakis
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:31 +0000 (18:24 +0200)]
Rollup merge of #64914 - pnkfelix:issue-64453-regression-test, r=nikomatsakis

regression test for 64453 borrow check error.

Fix #64453

4 years agoRollup merge of #64850 - Mark-Simulacrum:dedup-dep-node, r=michaelwoerister
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:30 +0000 (18:24 +0200)]
Rollup merge of #64850 - Mark-Simulacrum:dedup-dep-node, r=michaelwoerister

Remove inlines from DepNode code

4 years agoRollup merge of #64581 - ztlpn:fix-ok-wrapping-unreachable-code, r=Centril
Mazdak Farrokhzad [Wed, 2 Oct 2019 16:24:29 +0000 (18:24 +0200)]
Rollup merge of #64581 - ztlpn:fix-ok-wrapping-unreachable-code, r=Centril

Fix unreachable_code warnings for try{} block ok-wrapped expressions

Fixes #54165 and fixes #63324.

4 years agoUse zipped iterators in clone_from for LinkedList
Charles Gleason [Wed, 2 Oct 2019 15:29:12 +0000 (11:29 -0400)]
Use zipped iterators in clone_from for LinkedList

4 years agoReplace mentions of IRC with Discord
BO41 [Wed, 2 Oct 2019 15:28:48 +0000 (17:28 +0200)]
Replace mentions of IRC with Discord

4 years agoUpdate llvm-project submodule
Alex Crichton [Wed, 2 Oct 2019 14:47:38 +0000 (07:47 -0700)]
Update llvm-project submodule

Bring in rust-lang/llvm-project#24 which brings in some wasm
improvements related to the bulk-memory proposal

4 years agoWIP rebase for `shallow_resolve` call
Niko Matsakis [Wed, 2 Oct 2019 14:39:58 +0000 (10:39 -0400)]
WIP rebase for `shallow_resolve` call

4 years agoWIP tidy hir/lowering/expr.rs
Niko Matsakis [Wed, 2 Oct 2019 14:33:07 +0000 (10:33 -0400)]
WIP tidy hir/lowering/expr.rs

4 years agoextract expected return type from `-> impl Future` obligation
Niko Matsakis [Wed, 2 Oct 2019 14:03:40 +0000 (10:03 -0400)]
extract expected return type from `-> impl Future` obligation

4 years agoimproved debug output
Niko Matsakis [Wed, 2 Oct 2019 13:10:06 +0000 (09:10 -0400)]
improved debug output

4 years agothread down the body so we can check if this is an async fn body
Niko Matsakis [Wed, 25 Sep 2019 14:46:28 +0000 (10:46 -0400)]
thread down the body so we can check if this is an async fn body

4 years agotrack the kind of async generator we are creating
Niko Matsakis [Wed, 25 Sep 2019 14:26:54 +0000 (10:26 -0400)]
track the kind of async generator we are creating

4 years agoFilter out RLS output directories on tidy runs
Santiago Pastorino [Wed, 2 Oct 2019 14:02:14 +0000 (11:02 -0300)]
Filter out RLS output directories on tidy runs

4 years agoUse PlaceBuilder to avoid a lot of slice -> vec -> slice convertions
Santiago Pastorino [Mon, 30 Sep 2019 16:09:10 +0000 (13:09 -0300)]
Use PlaceBuilder to avoid a lot of slice -> vec -> slice convertions

4 years agorustc book: nitpick SLP vectorization
Robin Kruppe [Wed, 2 Oct 2019 12:41:49 +0000 (14:41 +0200)]
rustc book: nitpick SLP vectorization

SLP vectorization (in general and as implemented in LLVM) is not limited to loops.