-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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 #92710 - jackh726:issue-92280, r=nikomatsakis
Include Projections when elaborating TypeOutlives Fixes #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
92 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
18 changes: 18 additions & 0 deletions
18
src/test/ui/generic-associated-types/issue-92096.migrate.stderr
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:20: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:20: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,29 @@ | ||
// edition:2018 | ||
// [nll] check-pass | ||
// revisions: migrate nll | ||
// Explicitly testing nll with revision, so ignore compare-mode=nll | ||
// ignore-compare-mode-nll | ||
|
||
#![cfg_attr(nll, feature(nll))] | ||
#![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 | ||
//[migrate]~^ ERROR the parameter | ||
//[migrate]~| 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,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() {} |