diff options
| author | bors <bors@rust-lang.org> | 2018-07-26 15:23:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-07-26 15:23:50 +0000 |
| commit | bfbf8375d7b1a4f4fb8a5feb54ae132847d916ad (patch) | |
| tree | 9afeb7f75e66a7fb1bee1572a1f01de27c5662a1 /src/test/ui/impl-trait | |
| parent | fefe81605d6111faa8dbb3635ab2c51d59de740a (diff) | |
| parent | ce576ac259e98138f6e2f19e40a632c279c6a516 (diff) | |
| download | rust-bfbf8375d7b1a4f4fb8a5feb54ae132847d916ad.tar.gz rust-bfbf8375d7b1a4f4fb8a5feb54ae132847d916ad.zip | |
Auto merge of #52488 - nikomatsakis:nll-issue-48071-universe-and-sub, r=pnkfelix
introduce universes to NLL type check This branch aims to fix #48071 and also advance chalk integration a bit at the same time. It re-implements the subtyping/type-equating check so that NLL doesn't "piggy back" on the subtyping code of the old type checker. This new code uses the "universe-based" approach to handling higher-ranked lifetimes, which sidesteps some of the limitations of the current "leak-based" scheme. This avoids the ICE in #48071. At the same time, I aim for this to potentially be a kind of optimization. This NLL code is (currently) not cached, but it also generates constraints without doing as much instantiation, substitution, and folding. Right now, though, it still piggy backs on the `relate_tys` trait, which is a bit unfortunate -- it means we are doing more hashing and things than we have to. I want to measure the see the perf. Refactoring that trait is something I'd prefer to leave for follow-up work. r? @pnkfelix -- but I want to measure perf etc first
Diffstat (limited to 'src/test/ui/impl-trait')
| -rw-r--r-- | src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr index 4c0b3a5d931..c6f8d2e519c 100644 --- a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr +++ b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr @@ -10,19 +10,21 @@ warning: not reporting region error due to nll LL | self.x.iter().map(|a| a.0) | ^^^^ -error: unsatisfied lifetime constraints +error: borrowed data escapes outside of closure --> $DIR/static-return-lifetime-infered.rs:17:9 | LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> { - | - let's call the lifetime of this reference `'1` + | ----- `self` is a reference that is only valid in the closure body LL | self.x.iter().map(|a| a.0) - | ^^^^^^ cast requires that `'1` must outlive `'static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `self` escapes the closure body here -error: unsatisfied lifetime constraints +error: borrowed data escapes outside of closure --> $DIR/static-return-lifetime-infered.rs:21:9 | +LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> { + | -------- `self` is a reference that is only valid in the closure body LL | self.x.iter().map(|a| a.0) - | ^^^^^^ cast requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `self` escapes the closure body here error: aborting due to 2 previous errors |
