-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rework so that we pick static as a last resort only
- Loading branch information
1 parent
b893cff
commit 92b2be2
Showing
4 changed files
with
89 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Regression test found by crater run. The scenario here is that we have | ||
// a region variable `?0` from the `impl Future` with no upper bounds | ||
// and a member constraint of `?0 in ['a, 'static]`. If we pick `'static`, | ||
// however, we then fail the check that `F: ?0` (since we only know that | ||
// F: ?a). The problem here is that our upper bound detection | ||
// doesn't consider "type tests" like `F: 'x`. This was fixed by | ||
// preferring to pick a least choice and only using static as a last resort. | ||
// | ||
// edition:2018 | ||
// check-pass | ||
|
||
trait Future {} | ||
impl Future for () {} | ||
|
||
fn sink_error1<'a, F: 'a>(f: F) -> impl Future + 'a { | ||
sink_error2(f) // error: `F` may not live long enough | ||
} | ||
fn sink_error2<'a, F: 'a>(_: F) -> impl Future + 'a {} | ||
fn main() {} |