From 11f86641829273e2b2b7023c2028bb475fce58ee Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 11 Dec 2020 13:49:32 +0100 Subject: Add Lifetimes to the HIR --- crates/hir_def/src/path/lower.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'crates/hir_def/src/path/lower.rs') diff --git a/crates/hir_def/src/path/lower.rs b/crates/hir_def/src/path/lower.rs index 07b9723ce..60fa7646b 100644 --- a/crates/hir_def/src/path/lower.rs +++ b/crates/hir_def/src/path/lower.rs @@ -15,7 +15,7 @@ use super::AssociatedTypeBinding; use crate::{ body::LowerCtx, path::{GenericArg, GenericArgs, ModPath, Path, PathKind}, - type_ref::{TypeBound, TypeRef}, + type_ref::{LifetimeRef, TypeBound, TypeRef}, }; pub(super) use lower_use::lower_use_tree; @@ -170,8 +170,14 @@ pub(super) fn lower_generic_args( bindings.push(AssociatedTypeBinding { name, type_ref, bounds }); } } - // Lifetimes and constants are ignored for now. - ast::GenericArg::LifetimeArg(_) | ast::GenericArg::ConstArg(_) => (), + ast::GenericArg::LifetimeArg(lifetime_arg) => { + if let Some(lifetime) = lifetime_arg.lifetime_token() { + let lifetime_ref = LifetimeRef::from_token(lifetime); + args.push(GenericArg::Lifetime(lifetime_ref)) + } + } + // constants are ignored for now. + ast::GenericArg::ConstArg(_) => (), } } -- cgit v1.2.3