1
Fork 0

Rollup merge of #97023 - cjgillot:uniform-anon, r=estebank

Diagnose anonymous lifetimes errors more uniformly between async and regular fns

Async fns and regular fns are desugared differently.  For the former, we create a generic parameter at HIR level.  For the latter, we just create an anonymous region for typeck.

I plan to migrate regular fns to the async fn desugaring.

Before that, this PR attempts to merge the diagnostics for both cases.

r? ```@estebank```
This commit is contained in:
Dylan DPC 2022-06-02 11:13:22 +02:00 committed by GitHub
commit 5c041f98fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 628 additions and 202 deletions

View file

@ -131,6 +131,17 @@ impl LifetimeName {
}
}
pub fn is_anonymous(&self) -> bool {
match *self {
LifetimeName::ImplicitObjectLifetimeDefault
| LifetimeName::Implicit
| LifetimeName::Underscore
| LifetimeName::Param(ParamName::Fresh(_))
| LifetimeName::Error => true,
LifetimeName::Static | LifetimeName::Param(_) => false,
}
}
pub fn is_elided(&self) -> bool {
match self {
LifetimeName::ImplicitObjectLifetimeDefault