forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#92710 - jackh726:issue-92280, r=nikomatsakis
Include Projections when elaborating TypeOutlives Fixes rust-lang#92280 In `Elaborator`, we elaborate that `Foo<<Bar as Baz>::Assoc>: 'a` -> `<Bar as Baz>::Assoc: 'a`. This is the same rule that would be applied to any other `Param`. If there are escaping vars, we continue to do nothing. r? `@nikomatsakis`
- Loading branch information
Showing
6 changed files
with
90 additions
and
6 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,27 @@ | ||
// edition:2018 | ||
// check-fail | ||
// FIXME(generic_associated_types): this should pass, but we end up | ||
// essentially requiring that `for<'s> C: 's` | ||
|
||
#![feature(generic_associated_types)] | ||
|
||
use std::future::Future; | ||
|
||
trait Client { | ||
type Connecting<'a>: Future + Send | ||
where | ||
Self: 'a; | ||
|
||
fn connect(&'_ self) -> Self::Connecting<'_>; | ||
} | ||
|
||
fn call_connect<C>(c: &'_ C) -> impl '_ + Future + Send | ||
//~^ ERROR the parameter | ||
//~| ERROR the parameter | ||
where | ||
C: Client + Send + Sync, | ||
{ | ||
async move { c.connect().await } | ||
} | ||
|
||
fn main() {} |
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,18 @@ | ||
error[E0311]: the parameter type `C` may not live long enough | ||
--> $DIR/issue-92096.rs:18:33 | ||
| | ||
LL | fn call_connect<C>(c: &'_ C) -> impl '_ + Future + Send | ||
| - ^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds | ||
| | | ||
| help: consider adding an explicit lifetime bound...: `C: 'a` | ||
|
||
error[E0311]: the parameter type `C` may not live long enough | ||
--> $DIR/issue-92096.rs:18:33 | ||
| | ||
LL | fn call_connect<C>(c: &'_ C) -> impl '_ + Future + Send | ||
| - ^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds | ||
| | | ||
| help: consider adding an explicit lifetime bound...: `C: 'a` | ||
|
||
error: aborting due to 2 previous errors | ||
|
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,26 @@ | ||
// check-pass | ||
|
||
#![feature(generic_associated_types)] | ||
#![allow(non_camel_case_types)] | ||
|
||
trait HasAssoc { | ||
type Assoc; | ||
} | ||
|
||
trait Iterate<S: HasAssoc> { | ||
type Iter<'a> | ||
where | ||
Self: 'a; | ||
} | ||
|
||
struct KeySegment_Broken<T> { | ||
key: T, | ||
} | ||
impl<S: HasAssoc> Iterate<S> for KeySegment_Broken<S::Assoc> { | ||
type Iter<'a> | ||
where | ||
Self: 'a, | ||
= (); | ||
} | ||
|
||
fn main() {} |