Commit graph

72497 commits

Author SHA1 Message Date
Niko Matsakis
4f43c5b1e7 stop dumping DefPath into "failed type test" errors
The prior messages were not stable across platforms.
2017-12-15 17:04:48 -05:00
Niko Matsakis
0f8ef0ca1a more concise debug output when dumping the value of a region 2017-12-15 10:27:54 -05:00
Niko Matsakis
0d6bd42abb make blame_span deterministic 2017-12-15 10:27:54 -05:00
Niko Matsakis
a118afe7ca add a test regarding relating closure and fn generics
Turns out this works but we had no test targeting it.
2017-12-15 10:27:53 -05:00
Niko Matsakis
e9824c50ed impose inputs/ouputs on MIR after the fact
The input/output types found in `UniversalRegions` are not normalized.
The old code used to assign them directly into the MIR, which would
lead to errors when there was a projection in a argument or return
type. This also led to some special cases in the `renumber` code.

We now renumber uniformly but then pass the input/output types into
the MIR type-checker, which equates them with the types found in MIR.
This allows us to normalize at the same time.
2017-12-15 10:27:53 -05:00
Niko Matsakis
3fcb13ae45 handle projections with regions 2017-12-15 10:27:52 -05:00
Niko Matsakis
3a5842afe1 add a new RegionKind variant: ReClosureBound
This is needed to allow the `ClosureRegionRequirements` to capture
types that include regions.
2017-12-15 10:27:52 -05:00
Niko Matsakis
85e1d4749e propagate type tests from closure to closure creators
Currently, we only propagate type tests that exclude all regions from
the type.
2017-12-15 10:27:51 -05:00
Niko Matsakis
5804637a81 permit ClosureOutlivesRequirement to constrain regions or types 2017-12-15 10:27:51 -05:00
Niko Matsakis
c7cfa2367b thread through an implicit region body of the fn body 2017-12-15 10:27:50 -05:00
Niko Matsakis
154cd94197 rework region flags: 'static can be erased too
The existing flags did not consider `'static` to be "free". This then
fed into what was "erasable" -- but `'static` is most certainly
erasable.
2017-12-15 10:27:50 -05:00
Niko Matsakis
02e65250e4 mild refactors of the control flow (no functional changes)
In the future, `check_type_tests` will also potentially propagate
constriants to its caller.
2017-12-15 10:27:49 -05:00
Niko Matsakis
47c1921b9a move some parts of liveness to happen during type checking
This allows us to re-use the `normalize` method on `TypeCheck`, which
is important since normalization may create fresh region
variables. This is not an ideal solution, though, since the current
representation of "liveness constraints" (a vector of (region, point)
pairs) is rather inefficient. Could do somewhat better by converting
to indices, but it'd still be less good than the older code. Unclear
how important this is.
2017-12-15 10:27:49 -05:00
Niko Matsakis
4a940b3215 move flow_in_progress into dataflow and document it 2017-12-15 10:27:46 -05:00
Niko Matsakis
ebd086b67f move LivenessResults from nll into liveness analysis 2017-12-15 10:10:57 -05:00
Niko Matsakis
1c57468840 move type_check out of transform and into the nll module 2017-12-15 10:10:57 -05:00
Niko Matsakis
fad3d1d7fd dfs.rs: rustfmt 2017-12-15 10:10:56 -05:00
Niko Matsakis
6193c5cc2a translate Verifys into TypeTests and check them 2017-12-15 10:10:56 -05:00
Niko Matsakis
cd564d20ff only propagate ClosureRegionRequirements if non-trivial
Before, we would always have a `Some` ClosureRegionRequirements if we
were inferring values for a closure. Now we only do is it has a
non-empty set of outlives requirements.
2017-12-15 10:10:56 -05:00
Niko Matsakis
a0f0392a6d rename copy to dfs and make it customizable 2017-12-15 10:10:55 -05:00
Niko Matsakis
86334c7116 remove unnecessary intermediate vector from copy 2017-12-15 10:10:55 -05:00
bors
b4f323254a Auto merge of #46706 - sunjay:gat-lifetimes, r=nikomatsakis
Lifetime Resolution for Generic Associated Types

Tracking Issue: https://github.com/rust-lang/rust/issues/44265

r? @nikomatsakis

This PR implements lifetime resolution for generic associated types. 🎉

## Remaining Work Before Merge

I'm going to go do these things in the next day or so. Please let me know if you spot anything in my changes until then.

- [x] If I'm not mistaken, at least some tests should pass now. I need to go through the tests and re-enable the ones that should work by removing the appropriate `~ ERROR` comments
2017-12-15 10:50:20 +00:00
bors
04b23449c0 Auto merge of #46653 - estebank:str-as-ch, r=petrochenkov
When attempting to write str with single quote suggest double quotes

Fix #26101.
2017-12-15 08:13:37 +00:00
Esteban Küber
c60aab29f1 When attempting to write str with single quote suggest double quotes 2017-12-14 22:51:42 -08:00
bors
84feab34e4 Auto merge of #46537 - pnkfelix:two-phase-borrows, r=arielb1
[MIR-borrowck] Two phase borrows

This adds limited support for two-phase borrows as described in
  http://smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/

The support is off by default; you opt into it via the flag `-Z two-phase-borrows`

I have written "*limited* support" above because there are simple variants of the simple `v.push(v.len())` example that one would think should work but currently do not, such as the one documented in the test compile-fail/borrowck/two-phase-reservation-sharing-interference-2.rs

