Rollup merge of #113164 - JohnTitor:issue-109054, r=compiler-errors

Add a regression test for #109054

Closes #109054
r? ``@compiler-errors``
This commit is contained in:
Michael Goulet 2023-07-06 20:11:39 -07:00 committed by GitHub
commit 1cb31e71d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,22 @@
// edition:2021
#![feature(type_alias_impl_trait)]
struct CallMe;
type ReturnType<'a> = impl std::future::Future<Output = u32> + 'a;
type FnType = impl Fn(&u32) -> ReturnType;
impl std::ops::Deref for CallMe {
type Target = FnType;
fn deref(&self) -> &Self::Target {
fn inner(val: &u32) -> ReturnType {
async move { *val * 2 }
}
&inner //~ ERROR: expected generic lifetime parameter, found `'_`
}
}
fn main() {}

View File

@ -0,0 +1,12 @@
error[E0792]: expected generic lifetime parameter, found `'_`
--> $DIR/issue-109054.rs:18:9
|
LL | type ReturnType<'a> = impl std::future::Future<Output = u32> + 'a;
| -- this generic parameter must be used with a generic lifetime parameter
...
LL | &inner
| ^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0792`.