6896: Node-ify lifetimes r=jonas-schievink a=Veykril

Let's see if this passes the tests 🤞 

Depends on https://github.com/rust-analyzer/ungrammar/pull/15

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2020-12-16 17:08:03 +00:00 committed by GitHub
commit 067067a6c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
63 changed files with 420 additions and 274 deletions

View file

@ -260,9 +260,8 @@ impl GenericParams {
self.fill_bounds(&lower_ctx, &type_param, Either::Left(type_ref));
}
for lifetime_param in params.lifetime_params() {
let name = lifetime_param
.lifetime_token()
.map_or_else(Name::missing, |tok| Name::new_lifetime(&tok));
let name =
lifetime_param.lifetime().map_or_else(Name::missing, |lt| Name::new_lifetime(&lt));
let param = LifetimeParamData { name: name.clone() };
let param_id = self.lifetimes.alloc(param);
sm.lifetime_params.insert(param_id, lifetime_param.clone());
@ -275,8 +274,8 @@ impl GenericParams {
for pred in where_clause.predicates() {
let target = if let Some(type_ref) = pred.ty() {
Either::Left(TypeRef::from_ast(lower_ctx, type_ref))
} else if let Some(lifetime_tok) = pred.lifetime_token() {
Either::Right(LifetimeRef::from_token(lifetime_tok))
} else if let Some(lifetime) = pred.lifetime() {
Either::Right(LifetimeRef::new(&lifetime))
} else {
continue;
};