(To be clear, that test is not describing something that is unsound. It is just providing an explicit example of a limitation in the implementation given in this PR. I have ideas on how to fix, but I want to land the work that is in this PR first, so that I can stop repeatedly rebasing this branch.)
2017-12-15 05:40:12 +00:00
bors
9331031909 Auto merge of #46701 - eddyb:vector-newtypes, r=nagisa
rustc: unpack newtyped of #[repr(simd)] vector types.

Prerequisite for a `#[repr(transparent)]` implementation that works with SIMD vectors.

cc @rkruppe
2017-12-15 02:59:27 +00:00
bors
2f351415e5 Auto merge of #46641 - petrochenkov:nohelp2, r=nikomatsakis
Move compile-fail tests with NOTE/HELP annotations to UI

Remove NOTE/HELP annotations from UI tests

cc https://github.com/rust-lang/rust/issues/44844 @oli-obk @est31
r? @nikomatsakis
2017-12-15 00:11:40 +00:00
Felix S. Klock II
159037e053 Address review feedback: don't treat "first" activation special.
Instead, filter out (non-)conflicts of activiations with themselves in
the same manner that we filter out non-conflict between an activation
and its reservation.
2017-12-14 17:34:16 -06:00
Felix S. Klock II
d654cd3b8b Review feedback: Added test with control flow merge of two borrows "before activation"
In reality the currently generated MIR has at least one of the activations
in a copy that occurs before the merge. But still, good to have a test,
in anticipation of that potentially changing...
2017-12-14 16:30:05 -06:00
Felix S. Klock II
b0421fa7de Address review feedback: don't bother skipping reservations paired with activations. 2017-12-14 16:28:26 -06:00
bors
0077d128d3 Auto merge of #45047 - durka:trait-alias, r=petrochenkov
trait alias infrastructure

This will be an implementation of trait aliases (RFC 1733, #41517).

Progress so far:

- [x] Feature gate
- [x] Add to parser
  - [x] `where` clauses
    - [x] prohibit LHS type parameter bounds via AST validation https://github.com/rust-lang/rust/pull/45047#discussion_r143575575
- [x] Add to AST and HIR
  - [x] make a separate PathSource for trait alias contexts https://github.com/rust-lang/rust/pull/45047#discussion_r143353932
- [x] Stub out enough of typeck and resolve to just barely not ICE

Postponed:

- [ ] Actually implement the alias part
- [ ] #21903
- [ ] #24010

I need some pointers on where to start with that last one. The test currently does this:

```
error[E0283]: type annotations required: cannot resolve `_: CD`
  --> src/test/run-pass/trait-alias.rs:34:16
   |
34 |     let both = foo();
   |                ^^^
   |
   = note: required by `foo`
```
2017-12-14 20:57:09 +00:00
Vadim Petrochenkov
66bd53ad2a Fix rebase
Update docs for custom normalization of test output
2017-12-14 23:54:08 +03:00
Vadim Petrochenkov
c3a7d36c6e Support regexes in custom normalization in UI tests 2017-12-14 23:26:40 +03:00
Vadim Petrochenkov
3fe1d9c524 Do the same things for fulldeps tests 2017-12-14 23:26:40 +03:00
Vadim Petrochenkov
1f5b201aff Remove NOTE/HELP annotations from UI tests 2017-12-14 23:26:39 +03:00
Vadim Petrochenkov
d4e51a8fb2 Move compile-fail tests with NOTE/HELP annotations to UI 2017-12-14 23:23:07 +03:00
Vadim Petrochenkov
3a2ad576c5 Remove NOTE/HELP annotations from error index tests 2017-12-14 23:23:07 +03:00
bors
3fc7f8522b Auto merge of #46562 - michaelwoerister:faster-span-hashing, r=eddyb
incr.comp.: Speed up span hashing by caching expansion context hashes.

This PR fixes the performance regressions from https://github.com/rust-lang/rust/pull/46338.

r? @nikomatsakis
2017-12-14 18:22:55 +00:00
Alex Burka
834674fa1d rls depends on rustfmt 2017-12-14 12:56:27 -05:00
Alex Burka
aaeae4c72e error for impl trait alias 2017-12-14 12:56:26 -05:00
Alex Burka
435fe5b794 trait alias fallout 2017-12-14 12:56:26 -05:00
Alex Burka
4f0b4f267f feature gate trait aliases 2017-12-14 12:56:26 -05:00
Alex Burka
4029a01984 error on any use of trait alias 2017-12-14 12:56:26 -05:00
Alex Burka
63f1c24d8a add trait aliases to typeck 2017-12-14 12:56:26 -05:00
Alex Burka
2eefc9db15 add trait aliases to HIR 2017-12-14 12:56:26 -05:00
Alex Burka
1b6ad1e647 stub out trait aliases in librustdoc 2017-12-14 12:56:26 -05:00
Alex Burka
46dc7c59de stub out trait aliases in save_analysis 2017-12-14 12:56:26 -05:00
Alex Burka
f1c4a922fe stub out trait aliases in resolve 2017-12-14 12:56:26 -05:00
Alex Burka
d4a28268cc add trait aliases to AST 2017-12-14 12:56:26 -05:00
Michael Woerister
0b4c2cccac incr.comp.: Do less hashing per Span. 2017-12-14 10:29:16 -06:00