rust/src/test
bors 8301de16da Auto merge of #61775 - nikomatsakis:issue-56238-multiple-lifetimes-async-fn-region-solver, r=MatthewJasper
generalize impl trait to permit multiple lifetime bounds

Generalizes the region solver to support "pick constraints". These have the form:

```
pick R0 from [R1..Rn]
```

where `R1..Rn` are called the "option regions". The idea is that `R0` must be equal to *some* region in the set `R1..Rn`. These constraints are then used to handle cases like this:

```rust
fn foo<'a, 'b>(...) -> impl Trait<'a, 'b> { .. }
```

The problem here is that every region R in the hidden type must be equal to *either* `'a` *or* `'b` (or `'static`) -- in the past, the only kinds of constraints we had were outlives constraints, and since `'a` and `'b` are unrelated, there was no outlives constraint we could issue that would enforce that (`R: 'a` and `R: 'b` are both too strict, for example). But now we can issue a pick constraint: `pick R from ['a, 'b]`.

In general, solving pick constraints is tricky. We integrate them into the solver as follows. In general, during the propagation phase, we are monotonically growing a set of inference regions. To handle a case like `pick R from [O...]`, where `O...` represents the option regions, we do the following:

- Look for all the *lower bounds* of the region R -- that is, every region LB such that `R: LB` must hold.
- Look for all the *upper bounds* of the region R -- that is, every region UB such that `UB: R` must hold.
- Let the *viable options* be each option region O such that `UB: O` and `O: LB` for each UB, LB bound.
- Find the *minimal viable option* M, where `O: M` holds for every option region O.

If there is such a *minimal viable option*, then we make `R: M`. (This may in turn influence other bits of inference.) If there is no minimal viable option, either because all options were eliminated or because none of the remaining options are minimal, we do nothing. Ultimately, if the pick constraint is not satisfied, an error is reported.

For this logic, we currently require that the option regions O are always lifetime parameters. To determine the bounds, we walk the various outlives edges that were otherwise introduced.

r? @matthewjasper
cc @cramertj

Fixes #56238

TODO:

- [ ] Error messages include region variable info sometimes, how to fix?
- [ ] Tests for bare `existential type`  and other impl Trait usage
2019-07-03 03:47:47 +00:00
..
assembly Ignore NVPTX tests 2019-06-12 23:09:08 +02:00
auxiliary Expose VaListImpl as the Rust equivalent of __va_list_tag and implement Clone for it. 2019-06-17 16:04:49 -07:00
codegen Stabilize profile-guided optimization. 2019-06-21 09:54:58 +02:00
codegen-units Remove unnecessary ignore-tidy-linelength 2019-04-23 11:42:14 +01:00
compile-fail Auto merge of #60341 - mtak-:macos-tlv-workaround, r=alexcrichton 2019-06-20 02:36:49 +00:00
debuginfo Fix CDB support tidy check line length failures. 2019-05-20 02:44:26 -07:00
incremental Auto merge of #61778 - petrochenkov:pass, r=Mark-Simulacrum 2019-06-23 17:16:22 +00:00
mir-opt Add StorageDead statements for while conditions 2019-06-25 22:41:22 +01:00
pretty Introduce #[rustc_dummy] attribute and use it in tests 2019-06-08 23:55:25 +03:00
run-fail compiletest: Validate pass modes harder 2019-06-16 12:23:22 +03:00
run-make Make tests compatible with musl host 2019-05-10 16:12:47 +02:00
run-make-fulldeps Stabilize profile-guided optimization. 2019-06-21 09:54:58 +02:00
run-pass Auto merge of #61922 - tmandry:moar-generator-optimization, r=matthewjasper 2019-07-02 12:25:00 +00:00
run-pass-fulldeps let_chains: Add test cases to pprust-expr-roundtrip. 2019-06-23 01:29:29 +02:00
run-pass-valgrind Added ignore-sgx for appropriate tests 2019-05-16 14:29:12 -07:00
rustdoc Revert "implicit Option-returning doctests" 2019-07-01 16:41:37 +02:00
rustdoc-js Auto merge of #59910 - Centril:rollup-yjv7b06, r=Centril 2019-04-12 11:46:01 +00:00
rustdoc-js-std
rustdoc-ui Fix tests after revert of rustdoc cfg(test) feature 2019-06-08 18:26:06 +01:00
rustfix
ui fix ICE with delay-span-bug 2019-07-02 14:23:38 -04:00
ui-fulldeps Unify all uses of 'gcx and 'tcx. 2019-06-14 18:58:23 +03:00
COMPILER_TESTS.md